nowbackup 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3578 @@
1
+ import {
2
+ LazyJsonString,
3
+ NumericValue,
4
+ Uint8ArrayBlobAdapter,
5
+ _parseEpochTimestamp,
6
+ _parseRfc3339DateTimeWithOffset,
7
+ _parseRfc7231DateTime,
8
+ dateToUtcString,
9
+ fromBase64,
10
+ fromUtf8,
11
+ generateIdempotencyToken,
12
+ quoteHeader,
13
+ sdkStreamMixin,
14
+ splitEvery,
15
+ splitHeader,
16
+ toBase64,
17
+ toUtf8
18
+ } from "./chunk-APZ4HNNC.js";
19
+
20
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/middleware-stack/MiddlewareStack.js
21
+ var getAllAliases = (name, aliases) => {
22
+ const _aliases = [];
23
+ if (name) {
24
+ _aliases.push(name);
25
+ }
26
+ if (aliases) {
27
+ for (const alias of aliases) {
28
+ _aliases.push(alias);
29
+ }
30
+ }
31
+ return _aliases;
32
+ };
33
+ var getMiddlewareNameWithAliases = (name, aliases) => {
34
+ return `${name || "anonymous"}${aliases && aliases.length > 0 ? ` (a.k.a. ${aliases.join(",")})` : ""}`;
35
+ };
36
+ var constructStack = () => {
37
+ let absoluteEntries = [];
38
+ let relativeEntries = [];
39
+ let identifyOnResolve = false;
40
+ const entriesNameSet = /* @__PURE__ */ new Set();
41
+ const sort = (entries) => entries.sort((a, b) => stepWeights[b.step] - stepWeights[a.step] || priorityWeights[b.priority || "normal"] - priorityWeights[a.priority || "normal"]);
42
+ const removeByName = (toRemove) => {
43
+ let isRemoved = false;
44
+ const filterCb = (entry) => {
45
+ const aliases = getAllAliases(entry.name, entry.aliases);
46
+ if (aliases.includes(toRemove)) {
47
+ isRemoved = true;
48
+ for (const alias of aliases) {
49
+ entriesNameSet.delete(alias);
50
+ }
51
+ return false;
52
+ }
53
+ return true;
54
+ };
55
+ absoluteEntries = absoluteEntries.filter(filterCb);
56
+ relativeEntries = relativeEntries.filter(filterCb);
57
+ return isRemoved;
58
+ };
59
+ const removeByReference = (toRemove) => {
60
+ let isRemoved = false;
61
+ const filterCb = (entry) => {
62
+ if (entry.middleware === toRemove) {
63
+ isRemoved = true;
64
+ for (const alias of getAllAliases(entry.name, entry.aliases)) {
65
+ entriesNameSet.delete(alias);
66
+ }
67
+ return false;
68
+ }
69
+ return true;
70
+ };
71
+ absoluteEntries = absoluteEntries.filter(filterCb);
72
+ relativeEntries = relativeEntries.filter(filterCb);
73
+ return isRemoved;
74
+ };
75
+ const cloneTo = (toStack) => {
76
+ var _a;
77
+ absoluteEntries.forEach((entry) => {
78
+ toStack.add(entry.middleware, { ...entry });
79
+ });
80
+ relativeEntries.forEach((entry) => {
81
+ toStack.addRelativeTo(entry.middleware, { ...entry });
82
+ });
83
+ (_a = toStack.identifyOnResolve) == null ? void 0 : _a.call(toStack, stack.identifyOnResolve());
84
+ return toStack;
85
+ };
86
+ const expandRelativeMiddlewareList = (from) => {
87
+ const expandedMiddlewareList = [];
88
+ from.before.forEach((entry) => {
89
+ if (entry.before.length === 0 && entry.after.length === 0) {
90
+ expandedMiddlewareList.push(entry);
91
+ } else {
92
+ expandedMiddlewareList.push(...expandRelativeMiddlewareList(entry));
93
+ }
94
+ });
95
+ expandedMiddlewareList.push(from);
96
+ from.after.reverse().forEach((entry) => {
97
+ if (entry.before.length === 0 && entry.after.length === 0) {
98
+ expandedMiddlewareList.push(entry);
99
+ } else {
100
+ expandedMiddlewareList.push(...expandRelativeMiddlewareList(entry));
101
+ }
102
+ });
103
+ return expandedMiddlewareList;
104
+ };
105
+ const getMiddlewareList = (debug = false) => {
106
+ const normalizedAbsoluteEntries = [];
107
+ const normalizedRelativeEntries = [];
108
+ const normalizedEntriesNameMap = {};
109
+ absoluteEntries.forEach((entry) => {
110
+ const normalizedEntry = {
111
+ ...entry,
112
+ before: [],
113
+ after: []
114
+ };
115
+ for (const alias of getAllAliases(normalizedEntry.name, normalizedEntry.aliases)) {
116
+ normalizedEntriesNameMap[alias] = normalizedEntry;
117
+ }
118
+ normalizedAbsoluteEntries.push(normalizedEntry);
119
+ });
120
+ relativeEntries.forEach((entry) => {
121
+ const normalizedEntry = {
122
+ ...entry,
123
+ before: [],
124
+ after: []
125
+ };
126
+ for (const alias of getAllAliases(normalizedEntry.name, normalizedEntry.aliases)) {
127
+ normalizedEntriesNameMap[alias] = normalizedEntry;
128
+ }
129
+ normalizedRelativeEntries.push(normalizedEntry);
130
+ });
131
+ normalizedRelativeEntries.forEach((entry) => {
132
+ if (entry.toMiddleware) {
133
+ const toMiddleware = normalizedEntriesNameMap[entry.toMiddleware];
134
+ if (toMiddleware === void 0) {
135
+ if (debug) {
136
+ return;
137
+ }
138
+ throw new Error(`${entry.toMiddleware} is not found when adding ${getMiddlewareNameWithAliases(entry.name, entry.aliases)} middleware ${entry.relation} ${entry.toMiddleware}`);
139
+ }
140
+ if (entry.relation === "after") {
141
+ toMiddleware.after.push(entry);
142
+ }
143
+ if (entry.relation === "before") {
144
+ toMiddleware.before.push(entry);
145
+ }
146
+ }
147
+ });
148
+ const mainChain = sort(normalizedAbsoluteEntries).map(expandRelativeMiddlewareList).reduce((wholeList, expandedMiddlewareList) => {
149
+ wholeList.push(...expandedMiddlewareList);
150
+ return wholeList;
151
+ }, []);
152
+ return mainChain;
153
+ };
154
+ const stack = {
155
+ add: (middleware, options = {}) => {
156
+ const { name, override, aliases: _aliases } = options;
157
+ const entry = {
158
+ step: "initialize",
159
+ priority: "normal",
160
+ middleware,
161
+ ...options
162
+ };
163
+ const aliases = getAllAliases(name, _aliases);
164
+ if (aliases.length > 0) {
165
+ if (aliases.some((alias) => entriesNameSet.has(alias))) {
166
+ if (!override)
167
+ throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(name, _aliases)}'`);
168
+ for (const alias of aliases) {
169
+ const toOverrideIndex = absoluteEntries.findIndex((entry2) => {
170
+ var _a;
171
+ return entry2.name === alias || ((_a = entry2.aliases) == null ? void 0 : _a.some((a) => a === alias));
172
+ });
173
+ if (toOverrideIndex === -1) {
174
+ continue;
175
+ }
176
+ const toOverride = absoluteEntries[toOverrideIndex];
177
+ if (toOverride.step !== entry.step || entry.priority !== toOverride.priority) {
178
+ 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.`);
179
+ }
180
+ absoluteEntries.splice(toOverrideIndex, 1);
181
+ }
182
+ }
183
+ for (const alias of aliases) {
184
+ entriesNameSet.add(alias);
185
+ }
186
+ }
187
+ absoluteEntries.push(entry);
188
+ },
189
+ addRelativeTo: (middleware, options) => {
190
+ const { name, override, aliases: _aliases } = options;
191
+ const entry = {
192
+ middleware,
193
+ ...options
194
+ };
195
+ const aliases = getAllAliases(name, _aliases);
196
+ if (aliases.length > 0) {
197
+ if (aliases.some((alias) => entriesNameSet.has(alias))) {
198
+ if (!override)
199
+ throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(name, _aliases)}'`);
200
+ for (const alias of aliases) {
201
+ const toOverrideIndex = relativeEntries.findIndex((entry2) => {
202
+ var _a;
203
+ return entry2.name === alias || ((_a = entry2.aliases) == null ? void 0 : _a.some((a) => a === alias));
204
+ });
205
+ if (toOverrideIndex === -1) {
206
+ continue;
207
+ }
208
+ const toOverride = relativeEntries[toOverrideIndex];
209
+ if (toOverride.toMiddleware !== entry.toMiddleware || toOverride.relation !== entry.relation) {
210
+ 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.`);
211
+ }
212
+ relativeEntries.splice(toOverrideIndex, 1);
213
+ }
214
+ }
215
+ for (const alias of aliases) {
216
+ entriesNameSet.add(alias);
217
+ }
218
+ }
219
+ relativeEntries.push(entry);
220
+ },
221
+ clone: () => cloneTo(constructStack()),
222
+ use: (plugin) => {
223
+ plugin.applyToStack(stack);
224
+ },
225
+ remove: (toRemove) => {
226
+ if (typeof toRemove === "string")
227
+ return removeByName(toRemove);
228
+ else
229
+ return removeByReference(toRemove);
230
+ },
231
+ removeByTag: (toRemove) => {
232
+ let isRemoved = false;
233
+ const filterCb = (entry) => {
234
+ const { tags, name, aliases: _aliases } = entry;
235
+ if (tags && tags.includes(toRemove)) {
236
+ const aliases = getAllAliases(name, _aliases);
237
+ for (const alias of aliases) {
238
+ entriesNameSet.delete(alias);
239
+ }
240
+ isRemoved = true;
241
+ return false;
242
+ }
243
+ return true;
244
+ };
245
+ absoluteEntries = absoluteEntries.filter(filterCb);
246
+ relativeEntries = relativeEntries.filter(filterCb);
247
+ return isRemoved;
248
+ },
249
+ concat: (from) => {
250
+ var _a;
251
+ const cloned = cloneTo(constructStack());
252
+ cloned.use(from);
253
+ cloned.identifyOnResolve(identifyOnResolve || cloned.identifyOnResolve() || (((_a = from.identifyOnResolve) == null ? void 0 : _a.call(from)) ?? false));
254
+ return cloned;
255
+ },
256
+ applyToStack: cloneTo,
257
+ identify: () => {
258
+ return getMiddlewareList(true).map((mw) => {
259
+ const step = mw.step ?? mw.relation + " " + mw.toMiddleware;
260
+ return getMiddlewareNameWithAliases(mw.name, mw.aliases) + " - " + step;
261
+ });
262
+ },
263
+ identifyOnResolve(toggle) {
264
+ if (typeof toggle === "boolean")
265
+ identifyOnResolve = toggle;
266
+ return identifyOnResolve;
267
+ },
268
+ resolve: (handler, context) => {
269
+ for (const middleware of getMiddlewareList().map((entry) => entry.middleware).reverse()) {
270
+ handler = middleware(handler, context);
271
+ }
272
+ if (identifyOnResolve) {
273
+ console.log(stack.identify());
274
+ }
275
+ return handler;
276
+ }
277
+ };
278
+ return stack;
279
+ };
280
+ var stepWeights = {
281
+ initialize: 5,
282
+ serialize: 4,
283
+ build: 3,
284
+ finalizeRequest: 2,
285
+ deserialize: 1
286
+ };
287
+ var priorityWeights = {
288
+ high: 3,
289
+ normal: 2,
290
+ low: 1
291
+ };
292
+
293
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/smithy-client/client.js
294
+ var Client = class {
295
+ config;
296
+ middlewareStack = constructStack();
297
+ initConfig;
298
+ handlers;
299
+ constructor(config) {
300
+ this.config = config;
301
+ const { protocol, protocolSettings } = config;
302
+ if (protocolSettings) {
303
+ if (typeof protocol === "function") {
304
+ config.protocol = new protocol(protocolSettings);
305
+ }
306
+ }
307
+ }
308
+ send(command, optionsOrCb, cb) {
309
+ const options = typeof optionsOrCb !== "function" ? optionsOrCb : void 0;
310
+ const callback = typeof optionsOrCb === "function" ? optionsOrCb : cb;
311
+ const useHandlerCache = options === void 0 && this.config.cacheMiddleware === true;
312
+ let handler;
313
+ if (useHandlerCache) {
314
+ if (!this.handlers) {
315
+ this.handlers = /* @__PURE__ */ new WeakMap();
316
+ }
317
+ const handlers = this.handlers;
318
+ if (handlers.has(command.constructor)) {
319
+ handler = handlers.get(command.constructor);
320
+ } else {
321
+ handler = command.resolveMiddleware(this.middlewareStack, this.config, options);
322
+ handlers.set(command.constructor, handler);
323
+ }
324
+ } else {
325
+ delete this.handlers;
326
+ handler = command.resolveMiddleware(this.middlewareStack, this.config, options);
327
+ }
328
+ if (callback) {
329
+ handler(command).then((result) => callback(null, result.output), (err) => callback(err)).catch(() => {
330
+ });
331
+ } else {
332
+ return handler(command).then((result) => result.output);
333
+ }
334
+ }
335
+ destroy() {
336
+ var _a, _b, _c;
337
+ (_c = (_b = (_a = this.config) == null ? void 0 : _a.requestHandler) == null ? void 0 : _b.destroy) == null ? void 0 : _c.call(_b);
338
+ delete this.handlers;
339
+ }
340
+ };
341
+
342
+ // ../../node_modules/@smithy/types/dist-es/endpoint.js
343
+ var EndpointURLScheme;
344
+ (function(EndpointURLScheme2) {
345
+ EndpointURLScheme2["HTTP"] = "http";
346
+ EndpointURLScheme2["HTTPS"] = "https";
347
+ })(EndpointURLScheme || (EndpointURLScheme = {}));
348
+
349
+ // ../../node_modules/@smithy/types/dist-es/extensions/checksum.js
350
+ var AlgorithmId;
351
+ (function(AlgorithmId2) {
352
+ AlgorithmId2["MD5"] = "md5";
353
+ AlgorithmId2["CRC32"] = "crc32";
354
+ AlgorithmId2["CRC32C"] = "crc32c";
355
+ AlgorithmId2["SHA1"] = "sha1";
356
+ AlgorithmId2["SHA256"] = "sha256";
357
+ })(AlgorithmId || (AlgorithmId = {}));
358
+
359
+ // ../../node_modules/@smithy/types/dist-es/middleware.js
360
+ var SMITHY_CONTEXT_KEY = "__smithy_context";
361
+
362
+ // ../../node_modules/@smithy/types/dist-es/profile.js
363
+ var IniSectionType;
364
+ (function(IniSectionType2) {
365
+ IniSectionType2["PROFILE"] = "profile";
366
+ IniSectionType2["SSO_SESSION"] = "sso-session";
367
+ IniSectionType2["SERVICES"] = "services";
368
+ })(IniSectionType || (IniSectionType = {}));
369
+
370
+ // ../../node_modules/@smithy/core/dist-es/submodules/schema/deref.js
371
+ var deref = (schemaRef) => {
372
+ if (typeof schemaRef === "function") {
373
+ return schemaRef();
374
+ }
375
+ return schemaRef;
376
+ };
377
+
378
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/util-middleware/getSmithyContext.js
379
+ var getSmithyContext = (context) => context[SMITHY_CONTEXT_KEY] || (context[SMITHY_CONTEXT_KEY] = {});
380
+
381
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/util-middleware/normalizeProvider.js
382
+ var normalizeProvider = (input) => {
383
+ if (typeof input === "function")
384
+ return input;
385
+ const promisified = Promise.resolve(input);
386
+ return () => promisified;
387
+ };
388
+
389
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/smithy-client/create-aggregated-client.js
390
+ var createAggregatedClient = (commands, Client2, options) => {
391
+ for (const [command, CommandCtor] of Object.entries(commands)) {
392
+ const methodImpl = async function(args, optionsOrCb, cb) {
393
+ const command2 = new CommandCtor(args);
394
+ if (typeof optionsOrCb === "function") {
395
+ this.send(command2, optionsOrCb);
396
+ } else if (typeof cb === "function") {
397
+ if (typeof optionsOrCb !== "object")
398
+ throw new Error(`Expected http options but got ${typeof optionsOrCb}`);
399
+ this.send(command2, optionsOrCb || {}, cb);
400
+ } else {
401
+ return this.send(command2, optionsOrCb);
402
+ }
403
+ };
404
+ const methodName = (command[0].toLowerCase() + command.slice(1)).replace(/Command$/, "");
405
+ Client2.prototype[methodName] = methodImpl;
406
+ }
407
+ const { paginators = {}, waiters = {} } = options ?? {};
408
+ for (const [paginatorName, paginatorFn] of Object.entries(paginators)) {
409
+ if (Client2.prototype[paginatorName] === void 0) {
410
+ Client2.prototype[paginatorName] = function(commandInput = {}, paginationConfiguration, ...rest) {
411
+ return paginatorFn({
412
+ ...paginationConfiguration,
413
+ client: this
414
+ }, commandInput, ...rest);
415
+ };
416
+ }
417
+ }
418
+ for (const [waiterName, waiterFn] of Object.entries(waiters)) {
419
+ if (Client2.prototype[waiterName] === void 0) {
420
+ Client2.prototype[waiterName] = async function(commandInput = {}, waiterConfiguration, ...rest) {
421
+ let config = waiterConfiguration;
422
+ if (typeof waiterConfiguration === "number") {
423
+ config = {
424
+ maxWaitTime: waiterConfiguration
425
+ };
426
+ }
427
+ return waiterFn({
428
+ ...config,
429
+ client: this
430
+ }, commandInput, ...rest);
431
+ };
432
+ }
433
+ }
434
+ };
435
+
436
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/smithy-client/exceptions.js
437
+ var ServiceException = class _ServiceException extends Error {
438
+ $fault;
439
+ $response;
440
+ $retryable;
441
+ $metadata;
442
+ constructor(options) {
443
+ super(options.message);
444
+ Object.setPrototypeOf(this, Object.getPrototypeOf(this).constructor.prototype);
445
+ this.name = options.name;
446
+ this.$fault = options.$fault;
447
+ this.$metadata = options.$metadata;
448
+ }
449
+ static isInstance(value) {
450
+ if (!value)
451
+ return false;
452
+ const candidate = value;
453
+ return _ServiceException.prototype.isPrototypeOf(candidate) || Boolean(candidate.$fault) && Boolean(candidate.$metadata) && (candidate.$fault === "client" || candidate.$fault === "server");
454
+ }
455
+ static [Symbol.hasInstance](instance) {
456
+ if (!instance)
457
+ return false;
458
+ const candidate = instance;
459
+ if (this === _ServiceException) {
460
+ return _ServiceException.isInstance(instance);
461
+ }
462
+ if (_ServiceException.isInstance(instance)) {
463
+ if (candidate.name && this.name) {
464
+ return this.prototype.isPrototypeOf(instance) || candidate.name === this.name;
465
+ }
466
+ return this.prototype.isPrototypeOf(instance);
467
+ }
468
+ return false;
469
+ }
470
+ };
471
+ var decorateServiceException = (exception, additions = {}) => {
472
+ Object.entries(additions).filter(([, v]) => v !== void 0).forEach(([k, v]) => {
473
+ if (exception[k] == void 0 || exception[k] === "") {
474
+ exception[k] = v;
475
+ }
476
+ });
477
+ const message = exception.message || exception.Message || "UnknownError";
478
+ exception.message = message;
479
+ delete exception.Message;
480
+ return exception;
481
+ };
482
+
483
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/smithy-client/defaults-mode.js
484
+ var loadConfigsForDefaultMode = (mode) => {
485
+ switch (mode) {
486
+ case "standard":
487
+ return {
488
+ retryMode: "standard",
489
+ connectionTimeout: 3100
490
+ };
491
+ case "in-region":
492
+ return {
493
+ retryMode: "standard",
494
+ connectionTimeout: 1100
495
+ };
496
+ case "cross-region":
497
+ return {
498
+ retryMode: "standard",
499
+ connectionTimeout: 3100
500
+ };
501
+ case "mobile":
502
+ return {
503
+ retryMode: "standard",
504
+ connectionTimeout: 3e4
505
+ };
506
+ default:
507
+ return {};
508
+ }
509
+ };
510
+
511
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/smithy-client/emitWarningIfUnsupportedVersion.js
512
+ var warningEmitted = false;
513
+ var emitWarningIfUnsupportedVersion = (version) => {
514
+ if (version && !warningEmitted && parseInt(version.substring(1, version.indexOf("."))) < 16) {
515
+ warningEmitted = true;
516
+ }
517
+ };
518
+
519
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/smithy-client/extensions/checksum.js
520
+ var knownAlgorithms = Object.values(AlgorithmId);
521
+ var getChecksumConfiguration = (runtimeConfig) => {
522
+ const checksumAlgorithms = [];
523
+ for (const id in AlgorithmId) {
524
+ const algorithmId = AlgorithmId[id];
525
+ if (runtimeConfig[algorithmId] === void 0) {
526
+ continue;
527
+ }
528
+ checksumAlgorithms.push({
529
+ algorithmId: () => algorithmId,
530
+ checksumConstructor: () => runtimeConfig[algorithmId]
531
+ });
532
+ }
533
+ for (const [id, ChecksumCtor] of Object.entries(runtimeConfig.checksumAlgorithms ?? {})) {
534
+ checksumAlgorithms.push({
535
+ algorithmId: () => id,
536
+ checksumConstructor: () => ChecksumCtor
537
+ });
538
+ }
539
+ return {
540
+ addChecksumAlgorithm(algo) {
541
+ runtimeConfig.checksumAlgorithms = runtimeConfig.checksumAlgorithms ?? {};
542
+ const id = algo.algorithmId();
543
+ const ctor = algo.checksumConstructor();
544
+ if (knownAlgorithms.includes(id)) {
545
+ runtimeConfig.checksumAlgorithms[id.toUpperCase()] = ctor;
546
+ } else {
547
+ runtimeConfig.checksumAlgorithms[id] = ctor;
548
+ }
549
+ checksumAlgorithms.push(algo);
550
+ },
551
+ checksumAlgorithms() {
552
+ return checksumAlgorithms;
553
+ }
554
+ };
555
+ };
556
+ var resolveChecksumRuntimeConfig = (clientConfig) => {
557
+ const runtimeConfig = {};
558
+ clientConfig.checksumAlgorithms().forEach((checksumAlgorithm) => {
559
+ const id = checksumAlgorithm.algorithmId();
560
+ if (knownAlgorithms.includes(id)) {
561
+ runtimeConfig[id] = checksumAlgorithm.checksumConstructor();
562
+ }
563
+ });
564
+ return runtimeConfig;
565
+ };
566
+
567
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/smithy-client/extensions/retry.js
568
+ var getRetryConfiguration = (runtimeConfig) => {
569
+ return {
570
+ setRetryStrategy(retryStrategy) {
571
+ runtimeConfig.retryStrategy = retryStrategy;
572
+ },
573
+ retryStrategy() {
574
+ return runtimeConfig.retryStrategy;
575
+ }
576
+ };
577
+ };
578
+ var resolveRetryRuntimeConfig = (retryStrategyConfiguration) => {
579
+ const runtimeConfig = {};
580
+ runtimeConfig.retryStrategy = retryStrategyConfiguration.retryStrategy();
581
+ return runtimeConfig;
582
+ };
583
+
584
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/smithy-client/extensions/defaultExtensionConfiguration.js
585
+ var getDefaultExtensionConfiguration = (runtimeConfig) => {
586
+ return Object.assign(getChecksumConfiguration(runtimeConfig), getRetryConfiguration(runtimeConfig));
587
+ };
588
+ var resolveDefaultRuntimeConfig = (config) => {
589
+ return Object.assign(resolveChecksumRuntimeConfig(config), resolveRetryRuntimeConfig(config));
590
+ };
591
+
592
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/smithy-client/get-value-from-text-node.js
593
+ var getValueFromTextNode = (obj) => {
594
+ const textNodeName = "#text";
595
+ for (const key in obj) {
596
+ if (obj.hasOwnProperty(key) && obj[key][textNodeName] !== void 0) {
597
+ obj[key] = obj[key][textNodeName];
598
+ } else if (typeof obj[key] === "object" && obj[key] !== null) {
599
+ obj[key] = getValueFromTextNode(obj[key]);
600
+ }
601
+ }
602
+ return obj;
603
+ };
604
+
605
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/smithy-client/NoOpLogger.js
606
+ var NoOpLogger = class {
607
+ trace() {
608
+ }
609
+ debug() {
610
+ }
611
+ info() {
612
+ }
613
+ warn() {
614
+ }
615
+ error() {
616
+ }
617
+ };
618
+
619
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/property-provider/ProviderError.js
620
+ var ProviderError = class _ProviderError extends Error {
621
+ name = "ProviderError";
622
+ tryNextLink;
623
+ constructor(message, options = true) {
624
+ var _a;
625
+ let logger;
626
+ let tryNextLink = true;
627
+ if (typeof options === "boolean") {
628
+ logger = void 0;
629
+ tryNextLink = options;
630
+ } else if (options != null && typeof options === "object") {
631
+ logger = options.logger;
632
+ tryNextLink = options.tryNextLink ?? true;
633
+ }
634
+ super(message);
635
+ this.tryNextLink = tryNextLink;
636
+ Object.setPrototypeOf(this, _ProviderError.prototype);
637
+ (_a = logger == null ? void 0 : logger.debug) == null ? void 0 : _a.call(logger, `@smithy/property-provider ${tryNextLink ? "->" : "(!)"} ${message}`);
638
+ }
639
+ static from(error, options = true) {
640
+ return Object.assign(new this(error.message, options), error);
641
+ }
642
+ };
643
+
644
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/property-provider/CredentialsProviderError.js
645
+ var CredentialsProviderError = class _CredentialsProviderError extends ProviderError {
646
+ name = "CredentialsProviderError";
647
+ constructor(message, options = true) {
648
+ super(message, options);
649
+ Object.setPrototypeOf(this, _CredentialsProviderError.prototype);
650
+ }
651
+ };
652
+
653
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/property-provider/TokenProviderError.js
654
+ var TokenProviderError = class _TokenProviderError extends ProviderError {
655
+ name = "TokenProviderError";
656
+ constructor(message, options = true) {
657
+ super(message, options);
658
+ Object.setPrototypeOf(this, _TokenProviderError.prototype);
659
+ }
660
+ };
661
+
662
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/property-provider/chain.js
663
+ var chain = (...providers) => async () => {
664
+ if (providers.length === 0) {
665
+ throw new ProviderError("No providers in chain");
666
+ }
667
+ let lastProviderError;
668
+ for (const provider of providers) {
669
+ try {
670
+ const credentials = await provider();
671
+ return credentials;
672
+ } catch (err) {
673
+ lastProviderError = err;
674
+ if (err == null ? void 0 : err.tryNextLink) {
675
+ continue;
676
+ }
677
+ throw err;
678
+ }
679
+ }
680
+ throw lastProviderError;
681
+ };
682
+
683
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/property-provider/fromValue.js
684
+ var fromValue = (staticValue) => () => Promise.resolve(staticValue);
685
+
686
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/property-provider/memoize.js
687
+ var memoize = (provider, isExpired, requiresRefresh) => {
688
+ let resolved;
689
+ let pending;
690
+ let hasResult;
691
+ let isConstant = false;
692
+ const coalesceProvider = async () => {
693
+ if (!pending) {
694
+ pending = provider();
695
+ }
696
+ try {
697
+ resolved = await pending;
698
+ hasResult = true;
699
+ isConstant = false;
700
+ } finally {
701
+ pending = void 0;
702
+ }
703
+ return resolved;
704
+ };
705
+ if (isExpired === void 0) {
706
+ return async (options) => {
707
+ if (!hasResult || (options == null ? void 0 : options.forceRefresh)) {
708
+ resolved = await coalesceProvider();
709
+ }
710
+ return resolved;
711
+ };
712
+ }
713
+ return async (options) => {
714
+ if (!hasResult || (options == null ? void 0 : options.forceRefresh)) {
715
+ resolved = await coalesceProvider();
716
+ }
717
+ if (isConstant) {
718
+ return resolved;
719
+ }
720
+ if (requiresRefresh && !requiresRefresh(resolved)) {
721
+ isConstant = true;
722
+ return resolved;
723
+ }
724
+ if (isExpired(resolved)) {
725
+ await coalesceProvider();
726
+ return resolved;
727
+ }
728
+ return resolved;
729
+ };
730
+ };
731
+
732
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/util-config-provider/booleanSelector.js
733
+ var booleanSelector = (obj, key, type) => {
734
+ if (!(key in obj))
735
+ return void 0;
736
+ if (obj[key] === "true")
737
+ return true;
738
+ if (obj[key] === "false")
739
+ return false;
740
+ throw new Error(`Cannot load ${type} "${key}". Expected "true" or "false", got ${obj[key]}.`);
741
+ };
742
+
743
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/util-config-provider/types.js
744
+ var SelectorType;
745
+ (function(SelectorType2) {
746
+ SelectorType2["ENV"] = "env";
747
+ SelectorType2["CONFIG"] = "shared config entry";
748
+ })(SelectorType || (SelectorType = {}));
749
+
750
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getHomeDir.js
751
+ import { homedir } from "os";
752
+ import { sep } from "path";
753
+ var homeDirCache = {};
754
+ var getHomeDirCacheKey = () => {
755
+ if (process && process.geteuid) {
756
+ return `${process.geteuid()}`;
757
+ }
758
+ return "DEFAULT";
759
+ };
760
+ var getHomeDir = () => {
761
+ const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${sep}` } = process.env;
762
+ if (HOME)
763
+ return HOME;
764
+ if (USERPROFILE)
765
+ return USERPROFILE;
766
+ if (HOMEPATH)
767
+ return `${HOMEDRIVE}${HOMEPATH}`;
768
+ const homeDirCacheKey = getHomeDirCacheKey();
769
+ if (!homeDirCache[homeDirCacheKey])
770
+ homeDirCache[homeDirCacheKey] = homedir();
771
+ return homeDirCache[homeDirCacheKey];
772
+ };
773
+
774
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getProfileName.js
775
+ var ENV_PROFILE = "AWS_PROFILE";
776
+ var DEFAULT_PROFILE = "default";
777
+ var getProfileName = (init) => init.profile || process.env[ENV_PROFILE] || DEFAULT_PROFILE;
778
+
779
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getSSOTokenFilepath.js
780
+ import { createHash } from "crypto";
781
+ import { join } from "path";
782
+ var getSSOTokenFilepath = (id) => {
783
+ const hasher = createHash("sha1");
784
+ const cacheName = hasher.update(id).digest("hex");
785
+ return join(getHomeDir(), ".aws", "sso", "cache", `${cacheName}.json`);
786
+ };
787
+
788
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getSSOTokenFromFile.js
789
+ import { readFile } from "fs/promises";
790
+ var tokenIntercept = {};
791
+ var getSSOTokenFromFile = async (id) => {
792
+ if (tokenIntercept[id]) {
793
+ return tokenIntercept[id];
794
+ }
795
+ const ssoTokenFilepath = getSSOTokenFilepath(id);
796
+ const ssoTokenText = await readFile(ssoTokenFilepath, "utf8");
797
+ return JSON.parse(ssoTokenText);
798
+ };
799
+
800
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/constants.js
801
+ var CONFIG_PREFIX_SEPARATOR = ".";
802
+
803
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/loadSharedConfigFiles.js
804
+ import { join as join4 } from "path";
805
+
806
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getConfigData.js
807
+ var getConfigData = (data) => Object.entries(data).filter(([key]) => {
808
+ const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR);
809
+ if (indexOfSeparator === -1) {
810
+ return false;
811
+ }
812
+ return Object.values(IniSectionType).includes(key.substring(0, indexOfSeparator));
813
+ }).reduce((acc, [key, value]) => {
814
+ const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR);
815
+ const updatedKey = key.substring(0, indexOfSeparator) === IniSectionType.PROFILE ? key.substring(indexOfSeparator + 1) : key;
816
+ acc[updatedKey] = value;
817
+ return acc;
818
+ }, {
819
+ ...data.default && { default: data.default }
820
+ });
821
+
822
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getConfigFilepath.js
823
+ import { join as join2 } from "path";
824
+ var ENV_CONFIG_PATH = "AWS_CONFIG_FILE";
825
+ var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || join2(getHomeDir(), ".aws", "config");
826
+
827
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getCredentialsFilepath.js
828
+ import { join as join3 } from "path";
829
+ var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE";
830
+ var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || join3(getHomeDir(), ".aws", "credentials");
831
+
832
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/parseIni.js
833
+ var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/;
834
+ var profileNameBlockList = ["__proto__", "profile __proto__"];
835
+ var parseIni = (iniData) => {
836
+ const map = {};
837
+ let currentSection;
838
+ let currentSubSection;
839
+ for (const iniLine of iniData.split(/\r?\n/)) {
840
+ const trimmedLine = iniLine.split(/(^|\s)[;#]/)[0].trim();
841
+ const isSection = trimmedLine[0] === "[" && trimmedLine[trimmedLine.length - 1] === "]";
842
+ if (isSection) {
843
+ currentSection = void 0;
844
+ currentSubSection = void 0;
845
+ const sectionName = trimmedLine.substring(1, trimmedLine.length - 1);
846
+ const matches = prefixKeyRegex.exec(sectionName);
847
+ if (matches) {
848
+ const [, prefix, , name] = matches;
849
+ if (Object.values(IniSectionType).includes(prefix)) {
850
+ currentSection = [prefix, name].join(CONFIG_PREFIX_SEPARATOR);
851
+ }
852
+ } else {
853
+ currentSection = sectionName;
854
+ }
855
+ if (profileNameBlockList.includes(sectionName)) {
856
+ throw new Error(`Found invalid profile name "${sectionName}"`);
857
+ }
858
+ } else if (currentSection) {
859
+ const indexOfEqualsSign = trimmedLine.indexOf("=");
860
+ if (![0, -1].includes(indexOfEqualsSign)) {
861
+ const [name, value] = [
862
+ trimmedLine.substring(0, indexOfEqualsSign).trim(),
863
+ trimmedLine.substring(indexOfEqualsSign + 1).trim()
864
+ ];
865
+ if (value === "") {
866
+ currentSubSection = name;
867
+ } else {
868
+ if (currentSubSection && iniLine.trimStart() === iniLine) {
869
+ currentSubSection = void 0;
870
+ }
871
+ map[currentSection] = map[currentSection] || {};
872
+ const key = currentSubSection ? [currentSubSection, name].join(CONFIG_PREFIX_SEPARATOR) : name;
873
+ map[currentSection][key] = value;
874
+ }
875
+ }
876
+ }
877
+ }
878
+ return map;
879
+ };
880
+
881
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/readFile.js
882
+ import { readFile as fsReadFile } from "fs/promises";
883
+ var filePromises = {};
884
+ var fileIntercept = {};
885
+ var readFile2 = (path, options) => {
886
+ if (fileIntercept[path] !== void 0) {
887
+ return fileIntercept[path];
888
+ }
889
+ if (!filePromises[path] || (options == null ? void 0 : options.ignoreCache)) {
890
+ filePromises[path] = fsReadFile(path, "utf8");
891
+ }
892
+ return filePromises[path];
893
+ };
894
+
895
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/loadSharedConfigFiles.js
896
+ var swallowError = () => ({});
897
+ var loadSharedConfigFiles = async (init = {}) => {
898
+ const { filepath = getCredentialsFilepath(), configFilepath = getConfigFilepath() } = init;
899
+ const homeDir = getHomeDir();
900
+ const relativeHomeDirPrefix = "~/";
901
+ let resolvedFilepath = filepath;
902
+ if (filepath.startsWith(relativeHomeDirPrefix)) {
903
+ resolvedFilepath = join4(homeDir, filepath.slice(2));
904
+ }
905
+ let resolvedConfigFilepath = configFilepath;
906
+ if (configFilepath.startsWith(relativeHomeDirPrefix)) {
907
+ resolvedConfigFilepath = join4(homeDir, configFilepath.slice(2));
908
+ }
909
+ const parsedFiles = await Promise.all([
910
+ readFile2(resolvedConfigFilepath, {
911
+ ignoreCache: init.ignoreCache
912
+ }).then(parseIni).then(getConfigData).catch(swallowError),
913
+ readFile2(resolvedFilepath, {
914
+ ignoreCache: init.ignoreCache
915
+ }).then(parseIni).catch(swallowError)
916
+ ]);
917
+ return {
918
+ configFile: parsedFiles[0],
919
+ credentialsFile: parsedFiles[1]
920
+ };
921
+ };
922
+
923
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getSsoSessionData.js
924
+ var getSsoSessionData = (data) => Object.entries(data).filter(([key]) => key.startsWith(IniSectionType.SSO_SESSION + CONFIG_PREFIX_SEPARATOR)).reduce((acc, [key, value]) => ({ ...acc, [key.substring(key.indexOf(CONFIG_PREFIX_SEPARATOR) + 1)]: value }), {});
925
+
926
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/loadSsoSessionData.js
927
+ var swallowError2 = () => ({});
928
+ var loadSsoSessionData = async (init = {}) => readFile2(init.configFilepath ?? getConfigFilepath()).then(parseIni).then(getSsoSessionData).catch(swallowError2);
929
+
930
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/mergeConfigFiles.js
931
+ var mergeConfigFiles = (...files) => {
932
+ const merged = {};
933
+ for (const file of files) {
934
+ for (const [key, values] of Object.entries(file)) {
935
+ if (merged[key] !== void 0) {
936
+ Object.assign(merged[key], values);
937
+ } else {
938
+ merged[key] = values;
939
+ }
940
+ }
941
+ }
942
+ return merged;
943
+ };
944
+
945
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/parseKnownFiles.js
946
+ var parseKnownFiles = async (init) => {
947
+ const parsedFiles = await loadSharedConfigFiles(init);
948
+ return mergeConfigFiles(parsedFiles.configFile, parsedFiles.credentialsFile);
949
+ };
950
+
951
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/externalDataInterceptor.js
952
+ var externalDataInterceptor = {
953
+ getFileRecord() {
954
+ return fileIntercept;
955
+ },
956
+ interceptFile(path, contents) {
957
+ fileIntercept[path] = Promise.resolve(contents);
958
+ },
959
+ getTokenRecord() {
960
+ return tokenIntercept;
961
+ },
962
+ interceptToken(id, contents) {
963
+ tokenIntercept[id] = contents;
964
+ }
965
+ };
966
+
967
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/node-config-provider/getSelectorName.js
968
+ function getSelectorName(functionString) {
969
+ try {
970
+ const constants = new Set(Array.from(functionString.match(/([A-Z_]){3,}/g) ?? []));
971
+ constants.delete("CONFIG");
972
+ constants.delete("CONFIG_PREFIX_SEPARATOR");
973
+ constants.delete("ENV");
974
+ return [...constants].join(", ");
975
+ } catch (e) {
976
+ return functionString;
977
+ }
978
+ }
979
+
980
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/node-config-provider/fromEnv.js
981
+ var fromEnv = (envVarSelector, options) => async () => {
982
+ try {
983
+ const config = envVarSelector(process.env, options);
984
+ if (config === void 0) {
985
+ throw new Error();
986
+ }
987
+ return config;
988
+ } catch (e) {
989
+ throw new CredentialsProviderError(e.message || `Not found in ENV: ${getSelectorName(envVarSelector.toString())}`, { logger: options == null ? void 0 : options.logger });
990
+ }
991
+ };
992
+
993
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/node-config-provider/fromSharedConfigFiles.js
994
+ var fromSharedConfigFiles = (configSelector, { preferredFile = "config", ...init } = {}) => async () => {
995
+ const profile = getProfileName(init);
996
+ const { configFile, credentialsFile } = await loadSharedConfigFiles(init);
997
+ const profileFromCredentials = credentialsFile[profile] || {};
998
+ const profileFromConfig = configFile[profile] || {};
999
+ const mergedProfile = preferredFile === "config" ? { ...profileFromCredentials, ...profileFromConfig } : { ...profileFromConfig, ...profileFromCredentials };
1000
+ try {
1001
+ const cfgFile = preferredFile === "config" ? configFile : credentialsFile;
1002
+ const configValue = configSelector(mergedProfile, cfgFile);
1003
+ if (configValue === void 0) {
1004
+ throw new Error();
1005
+ }
1006
+ return configValue;
1007
+ } catch (e) {
1008
+ throw new CredentialsProviderError(e.message || `Not found in config files w/ profile [${profile}]: ${getSelectorName(configSelector.toString())}`, { logger: init.logger });
1009
+ }
1010
+ };
1011
+
1012
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/node-config-provider/fromStatic.js
1013
+ var isFunction = (func) => typeof func === "function";
1014
+ var fromStatic = (defaultValue) => isFunction(defaultValue) ? async () => await defaultValue() : fromValue(defaultValue);
1015
+
1016
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/node-config-provider/configLoader.js
1017
+ var loadConfig = ({ environmentVariableSelector, configFileSelector, default: defaultValue }, configuration = {}) => {
1018
+ const { signingName, logger } = configuration;
1019
+ const envOptions = { signingName, logger };
1020
+ return memoize(chain(fromEnv(environmentVariableSelector, envOptions), fromSharedConfigFiles(configFileSelector, configuration), fromStatic(defaultValue)));
1021
+ };
1022
+
1023
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/config-resolver/endpointsConfig/NodeUseDualstackEndpointConfigOptions.js
1024
+ var ENV_USE_DUALSTACK_ENDPOINT = "AWS_USE_DUALSTACK_ENDPOINT";
1025
+ var CONFIG_USE_DUALSTACK_ENDPOINT = "use_dualstack_endpoint";
1026
+ var NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS = {
1027
+ environmentVariableSelector: (env) => booleanSelector(env, ENV_USE_DUALSTACK_ENDPOINT, SelectorType.ENV),
1028
+ configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_DUALSTACK_ENDPOINT, SelectorType.CONFIG),
1029
+ default: false
1030
+ };
1031
+
1032
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/config-resolver/endpointsConfig/NodeUseFipsEndpointConfigOptions.js
1033
+ var ENV_USE_FIPS_ENDPOINT = "AWS_USE_FIPS_ENDPOINT";
1034
+ var CONFIG_USE_FIPS_ENDPOINT = "use_fips_endpoint";
1035
+ var NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS = {
1036
+ environmentVariableSelector: (env) => booleanSelector(env, ENV_USE_FIPS_ENDPOINT, SelectorType.ENV),
1037
+ configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_FIPS_ENDPOINT, SelectorType.CONFIG),
1038
+ default: false
1039
+ };
1040
+
1041
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/config-resolver/regionConfig/config.js
1042
+ var REGION_ENV_NAME = "AWS_REGION";
1043
+ var REGION_INI_NAME = "region";
1044
+ var NODE_REGION_CONFIG_OPTIONS = {
1045
+ environmentVariableSelector: (env) => env[REGION_ENV_NAME],
1046
+ configFileSelector: (profile) => profile[REGION_INI_NAME],
1047
+ default: () => {
1048
+ throw new Error("Region is missing");
1049
+ }
1050
+ };
1051
+ var NODE_REGION_CONFIG_FILE_OPTIONS = {
1052
+ preferredFile: "credentials"
1053
+ };
1054
+
1055
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/config-resolver/regionConfig/checkRegion.js
1056
+ var validRegions = /* @__PURE__ */ new Set();
1057
+ var checkRegion = (region, check = isValidHostLabel) => {
1058
+ if (!validRegions.has(region) && !check(region)) {
1059
+ if (region === "*") {
1060
+ console.warn(`@smithy/config-resolver WARN - Please use the caller region instead of "*". See "sigv4a" in https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md.`);
1061
+ } else {
1062
+ throw new Error(`Region not accepted: region="${region}" is not a valid hostname component.`);
1063
+ }
1064
+ } else {
1065
+ validRegions.add(region);
1066
+ }
1067
+ };
1068
+
1069
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/config-resolver/regionConfig/isFipsRegion.js
1070
+ var isFipsRegion = (region) => typeof region === "string" && (region.startsWith("fips-") || region.endsWith("-fips"));
1071
+
1072
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/config-resolver/regionConfig/getRealRegion.js
1073
+ var getRealRegion = (region) => isFipsRegion(region) ? ["fips-aws-global", "aws-fips"].includes(region) ? "us-east-1" : region.replace(/fips-(dkr-|prod-)?|-fips/, "") : region;
1074
+
1075
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/config-resolver/regionConfig/resolveRegionConfig.js
1076
+ var resolveRegionConfig = (input) => {
1077
+ const { region, useFipsEndpoint } = input;
1078
+ if (!region) {
1079
+ throw new Error("Region is missing");
1080
+ }
1081
+ return Object.assign(input, {
1082
+ region: async () => {
1083
+ const providedRegion = typeof region === "function" ? await region() : region;
1084
+ const realRegion = getRealRegion(providedRegion);
1085
+ checkRegion(realRegion);
1086
+ return realRegion;
1087
+ },
1088
+ useFipsEndpoint: async () => {
1089
+ const providedRegion = typeof region === "string" ? region : await region();
1090
+ if (isFipsRegion(providedRegion)) {
1091
+ return true;
1092
+ }
1093
+ return typeof useFipsEndpoint !== "function" ? Promise.resolve(!!useFipsEndpoint) : useFipsEndpoint();
1094
+ }
1095
+ });
1096
+ };
1097
+
1098
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/defaults-mode/constants.js
1099
+ var AWS_EXECUTION_ENV = "AWS_EXECUTION_ENV";
1100
+ var AWS_REGION_ENV = "AWS_REGION";
1101
+ var AWS_DEFAULT_REGION_ENV = "AWS_DEFAULT_REGION";
1102
+ var ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED";
1103
+ var DEFAULTS_MODE_OPTIONS = ["in-region", "cross-region", "mobile", "standard", "legacy"];
1104
+ var IMDS_REGION_PATH = "/latest/meta-data/placement/region";
1105
+
1106
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/defaults-mode/defaultsModeConfig.js
1107
+ var AWS_DEFAULTS_MODE_ENV = "AWS_DEFAULTS_MODE";
1108
+ var AWS_DEFAULTS_MODE_CONFIG = "defaults_mode";
1109
+ var NODE_DEFAULTS_MODE_CONFIG_OPTIONS = {
1110
+ environmentVariableSelector: (env) => {
1111
+ return env[AWS_DEFAULTS_MODE_ENV];
1112
+ },
1113
+ configFileSelector: (profile) => {
1114
+ return profile[AWS_DEFAULTS_MODE_CONFIG];
1115
+ },
1116
+ default: "legacy"
1117
+ };
1118
+
1119
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/defaults-mode/resolveDefaultsModeConfig.js
1120
+ var resolveDefaultsModeConfig = ({ region = loadConfig(NODE_REGION_CONFIG_OPTIONS), defaultsMode = loadConfig(NODE_DEFAULTS_MODE_CONFIG_OPTIONS) } = {}) => memoize(async () => {
1121
+ const mode = typeof defaultsMode === "function" ? await defaultsMode() : defaultsMode;
1122
+ switch (mode == null ? void 0 : mode.toLowerCase()) {
1123
+ case "auto":
1124
+ return resolveNodeDefaultsModeAuto(region);
1125
+ case "in-region":
1126
+ case "cross-region":
1127
+ case "mobile":
1128
+ case "standard":
1129
+ case "legacy":
1130
+ return Promise.resolve(mode == null ? void 0 : mode.toLocaleLowerCase());
1131
+ case void 0:
1132
+ return Promise.resolve("legacy");
1133
+ default:
1134
+ throw new Error(`Invalid parameter for "defaultsMode", expect ${DEFAULTS_MODE_OPTIONS.join(", ")}, got ${mode}`);
1135
+ }
1136
+ });
1137
+ var resolveNodeDefaultsModeAuto = async (clientRegion) => {
1138
+ if (clientRegion) {
1139
+ const resolvedRegion = typeof clientRegion === "function" ? await clientRegion() : clientRegion;
1140
+ const inferredRegion = await inferPhysicalRegion();
1141
+ if (!inferredRegion) {
1142
+ return "standard";
1143
+ }
1144
+ if (resolvedRegion === inferredRegion) {
1145
+ return "in-region";
1146
+ } else {
1147
+ return "cross-region";
1148
+ }
1149
+ }
1150
+ return "standard";
1151
+ };
1152
+ var inferPhysicalRegion = async () => {
1153
+ if (process.env[AWS_EXECUTION_ENV] && (process.env[AWS_REGION_ENV] || process.env[AWS_DEFAULT_REGION_ENV])) {
1154
+ return process.env[AWS_REGION_ENV] ?? process.env[AWS_DEFAULT_REGION_ENV];
1155
+ }
1156
+ if (!process.env[ENV_IMDS_DISABLED]) {
1157
+ try {
1158
+ const endpoint = await getImdsEndpoint();
1159
+ return (await imdsHttpGet({ hostname: endpoint.hostname, path: IMDS_REGION_PATH })).toString();
1160
+ } catch (e) {
1161
+ }
1162
+ }
1163
+ };
1164
+ var getImdsEndpoint = async () => {
1165
+ const envEndpoint = process.env.AWS_EC2_METADATA_SERVICE_ENDPOINT;
1166
+ if (envEndpoint) {
1167
+ const url = new URL(envEndpoint);
1168
+ return { hostname: url.hostname, path: url.pathname };
1169
+ }
1170
+ const envMode = process.env.AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE;
1171
+ if (envMode === "IPv6") {
1172
+ return { hostname: "fd00:ec2::254", path: "/" };
1173
+ }
1174
+ return { hostname: "169.254.169.254", path: "/" };
1175
+ };
1176
+ var imdsHttpGet = async ({ hostname, path }) => {
1177
+ const { request } = await import("http");
1178
+ return new Promise((resolve, reject) => {
1179
+ const req = request({
1180
+ method: "GET",
1181
+ hostname: hostname.replace(/^\[(.+)]$/, "$1"),
1182
+ path,
1183
+ timeout: 1e3,
1184
+ signal: AbortSignal.timeout(1e3)
1185
+ });
1186
+ req.on("error", (err) => {
1187
+ reject(err);
1188
+ req.destroy();
1189
+ });
1190
+ req.on("timeout", () => {
1191
+ reject(new Error("TimeoutError from instance metadata service"));
1192
+ req.destroy();
1193
+ });
1194
+ req.on("response", (res) => {
1195
+ const { statusCode = 400 } = res;
1196
+ if (statusCode < 200 || 300 <= statusCode) {
1197
+ reject(Object.assign(new Error("Error response received from instance metadata service"), { statusCode }));
1198
+ req.destroy();
1199
+ return;
1200
+ }
1201
+ const chunks = [];
1202
+ res.on("data", (chunk) => chunks.push(chunk));
1203
+ res.on("end", () => {
1204
+ resolve(Buffer.concat(chunks));
1205
+ req.destroy();
1206
+ });
1207
+ });
1208
+ req.end();
1209
+ });
1210
+ };
1211
+
1212
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/getEndpointUrlConfig.js
1213
+ var ENV_ENDPOINT_URL = "AWS_ENDPOINT_URL";
1214
+ var CONFIG_ENDPOINT_URL = "endpoint_url";
1215
+ var getEndpointUrlConfig = (serviceId) => ({
1216
+ environmentVariableSelector: (env) => {
1217
+ const serviceSuffixParts = serviceId.split(" ").map((w) => w.toUpperCase());
1218
+ const serviceEndpointUrl = env[[ENV_ENDPOINT_URL, ...serviceSuffixParts].join("_")];
1219
+ if (serviceEndpointUrl)
1220
+ return serviceEndpointUrl;
1221
+ const endpointUrl = env[ENV_ENDPOINT_URL];
1222
+ if (endpointUrl)
1223
+ return endpointUrl;
1224
+ return void 0;
1225
+ },
1226
+ configFileSelector: (profile, config) => {
1227
+ if (config && profile.services) {
1228
+ const servicesSection = config[["services", profile.services].join(CONFIG_PREFIX_SEPARATOR)];
1229
+ if (servicesSection) {
1230
+ const servicePrefixParts = serviceId.split(" ").map((w) => w.toLowerCase());
1231
+ const endpointUrl2 = servicesSection[[servicePrefixParts.join("_"), CONFIG_ENDPOINT_URL].join(CONFIG_PREFIX_SEPARATOR)];
1232
+ if (endpointUrl2)
1233
+ return endpointUrl2;
1234
+ }
1235
+ }
1236
+ const endpointUrl = profile[CONFIG_ENDPOINT_URL];
1237
+ if (endpointUrl)
1238
+ return endpointUrl;
1239
+ return void 0;
1240
+ },
1241
+ default: void 0
1242
+ });
1243
+
1244
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/getEndpointFromConfig.js
1245
+ var getEndpointFromConfig = async (serviceId) => loadConfig(getEndpointUrlConfig(serviceId ?? ""))();
1246
+
1247
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/service-customizations/s3.js
1248
+ var resolveParamsForS3 = async (endpointParams) => {
1249
+ const bucket = (endpointParams == null ? void 0 : endpointParams.Bucket) || "";
1250
+ if (typeof endpointParams.Bucket === "string") {
1251
+ endpointParams.Bucket = bucket.replace(/#/g, encodeURIComponent("#")).replace(/\?/g, encodeURIComponent("?"));
1252
+ }
1253
+ if (isArnBucketName(bucket)) {
1254
+ if (endpointParams.ForcePathStyle === true) {
1255
+ throw new Error("Path-style addressing cannot be used with ARN buckets");
1256
+ }
1257
+ } else if (!isDnsCompatibleBucketName(bucket) || bucket.indexOf(".") !== -1 && !String(endpointParams.Endpoint).startsWith("http:") || bucket.toLowerCase() !== bucket || bucket.length < 3) {
1258
+ endpointParams.ForcePathStyle = true;
1259
+ }
1260
+ if (endpointParams.DisableMultiRegionAccessPoints) {
1261
+ endpointParams.disableMultiRegionAccessPoints = true;
1262
+ endpointParams.DisableMRAP = true;
1263
+ }
1264
+ return endpointParams;
1265
+ };
1266
+ var DOMAIN_PATTERN = /^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/;
1267
+ var IP_ADDRESS_PATTERN = /(\d+\.){3}\d+/;
1268
+ var DOTS_PATTERN = /\.\./;
1269
+ var isDnsCompatibleBucketName = (bucketName) => DOMAIN_PATTERN.test(bucketName) && !IP_ADDRESS_PATTERN.test(bucketName) && !DOTS_PATTERN.test(bucketName);
1270
+ var isArnBucketName = (bucketName) => {
1271
+ const [arn, partition, service, , , bucket] = bucketName.split(":");
1272
+ const isArn = arn === "arn" && bucketName.split(":").length >= 6;
1273
+ const isValidArn = Boolean(isArn && partition && service && bucket);
1274
+ if (isArn && !isValidArn) {
1275
+ throw new Error(`Invalid ARN: ${bucketName} was an invalid ARN.`);
1276
+ }
1277
+ return isValidArn;
1278
+ };
1279
+
1280
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/createConfigValueProvider.js
1281
+ var createConfigValueProvider = (configKey, canonicalEndpointParamKey, config, isClientContextParam = false) => {
1282
+ const configProvider = async () => {
1283
+ let configValue;
1284
+ if (isClientContextParam) {
1285
+ const clientContextParams = config.clientContextParams;
1286
+ const nestedValue = clientContextParams == null ? void 0 : clientContextParams[configKey];
1287
+ configValue = nestedValue ?? config[configKey] ?? config[canonicalEndpointParamKey];
1288
+ } else {
1289
+ configValue = config[configKey] ?? config[canonicalEndpointParamKey];
1290
+ }
1291
+ if (typeof configValue === "function") {
1292
+ return configValue();
1293
+ }
1294
+ return configValue;
1295
+ };
1296
+ if (configKey === "credentialScope" || canonicalEndpointParamKey === "CredentialScope") {
1297
+ return async () => {
1298
+ const credentials = typeof config.credentials === "function" ? await config.credentials() : config.credentials;
1299
+ const configValue = (credentials == null ? void 0 : credentials.credentialScope) ?? (credentials == null ? void 0 : credentials.CredentialScope);
1300
+ return configValue;
1301
+ };
1302
+ }
1303
+ if (configKey === "accountId" || canonicalEndpointParamKey === "AccountId") {
1304
+ return async () => {
1305
+ const credentials = typeof config.credentials === "function" ? await config.credentials() : config.credentials;
1306
+ const configValue = (credentials == null ? void 0 : credentials.accountId) ?? (credentials == null ? void 0 : credentials.AccountId);
1307
+ return configValue;
1308
+ };
1309
+ }
1310
+ if (configKey === "endpoint" || canonicalEndpointParamKey === "endpoint") {
1311
+ return async () => {
1312
+ if (config.isCustomEndpoint === false) {
1313
+ return void 0;
1314
+ }
1315
+ const endpoint = await configProvider();
1316
+ if (endpoint && typeof endpoint === "object") {
1317
+ if ("url" in endpoint) {
1318
+ return endpoint.url.href;
1319
+ }
1320
+ if ("hostname" in endpoint) {
1321
+ const { protocol, hostname, port, path } = endpoint;
1322
+ return `${protocol}//${hostname}${port ? ":" + port : ""}${path}`;
1323
+ }
1324
+ }
1325
+ return endpoint;
1326
+ };
1327
+ }
1328
+ return configProvider;
1329
+ };
1330
+
1331
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/toEndpointV1.js
1332
+ var toEndpointV1 = (endpoint) => {
1333
+ if (typeof endpoint === "object") {
1334
+ if ("url" in endpoint) {
1335
+ const v1Endpoint = parseUrl(endpoint.url);
1336
+ if (endpoint.headers) {
1337
+ v1Endpoint.headers = {};
1338
+ for (const name in endpoint.headers) {
1339
+ v1Endpoint.headers[name.toLowerCase()] = endpoint.headers[name].join(", ");
1340
+ }
1341
+ }
1342
+ return v1Endpoint;
1343
+ }
1344
+ return endpoint;
1345
+ }
1346
+ return parseUrl(endpoint);
1347
+ };
1348
+
1349
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/getEndpointFromInstructions.js
1350
+ function bindGetEndpointFromInstructions(getEndpointFromConfig2) {
1351
+ return async (commandInput, instructionsSupplier, clientConfig, context) => {
1352
+ if (!clientConfig.isCustomEndpoint) {
1353
+ let endpointFromConfig;
1354
+ if (clientConfig.serviceConfiguredEndpoint) {
1355
+ endpointFromConfig = await clientConfig.serviceConfiguredEndpoint();
1356
+ } else {
1357
+ endpointFromConfig = await getEndpointFromConfig2(clientConfig.serviceId);
1358
+ }
1359
+ if (endpointFromConfig) {
1360
+ clientConfig.endpoint = () => Promise.resolve(toEndpointV1(endpointFromConfig));
1361
+ clientConfig.isCustomEndpoint = true;
1362
+ }
1363
+ }
1364
+ const endpointParams = await resolveParams(commandInput, instructionsSupplier, clientConfig);
1365
+ if (typeof clientConfig.endpointProvider !== "function") {
1366
+ throw new Error("config.endpointProvider is not set.");
1367
+ }
1368
+ const endpoint = clientConfig.endpointProvider(endpointParams, context);
1369
+ if (clientConfig.isCustomEndpoint && clientConfig.endpoint) {
1370
+ const customEndpoint = await clientConfig.endpoint();
1371
+ if (customEndpoint == null ? void 0 : customEndpoint.headers) {
1372
+ endpoint.headers ??= {};
1373
+ for (const [name, value] of Object.entries(customEndpoint.headers)) {
1374
+ endpoint.headers[name] = Array.isArray(value) ? value : [value];
1375
+ }
1376
+ }
1377
+ }
1378
+ return endpoint;
1379
+ };
1380
+ }
1381
+ var resolveParams = async (commandInput, instructionsSupplier, clientConfig) => {
1382
+ var _a;
1383
+ const endpointParams = {};
1384
+ const instructions = ((_a = instructionsSupplier == null ? void 0 : instructionsSupplier.getEndpointParameterInstructions) == null ? void 0 : _a.call(instructionsSupplier)) || {};
1385
+ for (const [name, instruction] of Object.entries(instructions)) {
1386
+ switch (instruction.type) {
1387
+ case "staticContextParams":
1388
+ endpointParams[name] = instruction.value;
1389
+ break;
1390
+ case "contextParams":
1391
+ endpointParams[name] = commandInput[instruction.name];
1392
+ break;
1393
+ case "clientContextParams":
1394
+ case "builtInParams":
1395
+ endpointParams[name] = await createConfigValueProvider(instruction.name, name, clientConfig, instruction.type !== "builtInParams")();
1396
+ break;
1397
+ case "operationContextParams":
1398
+ endpointParams[name] = instruction.get(commandInput);
1399
+ break;
1400
+ default:
1401
+ throw new Error("Unrecognized endpoint parameter instruction: " + JSON.stringify(instruction));
1402
+ }
1403
+ }
1404
+ if (Object.keys(instructions).length === 0) {
1405
+ Object.assign(endpointParams, clientConfig);
1406
+ }
1407
+ if (String(clientConfig.serviceId).toLowerCase() === "s3") {
1408
+ await resolveParamsForS3(endpointParams);
1409
+ }
1410
+ return endpointParams;
1411
+ };
1412
+
1413
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/endpointMiddleware.js
1414
+ function setFeature(context, feature, value) {
1415
+ if (!context.__smithy_context) {
1416
+ context.__smithy_context = { features: {} };
1417
+ } else if (!context.__smithy_context.features) {
1418
+ context.__smithy_context.features = {};
1419
+ }
1420
+ context.__smithy_context.features[feature] = value;
1421
+ }
1422
+ function bindEndpointMiddleware(getEndpointFromConfig2) {
1423
+ const getEndpointFromInstructions2 = bindGetEndpointFromInstructions(getEndpointFromConfig2);
1424
+ return ({ config, instructions }) => {
1425
+ return (next, context) => async (args) => {
1426
+ var _a, _b, _c;
1427
+ if (config.isCustomEndpoint) {
1428
+ setFeature(context, "ENDPOINT_OVERRIDE", "N");
1429
+ }
1430
+ const endpoint = await getEndpointFromInstructions2(args.input, {
1431
+ getEndpointParameterInstructions() {
1432
+ return instructions;
1433
+ }
1434
+ }, { ...config }, context);
1435
+ context.endpointV2 = endpoint;
1436
+ context.authSchemes = (_a = endpoint.properties) == null ? void 0 : _a.authSchemes;
1437
+ const authScheme = (_b = context.authSchemes) == null ? void 0 : _b[0];
1438
+ if (authScheme) {
1439
+ context["signing_region"] = authScheme.signingRegion;
1440
+ context["signing_service"] = authScheme.signingName;
1441
+ const smithyContext = getSmithyContext(context);
1442
+ const httpAuthOption = (_c = smithyContext == null ? void 0 : smithyContext.selectedHttpAuthScheme) == null ? void 0 : _c.httpAuthOption;
1443
+ if (httpAuthOption) {
1444
+ httpAuthOption.signingProperties = Object.assign(httpAuthOption.signingProperties || {}, {
1445
+ signing_region: authScheme.signingRegion,
1446
+ signingRegion: authScheme.signingRegion,
1447
+ signing_service: authScheme.signingName,
1448
+ signingName: authScheme.signingName,
1449
+ signingRegionSet: authScheme.signingRegionSet
1450
+ }, authScheme.properties);
1451
+ }
1452
+ }
1453
+ return next({
1454
+ ...args
1455
+ });
1456
+ };
1457
+ };
1458
+ }
1459
+
1460
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/getEndpointPlugin.js
1461
+ var serializerMiddlewareOption = {
1462
+ name: "serializerMiddleware",
1463
+ step: "serialize",
1464
+ tags: ["SERIALIZER"],
1465
+ override: true
1466
+ };
1467
+ var endpointMiddlewareOptions = {
1468
+ step: "serialize",
1469
+ tags: ["ENDPOINT_PARAMETERS", "ENDPOINT_V2", "ENDPOINT"],
1470
+ name: "endpointV2Middleware",
1471
+ override: true,
1472
+ relation: "before",
1473
+ toMiddleware: serializerMiddlewareOption.name
1474
+ };
1475
+ function bindGetEndpointPlugin(getEndpointFromConfig2) {
1476
+ const endpointMiddleware2 = bindEndpointMiddleware(getEndpointFromConfig2);
1477
+ return (config, instructions) => ({
1478
+ applyToStack: (clientStack) => {
1479
+ clientStack.addRelativeTo(endpointMiddleware2({
1480
+ config,
1481
+ instructions
1482
+ }), endpointMiddlewareOptions);
1483
+ }
1484
+ });
1485
+ }
1486
+
1487
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/resolveEndpointConfig.js
1488
+ function bindResolveEndpointConfig(getEndpointFromConfig2) {
1489
+ return (input) => {
1490
+ const tls = input.tls ?? true;
1491
+ const { endpoint, useDualstackEndpoint, useFipsEndpoint } = input;
1492
+ const customEndpointProvider = endpoint != null ? async () => toEndpointV1(await normalizeProvider(endpoint)()) : void 0;
1493
+ const isCustomEndpoint = !!endpoint;
1494
+ const resolvedConfig = Object.assign(input, {
1495
+ endpoint: customEndpointProvider,
1496
+ tls,
1497
+ isCustomEndpoint,
1498
+ useDualstackEndpoint: normalizeProvider(useDualstackEndpoint ?? false),
1499
+ useFipsEndpoint: normalizeProvider(useFipsEndpoint ?? false)
1500
+ });
1501
+ let configuredEndpointPromise = void 0;
1502
+ resolvedConfig.serviceConfiguredEndpoint = async () => {
1503
+ if (input.serviceId && !configuredEndpointPromise) {
1504
+ configuredEndpointPromise = getEndpointFromConfig2(input.serviceId);
1505
+ }
1506
+ return configuredEndpointPromise;
1507
+ };
1508
+ return resolvedConfig;
1509
+ };
1510
+ }
1511
+
1512
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/bdd/BinaryDecisionDiagram.js
1513
+ var BinaryDecisionDiagram = class _BinaryDecisionDiagram {
1514
+ nodes;
1515
+ root;
1516
+ conditions;
1517
+ results;
1518
+ constructor(bdd, root, conditions, results) {
1519
+ this.nodes = bdd;
1520
+ this.root = root;
1521
+ this.conditions = conditions;
1522
+ this.results = results;
1523
+ }
1524
+ static from(bdd, root, conditions, results) {
1525
+ return new _BinaryDecisionDiagram(bdd, root, conditions, results);
1526
+ }
1527
+ };
1528
+
1529
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/cache/EndpointCache.js
1530
+ var EndpointCache = class {
1531
+ capacity;
1532
+ data = /* @__PURE__ */ new Map();
1533
+ parameters = [];
1534
+ constructor({ size, params }) {
1535
+ this.capacity = size ?? 50;
1536
+ if (params) {
1537
+ this.parameters = params;
1538
+ }
1539
+ }
1540
+ get(endpointParams, resolver) {
1541
+ const key = this.hash(endpointParams);
1542
+ if (key === false) {
1543
+ return resolver();
1544
+ }
1545
+ if (!this.data.has(key)) {
1546
+ if (this.data.size > this.capacity + 10) {
1547
+ const keys = this.data.keys();
1548
+ let i = 0;
1549
+ while (true) {
1550
+ const { value, done } = keys.next();
1551
+ this.data.delete(value);
1552
+ if (done || ++i > 10) {
1553
+ break;
1554
+ }
1555
+ }
1556
+ }
1557
+ this.data.set(key, resolver());
1558
+ }
1559
+ return this.data.get(key);
1560
+ }
1561
+ size() {
1562
+ return this.data.size;
1563
+ }
1564
+ hash(endpointParams) {
1565
+ let buffer = "";
1566
+ const { parameters } = this;
1567
+ if (parameters.length === 0) {
1568
+ return false;
1569
+ }
1570
+ for (const param of parameters) {
1571
+ const val = String(endpointParams[param] ?? "");
1572
+ if (val.includes("|;")) {
1573
+ return false;
1574
+ }
1575
+ buffer += val + "|;";
1576
+ }
1577
+ return buffer;
1578
+ }
1579
+ };
1580
+
1581
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/types/EndpointError.js
1582
+ var EndpointError = class extends Error {
1583
+ constructor(message) {
1584
+ super(message);
1585
+ this.name = "EndpointError";
1586
+ }
1587
+ };
1588
+
1589
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/debug/debugId.js
1590
+ var debugId = "endpoints";
1591
+
1592
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/debug/toDebugString.js
1593
+ function toDebugString(input) {
1594
+ if (typeof input !== "object" || input == null) {
1595
+ return input;
1596
+ }
1597
+ if ("ref" in input) {
1598
+ return `$${toDebugString(input.ref)}`;
1599
+ }
1600
+ if ("fn" in input) {
1601
+ return `${input.fn}(${(input.argv || []).map(toDebugString).join(", ")})`;
1602
+ }
1603
+ return JSON.stringify(input, null, 2);
1604
+ }
1605
+
1606
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/utils/customEndpointFunctions.js
1607
+ var customEndpointFunctions = {};
1608
+
1609
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/booleanEquals.js
1610
+ var booleanEquals = (value1, value2) => value1 === value2;
1611
+
1612
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/coalesce.js
1613
+ function coalesce(...args) {
1614
+ for (const arg of args) {
1615
+ if (arg != null) {
1616
+ return arg;
1617
+ }
1618
+ }
1619
+ return void 0;
1620
+ }
1621
+
1622
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/getAttrPathList.js
1623
+ var getAttrPathList = (path) => {
1624
+ const parts = path.split(".");
1625
+ const pathList = [];
1626
+ for (const part of parts) {
1627
+ const squareBracketIndex = part.indexOf("[");
1628
+ if (squareBracketIndex !== -1) {
1629
+ if (part.indexOf("]") !== part.length - 1) {
1630
+ throw new EndpointError(`Path: '${path}' does not end with ']'`);
1631
+ }
1632
+ const arrayIndex = part.slice(squareBracketIndex + 1, -1);
1633
+ if (Number.isNaN(parseInt(arrayIndex))) {
1634
+ throw new EndpointError(`Invalid array index: '${arrayIndex}' in path: '${path}'`);
1635
+ }
1636
+ if (squareBracketIndex !== 0) {
1637
+ pathList.push(part.slice(0, squareBracketIndex));
1638
+ }
1639
+ pathList.push(arrayIndex);
1640
+ } else {
1641
+ pathList.push(part);
1642
+ }
1643
+ }
1644
+ return pathList;
1645
+ };
1646
+
1647
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/getAttr.js
1648
+ var getAttr = (value, path) => getAttrPathList(path).reduce((acc, index) => {
1649
+ if (typeof acc !== "object") {
1650
+ throw new EndpointError(`Index '${index}' in '${path}' not found in '${JSON.stringify(value)}'`);
1651
+ } else if (Array.isArray(acc)) {
1652
+ const i = parseInt(index);
1653
+ return acc[i < 0 ? acc.length + i : i];
1654
+ }
1655
+ return acc[index];
1656
+ }, value);
1657
+
1658
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/isSet.js
1659
+ var isSet = (value) => value != null;
1660
+
1661
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/isValidHostLabel.js
1662
+ var VALID_HOST_LABEL_REGEX = new RegExp(`^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$`);
1663
+ var isValidHostLabel = (value, allowSubDomains = false) => {
1664
+ if (!allowSubDomains) {
1665
+ return VALID_HOST_LABEL_REGEX.test(value);
1666
+ }
1667
+ const labels = value.split(".");
1668
+ for (const label of labels) {
1669
+ if (!isValidHostLabel(label)) {
1670
+ return false;
1671
+ }
1672
+ }
1673
+ return true;
1674
+ };
1675
+
1676
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/ite.js
1677
+ function ite(condition, trueValue, falseValue) {
1678
+ return condition ? trueValue : falseValue;
1679
+ }
1680
+
1681
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/not.js
1682
+ var not = (value) => !value;
1683
+
1684
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/isIpAddress.js
1685
+ 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}$`);
1686
+ var isIpAddress = (value) => IP_V4_REGEX.test(value) || value.startsWith("[") && value.endsWith("]");
1687
+
1688
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/parseURL.js
1689
+ var DEFAULT_PORTS = {
1690
+ [EndpointURLScheme.HTTP]: 80,
1691
+ [EndpointURLScheme.HTTPS]: 443
1692
+ };
1693
+ var parseURL = (value) => {
1694
+ const whatwgURL = (() => {
1695
+ try {
1696
+ if (value instanceof URL) {
1697
+ return value;
1698
+ }
1699
+ if (typeof value === "object" && "hostname" in value) {
1700
+ const { hostname: hostname2, port, protocol: protocol2 = "", path = "", query = {} } = value;
1701
+ const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path}`);
1702
+ url.search = Object.entries(query).map(([k, v]) => `${k}=${v}`).join("&");
1703
+ return url;
1704
+ }
1705
+ return new URL(value);
1706
+ } catch (error) {
1707
+ return null;
1708
+ }
1709
+ })();
1710
+ if (!whatwgURL) {
1711
+ console.error(`Unable to parse ${JSON.stringify(value)} as a whatwg URL.`);
1712
+ return null;
1713
+ }
1714
+ const urlString = whatwgURL.href;
1715
+ const { host, hostname, pathname, protocol, search } = whatwgURL;
1716
+ if (search) {
1717
+ return null;
1718
+ }
1719
+ const scheme = protocol.slice(0, -1);
1720
+ if (!Object.values(EndpointURLScheme).includes(scheme)) {
1721
+ return null;
1722
+ }
1723
+ const isIp = isIpAddress(hostname);
1724
+ const inputContainsDefaultPort = urlString.includes(`${host}:${DEFAULT_PORTS[scheme]}`) || typeof value === "string" && value.includes(`${host}:${DEFAULT_PORTS[scheme]}`);
1725
+ const authority = `${host}${inputContainsDefaultPort ? `:${DEFAULT_PORTS[scheme]}` : ``}`;
1726
+ return {
1727
+ scheme,
1728
+ authority,
1729
+ path: pathname,
1730
+ normalizedPath: pathname.endsWith("/") ? pathname : `${pathname}/`,
1731
+ isIp
1732
+ };
1733
+ };
1734
+
1735
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/split.js
1736
+ function split(value, delimiter, limit) {
1737
+ if (limit === 1) {
1738
+ return [value];
1739
+ }
1740
+ if (value === "") {
1741
+ return [""];
1742
+ }
1743
+ const parts = value.split(delimiter);
1744
+ if (limit === 0) {
1745
+ return parts;
1746
+ }
1747
+ return parts.slice(0, limit - 1).concat(parts.slice(1).join(delimiter));
1748
+ }
1749
+
1750
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/stringEquals.js
1751
+ var stringEquals = (value1, value2) => value1 === value2;
1752
+
1753
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/substring.js
1754
+ var substring = (input, start, stop, reverse) => {
1755
+ if (input == null || start >= stop || input.length < stop || /[^\u0000-\u007f]/.test(input)) {
1756
+ return null;
1757
+ }
1758
+ if (!reverse) {
1759
+ return input.substring(start, stop);
1760
+ }
1761
+ return input.substring(input.length - stop, input.length - start);
1762
+ };
1763
+
1764
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/uriEncode.js
1765
+ var uriEncode = (value) => encodeURIComponent(value).replace(/[!*'()]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`);
1766
+
1767
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/utils/endpointFunctions.js
1768
+ var endpointFunctions = {
1769
+ booleanEquals,
1770
+ coalesce,
1771
+ getAttr,
1772
+ isSet,
1773
+ isValidHostLabel,
1774
+ ite,
1775
+ not,
1776
+ parseURL,
1777
+ split,
1778
+ stringEquals,
1779
+ substring,
1780
+ uriEncode
1781
+ };
1782
+
1783
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/utils/evaluateTemplate.js
1784
+ var evaluateTemplate = (template, options) => {
1785
+ const evaluatedTemplateArr = [];
1786
+ const { referenceRecord, endpointParams } = options;
1787
+ let currentIndex = 0;
1788
+ while (currentIndex < template.length) {
1789
+ const openingBraceIndex = template.indexOf("{", currentIndex);
1790
+ if (openingBraceIndex === -1) {
1791
+ evaluatedTemplateArr.push(template.slice(currentIndex));
1792
+ break;
1793
+ }
1794
+ evaluatedTemplateArr.push(template.slice(currentIndex, openingBraceIndex));
1795
+ const closingBraceIndex = template.indexOf("}", openingBraceIndex);
1796
+ if (closingBraceIndex === -1) {
1797
+ evaluatedTemplateArr.push(template.slice(openingBraceIndex));
1798
+ break;
1799
+ }
1800
+ if (template[openingBraceIndex + 1] === "{" && template[closingBraceIndex + 1] === "}") {
1801
+ evaluatedTemplateArr.push(template.slice(openingBraceIndex + 1, closingBraceIndex));
1802
+ currentIndex = closingBraceIndex + 2;
1803
+ }
1804
+ const parameterName = template.substring(openingBraceIndex + 1, closingBraceIndex);
1805
+ if (parameterName.includes("#")) {
1806
+ const [refName, attrName] = parameterName.split("#");
1807
+ evaluatedTemplateArr.push(getAttr(referenceRecord[refName] ?? endpointParams[refName], attrName));
1808
+ } else {
1809
+ evaluatedTemplateArr.push(referenceRecord[parameterName] ?? endpointParams[parameterName]);
1810
+ }
1811
+ currentIndex = closingBraceIndex + 1;
1812
+ }
1813
+ return evaluatedTemplateArr.join("");
1814
+ };
1815
+
1816
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/utils/getReferenceValue.js
1817
+ var getReferenceValue = ({ ref }, options) => {
1818
+ return options.referenceRecord[ref] ?? options.endpointParams[ref];
1819
+ };
1820
+
1821
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/utils/evaluateExpression.js
1822
+ var evaluateExpression = (obj, keyName, options) => {
1823
+ if (typeof obj === "string") {
1824
+ return evaluateTemplate(obj, options);
1825
+ } else if (obj["fn"]) {
1826
+ return group.callFunction(obj, options);
1827
+ } else if (obj["ref"]) {
1828
+ return getReferenceValue(obj, options);
1829
+ }
1830
+ throw new EndpointError(`'${keyName}': ${String(obj)} is not a string, function or reference.`);
1831
+ };
1832
+ var callFunction = ({ fn, argv }, options) => {
1833
+ const evaluatedArgs = Array(argv.length);
1834
+ for (let i = 0; i < evaluatedArgs.length; ++i) {
1835
+ const arg = argv[i];
1836
+ if (typeof arg === "boolean" || typeof arg === "number") {
1837
+ evaluatedArgs[i] = arg;
1838
+ } else {
1839
+ evaluatedArgs[i] = group.evaluateExpression(arg, "arg", options);
1840
+ }
1841
+ }
1842
+ const namespaceSeparatorIndex = fn.indexOf(".");
1843
+ if (namespaceSeparatorIndex !== -1) {
1844
+ const namespaceFunctions = customEndpointFunctions[fn.slice(0, namespaceSeparatorIndex)];
1845
+ const customFunction = namespaceFunctions == null ? void 0 : namespaceFunctions[fn.slice(namespaceSeparatorIndex + 1)];
1846
+ if (typeof customFunction === "function") {
1847
+ return customFunction(...evaluatedArgs);
1848
+ }
1849
+ }
1850
+ const callable = endpointFunctions[fn];
1851
+ if (typeof callable === "function") {
1852
+ return callable(...evaluatedArgs);
1853
+ }
1854
+ throw new Error(`function ${fn} not loaded in endpointFunctions.`);
1855
+ };
1856
+ var group = {
1857
+ evaluateExpression,
1858
+ callFunction
1859
+ };
1860
+
1861
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/utils/evaluateCondition.js
1862
+ var evaluateCondition = (condition, options) => {
1863
+ var _a, _b;
1864
+ const { assign } = condition;
1865
+ if (assign && assign in options.referenceRecord) {
1866
+ throw new EndpointError(`'${assign}' is already defined in Reference Record.`);
1867
+ }
1868
+ const value = callFunction(condition, options);
1869
+ (_b = (_a = options.logger) == null ? void 0 : _a.debug) == null ? void 0 : _b.call(_a, `${debugId} evaluateCondition: ${toDebugString(condition)} = ${toDebugString(value)}`);
1870
+ const result = value === "" ? true : !!value;
1871
+ if (assign != null) {
1872
+ return { result, toAssign: { name: assign, value } };
1873
+ }
1874
+ return { result };
1875
+ };
1876
+
1877
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/utils/getEndpointHeaders.js
1878
+ var getEndpointHeaders = (headers, options) => Object.entries(headers ?? {}).reduce((acc, [headerKey, headerVal]) => {
1879
+ acc[headerKey] = headerVal.map((headerValEntry) => {
1880
+ const processedExpr = evaluateExpression(headerValEntry, "Header value entry", options);
1881
+ if (typeof processedExpr !== "string") {
1882
+ throw new EndpointError(`Header '${headerKey}' value '${processedExpr}' is not a string`);
1883
+ }
1884
+ return processedExpr;
1885
+ });
1886
+ return acc;
1887
+ }, {});
1888
+
1889
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/utils/getEndpointProperties.js
1890
+ var getEndpointProperties = (properties, options) => Object.entries(properties).reduce((acc, [propertyKey, propertyVal]) => {
1891
+ acc[propertyKey] = group2.getEndpointProperty(propertyVal, options);
1892
+ return acc;
1893
+ }, {});
1894
+ var getEndpointProperty = (property, options) => {
1895
+ if (Array.isArray(property)) {
1896
+ return property.map((propertyEntry) => getEndpointProperty(propertyEntry, options));
1897
+ }
1898
+ switch (typeof property) {
1899
+ case "string":
1900
+ return evaluateTemplate(property, options);
1901
+ case "object":
1902
+ if (property === null) {
1903
+ throw new EndpointError(`Unexpected endpoint property: ${property}`);
1904
+ }
1905
+ return group2.getEndpointProperties(property, options);
1906
+ case "boolean":
1907
+ return property;
1908
+ default:
1909
+ throw new EndpointError(`Unexpected endpoint property type: ${typeof property}`);
1910
+ }
1911
+ };
1912
+ var group2 = {
1913
+ getEndpointProperty,
1914
+ getEndpointProperties
1915
+ };
1916
+
1917
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/utils/getEndpointUrl.js
1918
+ var getEndpointUrl = (endpointUrl, options) => {
1919
+ const expression = evaluateExpression(endpointUrl, "Endpoint URL", options);
1920
+ if (typeof expression === "string") {
1921
+ try {
1922
+ return new URL(expression);
1923
+ } catch (error) {
1924
+ console.error(`Failed to construct URL with ${expression}`, error);
1925
+ throw error;
1926
+ }
1927
+ }
1928
+ throw new EndpointError(`Endpoint URL must be a string, got ${typeof expression}`);
1929
+ };
1930
+
1931
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/decideEndpoint.js
1932
+ var RESULT = 1e8;
1933
+ var decideEndpoint = (bdd, options) => {
1934
+ const { nodes, root, results, conditions } = bdd;
1935
+ let ref = root;
1936
+ const referenceRecord = {};
1937
+ const closure = {
1938
+ referenceRecord,
1939
+ endpointParams: options.endpointParams,
1940
+ logger: options.logger
1941
+ };
1942
+ while (ref !== 1 && ref !== -1 && ref < RESULT) {
1943
+ const node_i = 3 * (Math.abs(ref) - 1);
1944
+ const [condition_i, highRef, lowRef] = [nodes[node_i], nodes[node_i + 1], nodes[node_i + 2]];
1945
+ const [fn, argv, assign] = conditions[condition_i];
1946
+ const evaluation = evaluateCondition({ fn, assign, argv }, closure);
1947
+ if (evaluation.toAssign) {
1948
+ const { name, value } = evaluation.toAssign;
1949
+ referenceRecord[name] = value;
1950
+ }
1951
+ ref = ref >= 0 === evaluation.result ? highRef : lowRef;
1952
+ }
1953
+ if (ref >= RESULT) {
1954
+ const result = results[ref - RESULT];
1955
+ if (result[0] === -1) {
1956
+ const [, errorExpression] = result;
1957
+ throw new EndpointError(evaluateExpression(errorExpression, "Error", closure));
1958
+ }
1959
+ const [url, properties, headers] = result;
1960
+ return {
1961
+ url: getEndpointUrl(url, closure),
1962
+ properties: getEndpointProperties(properties, closure),
1963
+ headers: getEndpointHeaders(headers ?? {}, closure)
1964
+ };
1965
+ }
1966
+ throw new EndpointError(`No matching endpoint.`);
1967
+ };
1968
+
1969
+ // ../../node_modules/@smithy/core/dist-es/submodules/endpoints/index.js
1970
+ var getEndpointFromInstructions = bindGetEndpointFromInstructions(getEndpointFromConfig);
1971
+ var resolveEndpointConfig = bindResolveEndpointConfig(getEndpointFromConfig);
1972
+ var endpointMiddleware = bindEndpointMiddleware(getEndpointFromConfig);
1973
+ var getEndpointPlugin = bindGetEndpointPlugin(getEndpointFromConfig);
1974
+
1975
+ // ../../node_modules/@smithy/core/dist-es/submodules/protocols/collect-stream-body.js
1976
+ var collectBody = async (streamBody = new Uint8Array(), context) => {
1977
+ if (streamBody instanceof Uint8Array) {
1978
+ return Uint8ArrayBlobAdapter.mutate(streamBody);
1979
+ }
1980
+ if (!streamBody) {
1981
+ return Uint8ArrayBlobAdapter.mutate(new Uint8Array());
1982
+ }
1983
+ const fromContext = context.streamCollector(streamBody);
1984
+ return Uint8ArrayBlobAdapter.mutate(await fromContext);
1985
+ };
1986
+
1987
+ // ../../node_modules/@smithy/core/dist-es/submodules/protocols/extended-encode-uri-component.js
1988
+ function extendedEncodeURIComponent(str) {
1989
+ return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {
1990
+ return "%" + c.charCodeAt(0).toString(16).toUpperCase();
1991
+ });
1992
+ }
1993
+
1994
+ // ../../node_modules/@smithy/core/dist-es/submodules/protocols/SerdeContext.js
1995
+ var SerdeContext = class {
1996
+ serdeContext;
1997
+ setSerdeContext(serdeContext) {
1998
+ this.serdeContext = serdeContext;
1999
+ }
2000
+ };
2001
+
2002
+ // ../../node_modules/@smithy/core/dist-es/submodules/protocols/protocol-http/httpRequest.js
2003
+ var HttpRequest = class _HttpRequest {
2004
+ method;
2005
+ protocol;
2006
+ hostname;
2007
+ port;
2008
+ path;
2009
+ query;
2010
+ headers;
2011
+ username;
2012
+ password;
2013
+ fragment;
2014
+ body;
2015
+ constructor(options) {
2016
+ this.method = options.method || "GET";
2017
+ this.hostname = options.hostname || "localhost";
2018
+ this.port = options.port;
2019
+ this.query = options.query || {};
2020
+ this.headers = options.headers || {};
2021
+ this.body = options.body;
2022
+ this.protocol = options.protocol ? options.protocol.slice(-1) !== ":" ? `${options.protocol}:` : options.protocol : "https:";
2023
+ this.path = options.path ? options.path.charAt(0) !== "/" ? `/${options.path}` : options.path : "/";
2024
+ this.username = options.username;
2025
+ this.password = options.password;
2026
+ this.fragment = options.fragment;
2027
+ }
2028
+ static clone(request) {
2029
+ const cloned = new _HttpRequest({
2030
+ ...request,
2031
+ headers: { ...request.headers }
2032
+ });
2033
+ if (cloned.query) {
2034
+ cloned.query = cloneQuery(cloned.query);
2035
+ }
2036
+ return cloned;
2037
+ }
2038
+ static isInstance(request) {
2039
+ if (!request) {
2040
+ return false;
2041
+ }
2042
+ const req = request;
2043
+ return "method" in req && "protocol" in req && "hostname" in req && "path" in req && typeof req["query"] === "object" && typeof req["headers"] === "object";
2044
+ }
2045
+ clone() {
2046
+ return _HttpRequest.clone(this);
2047
+ }
2048
+ };
2049
+ function cloneQuery(query) {
2050
+ return Object.keys(query).reduce((carry, paramName) => {
2051
+ const param = query[paramName];
2052
+ return {
2053
+ ...carry,
2054
+ [paramName]: Array.isArray(param) ? [...param] : param
2055
+ };
2056
+ }, {});
2057
+ }
2058
+
2059
+ // ../../node_modules/@smithy/core/dist-es/submodules/protocols/protocol-http/httpResponse.js
2060
+ var HttpResponse = class {
2061
+ statusCode;
2062
+ reason;
2063
+ headers;
2064
+ body;
2065
+ constructor(options) {
2066
+ this.statusCode = options.statusCode;
2067
+ this.reason = options.reason;
2068
+ this.headers = options.headers || {};
2069
+ this.body = options.body;
2070
+ }
2071
+ static isInstance(response) {
2072
+ if (!response)
2073
+ return false;
2074
+ const resp = response;
2075
+ return typeof resp.statusCode === "number" && typeof resp.headers === "object";
2076
+ }
2077
+ };
2078
+
2079
+ // ../../node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js
2080
+ var HttpProtocol = class extends SerdeContext {
2081
+ options;
2082
+ compositeErrorRegistry;
2083
+ constructor(options) {
2084
+ super();
2085
+ this.options = options;
2086
+ this.compositeErrorRegistry = TypeRegistry.for(options.defaultNamespace);
2087
+ for (const etr of options.errorTypeRegistries ?? []) {
2088
+ this.compositeErrorRegistry.copyFrom(etr);
2089
+ }
2090
+ }
2091
+ getRequestType() {
2092
+ return HttpRequest;
2093
+ }
2094
+ getResponseType() {
2095
+ return HttpResponse;
2096
+ }
2097
+ setSerdeContext(serdeContext) {
2098
+ this.serdeContext = serdeContext;
2099
+ this.serializer.setSerdeContext(serdeContext);
2100
+ this.deserializer.setSerdeContext(serdeContext);
2101
+ if (this.getPayloadCodec()) {
2102
+ this.getPayloadCodec().setSerdeContext(serdeContext);
2103
+ }
2104
+ }
2105
+ updateServiceEndpoint(request, endpoint) {
2106
+ if ("url" in endpoint) {
2107
+ request.protocol = endpoint.url.protocol;
2108
+ request.hostname = endpoint.url.hostname;
2109
+ request.port = endpoint.url.port ? Number(endpoint.url.port) : void 0;
2110
+ request.path = endpoint.url.pathname;
2111
+ request.fragment = endpoint.url.hash || void 0;
2112
+ request.username = endpoint.url.username || void 0;
2113
+ request.password = endpoint.url.password || void 0;
2114
+ if (!request.query) {
2115
+ request.query = {};
2116
+ }
2117
+ for (const [k, v] of endpoint.url.searchParams.entries()) {
2118
+ request.query[k] = v;
2119
+ }
2120
+ if (endpoint.headers) {
2121
+ for (const name in endpoint.headers) {
2122
+ request.headers[name] = endpoint.headers[name].join(", ");
2123
+ }
2124
+ }
2125
+ return request;
2126
+ } else {
2127
+ request.protocol = endpoint.protocol;
2128
+ request.hostname = endpoint.hostname;
2129
+ request.port = endpoint.port ? Number(endpoint.port) : void 0;
2130
+ request.path = endpoint.path;
2131
+ request.query = {
2132
+ ...endpoint.query
2133
+ };
2134
+ if (endpoint.headers) {
2135
+ for (const name in endpoint.headers) {
2136
+ request.headers[name] = endpoint.headers[name];
2137
+ }
2138
+ }
2139
+ return request;
2140
+ }
2141
+ }
2142
+ setHostPrefix(request, operationSchema, input) {
2143
+ var _a, _b;
2144
+ if ((_a = this.serdeContext) == null ? void 0 : _a.disableHostPrefix) {
2145
+ return;
2146
+ }
2147
+ const inputNs = NormalizedSchema.of(operationSchema.input);
2148
+ const opTraits = translateTraits(operationSchema.traits ?? {});
2149
+ if (opTraits.endpoint) {
2150
+ let hostPrefix = (_b = opTraits.endpoint) == null ? void 0 : _b[0];
2151
+ if (typeof hostPrefix === "string") {
2152
+ for (const [name, member2] of inputNs.structIterator()) {
2153
+ if (!member2.getMergedTraits().hostLabel) {
2154
+ continue;
2155
+ }
2156
+ const replacement = input[name];
2157
+ if (typeof replacement !== "string") {
2158
+ throw new Error(`@smithy/core/schema - ${name} in input must be a string as hostLabel.`);
2159
+ }
2160
+ hostPrefix = hostPrefix.replace(`{${name}}`, replacement);
2161
+ }
2162
+ request.hostname = hostPrefix + request.hostname;
2163
+ }
2164
+ }
2165
+ }
2166
+ deserializeMetadata(output) {
2167
+ return {
2168
+ httpStatusCode: output.statusCode,
2169
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
2170
+ extendedRequestId: output.headers["x-amz-id-2"],
2171
+ cfId: output.headers["x-amz-cf-id"]
2172
+ };
2173
+ }
2174
+ async serializeEventStream({ eventStream, requestSchema, initialRequest }) {
2175
+ const eventStreamSerde = await this.loadEventStreamCapability();
2176
+ return eventStreamSerde.serializeEventStream({
2177
+ eventStream,
2178
+ requestSchema,
2179
+ initialRequest
2180
+ });
2181
+ }
2182
+ async deserializeEventStream({ response, responseSchema, initialResponseContainer }) {
2183
+ const eventStreamSerde = await this.loadEventStreamCapability();
2184
+ return eventStreamSerde.deserializeEventStream({
2185
+ response,
2186
+ responseSchema,
2187
+ initialResponseContainer
2188
+ });
2189
+ }
2190
+ async loadEventStreamCapability() {
2191
+ const { EventStreamSerde } = await import("./event-streams-CYRJEQX4.js");
2192
+ return new EventStreamSerde({
2193
+ marshaller: this.getEventStreamMarshaller(),
2194
+ serializer: this.serializer,
2195
+ deserializer: this.deserializer,
2196
+ serdeContext: this.serdeContext,
2197
+ defaultContentType: this.getDefaultContentType()
2198
+ });
2199
+ }
2200
+ getDefaultContentType() {
2201
+ throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`);
2202
+ }
2203
+ async deserializeHttpMessage(schema, context, response, arg4, arg5) {
2204
+ void schema;
2205
+ void context;
2206
+ void response;
2207
+ void arg4;
2208
+ void arg5;
2209
+ return [];
2210
+ }
2211
+ getEventStreamMarshaller() {
2212
+ const context = this.serdeContext;
2213
+ if (!context.eventStreamMarshaller) {
2214
+ throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");
2215
+ }
2216
+ return context.eventStreamMarshaller;
2217
+ }
2218
+ };
2219
+
2220
+ // ../../node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js
2221
+ var HttpBindingProtocol = class extends HttpProtocol {
2222
+ async serializeRequest(operationSchema, _input, context) {
2223
+ const input = _input && typeof _input === "object" ? _input : {};
2224
+ const serializer = this.serializer;
2225
+ const query = {};
2226
+ const headers = {};
2227
+ const endpoint = await context.endpoint();
2228
+ const ns = NormalizedSchema.of(operationSchema == null ? void 0 : operationSchema.input);
2229
+ const payloadMemberNames = [];
2230
+ const payloadMemberSchemas = [];
2231
+ let hasNonHttpBindingMember = false;
2232
+ let payload;
2233
+ const request = new HttpRequest({
2234
+ protocol: "",
2235
+ hostname: "",
2236
+ port: void 0,
2237
+ path: "",
2238
+ fragment: void 0,
2239
+ query,
2240
+ headers,
2241
+ body: void 0
2242
+ });
2243
+ if (endpoint) {
2244
+ this.updateServiceEndpoint(request, endpoint);
2245
+ this.setHostPrefix(request, operationSchema, input);
2246
+ const opTraits = translateTraits(operationSchema.traits);
2247
+ if (opTraits.http) {
2248
+ request.method = opTraits.http[0];
2249
+ const [path, search] = opTraits.http[1].split("?");
2250
+ if (request.path == "/") {
2251
+ request.path = path;
2252
+ } else {
2253
+ request.path += path;
2254
+ }
2255
+ const traitSearchParams = new URLSearchParams(search ?? "");
2256
+ for (const [key, value] of traitSearchParams) {
2257
+ query[key] = value;
2258
+ }
2259
+ }
2260
+ }
2261
+ for (const [memberName, memberNs] of ns.structIterator()) {
2262
+ const memberTraits = memberNs.getMergedTraits() ?? {};
2263
+ const inputMemberValue = input[memberName];
2264
+ if (inputMemberValue == null && !memberNs.isIdempotencyToken()) {
2265
+ if (memberTraits.httpLabel) {
2266
+ if (request.path.includes(`{${memberName}+}`) || request.path.includes(`{${memberName}}`)) {
2267
+ throw new Error(`No value provided for input HTTP label: ${memberName}.`);
2268
+ }
2269
+ }
2270
+ continue;
2271
+ }
2272
+ if (memberTraits.httpPayload) {
2273
+ const isStreaming = memberNs.isStreaming();
2274
+ if (isStreaming) {
2275
+ const isEventStream = memberNs.isStructSchema();
2276
+ if (isEventStream) {
2277
+ if (input[memberName]) {
2278
+ payload = await this.serializeEventStream({
2279
+ eventStream: input[memberName],
2280
+ requestSchema: ns
2281
+ });
2282
+ }
2283
+ } else {
2284
+ payload = inputMemberValue;
2285
+ }
2286
+ } else {
2287
+ serializer.write(memberNs, inputMemberValue);
2288
+ payload = serializer.flush();
2289
+ }
2290
+ } else if (memberTraits.httpLabel) {
2291
+ serializer.write(memberNs, inputMemberValue);
2292
+ const replacement = serializer.flush();
2293
+ if (request.path.includes(`{${memberName}+}`)) {
2294
+ request.path = request.path.replace(`{${memberName}+}`, replacement.split("/").map(extendedEncodeURIComponent).join("/"));
2295
+ } else if (request.path.includes(`{${memberName}}`)) {
2296
+ request.path = request.path.replace(`{${memberName}}`, extendedEncodeURIComponent(replacement));
2297
+ }
2298
+ } else if (memberTraits.httpHeader) {
2299
+ serializer.write(memberNs, inputMemberValue);
2300
+ headers[memberTraits.httpHeader.toLowerCase()] = String(serializer.flush());
2301
+ } else if (typeof memberTraits.httpPrefixHeaders === "string") {
2302
+ for (const key in inputMemberValue) {
2303
+ const val = inputMemberValue[key];
2304
+ const amalgam = memberTraits.httpPrefixHeaders + key;
2305
+ serializer.write([memberNs.getValueSchema(), { httpHeader: amalgam }], val);
2306
+ headers[amalgam.toLowerCase()] = serializer.flush();
2307
+ }
2308
+ } else if (memberTraits.httpQuery || memberTraits.httpQueryParams) {
2309
+ this.serializeQuery(memberNs, inputMemberValue, query);
2310
+ } else {
2311
+ hasNonHttpBindingMember = true;
2312
+ payloadMemberNames.push(memberName);
2313
+ payloadMemberSchemas.push(memberNs);
2314
+ }
2315
+ }
2316
+ if (hasNonHttpBindingMember && input) {
2317
+ const [namespace, name] = (ns.getName(true) ?? "#Unknown").split("#");
2318
+ const requiredMembers = ns.getSchema()[6];
2319
+ const payloadSchema = [
2320
+ 3,
2321
+ namespace,
2322
+ name,
2323
+ ns.getMergedTraits(),
2324
+ payloadMemberNames,
2325
+ payloadMemberSchemas,
2326
+ void 0
2327
+ ];
2328
+ if (requiredMembers) {
2329
+ payloadSchema[6] = requiredMembers;
2330
+ } else {
2331
+ payloadSchema.pop();
2332
+ }
2333
+ serializer.write(payloadSchema, input);
2334
+ payload = serializer.flush();
2335
+ }
2336
+ request.headers = headers;
2337
+ request.query = query;
2338
+ request.body = payload;
2339
+ return request;
2340
+ }
2341
+ serializeQuery(ns, data, query) {
2342
+ const serializer = this.serializer;
2343
+ const traits = ns.getMergedTraits();
2344
+ if (traits.httpQueryParams) {
2345
+ for (const key in data) {
2346
+ if (!(key in query)) {
2347
+ const val = data[key];
2348
+ const valueSchema = ns.getValueSchema();
2349
+ Object.assign(valueSchema.getMergedTraits(), {
2350
+ ...traits,
2351
+ httpQuery: key,
2352
+ httpQueryParams: void 0
2353
+ });
2354
+ this.serializeQuery(valueSchema, val, query);
2355
+ }
2356
+ }
2357
+ return;
2358
+ }
2359
+ if (ns.isListSchema()) {
2360
+ const sparse = !!ns.getMergedTraits().sparse;
2361
+ const buffer = [];
2362
+ for (const item of data) {
2363
+ serializer.write([ns.getValueSchema(), traits], item);
2364
+ const serializable = serializer.flush();
2365
+ if (sparse || serializable !== void 0) {
2366
+ buffer.push(serializable);
2367
+ }
2368
+ }
2369
+ query[traits.httpQuery] = buffer;
2370
+ } else {
2371
+ serializer.write([ns, traits], data);
2372
+ query[traits.httpQuery] = serializer.flush();
2373
+ }
2374
+ }
2375
+ async deserializeResponse(operationSchema, context, response) {
2376
+ const deserializer = this.deserializer;
2377
+ const ns = NormalizedSchema.of(operationSchema.output);
2378
+ const dataObject = {};
2379
+ if (response.statusCode >= 300) {
2380
+ const bytes = await collectBody(response.body, context);
2381
+ if (bytes.byteLength > 0) {
2382
+ Object.assign(dataObject, await deserializer.read(15, bytes));
2383
+ }
2384
+ await this.handleError(operationSchema, context, response, dataObject, this.deserializeMetadata(response));
2385
+ throw new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.");
2386
+ }
2387
+ for (const header in response.headers) {
2388
+ const value = response.headers[header];
2389
+ delete response.headers[header];
2390
+ response.headers[header.toLowerCase()] = value;
2391
+ }
2392
+ const nonHttpBindingMembers = await this.deserializeHttpMessage(ns, context, response, dataObject);
2393
+ if (nonHttpBindingMembers.length) {
2394
+ const bytes = await collectBody(response.body, context);
2395
+ if (bytes.byteLength > 0) {
2396
+ const dataFromBody = await deserializer.read(ns, bytes);
2397
+ for (const member2 of nonHttpBindingMembers) {
2398
+ if (dataFromBody[member2] != null) {
2399
+ dataObject[member2] = dataFromBody[member2];
2400
+ }
2401
+ }
2402
+ }
2403
+ } else if (nonHttpBindingMembers.discardResponseBody) {
2404
+ await collectBody(response.body, context);
2405
+ }
2406
+ dataObject.$metadata = this.deserializeMetadata(response);
2407
+ return dataObject;
2408
+ }
2409
+ async deserializeHttpMessage(schema, context, response, arg4, arg5) {
2410
+ let dataObject;
2411
+ if (arg4 instanceof Set) {
2412
+ dataObject = arg5;
2413
+ } else {
2414
+ dataObject = arg4;
2415
+ }
2416
+ let discardResponseBody = true;
2417
+ const deserializer = this.deserializer;
2418
+ const ns = NormalizedSchema.of(schema);
2419
+ const nonHttpBindingMembers = [];
2420
+ for (const [memberName, memberSchema] of ns.structIterator()) {
2421
+ const memberTraits = memberSchema.getMemberTraits();
2422
+ if (memberTraits.httpPayload) {
2423
+ discardResponseBody = false;
2424
+ const isStreaming = memberSchema.isStreaming();
2425
+ if (isStreaming) {
2426
+ const isEventStream = memberSchema.isStructSchema();
2427
+ if (isEventStream) {
2428
+ dataObject[memberName] = await this.deserializeEventStream({
2429
+ response,
2430
+ responseSchema: ns
2431
+ });
2432
+ } else {
2433
+ dataObject[memberName] = sdkStreamMixin(response.body);
2434
+ }
2435
+ } else if (response.body) {
2436
+ const bytes = await collectBody(response.body, context);
2437
+ if (bytes.byteLength > 0) {
2438
+ dataObject[memberName] = await deserializer.read(memberSchema, bytes);
2439
+ }
2440
+ }
2441
+ } else if (memberTraits.httpHeader) {
2442
+ const key = String(memberTraits.httpHeader).toLowerCase();
2443
+ const value = response.headers[key];
2444
+ if (null != value) {
2445
+ if (memberSchema.isListSchema()) {
2446
+ const headerListValueSchema = memberSchema.getValueSchema();
2447
+ headerListValueSchema.getMergedTraits().httpHeader = key;
2448
+ let sections;
2449
+ if (headerListValueSchema.isTimestampSchema() && headerListValueSchema.getSchema() === 4) {
2450
+ sections = splitEvery(value, ",", 2);
2451
+ } else {
2452
+ sections = splitHeader(value);
2453
+ }
2454
+ const list = [];
2455
+ for (const section of sections) {
2456
+ list.push(await deserializer.read(headerListValueSchema, section.trim()));
2457
+ }
2458
+ dataObject[memberName] = list;
2459
+ } else {
2460
+ dataObject[memberName] = await deserializer.read(memberSchema, value);
2461
+ }
2462
+ }
2463
+ } else if (memberTraits.httpPrefixHeaders !== void 0) {
2464
+ dataObject[memberName] = {};
2465
+ for (const header in response.headers) {
2466
+ if (header.startsWith(memberTraits.httpPrefixHeaders)) {
2467
+ const value = response.headers[header];
2468
+ const valueSchema = memberSchema.getValueSchema();
2469
+ valueSchema.getMergedTraits().httpHeader = header;
2470
+ dataObject[memberName][header.slice(memberTraits.httpPrefixHeaders.length)] = await deserializer.read(valueSchema, value);
2471
+ }
2472
+ }
2473
+ } else if (memberTraits.httpResponseCode) {
2474
+ dataObject[memberName] = response.statusCode;
2475
+ } else {
2476
+ nonHttpBindingMembers.push(memberName);
2477
+ }
2478
+ }
2479
+ nonHttpBindingMembers.discardResponseBody = discardResponseBody;
2480
+ return nonHttpBindingMembers;
2481
+ }
2482
+ };
2483
+
2484
+ // ../../node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js
2485
+ var RpcProtocol = class extends HttpProtocol {
2486
+ async serializeRequest(operationSchema, _input, context) {
2487
+ const serializer = this.serializer;
2488
+ const query = {};
2489
+ const headers = {};
2490
+ const endpoint = await context.endpoint();
2491
+ const ns = NormalizedSchema.of(operationSchema == null ? void 0 : operationSchema.input);
2492
+ const schema = ns.getSchema();
2493
+ let payload;
2494
+ const input = _input && typeof _input === "object" ? _input : {};
2495
+ const request = new HttpRequest({
2496
+ protocol: "",
2497
+ hostname: "",
2498
+ port: void 0,
2499
+ path: "/",
2500
+ fragment: void 0,
2501
+ query,
2502
+ headers,
2503
+ body: void 0
2504
+ });
2505
+ if (endpoint) {
2506
+ this.updateServiceEndpoint(request, endpoint);
2507
+ this.setHostPrefix(request, operationSchema, input);
2508
+ }
2509
+ if (input) {
2510
+ const eventStreamMember = ns.getEventStreamMember();
2511
+ if (eventStreamMember) {
2512
+ if (input[eventStreamMember]) {
2513
+ const initialRequest = {};
2514
+ for (const [memberName, memberSchema] of ns.structIterator()) {
2515
+ if (memberName !== eventStreamMember && input[memberName]) {
2516
+ serializer.write(memberSchema, input[memberName]);
2517
+ initialRequest[memberName] = serializer.flush();
2518
+ }
2519
+ }
2520
+ payload = await this.serializeEventStream({
2521
+ eventStream: input[eventStreamMember],
2522
+ requestSchema: ns,
2523
+ initialRequest
2524
+ });
2525
+ }
2526
+ } else {
2527
+ serializer.write(schema, input);
2528
+ payload = serializer.flush();
2529
+ }
2530
+ }
2531
+ request.headers = Object.assign(request.headers, headers);
2532
+ request.query = query;
2533
+ request.body = payload;
2534
+ request.method = "POST";
2535
+ return request;
2536
+ }
2537
+ async deserializeResponse(operationSchema, context, response) {
2538
+ const deserializer = this.deserializer;
2539
+ const ns = NormalizedSchema.of(operationSchema.output);
2540
+ const dataObject = {};
2541
+ if (response.statusCode >= 300) {
2542
+ const bytes = await collectBody(response.body, context);
2543
+ if (bytes.byteLength > 0) {
2544
+ Object.assign(dataObject, await deserializer.read(15, bytes));
2545
+ }
2546
+ await this.handleError(operationSchema, context, response, dataObject, this.deserializeMetadata(response));
2547
+ throw new Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.");
2548
+ }
2549
+ for (const header in response.headers) {
2550
+ const value = response.headers[header];
2551
+ delete response.headers[header];
2552
+ response.headers[header.toLowerCase()] = value;
2553
+ }
2554
+ const eventStreamMember = ns.getEventStreamMember();
2555
+ if (eventStreamMember) {
2556
+ dataObject[eventStreamMember] = await this.deserializeEventStream({
2557
+ response,
2558
+ responseSchema: ns,
2559
+ initialResponseContainer: dataObject
2560
+ });
2561
+ } else {
2562
+ const bytes = await collectBody(response.body, context);
2563
+ if (bytes.byteLength > 0) {
2564
+ Object.assign(dataObject, await deserializer.read(ns, bytes));
2565
+ }
2566
+ }
2567
+ dataObject.$metadata = this.deserializeMetadata(response);
2568
+ return dataObject;
2569
+ }
2570
+ };
2571
+
2572
+ // ../../node_modules/@smithy/core/dist-es/submodules/protocols/serde/determineTimestampFormat.js
2573
+ function determineTimestampFormat(ns, settings) {
2574
+ if (settings.timestampFormat.useTrait) {
2575
+ if (ns.isTimestampSchema() && (ns.getSchema() === 5 || ns.getSchema() === 6 || ns.getSchema() === 7)) {
2576
+ return ns.getSchema();
2577
+ }
2578
+ }
2579
+ const { httpLabel, httpPrefixHeaders, httpHeader, httpQuery } = ns.getMergedTraits();
2580
+ const bindingFormat = settings.httpBindings ? typeof httpPrefixHeaders === "string" || Boolean(httpHeader) ? 6 : Boolean(httpQuery) || Boolean(httpLabel) ? 5 : void 0 : void 0;
2581
+ return bindingFormat ?? settings.timestampFormat.default;
2582
+ }
2583
+
2584
+ // ../../node_modules/@smithy/core/dist-es/submodules/protocols/serde/FromStringShapeDeserializer.js
2585
+ var FromStringShapeDeserializer = class extends SerdeContext {
2586
+ settings;
2587
+ constructor(settings) {
2588
+ super();
2589
+ this.settings = settings;
2590
+ }
2591
+ read(_schema, data) {
2592
+ var _a;
2593
+ const ns = NormalizedSchema.of(_schema);
2594
+ if (ns.isListSchema()) {
2595
+ return splitHeader(data).map((item) => this.read(ns.getValueSchema(), item));
2596
+ }
2597
+ if (ns.isBlobSchema()) {
2598
+ return (((_a = this.serdeContext) == null ? void 0 : _a.base64Decoder) ?? fromBase64)(data);
2599
+ }
2600
+ if (ns.isTimestampSchema()) {
2601
+ const format = determineTimestampFormat(ns, this.settings);
2602
+ switch (format) {
2603
+ case 5:
2604
+ return _parseRfc3339DateTimeWithOffset(data);
2605
+ case 6:
2606
+ return _parseRfc7231DateTime(data);
2607
+ case 7:
2608
+ return _parseEpochTimestamp(data);
2609
+ default:
2610
+ console.warn("Missing timestamp format, parsing value with Date constructor:", data);
2611
+ return new Date(data);
2612
+ }
2613
+ }
2614
+ if (ns.isStringSchema()) {
2615
+ const mediaType = ns.getMergedTraits().mediaType;
2616
+ let intermediateValue = data;
2617
+ if (mediaType) {
2618
+ if (ns.getMergedTraits().httpHeader) {
2619
+ intermediateValue = this.base64ToUtf8(intermediateValue);
2620
+ }
2621
+ const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
2622
+ if (isJson) {
2623
+ intermediateValue = LazyJsonString.from(intermediateValue);
2624
+ }
2625
+ return intermediateValue;
2626
+ }
2627
+ }
2628
+ if (ns.isNumericSchema()) {
2629
+ return Number(data);
2630
+ }
2631
+ if (ns.isBigIntegerSchema()) {
2632
+ return BigInt(data);
2633
+ }
2634
+ if (ns.isBigDecimalSchema()) {
2635
+ return new NumericValue(data, "bigDecimal");
2636
+ }
2637
+ if (ns.isBooleanSchema()) {
2638
+ return String(data).toLowerCase() === "true";
2639
+ }
2640
+ return data;
2641
+ }
2642
+ base64ToUtf8(base64String) {
2643
+ var _a, _b;
2644
+ return (((_a = this.serdeContext) == null ? void 0 : _a.utf8Encoder) ?? toUtf8)((((_b = this.serdeContext) == null ? void 0 : _b.base64Decoder) ?? fromBase64)(base64String));
2645
+ }
2646
+ };
2647
+
2648
+ // ../../node_modules/@smithy/core/dist-es/submodules/protocols/serde/HttpInterceptingShapeDeserializer.js
2649
+ var HttpInterceptingShapeDeserializer = class extends SerdeContext {
2650
+ codecDeserializer;
2651
+ stringDeserializer;
2652
+ constructor(codecDeserializer, codecSettings) {
2653
+ super();
2654
+ this.codecDeserializer = codecDeserializer;
2655
+ this.stringDeserializer = new FromStringShapeDeserializer(codecSettings);
2656
+ }
2657
+ setSerdeContext(serdeContext) {
2658
+ this.stringDeserializer.setSerdeContext(serdeContext);
2659
+ this.codecDeserializer.setSerdeContext(serdeContext);
2660
+ this.serdeContext = serdeContext;
2661
+ }
2662
+ read(schema, data) {
2663
+ var _a, _b;
2664
+ const ns = NormalizedSchema.of(schema);
2665
+ const traits = ns.getMergedTraits();
2666
+ const toString = ((_a = this.serdeContext) == null ? void 0 : _a.utf8Encoder) ?? toUtf8;
2667
+ if (traits.httpHeader || traits.httpResponseCode) {
2668
+ return this.stringDeserializer.read(ns, toString(data));
2669
+ }
2670
+ if (traits.httpPayload) {
2671
+ if (ns.isBlobSchema()) {
2672
+ const toBytes = ((_b = this.serdeContext) == null ? void 0 : _b.utf8Decoder) ?? fromUtf8;
2673
+ if (typeof data === "string") {
2674
+ return toBytes(data);
2675
+ }
2676
+ return data;
2677
+ } else if (ns.isStringSchema()) {
2678
+ if ("byteLength" in data) {
2679
+ return toString(data);
2680
+ }
2681
+ return data;
2682
+ }
2683
+ }
2684
+ return this.codecDeserializer.read(ns, data);
2685
+ }
2686
+ };
2687
+
2688
+ // ../../node_modules/@smithy/core/dist-es/submodules/protocols/serde/ToStringShapeSerializer.js
2689
+ var ToStringShapeSerializer = class extends SerdeContext {
2690
+ settings;
2691
+ stringBuffer = "";
2692
+ constructor(settings) {
2693
+ super();
2694
+ this.settings = settings;
2695
+ }
2696
+ write(schema, value) {
2697
+ var _a, _b;
2698
+ const ns = NormalizedSchema.of(schema);
2699
+ switch (typeof value) {
2700
+ case "object":
2701
+ if (value === null) {
2702
+ this.stringBuffer = "null";
2703
+ return;
2704
+ }
2705
+ if (ns.isTimestampSchema()) {
2706
+ if (!(value instanceof Date)) {
2707
+ throw new Error(`@smithy/core/protocols - received non-Date value ${value} when schema expected Date in ${ns.getName(true)}`);
2708
+ }
2709
+ const format = determineTimestampFormat(ns, this.settings);
2710
+ switch (format) {
2711
+ case 5:
2712
+ this.stringBuffer = value.toISOString().replace(".000Z", "Z");
2713
+ break;
2714
+ case 6:
2715
+ this.stringBuffer = dateToUtcString(value);
2716
+ break;
2717
+ case 7:
2718
+ this.stringBuffer = String(value.getTime() / 1e3);
2719
+ break;
2720
+ default:
2721
+ console.warn("Missing timestamp format, using epoch seconds", value);
2722
+ this.stringBuffer = String(value.getTime() / 1e3);
2723
+ }
2724
+ return;
2725
+ }
2726
+ if (ns.isBlobSchema() && "byteLength" in value) {
2727
+ this.stringBuffer = (((_a = this.serdeContext) == null ? void 0 : _a.base64Encoder) ?? toBase64)(value);
2728
+ return;
2729
+ }
2730
+ if (ns.isListSchema() && Array.isArray(value)) {
2731
+ let buffer = "";
2732
+ for (const item of value) {
2733
+ this.write([ns.getValueSchema(), ns.getMergedTraits()], item);
2734
+ const headerItem = this.flush();
2735
+ const serialized = ns.getValueSchema().isTimestampSchema() ? headerItem : quoteHeader(headerItem);
2736
+ if (buffer !== "") {
2737
+ buffer += ", ";
2738
+ }
2739
+ buffer += serialized;
2740
+ }
2741
+ this.stringBuffer = buffer;
2742
+ return;
2743
+ }
2744
+ this.stringBuffer = JSON.stringify(value, null, 2);
2745
+ break;
2746
+ case "string":
2747
+ const mediaType = ns.getMergedTraits().mediaType;
2748
+ let intermediateValue = value;
2749
+ if (mediaType) {
2750
+ const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
2751
+ if (isJson) {
2752
+ intermediateValue = LazyJsonString.from(intermediateValue);
2753
+ }
2754
+ if (ns.getMergedTraits().httpHeader) {
2755
+ this.stringBuffer = (((_b = this.serdeContext) == null ? void 0 : _b.base64Encoder) ?? toBase64)(intermediateValue.toString());
2756
+ return;
2757
+ }
2758
+ }
2759
+ this.stringBuffer = value;
2760
+ break;
2761
+ default:
2762
+ if (ns.isIdempotencyToken()) {
2763
+ this.stringBuffer = generateIdempotencyToken();
2764
+ } else {
2765
+ this.stringBuffer = String(value);
2766
+ }
2767
+ }
2768
+ }
2769
+ flush() {
2770
+ const buffer = this.stringBuffer;
2771
+ this.stringBuffer = "";
2772
+ return buffer;
2773
+ }
2774
+ };
2775
+
2776
+ // ../../node_modules/@smithy/core/dist-es/submodules/protocols/serde/HttpInterceptingShapeSerializer.js
2777
+ var HttpInterceptingShapeSerializer = class {
2778
+ codecSerializer;
2779
+ stringSerializer;
2780
+ buffer;
2781
+ constructor(codecSerializer, codecSettings, stringSerializer = new ToStringShapeSerializer(codecSettings)) {
2782
+ this.codecSerializer = codecSerializer;
2783
+ this.stringSerializer = stringSerializer;
2784
+ }
2785
+ setSerdeContext(serdeContext) {
2786
+ this.codecSerializer.setSerdeContext(serdeContext);
2787
+ this.stringSerializer.setSerdeContext(serdeContext);
2788
+ }
2789
+ write(schema, value) {
2790
+ const ns = NormalizedSchema.of(schema);
2791
+ const traits = ns.getMergedTraits();
2792
+ if (traits.httpHeader || traits.httpLabel || traits.httpQuery) {
2793
+ this.stringSerializer.write(ns, value);
2794
+ this.buffer = this.stringSerializer.flush();
2795
+ return;
2796
+ }
2797
+ return this.codecSerializer.write(ns, value);
2798
+ }
2799
+ flush() {
2800
+ if (this.buffer !== void 0) {
2801
+ const buffer = this.buffer;
2802
+ this.buffer = void 0;
2803
+ return buffer;
2804
+ }
2805
+ return this.codecSerializer.flush();
2806
+ }
2807
+ };
2808
+
2809
+ // ../../node_modules/@smithy/core/dist-es/submodules/protocols/protocol-http/extensions/httpExtensionConfiguration.js
2810
+ var getHttpHandlerExtensionConfiguration = (runtimeConfig) => {
2811
+ return {
2812
+ setHttpHandler(handler) {
2813
+ runtimeConfig.httpHandler = handler;
2814
+ },
2815
+ httpHandler() {
2816
+ return runtimeConfig.httpHandler;
2817
+ },
2818
+ updateHttpClientConfig(key, value) {
2819
+ var _a;
2820
+ (_a = runtimeConfig.httpHandler) == null ? void 0 : _a.updateHttpClientConfig(key, value);
2821
+ },
2822
+ httpHandlerConfigs() {
2823
+ return runtimeConfig.httpHandler.httpHandlerConfigs();
2824
+ }
2825
+ };
2826
+ };
2827
+ var resolveHttpHandlerRuntimeConfig = (httpHandlerExtensionConfiguration) => {
2828
+ return {
2829
+ httpHandler: httpHandlerExtensionConfiguration.httpHandler()
2830
+ };
2831
+ };
2832
+
2833
+ // ../../node_modules/@smithy/core/dist-es/submodules/protocols/middleware-content-length/contentLengthMiddleware.js
2834
+ var CONTENT_LENGTH_HEADER = "content-length";
2835
+ function contentLengthMiddleware(bodyLengthChecker) {
2836
+ return (next) => async (args) => {
2837
+ const request = args.request;
2838
+ if (HttpRequest.isInstance(request)) {
2839
+ const { body, headers } = request;
2840
+ if (body && Object.keys(headers).map((str) => str.toLowerCase()).indexOf(CONTENT_LENGTH_HEADER) === -1) {
2841
+ try {
2842
+ const length = bodyLengthChecker(body);
2843
+ request.headers = {
2844
+ ...request.headers,
2845
+ [CONTENT_LENGTH_HEADER]: String(length)
2846
+ };
2847
+ } catch (error) {
2848
+ }
2849
+ }
2850
+ }
2851
+ return next({
2852
+ ...args,
2853
+ request
2854
+ });
2855
+ };
2856
+ }
2857
+ var contentLengthMiddlewareOptions = {
2858
+ step: "build",
2859
+ tags: ["SET_CONTENT_LENGTH", "CONTENT_LENGTH"],
2860
+ name: "contentLengthMiddleware",
2861
+ override: true
2862
+ };
2863
+ var getContentLengthPlugin = (options) => ({
2864
+ applyToStack: (clientStack) => {
2865
+ clientStack.add(contentLengthMiddleware(options.bodyLengthChecker), contentLengthMiddlewareOptions);
2866
+ }
2867
+ });
2868
+
2869
+ // ../../node_modules/@smithy/core/dist-es/submodules/protocols/util-uri-escape/escape-uri.js
2870
+ var escapeUri = (uri) => encodeURIComponent(uri).replace(/[!'()*]/g, hexEncode);
2871
+ var hexEncode = (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`;
2872
+
2873
+ // ../../node_modules/@smithy/core/dist-es/submodules/protocols/querystring-builder/buildQueryString.js
2874
+ function buildQueryString(query) {
2875
+ const parts = [];
2876
+ for (let key of Object.keys(query).sort()) {
2877
+ const value = query[key];
2878
+ key = escapeUri(key);
2879
+ if (Array.isArray(value)) {
2880
+ for (let i = 0, iLen = value.length; i < iLen; i++) {
2881
+ parts.push(`${key}=${escapeUri(value[i])}`);
2882
+ }
2883
+ } else {
2884
+ let qsEntry = key;
2885
+ if (value || typeof value === "string") {
2886
+ qsEntry += `=${escapeUri(value)}`;
2887
+ }
2888
+ parts.push(qsEntry);
2889
+ }
2890
+ }
2891
+ return parts.join("&");
2892
+ }
2893
+
2894
+ // ../../node_modules/@smithy/core/dist-es/submodules/protocols/querystring-parser/parseQueryString.js
2895
+ function parseQueryString(querystring) {
2896
+ const query = {};
2897
+ querystring = querystring.replace(/^\?/, "");
2898
+ if (querystring) {
2899
+ for (const pair of querystring.split("&")) {
2900
+ let [key, value = null] = pair.split("=");
2901
+ key = decodeURIComponent(key);
2902
+ if (value) {
2903
+ value = decodeURIComponent(value);
2904
+ }
2905
+ if (!(key in query)) {
2906
+ query[key] = value;
2907
+ } else if (Array.isArray(query[key])) {
2908
+ query[key].push(value);
2909
+ } else {
2910
+ query[key] = [query[key], value];
2911
+ }
2912
+ }
2913
+ }
2914
+ return query;
2915
+ }
2916
+
2917
+ // ../../node_modules/@smithy/core/dist-es/submodules/protocols/url-parser/parseUrl.js
2918
+ var parseUrl = (url) => {
2919
+ if (typeof url === "string") {
2920
+ return parseUrl(new URL(url));
2921
+ }
2922
+ const { hostname, pathname, port, protocol, search } = url;
2923
+ let query;
2924
+ if (search) {
2925
+ query = parseQueryString(search);
2926
+ }
2927
+ return {
2928
+ hostname,
2929
+ port: port ? parseInt(port) : void 0,
2930
+ protocol,
2931
+ path: pathname,
2932
+ query
2933
+ };
2934
+ };
2935
+
2936
+ // ../../node_modules/@smithy/core/dist-es/submodules/schema/schemas/translateTraits.js
2937
+ var traitsCache = [];
2938
+ function translateTraits(indicator) {
2939
+ if (typeof indicator === "object") {
2940
+ return indicator;
2941
+ }
2942
+ indicator = indicator | 0;
2943
+ if (traitsCache[indicator]) {
2944
+ return traitsCache[indicator];
2945
+ }
2946
+ const traits = {};
2947
+ let i = 0;
2948
+ for (const trait of [
2949
+ "httpLabel",
2950
+ "idempotent",
2951
+ "idempotencyToken",
2952
+ "sensitive",
2953
+ "httpPayload",
2954
+ "httpResponseCode",
2955
+ "httpQueryParams"
2956
+ ]) {
2957
+ if ((indicator >> i++ & 1) === 1) {
2958
+ traits[trait] = 1;
2959
+ }
2960
+ }
2961
+ return traitsCache[indicator] = traits;
2962
+ }
2963
+
2964
+ // ../../node_modules/@smithy/core/dist-es/submodules/schema/schemas/NormalizedSchema.js
2965
+ var anno = {
2966
+ it: /* @__PURE__ */ Symbol.for("@smithy/nor-struct-it"),
2967
+ ns: /* @__PURE__ */ Symbol.for("@smithy/ns")
2968
+ };
2969
+ var simpleSchemaCacheN = [];
2970
+ var simpleSchemaCacheS = {};
2971
+ var NormalizedSchema = class _NormalizedSchema {
2972
+ ref;
2973
+ memberName;
2974
+ static symbol = /* @__PURE__ */ Symbol.for("@smithy/nor");
2975
+ symbol = _NormalizedSchema.symbol;
2976
+ name;
2977
+ schema;
2978
+ _isMemberSchema;
2979
+ traits;
2980
+ memberTraits;
2981
+ normalizedTraits;
2982
+ constructor(ref, memberName) {
2983
+ this.ref = ref;
2984
+ this.memberName = memberName;
2985
+ const traitStack = [];
2986
+ let _ref = ref;
2987
+ let schema = ref;
2988
+ this._isMemberSchema = false;
2989
+ while (isMemberSchema(_ref)) {
2990
+ traitStack.push(_ref[1]);
2991
+ _ref = _ref[0];
2992
+ schema = deref(_ref);
2993
+ this._isMemberSchema = true;
2994
+ }
2995
+ if (traitStack.length > 0) {
2996
+ this.memberTraits = {};
2997
+ for (let i = traitStack.length - 1; i >= 0; --i) {
2998
+ const traitSet = traitStack[i];
2999
+ Object.assign(this.memberTraits, translateTraits(traitSet));
3000
+ }
3001
+ } else {
3002
+ this.memberTraits = 0;
3003
+ }
3004
+ if (schema instanceof _NormalizedSchema) {
3005
+ const computedMemberTraits = this.memberTraits;
3006
+ Object.assign(this, schema);
3007
+ this.memberTraits = Object.assign({}, computedMemberTraits, schema.getMemberTraits(), this.getMemberTraits());
3008
+ this.normalizedTraits = void 0;
3009
+ this.memberName = memberName ?? schema.memberName;
3010
+ return;
3011
+ }
3012
+ this.schema = deref(schema);
3013
+ if (isStaticSchema(this.schema)) {
3014
+ this.name = `${this.schema[1]}#${this.schema[2]}`;
3015
+ this.traits = this.schema[3];
3016
+ } else {
3017
+ this.name = this.memberName ?? String(schema);
3018
+ this.traits = 0;
3019
+ }
3020
+ if (this._isMemberSchema && !memberName) {
3021
+ throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(true)} missing member name.`);
3022
+ }
3023
+ }
3024
+ static [Symbol.hasInstance](lhs) {
3025
+ const isPrototype = this.prototype.isPrototypeOf(lhs);
3026
+ if (!isPrototype && typeof lhs === "object" && lhs !== null) {
3027
+ const ns = lhs;
3028
+ return ns.symbol === this.symbol;
3029
+ }
3030
+ return isPrototype;
3031
+ }
3032
+ static of(ref) {
3033
+ const keyAble = typeof ref === "function" || typeof ref === "object" && ref !== null;
3034
+ if (typeof ref === "number") {
3035
+ if (simpleSchemaCacheN[ref]) {
3036
+ return simpleSchemaCacheN[ref];
3037
+ }
3038
+ } else if (typeof ref === "string") {
3039
+ if (simpleSchemaCacheS[ref]) {
3040
+ return simpleSchemaCacheS[ref];
3041
+ }
3042
+ } else if (keyAble) {
3043
+ if (ref[anno.ns]) {
3044
+ return ref[anno.ns];
3045
+ }
3046
+ }
3047
+ const sc = deref(ref);
3048
+ if (sc instanceof _NormalizedSchema) {
3049
+ return sc;
3050
+ }
3051
+ if (isMemberSchema(sc)) {
3052
+ const [ns2, traits] = sc;
3053
+ if (ns2 instanceof _NormalizedSchema) {
3054
+ Object.assign(ns2.getMergedTraits(), translateTraits(traits));
3055
+ return ns2;
3056
+ }
3057
+ throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(ref, null, 2)}.`);
3058
+ }
3059
+ const ns = new _NormalizedSchema(sc);
3060
+ if (keyAble) {
3061
+ return ref[anno.ns] = ns;
3062
+ }
3063
+ if (typeof sc === "string") {
3064
+ return simpleSchemaCacheS[sc] = ns;
3065
+ }
3066
+ if (typeof sc === "number") {
3067
+ return simpleSchemaCacheN[sc] = ns;
3068
+ }
3069
+ return ns;
3070
+ }
3071
+ getSchema() {
3072
+ const sc = this.schema;
3073
+ if (Array.isArray(sc) && sc[0] === 0) {
3074
+ return sc[4];
3075
+ }
3076
+ return sc;
3077
+ }
3078
+ getName(withNamespace = false) {
3079
+ const { name } = this;
3080
+ const short = !withNamespace && name && name.includes("#");
3081
+ return short ? name.split("#")[1] : name || void 0;
3082
+ }
3083
+ getMemberName() {
3084
+ return this.memberName;
3085
+ }
3086
+ isMemberSchema() {
3087
+ return this._isMemberSchema;
3088
+ }
3089
+ isListSchema() {
3090
+ const sc = this.getSchema();
3091
+ return typeof sc === "number" ? sc >= 64 && sc < 128 : sc[0] === 1;
3092
+ }
3093
+ isMapSchema() {
3094
+ const sc = this.getSchema();
3095
+ return typeof sc === "number" ? sc >= 128 && sc <= 255 : sc[0] === 2;
3096
+ }
3097
+ isStructSchema() {
3098
+ const sc = this.getSchema();
3099
+ if (typeof sc !== "object") {
3100
+ return false;
3101
+ }
3102
+ const id = sc[0];
3103
+ return id === 3 || id === -3 || id === 4;
3104
+ }
3105
+ isUnionSchema() {
3106
+ const sc = this.getSchema();
3107
+ if (typeof sc !== "object") {
3108
+ return false;
3109
+ }
3110
+ return sc[0] === 4;
3111
+ }
3112
+ isBlobSchema() {
3113
+ const sc = this.getSchema();
3114
+ return sc === 21 || sc === 42;
3115
+ }
3116
+ isTimestampSchema() {
3117
+ const sc = this.getSchema();
3118
+ return typeof sc === "number" && sc >= 4 && sc <= 7;
3119
+ }
3120
+ isUnitSchema() {
3121
+ return this.getSchema() === "unit";
3122
+ }
3123
+ isDocumentSchema() {
3124
+ return this.getSchema() === 15;
3125
+ }
3126
+ isStringSchema() {
3127
+ return this.getSchema() === 0;
3128
+ }
3129
+ isBooleanSchema() {
3130
+ return this.getSchema() === 2;
3131
+ }
3132
+ isNumericSchema() {
3133
+ return this.getSchema() === 1;
3134
+ }
3135
+ isBigIntegerSchema() {
3136
+ return this.getSchema() === 17;
3137
+ }
3138
+ isBigDecimalSchema() {
3139
+ return this.getSchema() === 19;
3140
+ }
3141
+ isStreaming() {
3142
+ const { streaming } = this.getMergedTraits();
3143
+ return !!streaming || this.getSchema() === 42;
3144
+ }
3145
+ isIdempotencyToken() {
3146
+ return !!this.getMergedTraits().idempotencyToken;
3147
+ }
3148
+ getMergedTraits() {
3149
+ return this.normalizedTraits ?? (this.normalizedTraits = {
3150
+ ...this.getOwnTraits(),
3151
+ ...this.getMemberTraits()
3152
+ });
3153
+ }
3154
+ getMemberTraits() {
3155
+ return translateTraits(this.memberTraits);
3156
+ }
3157
+ getOwnTraits() {
3158
+ return translateTraits(this.traits);
3159
+ }
3160
+ getKeySchema() {
3161
+ const [isDoc, isMap] = [this.isDocumentSchema(), this.isMapSchema()];
3162
+ if (!isDoc && !isMap) {
3163
+ throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(true)}`);
3164
+ }
3165
+ const schema = this.getSchema();
3166
+ const memberSchema = isDoc ? 15 : schema[4] ?? 0;
3167
+ return member([memberSchema, 0], "key");
3168
+ }
3169
+ getValueSchema() {
3170
+ const sc = this.getSchema();
3171
+ const [isDoc, isMap, isList] = [this.isDocumentSchema(), this.isMapSchema(), this.isListSchema()];
3172
+ const memberSchema = typeof sc === "number" ? 63 & sc : sc && typeof sc === "object" && (isMap || isList) ? sc[3 + sc[0]] : isDoc ? 15 : void 0;
3173
+ if (memberSchema != null) {
3174
+ return member([memberSchema, 0], isMap ? "value" : "member");
3175
+ }
3176
+ throw new Error(`@smithy/core/schema - ${this.getName(true)} has no value member.`);
3177
+ }
3178
+ getMemberSchema(memberName) {
3179
+ const struct = this.getSchema();
3180
+ if (this.isStructSchema() && struct[4].includes(memberName)) {
3181
+ const i = struct[4].indexOf(memberName);
3182
+ const memberSchema = struct[5][i];
3183
+ return member(isMemberSchema(memberSchema) ? memberSchema : [memberSchema, 0], memberName);
3184
+ }
3185
+ if (this.isDocumentSchema()) {
3186
+ return member([15, 0], memberName);
3187
+ }
3188
+ throw new Error(`@smithy/core/schema - ${this.getName(true)} has no member=${memberName}.`);
3189
+ }
3190
+ getMemberSchemas() {
3191
+ const buffer = {};
3192
+ try {
3193
+ for (const [k, v] of this.structIterator()) {
3194
+ buffer[k] = v;
3195
+ }
3196
+ } catch (ignored) {
3197
+ }
3198
+ return buffer;
3199
+ }
3200
+ getEventStreamMember() {
3201
+ if (this.isStructSchema()) {
3202
+ for (const [memberName, memberSchema] of this.structIterator()) {
3203
+ if (memberSchema.isStreaming() && memberSchema.isStructSchema()) {
3204
+ return memberName;
3205
+ }
3206
+ }
3207
+ }
3208
+ return "";
3209
+ }
3210
+ *structIterator() {
3211
+ if (this.isUnitSchema()) {
3212
+ return;
3213
+ }
3214
+ if (!this.isStructSchema()) {
3215
+ throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");
3216
+ }
3217
+ const struct = this.getSchema();
3218
+ const z = struct[4].length;
3219
+ let it = struct[anno.it];
3220
+ if (it && z === it.length) {
3221
+ yield* it;
3222
+ return;
3223
+ }
3224
+ it = Array(z);
3225
+ for (let i = 0; i < z; ++i) {
3226
+ const k = struct[4][i];
3227
+ const v = member([struct[5][i], 0], k);
3228
+ yield it[i] = [k, v];
3229
+ }
3230
+ struct[anno.it] = it;
3231
+ }
3232
+ };
3233
+ function member(memberSchema, memberName) {
3234
+ if (memberSchema instanceof NormalizedSchema) {
3235
+ return Object.assign(memberSchema, {
3236
+ memberName,
3237
+ _isMemberSchema: true
3238
+ });
3239
+ }
3240
+ const internalCtorAccess = NormalizedSchema;
3241
+ return new internalCtorAccess(memberSchema, memberName);
3242
+ }
3243
+ var isMemberSchema = (sc) => Array.isArray(sc) && sc.length === 2;
3244
+ var isStaticSchema = (sc) => Array.isArray(sc) && sc.length >= 5;
3245
+
3246
+ // ../../node_modules/@smithy/core/dist-es/submodules/schema/TypeRegistry.js
3247
+ var TypeRegistry = class _TypeRegistry {
3248
+ namespace;
3249
+ schemas;
3250
+ exceptions;
3251
+ static registries = /* @__PURE__ */ new Map();
3252
+ constructor(namespace, schemas = /* @__PURE__ */ new Map(), exceptions = /* @__PURE__ */ new Map()) {
3253
+ this.namespace = namespace;
3254
+ this.schemas = schemas;
3255
+ this.exceptions = exceptions;
3256
+ }
3257
+ static for(namespace) {
3258
+ if (!_TypeRegistry.registries.has(namespace)) {
3259
+ _TypeRegistry.registries.set(namespace, new _TypeRegistry(namespace));
3260
+ }
3261
+ return _TypeRegistry.registries.get(namespace);
3262
+ }
3263
+ copyFrom(other) {
3264
+ const { schemas, exceptions } = this;
3265
+ for (const [k, v] of other.schemas) {
3266
+ if (!schemas.has(k)) {
3267
+ schemas.set(k, v);
3268
+ }
3269
+ }
3270
+ for (const [k, v] of other.exceptions) {
3271
+ if (!exceptions.has(k)) {
3272
+ exceptions.set(k, v);
3273
+ }
3274
+ }
3275
+ }
3276
+ register(shapeId, schema) {
3277
+ const qualifiedName = this.normalizeShapeId(shapeId);
3278
+ for (const r of [this, _TypeRegistry.for(qualifiedName.split("#")[0])]) {
3279
+ r.schemas.set(qualifiedName, schema);
3280
+ }
3281
+ }
3282
+ getSchema(shapeId) {
3283
+ const id = this.normalizeShapeId(shapeId);
3284
+ if (!this.schemas.has(id)) {
3285
+ if (!shapeId.includes("#")) {
3286
+ const suffix = "#" + shapeId;
3287
+ const candidates = [];
3288
+ for (const [shapeId2, schema] of this.schemas.entries()) {
3289
+ if (shapeId2.endsWith(suffix)) {
3290
+ candidates.push(schema);
3291
+ }
3292
+ }
3293
+ if (candidates.length === 1) {
3294
+ return candidates[0];
3295
+ }
3296
+ }
3297
+ throw new Error(`@smithy/core/schema - schema not found for ${id}`);
3298
+ }
3299
+ return this.schemas.get(id);
3300
+ }
3301
+ registerError(es, ctor) {
3302
+ const $error = es;
3303
+ const ns = $error[1];
3304
+ for (const r of [this, _TypeRegistry.for(ns)]) {
3305
+ r.schemas.set(ns + "#" + $error[2], $error);
3306
+ r.exceptions.set($error, ctor);
3307
+ }
3308
+ }
3309
+ getErrorCtor(es) {
3310
+ const $error = es;
3311
+ if (this.exceptions.has($error)) {
3312
+ return this.exceptions.get($error);
3313
+ }
3314
+ const registry = _TypeRegistry.for($error[1]);
3315
+ return registry.exceptions.get($error);
3316
+ }
3317
+ getBaseException() {
3318
+ for (const exceptionKey of this.exceptions.keys()) {
3319
+ if (Array.isArray(exceptionKey)) {
3320
+ const [, ns, name] = exceptionKey;
3321
+ const id = ns + "#" + name;
3322
+ if (id.startsWith("smithy.ts.sdk.synthetic.") && id.endsWith("ServiceException")) {
3323
+ return exceptionKey;
3324
+ }
3325
+ }
3326
+ }
3327
+ return void 0;
3328
+ }
3329
+ find(predicate) {
3330
+ for (const schema of this.schemas.values()) {
3331
+ if (predicate(schema)) {
3332
+ return schema;
3333
+ }
3334
+ }
3335
+ return void 0;
3336
+ }
3337
+ clear() {
3338
+ this.schemas.clear();
3339
+ this.exceptions.clear();
3340
+ }
3341
+ normalizeShapeId(shapeId) {
3342
+ if (shapeId.includes("#")) {
3343
+ return shapeId;
3344
+ }
3345
+ return this.namespace + "#" + shapeId;
3346
+ }
3347
+ };
3348
+
3349
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/smithy-client/schemaLogFilter.js
3350
+ var SENSITIVE_STRING = "***SensitiveInformation***";
3351
+ function schemaLogFilter(schema, data) {
3352
+ if (data == null) {
3353
+ return data;
3354
+ }
3355
+ const ns = NormalizedSchema.of(schema);
3356
+ if (ns.getMergedTraits().sensitive) {
3357
+ return SENSITIVE_STRING;
3358
+ }
3359
+ if (ns.isListSchema()) {
3360
+ const isSensitive = !!ns.getValueSchema().getMergedTraits().sensitive;
3361
+ if (isSensitive) {
3362
+ return SENSITIVE_STRING;
3363
+ }
3364
+ } else if (ns.isMapSchema()) {
3365
+ const isSensitive = !!ns.getKeySchema().getMergedTraits().sensitive || !!ns.getValueSchema().getMergedTraits().sensitive;
3366
+ if (isSensitive) {
3367
+ return SENSITIVE_STRING;
3368
+ }
3369
+ } else if (ns.isStructSchema() && typeof data === "object") {
3370
+ const object = data;
3371
+ const newObject = {};
3372
+ for (const [member2, memberNs] of ns.structIterator()) {
3373
+ if (object[member2] != null) {
3374
+ newObject[member2] = schemaLogFilter(memberNs, object[member2]);
3375
+ }
3376
+ }
3377
+ return newObject;
3378
+ }
3379
+ return data;
3380
+ }
3381
+
3382
+ // ../../node_modules/@smithy/core/dist-es/submodules/client/smithy-client/command.js
3383
+ var Command = class {
3384
+ middlewareStack = constructStack();
3385
+ schema;
3386
+ static classBuilder() {
3387
+ return new ClassBuilder();
3388
+ }
3389
+ resolveMiddlewareWithContext(clientStack, configuration, options, { middlewareFn, clientName, commandName, inputFilterSensitiveLog, outputFilterSensitiveLog, smithyContext, additionalContext, CommandCtor }) {
3390
+ for (const mw of middlewareFn.bind(this)(CommandCtor, clientStack, configuration, options)) {
3391
+ this.middlewareStack.use(mw);
3392
+ }
3393
+ const stack = clientStack.concat(this.middlewareStack);
3394
+ const { logger } = configuration;
3395
+ const handlerExecutionContext = {
3396
+ logger,
3397
+ clientName,
3398
+ commandName,
3399
+ inputFilterSensitiveLog,
3400
+ outputFilterSensitiveLog,
3401
+ [SMITHY_CONTEXT_KEY]: {
3402
+ commandInstance: this,
3403
+ ...smithyContext
3404
+ },
3405
+ ...additionalContext
3406
+ };
3407
+ const { requestHandler } = configuration;
3408
+ let requestOptions = options ?? {};
3409
+ if (smithyContext.eventStream) {
3410
+ requestOptions = {
3411
+ isEventStream: true,
3412
+ ...requestOptions
3413
+ };
3414
+ }
3415
+ return stack.resolve((request) => requestHandler.handle(request.request, requestOptions), handlerExecutionContext);
3416
+ }
3417
+ };
3418
+ var ClassBuilder = class {
3419
+ _init = () => {
3420
+ };
3421
+ _ep = {};
3422
+ _middlewareFn = () => [];
3423
+ _commandName = "";
3424
+ _clientName = "";
3425
+ _additionalContext = {};
3426
+ _smithyContext = {};
3427
+ _inputFilterSensitiveLog = void 0;
3428
+ _outputFilterSensitiveLog = void 0;
3429
+ _serializer = null;
3430
+ _deserializer = null;
3431
+ _operationSchema;
3432
+ init(cb) {
3433
+ this._init = cb;
3434
+ }
3435
+ ep(endpointParameterInstructions) {
3436
+ this._ep = endpointParameterInstructions;
3437
+ return this;
3438
+ }
3439
+ m(middlewareSupplier) {
3440
+ this._middlewareFn = middlewareSupplier;
3441
+ return this;
3442
+ }
3443
+ s(service, operation, smithyContext = {}) {
3444
+ this._smithyContext = {
3445
+ service,
3446
+ operation,
3447
+ ...smithyContext
3448
+ };
3449
+ return this;
3450
+ }
3451
+ c(additionalContext = {}) {
3452
+ this._additionalContext = additionalContext;
3453
+ return this;
3454
+ }
3455
+ n(clientName, commandName) {
3456
+ this._clientName = clientName;
3457
+ this._commandName = commandName;
3458
+ return this;
3459
+ }
3460
+ f(inputFilter = (_) => _, outputFilter = (_) => _) {
3461
+ this._inputFilterSensitiveLog = inputFilter;
3462
+ this._outputFilterSensitiveLog = outputFilter;
3463
+ return this;
3464
+ }
3465
+ ser(serializer) {
3466
+ this._serializer = serializer;
3467
+ return this;
3468
+ }
3469
+ de(deserializer) {
3470
+ this._deserializer = deserializer;
3471
+ return this;
3472
+ }
3473
+ sc(operation) {
3474
+ this._operationSchema = operation;
3475
+ this._smithyContext.operationSchema = operation;
3476
+ return this;
3477
+ }
3478
+ build() {
3479
+ const closure = this;
3480
+ let CommandRef;
3481
+ return CommandRef = class extends Command {
3482
+ input;
3483
+ static getEndpointParameterInstructions() {
3484
+ return closure._ep;
3485
+ }
3486
+ constructor(...[input]) {
3487
+ super();
3488
+ this.input = input ?? {};
3489
+ closure._init(this);
3490
+ this.schema = closure._operationSchema;
3491
+ }
3492
+ resolveMiddleware(stack, configuration, options) {
3493
+ const op = closure._operationSchema;
3494
+ const input = (op == null ? void 0 : op[4]) ?? (op == null ? void 0 : op.input);
3495
+ const output = (op == null ? void 0 : op[5]) ?? (op == null ? void 0 : op.output);
3496
+ return this.resolveMiddlewareWithContext(stack, configuration, options, {
3497
+ CommandCtor: CommandRef,
3498
+ middlewareFn: closure._middlewareFn,
3499
+ clientName: closure._clientName,
3500
+ commandName: closure._commandName,
3501
+ inputFilterSensitiveLog: closure._inputFilterSensitiveLog ?? (op ? schemaLogFilter.bind(null, input) : (_) => _),
3502
+ outputFilterSensitiveLog: closure._outputFilterSensitiveLog ?? (op ? schemaLogFilter.bind(null, output) : (_) => _),
3503
+ smithyContext: closure._smithyContext,
3504
+ additionalContext: closure._additionalContext
3505
+ });
3506
+ }
3507
+ serialize = closure._serializer;
3508
+ deserialize = closure._deserializer;
3509
+ };
3510
+ }
3511
+ };
3512
+
3513
+ export {
3514
+ ProviderError,
3515
+ CredentialsProviderError,
3516
+ TokenProviderError,
3517
+ chain,
3518
+ booleanSelector,
3519
+ SelectorType,
3520
+ ENV_PROFILE,
3521
+ getProfileName,
3522
+ getSSOTokenFilepath,
3523
+ getSSOTokenFromFile,
3524
+ readFile2 as readFile,
3525
+ loadSsoSessionData,
3526
+ parseKnownFiles,
3527
+ externalDataInterceptor,
3528
+ loadConfig,
3529
+ NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS,
3530
+ NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS,
3531
+ getSmithyContext,
3532
+ normalizeProvider,
3533
+ Client,
3534
+ deref,
3535
+ NormalizedSchema,
3536
+ TypeRegistry,
3537
+ Command,
3538
+ createAggregatedClient,
3539
+ ServiceException,
3540
+ decorateServiceException,
3541
+ loadConfigsForDefaultMode,
3542
+ emitWarningIfUnsupportedVersion,
3543
+ getDefaultExtensionConfiguration,
3544
+ resolveDefaultRuntimeConfig,
3545
+ getValueFromTextNode,
3546
+ NoOpLogger,
3547
+ NODE_REGION_CONFIG_OPTIONS,
3548
+ NODE_REGION_CONFIG_FILE_OPTIONS,
3549
+ resolveRegionConfig,
3550
+ resolveDefaultsModeConfig,
3551
+ toEndpointV1,
3552
+ resolveParams,
3553
+ BinaryDecisionDiagram,
3554
+ EndpointCache,
3555
+ customEndpointFunctions,
3556
+ isValidHostLabel,
3557
+ isIpAddress,
3558
+ decideEndpoint,
3559
+ getEndpointFromInstructions,
3560
+ resolveEndpointConfig,
3561
+ getEndpointPlugin,
3562
+ collectBody,
3563
+ extendedEncodeURIComponent,
3564
+ HttpRequest,
3565
+ HttpResponse,
3566
+ HttpBindingProtocol,
3567
+ RpcProtocol,
3568
+ determineTimestampFormat,
3569
+ FromStringShapeDeserializer,
3570
+ HttpInterceptingShapeDeserializer,
3571
+ HttpInterceptingShapeSerializer,
3572
+ getHttpHandlerExtensionConfiguration,
3573
+ resolveHttpHandlerRuntimeConfig,
3574
+ getContentLengthPlugin,
3575
+ escapeUri,
3576
+ buildQueryString,
3577
+ parseUrl
3578
+ };