@semiont/graph 0.5.4 → 0.5.6

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 (64) hide show
  1. package/README.md +0 -6
  2. package/dist/bowser-D72SKZAH.js +2820 -0
  3. package/dist/bowser-D72SKZAH.js.map +1 -0
  4. package/dist/chunk-27S56UPF.js +4754 -0
  5. package/dist/chunk-27S56UPF.js.map +1 -0
  6. package/dist/chunk-4UP2SG3N.js +2095 -0
  7. package/dist/chunk-4UP2SG3N.js.map +1 -0
  8. package/dist/chunk-6DEJAFBY.js +125 -0
  9. package/dist/chunk-6DEJAFBY.js.map +1 -0
  10. package/dist/chunk-7UD62TQI.js +3317 -0
  11. package/dist/chunk-7UD62TQI.js.map +1 -0
  12. package/dist/chunk-B2W57CWL.js +47 -0
  13. package/dist/chunk-B2W57CWL.js.map +1 -0
  14. package/dist/chunk-DCLCNCC5.js +1051 -0
  15. package/dist/chunk-DCLCNCC5.js.map +1 -0
  16. package/dist/chunk-KE4TRQI4.js +576 -0
  17. package/dist/chunk-KE4TRQI4.js.map +1 -0
  18. package/dist/chunk-MWZWSKZD.js +1166 -0
  19. package/dist/chunk-MWZWSKZD.js.map +1 -0
  20. package/dist/chunk-V4VXQDJC.js +436 -0
  21. package/dist/chunk-V4VXQDJC.js.map +1 -0
  22. package/dist/dist-es-2CKOZ7UJ.js +69 -0
  23. package/dist/dist-es-2CKOZ7UJ.js.map +1 -0
  24. package/dist/dist-es-CUJAAJXF.js +6632 -0
  25. package/dist/dist-es-CUJAAJXF.js.map +1 -0
  26. package/dist/dist-es-LM7J2FUI.js +87 -0
  27. package/dist/dist-es-LM7J2FUI.js.map +1 -0
  28. package/dist/dist-es-QTXLRLLM.js +169 -0
  29. package/dist/dist-es-QTXLRLLM.js.map +1 -0
  30. package/dist/dist-es-R223S2WP.js +484 -0
  31. package/dist/dist-es-R223S2WP.js.map +1 -0
  32. package/dist/dist-es-SI3C7IEH.js +22 -0
  33. package/dist/dist-es-SI3C7IEH.js.map +1 -0
  34. package/dist/dist-es-XNPYIYQW.js +314 -0
  35. package/dist/dist-es-XNPYIYQW.js.map +1 -0
  36. package/dist/dist-es-ZYIOCGDF.js +376 -0
  37. package/dist/dist-es-ZYIOCGDF.js.map +1 -0
  38. package/dist/event-streams-AI5RIQ2F.js +1376 -0
  39. package/dist/event-streams-AI5RIQ2F.js.map +1 -0
  40. package/dist/index.d.ts +359 -17
  41. package/dist/index.js +2 -1
  42. package/dist/index.js.map +1 -1
  43. package/dist/loadSso-6PVX5KA7.js +576 -0
  44. package/dist/loadSso-6PVX5KA7.js.map +1 -0
  45. package/dist/signin-GV4P4PGF.js +662 -0
  46. package/dist/signin-GV4P4PGF.js.map +1 -0
  47. package/dist/sso-oidc-WFVKSVW6.js +829 -0
  48. package/dist/sso-oidc-WFVKSVW6.js.map +1 -0
  49. package/dist/sts-7N7QMJRQ.js +1244 -0
  50. package/dist/sts-7N7QMJRQ.js.map +1 -0
  51. package/package.json +15 -8
  52. package/dist/factory.d.ts +0 -21
  53. package/dist/factory.d.ts.map +0 -1
  54. package/dist/implementations/janusgraph.d.ts +0 -72
  55. package/dist/implementations/janusgraph.d.ts.map +0 -1
  56. package/dist/implementations/memorygraph.d.ts +0 -70
  57. package/dist/implementations/memorygraph.d.ts.map +0 -1
  58. package/dist/implementations/neo4j.d.ts +0 -80
  59. package/dist/implementations/neo4j.d.ts.map +0 -1
  60. package/dist/implementations/neptune.d.ts +0 -78
  61. package/dist/implementations/neptune.d.ts.map +0 -1
  62. package/dist/index.d.ts.map +0 -1
  63. package/dist/interface.d.ts +0 -57
  64. package/dist/interface.d.ts.map +0 -1
