@semiont/graph 0.5.10 → 0.5.12

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 (66) hide show
  1. package/dist/{chunk-RUQUFRTB.js → chunk-2FZWFAHI.js} +2 -2
  2. package/dist/{chunk-7UEKNJE3.js → chunk-7W3WYDYY.js} +947 -768
  3. package/dist/chunk-7W3WYDYY.js.map +1 -0
  4. package/dist/{chunk-HQ3XLO52.js → chunk-ANBNC7ET.js} +9 -11
  5. package/dist/chunk-ANBNC7ET.js.map +1 -0
  6. package/dist/{chunk-DCLCNCC5.js → chunk-FG7DZRU2.js} +47 -138
  7. package/dist/chunk-FG7DZRU2.js.map +1 -0
  8. package/dist/{chunk-WVFBW2BJ.js → chunk-FUH65BXZ.js} +3 -3
  9. package/dist/chunk-GH2BPPIO.js +358 -0
  10. package/dist/chunk-GH2BPPIO.js.map +1 -0
  11. package/dist/{chunk-2UFYZAZA.js → chunk-SIIGOCAF.js} +88 -169
  12. package/dist/chunk-SIIGOCAF.js.map +1 -0
  13. package/dist/chunk-TTCF2MVW.js +2238 -0
  14. package/dist/chunk-TTCF2MVW.js.map +1 -0
  15. package/dist/dist-es-2TLZH4GR.js +286 -0
  16. package/dist/dist-es-2TLZH4GR.js.map +1 -0
  17. package/dist/{dist-es-F3ITMM62.js → dist-es-3LHYAN2Z.js} +4 -4
  18. package/dist/{dist-es-RKGSX75L.js → dist-es-ERGUA43M.js} +126 -265
  19. package/dist/dist-es-ERGUA43M.js.map +1 -0
  20. package/dist/{dist-es-RHZZGTBH.js → dist-es-FF2QSTPC.js} +20 -14
  21. package/dist/dist-es-FF2QSTPC.js.map +1 -0
  22. package/dist/{dist-es-T7UQEVTL.js → dist-es-FYIEMWHW.js} +5 -5
  23. package/dist/{dist-es-SEF7BNPV.js → dist-es-QUWKNR3E.js} +3 -3
  24. package/dist/{dist-es-PIT4UOVB.js → dist-es-VWWFUSHN.js} +7 -7
  25. package/dist/dist-es-WPIJNMD4.js +220 -0
  26. package/dist/dist-es-WPIJNMD4.js.map +1 -0
  27. package/dist/{dist-es-HQN7ECGH.js → dist-es-YDMYLFPU.js} +5 -5
  28. package/dist/{event-streams-AI5RIQ2F.js → event-streams-C2JNHHGL.js} +20 -503
  29. package/dist/event-streams-C2JNHHGL.js.map +1 -0
  30. package/dist/index.js +45 -19
  31. package/dist/index.js.map +1 -1
  32. package/dist/{loadSso-GG2G7R6K.js → loadSso-XDB76252.js} +22 -19
  33. package/dist/loadSso-XDB76252.js.map +1 -0
  34. package/dist/{signin-W2DUKDEU.js → signin-AHFRIARE.js} +24 -21
  35. package/dist/signin-AHFRIARE.js.map +1 -0
  36. package/dist/{sso-oidc-QMDDOWYK.js → sso-oidc-3B3W33KS.js} +22 -18
  37. package/dist/sso-oidc-3B3W33KS.js.map +1 -0
  38. package/dist/{sts-3APBVT3H.js → sts-OXRUFMHG.js} +23 -25
  39. package/dist/sts-OXRUFMHG.js.map +1 -0
  40. package/package.json +7 -7
  41. package/dist/chunk-2UFYZAZA.js.map +0 -1
  42. package/dist/chunk-7UEKNJE3.js.map +0 -1
  43. package/dist/chunk-DCLCNCC5.js.map +0 -1
  44. package/dist/chunk-GXSQEW4F.js +0 -694
  45. package/dist/chunk-GXSQEW4F.js.map +0 -1
  46. package/dist/chunk-HQ3XLO52.js.map +0 -1
  47. package/dist/chunk-MTWDPBDH.js +0 -576
  48. package/dist/chunk-MTWDPBDH.js.map +0 -1
  49. package/dist/chunk-USQJFUZP.js +0 -1166
  50. package/dist/chunk-USQJFUZP.js.map +0 -1
  51. package/dist/dist-es-RHZZGTBH.js.map +0 -1
  52. package/dist/dist-es-RKGSX75L.js.map +0 -1
  53. package/dist/dist-es-ZEE6WCCG.js +0 -492
  54. package/dist/dist-es-ZEE6WCCG.js.map +0 -1
  55. package/dist/event-streams-AI5RIQ2F.js.map +0 -1
  56. package/dist/loadSso-GG2G7R6K.js.map +0 -1
  57. package/dist/signin-W2DUKDEU.js.map +0 -1
  58. package/dist/sso-oidc-QMDDOWYK.js.map +0 -1
  59. package/dist/sts-3APBVT3H.js.map +0 -1
  60. /package/dist/{chunk-RUQUFRTB.js.map → chunk-2FZWFAHI.js.map} +0 -0
  61. /package/dist/{chunk-WVFBW2BJ.js.map → chunk-FUH65BXZ.js.map} +0 -0
  62. /package/dist/{dist-es-F3ITMM62.js.map → dist-es-3LHYAN2Z.js.map} +0 -0
  63. /package/dist/{dist-es-T7UQEVTL.js.map → dist-es-FYIEMWHW.js.map} +0 -0
  64. /package/dist/{dist-es-SEF7BNPV.js.map → dist-es-QUWKNR3E.js.map} +0 -0
  65. /package/dist/{dist-es-PIT4UOVB.js.map → dist-es-VWWFUSHN.js.map} +0 -0
  66. /package/dist/{dist-es-HQN7ECGH.js.map → dist-es-YDMYLFPU.js.map} +0 -0
@@ -15,11 +15,28 @@ import {
15
15
  splitHeader,
16
16
  toBase64,
17
17
  toUtf8
18
- } from "./chunk-DCLCNCC5.js";
18
+ } from "./chunk-FG7DZRU2.js";
19
+
20
+ // ../../node_modules/@smithy/types/dist-es/extensions/checksum.js
21
+ var AlgorithmId;
22
+ (function(AlgorithmId2) {
23
+ AlgorithmId2["MD5"] = "md5";
24
+ AlgorithmId2["CRC32"] = "crc32";
25
+ AlgorithmId2["CRC32C"] = "crc32c";
26
+ AlgorithmId2["SHA1"] = "sha1";
27
+ AlgorithmId2["SHA256"] = "sha256";
28
+ })(AlgorithmId || (AlgorithmId = {}));
19
29
 
20
30
  // ../../node_modules/@smithy/types/dist-es/middleware.js
21
31
  var SMITHY_CONTEXT_KEY = "__smithy_context";
22
32
 
33
+ // ../../node_modules/@smithy/types/dist-es/endpoint.js
34
+ var EndpointURLScheme;
35
+ (function(EndpointURLScheme2) {
36
+ EndpointURLScheme2["HTTP"] = "http";
37
+ EndpointURLScheme2["HTTPS"] = "https";
38
+ })(EndpointURLScheme || (EndpointURLScheme = {}));
39
+
23
40
  // ../../node_modules/@smithy/types/dist-es/profile.js
24
41
  var IniSectionType;
