@wildix/xbees-conversations-client 1.2.11 → 1.2.12
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.
- package/dist-cjs/ConversationsClient.js +34 -85
- package/dist-cjs/runtimeConfig.browser.js +1 -1
- package/dist-cjs/runtimeConfig.js +1 -1
- package/dist-es/ConversationsClient.js +34 -85
- package/dist-es/runtimeConfig.browser.js +1 -1
- package/dist-es/runtimeConfig.js +1 -1
- package/dist-types/ConversationsClient.d.ts +1 -1
- package/package.json +1 -1
|
@@ -9,30 +9,6 @@ const middleware_retry_1 = require("@smithy/middleware-retry");
|
|
|
9
9
|
const smithy_client_1 = require("@smithy/smithy-client");
|
|
10
10
|
Object.defineProperty(exports, "__Client", { enumerable: true, get: function () { return smithy_client_1.Client; } });
|
|
11
11
|
const smithy_utils_1 = require("@wildix/smithy-utils");
|
|
12
|
-
const DEFAULT_429_RETRY_DELAY_MS = 1000;
|
|
13
|
-
const parseRetryDelayMs = (rawValue) => {
|
|
14
|
-
if (typeof rawValue === "number" && Number.isFinite(rawValue)) {
|
|
15
|
-
if (rawValue >= 1000) {
|
|
16
|
-
return Math.max(0, Math.round(rawValue));
|
|
17
|
-
}
|
|
18
|
-
return Math.max(0, Math.round(rawValue * 1000));
|
|
19
|
-
}
|
|
20
|
-
if (typeof rawValue !== "string") {
|
|
21
|
-
return undefined;
|
|
22
|
-
}
|
|
23
|
-
const numeric = Number(rawValue);
|
|
24
|
-
if (!Number.isNaN(numeric)) {
|
|
25
|
-
if (numeric >= 1000) {
|
|
26
|
-
return Math.max(0, Math.round(numeric));
|
|
27
|
-
}
|
|
28
|
-
return Math.max(0, Math.round(numeric * 1000));
|
|
29
|
-
}
|
|
30
|
-
const parsedDateMs = Date.parse(rawValue);
|
|
31
|
-
if (!Number.isNaN(parsedDateMs)) {
|
|
32
|
-
return Math.max(0, parsedDateMs - Date.now());
|
|
33
|
-
}
|
|
34
|
-
return undefined;
|
|
35
|
-
};
|
|
36
12
|
const getHeaderCaseInsensitive = (headers, ...names) => {
|
|
37
13
|
if (!headers) {
|
|
38
14
|
return undefined;
|
|
@@ -45,24 +21,31 @@ const getHeaderCaseInsensitive = (headers, ...names) => {
|
|
|
45
21
|
}
|
|
46
22
|
return undefined;
|
|
47
23
|
};
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
24
|
+
const parseHeaderDelayMs = (rawValue) => {
|
|
25
|
+
if (typeof rawValue === "number" && Number.isFinite(rawValue)) {
|
|
26
|
+
if (rawValue > 1000000000000) {
|
|
27
|
+
return Math.max(0, Math.round(rawValue - Date.now()));
|
|
28
|
+
}
|
|
29
|
+
if (rawValue > 1000000000) {
|
|
30
|
+
return Math.max(0, Math.round(rawValue * 1000 - Date.now()));
|
|
31
|
+
}
|
|
32
|
+
if (rawValue >= 1000) {
|
|
33
|
+
return Math.max(0, Math.round(rawValue));
|
|
34
|
+
}
|
|
35
|
+
return Math.max(0, Math.round(rawValue * 1000));
|
|
56
36
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return delayFromReset;
|
|
37
|
+
if (typeof rawValue !== "string") {
|
|
38
|
+
return undefined;
|
|
60
39
|
}
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
63
|
-
return
|
|
40
|
+
const asNumber = Number(rawValue);
|
|
41
|
+
if (!Number.isNaN(asNumber)) {
|
|
42
|
+
return parseHeaderDelayMs(asNumber);
|
|
64
43
|
}
|
|
65
|
-
|
|
44
|
+
const asDateMs = Date.parse(rawValue);
|
|
45
|
+
if (!Number.isNaN(asDateMs)) {
|
|
46
|
+
return Math.max(0, asDateMs - Date.now());
|
|
47
|
+
}
|
|
48
|
+
return undefined;
|
|
66
49
|
};
|
|
67
50
|
class ConversationsClient extends smithy_client_1.Client {
|
|
68
51
|
config;
|
|
@@ -87,43 +70,13 @@ class ConversationsClient extends smithy_client_1.Client {
|
|
|
87
70
|
this.middlewareStack.add(smithy_utils_1.authorizationMiddleware.bind(this, configuration.token), { step: "build" });
|
|
88
71
|
this.middlewareStack.use((0, middleware_user_agent_1.getUserAgentPlugin)(this.config));
|
|
89
72
|
this.middlewareStack.use((0, middleware_retry_1.getRetryPlugin)(this.config));
|
|
90
|
-
this.middlewareStack.add((next, context) => async (args) => {
|
|
91
|
-
const retryOn429 = configuration?.retryOn429 ?? true;
|
|
92
|
-
const maxAttempts = await this.config.maxAttempts();
|
|
93
|
-
let customAttempt = 0;
|
|
94
|
-
for (;;) {
|
|
95
|
-
customAttempt += 1;
|
|
96
|
-
context.__xbsCustom429Attempt = customAttempt;
|
|
97
|
-
context.__xbsCustom429MaxAttempts = maxAttempts;
|
|
98
|
-
try {
|
|
99
|
-
return await next(args);
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
const statusCode = error?.$metadata?.httpStatusCode ?? error?.$response?.statusCode;
|
|
103
|
-
if (!retryOn429 || statusCode !== 429 || customAttempt >= maxAttempts) {
|
|
104
|
-
throw error;
|
|
105
|
-
}
|
|
106
|
-
const retryDelayMs = get429RetryDelayMs(error);
|
|
107
|
-
if (configuration?.retryLogging) {
|
|
108
|
-
console.warn(`[ConversationsClient] Custom 429 retry scheduling: attempt ${customAttempt}/${maxAttempts}, delayMs=${retryDelayMs}, nextAt=${new Date(Date.now() + retryDelayMs).toISOString()}`);
|
|
109
|
-
}
|
|
110
|
-
await new Promise((resolve) => setTimeout(resolve, retryDelayMs));
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}, {
|
|
114
|
-
name: "custom429RetryMiddleware",
|
|
115
|
-
step: "deserialize",
|
|
116
|
-
priority: "high",
|
|
117
|
-
});
|
|
118
73
|
if (configuration?.retryLogging) {
|
|
119
|
-
this.middlewareStack.add((next
|
|
74
|
+
this.middlewareStack.add((next) => async (args) => {
|
|
120
75
|
const request = args.request;
|
|
121
76
|
const attemptHeader = request?.headers?.["amz-sdk-request"] ?? request?.headers?.["x-amz-sdk-request"];
|
|
122
77
|
const attemptMatch = typeof attemptHeader === "string" ? attemptHeader.match(/attempt=(\d+)/) : null;
|
|
123
|
-
const
|
|
124
|
-
const
|
|
125
|
-
const attempt = customAttempt ?? (attemptMatch ? Number(attemptMatch[1]) : 1);
|
|
126
|
-
const maxAttempts = customMaxAttempts ?? await this.config.maxAttempts();
|
|
78
|
+
const attempt = attemptMatch ? Number(attemptMatch[1]) : 1;
|
|
79
|
+
const maxAttempts = await this.config.maxAttempts();
|
|
127
80
|
const startedAt = new Date().toISOString();
|
|
128
81
|
if (attempt > 1) {
|
|
129
82
|
console.warn(`[ConversationsClient] Retry attempt ${attempt}/${maxAttempts} started at ${startedAt}`);
|
|
@@ -136,26 +89,22 @@ class ConversationsClient extends smithy_client_1.Client {
|
|
|
136
89
|
}
|
|
137
90
|
catch (error) {
|
|
138
91
|
const statusCode = error?.$metadata?.httpStatusCode ?? error?.$response?.statusCode;
|
|
139
|
-
const
|
|
140
|
-
const willRetry = statusCode === 429
|
|
141
|
-
? retryOn429 && attempt < maxAttempts
|
|
142
|
-
: attempt < maxAttempts && this.config.retryDecider(error);
|
|
92
|
+
const willRetry = attempt < maxAttempts && this.config.retryDecider(error);
|
|
143
93
|
const responseHeaders = (error?.$response?.headers ?? {});
|
|
144
|
-
const
|
|
145
|
-
const
|
|
146
|
-
const
|
|
147
|
-
const
|
|
148
|
-
const
|
|
149
|
-
const
|
|
150
|
-
const rateLimitResetDelayMs = parseRetryDelayMs(rateLimitResetRaw);
|
|
94
|
+
const retryAfterRaw = getHeaderCaseInsensitive(responseHeaders, "retry-after");
|
|
95
|
+
const rateLimitResetRaw = getHeaderCaseInsensitive(responseHeaders, "x-ratelimit-reset", "ratelimit-reset", "rateLimitReset");
|
|
96
|
+
const rateLimitRaw = getHeaderCaseInsensitive(responseHeaders, "x-ratelimit-limit", "ratelimit-limit", "rateLimit");
|
|
97
|
+
const rateLimitRemainingRaw = getHeaderCaseInsensitive(responseHeaders, "x-ratelimit-remaining", "ratelimit-remaining", "rateLimitRemaining");
|
|
98
|
+
const retryAfterDelayMs = parseHeaderDelayMs(retryAfterRaw);
|
|
99
|
+
const rateLimitResetDelayMs = parseHeaderDelayMs(rateLimitResetRaw);
|
|
151
100
|
if (willRetry) {
|
|
152
101
|
console.warn(`[ConversationsClient] Retry decision: will retry after attempt ${attempt}/${maxAttempts} (status=${statusCode ?? "unknown"}, time=${new Date().toISOString()})`);
|
|
153
|
-
console.warn(`[ConversationsClient] Retry headers: retry-after=${String(retryAfterRaw ?? "n/a")}, x-ratelimit-reset=${String(rateLimitResetRaw ?? "n/a")}, x-ratelimit-limit=${String(rateLimitRaw ?? "n/a")}, x-ratelimit-remaining=${String(rateLimitRemainingRaw ?? "n/a")}`);
|
|
154
|
-
console.warn(`[ConversationsClient] Parsed retry timing: retryAfterDelayMs=${retryAfterDelayMs ?? "n/a"}, rateLimitResetDelayMs=${rateLimitResetDelayMs ?? "n/a"}`);
|
|
155
102
|
}
|
|
156
103
|
else {
|
|
157
104
|
console.warn(`[ConversationsClient] Retry decision: stop after attempt ${attempt}/${maxAttempts} (status=${statusCode ?? "unknown"}, time=${new Date().toISOString()})`);
|
|
158
105
|
}
|
|
106
|
+
console.warn(`[ConversationsClient] Retry headers: retry-after=${String(retryAfterRaw ?? "n/a")}, x-ratelimit-reset=${String(rateLimitResetRaw ?? "n/a")}, x-ratelimit-limit=${String(rateLimitRaw ?? "n/a")}, x-ratelimit-remaining=${String(rateLimitRemainingRaw ?? "n/a")}`);
|
|
107
|
+
console.warn(`[ConversationsClient] Parsed retry timing: retryAfterDelayMs=${retryAfterDelayMs ?? "n/a"}, rateLimitResetDelayMs=${rateLimitResetDelayMs ?? "n/a"}`);
|
|
159
108
|
throw error;
|
|
160
109
|
}
|
|
161
110
|
}, {
|
|
@@ -27,7 +27,7 @@ const getRuntimeConfig = (config) => {
|
|
|
27
27
|
retryDecider: config?.retryDecider ?? ((error) => {
|
|
28
28
|
const statusCode = error?.$metadata?.httpStatusCode ?? error?.$response?.statusCode;
|
|
29
29
|
if (statusCode === 429) {
|
|
30
|
-
return
|
|
30
|
+
return Boolean(config?.retryOn429 ?? true);
|
|
31
31
|
}
|
|
32
32
|
return Boolean(error?.$retryable?.throttling
|
|
33
33
|
|| error?.$retryable?.retryable
|
|
@@ -31,7 +31,7 @@ const getRuntimeConfig = (config) => {
|
|
|
31
31
|
retryDecider: config?.retryDecider ?? ((error) => {
|
|
32
32
|
const statusCode = error?.$metadata?.httpStatusCode ?? error?.$response?.statusCode;
|
|
33
33
|
if (statusCode === 429) {
|
|
34
|
-
return
|
|
34
|
+
return Boolean(config?.retryOn429 ?? true);
|
|
35
35
|
}
|
|
36
36
|
return Boolean(error?.$retryable?.throttling
|
|
37
37
|
|| error?.$retryable?.retryable
|
|
@@ -6,30 +6,6 @@ import { getRetryPlugin, resolveRetryConfig, } from "@smithy/middleware-retry";
|
|
|
6
6
|
import { Client as __Client, } from "@smithy/smithy-client";
|
|
7
7
|
import { authorizationMiddleware } from '@wildix/smithy-utils';
|
|
8
8
|
export { __Client };
|
|
9
|
-
const DEFAULT_429_RETRY_DELAY_MS = 1000;
|
|
10
|
-
const parseRetryDelayMs = (rawValue) => {
|
|
11
|
-
if (typeof rawValue === "number" && Number.isFinite(rawValue)) {
|
|
12
|
-
if (rawValue >= 1000) {
|
|
13
|
-
return Math.max(0, Math.round(rawValue));
|
|
14
|
-
}
|
|
15
|
-
return Math.max(0, Math.round(rawValue * 1000));
|
|
16
|
-
}
|
|
17
|
-
if (typeof rawValue !== "string") {
|
|
18
|
-
return undefined;
|
|
19
|
-
}
|
|
20
|
-
const numeric = Number(rawValue);
|
|
21
|
-
if (!Number.isNaN(numeric)) {
|
|
22
|
-
if (numeric >= 1000) {
|
|
23
|
-
return Math.max(0, Math.round(numeric));
|
|
24
|
-
}
|
|
25
|
-
return Math.max(0, Math.round(numeric * 1000));
|
|
26
|
-
}
|
|
27
|
-
const parsedDateMs = Date.parse(rawValue);
|
|
28
|
-
if (!Number.isNaN(parsedDateMs)) {
|
|
29
|
-
return Math.max(0, parsedDateMs - Date.now());
|
|
30
|
-
}
|
|
31
|
-
return undefined;
|
|
32
|
-
};
|
|
33
9
|
const getHeaderCaseInsensitive = (headers, ...names) => {
|
|
34
10
|
if (!headers) {
|
|
35
11
|
return undefined;
|
|
@@ -42,24 +18,31 @@ const getHeaderCaseInsensitive = (headers, ...names) => {
|
|
|
42
18
|
}
|
|
43
19
|
return undefined;
|
|
44
20
|
};
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
21
|
+
const parseHeaderDelayMs = (rawValue) => {
|
|
22
|
+
if (typeof rawValue === "number" && Number.isFinite(rawValue)) {
|
|
23
|
+
if (rawValue > 1000000000000) {
|
|
24
|
+
return Math.max(0, Math.round(rawValue - Date.now()));
|
|
25
|
+
}
|
|
26
|
+
if (rawValue > 1000000000) {
|
|
27
|
+
return Math.max(0, Math.round(rawValue * 1000 - Date.now()));
|
|
28
|
+
}
|
|
29
|
+
if (rawValue >= 1000) {
|
|
30
|
+
return Math.max(0, Math.round(rawValue));
|
|
31
|
+
}
|
|
32
|
+
return Math.max(0, Math.round(rawValue * 1000));
|
|
53
33
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return delayFromReset;
|
|
34
|
+
if (typeof rawValue !== "string") {
|
|
35
|
+
return undefined;
|
|
57
36
|
}
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
60
|
-
return
|
|
37
|
+
const asNumber = Number(rawValue);
|
|
38
|
+
if (!Number.isNaN(asNumber)) {
|
|
39
|
+
return parseHeaderDelayMs(asNumber);
|
|
61
40
|
}
|
|
62
|
-
|
|
41
|
+
const asDateMs = Date.parse(rawValue);
|
|
42
|
+
if (!Number.isNaN(asDateMs)) {
|
|
43
|
+
return Math.max(0, asDateMs - Date.now());
|
|
44
|
+
}
|
|
45
|
+
return undefined;
|
|
63
46
|
};
|
|
64
47
|
export class ConversationsClient extends __Client {
|
|
65
48
|
config;
|
|
@@ -84,43 +67,13 @@ export class ConversationsClient extends __Client {
|
|
|
84
67
|
this.middlewareStack.add(authorizationMiddleware.bind(this, configuration.token), { step: "build" });
|
|
85
68
|
this.middlewareStack.use(getUserAgentPlugin(this.config));
|
|
86
69
|
this.middlewareStack.use(getRetryPlugin(this.config));
|
|
87
|
-
this.middlewareStack.add((next, context) => async (args) => {
|
|
88
|
-
const retryOn429 = configuration?.retryOn429 ?? true;
|
|
89
|
-
const maxAttempts = await this.config.maxAttempts();
|
|
90
|
-
let customAttempt = 0;
|
|
91
|
-
for (;;) {
|
|
92
|
-
customAttempt += 1;
|
|
93
|
-
context.__xbsCustom429Attempt = customAttempt;
|
|
94
|
-
context.__xbsCustom429MaxAttempts = maxAttempts;
|
|
95
|
-
try {
|
|
96
|
-
return await next(args);
|
|
97
|
-
}
|
|
98
|
-
catch (error) {
|
|
99
|
-
const statusCode = error?.$metadata?.httpStatusCode ?? error?.$response?.statusCode;
|
|
100
|
-
if (!retryOn429 || statusCode !== 429 || customAttempt >= maxAttempts) {
|
|
101
|
-
throw error;
|
|
102
|
-
}
|
|
103
|
-
const retryDelayMs = get429RetryDelayMs(error);
|
|
104
|
-
if (configuration?.retryLogging) {
|
|
105
|
-
console.warn(`[ConversationsClient] Custom 429 retry scheduling: attempt ${customAttempt}/${maxAttempts}, delayMs=${retryDelayMs}, nextAt=${new Date(Date.now() + retryDelayMs).toISOString()}`);
|
|
106
|
-
}
|
|
107
|
-
await new Promise((resolve) => setTimeout(resolve, retryDelayMs));
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}, {
|
|
111
|
-
name: "custom429RetryMiddleware",
|
|
112
|
-
step: "deserialize",
|
|
113
|
-
priority: "high",
|
|
114
|
-
});
|
|
115
70
|
if (configuration?.retryLogging) {
|
|
116
|
-
this.middlewareStack.add((next
|
|
71
|
+
this.middlewareStack.add((next) => async (args) => {
|
|
117
72
|
const request = args.request;
|
|
118
73
|
const attemptHeader = request?.headers?.["amz-sdk-request"] ?? request?.headers?.["x-amz-sdk-request"];
|
|
119
74
|
const attemptMatch = typeof attemptHeader === "string" ? attemptHeader.match(/attempt=(\d+)/) : null;
|
|
120
|
-
const
|
|
121
|
-
const
|
|
122
|
-
const attempt = customAttempt ?? (attemptMatch ? Number(attemptMatch[1]) : 1);
|
|
123
|
-
const maxAttempts = customMaxAttempts ?? await this.config.maxAttempts();
|
|
75
|
+
const attempt = attemptMatch ? Number(attemptMatch[1]) : 1;
|
|
76
|
+
const maxAttempts = await this.config.maxAttempts();
|
|
124
77
|
const startedAt = new Date().toISOString();
|
|
125
78
|
if (attempt > 1) {
|
|
126
79
|
console.warn(`[ConversationsClient] Retry attempt ${attempt}/${maxAttempts} started at ${startedAt}`);
|
|
@@ -133,26 +86,22 @@ export class ConversationsClient extends __Client {
|
|
|
133
86
|
}
|
|
134
87
|
catch (error) {
|
|
135
88
|
const statusCode = error?.$metadata?.httpStatusCode ?? error?.$response?.statusCode;
|
|
136
|
-
const
|
|
137
|
-
const willRetry = statusCode === 429
|
|
138
|
-
? retryOn429 && attempt < maxAttempts
|
|
139
|
-
: attempt < maxAttempts && this.config.retryDecider(error);
|
|
89
|
+
const willRetry = attempt < maxAttempts && this.config.retryDecider(error);
|
|
140
90
|
const responseHeaders = (error?.$response?.headers ?? {});
|
|
141
|
-
const
|
|
142
|
-
const
|
|
143
|
-
const
|
|
144
|
-
const
|
|
145
|
-
const
|
|
146
|
-
const
|
|
147
|
-
const rateLimitResetDelayMs = parseRetryDelayMs(rateLimitResetRaw);
|
|
91
|
+
const retryAfterRaw = getHeaderCaseInsensitive(responseHeaders, "retry-after");
|
|
92
|
+
const rateLimitResetRaw = getHeaderCaseInsensitive(responseHeaders, "x-ratelimit-reset", "ratelimit-reset", "rateLimitReset");
|
|
93
|
+
const rateLimitRaw = getHeaderCaseInsensitive(responseHeaders, "x-ratelimit-limit", "ratelimit-limit", "rateLimit");
|
|
94
|
+
const rateLimitRemainingRaw = getHeaderCaseInsensitive(responseHeaders, "x-ratelimit-remaining", "ratelimit-remaining", "rateLimitRemaining");
|
|
95
|
+
const retryAfterDelayMs = parseHeaderDelayMs(retryAfterRaw);
|
|
96
|
+
const rateLimitResetDelayMs = parseHeaderDelayMs(rateLimitResetRaw);
|
|
148
97
|
if (willRetry) {
|
|
149
98
|
console.warn(`[ConversationsClient] Retry decision: will retry after attempt ${attempt}/${maxAttempts} (status=${statusCode ?? "unknown"}, time=${new Date().toISOString()})`);
|
|
150
|
-
console.warn(`[ConversationsClient] Retry headers: retry-after=${String(retryAfterRaw ?? "n/a")}, x-ratelimit-reset=${String(rateLimitResetRaw ?? "n/a")}, x-ratelimit-limit=${String(rateLimitRaw ?? "n/a")}, x-ratelimit-remaining=${String(rateLimitRemainingRaw ?? "n/a")}`);
|
|
151
|
-
console.warn(`[ConversationsClient] Parsed retry timing: retryAfterDelayMs=${retryAfterDelayMs ?? "n/a"}, rateLimitResetDelayMs=${rateLimitResetDelayMs ?? "n/a"}`);
|
|
152
99
|
}
|
|
153
100
|
else {
|
|
154
101
|
console.warn(`[ConversationsClient] Retry decision: stop after attempt ${attempt}/${maxAttempts} (status=${statusCode ?? "unknown"}, time=${new Date().toISOString()})`);
|
|
155
102
|
}
|
|
103
|
+
console.warn(`[ConversationsClient] Retry headers: retry-after=${String(retryAfterRaw ?? "n/a")}, x-ratelimit-reset=${String(rateLimitResetRaw ?? "n/a")}, x-ratelimit-limit=${String(rateLimitRaw ?? "n/a")}, x-ratelimit-remaining=${String(rateLimitRemainingRaw ?? "n/a")}`);
|
|
104
|
+
console.warn(`[ConversationsClient] Parsed retry timing: retryAfterDelayMs=${retryAfterDelayMs ?? "n/a"}, rateLimitResetDelayMs=${rateLimitResetDelayMs ?? "n/a"}`);
|
|
156
105
|
throw error;
|
|
157
106
|
}
|
|
158
107
|
}, {
|
|
@@ -23,7 +23,7 @@ export const getRuntimeConfig = (config) => {
|
|
|
23
23
|
retryDecider: config?.retryDecider ?? ((error) => {
|
|
24
24
|
const statusCode = error?.$metadata?.httpStatusCode ?? error?.$response?.statusCode;
|
|
25
25
|
if (statusCode === 429) {
|
|
26
|
-
return
|
|
26
|
+
return Boolean(config?.retryOn429 ?? true);
|
|
27
27
|
}
|
|
28
28
|
return Boolean(error?.$retryable?.throttling
|
|
29
29
|
|| error?.$retryable?.retryable
|
package/dist-es/runtimeConfig.js
CHANGED
|
@@ -27,7 +27,7 @@ export const getRuntimeConfig = (config) => {
|
|
|
27
27
|
retryDecider: config?.retryDecider ?? ((error) => {
|
|
28
28
|
const statusCode = error?.$metadata?.httpStatusCode ?? error?.$response?.statusCode;
|
|
29
29
|
if (statusCode === 429) {
|
|
30
|
-
return
|
|
30
|
+
return Boolean(config?.retryOn429 ?? true);
|
|
31
31
|
}
|
|
32
32
|
return Boolean(error?.$retryable?.throttling
|
|
33
33
|
|| error?.$retryable?.retryable
|
|
@@ -152,7 +152,7 @@ export interface ClientDefaults extends Partial<__SmithyConfiguration<__HttpHand
|
|
|
152
152
|
*/
|
|
153
153
|
retryDecider?: (error: any) => boolean;
|
|
154
154
|
/**
|
|
155
|
-
* Enables console logging for retry attempts and
|
|
155
|
+
* Enables console logging for retry attempts and timing headers.
|
|
156
156
|
* Defaults to `false`.
|
|
157
157
|
*/
|
|
158
158
|
retryLogging?: boolean;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildix/xbees-conversations-client",
|
|
3
3
|
"description": "@wildix/xbees-conversations-client client",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.12",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
7
7
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|