@@ -0,0 +1,3317 @@
1
+ import {
2
+ CONFIG_PREFIX_SEPARATOR,
3
+ HttpRequest,
4
+ HttpResponse,
5
+ NODE_REGION_CONFIG_FILE_OPTIONS,
6
+ NODE_REGION_CONFIG_OPTIONS,
7
+ NormalizedSchema,
8
+ SMITHY_CONTEXT_KEY,
9
+ SelectorType,
10
+ booleanSelector,
11
+ getSmithyContext,
12
+ isValidHostLabel,
13
+ loadConfig,
14
+ normalizeProvider,
15
+ toEndpointV1
16
+ } from "./chunk-4UP2SG3N.js";
17
+ import {
18
+ parseRfc7231DateTime,
19
+ v4
20
+ } from "./chunk-DCLCNCC5.js";
21
+
22
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/middleware-stack/MiddlewareStack.js
23
+ var getAllAliases = (name, aliases) => {
24
+ const _aliases = [];
25
+ if (name) {
26
+ _aliases.push(name);
27
+ }
28
+ if (aliases) {
29
+ for (const alias of aliases) {
30
+ _aliases.push(alias);
31
+ }
32
+ }
33
+ return _aliases;
34
+ };
35
+ var getMiddlewareNameWithAliases = (name, aliases) => {
36
+ return `${name || "anonymous"}${aliases && aliases.length > 0 ? ` (a.k.a. ${aliases.join(",")})` : ""}`;
37
+ };
38
+ var constructStack = () => {
39
+ let absoluteEntries = [];
40
+ let relativeEntries = [];
41
+ let identifyOnResolve = false;
42
+ const entriesNameSet = /* @__PURE__ */ new Set();
43
+ const sort = (entries) => entries.sort((a, b) => stepWeights[b.step] - stepWeights[a.step] || priorityWeights[b.priority || "normal"] - priorityWeights[a.priority || "normal"]);
44
+ const removeByName = (toRemove) => {
45
+ let isRemoved = false;
46
+ const filterCb = (entry) => {
47
+ const aliases = getAllAliases(entry.name, entry.aliases);
48
+ if (aliases.includes(toRemove)) {
49
+ isRemoved = true;
50
+ for (const alias of aliases) {
51
+ entriesNameSet.delete(alias);
52
+ }
53
+ return false;
54
+ }
55
+ return true;
56
+ };
57
+ absoluteEntries = absoluteEntries.filter(filterCb);
58
+ relativeEntries = relativeEntries.filter(filterCb);
59
+ return isRemoved;
60
+ };
61
+ const removeByReference = (toRemove) => {
62
+ let isRemoved = false;
63
+ const filterCb = (entry) => {
64
+ if (entry.middleware === toRemove) {
65
+ isRemoved = true;
66
+ for (const alias of getAllAliases(entry.name, entry.aliases)) {
67
+ entriesNameSet.delete(alias);
68
+ }
69
+ return false;
70
+ }
71
+ return true;
72
+ };
73
+ absoluteEntries = absoluteEntries.filter(filterCb);
74
+ relativeEntries = relativeEntries.filter(filterCb);
75
+ return isRemoved;
76
+ };
77
+ const cloneTo = (toStack) => {
78
+ absoluteEntries.forEach((entry) => {
79
+ toStack.add(entry.middleware, { ...entry });
80
+ });
81
+ relativeEntries.forEach((entry) => {
82
+ toStack.addRelativeTo(entry.middleware, { ...entry });
83
+ });
84
+ toStack.identifyOnResolve?.(stack.identifyOnResolve());
85
+ return toStack;
86
+ };
87
+ const expandRelativeMiddlewareList = (from) => {
88
+ const expandedMiddlewareList = [];
89
+ from.before.forEach((entry) => {
90
+ if (entry.before.length === 0 && entry.after.length === 0) {
91
+ expandedMiddlewareList.push(entry);
92
+ } else {
93
+ expandedMiddlewareList.push(...expandRelativeMiddlewareList(entry));
94
+ }
95
+ });
96
+ expandedMiddlewareList.push(from);
97
+ from.after.reverse().forEach((entry) => {
98
+ if (entry.before.length === 0 && entry.after.length === 0) {
99
+ expandedMiddlewareList.push(entry);
100
+ } else {
101
+ expandedMiddlewareList.push(...expandRelativeMiddlewareList(entry));
102
+ }
103
+ });
104
+ return expandedMiddlewareList;
105
+ };
106
+ const getMiddlewareList = (debug = false) => {
107
+ const normalizedAbsoluteEntries = [];
108
+ const normalizedRelativeEntries = [];
109
+ const normalizedEntriesNameMap = {};
110
+ absoluteEntries.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
+ normalizedAbsoluteEntries.push(normalizedEntry);
120
+ });
121
+ relativeEntries.forEach((entry) => {
122
+ const normalizedEntry = {
123
+ ...entry,
124
+ before: [],
125
+ after: []
126
+ };
127
+ for (const alias of getAllAliases(normalizedEntry.name, normalizedEntry.aliases)) {
128
+ normalizedEntriesNameMap[alias] = normalizedEntry;
129
+ }
130
+ normalizedRelativeEntries.push(normalizedEntry);
131
+ });
132
+ normalizedRelativeEntries.forEach((entry) => {
133
+ if (entry.toMiddleware) {
134
+ const toMiddleware = normalizedEntriesNameMap[entry.toMiddleware];
135
+ if (toMiddleware === void 0) {
136
+ if (debug) {
137
+ return;
138
+ }
139
+ throw new Error(`${entry.toMiddleware} is not found when adding ${getMiddlewareNameWithAliases(entry.name, entry.aliases)} middleware ${entry.relation} ${entry.toMiddleware}`);
140
+ }
141
+ if (entry.relation === "after") {
142
+ toMiddleware.after.push(entry);
143
+ }
144
+ if (entry.relation === "before") {
145
+ toMiddleware.before.push(entry);
146
+ }
147
+ }
148
+ });
149
+ const mainChain = sort(normalizedAbsoluteEntries).map(expandRelativeMiddlewareList).reduce((wholeList, expandedMiddlewareList) => {
150
+ wholeList.push(...expandedMiddlewareList);
151
+ return wholeList;
152
+ }, []);
153
+ return mainChain;
154
+ };
155
+ const stack = {
156
+ add: (middleware, options = {}) => {
157
+ const { name, override, aliases: _aliases } = options;
158
+ const entry = {
159
+ step: "initialize",
160
+ priority: "normal",
161
+ middleware,
162
+ ...options
163
+ };
164
+ const aliases = getAllAliases(name, _aliases);
165
+ if (aliases.length > 0) {
166
+ if (aliases.some((alias) => entriesNameSet.has(alias))) {
167
+ if (!override)
168
+ throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(name, _aliases)}'`);
169
+ for (const alias of aliases) {
170
+ const toOverrideIndex = absoluteEntries.findIndex((entry2) => entry2.name === alias || entry2.aliases?.some((a) => a === alias));
171
+ if (toOverrideIndex === -1) {
172
+ continue;
173
+ }
174
+ const toOverride = absoluteEntries[toOverrideIndex];
175
+ if (toOverride.step !== entry.step || entry.priority !== toOverride.priority) {
176
+ 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.`);
177
+ }
178
+ absoluteEntries.splice(toOverrideIndex, 1);
179
+ }
180
+ }
181
+ for (const alias of aliases) {
182
+ entriesNameSet.add(alias);
183
+ }
184
+ }
185
+ absoluteEntries.push(entry);
186
+ },
187
+ addRelativeTo: (middleware, options) => {
188
+ const { name, override, aliases: _aliases } = options;
189
+ const entry = {
190
+ middleware,
191
+ ...options
192
+ };
193
+ const aliases = getAllAliases(name, _aliases);
194
+ if (aliases.length > 0) {
195
+ if (aliases.some((alias) => entriesNameSet.has(alias))) {
196
+ if (!override)
197
+ throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(name, _aliases)}'`);
198
+ for (const alias of aliases) {
199
+ const toOverrideIndex = relativeEntries.findIndex((entry2) => entry2.name === alias || entry2.aliases?.some((a) => a === alias));
200
+ if (toOverrideIndex === -1) {
201
+ continue;
202
+ }
203
+ const toOverride = relativeEntries[toOverrideIndex];
204
+ if (toOverride.toMiddleware !== entry.toMiddleware || toOverride.relation !== entry.relation) {
205
+ 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.`);
206
+ }
207
+ relativeEntries.splice(toOverrideIndex, 1);
208
+ }
209
+ }
210
+ for (const alias of aliases) {
211
+ entriesNameSet.add(alias);
212
+ }
213
+ }
214
+ relativeEntries.push(entry);
215
+ },
216
+ clone: () => cloneTo(constructStack()),
217
+ use: (plugin) => {
218
+ plugin.applyToStack(stack);
219
+ },
220
+ remove: (toRemove) => {
221
+ if (typeof toRemove === "string")
222
+ return removeByName(toRemove);
223
+ else
224
+ return removeByReference(toRemove);
225
+ },
226
+ removeByTag: (toRemove) => {
227
+ let isRemoved = false;
228
+ const filterCb = (entry) => {
229
+ const { tags, name, aliases: _aliases } = entry;
230
+ if (tags && tags.includes(toRemove)) {
231
+ const aliases = getAllAliases(name, _aliases);
232
+ for (const alias of aliases) {
233
+ entriesNameSet.delete(alias);
234
+ }
235
+ isRemoved = true;
236
+ return false;
237
+ }
238
+ return true;
239
+ };
240
+ absoluteEntries = absoluteEntries.filter(filterCb);
241
+ relativeEntries = relativeEntries.filter(filterCb);
242
+ return isRemoved;
243
+ },
244
+ concat: (from) => {
245
+ const cloned = cloneTo(constructStack());
246
+ cloned.use(from);
247
+ cloned.identifyOnResolve(identifyOnResolve || cloned.identifyOnResolve() || (from.identifyOnResolve?.() ?? false));
248
+ return cloned;
249
+ },
250
+ applyToStack: cloneTo,
251
+ identify: () => {
252
+ return getMiddlewareList(true).map((mw) => {
253
+ const step = mw.step ?? mw.relation + " " + mw.toMiddleware;
254
+ return getMiddlewareNameWithAliases(mw.name, mw.aliases) + " - " + step;
255
+ });
256
+ },
257
+ identifyOnResolve(toggle) {
258
+ if (typeof toggle === "boolean")
259
+ identifyOnResolve = toggle;
260
+ return identifyOnResolve;
261
+ },
262
+ resolve: (handler, context) => {
263
+ for (const middleware of getMiddlewareList().map((entry) => entry.middleware).reverse()) {
264
+ handler = middleware(handler, context);
265
+ }
266
+ if (identifyOnResolve) {
267
+ console.log(stack.identify());
268
+ }
269
+ return handler;
270
+ }
271
+ };
272
+ return stack;
273
+ };
274
+ var stepWeights = {
275
+ initialize: 5,
276
+ serialize: 4,
277
+ build: 3,
278
+ finalizeRequest: 2,
279
+ deserialize: 1
280
+ };
281
+ var priorityWeights = {
282
+ high: 3,
283
+ normal: 2,
284
+ low: 1
285
+ };
286
+
287
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/smithy-client/client.js
288
+ var Client = class {
289
+ config;
290
+ middlewareStack = constructStack();
291
+ initConfig;
292
+ handlers;
293
+ constructor(config) {
294
+ this.config = config;
295
+ const { protocol, protocolSettings } = config;
296
+ if (protocolSettings) {
297
+ if (typeof protocol === "function") {
298
+ config.protocol = new protocol(protocolSettings);
299
+ }
300
+ }
301
+ }
302
+ send(command, optionsOrCb, cb) {
303
+ const options = typeof optionsOrCb !== "function" ? optionsOrCb : void 0;
304
+ const callback = typeof optionsOrCb === "function" ? optionsOrCb : cb;
305
+ const useHandlerCache = options === void 0 && this.config.cacheMiddleware === true;
306
+ let handler;
307
+ if (useHandlerCache) {
308
+ if (!this.handlers) {
309
+ this.handlers = /* @__PURE__ */ new WeakMap();
310
+ }
311
+ const handlers = this.handlers;
312
+ if (handlers.has(command.constructor)) {
313
+ handler = handlers.get(command.constructor);
314
+ } else {
315
+ handler = command.resolveMiddleware(this.middlewareStack, this.config, options);
316
+ handlers.set(command.constructor, handler);
317
+ }
318
+ } else {
319
+ delete this.handlers;
320
+ handler = command.resolveMiddleware(this.middlewareStack, this.config, options);
321
+ }
322
+ if (callback) {
323
+ handler(command).then((result) => callback(null, result.output), (err) => callback(err)).catch(() => {
324
+ });
325
+ } else {
326
+ return handler(command).then((result) => result.output);
327
+ }
328
+ }
329
+ destroy() {
330
+ this.config?.requestHandler?.destroy?.();
331
+ delete this.handlers;
332
+ }
333
+ };
334
+
335
+ // ../../node_modules/@smithy/types/dist-es/endpoint.js
336
+ var EndpointURLScheme;
337
+ (function(EndpointURLScheme2) {
338
+ EndpointURLScheme2["HTTP"] = "http";
339
+ EndpointURLScheme2["HTTPS"] = "https";
340
+ })(EndpointURLScheme || (EndpointURLScheme = {}));
341
+
342
+ // ../../node_modules/@smithy/types/dist-es/extensions/checksum.js
343
+ var AlgorithmId;
344
+ (function(AlgorithmId2) {
345
+ AlgorithmId2["MD5"] = "md5";
346
+ AlgorithmId2["CRC32"] = "crc32";
347
+ AlgorithmId2["CRC32C"] = "crc32c";
348
+ AlgorithmId2["SHA1"] = "sha1";
349
+ AlgorithmId2["SHA256"] = "sha256";
350
+ })(AlgorithmId || (AlgorithmId = {}));
351
+
352
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/smithy-client/schemaLogFilter.js
353
+ var SENSITIVE_STRING = "***SensitiveInformation***";
354
+ function schemaLogFilter(schema, data) {
355
+ if (data == null) {
356
+ return data;
357
+ }
358
+ const ns = NormalizedSchema.of(schema);
359
+ if (ns.getMergedTraits().sensitive) {
360
+ return SENSITIVE_STRING;
361
+ }
362
+ if (ns.isListSchema()) {
363
+ const isSensitive = !!ns.getValueSchema().getMergedTraits().sensitive;
364
+ if (isSensitive) {
365
+ return SENSITIVE_STRING;
366
+ }
367
+ } else if (ns.isMapSchema()) {
368
+ const isSensitive = !!ns.getKeySchema().getMergedTraits().sensitive || !!ns.getValueSchema().getMergedTraits().sensitive;
369
+ if (isSensitive) {
370
+ return SENSITIVE_STRING;
371
+ }
372
+ } else if (ns.isStructSchema() && typeof data === "object") {
373
+ const object = data;
374
+ const newObject = {};
375
+ for (const [member, memberNs] of ns.structIterator()) {
376
+ if (object[member] != null) {
377
+ newObject[member] = schemaLogFilter(memberNs, object[member]);
378
+ }
379
+ }
380
+ return newObject;
381
+ }
382
+ return data;
383
+ }
384
+
385
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/smithy-client/command.js
386
+ var Command = class {
387
+ middlewareStack = constructStack();
388
+ schema;
389
+ static classBuilder() {
390
+ return new ClassBuilder();
391
+ }
392
+ resolveMiddlewareWithContext(clientStack, configuration, options, { middlewareFn, clientName, commandName, inputFilterSensitiveLog, outputFilterSensitiveLog, smithyContext, additionalContext, CommandCtor }) {
393
+ for (const mw of middlewareFn.bind(this)(CommandCtor, clientStack, configuration, options)) {
394
+ this.middlewareStack.use(mw);
395
+ }
396
+ const stack = clientStack.concat(this.middlewareStack);
397
+ const { logger } = configuration;
398
+ const handlerExecutionContext = {
399
+ logger,
400
+ clientName,
401
+ commandName,
402
+ inputFilterSensitiveLog,
403
+ outputFilterSensitiveLog,
404
+ [SMITHY_CONTEXT_KEY]: {
405
+ commandInstance: this,
406
+ ...smithyContext
407
+ },
408
+ ...additionalContext
409
+ };
410
+ const { requestHandler } = configuration;
411
+ let requestOptions = options ?? {};
412
+ if (smithyContext.eventStream) {
413
+ requestOptions = {
414
+ isEventStream: true,
415
+ ...requestOptions
416
+ };
417
+ }
418
+ return stack.resolve((request) => requestHandler.handle(request.request, requestOptions), handlerExecutionContext);
419
+ }
420
+ };
421
+ var ClassBuilder = class {
422
+ _init = () => {
423
+ };
424
+ _ep = {};
425
+ _middlewareFn = () => [];
426
+ _commandName = "";
427
+ _clientName = "";
428
+ _additionalContext = {};
429
+ _smithyContext = {};
430
+ _inputFilterSensitiveLog = void 0;
431
+ _outputFilterSensitiveLog = void 0;
432
+ _serializer = null;
433
+ _deserializer = null;
434
+ _operationSchema;
435
+ init(cb) {
436
+ this._init = cb;
437
+ }
438
+ ep(endpointParameterInstructions) {
439
+ this._ep = endpointParameterInstructions;
440
+ return this;
441
+ }
442
+ m(middlewareSupplier) {
443
+ this._middlewareFn = middlewareSupplier;
444
+ return this;
445
+ }
446
+ s(service, operation, smithyContext = {}) {
447
+ this._smithyContext = {
448
+ service,
449
+ operation,
450
+ ...smithyContext
451
+ };
452
+ return this;
453
+ }
454
+ c(additionalContext = {}) {
455
+ this._additionalContext = additionalContext;
456
+ return this;
457
+ }
458
+ n(clientName, commandName) {
459
+ this._clientName = clientName;
460
+ this._commandName = commandName;
461
+ return this;
462
+ }
463
+ f(inputFilter = (_) => _, outputFilter = (_) => _) {
464
+ this._inputFilterSensitiveLog = inputFilter;
465
+ this._outputFilterSensitiveLog = outputFilter;
466
+ return this;
467
+ }
468
+ ser(serializer) {
469
+ this._serializer = serializer;
470
+ return this;
471
+ }
472
+ de(deserializer) {
473
+ this._deserializer = deserializer;
474
+ return this;
475
+ }
476
+ sc(operation) {
477
+ this._operationSchema = operation;
478
+ this._smithyContext.operationSchema = operation;
479
+ return this;
480
+ }
481
+ build() {
482
+ const closure = this;
483
+ let CommandRef;
484
+ return CommandRef = class extends Command {
485
+ input;
486
+ static getEndpointParameterInstructions() {
487
+ return closure._ep;
488
+ }
489
+ constructor(...[input]) {
490
+ super();
491
+ this.input = input ?? {};
492
+ closure._init(this);
493
+ this.schema = closure._operationSchema;
494
+ }
495
+ resolveMiddleware(stack, configuration, options) {
496
+ const op = closure._operationSchema;
497
+ const input = op?.[4] ?? op?.input;
498
+ const output = op?.[5] ?? op?.output;
499
+ return this.resolveMiddlewareWithContext(stack, configuration, options, {
500
+ CommandCtor: CommandRef,
501
+ middlewareFn: closure._middlewareFn,
502
+ clientName: closure._clientName,
503
+ commandName: closure._commandName,
504
+ inputFilterSensitiveLog: closure._inputFilterSensitiveLog ?? (op ? schemaLogFilter.bind(null, input) : (_) => _),
505
+ outputFilterSensitiveLog: closure._outputFilterSensitiveLog ?? (op ? schemaLogFilter.bind(null, output) : (_) => _),
506
+ smithyContext: closure._smithyContext,
507
+ additionalContext: closure._additionalContext
508
+ });
509
+ }
510
+ serialize = closure._serializer;
511
+ deserialize = closure._deserializer;
512
+ };
513
+ }
514
+ };
515
+
516
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/util-waiter/circularReplacer.js
517
+ var getCircularReplacer = () => {
518
+ const seen = /* @__PURE__ */ new WeakSet();
519
+ return (key, value) => {
520
+ if (typeof value === "object" && value !== null) {
521
+ if (seen.has(value)) {
522
+ return "[Circular]";
523
+ }
524
+ seen.add(value);
525
+ }
526
+ return value;
527
+ };
528
+ };
529
+
530
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/util-waiter/utils/sleep.js
531
+ var sleep = (seconds) => {
532
+ return new Promise((resolve) => setTimeout(resolve, seconds * 1e3));
533
+ };
534
+
535
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/util-waiter/waiter.js
536
+ var waiterServiceDefaults = {
537
+ minDelay: 2,
538
+ maxDelay: 120
539
+ };
540
+ var WaiterState;
541
+ (function(WaiterState2) {
542
+ WaiterState2["ABORTED"] = "ABORTED";
543
+ WaiterState2["FAILURE"] = "FAILURE";
544
+ WaiterState2["SUCCESS"] = "SUCCESS";
545
+ WaiterState2["RETRY"] = "RETRY";
546
+ WaiterState2["TIMEOUT"] = "TIMEOUT";
547
+ })(WaiterState || (WaiterState = {}));
548
+ var checkExceptions = (result) => {
549
+ if (result.state === WaiterState.ABORTED) {
550
+ const abortError = new Error(`${JSON.stringify({
551
+ ...result,
552
+ reason: "Request was aborted"
553
+ }, getCircularReplacer())}`);
554
+ abortError.name = "AbortError";
555
+ throw abortError;
556
+ } else if (result.state === WaiterState.TIMEOUT) {
557
+ const timeoutError = new Error(`${JSON.stringify({
558
+ ...result,
559
+ reason: "Waiter has timed out"
560
+ }, getCircularReplacer())}`);
561
+ timeoutError.name = "TimeoutError";
562
+ throw timeoutError;
563
+ } else if (result.state !== WaiterState.SUCCESS) {
564
+ throw new Error(`${JSON.stringify(result, getCircularReplacer())}`);
565
+ }
566
+ return result;
567
+ };
568
+
569
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/util-waiter/poller.js
570
+ var runPolling = async ({ minDelay, maxDelay, maxWaitTime, abortController, client, abortSignal }, input, acceptorChecks) => {
571
+ const observedResponses = {};
572
+ const [minDelayMs, maxDelayMs] = [minDelay * 1e3, maxDelay * 1e3];
573
+ let currentAttempt = 0;
574
+ const waitUntil = Date.now() + maxWaitTime * 1e3;
575
+ const warn403Time = Date.now() + 6e4;
576
+ let didWarn403 = false;
577
+ while (true) {
578
+ if (currentAttempt > 0) {
579
+ const delayMs = exponentialBackoffWithJitter(minDelayMs, maxDelayMs, currentAttempt, waitUntil);
580
+ if (abortController?.signal?.aborted || abortSignal?.aborted) {
581
+ const message = "AbortController signal aborted.";
582
+ observedResponses[message] |= 0;
583
+ observedResponses[message] += 1;
584
+ return { state: WaiterState.ABORTED, observedResponses };
585
+ }
586
+ if (Date.now() + delayMs > waitUntil) {
587
+ return { state: WaiterState.TIMEOUT, observedResponses };
588
+ }
589
+ await sleep(delayMs / 1e3);
590
+ }
591
+ const { state: state2, reason } = await acceptorChecks(client, input);
592
+ if (reason) {
593
+ const message = createMessageFromResponse(reason);
594
+ observedResponses[message] |= 0;
595
+ observedResponses[message] += 1;
596
+ }
597
+ if (state2 !== WaiterState.RETRY) {
598
+ return { state: state2, reason, final: reason, observedResponses };
599
+ }
600
+ currentAttempt += 1;
601
+ if (!didWarn403 && Date.now() >= warn403Time) {
602
+ checkWarn403(observedResponses, client);
603
+ didWarn403 = true;
604
+ }
605
+ }
606
+ };
607
+ var checkWarn403 = (observedResponses = {}, client) => {
608
+ const orderedErrors = Object.keys(observedResponses);
609
+ let maxCount = 0;
610
+ let count403 = 0;
611
+ for (const response of orderedErrors) {
612
+ const n = observedResponses[response] | 0;
613
+ maxCount = Math.max(n, maxCount);
614
+ if (response.startsWith("403:")) {
615
+ count403 += n;
616
+ }
617
+ }
618
+ const clientLogger = client?.config?.logger;
619
+ const warningLogger = typeof clientLogger?.warn === "function" && !clientLogger.constructor?.name?.includes?.("NoOpLogger") ? clientLogger : console;
620
+ if (count403 >= 3 || orderedErrors[orderedErrors.length - 1]?.startsWith("403:")) {
621
+ warningLogger.warn(`@smithy/util-waiter WARN - 403 status code encountered during waiter polling.`);
622
+ }
623
+ };
624
+ var createMessageFromResponse = (reason) => {
625
+ const status = reason?.$response?.statusCode ?? reason?.$metadata?.httpStatusCode;
626
+ if (reason?.$responseBodyText) {
627
+ return `${status ? status + ": " : ""}Deserialization error for body: ${reason.$responseBodyText}`;
628
+ }
629
+ if (status) {
630
+ if (reason?.$response || reason?.message) {
631
+ return `${status ?? "Unknown"}: ${reason?.message}`;
632
+ }
633
+ return `${status}: OK`;
634
+ }
635
+ return String(reason?.message ?? JSON.stringify(reason, getCircularReplacer()) ?? "Unknown");
636
+ };
637
+ var exponentialBackoffWithJitter = (minDelayMs, maxDelayMs, attempt, waitUntil) => {
638
+ const attemptCountCeiling = Math.log(maxDelayMs / minDelayMs) / Math.log(2) + 1;
639
+ if (attempt > attemptCountCeiling) {
640
+ return maxDelayMs;
641
+ }
642
+ const delay = minDelayMs * 2 ** (attempt - 1);
643
+ const capped = Math.min(delay, maxDelayMs);
644
+ const waitFor = randomInRange(minDelayMs, capped);
645
+ if (Date.now() + waitFor > waitUntil) {
646
+ const timeRemaining = waitUntil - Date.now();
647
+ return Math.max(0, timeRemaining - 500);
648
+ }
649
+ return waitFor;
650
+ };
651
+ var randomInRange = (min, max) => min + Math.random() * (max - min);
652
+
653
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/util-waiter/utils/validate.js
654
+ var validateWaiterOptions = (options) => {
655
+ if (options.maxWaitTime <= 0) {
656
+ throw new Error(`WaiterConfiguration.maxWaitTime must be greater than 0`);
657
+ } else if (options.minDelay <= 0) {
658
+ throw new Error(`WaiterConfiguration.minDelay must be greater than 0`);
659
+ } else if (options.maxDelay <= 0) {
660
+ throw new Error(`WaiterConfiguration.maxDelay must be greater than 0`);
661
+ } else if (options.maxWaitTime <= options.minDelay) {
662
+ throw new Error(`WaiterConfiguration.maxWaitTime [${options.maxWaitTime}] must be greater than WaiterConfiguration.minDelay [${options.minDelay}] for this waiter`);
663
+ } else if (options.maxDelay < options.minDelay) {
664
+ throw new Error(`WaiterConfiguration.maxDelay [${options.maxDelay}] must be greater than WaiterConfiguration.minDelay [${options.minDelay}] for this waiter`);
665
+ }
666
+ };
667
+
668
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/util-waiter/createWaiter.js
669
+ var abortTimeout = (abortSignal) => {
670
+ let onAbort;
671
+ const promise = new Promise((resolve) => {
672
+ onAbort = () => resolve({ state: WaiterState.ABORTED });
673
+ if (typeof abortSignal.addEventListener === "function") {
674
+ abortSignal.addEventListener("abort", onAbort);
675
+ } else {
676
+ abortSignal.onabort = onAbort;
677
+ }
678
+ });
679
+ return {
680
+ clearListener() {
681
+ if (typeof abortSignal.removeEventListener === "function") {
682
+ abortSignal.removeEventListener("abort", onAbort);
683
+ }
684
+ },
685
+ aborted: promise
686
+ };
687
+ };
688
+ var createWaiter = async (options, input, acceptorChecks) => {
689
+ const params = {
690
+ ...waiterServiceDefaults,
691
+ ...options
692
+ };
693
+ validateWaiterOptions(params);
694
+ const exitConditions = [runPolling(params, input, acceptorChecks)];
695
+ const finalize = [];
696
+ if (options.abortSignal) {
697
+ const { aborted, clearListener } = abortTimeout(options.abortSignal);
698
+ finalize.push(clearListener);
699
+ exitConditions.push(aborted);
700
+ }
701
+ if (options.abortController?.signal) {
702
+ const { aborted, clearListener } = abortTimeout(options.abortController.signal);
703
+ finalize.push(clearListener);
704
+ exitConditions.push(aborted);
705
+ }
706
+ return Promise.race(exitConditions).then((result) => {
707
+ for (const fn of finalize) {
708
+ fn();
709
+ }
710
+ return result;
711
+ });
712
+ };
713
+
714
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/smithy-client/create-aggregated-client.js
715
+ var createAggregatedClient = (commands, Client2, options) => {
716
+ for (const [command, CommandCtor] of Object.entries(commands)) {
717
+ const methodImpl = async function(args, optionsOrCb, cb) {
718
+ const command2 = new CommandCtor(args);
719
+ if (typeof optionsOrCb === "function") {
720
+ this.send(command2, optionsOrCb);
721
+ } else if (typeof cb === "function") {
722
+ if (typeof optionsOrCb !== "object")
723
+ throw new Error(`Expected http options but got ${typeof optionsOrCb}`);
724
+ this.send(command2, optionsOrCb || {}, cb);
725
+ } else {
726
+ return this.send(command2, optionsOrCb);
727
+ }
728
+ };
729
+ const methodName = (command[0].toLowerCase() + command.slice(1)).replace(/Command$/, "");
730
+ Client2.prototype[methodName] = methodImpl;
731
+ }
732
+ const { paginators = {}, waiters = {} } = options ?? {};
733
+ for (const [paginatorName, paginatorFn] of Object.entries(paginators)) {
734
+ if (Client2.prototype[paginatorName] === void 0) {
735
+ Client2.prototype[paginatorName] = function(commandInput = {}, paginationConfiguration, ...rest) {
736
+ return paginatorFn({
737
+ ...paginationConfiguration,
738
+ client: this
739
+ }, commandInput, ...rest);
740
+ };
741
+ }
742
+ }
743
+ for (const [waiterName, waiterFn] of Object.entries(waiters)) {
744
+ if (Client2.prototype[waiterName] === void 0) {
745
+ Client2.prototype[waiterName] = async function(commandInput = {}, waiterConfiguration, ...rest) {
746
+ let config = waiterConfiguration;
747
+ if (typeof waiterConfiguration === "number") {
748
+ config = {
749
+ maxWaitTime: waiterConfiguration
750
+ };
751
+ }
752
+ return waiterFn({
753
+ ...config,
754
+ client: this
755
+ }, commandInput, ...rest);
756
+ };
757
+ }
758
+ }
759
+ };
760
+
761
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/smithy-client/exceptions.js
762
+ var ServiceException = class _ServiceException extends Error {
763
+ $fault;
764
+ $response;
765
+ $retryable;
766
+ $metadata;
767
+ constructor(options) {
768
+ super(options.message);
769
+ Object.setPrototypeOf(this, Object.getPrototypeOf(this).constructor.prototype);
770
+ this.name = options.name;
771
+ this.$fault = options.$fault;
772
+ this.$metadata = options.$metadata;
773
+ }
774
+ static isInstance(value) {
775
+ if (!value)
776
+ return false;
777
+ const candidate = value;
778
+ return _ServiceException.prototype.isPrototypeOf(candidate) || Boolean(candidate.$fault) && Boolean(candidate.$metadata) && (candidate.$fault === "client" || candidate.$fault === "server");
779
+ }
780
+ static [Symbol.hasInstance](instance) {
781
+ if (!instance)
782
+ return false;
783
+ const candidate = instance;
784
+ if (this === _ServiceException) {
785
+ return _ServiceException.isInstance(instance);
786
+ }
787
+ if (_ServiceException.isInstance(instance)) {
788
+ if (candidate.name && this.name) {
789
+ return this.prototype.isPrototypeOf(instance) || candidate.name === this.name;
790
+ }
791
+ return this.prototype.isPrototypeOf(instance);
792
+ }
793
+ return false;
794
+ }
795
+ };
796
+ var decorateServiceException = (exception, additions = {}) => {
797
+ Object.entries(additions).filter(([, v]) => v !== void 0).forEach(([k, v]) => {
798
+ if (exception[k] == void 0 || exception[k] === "") {
799
+ exception[k] = v;
800
+ }
801
+ });
802
+ const message = exception.message || exception.Message || "UnknownError";
803
+ exception.message = message;
804
+ delete exception.Message;
805
+ return exception;
806
+ };
807
+
808
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/smithy-client/defaults-mode.js
809
+ var loadConfigsForDefaultMode = (mode) => {
810
+ switch (mode) {
811
+ case "standard":
812
+ return {
813
+ retryMode: "standard",
814
+ connectionTimeout: 3100
815
+ };
816
+ case "in-region":
817
+ return {
818
+ retryMode: "standard",
819
+ connectionTimeout: 1100
820
+ };
821
+ case "cross-region":
822
+ return {
823
+ retryMode: "standard",
824
+ connectionTimeout: 3100
825
+ };
826
+ case "mobile":
827
+ return {
828
+ retryMode: "standard",
829
+ connectionTimeout: 3e4
830
+ };
831
+ default:
832
+ return {};
833
+ }
834
+ };
835
+
836
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/smithy-client/emitWarningIfUnsupportedVersion.js
837
+ var warningEmitted = false;
838
+ var emitWarningIfUnsupportedVersion = (version) => {
839
+ if (version && !warningEmitted && parseInt(version.substring(1, version.indexOf("."))) < 16) {
840
+ warningEmitted = true;
841
+ }
842
+ };
843
+
844
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/smithy-client/extensions/checksum.js
845
+ var knownAlgorithms = Object.values(AlgorithmId);
846
+ var getChecksumConfiguration = (runtimeConfig) => {
847
+ const checksumAlgorithms = [];
848
+ for (const id in AlgorithmId) {
849
+ const algorithmId = AlgorithmId[id];
850
+ if (runtimeConfig[algorithmId] === void 0) {
851
+ continue;
852
+ }
853
+ checksumAlgorithms.push({
854
+ algorithmId: () => algorithmId,
855
+ checksumConstructor: () => runtimeConfig[algorithmId]
856
+ });
857
+ }
858
+ for (const [id, ChecksumCtor] of Object.entries(runtimeConfig.checksumAlgorithms ?? {})) {
859
+ checksumAlgorithms.push({
860
+ algorithmId: () => id,
861
+ checksumConstructor: () => ChecksumCtor
862
+ });
863
+ }
864
+ return {
865
+ addChecksumAlgorithm(algo) {
866
+ runtimeConfig.checksumAlgorithms = runtimeConfig.checksumAlgorithms ?? {};
867
+ const id = algo.algorithmId();
868
+ const ctor = algo.checksumConstructor();
869
+ if (knownAlgorithms.includes(id)) {
870
+ runtimeConfig.checksumAlgorithms[id.toUpperCase()] = ctor;
871
+ } else {
872
+ runtimeConfig.checksumAlgorithms[id] = ctor;
873
+ }
874
+ checksumAlgorithms.push(algo);
875
+ },
876
+ checksumAlgorithms() {
877
+ return checksumAlgorithms;
878
+ }
879
+ };
880
+ };
881
+ var resolveChecksumRuntimeConfig = (clientConfig) => {
882
+ const runtimeConfig = {};
883
+ clientConfig.checksumAlgorithms().forEach((checksumAlgorithm) => {
884
+ const id = checksumAlgorithm.algorithmId();
885
+ if (knownAlgorithms.includes(id)) {
886
+ runtimeConfig[id] = checksumAlgorithm.checksumConstructor();
887
+ }
888
+ });
889
+ return runtimeConfig;
890
+ };
891
+
892
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/smithy-client/extensions/retry.js
893
+ var getRetryConfiguration = (runtimeConfig) => {
894
+ return {
895
+ setRetryStrategy(retryStrategy) {
896
+ runtimeConfig.retryStrategy = retryStrategy;
897
+ },
898
+ retryStrategy() {
899
+ return runtimeConfig.retryStrategy;
900
+ }
901
+ };
902
+ };
903
+ var resolveRetryRuntimeConfig = (retryStrategyConfiguration) => {
904
+ const runtimeConfig = {};
905
+ runtimeConfig.retryStrategy = retryStrategyConfiguration.retryStrategy();
906
+ return runtimeConfig;
907
+ };
908
+
909
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/smithy-client/extensions/defaultExtensionConfiguration.js
910
+ var getDefaultExtensionConfiguration = (runtimeConfig) => {
911
+ return Object.assign(getChecksumConfiguration(runtimeConfig), getRetryConfiguration(runtimeConfig));
912
+ };
913
+ var resolveDefaultRuntimeConfig = (config) => {
914
+ return Object.assign(resolveChecksumRuntimeConfig(config), resolveRetryRuntimeConfig(config));
915
+ };
916
+
917
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/smithy-client/get-value-from-text-node.js
918
+ var getValueFromTextNode = (obj) => {
919
+ const textNodeName = "#text";
920
+ for (const key in obj) {
921
+ if (obj.hasOwnProperty(key) && obj[key][textNodeName] !== void 0) {
922
+ obj[key] = obj[key][textNodeName];
923
+ } else if (typeof obj[key] === "object" && obj[key] !== null) {
924
+ obj[key] = getValueFromTextNode(obj[key]);
925
+ }
926
+ }
927
+ return obj;
928
+ };
929
+
930
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/smithy-client/NoOpLogger.js
931
+ var NoOpLogger = class {
932
+ trace() {
933
+ }
934
+ debug() {
935
+ }
936
+ info() {
937
+ }
938
+ warn() {
939
+ }
940
+ error() {
941
+ }
942
+ };
943
+
944
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/setCredentialFeature.js
945
+ function setCredentialFeature(credentials, feature, value) {
946
+ if (!credentials.$source) {
947
+ credentials.$source = {};
948
+ }
949
+ credentials.$source[feature] = value;
950
+ return credentials;
951
+ }
952
+
953
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/getEndpointUrlConfig.js
954
+ var ENV_ENDPOINT_URL = "AWS_ENDPOINT_URL";
955
+ var CONFIG_ENDPOINT_URL = "endpoint_url";
956
+ var getEndpointUrlConfig = (serviceId) => ({
957
+ environmentVariableSelector: (env2) => {
958
+ const serviceSuffixParts = serviceId.split(" ").map((w) => w.toUpperCase());
959
+ const serviceEndpointUrl = env2[[ENV_ENDPOINT_URL, ...serviceSuffixParts].join("_")];
960
+ if (serviceEndpointUrl)
961
+ return serviceEndpointUrl;
962
+ const endpointUrl = env2[ENV_ENDPOINT_URL];
963
+ if (endpointUrl)
964
+ return endpointUrl;
965
+ return void 0;
966
+ },
967
+ configFileSelector: (profile, config) => {
968
+ if (config && profile.services) {
969
+ const servicesSection = config[["services", profile.services].join(CONFIG_PREFIX_SEPARATOR)];
970
+ if (servicesSection) {
971
+ const servicePrefixParts = serviceId.split(" ").map((w) => w.toLowerCase());
972
+ const endpointUrl2 = servicesSection[[servicePrefixParts.join("_"), CONFIG_ENDPOINT_URL].join(CONFIG_PREFIX_SEPARATOR)];
973
+ if (endpointUrl2)
974
+ return endpointUrl2;
975
+ }
976
+ }
977
+ const endpointUrl = profile[CONFIG_ENDPOINT_URL];
978
+ if (endpointUrl)
979
+ return endpointUrl;
980
+ return void 0;
981
+ },
982
+ default: void 0
983
+ });
984
+
985
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/getEndpointFromConfig.js
986
+ var getEndpointFromConfig = async (serviceId) => loadConfig(getEndpointUrlConfig(serviceId ?? ""))();
987
+
988
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/service-customizations/s3.js
989
+ var resolveParamsForS3 = async (endpointParams) => {
990
+ const bucket = endpointParams?.Bucket || "";
991
+ if (typeof endpointParams.Bucket === "string") {
992
+ endpointParams.Bucket = bucket.replace(/#/g, encodeURIComponent("#")).replace(/\?/g, encodeURIComponent("?"));
993
+ }
994
+ if (isArnBucketName(bucket)) {
995
+ if (endpointParams.ForcePathStyle === true) {
996
+ throw new Error("Path-style addressing cannot be used with ARN buckets");
997
+ }
998
+ } else if (!isDnsCompatibleBucketName(bucket) || bucket.indexOf(".") !== -1 && !String(endpointParams.Endpoint).startsWith("http:") || bucket.toLowerCase() !== bucket || bucket.length < 3) {
999
+ endpointParams.ForcePathStyle = true;
1000
+ }
1001
+ if (endpointParams.DisableMultiRegionAccessPoints) {
1002
+ endpointParams.disableMultiRegionAccessPoints = true;
1003
+ endpointParams.DisableMRAP = true;
1004
+ }
1005
+ return endpointParams;
1006
+ };
1007
+ var DOMAIN_PATTERN = /^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/;
1008
+ var IP_ADDRESS_PATTERN = /(\d+\.){3}\d+/;
1009
+ var DOTS_PATTERN = /\.\./;
1010
+ var isDnsCompatibleBucketName = (bucketName) => DOMAIN_PATTERN.test(bucketName) && !IP_ADDRESS_PATTERN.test(bucketName) && !DOTS_PATTERN.test(bucketName);
1011
+ var isArnBucketName = (bucketName) => {
1012
+ const [arn, partition2, service, , , bucket] = bucketName.split(":");
1013
+ const isArn = arn === "arn" && bucketName.split(":").length >= 6;
1014
+ const isValidArn = Boolean(isArn && partition2 && service && bucket);
1015
+ if (isArn && !isValidArn) {
1016
+ throw new Error(`Invalid ARN: ${bucketName} was an invalid ARN.`);
1017
+ }
1018
+ return isValidArn;
1019
+ };
1020
+
1021
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/createConfigValueProvider.js
1022
+ var createConfigValueProvider = (configKey, canonicalEndpointParamKey, config, isClientContextParam = false) => {
1023
+ const configProvider = async () => {
1024
+ let configValue;
1025
+ if (isClientContextParam) {
1026
+ const clientContextParams = config.clientContextParams;
1027
+ const nestedValue = clientContextParams?.[configKey];
1028
+ configValue = nestedValue ?? config[configKey] ?? config[canonicalEndpointParamKey];
1029
+ } else {
1030
+ configValue = config[configKey] ?? config[canonicalEndpointParamKey];
1031
+ }
1032
+ if (typeof configValue === "function") {
1033
+ return configValue();
1034
+ }
1035
+ return configValue;
1036
+ };
1037
+ if (configKey === "credentialScope" || canonicalEndpointParamKey === "CredentialScope") {
1038
+ return async () => {
1039
+ const credentials = typeof config.credentials === "function" ? await config.credentials() : config.credentials;
1040
+ const configValue = credentials?.credentialScope ?? credentials?.CredentialScope;
1041
+ return configValue;
1042
+ };
1043
+ }
1044
+ if (configKey === "accountId" || canonicalEndpointParamKey === "AccountId") {
1045
+ return async () => {
1046
+ const credentials = typeof config.credentials === "function" ? await config.credentials() : config.credentials;
1047
+ const configValue = credentials?.accountId ?? credentials?.AccountId;
1048
+ return configValue;
1049
+ };
1050
+ }
1051
+ if (configKey === "endpoint" || canonicalEndpointParamKey === "endpoint") {
1052
+ return async () => {
1053
+ if (config.isCustomEndpoint === false) {
1054
+ return void 0;
1055
+ }
1056
+ const endpoint = await configProvider();
1057
+ if (endpoint && typeof endpoint === "object") {
1058
+ if ("url" in endpoint) {
1059
+ return endpoint.url.href;
1060
+ }
1061
+ if ("hostname" in endpoint) {
1062
+ const { protocol, hostname, port, path } = endpoint;
1063
+ return `${protocol}//${hostname}${port ? ":" + port : ""}${path}`;
1064
+ }
1065
+ }
1066
+ return endpoint;
1067
+ };
1068
+ }
1069
+ return configProvider;
1070
+ };
1071
+
1072
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/getEndpointFromInstructions.js
1073
+ function bindGetEndpointFromInstructions(getEndpointFromConfig2) {
1074
+ return async (commandInput, instructionsSupplier, clientConfig, context) => {
1075
+ if (!clientConfig.isCustomEndpoint) {
1076
+ let endpointFromConfig;
1077
+ if (clientConfig.serviceConfiguredEndpoint) {
1078
+ endpointFromConfig = await clientConfig.serviceConfiguredEndpoint();
1079
+ } else {
1080
+ endpointFromConfig = await getEndpointFromConfig2(clientConfig.serviceId);
1081
+ }
1082
+ if (endpointFromConfig) {
1083
+ clientConfig.endpoint = () => Promise.resolve(toEndpointV1(endpointFromConfig));
1084
+ clientConfig.isCustomEndpoint = true;
1085
+ }
1086
+ }
1087
+ const endpointParams = await resolveParams(commandInput, instructionsSupplier, clientConfig);
1088
+ if (typeof clientConfig.endpointProvider !== "function") {
1089
+ throw new Error("config.endpointProvider is not set.");
1090
+ }
1091
+ const endpoint = clientConfig.endpointProvider(endpointParams, context);
1092
+ if (clientConfig.isCustomEndpoint && clientConfig.endpoint) {
1093
+ const customEndpoint = await clientConfig.endpoint();
1094
+ if (customEndpoint?.headers) {
1095
+ endpoint.headers ??= {};
1096
+ for (const [name, value] of Object.entries(customEndpoint.headers)) {
1097
+ endpoint.headers[name] = Array.isArray(value) ? value : [value];
1098
+ }
1099
+ }
1100
+ }
1101
+ return endpoint;
1102
+ };
1103
+ }
1104
+ var resolveParams = async (commandInput, instructionsSupplier, clientConfig) => {
1105
+ const endpointParams = {};
1106
+ const instructions = instructionsSupplier?.getEndpointParameterInstructions?.() || {};
1107
+ for (const [name, instruction] of Object.entries(instructions)) {
1108
+ switch (instruction.type) {
1109
+ case "staticContextParams":
1110
+ endpointParams[name] = instruction.value;
1111
+ break;
1112
+ case "contextParams":
1113
+ endpointParams[name] = commandInput[instruction.name];
1114
+ break;
1115
+ case "clientContextParams":
1116
+ case "builtInParams":
1117
+ endpointParams[name] = await createConfigValueProvider(instruction.name, name, clientConfig, instruction.type !== "builtInParams")();
1118
+ break;
1119
+ case "operationContextParams":
1120
+ endpointParams[name] = instruction.get(commandInput);
1121
+ break;
1122
+ default:
1123
+ throw new Error("Unrecognized endpoint parameter instruction: " + JSON.stringify(instruction));
1124
+ }
1125
+ }
1126
+ if (Object.keys(instructions).length === 0) {
1127
+ Object.assign(endpointParams, clientConfig);
1128
+ }
1129
+ if (String(clientConfig.serviceId).toLowerCase() === "s3") {
1130
+ await resolveParamsForS3(endpointParams);
1131
+ }
1132
+ return endpointParams;
1133
+ };
1134
+
1135
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/endpointMiddleware.js
1136
+ function setFeature(context, feature, value) {
1137
+ if (!context.__smithy_context) {
1138
+ context.__smithy_context = { features: {} };
1139
+ } else if (!context.__smithy_context.features) {
1140
+ context.__smithy_context.features = {};
1141
+ }
1142
+ context.__smithy_context.features[feature] = value;
1143
+ }
1144
+ function bindEndpointMiddleware(getEndpointFromConfig2) {
1145
+ const getEndpointFromInstructions2 = bindGetEndpointFromInstructions(getEndpointFromConfig2);
1146
+ return ({ config, instructions }) => {
1147
+ return (next, context) => async (args) => {
1148
+ if (config.isCustomEndpoint) {
1149
+ setFeature(context, "ENDPOINT_OVERRIDE", "N");
1150
+ }
1151
+ const endpoint = await getEndpointFromInstructions2(args.input, {
1152
+ getEndpointParameterInstructions() {
1153
+ return instructions;
1154
+ }
1155
+ }, { ...config }, context);
1156
+ context.endpointV2 = endpoint;
1157
+ context.authSchemes = endpoint.properties?.authSchemes;
1158
+ const authScheme = context.authSchemes?.[0];
1159
+ if (authScheme) {
1160
+ context["signing_region"] = authScheme.signingRegion;
1161
+ context["signing_service"] = authScheme.signingName;
1162
+ const smithyContext = getSmithyContext(context);
1163
+ const httpAuthOption = smithyContext?.selectedHttpAuthScheme?.httpAuthOption;
1164
+ if (httpAuthOption) {
1165
+ httpAuthOption.signingProperties = Object.assign(httpAuthOption.signingProperties || {}, {
1166
+ signing_region: authScheme.signingRegion,
1167
+ signingRegion: authScheme.signingRegion,
1168
+ signing_service: authScheme.signingName,
1169
+ signingName: authScheme.signingName,
1170
+ signingRegionSet: authScheme.signingRegionSet
1171
+ }, authScheme.properties);
1172
+ }
1173
+ }
1174
+ return next({
1175
+ ...args
1176
+ });
1177
+ };
1178
+ };
1179
+ }
1180
+
1181
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/getEndpointPlugin.js
1182
+ var serializerMiddlewareOption = {
1183
+ name: "serializerMiddleware",
1184
+ step: "serialize",
1185
+ tags: ["SERIALIZER"],
1186
+ override: true
1187
+ };
1188
+ var endpointMiddlewareOptions = {
1189
+ step: "serialize",
1190
+ tags: ["ENDPOINT_PARAMETERS", "ENDPOINT_V2", "ENDPOINT"],
1191
+ name: "endpointV2Middleware",
1192
+ override: true,
1193
+ relation: "before",
1194
+ toMiddleware: serializerMiddlewareOption.name
1195
+ };
1196
+ function bindGetEndpointPlugin(getEndpointFromConfig2) {
1197
+ const endpointMiddleware2 = bindEndpointMiddleware(getEndpointFromConfig2);
1198
+ return (config, instructions) => ({
1199
+ applyToStack: (clientStack) => {
1200
+ clientStack.addRelativeTo(endpointMiddleware2({
1201
+ config,
1202
+ instructions
1203
+ }), endpointMiddlewareOptions);
1204
+ }
1205
+ });
1206
+ }
1207
+
1208
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/resolveEndpointConfig.js
1209
+ function bindResolveEndpointConfig(getEndpointFromConfig2) {
1210
+ return (input) => {
1211
+ const tls = input.tls ?? true;
1212
+ const { endpoint, useDualstackEndpoint, useFipsEndpoint } = input;
1213
+ const customEndpointProvider = endpoint != null ? async () => toEndpointV1(await normalizeProvider(endpoint)()) : void 0;
1214
+ const isCustomEndpoint = !!endpoint;
1215
+ const resolvedConfig = Object.assign(input, {
1216
+ endpoint: customEndpointProvider,
1217
+ tls,
1218
+ isCustomEndpoint,
1219
+ useDualstackEndpoint: normalizeProvider(useDualstackEndpoint ?? false),
1220
+ useFipsEndpoint: normalizeProvider(useFipsEndpoint ?? false)
1221
+ });
1222
+ let configuredEndpointPromise = void 0;
1223
+ resolvedConfig.serviceConfiguredEndpoint = async () => {
1224
+ if (input.serviceId && !configuredEndpointPromise) {
1225
+ configuredEndpointPromise = getEndpointFromConfig2(input.serviceId);
1226
+ }
1227
+ return configuredEndpointPromise;
1228
+ };
1229
+ return resolvedConfig;
1230
+ };
1231
+ }
1232
+
1233
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/bdd/BinaryDecisionDiagram.js
1234
+ var BinaryDecisionDiagram = class _BinaryDecisionDiagram {
1235
+ nodes;
1236
+ root;
1237
+ conditions;
1238
+ results;
1239
+ constructor(bdd, root, conditions, results) {
1240
+ this.nodes = bdd;
1241
+ this.root = root;
1242
+ this.conditions = conditions;
1243
+ this.results = results;
1244
+ }
1245
+ static from(bdd, root, conditions, results) {
1246
+ return new _BinaryDecisionDiagram(bdd, root, conditions, results);
1247
+ }
1248
+ };
1249
+
1250
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/cache/EndpointCache.js
1251
+ var EndpointCache = class {
1252
+ capacity;
1253
+ data = /* @__PURE__ */ new Map();
1254
+ parameters = [];
1255
+ constructor({ size, params }) {
1256
+ this.capacity = size ?? 50;
1257
+ if (params) {
1258
+ this.parameters = params;
1259
+ }
1260
+ }
1261
+ get(endpointParams, resolver) {
1262
+ const key = this.hash(endpointParams);
1263
+ if (key === false) {
1264
+ return resolver();
1265
+ }
1266
+ if (!this.data.has(key)) {
1267
+ if (this.data.size > this.capacity + 10) {
1268
+ const keys = this.data.keys();
1269
+ let i = 0;
1270
+ while (true) {
1271
+ const { value, done } = keys.next();
1272
+ this.data.delete(value);
1273
+ if (done || ++i > 10) {
1274
+ break;
1275
+ }
1276
+ }
1277
+ }
1278
+ this.data.set(key, resolver());
1279
+ }
1280
+ return this.data.get(key);
1281
+ }
1282
+ size() {
1283
+ return this.data.size;
1284
+ }
1285
+ hash(endpointParams) {
1286
+ let buffer = "";
1287
+ const { parameters } = this;
1288
+ if (parameters.length === 0) {
1289
+ return false;
1290
+ }
1291
+ for (const param of parameters) {
1292
+ const val = String(endpointParams[param] ?? "");
1293
+ if (val.includes("|;")) {
1294
+ return false;
1295
+ }
1296
+ buffer += val + "|;";
1297
+ }
1298
+ return buffer;
1299
+ }
1300
+ };
1301
+
1302
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/EndpointError.js
1303
+ var EndpointError = class extends Error {
1304
+ constructor(message) {
1305
+ super(message);
1306
+ this.name = "EndpointError";
1307
+ }
1308
+ };
1309
+
1310
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/debug/debugId.js
1311
+ var debugId = "endpoints";
1312
+
1313
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/debug/toDebugString.js
1314
+ function toDebugString(input) {
1315
+ if (typeof input !== "object" || input == null) {
1316
+ return input;
1317
+ }
1318
+ if ("ref" in input) {
1319
+ return `$${toDebugString(input.ref)}`;
1320
+ }
1321
+ if ("fn" in input) {
1322
+ return `${input.fn}(${(input.argv || []).map(toDebugString).join(", ")})`;
1323
+ }
1324
+ return JSON.stringify(input, null, 2);
1325
+ }
1326
+
1327
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/utils/customEndpointFunctions.js
1328
+ var customEndpointFunctions = {};
1329
+
1330
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/booleanEquals.js
1331
+ var booleanEquals = (value1, value2) => value1 === value2;
1332
+
1333
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/coalesce.js
1334
+ function coalesce(...args) {
1335
+ for (const arg of args) {
1336
+ if (arg != null) {
1337
+ return arg;
1338
+ }
1339
+ }
1340
+ return void 0;
1341
+ }
1342
+
1343
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/getAttrPathList.js
1344
+ var getAttrPathList = (path) => {
1345
+ const parts = path.split(".");
1346
+ const pathList = [];
1347
+ for (const part of parts) {
1348
+ const squareBracketIndex = part.indexOf("[");
1349
+ if (squareBracketIndex !== -1) {
1350
+ if (part.indexOf("]") !== part.length - 1) {
1351
+ throw new EndpointError(`Path: '${path}' does not end with ']'`);
1352
+ }
1353
+ const arrayIndex = part.slice(squareBracketIndex + 1, -1);
1354
+ if (Number.isNaN(parseInt(arrayIndex))) {
1355
+ throw new EndpointError(`Invalid array index: '${arrayIndex}' in path: '${path}'`);
1356
+ }
1357
+ if (squareBracketIndex !== 0) {
1358
+ pathList.push(part.slice(0, squareBracketIndex));
1359
+ }
1360
+ pathList.push(arrayIndex);
1361
+ } else {
1362
+ pathList.push(part);
1363
+ }
1364
+ }
1365
+ return pathList;
1366
+ };
1367
+
1368
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/getAttr.js
1369
+ var getAttr = (value, path) => getAttrPathList(path).reduce((acc, index) => {
1370
+ if (typeof acc !== "object") {
1371
+ throw new EndpointError(`Index '${index}' in '${path}' not found in '${JSON.stringify(value)}'`);
1372
+ } else if (Array.isArray(acc)) {
1373
+ const i = parseInt(index);
1374
+ return acc[i < 0 ? acc.length + i : i];
1375
+ }
1376
+ return acc[index];
1377
+ }, value);
1378
+
1379
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/isSet.js
1380
+ var isSet = (value) => value != null;
1381
+
1382
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/ite.js
1383
+ function ite(condition, trueValue, falseValue) {
1384
+ return condition ? trueValue : falseValue;
1385
+ }
1386
+
1387
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/not.js
1388
+ var not = (value) => !value;
1389
+
1390
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/isIpAddress.js
1391
+ var IP_V4_REGEX = new RegExp(`^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$`);
1392
+ var isIpAddress = (value) => IP_V4_REGEX.test(value) || value.startsWith("[") && value.endsWith("]");
1393
+
1394
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/parseURL.js
1395
+ var DEFAULT_PORTS = {
1396
+ [EndpointURLScheme.HTTP]: 80,
1397
+ [EndpointURLScheme.HTTPS]: 443
1398
+ };
1399
+ var parseURL = (value) => {
1400
+ const whatwgURL = (() => {
1401
+ try {
1402
+ if (value instanceof URL) {
1403
+ return value;
1404
+ }
1405
+ if (typeof value === "object" && "hostname" in value) {
1406
+ const { hostname: hostname2, port, protocol: protocol2 = "", path = "", query = {} } = value;
1407
+ const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path}`);
1408
+ url.search = Object.entries(query).map(([k, v]) => `${k}=${v}`).join("&");
1409
+ return url;
1410
+ }
1411
+ return new URL(value);
1412
+ } catch (error) {
1413
+ return null;
1414
+ }
1415
+ })();
1416
+ if (!whatwgURL) {
1417
+ console.error(`Unable to parse ${JSON.stringify(value)} as a whatwg URL.`);
1418
+ return null;
1419
+ }
1420
+ const urlString = whatwgURL.href;
1421
+ const { host, hostname, pathname, protocol, search } = whatwgURL;
1422
+ if (search) {
1423
+ return null;
1424
+ }
1425
+ const scheme = protocol.slice(0, -1);
1426
+ if (!Object.values(EndpointURLScheme).includes(scheme)) {
1427
+ return null;
1428
+ }
1429
+ const isIp = isIpAddress(hostname);
1430
+ const inputContainsDefaultPort = urlString.includes(`${host}:${DEFAULT_PORTS[scheme]}`) || typeof value === "string" && value.includes(`${host}:${DEFAULT_PORTS[scheme]}`);
1431
+ const authority = `${host}${inputContainsDefaultPort ? `:${DEFAULT_PORTS[scheme]}` : ``}`;
1432
+ return {
1433
+ scheme,
1434
+ authority,
1435
+ path: pathname,
1436
+ normalizedPath: pathname.endsWith("/") ? pathname : `${pathname}/`,
1437
+ isIp
1438
+ };
1439
+ };
1440
+
1441
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/split.js
1442
+ function split(value, delimiter, limit) {
1443
+ if (limit === 1) {
1444
+ return [value];
1445
+ }
1446
+ if (value === "") {
1447
+ return [""];
1448
+ }
1449
+ const parts = value.split(delimiter);
1450
+ if (limit === 0) {
1451
+ return parts;
1452
+ }
1453
+ return parts.slice(0, limit - 1).concat(parts.slice(1).join(delimiter));
1454
+ }
1455
+
1456
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/stringEquals.js
1457
+ var stringEquals = (value1, value2) => value1 === value2;
1458
+
1459
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/substring.js
1460
+ var substring = (input, start, stop, reverse) => {
1461
+ if (input == null || start >= stop || input.length < stop || /[^\u0000-\u007f]/.test(input)) {
1462
+ return null;
1463
+ }
1464
+ if (!reverse) {
1465
+ return input.substring(start, stop);
1466
+ }
1467
+ return input.substring(input.length - stop, input.length - start);
1468
+ };
1469
+
1470
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/uriEncode.js
1471
+ var uriEncode = (value) => encodeURIComponent(value).replace(/[!*'()]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`);
1472
+
1473
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/utils/endpointFunctions.js
1474
+ var endpointFunctions = {
1475
+ booleanEquals,
1476
+ coalesce,
1477
+ getAttr,
1478
+ isSet,
1479
+ isValidHostLabel,
1480
+ ite,
1481
+ not,
1482
+ parseURL,
1483
+ split,
1484
+ stringEquals,
1485
+ substring,
1486
+ uriEncode
1487
+ };
1488
+
1489
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/utils/evaluateTemplate.js
1490
+ var evaluateTemplate = (template, options) => {
1491
+ const evaluatedTemplateArr = [];
1492
+ const { referenceRecord, endpointParams } = options;
1493
+ let currentIndex = 0;
1494
+ while (currentIndex < template.length) {
1495
+ const openingBraceIndex = template.indexOf("{", currentIndex);
1496
+ if (openingBraceIndex === -1) {
1497
+ evaluatedTemplateArr.push(template.slice(currentIndex));
1498
+ break;
1499
+ }
1500
+ evaluatedTemplateArr.push(template.slice(currentIndex, openingBraceIndex));
1501
+ const closingBraceIndex = template.indexOf("}", openingBraceIndex);
1502
+ if (closingBraceIndex === -1) {
1503
+ evaluatedTemplateArr.push(template.slice(openingBraceIndex));
1504
+ break;
1505
+ }
1506
+ if (template[openingBraceIndex + 1] === "{" && template[closingBraceIndex + 1] === "}") {
1507
+ evaluatedTemplateArr.push(template.slice(openingBraceIndex + 1, closingBraceIndex));
1508
+ currentIndex = closingBraceIndex + 2;
1509
+ }
1510
+ const parameterName = template.substring(openingBraceIndex + 1, closingBraceIndex);
1511
+ if (parameterName.includes("#")) {
1512
+ const [refName, attrName] = parameterName.split("#");
1513
+ evaluatedTemplateArr.push(getAttr(referenceRecord[refName] ?? endpointParams[refName], attrName));
1514
+ } else {
1515
+ evaluatedTemplateArr.push(referenceRecord[parameterName] ?? endpointParams[parameterName]);
1516
+ }
1517
+ currentIndex = closingBraceIndex + 1;
1518
+ }
1519
+ return evaluatedTemplateArr.join("");
1520
+ };
1521
+
1522
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/utils/getReferenceValue.js
1523
+ var getReferenceValue = ({ ref }, options) => {
1524
+ return options.referenceRecord[ref] ?? options.endpointParams[ref];
1525
+ };
1526
+
1527
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/utils/evaluateExpression.js
1528
+ var evaluateExpression = (obj, keyName, options) => {
1529
+ if (typeof obj === "string") {
1530
+ return evaluateTemplate(obj, options);
1531
+ } else if (obj["fn"]) {
1532
+ return group.callFunction(obj, options);
1533
+ } else if (obj["ref"]) {
1534
+ return getReferenceValue(obj, options);
1535
+ }
1536
+ throw new EndpointError(`'${keyName}': ${String(obj)} is not a string, function or reference.`);
1537
+ };
1538
+ var callFunction = ({ fn, argv }, options) => {
1539
+ const evaluatedArgs = Array(argv.length);
1540
+ for (let i = 0; i < evaluatedArgs.length; ++i) {
1541
+ const arg = argv[i];
1542
+ if (typeof arg === "boolean" || typeof arg === "number") {
1543
+ evaluatedArgs[i] = arg;
1544
+ } else {
1545
+ evaluatedArgs[i] = group.evaluateExpression(arg, "arg", options);
1546
+ }
1547
+ }
1548
+ const namespaceSeparatorIndex = fn.indexOf(".");
1549
+ if (namespaceSeparatorIndex !== -1) {
1550
+ const namespaceFunctions = customEndpointFunctions[fn.slice(0, namespaceSeparatorIndex)];
1551
+ const customFunction = namespaceFunctions?.[fn.slice(namespaceSeparatorIndex + 1)];
1552
+ if (typeof customFunction === "function") {
1553
+ return customFunction(...evaluatedArgs);
1554
+ }
1555
+ }
1556
+ const callable = endpointFunctions[fn];
1557
+ if (typeof callable === "function") {
1558
+ return callable(...evaluatedArgs);
1559
+ }
1560
+ throw new Error(`function ${fn} not loaded in endpointFunctions.`);
1561
+ };
1562
+ var group = {
1563
+ evaluateExpression,
1564
+ callFunction
1565
+ };
1566
+
1567
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/utils/evaluateCondition.js
1568
+ var evaluateCondition = (condition, options) => {
1569
+ const { assign } = condition;
1570
+ if (assign && assign in options.referenceRecord) {
1571
+ throw new EndpointError(`'${assign}' is already defined in Reference Record.`);
1572
+ }
1573
+ const value = callFunction(condition, options);
1574
+ options.logger?.debug?.(`${debugId} evaluateCondition: ${toDebugString(condition)} = ${toDebugString(value)}`);
1575
+ const result = value === "" ? true : !!value;
1576
+ if (assign != null) {
1577
+ return { result, toAssign: { name: assign, value } };
1578
+ }
1579
+ return { result };
1580
+ };
1581
+
1582
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/utils/getEndpointHeaders.js
1583
+ var getEndpointHeaders = (headers, options) => Object.entries(headers ?? {}).reduce((acc, [headerKey, headerVal]) => {
1584
+ acc[headerKey] = headerVal.map((headerValEntry) => {
1585
+ const processedExpr = evaluateExpression(headerValEntry, "Header value entry", options);
1586
+ if (typeof processedExpr !== "string") {
1587
+ throw new EndpointError(`Header '${headerKey}' value '${processedExpr}' is not a string`);
1588
+ }
1589
+ return processedExpr;
1590
+ });
1591
+ return acc;
1592
+ }, {});
1593
+
1594
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/utils/getEndpointProperties.js
1595
+ var getEndpointProperties = (properties, options) => Object.entries(properties).reduce((acc, [propertyKey, propertyVal]) => {
1596
+ acc[propertyKey] = group2.getEndpointProperty(propertyVal, options);
1597
+ return acc;
1598
+ }, {});
1599
+ var getEndpointProperty = (property, options) => {
1600
+ if (Array.isArray(property)) {
1601
+ return property.map((propertyEntry) => getEndpointProperty(propertyEntry, options));
1602
+ }
1603
+ switch (typeof property) {
1604
+ case "string":
1605
+ return evaluateTemplate(property, options);
1606
+ case "object":
1607
+ if (property === null) {
1608
+ throw new EndpointError(`Unexpected endpoint property: ${property}`);
1609
+ }
1610
+ return group2.getEndpointProperties(property, options);
1611
+ case "boolean":
1612
+ return property;
1613
+ default:
1614
+ throw new EndpointError(`Unexpected endpoint property type: ${typeof property}`);
1615
+ }
1616
+ };
1617
+ var group2 = {
1618
+ getEndpointProperty,
1619
+ getEndpointProperties
1620
+ };
1621
+
1622
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/utils/getEndpointUrl.js
1623
+ var getEndpointUrl = (endpointUrl, options) => {
1624
+ const expression = evaluateExpression(endpointUrl, "Endpoint URL", options);
1625
+ if (typeof expression === "string") {
1626
+ try {
1627
+ return new URL(expression);
1628
+ } catch (error) {
1629
+ console.error(`Failed to construct URL with ${expression}`, error);
1630
+ throw error;
1631
+ }
1632
+ }
1633
+ throw new EndpointError(`Endpoint URL must be a string, got ${typeof expression}`);
1634
+ };
1635
+
1636
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/decideEndpoint.js
1637
+ var RESULT = 1e8;
1638
+ var decideEndpoint = (bdd, options) => {
1639
+ const { nodes, root, results, conditions } = bdd;
1640
+ let ref = root;
1641
+ const referenceRecord = {};
1642
+ const closure = {
1643
+ referenceRecord,
1644
+ endpointParams: options.endpointParams,
1645
+ logger: options.logger
1646
+ };
1647
+ while (ref !== 1 && ref !== -1 && ref < RESULT) {
1648
+ const node_i = 3 * (Math.abs(ref) - 1);
1649
+ const [condition_i, highRef, lowRef] = [nodes[node_i], nodes[node_i + 1], nodes[node_i + 2]];
1650
+ const [fn, argv, assign] = conditions[condition_i];
1651
+ const evaluation = evaluateCondition({ fn, assign, argv }, closure);
1652
+ if (evaluation.toAssign) {
1653
+ const { name, value } = evaluation.toAssign;
1654
+ referenceRecord[name] = value;
1655
+ }
1656
+ ref = ref >= 0 === evaluation.result ? highRef : lowRef;
1657
+ }
1658
+ if (ref >= RESULT) {
1659
+ const result = results[ref - RESULT];
1660
+ if (result[0] === -1) {
1661
+ const [, errorExpression] = result;
1662
+ throw new EndpointError(evaluateExpression(errorExpression, "Error", closure));
1663
+ }
1664
+ const [url, properties, headers] = result;
1665
+ return {
1666
+ url: getEndpointUrl(url, closure),
1667
+ properties: getEndpointProperties(properties, closure),
1668
+ headers: getEndpointHeaders(headers ?? {}, closure)
1669
+ };
1670
+ }
1671
+ throw new EndpointError(`No matching endpoint.`);
1672
+ };
1673
+
1674
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/index.js
1675
+ var getEndpointFromInstructions = bindGetEndpointFromInstructions(getEndpointFromConfig);
1676
+ var resolveEndpointConfig = bindResolveEndpointConfig(getEndpointFromConfig);
1677
+ var endpointMiddleware = bindEndpointMiddleware(getEndpointFromConfig);
1678
+ var getEndpointPlugin = bindGetEndpointPlugin(getEndpointFromConfig);
1679
+
1680
+ // ../../node_modules/@smithy/core/dist-es/submodules/retry/service-error-classification/constants.js
1681
+ var THROTTLING_ERROR_CODES = [
1682
+ "BandwidthLimitExceeded",
1683
+ "EC2ThrottledException",
1684
+ "LimitExceededException",
1685
+ "PriorRequestNotComplete",
1686
+ "ProvisionedThroughputExceededException",
1687
+ "RequestLimitExceeded",
1688
+ "RequestThrottled",
1689
+ "RequestThrottledException",
1690
+ "SlowDown",
1691
+ "ThrottledException",
1692
+ "Throttling",
1693
+ "ThrottlingException",
1694
+ "TooManyRequestsException",
1695
+ "TransactionInProgressException"
1696
+ ];
1697
+ var TRANSIENT_ERROR_CODES = ["TimeoutError", "RequestTimeout", "RequestTimeoutException"];
1698
+ var TRANSIENT_ERROR_STATUS_CODES = [500, 502, 503, 504];
1699
+ var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "ECONNREFUSED", "EPIPE", "ETIMEDOUT"];
1700
+ var NODEJS_NETWORK_ERROR_CODES = ["EHOSTUNREACH", "ENETUNREACH", "ENOTFOUND", "EAI_AGAIN"];
1701
+
1702
+ // ../../node_modules/@smithy/core/dist-es/submodules/retry/service-error-classification/service-error-classification.js
1703
+ var isRetryableByTrait = (error) => error?.$retryable !== void 0;
1704
+ var isClockSkewCorrectedError = (error) => error.$metadata?.clockSkewCorrected;
1705
+ var isBrowserNetworkError = (error) => {
1706
+ const errorMessages = /* @__PURE__ */ new Set([
1707
+ "Failed to fetch",
1708
+ "NetworkError when attempting to fetch resource",
1709
+ "The Internet connection appears to be offline",
1710
+ "Load failed",
1711
+ "Network request failed"
1712
+ ]);
1713
+ const isValid = error && error instanceof TypeError;
1714
+ if (!isValid) {
1715
+ return false;
1716
+ }
1717
+ return errorMessages.has(error.message);
1718
+ };
1719
+ var isThrottlingError = (error) => error.$metadata?.httpStatusCode === 429 || THROTTLING_ERROR_CODES.includes(error.name) || error.$retryable?.throttling == true;
1720
+ var isTransientError = (error, depth = 0) => isRetryableByTrait(error) || isClockSkewCorrectedError(error) || error.name === "InvalidSignatureException" && error.message?.includes("Signature expired") || TRANSIENT_ERROR_CODES.includes(error.name) || NODEJS_TIMEOUT_ERROR_CODES.includes(error?.code || "") || NODEJS_NETWORK_ERROR_CODES.includes(error?.code || "") || TRANSIENT_ERROR_STATUS_CODES.includes(error.$metadata?.httpStatusCode || 0) || isBrowserNetworkError(error) || isNodeJsHttp2TransientError(error) || error.cause !== void 0 && depth <= 10 && isTransientError(error.cause, depth + 1);
1721
+ var isServerError = (error) => {
1722
+ if (error.$metadata?.httpStatusCode !== void 0) {
1723
+ const statusCode = error.$metadata.httpStatusCode;
1724
+ if (500 <= statusCode && statusCode <= 599 && !isTransientError(error)) {
1725
+ return true;
1726
+ }
1727
+ return false;
1728
+ }
1729
+ return false;
1730
+ };
1731
+ function isNodeJsHttp2TransientError(error) {
1732
+ return error.code === "ERR_HTTP2_STREAM_ERROR" && error.message.includes("NGHTTP2_REFUSED_STREAM");
1733
+ }
1734
+
1735
+ // ../../node_modules/@smithy/core/dist-es/submodules/retry/util-retry/DefaultRateLimiter.js
1736
+ var DefaultRateLimiter = class _DefaultRateLimiter {
1737
+ static setTimeoutFn = setTimeout;
1738
+ beta;
1739
+ minCapacity;
1740
+ minFillRate;
1741
+ scaleConstant;
1742
+ smooth;
1743
+ enabled = false;
1744
+ availableTokens = 0;
1745
+ lastMaxRate = 0;
1746
+ measuredTxRate = 0;
1747
+ requestCount = 0;
1748
+ fillRate;
1749
+ lastThrottleTime;
1750
+ lastTimestamp = 0;
1751
+ lastTxRateBucket;
1752
+ maxCapacity;
1753
+ timeWindow = 0;
1754
+ constructor(options) {
1755
+ this.beta = options?.beta ?? 0.7;
1756
+ this.minCapacity = options?.minCapacity ?? 1;
1757
+ this.minFillRate = options?.minFillRate ?? 0.5;
1758
+ this.scaleConstant = options?.scaleConstant ?? 0.4;
1759
+ this.smooth = options?.smooth ?? 0.8;
1760
+ this.lastThrottleTime = this.getCurrentTimeInSeconds();
1761
+ this.lastTxRateBucket = Math.floor(this.getCurrentTimeInSeconds());
1762
+ this.fillRate = this.minFillRate;
1763
+ this.maxCapacity = this.minCapacity;
1764
+ }
1765
+ async getSendToken() {
1766
+ return this.acquireTokenBucket(1);
1767
+ }
1768
+ updateClientSendingRate(response) {
1769
+ let calculatedRate;
1770
+ this.updateMeasuredRate();
1771
+ const retryErrorInfo = response;
1772
+ const isThrottling = retryErrorInfo?.errorType === "THROTTLING" || isThrottlingError(retryErrorInfo?.error ?? response);
1773
+ if (isThrottling) {
1774
+ const rateToUse = !this.enabled ? this.measuredTxRate : Math.min(this.measuredTxRate, this.fillRate);
1775
+ this.lastMaxRate = rateToUse;
1776
+ this.calculateTimeWindow();
1777
+ this.lastThrottleTime = this.getCurrentTimeInSeconds();
1778
+ calculatedRate = this.cubicThrottle(rateToUse);
1779
+ this.enableTokenBucket();
1780
+ } else {
1781
+ this.calculateTimeWindow();
1782
+ calculatedRate = this.cubicSuccess(this.getCurrentTimeInSeconds());
1783
+ }
1784
+ const newRate = Math.min(calculatedRate, 2 * this.measuredTxRate);
1785
+ this.updateTokenBucketRate(newRate);
1786
+ }
1787
+ getCurrentTimeInSeconds() {
1788
+ return Date.now() / 1e3;
1789
+ }
1790
+ async acquireTokenBucket(amount) {
1791
+ if (!this.enabled) {
1792
+ return;
1793
+ }
1794
+ this.refillTokenBucket();
1795
+ while (amount > this.availableTokens) {
1796
+ const delay = (amount - this.availableTokens) / this.fillRate * 1e3;
1797
+ await new Promise((resolve) => _DefaultRateLimiter.setTimeoutFn(resolve, delay));
1798
+ this.refillTokenBucket();
1799
+ }
1800
+ this.availableTokens = this.availableTokens - amount;
1801
+ }
1802
+ refillTokenBucket() {
1803
+ const timestamp = this.getCurrentTimeInSeconds();
1804
+ if (!this.lastTimestamp) {
1805
+ this.lastTimestamp = timestamp;
1806
+ return;
1807
+ }
1808
+ const fillAmount = (timestamp - this.lastTimestamp) * this.fillRate;
1809
+ this.availableTokens = Math.min(this.maxCapacity, this.availableTokens + fillAmount);
1810
+ this.lastTimestamp = timestamp;
1811
+ }
1812
+ calculateTimeWindow() {
1813
+ this.timeWindow = this.getPrecise(Math.pow(this.lastMaxRate * (1 - this.beta) / this.scaleConstant, 1 / 3));
1814
+ }
1815
+ cubicThrottle(rateToUse) {
1816
+ return this.getPrecise(rateToUse * this.beta);
1817
+ }
1818
+ cubicSuccess(timestamp) {
1819
+ return this.getPrecise(this.scaleConstant * Math.pow(timestamp - this.lastThrottleTime - this.timeWindow, 3) + this.lastMaxRate);
1820
+ }
1821
+ enableTokenBucket() {
1822
+ this.enabled = true;
1823
+ }
1824
+ updateTokenBucketRate(newRate) {
1825
+ this.refillTokenBucket();
1826
+ this.fillRate = Math.max(newRate, this.minFillRate);
1827
+ this.maxCapacity = Math.max(newRate, this.minCapacity);
1828
+ this.availableTokens = Math.min(this.availableTokens, this.maxCapacity);
1829
+ }
1830
+ updateMeasuredRate() {
1831
+ const t = this.getCurrentTimeInSeconds();
1832
+ const timeBucket = Math.floor(t * 2) / 2;
1833
+ this.requestCount++;
1834
+ if (timeBucket > this.lastTxRateBucket) {
1835
+ const currentRate = this.requestCount / (timeBucket - this.lastTxRateBucket);
1836
+ this.measuredTxRate = this.getPrecise(currentRate * this.smooth + this.measuredTxRate * (1 - this.smooth));
1837
+ this.requestCount = 0;
1838
+ this.lastTxRateBucket = timeBucket;
1839
+ }
1840
+ }
1841
+ getPrecise(num) {
1842
+ return parseFloat(num.toFixed(8));
1843
+ }
1844
+ };
1845
+
1846
+ // ../../node_modules/@smithy/core/dist-es/submodules/retry/util-retry/constants.js
1847
+ var MAXIMUM_RETRY_DELAY = 20 * 1e3;
1848
+ var INITIAL_RETRY_TOKENS = 500;
1849
+ var NO_RETRY_INCREMENT = 1;
1850
+ var INVOCATION_ID_HEADER = "amz-sdk-invocation-id";
1851
+ var REQUEST_HEADER = "amz-sdk-request";
1852
+
1853
+ // ../../node_modules/@smithy/core/dist-es/submodules/retry/util-retry/retries-2026-config.js
1854
+ var Retry = class _Retry {
1855
+ static v2026 = typeof process !== "undefined" && process.env?.SMITHY_NEW_RETRIES_2026 === "true";
1856
+ static delay() {
1857
+ return _Retry.v2026 ? 50 : 100;
1858
+ }
1859
+ static throttlingDelay() {
1860
+ return _Retry.v2026 ? 1e3 : 500;
1861
+ }
1862
+ static cost() {
1863
+ return _Retry.v2026 ? 14 : 5;
1864
+ }
1865
+ static throttlingCost() {
1866
+ return _Retry.v2026 ? 5 : 10;
1867
+ }
1868
+ static modifiedCostType() {
1869
+ return _Retry.v2026 ? "THROTTLING" : "TRANSIENT";
1870
+ }
1871
+ };
1872
+
1873
+ // ../../node_modules/@smithy/core/dist-es/submodules/retry/util-retry/DefaultRetryBackoffStrategy.js
1874
+ var DefaultRetryBackoffStrategy = class {
1875
+ x = Retry.delay();
1876
+ computeNextBackoffDelay(i) {
1877
+ const b = Math.random();
1878
+ const r = 2;
1879
+ const t_i = b * Math.min(this.x * r ** i, MAXIMUM_RETRY_DELAY);
1880
+ return Math.floor(t_i);
1881
+ }
1882
+ setDelayBase(delay) {
1883
+ this.x = delay;
1884
+ }
1885
+ };
1886
+
1887
+ // ../../node_modules/@smithy/core/dist-es/submodules/retry/util-retry/DefaultRetryToken.js
1888
+ var DefaultRetryToken = class {
1889
+ delay;
1890
+ count;
1891
+ cost;
1892
+ longPoll;
1893
+ $retryLog = {
1894
+ acquisitionDelay: 0
1895
+ };
1896
+ constructor(delay, count, cost, longPoll) {
1897
+ this.delay = delay;
1898
+ this.count = count;
1899
+ this.cost = cost;
1900
+ this.longPoll = longPoll;
1901
+ }
1902
+ getRetryCount() {
1903
+ return this.count;
1904
+ }
1905
+ getRetryDelay() {
1906
+ return Math.min(MAXIMUM_RETRY_DELAY, this.delay);
1907
+ }
1908
+ getRetryCost() {
1909
+ return this.cost;
1910
+ }
1911
+ isLongPoll() {
1912
+ return this.longPoll;
1913
+ }
1914
+ };
1915
+
1916
+ // ../../node_modules/@smithy/core/dist-es/submodules/retry/util-retry/config.js
1917
+ var RETRY_MODES;
1918
+ (function(RETRY_MODES2) {
1919
+ RETRY_MODES2["STANDARD"] = "standard";
1920
+ RETRY_MODES2["ADAPTIVE"] = "adaptive";
1921
+ })(RETRY_MODES || (RETRY_MODES = {}));
1922
+ var DEFAULT_MAX_ATTEMPTS = 3;
1923
+ var DEFAULT_RETRY_MODE = RETRY_MODES.STANDARD;
1924
+
1925
+ // ../../node_modules/@smithy/core/dist-es/submodules/retry/util-retry/StandardRetryStrategy.js
1926
+ var refusal = {
1927
+ incompatible: 1,
1928
+ attempts: 2,
1929
+ capacity: 3
1930
+ };
1931
+ var StandardRetryStrategy = class {
1932
+ mode = RETRY_MODES.STANDARD;
1933
+ retryBackoffStrategy;
1934
+ capacity = INITIAL_RETRY_TOKENS;
1935
+ maxAttemptsProvider;
1936
+ baseDelay;
1937
+ constructor(arg1) {
1938
+ if (typeof arg1 === "number") {
1939
+ this.maxAttemptsProvider = async () => arg1;
1940
+ } else if (typeof arg1 === "function") {
1941
+ this.maxAttemptsProvider = arg1;
1942
+ } else if (arg1 && typeof arg1 === "object") {
1943
+ this.maxAttemptsProvider = async () => arg1.maxAttempts;
1944
+ this.baseDelay = arg1.baseDelay;
1945
+ this.retryBackoffStrategy = arg1.backoff;
1946
+ }
1947
+ this.maxAttemptsProvider ??= async () => DEFAULT_MAX_ATTEMPTS;
1948
+ this.baseDelay ??= Retry.delay();
1949
+ this.retryBackoffStrategy ??= new DefaultRetryBackoffStrategy();
1950
+ }
1951
+ async acquireInitialRetryToken(retryTokenScope) {
1952
+ return new DefaultRetryToken(Retry.delay(), 0, void 0, Retry.v2026 && retryTokenScope.includes(":longpoll"));
1953
+ }
1954
+ async refreshRetryTokenForRetry(token, errorInfo) {
1955
+ const maxAttempts = await this.getMaxAttempts();
1956
+ const retryCode = this.retryCode(token, errorInfo, maxAttempts);
1957
+ const shouldRetry = retryCode === 0;
1958
+ const isLongPoll = token.isLongPoll?.();
1959
+ if (shouldRetry || isLongPoll) {
1960
+ const errorType = errorInfo.errorType;
1961
+ this.retryBackoffStrategy.setDelayBase(errorType === "THROTTLING" ? Retry.throttlingDelay() : this.baseDelay);
1962
+ const delayFromErrorType = this.retryBackoffStrategy.computeNextBackoffDelay(token.getRetryCount());
1963
+ let retryDelay = delayFromErrorType;
1964
+ if (errorInfo.retryAfterHint instanceof Date) {
1965
+ retryDelay = Math.max(delayFromErrorType, Math.min(errorInfo.retryAfterHint.getTime() - Date.now(), delayFromErrorType + 5e3));
1966
+ }
1967
+ if (!shouldRetry) {
1968
+ const longPollBackoff = Retry.v2026 && retryCode === refusal.capacity && isLongPoll ? retryDelay : 0;
1969
+ if (longPollBackoff > 0) {
1970
+ await new Promise((r) => setTimeout(r, longPollBackoff));
1971
+ }
1972
+ } else {
1973
+ const capacityCost = this.getCapacityCost(errorType);
1974
+ this.capacity -= capacityCost;
1975
+ const nextToken = new DefaultRetryToken(0, token.getRetryCount() + 1, capacityCost, token.isLongPoll?.() ?? false);
1976
+ await new Promise((r) => setTimeout(r, retryDelay));
1977
+ nextToken.$retryLog.acquisitionDelay = retryDelay;
1978
+ return nextToken;
1979
+ }
1980
+ }
1981
+ throw new Error("No retry token available");
1982
+ }
1983
+ recordSuccess(token) {
1984
+ this.capacity = Math.min(INITIAL_RETRY_TOKENS, this.capacity + (token.getRetryCost() ?? NO_RETRY_INCREMENT));
1985
+ }
1986
+ getCapacity() {
1987
+ return this.capacity;
1988
+ }
1989
+ async maxAttempts() {
1990
+ return this.maxAttemptsProvider();
1991
+ }
1992
+ async getMaxAttempts() {
1993
+ try {
1994
+ return await this.maxAttemptsProvider();
1995
+ } catch (error) {
1996
+ console.warn(`Max attempts provider could not resolve. Using default of ${DEFAULT_MAX_ATTEMPTS}`);
1997
+ return DEFAULT_MAX_ATTEMPTS;
1998
+ }
1999
+ }
2000
+ retryCode(tokenToRenew, errorInfo, maxAttempts) {
2001
+ const attempts = tokenToRenew.getRetryCount() + 1;
2002
+ const retryableStatus = this.isRetryableError(errorInfo.errorType) ? 0 : refusal.incompatible;
2003
+ const attemptStatus = attempts < maxAttempts ? 0 : refusal.attempts;
2004
+ const capacityStatus = this.capacity >= this.getCapacityCost(errorInfo.errorType) ? 0 : refusal.capacity;
2005
+ return retryableStatus || attemptStatus || capacityStatus;
2006
+ }
2007
+ getCapacityCost(errorType) {
2008
+ return errorType === Retry.modifiedCostType() ? Retry.throttlingCost() : Retry.cost();
2009
+ }
2010
+ isRetryableError(errorType) {
2011
+ return errorType === "THROTTLING" || errorType === "TRANSIENT";
2012
+ }
2013
+ };
2014
+
2015
+ // ../../node_modules/@smithy/core/dist-es/submodules/retry/util-retry/AdaptiveRetryStrategy.js
2016
+ var AdaptiveRetryStrategy = class {
2017
+ mode = RETRY_MODES.ADAPTIVE;
2018
+ rateLimiter;
2019
+ standardRetryStrategy;
2020
+ constructor(maxAttemptsProvider, options) {
2021
+ const { rateLimiter } = options ?? {};
2022
+ this.rateLimiter = rateLimiter ?? new DefaultRateLimiter();
2023
+ this.standardRetryStrategy = options ? new StandardRetryStrategy({
2024
+ maxAttempts: typeof maxAttemptsProvider === "number" ? maxAttemptsProvider : 3,
2025
+ ...options
2026
+ }) : new StandardRetryStrategy(maxAttemptsProvider);
2027
+ }
2028
+ async acquireInitialRetryToken(retryTokenScope) {
2029
+ const token = await this.standardRetryStrategy.acquireInitialRetryToken(retryTokenScope);
2030
+ await this.rateLimiter.getSendToken();
2031
+ return token;
2032
+ }
2033
+ async refreshRetryTokenForRetry(tokenToRenew, errorInfo) {
2034
+ this.rateLimiter.updateClientSendingRate(errorInfo);
2035
+ const token = await this.standardRetryStrategy.refreshRetryTokenForRetry(tokenToRenew, errorInfo);
2036
+ await this.rateLimiter.getSendToken();
2037
+ return token;
2038
+ }
2039
+ recordSuccess(token) {
2040
+ this.rateLimiter.updateClientSendingRate({});
2041
+ this.standardRetryStrategy.recordSuccess(token);
2042
+ }
2043
+ async maxAttemptsProvider() {
2044
+ return this.standardRetryStrategy.maxAttempts();
2045
+ }
2046
+ };
2047
+
2048
+ // ../../node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/configurations.js
2049
+ var ENV_MAX_ATTEMPTS = "AWS_MAX_ATTEMPTS";
2050
+ var CONFIG_MAX_ATTEMPTS = "max_attempts";
2051
+ var NODE_MAX_ATTEMPT_CONFIG_OPTIONS = {
2052
+ environmentVariableSelector: (env2) => {
2053
+ const value = env2[ENV_MAX_ATTEMPTS];
2054
+ if (!value)
2055
+ return void 0;
2056
+ const maxAttempt = parseInt(value);
2057
+ if (Number.isNaN(maxAttempt)) {
2058
+ throw new Error(`Environment variable ${ENV_MAX_ATTEMPTS} mast be a number, got "${value}"`);
2059
+ }
2060
+ return maxAttempt;
2061
+ },
2062
+ configFileSelector: (profile) => {
2063
+ const value = profile[CONFIG_MAX_ATTEMPTS];
2064
+ if (!value)
2065
+ return void 0;
2066
+ const maxAttempt = parseInt(value);
2067
+ if (Number.isNaN(maxAttempt)) {
2068
+ throw new Error(`Shared config file entry ${CONFIG_MAX_ATTEMPTS} mast be a number, got "${value}"`);
2069
+ }
2070
+ return maxAttempt;
2071
+ },
2072
+ default: DEFAULT_MAX_ATTEMPTS
2073
+ };
2074
+ var resolveRetryConfig = (input, defaults) => {
2075
+ const { retryStrategy, retryMode } = input;
2076
+ const { defaultMaxAttempts = DEFAULT_MAX_ATTEMPTS, defaultBaseDelay = Retry.delay() } = defaults ?? {};
2077
+ const maxAttemptsProvider = normalizeProvider(input.maxAttempts ?? defaultMaxAttempts);
2078
+ let controller = retryStrategy ? Promise.resolve(retryStrategy) : void 0;
2079
+ const getDefault = async () => {
2080
+ const maxAttempts = await maxAttemptsProvider();
2081
+ const adaptive = await normalizeProvider(retryMode)() === RETRY_MODES.ADAPTIVE;
2082
+ if (adaptive) {
2083
+ return new AdaptiveRetryStrategy(maxAttemptsProvider, {
2084
+ maxAttempts,
2085
+ baseDelay: defaultBaseDelay
2086
+ });
2087
+ }
2088
+ return new StandardRetryStrategy({
2089
+ maxAttempts,
2090
+ baseDelay: defaultBaseDelay
2091
+ });
2092
+ };
2093
+ return Object.assign(input, {
2094
+ maxAttempts: maxAttemptsProvider,
2095
+ retryStrategy: () => controller ??= getDefault()
2096
+ });
2097
+ };
2098
+ var ENV_RETRY_MODE = "AWS_RETRY_MODE";
2099
+ var CONFIG_RETRY_MODE = "retry_mode";
2100
+ var NODE_RETRY_MODE_CONFIG_OPTIONS = {
2101
+ environmentVariableSelector: (env2) => env2[ENV_RETRY_MODE],
2102
+ configFileSelector: (profile) => profile[CONFIG_RETRY_MODE],
2103
+ default: DEFAULT_RETRY_MODE
2104
+ };
2105
+
2106
+ // ../../node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/isStreamingPayload/isStreamingPayload.js
2107
+ import { Readable } from "stream";
2108
+ var isStreamingPayload = (request) => request?.body instanceof Readable || typeof ReadableStream !== "undefined" && request?.body instanceof ReadableStream;
2109
+
2110
+ // ../../node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/parseRetryAfterHeader.js
2111
+ function parseRetryAfterHeader(response, logger) {
2112
+ if (!HttpResponse.isInstance(response)) {
2113
+ return;
2114
+ }
2115
+ for (const header of Object.keys(response.headers)) {
2116
+ const h = header.toLowerCase();
2117
+ if (h === "retry-after") {
2118
+ const retryAfter = response.headers[header];
2119
+ let retryAfterSeconds = NaN;
2120
+ if (retryAfter.endsWith("GMT")) {
2121
+ try {
2122
+ const date = parseRfc7231DateTime(retryAfter);
2123
+ retryAfterSeconds = (date.getTime() - Date.now()) / 1e3;
2124
+ } catch (e) {
2125
+ logger?.trace?.("Failed to parse retry-after header");
2126
+ logger?.trace?.(e);
2127
+ }
2128
+ } else if (retryAfter.match(/ GMT, ((\d+)|(\d+\.\d+))$/)) {
2129
+ retryAfterSeconds = Number(retryAfter.match(/ GMT, ([\d.]+)$/)?.[1]);
2130
+ } else if (retryAfter.match(/^((\d+)|(\d+\.\d+))$/)) {
2131
+ retryAfterSeconds = Number(retryAfter);
2132
+ } else if (Date.parse(retryAfter) >= Date.now()) {
2133
+ retryAfterSeconds = (Date.parse(retryAfter) - Date.now()) / 1e3;
2134
+ }
2135
+ if (isNaN(retryAfterSeconds)) {
2136
+ return;
2137
+ }
2138
+ return new Date(Date.now() + retryAfterSeconds * 1e3);
2139
+ } else if (h === "x-amz-retry-after") {
2140
+ const v = response.headers[header];
2141
+ const backoffMilliseconds = Number(v);
2142
+ if (isNaN(backoffMilliseconds)) {
2143
+ logger?.trace?.(`Failed to parse x-amz-retry-after=${v}`);
2144
+ return;
2145
+ }
2146
+ return new Date(Date.now() + backoffMilliseconds);
2147
+ }
2148
+ }
2149
+ }
2150
+
2151
+ // ../../node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/util.js
2152
+ var asSdkError = (error) => {
2153
+ if (error instanceof Error)
2154
+ return error;
2155
+ if (error instanceof Object)
2156
+ return Object.assign(new Error(), error);
2157
+ if (typeof error === "string")
2158
+ return new Error(error);
2159
+ return new Error(`AWS SDK error wrapper for ${error}`);
2160
+ };
2161
+
2162
+ // ../../node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/retryMiddleware.js
2163
+ function bindRetryMiddleware(isStreamingPayload2) {
2164
+ return (options) => (next, context) => async (args) => {
2165
+ let retryStrategy = await options.retryStrategy();
2166
+ const maxAttempts = await options.maxAttempts();
2167
+ if (isRetryStrategyV2(retryStrategy)) {
2168
+ retryStrategy = retryStrategy;
2169
+ let retryToken = await retryStrategy.acquireInitialRetryToken((context["partition_id"] ?? "") + (context.__retryLongPoll ? ":longpoll" : ""));
2170
+ let lastError = new Error();
2171
+ let attempts = 0;
2172
+ let totalRetryDelay = 0;
2173
+ const { request } = args;
2174
+ const isRequest = HttpRequest.isInstance(request);
2175
+ if (isRequest) {
2176
+ request.headers[INVOCATION_ID_HEADER] = v4();
2177
+ }
2178
+ while (true) {
2179
+ try {
2180
+ if (isRequest) {
2181
+ request.headers[REQUEST_HEADER] = `attempt=${attempts + 1}; max=${maxAttempts}`;
2182
+ }
2183
+ const { response, output } = await next(args);
2184
+ retryStrategy.recordSuccess(retryToken);
2185
+ output.$metadata.attempts = attempts + 1;
2186
+ output.$metadata.totalRetryDelay = totalRetryDelay;
2187
+ return { response, output };
2188
+ } catch (e) {
2189
+ const retryErrorInfo = getRetryErrorInfo(e, options.logger);
2190
+ lastError = asSdkError(e);
2191
+ if (isRequest && isStreamingPayload2(request)) {
2192
+ (context.logger instanceof NoOpLogger ? console : context.logger)?.warn("An error was encountered in a non-retryable streaming request.");
2193
+ throw lastError;
2194
+ }
2195
+ try {
2196
+ retryToken = await retryStrategy.refreshRetryTokenForRetry(retryToken, retryErrorInfo);
2197
+ } catch (refreshError) {
2198
+ if (!lastError.$metadata) {
2199
+ lastError.$metadata = {};
2200
+ }
2201
+ lastError.$metadata.attempts = attempts + 1;
2202
+ lastError.$metadata.totalRetryDelay = totalRetryDelay;
2203
+ throw lastError;
2204
+ }
2205
+ attempts = retryToken.getRetryCount();
2206
+ const delay = retryToken.getRetryDelay();
2207
+ totalRetryDelay += (retryToken?.$retryLog?.acquisitionDelay ?? 0) + delay;
2208
+ if (delay > 0) {
2209
+ await cooldown(delay);
2210
+ }
2211
+ }
2212
+ }
2213
+ } else {
2214
+ retryStrategy = retryStrategy;
2215
+ if (retryStrategy?.mode) {
2216
+ context.userAgent = [...context.userAgent || [], ["cfg/retry-mode", retryStrategy.mode]];
2217
+ }
2218
+ return retryStrategy.retry(next, args);
2219
+ }
2220
+ };
2221
+ }
2222
+ var cooldown = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
2223
+ var isRetryStrategyV2 = (retryStrategy) => typeof retryStrategy.acquireInitialRetryToken !== "undefined" && typeof retryStrategy.refreshRetryTokenForRetry !== "undefined" && typeof retryStrategy.recordSuccess !== "undefined";
2224
+ var getRetryErrorInfo = (error, logger) => {
2225
+ const errorInfo = {
2226
+ error,
2227
+ errorType: getRetryErrorType(error)
2228
+ };
2229
+ const retryAfterHint = parseRetryAfterHeader(error.$response, logger);
2230
+ if (retryAfterHint) {
2231
+ errorInfo.retryAfterHint = retryAfterHint;
2232
+ }
2233
+ return errorInfo;
2234
+ };
2235
+ var getRetryErrorType = (error) => {
2236
+ if (isThrottlingError(error))
2237
+ return "THROTTLING";
2238
+ if (isTransientError(error))
2239
+ return "TRANSIENT";
2240
+ if (isServerError(error))
2241
+ return "SERVER_ERROR";
2242
+ return "CLIENT_ERROR";
2243
+ };
2244
+ var retryMiddlewareOptions = {
2245
+ name: "retryMiddleware",
2246
+ tags: ["RETRY"],
2247
+ step: "finalizeRequest",
2248
+ priority: "high",
2249
+ override: true
2250
+ };
2251
+ function bindGetRetryPlugin(isStreamingPayload2) {
2252
+ const retryMiddleware2 = bindRetryMiddleware(isStreamingPayload2);
2253
+ return (options) => ({
2254
+ applyToStack: (clientStack) => {
2255
+ clientStack.add(retryMiddleware2(options), retryMiddlewareOptions);
2256
+ }
2257
+ });
2258
+ }
2259
+
2260
+ // ../../node_modules/@smithy/core/dist-es/submodules/retry/index.js
2261
+ var retryMiddleware = bindRetryMiddleware(isStreamingPayload);
2262
+ var getRetryPlugin = bindGetRetryPlugin(isStreamingPayload);
2263
+
2264
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/middleware-host-header/hostHeaderMiddleware.js
2265
+ function resolveHostHeaderConfig(input) {
2266
+ return input;
2267
+ }
2268
+ var hostHeaderMiddleware = (options) => (next) => async (args) => {
2269
+ if (!HttpRequest.isInstance(args.request))
2270
+ return next(args);
2271
+ const { request } = args;
2272
+ const { handlerProtocol = "" } = options.requestHandler.metadata || {};
2273
+ if (handlerProtocol.indexOf("h2") >= 0 && !request.headers[":authority"]) {
2274
+ delete request.headers["host"];
2275
+ request.headers[":authority"] = request.hostname + (request.port ? ":" + request.port : "");
2276
+ } else if (!request.headers["host"]) {
2277
+ let host = request.hostname;
2278
+ if (request.port != null)
2279
+ host += `:${request.port}`;
2280
+ request.headers["host"] = host;
2281
+ }
2282
+ return next(args);
2283
+ };
2284
+ var hostHeaderMiddlewareOptions = {
2285
+ name: "hostHeaderMiddleware",
2286
+ step: "build",
2287
+ priority: "low",
2288
+ tags: ["HOST"],
2289
+ override: true
2290
+ };
2291
+ var getHostHeaderPlugin = (options) => ({
2292
+ applyToStack: (clientStack) => {
2293
+ clientStack.add(hostHeaderMiddleware(options), hostHeaderMiddlewareOptions);
2294
+ }
2295
+ });
2296
+
2297
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/middleware-logger/loggerMiddleware.js
2298
+ var loggerMiddleware = () => (next, context) => async (args) => {
2299
+ try {
2300
+ const response = await next(args);
2301
+ const { clientName, commandName, logger, dynamoDbDocumentClientOptions = {} } = context;
2302
+ const { overrideInputFilterSensitiveLog, overrideOutputFilterSensitiveLog } = dynamoDbDocumentClientOptions;
2303
+ const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context.inputFilterSensitiveLog;
2304
+ const outputFilterSensitiveLog = overrideOutputFilterSensitiveLog ?? context.outputFilterSensitiveLog;
2305
+ const { $metadata, ...outputWithoutMetadata } = response.output;
2306
+ logger?.info?.({
2307
+ clientName,
2308
+ commandName,
2309
+ input: inputFilterSensitiveLog(args.input),
2310
+ output: outputFilterSensitiveLog(outputWithoutMetadata),
2311
+ metadata: $metadata
2312
+ });
2313
+ return response;
2314
+ } catch (error) {
2315
+ const { clientName, commandName, logger, dynamoDbDocumentClientOptions = {} } = context;
2316
+ const { overrideInputFilterSensitiveLog } = dynamoDbDocumentClientOptions;
2317
+ const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context.inputFilterSensitiveLog;
2318
+ logger?.error?.({
2319
+ clientName,
2320
+ commandName,
2321
+ input: inputFilterSensitiveLog(args.input),
2322
+ error,
2323
+ metadata: error.$metadata
2324
+ });
2325
+ throw error;
2326
+ }
2327
+ };
2328
+ var loggerMiddlewareOptions = {
2329
+ name: "loggerMiddleware",
2330
+ tags: ["LOGGER"],
2331
+ step: "initialize",
2332
+ override: true
2333
+ };
2334
+ var getLoggerPlugin = (options) => ({
2335
+ applyToStack: (clientStack) => {
2336
+ clientStack.add(loggerMiddleware(), loggerMiddlewareOptions);
2337
+ }
2338
+ });
2339
+
2340
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/middleware-recursion-detection/configuration.js
2341
+ var recursionDetectionMiddlewareOptions = {
2342
+ step: "build",
2343
+ tags: ["RECURSION_DETECTION"],
2344
+ name: "recursionDetectionMiddleware",
2345
+ override: true,
2346
+ priority: "low"
2347
+ };
2348
+
2349
+ // ../../node_modules/@aws/lambda-invoke-store/dist-es/invoke-store.js
2350
+ var PROTECTED_KEYS = {
2351
+ REQUEST_ID: /* @__PURE__ */ Symbol.for("_AWS_LAMBDA_REQUEST_ID"),
2352
+ X_RAY_TRACE_ID: /* @__PURE__ */ Symbol.for("_AWS_LAMBDA_X_RAY_TRACE_ID"),
2353
+ TENANT_ID: /* @__PURE__ */ Symbol.for("_AWS_LAMBDA_TENANT_ID")
2354
+ };
2355
+ var NO_GLOBAL_AWS_LAMBDA = ["true", "1"].includes(process.env?.AWS_LAMBDA_NODEJS_NO_GLOBAL_AWSLAMBDA ?? "");
2356
+ if (!NO_GLOBAL_AWS_LAMBDA) {
2357
+ globalThis.awslambda = globalThis.awslambda || {};
2358
+ }
2359
+ var InvokeStoreBase = class {
2360
+ static PROTECTED_KEYS = PROTECTED_KEYS;
2361
+ isProtectedKey(key) {
2362
+ return Object.values(PROTECTED_KEYS).includes(key);
2363
+ }
2364
+ getRequestId() {
2365
+ return this.get(PROTECTED_KEYS.REQUEST_ID) ?? "-";
2366
+ }
2367
+ getXRayTraceId() {
2368
+ return this.get(PROTECTED_KEYS.X_RAY_TRACE_ID);
2369
+ }
2370
+ getTenantId() {
2371
+ return this.get(PROTECTED_KEYS.TENANT_ID);
2372
+ }
2373
+ };
2374
+ var InvokeStoreSingle = class extends InvokeStoreBase {
2375
+ currentContext;
2376
+ getContext() {
2377
+ return this.currentContext;
2378
+ }
2379
+ hasContext() {
2380
+ return this.currentContext !== void 0;
2381
+ }
2382
+ get(key) {
2383
+ return this.currentContext?.[key];
2384
+ }
2385
+ set(key, value) {
2386
+ if (this.isProtectedKey(key)) {
2387
+ throw new Error(`Cannot modify protected Lambda context field: ${String(key)}`);
2388
+ }
2389
+ this.currentContext = this.currentContext || {};
2390
+ this.currentContext[key] = value;
2391
+ }
2392
+ run(context, fn) {
2393
+ this.currentContext = context;
2394
+ return fn();
2395
+ }
2396
+ };
2397
+ var InvokeStoreMulti = class _InvokeStoreMulti extends InvokeStoreBase {
2398
+ als;
2399
+ static async create() {
2400
+ const instance = new _InvokeStoreMulti();
2401
+ const asyncHooks = await import("async_hooks");
2402
+ instance.als = new asyncHooks.AsyncLocalStorage();
2403
+ return instance;
2404
+ }
2405
+ getContext() {
2406
+ return this.als.getStore();
2407
+ }
2408
+ hasContext() {
2409
+ return this.als.getStore() !== void 0;
2410
+ }
2411
+ get(key) {
2412
+ return this.als.getStore()?.[key];
2413
+ }
2414
+ set(key, value) {
2415
+ if (this.isProtectedKey(key)) {
2416
+ throw new Error(`Cannot modify protected Lambda context field: ${String(key)}`);
2417
+ }
2418
+ const store = this.als.getStore();
2419
+ if (!store) {
2420
+ throw new Error("No context available");
2421
+ }
2422
+ store[key] = value;
2423
+ }
2424
+ run(context, fn) {
2425
+ return this.als.run(context, fn);
2426
+ }
2427
+ };
2428
+ var InvokeStore;
2429
+ (function(InvokeStore2) {
2430
+ let instance = null;
2431
+ async function getInstanceAsync(forceInvokeStoreMulti) {
2432
+ if (!instance) {
2433
+ instance = (async () => {
2434
+ const isMulti = forceInvokeStoreMulti === true || "AWS_LAMBDA_MAX_CONCURRENCY" in process.env;
2435
+ const newInstance = isMulti ? await InvokeStoreMulti.create() : new InvokeStoreSingle();
2436
+ if (!NO_GLOBAL_AWS_LAMBDA && globalThis.awslambda?.InvokeStore) {
2437
+ return globalThis.awslambda.InvokeStore;
2438
+ } else if (!NO_GLOBAL_AWS_LAMBDA && globalThis.awslambda) {
2439
+ globalThis.awslambda.InvokeStore = newInstance;
2440
+ return newInstance;
2441
+ } else {
2442
+ return newInstance;
2443
+ }
2444
+ })();
2445
+ }
2446
+ return instance;
2447
+ }
2448
+ InvokeStore2.getInstanceAsync = getInstanceAsync;
2449
+ InvokeStore2._testing = process.env.AWS_LAMBDA_BENCHMARK_MODE === "1" ? {
2450
+ reset: () => {
2451
+ instance = null;
2452
+ if (globalThis.awslambda?.InvokeStore) {
2453
+ delete globalThis.awslambda.InvokeStore;
2454
+ }
2455
+ globalThis.awslambda = { InvokeStore: void 0 };
2456
+ }
2457
+ } : void 0;
2458
+ })(InvokeStore || (InvokeStore = {}));
2459
+
2460
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/middleware-recursion-detection/recursionDetectionMiddleware.js
2461
+ var TRACE_ID_HEADER_NAME = "X-Amzn-Trace-Id";
2462
+ var ENV_LAMBDA_FUNCTION_NAME = "AWS_LAMBDA_FUNCTION_NAME";
2463
+ var ENV_TRACE_ID = "_X_AMZN_TRACE_ID";
2464
+ var recursionDetectionMiddleware = () => (next) => async (args) => {
2465
+ const { request } = args;
2466
+ if (!HttpRequest.isInstance(request)) {
2467
+ return next(args);
2468
+ }
2469
+ const traceIdHeader = Object.keys(request.headers ?? {}).find((h) => h.toLowerCase() === TRACE_ID_HEADER_NAME.toLowerCase()) ?? TRACE_ID_HEADER_NAME;
2470
+ if (request.headers.hasOwnProperty(traceIdHeader)) {
2471
+ return next(args);
2472
+ }
2473
+ const functionName = process.env[ENV_LAMBDA_FUNCTION_NAME];
2474
+ const traceIdFromEnv = process.env[ENV_TRACE_ID];
2475
+ const invokeStore = await InvokeStore.getInstanceAsync();
2476
+ const traceIdFromInvokeStore = invokeStore?.getXRayTraceId();
2477
+ const traceId = traceIdFromInvokeStore ?? traceIdFromEnv;
2478
+ const nonEmptyString = (str) => typeof str === "string" && str.length > 0;
2479
+ if (nonEmptyString(functionName) && nonEmptyString(traceId)) {
2480
+ request.headers[TRACE_ID_HEADER_NAME] = traceId;
2481
+ }
2482
+ return next({
2483
+ ...args,
2484
+ request
2485
+ });
2486
+ };
2487
+
2488
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/middleware-recursion-detection/getRecursionDetectionPlugin.js
2489
+ var getRecursionDetectionPlugin = (options) => ({
2490
+ applyToStack: (clientStack) => {
2491
+ clientStack.add(recursionDetectionMiddleware(), recursionDetectionMiddlewareOptions);
2492
+ }
2493
+ });
2494
+
2495
+ // ../../node_modules/@smithy/core/dist-es/legacy-root-exports/middleware-http-auth-scheme/resolveAuthOptions.js
2496
+ var resolveAuthOptions = (candidateAuthOptions, authSchemePreference) => {
2497
+ if (!authSchemePreference || authSchemePreference.length === 0) {
2498
+ return candidateAuthOptions;
2499
+ }
2500
+ const preferredAuthOptions = [];
2501
+ for (const preferredSchemeName of authSchemePreference) {
2502
+ for (const candidateAuthOption of candidateAuthOptions) {
2503
+ const candidateAuthSchemeName = candidateAuthOption.schemeId.split("#")[1];
2504
+ if (candidateAuthSchemeName === preferredSchemeName) {
2505
+ preferredAuthOptions.push(candidateAuthOption);
2506
+ }
2507
+ }
2508
+ }
2509
+ for (const candidateAuthOption of candidateAuthOptions) {
2510
+ if (!preferredAuthOptions.find(({ schemeId }) => schemeId === candidateAuthOption.schemeId)) {
2511
+ preferredAuthOptions.push(candidateAuthOption);
2512
+ }
2513
+ }
2514
+ return preferredAuthOptions;
2515
+ };
2516
+
2517
+ // ../../node_modules/@smithy/core/dist-es/legacy-root-exports/middleware-http-auth-scheme/httpAuthSchemeMiddleware.js
2518
+ function convertHttpAuthSchemesToMap(httpAuthSchemes) {
2519
+ const map = /* @__PURE__ */ new Map();
2520
+ for (const scheme of httpAuthSchemes) {
2521
+ map.set(scheme.schemeId, scheme);
2522
+ }
2523
+ return map;
2524
+ }
2525
+ var httpAuthSchemeMiddleware = (config, mwOptions) => (next, context) => async (args) => {
2526
+ const options = config.httpAuthSchemeProvider(await mwOptions.httpAuthSchemeParametersProvider(config, context, args.input));
2527
+ const authSchemePreference = config.authSchemePreference ? await config.authSchemePreference() : [];
2528
+ const resolvedOptions = resolveAuthOptions(options, authSchemePreference);
2529
+ const authSchemes = convertHttpAuthSchemesToMap(config.httpAuthSchemes);
2530
+ const smithyContext = getSmithyContext(context);
2531
+ const failureReasons = [];
2532
+ for (const option of resolvedOptions) {
2533
+ const scheme = authSchemes.get(option.schemeId);
2534
+ if (!scheme) {
2535
+ failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` was not enabled for this service.`);
2536
+ continue;
2537
+ }
2538
+ const identityProvider = scheme.identityProvider(await mwOptions.identityProviderConfigProvider(config));
2539
+ if (!identityProvider) {
2540
+ failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` did not have an IdentityProvider configured.`);
2541
+ continue;
2542
+ }
2543
+ const { identityProperties = {}, signingProperties = {} } = option.propertiesExtractor?.(config, context) || {};
2544
+ option.identityProperties = Object.assign(option.identityProperties || {}, identityProperties);
2545
+ option.signingProperties = Object.assign(option.signingProperties || {}, signingProperties);
2546
+ smithyContext.selectedHttpAuthScheme = {
2547
+ httpAuthOption: option,
2548
+ identity: await identityProvider(option.identityProperties),
2549
+ signer: scheme.signer
2550
+ };
2551
+ break;
2552
+ }
2553
+ if (!smithyContext.selectedHttpAuthScheme) {
2554
+ throw new Error(failureReasons.join("\n"));
2555
+ }
2556
+ return next(args);
2557
+ };
2558
+
2559
+ // ../../node_modules/@smithy/core/dist-es/legacy-root-exports/middleware-http-auth-scheme/getHttpAuthSchemeEndpointRuleSetPlugin.js
2560
+ var httpAuthSchemeEndpointRuleSetMiddlewareOptions = {
2561
+ step: "serialize",
2562
+ tags: ["HTTP_AUTH_SCHEME"],
2563
+ name: "httpAuthSchemeMiddleware",
2564
+ override: true,
2565
+ relation: "before",
2566
+ toMiddleware: "endpointV2Middleware"
2567
+ };
2568
+ var getHttpAuthSchemeEndpointRuleSetPlugin = (config, { httpAuthSchemeParametersProvider, identityProviderConfigProvider }) => ({
2569
+ applyToStack: (clientStack) => {
2570
+ clientStack.addRelativeTo(httpAuthSchemeMiddleware(config, {
2571
+ httpAuthSchemeParametersProvider,
2572
+ identityProviderConfigProvider
2573
+ }), httpAuthSchemeEndpointRuleSetMiddlewareOptions);
2574
+ }
2575
+ });
2576
+
2577
+ // ../../node_modules/@smithy/core/dist-es/legacy-root-exports/middleware-http-signing/httpSigningMiddleware.js
2578
+ var defaultErrorHandler = (signingProperties) => (error) => {
2579
+ throw error;
2580
+ };
2581
+ var defaultSuccessHandler = (httpResponse, signingProperties) => {
2582
+ };
2583
+ var httpSigningMiddleware = (config) => (next, context) => async (args) => {
2584
+ if (!HttpRequest.isInstance(args.request)) {
2585
+ return next(args);
2586
+ }
2587
+ const smithyContext = getSmithyContext(context);
2588
+ const scheme = smithyContext.selectedHttpAuthScheme;
2589
+ if (!scheme) {
2590
+ throw new Error(`No HttpAuthScheme was selected: unable to sign request`);
2591
+ }
2592
+ const { httpAuthOption: { signingProperties = {} }, identity, signer } = scheme;
2593
+ const output = await next({
2594
+ ...args,
2595
+ request: await signer.sign(args.request, identity, signingProperties)
2596
+ }).catch((signer.errorHandler || defaultErrorHandler)(signingProperties));
2597
+ (signer.successHandler || defaultSuccessHandler)(output.response, signingProperties);
2598
+ return output;
2599
+ };
2600
+
2601
+ // ../../node_modules/@smithy/core/dist-es/legacy-root-exports/middleware-http-signing/getHttpSigningMiddleware.js
2602
+ var httpSigningMiddlewareOptions = {
2603
+ step: "finalizeRequest",
2604
+ tags: ["HTTP_SIGNING"],
2605
+ name: "httpSigningMiddleware",
2606
+ aliases: ["apiKeyMiddleware", "tokenMiddleware", "awsAuthMiddleware"],
2607
+ override: true,
2608
+ relation: "after",
2609
+ toMiddleware: "retryMiddleware"
2610
+ };
2611
+ var getHttpSigningPlugin = (config) => ({
2612
+ applyToStack: (clientStack) => {
2613
+ clientStack.addRelativeTo(httpSigningMiddleware(config), httpSigningMiddlewareOptions);
2614
+ }
2615
+ });
2616
+
2617
+ // ../../node_modules/@smithy/core/dist-es/legacy-root-exports/pagination/createPaginator.js
2618
+ var makePagedClientRequest = async (CommandCtor, client, input, withCommand = (_) => _, ...args) => {
2619
+ let command = new CommandCtor(input);
2620
+ command = withCommand(command) ?? command;
2621
+ return await client.send(command, ...args);
2622
+ };
2623
+ function createPaginator(ClientCtor, CommandCtor, inputTokenName, outputTokenName, pageSizeTokenName) {
2624
+ return async function* paginateOperation(config, input, ...additionalArguments) {
2625
+ const _input = input;
2626
+ let token = config.startingToken ?? _input[inputTokenName];
2627
+ let hasNext = true;
2628
+ let page;
2629
+ while (hasNext) {
2630
+ _input[inputTokenName] = token;
2631
+ if (pageSizeTokenName) {
2632
+ _input[pageSizeTokenName] = _input[pageSizeTokenName] ?? config.pageSize;
2633
+ }
2634
+ if (config.client instanceof ClientCtor) {
2635
+ page = await makePagedClientRequest(CommandCtor, config.client, input, config.withCommand, ...additionalArguments);
2636
+ } else {
2637
+ throw new Error(`Invalid client, expected instance of ${ClientCtor.name}`);
2638
+ }
2639
+ yield page;
2640
+ const prevToken = token;
2641
+ token = get(page, outputTokenName);
2642
+ hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
2643
+ }
2644
+ return void 0;
2645
+ };
2646
+ }
2647
+ var get = (fromObject, path) => {
2648
+ let cursor = fromObject;
2649
+ const pathComponents = path.split(".");
2650
+ for (const step of pathComponents) {
2651
+ if (!cursor || typeof cursor !== "object") {
2652
+ return void 0;
2653
+ }
2654
+ cursor = cursor[step];
2655
+ }
2656
+ return cursor;
2657
+ };
2658
+
2659
+ // ../../node_modules/@smithy/core/dist-es/legacy-root-exports/util-identity-and-auth/DefaultIdentityProviderConfig.js
2660
+ var DefaultIdentityProviderConfig = class {
2661
+ authSchemes = /* @__PURE__ */ new Map();
2662
+ constructor(config) {
2663
+ for (const key in config) {
2664
+ const value = config[key];
2665
+ if (value !== void 0) {
2666
+ this.authSchemes.set(key, value);
2667
+ }
2668
+ }
2669
+ }
2670
+ getIdentityProvider(schemeId) {
2671
+ return this.authSchemes.get(schemeId);
2672
+ }
2673
+ };
2674
+
2675
+ // ../../node_modules/@smithy/core/dist-es/normalizeProvider.js
2676
+ var normalizeProvider2 = (input) => {
2677
+ if (typeof input === "function")
2678
+ return input;
2679
+ const promisified = Promise.resolve(input);
2680
+ return () => promisified;
2681
+ };
2682
+
2683
+ // ../../node_modules/@smithy/core/dist-es/legacy-root-exports/util-identity-and-auth/httpAuthSchemes/noAuth.js
2684
+ var NoAuthSigner = class {
2685
+ async sign(httpRequest, identity, signingProperties) {
2686
+ return httpRequest;
2687
+ }
2688
+ };
2689
+
2690
+ // ../../node_modules/@smithy/core/dist-es/legacy-root-exports/util-identity-and-auth/memoizeIdentityProvider.js
2691
+ var createIsIdentityExpiredFunction = (expirationMs) => function isIdentityExpired2(identity) {
2692
+ return doesIdentityRequireRefresh(identity) && identity.expiration.getTime() - Date.now() < expirationMs;
2693
+ };
2694
+ var EXPIRATION_MS = 3e5;
2695
+ var isIdentityExpired = createIsIdentityExpiredFunction(EXPIRATION_MS);
2696
+ var doesIdentityRequireRefresh = (identity) => identity.expiration !== void 0;
2697
+ var memoizeIdentityProvider = (provider, isExpired, requiresRefresh) => {
2698
+ if (provider === void 0) {
2699
+ return void 0;
2700
+ }
2701
+ const normalizedProvider = typeof provider !== "function" ? async () => Promise.resolve(provider) : provider;
2702
+ let resolved;
2703
+ let pending;
2704
+ let hasResult;
2705
+ let isConstant = false;
2706
+ const coalesceProvider = async (options) => {
2707
+ if (!pending) {
2708
+ pending = normalizedProvider(options);
2709
+ }
2710
+ try {
2711
+ resolved = await pending;
2712
+ hasResult = true;
2713
+ isConstant = false;
2714
+ } finally {
2715
+ pending = void 0;
2716
+ }
2717
+ return resolved;
2718
+ };
2719
+ if (isExpired === void 0) {
2720
+ return async (options) => {
2721
+ if (!hasResult || options?.forceRefresh) {
2722
+ resolved = await coalesceProvider(options);
2723
+ }
2724
+ return resolved;
2725
+ };
2726
+ }
2727
+ return async (options) => {
2728
+ if (!hasResult || options?.forceRefresh) {
2729
+ resolved = await coalesceProvider(options);
2730
+ }
2731
+ if (isConstant) {
2732
+ return resolved;
2733
+ }
2734
+ if (!requiresRefresh(resolved)) {
2735
+ isConstant = true;
2736
+ return resolved;
2737
+ }
2738
+ if (isExpired(resolved)) {
2739
+ await coalesceProvider(options);
2740
+ return resolved;
2741
+ }
2742
+ return resolved;
2743
+ };
2744
+ };
2745
+
2746
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/middleware-user-agent/configurations.js
2747
+ var DEFAULT_UA_APP_ID = void 0;
2748
+ function isValidUserAgentAppId(appId) {
2749
+ if (appId === void 0) {
2750
+ return true;
2751
+ }
2752
+ return typeof appId === "string" && appId.length <= 50;
2753
+ }
2754
+ function resolveUserAgentConfig(input) {
2755
+ const normalizedAppIdProvider = normalizeProvider2(input.userAgentAppId ?? DEFAULT_UA_APP_ID);
2756
+ const { customUserAgent } = input;
2757
+ return Object.assign(input, {
2758
+ customUserAgent: typeof customUserAgent === "string" ? [[customUserAgent]] : customUserAgent,
2759
+ userAgentAppId: async () => {
2760
+ const appId = await normalizedAppIdProvider();
2761
+ if (!isValidUserAgentAppId(appId)) {
2762
+ const logger = input.logger?.constructor?.name === "NoOpLogger" || !input.logger ? console : input.logger;
2763
+ if (typeof appId !== "string") {
2764
+ logger?.warn("userAgentAppId must be a string or undefined.");
2765
+ } else if (appId.length > 50) {
2766
+ logger?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.");
2767
+ }
2768
+ }
2769
+ return appId;
2770
+ }
2771
+ });
2772
+ }
2773
+
2774
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/util-endpoints/lib/aws/partitions.js
2775
+ var partitionsInfo = { "partitions": [{ "id": "aws", "outputs": { "dnsSuffix": "amazonaws.com", "dualStackDnsSuffix": "api.aws", "implicitGlobalRegion": "us-east-1", "name": "aws", "supportsDualStack": true, "supportsFIPS": true }, "regionRegex": "^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$", "regions": { "af-south-1": { "description": "Africa (Cape Town)" }, "ap-east-1": { "description": "Asia Pacific (Hong Kong)" }, "ap-east-2": { "description": "Asia Pacific (Taipei)" }, "ap-northeast-1": { "description": "Asia Pacific (Tokyo)" }, "ap-northeast-2": { "description": "Asia Pacific (Seoul)" }, "ap-northeast-3": { "description": "Asia Pacific (Osaka)" }, "ap-south-1": { "description": "Asia Pacific (Mumbai)" }, "ap-south-2": { "description": "Asia Pacific (Hyderabad)" }, "ap-southeast-1": { "description": "Asia Pacific (Singapore)" }, "ap-southeast-2": { "description": "Asia Pacific (Sydney)" }, "ap-southeast-3": { "description": "Asia Pacific (Jakarta)" }, "ap-southeast-4": { "description": "Asia Pacific (Melbourne)" }, "ap-southeast-5": { "description": "Asia Pacific (Malaysia)" }, "ap-southeast-6": { "description": "Asia Pacific (New Zealand)" }, "ap-southeast-7": { "description": "Asia Pacific (Thailand)" }, "aws-global": { "description": "aws global region" }, "ca-central-1": { "description": "Canada (Central)" }, "ca-west-1": { "description": "Canada West (Calgary)" }, "eu-central-1": { "description": "Europe (Frankfurt)" }, "eu-central-2": { "description": "Europe (Zurich)" }, "eu-north-1": { "description": "Europe (Stockholm)" }, "eu-south-1": { "description": "Europe (Milan)" }, "eu-south-2": { "description": "Europe (Spain)" }, "eu-west-1": { "description": "Europe (Ireland)" }, "eu-west-2": { "description": "Europe (London)" }, "eu-west-3": { "description": "Europe (Paris)" }, "il-central-1": { "description": "Israel (Tel Aviv)" }, "me-central-1": { "description": "Middle East (UAE)" }, "me-south-1": { "description": "Middle East (Bahrain)" }, "mx-central-1": { "description": "Mexico (Central)" }, "sa-east-1": { "description": "South America (Sao Paulo)" }, "us-east-1": { "description": "US East (N. Virginia)" }, "us-east-2": { "description": "US East (Ohio)" }, "us-west-1": { "description": "US West (N. California)" }, "us-west-2": { "description": "US West (Oregon)" } } }, { "id": "aws-cn", "outputs": { "dnsSuffix": "amazonaws.com.cn", "dualStackDnsSuffix": "api.amazonwebservices.com.cn", "implicitGlobalRegion": "cn-northwest-1", "name": "aws-cn", "supportsDualStack": true, "supportsFIPS": true }, "regionRegex": "^cn\\-\\w+\\-\\d+$", "regions": { "aws-cn-global": { "description": "aws-cn global region" }, "cn-north-1": { "description": "China (Beijing)" }, "cn-northwest-1": { "description": "China (Ningxia)" } } }, { "id": "aws-eusc", "outputs": { "dnsSuffix": "amazonaws.eu", "dualStackDnsSuffix": "api.amazonwebservices.eu", "implicitGlobalRegion": "eusc-de-east-1", "name": "aws-eusc", "supportsDualStack": true, "supportsFIPS": true }, "regionRegex": "^eusc\\-(de)\\-\\w+\\-\\d+$", "regions": { "eusc-de-east-1": { "description": "AWS European Sovereign Cloud (Germany)" } } }, { "id": "aws-iso", "outputs": { "dnsSuffix": "c2s.ic.gov", "dualStackDnsSuffix": "api.aws.ic.gov", "implicitGlobalRegion": "us-iso-east-1", "name": "aws-iso", "supportsDualStack": true, "supportsFIPS": true }, "regionRegex": "^us\\-iso\\-\\w+\\-\\d+$", "regions": { "aws-iso-global": { "description": "aws-iso global region" }, "us-iso-east-1": { "description": "US ISO East" }, "us-iso-west-1": { "description": "US ISO WEST" } } }, { "id": "aws-iso-b", "outputs": { "dnsSuffix": "sc2s.sgov.gov", "dualStackDnsSuffix": "api.aws.scloud", "implicitGlobalRegion": "us-isob-east-1", "name": "aws-iso-b", "supportsDualStack": true, "supportsFIPS": true }, "regionRegex": "^us\\-isob\\-\\w+\\-\\d+$", "regions": { "aws-iso-b-global": { "description": "aws-iso-b global region" }, "us-isob-east-1": { "description": "US ISOB East (Ohio)" }, "us-isob-west-1": { "description": "US ISOB West" } } }, { "id": "aws-iso-e", "outputs": { "dnsSuffix": "cloud.adc-e.uk", "dualStackDnsSuffix": "api.cloud-aws.adc-e.uk", "implicitGlobalRegion": "eu-isoe-west-1", "name": "aws-iso-e", "supportsDualStack": true, "supportsFIPS": true }, "regionRegex": "^eu\\-isoe\\-\\w+\\-\\d+$", "regions": { "aws-iso-e-global": { "description": "aws-iso-e global region" }, "eu-isoe-west-1": { "description": "EU ISOE West" } } }, { "id": "aws-iso-f", "outputs": { "dnsSuffix": "csp.hci.ic.gov", "dualStackDnsSuffix": "api.aws.hci.ic.gov", "implicitGlobalRegion": "us-isof-south-1", "name": "aws-iso-f", "supportsDualStack": true, "supportsFIPS": true }, "regionRegex": "^us\\-isof\\-\\w+\\-\\d+$", "regions": { "aws-iso-f-global": { "description": "aws-iso-f global region" }, "us-isof-east-1": { "description": "US ISOF EAST" }, "us-isof-south-1": { "description": "US ISOF SOUTH" } } }, { "id": "aws-us-gov", "outputs": { "dnsSuffix": "amazonaws.com", "dualStackDnsSuffix": "api.aws", "implicitGlobalRegion": "us-gov-west-1", "name": "aws-us-gov", "supportsDualStack": true, "supportsFIPS": true }, "regionRegex": "^us\\-gov\\-\\w+\\-\\d+$", "regions": { "aws-us-gov-global": { "description": "aws-us-gov global region" }, "us-gov-east-1": { "description": "AWS GovCloud (US-East)" }, "us-gov-west-1": { "description": "AWS GovCloud (US-West)" } } }], "version": "1.1" };
2776
+
2777
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/util-endpoints/lib/aws/partition.js
2778
+ var selectedPartitionsInfo = partitionsInfo;
2779
+ var selectedUserAgentPrefix = "";
2780
+ var partition = (value) => {
2781
+ const { partitions } = selectedPartitionsInfo;
2782
+ for (const partition2 of partitions) {
2783
+ const { regions, outputs } = partition2;
2784
+ for (const [region, regionData] of Object.entries(regions)) {
2785
+ if (region === value) {
2786
+ return {
2787
+ ...outputs,
2788
+ ...regionData
2789
+ };
2790
+ }
2791
+ }
2792
+ }
2793
+ for (const partition2 of partitions) {
2794
+ const { regionRegex, outputs } = partition2;
2795
+ if (new RegExp(regionRegex).test(value)) {
2796
+ return {
2797
+ ...outputs
2798
+ };
2799
+ }
2800
+ }
2801
+ const DEFAULT_PARTITION = partitions.find((partition2) => partition2.id === "aws");
2802
+ if (!DEFAULT_PARTITION) {
2803
+ throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");
2804
+ }
2805
+ return {
2806
+ ...DEFAULT_PARTITION.outputs
2807
+ };
2808
+ };
2809
+ var getUserAgentPrefix = () => selectedUserAgentPrefix;
2810
+
2811
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/setFeature.js
2812
+ Retry.v2026 ||= typeof process === "object" && process.env?.AWS_NEW_RETRIES_2026 === "true";
2813
+ function setFeature2(context, feature, value) {
2814
+ if (!context.__aws_sdk_context) {
2815
+ context.__aws_sdk_context = {
2816
+ features: {}
2817
+ };
2818
+ } else if (!context.__aws_sdk_context.features) {
2819
+ context.__aws_sdk_context.features = {};
2820
+ }
2821
+ context.__aws_sdk_context.features[feature] = value;
2822
+ }
2823
+
2824
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/middleware-user-agent/check-features.js
2825
+ var ACCOUNT_ID_ENDPOINT_REGEX = /\d{12}\.ddb/;
2826
+ async function checkFeatures(context, config, args) {
2827
+ const request = args.request;
2828
+ if (request?.headers?.["smithy-protocol"] === "rpc-v2-cbor") {
2829
+ setFeature2(context, "PROTOCOL_RPC_V2_CBOR", "M");
2830
+ }
2831
+ if (typeof config.retryStrategy === "function") {
2832
+ const retryStrategy = await config.retryStrategy();
2833
+ if (typeof retryStrategy.mode === "string") {
2834
+ switch (retryStrategy.mode) {
2835
+ case RETRY_MODES.ADAPTIVE:
2836
+ setFeature2(context, "RETRY_MODE_ADAPTIVE", "F");
2837
+ break;
2838
+ case RETRY_MODES.STANDARD:
2839
+ setFeature2(context, "RETRY_MODE_STANDARD", "E");
2840
+ break;
2841
+ }
2842
+ }
2843
+ }
2844
+ if (typeof config.accountIdEndpointMode === "function") {
2845
+ const endpointV2 = context.endpointV2;
2846
+ if (String(endpointV2?.url?.hostname).match(ACCOUNT_ID_ENDPOINT_REGEX)) {
2847
+ setFeature2(context, "ACCOUNT_ID_ENDPOINT", "O");
2848
+ }
2849
+ switch (await config.accountIdEndpointMode?.()) {
2850
+ case "disabled":
2851
+ setFeature2(context, "ACCOUNT_ID_MODE_DISABLED", "Q");
2852
+ break;
2853
+ case "preferred":
2854
+ setFeature2(context, "ACCOUNT_ID_MODE_PREFERRED", "P");
2855
+ break;
2856
+ case "required":
2857
+ setFeature2(context, "ACCOUNT_ID_MODE_REQUIRED", "R");
2858
+ break;
2859
+ }
2860
+ }
2861
+ const identity = context.__smithy_context?.selectedHttpAuthScheme?.identity;
2862
+ if (identity?.$source) {
2863
+ const credentials = identity;
2864
+ if (credentials.accountId) {
2865
+ setFeature2(context, "RESOLVED_ACCOUNT_ID", "T");
2866
+ }
2867
+ for (const [key, value] of Object.entries(credentials.$source ?? {})) {
2868
+ setFeature2(context, key, value);
2869
+ }
2870
+ }
2871
+ }
2872
+
2873
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/middleware-user-agent/constants.js
2874
+ var USER_AGENT = "user-agent";
2875
+ var X_AMZ_USER_AGENT = "x-amz-user-agent";
2876
+ var SPACE = " ";
2877
+ var UA_NAME_SEPARATOR = "/";
2878
+ var UA_NAME_ESCAPE_REGEX = /[^!$%&'*+\-.^_`|~\w]/g;
2879
+ var UA_VALUE_ESCAPE_REGEX = /[^!$%&'*+\-.^_`|~\w#]/g;
2880
+ var UA_ESCAPE_CHAR = "-";
2881
+
2882
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/middleware-user-agent/encode-features.js
2883
+ var BYTE_LIMIT = 1024;
2884
+ function encodeFeatures(features) {
2885
+ let buffer = "";
2886
+ for (const key in features) {
2887
+ const val = features[key];
2888
+ if (buffer.length + val.length + 1 <= BYTE_LIMIT) {
2889
+ if (buffer.length) {
2890
+ buffer += "," + val;
2891
+ } else {
2892
+ buffer += val;
2893
+ }
2894
+ continue;
2895
+ }
2896
+ break;
2897
+ }
2898
+ return buffer;
2899
+ }
2900
+
2901
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/middleware-user-agent/user-agent-middleware.js
2902
+ var userAgentMiddleware = (options) => (next, context) => async (args) => {
2903
+ const { request } = args;
2904
+ if (!HttpRequest.isInstance(request)) {
2905
+ return next(args);
2906
+ }
2907
+ const { headers } = request;
2908
+ const userAgent = context?.userAgent?.map(escapeUserAgent) || [];
2909
+ const defaultUserAgent2 = (await options.defaultUserAgentProvider()).map(escapeUserAgent);
2910
+ await checkFeatures(context, options, args);
2911
+ const awsContext = context;
2912
+ defaultUserAgent2.push(`m/${encodeFeatures(Object.assign({}, context.__smithy_context?.features, awsContext.__aws_sdk_context?.features))}`);
2913
+ const customUserAgent = options?.customUserAgent?.map(escapeUserAgent) || [];
2914
+ const appId = await options.userAgentAppId();
2915
+ if (appId) {
2916
+ defaultUserAgent2.push(escapeUserAgent([`app`, `${appId}`]));
2917
+ }
2918
+ const prefix = getUserAgentPrefix();
2919
+ const sdkUserAgentValue = (prefix ? [prefix] : []).concat([...defaultUserAgent2, ...userAgent, ...customUserAgent]).join(SPACE);
2920
+ const normalUAValue = [
2921
+ ...defaultUserAgent2.filter((section) => section.startsWith("aws-sdk-")),
2922
+ ...customUserAgent
2923
+ ].join(SPACE);
2924
+ if (options.runtime !== "browser") {
2925
+ if (normalUAValue) {
2926
+ headers[X_AMZ_USER_AGENT] = headers[X_AMZ_USER_AGENT] ? `${headers[USER_AGENT]} ${normalUAValue}` : normalUAValue;
2927
+ }
2928
+ headers[USER_AGENT] = sdkUserAgentValue;
2929
+ } else {
2930
+ headers[X_AMZ_USER_AGENT] = sdkUserAgentValue;
2931
+ }
2932
+ return next({
2933
+ ...args,
2934
+ request
2935
+ });
2936
+ };
2937
+ var escapeUserAgent = (userAgentPair) => {
2938
+ const name = userAgentPair[0].split(UA_NAME_SEPARATOR).map((part) => part.replace(UA_NAME_ESCAPE_REGEX, UA_ESCAPE_CHAR)).join(UA_NAME_SEPARATOR);
2939
+ const version = userAgentPair[1]?.replace(UA_VALUE_ESCAPE_REGEX, UA_ESCAPE_CHAR);
2940
+ const prefixSeparatorIndex = name.indexOf(UA_NAME_SEPARATOR);
2941
+ const prefix = name.substring(0, prefixSeparatorIndex);
2942
+ let uaName = name.substring(prefixSeparatorIndex + 1);
2943
+ if (prefix === "api") {
2944
+ uaName = uaName.toLowerCase();
2945
+ }
2946
+ return [prefix, uaName, version].filter((item) => item && item.length > 0).reduce((acc, item, index) => {
2947
+ switch (index) {
2948
+ case 0:
2949
+ return item;
2950
+ case 1:
2951
+ return `${acc}/${item}`;
2952
+ default:
2953
+ return `${acc}#${item}`;
2954
+ }
2955
+ }, "");
2956
+ };
2957
+ var getUserAgentMiddlewareOptions = {
2958
+ name: "getUserAgentMiddleware",
2959
+ step: "build",
2960
+ priority: "low",
2961
+ tags: ["SET_USER_AGENT", "USER_AGENT"],
2962
+ override: true
2963
+ };
2964
+ var getUserAgentPlugin = (config) => ({
2965
+ applyToStack: (clientStack) => {
2966
+ clientStack.add(userAgentMiddleware(config), getUserAgentMiddlewareOptions);
2967
+ }
2968
+ });
2969
+
2970
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/emitWarningIfUnsupportedVersion.js
2971
+ var state = {
2972
+ warningEmitted: false
2973
+ };
2974
+ var emitWarningIfUnsupportedVersion2 = (version) => {
2975
+ if (version && !state.warningEmitted) {
2976
+ if (process.env.AWS_SDK_JS_NODE_VERSION_SUPPORT_WARNING_DISABLED === "true") {
2977
+ state.warningEmitted = true;
2978
+ return;
2979
+ }
2980
+ const userMajorVersion = parseInt(version.substring(1, version.indexOf(".")));
2981
+ const vv = 22;
2982
+ if (userMajorVersion < vv) {
2983
+ state.warningEmitted = true;
2984
+ process.emitWarning(`NodeVersionSupportWarning: The AWS SDK for JavaScript (v3)
2985
+ versions published after the first week of January 2027
2986
+ will require node >=${vv}. You are running node ${version}.
2987
+
2988
+ To continue receiving updates to AWS services, bug fixes,
2989
+ and security updates please upgrade to node >=${vv}.
2990
+
2991
+ More information can be found at: https://a.co/c895JFp`);
2992
+ }
2993
+ }
2994
+ };
2995
+
2996
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/util-user-agent-node/defaultUserAgent.js
2997
+ import { platform, release } from "os";
2998
+ import { env } from "process";
2999
+
3000
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/util-user-agent-node/getRuntimeUserAgentPair.js
3001
+ import { versions } from "process";
3002
+ var getRuntimeUserAgentPair = () => {
3003
+ const runtimesToCheck = ["deno", "bun", "llrt"];
3004
+ for (const runtime of runtimesToCheck) {
3005
+ if (versions[runtime]) {
3006
+ return [`md/${runtime}`, versions[runtime]];
3007
+ }
3008
+ }
3009
+ return ["md/nodejs", versions.node];
3010
+ };
3011
+
3012
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/util-user-agent-node/getTypeScriptUserAgentPair.js
3013
+ import { readFile } from "fs/promises";
3014
+ import { join } from "path";
3015
+
3016
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/util-user-agent-node/getNodeModulesParentDirs.js
3017
+ import { normalize, sep } from "path";
3018
+ var getNodeModulesParentDirs = (dirname) => {
3019
+ const cwd = process.cwd();
3020
+ if (!dirname) {
3021
+ return [cwd];
3022
+ }
3023
+ const normalizedPath = normalize(dirname);
3024
+ const parts = normalizedPath.split(sep);
3025
+ const nodeModulesIndex = parts.indexOf("node_modules");
3026
+ const parentDir = nodeModulesIndex !== -1 ? parts.slice(0, nodeModulesIndex).join(sep) : normalizedPath;
3027
+ if (cwd === parentDir) {
3028
+ return [cwd];
3029
+ }
3030
+ return [parentDir, cwd];
3031
+ };
3032
+
3033
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/util-user-agent-node/getSanitizedTypeScriptVersion.js
3034
+ var SEMVER_REGEX = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/;
3035
+ var getSanitizedTypeScriptVersion = (version = "") => {
3036
+ const match = version.match(SEMVER_REGEX);
3037
+ if (!match) {
3038
+ return void 0;
3039
+ }
3040
+ const [major, minor, patch, prerelease] = [match[1], match[2], match[3], match[4]];
3041
+ return prerelease ? `${major}.${minor}.${patch}-${prerelease}` : `${major}.${minor}.${patch}`;
3042
+ };
3043
+
3044
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/util-user-agent-node/getSanitizedDevTypeScriptVersion.js
3045
+ var ALLOWED_PREFIXES = ["^", "~", ">=", "<=", ">", "<"];
3046
+ var ALLOWED_DIST_TAGS = ["latest", "beta", "dev", "rc", "insiders", "next"];
3047
+ var getSanitizedDevTypeScriptVersion = (version = "") => {
3048
+ if (ALLOWED_DIST_TAGS.includes(version)) {
3049
+ return version;
3050
+ }
3051
+ const prefix = ALLOWED_PREFIXES.find((p) => version.startsWith(p)) ?? "";
3052
+ const sanitizedTypeScriptVersion = getSanitizedTypeScriptVersion(version.slice(prefix.length));
3053
+ if (!sanitizedTypeScriptVersion) {
3054
+ return void 0;
3055
+ }
3056
+ return `${prefix}${sanitizedTypeScriptVersion}`;
3057
+ };
3058
+
3059
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/util-user-agent-node/getTypeScriptUserAgentPair.js
3060
+ var tscVersion;
3061
+ var TS_PACKAGE_JSON = join("node_modules", "typescript", "package.json");
3062
+ var getTypeScriptUserAgentPair = async () => {
3063
+ if (tscVersion === null) {
3064
+ return void 0;
3065
+ } else if (typeof tscVersion === "string") {
3066
+ return ["md/tsc", tscVersion];
3067
+ }
3068
+ let isTypeScriptDetectionDisabled = false;
3069
+ try {
3070
+ isTypeScriptDetectionDisabled = booleanSelector(process.env, "AWS_SDK_JS_TYPESCRIPT_DETECTION_DISABLED", SelectorType.ENV) || false;
3071
+ } catch {
3072
+ }
3073
+ if (isTypeScriptDetectionDisabled) {
3074
+ tscVersion = null;
3075
+ return void 0;
3076
+ }
3077
+ const dirname = typeof __dirname !== "undefined" ? __dirname : void 0;
3078
+ const nodeModulesParentDirs = getNodeModulesParentDirs(dirname);
3079
+ let versionFromApp;
3080
+ for (const nodeModulesParentDir of nodeModulesParentDirs) {
3081
+ try {
3082
+ const appPackageJsonPath = join(nodeModulesParentDir, "package.json");
3083
+ const packageJson = await readFile(appPackageJsonPath, "utf-8");
3084
+ const { dependencies, devDependencies } = JSON.parse(packageJson);
3085
+ const version = devDependencies?.typescript ?? dependencies?.typescript;
3086
+ if (typeof version !== "string") {
3087
+ continue;
3088
+ }
3089
+ versionFromApp = version;
3090
+ break;
3091
+ } catch {
3092
+ }
3093
+ }
3094
+ if (!versionFromApp) {
3095
+ tscVersion = null;
3096
+ return void 0;
3097
+ }
3098
+ let versionFromNodeModules;
3099
+ for (const nodeModulesParentDir of nodeModulesParentDirs) {
3100
+ try {
3101
+ const tsPackageJsonPath = join(nodeModulesParentDir, TS_PACKAGE_JSON);
3102
+ const packageJson = await readFile(tsPackageJsonPath, "utf-8");
3103
+ const { version } = JSON.parse(packageJson);
3104
+ const sanitizedVersion2 = getSanitizedTypeScriptVersion(version);
3105
+ if (typeof sanitizedVersion2 !== "string") {
3106
+ continue;
3107
+ }
3108
+ versionFromNodeModules = sanitizedVersion2;
3109
+ break;
3110
+ } catch {
3111
+ }
3112
+ }
3113
+ if (versionFromNodeModules) {
3114
+ tscVersion = versionFromNodeModules;
3115
+ return ["md/tsc", tscVersion];
3116
+ }
3117
+ const sanitizedVersion = getSanitizedDevTypeScriptVersion(versionFromApp);
3118
+ if (typeof sanitizedVersion !== "string") {
3119
+ tscVersion = null;
3120
+ return void 0;
3121
+ }
3122
+ tscVersion = `dev_${sanitizedVersion}`;
3123
+ return ["md/tsc", tscVersion];
3124
+ };
3125
+
3126
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/util-user-agent-node/crt-availability.js
3127
+ var crtAvailability = {
3128
+ isCrtAvailable: false
3129
+ };
3130
+
3131
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/util-user-agent-node/is-crt-available.js
3132
+ var isCrtAvailable = () => {
3133
+ if (crtAvailability.isCrtAvailable) {
3134
+ return ["md/crt-avail"];
3135
+ }
3136
+ return null;
3137
+ };
3138
+
3139
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/util-user-agent-node/defaultUserAgent.js
3140
+ var createDefaultUserAgentProvider = ({ serviceId, clientVersion }) => {
3141
+ const runtimeUserAgentPair = getRuntimeUserAgentPair();
3142
+ return async (config) => {
3143
+ const sections = [
3144
+ ["aws-sdk-js", clientVersion],
3145
+ ["ua", "2.1"],
3146
+ [`os/${platform()}`, release()],
3147
+ ["lang/js"],
3148
+ runtimeUserAgentPair
3149
+ ];
3150
+ const typescriptUserAgentPair = await getTypeScriptUserAgentPair();
3151
+ if (typescriptUserAgentPair) {
3152
+ sections.push(typescriptUserAgentPair);
3153
+ }
3154
+ const crtAvailable = isCrtAvailable();
3155
+ if (crtAvailable) {
3156
+ sections.push(crtAvailable);
3157
+ }
3158
+ if (serviceId) {
3159
+ sections.push([`api/${serviceId}`, clientVersion]);
3160
+ }
3161
+ if (env.AWS_EXECUTION_ENV) {
3162
+ sections.push([`exec-env/${env.AWS_EXECUTION_ENV}`]);
3163
+ }
3164
+ const appId = await config?.userAgentAppId?.();
3165
+ const resolvedUserAgent = appId ? [...sections, [`app/${appId}`]] : [...sections];
3166
+ return resolvedUserAgent;
3167
+ };
3168
+ };
3169
+
3170
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/util-user-agent-node/nodeAppIdConfigOptions.js
3171
+ var UA_APP_ID_ENV_NAME = "AWS_SDK_UA_APP_ID";
3172
+ var UA_APP_ID_INI_NAME = "sdk_ua_app_id";
3173
+ var UA_APP_ID_INI_NAME_DEPRECATED = "sdk-ua-app-id";
3174
+ var NODE_APP_ID_CONFIG_OPTIONS = {
3175
+ environmentVariableSelector: (env2) => env2[UA_APP_ID_ENV_NAME],
3176
+ configFileSelector: (profile) => profile[UA_APP_ID_INI_NAME] ?? profile[UA_APP_ID_INI_NAME_DEPRECATED],
3177
+ default: DEFAULT_UA_APP_ID
3178
+ };
3179
+
3180
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/util-endpoints/lib/aws/isVirtualHostableS3Bucket.js
3181
+ var isVirtualHostableS3Bucket = (value, allowSubDomains = false) => {
3182
+ if (allowSubDomains) {
3183
+ for (const label of value.split(".")) {
3184
+ if (!isVirtualHostableS3Bucket(label)) {
3185
+ return false;
3186
+ }
3187
+ }
3188
+ return true;
3189
+ }
3190
+ if (!isValidHostLabel(value)) {
3191
+ return false;
3192
+ }
3193
+ if (value.length < 3 || value.length > 63) {
3194
+ return false;
3195
+ }
3196
+ if (value !== value.toLowerCase()) {
3197
+ return false;
3198
+ }
3199
+ if (isIpAddress(value)) {
3200
+ return false;
3201
+ }
3202
+ return true;
3203
+ };
3204
+
3205
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/util-endpoints/lib/aws/parseArn.js
3206
+ var ARN_DELIMITER = ":";
3207
+ var RESOURCE_DELIMITER = "/";
3208
+ var parseArn = (value) => {
3209
+ const segments = value.split(ARN_DELIMITER);
3210
+ if (segments.length < 6)
3211
+ return null;
3212
+ const [arn, partition2, service, region, accountId, ...resourcePath] = segments;
3213
+ if (arn !== "arn" || partition2 === "" || service === "" || resourcePath.join(ARN_DELIMITER) === "")
3214
+ return null;
3215
+ const resourceId = resourcePath.map((resource) => resource.split(RESOURCE_DELIMITER)).flat();
3216
+ return {
3217
+ partition: partition2,
3218
+ service,
3219
+ region,
3220
+ accountId,
3221
+ resourceId
3222
+ };
3223
+ };
3224
+
3225
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/util-endpoints/aws.js
3226
+ var awsEndpointFunctions = {
3227
+ isVirtualHostableS3Bucket,
3228
+ parseArn,
3229
+ partition
3230
+ };
3231
+ customEndpointFunctions.aws = awsEndpointFunctions;
3232
+
3233
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/region-config-resolver/stsRegionDefaultResolver.js
3234
+ function stsRegionDefaultResolver(loaderConfig = {}) {
3235
+ return loadConfig({
3236
+ ...NODE_REGION_CONFIG_OPTIONS,
3237
+ async default() {
3238
+ if (!warning.silence) {
3239
+ console.warn("@aws-sdk - WARN - default STS region of us-east-1 used. See @aws-sdk/credential-providers README and set a region explicitly.");
3240
+ }
3241
+ return "us-east-1";
3242
+ }
3243
+ }, { ...NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig });
3244
+ }
3245
+ var warning = {
3246
+ silence: false
3247
+ };
3248
+
3249
+ // ../../node_modules/@aws-sdk/core/dist-es/submodules/client/region-config-resolver/extensions.js
3250
+ var getAwsRegionExtensionConfiguration = (runtimeConfig) => {
3251
+ return {
3252
+ setRegion(region) {
3253
+ runtimeConfig.region = region;
3254
+ },
3255
+ region() {
3256
+ return runtimeConfig.region;
3257
+ }
3258
+ };
3259
+ };
3260
+ var resolveAwsRegionExtensionConfiguration = (awsRegionExtensionConfiguration) => {
3261
+ return {
3262
+ region: awsRegionExtensionConfiguration.region()
3263
+ };
3264
+ };
3265
+
3266
+ export {
3267
+ emitWarningIfUnsupportedVersion2 as emitWarningIfUnsupportedVersion,
3268
+ setCredentialFeature,
3269
+ WaiterState,
3270
+ checkExceptions,
3271
+ createWaiter,
3272
+ Client,
3273
+ Command,
3274
+ createAggregatedClient,
3275
+ ServiceException,
3276
+ decorateServiceException,
3277
+ loadConfigsForDefaultMode,
3278
+ emitWarningIfUnsupportedVersion as emitWarningIfUnsupportedVersion2,
3279
+ getDefaultExtensionConfiguration,
3280
+ resolveDefaultRuntimeConfig,
3281
+ getValueFromTextNode,
3282
+ NoOpLogger,
3283
+ resolveParams,
3284
+ BinaryDecisionDiagram,
3285
+ EndpointCache,
3286
+ customEndpointFunctions,
3287
+ decideEndpoint,
3288
+ resolveEndpointConfig,
3289
+ getEndpointPlugin,
3290
+ DEFAULT_RETRY_MODE,
3291
+ NODE_MAX_ATTEMPT_CONFIG_OPTIONS,
3292
+ resolveRetryConfig,
3293
+ NODE_RETRY_MODE_CONFIG_OPTIONS,
3294
+ getRetryPlugin,
3295
+ resolveHostHeaderConfig,
3296
+ getHostHeaderPlugin,
3297
+ getLoggerPlugin,
3298
+ getRecursionDetectionPlugin,
3299
+ getHttpAuthSchemeEndpointRuleSetPlugin,
3300
+ getHttpSigningPlugin,
3301
+ normalizeProvider2 as normalizeProvider,
3302
+ createPaginator,
3303
+ DefaultIdentityProviderConfig,
3304
+ NoAuthSigner,
3305
+ isIdentityExpired,
3306
+ doesIdentityRequireRefresh,
3307
+ memoizeIdentityProvider,
3308
+ resolveUserAgentConfig,
3309
+ getUserAgentPlugin,
3310
+ createDefaultUserAgentProvider,
3311
+ NODE_APP_ID_CONFIG_OPTIONS,
3312
+ awsEndpointFunctions,
3313
+ stsRegionDefaultResolver,
3314
+ getAwsRegionExtensionConfiguration,
3315
+ resolveAwsRegionExtensionConfiguration
3316
+ };
3317
+ //# sourceMappingURL=chunk-7UD62TQI.js.map