@jjrawlins/cdk-iam-policy-builder-helper 0.0.52 → 0.0.54

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 (123) hide show
  1. package/.jsii +3 -3
  2. package/cdk-iam-policy-builder-helper/jsii/jsii.go +2 -2
  3. package/cdk-iam-policy-builder-helper/version +1 -1
  4. package/node_modules/@aws-sdk/client-iam/dist-cjs/index.js +13439 -13574
  5. package/node_modules/@aws-sdk/client-iam/package.json +6 -6
  6. package/node_modules/@aws-sdk/client-sso/dist-cjs/index.js +478 -596
  7. package/node_modules/@aws-sdk/client-sso/package.json +5 -5
  8. package/node_modules/@aws-sdk/core/dist-cjs/index.js +1969 -6
  9. package/node_modules/@aws-sdk/core/dist-cjs/submodules/account-id-endpoint/index.js +48 -88
  10. package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.js +35 -74
  11. package/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js +273 -365
  12. package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +1581 -1863
  13. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsJsonRpcProtocol.js +2 -2
  14. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsRestJsonProtocol.js +2 -2
  15. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeDeserializer.js +4 -4
  16. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeSerializer.js +4 -4
  17. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/query/AwsQueryProtocol.js +3 -3
  18. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/query/QueryShapeSerializer.js +4 -4
  19. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/AwsRestXmlProtocol.js +2 -2
  20. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/XmlShapeSerializer.js +4 -4
  21. package/node_modules/@aws-sdk/core/dist-types/submodules/account-id-endpoint/AccountIdEndpointModeConfigResolver.d.ts +1 -1
  22. package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4ASigner.d.ts +1 -1
  23. package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.d.ts +1 -1
  24. package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4AConfig.d.ts +1 -1
  25. package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.d.ts +1 -1
  26. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/ConfigurableSerdeContext.d.ts +1 -1
  27. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/JsonCodec.d.ts +1 -1
  28. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/JsonShapeDeserializer.d.ts +1 -1
  29. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/JsonShapeSerializer.d.ts +2 -2
  30. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/query/QuerySerializerSettings.d.ts +1 -1
  31. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/xml/XmlCodec.d.ts +1 -1
  32. package/node_modules/@aws-sdk/core/package.json +1 -1
  33. package/node_modules/@aws-sdk/credential-provider-env/dist-cjs/index.js +38 -73
  34. package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
  35. package/node_modules/@aws-sdk/credential-provider-http/package.json +2 -2
  36. package/node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js +194 -259
  37. package/node_modules/@aws-sdk/credential-provider-ini/package.json +8 -8
  38. package/node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js +72 -132
  39. package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
  40. package/node_modules/@aws-sdk/credential-provider-process/dist-cjs/index.js +71 -107
  41. package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
  42. package/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/index.js +176 -249
  43. package/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/loadSso-CVy8iqsZ.js +14 -0
  44. package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
  45. package/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/index.js +16 -25
  46. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
  47. package/node_modules/@aws-sdk/middleware-user-agent/dist-cjs/index.js +170 -203
  48. package/node_modules/@aws-sdk/middleware-user-agent/package.json +2 -2
  49. package/node_modules/@aws-sdk/nested-clients/dist-cjs/index.js +2 -2
  50. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +583 -858
  51. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +795 -928
  52. package/node_modules/@aws-sdk/nested-clients/package.json +5 -5
  53. package/node_modules/@aws-sdk/token-providers/dist-cjs/index.js +147 -222
  54. package/node_modules/@aws-sdk/token-providers/package.json +3 -3
  55. package/node_modules/@aws-sdk/util-user-agent-browser/README.md +22 -3
  56. package/node_modules/@aws-sdk/util-user-agent-browser/dist-cjs/createUserAgentStringParsingProvider.js +57 -0
  57. package/node_modules/@aws-sdk/util-user-agent-browser/dist-cjs/index.js +39 -8
  58. package/node_modules/@aws-sdk/util-user-agent-browser/dist-es/createUserAgentStringParsingProvider.js +20 -0
  59. package/node_modules/@aws-sdk/util-user-agent-browser/dist-es/index.js +37 -6
  60. package/node_modules/@aws-sdk/util-user-agent-browser/dist-types/createUserAgentStringParsingProvider.d.ts +14 -0
  61. package/node_modules/@aws-sdk/util-user-agent-browser/dist-types/index.d.ts +14 -4
  62. package/node_modules/@aws-sdk/util-user-agent-browser/dist-types/index.native.d.ts +4 -3
  63. package/node_modules/@aws-sdk/util-user-agent-browser/dist-types/ts3.4/createUserAgentStringParsingProvider.d.ts +9 -0
  64. package/node_modules/@aws-sdk/util-user-agent-browser/dist-types/ts3.4/index.d.ts +5 -0
  65. package/node_modules/@aws-sdk/util-user-agent-browser/package.json +1 -1
  66. package/node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js +50 -94
  67. package/node_modules/@aws-sdk/util-user-agent-node/dist-types/crt-availability.d.ts +1 -2
  68. package/node_modules/@aws-sdk/util-user-agent-node/dist-types/defaultUserAgent.d.ts +10 -5
  69. package/node_modules/@aws-sdk/util-user-agent-node/package.json +2 -2
  70. package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +1 -1
  71. package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +5 -3
  72. package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +32 -30
  73. package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +133 -202
  74. package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +126 -34
  75. package/node_modules/@smithy/core/dist-es/submodules/cbor/CborCodec.js +2 -2
  76. package/node_modules/@smithy/core/dist-es/submodules/event-streams/EventStreamSerde.js +5 -3
  77. package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js +4 -4
  78. package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +3 -3
  79. package/node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js +2 -2
  80. package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/FromStringShapeDeserializer.js +19 -17
  81. package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/ToStringShapeSerializer.js +4 -4
  82. package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/determineTimestampFormat.js +5 -6
  83. package/node_modules/@smithy/core/dist-es/submodules/schema/index.js +1 -0
  84. package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/NormalizedSchema.js +82 -176
  85. package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/translateTraits.js +22 -0
  86. package/node_modules/@smithy/core/dist-es/submodules/serde/index.js +1 -0
  87. package/node_modules/@smithy/core/dist-es/submodules/serde/schema-serde-lib/schema-date-utils.js +110 -0
  88. package/node_modules/@smithy/core/dist-es/submodules/serde/value/NumericValue.js +4 -26
  89. package/node_modules/@smithy/core/dist-types/submodules/schema/index.d.ts +1 -0
  90. package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/NormalizedSchema.d.ts +5 -24
  91. package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/sentinels.d.ts +2 -0
  92. package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/translateTraits.d.ts +7 -0
  93. package/node_modules/@smithy/core/dist-types/submodules/serde/index.d.ts +1 -0
  94. package/node_modules/@smithy/core/dist-types/submodules/serde/schema-serde-lib/schema-date-utils.d.ts +47 -0
  95. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/index.d.ts +1 -0
  96. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/NormalizedSchema.d.ts +5 -24
  97. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/sentinels.d.ts +2 -0
  98. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/translateTraits.d.ts +7 -0
  99. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/serde/index.d.ts +1 -0
  100. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/serde/schema-serde-lib/schema-date-utils.d.ts +47 -0
  101. package/node_modules/@smithy/core/package.json +3 -3
  102. package/node_modules/@smithy/fetch-http-handler/package.json +2 -2
  103. package/node_modules/@smithy/middleware-endpoint/package.json +2 -2
  104. package/node_modules/@smithy/middleware-retry/package.json +2 -2
  105. package/node_modules/@smithy/smithy-client/package.json +4 -4
  106. package/node_modules/@smithy/util-base64/dist-cjs/constants.browser.js +9 -32
  107. package/node_modules/@smithy/util-base64/dist-es/constants.browser.js +9 -28
  108. package/node_modules/@smithy/util-base64/dist-types/constants.browser.d.ts +5 -6
  109. package/node_modules/@smithy/util-base64/dist-types/ts3.4/constants.browser.d.ts +5 -6
  110. package/node_modules/@smithy/util-base64/package.json +1 -1
  111. package/node_modules/@smithy/util-body-length-node/dist-cjs/index.js +8 -6
  112. package/node_modules/@smithy/util-body-length-node/dist-es/calculateBodyLength.js +8 -6
  113. package/node_modules/@smithy/util-body-length-node/package.json +1 -1
  114. package/node_modules/@smithy/util-defaults-mode-browser/dist-cjs/resolveDefaultsModeConfig.js +11 -9
  115. package/node_modules/@smithy/util-defaults-mode-browser/dist-es/resolveDefaultsModeConfig.js +11 -8
  116. package/node_modules/@smithy/util-defaults-mode-browser/package.json +2 -3
  117. package/node_modules/@smithy/util-defaults-mode-node/package.json +2 -2
  118. package/node_modules/@smithy/util-stream/dist-cjs/index.js +3 -5
  119. package/node_modules/@smithy/util-stream/dist-es/blob/Uint8ArrayBlobAdapter.js +3 -5
  120. package/node_modules/@smithy/util-stream/dist-types/blob/Uint8ArrayBlobAdapter.d.ts +1 -0
  121. package/node_modules/@smithy/util-stream/dist-types/ts3.4/blob/Uint8ArrayBlobAdapter.d.ts +1 -0
  122. package/node_modules/@smithy/util-stream/package.json +3 -3
  123. package/package.json +3 -3
