@granite-js/pulumi-aws 0.1.34 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CHANGELOG.md +4 -116
  2. package/dist/chunk-23MVQUOJ.js +1630 -0
  3. package/dist/chunk-24XYHOWM.js +171 -0
  4. package/dist/chunk-3AVBP57V.js +1598 -0
  5. package/dist/chunk-3JKQPIJ2.js +460 -0
  6. package/dist/{chunk-ITI6QA2Q.js → chunk-3OYGHA4S.js} +1 -1
  7. package/dist/{chunk-IEZY5C3G.js → chunk-46DIC54Q.js} +49 -37
  8. package/dist/chunk-57WYIP4I.js +808 -0
  9. package/dist/{chunk-WCHHWTND.js → chunk-63Q3RLAK.js} +93 -59
  10. package/dist/chunk-6KRYZP6R.js +28 -0
  11. package/dist/{chunk-QAE2S7MG.js → chunk-7NN7DVGK.js} +2050 -552
  12. package/dist/{chunk-5W7B34BN.js → chunk-ASGFIK4A.js} +2231 -464
  13. package/dist/chunk-BTBQTDRJ.js +174 -0
  14. package/dist/chunk-DDZTWBHZ.js +154 -0
  15. package/dist/chunk-G3FWLTNJ.js +10 -0
  16. package/dist/{chunk-TJ744C2T.js → chunk-GJFKL6XM.js} +43 -38
  17. package/dist/chunk-H4QJ5O4E.js +36 -0
  18. package/dist/{chunk-X6XO7USX.js → chunk-LCO5F3JB.js} +109 -56
  19. package/dist/chunk-NDDYFDCU.js +60 -0
  20. package/dist/chunk-OCHPLE5N.js +28 -0
  21. package/dist/chunk-OSJA4YYQ.js +846 -0
  22. package/dist/chunk-PIT3K3NC.js +464 -0
  23. package/dist/chunk-QCKAO4UT.js +476 -0
  24. package/dist/{chunk-64IS37V6.js → chunk-RYIGWCGK.js} +1 -6
  25. package/dist/chunk-S4LJWEXU.js +37 -0
  26. package/dist/chunk-SJ26Y3GW.js +472 -0
  27. package/dist/chunk-TDZTH7TL.js +60 -0
  28. package/dist/chunk-THUA35UY.js +35 -0
  29. package/dist/{chunk-IUKLHJNE.js → chunk-V7TRGEV6.js} +4 -7
  30. package/dist/{chunk-KGNTV362.js → chunk-WDFKVCPC.js} +66 -34
  31. package/dist/{chunk-B7OAPHPY.js → chunk-YWWEFWFD.js} +3 -3
  32. package/dist/chunk-Z4UYYQ4J.js +42 -0
  33. package/dist/chunk-ZBT5SDIQ.js +16528 -0
  34. package/dist/chunk-ZIHRRTTA.js +24 -0
  35. package/dist/{dist-es-CDFIYJVE.js → dist-es-3VZ2IGGJ.js} +18 -15
  36. package/dist/{dist-es-SUPEA6VE-3B5JSW5C.js → dist-es-BQW4ETQH-C7ZSD5EG.js} +8 -25
  37. package/dist/{dist-es-GHYMLBON.js → dist-es-HSWXMGNC.js} +21 -21
  38. package/dist/{dist-es-OCQVKISC-TNAJ62WG.js → dist-es-IDBNBAO5-H3TO63FG.js} +15 -18
  39. package/dist/{dist-es-S75EKWRJ.js → dist-es-KPJNIAPT.js} +9 -10
  40. package/dist/{dist-es-PRWCVZGQ-HTTVI42T.js → dist-es-LZDRG6RP-SP2FWWEO.js} +3 -4
  41. package/dist/{dist-es-OZGLUDWT.js → dist-es-PIWY5TOR.js} +49 -26
  42. package/dist/{dist-es-ADTONJUN-RVFWNZHO.js → dist-es-R4LD2OHZ-B5MB6BR2.js} +11 -13
  43. package/dist/dist-es-S2KJK4L2-5GDBXJIO.js +470 -0
  44. package/dist/{dist-es-XQME5F6W.js → dist-es-THYWPEKB.js} +12 -10
  45. package/dist/{dist-es-HJVOMDYC-PIAMWMAL.js → dist-es-TIYLKN6W-BAHZRZH5.js} +7 -13
  46. package/dist/{dist-es-IDBDK36G-Y6TQMRO5.js → dist-es-VORPMM2F-WOMP2FYQ.js} +37 -30
  47. package/dist/{dist-es-WQHDOVD7.js → dist-es-WESJCADT.js} +3 -4
  48. package/dist/dist-es-XMOG24OT.js +490 -0
  49. package/dist/event-streams-L7RH32OW-AFMBEYJJ.js +237 -0
  50. package/dist/event-streams-NGUY2RWE.js +237 -0
  51. package/dist/index.cjs +2 -2
  52. package/dist/index.js +2 -2
  53. package/dist/lambda/auto-cache-removal.cjs +28894 -16488
  54. package/dist/lambda/auto-cache-removal.js +11574 -2713
  55. package/dist/lambda/origin-request.cjs +22351 -17619
  56. package/dist/lambda/origin-request.js +21 -17
  57. package/dist/lambda/origin-response.cjs +22219 -17387
  58. package/dist/lambda/origin-response.js +17 -13
  59. package/dist/{loadSso-CZSSLFH6-SA5HOQAX.js → loadSso-F4PTCHDN-YR3RRUYW.js} +330 -227
  60. package/dist/{loadSso-T7GJVVO2.js → loadSso-LG7MFP7N.js} +344 -223
  61. package/dist/signin-P7DNG43W.js +658 -0
  62. package/dist/signin-XWTOVLF3-4ENWNEF7.js +630 -0
  63. package/dist/{sso-oidc-PKO5GYK5-LC65L46O.js → sso-oidc-FQQGUOJL.js} +293 -332
  64. package/dist/{sso-oidc-55SJ27II.js → sso-oidc-RRDYLOJY-FK3AUTOI.js} +263 -337
  65. package/dist/{sts-OPF4H3GL.js → sts-7FBOVTCN.js} +674 -601
  66. package/dist/{sts-P7Q3MYTS-BKGWHQE4.js → sts-TBWJ374A-DHXXCVJJ.js} +651 -608
  67. package/package.json +5 -5
  68. package/dist/chunk-AEOST5WF.js +0 -63
  69. package/dist/chunk-FO7L563E.js +0 -13695
  70. package/dist/chunk-FRWSD3YQ.js +0 -1722
  71. package/dist/chunk-JBVMOFGH.js +0 -152
  72. package/dist/chunk-JSBRDJBE.js +0 -30
  73. package/dist/chunk-KRJS4RAS.js +0 -1732
  74. package/dist/chunk-M5GUUX64.js +0 -63
  75. package/dist/chunk-SX6SVQKS.js +0 -67
  76. package/dist/chunk-UNXXS5FM.js +0 -120
  77. package/dist/chunk-UT2RMOJS.js +0 -2447
  78. package/dist/chunk-VOTRVWIB.js +0 -1965
  79. package/dist/chunk-W3VXP3A3.js +0 -119
  80. package/dist/chunk-XLUI7RQ4.js +0 -115
  81. package/dist/dist-es-2M7RLZ5O.js +0 -200
  82. package/dist/dist-es-Y7VN37H5-WQ3GYROF.js +0 -196
@@ -1,148 +1,421 @@
1
1
  import {
2
2
  loadConfig,
3
+ memoize,
3
4
  parseUrl
4
- } from "./chunk-X6XO7USX.js";
5
+ } from "./chunk-63Q3RLAK.js";
6
+ import {
7
+ CONFIG_PREFIX_SEPARATOR
8
+ } from "./chunk-GJFKL6XM.js";
5
9
  import {
6
- HttpRequest,
7
10
  HttpResponse,
8
- NoOpLogger,
9
- collectBody,
10
11
  escapeUri,
11
- fromArrayBuffer,
12
+ fromBase64,
12
13
  fromHex,
13
- fromString,
14
- fromUtf8,
15
- isArrayBuffer,
16
- toHex,
17
- toUint8Array
18
- } from "./chunk-UT2RMOJS.js";
14
+ toBase64,
15
+ toHex
16
+ } from "./chunk-57WYIP4I.js";
19
17
  import {
20
- CONFIG_PREFIX_SEPARATOR
21
- } from "./chunk-TJ744C2T.js";
18
+ HttpRequest
19
+ } from "./chunk-TDZTH7TL.js";
22
20
  import {
23
21
  setCredentialFeature
24
- } from "./chunk-64IS37V6.js";
22
+ } from "./chunk-RYIGWCGK.js";
25
23
  import {
26
- EndpointURLScheme,
27
- SMITHY_CONTEXT_KEY
28
- } from "./chunk-XLUI7RQ4.js";
24
+ fromArrayBuffer,
25
+ fromString,
26
+ fromUtf8,
27
+ isArrayBuffer,
28
+ toUtf8
29
+ } from "./chunk-H4QJ5O4E.js";
29
30
  import {
30
- ProviderError,
31
- init_esm_shims,
32
- memoize
33
- } from "./chunk-JBVMOFGH.js";
31
+ ProviderError
32
+ } from "./chunk-THUA35UY.js";
34
33
 
35
- // ../deployment-manager/dist/chunk-N74WAUXR.js
36
- import crypto from "crypto";
34
+ // ../deployment-manager/dist/chunk-IF7J7OTC.js
37
35
  import crypto2 from "crypto";
38
36
  import { Readable } from "stream";
39
37
  import { platform, release } from "os";
40
38
  import { env, versions } from "process";
41
39
  import { Buffer as Buffer2 } from "buffer";
42
40
  import { createHash, createHmac } from "crypto";
