@cdk8s/awscdk-resolver 0.0.300 → 0.0.302
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/@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 +5 -5
@@ -0,0 +1,164 @@
|
|
1
|
+
import { NormalizedSchema, SCHEMA } from "@smithy/core/schema";
|
2
|
+
import { splitEvery, splitHeader } from "@smithy/core/serde";
|
3
|
+
import { HttpRequest, HttpResponse } from "@smithy/protocol-http";
|
4
|
+
import { sdkStreamMixin } from "@smithy/util-stream";
|
5
|
+
import { collectBody } from "./collect-stream-body";
|
6
|
+
export class HttpProtocol {
|
7
|
+
constructor(options) {
|
8
|
+
this.options = options;
|
9
|
+
}
|
10
|
+
getRequestType() {
|
11
|
+
return HttpRequest;
|
12
|
+
}
|
13
|
+
getResponseType() {
|
14
|
+
return HttpResponse;
|
15
|
+
}
|
16
|
+
setSerdeContext(serdeContext) {
|
17
|
+
this.serdeContext = serdeContext;
|
18
|
+
this.serializer.setSerdeContext(serdeContext);
|
19
|
+
this.deserializer.setSerdeContext(serdeContext);
|
20
|
+
if (this.getPayloadCodec()) {
|
21
|
+
this.getPayloadCodec().setSerdeContext(serdeContext);
|
22
|
+
}
|
23
|
+
}
|
24
|
+
updateServiceEndpoint(request, endpoint) {
|
25
|
+
if ("url" in endpoint) {
|
26
|
+
request.protocol = endpoint.url.protocol;
|
27
|
+
request.hostname = endpoint.url.hostname;
|
28
|
+
request.port = endpoint.url.port ? Number(endpoint.url.port) : undefined;
|
29
|
+
request.path = endpoint.url.pathname;
|
30
|
+
request.fragment = endpoint.url.hash || void 0;
|
31
|
+
request.username = endpoint.url.username || void 0;
|
32
|
+
request.password = endpoint.url.password || void 0;
|
33
|
+
for (const [k, v] of endpoint.url.searchParams.entries()) {
|
34
|
+
if (!request.query) {
|
35
|
+
request.query = {};
|
36
|
+
}
|
37
|
+
request.query[k] = v;
|
38
|
+
}
|
39
|
+
return request;
|
40
|
+
}
|
41
|
+
else {
|
42
|
+
request.protocol = endpoint.protocol;
|
43
|
+
request.hostname = endpoint.hostname;
|
44
|
+
request.port = endpoint.port ? Number(endpoint.port) : undefined;
|
45
|
+
request.path = endpoint.path;
|
46
|
+
request.query = {
|
47
|
+
...endpoint.query,
|
48
|
+
};
|
49
|
+
return request;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
setHostPrefix(request, operationSchema, input) {
|
53
|
+
const operationNs = NormalizedSchema.of(operationSchema);
|
54
|
+
const inputNs = NormalizedSchema.of(operationSchema.input);
|
55
|
+
if (operationNs.getMergedTraits().endpoint) {
|
56
|
+
let hostPrefix = operationNs.getMergedTraits().endpoint?.[0];
|
57
|
+
if (typeof hostPrefix === "string") {
|
58
|
+
const hostLabelInputs = [...inputNs.structIterator()].filter(([, member]) => member.getMergedTraits().hostLabel);
|
59
|
+
for (const [name] of hostLabelInputs) {
|
60
|
+
const replacement = input[name];
|
61
|
+
if (typeof replacement !== "string") {
|
62
|
+
throw new Error(`@smithy/core/schema - ${name} in input must be a string as hostLabel.`);
|
63
|
+
}
|
64
|
+
hostPrefix = hostPrefix.replace(`{${name}}`, replacement);
|
65
|
+
}
|
66
|
+
request.hostname = hostPrefix + request.hostname;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
deserializeMetadata(output) {
|
71
|
+
return {
|
72
|
+
httpStatusCode: output.statusCode,
|
73
|
+
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
|
74
|
+
extendedRequestId: output.headers["x-amz-id-2"],
|
75
|
+
cfId: output.headers["x-amz-cf-id"],
|
76
|
+
};
|
77
|
+
}
|
78
|
+
async deserializeHttpMessage(schema, context, response, headerBindings, dataObject) {
|
79
|
+
const deserializer = this.deserializer;
|
80
|
+
const ns = NormalizedSchema.of(schema);
|
81
|
+
const nonHttpBindingMembers = [];
|
82
|
+
for (const [memberName, memberSchema] of ns.structIterator()) {
|
83
|
+
const memberTraits = memberSchema.getMemberTraits();
|
84
|
+
if (memberTraits.httpPayload) {
|
85
|
+
const isStreaming = memberSchema.isStreaming();
|
86
|
+
if (isStreaming) {
|
87
|
+
const isEventStream = memberSchema.isStructSchema();
|
88
|
+
if (isEventStream) {
|
89
|
+
const context = this.serdeContext;
|
90
|
+
if (!context.eventStreamMarshaller) {
|
91
|
+
throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");
|
92
|
+
}
|
93
|
+
const memberSchemas = memberSchema.getMemberSchemas();
|
94
|
+
dataObject[memberName] = context.eventStreamMarshaller.deserialize(response.body, async (event) => {
|
95
|
+
const unionMember = Object.keys(event).find((key) => {
|
96
|
+
return key !== "__type";
|
97
|
+
}) ?? "";
|
98
|
+
if (unionMember in memberSchemas) {
|
99
|
+
const eventStreamSchema = memberSchemas[unionMember];
|
100
|
+
return {
|
101
|
+
[unionMember]: await deserializer.read(eventStreamSchema, event[unionMember].body),
|
102
|
+
};
|
103
|
+
}
|
104
|
+
else {
|
105
|
+
return {
|
106
|
+
$unknown: event,
|
107
|
+
};
|
108
|
+
}
|
109
|
+
});
|
110
|
+
}
|
111
|
+
else {
|
112
|
+
dataObject[memberName] = sdkStreamMixin(response.body);
|
113
|
+
}
|
114
|
+
}
|
115
|
+
else if (response.body) {
|
116
|
+
const bytes = await collectBody(response.body, context);
|
117
|
+
if (bytes.byteLength > 0) {
|
118
|
+
dataObject[memberName] = await deserializer.read(memberSchema, bytes);
|
119
|
+
}
|
120
|
+
}
|
121
|
+
}
|
122
|
+
else if (memberTraits.httpHeader) {
|
123
|
+
const key = String(memberTraits.httpHeader).toLowerCase();
|
124
|
+
const value = response.headers[key];
|
125
|
+
if (null != value) {
|
126
|
+
if (memberSchema.isListSchema()) {
|
127
|
+
const headerListValueSchema = memberSchema.getValueSchema();
|
128
|
+
let sections;
|
129
|
+
if (headerListValueSchema.isTimestampSchema() &&
|
130
|
+
headerListValueSchema.getSchema() === SCHEMA.TIMESTAMP_DEFAULT) {
|
131
|
+
sections = splitEvery(value, ",", 2);
|
132
|
+
}
|
133
|
+
else {
|
134
|
+
sections = splitHeader(value);
|
135
|
+
}
|
136
|
+
const list = [];
|
137
|
+
for (const section of sections) {
|
138
|
+
list.push(await deserializer.read([headerListValueSchema, { httpHeader: key }], section.trim()));
|
139
|
+
}
|
140
|
+
dataObject[memberName] = list;
|
141
|
+
}
|
142
|
+
else {
|
143
|
+
dataObject[memberName] = await deserializer.read(memberSchema, value);
|
144
|
+
}
|
145
|
+
}
|
146
|
+
}
|
147
|
+
else if (memberTraits.httpPrefixHeaders !== undefined) {
|
148
|
+
dataObject[memberName] = {};
|
149
|
+
for (const [header, value] of Object.entries(response.headers)) {
|
150
|
+
if (!headerBindings.has(header) && header.startsWith(memberTraits.httpPrefixHeaders)) {
|
151
|
+
dataObject[memberName][header.slice(memberTraits.httpPrefixHeaders.length)] = await deserializer.read([memberSchema.getValueSchema(), { httpHeader: header }], value);
|
152
|
+
}
|
153
|
+
}
|
154
|
+
}
|
155
|
+
else if (memberTraits.httpResponseCode) {
|
156
|
+
dataObject[memberName] = response.statusCode;
|
157
|
+
}
|
158
|
+
else {
|
159
|
+
nonHttpBindingMembers.push(memberName);
|
160
|
+
}
|
161
|
+
}
|
162
|
+
return nonHttpBindingMembers;
|
163
|
+
}
|
164
|
+
}
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import { NormalizedSchema, SCHEMA } from "@smithy/core/schema";
|
2
|
+
import { HttpRequest } from "@smithy/protocol-http";
|
3
|
+
import { collectBody } from "./collect-stream-body";
|
4
|
+
import { HttpProtocol } from "./HttpProtocol";
|
5
|
+
export class RpcProtocol extends HttpProtocol {
|
6
|
+
async serializeRequest(operationSchema, input, context) {
|
7
|
+
const serializer = this.serializer;
|
8
|
+
const query = {};
|
9
|
+
const headers = {};
|
10
|
+
const endpoint = await context.endpoint();
|
11
|
+
const ns = NormalizedSchema.of(operationSchema?.input);
|
12
|
+
const schema = ns.getSchema();
|
13
|
+
let payload;
|
14
|
+
const request = new HttpRequest({
|
15
|
+
protocol: "",
|
16
|
+
hostname: "",
|
17
|
+
port: undefined,
|
18
|
+
path: "/",
|
19
|
+
fragment: undefined,
|
20
|
+
query: query,
|
21
|
+
headers: headers,
|
22
|
+
body: undefined,
|
23
|
+
});
|
24
|
+
if (endpoint) {
|
25
|
+
this.updateServiceEndpoint(request, endpoint);
|
26
|
+
this.setHostPrefix(request, operationSchema, input);
|
27
|
+
}
|
28
|
+
const _input = {
|
29
|
+
...input,
|
30
|
+
};
|
31
|
+
if (input) {
|
32
|
+
serializer.write(schema, _input);
|
33
|
+
payload = serializer.flush();
|
34
|
+
}
|
35
|
+
request.headers = headers;
|
36
|
+
request.query = query;
|
37
|
+
request.body = payload;
|
38
|
+
request.method = "POST";
|
39
|
+
return request;
|
40
|
+
}
|
41
|
+
async deserializeResponse(operationSchema, context, response) {
|
42
|
+
const deserializer = this.deserializer;
|
43
|
+
const ns = NormalizedSchema.of(operationSchema.output);
|
44
|
+
const dataObject = {};
|
45
|
+
if (response.statusCode >= 300) {
|
46
|
+
const bytes = await collectBody(response.body, context);
|
47
|
+
if (bytes.byteLength > 0) {
|
48
|
+
Object.assign(dataObject, await deserializer.read(SCHEMA.DOCUMENT, bytes));
|
49
|
+
}
|
50
|
+
await this.handleError(operationSchema, context, response, dataObject, this.deserializeMetadata(response));
|
51
|
+
throw new Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.");
|
52
|
+
}
|
53
|
+
for (const header in response.headers) {
|
54
|
+
const value = response.headers[header];
|
55
|
+
delete response.headers[header];
|
56
|
+
response.headers[header.toLowerCase()] = value;
|
57
|
+
}
|
58
|
+
const bytes = await collectBody(response.body, context);
|
59
|
+
if (bytes.byteLength > 0) {
|
60
|
+
Object.assign(dataObject, await deserializer.read(ns, bytes));
|
61
|
+
}
|
62
|
+
const output = {
|
63
|
+
$metadata: this.deserializeMetadata(response),
|
64
|
+
...dataObject,
|
65
|
+
};
|
66
|
+
return output;
|
67
|
+
}
|
68
|
+
}
|
@@ -1,4 +1,11 @@
|
|
1
1
|
export * from "./collect-stream-body";
|
2
2
|
export * from "./extended-encode-uri-component";
|
3
|
+
export * from "./HttpBindingProtocol";
|
4
|
+
export * from "./RpcProtocol";
|
3
5
|
export * from "./requestBuilder";
|
4
6
|
export * from "./resolve-path";
|
7
|
+
export * from "./serde/FromStringShapeDeserializer";
|
8
|
+
export * from "./serde/HttpInterceptingShapeDeserializer";
|
9
|
+
export * from "./serde/HttpInterceptingShapeSerializer";
|
10
|
+
export * from "./serde/ToStringShapeSerializer";
|
11
|
+
export * from "./serde/determineTimestampFormat";
|
package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/FromStringShapeDeserializer.js
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
import { NormalizedSchema, SCHEMA } from "@smithy/core/schema";
|
2
|
+
import { LazyJsonString, NumericValue, parseEpochTimestamp, parseRfc3339DateTimeWithOffset, parseRfc7231DateTime, splitHeader, } from "@smithy/core/serde";
|
3
|
+
import { fromBase64 } from "@smithy/util-base64";
|
4
|
+
import { toUtf8 } from "@smithy/util-utf8";
|
5
|
+
import { determineTimestampFormat } from "./determineTimestampFormat";
|
6
|
+
export class FromStringShapeDeserializer {
|
7
|
+
constructor(settings) {
|
8
|
+
this.settings = settings;
|
9
|
+
}
|
10
|
+
setSerdeContext(serdeContext) {
|
11
|
+
this.serdeContext = serdeContext;
|
12
|
+
}
|
13
|
+
read(_schema, data) {
|
14
|
+
const ns = NormalizedSchema.of(_schema);
|
15
|
+
if (ns.isListSchema()) {
|
16
|
+
return splitHeader(data).map((item) => this.read(ns.getValueSchema(), item));
|
17
|
+
}
|
18
|
+
if (ns.isBlobSchema()) {
|
19
|
+
return (this.serdeContext?.base64Decoder ?? fromBase64)(data);
|
20
|
+
}
|
21
|
+
if (ns.isTimestampSchema()) {
|
22
|
+
const format = determineTimestampFormat(ns, this.settings);
|
23
|
+
switch (format) {
|
24
|
+
case SCHEMA.TIMESTAMP_DATE_TIME:
|
25
|
+
return parseRfc3339DateTimeWithOffset(data);
|
26
|
+
case SCHEMA.TIMESTAMP_HTTP_DATE:
|
27
|
+
return parseRfc7231DateTime(data);
|
28
|
+
case SCHEMA.TIMESTAMP_EPOCH_SECONDS:
|
29
|
+
return parseEpochTimestamp(data);
|
30
|
+
default:
|
31
|
+
console.warn("Missing timestamp format, parsing value with Date constructor:", data);
|
32
|
+
return new Date(data);
|
33
|
+
}
|
34
|
+
}
|
35
|
+
if (ns.isStringSchema()) {
|
36
|
+
const mediaType = ns.getMergedTraits().mediaType;
|
37
|
+
let intermediateValue = data;
|
38
|
+
if (mediaType) {
|
39
|
+
if (ns.getMergedTraits().httpHeader) {
|
40
|
+
intermediateValue = this.base64ToUtf8(intermediateValue);
|
41
|
+
}
|
42
|
+
const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
|
43
|
+
if (isJson) {
|
44
|
+
intermediateValue = LazyJsonString.from(intermediateValue);
|
45
|
+
}
|
46
|
+
return intermediateValue;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
switch (true) {
|
50
|
+
case ns.isNumericSchema():
|
51
|
+
return Number(data);
|
52
|
+
case ns.isBigIntegerSchema():
|
53
|
+
return BigInt(data);
|
54
|
+
case ns.isBigDecimalSchema():
|
55
|
+
return new NumericValue(data, "bigDecimal");
|
56
|
+
case ns.isBooleanSchema():
|
57
|
+
return String(data).toLowerCase() === "true";
|
58
|
+
}
|
59
|
+
return data;
|
60
|
+
}
|
61
|
+
base64ToUtf8(base64String) {
|
62
|
+
return (this.serdeContext?.utf8Encoder ?? toUtf8)((this.serdeContext?.base64Decoder ?? fromBase64)(base64String));
|
63
|
+
}
|
64
|
+
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import { NormalizedSchema } from "@smithy/core/schema";
|
2
|
+
import { fromUtf8, toUtf8 } from "@smithy/util-utf8";
|
3
|
+
import { FromStringShapeDeserializer } from "./FromStringShapeDeserializer";
|
4
|
+
export class HttpInterceptingShapeDeserializer {
|
5
|
+
constructor(codecDeserializer, codecSettings) {
|
6
|
+
this.codecDeserializer = codecDeserializer;
|
7
|
+
this.stringDeserializer = new FromStringShapeDeserializer(codecSettings);
|
8
|
+
}
|
9
|
+
setSerdeContext(serdeContext) {
|
10
|
+
this.stringDeserializer.setSerdeContext(serdeContext);
|
11
|
+
this.codecDeserializer.setSerdeContext(serdeContext);
|
12
|
+
this.serdeContext = serdeContext;
|
13
|
+
}
|
14
|
+
read(schema, data) {
|
15
|
+
const ns = NormalizedSchema.of(schema);
|
16
|
+
const traits = ns.getMergedTraits();
|
17
|
+
const toString = this.serdeContext?.utf8Encoder ?? toUtf8;
|
18
|
+
if (traits.httpHeader || traits.httpResponseCode) {
|
19
|
+
return this.stringDeserializer.read(ns, toString(data));
|
20
|
+
}
|
21
|
+
if (traits.httpPayload) {
|
22
|
+
if (ns.isBlobSchema()) {
|
23
|
+
const toBytes = this.serdeContext?.utf8Decoder ?? fromUtf8;
|
24
|
+
if (typeof data === "string") {
|
25
|
+
return toBytes(data);
|
26
|
+
}
|
27
|
+
return data;
|
28
|
+
}
|
29
|
+
else if (ns.isStringSchema()) {
|
30
|
+
if ("byteLength" in data) {
|
31
|
+
return toString(data);
|
32
|
+
}
|
33
|
+
return data;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
return this.codecDeserializer.read(ns, data);
|
37
|
+
}
|
38
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { NormalizedSchema } from "@smithy/core/schema";
|
2
|
+
import { ToStringShapeSerializer } from "./ToStringShapeSerializer";
|
3
|
+
export class HttpInterceptingShapeSerializer {
|
4
|
+
constructor(codecSerializer, codecSettings, stringSerializer = new ToStringShapeSerializer(codecSettings)) {
|
5
|
+
this.codecSerializer = codecSerializer;
|
6
|
+
this.stringSerializer = stringSerializer;
|
7
|
+
}
|
8
|
+
setSerdeContext(serdeContext) {
|
9
|
+
this.codecSerializer.setSerdeContext(serdeContext);
|
10
|
+
this.stringSerializer.setSerdeContext(serdeContext);
|
11
|
+
}
|
12
|
+
write(schema, value) {
|
13
|
+
const ns = NormalizedSchema.of(schema);
|
14
|
+
const traits = ns.getMergedTraits();
|
15
|
+
if (traits.httpHeader || traits.httpLabel || traits.httpQuery) {
|
16
|
+
this.stringSerializer.write(ns, value);
|
17
|
+
this.buffer = this.stringSerializer.flush();
|
18
|
+
return;
|
19
|
+
}
|
20
|
+
return this.codecSerializer.write(ns, value);
|
21
|
+
}
|
22
|
+
flush() {
|
23
|
+
if (this.buffer !== undefined) {
|
24
|
+
const buffer = this.buffer;
|
25
|
+
this.buffer = undefined;
|
26
|
+
return buffer;
|
27
|
+
}
|
28
|
+
return this.codecSerializer.flush();
|
29
|
+
}
|
30
|
+
}
|
package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/ToStringShapeSerializer.js
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
import { NormalizedSchema, SCHEMA } from "@smithy/core/schema";
|
2
|
+
import { dateToUtcString, LazyJsonString, quoteHeader } from "@smithy/core/serde";
|
3
|
+
import { toBase64 } from "@smithy/util-base64";
|
4
|
+
import { determineTimestampFormat } from "./determineTimestampFormat";
|
5
|
+
export class ToStringShapeSerializer {
|
6
|
+
constructor(settings) {
|
7
|
+
this.settings = settings;
|
8
|
+
this.stringBuffer = "";
|
9
|
+
this.serdeContext = undefined;
|
10
|
+
}
|
11
|
+
setSerdeContext(serdeContext) {
|
12
|
+
this.serdeContext = serdeContext;
|
13
|
+
}
|
14
|
+
write(schema, value) {
|
15
|
+
const ns = NormalizedSchema.of(schema);
|
16
|
+
switch (typeof value) {
|
17
|
+
case "object":
|
18
|
+
if (value === null) {
|
19
|
+
this.stringBuffer = "null";
|
20
|
+
return;
|
21
|
+
}
|
22
|
+
if (ns.isTimestampSchema()) {
|
23
|
+
if (!(value instanceof Date)) {
|
24
|
+
throw new Error(`@smithy/core/protocols - received non-Date value ${value} when schema expected Date in ${ns.getName(true)}`);
|
25
|
+
}
|
26
|
+
const format = determineTimestampFormat(ns, this.settings);
|
27
|
+
switch (format) {
|
28
|
+
case SCHEMA.TIMESTAMP_DATE_TIME:
|
29
|
+
this.stringBuffer = value.toISOString().replace(".000Z", "Z");
|
30
|
+
break;
|
31
|
+
case SCHEMA.TIMESTAMP_HTTP_DATE:
|
32
|
+
this.stringBuffer = dateToUtcString(value);
|
33
|
+
break;
|
34
|
+
case SCHEMA.TIMESTAMP_EPOCH_SECONDS:
|
35
|
+
this.stringBuffer = String(value.getTime() / 1000);
|
36
|
+
break;
|
37
|
+
default:
|
38
|
+
console.warn("Missing timestamp format, using epoch seconds", value);
|
39
|
+
this.stringBuffer = String(value.getTime() / 1000);
|
40
|
+
}
|
41
|
+
return;
|
42
|
+
}
|
43
|
+
if (ns.isBlobSchema() && "byteLength" in value) {
|
44
|
+
this.stringBuffer = (this.serdeContext?.base64Encoder ?? toBase64)(value);
|
45
|
+
return;
|
46
|
+
}
|
47
|
+
if (ns.isListSchema() && Array.isArray(value)) {
|
48
|
+
let buffer = "";
|
49
|
+
for (const item of value) {
|
50
|
+
this.write([ns.getValueSchema(), ns.getMergedTraits()], item);
|
51
|
+
const headerItem = this.flush();
|
52
|
+
const serialized = ns.getValueSchema().isTimestampSchema() ? headerItem : quoteHeader(headerItem);
|
53
|
+
if (buffer !== "") {
|
54
|
+
buffer += ", ";
|
55
|
+
}
|
56
|
+
buffer += serialized;
|
57
|
+
}
|
58
|
+
this.stringBuffer = buffer;
|
59
|
+
return;
|
60
|
+
}
|
61
|
+
this.stringBuffer = JSON.stringify(value, null, 2);
|
62
|
+
break;
|
63
|
+
case "string":
|
64
|
+
const mediaType = ns.getMergedTraits().mediaType;
|
65
|
+
let intermediateValue = value;
|
66
|
+
if (mediaType) {
|
67
|
+
const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
|
68
|
+
if (isJson) {
|
69
|
+
intermediateValue = LazyJsonString.from(intermediateValue);
|
70
|
+
}
|
71
|
+
if (ns.getMergedTraits().httpHeader) {
|
72
|
+
this.stringBuffer = (this.serdeContext?.base64Encoder ?? toBase64)(intermediateValue.toString());
|
73
|
+
return;
|
74
|
+
}
|
75
|
+
}
|
76
|
+
this.stringBuffer = value;
|
77
|
+
break;
|
78
|
+
default:
|
79
|
+
this.stringBuffer = String(value);
|
80
|
+
}
|
81
|
+
}
|
82
|
+
flush() {
|
83
|
+
const buffer = this.stringBuffer;
|
84
|
+
this.stringBuffer = "";
|
85
|
+
return buffer;
|
86
|
+
}
|
87
|
+
}
|
package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/determineTimestampFormat.js
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
import { SCHEMA } from "@smithy/core/schema";
|
2
|
+
export function determineTimestampFormat(ns, settings) {
|
3
|
+
if (settings.timestampFormat.useTrait) {
|
4
|
+
if (ns.isTimestampSchema() &&
|
5
|
+
(ns.getSchema() === SCHEMA.TIMESTAMP_DATE_TIME ||
|
6
|
+
ns.getSchema() === SCHEMA.TIMESTAMP_HTTP_DATE ||
|
7
|
+
ns.getSchema() === SCHEMA.TIMESTAMP_EPOCH_SECONDS)) {
|
8
|
+
return ns.getSchema();
|
9
|
+
}
|
10
|
+
}
|
11
|
+
const { httpLabel, httpPrefixHeaders, httpHeader, httpQuery } = ns.getMergedTraits();
|
12
|
+
const bindingFormat = settings.httpBindings
|
13
|
+
? typeof httpPrefixHeaders === "string" || Boolean(httpHeader)
|
14
|
+
? SCHEMA.TIMESTAMP_HTTP_DATE
|
15
|
+
: Boolean(httpQuery) || Boolean(httpLabel)
|
16
|
+
? SCHEMA.TIMESTAMP_DATE_TIME
|
17
|
+
: undefined
|
18
|
+
: undefined;
|
19
|
+
return bindingFormat ?? settings.timestampFormat.default;
|
20
|
+
}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
export class TypeRegistry {
|
2
|
+
constructor(namespace, schemas = new Map()) {
|
3
|
+
this.namespace = namespace;
|
4
|
+
this.schemas = schemas;
|
5
|
+
}
|
6
|
+
static for(namespace) {
|
7
|
+
if (!TypeRegistry.registries.has(namespace)) {
|
8
|
+
TypeRegistry.registries.set(namespace, new TypeRegistry(namespace));
|
9
|
+
}
|
10
|
+
return TypeRegistry.registries.get(namespace);
|
11
|
+
}
|
12
|
+
register(shapeId, schema) {
|
13
|
+
const qualifiedName = this.normalizeShapeId(shapeId);
|
14
|
+
const registry = TypeRegistry.for(this.getNamespace(shapeId));
|
15
|
+
registry.schemas.set(qualifiedName, schema);
|
16
|
+
}
|
17
|
+
getSchema(shapeId) {
|
18
|
+
const id = this.normalizeShapeId(shapeId);
|
19
|
+
if (!this.schemas.has(id)) {
|
20
|
+
throw new Error(`@smithy/core/schema - schema not found for ${id}`);
|
21
|
+
}
|
22
|
+
return this.schemas.get(id);
|
23
|
+
}
|
24
|
+
getBaseException() {
|
25
|
+
for (const [id, schema] of this.schemas.entries()) {
|
26
|
+
if (id.startsWith("smithyts.client.synthetic.") && id.endsWith("ServiceException")) {
|
27
|
+
return schema;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
return undefined;
|
31
|
+
}
|
32
|
+
find(predicate) {
|
33
|
+
return [...this.schemas.values()].find(predicate);
|
34
|
+
}
|
35
|
+
destroy() {
|
36
|
+
TypeRegistry.registries.delete(this.namespace);
|
37
|
+
this.schemas.clear();
|
38
|
+
}
|
39
|
+
normalizeShapeId(shapeId) {
|
40
|
+
if (shapeId.includes("#")) {
|
41
|
+
return shapeId;
|
42
|
+
}
|
43
|
+
return this.namespace + "#" + shapeId;
|
44
|
+
}
|
45
|
+
getNamespace(shapeId) {
|
46
|
+
return this.normalizeShapeId(shapeId).split("#")[0];
|
47
|
+
}
|
48
|
+
}
|
49
|
+
TypeRegistry.registries = new Map();
|
@@ -0,0 +1,12 @@
|
|
1
|
+
export * from "./deref";
|
2
|
+
export * from "./middleware/getSchemaSerdePlugin";
|
3
|
+
export * from "./schemas/ListSchema";
|
4
|
+
export * from "./schemas/MapSchema";
|
5
|
+
export * from "./schemas/OperationSchema";
|
6
|
+
export * from "./schemas/ErrorSchema";
|
7
|
+
export * from "./schemas/NormalizedSchema";
|
8
|
+
export * from "./schemas/Schema";
|
9
|
+
export * from "./schemas/SimpleSchema";
|
10
|
+
export * from "./schemas/StructureSchema";
|
11
|
+
export * from "./schemas/sentinels";
|
12
|
+
export * from "./TypeRegistry";
|
package/node_modules/@smithy/core/dist-es/submodules/schema/middleware/getSchemaSerdePlugin.js
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
import { schemaDeserializationMiddleware } from "./schemaDeserializationMiddleware";
|
2
|
+
import { schemaSerializationMiddleware } from "./schemaSerializationMiddleware";
|
3
|
+
export const deserializerMiddlewareOption = {
|
4
|
+
name: "deserializerMiddleware",
|
5
|
+
step: "deserialize",
|
6
|
+
tags: ["DESERIALIZER"],
|
7
|
+
override: true,
|
8
|
+
};
|
9
|
+
export const serializerMiddlewareOption = {
|
10
|
+
name: "serializerMiddleware",
|
11
|
+
step: "serialize",
|
12
|
+
tags: ["SERIALIZER"],
|
13
|
+
override: true,
|
14
|
+
};
|
15
|
+
export function getSchemaSerdePlugin(config) {
|
16
|
+
return {
|
17
|
+
applyToStack: (commandStack) => {
|
18
|
+
commandStack.add(schemaSerializationMiddleware(config), serializerMiddlewareOption);
|
19
|
+
commandStack.add(schemaDeserializationMiddleware(config), deserializerMiddlewareOption);
|
20
|
+
config.protocol.setSerdeContext(config);
|
21
|
+
},
|
22
|
+
};
|
23
|
+
}
|
package/node_modules/@smithy/core/dist-es/submodules/schema/middleware/schema-middleware-types.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import { HttpResponse } from "@smithy/protocol-http";
|
2
|
+
import { getSmithyContext } from "@smithy/util-middleware";
|
3
|
+
export const schemaDeserializationMiddleware = (config) => (next, context) => async (args) => {
|
4
|
+
const { response } = await next(args);
|
5
|
+
const { operationSchema } = getSmithyContext(context);
|
6
|
+
try {
|
7
|
+
const parsed = await config.protocol.deserializeResponse(operationSchema, {
|
8
|
+
...config,
|
9
|
+
...context,
|
10
|
+
}, response);
|
11
|
+
return {
|
12
|
+
response,
|
13
|
+
output: parsed,
|
14
|
+
};
|
15
|
+
}
|
16
|
+
catch (error) {
|
17
|
+
Object.defineProperty(error, "$response", {
|
18
|
+
value: response,
|
19
|
+
});
|
20
|
+
if (!("$metadata" in error)) {
|
21
|
+
const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;
|
22
|
+
try {
|
23
|
+
error.message += "\n " + hint;
|
24
|
+
}
|
25
|
+
catch (e) {
|
26
|
+
if (!context.logger || context.logger?.constructor?.name === "NoOpLogger") {
|
27
|
+
console.warn(hint);
|
28
|
+
}
|
29
|
+
else {
|
30
|
+
context.logger?.warn?.(hint);
|
31
|
+
}
|
32
|
+
}
|
33
|
+
if (typeof error.$responseBodyText !== "undefined") {
|
34
|
+
if (error.$response) {
|
35
|
+
error.$response.body = error.$responseBodyText;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
try {
|
39
|
+
if (HttpResponse.isInstance(response)) {
|
40
|
+
const { headers = {} } = response;
|
41
|
+
const headerEntries = Object.entries(headers);
|
42
|
+
error.$metadata = {
|
43
|
+
httpStatusCode: response.statusCode,
|
44
|
+
requestId: findHeader(/^x-[\w-]+-request-?id$/, headerEntries),
|
45
|
+
extendedRequestId: findHeader(/^x-[\w-]+-id-2$/, headerEntries),
|
46
|
+
cfId: findHeader(/^x-[\w-]+-cf-id$/, headerEntries),
|
47
|
+
};
|
48
|
+
}
|
49
|
+
}
|
50
|
+
catch (e) {
|
51
|
+
}
|
52
|
+
}
|
53
|
+
throw error;
|
54
|
+
}
|
55
|
+
};
|
56
|
+
const findHeader = (pattern, headers) => {
|
57
|
+
return (headers.find(([k]) => {
|
58
|
+
return k.match(pattern);
|
59
|
+
}) || [void 0, void 1])[1];
|
60
|
+
};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { getSmithyContext } from "@smithy/util-middleware";
|
2
|
+
export const schemaSerializationMiddleware = (config) => (next, context) => async (args) => {
|
3
|
+
const { operationSchema } = getSmithyContext(context);
|
4
|
+
const endpoint = context.endpointV2?.url && config.urlParser
|
5
|
+
? async () => config.urlParser(context.endpointV2.url)
|
6
|
+
: config.endpoint;
|
7
|
+
const request = await config.protocol.serializeRequest(operationSchema, args.input, {
|
8
|
+
...config,
|
9
|
+
...context,
|
10
|
+
endpoint,
|
11
|
+
});
|
12
|
+
return next({
|
13
|
+
...args,
|
14
|
+
request,
|
15
|
+
});
|
16
|
+
};
|