@stacksjs/actions 0.70.10 → 0.70.11

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 (54) hide show
  1. package/dist/build/core.js +1 -1
  2. package/dist/build.js +18 -3
  3. package/dist/chunk-1hqs8kt1.js +179252 -0
  4. package/dist/{chunk-fxan91t8.js → chunk-2dvnt46s.js} +31 -31
  5. package/dist/chunk-38cnnp2b.js +3823 -0
  6. package/dist/chunk-3d7m14ee.js +212 -0
  7. package/dist/chunk-76zhb40c.js +92 -0
  8. package/dist/chunk-7s5qcjkt.js +105 -0
  9. package/dist/{chunk-v1qz355d.js → chunk-8fdqje2t.js} +4 -4
  10. package/dist/chunk-9exgwfkw.js +1283 -0
  11. package/dist/chunk-a13x0e43.js +1180 -0
  12. package/dist/chunk-a7k3cdby.js +2266 -0
  13. package/dist/chunk-b5g5w1hh.js +1482 -0
  14. package/dist/chunk-bf8bq8pc.js +205 -0
  15. package/dist/chunk-bst5srwz.js +662 -0
  16. package/dist/{chunk-6jdq6549.js → chunk-djkz87qs.js} +18 -3
  17. package/dist/chunk-f6a9g4qa.js +902 -0
  18. package/dist/chunk-frw3va9v.js +69 -0
  19. package/dist/chunk-hsak03yh.js +311 -0
  20. package/dist/{chunk-8swsxabt.js → chunk-k2wcwm7g.js} +63 -3
  21. package/dist/chunk-mdj7x1vs.js +790 -0
  22. package/dist/chunk-mdqphqep.js +438 -0
  23. package/dist/chunk-p0c688mg.js +729 -0
  24. package/dist/chunk-pjjzff0p.js +2116 -0
  25. package/dist/chunk-q81mf99q.js +169 -0
  26. package/dist/chunk-q9dmga3k.js +11 -0
  27. package/dist/chunk-qhh0v93n.js +73 -0
  28. package/dist/chunk-qkm8e752.js +51 -0
  29. package/dist/chunk-saqpg5nd.js +118 -0
  30. package/dist/chunk-t5em30ak.js +379 -0
  31. package/dist/chunk-veja9rez.js +5764 -0
  32. package/dist/chunk-zsm2c35w.js +72 -0
  33. package/dist/chunk-zzerxbrm.js +107 -0
  34. package/dist/database/seed.js +18 -3
  35. package/dist/deploy/index.js +1 -1
  36. package/dist/examples.js +1 -1
  37. package/dist/fresh.js +1 -1
  38. package/dist/generate/index.js +19 -4
  39. package/dist/helpers/component-meta.js +10 -10
  40. package/dist/helpers/lib-entries.js +1 -1
  41. package/dist/index.js +18 -3
  42. package/dist/key-generate.js +1 -1
  43. package/dist/lint/fix.js +1 -1
  44. package/dist/make.js +1 -1
  45. package/dist/prepublish.js +1 -1
  46. package/dist/release.js +18 -3
  47. package/dist/test/feature.js +1 -1
  48. package/dist/test/index.js +1 -1
  49. package/dist/test/unit.js +1 -1
  50. package/dist/types.js +1 -1
  51. package/dist/upgrade/index.js +1 -1
  52. package/dist/upgrade.js +2 -2
  53. package/package.json +17 -17
  54. package/dist/chunk-8tjc3whz.js +0 -77989