25
42
  (function(IniSectionType2) {
@@ -173,6 +190,12 @@ var isValidHostLabel = (value, allowSubDomains = false) => {
173
190
  return true;
174
191
  };
175
192
 
193
+ // ../../node_modules/@smithy/core/dist-es/submodules/transport/isValidHostname.js
194
+ function isValidHostname(hostname) {
195
+ const hostPattern = /^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/;
196
+ return hostPattern.test(hostname);
197
+ }
198
+
176
199
  // ../../node_modules/@smithy/core/dist-es/submodules/transport/toEndpointV1.js
177
200
  var toEndpointV1 = (endpoint) => {
178
201
  if (typeof endpoint === "object") {
@@ -191,6 +214,114 @@ var toEndpointV1 = (endpoint) => {
191
214
  return parseUrl(endpoint);
192
215
  };
193
216
 
217
+ // ../../node_modules/@smithy/core/dist-es/submodules/schema/schemas/operation.js
218
+ var operation = (namespace, name, traits, input, output) => ({
219
+ name,
220
+ namespace,
221
+ traits,
222
+ input,
223
+ output
224
+ });
225
+
226
+ // ../../node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaDeserializationMiddleware.js
227
+ var schemaDeserializationMiddleware = (config) => (next, context) => async (args) => {
228
+ const { response } = await next(args);
229
+ const { operationSchema } = getSmithyContext(context);
230
+ const [, ns, n, t, i, o] = operationSchema ?? [];
231
+ try {
232
+ const parsed = await config.protocol.deserializeResponse(operation(ns, n, t, i, o), {
233
+ ...config,
234
+ ...context
235
+ }, response);
236
+ return {
237
+ response,
238
+ output: parsed
239
+ };
240
+ } catch (error) {
241
+ Object.defineProperty(error, "$response", {
242
+ value: response,
243
+ enumerable: false,
244
+ writable: false,
245
+ configurable: false
246
+ });
247
+ if (!("$metadata" in error)) {
248
+ const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;
249
+ try {
250
+ error.message += "\n " + hint;
251
+ } catch (e) {
252
+ if (!context.logger || context.logger?.constructor?.name === "NoOpLogger") {
253
+ console.warn(hint);
254
+ } else {
255
+ context.logger?.warn?.(hint);
256
+ }
257
+ }
258
+ if (typeof error.$responseBodyText !== "undefined") {
259
+ if (error.$response) {
260
+ error.$response.body = error.$responseBodyText;
261
+ }
262
+ }
263
+ try {
264
+ if (HttpResponse.isInstance(response)) {
265
+ const { headers = {}, statusCode } = response;
266
+ const headerEntries = Object.entries(headers);
267
+ error.$metadata = {
268
+ httpStatusCode: statusCode,
269
+ requestId: findHeader(/^x-[\w-]+-request-?id$/, headerEntries),
270
+ extendedRequestId: findHeader(/^x-[\w-]+-id-2$/, headerEntries),
271
+ cfId: findHeader(/^x-[\w-]+-cf-id$/, headerEntries)
272
+ };
273
+ }
274
+ } catch (e) {
275
+ }
276
+ }
277
+ throw error;
278
+ }
279
+ };
280
+ var findHeader = (pattern, headers) => {
281
+ return (headers.find(([k]) => {
282
+ return k.match(pattern);
283
+ }) || [void 0, void 0])[1];
284
+ };
285
+
286
+ // ../../node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaSerializationMiddleware.js
287
+ var schemaSerializationMiddleware = (config) => (next, context) => async (args) => {
288
+ const { operationSchema } = getSmithyContext(context);
289
+ const [, ns, n, t, i, o] = operationSchema ?? [];
290
+ const endpoint = context.endpointV2 ? async () => toEndpointV1(context.endpointV2) : config.endpoint;
291
+ const request = await config.protocol.serializeRequest(operation(ns, n, t, i, o), args.input, {
292
+ ...config,
293
+ ...context,
294
+ endpoint
295
+ });
296
+ return next({
297
+ ...args,
298
+ request
299
+ });
300
+ };
301
+
302
+ // ../../node_modules/@smithy/core/dist-es/submodules/schema/middleware/getSchemaSerdePlugin.js
303
+ var deserializerMiddlewareOption = {
304
+ name: "deserializerMiddleware",
305
+ step: "deserialize",
306
+ tags: ["DESERIALIZER"],
307
+ override: true
308
+ };
309
+ var serializerMiddlewareOption = {
310
+ name: "serializerMiddleware",
311
+ step: "serialize",
312
+ tags: ["SERIALIZER"],
313
+ override: true
314
+ };
315
+ function getSchemaSerdePlugin(config) {
316
+ return {
317
+ applyToStack: (commandStack) => {
318
+ commandStack.add(schemaSerializationMiddleware(config), serializerMiddlewareOption);
319
+ commandStack.add(schemaDeserializationMiddleware(config), deserializerMiddlewareOption);
320
+ config.protocol.setSerdeContext(config);
321
+ }
322
+ };
323
+ }
324
+
194
325
  // ../../node_modules/@smithy/core/dist-es/submodules/schema/TypeRegistry.js
195
326
  var TypeRegistry = class _TypeRegistry {
196
327
  namespace;
@@ -294,791 +425,892 @@ var TypeRegistry = class _TypeRegistry {
294
425
  }
295
426
  };
296
427
 
297
- // ../../node_modules/@smithy/core/dist-es/submodules/config/property-provider/ProviderError.js
298
- var ProviderError = class _ProviderError extends Error {
299
- name = "ProviderError";
300
- tryNextLink;
301
- constructor(message, options = true) {
302
- let logger;
303
- let tryNextLink = true;
304
- if (typeof options === "boolean") {
305
- logger = void 0;
306
- tryNextLink = options;
307
- } else if (options != null && typeof options === "object") {
308
- logger = options.logger;
309
- tryNextLink = options.tryNextLink ?? true;
310
- }
311
- super(message);
312
- this.tryNextLink = tryNextLink;
313
- Object.setPrototypeOf(this, _ProviderError.prototype);
314
- logger?.debug?.(`@smithy/property-provider ${tryNextLink ? "->" : "(!)"} ${message}`);
315
- }
316
- static from(error, options = true) {
317
- return Object.assign(new this(error.message, options), error);
428
+ // ../../node_modules/@smithy/core/dist-es/submodules/schema/deref.js
429
+ var deref = (schemaRef) => {
430
+ if (typeof schemaRef === "function") {
431
+ return schemaRef();
318
432
  }
433
+ return schemaRef;
319
434
  };
320
435
 
321
- // ../../node_modules/@smithy/core/dist-es/submodules/config/property-provider/CredentialsProviderError.js
322
- var CredentialsProviderError = class _CredentialsProviderError extends ProviderError {
323
- name = "CredentialsProviderError";
324
- constructor(message, options = true) {
325
- super(message, options);
326
- Object.setPrototypeOf(this, _CredentialsProviderError.prototype);
436
+ // ../../node_modules/@smithy/core/dist-es/submodules/schema/schemas/translateTraits.js
437
+ var traitsCache = [];
438
+ function translateTraits(indicator) {
439
+ if (typeof indicator === "object") {
440
+ return indicator;
327
441
  }
328
- };
329
-
330
- // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getProfileName.js
331
- var ENV_PROFILE = "AWS_PROFILE";
332
- var DEFAULT_PROFILE = "default";
333
- var getProfileName = (init) => init.profile || process.env[ENV_PROFILE] || DEFAULT_PROFILE;
334
-
335
- // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getConfigFilepath.js
336
- import { join } from "path";
337
-
338
- // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getHomeDir.js
339
- import { homedir } from "os";
340
- import { sep } from "path";
341
- var homeDirCache = {};
342
- var getHomeDirCacheKey = () => {
343
- if (process && process.geteuid) {
344
- return `${process.geteuid()}`;
442
+ indicator = indicator | 0;
443
+ if (traitsCache[indicator]) {
444
+ return traitsCache[indicator];
345
445
  }
346
- return "DEFAULT";
347
- };
348
- var getHomeDir = () => {
349
- const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${sep}` } = process.env;
350
- if (HOME)
351
- return HOME;
352
- if (USERPROFILE)
353
- return USERPROFILE;
354
- if (HOMEPATH)
355
- return `${HOMEDRIVE}${HOMEPATH}`;
356
- const homeDirCacheKey = getHomeDirCacheKey();
357
- if (!homeDirCache[homeDirCacheKey])
358
- homeDirCache[homeDirCacheKey] = homedir();
359
- return homeDirCache[homeDirCacheKey];
360
- };
361
-
362
- // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getConfigFilepath.js
363
- var ENV_CONFIG_PATH = "AWS_CONFIG_FILE";
364
- var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || join(getHomeDir(), ".aws", "config");
365
-
366
- // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/loadSharedConfigFiles.js
367
- import { join as join3 } from "path";
368
-
369
- // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/constants.js
370
- var CONFIG_PREFIX_SEPARATOR = ".";
371
-
372
- // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getConfigData.js
373
- var getConfigData = (data) => Object.entries(data).filter(([key]) => {
374
- const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR);
375
- if (indexOfSeparator === -1) {
376
- return false;
446
+ const traits = {};
447
+ let i = 0;
448
+ for (const trait of [
449
+ "httpLabel",
450
+ "idempotent",
451
+ "idempotencyToken",
452
+ "sensitive",
453
+ "httpPayload",
454
+ "httpResponseCode",
455
+ "httpQueryParams"
456
+ ]) {
457
+ if ((indicator >> i++ & 1) === 1) {
458
+ traits[trait] = 1;
459
+ }
377
460
  }
378
- return Object.values(IniSectionType).includes(key.substring(0, indexOfSeparator));
379
- }).reduce((acc, [key, value]) => {
380
- const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR);
381
- const updatedKey = key.substring(0, indexOfSeparator) === IniSectionType.PROFILE ? key.substring(indexOfSeparator + 1) : key;
382
- acc[updatedKey] = value;
383
- return acc;
384
- }, {
385
- ...data.default && { default: data.default }
386
- });
387
-
388
- // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getCredentialsFilepath.js
389
- import { join as join2 } from "path";
390
- var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE";
391
- var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || join2(getHomeDir(), ".aws", "credentials");
461
+ return traitsCache[indicator] = traits;
462
+ }
392
463
 
393
- // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/parseIni.js
394
- var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/;
395
- var profileNameBlockList = ["__proto__", "profile __proto__"];
396
- var parseIni = (iniData) => {
397
- const map = {};
398
- let currentSection;
399
- let currentSubSection;
400
- for (const iniLine of iniData.split(/\r?\n/)) {
401
- const trimmedLine = iniLine.split(/(^|\s)[;#]/)[0].trim();
402
- const isSection = trimmedLine[0] === "[" && trimmedLine[trimmedLine.length - 1] === "]";
403
- if (isSection) {
404
- currentSection = void 0;
405
- currentSubSection = void 0;
406
- const sectionName = trimmedLine.substring(1, trimmedLine.length - 1);
407
- const matches = prefixKeyRegex.exec(sectionName);
408
- if (matches) {
409
- const [, prefix, , name] = matches;
410
- if (Object.values(IniSectionType).includes(prefix)) {
411
- currentSection = [prefix, name].join(CONFIG_PREFIX_SEPARATOR);
412
- }
413
- } else {
414
- currentSection = sectionName;
415
- }
416
- if (profileNameBlockList.includes(sectionName)) {
417
- throw new Error(`Found invalid profile name "${sectionName}"`);
418
- }
419
- } else if (currentSection) {
420
- const indexOfEqualsSign = trimmedLine.indexOf("=");
421
- if (![0, -1].includes(indexOfEqualsSign)) {
422
- const [name, value] = [
423
- trimmedLine.substring(0, indexOfEqualsSign).trim(),
424
- trimmedLine.substring(indexOfEqualsSign + 1).trim()
425
- ];
426
- if (value === "") {
427
- currentSubSection = name;
428
- } else {
429
- if (currentSubSection && iniLine.trimStart() === iniLine) {
430
- currentSubSection = void 0;
431
- }
432
- map[currentSection] = map[currentSection] || {};
433
- const key = currentSubSection ? [currentSubSection, name].join(CONFIG_PREFIX_SEPARATOR) : name;
434
- map[currentSection][key] = value;
435
- }
464
+ // ../../node_modules/@smithy/core/dist-es/submodules/schema/schemas/NormalizedSchema.js
465
+ var anno = {
466
+ it: /* @__PURE__ */ Symbol.for("@smithy/nor-struct-it"),
467
+ ns: /* @__PURE__ */ Symbol.for("@smithy/ns")
468
+ };
469
+ var simpleSchemaCacheN = [];
470
+ var simpleSchemaCacheS = {};
471
+ var NormalizedSchema = class _NormalizedSchema {
472
+ ref;
473
+ memberName;
474
+ static symbol = /* @__PURE__ */ Symbol.for("@smithy/nor");
475
+ symbol = _NormalizedSchema.symbol;
476
+ name;
477
+ schema;
478
+ _isMemberSchema;
479
+ traits;
480
+ memberTraits;
481
+ normalizedTraits;
482
+ constructor(ref, memberName) {
483
+ this.ref = ref;
484
+ this.memberName = memberName;
485
+ const traitStack = [];
486
+ let _ref = ref;
487
+ let schema = ref;
488
+ this._isMemberSchema = false;
489
+ while (isMemberSchema(_ref)) {
490
+ traitStack.push(_ref[1]);
491
+ _ref = _ref[0];
492
+ schema = deref(_ref);
493
+ this._isMemberSchema = true;
494
+ }
495
+ if (traitStack.length > 0) {
496
+ this.memberTraits = {};
497
+ for (let i = traitStack.length - 1; i >= 0; --i) {
498
+ const traitSet = traitStack[i];
499
+ Object.assign(this.memberTraits, translateTraits(traitSet));
436
500
  }
501
+ } else {
502
+ this.memberTraits = 0;
503
+ }
504
+ if (schema instanceof _NormalizedSchema) {
505
+ const computedMemberTraits = this.memberTraits;
506
+ Object.assign(this, schema);
507
+ this.memberTraits = Object.assign({}, computedMemberTraits, schema.getMemberTraits(), this.getMemberTraits());
508
+ this.normalizedTraits = void 0;
509
+ this.memberName = memberName ?? schema.memberName;
510
+ return;
511
+ }
512
+ this.schema = deref(schema);
513
+ if (isStaticSchema(this.schema)) {
514
+ this.name = `${this.schema[1]}#${this.schema[2]}`;
515
+ this.traits = this.schema[3];
516
+ } else {
517
+ this.name = this.memberName ?? String(schema);
518
+ this.traits = 0;
519
+ }
520
+ if (this._isMemberSchema && !memberName) {
521
+ throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(true)} missing member name.`);
437
522
  }
438
523
  }
439
- return map;
440
- };
441
-
442
- // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/readFile.js
443
- import { readFile as fsReadFile } from "fs/promises";
444
- var filePromises = {};
445
- var fileIntercept = {};
446
- var readFile = (path, options) => {
447
- if (fileIntercept[path] !== void 0) {
448
- return fileIntercept[path];
524
+ static [Symbol.hasInstance](lhs) {
525
+ const isPrototype = this.prototype.isPrototypeOf(lhs);
526
+ if (!isPrototype && typeof lhs === "object" && lhs !== null) {
527
+ const ns = lhs;
528
+ return ns.symbol === this.symbol;
529
+ }
530
+ return isPrototype;
449
531
  }
450
- if (!filePromises[path] || options?.ignoreCache) {
451
- filePromises[path] = fsReadFile(path, "utf8");
532
+ static of(ref) {
533
+ const keyAble = typeof ref === "function" || typeof ref === "object" && ref !== null;
534
+ if (typeof ref === "number") {
535
+ if (simpleSchemaCacheN[ref]) {
536
+ return simpleSchemaCacheN[ref];
537
+ }
538
+ } else if (typeof ref === "string") {
539
+ if (simpleSchemaCacheS[ref]) {
540
+ return simpleSchemaCacheS[ref];
541
+ }
542
+ } else if (keyAble) {
543
+ if (ref[anno.ns]) {
544
+ return ref[anno.ns];
545
+ }
546
+ }
547
+ const sc = deref(ref);
548
+ if (sc instanceof _NormalizedSchema) {
549
+ return sc;
550
+ }
551
+ if (isMemberSchema(sc)) {
552
+ const [ns2, traits] = sc;
553
+ if (ns2 instanceof _NormalizedSchema) {
554
+ Object.assign(ns2.getMergedTraits(), translateTraits(traits));
555
+ return ns2;
556
+ }
557
+ throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(ref, null, 2)}.`);
558
+ }
559
+ const ns = new _NormalizedSchema(sc);
560
+ if (keyAble) {
561
+ return ref[anno.ns] = ns;
562
+ }
563
+ if (typeof sc === "string") {
564
+ return simpleSchemaCacheS[sc] = ns;
565
+ }
566
+ if (typeof sc === "number") {
567
+ return simpleSchemaCacheN[sc] = ns;
568
+ }
569
+ return ns;
452
570
  }
453
- return filePromises[path];
454
- };
455
-
456
- // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/loadSharedConfigFiles.js
457
- var swallowError = () => ({});
458
- var loadSharedConfigFiles = async (init = {}) => {
459
- const { filepath = getCredentialsFilepath(), configFilepath = getConfigFilepath() } = init;
460
- const homeDir = getHomeDir();
461
- const relativeHomeDirPrefix = "~/";
462
- let resolvedFilepath = filepath;
463
- if (filepath.startsWith(relativeHomeDirPrefix)) {
464
- resolvedFilepath = join3(homeDir, filepath.slice(2));
571
+ getSchema() {
572
+ const sc = this.schema;
573
+ if (Array.isArray(sc) && sc[0] === 0) {
574
+ return sc[4];
575
+ }
576
+ return sc;
465
577
  }
466
- let resolvedConfigFilepath = configFilepath;
467
- if (configFilepath.startsWith(relativeHomeDirPrefix)) {
468
- resolvedConfigFilepath = join3(homeDir, configFilepath.slice(2));
578
+ getName(withNamespace = false) {
579
+ const { name } = this;
580
+ const short = !withNamespace && name && name.includes("#");
581
+ return short ? name.split("#")[1] : name || void 0;
469
582
  }
470
- const parsedFiles = await Promise.all([
471
- readFile(resolvedConfigFilepath, {
472
- ignoreCache: init.ignoreCache
473
- }).then(parseIni).then(getConfigData).catch(swallowError),
474
- readFile(resolvedFilepath, {
475
- ignoreCache: init.ignoreCache
476
- }).then(parseIni).catch(swallowError)
477
- ]);
478
- return {
479
- configFile: parsedFiles[0],
480
- credentialsFile: parsedFiles[1]
481
- };
482
- };
483
-
484
- // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getSsoSessionData.js
485
- var getSsoSessionData = (data) => Object.entries(data).filter(([key]) => key.startsWith(IniSectionType.SSO_SESSION + CONFIG_PREFIX_SEPARATOR)).reduce((acc, [key, value]) => ({ ...acc, [key.substring(key.indexOf(CONFIG_PREFIX_SEPARATOR) + 1)]: value }), {});
486
-
487
- // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/loadSsoSessionData.js
488
- var swallowError2 = () => ({});
489
- var loadSsoSessionData = async (init = {}) => readFile(init.configFilepath ?? getConfigFilepath()).then(parseIni).then(getSsoSessionData).catch(swallowError2);
490
-
491
- // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/mergeConfigFiles.js
492
- var mergeConfigFiles = (...files) => {
493
- const merged = {};
494
- for (const file of files) {
495
- for (const [key, values] of Object.entries(file)) {
496
- if (merged[key] !== void 0) {
497
- Object.assign(merged[key], values);
498
- } else {
499
- merged[key] = values;
500
- }
583
+ getMemberName() {
584
+ return this.memberName;
585
+ }
586
+ isMemberSchema() {
587
+ return this._isMemberSchema;
588
+ }
589
+ isListSchema() {
590
+ const sc = this.getSchema();
591
+ return typeof sc === "number" ? sc >= 64 && sc < 128 : sc[0] === 1;
592
+ }
593
+ isMapSchema() {
594
+ const sc = this.getSchema();
595
+ return typeof sc === "number" ? sc >= 128 && sc <= 255 : sc[0] === 2;
596
+ }
597
+ isStructSchema() {
598
+ const sc = this.getSchema();
599
+ if (typeof sc !== "object") {
600
+ return false;
501
601
  }
602
+ const id = sc[0];
603
+ return id === 3 || id === -3 || id === 4;
502
604
  }
503
- return merged;
504
- };
505
-
506
- // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/parseKnownFiles.js
507
- var parseKnownFiles = async (init) => {
508
- const parsedFiles = await loadSharedConfigFiles(init);
509
- return mergeConfigFiles(parsedFiles.configFile, parsedFiles.credentialsFile);
510
- };
511
-
512
- // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getSSOTokenFromFile.js
513
- import { readFile as readFile2 } from "fs/promises";
514
-
515
- // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getSSOTokenFilepath.js
516
- import { createHash } from "crypto";
517
- import { join as join4 } from "path";
518
- var getSSOTokenFilepath = (id) => {
519
- const hasher = createHash("sha1");
520
- const cacheName = hasher.update(id).digest("hex");
521
- return join4(getHomeDir(), ".aws", "sso", "cache", `${cacheName}.json`);
522
- };
523
-
524
- // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getSSOTokenFromFile.js
525
- var tokenIntercept = {};
526
- var getSSOTokenFromFile = async (id) => {
527
- if (tokenIntercept[id]) {
528
- return tokenIntercept[id];
605
+ isUnionSchema() {
606
+ const sc = this.getSchema();
607
+ if (typeof sc !== "object") {
608
+ return false;
609
+ }
610
+ return sc[0] === 4;
529
611
  }
530
- const ssoTokenFilepath = getSSOTokenFilepath(id);
531
- const ssoTokenText = await readFile2(ssoTokenFilepath, "utf8");
532
- return JSON.parse(ssoTokenText);
533
- };
534
-
535
- // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/externalDataInterceptor.js
536
- var externalDataInterceptor = {
537
- getFileRecord() {
538
- return fileIntercept;
539
- },
540
- interceptFile(path, contents) {
541
- fileIntercept[path] = Promise.resolve(contents);
542
- },
543
- getTokenRecord() {
544
- return tokenIntercept;
545
- },
546
- interceptToken(id, contents) {
547
- tokenIntercept[id] = contents;
612
+ isBlobSchema() {
613
+ const sc = this.getSchema();
614
+ return sc === 21 || sc === 42;
548
615
  }
549
- };
550
-
551
- // ../../node_modules/@smithy/core/dist-es/submodules/config/property-provider/chain.js
552
- var chain = (...providers) => async () => {
553
- if (providers.length === 0) {
554
- throw new ProviderError("No providers in chain");
616
+ isTimestampSchema() {
617
+ const sc = this.getSchema();
618
+ return typeof sc === "number" && sc >= 4 && sc <= 7;
555
619
  }
556
- let lastProviderError;
557
- for (const provider of providers) {
558
- try {
559
- const credentials = await provider();
560
- return credentials;
561
- } catch (err) {
562
- lastProviderError = err;
563
- if (err?.tryNextLink) {
564
- continue;
565
- }
566
- throw err;
620
+ isUnitSchema() {
621
+ return this.getSchema() === "unit";
622
+ }
623
+ isDocumentSchema() {
624
+ return this.getSchema() === 15;
625
+ }
626
+ isStringSchema() {
627
+ return this.getSchema() === 0;
628
+ }
629
+ isBooleanSchema() {
630
+ return this.getSchema() === 2;
631
+ }
632
+ isNumericSchema() {
633
+ return this.getSchema() === 1;
634
+ }
635
+ isBigIntegerSchema() {
636
+ return this.getSchema() === 17;
637
+ }
638
+ isBigDecimalSchema() {
639
+ return this.getSchema() === 19;
640
+ }
641
+ isStreaming() {
642
+ const { streaming } = this.getMergedTraits();
643
+ return !!streaming || this.getSchema() === 42;
644
+ }
645
+ isIdempotencyToken() {
646
+ return !!this.getMergedTraits().idempotencyToken;
647
+ }
648
+ getMergedTraits() {
649
+ return this.normalizedTraits ?? (this.normalizedTraits = {
650
+ ...this.getOwnTraits(),
651
+ ...this.getMemberTraits()
652
+ });
653
+ }
654
+ getMemberTraits() {
655
+ return translateTraits(this.memberTraits);
656
+ }
657
+ getOwnTraits() {
658
+ return translateTraits(this.traits);
659
+ }
660
+ getKeySchema() {
661
+ const [isDoc, isMap] = [this.isDocumentSchema(), this.isMapSchema()];
662
+ if (!isDoc && !isMap) {
663
+ throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(true)}`);
664
+ }
665
+ const schema = this.getSchema();
666
+ const memberSchema = isDoc ? 15 : schema[4] ?? 0;
667
+ return member([memberSchema, 0], "key");
668
+ }
669
+ getValueSchema() {
670
+ const sc = this.getSchema();
671
+ const [isDoc, isMap, isList] = [this.isDocumentSchema(), this.isMapSchema(), this.isListSchema()];
672
+ const memberSchema = typeof sc === "number" ? 63 & sc : sc && typeof sc === "object" && (isMap || isList) ? sc[3 + sc[0]] : isDoc ? 15 : void 0;
673
+ if (memberSchema != null) {
674
+ return member([memberSchema, 0], isMap ? "value" : "member");
567
675
  }
676
+ throw new Error(`@smithy/core/schema - ${this.getName(true)} has no value member.`);
568
677
  }
569
- throw lastProviderError;
570
- };
571
-
572
- // ../../node_modules/@smithy/core/dist-es/submodules/config/property-provider/memoize.js
573
- var memoize = (provider, isExpired, requiresRefresh) => {
574
- let resolved;
575
- let pending;
576
- let hasResult;
577
- let isConstant = false;
578
- const coalesceProvider = async () => {
579
- if (!pending) {
580
- pending = provider();
678
+ getMemberSchema(memberName) {
679
+ const struct = this.getSchema();
680
+ if (this.isStructSchema() && struct[4].includes(memberName)) {
681
+ const i = struct[4].indexOf(memberName);
682
+ const memberSchema = struct[5][i];
683
+ return member(isMemberSchema(memberSchema) ? memberSchema : [memberSchema, 0], memberName);
684
+ }
685
+ if (this.isDocumentSchema()) {
686
+ return member([15, 0], memberName);
581
687
  }
688
+ throw new Error(`@smithy/core/schema - ${this.getName(true)} has no member=${memberName}.`);
689
+ }
690
+ getMemberSchemas() {
691
+ const buffer = {};
582
692
  try {
583
- resolved = await pending;
584
- hasResult = true;
585
- isConstant = false;
586
- } finally {
587
- pending = void 0;
693
+ for (const [k, v] of this.structIterator()) {
694
+ buffer[k] = v;
695
+ }
696
+ } catch (ignored) {
588
697
  }
589
- return resolved;
590
- };
591
- if (isExpired === void 0) {
592
- return async (options) => {
593
- if (!hasResult || options?.forceRefresh) {
594
- resolved = await coalesceProvider();
698
+ return buffer;
699
+ }
700
+ getEventStreamMember() {
701
+ if (this.isStructSchema()) {
702
+ for (const [memberName, memberSchema] of this.structIterator()) {
703
+ if (memberSchema.isStreaming() && memberSchema.isStructSchema()) {
704
+ return memberName;
705
+ }
595
706
  }
596
- return resolved;
597
- };
707
+ }
708
+ return "";
598
709
  }
599
- return async (options) => {
600
- if (!hasResult || options?.forceRefresh) {
601
- resolved = await coalesceProvider();
710
+ *structIterator() {
711
+ if (this.isUnitSchema()) {
712
+ return;
602
713
  }
603
- if (isConstant) {
604
- return resolved;
714
+ if (!this.isStructSchema()) {
715
+ throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");
605
716
  }
606
- if (requiresRefresh && !requiresRefresh(resolved)) {
607
- isConstant = true;
608
- return resolved;
717
+ const struct = this.getSchema();
718
+ const z = struct[4].length;
719
+ let it = struct[anno.it];
720
+ if (it && z === it.length) {
721
+ yield* it;
722
+ return;
609
723
  }
610
- if (isExpired(resolved)) {
611
- await coalesceProvider();
612
- return resolved;
724
+ it = Array(z);
725
+ for (let i = 0; i < z; ++i) {
726
+ const k = struct[4][i];
727
+ const v = member([struct[5][i], 0], k);
728
+ yield it[i] = [k, v];
613
729
  }
614
- return resolved;
615
- };
730
+ struct[anno.it] = it;
731
+ }
616
732
  };
617
-
618
- // ../../node_modules/@smithy/core/dist-es/submodules/config/node-config-provider/getSelectorName.js
619
- function getSelectorName(functionString) {
620
- try {
621
- const constants = new Set(Array.from(functionString.match(/([A-Z_]){3,}/g) ?? []));
622
- constants.delete("CONFIG");
623
- constants.delete("CONFIG_PREFIX_SEPARATOR");
624
- constants.delete("ENV");
625
- return [...constants].join(", ");
626
- } catch (e) {
627
- return functionString;
733
+ function member(memberSchema, memberName) {
734
+ if (memberSchema instanceof NormalizedSchema) {
735
+ return Object.assign(memberSchema, {
736
+ memberName,
737
+ _isMemberSchema: true
738
+ });
628
739
  }
740
+ const internalCtorAccess = NormalizedSchema;
741
+ return new internalCtorAccess(memberSchema, memberName);
629
742
  }
743
+ var isMemberSchema = (sc) => Array.isArray(sc) && sc.length === 2;
744
+ var isStaticSchema = (sc) => Array.isArray(sc) && sc.length >= 5;
630
745
 
631
- // ../../node_modules/@smithy/core/dist-es/submodules/config/node-config-provider/fromEnv.js
632
- var fromEnv = (envVarSelector, options) => async () => {
633
- try {
634
- const config = envVarSelector(process.env, options);
635
- if (config === void 0) {
636
- throw new Error();
746
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/property-provider/ProviderError.js
747
+ var ProviderError = class _ProviderError extends Error {
748
+ name = "ProviderError";
749
+ tryNextLink;
750
+ constructor(message, options = true) {
751
+ let logger;
752
+ let tryNextLink = true;
753
+ if (typeof options === "boolean") {
754
+ logger = void 0;
755
+ tryNextLink = options;
756
+ } else if (options != null && typeof options === "object") {
757
+ logger = options.logger;
758
+ tryNextLink = options.tryNextLink ?? true;
637
759
  }
638
- return config;
639
- } catch (e) {
640
- throw new CredentialsProviderError(e.message || `Not found in ENV: ${getSelectorName(envVarSelector.toString())}`, { logger: options?.logger });
760
+ super(message);
761
+ this.tryNextLink = tryNextLink;
762
+ Object.setPrototypeOf(this, _ProviderError.prototype);
763
+ logger?.debug?.(`@smithy/property-provider ${tryNextLink ? "->" : "(!)"} ${message}`);
764
+ }
765
+ static from(error, options = true) {
766
+ return Object.assign(new this(error.message, options), error);
641
767
  }
642
768
  };
643
769
 
644
- // ../../node_modules/@smithy/core/dist-es/submodules/config/node-config-provider/fromSharedConfigFiles.js
645
- var fromSharedConfigFiles = (configSelector, { preferredFile = "config", ...init } = {}) => async () => {
646
- const profile = getProfileName(init);
647
- const { configFile, credentialsFile } = await loadSharedConfigFiles(init);
648
- const profileFromCredentials = credentialsFile[profile] || {};
649
- const profileFromConfig = configFile[profile] || {};
650
- const mergedProfile = preferredFile === "config" ? { ...profileFromCredentials, ...profileFromConfig } : { ...profileFromConfig, ...profileFromCredentials };
651
- try {
652
- const cfgFile = preferredFile === "config" ? configFile : credentialsFile;
653
- const configValue = configSelector(mergedProfile, cfgFile);
654
- if (configValue === void 0) {
655
- throw new Error();
770
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/property-provider/CredentialsProviderError.js
771
+ var CredentialsProviderError = class _CredentialsProviderError extends ProviderError {
772
+ name = "CredentialsProviderError";
773
+ constructor(message, options = true) {
774
+ super(message, options);
775
+ Object.setPrototypeOf(this, _CredentialsProviderError.prototype);
776
+ }
777
+ };
778
+
779
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getProfileName.js
780
+ var ENV_PROFILE = "AWS_PROFILE";
781
+ var DEFAULT_PROFILE = "default";
782
+ var getProfileName = (init) => init.profile || process.env[ENV_PROFILE] || DEFAULT_PROFILE;
783
+
784
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getConfigFilepath.js
785
+ import { join } from "path";
786
+
787
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getHomeDir.js
788
+ import { homedir } from "os";
789
+ import { sep } from "path";
790
+ var homeDirCache = {};
791
+ var getHomeDirCacheKey = () => {
792
+ if (process && process.geteuid) {
793
+ return `${process.geteuid()}`;
794
+ }
795
+ return "DEFAULT";
796
+ };
797
+ var getHomeDir = () => {
798
+ const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${sep}` } = process.env;
799
+ if (HOME)
800
+ return HOME;
801
+ if (USERPROFILE)
802
+ return USERPROFILE;
803
+ if (HOMEPATH)
804
+ return `${HOMEDRIVE}${HOMEPATH}`;
805
+ const homeDirCacheKey = getHomeDirCacheKey();
806
+ if (!homeDirCache[homeDirCacheKey])
807
+ homeDirCache[homeDirCacheKey] = homedir();
808
+ return homeDirCache[homeDirCacheKey];
809
+ };
810
+
811
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getConfigFilepath.js
812
+ var ENV_CONFIG_PATH = "AWS_CONFIG_FILE";
813
+ var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || join(getHomeDir(), ".aws", "config");
814
+
815
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/loadSharedConfigFiles.js
816
+ import { join as join3 } from "path";
817
+
818
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/constants.js
819
+ var CONFIG_PREFIX_SEPARATOR = ".";
820
+
821
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getConfigData.js
822
+ var getConfigData = (data) => Object.entries(data).filter(([key]) => {
823
+ const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR);
824
+ if (indexOfSeparator === -1) {
825
+ return false;
826
+ }
827
+ return Object.values(IniSectionType).includes(key.substring(0, indexOfSeparator));
828
+ }).reduce((acc, [key, value]) => {
829
+ const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR);
830
+ const updatedKey = key.substring(0, indexOfSeparator) === IniSectionType.PROFILE ? key.substring(indexOfSeparator + 1) : key;
831
+ acc[updatedKey] = value;
832
+ return acc;
833
+ }, {
834
+ ...data.default && { default: data.default }
835
+ });
836
+
837
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getCredentialsFilepath.js
838
+ import { join as join2 } from "path";
839
+ var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE";
840
+ var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || join2(getHomeDir(), ".aws", "credentials");
841
+
842
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/parseIni.js
843
+ var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/;
844
+ var profileNameBlockList = ["__proto__", "profile __proto__"];
845
+ var parseIni = (iniData) => {
846
+ const map = {};
847
+ let currentSection;
848
+ let currentSubSection;
849
+ for (const iniLine of iniData.split(/\r?\n/)) {
850
+ const trimmedLine = iniLine.split(/(^|\s)[;#]/)[0].trim();
851
+ const isSection = trimmedLine[0] === "[" && trimmedLine[trimmedLine.length - 1] === "]";
852
+ if (isSection) {
853
+ currentSection = void 0;
854
+ currentSubSection = void 0;
855
+ const sectionName = trimmedLine.substring(1, trimmedLine.length - 1);
856
+ const matches = prefixKeyRegex.exec(sectionName);
857
+ if (matches) {
858
+ const [, prefix, , name] = matches;
859
+ if (Object.values(IniSectionType).includes(prefix)) {
860
+ currentSection = [prefix, name].join(CONFIG_PREFIX_SEPARATOR);
861
+ }
862
+ } else {
863
+ currentSection = sectionName;
864
+ }
865
+ if (profileNameBlockList.includes(sectionName)) {
866
+ throw new Error(`Found invalid profile name "${sectionName}"`);
867
+ }
868
+ } else if (currentSection) {
869
+ const indexOfEqualsSign = trimmedLine.indexOf("=");
870
+ if (![0, -1].includes(indexOfEqualsSign)) {
871
+ const [name, value] = [
872
+ trimmedLine.substring(0, indexOfEqualsSign).trim(),
873
+ trimmedLine.substring(indexOfEqualsSign + 1).trim()
874
+ ];
875
+ if (value === "") {
876
+ currentSubSection = name;
877
+ } else {
878
+ if (currentSubSection && iniLine.trimStart() === iniLine) {
879
+ currentSubSection = void 0;
880
+ }
881
+ map[currentSection] = map[currentSection] || {};
882
+ const key = currentSubSection ? [currentSubSection, name].join(CONFIG_PREFIX_SEPARATOR) : name;
883
+ map[currentSection][key] = value;
884
+ }
885
+ }
656
886
  }
657
- return configValue;
658
- } catch (e) {
659
- throw new CredentialsProviderError(e.message || `Not found in config files w/ profile [${profile}]: ${getSelectorName(configSelector.toString())}`, { logger: init.logger });
660
887
  }
888
+ return map;
661
889
  };
662
890
 
663
- // ../../node_modules/@smithy/core/dist-es/submodules/config/property-provider/fromValue.js
664
- var fromValue = (staticValue) => () => Promise.resolve(staticValue);
665
-
666
- // ../../node_modules/@smithy/core/dist-es/submodules/config/node-config-provider/fromStatic.js
667
- var isFunction = (func) => typeof func === "function";
668
- var fromStatic = (defaultValue) => isFunction(defaultValue) ? async () => await defaultValue() : fromValue(defaultValue);
669
-
670
- // ../../node_modules/@smithy/core/dist-es/submodules/config/node-config-provider/configLoader.js
671
- var loadConfig = ({ environmentVariableSelector, configFileSelector, default: defaultValue }, configuration = {}) => {
672
- const { signingName, logger } = configuration;
673
- const envOptions = { signingName, logger };
674
- return memoize(chain(fromEnv(environmentVariableSelector, envOptions), fromSharedConfigFiles(configFileSelector, configuration), fromStatic(defaultValue)));
891
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/readFile.js
892
+ import { readFile as fsReadFile } from "fs/promises";
893
+ var filePromises = {};
894
+ var fileIntercept = {};
895
+ var readFile = (path, options) => {
896
+ if (fileIntercept[path] !== void 0) {
897
+ return fileIntercept[path];
898
+ }
899
+ if (!filePromises[path] || options?.ignoreCache) {
900
+ filePromises[path] = fsReadFile(path, "utf8");
901
+ }
902
+ return filePromises[path];
675
903
  };
676
904
 
677
- // ../../node_modules/@smithy/core/dist-es/submodules/config/config-resolver/regionConfig/checkRegion.js
678
- var validRegions = /* @__PURE__ */ new Set();
679
- var checkRegion = (region, check = isValidHostLabel) => {
680
- if (!validRegions.has(region) && !check(region)) {
681
- if (region === "*") {
682
- console.warn(`@smithy/config-resolver WARN - Please use the caller region instead of "*". See "sigv4a" in https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md.`);
683
- } else {
684
- throw new Error(`Region not accepted: region="${region}" is not a valid hostname component.`);
685
- }
686
- } else {
687
- validRegions.add(region);
905
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/loadSharedConfigFiles.js
906
+ var swallowError = () => ({});
907
+ var loadSharedConfigFiles = async (init = {}) => {
908
+ const { filepath = getCredentialsFilepath(), configFilepath = getConfigFilepath() } = init;
909
+ const homeDir = getHomeDir();
910
+ const relativeHomeDirPrefix = "~/";
911
+ let resolvedFilepath = filepath;
912
+ if (filepath.startsWith(relativeHomeDirPrefix)) {
913
+ resolvedFilepath = join3(homeDir, filepath.slice(2));
914
+ }
915
+ let resolvedConfigFilepath = configFilepath;
916
+ if (configFilepath.startsWith(relativeHomeDirPrefix)) {
917
+ resolvedConfigFilepath = join3(homeDir, configFilepath.slice(2));
688
918
  }
919
+ const parsedFiles = await Promise.all([
920
+ readFile(resolvedConfigFilepath, {
921
+ ignoreCache: init.ignoreCache
922
+ }).then(parseIni).then(getConfigData).catch(swallowError),
923
+ readFile(resolvedFilepath, {
924
+ ignoreCache: init.ignoreCache
925
+ }).then(parseIni).catch(swallowError)
926
+ ]);
927
+ return {
928
+ configFile: parsedFiles[0],
929
+ credentialsFile: parsedFiles[1]
930
+ };
689
931
  };
690
932
 
691
- // ../../node_modules/@smithy/core/dist-es/submodules/config/config-resolver/regionConfig/isFipsRegion.js
692
- var isFipsRegion = (region) => typeof region === "string" && (region.startsWith("fips-") || region.endsWith("-fips"));
933
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getSsoSessionData.js
934
+ var getSsoSessionData = (data) => Object.entries(data).filter(([key]) => key.startsWith(IniSectionType.SSO_SESSION + CONFIG_PREFIX_SEPARATOR)).reduce((acc, [key, value]) => ({ ...acc, [key.substring(key.indexOf(CONFIG_PREFIX_SEPARATOR) + 1)]: value }), {});
693
935
 
694
- // ../../node_modules/@smithy/core/dist-es/submodules/config/config-resolver/regionConfig/getRealRegion.js
695
- var getRealRegion = (region) => isFipsRegion(region) ? ["fips-aws-global", "aws-fips"].includes(region) ? "us-east-1" : region.replace(/fips-(dkr-|prod-)?|-fips/, "") : region;
936
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/loadSsoSessionData.js
937
+ var swallowError2 = () => ({});
938
+ var loadSsoSessionData = async (init = {}) => readFile(init.configFilepath ?? getConfigFilepath()).then(parseIni).then(getSsoSessionData).catch(swallowError2);
696
939
 
697
- // ../../node_modules/@smithy/core/dist-es/submodules/config/config-resolver/regionConfig/resolveRegionConfig.js
698
- var resolveRegionConfig = (input) => {
699
- const { region, useFipsEndpoint } = input;
700
- if (!region) {
701
- throw new Error("Region is missing");
702
- }
703
- return Object.assign(input, {
704
- region: async () => {
705
- const providedRegion = typeof region === "function" ? await region() : region;
706
- const realRegion = getRealRegion(providedRegion);
707
- checkRegion(realRegion);
708
- return realRegion;
709
- },
710
- useFipsEndpoint: async () => {
711
- const providedRegion = typeof region === "string" ? region : await region();
712
- if (isFipsRegion(providedRegion)) {
713
- return true;
940
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/mergeConfigFiles.js
941
+ var mergeConfigFiles = (...files) => {
942
+ const merged = {};
943
+ for (const file of files) {
944
+ for (const [key, values] of Object.entries(file)) {
945
+ if (merged[key] !== void 0) {
946
+ Object.assign(merged[key], values);
947
+ } else {
948
+ merged[key] = values;
714
949
  }
715
- return typeof useFipsEndpoint !== "function" ? Promise.resolve(!!useFipsEndpoint) : useFipsEndpoint();
716
950
  }
717
- });
718
- };
719
-
720
- // ../../node_modules/@smithy/core/dist-es/submodules/config/property-provider/TokenProviderError.js
721
- var TokenProviderError = class _TokenProviderError extends ProviderError {
722
- name = "TokenProviderError";
723
- constructor(message, options = true) {
724
- super(message, options);
725
- Object.setPrototypeOf(this, _TokenProviderError.prototype);
726
951
  }
952
+ return merged;
727
953
  };
728
954
 
729
- // ../../node_modules/@smithy/core/dist-es/submodules/config/util-config-provider/booleanSelector.js
730
- var booleanSelector = (obj, key, type) => {
731
- if (!(key in obj))
732
- return void 0;
733
- if (obj[key] === "true")
734
- return true;
735
- if (obj[key] === "false")
736
- return false;
737
- throw new Error(`Cannot load ${type} "${key}". Expected "true" or "false", got ${obj[key]}.`);
738
- };
739
-
740
- // ../../node_modules/@smithy/core/dist-es/submodules/config/util-config-provider/types.js
741
- var SelectorType;
742
- (function(SelectorType2) {
743
- SelectorType2["ENV"] = "env";
744
- SelectorType2["CONFIG"] = "shared config entry";
745
- })(SelectorType || (SelectorType = {}));
746
-
747
- // ../../node_modules/@smithy/core/dist-es/submodules/config/config-resolver/endpointsConfig/NodeUseDualstackEndpointConfigOptions.js
748
- var ENV_USE_DUALSTACK_ENDPOINT = "AWS_USE_DUALSTACK_ENDPOINT";
749
- var CONFIG_USE_DUALSTACK_ENDPOINT = "use_dualstack_endpoint";
750
- var NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS = {
751
- environmentVariableSelector: (env) => booleanSelector(env, ENV_USE_DUALSTACK_ENDPOINT, SelectorType.ENV),
752
- configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_DUALSTACK_ENDPOINT, SelectorType.CONFIG),
753
- default: false
754
- };
755
-
756
- // ../../node_modules/@smithy/core/dist-es/submodules/config/config-resolver/endpointsConfig/NodeUseFipsEndpointConfigOptions.js
757
- var ENV_USE_FIPS_ENDPOINT = "AWS_USE_FIPS_ENDPOINT";
758
- var CONFIG_USE_FIPS_ENDPOINT = "use_fips_endpoint";
759
- var NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS = {
760
- environmentVariableSelector: (env) => booleanSelector(env, ENV_USE_FIPS_ENDPOINT, SelectorType.ENV),
761
- configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_FIPS_ENDPOINT, SelectorType.CONFIG),
762
- default: false
763
- };
764
-
765
- // ../../node_modules/@smithy/core/dist-es/submodules/schema/deref.js
766
- var deref = (schemaRef) => {
767
- if (typeof schemaRef === "function") {
768
- return schemaRef();
769
- }
770
- return schemaRef;
955
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/parseKnownFiles.js
956
+ var parseKnownFiles = async (init) => {
957
+ const parsedFiles = await loadSharedConfigFiles(init);
958
+ return mergeConfigFiles(parsedFiles.configFile, parsedFiles.credentialsFile);
771
959
  };
772
960
 
773
- // ../../node_modules/@smithy/core/dist-es/submodules/schema/schemas/translateTraits.js
774
- var traitsCache = [];
775
- function translateTraits(indicator) {
776
- if (typeof indicator === "object") {
777
- return indicator;
778
- }
779
- indicator = indicator | 0;
780
- if (traitsCache[indicator]) {
781
- return traitsCache[indicator];
782
- }
783
- const traits = {};
784
- let i = 0;
785
- for (const trait of [
786
- "httpLabel",
787
- "idempotent",
788
- "idempotencyToken",
789
- "sensitive",
790
- "httpPayload",
791
- "httpResponseCode",
792
- "httpQueryParams"
793
- ]) {
794
- if ((indicator >> i++ & 1) === 1) {
795
- traits[trait] = 1;
796
- }
797
- }
798
- return traitsCache[indicator] = traits;
799
- }
961
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getSSOTokenFromFile.js
962
+ import { readFile as readFile2 } from "fs/promises";
800
963
 
801
- // ../../node_modules/@smithy/core/dist-es/submodules/schema/schemas/NormalizedSchema.js
802
- var anno = {
803
- it: /* @__PURE__ */ Symbol.for("@smithy/nor-struct-it"),
804
- ns: /* @__PURE__ */ Symbol.for("@smithy/ns")
964
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getSSOTokenFilepath.js
965
+ import { createHash } from "crypto";
966
+ import { join as join4 } from "path";
967
+ var getSSOTokenFilepath = (id) => {
968
+ const hasher = createHash("sha1");
969
+ const cacheName = hasher.update(id).digest("hex");
970
+ return join4(getHomeDir(), ".aws", "sso", "cache", `${cacheName}.json`);
805
971
  };
806
- var simpleSchemaCacheN = [];
807
- var simpleSchemaCacheS = {};
808
- var NormalizedSchema = class _NormalizedSchema {
809
- ref;
810
- memberName;
811
- static symbol = /* @__PURE__ */ Symbol.for("@smithy/nor");
812
- symbol = _NormalizedSchema.symbol;
813
- name;
814
- schema;
815
- _isMemberSchema;
816
- traits;
817
- memberTraits;
818
- normalizedTraits;
819
- constructor(ref, memberName) {
820
- this.ref = ref;
821
- this.memberName = memberName;
822
- const traitStack = [];
823
- let _ref = ref;
824
- let schema = ref;
825
- this._isMemberSchema = false;
826
- while (isMemberSchema(_ref)) {
827
- traitStack.push(_ref[1]);
828
- _ref = _ref[0];
829
- schema = deref(_ref);
830
- this._isMemberSchema = true;
831
- }
832
- if (traitStack.length > 0) {
833
- this.memberTraits = {};
834
- for (let i = traitStack.length - 1; i >= 0; --i) {
835
- const traitSet = traitStack[i];
836
- Object.assign(this.memberTraits, translateTraits(traitSet));
837
- }
838
- } else {
839
- this.memberTraits = 0;
840
- }
841
- if (schema instanceof _NormalizedSchema) {
842
- const computedMemberTraits = this.memberTraits;
843
- Object.assign(this, schema);
844
- this.memberTraits = Object.assign({}, computedMemberTraits, schema.getMemberTraits(), this.getMemberTraits());
845
- this.normalizedTraits = void 0;
846
- this.memberName = memberName ?? schema.memberName;
847
- return;
848
- }
849
- this.schema = deref(schema);
850
- if (isStaticSchema(this.schema)) {
851
- this.name = `${this.schema[1]}#${this.schema[2]}`;
852
- this.traits = this.schema[3];
853
- } else {
854
- this.name = this.memberName ?? String(schema);
855
- this.traits = 0;
856
- }
857
- if (this._isMemberSchema && !memberName) {
858
- throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(true)} missing member name.`);
859
- }
972
+
973
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getSSOTokenFromFile.js
974
+ var tokenIntercept = {};
975
+ var getSSOTokenFromFile = async (id) => {
976
+ if (tokenIntercept[id]) {
977
+ return tokenIntercept[id];
860
978
  }
861
- static [Symbol.hasInstance](lhs) {
862
- const isPrototype = this.prototype.isPrototypeOf(lhs);
863
- if (!isPrototype && typeof lhs === "object" && lhs !== null) {
864
- const ns = lhs;
865
- return ns.symbol === this.symbol;
866
- }
867
- return isPrototype;
979
+ const ssoTokenFilepath = getSSOTokenFilepath(id);
980
+ const ssoTokenText = await readFile2(ssoTokenFilepath, "utf8");
981
+ return JSON.parse(ssoTokenText);
982
+ };
983
+
984
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/externalDataInterceptor.js
985
+ var externalDataInterceptor = {
986
+ getFileRecord() {
987
+ return fileIntercept;
988
+ },
989
+ interceptFile(path, contents) {
990
+ fileIntercept[path] = Promise.resolve(contents);
991
+ },
992
+ getTokenRecord() {
993
+ return tokenIntercept;
994
+ },
995
+ interceptToken(id, contents) {
996
+ tokenIntercept[id] = contents;
868
997
  }
869
- static of(ref) {
870
- const keyAble = typeof ref === "function" || typeof ref === "object" && ref !== null;
871
- if (typeof ref === "number") {
872
- if (simpleSchemaCacheN[ref]) {
873
- return simpleSchemaCacheN[ref];
874
- }
875
- } else if (typeof ref === "string") {
876
- if (simpleSchemaCacheS[ref]) {
877
- return simpleSchemaCacheS[ref];
878
- }
879
- } else if (keyAble) {
880
- if (ref[anno.ns]) {
881
- return ref[anno.ns];
998
+ };
999
+
1000
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/property-provider/chain.js
1001
+ var chain = (...providers) => async () => {
1002
+ if (providers.length === 0) {
1003
+ throw new ProviderError("No providers in chain");
1004
+ }
1005
+ let lastProviderError;
1006
+ for (const provider of providers) {
1007
+ try {
1008
+ const credentials = await provider();
1009
+ return credentials;
1010
+ } catch (err) {
1011
+ lastProviderError = err;
1012
+ if (err?.tryNextLink) {
1013
+ continue;
882
1014
  }
1015
+ throw err;
883
1016
  }
884
- const sc = deref(ref);
885
- if (sc instanceof _NormalizedSchema) {
886
- return sc;
1017
+ }
1018
+ throw lastProviderError;
1019
+ };
1020
+
1021
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/property-provider/memoize.js
1022
+ var memoize = (provider, isExpired, requiresRefresh) => {
1023
+ let resolved;
1024
+ let pending;
1025
+ let hasResult;
1026
+ let isConstant = false;
1027
+ const coalesceProvider = async () => {
1028
+ if (!pending) {
1029
+ pending = provider();
887
1030
  }
888
- if (isMemberSchema(sc)) {
889
- const [ns2, traits] = sc;
890
- if (ns2 instanceof _NormalizedSchema) {
891
- Object.assign(ns2.getMergedTraits(), translateTraits(traits));
892
- return ns2;
893
- }
894
- throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(ref, null, 2)}.`);
1031
+ try {
1032
+ resolved = await pending;
1033
+ hasResult = true;
1034
+ isConstant = false;
1035
+ } finally {
1036
+ pending = void 0;
895
1037
  }
896
- const ns = new _NormalizedSchema(sc);
897
- if (keyAble) {
898
- return ref[anno.ns] = ns;
1038
+ return resolved;
1039
+ };
1040
+ if (isExpired === void 0) {
1041
+ return async (options) => {
1042
+ if (!hasResult || options?.forceRefresh) {
1043
+ resolved = await coalesceProvider();
1044
+ }
1045
+ return resolved;
1046
+ };
1047
+ }
1048
+ return async (options) => {
1049
+ if (!hasResult || options?.forceRefresh) {
1050
+ resolved = await coalesceProvider();
899
1051
  }
900
- if (typeof sc === "string") {
901
- return simpleSchemaCacheS[sc] = ns;
1052
+ if (isConstant) {
1053
+ return resolved;
902
1054
  }
903
- if (typeof sc === "number") {
904
- return simpleSchemaCacheN[sc] = ns;
1055
+ if (requiresRefresh && !requiresRefresh(resolved)) {
1056
+ isConstant = true;
1057
+ return resolved;
905
1058
  }
906
- return ns;
907
- }
908
- getSchema() {
909
- const sc = this.schema;
910
- if (Array.isArray(sc) && sc[0] === 0) {
911
- return sc[4];
1059
+ if (isExpired(resolved)) {
1060
+ await coalesceProvider();
1061
+ return resolved;
912
1062
  }
913
- return sc;
914
- }
915
- getName(withNamespace = false) {
916
- const { name } = this;
917
- const short = !withNamespace && name && name.includes("#");
918
- return short ? name.split("#")[1] : name || void 0;
919
- }
920
- getMemberName() {
921
- return this.memberName;
922
- }
923
- isMemberSchema() {
924
- return this._isMemberSchema;
925
- }
926
- isListSchema() {
927
- const sc = this.getSchema();
928
- return typeof sc === "number" ? sc >= 64 && sc < 128 : sc[0] === 1;
929
- }
930
- isMapSchema() {
931
- const sc = this.getSchema();
932
- return typeof sc === "number" ? sc >= 128 && sc <= 255 : sc[0] === 2;
1063
+ return resolved;
1064
+ };
1065
+ };
1066
+
1067
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/node-config-provider/getSelectorName.js
1068
+ function getSelectorName(functionString) {
1069
+ try {
1070
+ const constants = new Set(Array.from(functionString.match(/([A-Z_]){3,}/g) ?? []));
1071
+ constants.delete("CONFIG");
1072
+ constants.delete("CONFIG_PREFIX_SEPARATOR");
1073
+ constants.delete("ENV");
1074
+ return [...constants].join(", ");
1075
+ } catch (e) {
1076
+ return functionString;
933
1077
  }
934
- isStructSchema() {
935
- const sc = this.getSchema();
936
- if (typeof sc !== "object") {
937
- return false;
1078
+ }
1079
+
1080
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/node-config-provider/fromEnv.js
1081
+ var fromEnv = (envVarSelector, options) => async () => {
1082
+ try {
1083
+ const config = envVarSelector(process.env, options);
1084
+ if (config === void 0) {
1085
+ throw new Error();
938
1086
  }
939
- const id = sc[0];
940
- return id === 3 || id === -3 || id === 4;
1087
+ return config;
1088
+ } catch (e) {
1089
+ throw new CredentialsProviderError(e.message || `Not found in ENV: ${getSelectorName(envVarSelector.toString())}`, { logger: options?.logger });
941
1090
  }
942
- isUnionSchema() {
943
- const sc = this.getSchema();
944
- if (typeof sc !== "object") {
945
- return false;
1091
+ };
1092
+
1093
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/node-config-provider/fromSharedConfigFiles.js
1094
+ var fromSharedConfigFiles = (configSelector, { preferredFile = "config", ...init } = {}) => async () => {
1095
+ const profile = getProfileName(init);
1096
+ const { configFile, credentialsFile } = await loadSharedConfigFiles(init);
1097
+ const profileFromCredentials = credentialsFile[profile] || {};
1098
+ const profileFromConfig = configFile[profile] || {};
1099
+ const mergedProfile = preferredFile === "config" ? { ...profileFromCredentials, ...profileFromConfig } : { ...profileFromConfig, ...profileFromCredentials };
1100
+ try {
1101
+ const cfgFile = preferredFile === "config" ? configFile : credentialsFile;
1102
+ const configValue = configSelector(mergedProfile, cfgFile);
1103
+ if (configValue === void 0) {
1104
+ throw new Error();
946
1105
  }
947
- return sc[0] === 4;
948
- }
949
- isBlobSchema() {
950
- const sc = this.getSchema();
951
- return sc === 21 || sc === 42;
952
- }
953
- isTimestampSchema() {
954
- const sc = this.getSchema();
955
- return typeof sc === "number" && sc >= 4 && sc <= 7;
956
- }
957
- isUnitSchema() {
958
- return this.getSchema() === "unit";
959
- }
960
- isDocumentSchema() {
961
- return this.getSchema() === 15;
962
- }
963
- isStringSchema() {
964
- return this.getSchema() === 0;
965
- }
966
- isBooleanSchema() {
967
- return this.getSchema() === 2;
968
- }
969
- isNumericSchema() {
970
- return this.getSchema() === 1;
971
- }
972
- isBigIntegerSchema() {
973
- return this.getSchema() === 17;
974
- }
975
- isBigDecimalSchema() {
976
- return this.getSchema() === 19;
977
- }
978
- isStreaming() {
979
- const { streaming } = this.getMergedTraits();
980
- return !!streaming || this.getSchema() === 42;
981
- }
982
- isIdempotencyToken() {
983
- return !!this.getMergedTraits().idempotencyToken;
984
- }
985
- getMergedTraits() {
986
- return this.normalizedTraits ?? (this.normalizedTraits = {
987
- ...this.getOwnTraits(),
988
- ...this.getMemberTraits()
989
- });
1106
+ return configValue;
1107
+ } catch (e) {
1108
+ throw new CredentialsProviderError(e.message || `Not found in config files w/ profile [${profile}]: ${getSelectorName(configSelector.toString())}`, { logger: init.logger });
990
1109
  }
991
- getMemberTraits() {
992
- return translateTraits(this.memberTraits);
1110
+ };
1111
+
1112
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/property-provider/fromValue.js
1113
+ var fromValue = (staticValue) => () => Promise.resolve(staticValue);
1114
+
1115
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/node-config-provider/fromStatic.js
1116
+ var isFunction = (func) => typeof func === "function";
1117
+ var fromStatic = (defaultValue) => isFunction(defaultValue) ? async () => await defaultValue() : fromValue(defaultValue);
1118
+
1119
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/node-config-provider/configLoader.js
1120
+ var loadConfig = ({ environmentVariableSelector, configFileSelector, default: defaultValue }, configuration = {}) => {
1121
+ const { signingName, logger } = configuration;
1122
+ const envOptions = { signingName, logger };
1123
+ return memoize(chain(fromEnv(environmentVariableSelector, envOptions), fromSharedConfigFiles(configFileSelector, configuration), fromStatic(defaultValue)));
1124
+ };
1125
+
1126
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/config-resolver/regionConfig/checkRegion.js
1127
+ var validRegions = /* @__PURE__ */ new Set();
1128
+ var checkRegion = (region, check = isValidHostLabel) => {
1129
+ if (!validRegions.has(region) && !check(region)) {
1130
+ if (region === "*") {
1131
+ console.warn(`@smithy/config-resolver WARN - Please use the caller region instead of "*". See "sigv4a" in https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md.`);
1132
+ } else {
1133
+ throw new Error(`Region not accepted: region="${region}" is not a valid hostname component.`);
1134
+ }
1135
+ } else {
1136
+ validRegions.add(region);
993
1137
  }
994
- getOwnTraits() {
995
- return translateTraits(this.traits);
1138
+ };
1139
+
1140
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/config-resolver/regionConfig/isFipsRegion.js
1141
+ var isFipsRegion = (region) => typeof region === "string" && (region.startsWith("fips-") || region.endsWith("-fips"));
1142
+
1143
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/config-resolver/regionConfig/getRealRegion.js
1144
+ var getRealRegion = (region) => isFipsRegion(region) ? ["fips-aws-global", "aws-fips"].includes(region) ? "us-east-1" : region.replace(/fips-(dkr-|prod-)?|-fips/, "") : region;
1145
+
1146
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/config-resolver/regionConfig/resolveRegionConfig.js
1147
+ var resolveRegionConfig = (input) => {
1148
+ const { region, useFipsEndpoint } = input;
1149
+ if (!region) {
1150
+ throw new Error("Region is missing");
996
1151
  }
997
- getKeySchema() {
998
- const [isDoc, isMap] = [this.isDocumentSchema(), this.isMapSchema()];
999
- if (!isDoc && !isMap) {
1000
- throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(true)}`);
1152
+ return Object.assign(input, {
1153
+ region: async () => {
1154
+ const providedRegion = typeof region === "function" ? await region() : region;
1155
+ const realRegion = getRealRegion(providedRegion);
1156
+ checkRegion(realRegion);
1157
+ return realRegion;
1158
+ },
1159
+ useFipsEndpoint: async () => {
1160
+ const providedRegion = typeof region === "string" ? region : await region();
1161
+ if (isFipsRegion(providedRegion)) {
1162
+ return true;
1163
+ }
1164
+ return typeof useFipsEndpoint !== "function" ? Promise.resolve(!!useFipsEndpoint) : useFipsEndpoint();
1001
1165
  }
1002
- const schema = this.getSchema();
1003
- const memberSchema = isDoc ? 15 : schema[4] ?? 0;
1004
- return member([memberSchema, 0], "key");
1166
+ });
1167
+ };
1168
+
1169
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/property-provider/TokenProviderError.js
1170
+ var TokenProviderError = class _TokenProviderError extends ProviderError {
1171
+ name = "TokenProviderError";
1172
+ constructor(message, options = true) {
1173
+ super(message, options);
1174
+ Object.setPrototypeOf(this, _TokenProviderError.prototype);
1005
1175
  }
1006
- getValueSchema() {
1007
- const sc = this.getSchema();
1008
- const [isDoc, isMap, isList] = [this.isDocumentSchema(), this.isMapSchema(), this.isListSchema()];
1009
- const memberSchema = typeof sc === "number" ? 63 & sc : sc && typeof sc === "object" && (isMap || isList) ? sc[3 + sc[0]] : isDoc ? 15 : void 0;
1010
- if (memberSchema != null) {
1011
- return member([memberSchema, 0], isMap ? "value" : "member");
1012
- }
1013
- throw new Error(`@smithy/core/schema - ${this.getName(true)} has no value member.`);
1176
+ };
1177
+
1178
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/util-config-provider/booleanSelector.js
1179
+ var booleanSelector = (obj, key, type) => {
1180
+ if (!(key in obj))
1181
+ return void 0;
1182
+ if (obj[key] === "true")
1183
+ return true;
1184
+ if (obj[key] === "false")
1185
+ return false;
1186
+ throw new Error(`Cannot load ${type} "${key}". Expected "true" or "false", got ${obj[key]}.`);
1187
+ };
1188
+
1189
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/util-config-provider/types.js
1190
+ var SelectorType;
1191
+ (function(SelectorType2) {
1192
+ SelectorType2["ENV"] = "env";
1193
+ SelectorType2["CONFIG"] = "shared config entry";
1194
+ })(SelectorType || (SelectorType = {}));
1195
+
1196
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/config-resolver/endpointsConfig/NodeUseDualstackEndpointConfigOptions.js
1197
+ var ENV_USE_DUALSTACK_ENDPOINT = "AWS_USE_DUALSTACK_ENDPOINT";
1198
+ var CONFIG_USE_DUALSTACK_ENDPOINT = "use_dualstack_endpoint";
1199
+ var NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS = {
1200
+ environmentVariableSelector: (env) => booleanSelector(env, ENV_USE_DUALSTACK_ENDPOINT, SelectorType.ENV),
1201
+ configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_DUALSTACK_ENDPOINT, SelectorType.CONFIG),
1202
+ default: false
1203
+ };
1204
+
1205
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/config-resolver/endpointsConfig/NodeUseFipsEndpointConfigOptions.js
1206
+ var ENV_USE_FIPS_ENDPOINT = "AWS_USE_FIPS_ENDPOINT";
1207
+ var CONFIG_USE_FIPS_ENDPOINT = "use_fips_endpoint";
1208
+ var NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS = {
1209
+ environmentVariableSelector: (env) => booleanSelector(env, ENV_USE_FIPS_ENDPOINT, SelectorType.ENV),
1210
+ configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_FIPS_ENDPOINT, SelectorType.CONFIG),
1211
+ default: false
1212
+ };
1213
+
1214
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/defaults-mode/constants.js
1215
+ var AWS_EXECUTION_ENV = "AWS_EXECUTION_ENV";
1216
+ var AWS_REGION_ENV = "AWS_REGION";
1217
+ var AWS_DEFAULT_REGION_ENV = "AWS_DEFAULT_REGION";
1218
+ var ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED";
1219
+ var DEFAULTS_MODE_OPTIONS = ["in-region", "cross-region", "mobile", "standard", "legacy"];
1220
+ var IMDS_REGION_PATH = "/latest/meta-data/placement/region";
1221
+ var IMDS_TOKEN_PATH = "/latest/api/token";
1222
+ var X_AWS_EC2_METADATA_TOKEN = "x-aws-ec2-metadata-token";
1223
+ var X_AWS_EC2_METADATA_TOKEN_TTL = "x-aws-ec2-metadata-token-ttl-seconds";
1224
+
1225
+ // ../../node_modules/@smithy/core/dist-es/submodules/config/config-resolver/regionConfig/getInstanceMetadataRegion.js
1226
+ var TIMEOUT_MS = 1e3;
1227
+ var NEG_CACHE_TTL_MS = 6e4;
1228
+ var negativeCacheUntil = 0;
1229
+ var getInstanceMetadataRegion = async () => {
1230
+ if (process.env[ENV_IMDS_DISABLED]) {
1231
+ return void 0;
1014
1232
  }
1015
- getMemberSchema(memberName) {
1016
- const struct = this.getSchema();
1017
- if (this.isStructSchema() && struct[4].includes(memberName)) {
1018
- const i = struct[4].indexOf(memberName);
1019
- const memberSchema = struct[5][i];
1020
- return member(isMemberSchema(memberSchema) ? memberSchema : [memberSchema, 0], memberName);
1021
- }
1022
- if (this.isDocumentSchema()) {
1023
- return member([15, 0], memberName);
1024
- }
1025
- throw new Error(`@smithy/core/schema - ${this.getName(true)} has no member=${memberName}.`);
1233
+ if (Date.now() < negativeCacheUntil) {
1234
+ return void 0;
1026
1235
  }
1027
- getMemberSchemas() {
1028
- const buffer = {};
1029
- try {
1030
- for (const [k, v] of this.structIterator()) {
1031
- buffer[k] = v;
1236
+ try {
1237
+ const endpoint = resolveImdsEndpoint();
1238
+ const token = (await imdsRequest({
1239
+ ...endpoint,
1240
+ path: IMDS_TOKEN_PATH,
1241
+ method: "PUT",
1242
+ headers: {
1243
+ [X_AWS_EC2_METADATA_TOKEN_TTL]: "21600"
1032
1244
  }
1033
- } catch (ignored) {
1034
- }
1035
- return buffer;
1036
- }
1037
- getEventStreamMember() {
1038
- if (this.isStructSchema()) {
1039
- for (const [memberName, memberSchema] of this.structIterator()) {
1040
- if (memberSchema.isStreaming() && memberSchema.isStructSchema()) {
1041
- return memberName;
1042
- }
1245
+ })).toString();
1246
+ const region = (await imdsRequest({
1247
+ ...endpoint,
1248
+ path: IMDS_REGION_PATH,
1249
+ method: "GET",
1250
+ headers: {
1251
+ [X_AWS_EC2_METADATA_TOKEN]: token
1043
1252
  }
1044
- }
1045
- return "";
1253
+ })).toString().trim();
1254
+ return region || cacheNegativeAndReturnUndefined();
1255
+ } catch {
1256
+ return cacheNegativeAndReturnUndefined();
1046
1257
  }
1047
- *structIterator() {
1048
- if (this.isUnitSchema()) {
1049
- return;
1050
- }
1051
- if (!this.isStructSchema()) {
1052
- throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");
1053
- }
1054
- const struct = this.getSchema();
1055
- const z = struct[4].length;
1056
- let it = struct[anno.it];
1057
- if (it && z === it.length) {
1058
- yield* it;
1059
- return;
1060
- }
1061
- it = Array(z);
1062
- for (let i = 0; i < z; ++i) {
1063
- const k = struct[4][i];
1064
- const v = member([struct[5][i], 0], k);
1065
- yield it[i] = [k, v];
1066
- }
1067
- struct[anno.it] = it;
1258
+ };
1259
+ var cacheNegativeAndReturnUndefined = () => {
1260
+ negativeCacheUntil = Date.now() + NEG_CACHE_TTL_MS;
1261
+ return void 0;
1262
+ };
1263
+ var resolveImdsEndpoint = () => {
1264
+ const envEndpoint = process.env.AWS_EC2_METADATA_SERVICE_ENDPOINT;
1265
+ if (envEndpoint) {
1266
+ const url = new URL(envEndpoint);
1267
+ return {
1268
+ hostname: url.hostname.replace(/^\[(.+)]$/, "$1"),
1269
+ port: url.port ? Number(url.port) : void 0
1270
+ };
1271
+ }
1272
+ if (process.env.AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE === "IPv6") {
1273
+ return { hostname: "fd00:ec2::254" };
1068
1274
  }
1275
+ return { hostname: "169.254.169.254" };
1069
1276
  };
1070
- function member(memberSchema, memberName) {
1071
- if (memberSchema instanceof NormalizedSchema) {
1072
- return Object.assign(memberSchema, {
1073
- memberName,
1074
- _isMemberSchema: true
1277
+ var imdsRequest = async (options) => {
1278
+ const { request } = await import("http");
1279
+ return new Promise((resolve, reject) => {
1280
+ const req = request({
1281
+ hostname: options.hostname,
1282
+ port: options.port,
1283
+ path: options.path,
1284
+ method: options.method,
1285
+ headers: options.headers,
1286
+ timeout: TIMEOUT_MS,
1287
+ signal: AbortSignal.timeout(TIMEOUT_MS)
1075
1288
  });
1076
- }
1077
- const internalCtorAccess = NormalizedSchema;
1078
- return new internalCtorAccess(memberSchema, memberName);
1079
- }
1080
- var isMemberSchema = (sc) => Array.isArray(sc) && sc.length === 2;
1081
- var isStaticSchema = (sc) => Array.isArray(sc) && sc.length >= 5;
1289
+ req.on("error", (err) => {
1290
+ reject(err);
1291
+ req.destroy();
1292
+ });
1293
+ req.on("timeout", () => {
1294
+ reject(new Error("TimeoutError from instance metadata service"));
1295
+ req.destroy();
1296
+ });
1297
+ req.on("response", (res) => {
1298
+ const { statusCode = 400 } = res;
1299
+ if (statusCode < 200 || statusCode >= 300) {
1300
+ reject(Object.assign(new Error("Error response received from instance metadata service"), { statusCode }));
1301
+ req.destroy();
1302
+ return;
1303
+ }
1304
+ const chunks = [];
1305
+ res.on("data", (chunk) => chunks.push(chunk));
1306
+ res.on("end", () => {
1307
+ resolve(Buffer.concat(chunks));
1308
+ req.destroy();
1309
+ });
1310
+ });
1311
+ req.end();
1312
+ });
1313
+ };
1082
1314
 
1083
1315
  // ../../node_modules/@smithy/core/dist-es/submodules/config/config-resolver/regionConfig/config.js
1084
1316
  var REGION_ENV_NAME = "AWS_REGION";
@@ -1086,7 +1318,11 @@ var REGION_INI_NAME = "region";
1086
1318
  var NODE_REGION_CONFIG_OPTIONS = {
1087
1319
  environmentVariableSelector: (env) => env[REGION_ENV_NAME],
1088
1320
  configFileSelector: (profile) => profile[REGION_INI_NAME],
1089
- default: () => {
1321
+ default: async () => {
1322
+ const region = await getInstanceMetadataRegion();
1323
+ if (region) {
1324
+ return region;
1325
+ }
1090
1326
  throw new Error("Region is missing");
1091
1327
  }
1092
1328
  };
@@ -1094,14 +1330,6 @@ var NODE_REGION_CONFIG_FILE_OPTIONS = {
1094
1330
  preferredFile: "credentials"
1095
1331
  };
1096
1332
 
1097
- // ../../node_modules/@smithy/core/dist-es/submodules/config/defaults-mode/constants.js
1098
- var AWS_EXECUTION_ENV = "AWS_EXECUTION_ENV";
1099
- var AWS_REGION_ENV = "AWS_REGION";
1100
- var AWS_DEFAULT_REGION_ENV = "AWS_DEFAULT_REGION";
1101
- var ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED";
1102
- var DEFAULTS_MODE_OPTIONS = ["in-region", "cross-region", "mobile", "standard", "legacy"];
1103
- var IMDS_REGION_PATH = "/latest/meta-data/placement/region";
1104
-
1105
1333
  // ../../node_modules/@smithy/core/dist-es/submodules/config/defaults-mode/defaultsModeConfig.js
1106
1334
  var AWS_DEFAULTS_MODE_ENV = "AWS_DEFAULTS_MODE";
1107
1335
  var AWS_DEFAULTS_MODE_CONFIG = "defaults_mode";
@@ -1152,60 +1380,7 @@ var inferPhysicalRegion = async () => {
1152
1380
  if (process.env[AWS_EXECUTION_ENV] && (process.env[AWS_REGION_ENV] || process.env[AWS_DEFAULT_REGION_ENV])) {
1153
1381
  return process.env[AWS_REGION_ENV] ?? process.env[AWS_DEFAULT_REGION_ENV];
1154
1382
  }
1155
- if (!process.env[ENV_IMDS_DISABLED]) {
1156
- try {
1157
- const endpoint = await getImdsEndpoint();
1158
- return (await imdsHttpGet({ hostname: endpoint.hostname, path: IMDS_REGION_PATH })).toString();
1159
- } catch (e) {
1160
- }
1161
- }
1162
- };
1163
- var getImdsEndpoint = async () => {
1164
- const envEndpoint = process.env.AWS_EC2_METADATA_SERVICE_ENDPOINT;
1165
- if (envEndpoint) {
1166
- const url = new URL(envEndpoint);
1167
- return { hostname: url.hostname, path: url.pathname };
1168
- }
1169
- const envMode = process.env.AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE;
1170
- if (envMode === "IPv6") {
1171
- return { hostname: "fd00:ec2::254", path: "/" };
1172
- }
1173
- return { hostname: "169.254.169.254", path: "/" };
1174
- };
1175
- var imdsHttpGet = async ({ hostname, path }) => {
1176
- const { request } = await import("http");
1177
- return new Promise((resolve, reject) => {
1178
- const req = request({
1179
- method: "GET",
1180
- hostname: hostname.replace(/^\[(.+)]$/, "$1"),
1181
- path,
1182
- timeout: 1e3,
1183
- signal: AbortSignal.timeout(1e3)
1184
- });
1185
- req.on("error", (err) => {
1186
- reject(err);
1187
- req.destroy();
1188
- });
1189
- req.on("timeout", () => {
1190
- reject(new Error("TimeoutError from instance metadata service"));
1191
- req.destroy();
1192
- });
1193
- req.on("response", (res) => {
1194
- const { statusCode = 400 } = res;
1195
- if (statusCode < 200 || 300 <= statusCode) {
1196
- reject(Object.assign(new Error("Error response received from instance metadata service"), { statusCode }));
1197
- req.destroy();
1198
- return;
1199
- }
1200
- const chunks = [];
1201
- res.on("data", (chunk) => chunks.push(chunk));
1202
- res.on("end", () => {
1203
- resolve(Buffer.concat(chunks));
1204
- req.destroy();
1205
- });
1206
- });
1207
- req.end();
1208
- });
1383
+ return getInstanceMetadataRegion();
1209
1384
  };
1210
1385
 
1211
1386
  // ../../node_modules/@smithy/core/dist-es/submodules/protocols/middleware-content-length/contentLengthMiddleware.js
@@ -1354,6 +1529,9 @@ var HttpProtocol = class extends SerdeContext {
1354
1529
  hostPrefix = hostPrefix.replace(`{${name}}`, replacement);
1355
1530
  }
1356
1531
  request.hostname = hostPrefix + request.hostname;
1532
+ if (!isValidHostname(request.hostname)) {
1533
+ throw new Error(`[${request.hostname}] is not a valid hostname.`);
1534
+ }
1357
1535
  }
1358
1536
  }
1359
1537
  }
@@ -1382,7 +1560,7 @@ var HttpProtocol = class extends SerdeContext {
1382
1560
  });
1383
1561
  }
1384
1562
  async loadEventStreamCapability() {
1385
- const { EventStreamSerde, eventStreamSerdeProvider } = await import("./event-streams-AI5RIQ2F.js");
1563
+ const { EventStreamSerde, eventStreamSerdeProvider } = await import("./event-streams-C2JNHHGL.js");
1386
1564
  const marshaller = this.resolveEventStreamMarshaller(eventStreamSerdeProvider);
1387
1565
  return new EventStreamSerde({
1388
1566
  marshaller,
@@ -2053,6 +2231,8 @@ function buildQueryString(query) {
2053
2231
  }
2054
2232
 
2055
2233
  export {
2234
+ EndpointURLScheme,
2235
+ AlgorithmId,
2056
2236
  SMITHY_CONTEXT_KEY,
2057
2237
  getSmithyContext,
2058
2238
  HttpRequest,
@@ -2062,14 +2242,13 @@ export {
2062
2242
  parseUrl,
2063
2243
  toEndpointV1,
2064
2244
  deref,
2245
+ getSchemaSerdePlugin,
2065
2246
  NormalizedSchema,
2066
2247
  TypeRegistry,
2067
2248
  ProviderError,
2068
2249
  CredentialsProviderError,
2069
2250
  TokenProviderError,
2070
2251
  chain,
2071
- booleanSelector,
2072
- SelectorType,
2073
2252
  ENV_PROFILE,
2074
2253
  getProfileName,
2075
2254
  getSSOTokenFilepath,
@@ -2100,4 +2279,4 @@ export {
2100
2279
  escapeUri,
2101
2280
  buildQueryString
2102
2281
  };
2103
- //# sourceMappingURL=chunk-7UEKNJE3.js.map
2282
+ //# sourceMappingURL=chunk-7W3WYDYY.js.map