@cdk8s/awscdk-resolver 0.0.419 → 0.0.421
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/.jsii +3 -3
- package/lib/resolve.js +1 -1
- package/node_modules/@aws/lambda-invoke-store/dist-cjs/invoke-store.js +1 -6
- package/node_modules/@aws/lambda-invoke-store/dist-es/invoke-store.js +1 -6
- package/node_modules/@aws/lambda-invoke-store/package.json +1 -1
- package/node_modules/@aws-sdk/client-cloudformation/package.json +5 -5
- package/node_modules/@aws-sdk/client-sso/package.json +4 -4
- package/node_modules/@aws-sdk/core/dist-cjs/index.js +124 -92
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +124 -92
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsJson1_0Protocol.js +2 -1
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsJson1_1Protocol.js +2 -1
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsJsonRpcProtocol.js +10 -8
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeDeserializer.js +30 -26
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeSerializer.js +75 -53
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/structIterator.js +5 -3
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJson1_0Protocol.d.ts +3 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJson1_1Protocol.d.ts +3 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +2 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/JsonShapeDeserializer.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/JsonShapeSerializer.d.ts +12 -3
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJson1_0Protocol.d.ts +3 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJson1_1Protocol.d.ts +3 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +2 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/JsonShapeDeserializer.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/JsonShapeSerializer.d.ts +9 -3
- package/node_modules/@aws-sdk/core/package.json +1 -1
- package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-http/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
- package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
- package/node_modules/@aws-sdk/middleware-user-agent/package.json +2 -2
- package/node_modules/@aws-sdk/nested-clients/package.json +4 -4
- package/node_modules/@aws-sdk/token-providers/package.json +3 -3
- package/node_modules/@aws-sdk/util-user-agent-node/package.json +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +10 -3
- package/node_modules/@smithy/core/dist-es/submodules/cbor/CborCodec.js +10 -3
- package/node_modules/@smithy/core/package.json +1 -1
- package/node_modules/@smithy/middleware-endpoint/package.json +2 -2
- package/node_modules/@smithy/middleware-retry/package.json +2 -2
- package/node_modules/@smithy/smithy-client/package.json +3 -3
- package/node_modules/@smithy/util-defaults-mode-browser/package.json +2 -2
- package/node_modules/@smithy/util-defaults-mode-node/package.json +2 -2
- package/package.json +3 -3
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/CHANGELOG.md +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/LICENSE +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/README.md +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/lib/fxbuilder.min.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/lib/fxbuilder.min.js.map +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/lib/fxp.cjs +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/lib/fxp.d.cts +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/lib/fxp.min.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/lib/fxp.min.js.map +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/lib/fxparser.min.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/lib/fxparser.min.js.map +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/lib/fxvalidator.min.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/lib/fxvalidator.min.js.map +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/package.json +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/cli/cli.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/cli/man.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/cli/read.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/fxp.d.ts +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/fxp.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/ignoreAttributes.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/util.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/CharsSymbol.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/EntitiesParser.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/OptionsBuilder.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/OutputBuilders/BaseOutputBuilder.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/OutputBuilders/JsArrBuilder.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/OutputBuilders/JsMinArrBuilder.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/OutputBuilders/JsObjBuilder.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/OutputBuilders/ParserOptionsBuilder.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/Report.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/TagPath.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/TagPathMatcher.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/XMLParser.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/Xml2JsParser.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/XmlPartReader.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/XmlSpecialTagsReader.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/inputSource/BufferSource.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/inputSource/StringSource.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/valueParsers/EntitiesParser.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/valueParsers/booleanParser.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/valueParsers/booleanParserExt.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/valueParsers/currency.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/valueParsers/join.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/valueParsers/number.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/v6/valueParsers/trim.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/validator.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/xmlbuilder/json2xml.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/xmlbuilder/orderedJs2Xml.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/xmlbuilder/prettifyJs2Xml.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/xmlparser/DocTypeReader.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/xmlparser/OptionsBuilder.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/xmlparser/OrderedObjParser.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/xmlparser/XMLParser.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/xmlparser/node2json.js +0 -0
- /package/node_modules/{fast-xml-parser → @aws-sdk/xml-builder/node_modules/fast-xml-parser}/src/xmlparser/xmlNode.js +0 -0
|
@@ -216,7 +216,8 @@ function* serializingStructIterator(ns, sourceObject) {
|
|
|
216
216
|
const struct = ns.getSchema();
|
|
217
217
|
for (let i = 0; i < struct[4].length; ++i) {
|
|
218
218
|
const key = struct[4][i];
|
|
219
|
-
const
|
|
219
|
+
const memberSchema = struct[5][i];
|
|
220
|
+
const memberNs = new schema.NormalizedSchema([memberSchema, 0], key);
|
|
220
221
|
if (!(key in sourceObject) && !memberNs.isIdempotencyToken()) {
|
|
221
222
|
continue;
|
|
222
223
|
}
|
|
@@ -228,13 +229,14 @@ function* deserializingStructIterator(ns, sourceObject, nameTrait) {
|
|
|
228
229
|
return;
|
|
229
230
|
}
|
|
230
231
|
const struct = ns.getSchema();
|
|
231
|
-
let keysRemaining = Object.keys(sourceObject).length;
|
|
232
|
+
let keysRemaining = Object.keys(sourceObject).filter((k) => k !== "__type").length;
|
|
232
233
|
for (let i = 0; i < struct[4].length; ++i) {
|
|
233
234
|
if (keysRemaining === 0) {
|
|
234
235
|
break;
|
|
235
236
|
}
|
|
236
237
|
const key = struct[4][i];
|
|
237
|
-
const
|
|
238
|
+
const memberSchema = struct[5][i];
|
|
239
|
+
const memberNs = new schema.NormalizedSchema([memberSchema, 0], key);
|
|
238
240
|
let serializationKey = key;
|
|
239
241
|
if (nameTrait) {
|
|
240
242
|
serializationKey = memberNs.getMergedTraits()[nameTrait] ?? key;
|
|
@@ -336,38 +338,40 @@ class JsonShapeDeserializer extends SerdeContextConfig {
|
|
|
336
338
|
_read(schema$1, value) {
|
|
337
339
|
const isObject = value !== null && typeof value === "object";
|
|
338
340
|
const ns = schema.NormalizedSchema.of(schema$1);
|
|
339
|
-
if (
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
341
|
+
if (isObject) {
|
|
342
|
+
if (ns.isStructSchema()) {
|
|
343
|
+
const out = {};
|
|
344
|
+
for (const [memberName, memberSchema] of deserializingStructIterator(ns, value, this.settings.jsonName ? "jsonName" : false)) {
|
|
345
|
+
const fromKey = this.settings.jsonName ? memberSchema.getMergedTraits().jsonName ?? memberName : memberName;
|
|
346
|
+
const deserializedValue = this._read(memberSchema, value[fromKey]);
|
|
347
|
+
if (deserializedValue != null) {
|
|
348
|
+
out[memberName] = deserializedValue;
|
|
349
|
+
}
|
|
346
350
|
}
|
|
351
|
+
return out;
|
|
347
352
|
}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
out[_k] = this._read(mapMember, _v);
|
|
353
|
+
if (Array.isArray(value) && ns.isListSchema()) {
|
|
354
|
+
const listMember = ns.getValueSchema();
|
|
355
|
+
const out = [];
|
|
356
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
|
357
|
+
for (const item of value) {
|
|
358
|
+
if (sparse || item != null) {
|
|
359
|
+
out.push(this._read(listMember, item));
|
|
360
|
+
}
|
|
357
361
|
}
|
|
362
|
+
return out;
|
|
358
363
|
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
out[memberName] = deserializedValue;
|
|
364
|
+
if (ns.isMapSchema()) {
|
|
365
|
+
const mapMember = ns.getValueSchema();
|
|
366
|
+
const out = {};
|
|
367
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
|
368
|
+
for (const [_k, _v] of Object.entries(value)) {
|
|
369
|
+
if (sparse || _v != null) {
|
|
370
|
+
out[_k] = this._read(mapMember, _v);
|
|
371
|
+
}
|
|
368
372
|
}
|
|
373
|
+
return out;
|
|
369
374
|
}
|
|
370
|
-
return out;
|
|
371
375
|
}
|
|
372
376
|
if (ns.isBlobSchema() && typeof value === "string") {
|
|
373
377
|
return utilBase64.fromBase64(value);
|
|
@@ -378,6 +382,7 @@ class JsonShapeDeserializer extends SerdeContextConfig {
|
|
|
378
382
|
if (isJson) {
|
|
379
383
|
return serde.LazyJsonString.from(value);
|
|
380
384
|
}
|
|
385
|
+
return value;
|
|
381
386
|
}
|
|
382
387
|
if (ns.isTimestampSchema() && value != null) {
|
|
383
388
|
const format = protocols.determineTimestampFormat(ns, this.settings);
|
|
@@ -415,6 +420,7 @@ class JsonShapeDeserializer extends SerdeContextConfig {
|
|
|
415
420
|
case "NaN":
|
|
416
421
|
return NaN;
|
|
417
422
|
}
|
|
423
|
+
return value;
|
|
418
424
|
}
|
|
419
425
|
if (ns.isDocumentSchema()) {
|
|
420
426
|
if (isObject) {
|
|
@@ -486,6 +492,7 @@ class JsonReplacer {
|
|
|
486
492
|
class JsonShapeSerializer extends SerdeContextConfig {
|
|
487
493
|
settings;
|
|
488
494
|
buffer;
|
|
495
|
+
useReplacer = false;
|
|
489
496
|
rootSchema;
|
|
490
497
|
constructor(settings) {
|
|
491
498
|
super();
|
|
@@ -502,9 +509,13 @@ class JsonShapeSerializer extends SerdeContextConfig {
|
|
|
502
509
|
}
|
|
503
510
|
}
|
|
504
511
|
flush() {
|
|
505
|
-
const { rootSchema } = this;
|
|
512
|
+
const { rootSchema, useReplacer } = this;
|
|
506
513
|
this.rootSchema = undefined;
|
|
514
|
+
this.useReplacer = false;
|
|
507
515
|
if (rootSchema?.isStructSchema() || rootSchema?.isDocumentSchema()) {
|
|
516
|
+
if (!useReplacer) {
|
|
517
|
+
return JSON.stringify(this.buffer);
|
|
518
|
+
}
|
|
508
519
|
const replacer = new JsonReplacer();
|
|
509
520
|
return replacer.replaceInJson(JSON.stringify(this.buffer, replacer.createReplacer(), 0));
|
|
510
521
|
}
|
|
@@ -513,68 +524,68 @@ class JsonShapeSerializer extends SerdeContextConfig {
|
|
|
513
524
|
_write(schema$1, value, container) {
|
|
514
525
|
const isObject = value !== null && typeof value === "object";
|
|
515
526
|
const ns = schema.NormalizedSchema.of(schema$1);
|
|
516
|
-
if (
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
527
|
+
if (isObject) {
|
|
528
|
+
if (ns.isStructSchema()) {
|
|
529
|
+
const out = {};
|
|
530
|
+
for (const [memberName, memberSchema] of serializingStructIterator(ns, value)) {
|
|
531
|
+
const serializableValue = this._write(memberSchema, value[memberName], ns);
|
|
532
|
+
if (serializableValue !== undefined) {
|
|
533
|
+
const jsonName = memberSchema.getMergedTraits().jsonName;
|
|
534
|
+
const targetKey = this.settings.jsonName ? jsonName ?? memberName : memberName;
|
|
535
|
+
out[targetKey] = serializableValue;
|
|
536
|
+
}
|
|
523
537
|
}
|
|
538
|
+
return out;
|
|
524
539
|
}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
out[_k] = this._write(mapMember, _v);
|
|
540
|
+
if (Array.isArray(value) && ns.isListSchema()) {
|
|
541
|
+
const listMember = ns.getValueSchema();
|
|
542
|
+
const out = [];
|
|
543
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
|
544
|
+
for (const item of value) {
|
|
545
|
+
if (sparse || item != null) {
|
|
546
|
+
out.push(this._write(listMember, item));
|
|
547
|
+
}
|
|
534
548
|
}
|
|
549
|
+
return out;
|
|
535
550
|
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
out[targetKey] = serializableValue;
|
|
551
|
+
if (ns.isMapSchema()) {
|
|
552
|
+
const mapMember = ns.getValueSchema();
|
|
553
|
+
const out = {};
|
|
554
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
|
555
|
+
for (const [_k, _v] of Object.entries(value)) {
|
|
556
|
+
if (sparse || _v != null) {
|
|
557
|
+
out[_k] = this._write(mapMember, _v);
|
|
558
|
+
}
|
|
545
559
|
}
|
|
560
|
+
return out;
|
|
546
561
|
}
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
if ((ns.isBlobSchema() && (value instanceof Uint8Array || typeof value === "string")) ||
|
|
553
|
-
(ns.isDocumentSchema() && value instanceof Uint8Array)) {
|
|
554
|
-
if (ns === this.rootSchema) {
|
|
555
|
-
return value;
|
|
562
|
+
if (value instanceof Uint8Array && (ns.isBlobSchema() || ns.isDocumentSchema())) {
|
|
563
|
+
if (ns === this.rootSchema) {
|
|
564
|
+
return value;
|
|
565
|
+
}
|
|
566
|
+
return (this.serdeContext?.base64Encoder ?? utilBase64.toBase64)(value);
|
|
556
567
|
}
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
return value.getTime() / 1000;
|
|
568
|
+
if (value instanceof Date && (ns.isTimestampSchema() || ns.isDocumentSchema())) {
|
|
569
|
+
const format = protocols.determineTimestampFormat(ns, this.settings);
|
|
570
|
+
switch (format) {
|
|
571
|
+
case 5:
|
|
572
|
+
return value.toISOString().replace(".000Z", "Z");
|
|
573
|
+
case 6:
|
|
574
|
+
return serde.dateToUtcString(value);
|
|
575
|
+
case 7:
|
|
576
|
+
return value.getTime() / 1000;
|
|
577
|
+
default:
|
|
578
|
+
console.warn("Missing timestamp format, using epoch seconds", value);
|
|
579
|
+
return value.getTime() / 1000;
|
|
580
|
+
}
|
|
571
581
|
}
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
if (Math.abs(value) === Infinity || isNaN(value)) {
|
|
575
|
-
return String(value);
|
|
582
|
+
if (value instanceof serde.NumericValue) {
|
|
583
|
+
this.useReplacer = true;
|
|
576
584
|
}
|
|
577
585
|
}
|
|
586
|
+
if (value === null && container?.isStructSchema()) {
|
|
587
|
+
return void 0;
|
|
588
|
+
}
|
|
578
589
|
if (ns.isStringSchema()) {
|
|
579
590
|
if (typeof value === "undefined" && ns.isIdempotencyToken()) {
|
|
580
591
|
return serde.generateIdempotencyToken();
|
|
@@ -586,12 +597,29 @@ class JsonShapeSerializer extends SerdeContextConfig {
|
|
|
586
597
|
return serde.LazyJsonString.from(value);
|
|
587
598
|
}
|
|
588
599
|
}
|
|
600
|
+
return value;
|
|
601
|
+
}
|
|
602
|
+
if (typeof value === "number" && ns.isNumericSchema()) {
|
|
603
|
+
if (Math.abs(value) === Infinity || isNaN(value)) {
|
|
604
|
+
return String(value);
|
|
605
|
+
}
|
|
606
|
+
return value;
|
|
607
|
+
}
|
|
608
|
+
if (typeof value === "string" && ns.isBlobSchema()) {
|
|
609
|
+
if (ns === this.rootSchema) {
|
|
610
|
+
return value;
|
|
611
|
+
}
|
|
612
|
+
return (this.serdeContext?.base64Encoder ?? utilBase64.toBase64)(value);
|
|
613
|
+
}
|
|
614
|
+
if (typeof value === "bigint") {
|
|
615
|
+
this.useReplacer = true;
|
|
589
616
|
}
|
|
590
617
|
if (ns.isDocumentSchema()) {
|
|
591
618
|
if (isObject) {
|
|
592
619
|
const out = Array.isArray(value) ? [] : {};
|
|
593
620
|
for (const [k, v] of Object.entries(value)) {
|
|
594
621
|
if (v instanceof serde.NumericValue) {
|
|
622
|
+
this.useReplacer = true;
|
|
595
623
|
out[k] = v;
|
|
596
624
|
}
|
|
597
625
|
else {
|
|
@@ -633,18 +661,20 @@ class AwsJsonRpcProtocol extends protocols.RpcProtocol {
|
|
|
633
661
|
codec;
|
|
634
662
|
mixin;
|
|
635
663
|
awsQueryCompatible;
|
|
636
|
-
constructor({ defaultNamespace, serviceTarget, awsQueryCompatible, }) {
|
|
664
|
+
constructor({ defaultNamespace, serviceTarget, awsQueryCompatible, jsonCodec, }) {
|
|
637
665
|
super({
|
|
638
666
|
defaultNamespace,
|
|
639
667
|
});
|
|
640
668
|
this.serviceTarget = serviceTarget;
|
|
641
|
-
this.codec =
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
669
|
+
this.codec =
|
|
670
|
+
jsonCodec ??
|
|
671
|
+
new JsonCodec({
|
|
672
|
+
timestampFormat: {
|
|
673
|
+
useTrait: true,
|
|
674
|
+
default: 7,
|
|
675
|
+
},
|
|
676
|
+
jsonName: false,
|
|
677
|
+
});
|
|
648
678
|
this.serializer = this.codec.createSerializer();
|
|
649
679
|
this.deserializer = this.codec.createDeserializer();
|
|
650
680
|
this.awsQueryCompatible = !!awsQueryCompatible;
|
|
@@ -696,11 +726,12 @@ class AwsJsonRpcProtocol extends protocols.RpcProtocol {
|
|
|
696
726
|
}
|
|
697
727
|
|
|
698
728
|
class AwsJson1_0Protocol extends AwsJsonRpcProtocol {
|
|
699
|
-
constructor({ defaultNamespace, serviceTarget, awsQueryCompatible, }) {
|
|
729
|
+
constructor({ defaultNamespace, serviceTarget, awsQueryCompatible, jsonCodec, }) {
|
|
700
730
|
super({
|
|
701
731
|
defaultNamespace,
|
|
702
732
|
serviceTarget,
|
|
703
733
|
awsQueryCompatible,
|
|
734
|
+
jsonCodec,
|
|
704
735
|
});
|
|
705
736
|
}
|
|
706
737
|
getShapeId() {
|
|
@@ -715,11 +746,12 @@ class AwsJson1_0Protocol extends AwsJsonRpcProtocol {
|
|
|
715
746
|
}
|
|
716
747
|
|
|
717
748
|
class AwsJson1_1Protocol extends AwsJsonRpcProtocol {
|
|
718
|
-
constructor({ defaultNamespace, serviceTarget, awsQueryCompatible, }) {
|
|
749
|
+
constructor({ defaultNamespace, serviceTarget, awsQueryCompatible, jsonCodec, }) {
|
|
719
750
|
super({
|
|
720
751
|
defaultNamespace,
|
|
721
752
|
serviceTarget,
|
|
722
753
|
awsQueryCompatible,
|
|
754
|
+
jsonCodec,
|
|
723
755
|
});
|
|
724
756
|
}
|
|
725
757
|
getShapeId() {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { AwsJsonRpcProtocol } from "./AwsJsonRpcProtocol";
|
|
2
2
|
export class AwsJson1_0Protocol extends AwsJsonRpcProtocol {
|
|
3
|
-
constructor({ defaultNamespace, serviceTarget, awsQueryCompatible, }) {
|
|
3
|
+
constructor({ defaultNamespace, serviceTarget, awsQueryCompatible, jsonCodec, }) {
|
|
4
4
|
super({
|
|
5
5
|
defaultNamespace,
|
|
6
6
|
serviceTarget,
|
|
7
7
|
awsQueryCompatible,
|
|
8
|
+
jsonCodec,
|
|
8
9
|
});
|
|
9
10
|
}
|
|
10
11
|
getShapeId() {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { AwsJsonRpcProtocol } from "./AwsJsonRpcProtocol";
|
|
2
2
|
export class AwsJson1_1Protocol extends AwsJsonRpcProtocol {
|
|
3
|
-
constructor({ defaultNamespace, serviceTarget, awsQueryCompatible, }) {
|
|
3
|
+
constructor({ defaultNamespace, serviceTarget, awsQueryCompatible, jsonCodec, }) {
|
|
4
4
|
super({
|
|
5
5
|
defaultNamespace,
|
|
6
6
|
serviceTarget,
|
|
7
7
|
awsQueryCompatible,
|
|
8
|
+
jsonCodec,
|
|
8
9
|
});
|
|
9
10
|
}
|
|
10
11
|
getShapeId() {
|
|
@@ -10,18 +10,20 @@ export class AwsJsonRpcProtocol extends RpcProtocol {
|
|
|
10
10
|
codec;
|
|
11
11
|
mixin;
|
|
12
12
|
awsQueryCompatible;
|
|
13
|
-
constructor({ defaultNamespace, serviceTarget, awsQueryCompatible, }) {
|
|
13
|
+
constructor({ defaultNamespace, serviceTarget, awsQueryCompatible, jsonCodec, }) {
|
|
14
14
|
super({
|
|
15
15
|
defaultNamespace,
|
|
16
16
|
});
|
|
17
17
|
this.serviceTarget = serviceTarget;
|
|
18
|
-
this.codec =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
this.codec =
|
|
19
|
+
jsonCodec ??
|
|
20
|
+
new JsonCodec({
|
|
21
|
+
timestampFormat: {
|
|
22
|
+
useTrait: true,
|
|
23
|
+
default: 7,
|
|
24
|
+
},
|
|
25
|
+
jsonName: false,
|
|
26
|
+
});
|
|
25
27
|
this.serializer = this.codec.createSerializer();
|
|
26
28
|
this.deserializer = this.codec.createDeserializer();
|
|
27
29
|
this.awsQueryCompatible = !!awsQueryCompatible;
|
package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeDeserializer.js
CHANGED
|
@@ -21,38 +21,40 @@ export class JsonShapeDeserializer extends SerdeContextConfig {
|
|
|
21
21
|
_read(schema, value) {
|
|
22
22
|
const isObject = value !== null && typeof value === "object";
|
|
23
23
|
const ns = NormalizedSchema.of(schema);
|
|
24
|
-
if (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
if (isObject) {
|
|
25
|
+
if (ns.isStructSchema()) {
|
|
26
|
+
const out = {};
|
|
27
|
+
for (const [memberName, memberSchema] of deserializingStructIterator(ns, value, this.settings.jsonName ? "jsonName" : false)) {
|
|
28
|
+
const fromKey = this.settings.jsonName ? memberSchema.getMergedTraits().jsonName ?? memberName : memberName;
|
|
29
|
+
const deserializedValue = this._read(memberSchema, value[fromKey]);
|
|
30
|
+
if (deserializedValue != null) {
|
|
31
|
+
out[memberName] = deserializedValue;
|
|
32
|
+
}
|
|
31
33
|
}
|
|
34
|
+
return out;
|
|
32
35
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
out[_k] = this._read(mapMember, _v);
|
|
36
|
+
if (Array.isArray(value) && ns.isListSchema()) {
|
|
37
|
+
const listMember = ns.getValueSchema();
|
|
38
|
+
const out = [];
|
|
39
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
|
40
|
+
for (const item of value) {
|
|
41
|
+
if (sparse || item != null) {
|
|
42
|
+
out.push(this._read(listMember, item));
|
|
43
|
+
}
|
|
42
44
|
}
|
|
45
|
+
return out;
|
|
43
46
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
out[memberName] = deserializedValue;
|
|
47
|
+
if (ns.isMapSchema()) {
|
|
48
|
+
const mapMember = ns.getValueSchema();
|
|
49
|
+
const out = {};
|
|
50
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
|
51
|
+
for (const [_k, _v] of Object.entries(value)) {
|
|
52
|
+
if (sparse || _v != null) {
|
|
53
|
+
out[_k] = this._read(mapMember, _v);
|
|
54
|
+
}
|
|
53
55
|
}
|
|
56
|
+
return out;
|
|
54
57
|
}
|
|
55
|
-
return out;
|
|
56
58
|
}
|
|
57
59
|
if (ns.isBlobSchema() && typeof value === "string") {
|
|
58
60
|
return fromBase64(value);
|
|
@@ -63,6 +65,7 @@ export class JsonShapeDeserializer extends SerdeContextConfig {
|
|
|
63
65
|
if (isJson) {
|
|
64
66
|
return LazyJsonString.from(value);
|
|
65
67
|
}
|
|
68
|
+
return value;
|
|
66
69
|
}
|
|
67
70
|
if (ns.isTimestampSchema() && value != null) {
|
|
68
71
|
const format = determineTimestampFormat(ns, this.settings);
|
|
@@ -100,6 +103,7 @@ export class JsonShapeDeserializer extends SerdeContextConfig {
|
|
|
100
103
|
case "NaN":
|
|
101
104
|
return NaN;
|
|
102
105
|
}
|
|
106
|
+
return value;
|
|
103
107
|
}
|
|
104
108
|
if (ns.isDocumentSchema()) {
|
|
105
109
|
if (isObject) {
|