@aws-sdk/core 3.969.0 → 3.972.0

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.
package/dist-cjs/index.js CHANGED
@@ -727,24 +727,42 @@ class JsonShapeDeserializer extends SerdeContextConfig {
727
727
  const ns = schema.NormalizedSchema.of(schema$1);
728
728
  if (isObject) {
729
729
  if (ns.isStructSchema()) {
730
+ const record = value;
730
731
  const union = ns.isUnionSchema();
731
732
  const out = {};
733
+ let nameMap = void 0;
734
+ const { jsonName } = this.settings;
735
+ if (jsonName) {
736
+ nameMap = {};
737
+ }
732
738
  let unionSerde;
733
739
  if (union) {
734
- unionSerde = new UnionSerde(value, out);
740
+ unionSerde = new UnionSerde(record, out);
735
741
  }
736
- for (const [memberName, memberSchema] of deserializingStructIterator(ns, value, this.settings.jsonName ? "jsonName" : false)) {
737
- const fromKey = this.settings.jsonName ? memberSchema.getMergedTraits().jsonName ?? memberName : memberName;
742
+ for (const [memberName, memberSchema] of deserializingStructIterator(ns, record, jsonName ? "jsonName" : false)) {
743
+ let fromKey = memberName;
744
+ if (jsonName) {
745
+ fromKey = memberSchema.getMergedTraits().jsonName ?? fromKey;
746
+ nameMap[fromKey] = memberName;
747
+ }
738
748
  if (union) {
739
749
  unionSerde.mark(fromKey);
740
750
  }
741
- if (value[fromKey] != null) {
742
- out[memberName] = this._read(memberSchema, value[fromKey]);
751
+ if (record[fromKey] != null) {
752
+ out[memberName] = this._read(memberSchema, record[fromKey]);
743
753
  }
744
754
  }
745
755
  if (union) {
746
756
  unionSerde.writeUnknown();
747
757
  }
758
+ else if (typeof record.__type === "string") {
759
+ for (const [k, v] of Object.entries(record)) {
760
+ const t = jsonName ? nameMap[k] ?? k : k;
761
+ if (!(t in out)) {
762
+ out[t] = v;
763
+ }
764
+ }
765
+ }
748
766
  return out;
749
767
  }
750
768
  if (Array.isArray(value) && ns.isListSchema()) {
@@ -923,22 +941,39 @@ class JsonShapeSerializer extends SerdeContextConfig {
923
941
  const ns = schema.NormalizedSchema.of(schema$1);
924
942
  if (isObject) {
925
943
  if (ns.isStructSchema()) {
944
+ const record = value;
926
945
  const out = {};
927
- for (const [memberName, memberSchema] of serializingStructIterator(ns, value)) {
928
- const serializableValue = this._write(memberSchema, value[memberName], ns);
946
+ const { jsonName } = this.settings;
947
+ let nameMap = void 0;
948
+ if (jsonName) {
949
+ nameMap = {};
950
+ }
951
+ for (const [memberName, memberSchema] of serializingStructIterator(ns, record)) {
952
+ const serializableValue = this._write(memberSchema, record[memberName], ns);
929
953
  if (serializableValue !== undefined) {
930
- const jsonName = memberSchema.getMergedTraits().jsonName;
931
- const targetKey = this.settings.jsonName ? jsonName ?? memberName : memberName;
954
+ let targetKey = memberName;
955
+ if (jsonName) {
956
+ targetKey = memberSchema.getMergedTraits().jsonName ?? memberName;
957
+ nameMap[memberName] = targetKey;
958
+ }
932
959
  out[targetKey] = serializableValue;
933
960
  }
934
961
  }
935
962
  if (ns.isUnionSchema() && Object.keys(out).length === 0) {
936
- const { $unknown } = value;
963
+ const { $unknown } = record;
937
964
  if (Array.isArray($unknown)) {
938
965
  const [k, v] = $unknown;
939
966
  out[k] = this._write(15, v);
940
967
  }
941
968
  }
969
+ else if (typeof record.__type === "string") {
970
+ for (const [k, v] of Object.entries(record)) {
971
+ const targetKey = jsonName ? nameMap[k] ?? k : k;
972
+ if (!(targetKey in out)) {
973
+ out[targetKey] = this._write(15, v);
974
+ }
975
+ }
976
+ }
942
977
  return out;
943
978
  }
944
979
  if (Array.isArray(value) && ns.isListSchema()) {
@@ -389,24 +389,42 @@ class JsonShapeDeserializer extends SerdeContextConfig {
389
389
  const ns = schema.NormalizedSchema.of(schema$1);
390
390
  if (isObject) {
391
391
  if (ns.isStructSchema()) {
392
+ const record = value;
392
393
  const union = ns.isUnionSchema();
393
394
  const out = {};
395
+ let nameMap = void 0;
396
+ const { jsonName } = this.settings;
397
+ if (jsonName) {
398
+ nameMap = {};
399
+ }
394
400
  let unionSerde;
395
401
  if (union) {
396
- unionSerde = new UnionSerde(value, out);
402
+ unionSerde = new UnionSerde(record, out);
397
403
  }
398
- for (const [memberName, memberSchema] of deserializingStructIterator(ns, value, this.settings.jsonName ? "jsonName" : false)) {
399
- const fromKey = this.settings.jsonName ? memberSchema.getMergedTraits().jsonName ?? memberName : memberName;
404
+ for (const [memberName, memberSchema] of deserializingStructIterator(ns, record, jsonName ? "jsonName" : false)) {
405
+ let fromKey = memberName;
406
+ if (jsonName) {
407
+ fromKey = memberSchema.getMergedTraits().jsonName ?? fromKey;
408
+ nameMap[fromKey] = memberName;
409
+ }
400
410
  if (union) {
401
411
  unionSerde.mark(fromKey);
402
412
  }
403
- if (value[fromKey] != null) {
404
- out[memberName] = this._read(memberSchema, value[fromKey]);
413
+ if (record[fromKey] != null) {
414
+ out[memberName] = this._read(memberSchema, record[fromKey]);
405
415
  }
406
416
  }
407
417
  if (union) {
408
418
  unionSerde.writeUnknown();
409
419
  }
420
+ else if (typeof record.__type === "string") {
421
+ for (const [k, v] of Object.entries(record)) {
422
+ const t = jsonName ? nameMap[k] ?? k : k;
423
+ if (!(t in out)) {
424
+ out[t] = v;
425
+ }
426
+ }
427
+ }
410
428
  return out;
411
429
  }
412
430
  if (Array.isArray(value) && ns.isListSchema()) {
@@ -585,22 +603,39 @@ class JsonShapeSerializer extends SerdeContextConfig {
585
603
  const ns = schema.NormalizedSchema.of(schema$1);
586
604
  if (isObject) {
587
605
  if (ns.isStructSchema()) {
606
+ const record = value;
588
607
  const out = {};
589
- for (const [memberName, memberSchema] of serializingStructIterator(ns, value)) {
590
- const serializableValue = this._write(memberSchema, value[memberName], ns);
608
+ const { jsonName } = this.settings;
609
+ let nameMap = void 0;
610
+ if (jsonName) {
611
+ nameMap = {};
612
+ }
613
+ for (const [memberName, memberSchema] of serializingStructIterator(ns, record)) {
614
+ const serializableValue = this._write(memberSchema, record[memberName], ns);
591
615
  if (serializableValue !== undefined) {
592
- const jsonName = memberSchema.getMergedTraits().jsonName;
593
- const targetKey = this.settings.jsonName ? jsonName ?? memberName : memberName;
616
+ let targetKey = memberName;
617
+ if (jsonName) {
618
+ targetKey = memberSchema.getMergedTraits().jsonName ?? memberName;
619
+ nameMap[memberName] = targetKey;
620
+ }
594
621
  out[targetKey] = serializableValue;
595
622
  }
596
623
  }
597
624
  if (ns.isUnionSchema() && Object.keys(out).length === 0) {
598
- const { $unknown } = value;
625
+ const { $unknown } = record;
599
626
  if (Array.isArray($unknown)) {
600
627
  const [k, v] = $unknown;
601
628
  out[k] = this._write(15, v);
602
629
  }
603
630
  }
631
+ else if (typeof record.__type === "string") {
632
+ for (const [k, v] of Object.entries(record)) {
633
+ const targetKey = jsonName ? nameMap[k] ?? k : k;
634
+ if (!(targetKey in out)) {
635
+ out[targetKey] = this._write(15, v);
636
+ }
637
+ }
638
+ }
604
639
  return out;
605
640
  }
606
641
  if (Array.isArray(value) && ns.isListSchema()) {
@@ -24,24 +24,42 @@ export class JsonShapeDeserializer extends SerdeContextConfig {
24
24
  const ns = NormalizedSchema.of(schema);
25
25
  if (isObject) {
26
26
  if (ns.isStructSchema()) {
27
+ const record = value;
27
28
  const union = ns.isUnionSchema();
28
29
  const out = {};
30
+ let nameMap = void 0;
31
+ const { jsonName } = this.settings;
32
+ if (jsonName) {
33
+ nameMap = {};
34
+ }
29
35
  let unionSerde;
30
36
  if (union) {
31
- unionSerde = new UnionSerde(value, out);
37
+ unionSerde = new UnionSerde(record, out);
32
38
  }
33
- for (const [memberName, memberSchema] of deserializingStructIterator(ns, value, this.settings.jsonName ? "jsonName" : false)) {
34
- const fromKey = this.settings.jsonName ? memberSchema.getMergedTraits().jsonName ?? memberName : memberName;
39
+ for (const [memberName, memberSchema] of deserializingStructIterator(ns, record, jsonName ? "jsonName" : false)) {
40
+ let fromKey = memberName;
41
+ if (jsonName) {
42
+ fromKey = memberSchema.getMergedTraits().jsonName ?? fromKey;
43
+ nameMap[fromKey] = memberName;
44
+ }
35
45
  if (union) {
36
46
  unionSerde.mark(fromKey);
37
47
  }
38
- if (value[fromKey] != null) {
39
- out[memberName] = this._read(memberSchema, value[fromKey]);
48
+ if (record[fromKey] != null) {
49
+ out[memberName] = this._read(memberSchema, record[fromKey]);
40
50
  }
41
51
  }
42
52
  if (union) {
43
53
  unionSerde.writeUnknown();
44
54
  }
55
+ else if (typeof record.__type === "string") {
56
+ for (const [k, v] of Object.entries(record)) {
57
+ const t = jsonName ? nameMap[k] ?? k : k;
58
+ if (!(t in out)) {
59
+ out[t] = v;
60
+ }
61
+ }
62
+ }
45
63
  return out;
46
64
  }
47
65
  if (Array.isArray(value) && ns.isListSchema()) {
@@ -42,22 +42,39 @@ export class JsonShapeSerializer extends SerdeContextConfig {
42
42
  const ns = NormalizedSchema.of(schema);
43
43
  if (isObject) {
44
44
  if (ns.isStructSchema()) {
45
+ const record = value;
45
46
  const out = {};
46
- for (const [memberName, memberSchema] of serializingStructIterator(ns, value)) {
47
- const serializableValue = this._write(memberSchema, value[memberName], ns);
47
+ const { jsonName } = this.settings;
48
+ let nameMap = void 0;
49
+ if (jsonName) {
50
+ nameMap = {};
51
+ }
52
+ for (const [memberName, memberSchema] of serializingStructIterator(ns, record)) {
53
+ const serializableValue = this._write(memberSchema, record[memberName], ns);
48
54
  if (serializableValue !== undefined) {
49
- const jsonName = memberSchema.getMergedTraits().jsonName;
50
- const targetKey = this.settings.jsonName ? jsonName ?? memberName : memberName;
55
+ let targetKey = memberName;
56
+ if (jsonName) {
57
+ targetKey = memberSchema.getMergedTraits().jsonName ?? memberName;
58
+ nameMap[memberName] = targetKey;
59
+ }
51
60
  out[targetKey] = serializableValue;
52
61
  }
53
62
  }
54
63
  if (ns.isUnionSchema() && Object.keys(out).length === 0) {
55
- const { $unknown } = value;
64
+ const { $unknown } = record;
56
65
  if (Array.isArray($unknown)) {
57
66
  const [k, v] = $unknown;
58
67
  out[k] = this._write(15, v);
59
68
  }
60
69
  }
70
+ else if (typeof record.__type === "string") {
71
+ for (const [k, v] of Object.entries(record)) {
72
+ const targetKey = jsonName ? nameMap[k] ?? k : k;
73
+ if (!(targetKey in out)) {
74
+ out[targetKey] = this._write(15, v);
75
+ }
76
+ }
77
+ }
61
78
  return out;
62
79
  }
63
80
  if (Array.isArray(value) && ns.isListSchema()) {
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@aws-sdk/core",
3
- "version": "3.969.0",
3
+ "version": "3.972.0",
4
4
  "description": "Core functions & classes shared by multiple AWS SDK clients.",
5
5
  "scripts": {
6
6
  "build": "yarn lint && concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
7
- "build:cjs": "node ../../scripts/compilation/inline core && rimraf ./dist-cjs/api-extractor-type-index.js",
8
- "build:es": "tsc -p tsconfig.es.json && rimraf ./dist-es/api-extractor-type-index.js",
7
+ "build:cjs": "node ../../scripts/compilation/inline core && premove ./dist-cjs/api-extractor-type-index.js",
8
+ "build:es": "tsc -p tsconfig.es.json && premove ./dist-es/api-extractor-type-index.js",
9
9
  "build:include:deps": "yarn g:turbo run build -F=\"$npm_package_name\"",
10
10
  "build:types": "tsc -p tsconfig.types.json",
11
11
  "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
12
12
  "lint": "node ../../scripts/validation/submodules-linter.js --pkg core",
13
- "clean": "rimraf ./dist-* && rimraf *.tsbuildinfo",
13
+ "clean": "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo",
14
14
  "extract:docs": "api-extractor run --local",
15
15
  "test": "yarn g:vitest run",
16
16
  "test:watch": "yarn g:vitest watch",
@@ -81,14 +81,14 @@
81
81
  },
82
82
  "license": "Apache-2.0",
83
83
  "dependencies": {
84
- "@aws-sdk/types": "3.969.0",
85
- "@aws-sdk/xml-builder": "3.969.0",
86
- "@smithy/core": "^3.20.5",
84
+ "@aws-sdk/types": "3.972.0",
85
+ "@aws-sdk/xml-builder": "3.972.0",
86
+ "@smithy/core": "^3.20.6",
87
87
  "@smithy/node-config-provider": "^4.3.8",
88
88
  "@smithy/property-provider": "^4.2.8",
89
89
  "@smithy/protocol-http": "^5.3.8",
90
90
  "@smithy/signature-v4": "^5.3.8",
91
- "@smithy/smithy-client": "^4.10.7",
91
+ "@smithy/smithy-client": "^4.10.8",
92
92
  "@smithy/types": "^4.12.0",
93
93
  "@smithy/util-base64": "^4.3.0",
94
94
  "@smithy/util-middleware": "^4.2.8",
@@ -99,7 +99,7 @@
99
99
  "@tsconfig/recommended": "1.0.1",
100
100
  "concurrently": "7.0.0",
101
101
  "downlevel-dts": "0.10.1",
102
- "rimraf": "5.0.10",
102
+ "premove": "4.0.0",
103
103
  "typescript": "~5.8.3"
104
104
  },
105
105
  "engines": {