Skip to content

docs(tsdoc): add release tags to util-waiters #4512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/util-waiter/src/poller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { sleep } from "./utils/sleep";
import { WaiterOptions, WaiterResult, WaiterState } from "./waiter";

/**
* @internal
*
* Reference: https://smithy.io/2.0/additional-specs/waiters.html#waiter-retries
*/
const exponentialBackoffWithJitter = (minDelay: number, maxDelay: number, attemptCeiling: number, attempt: number) => {
Expand Down
3 changes: 3 additions & 0 deletions packages/util-waiter/src/utils/sleep.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @internal
*/
export const sleep = (seconds: number) => {
return new Promise((resolve) => setTimeout(resolve, seconds * 1000));
};
2 changes: 2 additions & 0 deletions packages/util-waiter/src/utils/validate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { WaiterOptions } from "../waiter";

/**
* @internal
*
* Validates that waiter options are passed correctly
* @param options a waiter configuration object
*/
Expand Down
15 changes: 13 additions & 2 deletions packages/util-waiter/src/waiter.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
import { WaiterConfiguration as WaiterConfiguration__ } from "@aws-sdk/types";

/**
* @internal
*/
export interface WaiterConfiguration<T> extends WaiterConfiguration__<T> {}

/**
* @private
* @internal
*/
export const waiterServiceDefaults = {
minDelay: 2,
maxDelay: 120,
};

/**
* @private
* @internal
*/
export type WaiterOptions<Client> = WaiterConfiguration<Client> &
Required<Pick<WaiterConfiguration<Client>, "minDelay" | "maxDelay">>;

/**
* @internal
*/
export enum WaiterState {
ABORTED = "ABORTED",
FAILURE = "FAILURE",
Expand All @@ -24,6 +30,9 @@ export enum WaiterState {
TIMEOUT = "TIMEOUT",
}

/**
* @internal
*/
export type WaiterResult = {
state: WaiterState;

Expand All @@ -34,6 +43,8 @@ export type WaiterResult = {
};

/**
* @internal
*
* Handles and throws exceptions resulting from the waiterResult
* @param result WaiterResult
*/
Expand Down