@etainabl/nodejs-sdk 1.3.165 → 1.3.166

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.
Files changed (78) hide show
  1. package/dist/esm/chunk-5UJEKK4C.js +22 -0
  2. package/dist/esm/chunk-5UJEKK4C.js.map +1 -0
  3. package/dist/esm/chunk-72KZNKH6.js +180 -0
  4. package/dist/esm/chunk-72KZNKH6.js.map +1 -0
  5. package/dist/esm/{chunk-V42NON4H.js → chunk-7QBJXGSP.js} +23 -1
  6. package/dist/esm/chunk-7QBJXGSP.js.map +1 -0
  7. package/dist/esm/{chunk-GEJJRBZZ.js → chunk-AQUTK7AW.js} +15 -5
  8. package/dist/esm/chunk-AQUTK7AW.js.map +1 -0
  9. package/dist/esm/{chunk-JFJBZL6W.js → chunk-EVJULQPT.js} +1458 -230
  10. package/dist/esm/chunk-EVJULQPT.js.map +1 -0
  11. package/dist/esm/chunk-GA2PLVMV.js +29 -0
  12. package/dist/esm/chunk-GA2PLVMV.js.map +1 -0
  13. package/dist/esm/{chunk-ITNQSW66.js → chunk-IMDTX6W5.js} +57 -7
  14. package/dist/esm/chunk-IMDTX6W5.js.map +1 -0
  15. package/dist/esm/chunk-JI6PVVK3.js +739 -0
  16. package/dist/esm/chunk-JI6PVVK3.js.map +1 -0
  17. package/dist/esm/chunk-KH6HADHN.js +31 -0
  18. package/dist/esm/chunk-KH6HADHN.js.map +1 -0
  19. package/dist/esm/{chunk-64PZMULY.js → chunk-LARQKHST.js} +2 -2
  20. package/dist/esm/chunk-PZ5AY32C.js +10 -0
  21. package/dist/esm/chunk-R2ZTENKB.js +37 -0
  22. package/dist/esm/chunk-R2ZTENKB.js.map +1 -0
  23. package/dist/esm/chunk-RREOR7G6.js +9 -0
  24. package/dist/esm/chunk-RREOR7G6.js.map +1 -0
  25. package/dist/esm/chunk-STDLTQUB.js +180 -0
  26. package/dist/esm/chunk-STDLTQUB.js.map +1 -0
  27. package/dist/esm/chunk-STQV3LF2.js +29 -0
  28. package/dist/esm/chunk-STQV3LF2.js.map +1 -0
  29. package/dist/esm/chunk-WRTOEGQL.js +255 -0
  30. package/dist/esm/chunk-WRTOEGQL.js.map +1 -0
  31. package/dist/esm/{chunk-HAEAETXR.js → chunk-ZW5YT27C.js} +55 -96
  32. package/dist/esm/chunk-ZW5YT27C.js.map +1 -0
  33. package/dist/esm/{dist-es-W6M73SKO.js → dist-es-32LEW3C7.js} +6 -5
  34. package/dist/esm/{dist-es-W6M73SKO.js.map → dist-es-32LEW3C7.js.map} +1 -1
  35. package/dist/esm/{dist-es-SHHKSG6R.js → dist-es-GCETMDH7.js} +4 -3
  36. package/dist/esm/dist-es-GCETMDH7.js.map +1 -0
  37. package/dist/esm/{dist-es-UQHTRG6U.js → dist-es-MHO4ZWXK.js} +7 -5
  38. package/dist/esm/{dist-es-UQHTRG6U.js.map → dist-es-MHO4ZWXK.js.map} +1 -1
  39. package/dist/esm/{dist-es-IIKV4LDE.js → dist-es-MRJ45ZBG.js} +19 -15
  40. package/dist/esm/{dist-es-IIKV4LDE.js.map → dist-es-MRJ45ZBG.js.map} +1 -1
  41. package/dist/esm/{dist-es-CQVI4NNF.js → dist-es-NBFOPILZ.js} +53 -14
  42. package/dist/esm/dist-es-NBFOPILZ.js.map +1 -0
  43. package/dist/esm/{dist-es-AV5FKRC6.js → dist-es-YDCANF64.js} +12 -7
  44. package/dist/esm/{dist-es-AV5FKRC6.js.map → dist-es-YDCANF64.js.map} +1 -1
  45. package/dist/esm/{dist-es-HQRLUYWI.js → dist-es-YPLWYQ2P.js} +4 -3
  46. package/dist/esm/{dist-es-HQRLUYWI.js.map → dist-es-YPLWYQ2P.js.map} +1 -1
  47. package/dist/esm/event-streams-C2D437DF.js +198 -0
  48. package/dist/esm/event-streams-C2D437DF.js.map +1 -0
  49. package/dist/esm/index.js +8421 -7505
  50. package/dist/esm/index.js.map +1 -1
  51. package/dist/esm/{loadSso-2Q7LGXOS.js → loadSso-QXCYUPG5.js} +54 -48
  52. package/dist/esm/loadSso-QXCYUPG5.js.map +1 -0
  53. package/dist/esm/{sso-oidc-7RZV73L6.js → sso-oidc-EU7F5QE4.js} +38 -34
  54. package/dist/esm/{sso-oidc-7RZV73L6.js.map → sso-oidc-EU7F5QE4.js.map} +1 -1
  55. package/dist/esm/{sts-IERANB7E.js → sts-7N2XX5PT.js} +34 -28
  56. package/dist/esm/{sts-IERANB7E.js.map → sts-7N2XX5PT.js.map} +1 -1
  57. package/dist/index.d.cts +410 -11
  58. package/dist/index.d.ts +410 -11
  59. package/dist/index.js +20412 -19412
  60. package/dist/index.js.map +1 -1
  61. package/package.json +7 -2
  62. package/dist/esm/chunk-3YGWW265.js +0 -64
  63. package/dist/esm/chunk-3YGWW265.js.map +0 -1
  64. package/dist/esm/chunk-5VQORBLK.js +0 -136
  65. package/dist/esm/chunk-5VQORBLK.js.map +0 -1
  66. package/dist/esm/chunk-6ZE6VFBF.js +0 -2420
  67. package/dist/esm/chunk-6ZE6VFBF.js.map +0 -1
  68. package/dist/esm/chunk-GEJJRBZZ.js.map +0 -1
  69. package/dist/esm/chunk-HAEAETXR.js.map +0 -1
  70. package/dist/esm/chunk-ITNQSW66.js.map +0 -1
  71. package/dist/esm/chunk-JFJBZL6W.js.map +0 -1
  72. package/dist/esm/chunk-JVMEEBKP.js +0 -127
  73. package/dist/esm/chunk-JVMEEBKP.js.map +0 -1
  74. package/dist/esm/chunk-V42NON4H.js.map +0 -1
  75. package/dist/esm/dist-es-CQVI4NNF.js.map +0 -1
  76. package/dist/esm/loadSso-2Q7LGXOS.js.map +0 -1
  77. /package/dist/esm/{chunk-64PZMULY.js.map → chunk-LARQKHST.js.map} +0 -0
  78. /package/dist/esm/{dist-es-SHHKSG6R.js.map → chunk-PZ5AY32C.js.map} +0 -0
