@monolayer/sdk 1.3.0-canary.2 → 1.3.0-canary.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/bin/cli.js +61 -23
  2. package/dist/cjs/workloads/stateless/task/dispatcher.js +2 -1
  3. package/dist/esm/workloads/stateless/task/dispatcher.js +2 -1
  4. package/package.json +1 -1
  5. package/dist/bin/chunk-2DM36AIF.js +0 -60
  6. package/dist/bin/chunk-3TV5KLB7.js +0 -105
  7. package/dist/bin/chunk-54HDPH52.js +0 -116
  8. package/dist/bin/chunk-AKHG66MJ.js +0 -2359
  9. package/dist/bin/chunk-ASIK3ESJ.js +0 -37
  10. package/dist/bin/chunk-AV7FB56K.js +0 -14
  11. package/dist/bin/chunk-D6MRFOU6.js +0 -62
  12. package/dist/bin/chunk-DQ2PXUF5.js +0 -44
  13. package/dist/bin/chunk-GE4ESXBP.js +0 -57
  14. package/dist/bin/chunk-K4XCYO2X.js +0 -1637
  15. package/dist/bin/chunk-KHQQRHZY.js +0 -969
  16. package/dist/bin/chunk-KSHJCBUY.js +0 -938
  17. package/dist/bin/chunk-KW25ZB6Z.js +0 -14
  18. package/dist/bin/chunk-SYAMBCRY.js +0 -54
  19. package/dist/bin/chunk-T4MZMT2A.js +0 -122
  20. package/dist/bin/chunk-U43L2J36.js +0 -1875
  21. package/dist/bin/chunk-UKX3KEC2.js +0 -37
  22. package/dist/bin/chunk-X7GJVU6X.js +0 -182
  23. package/dist/bin/dist-es-4LCK4BMD.js +0 -81
  24. package/dist/bin/dist-es-4ULGGWP4.js +0 -361
  25. package/dist/bin/dist-es-7BYCFULM.js +0 -7
  26. package/dist/bin/dist-es-A2JHLMIV.js +0 -154
  27. package/dist/bin/dist-es-AWY666YH.js +0 -292
  28. package/dist/bin/dist-es-KUMQWKJB.js +0 -194
  29. package/dist/bin/dist-es-TNZXIBKF.js +0 -292
  30. package/dist/bin/dist-es-TV7F3ZAE.js +0 -7
  31. package/dist/bin/dist-es-XD3WAN5D.js +0 -154
  32. package/dist/bin/dist-es-YGJKPYIO.js +0 -81
  33. package/dist/bin/dist-es-YYROUSP5.js +0 -62
  34. package/dist/bin/dist-es-ZOY57CKU.js +0 -62
  35. package/dist/bin/dist-es-ZVXNFAFI.js +0 -194
  36. package/dist/bin/esm-ID5USS7G.js +0 -4773
  37. package/dist/bin/loadSso-55OGDGPY.js +0 -484
  38. package/dist/bin/loadSso-UYOIOSOA.js +0 -480
  39. package/dist/bin/sso-oidc-BHBT6MBW.js +0 -732
  40. package/dist/bin/sso-oidc-WOAY6JEM.js +0 -733
  41. package/dist/bin/sts-22SIO74C.js +0 -1109
  42. package/dist/bin/sts-SCV3QXFF.js +0 -1064
  43. package/dist/bin/sts-YWYJ3LVJ.js +0 -1064
