@cdk8s/awscdk-resolver 0.0.600 → 0.0.601
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-sdk/client-cloudformation/dist-cjs/auth/httpAuthSchemeProvider.js +9 -15
- package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/endpoint/bdd.js +2 -5
- package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/endpoint/endpointResolver.js +7 -11
- package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/index.js +449 -469
- package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/models/CloudFormationServiceException.js +4 -8
- package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/models/errors.js +59 -91
- package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/runtimeConfig.browser.js +22 -26
- package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/runtimeConfig.js +30 -34
- package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/runtimeConfig.native.js +4 -7
- package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/runtimeConfig.shared.js +20 -24
- package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/schemas/schemas_0.js +814 -533
- package/node_modules/@aws-sdk/client-cloudformation/package.json +8 -8
- package/node_modules/@aws-sdk/core/dist-cjs/index.js +45 -50
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/account-id-endpoint/index.js +2 -4
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.browser.js +21 -22
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.js +51 -51
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.native.js +21 -22
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js +19 -21
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +107 -109
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/util/index.js +2 -4
- package/node_modules/@aws-sdk/core/package.json +8 -8
- package/node_modules/@aws-sdk/credential-provider-env/dist-cjs/index.js +4 -6
- package/node_modules/@aws-sdk/credential-provider-env/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/checkUrl.js +3 -7
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/fromHttp.browser.js +12 -16
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/fromHttp.js +16 -21
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/requestHelpers.js +14 -18
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/retry-wrapper.js +1 -5
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/index.browser.js +2 -5
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/index.js +2 -7
- package/node_modules/@aws-sdk/credential-provider-http/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js +47 -41
- package/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveProcessCredentials.js +8 -4
- package/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveWebIdentityCredentials.js +14 -10
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +13 -13
- package/node_modules/@aws-sdk/credential-provider-login/dist-cjs/index.js +31 -33
- package/node_modules/@aws-sdk/credential-provider-login/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js +16 -18
- package/node_modules/@aws-sdk/credential-provider-node/package.json +11 -11
- package/node_modules/@aws-sdk/credential-provider-process/dist-cjs/index.js +11 -13
- package/node_modules/@aws-sdk/credential-provider-process/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/index.js +22 -24
- package/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/loadSso-BGYXHf8s.js +3 -0
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +8 -8
- package/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromTokenFile.js +10 -14
- package/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromWebToken.js +2 -6
- package/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/index.js +3 -27
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +7 -7
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/index.js +0 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +82 -84
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +158 -119
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +80 -82
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +80 -82
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +99 -101
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/commands/CreateOAuth2TokenCommand.js +4 -1
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/endpoint/bdd.js +70 -35
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/endpoint/endpointResolver.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/models/enums.js +3 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/endpoint/EndpointParameters.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/models/enums.d.ts +12 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/endpoint/EndpointParameters.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/models/enums.d.ts +3 -0
- package/node_modules/@aws-sdk/nested-clients/package.json +9 -8
- package/node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/index.js +4 -6
- package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +5 -5
- package/node_modules/@aws-sdk/token-providers/dist-cjs/index.js +26 -28
- package/node_modules/@aws-sdk/token-providers/package.json +7 -7
- package/node_modules/@aws-sdk/types/dist-cjs/index.js +7 -8
- package/node_modules/@aws-sdk/types/package.json +4 -4
- package/node_modules/@aws-sdk/util-locate-window/dist-cjs/index.js +0 -2
- package/node_modules/@aws-sdk/util-locate-window/package.json +4 -4
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/index.js +2 -4
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-external/nodable_entities.js +4 -7
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-parser.browser.js +2 -5
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-parser.js +7 -10
- package/node_modules/@aws-sdk/xml-builder/package.json +4 -4
- package/node_modules/@smithy/core/dist-cjs/index.js +13 -15
- package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +29 -31
- package/node_modules/@smithy/core/dist-cjs/submodules/checksum/index.browser.js +2 -4
- package/node_modules/@smithy/core/dist-cjs/submodules/checksum/index.js +7 -9
- package/node_modules/@smithy/core/dist-cjs/submodules/checksum/index.native.js +3 -5
- package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +22 -23
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.browser.js +10 -11
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.js +38 -39
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.native.js +10 -11
- package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.browser.js +14 -17
- package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js +20 -23
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.browser.js +9 -11
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +11 -13
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +59 -60
- package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.browser.js +23 -24
- package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.js +25 -26
- package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +5 -7
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.browser.js +4 -6
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +23 -25
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.native.js +4 -6
- package/node_modules/@smithy/core/dist-cjs/submodules/transport/index.js +2 -4
- package/node_modules/@smithy/core/dist-es/legacy-root-exports/middleware-http-auth-scheme/httpAuthSchemeMiddleware.js +1 -1
- package/node_modules/@smithy/core/dist-es/legacy-root-exports/middleware-http-signing/httpSigningMiddleware.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/cbor/SmithyRpcV2CborProtocol.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/endpointMiddleware.js +1 -1
- package/node_modules/@smithy/core/dist-types/submodules/schema/TypeRegistry.d.ts +1 -1
- package/node_modules/@smithy/core/package.json +7 -6
- package/node_modules/@smithy/credential-provider-imds/dist-cjs/index.js +23 -24
- package/node_modules/@smithy/credential-provider-imds/package.json +6 -6
- package/node_modules/@smithy/fetch-http-handler/dist-cjs/index.js +6 -8
- package/node_modules/@smithy/fetch-http-handler/package.json +7 -7
- package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +11 -13
- package/node_modules/@smithy/node-http-handler/package.json +7 -7
- package/node_modules/@smithy/signature-v4/dist-cjs/index.js +27 -29
- package/node_modules/@smithy/signature-v4/package.json +6 -6
- package/node_modules/@smithy/types/dist-cjs/index.js +23 -18
- package/node_modules/@smithy/types/package.json +4 -4
- package/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/loadSso-BKDNrsal.js +0 -8
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var serde = require('@smithy/core/serde');
|
|
8
|
-
var xmlBuilder = require('@aws-sdk/xml-builder');
|
|
1
|
+
const { SmithyRpcV2CborProtocol, loadSmithyRpcV2CborErrorCode } = require("@smithy/core/cbor");
|
|
2
|
+
const { TypeRegistry, NormalizedSchema, deref } = require("@smithy/core/schema");
|
|
3
|
+
const { decorateServiceException, getValueFromTextNode } = require("@smithy/core/client");
|
|
4
|
+
const { collectBody, determineTimestampFormat, RpcProtocol, HttpBindingProtocol, HttpInterceptingShapeSerializer, HttpInterceptingShapeDeserializer, FromStringShapeDeserializer, extendedEncodeURIComponent } = require("@smithy/core/protocols");
|
|
5
|
+
const { NumericValue, toUtf8, fromBase64, LazyJsonString, parseEpochTimestamp, parseRfc7231DateTime, parseRfc3339DateTimeWithOffset, toBase64, dateToUtcString, generateIdempotencyToken, expectUnion } = require("@smithy/core/serde");
|
|
6
|
+
const { parseXML, XmlNode, XmlText } = require("@aws-sdk/xml-builder");
|
|
9
7
|
|
|
10
8
|
class ProtocolLib {
|
|
11
9
|
queryCompat;
|
|
@@ -81,8 +79,8 @@ class ProtocolLib {
|
|
|
81
79
|
if (errorIdentifier.includes("#")) {
|
|
82
80
|
[namespace] = errorIdentifier.split("#");
|
|
83
81
|
}
|
|
84
|
-
const staticRegistry =
|
|
85
|
-
const defaultSyntheticRegistry =
|
|
82
|
+
const staticRegistry = TypeRegistry.for(namespace);
|
|
83
|
+
const defaultSyntheticRegistry = TypeRegistry.for("smithy.ts.sdk.synthetic." + defaultNamespace);
|
|
86
84
|
composite.copyFrom(staticRegistry);
|
|
87
85
|
composite.copyFrom(defaultSyntheticRegistry);
|
|
88
86
|
this.errorRegistry = composite;
|
|
@@ -90,7 +88,7 @@ class ProtocolLib {
|
|
|
90
88
|
decorateServiceException(exception, additions = {}) {
|
|
91
89
|
if (this.queryCompat) {
|
|
92
90
|
const msg = exception.Message ?? additions.Message;
|
|
93
|
-
const error =
|
|
91
|
+
const error = decorateServiceException(exception, additions);
|
|
94
92
|
if (msg) {
|
|
95
93
|
error.message = msg;
|
|
96
94
|
}
|
|
@@ -105,7 +103,7 @@ class ProtocolLib {
|
|
|
105
103
|
}
|
|
106
104
|
return error;
|
|
107
105
|
}
|
|
108
|
-
return
|
|
106
|
+
return decorateServiceException(exception, additions);
|
|
109
107
|
}
|
|
110
108
|
setQueryCompatError(output, response) {
|
|
111
109
|
const queryErrorHeader = response.headers?.["x-amzn-query-error"];
|
|
@@ -142,12 +140,12 @@ class ProtocolLib {
|
|
|
142
140
|
return registry.getSchema(errorName);
|
|
143
141
|
}
|
|
144
142
|
catch (e) {
|
|
145
|
-
return registry.find((schema
|
|
143
|
+
return registry.find((schema) => NormalizedSchema.of(schema).getMergedTraits().awsQueryError?.[0] === errorName);
|
|
146
144
|
}
|
|
147
145
|
}
|
|
148
146
|
}
|
|
149
147
|
|
|
150
|
-
class AwsSmithyRpcV2CborProtocol extends
|
|
148
|
+
class AwsSmithyRpcV2CborProtocol extends SmithyRpcV2CborProtocol {
|
|
151
149
|
awsQueryCompatible;
|
|
152
150
|
mixin;
|
|
153
151
|
constructor({ defaultNamespace, errorTypeRegistries, awsQueryCompatible, }) {
|
|
@@ -171,11 +169,11 @@ class AwsSmithyRpcV2CborProtocol extends cbor.SmithyRpcV2CborProtocol {
|
|
|
171
169
|
if (compatHeader && this.awsQueryCompatible) {
|
|
172
170
|
return compatHeader.split(";")[0];
|
|
173
171
|
}
|
|
174
|
-
return
|
|
172
|
+
return loadSmithyRpcV2CborErrorCode(response, dataObject) ?? "Unknown";
|
|
175
173
|
})();
|
|
176
174
|
this.mixin.compose(this.compositeErrorRegistry, errorName, this.options.defaultNamespace);
|
|
177
175
|
const { errorSchema, errorMetadata } = await this.mixin.getErrorSchemaOrThrowBaseException(errorName, this.options.defaultNamespace, response, dataObject, metadata, this.awsQueryCompatible ? this.mixin.findQueryCompatibleError : undefined);
|
|
178
|
-
const ns =
|
|
176
|
+
const ns = NormalizedSchema.of(errorSchema);
|
|
179
177
|
const message = dataObject.message ?? dataObject.Message ?? "UnknownError";
|
|
180
178
|
const ErrorCtor = this.compositeErrorRegistry.getErrorCtor(errorSchema) ?? Error;
|
|
181
179
|
const exception = new ErrorCtor({});
|
|
@@ -286,7 +284,7 @@ function jsonReviver(key, value, context) {
|
|
|
286
284
|
if (value > Number.MAX_SAFE_INTEGER || value < Number.MIN_SAFE_INTEGER || numericString !== String(value)) {
|
|
287
285
|
const isFractional = numericString.includes(".");
|
|
288
286
|
if (isFractional) {
|
|
289
|
-
return new
|
|
287
|
+
return new NumericValue(numericString, "bigDecimal");
|
|
290
288
|
}
|
|
291
289
|
else {
|
|
292
290
|
return BigInt(numericString);
|
|
@@ -297,7 +295,7 @@ function jsonReviver(key, value, context) {
|
|
|
297
295
|
return value;
|
|
298
296
|
}
|
|
299
297
|
|
|
300
|
-
const collectBodyString = (streamBody, context) =>
|
|
298
|
+
const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => (context?.utf8Encoder ?? toUtf8)(body));
|
|
301
299
|
|
|
302
300
|
const parseJsonBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
|
|
303
301
|
if (encoded.length) {
|
|
@@ -380,9 +378,9 @@ class JsonShapeDeserializer extends SerdeContextConfig {
|
|
|
380
378
|
readObject(schema, data) {
|
|
381
379
|
return this._read(schema, data);
|
|
382
380
|
}
|
|
383
|
-
_read(schema
|
|
381
|
+
_read(schema, value) {
|
|
384
382
|
const isObject = value !== null && typeof value === "object";
|
|
385
|
-
const ns =
|
|
383
|
+
const ns = NormalizedSchema.of(schema);
|
|
386
384
|
if (isObject) {
|
|
387
385
|
if (ns.isStructSchema()) {
|
|
388
386
|
const record = value;
|
|
@@ -442,25 +440,25 @@ class JsonShapeDeserializer extends SerdeContextConfig {
|
|
|
442
440
|
}
|
|
443
441
|
}
|
|
444
442
|
if (ns.isBlobSchema() && typeof value === "string") {
|
|
445
|
-
return
|
|
443
|
+
return fromBase64(value);
|
|
446
444
|
}
|
|
447
445
|
const mediaType = ns.getMergedTraits().mediaType;
|
|
448
446
|
if (ns.isStringSchema() && typeof value === "string" && mediaType) {
|
|
449
447
|
const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
|
|
450
448
|
if (isJson) {
|
|
451
|
-
return
|
|
449
|
+
return LazyJsonString.from(value);
|
|
452
450
|
}
|
|
453
451
|
return value;
|
|
454
452
|
}
|
|
455
453
|
if (ns.isTimestampSchema() && value != null) {
|
|
456
|
-
const format =
|
|
454
|
+
const format = determineTimestampFormat(ns, this.settings);
|
|
457
455
|
switch (format) {
|
|
458
456
|
case 5:
|
|
459
|
-
return
|
|
457
|
+
return parseRfc3339DateTimeWithOffset(value);
|
|
460
458
|
case 6:
|
|
461
|
-
return
|
|
459
|
+
return parseRfc7231DateTime(value);
|
|
462
460
|
case 7:
|
|
463
|
-
return
|
|
461
|
+
return parseEpochTimestamp(value);
|
|
464
462
|
default:
|
|
465
463
|
console.warn("Missing timestamp format, parsing value with Date constructor:", value);
|
|
466
464
|
return new Date(value);
|
|
@@ -470,14 +468,14 @@ class JsonShapeDeserializer extends SerdeContextConfig {
|
|
|
470
468
|
return BigInt(value);
|
|
471
469
|
}
|
|
472
470
|
if (ns.isBigDecimalSchema() && value != undefined) {
|
|
473
|
-
if (value instanceof
|
|
471
|
+
if (value instanceof NumericValue) {
|
|
474
472
|
return value;
|
|
475
473
|
}
|
|
476
474
|
const untyped = value;
|
|
477
475
|
if (untyped.type === "bigDecimal" && "string" in untyped) {
|
|
478
|
-
return new
|
|
476
|
+
return new NumericValue(untyped.string, untyped.type);
|
|
479
477
|
}
|
|
480
|
-
return new
|
|
478
|
+
return new NumericValue(String(value), "bigDecimal");
|
|
481
479
|
}
|
|
482
480
|
if (ns.isNumericSchema() && typeof value === "string") {
|
|
483
481
|
switch (value) {
|
|
@@ -495,7 +493,7 @@ class JsonShapeDeserializer extends SerdeContextConfig {
|
|
|
495
493
|
const out = Array.isArray(value) ? [] : {};
|
|
496
494
|
for (const k in value) {
|
|
497
495
|
const v = value[k];
|
|
498
|
-
if (v instanceof
|
|
496
|
+
if (v instanceof NumericValue) {
|
|
499
497
|
out[k] = v;
|
|
500
498
|
}
|
|
501
499
|
else {
|
|
@@ -526,7 +524,7 @@ class JsonReplacer {
|
|
|
526
524
|
}
|
|
527
525
|
this.stage = 1;
|
|
528
526
|
return (key, value) => {
|
|
529
|
-
if (value instanceof
|
|
527
|
+
if (value instanceof NumericValue) {
|
|
530
528
|
const v = `${NUMERIC_CONTROL_CHAR + "nv" + this.counter++}_` + value.string;
|
|
531
529
|
this.values.set(`"${v}"`, value.string);
|
|
532
530
|
return v;
|
|
@@ -567,8 +565,8 @@ class JsonShapeSerializer extends SerdeContextConfig {
|
|
|
567
565
|
super();
|
|
568
566
|
this.settings = settings;
|
|
569
567
|
}
|
|
570
|
-
write(schema
|
|
571
|
-
this.rootSchema =
|
|
568
|
+
write(schema, value) {
|
|
569
|
+
this.rootSchema = NormalizedSchema.of(schema);
|
|
572
570
|
this.buffer = this._write(this.rootSchema, value);
|
|
573
571
|
}
|
|
574
572
|
flush() {
|
|
@@ -584,15 +582,15 @@ class JsonShapeSerializer extends SerdeContextConfig {
|
|
|
584
582
|
}
|
|
585
583
|
return this.buffer;
|
|
586
584
|
}
|
|
587
|
-
writeDiscriminatedDocument(schema
|
|
588
|
-
this.write(schema
|
|
585
|
+
writeDiscriminatedDocument(schema, value) {
|
|
586
|
+
this.write(schema, value);
|
|
589
587
|
if (typeof this.buffer === "object") {
|
|
590
|
-
this.buffer.__type =
|
|
588
|
+
this.buffer.__type = NormalizedSchema.of(schema).getName(true);
|
|
591
589
|
}
|
|
592
590
|
}
|
|
593
|
-
_write(schema
|
|
591
|
+
_write(schema, value, container) {
|
|
594
592
|
const isObject = value !== null && typeof value === "object";
|
|
595
|
-
const ns =
|
|
593
|
+
const ns = NormalizedSchema.of(schema);
|
|
596
594
|
if (isObject) {
|
|
597
595
|
if (ns.isStructSchema()) {
|
|
598
596
|
const record = value;
|
|
@@ -660,15 +658,15 @@ class JsonShapeSerializer extends SerdeContextConfig {
|
|
|
660
658
|
if (ns === this.rootSchema) {
|
|
661
659
|
return value;
|
|
662
660
|
}
|
|
663
|
-
return (this.serdeContext?.base64Encoder ??
|
|
661
|
+
return (this.serdeContext?.base64Encoder ?? toBase64)(value);
|
|
664
662
|
}
|
|
665
663
|
if (value instanceof Date && (ns.isTimestampSchema() || ns.isDocumentSchema())) {
|
|
666
|
-
const format =
|
|
664
|
+
const format = determineTimestampFormat(ns, this.settings);
|
|
667
665
|
switch (format) {
|
|
668
666
|
case 5:
|
|
669
667
|
return value.toISOString().replace(".000Z", "Z");
|
|
670
668
|
case 6:
|
|
671
|
-
return
|
|
669
|
+
return dateToUtcString(value);
|
|
672
670
|
case 7:
|
|
673
671
|
return value.getTime() / 1000;
|
|
674
672
|
default:
|
|
@@ -676,7 +674,7 @@ class JsonShapeSerializer extends SerdeContextConfig {
|
|
|
676
674
|
return value.getTime() / 1000;
|
|
677
675
|
}
|
|
678
676
|
}
|
|
679
|
-
if (value instanceof
|
|
677
|
+
if (value instanceof NumericValue) {
|
|
680
678
|
this.useReplacer = true;
|
|
681
679
|
}
|
|
682
680
|
}
|
|
@@ -685,13 +683,13 @@ class JsonShapeSerializer extends SerdeContextConfig {
|
|
|
685
683
|
}
|
|
686
684
|
if (ns.isStringSchema()) {
|
|
687
685
|
if (typeof value === "undefined" && ns.isIdempotencyToken()) {
|
|
688
|
-
return
|
|
686
|
+
return generateIdempotencyToken();
|
|
689
687
|
}
|
|
690
688
|
const mediaType = ns.getMergedTraits().mediaType;
|
|
691
689
|
if (value != null && mediaType) {
|
|
692
690
|
const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
|
|
693
691
|
if (isJson) {
|
|
694
|
-
return
|
|
692
|
+
return LazyJsonString.from(value);
|
|
695
693
|
}
|
|
696
694
|
}
|
|
697
695
|
return value;
|
|
@@ -706,7 +704,7 @@ class JsonShapeSerializer extends SerdeContextConfig {
|
|
|
706
704
|
if (ns === this.rootSchema) {
|
|
707
705
|
return value;
|
|
708
706
|
}
|
|
709
|
-
return (this.serdeContext?.base64Encoder ??
|
|
707
|
+
return (this.serdeContext?.base64Encoder ?? toBase64)(value);
|
|
710
708
|
}
|
|
711
709
|
if (typeof value === "bigint") {
|
|
712
710
|
this.useReplacer = true;
|
|
@@ -716,7 +714,7 @@ class JsonShapeSerializer extends SerdeContextConfig {
|
|
|
716
714
|
const out = Array.isArray(value) ? [] : {};
|
|
717
715
|
for (const k in value) {
|
|
718
716
|
const v = value[k];
|
|
719
|
-
if (v instanceof
|
|
717
|
+
if (v instanceof NumericValue) {
|
|
720
718
|
this.useReplacer = true;
|
|
721
719
|
out[k] = v;
|
|
722
720
|
}
|
|
@@ -752,7 +750,7 @@ class JsonCodec extends SerdeContextConfig {
|
|
|
752
750
|
}
|
|
753
751
|
}
|
|
754
752
|
|
|
755
|
-
class AwsJsonRpcProtocol extends
|
|
753
|
+
class AwsJsonRpcProtocol extends RpcProtocol {
|
|
756
754
|
serializer;
|
|
757
755
|
deserializer;
|
|
758
756
|
serviceTarget;
|
|
@@ -789,7 +787,7 @@ class AwsJsonRpcProtocol extends protocols.RpcProtocol {
|
|
|
789
787
|
if (this.awsQueryCompatible) {
|
|
790
788
|
request.headers["x-amzn-query-mode"] = "true";
|
|
791
789
|
}
|
|
792
|
-
if (
|
|
790
|
+
if (deref(operationSchema.input) === "unit" || !request.body) {
|
|
793
791
|
request.body = "{}";
|
|
794
792
|
}
|
|
795
793
|
return request;
|
|
@@ -805,7 +803,7 @@ class AwsJsonRpcProtocol extends protocols.RpcProtocol {
|
|
|
805
803
|
const errorIdentifier = loadJsonRpcErrorCode(response, dataObject, awsQueryCompatible) ?? "Unknown";
|
|
806
804
|
this.mixin.compose(this.compositeErrorRegistry, errorIdentifier, this.options.defaultNamespace);
|
|
807
805
|
const { errorSchema, errorMetadata } = await this.mixin.getErrorSchemaOrThrowBaseException(errorIdentifier, this.options.defaultNamespace, response, dataObject, metadata, awsQueryCompatible ? this.mixin.findQueryCompatibleError : undefined);
|
|
808
|
-
const ns =
|
|
806
|
+
const ns = NormalizedSchema.of(errorSchema);
|
|
809
807
|
const message = dataObject.message ?? dataObject.Message ?? "UnknownError";
|
|
810
808
|
const ErrorCtor = this.compositeErrorRegistry.getErrorCtor(errorSchema) ?? Error;
|
|
811
809
|
const exception = new ErrorCtor({});
|
|
@@ -868,7 +866,7 @@ class AwsJson1_1Protocol extends AwsJsonRpcProtocol {
|
|
|
868
866
|
}
|
|
869
867
|
}
|
|
870
868
|
|
|
871
|
-
class AwsRestJsonProtocol extends
|
|
869
|
+
class AwsRestJsonProtocol extends HttpBindingProtocol {
|
|
872
870
|
serializer;
|
|
873
871
|
deserializer;
|
|
874
872
|
codec;
|
|
@@ -887,8 +885,8 @@ class AwsRestJsonProtocol extends protocols.HttpBindingProtocol {
|
|
|
887
885
|
jsonName: true,
|
|
888
886
|
};
|
|
889
887
|
this.codec = new JsonCodec(settings);
|
|
890
|
-
this.serializer = new
|
|
891
|
-
this.deserializer = new
|
|
888
|
+
this.serializer = new HttpInterceptingShapeSerializer(this.codec.createSerializer(), settings);
|
|
889
|
+
this.deserializer = new HttpInterceptingShapeDeserializer(this.codec.createDeserializer(), settings);
|
|
892
890
|
}
|
|
893
891
|
getShapeId() {
|
|
894
892
|
return "aws.protocols#restJson1";
|
|
@@ -902,7 +900,7 @@ class AwsRestJsonProtocol extends protocols.HttpBindingProtocol {
|
|
|
902
900
|
}
|
|
903
901
|
async serializeRequest(operationSchema, input, context) {
|
|
904
902
|
const request = await super.serializeRequest(operationSchema, input, context);
|
|
905
|
-
const inputSchema =
|
|
903
|
+
const inputSchema = NormalizedSchema.of(operationSchema.input);
|
|
906
904
|
if (!request.headers["content-type"]) {
|
|
907
905
|
const contentType = this.mixin.resolveRestContentType(this.getDefaultContentType(), inputSchema);
|
|
908
906
|
if (contentType) {
|
|
@@ -916,7 +914,7 @@ class AwsRestJsonProtocol extends protocols.HttpBindingProtocol {
|
|
|
916
914
|
}
|
|
917
915
|
async deserializeResponse(operationSchema, context, response) {
|
|
918
916
|
const output = await super.deserializeResponse(operationSchema, context, response);
|
|
919
|
-
const outputSchema =
|
|
917
|
+
const outputSchema = NormalizedSchema.of(operationSchema.output);
|
|
920
918
|
for (const [name, member] of outputSchema.structIterator()) {
|
|
921
919
|
if (member.getMemberTraits().httpPayload && !(name in output)) {
|
|
922
920
|
output[name] = null;
|
|
@@ -928,7 +926,7 @@ class AwsRestJsonProtocol extends protocols.HttpBindingProtocol {
|
|
|
928
926
|
const errorIdentifier = loadRestJsonErrorCode(response, dataObject) ?? "Unknown";
|
|
929
927
|
this.mixin.compose(this.compositeErrorRegistry, errorIdentifier, this.options.defaultNamespace);
|
|
930
928
|
const { errorSchema, errorMetadata } = await this.mixin.getErrorSchemaOrThrowBaseException(errorIdentifier, this.options.defaultNamespace, response, dataObject, metadata);
|
|
931
|
-
const ns =
|
|
929
|
+
const ns = NormalizedSchema.of(errorSchema);
|
|
932
930
|
const message = dataObject.message ?? dataObject.Message ?? "UnknownError";
|
|
933
931
|
const ErrorCtor = this.compositeErrorRegistry.getErrorCtor(errorSchema) ?? Error;
|
|
934
932
|
const exception = new ErrorCtor({});
|
|
@@ -956,7 +954,7 @@ const awsExpectUnion = (value) => {
|
|
|
956
954
|
if (typeof value === "object" && "__type" in value) {
|
|
957
955
|
delete value.__type;
|
|
958
956
|
}
|
|
959
|
-
return
|
|
957
|
+
return expectUnion(value);
|
|
960
958
|
};
|
|
961
959
|
|
|
962
960
|
class XmlShapeDeserializer extends SerdeContextConfig {
|
|
@@ -965,14 +963,14 @@ class XmlShapeDeserializer extends SerdeContextConfig {
|
|
|
965
963
|
constructor(settings) {
|
|
966
964
|
super();
|
|
967
965
|
this.settings = settings;
|
|
968
|
-
this.stringDeserializer = new
|
|
966
|
+
this.stringDeserializer = new FromStringShapeDeserializer(settings);
|
|
969
967
|
}
|
|
970
968
|
setSerdeContext(serdeContext) {
|
|
971
969
|
this.serdeContext = serdeContext;
|
|
972
970
|
this.stringDeserializer.setSerdeContext(serdeContext);
|
|
973
971
|
}
|
|
974
|
-
read(schema
|
|
975
|
-
const ns =
|
|
972
|
+
read(schema, bytes, key) {
|
|
973
|
+
const ns = NormalizedSchema.of(schema);
|
|
976
974
|
const memberSchemas = ns.getMemberSchemas();
|
|
977
975
|
const isEventPayload = ns.isStructSchema() &&
|
|
978
976
|
ns.isMemberSchema() &&
|
|
@@ -991,12 +989,12 @@ class XmlShapeDeserializer extends SerdeContextConfig {
|
|
|
991
989
|
}
|
|
992
990
|
return output;
|
|
993
991
|
}
|
|
994
|
-
const xmlString = (this.serdeContext?.utf8Encoder ??
|
|
992
|
+
const xmlString = (this.serdeContext?.utf8Encoder ?? toUtf8)(bytes);
|
|
995
993
|
const parsedObject = this.parseXml(xmlString);
|
|
996
|
-
return this.readSchema(schema
|
|
994
|
+
return this.readSchema(schema, key ? parsedObject[key] : parsedObject);
|
|
997
995
|
}
|
|
998
996
|
readSchema(_schema, value) {
|
|
999
|
-
const ns =
|
|
997
|
+
const ns = NormalizedSchema.of(_schema);
|
|
1000
998
|
if (ns.isUnitSchema()) {
|
|
1001
999
|
return;
|
|
1002
1000
|
}
|
|
@@ -1083,7 +1081,7 @@ class XmlShapeDeserializer extends SerdeContextConfig {
|
|
|
1083
1081
|
if (xml.length) {
|
|
1084
1082
|
let parsedObj;
|
|
1085
1083
|
try {
|
|
1086
|
-
parsedObj =
|
|
1084
|
+
parsedObj = parseXML(xml);
|
|
1087
1085
|
}
|
|
1088
1086
|
catch (e) {
|
|
1089
1087
|
if (e && typeof e === "object") {
|
|
@@ -1100,7 +1098,7 @@ class XmlShapeDeserializer extends SerdeContextConfig {
|
|
|
1100
1098
|
parsedObjToReturn[key] = parsedObjToReturn[textNodeName];
|
|
1101
1099
|
delete parsedObjToReturn[textNodeName];
|
|
1102
1100
|
}
|
|
1103
|
-
return
|
|
1101
|
+
return getValueFromTextNode(parsedObjToReturn);
|
|
1104
1102
|
}
|
|
1105
1103
|
return {};
|
|
1106
1104
|
}
|
|
@@ -1113,18 +1111,18 @@ class QueryShapeSerializer extends SerdeContextConfig {
|
|
|
1113
1111
|
super();
|
|
1114
1112
|
this.settings = settings;
|
|
1115
1113
|
}
|
|
1116
|
-
write(schema
|
|
1114
|
+
write(schema, value, prefix = "") {
|
|
1117
1115
|
if (this.buffer === undefined) {
|
|
1118
1116
|
this.buffer = "";
|
|
1119
1117
|
}
|
|
1120
|
-
const ns =
|
|
1118
|
+
const ns = NormalizedSchema.of(schema);
|
|
1121
1119
|
if (prefix && !prefix.endsWith(".")) {
|
|
1122
1120
|
prefix += ".";
|
|
1123
1121
|
}
|
|
1124
1122
|
if (ns.isBlobSchema()) {
|
|
1125
1123
|
if (typeof value === "string" || value instanceof Uint8Array) {
|
|
1126
1124
|
this.writeKey(prefix);
|
|
1127
|
-
this.writeValue((this.serdeContext?.base64Encoder ??
|
|
1125
|
+
this.writeValue((this.serdeContext?.base64Encoder ?? toBase64)(value));
|
|
1128
1126
|
}
|
|
1129
1127
|
}
|
|
1130
1128
|
else if (ns.isBooleanSchema() || ns.isNumericSchema() || ns.isStringSchema()) {
|
|
@@ -1134,7 +1132,7 @@ class QueryShapeSerializer extends SerdeContextConfig {
|
|
|
1134
1132
|
}
|
|
1135
1133
|
else if (ns.isIdempotencyToken()) {
|
|
1136
1134
|
this.writeKey(prefix);
|
|
1137
|
-
this.writeValue(
|
|
1135
|
+
this.writeValue(generateIdempotencyToken());
|
|
1138
1136
|
}
|
|
1139
1137
|
}
|
|
1140
1138
|
else if (ns.isBigIntegerSchema()) {
|
|
@@ -1146,19 +1144,19 @@ class QueryShapeSerializer extends SerdeContextConfig {
|
|
|
1146
1144
|
else if (ns.isBigDecimalSchema()) {
|
|
1147
1145
|
if (value != null) {
|
|
1148
1146
|
this.writeKey(prefix);
|
|
1149
|
-
this.writeValue(value instanceof
|
|
1147
|
+
this.writeValue(value instanceof NumericValue ? value.string : String(value));
|
|
1150
1148
|
}
|
|
1151
1149
|
}
|
|
1152
1150
|
else if (ns.isTimestampSchema()) {
|
|
1153
1151
|
if (value instanceof Date) {
|
|
1154
1152
|
this.writeKey(prefix);
|
|
1155
|
-
const format =
|
|
1153
|
+
const format = determineTimestampFormat(ns, this.settings);
|
|
1156
1154
|
switch (format) {
|
|
1157
1155
|
case 5:
|
|
1158
1156
|
this.writeValue(value.toISOString().replace(".000Z", "Z"));
|
|
1159
1157
|
break;
|
|
1160
1158
|
case 6:
|
|
1161
|
-
this.writeValue(
|
|
1159
|
+
this.writeValue(dateToUtcString(value));
|
|
1162
1160
|
break;
|
|
1163
1161
|
case 7:
|
|
1164
1162
|
this.writeValue(String(value.getTime() / 1000));
|
|
@@ -1283,14 +1281,14 @@ class QueryShapeSerializer extends SerdeContextConfig {
|
|
|
1283
1281
|
if (key.endsWith(".")) {
|
|
1284
1282
|
key = key.slice(0, key.length - 1);
|
|
1285
1283
|
}
|
|
1286
|
-
this.buffer += `&${
|
|
1284
|
+
this.buffer += `&${extendedEncodeURIComponent(key)}=`;
|
|
1287
1285
|
}
|
|
1288
1286
|
writeValue(value) {
|
|
1289
|
-
this.buffer +=
|
|
1287
|
+
this.buffer += extendedEncodeURIComponent(value);
|
|
1290
1288
|
}
|
|
1291
1289
|
}
|
|
1292
1290
|
|
|
1293
|
-
class AwsQueryProtocol extends
|
|
1291
|
+
class AwsQueryProtocol extends RpcProtocol {
|
|
1294
1292
|
options;
|
|
1295
1293
|
serializer;
|
|
1296
1294
|
deserializer;
|
|
@@ -1330,7 +1328,7 @@ class AwsQueryProtocol extends protocols.RpcProtocol {
|
|
|
1330
1328
|
request.path += "/";
|
|
1331
1329
|
}
|
|
1332
1330
|
request.headers["content-type"] = "application/x-www-form-urlencoded";
|
|
1333
|
-
if (
|
|
1331
|
+
if (deref(operationSchema.input) === "unit" || !request.body) {
|
|
1334
1332
|
request.body = "";
|
|
1335
1333
|
}
|
|
1336
1334
|
const action = operationSchema.name.split("#")[1] ?? operationSchema.name;
|
|
@@ -1342,10 +1340,10 @@ class AwsQueryProtocol extends protocols.RpcProtocol {
|
|
|
1342
1340
|
}
|
|
1343
1341
|
async deserializeResponse(operationSchema, context, response) {
|
|
1344
1342
|
const deserializer = this.deserializer;
|
|
1345
|
-
const ns =
|
|
1343
|
+
const ns = NormalizedSchema.of(operationSchema.output);
|
|
1346
1344
|
const dataObject = {};
|
|
1347
1345
|
if (response.statusCode >= 300) {
|
|
1348
|
-
const bytes = await
|
|
1346
|
+
const bytes = await collectBody(response.body, context);
|
|
1349
1347
|
if (bytes.byteLength > 0) {
|
|
1350
1348
|
Object.assign(dataObject, await deserializer.read(15, bytes));
|
|
1351
1349
|
}
|
|
@@ -1358,7 +1356,7 @@ class AwsQueryProtocol extends protocols.RpcProtocol {
|
|
|
1358
1356
|
}
|
|
1359
1357
|
const shortName = operationSchema.name.split("#")[1] ?? operationSchema.name;
|
|
1360
1358
|
const awsQueryResultKey = ns.isStructSchema() && this.useNestedResult() ? shortName + "Result" : undefined;
|
|
1361
|
-
const bytes = await
|
|
1359
|
+
const bytes = await collectBody(response.body, context);
|
|
1362
1360
|
if (bytes.byteLength > 0) {
|
|
1363
1361
|
Object.assign(dataObject, await deserializer.read(ns, bytes, awsQueryResultKey));
|
|
1364
1362
|
}
|
|
@@ -1380,7 +1378,7 @@ class AwsQueryProtocol extends protocols.RpcProtocol {
|
|
|
1380
1378
|
Message: message,
|
|
1381
1379
|
};
|
|
1382
1380
|
const { errorSchema, errorMetadata } = await this.mixin.getErrorSchemaOrThrowBaseException(errorIdentifier, this.options.defaultNamespace, response, errorData, metadata, this.mixin.findQueryCompatibleError);
|
|
1383
|
-
const ns =
|
|
1381
|
+
const ns = NormalizedSchema.of(errorSchema);
|
|
1384
1382
|
const ErrorCtor = this.compositeErrorRegistry.getErrorCtor(errorSchema) ?? Error;
|
|
1385
1383
|
const exception = new ErrorCtor({});
|
|
1386
1384
|
const output = {
|
|
@@ -1444,7 +1442,7 @@ const parseXmlBody = (streamBody, context) => collectBodyString(streamBody, cont
|
|
|
1444
1442
|
if (encoded.length) {
|
|
1445
1443
|
let parsedObj;
|
|
1446
1444
|
try {
|
|
1447
|
-
parsedObj =
|
|
1445
|
+
parsedObj = parseXML(encoded);
|
|
1448
1446
|
}
|
|
1449
1447
|
catch (e) {
|
|
1450
1448
|
if (e && typeof e === "object") {
|
|
@@ -1461,7 +1459,7 @@ const parseXmlBody = (streamBody, context) => collectBodyString(streamBody, cont
|
|
|
1461
1459
|
parsedObjToReturn[key] = parsedObjToReturn[textNodeName];
|
|
1462
1460
|
delete parsedObjToReturn[textNodeName];
|
|
1463
1461
|
}
|
|
1464
|
-
return
|
|
1462
|
+
return getValueFromTextNode(parsedObjToReturn);
|
|
1465
1463
|
}
|
|
1466
1464
|
return {};
|
|
1467
1465
|
});
|
|
@@ -1493,8 +1491,8 @@ class XmlShapeSerializer extends SerdeContextConfig {
|
|
|
1493
1491
|
super();
|
|
1494
1492
|
this.settings = settings;
|
|
1495
1493
|
}
|
|
1496
|
-
write(schema
|
|
1497
|
-
const ns =
|
|
1494
|
+
write(schema, value) {
|
|
1495
|
+
const ns = NormalizedSchema.of(schema);
|
|
1498
1496
|
if (ns.isStringSchema() && typeof value === "string") {
|
|
1499
1497
|
this.stringBuffer = value;
|
|
1500
1498
|
}
|
|
@@ -1502,7 +1500,7 @@ class XmlShapeSerializer extends SerdeContextConfig {
|
|
|
1502
1500
|
this.byteBuffer =
|
|
1503
1501
|
"byteLength" in value
|
|
1504
1502
|
? value
|
|
1505
|
-
: (this.serdeContext?.base64Decoder ??
|
|
1503
|
+
: (this.serdeContext?.base64Decoder ?? fromBase64)(value);
|
|
1506
1504
|
}
|
|
1507
1505
|
else {
|
|
1508
1506
|
this.buffer = this.writeStruct(ns, value, undefined);
|
|
@@ -1540,7 +1538,7 @@ class XmlShapeSerializer extends SerdeContextConfig {
|
|
|
1540
1538
|
if (!name || !ns.isStructSchema()) {
|
|
1541
1539
|
throw new Error(`@aws-sdk/core/protocols - xml serializer, cannot write struct with empty name or non-struct, schema=${ns.getName(true)}.`);
|
|
1542
1540
|
}
|
|
1543
|
-
const structXmlNode =
|
|
1541
|
+
const structXmlNode = XmlNode.of(name);
|
|
1544
1542
|
const [xmlnsAttr, xmlns] = this.getXmlnsAttribute(ns, parentXmlns);
|
|
1545
1543
|
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
1546
1544
|
const val = value[memberName];
|
|
@@ -1559,7 +1557,7 @@ class XmlShapeSerializer extends SerdeContextConfig {
|
|
|
1559
1557
|
structXmlNode.addChildNode(this.writeStruct(memberSchema, val, xmlns));
|
|
1560
1558
|
}
|
|
1561
1559
|
else {
|
|
1562
|
-
const memberNode =
|
|
1560
|
+
const memberNode = XmlNode.of(memberSchema.getMergedTraits().xmlName ?? memberSchema.getMemberName());
|
|
1563
1561
|
this.writeSimpleInto(memberSchema, val, memberNode, xmlns);
|
|
1564
1562
|
structXmlNode.addChildNode(memberNode);
|
|
1565
1563
|
}
|
|
@@ -1568,9 +1566,9 @@ class XmlShapeSerializer extends SerdeContextConfig {
|
|
|
1568
1566
|
const { $unknown } = value;
|
|
1569
1567
|
if ($unknown && ns.isUnionSchema() && Array.isArray($unknown) && Object.keys(value).length === 1) {
|
|
1570
1568
|
const [k, v] = $unknown;
|
|
1571
|
-
const node =
|
|
1569
|
+
const node = XmlNode.of(k);
|
|
1572
1570
|
if (typeof v !== "string") {
|
|
1573
|
-
if (value instanceof
|
|
1571
|
+
if (value instanceof XmlNode || value instanceof XmlText) {
|
|
1574
1572
|
structXmlNode.addChildNode(value);
|
|
1575
1573
|
}
|
|
1576
1574
|
else {
|
|
@@ -1608,7 +1606,7 @@ class XmlShapeSerializer extends SerdeContextConfig {
|
|
|
1608
1606
|
container.addChildNode(struct.withName(flat ? listTraits.xmlName ?? listMember.getMemberName() : listValueTraits.xmlName ?? "member"));
|
|
1609
1607
|
}
|
|
1610
1608
|
else {
|
|
1611
|
-
const listItemNode =
|
|
1609
|
+
const listItemNode = XmlNode.of(flat ? listTraits.xmlName ?? listMember.getMemberName() : listValueTraits.xmlName ?? "member");
|
|
1612
1610
|
this.writeSimpleInto(listValueSchema, value, listItemNode, xmlns);
|
|
1613
1611
|
container.addChildNode(listItemNode);
|
|
1614
1612
|
}
|
|
@@ -1621,7 +1619,7 @@ class XmlShapeSerializer extends SerdeContextConfig {
|
|
|
1621
1619
|
}
|
|
1622
1620
|
}
|
|
1623
1621
|
else {
|
|
1624
|
-
const listNode =
|
|
1622
|
+
const listNode = XmlNode.of(listTraits.xmlName ?? listMember.getMemberName());
|
|
1625
1623
|
if (xmlns) {
|
|
1626
1624
|
listNode.addAttribute(xmlnsAttr, xmlns);
|
|
1627
1625
|
}
|
|
@@ -1648,13 +1646,13 @@ class XmlShapeSerializer extends SerdeContextConfig {
|
|
|
1648
1646
|
const flat = !!mapTraits.xmlFlattened;
|
|
1649
1647
|
const [xmlnsAttr, xmlns] = this.getXmlnsAttribute(mapMember, parentXmlns);
|
|
1650
1648
|
const addKeyValue = (entry, key, val) => {
|
|
1651
|
-
const keyNode =
|
|
1649
|
+
const keyNode = XmlNode.of(keyTag, key);
|
|
1652
1650
|
const [keyXmlnsAttr, keyXmlns] = this.getXmlnsAttribute(mapKeySchema, xmlns);
|
|
1653
1651
|
if (keyXmlns) {
|
|
1654
1652
|
keyNode.addAttribute(keyXmlnsAttr, keyXmlns);
|
|
1655
1653
|
}
|
|
1656
1654
|
entry.addChildNode(keyNode);
|
|
1657
|
-
let valueNode =
|
|
1655
|
+
let valueNode = XmlNode.of(valueTag);
|
|
1658
1656
|
if (mapValueSchema.isListSchema()) {
|
|
1659
1657
|
this.writeList(mapValueSchema, val, valueNode, xmlns);
|
|
1660
1658
|
}
|
|
@@ -1673,7 +1671,7 @@ class XmlShapeSerializer extends SerdeContextConfig {
|
|
|
1673
1671
|
for (const key in map) {
|
|
1674
1672
|
const val = map[key];
|
|
1675
1673
|
if (sparse || val != null) {
|
|
1676
|
-
const entry =
|
|
1674
|
+
const entry = XmlNode.of(mapTraits.xmlName ?? mapMember.getMemberName());
|
|
1677
1675
|
addKeyValue(entry, key, val);
|
|
1678
1676
|
container.addChildNode(entry);
|
|
1679
1677
|
}
|
|
@@ -1682,7 +1680,7 @@ class XmlShapeSerializer extends SerdeContextConfig {
|
|
|
1682
1680
|
else {
|
|
1683
1681
|
let mapNode;
|
|
1684
1682
|
if (!containerIsMap) {
|
|
1685
|
-
mapNode =
|
|
1683
|
+
mapNode = XmlNode.of(mapTraits.xmlName ?? mapMember.getMemberName());
|
|
1686
1684
|
if (xmlns) {
|
|
1687
1685
|
mapNode.addAttribute(xmlnsAttr, xmlns);
|
|
1688
1686
|
}
|
|
@@ -1691,7 +1689,7 @@ class XmlShapeSerializer extends SerdeContextConfig {
|
|
|
1691
1689
|
for (const key in map) {
|
|
1692
1690
|
const val = map[key];
|
|
1693
1691
|
if (sparse || val != null) {
|
|
1694
|
-
const entry =
|
|
1692
|
+
const entry = XmlNode.of("entry");
|
|
1695
1693
|
addKeyValue(entry, key, val);
|
|
1696
1694
|
(containerIsMap ? container : mapNode).addChildNode(entry);
|
|
1697
1695
|
}
|
|
@@ -1702,32 +1700,32 @@ class XmlShapeSerializer extends SerdeContextConfig {
|
|
|
1702
1700
|
if (null === value) {
|
|
1703
1701
|
throw new Error("@aws-sdk/core/protocols - (XML serializer) cannot write null value.");
|
|
1704
1702
|
}
|
|
1705
|
-
const ns =
|
|
1703
|
+
const ns = NormalizedSchema.of(_schema);
|
|
1706
1704
|
let nodeContents = null;
|
|
1707
1705
|
if (value && typeof value === "object") {
|
|
1708
1706
|
if (ns.isBlobSchema()) {
|
|
1709
|
-
nodeContents = (this.serdeContext?.base64Encoder ??
|
|
1707
|
+
nodeContents = (this.serdeContext?.base64Encoder ?? toBase64)(value);
|
|
1710
1708
|
}
|
|
1711
1709
|
else if (ns.isTimestampSchema() && value instanceof Date) {
|
|
1712
|
-
const format =
|
|
1710
|
+
const format = determineTimestampFormat(ns, this.settings);
|
|
1713
1711
|
switch (format) {
|
|
1714
1712
|
case 5:
|
|
1715
1713
|
nodeContents = value.toISOString().replace(".000Z", "Z");
|
|
1716
1714
|
break;
|
|
1717
1715
|
case 6:
|
|
1718
|
-
nodeContents =
|
|
1716
|
+
nodeContents = dateToUtcString(value);
|
|
1719
1717
|
break;
|
|
1720
1718
|
case 7:
|
|
1721
1719
|
nodeContents = String(value.getTime() / 1000);
|
|
1722
1720
|
break;
|
|
1723
1721
|
default:
|
|
1724
1722
|
console.warn("Missing timestamp format, using http date", value);
|
|
1725
|
-
nodeContents =
|
|
1723
|
+
nodeContents = dateToUtcString(value);
|
|
1726
1724
|
break;
|
|
1727
1725
|
}
|
|
1728
1726
|
}
|
|
1729
1727
|
else if (ns.isBigDecimalSchema() && value) {
|
|
1730
|
-
if (value instanceof
|
|
1728
|
+
if (value instanceof NumericValue) {
|
|
1731
1729
|
return value.string;
|
|
1732
1730
|
}
|
|
1733
1731
|
return String(value);
|
|
@@ -1744,7 +1742,7 @@ class XmlShapeSerializer extends SerdeContextConfig {
|
|
|
1744
1742
|
}
|
|
1745
1743
|
if (ns.isStringSchema()) {
|
|
1746
1744
|
if (value === undefined && ns.isIdempotencyToken()) {
|
|
1747
|
-
nodeContents =
|
|
1745
|
+
nodeContents = generateIdempotencyToken();
|
|
1748
1746
|
}
|
|
1749
1747
|
else {
|
|
1750
1748
|
nodeContents = String(value);
|
|
@@ -1757,8 +1755,8 @@ class XmlShapeSerializer extends SerdeContextConfig {
|
|
|
1757
1755
|
}
|
|
1758
1756
|
writeSimpleInto(_schema, value, into, parentXmlns) {
|
|
1759
1757
|
const nodeContents = this.writeSimple(_schema, value);
|
|
1760
|
-
const ns =
|
|
1761
|
-
const content = new
|
|
1758
|
+
const ns = NormalizedSchema.of(_schema);
|
|
1759
|
+
const content = new XmlText(nodeContents);
|
|
1762
1760
|
const [xmlnsAttr, xmlns] = this.getXmlnsAttribute(ns, parentXmlns);
|
|
1763
1761
|
if (xmlns) {
|
|
1764
1762
|
into.addAttribute(xmlnsAttr, xmlns);
|
|
@@ -1793,7 +1791,7 @@ class XmlCodec extends SerdeContextConfig {
|
|
|
1793
1791
|
}
|
|
1794
1792
|
}
|
|
1795
1793
|
|
|
1796
|
-
class AwsRestXmlProtocol extends
|
|
1794
|
+
class AwsRestXmlProtocol extends HttpBindingProtocol {
|
|
1797
1795
|
codec;
|
|
1798
1796
|
serializer;
|
|
1799
1797
|
deserializer;
|
|
@@ -1810,8 +1808,8 @@ class AwsRestXmlProtocol extends protocols.HttpBindingProtocol {
|
|
|
1810
1808
|
serviceNamespace: options.defaultNamespace,
|
|
1811
1809
|
};
|
|
1812
1810
|
this.codec = new XmlCodec(settings);
|
|
1813
|
-
this.serializer = new
|
|
1814
|
-
this.deserializer = new
|
|
1811
|
+
this.serializer = new HttpInterceptingShapeSerializer(this.codec.createSerializer(), settings);
|
|
1812
|
+
this.deserializer = new HttpInterceptingShapeDeserializer(this.codec.createDeserializer(), settings);
|
|
1815
1813
|
}
|
|
1816
1814
|
getPayloadCodec() {
|
|
1817
1815
|
return this.codec;
|
|
@@ -1821,7 +1819,7 @@ class AwsRestXmlProtocol extends protocols.HttpBindingProtocol {
|
|
|
1821
1819
|
}
|
|
1822
1820
|
async serializeRequest(operationSchema, input, context) {
|
|
1823
1821
|
const request = await super.serializeRequest(operationSchema, input, context);
|
|
1824
|
-
const inputSchema =
|
|
1822
|
+
const inputSchema = NormalizedSchema.of(operationSchema.input);
|
|
1825
1823
|
if (!request.headers["content-type"]) {
|
|
1826
1824
|
const contentType = this.mixin.resolveRestContentType(this.getDefaultContentType(), inputSchema);
|
|
1827
1825
|
if (contentType) {
|
|
@@ -1854,7 +1852,7 @@ class AwsRestXmlProtocol extends protocols.HttpBindingProtocol {
|
|
|
1854
1852
|
metadata.requestId = dataObject.RequestId;
|
|
1855
1853
|
}
|
|
1856
1854
|
const { errorSchema, errorMetadata } = await this.mixin.getErrorSchemaOrThrowBaseException(errorIdentifier, this.options.defaultNamespace, response, dataObject, metadata);
|
|
1857
|
-
const ns =
|
|
1855
|
+
const ns = NormalizedSchema.of(errorSchema);
|
|
1858
1856
|
const message = dataObject.Error?.message ??
|
|
1859
1857
|
dataObject.Error?.Message ??
|
|
1860
1858
|
dataObject.message ??
|