@aws-sdk/core 3.973.2 → 3.973.4

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
@@ -572,46 +572,6 @@ class SerdeContextConfig {
572
572
  }
573
573
  }
574
574
 
575
- function* serializingStructIterator(ns, sourceObject) {
576
- if (ns.isUnitSchema()) {
577
- return;
578
- }
579
- const struct = ns.getSchema();
580
- for (let i = 0; i < struct[4].length; ++i) {
581
- const key = struct[4][i];
582
- const memberSchema = struct[5][i];
583
- const memberNs = new schema.NormalizedSchema([memberSchema, 0], key);
584
- if (!(key in sourceObject) && !memberNs.isIdempotencyToken()) {
585
- continue;
586
- }
587
- yield [key, memberNs];
588
- }
589
- }
590
- function* deserializingStructIterator(ns, sourceObject, nameTrait) {
591
- if (ns.isUnitSchema()) {
592
- return;
593
- }
594
- const struct = ns.getSchema();
595
- let keysRemaining = Object.keys(sourceObject).filter((k) => k !== "__type").length;
596
- for (let i = 0; i < struct[4].length; ++i) {
597
- if (keysRemaining === 0) {
598
- break;
599
- }
600
- const key = struct[4][i];
601
- const memberSchema = struct[5][i];
602
- const memberNs = new schema.NormalizedSchema([memberSchema, 0], key);
603
- let serializationKey = key;
604
- if (nameTrait) {
605
- serializationKey = memberNs.getMergedTraits()[nameTrait] ?? key;
606
- }
607
- if (!(serializationKey in sourceObject)) {
608
- continue;
609
- }
610
- yield [key, memberNs];
611
- keysRemaining -= 1;
612
- }
613
- }
614
-
615
575
  class UnionSerde {
616
576
  from;
617
577
  to;
@@ -739,7 +699,7 @@ class JsonShapeDeserializer extends SerdeContextConfig {
739
699
  if (union) {
740
700
  unionSerde = new UnionSerde(record, out);
741
701
  }
742
- for (const [memberName, memberSchema] of deserializingStructIterator(ns, record, jsonName ? "jsonName" : false)) {
702
+ for (const [memberName, memberSchema] of ns.structIterator()) {
743
703
  let fromKey = memberName;
744
704
  if (jsonName) {
745
705
  fromKey = memberSchema.getMergedTraits().jsonName ?? fromKey;
@@ -948,7 +908,7 @@ class JsonShapeSerializer extends SerdeContextConfig {
948
908
  if (jsonName) {
949
909
  nameMap = {};
950
910
  }
951
- for (const [memberName, memberSchema] of serializingStructIterator(ns, record)) {
911
+ for (const [memberName, memberSchema] of ns.structIterator()) {
952
912
  const serializableValue = this._write(memberSchema, record[memberName], ns);
953
913
  if (serializableValue !== undefined) {
954
914
  let targetKey = memberName;
@@ -1567,7 +1527,7 @@ class QueryShapeSerializer extends SerdeContextConfig {
1567
1527
  else if (ns.isStructSchema()) {
1568
1528
  if (value && typeof value === "object") {
1569
1529
  let didWriteMember = false;
1570
- for (const [memberName, member] of serializingStructIterator(ns, value)) {
1530
+ for (const [memberName, member] of ns.structIterator()) {
1571
1531
  if (value[memberName] == null && !member.isIdempotencyToken()) {
1572
1532
  continue;
1573
1533
  }
@@ -1868,7 +1828,7 @@ class XmlShapeSerializer extends SerdeContextConfig {
1868
1828
  }
1869
1829
  const structXmlNode = xmlBuilder.XmlNode.of(name);
1870
1830
  const [xmlnsAttr, xmlns] = this.getXmlnsAttribute(ns, parentXmlns);
1871
- for (const [memberName, memberSchema] of serializingStructIterator(ns, value)) {
1831
+ for (const [memberName, memberSchema] of ns.structIterator()) {
1872
1832
  const val = value[memberName];
1873
1833
  if (val != null || memberSchema.isIdempotencyToken()) {
1874
1834
  if (memberSchema.getMergedTraits().xmlAttribute) {
@@ -234,46 +234,6 @@ class SerdeContextConfig {
234
234
  }
235
235
  }
236
236
 
237
- function* serializingStructIterator(ns, sourceObject) {
238
- if (ns.isUnitSchema()) {
239
- return;
240
- }
241
- const struct = ns.getSchema();
242
- for (let i = 0; i < struct[4].length; ++i) {
243
- const key = struct[4][i];
244
- const memberSchema = struct[5][i];
245
- const memberNs = new schema.NormalizedSchema([memberSchema, 0], key);
246
- if (!(key in sourceObject) && !memberNs.isIdempotencyToken()) {
247
- continue;
248
- }
249
- yield [key, memberNs];
250
- }
251
- }
252
- function* deserializingStructIterator(ns, sourceObject, nameTrait) {
253
- if (ns.isUnitSchema()) {
254
- return;
255
- }
256
- const struct = ns.getSchema();
257
- let keysRemaining = Object.keys(sourceObject).filter((k) => k !== "__type").length;
258
- for (let i = 0; i < struct[4].length; ++i) {
259
- if (keysRemaining === 0) {
260
- break;
261
- }
262
- const key = struct[4][i];
263
- const memberSchema = struct[5][i];
264
- const memberNs = new schema.NormalizedSchema([memberSchema, 0], key);
265
- let serializationKey = key;
266
- if (nameTrait) {
267
- serializationKey = memberNs.getMergedTraits()[nameTrait] ?? key;
268
- }
269
- if (!(serializationKey in sourceObject)) {
270
- continue;
271
- }
272
- yield [key, memberNs];
273
- keysRemaining -= 1;
274
- }
275
- }
276
-
277
237
  class UnionSerde {
278
238
  from;
279
239
  to;
@@ -401,7 +361,7 @@ class JsonShapeDeserializer extends SerdeContextConfig {
401
361
  if (union) {
402
362
  unionSerde = new UnionSerde(record, out);
403
363
  }
404
- for (const [memberName, memberSchema] of deserializingStructIterator(ns, record, jsonName ? "jsonName" : false)) {
364
+ for (const [memberName, memberSchema] of ns.structIterator()) {
405
365
  let fromKey = memberName;
406
366
  if (jsonName) {
407
367
  fromKey = memberSchema.getMergedTraits().jsonName ?? fromKey;
@@ -610,7 +570,7 @@ class JsonShapeSerializer extends SerdeContextConfig {
610
570
  if (jsonName) {
611
571
  nameMap = {};
612
572
  }
613
- for (const [memberName, memberSchema] of serializingStructIterator(ns, record)) {
573
+ for (const [memberName, memberSchema] of ns.structIterator()) {
614
574
  const serializableValue = this._write(memberSchema, record[memberName], ns);
615
575
  if (serializableValue !== undefined) {
616
576
  let targetKey = memberName;
@@ -1229,7 +1189,7 @@ class QueryShapeSerializer extends SerdeContextConfig {
1229
1189
  else if (ns.isStructSchema()) {
1230
1190
  if (value && typeof value === "object") {
1231
1191
  let didWriteMember = false;
1232
- for (const [memberName, member] of serializingStructIterator(ns, value)) {
1192
+ for (const [memberName, member] of ns.structIterator()) {
1233
1193
  if (value[memberName] == null && !member.isIdempotencyToken()) {
1234
1194
  continue;
1235
1195
  }
@@ -1530,7 +1490,7 @@ class XmlShapeSerializer extends SerdeContextConfig {
1530
1490
  }
1531
1491
  const structXmlNode = xmlBuilder.XmlNode.of(name);
1532
1492
  const [xmlnsAttr, xmlns] = this.getXmlnsAttribute(ns, parentXmlns);
1533
- for (const [memberName, memberSchema] of serializingStructIterator(ns, value)) {
1493
+ for (const [memberName, memberSchema] of ns.structIterator()) {
1534
1494
  const val = value[memberName];
1535
1495
  if (val != null || memberSchema.isIdempotencyToken()) {
1536
1496
  if (memberSchema.getMergedTraits().xmlAttribute) {
@@ -3,7 +3,6 @@ import { NormalizedSchema } from "@smithy/core/schema";
3
3
  import { LazyJsonString, NumericValue, parseEpochTimestamp, parseRfc3339DateTimeWithOffset, parseRfc7231DateTime, } from "@smithy/core/serde";
4
4
  import { fromBase64 } from "@smithy/util-base64";
5
5
  import { SerdeContextConfig } from "../ConfigurableSerdeContext";
6
- import { deserializingStructIterator } from "../structIterator";
7
6
  import { UnionSerde } from "../UnionSerde";
8
7
  import { jsonReviver } from "./jsonReviver";
9
8
  import { parseJsonBody } from "./parseJsonBody";
@@ -36,7 +35,7 @@ export class JsonShapeDeserializer extends SerdeContextConfig {
36
35
  if (union) {
37
36
  unionSerde = new UnionSerde(record, out);
38
37
  }
39
- for (const [memberName, memberSchema] of deserializingStructIterator(ns, record, jsonName ? "jsonName" : false)) {
38
+ for (const [memberName, memberSchema] of ns.structIterator()) {
40
39
  let fromKey = memberName;
41
40
  if (jsonName) {
42
41
  fromKey = memberSchema.getMergedTraits().jsonName ?? fromKey;
@@ -3,7 +3,6 @@ import { NormalizedSchema } from "@smithy/core/schema";
3
3
  import { dateToUtcString, generateIdempotencyToken, LazyJsonString, NumericValue } from "@smithy/core/serde";
4
4
  import { toBase64 } from "@smithy/util-base64";
5
5
  import { SerdeContextConfig } from "../ConfigurableSerdeContext";
6
- import { serializingStructIterator } from "../structIterator";
7
6
  import { JsonReplacer } from "./jsonReplacer";
8
7
  export class JsonShapeSerializer extends SerdeContextConfig {
9
8
  settings;
@@ -49,7 +48,7 @@ export class JsonShapeSerializer extends SerdeContextConfig {
49
48
  if (jsonName) {
50
49
  nameMap = {};
51
50
  }
52
- for (const [memberName, memberSchema] of serializingStructIterator(ns, record)) {
51
+ for (const [memberName, memberSchema] of ns.structIterator()) {
53
52
  const serializableValue = this._write(memberSchema, record[memberName], ns);
54
53
  if (serializableValue !== undefined) {
55
54
  let targetKey = memberName;
@@ -3,7 +3,6 @@ import { NormalizedSchema } from "@smithy/core/schema";
3
3
  import { dateToUtcString, generateIdempotencyToken, LazyJsonString, NumericValue } from "@smithy/core/serde";
4
4
  import { toBase64 } from "@smithy/util-base64";
5
5
  import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
6
- import { serializingStructIterator } from "../../structIterator";
7
6
  export class SinglePassJsonShapeSerializer extends SerdeContextConfig {
8
7
  settings;
9
8
  buffer;
@@ -46,7 +45,7 @@ export class SinglePassJsonShapeSerializer extends SerdeContextConfig {
46
45
  else if (ns.isStructSchema()) {
47
46
  b += "{";
48
47
  let didWriteMember = false;
49
- for (const [name, member] of serializingStructIterator(ns, value)) {
48
+ for (const [name, member] of ns.structIterator()) {
50
49
  const item = value[name];
51
50
  const targetKey = this.settings.jsonName ? member.getMergedTraits().jsonName ?? name : name;
52
51
  const serializableValue = this.writeValue(member, item);
@@ -4,7 +4,6 @@ import { generateIdempotencyToken, NumericValue } from "@smithy/core/serde";
4
4
  import { dateToUtcString } from "@smithy/smithy-client";
5
5
  import { toBase64 } from "@smithy/util-base64";
6
6
  import { SerdeContextConfig } from "../ConfigurableSerdeContext";
7
- import { serializingStructIterator } from "../structIterator";
8
7
  export class QueryShapeSerializer extends SerdeContextConfig {
9
8
  settings;
10
9
  buffer;
@@ -130,7 +129,7 @@ export class QueryShapeSerializer extends SerdeContextConfig {
130
129
  else if (ns.isStructSchema()) {
131
130
  if (value && typeof value === "object") {
132
131
  let didWriteMember = false;
133
- for (const [memberName, member] of serializingStructIterator(ns, value)) {
132
+ for (const [memberName, member] of ns.structIterator()) {
134
133
  if (value[memberName] == null && !member.isIdempotencyToken()) {
135
134
  continue;
136
135
  }
@@ -5,7 +5,6 @@ import { generateIdempotencyToken, NumericValue } from "@smithy/core/serde";
5
5
  import { dateToUtcString } from "@smithy/smithy-client";
6
6
  import { fromBase64, toBase64 } from "@smithy/util-base64";
7
7
  import { SerdeContextConfig } from "../ConfigurableSerdeContext";
8
- import { serializingStructIterator } from "../structIterator";
9
8
  export class XmlShapeSerializer extends SerdeContextConfig {
10
9
  settings;
11
10
  stringBuffer;
@@ -64,7 +63,7 @@ export class XmlShapeSerializer extends SerdeContextConfig {
64
63
  }
65
64
  const structXmlNode = XmlNode.of(name);
66
65
  const [xmlnsAttr, xmlns] = this.getXmlnsAttribute(ns, parentXmlns);
67
- for (const [memberName, memberSchema] of serializingStructIterator(ns, value)) {
66
+ for (const [memberName, memberSchema] of ns.structIterator()) {
68
67
  const val = value[memberName];
69
68
  if (val != null || memberSchema.isIdempotencyToken()) {
70
69
  if (memberSchema.getMergedTraits().xmlAttribute) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/core",
3
- "version": "3.973.2",
3
+ "version": "3.973.4",
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",
@@ -83,12 +83,12 @@
83
83
  "dependencies": {
84
84
  "@aws-sdk/types": "^3.973.1",
85
85
  "@aws-sdk/xml-builder": "^3.972.2",
86
- "@smithy/core": "^3.21.1",
86
+ "@smithy/core": "^3.22.0",
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.12",
91
+ "@smithy/smithy-client": "^4.11.1",
92
92
  "@smithy/types": "^4.12.0",
93
93
  "@smithy/util-base64": "^4.3.0",
94
94
  "@smithy/util-middleware": "^4.2.8",
@@ -1,40 +0,0 @@
1
- import { NormalizedSchema } from "@smithy/core/schema";
2
- export function* serializingStructIterator(ns, sourceObject) {
3
- if (ns.isUnitSchema()) {
4
- return;
5
- }
6
- const struct = ns.getSchema();
7
- for (let i = 0; i < struct[4].length; ++i) {
8
- const key = struct[4][i];
9
- const memberSchema = struct[5][i];
10
- const memberNs = new NormalizedSchema([memberSchema, 0], key);
11
- if (!(key in sourceObject) && !memberNs.isIdempotencyToken()) {
12
- continue;
13
- }
14
- yield [key, memberNs];
15
- }
16
- }
17
- export function* deserializingStructIterator(ns, sourceObject, nameTrait) {
18
- if (ns.isUnitSchema()) {
19
- return;
20
- }
21
- const struct = ns.getSchema();
22
- let keysRemaining = Object.keys(sourceObject).filter((k) => k !== "__type").length;
23
- for (let i = 0; i < struct[4].length; ++i) {
24
- if (keysRemaining === 0) {
25
- break;
26
- }
27
- const key = struct[4][i];
28
- const memberSchema = struct[5][i];
29
- const memberNs = new NormalizedSchema([memberSchema, 0], key);
30
- let serializationKey = key;
31
- if (nameTrait) {
32
- serializationKey = memberNs.getMergedTraits()[nameTrait] ?? key;
33
- }
34
- if (!(serializationKey in sourceObject)) {
35
- continue;
36
- }
37
- yield [key, memberNs];
38
- keysRemaining -= 1;
39
- }
40
- }
@@ -1,27 +0,0 @@
1
- import { NormalizedSchema } from "@smithy/core/schema";
2
- /**
3
- * @internal
4
- */
5
- type SourceObject = Record<string, any>;
6
- /**
7
- * For serialization use only.
8
- * @internal
9
- *
10
- * @param ns - normalized schema object.
11
- * @param sourceObject - source object from serialization.
12
- */
13
- export declare function serializingStructIterator(ns: NormalizedSchema, sourceObject: SourceObject): Generator<any[], void, unknown>;
14
- /**
15
- * For deserialization use only.
16
- * Yields a subset of NormalizedSchema::structIterator matched to the source object keys.
17
- * This is a performance optimization to avoid creation of NormalizedSchema member
18
- * objects for members that are undefined in the source data object but may be numerous
19
- * in the schema/model.
20
- * @internal
21
- *
22
- * @param ns - normalized schema object.
23
- * @param sourceObject - source object from deserialization.
24
- * @param nameTrait - xmlName or jsonName trait to look for.
25
- */
26
- export declare function deserializingStructIterator(ns: NormalizedSchema, sourceObject: SourceObject, nameTrait?: "xmlName" | "jsonName" | false): Generator<any[], void, unknown>;
27
- export {};
@@ -1,12 +0,0 @@
1
- import { NormalizedSchema } from "@smithy/core/schema";
2
- type SourceObject = Record<string, any>;
3
- export declare function serializingStructIterator(
4
- ns: NormalizedSchema,
5
- sourceObject: SourceObject
6
- ): Generator<any[], void, unknown>;
7
- export declare function deserializingStructIterator(
8
- ns: NormalizedSchema,
9
- sourceObject: SourceObject,
10
- nameTrait?: "xmlName" | "jsonName" | false
11
- ): Generator<any[], void, unknown>;
12
- export {};