@@ -1,2359 +0,0 @@
1
- import { createRequire } from 'module';
2
- import { loadConfig, parseUrl } from './chunk-3TV5KLB7.js';
3
- import { HttpRequest, resolvedPath, toUint8Array, fromString, fromArrayBuffer, toHex, HttpResponse, NoOpLogger, escapeUri, fromUtf8, fromHex, isArrayBuffer } from './chunk-U43L2J36.js';
4
- import { CONFIG_PREFIX_SEPARATOR } from './chunk-X7GJVU6X.js';
5
- import { EndpointURLScheme, SMITHY_CONTEXT_KEY } from './chunk-D6MRFOU6.js';
6
- import { memoize } from './chunk-54HDPH52.js';
7
- import crypto, { createHmac, createHash } from 'crypto';
8
- import { Readable } from 'stream';
9
- import { Buffer as Buffer$1 } from 'buffer';
10
- import { lstatSync, fstatSync } from 'fs';
11
-
12
- createRequire(import.meta.url);
13
-
14
- // ../../node_modules/@smithy/util-middleware/dist-es/getSmithyContext.js
15
- var getSmithyContext = (context) => context[SMITHY_CONTEXT_KEY] || (context[SMITHY_CONTEXT_KEY] = {});
16
-
17
- // ../../node_modules/@smithy/util-middleware/dist-es/normalizeProvider.js
18
- var normalizeProvider = (input) => {
19
- if (typeof input === "function")
20
- return input;
21
- const promisified = Promise.resolve(input);
22
- return () => promisified;
23
- };
24
-
25
- // ../../node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/resolveAuthOptions.js
26
- var resolveAuthOptions = (candidateAuthOptions, authSchemePreference) => {
27
- if (!authSchemePreference || authSchemePreference.length === 0) {
28
- return candidateAuthOptions;
29
- }
30
- const preferredAuthOptions = [];
31
- for (const preferredSchemeName of authSchemePreference) {
32
- for (const candidateAuthOption of candidateAuthOptions) {
33
- const candidateAuthSchemeName = candidateAuthOption.schemeId.split("#")[1];
34
- if (candidateAuthSchemeName === preferredSchemeName) {
35
- preferredAuthOptions.push(candidateAuthOption);
36
- }
37
- }
38
- }
39
- for (const candidateAuthOption of candidateAuthOptions) {
40
- if (!preferredAuthOptions.find(({ schemeId }) => schemeId === candidateAuthOption.schemeId)) {
41
- preferredAuthOptions.push(candidateAuthOption);
42
- }
43
- }
44
- return preferredAuthOptions;
45
- };
46
-
47
- // ../../node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/httpAuthSchemeMiddleware.js
48
- function convertHttpAuthSchemesToMap(httpAuthSchemes) {
49
- const map = /* @__PURE__ */ new Map();
50
- for (const scheme of httpAuthSchemes) {
51
- map.set(scheme.schemeId, scheme);
52
- }
53
- return map;
54
- }
55
- var httpAuthSchemeMiddleware = (config, mwOptions) => (next, context) => async (args) => {
56
- const options = config.httpAuthSchemeProvider(await mwOptions.httpAuthSchemeParametersProvider(config, context, args.input));
57
- const authSchemePreference = config.authSchemePreference ? await config.authSchemePreference() : [];
58
- const resolvedOptions = resolveAuthOptions(options, authSchemePreference);
59
- const authSchemes = convertHttpAuthSchemesToMap(config.httpAuthSchemes);
60
- const smithyContext = getSmithyContext(context);
61
- const failureReasons = [];
62
- for (const option of resolvedOptions) {
63
- const scheme = authSchemes.get(option.schemeId);
64
- if (!scheme) {
65
- failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` was not enabled for this service.`);
66
- continue;
67
- }
68
- const identityProvider = scheme.identityProvider(await mwOptions.identityProviderConfigProvider(config));
69
- if (!identityProvider) {
70
- failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` did not have an IdentityProvider configured.`);
71
- continue;
72
- }
73
- const { identityProperties = {}, signingProperties = {} } = option.propertiesExtractor?.(config, context) || {};
74
- option.identityProperties = Object.assign(option.identityProperties || {}, identityProperties);
75
- option.signingProperties = Object.assign(option.signingProperties || {}, signingProperties);
76
- smithyContext.selectedHttpAuthScheme = {
77
- httpAuthOption: option,
78
- identity: await identityProvider(option.identityProperties),
79
- signer: scheme.signer
80
- };
81
- break;
82
- }
83
- if (!smithyContext.selectedHttpAuthScheme) {
84
- throw new Error(failureReasons.join("\n"));
85
- }
86
- return next(args);
87
- };
88
-
89
- // ../../node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/getHttpAuthSchemeEndpointRuleSetPlugin.js
90
- var httpAuthSchemeEndpointRuleSetMiddlewareOptions = {
91
- step: "serialize",
92
- tags: ["HTTP_AUTH_SCHEME"],
93
- name: "httpAuthSchemeMiddleware",
94
- override: true,
95
- relation: "before",
96
- toMiddleware: "endpointV2Middleware"
97
- };
98
- var getHttpAuthSchemeEndpointRuleSetPlugin = (config, { httpAuthSchemeParametersProvider, identityProviderConfigProvider }) => ({
99
- applyToStack: (clientStack) => {
100
- clientStack.addRelativeTo(httpAuthSchemeMiddleware(config, {
101
- httpAuthSchemeParametersProvider,
102
- identityProviderConfigProvider
103
- }), httpAuthSchemeEndpointRuleSetMiddlewareOptions);
104
- }
105
- });
106
-
107
- // ../../node_modules/@smithy/middleware-serde/dist-es/deserializerMiddleware.js
108
- var deserializerMiddleware = (options, deserializer) => (next, context) => async (args) => {
109
- const { response } = await next(args);
110
- try {
111
- const parsed = await deserializer(response, options);
112
- return {
113
- response,
114
- output: parsed
115
- };
116
- } catch (error) {
117
- Object.defineProperty(error, "$response", {
118
- value: response
119
- });
120
- if (!("$metadata" in error)) {
121
- const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;
122
- try {
123
- error.message += "\n " + hint;
124
- } catch (e) {
125
- if (!context.logger || context.logger?.constructor?.name === "NoOpLogger") {
126
- console.warn(hint);
127
- } else {
128
- context.logger?.warn?.(hint);
129
- }
130
- }
131
- if (typeof error.$responseBodyText !== "undefined") {
132
- if (error.$response) {
133
- error.$response.body = error.$responseBodyText;
134
- }
135
- }
136
- try {
137
- if (HttpResponse.isInstance(response)) {
138
- const { headers = {} } = response;
139
- const headerEntries = Object.entries(headers);
140
- error.$metadata = {
141
- httpStatusCode: response.statusCode,
142
- requestId: findHeader(/^x-[\w-]+-request-?id$/, headerEntries),
143
- extendedRequestId: findHeader(/^x-[\w-]+-id-2$/, headerEntries),
144
- cfId: findHeader(/^x-[\w-]+-cf-id$/, headerEntries)
145
- };
146
- }
147
- } catch (e) {
148
- }
149
- }
150
- throw error;
151
- }
152
- };
153
- var findHeader = (pattern, headers) => {
154
- return (headers.find(([k]) => {
155
- return k.match(pattern);
156
- }) || [void 0, void 0])[1];
157
- };
158
-
159
- // ../../node_modules/@smithy/middleware-serde/dist-es/serializerMiddleware.js
160
- var serializerMiddleware = (options, serializer) => (next, context) => async (args) => {
161
- const endpointConfig = options;
162
- const endpoint = context.endpointV2?.url && endpointConfig.urlParser ? async () => endpointConfig.urlParser(context.endpointV2.url) : endpointConfig.endpoint;
163
- if (!endpoint) {
164
- throw new Error("No valid endpoint provider available.");
165
- }
166
- const request = await serializer(args.input, { ...options, endpoint });
167
- return next({
168
- ...args,
169
- request
170
- });
171
- };
172
-
173
- // ../../node_modules/@smithy/middleware-serde/dist-es/serdePlugin.js
174
- var deserializerMiddlewareOption = {
175
- name: "deserializerMiddleware",
176
- step: "deserialize",
177
- tags: ["DESERIALIZER"],
178
- override: true
179
- };
180
- var serializerMiddlewareOption = {
181
- name: "serializerMiddleware",
182
- step: "serialize",
183
- tags: ["SERIALIZER"],
184
- override: true
185
- };
186
- function getSerdePlugin(config, serializer, deserializer) {
187
- return {
188
- applyToStack: (commandStack) => {
189
- commandStack.add(deserializerMiddleware(config, deserializer), deserializerMiddlewareOption);
190
- commandStack.add(serializerMiddleware(config, serializer), serializerMiddlewareOption);
191
- }
192
- };
193
- }
194
-
195
- // ../../node_modules/@smithy/core/dist-es/middleware-http-signing/httpSigningMiddleware.js
196
- var defaultErrorHandler = (signingProperties) => (error) => {
197
- throw error;
198
- };
199
- var defaultSuccessHandler = (httpResponse, signingProperties) => {
200
- };
201
- var httpSigningMiddleware = (config) => (next, context) => async (args) => {
202
- if (!HttpRequest.isInstance(args.request)) {
203
- return next(args);
204
- }
205
- const smithyContext = getSmithyContext(context);
206
- const scheme = smithyContext.selectedHttpAuthScheme;
207
- if (!scheme) {
208
- throw new Error(`No HttpAuthScheme was selected: unable to sign request`);
209
- }
210
- const { httpAuthOption: { signingProperties = {} }, identity, signer } = scheme;
211
- const output = await next({
212
- ...args,
213
- request: await signer.sign(args.request, identity, signingProperties)
214
- }).catch((signer.errorHandler || defaultErrorHandler)(signingProperties));
215
- (signer.successHandler || defaultSuccessHandler)(output.response, signingProperties);
216
- return output;
217
- };
218
-
219
- // ../../node_modules/@smithy/core/dist-es/middleware-http-signing/getHttpSigningMiddleware.js
220
- var httpSigningMiddlewareOptions = {
221
- step: "finalizeRequest",
222
- tags: ["HTTP_SIGNING"],
223
- name: "httpSigningMiddleware",
224
- aliases: ["apiKeyMiddleware", "tokenMiddleware", "awsAuthMiddleware"],
225
- override: true,
226
- relation: "after",
227
- toMiddleware: "retryMiddleware"
228
- };
229
- var getHttpSigningPlugin = (config) => ({
230
- applyToStack: (clientStack) => {
231
- clientStack.addRelativeTo(httpSigningMiddleware(), httpSigningMiddlewareOptions);
232
- }
233
- });
234
-
235
- // ../../node_modules/@smithy/core/dist-es/util-identity-and-auth/DefaultIdentityProviderConfig.js
236
- var DefaultIdentityProviderConfig = class {
237
- constructor(config) {
238
- this.authSchemes = /* @__PURE__ */ new Map();
239
- for (const [key, value] of Object.entries(config)) {
240
- if (value !== void 0) {
241
- this.authSchemes.set(key, value);
242
- }
243
- }
244
- }
245
- getIdentityProvider(schemeId) {
246
- return this.authSchemes.get(schemeId);
247
- }
248
- };
249
-
250
- // ../../node_modules/@smithy/core/dist-es/normalizeProvider.js
251
- var normalizeProvider2 = (input) => {
252
- if (typeof input === "function")
253
- return input;
254
- const promisified = Promise.resolve(input);
255
- return () => promisified;
256
- };
257
-
258
- // ../../node_modules/@smithy/core/dist-es/pagination/createPaginator.js
259
- var makePagedClientRequest = async (CommandCtor, client, input, withCommand = (_) => _, ...args) => {
260
- let command = new CommandCtor(input);
261
- command = withCommand(command) ?? command;
262
- return await client.send(command, ...args);
263
- };
264
- function createPaginator(ClientCtor, CommandCtor, inputTokenName, outputTokenName, pageSizeTokenName) {
265
- return async function* paginateOperation(config, input, ...additionalArguments) {
266
- const _input = input;
267
- let token = config.startingToken ?? _input[inputTokenName];
268
- let hasNext = true;
269
- let page;
270
- while (hasNext) {
271
- _input[inputTokenName] = token;
272
- if (pageSizeTokenName) {
273
- _input[pageSizeTokenName] = _input[pageSizeTokenName] ?? config.pageSize;
274
- }
275
- if (config.client instanceof ClientCtor) {
276
- page = await makePagedClientRequest(CommandCtor, config.client, input, config.withCommand, ...additionalArguments);
277
- } else {
278
- throw new Error(`Invalid client, expected instance of ${ClientCtor.name}`);
279
- }
280
- yield page;
281
- const prevToken = token;
282
- token = get(page, outputTokenName);
283
- hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
284
- }
285
- return void 0;
286
- };
287
- }
288
- var get = (fromObject, path) => {
289
- let cursor = fromObject;
290
- const pathComponents = path.split(".");
291
- for (const step of pathComponents) {
292
- if (!cursor || typeof cursor !== "object") {
293
- return void 0;
294
- }
295
- cursor = cursor[step];
296
- }
297
- return cursor;
298
- };
299
-
300
- // ../../node_modules/@smithy/core/dist-es/submodules/protocols/requestBuilder.js
301
- function requestBuilder(input, context) {
302
- return new RequestBuilder(input, context);
303
- }
304
- var RequestBuilder = class {
305
- constructor(input, context) {
306
- this.input = input;
307
- this.context = context;
308
- this.query = {};
309
- this.method = "";
310
- this.headers = {};
311
- this.path = "";
312
- this.body = null;
313
- this.hostname = "";
314
- this.resolvePathStack = [];
315
- }
316
- async build() {
317
- const { hostname, protocol = "https", port, path: basePath } = await this.context.endpoint();
318
- this.path = basePath;
319
- for (const resolvePath of this.resolvePathStack) {
320
- resolvePath(this.path);
321
- }
322
- return new HttpRequest({
323
- protocol,
324
- hostname: this.hostname || hostname,
325
- port,
326
- method: this.method,
327
- path: this.path,
328
- query: this.query,
329
- body: this.body,
330
- headers: this.headers
331
- });
332
- }
333
- hn(hostname) {
334
- this.hostname = hostname;
335
- return this;
336
- }
337
- bp(uriLabel) {
338
- this.resolvePathStack.push((basePath) => {
339
- this.path = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + uriLabel;
340
- });
341
- return this;
342
- }
343
- p(memberName, labelValueProvider, uriLabel, isGreedyLabel) {
344
- this.resolvePathStack.push((path) => {
345
- this.path = resolvedPath(path, this.input, memberName, labelValueProvider, uriLabel, isGreedyLabel);
346
- });
347
- return this;
348
- }
349
- h(headers) {
350
- this.headers = headers;
351
- return this;
352
- }
353
- q(query) {
354
- this.query = query;
355
- return this;
356
- }
357
- b(body) {
358
- this.body = body;
359
- return this;
360
- }
361
- m(method) {
362
- this.method = method;
363
- return this;
364
- }
365
- };
366
-
367
- // ../../node_modules/@smithy/core/dist-es/setFeature.js
368
- function setFeature(context, feature, value) {
369
- if (!context.__smithy_context) {
370
- context.__smithy_context = {
371
- features: {}
372
- };
373
- } else if (!context.__smithy_context.features) {
374
- context.__smithy_context.features = {};
375
- }
376
- context.__smithy_context.features[feature] = value;
377
- }
378
-
379
- // ../../node_modules/@smithy/core/dist-es/util-identity-and-auth/httpAuthSchemes/noAuth.js
380
- var NoAuthSigner = class {
381
- async sign(httpRequest, identity, signingProperties) {
382
- return httpRequest;
383
- }
384
- };
385
-
386
- // ../../node_modules/@smithy/core/dist-es/util-identity-and-auth/memoizeIdentityProvider.js
387
- var createIsIdentityExpiredFunction = (expirationMs) => (identity) => doesIdentityRequireRefresh(identity) && identity.expiration.getTime() - Date.now() < expirationMs;
388
- var EXPIRATION_MS = 3e5;
389
- var isIdentityExpired = createIsIdentityExpiredFunction(EXPIRATION_MS);
390
- var doesIdentityRequireRefresh = (identity) => identity.expiration !== void 0;
391
- var memoizeIdentityProvider = (provider, isExpired, requiresRefresh) => {
392
- if (provider === void 0) {
393
- return void 0;
394
- }
395
- const normalizedProvider = typeof provider !== "function" ? async () => Promise.resolve(provider) : provider;
396
- let resolved;
397
- let pending;
398
- let hasResult;
399
- let isConstant = false;
400
- const coalesceProvider = async (options) => {
401
- if (!pending) {
402
- pending = normalizedProvider(options);
403
- }
404
- try {
405
- resolved = await pending;
406
- hasResult = true;
407
- isConstant = false;
408
- } finally {
409
- pending = void 0;
410
- }
411
- return resolved;
412
- };
413
- if (isExpired === void 0) {
414
- return async (options) => {
415
- if (!hasResult || options?.forceRefresh) {
416
- resolved = await coalesceProvider(options);
417
- }
418
- return resolved;
419
- };
420
- }
421
- return async (options) => {
422
- if (!hasResult || options?.forceRefresh) {
423
- resolved = await coalesceProvider(options);
424
- }
425
- if (isConstant) {
426
- return resolved;
427
- }
428
- if (!requiresRefresh(resolved)) {
429
- isConstant = true;
430
- return resolved;
431
- }
432
- if (isExpired(resolved)) {
433
- await coalesceProvider(options);
434
- return resolved;
435
- }
436
- return resolved;
437
- };
438
- };
439
-
440
- // ../../node_modules/@smithy/config-resolver/dist-es/regionConfig/isFipsRegion.js
441
- var isFipsRegion = (region) => typeof region === "string" && (region.startsWith("fips-") || region.endsWith("-fips"));
442
-
443
- // ../../node_modules/@smithy/config-resolver/dist-es/regionConfig/getRealRegion.js
444
- var getRealRegion = (region) => isFipsRegion(region) ? ["fips-aws-global", "aws-fips"].includes(region) ? "us-east-1" : region.replace(/fips-(dkr-|prod-)?|-fips/, "") : region;
445
-
446
- // ../../node_modules/@smithy/config-resolver/dist-es/regionConfig/resolveRegionConfig.js
447
- var resolveRegionConfig = (input) => {
448
- const { region, useFipsEndpoint } = input;
449
- if (!region) {
450
- throw new Error("Region is missing");
451
- }
452
- return Object.assign(input, {
453
- region: async () => {
454
- if (typeof region === "string") {
455
- return getRealRegion(region);
456
- }
457
- const providedRegion = await region();
458
- return getRealRegion(providedRegion);
459
- },
460
- useFipsEndpoint: async () => {
461
- const providedRegion = typeof region === "string" ? region : await region();
462
- if (isFipsRegion(providedRegion)) {
463
- return true;
464
- }
465
- return typeof useFipsEndpoint !== "function" ? Promise.resolve(!!useFipsEndpoint) : useFipsEndpoint();
466
- }
467
- });
468
- };
469
-
470
- // ../../node_modules/@smithy/util-config-provider/dist-es/booleanSelector.js
471
- var booleanSelector = (obj, key, type) => {
472
- if (!(key in obj))
473
- return void 0;
474
- if (obj[key] === "true")
475
- return true;
476
- if (obj[key] === "false")
477
- return false;
478
- throw new Error(`Cannot load ${type} "${key}". Expected "true" or "false", got ${obj[key]}.`);
479
- };
480
-
481
- // ../../node_modules/@smithy/util-config-provider/dist-es/types.js
482
- var SelectorType;
483
- (function(SelectorType2) {
484
- SelectorType2["ENV"] = "env";
485
- SelectorType2["CONFIG"] = "shared config entry";
486
- })(SelectorType || (SelectorType = {}));
487
-
488
- // ../../node_modules/@smithy/config-resolver/dist-es/endpointsConfig/NodeUseDualstackEndpointConfigOptions.js
489
- var ENV_USE_DUALSTACK_ENDPOINT = "AWS_USE_DUALSTACK_ENDPOINT";
490
- var CONFIG_USE_DUALSTACK_ENDPOINT = "use_dualstack_endpoint";
491
- var NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS = {
492
- environmentVariableSelector: (env) => booleanSelector(env, ENV_USE_DUALSTACK_ENDPOINT, SelectorType.ENV),
493
- configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_DUALSTACK_ENDPOINT, SelectorType.CONFIG),
494
- default: false
495
- };
496
-
497
- // ../../node_modules/@smithy/config-resolver/dist-es/endpointsConfig/NodeUseFipsEndpointConfigOptions.js
498
- var ENV_USE_FIPS_ENDPOINT = "AWS_USE_FIPS_ENDPOINT";
499
- var CONFIG_USE_FIPS_ENDPOINT = "use_fips_endpoint";
500
- var NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS = {
501
- environmentVariableSelector: (env) => booleanSelector(env, ENV_USE_FIPS_ENDPOINT, SelectorType.ENV),
502
- configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_FIPS_ENDPOINT, SelectorType.CONFIG),
503
- default: false
504
- };
505
-
506
- // ../../node_modules/@smithy/config-resolver/dist-es/regionConfig/config.js
507
- var REGION_ENV_NAME = "AWS_REGION";
508
- var REGION_INI_NAME = "region";
509
- var NODE_REGION_CONFIG_OPTIONS = {
510
- environmentVariableSelector: (env) => env[REGION_ENV_NAME],
511
- configFileSelector: (profile) => profile[REGION_INI_NAME],
512
- default: () => {
513
- throw new Error("Region is missing");
514
- }
515
- };
516
- var NODE_REGION_CONFIG_FILE_OPTIONS = {
517
- preferredFile: "credentials"
518
- };
519
-
520
- // ../../node_modules/@smithy/middleware-content-length/dist-es/index.js
521
- var CONTENT_LENGTH_HEADER = "content-length";
522
- function contentLengthMiddleware(bodyLengthChecker) {
523
- return (next) => async (args) => {
524
- const request = args.request;
525
- if (HttpRequest.isInstance(request)) {
526
- const { body, headers } = request;
527
- if (body && Object.keys(headers).map((str) => str.toLowerCase()).indexOf(CONTENT_LENGTH_HEADER) === -1) {
528
- try {
529
- const length = bodyLengthChecker(body);
530
- request.headers = {
531
- ...request.headers,
532
- [CONTENT_LENGTH_HEADER]: String(length)
533
- };
534
- } catch (error) {
535
- }
536
- }
537
- }
538
- return next({
539
- ...args,
540
- request
541
- });
542
- };
543
- }
544
- var contentLengthMiddlewareOptions = {
545
- step: "build",
546
- tags: ["SET_CONTENT_LENGTH", "CONTENT_LENGTH"],
547
- name: "contentLengthMiddleware",
548
- override: true
549
- };
550
- var getContentLengthPlugin = (options) => ({
551
- applyToStack: (clientStack) => {
552
- clientStack.add(contentLengthMiddleware(options.bodyLengthChecker), contentLengthMiddlewareOptions);
553
- }
554
- });
555
-
556
- // ../../node_modules/@smithy/middleware-endpoint/dist-es/service-customizations/s3.js
557
- var resolveParamsForS3 = async (endpointParams) => {
558
- const bucket = endpointParams?.Bucket || "";
559
- if (typeof endpointParams.Bucket === "string") {
560
- endpointParams.Bucket = bucket.replace(/#/g, encodeURIComponent("#")).replace(/\?/g, encodeURIComponent("?"));
561
- }
562
- if (isArnBucketName(bucket)) {
563
- if (endpointParams.ForcePathStyle === true) {
564
- throw new Error("Path-style addressing cannot be used with ARN buckets");
565
- }
566
- } else if (!isDnsCompatibleBucketName(bucket) || bucket.indexOf(".") !== -1 && !String(endpointParams.Endpoint).startsWith("http:") || bucket.toLowerCase() !== bucket || bucket.length < 3) {
567
- endpointParams.ForcePathStyle = true;
568
- }
569
- if (endpointParams.DisableMultiRegionAccessPoints) {
570
- endpointParams.disableMultiRegionAccessPoints = true;
571
- endpointParams.DisableMRAP = true;
572
- }
573
- return endpointParams;
574
- };
575
- var DOMAIN_PATTERN = /^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/;
576
- var IP_ADDRESS_PATTERN = /(\d+\.){3}\d+/;
577
- var DOTS_PATTERN = /\.\./;
578
- var isDnsCompatibleBucketName = (bucketName) => DOMAIN_PATTERN.test(bucketName) && !IP_ADDRESS_PATTERN.test(bucketName) && !DOTS_PATTERN.test(bucketName);
579
- var isArnBucketName = (bucketName) => {
580
- const [arn, partition, service, , , bucket] = bucketName.split(":");
581
- const isArn = arn === "arn" && bucketName.split(":").length >= 6;
582
- const isValidArn = Boolean(isArn && partition && service && bucket);
583
- if (isArn && !isValidArn) {
584
- throw new Error(`Invalid ARN: ${bucketName} was an invalid ARN.`);
585
- }
586
- return isValidArn;
587
- };
588
-
589
- // ../../node_modules/@smithy/middleware-endpoint/dist-es/adaptors/createConfigValueProvider.js
590
- var createConfigValueProvider = (configKey, canonicalEndpointParamKey, config) => {
591
- const configProvider = async () => {
592
- const configValue = config[configKey] ?? config[canonicalEndpointParamKey];
593
- if (typeof configValue === "function") {
594
- return configValue();
595
- }
596
- return configValue;
597
- };
598
- if (configKey === "credentialScope" || canonicalEndpointParamKey === "CredentialScope") {
599
- return async () => {
600
- const credentials = typeof config.credentials === "function" ? await config.credentials() : config.credentials;
601
- const configValue = credentials?.credentialScope ?? credentials?.CredentialScope;
602
- return configValue;
603
- };
604
- }
605
- if (configKey === "accountId" || canonicalEndpointParamKey === "AccountId") {
606
- return async () => {
607
- const credentials = typeof config.credentials === "function" ? await config.credentials() : config.credentials;
608
- const configValue = credentials?.accountId ?? credentials?.AccountId;
609
- return configValue;
610
- };
611
- }
612
- if (configKey === "endpoint" || canonicalEndpointParamKey === "endpoint") {
613
- return async () => {
614
- if (config.isCustomEndpoint === false) {
615
- return void 0;
616
- }
617
- const endpoint = await configProvider();
618
- if (endpoint && typeof endpoint === "object") {
619
- if ("url" in endpoint) {
620
- return endpoint.url.href;
621
- }
622
- if ("hostname" in endpoint) {
623
- const { protocol, hostname, port, path } = endpoint;
624
- return `${protocol}//${hostname}${port ? ":" + port : ""}${path}`;
625
- }
626
- }
627
- return endpoint;
628
- };
629
- }
630
- return configProvider;
631
- };
632
-
633
- // ../../node_modules/@smithy/middleware-endpoint/dist-es/adaptors/getEndpointUrlConfig.js
634
- var ENV_ENDPOINT_URL = "AWS_ENDPOINT_URL";
635
- var CONFIG_ENDPOINT_URL = "endpoint_url";
636
- var getEndpointUrlConfig = (serviceId) => ({
637
- environmentVariableSelector: (env) => {
638
- const serviceSuffixParts = serviceId.split(" ").map((w) => w.toUpperCase());
639
- const serviceEndpointUrl = env[[ENV_ENDPOINT_URL, ...serviceSuffixParts].join("_")];
640
- if (serviceEndpointUrl)
641
- return serviceEndpointUrl;
642
- const endpointUrl = env[ENV_ENDPOINT_URL];
643
- if (endpointUrl)
644
- return endpointUrl;
645
- return void 0;
646
- },
647
- configFileSelector: (profile, config) => {
648
- if (config && profile.services) {
649
- const servicesSection = config[["services", profile.services].join(CONFIG_PREFIX_SEPARATOR)];
650
- if (servicesSection) {
651
- const servicePrefixParts = serviceId.split(" ").map((w) => w.toLowerCase());
652
- const endpointUrl2 = servicesSection[[servicePrefixParts.join("_"), CONFIG_ENDPOINT_URL].join(CONFIG_PREFIX_SEPARATOR)];
653
- if (endpointUrl2)
654
- return endpointUrl2;
655
- }
656
- }
657
- const endpointUrl = profile[CONFIG_ENDPOINT_URL];
658
- if (endpointUrl)
659
- return endpointUrl;
660
- return void 0;
661
- },
662
- default: void 0
663
- });
664
-
665
- // ../../node_modules/@smithy/middleware-endpoint/dist-es/adaptors/getEndpointFromConfig.js
666
- var getEndpointFromConfig = async (serviceId) => loadConfig(getEndpointUrlConfig(serviceId ?? ""))();
667
-
668
- // ../../node_modules/@smithy/middleware-endpoint/dist-es/adaptors/toEndpointV1.js
669
- var toEndpointV1 = (endpoint) => {
670
- if (typeof endpoint === "object") {
671
- if ("url" in endpoint) {
672
- return parseUrl(endpoint.url);
673
- }
674
- return endpoint;
675
- }
676
- return parseUrl(endpoint);
677
- };
678
-
679
- // ../../node_modules/@smithy/middleware-endpoint/dist-es/adaptors/getEndpointFromInstructions.js
680
- var getEndpointFromInstructions = async (commandInput, instructionsSupplier, clientConfig, context) => {
681
- if (!clientConfig.isCustomEndpoint) {
682
- let endpointFromConfig;
683
- if (clientConfig.serviceConfiguredEndpoint) {
684
- endpointFromConfig = await clientConfig.serviceConfiguredEndpoint();
685
- } else {
686
- endpointFromConfig = await getEndpointFromConfig(clientConfig.serviceId);
687
- }
688
- if (endpointFromConfig) {
689
- clientConfig.endpoint = () => Promise.resolve(toEndpointV1(endpointFromConfig));
690
- clientConfig.isCustomEndpoint = true;
691
- }
692
- }
693
- const endpointParams = await resolveParams(commandInput, instructionsSupplier, clientConfig);
694
- if (typeof clientConfig.endpointProvider !== "function") {
695
- throw new Error("config.endpointProvider is not set.");
696
- }
697
- const endpoint = clientConfig.endpointProvider(endpointParams, context);
698
- return endpoint;
699
- };
700
- var resolveParams = async (commandInput, instructionsSupplier, clientConfig) => {
701
- const endpointParams = {};
702
- const instructions = instructionsSupplier?.getEndpointParameterInstructions?.() || {};
703
- for (const [name, instruction] of Object.entries(instructions)) {
704
- switch (instruction.type) {
705
- case "staticContextParams":
706
- endpointParams[name] = instruction.value;
707
- break;
708
- case "contextParams":
709
- endpointParams[name] = commandInput[instruction.name];
710
- break;
711
- case "clientContextParams":
712
- case "builtInParams":
713
- endpointParams[name] = await createConfigValueProvider(instruction.name, name, clientConfig)();
714
- break;
715
- case "operationContextParams":
716
- endpointParams[name] = instruction.get(commandInput);
717
- break;
718
- default:
719
- throw new Error("Unrecognized endpoint parameter instruction: " + JSON.stringify(instruction));
720
- }
721
- }
722
- if (Object.keys(instructions).length === 0) {
723
- Object.assign(endpointParams, clientConfig);
724
- }
725
- if (String(clientConfig.serviceId).toLowerCase() === "s3") {
726
- await resolveParamsForS3(endpointParams);
727
- }
728
- return endpointParams;
729
- };
730
-
731
- // ../../node_modules/@smithy/middleware-endpoint/dist-es/endpointMiddleware.js
732
- var endpointMiddleware = ({ config, instructions }) => {
733
- return (next, context) => async (args) => {
734
- if (config.isCustomEndpoint) {
735
- setFeature(context, "ENDPOINT_OVERRIDE", "N");
736
- }
737
- const endpoint = await getEndpointFromInstructions(args.input, {
738
- getEndpointParameterInstructions() {
739
- return instructions;
740
- }
741
- }, { ...config }, context);
742
- context.endpointV2 = endpoint;
743
- context.authSchemes = endpoint.properties?.authSchemes;
744
- const authScheme = context.authSchemes?.[0];
745
- if (authScheme) {
746
- context["signing_region"] = authScheme.signingRegion;
747
- context["signing_service"] = authScheme.signingName;
748
- const smithyContext = getSmithyContext(context);
749
- const httpAuthOption = smithyContext?.selectedHttpAuthScheme?.httpAuthOption;
750
- if (httpAuthOption) {
751
- httpAuthOption.signingProperties = Object.assign(httpAuthOption.signingProperties || {}, {
752
- signing_region: authScheme.signingRegion,
753
- signingRegion: authScheme.signingRegion,
754
- signing_service: authScheme.signingName,
755
- signingName: authScheme.signingName,
756
- signingRegionSet: authScheme.signingRegionSet
757
- }, authScheme.properties);
758
- }
759
- }
760
- return next({
761
- ...args
762
- });
763
- };
764
- };
765
-
766
- // ../../node_modules/@smithy/middleware-endpoint/dist-es/getEndpointPlugin.js
767
- var endpointMiddlewareOptions = {
768
- step: "serialize",
769
- tags: ["ENDPOINT_PARAMETERS", "ENDPOINT_V2", "ENDPOINT"],
770
- name: "endpointV2Middleware",
771
- override: true,
772
- relation: "before",
773
- toMiddleware: serializerMiddlewareOption.name
774
- };
775
- var getEndpointPlugin = (config, instructions) => ({
776
- applyToStack: (clientStack) => {
777
- clientStack.addRelativeTo(endpointMiddleware({
778
- config,
779
- instructions
780
- }), endpointMiddlewareOptions);
781
- }
782
- });
783
-
784
- // ../../node_modules/@smithy/middleware-endpoint/dist-es/resolveEndpointConfig.js
785
- var resolveEndpointConfig = (input) => {
786
- const tls = input.tls ?? true;
787
- const { endpoint, useDualstackEndpoint, useFipsEndpoint } = input;
788
- const customEndpointProvider = endpoint != null ? async () => toEndpointV1(await normalizeProvider(endpoint)()) : void 0;
789
- const isCustomEndpoint = !!endpoint;
790
- const resolvedConfig = Object.assign(input, {
791
- endpoint: customEndpointProvider,
792
- tls,
793
- isCustomEndpoint,
794
- useDualstackEndpoint: normalizeProvider(useDualstackEndpoint ?? false),
795
- useFipsEndpoint: normalizeProvider(useFipsEndpoint ?? false)
796
- });
797
- let configuredEndpointPromise = void 0;
798
- resolvedConfig.serviceConfiguredEndpoint = async () => {
799
- if (input.serviceId && !configuredEndpointPromise) {
800
- configuredEndpointPromise = getEndpointFromConfig(input.serviceId);
801
- }
802
- return configuredEndpointPromise;
803
- };
804
- return resolvedConfig;
805
- };
806
-
807
- // ../../node_modules/@smithy/util-retry/dist-es/config.js
808
- var RETRY_MODES;
809
- (function(RETRY_MODES2) {
810
- RETRY_MODES2["STANDARD"] = "standard";
811
- RETRY_MODES2["ADAPTIVE"] = "adaptive";
812
- })(RETRY_MODES || (RETRY_MODES = {}));
813
- var DEFAULT_MAX_ATTEMPTS = 3;
814
- var DEFAULT_RETRY_MODE = RETRY_MODES.STANDARD;
815
-
816
- // ../../node_modules/@smithy/service-error-classification/dist-es/constants.js
817
- var THROTTLING_ERROR_CODES = [
818
- "BandwidthLimitExceeded",
819
- "EC2ThrottledException",
820
- "LimitExceededException",
821
- "PriorRequestNotComplete",
822
- "ProvisionedThroughputExceededException",
823
- "RequestLimitExceeded",
824
- "RequestThrottled",
825
- "RequestThrottledException",
826
- "SlowDown",
827
- "ThrottledException",
828
- "Throttling",
829
- "ThrottlingException",
830
- "TooManyRequestsException",
831
- "TransactionInProgressException"
832
- ];
833
- var TRANSIENT_ERROR_CODES = ["TimeoutError", "RequestTimeout", "RequestTimeoutException"];
834
- var TRANSIENT_ERROR_STATUS_CODES = [500, 502, 503, 504];
835
- var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "ECONNREFUSED", "EPIPE", "ETIMEDOUT"];
836
-
837
- // ../../node_modules/@smithy/service-error-classification/dist-es/index.js
838
- var isClockSkewCorrectedError = (error) => error.$metadata?.clockSkewCorrected;
839
- var isBrowserNetworkError = (error) => {
840
- const errorMessages = /* @__PURE__ */ new Set([
841
- "Failed to fetch",
842
- "NetworkError when attempting to fetch resource",
843
- "The Internet connection appears to be offline",
844
- "Load failed",
845
- "Network request failed"
846
- ]);
847
- const isValid = error && error instanceof TypeError;
848
- if (!isValid) {
849
- return false;
850
- }
851
- return errorMessages.has(error.message);
852
- };
853
- var isThrottlingError = (error) => error.$metadata?.httpStatusCode === 429 || THROTTLING_ERROR_CODES.includes(error.name) || error.$retryable?.throttling == true;
854
- 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);
855
- var isServerError = (error) => {
856
- if (error.$metadata?.httpStatusCode !== void 0) {
857
- const statusCode = error.$metadata.httpStatusCode;
858
- if (500 <= statusCode && statusCode <= 599 && !isTransientError(error)) {
859
- return true;
860
- }
861
- return false;
862
- }
863
- return false;
864
- };
865
-
866
- // ../../node_modules/@smithy/util-retry/dist-es/DefaultRateLimiter.js
867
- var DefaultRateLimiter = class _DefaultRateLimiter {
868
- constructor(options) {
869
- this.currentCapacity = 0;
870
- this.enabled = false;
871
- this.lastMaxRate = 0;
872
- this.measuredTxRate = 0;
873
- this.requestCount = 0;
874
- this.lastTimestamp = 0;
875
- this.timeWindow = 0;
876
- this.beta = options?.beta ?? 0.7;
877
- this.minCapacity = options?.minCapacity ?? 1;
878
- this.minFillRate = options?.minFillRate ?? 0.5;
879
- this.scaleConstant = options?.scaleConstant ?? 0.4;
880
- this.smooth = options?.smooth ?? 0.8;
881
- const currentTimeInSeconds = this.getCurrentTimeInSeconds();
882
- this.lastThrottleTime = currentTimeInSeconds;
883
- this.lastTxRateBucket = Math.floor(this.getCurrentTimeInSeconds());
884
- this.fillRate = this.minFillRate;
885
- this.maxCapacity = this.minCapacity;
886
- }
887
- getCurrentTimeInSeconds() {
888
- return Date.now() / 1e3;
889
- }
890
- async getSendToken() {
891
- return this.acquireTokenBucket(1);
892
- }
893
- async acquireTokenBucket(amount) {
894
- if (!this.enabled) {
895
- return;
896
- }
897
- this.refillTokenBucket();
898
- if (amount > this.currentCapacity) {
899
- const delay = (amount - this.currentCapacity) / this.fillRate * 1e3;
900
- await new Promise((resolve) => _DefaultRateLimiter.setTimeoutFn(resolve, delay));
901
- }
902
- this.currentCapacity = this.currentCapacity - amount;
903
- }
904
- refillTokenBucket() {
905
- const timestamp = this.getCurrentTimeInSeconds();
906
- if (!this.lastTimestamp) {
907
- this.lastTimestamp = timestamp;
908
- return;
909
- }
910
- const fillAmount = (timestamp - this.lastTimestamp) * this.fillRate;
911
- this.currentCapacity = Math.min(this.maxCapacity, this.currentCapacity + fillAmount);
912
- this.lastTimestamp = timestamp;
913
- }
914
- updateClientSendingRate(response) {
915
- let calculatedRate;
916
- this.updateMeasuredRate();
917
- if (isThrottlingError(response)) {
918
- const rateToUse = !this.enabled ? this.measuredTxRate : Math.min(this.measuredTxRate, this.fillRate);
919
- this.lastMaxRate = rateToUse;
920
- this.calculateTimeWindow();
921
- this.lastThrottleTime = this.getCurrentTimeInSeconds();
922
- calculatedRate = this.cubicThrottle(rateToUse);
923
- this.enableTokenBucket();
924
- } else {
925
- this.calculateTimeWindow();
926
- calculatedRate = this.cubicSuccess(this.getCurrentTimeInSeconds());
927
- }
928
- const newRate = Math.min(calculatedRate, 2 * this.measuredTxRate);
929
- this.updateTokenBucketRate(newRate);
930
- }
931
- calculateTimeWindow() {
932
- this.timeWindow = this.getPrecise(Math.pow(this.lastMaxRate * (1 - this.beta) / this.scaleConstant, 1 / 3));
933
- }
934
- cubicThrottle(rateToUse) {
935
- return this.getPrecise(rateToUse * this.beta);
936
- }
937
- cubicSuccess(timestamp) {
938
- return this.getPrecise(this.scaleConstant * Math.pow(timestamp - this.lastThrottleTime - this.timeWindow, 3) + this.lastMaxRate);
939
- }
940
- enableTokenBucket() {
941
- this.enabled = true;
942
- }
943
- updateTokenBucketRate(newRate) {
944
- this.refillTokenBucket();
945
- this.fillRate = Math.max(newRate, this.minFillRate);
946
- this.maxCapacity = Math.max(newRate, this.minCapacity);
947
- this.currentCapacity = Math.min(this.currentCapacity, this.maxCapacity);
948
- }
949
- updateMeasuredRate() {
950
- const t = this.getCurrentTimeInSeconds();
951
- const timeBucket = Math.floor(t * 2) / 2;
952
- this.requestCount++;
953
- if (timeBucket > this.lastTxRateBucket) {
954
- const currentRate = this.requestCount / (timeBucket - this.lastTxRateBucket);
955
- this.measuredTxRate = this.getPrecise(currentRate * this.smooth + this.measuredTxRate * (1 - this.smooth));
956
- this.requestCount = 0;
957
- this.lastTxRateBucket = timeBucket;
958
- }
959
- }
960
- getPrecise(num) {
961
- return parseFloat(num.toFixed(8));
962
- }
963
- };
964
- DefaultRateLimiter.setTimeoutFn = setTimeout;
965
-
966
- // ../../node_modules/@smithy/util-retry/dist-es/constants.js
967
- var DEFAULT_RETRY_DELAY_BASE = 100;
968
- var MAXIMUM_RETRY_DELAY = 20 * 1e3;
969
- var THROTTLING_RETRY_DELAY_BASE = 500;
970
- var INITIAL_RETRY_TOKENS = 500;
971
- var RETRY_COST = 5;
972
- var TIMEOUT_RETRY_COST = 10;
973
- var NO_RETRY_INCREMENT = 1;
974
- var INVOCATION_ID_HEADER = "amz-sdk-invocation-id";
975
- var REQUEST_HEADER = "amz-sdk-request";
976
-
977
- // ../../node_modules/@smithy/util-retry/dist-es/defaultRetryBackoffStrategy.js
978
- var getDefaultRetryBackoffStrategy = () => {
979
- let delayBase = DEFAULT_RETRY_DELAY_BASE;
980
- const computeNextBackoffDelay = (attempts) => {
981
- return Math.floor(Math.min(MAXIMUM_RETRY_DELAY, Math.random() * 2 ** attempts * delayBase));
982
- };
983
- const setDelayBase = (delay) => {
984
- delayBase = delay;
985
- };
986
- return {
987
- computeNextBackoffDelay,
988
- setDelayBase
989
- };
990
- };
991
-
992
- // ../../node_modules/@smithy/util-retry/dist-es/defaultRetryToken.js
993
- var createDefaultRetryToken = ({ retryDelay, retryCount, retryCost }) => {
994
- const getRetryCount = () => retryCount;
995
- const getRetryDelay = () => Math.min(MAXIMUM_RETRY_DELAY, retryDelay);
996
- const getRetryCost = () => retryCost;
997
- return {
998
- getRetryCount,
999
- getRetryDelay,
1000
- getRetryCost
1001
- };
1002
- };
1003
-
1004
- // ../../node_modules/@smithy/util-retry/dist-es/StandardRetryStrategy.js
1005
- var StandardRetryStrategy = class {
1006
- constructor(maxAttempts) {
1007
- this.maxAttempts = maxAttempts;
1008
- this.mode = RETRY_MODES.STANDARD;
1009
- this.capacity = INITIAL_RETRY_TOKENS;
1010
- this.retryBackoffStrategy = getDefaultRetryBackoffStrategy();
1011
- this.maxAttemptsProvider = typeof maxAttempts === "function" ? maxAttempts : async () => maxAttempts;
1012
- }
1013
- async acquireInitialRetryToken(retryTokenScope) {
1014
- return createDefaultRetryToken({
1015
- retryDelay: DEFAULT_RETRY_DELAY_BASE,
1016
- retryCount: 0
1017
- });
1018
- }
1019
- async refreshRetryTokenForRetry(token, errorInfo) {
1020
- const maxAttempts = await this.getMaxAttempts();
1021
- if (this.shouldRetry(token, errorInfo, maxAttempts)) {
1022
- const errorType = errorInfo.errorType;
1023
- this.retryBackoffStrategy.setDelayBase(errorType === "THROTTLING" ? THROTTLING_RETRY_DELAY_BASE : DEFAULT_RETRY_DELAY_BASE);
1024
- const delayFromErrorType = this.retryBackoffStrategy.computeNextBackoffDelay(token.getRetryCount());
1025
- const retryDelay = errorInfo.retryAfterHint ? Math.max(errorInfo.retryAfterHint.getTime() - Date.now() || 0, delayFromErrorType) : delayFromErrorType;
1026
- const capacityCost = this.getCapacityCost(errorType);
1027
- this.capacity -= capacityCost;
1028
- return createDefaultRetryToken({
1029
- retryDelay,
1030
- retryCount: token.getRetryCount() + 1,
1031
- retryCost: capacityCost
1032
- });
1033
- }
1034
- throw new Error("No retry token available");
1035
- }
1036
- recordSuccess(token) {
1037
- this.capacity = Math.max(INITIAL_RETRY_TOKENS, this.capacity + (token.getRetryCost() ?? NO_RETRY_INCREMENT));
1038
- }
1039
- getCapacity() {
1040
- return this.capacity;
1041
- }
1042
- async getMaxAttempts() {
1043
- try {
1044
- return await this.maxAttemptsProvider();
1045
- } catch (error) {
1046
- console.warn(`Max attempts provider could not resolve. Using default of ${DEFAULT_MAX_ATTEMPTS}`);
1047
- return DEFAULT_MAX_ATTEMPTS;
1048
- }
1049
- }
1050
- shouldRetry(tokenToRenew, errorInfo, maxAttempts) {
1051
- const attempts = tokenToRenew.getRetryCount() + 1;
1052
- return attempts < maxAttempts && this.capacity >= this.getCapacityCost(errorInfo.errorType) && this.isRetryableError(errorInfo.errorType);
1053
- }
1054
- getCapacityCost(errorType) {
1055
- return errorType === "TRANSIENT" ? TIMEOUT_RETRY_COST : RETRY_COST;
1056
- }
1057
- isRetryableError(errorType) {
1058
- return errorType === "THROTTLING" || errorType === "TRANSIENT";
1059
- }
1060
- };
1061
-
1062
- // ../../node_modules/@smithy/util-retry/dist-es/AdaptiveRetryStrategy.js
1063
- var AdaptiveRetryStrategy = class {
1064
- constructor(maxAttemptsProvider, options) {
1065
- this.maxAttemptsProvider = maxAttemptsProvider;
1066
- this.mode = RETRY_MODES.ADAPTIVE;
1067
- const { rateLimiter } = options ?? {};
1068
- this.rateLimiter = rateLimiter ?? new DefaultRateLimiter();
1069
- this.standardRetryStrategy = new StandardRetryStrategy(maxAttemptsProvider);
1070
- }
1071
- async acquireInitialRetryToken(retryTokenScope) {
1072
- await this.rateLimiter.getSendToken();
1073
- return this.standardRetryStrategy.acquireInitialRetryToken(retryTokenScope);
1074
- }
1075
- async refreshRetryTokenForRetry(tokenToRenew, errorInfo) {
1076
- this.rateLimiter.updateClientSendingRate(errorInfo);
1077
- return this.standardRetryStrategy.refreshRetryTokenForRetry(tokenToRenew, errorInfo);
1078
- }
1079
- recordSuccess(token) {
1080
- this.rateLimiter.updateClientSendingRate({});
1081
- this.standardRetryStrategy.recordSuccess(token);
1082
- }
1083
- };
1084
-
1085
- // ../../node_modules/@smithy/middleware-retry/dist-es/configurations.js
1086
- var ENV_MAX_ATTEMPTS = "AWS_MAX_ATTEMPTS";
1087
- var CONFIG_MAX_ATTEMPTS = "max_attempts";
1088
- var NODE_MAX_ATTEMPT_CONFIG_OPTIONS = {
1089
- environmentVariableSelector: (env) => {
1090
- const value = env[ENV_MAX_ATTEMPTS];
1091
- if (!value)
1092
- return void 0;
1093
- const maxAttempt = parseInt(value);
1094
- if (Number.isNaN(maxAttempt)) {
1095
- throw new Error(`Environment variable ${ENV_MAX_ATTEMPTS} mast be a number, got "${value}"`);
1096
- }
1097
- return maxAttempt;
1098
- },
1099
- configFileSelector: (profile) => {
1100
- const value = profile[CONFIG_MAX_ATTEMPTS];
1101
- if (!value)
1102
- return void 0;
1103
- const maxAttempt = parseInt(value);
1104
- if (Number.isNaN(maxAttempt)) {
1105
- throw new Error(`Shared config file entry ${CONFIG_MAX_ATTEMPTS} mast be a number, got "${value}"`);
1106
- }
1107
- return maxAttempt;
1108
- },
1109
- default: DEFAULT_MAX_ATTEMPTS
1110
- };
1111
- var resolveRetryConfig = (input) => {
1112
- const { retryStrategy, retryMode: _retryMode, maxAttempts: _maxAttempts } = input;
1113
- const maxAttempts = normalizeProvider(_maxAttempts ?? DEFAULT_MAX_ATTEMPTS);
1114
- return Object.assign(input, {
1115
- maxAttempts,
1116
- retryStrategy: async () => {
1117
- if (retryStrategy) {
1118
- return retryStrategy;
1119
- }
1120
- const retryMode = await normalizeProvider(_retryMode)();
1121
- if (retryMode === RETRY_MODES.ADAPTIVE) {
1122
- return new AdaptiveRetryStrategy(maxAttempts);
1123
- }
1124
- return new StandardRetryStrategy(maxAttempts);
1125
- }
1126
- });
1127
- };
1128
- var ENV_RETRY_MODE = "AWS_RETRY_MODE";
1129
- var CONFIG_RETRY_MODE = "retry_mode";
1130
- var NODE_RETRY_MODE_CONFIG_OPTIONS = {
1131
- environmentVariableSelector: (env) => env[ENV_RETRY_MODE],
1132
- configFileSelector: (profile) => profile[CONFIG_RETRY_MODE],
1133
- default: DEFAULT_RETRY_MODE
1134
- };
1135
- var rnds8Pool = new Uint8Array(256);
1136
- var poolPtr = rnds8Pool.length;
1137
- function rng() {
1138
- if (poolPtr > rnds8Pool.length - 16) {
1139
- crypto.randomFillSync(rnds8Pool);
1140
- poolPtr = 0;
1141
- }
1142
- return rnds8Pool.slice(poolPtr, poolPtr += 16);
1143
- }
1144
-
1145
- // ../../node_modules/uuid/dist/esm-node/stringify.js
1146
- var byteToHex = [];
1147
- for (let i = 0; i < 256; ++i) {
1148
- byteToHex.push((i + 256).toString(16).slice(1));
1149
- }
1150
- function unsafeStringify(arr, offset = 0) {
1151
- 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]];
1152
- }
1153
- var native_default = {
1154
- randomUUID: crypto.randomUUID
1155
- };
1156
-
1157
- // ../../node_modules/uuid/dist/esm-node/v4.js
1158
- function v4(options, buf, offset) {
1159
- if (native_default.randomUUID && !buf && !options) {
1160
- return native_default.randomUUID();
1161
- }
1162
- options = options || {};
1163
- const rnds = options.random || (options.rng || rng)();
1164
- rnds[6] = rnds[6] & 15 | 64;
1165
- rnds[8] = rnds[8] & 63 | 128;
1166
- if (buf) {
1167
- offset = offset || 0;
1168
- for (let i = 0; i < 16; ++i) {
1169
- buf[offset + i] = rnds[i];
1170
- }
1171
- return buf;
1172
- }
1173
- return unsafeStringify(rnds);
1174
- }
1175
- var v4_default = v4;
1176
- var isStreamingPayload = (request) => request?.body instanceof Readable || typeof ReadableStream !== "undefined" && request?.body instanceof ReadableStream;
1177
-
1178
- // ../../node_modules/@smithy/middleware-retry/dist-es/util.js
1179
- var asSdkError = (error) => {
1180
- if (error instanceof Error)
1181
- return error;
1182
- if (error instanceof Object)
1183
- return Object.assign(new Error(), error);
1184
- if (typeof error === "string")
1185
- return new Error(error);
1186
- return new Error(`AWS SDK error wrapper for ${error}`);
1187
- };
1188
-
1189
- // ../../node_modules/@smithy/middleware-retry/dist-es/retryMiddleware.js
1190
- var retryMiddleware = (options) => (next, context) => async (args) => {
1191
- let retryStrategy = await options.retryStrategy();
1192
- const maxAttempts = await options.maxAttempts();
1193
- if (isRetryStrategyV2(retryStrategy)) {
1194
- retryStrategy = retryStrategy;
1195
- let retryToken = await retryStrategy.acquireInitialRetryToken(context["partition_id"]);
1196
- let lastError = new Error();
1197
- let attempts = 0;
1198
- let totalRetryDelay = 0;
1199
- const { request } = args;
1200
- const isRequest = HttpRequest.isInstance(request);
1201
- if (isRequest) {
1202
- request.headers[INVOCATION_ID_HEADER] = v4_default();
1203
- }
1204
- while (true) {
1205
- try {
1206
- if (isRequest) {
1207
- request.headers[REQUEST_HEADER] = `attempt=${attempts + 1}; max=${maxAttempts}`;
1208
- }
1209
- const { response, output } = await next(args);
1210
- retryStrategy.recordSuccess(retryToken);
1211
- output.$metadata.attempts = attempts + 1;
1212
- output.$metadata.totalRetryDelay = totalRetryDelay;
1213
- return { response, output };
1214
- } catch (e) {
1215
- const retryErrorInfo = getRetryErrorInfo(e);
1216
- lastError = asSdkError(e);
1217
- if (isRequest && isStreamingPayload(request)) {
1218
- (context.logger instanceof NoOpLogger ? console : context.logger)?.warn("An error was encountered in a non-retryable streaming request.");
1219
- throw lastError;
1220
- }
1221
- try {
1222
- retryToken = await retryStrategy.refreshRetryTokenForRetry(retryToken, retryErrorInfo);
1223
- } catch (refreshError) {
1224
- if (!lastError.$metadata) {
1225
- lastError.$metadata = {};
1226
- }
1227
- lastError.$metadata.attempts = attempts + 1;
1228
- lastError.$metadata.totalRetryDelay = totalRetryDelay;
1229
- throw lastError;
1230
- }
1231
- attempts = retryToken.getRetryCount();
1232
- const delay = retryToken.getRetryDelay();
1233
- totalRetryDelay += delay;
1234
- await new Promise((resolve) => setTimeout(resolve, delay));
1235
- }
1236
- }
1237
- } else {
1238
- retryStrategy = retryStrategy;
1239
- if (retryStrategy?.mode)
1240
- context.userAgent = [...context.userAgent || [], ["cfg/retry-mode", retryStrategy.mode]];
1241
- return retryStrategy.retry(next, args);
1242
- }
1243
- };
1244
- var isRetryStrategyV2 = (retryStrategy) => typeof retryStrategy.acquireInitialRetryToken !== "undefined" && typeof retryStrategy.refreshRetryTokenForRetry !== "undefined" && typeof retryStrategy.recordSuccess !== "undefined";
1245
- var getRetryErrorInfo = (error) => {
1246
- const errorInfo = {
1247
- error,
1248
- errorType: getRetryErrorType(error)
1249
- };
1250
- const retryAfterHint = getRetryAfterHint(error.$response);
1251
- if (retryAfterHint) {
1252
- errorInfo.retryAfterHint = retryAfterHint;
1253
- }
1254
- return errorInfo;
1255
- };
1256
- var getRetryErrorType = (error) => {
1257
- if (isThrottlingError(error))
1258
- return "THROTTLING";
1259
- if (isTransientError(error))
1260
- return "TRANSIENT";
1261
- if (isServerError(error))
1262
- return "SERVER_ERROR";
1263
- return "CLIENT_ERROR";
1264
- };
1265
- var retryMiddlewareOptions = {
1266
- name: "retryMiddleware",
1267
- tags: ["RETRY"],
1268
- step: "finalizeRequest",
1269
- priority: "high",
1270
- override: true
1271
- };
1272
- var getRetryPlugin = (options) => ({
1273
- applyToStack: (clientStack) => {
1274
- clientStack.add(retryMiddleware(options), retryMiddlewareOptions);
1275
- }
1276
- });
1277
- var getRetryAfterHint = (response) => {
1278
- if (!HttpResponse.isInstance(response))
1279
- return;
1280
- const retryAfterHeaderName = Object.keys(response.headers).find((key) => key.toLowerCase() === "retry-after");
1281
- if (!retryAfterHeaderName)
1282
- return;
1283
- const retryAfter = response.headers[retryAfterHeaderName];
1284
- const retryAfterSeconds = Number(retryAfter);
1285
- if (!Number.isNaN(retryAfterSeconds))
1286
- return new Date(retryAfterSeconds * 1e3);
1287
- const retryAfterDate = new Date(retryAfter);
1288
- return retryAfterDate;
1289
- };
1290
- var Hash = class {
1291
- constructor(algorithmIdentifier, secret) {
1292
- this.algorithmIdentifier = algorithmIdentifier;
1293
- this.secret = secret;
1294
- this.reset();
1295
- }
1296
- update(toHash, encoding) {
1297
- this.hash.update(toUint8Array(castSourceData(toHash, encoding)));
1298
- }
1299
- digest() {
1300
- return Promise.resolve(this.hash.digest());
1301
- }
1302
- reset() {
1303
- this.hash = this.secret ? createHmac(this.algorithmIdentifier, castSourceData(this.secret)) : createHash(this.algorithmIdentifier);
1304
- }
1305
- };
1306
- function castSourceData(toCast, encoding) {
1307
- if (Buffer$1.isBuffer(toCast)) {
1308
- return toCast;
1309
- }
1310
- if (typeof toCast === "string") {
1311
- return fromString(toCast, encoding);
1312
- }
1313
- if (ArrayBuffer.isView(toCast)) {
1314
- return fromArrayBuffer(toCast.buffer, toCast.byteOffset, toCast.byteLength);
1315
- }
1316
- return fromArrayBuffer(toCast);
1317
- }
1318
- var calculateBodyLength = (body) => {
1319
- if (!body) {
1320
- return 0;
1321
- }
1322
- if (typeof body === "string") {
1323
- return Buffer.byteLength(body);
1324
- } else if (typeof body.byteLength === "number") {
1325
- return body.byteLength;
1326
- } else if (typeof body.size === "number") {
1327
- return body.size;
1328
- } else if (typeof body.start === "number" && typeof body.end === "number") {
1329
- return body.end + 1 - body.start;
1330
- } else if (typeof body.path === "string" || Buffer.isBuffer(body.path)) {
1331
- return lstatSync(body.path).size;
1332
- } else if (typeof body.fd === "number") {
1333
- return fstatSync(body.fd).size;
1334
- }
1335
- throw new Error(`Body Length computation failed for ${body}`);
1336
- };
1337
-
1338
- // ../../node_modules/@smithy/util-defaults-mode-node/dist-es/constants.js
1339
- var AWS_EXECUTION_ENV = "AWS_EXECUTION_ENV";
1340
- var AWS_REGION_ENV = "AWS_REGION";
1341
- var AWS_DEFAULT_REGION_ENV = "AWS_DEFAULT_REGION";
1342
- var ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED";
1343
- var DEFAULTS_MODE_OPTIONS = ["in-region", "cross-region", "mobile", "standard", "legacy"];
1344
- var IMDS_REGION_PATH = "/latest/meta-data/placement/region";
1345
-
1346
- // ../../node_modules/@smithy/util-defaults-mode-node/dist-es/defaultsModeConfig.js
1347
- var AWS_DEFAULTS_MODE_ENV = "AWS_DEFAULTS_MODE";
1348
- var AWS_DEFAULTS_MODE_CONFIG = "defaults_mode";
1349
- var NODE_DEFAULTS_MODE_CONFIG_OPTIONS = {
1350
- environmentVariableSelector: (env) => {
1351
- return env[AWS_DEFAULTS_MODE_ENV];
1352
- },
1353
- configFileSelector: (profile) => {
1354
- return profile[AWS_DEFAULTS_MODE_CONFIG];
1355
- },
1356
- default: "legacy"
1357
- };
1358
-
1359
- // ../../node_modules/@smithy/util-defaults-mode-node/dist-es/resolveDefaultsModeConfig.js
1360
- var resolveDefaultsModeConfig = ({ region = loadConfig(NODE_REGION_CONFIG_OPTIONS), defaultsMode = loadConfig(NODE_DEFAULTS_MODE_CONFIG_OPTIONS) } = {}) => memoize(async () => {
1361
- const mode = typeof defaultsMode === "function" ? await defaultsMode() : defaultsMode;
1362
- switch (mode?.toLowerCase()) {
1363
- case "auto":
1364
- return resolveNodeDefaultsModeAuto(region);
1365
- case "in-region":
1366
- case "cross-region":
1367
- case "mobile":
1368
- case "standard":
1369
- case "legacy":
1370
- return Promise.resolve(mode?.toLocaleLowerCase());
1371
- case void 0:
1372
- return Promise.resolve("legacy");
1373
- default:
1374
- throw new Error(`Invalid parameter for "defaultsMode", expect ${DEFAULTS_MODE_OPTIONS.join(", ")}, got ${mode}`);
1375
- }
1376
- });
1377
- var resolveNodeDefaultsModeAuto = async (clientRegion) => {
1378
- if (clientRegion) {
1379
- const resolvedRegion = typeof clientRegion === "function" ? await clientRegion() : clientRegion;
1380
- const inferredRegion = await inferPhysicalRegion();
1381
- if (!inferredRegion) {
1382
- return "standard";
1383
- }
1384
- if (resolvedRegion === inferredRegion) {
1385
- return "in-region";
1386
- } else {
1387
- return "cross-region";
1388
- }
1389
- }
1390
- return "standard";
1391
- };
1392
- var inferPhysicalRegion = async () => {
1393
- if (process.env[AWS_EXECUTION_ENV] && (process.env[AWS_REGION_ENV] || process.env[AWS_DEFAULT_REGION_ENV])) {
1394
- return process.env[AWS_REGION_ENV] ?? process.env[AWS_DEFAULT_REGION_ENV];
1395
- }
1396
- if (!process.env[ENV_IMDS_DISABLED]) {
1397
- try {
1398
- const { getInstanceMetadataEndpoint, httpRequest } = await import('./dist-es-4ULGGWP4.js');
1399
- const endpoint = await getInstanceMetadataEndpoint();
1400
- return (await httpRequest({ ...endpoint, path: IMDS_REGION_PATH })).toString();
1401
- } catch (e) {
1402
- }
1403
- }
1404
- };
1405
-
1406
- // ../../node_modules/@smithy/util-endpoints/dist-es/lib/isIpAddress.js
1407
- 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}$`);
1408
- var isIpAddress = (value) => IP_V4_REGEX.test(value) || value.startsWith("[") && value.endsWith("]");
1409
-
1410
- // ../../node_modules/@smithy/util-endpoints/dist-es/types/EndpointError.js
1411
- var EndpointError = class extends Error {
1412
- constructor(message) {
1413
- super(message);
1414
- this.name = "EndpointError";
1415
- }
1416
- };
1417
-
1418
- // ../../node_modules/@smithy/util-endpoints/dist-es/debug/debugId.js
1419
- var debugId = "endpoints";
1420
-
1421
- // ../../node_modules/@smithy/util-endpoints/dist-es/debug/toDebugString.js
1422
- function toDebugString(input) {
1423
- if (typeof input !== "object" || input == null) {
1424
- return input;
1425
- }
1426
- if ("ref" in input) {
1427
- return `$${toDebugString(input.ref)}`;
1428
- }
1429
- if ("fn" in input) {
1430
- return `${input.fn}(${(input.argv || []).map(toDebugString).join(", ")})`;
1431
- }
1432
- return JSON.stringify(input, null, 2);
1433
- }
1434
-
1435
- // ../../node_modules/@smithy/util-endpoints/dist-es/utils/customEndpointFunctions.js
1436
- var customEndpointFunctions = {};
1437
-
1438
- // ../../node_modules/@smithy/util-endpoints/dist-es/lib/booleanEquals.js
1439
- var booleanEquals = (value1, value2) => value1 === value2;
1440
-
1441
- // ../../node_modules/@smithy/util-endpoints/dist-es/lib/getAttrPathList.js
1442
- var getAttrPathList = (path) => {
1443
- const parts = path.split(".");
1444
- const pathList = [];
1445
- for (const part of parts) {
1446
- const squareBracketIndex = part.indexOf("[");
1447
- if (squareBracketIndex !== -1) {
1448
- if (part.indexOf("]") !== part.length - 1) {
1449
- throw new EndpointError(`Path: '${path}' does not end with ']'`);
1450
- }
1451
- const arrayIndex = part.slice(squareBracketIndex + 1, -1);
1452
- if (Number.isNaN(parseInt(arrayIndex))) {
1453
- throw new EndpointError(`Invalid array index: '${arrayIndex}' in path: '${path}'`);
1454
- }
1455
- if (squareBracketIndex !== 0) {
1456
- pathList.push(part.slice(0, squareBracketIndex));
1457
- }
1458
- pathList.push(arrayIndex);
1459
- } else {
1460
- pathList.push(part);
1461
- }
1462
- }
1463
- return pathList;
1464
- };
1465
-
1466
- // ../../node_modules/@smithy/util-endpoints/dist-es/lib/getAttr.js
1467
- var getAttr = (value, path) => getAttrPathList(path).reduce((acc, index) => {
1468
- if (typeof acc !== "object") {
1469
- throw new EndpointError(`Index '${index}' in '${path}' not found in '${JSON.stringify(value)}'`);
1470
- } else if (Array.isArray(acc)) {
1471
- return acc[parseInt(index)];
1472
- }
1473
- return acc[index];
1474
- }, value);
1475
-
1476
- // ../../node_modules/@smithy/util-endpoints/dist-es/lib/isSet.js
1477
- var isSet = (value) => value != null;
1478
-
1479
- // ../../node_modules/@smithy/util-endpoints/dist-es/lib/isValidHostLabel.js
1480
- var VALID_HOST_LABEL_REGEX = new RegExp(`^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$`);
1481
- var isValidHostLabel = (value, allowSubDomains = false) => {
1482
- if (!allowSubDomains) {
1483
- return VALID_HOST_LABEL_REGEX.test(value);
1484
- }
1485
- const labels = value.split(".");
1486
- for (const label of labels) {
1487
- if (!isValidHostLabel(label)) {
1488
- return false;
1489
- }
1490
- }
1491
- return true;
1492
- };
1493
-
1494
- // ../../node_modules/@smithy/util-endpoints/dist-es/lib/not.js
1495
- var not = (value) => !value;
1496
-
1497
- // ../../node_modules/@smithy/util-endpoints/dist-es/lib/parseURL.js
1498
- var DEFAULT_PORTS = {
1499
- [EndpointURLScheme.HTTP]: 80,
1500
- [EndpointURLScheme.HTTPS]: 443
1501
- };
1502
- var parseURL = (value) => {
1503
- const whatwgURL = (() => {
1504
- try {
1505
- if (value instanceof URL) {
1506
- return value;
1507
- }
1508
- if (typeof value === "object" && "hostname" in value) {
1509
- const { hostname: hostname2, port, protocol: protocol2 = "", path = "", query = {} } = value;
1510
- const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path}`);
1511
- url.search = Object.entries(query).map(([k, v]) => `${k}=${v}`).join("&");
1512
- return url;
1513
- }
1514
- return new URL(value);
1515
- } catch (error) {
1516
- return null;
1517
- }
1518
- })();
1519
- if (!whatwgURL) {
1520
- console.error(`Unable to parse ${JSON.stringify(value)} as a whatwg URL.`);
1521
- return null;
1522
- }
1523
- const urlString = whatwgURL.href;
1524
- const { host, hostname, pathname, protocol, search } = whatwgURL;
1525
- if (search) {
1526
- return null;
1527
- }
1528
- const scheme = protocol.slice(0, -1);
1529
- if (!Object.values(EndpointURLScheme).includes(scheme)) {
1530
- return null;
1531
- }
1532
- const isIp = isIpAddress(hostname);
1533
- const inputContainsDefaultPort = urlString.includes(`${host}:${DEFAULT_PORTS[scheme]}`) || typeof value === "string" && value.includes(`${host}:${DEFAULT_PORTS[scheme]}`);
1534
- const authority = `${host}${inputContainsDefaultPort ? `:${DEFAULT_PORTS[scheme]}` : ``}`;
1535
- return {
1536
- scheme,
1537
- authority,
1538
- path: pathname,
1539
- normalizedPath: pathname.endsWith("/") ? pathname : `${pathname}/`,
1540
- isIp
1541
- };
1542
- };
1543
-
1544
- // ../../node_modules/@smithy/util-endpoints/dist-es/lib/stringEquals.js
1545
- var stringEquals = (value1, value2) => value1 === value2;
1546
-
1547
- // ../../node_modules/@smithy/util-endpoints/dist-es/lib/substring.js
1548
- var substring = (input, start, stop, reverse) => {
1549
- if (start >= stop || input.length < stop) {
1550
- return null;
1551
- }
1552
- if (!reverse) {
1553
- return input.substring(start, stop);
1554
- }
1555
- return input.substring(input.length - stop, input.length - start);
1556
- };
1557
-
1558
- // ../../node_modules/@smithy/util-endpoints/dist-es/lib/uriEncode.js
1559
- var uriEncode = (value) => encodeURIComponent(value).replace(/[!*'()]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`);
1560
-
1561
- // ../../node_modules/@smithy/util-endpoints/dist-es/utils/endpointFunctions.js
1562
- var endpointFunctions = {
1563
- booleanEquals,
1564
- getAttr,
1565
- isSet,
1566
- isValidHostLabel,
1567
- not,
1568
- parseURL,
1569
- stringEquals,
1570
- substring,
1571
- uriEncode
1572
- };
1573
-
1574
- // ../../node_modules/@smithy/util-endpoints/dist-es/utils/evaluateTemplate.js
1575
- var evaluateTemplate = (template, options) => {
1576
- const evaluatedTemplateArr = [];
1577
- const templateContext = {
1578
- ...options.endpointParams,
1579
- ...options.referenceRecord
1580
- };
1581
- let currentIndex = 0;
1582
- while (currentIndex < template.length) {
1583
- const openingBraceIndex = template.indexOf("{", currentIndex);
1584
- if (openingBraceIndex === -1) {
1585
- evaluatedTemplateArr.push(template.slice(currentIndex));
1586
- break;
1587
- }
1588
- evaluatedTemplateArr.push(template.slice(currentIndex, openingBraceIndex));
1589
- const closingBraceIndex = template.indexOf("}", openingBraceIndex);
1590
- if (closingBraceIndex === -1) {
1591
- evaluatedTemplateArr.push(template.slice(openingBraceIndex));
1592
- break;
1593
- }
1594
- if (template[openingBraceIndex + 1] === "{" && template[closingBraceIndex + 1] === "}") {
1595
- evaluatedTemplateArr.push(template.slice(openingBraceIndex + 1, closingBraceIndex));
1596
- currentIndex = closingBraceIndex + 2;
1597
- }
1598
- const parameterName = template.substring(openingBraceIndex + 1, closingBraceIndex);
1599
- if (parameterName.includes("#")) {
1600
- const [refName, attrName] = parameterName.split("#");
1601
- evaluatedTemplateArr.push(getAttr(templateContext[refName], attrName));
1602
- } else {
1603
- evaluatedTemplateArr.push(templateContext[parameterName]);
1604
- }
1605
- currentIndex = closingBraceIndex + 1;
1606
- }
1607
- return evaluatedTemplateArr.join("");
1608
- };
1609
-
1610
- // ../../node_modules/@smithy/util-endpoints/dist-es/utils/getReferenceValue.js
1611
- var getReferenceValue = ({ ref }, options) => {
1612
- const referenceRecord = {
1613
- ...options.endpointParams,
1614
- ...options.referenceRecord
1615
- };
1616
- return referenceRecord[ref];
1617
- };
1618
-
1619
- // ../../node_modules/@smithy/util-endpoints/dist-es/utils/evaluateExpression.js
1620
- var evaluateExpression = (obj, keyName, options) => {
1621
- if (typeof obj === "string") {
1622
- return evaluateTemplate(obj, options);
1623
- } else if (obj["fn"]) {
1624
- return callFunction(obj, options);
1625
- } else if (obj["ref"]) {
1626
- return getReferenceValue(obj, options);
1627
- }
1628
- throw new EndpointError(`'${keyName}': ${String(obj)} is not a string, function or reference.`);
1629
- };
1630
-
1631
- // ../../node_modules/@smithy/util-endpoints/dist-es/utils/callFunction.js
1632
- var callFunction = ({ fn, argv }, options) => {
1633
- const evaluatedArgs = argv.map((arg) => ["boolean", "number"].includes(typeof arg) ? arg : evaluateExpression(arg, "arg", options));
1634
- const fnSegments = fn.split(".");
1635
- if (fnSegments[0] in customEndpointFunctions && fnSegments[1] != null) {
1636
- return customEndpointFunctions[fnSegments[0]][fnSegments[1]](...evaluatedArgs);
1637
- }
1638
- return endpointFunctions[fn](...evaluatedArgs);
1639
- };
1640
-
1641
- // ../../node_modules/@smithy/util-endpoints/dist-es/utils/evaluateCondition.js
1642
- var evaluateCondition = ({ assign, ...fnArgs }, options) => {
1643
- if (assign && assign in options.referenceRecord) {
1644
- throw new EndpointError(`'${assign}' is already defined in Reference Record.`);
1645
- }
1646
- const value = callFunction(fnArgs, options);
1647
- options.logger?.debug?.(`${debugId} evaluateCondition: ${toDebugString(fnArgs)} = ${toDebugString(value)}`);
1648
- return {
1649
- result: value === "" ? true : !!value,
1650
- ...assign != null && { toAssign: { name: assign, value } }
1651
- };
1652
- };
1653
-
1654
- // ../../node_modules/@smithy/util-endpoints/dist-es/utils/evaluateConditions.js
1655
- var evaluateConditions = (conditions = [], options) => {
1656
- const conditionsReferenceRecord = {};
1657
- for (const condition of conditions) {
1658
- const { result, toAssign } = evaluateCondition(condition, {
1659
- ...options,
1660
- referenceRecord: {
1661
- ...options.referenceRecord,
1662
- ...conditionsReferenceRecord
1663
- }
1664
- });
1665
- if (!result) {
1666
- return { result };
1667
- }
1668
- if (toAssign) {
1669
- conditionsReferenceRecord[toAssign.name] = toAssign.value;
1670
- options.logger?.debug?.(`${debugId} assign: ${toAssign.name} := ${toDebugString(toAssign.value)}`);
1671
- }
1672
- }
1673
- return { result: true, referenceRecord: conditionsReferenceRecord };
1674
- };
1675
-
1676
- // ../../node_modules/@smithy/util-endpoints/dist-es/utils/getEndpointHeaders.js
1677
- var getEndpointHeaders = (headers, options) => Object.entries(headers).reduce((acc, [headerKey, headerVal]) => ({
1678
- ...acc,
1679
- [headerKey]: headerVal.map((headerValEntry) => {
1680
- const processedExpr = evaluateExpression(headerValEntry, "Header value entry", options);
1681
- if (typeof processedExpr !== "string") {
1682
- throw new EndpointError(`Header '${headerKey}' value '${processedExpr}' is not a string`);
1683
- }
1684
- return processedExpr;
1685
- })
1686
- }), {});
1687
-
1688
- // ../../node_modules/@smithy/util-endpoints/dist-es/utils/getEndpointProperty.js
1689
- var getEndpointProperty = (property, options) => {
1690
- if (Array.isArray(property)) {
1691
- return property.map((propertyEntry) => getEndpointProperty(propertyEntry, options));
1692
- }
1693
- switch (typeof property) {
1694
- case "string":
1695
- return evaluateTemplate(property, options);
1696
- case "object":
1697
- if (property === null) {
1698
- throw new EndpointError(`Unexpected endpoint property: ${property}`);
1699
- }
1700
- return getEndpointProperties(property, options);
1701
- case "boolean":
1702
- return property;
1703
- default:
1704
- throw new EndpointError(`Unexpected endpoint property type: ${typeof property}`);
1705
- }
1706
- };
1707
-
1708
- // ../../node_modules/@smithy/util-endpoints/dist-es/utils/getEndpointProperties.js
1709
- var getEndpointProperties = (properties, options) => Object.entries(properties).reduce((acc, [propertyKey, propertyVal]) => ({
1710
- ...acc,
1711
- [propertyKey]: getEndpointProperty(propertyVal, options)
1712
- }), {});
1713
-
1714
- // ../../node_modules/@smithy/util-endpoints/dist-es/utils/getEndpointUrl.js
1715
- var getEndpointUrl = (endpointUrl, options) => {
1716
- const expression = evaluateExpression(endpointUrl, "Endpoint URL", options);
1717
- if (typeof expression === "string") {
1718
- try {
1719
- return new URL(expression);
1720
- } catch (error) {
1721
- console.error(`Failed to construct URL with ${expression}`, error);
1722
- throw error;
1723
- }
1724
- }
1725
- throw new EndpointError(`Endpoint URL must be a string, got ${typeof expression}`);
1726
- };
1727
-
1728
- // ../../node_modules/@smithy/util-endpoints/dist-es/utils/evaluateEndpointRule.js
1729
- var evaluateEndpointRule = (endpointRule, options) => {
1730
- const { conditions, endpoint } = endpointRule;
1731
- const { result, referenceRecord } = evaluateConditions(conditions, options);
1732
- if (!result) {
1733
- return;
1734
- }
1735
- const endpointRuleOptions = {
1736
- ...options,
1737
- referenceRecord: { ...options.referenceRecord, ...referenceRecord }
1738
- };
1739
- const { url, properties, headers } = endpoint;
1740
- options.logger?.debug?.(`${debugId} Resolving endpoint from template: ${toDebugString(endpoint)}`);
1741
- return {
1742
- ...headers != void 0 && {
1743
- headers: getEndpointHeaders(headers, endpointRuleOptions)
1744
- },
1745
- ...properties != void 0 && {
1746
- properties: getEndpointProperties(properties, endpointRuleOptions)
1747
- },
1748
- url: getEndpointUrl(url, endpointRuleOptions)
1749
- };
1750
- };
1751
-
1752
- // ../../node_modules/@smithy/util-endpoints/dist-es/utils/evaluateErrorRule.js
1753
- var evaluateErrorRule = (errorRule, options) => {
1754
- const { conditions, error } = errorRule;
1755
- const { result, referenceRecord } = evaluateConditions(conditions, options);
1756
- if (!result) {
1757
- return;
1758
- }
1759
- throw new EndpointError(evaluateExpression(error, "Error", {
1760
- ...options,
1761
- referenceRecord: { ...options.referenceRecord, ...referenceRecord }
1762
- }));
1763
- };
1764
-
1765
- // ../../node_modules/@smithy/util-endpoints/dist-es/utils/evaluateTreeRule.js
1766
- var evaluateTreeRule = (treeRule, options) => {
1767
- const { conditions, rules } = treeRule;
1768
- const { result, referenceRecord } = evaluateConditions(conditions, options);
1769
- if (!result) {
1770
- return;
1771
- }
1772
- return evaluateRules(rules, {
1773
- ...options,
1774
- referenceRecord: { ...options.referenceRecord, ...referenceRecord }
1775
- });
1776
- };
1777
-
1778
- // ../../node_modules/@smithy/util-endpoints/dist-es/utils/evaluateRules.js
1779
- var evaluateRules = (rules, options) => {
1780
- for (const rule of rules) {
1781
- if (rule.type === "endpoint") {
1782
- const endpointOrUndefined = evaluateEndpointRule(rule, options);
1783
- if (endpointOrUndefined) {
1784
- return endpointOrUndefined;
1785
- }
1786
- } else if (rule.type === "error") {
1787
- evaluateErrorRule(rule, options);
1788
- } else if (rule.type === "tree") {
1789
- const endpointOrUndefined = evaluateTreeRule(rule, options);
1790
- if (endpointOrUndefined) {
1791
- return endpointOrUndefined;
1792
- }
1793
- } else {
1794
- throw new EndpointError(`Unknown endpoint rule: ${rule}`);
1795
- }
1796
- }
1797
- throw new EndpointError(`Rules evaluation failed`);
1798
- };
1799
-
1800
- // ../../node_modules/@smithy/util-endpoints/dist-es/resolveEndpoint.js
1801
- var resolveEndpoint = (ruleSetObject, options) => {
1802
- const { endpointParams, logger } = options;
1803
- const { parameters, rules } = ruleSetObject;
1804
- options.logger?.debug?.(`${debugId} Initial EndpointParams: ${toDebugString(endpointParams)}`);
1805
- const paramsWithDefault = Object.entries(parameters).filter(([, v]) => v.default != null).map(([k, v]) => [k, v.default]);
1806
- if (paramsWithDefault.length > 0) {
1807
- for (const [paramKey, paramDefaultValue] of paramsWithDefault) {
1808
- endpointParams[paramKey] = endpointParams[paramKey] ?? paramDefaultValue;
1809
- }
1810
- }
1811
- const requiredParams = Object.entries(parameters).filter(([, v]) => v.required).map(([k]) => k);
1812
- for (const requiredParam of requiredParams) {
1813
- if (endpointParams[requiredParam] == null) {
1814
- throw new EndpointError(`Missing required parameter: '${requiredParam}'`);
1815
- }
1816
- }
1817
- const endpoint = evaluateRules(rules, { endpointParams, logger, referenceRecord: {} });
1818
- options.logger?.debug?.(`${debugId} Resolved endpoint: ${toDebugString(endpoint)}`);
1819
- return endpoint;
1820
- };
1821
-
1822
- // ../../node_modules/@smithy/signature-v4/dist-es/constants.js
1823
- var ALGORITHM_QUERY_PARAM = "X-Amz-Algorithm";
1824
- var CREDENTIAL_QUERY_PARAM = "X-Amz-Credential";
1825
- var AMZ_DATE_QUERY_PARAM = "X-Amz-Date";
1826
- var SIGNED_HEADERS_QUERY_PARAM = "X-Amz-SignedHeaders";
1827
- var EXPIRES_QUERY_PARAM = "X-Amz-Expires";
1828
- var SIGNATURE_QUERY_PARAM = "X-Amz-Signature";
1829
- var TOKEN_QUERY_PARAM = "X-Amz-Security-Token";
1830
- var AUTH_HEADER = "authorization";
1831
- var AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase();
1832
- var DATE_HEADER = "date";
1833
- var GENERATED_HEADERS = [AUTH_HEADER, AMZ_DATE_HEADER, DATE_HEADER];
1834
- var SIGNATURE_HEADER = SIGNATURE_QUERY_PARAM.toLowerCase();
1835
- var SHA256_HEADER = "x-amz-content-sha256";
1836
- var TOKEN_HEADER = TOKEN_QUERY_PARAM.toLowerCase();
1837
- var ALWAYS_UNSIGNABLE_HEADERS = {
1838
- authorization: true,
1839
- "cache-control": true,
1840
- connection: true,
1841
- expect: true,
1842
- from: true,
1843
- "keep-alive": true,
1844
- "max-forwards": true,
1845
- pragma: true,
1846
- referer: true,
1847
- te: true,
1848
- trailer: true,
1849
- "transfer-encoding": true,
1850
- upgrade: true,
1851
- "user-agent": true,
1852
- "x-amzn-trace-id": true
1853
- };
1854
- var PROXY_HEADER_PATTERN = /^proxy-/;
1855
- var SEC_HEADER_PATTERN = /^sec-/;
1856
- var ALGORITHM_IDENTIFIER = "AWS4-HMAC-SHA256";
1857
- var EVENT_ALGORITHM_IDENTIFIER = "AWS4-HMAC-SHA256-PAYLOAD";
1858
- var UNSIGNED_PAYLOAD = "UNSIGNED-PAYLOAD";
1859
- var MAX_CACHE_SIZE = 50;
1860
- var KEY_TYPE_IDENTIFIER = "aws4_request";
1861
- var MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7;
1862
-
1863
- // ../../node_modules/@smithy/signature-v4/dist-es/credentialDerivation.js
1864
- var signingKeyCache = {};
1865
- var cacheQueue = [];
1866
- var createScope = (shortDate, region, service) => `${shortDate}/${region}/${service}/${KEY_TYPE_IDENTIFIER}`;
1867
- var getSigningKey = async (sha256Constructor, credentials, shortDate, region, service) => {
1868
- const credsHash = await hmac(sha256Constructor, credentials.secretAccessKey, credentials.accessKeyId);
1869
- const cacheKey = `${shortDate}:${region}:${service}:${toHex(credsHash)}:${credentials.sessionToken}`;
1870
- if (cacheKey in signingKeyCache) {
1871
- return signingKeyCache[cacheKey];
1872
- }
1873
- cacheQueue.push(cacheKey);
1874
- while (cacheQueue.length > MAX_CACHE_SIZE) {
1875
- delete signingKeyCache[cacheQueue.shift()];
1876
- }
1877
- let key = `AWS4${credentials.secretAccessKey}`;
1878
- for (const signable of [shortDate, region, service, KEY_TYPE_IDENTIFIER]) {
1879
- key = await hmac(sha256Constructor, key, signable);
1880
- }
1881
- return signingKeyCache[cacheKey] = key;
1882
- };
1883
- var hmac = (ctor, secret, data) => {
1884
- const hash = new ctor(secret);
1885
- hash.update(toUint8Array(data));
1886
- return hash.digest();
1887
- };
1888
-
1889
- // ../../node_modules/@smithy/signature-v4/dist-es/getCanonicalHeaders.js
1890
- var getCanonicalHeaders = ({ headers }, unsignableHeaders, signableHeaders) => {
1891
- const canonical = {};
1892
- for (const headerName of Object.keys(headers).sort()) {
1893
- if (headers[headerName] == void 0) {
1894
- continue;
1895
- }
1896
- const canonicalHeaderName = headerName.toLowerCase();
1897
- if (canonicalHeaderName in ALWAYS_UNSIGNABLE_HEADERS || unsignableHeaders?.has(canonicalHeaderName) || PROXY_HEADER_PATTERN.test(canonicalHeaderName) || SEC_HEADER_PATTERN.test(canonicalHeaderName)) {
1898
- if (!signableHeaders || signableHeaders && !signableHeaders.has(canonicalHeaderName)) {
1899
- continue;
1900
- }
1901
- }
1902
- canonical[canonicalHeaderName] = headers[headerName].trim().replace(/\s+/g, " ");
1903
- }
1904
- return canonical;
1905
- };
1906
-
1907
- // ../../node_modules/@smithy/signature-v4/dist-es/getPayloadHash.js
1908
- var getPayloadHash = async ({ headers, body }, hashConstructor) => {
1909
- for (const headerName of Object.keys(headers)) {
1910
- if (headerName.toLowerCase() === SHA256_HEADER) {
1911
- return headers[headerName];
1912
- }
1913
- }
1914
- if (body == void 0) {
1915
- return "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
1916
- } else if (typeof body === "string" || ArrayBuffer.isView(body) || isArrayBuffer(body)) {
1917
- const hashCtor = new hashConstructor();
1918
- hashCtor.update(toUint8Array(body));
1919
- return toHex(await hashCtor.digest());
1920
- }
1921
- return UNSIGNED_PAYLOAD;
1922
- };
1923
-
1924
- // ../../node_modules/@smithy/signature-v4/dist-es/HeaderFormatter.js
1925
- var HeaderFormatter = class {
1926
- format(headers) {
1927
- const chunks = [];
1928
- for (const headerName of Object.keys(headers)) {
1929
- const bytes = fromUtf8(headerName);
1930
- chunks.push(Uint8Array.from([bytes.byteLength]), bytes, this.formatHeaderValue(headers[headerName]));
1931
- }
1932
- const out = new Uint8Array(chunks.reduce((carry, bytes) => carry + bytes.byteLength, 0));
1933
- let position = 0;
1934
- for (const chunk of chunks) {
1935
- out.set(chunk, position);
1936
- position += chunk.byteLength;
1937
- }
1938
- return out;
1939
- }
1940
- formatHeaderValue(header) {
1941
- switch (header.type) {
1942
- case "boolean":
1943
- return Uint8Array.from([header.value ? 0 : 1]);
1944
- case "byte":
1945
- return Uint8Array.from([2, header.value]);
1946
- case "short":
1947
- const shortView = new DataView(new ArrayBuffer(3));
1948
- shortView.setUint8(0, 3);
1949
- shortView.setInt16(1, header.value, false);
1950
- return new Uint8Array(shortView.buffer);
1951
- case "integer":
1952
- const intView = new DataView(new ArrayBuffer(5));
1953
- intView.setUint8(0, 4);
1954
- intView.setInt32(1, header.value, false);
1955
- return new Uint8Array(intView.buffer);
1956
- case "long":
1957
- const longBytes = new Uint8Array(9);
1958
- longBytes[0] = 5;
1959
- longBytes.set(header.value.bytes, 1);
1960
- return longBytes;
1961
- case "binary":
1962
- const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength));
1963
- binView.setUint8(0, 6);
1964
- binView.setUint16(1, header.value.byteLength, false);
1965
- const binBytes = new Uint8Array(binView.buffer);
1966
- binBytes.set(header.value, 3);
1967
- return binBytes;
1968
- case "string":
1969
- const utf8Bytes = fromUtf8(header.value);
1970
- const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength));
1971
- strView.setUint8(0, 7);
1972
- strView.setUint16(1, utf8Bytes.byteLength, false);
1973
- const strBytes = new Uint8Array(strView.buffer);
1974
- strBytes.set(utf8Bytes, 3);
1975
- return strBytes;
1976
- case "timestamp":
1977
- const tsBytes = new Uint8Array(9);
1978
- tsBytes[0] = 8;
1979
- tsBytes.set(Int64.fromNumber(header.value.valueOf()).bytes, 1);
1980
- return tsBytes;
1981
- case "uuid":
1982
- if (!UUID_PATTERN.test(header.value)) {
1983
- throw new Error(`Invalid UUID received: ${header.value}`);
1984
- }
1985
- const uuidBytes = new Uint8Array(17);
1986
- uuidBytes[0] = 9;
1987
- uuidBytes.set(fromHex(header.value.replace(/\-/g, "")), 1);
1988
- return uuidBytes;
1989
- }
1990
- }
1991
- };
1992
- var HEADER_VALUE_TYPE;
1993
- (function(HEADER_VALUE_TYPE2) {
1994
- HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["boolTrue"] = 0] = "boolTrue";
1995
- HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["boolFalse"] = 1] = "boolFalse";
1996
- HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["byte"] = 2] = "byte";
1997
- HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["short"] = 3] = "short";
1998
- HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["integer"] = 4] = "integer";
1999
- HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["long"] = 5] = "long";
2000
- HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["byteArray"] = 6] = "byteArray";
2001
- HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["string"] = 7] = "string";
2002
- HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["timestamp"] = 8] = "timestamp";
2003
- HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["uuid"] = 9] = "uuid";
2004
- })(HEADER_VALUE_TYPE || (HEADER_VALUE_TYPE = {}));
2005
- var UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
2006
- var Int64 = class _Int64 {
2007
- constructor(bytes) {
2008
- this.bytes = bytes;
2009
- if (bytes.byteLength !== 8) {
2010
- throw new Error("Int64 buffers must be exactly 8 bytes");
2011
- }
2012
- }
2013
- static fromNumber(number) {
2014
- if (number > 9223372036854776e3 || number < -9223372036854776e3) {
2015
- throw new Error(`${number} is too large (or, if negative, too small) to represent as an Int64`);
2016
- }
2017
- const bytes = new Uint8Array(8);
2018
- for (let i = 7, remaining = Math.abs(Math.round(number)); i > -1 && remaining > 0; i--, remaining /= 256) {
2019
- bytes[i] = remaining;
2020
- }
2021
- if (number < 0) {
2022
- negate(bytes);
2023
- }
2024
- return new _Int64(bytes);
2025
- }
2026
- valueOf() {
2027
- const bytes = this.bytes.slice(0);
2028
- const negative = bytes[0] & 128;
2029
- if (negative) {
2030
- negate(bytes);
2031
- }
2032
- return parseInt(toHex(bytes), 16) * (negative ? -1 : 1);
2033
- }
2034
- toString() {
2035
- return String(this.valueOf());
2036
- }
2037
- };
2038
- function negate(bytes) {
2039
- for (let i = 0; i < 8; i++) {
2040
- bytes[i] ^= 255;
2041
- }
2042
- for (let i = 7; i > -1; i--) {
2043
- bytes[i]++;
2044
- if (bytes[i] !== 0)
2045
- break;
2046
- }
2047
- }
2048
-
2049
- // ../../node_modules/@smithy/signature-v4/dist-es/headerUtil.js
2050
- var hasHeader = (soughtHeader, headers) => {
2051
- soughtHeader = soughtHeader.toLowerCase();
2052
- for (const headerName of Object.keys(headers)) {
2053
- if (soughtHeader === headerName.toLowerCase()) {
2054
- return true;
2055
- }
2056
- }
2057
- return false;
2058
- };
2059
-
2060
- // ../../node_modules/@smithy/signature-v4/dist-es/moveHeadersToQuery.js
2061
- var moveHeadersToQuery = (request, options = {}) => {
2062
- const { headers, query = {} } = HttpRequest.clone(request);
2063
- for (const name of Object.keys(headers)) {
2064
- const lname = name.toLowerCase();
2065
- if (lname.slice(0, 6) === "x-amz-" && !options.unhoistableHeaders?.has(lname) || options.hoistableHeaders?.has(lname)) {
2066
- query[name] = headers[name];
2067
- delete headers[name];
2068
- }
2069
- }
2070
- return {
2071
- ...request,
2072
- headers,
2073
- query
2074
- };
2075
- };
2076
-
2077
- // ../../node_modules/@smithy/signature-v4/dist-es/prepareRequest.js
2078
- var prepareRequest = (request) => {
2079
- request = HttpRequest.clone(request);
2080
- for (const headerName of Object.keys(request.headers)) {
2081
- if (GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) {
2082
- delete request.headers[headerName];
2083
- }
2084
- }
2085
- return request;
2086
- };
2087
-
2088
- // ../../node_modules/@smithy/signature-v4/dist-es/getCanonicalQuery.js
2089
- var getCanonicalQuery = ({ query = {} }) => {
2090
- const keys = [];
2091
- const serialized = {};
2092
- for (const key of Object.keys(query)) {
2093
- if (key.toLowerCase() === SIGNATURE_HEADER) {
2094
- continue;
2095
- }
2096
- const encodedKey = escapeUri(key);
2097
- keys.push(encodedKey);
2098
- const value = query[key];
2099
- if (typeof value === "string") {
2100
- serialized[encodedKey] = `${encodedKey}=${escapeUri(value)}`;
2101
- } else if (Array.isArray(value)) {
2102
- serialized[encodedKey] = value.slice(0).reduce((encoded, value2) => encoded.concat([`${encodedKey}=${escapeUri(value2)}`]), []).sort().join("&");
2103
- }
2104
- }
2105
- return keys.sort().map((key) => serialized[key]).filter((serialized2) => serialized2).join("&");
2106
- };
2107
-
2108
- // ../../node_modules/@smithy/signature-v4/dist-es/utilDate.js
2109
- var iso8601 = (time) => toDate(time).toISOString().replace(/\.\d{3}Z$/, "Z");
2110
- var toDate = (time) => {
2111
- if (typeof time === "number") {
2112
- return new Date(time * 1e3);
2113
- }
2114
- if (typeof time === "string") {
2115
- if (Number(time)) {
2116
- return new Date(Number(time) * 1e3);
2117
- }
2118
- return new Date(time);
2119
- }
2120
- return time;
2121
- };
2122
-
2123
- // ../../node_modules/@smithy/signature-v4/dist-es/SignatureV4Base.js
2124
- var SignatureV4Base = class {
2125
- constructor({ applyChecksum, credentials, region, service, sha256, uriEscapePath = true }) {
2126
- this.service = service;
2127
- this.sha256 = sha256;
2128
- this.uriEscapePath = uriEscapePath;
2129
- this.applyChecksum = typeof applyChecksum === "boolean" ? applyChecksum : true;
2130
- this.regionProvider = normalizeProvider(region);
2131
- this.credentialProvider = normalizeProvider(credentials);
2132
- }
2133
- createCanonicalRequest(request, canonicalHeaders, payloadHash) {
2134
- const sortedHeaders = Object.keys(canonicalHeaders).sort();
2135
- return `${request.method}
2136
- ${this.getCanonicalPath(request)}
2137
- ${getCanonicalQuery(request)}
2138
- ${sortedHeaders.map((name) => `${name}:${canonicalHeaders[name]}`).join("\n")}
2139
-
2140
- ${sortedHeaders.join(";")}
2141
- ${payloadHash}`;
2142
- }
2143
- async createStringToSign(longDate, credentialScope, canonicalRequest, algorithmIdentifier) {
2144
- const hash = new this.sha256();
2145
- hash.update(toUint8Array(canonicalRequest));
2146
- const hashedRequest = await hash.digest();
2147
- return `${algorithmIdentifier}
2148
- ${longDate}
2149
- ${credentialScope}
2150
- ${toHex(hashedRequest)}`;
2151
- }
2152
- getCanonicalPath({ path }) {
2153
- if (this.uriEscapePath) {
2154
- const normalizedPathSegments = [];
2155
- for (const pathSegment of path.split("/")) {
2156
- if (pathSegment?.length === 0)
2157
- continue;
2158
- if (pathSegment === ".")
2159
- continue;
2160
- if (pathSegment === "..") {
2161
- normalizedPathSegments.pop();
2162
- } else {
2163
- normalizedPathSegments.push(pathSegment);
2164
- }
2165
- }
2166
- const normalizedPath = `${path?.startsWith("/") ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && path?.endsWith("/") ? "/" : ""}`;
2167
- const doubleEncoded = escapeUri(normalizedPath);
2168
- return doubleEncoded.replace(/%2F/g, "/");
2169
- }
2170
- return path;
2171
- }
2172
- validateResolvedCredentials(credentials) {
2173
- if (typeof credentials !== "object" || typeof credentials.accessKeyId !== "string" || typeof credentials.secretAccessKey !== "string") {
2174
- throw new Error("Resolved credential object is not valid");
2175
- }
2176
- }
2177
- formatDate(now) {
2178
- const longDate = iso8601(now).replace(/[\-:]/g, "");
2179
- return {
2180
- longDate,
2181
- shortDate: longDate.slice(0, 8)
2182
- };
2183
- }
2184
- getCanonicalHeaderList(headers) {
2185
- return Object.keys(headers).sort().join(";");
2186
- }
2187
- };
2188
-
2189
- // ../../node_modules/@smithy/signature-v4/dist-es/SignatureV4.js
2190
- var SignatureV4 = class extends SignatureV4Base {
2191
- constructor({ applyChecksum, credentials, region, service, sha256, uriEscapePath = true }) {
2192
- super({
2193
- applyChecksum,
2194
- credentials,
2195
- region,
2196
- service,
2197
- sha256,
2198
- uriEscapePath
2199
- });
2200
- this.headerFormatter = new HeaderFormatter();
2201
- }
2202
- async presign(originalRequest, options = {}) {
2203
- const { signingDate = /* @__PURE__ */ new Date(), expiresIn = 3600, unsignableHeaders, unhoistableHeaders, signableHeaders, hoistableHeaders, signingRegion, signingService } = options;
2204
- const credentials = await this.credentialProvider();
2205
- this.validateResolvedCredentials(credentials);
2206
- const region = signingRegion ?? await this.regionProvider();
2207
- const { longDate, shortDate } = this.formatDate(signingDate);
2208
- if (expiresIn > MAX_PRESIGNED_TTL) {
2209
- return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");
2210
- }
2211
- const scope = createScope(shortDate, region, signingService ?? this.service);
2212
- const request = moveHeadersToQuery(prepareRequest(originalRequest), { unhoistableHeaders, hoistableHeaders });
2213
- if (credentials.sessionToken) {
2214
- request.query[TOKEN_QUERY_PARAM] = credentials.sessionToken;
2215
- }
2216
- request.query[ALGORITHM_QUERY_PARAM] = ALGORITHM_IDENTIFIER;
2217
- request.query[CREDENTIAL_QUERY_PARAM] = `${credentials.accessKeyId}/${scope}`;
2218
- request.query[AMZ_DATE_QUERY_PARAM] = longDate;
2219
- request.query[EXPIRES_QUERY_PARAM] = expiresIn.toString(10);
2220
- const canonicalHeaders = getCanonicalHeaders(request, unsignableHeaders, signableHeaders);
2221
- request.query[SIGNED_HEADERS_QUERY_PARAM] = this.getCanonicalHeaderList(canonicalHeaders);
2222
- request.query[SIGNATURE_QUERY_PARAM] = await this.getSignature(longDate, scope, this.getSigningKey(credentials, region, shortDate, signingService), this.createCanonicalRequest(request, canonicalHeaders, await getPayloadHash(originalRequest, this.sha256)));
2223
- return request;
2224
- }
2225
- async sign(toSign, options) {
2226
- if (typeof toSign === "string") {
2227
- return this.signString(toSign, options);
2228
- } else if (toSign.headers && toSign.payload) {
2229
- return this.signEvent(toSign, options);
2230
- } else if (toSign.message) {
2231
- return this.signMessage(toSign, options);
2232
- } else {
2233
- return this.signRequest(toSign, options);
2234
- }
2235
- }
2236
- async signEvent({ headers, payload }, { signingDate = /* @__PURE__ */ new Date(), priorSignature, signingRegion, signingService }) {
2237
- const region = signingRegion ?? await this.regionProvider();
2238
- const { shortDate, longDate } = this.formatDate(signingDate);
2239
- const scope = createScope(shortDate, region, signingService ?? this.service);
2240
- const hashedPayload = await getPayloadHash({ headers: {}, body: payload }, this.sha256);
2241
- const hash = new this.sha256();
2242
- hash.update(headers);
2243
- const hashedHeaders = toHex(await hash.digest());
2244
- const stringToSign = [
2245
- EVENT_ALGORITHM_IDENTIFIER,
2246
- longDate,
2247
- scope,
2248
- priorSignature,
2249
- hashedHeaders,
2250
- hashedPayload
2251
- ].join("\n");
2252
- return this.signString(stringToSign, { signingDate, signingRegion: region, signingService });
2253
- }
2254
- async signMessage(signableMessage, { signingDate = /* @__PURE__ */ new Date(), signingRegion, signingService }) {
2255
- const promise = this.signEvent({
2256
- headers: this.headerFormatter.format(signableMessage.message.headers),
2257
- payload: signableMessage.message.body
2258
- }, {
2259
- signingDate,
2260
- signingRegion,
2261
- signingService,
2262
- priorSignature: signableMessage.priorSignature
2263
- });
2264
- return promise.then((signature) => {
2265
- return { message: signableMessage.message, signature };
2266
- });
2267
- }
2268
- async signString(stringToSign, { signingDate = /* @__PURE__ */ new Date(), signingRegion, signingService } = {}) {
2269
- const credentials = await this.credentialProvider();
2270
- this.validateResolvedCredentials(credentials);
2271
- const region = signingRegion ?? await this.regionProvider();
2272
- const { shortDate } = this.formatDate(signingDate);
2273
- const hash = new this.sha256(await this.getSigningKey(credentials, region, shortDate, signingService));
2274
- hash.update(toUint8Array(stringToSign));
2275
- return toHex(await hash.digest());
2276
- }
2277
- async signRequest(requestToSign, { signingDate = /* @__PURE__ */ new Date(), signableHeaders, unsignableHeaders, signingRegion, signingService } = {}) {
2278
- const credentials = await this.credentialProvider();
2279
- this.validateResolvedCredentials(credentials);
2280
- const region = signingRegion ?? await this.regionProvider();
2281
- const request = prepareRequest(requestToSign);
2282
- const { longDate, shortDate } = this.formatDate(signingDate);
2283
- const scope = createScope(shortDate, region, signingService ?? this.service);
2284
- request.headers[AMZ_DATE_HEADER] = longDate;
2285
- if (credentials.sessionToken) {
2286
- request.headers[TOKEN_HEADER] = credentials.sessionToken;
2287
- }
2288
- const payloadHash = await getPayloadHash(request, this.sha256);
2289
- if (!hasHeader(SHA256_HEADER, request.headers) && this.applyChecksum) {
2290
- request.headers[SHA256_HEADER] = payloadHash;
2291
- }
2292
- const canonicalHeaders = getCanonicalHeaders(request, unsignableHeaders, signableHeaders);
2293
- const signature = await this.getSignature(longDate, scope, this.getSigningKey(credentials, region, shortDate, signingService), this.createCanonicalRequest(request, canonicalHeaders, payloadHash));
2294
- request.headers[AUTH_HEADER] = `${ALGORITHM_IDENTIFIER} Credential=${credentials.accessKeyId}/${scope}, SignedHeaders=${this.getCanonicalHeaderList(canonicalHeaders)}, Signature=${signature}`;
2295
- return request;
2296
- }
2297
- async getSignature(longDate, credentialScope, keyPromise, canonicalRequest) {
2298
- const stringToSign = await this.createStringToSign(longDate, credentialScope, canonicalRequest, ALGORITHM_IDENTIFIER);
2299
- const hash = new this.sha256(await keyPromise);
2300
- hash.update(toUint8Array(stringToSign));
2301
- return toHex(await hash.digest());
2302
- }
2303
- getSigningKey(credentials, region, shortDate, service) {
2304
- return getSigningKey(this.sha256, credentials, shortDate, region, service || this.service);
2305
- }
2306
- };
2307
-
2308
- // ../../node_modules/@smithy/util-endpoints/dist-es/cache/EndpointCache.js
2309
- var EndpointCache = class {
2310
- constructor({ size, params }) {
2311
- this.data = /* @__PURE__ */ new Map();
2312
- this.parameters = [];
2313
- this.capacity = size ?? 50;
2314
- if (params) {
2315
- this.parameters = params;
2316
- }
2317
- }
2318
- get(endpointParams, resolver) {
2319
- const key = this.hash(endpointParams);
2320
- if (key === false) {
2321
- return resolver();
2322
- }
2323
- if (!this.data.has(key)) {
2324
- if (this.data.size > this.capacity + 10) {
2325
- const keys = this.data.keys();
2326
- let i = 0;
2327
- while (true) {
2328
- const { value, done } = keys.next();
2329
- this.data.delete(value);
2330
- if (done || ++i > 10) {
2331
- break;
2332
- }
2333
- }
2334
- }
2335
- this.data.set(key, resolver());
2336
- }
2337
- return this.data.get(key);
2338
- }
2339
- size() {
2340
- return this.data.size;
2341
- }
2342
- hash(endpointParams) {
2343
- let buffer = "";
2344
- const { parameters } = this;
2345
- if (parameters.length === 0) {
2346
- return false;
2347
- }
2348
- for (const param of parameters) {
2349
- const val = String(endpointParams[param] ?? "");
2350
- if (val.includes("|;")) {
2351
- return false;
2352
- }
2353
- buffer += val + "|;";
2354
- }
2355
- return buffer;
2356
- }
2357
- };
2358
-
2359
- export { DEFAULT_RETRY_MODE, DefaultIdentityProviderConfig, EndpointCache, Hash, NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS, NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, NoAuthSigner, SignatureV4, calculateBodyLength, createPaginator, customEndpointFunctions, doesIdentityRequireRefresh, getContentLengthPlugin, getEndpointPlugin, getHttpAuthSchemeEndpointRuleSetPlugin, getHttpSigningPlugin, getRetryPlugin, getSerdePlugin, getSmithyContext, isIdentityExpired, isIpAddress, isValidHostLabel, memoizeIdentityProvider, normalizeProvider, normalizeProvider2, requestBuilder, resolveDefaultsModeConfig, resolveEndpoint, resolveEndpointConfig, resolveRegionConfig, resolveRetryConfig };