@cdk8s/awscdk-resolver 0.0.334 → 0.0.336
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 +4 -4
- package/lib/resolve.js +1 -1
- package/node_modules/@aws-sdk/client-cloudformation/package.json +34 -34
- package/node_modules/@aws-sdk/client-sso/package.json +32 -32
- 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 +13 -13
- 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 +6 -6
- 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/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/node_modules/@smithy/abort-controller/package.json +2 -2
- package/node_modules/@smithy/config-resolver/package.json +4 -4
- package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +77 -38
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +88 -85
- package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +12 -0
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +6 -51
- package/node_modules/@smithy/core/dist-es/submodules/cbor/CborCodec.js +77 -41
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js +95 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +7 -95
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/NormalizedSchema.js +9 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/copyDocumentWithTransform.js +1 -53
- package/node_modules/@smithy/core/dist-es/submodules/serde/generateIdempotencyToken.js +2 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/index.js +1 -0
- package/node_modules/@smithy/core/dist-types/submodules/cbor/CborCodec.d.ts +5 -0
- package/node_modules/@smithy/core/dist-types/submodules/protocols/HttpBindingProtocol.d.ts +9 -1
- package/node_modules/@smithy/core/dist-types/submodules/protocols/HttpProtocol.d.ts +3 -1
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/NormalizedSchema.d.ts +5 -0
- package/node_modules/@smithy/core/dist-types/submodules/serde/copyDocumentWithTransform.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/submodules/serde/generateIdempotencyToken.d.ts +2 -0
- package/node_modules/@smithy/core/dist-types/submodules/serde/index.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/CborCodec.d.ts +5 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/HttpBindingProtocol.d.ts +9 -1
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/HttpProtocol.d.ts +3 -1
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/NormalizedSchema.d.ts +5 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/serde/copyDocumentWithTransform.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/serde/generateIdempotencyToken.d.ts +2 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/serde/index.d.ts +1 -0
- package/node_modules/@smithy/core/package.json +9 -7
- package/node_modules/@smithy/credential-provider-imds/package.json +5 -5
- package/node_modules/@smithy/fetch-http-handler/package.json +5 -5
- package/node_modules/@smithy/hash-node/package.json +2 -2
- package/node_modules/@smithy/invalid-dependency/package.json +2 -2
- package/node_modules/@smithy/middleware-content-length/package.json +3 -3
- package/node_modules/@smithy/middleware-endpoint/package.json +8 -8
- package/node_modules/@smithy/middleware-retry/package.json +9 -9
- package/node_modules/@smithy/middleware-serde/package.json +3 -3
- package/node_modules/@smithy/middleware-stack/package.json +2 -2
- package/node_modules/@smithy/node-config-provider/package.json +4 -4
- package/node_modules/@smithy/node-http-handler/package.json +5 -5
- package/node_modules/@smithy/property-provider/package.json +2 -2
- package/node_modules/@smithy/protocol-http/package.json +2 -2
- package/node_modules/@smithy/querystring-builder/package.json +2 -2
- package/node_modules/@smithy/querystring-parser/package.json +2 -2
- package/node_modules/@smithy/service-error-classification/package.json +2 -2
- package/node_modules/@smithy/shared-ini-file-loader/package.json +2 -2
- package/node_modules/@smithy/signature-v4/package.json +4 -4
- package/node_modules/@smithy/smithy-client/dist-cjs/index.js +1 -0
- package/node_modules/@smithy/smithy-client/package.json +7 -7
- package/node_modules/@smithy/types/dist-types/schema/schema.d.ts +1 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/schema/schema.d.ts +1 -0
- package/node_modules/@smithy/types/package.json +1 -1
- package/node_modules/@smithy/url-parser/package.json +3 -3
- package/node_modules/@smithy/util-defaults-mode-browser/package.json +4 -4
- package/node_modules/@smithy/util-defaults-mode-node/package.json +7 -7
- package/node_modules/@smithy/util-endpoints/package.json +3 -3
- package/node_modules/@smithy/util-middleware/package.json +2 -2
- package/node_modules/@smithy/util-retry/package.json +3 -3
- package/node_modules/@smithy/util-stream/package.json +4 -4
- package/node_modules/@smithy/util-waiter/package.json +3 -3
- package/package.json +6 -6
@@ -35,6 +35,7 @@ __export(serde_exports, {
|
|
35
35
|
expectShort: () => expectShort,
|
36
36
|
expectString: () => expectString,
|
37
37
|
expectUnion: () => expectUnion,
|
38
|
+
generateIdempotencyToken: () => import_uuid.v4,
|
38
39
|
handleFloat: () => handleFloat,
|
39
40
|
limitedParseDouble: () => limitedParseDouble,
|
40
41
|
limitedParseFloat: () => limitedParseFloat,
|
@@ -61,57 +62,7 @@ __export(serde_exports, {
|
|
61
62
|
module.exports = __toCommonJS(serde_exports);
|
62
63
|
|
63
64
|
// src/submodules/serde/copyDocumentWithTransform.ts
|
64
|
-
var
|
65
|
-
var copyDocumentWithTransform = (source, schemaRef, transform = (_) => _) => {
|
66
|
-
const ns = import_schema.NormalizedSchema.of(schemaRef);
|
67
|
-
switch (typeof source) {
|
68
|
-
case "undefined":
|
69
|
-
case "boolean":
|
70
|
-
case "number":
|
71
|
-
case "string":
|
72
|
-
case "bigint":
|
73
|
-
case "symbol":
|
74
|
-
return transform(source, ns);
|
75
|
-
case "function":
|
76
|
-
case "object":
|
77
|
-
if (source === null) {
|
78
|
-
return transform(null, ns);
|
79
|
-
}
|
80
|
-
if (Array.isArray(source)) {
|
81
|
-
const newArray = new Array(source.length);
|
82
|
-
let i = 0;
|
83
|
-
for (const item of source) {
|
84
|
-
newArray[i++] = copyDocumentWithTransform(item, ns.getValueSchema(), transform);
|
85
|
-
}
|
86
|
-
return transform(newArray, ns);
|
87
|
-
}
|
88
|
-
if ("byteLength" in source) {
|
89
|
-
const newBytes = new Uint8Array(source.byteLength);
|
90
|
-
newBytes.set(source, 0);
|
91
|
-
return transform(newBytes, ns);
|
92
|
-
}
|
93
|
-
if (source instanceof Date) {
|
94
|
-
return transform(source, ns);
|
95
|
-
}
|
96
|
-
const newObject = {};
|
97
|
-
if (ns.isMapSchema()) {
|
98
|
-
for (const key of Object.keys(source)) {
|
99
|
-
newObject[key] = copyDocumentWithTransform(source[key], ns.getValueSchema(), transform);
|
100
|
-
}
|
101
|
-
} else if (ns.isStructSchema()) {
|
102
|
-
for (const [key, memberSchema] of ns.structIterator()) {
|
103
|
-
newObject[key] = copyDocumentWithTransform(source[key], memberSchema, transform);
|
104
|
-
}
|
105
|
-
} else if (ns.isDocumentSchema()) {
|
106
|
-
for (const key of Object.keys(source)) {
|
107
|
-
newObject[key] = copyDocumentWithTransform(source[key], ns.getValueSchema(), transform);
|
108
|
-
}
|
109
|
-
}
|
110
|
-
return transform(newObject, ns);
|
111
|
-
default:
|
112
|
-
return transform(source, ns);
|
113
|
-
}
|
114
|
-
};
|
65
|
+
var copyDocumentWithTransform = (source, schemaRef, transform = (_) => _) => source;
|
115
66
|
|
116
67
|
// src/submodules/serde/parse-utils.ts
|
117
68
|
var parseBoolean = (value) => {
|
@@ -566,6 +517,9 @@ var stripLeadingZeroes = (value) => {
|
|
566
517
|
return value.slice(idx);
|
567
518
|
};
|
568
519
|
|
520
|
+
// src/submodules/serde/generateIdempotencyToken.ts
|
521
|
+
var import_uuid = require("uuid");
|
522
|
+
|
569
523
|
// src/submodules/serde/lazy-json.ts
|
570
524
|
var LazyJsonString = function LazyJsonString2(val) {
|
571
525
|
const str = Object.assign(new String(val), {
|
@@ -730,6 +684,7 @@ function nv(input) {
|
|
730
684
|
expectShort,
|
731
685
|
expectString,
|
732
686
|
expectUnion,
|
687
|
+
generateIdempotencyToken,
|
733
688
|
handleFloat,
|
734
689
|
limitedParseDouble,
|
735
690
|
limitedParseFloat,
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { NormalizedSchema } from "@smithy/core/schema";
|
2
|
-
import {
|
2
|
+
import { generateIdempotencyToken, parseEpochTimestamp } from "@smithy/core/serde";
|
3
|
+
import { fromBase64 } from "@smithy/util-base64";
|
3
4
|
import { cbor } from "./cbor";
|
4
5
|
import { dateToTag } from "./parseCborBody";
|
5
6
|
export class CborCodec {
|
@@ -22,36 +23,71 @@ export class CborShapeSerializer {
|
|
22
23
|
this.serdeContext = serdeContext;
|
23
24
|
}
|
24
25
|
write(schema, value) {
|
25
|
-
this.value =
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
26
|
+
this.value = this.serialize(schema, value);
|
27
|
+
}
|
28
|
+
serialize(schema, source) {
|
29
|
+
const ns = NormalizedSchema.of(schema);
|
30
|
+
if (source == null) {
|
31
|
+
if (ns.isIdempotencyToken()) {
|
32
|
+
return generateIdempotencyToken();
|
33
|
+
}
|
34
|
+
return source;
|
35
|
+
}
|
36
|
+
if (ns.isBlobSchema()) {
|
37
|
+
if (typeof source === "string") {
|
38
|
+
return (this.serdeContext?.base64Decoder ?? fromBase64)(source);
|
39
|
+
}
|
40
|
+
return source;
|
41
|
+
}
|
42
|
+
if (ns.isTimestampSchema()) {
|
43
|
+
if (typeof source === "number" || typeof source === "bigint") {
|
44
|
+
return dateToTag(new Date((Number(source) / 1000) | 0));
|
45
|
+
}
|
46
|
+
return dateToTag(source);
|
47
|
+
}
|
48
|
+
if (typeof source === "function" || typeof source === "object") {
|
49
|
+
const sourceObject = source;
|
50
|
+
if (ns.isListSchema() && Array.isArray(sourceObject)) {
|
51
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
52
|
+
const newArray = [];
|
53
|
+
let i = 0;
|
54
|
+
for (const item of sourceObject) {
|
55
|
+
const value = this.serialize(ns.getValueSchema(), item);
|
56
|
+
if (value != null || sparse) {
|
57
|
+
newArray[i++] = value;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
return newArray;
|
61
|
+
}
|
62
|
+
if (sourceObject instanceof Date) {
|
63
|
+
return dateToTag(sourceObject);
|
64
|
+
}
|
65
|
+
const newObject = {};
|
66
|
+
if (ns.isMapSchema()) {
|
67
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
68
|
+
for (const key of Object.keys(sourceObject)) {
|
69
|
+
const value = this.serialize(ns.getValueSchema(), sourceObject[key]);
|
70
|
+
if (value != null || sparse) {
|
71
|
+
newObject[key] = value;
|
72
|
+
}
|
37
73
|
}
|
38
74
|
}
|
39
|
-
else if (
|
40
|
-
const
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
const filteredOutByNonSparse = !sparse && v == null;
|
45
|
-
const filteredOutByUnrecognizedMember = isStruct && !(k in members);
|
46
|
-
if (filteredOutByNonSparse || filteredOutByUnrecognizedMember) {
|
47
|
-
delete _[k];
|
48
|
-
}
|
75
|
+
else if (ns.isStructSchema()) {
|
76
|
+
for (const [key, memberSchema] of ns.structIterator()) {
|
77
|
+
const value = this.serialize(memberSchema, sourceObject[key]);
|
78
|
+
if (value != null) {
|
79
|
+
newObject[key] = value;
|
49
80
|
}
|
50
|
-
return _;
|
51
81
|
}
|
52
82
|
}
|
53
|
-
|
54
|
-
|
83
|
+
else if (ns.isDocumentSchema()) {
|
84
|
+
for (const key of Object.keys(sourceObject)) {
|
85
|
+
newObject[key] = this.serialize(ns.getValueSchema(), sourceObject[key]);
|
86
|
+
}
|
87
|
+
}
|
88
|
+
return newObject;
|
89
|
+
}
|
90
|
+
return source;
|
55
91
|
}
|
56
92
|
flush() {
|
57
93
|
const buffer = cbor.serialize(this.value);
|
@@ -69,14 +105,14 @@ export class CborShapeDeserializer {
|
|
69
105
|
}
|
70
106
|
readValue(_schema, value) {
|
71
107
|
const ns = NormalizedSchema.of(_schema);
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
return value;
|
108
|
+
if (ns.isTimestampSchema() && typeof value === "number") {
|
109
|
+
return parseEpochTimestamp(value);
|
110
|
+
}
|
111
|
+
if (ns.isBlobSchema()) {
|
112
|
+
if (typeof value === "string") {
|
113
|
+
return (this.serdeContext?.base64Decoder ?? fromBase64)(value);
|
79
114
|
}
|
115
|
+
return value;
|
80
116
|
}
|
81
117
|
if (typeof value === "undefined" ||
|
82
118
|
typeof value === "boolean" ||
|
@@ -102,23 +138,23 @@ export class CborShapeDeserializer {
|
|
102
138
|
if (ns.isListSchema()) {
|
103
139
|
const newArray = [];
|
104
140
|
const memberSchema = ns.getValueSchema();
|
105
|
-
const sparse =
|
141
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
106
142
|
for (const item of value) {
|
107
|
-
|
108
|
-
if (
|
109
|
-
newArray.
|
143
|
+
const itemValue = this.readValue(memberSchema, item);
|
144
|
+
if (itemValue != null || sparse) {
|
145
|
+
newArray.push(itemValue);
|
110
146
|
}
|
111
147
|
}
|
112
148
|
return newArray;
|
113
149
|
}
|
114
150
|
const newObject = {};
|
115
151
|
if (ns.isMapSchema()) {
|
116
|
-
const sparse = ns.getMergedTraits().sparse;
|
152
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
117
153
|
const targetSchema = ns.getValueSchema();
|
118
154
|
for (const key of Object.keys(value)) {
|
119
|
-
|
120
|
-
if (
|
121
|
-
|
155
|
+
const itemValue = this.readValue(targetSchema, value[key]);
|
156
|
+
if (itemValue != null || sparse) {
|
157
|
+
newObject[key] = itemValue;
|
122
158
|
}
|
123
159
|
}
|
124
160
|
}
|
@@ -1,5 +1,7 @@
|
|
1
1
|
import { NormalizedSchema, SCHEMA } from "@smithy/core/schema";
|
2
|
+
import { splitEvery, splitHeader } from "@smithy/core/serde";
|
2
3
|
import { HttpRequest } from "@smithy/protocol-http";
|
4
|
+
import { sdkStreamMixin } from "@smithy/util-stream";
|
3
5
|
import { collectBody } from "./collect-stream-body";
|
4
6
|
import { extendedEncodeURIComponent } from "./extended-encode-uri-component";
|
5
7
|
import { HttpProtocol } from "./HttpProtocol";
|
@@ -175,4 +177,97 @@ export class HttpBindingProtocol extends HttpProtocol {
|
|
175
177
|
};
|
176
178
|
return output;
|
177
179
|
}
|
180
|
+
async deserializeHttpMessage(schema, context, response, arg4, arg5) {
|
181
|
+
let dataObject;
|
182
|
+
if (arg4 instanceof Set) {
|
183
|
+
dataObject = arg5;
|
184
|
+
}
|
185
|
+
else {
|
186
|
+
dataObject = arg4;
|
187
|
+
}
|
188
|
+
const deserializer = this.deserializer;
|
189
|
+
const ns = NormalizedSchema.of(schema);
|
190
|
+
const nonHttpBindingMembers = [];
|
191
|
+
for (const [memberName, memberSchema] of ns.structIterator()) {
|
192
|
+
const memberTraits = memberSchema.getMemberTraits();
|
193
|
+
if (memberTraits.httpPayload) {
|
194
|
+
const isStreaming = memberSchema.isStreaming();
|
195
|
+
if (isStreaming) {
|
196
|
+
const isEventStream = memberSchema.isStructSchema();
|
197
|
+
if (isEventStream) {
|
198
|
+
const context = this.serdeContext;
|
199
|
+
if (!context.eventStreamMarshaller) {
|
200
|
+
throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");
|
201
|
+
}
|
202
|
+
const memberSchemas = memberSchema.getMemberSchemas();
|
203
|
+
dataObject[memberName] = context.eventStreamMarshaller.deserialize(response.body, async (event) => {
|
204
|
+
const unionMember = Object.keys(event).find((key) => {
|
205
|
+
return key !== "__type";
|
206
|
+
}) ?? "";
|
207
|
+
if (unionMember in memberSchemas) {
|
208
|
+
const eventStreamSchema = memberSchemas[unionMember];
|
209
|
+
return {
|
210
|
+
[unionMember]: await deserializer.read(eventStreamSchema, event[unionMember].body),
|
211
|
+
};
|
212
|
+
}
|
213
|
+
else {
|
214
|
+
return {
|
215
|
+
$unknown: event,
|
216
|
+
};
|
217
|
+
}
|
218
|
+
});
|
219
|
+
}
|
220
|
+
else {
|
221
|
+
dataObject[memberName] = sdkStreamMixin(response.body);
|
222
|
+
}
|
223
|
+
}
|
224
|
+
else if (response.body) {
|
225
|
+
const bytes = await collectBody(response.body, context);
|
226
|
+
if (bytes.byteLength > 0) {
|
227
|
+
dataObject[memberName] = await deserializer.read(memberSchema, bytes);
|
228
|
+
}
|
229
|
+
}
|
230
|
+
}
|
231
|
+
else if (memberTraits.httpHeader) {
|
232
|
+
const key = String(memberTraits.httpHeader).toLowerCase();
|
233
|
+
const value = response.headers[key];
|
234
|
+
if (null != value) {
|
235
|
+
if (memberSchema.isListSchema()) {
|
236
|
+
const headerListValueSchema = memberSchema.getValueSchema();
|
237
|
+
let sections;
|
238
|
+
if (headerListValueSchema.isTimestampSchema() &&
|
239
|
+
headerListValueSchema.getSchema() === SCHEMA.TIMESTAMP_DEFAULT) {
|
240
|
+
sections = splitEvery(value, ",", 2);
|
241
|
+
}
|
242
|
+
else {
|
243
|
+
sections = splitHeader(value);
|
244
|
+
}
|
245
|
+
const list = [];
|
246
|
+
for (const section of sections) {
|
247
|
+
list.push(await deserializer.read([headerListValueSchema, { httpHeader: key }], section.trim()));
|
248
|
+
}
|
249
|
+
dataObject[memberName] = list;
|
250
|
+
}
|
251
|
+
else {
|
252
|
+
dataObject[memberName] = await deserializer.read(memberSchema, value);
|
253
|
+
}
|
254
|
+
}
|
255
|
+
}
|
256
|
+
else if (memberTraits.httpPrefixHeaders !== undefined) {
|
257
|
+
dataObject[memberName] = {};
|
258
|
+
for (const [header, value] of Object.entries(response.headers)) {
|
259
|
+
if (header.startsWith(memberTraits.httpPrefixHeaders)) {
|
260
|
+
dataObject[memberName][header.slice(memberTraits.httpPrefixHeaders.length)] = await deserializer.read([memberSchema.getValueSchema(), { httpHeader: header }], value);
|
261
|
+
}
|
262
|
+
}
|
263
|
+
}
|
264
|
+
else if (memberTraits.httpResponseCode) {
|
265
|
+
dataObject[memberName] = response.statusCode;
|
266
|
+
}
|
267
|
+
else {
|
268
|
+
nonHttpBindingMembers.push(memberName);
|
269
|
+
}
|
270
|
+
}
|
271
|
+
return nonHttpBindingMembers;
|
272
|
+
}
|
178
273
|
}
|
@@ -1,8 +1,5 @@
|
|
1
|
-
import { NormalizedSchema
|
2
|
-
import { splitEvery, splitHeader } from "@smithy/core/serde";
|
1
|
+
import { NormalizedSchema } from "@smithy/core/schema";
|
3
2
|
import { HttpRequest, HttpResponse } from "@smithy/protocol-http";
|
4
|
-
import { sdkStreamMixin } from "@smithy/util-stream";
|
5
|
-
import { collectBody } from "./collect-stream-body";
|
6
3
|
export class HttpProtocol {
|
7
4
|
constructor(options) {
|
8
5
|
this.options = options;
|
@@ -76,96 +73,11 @@ export class HttpProtocol {
|
|
76
73
|
};
|
77
74
|
}
|
78
75
|
async deserializeHttpMessage(schema, context, response, arg4, arg5) {
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
}
|
86
|
-
const deserializer = this.deserializer;
|
87
|
-
const ns = NormalizedSchema.of(schema);
|
88
|
-
const nonHttpBindingMembers = [];
|
89
|
-
for (const [memberName, memberSchema] of ns.structIterator()) {
|
90
|
-
const memberTraits = memberSchema.getMemberTraits();
|
91
|
-
if (memberTraits.httpPayload) {
|
92
|
-
const isStreaming = memberSchema.isStreaming();
|
93
|
-
if (isStreaming) {
|
94
|
-
const isEventStream = memberSchema.isStructSchema();
|
95
|
-
if (isEventStream) {
|
96
|
-
const context = this.serdeContext;
|
97
|
-
if (!context.eventStreamMarshaller) {
|
98
|
-
throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");
|
99
|
-
}
|
100
|
-
const memberSchemas = memberSchema.getMemberSchemas();
|
101
|
-
dataObject[memberName] = context.eventStreamMarshaller.deserialize(response.body, async (event) => {
|
102
|
-
const unionMember = Object.keys(event).find((key) => {
|
103
|
-
return key !== "__type";
|
104
|
-
}) ?? "";
|
105
|
-
if (unionMember in memberSchemas) {
|
106
|
-
const eventStreamSchema = memberSchemas[unionMember];
|
107
|
-
return {
|
108
|
-
[unionMember]: await deserializer.read(eventStreamSchema, event[unionMember].body),
|
109
|
-
};
|
110
|
-
}
|
111
|
-
else {
|
112
|
-
return {
|
113
|
-
$unknown: event,
|
114
|
-
};
|
115
|
-
}
|
116
|
-
});
|
117
|
-
}
|
118
|
-
else {
|
119
|
-
dataObject[memberName] = sdkStreamMixin(response.body);
|
120
|
-
}
|
121
|
-
}
|
122
|
-
else if (response.body) {
|
123
|
-
const bytes = await collectBody(response.body, context);
|
124
|
-
if (bytes.byteLength > 0) {
|
125
|
-
dataObject[memberName] = await deserializer.read(memberSchema, bytes);
|
126
|
-
}
|
127
|
-
}
|
128
|
-
}
|
129
|
-
else if (memberTraits.httpHeader) {
|
130
|
-
const key = String(memberTraits.httpHeader).toLowerCase();
|
131
|
-
const value = response.headers[key];
|
132
|
-
if (null != value) {
|
133
|
-
if (memberSchema.isListSchema()) {
|
134
|
-
const headerListValueSchema = memberSchema.getValueSchema();
|
135
|
-
let sections;
|
136
|
-
if (headerListValueSchema.isTimestampSchema() &&
|
137
|
-
headerListValueSchema.getSchema() === SCHEMA.TIMESTAMP_DEFAULT) {
|
138
|
-
sections = splitEvery(value, ",", 2);
|
139
|
-
}
|
140
|
-
else {
|
141
|
-
sections = splitHeader(value);
|
142
|
-
}
|
143
|
-
const list = [];
|
144
|
-
for (const section of sections) {
|
145
|
-
list.push(await deserializer.read([headerListValueSchema, { httpHeader: key }], section.trim()));
|
146
|
-
}
|
147
|
-
dataObject[memberName] = list;
|
148
|
-
}
|
149
|
-
else {
|
150
|
-
dataObject[memberName] = await deserializer.read(memberSchema, value);
|
151
|
-
}
|
152
|
-
}
|
153
|
-
}
|
154
|
-
else if (memberTraits.httpPrefixHeaders !== undefined) {
|
155
|
-
dataObject[memberName] = {};
|
156
|
-
for (const [header, value] of Object.entries(response.headers)) {
|
157
|
-
if (header.startsWith(memberTraits.httpPrefixHeaders)) {
|
158
|
-
dataObject[memberName][header.slice(memberTraits.httpPrefixHeaders.length)] = await deserializer.read([memberSchema.getValueSchema(), { httpHeader: header }], value);
|
159
|
-
}
|
160
|
-
}
|
161
|
-
}
|
162
|
-
else if (memberTraits.httpResponseCode) {
|
163
|
-
dataObject[memberName] = response.statusCode;
|
164
|
-
}
|
165
|
-
else {
|
166
|
-
nonHttpBindingMembers.push(memberName);
|
167
|
-
}
|
168
|
-
}
|
169
|
-
return nonHttpBindingMembers;
|
76
|
+
void schema;
|
77
|
+
void context;
|
78
|
+
void response;
|
79
|
+
void arg4;
|
80
|
+
void arg5;
|
81
|
+
return [];
|
170
82
|
}
|
171
83
|
}
|
@@ -183,6 +183,15 @@ export class NormalizedSchema {
|
|
183
183
|
}
|
184
184
|
return this.getSchema() === SCHEMA.STREAMING_BLOB;
|
185
185
|
}
|
186
|
+
isIdempotencyToken() {
|
187
|
+
if (typeof this.traits === "number") {
|
188
|
+
return (this.traits & 0b0100) === 0b0100;
|
189
|
+
}
|
190
|
+
else if (typeof this.traits === "object") {
|
191
|
+
return !!this.traits.idempotencyToken;
|
192
|
+
}
|
193
|
+
return false;
|
194
|
+
}
|
186
195
|
getMergedTraits() {
|
187
196
|
if (this.normalizedTraits) {
|
188
197
|
return this.normalizedTraits;
|
@@ -1,53 +1 @@
|
|
1
|
-
|
2
|
-
export const copyDocumentWithTransform = (source, schemaRef, transform = (_) => _) => {
|
3
|
-
const ns = NormalizedSchema.of(schemaRef);
|
4
|
-
switch (typeof source) {
|
5
|
-
case "undefined":
|
6
|
-
case "boolean":
|
7
|
-
case "number":
|
8
|
-
case "string":
|
9
|
-
case "bigint":
|
10
|
-
case "symbol":
|
11
|
-
return transform(source, ns);
|
12
|
-
case "function":
|
13
|
-
case "object":
|
14
|
-
if (source === null) {
|
15
|
-
return transform(null, ns);
|
16
|
-
}
|
17
|
-
if (Array.isArray(source)) {
|
18
|
-
const newArray = new Array(source.length);
|
19
|
-
let i = 0;
|
20
|
-
for (const item of source) {
|
21
|
-
newArray[i++] = copyDocumentWithTransform(item, ns.getValueSchema(), transform);
|
22
|
-
}
|
23
|
-
return transform(newArray, ns);
|
24
|
-
}
|
25
|
-
if ("byteLength" in source) {
|
26
|
-
const newBytes = new Uint8Array(source.byteLength);
|
27
|
-
newBytes.set(source, 0);
|
28
|
-
return transform(newBytes, ns);
|
29
|
-
}
|
30
|
-
if (source instanceof Date) {
|
31
|
-
return transform(source, ns);
|
32
|
-
}
|
33
|
-
const newObject = {};
|
34
|
-
if (ns.isMapSchema()) {
|
35
|
-
for (const key of Object.keys(source)) {
|
36
|
-
newObject[key] = copyDocumentWithTransform(source[key], ns.getValueSchema(), transform);
|
37
|
-
}
|
38
|
-
}
|
39
|
-
else if (ns.isStructSchema()) {
|
40
|
-
for (const [key, memberSchema] of ns.structIterator()) {
|
41
|
-
newObject[key] = copyDocumentWithTransform(source[key], memberSchema, transform);
|
42
|
-
}
|
43
|
-
}
|
44
|
-
else if (ns.isDocumentSchema()) {
|
45
|
-
for (const key of Object.keys(source)) {
|
46
|
-
newObject[key] = copyDocumentWithTransform(source[key], ns.getValueSchema(), transform);
|
47
|
-
}
|
48
|
-
}
|
49
|
-
return transform(newObject, ns);
|
50
|
-
default:
|
51
|
-
return transform(source, ns);
|
52
|
-
}
|
53
|
-
};
|
1
|
+
export const copyDocumentWithTransform = (source, schemaRef, transform = (_) => _) => source;
|
@@ -16,6 +16,11 @@ export declare class CborShapeSerializer implements ShapeSerializer {
|
|
16
16
|
private value;
|
17
17
|
setSerdeContext(serdeContext: SerdeFunctions): void;
|
18
18
|
write(schema: Schema, value: unknown): void;
|
19
|
+
/**
|
20
|
+
* Recursive serializer transform that copies and prepares the user input object
|
21
|
+
* for CBOR serialization.
|
22
|
+
*/
|
23
|
+
serialize(schema: Schema, source: unknown): any;
|
19
24
|
flush(): Uint8Array;
|
20
25
|
}
|
21
26
|
/**
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { NormalizedSchema } from "@smithy/core/schema";
|
2
2
|
import { HttpRequest } from "@smithy/protocol-http";
|
3
|
-
import { EndpointBearer, HandlerExecutionContext, HttpRequest as IHttpRequest, HttpResponse as IHttpResponse, MetadataBearer, OperationSchema, SerdeFunctions } from "@smithy/types";
|
3
|
+
import { EndpointBearer, HandlerExecutionContext, HttpRequest as IHttpRequest, HttpResponse as IHttpResponse, MetadataBearer, OperationSchema, Schema, SerdeFunctions } from "@smithy/types";
|
4
4
|
import { HttpProtocol } from "./HttpProtocol";
|
5
5
|
/**
|
6
6
|
* Base for HTTP-binding protocols. Downstream examples
|
@@ -12,4 +12,12 @@ export declare abstract class HttpBindingProtocol extends HttpProtocol {
|
|
12
12
|
serializeRequest<Input extends object>(operationSchema: OperationSchema, _input: Input, context: HandlerExecutionContext & SerdeFunctions & EndpointBearer): Promise<IHttpRequest>;
|
13
13
|
protected serializeQuery(ns: NormalizedSchema, data: any, query: HttpRequest["query"]): void;
|
14
14
|
deserializeResponse<Output extends MetadataBearer>(operationSchema: OperationSchema, context: HandlerExecutionContext & SerdeFunctions, response: IHttpResponse): Promise<Output>;
|
15
|
+
/**
|
16
|
+
* The base method ignores HTTP bindings.
|
17
|
+
*
|
18
|
+
* @deprecated (only this signature) use signature without headerBindings.
|
19
|
+
* @override
|
20
|
+
*/
|
21
|
+
protected deserializeHttpMessage(schema: Schema, context: HandlerExecutionContext & SerdeFunctions, response: IHttpResponse, headerBindings: Set<string>, dataObject: any): Promise<string[]>;
|
22
|
+
protected deserializeHttpMessage(schema: Schema, context: HandlerExecutionContext & SerdeFunctions, response: IHttpResponse, dataObject: any): Promise<string[]>;
|
15
23
|
}
|
@@ -26,7 +26,9 @@ export declare abstract class HttpProtocol implements ClientProtocol<IHttpReques
|
|
26
26
|
protected abstract handleError(operationSchema: OperationSchema, context: HandlerExecutionContext & SerdeFunctions, response: IHttpResponse, dataObject: any, metadata: ResponseMetadata): Promise<never>;
|
27
27
|
protected deserializeMetadata(output: IHttpResponse): ResponseMetadata;
|
28
28
|
/**
|
29
|
-
*
|
29
|
+
* For HTTP binding protocols, this method is overridden in {@link HttpBindingProtocol}.
|
30
|
+
*
|
31
|
+
* @deprecated only use this for HTTP binding protocols.
|
30
32
|
*/
|
31
33
|
protected deserializeHttpMessage(schema: Schema, context: HandlerExecutionContext & SerdeFunctions, response: IHttpResponse, headerBindings: Set<string>, dataObject: any): Promise<string[]>;
|
32
34
|
protected deserializeHttpMessage(schema: Schema, context: HandlerExecutionContext & SerdeFunctions, response: IHttpResponse, dataObject: any): Promise<string[]>;
|
package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/NormalizedSchema.d.ts
CHANGED
@@ -66,6 +66,11 @@ export declare class NormalizedSchema implements INormalizedSchema {
|
|
66
66
|
isBigIntegerSchema(): boolean;
|
67
67
|
isBigDecimalSchema(): boolean;
|
68
68
|
isStreaming(): boolean;
|
69
|
+
/**
|
70
|
+
* This is a shortcut to avoid calling `getMergedTraits().idempotencyToken` on every string.
|
71
|
+
* @returns whether the schema has the idempotencyToken trait.
|
72
|
+
*/
|
73
|
+
isIdempotencyToken(): boolean;
|
69
74
|
/**
|
70
75
|
* @returns own traits merged with member traits, where member traits of the same trait key take priority.
|
71
76
|
* This method is cached.
|
package/node_modules/@smithy/core/dist-types/submodules/serde/copyDocumentWithTransform.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import { SchemaRef } from "@smithy/types";
|
2
2
|
/**
|
3
3
|
* @internal
|
4
|
+
* @deprecated the former functionality has been internalized to the CborCodec.
|
4
5
|
*/
|
5
6
|
export declare const copyDocumentWithTransform: (source: any, schemaRef: SchemaRef, transform?: (_: any, schemaRef: SchemaRef) => any) => any;
|
@@ -16,6 +16,11 @@ export declare class CborShapeSerializer implements ShapeSerializer {
|
|
16
16
|
private value;
|
17
17
|
setSerdeContext(serdeContext: SerdeFunctions): void;
|
18
18
|
write(schema: Schema, value: unknown): void;
|
19
|
+
/**
|
20
|
+
* Recursive serializer transform that copies and prepares the user input object
|
21
|
+
* for CBOR serialization.
|
22
|
+
*/
|
23
|
+
serialize(schema: Schema, source: unknown): any;
|
19
24
|
flush(): Uint8Array;
|
20
25
|
}
|
21
26
|
/**
|
package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/HttpBindingProtocol.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { NormalizedSchema } from "@smithy/core/schema";
|
2
2
|
import { HttpRequest } from "@smithy/protocol-http";
|
3
|
-
import { EndpointBearer, HandlerExecutionContext, HttpRequest as IHttpRequest, HttpResponse as IHttpResponse, MetadataBearer, OperationSchema, SerdeFunctions } from "@smithy/types";
|
3
|
+
import { EndpointBearer, HandlerExecutionContext, HttpRequest as IHttpRequest, HttpResponse as IHttpResponse, MetadataBearer, OperationSchema, Schema, SerdeFunctions } from "@smithy/types";
|
4
4
|
import { HttpProtocol } from "./HttpProtocol";
|
5
5
|
/**
|
6
6
|
* Base for HTTP-binding protocols. Downstream examples
|
@@ -12,4 +12,12 @@ export declare abstract class HttpBindingProtocol extends HttpProtocol {
|
|
12
12
|
serializeRequest<Input extends object>(operationSchema: OperationSchema, _input: Input, context: HandlerExecutionContext & SerdeFunctions & EndpointBearer): Promise<IHttpRequest>;
|
13
13
|
protected serializeQuery(ns: NormalizedSchema, data: any, query: HttpRequest["query"]): void;
|
14
14
|
deserializeResponse<Output extends MetadataBearer>(operationSchema: OperationSchema, context: HandlerExecutionContext & SerdeFunctions, response: IHttpResponse): Promise<Output>;
|
15
|
+
/**
|
16
|
+
* The base method ignores HTTP bindings.
|
17
|
+
*
|
18
|
+
* @deprecated (only this signature) use signature without headerBindings.
|
19
|
+
* @override
|
20
|
+
*/
|
21
|
+
protected deserializeHttpMessage(schema: Schema, context: HandlerExecutionContext & SerdeFunctions, response: IHttpResponse, headerBindings: Set<string>, dataObject: any): Promise<string[]>;
|
22
|
+
protected deserializeHttpMessage(schema: Schema, context: HandlerExecutionContext & SerdeFunctions, response: IHttpResponse, dataObject: any): Promise<string[]>;
|
15
23
|
}
|