@monorise/react 7.0.0 → 8.0.0-dev.0
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/dist/bowser-RUCNDTEX.js +2822 -0
- package/dist/bowser-RUCNDTEX.js.map +1 -0
- package/dist/chunk-2U2REJF4.js +138 -0
- package/dist/chunk-2U2REJF4.js.map +1 -0
- package/dist/chunk-5CPIG7AN.js +449 -0
- package/dist/chunk-5CPIG7AN.js.map +1 -0
- package/dist/chunk-7BSJSLIL.js +528 -0
- package/dist/chunk-7BSJSLIL.js.map +1 -0
- package/dist/chunk-7MNBSDJI.js +3362 -0
- package/dist/chunk-7MNBSDJI.js.map +1 -0
- package/dist/chunk-JXBFOCBM.js +2929 -0
- package/dist/chunk-JXBFOCBM.js.map +1 -0
- package/dist/chunk-MIXAYX55.js +147 -0
- package/dist/chunk-MIXAYX55.js.map +1 -0
- package/dist/chunk-Q26JGAFF.js +47 -0
- package/dist/chunk-Q26JGAFF.js.map +1 -0
- package/dist/chunk-QZSEUOCY.js +2298 -0
- package/dist/chunk-QZSEUOCY.js.map +1 -0
- package/dist/chunk-W6S3JWZV.js +1045 -0
- package/dist/chunk-W6S3JWZV.js.map +1 -0
- package/dist/chunk-WUOPYF3V.js +127 -0
- package/dist/chunk-WUOPYF3V.js.map +1 -0
- package/dist/chunk-Z45ECZFO.js +995 -0
- package/dist/chunk-Z45ECZFO.js.map +1 -0
- package/dist/dist-es-2P6AKQM3.js +325 -0
- package/dist/dist-es-2P6AKQM3.js.map +1 -0
- package/dist/dist-es-CEMZ6HT6.js +294 -0
- package/dist/dist-es-CEMZ6HT6.js.map +1 -0
- package/dist/dist-es-NZWWHEBR.js +89 -0
- package/dist/dist-es-NZWWHEBR.js.map +1 -0
- package/dist/dist-es-QVQ2CPIM.js +376 -0
- package/dist/dist-es-QVQ2CPIM.js.map +1 -0
- package/dist/dist-es-VBWII54H.js +70 -0
- package/dist/dist-es-VBWII54H.js.map +1 -0
- package/dist/dist-es-VXN7IC3J.js +23 -0
- package/dist/dist-es-VXN7IC3J.js.map +1 -0
- package/dist/dist-es-YKVDPOOB.js +221 -0
- package/dist/dist-es-YKVDPOOB.js.map +1 -0
- package/dist/dist-es-ZPOY2Z6R.js +178 -0
- package/dist/dist-es-ZPOY2Z6R.js.map +1 -0
- package/dist/event-streams-NBH35WQC.js +44 -0
- package/dist/event-streams-NBH35WQC.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25670 -368
- package/dist/index.js.map +1 -1
- package/dist/loadSso-2GPAQE3H.js +583 -0
- package/dist/loadSso-2GPAQE3H.js.map +1 -0
- package/dist/services/core.service.d.ts +8 -0
- package/dist/services/core.service.d.ts.map +1 -1
- package/dist/signin-HT4EDHQE.js +821 -0
- package/dist/signin-HT4EDHQE.js.map +1 -0
- package/dist/sso-oidc-WA3BK6FI.js +830 -0
- package/dist/sso-oidc-WA3BK6FI.js.map +1 -0
- package/dist/sts-V7PNNQ2L.js +1114 -0
- package/dist/sts-V7PNNQ2L.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,2929 @@
|
|
|
1
|
+
import {
|
|
2
|
+
decorateServiceException,
|
|
3
|
+
doesIdentityRequireRefresh,
|
|
4
|
+
getValueFromTextNode,
|
|
5
|
+
isIdentityExpired,
|
|
6
|
+
memoizeIdentityProvider,
|
|
7
|
+
normalizeProvider as normalizeProvider2,
|
|
8
|
+
setCredentialFeature
|
|
9
|
+
} from "./chunk-7MNBSDJI.js";
|
|
10
|
+
import {
|
|
11
|
+
FromStringShapeDeserializer,
|
|
12
|
+
HttpBindingProtocol,
|
|
13
|
+
HttpInterceptingShapeDeserializer,
|
|
14
|
+
HttpInterceptingShapeSerializer,
|
|
15
|
+
HttpRequest,
|
|
16
|
+
HttpResponse,
|
|
17
|
+
NormalizedSchema,
|
|
18
|
+
ProviderError,
|
|
19
|
+
RpcProtocol,
|
|
20
|
+
TypeRegistry,
|
|
21
|
+
collectBody,
|
|
22
|
+
deref,
|
|
23
|
+
determineTimestampFormat,
|
|
24
|
+
escapeUri,
|
|
25
|
+
extendedEncodeURIComponent,
|
|
26
|
+
normalizeProvider
|
|
27
|
+
} from "./chunk-QZSEUOCY.js";
|
|
28
|
+
import {
|
|
29
|
+
LazyJsonString,
|
|
30
|
+
NumericValue,
|
|
31
|
+
dateToUtcString,
|
|
32
|
+
fromBase64,
|
|
33
|
+
fromHex,
|
|
34
|
+
fromUtf8,
|
|
35
|
+
generateIdempotencyToken,
|
|
36
|
+
isArrayBuffer,
|
|
37
|
+
parseEpochTimestamp,
|
|
38
|
+
parseRfc3339DateTimeWithOffset,
|
|
39
|
+
parseRfc7231DateTime,
|
|
40
|
+
toBase64,
|
|
41
|
+
toHex,
|
|
42
|
+
toUint8Array,
|
|
43
|
+
toUtf8
|
|
44
|
+
} from "./chunk-W6S3JWZV.js";
|
|
45
|
+
import {
|
|
46
|
+
__publicField,
|
|
47
|
+
__spreadProps,
|
|
48
|
+
__spreadValues
|
|
49
|
+
} from "./chunk-MIXAYX55.js";
|
|
50
|
+
|
|
51
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getDateHeader.js
|
|
52
|
+
var getDateHeader = (response) => {
|
|
53
|
+
var _a, _b, _c;
|
|
54
|
+
return HttpResponse.isInstance(response) ? (_c = (_a = response.headers) == null ? void 0 : _a.date) != null ? _c : (_b = response.headers) == null ? void 0 : _b.Date : void 0;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getSkewCorrectedDate.js
|
|
58
|
+
var getSkewCorrectedDate = (systemClockOffset) => new Date(Date.now() + systemClockOffset);
|
|
59
|
+
|
|
60
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/isClockSkewed.js
|
|
61
|
+
var isClockSkewed = (clockTime, systemClockOffset) => Math.abs(getSkewCorrectedDate(systemClockOffset).getTime() - clockTime) >= 3e5;
|
|
62
|
+
|
|
63
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getUpdatedSystemClockOffset.js
|
|
64
|
+
var getUpdatedSystemClockOffset = (clockTime, currentSystemClockOffset) => {
|
|
65
|
+
const clockTimeInMs = Date.parse(clockTime);
|
|
66
|
+
if (isClockSkewed(clockTimeInMs, currentSystemClockOffset)) {
|
|
67
|
+
return clockTimeInMs - Date.now();
|
|
68
|
+
}
|
|
69
|
+
return currentSystemClockOffset;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.js
|
|
73
|
+
var throwSigningPropertyError = (name, property) => {
|
|
74
|
+
if (!property) {
|
|
75
|
+
throw new Error(`Property \`${name}\` is not resolved for AWS SDK SigV4Auth`);
|
|
76
|
+
}
|
|
77
|
+
return property;
|
|
78
|
+
};
|
|
79
|
+
var validateSigningProperties = async (signingProperties) => {
|
|
80
|
+
var _a, _b, _c;
|
|
81
|
+
const context = throwSigningPropertyError("context", signingProperties.context);
|
|
82
|
+
const config = throwSigningPropertyError("config", signingProperties.config);
|
|
83
|
+
const authScheme = (_c = (_b = (_a = context.endpointV2) == null ? void 0 : _a.properties) == null ? void 0 : _b.authSchemes) == null ? void 0 : _c[0];
|
|
84
|
+
const signerFunction = throwSigningPropertyError("signer", config.signer);
|
|
85
|
+
const signer = await signerFunction(authScheme);
|
|
86
|
+
const signingRegion = signingProperties == null ? void 0 : signingProperties.signingRegion;
|
|
87
|
+
const signingRegionSet = signingProperties == null ? void 0 : signingProperties.signingRegionSet;
|
|
88
|
+
const signingName = signingProperties == null ? void 0 : signingProperties.signingName;
|
|
89
|
+
return {
|
|
90
|
+
config,
|
|
91
|
+
signer,
|
|
92
|
+
signingRegion,
|
|
93
|
+
signingRegionSet,
|
|
94
|
+
signingName
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
var AwsSdkSigV4Signer = class {
|
|
98
|
+
async sign(httpRequest, identity, signingProperties) {
|
|
99
|
+
var _a, _b, _c, _d;
|
|
100
|
+
if (!HttpRequest.isInstance(httpRequest)) {
|
|
101
|
+
throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");
|
|
102
|
+
}
|
|
103
|
+
const validatedProps = await validateSigningProperties(signingProperties);
|
|
104
|
+
const { config, signer } = validatedProps;
|
|
105
|
+
let { signingRegion, signingName } = validatedProps;
|
|
106
|
+
const handlerExecutionContext = signingProperties.context;
|
|
107
|
+
if ((_b = (_a = handlerExecutionContext == null ? void 0 : handlerExecutionContext.authSchemes) == null ? void 0 : _a.length) != null ? _b : 0 > 1) {
|
|
108
|
+
const [first, second] = handlerExecutionContext.authSchemes;
|
|
109
|
+
if ((first == null ? void 0 : first.name) === "sigv4a" && (second == null ? void 0 : second.name) === "sigv4") {
|
|
110
|
+
signingRegion = (_c = second == null ? void 0 : second.signingRegion) != null ? _c : signingRegion;
|
|
111
|
+
signingName = (_d = second == null ? void 0 : second.signingName) != null ? _d : signingName;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
signingProperties._preRequestSystemClockOffset = config.systemClockOffset;
|
|
115
|
+
const signedRequest = await signer.sign(httpRequest, {
|
|
116
|
+
signingDate: getSkewCorrectedDate(config.systemClockOffset),
|
|
117
|
+
signingRegion,
|
|
118
|
+
signingService: signingName
|
|
119
|
+
});
|
|
120
|
+
return signedRequest;
|
|
121
|
+
}
|
|
122
|
+
errorHandler(signingProperties) {
|
|
123
|
+
return (error) => {
|
|
124
|
+
var _a;
|
|
125
|
+
const errorException = error;
|
|
126
|
+
const serverTime = (_a = errorException.ServerTime) != null ? _a : getDateHeader(errorException.$response);
|
|
127
|
+
if (serverTime) {
|
|
128
|
+
const config = throwSigningPropertyError("config", signingProperties.config);
|
|
129
|
+
const preRequestOffset = signingProperties._preRequestSystemClockOffset;
|
|
130
|
+
const newOffset = getUpdatedSystemClockOffset(serverTime, config.systemClockOffset);
|
|
131
|
+
const isLocalCorrection = newOffset !== config.systemClockOffset;
|
|
132
|
+
const isConcurrentCorrection = preRequestOffset !== void 0 && preRequestOffset !== newOffset;
|
|
133
|
+
const clockSkewCorrected = isLocalCorrection || isConcurrentCorrection;
|
|
134
|
+
if (clockSkewCorrected && errorException.$metadata) {
|
|
135
|
+
config.systemClockOffset = newOffset;
|
|
136
|
+
errorException.$metadata.clockSkewCorrected = true;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
throw error;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
successHandler(httpResponse, signingProperties) {
|
|
143
|
+
const dateHeader = getDateHeader(httpResponse);
|
|
144
|
+
if (dateHeader) {
|
|
145
|
+
const config = throwSigningPropertyError("config", signingProperties.config);
|
|
146
|
+
config.systemClockOffset = getUpdatedSystemClockOffset(dateHeader, config.systemClockOffset);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4ASigner.js
|
|
152
|
+
var AwsSdkSigV4ASigner = class extends AwsSdkSigV4Signer {
|
|
153
|
+
async sign(httpRequest, identity, signingProperties) {
|
|
154
|
+
var _a, _b;
|
|
155
|
+
if (!HttpRequest.isInstance(httpRequest)) {
|
|
156
|
+
throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");
|
|
157
|
+
}
|
|
158
|
+
const { config, signer, signingRegion, signingRegionSet, signingName } = await validateSigningProperties(signingProperties);
|
|
159
|
+
const configResolvedSigningRegionSet = await ((_a = config.sigv4aSigningRegionSet) == null ? void 0 : _a.call(config));
|
|
160
|
+
const multiRegionOverride = ((_b = configResolvedSigningRegionSet != null ? configResolvedSigningRegionSet : signingRegionSet) != null ? _b : [signingRegion]).join(",");
|
|
161
|
+
signingProperties._preRequestSystemClockOffset = config.systemClockOffset;
|
|
162
|
+
const signedRequest = await signer.sign(httpRequest, {
|
|
163
|
+
signingDate: getSkewCorrectedDate(config.systemClockOffset),
|
|
164
|
+
signingRegion: multiRegionOverride,
|
|
165
|
+
signingService: signingName
|
|
166
|
+
});
|
|
167
|
+
return signedRequest;
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getArrayForCommaSeparatedString.js
|
|
172
|
+
var getArrayForCommaSeparatedString = (str) => typeof str === "string" && str.length > 0 ? str.split(",").map((item) => item.trim()) : [];
|
|
173
|
+
|
|
174
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getBearerTokenEnvKey.js
|
|
175
|
+
var getBearerTokenEnvKey = (signingName) => `AWS_BEARER_TOKEN_${signingName.replace(/[\s-]/g, "_").toUpperCase()}`;
|
|
176
|
+
|
|
177
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/NODE_AUTH_SCHEME_PREFERENCE_OPTIONS.js
|
|
178
|
+
var NODE_AUTH_SCHEME_PREFERENCE_ENV_KEY = "AWS_AUTH_SCHEME_PREFERENCE";
|
|
179
|
+
var NODE_AUTH_SCHEME_PREFERENCE_CONFIG_KEY = "auth_scheme_preference";
|
|
180
|
+
var NODE_AUTH_SCHEME_PREFERENCE_OPTIONS = {
|
|
181
|
+
environmentVariableSelector: (env, options) => {
|
|
182
|
+
if (options == null ? void 0 : options.signingName) {
|
|
183
|
+
const bearerTokenKey = getBearerTokenEnvKey(options.signingName);
|
|
184
|
+
if (bearerTokenKey in env)
|
|
185
|
+
return ["httpBearerAuth"];
|
|
186
|
+
}
|
|
187
|
+
if (!(NODE_AUTH_SCHEME_PREFERENCE_ENV_KEY in env))
|
|
188
|
+
return void 0;
|
|
189
|
+
return getArrayForCommaSeparatedString(env[NODE_AUTH_SCHEME_PREFERENCE_ENV_KEY]);
|
|
190
|
+
},
|
|
191
|
+
configFileSelector: (profile) => {
|
|
192
|
+
if (!(NODE_AUTH_SCHEME_PREFERENCE_CONFIG_KEY in profile))
|
|
193
|
+
return void 0;
|
|
194
|
+
return getArrayForCommaSeparatedString(profile[NODE_AUTH_SCHEME_PREFERENCE_CONFIG_KEY]);
|
|
195
|
+
},
|
|
196
|
+
default: []
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4AConfig.js
|
|
200
|
+
var resolveAwsSdkSigV4AConfig = (config) => {
|
|
201
|
+
config.sigv4aSigningRegionSet = normalizeProvider2(config.sigv4aSigningRegionSet);
|
|
202
|
+
return config;
|
|
203
|
+
};
|
|
204
|
+
var NODE_SIGV4A_CONFIG_OPTIONS = {
|
|
205
|
+
environmentVariableSelector(env) {
|
|
206
|
+
if (env.AWS_SIGV4A_SIGNING_REGION_SET) {
|
|
207
|
+
return env.AWS_SIGV4A_SIGNING_REGION_SET.split(",").map((_) => _.trim());
|
|
208
|
+
}
|
|
209
|
+
throw new ProviderError("AWS_SIGV4A_SIGNING_REGION_SET not set in env.", {
|
|
210
|
+
tryNextLink: true
|
|
211
|
+
});
|
|
212
|
+
},
|
|
213
|
+
configFileSelector(profile) {
|
|
214
|
+
var _a;
|
|
215
|
+
if (profile.sigv4a_signing_region_set) {
|
|
216
|
+
return ((_a = profile.sigv4a_signing_region_set) != null ? _a : "").split(",").map((_) => _.trim());
|
|
217
|
+
}
|
|
218
|
+
throw new ProviderError("sigv4a_signing_region_set not set in profile.", {
|
|
219
|
+
tryNextLink: true
|
|
220
|
+
});
|
|
221
|
+
},
|
|
222
|
+
default: void 0
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
// ../../node_modules/@smithy/signature-v4/dist-es/HeaderFormatter.js
|
|
226
|
+
var HeaderFormatter = class {
|
|
227
|
+
format(headers) {
|
|
228
|
+
const chunks = [];
|
|
229
|
+
for (const headerName of Object.keys(headers)) {
|
|
230
|
+
const bytes = fromUtf8(headerName);
|
|
231
|
+
chunks.push(Uint8Array.from([bytes.byteLength]), bytes, this.formatHeaderValue(headers[headerName]));
|
|
232
|
+
}
|
|
233
|
+
const out = new Uint8Array(chunks.reduce((carry, bytes) => carry + bytes.byteLength, 0));
|
|
234
|
+
let position = 0;
|
|
235
|
+
for (const chunk of chunks) {
|
|
236
|
+
out.set(chunk, position);
|
|
237
|
+
position += chunk.byteLength;
|
|
238
|
+
}
|
|
239
|
+
return out;
|
|
240
|
+
}
|
|
241
|
+
formatHeaderValue(header) {
|
|
242
|
+
switch (header.type) {
|
|
243
|
+
case "boolean":
|
|
244
|
+
return Uint8Array.from([header.value ? HEADER_VALUE_TYPE.boolTrue : HEADER_VALUE_TYPE.boolFalse]);
|
|
245
|
+
case "byte":
|
|
246
|
+
return Uint8Array.from([HEADER_VALUE_TYPE.byte, header.value]);
|
|
247
|
+
case "short":
|
|
248
|
+
const shortView = new DataView(new ArrayBuffer(3));
|
|
249
|
+
shortView.setUint8(0, HEADER_VALUE_TYPE.short);
|
|
250
|
+
shortView.setInt16(1, header.value, false);
|
|
251
|
+
return new Uint8Array(shortView.buffer);
|
|
252
|
+
case "integer":
|
|
253
|
+
const intView = new DataView(new ArrayBuffer(5));
|
|
254
|
+
intView.setUint8(0, HEADER_VALUE_TYPE.integer);
|
|
255
|
+
intView.setInt32(1, header.value, false);
|
|
256
|
+
return new Uint8Array(intView.buffer);
|
|
257
|
+
case "long":
|
|
258
|
+
const longBytes = new Uint8Array(9);
|
|
259
|
+
longBytes[0] = HEADER_VALUE_TYPE.long;
|
|
260
|
+
longBytes.set(header.value.bytes, 1);
|
|
261
|
+
return longBytes;
|
|
262
|
+
case "binary":
|
|
263
|
+
const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength));
|
|
264
|
+
binView.setUint8(0, HEADER_VALUE_TYPE.byteArray);
|
|
265
|
+
binView.setUint16(1, header.value.byteLength, false);
|
|
266
|
+
const binBytes = new Uint8Array(binView.buffer);
|
|
267
|
+
binBytes.set(header.value, 3);
|
|
268
|
+
return binBytes;
|
|
269
|
+
case "string":
|
|
270
|
+
const utf8Bytes = fromUtf8(header.value);
|
|
271
|
+
const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength));
|
|
272
|
+
strView.setUint8(0, HEADER_VALUE_TYPE.string);
|
|
273
|
+
strView.setUint16(1, utf8Bytes.byteLength, false);
|
|
274
|
+
const strBytes = new Uint8Array(strView.buffer);
|
|
275
|
+
strBytes.set(utf8Bytes, 3);
|
|
276
|
+
return strBytes;
|
|
277
|
+
case "timestamp":
|
|
278
|
+
const tsBytes = new Uint8Array(9);
|
|
279
|
+
tsBytes[0] = HEADER_VALUE_TYPE.timestamp;
|
|
280
|
+
tsBytes.set(Int64.fromNumber(header.value.valueOf()).bytes, 1);
|
|
281
|
+
return tsBytes;
|
|
282
|
+
case "uuid":
|
|
283
|
+
if (!UUID_PATTERN.test(header.value)) {
|
|
284
|
+
throw new Error(`Invalid UUID received: ${header.value}`);
|
|
285
|
+
}
|
|
286
|
+
const uuidBytes = new Uint8Array(17);
|
|
287
|
+
uuidBytes[0] = HEADER_VALUE_TYPE.uuid;
|
|
288
|
+
uuidBytes.set(fromHex(header.value.replace(/-/g, "")), 1);
|
|
289
|
+
return uuidBytes;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
var HEADER_VALUE_TYPE;
|
|
294
|
+
(function(HEADER_VALUE_TYPE2) {
|
|
295
|
+
HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["boolTrue"] = 0] = "boolTrue";
|
|
296
|
+
HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["boolFalse"] = 1] = "boolFalse";
|
|
297
|
+
HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["byte"] = 2] = "byte";
|
|
298
|
+
HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["short"] = 3] = "short";
|
|
299
|
+
HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["integer"] = 4] = "integer";
|
|
300
|
+
HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["long"] = 5] = "long";
|
|
301
|
+
HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["byteArray"] = 6] = "byteArray";
|
|
302
|
+
HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["string"] = 7] = "string";
|
|
303
|
+
HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["timestamp"] = 8] = "timestamp";
|
|
304
|
+
HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["uuid"] = 9] = "uuid";
|
|
305
|
+
})(HEADER_VALUE_TYPE || (HEADER_VALUE_TYPE = {}));
|
|
306
|
+
var UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
|
|
307
|
+
var Int64 = class _Int64 {
|
|
308
|
+
constructor(bytes) {
|
|
309
|
+
__publicField(this, "bytes");
|
|
310
|
+
this.bytes = bytes;
|
|
311
|
+
if (bytes.byteLength !== 8) {
|
|
312
|
+
throw new Error("Int64 buffers must be exactly 8 bytes");
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
static fromNumber(number) {
|
|
316
|
+
if (number > 9223372036854776e3 || number < -9223372036854776e3) {
|
|
317
|
+
throw new Error(`${number} is too large (or, if negative, too small) to represent as an Int64`);
|
|
318
|
+
}
|
|
319
|
+
const bytes = new Uint8Array(8);
|
|
320
|
+
for (let i = 7, remaining = Math.abs(Math.round(number)); i > -1 && remaining > 0; i--, remaining /= 256) {
|
|
321
|
+
bytes[i] = remaining;
|
|
322
|
+
}
|
|
323
|
+
if (number < 0) {
|
|
324
|
+
negate(bytes);
|
|
325
|
+
}
|
|
326
|
+
return new _Int64(bytes);
|
|
327
|
+
}
|
|
328
|
+
valueOf() {
|
|
329
|
+
const bytes = this.bytes.slice(0);
|
|
330
|
+
const negative = bytes[0] & 128;
|
|
331
|
+
if (negative) {
|
|
332
|
+
negate(bytes);
|
|
333
|
+
}
|
|
334
|
+
return parseInt(toHex(bytes), 16) * (negative ? -1 : 1);
|
|
335
|
+
}
|
|
336
|
+
toString() {
|
|
337
|
+
return String(this.valueOf());
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
function negate(bytes) {
|
|
341
|
+
for (let i = 0; i < 8; i++) {
|
|
342
|
+
bytes[i] ^= 255;
|
|
343
|
+
}
|
|
344
|
+
for (let i = 7; i > -1; i--) {
|
|
345
|
+
bytes[i]++;
|
|
346
|
+
if (bytes[i] !== 0)
|
|
347
|
+
break;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// ../../node_modules/@smithy/signature-v4/dist-es/constants.js
|
|
352
|
+
var ALGORITHM_QUERY_PARAM = "X-Amz-Algorithm";
|
|
353
|
+
var CREDENTIAL_QUERY_PARAM = "X-Amz-Credential";
|
|
354
|
+
var AMZ_DATE_QUERY_PARAM = "X-Amz-Date";
|
|
355
|
+
var SIGNED_HEADERS_QUERY_PARAM = "X-Amz-SignedHeaders";
|
|
356
|
+
var EXPIRES_QUERY_PARAM = "X-Amz-Expires";
|
|
357
|
+
var SIGNATURE_QUERY_PARAM = "X-Amz-Signature";
|
|
358
|
+
var TOKEN_QUERY_PARAM = "X-Amz-Security-Token";
|
|
359
|
+
var AUTH_HEADER = "authorization";
|
|
360
|
+
var AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase();
|
|
361
|
+
var DATE_HEADER = "date";
|
|
362
|
+
var GENERATED_HEADERS = [AUTH_HEADER, AMZ_DATE_HEADER, DATE_HEADER];
|
|
363
|
+
var SIGNATURE_HEADER = SIGNATURE_QUERY_PARAM.toLowerCase();
|
|
364
|
+
var SHA256_HEADER = "x-amz-content-sha256";
|
|
365
|
+
var TOKEN_HEADER = TOKEN_QUERY_PARAM.toLowerCase();
|
|
366
|
+
var ALWAYS_UNSIGNABLE_HEADERS = {
|
|
367
|
+
authorization: true,
|
|
368
|
+
"cache-control": true,
|
|
369
|
+
connection: true,
|
|
370
|
+
expect: true,
|
|
371
|
+
from: true,
|
|
372
|
+
"keep-alive": true,
|
|
373
|
+
"max-forwards": true,
|
|
374
|
+
pragma: true,
|
|
375
|
+
referer: true,
|
|
376
|
+
te: true,
|
|
377
|
+
trailer: true,
|
|
378
|
+
"transfer-encoding": true,
|
|
379
|
+
upgrade: true,
|
|
380
|
+
"user-agent": true,
|
|
381
|
+
"x-amzn-trace-id": true
|
|
382
|
+
};
|
|
383
|
+
var PROXY_HEADER_PATTERN = /^proxy-/;
|
|
384
|
+
var SEC_HEADER_PATTERN = /^sec-/;
|
|
385
|
+
var ALGORITHM_IDENTIFIER = "AWS4-HMAC-SHA256";
|
|
386
|
+
var EVENT_ALGORITHM_IDENTIFIER = "AWS4-HMAC-SHA256-PAYLOAD";
|
|
387
|
+
var UNSIGNED_PAYLOAD = "UNSIGNED-PAYLOAD";
|
|
388
|
+
var MAX_CACHE_SIZE = 50;
|
|
389
|
+
var KEY_TYPE_IDENTIFIER = "aws4_request";
|
|
390
|
+
var MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7;
|
|
391
|
+
|
|
392
|
+
// ../../node_modules/@smithy/signature-v4/dist-es/getCanonicalQuery.js
|
|
393
|
+
var getCanonicalQuery = ({ query = {} }) => {
|
|
394
|
+
const keys = [];
|
|
395
|
+
const serialized = {};
|
|
396
|
+
for (const key of Object.keys(query)) {
|
|
397
|
+
if (key.toLowerCase() === SIGNATURE_HEADER) {
|
|
398
|
+
continue;
|
|
399
|
+
}
|
|
400
|
+
const encodedKey = escapeUri(key);
|
|
401
|
+
keys.push(encodedKey);
|
|
402
|
+
const value = query[key];
|
|
403
|
+
if (typeof value === "string") {
|
|
404
|
+
serialized[encodedKey] = `${encodedKey}=${escapeUri(value)}`;
|
|
405
|
+
} else if (Array.isArray(value)) {
|
|
406
|
+
serialized[encodedKey] = value.slice(0).reduce((encoded, value2) => encoded.concat([`${encodedKey}=${escapeUri(value2)}`]), []).sort().join("&");
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
return keys.sort().map((key) => serialized[key]).filter((serialized2) => serialized2).join("&");
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
// ../../node_modules/@smithy/signature-v4/dist-es/utilDate.js
|
|
413
|
+
var iso8601 = (time) => toDate(time).toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
414
|
+
var toDate = (time) => {
|
|
415
|
+
if (typeof time === "number") {
|
|
416
|
+
return new Date(time * 1e3);
|
|
417
|
+
}
|
|
418
|
+
if (typeof time === "string") {
|
|
419
|
+
if (Number(time)) {
|
|
420
|
+
return new Date(Number(time) * 1e3);
|
|
421
|
+
}
|
|
422
|
+
return new Date(time);
|
|
423
|
+
}
|
|
424
|
+
return time;
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
// ../../node_modules/@smithy/signature-v4/dist-es/SignatureV4Base.js
|
|
428
|
+
var SignatureV4Base = class {
|
|
429
|
+
constructor({ applyChecksum, credentials, region, service, sha256, uriEscapePath = true }) {
|
|
430
|
+
__publicField(this, "service");
|
|
431
|
+
__publicField(this, "regionProvider");
|
|
432
|
+
__publicField(this, "credentialProvider");
|
|
433
|
+
__publicField(this, "sha256");
|
|
434
|
+
__publicField(this, "uriEscapePath");
|
|
435
|
+
__publicField(this, "applyChecksum");
|
|
436
|
+
this.service = service;
|
|
437
|
+
this.sha256 = sha256;
|
|
438
|
+
this.uriEscapePath = uriEscapePath;
|
|
439
|
+
this.applyChecksum = typeof applyChecksum === "boolean" ? applyChecksum : true;
|
|
440
|
+
this.regionProvider = normalizeProvider(region);
|
|
441
|
+
this.credentialProvider = normalizeProvider(credentials);
|
|
442
|
+
}
|
|
443
|
+
createCanonicalRequest(request, canonicalHeaders, payloadHash) {
|
|
444
|
+
const sortedHeaders = Object.keys(canonicalHeaders).sort();
|
|
445
|
+
return `${request.method}
|
|
446
|
+
${this.getCanonicalPath(request)}
|
|
447
|
+
${getCanonicalQuery(request)}
|
|
448
|
+
${sortedHeaders.map((name) => `${name}:${canonicalHeaders[name]}`).join("\n")}
|
|
449
|
+
|
|
450
|
+
${sortedHeaders.join(";")}
|
|
451
|
+
${payloadHash}`;
|
|
452
|
+
}
|
|
453
|
+
async createStringToSign(longDate, credentialScope, canonicalRequest, algorithmIdentifier) {
|
|
454
|
+
const hash = new this.sha256();
|
|
455
|
+
hash.update(toUint8Array(canonicalRequest));
|
|
456
|
+
const hashedRequest = await hash.digest();
|
|
457
|
+
return `${algorithmIdentifier}
|
|
458
|
+
${longDate}
|
|
459
|
+
${credentialScope}
|
|
460
|
+
${toHex(hashedRequest)}`;
|
|
461
|
+
}
|
|
462
|
+
getCanonicalPath({ path }) {
|
|
463
|
+
if (this.uriEscapePath) {
|
|
464
|
+
const normalizedPathSegments = [];
|
|
465
|
+
for (const pathSegment of path.split("/")) {
|
|
466
|
+
if ((pathSegment == null ? void 0 : pathSegment.length) === 0)
|
|
467
|
+
continue;
|
|
468
|
+
if (pathSegment === ".")
|
|
469
|
+
continue;
|
|
470
|
+
if (pathSegment === "..") {
|
|
471
|
+
normalizedPathSegments.pop();
|
|
472
|
+
} else {
|
|
473
|
+
normalizedPathSegments.push(pathSegment);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
const normalizedPath = `${(path == null ? void 0 : path.startsWith("/")) ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && (path == null ? void 0 : path.endsWith("/")) ? "/" : ""}`;
|
|
477
|
+
const doubleEncoded = escapeUri(normalizedPath);
|
|
478
|
+
return doubleEncoded.replace(/%2F/g, "/");
|
|
479
|
+
}
|
|
480
|
+
return path;
|
|
481
|
+
}
|
|
482
|
+
validateResolvedCredentials(credentials) {
|
|
483
|
+
if (typeof credentials !== "object" || typeof credentials.accessKeyId !== "string" || typeof credentials.secretAccessKey !== "string") {
|
|
484
|
+
throw new Error("Resolved credential object is not valid");
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
formatDate(now) {
|
|
488
|
+
const longDate = iso8601(now).replace(/[-:]/g, "");
|
|
489
|
+
return {
|
|
490
|
+
longDate,
|
|
491
|
+
shortDate: longDate.slice(0, 8)
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
getCanonicalHeaderList(headers) {
|
|
495
|
+
return Object.keys(headers).sort().join(";");
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
// ../../node_modules/@smithy/signature-v4/dist-es/credentialDerivation.js
|
|
500
|
+
var signingKeyCache = {};
|
|
501
|
+
var cacheQueue = [];
|
|
502
|
+
var createScope = (shortDate, region, service) => `${shortDate}/${region}/${service}/${KEY_TYPE_IDENTIFIER}`;
|
|
503
|
+
var getSigningKey = async (sha256Constructor, credentials, shortDate, region, service) => {
|
|
504
|
+
const credsHash = await hmac(sha256Constructor, credentials.secretAccessKey, credentials.accessKeyId);
|
|
505
|
+
const cacheKey = `${shortDate}:${region}:${service}:${toHex(credsHash)}:${credentials.sessionToken}`;
|
|
506
|
+
if (cacheKey in signingKeyCache) {
|
|
507
|
+
return signingKeyCache[cacheKey];
|
|
508
|
+
}
|
|
509
|
+
cacheQueue.push(cacheKey);
|
|
510
|
+
while (cacheQueue.length > MAX_CACHE_SIZE) {
|
|
511
|
+
delete signingKeyCache[cacheQueue.shift()];
|
|
512
|
+
}
|
|
513
|
+
let key = `AWS4${credentials.secretAccessKey}`;
|
|
514
|
+
for (const signable of [shortDate, region, service, KEY_TYPE_IDENTIFIER]) {
|
|
515
|
+
key = await hmac(sha256Constructor, key, signable);
|
|
516
|
+
}
|
|
517
|
+
return signingKeyCache[cacheKey] = key;
|
|
518
|
+
};
|
|
519
|
+
var hmac = (ctor, secret, data) => {
|
|
520
|
+
const hash = new ctor(secret);
|
|
521
|
+
hash.update(toUint8Array(data));
|
|
522
|
+
return hash.digest();
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
// ../../node_modules/@smithy/signature-v4/dist-es/getCanonicalHeaders.js
|
|
526
|
+
var getCanonicalHeaders = ({ headers }, unsignableHeaders, signableHeaders) => {
|
|
527
|
+
const canonical = {};
|
|
528
|
+
for (const headerName of Object.keys(headers).sort()) {
|
|
529
|
+
if (headers[headerName] == void 0) {
|
|
530
|
+
continue;
|
|
531
|
+
}
|
|
532
|
+
const canonicalHeaderName = headerName.toLowerCase();
|
|
533
|
+
if (canonicalHeaderName in ALWAYS_UNSIGNABLE_HEADERS || (unsignableHeaders == null ? void 0 : unsignableHeaders.has(canonicalHeaderName)) || PROXY_HEADER_PATTERN.test(canonicalHeaderName) || SEC_HEADER_PATTERN.test(canonicalHeaderName)) {
|
|
534
|
+
if (!signableHeaders || signableHeaders && !signableHeaders.has(canonicalHeaderName)) {
|
|
535
|
+
continue;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
canonical[canonicalHeaderName] = headers[headerName].trim().replace(/\s+/g, " ");
|
|
539
|
+
}
|
|
540
|
+
return canonical;
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
// ../../node_modules/@smithy/signature-v4/dist-es/getPayloadHash.js
|
|
544
|
+
var getPayloadHash = async ({ headers, body }, hashConstructor) => {
|
|
545
|
+
for (const headerName of Object.keys(headers)) {
|
|
546
|
+
if (headerName.toLowerCase() === SHA256_HEADER) {
|
|
547
|
+
return headers[headerName];
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
if (body == void 0) {
|
|
551
|
+
return "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
|
|
552
|
+
} else if (typeof body === "string" || ArrayBuffer.isView(body) || isArrayBuffer(body)) {
|
|
553
|
+
const hashCtor = new hashConstructor();
|
|
554
|
+
hashCtor.update(toUint8Array(body));
|
|
555
|
+
return toHex(await hashCtor.digest());
|
|
556
|
+
}
|
|
557
|
+
return UNSIGNED_PAYLOAD;
|
|
558
|
+
};
|
|
559
|
+
|
|
560
|
+
// ../../node_modules/@smithy/signature-v4/dist-es/headerUtil.js
|
|
561
|
+
var hasHeader = (soughtHeader, headers) => {
|
|
562
|
+
soughtHeader = soughtHeader.toLowerCase();
|
|
563
|
+
for (const headerName of Object.keys(headers)) {
|
|
564
|
+
if (soughtHeader === headerName.toLowerCase()) {
|
|
565
|
+
return true;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
return false;
|
|
569
|
+
};
|
|
570
|
+
|
|
571
|
+
// ../../node_modules/@smithy/signature-v4/dist-es/moveHeadersToQuery.js
|
|
572
|
+
var moveHeadersToQuery = (request, options = {}) => {
|
|
573
|
+
var _a, _b;
|
|
574
|
+
const { headers, query = {} } = HttpRequest.clone(request);
|
|
575
|
+
for (const name of Object.keys(headers)) {
|
|
576
|
+
const lname = name.toLowerCase();
|
|
577
|
+
if (lname.slice(0, 6) === "x-amz-" && !((_a = options.unhoistableHeaders) == null ? void 0 : _a.has(lname)) || ((_b = options.hoistableHeaders) == null ? void 0 : _b.has(lname))) {
|
|
578
|
+
query[name] = headers[name];
|
|
579
|
+
delete headers[name];
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
return __spreadProps(__spreadValues({}, request), {
|
|
583
|
+
headers,
|
|
584
|
+
query
|
|
585
|
+
});
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
// ../../node_modules/@smithy/signature-v4/dist-es/prepareRequest.js
|
|
589
|
+
var prepareRequest = (request) => {
|
|
590
|
+
request = HttpRequest.clone(request);
|
|
591
|
+
for (const headerName of Object.keys(request.headers)) {
|
|
592
|
+
if (GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) {
|
|
593
|
+
delete request.headers[headerName];
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
return request;
|
|
597
|
+
};
|
|
598
|
+
|
|
599
|
+
// ../../node_modules/@smithy/signature-v4/dist-es/SignatureV4.js
|
|
600
|
+
var SignatureV4 = class extends SignatureV4Base {
|
|
601
|
+
constructor({ applyChecksum, credentials, region, service, sha256, uriEscapePath = true }) {
|
|
602
|
+
super({
|
|
603
|
+
applyChecksum,
|
|
604
|
+
credentials,
|
|
605
|
+
region,
|
|
606
|
+
service,
|
|
607
|
+
sha256,
|
|
608
|
+
uriEscapePath
|
|
609
|
+
});
|
|
610
|
+
__publicField(this, "headerFormatter", new HeaderFormatter());
|
|
611
|
+
}
|
|
612
|
+
async presign(originalRequest, options = {}) {
|
|
613
|
+
const { signingDate = /* @__PURE__ */ new Date(), expiresIn = 3600, unsignableHeaders, unhoistableHeaders, signableHeaders, hoistableHeaders, signingRegion, signingService } = options;
|
|
614
|
+
const credentials = await this.credentialProvider();
|
|
615
|
+
this.validateResolvedCredentials(credentials);
|
|
616
|
+
const region = signingRegion != null ? signingRegion : await this.regionProvider();
|
|
617
|
+
const { longDate, shortDate } = this.formatDate(signingDate);
|
|
618
|
+
if (expiresIn > MAX_PRESIGNED_TTL) {
|
|
619
|
+
return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");
|
|
620
|
+
}
|
|
621
|
+
const scope = createScope(shortDate, region, signingService != null ? signingService : this.service);
|
|
622
|
+
const request = moveHeadersToQuery(prepareRequest(originalRequest), { unhoistableHeaders, hoistableHeaders });
|
|
623
|
+
if (credentials.sessionToken) {
|
|
624
|
+
request.query[TOKEN_QUERY_PARAM] = credentials.sessionToken;
|
|
625
|
+
}
|
|
626
|
+
request.query[ALGORITHM_QUERY_PARAM] = ALGORITHM_IDENTIFIER;
|
|
627
|
+
request.query[CREDENTIAL_QUERY_PARAM] = `${credentials.accessKeyId}/${scope}`;
|
|
628
|
+
request.query[AMZ_DATE_QUERY_PARAM] = longDate;
|
|
629
|
+
request.query[EXPIRES_QUERY_PARAM] = expiresIn.toString(10);
|
|
630
|
+
const canonicalHeaders = getCanonicalHeaders(request, unsignableHeaders, signableHeaders);
|
|
631
|
+
request.query[SIGNED_HEADERS_QUERY_PARAM] = this.getCanonicalHeaderList(canonicalHeaders);
|
|
632
|
+
request.query[SIGNATURE_QUERY_PARAM] = await this.getSignature(longDate, scope, this.getSigningKey(credentials, region, shortDate, signingService), this.createCanonicalRequest(request, canonicalHeaders, await getPayloadHash(originalRequest, this.sha256)));
|
|
633
|
+
return request;
|
|
634
|
+
}
|
|
635
|
+
async sign(toSign, options) {
|
|
636
|
+
if (typeof toSign === "string") {
|
|
637
|
+
return this.signString(toSign, options);
|
|
638
|
+
} else if (toSign.headers && toSign.payload) {
|
|
639
|
+
return this.signEvent(toSign, options);
|
|
640
|
+
} else if (toSign.message) {
|
|
641
|
+
return this.signMessage(toSign, options);
|
|
642
|
+
} else {
|
|
643
|
+
return this.signRequest(toSign, options);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
async signEvent({ headers, payload }, { signingDate = /* @__PURE__ */ new Date(), priorSignature, signingRegion, signingService, eventStreamCredentials }) {
|
|
647
|
+
const region = signingRegion != null ? signingRegion : await this.regionProvider();
|
|
648
|
+
const { shortDate, longDate } = this.formatDate(signingDate);
|
|
649
|
+
const scope = createScope(shortDate, region, signingService != null ? signingService : this.service);
|
|
650
|
+
const hashedPayload = await getPayloadHash({ headers: {}, body: payload }, this.sha256);
|
|
651
|
+
const hash = new this.sha256();
|
|
652
|
+
hash.update(headers);
|
|
653
|
+
const hashedHeaders = toHex(await hash.digest());
|
|
654
|
+
const stringToSign = [
|
|
655
|
+
EVENT_ALGORITHM_IDENTIFIER,
|
|
656
|
+
longDate,
|
|
657
|
+
scope,
|
|
658
|
+
priorSignature,
|
|
659
|
+
hashedHeaders,
|
|
660
|
+
hashedPayload
|
|
661
|
+
].join("\n");
|
|
662
|
+
return this.signString(stringToSign, {
|
|
663
|
+
signingDate,
|
|
664
|
+
signingRegion: region,
|
|
665
|
+
signingService,
|
|
666
|
+
eventStreamCredentials
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
async signMessage(signableMessage, { signingDate = /* @__PURE__ */ new Date(), signingRegion, signingService, eventStreamCredentials }) {
|
|
670
|
+
const promise = this.signEvent({
|
|
671
|
+
headers: this.headerFormatter.format(signableMessage.message.headers),
|
|
672
|
+
payload: signableMessage.message.body
|
|
673
|
+
}, {
|
|
674
|
+
signingDate,
|
|
675
|
+
signingRegion,
|
|
676
|
+
signingService,
|
|
677
|
+
priorSignature: signableMessage.priorSignature,
|
|
678
|
+
eventStreamCredentials
|
|
679
|
+
});
|
|
680
|
+
return promise.then((signature) => {
|
|
681
|
+
return { message: signableMessage.message, signature };
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
async signString(stringToSign, { signingDate = /* @__PURE__ */ new Date(), signingRegion, signingService, eventStreamCredentials } = {}) {
|
|
685
|
+
const credentials = eventStreamCredentials != null ? eventStreamCredentials : await this.credentialProvider();
|
|
686
|
+
this.validateResolvedCredentials(credentials);
|
|
687
|
+
const region = signingRegion != null ? signingRegion : await this.regionProvider();
|
|
688
|
+
const { shortDate } = this.formatDate(signingDate);
|
|
689
|
+
const hash = new this.sha256(await this.getSigningKey(credentials, region, shortDate, signingService));
|
|
690
|
+
hash.update(toUint8Array(stringToSign));
|
|
691
|
+
return toHex(await hash.digest());
|
|
692
|
+
}
|
|
693
|
+
async signRequest(requestToSign, { signingDate = /* @__PURE__ */ new Date(), signableHeaders, unsignableHeaders, signingRegion, signingService } = {}) {
|
|
694
|
+
const credentials = await this.credentialProvider();
|
|
695
|
+
this.validateResolvedCredentials(credentials);
|
|
696
|
+
const region = signingRegion != null ? signingRegion : await this.regionProvider();
|
|
697
|
+
const request = prepareRequest(requestToSign);
|
|
698
|
+
const { longDate, shortDate } = this.formatDate(signingDate);
|
|
699
|
+
const scope = createScope(shortDate, region, signingService != null ? signingService : this.service);
|
|
700
|
+
request.headers[AMZ_DATE_HEADER] = longDate;
|
|
701
|
+
if (credentials.sessionToken) {
|
|
702
|
+
request.headers[TOKEN_HEADER] = credentials.sessionToken;
|
|
703
|
+
}
|
|
704
|
+
const payloadHash = await getPayloadHash(request, this.sha256);
|
|
705
|
+
if (!hasHeader(SHA256_HEADER, request.headers) && this.applyChecksum) {
|
|
706
|
+
request.headers[SHA256_HEADER] = payloadHash;
|
|
707
|
+
}
|
|
708
|
+
const canonicalHeaders = getCanonicalHeaders(request, unsignableHeaders, signableHeaders);
|
|
709
|
+
const signature = await this.getSignature(longDate, scope, this.getSigningKey(credentials, region, shortDate, signingService), this.createCanonicalRequest(request, canonicalHeaders, payloadHash));
|
|
710
|
+
request.headers[AUTH_HEADER] = `${ALGORITHM_IDENTIFIER} Credential=${credentials.accessKeyId}/${scope}, SignedHeaders=${this.getCanonicalHeaderList(canonicalHeaders)}, Signature=${signature}`;
|
|
711
|
+
return request;
|
|
712
|
+
}
|
|
713
|
+
async getSignature(longDate, credentialScope, keyPromise, canonicalRequest) {
|
|
714
|
+
const stringToSign = await this.createStringToSign(longDate, credentialScope, canonicalRequest, ALGORITHM_IDENTIFIER);
|
|
715
|
+
const hash = new this.sha256(await keyPromise);
|
|
716
|
+
hash.update(toUint8Array(stringToSign));
|
|
717
|
+
return toHex(await hash.digest());
|
|
718
|
+
}
|
|
719
|
+
getSigningKey(credentials, region, shortDate, service) {
|
|
720
|
+
return getSigningKey(this.sha256, credentials, shortDate, region, service || this.service);
|
|
721
|
+
}
|
|
722
|
+
};
|
|
723
|
+
|
|
724
|
+
// ../../node_modules/@smithy/signature-v4/dist-es/signature-v4a-container.js
|
|
725
|
+
var signatureV4aContainer = {
|
|
726
|
+
SignatureV4a: null
|
|
727
|
+
};
|
|
728
|
+
|
|
729
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.js
|
|
730
|
+
var resolveAwsSdkSigV4Config = (config) => {
|
|
731
|
+
let inputCredentials = config.credentials;
|
|
732
|
+
let isUserSupplied = !!config.credentials;
|
|
733
|
+
let resolvedCredentials = void 0;
|
|
734
|
+
Object.defineProperty(config, "credentials", {
|
|
735
|
+
set(credentials) {
|
|
736
|
+
if (credentials && credentials !== inputCredentials && credentials !== resolvedCredentials) {
|
|
737
|
+
isUserSupplied = true;
|
|
738
|
+
}
|
|
739
|
+
inputCredentials = credentials;
|
|
740
|
+
const memoizedProvider = normalizeCredentialProvider(config, {
|
|
741
|
+
credentials: inputCredentials,
|
|
742
|
+
credentialDefaultProvider: config.credentialDefaultProvider
|
|
743
|
+
});
|
|
744
|
+
const boundProvider = bindCallerConfig(config, memoizedProvider);
|
|
745
|
+
if (isUserSupplied && !boundProvider.attributed) {
|
|
746
|
+
const isCredentialObject = typeof inputCredentials === "object" && inputCredentials !== null;
|
|
747
|
+
resolvedCredentials = async (options) => {
|
|
748
|
+
const creds = await boundProvider(options);
|
|
749
|
+
const attributedCreds = creds;
|
|
750
|
+
if (isCredentialObject && (!attributedCreds.$source || Object.keys(attributedCreds.$source).length === 0)) {
|
|
751
|
+
return setCredentialFeature(attributedCreds, "CREDENTIALS_CODE", "e");
|
|
752
|
+
}
|
|
753
|
+
return attributedCreds;
|
|
754
|
+
};
|
|
755
|
+
resolvedCredentials.memoized = boundProvider.memoized;
|
|
756
|
+
resolvedCredentials.configBound = boundProvider.configBound;
|
|
757
|
+
resolvedCredentials.attributed = true;
|
|
758
|
+
} else {
|
|
759
|
+
resolvedCredentials = boundProvider;
|
|
760
|
+
}
|
|
761
|
+
},
|
|
762
|
+
get() {
|
|
763
|
+
return resolvedCredentials;
|
|
764
|
+
},
|
|
765
|
+
enumerable: true,
|
|
766
|
+
configurable: true
|
|
767
|
+
});
|
|
768
|
+
config.credentials = inputCredentials;
|
|
769
|
+
const { signingEscapePath = true, systemClockOffset = config.systemClockOffset || 0, sha256 } = config;
|
|
770
|
+
let signer;
|
|
771
|
+
if (config.signer) {
|
|
772
|
+
signer = normalizeProvider2(config.signer);
|
|
773
|
+
} else if (config.regionInfoProvider) {
|
|
774
|
+
signer = () => normalizeProvider2(config.region)().then(async (region) => [
|
|
775
|
+
await config.regionInfoProvider(region, {
|
|
776
|
+
useFipsEndpoint: await config.useFipsEndpoint(),
|
|
777
|
+
useDualstackEndpoint: await config.useDualstackEndpoint()
|
|
778
|
+
}) || {},
|
|
779
|
+
region
|
|
780
|
+
]).then(([regionInfo, region]) => {
|
|
781
|
+
const { signingRegion, signingService } = regionInfo;
|
|
782
|
+
config.signingRegion = config.signingRegion || signingRegion || region;
|
|
783
|
+
config.signingName = config.signingName || signingService || config.serviceId;
|
|
784
|
+
const params = __spreadProps(__spreadValues({}, config), {
|
|
785
|
+
credentials: config.credentials,
|
|
786
|
+
region: config.signingRegion,
|
|
787
|
+
service: config.signingName,
|
|
788
|
+
sha256,
|
|
789
|
+
uriEscapePath: signingEscapePath
|
|
790
|
+
});
|
|
791
|
+
const SignerCtor = config.signerConstructor || SignatureV4;
|
|
792
|
+
return new SignerCtor(params);
|
|
793
|
+
});
|
|
794
|
+
} else {
|
|
795
|
+
signer = async (authScheme) => {
|
|
796
|
+
authScheme = Object.assign({}, {
|
|
797
|
+
name: "sigv4",
|
|
798
|
+
signingName: config.signingName || config.defaultSigningName,
|
|
799
|
+
signingRegion: await normalizeProvider2(config.region)(),
|
|
800
|
+
properties: {}
|
|
801
|
+
}, authScheme);
|
|
802
|
+
const signingRegion = authScheme.signingRegion;
|
|
803
|
+
const signingService = authScheme.signingName;
|
|
804
|
+
config.signingRegion = config.signingRegion || signingRegion;
|
|
805
|
+
config.signingName = config.signingName || signingService || config.serviceId;
|
|
806
|
+
const params = __spreadProps(__spreadValues({}, config), {
|
|
807
|
+
credentials: config.credentials,
|
|
808
|
+
region: config.signingRegion,
|
|
809
|
+
service: config.signingName,
|
|
810
|
+
sha256,
|
|
811
|
+
uriEscapePath: signingEscapePath
|
|
812
|
+
});
|
|
813
|
+
const SignerCtor = config.signerConstructor || SignatureV4;
|
|
814
|
+
return new SignerCtor(params);
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
const resolvedConfig = Object.assign(config, {
|
|
818
|
+
systemClockOffset,
|
|
819
|
+
signingEscapePath,
|
|
820
|
+
signer
|
|
821
|
+
});
|
|
822
|
+
return resolvedConfig;
|
|
823
|
+
};
|
|
824
|
+
function normalizeCredentialProvider(config, { credentials, credentialDefaultProvider }) {
|
|
825
|
+
let credentialsProvider;
|
|
826
|
+
if (credentials) {
|
|
827
|
+
if (!(credentials == null ? void 0 : credentials.memoized)) {
|
|
828
|
+
credentialsProvider = memoizeIdentityProvider(credentials, isIdentityExpired, doesIdentityRequireRefresh);
|
|
829
|
+
} else {
|
|
830
|
+
credentialsProvider = credentials;
|
|
831
|
+
}
|
|
832
|
+
} else {
|
|
833
|
+
if (credentialDefaultProvider) {
|
|
834
|
+
credentialsProvider = normalizeProvider2(credentialDefaultProvider(Object.assign({}, config, {
|
|
835
|
+
parentClientConfig: config
|
|
836
|
+
})));
|
|
837
|
+
} else {
|
|
838
|
+
credentialsProvider = async () => {
|
|
839
|
+
throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.");
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
credentialsProvider.memoized = true;
|
|
844
|
+
return credentialsProvider;
|
|
845
|
+
}
|
|
846
|
+
function bindCallerConfig(config, credentialsProvider) {
|
|
847
|
+
if (credentialsProvider.configBound) {
|
|
848
|
+
return credentialsProvider;
|
|
849
|
+
}
|
|
850
|
+
const fn = async (options) => credentialsProvider(__spreadProps(__spreadValues({}, options), { callerClientConfig: config }));
|
|
851
|
+
fn.memoized = credentialsProvider.memoized;
|
|
852
|
+
fn.configBound = true;
|
|
853
|
+
return fn;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/ProtocolLib.js
|
|
857
|
+
var ProtocolLib = class {
|
|
858
|
+
constructor(queryCompat = false) {
|
|
859
|
+
__publicField(this, "queryCompat");
|
|
860
|
+
__publicField(this, "errorRegistry");
|
|
861
|
+
this.queryCompat = queryCompat;
|
|
862
|
+
}
|
|
863
|
+
resolveRestContentType(defaultContentType, inputSchema) {
|
|
864
|
+
const members = inputSchema.getMemberSchemas();
|
|
865
|
+
const httpPayloadMember = Object.values(members).find((m) => {
|
|
866
|
+
return !!m.getMergedTraits().httpPayload;
|
|
867
|
+
});
|
|
868
|
+
if (httpPayloadMember) {
|
|
869
|
+
const mediaType = httpPayloadMember.getMergedTraits().mediaType;
|
|
870
|
+
if (mediaType) {
|
|
871
|
+
return mediaType;
|
|
872
|
+
} else if (httpPayloadMember.isStringSchema()) {
|
|
873
|
+
return "text/plain";
|
|
874
|
+
} else if (httpPayloadMember.isBlobSchema()) {
|
|
875
|
+
return "application/octet-stream";
|
|
876
|
+
} else {
|
|
877
|
+
return defaultContentType;
|
|
878
|
+
}
|
|
879
|
+
} else if (!inputSchema.isUnitSchema()) {
|
|
880
|
+
const hasBody = Object.values(members).find((m) => {
|
|
881
|
+
const { httpQuery, httpQueryParams, httpHeader, httpLabel, httpPrefixHeaders } = m.getMergedTraits();
|
|
882
|
+
const noPrefixHeaders = httpPrefixHeaders === void 0;
|
|
883
|
+
return !httpQuery && !httpQueryParams && !httpHeader && !httpLabel && noPrefixHeaders;
|
|
884
|
+
});
|
|
885
|
+
if (hasBody) {
|
|
886
|
+
return defaultContentType;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
async getErrorSchemaOrThrowBaseException(errorIdentifier, defaultNamespace, response, dataObject, metadata, getErrorSchema) {
|
|
891
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
892
|
+
let errorName = errorIdentifier;
|
|
893
|
+
if (errorIdentifier.includes("#")) {
|
|
894
|
+
[, errorName] = errorIdentifier.split("#");
|
|
895
|
+
}
|
|
896
|
+
const errorMetadata = {
|
|
897
|
+
$metadata: metadata,
|
|
898
|
+
$fault: response.statusCode < 500 ? "client" : "server"
|
|
899
|
+
};
|
|
900
|
+
if (!this.errorRegistry) {
|
|
901
|
+
throw new Error("@aws-sdk/core/protocols - error handler not initialized.");
|
|
902
|
+
}
|
|
903
|
+
try {
|
|
904
|
+
const errorSchema = (_a = getErrorSchema == null ? void 0 : getErrorSchema(this.errorRegistry, errorName)) != null ? _a : this.errorRegistry.getSchema(errorIdentifier);
|
|
905
|
+
return { errorSchema, errorMetadata };
|
|
906
|
+
} catch (e) {
|
|
907
|
+
dataObject.message = (_c = (_b = dataObject.message) != null ? _b : dataObject.Message) != null ? _c : "UnknownError";
|
|
908
|
+
const synthetic = this.errorRegistry;
|
|
909
|
+
const baseExceptionSchema = synthetic.getBaseException();
|
|
910
|
+
if (baseExceptionSchema) {
|
|
911
|
+
const ErrorCtor = (_d = synthetic.getErrorCtor(baseExceptionSchema)) != null ? _d : Error;
|
|
912
|
+
throw this.decorateServiceException(Object.assign(new ErrorCtor({ name: errorName }), errorMetadata), dataObject);
|
|
913
|
+
}
|
|
914
|
+
const d = dataObject;
|
|
915
|
+
const message = (_i = (_g = (_e = d == null ? void 0 : d.message) != null ? _e : d == null ? void 0 : d.Message) != null ? _g : (_f = d == null ? void 0 : d.Error) == null ? void 0 : _f.Message) != null ? _i : (_h = d == null ? void 0 : d.Error) == null ? void 0 : _h.message;
|
|
916
|
+
throw this.decorateServiceException(Object.assign(new Error(message), {
|
|
917
|
+
name: errorName
|
|
918
|
+
}, errorMetadata), dataObject);
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
compose(composite, errorIdentifier, defaultNamespace) {
|
|
922
|
+
let namespace = defaultNamespace;
|
|
923
|
+
if (errorIdentifier.includes("#")) {
|
|
924
|
+
[namespace] = errorIdentifier.split("#");
|
|
925
|
+
}
|
|
926
|
+
const staticRegistry = TypeRegistry.for(namespace);
|
|
927
|
+
const defaultSyntheticRegistry = TypeRegistry.for("smithy.ts.sdk.synthetic." + defaultNamespace);
|
|
928
|
+
composite.copyFrom(staticRegistry);
|
|
929
|
+
composite.copyFrom(defaultSyntheticRegistry);
|
|
930
|
+
this.errorRegistry = composite;
|
|
931
|
+
}
|
|
932
|
+
decorateServiceException(exception, additions = {}) {
|
|
933
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
934
|
+
if (this.queryCompat) {
|
|
935
|
+
const msg = (_a = exception.Message) != null ? _a : additions.Message;
|
|
936
|
+
const error = decorateServiceException(exception, additions);
|
|
937
|
+
if (msg) {
|
|
938
|
+
error.message = msg;
|
|
939
|
+
}
|
|
940
|
+
const errorObj = (_b = error.Error) != null ? _b : {};
|
|
941
|
+
errorObj.Type = (_c = error.Error) == null ? void 0 : _c.Type;
|
|
942
|
+
errorObj.Code = (_d = error.Error) == null ? void 0 : _d.Code;
|
|
943
|
+
errorObj.Message = (_h = (_g = (_e = error.Error) == null ? void 0 : _e.message) != null ? _g : (_f = error.Error) == null ? void 0 : _f.Message) != null ? _h : msg;
|
|
944
|
+
error.Error = errorObj;
|
|
945
|
+
const reqId = error.$metadata.requestId;
|
|
946
|
+
if (reqId) {
|
|
947
|
+
error.RequestId = reqId;
|
|
948
|
+
}
|
|
949
|
+
return error;
|
|
950
|
+
}
|
|
951
|
+
return decorateServiceException(exception, additions);
|
|
952
|
+
}
|
|
953
|
+
setQueryCompatError(output, response) {
|
|
954
|
+
var _a;
|
|
955
|
+
const queryErrorHeader = (_a = response.headers) == null ? void 0 : _a["x-amzn-query-error"];
|
|
956
|
+
if (output !== void 0 && queryErrorHeader != null) {
|
|
957
|
+
const [Code, Type] = queryErrorHeader.split(";");
|
|
958
|
+
const keys = Object.keys(output);
|
|
959
|
+
const Error2 = {
|
|
960
|
+
Code,
|
|
961
|
+
Type
|
|
962
|
+
};
|
|
963
|
+
output.Code = Code;
|
|
964
|
+
output.Type = Type;
|
|
965
|
+
for (let i = 0; i < keys.length; i++) {
|
|
966
|
+
const k = keys[i];
|
|
967
|
+
Error2[k === "message" ? "Message" : k] = output[k];
|
|
968
|
+
}
|
|
969
|
+
delete Error2.__type;
|
|
970
|
+
output.Error = Error2;
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
queryCompatOutput(queryCompatErrorData, errorData) {
|
|
974
|
+
if (queryCompatErrorData.Error) {
|
|
975
|
+
errorData.Error = queryCompatErrorData.Error;
|
|
976
|
+
}
|
|
977
|
+
if (queryCompatErrorData.Type) {
|
|
978
|
+
errorData.Type = queryCompatErrorData.Type;
|
|
979
|
+
}
|
|
980
|
+
if (queryCompatErrorData.Code) {
|
|
981
|
+
errorData.Code = queryCompatErrorData.Code;
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
findQueryCompatibleError(registry, errorName) {
|
|
985
|
+
try {
|
|
986
|
+
return registry.getSchema(errorName);
|
|
987
|
+
} catch (e) {
|
|
988
|
+
return registry.find((schema) => {
|
|
989
|
+
var _a;
|
|
990
|
+
return ((_a = NormalizedSchema.of(schema).getMergedTraits().awsQueryError) == null ? void 0 : _a[0]) === errorName;
|
|
991
|
+
});
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
};
|
|
995
|
+
|
|
996
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/ConfigurableSerdeContext.js
|
|
997
|
+
var SerdeContextConfig = class {
|
|
998
|
+
constructor() {
|
|
999
|
+
__publicField(this, "serdeContext");
|
|
1000
|
+
}
|
|
1001
|
+
setSerdeContext(serdeContext) {
|
|
1002
|
+
this.serdeContext = serdeContext;
|
|
1003
|
+
}
|
|
1004
|
+
};
|
|
1005
|
+
|
|
1006
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/UnionSerde.js
|
|
1007
|
+
var UnionSerde = class {
|
|
1008
|
+
constructor(from, to) {
|
|
1009
|
+
__publicField(this, "from");
|
|
1010
|
+
__publicField(this, "to");
|
|
1011
|
+
__publicField(this, "keys");
|
|
1012
|
+
this.from = from;
|
|
1013
|
+
this.to = to;
|
|
1014
|
+
const keys = Object.keys(this.from);
|
|
1015
|
+
const set = new Set(keys);
|
|
1016
|
+
set.delete("__type");
|
|
1017
|
+
this.keys = set;
|
|
1018
|
+
}
|
|
1019
|
+
mark(key) {
|
|
1020
|
+
this.keys.delete(key);
|
|
1021
|
+
}
|
|
1022
|
+
hasUnknown() {
|
|
1023
|
+
return this.keys.size === 1 && Object.keys(this.to).length === 0;
|
|
1024
|
+
}
|
|
1025
|
+
writeUnknown() {
|
|
1026
|
+
if (this.hasUnknown()) {
|
|
1027
|
+
const k = this.keys.values().next().value;
|
|
1028
|
+
const v = this.from[k];
|
|
1029
|
+
this.to.$unknown = [k, v];
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
};
|
|
1033
|
+
|
|
1034
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/jsonReviver.js
|
|
1035
|
+
function jsonReviver(key, value, context) {
|
|
1036
|
+
if (context == null ? void 0 : context.source) {
|
|
1037
|
+
const numericString = context.source;
|
|
1038
|
+
if (typeof value === "number") {
|
|
1039
|
+
if (value > Number.MAX_SAFE_INTEGER || value < Number.MIN_SAFE_INTEGER || numericString !== String(value)) {
|
|
1040
|
+
const isFractional = numericString.includes(".");
|
|
1041
|
+
if (isFractional) {
|
|
1042
|
+
return new NumericValue(numericString, "bigDecimal");
|
|
1043
|
+
} else {
|
|
1044
|
+
return BigInt(numericString);
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
return value;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/common.js
|
|
1053
|
+
var collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => {
|
|
1054
|
+
var _a;
|
|
1055
|
+
return ((_a = context == null ? void 0 : context.utf8Encoder) != null ? _a : toUtf8)(body);
|
|
1056
|
+
});
|
|
1057
|
+
|
|
1058
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/parseJsonBody.js
|
|
1059
|
+
var parseJsonBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
|
|
1060
|
+
if (encoded.length) {
|
|
1061
|
+
try {
|
|
1062
|
+
return JSON.parse(encoded);
|
|
1063
|
+
} catch (e) {
|
|
1064
|
+
if ((e == null ? void 0 : e.name) === "SyntaxError") {
|
|
1065
|
+
Object.defineProperty(e, "$responseBodyText", {
|
|
1066
|
+
value: encoded
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
throw e;
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
return {};
|
|
1073
|
+
});
|
|
1074
|
+
var findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
1075
|
+
var sanitizeErrorCode = (rawValue) => {
|
|
1076
|
+
let cleanValue = rawValue;
|
|
1077
|
+
if (typeof cleanValue === "number") {
|
|
1078
|
+
cleanValue = cleanValue.toString();
|
|
1079
|
+
}
|
|
1080
|
+
if (cleanValue.indexOf(",") >= 0) {
|
|
1081
|
+
cleanValue = cleanValue.split(",")[0];
|
|
1082
|
+
}
|
|
1083
|
+
if (cleanValue.indexOf(":") >= 0) {
|
|
1084
|
+
cleanValue = cleanValue.split(":")[0];
|
|
1085
|
+
}
|
|
1086
|
+
if (cleanValue.indexOf("#") >= 0) {
|
|
1087
|
+
cleanValue = cleanValue.split("#")[1];
|
|
1088
|
+
}
|
|
1089
|
+
return cleanValue;
|
|
1090
|
+
};
|
|
1091
|
+
var loadRestJsonErrorCode = (output, data) => {
|
|
1092
|
+
return loadErrorCode(output, data, ["header", "code", "type"]);
|
|
1093
|
+
};
|
|
1094
|
+
var loadJsonRpcErrorCode = (output, data, queryCompat = false) => {
|
|
1095
|
+
return loadErrorCode(output, data, queryCompat ? ["code", "header", "type"] : ["type", "code", "header"]);
|
|
1096
|
+
};
|
|
1097
|
+
var loadErrorCode = ({ headers }, data, order) => {
|
|
1098
|
+
while (order.length > 0) {
|
|
1099
|
+
const location = order.shift();
|
|
1100
|
+
switch (location) {
|
|
1101
|
+
case "header":
|
|
1102
|
+
const headerKey = findKey(headers != null ? headers : {}, "x-amzn-errortype");
|
|
1103
|
+
if (headerKey !== void 0) {
|
|
1104
|
+
return sanitizeErrorCode(headers[headerKey]);
|
|
1105
|
+
}
|
|
1106
|
+
break;
|
|
1107
|
+
case "code":
|
|
1108
|
+
const codeKey = findKey(data != null ? data : {}, "code");
|
|
1109
|
+
if (codeKey && data[codeKey] !== void 0) {
|
|
1110
|
+
return sanitizeErrorCode(data[codeKey]);
|
|
1111
|
+
}
|
|
1112
|
+
break;
|
|
1113
|
+
case "type":
|
|
1114
|
+
if ((data == null ? void 0 : data.__type) !== void 0) {
|
|
1115
|
+
return sanitizeErrorCode(data.__type);
|
|
1116
|
+
}
|
|
1117
|
+
break;
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
};
|
|
1121
|
+
|
|
1122
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeDeserializer.js
|
|
1123
|
+
var JsonShapeDeserializer = class extends SerdeContextConfig {
|
|
1124
|
+
constructor(settings) {
|
|
1125
|
+
super();
|
|
1126
|
+
__publicField(this, "settings");
|
|
1127
|
+
this.settings = settings;
|
|
1128
|
+
}
|
|
1129
|
+
async read(schema, data) {
|
|
1130
|
+
return this._read(schema, typeof data === "string" ? JSON.parse(data, jsonReviver) : await parseJsonBody(data, this.serdeContext));
|
|
1131
|
+
}
|
|
1132
|
+
readObject(schema, data) {
|
|
1133
|
+
return this._read(schema, data);
|
|
1134
|
+
}
|
|
1135
|
+
_read(schema, value) {
|
|
1136
|
+
var _a, _b;
|
|
1137
|
+
const isObject = value !== null && typeof value === "object";
|
|
1138
|
+
const ns = NormalizedSchema.of(schema);
|
|
1139
|
+
if (isObject) {
|
|
1140
|
+
if (ns.isStructSchema()) {
|
|
1141
|
+
const record = value;
|
|
1142
|
+
const union = ns.isUnionSchema();
|
|
1143
|
+
const out = {};
|
|
1144
|
+
let nameMap = void 0;
|
|
1145
|
+
const { jsonName } = this.settings;
|
|
1146
|
+
if (jsonName) {
|
|
1147
|
+
nameMap = {};
|
|
1148
|
+
}
|
|
1149
|
+
let unionSerde;
|
|
1150
|
+
if (union) {
|
|
1151
|
+
unionSerde = new UnionSerde(record, out);
|
|
1152
|
+
}
|
|
1153
|
+
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
1154
|
+
let fromKey = memberName;
|
|
1155
|
+
if (jsonName) {
|
|
1156
|
+
fromKey = (_a = memberSchema.getMergedTraits().jsonName) != null ? _a : fromKey;
|
|
1157
|
+
nameMap[fromKey] = memberName;
|
|
1158
|
+
}
|
|
1159
|
+
if (union) {
|
|
1160
|
+
unionSerde.mark(fromKey);
|
|
1161
|
+
}
|
|
1162
|
+
if (record[fromKey] != null) {
|
|
1163
|
+
out[memberName] = this._read(memberSchema, record[fromKey]);
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
if (union) {
|
|
1167
|
+
unionSerde.writeUnknown();
|
|
1168
|
+
} else if (typeof record.__type === "string") {
|
|
1169
|
+
for (const k in record) {
|
|
1170
|
+
const v = record[k];
|
|
1171
|
+
const t = jsonName ? (_b = nameMap[k]) != null ? _b : k : k;
|
|
1172
|
+
if (!(t in out)) {
|
|
1173
|
+
out[t] = v;
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
return out;
|
|
1178
|
+
}
|
|
1179
|
+
if (Array.isArray(value) && ns.isListSchema()) {
|
|
1180
|
+
const listMember = ns.getValueSchema();
|
|
1181
|
+
const out = [];
|
|
1182
|
+
for (const item of value) {
|
|
1183
|
+
out.push(this._read(listMember, item));
|
|
1184
|
+
}
|
|
1185
|
+
return out;
|
|
1186
|
+
}
|
|
1187
|
+
if (ns.isMapSchema()) {
|
|
1188
|
+
const mapMember = ns.getValueSchema();
|
|
1189
|
+
const out = {};
|
|
1190
|
+
for (const _k in value) {
|
|
1191
|
+
out[_k] = this._read(mapMember, value[_k]);
|
|
1192
|
+
}
|
|
1193
|
+
return out;
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
if (ns.isBlobSchema() && typeof value === "string") {
|
|
1197
|
+
return fromBase64(value);
|
|
1198
|
+
}
|
|
1199
|
+
const mediaType = ns.getMergedTraits().mediaType;
|
|
1200
|
+
if (ns.isStringSchema() && typeof value === "string" && mediaType) {
|
|
1201
|
+
const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
|
|
1202
|
+
if (isJson) {
|
|
1203
|
+
return LazyJsonString.from(value);
|
|
1204
|
+
}
|
|
1205
|
+
return value;
|
|
1206
|
+
}
|
|
1207
|
+
if (ns.isTimestampSchema() && value != null) {
|
|
1208
|
+
const format = determineTimestampFormat(ns, this.settings);
|
|
1209
|
+
switch (format) {
|
|
1210
|
+
case 5:
|
|
1211
|
+
return parseRfc3339DateTimeWithOffset(value);
|
|
1212
|
+
case 6:
|
|
1213
|
+
return parseRfc7231DateTime(value);
|
|
1214
|
+
case 7:
|
|
1215
|
+
return parseEpochTimestamp(value);
|
|
1216
|
+
default:
|
|
1217
|
+
console.warn("Missing timestamp format, parsing value with Date constructor:", value);
|
|
1218
|
+
return new Date(value);
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
if (ns.isBigIntegerSchema() && (typeof value === "number" || typeof value === "string")) {
|
|
1222
|
+
return BigInt(value);
|
|
1223
|
+
}
|
|
1224
|
+
if (ns.isBigDecimalSchema() && value != void 0) {
|
|
1225
|
+
if (value instanceof NumericValue) {
|
|
1226
|
+
return value;
|
|
1227
|
+
}
|
|
1228
|
+
const untyped = value;
|
|
1229
|
+
if (untyped.type === "bigDecimal" && "string" in untyped) {
|
|
1230
|
+
return new NumericValue(untyped.string, untyped.type);
|
|
1231
|
+
}
|
|
1232
|
+
return new NumericValue(String(value), "bigDecimal");
|
|
1233
|
+
}
|
|
1234
|
+
if (ns.isNumericSchema() && typeof value === "string") {
|
|
1235
|
+
switch (value) {
|
|
1236
|
+
case "Infinity":
|
|
1237
|
+
return Infinity;
|
|
1238
|
+
case "-Infinity":
|
|
1239
|
+
return -Infinity;
|
|
1240
|
+
case "NaN":
|
|
1241
|
+
return NaN;
|
|
1242
|
+
}
|
|
1243
|
+
return value;
|
|
1244
|
+
}
|
|
1245
|
+
if (ns.isDocumentSchema()) {
|
|
1246
|
+
if (isObject) {
|
|
1247
|
+
const out = Array.isArray(value) ? [] : {};
|
|
1248
|
+
for (const k in value) {
|
|
1249
|
+
const v = value[k];
|
|
1250
|
+
if (v instanceof NumericValue) {
|
|
1251
|
+
out[k] = v;
|
|
1252
|
+
} else {
|
|
1253
|
+
out[k] = this._read(ns, v);
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
return out;
|
|
1257
|
+
} else {
|
|
1258
|
+
return structuredClone(value);
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
return value;
|
|
1262
|
+
}
|
|
1263
|
+
};
|
|
1264
|
+
|
|
1265
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/jsonReplacer.js
|
|
1266
|
+
var NUMERIC_CONTROL_CHAR = String.fromCharCode(925);
|
|
1267
|
+
var JsonReplacer = class {
|
|
1268
|
+
constructor() {
|
|
1269
|
+
__publicField(this, "values", /* @__PURE__ */ new Map());
|
|
1270
|
+
__publicField(this, "counter", 0);
|
|
1271
|
+
__publicField(this, "stage", 0);
|
|
1272
|
+
}
|
|
1273
|
+
createReplacer() {
|
|
1274
|
+
if (this.stage === 1) {
|
|
1275
|
+
throw new Error("@aws-sdk/core/protocols - JsonReplacer already created.");
|
|
1276
|
+
}
|
|
1277
|
+
if (this.stage === 2) {
|
|
1278
|
+
throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");
|
|
1279
|
+
}
|
|
1280
|
+
this.stage = 1;
|
|
1281
|
+
return (key, value) => {
|
|
1282
|
+
if (value instanceof NumericValue) {
|
|
1283
|
+
const v = `${NUMERIC_CONTROL_CHAR + "nv" + this.counter++}_` + value.string;
|
|
1284
|
+
this.values.set(`"${v}"`, value.string);
|
|
1285
|
+
return v;
|
|
1286
|
+
}
|
|
1287
|
+
if (typeof value === "bigint") {
|
|
1288
|
+
const s = value.toString();
|
|
1289
|
+
const v = `${NUMERIC_CONTROL_CHAR + "b" + this.counter++}_` + s;
|
|
1290
|
+
this.values.set(`"${v}"`, s);
|
|
1291
|
+
return v;
|
|
1292
|
+
}
|
|
1293
|
+
return value;
|
|
1294
|
+
};
|
|
1295
|
+
}
|
|
1296
|
+
replaceInJson(json) {
|
|
1297
|
+
if (this.stage === 0) {
|
|
1298
|
+
throw new Error("@aws-sdk/core/protocols - JsonReplacer not created yet.");
|
|
1299
|
+
}
|
|
1300
|
+
if (this.stage === 2) {
|
|
1301
|
+
throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");
|
|
1302
|
+
}
|
|
1303
|
+
this.stage = 2;
|
|
1304
|
+
if (this.counter === 0) {
|
|
1305
|
+
return json;
|
|
1306
|
+
}
|
|
1307
|
+
for (const [key, value] of this.values) {
|
|
1308
|
+
json = json.replace(key, value);
|
|
1309
|
+
}
|
|
1310
|
+
return json;
|
|
1311
|
+
}
|
|
1312
|
+
};
|
|
1313
|
+
|
|
1314
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeSerializer.js
|
|
1315
|
+
var JsonShapeSerializer = class extends SerdeContextConfig {
|
|
1316
|
+
constructor(settings) {
|
|
1317
|
+
super();
|
|
1318
|
+
__publicField(this, "settings");
|
|
1319
|
+
__publicField(this, "buffer");
|
|
1320
|
+
__publicField(this, "useReplacer", false);
|
|
1321
|
+
__publicField(this, "rootSchema");
|
|
1322
|
+
this.settings = settings;
|
|
1323
|
+
}
|
|
1324
|
+
write(schema, value) {
|
|
1325
|
+
this.rootSchema = NormalizedSchema.of(schema);
|
|
1326
|
+
this.buffer = this._write(this.rootSchema, value);
|
|
1327
|
+
}
|
|
1328
|
+
flush() {
|
|
1329
|
+
const { rootSchema, useReplacer } = this;
|
|
1330
|
+
this.rootSchema = void 0;
|
|
1331
|
+
this.useReplacer = false;
|
|
1332
|
+
if ((rootSchema == null ? void 0 : rootSchema.isStructSchema()) || (rootSchema == null ? void 0 : rootSchema.isDocumentSchema())) {
|
|
1333
|
+
if (!useReplacer) {
|
|
1334
|
+
return JSON.stringify(this.buffer);
|
|
1335
|
+
}
|
|
1336
|
+
const replacer = new JsonReplacer();
|
|
1337
|
+
return replacer.replaceInJson(JSON.stringify(this.buffer, replacer.createReplacer(), 0));
|
|
1338
|
+
}
|
|
1339
|
+
return this.buffer;
|
|
1340
|
+
}
|
|
1341
|
+
writeDiscriminatedDocument(schema, value) {
|
|
1342
|
+
this.write(schema, value);
|
|
1343
|
+
if (typeof this.buffer === "object") {
|
|
1344
|
+
this.buffer.__type = NormalizedSchema.of(schema).getName(true);
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
_write(schema, value, container) {
|
|
1348
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1349
|
+
const isObject = value !== null && typeof value === "object";
|
|
1350
|
+
const ns = NormalizedSchema.of(schema);
|
|
1351
|
+
if (isObject) {
|
|
1352
|
+
if (ns.isStructSchema()) {
|
|
1353
|
+
const record = value;
|
|
1354
|
+
const out = {};
|
|
1355
|
+
const { jsonName } = this.settings;
|
|
1356
|
+
let nameMap = void 0;
|
|
1357
|
+
if (jsonName) {
|
|
1358
|
+
nameMap = {};
|
|
1359
|
+
}
|
|
1360
|
+
let outCount = 0;
|
|
1361
|
+
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
1362
|
+
const serializableValue = this._write(memberSchema, record[memberName], ns);
|
|
1363
|
+
if (serializableValue !== void 0) {
|
|
1364
|
+
let targetKey = memberName;
|
|
1365
|
+
if (jsonName) {
|
|
1366
|
+
targetKey = (_a = memberSchema.getMergedTraits().jsonName) != null ? _a : memberName;
|
|
1367
|
+
nameMap[memberName] = targetKey;
|
|
1368
|
+
}
|
|
1369
|
+
out[targetKey] = serializableValue;
|
|
1370
|
+
outCount++;
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
if (ns.isUnionSchema() && outCount === 0) {
|
|
1374
|
+
const { $unknown } = record;
|
|
1375
|
+
if (Array.isArray($unknown)) {
|
|
1376
|
+
const [k, v] = $unknown;
|
|
1377
|
+
out[k] = this._write(15, v);
|
|
1378
|
+
}
|
|
1379
|
+
} else if (typeof record.__type === "string") {
|
|
1380
|
+
for (const k in record) {
|
|
1381
|
+
const v = record[k];
|
|
1382
|
+
const targetKey = jsonName ? (_b = nameMap[k]) != null ? _b : k : k;
|
|
1383
|
+
if (!(targetKey in out)) {
|
|
1384
|
+
out[targetKey] = this._write(15, v);
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
return out;
|
|
1389
|
+
}
|
|
1390
|
+
if (Array.isArray(value) && ns.isListSchema()) {
|
|
1391
|
+
const listMember = ns.getValueSchema();
|
|
1392
|
+
const out = [];
|
|
1393
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
|
1394
|
+
for (const item of value) {
|
|
1395
|
+
if (sparse || item != null) {
|
|
1396
|
+
out.push(this._write(listMember, item));
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
return out;
|
|
1400
|
+
}
|
|
1401
|
+
if (ns.isMapSchema()) {
|
|
1402
|
+
const mapMember = ns.getValueSchema();
|
|
1403
|
+
const out = {};
|
|
1404
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
|
1405
|
+
for (const _k in value) {
|
|
1406
|
+
const _v = value[_k];
|
|
1407
|
+
if (sparse || _v != null) {
|
|
1408
|
+
out[_k] = this._write(mapMember, _v);
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
return out;
|
|
1412
|
+
}
|
|
1413
|
+
if (value instanceof Uint8Array && (ns.isBlobSchema() || ns.isDocumentSchema())) {
|
|
1414
|
+
if (ns === this.rootSchema) {
|
|
1415
|
+
return value;
|
|
1416
|
+
}
|
|
1417
|
+
return ((_d = (_c = this.serdeContext) == null ? void 0 : _c.base64Encoder) != null ? _d : toBase64)(value);
|
|
1418
|
+
}
|
|
1419
|
+
if (value instanceof Date && (ns.isTimestampSchema() || ns.isDocumentSchema())) {
|
|
1420
|
+
const format = determineTimestampFormat(ns, this.settings);
|
|
1421
|
+
switch (format) {
|
|
1422
|
+
case 5:
|
|
1423
|
+
return value.toISOString().replace(".000Z", "Z");
|
|
1424
|
+
case 6:
|
|
1425
|
+
return dateToUtcString(value);
|
|
1426
|
+
case 7:
|
|
1427
|
+
return value.getTime() / 1e3;
|
|
1428
|
+
default:
|
|
1429
|
+
console.warn("Missing timestamp format, using epoch seconds", value);
|
|
1430
|
+
return value.getTime() / 1e3;
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
if (value instanceof NumericValue) {
|
|
1434
|
+
this.useReplacer = true;
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
if (value === null && (container == null ? void 0 : container.isStructSchema())) {
|
|
1438
|
+
return void 0;
|
|
1439
|
+
}
|
|
1440
|
+
if (ns.isStringSchema()) {
|
|
1441
|
+
if (typeof value === "undefined" && ns.isIdempotencyToken()) {
|
|
1442
|
+
return generateIdempotencyToken();
|
|
1443
|
+
}
|
|
1444
|
+
const mediaType = ns.getMergedTraits().mediaType;
|
|
1445
|
+
if (value != null && mediaType) {
|
|
1446
|
+
const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
|
|
1447
|
+
if (isJson) {
|
|
1448
|
+
return LazyJsonString.from(value);
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
return value;
|
|
1452
|
+
}
|
|
1453
|
+
if (typeof value === "number" && ns.isNumericSchema()) {
|
|
1454
|
+
if (Math.abs(value) === Infinity || isNaN(value)) {
|
|
1455
|
+
return String(value);
|
|
1456
|
+
}
|
|
1457
|
+
return value;
|
|
1458
|
+
}
|
|
1459
|
+
if (typeof value === "string" && ns.isBlobSchema()) {
|
|
1460
|
+
if (ns === this.rootSchema) {
|
|
1461
|
+
return value;
|
|
1462
|
+
}
|
|
1463
|
+
return ((_f = (_e = this.serdeContext) == null ? void 0 : _e.base64Encoder) != null ? _f : toBase64)(value);
|
|
1464
|
+
}
|
|
1465
|
+
if (typeof value === "bigint") {
|
|
1466
|
+
this.useReplacer = true;
|
|
1467
|
+
}
|
|
1468
|
+
if (ns.isDocumentSchema()) {
|
|
1469
|
+
if (isObject) {
|
|
1470
|
+
const out = Array.isArray(value) ? [] : {};
|
|
1471
|
+
for (const k in value) {
|
|
1472
|
+
const v = value[k];
|
|
1473
|
+
if (v instanceof NumericValue) {
|
|
1474
|
+
this.useReplacer = true;
|
|
1475
|
+
out[k] = v;
|
|
1476
|
+
} else {
|
|
1477
|
+
out[k] = this._write(ns, v);
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
return out;
|
|
1481
|
+
} else {
|
|
1482
|
+
return structuredClone(value);
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
return value;
|
|
1486
|
+
}
|
|
1487
|
+
};
|
|
1488
|
+
|
|
1489
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonCodec.js
|
|
1490
|
+
var JsonCodec = class extends SerdeContextConfig {
|
|
1491
|
+
constructor(settings) {
|
|
1492
|
+
super();
|
|
1493
|
+
__publicField(this, "settings");
|
|
1494
|
+
this.settings = settings;
|
|
1495
|
+
}
|
|
1496
|
+
createSerializer() {
|
|
1497
|
+
const serializer = new JsonShapeSerializer(this.settings);
|
|
1498
|
+
serializer.setSerdeContext(this.serdeContext);
|
|
1499
|
+
return serializer;
|
|
1500
|
+
}
|
|
1501
|
+
createDeserializer() {
|
|
1502
|
+
const deserializer = new JsonShapeDeserializer(this.settings);
|
|
1503
|
+
deserializer.setSerdeContext(this.serdeContext);
|
|
1504
|
+
return deserializer;
|
|
1505
|
+
}
|
|
1506
|
+
};
|
|
1507
|
+
|
|
1508
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsRestJsonProtocol.js
|
|
1509
|
+
var AwsRestJsonProtocol = class extends HttpBindingProtocol {
|
|
1510
|
+
constructor({ defaultNamespace, errorTypeRegistries }) {
|
|
1511
|
+
super({
|
|
1512
|
+
defaultNamespace,
|
|
1513
|
+
errorTypeRegistries
|
|
1514
|
+
});
|
|
1515
|
+
__publicField(this, "serializer");
|
|
1516
|
+
__publicField(this, "deserializer");
|
|
1517
|
+
__publicField(this, "codec");
|
|
1518
|
+
__publicField(this, "mixin", new ProtocolLib());
|
|
1519
|
+
const settings = {
|
|
1520
|
+
timestampFormat: {
|
|
1521
|
+
useTrait: true,
|
|
1522
|
+
default: 7
|
|
1523
|
+
},
|
|
1524
|
+
httpBindings: true,
|
|
1525
|
+
jsonName: true
|
|
1526
|
+
};
|
|
1527
|
+
this.codec = new JsonCodec(settings);
|
|
1528
|
+
this.serializer = new HttpInterceptingShapeSerializer(this.codec.createSerializer(), settings);
|
|
1529
|
+
this.deserializer = new HttpInterceptingShapeDeserializer(this.codec.createDeserializer(), settings);
|
|
1530
|
+
}
|
|
1531
|
+
getShapeId() {
|
|
1532
|
+
return "aws.protocols#restJson1";
|
|
1533
|
+
}
|
|
1534
|
+
getPayloadCodec() {
|
|
1535
|
+
return this.codec;
|
|
1536
|
+
}
|
|
1537
|
+
setSerdeContext(serdeContext) {
|
|
1538
|
+
this.codec.setSerdeContext(serdeContext);
|
|
1539
|
+
super.setSerdeContext(serdeContext);
|
|
1540
|
+
}
|
|
1541
|
+
async serializeRequest(operationSchema, input, context) {
|
|
1542
|
+
const request = await super.serializeRequest(operationSchema, input, context);
|
|
1543
|
+
const inputSchema = NormalizedSchema.of(operationSchema.input);
|
|
1544
|
+
if (!request.headers["content-type"]) {
|
|
1545
|
+
const contentType = this.mixin.resolveRestContentType(this.getDefaultContentType(), inputSchema);
|
|
1546
|
+
if (contentType) {
|
|
1547
|
+
request.headers["content-type"] = contentType;
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
if (request.body == null && request.headers["content-type"] === this.getDefaultContentType()) {
|
|
1551
|
+
request.body = "{}";
|
|
1552
|
+
}
|
|
1553
|
+
return request;
|
|
1554
|
+
}
|
|
1555
|
+
async deserializeResponse(operationSchema, context, response) {
|
|
1556
|
+
const output = await super.deserializeResponse(operationSchema, context, response);
|
|
1557
|
+
const outputSchema = NormalizedSchema.of(operationSchema.output);
|
|
1558
|
+
for (const [name, member] of outputSchema.structIterator()) {
|
|
1559
|
+
if (member.getMemberTraits().httpPayload && !(name in output)) {
|
|
1560
|
+
output[name] = null;
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
return output;
|
|
1564
|
+
}
|
|
1565
|
+
async handleError(operationSchema, context, response, dataObject, metadata) {
|
|
1566
|
+
var _a, _b, _c, _d, _e;
|
|
1567
|
+
const errorIdentifier = (_a = loadRestJsonErrorCode(response, dataObject)) != null ? _a : "Unknown";
|
|
1568
|
+
this.mixin.compose(this.compositeErrorRegistry, errorIdentifier, this.options.defaultNamespace);
|
|
1569
|
+
const { errorSchema, errorMetadata } = await this.mixin.getErrorSchemaOrThrowBaseException(errorIdentifier, this.options.defaultNamespace, response, dataObject, metadata);
|
|
1570
|
+
const ns = NormalizedSchema.of(errorSchema);
|
|
1571
|
+
const message = (_c = (_b = dataObject.message) != null ? _b : dataObject.Message) != null ? _c : "UnknownError";
|
|
1572
|
+
const ErrorCtor = (_d = this.compositeErrorRegistry.getErrorCtor(errorSchema)) != null ? _d : Error;
|
|
1573
|
+
const exception = new ErrorCtor({});
|
|
1574
|
+
await this.deserializeHttpMessage(errorSchema, context, response, dataObject);
|
|
1575
|
+
const output = {};
|
|
1576
|
+
const errorDeserializer = this.codec.createDeserializer();
|
|
1577
|
+
for (const [name, member] of ns.structIterator()) {
|
|
1578
|
+
const target = (_e = member.getMergedTraits().jsonName) != null ? _e : name;
|
|
1579
|
+
output[name] = errorDeserializer.readObject(member, dataObject[target]);
|
|
1580
|
+
}
|
|
1581
|
+
throw this.mixin.decorateServiceException(Object.assign(exception, errorMetadata, {
|
|
1582
|
+
$fault: ns.getMergedTraits().error,
|
|
1583
|
+
message
|
|
1584
|
+
}, output), dataObject);
|
|
1585
|
+
}
|
|
1586
|
+
getDefaultContentType() {
|
|
1587
|
+
return "application/json";
|
|
1588
|
+
}
|
|
1589
|
+
};
|
|
1590
|
+
|
|
1591
|
+
// ../../node_modules/@aws-sdk/xml-builder/dist-es/escape-attribute.js
|
|
1592
|
+
var ATTR_ESCAPE_RE = /[&<>"]/g;
|
|
1593
|
+
var ATTR_ESCAPE_MAP = {
|
|
1594
|
+
"&": "&",
|
|
1595
|
+
"<": "<",
|
|
1596
|
+
">": ">",
|
|
1597
|
+
'"': """
|
|
1598
|
+
};
|
|
1599
|
+
function escapeAttribute(value) {
|
|
1600
|
+
return value.replace(ATTR_ESCAPE_RE, (ch) => ATTR_ESCAPE_MAP[ch]);
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
// ../../node_modules/@aws-sdk/xml-builder/dist-es/escape-element.js
|
|
1604
|
+
var ELEMENT_ESCAPE_RE = /[&"'<>\r\n\u0085\u2028]/g;
|
|
1605
|
+
var ELEMENT_ESCAPE_MAP = {
|
|
1606
|
+
"&": "&",
|
|
1607
|
+
'"': """,
|
|
1608
|
+
"'": "'",
|
|
1609
|
+
"<": "<",
|
|
1610
|
+
">": ">",
|
|
1611
|
+
"\r": "
",
|
|
1612
|
+
"\n": "
",
|
|
1613
|
+
"\x85": "…",
|
|
1614
|
+
"\u2028": "
"
|
|
1615
|
+
};
|
|
1616
|
+
function escapeElement(value) {
|
|
1617
|
+
return value.replace(ELEMENT_ESCAPE_RE, (ch) => ELEMENT_ESCAPE_MAP[ch]);
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
// ../../node_modules/@aws-sdk/xml-builder/dist-es/XmlText.js
|
|
1621
|
+
var XmlText = class {
|
|
1622
|
+
constructor(value) {
|
|
1623
|
+
__publicField(this, "value");
|
|
1624
|
+
this.value = value;
|
|
1625
|
+
}
|
|
1626
|
+
toString() {
|
|
1627
|
+
return escapeElement("" + this.value);
|
|
1628
|
+
}
|
|
1629
|
+
};
|
|
1630
|
+
|
|
1631
|
+
// ../../node_modules/@aws-sdk/xml-builder/dist-es/XmlNode.js
|
|
1632
|
+
var XmlNode = class _XmlNode {
|
|
1633
|
+
constructor(name, children = []) {
|
|
1634
|
+
__publicField(this, "name");
|
|
1635
|
+
__publicField(this, "children");
|
|
1636
|
+
__publicField(this, "attributes", {});
|
|
1637
|
+
this.name = name;
|
|
1638
|
+
this.children = children;
|
|
1639
|
+
}
|
|
1640
|
+
static of(name, childText, withName) {
|
|
1641
|
+
const node = new _XmlNode(name);
|
|
1642
|
+
if (childText !== void 0) {
|
|
1643
|
+
node.addChildNode(new XmlText(childText));
|
|
1644
|
+
}
|
|
1645
|
+
if (withName !== void 0) {
|
|
1646
|
+
node.withName(withName);
|
|
1647
|
+
}
|
|
1648
|
+
return node;
|
|
1649
|
+
}
|
|
1650
|
+
withName(name) {
|
|
1651
|
+
this.name = name;
|
|
1652
|
+
return this;
|
|
1653
|
+
}
|
|
1654
|
+
addAttribute(name, value) {
|
|
1655
|
+
this.attributes[name] = value;
|
|
1656
|
+
return this;
|
|
1657
|
+
}
|
|
1658
|
+
addChildNode(child) {
|
|
1659
|
+
this.children.push(child);
|
|
1660
|
+
return this;
|
|
1661
|
+
}
|
|
1662
|
+
removeAttribute(name) {
|
|
1663
|
+
delete this.attributes[name];
|
|
1664
|
+
return this;
|
|
1665
|
+
}
|
|
1666
|
+
n(name) {
|
|
1667
|
+
this.name = name;
|
|
1668
|
+
return this;
|
|
1669
|
+
}
|
|
1670
|
+
c(child) {
|
|
1671
|
+
this.children.push(child);
|
|
1672
|
+
return this;
|
|
1673
|
+
}
|
|
1674
|
+
a(name, value) {
|
|
1675
|
+
if (value != null) {
|
|
1676
|
+
this.attributes[name] = value;
|
|
1677
|
+
}
|
|
1678
|
+
return this;
|
|
1679
|
+
}
|
|
1680
|
+
cc(input, field, withName = field) {
|
|
1681
|
+
if (input[field] != null) {
|
|
1682
|
+
const node = _XmlNode.of(field, input[field]).withName(withName);
|
|
1683
|
+
this.c(node);
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
l(input, listName, memberName, valueProvider) {
|
|
1687
|
+
if (input[listName] != null) {
|
|
1688
|
+
const nodes = valueProvider();
|
|
1689
|
+
nodes.map((node) => {
|
|
1690
|
+
node.withName(memberName);
|
|
1691
|
+
this.c(node);
|
|
1692
|
+
});
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
lc(input, listName, memberName, valueProvider) {
|
|
1696
|
+
if (input[listName] != null) {
|
|
1697
|
+
const nodes = valueProvider();
|
|
1698
|
+
const containerNode = new _XmlNode(memberName);
|
|
1699
|
+
nodes.map((node) => {
|
|
1700
|
+
containerNode.c(node);
|
|
1701
|
+
});
|
|
1702
|
+
this.c(containerNode);
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
toString() {
|
|
1706
|
+
const hasChildren = Boolean(this.children.length);
|
|
1707
|
+
let xmlText = `<${this.name}`;
|
|
1708
|
+
const attributes = this.attributes;
|
|
1709
|
+
for (const attributeName of Object.keys(attributes)) {
|
|
1710
|
+
const attribute = attributes[attributeName];
|
|
1711
|
+
if (attribute != null) {
|
|
1712
|
+
xmlText += ` ${attributeName}="${escapeAttribute("" + attribute)}"`;
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
return xmlText += !hasChildren ? "/>" : `>${this.children.map((c) => c.toString()).join("")}</${this.name}>`;
|
|
1716
|
+
}
|
|
1717
|
+
};
|
|
1718
|
+
|
|
1719
|
+
// ../../node_modules/@aws-sdk/xml-builder/dist-es/xml-parser.js
|
|
1720
|
+
function parseXML(xml) {
|
|
1721
|
+
const state = new AwsXmlParser(xml);
|
|
1722
|
+
return state.parse();
|
|
1723
|
+
}
|
|
1724
|
+
var _AwsXmlParser = class _AwsXmlParser {
|
|
1725
|
+
constructor(x) {
|
|
1726
|
+
__publicField(this, "x");
|
|
1727
|
+
__publicField(this, "i", 0);
|
|
1728
|
+
__publicField(this, "z");
|
|
1729
|
+
this.x = x;
|
|
1730
|
+
this.x = x.replace(/\r\n?/g, "\n");
|
|
1731
|
+
this.z = this.x.length;
|
|
1732
|
+
}
|
|
1733
|
+
parse() {
|
|
1734
|
+
const p = this;
|
|
1735
|
+
const { z } = p;
|
|
1736
|
+
while (p.i < z) {
|
|
1737
|
+
p.trim();
|
|
1738
|
+
if (p.i >= z) {
|
|
1739
|
+
break;
|
|
1740
|
+
}
|
|
1741
|
+
if (p.isNext("<?")) {
|
|
1742
|
+
p.readTo("?>");
|
|
1743
|
+
p.trim();
|
|
1744
|
+
} else if (p.isNext("<!--")) {
|
|
1745
|
+
p.readTo("-->");
|
|
1746
|
+
p.trim();
|
|
1747
|
+
} else if (p.isNext("<!DOCTYPE", false)) {
|
|
1748
|
+
p.skipDoctype();
|
|
1749
|
+
p.trim();
|
|
1750
|
+
} else if (p.x[p.i] === "<") {
|
|
1751
|
+
const root = p.parseTag();
|
|
1752
|
+
return { [root.tag]: root.value };
|
|
1753
|
+
} else {
|
|
1754
|
+
throw new Error("@aws-sdk XML parse error: unexpected content.");
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
throw new Error("@aws-sdk XML parse error: no root element.");
|
|
1758
|
+
}
|
|
1759
|
+
isNext(s, caseSensitive = true) {
|
|
1760
|
+
const p = this;
|
|
1761
|
+
if (caseSensitive) {
|
|
1762
|
+
return p.x.startsWith(s, p.i);
|
|
1763
|
+
}
|
|
1764
|
+
return p.x.toLowerCase().startsWith(s.toLowerCase(), p.i);
|
|
1765
|
+
}
|
|
1766
|
+
readTo(stop) {
|
|
1767
|
+
const p = this;
|
|
1768
|
+
const _i = p.x.indexOf(stop, p.i);
|
|
1769
|
+
if (_i === -1) {
|
|
1770
|
+
throw new Error(`@aws-sdk XML parse error: expected "${stop}" not found.`);
|
|
1771
|
+
}
|
|
1772
|
+
const result = p.x.slice(p.i, _i);
|
|
1773
|
+
p.i = _i + stop.length;
|
|
1774
|
+
return result;
|
|
1775
|
+
}
|
|
1776
|
+
trim() {
|
|
1777
|
+
const p = this;
|
|
1778
|
+
while (p.i < p.z && " \r\n".includes(p.x[p.i])) {
|
|
1779
|
+
++p.i;
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
readAttrValue() {
|
|
1783
|
+
const p = this;
|
|
1784
|
+
const quote = p.x[p.i];
|
|
1785
|
+
++p.i;
|
|
1786
|
+
let value = "";
|
|
1787
|
+
while (p.i < p.z && p.x[p.i] !== quote) {
|
|
1788
|
+
value += p.x[p.i++];
|
|
1789
|
+
}
|
|
1790
|
+
++p.i;
|
|
1791
|
+
return p.decodeEntities(value);
|
|
1792
|
+
}
|
|
1793
|
+
parseTag() {
|
|
1794
|
+
const p = this;
|
|
1795
|
+
++p.i;
|
|
1796
|
+
let tag = "";
|
|
1797
|
+
while (p.i < p.z && !" \r\n>/".includes(p.x[p.i])) {
|
|
1798
|
+
tag += p.x[p.i++];
|
|
1799
|
+
}
|
|
1800
|
+
let hasAttrs = false;
|
|
1801
|
+
const attrs = /* @__PURE__ */ Object.create(null);
|
|
1802
|
+
while (p.i < p.z) {
|
|
1803
|
+
p.trim();
|
|
1804
|
+
if (">/".includes(p.x[p.i])) {
|
|
1805
|
+
break;
|
|
1806
|
+
}
|
|
1807
|
+
let name = "";
|
|
1808
|
+
while (p.i < p.z && !"= \r\n>/?".includes(p.x[p.i])) {
|
|
1809
|
+
name += p.x[p.i++];
|
|
1810
|
+
}
|
|
1811
|
+
p.trim();
|
|
1812
|
+
if (p.x[p.i] !== "=") {
|
|
1813
|
+
break;
|
|
1814
|
+
}
|
|
1815
|
+
++p.i;
|
|
1816
|
+
p.trim();
|
|
1817
|
+
attrs[name] = p.readAttrValue();
|
|
1818
|
+
hasAttrs = true;
|
|
1819
|
+
}
|
|
1820
|
+
if (p.i >= p.z) {
|
|
1821
|
+
throw new Error("@aws-sdk XML parse error: unexpected end of input.");
|
|
1822
|
+
}
|
|
1823
|
+
if (p.x[p.i] === "/") {
|
|
1824
|
+
++p.i;
|
|
1825
|
+
if (p.i >= p.z || p.x[p.i] !== ">") {
|
|
1826
|
+
throw new Error("@aws-sdk XML parse error: expected > at the end of self-closing tag.");
|
|
1827
|
+
}
|
|
1828
|
+
++p.i;
|
|
1829
|
+
Object.setPrototypeOf(attrs, Object.prototype);
|
|
1830
|
+
return { tag, value: hasAttrs ? attrs : "" };
|
|
1831
|
+
}
|
|
1832
|
+
if (p.x[p.i] !== ">") {
|
|
1833
|
+
throw new Error("@aws-sdk XML parse error: expected > at the end of opening tag.");
|
|
1834
|
+
}
|
|
1835
|
+
++p.i;
|
|
1836
|
+
const textParts = [];
|
|
1837
|
+
const childTags = [];
|
|
1838
|
+
let hasElementChild = false;
|
|
1839
|
+
while (p.i < p.z) {
|
|
1840
|
+
if (p.isNext("</")) {
|
|
1841
|
+
break;
|
|
1842
|
+
}
|
|
1843
|
+
if (p.x[p.i] === "<") {
|
|
1844
|
+
if (p.isNext("<!--")) {
|
|
1845
|
+
p.readTo("-->");
|
|
1846
|
+
} else if (p.isNext("<![CDATA[")) {
|
|
1847
|
+
p.i += 9;
|
|
1848
|
+
textParts.push(p.readTo("]]>"));
|
|
1849
|
+
} else if (p.isNext("<?")) {
|
|
1850
|
+
p.readTo("?>");
|
|
1851
|
+
} else {
|
|
1852
|
+
hasElementChild = true;
|
|
1853
|
+
childTags.push(p.parseTag());
|
|
1854
|
+
}
|
|
1855
|
+
} else {
|
|
1856
|
+
let text = "";
|
|
1857
|
+
while (p.i < p.z && p.x[p.i] !== "<") {
|
|
1858
|
+
text += p.x[p.i++];
|
|
1859
|
+
}
|
|
1860
|
+
textParts.push(p.decodeEntities(text));
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
if (!p.isNext("</")) {
|
|
1864
|
+
throw new Error(`@aws-sdk XML parse error: missing closing tag </${tag}>.`);
|
|
1865
|
+
}
|
|
1866
|
+
p.i += 2;
|
|
1867
|
+
const closeTag = p.readTo(">").trim();
|
|
1868
|
+
if (closeTag !== tag) {
|
|
1869
|
+
throw new Error(`@aws-sdk XML parse error: mismatched tags <${tag}> and </${closeTag}>.`);
|
|
1870
|
+
}
|
|
1871
|
+
if (!hasAttrs && textParts.length === 0 && !hasElementChild) {
|
|
1872
|
+
return { tag, value: "" };
|
|
1873
|
+
}
|
|
1874
|
+
if (!hasAttrs && !hasElementChild) {
|
|
1875
|
+
const text = textParts.length === 1 ? textParts[0] : textParts.join("");
|
|
1876
|
+
if (text.trim() === "" && text.includes("\n")) {
|
|
1877
|
+
return { tag, value: "" };
|
|
1878
|
+
}
|
|
1879
|
+
return { tag, value: text };
|
|
1880
|
+
}
|
|
1881
|
+
const obj = /* @__PURE__ */ Object.create(null);
|
|
1882
|
+
for (const text of textParts) {
|
|
1883
|
+
if (text.trim() === "" && text.includes("\n")) {
|
|
1884
|
+
continue;
|
|
1885
|
+
}
|
|
1886
|
+
obj["#text"] = "#text" in obj ? obj["#text"] + text : text;
|
|
1887
|
+
}
|
|
1888
|
+
for (const child of childTags) {
|
|
1889
|
+
if (child.tag in obj) {
|
|
1890
|
+
if (Array.isArray(obj[child.tag])) {
|
|
1891
|
+
obj[child.tag].push(child.value);
|
|
1892
|
+
} else {
|
|
1893
|
+
obj[child.tag] = [obj[child.tag], child.value];
|
|
1894
|
+
}
|
|
1895
|
+
} else {
|
|
1896
|
+
obj[child.tag] = child.value;
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
for (const [k, v] of Object.entries(attrs)) {
|
|
1900
|
+
obj[k] = v;
|
|
1901
|
+
}
|
|
1902
|
+
Object.setPrototypeOf(obj, Object.prototype);
|
|
1903
|
+
return { tag, value: obj };
|
|
1904
|
+
}
|
|
1905
|
+
skipDoctype() {
|
|
1906
|
+
const p = this;
|
|
1907
|
+
p.i += 9;
|
|
1908
|
+
let depth = 0;
|
|
1909
|
+
while (p.i < p.z) {
|
|
1910
|
+
const c = p.x[p.i];
|
|
1911
|
+
if (c === "[") {
|
|
1912
|
+
++depth;
|
|
1913
|
+
} else if (c === "]") {
|
|
1914
|
+
--depth;
|
|
1915
|
+
} else if (c === ">" && depth === 0) {
|
|
1916
|
+
++p.i;
|
|
1917
|
+
return;
|
|
1918
|
+
}
|
|
1919
|
+
++p.i;
|
|
1920
|
+
}
|
|
1921
|
+
throw new Error("@aws-sdk XML parse error: unclosed DOCTYPE.");
|
|
1922
|
+
}
|
|
1923
|
+
decodeEntities(s) {
|
|
1924
|
+
return s.replace(/&(?:#x([0-9a-fA-F]{1,6})|#(\d{1,7})|([a-zA-Z][a-zA-Z0-9]{0,30}));/g, (_, hex, dec, named) => {
|
|
1925
|
+
var _a;
|
|
1926
|
+
if (hex) {
|
|
1927
|
+
return String.fromCharCode(parseInt(hex, 16));
|
|
1928
|
+
}
|
|
1929
|
+
if (dec) {
|
|
1930
|
+
return String.fromCharCode(parseInt(dec, 10));
|
|
1931
|
+
}
|
|
1932
|
+
return (_a = _AwsXmlParser.ENTITIES[named]) != null ? _a : "";
|
|
1933
|
+
});
|
|
1934
|
+
}
|
|
1935
|
+
};
|
|
1936
|
+
__publicField(_AwsXmlParser, "ENTITIES", {
|
|
1937
|
+
amp: "&",
|
|
1938
|
+
lt: "<",
|
|
1939
|
+
gt: ">",
|
|
1940
|
+
quot: '"',
|
|
1941
|
+
apos: "'"
|
|
1942
|
+
});
|
|
1943
|
+
var AwsXmlParser = _AwsXmlParser;
|
|
1944
|
+
|
|
1945
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/XmlShapeDeserializer.js
|
|
1946
|
+
var XmlShapeDeserializer = class extends SerdeContextConfig {
|
|
1947
|
+
constructor(settings) {
|
|
1948
|
+
super();
|
|
1949
|
+
__publicField(this, "settings");
|
|
1950
|
+
__publicField(this, "stringDeserializer");
|
|
1951
|
+
this.settings = settings;
|
|
1952
|
+
this.stringDeserializer = new FromStringShapeDeserializer(settings);
|
|
1953
|
+
}
|
|
1954
|
+
setSerdeContext(serdeContext) {
|
|
1955
|
+
this.serdeContext = serdeContext;
|
|
1956
|
+
this.stringDeserializer.setSerdeContext(serdeContext);
|
|
1957
|
+
}
|
|
1958
|
+
read(schema, bytes, key) {
|
|
1959
|
+
var _a, _b;
|
|
1960
|
+
const ns = NormalizedSchema.of(schema);
|
|
1961
|
+
const memberSchemas = ns.getMemberSchemas();
|
|
1962
|
+
const isEventPayload = ns.isStructSchema() && ns.isMemberSchema() && !!Object.values(memberSchemas).find((memberNs) => {
|
|
1963
|
+
return !!memberNs.getMemberTraits().eventPayload;
|
|
1964
|
+
});
|
|
1965
|
+
if (isEventPayload) {
|
|
1966
|
+
const output = {};
|
|
1967
|
+
const memberName = Object.keys(memberSchemas)[0];
|
|
1968
|
+
const eventMemberSchema = memberSchemas[memberName];
|
|
1969
|
+
if (eventMemberSchema.isBlobSchema()) {
|
|
1970
|
+
output[memberName] = bytes;
|
|
1971
|
+
} else {
|
|
1972
|
+
output[memberName] = this.read(memberSchemas[memberName], bytes);
|
|
1973
|
+
}
|
|
1974
|
+
return output;
|
|
1975
|
+
}
|
|
1976
|
+
const xmlString = ((_b = (_a = this.serdeContext) == null ? void 0 : _a.utf8Encoder) != null ? _b : toUtf8)(bytes);
|
|
1977
|
+
const parsedObject = this.parseXml(xmlString);
|
|
1978
|
+
return this.readSchema(schema, key ? parsedObject[key] : parsedObject);
|
|
1979
|
+
}
|
|
1980
|
+
readSchema(_schema, value) {
|
|
1981
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1982
|
+
const ns = NormalizedSchema.of(_schema);
|
|
1983
|
+
if (ns.isUnitSchema()) {
|
|
1984
|
+
return;
|
|
1985
|
+
}
|
|
1986
|
+
const traits = ns.getMergedTraits();
|
|
1987
|
+
if (ns.isListSchema() && !Array.isArray(value)) {
|
|
1988
|
+
return this.readSchema(ns, [value]);
|
|
1989
|
+
}
|
|
1990
|
+
if (value == null) {
|
|
1991
|
+
return value;
|
|
1992
|
+
}
|
|
1993
|
+
if (typeof value === "object") {
|
|
1994
|
+
const flat = !!traits.xmlFlattened;
|
|
1995
|
+
if (ns.isListSchema()) {
|
|
1996
|
+
const listValue = ns.getValueSchema();
|
|
1997
|
+
const buffer2 = [];
|
|
1998
|
+
const sourceKey = (_a = listValue.getMergedTraits().xmlName) != null ? _a : "member";
|
|
1999
|
+
const source = flat ? value : ((_b = value[0]) != null ? _b : value)[sourceKey];
|
|
2000
|
+
if (source == null) {
|
|
2001
|
+
return buffer2;
|
|
2002
|
+
}
|
|
2003
|
+
const sourceArray = Array.isArray(source) ? source : [source];
|
|
2004
|
+
for (const v of sourceArray) {
|
|
2005
|
+
buffer2.push(this.readSchema(listValue, v));
|
|
2006
|
+
}
|
|
2007
|
+
return buffer2;
|
|
2008
|
+
}
|
|
2009
|
+
const buffer = {};
|
|
2010
|
+
if (ns.isMapSchema()) {
|
|
2011
|
+
const keyNs = ns.getKeySchema();
|
|
2012
|
+
const memberNs = ns.getValueSchema();
|
|
2013
|
+
let entries;
|
|
2014
|
+
if (flat) {
|
|
2015
|
+
entries = Array.isArray(value) ? value : [value];
|
|
2016
|
+
} else {
|
|
2017
|
+
entries = Array.isArray(value.entry) ? value.entry : [value.entry];
|
|
2018
|
+
}
|
|
2019
|
+
const keyProperty = (_c = keyNs.getMergedTraits().xmlName) != null ? _c : "key";
|
|
2020
|
+
const valueProperty = (_d = memberNs.getMergedTraits().xmlName) != null ? _d : "value";
|
|
2021
|
+
for (const entry of entries) {
|
|
2022
|
+
const key = entry[keyProperty];
|
|
2023
|
+
const value2 = entry[valueProperty];
|
|
2024
|
+
buffer[key] = this.readSchema(memberNs, value2);
|
|
2025
|
+
}
|
|
2026
|
+
return buffer;
|
|
2027
|
+
}
|
|
2028
|
+
if (ns.isStructSchema()) {
|
|
2029
|
+
const union = ns.isUnionSchema();
|
|
2030
|
+
let unionSerde;
|
|
2031
|
+
if (union) {
|
|
2032
|
+
unionSerde = new UnionSerde(value, buffer);
|
|
2033
|
+
}
|
|
2034
|
+
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
2035
|
+
const memberTraits = memberSchema.getMergedTraits();
|
|
2036
|
+
const xmlObjectKey = !memberTraits.httpPayload ? (_e = memberSchema.getMemberTraits().xmlName) != null ? _e : memberName : (_f = memberTraits.xmlName) != null ? _f : memberSchema.getName();
|
|
2037
|
+
if (union) {
|
|
2038
|
+
unionSerde.mark(xmlObjectKey);
|
|
2039
|
+
}
|
|
2040
|
+
if (value[xmlObjectKey] != null) {
|
|
2041
|
+
buffer[memberName] = this.readSchema(memberSchema, value[xmlObjectKey]);
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
if (union) {
|
|
2045
|
+
unionSerde.writeUnknown();
|
|
2046
|
+
}
|
|
2047
|
+
return buffer;
|
|
2048
|
+
}
|
|
2049
|
+
if (ns.isDocumentSchema()) {
|
|
2050
|
+
return value;
|
|
2051
|
+
}
|
|
2052
|
+
throw new Error(`@aws-sdk/core/protocols - xml deserializer unhandled schema type for ${ns.getName(true)}`);
|
|
2053
|
+
}
|
|
2054
|
+
if (ns.isListSchema()) {
|
|
2055
|
+
return [];
|
|
2056
|
+
}
|
|
2057
|
+
if (ns.isMapSchema() || ns.isStructSchema()) {
|
|
2058
|
+
return {};
|
|
2059
|
+
}
|
|
2060
|
+
return this.stringDeserializer.read(ns, value);
|
|
2061
|
+
}
|
|
2062
|
+
parseXml(xml) {
|
|
2063
|
+
if (xml.length) {
|
|
2064
|
+
let parsedObj;
|
|
2065
|
+
try {
|
|
2066
|
+
parsedObj = parseXML(xml);
|
|
2067
|
+
} catch (e) {
|
|
2068
|
+
if (e && typeof e === "object") {
|
|
2069
|
+
Object.defineProperty(e, "$responseBodyText", {
|
|
2070
|
+
value: xml
|
|
2071
|
+
});
|
|
2072
|
+
}
|
|
2073
|
+
throw e;
|
|
2074
|
+
}
|
|
2075
|
+
const textNodeName = "#text";
|
|
2076
|
+
const key = Object.keys(parsedObj)[0];
|
|
2077
|
+
const parsedObjToReturn = parsedObj[key];
|
|
2078
|
+
if (parsedObjToReturn[textNodeName]) {
|
|
2079
|
+
parsedObjToReturn[key] = parsedObjToReturn[textNodeName];
|
|
2080
|
+
delete parsedObjToReturn[textNodeName];
|
|
2081
|
+
}
|
|
2082
|
+
return getValueFromTextNode(parsedObjToReturn);
|
|
2083
|
+
}
|
|
2084
|
+
return {};
|
|
2085
|
+
}
|
|
2086
|
+
};
|
|
2087
|
+
|
|
2088
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/query/QueryShapeSerializer.js
|
|
2089
|
+
var QueryShapeSerializer = class extends SerdeContextConfig {
|
|
2090
|
+
constructor(settings) {
|
|
2091
|
+
super();
|
|
2092
|
+
__publicField(this, "settings");
|
|
2093
|
+
__publicField(this, "buffer");
|
|
2094
|
+
this.settings = settings;
|
|
2095
|
+
}
|
|
2096
|
+
write(schema, value, prefix = "") {
|
|
2097
|
+
var _a, _b;
|
|
2098
|
+
if (this.buffer === void 0) {
|
|
2099
|
+
this.buffer = "";
|
|
2100
|
+
}
|
|
2101
|
+
const ns = NormalizedSchema.of(schema);
|
|
2102
|
+
if (prefix && !prefix.endsWith(".")) {
|
|
2103
|
+
prefix += ".";
|
|
2104
|
+
}
|
|
2105
|
+
if (ns.isBlobSchema()) {
|
|
2106
|
+
if (typeof value === "string" || value instanceof Uint8Array) {
|
|
2107
|
+
this.writeKey(prefix);
|
|
2108
|
+
this.writeValue(((_b = (_a = this.serdeContext) == null ? void 0 : _a.base64Encoder) != null ? _b : toBase64)(value));
|
|
2109
|
+
}
|
|
2110
|
+
} else if (ns.isBooleanSchema() || ns.isNumericSchema() || ns.isStringSchema()) {
|
|
2111
|
+
if (value != null) {
|
|
2112
|
+
this.writeKey(prefix);
|
|
2113
|
+
this.writeValue(String(value));
|
|
2114
|
+
} else if (ns.isIdempotencyToken()) {
|
|
2115
|
+
this.writeKey(prefix);
|
|
2116
|
+
this.writeValue(generateIdempotencyToken());
|
|
2117
|
+
}
|
|
2118
|
+
} else if (ns.isBigIntegerSchema()) {
|
|
2119
|
+
if (value != null) {
|
|
2120
|
+
this.writeKey(prefix);
|
|
2121
|
+
this.writeValue(String(value));
|
|
2122
|
+
}
|
|
2123
|
+
} else if (ns.isBigDecimalSchema()) {
|
|
2124
|
+
if (value != null) {
|
|
2125
|
+
this.writeKey(prefix);
|
|
2126
|
+
this.writeValue(value instanceof NumericValue ? value.string : String(value));
|
|
2127
|
+
}
|
|
2128
|
+
} else if (ns.isTimestampSchema()) {
|
|
2129
|
+
if (value instanceof Date) {
|
|
2130
|
+
this.writeKey(prefix);
|
|
2131
|
+
const format = determineTimestampFormat(ns, this.settings);
|
|
2132
|
+
switch (format) {
|
|
2133
|
+
case 5:
|
|
2134
|
+
this.writeValue(value.toISOString().replace(".000Z", "Z"));
|
|
2135
|
+
break;
|
|
2136
|
+
case 6:
|
|
2137
|
+
this.writeValue(dateToUtcString(value));
|
|
2138
|
+
break;
|
|
2139
|
+
case 7:
|
|
2140
|
+
this.writeValue(String(value.getTime() / 1e3));
|
|
2141
|
+
break;
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
} else if (ns.isDocumentSchema()) {
|
|
2145
|
+
if (Array.isArray(value)) {
|
|
2146
|
+
this.write(64 | 15, value, prefix);
|
|
2147
|
+
} else if (value instanceof Date) {
|
|
2148
|
+
this.write(4, value, prefix);
|
|
2149
|
+
} else if (value instanceof Uint8Array) {
|
|
2150
|
+
this.write(21, value, prefix);
|
|
2151
|
+
} else if (value && typeof value === "object") {
|
|
2152
|
+
this.write(128 | 15, value, prefix);
|
|
2153
|
+
} else {
|
|
2154
|
+
this.writeKey(prefix);
|
|
2155
|
+
this.writeValue(String(value));
|
|
2156
|
+
}
|
|
2157
|
+
} else if (ns.isListSchema()) {
|
|
2158
|
+
if (Array.isArray(value)) {
|
|
2159
|
+
if (value.length === 0) {
|
|
2160
|
+
if (this.settings.serializeEmptyLists) {
|
|
2161
|
+
this.writeKey(prefix);
|
|
2162
|
+
this.writeValue("");
|
|
2163
|
+
}
|
|
2164
|
+
} else {
|
|
2165
|
+
const member = ns.getValueSchema();
|
|
2166
|
+
const flat = this.settings.flattenLists || ns.getMergedTraits().xmlFlattened;
|
|
2167
|
+
let i = 1;
|
|
2168
|
+
for (const item of value) {
|
|
2169
|
+
if (item == null) {
|
|
2170
|
+
continue;
|
|
2171
|
+
}
|
|
2172
|
+
const traits = member.getMergedTraits();
|
|
2173
|
+
const suffix = this.getKey("member", traits.xmlName, traits.ec2QueryName);
|
|
2174
|
+
const key = flat ? `${prefix}${i}` : `${prefix}${suffix}.${i}`;
|
|
2175
|
+
this.write(member, item, key);
|
|
2176
|
+
++i;
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
}
|
|
2180
|
+
} else if (ns.isMapSchema()) {
|
|
2181
|
+
if (value && typeof value === "object") {
|
|
2182
|
+
const keySchema = ns.getKeySchema();
|
|
2183
|
+
const memberSchema = ns.getValueSchema();
|
|
2184
|
+
const flat = ns.getMergedTraits().xmlFlattened;
|
|
2185
|
+
let i = 1;
|
|
2186
|
+
for (const k in value) {
|
|
2187
|
+
const v = value[k];
|
|
2188
|
+
if (v == null) {
|
|
2189
|
+
continue;
|
|
2190
|
+
}
|
|
2191
|
+
const keyTraits = keySchema.getMergedTraits();
|
|
2192
|
+
const keySuffix = this.getKey("key", keyTraits.xmlName, keyTraits.ec2QueryName);
|
|
2193
|
+
const key = flat ? `${prefix}${i}.${keySuffix}` : `${prefix}entry.${i}.${keySuffix}`;
|
|
2194
|
+
const valTraits = memberSchema.getMergedTraits();
|
|
2195
|
+
const valueSuffix = this.getKey("value", valTraits.xmlName, valTraits.ec2QueryName);
|
|
2196
|
+
const valueKey = flat ? `${prefix}${i}.${valueSuffix}` : `${prefix}entry.${i}.${valueSuffix}`;
|
|
2197
|
+
this.write(keySchema, k, key);
|
|
2198
|
+
this.write(memberSchema, v, valueKey);
|
|
2199
|
+
++i;
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2202
|
+
} else if (ns.isStructSchema()) {
|
|
2203
|
+
if (value && typeof value === "object") {
|
|
2204
|
+
let didWriteMember = false;
|
|
2205
|
+
for (const [memberName, member] of ns.structIterator()) {
|
|
2206
|
+
if (value[memberName] == null && !member.isIdempotencyToken()) {
|
|
2207
|
+
continue;
|
|
2208
|
+
}
|
|
2209
|
+
const traits = member.getMergedTraits();
|
|
2210
|
+
const suffix = this.getKey(memberName, traits.xmlName, traits.ec2QueryName, "struct");
|
|
2211
|
+
const key = `${prefix}${suffix}`;
|
|
2212
|
+
this.write(member, value[memberName], key);
|
|
2213
|
+
didWriteMember = true;
|
|
2214
|
+
}
|
|
2215
|
+
if (!didWriteMember && ns.isUnionSchema()) {
|
|
2216
|
+
const { $unknown } = value;
|
|
2217
|
+
if (Array.isArray($unknown)) {
|
|
2218
|
+
const [k, v] = $unknown;
|
|
2219
|
+
const key = `${prefix}${k}`;
|
|
2220
|
+
this.write(15, v, key);
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
} else if (ns.isUnitSchema()) {
|
|
2225
|
+
} else {
|
|
2226
|
+
throw new Error(`@aws-sdk/core/protocols - QuerySerializer unrecognized schema type ${ns.getName(true)}`);
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2229
|
+
flush() {
|
|
2230
|
+
if (this.buffer === void 0) {
|
|
2231
|
+
throw new Error("@aws-sdk/core/protocols - QuerySerializer cannot flush with nothing written to buffer.");
|
|
2232
|
+
}
|
|
2233
|
+
const str = this.buffer;
|
|
2234
|
+
delete this.buffer;
|
|
2235
|
+
return str;
|
|
2236
|
+
}
|
|
2237
|
+
getKey(memberName, xmlName, ec2QueryName, keySource) {
|
|
2238
|
+
const { ec2, capitalizeKeys } = this.settings;
|
|
2239
|
+
if (ec2 && ec2QueryName) {
|
|
2240
|
+
return ec2QueryName;
|
|
2241
|
+
}
|
|
2242
|
+
const key = xmlName != null ? xmlName : memberName;
|
|
2243
|
+
if (capitalizeKeys && keySource === "struct") {
|
|
2244
|
+
return key[0].toUpperCase() + key.slice(1);
|
|
2245
|
+
}
|
|
2246
|
+
return key;
|
|
2247
|
+
}
|
|
2248
|
+
writeKey(key) {
|
|
2249
|
+
if (key.endsWith(".")) {
|
|
2250
|
+
key = key.slice(0, key.length - 1);
|
|
2251
|
+
}
|
|
2252
|
+
this.buffer += `&${extendedEncodeURIComponent(key)}=`;
|
|
2253
|
+
}
|
|
2254
|
+
writeValue(value) {
|
|
2255
|
+
this.buffer += extendedEncodeURIComponent(value);
|
|
2256
|
+
}
|
|
2257
|
+
};
|
|
2258
|
+
|
|
2259
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/query/AwsQueryProtocol.js
|
|
2260
|
+
var AwsQueryProtocol = class extends RpcProtocol {
|
|
2261
|
+
constructor(options) {
|
|
2262
|
+
super({
|
|
2263
|
+
defaultNamespace: options.defaultNamespace,
|
|
2264
|
+
errorTypeRegistries: options.errorTypeRegistries
|
|
2265
|
+
});
|
|
2266
|
+
__publicField(this, "options");
|
|
2267
|
+
__publicField(this, "serializer");
|
|
2268
|
+
__publicField(this, "deserializer");
|
|
2269
|
+
__publicField(this, "mixin", new ProtocolLib());
|
|
2270
|
+
this.options = options;
|
|
2271
|
+
const settings = {
|
|
2272
|
+
timestampFormat: {
|
|
2273
|
+
useTrait: true,
|
|
2274
|
+
default: 5
|
|
2275
|
+
},
|
|
2276
|
+
httpBindings: false,
|
|
2277
|
+
xmlNamespace: options.xmlNamespace,
|
|
2278
|
+
serviceNamespace: options.defaultNamespace,
|
|
2279
|
+
serializeEmptyLists: true
|
|
2280
|
+
};
|
|
2281
|
+
this.serializer = new QueryShapeSerializer(settings);
|
|
2282
|
+
this.deserializer = new XmlShapeDeserializer(settings);
|
|
2283
|
+
}
|
|
2284
|
+
getShapeId() {
|
|
2285
|
+
return "aws.protocols#awsQuery";
|
|
2286
|
+
}
|
|
2287
|
+
setSerdeContext(serdeContext) {
|
|
2288
|
+
this.serializer.setSerdeContext(serdeContext);
|
|
2289
|
+
this.deserializer.setSerdeContext(serdeContext);
|
|
2290
|
+
}
|
|
2291
|
+
getPayloadCodec() {
|
|
2292
|
+
throw new Error("AWSQuery protocol has no payload codec.");
|
|
2293
|
+
}
|
|
2294
|
+
async serializeRequest(operationSchema, input, context) {
|
|
2295
|
+
var _a;
|
|
2296
|
+
const request = await super.serializeRequest(operationSchema, input, context);
|
|
2297
|
+
if (!request.path.endsWith("/")) {
|
|
2298
|
+
request.path += "/";
|
|
2299
|
+
}
|
|
2300
|
+
request.headers["content-type"] = "application/x-www-form-urlencoded";
|
|
2301
|
+
if (deref(operationSchema.input) === "unit" || !request.body) {
|
|
2302
|
+
request.body = "";
|
|
2303
|
+
}
|
|
2304
|
+
const action = (_a = operationSchema.name.split("#")[1]) != null ? _a : operationSchema.name;
|
|
2305
|
+
request.body = `Action=${action}&Version=${this.options.version}` + request.body;
|
|
2306
|
+
if (request.body.endsWith("&")) {
|
|
2307
|
+
request.body = request.body.slice(-1);
|
|
2308
|
+
}
|
|
2309
|
+
return request;
|
|
2310
|
+
}
|
|
2311
|
+
async deserializeResponse(operationSchema, context, response) {
|
|
2312
|
+
var _a;
|
|
2313
|
+
const deserializer = this.deserializer;
|
|
2314
|
+
const ns = NormalizedSchema.of(operationSchema.output);
|
|
2315
|
+
const dataObject = {};
|
|
2316
|
+
if (response.statusCode >= 300) {
|
|
2317
|
+
const bytes2 = await collectBody(response.body, context);
|
|
2318
|
+
if (bytes2.byteLength > 0) {
|
|
2319
|
+
Object.assign(dataObject, await deserializer.read(15, bytes2));
|
|
2320
|
+
}
|
|
2321
|
+
await this.handleError(operationSchema, context, response, dataObject, this.deserializeMetadata(response));
|
|
2322
|
+
}
|
|
2323
|
+
for (const header in response.headers) {
|
|
2324
|
+
const value = response.headers[header];
|
|
2325
|
+
delete response.headers[header];
|
|
2326
|
+
response.headers[header.toLowerCase()] = value;
|
|
2327
|
+
}
|
|
2328
|
+
const shortName = (_a = operationSchema.name.split("#")[1]) != null ? _a : operationSchema.name;
|
|
2329
|
+
const awsQueryResultKey = ns.isStructSchema() && this.useNestedResult() ? shortName + "Result" : void 0;
|
|
2330
|
+
const bytes = await collectBody(response.body, context);
|
|
2331
|
+
if (bytes.byteLength > 0) {
|
|
2332
|
+
Object.assign(dataObject, await deserializer.read(ns, bytes, awsQueryResultKey));
|
|
2333
|
+
}
|
|
2334
|
+
dataObject.$metadata = this.deserializeMetadata(response);
|
|
2335
|
+
return dataObject;
|
|
2336
|
+
}
|
|
2337
|
+
useNestedResult() {
|
|
2338
|
+
return true;
|
|
2339
|
+
}
|
|
2340
|
+
async handleError(operationSchema, context, response, dataObject, metadata) {
|
|
2341
|
+
var _a, _b, _c, _d, _e;
|
|
2342
|
+
const errorIdentifier = (_a = this.loadQueryErrorCode(response, dataObject)) != null ? _a : "Unknown";
|
|
2343
|
+
this.mixin.compose(this.compositeErrorRegistry, errorIdentifier, this.options.defaultNamespace);
|
|
2344
|
+
const errorData = (_b = this.loadQueryError(dataObject)) != null ? _b : {};
|
|
2345
|
+
const message = this.loadQueryErrorMessage(dataObject);
|
|
2346
|
+
errorData.message = message;
|
|
2347
|
+
errorData.Error = {
|
|
2348
|
+
Type: errorData.Type,
|
|
2349
|
+
Code: errorData.Code,
|
|
2350
|
+
Message: message
|
|
2351
|
+
};
|
|
2352
|
+
const { errorSchema, errorMetadata } = await this.mixin.getErrorSchemaOrThrowBaseException(errorIdentifier, this.options.defaultNamespace, response, errorData, metadata, this.mixin.findQueryCompatibleError);
|
|
2353
|
+
const ns = NormalizedSchema.of(errorSchema);
|
|
2354
|
+
const ErrorCtor = (_c = this.compositeErrorRegistry.getErrorCtor(errorSchema)) != null ? _c : Error;
|
|
2355
|
+
const exception = new ErrorCtor({});
|
|
2356
|
+
const output = {
|
|
2357
|
+
Type: errorData.Error.Type,
|
|
2358
|
+
Code: errorData.Error.Code,
|
|
2359
|
+
Error: errorData.Error
|
|
2360
|
+
};
|
|
2361
|
+
for (const [name, member] of ns.structIterator()) {
|
|
2362
|
+
const target = (_d = member.getMergedTraits().xmlName) != null ? _d : name;
|
|
2363
|
+
const value = (_e = errorData[target]) != null ? _e : dataObject[target];
|
|
2364
|
+
output[name] = this.deserializer.readSchema(member, value);
|
|
2365
|
+
}
|
|
2366
|
+
throw this.mixin.decorateServiceException(Object.assign(exception, errorMetadata, {
|
|
2367
|
+
$fault: ns.getMergedTraits().error,
|
|
2368
|
+
message
|
|
2369
|
+
}, output), dataObject);
|
|
2370
|
+
}
|
|
2371
|
+
loadQueryErrorCode(output, data) {
|
|
2372
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2373
|
+
const code = (_f = (_e = (_d = (_b = (_a = data.Errors) == null ? void 0 : _a[0]) == null ? void 0 : _b.Error) != null ? _d : (_c = data.Errors) == null ? void 0 : _c.Error) != null ? _e : data.Error) == null ? void 0 : _f.Code;
|
|
2374
|
+
if (code !== void 0) {
|
|
2375
|
+
return code;
|
|
2376
|
+
}
|
|
2377
|
+
if (output.statusCode == 404) {
|
|
2378
|
+
return "NotFound";
|
|
2379
|
+
}
|
|
2380
|
+
}
|
|
2381
|
+
loadQueryError(data) {
|
|
2382
|
+
var _a, _b, _c, _d, _e;
|
|
2383
|
+
return (_e = (_d = (_b = (_a = data.Errors) == null ? void 0 : _a[0]) == null ? void 0 : _b.Error) != null ? _d : (_c = data.Errors) == null ? void 0 : _c.Error) != null ? _e : data.Error;
|
|
2384
|
+
}
|
|
2385
|
+
loadQueryErrorMessage(data) {
|
|
2386
|
+
var _a, _b, _c, _d;
|
|
2387
|
+
const errorData = this.loadQueryError(data);
|
|
2388
|
+
return (_d = (_c = (_b = (_a = errorData == null ? void 0 : errorData.message) != null ? _a : errorData == null ? void 0 : errorData.Message) != null ? _b : data.message) != null ? _c : data.Message) != null ? _d : "Unknown";
|
|
2389
|
+
}
|
|
2390
|
+
getDefaultContentType() {
|
|
2391
|
+
return "application/x-www-form-urlencoded";
|
|
2392
|
+
}
|
|
2393
|
+
};
|
|
2394
|
+
|
|
2395
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsJsonRpcProtocol.js
|
|
2396
|
+
var AwsJsonRpcProtocol = class extends RpcProtocol {
|
|
2397
|
+
constructor({ defaultNamespace, errorTypeRegistries, serviceTarget, awsQueryCompatible, jsonCodec }) {
|
|
2398
|
+
super({
|
|
2399
|
+
defaultNamespace,
|
|
2400
|
+
errorTypeRegistries
|
|
2401
|
+
});
|
|
2402
|
+
__publicField(this, "serializer");
|
|
2403
|
+
__publicField(this, "deserializer");
|
|
2404
|
+
__publicField(this, "serviceTarget");
|
|
2405
|
+
__publicField(this, "codec");
|
|
2406
|
+
__publicField(this, "mixin");
|
|
2407
|
+
__publicField(this, "awsQueryCompatible");
|
|
2408
|
+
this.serviceTarget = serviceTarget;
|
|
2409
|
+
this.codec = jsonCodec != null ? jsonCodec : new JsonCodec({
|
|
2410
|
+
timestampFormat: {
|
|
2411
|
+
useTrait: true,
|
|
2412
|
+
default: 7
|
|
2413
|
+
},
|
|
2414
|
+
jsonName: false
|
|
2415
|
+
});
|
|
2416
|
+
this.serializer = this.codec.createSerializer();
|
|
2417
|
+
this.deserializer = this.codec.createDeserializer();
|
|
2418
|
+
this.awsQueryCompatible = !!awsQueryCompatible;
|
|
2419
|
+
this.mixin = new ProtocolLib(this.awsQueryCompatible);
|
|
2420
|
+
}
|
|
2421
|
+
async serializeRequest(operationSchema, input, context) {
|
|
2422
|
+
const request = await super.serializeRequest(operationSchema, input, context);
|
|
2423
|
+
if (!request.path.endsWith("/")) {
|
|
2424
|
+
request.path += "/";
|
|
2425
|
+
}
|
|
2426
|
+
request.headers["content-type"] = `application/x-amz-json-${this.getJsonRpcVersion()}`;
|
|
2427
|
+
request.headers["x-amz-target"] = `${this.serviceTarget}.${operationSchema.name}`;
|
|
2428
|
+
if (this.awsQueryCompatible) {
|
|
2429
|
+
request.headers["x-amzn-query-mode"] = "true";
|
|
2430
|
+
}
|
|
2431
|
+
if (deref(operationSchema.input) === "unit" || !request.body) {
|
|
2432
|
+
request.body = "{}";
|
|
2433
|
+
}
|
|
2434
|
+
return request;
|
|
2435
|
+
}
|
|
2436
|
+
getPayloadCodec() {
|
|
2437
|
+
return this.codec;
|
|
2438
|
+
}
|
|
2439
|
+
async handleError(operationSchema, context, response, dataObject, metadata) {
|
|
2440
|
+
var _a, _b, _c, _d;
|
|
2441
|
+
const { awsQueryCompatible } = this;
|
|
2442
|
+
if (awsQueryCompatible) {
|
|
2443
|
+
this.mixin.setQueryCompatError(dataObject, response);
|
|
2444
|
+
}
|
|
2445
|
+
const errorIdentifier = (_a = loadJsonRpcErrorCode(response, dataObject, awsQueryCompatible)) != null ? _a : "Unknown";
|
|
2446
|
+
this.mixin.compose(this.compositeErrorRegistry, errorIdentifier, this.options.defaultNamespace);
|
|
2447
|
+
const { errorSchema, errorMetadata } = await this.mixin.getErrorSchemaOrThrowBaseException(errorIdentifier, this.options.defaultNamespace, response, dataObject, metadata, awsQueryCompatible ? this.mixin.findQueryCompatibleError : void 0);
|
|
2448
|
+
const ns = NormalizedSchema.of(errorSchema);
|
|
2449
|
+
const message = (_c = (_b = dataObject.message) != null ? _b : dataObject.Message) != null ? _c : "UnknownError";
|
|
2450
|
+
const ErrorCtor = (_d = this.compositeErrorRegistry.getErrorCtor(errorSchema)) != null ? _d : Error;
|
|
2451
|
+
const exception = new ErrorCtor({});
|
|
2452
|
+
const output = {};
|
|
2453
|
+
const errorDeserializer = this.codec.createDeserializer();
|
|
2454
|
+
for (const [name, member] of ns.structIterator()) {
|
|
2455
|
+
if (dataObject[name] != null) {
|
|
2456
|
+
output[name] = errorDeserializer.readObject(member, dataObject[name]);
|
|
2457
|
+
}
|
|
2458
|
+
}
|
|
2459
|
+
if (awsQueryCompatible) {
|
|
2460
|
+
this.mixin.queryCompatOutput(dataObject, output);
|
|
2461
|
+
}
|
|
2462
|
+
throw this.mixin.decorateServiceException(Object.assign(exception, errorMetadata, {
|
|
2463
|
+
$fault: ns.getMergedTraits().error,
|
|
2464
|
+
message
|
|
2465
|
+
}, output), dataObject);
|
|
2466
|
+
}
|
|
2467
|
+
};
|
|
2468
|
+
|
|
2469
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsJson1_0Protocol.js
|
|
2470
|
+
var AwsJson1_0Protocol = class extends AwsJsonRpcProtocol {
|
|
2471
|
+
constructor({ defaultNamespace, errorTypeRegistries, serviceTarget, awsQueryCompatible, jsonCodec }) {
|
|
2472
|
+
super({
|
|
2473
|
+
defaultNamespace,
|
|
2474
|
+
errorTypeRegistries,
|
|
2475
|
+
serviceTarget,
|
|
2476
|
+
awsQueryCompatible,
|
|
2477
|
+
jsonCodec
|
|
2478
|
+
});
|
|
2479
|
+
}
|
|
2480
|
+
getShapeId() {
|
|
2481
|
+
return "aws.protocols#awsJson1_0";
|
|
2482
|
+
}
|
|
2483
|
+
getJsonRpcVersion() {
|
|
2484
|
+
return "1.0";
|
|
2485
|
+
}
|
|
2486
|
+
getDefaultContentType() {
|
|
2487
|
+
return "application/x-amz-json-1.0";
|
|
2488
|
+
}
|
|
2489
|
+
};
|
|
2490
|
+
|
|
2491
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsJson1_1Protocol.js
|
|
2492
|
+
var AwsJson1_1Protocol = class extends AwsJsonRpcProtocol {
|
|
2493
|
+
constructor({ defaultNamespace, errorTypeRegistries, serviceTarget, awsQueryCompatible, jsonCodec }) {
|
|
2494
|
+
super({
|
|
2495
|
+
defaultNamespace,
|
|
2496
|
+
errorTypeRegistries,
|
|
2497
|
+
serviceTarget,
|
|
2498
|
+
awsQueryCompatible,
|
|
2499
|
+
jsonCodec
|
|
2500
|
+
});
|
|
2501
|
+
}
|
|
2502
|
+
getShapeId() {
|
|
2503
|
+
return "aws.protocols#awsJson1_1";
|
|
2504
|
+
}
|
|
2505
|
+
getJsonRpcVersion() {
|
|
2506
|
+
return "1.1";
|
|
2507
|
+
}
|
|
2508
|
+
getDefaultContentType() {
|
|
2509
|
+
return "application/x-amz-json-1.1";
|
|
2510
|
+
}
|
|
2511
|
+
};
|
|
2512
|
+
|
|
2513
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/parseXmlBody.js
|
|
2514
|
+
var loadRestXmlErrorCode = (output, data) => {
|
|
2515
|
+
var _a;
|
|
2516
|
+
if (((_a = data == null ? void 0 : data.Error) == null ? void 0 : _a.Code) !== void 0) {
|
|
2517
|
+
return data.Error.Code;
|
|
2518
|
+
}
|
|
2519
|
+
if ((data == null ? void 0 : data.Code) !== void 0) {
|
|
2520
|
+
return data.Code;
|
|
2521
|
+
}
|
|
2522
|
+
if (output.statusCode == 404) {
|
|
2523
|
+
return "NotFound";
|
|
2524
|
+
}
|
|
2525
|
+
};
|
|
2526
|
+
|
|
2527
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/XmlShapeSerializer.js
|
|
2528
|
+
var XmlShapeSerializer = class extends SerdeContextConfig {
|
|
2529
|
+
constructor(settings) {
|
|
2530
|
+
super();
|
|
2531
|
+
__publicField(this, "settings");
|
|
2532
|
+
__publicField(this, "stringBuffer");
|
|
2533
|
+
__publicField(this, "byteBuffer");
|
|
2534
|
+
__publicField(this, "buffer");
|
|
2535
|
+
this.settings = settings;
|
|
2536
|
+
}
|
|
2537
|
+
write(schema, value) {
|
|
2538
|
+
var _a, _b;
|
|
2539
|
+
const ns = NormalizedSchema.of(schema);
|
|
2540
|
+
if (ns.isStringSchema() && typeof value === "string") {
|
|
2541
|
+
this.stringBuffer = value;
|
|
2542
|
+
} else if (ns.isBlobSchema()) {
|
|
2543
|
+
this.byteBuffer = "byteLength" in value ? value : ((_b = (_a = this.serdeContext) == null ? void 0 : _a.base64Decoder) != null ? _b : fromBase64)(value);
|
|
2544
|
+
} else {
|
|
2545
|
+
this.buffer = this.writeStruct(ns, value, void 0);
|
|
2546
|
+
const traits = ns.getMergedTraits();
|
|
2547
|
+
if (traits.httpPayload && !traits.xmlName) {
|
|
2548
|
+
this.buffer.withName(ns.getName());
|
|
2549
|
+
}
|
|
2550
|
+
}
|
|
2551
|
+
}
|
|
2552
|
+
flush() {
|
|
2553
|
+
var _a;
|
|
2554
|
+
if (this.byteBuffer !== void 0) {
|
|
2555
|
+
const bytes = this.byteBuffer;
|
|
2556
|
+
delete this.byteBuffer;
|
|
2557
|
+
return bytes;
|
|
2558
|
+
}
|
|
2559
|
+
if (this.stringBuffer !== void 0) {
|
|
2560
|
+
const str = this.stringBuffer;
|
|
2561
|
+
delete this.stringBuffer;
|
|
2562
|
+
return str;
|
|
2563
|
+
}
|
|
2564
|
+
const buffer = this.buffer;
|
|
2565
|
+
if (this.settings.xmlNamespace) {
|
|
2566
|
+
if (!((_a = buffer == null ? void 0 : buffer.attributes) == null ? void 0 : _a["xmlns"])) {
|
|
2567
|
+
buffer.addAttribute("xmlns", this.settings.xmlNamespace);
|
|
2568
|
+
}
|
|
2569
|
+
}
|
|
2570
|
+
delete this.buffer;
|
|
2571
|
+
return buffer.toString();
|
|
2572
|
+
}
|
|
2573
|
+
writeStruct(ns, value, parentXmlns) {
|
|
2574
|
+
var _a, _b, _c, _d;
|
|
2575
|
+
const traits = ns.getMergedTraits();
|
|
2576
|
+
const name = ns.isMemberSchema() && !traits.httpPayload ? (_a = ns.getMemberTraits().xmlName) != null ? _a : ns.getMemberName() : (_b = traits.xmlName) != null ? _b : ns.getName();
|
|
2577
|
+
if (!name || !ns.isStructSchema()) {
|
|
2578
|
+
throw new Error(`@aws-sdk/core/protocols - xml serializer, cannot write struct with empty name or non-struct, schema=${ns.getName(true)}.`);
|
|
2579
|
+
}
|
|
2580
|
+
const structXmlNode = XmlNode.of(name);
|
|
2581
|
+
const [xmlnsAttr, xmlns] = this.getXmlnsAttribute(ns, parentXmlns);
|
|
2582
|
+
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
2583
|
+
const val = value[memberName];
|
|
2584
|
+
if (val != null || memberSchema.isIdempotencyToken()) {
|
|
2585
|
+
if (memberSchema.getMergedTraits().xmlAttribute) {
|
|
2586
|
+
structXmlNode.addAttribute((_c = memberSchema.getMergedTraits().xmlName) != null ? _c : memberName, this.writeSimple(memberSchema, val));
|
|
2587
|
+
continue;
|
|
2588
|
+
}
|
|
2589
|
+
if (memberSchema.isListSchema()) {
|
|
2590
|
+
this.writeList(memberSchema, val, structXmlNode, xmlns);
|
|
2591
|
+
} else if (memberSchema.isMapSchema()) {
|
|
2592
|
+
this.writeMap(memberSchema, val, structXmlNode, xmlns);
|
|
2593
|
+
} else if (memberSchema.isStructSchema()) {
|
|
2594
|
+
structXmlNode.addChildNode(this.writeStruct(memberSchema, val, xmlns));
|
|
2595
|
+
} else {
|
|
2596
|
+
const memberNode = XmlNode.of((_d = memberSchema.getMergedTraits().xmlName) != null ? _d : memberSchema.getMemberName());
|
|
2597
|
+
this.writeSimpleInto(memberSchema, val, memberNode, xmlns);
|
|
2598
|
+
structXmlNode.addChildNode(memberNode);
|
|
2599
|
+
}
|
|
2600
|
+
}
|
|
2601
|
+
}
|
|
2602
|
+
const { $unknown } = value;
|
|
2603
|
+
if ($unknown && ns.isUnionSchema() && Array.isArray($unknown) && Object.keys(value).length === 1) {
|
|
2604
|
+
const [k, v] = $unknown;
|
|
2605
|
+
const node = XmlNode.of(k);
|
|
2606
|
+
if (typeof v !== "string") {
|
|
2607
|
+
if (value instanceof XmlNode || value instanceof XmlText) {
|
|
2608
|
+
structXmlNode.addChildNode(value);
|
|
2609
|
+
} else {
|
|
2610
|
+
throw new Error(`@aws-sdk - $unknown union member in XML requires value of type string, @aws-sdk/xml-builder::XmlNode or XmlText.`);
|
|
2611
|
+
}
|
|
2612
|
+
}
|
|
2613
|
+
this.writeSimpleInto(0, v, node, xmlns);
|
|
2614
|
+
structXmlNode.addChildNode(node);
|
|
2615
|
+
}
|
|
2616
|
+
if (xmlns) {
|
|
2617
|
+
structXmlNode.addAttribute(xmlnsAttr, xmlns);
|
|
2618
|
+
}
|
|
2619
|
+
return structXmlNode;
|
|
2620
|
+
}
|
|
2621
|
+
writeList(listMember, array, container, parentXmlns) {
|
|
2622
|
+
var _a;
|
|
2623
|
+
if (!listMember.isMemberSchema()) {
|
|
2624
|
+
throw new Error(`@aws-sdk/core/protocols - xml serializer, cannot write non-member list: ${listMember.getName(true)}`);
|
|
2625
|
+
}
|
|
2626
|
+
const listTraits = listMember.getMergedTraits();
|
|
2627
|
+
const listValueSchema = listMember.getValueSchema();
|
|
2628
|
+
const listValueTraits = listValueSchema.getMergedTraits();
|
|
2629
|
+
const sparse = !!listValueTraits.sparse;
|
|
2630
|
+
const flat = !!listTraits.xmlFlattened;
|
|
2631
|
+
const [xmlnsAttr, xmlns] = this.getXmlnsAttribute(listMember, parentXmlns);
|
|
2632
|
+
const writeItem = (container2, value) => {
|
|
2633
|
+
var _a2, _b, _c, _d;
|
|
2634
|
+
if (listValueSchema.isListSchema()) {
|
|
2635
|
+
this.writeList(listValueSchema, Array.isArray(value) ? value : [value], container2, xmlns);
|
|
2636
|
+
} else if (listValueSchema.isMapSchema()) {
|
|
2637
|
+
this.writeMap(listValueSchema, value, container2, xmlns);
|
|
2638
|
+
} else if (listValueSchema.isStructSchema()) {
|
|
2639
|
+
const struct = this.writeStruct(listValueSchema, value, xmlns);
|
|
2640
|
+
container2.addChildNode(struct.withName(flat ? (_a2 = listTraits.xmlName) != null ? _a2 : listMember.getMemberName() : (_b = listValueTraits.xmlName) != null ? _b : "member"));
|
|
2641
|
+
} else {
|
|
2642
|
+
const listItemNode = XmlNode.of(flat ? (_c = listTraits.xmlName) != null ? _c : listMember.getMemberName() : (_d = listValueTraits.xmlName) != null ? _d : "member");
|
|
2643
|
+
this.writeSimpleInto(listValueSchema, value, listItemNode, xmlns);
|
|
2644
|
+
container2.addChildNode(listItemNode);
|
|
2645
|
+
}
|
|
2646
|
+
};
|
|
2647
|
+
if (flat) {
|
|
2648
|
+
for (const value of array) {
|
|
2649
|
+
if (sparse || value != null) {
|
|
2650
|
+
writeItem(container, value);
|
|
2651
|
+
}
|
|
2652
|
+
}
|
|
2653
|
+
} else {
|
|
2654
|
+
const listNode = XmlNode.of((_a = listTraits.xmlName) != null ? _a : listMember.getMemberName());
|
|
2655
|
+
if (xmlns) {
|
|
2656
|
+
listNode.addAttribute(xmlnsAttr, xmlns);
|
|
2657
|
+
}
|
|
2658
|
+
for (const value of array) {
|
|
2659
|
+
if (sparse || value != null) {
|
|
2660
|
+
writeItem(listNode, value);
|
|
2661
|
+
}
|
|
2662
|
+
}
|
|
2663
|
+
container.addChildNode(listNode);
|
|
2664
|
+
}
|
|
2665
|
+
}
|
|
2666
|
+
writeMap(mapMember, map, container, parentXmlns, containerIsMap = false) {
|
|
2667
|
+
var _a, _b, _c, _d;
|
|
2668
|
+
if (!mapMember.isMemberSchema()) {
|
|
2669
|
+
throw new Error(`@aws-sdk/core/protocols - xml serializer, cannot write non-member map: ${mapMember.getName(true)}`);
|
|
2670
|
+
}
|
|
2671
|
+
const mapTraits = mapMember.getMergedTraits();
|
|
2672
|
+
const mapKeySchema = mapMember.getKeySchema();
|
|
2673
|
+
const mapKeyTraits = mapKeySchema.getMergedTraits();
|
|
2674
|
+
const keyTag = (_a = mapKeyTraits.xmlName) != null ? _a : "key";
|
|
2675
|
+
const mapValueSchema = mapMember.getValueSchema();
|
|
2676
|
+
const mapValueTraits = mapValueSchema.getMergedTraits();
|
|
2677
|
+
const valueTag = (_b = mapValueTraits.xmlName) != null ? _b : "value";
|
|
2678
|
+
const sparse = !!mapValueTraits.sparse;
|
|
2679
|
+
const flat = !!mapTraits.xmlFlattened;
|
|
2680
|
+
const [xmlnsAttr, xmlns] = this.getXmlnsAttribute(mapMember, parentXmlns);
|
|
2681
|
+
const addKeyValue = (entry, key, val) => {
|
|
2682
|
+
const keyNode = XmlNode.of(keyTag, key);
|
|
2683
|
+
const [keyXmlnsAttr, keyXmlns] = this.getXmlnsAttribute(mapKeySchema, xmlns);
|
|
2684
|
+
if (keyXmlns) {
|
|
2685
|
+
keyNode.addAttribute(keyXmlnsAttr, keyXmlns);
|
|
2686
|
+
}
|
|
2687
|
+
entry.addChildNode(keyNode);
|
|
2688
|
+
let valueNode = XmlNode.of(valueTag);
|
|
2689
|
+
if (mapValueSchema.isListSchema()) {
|
|
2690
|
+
this.writeList(mapValueSchema, val, valueNode, xmlns);
|
|
2691
|
+
} else if (mapValueSchema.isMapSchema()) {
|
|
2692
|
+
this.writeMap(mapValueSchema, val, valueNode, xmlns, true);
|
|
2693
|
+
} else if (mapValueSchema.isStructSchema()) {
|
|
2694
|
+
valueNode = this.writeStruct(mapValueSchema, val, xmlns);
|
|
2695
|
+
} else {
|
|
2696
|
+
this.writeSimpleInto(mapValueSchema, val, valueNode, xmlns);
|
|
2697
|
+
}
|
|
2698
|
+
entry.addChildNode(valueNode);
|
|
2699
|
+
};
|
|
2700
|
+
if (flat) {
|
|
2701
|
+
for (const key in map) {
|
|
2702
|
+
const val = map[key];
|
|
2703
|
+
if (sparse || val != null) {
|
|
2704
|
+
const entry = XmlNode.of((_c = mapTraits.xmlName) != null ? _c : mapMember.getMemberName());
|
|
2705
|
+
addKeyValue(entry, key, val);
|
|
2706
|
+
container.addChildNode(entry);
|
|
2707
|
+
}
|
|
2708
|
+
}
|
|
2709
|
+
} else {
|
|
2710
|
+
let mapNode;
|
|
2711
|
+
if (!containerIsMap) {
|
|
2712
|
+
mapNode = XmlNode.of((_d = mapTraits.xmlName) != null ? _d : mapMember.getMemberName());
|
|
2713
|
+
if (xmlns) {
|
|
2714
|
+
mapNode.addAttribute(xmlnsAttr, xmlns);
|
|
2715
|
+
}
|
|
2716
|
+
container.addChildNode(mapNode);
|
|
2717
|
+
}
|
|
2718
|
+
for (const key in map) {
|
|
2719
|
+
const val = map[key];
|
|
2720
|
+
if (sparse || val != null) {
|
|
2721
|
+
const entry = XmlNode.of("entry");
|
|
2722
|
+
addKeyValue(entry, key, val);
|
|
2723
|
+
(containerIsMap ? container : mapNode).addChildNode(entry);
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2726
|
+
}
|
|
2727
|
+
}
|
|
2728
|
+
writeSimple(_schema, value) {
|
|
2729
|
+
var _a, _b;
|
|
2730
|
+
if (null === value) {
|
|
2731
|
+
throw new Error("@aws-sdk/core/protocols - (XML serializer) cannot write null value.");
|
|
2732
|
+
}
|
|
2733
|
+
const ns = NormalizedSchema.of(_schema);
|
|
2734
|
+
let nodeContents = null;
|
|
2735
|
+
if (value && typeof value === "object") {
|
|
2736
|
+
if (ns.isBlobSchema()) {
|
|
2737
|
+
nodeContents = ((_b = (_a = this.serdeContext) == null ? void 0 : _a.base64Encoder) != null ? _b : toBase64)(value);
|
|
2738
|
+
} else if (ns.isTimestampSchema() && value instanceof Date) {
|
|
2739
|
+
const format = determineTimestampFormat(ns, this.settings);
|
|
2740
|
+
switch (format) {
|
|
2741
|
+
case 5:
|
|
2742
|
+
nodeContents = value.toISOString().replace(".000Z", "Z");
|
|
2743
|
+
break;
|
|
2744
|
+
case 6:
|
|
2745
|
+
nodeContents = dateToUtcString(value);
|
|
2746
|
+
break;
|
|
2747
|
+
case 7:
|
|
2748
|
+
nodeContents = String(value.getTime() / 1e3);
|
|
2749
|
+
break;
|
|
2750
|
+
default:
|
|
2751
|
+
console.warn("Missing timestamp format, using http date", value);
|
|
2752
|
+
nodeContents = dateToUtcString(value);
|
|
2753
|
+
break;
|
|
2754
|
+
}
|
|
2755
|
+
} else if (ns.isBigDecimalSchema() && value) {
|
|
2756
|
+
if (value instanceof NumericValue) {
|
|
2757
|
+
return value.string;
|
|
2758
|
+
}
|
|
2759
|
+
return String(value);
|
|
2760
|
+
} else if (ns.isMapSchema() || ns.isListSchema()) {
|
|
2761
|
+
throw new Error("@aws-sdk/core/protocols - xml serializer, cannot call _write() on List/Map schema, call writeList or writeMap() instead.");
|
|
2762
|
+
} else {
|
|
2763
|
+
throw new Error(`@aws-sdk/core/protocols - xml serializer, unhandled schema type for object value and schema: ${ns.getName(true)}`);
|
|
2764
|
+
}
|
|
2765
|
+
}
|
|
2766
|
+
if (ns.isBooleanSchema() || ns.isNumericSchema() || ns.isBigIntegerSchema() || ns.isBigDecimalSchema()) {
|
|
2767
|
+
nodeContents = String(value);
|
|
2768
|
+
}
|
|
2769
|
+
if (ns.isStringSchema()) {
|
|
2770
|
+
if (value === void 0 && ns.isIdempotencyToken()) {
|
|
2771
|
+
nodeContents = generateIdempotencyToken();
|
|
2772
|
+
} else {
|
|
2773
|
+
nodeContents = String(value);
|
|
2774
|
+
}
|
|
2775
|
+
}
|
|
2776
|
+
if (nodeContents === null) {
|
|
2777
|
+
throw new Error(`Unhandled schema-value pair ${ns.getName(true)}=${value}`);
|
|
2778
|
+
}
|
|
2779
|
+
return nodeContents;
|
|
2780
|
+
}
|
|
2781
|
+
writeSimpleInto(_schema, value, into, parentXmlns) {
|
|
2782
|
+
const nodeContents = this.writeSimple(_schema, value);
|
|
2783
|
+
const ns = NormalizedSchema.of(_schema);
|
|
2784
|
+
const content = new XmlText(nodeContents);
|
|
2785
|
+
const [xmlnsAttr, xmlns] = this.getXmlnsAttribute(ns, parentXmlns);
|
|
2786
|
+
if (xmlns) {
|
|
2787
|
+
into.addAttribute(xmlnsAttr, xmlns);
|
|
2788
|
+
}
|
|
2789
|
+
into.addChildNode(content);
|
|
2790
|
+
}
|
|
2791
|
+
getXmlnsAttribute(ns, parentXmlns) {
|
|
2792
|
+
var _a;
|
|
2793
|
+
const traits = ns.getMergedTraits();
|
|
2794
|
+
const [prefix, xmlns] = (_a = traits.xmlNamespace) != null ? _a : [];
|
|
2795
|
+
if (xmlns && xmlns !== parentXmlns) {
|
|
2796
|
+
return [prefix ? `xmlns:${prefix}` : "xmlns", xmlns];
|
|
2797
|
+
}
|
|
2798
|
+
return [void 0, void 0];
|
|
2799
|
+
}
|
|
2800
|
+
};
|
|
2801
|
+
|
|
2802
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/XmlCodec.js
|
|
2803
|
+
var XmlCodec = class extends SerdeContextConfig {
|
|
2804
|
+
constructor(settings) {
|
|
2805
|
+
super();
|
|
2806
|
+
__publicField(this, "settings");
|
|
2807
|
+
this.settings = settings;
|
|
2808
|
+
}
|
|
2809
|
+
createSerializer() {
|
|
2810
|
+
const serializer = new XmlShapeSerializer(this.settings);
|
|
2811
|
+
serializer.setSerdeContext(this.serdeContext);
|
|
2812
|
+
return serializer;
|
|
2813
|
+
}
|
|
2814
|
+
createDeserializer() {
|
|
2815
|
+
const deserializer = new XmlShapeDeserializer(this.settings);
|
|
2816
|
+
deserializer.setSerdeContext(this.serdeContext);
|
|
2817
|
+
return deserializer;
|
|
2818
|
+
}
|
|
2819
|
+
};
|
|
2820
|
+
|
|
2821
|
+
// ../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/AwsRestXmlProtocol.js
|
|
2822
|
+
var AwsRestXmlProtocol = class extends HttpBindingProtocol {
|
|
2823
|
+
constructor(options) {
|
|
2824
|
+
super(options);
|
|
2825
|
+
__publicField(this, "codec");
|
|
2826
|
+
__publicField(this, "serializer");
|
|
2827
|
+
__publicField(this, "deserializer");
|
|
2828
|
+
__publicField(this, "mixin", new ProtocolLib());
|
|
2829
|
+
const settings = {
|
|
2830
|
+
timestampFormat: {
|
|
2831
|
+
useTrait: true,
|
|
2832
|
+
default: 5
|
|
2833
|
+
},
|
|
2834
|
+
httpBindings: true,
|
|
2835
|
+
xmlNamespace: options.xmlNamespace,
|
|
2836
|
+
serviceNamespace: options.defaultNamespace
|
|
2837
|
+
};
|
|
2838
|
+
this.codec = new XmlCodec(settings);
|
|
2839
|
+
this.serializer = new HttpInterceptingShapeSerializer(this.codec.createSerializer(), settings);
|
|
2840
|
+
this.deserializer = new HttpInterceptingShapeDeserializer(this.codec.createDeserializer(), settings);
|
|
2841
|
+
}
|
|
2842
|
+
getPayloadCodec() {
|
|
2843
|
+
return this.codec;
|
|
2844
|
+
}
|
|
2845
|
+
getShapeId() {
|
|
2846
|
+
return "aws.protocols#restXml";
|
|
2847
|
+
}
|
|
2848
|
+
async serializeRequest(operationSchema, input, context) {
|
|
2849
|
+
const request = await super.serializeRequest(operationSchema, input, context);
|
|
2850
|
+
const inputSchema = NormalizedSchema.of(operationSchema.input);
|
|
2851
|
+
if (!request.headers["content-type"]) {
|
|
2852
|
+
const contentType = this.mixin.resolveRestContentType(this.getDefaultContentType(), inputSchema);
|
|
2853
|
+
if (contentType) {
|
|
2854
|
+
request.headers["content-type"] = contentType;
|
|
2855
|
+
}
|
|
2856
|
+
}
|
|
2857
|
+
if (typeof request.body === "string" && request.headers["content-type"] === this.getDefaultContentType() && !request.body.startsWith("<?xml ") && !this.hasUnstructuredPayloadBinding(inputSchema)) {
|
|
2858
|
+
request.body = '<?xml version="1.0" encoding="UTF-8"?>' + request.body;
|
|
2859
|
+
}
|
|
2860
|
+
return request;
|
|
2861
|
+
}
|
|
2862
|
+
async deserializeResponse(operationSchema, context, response) {
|
|
2863
|
+
return super.deserializeResponse(operationSchema, context, response);
|
|
2864
|
+
}
|
|
2865
|
+
async handleError(operationSchema, context, response, dataObject, metadata) {
|
|
2866
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
2867
|
+
const errorIdentifier = (_a = loadRestXmlErrorCode(response, dataObject)) != null ? _a : "Unknown";
|
|
2868
|
+
this.mixin.compose(this.compositeErrorRegistry, errorIdentifier, this.options.defaultNamespace);
|
|
2869
|
+
if (dataObject.Error && typeof dataObject.Error === "object") {
|
|
2870
|
+
for (const key of Object.keys(dataObject.Error)) {
|
|
2871
|
+
dataObject[key] = dataObject.Error[key];
|
|
2872
|
+
if (key.toLowerCase() === "message") {
|
|
2873
|
+
dataObject.message = dataObject.Error[key];
|
|
2874
|
+
}
|
|
2875
|
+
}
|
|
2876
|
+
}
|
|
2877
|
+
if (dataObject.RequestId && !metadata.requestId) {
|
|
2878
|
+
metadata.requestId = dataObject.RequestId;
|
|
2879
|
+
}
|
|
2880
|
+
const { errorSchema, errorMetadata } = await this.mixin.getErrorSchemaOrThrowBaseException(errorIdentifier, this.options.defaultNamespace, response, dataObject, metadata);
|
|
2881
|
+
const ns = NormalizedSchema.of(errorSchema);
|
|
2882
|
+
const message = (_g = (_f = (_e = (_d = (_b = dataObject.Error) == null ? void 0 : _b.message) != null ? _d : (_c = dataObject.Error) == null ? void 0 : _c.Message) != null ? _e : dataObject.message) != null ? _f : dataObject.Message) != null ? _g : "UnknownError";
|
|
2883
|
+
const ErrorCtor = (_h = this.compositeErrorRegistry.getErrorCtor(errorSchema)) != null ? _h : Error;
|
|
2884
|
+
const exception = new ErrorCtor({});
|
|
2885
|
+
await this.deserializeHttpMessage(errorSchema, context, response, dataObject);
|
|
2886
|
+
const output = {};
|
|
2887
|
+
const errorDeserializer = this.codec.createDeserializer();
|
|
2888
|
+
for (const [name, member] of ns.structIterator()) {
|
|
2889
|
+
const target = (_i = member.getMergedTraits().xmlName) != null ? _i : name;
|
|
2890
|
+
const value = (_k = (_j = dataObject.Error) == null ? void 0 : _j[target]) != null ? _k : dataObject[target];
|
|
2891
|
+
output[name] = errorDeserializer.readSchema(member, value);
|
|
2892
|
+
}
|
|
2893
|
+
throw this.mixin.decorateServiceException(Object.assign(exception, errorMetadata, {
|
|
2894
|
+
$fault: ns.getMergedTraits().error,
|
|
2895
|
+
message
|
|
2896
|
+
}, output), dataObject);
|
|
2897
|
+
}
|
|
2898
|
+
getDefaultContentType() {
|
|
2899
|
+
return "application/xml";
|
|
2900
|
+
}
|
|
2901
|
+
hasUnstructuredPayloadBinding(ns) {
|
|
2902
|
+
for (const [, member] of ns.structIterator()) {
|
|
2903
|
+
if (member.getMergedTraits().httpPayload) {
|
|
2904
|
+
return !(member.isStructSchema() || member.isMapSchema() || member.isListSchema());
|
|
2905
|
+
}
|
|
2906
|
+
}
|
|
2907
|
+
return false;
|
|
2908
|
+
}
|
|
2909
|
+
};
|
|
2910
|
+
|
|
2911
|
+
export {
|
|
2912
|
+
AwsSdkSigV4Signer,
|
|
2913
|
+
AwsSdkSigV4ASigner,
|
|
2914
|
+
NODE_AUTH_SCHEME_PREFERENCE_OPTIONS,
|
|
2915
|
+
resolveAwsSdkSigV4AConfig,
|
|
2916
|
+
NODE_SIGV4A_CONFIG_OPTIONS,
|
|
2917
|
+
SignatureV4,
|
|
2918
|
+
signatureV4aContainer,
|
|
2919
|
+
resolveAwsSdkSigV4Config,
|
|
2920
|
+
JsonShapeDeserializer,
|
|
2921
|
+
JsonShapeSerializer,
|
|
2922
|
+
JsonCodec,
|
|
2923
|
+
AwsJson1_0Protocol,
|
|
2924
|
+
AwsJson1_1Protocol,
|
|
2925
|
+
AwsRestJsonProtocol,
|
|
2926
|
+
AwsQueryProtocol,
|
|
2927
|
+
AwsRestXmlProtocol
|
|
2928
|
+
};
|
|
2929
|
+
//# sourceMappingURL=chunk-JXBFOCBM.js.map
|