@@ -264,36 +264,28 @@ const error = (namespace, name, traits, memberNames, memberList, ctor) => Schema
264
264
  ctor: null,
265
265
  });
266
266
 
267
- const SCHEMA = {
268
- BLOB: 0b0001_0101,
269
- STREAMING_BLOB: 0b0010_1010,
270
- BOOLEAN: 0b0000_0010,
271
- STRING: 0b0000_0000,
272
- NUMERIC: 0b0000_0001,
273
- BIG_INTEGER: 0b0001_0001,
274
- BIG_DECIMAL: 0b0001_0011,
275
- DOCUMENT: 0b0000_1111,
276
- TIMESTAMP_DEFAULT: 0b0000_0100,
277
- TIMESTAMP_DATE_TIME: 0b0000_0101,
278
- TIMESTAMP_HTTP_DATE: 0b0000_0110,
279
- TIMESTAMP_EPOCH_SECONDS: 0b0000_0111,
280
- LIST_MODIFIER: 0b0100_0000,
281
- MAP_MODIFIER: 0b1000_0000,
282
- };
283
-
284
- class SimpleSchema extends Schema {
285
- static symbol = Symbol.for("@smithy/sim");
286
- name;
287
- schemaRef;
288
- traits;
289
- symbol = SimpleSchema.symbol;
267
+ function translateTraits(indicator) {
268
+ if (typeof indicator === "object") {
269
+ return indicator;
270
+ }
271
+ indicator = indicator | 0;
272
+ const traits = {};
273
+ let i = 0;
274
+ for (const trait of [
275
+ "httpLabel",
276
+ "idempotent",
277
+ "idempotencyToken",
278
+ "sensitive",
279
+ "httpPayload",
280
+ "httpResponseCode",
281
+ "httpQueryParams",
282
+ ]) {
283
+ if (((indicator >> i++) & 1) === 1) {
284
+ traits[trait] = 1;
285
+ }
286
+ }
287
+ return traits;
290
288
  }
291
- const sim = (namespace, name, schemaRef, traits) => Schema.assign(new SimpleSchema(), {
292
- name,
293
- namespace,
294
- traits,
295
- schemaRef,
296
- });
297
289
 
298
290
  class NormalizedSchema {
299
291
  ref;
@@ -323,7 +315,7 @@ class NormalizedSchema {
323
315
  this.memberTraits = {};
324
316
  for (let i = traitStack.length - 1; i >= 0; --i) {
325
317
  const traitSet = traitStack[i];
326
- Object.assign(this.memberTraits, NormalizedSchema.translateTraits(traitSet));
318
+ Object.assign(this.memberTraits, translateTraits(traitSet));
327
319
  }
328
320
  }
329
321
  else {
@@ -344,8 +336,7 @@ class NormalizedSchema {
344
336
  else {
345
337
  this.traits = 0;
346
338
  }
347
- this.name =
348
- (this.schema instanceof Schema ? this.schema.getName?.() : void 0) ?? this.memberName ?? this.getSchemaName();
339
+ this.name = (this.schema instanceof Schema ? this.schema.getName?.() : void 0) ?? this.memberName ?? String(schema);
349
340
  if (this._isMemberSchema && !memberName) {
350
341
  throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(true)} missing member name.`);
351
342
  }
@@ -354,138 +345,90 @@ class NormalizedSchema {
354
345
  return Schema[Symbol.hasInstance].bind(this)(lhs);
355
346
  }
356
347
  static of(ref) {
357
- if (ref instanceof NormalizedSchema) {
358
- return ref;
348
+ const sc = deref(ref);
349
+ if (sc instanceof NormalizedSchema) {
350
+ return sc;
359
351
  }
360
- if (Array.isArray(ref)) {
361
- const [ns, traits] = ref;
352
+ if (Array.isArray(sc)) {
353
+ const [ns, traits] = sc;
362
354
  if (ns instanceof NormalizedSchema) {
363
- Object.assign(ns.getMergedTraits(), NormalizedSchema.translateTraits(traits));
355
+ Object.assign(ns.getMergedTraits(), translateTraits(traits));
364
356
  return ns;
365
357
  }
366
358
  throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(ref, null, 2)}.`);
367
359
  }
368
- return new NormalizedSchema(ref);
369
- }
370
- static translateTraits(indicator) {
371
- if (typeof indicator === "object") {
372
- return indicator;
373
- }
374
- indicator = indicator | 0;
375
- const traits = {};
376
- let i = 0;
377
- for (const trait of [
378
- "httpLabel",
379
- "idempotent",
380
- "idempotencyToken",
381
- "sensitive",
382
- "httpPayload",
383
- "httpResponseCode",
384
- "httpQueryParams",
385
- ]) {
386
- if (((indicator >> i++) & 1) === 1) {
387
- traits[trait] = 1;
388
- }
389
- }
390
- return traits;
360
+ return new NormalizedSchema(sc);
391
361
  }
392
362
  getSchema() {
393
- if (this.schema instanceof NormalizedSchema) {
394
- Object.assign(this, { schema: this.schema.getSchema() });
395
- return this.schema;
396
- }
397
- if (this.schema instanceof SimpleSchema) {
398
- return deref(this.schema.schemaRef);
399
- }
400
- return deref(this.schema);
363
+ return deref(this.schema?.schemaRef ?? this.schema);
401
364
  }
402
365
  getName(withNamespace = false) {
403
- if (!withNamespace) {
404
- if (this.name && this.name.includes("#")) {
405
- return this.name.split("#")[1];
406
- }
407
- }
408
- return this.name || undefined;
366
+ const { name } = this;
367
+ const short = !withNamespace && name && name.includes("#");
368
+ return short ? name.split("#")[1] : name || undefined;
409
369
  }
410
370
  getMemberName() {
411
- if (!this.isMemberSchema()) {
412
- throw new Error(`@smithy/core/schema - non-member schema: ${this.getName(true)}`);
413
- }
414
371
  return this.memberName;
415
372
  }
416
373
  isMemberSchema() {
417
374
  return this._isMemberSchema;
418
375
  }
419
- isUnitSchema() {
420
- return this.getSchema() === "unit";
421
- }
422
376
  isListSchema() {
423
- const inner = this.getSchema();
424
- if (typeof inner === "number") {
425
- return inner >= SCHEMA.LIST_MODIFIER && inner < SCHEMA.MAP_MODIFIER;
426
- }
427
- return inner instanceof ListSchema;
377
+ const sc = this.getSchema();
378
+ return typeof sc === "number"
379
+ ? sc >= 64 && sc < 128
380
+ : sc instanceof ListSchema;
428
381
  }
429
382
  isMapSchema() {
430
- const inner = this.getSchema();
431
- if (typeof inner === "number") {
432
- return inner >= SCHEMA.MAP_MODIFIER && inner <= 0b1111_1111;
433
- }
434
- return inner instanceof MapSchema;
383
+ const sc = this.getSchema();
384
+ return typeof sc === "number"
385
+ ? sc >= 128 && sc <= 0b1111_1111
386
+ : sc instanceof MapSchema;
435
387
  }
436
388
  isStructSchema() {
437
- const inner = this.getSchema();
438
- return (inner !== null && typeof inner === "object" && "members" in inner) || inner instanceof StructureSchema;
389
+ const sc = this.getSchema();
390
+ return (sc !== null && typeof sc === "object" && "members" in sc) || sc instanceof StructureSchema;
439
391
  }
440
392
  isBlobSchema() {
441
- return this.getSchema() === SCHEMA.BLOB || this.getSchema() === SCHEMA.STREAMING_BLOB;
393
+ const sc = this.getSchema();
394
+ return sc === 21 || sc === 42;
442
395
  }
443
396
  isTimestampSchema() {
444
- const schema = this.getSchema();
445
- return typeof schema === "number" && schema >= SCHEMA.TIMESTAMP_DEFAULT && schema <= SCHEMA.TIMESTAMP_EPOCH_SECONDS;
397
+ const sc = this.getSchema();
398
+ return (typeof sc === "number" &&
399
+ sc >= 4 &&
400
+ sc <= 7);
401
+ }
402
+ isUnitSchema() {
403
+ return this.getSchema() === "unit";
446
404
  }
447
405
  isDocumentSchema() {
448
- return this.getSchema() === SCHEMA.DOCUMENT;
406
+ return this.getSchema() === 15;
449
407
  }
450
408
  isStringSchema() {
451
- return this.getSchema() === SCHEMA.STRING;
409
+ return this.getSchema() === 0;
452
410
  }
453
411
  isBooleanSchema() {
454
- return this.getSchema() === SCHEMA.BOOLEAN;
412
+ return this.getSchema() === 2;
455
413
  }
456
414
  isNumericSchema() {
457
- return this.getSchema() === SCHEMA.NUMERIC;
415
+ return this.getSchema() === 1;
458
416
  }
459
417
  isBigIntegerSchema() {
460
- return this.getSchema() === SCHEMA.BIG_INTEGER;
418
+ return this.getSchema() === 17;
461
419
  }
462
420
  isBigDecimalSchema() {
463
- return this.getSchema() === SCHEMA.BIG_DECIMAL;
421
+ return this.getSchema() === 19;
464
422
  }
465
423
  isStreaming() {
466
- const streaming = !!this.getMergedTraits().streaming;
467
- if (streaming) {
468
- return true;
469
- }
470
- return this.getSchema() === SCHEMA.STREAMING_BLOB;
424
+ const { streaming } = this.getMergedTraits();
425
+ return !!streaming || this.getSchema() === 42;
471
426
  }
472
427
  isIdempotencyToken() {
473
- if (this.normalizedTraits) {
474
- return !!this.normalizedTraits.idempotencyToken;
475
- }
476
- for (const traits of [this.traits, this.memberTraits]) {
477
- if (typeof traits === "number") {
478
- if ((traits & 0b0100) === 0b0100) {
479
- return true;
480
- }
481
- }
482
- else if (typeof traits === "object") {
483
- if (!!traits.idempotencyToken) {
484
- return true;
485
- }
486
- }
487
- }
488
- return false;
428
+ const match = (traits) => (traits & 0b0100) === 0b0100 ||
429
+ !!traits?.idempotencyToken;
430
+ const { normalizedTraits, traits, memberTraits } = this;
431
+ return match(normalizedTraits) || match(traits) || match(memberTraits);
489
432
  }
490
433
  getMergedTraits() {
491
434
  return (this.normalizedTraits ??
@@ -495,74 +438,48 @@ class NormalizedSchema {
495
438
  }));
496
439
  }
