@cdk8s/awscdk-resolver 0.0.301 → 0.0.303
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/package.json +34 -34
- package/node_modules/@aws-sdk/client-sso/package.json +32 -32
- package/node_modules/@aws-sdk/core/package.json +10 -10
- 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 +4 -4
- 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/@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 +209 -0
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +667 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +771 -0
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +108 -53
- package/node_modules/@smithy/core/dist-es/submodules/cbor/CborCodec.js +136 -0
- package/node_modules/@smithy/core/dist-es/submodules/cbor/SmithyRpcV2CborProtocol.js +74 -0
- package/node_modules/@smithy/core/dist-es/submodules/cbor/index.js +3 -1
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js +183 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +164 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js +68 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/index.js +7 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/FromStringShapeDeserializer.js +64 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/HttpInterceptingShapeDeserializer.js +38 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/HttpInterceptingShapeSerializer.js +30 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/ToStringShapeSerializer.js +87 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/determineTimestampFormat.js +20 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/TypeRegistry.js +49 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/deref.js +6 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/index.js +12 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/middleware/getSchemaSerdePlugin.js +23 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/middleware/schema-middleware-types.js +1 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaDeserializationMiddleware.js +60 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaSerializationMiddleware.js +16 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/ErrorSchema.js +17 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/ListSchema.js +15 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/MapSchema.js +16 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/NormalizedSchema.js +291 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/OperationSchema.js +16 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/Schema.js +6 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/SimpleSchema.js +15 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/StructureSchema.js +22 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/sentinels.js +16 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/copyDocumentWithTransform.js +53 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/index.js +4 -3
- package/node_modules/@smithy/core/dist-types/submodules/cbor/CborCodec.d.ts +29 -0
- package/node_modules/@smithy/core/dist-types/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +22 -0
- package/node_modules/@smithy/core/dist-types/submodules/cbor/index.d.ts +3 -1
- package/node_modules/@smithy/core/dist-types/submodules/protocols/HttpBindingProtocol.d.ts +15 -0
- package/node_modules/@smithy/core/dist-types/submodules/protocols/HttpProtocol.d.ts +29 -0
- package/node_modules/@smithy/core/dist-types/submodules/protocols/RpcProtocol.d.ts +11 -0
- package/node_modules/@smithy/core/dist-types/submodules/protocols/index.d.ts +7 -0
- package/node_modules/@smithy/core/dist-types/submodules/protocols/serde/FromStringShapeDeserializer.d.ts +14 -0
- package/node_modules/@smithy/core/dist-types/submodules/protocols/serde/HttpInterceptingShapeDeserializer.d.ts +18 -0
- package/node_modules/@smithy/core/dist-types/submodules/protocols/serde/HttpInterceptingShapeSerializer.d.ts +20 -0
- package/node_modules/@smithy/core/dist-types/submodules/protocols/serde/ToStringShapeSerializer.d.ts +15 -0
- package/node_modules/@smithy/core/dist-types/submodules/protocols/serde/determineTimestampFormat.d.ts +9 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/TypeRegistry.d.ts +55 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/deref.d.ts +6 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/index.d.ts +12 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/middleware/getSchemaSerdePlugin.d.ts +14 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/middleware/schema-middleware-types.d.ts +8 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/middleware/schemaDeserializationMiddleware.d.ts +9 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/middleware/schemaSerializationMiddleware.d.ts +6 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/ErrorSchema.d.ts +38 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/ListSchema.d.ts +20 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/MapSchema.d.ts +25 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/NormalizedSchema.d.ts +122 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/OperationSchema.d.ts +20 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/Schema.d.ts +11 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/SimpleSchema.d.ts +20 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/StructureSchema.d.ts +21 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/sentinels.d.ts +21 -0
- package/node_modules/@smithy/core/dist-types/submodules/serde/copyDocumentWithTransform.d.ts +5 -0
- package/node_modules/@smithy/core/dist-types/submodules/serde/index.d.ts +4 -3
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/CborCodec.d.ts +29 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +22 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/index.d.ts +3 -1
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/HttpBindingProtocol.d.ts +15 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/HttpProtocol.d.ts +29 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/RpcProtocol.d.ts +11 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/index.d.ts +7 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/serde/FromStringShapeDeserializer.d.ts +14 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/serde/HttpInterceptingShapeDeserializer.d.ts +18 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/serde/HttpInterceptingShapeSerializer.d.ts +20 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/serde/ToStringShapeSerializer.d.ts +15 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/serde/determineTimestampFormat.d.ts +9 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/TypeRegistry.d.ts +55 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/deref.d.ts +6 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/index.d.ts +12 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/middleware/getSchemaSerdePlugin.d.ts +14 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/middleware/schema-middleware-types.d.ts +11 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/middleware/schemaDeserializationMiddleware.d.ts +9 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/middleware/schemaSerializationMiddleware.d.ts +6 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/ErrorSchema.d.ts +38 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/ListSchema.d.ts +20 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/MapSchema.d.ts +25 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/NormalizedSchema.d.ts +125 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/OperationSchema.d.ts +20 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/Schema.d.ts +11 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/SimpleSchema.d.ts +20 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/StructureSchema.d.ts +24 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/sentinels.d.ts +21 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/serde/copyDocumentWithTransform.d.ts +5 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/serde/index.d.ts +4 -3
- package/node_modules/@smithy/core/package.json +17 -7
- package/node_modules/@smithy/core/schema.d.ts +7 -0
- package/node_modules/@smithy/core/schema.js +6 -0
- 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 +8 -8
- package/node_modules/@smithy/middleware-serde/dist-types/deserializerMiddleware.d.ts +1 -0
- package/node_modules/@smithy/middleware-serde/dist-types/serdePlugin.d.ts +7 -1
- package/node_modules/@smithy/middleware-serde/dist-types/serializerMiddleware.d.ts +1 -0
- package/node_modules/@smithy/middleware-serde/dist-types/ts3.4/deserializerMiddleware.d.ts +1 -0
- package/node_modules/@smithy/middleware-serde/dist-types/ts3.4/serdePlugin.d.ts +7 -1
- package/node_modules/@smithy/middleware-serde/dist-types/ts3.4/serializerMiddleware.d.ts +1 -0
- 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 +10 -0
- package/node_modules/@smithy/smithy-client/dist-es/command.js +6 -0
- package/node_modules/@smithy/smithy-client/dist-types/command.d.ts +7 -1
- package/node_modules/@smithy/smithy-client/dist-types/ts3.4/command.d.ts +7 -1
- package/node_modules/@smithy/smithy-client/package.json +7 -7
- package/node_modules/@smithy/types/dist-types/command.d.ts +5 -2
- package/node_modules/@smithy/types/dist-types/schema/schema.d.ts +2 -4
- package/node_modules/@smithy/types/dist-types/ts3.4/command.d.ts +5 -2
- package/node_modules/@smithy/types/dist-types/ts3.4/schema/schema.d.ts +2 -4
- 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
@@ -19,8 +19,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
19
19
|
// src/submodules/protocols/index.ts
|
20
20
|
var protocols_exports = {};
|
21
21
|
__export(protocols_exports, {
|
22
|
+
FromStringShapeDeserializer: () => FromStringShapeDeserializer,
|
23
|
+
HttpBindingProtocol: () => HttpBindingProtocol,
|
24
|
+
HttpInterceptingShapeDeserializer: () => HttpInterceptingShapeDeserializer,
|
25
|
+
HttpInterceptingShapeSerializer: () => HttpInterceptingShapeSerializer,
|
22
26
|
RequestBuilder: () => RequestBuilder,
|
27
|
+
RpcProtocol: () => RpcProtocol,
|
28
|
+
ToStringShapeSerializer: () => ToStringShapeSerializer,
|
23
29
|
collectBody: () => collectBody,
|
30
|
+
determineTimestampFormat: () => determineTimestampFormat,
|
24
31
|
extendedEncodeURIComponent: () => extendedEncodeURIComponent,
|
25
32
|
requestBuilder: () => requestBuilder,
|
26
33
|
resolvedPath: () => resolvedPath
|
@@ -47,8 +54,418 @@ function extendedEncodeURIComponent(str) {
|
|
47
54
|
});
|
48
55
|
}
|
49
56
|
|
50
|
-
// src/submodules/protocols/
|
57
|
+
// src/submodules/protocols/HttpBindingProtocol.ts
|
58
|
+
var import_schema2 = require("@smithy/core/schema");
|
59
|
+
var import_protocol_http2 = require("@smithy/protocol-http");
|
60
|
+
|
61
|
+
// src/submodules/protocols/HttpProtocol.ts
|
62
|
+
var import_schema = require("@smithy/core/schema");
|
63
|
+
var import_serde = require("@smithy/core/serde");
|
51
64
|
var import_protocol_http = require("@smithy/protocol-http");
|
65
|
+
var import_util_stream2 = require("@smithy/util-stream");
|
66
|
+
var HttpProtocol = class {
|
67
|
+
constructor(options) {
|
68
|
+
this.options = options;
|
69
|
+
}
|
70
|
+
getRequestType() {
|
71
|
+
return import_protocol_http.HttpRequest;
|
72
|
+
}
|
73
|
+
getResponseType() {
|
74
|
+
return import_protocol_http.HttpResponse;
|
75
|
+
}
|
76
|
+
setSerdeContext(serdeContext) {
|
77
|
+
this.serdeContext = serdeContext;
|
78
|
+
this.serializer.setSerdeContext(serdeContext);
|
79
|
+
this.deserializer.setSerdeContext(serdeContext);
|
80
|
+
if (this.getPayloadCodec()) {
|
81
|
+
this.getPayloadCodec().setSerdeContext(serdeContext);
|
82
|
+
}
|
83
|
+
}
|
84
|
+
updateServiceEndpoint(request, endpoint) {
|
85
|
+
if ("url" in endpoint) {
|
86
|
+
request.protocol = endpoint.url.protocol;
|
87
|
+
request.hostname = endpoint.url.hostname;
|
88
|
+
request.port = endpoint.url.port ? Number(endpoint.url.port) : void 0;
|
89
|
+
request.path = endpoint.url.pathname;
|
90
|
+
request.fragment = endpoint.url.hash || void 0;
|
91
|
+
request.username = endpoint.url.username || void 0;
|
92
|
+
request.password = endpoint.url.password || void 0;
|
93
|
+
for (const [k, v] of endpoint.url.searchParams.entries()) {
|
94
|
+
if (!request.query) {
|
95
|
+
request.query = {};
|
96
|
+
}
|
97
|
+
request.query[k] = v;
|
98
|
+
}
|
99
|
+
return request;
|
100
|
+
} else {
|
101
|
+
request.protocol = endpoint.protocol;
|
102
|
+
request.hostname = endpoint.hostname;
|
103
|
+
request.port = endpoint.port ? Number(endpoint.port) : void 0;
|
104
|
+
request.path = endpoint.path;
|
105
|
+
request.query = {
|
106
|
+
...endpoint.query
|
107
|
+
};
|
108
|
+
return request;
|
109
|
+
}
|
110
|
+
}
|
111
|
+
setHostPrefix(request, operationSchema, input) {
|
112
|
+
const operationNs = import_schema.NormalizedSchema.of(operationSchema);
|
113
|
+
const inputNs = import_schema.NormalizedSchema.of(operationSchema.input);
|
114
|
+
if (operationNs.getMergedTraits().endpoint) {
|
115
|
+
let hostPrefix = operationNs.getMergedTraits().endpoint?.[0];
|
116
|
+
if (typeof hostPrefix === "string") {
|
117
|
+
const hostLabelInputs = [...inputNs.structIterator()].filter(
|
118
|
+
([, member]) => member.getMergedTraits().hostLabel
|
119
|
+
);
|
120
|
+
for (const [name] of hostLabelInputs) {
|
121
|
+
const replacement = input[name];
|
122
|
+
if (typeof replacement !== "string") {
|
123
|
+
throw new Error(`@smithy/core/schema - ${name} in input must be a string as hostLabel.`);
|
124
|
+
}
|
125
|
+
hostPrefix = hostPrefix.replace(`{${name}}`, replacement);
|
126
|
+
}
|
127
|
+
request.hostname = hostPrefix + request.hostname;
|
128
|
+
}
|
129
|
+
}
|
130
|
+
}
|
131
|
+
deserializeMetadata(output) {
|
132
|
+
return {
|
133
|
+
httpStatusCode: output.statusCode,
|
134
|
+
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
|
135
|
+
extendedRequestId: output.headers["x-amz-id-2"],
|
136
|
+
cfId: output.headers["x-amz-cf-id"]
|
137
|
+
};
|
138
|
+
}
|
139
|
+
async deserializeHttpMessage(schema, context, response, headerBindings, dataObject) {
|
140
|
+
const deserializer = this.deserializer;
|
141
|
+
const ns = import_schema.NormalizedSchema.of(schema);
|
142
|
+
const nonHttpBindingMembers = [];
|
143
|
+
for (const [memberName, memberSchema] of ns.structIterator()) {
|
144
|
+
const memberTraits = memberSchema.getMemberTraits();
|
145
|
+
if (memberTraits.httpPayload) {
|
146
|
+
const isStreaming = memberSchema.isStreaming();
|
147
|
+
if (isStreaming) {
|
148
|
+
const isEventStream = memberSchema.isStructSchema();
|
149
|
+
if (isEventStream) {
|
150
|
+
const context2 = this.serdeContext;
|
151
|
+
if (!context2.eventStreamMarshaller) {
|
152
|
+
throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");
|
153
|
+
}
|
154
|
+
const memberSchemas = memberSchema.getMemberSchemas();
|
155
|
+
dataObject[memberName] = context2.eventStreamMarshaller.deserialize(response.body, async (event) => {
|
156
|
+
const unionMember = Object.keys(event).find((key) => {
|
157
|
+
return key !== "__type";
|
158
|
+
}) ?? "";
|
159
|
+
if (unionMember in memberSchemas) {
|
160
|
+
const eventStreamSchema = memberSchemas[unionMember];
|
161
|
+
return {
|
162
|
+
[unionMember]: await deserializer.read(eventStreamSchema, event[unionMember].body)
|
163
|
+
};
|
164
|
+
} else {
|
165
|
+
return {
|
166
|
+
$unknown: event
|
167
|
+
};
|
168
|
+
}
|
169
|
+
});
|
170
|
+
} else {
|
171
|
+
dataObject[memberName] = (0, import_util_stream2.sdkStreamMixin)(response.body);
|
172
|
+
}
|
173
|
+
} else if (response.body) {
|
174
|
+
const bytes = await collectBody(response.body, context);
|
175
|
+
if (bytes.byteLength > 0) {
|
176
|
+
dataObject[memberName] = await deserializer.read(memberSchema, bytes);
|
177
|
+
}
|
178
|
+
}
|
179
|
+
} else if (memberTraits.httpHeader) {
|
180
|
+
const key = String(memberTraits.httpHeader).toLowerCase();
|
181
|
+
const value = response.headers[key];
|
182
|
+
if (null != value) {
|
183
|
+
if (memberSchema.isListSchema()) {
|
184
|
+
const headerListValueSchema = memberSchema.getValueSchema();
|
185
|
+
let sections;
|
186
|
+
if (headerListValueSchema.isTimestampSchema() && headerListValueSchema.getSchema() === import_schema.SCHEMA.TIMESTAMP_DEFAULT) {
|
187
|
+
sections = (0, import_serde.splitEvery)(value, ",", 2);
|
188
|
+
} else {
|
189
|
+
sections = (0, import_serde.splitHeader)(value);
|
190
|
+
}
|
191
|
+
const list = [];
|
192
|
+
for (const section of sections) {
|
193
|
+
list.push(await deserializer.read([headerListValueSchema, { httpHeader: key }], section.trim()));
|
194
|
+
}
|
195
|
+
dataObject[memberName] = list;
|
196
|
+
} else {
|
197
|
+
dataObject[memberName] = await deserializer.read(memberSchema, value);
|
198
|
+
}
|
199
|
+
}
|
200
|
+
} else if (memberTraits.httpPrefixHeaders !== void 0) {
|
201
|
+
dataObject[memberName] = {};
|
202
|
+
for (const [header, value] of Object.entries(response.headers)) {
|
203
|
+
if (!headerBindings.has(header) && header.startsWith(memberTraits.httpPrefixHeaders)) {
|
204
|
+
dataObject[memberName][header.slice(memberTraits.httpPrefixHeaders.length)] = await deserializer.read(
|
205
|
+
[memberSchema.getValueSchema(), { httpHeader: header }],
|
206
|
+
value
|
207
|
+
);
|
208
|
+
}
|
209
|
+
}
|
210
|
+
} else if (memberTraits.httpResponseCode) {
|
211
|
+
dataObject[memberName] = response.statusCode;
|
212
|
+
} else {
|
213
|
+
nonHttpBindingMembers.push(memberName);
|
214
|
+
}
|
215
|
+
}
|
216
|
+
return nonHttpBindingMembers;
|
217
|
+
}
|
218
|
+
};
|
219
|
+
|
220
|
+
// src/submodules/protocols/HttpBindingProtocol.ts
|
221
|
+
var HttpBindingProtocol = class extends HttpProtocol {
|
222
|
+
async serializeRequest(operationSchema, input, context) {
|
223
|
+
const serializer = this.serializer;
|
224
|
+
const query = {};
|
225
|
+
const headers = {};
|
226
|
+
const endpoint = await context.endpoint();
|
227
|
+
const ns = import_schema2.NormalizedSchema.of(operationSchema?.input);
|
228
|
+
const schema = ns.getSchema();
|
229
|
+
let hasNonHttpBindingMember = false;
|
230
|
+
let payload;
|
231
|
+
const request = new import_protocol_http2.HttpRequest({
|
232
|
+
protocol: "",
|
233
|
+
hostname: "",
|
234
|
+
port: void 0,
|
235
|
+
path: "",
|
236
|
+
fragment: void 0,
|
237
|
+
query,
|
238
|
+
headers,
|
239
|
+
body: void 0
|
240
|
+
});
|
241
|
+
if (endpoint) {
|
242
|
+
this.updateServiceEndpoint(request, endpoint);
|
243
|
+
this.setHostPrefix(request, operationSchema, input);
|
244
|
+
const opTraits = import_schema2.NormalizedSchema.translateTraits(operationSchema.traits);
|
245
|
+
if (opTraits.http) {
|
246
|
+
request.method = opTraits.http[0];
|
247
|
+
const [path, search] = opTraits.http[1].split("?");
|
248
|
+
if (request.path == "/") {
|
249
|
+
request.path = path;
|
250
|
+
} else {
|
251
|
+
request.path += path;
|
252
|
+
}
|
253
|
+
const traitSearchParams = new URLSearchParams(search ?? "");
|
254
|
+
Object.assign(query, Object.fromEntries(traitSearchParams));
|
255
|
+
}
|
256
|
+
}
|
257
|
+
const _input = {
|
258
|
+
...input
|
259
|
+
};
|
260
|
+
for (const memberName of Object.keys(_input)) {
|
261
|
+
const memberNs = ns.getMemberSchema(memberName);
|
262
|
+
if (memberNs === void 0) {
|
263
|
+
continue;
|
264
|
+
}
|
265
|
+
const memberTraits = memberNs.getMergedTraits();
|
266
|
+
const inputMember = _input[memberName];
|
267
|
+
if (memberTraits.httpPayload) {
|
268
|
+
const isStreaming = memberNs.isStreaming();
|
269
|
+
if (isStreaming) {
|
270
|
+
const isEventStream = memberNs.isStructSchema();
|
271
|
+
if (isEventStream) {
|
272
|
+
throw new Error("serialization of event streams is not yet implemented");
|
273
|
+
} else {
|
274
|
+
payload = inputMember;
|
275
|
+
}
|
276
|
+
} else {
|
277
|
+
serializer.write(memberNs, inputMember);
|
278
|
+
payload = serializer.flush();
|
279
|
+
}
|
280
|
+
} else if (memberTraits.httpLabel) {
|
281
|
+
serializer.write(memberNs, inputMember);
|
282
|
+
const replacement = serializer.flush();
|
283
|
+
if (request.path.includes(`{${memberName}+}`)) {
|
284
|
+
request.path = request.path.replace(
|
285
|
+
`{${memberName}+}`,
|
286
|
+
replacement.split("/").map(extendedEncodeURIComponent).join("/")
|
287
|
+
);
|
288
|
+
} else if (request.path.includes(`{${memberName}}`)) {
|
289
|
+
request.path = request.path.replace(`{${memberName}}`, extendedEncodeURIComponent(replacement));
|
290
|
+
}
|
291
|
+
delete _input[memberName];
|
292
|
+
} else if (memberTraits.httpHeader) {
|
293
|
+
serializer.write(memberNs, inputMember);
|
294
|
+
headers[memberTraits.httpHeader.toLowerCase()] = String(serializer.flush());
|
295
|
+
delete _input[memberName];
|
296
|
+
} else if (typeof memberTraits.httpPrefixHeaders === "string") {
|
297
|
+
for (const [key, val] of Object.entries(inputMember)) {
|
298
|
+
const amalgam = memberTraits.httpPrefixHeaders + key;
|
299
|
+
serializer.write([memberNs.getValueSchema(), { httpHeader: amalgam }], val);
|
300
|
+
headers[amalgam.toLowerCase()] = serializer.flush();
|
301
|
+
}
|
302
|
+
delete _input[memberName];
|
303
|
+
} else if (memberTraits.httpQuery || memberTraits.httpQueryParams) {
|
304
|
+
this.serializeQuery(memberNs, inputMember, query);
|
305
|
+
delete _input[memberName];
|
306
|
+
} else {
|
307
|
+
hasNonHttpBindingMember = true;
|
308
|
+
}
|
309
|
+
}
|
310
|
+
if (hasNonHttpBindingMember && input) {
|
311
|
+
serializer.write(schema, _input);
|
312
|
+
payload = serializer.flush();
|
313
|
+
}
|
314
|
+
request.headers = headers;
|
315
|
+
request.query = query;
|
316
|
+
request.body = payload;
|
317
|
+
return request;
|
318
|
+
}
|
319
|
+
serializeQuery(ns, data, query) {
|
320
|
+
const serializer = this.serializer;
|
321
|
+
const traits = ns.getMergedTraits();
|
322
|
+
if (traits.httpQueryParams) {
|
323
|
+
for (const [key, val] of Object.entries(data)) {
|
324
|
+
if (!(key in query)) {
|
325
|
+
this.serializeQuery(
|
326
|
+
import_schema2.NormalizedSchema.of([
|
327
|
+
ns.getValueSchema(),
|
328
|
+
{
|
329
|
+
// We pass on the traits to the sub-schema
|
330
|
+
// because we are still in the process of serializing the map itself.
|
331
|
+
...traits,
|
332
|
+
httpQuery: key,
|
333
|
+
httpQueryParams: void 0
|
334
|
+
}
|
335
|
+
]),
|
336
|
+
val,
|
337
|
+
query
|
338
|
+
);
|
339
|
+
}
|
340
|
+
}
|
341
|
+
return;
|
342
|
+
}
|
343
|
+
if (ns.isListSchema()) {
|
344
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
345
|
+
const buffer = [];
|
346
|
+
for (const item of data) {
|
347
|
+
serializer.write([ns.getValueSchema(), traits], item);
|
348
|
+
const serializable = serializer.flush();
|
349
|
+
if (sparse || serializable !== void 0) {
|
350
|
+
buffer.push(serializable);
|
351
|
+
}
|
352
|
+
}
|
353
|
+
query[traits.httpQuery] = buffer;
|
354
|
+
} else {
|
355
|
+
serializer.write([ns, traits], data);
|
356
|
+
query[traits.httpQuery] = serializer.flush();
|
357
|
+
}
|
358
|
+
}
|
359
|
+
async deserializeResponse(operationSchema, context, response) {
|
360
|
+
const deserializer = this.deserializer;
|
361
|
+
const ns = import_schema2.NormalizedSchema.of(operationSchema.output);
|
362
|
+
const dataObject = {};
|
363
|
+
if (response.statusCode >= 300) {
|
364
|
+
const bytes = await collectBody(response.body, context);
|
365
|
+
if (bytes.byteLength > 0) {
|
366
|
+
Object.assign(dataObject, await deserializer.read(import_schema2.SCHEMA.DOCUMENT, bytes));
|
367
|
+
}
|
368
|
+
await this.handleError(operationSchema, context, response, dataObject, this.deserializeMetadata(response));
|
369
|
+
throw new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.");
|
370
|
+
}
|
371
|
+
for (const header in response.headers) {
|
372
|
+
const value = response.headers[header];
|
373
|
+
delete response.headers[header];
|
374
|
+
response.headers[header.toLowerCase()] = value;
|
375
|
+
}
|
376
|
+
const headerBindings = new Set(
|
377
|
+
Object.values(ns.getMemberSchemas()).map((schema) => {
|
378
|
+
return schema.getMergedTraits().httpHeader;
|
379
|
+
}).filter(Boolean)
|
380
|
+
);
|
381
|
+
const nonHttpBindingMembers = await this.deserializeHttpMessage(ns, context, response, headerBindings, dataObject);
|
382
|
+
if (nonHttpBindingMembers.length) {
|
383
|
+
const bytes = await collectBody(response.body, context);
|
384
|
+
if (bytes.byteLength > 0) {
|
385
|
+
const dataFromBody = await deserializer.read(ns, bytes);
|
386
|
+
for (const member of nonHttpBindingMembers) {
|
387
|
+
dataObject[member] = dataFromBody[member];
|
388
|
+
}
|
389
|
+
}
|
390
|
+
}
|
391
|
+
const output = {
|
392
|
+
$metadata: this.deserializeMetadata(response),
|
393
|
+
...dataObject
|
394
|
+
};
|
395
|
+
return output;
|
396
|
+
}
|
397
|
+
};
|
398
|
+
|
399
|
+
// src/submodules/protocols/RpcProtocol.ts
|
400
|
+
var import_schema3 = require("@smithy/core/schema");
|
401
|
+
var import_protocol_http3 = require("@smithy/protocol-http");
|
402
|
+
var RpcProtocol = class extends HttpProtocol {
|
403
|
+
async serializeRequest(operationSchema, input, context) {
|
404
|
+
const serializer = this.serializer;
|
405
|
+
const query = {};
|
406
|
+
const headers = {};
|
407
|
+
const endpoint = await context.endpoint();
|
408
|
+
const ns = import_schema3.NormalizedSchema.of(operationSchema?.input);
|
409
|
+
const schema = ns.getSchema();
|
410
|
+
let payload;
|
411
|
+
const request = new import_protocol_http3.HttpRequest({
|
412
|
+
protocol: "",
|
413
|
+
hostname: "",
|
414
|
+
port: void 0,
|
415
|
+
path: "/",
|
416
|
+
fragment: void 0,
|
417
|
+
query,
|
418
|
+
headers,
|
419
|
+
body: void 0
|
420
|
+
});
|
421
|
+
if (endpoint) {
|
422
|
+
this.updateServiceEndpoint(request, endpoint);
|
423
|
+
this.setHostPrefix(request, operationSchema, input);
|
424
|
+
}
|
425
|
+
const _input = {
|
426
|
+
...input
|
427
|
+
};
|
428
|
+
if (input) {
|
429
|
+
serializer.write(schema, _input);
|
430
|
+
payload = serializer.flush();
|
431
|
+
}
|
432
|
+
request.headers = headers;
|
433
|
+
request.query = query;
|
434
|
+
request.body = payload;
|
435
|
+
request.method = "POST";
|
436
|
+
return request;
|
437
|
+
}
|
438
|
+
async deserializeResponse(operationSchema, context, response) {
|
439
|
+
const deserializer = this.deserializer;
|
440
|
+
const ns = import_schema3.NormalizedSchema.of(operationSchema.output);
|
441
|
+
const dataObject = {};
|
442
|
+
if (response.statusCode >= 300) {
|
443
|
+
const bytes2 = await collectBody(response.body, context);
|
444
|
+
if (bytes2.byteLength > 0) {
|
445
|
+
Object.assign(dataObject, await deserializer.read(import_schema3.SCHEMA.DOCUMENT, bytes2));
|
446
|
+
}
|
447
|
+
await this.handleError(operationSchema, context, response, dataObject, this.deserializeMetadata(response));
|
448
|
+
throw new Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.");
|
449
|
+
}
|
450
|
+
for (const header in response.headers) {
|
451
|
+
const value = response.headers[header];
|
452
|
+
delete response.headers[header];
|
453
|
+
response.headers[header.toLowerCase()] = value;
|
454
|
+
}
|
455
|
+
const bytes = await collectBody(response.body, context);
|
456
|
+
if (bytes.byteLength > 0) {
|
457
|
+
Object.assign(dataObject, await deserializer.read(ns, bytes));
|
458
|
+
}
|
459
|
+
const output = {
|
460
|
+
$metadata: this.deserializeMetadata(response),
|
461
|
+
...dataObject
|
462
|
+
};
|
463
|
+
return output;
|
464
|
+
}
|
465
|
+
};
|
466
|
+
|
467
|
+
// src/submodules/protocols/requestBuilder.ts
|
468
|
+
var import_protocol_http4 = require("@smithy/protocol-http");
|
52
469
|
|
53
470
|
// src/submodules/protocols/resolve-path.ts
|
54
471
|
var resolvedPath = (resolvedPath2, input, memberName, labelValueProvider, uriLabel, isGreedyLabel) => {
|
@@ -89,7 +506,7 @@ var RequestBuilder = class {
|
|
89
506
|
for (const resolvePath of this.resolvePathStack) {
|
90
507
|
resolvePath(this.path);
|
91
508
|
}
|
92
|
-
return new
|
509
|
+
return new import_protocol_http4.HttpRequest({
|
93
510
|
protocol,
|
94
511
|
hostname: this.hostname || hostname,
|
95
512
|
port,
|
@@ -154,10 +571,258 @@ var RequestBuilder = class {
|
|
154
571
|
return this;
|
155
572
|
}
|
156
573
|
};
|
574
|
+
|
575
|
+
// src/submodules/protocols/serde/FromStringShapeDeserializer.ts
|
576
|
+
var import_schema5 = require("@smithy/core/schema");
|
577
|
+
var import_serde2 = require("@smithy/core/serde");
|
578
|
+
var import_util_base64 = require("@smithy/util-base64");
|
579
|
+
var import_util_utf8 = require("@smithy/util-utf8");
|
580
|
+
|
581
|
+
// src/submodules/protocols/serde/determineTimestampFormat.ts
|
582
|
+
var import_schema4 = require("@smithy/core/schema");
|
583
|
+
function determineTimestampFormat(ns, settings) {
|
584
|
+
if (settings.timestampFormat.useTrait) {
|
585
|
+
if (ns.isTimestampSchema() && (ns.getSchema() === import_schema4.SCHEMA.TIMESTAMP_DATE_TIME || ns.getSchema() === import_schema4.SCHEMA.TIMESTAMP_HTTP_DATE || ns.getSchema() === import_schema4.SCHEMA.TIMESTAMP_EPOCH_SECONDS)) {
|
586
|
+
return ns.getSchema();
|
587
|
+
}
|
588
|
+
}
|
589
|
+
const { httpLabel, httpPrefixHeaders, httpHeader, httpQuery } = ns.getMergedTraits();
|
590
|
+
const bindingFormat = settings.httpBindings ? typeof httpPrefixHeaders === "string" || Boolean(httpHeader) ? import_schema4.SCHEMA.TIMESTAMP_HTTP_DATE : Boolean(httpQuery) || Boolean(httpLabel) ? import_schema4.SCHEMA.TIMESTAMP_DATE_TIME : void 0 : void 0;
|
591
|
+
return bindingFormat ?? settings.timestampFormat.default;
|
592
|
+
}
|
593
|
+
|
594
|
+
// src/submodules/protocols/serde/FromStringShapeDeserializer.ts
|
595
|
+
var FromStringShapeDeserializer = class {
|
596
|
+
constructor(settings) {
|
597
|
+
this.settings = settings;
|
598
|
+
}
|
599
|
+
setSerdeContext(serdeContext) {
|
600
|
+
this.serdeContext = serdeContext;
|
601
|
+
}
|
602
|
+
read(_schema, data) {
|
603
|
+
const ns = import_schema5.NormalizedSchema.of(_schema);
|
604
|
+
if (ns.isListSchema()) {
|
605
|
+
return (0, import_serde2.splitHeader)(data).map((item) => this.read(ns.getValueSchema(), item));
|
606
|
+
}
|
607
|
+
if (ns.isBlobSchema()) {
|
608
|
+
return (this.serdeContext?.base64Decoder ?? import_util_base64.fromBase64)(data);
|
609
|
+
}
|
610
|
+
if (ns.isTimestampSchema()) {
|
611
|
+
const format = determineTimestampFormat(ns, this.settings);
|
612
|
+
switch (format) {
|
613
|
+
case import_schema5.SCHEMA.TIMESTAMP_DATE_TIME:
|
614
|
+
return (0, import_serde2.parseRfc3339DateTimeWithOffset)(data);
|
615
|
+
case import_schema5.SCHEMA.TIMESTAMP_HTTP_DATE:
|
616
|
+
return (0, import_serde2.parseRfc7231DateTime)(data);
|
617
|
+
case import_schema5.SCHEMA.TIMESTAMP_EPOCH_SECONDS:
|
618
|
+
return (0, import_serde2.parseEpochTimestamp)(data);
|
619
|
+
default:
|
620
|
+
console.warn("Missing timestamp format, parsing value with Date constructor:", data);
|
621
|
+
return new Date(data);
|
622
|
+
}
|
623
|
+
}
|
624
|
+
if (ns.isStringSchema()) {
|
625
|
+
const mediaType = ns.getMergedTraits().mediaType;
|
626
|
+
let intermediateValue = data;
|
627
|
+
if (mediaType) {
|
628
|
+
if (ns.getMergedTraits().httpHeader) {
|
629
|
+
intermediateValue = this.base64ToUtf8(intermediateValue);
|
630
|
+
}
|
631
|
+
const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
|
632
|
+
if (isJson) {
|
633
|
+
intermediateValue = import_serde2.LazyJsonString.from(intermediateValue);
|
634
|
+
}
|
635
|
+
return intermediateValue;
|
636
|
+
}
|
637
|
+
}
|
638
|
+
switch (true) {
|
639
|
+
case ns.isNumericSchema():
|
640
|
+
return Number(data);
|
641
|
+
case ns.isBigIntegerSchema():
|
642
|
+
return BigInt(data);
|
643
|
+
case ns.isBigDecimalSchema():
|
644
|
+
return new import_serde2.NumericValue(data, "bigDecimal");
|
645
|
+
case ns.isBooleanSchema():
|
646
|
+
return String(data).toLowerCase() === "true";
|
647
|
+
}
|
648
|
+
return data;
|
649
|
+
}
|
650
|
+
base64ToUtf8(base64String) {
|
651
|
+
return (this.serdeContext?.utf8Encoder ?? import_util_utf8.toUtf8)((this.serdeContext?.base64Decoder ?? import_util_base64.fromBase64)(base64String));
|
652
|
+
}
|
653
|
+
};
|
654
|
+
|
655
|
+
// src/submodules/protocols/serde/HttpInterceptingShapeDeserializer.ts
|
656
|
+
var import_schema6 = require("@smithy/core/schema");
|
657
|
+
var import_util_utf82 = require("@smithy/util-utf8");
|
658
|
+
var HttpInterceptingShapeDeserializer = class {
|
659
|
+
constructor(codecDeserializer, codecSettings) {
|
660
|
+
this.codecDeserializer = codecDeserializer;
|
661
|
+
this.stringDeserializer = new FromStringShapeDeserializer(codecSettings);
|
662
|
+
}
|
663
|
+
setSerdeContext(serdeContext) {
|
664
|
+
this.stringDeserializer.setSerdeContext(serdeContext);
|
665
|
+
this.codecDeserializer.setSerdeContext(serdeContext);
|
666
|
+
this.serdeContext = serdeContext;
|
667
|
+
}
|
668
|
+
read(schema, data) {
|
669
|
+
const ns = import_schema6.NormalizedSchema.of(schema);
|
670
|
+
const traits = ns.getMergedTraits();
|
671
|
+
const toString = this.serdeContext?.utf8Encoder ?? import_util_utf82.toUtf8;
|
672
|
+
if (traits.httpHeader || traits.httpResponseCode) {
|
673
|
+
return this.stringDeserializer.read(ns, toString(data));
|
674
|
+
}
|
675
|
+
if (traits.httpPayload) {
|
676
|
+
if (ns.isBlobSchema()) {
|
677
|
+
const toBytes = this.serdeContext?.utf8Decoder ?? import_util_utf82.fromUtf8;
|
678
|
+
if (typeof data === "string") {
|
679
|
+
return toBytes(data);
|
680
|
+
}
|
681
|
+
return data;
|
682
|
+
} else if (ns.isStringSchema()) {
|
683
|
+
if ("byteLength" in data) {
|
684
|
+
return toString(data);
|
685
|
+
}
|
686
|
+
return data;
|
687
|
+
}
|
688
|
+
}
|
689
|
+
return this.codecDeserializer.read(ns, data);
|
690
|
+
}
|
691
|
+
};
|
692
|
+
|
693
|
+
// src/submodules/protocols/serde/HttpInterceptingShapeSerializer.ts
|
694
|
+
var import_schema8 = require("@smithy/core/schema");
|
695
|
+
|
696
|
+
// src/submodules/protocols/serde/ToStringShapeSerializer.ts
|
697
|
+
var import_schema7 = require("@smithy/core/schema");
|
698
|
+
var import_serde3 = require("@smithy/core/serde");
|
699
|
+
var import_util_base642 = require("@smithy/util-base64");
|
700
|
+
var ToStringShapeSerializer = class {
|
701
|
+
constructor(settings) {
|
702
|
+
this.settings = settings;
|
703
|
+
this.stringBuffer = "";
|
704
|
+
this.serdeContext = void 0;
|
705
|
+
}
|
706
|
+
setSerdeContext(serdeContext) {
|
707
|
+
this.serdeContext = serdeContext;
|
708
|
+
}
|
709
|
+
write(schema, value) {
|
710
|
+
const ns = import_schema7.NormalizedSchema.of(schema);
|
711
|
+
switch (typeof value) {
|
712
|
+
case "object":
|
713
|
+
if (value === null) {
|
714
|
+
this.stringBuffer = "null";
|
715
|
+
return;
|
716
|
+
}
|
717
|
+
if (ns.isTimestampSchema()) {
|
718
|
+
if (!(value instanceof Date)) {
|
719
|
+
throw new Error(
|
720
|
+
`@smithy/core/protocols - received non-Date value ${value} when schema expected Date in ${ns.getName(true)}`
|
721
|
+
);
|
722
|
+
}
|
723
|
+
const format = determineTimestampFormat(ns, this.settings);
|
724
|
+
switch (format) {
|
725
|
+
case import_schema7.SCHEMA.TIMESTAMP_DATE_TIME:
|
726
|
+
this.stringBuffer = value.toISOString().replace(".000Z", "Z");
|
727
|
+
break;
|
728
|
+
case import_schema7.SCHEMA.TIMESTAMP_HTTP_DATE:
|
729
|
+
this.stringBuffer = (0, import_serde3.dateToUtcString)(value);
|
730
|
+
break;
|
731
|
+
case import_schema7.SCHEMA.TIMESTAMP_EPOCH_SECONDS:
|
732
|
+
this.stringBuffer = String(value.getTime() / 1e3);
|
733
|
+
break;
|
734
|
+
default:
|
735
|
+
console.warn("Missing timestamp format, using epoch seconds", value);
|
736
|
+
this.stringBuffer = String(value.getTime() / 1e3);
|
737
|
+
}
|
738
|
+
return;
|
739
|
+
}
|
740
|
+
if (ns.isBlobSchema() && "byteLength" in value) {
|
741
|
+
this.stringBuffer = (this.serdeContext?.base64Encoder ?? import_util_base642.toBase64)(value);
|
742
|
+
return;
|
743
|
+
}
|
744
|
+
if (ns.isListSchema() && Array.isArray(value)) {
|
745
|
+
let buffer = "";
|
746
|
+
for (const item of value) {
|
747
|
+
this.write([ns.getValueSchema(), ns.getMergedTraits()], item);
|
748
|
+
const headerItem = this.flush();
|
749
|
+
const serialized = ns.getValueSchema().isTimestampSchema() ? headerItem : (0, import_serde3.quoteHeader)(headerItem);
|
750
|
+
if (buffer !== "") {
|
751
|
+
buffer += ", ";
|
752
|
+
}
|
753
|
+
buffer += serialized;
|
754
|
+
}
|
755
|
+
this.stringBuffer = buffer;
|
756
|
+
return;
|
757
|
+
}
|
758
|
+
this.stringBuffer = JSON.stringify(value, null, 2);
|
759
|
+
break;
|
760
|
+
case "string":
|
761
|
+
const mediaType = ns.getMergedTraits().mediaType;
|
762
|
+
let intermediateValue = value;
|
763
|
+
if (mediaType) {
|
764
|
+
const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
|
765
|
+
if (isJson) {
|
766
|
+
intermediateValue = import_serde3.LazyJsonString.from(intermediateValue);
|
767
|
+
}
|
768
|
+
if (ns.getMergedTraits().httpHeader) {
|
769
|
+
this.stringBuffer = (this.serdeContext?.base64Encoder ?? import_util_base642.toBase64)(intermediateValue.toString());
|
770
|
+
return;
|
771
|
+
}
|
772
|
+
}
|
773
|
+
this.stringBuffer = value;
|
774
|
+
break;
|
775
|
+
default:
|
776
|
+
this.stringBuffer = String(value);
|
777
|
+
}
|
778
|
+
}
|
779
|
+
flush() {
|
780
|
+
const buffer = this.stringBuffer;
|
781
|
+
this.stringBuffer = "";
|
782
|
+
return buffer;
|
783
|
+
}
|
784
|
+
};
|
785
|
+
|
786
|
+
// src/submodules/protocols/serde/HttpInterceptingShapeSerializer.ts
|
787
|
+
var HttpInterceptingShapeSerializer = class {
|
788
|
+
constructor(codecSerializer, codecSettings, stringSerializer = new ToStringShapeSerializer(codecSettings)) {
|
789
|
+
this.codecSerializer = codecSerializer;
|
790
|
+
this.stringSerializer = stringSerializer;
|
791
|
+
}
|
792
|
+
setSerdeContext(serdeContext) {
|
793
|
+
this.codecSerializer.setSerdeContext(serdeContext);
|
794
|
+
this.stringSerializer.setSerdeContext(serdeContext);
|
795
|
+
}
|
796
|
+
write(schema, value) {
|
797
|
+
const ns = import_schema8.NormalizedSchema.of(schema);
|
798
|
+
const traits = ns.getMergedTraits();
|
799
|
+
if (traits.httpHeader || traits.httpLabel || traits.httpQuery) {
|
800
|
+
this.stringSerializer.write(ns, value);
|
801
|
+
this.buffer = this.stringSerializer.flush();
|
802
|
+
return;
|
803
|
+
}
|
804
|
+
return this.codecSerializer.write(ns, value);
|
805
|
+
}
|
806
|
+
flush() {
|
807
|
+
if (this.buffer !== void 0) {
|
808
|
+
const buffer = this.buffer;
|
809
|
+
this.buffer = void 0;
|
810
|
+
return buffer;
|
811
|
+
}
|
812
|
+
return this.codecSerializer.flush();
|
813
|
+
}
|
814
|
+
};
|
157
815
|
// Annotate the CommonJS export names for ESM import in node:
|
158
816
|
0 && (module.exports = {
|
817
|
+
FromStringShapeDeserializer,
|
818
|
+
HttpBindingProtocol,
|
819
|
+
HttpInterceptingShapeDeserializer,
|
820
|
+
HttpInterceptingShapeSerializer,
|
159
821
|
RequestBuilder,
|
822
|
+
RpcProtocol,
|
823
|
+
ToStringShapeSerializer,
|
160
824
|
collectBody,
|
825
|
+
determineTimestampFormat,
|
161
826
|
extendedEncodeURIComponent,
|
162
827
|
requestBuilder,
|
163
828
|
resolvedPath
|