@@ -0,0 +1,739 @@
1
+ import {
2
+ fromArrayBuffer,
3
+ fromString,
4
+ fromUtf8
5
+ } from "./chunk-KH6HADHN.js";
6
+
7
+ // node_modules/@smithy/protocol-http/dist-es/httpRequest.js
8
+ var HttpRequest = class _HttpRequest {
9
+ constructor(options) {
10
+ this.method = options.method || "GET";
11
+ this.hostname = options.hostname || "localhost";
12
+ this.port = options.port;
13
+ this.query = options.query || {};
14
+ this.headers = options.headers || {};
15
+ this.body = options.body;
16
+ this.protocol = options.protocol ? options.protocol.slice(-1) !== ":" ? `${options.protocol}:` : options.protocol : "https:";
17
+ this.path = options.path ? options.path.charAt(0) !== "/" ? `/${options.path}` : options.path : "/";
18
+ this.username = options.username;
19
+ this.password = options.password;
20
+ this.fragment = options.fragment;
21
+ }
22
+ static clone(request) {
23
+ const cloned = new _HttpRequest({
24
+ ...request,
25
+ headers: { ...request.headers }
26
+ });
27
+ if (cloned.query) {
28
+ cloned.query = cloneQuery(cloned.query);
29
+ }
30
+ return cloned;
31
+ }
32
+ static isInstance(request) {
33
+ if (!request) {
34
+ return false;
35
+ }
36
+ const req = request;
37
+ return "method" in req && "protocol" in req && "hostname" in req && "path" in req && typeof req["query"] === "object" && typeof req["headers"] === "object";
38
+ }
39
+ clone() {
40
+ return _HttpRequest.clone(this);
41
+ }
42
+ };
43
+ function cloneQuery(query) {
44
+ return Object.keys(query).reduce((carry, paramName) => {
45
+ const param = query[paramName];
46
+ return {
47
+ ...carry,
48
+ [paramName]: Array.isArray(param) ? [...param] : param
49
+ };
50
+ }, {});
51
+ }
52
+
53
+ // node_modules/@smithy/protocol-http/dist-es/httpResponse.js
54
+ var HttpResponse = class {
55
+ constructor(options) {
56
+ this.statusCode = options.statusCode;
57
+ this.reason = options.reason;
58
+ this.headers = options.headers || {};
59
+ this.body = options.body;
60
+ }
61
+ static isInstance(response) {
62
+ if (!response)
63
+ return false;
64
+ const resp = response;
65
+ return typeof resp.statusCode === "number" && typeof resp.headers === "object";
66
+ }
67
+ };
68
+
69
+ // node_modules/@smithy/util-uri-escape/dist-es/escape-uri.js
70
+ var escapeUri = (uri) => encodeURIComponent(uri).replace(/[!'()*]/g, hexEncode);
71
+ var hexEncode = (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`;
72
+
73
+ // node_modules/@smithy/querystring-builder/dist-es/index.js
74
+ function buildQueryString(query) {
75
+ const parts = [];
76
+ for (let key of Object.keys(query).sort()) {
77
+ const value = query[key];
78
+ key = escapeUri(key);
79
+ if (Array.isArray(value)) {
80
+ for (let i = 0, iLen = value.length; i < iLen; i++) {
81
+ parts.push(`${key}=${escapeUri(value[i])}`);
82
+ }
83
+ } else {
84
+ let qsEntry = key;
85
+ if (value || typeof value === "string") {
86
+ qsEntry += `=${escapeUri(value)}`;
87
+ }
88
+ parts.push(qsEntry);
89
+ }
90
+ }
91
+ return parts.join("&");
92
+ }
93
+
94
+ // node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js
95
+ import { Agent as hAgent, request as hRequest } from "http";
96
+ import { Agent as hsAgent, request as hsRequest } from "https";
97
+
98
+ // node_modules/@smithy/node-http-handler/dist-es/constants.js
99
+ var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "EPIPE", "ETIMEDOUT"];
100
+
101
+ // node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js
102
+ var getTransformedHeaders = (headers) => {
103
+ const transformedHeaders = {};
104
+ for (const name of Object.keys(headers)) {
105
+ const headerValues = headers[name];
106
+ transformedHeaders[name] = Array.isArray(headerValues) ? headerValues.join(",") : headerValues;
107
+ }
108
+ return transformedHeaders;
109
+ };
110
+
111
+ // node_modules/@smithy/node-http-handler/dist-es/timing.js
112
+ var timing = {
113
+ setTimeout: (cb, ms) => setTimeout(cb, ms),
114
+ clearTimeout: (timeoutId) => clearTimeout(timeoutId)
115
+ };
116
+
117
+ // node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js
118
+ var DEFER_EVENT_LISTENER_TIME = 1e3;
119
+ var setConnectionTimeout = (request, reject, timeoutInMs = 0) => {
120
+ if (!timeoutInMs) {
121
+ return -1;
122
+ }
123
+ const registerTimeout = (offset) => {
124
+ const timeoutId = timing.setTimeout(() => {
125
+ request.destroy();
126
+ reject(Object.assign(new Error(`Socket timed out without establishing a connection within ${timeoutInMs} ms`), {
127
+ name: "TimeoutError"
128
+ }));
129
+ }, timeoutInMs - offset);
130
+ const doWithSocket = (socket) => {
131
+ if (socket?.connecting) {
132
+ socket.on("connect", () => {
133
+ timing.clearTimeout(timeoutId);
134
+ });
135
+ } else {
136
+ timing.clearTimeout(timeoutId);
137
+ }
138
+ };
139
+ if (request.socket) {
140
+ doWithSocket(request.socket);
141
+ } else {
142
+ request.on("socket", doWithSocket);
143
+ }
144
+ };
145
+ if (timeoutInMs < 2e3) {
146
+ registerTimeout(0);
147
+ return 0;
148
+ }
149
+ return timing.setTimeout(registerTimeout.bind(null, DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME);
150
+ };
151
+
152
+ // node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js
153
+ var DEFER_EVENT_LISTENER_TIME2 = 3e3;
154
+ var setSocketKeepAlive = (request, { keepAlive, keepAliveMsecs }, deferTimeMs = DEFER_EVENT_LISTENER_TIME2) => {
155
+ if (keepAlive !== true) {
156
+ return -1;
157
+ }
158
+ const registerListener = () => {
159
+ if (request.socket) {
160
+ request.socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
161
+ } else {
162
+ request.on("socket", (socket) => {
163
+ socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
164
+ });
165
+ }
166
+ };
167
+ if (deferTimeMs === 0) {
168
+ registerListener();
169
+ return 0;
170
+ }
171
+ return timing.setTimeout(registerListener, deferTimeMs);
172
+ };
173
+
174
+ // node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js
175
+ var DEFER_EVENT_LISTENER_TIME3 = 3e3;
176
+ var setSocketTimeout = (request, reject, timeoutInMs = DEFAULT_REQUEST_TIMEOUT) => {
177
+ const registerTimeout = (offset) => {
178
+ const timeout = timeoutInMs - offset;
179
+ const onTimeout = () => {
180
+ request.destroy();
181
+ reject(Object.assign(new Error(`Connection timed out after ${timeoutInMs} ms`), { name: "TimeoutError" }));
182
+ };
183
+ if (request.socket) {
184
+ request.socket.setTimeout(timeout, onTimeout);
185
+ request.on("close", () => request.socket?.removeListener("timeout", onTimeout));
186
+ } else {
187
+ request.setTimeout(timeout, onTimeout);
188
+ }
189
+ };
190
+ if (0 < timeoutInMs && timeoutInMs < 6e3) {
191
+ registerTimeout(0);
192
+ return 0;
193
+ }
194
+ return timing.setTimeout(registerTimeout.bind(null, timeoutInMs === 0 ? 0 : DEFER_EVENT_LISTENER_TIME3), DEFER_EVENT_LISTENER_TIME3);
195
+ };
196
+
197
+ // node_modules/@smithy/node-http-handler/dist-es/write-request-body.js
198
+ import { Readable } from "stream";
199
+ var MIN_WAIT_TIME = 6e3;
200
+ async function writeRequestBody(httpRequest, request, maxContinueTimeoutMs = MIN_WAIT_TIME) {
201
+ const headers = request.headers ?? {};
202
+ const expect = headers["Expect"] || headers["expect"];
203
+ let timeoutId = -1;
204
+ let sendBody = true;
205
+ if (expect === "100-continue") {
206
+ sendBody = await Promise.race([
207
+ new Promise((resolve) => {
208
+ timeoutId = Number(timing.setTimeout(() => resolve(true), Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs)));
209
+ }),
210
+ new Promise((resolve) => {
211
+ httpRequest.on("continue", () => {
212
+ timing.clearTimeout(timeoutId);
213
+ resolve(true);
214
+ });
215
+ httpRequest.on("response", () => {
216
+ timing.clearTimeout(timeoutId);
217
+ resolve(false);
218
+ });
219
+ httpRequest.on("error", () => {
220
+ timing.clearTimeout(timeoutId);
221
+ resolve(false);
222
+ });
223
+ })
224
+ ]);
225
+ }
226
+ if (sendBody) {
227
+ writeBody(httpRequest, request.body);
228
+ }
229
+ }
230
+ function writeBody(httpRequest, body) {
231
+ if (body instanceof Readable) {
232
+ body.pipe(httpRequest);
233
+ return;
234
+ }
235
+ if (body) {
236
+ if (Buffer.isBuffer(body) || typeof body === "string") {
237
+ httpRequest.end(body);
238
+ return;
239
+ }
240
+ const uint8 = body;
241
+ if (typeof uint8 === "object" && uint8.buffer && typeof uint8.byteOffset === "number" && typeof uint8.byteLength === "number") {
242
+ httpRequest.end(Buffer.from(uint8.buffer, uint8.byteOffset, uint8.byteLength));
243
+ return;
244
+ }
245
+ httpRequest.end(Buffer.from(body));
246
+ return;
247
+ }
248
+ httpRequest.end();
249
+ }
250
+
251
+ // node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js
252
+ var DEFAULT_REQUEST_TIMEOUT = 0;
253
+ var NodeHttpHandler = class _NodeHttpHandler {
254
+ static create(instanceOrOptions) {
255
+ if (typeof instanceOrOptions?.handle === "function") {
256
+ return instanceOrOptions;
257
+ }
258
+ return new _NodeHttpHandler(instanceOrOptions);
259
+ }
260
+ static checkSocketUsage(agent, socketWarningTimestamp, logger2 = console) {
261
+ const { sockets, requests, maxSockets } = agent;
262
+ if (typeof maxSockets !== "number" || maxSockets === Infinity) {
263
+ return socketWarningTimestamp;
264
+ }
265
+ const interval = 15e3;
266
+ if (Date.now() - interval < socketWarningTimestamp) {
267
+ return socketWarningTimestamp;
268
+ }
269
+ if (sockets && requests) {
270
+ for (const origin in sockets) {
271
+ const socketsInUse = sockets[origin]?.length ?? 0;
272
+ const requestsEnqueued = requests[origin]?.length ?? 0;
273
+ if (socketsInUse >= maxSockets && requestsEnqueued >= 2 * maxSockets) {
274
+ logger2?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${socketsInUse} and ${requestsEnqueued} additional requests are enqueued.
275
+ See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
276
+ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`);
277
+ return Date.now();
278
+ }
279
+ }
280
+ }
281
+ return socketWarningTimestamp;
282
+ }
283
+ constructor(options) {
284
+ this.socketWarningTimestamp = 0;
285
+ this.metadata = { handlerProtocol: "http/1.1" };
286
+ this.configProvider = new Promise((resolve, reject) => {
287
+ if (typeof options === "function") {
288
+ options().then((_options) => {
289
+ resolve(this.resolveDefaultConfig(_options));
290
+ }).catch(reject);
291
+ } else {
292
+ resolve(this.resolveDefaultConfig(options));
293
+ }
294
+ });
295
+ }
296
+ resolveDefaultConfig(options) {
297
+ const { requestTimeout, connectionTimeout, socketTimeout, socketAcquisitionWarningTimeout, httpAgent, httpsAgent } = options || {};
298
+ const keepAlive = true;
299
+ const maxSockets = 50;
300
+ return {
301
+ connectionTimeout,
302
+ requestTimeout: requestTimeout ?? socketTimeout,
303
+ socketAcquisitionWarningTimeout,
304
+ httpAgent: (() => {
305
+ if (httpAgent instanceof hAgent || typeof httpAgent?.destroy === "function") {
306
+ return httpAgent;
307
+ }
308
+ return new hAgent({ keepAlive, maxSockets, ...httpAgent });
309
+ })(),
310
+ httpsAgent: (() => {
311
+ if (httpsAgent instanceof hsAgent || typeof httpsAgent?.destroy === "function") {
312
+ return httpsAgent;
313
+ }
314
+ return new hsAgent({ keepAlive, maxSockets, ...httpsAgent });
315
+ })(),
316
+ logger: console
317
+ };
318
+ }
319
+ destroy() {
320
+ this.config?.httpAgent?.destroy();
321
+ this.config?.httpsAgent?.destroy();
322
+ }
323
+ async handle(request, { abortSignal, requestTimeout } = {}) {
324
+ if (!this.config) {
325
+ this.config = await this.configProvider;
326
+ }
327
+ return new Promise((_resolve, _reject) => {
328
+ let writeRequestBodyPromise = void 0;
329
+ const timeouts = [];
330
+ const resolve = async (arg) => {
331
+ await writeRequestBodyPromise;
332
+ timeouts.forEach(timing.clearTimeout);
333
+ _resolve(arg);
334
+ };
335
+ const reject = async (arg) => {
336
+ await writeRequestBodyPromise;
337
+ timeouts.forEach(timing.clearTimeout);
338
+ _reject(arg);
339
+ };
340
+ if (!this.config) {
341
+ throw new Error("Node HTTP request handler config is not resolved");
342
+ }
343
+ if (abortSignal?.aborted) {
344
+ const abortError = new Error("Request aborted");
345
+ abortError.name = "AbortError";
346
+ reject(abortError);
347
+ return;
348
+ }
349
+ const isSSL = request.protocol === "https:";
350
+ const agent = isSSL ? this.config.httpsAgent : this.config.httpAgent;
351
+ timeouts.push(timing.setTimeout(() => {
352
+ this.socketWarningTimestamp = _NodeHttpHandler.checkSocketUsage(agent, this.socketWarningTimestamp, this.config.logger);
353
+ }, this.config.socketAcquisitionWarningTimeout ?? (this.config.requestTimeout ?? 2e3) + (this.config.connectionTimeout ?? 1e3)));
354
+ const queryString = buildQueryString(request.query || {});
355
+ let auth = void 0;
356
+ if (request.username != null || request.password != null) {
357
+ const username = request.username ?? "";
358
+ const password = request.password ?? "";
359
+ auth = `${username}:${password}`;
360
+ }
361
+ let path = request.path;
362
+ if (queryString) {
363
+ path += `?${queryString}`;
364
+ }
365
+ if (request.fragment) {
366
+ path += `#${request.fragment}`;
367
+ }
368
+ let hostname = request.hostname ?? "";
369
+ if (hostname[0] === "[" && hostname.endsWith("]")) {
370
+ hostname = request.hostname.slice(1, -1);
371
+ } else {
372
+ hostname = request.hostname;
373
+ }
374
+ const nodeHttpsOptions = {
375
+ headers: request.headers,
376
+ host: hostname,
377
+ method: request.method,
378
+ path,
379
+ port: request.port,
380
+ agent,
381
+ auth
382
+ };
383
+ const requestFunc = isSSL ? hsRequest : hRequest;
384
+ const req = requestFunc(nodeHttpsOptions, (res) => {
385
+ const httpResponse = new HttpResponse({
386
+ statusCode: res.statusCode || -1,
387
+ reason: res.statusMessage,
388
+ headers: getTransformedHeaders(res.headers),
389
+ body: res
390
+ });
391
+ resolve({ response: httpResponse });
392
+ });
393
+ req.on("error", (err) => {
394
+ if (NODEJS_TIMEOUT_ERROR_CODES.includes(err.code)) {
395
+ reject(Object.assign(err, { name: "TimeoutError" }));
396
+ } else {
397
+ reject(err);
398
+ }
399
+ });
400
+ if (abortSignal) {
401
+ const onAbort = () => {
402
+ req.destroy();
403
+ const abortError = new Error("Request aborted");
404
+ abortError.name = "AbortError";
405
+ reject(abortError);
406
+ };
407
+ if (typeof abortSignal.addEventListener === "function") {
408
+ const signal = abortSignal;
409
+ signal.addEventListener("abort", onAbort, { once: true });
410
+ req.once("close", () => signal.removeEventListener("abort", onAbort));
411
+ } else {
412
+ abortSignal.onabort = onAbort;
413
+ }
414
+ }
415
+ const effectiveRequestTimeout = requestTimeout ?? this.config.requestTimeout;
416
+ timeouts.push(setConnectionTimeout(req, reject, this.config.connectionTimeout));
417
+ timeouts.push(setSocketTimeout(req, reject, effectiveRequestTimeout));
418
+ const httpAgent = nodeHttpsOptions.agent;
419
+ if (typeof httpAgent === "object" && "keepAlive" in httpAgent) {
420
+ timeouts.push(setSocketKeepAlive(req, {
421
+ keepAlive: httpAgent.keepAlive,
422
+ keepAliveMsecs: httpAgent.keepAliveMsecs
423
+ }));
424
+ }
425
+ writeRequestBodyPromise = writeRequestBody(req, request, effectiveRequestTimeout).catch((e) => {
426
+ timeouts.forEach(timing.clearTimeout);
427
+ return _reject(e);
428
+ });
429
+ });
430
+ }
431
+ updateHttpClientConfig(key, value) {
432
+ this.config = void 0;
433
+ this.configProvider = this.configProvider.then((config) => {
434
+ return {
435
+ ...config,
436
+ [key]: value
437
+ };
438
+ });
439
+ }
440
+ httpHandlerConfigs() {
441
+ return this.config ?? {};
442
+ }
443
+ };
444
+
445
+ // node_modules/@smithy/node-http-handler/dist-es/stream-collector/collector.js
446
+ import { Writable } from "stream";
447
+ var Collector = class extends Writable {
448
+ constructor() {
449
+ super(...arguments);
450
+ this.bufferedBytes = [];
451
+ }
452
+ _write(chunk, encoding, callback) {
453
+ this.bufferedBytes.push(chunk);
454
+ callback();
455
+ }
456
+ };
457
+
458
+ // node_modules/@smithy/node-http-handler/dist-es/stream-collector/index.js
459
+ var streamCollector = (stream) => {
460
+ if (isReadableStreamInstance(stream)) {
461
+ return collectReadableStream(stream);
462
+ }
463
+ return new Promise((resolve, reject) => {
464
+ const collector = new Collector();
465
+ stream.pipe(collector);
466
+ stream.on("error", (err) => {
467
+ collector.end();
468
+ reject(err);
469
+ });
470
+ collector.on("error", reject);
471
+ collector.on("finish", function() {
472
+ const bytes = new Uint8Array(Buffer.concat(this.bufferedBytes));
473
+ resolve(bytes);
474
+ });
475
+ });
476
+ };
477
+ var isReadableStreamInstance = (stream) => typeof ReadableStream === "function" && stream instanceof ReadableStream;
478
+ async function collectReadableStream(stream) {
479
+ const chunks = [];
480
+ const reader = stream.getReader();
481
+ let isDone = false;
482
+ let length = 0;
483
+ while (!isDone) {
484
+ const { done, value } = await reader.read();
485
+ if (value) {
486
+ chunks.push(value);
487
+ length += value.length;
488
+ }
489
+ isDone = done;
490
+ }
491
+ const collected = new Uint8Array(length);
492
+ let offset = 0;
493
+ for (const chunk of chunks) {
494
+ collected.set(chunk, offset);
495
+ offset += chunk.length;
496
+ }
497
+ return collected;
498
+ }
499
+
500
+ // node_modules/@smithy/core/dist-es/submodules/serde/parse-utils.js
501
+ var parseBoolean = (value) => {
502
+ switch (value) {
503
+ case "true":
504
+ return true;
505
+ case "false":
506
+ return false;
507
+ default:
508
+ throw new Error(`Unable to parse boolean value "${value}"`);
509
+ }
510
+ };
511
+ var expectNumber = (value) => {
512
+ if (value === null || value === void 0) {
513
+ return void 0;
514
+ }
515
+ if (typeof value === "string") {
516
+ const parsed = parseFloat(value);
517
+ if (!Number.isNaN(parsed)) {
518
+ if (String(parsed) !== String(value)) {
519
+ logger.warn(stackTraceWarning(`Expected number but observed string: ${value}`));
520
+ }
521
+ return parsed;
522
+ }
523
+ }
524
+ if (typeof value === "number") {
525
+ return value;
526
+ }
527
+ throw new TypeError(`Expected number, got ${typeof value}: ${value}`);
528
+ };
529
+ var MAX_FLOAT = Math.ceil(2 ** 127 * (2 - 2 ** -23));
530
+ var expectFloat32 = (value) => {
531
+ const expected = expectNumber(value);
532
+ if (expected !== void 0 && !Number.isNaN(expected) && expected !== Infinity && expected !== -Infinity) {
533
+ if (Math.abs(expected) > MAX_FLOAT) {
534
+ throw new TypeError(`Expected 32-bit float, got ${value}`);
535
+ }
536
+ }
537
+ return expected;
538
+ };
539
+ var expectLong = (value) => {
540
+ if (value === null || value === void 0) {
541
+ return void 0;
542
+ }
543
+ if (Number.isInteger(value) && !Number.isNaN(value)) {
544
+ return value;
545
+ }
546
+ throw new TypeError(`Expected integer, got ${typeof value}: ${value}`);
547
+ };
548
+ var expectInt32 = (value) => expectSizedInt(value, 32);
549
+ var expectShort = (value) => expectSizedInt(value, 16);
550
+ var expectByte = (value) => expectSizedInt(value, 8);
551
+ var expectSizedInt = (value, size) => {
552
+ const expected = expectLong(value);
553
+ if (expected !== void 0 && castInt(expected, size) !== expected) {
554
+ throw new TypeError(`Expected ${size}-bit integer, got ${value}`);
555
+ }
556
+ return expected;
557
+ };
558
+ var castInt = (value, size) => {
559
+ switch (size) {
560
+ case 32:
561
+ return Int32Array.of(value)[0];
562
+ case 16:
563
+ return Int16Array.of(value)[0];
564
+ case 8:
565
+ return Int8Array.of(value)[0];
566
+ }
567
+ };
568
+ var expectNonNull = (value, location) => {
569
+ if (value === null || value === void 0) {
570
+ if (location) {
571
+ throw new TypeError(`Expected a non-null value for ${location}`);
572
+ }
573
+ throw new TypeError("Expected a non-null value");
574
+ }
575
+ return value;
576
+ };
577
+ var expectObject = (value) => {
578
+ if (value === null || value === void 0) {
579
+ return void 0;
580
+ }
581
+ if (typeof value === "object" && !Array.isArray(value)) {
582
+ return value;
583
+ }
584
+ const receivedType = Array.isArray(value) ? "array" : typeof value;
585
+ throw new TypeError(`Expected object, got ${receivedType}: ${value}`);
586
+ };
587
+ var expectString = (value) => {
588
+ if (value === null || value === void 0) {
589
+ return void 0;
590
+ }
591
+ if (typeof value === "string") {
592
+ return value;
593
+ }
594
+ if (["boolean", "number", "bigint"].includes(typeof value)) {
595
+ logger.warn(stackTraceWarning(`Expected string, got ${typeof value}: ${value}`));
596
+ return String(value);
597
+ }
598
+ throw new TypeError(`Expected string, got ${typeof value}: ${value}`);
599
+ };
600
+ var strictParseFloat32 = (value) => {
601
+ if (typeof value == "string") {
602
+ return expectFloat32(parseNumber(value));
603
+ }
604
+ return expectFloat32(value);
605
+ };
606
+ var NUMBER_REGEX = /(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g;
607
+ var parseNumber = (value) => {
608
+ const matches = value.match(NUMBER_REGEX);
609
+ if (matches === null || matches[0].length !== value.length) {
610
+ throw new TypeError(`Expected real number, got implicit NaN`);
611
+ }
612
+ return parseFloat(value);
613
+ };
614
+ var strictParseLong = (value) => {
615
+ if (typeof value === "string") {
616
+ return expectLong(parseNumber(value));
617
+ }
618
+ return expectLong(value);
619
+ };
620
+ var strictParseInt32 = (value) => {
621
+ if (typeof value === "string") {
622
+ return expectInt32(parseNumber(value));
623
+ }
624
+ return expectInt32(value);
625
+ };
626
+ var strictParseShort = (value) => {
627
+ if (typeof value === "string") {
628
+ return expectShort(parseNumber(value));
629
+ }
630
+ return expectShort(value);
631
+ };
632
+ var strictParseByte = (value) => {
633
+ if (typeof value === "string") {
634
+ return expectByte(parseNumber(value));
635
+ }
636
+ return expectByte(value);
637
+ };
638
+ var stackTraceWarning = (message) => {
639
+ return String(new TypeError(message).stack || message).split("\n").slice(0, 5).filter((s) => !s.includes("stackTraceWarning")).join("\n");
640
+ };
641
+ var logger = {
642
+ warn: console.warn
643
+ };
644
+
645
+ // node_modules/@smithy/util-base64/dist-es/fromBase64.js
646
+ var BASE64_REGEX = /^[A-Za-z0-9+/]*={0,2}$/;
647
+ var fromBase64 = (input) => {
648
+ if (input.length * 3 % 4 !== 0) {
649
+ throw new TypeError(`Incorrect padding on base64 string.`);
650
+ }
651
+ if (!BASE64_REGEX.exec(input)) {
652
+ throw new TypeError(`Invalid base64 string.`);
653
+ }
654
+ const buffer = fromString(input, "base64");
655
+ return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
656
+ };
657
+
658
+ // node_modules/@smithy/util-utf8/dist-es/toUtf8.js
659
+ var toUtf8 = (input) => {
660
+ if (typeof input === "string") {
661
+ return input;
662
+ }
663
+ if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") {
664
+ throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");
665
+ }
666
+ return fromArrayBuffer(input.buffer, input.byteOffset, input.byteLength).toString("utf8");
667
+ };
668
+
669
+ // node_modules/@smithy/util-base64/dist-es/toBase64.js
670
+ var toBase64 = (_input) => {
671
+ let input;
672
+ if (typeof _input === "string") {
673
+ input = fromUtf8(_input);
674
+ } else {
675
+ input = _input;
676
+ }
677
+ if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") {
678
+ throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");
679
+ }
680
+ return fromArrayBuffer(input.buffer, input.byteOffset, input.byteLength).toString("base64");
681
+ };
682
+
683
+ // node_modules/@smithy/util-hex-encoding/dist-es/index.js
684
+ var SHORT_TO_HEX = {};
685
+ var HEX_TO_SHORT = {};
686
+ for (let i = 0; i < 256; i++) {
687
+ let encodedByte = i.toString(16).toLowerCase();
688
+ if (encodedByte.length === 1) {
689
+ encodedByte = `0${encodedByte}`;
690
+ }
691
+ SHORT_TO_HEX[i] = encodedByte;
692
+ HEX_TO_SHORT[encodedByte] = i;
693
+ }
694
+ function fromHex(encoded) {
695
+ if (encoded.length % 2 !== 0) {
696
+ throw new Error("Hex encoded strings must have an even number length");
697
+ }
698
+ const out = new Uint8Array(encoded.length / 2);
699
+ for (let i = 0; i < encoded.length; i += 2) {
700
+ const encodedByte = encoded.slice(i, i + 2).toLowerCase();
701
+ if (encodedByte in HEX_TO_SHORT) {
702
+ out[i / 2] = HEX_TO_SHORT[encodedByte];
703
+ } else {
704
+ throw new Error(`Cannot decode unrecognized sequence ${encodedByte} as hexadecimal`);
705
+ }
706
+ }
707
+ return out;
708
+ }
709
+ function toHex(bytes) {
710
+ let out = "";
711
+ for (let i = 0; i < bytes.byteLength; i++) {
712
+ out += SHORT_TO_HEX[bytes[i]];
713
+ }
714
+ return out;
715
+ }
716
+
717
+ export {
718
+ HttpRequest,
719
+ HttpResponse,
720
+ fromBase64,
721
+ toUtf8,
722
+ toBase64,
723
+ escapeUri,
724
+ NodeHttpHandler,
725
+ streamCollector,
726
+ fromHex,
727
+ toHex,
728
+ parseBoolean,
729
+ expectInt32,
730
+ expectNonNull,
731
+ expectObject,
732
+ expectString,
733
+ strictParseFloat32,
734
+ strictParseLong,
735
+ strictParseInt32,
736
+ strictParseShort,
737
+ strictParseByte
738
+ };
739
+ //# sourceMappingURL=chunk-JI6PVVK3.js.map