43
- import { fstatSync, lstatSync } from "fs";
44
- init_esm_shims();
45
- init_esm_shims();
46
- init_esm_shims();
47
- init_esm_shims();
48
- var getSmithyContext = (context) => context[SMITHY_CONTEXT_KEY] || (context[SMITHY_CONTEXT_KEY] = {});
49
- init_esm_shims();
50
- var normalizeProvider = (input) => {
51
- if (typeof input === "function")
52
- return input;
53
- const promisified = Promise.resolve(input);
54
- return () => promisified;
55
- };
56
- init_esm_shims();
57
- var resolveAuthOptions = (candidateAuthOptions, authSchemePreference) => {
58
- if (!authSchemePreference || authSchemePreference.length === 0) {
59
- return candidateAuthOptions;
60
- }
61
- const preferredAuthOptions = [];
62
- for (const preferredSchemeName of authSchemePreference) {
63
- for (const candidateAuthOption of candidateAuthOptions) {
64
- const candidateAuthSchemeName = candidateAuthOption.schemeId.split("#")[1];
65
- if (candidateAuthSchemeName === preferredSchemeName) {
66
- preferredAuthOptions.push(candidateAuthOption);
67
- }
41
+ import { fstatSync, lstatSync, ReadStream } from "fs";
42
+ var getAllAliases = (name, aliases) => {
43
+ const _aliases = [];
44
+ if (name) {
45
+ _aliases.push(name);
46
+ }
47
+ if (aliases) {
48
+ for (const alias of aliases) {
49
+ _aliases.push(alias);
68
50
  }
69
51
  }
70
- for (const candidateAuthOption of candidateAuthOptions) {
71
- if (!preferredAuthOptions.find(({ schemeId }) => schemeId === candidateAuthOption.schemeId)) {
72
- preferredAuthOptions.push(candidateAuthOption);
52
+ return _aliases;
53
+ };
54
+ var getMiddlewareNameWithAliases = (name, aliases) => {
55
+ return `${name || "anonymous"}${aliases && aliases.length > 0 ? ` (a.k.a. ${aliases.join(",")})` : ""}`;
56
+ };
57
+ var constructStack = () => {
58
+ let absoluteEntries = [];
59
+ let relativeEntries = [];
60
+ let identifyOnResolve = false;
61
+ const entriesNameSet = /* @__PURE__ */ new Set();
62
+ const sort = (entries) => entries.sort((a, b) => stepWeights[b.step] - stepWeights[a.step] || priorityWeights[b.priority || "normal"] - priorityWeights[a.priority || "normal"]);
63
+ const removeByName = (toRemove) => {
64
+ let isRemoved = false;
65
+ const filterCb = (entry) => {
66
+ const aliases = getAllAliases(entry.name, entry.aliases);
67
+ if (aliases.includes(toRemove)) {
68
+ isRemoved = true;
69
+ for (const alias of aliases) {
70
+ entriesNameSet.delete(alias);
71
+ }
72
+ return false;
73
+ }
74
+ return true;
75
+ };
76
+ absoluteEntries = absoluteEntries.filter(filterCb);
77
+ relativeEntries = relativeEntries.filter(filterCb);
78
+ return isRemoved;
79
+ };
80
+ const removeByReference = (toRemove) => {
81
+ let isRemoved = false;
82
+ const filterCb = (entry) => {
83
+ if (entry.middleware === toRemove) {
84
+ isRemoved = true;
85
+ for (const alias of getAllAliases(entry.name, entry.aliases)) {
86
+ entriesNameSet.delete(alias);
87
+ }
88
+ return false;
89
+ }
90
+ return true;
91
+ };
92
+ absoluteEntries = absoluteEntries.filter(filterCb);
93
+ relativeEntries = relativeEntries.filter(filterCb);
94
+ return isRemoved;
95
+ };
96
+ const cloneTo = (toStack) => {
97
+ absoluteEntries.forEach((entry) => {
98
+ toStack.add(entry.middleware, { ...entry });
99
+ });
100
+ relativeEntries.forEach((entry) => {
101
+ toStack.addRelativeTo(entry.middleware, { ...entry });
102
+ });
103
+ toStack.identifyOnResolve?.(stack.identifyOnResolve());
104
+ return toStack;
105
+ };
106
+ const expandRelativeMiddlewareList = (from) => {
107
+ const expandedMiddlewareList = [];
108
+ from.before.forEach((entry) => {
109
+ if (entry.before.length === 0 && entry.after.length === 0) {
110
+ expandedMiddlewareList.push(entry);
111
+ } else {
112
+ expandedMiddlewareList.push(...expandRelativeMiddlewareList(entry));
113
+ }
114
+ });
115
+ expandedMiddlewareList.push(from);
116
+ from.after.reverse().forEach((entry) => {
117
+ if (entry.before.length === 0 && entry.after.length === 0) {
118
+ expandedMiddlewareList.push(entry);
119
+ } else {
120
+ expandedMiddlewareList.push(...expandRelativeMiddlewareList(entry));
121
+ }
122
+ });
123
+ return expandedMiddlewareList;
124
+ };
125
+ const getMiddlewareList = (debug = false) => {
126
+ const normalizedAbsoluteEntries = [];
127
+ const normalizedRelativeEntries = [];
128
+ const normalizedEntriesNameMap = {};
129
+ absoluteEntries.forEach((entry) => {
130
+ const normalizedEntry = {
131
+ ...entry,
132
+ before: [],
133
+ after: []
134
+ };
135
+ for (const alias of getAllAliases(normalizedEntry.name, normalizedEntry.aliases)) {
136
+ normalizedEntriesNameMap[alias] = normalizedEntry;
137
+ }
138
+ normalizedAbsoluteEntries.push(normalizedEntry);
139
+ });
140
+ relativeEntries.forEach((entry) => {
141
+ const normalizedEntry = {
142
+ ...entry,
143
+ before: [],
144
+ after: []
145
+ };
146
+ for (const alias of getAllAliases(normalizedEntry.name, normalizedEntry.aliases)) {
147
+ normalizedEntriesNameMap[alias] = normalizedEntry;
148
+ }
149
+ normalizedRelativeEntries.push(normalizedEntry);
150
+ });
151
+ normalizedRelativeEntries.forEach((entry) => {
152
+ if (entry.toMiddleware) {
153
+ const toMiddleware = normalizedEntriesNameMap[entry.toMiddleware];
154
+ if (toMiddleware === void 0) {
155
+ if (debug) {
156
+ return;
157
+ }
158
+ throw new Error(`${entry.toMiddleware} is not found when adding ${getMiddlewareNameWithAliases(entry.name, entry.aliases)} middleware ${entry.relation} ${entry.toMiddleware}`);
159
+ }
160
+ if (entry.relation === "after") {
161
+ toMiddleware.after.push(entry);
162
+ }
163
+ if (entry.relation === "before") {
164
+ toMiddleware.before.push(entry);
165
+ }
166
+ }
167
+ });
168
+ const mainChain = sort(normalizedAbsoluteEntries).map(expandRelativeMiddlewareList).reduce((wholeList, expandedMiddlewareList) => {
169
+ wholeList.push(...expandedMiddlewareList);
170
+ return wholeList;
171
+ }, []);
172
+ return mainChain;
173
+ };
174
+ const stack = {
175
+ add: (middleware, options = {}) => {
176
+ const { name, override, aliases: _aliases } = options;
177
+ const entry = {
178
+ step: "initialize",
179
+ priority: "normal",
180
+ middleware,
181
+ ...options
182
+ };
183
+ const aliases = getAllAliases(name, _aliases);
184
+ if (aliases.length > 0) {
185
+ if (aliases.some((alias) => entriesNameSet.has(alias))) {
186
+ if (!override)
187
+ throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(name, _aliases)}'`);
188
+ for (const alias of aliases) {
189
+ const toOverrideIndex = absoluteEntries.findIndex((entry2) => entry2.name === alias || entry2.aliases?.some((a) => a === alias));
190
+ if (toOverrideIndex === -1) {
191
+ continue;
192
+ }
193
+ const toOverride = absoluteEntries[toOverrideIndex];
194
+ if (toOverride.step !== entry.step || entry.priority !== toOverride.priority) {
195
+ 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.`);
196
+ }
197
+ absoluteEntries.splice(toOverrideIndex, 1);
198
+ }
199
+ }
200
+ for (const alias of aliases) {
201
+ entriesNameSet.add(alias);
202
+ }
203
+ }
204
+ absoluteEntries.push(entry);
205
+ },
206
+ addRelativeTo: (middleware, options) => {
207
+ const { name, override, aliases: _aliases } = options;
208
+ const entry = {
209
+ middleware,
210
+ ...options
211
+ };
212
+ const aliases = getAllAliases(name, _aliases);
213
+ if (aliases.length > 0) {
214
+ if (aliases.some((alias) => entriesNameSet.has(alias))) {
215
+ if (!override)
216
+ throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(name, _aliases)}'`);
217
+ for (const alias of aliases) {
218
+ const toOverrideIndex = relativeEntries.findIndex((entry2) => entry2.name === alias || entry2.aliases?.some((a) => a === alias));
219
+ if (toOverrideIndex === -1) {
220
+ continue;
221
+ }
222
+ const toOverride = relativeEntries[toOverrideIndex];
223
+ if (toOverride.toMiddleware !== entry.toMiddleware || toOverride.relation !== entry.relation) {
224
+ 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.`);
225
+ }
226
+ relativeEntries.splice(toOverrideIndex, 1);
227
+ }
228
+ }
229
+ for (const alias of aliases) {
230
+ entriesNameSet.add(alias);
231
+ }
232
+ }
233
+ relativeEntries.push(entry);
234
+ },
235
+ clone: () => cloneTo(constructStack()),
236
+ use: (plugin) => {
237
+ plugin.applyToStack(stack);
238
+ },
239
+ remove: (toRemove) => {
240
+ if (typeof toRemove === "string")
241
+ return removeByName(toRemove);
242
+ else
243
+ return removeByReference(toRemove);
244
+ },
245
+ removeByTag: (toRemove) => {
246
+ let isRemoved = false;
247
+ const filterCb = (entry) => {
248
+ const { tags, name, aliases: _aliases } = entry;
249
+ if (tags && tags.includes(toRemove)) {
250
+ const aliases = getAllAliases(name, _aliases);
251
+ for (const alias of aliases) {
252
+ entriesNameSet.delete(alias);
253
+ }
254
+ isRemoved = true;
255
+ return false;
256
+ }
257
+ return true;
258
+ };
259
+ absoluteEntries = absoluteEntries.filter(filterCb);
260
+ relativeEntries = relativeEntries.filter(filterCb);
261
+ return isRemoved;
262
+ },
263
+ concat: (from) => {
264
+ const cloned = cloneTo(constructStack());
265
+ cloned.use(from);
266
+ cloned.identifyOnResolve(identifyOnResolve || cloned.identifyOnResolve() || (from.identifyOnResolve?.() ?? false));
267
+ return cloned;
268
+ },
269
+ applyToStack: cloneTo,
270
+ identify: () => {
271
+ return getMiddlewareList(true).map((mw) => {
272
+ const step = mw.step ?? mw.relation + " " + mw.toMiddleware;
273
+ return getMiddlewareNameWithAliases(mw.name, mw.aliases) + " - " + step;
274
+ });
275
+ },
276
+ identifyOnResolve(toggle) {
277
+ if (typeof toggle === "boolean")
278
+ identifyOnResolve = toggle;
279
+ return identifyOnResolve;
280
+ },
281
+ resolve: (handler, context) => {
282
+ for (const middleware of getMiddlewareList().map((entry) => entry.middleware).reverse()) {
283
+ handler = middleware(handler, context);
284
+ }
285
+ if (identifyOnResolve) {
286
+ console.log(stack.identify());
287
+ }
288
+ return handler;
73
289
  }
74
- }
75
- return preferredAuthOptions;
290
+ };
291
+ return stack;
76
292
  };
77
- function convertHttpAuthSchemesToMap(httpAuthSchemes) {
78
- const map = /* @__PURE__ */ new Map();
79
- for (const scheme of httpAuthSchemes) {
80
- map.set(scheme.schemeId, scheme);
81
- }
82
- return map;
83
- }
84
- var httpAuthSchemeMiddleware = (config, mwOptions) => (next, context) => async (args) => {
85
- const options = config.httpAuthSchemeProvider(await mwOptions.httpAuthSchemeParametersProvider(config, context, args.input));
86
- const authSchemePreference = config.authSchemePreference ? await config.authSchemePreference() : [];
87
- const resolvedOptions = resolveAuthOptions(options, authSchemePreference);
88
- const authSchemes = convertHttpAuthSchemesToMap(config.httpAuthSchemes);
89
- const smithyContext = getSmithyContext(context);
90
- const failureReasons = [];
91
- for (const option of resolvedOptions) {
92
- const scheme = authSchemes.get(option.schemeId);
93
- if (!scheme) {
94
- failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` was not enabled for this service.`);
95
- continue;
293
+ var stepWeights = {
294
+ initialize: 5,
295
+ serialize: 4,
296
+ build: 3,
297
+ finalizeRequest: 2,
298
+ deserialize: 1
299
+ };
300
+ var priorityWeights = {
301
+ high: 3,
302
+ normal: 2,
303
+ low: 1
304
+ };
305
+ var Client = class {
306
+ config;
307
+ middlewareStack = constructStack();
308
+ initConfig;
309
+ handlers;
310
+ constructor(config) {
311
+ this.config = config;
312
+ }
313
+ send(command, optionsOrCb, cb) {
314
+ const options = typeof optionsOrCb !== "function" ? optionsOrCb : void 0;
315
+ const callback = typeof optionsOrCb === "function" ? optionsOrCb : cb;
316
+ const useHandlerCache = options === void 0 && this.config.cacheMiddleware === true;
317
+ let handler;
318
+ if (useHandlerCache) {
319
+ if (!this.handlers) {
320
+ this.handlers = /* @__PURE__ */ new WeakMap();
321
+ }
322
+ const handlers = this.handlers;
323
+ if (handlers.has(command.constructor)) {
324
+ handler = handlers.get(command.constructor);
325
+ } else {
326
+ handler = command.resolveMiddleware(this.middlewareStack, this.config, options);
327
+ handlers.set(command.constructor, handler);
328
+ }
329
+ } else {
330
+ delete this.handlers;
331
+ handler = command.resolveMiddleware(this.middlewareStack, this.config, options);
96
332
  }
97
- const identityProvider = scheme.identityProvider(await mwOptions.identityProviderConfigProvider(config));
98
- if (!identityProvider) {
99
- failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` did not have an IdentityProvider configured.`);
100
- continue;
333
+ if (callback) {
334
+ handler(command).then((result) => callback(null, result.output), (err) => callback(err)).catch(() => {
335
+ });
336
+ } else {
337
+ return handler(command).then((result) => result.output);
101
338
  }
102
- const { identityProperties = {}, signingProperties = {} } = option.propertiesExtractor?.(config, context) || {};
103
- option.identityProperties = Object.assign(option.identityProperties || {}, identityProperties);
104
- option.signingProperties = Object.assign(option.signingProperties || {}, signingProperties);
105
- smithyContext.selectedHttpAuthScheme = {
106
- httpAuthOption: option,
107
- identity: await identityProvider(option.identityProperties),
108
- signer: scheme.signer
109
- };
110
- break;
111
339
  }
112
- if (!smithyContext.selectedHttpAuthScheme) {
113
- throw new Error(failureReasons.join("\n"));
340
+ destroy() {
341
+ this.config?.requestHandler?.destroy?.();
342
+ delete this.handlers;
114
343
  }
115
- return next(args);
116
344
  };
117
- var httpAuthSchemeEndpointRuleSetMiddlewareOptions = {
118
- step: "serialize",
119
- tags: ["HTTP_AUTH_SCHEME"],
120
- name: "httpAuthSchemeMiddleware",
121
- override: true,
122
- relation: "before",
123
- toMiddleware: "endpointV2Middleware"
345
+ var EndpointURLScheme;
346
+ (function(EndpointURLScheme2) {
347
+ EndpointURLScheme2["HTTP"] = "http";
348
+ EndpointURLScheme2["HTTPS"] = "https";
349
+ })(EndpointURLScheme || (EndpointURLScheme = {}));
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
+ var SMITHY_CONTEXT_KEY = "__smithy_context";
359
+ var deref = (schemaRef) => {
360
+ if (typeof schemaRef === "function") {
361
+ return schemaRef();
362
+ }
363
+ return schemaRef;
124
364
  };
125
- var getHttpAuthSchemeEndpointRuleSetPlugin = (config, { httpAuthSchemeParametersProvider, identityProviderConfigProvider }) => ({
126
- applyToStack: (clientStack) => {
127
- clientStack.addRelativeTo(httpAuthSchemeMiddleware(config, {
128
- httpAuthSchemeParametersProvider,
129
- identityProviderConfigProvider
130
- }), httpAuthSchemeEndpointRuleSetMiddlewareOptions);
131
- }
365
+ var getHttpHandlerExtensionConfiguration = (runtimeConfig) => {
366
+ return {
367
+ setHttpHandler(handler) {
368
+ runtimeConfig.httpHandler = handler;
369
+ },
370
+ httpHandler() {
371
+ return runtimeConfig.httpHandler;
372
+ },
373
+ updateHttpClientConfig(key, value) {
374
+ runtimeConfig.httpHandler?.updateHttpClientConfig(key, value);
375
+ },
376
+ httpHandlerConfigs() {
377
+ return runtimeConfig.httpHandler.httpHandlerConfigs();
378
+ }
379
+ };
380
+ };
381
+ var resolveHttpHandlerRuntimeConfig = (httpHandlerExtensionConfiguration) => {
382
+ return {
383
+ httpHandler: httpHandlerExtensionConfiguration.httpHandler()
384
+ };
385
+ };
386
+ var getSmithyContext = (context) => context[SMITHY_CONTEXT_KEY] || (context[SMITHY_CONTEXT_KEY] = {});
387
+ var normalizeProvider = (input) => {
388
+ if (typeof input === "function")
389
+ return input;
390
+ const promisified = Promise.resolve(input);
391
+ return () => promisified;
392
+ };
393
+ var operation = (namespace, name, traits, input, output) => ({
394
+ name,
395
+ namespace,
396
+ traits,
397
+ input,
398
+ output
132
399
  });
133
- init_esm_shims();
134
- init_esm_shims();
135
- var deserializerMiddleware = (options, deserializer) => (next, context) => async (args) => {
400
+ var schemaDeserializationMiddleware = (config) => (next, context) => async (args) => {
136
401
  const { response } = await next(args);
402
+ const { operationSchema } = getSmithyContext(context);
403
+ const [, ns, n, t, i, o] = operationSchema ?? [];
137
404
  try {
138
- const parsed = await deserializer(response, options);
405
+ const parsed = await config.protocol.deserializeResponse(operation(ns, n, t, i, o), {
406
+ ...config,
407
+ ...context
408
+ }, response);
139
409
  return {
140
410
  response,
141
411
  output: parsed
142
412
  };
143
413
  } catch (error) {
144
414
  Object.defineProperty(error, "$response", {
145
- value: response
415
+ value: response,
416
+ enumerable: false,
417
+ writable: false,
418
+ configurable: false
146
419
  });
147
420
  if (!("$metadata" in error)) {
148
421
  const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;
@@ -174,50 +447,596 @@ var deserializerMiddleware = (options, deserializer) => (next, context) => async
174
447
  } catch (e) {
175
448
  }
176
449
  }
177
- throw error;
450
+ throw error;
451
+ }
452
+ };
453
+ var findHeader = (pattern, headers) => {
454
+ return (headers.find(([k]) => {
455
+ return k.match(pattern);
456
+ }) || [void 0, void 0])[1];
457
+ };
458
+ var schemaSerializationMiddleware = (config) => (next, context) => async (args) => {
459
+ const { operationSchema } = getSmithyContext(context);
460
+ const [, ns, n, t, i, o] = operationSchema ?? [];
461
+ const endpoint = context.endpointV2?.url && config.urlParser ? async () => config.urlParser(context.endpointV2.url) : config.endpoint;
462
+ const request = await config.protocol.serializeRequest(operation(ns, n, t, i, o), args.input, {
463
+ ...config,
464
+ ...context,
465
+ endpoint
466
+ });
467
+ return next({
468
+ ...args,
469
+ request
470
+ });
471
+ };
472
+ var deserializerMiddlewareOption = {
473
+ name: "deserializerMiddleware",
474
+ step: "deserialize",
475
+ tags: ["DESERIALIZER"],
476
+ override: true
477
+ };
478
+ var serializerMiddlewareOption = {
479
+ name: "serializerMiddleware",
480
+ step: "serialize",
481
+ tags: ["SERIALIZER"],
482
+ override: true
483
+ };
484
+ function getSchemaSerdePlugin(config) {
485
+ return {
486
+ applyToStack: (commandStack) => {
487
+ commandStack.add(schemaSerializationMiddleware(config), serializerMiddlewareOption);
488
+ commandStack.add(schemaDeserializationMiddleware(config), deserializerMiddlewareOption);
489
+ config.protocol.setSerdeContext(config);
490
+ }
491
+ };
492
+ }
493
+ function translateTraits(indicator) {
494
+ if (typeof indicator === "object") {
495
+ return indicator;
496
+ }
497
+ indicator = indicator | 0;
498
+ const traits = {};
499
+ let i = 0;
500
+ for (const trait of [
501
+ "httpLabel",
502
+ "idempotent",
503
+ "idempotencyToken",
504
+ "sensitive",
505
+ "httpPayload",
506
+ "httpResponseCode",
507
+ "httpQueryParams"
508
+ ]) {
509
+ if ((indicator >> i++ & 1) === 1) {
510
+ traits[trait] = 1;
511
+ }
512
+ }
513
+ return traits;
514
+ }
515
+ var NormalizedSchema = class _NormalizedSchema {
516
+ ref;
517
+ memberName;
518
+ static symbol = Symbol.for("@smithy/nor");
519
+ symbol = _NormalizedSchema.symbol;
520
+ name;
521
+ schema;
522
+ _isMemberSchema;
523
+ traits;
524
+ memberTraits;
525
+ normalizedTraits;
526
+ constructor(ref, memberName) {
527
+ this.ref = ref;
528
+ this.memberName = memberName;
529
+ const traitStack = [];
530
+ let _ref = ref;
531
+ let schema = ref;
532
+ this._isMemberSchema = false;
533
+ while (isMemberSchema(_ref)) {
534
+ traitStack.push(_ref[1]);
535
+ _ref = _ref[0];
536
+ schema = deref(_ref);
537
+ this._isMemberSchema = true;
538
+ }
539
+ if (traitStack.length > 0) {
540
+ this.memberTraits = {};
541
+ for (let i = traitStack.length - 1; i >= 0; --i) {
542
+ const traitSet = traitStack[i];
543
+ Object.assign(this.memberTraits, translateTraits(traitSet));
544
+ }
545
+ } else {
546
+ this.memberTraits = 0;
547
+ }
548
+ if (schema instanceof _NormalizedSchema) {
549
+ const computedMemberTraits = this.memberTraits;
550
+ Object.assign(this, schema);
551
+ this.memberTraits = Object.assign({}, computedMemberTraits, schema.getMemberTraits(), this.getMemberTraits());
552
+ this.normalizedTraits = void 0;
553
+ this.memberName = memberName ?? schema.memberName;
554
+ return;
555
+ }
556
+ this.schema = deref(schema);
557
+ if (isStaticSchema(this.schema)) {
558
+ this.name = `${this.schema[1]}#${this.schema[2]}`;
559
+ this.traits = this.schema[3];
560
+ } else {
561
+ this.name = this.memberName ?? String(schema);
562
+ this.traits = 0;
563
+ }
564
+ if (this._isMemberSchema && !memberName) {
565
+ throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(true)} missing member name.`);
566
+ }
567
+ }
568
+ static [Symbol.hasInstance](lhs) {
569
+ const isPrototype = this.prototype.isPrototypeOf(lhs);
570
+ if (!isPrototype && typeof lhs === "object" && lhs !== null) {
571
+ const ns = lhs;
572
+ return ns.symbol === this.symbol;
573
+ }
574
+ return isPrototype;
575
+ }
576
+ static of(ref) {
577
+ const sc = deref(ref);
578
+ if (sc instanceof _NormalizedSchema) {
579
+ return sc;
580
+ }
581
+ if (isMemberSchema(sc)) {
582
+ const [ns, traits] = sc;
583
+ if (ns instanceof _NormalizedSchema) {
584
+ Object.assign(ns.getMergedTraits(), translateTraits(traits));
585
+ return ns;
586
+ }
587
+ throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(ref, null, 2)}.`);
588
+ }
589
+ return new _NormalizedSchema(sc);
590
+ }
591
+ getSchema() {
592
+ const sc = this.schema;
593
+ if (sc[0] === 0) {
594
+ return sc[4];
595
+ }
596
+ return sc;
597
+ }
598
+ getName(withNamespace = false) {
599
+ const { name } = this;
600
+ const short = !withNamespace && name && name.includes("#");
601
+ return short ? name.split("#")[1] : name || void 0;
602
+ }
603
+ getMemberName() {
604
+ return this.memberName;
605
+ }
606
+ isMemberSchema() {
607
+ return this._isMemberSchema;
608
+ }
609
+ isListSchema() {
610
+ const sc = this.getSchema();
611
+ return typeof sc === "number" ? sc >= 64 && sc < 128 : sc[0] === 1;
612
+ }
613
+ isMapSchema() {
614
+ const sc = this.getSchema();
615
+ return typeof sc === "number" ? sc >= 128 && sc <= 255 : sc[0] === 2;
616
+ }
617
+ isStructSchema() {
618
+ const sc = this.getSchema();
619
+ return sc[0] === 3 || sc[0] === -3;
620
+ }
621
+ isBlobSchema() {
622
+ const sc = this.getSchema();
623
+ return sc === 21 || sc === 42;
624
+ }
625
+ isTimestampSchema() {
626
+ const sc = this.getSchema();
627
+ return typeof sc === "number" && sc >= 4 && sc <= 7;
628
+ }
629
+ isUnitSchema() {
630
+ return this.getSchema() === "unit";
631
+ }
632
+ isDocumentSchema() {
633
+ return this.getSchema() === 15;
634
+ }
635
+ isStringSchema() {
636
+ return this.getSchema() === 0;
637
+ }
638
+ isBooleanSchema() {
639
+ return this.getSchema() === 2;
640
+ }
641
+ isNumericSchema() {
642
+ return this.getSchema() === 1;
643
+ }
644
+ isBigIntegerSchema() {
645
+ return this.getSchema() === 17;
646
+ }
647
+ isBigDecimalSchema() {
648
+ return this.getSchema() === 19;
649
+ }
650
+ isStreaming() {
651
+ const { streaming } = this.getMergedTraits();
652
+ return !!streaming || this.getSchema() === 42;
653
+ }
654
+ isIdempotencyToken() {
655
+ const match = (traits2) => (traits2 & 4) === 4 || !!traits2?.idempotencyToken;
656
+ const { normalizedTraits, traits, memberTraits } = this;
657
+ return match(normalizedTraits) || match(traits) || match(memberTraits);
658
+ }
659
+ getMergedTraits() {
660
+ return this.normalizedTraits ?? (this.normalizedTraits = {
661
+ ...this.getOwnTraits(),
662
+ ...this.getMemberTraits()
663
+ });
664
+ }
665
+ getMemberTraits() {
666
+ return translateTraits(this.memberTraits);
667
+ }
668
+ getOwnTraits() {
669
+ return translateTraits(this.traits);
670
+ }
671
+ getKeySchema() {
672
+ const [isDoc, isMap] = [this.isDocumentSchema(), this.isMapSchema()];
673
+ if (!isDoc && !isMap) {
674
+ throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(true)}`);
675
+ }
676
+ const schema = this.getSchema();
677
+ const memberSchema = isDoc ? 15 : schema[4] ?? 0;
678
+ return member([memberSchema, 0], "key");
679
+ }
680
+ getValueSchema() {
681
+ const sc = this.getSchema();
682
+ const [isDoc, isMap, isList] = [this.isDocumentSchema(), this.isMapSchema(), this.isListSchema()];
683
+ const memberSchema = typeof sc === "number" ? 63 & sc : sc && typeof sc === "object" && (isMap || isList) ? sc[3 + sc[0]] : isDoc ? 15 : void 0;
684
+ if (memberSchema != null) {
685
+ return member([memberSchema, 0], isMap ? "value" : "member");
686
+ }
687
+ throw new Error(`@smithy/core/schema - ${this.getName(true)} has no value member.`);
688
+ }
689
+ getMemberSchema(memberName) {
690
+ const struct = this.getSchema();
691
+ if (this.isStructSchema() && struct[4].includes(memberName)) {
692
+ const i = struct[4].indexOf(memberName);
693
+ const memberSchema = struct[5][i];
694
+ return member(isMemberSchema(memberSchema) ? memberSchema : [memberSchema, 0], memberName);
695
+ }
696
+ if (this.isDocumentSchema()) {
697
+ return member([15, 0], memberName);
698
+ }
699
+ throw new Error(`@smithy/core/schema - ${this.getName(true)} has no no member=${memberName}.`);
700
+ }
701
+ getMemberSchemas() {
702
+ const buffer = {};
703
+ try {
704
+ for (const [k, v] of this.structIterator()) {
705
+ buffer[k] = v;
706
+ }
707
+ } catch (ignored) {
708
+ }
709
+ return buffer;
710
+ }
711
+ getEventStreamMember() {
712
+ if (this.isStructSchema()) {
713
+ for (const [memberName, memberSchema] of this.structIterator()) {
714
+ if (memberSchema.isStreaming() && memberSchema.isStructSchema()) {
715
+ return memberName;
716
+ }
717
+ }
718
+ }
719
+ return "";
720
+ }
721
+ *structIterator() {
722
+ if (this.isUnitSchema()) {
723
+ return;
724
+ }
725
+ if (!this.isStructSchema()) {
726
+ throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");
727
+ }
728
+ const struct = this.getSchema();
729
+ for (let i = 0; i < struct[4].length; ++i) {
730
+ yield [struct[4][i], member([struct[5][i], 0], struct[4][i])];
731
+ }
732
+ }
733
+ };
734
+ function member(memberSchema, memberName) {
735
+ if (memberSchema instanceof NormalizedSchema) {
736
+ return Object.assign(memberSchema, {
737
+ memberName,
738
+ _isMemberSchema: true
739
+ });
740
+ }
741
+ const internalCtorAccess = NormalizedSchema;
742
+ return new internalCtorAccess(memberSchema, memberName);
743
+ }
744
+ var isMemberSchema = (sc) => Array.isArray(sc) && sc.length === 2;
745
+ var isStaticSchema = (sc) => Array.isArray(sc) && sc.length >= 5;
746
+ var TypeRegistry = class _TypeRegistry {
747
+ namespace;
748
+ schemas;
749
+ exceptions;
750
+ static registries = /* @__PURE__ */ new Map();
751
+ constructor(namespace, schemas = /* @__PURE__ */ new Map(), exceptions = /* @__PURE__ */ new Map()) {
752
+ this.namespace = namespace;
753
+ this.schemas = schemas;
754
+ this.exceptions = exceptions;
755
+ }
756
+ static for(namespace) {
757
+ if (!_TypeRegistry.registries.has(namespace)) {
758
+ _TypeRegistry.registries.set(namespace, new _TypeRegistry(namespace));
759
+ }
760
+ return _TypeRegistry.registries.get(namespace);
761
+ }
762
+ register(shapeId, schema) {
763
+ const qualifiedName = this.normalizeShapeId(shapeId);
764
+ const registry = _TypeRegistry.for(qualifiedName.split("#")[0]);
765
+ registry.schemas.set(qualifiedName, schema);
766
+ }
767
+ getSchema(shapeId) {
768
+ const id = this.normalizeShapeId(shapeId);
769
+ if (!this.schemas.has(id)) {
770
+ throw new Error(`@smithy/core/schema - schema not found for ${id}`);
771
+ }
772
+ return this.schemas.get(id);
773
+ }
774
+ registerError(es, ctor) {
775
+ const $error = es;
776
+ const registry = _TypeRegistry.for($error[1]);
777
+ registry.schemas.set($error[1] + "#" + $error[2], $error);
778
+ registry.exceptions.set($error, ctor);
779
+ }
780
+ getErrorCtor(es) {
781
+ const $error = es;
782
+ const registry = _TypeRegistry.for($error[1]);
783
+ return registry.exceptions.get($error);
784
+ }
785
+ getBaseException() {
786
+ for (const exceptionKey of this.exceptions.keys()) {
787
+ if (Array.isArray(exceptionKey)) {
788
+ const [, ns, name] = exceptionKey;
789
+ const id = ns + "#" + name;
790
+ if (id.startsWith("smithy.ts.sdk.synthetic.") && id.endsWith("ServiceException")) {
791
+ return exceptionKey;
792
+ }
793
+ }
794
+ }
795
+ return void 0;
796
+ }
797
+ find(predicate) {
798
+ return [...this.schemas.values()].find(predicate);
799
+ }
800
+ clear() {
801
+ this.schemas.clear();
802
+ this.exceptions.clear();
803
+ }
804
+ normalizeShapeId(shapeId) {
805
+ if (shapeId.includes("#")) {
806
+ return shapeId;
807
+ }
808
+ return this.namespace + "#" + shapeId;
809
+ }
810
+ };
811
+ var SENSITIVE_STRING = "***SensitiveInformation***";
812
+ function schemaLogFilter(schema, data) {
813
+ if (data == null) {
814
+ return data;
815
+ }
816
+ const ns = NormalizedSchema.of(schema);
817
+ if (ns.getMergedTraits().sensitive) {
818
+ return SENSITIVE_STRING;
819
+ }
820
+ if (ns.isListSchema()) {
821
+ const isSensitive = !!ns.getValueSchema().getMergedTraits().sensitive;
822
+ if (isSensitive) {
823
+ return SENSITIVE_STRING;
824
+ }
825
+ } else if (ns.isMapSchema()) {
826
+ const isSensitive = !!ns.getKeySchema().getMergedTraits().sensitive || !!ns.getValueSchema().getMergedTraits().sensitive;
827
+ if (isSensitive) {
828
+ return SENSITIVE_STRING;
829
+ }
830
+ } else if (ns.isStructSchema() && typeof data === "object") {
831
+ const object = data;
832
+ const newObject = {};
833
+ for (const [member2, memberNs] of ns.structIterator()) {
834
+ if (object[member2] != null) {
835
+ newObject[member2] = schemaLogFilter(memberNs, object[member2]);
836
+ }
837
+ }
838
+ return newObject;
839
+ }
840
+ return data;
841
+ }
842
+ var Command = class {
843
+ middlewareStack = constructStack();
844
+ schema;
845
+ static classBuilder() {
846
+ return new ClassBuilder();
847
+ }
848
+ resolveMiddlewareWithContext(clientStack, configuration, options, { middlewareFn, clientName, commandName, inputFilterSensitiveLog, outputFilterSensitiveLog, smithyContext, additionalContext, CommandCtor }) {
849
+ for (const mw of middlewareFn.bind(this)(CommandCtor, clientStack, configuration, options)) {
850
+ this.middlewareStack.use(mw);
851
+ }
852
+ const stack = clientStack.concat(this.middlewareStack);
853
+ const { logger } = configuration;
854
+ const handlerExecutionContext = {
855
+ logger,
856
+ clientName,
857
+ commandName,
858
+ inputFilterSensitiveLog,
859
+ outputFilterSensitiveLog,
860
+ [SMITHY_CONTEXT_KEY]: {
861
+ commandInstance: this,
862
+ ...smithyContext
863
+ },
864
+ ...additionalContext
865
+ };
866
+ const { requestHandler } = configuration;
867
+ return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
868
+ }
869
+ };
870
+ var ClassBuilder = class {
871
+ _init = () => {
872
+ };
873
+ _ep = {};
874
+ _middlewareFn = () => [];
875
+ _commandName = "";
876
+ _clientName = "";
877
+ _additionalContext = {};
878
+ _smithyContext = {};
879
+ _inputFilterSensitiveLog = void 0;
880
+ _outputFilterSensitiveLog = void 0;
881
+ _serializer = null;
882
+ _deserializer = null;
883
+ _operationSchema;
884
+ init(cb) {
885
+ this._init = cb;
886
+ }
887
+ ep(endpointParameterInstructions) {
888
+ this._ep = endpointParameterInstructions;
889
+ return this;
890
+ }
891
+ m(middlewareSupplier) {
892
+ this._middlewareFn = middlewareSupplier;
893
+ return this;
894
+ }
895
+ s(service, operation2, smithyContext = {}) {
896
+ this._smithyContext = {
897
+ service,
898
+ operation: operation2,
899
+ ...smithyContext
900
+ };
901
+ return this;
902
+ }
903
+ c(additionalContext = {}) {
904
+ this._additionalContext = additionalContext;
905
+ return this;
906
+ }
907
+ n(clientName, commandName) {
908
+ this._clientName = clientName;
909
+ this._commandName = commandName;
910
+ return this;
911
+ }
912
+ f(inputFilter = (_) => _, outputFilter = (_) => _) {
913
+ this._inputFilterSensitiveLog = inputFilter;
914
+ this._outputFilterSensitiveLog = outputFilter;
915
+ return this;
916
+ }
917
+ ser(serializer) {
918
+ this._serializer = serializer;
919
+ return this;
920
+ }
921
+ de(deserializer) {
922
+ this._deserializer = deserializer;
923
+ return this;
924
+ }
925
+ sc(operation2) {
926
+ this._operationSchema = operation2;
927
+ this._smithyContext.operationSchema = operation2;
928
+ return this;
929
+ }
930
+ build() {
931
+ const closure = this;
932
+ let CommandRef;
933
+ return CommandRef = class extends Command {
934
+ input;
935
+ static getEndpointParameterInstructions() {
936
+ return closure._ep;
937
+ }
938
+ constructor(...[input]) {
939
+ super();
940
+ this.input = input ?? {};
941
+ closure._init(this);
942
+ this.schema = closure._operationSchema;
943
+ }
944
+ resolveMiddleware(stack, configuration, options) {
945
+ const op = closure._operationSchema;
946
+ const input = op?.[4] ?? op?.input;
947
+ const output = op?.[5] ?? op?.output;
948
+ return this.resolveMiddlewareWithContext(stack, configuration, options, {
949
+ CommandCtor: CommandRef,
950
+ middlewareFn: closure._middlewareFn,
951
+ clientName: closure._clientName,
952
+ commandName: closure._commandName,
953
+ inputFilterSensitiveLog: closure._inputFilterSensitiveLog ?? (op ? schemaLogFilter.bind(null, input) : (_) => _),
954
+ outputFilterSensitiveLog: closure._outputFilterSensitiveLog ?? (op ? schemaLogFilter.bind(null, output) : (_) => _),
955
+ smithyContext: closure._smithyContext,
956
+ additionalContext: closure._additionalContext
957
+ });
958
+ }
959
+ serialize = closure._serializer;
960
+ deserialize = closure._deserializer;
961
+ };
962
+ }
963
+ };
964
+ var resolveAuthOptions = (candidateAuthOptions, authSchemePreference) => {
965
+ if (!authSchemePreference || authSchemePreference.length === 0) {
966
+ return candidateAuthOptions;
967
+ }
968
+ const preferredAuthOptions = [];
969
+ for (const preferredSchemeName of authSchemePreference) {
970
+ for (const candidateAuthOption of candidateAuthOptions) {
971
+ const candidateAuthSchemeName = candidateAuthOption.schemeId.split("#")[1];
972
+ if (candidateAuthSchemeName === preferredSchemeName) {
973
+ preferredAuthOptions.push(candidateAuthOption);
974
+ }
975
+ }
976
+ }
977
+ for (const candidateAuthOption of candidateAuthOptions) {
978
+ if (!preferredAuthOptions.find(({ schemeId }) => schemeId === candidateAuthOption.schemeId)) {
979
+ preferredAuthOptions.push(candidateAuthOption);
980
+ }
981
+ }
982
+ return preferredAuthOptions;
983
+ };
984
+ function convertHttpAuthSchemesToMap(httpAuthSchemes) {
985
+ const map = /* @__PURE__ */ new Map();
986
+ for (const scheme of httpAuthSchemes) {
987
+ map.set(scheme.schemeId, scheme);
988
+ }
989
+ return map;
990
+ }
991
+ var httpAuthSchemeMiddleware = (config, mwOptions) => (next, context) => async (args) => {
992
+ const options = config.httpAuthSchemeProvider(await mwOptions.httpAuthSchemeParametersProvider(config, context, args.input));
993
+ const authSchemePreference = config.authSchemePreference ? await config.authSchemePreference() : [];
994
+ const resolvedOptions = resolveAuthOptions(options, authSchemePreference);
995
+ const authSchemes = convertHttpAuthSchemesToMap(config.httpAuthSchemes);
996
+ const smithyContext = getSmithyContext(context);
997
+ const failureReasons = [];
998
+ for (const option of resolvedOptions) {
999
+ const scheme = authSchemes.get(option.schemeId);
1000
+ if (!scheme) {
1001
+ failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` was not enabled for this service.`);
1002
+ continue;
1003
+ }
1004
+ const identityProvider = scheme.identityProvider(await mwOptions.identityProviderConfigProvider(config));
1005
+ if (!identityProvider) {
1006
+ failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` did not have an IdentityProvider configured.`);
1007
+ continue;
1008
+ }
1009
+ const { identityProperties = {}, signingProperties = {} } = option.propertiesExtractor?.(config, context) || {};
1010
+ option.identityProperties = Object.assign(option.identityProperties || {}, identityProperties);
1011
+ option.signingProperties = Object.assign(option.signingProperties || {}, signingProperties);
1012
+ smithyContext.selectedHttpAuthScheme = {
1013
+ httpAuthOption: option,
1014
+ identity: await identityProvider(option.identityProperties),
1015
+ signer: scheme.signer
1016
+ };
1017
+ break;
178
1018
  }
179
- };
180
- var findHeader = (pattern, headers) => {
181
- return (headers.find(([k]) => {
182
- return k.match(pattern);
183
- }) || [void 0, void 0])[1];
184
- };
185
- init_esm_shims();
186
- var serializerMiddleware = (options, serializer) => (next, context) => async (args) => {
187
- const endpointConfig = options;
188
- const endpoint = context.endpointV2?.url && endpointConfig.urlParser ? async () => endpointConfig.urlParser(context.endpointV2.url) : endpointConfig.endpoint;
189
- if (!endpoint) {
190
- throw new Error("No valid endpoint provider available.");
1019
+ if (!smithyContext.selectedHttpAuthScheme) {
1020
+ throw new Error(failureReasons.join("\n"));
191
1021
  }
192
- const request = await serializer(args.input, { ...options, endpoint });
193
- return next({
194
- ...args,
195
- request
196
- });
197
- };
198
- var deserializerMiddlewareOption = {
199
- name: "deserializerMiddleware",
200
- step: "deserialize",
201
- tags: ["DESERIALIZER"],
202
- override: true
1022
+ return next(args);
203
1023
  };
204
- var serializerMiddlewareOption = {
205
- name: "serializerMiddleware",
1024
+ var httpAuthSchemeEndpointRuleSetMiddlewareOptions = {
206
1025
  step: "serialize",
207
- tags: ["SERIALIZER"],
208
- override: true
1026
+ tags: ["HTTP_AUTH_SCHEME"],
1027
+ name: "httpAuthSchemeMiddleware",
1028
+ override: true,
1029
+ relation: "before",
1030
+ toMiddleware: "endpointV2Middleware"
209
1031
  };
210
- function getSerdePlugin(config, serializer, deserializer) {
211
- return {
212
- applyToStack: (commandStack) => {
213
- commandStack.add(deserializerMiddleware(config, deserializer), deserializerMiddlewareOption);
214
- commandStack.add(serializerMiddleware(config, serializer), serializerMiddlewareOption);
215
- }
216
- };
217
- }
218
- init_esm_shims();
219
- init_esm_shims();
220
- init_esm_shims();
1032
+ var getHttpAuthSchemeEndpointRuleSetPlugin = (config, { httpAuthSchemeParametersProvider, identityProviderConfigProvider }) => ({
1033
+ applyToStack: (clientStack) => {
1034
+ clientStack.addRelativeTo(httpAuthSchemeMiddleware(config, {
1035
+ httpAuthSchemeParametersProvider,
1036
+ identityProviderConfigProvider
1037
+ }), httpAuthSchemeEndpointRuleSetMiddlewareOptions);
1038
+ }
1039
+ });
221
1040
  var defaultErrorHandler = (signingProperties) => (error) => {
222
1041
  throw error;
223
1042
  };
@@ -254,7 +1073,6 @@ var getHttpSigningPlugin = (config) => ({
254
1073
  clientStack.addRelativeTo(httpSigningMiddleware(config), httpSigningMiddlewareOptions);
255
1074
  }
256
1075
  });
257
- init_esm_shims();
258
1076
  var makePagedClientRequest = async (CommandCtor, client, input, withCommand = (_) => _, ...args) => {
259
1077
  let command = new CommandCtor(input);
260
1078
  command = withCommand(command) ?? command;
@@ -295,10 +1113,9 @@ var get = (fromObject, path) => {
295
1113
  }
296
1114
  return cursor;
297
1115
  };
298
- init_esm_shims();
299
1116
  var DefaultIdentityProviderConfig = class {
1117
+ authSchemes = /* @__PURE__ */ new Map();
300
1118
  constructor(config) {
301
- this.authSchemes = /* @__PURE__ */ new Map();
302
1119
  for (const [key, value] of Object.entries(config)) {
303
1120
  if (value !== void 0) {
304
1121
  this.authSchemes.set(key, value);
@@ -309,28 +1126,448 @@ var DefaultIdentityProviderConfig = class {
309
1126
  return this.authSchemes.get(schemeId);
310
1127
  }
311
1128
  };
312
- init_esm_shims();
313
- init_esm_shims();
314
- init_esm_shims();
315
- init_esm_shims();
316
- var httpAuthSchemeMiddlewareOptions = {
1129
+ var serializerMiddlewareOption2 = {
1130
+ name: "serializerMiddleware",
317
1131
  step: "serialize",
318
- tags: ["HTTP_AUTH_SCHEME"],
319
- name: "httpAuthSchemeMiddleware",
320
- override: true,
321
- relation: "before",
322
- toMiddleware: serializerMiddlewareOption.name
1132
+ tags: ["SERIALIZER"],
1133
+ override: true
323
1134
  };
324
- init_esm_shims();
325
- init_esm_shims();
326
1135
  var normalizeProvider2 = (input) => {
327
1136
  if (typeof input === "function")
328
1137
  return input;
329
1138
  const promisified = Promise.resolve(input);
330
1139
  return () => promisified;
331
1140
  };
332
- init_esm_shims();
333
- init_esm_shims();
1141
+ var toUint8Array = (data) => {
1142
+ if (typeof data === "string") {
1143
+ return fromUtf8(data);
1144
+ }
1145
+ if (ArrayBuffer.isView(data)) {
1146
+ return new Uint8Array(data.buffer, data.byteOffset, data.byteLength / Uint8Array.BYTES_PER_ELEMENT);
1147
+ }
1148
+ return new Uint8Array(data);
1149
+ };
1150
+ var Uint8ArrayBlobAdapter = class _Uint8ArrayBlobAdapter extends Uint8Array {
1151
+ static fromString(source, encoding = "utf-8") {
1152
+ if (typeof source === "string") {
1153
+ if (encoding === "base64") {
1154
+ return _Uint8ArrayBlobAdapter.mutate(fromBase64(source));
1155
+ }
1156
+ return _Uint8ArrayBlobAdapter.mutate(fromUtf8(source));
1157
+ }
1158
+ throw new Error(`Unsupported conversion from ${typeof source} to Uint8ArrayBlobAdapter.`);
1159
+ }
1160
+ static mutate(source) {
1161
+ Object.setPrototypeOf(source, _Uint8ArrayBlobAdapter.prototype);
1162
+ return source;
1163
+ }
1164
+ transformToString(encoding = "utf-8") {
1165
+ if (encoding === "base64") {
1166
+ return toBase64(this);
1167
+ }
1168
+ return toUtf8(this);
1169
+ }
1170
+ };
1171
+ var collectBody = async (streamBody = new Uint8Array(), context) => {
1172
+ if (streamBody instanceof Uint8Array) {
1173
+ return Uint8ArrayBlobAdapter.mutate(streamBody);
1174
+ }
1175
+ if (!streamBody) {
1176
+ return Uint8ArrayBlobAdapter.mutate(new Uint8Array());
1177
+ }
1178
+ const fromContext = context.streamCollector(streamBody);
1179
+ return Uint8ArrayBlobAdapter.mutate(await fromContext);
1180
+ };
1181
+ function extendedEncodeURIComponent(str) {
1182
+ return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {
1183
+ return "%" + c.charCodeAt(0).toString(16).toUpperCase();
1184
+ });
1185
+ }
1186
+ var randomUUID = crypto2.randomUUID.bind(crypto2);
1187
+ var decimalToHex = Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
1188
+ var v4 = () => {
1189
+ if (randomUUID) {
1190
+ return randomUUID();
1191
+ }
1192
+ const rnds = new Uint8Array(16);
1193
+ crypto.getRandomValues(rnds);
1194
+ rnds[6] = rnds[6] & 15 | 64;
1195
+ rnds[8] = rnds[8] & 63 | 128;
1196
+ return decimalToHex[rnds[0]] + decimalToHex[rnds[1]] + decimalToHex[rnds[2]] + decimalToHex[rnds[3]] + "-" + decimalToHex[rnds[4]] + decimalToHex[rnds[5]] + "-" + decimalToHex[rnds[6]] + decimalToHex[rnds[7]] + "-" + decimalToHex[rnds[8]] + decimalToHex[rnds[9]] + "-" + decimalToHex[rnds[10]] + decimalToHex[rnds[11]] + decimalToHex[rnds[12]] + decimalToHex[rnds[13]] + decimalToHex[rnds[14]] + decimalToHex[rnds[15]];
1197
+ };
1198
+ var LazyJsonString = function LazyJsonString2(val) {
1199
+ const str = Object.assign(new String(val), {
1200
+ deserializeJSON() {
1201
+ return JSON.parse(String(val));
1202
+ },
1203
+ toString() {
1204
+ return String(val);
1205
+ },
1206
+ toJSON() {
1207
+ return String(val);
1208
+ }
1209
+ });
1210
+ return str;
1211
+ };
1212
+ LazyJsonString.from = (object) => {
1213
+ if (object && typeof object === "object" && (object instanceof LazyJsonString || "deserializeJSON" in object)) {
1214
+ return object;
1215
+ } else if (typeof object === "string" || Object.getPrototypeOf(object) === String.prototype) {
1216
+ return LazyJsonString(String(object));
1217
+ }
1218
+ return LazyJsonString(JSON.stringify(object));
1219
+ };
1220
+ LazyJsonString.fromObject = LazyJsonString.from;
1221
+ var ddd = `(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?`;
1222
+ var mmm = `(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)`;
1223
+ var time = `(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?`;
1224
+ var date = `(\\d?\\d)`;
1225
+ var year = `(\\d{4})`;
1226
+ var RFC3339_WITH_OFFSET = new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/);
1227
+ var IMF_FIXDATE = new RegExp(`^${ddd}, ${date} ${mmm} ${year} ${time} GMT$`);
1228
+ var RFC_850_DATE = new RegExp(`^${ddd}, ${date}-${mmm}-(\\d\\d) ${time} GMT$`);
1229
+ var ASC_TIME = new RegExp(`^${ddd} ${mmm} ( [1-9]|\\d\\d) ${time} ${year}$`);
1230
+ var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
1231
+ var _parseEpochTimestamp = (value) => {
1232
+ if (value == null) {
1233
+ return void 0;
1234
+ }
1235
+ let num = NaN;
1236
+ if (typeof value === "number") {
1237
+ num = value;
1238
+ } else if (typeof value === "string") {
1239
+ if (!/^-?\d*\.?\d+$/.test(value)) {
1240
+ throw new TypeError(`parseEpochTimestamp - numeric string invalid.`);
1241
+ }
1242
+ num = Number.parseFloat(value);
1243
+ } else if (typeof value === "object" && value.tag === 1) {
1244
+ num = value.value;
1245
+ }
1246
+ if (isNaN(num) || Math.abs(num) === Infinity) {
1247
+ throw new TypeError("Epoch timestamps must be valid finite numbers.");
1248
+ }
1249
+ return new Date(Math.round(num * 1e3));
1250
+ };
1251
+ var _parseRfc3339DateTimeWithOffset = (value) => {
1252
+ if (value == null) {
1253
+ return void 0;
1254
+ }
1255
+ if (typeof value !== "string") {
1256
+ throw new TypeError("RFC3339 timestamps must be strings");
1257
+ }
1258
+ const matches = RFC3339_WITH_OFFSET.exec(value);
1259
+ if (!matches) {
1260
+ throw new TypeError(`Invalid RFC3339 timestamp format ${value}`);
1261
+ }
1262
+ const [, yearStr, monthStr, dayStr, hours, minutes, seconds, , ms, offsetStr] = matches;
1263
+ range(monthStr, 1, 12);
1264
+ range(dayStr, 1, 31);
1265
+ range(hours, 0, 23);
1266
+ range(minutes, 0, 59);
1267
+ range(seconds, 0, 60);
1268
+ const date2 = new Date(Date.UTC(Number(yearStr), Number(monthStr) - 1, Number(dayStr), Number(hours), Number(minutes), Number(seconds), Number(ms) ? Math.round(parseFloat(`0.${ms}`) * 1e3) : 0));
1269
+ date2.setUTCFullYear(Number(yearStr));
1270
+ if (offsetStr.toUpperCase() != "Z") {
1271
+ const [, sign, offsetH, offsetM] = /([+-])(\d\d):(\d\d)/.exec(offsetStr) || [void 0, "+", 0, 0];
1272
+ const scalar = sign === "-" ? 1 : -1;
1273
+ date2.setTime(date2.getTime() + scalar * (Number(offsetH) * 60 * 60 * 1e3 + Number(offsetM) * 60 * 1e3));
1274
+ }
1275
+ return date2;
1276
+ };
1277
+ var _parseRfc7231DateTime = (value) => {
1278
+ if (value == null) {
1279
+ return void 0;
1280
+ }
1281
+ if (typeof value !== "string") {
1282
+ throw new TypeError("RFC7231 timestamps must be strings.");
1283
+ }
1284
+ let day;
1285
+ let month;
1286
+ let year2;
1287
+ let hour;
1288
+ let minute;
1289
+ let second;
1290
+ let fraction;
1291
+ let matches;
1292
+ if (matches = IMF_FIXDATE.exec(value)) {
1293
+ [, day, month, year2, hour, minute, second, fraction] = matches;
1294
+ } else if (matches = RFC_850_DATE.exec(value)) {
1295
+ [, day, month, year2, hour, minute, second, fraction] = matches;
1296
+ year2 = (Number(year2) + 1900).toString();
1297
+ } else if (matches = ASC_TIME.exec(value)) {
1298
+ [, month, day, hour, minute, second, fraction, year2] = matches;
1299
+ }
1300
+ if (year2 && second) {
1301
+ const timestamp = Date.UTC(Number(year2), months.indexOf(month), Number(day), Number(hour), Number(minute), Number(second), fraction ? Math.round(parseFloat(`0.${fraction}`) * 1e3) : 0);
1302
+ range(day, 1, 31);
1303
+ range(hour, 0, 23);
1304
+ range(minute, 0, 59);
1305
+ range(second, 0, 60);
1306
+ const date2 = new Date(timestamp);
1307
+ date2.setUTCFullYear(Number(year2));
1308
+ return date2;
1309
+ }
1310
+ throw new TypeError(`Invalid RFC7231 date-time value ${value}.`);
1311
+ };
1312
+ function range(v, min, max) {
1313
+ const _v = Number(v);
1314
+ if (_v < min || _v > max) {
1315
+ throw new Error(`Value ${_v} out of range [${min}, ${max}]`);
1316
+ }
1317
+ }
1318
+ var splitHeader = (value) => {
1319
+ const z = value.length;
1320
+ const values = [];
1321
+ let withinQuotes = false;
1322
+ let prevChar = void 0;
1323
+ let anchor = 0;
1324
+ for (let i = 0; i < z; ++i) {
1325
+ const char = value[i];
1326
+ switch (char) {
1327
+ case `"`:
1328
+ if (prevChar !== "\\") {
1329
+ withinQuotes = !withinQuotes;
1330
+ }
1331
+ break;
1332
+ case ",":
1333
+ if (!withinQuotes) {
1334
+ values.push(value.slice(anchor, i));
1335
+ anchor = i + 1;
1336
+ }
1337
+ break;
1338
+ default:
1339
+ }
1340
+ prevChar = char;
1341
+ }
1342
+ values.push(value.slice(anchor));
1343
+ return values.map((v) => {
1344
+ v = v.trim();
1345
+ const z2 = v.length;
1346
+ if (z2 < 2) {
1347
+ return v;
1348
+ }
1349
+ if (v[0] === `"` && v[z2 - 1] === `"`) {
1350
+ v = v.slice(1, z2 - 1);
1351
+ }
1352
+ return v.replace(/\\"/g, '"');
1353
+ });
1354
+ };
1355
+ var format = /^-?\d*(\.\d+)?$/;
1356
+ var NumericValue = class _NumericValue {
1357
+ string;
1358
+ type;
1359
+ constructor(string, type) {
1360
+ this.string = string;
1361
+ this.type = type;
1362
+ if (!format.test(string)) {
1363
+ throw new Error(`@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".`);
1364
+ }
1365
+ }
1366
+ toString() {
1367
+ return this.string;
1368
+ }
1369
+ static [Symbol.hasInstance](object) {
1370
+ if (!object || typeof object !== "object") {
1371
+ return false;
1372
+ }
1373
+ const _nv = object;
1374
+ return _NumericValue.prototype.isPrototypeOf(object) || _nv.type === "bigDecimal" && format.test(_nv.string);
1375
+ }
1376
+ };
1377
+ var SerdeContext = class {
1378
+ serdeContext;
1379
+ setSerdeContext(serdeContext) {
1380
+ this.serdeContext = serdeContext;
1381
+ }
1382
+ };
1383
+ var HttpProtocol = class extends SerdeContext {
1384
+ options;
1385
+ constructor(options) {
1386
+ super();
1387
+ this.options = options;
1388
+ }
1389
+ getRequestType() {
1390
+ return HttpRequest;
1391
+ }
1392
+ getResponseType() {
1393
+ return HttpResponse;
1394
+ }
1395
+ setSerdeContext(serdeContext) {
1396
+ this.serdeContext = serdeContext;
1397
+ this.serializer.setSerdeContext(serdeContext);
1398
+ this.deserializer.setSerdeContext(serdeContext);
1399
+ if (this.getPayloadCodec()) {
1400
+ this.getPayloadCodec().setSerdeContext(serdeContext);
1401
+ }
1402
+ }
1403
+ updateServiceEndpoint(request, endpoint) {
1404
+ if ("url" in endpoint) {
1405
+ request.protocol = endpoint.url.protocol;
1406
+ request.hostname = endpoint.url.hostname;
1407
+ request.port = endpoint.url.port ? Number(endpoint.url.port) : void 0;
1408
+ request.path = endpoint.url.pathname;
1409
+ request.fragment = endpoint.url.hash || void 0;
1410
+ request.username = endpoint.url.username || void 0;
1411
+ request.password = endpoint.url.password || void 0;
1412
+ if (!request.query) {
1413
+ request.query = {};
1414
+ }
1415
+ for (const [k, v] of endpoint.url.searchParams.entries()) {
1416
+ request.query[k] = v;
1417
+ }
1418
+ return request;
1419
+ } else {
1420
+ request.protocol = endpoint.protocol;
1421
+ request.hostname = endpoint.hostname;
1422
+ request.port = endpoint.port ? Number(endpoint.port) : void 0;
1423
+ request.path = endpoint.path;
1424
+ request.query = {
1425
+ ...endpoint.query
1426
+ };
1427
+ return request;
1428
+ }
1429
+ }
1430
+ setHostPrefix(request, operationSchema, input) {
1431
+ const inputNs = NormalizedSchema.of(operationSchema.input);
1432
+ const opTraits = translateTraits(operationSchema.traits ?? {});
1433
+ if (opTraits.endpoint) {
1434
+ let hostPrefix = opTraits.endpoint?.[0];
1435
+ if (typeof hostPrefix === "string") {
1436
+ const hostLabelInputs = [...inputNs.structIterator()].filter(([, member2]) => member2.getMergedTraits().hostLabel);
1437
+ for (const [name] of hostLabelInputs) {
1438
+ const replacement = input[name];
1439
+ if (typeof replacement !== "string") {
1440
+ throw new Error(`@smithy/core/schema - ${name} in input must be a string as hostLabel.`);
1441
+ }
1442
+ hostPrefix = hostPrefix.replace(`{${name}}`, replacement);
1443
+ }
1444
+ request.hostname = hostPrefix + request.hostname;
1445
+ }
1446
+ }
1447
+ }
1448
+ deserializeMetadata(output) {
1449
+ return {
1450
+ httpStatusCode: output.statusCode,
1451
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
1452
+ extendedRequestId: output.headers["x-amz-id-2"],
1453
+ cfId: output.headers["x-amz-cf-id"]
1454
+ };
1455
+ }
1456
+ async serializeEventStream({ eventStream, requestSchema, initialRequest }) {
1457
+ const eventStreamSerde = await this.loadEventStreamCapability();
1458
+ return eventStreamSerde.serializeEventStream({
1459
+ eventStream,
1460
+ requestSchema,
1461
+ initialRequest
1462
+ });
1463
+ }
1464
+ async deserializeEventStream({ response, responseSchema, initialResponseContainer }) {
1465
+ const eventStreamSerde = await this.loadEventStreamCapability();
1466
+ return eventStreamSerde.deserializeEventStream({
1467
+ response,
1468
+ responseSchema,
1469
+ initialResponseContainer
1470
+ });
1471
+ }
1472
+ async loadEventStreamCapability() {
1473
+ const { EventStreamSerde } = await import("./event-streams-L7RH32OW-AFMBEYJJ.js");
1474
+ return new EventStreamSerde({
1475
+ marshaller: this.getEventStreamMarshaller(),
1476
+ serializer: this.serializer,
1477
+ deserializer: this.deserializer,
1478
+ serdeContext: this.serdeContext,
1479
+ defaultContentType: this.getDefaultContentType()
1480
+ });
1481
+ }
1482
+ getDefaultContentType() {
1483
+ throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`);
1484
+ }
1485
+ async deserializeHttpMessage(schema, context, response, arg4, arg5) {
1486
+ void schema;
1487
+ void context;
1488
+ void response;
1489
+ void arg4;
1490
+ void arg5;
1491
+ return [];
1492
+ }
1493
+ getEventStreamMarshaller() {
1494
+ const context = this.serdeContext;
1495
+ if (!context.eventStreamMarshaller) {
1496
+ throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");
1497
+ }
1498
+ return context.eventStreamMarshaller;
1499
+ }
1500
+ };
1501
+ function determineTimestampFormat(ns, settings) {
1502
+ if (settings.timestampFormat.useTrait) {
1503
+ if (ns.isTimestampSchema() && (ns.getSchema() === 5 || ns.getSchema() === 6 || ns.getSchema() === 7)) {
1504
+ return ns.getSchema();
1505
+ }
1506
+ }
1507
+ const { httpLabel, httpPrefixHeaders, httpHeader, httpQuery } = ns.getMergedTraits();
1508
+ const bindingFormat = settings.httpBindings ? typeof httpPrefixHeaders === "string" || Boolean(httpHeader) ? 6 : Boolean(httpQuery) || Boolean(httpLabel) ? 5 : void 0 : void 0;
1509
+ return bindingFormat ?? settings.timestampFormat.default;
1510
+ }
1511
+ var FromStringShapeDeserializer = class extends SerdeContext {
1512
+ settings;
1513
+ constructor(settings) {
1514
+ super();
1515
+ this.settings = settings;
1516
+ }
1517
+ read(_schema, data) {
1518
+ const ns = NormalizedSchema.of(_schema);
1519
+ if (ns.isListSchema()) {
1520
+ return splitHeader(data).map((item) => this.read(ns.getValueSchema(), item));
1521
+ }
1522
+ if (ns.isBlobSchema()) {
1523
+ return (this.serdeContext?.base64Decoder ?? fromBase64)(data);
1524
+ }
1525
+ if (ns.isTimestampSchema()) {
1526
+ const format2 = determineTimestampFormat(ns, this.settings);
1527
+ switch (format2) {
1528
+ case 5:
1529
+ return _parseRfc3339DateTimeWithOffset(data);
1530
+ case 6:
1531
+ return _parseRfc7231DateTime(data);
1532
+ case 7:
1533
+ return _parseEpochTimestamp(data);
1534
+ default:
1535
+ console.warn("Missing timestamp format, parsing value with Date constructor:", data);
1536
+ return new Date(data);
1537
+ }
1538
+ }
1539
+ if (ns.isStringSchema()) {
1540
+ const mediaType = ns.getMergedTraits().mediaType;
1541
+ let intermediateValue = data;
1542
+ if (mediaType) {
1543
+ if (ns.getMergedTraits().httpHeader) {
1544
+ intermediateValue = this.base64ToUtf8(intermediateValue);
1545
+ }
1546
+ const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
1547
+ if (isJson) {
1548
+ intermediateValue = LazyJsonString.from(intermediateValue);
1549
+ }
1550
+ return intermediateValue;
1551
+ }
1552
+ }
1553
+ if (ns.isNumericSchema()) {
1554
+ return Number(data);
1555
+ }
1556
+ if (ns.isBigIntegerSchema()) {
1557
+ return BigInt(data);
1558
+ }
1559
+ if (ns.isBigDecimalSchema()) {
1560
+ return new NumericValue(data, "bigDecimal");
1561
+ }
1562
+ if (ns.isBooleanSchema()) {
1563
+ return String(data).toLowerCase() === "true";
1564
+ }
1565
+ return data;
1566
+ }
1567
+ base64ToUtf8(base64String) {
1568
+ return (this.serdeContext?.utf8Encoder ?? toUtf8)((this.serdeContext?.base64Decoder ?? fromBase64)(base64String));
1569
+ }
1570
+ };
334
1571
  function setFeature(context, feature, value) {
335
1572
  if (!context.__smithy_context) {
336
1573
  context.__smithy_context = {
@@ -341,18 +1578,14 @@ function setFeature(context, feature, value) {
341
1578
  }
342
1579
  context.__smithy_context.features[feature] = value;
343
1580
  }
344
- init_esm_shims();
345
- init_esm_shims();
346
- init_esm_shims();
347
- init_esm_shims();
348
- init_esm_shims();
349
1581
  var NoAuthSigner = class {
350
1582
  async sign(httpRequest, identity, signingProperties) {
351
1583
  return httpRequest;
352
1584
  }
353
1585
  };
354
- init_esm_shims();
355
- var createIsIdentityExpiredFunction = (expirationMs) => (identity) => doesIdentityRequireRefresh(identity) && identity.expiration.getTime() - Date.now() < expirationMs;
1586
+ var createIsIdentityExpiredFunction = (expirationMs) => function isIdentityExpired2(identity) {
1587
+ return doesIdentityRequireRefresh(identity) && identity.expiration.getTime() - Date.now() < expirationMs;
1588
+ };
356
1589
  var EXPIRATION_MS = 3e5;
357
1590
  var isIdentityExpired = createIsIdentityExpiredFunction(EXPIRATION_MS);
358
1591
  var doesIdentityRequireRefresh = (identity) => identity.expiration !== void 0;
@@ -404,7 +1637,51 @@ var memoizeIdentityProvider = (provider, isExpired, requiresRefresh) => {
404
1637
  return resolved;
405
1638
  };
406
1639
  };
407
- init_esm_shims();
1640
+ var ServiceException = class _ServiceException extends Error {
1641
+ $fault;
1642
+ $response;
1643
+ $retryable;
1644
+ $metadata;
1645
+ constructor(options) {
1646
+ super(options.message);
1647
+ Object.setPrototypeOf(this, Object.getPrototypeOf(this).constructor.prototype);
1648
+ this.name = options.name;
1649
+ this.$fault = options.$fault;
1650
+ this.$metadata = options.$metadata;
1651
+ }
1652
+ static isInstance(value) {
1653
+ if (!value)
1654
+ return false;
1655
+ const candidate = value;
1656
+ return _ServiceException.prototype.isPrototypeOf(candidate) || Boolean(candidate.$fault) && Boolean(candidate.$metadata) && (candidate.$fault === "client" || candidate.$fault === "server");
1657
+ }
1658
+ static [Symbol.hasInstance](instance) {
1659
+ if (!instance)
1660
+ return false;
1661
+ const candidate = instance;
1662
+ if (this === _ServiceException) {
1663
+ return _ServiceException.isInstance(instance);
1664
+ }
1665
+ if (_ServiceException.isInstance(instance)) {
1666
+ if (candidate.name && this.name) {
1667
+ return this.prototype.isPrototypeOf(instance) || candidate.name === this.name;
1668
+ }
1669
+ return this.prototype.isPrototypeOf(instance);
1670
+ }
1671
+ return false;
1672
+ }
1673
+ };
1674
+ var decorateServiceException = (exception, additions = {}) => {
1675
+ Object.entries(additions).filter(([, v]) => v !== void 0).forEach(([k, v]) => {
1676
+ if (exception[k] == void 0 || exception[k] === "") {
1677
+ exception[k] = v;
1678
+ }
1679
+ });
1680
+ const message = exception.message || exception.Message || "UnknownError";
1681
+ exception.message = message;
1682
+ delete exception.Message;
1683
+ return exception;
1684
+ };
408
1685
  function resolveHostHeaderConfig(input) {
409
1686
  return input;
410
1687
  }
@@ -436,7 +1713,6 @@ var getHostHeaderPlugin = (options) => ({
436
1713
  clientStack.add(hostHeaderMiddleware(options), hostHeaderMiddlewareOptions);
437
1714
  }
438
1715
  });
439
- init_esm_shims();
440
1716
  var loggerMiddleware = () => (next, context) => async (args) => {
441
1717
  try {
442
1718
  const response = await next(args);
@@ -478,14 +1754,132 @@ var getLoggerPlugin = (options) => ({
478
1754
  clientStack.add(loggerMiddleware(), loggerMiddlewareOptions);
479
1755
  }
480
1756
  });
481
- init_esm_shims();
482
- init_esm_shims();
1757
+ var recursionDetectionMiddlewareOptions = {
1758
+ step: "build",
1759
+ tags: ["RECURSION_DETECTION"],
1760
+ name: "recursionDetectionMiddleware",
1761
+ override: true,
1762
+ priority: "low"
1763
+ };
1764
+ var PROTECTED_KEYS = {
1765
+ REQUEST_ID: Symbol.for("_AWS_LAMBDA_REQUEST_ID"),
1766
+ X_RAY_TRACE_ID: Symbol.for("_AWS_LAMBDA_X_RAY_TRACE_ID"),
1767
+ TENANT_ID: Symbol.for("_AWS_LAMBDA_TENANT_ID")
1768
+ };
1769
+ var NO_GLOBAL_AWS_LAMBDA = ["true", "1"].includes(process.env?.AWS_LAMBDA_NODEJS_NO_GLOBAL_AWSLAMBDA ?? "");
1770
+ if (!NO_GLOBAL_AWS_LAMBDA) {
1771
+ globalThis.awslambda = globalThis.awslambda || {};
1772
+ }
1773
+ var InvokeStoreBase = class {
1774
+ static PROTECTED_KEYS = PROTECTED_KEYS;
1775
+ isProtectedKey(key) {
1776
+ return Object.values(PROTECTED_KEYS).includes(key);
1777
+ }
1778
+ getRequestId() {
1779
+ return this.get(PROTECTED_KEYS.REQUEST_ID) ?? "-";
1780
+ }
1781
+ getXRayTraceId() {
1782
+ return this.get(PROTECTED_KEYS.X_RAY_TRACE_ID);
1783
+ }
1784
+ getTenantId() {
1785
+ return this.get(PROTECTED_KEYS.TENANT_ID);
1786
+ }
1787
+ };
1788
+ var InvokeStoreSingle = class extends InvokeStoreBase {
1789
+ currentContext;
1790
+ getContext() {
1791
+ return this.currentContext;
1792
+ }
1793
+ hasContext() {
1794
+ return this.currentContext !== void 0;
1795
+ }
1796
+ get(key) {
1797
+ return this.currentContext?.[key];
1798
+ }
1799
+ set(key, value) {
1800
+ if (this.isProtectedKey(key)) {
1801
+ throw new Error(`Cannot modify protected Lambda context field: ${String(key)}`);
1802
+ }
1803
+ this.currentContext = this.currentContext || {};
1804
+ this.currentContext[key] = value;
1805
+ }
1806
+ run(context, fn) {
1807
+ this.currentContext = context;
1808
+ try {
1809
+ return fn();
1810
+ } finally {
1811
+ this.currentContext = void 0;
1812
+ }
1813
+ }
1814
+ };
1815
+ var InvokeStoreMulti = class _InvokeStoreMulti extends InvokeStoreBase {
1816
+ als;
1817
+ static async create() {
1818
+ const instance = new _InvokeStoreMulti();
1819
+ const asyncHooks = await import("async_hooks");
1820
+ instance.als = new asyncHooks.AsyncLocalStorage();
1821
+ return instance;
1822
+ }
1823
+ getContext() {
1824
+ return this.als.getStore();
1825
+ }
1826
+ hasContext() {
1827
+ return this.als.getStore() !== void 0;
1828
+ }
1829
+ get(key) {
1830
+ return this.als.getStore()?.[key];
1831
+ }
1832
+ set(key, value) {
1833
+ if (this.isProtectedKey(key)) {
1834
+ throw new Error(`Cannot modify protected Lambda context field: ${String(key)}`);
1835
+ }
1836
+ const store = this.als.getStore();
1837
+ if (!store) {
1838
+ throw new Error("No context available");
1839
+ }
1840
+ store[key] = value;
1841
+ }
1842
+ run(context, fn) {
1843
+ return this.als.run(context, fn);
1844
+ }
1845
+ };
1846
+ var InvokeStore;
1847
+ (function(InvokeStore2) {
1848
+ let instance = null;
1849
+ async function getInstanceAsync() {
1850
+ if (!instance) {
1851
+ instance = (async () => {
1852
+ const isMulti = "AWS_LAMBDA_MAX_CONCURRENCY" in process.env;
1853
+ const newInstance = isMulti ? await InvokeStoreMulti.create() : new InvokeStoreSingle();
1854
+ if (!NO_GLOBAL_AWS_LAMBDA && globalThis.awslambda?.InvokeStore) {
1855
+ return globalThis.awslambda.InvokeStore;
1856
+ } else if (!NO_GLOBAL_AWS_LAMBDA && globalThis.awslambda) {
1857
+ globalThis.awslambda.InvokeStore = newInstance;
1858
+ return newInstance;
1859
+ } else {
1860
+ return newInstance;
1861
+ }
1862
+ })();
1863
+ }
1864
+ return instance;
1865
+ }
1866
+ InvokeStore2.getInstanceAsync = getInstanceAsync;
1867
+ InvokeStore2._testing = process.env.AWS_LAMBDA_BENCHMARK_MODE === "1" ? {
1868
+ reset: () => {
1869
+ instance = null;
1870
+ if (globalThis.awslambda?.InvokeStore) {
1871
+ delete globalThis.awslambda.InvokeStore;
1872
+ }
1873
+ globalThis.awslambda = {};
1874
+ }
1875
+ } : void 0;
1876
+ })(InvokeStore || (InvokeStore = {}));
483
1877
  var TRACE_ID_HEADER_NAME = "X-Amzn-Trace-Id";
484
1878
  var ENV_LAMBDA_FUNCTION_NAME = "AWS_LAMBDA_FUNCTION_NAME";
485
1879
  var ENV_TRACE_ID = "_X_AMZN_TRACE_ID";
486
- var recursionDetectionMiddleware = (options) => (next) => async (args) => {
1880
+ var recursionDetectionMiddleware = () => (next) => async (args) => {
487
1881
  const { request } = args;
488
- if (!HttpRequest.isInstance(request) || options.runtime !== "node") {
1882
+ if (!HttpRequest.isInstance(request)) {
489
1883
  return next(args);
490
1884
  }
491
1885
  const traceIdHeader = Object.keys(request.headers ?? {}).find((h) => h.toLowerCase() === TRACE_ID_HEADER_NAME.toLowerCase()) ?? TRACE_ID_HEADER_NAME;
@@ -493,7 +1887,10 @@ var recursionDetectionMiddleware = (options) => (next) => async (args) => {
493
1887
  return next(args);
494
1888
  }
495
1889
  const functionName = process.env[ENV_LAMBDA_FUNCTION_NAME];
496
- const traceId = process.env[ENV_TRACE_ID];
1890
+ const traceIdFromEnv = process.env[ENV_TRACE_ID];
1891
+ const invokeStore = await InvokeStore.getInstanceAsync();
1892
+ const traceIdFromInvokeStore = invokeStore?.getXRayTraceId();
1893
+ const traceId = traceIdFromInvokeStore ?? traceIdFromEnv;
497
1894
  const nonEmptyString = (str) => typeof str === "string" && str.length > 0;
498
1895
  if (nonEmptyString(functionName) && nonEmptyString(traceId)) {
499
1896
  request.headers[TRACE_ID_HEADER_NAME] = traceId;
@@ -503,19 +1900,11 @@ var recursionDetectionMiddleware = (options) => (next) => async (args) => {
503
1900
  request
504
1901
  });
505
1902
  };
506
- var addRecursionDetectionMiddlewareOptions = {
507
- step: "build",
508
- tags: ["RECURSION_DETECTION"],
509
- name: "recursionDetectionMiddleware",
510
- override: true,
511
- priority: "low"
512
- };
513
1903
  var getRecursionDetectionPlugin = (options) => ({
514
1904
  applyToStack: (clientStack) => {
515
- clientStack.add(recursionDetectionMiddleware(options), addRecursionDetectionMiddlewareOptions);
1905
+ clientStack.add(recursionDetectionMiddleware(), recursionDetectionMiddlewareOptions);
516
1906
  }
517
1907
  });
518
- init_esm_shims();
519
1908
  var DEFAULT_UA_APP_ID = void 0;
520
1909
  function isValidUserAgentAppId(appId) {
521
1910
  if (appId === void 0) {
@@ -542,15 +1931,11 @@ function resolveUserAgentConfig(input) {
542
1931
  }
543
1932
  });
544
1933
  }
545
- init_esm_shims();
546
- init_esm_shims();
547
- init_esm_shims();
548
- init_esm_shims();
549
- init_esm_shims();
550
1934
  var EndpointCache = class {
1935
+ capacity;
1936
+ data = /* @__PURE__ */ new Map();
1937
+ parameters = [];
551
1938
  constructor({ size, params }) {
552
- this.data = /* @__PURE__ */ new Map();
553
- this.parameters = [];
554
1939
  this.capacity = size ?? 50;
555
1940
  if (params) {
556
1941
  this.parameters = params;
@@ -596,10 +1981,8 @@ var EndpointCache = class {
596
1981
  return buffer;
597
1982
  }
598
1983
  };
599
- init_esm_shims();
600
1984
  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}$`);
601
1985
  var isIpAddress = (value) => IP_V4_REGEX.test(value) || value.startsWith("[") && value.endsWith("]");
602
- init_esm_shims();
603
1986
  var VALID_HOST_LABEL_REGEX = new RegExp(`^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$`);
604
1987
  var isValidHostLabel = (value, allowSubDomains = false) => {
605
1988
  if (!allowSubDomains) {
@@ -613,13 +1996,8 @@ var isValidHostLabel = (value, allowSubDomains = false) => {
613
1996
  }
614
1997
  return true;
615
1998
  };
616
- init_esm_shims();
617
1999
  var customEndpointFunctions = {};
618
- init_esm_shims();
619
- init_esm_shims();
620
- init_esm_shims();
621
2000
  var debugId = "endpoints";
622
- init_esm_shims();
623
2001
  function toDebugString(input) {
624
2002
  if (typeof input !== "object" || input == null) {
625
2003
  return input;
@@ -632,32 +2010,13 @@ function toDebugString(input) {
632
2010
  }
633
2011
  return JSON.stringify(input, null, 2);
634
2012
  }
635
- init_esm_shims();
636
- init_esm_shims();
637
2013
  var EndpointError = class extends Error {
638
2014
  constructor(message) {
639
2015
  super(message);
640
2016
  this.name = "EndpointError";
641
2017
  }
642
2018
  };
643
- init_esm_shims();
644
- init_esm_shims();
645
- init_esm_shims();
646
- init_esm_shims();
647
- init_esm_shims();
648
- init_esm_shims();
649
- init_esm_shims();
650
- init_esm_shims();
651
- init_esm_shims();
652
- init_esm_shims();
653
- init_esm_shims();
654
- init_esm_shims();
655
- init_esm_shims();
656
- init_esm_shims();
657
- init_esm_shims();
658
2019
  var booleanEquals = (value1, value2) => value1 === value2;
659
- init_esm_shims();
660
- init_esm_shims();
661
2020
  var getAttrPathList = (path) => {
662
2021
  const parts = path.split(".");
663
2022
  const pathList = [];
@@ -689,11 +2048,8 @@ var getAttr = (value, path) => getAttrPathList(path).reduce((acc, index) => {
689
2048
  }
690
2049
  return acc[index];
691
2050
  }, value);
692
- init_esm_shims();
693
2051
  var isSet = (value) => value != null;
694
- init_esm_shims();
695
2052
  var not = (value) => !value;
696
- init_esm_shims();
697
2053
  var DEFAULT_PORTS = {
698
2054
  [EndpointURLScheme.HTTP]: 80,
699
2055
  [EndpointURLScheme.HTTPS]: 443
@@ -739,9 +2095,7 @@ var parseURL = (value) => {
739
2095
  isIp
740
2096
  };
741
2097
  };
742
- init_esm_shims();
743
2098
  var stringEquals = (value1, value2) => value1 === value2;
744
- init_esm_shims();
745
2099
  var substring = (input, start, stop, reverse) => {
746
2100
  if (start >= stop || input.length < stop) {
747
2101
  return null;
@@ -751,7 +2105,6 @@ var substring = (input, start, stop, reverse) => {
751
2105
  }
752
2106
  return input.substring(input.length - stop, input.length - start);
753
2107
  };
754
- init_esm_shims();
755
2108
  var uriEncode = (value) => encodeURIComponent(value).replace(/[!*'()]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`);
756
2109
  var endpointFunctions = {
757
2110
  booleanEquals,
@@ -764,8 +2117,6 @@ var endpointFunctions = {
764
2117
  substring,
765
2118
  uriEncode
766
2119
  };
767
- init_esm_shims();
768
- init_esm_shims();
769
2120
  var evaluateTemplate = (template, options) => {
770
2121
  const evaluatedTemplateArr = [];
771
2122
  const templateContext = {
@@ -800,7 +2151,6 @@ var evaluateTemplate = (template, options) => {
800
2151
  }
801
2152
  return evaluatedTemplateArr.join("");
802
2153
  };
803
- init_esm_shims();
804
2154
  var getReferenceValue = ({ ref }, options) => {
805
2155
  const referenceRecord = {
806
2156
  ...options.endpointParams,
@@ -812,20 +2162,24 @@ var evaluateExpression = (obj, keyName, options) => {
812
2162
  if (typeof obj === "string") {
813
2163
  return evaluateTemplate(obj, options);
814
2164
  } else if (obj["fn"]) {
815
- return callFunction(obj, options);
2165
+ return group.callFunction(obj, options);
816
2166
  } else if (obj["ref"]) {
817
2167
  return getReferenceValue(obj, options);
818
2168
  }
819
2169
  throw new EndpointError(`'${keyName}': ${String(obj)} is not a string, function or reference.`);
820
2170
  };
821
2171
  var callFunction = ({ fn, argv }, options) => {
822
- const evaluatedArgs = argv.map((arg) => ["boolean", "number"].includes(typeof arg) ? arg : evaluateExpression(arg, "arg", options));
2172
+ const evaluatedArgs = argv.map((arg) => ["boolean", "number"].includes(typeof arg) ? arg : group.evaluateExpression(arg, "arg", options));
823
2173
  const fnSegments = fn.split(".");
824
2174
  if (fnSegments[0] in customEndpointFunctions && fnSegments[1] != null) {
825
2175
  return customEndpointFunctions[fnSegments[0]][fnSegments[1]](...evaluatedArgs);
826
2176
  }
827
2177
  return endpointFunctions[fn](...evaluatedArgs);
828
2178
  };
2179
+ var group = {
2180
+ evaluateExpression,
2181
+ callFunction
2182
+ };
829
2183
  var evaluateCondition = ({ assign, ...fnArgs }, options) => {
830
2184
  if (assign && assign in options.referenceRecord) {
831
2185
  throw new EndpointError(`'${assign}' is already defined in Reference Record.`);
@@ -857,7 +2211,6 @@ var evaluateConditions = (conditions = [], options) => {
857
2211
  }
858
2212
  return { result: true, referenceRecord: conditionsReferenceRecord };
859
2213
  };
860
- init_esm_shims();
861
2214
  var getEndpointHeaders = (headers, options) => Object.entries(headers).reduce((acc, [headerKey, headerVal]) => ({
862
2215
  ...acc,
863
2216
  [headerKey]: headerVal.map((headerValEntry) => {
@@ -868,8 +2221,10 @@ var getEndpointHeaders = (headers, options) => Object.entries(headers).reduce((a
868
2221
  return processedExpr;
869
2222
  })
870
2223
  }), {});
871
- init_esm_shims();
872
- init_esm_shims();
2224
+ var getEndpointProperties = (properties, options) => Object.entries(properties).reduce((acc, [propertyKey, propertyVal]) => ({
2225
+ ...acc,
2226
+ [propertyKey]: group2.getEndpointProperty(propertyVal, options)
2227
+ }), {});
873
2228
  var getEndpointProperty = (property, options) => {
874
2229
  if (Array.isArray(property)) {
875
2230
  return property.map((propertyEntry) => getEndpointProperty(propertyEntry, options));
@@ -881,18 +2236,17 @@ var getEndpointProperty = (property, options) => {
881
2236
  if (property === null) {
882
2237
  throw new EndpointError(`Unexpected endpoint property: ${property}`);
883
2238
  }
884
- return getEndpointProperties(property, options);
2239
+ return group2.getEndpointProperties(property, options);
885
2240
  case "boolean":
886
2241
  return property;
887
2242
  default:
888
2243
  throw new EndpointError(`Unexpected endpoint property type: ${typeof property}`);
889
2244
  }
890
2245
  };
891
- var getEndpointProperties = (properties, options) => Object.entries(properties).reduce((acc, [propertyKey, propertyVal]) => ({
892
- ...acc,
893
- [propertyKey]: getEndpointProperty(propertyVal, options)
894
- }), {});
895
- init_esm_shims();
2246
+ var group2 = {
2247
+ getEndpointProperty,
2248
+ getEndpointProperties
2249
+ };
896
2250
  var getEndpointUrl = (endpointUrl, options) => {
897
2251
  const expression = evaluateExpression(endpointUrl, "Endpoint URL", options);
898
2252
  if (typeof expression === "string") {
@@ -927,7 +2281,6 @@ var evaluateEndpointRule = (endpointRule, options) => {
927
2281
  url: getEndpointUrl(url, endpointRuleOptions)
928
2282
  };
929
2283
  };
930
- init_esm_shims();
931
2284
  var evaluateErrorRule = (errorRule, options) => {
932
2285
  const { conditions, error } = errorRule;
933
2286
  const { result, referenceRecord } = evaluateConditions(conditions, options);
@@ -939,18 +2292,6 @@ var evaluateErrorRule = (errorRule, options) => {
939
2292
  referenceRecord: { ...options.referenceRecord, ...referenceRecord }
940
2293
  }));
941
2294
  };
942
- init_esm_shims();
943
- var evaluateTreeRule = (treeRule, options) => {
944
- const { conditions, rules } = treeRule;
945
- const { result, referenceRecord } = evaluateConditions(conditions, options);
946
- if (!result) {
947
- return;
948
- }
949
- return evaluateRules(rules, {
950
- ...options,
951
- referenceRecord: { ...options.referenceRecord, ...referenceRecord }
952
- });
953
- };
954
2295
  var evaluateRules = (rules, options) => {
955
2296
  for (const rule of rules) {
956
2297
  if (rule.type === "endpoint") {
@@ -961,7 +2302,7 @@ var evaluateRules = (rules, options) => {
961
2302
  } else if (rule.type === "error") {
962
2303
  evaluateErrorRule(rule, options);
963
2304
  } else if (rule.type === "tree") {
964
- const endpointOrUndefined = evaluateTreeRule(rule, options);
2305
+ const endpointOrUndefined = group3.evaluateTreeRule(rule, options);
965
2306
  if (endpointOrUndefined) {
966
2307
  return endpointOrUndefined;
967
2308
  }
@@ -969,7 +2310,22 @@ var evaluateRules = (rules, options) => {
969
2310
  throw new EndpointError(`Unknown endpoint rule: ${rule}`);
970
2311
  }
971
2312
  }
972
- throw new EndpointError(`Rules evaluation failed`);
2313
+ throw new EndpointError(`Rules evaluation failed`);
2314
+ };
2315
+ var evaluateTreeRule = (treeRule, options) => {
2316
+ const { conditions, rules } = treeRule;
2317
+ const { result, referenceRecord } = evaluateConditions(conditions, options);
2318
+ if (!result) {
2319
+ return;
2320
+ }
2321
+ return group3.evaluateRules(rules, {
2322
+ ...options,
2323
+ referenceRecord: { ...options.referenceRecord, ...referenceRecord }
2324
+ });
2325
+ };
2326
+ var group3 = {
2327
+ evaluateRules,
2328
+ evaluateTreeRule
973
2329
  };
974
2330
  var resolveEndpoint = (ruleSetObject, options) => {
975
2331
  const { endpointParams, logger } = options;
@@ -991,8 +2347,6 @@ var resolveEndpoint = (ruleSetObject, options) => {
991
2347
  options.logger?.debug?.(`${debugId} Resolved endpoint: ${toDebugString(endpoint)}`);
992
2348
  return endpoint;
993
2349
  };
994
- init_esm_shims();
995
- init_esm_shims();
996
2350
  var isVirtualHostableS3Bucket = (value, allowSubDomains = false) => {
997
2351
  if (allowSubDomains) {
998
2352
  for (const label of value.split(".")) {
@@ -1016,7 +2370,6 @@ var isVirtualHostableS3Bucket = (value, allowSubDomains = false) => {
1016
2370
  }
1017
2371
  return true;
1018
2372
  };
1019
- init_esm_shims();
1020
2373
  var ARN_DELIMITER = ":";
1021
2374
  var RESOURCE_DELIMITER = "/";
1022
2375
  var parseArn = (value) => {
@@ -1035,7 +2388,6 @@ var parseArn = (value) => {
1035
2388
  resourceId
1036
2389
  };
1037
2390
  };
1038
- init_esm_shims();
1039
2391
  var partitions_default = {
1040
2392
  partitions: [{
1041
2393
  id: "aws",
@@ -1055,6 +2407,9 @@ var partitions_default = {
1055
2407
  "ap-east-1": {
1056
2408
  description: "Asia Pacific (Hong Kong)"
1057
2409
  },
2410
+ "ap-east-2": {
2411
+ description: "Asia Pacific (Taipei)"
2412
+ },
1058
2413
  "ap-northeast-1": {
1059
2414
  description: "Asia Pacific (Tokyo)"
1060
2415
  },
@@ -1085,11 +2440,14 @@ var partitions_default = {
1085
2440
  "ap-southeast-5": {
1086
2441
  description: "Asia Pacific (Malaysia)"
1087
2442
  },
2443
+ "ap-southeast-6": {
2444
+ description: "Asia Pacific (New Zealand)"
2445
+ },
1088
2446
  "ap-southeast-7": {
1089
2447
  description: "Asia Pacific (Thailand)"
1090
2448
  },
1091
2449
  "aws-global": {
1092
- description: "AWS Standard global region"
2450
+ description: "aws global region"
1093
2451
  },
1094
2452
  "ca-central-1": {
1095
2453
  description: "Canada (Central)"
@@ -1162,7 +2520,7 @@ var partitions_default = {
1162
2520
  regionRegex: "^cn\\-\\w+\\-\\d+$",
1163
2521
  regions: {
1164
2522
  "aws-cn-global": {
1165
- description: "AWS China global region"
2523
+ description: "aws-cn global region"
1166
2524
  },
1167
2525
  "cn-north-1": {
1168
2526
  description: "China (Beijing)"
@@ -1172,41 +2530,35 @@ var partitions_default = {
1172
2530
  }
1173
2531
  }
1174
2532
  }, {
1175
- id: "aws-us-gov",
2533
+ id: "aws-eusc",
1176
2534
  outputs: {
1177
- dnsSuffix: "amazonaws.com",
1178
- dualStackDnsSuffix: "api.aws",
1179
- implicitGlobalRegion: "us-gov-west-1",
1180
- name: "aws-us-gov",
2535
+ dnsSuffix: "amazonaws.eu",
2536
+ dualStackDnsSuffix: "api.amazonwebservices.eu",
2537
+ implicitGlobalRegion: "eusc-de-east-1",
2538
+ name: "aws-eusc",
1181
2539
  supportsDualStack: true,
1182
2540
  supportsFIPS: true
1183
2541
  },
1184
- regionRegex: "^us\\-gov\\-\\w+\\-\\d+$",
2542
+ regionRegex: "^eusc\\-(de)\\-\\w+\\-\\d+$",
1185
2543
  regions: {
1186
- "aws-us-gov-global": {
1187
- description: "AWS GovCloud (US) global region"
1188
- },
1189
- "us-gov-east-1": {
1190
- description: "AWS GovCloud (US-East)"
1191
- },
1192
- "us-gov-west-1": {
1193
- description: "AWS GovCloud (US-West)"
2544
+ "eusc-de-east-1": {
2545
+ description: "EU (Germany)"
1194
2546
  }
1195
2547
  }
1196
2548
  }, {
1197
2549
  id: "aws-iso",
1198
2550
  outputs: {
1199
2551
  dnsSuffix: "c2s.ic.gov",
1200
- dualStackDnsSuffix: "c2s.ic.gov",
2552
+ dualStackDnsSuffix: "api.aws.ic.gov",
1201
2553
  implicitGlobalRegion: "us-iso-east-1",
1202
2554
  name: "aws-iso",
1203
- supportsDualStack: false,
2555
+ supportsDualStack: true,
1204
2556
  supportsFIPS: true
1205
2557
  },
1206
2558
  regionRegex: "^us\\-iso\\-\\w+\\-\\d+$",
1207
2559
  regions: {
1208
2560
  "aws-iso-global": {
1209
- description: "AWS ISO (US) global region"
2561
+ description: "aws-iso global region"
1210
2562
  },
1211
2563
  "us-iso-east-1": {
1212
2564
  description: "US ISO East"
@@ -1219,35 +2571,38 @@ var partitions_default = {
1219
2571
  id: "aws-iso-b",
1220
2572
  outputs: {
1221
2573
  dnsSuffix: "sc2s.sgov.gov",
1222
- dualStackDnsSuffix: "sc2s.sgov.gov",
2574
+ dualStackDnsSuffix: "api.aws.scloud",
1223
2575
  implicitGlobalRegion: "us-isob-east-1",
1224
2576
  name: "aws-iso-b",
1225
- supportsDualStack: false,
2577
+ supportsDualStack: true,
1226
2578
  supportsFIPS: true
1227
2579
  },
1228
2580
  regionRegex: "^us\\-isob\\-\\w+\\-\\d+$",
1229
2581
  regions: {
1230
2582
  "aws-iso-b-global": {
1231
- description: "AWS ISOB (US) global region"
2583
+ description: "aws-iso-b global region"
1232
2584
  },
1233
2585
  "us-isob-east-1": {
1234
2586
  description: "US ISOB East (Ohio)"
2587
+ },
2588
+ "us-isob-west-1": {
2589
+ description: "US ISOB West"
1235
2590
  }
1236
2591
  }
1237
2592
  }, {
1238
2593
  id: "aws-iso-e",
1239
2594
  outputs: {
1240
2595
  dnsSuffix: "cloud.adc-e.uk",
1241
- dualStackDnsSuffix: "cloud.adc-e.uk",
2596
+ dualStackDnsSuffix: "api.cloud-aws.adc-e.uk",
1242
2597
  implicitGlobalRegion: "eu-isoe-west-1",
1243
2598
  name: "aws-iso-e",
1244
- supportsDualStack: false,
2599
+ supportsDualStack: true,
1245
2600
  supportsFIPS: true
1246
2601
  },
1247
2602
  regionRegex: "^eu\\-isoe\\-\\w+\\-\\d+$",
1248
2603
  regions: {
1249
2604
  "aws-iso-e-global": {
1250
- description: "AWS ISOE (Europe) global region"
2605
+ description: "aws-iso-e global region"
1251
2606
  },
1252
2607
  "eu-isoe-west-1": {
1253
2608
  description: "EU ISOE West"
@@ -1257,16 +2612,16 @@ var partitions_default = {
1257
2612
  id: "aws-iso-f",
1258
2613
  outputs: {
1259
2614
  dnsSuffix: "csp.hci.ic.gov",
1260
- dualStackDnsSuffix: "csp.hci.ic.gov",
2615
+ dualStackDnsSuffix: "api.aws.hci.ic.gov",
1261
2616
  implicitGlobalRegion: "us-isof-south-1",
1262
2617
  name: "aws-iso-f",
1263
- supportsDualStack: false,
2618
+ supportsDualStack: true,
1264
2619
  supportsFIPS: true
1265
2620
  },
1266
2621
  regionRegex: "^us\\-isof\\-\\w+\\-\\d+$",
1267
2622
  regions: {
1268
2623
  "aws-iso-f-global": {
1269
- description: "AWS ISOF global region"
2624
+ description: "aws-iso-f global region"
1270
2625
  },
1271
2626
  "us-isof-east-1": {
1272
2627
  description: "US ISOF EAST"
@@ -1276,19 +2631,25 @@ var partitions_default = {
1276
2631
  }
1277
2632
  }
1278
2633
  }, {
1279
- id: "aws-eusc",
2634
+ id: "aws-us-gov",
1280
2635
  outputs: {
1281
- dnsSuffix: "amazonaws.eu",
1282
- dualStackDnsSuffix: "amazonaws.eu",
1283
- implicitGlobalRegion: "eusc-de-east-1",
1284
- name: "aws-eusc",
1285
- supportsDualStack: false,
2636
+ dnsSuffix: "amazonaws.com",
2637
+ dualStackDnsSuffix: "api.aws",
2638
+ implicitGlobalRegion: "us-gov-west-1",
2639
+ name: "aws-us-gov",
2640
+ supportsDualStack: true,
1286
2641
  supportsFIPS: true
1287
2642
  },
1288
- regionRegex: "^eusc\\-(de)\\-\\w+\\-\\d+$",
2643
+ regionRegex: "^us\\-gov\\-\\w+\\-\\d+$",
1289
2644
  regions: {
1290
- "eusc-de-east-1": {
1291
- description: "EU (Germany)"
2645
+ "aws-us-gov-global": {
2646
+ description: "aws-us-gov global region"
2647
+ },
2648
+ "us-gov-east-1": {
2649
+ description: "AWS GovCloud (US-East)"
2650
+ },
2651
+ "us-gov-west-1": {
2652
+ description: "AWS GovCloud (US-West)"
1292
2653
  }
1293
2654
  }
1294
2655
  }],
@@ -1332,16 +2693,6 @@ var awsEndpointFunctions = {
1332
2693
  partition
1333
2694
  };
1334
2695
  customEndpointFunctions.aws = awsEndpointFunctions;
1335
- init_esm_shims();
1336
- init_esm_shims();
1337
- init_esm_shims();
1338
- init_esm_shims();
1339
- init_esm_shims();
1340
- init_esm_shims();
1341
- init_esm_shims();
1342
- init_esm_shims();
1343
- init_esm_shims();
1344
- init_esm_shims();
1345
2696
  var state = {
1346
2697
  warningEmitted: false
1347
2698
  };
@@ -1357,7 +2708,6 @@ updates please upgrade to a supported Node.js LTS version.
1357
2708
  More information can be found at: https://a.co/74kJMmI`);
1358
2709
  }
1359
2710
  };
1360
- init_esm_shims();
1361
2711
  function setFeature2(context, feature, value) {
1362
2712
  if (!context.__aws_sdk_context) {
1363
2713
  context.__aws_sdk_context = {
@@ -1368,14 +2718,8 @@ function setFeature2(context, feature, value) {
1368
2718
  }
1369
2719
  context.__aws_sdk_context.features[feature] = value;
1370
2720
  }
1371
- init_esm_shims();
1372
- init_esm_shims();
1373
- init_esm_shims();
1374
2721
  var getDateHeader = (response) => HttpResponse.isInstance(response) ? response.headers?.date ?? response.headers?.Date : void 0;
1375
- init_esm_shims();
1376
2722
  var getSkewCorrectedDate = (systemClockOffset) => new Date(Date.now() + systemClockOffset);
1377
- init_esm_shims();
1378
- init_esm_shims();
1379
2723
  var isClockSkewed = (clockTime, systemClockOffset) => Math.abs(getSkewCorrectedDate(systemClockOffset).getTime() - clockTime) >= 3e5;
1380
2724
  var getUpdatedSystemClockOffset = (clockTime, currentSystemClockOffset) => {
1381
2725
  const clockTimeInMs = Date.parse(clockTime);
@@ -1453,7 +2797,6 @@ var AwsSdkSigV4Signer = class {
1453
2797
  }
1454
2798
  }
1455
2799
  };
1456
- init_esm_shims();
1457
2800
  var AwsSdkSigV4ASigner = class extends AwsSdkSigV4Signer {
1458
2801
  async sign(httpRequest, identity, signingProperties) {
1459
2802
  if (!HttpRequest.isInstance(httpRequest)) {
@@ -1470,10 +2813,7 @@ var AwsSdkSigV4ASigner = class extends AwsSdkSigV4Signer {
1470
2813
  return signedRequest;
1471
2814
  }
1472
2815
  };
1473
- init_esm_shims();
1474
- init_esm_shims();
1475
2816
  var getArrayForCommaSeparatedString = (str) => typeof str === "string" && str.length > 0 ? str.split(",").map((item) => item.trim()) : [];
1476
- init_esm_shims();
1477
2817
  var getBearerTokenEnvKey = (signingName) => `AWS_BEARER_TOKEN_${signingName.replace(/[\s-]/g, "_").toUpperCase()}`;
1478
2818
  var NODE_AUTH_SCHEME_PREFERENCE_ENV_KEY = "AWS_AUTH_SCHEME_PREFERENCE";
1479
2819
  var NODE_AUTH_SCHEME_PREFERENCE_CONFIG_KEY = "auth_scheme_preference";
@@ -1495,7 +2835,6 @@ var NODE_AUTH_SCHEME_PREFERENCE_OPTIONS = {
1495
2835
  },
1496
2836
  default: []
1497
2837
  };
1498
- init_esm_shims();
1499
2838
  var resolveAwsSdkSigV4AConfig = (config) => {
1500
2839
  config.sigv4aSigningRegionSet = normalizeProvider2(config.sigv4aSigningRegionSet);
1501
2840
  return config;
@@ -1519,10 +2858,6 @@ var NODE_SIGV4A_CONFIG_OPTIONS = {
1519
2858
  },
1520
2859
  default: void 0
1521
2860
  };
1522
- init_esm_shims();
1523
- init_esm_shims();
1524
- init_esm_shims();
1525
- init_esm_shims();
1526
2861
  var ALGORITHM_QUERY_PARAM = "X-Amz-Algorithm";
1527
2862
  var CREDENTIAL_QUERY_PARAM = "X-Amz-Credential";
1528
2863
  var AMZ_DATE_QUERY_PARAM = "X-Amz-Date";
@@ -1562,7 +2897,6 @@ var UNSIGNED_PAYLOAD = "UNSIGNED-PAYLOAD";
1562
2897
  var MAX_CACHE_SIZE = 50;
1563
2898
  var KEY_TYPE_IDENTIFIER = "aws4_request";
1564
2899
  var MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7;
1565
- init_esm_shims();
1566
2900
  var signingKeyCache = {};
1567
2901
  var cacheQueue = [];
1568
2902
  var createScope = (shortDate, region, service) => `${shortDate}/${region}/${service}/${KEY_TYPE_IDENTIFIER}`;
@@ -1587,7 +2921,6 @@ var hmac = (ctor, secret, data) => {
1587
2921
  hash.update(toUint8Array(data));
1588
2922
  return hash.digest();
1589
2923
  };
1590
- init_esm_shims();
1591
2924
  var getCanonicalHeaders = ({ headers }, unsignableHeaders, signableHeaders) => {
1592
2925
  const canonical = {};
1593
2926
  for (const headerName of Object.keys(headers).sort()) {
@@ -1604,7 +2937,6 @@ var getCanonicalHeaders = ({ headers }, unsignableHeaders, signableHeaders) => {
1604
2937
  }
1605
2938
  return canonical;
1606
2939
  };
1607
- init_esm_shims();
1608
2940
  var getPayloadHash = async ({ headers, body }, hashConstructor) => {
1609
2941
  for (const headerName of Object.keys(headers)) {
1610
2942
  if (headerName.toLowerCase() === SHA256_HEADER) {
@@ -1620,7 +2952,6 @@ var getPayloadHash = async ({ headers, body }, hashConstructor) => {
1620
2952
  }
1621
2953
  return UNSIGNED_PAYLOAD;
1622
2954
  };
1623
- init_esm_shims();
1624
2955
  var HeaderFormatter = class {
1625
2956
  format(headers) {
1626
2957
  const chunks = [];
@@ -1703,6 +3034,7 @@ var HEADER_VALUE_TYPE;
1703
3034
  })(HEADER_VALUE_TYPE || (HEADER_VALUE_TYPE = {}));
1704
3035
  var UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
1705
3036
  var Int64 = class _Int64 {
3037
+ bytes;
1706
3038
  constructor(bytes) {
1707
3039
  this.bytes = bytes;
1708
3040
  if (bytes.byteLength !== 8) {
@@ -1744,7 +3076,6 @@ function negate(bytes) {
1744
3076
  break;
1745
3077
  }
1746
3078
  }
1747
- init_esm_shims();
1748
3079
  var hasHeader = (soughtHeader, headers) => {
1749
3080
  soughtHeader = soughtHeader.toLowerCase();
1750
3081
  for (const headerName of Object.keys(headers)) {
@@ -1754,7 +3085,6 @@ var hasHeader = (soughtHeader, headers) => {
1754
3085
  }
1755
3086
  return false;
1756
3087
  };
1757
- init_esm_shims();
1758
3088
  var moveHeadersToQuery = (request, options = {}) => {
1759
3089
  const { headers, query = {} } = HttpRequest.clone(request);
1760
3090
  for (const name of Object.keys(headers)) {
@@ -1770,7 +3100,6 @@ var moveHeadersToQuery = (request, options = {}) => {
1770
3100
  query
1771
3101
  };
1772
3102
  };
1773
- init_esm_shims();
1774
3103
  var prepareRequest = (request) => {
1775
3104
  request = HttpRequest.clone(request);
1776
3105
  for (const headerName of Object.keys(request.headers)) {
@@ -1780,8 +3109,6 @@ var prepareRequest = (request) => {
1780
3109
  }
1781
3110
  return request;
1782
3111
  };
1783
- init_esm_shims();
1784
- init_esm_shims();
1785
3112
  var getCanonicalQuery = ({ query = {} }) => {
1786
3113
  const keys = [];
1787
3114
  const serialized = {};
@@ -1800,21 +3127,26 @@ var getCanonicalQuery = ({ query = {} }) => {
1800
3127
  }
1801
3128
  return keys.sort().map((key) => serialized[key]).filter((serialized2) => serialized2).join("&");
1802
3129
  };
1803
- init_esm_shims();
1804
- var iso8601 = (time) => toDate(time).toISOString().replace(/\.\d{3}Z$/, "Z");
1805
- var toDate = (time) => {
1806
- if (typeof time === "number") {
1807
- return new Date(time * 1e3);
1808
- }
1809
- if (typeof time === "string") {
1810
- if (Number(time)) {
1811
- return new Date(Number(time) * 1e3);
3130
+ var iso8601 = (time2) => toDate(time2).toISOString().replace(/\.\d{3}Z$/, "Z");
3131
+ var toDate = (time2) => {
3132
+ if (typeof time2 === "number") {
3133
+ return new Date(time2 * 1e3);
3134
+ }
3135
+ if (typeof time2 === "string") {
3136
+ if (Number(time2)) {
3137
+ return new Date(Number(time2) * 1e3);
1812
3138
  }
1813
- return new Date(time);
3139
+ return new Date(time2);
1814
3140
  }
1815
- return time;
3141
+ return time2;
1816
3142
  };
1817
3143
  var SignatureV4Base = class {
3144
+ service;
3145
+ regionProvider;
3146
+ credentialProvider;
3147
+ sha256;
3148
+ uriEscapePath;
3149
+ applyChecksum;
1818
3150
  constructor({ applyChecksum, credentials, region, service, sha256, uriEscapePath = true }) {
1819
3151
  this.service = service;
1820
3152
  this.sha256 = sha256;
@@ -1879,6 +3211,7 @@ ${toHex(hashedRequest)}`;
1879
3211
  }
1880
3212
  };
1881
3213
  var SignatureV4 = class extends SignatureV4Base {
3214
+ headerFormatter = new HeaderFormatter();
1882
3215
  constructor({ applyChecksum, credentials, region, service, sha256, uriEscapePath = true }) {
1883
3216
  super({
1884
3217
  applyChecksum,
@@ -1888,7 +3221,6 @@ var SignatureV4 = class extends SignatureV4Base {
1888
3221
  sha256,
1889
3222
  uriEscapePath
1890
3223
  });
1891
- this.headerFormatter = new HeaderFormatter();
1892
3224
  }
1893
3225
  async presign(originalRequest, options = {}) {
1894
3226
  const { signingDate = /* @__PURE__ */ new Date(), expiresIn = 3600, unsignableHeaders, unhoistableHeaders, signableHeaders, hoistableHeaders, signingRegion, signingService } = options;
@@ -1995,10 +3327,6 @@ var SignatureV4 = class extends SignatureV4Base {
1995
3327
  return getSigningKey(this.sha256, credentials, shortDate, region, service || this.service);
1996
3328
  }
1997
3329
  };
1998
- init_esm_shims();
1999
- var signatureV4aContainer = {
2000
- SignatureV4a: null
2001
- };
2002
3330
  var resolveAwsSdkSigV4Config = (config) => {
2003
3331
  let inputCredentials = config.credentials;
2004
3332
  let isUserSupplied = !!config.credentials;
@@ -2118,8 +3446,240 @@ function bindCallerConfig(config, credentialsProvider) {
2118
3446
  fn.configBound = true;
2119
3447
  return fn;
2120
3448
  }
2121
- init_esm_shims();
2122
- var collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
3449
+ var loadConfigsForDefaultMode = (mode) => {
3450
+ switch (mode) {
3451
+ case "standard":
3452
+ return {
3453
+ retryMode: "standard",
3454
+ connectionTimeout: 3100
3455
+ };
3456
+ case "in-region":
3457
+ return {
3458
+ retryMode: "standard",
3459
+ connectionTimeout: 1100
3460
+ };
3461
+ case "cross-region":
3462
+ return {
3463
+ retryMode: "standard",
3464
+ connectionTimeout: 3100
3465
+ };
3466
+ case "mobile":
3467
+ return {
3468
+ retryMode: "standard",
3469
+ connectionTimeout: 3e4
3470
+ };
3471
+ default:
3472
+ return {};
3473
+ }
3474
+ };
3475
+ var warningEmitted = false;
3476
+ var emitWarningIfUnsupportedVersion2 = (version) => {
3477
+ if (version && !warningEmitted && parseInt(version.substring(1, version.indexOf("."))) < 16) {
3478
+ warningEmitted = true;
3479
+ }
3480
+ };
3481
+ var getChecksumConfiguration = (runtimeConfig) => {
3482
+ const checksumAlgorithms = [];
3483
+ for (const id in AlgorithmId) {
3484
+ const algorithmId = AlgorithmId[id];
3485
+ if (runtimeConfig[algorithmId] === void 0) {
3486
+ continue;
3487
+ }
3488
+ checksumAlgorithms.push({
3489
+ algorithmId: () => algorithmId,
3490
+ checksumConstructor: () => runtimeConfig[algorithmId]
3491
+ });
3492
+ }
3493
+ return {
3494
+ addChecksumAlgorithm(algo) {
3495
+ checksumAlgorithms.push(algo);
3496
+ },
3497
+ checksumAlgorithms() {
3498
+ return checksumAlgorithms;
3499
+ }
3500
+ };
3501
+ };
3502
+ var resolveChecksumRuntimeConfig = (clientConfig) => {
3503
+ const runtimeConfig = {};
3504
+ clientConfig.checksumAlgorithms().forEach((checksumAlgorithm) => {
3505
+ runtimeConfig[checksumAlgorithm.algorithmId()] = checksumAlgorithm.checksumConstructor();
3506
+ });
3507
+ return runtimeConfig;
3508
+ };
3509
+ var getRetryConfiguration = (runtimeConfig) => {
3510
+ return {
3511
+ setRetryStrategy(retryStrategy) {
3512
+ runtimeConfig.retryStrategy = retryStrategy;
3513
+ },
3514
+ retryStrategy() {
3515
+ return runtimeConfig.retryStrategy;
3516
+ }
3517
+ };
3518
+ };
3519
+ var resolveRetryRuntimeConfig = (retryStrategyConfiguration) => {
3520
+ const runtimeConfig = {};
3521
+ runtimeConfig.retryStrategy = retryStrategyConfiguration.retryStrategy();
3522
+ return runtimeConfig;
3523
+ };
3524
+ var getDefaultExtensionConfiguration = (runtimeConfig) => {
3525
+ return Object.assign(getChecksumConfiguration(runtimeConfig), getRetryConfiguration(runtimeConfig));
3526
+ };
3527
+ var resolveDefaultRuntimeConfig = (config) => {
3528
+ return Object.assign(resolveChecksumRuntimeConfig(config), resolveRetryRuntimeConfig(config));
3529
+ };
3530
+ var NoOpLogger = class {
3531
+ trace() {
3532
+ }
3533
+ debug() {
3534
+ }
3535
+ info() {
3536
+ }
3537
+ warn() {
3538
+ }
3539
+ error() {
3540
+ }
3541
+ };
3542
+ var ProtocolLib = class {
3543
+ queryCompat;
3544
+ constructor(queryCompat = false) {
3545
+ this.queryCompat = queryCompat;
3546
+ }
3547
+ resolveRestContentType(defaultContentType, inputSchema) {
3548
+ const members = inputSchema.getMemberSchemas();
3549
+ const httpPayloadMember = Object.values(members).find((m) => {
3550
+ return !!m.getMergedTraits().httpPayload;
3551
+ });
3552
+ if (httpPayloadMember) {
3553
+ const mediaType = httpPayloadMember.getMergedTraits().mediaType;
3554
+ if (mediaType) {
3555
+ return mediaType;
3556
+ } else if (httpPayloadMember.isStringSchema()) {
3557
+ return "text/plain";
3558
+ } else if (httpPayloadMember.isBlobSchema()) {
3559
+ return "application/octet-stream";
3560
+ } else {
3561
+ return defaultContentType;
3562
+ }
3563
+ } else if (!inputSchema.isUnitSchema()) {
3564
+ const hasBody = Object.values(members).find((m) => {
3565
+ const { httpQuery, httpQueryParams, httpHeader, httpLabel, httpPrefixHeaders } = m.getMergedTraits();
3566
+ const noPrefixHeaders = httpPrefixHeaders === void 0;
3567
+ return !httpQuery && !httpQueryParams && !httpHeader && !httpLabel && noPrefixHeaders;
3568
+ });
3569
+ if (hasBody) {
3570
+ return defaultContentType;
3571
+ }
3572
+ }
3573
+ }
3574
+ async getErrorSchemaOrThrowBaseException(errorIdentifier, defaultNamespace, response, dataObject, metadata, getErrorSchema) {
3575
+ let namespace = defaultNamespace;
3576
+ let errorName = errorIdentifier;
3577
+ if (errorIdentifier.includes("#")) {
3578
+ [namespace, errorName] = errorIdentifier.split("#");
3579
+ }
3580
+ const errorMetadata = {
3581
+ $metadata: metadata,
3582
+ $fault: response.statusCode < 500 ? "client" : "server"
3583
+ };
3584
+ const registry = TypeRegistry.for(namespace);
3585
+ try {
3586
+ const errorSchema = getErrorSchema?.(registry, errorName) ?? registry.getSchema(errorIdentifier);
3587
+ return { errorSchema, errorMetadata };
3588
+ } catch (e) {
3589
+ dataObject.message = dataObject.message ?? dataObject.Message ?? "UnknownError";
3590
+ const synthetic = TypeRegistry.for("smithy.ts.sdk.synthetic." + namespace);
3591
+ const baseExceptionSchema = synthetic.getBaseException();
3592
+ if (baseExceptionSchema) {
3593
+ const ErrorCtor = synthetic.getErrorCtor(baseExceptionSchema) ?? Error;
3594
+ throw this.decorateServiceException(Object.assign(new ErrorCtor({ name: errorName }), errorMetadata), dataObject);
3595
+ }
3596
+ throw this.decorateServiceException(Object.assign(new Error(errorName), errorMetadata), dataObject);
3597
+ }
3598
+ }
3599
+ decorateServiceException(exception, additions = {}) {
3600
+ if (this.queryCompat) {
3601
+ const msg = exception.Message ?? additions.Message;
3602
+ const error = decorateServiceException(exception, additions);
3603
+ if (msg) {
3604
+ error.Message = msg;
3605
+ error.message = msg;
3606
+ }
3607
+ return error;
3608
+ }
3609
+ return decorateServiceException(exception, additions);
3610
+ }
3611
+ setQueryCompatError(output, response) {
3612
+ const queryErrorHeader = response.headers?.["x-amzn-query-error"];
3613
+ if (output !== void 0 && queryErrorHeader != null) {
3614
+ const [Code, Type] = queryErrorHeader.split(";");
3615
+ const entries = Object.entries(output);
3616
+ const Error2 = {
3617
+ Code,
3618
+ Type
3619
+ };
3620
+ Object.assign(output, Error2);
3621
+ for (const [k, v] of entries) {
3622
+ Error2[k] = v;
3623
+ }
3624
+ delete Error2.__type;
3625
+ output.Error = Error2;
3626
+ }
3627
+ }
3628
+ queryCompatOutput(queryCompatErrorData, errorData) {
3629
+ if (queryCompatErrorData.Error) {
3630
+ errorData.Error = queryCompatErrorData.Error;
3631
+ }
3632
+ if (queryCompatErrorData.Type) {
3633
+ errorData.Type = queryCompatErrorData.Type;
3634
+ }
3635
+ if (queryCompatErrorData.Code) {
3636
+ errorData.Code = queryCompatErrorData.Code;
3637
+ }
3638
+ }
3639
+ };
3640
+ var SerdeContextConfig = class {
3641
+ serdeContext;
3642
+ setSerdeContext(serdeContext) {
3643
+ this.serdeContext = serdeContext;
3644
+ }
3645
+ };
3646
+ function* serializingStructIterator(ns, sourceObject) {
3647
+ if (ns.isUnitSchema()) {
3648
+ return;
3649
+ }
3650
+ const struct = ns.getSchema();
3651
+ for (let i = 0; i < struct[4].length; ++i) {
3652
+ const key = struct[4][i];
3653
+ const memberNs = new NormalizedSchema([struct[5][i], 0], key);
3654
+ if (!(key in sourceObject) && !memberNs.isIdempotencyToken()) {
3655
+ continue;
3656
+ }
3657
+ yield [key, memberNs];
3658
+ }
3659
+ }
3660
+ function* deserializingStructIterator(ns, sourceObject, nameTrait) {
3661
+ if (ns.isUnitSchema()) {
3662
+ return;
3663
+ }
3664
+ const struct = ns.getSchema();
3665
+ let keysRemaining = Object.keys(sourceObject).length;
3666
+ for (let i = 0; i < struct[4].length; ++i) {
3667
+ if (keysRemaining === 0) {
3668
+ break;
3669
+ }
3670
+ const key = struct[4][i];
3671
+ const memberNs = new NormalizedSchema([struct[5][i], 0], key);
3672
+ let serializationKey = key;
3673
+ if (nameTrait) {
3674
+ serializationKey = memberNs.getMergedTraits()[nameTrait] ?? key;
3675
+ }
3676
+ if (!(serializationKey in sourceObject)) {
3677
+ continue;
3678
+ }
3679
+ yield [key, memberNs];
3680
+ keysRemaining -= 1;
3681
+ }
3682
+ }
2123
3683
  var ACCOUNT_ID_ENDPOINT_REGEX = /\d{12}\.ddb/;
2124
3684
  async function checkFeatures(context, config, args) {
2125
3685
  const request = args.request;
@@ -2166,15 +3726,13 @@ async function checkFeatures(context, config, args) {
2166
3726
  }
2167
3727
  }
2168
3728
  }
2169
- init_esm_shims();
2170
3729
  var USER_AGENT = "user-agent";
2171
3730
  var X_AMZ_USER_AGENT = "x-amz-user-agent";
2172
3731
  var SPACE = " ";
2173
3732
  var UA_NAME_SEPARATOR = "/";
2174
- var UA_NAME_ESCAPE_REGEX = /[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g;
2175
- var UA_VALUE_ESCAPE_REGEX = /[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g;
3733
+ var UA_NAME_ESCAPE_REGEX = /[^!$%&'*+\-.^_`|~\w]/g;
3734
+ var UA_VALUE_ESCAPE_REGEX = /[^!$%&'*+\-.^_`|~\w#]/g;
2176
3735
  var UA_ESCAPE_CHAR = "-";
2177
- init_esm_shims();
2178
3736
  var BYTE_LIMIT = 1024;
2179
3737
  function encodeFeatures(features) {
2180
3738
  let buffer = "";
@@ -2206,7 +3764,7 @@ var userAgentMiddleware = (options) => (next, context) => async (args) => {
2206
3764
  const customUserAgent = options?.customUserAgent?.map(escapeUserAgent) || [];
2207
3765
  const appId = await options.userAgentAppId();
2208
3766
  if (appId) {
2209
- defaultUserAgent.push(escapeUserAgent([`app/${appId}`]));
3767
+ defaultUserAgent.push(escapeUserAgent([`app`, `${appId}`]));
2210
3768
  }
2211
3769
  const prefix = getUserAgentPrefix();
2212
3770
  const sdkUserAgentValue = (prefix ? [prefix] : []).concat([...defaultUserAgent, ...userAgent, ...customUserAgent]).join(SPACE);
@@ -2259,10 +3817,18 @@ var getUserAgentPlugin = (config) => ({
2259
3817
  clientStack.add(userAgentMiddleware(config), getUserAgentMiddlewareOptions);
2260
3818
  }
2261
3819
  });
2262
- init_esm_shims();
2263
- init_esm_shims();
2264
- init_esm_shims();
2265
- init_esm_shims();
3820
+ var validRegions = /* @__PURE__ */ new Set();
3821
+ var checkRegion = (region, check = isValidHostLabel) => {
3822
+ if (!validRegions.has(region) && !check(region)) {
3823
+ if (region === "*") {
3824
+ 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.`);
3825
+ } else {
3826
+ throw new Error(`Region not accepted: region="${region}" is not a valid hostname component.`);
3827
+ }
3828
+ } else {
3829
+ validRegions.add(region);
3830
+ }
3831
+ };
2266
3832
  var isFipsRegion = (region) => typeof region === "string" && (region.startsWith("fips-") || region.endsWith("-fips"));
2267
3833
  var getRealRegion = (region) => isFipsRegion(region) ? ["fips-aws-global", "aws-fips"].includes(region) ? "us-east-1" : region.replace(/fips-(dkr-|prod-)?|-fips/, "") : region;
2268
3834
  var resolveRegionConfig = (input) => {
@@ -2272,11 +3838,10 @@ var resolveRegionConfig = (input) => {
2272
3838
  }
2273
3839
  return Object.assign(input, {
2274
3840
  region: async () => {
2275
- if (typeof region === "string") {
2276
- return getRealRegion(region);
2277
- }
2278
- const providedRegion = await region();
2279
- return getRealRegion(providedRegion);
3841
+ const providedRegion = typeof region === "function" ? await region() : region;
3842
+ const realRegion = getRealRegion(providedRegion);
3843
+ checkRegion(realRegion);
3844
+ return realRegion;
2280
3845
  },
2281
3846
  useFipsEndpoint: async () => {
2282
3847
  const providedRegion = typeof region === "string" ? region : await region();
@@ -2287,68 +3852,6 @@ var resolveRegionConfig = (input) => {
2287
3852
  }
2288
3853
  });
2289
3854
  };
2290
- init_esm_shims();
2291
- init_esm_shims();
2292
- init_esm_shims();
2293
- init_esm_shims();
2294
- init_esm_shims();
2295
- var booleanSelector = (obj, key, type) => {
2296
- if (!(key in obj))
2297
- return void 0;
2298
- if (obj[key] === "true")
2299
- return true;
2300
- if (obj[key] === "false")
2301
- return false;
2302
- throw new Error(`Cannot load ${type} "${key}". Expected "true" or "false", got ${obj[key]}.`);
2303
- };
2304
- init_esm_shims();
2305
- init_esm_shims();
2306
- var SelectorType;
2307
- (function(SelectorType2) {
2308
- SelectorType2["ENV"] = "env";
2309
- SelectorType2["CONFIG"] = "shared config entry";
2310
- })(SelectorType || (SelectorType = {}));
2311
- var ENV_USE_DUALSTACK_ENDPOINT = "AWS_USE_DUALSTACK_ENDPOINT";
2312
- var CONFIG_USE_DUALSTACK_ENDPOINT = "use_dualstack_endpoint";
2313
- var NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS = {
2314
- environmentVariableSelector: (env2) => booleanSelector(env2, ENV_USE_DUALSTACK_ENDPOINT, SelectorType.ENV),
2315
- configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_DUALSTACK_ENDPOINT, SelectorType.CONFIG),
2316
- default: false
2317
- };
2318
- init_esm_shims();
2319
- var ENV_USE_FIPS_ENDPOINT = "AWS_USE_FIPS_ENDPOINT";
2320
- var CONFIG_USE_FIPS_ENDPOINT = "use_fips_endpoint";
2321
- var NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS = {
2322
- environmentVariableSelector: (env2) => booleanSelector(env2, ENV_USE_FIPS_ENDPOINT, SelectorType.ENV),
2323
- configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_FIPS_ENDPOINT, SelectorType.CONFIG),
2324
- default: false
2325
- };
2326
- init_esm_shims();
2327
- init_esm_shims();
2328
- init_esm_shims();
2329
- init_esm_shims();
2330
- init_esm_shims();
2331
- var REGION_ENV_NAME = "AWS_REGION";
2332
- var REGION_INI_NAME = "region";
2333
- var NODE_REGION_CONFIG_OPTIONS = {
2334
- environmentVariableSelector: (env2) => env2[REGION_ENV_NAME],
2335
- configFileSelector: (profile) => profile[REGION_INI_NAME],
2336
- default: () => {
2337
- throw new Error("Region is missing");
2338
- }
2339
- };
2340
- var NODE_REGION_CONFIG_FILE_OPTIONS = {
2341
- preferredFile: "credentials"
2342
- };
2343
- init_esm_shims();
2344
- init_esm_shims();
2345
- init_esm_shims();
2346
- init_esm_shims();
2347
- init_esm_shims();
2348
- init_esm_shims();
2349
- init_esm_shims();
2350
- init_esm_shims();
2351
- init_esm_shims();
2352
3855
  var CONTENT_LENGTH_HEADER = "content-length";
2353
3856
  function contentLengthMiddleware(bodyLengthChecker) {
2354
3857
  return (next) => async (args) => {
@@ -2383,11 +3886,6 @@ var getContentLengthPlugin = (options) => ({
2383
3886
  clientStack.add(contentLengthMiddleware(options.bodyLengthChecker), contentLengthMiddlewareOptions);
2384
3887
  }
2385
3888
  });
2386
- init_esm_shims();
2387
- init_esm_shims();
2388
- init_esm_shims();
2389
- init_esm_shims();
2390
- init_esm_shims();
2391
3889
  var resolveParamsForS3 = async (endpointParams) => {
2392
3890
  const bucket = endpointParams?.Bucket || "";
2393
3891
  if (typeof endpointParams.Bucket === "string") {
@@ -2419,7 +3917,6 @@ var isArnBucketName = (bucketName) => {
2419
3917
  }
2420
3918
  return isValidArn;
2421
3919
  };
2422
- init_esm_shims();
2423
3920
  var createConfigValueProvider = (configKey, canonicalEndpointParamKey, config) => {
2424
3921
  const configProvider = async () => {
2425
3922
  const configValue = config[configKey] ?? config[canonicalEndpointParamKey];
@@ -2444,6 +3941,9 @@ var createConfigValueProvider = (configKey, canonicalEndpointParamKey, config) =
2444
3941
  }
2445
3942
  if (configKey === "endpoint" || canonicalEndpointParamKey === "endpoint") {
2446
3943
  return async () => {
3944
+ if (config.isCustomEndpoint === false) {
3945
+ return void 0;
3946
+ }
2447
3947
  const endpoint = await configProvider();
2448
3948
  if (endpoint && typeof endpoint === "object") {
2449
3949
  if ("url" in endpoint) {
@@ -2459,8 +3959,6 @@ var createConfigValueProvider = (configKey, canonicalEndpointParamKey, config) =
2459
3959
  }
2460
3960
  return configProvider;
2461
3961
  };
2462
- init_esm_shims();
2463
- init_esm_shims();
2464
3962
  var ENV_ENDPOINT_URL = "AWS_ENDPOINT_URL";
2465
3963
  var CONFIG_ENDPOINT_URL = "endpoint_url";
2466
3964
  var getEndpointUrlConfig = (serviceId) => ({
@@ -2492,7 +3990,6 @@ var getEndpointUrlConfig = (serviceId) => ({
2492
3990
  default: void 0
2493
3991
  });
2494
3992
  var getEndpointFromConfig = async (serviceId) => loadConfig(getEndpointUrlConfig(serviceId ?? ""))();
2495
- init_esm_shims();
2496
3993
  var toEndpointV1 = (endpoint) => {
2497
3994
  if (typeof endpoint === "object") {
2498
3995
  if ("url" in endpoint) {
@@ -2503,7 +4000,7 @@ var toEndpointV1 = (endpoint) => {
2503
4000
  return parseUrl(endpoint);
2504
4001
  };
2505
4002
  var getEndpointFromInstructions = async (commandInput, instructionsSupplier, clientConfig, context) => {
2506
- if (!clientConfig.endpoint) {
4003
+ if (!clientConfig.isCustomEndpoint) {
2507
4004
  let endpointFromConfig;
2508
4005
  if (clientConfig.serviceConfiguredEndpoint) {
2509
4006
  endpointFromConfig = await clientConfig.serviceConfiguredEndpoint();
@@ -2512,6 +4009,7 @@ var getEndpointFromInstructions = async (commandInput, instructionsSupplier, cli
2512
4009
  }
2513
4010
  if (endpointFromConfig) {
2514
4011
  clientConfig.endpoint = () => Promise.resolve(toEndpointV1(endpointFromConfig));
4012
+ clientConfig.isCustomEndpoint = true;
2515
4013
  }
2516
4014
  }
2517
4015
  const endpointParams = await resolveParams(commandInput, instructionsSupplier, clientConfig);
@@ -2553,7 +4051,7 @@ var resolveParams = async (commandInput, instructionsSupplier, clientConfig) =>
2553
4051
  };
2554
4052
  var endpointMiddleware = ({ config, instructions }) => {
2555
4053
  return (next, context) => async (args) => {
2556
- if (config.endpoint) {
4054
+ if (config.isCustomEndpoint) {
2557
4055
  setFeature(context, "ENDPOINT_OVERRIDE", "N");
2558
4056
  }
2559
4057
  const endpoint = await getEndpointFromInstructions(args.input, {
@@ -2590,7 +4088,7 @@ var endpointMiddlewareOptions = {
2590
4088
  name: "endpointV2Middleware",
2591
4089
  override: true,
2592
4090
  relation: "before",
2593
- toMiddleware: serializerMiddlewareOption.name
4091
+ toMiddleware: serializerMiddlewareOption2.name
2594
4092
  };
2595
4093
  var getEndpointPlugin = (config, instructions) => ({
2596
4094
  applyToStack: (clientStack) => {
@@ -2600,7 +4098,6 @@ var getEndpointPlugin = (config, instructions) => ({
2600
4098
  }), endpointMiddlewareOptions);
2601
4099
  }
2602
4100
  });
2603
- init_esm_shims();
2604
4101
  var resolveEndpointConfig = (input) => {
2605
4102
  const tls = input.tls ?? true;
2606
4103
  const { endpoint, useDualstackEndpoint, useFipsEndpoint } = input;
@@ -2622,13 +4119,6 @@ var resolveEndpointConfig = (input) => {
2622
4119
  };
2623
4120
  return resolvedConfig;
2624
4121
  };
2625
- init_esm_shims();
2626
- init_esm_shims();
2627
- init_esm_shims();
2628
- init_esm_shims();
2629
- init_esm_shims();
2630
- init_esm_shims();
2631
- init_esm_shims();
2632
4122
  var RETRY_MODES;
2633
4123
  (function(RETRY_MODES2) {
2634
4124
  RETRY_MODES2["STANDARD"] = "standard";
@@ -2636,9 +4126,6 @@ var RETRY_MODES;
2636
4126
  })(RETRY_MODES || (RETRY_MODES = {}));
2637
4127
  var DEFAULT_MAX_ATTEMPTS = 3;
2638
4128
  var DEFAULT_RETRY_MODE = RETRY_MODES.STANDARD;
2639
- init_esm_shims();
2640
- init_esm_shims();
2641
- init_esm_shims();
2642
4129
  var THROTTLING_ERROR_CODES = [
2643
4130
  "BandwidthLimitExceeded",
2644
4131
  "EC2ThrottledException",
@@ -2658,6 +4145,8 @@ var THROTTLING_ERROR_CODES = [
2658
4145
  var TRANSIENT_ERROR_CODES = ["TimeoutError", "RequestTimeout", "RequestTimeoutException"];
2659
4146
  var TRANSIENT_ERROR_STATUS_CODES = [500, 502, 503, 504];
2660
4147
  var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "ECONNREFUSED", "EPIPE", "ETIMEDOUT"];
4148
+ var NODEJS_NETWORK_ERROR_CODES = ["EHOSTUNREACH", "ENETUNREACH", "ENOTFOUND"];
4149
+ var isRetryableByTrait = (error) => error?.$retryable !== void 0;
2661
4150
  var isClockSkewCorrectedError = (error) => error.$metadata?.clockSkewCorrected;
2662
4151
  var isBrowserNetworkError = (error) => {
2663
4152
  const errorMessages = /* @__PURE__ */ new Set([
@@ -2674,7 +4163,7 @@ var isBrowserNetworkError = (error) => {
2674
4163
  return errorMessages.has(error.message);
2675
4164
  };
2676
4165
  var isThrottlingError = (error) => error.$metadata?.httpStatusCode === 429 || THROTTLING_ERROR_CODES.includes(error.name) || error.$retryable?.throttling == true;
2677
- var isTransientError = (error, depth = 0) => isClockSkewCorrectedError(error) || TRANSIENT_ERROR_CODES.includes(error.name) || NODEJS_TIMEOUT_ERROR_CODES.includes(error?.code || "") || TRANSIENT_ERROR_STATUS_CODES.includes(error.$metadata?.httpStatusCode || 0) || isBrowserNetworkError(error) || error.cause !== void 0 && depth <= 10 && isTransientError(error.cause, depth + 1);
4166
+ var isTransientError = (error, depth = 0) => isRetryableByTrait(error) || isClockSkewCorrectedError(error) || TRANSIENT_ERROR_CODES.includes(error.name) || NODEJS_TIMEOUT_ERROR_CODES.includes(error?.code || "") || NODEJS_NETWORK_ERROR_CODES.includes(error?.code || "") || TRANSIENT_ERROR_STATUS_CODES.includes(error.$metadata?.httpStatusCode || 0) || isBrowserNetworkError(error) || error.cause !== void 0 && depth <= 10 && isTransientError(error.cause, depth + 1);
2678
4167
  var isServerError = (error) => {
2679
4168
  if (error.$metadata?.httpStatusCode !== void 0) {
2680
4169
  const statusCode = error.$metadata.httpStatusCode;
@@ -2686,14 +4175,24 @@ var isServerError = (error) => {
2686
4175
  return false;
2687
4176
  };
2688
4177
  var DefaultRateLimiter = class _DefaultRateLimiter {
4178
+ static setTimeoutFn = setTimeout;
4179
+ beta;
4180
+ minCapacity;
4181
+ minFillRate;
4182
+ scaleConstant;
4183
+ smooth;
4184
+ currentCapacity = 0;
4185
+ enabled = false;
4186
+ lastMaxRate = 0;
4187
+ measuredTxRate = 0;
4188
+ requestCount = 0;
4189
+ fillRate;
4190
+ lastThrottleTime;
4191
+ lastTimestamp = 0;
4192
+ lastTxRateBucket;
4193
+ maxCapacity;
4194
+ timeWindow = 0;
2689
4195
  constructor(options) {
2690
- this.currentCapacity = 0;
2691
- this.enabled = false;
2692
- this.lastMaxRate = 0;
2693
- this.measuredTxRate = 0;
2694
- this.requestCount = 0;
2695
- this.lastTimestamp = 0;
2696
- this.timeWindow = 0;
2697
4196
  this.beta = options?.beta ?? 0.7;
2698
4197
  this.minCapacity = options?.minCapacity ?? 1;
2699
4198
  this.minFillRate = options?.minFillRate ?? 0.5;
@@ -2782,9 +4281,6 @@ var DefaultRateLimiter = class _DefaultRateLimiter {
2782
4281
  return parseFloat(num.toFixed(8));
2783
4282
  }
2784
4283
  };
2785
- DefaultRateLimiter.setTimeoutFn = setTimeout;
2786
- init_esm_shims();
2787
- init_esm_shims();
2788
4284
  var DEFAULT_RETRY_DELAY_BASE = 100;
2789
4285
  var MAXIMUM_RETRY_DELAY = 20 * 1e3;
2790
4286
  var THROTTLING_RETRY_DELAY_BASE = 500;
@@ -2794,7 +4290,6 @@ var TIMEOUT_RETRY_COST = 10;
2794
4290
  var NO_RETRY_INCREMENT = 1;
2795
4291
  var INVOCATION_ID_HEADER = "amz-sdk-invocation-id";
2796
4292
  var REQUEST_HEADER = "amz-sdk-request";
2797
- init_esm_shims();
2798
4293
  var getDefaultRetryBackoffStrategy = () => {
2799
4294
  let delayBase = DEFAULT_RETRY_DELAY_BASE;
2800
4295
  const computeNextBackoffDelay = (attempts) => {
@@ -2808,7 +4303,6 @@ var getDefaultRetryBackoffStrategy = () => {
2808
4303
  setDelayBase
2809
4304
  };
2810
4305
  };
2811
- init_esm_shims();
2812
4306
  var createDefaultRetryToken = ({ retryDelay, retryCount, retryCost }) => {
2813
4307
  const getRetryCount = () => retryCount;
2814
4308
  const getRetryDelay = () => Math.min(MAXIMUM_RETRY_DELAY, retryDelay);
@@ -2820,11 +4314,13 @@ var createDefaultRetryToken = ({ retryDelay, retryCount, retryCost }) => {
2820
4314
  };
2821
4315
  };
2822
4316
  var StandardRetryStrategy = class {
4317
+ maxAttempts;
4318
+ mode = RETRY_MODES.STANDARD;
4319
+ capacity = INITIAL_RETRY_TOKENS;
4320
+ retryBackoffStrategy = getDefaultRetryBackoffStrategy();
4321
+ maxAttemptsProvider;
2823
4322
  constructor(maxAttempts) {
2824
4323
  this.maxAttempts = maxAttempts;
2825
- this.mode = RETRY_MODES.STANDARD;
2826
- this.capacity = INITIAL_RETRY_TOKENS;
2827
- this.retryBackoffStrategy = getDefaultRetryBackoffStrategy();
2828
4324
  this.maxAttemptsProvider = typeof maxAttempts === "function" ? maxAttempts : async () => maxAttempts;
2829
4325
  }
2830
4326
  async acquireInitialRetryToken(retryTokenScope) {
@@ -2876,9 +4372,12 @@ var StandardRetryStrategy = class {
2876
4372
  }
2877
4373
  };
2878
4374
  var AdaptiveRetryStrategy = class {
4375
+ maxAttemptsProvider;
4376
+ rateLimiter;
4377
+ standardRetryStrategy;
4378
+ mode = RETRY_MODES.ADAPTIVE;
2879
4379
  constructor(maxAttemptsProvider, options) {
2880
4380
  this.maxAttemptsProvider = maxAttemptsProvider;
2881
- this.mode = RETRY_MODES.ADAPTIVE;
2882
4381
  const { rateLimiter } = options ?? {};
2883
4382
  this.rateLimiter = rateLimiter ?? new DefaultRateLimiter();
2884
4383
  this.standardRetryStrategy = new StandardRetryStrategy(maxAttemptsProvider);
@@ -2896,8 +4395,6 @@ var AdaptiveRetryStrategy = class {
2896
4395
  this.standardRetryStrategy.recordSuccess(token);
2897
4396
  }
2898
4397
  };
2899
- init_esm_shims();
2900
- init_esm_shims();
2901
4398
  var ENV_MAX_ATTEMPTS = "AWS_MAX_ATTEMPTS";
2902
4399
  var CONFIG_MAX_ATTEMPTS = "max_attempts";
2903
4400
  var NODE_MAX_ATTEMPT_CONFIG_OPTIONS = {
@@ -2947,52 +4444,7 @@ var NODE_RETRY_MODE_CONFIG_OPTIONS = {
2947
4444
  configFileSelector: (profile) => profile[CONFIG_RETRY_MODE],
2948
4445
  default: DEFAULT_RETRY_MODE
2949
4446
  };
2950
- init_esm_shims();
2951
- init_esm_shims();
2952
- init_esm_shims();
2953
- var rnds8Pool = new Uint8Array(256);
2954
- var poolPtr = rnds8Pool.length;
2955
- function rng() {
2956
- if (poolPtr > rnds8Pool.length - 16) {
2957
- crypto.randomFillSync(rnds8Pool);
2958
- poolPtr = 0;
2959
- }
2960
- return rnds8Pool.slice(poolPtr, poolPtr += 16);
2961
- }
2962
- init_esm_shims();
2963
- var byteToHex = [];
2964
- for (let i = 0; i < 256; ++i) {
2965
- byteToHex.push((i + 256).toString(16).slice(1));
2966
- }
2967
- function unsafeStringify(arr, offset = 0) {
2968
- return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
2969
- }
2970
- init_esm_shims();
2971
- init_esm_shims();
2972
- var native_default = {
2973
- randomUUID: crypto2.randomUUID
2974
- };
2975
- function v4(options, buf, offset) {
2976
- if (native_default.randomUUID && !buf && !options) {
2977
- return native_default.randomUUID();
2978
- }
2979
- options = options || {};
2980
- const rnds = options.random || (options.rng || rng)();
2981
- rnds[6] = rnds[6] & 15 | 64;
2982
- rnds[8] = rnds[8] & 63 | 128;
2983
- if (buf) {
2984
- offset = offset || 0;
2985
- for (let i = 0; i < 16; ++i) {
2986
- buf[offset + i] = rnds[i];
2987
- }
2988
- return buf;
2989
- }
2990
- return unsafeStringify(rnds);
2991
- }
2992
- var v4_default = v4;
2993
- init_esm_shims();
2994
4447
  var isStreamingPayload = (request) => request?.body instanceof Readable || typeof ReadableStream !== "undefined" && request?.body instanceof ReadableStream;
2995
- init_esm_shims();
2996
4448
  var asSdkError = (error) => {
2997
4449
  if (error instanceof Error)
2998
4450
  return error;
@@ -3014,7 +4466,7 @@ var retryMiddleware = (options) => (next, context) => async (args) => {
3014
4466
  const { request } = args;
3015
4467
  const isRequest = HttpRequest.isInstance(request);
3016
4468
  if (isRequest) {
3017
- request.headers[INVOCATION_ID_HEADER] = v4_default();
4469
+ request.headers[INVOCATION_ID_HEADER] = v4();
3018
4470
  }
3019
4471
  while (true) {
3020
4472
  try {
@@ -3102,16 +4554,46 @@ var getRetryAfterHint = (response) => {
3102
4554
  const retryAfterDate = new Date(retryAfter);
3103
4555
  return retryAfterDate;
3104
4556
  };
3105
- init_esm_shims();
3106
- init_esm_shims();
3107
- init_esm_shims();
3108
- init_esm_shims();
3109
- init_esm_shims();
3110
- init_esm_shims();
3111
- init_esm_shims();
3112
- init_esm_shims();
3113
- init_esm_shims();
3114
- init_esm_shims();
4557
+ var booleanSelector = (obj, key, type) => {
4558
+ if (!(key in obj))
4559
+ return void 0;
4560
+ if (obj[key] === "true")
4561
+ return true;
4562
+ if (obj[key] === "false")
4563
+ return false;
4564
+ throw new Error(`Cannot load ${type} "${key}". Expected "true" or "false", got ${obj[key]}.`);
4565
+ };
4566
+ var SelectorType;
4567
+ (function(SelectorType2) {
4568
+ SelectorType2["ENV"] = "env";
4569
+ SelectorType2["CONFIG"] = "shared config entry";
4570
+ })(SelectorType || (SelectorType = {}));
4571
+ var ENV_USE_DUALSTACK_ENDPOINT = "AWS_USE_DUALSTACK_ENDPOINT";
4572
+ var CONFIG_USE_DUALSTACK_ENDPOINT = "use_dualstack_endpoint";
4573
+ var NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS = {
4574
+ environmentVariableSelector: (env2) => booleanSelector(env2, ENV_USE_DUALSTACK_ENDPOINT, SelectorType.ENV),
4575
+ configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_DUALSTACK_ENDPOINT, SelectorType.CONFIG),
4576
+ default: false
4577
+ };
4578
+ var ENV_USE_FIPS_ENDPOINT = "AWS_USE_FIPS_ENDPOINT";
4579
+ var CONFIG_USE_FIPS_ENDPOINT = "use_fips_endpoint";
4580
+ var NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS = {
4581
+ environmentVariableSelector: (env2) => booleanSelector(env2, ENV_USE_FIPS_ENDPOINT, SelectorType.ENV),
4582
+ configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_FIPS_ENDPOINT, SelectorType.CONFIG),
4583
+ default: false
4584
+ };
4585
+ var REGION_ENV_NAME = "AWS_REGION";
4586
+ var REGION_INI_NAME = "region";
4587
+ var NODE_REGION_CONFIG_OPTIONS = {
4588
+ environmentVariableSelector: (env2) => env2[REGION_ENV_NAME],
4589
+ configFileSelector: (profile) => profile[REGION_INI_NAME],
4590
+ default: () => {
4591
+ throw new Error("Region is missing");
4592
+ }
4593
+ };
4594
+ var NODE_REGION_CONFIG_FILE_OPTIONS = {
4595
+ preferredFile: "credentials"
4596
+ };
3115
4597
  var crtAvailability = {
3116
4598
  isCrtAvailable: false
3117
4599
  };
@@ -3145,7 +4627,6 @@ var createDefaultUserAgentProvider = ({ serviceId, clientVersion }) => {
3145
4627
  return resolvedUserAgent;
3146
4628
  };
3147
4629
  };
3148
- init_esm_shims();
3149
4630
  var UA_APP_ID_ENV_NAME = "AWS_SDK_UA_APP_ID";
3150
4631
  var UA_APP_ID_INI_NAME = "sdk_ua_app_id";
3151
4632
  var UA_APP_ID_INI_NAME_DEPRECATED = "sdk-ua-app-id";
@@ -3154,9 +4635,10 @@ var NODE_APP_ID_CONFIG_OPTIONS = {
3154
4635
  configFileSelector: (profile) => profile[UA_APP_ID_INI_NAME] ?? profile[UA_APP_ID_INI_NAME_DEPRECATED],
3155
4636
  default: DEFAULT_UA_APP_ID
3156
4637
  };
3157
- init_esm_shims();
3158
- init_esm_shims();
3159
4638
  var Hash = class {
4639
+ algorithmIdentifier;
4640
+ secret;
4641
+ hash;
3160
4642
  constructor(algorithmIdentifier, secret) {
3161
4643
  this.algorithmIdentifier = algorithmIdentifier;
3162
4644
  this.secret = secret;
@@ -3184,7 +4666,6 @@ function castSourceData(toCast, encoding) {
3184
4666
  }
3185
4667
  return fromArrayBuffer(toCast);
3186
4668
  }
3187
- init_esm_shims();
3188
4669
  var calculateBodyLength = (body) => {
3189
4670
  if (!body) {
3190
4671
  return 0;
@@ -3197,23 +4678,21 @@ var calculateBodyLength = (body) => {
3197
4678
  return body.size;
3198
4679
  } else if (typeof body.start === "number" && typeof body.end === "number") {
3199
4680
  return body.end + 1 - body.start;
3200
- } else if (typeof body.path === "string" || Buffer.isBuffer(body.path)) {
3201
- return lstatSync(body.path).size;
3202
- } else if (typeof body.fd === "number") {
3203
- return fstatSync(body.fd).size;
4681
+ } else if (body instanceof ReadStream) {
4682
+ if (body.path != null) {
4683
+ return lstatSync(body.path).size;
4684
+ } else if (typeof body.fd === "number") {
4685
+ return fstatSync(body.fd).size;
4686
+ }
3204
4687
  }
3205
4688
  throw new Error(`Body Length computation failed for ${body}`);
3206
4689
  };
3207
- init_esm_shims();
3208
- init_esm_shims();
3209
- init_esm_shims();
3210
4690
  var AWS_EXECUTION_ENV = "AWS_EXECUTION_ENV";
3211
4691
  var AWS_REGION_ENV = "AWS_REGION";
3212
4692
  var AWS_DEFAULT_REGION_ENV = "AWS_DEFAULT_REGION";
3213
4693
  var ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED";
3214
4694
  var DEFAULTS_MODE_OPTIONS = ["in-region", "cross-region", "mobile", "standard", "legacy"];
3215
4695
  var IMDS_REGION_PATH = "/latest/meta-data/placement/region";
3216
- init_esm_shims();
3217
4696
  var AWS_DEFAULTS_MODE_ENV = "AWS_DEFAULTS_MODE";
3218
4697
  var AWS_DEFAULTS_MODE_CONFIG = "defaults_mode";
3219
4698
  var NODE_DEFAULTS_MODE_CONFIG_OPTIONS = {
@@ -3263,15 +4742,13 @@ var inferPhysicalRegion = async () => {
3263
4742
  }
3264
4743
  if (!process.env[ENV_IMDS_DISABLED]) {
3265
4744
  try {
3266
- const { getInstanceMetadataEndpoint, httpRequest } = await import("./dist-es-SUPEA6VE-3B5JSW5C.js");
4745
+ const { getInstanceMetadataEndpoint, httpRequest } = await import("./dist-es-BQW4ETQH-C7ZSD5EG.js");
3267
4746
  const endpoint = await getInstanceMetadataEndpoint();
3268
4747
  return (await httpRequest({ ...endpoint, path: IMDS_REGION_PATH })).toString();
3269
4748
  } catch (e) {
3270
4749
  }
3271
4750
  }
3272
4751
  };
3273
- init_esm_shims();
3274
- init_esm_shims();
3275
4752
  var getAwsRegionExtensionConfiguration = (runtimeConfig) => {
3276
4753
  return {
3277
4754
  setRegion(region) {
@@ -3287,23 +4764,37 @@ var resolveAwsRegionExtensionConfiguration = (awsRegionExtensionConfiguration) =
3287
4764
  region: awsRegionExtensionConfiguration.region()
3288
4765
  };
3289
4766
  };
3290
- init_esm_shims();
3291
- init_esm_shims();
3292
- init_esm_shims();
3293
- init_esm_shims();
3294
- init_esm_shims();
3295
- init_esm_shims();
3296
4767
 
3297
4768
  export {
4769
+ Client,
4770
+ deref,
4771
+ getHttpHandlerExtensionConfiguration,
4772
+ resolveHttpHandlerRuntimeConfig,
3298
4773
  getSmithyContext,
3299
4774
  normalizeProvider,
4775
+ getSchemaSerdePlugin,
4776
+ translateTraits,
4777
+ NormalizedSchema,
4778
+ TypeRegistry,
4779
+ Command,
3300
4780
  getHttpAuthSchemeEndpointRuleSetPlugin,
3301
- getSerdePlugin,
3302
4781
  httpSigningMiddlewareOptions,
3303
4782
  getHttpSigningPlugin,
3304
4783
  createPaginator,
3305
4784
  DefaultIdentityProviderConfig,
4785
+ toUint8Array,
4786
+ collectBody,
4787
+ extendedEncodeURIComponent,
4788
+ v4,
4789
+ LazyJsonString,
4790
+ splitHeader,
4791
+ NumericValue,
4792
+ SerdeContext,
4793
+ HttpProtocol,
4794
+ determineTimestampFormat,
4795
+ FromStringShapeDeserializer,
3306
4796
  NoAuthSigner,
4797
+ ServiceException,
3307
4798
  resolveHostHeaderConfig,
3308
4799
  getHostHeaderPlugin,
3309
4800
  getLoggerPlugin,
@@ -3321,17 +4812,18 @@ export {
3321
4812
  resolveAwsSdkSigV4AConfig,
3322
4813
  NODE_SIGV4A_CONFIG_OPTIONS,
3323
4814
  SignatureV4,
3324
- signatureV4aContainer,
3325
4815
  resolveAwsSdkSigV4Config,
3326
- collectBodyString,
4816
+ loadConfigsForDefaultMode,
4817
+ emitWarningIfUnsupportedVersion2,
4818
+ getDefaultExtensionConfiguration,
4819
+ resolveDefaultRuntimeConfig,
4820
+ NoOpLogger,
4821
+ ProtocolLib,
4822
+ SerdeContextConfig,
4823
+ serializingStructIterator,
4824
+ deserializingStructIterator,
3327
4825
  getUserAgentPlugin,
3328
4826
  resolveRegionConfig,
3329
- booleanSelector,
3330
- SelectorType,
3331
- NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS,
3332
- NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS,
3333
- NODE_REGION_CONFIG_OPTIONS,
3334
- NODE_REGION_CONFIG_FILE_OPTIONS,
3335
4827
  getContentLengthPlugin,
3336
4828
  resolveParams,
3337
4829
  getEndpointPlugin,
@@ -3341,6 +4833,12 @@ export {
3341
4833
  resolveRetryConfig,
3342
4834
  NODE_RETRY_MODE_CONFIG_OPTIONS,
3343
4835
  getRetryPlugin,
4836
+ booleanSelector,
4837
+ SelectorType,
4838
+ NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS,
4839
+ NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS,
4840
+ NODE_REGION_CONFIG_OPTIONS,
4841
+ NODE_REGION_CONFIG_FILE_OPTIONS,
3344
4842
  createDefaultUserAgentProvider,
3345
4843
  NODE_APP_ID_CONFIG_OPTIONS,
3346
4844
  Hash,