@larkup/cli 0.2.25 → 0.2.26

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