@@ -0,0 +1,1482 @@
1
+ import {
2
+ require_protocols
3
+ } from "./chunk-a7k3cdby.js";
4
+ import {
5
+ require_dist_cjs
6
+ } from "./chunk-saqpg5nd.js";
7
+ import {
8
+ __toESM
9
+ } from "./chunk-9v6qtbez.js";
10
+
11
+ // ../../../../node_modules/@smithy/middleware-stack/dist-es/MiddlewareStack.js
12
+ var getAllAliases = (name, aliases) => {
13
+ const _aliases = [];
14
+ if (name) {
15
+ _aliases.push(name);
16
+ }
17
+ if (aliases) {
18
+ for (const alias of aliases) {
19
+ _aliases.push(alias);
20
+ }
21
+ }
22
+ return _aliases;
23
+ };
24
+ var getMiddlewareNameWithAliases = (name, aliases) => {
25
+ return `${name || "anonymous"}${aliases && aliases.length > 0 ? ` (a.k.a. ${aliases.join(",")})` : ""}`;
26
+ };
27
+ var constructStack = () => {
28
+ let absoluteEntries = [];
29
+ let relativeEntries = [];
30
+ let identifyOnResolve = false;
31
+ const entriesNameSet = new Set;
32
+ const sort = (entries) => entries.sort((a, b) => stepWeights[b.step] - stepWeights[a.step] || priorityWeights[b.priority || "normal"] - priorityWeights[a.priority || "normal"]);
33
+ const removeByName = (toRemove) => {
34
+ let isRemoved = false;
35
+ const filterCb = (entry) => {
36
+ const aliases = getAllAliases(entry.name, entry.aliases);
37
+ if (aliases.includes(toRemove)) {
38
+ isRemoved = true;
39
+ for (const alias of aliases) {
40
+ entriesNameSet.delete(alias);
41
+ }
42
+ return false;
43
+ }
44
+ return true;
45
+ };
46
+ absoluteEntries = absoluteEntries.filter(filterCb);
47
+ relativeEntries = relativeEntries.filter(filterCb);
48
+ return isRemoved;
49
+ };
50
+ const removeByReference = (toRemove) => {
51
+ let isRemoved = false;
52
+ const filterCb = (entry) => {
53
+ if (entry.middleware === toRemove) {
54
+ isRemoved = true;
55
+ for (const alias of getAllAliases(entry.name, entry.aliases)) {
56
+ entriesNameSet.delete(alias);
57
+ }
58
+ return false;
59
+ }
60
+ return true;
61
+ };
62
+ absoluteEntries = absoluteEntries.filter(filterCb);
63
+ relativeEntries = relativeEntries.filter(filterCb);
64
+ return isRemoved;
65
+ };
66
+ const cloneTo = (toStack) => {
67
+ absoluteEntries.forEach((entry) => {
68
+ toStack.add(entry.middleware, { ...entry });
69
+ });
70
+ relativeEntries.forEach((entry) => {
71
+ toStack.addRelativeTo(entry.middleware, { ...entry });
72
+ });
73
+ toStack.identifyOnResolve?.(stack.identifyOnResolve());
74
+ return toStack;
75
+ };
76
+ const expandRelativeMiddlewareList = (from) => {
77
+ const expandedMiddlewareList = [];
78
+ from.before.forEach((entry) => {
79
+ if (entry.before.length === 0 && entry.after.length === 0) {
80
+ expandedMiddlewareList.push(entry);
81
+ } else {
82
+ expandedMiddlewareList.push(...expandRelativeMiddlewareList(entry));
83
+ }
84
+ });
85
+ expandedMiddlewareList.push(from);
86
+ from.after.reverse().forEach((entry) => {
87
+ if (entry.before.length === 0 && entry.after.length === 0) {
88
+ expandedMiddlewareList.push(entry);
89
+ } else {
90
+ expandedMiddlewareList.push(...expandRelativeMiddlewareList(entry));
91
+ }
92
+ });
93
+ return expandedMiddlewareList;
94
+ };
95
+ const getMiddlewareList = (debug = false) => {
96
+ const normalizedAbsoluteEntries = [];
97
+ const normalizedRelativeEntries = [];
98
+ const normalizedEntriesNameMap = {};
99
+ absoluteEntries.forEach((entry) => {
100
+ const normalizedEntry = {
101
+ ...entry,
102
+ before: [],
103
+ after: []
104
+ };
105
+ for (const alias of getAllAliases(normalizedEntry.name, normalizedEntry.aliases)) {
106
+ normalizedEntriesNameMap[alias] = normalizedEntry;
107
+ }
108
+ normalizedAbsoluteEntries.push(normalizedEntry);
109
+ });
110
+ relativeEntries.forEach((entry) => {
111
+ const normalizedEntry = {
112
+ ...entry,
113
+ before: [],
114
+ after: []
115
+ };
116
+ for (const alias of getAllAliases(normalizedEntry.name, normalizedEntry.aliases)) {
117
+ normalizedEntriesNameMap[alias] = normalizedEntry;
118
+ }
119
+ normalizedRelativeEntries.push(normalizedEntry);
120
+ });
121
+ normalizedRelativeEntries.forEach((entry) => {
122
+ if (entry.toMiddleware) {
123
+ const toMiddleware = normalizedEntriesNameMap[entry.toMiddleware];
124
+ if (toMiddleware === undefined) {
125
+ if (debug) {
126
+ return;
127
+ }
128
+ throw new Error(`${entry.toMiddleware} is not found when adding ` + `${getMiddlewareNameWithAliases(entry.name, entry.aliases)} ` + `middleware ${entry.relation} ${entry.toMiddleware}`);
129
+ }
130
+ if (entry.relation === "after") {
131
+ toMiddleware.after.push(entry);
132
+ }
133
+ if (entry.relation === "before") {
134
+ toMiddleware.before.push(entry);
135
+ }
136
+ }
137
+ });
138
+ const mainChain = sort(normalizedAbsoluteEntries).map(expandRelativeMiddlewareList).reduce((wholeList, expandedMiddlewareList) => {
139
+ wholeList.push(...expandedMiddlewareList);
140
+ return wholeList;
141
+ }, []);
142
+ return mainChain;
143
+ };
144
+ const stack = {
145
+ add: (middleware, options = {}) => {
146
+ const { name, override, aliases: _aliases } = options;
147
+ const entry = {
148
+ step: "initialize",
149
+ priority: "normal",
150
+ middleware,
151
+ ...options
152
+ };
153
+ const aliases = getAllAliases(name, _aliases);
154
+ if (aliases.length > 0) {
155
+ if (aliases.some((alias) => entriesNameSet.has(alias))) {
156
+ if (!override)
157
+ throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(name, _aliases)}'`);
158
+ for (const alias of aliases) {
159
+ const toOverrideIndex = absoluteEntries.findIndex((entry2) => entry2.name === alias || entry2.aliases?.some((a) => a === alias));
160
+ if (toOverrideIndex === -1) {
161
+ continue;
162
+ }
163
+ const toOverride = absoluteEntries[toOverrideIndex];
164
+ if (toOverride.step !== entry.step || entry.priority !== toOverride.priority) {
165
+ throw new Error(`"${getMiddlewareNameWithAliases(toOverride.name, toOverride.aliases)}" middleware with ` + `${toOverride.priority} priority in ${toOverride.step} step cannot ` + `be overridden by "${getMiddlewareNameWithAliases(name, _aliases)}" middleware with ` + `${entry.priority} priority in ${entry.step} step.`);
166
+ }
167
+ absoluteEntries.splice(toOverrideIndex, 1);
168
+ }
169
+ }
170
+ for (const alias of aliases) {
171
+ entriesNameSet.add(alias);
172
+ }
173
+ }
174
+ absoluteEntries.push(entry);
175
+ },
176
+ addRelativeTo: (middleware, options) => {
177
+ const { name, override, aliases: _aliases } = options;
178
+ const entry = {
179
+ middleware,
180
+ ...options
181
+ };
182
+ const aliases = getAllAliases(name, _aliases);
183
+ if (aliases.length > 0) {
184
+ if (aliases.some((alias) => entriesNameSet.has(alias))) {
185
+ if (!override)
186
+ throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(name, _aliases)}'`);
187
+ for (const alias of aliases) {
188
+ const toOverrideIndex = relativeEntries.findIndex((entry2) => entry2.name === alias || entry2.aliases?.some((a) => a === alias));
189
+ if (toOverrideIndex === -1) {
190
+ continue;
191
+ }
192
+ const toOverride = relativeEntries[toOverrideIndex];
193
+ if (toOverride.toMiddleware !== entry.toMiddleware || toOverride.relation !== entry.relation) {
194
+ throw new Error(`"${getMiddlewareNameWithAliases(toOverride.name, toOverride.aliases)}" middleware ` + `${toOverride.relation} "${toOverride.toMiddleware}" middleware cannot be overridden ` + `by "${getMiddlewareNameWithAliases(name, _aliases)}" middleware ${entry.relation} ` + `"${entry.toMiddleware}" middleware.`);
195
+ }
196
+ relativeEntries.splice(toOverrideIndex, 1);
197
+ }
198
+ }
199
+ for (const alias of aliases) {
200
+ entriesNameSet.add(alias);
201
+ }
202
+ }
203
+ relativeEntries.push(entry);
204
+ },
205
+ clone: () => cloneTo(constructStack()),
206
+ use: (plugin) => {
207
+ plugin.applyToStack(stack);
208
+ },
209
+ remove: (toRemove) => {
210
+ if (typeof toRemove === "string")
211
+ return removeByName(toRemove);
212
+ else
213
+ return removeByReference(toRemove);
214
+ },
215
+ removeByTag: (toRemove) => {
216
+ let isRemoved = false;
217
+ const filterCb = (entry) => {
218
+ const { tags, name, aliases: _aliases } = entry;
219
+ if (tags && tags.includes(toRemove)) {
220
+ const aliases = getAllAliases(name, _aliases);
221
+ for (const alias of aliases) {
222
+ entriesNameSet.delete(alias);
223
+ }
224
+ isRemoved = true;
225
+ return false;
226
+ }
227
+ return true;
228
+ };
229
+ absoluteEntries = absoluteEntries.filter(filterCb);
230
+ relativeEntries = relativeEntries.filter(filterCb);
231
+ return isRemoved;
232
+ },
233
+ concat: (from) => {
234
+ const cloned = cloneTo(constructStack());
235
+ cloned.use(from);
236
+ cloned.identifyOnResolve(identifyOnResolve || cloned.identifyOnResolve() || (from.identifyOnResolve?.() ?? false));
237
+ return cloned;
238
+ },
239
+ applyToStack: cloneTo,
240
+ identify: () => {
241
+ return getMiddlewareList(true).map((mw) => {
242
+ const step = mw.step ?? mw.relation + " " + mw.toMiddleware;
243
+ return getMiddlewareNameWithAliases(mw.name, mw.aliases) + " - " + step;
244
+ });
245
+ },
246
+ identifyOnResolve(toggle) {
247
+ if (typeof toggle === "boolean")
248
+ identifyOnResolve = toggle;
249
+ return identifyOnResolve;
250
+ },
251
+ resolve: (handler, context) => {
252
+ for (const middleware of getMiddlewareList().map((entry) => entry.middleware).reverse()) {
253
+ handler = middleware(handler, context);
254
+ }
255
+ if (identifyOnResolve) {
256
+ console.log(stack.identify());
257
+ }
258
+ return handler;
259
+ }
260
+ };
261
+ return stack;
262
+ };
263
+ var stepWeights = {
264
+ initialize: 5,
265
+ serialize: 4,
266
+ build: 3,
267
+ finalizeRequest: 2,
268
+ deserialize: 1
269
+ };
270
+ var priorityWeights = {
271
+ high: 3,
272
+ normal: 2,
273
+ low: 1
274
+ };
275
+ // ../../../../node_modules/@smithy/smithy-client/dist-es/client.js
276
+ class Client {
277
+ constructor(config) {
278
+ this.config = config;
279
+ this.middlewareStack = constructStack();
280
+ }
281
+ send(command, optionsOrCb, cb) {
282
+ const options = typeof optionsOrCb !== "function" ? optionsOrCb : undefined;
283
+ const callback = typeof optionsOrCb === "function" ? optionsOrCb : cb;
284
+ const useHandlerCache = options === undefined && this.config.cacheMiddleware === true;
285
+ let handler;
286
+ if (useHandlerCache) {
287
+ if (!this.handlers) {
288
+ this.handlers = new WeakMap;
289
+ }
290
+ const handlers = this.handlers;
291
+ if (handlers.has(command.constructor)) {
292
+ handler = handlers.get(command.constructor);
293
+ } else {
294
+ handler = command.resolveMiddleware(this.middlewareStack, this.config, options);
295
+ handlers.set(command.constructor, handler);
296
+ }
297
+ } else {
298
+ delete this.handlers;
299
+ handler = command.resolveMiddleware(this.middlewareStack, this.config, options);
300
+ }
301
+ if (callback) {
302
+ handler(command).then((result) => callback(null, result.output), (err) => callback(err)).catch(() => {});
303
+ } else {
304
+ return handler(command).then((result) => result.output);
305
+ }
306
+ }
307
+ destroy() {
308
+ this.config?.requestHandler?.destroy?.();
309
+ delete this.handlers;
310
+ }
311
+ }
312
+
313
+ // ../../../../node_modules/@smithy/smithy-client/dist-es/command.js
314
+ var import_types = __toESM(require_dist_cjs(), 1);
315
+
316
+ class Command {
317
+ constructor() {
318
+ this.middlewareStack = constructStack();
319
+ }
320
+ static classBuilder() {
321
+ return new ClassBuilder;
322
+ }
323
+ resolveMiddlewareWithContext(clientStack, configuration, options, { middlewareFn, clientName, commandName, inputFilterSensitiveLog, outputFilterSensitiveLog, smithyContext, additionalContext, CommandCtor }) {
324
+ for (const mw of middlewareFn.bind(this)(CommandCtor, clientStack, configuration, options)) {
325
+ this.middlewareStack.use(mw);
326
+ }
327
+ const stack = clientStack.concat(this.middlewareStack);
328
+ const { logger } = configuration;
329
+ const handlerExecutionContext = {
330
+ logger,
331
+ clientName,
332
+ commandName,
333
+ inputFilterSensitiveLog,
334
+ outputFilterSensitiveLog,
335
+ [import_types.SMITHY_CONTEXT_KEY]: {
336
+ commandInstance: this,
337
+ ...smithyContext
338
+ },
339
+ ...additionalContext
340
+ };
341
+ const { requestHandler } = configuration;
342
+ return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
343
+ }
344
+ }
345
+
346
+ class ClassBuilder {
347
+ constructor() {
348
+ this._init = () => {};
349
+ this._ep = {};
350
+ this._middlewareFn = () => [];
351
+ this._commandName = "";
352
+ this._clientName = "";
353
+ this._additionalContext = {};
354
+ this._smithyContext = {};
355
+ this._inputFilterSensitiveLog = (_) => _;
356
+ this._outputFilterSensitiveLog = (_) => _;
357
+ this._serializer = null;
358
+ this._deserializer = null;
359
+ }
360
+ init(cb) {
361
+ this._init = cb;
362
+ }
363
+ ep(endpointParameterInstructions) {
364
+ this._ep = endpointParameterInstructions;
365
+ return this;
366
+ }
367
+ m(middlewareSupplier) {
368
+ this._middlewareFn = middlewareSupplier;
369
+ return this;
370
+ }
371
+ s(service, operation, smithyContext = {}) {
372
+ this._smithyContext = {
373
+ service,
374
+ operation,
375
+ ...smithyContext
376
+ };
377
+ return this;
378
+ }
379
+ c(additionalContext = {}) {
380
+ this._additionalContext = additionalContext;
381
+ return this;
382
+ }
383
+ n(clientName, commandName) {
384
+ this._clientName = clientName;
385
+ this._commandName = commandName;
386
+ return this;
387
+ }
388
+ f(inputFilter = (_) => _, outputFilter = (_) => _) {
389
+ this._inputFilterSensitiveLog = inputFilter;
390
+ this._outputFilterSensitiveLog = outputFilter;
391
+ return this;
392
+ }
393
+ ser(serializer) {
394
+ this._serializer = serializer;
395
+ return this;
396
+ }
397
+ de(deserializer) {
398
+ this._deserializer = deserializer;
399
+ return this;
400
+ }
401
+ build() {
402
+ const closure = this;
403
+ let CommandRef;
404
+ return CommandRef = class extends Command {
405
+ static getEndpointParameterInstructions() {
406
+ return closure._ep;
407
+ }
408
+ constructor(...[input]) {
409
+ super();
410
+ this.serialize = closure._serializer;
411
+ this.deserialize = closure._deserializer;
412
+ this.input = input ?? {};
413
+ closure._init(this);
414
+ }
415
+ resolveMiddleware(stack, configuration, options) {
416
+ return this.resolveMiddlewareWithContext(stack, configuration, options, {
417
+ CommandCtor: CommandRef,
418
+ middlewareFn: closure._middlewareFn,
419
+ clientName: closure._clientName,
420
+ commandName: closure._commandName,
421
+ inputFilterSensitiveLog: closure._inputFilterSensitiveLog,
422
+ outputFilterSensitiveLog: closure._outputFilterSensitiveLog,
423
+ smithyContext: closure._smithyContext,
424
+ additionalContext: closure._additionalContext
425
+ });
426
+ }
427
+ };
428
+ }
429
+ }
430
+ // ../../../../node_modules/@smithy/smithy-client/dist-es/collect-stream-body.js
431
+ var import_protocols = __toESM(require_protocols(), 1);
432
+ // ../../../../node_modules/@smithy/smithy-client/dist-es/constants.js
433
+ var SENSITIVE_STRING = "***SensitiveInformation***";
434
+ // ../../../../node_modules/@smithy/smithy-client/dist-es/parse-utils.js
435
+ var expectBoolean = (value) => {
436
+ if (value === null || value === undefined) {
437
+ return;
438
+ }
439
+ if (typeof value === "number") {
440
+ if (value === 0 || value === 1) {
441
+ logger.warn(stackTraceWarning(`Expected boolean, got ${typeof value}: ${value}`));
442
+ }
443
+ if (value === 0) {
444
+ return false;
445
+ }
446
+ if (value === 1) {
447
+ return true;
448
+ }
449
+ }
450
+ if (typeof value === "string") {
451
+ const lower = value.toLowerCase();
452
+ if (lower === "false" || lower === "true") {
453
+ logger.warn(stackTraceWarning(`Expected boolean, got ${typeof value}: ${value}`));
454
+ }
455
+ if (lower === "false") {
456
+ return false;
457
+ }
458
+ if (lower === "true") {
459
+ return true;
460
+ }
461
+ }
462
+ if (typeof value === "boolean") {
463
+ return value;
464
+ }
465
+ throw new TypeError(`Expected boolean, got ${typeof value}: ${value}`);
466
+ };
467
+ var expectNumber = (value) => {
468
+ if (value === null || value === undefined) {
469
+ return;
470
+ }
471
+ if (typeof value === "string") {
472
+ const parsed = parseFloat(value);
473
+ if (!Number.isNaN(parsed)) {
474
+ if (String(parsed) !== String(value)) {
475
+ logger.warn(stackTraceWarning(`Expected number but observed string: ${value}`));
476
+ }
477
+ return parsed;
478
+ }
479
+ }
480
+ if (typeof value === "number") {
481
+ return value;
482
+ }
483
+ throw new TypeError(`Expected number, got ${typeof value}: ${value}`);
484
+ };
485
+ var MAX_FLOAT = Math.ceil(2 ** 127 * (2 - 2 ** -23));
486
+ var expectFloat32 = (value) => {
487
+ const expected = expectNumber(value);
488
+ if (expected !== undefined && !Number.isNaN(expected) && expected !== Infinity && expected !== -Infinity) {
489
+ if (Math.abs(expected) > MAX_FLOAT) {
490
+ throw new TypeError(`Expected 32-bit float, got ${value}`);
491
+ }
492
+ }
493
+ return expected;
494
+ };
495
+ var expectLong = (value) => {
496
+ if (value === null || value === undefined) {
497
+ return;
498
+ }
499
+ if (Number.isInteger(value) && !Number.isNaN(value)) {
500
+ return value;
501
+ }
502
+ throw new TypeError(`Expected integer, got ${typeof value}: ${value}`);
503
+ };
504
+ var expectInt32 = (value) => expectSizedInt(value, 32);
505
+ var expectShort = (value) => expectSizedInt(value, 16);
506
+ var expectByte = (value) => expectSizedInt(value, 8);
507
+ var expectSizedInt = (value, size) => {
508
+ const expected = expectLong(value);
509
+ if (expected !== undefined && castInt(expected, size) !== expected) {
510
+ throw new TypeError(`Expected ${size}-bit integer, got ${value}`);
511
+ }
512
+ return expected;
513
+ };
514
+ var castInt = (value, size) => {
515
+ switch (size) {
516
+ case 32:
517
+ return Int32Array.of(value)[0];
518
+ case 16:
519
+ return Int16Array.of(value)[0];
520
+ case 8:
521
+ return Int8Array.of(value)[0];
522
+ }
523
+ };
524
+ var expectNonNull = (value, location) => {
525
+ if (value === null || value === undefined) {
526
+ if (location) {
527
+ throw new TypeError(`Expected a non-null value for ${location}`);
528
+ }
529
+ throw new TypeError("Expected a non-null value");
530
+ }
531
+ return value;
532
+ };
533
+ var expectObject = (value) => {
534
+ if (value === null || value === undefined) {
535
+ return;
536
+ }
537
+ if (typeof value === "object" && !Array.isArray(value)) {
538
+ return value;
539
+ }
540
+ const receivedType = Array.isArray(value) ? "array" : typeof value;
541
+ throw new TypeError(`Expected object, got ${receivedType}: ${value}`);
542
+ };
543
+ var expectString = (value) => {
544
+ if (value === null || value === undefined) {
545
+ return;
546
+ }
547
+ if (typeof value === "string") {
548
+ return value;
549
+ }
550
+ if (["boolean", "number", "bigint"].includes(typeof value)) {
551
+ logger.warn(stackTraceWarning(`Expected string, got ${typeof value}: ${value}`));
552
+ return String(value);
553
+ }
554
+ throw new TypeError(`Expected string, got ${typeof value}: ${value}`);
555
+ };
556
+ var strictParseFloat32 = (value) => {
557
+ if (typeof value == "string") {
558
+ return expectFloat32(parseNumber(value));
559
+ }
560
+ return expectFloat32(value);
561
+ };
562
+ var NUMBER_REGEX = /(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g;
563
+ var parseNumber = (value) => {
564
+ const matches = value.match(NUMBER_REGEX);
565
+ if (matches === null || matches[0].length !== value.length) {
566
+ throw new TypeError(`Expected real number, got implicit NaN`);
567
+ }
568
+ return parseFloat(value);
569
+ };
570
+ var limitedParseDouble = (value) => {
571
+ if (typeof value == "string") {
572
+ return parseFloatString(value);
573
+ }
574
+ return expectNumber(value);
575
+ };
576
+ var parseFloatString = (value) => {
577
+ switch (value) {
578
+ case "NaN":
579
+ return NaN;
580
+ case "Infinity":
581
+ return Infinity;
582
+ case "-Infinity":
583
+ return -Infinity;
584
+ default:
585
+ throw new Error(`Unable to parse float value: ${value}`);
586
+ }
587
+ };
588
+ var strictParseShort = (value) => {
589
+ if (typeof value === "string") {
590
+ return expectShort(parseNumber(value));
591
+ }
592
+ return expectShort(value);
593
+ };
594
+ var strictParseByte = (value) => {
595
+ if (typeof value === "string") {
596
+ return expectByte(parseNumber(value));
597
+ }
598
+ return expectByte(value);
599
+ };
600
+ var stackTraceWarning = (message) => {
601
+ return String(new TypeError(message).stack || message).split(`
602
+ `).slice(0, 5).filter((s) => !s.includes("stackTraceWarning")).join(`
603
+ `);
604
+ };
605
+ var logger = {
606
+ warn: console.warn
607
+ };
608
+
609
+ // ../../../../node_modules/@smithy/smithy-client/dist-es/date-utils.js
610
+ var MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
611
+ var RFC3339 = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/);
612
+ var parseRfc3339DateTime = (value) => {
613
+ if (value === null || value === undefined) {
614
+ return;
615
+ }
616
+ if (typeof value !== "string") {
617
+ throw new TypeError("RFC-3339 date-times must be expressed as strings");
618
+ }
619
+ const match = RFC3339.exec(value);
620
+ if (!match) {
621
+ throw new TypeError("Invalid RFC-3339 date-time value");
622
+ }
623
+ const [_, yearStr, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds] = match;
624
+ const year = strictParseShort(stripLeadingZeroes(yearStr));
625
+ const month = parseDateValue(monthStr, "month", 1, 12);
626
+ const day = parseDateValue(dayStr, "day", 1, 31);
627
+ return buildDate(year, month, day, { hours, minutes, seconds, fractionalMilliseconds });
628
+ };
629
+ var RFC3339_WITH_OFFSET = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/);
630
+ var IMF_FIXDATE = new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/);
631
+ var RFC_850_DATE = new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/);
632
+ var ASC_TIME = new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/);
633
+ var buildDate = (year, month, day, time) => {
634
+ const adjustedMonth = month - 1;
635
+ validateDayOfMonth(year, adjustedMonth, day);
636
+ return new Date(Date.UTC(year, adjustedMonth, day, parseDateValue(time.hours, "hour", 0, 23), parseDateValue(time.minutes, "minute", 0, 59), parseDateValue(time.seconds, "seconds", 0, 60), parseMilliseconds(time.fractionalMilliseconds)));
637
+ };
638
+ var FIFTY_YEARS_IN_MILLIS = 50 * 365 * 24 * 60 * 60 * 1000;
639
+ var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
640
+ var validateDayOfMonth = (year, month, day) => {
641
+ let maxDays = DAYS_IN_MONTH[month];
642
+ if (month === 1 && isLeapYear(year)) {
643
+ maxDays = 29;
644
+ }
645
+ if (day > maxDays) {
646
+ throw new TypeError(`Invalid day for ${MONTHS[month]} in ${year}: ${day}`);
647
+ }
648
+ };
649
+ var isLeapYear = (year) => {
650
+ return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
651
+ };
652
+ var parseDateValue = (value, type, lower, upper) => {
653
+ const dateVal = strictParseByte(stripLeadingZeroes(value));
654
+ if (dateVal < lower || dateVal > upper) {
655
+ throw new TypeError(`${type} must be between ${lower} and ${upper}, inclusive`);
656
+ }
657
+ return dateVal;
658
+ };
659
+ var parseMilliseconds = (value) => {
660
+ if (value === null || value === undefined) {
661
+ return 0;
662
+ }
663
+ return strictParseFloat32("0." + value) * 1000;
664
+ };
665
+ var stripLeadingZeroes = (value) => {
666
+ let idx = 0;
667
+ while (idx < value.length - 1 && value.charAt(idx) === "0") {
668
+ idx++;
669
+ }
670
+ if (idx === 0) {
671
+ return value;
672
+ }
673
+ return value.slice(idx);
674
+ };
675
+ // ../../../../node_modules/@smithy/smithy-client/dist-es/exceptions.js
676
+ class ServiceException extends Error {
677
+ constructor(options) {
678
+ super(options.message);
679
+ Object.setPrototypeOf(this, Object.getPrototypeOf(this).constructor.prototype);
680
+ this.name = options.name;
681
+ this.$fault = options.$fault;
682
+ this.$metadata = options.$metadata;
683
+ }
684
+ static isInstance(value) {
685
+ if (!value)
686
+ return false;
687
+ const candidate = value;
688
+ return ServiceException.prototype.isPrototypeOf(candidate) || Boolean(candidate.$fault) && Boolean(candidate.$metadata) && (candidate.$fault === "client" || candidate.$fault === "server");
689
+ }
690
+ static [Symbol.hasInstance](instance) {
691
+ if (!instance)
692
+ return false;
693
+ const candidate = instance;
694
+ if (this === ServiceException) {
695
+ return ServiceException.isInstance(instance);
696
+ }
697
+ if (ServiceException.isInstance(instance)) {
698
+ if (candidate.name && this.name) {
699
+ return this.prototype.isPrototypeOf(instance) || candidate.name === this.name;
700
+ }
701
+ return this.prototype.isPrototypeOf(instance);
702
+ }
703
+ return false;
704
+ }
705
+ }
706
+ var decorateServiceException = (exception, additions = {}) => {
707
+ Object.entries(additions).filter(([, v]) => v !== undefined).forEach(([k, v]) => {
708
+ if (exception[k] == undefined || exception[k] === "") {
709
+ exception[k] = v;
710
+ }
711
+ });
712
+ const message = exception.message || exception.Message || "UnknownError";
713
+ exception.message = message;
714
+ delete exception.Message;
715
+ return exception;
716
+ };
717
+
718
+ // ../../../../node_modules/@smithy/smithy-client/dist-es/default-error-handler.js
719
+ var throwDefaultError = ({ output, parsedBody, exceptionCtor, errorCode }) => {
720
+ const $metadata = deserializeMetadata(output);
721
+ const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
722
+ const response = new exceptionCtor({
723
+ name: parsedBody?.code || parsedBody?.Code || errorCode || statusCode || "UnknownError",
724
+ $fault: "client",
725
+ $metadata
726
+ });
727
+ throw decorateServiceException(response, parsedBody);
728
+ };
729
+ var withBaseException = (ExceptionCtor) => {
730
+ return ({ output, parsedBody, errorCode }) => {
731
+ throwDefaultError({ output, parsedBody, exceptionCtor: ExceptionCtor, errorCode });
732
+ };
733
+ };
734
+ var deserializeMetadata = (output) => ({
735
+ httpStatusCode: output.statusCode,
736
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
737
+ extendedRequestId: output.headers["x-amz-id-2"],
738
+ cfId: output.headers["x-amz-cf-id"]
739
+ });
740
+ // ../../../../node_modules/@smithy/smithy-client/dist-es/defaults-mode.js
741
+ var loadConfigsForDefaultMode = (mode) => {
742
+ switch (mode) {
743
+ case "standard":
744
+ return {
745
+ retryMode: "standard",
746
+ connectionTimeout: 3100
747
+ };
748
+ case "in-region":
749
+ return {
750
+ retryMode: "standard",
751
+ connectionTimeout: 1100
752
+ };
753
+ case "cross-region":
754
+ return {
755
+ retryMode: "standard",
756
+ connectionTimeout: 3100
757
+ };
758
+ case "mobile":
759
+ return {
760
+ retryMode: "standard",
761
+ connectionTimeout: 30000
762
+ };
763
+ default:
764
+ return {};
765
+ }
766
+ };
767
+ // ../../../../node_modules/@smithy/smithy-client/dist-es/emitWarningIfUnsupportedVersion.js
768
+ var warningEmitted = false;
769
+ var emitWarningIfUnsupportedVersion = (version) => {
770
+ if (version && !warningEmitted && parseInt(version.substring(1, version.indexOf("."))) < 16) {
771
+ warningEmitted = true;
772
+ }
773
+ };
774
+ // ../../../../node_modules/@smithy/smithy-client/dist-es/extended-encode-uri-component.js
775
+ var import_protocols2 = __toESM(require_protocols(), 1);
776
+ // ../../../../node_modules/@smithy/smithy-client/dist-es/extensions/checksum.js
777
+ var import_types2 = __toESM(require_dist_cjs(), 1);
778
+ var getChecksumConfiguration = (runtimeConfig) => {
779
+ const checksumAlgorithms = [];
780
+ for (const id in import_types2.AlgorithmId) {
781
+ const algorithmId = import_types2.AlgorithmId[id];
782
+ if (runtimeConfig[algorithmId] === undefined) {
783
+ continue;
784
+ }
785
+ checksumAlgorithms.push({
786
+ algorithmId: () => algorithmId,
787
+ checksumConstructor: () => runtimeConfig[algorithmId]
788
+ });
789
+ }
790
+ return {
791
+ addChecksumAlgorithm(algo) {
792
+ checksumAlgorithms.push(algo);
793
+ },
794
+ checksumAlgorithms() {
795
+ return checksumAlgorithms;
796
+ }
797
+ };
798
+ };
799
+ var resolveChecksumRuntimeConfig = (clientConfig) => {
800
+ const runtimeConfig = {};
801
+ clientConfig.checksumAlgorithms().forEach((checksumAlgorithm) => {
802
+ runtimeConfig[checksumAlgorithm.algorithmId()] = checksumAlgorithm.checksumConstructor();
803
+ });
804
+ return runtimeConfig;
805
+ };
806
+
807
+ // ../../../../node_modules/@smithy/smithy-client/dist-es/extensions/retry.js
808
+ var getRetryConfiguration = (runtimeConfig) => {
809
+ return {
810
+ setRetryStrategy(retryStrategy) {
811
+ runtimeConfig.retryStrategy = retryStrategy;
812
+ },
813
+ retryStrategy() {
814
+ return runtimeConfig.retryStrategy;
815
+ }
816
+ };
817
+ };
818
+ var resolveRetryRuntimeConfig = (retryStrategyConfiguration) => {
819
+ const runtimeConfig = {};
820
+ runtimeConfig.retryStrategy = retryStrategyConfiguration.retryStrategy();
821
+ return runtimeConfig;
822
+ };
823
+
824
+ // ../../../../node_modules/@smithy/smithy-client/dist-es/extensions/defaultExtensionConfiguration.js
825
+ var getDefaultExtensionConfiguration = (runtimeConfig) => {
826
+ return Object.assign(getChecksumConfiguration(runtimeConfig), getRetryConfiguration(runtimeConfig));
827
+ };
828
+ var resolveDefaultRuntimeConfig = (config) => {
829
+ return Object.assign(resolveChecksumRuntimeConfig(config), resolveRetryRuntimeConfig(config));
830
+ };
831
+ // ../../../../node_modules/@smithy/smithy-client/dist-es/is-serializable-header-value.js
832
+ var isSerializableHeaderValue = (value) => {
833
+ return value != null;
834
+ };
835
+ // ../../../../node_modules/@smithy/smithy-client/dist-es/lazy-json.js
836
+ var LazyJsonString = function LazyJsonString2(val) {
837
+ const str = Object.assign(new String(val), {
838
+ deserializeJSON() {
839
+ return JSON.parse(String(val));
840
+ },
841
+ toString() {
842
+ return String(val);
843
+ },
844
+ toJSON() {
845
+ return String(val);
846
+ }
847
+ });
848
+ return str;
849
+ };
850
+ LazyJsonString.from = (object) => {
851
+ if (object && typeof object === "object" && (object instanceof LazyJsonString || ("deserializeJSON" in object))) {
852
+ return object;
853
+ } else if (typeof object === "string" || Object.getPrototypeOf(object) === String.prototype) {
854
+ return LazyJsonString(String(object));
855
+ }
856
+ return LazyJsonString(JSON.stringify(object));
857
+ };
858
+ LazyJsonString.fromObject = LazyJsonString.from;
859
+ // ../../../../node_modules/@smithy/smithy-client/dist-es/NoOpLogger.js
860
+ class NoOpLogger {
861
+ trace() {}
862
+ debug() {}
863
+ info() {}
864
+ warn() {}
865
+ error() {}
866
+ }
867
+ // ../../../../node_modules/@smithy/smithy-client/dist-es/object-mapping.js
868
+ function map(arg0, arg1, arg2) {
869
+ let target;
870
+ let filter;
871
+ let instructions;
872
+ if (typeof arg1 === "undefined" && typeof arg2 === "undefined") {
873
+ target = {};
874
+ instructions = arg0;
875
+ } else {
876
+ target = arg0;
877
+ if (typeof arg1 === "function") {
878
+ filter = arg1;
879
+ instructions = arg2;
880
+ return mapWithFilter(target, filter, instructions);
881
+ } else {
882
+ instructions = arg1;
883
+ }
884
+ }
885
+ for (const key of Object.keys(instructions)) {
886
+ if (!Array.isArray(instructions[key])) {
887
+ target[key] = instructions[key];
888
+ continue;
889
+ }
890
+ applyInstruction(target, null, instructions, key);
891
+ }
892
+ return target;
893
+ }
894
+ var take = (source, instructions) => {
895
+ const out = {};
896
+ for (const key in instructions) {
897
+ applyInstruction(out, source, instructions, key);
898
+ }
899
+ return out;
900
+ };
901
+ var mapWithFilter = (target, filter, instructions) => {
902
+ return map(target, Object.entries(instructions).reduce((_instructions, [key, value]) => {
903
+ if (Array.isArray(value)) {
904
+ _instructions[key] = value;
905
+ } else {
906
+ if (typeof value === "function") {
907
+ _instructions[key] = [filter, value()];
908
+ } else {
909
+ _instructions[key] = [filter, value];
910
+ }
911
+ }
912
+ return _instructions;
913
+ }, {}));
914
+ };
915
+ var applyInstruction = (target, source, instructions, targetKey) => {
916
+ if (source !== null) {
917
+ let instruction = instructions[targetKey];
918
+ if (typeof instruction === "function") {
919
+ instruction = [, instruction];
920
+ }
921
+ const [filter2 = nonNullish, valueFn = pass, sourceKey = targetKey] = instruction;
922
+ if (typeof filter2 === "function" && filter2(source[sourceKey]) || typeof filter2 !== "function" && !!filter2) {
923
+ target[targetKey] = valueFn(source[sourceKey]);
924
+ }
925
+ return;
926
+ }
927
+ let [filter, value] = instructions[targetKey];
928
+ if (typeof value === "function") {
929
+ let _value;
930
+ const defaultFilterPassed = filter === undefined && (_value = value()) != null;
931
+ const customFilterPassed = typeof filter === "function" && !!filter(undefined) || typeof filter !== "function" && !!filter;
932
+ if (defaultFilterPassed) {
933
+ target[targetKey] = _value;
934
+ } else if (customFilterPassed) {
935
+ target[targetKey] = value();
936
+ }
937
+ } else {
938
+ const defaultFilterPassed = filter === undefined && value != null;
939
+ const customFilterPassed = typeof filter === "function" && !!filter(value) || typeof filter !== "function" && !!filter;
940
+ if (defaultFilterPassed || customFilterPassed) {
941
+ target[targetKey] = value;
942
+ }
943
+ }
944
+ };
945
+ var nonNullish = (_) => _ != null;
946
+ var pass = (_) => _;
947
+ // ../../../../node_modules/@smithy/smithy-client/dist-es/resolve-path.js
948
+ var import_protocols3 = __toESM(require_protocols(), 1);
949
+ // ../../../../node_modules/@smithy/smithy-client/dist-es/serde-json.js
950
+ var _json = (obj) => {
951
+ if (obj == null) {
952
+ return {};
953
+ }
954
+ if (Array.isArray(obj)) {
955
+ return obj.filter((_) => _ != null).map(_json);
956
+ }
957
+ if (typeof obj === "object") {
958
+ const target = {};
959
+ for (const key of Object.keys(obj)) {
960
+ if (obj[key] == null) {
961
+ continue;
962
+ }
963
+ target[key] = _json(obj[key]);
964
+ }
965
+ return target;
966
+ }
967
+ return obj;
968
+ };
969
+ // ../../../../node_modules/@smithy/protocol-http/dist-es/extensions/httpExtensionConfiguration.js
970
+ var getHttpHandlerExtensionConfiguration = (runtimeConfig) => {
971
+ return {
972
+ setHttpHandler(handler) {
973
+ runtimeConfig.httpHandler = handler;
974
+ },
975
+ httpHandler() {
976
+ return runtimeConfig.httpHandler;
977
+ },
978
+ updateHttpClientConfig(key, value) {
979
+ runtimeConfig.httpHandler?.updateHttpClientConfig(key, value);
980
+ },
981
+ httpHandlerConfigs() {
982
+ return runtimeConfig.httpHandler.httpHandlerConfigs();
983
+ }
984
+ };
985
+ };
986
+ var resolveHttpHandlerRuntimeConfig = (httpHandlerExtensionConfiguration) => {
987
+ return {
988
+ httpHandler: httpHandlerExtensionConfiguration.httpHandler()
989
+ };
990
+ };
991
+ // ../../../../node_modules/@smithy/protocol-http/dist-es/Field.js
992
+ var import_types3 = __toESM(require_dist_cjs(), 1);
993
+ // ../../../../node_modules/@smithy/protocol-http/dist-es/httpRequest.js
994
+ class HttpRequest {
995
+ constructor(options) {
996
+ this.method = options.method || "GET";
997
+ this.hostname = options.hostname || "localhost";
998
+ this.port = options.port;
999
+ this.query = options.query || {};
1000
+ this.headers = options.headers || {};
1001
+ this.body = options.body;
1002
+ this.protocol = options.protocol ? options.protocol.slice(-1) !== ":" ? `${options.protocol}:` : options.protocol : "https:";
1003
+ this.path = options.path ? options.path.charAt(0) !== "/" ? `/${options.path}` : options.path : "/";
1004
+ this.username = options.username;
1005
+ this.password = options.password;
1006
+ this.fragment = options.fragment;
1007
+ }
1008
+ static clone(request) {
1009
+ const cloned = new HttpRequest({
1010
+ ...request,
1011
+ headers: { ...request.headers }
1012
+ });
1013
+ if (cloned.query) {
1014
+ cloned.query = cloneQuery(cloned.query);
1015
+ }
1016
+ return cloned;
1017
+ }
1018
+ static isInstance(request) {
1019
+ if (!request) {
1020
+ return false;
1021
+ }
1022
+ const req = request;
1023
+ return "method" in req && "protocol" in req && "hostname" in req && "path" in req && typeof req["query"] === "object" && typeof req["headers"] === "object";
1024
+ }
1025
+ clone() {
1026
+ return HttpRequest.clone(this);
1027
+ }
1028
+ }
1029
+ function cloneQuery(query) {
1030
+ return Object.keys(query).reduce((carry, paramName) => {
1031
+ const param = query[paramName];
1032
+ return {
1033
+ ...carry,
1034
+ [paramName]: Array.isArray(param) ? [...param] : param
1035
+ };
1036
+ }, {});
1037
+ }
1038
+ // ../../../../node_modules/@smithy/protocol-http/dist-es/httpResponse.js
1039
+ class HttpResponse {
1040
+ constructor(options) {
1041
+ this.statusCode = options.statusCode;
1042
+ this.reason = options.reason;
1043
+ this.headers = options.headers || {};
1044
+ this.body = options.body;
1045
+ }
1046
+ static isInstance(response) {
1047
+ if (!response)
1048
+ return false;
1049
+ const resp = response;
1050
+ return typeof resp.statusCode === "number" && typeof resp.headers === "object";
1051
+ }
1052
+ }
1053
+ // ../../../../node_modules/@smithy/util-uri-escape/dist-es/escape-uri.js
1054
+ var escapeUri = (uri) => encodeURIComponent(uri).replace(/[!'()*]/g, hexEncode);
1055
+ var hexEncode = (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`;
1056
+ // ../../../../node_modules/@smithy/querystring-builder/dist-es/index.js
1057
+ function buildQueryString(query) {
1058
+ const parts = [];
1059
+ for (let key of Object.keys(query).sort()) {
1060
+ const value = query[key];
1061
+ key = escapeUri(key);
1062
+ if (Array.isArray(value)) {
1063
+ for (let i = 0, iLen = value.length;i < iLen; i++) {
1064
+ parts.push(`${key}=${escapeUri(value[i])}`);
1065
+ }
1066
+ } else {
1067
+ let qsEntry = key;
1068
+ if (value || typeof value === "string") {
1069
+ qsEntry += `=${escapeUri(value)}`;
1070
+ }
1071
+ parts.push(qsEntry);
1072
+ }
1073
+ }
1074
+ return parts.join("&");
1075
+ }
1076
+
1077
+ // ../../../../node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js
1078
+ import { Agent as hAgent, request as hRequest } from "node:http";
1079
+ import { Agent as hsAgent, request as hsRequest } from "node:https";
1080
+
1081
+ // ../../../../node_modules/@smithy/node-http-handler/dist-es/constants.js
1082
+ var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "EPIPE", "ETIMEDOUT"];
1083
+
1084
+ // ../../../../node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js
1085
+ var getTransformedHeaders = (headers) => {
1086
+ const transformedHeaders = {};
1087
+ for (const name of Object.keys(headers)) {
1088
+ const headerValues = headers[name];
1089
+ transformedHeaders[name] = Array.isArray(headerValues) ? headerValues.join(",") : headerValues;
1090
+ }
1091
+ return transformedHeaders;
1092
+ };
1093
+
1094
+ // ../../../../node_modules/@smithy/node-http-handler/dist-es/timing.js
1095
+ var timing = {
1096
+ setTimeout: (cb, ms) => setTimeout(cb, ms),
1097
+ clearTimeout: (timeoutId) => clearTimeout(timeoutId)
1098
+ };
1099
+
1100
+ // ../../../../node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js
1101
+ var DEFER_EVENT_LISTENER_TIME = 1000;
1102
+ var setConnectionTimeout = (request, reject, timeoutInMs = 0) => {
1103
+ if (!timeoutInMs) {
1104
+ return -1;
1105
+ }
1106
+ const registerTimeout = (offset) => {
1107
+ const timeoutId = timing.setTimeout(() => {
1108
+ request.destroy();
1109
+ reject(Object.assign(new Error(`Socket timed out without establishing a connection within ${timeoutInMs} ms`), {
1110
+ name: "TimeoutError"
1111
+ }));
1112
+ }, timeoutInMs - offset);
1113
+ const doWithSocket = (socket) => {
1114
+ if (socket?.connecting) {
1115
+ socket.on("connect", () => {
1116
+ timing.clearTimeout(timeoutId);
1117
+ });
1118
+ } else {
1119
+ timing.clearTimeout(timeoutId);
1120
+ }
1121
+ };
1122
+ if (request.socket) {
1123
+ doWithSocket(request.socket);
1124
+ } else {
1125
+ request.on("socket", doWithSocket);
1126
+ }
1127
+ };
1128
+ if (timeoutInMs < 2000) {
1129
+ registerTimeout(0);
1130
+ return 0;
1131
+ }
1132
+ return timing.setTimeout(registerTimeout.bind(null, DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME);
1133
+ };
1134
+
1135
+ // ../../../../node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js
1136
+ var DEFER_EVENT_LISTENER_TIME2 = 3000;
1137
+ var setSocketKeepAlive = (request, { keepAlive, keepAliveMsecs }, deferTimeMs = DEFER_EVENT_LISTENER_TIME2) => {
1138
+ if (keepAlive !== true) {
1139
+ return -1;
1140
+ }
1141
+ const registerListener = () => {
1142
+ if (request.socket) {
1143
+ request.socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
1144
+ } else {
1145
+ request.on("socket", (socket) => {
1146
+ socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
1147
+ });
1148
+ }
1149
+ };
1150
+ if (deferTimeMs === 0) {
1151
+ registerListener();
1152
+ return 0;
1153
+ }
1154
+ return timing.setTimeout(registerListener, deferTimeMs);
1155
+ };
1156
+
1157
+ // ../../../../node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js
1158
+ var DEFER_EVENT_LISTENER_TIME3 = 3000;
1159
+ var setSocketTimeout = (request, reject, timeoutInMs = DEFAULT_REQUEST_TIMEOUT) => {
1160
+ const registerTimeout = (offset) => {
1161
+ const timeout = timeoutInMs - offset;
1162
+ const onTimeout = () => {
1163
+ request.destroy();
1164
+ reject(Object.assign(new Error(`Connection timed out after ${timeoutInMs} ms`), { name: "TimeoutError" }));
1165
+ };
1166
+ if (request.socket) {
1167
+ request.socket.setTimeout(timeout, onTimeout);
1168
+ request.on("close", () => request.socket?.removeListener("timeout", onTimeout));
1169
+ } else {
1170
+ request.setTimeout(timeout, onTimeout);
1171
+ }
1172
+ };
1173
+ if (0 < timeoutInMs && timeoutInMs < 6000) {
1174
+ registerTimeout(0);
1175
+ return 0;
1176
+ }
1177
+ return timing.setTimeout(registerTimeout.bind(null, timeoutInMs === 0 ? 0 : DEFER_EVENT_LISTENER_TIME3), DEFER_EVENT_LISTENER_TIME3);
1178
+ };
1179
+
1180
+ // ../../../../node_modules/@smithy/node-http-handler/dist-es/write-request-body.js
1181
+ import { Readable } from "node:stream";
1182
+ var MIN_WAIT_TIME = 6000;
1183
+ async function writeRequestBody(httpRequest2, request, maxContinueTimeoutMs = MIN_WAIT_TIME) {
1184
+ const headers = request.headers ?? {};
1185
+ const expect = headers["Expect"] || headers["expect"];
1186
+ let timeoutId = -1;
1187
+ let sendBody = true;
1188
+ if (expect === "100-continue") {
1189
+ sendBody = await Promise.race([
1190
+ new Promise((resolve) => {
1191
+ timeoutId = Number(timing.setTimeout(() => resolve(true), Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs)));
1192
+ }),
1193
+ new Promise((resolve) => {
1194
+ httpRequest2.on("continue", () => {
1195
+ timing.clearTimeout(timeoutId);
1196
+ resolve(true);
1197
+ });
1198
+ httpRequest2.on("response", () => {
1199
+ timing.clearTimeout(timeoutId);
1200
+ resolve(false);
1201
+ });
1202
+ httpRequest2.on("error", () => {
1203
+ timing.clearTimeout(timeoutId);
1204
+ resolve(false);
1205
+ });
1206
+ })
1207
+ ]);
1208
+ }
1209
+ if (sendBody) {
1210
+ writeBody(httpRequest2, request.body);
1211
+ }
1212
+ }
1213
+ function writeBody(httpRequest2, body) {
1214
+ if (body instanceof Readable) {
1215
+ body.pipe(httpRequest2);
1216
+ return;
1217
+ }
1218
+ if (body) {
1219
+ if (Buffer.isBuffer(body) || typeof body === "string") {
1220
+ httpRequest2.end(body);
1221
+ return;
1222
+ }
1223
+ const uint8 = body;
1224
+ if (typeof uint8 === "object" && uint8.buffer && typeof uint8.byteOffset === "number" && typeof uint8.byteLength === "number") {
1225
+ httpRequest2.end(Buffer.from(uint8.buffer, uint8.byteOffset, uint8.byteLength));
1226
+ return;
1227
+ }
1228
+ httpRequest2.end(Buffer.from(body));
1229
+ return;
1230
+ }
1231
+ httpRequest2.end();
1232
+ }
1233
+
1234
+ // ../../../../node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js
1235
+ var DEFAULT_REQUEST_TIMEOUT = 0;
1236
+
1237
+ class NodeHttpHandler {
1238
+ static create(instanceOrOptions) {
1239
+ if (typeof instanceOrOptions?.handle === "function") {
1240
+ return instanceOrOptions;
1241
+ }
1242
+ return new NodeHttpHandler(instanceOrOptions);
1243
+ }
1244
+ static checkSocketUsage(agent, socketWarningTimestamp, logger2 = console) {
1245
+ const { sockets, requests, maxSockets } = agent;
1246
+ if (typeof maxSockets !== "number" || maxSockets === Infinity) {
1247
+ return socketWarningTimestamp;
1248
+ }
1249
+ const interval = 15000;
1250
+ if (Date.now() - interval < socketWarningTimestamp) {
1251
+ return socketWarningTimestamp;
1252
+ }
1253
+ if (sockets && requests) {
1254
+ for (const origin in sockets) {
1255
+ const socketsInUse = sockets[origin]?.length ?? 0;
1256
+ const requestsEnqueued = requests[origin]?.length ?? 0;
1257
+ if (socketsInUse >= maxSockets && requestsEnqueued >= 2 * maxSockets) {
1258
+ logger2?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${socketsInUse} and ${requestsEnqueued} additional requests are enqueued.
1259
+ See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
1260
+ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`);
1261
+ return Date.now();
1262
+ }
1263
+ }
1264
+ }
1265
+ return socketWarningTimestamp;
1266
+ }
1267
+ constructor(options) {
1268
+ this.socketWarningTimestamp = 0;
1269
+ this.metadata = { handlerProtocol: "http/1.1" };
1270
+ this.configProvider = new Promise((resolve, reject) => {
1271
+ if (typeof options === "function") {
1272
+ options().then((_options) => {
1273
+ resolve(this.resolveDefaultConfig(_options));
1274
+ }).catch(reject);
1275
+ } else {
1276
+ resolve(this.resolveDefaultConfig(options));
1277
+ }
1278
+ });
1279
+ }
1280
+ resolveDefaultConfig(options) {
1281
+ const { requestTimeout, connectionTimeout, socketTimeout, socketAcquisitionWarningTimeout, httpAgent, httpsAgent } = options || {};
1282
+ const keepAlive = true;
1283
+ const maxSockets = 50;
1284
+ return {
1285
+ connectionTimeout,
1286
+ requestTimeout: requestTimeout ?? socketTimeout,
1287
+ socketAcquisitionWarningTimeout,
1288
+ httpAgent: (() => {
1289
+ if (httpAgent instanceof hAgent || typeof httpAgent?.destroy === "function") {
1290
+ return httpAgent;
1291
+ }
1292
+ return new hAgent({ keepAlive, maxSockets, ...httpAgent });
1293
+ })(),
1294
+ httpsAgent: (() => {
1295
+ if (httpsAgent instanceof hsAgent || typeof httpsAgent?.destroy === "function") {
1296
+ return httpsAgent;
1297
+ }
1298
+ return new hsAgent({ keepAlive, maxSockets, ...httpsAgent });
1299
+ })(),
1300
+ logger: console
1301
+ };
1302
+ }
1303
+ destroy() {
1304
+ this.config?.httpAgent?.destroy();
1305
+ this.config?.httpsAgent?.destroy();
1306
+ }
1307
+ async handle(request, { abortSignal } = {}) {
1308
+ if (!this.config) {
1309
+ this.config = await this.configProvider;
1310
+ }
1311
+ return new Promise((_resolve, _reject) => {
1312
+ let writeRequestBodyPromise = undefined;
1313
+ const timeouts = [];
1314
+ const resolve = async (arg) => {
1315
+ await writeRequestBodyPromise;
1316
+ timeouts.forEach(timing.clearTimeout);
1317
+ _resolve(arg);
1318
+ };
1319
+ const reject = async (arg) => {
1320
+ await writeRequestBodyPromise;
1321
+ timeouts.forEach(timing.clearTimeout);
1322
+ _reject(arg);
1323
+ };
1324
+ if (!this.config) {
1325
+ throw new Error("Node HTTP request handler config is not resolved");
1326
+ }
1327
+ if (abortSignal?.aborted) {
1328
+ const abortError = new Error("Request aborted");
1329
+ abortError.name = "AbortError";
1330
+ reject(abortError);
1331
+ return;
1332
+ }
1333
+ const isSSL = request.protocol === "https:";
1334
+ const agent = isSSL ? this.config.httpsAgent : this.config.httpAgent;
1335
+ timeouts.push(timing.setTimeout(() => {
1336
+ this.socketWarningTimestamp = NodeHttpHandler.checkSocketUsage(agent, this.socketWarningTimestamp, this.config.logger);
1337
+ }, this.config.socketAcquisitionWarningTimeout ?? (this.config.requestTimeout ?? 2000) + (this.config.connectionTimeout ?? 1000)));
1338
+ const queryString = buildQueryString(request.query || {});
1339
+ let auth = undefined;
1340
+ if (request.username != null || request.password != null) {
1341
+ const username = request.username ?? "";
1342
+ const password = request.password ?? "";
1343
+ auth = `${username}:${password}`;
1344
+ }
1345
+ let path = request.path;
1346
+ if (queryString) {
1347
+ path += `?${queryString}`;
1348
+ }
1349
+ if (request.fragment) {
1350
+ path += `#${request.fragment}`;
1351
+ }
1352
+ let hostname = request.hostname ?? "";
1353
+ if (hostname[0] === "[" && hostname.endsWith("]")) {
1354
+ hostname = request.hostname.slice(1, -1);
1355
+ } else {
1356
+ hostname = request.hostname;
1357
+ }
1358
+ const nodeHttpsOptions = {
1359
+ headers: request.headers,
1360
+ host: hostname,
1361
+ method: request.method,
1362
+ path,
1363
+ port: request.port,
1364
+ agent,
1365
+ auth
1366
+ };
1367
+ const requestFunc = isSSL ? hsRequest : hRequest;
1368
+ const req = requestFunc(nodeHttpsOptions, (res) => {
1369
+ const httpResponse2 = new HttpResponse({
1370
+ statusCode: res.statusCode || -1,
1371
+ reason: res.statusMessage,
1372
+ headers: getTransformedHeaders(res.headers),
1373
+ body: res
1374
+ });
1375
+ resolve({ response: httpResponse2 });
1376
+ });
1377
+ req.on("error", (err) => {
1378
+ if (NODEJS_TIMEOUT_ERROR_CODES.includes(err.code)) {
1379
+ reject(Object.assign(err, { name: "TimeoutError" }));
1380
+ } else {
1381
+ reject(err);
1382
+ }
1383
+ });
1384
+ if (abortSignal) {
1385
+ const onAbort = () => {
1386
+ req.destroy();
1387
+ const abortError = new Error("Request aborted");
1388
+ abortError.name = "AbortError";
1389
+ reject(abortError);
1390
+ };
1391
+ if (typeof abortSignal.addEventListener === "function") {
1392
+ const signal = abortSignal;
1393
+ signal.addEventListener("abort", onAbort, { once: true });
1394
+ req.once("close", () => signal.removeEventListener("abort", onAbort));
1395
+ } else {
1396
+ abortSignal.onabort = onAbort;
1397
+ }
1398
+ }
1399
+ timeouts.push(setConnectionTimeout(req, reject, this.config.connectionTimeout));
1400
+ timeouts.push(setSocketTimeout(req, reject, this.config.requestTimeout));
1401
+ const httpAgent = nodeHttpsOptions.agent;
1402
+ if (typeof httpAgent === "object" && "keepAlive" in httpAgent) {
1403
+ timeouts.push(setSocketKeepAlive(req, {
1404
+ keepAlive: httpAgent.keepAlive,
1405
+ keepAliveMsecs: httpAgent.keepAliveMsecs
1406
+ }));
1407
+ }
1408
+ writeRequestBodyPromise = writeRequestBody(req, request, this.config.requestTimeout).catch((e) => {
1409
+ timeouts.forEach(timing.clearTimeout);
1410
+ return _reject(e);
1411
+ });
1412
+ });
1413
+ }
1414
+ updateHttpClientConfig(key, value) {
1415
+ this.config = undefined;
1416
+ this.configProvider = this.configProvider.then((config) => {
1417
+ return {
1418
+ ...config,
1419
+ [key]: value
1420
+ };
1421
+ });
1422
+ }
1423
+ httpHandlerConfigs() {
1424
+ return this.config ?? {};
1425
+ }
1426
+ }
1427
+ // ../../../../node_modules/@smithy/node-http-handler/dist-es/stream-collector/collector.js
1428
+ import { Writable } from "node:stream";
1429
+
1430
+ class Collector extends Writable {
1431
+ constructor() {
1432
+ super(...arguments);
1433
+ this.bufferedBytes = [];
1434
+ }
1435
+ _write(chunk, encoding, callback) {
1436
+ this.bufferedBytes.push(chunk);
1437
+ callback();
1438
+ }
1439
+ }
1440
+
1441
+ // ../../../../node_modules/@smithy/node-http-handler/dist-es/stream-collector/index.js
1442
+ var streamCollector = (stream) => {
1443
+ if (isReadableStreamInstance(stream)) {
1444
+ return collectReadableStream(stream);
1445
+ }
1446
+ return new Promise((resolve, reject) => {
1447
+ const collector = new Collector;
1448
+ stream.pipe(collector);
1449
+ stream.on("error", (err) => {
1450
+ collector.end();
1451
+ reject(err);
1452
+ });
1453
+ collector.on("error", reject);
1454
+ collector.on("finish", function() {
1455
+ const bytes = new Uint8Array(Buffer.concat(this.bufferedBytes));
1456
+ resolve(bytes);
1457
+ });
1458
+ });
1459
+ };
1460
+ var isReadableStreamInstance = (stream) => typeof ReadableStream === "function" && stream instanceof ReadableStream;
1461
+ async function collectReadableStream(stream) {
1462
+ const chunks = [];
1463
+ const reader = stream.getReader();
1464
+ let isDone = false;
1465
+ let length = 0;
1466
+ while (!isDone) {
1467
+ const { done, value } = await reader.read();
1468
+ if (value) {
1469
+ chunks.push(value);
1470
+ length += value.length;
1471
+ }
1472
+ isDone = done;
1473
+ }
1474
+ const collected = new Uint8Array(length);
1475
+ let offset = 0;
1476
+ for (const chunk of chunks) {
1477
+ collected.set(chunk, offset);
1478
+ offset += chunk.length;
1479
+ }
1480
+ return collected;
1481
+ }
1482
+ export { getHttpHandlerExtensionConfiguration, resolveHttpHandlerRuntimeConfig, HttpRequest, HttpResponse, Client, Command, SENSITIVE_STRING, expectBoolean, expectInt32, expectNonNull, expectObject, expectString, limitedParseDouble, parseRfc3339DateTime, ServiceException, decorateServiceException, withBaseException, loadConfigsForDefaultMode, emitWarningIfUnsupportedVersion, getDefaultExtensionConfiguration, resolveDefaultRuntimeConfig, isSerializableHeaderValue, NoOpLogger, map, take, _json, NodeHttpHandler, streamCollector };