497
440
  getMemberTraits() {
498
- return NormalizedSchema.translateTraits(this.memberTraits);
441
+ return translateTraits(this.memberTraits);
499
442
  }
500
443
  getOwnTraits() {
501
- return NormalizedSchema.translateTraits(this.traits);
444
+ return translateTraits(this.traits);
502
445
  }
503
446
  getKeySchema() {
504
- if (this.isDocumentSchema()) {
505
- return this.memberFrom([SCHEMA.DOCUMENT, 0], "key");
506
- }
507
- if (!this.isMapSchema()) {
447
+ const [isDoc, isMap] = [this.isDocumentSchema(), this.isMapSchema()];
448
+ if (!isDoc && !isMap) {
508
449
  throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(true)}`);
509
450
  }
510
451
  const schema = this.getSchema();
511
- if (typeof schema === "number") {
512
- return this.memberFrom([0b0011_1111 & schema, 0], "key");
513
- }
514
- return this.memberFrom([schema.keySchema, 0], "key");
452
+ const memberSchema = isDoc
453
+ ? 15
454
+ : schema?.keySchema ?? 0;
455
+ return member([memberSchema, 0], "key");
515
456
  }
516
457
  getValueSchema() {
517
- const schema = this.getSchema();
518
- if (typeof schema === "number") {
519
- if (this.isMapSchema()) {
520
- return this.memberFrom([0b0011_1111 & schema, 0], "value");
521
- }
522
- else if (this.isListSchema()) {
523
- return this.memberFrom([0b0011_1111 & schema, 0], "member");
524
- }
525
- }
526
- if (schema && typeof schema === "object") {
527
- if (this.isStructSchema()) {
528
- throw new Error(`may not getValueSchema() on structure ${this.getName(true)}`);
529
- }
530
- const collection = schema;
531
- if ("valueSchema" in collection) {
532
- if (this.isMapSchema()) {
533
- return this.memberFrom([collection.valueSchema, 0], "value");
534
- }
535
- else if (this.isListSchema()) {
536
- return this.memberFrom([collection.valueSchema, 0], "member");
537
- }
538
- }
539
- }
540
- if (this.isDocumentSchema()) {
541
- return this.memberFrom([SCHEMA.DOCUMENT, 0], "value");
458
+ const sc = this.getSchema();
459
+ const [isDoc, isMap, isList] = [this.isDocumentSchema(), this.isMapSchema(), this.isListSchema()];
460
+ const memberSchema = typeof sc === "number"
461
+ ? 0b0011_1111 & sc
462
+ : sc && typeof sc === "object" && (isMap || isList)
463
+ ? sc.valueSchema
464
+ : isDoc
465
+ ? 15
466
+ : void 0;
467
+ if (memberSchema != null) {
468
+ return member([memberSchema, 0], isMap ? "value" : "member");
542
469
  }
543
470
  throw new Error(`@smithy/core/schema - ${this.getName(true)} has no value member.`);
544
471
  }
545
- hasMemberSchema(member) {
546
- if (this.isStructSchema()) {
547
- const struct = this.getSchema();
548
- return struct.memberNames.includes(member);
549
- }
550
- return false;
551
- }
552
- getMemberSchema(member) {
553
- if (this.isStructSchema()) {
554
- const struct = this.getSchema();
555
- if (!struct.memberNames.includes(member)) {
556
- throw new Error(`@smithy/core/schema - ${this.getName(true)} has no member=${member}.`);
557
- }
558
- const i = struct.memberNames.indexOf(member);
472
+ getMemberSchema(memberName) {
473
+ const struct = this.getSchema();
474
+ if (this.isStructSchema() && struct.memberNames.includes(memberName)) {
475
+ const i = struct.memberNames.indexOf(memberName);
559
476
  const memberSchema = struct.memberList[i];
560
- return this.memberFrom(Array.isArray(memberSchema) ? memberSchema : [memberSchema, 0], member);
477
+ return member(Array.isArray(memberSchema) ? memberSchema : [memberSchema, 0], memberName);
561
478
  }
562
479
  if (this.isDocumentSchema()) {
563
- return this.memberFrom([SCHEMA.DOCUMENT, 0], member);
480
+ return member([15, 0], memberName);
564
481
  }
565
- throw new Error(`@smithy/core/schema - ${this.getName(true)} has no members.`);
482
+ throw new Error(`@smithy/core/schema - ${this.getName(true)} has no no member=${memberName}.`);
566
483
  }
567
484
  getMemberSchemas() {
568
485
  const buffer = {};
@@ -593,39 +510,52 @@ class NormalizedSchema {
593
510
  }
594
511
  const struct = this.getSchema();
595
512
  for (let i = 0; i < struct.memberNames.length; ++i) {
596
- yield [struct.memberNames[i], this.memberFrom([struct.memberList[i], 0], struct.memberNames[i])];
513
+ yield [struct.memberNames[i], member([struct.memberList[i], 0], struct.memberNames[i])];
597
514
  }
598
515
  }
599
- memberFrom(memberSchema, memberName) {
600
- if (memberSchema instanceof NormalizedSchema) {
601
- return Object.assign(memberSchema, {
602
- memberName,
603
- _isMemberSchema: true,
604
- });
605
- }
606
- return new NormalizedSchema(memberSchema, memberName);
607
- }
608
- getSchemaName() {
609
- const schema = this.getSchema();
610
- if (typeof schema === "number") {
611
- const _schema = 0b0011_1111 & schema;
612
- const container = 0b1100_0000 & schema;
613
- const type = Object.entries(SCHEMA).find(([, value]) => {
614
- return value === _schema;
615
- })?.[0] ?? "Unknown";
616
- switch (container) {
617
- case SCHEMA.MAP_MODIFIER:
618
- return `${type}Map`;
619
- case SCHEMA.LIST_MODIFIER:
620
- return `${type}List`;
621
- case 0:
622
- return type;
623
- }
624
- }
625
- return "Unknown";
516
+ }
517
+ function member(memberSchema, memberName) {
518
+ if (memberSchema instanceof NormalizedSchema) {
519
+ return Object.assign(memberSchema, {
520
+ memberName,
521
+ _isMemberSchema: true,
522
+ });
626
523
  }
524
+ const internalCtorAccess = NormalizedSchema;
525
+ return new internalCtorAccess(memberSchema, memberName);
627
526
  }
628
527
 
528
+ class SimpleSchema extends Schema {
529
+ static symbol = Symbol.for("@smithy/sim");
530
+ name;
531
+ schemaRef;
532
+ traits;
533
+ symbol = SimpleSchema.symbol;
534
+ }
535
+ const sim = (namespace, name, schemaRef, traits) => Schema.assign(new SimpleSchema(), {
536
+ name,
537
+ namespace,
538
+ traits,
539
+ schemaRef,
540
+ });
541
+
542
+ const SCHEMA = {
543
+ BLOB: 0b0001_0101,
544
+ STREAMING_BLOB: 0b0010_1010,
545
+ BOOLEAN: 0b0000_0010,
546
+ STRING: 0b0000_0000,
547
+ NUMERIC: 0b0000_0001,
548
+ BIG_INTEGER: 0b0001_0001,
549
+ BIG_DECIMAL: 0b0001_0011,
550
+ DOCUMENT: 0b0000_1111,
551
+ TIMESTAMP_DEFAULT: 0b0000_0100,
552
+ TIMESTAMP_DATE_TIME: 0b0000_0101,
553
+ TIMESTAMP_HTTP_DATE: 0b0000_0110,
554
+ TIMESTAMP_EPOCH_SECONDS: 0b0000_0111,
555
+ LIST_MODIFIER: 0b0100_0000,
556
+ MAP_MODIFIER: 0b1000_0000,
557
+ };
558
+
629
559
  exports.ErrorSchema = ErrorSchema;
630
560
  exports.ListSchema = ListSchema;
631
561
  exports.MapSchema = MapSchema;
@@ -646,3 +576,4 @@ exports.op = op;
646
576
  exports.serializerMiddlewareOption = serializerMiddlewareOption;
647
577
  exports.sim = sim;
648
578
  exports.struct = struct;
579
+ exports.translateTraits = translateTraits;
@@ -269,7 +269,7 @@ const parseRfc3339DateTime = (value) => {
269
269
  const day = parseDateValue(dayStr, "day", 1, 31);
270
270
  return buildDate(year, month, day, { hours, minutes, seconds, fractionalMilliseconds });
271
271
  };
272
- const RFC3339_WITH_OFFSET = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/);
272
+ const RFC3339_WITH_OFFSET$1 = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/);
273
273
  const parseRfc3339DateTimeWithOffset = (value) => {
274
274
  if (value === null || value === undefined) {
275
275
  return undefined;
@@ -277,7 +277,7 @@ const parseRfc3339DateTimeWithOffset = (value) => {
277
277
  if (typeof value !== "string") {
278
278
  throw new TypeError("RFC-3339 date-times must be expressed as strings");
279
279
  }
280
- const match = RFC3339_WITH_OFFSET.exec(value);
280
+ const match = RFC3339_WITH_OFFSET$1.exec(value);
281
281
  if (!match) {
282
282
  throw new TypeError("Invalid RFC-3339 date-time value");
283
283
  }
@@ -291,9 +291,9 @@ const parseRfc3339DateTimeWithOffset = (value) => {
291
291
  }
292
292
  return date;
293
293
  };
294
- const IMF_FIXDATE = new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/);
295
- const RFC_850_DATE = new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/);
296
- const ASC_TIME = new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/);
294
+ const IMF_FIXDATE$1 = new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/);
295
+ const RFC_850_DATE$1 = new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/);
296
+ const ASC_TIME$1 = new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/);
297
297
  const parseRfc7231DateTime = (value) => {
298
298
  if (value === null || value === undefined) {
299
299
  return undefined;
@@ -301,12 +301,12 @@ const parseRfc7231DateTime = (value) => {
301
301
  if (typeof value !== "string") {
302
302
  throw new TypeError("RFC-7231 date-times must be expressed as strings");
303
303
  }
304
- let match = IMF_FIXDATE.exec(value);
304
+ let match = IMF_FIXDATE$1.exec(value);
305
305
  if (match) {
306
306
  const [_, dayStr, monthStr, yearStr, hours, minutes, seconds, fractionalMilliseconds] = match;
307
307
  return buildDate(strictParseShort(stripLeadingZeroes(yearStr)), parseMonthByShortName(monthStr), parseDateValue(dayStr, "day", 1, 31), { hours, minutes, seconds, fractionalMilliseconds });
308
308
  }
309
- match = RFC_850_DATE.exec(value);
309
+ match = RFC_850_DATE$1.exec(value);
310
310
  if (match) {
311
311
  const [_, dayStr, monthStr, yearStr, hours, minutes, seconds, fractionalMilliseconds] = match;
312
312
  return adjustRfc850Year(buildDate(parseTwoDigitYear(yearStr), parseMonthByShortName(monthStr), parseDateValue(dayStr, "day", 1, 31), {
@@ -316,7 +316,7 @@ const parseRfc7231DateTime = (value) => {
316
316
  fractionalMilliseconds,
317
317
  }));
318
318
  }
319
- match = ASC_TIME.exec(value);
319
+ match = ASC_TIME$1.exec(value);
320
320
  if (match) {
321
321
  const [_, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds, yearStr] = match;
322
322
  return buildDate(strictParseShort(stripLeadingZeroes(yearStr)), parseMonthByShortName(monthStr), parseDateValue(dayStr.trimLeft(), "day", 1, 31), { hours, minutes, seconds, fractionalMilliseconds });
@@ -457,6 +457,117 @@ function quoteHeader(part) {
457
457
  return part;
458
458
  }
459
459
 
460
+ const ddd = `(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?`;
461
+ const mmm = `(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)`;
462
+ const time = `(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?`;
463
+ const date = `(\\d?\\d)`;
464
+ const year = `(\\d{4})`;
465
+ const RFC3339_WITH_OFFSET = new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/);
466
+ const IMF_FIXDATE = new RegExp(`^${ddd}, ${date} ${mmm} ${year} ${time} GMT$`);
467
+ const RFC_850_DATE = new RegExp(`^${ddd}, ${date}-${mmm}-(\\d\\d) ${time} GMT$`);
468
+ const ASC_TIME = new RegExp(`^${ddd} ${mmm} ( [1-9]|\\d\\d) ${time} ${year}$`);
469
+ const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
470
+ const _parseEpochTimestamp = (value) => {
471
+ if (value == null) {
472
+ return void 0;
473
+ }
474
+ let num = NaN;
475
+ if (typeof value === "number") {
476
+ num = value;
477
+ }
478
+ else if (typeof value === "string") {
479
+ if (!/^-?\d*\.?\d+$/.test(value)) {
480
+ throw new TypeError(`parseEpochTimestamp - numeric string invalid.`);
481
+ }
482
+ num = Number.parseFloat(value);
483
+ }
484
+ else if (typeof value === "object" && value.tag === 1) {
485
+ num = value.value;
486
+ }
487
+ if (isNaN(num) || Math.abs(num) === Infinity) {
488
+ throw new TypeError("Epoch timestamps must be valid finite numbers.");
489
+ }
490
+ return new Date(Math.round(num * 1000));
491
+ };
492
+ const _parseRfc3339DateTimeWithOffset = (value) => {
493
+ if (value == null) {
494
+ return void 0;
495
+ }
496
+ if (typeof value !== "string") {
497
+ throw new TypeError("RFC3339 timestamps must be strings");
498
+ }
499
+ const matches = RFC3339_WITH_OFFSET.exec(value);
500
+ if (!matches) {
501
+ throw new TypeError(`Invalid RFC3339 timestamp format ${value}`);
502
+ }
503
+ const [, yearStr, monthStr, dayStr, hours, minutes, seconds, , ms, offsetStr] = matches;
504
+ range(monthStr, 1, 12);
505
+ range(dayStr, 1, 31);
506
+ range(hours, 0, 23);
507
+ range(minutes, 0, 59);
508
+ range(seconds, 0, 60);
509
+ const date = new Date();
510
+ date.setUTCFullYear(Number(yearStr), Number(monthStr) - 1, Number(dayStr));
511
+ date.setUTCHours(Number(hours));
512
+ date.setUTCMinutes(Number(minutes));
513
+ date.setUTCSeconds(Number(seconds));
514
+ date.setUTCMilliseconds(Number(ms) ? Math.round(parseFloat(`0.${ms}`) * 1000) : 0);
515
+ if (offsetStr.toUpperCase() != "Z") {
516
+ const [, sign, offsetH, offsetM] = /([+-])(\d\d):(\d\d)/.exec(offsetStr) || [void 0, "+", 0, 0];
517
+ const scalar = sign === "-" ? 1 : -1;
518
+ date.setTime(date.getTime() + scalar * (Number(offsetH) * 60 * 60 * 1000 + Number(offsetM) * 60 * 1000));
519
+ }
520
+ return date;
521
+ };
522
+ const _parseRfc7231DateTime = (value) => {
523
+ if (value == null) {
524
+ return void 0;
525
+ }
526
+ if (typeof value !== "string") {
527
+ throw new TypeError("RFC7231 timestamps must be strings.");
528
+ }
529
+ let day;
530
+ let month;
531
+ let year;
532
+ let hour;
533
+ let minute;
534
+ let second;
535
+ let fraction;
536
+ let matches;
537
+ if ((matches = IMF_FIXDATE.exec(value))) {
538
+ [, day, month, year, hour, minute, second, fraction] = matches;
539
+ }
540
+ else if ((matches = RFC_850_DATE.exec(value))) {
541
+ [, day, month, year, hour, minute, second, fraction] = matches;
542
+ year = (Number(year) + 1900).toString();
543
+ }
544
+ else if ((matches = ASC_TIME.exec(value))) {
545
+ [, month, day, hour, minute, second, fraction, year] = matches;
546
+ }
547
+ if (year && second) {
548
+ const date = new Date();
549
+ date.setUTCFullYear(Number(year));
550
+ date.setUTCMonth(months.indexOf(month));
551
+ range(day, 1, 31);
552
+ date.setUTCDate(Number(day));
553
+ range(hour, 0, 23);
554
+ date.setUTCHours(Number(hour));
555
+ range(minute, 0, 59);
556
+ date.setUTCMinutes(Number(minute));
557
+ range(second, 0, 60);
558
+ date.setUTCSeconds(Number(second));
559
+ date.setUTCMilliseconds(fraction ? Math.round(parseFloat(`0.${fraction}`) * 1000) : 0);
560
+ return date;
561
+ }
562
+ throw new TypeError(`Invalid RFC7231 date-time value ${value}.`);
563
+ };
564
+ function range(v, min, max) {
565
+ const _v = Number(v);
566
+ if (_v < min || _v > max) {
567
+ throw new Error(`Value ${_v} out of range [${min}, ${max}]`);
568
+ }
569
+ }
570
+
460
571
  function splitEvery(value, delimiter, numDelimiters) {
461
572
  if (numDelimiters <= 0 || !Number.isInteger(numDelimiters)) {
462
573
  throw new Error("Invalid number of delimiters (" + numDelimiters + ") for splitEvery.");
@@ -522,28 +633,15 @@ const splitHeader = (value) => {
522
633
  });
523
634
  };
524
635
 
636
+ const format = /^-?\d*(\.\d+)?$/;
525
637
  class NumericValue {
526
638
  string;
527
639
  type;
528
640
  constructor(string, type) {
529
641
  this.string = string;
530
642
  this.type = type;
531
- let dot = 0;
532
- for (let i = 0; i < string.length; ++i) {
533
- const char = string.charCodeAt(i);
534
- if (i === 0 && char === 45) {
535
- continue;
536
- }
537
- if (char === 46) {
538
- if (dot) {
539
- throw new Error("@smithy/core/serde - NumericValue must contain at most one decimal point.");
540
- }
541
- dot = 1;
542
- continue;
543
- }
544
- if (char < 48 || char > 57) {
545
- throw new Error(`@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".`);
546
- }
643
+ if (!format.test(string)) {
644
+ throw new Error(`@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".`);
547
645
  }
548
646
  }
549
647
  toString() {
@@ -554,16 +652,7 @@ class NumericValue {
554
652
  return false;
555
653
  }
556
654
  const _nv = object;
557
- const prototypeMatch = NumericValue.prototype.isPrototypeOf(object);
558
- if (prototypeMatch) {
559
- return prototypeMatch;
560
- }
561
- if (typeof _nv.string === "string" &&
562
- typeof _nv.type === "string" &&
563
- _nv.constructor?.name?.endsWith("NumericValue")) {
564
- return true;
565
- }
566
- return prototypeMatch;
655
+ return NumericValue.prototype.isPrototypeOf(object) || (_nv.type === "bigDecimal" && format.test(_nv.string));
567
656
  }
568
657
  }
569
658
  function nv(input) {
@@ -576,6 +665,9 @@ Object.defineProperty(exports, "generateIdempotencyToken", {
576
665
  });
577
666
  exports.LazyJsonString = LazyJsonString;
578
667
  exports.NumericValue = NumericValue;
668
+ exports._parseEpochTimestamp = _parseEpochTimestamp;
669
+ exports._parseRfc3339DateTimeWithOffset = _parseRfc3339DateTimeWithOffset;
670
+ exports._parseRfc7231DateTime = _parseRfc7231DateTime;
579
671
  exports.copyDocumentWithTransform = copyDocumentWithTransform;
580
672
  exports.dateToUtcString = dateToUtcString;
581
673
  exports.expectBoolean = expectBoolean;