@aws-sdk/types 3.215.0 → 3.222.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist-cjs/index.js CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./abort"), exports);
5
5
  tslib_1.__exportStar(require("./auth"), exports);
6
+ tslib_1.__exportStar(require("./checksum"), exports);
6
7
  tslib_1.__exportStar(require("./client"), exports);
7
8
  tslib_1.__exportStar(require("./command"), exports);
8
9
  tslib_1.__exportStar(require("./credentials"), exports);
@@ -16,6 +17,7 @@ tslib_1.__exportStar(require("./middleware"), exports);
16
17
  tslib_1.__exportStar(require("./pagination"), exports);
17
18
  tslib_1.__exportStar(require("./profile"), exports);
18
19
  tslib_1.__exportStar(require("./response"), exports);
20
+ tslib_1.__exportStar(require("./retry"), exports);
19
21
  tslib_1.__exportStar(require("./serde"), exports);
20
22
  tslib_1.__exportStar(require("./shapes"), exports);
21
23
  tslib_1.__exportStar(require("./signature"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export {};
package/dist-es/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from "./abort";
2
2
  export * from "./auth";
3
+ export * from "./checksum";
3
4
  export * from "./client";
4
5
  export * from "./command";
5
6
  export * from "./credentials";
@@ -13,6 +14,7 @@ export * from "./middleware";
13
14
  export * from "./pagination";
14
15
  export * from "./profile";
15
16
  export * from "./response";
17
+ export * from "./retry";
16
18
  export * from "./serde";
17
19
  export * from "./shapes";
18
20
  export * from "./signature";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,50 @@
1
+ /**
2
+ * An object that provides a checksum of data provided in chunks to `update`.
3
+ * The checksum may be performed incrementally as chunks are received or all
4
+ * at once when the checksum is finalized, depending on the underlying
5
+ * implementation.
6
+ *
7
+ * It's recommended to compute checksum incrementally to avoid reading the
8
+ * entire payload in memory.
9
+ *
10
+ * A class that implements this interface may accept an optional secret key in its
11
+ * constructor while computing checksum value, when using HMAC. If provided,
12
+ * this secret key would be used when computing checksum.
13
+ */
14
+ export interface Checksum {
15
+ /**
16
+ * Constant length of the digest created by the algorithm in bytes.
17
+ */
18
+ digestLength?: number;
19
+ /**
20
+ * Creates a new checksum object that contains a deep copy of the internal
21
+ * state of the current `Checksum` object.
22
+ */
23
+ copy?(): Checksum;
24
+ /**
25
+ * Returns the digest of all of the data passed.
26
+ */
27
+ digest(): Promise<Uint8Array>;
28
+ /**
29
+ * Allows marking a checksum for checksums that support the ability
30
+ * to mark and reset.
31
+ *
32
+ * @param {number} readLimit - The maximum limit of bytes that can be read
33
+ * before the mark position becomes invalid.
34
+ */
35
+ mark?(readLimit: number): void;
36
+ /**
37
+ * Resets the checksum to its initial value.
38
+ */
39
+ reset(): void;
40
+ /**
41
+ * Adds a chunk of data for which checksum needs to be computed.
42
+ * This can be called many times with new data as it is streamed.
43
+ *
44
+ * Implementations may override this method which passes second param
45
+ * which makes Checksum object stateless.
46
+ *
47
+ * @param {Uint8Array} chunk - The buffer to update checksum with.
48
+ */
49
+ update(chunk: Uint8Array): void;
50
+ }
@@ -3,6 +3,8 @@ export declare type SourceData = string | ArrayBuffer | ArrayBufferView;
3
3
  * An object that provides a hash of data provided in chunks to `update`. The
4
4
  * hash may be performed incrementally as chunks are received or all at once
5
5
  * when the hash is finalized, depending on the underlying implementation.
6
+ *
7
+ * @deprecated use {@link Checksum}
6
8
  */
7
9
  export interface Hash {
8
10
  /**
@@ -1,5 +1,6 @@
1
1
  export * from "./abort";
2
2
  export * from "./auth";
3
+ export * from "./checksum";
3
4
  export * from "./client";
4
5
  export * from "./command";
5
6
  export * from "./credentials";
@@ -13,6 +14,7 @@ export * from "./middleware";
13
14
  export * from "./pagination";
14
15
  export * from "./profile";
15
16
  export * from "./response";
17
+ export * from "./retry";
16
18
  export * from "./serde";
17
19
  export * from "./shapes";
18
20
  export * from "./signature";
@@ -0,0 +1,112 @@
1
+ export declare type RetryErrorType =
2
+ /**
3
+ * This is a connection level error such as a socket timeout, socket connect
4
+ * error, tls negotiation timeout etc...
5
+ * Typically these should never be applied for non-idempotent request types
6
+ * since in this scenario, it's impossible to know whether the operation had
7
+ * a side effect on the server.
8
+ */
9
+ "TRANSIENT"
10
+ /**
11
+ * This is an error where the server explicitly told the client to back off,
12
+ * such as a 429 or 503 Http error.
13
+ */
14
+ | "THROTTLING"
15
+ /**
16
+ * This is a server error that isn't explicitly throttling but is considered
17
+ * by the client to be something that should be retried.
18
+ */
19
+ | "SERVER_ERROR"
20
+ /**
21
+ * Doesn't count against any budgets. This could be something like a 401
22
+ * challenge in Http.
23
+ */
24
+ | "CLIENT_ERROR";
25
+ export interface RetryErrorInfo {
26
+ errorType: RetryErrorType;
27
+ /**
28
+ * Protocol hint. This could come from Http's 'retry-after' header or
29
+ * something from MQTT or any other protocol that has the ability to convey
30
+ * retry info from a peer.
31
+ *
32
+ * @returns the Date after which a retry should be attempted.
33
+ */
34
+ retryAfterHint?: Date;
35
+ }
36
+ export interface RetryBackoffStrategy {
37
+ /**
38
+ * @returns the number of milliseconds to wait before retrying an action.
39
+ */
40
+ computeNextBackoffDelay(retryAttempt: number): number;
41
+ }
42
+ export interface StandardRetryBackoffStrategy extends RetryBackoffStrategy {
43
+ /**
44
+ * Sets the delayBase used to compute backoff delays.
45
+ * @param delayBase
46
+ */
47
+ setDelayBase(delayBase: number): void;
48
+ }
49
+ export interface RetryStrategyOptions {
50
+ backoffStrategy: RetryBackoffStrategy;
51
+ maxRetriesBase: number;
52
+ }
53
+ export interface RetryToken {
54
+ /**
55
+ * @returns the current count of retry.
56
+ */
57
+ getRetryCount(): number;
58
+ /**
59
+ * @returns the number of milliseconds to wait before retrying an action.
60
+ */
61
+ getRetryDelay(): number;
62
+ }
63
+ export interface StandardRetryToken extends RetryToken {
64
+ /**
65
+ * @returns wheather token has remaining tokens.
66
+ */
67
+ hasRetryTokens(errorType: RetryErrorType): boolean;
68
+ /**
69
+ * @returns the number of available tokens.
70
+ */
71
+ getRetryTokenCount(errorInfo: RetryErrorInfo): number;
72
+ /**
73
+ * @returns the cost of the last retry attemp.
74
+ */
75
+ getLastRetryCost(): number | undefined;
76
+ /**
77
+ * Releases a number of tokens.
78
+ *
79
+ * @param amount of tokens to release.
80
+ */
81
+ releaseRetryTokens(amount?: number): void;
82
+ }
83
+ export interface RetryStrategyV2 {
84
+ /**
85
+ * Called before any retries (for the first call to the operation). It either
86
+ * returns a retry token or an error upon the failure to acquire a token prior.
87
+ *
88
+ * tokenScope is arbitrary and out of scope for this component. However,
89
+ * adding it here offers us a lot of future flexibility for outage detection.
90
+ * For example, it could be "us-east-1" on a shared retry strategy, or
91
+ * "us-west-2-c:dynamodb".
92
+ */
93
+ acquireInitialRetryToken(retryTokenScope: string): Promise<RetryToken>;
94
+ /**
95
+ * After a failed operation call, this function is invoked to refresh the
96
+ * retryToken returned by acquireInitialRetryToken(). This function can
97
+ * either choose to allow another retry and send a new or updated token,
98
+ * or reject the retry attempt and report the error either in an exception
99
+ * or returning an error.
100
+ */
101
+ refreshRetryTokenForRetry(tokenToRenew: RetryToken, errorInfo: RetryErrorInfo): Promise<RetryToken>;
102
+ /**
103
+ * Upon successful completion of the operation, a user calls this function
104
+ * to record that the operation was successful.
105
+ */
106
+ recordSuccess(token: RetryToken): void;
107
+ }
108
+ export declare type ExponentialBackoffJitterType = "DEFAULT" | "NONE" | "FULL" | "DECORRELATED";
109
+ export interface ExponentialBackoffStrategyOptions {
110
+ jitterType: ExponentialBackoffJitterType;
111
+ backoffScaleValue?: number;
112
+ }
@@ -0,0 +1,8 @@
1
+ export interface Checksum {
2
+ digestLength?: number;
3
+ copy?(): Checksum;
4
+ digest(): Promise<Uint8Array>;
5
+ mark?(readLimit: number): void;
6
+ reset(): void;
7
+ update(chunk: Uint8Array): void;
8
+ }
@@ -1,5 +1,6 @@
1
1
  export * from "./abort";
2
2
  export * from "./auth";
3
+ export * from "./checksum";
3
4
  export * from "./client";
4
5
  export * from "./command";
5
6
  export * from "./credentials";
@@ -13,6 +14,7 @@ export * from "./middleware";
13
14
  export * from "./pagination";
14
15
  export * from "./profile";
15
16
  export * from "./response";
17
+ export * from "./retry";
16
18
  export * from "./serde";
17
19
  export * from "./shapes";
18
20
  export * from "./signature";
@@ -0,0 +1,46 @@
1
+ export declare type RetryErrorType =
2
+ | "TRANSIENT"
3
+ | "THROTTLING"
4
+ | "SERVER_ERROR"
5
+ | "CLIENT_ERROR";
6
+ export interface RetryErrorInfo {
7
+ errorType: RetryErrorType;
8
+ retryAfterHint?: Date;
9
+ }
10
+ export interface RetryBackoffStrategy {
11
+ computeNextBackoffDelay(retryAttempt: number): number;
12
+ }
13
+ export interface StandardRetryBackoffStrategy extends RetryBackoffStrategy {
14
+ setDelayBase(delayBase: number): void;
15
+ }
16
+ export interface RetryStrategyOptions {
17
+ backoffStrategy: RetryBackoffStrategy;
18
+ maxRetriesBase: number;
19
+ }
20
+ export interface RetryToken {
21
+ getRetryCount(): number;
22
+ getRetryDelay(): number;
23
+ }
24
+ export interface StandardRetryToken extends RetryToken {
25
+ hasRetryTokens(errorType: RetryErrorType): boolean;
26
+ getRetryTokenCount(errorInfo: RetryErrorInfo): number;
27
+ getLastRetryCost(): number | undefined;
28
+ releaseRetryTokens(amount?: number): void;
29
+ }
30
+ export interface RetryStrategyV2 {
31
+ acquireInitialRetryToken(retryTokenScope: string): Promise<RetryToken>;
32
+ refreshRetryTokenForRetry(
33
+ tokenToRenew: RetryToken,
34
+ errorInfo: RetryErrorInfo
35
+ ): Promise<RetryToken>;
36
+ recordSuccess(token: RetryToken): void;
37
+ }
38
+ export declare type ExponentialBackoffJitterType =
39
+ | "DEFAULT"
40
+ | "NONE"
41
+ | "FULL"
42
+ | "DECORRELATED";
43
+ export interface ExponentialBackoffStrategyOptions {
44
+ jitterType: ExponentialBackoffJitterType;
45
+ backoffScaleValue?: number;
46
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/types",
3
- "version": "3.215.0",
3
+ "version": "3.222.0",
4
4
  "main": "./dist-cjs/index.js",
5
5
  "module": "./dist-es/index.js",
6
6
  "types": "./dist-types/index.d.ts",