@jjrawlins/cdk-iam-policy-builder-helper 0.0.110 → 0.0.112
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/cdkiampolicybuilderhelper/jsii/jsii.go +2 -2
- package/cdkiampolicybuilderhelper/version +1 -1
- package/node_modules/@aws-sdk/client-iam/dist-cjs/index.js +30 -30
- package/node_modules/@aws-sdk/client-iam/dist-es/schemas/schemas_0.js +30 -30
- package/node_modules/@aws-sdk/client-iam/package.json +34 -34
- package/node_modules/@aws-sdk/client-sso/package.json +32 -32
- package/node_modules/@aws-sdk/core/dist-cjs/index.js +97 -4
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +97 -4
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/UnionSerde.js +23 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeDeserializer.js +14 -3
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeSerializer.js +7 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/experimental/SinglePassJsonShapeSerializer.js +9 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/query/QueryShapeSerializer.js +26 -1
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/XmlShapeDeserializer.js +12 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/XmlShapeSerializer.js +16 -0
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/UnionSerde.d.ts +24 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/UnionSerde.d.ts +9 -0
- package/node_modules/@aws-sdk/core/package.json +11 -11
- package/node_modules/@aws-sdk/credential-provider-env/package.json +5 -5
- package/node_modules/@aws-sdk/credential-provider-http/package.json +10 -10
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +14 -14
- package/node_modules/@aws-sdk/credential-provider-login/package.json +8 -8
- package/node_modules/@aws-sdk/credential-provider-node/package.json +12 -12
- package/node_modules/@aws-sdk/credential-provider-process/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +8 -8
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +7 -7
- package/node_modules/@aws-sdk/middleware-host-header/package.json +4 -4
- package/node_modules/@aws-sdk/middleware-logger/package.json +3 -3
- package/node_modules/@aws-sdk/middleware-recursion-detection/package.json +4 -4
- package/node_modules/@aws-sdk/middleware-user-agent/package.json +7 -7
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +7 -7
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/schemas/schemas_0.js +7 -7
- package/node_modules/@aws-sdk/nested-clients/package.json +32 -32
- package/node_modules/@aws-sdk/region-config-resolver/package.json +5 -5
- package/node_modules/@aws-sdk/token-providers/package.json +7 -7
- package/node_modules/@aws-sdk/types/package.json +2 -2
- package/node_modules/@aws-sdk/util-endpoints/package.json +5 -5
- package/node_modules/@aws-sdk/util-user-agent-browser/package.json +3 -3
- package/node_modules/@aws-sdk/util-user-agent-node/package.json +5 -5
- package/node_modules/@aws-sdk/xml-builder/package.json +2 -2
- package/package.json +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/client-sso",
|
|
3
3
|
"description": "AWS SDK for JavaScript Sso Client for Node.js, Browser and React Native",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.956.0",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
|
|
7
7
|
"build:cjs": "node ../../scripts/compilation/inline client-sso",
|
|
@@ -21,40 +21,40 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@aws-crypto/sha256-browser": "5.2.0",
|
|
23
23
|
"@aws-crypto/sha256-js": "5.2.0",
|
|
24
|
-
"@aws-sdk/core": "3.
|
|
25
|
-
"@aws-sdk/middleware-host-header": "3.
|
|
26
|
-
"@aws-sdk/middleware-logger": "3.
|
|
27
|
-
"@aws-sdk/middleware-recursion-detection": "3.
|
|
28
|
-
"@aws-sdk/middleware-user-agent": "3.
|
|
29
|
-
"@aws-sdk/region-config-resolver": "3.
|
|
30
|
-
"@aws-sdk/types": "3.
|
|
31
|
-
"@aws-sdk/util-endpoints": "3.
|
|
32
|
-
"@aws-sdk/util-user-agent-browser": "3.
|
|
33
|
-
"@aws-sdk/util-user-agent-node": "3.
|
|
34
|
-
"@smithy/config-resolver": "^4.4.
|
|
35
|
-
"@smithy/core": "^3.
|
|
36
|
-
"@smithy/fetch-http-handler": "^5.3.
|
|
37
|
-
"@smithy/hash-node": "^4.2.
|
|
38
|
-
"@smithy/invalid-dependency": "^4.2.
|
|
39
|
-
"@smithy/middleware-content-length": "^4.2.
|
|
40
|
-
"@smithy/middleware-endpoint": "^4.4.
|
|
41
|
-
"@smithy/middleware-retry": "^4.4.
|
|
42
|
-
"@smithy/middleware-serde": "^4.2.
|
|
43
|
-
"@smithy/middleware-stack": "^4.2.
|
|
44
|
-
"@smithy/node-config-provider": "^4.3.
|
|
45
|
-
"@smithy/node-http-handler": "^4.4.
|
|
46
|
-
"@smithy/protocol-http": "^5.3.
|
|
47
|
-
"@smithy/smithy-client": "^4.10.
|
|
48
|
-
"@smithy/types": "^4.
|
|
49
|
-
"@smithy/url-parser": "^4.2.
|
|
24
|
+
"@aws-sdk/core": "3.956.0",
|
|
25
|
+
"@aws-sdk/middleware-host-header": "3.956.0",
|
|
26
|
+
"@aws-sdk/middleware-logger": "3.956.0",
|
|
27
|
+
"@aws-sdk/middleware-recursion-detection": "3.956.0",
|
|
28
|
+
"@aws-sdk/middleware-user-agent": "3.956.0",
|
|
29
|
+
"@aws-sdk/region-config-resolver": "3.956.0",
|
|
30
|
+
"@aws-sdk/types": "3.956.0",
|
|
31
|
+
"@aws-sdk/util-endpoints": "3.956.0",
|
|
32
|
+
"@aws-sdk/util-user-agent-browser": "3.956.0",
|
|
33
|
+
"@aws-sdk/util-user-agent-node": "3.956.0",
|
|
34
|
+
"@smithy/config-resolver": "^4.4.5",
|
|
35
|
+
"@smithy/core": "^3.20.0",
|
|
36
|
+
"@smithy/fetch-http-handler": "^5.3.8",
|
|
37
|
+
"@smithy/hash-node": "^4.2.7",
|
|
38
|
+
"@smithy/invalid-dependency": "^4.2.7",
|
|
39
|
+
"@smithy/middleware-content-length": "^4.2.7",
|
|
40
|
+
"@smithy/middleware-endpoint": "^4.4.1",
|
|
41
|
+
"@smithy/middleware-retry": "^4.4.17",
|
|
42
|
+
"@smithy/middleware-serde": "^4.2.8",
|
|
43
|
+
"@smithy/middleware-stack": "^4.2.7",
|
|
44
|
+
"@smithy/node-config-provider": "^4.3.7",
|
|
45
|
+
"@smithy/node-http-handler": "^4.4.7",
|
|
46
|
+
"@smithy/protocol-http": "^5.3.7",
|
|
47
|
+
"@smithy/smithy-client": "^4.10.2",
|
|
48
|
+
"@smithy/types": "^4.11.0",
|
|
49
|
+
"@smithy/url-parser": "^4.2.7",
|
|
50
50
|
"@smithy/util-base64": "^4.3.0",
|
|
51
51
|
"@smithy/util-body-length-browser": "^4.2.0",
|
|
52
52
|
"@smithy/util-body-length-node": "^4.2.1",
|
|
53
|
-
"@smithy/util-defaults-mode-browser": "^4.3.
|
|
54
|
-
"@smithy/util-defaults-mode-node": "^4.2.
|
|
55
|
-
"@smithy/util-endpoints": "^3.2.
|
|
56
|
-
"@smithy/util-middleware": "^4.2.
|
|
57
|
-
"@smithy/util-retry": "^4.2.
|
|
53
|
+
"@smithy/util-defaults-mode-browser": "^4.3.16",
|
|
54
|
+
"@smithy/util-defaults-mode-node": "^4.2.19",
|
|
55
|
+
"@smithy/util-endpoints": "^3.2.7",
|
|
56
|
+
"@smithy/util-middleware": "^4.2.7",
|
|
57
|
+
"@smithy/util-retry": "^4.2.7",
|
|
58
58
|
"@smithy/util-utf8": "^4.2.0",
|
|
59
59
|
"tslib": "^2.6.2"
|
|
60
60
|
},
|
|
@@ -604,6 +604,30 @@ function* deserializingStructIterator(ns, sourceObject, nameTrait) {
|
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
606
|
|
|
607
|
+
class UnionSerde {
|
|
608
|
+
from;
|
|
609
|
+
to;
|
|
610
|
+
keys;
|
|
611
|
+
constructor(from, to) {
|
|
612
|
+
this.from = from;
|
|
613
|
+
this.to = to;
|
|
614
|
+
this.keys = new Set(Object.keys(this.from).filter((k) => k !== "__type"));
|
|
615
|
+
}
|
|
616
|
+
mark(key) {
|
|
617
|
+
this.keys.delete(key);
|
|
618
|
+
}
|
|
619
|
+
hasUnknown() {
|
|
620
|
+
return this.keys.size === 1 && Object.keys(this.to).length === 0;
|
|
621
|
+
}
|
|
622
|
+
writeUnknown() {
|
|
623
|
+
if (this.hasUnknown()) {
|
|
624
|
+
const k = this.keys.values().next().value;
|
|
625
|
+
const v = this.from[k];
|
|
626
|
+
this.to.$unknown = [k, v];
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
|
|
607
631
|
function jsonReviver(key, value, context) {
|
|
608
632
|
if (context?.source) {
|
|
609
633
|
const numericString = context.source;
|
|
@@ -695,13 +719,23 @@ class JsonShapeDeserializer extends SerdeContextConfig {
|
|
|
695
719
|
const ns = schema.NormalizedSchema.of(schema$1);
|
|
696
720
|
if (isObject) {
|
|
697
721
|
if (ns.isStructSchema()) {
|
|
722
|
+
const union = ns.isUnionSchema();
|
|
698
723
|
const out = {};
|
|
724
|
+
let unionSerde;
|
|
725
|
+
if (union) {
|
|
726
|
+
unionSerde = new UnionSerde(value, out);
|
|
727
|
+
}
|
|
699
728
|
for (const [memberName, memberSchema] of deserializingStructIterator(ns, value, this.settings.jsonName ? "jsonName" : false)) {
|
|
700
729
|
const fromKey = this.settings.jsonName ? memberSchema.getMergedTraits().jsonName ?? memberName : memberName;
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
out[memberName] = deserializedValue;
|
|
730
|
+
if (union) {
|
|
731
|
+
unionSerde.mark(fromKey);
|
|
704
732
|
}
|
|
733
|
+
if (value[fromKey] != null) {
|
|
734
|
+
out[memberName] = this._read(memberSchema, value[fromKey]);
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
if (union) {
|
|
738
|
+
unionSerde.writeUnknown();
|
|
705
739
|
}
|
|
706
740
|
return out;
|
|
707
741
|
}
|
|
@@ -890,6 +924,13 @@ class JsonShapeSerializer extends SerdeContextConfig {
|
|
|
890
924
|
out[targetKey] = serializableValue;
|
|
891
925
|
}
|
|
892
926
|
}
|
|
927
|
+
if (ns.isUnionSchema() && Object.keys(out).length === 0) {
|
|
928
|
+
const { $unknown } = value;
|
|
929
|
+
if (Array.isArray($unknown)) {
|
|
930
|
+
const [k, v] = $unknown;
|
|
931
|
+
out[k] = this._write(15, v);
|
|
932
|
+
}
|
|
933
|
+
}
|
|
893
934
|
return out;
|
|
894
935
|
}
|
|
895
936
|
if (Array.isArray(value) && ns.isListSchema()) {
|
|
@@ -1296,15 +1337,26 @@ class XmlShapeDeserializer extends SerdeContextConfig {
|
|
|
1296
1337
|
return buffer;
|
|
1297
1338
|
}
|
|
1298
1339
|
if (ns.isStructSchema()) {
|
|
1340
|
+
const union = ns.isUnionSchema();
|
|
1341
|
+
let unionSerde;
|
|
1342
|
+
if (union) {
|
|
1343
|
+
unionSerde = new UnionSerde(value, buffer);
|
|
1344
|
+
}
|
|
1299
1345
|
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
1300
1346
|
const memberTraits = memberSchema.getMergedTraits();
|
|
1301
1347
|
const xmlObjectKey = !memberTraits.httpPayload
|
|
1302
1348
|
? memberSchema.getMemberTraits().xmlName ?? memberName
|
|
1303
1349
|
: memberTraits.xmlName ?? memberSchema.getName();
|
|
1350
|
+
if (union) {
|
|
1351
|
+
unionSerde.mark(xmlObjectKey);
|
|
1352
|
+
}
|
|
1304
1353
|
if (value[xmlObjectKey] != null) {
|
|
1305
1354
|
buffer[memberName] = this.readSchema(memberSchema, value[xmlObjectKey]);
|
|
1306
1355
|
}
|
|
1307
1356
|
}
|
|
1357
|
+
if (union) {
|
|
1358
|
+
unionSerde.writeUnknown();
|
|
1359
|
+
}
|
|
1308
1360
|
return buffer;
|
|
1309
1361
|
}
|
|
1310
1362
|
if (ns.isDocumentSchema()) {
|
|
@@ -1408,7 +1460,22 @@ class QueryShapeSerializer extends SerdeContextConfig {
|
|
|
1408
1460
|
}
|
|
1409
1461
|
}
|
|
1410
1462
|
else if (ns.isDocumentSchema()) {
|
|
1411
|
-
|
|
1463
|
+
if (Array.isArray(value)) {
|
|
1464
|
+
this.write(64 | 15, value, prefix);
|
|
1465
|
+
}
|
|
1466
|
+
else if (value instanceof Date) {
|
|
1467
|
+
this.write(4, value, prefix);
|
|
1468
|
+
}
|
|
1469
|
+
else if (value instanceof Uint8Array) {
|
|
1470
|
+
this.write(21, value, prefix);
|
|
1471
|
+
}
|
|
1472
|
+
else if (value && typeof value === "object") {
|
|
1473
|
+
this.write(128 | 15, value, prefix);
|
|
1474
|
+
}
|
|
1475
|
+
else {
|
|
1476
|
+
this.writeKey(prefix);
|
|
1477
|
+
this.writeValue(String(value));
|
|
1478
|
+
}
|
|
1412
1479
|
}
|
|
1413
1480
|
else if (ns.isListSchema()) {
|
|
1414
1481
|
if (Array.isArray(value)) {
|
|
@@ -1456,6 +1523,7 @@ class QueryShapeSerializer extends SerdeContextConfig {
|
|
|
1456
1523
|
}
|
|
1457
1524
|
else if (ns.isStructSchema()) {
|
|
1458
1525
|
if (value && typeof value === "object") {
|
|
1526
|
+
let didWriteMember = false;
|
|
1459
1527
|
for (const [memberName, member] of serializingStructIterator(ns, value)) {
|
|
1460
1528
|
if (value[memberName] == null && !member.isIdempotencyToken()) {
|
|
1461
1529
|
continue;
|
|
@@ -1463,6 +1531,15 @@ class QueryShapeSerializer extends SerdeContextConfig {
|
|
|
1463
1531
|
const suffix = this.getKey(memberName, member.getMergedTraits().xmlName);
|
|
1464
1532
|
const key = `${prefix}${suffix}`;
|
|
1465
1533
|
this.write(member, value[memberName], key);
|
|
1534
|
+
didWriteMember = true;
|
|
1535
|
+
}
|
|
1536
|
+
if (!didWriteMember && ns.isUnionSchema()) {
|
|
1537
|
+
const { $unknown } = value;
|
|
1538
|
+
if (Array.isArray($unknown)) {
|
|
1539
|
+
const [k, v] = $unknown;
|
|
1540
|
+
const key = `${prefix}${k}`;
|
|
1541
|
+
this.write(15, v, key);
|
|
1542
|
+
}
|
|
1466
1543
|
}
|
|
1467
1544
|
}
|
|
1468
1545
|
}
|
|
@@ -1771,6 +1848,22 @@ class XmlShapeSerializer extends SerdeContextConfig {
|
|
|
1771
1848
|
}
|
|
1772
1849
|
}
|
|
1773
1850
|
}
|
|
1851
|
+
const { $unknown } = value;
|
|
1852
|
+
if ($unknown && ns.isUnionSchema() && Array.isArray($unknown) && Object.keys(value).length === 1) {
|
|
1853
|
+
const [k, v] = $unknown;
|
|
1854
|
+
const node = xmlBuilder.XmlNode.of(k);
|
|
1855
|
+
if (typeof v !== "string") {
|
|
1856
|
+
if (value instanceof xmlBuilder.XmlNode || value instanceof xmlBuilder.XmlText) {
|
|
1857
|
+
structXmlNode.addChildNode(value);
|
|
1858
|
+
}
|
|
1859
|
+
else {
|
|
1860
|
+
throw new Error(`@aws-sdk - $unknown union member in XML requires ` +
|
|
1861
|
+
`value of type string, @aws-sdk/xml-builder::XmlNode or XmlText.`);
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
this.writeSimpleInto(0, v, node, xmlns);
|
|
1865
|
+
structXmlNode.addChildNode(node);
|
|
1866
|
+
}
|
|
1774
1867
|
if (xmlns) {
|
|
1775
1868
|
structXmlNode.addAttribute(xmlnsAttr, xmlns);
|
|
1776
1869
|
}
|
|
@@ -274,6 +274,30 @@ function* deserializingStructIterator(ns, sourceObject, nameTrait) {
|
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
+
class UnionSerde {
|
|
278
|
+
from;
|
|
279
|
+
to;
|
|
280
|
+
keys;
|
|
281
|
+
constructor(from, to) {
|
|
282
|
+
this.from = from;
|
|
283
|
+
this.to = to;
|
|
284
|
+
this.keys = new Set(Object.keys(this.from).filter((k) => k !== "__type"));
|
|
285
|
+
}
|
|
286
|
+
mark(key) {
|
|
287
|
+
this.keys.delete(key);
|
|
288
|
+
}
|
|
289
|
+
hasUnknown() {
|
|
290
|
+
return this.keys.size === 1 && Object.keys(this.to).length === 0;
|
|
291
|
+
}
|
|
292
|
+
writeUnknown() {
|
|
293
|
+
if (this.hasUnknown()) {
|
|
294
|
+
const k = this.keys.values().next().value;
|
|
295
|
+
const v = this.from[k];
|
|
296
|
+
this.to.$unknown = [k, v];
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
277
301
|
function jsonReviver(key, value, context) {
|
|
278
302
|
if (context?.source) {
|
|
279
303
|
const numericString = context.source;
|
|
@@ -365,13 +389,23 @@ class JsonShapeDeserializer extends SerdeContextConfig {
|
|
|
365
389
|
const ns = schema.NormalizedSchema.of(schema$1);
|
|
366
390
|
if (isObject) {
|
|
367
391
|
if (ns.isStructSchema()) {
|
|
392
|
+
const union = ns.isUnionSchema();
|
|
368
393
|
const out = {};
|
|
394
|
+
let unionSerde;
|
|
395
|
+
if (union) {
|
|
396
|
+
unionSerde = new UnionSerde(value, out);
|
|
397
|
+
}
|
|
369
398
|
for (const [memberName, memberSchema] of deserializingStructIterator(ns, value, this.settings.jsonName ? "jsonName" : false)) {
|
|
370
399
|
const fromKey = this.settings.jsonName ? memberSchema.getMergedTraits().jsonName ?? memberName : memberName;
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
out[memberName] = deserializedValue;
|
|
400
|
+
if (union) {
|
|
401
|
+
unionSerde.mark(fromKey);
|
|
374
402
|
}
|
|
403
|
+
if (value[fromKey] != null) {
|
|
404
|
+
out[memberName] = this._read(memberSchema, value[fromKey]);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
if (union) {
|
|
408
|
+
unionSerde.writeUnknown();
|
|
375
409
|
}
|
|
376
410
|
return out;
|
|
377
411
|
}
|
|
@@ -560,6 +594,13 @@ class JsonShapeSerializer extends SerdeContextConfig {
|
|
|
560
594
|
out[targetKey] = serializableValue;
|
|
561
595
|
}
|
|
562
596
|
}
|
|
597
|
+
if (ns.isUnionSchema() && Object.keys(out).length === 0) {
|
|
598
|
+
const { $unknown } = value;
|
|
599
|
+
if (Array.isArray($unknown)) {
|
|
600
|
+
const [k, v] = $unknown;
|
|
601
|
+
out[k] = this._write(15, v);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
563
604
|
return out;
|
|
564
605
|
}
|
|
565
606
|
if (Array.isArray(value) && ns.isListSchema()) {
|
|
@@ -966,15 +1007,26 @@ class XmlShapeDeserializer extends SerdeContextConfig {
|
|
|
966
1007
|
return buffer;
|
|
967
1008
|
}
|
|
968
1009
|
if (ns.isStructSchema()) {
|
|
1010
|
+
const union = ns.isUnionSchema();
|
|
1011
|
+
let unionSerde;
|
|
1012
|
+
if (union) {
|
|
1013
|
+
unionSerde = new UnionSerde(value, buffer);
|
|
1014
|
+
}
|
|
969
1015
|
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
970
1016
|
const memberTraits = memberSchema.getMergedTraits();
|
|
971
1017
|
const xmlObjectKey = !memberTraits.httpPayload
|
|
972
1018
|
? memberSchema.getMemberTraits().xmlName ?? memberName
|
|
973
1019
|
: memberTraits.xmlName ?? memberSchema.getName();
|
|
1020
|
+
if (union) {
|
|
1021
|
+
unionSerde.mark(xmlObjectKey);
|
|
1022
|
+
}
|
|
974
1023
|
if (value[xmlObjectKey] != null) {
|
|
975
1024
|
buffer[memberName] = this.readSchema(memberSchema, value[xmlObjectKey]);
|
|
976
1025
|
}
|
|
977
1026
|
}
|
|
1027
|
+
if (union) {
|
|
1028
|
+
unionSerde.writeUnknown();
|
|
1029
|
+
}
|
|
978
1030
|
return buffer;
|
|
979
1031
|
}
|
|
980
1032
|
if (ns.isDocumentSchema()) {
|
|
@@ -1078,7 +1130,22 @@ class QueryShapeSerializer extends SerdeContextConfig {
|
|
|
1078
1130
|
}
|
|
1079
1131
|
}
|
|
1080
1132
|
else if (ns.isDocumentSchema()) {
|
|
1081
|
-
|
|
1133
|
+
if (Array.isArray(value)) {
|
|
1134
|
+
this.write(64 | 15, value, prefix);
|
|
1135
|
+
}
|
|
1136
|
+
else if (value instanceof Date) {
|
|
1137
|
+
this.write(4, value, prefix);
|
|
1138
|
+
}
|
|
1139
|
+
else if (value instanceof Uint8Array) {
|
|
1140
|
+
this.write(21, value, prefix);
|
|
1141
|
+
}
|
|
1142
|
+
else if (value && typeof value === "object") {
|
|
1143
|
+
this.write(128 | 15, value, prefix);
|
|
1144
|
+
}
|
|
1145
|
+
else {
|
|
1146
|
+
this.writeKey(prefix);
|
|
1147
|
+
this.writeValue(String(value));
|
|
1148
|
+
}
|
|
1082
1149
|
}
|
|
1083
1150
|
else if (ns.isListSchema()) {
|
|
1084
1151
|
if (Array.isArray(value)) {
|
|
@@ -1126,6 +1193,7 @@ class QueryShapeSerializer extends SerdeContextConfig {
|
|
|
1126
1193
|
}
|
|
1127
1194
|
else if (ns.isStructSchema()) {
|
|
1128
1195
|
if (value && typeof value === "object") {
|
|
1196
|
+
let didWriteMember = false;
|
|
1129
1197
|
for (const [memberName, member] of serializingStructIterator(ns, value)) {
|
|
1130
1198
|
if (value[memberName] == null && !member.isIdempotencyToken()) {
|
|
1131
1199
|
continue;
|
|
@@ -1133,6 +1201,15 @@ class QueryShapeSerializer extends SerdeContextConfig {
|
|
|
1133
1201
|
const suffix = this.getKey(memberName, member.getMergedTraits().xmlName);
|
|
1134
1202
|
const key = `${prefix}${suffix}`;
|
|
1135
1203
|
this.write(member, value[memberName], key);
|
|
1204
|
+
didWriteMember = true;
|
|
1205
|
+
}
|
|
1206
|
+
if (!didWriteMember && ns.isUnionSchema()) {
|
|
1207
|
+
const { $unknown } = value;
|
|
1208
|
+
if (Array.isArray($unknown)) {
|
|
1209
|
+
const [k, v] = $unknown;
|
|
1210
|
+
const key = `${prefix}${k}`;
|
|
1211
|
+
this.write(15, v, key);
|
|
1212
|
+
}
|
|
1136
1213
|
}
|
|
1137
1214
|
}
|
|
1138
1215
|
}
|
|
@@ -1441,6 +1518,22 @@ class XmlShapeSerializer extends SerdeContextConfig {
|
|
|
1441
1518
|
}
|
|
1442
1519
|
}
|
|
1443
1520
|
}
|
|
1521
|
+
const { $unknown } = value;
|
|
1522
|
+
if ($unknown && ns.isUnionSchema() && Array.isArray($unknown) && Object.keys(value).length === 1) {
|
|
1523
|
+
const [k, v] = $unknown;
|
|
1524
|
+
const node = xmlBuilder.XmlNode.of(k);
|
|
1525
|
+
if (typeof v !== "string") {
|
|
1526
|
+
if (value instanceof xmlBuilder.XmlNode || value instanceof xmlBuilder.XmlText) {
|
|
1527
|
+
structXmlNode.addChildNode(value);
|
|
1528
|
+
}
|
|
1529
|
+
else {
|
|
1530
|
+
throw new Error(`@aws-sdk - $unknown union member in XML requires ` +
|
|
1531
|
+
`value of type string, @aws-sdk/xml-builder::XmlNode or XmlText.`);
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
this.writeSimpleInto(0, v, node, xmlns);
|
|
1535
|
+
structXmlNode.addChildNode(node);
|
|
1536
|
+
}
|
|
1444
1537
|
if (xmlns) {
|
|
1445
1538
|
structXmlNode.addAttribute(xmlnsAttr, xmlns);
|
|
1446
1539
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export class UnionSerde {
|
|
2
|
+
from;
|
|
3
|
+
to;
|
|
4
|
+
keys;
|
|
5
|
+
constructor(from, to) {
|
|
6
|
+
this.from = from;
|
|
7
|
+
this.to = to;
|
|
8
|
+
this.keys = new Set(Object.keys(this.from).filter((k) => k !== "__type"));
|
|
9
|
+
}
|
|
10
|
+
mark(key) {
|
|
11
|
+
this.keys.delete(key);
|
|
12
|
+
}
|
|
13
|
+
hasUnknown() {
|
|
14
|
+
return this.keys.size === 1 && Object.keys(this.to).length === 0;
|
|
15
|
+
}
|
|
16
|
+
writeUnknown() {
|
|
17
|
+
if (this.hasUnknown()) {
|
|
18
|
+
const k = this.keys.values().next().value;
|
|
19
|
+
const v = this.from[k];
|
|
20
|
+
this.to.$unknown = [k, v];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeDeserializer.js
CHANGED
|
@@ -4,6 +4,7 @@ import { LazyJsonString, NumericValue, parseEpochTimestamp, parseRfc3339DateTime
|
|
|
4
4
|
import { fromBase64 } from "@smithy/util-base64";
|
|
5
5
|
import { SerdeContextConfig } from "../ConfigurableSerdeContext";
|
|
6
6
|
import { deserializingStructIterator } from "../structIterator";
|
|
7
|
+
import { UnionSerde } from "../UnionSerde";
|
|
7
8
|
import { jsonReviver } from "./jsonReviver";
|
|
8
9
|
import { parseJsonBody } from "./parseJsonBody";
|
|
9
10
|
export class JsonShapeDeserializer extends SerdeContextConfig {
|
|
@@ -23,14 +24,24 @@ export class JsonShapeDeserializer extends SerdeContextConfig {
|
|
|
23
24
|
const ns = NormalizedSchema.of(schema);
|
|
24
25
|
if (isObject) {
|
|
25
26
|
if (ns.isStructSchema()) {
|
|
27
|
+
const union = ns.isUnionSchema();
|
|
26
28
|
const out = {};
|
|
29
|
+
let unionSerde;
|
|
30
|
+
if (union) {
|
|
31
|
+
unionSerde = new UnionSerde(value, out);
|
|
32
|
+
}
|
|
27
33
|
for (const [memberName, memberSchema] of deserializingStructIterator(ns, value, this.settings.jsonName ? "jsonName" : false)) {
|
|
28
34
|
const fromKey = this.settings.jsonName ? memberSchema.getMergedTraits().jsonName ?? memberName : memberName;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
35
|
+
if (union) {
|
|
36
|
+
unionSerde.mark(fromKey);
|
|
37
|
+
}
|
|
38
|
+
if (value[fromKey] != null) {
|
|
39
|
+
out[memberName] = this._read(memberSchema, value[fromKey]);
|
|
32
40
|
}
|
|
33
41
|
}
|
|
42
|
+
if (union) {
|
|
43
|
+
unionSerde.writeUnknown();
|
|
44
|
+
}
|
|
34
45
|
return out;
|
|
35
46
|
}
|
|
36
47
|
if (Array.isArray(value) && ns.isListSchema()) {
|
|
@@ -51,6 +51,13 @@ export class JsonShapeSerializer extends SerdeContextConfig {
|
|
|
51
51
|
out[targetKey] = serializableValue;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
+
if (ns.isUnionSchema() && Object.keys(out).length === 0) {
|
|
55
|
+
const { $unknown } = value;
|
|
56
|
+
if (Array.isArray($unknown)) {
|
|
57
|
+
const [k, v] = $unknown;
|
|
58
|
+
out[k] = this._write(15, v);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
54
61
|
return out;
|
|
55
62
|
}
|
|
56
63
|
if (Array.isArray(value) && ns.isListSchema()) {
|
|
@@ -45,15 +45,24 @@ export class SinglePassJsonShapeSerializer extends SerdeContextConfig {
|
|
|
45
45
|
}
|
|
46
46
|
else if (ns.isStructSchema()) {
|
|
47
47
|
b += "{";
|
|
48
|
+
let didWriteMember = false;
|
|
48
49
|
for (const [name, member] of serializingStructIterator(ns, value)) {
|
|
49
50
|
const item = value[name];
|
|
50
51
|
const targetKey = this.settings.jsonName ? member.getMergedTraits().jsonName ?? name : name;
|
|
51
52
|
const serializableValue = this.writeValue(member, item);
|
|
52
53
|
if (item != null || member.isIdempotencyToken()) {
|
|
54
|
+
didWriteMember = true;
|
|
53
55
|
b += `"${targetKey}":${serializableValue}`;
|
|
54
56
|
b += ",";
|
|
55
57
|
}
|
|
56
58
|
}
|
|
59
|
+
if (!didWriteMember && ns.isUnionSchema()) {
|
|
60
|
+
const { $unknown } = value;
|
|
61
|
+
if (Array.isArray($unknown)) {
|
|
62
|
+
const [k, v] = $unknown;
|
|
63
|
+
b += `"${k}":${this.writeValue(15, v)}`;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
57
66
|
}
|
|
58
67
|
else if (ns.isMapSchema() || ns.isDocumentSchema()) {
|
|
59
68
|
b += "{";
|
package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/query/QueryShapeSerializer.js
CHANGED
|
@@ -66,7 +66,22 @@ export class QueryShapeSerializer extends SerdeContextConfig {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
else if (ns.isDocumentSchema()) {
|
|
69
|
-
|
|
69
|
+
if (Array.isArray(value)) {
|
|
70
|
+
this.write(64 | 15, value, prefix);
|
|
71
|
+
}
|
|
72
|
+
else if (value instanceof Date) {
|
|
73
|
+
this.write(4, value, prefix);
|
|
74
|
+
}
|
|
75
|
+
else if (value instanceof Uint8Array) {
|
|
76
|
+
this.write(21, value, prefix);
|
|
77
|
+
}
|
|
78
|
+
else if (value && typeof value === "object") {
|
|
79
|
+
this.write(128 | 15, value, prefix);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
this.writeKey(prefix);
|
|
83
|
+
this.writeValue(String(value));
|
|
84
|
+
}
|
|
70
85
|
}
|
|
71
86
|
else if (ns.isListSchema()) {
|
|
72
87
|
if (Array.isArray(value)) {
|
|
@@ -114,6 +129,7 @@ export class QueryShapeSerializer extends SerdeContextConfig {
|
|
|
114
129
|
}
|
|
115
130
|
else if (ns.isStructSchema()) {
|
|
116
131
|
if (value && typeof value === "object") {
|
|
132
|
+
let didWriteMember = false;
|
|
117
133
|
for (const [memberName, member] of serializingStructIterator(ns, value)) {
|
|
118
134
|
if (value[memberName] == null && !member.isIdempotencyToken()) {
|
|
119
135
|
continue;
|
|
@@ -121,6 +137,15 @@ export class QueryShapeSerializer extends SerdeContextConfig {
|
|
|
121
137
|
const suffix = this.getKey(memberName, member.getMergedTraits().xmlName);
|
|
122
138
|
const key = `${prefix}${suffix}`;
|
|
123
139
|
this.write(member, value[memberName], key);
|
|
140
|
+
didWriteMember = true;
|
|
141
|
+
}
|
|
142
|
+
if (!didWriteMember && ns.isUnionSchema()) {
|
|
143
|
+
const { $unknown } = value;
|
|
144
|
+
if (Array.isArray($unknown)) {
|
|
145
|
+
const [k, v] = $unknown;
|
|
146
|
+
const key = `${prefix}${k}`;
|
|
147
|
+
this.write(15, v, key);
|
|
148
|
+
}
|
|
124
149
|
}
|
|
125
150
|
}
|
|
126
151
|
}
|
|
@@ -4,6 +4,7 @@ import { NormalizedSchema } from "@smithy/core/schema";
|
|
|
4
4
|
import { getValueFromTextNode } from "@smithy/smithy-client";
|
|
5
5
|
import { toUtf8 } from "@smithy/util-utf8";
|
|
6
6
|
import { SerdeContextConfig } from "../ConfigurableSerdeContext";
|
|
7
|
+
import { UnionSerde } from "../UnionSerde";
|
|
7
8
|
export class XmlShapeDeserializer extends SerdeContextConfig {
|
|
8
9
|
settings;
|
|
9
10
|
stringDeserializer;
|
|
@@ -91,15 +92,26 @@ export class XmlShapeDeserializer extends SerdeContextConfig {
|
|
|
91
92
|
return buffer;
|
|
92
93
|
}
|
|
93
94
|
if (ns.isStructSchema()) {
|
|
95
|
+
const union = ns.isUnionSchema();
|
|
96
|
+
let unionSerde;
|
|
97
|
+
if (union) {
|
|
98
|
+
unionSerde = new UnionSerde(value, buffer);
|
|
99
|
+
}
|
|
94
100
|
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
95
101
|
const memberTraits = memberSchema.getMergedTraits();
|
|
96
102
|
const xmlObjectKey = !memberTraits.httpPayload
|
|
97
103
|
? memberSchema.getMemberTraits().xmlName ?? memberName
|
|
98
104
|
: memberTraits.xmlName ?? memberSchema.getName();
|
|
105
|
+
if (union) {
|
|
106
|
+
unionSerde.mark(xmlObjectKey);
|
|
107
|
+
}
|
|
99
108
|
if (value[xmlObjectKey] != null) {
|
|
100
109
|
buffer[memberName] = this.readSchema(memberSchema, value[xmlObjectKey]);
|
|
101
110
|
}
|
|
102
111
|
}
|
|
112
|
+
if (union) {
|
|
113
|
+
unionSerde.writeUnknown();
|
|
114
|
+
}
|
|
103
115
|
return buffer;
|
|
104
116
|
}
|
|
105
117
|
if (ns.isDocumentSchema()) {
|
|
@@ -87,6 +87,22 @@ export class XmlShapeSerializer extends SerdeContextConfig {
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
+
const { $unknown } = value;
|
|
91
|
+
if ($unknown && ns.isUnionSchema() && Array.isArray($unknown) && Object.keys(value).length === 1) {
|
|
92
|
+
const [k, v] = $unknown;
|
|
93
|
+
const node = XmlNode.of(k);
|
|
94
|
+
if (typeof v !== "string") {
|
|
95
|
+
if (value instanceof XmlNode || value instanceof XmlText) {
|
|
96
|
+
structXmlNode.addChildNode(value);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
throw new Error(`@aws-sdk - $unknown union member in XML requires ` +
|
|
100
|
+
`value of type string, @aws-sdk/xml-builder::XmlNode or XmlText.`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
this.writeSimpleInto(0, v, node, xmlns);
|
|
104
|
+
structXmlNode.addChildNode(node);
|
|
105
|
+
}
|
|
90
106
|
if (xmlns) {
|
|
91
107
|
structXmlNode.addAttribute(xmlnsAttr, xmlns);
|
|
92
108
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper for identifying unknown union members during deserialization.
|
|
3
|
+
*/
|
|
4
|
+
export declare class UnionSerde {
|
|
5
|
+
private from;
|
|
6
|
+
private to;
|
|
7
|
+
private keys;
|
|
8
|
+
constructor(from: any, to: any);
|
|
9
|
+
/**
|
|
10
|
+
* Marks the key as being a known member.
|
|
11
|
+
* @param key - to mark.
|
|
12
|
+
*/
|
|
13
|
+
mark(key: string): void;
|
|
14
|
+
/**
|
|
15
|
+
* @returns whether only one key remains unmarked and nothing has been written,
|
|
16
|
+
* implying the object is a union.
|
|
17
|
+
*/
|
|
18
|
+
hasUnknown(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Writes the unknown key-value pair, if present, into the $unknown property
|
|
21
|
+
* of the union object.
|
|
22
|
+
*/
|
|
23
|
+
writeUnknown(): void;
|
|
24
|
+
}
|