thinkwork-cli 0.13.1 → 0.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{api-client-4DZ266J5.js → api-client-JYZXYQJR.js} +3 -1
- package/dist/bowser-6Z6JFAIR.js +2822 -0
- package/dist/chunk-DV3MRBR5.js +43 -0
- package/dist/chunk-DVPBI5HM.js +1728 -0
- package/dist/chunk-EI5ZX7CN.js +522 -0
- package/dist/chunk-EUJ7X6YD.js +126 -0
- package/dist/chunk-GG5WKBOX.js +436 -0
- package/dist/chunk-I64EZSU5.js +358 -0
- package/dist/chunk-ILZKG5WV.js +6151 -0
- package/dist/chunk-KMIJ5KGT.js +128 -0
- package/dist/chunk-OCPHU34C.js +996 -0
- package/dist/chunk-QOERT44A.js +3286 -0
- package/dist/chunk-XYM7PE2A.js +2264 -0
- package/dist/{chunk-Y2WHJECR.js → chunk-Z2F6RJFR.js} +1 -39
- package/dist/cli.js +43080 -13150
- package/dist/dist-es-CRV46D5B.js +315 -0
- package/dist/dist-es-DCY4IC3Y.js +2000 -0
- package/dist/dist-es-ENBUC3JP.js +14726 -0
- package/dist/dist-es-G54LBMRN.js +48 -0
- package/dist/dist-es-G7PTG75M.js +176 -0
- package/dist/dist-es-GKDBE7E6.js +88 -0
- package/dist/dist-es-HY3535OI.js +70 -0
- package/dist/dist-es-KL7Y5NB2.js +377 -0
- package/dist/dist-es-LDE437AM.js +170 -0
- package/dist/dist-es-P26FWFLT.js +485 -0
- package/dist/dist-es-Q57SZXZ7.js +70 -0
- package/dist/dist-es-R7FGL2IB.js +88 -0
- package/dist/dist-es-USORBXZ5.js +318 -0
- package/dist/dist-es-ZKC2QKD2.js +377 -0
- package/dist/drizzle/0076_scheduled_jobs_marco_backfill.sql +2 -1
- package/dist/drizzle/0079_seed_tenant_customize_catalog.sql +1 -0
- package/dist/drizzle/0090_brain_schema_extraction.sql +10 -0
- package/dist/drizzle/0132_drop_computer_tables.sql +3 -0
- package/dist/drizzle/0160_compliance_event_types_plugins.sql +2 -0
- package/dist/drizzle/0214_think137_drop_judge_evidence_roi.sql +1 -0
- package/dist/drizzle/0216_drop_agent_loop_versions_goal_worker_policy.sql +1 -0
- package/dist/drizzle/0227_analyst_reader_role.sql +6 -0
- package/dist/drizzle/0230_analyst_rls.sql +9 -0
- package/dist/drizzle/0250_kg_schema_extraction.sql +27 -0
- package/dist/drizzle/0251_brain_stragglers.sql +21 -0
- package/dist/drizzle/0253_drop_brain_substrate.sql +2 -0
- package/dist/drizzle/0257_agents_runtime_allow_harness.sql +24 -0
- package/dist/drizzle/0261_managed_harness_multiplayer.sql +313 -0
- package/dist/drizzle/0261_native_auth_control_plane.sql +328 -0
- package/dist/drizzle/0262_auth_subscription_tickets.sql +59 -0
- package/dist/drizzle/0262_parallel_harness_threads.sql +9 -0
- package/dist/drizzle/0263_agentcore_runtime_identifier.sql +69 -0
- package/dist/drizzle/0263_drop_workos_auth_runtime.sql +236 -0
- package/dist/drizzle/0264_auth_enrollment_attempt_limits.sql +15 -0
- package/dist/drizzle/0264_harness_tool_execution_ledger.sql +113 -0
- package/dist/drizzle/0265_eval_runs_requester_identity.sql +28 -0
- package/dist/drizzle/0265_require_fully_valid_auth_publication.sql +27 -0
- package/dist/drizzle/0266_auth_identity_recovery_grants.sql +9 -0
- package/dist/drizzle/0266_eval_profiles_runtime_type.sql +12 -0
- package/dist/drizzle/0267_ontology_candidate_rejections.sql +53 -0
- package/dist/drizzle/0268_identity_crosswalk_routing.sql +182 -0
- package/dist/drizzle/0269_ontology_system_map.sql +31 -0
- package/dist/event-streams-7JNLJEEL.js +894 -0
- package/dist/event-streams-KDF5RWR6.js +1515 -0
- package/dist/loadSso-DJVB7BXE.js +576 -0
- package/dist/loadSso-JAMNA3WY.js +583 -0
- package/dist/plugins/catalog/package.json +1 -2
- package/dist/plugins/catalog/src/__tests__/build-catalog.test.ts +0 -1
- package/dist/plugins/catalog/src/__tests__/contracts.test.ts +0 -69
- package/dist/plugins/catalog/src/__tests__/plugin-package.test.ts +0 -2
- package/dist/plugins/catalog/src/__tests__/plugin-registry.test.ts +0 -5
- package/dist/plugins/catalog/src/contracts.ts +2 -179
- package/dist/plugins/catalog/src/registry/generated-first-party.ts +0 -6
- package/dist/signin-UGDWTGS4.js +821 -0
- package/dist/sso-oidc-Q4VXANXY.js +837 -0
- package/dist/sts-CWLSE3GH.js +1241 -0
- package/dist/sts-DNZLNVOV.js +1245 -0
- package/dist/terraform/examples/greenfield/main.tf +223 -66
- package/dist/terraform/examples/greenfield/terraform.tfvars.example +15 -1
- package/dist/terraform/modules/app/agentcore-gateway/main.tf +305 -0
- package/dist/terraform/modules/app/agentcore-gateway/outputs.tf +44 -0
- package/dist/terraform/modules/app/agentcore-gateway/scripts/delete_gateway.sh +93 -0
- package/dist/terraform/modules/app/agentcore-gateway/scripts/read_gateway.sh +33 -0
- package/dist/terraform/modules/app/agentcore-gateway/scripts/reconcile_gateway.sh +543 -0
- package/dist/terraform/modules/app/agentcore-gateway/variables.tf +70 -0
- package/dist/terraform/modules/app/agentcore-harness/main.tf +237 -8
- package/dist/terraform/modules/app/agentcore-harness/outputs.tf +63 -0
- package/dist/terraform/modules/app/agentcore-harness/scripts/delete_harness.sh +5 -0
- package/dist/terraform/modules/app/agentcore-harness/scripts/harness-lifecycle.mjs +430 -0
- package/dist/terraform/modules/app/agentcore-harness/scripts/harness-readback.mjs +180 -0
- package/dist/terraform/modules/app/agentcore-harness/scripts/harness-tool-contract.mjs +193 -0
- package/dist/terraform/modules/app/agentcore-harness/scripts/prune_harness.sh +5 -0
- package/dist/terraform/modules/app/agentcore-harness/scripts/read_harness.sh +5 -0
- package/dist/terraform/modules/app/agentcore-harness/scripts/reconcile_harness.sh +5 -0
- package/dist/terraform/modules/app/agentcore-harness/variables.tf +72 -1
- package/dist/terraform/modules/app/agentcore-identity/main.tf +173 -0
- package/dist/terraform/modules/app/agentcore-identity/outputs.tf +51 -0
- package/dist/terraform/modules/app/agentcore-identity/scripts/bootstrap_twenty_oauth_client.sh +122 -0
- package/dist/terraform/modules/app/agentcore-identity/scripts/delete_identity.sh +25 -0
- package/dist/terraform/modules/app/agentcore-identity/scripts/delete_twenty_identity.sh +16 -0
- package/dist/terraform/modules/app/agentcore-identity/scripts/read_identity.sh +40 -0
- package/dist/terraform/modules/app/agentcore-identity/scripts/reconcile_identity.sh +73 -0
- package/dist/terraform/modules/app/agentcore-identity/scripts/reconcile_twenty_identity.sh +74 -0
- package/dist/terraform/modules/app/agentcore-identity/scripts/reconcile_twenty_provider.mjs +61 -0
- package/dist/terraform/modules/app/agentcore-identity/variables.tf +54 -0
- package/dist/terraform/modules/app/appsync-subscriptions/main.tf +127 -21
- package/dist/terraform/modules/app/appsync-subscriptions/outputs.tf +0 -6
- package/dist/terraform/modules/app/appsync-subscriptions/variables.tf +5 -0
- package/dist/terraform/modules/app/deployment-control-plane/runner.py +966 -27
- package/dist/terraform/modules/app/deployment-control-plane/test_runner_bundle.py +581 -22
- package/dist/terraform/modules/app/lambda-api/agentcore-harness-alarms.tf +88 -0
- package/dist/terraform/modules/app/lambda-api/agentcore-identity-alarms.tf +91 -0
- package/dist/terraform/modules/app/lambda-api/handlers.tf +298 -74
- package/dist/terraform/modules/app/lambda-api/iam-grouped.tf +99 -54
- package/dist/terraform/modules/app/lambda-api/main.tf +24 -0
- package/dist/terraform/modules/app/lambda-api/mcp-oauth.tf +181 -4
- package/dist/terraform/modules/app/lambda-api/outputs.tf +35 -0
- package/dist/terraform/modules/app/lambda-api/runtime-config.tf +3 -21
- package/dist/terraform/modules/app/lambda-api/variables.tf +109 -16
- package/dist/terraform/modules/foundation/cognito/main.tf +294 -72
- package/dist/terraform/modules/foundation/cognito/outputs.tf +42 -0
- package/dist/terraform/modules/foundation/cognito/variables.tf +114 -4
- package/dist/terraform/modules/thinkwork/main.tf +269 -46
- package/dist/terraform/modules/thinkwork/outputs.tf +136 -8
- package/dist/terraform/modules/thinkwork/variables.tf +124 -17
- package/dist/terraform/schema.graphql +69 -36
- package/dist/workspace-defaults/files/USER.md +1 -0
- package/package.json +3 -2
- package/dist/drizzle/0261_thread_turns_origin_turn_index.sql +0 -11
- package/dist/plugins/workos-auth/package.json +0 -22
- package/dist/plugins/workos-auth/src/index.ts +0 -30
- package/dist/plugins/workos-auth/src/manifest.ts +0 -40
- package/dist/plugins/workos-auth/src/provider-contract.ts +0 -39
- package/dist/plugins/workos-auth/test/manifest.test.ts +0 -94
- package/dist/plugins/workos-auth/tsconfig.json +0 -8
|
@@ -0,0 +1,1728 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
SignatureV4
|
|
4
|
+
} from "./chunk-EI5ZX7CN.js";
|
|
5
|
+
import {
|
|
6
|
+
decorateServiceException,
|
|
7
|
+
doesIdentityRequireRefresh,
|
|
8
|
+
getValueFromTextNode,
|
|
9
|
+
isIdentityExpired,
|
|
10
|
+
memoizeIdentityProvider,
|
|
11
|
+
normalizeProvider,
|
|
12
|
+
setCredentialFeature
|
|
13
|
+
} from "./chunk-QOERT44A.js";
|
|
14
|
+
import {
|
|
15
|
+
FromStringShapeDeserializer,
|
|
16
|
+
HttpBindingProtocol,
|
|
17
|
+
HttpInterceptingShapeDeserializer,
|
|
18
|
+
HttpInterceptingShapeSerializer,
|
|
19
|
+
HttpRequest,
|
|
20
|
+
HttpResponse,
|
|
21
|
+
NormalizedSchema,
|
|
22
|
+
ProviderError,
|
|
23
|
+
RpcProtocol,
|
|
24
|
+
TypeRegistry,
|
|
25
|
+
collectBody,
|
|
26
|
+
deref,
|
|
27
|
+
determineTimestampFormat,
|
|
28
|
+
extendedEncodeURIComponent
|
|
29
|
+
} from "./chunk-XYM7PE2A.js";
|
|
30
|
+
import {
|
|
31
|
+
LazyJsonString,
|
|
32
|
+
NumericValue,
|
|
33
|
+
dateToUtcString,
|
|
34
|
+
fromBase64,
|
|
35
|
+
generateIdempotencyToken,
|
|
36
|
+
parseEpochTimestamp,
|
|
37
|
+
parseRfc3339DateTimeWithOffset,
|
|
38
|
+
parseRfc7231DateTime,
|
|
39
|
+
toBase64,
|
|
40
|
+
toUtf8
|
|
41
|
+
} from "./chunk-OCPHU34C.js";
|
|
42
|
+
|
|
43
|
+
// ../../node_modules/.pnpm/@aws-sdk+core@3.975.3/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getDateHeader.js
|
|
44
|
+
var getDateHeader = (response) => HttpResponse.isInstance(response) ? response.headers?.date ?? response.headers?.Date : void 0;
|
|
45
|
+
|
|
46
|
+
// ../../node_modules/.pnpm/@aws-sdk+core@3.975.3/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getSkewCorrectedDate.js
|
|
47
|
+
var getSkewCorrectedDate = (systemClockOffset) => new Date(Date.now() + systemClockOffset);
|
|
48
|
+
|
|
49
|
+
// ../../node_modules/.pnpm/@aws-sdk+core@3.975.3/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/isClockSkewed.js
|
|
50
|
+
var isClockSkewed = (clockTime, systemClockOffset) => Math.abs(getSkewCorrectedDate(systemClockOffset).getTime() - clockTime) >= 3e5;
|
|
51
|
+
|
|
52
|
+
// ../../node_modules/.pnpm/@aws-sdk+core@3.975.3/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getUpdatedSystemClockOffset.js
|
|
53
|
+
var getUpdatedSystemClockOffset = (clockTime, currentSystemClockOffset) => {
|
|
54
|
+
const clockTimeInMs = Date.parse(clockTime);
|
|
55
|
+
if (isClockSkewed(clockTimeInMs, currentSystemClockOffset)) {
|
|
56
|
+
return clockTimeInMs - Date.now();
|
|
57
|
+
}
|
|
58
|
+
return currentSystemClockOffset;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// ../../node_modules/.pnpm/@aws-sdk+core@3.975.3/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.js
|
|
62
|
+
var throwSigningPropertyError = (name, property) => {
|
|
63
|
+
if (!property) {
|
|
64
|
+
throw new Error(`Property \`${name}\` is not resolved for AWS SDK SigV4Auth`);
|
|
65
|
+
}
|
|
66
|
+
return property;
|
|
67
|
+
};
|
|
68
|
+
var validateSigningProperties = async (signingProperties) => {
|
|
69
|
+
const context = throwSigningPropertyError("context", signingProperties.context);
|
|
70
|
+
const config = throwSigningPropertyError("config", signingProperties.config);
|
|
71
|
+
const authScheme = context.endpointV2?.properties?.authSchemes?.[0];
|
|
72
|
+
const signerFunction = throwSigningPropertyError("signer", config.signer);
|
|
73
|
+
const signer = await signerFunction(authScheme);
|
|
74
|
+
const signingRegion = signingProperties?.signingRegion;
|
|
75
|
+
const signingRegionSet = signingProperties?.signingRegionSet;
|
|
76
|
+
const signingName = signingProperties?.signingName;
|
|
77
|
+
return {
|
|
78
|
+
config,
|
|
79
|
+
signer,
|
|
80
|
+
signingRegion,
|
|
81
|
+
signingRegionSet,
|
|
82
|
+
signingName
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
var AwsSdkSigV4Signer = class {
|
|
86
|
+
async sign(httpRequest, identity, signingProperties) {
|
|
87
|
+
if (!HttpRequest.isInstance(httpRequest)) {
|
|
88
|
+
throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");
|
|
89
|
+
}
|
|
90
|
+
const validatedProps = await validateSigningProperties(signingProperties);
|
|
91
|
+
const { config, signer } = validatedProps;
|
|
92
|
+
let { signingRegion, signingName } = validatedProps;
|
|
93
|
+
const handlerExecutionContext = signingProperties.context;
|
|
94
|
+
if (handlerExecutionContext?.authSchemes?.length ?? 0 > 1) {
|
|
95
|
+
const [first, second] = handlerExecutionContext.authSchemes;
|
|
96
|
+
if (first?.name === "sigv4a" && second?.name === "sigv4") {
|
|
97
|
+
signingRegion = second?.signingRegion ?? signingRegion;
|
|
98
|
+
signingName = second?.signingName ?? signingName;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
signingProperties._preRequestSystemClockOffset = config.systemClockOffset;
|
|
102
|
+
const signedRequest = await signer.sign(httpRequest, {
|
|
103
|
+
signingDate: getSkewCorrectedDate(config.systemClockOffset),
|
|
104
|
+
signingRegion,
|
|
105
|
+
signingService: signingName
|
|
106
|
+
});
|
|
107
|
+
return signedRequest;
|
|
108
|
+
}
|
|
109
|
+
errorHandler(signingProperties) {
|
|
110
|
+
return (error) => {
|
|
111
|
+
const errorException = error;
|
|
112
|
+
const serverTime = errorException.ServerTime ?? getDateHeader(errorException.$response);
|
|
113
|
+
if (serverTime) {
|
|
114
|
+
const config = throwSigningPropertyError("config", signingProperties.config);
|
|
115
|
+
const preRequestOffset = signingProperties._preRequestSystemClockOffset;
|
|
116
|
+
const newOffset = getUpdatedSystemClockOffset(serverTime, config.systemClockOffset);
|
|
117
|
+
const isLocalCorrection = newOffset !== config.systemClockOffset;
|
|
118
|
+
const isConcurrentCorrection = preRequestOffset !== void 0 && preRequestOffset !== newOffset;
|
|
119
|
+
const clockSkewCorrected = isLocalCorrection || isConcurrentCorrection;
|
|
120
|
+
if (clockSkewCorrected && errorException.$metadata) {
|
|
121
|
+
config.systemClockOffset = newOffset;
|
|
122
|
+
errorException.$metadata.clockSkewCorrected = true;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
throw error;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
successHandler(httpResponse, signingProperties) {
|
|
129
|
+
const dateHeader = getDateHeader(httpResponse);
|
|
130
|
+
if (dateHeader) {
|
|
131
|
+
const config = throwSigningPropertyError("config", signingProperties.config);
|
|
132
|
+
config.systemClockOffset = getUpdatedSystemClockOffset(dateHeader, config.systemClockOffset);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
// ../../node_modules/.pnpm/@aws-sdk+core@3.975.3/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4ASigner.js
|
|
138
|
+
var AwsSdkSigV4ASigner = class extends AwsSdkSigV4Signer {
|
|
139
|
+
async sign(httpRequest, identity, signingProperties) {
|
|
140
|
+
if (!HttpRequest.isInstance(httpRequest)) {
|
|
141
|
+
throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");
|
|
142
|
+
}
|
|
143
|
+
const { config, signer, signingRegion, signingRegionSet, signingName } = await validateSigningProperties(signingProperties);
|
|
144
|
+
const configResolvedSigningRegionSet = await config.sigv4aSigningRegionSet?.();
|
|
145
|
+
const multiRegionOverride = (configResolvedSigningRegionSet ?? signingRegionSet ?? [signingRegion]).join(",");
|
|
146
|
+
signingProperties._preRequestSystemClockOffset = config.systemClockOffset;
|
|
147
|
+
const signedRequest = await signer.sign(httpRequest, {
|
|
148
|
+
signingDate: getSkewCorrectedDate(config.systemClockOffset),
|
|
149
|
+
signingRegion: multiRegionOverride,
|
|
150
|
+
signingService: signingName
|
|
151
|
+
});
|
|
152
|
+
return signedRequest;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// ../../node_modules/.pnpm/@aws-sdk+core@3.975.3/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getArrayForCommaSeparatedString.js
|
|
157
|
+
var getArrayForCommaSeparatedString = (str) => typeof str === "string" && str.length > 0 ? str.split(",").map((item) => item.trim()) : [];
|
|
158
|
+
|
|
159
|
+
// ../../node_modules/.pnpm/@aws-sdk+core@3.975.3/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getBearerTokenEnvKey.js
|
|
160
|
+
var getBearerTokenEnvKey = (signingName) => `AWS_BEARER_TOKEN_${signingName.replace(/[\s-]/g, "_").toUpperCase()}`;
|
|
161
|
+
|
|
162
|
+
// ../../node_modules/.pnpm/@aws-sdk+core@3.975.3/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/NODE_AUTH_SCHEME_PREFERENCE_OPTIONS.js
|
|
163
|
+
var NODE_AUTH_SCHEME_PREFERENCE_ENV_KEY = "AWS_AUTH_SCHEME_PREFERENCE";
|
|
164
|
+
var NODE_AUTH_SCHEME_PREFERENCE_CONFIG_KEY = "auth_scheme_preference";
|
|
165
|
+
var NODE_AUTH_SCHEME_PREFERENCE_OPTIONS = {
|
|
166
|
+
environmentVariableSelector: (env, options) => {
|
|
167
|
+
if (options?.signingName) {
|
|
168
|
+
const bearerTokenKey = getBearerTokenEnvKey(options.signingName);
|
|
169
|
+
if (bearerTokenKey in env)
|
|
170
|
+
return ["httpBearerAuth"];
|
|
171
|
+
}
|
|
172
|
+
if (!(NODE_AUTH_SCHEME_PREFERENCE_ENV_KEY in env))
|
|
173
|
+
return void 0;
|
|
174
|
+
return getArrayForCommaSeparatedString(env[NODE_AUTH_SCHEME_PREFERENCE_ENV_KEY]);
|
|
175
|
+
},
|
|
176
|
+
configFileSelector: (profile) => {
|
|
177
|
+
if (!(NODE_AUTH_SCHEME_PREFERENCE_CONFIG_KEY in profile))
|
|
178
|
+
return void 0;
|
|
179
|
+
return getArrayForCommaSeparatedString(profile[NODE_AUTH_SCHEME_PREFERENCE_CONFIG_KEY]);
|
|
180
|
+
},
|
|
181
|
+
default: []
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
// ../../node_modules/.pnpm/@aws-sdk+core@3.975.3/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4AConfig.js
|
|
185
|
+
var resolveAwsSdkSigV4AConfig = (config) => {
|
|
186
|
+
config.sigv4aSigningRegionSet = normalizeProvider(config.sigv4aSigningRegionSet);
|
|
187
|
+
return config;
|
|
188
|
+
};
|
|
189
|
+
var NODE_SIGV4A_CONFIG_OPTIONS = {
|
|
190
|
+
environmentVariableSelector(env) {
|
|
191
|
+
if (env.AWS_SIGV4A_SIGNING_REGION_SET) {
|
|
192
|
+
return env.AWS_SIGV4A_SIGNING_REGION_SET.split(",").map((_) => _.trim());
|
|
193
|
+
}
|
|
194
|
+
throw new ProviderError("AWS_SIGV4A_SIGNING_REGION_SET not set in env.", {
|
|
195
|
+
tryNextLink: true
|
|
196
|
+
});
|
|
197
|
+
},
|
|
198
|
+
configFileSelector(profile) {
|
|
199
|
+
if (profile.sigv4a_signing_region_set) {
|
|
200
|
+
return (profile.sigv4a_signing_region_set ?? "").split(",").map((_) => _.trim());
|
|
201
|
+
}
|
|
202
|
+
throw new ProviderError("sigv4a_signing_region_set not set in profile.", {
|
|
203
|
+
tryNextLink: true
|
|
204
|
+
});
|
|
205
|
+
},
|
|
206
|
+
default: void 0
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
// ../../node_modules/.pnpm/@aws-sdk+core@3.975.3/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.js
|
|
210
|
+
var resolveAwsSdkSigV4Config = (config) => {
|
|
211
|
+
let inputCredentials = config.credentials;
|
|
212
|
+
let isUserSupplied = !!config.credentials;
|
|
213
|
+
let resolvedCredentials = void 0;
|
|
214
|
+
Object.defineProperty(config, "credentials", {
|
|
215
|
+
set(credentials) {
|
|
216
|
+
if (credentials && credentials !== inputCredentials && credentials !== resolvedCredentials) {
|
|
217
|
+
isUserSupplied = true;
|
|
218
|
+
}
|
|
219
|
+
inputCredentials = credentials;
|
|
220
|
+
const memoizedProvider = normalizeCredentialProvider(config, {
|
|
221
|
+
credentials: inputCredentials,
|
|
222
|
+
credentialDefaultProvider: config.credentialDefaultProvider
|
|
223
|
+
});
|
|
224
|
+
const boundProvider = bindCallerConfig(config, memoizedProvider);
|
|
225
|
+
if (isUserSupplied && !boundProvider.attributed) {
|
|
226
|
+
const isCredentialObject = typeof inputCredentials === "object" && inputCredentials !== null;
|
|
227
|
+
resolvedCredentials = async (options) => {
|
|
228
|
+
const creds = await boundProvider(options);
|
|
229
|
+
const attributedCreds = creds;
|
|
230
|
+
if (isCredentialObject && (!attributedCreds.$source || Object.keys(attributedCreds.$source).length === 0)) {
|
|
231
|
+
return setCredentialFeature(attributedCreds, "CREDENTIALS_CODE", "e");
|
|
232
|
+
}
|
|
233
|
+
return attributedCreds;
|
|
234
|
+
};
|
|
235
|
+
resolvedCredentials.memoized = boundProvider.memoized;
|
|
236
|
+
resolvedCredentials.configBound = boundProvider.configBound;
|
|
237
|
+
resolvedCredentials.attributed = true;
|
|
238
|
+
} else {
|
|
239
|
+
resolvedCredentials = boundProvider;
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
get() {
|
|
243
|
+
return resolvedCredentials;
|
|
244
|
+
},
|
|
245
|
+
enumerable: true,
|
|
246
|
+
configurable: true
|
|
247
|
+
});
|
|
248
|
+
config.credentials = inputCredentials;
|
|
249
|
+
const { signingEscapePath = true, systemClockOffset = config.systemClockOffset || 0, sha256 } = config;
|
|
250
|
+
let signer;
|
|
251
|
+
if (config.signer) {
|
|
252
|
+
signer = normalizeProvider(config.signer);
|
|
253
|
+
} else if (config.regionInfoProvider) {
|
|
254
|
+
signer = () => normalizeProvider(config.region)().then(async (region) => [
|
|
255
|
+
await config.regionInfoProvider(region, {
|
|
256
|
+
useFipsEndpoint: await config.useFipsEndpoint(),
|
|
257
|
+
useDualstackEndpoint: await config.useDualstackEndpoint()
|
|
258
|
+
}) || {},
|
|
259
|
+
region
|
|
260
|
+
]).then(([regionInfo, region]) => {
|
|
261
|
+
const { signingRegion, signingService } = regionInfo;
|
|
262
|
+
config.signingRegion = config.signingRegion || signingRegion || region;
|
|
263
|
+
config.signingName = config.signingName || signingService || config.serviceId;
|
|
264
|
+
const params = {
|
|
265
|
+
...config,
|
|
266
|
+
credentials: config.credentials,
|
|
267
|
+
region: config.signingRegion,
|
|
268
|
+
service: config.signingName,
|
|
269
|
+
sha256,
|
|
270
|
+
uriEscapePath: signingEscapePath
|
|
271
|
+
};
|
|
272
|
+
const SignerCtor = config.signerConstructor || SignatureV4;
|
|
273
|
+
return new SignerCtor(params);
|
|
274
|
+
});
|
|
275
|
+
} else {
|
|
276
|
+
signer = async (authScheme) => {
|
|
277
|
+
authScheme = Object.assign({}, {
|
|
278
|
+
name: "sigv4",
|
|
279
|
+
signingName: config.signingName || config.defaultSigningName,
|
|
280
|
+
signingRegion: await normalizeProvider(config.region)(),
|
|
281
|
+
properties: {}
|
|
282
|
+
}, authScheme);
|
|
283
|
+
const signingRegion = authScheme.signingRegion;
|
|
284
|
+
const signingService = authScheme.signingName;
|
|
285
|
+
config.signingRegion = config.signingRegion || signingRegion;
|
|
286
|
+
config.signingName = config.signingName || signingService || config.serviceId;
|
|
287
|
+
const params = {
|
|
288
|
+
...config,
|
|
289
|
+
credentials: config.credentials,
|
|
290
|
+
region: config.signingRegion,
|
|
291
|
+
service: config.signingName,
|
|
292
|
+
sha256,
|
|
293
|
+
uriEscapePath: signingEscapePath
|
|
294
|
+
};
|
|
295
|
+
const SignerCtor = config.signerConstructor || SignatureV4;
|
|
296
|
+
return new SignerCtor(params);
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
const resolvedConfig = Object.assign(config, {
|
|
300
|
+
systemClockOffset,
|
|
301
|
+
signingEscapePath,
|
|
302
|
+
signer
|
|
303
|
+
});
|
|
304
|
+
return resolvedConfig;
|
|
305
|
+
};
|
|
306
|
+
function normalizeCredentialProvider(config, { credentials, credentialDefaultProvider }) {
|
|
307
|
+
let credentialsProvider;
|
|
308
|
+
if (credentials) {
|
|
309
|
+
if (!credentials?.memoized) {
|
|
310
|
+
credentialsProvider = memoizeIdentityProvider(credentials, isIdentityExpired, doesIdentityRequireRefresh);
|
|
311
|
+
} else {
|
|
312
|
+
credentialsProvider = credentials;
|
|
313
|
+
}
|
|
314
|
+
} else {
|
|
315
|
+
if (credentialDefaultProvider) {
|
|
316
|
+
credentialsProvider = normalizeProvider(credentialDefaultProvider(Object.assign({}, config, {
|
|
317
|
+
parentClientConfig: config
|
|
318
|
+
})));
|
|
319
|
+
} else {
|
|
320
|
+
credentialsProvider = async () => {
|
|
321
|
+
throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.");
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
credentialsProvider.memoized = true;
|
|
326
|
+
return credentialsProvider;
|
|
327
|
+
}
|
|
328
|
+
function bindCallerConfig(config, credentialsProvider) {
|
|
329
|
+
if (credentialsProvider.configBound) {
|
|
330
|
+
return credentialsProvider;
|
|
331
|
+
}
|
|
332
|
+
const fn = async (options) => credentialsProvider({ ...options, callerClientConfig: config });
|
|
333
|
+
fn.memoized = credentialsProvider.memoized;
|
|
334
|
+
fn.configBound = true;
|
|
335
|
+
return fn;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// ../../node_modules/.pnpm/@aws-sdk+core@3.975.3/node_modules/@aws-sdk/core/dist-es/submodules/protocols/ProtocolLib.js
|
|
339
|
+
var ProtocolLib = class {
|
|
340
|
+
queryCompat;
|
|
341
|
+
errorRegistry;
|
|
342
|
+
constructor(queryCompat = false) {
|
|
343
|
+
this.queryCompat = queryCompat;
|
|
344
|
+
}
|
|
345
|
+
resolveRestContentType(defaultContentType, inputSchema) {
|
|
346
|
+
const members = inputSchema.getMemberSchemas();
|
|
347
|
+
const httpPayloadMember = Object.values(members).find((m) => {
|
|
348
|
+
return !!m.getMergedTraits().httpPayload;
|
|
349
|
+
});
|
|
350
|
+
if (httpPayloadMember) {
|
|
351
|
+
const mediaType = httpPayloadMember.getMergedTraits().mediaType;
|
|
352
|
+
if (mediaType) {
|
|
353
|
+
return mediaType;
|
|
354
|
+
} else if (httpPayloadMember.isStringSchema()) {
|
|
355
|
+
return "text/plain";
|
|
356
|
+
} else if (httpPayloadMember.isBlobSchema()) {
|
|
357
|
+
return "application/octet-stream";
|
|
358
|
+
} else {
|
|
359
|
+
return defaultContentType;
|
|
360
|
+
}
|
|
361
|
+
} else if (!inputSchema.isUnitSchema()) {
|
|
362
|
+
const hasBody = Object.values(members).find((m) => {
|
|
363
|
+
const { httpQuery, httpQueryParams, httpHeader, httpLabel, httpPrefixHeaders } = m.getMergedTraits();
|
|
364
|
+
const noPrefixHeaders = httpPrefixHeaders === void 0;
|
|
365
|
+
return !httpQuery && !httpQueryParams && !httpHeader && !httpLabel && noPrefixHeaders;
|
|
366
|
+
});
|
|
367
|
+
if (hasBody) {
|
|
368
|
+
return defaultContentType;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
async getErrorSchemaOrThrowBaseException(errorIdentifier, defaultNamespace, response, dataObject, metadata, getErrorSchema) {
|
|
373
|
+
let errorName = errorIdentifier;
|
|
374
|
+
if (errorIdentifier.includes("#")) {
|
|
375
|
+
[, errorName] = errorIdentifier.split("#");
|
|
376
|
+
}
|
|
377
|
+
const errorMetadata = {
|
|
378
|
+
$metadata: metadata,
|
|
379
|
+
$fault: response.statusCode < 500 ? "client" : "server"
|
|
380
|
+
};
|
|
381
|
+
if (!this.errorRegistry) {
|
|
382
|
+
throw new Error("@aws-sdk/core/protocols - error handler not initialized.");
|
|
383
|
+
}
|
|
384
|
+
try {
|
|
385
|
+
const errorSchema = getErrorSchema?.(this.errorRegistry, errorName) ?? this.errorRegistry.getSchema(errorIdentifier);
|
|
386
|
+
return { errorSchema, errorMetadata };
|
|
387
|
+
} catch (e) {
|
|
388
|
+
dataObject.message = dataObject.message ?? dataObject.Message ?? "UnknownError";
|
|
389
|
+
const synthetic = this.errorRegistry;
|
|
390
|
+
const baseExceptionSchema = synthetic.getBaseException();
|
|
391
|
+
if (baseExceptionSchema) {
|
|
392
|
+
const ErrorCtor = synthetic.getErrorCtor(baseExceptionSchema) ?? Error;
|
|
393
|
+
throw this.decorateServiceException(Object.assign(new ErrorCtor({ name: errorName }), errorMetadata), dataObject);
|
|
394
|
+
}
|
|
395
|
+
const d = dataObject;
|
|
396
|
+
const message = d?.message ?? d?.Message ?? d?.Error?.Message ?? d?.Error?.message;
|
|
397
|
+
throw this.decorateServiceException(Object.assign(new Error(message), {
|
|
398
|
+
name: errorName
|
|
399
|
+
}, errorMetadata), dataObject);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
compose(composite, errorIdentifier, defaultNamespace) {
|
|
403
|
+
let namespace = defaultNamespace;
|
|
404
|
+
if (errorIdentifier.includes("#")) {
|
|
405
|
+
[namespace] = errorIdentifier.split("#");
|
|
406
|
+
}
|
|
407
|
+
const staticRegistry = TypeRegistry.for(namespace);
|
|
408
|
+
const defaultSyntheticRegistry = TypeRegistry.for("smithy.ts.sdk.synthetic." + defaultNamespace);
|
|
409
|
+
composite.copyFrom(staticRegistry);
|
|
410
|
+
composite.copyFrom(defaultSyntheticRegistry);
|
|
411
|
+
this.errorRegistry = composite;
|
|
412
|
+
}
|
|
413
|
+
decorateServiceException(exception, additions = {}) {
|
|
414
|
+
if (this.queryCompat) {
|
|
415
|
+
const msg = exception.Message ?? additions.Message;
|
|
416
|
+
const error = decorateServiceException(exception, additions);
|
|
417
|
+
if (msg) {
|
|
418
|
+
error.message = msg;
|
|
419
|
+
}
|
|
420
|
+
const errorObj = error.Error ?? {};
|
|
421
|
+
errorObj.Type = error.Error?.Type;
|
|
422
|
+
errorObj.Code = error.Error?.Code;
|
|
423
|
+
errorObj.Message = error.Error?.message ?? error.Error?.Message ?? msg;
|
|
424
|
+
error.Error = errorObj;
|
|
425
|
+
const reqId = error.$metadata.requestId;
|
|
426
|
+
if (reqId) {
|
|
427
|
+
error.RequestId = reqId;
|
|
428
|
+
}
|
|
429
|
+
return error;
|
|
430
|
+
}
|
|
431
|
+
return decorateServiceException(exception, additions);
|
|
432
|
+
}
|
|
433
|
+
setQueryCompatError(output, response) {
|
|
434
|
+
const queryErrorHeader = response.headers?.["x-amzn-query-error"];
|
|
435
|
+
if (output !== void 0 && queryErrorHeader != null) {
|
|
436
|
+
const [Code, Type] = queryErrorHeader.split(";");
|
|
437
|
+
const keys = Object.keys(output);
|
|
438
|
+
const Error2 = {
|
|
439
|
+
Code,
|
|
440
|
+
Type
|
|
441
|
+
};
|
|
442
|
+
output.Code = Code;
|
|
443
|
+
output.Type = Type;
|
|
444
|
+
for (let i = 0; i < keys.length; i++) {
|
|
445
|
+
const k = keys[i];
|
|
446
|
+
Error2[k === "message" ? "Message" : k] = output[k];
|
|
447
|
+
}
|
|
448
|
+
delete Error2.__type;
|
|
449
|
+
output.Error = Error2;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
queryCompatOutput(queryCompatErrorData, errorData) {
|
|
453
|
+
if (queryCompatErrorData.Error) {
|
|
454
|
+
errorData.Error = queryCompatErrorData.Error;
|
|
455
|
+
}
|
|
456
|
+
if (queryCompatErrorData.Type) {
|
|
457
|
+
errorData.Type = queryCompatErrorData.Type;
|
|
458
|
+
}
|
|
459
|
+
if (queryCompatErrorData.Code) {
|
|
460
|
+
errorData.Code = queryCompatErrorData.Code;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
findQueryCompatibleError(registry, errorName) {
|
|
464
|
+
try {
|
|
465
|
+
return registry.getSchema(errorName);
|
|
466
|
+
} catch (e) {
|
|
467
|
+
return registry.find((schema) => NormalizedSchema.of(schema).getMergedTraits().awsQueryError?.[0] === errorName);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
// ../../node_modules/.pnpm/@aws-sdk+core@3.975.3/node_modules/@aws-sdk/core/dist-es/submodules/protocols/ConfigurableSerdeContext.js
|
|
473
|
+
var SerdeContextConfig = class {
|
|
474
|
+
serdeContext;
|
|
475
|
+
setSerdeContext(serdeContext) {
|
|
476
|
+
this.serdeContext = serdeContext;
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
// ../../node_modules/.pnpm/@aws-sdk+core@3.975.3/node_modules/@aws-sdk/core/dist-es/submodules/protocols/UnionSerde.js
|
|
481
|
+
var UnionSerde = class {
|
|
482
|
+
from;
|
|
483
|
+
to;
|
|
484
|
+
keys;
|
|
485
|
+
constructor(from, to) {
|
|
486
|
+
this.from = from;
|
|
487
|
+
this.to = to;
|
|
488
|
+
const keys = Object.keys(this.from);
|
|
489
|
+
const set = new Set(keys);
|
|
490
|
+
set.delete("__type");
|
|
491
|
+
this.keys = set;
|
|
492
|
+
}
|
|
493
|
+
mark(key) {
|
|
494
|
+
this.keys.delete(key);
|
|
495
|
+
}
|
|
496
|
+
hasUnknown() {
|
|
497
|
+
return this.keys.size === 1 && Object.keys(this.to).length === 0;
|
|
498
|
+
}
|
|
499
|
+
writeUnknown() {
|
|
500
|
+
if (this.hasUnknown()) {
|
|
501
|
+
const k = this.keys.values().next().value;
|
|
502
|
+
const v = this.from[k];
|
|
503
|
+
this.to.$unknown = [k, v];
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
|
|
508
|
+
// ../../node_modules/.pnpm/@aws-sdk+core@3.975.3/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/jsonReviver.js
|
|
509
|
+
function jsonReviver(key, value, context) {
|
|
510
|
+
if (context?.source) {
|
|
511
|
+
const numericString = context.source;
|
|
512
|
+
if (typeof value === "number") {
|
|
513
|
+
if (value > Number.MAX_SAFE_INTEGER || value < Number.MIN_SAFE_INTEGER || numericString !== String(value)) {
|
|
514
|
+
const isFractional = numericString.includes(".");
|
|
515
|
+
if (isFractional) {
|
|
516
|
+
return new NumericValue(numericString, "bigDecimal");
|
|
517
|
+
} else {
|
|
518
|
+
return BigInt(numericString);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
return value;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
// ../../node_modules/.pnpm/@aws-sdk+core@3.975.3/node_modules/@aws-sdk/core/dist-es/submodules/protocols/common.js
|
|
527
|
+
var collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => (context?.utf8Encoder ?? toUtf8)(body));
|
|
528
|
+
|
|
529
|
+
// ../../node_modules/.pnpm/@aws-sdk+core@3.975.3/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/parseJsonBody.js
|
|
530
|
+
var parseJsonBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
|
|
531
|
+
if (encoded.length) {
|
|
532
|
+
try {
|
|
533
|
+
return JSON.parse(encoded);
|
|
534
|
+
} catch (e) {
|
|
535
|
+
if (e?.name === "SyntaxError") {
|
|
536
|
+
Object.defineProperty(e, "$responseBodyText", {
|
|
537
|
+
value: encoded
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
throw e;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
return {};
|
|
544
|
+
});
|
|
545
|
+
var findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
546
|
+
var sanitizeErrorCode = (rawValue) => {
|
|
547
|
+
let cleanValue = rawValue;
|
|
548
|
+
if (typeof cleanValue === "number") {
|
|
549
|
+
cleanValue = cleanValue.toString();
|
|
550
|
+
}
|
|
551
|
+
if (cleanValue.indexOf(",") >= 0) {
|
|
552
|
+
cleanValue = cleanValue.split(",")[0];
|
|
553
|
+
}
|
|
554
|
+
if (cleanValue.indexOf(":") >= 0) {
|
|
555
|
+
cleanValue = cleanValue.split(":")[0];
|
|
556
|
+
}
|
|
557
|
+
if (cleanValue.indexOf("#") >= 0) {
|
|
558
|
+
cleanValue = cleanValue.split("#")[1];
|
|
559
|
+
}
|
|
560
|
+
return cleanValue;
|
|
561
|
+
};
|
|
562
|
+
var loadRestJsonErrorCode = (output, data) => {
|
|
563
|
+
return loadErrorCode(output, data, ["header", "code", "type"]);
|
|
564
|
+
};
|
|
565
|
+
var loadErrorCode = ({ headers }, data, order) => {
|
|
566
|
+
while (order.length > 0) {
|
|
567
|
+
const location = order.shift();
|
|
568
|
+
switch (location) {
|
|
569
|
+
case "header":
|
|
570
|
+
const headerKey = findKey(headers ?? {}, "x-amzn-errortype");
|
|
571
|
+
if (headerKey !== void 0) {
|
|
572
|
+
return sanitizeErrorCode(headers[headerKey]);
|
|
573
|
+
}
|
|
574
|
+
break;
|
|
575
|
+
case "code":
|
|
576
|
+
const codeKey = findKey(data ?? {}, "code");
|
|
577
|
+
if (codeKey && data[codeKey] !== void 0) {
|
|
578
|
+
return sanitizeErrorCode(data[codeKey]);
|
|
579
|
+
}
|
|
580
|
+
break;
|
|
581
|
+
case "type":
|
|
582
|
+
if (data?.__type !== void 0) {
|
|
583
|
+
return sanitizeErrorCode(data.__type);
|
|
584
|
+
}
|
|
585
|
+
break;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
// ../../node_modules/.pnpm/@aws-sdk+core@3.975.3/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeDeserializer.js
|
|
591
|
+
var JsonShapeDeserializer = class extends SerdeContextConfig {
|
|
592
|
+
settings;
|
|
593
|
+
constructor(settings) {
|
|
594
|
+
super();
|
|
595
|
+
this.settings = settings;
|
|
596
|
+
}
|
|
597
|
+
async read(schema, data) {
|
|
598
|
+
return this._read(schema, typeof data === "string" ? JSON.parse(data, jsonReviver) : await parseJsonBody(data, this.serdeContext));
|
|
599
|
+
}
|
|
600
|
+
readObject(schema, data) {
|
|
601
|
+
return this._read(schema, data);
|
|
602
|
+
}
|
|
603
|
+
_read(schema, value) {
|
|
604
|
+
const isObject = value !== null && typeof value === "object";
|
|
605
|
+
const ns = NormalizedSchema.of(schema);
|
|
606
|
+
if (isObject) {
|
|
607
|
+
if (ns.isStructSchema()) {
|
|
608
|
+
const record = value;
|
|
609
|
+
const union = ns.isUnionSchema();
|
|
610
|
+
const out = {};
|
|
611
|
+
let nameMap = void 0;
|
|
612
|
+
const { jsonName } = this.settings;
|
|
613
|
+
if (jsonName) {
|
|
614
|
+
nameMap = {};
|
|
615
|
+
}
|
|
616
|
+
let unionSerde;
|
|
617
|
+
if (union) {
|
|
618
|
+
unionSerde = new UnionSerde(record, out);
|
|
619
|
+
}
|
|
620
|
+
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
621
|
+
let fromKey = memberName;
|
|
622
|
+
if (jsonName) {
|
|
623
|
+
fromKey = memberSchema.getMergedTraits().jsonName ?? fromKey;
|
|
624
|
+
nameMap[fromKey] = memberName;
|
|
625
|
+
}
|
|
626
|
+
if (union) {
|
|
627
|
+
unionSerde.mark(fromKey);
|
|
628
|
+
}
|
|
629
|
+
if (record[fromKey] != null) {
|
|
630
|
+
out[memberName] = this._read(memberSchema, record[fromKey]);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
if (union) {
|
|
634
|
+
unionSerde.writeUnknown();
|
|
635
|
+
} else if (typeof record.__type === "string") {
|
|
636
|
+
for (const k in record) {
|
|
637
|
+
const v = record[k];
|
|
638
|
+
const t = jsonName ? nameMap[k] ?? k : k;
|
|
639
|
+
if (!(t in out)) {
|
|
640
|
+
out[t] = v;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
return out;
|
|
645
|
+
}
|
|
646
|
+
if (Array.isArray(value) && ns.isListSchema()) {
|
|
647
|
+
const listMember = ns.getValueSchema();
|
|
648
|
+
const out = [];
|
|
649
|
+
for (const item of value) {
|
|
650
|
+
out.push(this._read(listMember, item));
|
|
651
|
+
}
|
|
652
|
+
return out;
|
|
653
|
+
}
|
|
654
|
+
if (ns.isMapSchema()) {
|
|
655
|
+
const mapMember = ns.getValueSchema();
|
|
656
|
+
const out = {};
|
|
657
|
+
for (const _k in value) {
|
|
658
|
+
out[_k] = this._read(mapMember, value[_k]);
|
|
659
|
+
}
|
|
660
|
+
return out;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
if (ns.isBlobSchema() && typeof value === "string") {
|
|
664
|
+
return fromBase64(value);
|
|
665
|
+
}
|
|
666
|
+
const mediaType = ns.getMergedTraits().mediaType;
|
|
667
|
+
if (ns.isStringSchema() && typeof value === "string" && mediaType) {
|
|
668
|
+
const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
|
|
669
|
+
if (isJson) {
|
|
670
|
+
return LazyJsonString.from(value);
|
|
671
|
+
}
|
|
672
|
+
return value;
|
|
673
|
+
}
|
|
674
|
+
if (ns.isTimestampSchema() && value != null) {
|
|
675
|
+
const format = determineTimestampFormat(ns, this.settings);
|
|
676
|
+
switch (format) {
|
|
677
|
+
case 5:
|
|
678
|
+
return parseRfc3339DateTimeWithOffset(value);
|
|
679
|
+
case 6:
|
|
680
|
+
return parseRfc7231DateTime(value);
|
|
681
|
+
case 7:
|
|
682
|
+
return parseEpochTimestamp(value);
|
|
683
|
+
default:
|
|
684
|
+
console.warn("Missing timestamp format, parsing value with Date constructor:", value);
|
|
685
|
+
return new Date(value);
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
if (ns.isBigIntegerSchema() && (typeof value === "number" || typeof value === "string")) {
|
|
689
|
+
return BigInt(value);
|
|
690
|
+
}
|
|
691
|
+
if (ns.isBigDecimalSchema() && value != void 0) {
|
|
692
|
+
if (value instanceof NumericValue) {
|
|
693
|
+
return value;
|
|
694
|
+
}
|
|
695
|
+
const untyped = value;
|
|
696
|
+
if (untyped.type === "bigDecimal" && "string" in untyped) {
|
|
697
|
+
return new NumericValue(untyped.string, untyped.type);
|
|
698
|
+
}
|
|
699
|
+
return new NumericValue(String(value), "bigDecimal");
|
|
700
|
+
}
|
|
701
|
+
if (ns.isNumericSchema() && typeof value === "string") {
|
|
702
|
+
switch (value) {
|
|
703
|
+
case "Infinity":
|
|
704
|
+
return Infinity;
|
|
705
|
+
case "-Infinity":
|
|
706
|
+
return -Infinity;
|
|
707
|
+
case "NaN":
|
|
708
|
+
return NaN;
|
|
709
|
+
}
|
|
710
|
+
return value;
|
|
711
|
+
}
|
|
712
|
+
if (ns.isDocumentSchema()) {
|
|
713
|
+
if (isObject) {
|
|
714
|
+
const out = Array.isArray(value) ? [] : {};
|
|
715
|
+
for (const k in value) {
|
|
716
|
+
const v = value[k];
|
|
717
|
+
if (v instanceof NumericValue) {
|
|
718
|
+
out[k] = v;
|
|
719
|
+
} else {
|
|
720
|
+
out[k] = this._read(ns, v);
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
return out;
|
|
724
|
+
} else {
|
|
725
|
+
return structuredClone(value);
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
return value;
|
|
729
|
+
}
|
|
730
|
+
};
|
|
731
|
+
|
|
732
|
+
// ../../node_modules/.pnpm/@aws-sdk+core@3.975.3/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/jsonReplacer.js
|
|
733
|
+
var NUMERIC_CONTROL_CHAR = String.fromCharCode(925);
|
|
734
|
+
var JsonReplacer = class {
|
|
735
|
+
values = /* @__PURE__ */ new Map();
|
|
736
|
+
counter = 0;
|
|
737
|
+
stage = 0;
|
|
738
|
+
createReplacer() {
|
|
739
|
+
if (this.stage === 1) {
|
|
740
|
+
throw new Error("@aws-sdk/core/protocols - JsonReplacer already created.");
|
|
741
|
+
}
|
|
742
|
+
if (this.stage === 2) {
|
|
743
|
+
throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");
|
|
744
|
+
}
|
|
745
|
+
this.stage = 1;
|
|
746
|
+
return (key, value) => {
|
|
747
|
+
if (value instanceof NumericValue) {
|
|
748
|
+
const v = `${NUMERIC_CONTROL_CHAR + "nv" + this.counter++}_` + value.string;
|
|
749
|
+
this.values.set(`"${v}"`, value.string);
|
|
750
|
+
return v;
|
|
751
|
+
}
|
|
752
|
+
if (typeof value === "bigint") {
|
|
753
|
+
const s = value.toString();
|
|
754
|
+
const v = `${NUMERIC_CONTROL_CHAR + "b" + this.counter++}_` + s;
|
|
755
|
+
this.values.set(`"${v}"`, s);
|
|
756
|
+
return v;
|
|
757
|
+
}
|
|
758
|
+
return value;
|
|
759
|
+
};
|
|
760
|
+
}
|
|
761
|
+
replaceInJson(json) {
|
|
762
|
+
if (this.stage === 0) {
|
|
763
|
+
throw new Error("@aws-sdk/core/protocols - JsonReplacer not created yet.");
|
|
764
|
+
}
|
|
765
|
+
if (this.stage === 2) {
|
|
766
|
+
throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");
|
|
767
|
+
}
|
|
768
|
+
this.stage = 2;
|
|
769
|
+
if (this.counter === 0) {
|
|
770
|
+
return json;
|
|
771
|
+
}
|
|
772
|
+
for (const [key, value] of this.values) {
|
|
773
|
+
json = json.replace(key, value);
|
|
774
|
+
}
|
|
775
|
+
return json;
|
|
776
|
+
}
|
|
777
|
+
};
|
|
778
|
+
|
|
779
|
+
// ../../node_modules/.pnpm/@aws-sdk+core@3.975.3/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeSerializer.js
|
|
780
|
+
var JsonShapeSerializer = class extends SerdeContextConfig {
|
|
781
|
+
settings;
|
|
782
|
+
buffer;
|
|
783
|
+
useReplacer = false;
|
|
784
|
+
rootSchema;
|
|
785
|
+
constructor(settings) {
|
|
786
|
+
super();
|
|
787
|
+
this.settings = settings;
|
|
788
|
+
}
|
|
789
|
+
write(schema, value) {
|
|
790
|
+
this.rootSchema = NormalizedSchema.of(schema);
|
|
791
|
+
this.buffer = this._write(this.rootSchema, value);
|
|
792
|
+
}
|
|
793
|
+
flush() {
|
|
794
|
+
const { rootSchema, useReplacer } = this;
|
|
795
|
+
this.rootSchema = void 0;
|
|
796
|
+
this.useReplacer = false;
|
|
797
|
+
if (rootSchema?.isStructSchema() || rootSchema?.isDocumentSchema()) {
|
|
798
|
+
if (!useReplacer) {
|
|
799
|
+
return JSON.stringify(this.buffer);
|
|
800
|
+
}
|
|
801
|
+
const replacer = new JsonReplacer();
|
|
802
|
+
return replacer.replaceInJson(JSON.stringify(this.buffer, replacer.createReplacer(), 0));
|
|
803
|
+
}
|
|
804
|
+
return this.buffer;
|
|
805
|
+
}
|
|
806
|
+
writeDiscriminatedDocument(schema, value) {
|
|
807
|
+
this.write(schema, value);
|
|
808
|
+
if (typeof this.buffer === "object") {
|
|
809
|
+
this.buffer.__type = NormalizedSchema.of(schema).getName(true);
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
_write(schema, value, container) {
|
|
813
|
+
const isObject = value !== null && typeof value === "object";
|
|
814
|
+
const ns = NormalizedSchema.of(schema);
|
|
815
|
+
if (isObject) {
|
|
816
|
+
if (ns.isStructSchema()) {
|
|
817
|
+
const record = value;
|
|
818
|
+
const out = {};
|
|
819
|
+
const { jsonName } = this.settings;
|
|
820
|
+
let nameMap = void 0;
|
|
821
|
+
if (jsonName) {
|
|
822
|
+
nameMap = {};
|
|
823
|
+
}
|
|
824
|
+
let outCount = 0;
|
|
825
|
+
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
826
|
+
const serializableValue = this._write(memberSchema, record[memberName], ns);
|
|
827
|
+
if (serializableValue !== void 0) {
|
|
828
|
+
let targetKey = memberName;
|
|
829
|
+
if (jsonName) {
|
|
830
|
+
targetKey = memberSchema.getMergedTraits().jsonName ?? memberName;
|
|
831
|
+
nameMap[memberName] = targetKey;
|
|
832
|
+
}
|
|
833
|
+
out[targetKey] = serializableValue;
|
|
834
|
+
outCount++;
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
if (ns.isUnionSchema() && outCount === 0) {
|
|
838
|
+
const { $unknown } = record;
|
|
839
|
+
if (Array.isArray($unknown)) {
|
|
840
|
+
const [k, v] = $unknown;
|
|
841
|
+
out[k] = this._write(15, v);
|
|
842
|
+
}
|
|
843
|
+
} else if (typeof record.__type === "string") {
|
|
844
|
+
for (const k in record) {
|
|
845
|
+
const v = record[k];
|
|
846
|
+
const targetKey = jsonName ? nameMap[k] ?? k : k;
|
|
847
|
+
if (!(targetKey in out)) {
|
|
848
|
+
out[targetKey] = this._write(15, v);
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
return out;
|
|
853
|
+
}
|
|
854
|
+
if (Array.isArray(value) && ns.isListSchema()) {
|
|
855
|
+
const listMember = ns.getValueSchema();
|
|
856
|
+
const out = [];
|
|
857
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
|
858
|
+
for (const item of value) {
|
|
859
|
+
if (sparse || item != null) {
|
|
860
|
+
out.push(this._write(listMember, item));
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
return out;
|
|
864
|
+
}
|
|
865
|
+
if (ns.isMapSchema()) {
|
|
866
|
+
const mapMember = ns.getValueSchema();
|
|
867
|
+
const out = {};
|
|
868
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
|
869
|
+
for (const _k in value) {
|
|
870
|
+
const _v = value[_k];
|
|
871
|
+
if (sparse || _v != null) {
|
|
872
|
+
out[_k] = this._write(mapMember, _v);
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
return out;
|
|
876
|
+
}
|
|
877
|
+
if (value instanceof Uint8Array && (ns.isBlobSchema() || ns.isDocumentSchema())) {
|
|
878
|
+
if (ns === this.rootSchema) {
|
|
879
|
+
return value;
|
|
880
|
+
}
|
|
881
|
+
return (this.serdeContext?.base64Encoder ?? toBase64)(value);
|
|
882
|
+
}
|
|
883
|
+
if (value instanceof Date && (ns.isTimestampSchema() || ns.isDocumentSchema())) {
|
|
884
|
+
const format = determineTimestampFormat(ns, this.settings);
|
|
885
|
+
switch (format) {
|
|
886
|
+
case 5:
|
|
887
|
+
return value.toISOString().replace(".000Z", "Z");
|
|
888
|
+
case 6:
|
|
889
|
+
return dateToUtcString(value);
|
|
890
|
+
case 7:
|
|
891
|
+
return value.getTime() / 1e3;
|
|
892
|
+
default:
|
|
893
|
+
console.warn("Missing timestamp format, using epoch seconds", value);
|
|
894
|
+
return value.getTime() / 1e3;
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
if (value instanceof NumericValue) {
|
|
898
|
+
this.useReplacer = true;
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
if (value === null && container?.isStructSchema()) {
|
|
902
|
+
return void 0;
|
|
903
|
+
}
|
|
904
|
+
if (ns.isStringSchema()) {
|
|
905
|
+
if (typeof value === "undefined" && ns.isIdempotencyToken()) {
|
|
906
|
+
return generateIdempotencyToken();
|
|
907
|
+
}
|
|
908
|
+
const mediaType = ns.getMergedTraits().mediaType;
|
|
909
|
+
if (value != null && mediaType) {
|
|
910
|
+
const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
|
|
911
|
+
if (isJson) {
|
|
912
|
+
return LazyJsonString.from(value);
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
return value;
|
|
916
|
+
}
|
|
917
|
+
if (typeof value === "number" && ns.isNumericSchema()) {
|
|
918
|
+
if (Math.abs(value) === Infinity || isNaN(value)) {
|
|
919
|
+
return String(value);
|
|
920
|
+
}
|
|
921
|
+
return value;
|
|
922
|
+
}
|
|
923
|
+
if (typeof value === "string" && ns.isBlobSchema()) {
|
|
924
|
+
if (ns === this.rootSchema) {
|
|
925
|
+
return value;
|
|
926
|
+
}
|
|
927
|
+
return (this.serdeContext?.base64Encoder ?? toBase64)(value);
|
|
928
|
+
}
|
|
929
|
+
if (typeof value === "bigint") {
|
|
930
|
+
this.useReplacer = true;
|
|
931
|
+
}
|
|
932
|
+
if (ns.isDocumentSchema()) {
|
|
933
|
+
if (isObject) {
|
|
934
|
+
const out = Array.isArray(value) ? [] : {};
|
|
935
|
+
for (const k in value) {
|
|
936
|
+
const v = value[k];
|
|
937
|
+
if (v instanceof NumericValue) {
|
|
938
|
+
this.useReplacer = true;
|
|
939
|
+
out[k] = v;
|
|
940
|
+
} else {
|
|
941
|
+
out[k] = this._write(ns, v);
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
return out;
|
|
945
|
+
} else {
|
|
946
|
+
return structuredClone(value);
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
return value;
|
|
950
|
+
}
|
|
951
|
+
};
|
|
952
|
+
|
|
953
|
+
// ../../node_modules/.pnpm/@aws-sdk+core@3.975.3/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonCodec.js
|
|
954
|
+
var JsonCodec = class extends SerdeContextConfig {
|
|
955
|
+
settings;
|
|
956
|
+
constructor(settings) {
|
|
957
|
+
super();
|
|
958
|
+
this.settings = settings;
|
|
959
|
+
}
|
|
960
|
+
createSerializer() {
|
|
961
|
+
const serializer = new JsonShapeSerializer(this.settings);
|
|
962
|
+
serializer.setSerdeContext(this.serdeContext);
|
|
963
|
+
return serializer;
|
|
964
|
+
}
|
|
965
|
+
createDeserializer() {
|
|
966
|
+
const deserializer = new JsonShapeDeserializer(this.settings);
|
|
967
|
+
deserializer.setSerdeContext(this.serdeContext);
|
|
968
|
+
return deserializer;
|
|
969
|
+
}
|
|
970
|
+
};
|
|
971
|
+
|
|
972
|
+
// ../../node_modules/.pnpm/@aws-sdk+core@3.975.3/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsRestJsonProtocol.js
|
|
973
|
+
var AwsRestJsonProtocol = class extends HttpBindingProtocol {
|
|
974
|
+
serializer;
|
|
975
|
+
deserializer;
|
|
976
|
+
codec;
|
|
977
|
+
mixin = new ProtocolLib();
|
|
978
|
+
constructor({ defaultNamespace, errorTypeRegistries }) {
|
|
979
|
+
super({
|
|
980
|
+
defaultNamespace,
|
|
981
|
+
errorTypeRegistries
|
|
982
|
+
});
|
|
983
|
+
const settings = {
|
|
984
|
+
timestampFormat: {
|
|
985
|
+
useTrait: true,
|
|
986
|
+
default: 7
|
|
987
|
+
},
|
|
988
|
+
httpBindings: true,
|
|
989
|
+
jsonName: true
|
|
990
|
+
};
|
|
991
|
+
this.codec = new JsonCodec(settings);
|
|
992
|
+
this.serializer = new HttpInterceptingShapeSerializer(this.codec.createSerializer(), settings);
|
|
993
|
+
this.deserializer = new HttpInterceptingShapeDeserializer(this.codec.createDeserializer(), settings);
|
|
994
|
+
}
|
|
995
|
+
getShapeId() {
|
|
996
|
+
return "aws.protocols#restJson1";
|
|
997
|
+
}
|
|
998
|
+
getPayloadCodec() {
|
|
999
|
+
return this.codec;
|
|
1000
|
+
}
|
|
1001
|
+
setSerdeContext(serdeContext) {
|
|
1002
|
+
this.codec.setSerdeContext(serdeContext);
|
|
1003
|
+
super.setSerdeContext(serdeContext);
|
|
1004
|
+
}
|
|
1005
|
+
async serializeRequest(operationSchema, input, context) {
|
|
1006
|
+
const request = await super.serializeRequest(operationSchema, input, context);
|
|
1007
|
+
const inputSchema = NormalizedSchema.of(operationSchema.input);
|
|
1008
|
+
if (!request.headers["content-type"]) {
|
|
1009
|
+
const contentType = this.mixin.resolveRestContentType(this.getDefaultContentType(), inputSchema);
|
|
1010
|
+
if (contentType) {
|
|
1011
|
+
request.headers["content-type"] = contentType;
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
if (request.body == null && request.headers["content-type"] === this.getDefaultContentType()) {
|
|
1015
|
+
request.body = "{}";
|
|
1016
|
+
}
|
|
1017
|
+
return request;
|
|
1018
|
+
}
|
|
1019
|
+
async deserializeResponse(operationSchema, context, response) {
|
|
1020
|
+
const output = await super.deserializeResponse(operationSchema, context, response);
|
|
1021
|
+
const outputSchema = NormalizedSchema.of(operationSchema.output);
|
|
1022
|
+
for (const [name, member] of outputSchema.structIterator()) {
|
|
1023
|
+
if (member.getMemberTraits().httpPayload && !(name in output)) {
|
|
1024
|
+
output[name] = null;
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
return output;
|
|
1028
|
+
}
|
|
1029
|
+
async handleError(operationSchema, context, response, dataObject, metadata) {
|
|
1030
|
+
const errorIdentifier = loadRestJsonErrorCode(response, dataObject) ?? "Unknown";
|
|
1031
|
+
this.mixin.compose(this.compositeErrorRegistry, errorIdentifier, this.options.defaultNamespace);
|
|
1032
|
+
const { errorSchema, errorMetadata } = await this.mixin.getErrorSchemaOrThrowBaseException(errorIdentifier, this.options.defaultNamespace, response, dataObject, metadata);
|
|
1033
|
+
const ns = NormalizedSchema.of(errorSchema);
|
|
1034
|
+
const message = dataObject.message ?? dataObject.Message ?? "UnknownError";
|
|
1035
|
+
const ErrorCtor = this.compositeErrorRegistry.getErrorCtor(errorSchema) ?? Error;
|
|
1036
|
+
const exception = new ErrorCtor({});
|
|
1037
|
+
await this.deserializeHttpMessage(errorSchema, context, response, dataObject);
|
|
1038
|
+
const output = {};
|
|
1039
|
+
const errorDeserializer = this.codec.createDeserializer();
|
|
1040
|
+
for (const [name, member] of ns.structIterator()) {
|
|
1041
|
+
const target = member.getMergedTraits().jsonName ?? name;
|
|
1042
|
+
output[name] = errorDeserializer.readObject(member, dataObject[target]);
|
|
1043
|
+
}
|
|
1044
|
+
throw this.mixin.decorateServiceException(Object.assign(exception, errorMetadata, {
|
|
1045
|
+
$fault: ns.getMergedTraits().error,
|
|
1046
|
+
message
|
|
1047
|
+
}, output), dataObject);
|
|
1048
|
+
}
|
|
1049
|
+
getDefaultContentType() {
|
|
1050
|
+
return "application/json";
|
|
1051
|
+
}
|
|
1052
|
+
};
|
|
1053
|
+
|
|
1054
|
+
// ../../node_modules/.pnpm/@aws-sdk+xml-builder@3.972.36/node_modules/@aws-sdk/xml-builder/dist-es/xml-parser.js
|
|
1055
|
+
function parseXML(xml) {
|
|
1056
|
+
const state = new AwsXmlParser(xml);
|
|
1057
|
+
return state.parse();
|
|
1058
|
+
}
|
|
1059
|
+
var AwsXmlParser = class _AwsXmlParser {
|
|
1060
|
+
x;
|
|
1061
|
+
i = 0;
|
|
1062
|
+
z;
|
|
1063
|
+
constructor(x) {
|
|
1064
|
+
this.x = x;
|
|
1065
|
+
this.x = x.replace(/\r\n?/g, "\n");
|
|
1066
|
+
this.z = this.x.length;
|
|
1067
|
+
}
|
|
1068
|
+
parse() {
|
|
1069
|
+
const p = this;
|
|
1070
|
+
const { z } = p;
|
|
1071
|
+
while (p.i < z) {
|
|
1072
|
+
p.trim();
|
|
1073
|
+
if (p.i >= z) {
|
|
1074
|
+
break;
|
|
1075
|
+
}
|
|
1076
|
+
if (p.isNext("<?")) {
|
|
1077
|
+
p.readTo("?>");
|
|
1078
|
+
p.trim();
|
|
1079
|
+
} else if (p.isNext("<!--")) {
|
|
1080
|
+
p.readTo("-->");
|
|
1081
|
+
p.trim();
|
|
1082
|
+
} else if (p.isNext("<!DOCTYPE", false)) {
|
|
1083
|
+
p.skipDoctype();
|
|
1084
|
+
p.trim();
|
|
1085
|
+
} else if (p.x[p.i] === "<") {
|
|
1086
|
+
const root = p.parseTag();
|
|
1087
|
+
return { [root.tag]: root.value };
|
|
1088
|
+
} else {
|
|
1089
|
+
throw new Error("@aws-sdk XML parse error: unexpected content.");
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
throw new Error("@aws-sdk XML parse error: no root element.");
|
|
1093
|
+
}
|
|
1094
|
+
isNext(s, caseSensitive = true) {
|
|
1095
|
+
const p = this;
|
|
1096
|
+
if (caseSensitive) {
|
|
1097
|
+
return p.x.startsWith(s, p.i);
|
|
1098
|
+
}
|
|
1099
|
+
return p.x.toLowerCase().startsWith(s.toLowerCase(), p.i);
|
|
1100
|
+
}
|
|
1101
|
+
readTo(stop) {
|
|
1102
|
+
const p = this;
|
|
1103
|
+
const _i = p.x.indexOf(stop, p.i);
|
|
1104
|
+
if (_i === -1) {
|
|
1105
|
+
throw new Error(`@aws-sdk XML parse error: expected "${stop}" not found.`);
|
|
1106
|
+
}
|
|
1107
|
+
const result = p.x.slice(p.i, _i);
|
|
1108
|
+
p.i = _i + stop.length;
|
|
1109
|
+
return result;
|
|
1110
|
+
}
|
|
1111
|
+
trim() {
|
|
1112
|
+
const p = this;
|
|
1113
|
+
while (p.i < p.z && " \r\n".includes(p.x[p.i])) {
|
|
1114
|
+
++p.i;
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
readAttrValue() {
|
|
1118
|
+
const p = this;
|
|
1119
|
+
const quote = p.x[p.i];
|
|
1120
|
+
++p.i;
|
|
1121
|
+
let value = "";
|
|
1122
|
+
while (p.i < p.z && p.x[p.i] !== quote) {
|
|
1123
|
+
value += p.x[p.i++];
|
|
1124
|
+
}
|
|
1125
|
+
++p.i;
|
|
1126
|
+
return p.decodeEntities(value);
|
|
1127
|
+
}
|
|
1128
|
+
parseTag() {
|
|
1129
|
+
const p = this;
|
|
1130
|
+
++p.i;
|
|
1131
|
+
let tag = "";
|
|
1132
|
+
while (p.i < p.z && !" \r\n>/".includes(p.x[p.i])) {
|
|
1133
|
+
tag += p.x[p.i++];
|
|
1134
|
+
}
|
|
1135
|
+
let hasAttrs = false;
|
|
1136
|
+
const attrs = /* @__PURE__ */ Object.create(null);
|
|
1137
|
+
while (p.i < p.z) {
|
|
1138
|
+
p.trim();
|
|
1139
|
+
if (">/".includes(p.x[p.i])) {
|
|
1140
|
+
break;
|
|
1141
|
+
}
|
|
1142
|
+
let name = "";
|
|
1143
|
+
while (p.i < p.z && !"= \r\n>/?".includes(p.x[p.i])) {
|
|
1144
|
+
name += p.x[p.i++];
|
|
1145
|
+
}
|
|
1146
|
+
p.trim();
|
|
1147
|
+
if (p.x[p.i] !== "=") {
|
|
1148
|
+
break;
|
|
1149
|
+
}
|
|
1150
|
+
++p.i;
|
|
1151
|
+
p.trim();
|
|
1152
|
+
attrs[name] = p.readAttrValue();
|
|
1153
|
+
hasAttrs = true;
|
|
1154
|
+
}
|
|
1155
|
+
if (p.i >= p.z) {
|
|
1156
|
+
throw new Error("@aws-sdk XML parse error: unexpected end of input.");
|
|
1157
|
+
}
|
|
1158
|
+
if (p.x[p.i] === "/") {
|
|
1159
|
+
++p.i;
|
|
1160
|
+
if (p.i >= p.z || p.x[p.i] !== ">") {
|
|
1161
|
+
throw new Error("@aws-sdk XML parse error: expected > at the end of self-closing tag.");
|
|
1162
|
+
}
|
|
1163
|
+
++p.i;
|
|
1164
|
+
Object.setPrototypeOf(attrs, Object.prototype);
|
|
1165
|
+
return { tag, value: hasAttrs ? attrs : "" };
|
|
1166
|
+
}
|
|
1167
|
+
if (p.x[p.i] !== ">") {
|
|
1168
|
+
throw new Error("@aws-sdk XML parse error: expected > at the end of opening tag.");
|
|
1169
|
+
}
|
|
1170
|
+
++p.i;
|
|
1171
|
+
const textParts = [];
|
|
1172
|
+
const childTags = [];
|
|
1173
|
+
let hasElementChild = false;
|
|
1174
|
+
while (p.i < p.z) {
|
|
1175
|
+
if (p.isNext("</")) {
|
|
1176
|
+
break;
|
|
1177
|
+
}
|
|
1178
|
+
if (p.x[p.i] === "<") {
|
|
1179
|
+
if (p.isNext("<!--")) {
|
|
1180
|
+
p.readTo("-->");
|
|
1181
|
+
} else if (p.isNext("<![CDATA[")) {
|
|
1182
|
+
p.i += 9;
|
|
1183
|
+
textParts.push(p.readTo("]]>"));
|
|
1184
|
+
} else if (p.isNext("<?")) {
|
|
1185
|
+
p.readTo("?>");
|
|
1186
|
+
} else {
|
|
1187
|
+
hasElementChild = true;
|
|
1188
|
+
childTags.push(p.parseTag());
|
|
1189
|
+
}
|
|
1190
|
+
} else {
|
|
1191
|
+
let text = "";
|
|
1192
|
+
while (p.i < p.z && p.x[p.i] !== "<") {
|
|
1193
|
+
text += p.x[p.i++];
|
|
1194
|
+
}
|
|
1195
|
+
textParts.push(p.decodeEntities(text));
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
if (!p.isNext("</")) {
|
|
1199
|
+
throw new Error(`@aws-sdk XML parse error: missing closing tag </${tag}>.`);
|
|
1200
|
+
}
|
|
1201
|
+
p.i += 2;
|
|
1202
|
+
const closeTag = p.readTo(">").trim();
|
|
1203
|
+
if (closeTag !== tag) {
|
|
1204
|
+
throw new Error(`@aws-sdk XML parse error: mismatched tags <${tag}> and </${closeTag}>.`);
|
|
1205
|
+
}
|
|
1206
|
+
if (!hasAttrs && textParts.length === 0 && !hasElementChild) {
|
|
1207
|
+
return { tag, value: "" };
|
|
1208
|
+
}
|
|
1209
|
+
if (!hasAttrs && !hasElementChild) {
|
|
1210
|
+
const text = textParts.length === 1 ? textParts[0] : textParts.join("");
|
|
1211
|
+
if (text.trim() === "" && text.includes("\n")) {
|
|
1212
|
+
return { tag, value: "" };
|
|
1213
|
+
}
|
|
1214
|
+
return { tag, value: text };
|
|
1215
|
+
}
|
|
1216
|
+
const obj = /* @__PURE__ */ Object.create(null);
|
|
1217
|
+
for (const text of textParts) {
|
|
1218
|
+
if (text.trim() === "" && text.includes("\n")) {
|
|
1219
|
+
continue;
|
|
1220
|
+
}
|
|
1221
|
+
obj["#text"] = "#text" in obj ? obj["#text"] + text : text;
|
|
1222
|
+
}
|
|
1223
|
+
for (const child of childTags) {
|
|
1224
|
+
if (child.tag in obj) {
|
|
1225
|
+
if (Array.isArray(obj[child.tag])) {
|
|
1226
|
+
obj[child.tag].push(child.value);
|
|
1227
|
+
} else {
|
|
1228
|
+
obj[child.tag] = [obj[child.tag], child.value];
|
|
1229
|
+
}
|
|
1230
|
+
} else {
|
|
1231
|
+
obj[child.tag] = child.value;
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
for (const [k, v] of Object.entries(attrs)) {
|
|
1235
|
+
obj[k] = v;
|
|
1236
|
+
}
|
|
1237
|
+
Object.setPrototypeOf(obj, Object.prototype);
|
|
1238
|
+
return { tag, value: obj };
|
|
1239
|
+
}
|
|
1240
|
+
static ENTITIES = {
|
|
1241
|
+
amp: "&",
|
|
1242
|
+
lt: "<",
|
|
1243
|
+
gt: ">",
|
|
1244
|
+
quot: '"',
|
|
1245
|
+
apos: "'"
|
|
1246
|
+
};
|
|
1247
|
+
skipDoctype() {
|
|
1248
|
+
const p = this;
|
|
1249
|
+
p.i += 9;
|
|
1250
|
+
let depth = 0;
|
|
1251
|
+
while (p.i < p.z) {
|
|
1252
|
+
const c = p.x[p.i];
|
|
1253
|
+
if (c === "[") {
|
|
1254
|
+
++depth;
|
|
1255
|
+
} else if (c === "]") {
|
|
1256
|
+
--depth;
|
|
1257
|
+
} else if (c === ">" && depth === 0) {
|
|
1258
|
+
++p.i;
|
|
1259
|
+
return;
|
|
1260
|
+
}
|
|
1261
|
+
++p.i;
|
|
1262
|
+
}
|
|
1263
|
+
throw new Error("@aws-sdk XML parse error: unclosed DOCTYPE.");
|
|
1264
|
+
}
|
|
1265
|
+
decodeEntities(s) {
|
|
1266
|
+
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) => {
|
|
1267
|
+
if (hex) {
|
|
1268
|
+
return String.fromCharCode(parseInt(hex, 16));
|
|
1269
|
+
}
|
|
1270
|
+
if (dec) {
|
|
1271
|
+
return String.fromCharCode(parseInt(dec, 10));
|
|
1272
|
+
}
|
|
1273
|
+
return _AwsXmlParser.ENTITIES[named] ?? "";
|
|
1274
|
+
});
|
|
1275
|
+
}
|
|
1276
|
+
};
|
|
1277
|
+
|
|
1278
|
+
// ../../node_modules/.pnpm/@aws-sdk+core@3.975.3/node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/XmlShapeDeserializer.js
|
|
1279
|
+
var XmlShapeDeserializer = class extends SerdeContextConfig {
|
|
1280
|
+
settings;
|
|
1281
|
+
stringDeserializer;
|
|
1282
|
+
constructor(settings) {
|
|
1283
|
+
super();
|
|
1284
|
+
this.settings = settings;
|
|
1285
|
+
this.stringDeserializer = new FromStringShapeDeserializer(settings);
|
|
1286
|
+
}
|
|
1287
|
+
setSerdeContext(serdeContext) {
|
|
1288
|
+
this.serdeContext = serdeContext;
|
|
1289
|
+
this.stringDeserializer.setSerdeContext(serdeContext);
|
|
1290
|
+
}
|
|
1291
|
+
read(schema, bytes, key) {
|
|
1292
|
+
const ns = NormalizedSchema.of(schema);
|
|
1293
|
+
const memberSchemas = ns.getMemberSchemas();
|
|
1294
|
+
const isEventPayload = ns.isStructSchema() && ns.isMemberSchema() && !!Object.values(memberSchemas).find((memberNs) => {
|
|
1295
|
+
return !!memberNs.getMemberTraits().eventPayload;
|
|
1296
|
+
});
|
|
1297
|
+
if (isEventPayload) {
|
|
1298
|
+
const output = {};
|
|
1299
|
+
const memberName = Object.keys(memberSchemas)[0];
|
|
1300
|
+
const eventMemberSchema = memberSchemas[memberName];
|
|
1301
|
+
if (eventMemberSchema.isBlobSchema()) {
|
|
1302
|
+
output[memberName] = bytes;
|
|
1303
|
+
} else {
|
|
1304
|
+
output[memberName] = this.read(memberSchemas[memberName], bytes);
|
|
1305
|
+
}
|
|
1306
|
+
return output;
|
|
1307
|
+
}
|
|
1308
|
+
const xmlString = (this.serdeContext?.utf8Encoder ?? toUtf8)(bytes);
|
|
1309
|
+
const parsedObject = this.parseXml(xmlString);
|
|
1310
|
+
return this.readSchema(schema, key ? parsedObject[key] : parsedObject);
|
|
1311
|
+
}
|
|
1312
|
+
readSchema(_schema, value) {
|
|
1313
|
+
const ns = NormalizedSchema.of(_schema);
|
|
1314
|
+
if (ns.isUnitSchema()) {
|
|
1315
|
+
return;
|
|
1316
|
+
}
|
|
1317
|
+
const traits = ns.getMergedTraits();
|
|
1318
|
+
if (ns.isListSchema() && !Array.isArray(value)) {
|
|
1319
|
+
return this.readSchema(ns, [value]);
|
|
1320
|
+
}
|
|
1321
|
+
if (value == null) {
|
|
1322
|
+
return value;
|
|
1323
|
+
}
|
|
1324
|
+
if (typeof value === "object") {
|
|
1325
|
+
const flat = !!traits.xmlFlattened;
|
|
1326
|
+
if (ns.isListSchema()) {
|
|
1327
|
+
const listValue = ns.getValueSchema();
|
|
1328
|
+
const buffer2 = [];
|
|
1329
|
+
const sourceKey = listValue.getMergedTraits().xmlName ?? "member";
|
|
1330
|
+
const source = flat ? value : (value[0] ?? value)[sourceKey];
|
|
1331
|
+
if (source == null) {
|
|
1332
|
+
return buffer2;
|
|
1333
|
+
}
|
|
1334
|
+
const sourceArray = Array.isArray(source) ? source : [source];
|
|
1335
|
+
for (const v of sourceArray) {
|
|
1336
|
+
buffer2.push(this.readSchema(listValue, v));
|
|
1337
|
+
}
|
|
1338
|
+
return buffer2;
|
|
1339
|
+
}
|
|
1340
|
+
const buffer = {};
|
|
1341
|
+
if (ns.isMapSchema()) {
|
|
1342
|
+
const keyNs = ns.getKeySchema();
|
|
1343
|
+
const memberNs = ns.getValueSchema();
|
|
1344
|
+
let entries;
|
|
1345
|
+
if (flat) {
|
|
1346
|
+
entries = Array.isArray(value) ? value : [value];
|
|
1347
|
+
} else {
|
|
1348
|
+
entries = Array.isArray(value.entry) ? value.entry : [value.entry];
|
|
1349
|
+
}
|
|
1350
|
+
const keyProperty = keyNs.getMergedTraits().xmlName ?? "key";
|
|
1351
|
+
const valueProperty = memberNs.getMergedTraits().xmlName ?? "value";
|
|
1352
|
+
for (const entry of entries) {
|
|
1353
|
+
const key = entry[keyProperty];
|
|
1354
|
+
const value2 = entry[valueProperty];
|
|
1355
|
+
buffer[key] = this.readSchema(memberNs, value2);
|
|
1356
|
+
}
|
|
1357
|
+
return buffer;
|
|
1358
|
+
}
|
|
1359
|
+
if (ns.isStructSchema()) {
|
|
1360
|
+
const union = ns.isUnionSchema();
|
|
1361
|
+
let unionSerde;
|
|
1362
|
+
if (union) {
|
|
1363
|
+
unionSerde = new UnionSerde(value, buffer);
|
|
1364
|
+
}
|
|
1365
|
+
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
1366
|
+
const memberTraits = memberSchema.getMergedTraits();
|
|
1367
|
+
const xmlObjectKey = !memberTraits.httpPayload ? memberSchema.getMemberTraits().xmlName ?? memberName : memberTraits.xmlName ?? memberSchema.getName();
|
|
1368
|
+
if (union) {
|
|
1369
|
+
unionSerde.mark(xmlObjectKey);
|
|
1370
|
+
}
|
|
1371
|
+
if (value[xmlObjectKey] != null) {
|
|
1372
|
+
buffer[memberName] = this.readSchema(memberSchema, value[xmlObjectKey]);
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
if (union) {
|
|
1376
|
+
unionSerde.writeUnknown();
|
|
1377
|
+
}
|
|
1378
|
+
return buffer;
|
|
1379
|
+
}
|
|
1380
|
+
if (ns.isDocumentSchema()) {
|
|
1381
|
+
return value;
|
|
1382
|
+
}
|
|
1383
|
+
throw new Error(`@aws-sdk/core/protocols - xml deserializer unhandled schema type for ${ns.getName(true)}`);
|
|
1384
|
+
}
|
|
1385
|
+
if (ns.isListSchema()) {
|
|
1386
|
+
return [];
|
|
1387
|
+
}
|
|
1388
|
+
if (ns.isMapSchema() || ns.isStructSchema()) {
|
|
1389
|
+
return {};
|
|
1390
|
+
}
|
|
1391
|
+
return this.stringDeserializer.read(ns, value);
|
|
1392
|
+
}
|
|
1393
|
+
parseXml(xml) {
|
|
1394
|
+
if (xml.length) {
|
|
1395
|
+
let parsedObj;
|
|
1396
|
+
try {
|
|
1397
|
+
parsedObj = parseXML(xml);
|
|
1398
|
+
} catch (e) {
|
|
1399
|
+
if (e && typeof e === "object") {
|
|
1400
|
+
Object.defineProperty(e, "$responseBodyText", {
|
|
1401
|
+
value: xml
|
|
1402
|
+
});
|
|
1403
|
+
}
|
|
1404
|
+
throw e;
|
|
1405
|
+
}
|
|
1406
|
+
const textNodeName = "#text";
|
|
1407
|
+
const key = Object.keys(parsedObj)[0];
|
|
1408
|
+
const parsedObjToReturn = parsedObj[key];
|
|
1409
|
+
if (parsedObjToReturn[textNodeName]) {
|
|
1410
|
+
parsedObjToReturn[key] = parsedObjToReturn[textNodeName];
|
|
1411
|
+
delete parsedObjToReturn[textNodeName];
|
|
1412
|
+
}
|
|
1413
|
+
return getValueFromTextNode(parsedObjToReturn);
|
|
1414
|
+
}
|
|
1415
|
+
return {};
|
|
1416
|
+
}
|
|
1417
|
+
};
|
|
1418
|
+
|
|
1419
|
+
// ../../node_modules/.pnpm/@aws-sdk+core@3.975.3/node_modules/@aws-sdk/core/dist-es/submodules/protocols/query/QueryShapeSerializer.js
|
|
1420
|
+
var QueryShapeSerializer = class extends SerdeContextConfig {
|
|
1421
|
+
settings;
|
|
1422
|
+
buffer;
|
|
1423
|
+
constructor(settings) {
|
|
1424
|
+
super();
|
|
1425
|
+
this.settings = settings;
|
|
1426
|
+
}
|
|
1427
|
+
write(schema, value, prefix = "") {
|
|
1428
|
+
if (this.buffer === void 0) {
|
|
1429
|
+
this.buffer = "";
|
|
1430
|
+
}
|
|
1431
|
+
const ns = NormalizedSchema.of(schema);
|
|
1432
|
+
if (prefix && !prefix.endsWith(".")) {
|
|
1433
|
+
prefix += ".";
|
|
1434
|
+
}
|
|
1435
|
+
if (ns.isBlobSchema()) {
|
|
1436
|
+
if (typeof value === "string" || value instanceof Uint8Array) {
|
|
1437
|
+
this.writeKey(prefix);
|
|
1438
|
+
this.writeValue((this.serdeContext?.base64Encoder ?? toBase64)(value));
|
|
1439
|
+
}
|
|
1440
|
+
} else if (ns.isBooleanSchema() || ns.isNumericSchema() || ns.isStringSchema()) {
|
|
1441
|
+
if (value != null) {
|
|
1442
|
+
this.writeKey(prefix);
|
|
1443
|
+
this.writeValue(String(value));
|
|
1444
|
+
} else if (ns.isIdempotencyToken()) {
|
|
1445
|
+
this.writeKey(prefix);
|
|
1446
|
+
this.writeValue(generateIdempotencyToken());
|
|
1447
|
+
}
|
|
1448
|
+
} else if (ns.isBigIntegerSchema()) {
|
|
1449
|
+
if (value != null) {
|
|
1450
|
+
this.writeKey(prefix);
|
|
1451
|
+
this.writeValue(String(value));
|
|
1452
|
+
}
|
|
1453
|
+
} else if (ns.isBigDecimalSchema()) {
|
|
1454
|
+
if (value != null) {
|
|
1455
|
+
this.writeKey(prefix);
|
|
1456
|
+
this.writeValue(value instanceof NumericValue ? value.string : String(value));
|
|
1457
|
+
}
|
|
1458
|
+
} else if (ns.isTimestampSchema()) {
|
|
1459
|
+
if (value instanceof Date) {
|
|
1460
|
+
this.writeKey(prefix);
|
|
1461
|
+
const format = determineTimestampFormat(ns, this.settings);
|
|
1462
|
+
switch (format) {
|
|
1463
|
+
case 5:
|
|
1464
|
+
this.writeValue(value.toISOString().replace(".000Z", "Z"));
|
|
1465
|
+
break;
|
|
1466
|
+
case 6:
|
|
1467
|
+
this.writeValue(dateToUtcString(value));
|
|
1468
|
+
break;
|
|
1469
|
+
case 7:
|
|
1470
|
+
this.writeValue(String(value.getTime() / 1e3));
|
|
1471
|
+
break;
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
} else if (ns.isDocumentSchema()) {
|
|
1475
|
+
if (Array.isArray(value)) {
|
|
1476
|
+
this.write(64 | 15, value, prefix);
|
|
1477
|
+
} else if (value instanceof Date) {
|
|
1478
|
+
this.write(4, value, prefix);
|
|
1479
|
+
} else if (value instanceof Uint8Array) {
|
|
1480
|
+
this.write(21, value, prefix);
|
|
1481
|
+
} else if (value && typeof value === "object") {
|
|
1482
|
+
this.write(128 | 15, value, prefix);
|
|
1483
|
+
} else {
|
|
1484
|
+
this.writeKey(prefix);
|
|
1485
|
+
this.writeValue(String(value));
|
|
1486
|
+
}
|
|
1487
|
+
} else if (ns.isListSchema()) {
|
|
1488
|
+
if (Array.isArray(value)) {
|
|
1489
|
+
if (value.length === 0) {
|
|
1490
|
+
if (this.settings.serializeEmptyLists) {
|
|
1491
|
+
this.writeKey(prefix);
|
|
1492
|
+
this.writeValue("");
|
|
1493
|
+
}
|
|
1494
|
+
} else {
|
|
1495
|
+
const member = ns.getValueSchema();
|
|
1496
|
+
const flat = this.settings.flattenLists || ns.getMergedTraits().xmlFlattened;
|
|
1497
|
+
let i = 1;
|
|
1498
|
+
for (const item of value) {
|
|
1499
|
+
if (item == null) {
|
|
1500
|
+
continue;
|
|
1501
|
+
}
|
|
1502
|
+
const traits = member.getMergedTraits();
|
|
1503
|
+
const suffix = this.getKey("member", traits.xmlName, traits.ec2QueryName);
|
|
1504
|
+
const key = flat ? `${prefix}${i}` : `${prefix}${suffix}.${i}`;
|
|
1505
|
+
this.write(member, item, key);
|
|
1506
|
+
++i;
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
} else if (ns.isMapSchema()) {
|
|
1511
|
+
if (value && typeof value === "object") {
|
|
1512
|
+
const keySchema = ns.getKeySchema();
|
|
1513
|
+
const memberSchema = ns.getValueSchema();
|
|
1514
|
+
const flat = ns.getMergedTraits().xmlFlattened;
|
|
1515
|
+
let i = 1;
|
|
1516
|
+
for (const k in value) {
|
|
1517
|
+
const v = value[k];
|
|
1518
|
+
if (v == null) {
|
|
1519
|
+
continue;
|
|
1520
|
+
}
|
|
1521
|
+
const keyTraits = keySchema.getMergedTraits();
|
|
1522
|
+
const keySuffix = this.getKey("key", keyTraits.xmlName, keyTraits.ec2QueryName);
|
|
1523
|
+
const key = flat ? `${prefix}${i}.${keySuffix}` : `${prefix}entry.${i}.${keySuffix}`;
|
|
1524
|
+
const valTraits = memberSchema.getMergedTraits();
|
|
1525
|
+
const valueSuffix = this.getKey("value", valTraits.xmlName, valTraits.ec2QueryName);
|
|
1526
|
+
const valueKey = flat ? `${prefix}${i}.${valueSuffix}` : `${prefix}entry.${i}.${valueSuffix}`;
|
|
1527
|
+
this.write(keySchema, k, key);
|
|
1528
|
+
this.write(memberSchema, v, valueKey);
|
|
1529
|
+
++i;
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
} else if (ns.isStructSchema()) {
|
|
1533
|
+
if (value && typeof value === "object") {
|
|
1534
|
+
let didWriteMember = false;
|
|
1535
|
+
for (const [memberName, member] of ns.structIterator()) {
|
|
1536
|
+
if (value[memberName] == null && !member.isIdempotencyToken()) {
|
|
1537
|
+
continue;
|
|
1538
|
+
}
|
|
1539
|
+
const traits = member.getMergedTraits();
|
|
1540
|
+
const suffix = this.getKey(memberName, traits.xmlName, traits.ec2QueryName, "struct");
|
|
1541
|
+
const key = `${prefix}${suffix}`;
|
|
1542
|
+
this.write(member, value[memberName], key);
|
|
1543
|
+
didWriteMember = true;
|
|
1544
|
+
}
|
|
1545
|
+
if (!didWriteMember && ns.isUnionSchema()) {
|
|
1546
|
+
const { $unknown } = value;
|
|
1547
|
+
if (Array.isArray($unknown)) {
|
|
1548
|
+
const [k, v] = $unknown;
|
|
1549
|
+
const key = `${prefix}${k}`;
|
|
1550
|
+
this.write(15, v, key);
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
} else if (ns.isUnitSchema()) {
|
|
1555
|
+
} else {
|
|
1556
|
+
throw new Error(`@aws-sdk/core/protocols - QuerySerializer unrecognized schema type ${ns.getName(true)}`);
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
flush() {
|
|
1560
|
+
if (this.buffer === void 0) {
|
|
1561
|
+
throw new Error("@aws-sdk/core/protocols - QuerySerializer cannot flush with nothing written to buffer.");
|
|
1562
|
+
}
|
|
1563
|
+
const str = this.buffer;
|
|
1564
|
+
delete this.buffer;
|
|
1565
|
+
return str;
|
|
1566
|
+
}
|
|
1567
|
+
getKey(memberName, xmlName, ec2QueryName, keySource) {
|
|
1568
|
+
const { ec2, capitalizeKeys } = this.settings;
|
|
1569
|
+
if (ec2 && ec2QueryName) {
|
|
1570
|
+
return ec2QueryName;
|
|
1571
|
+
}
|
|
1572
|
+
const key = xmlName ?? memberName;
|
|
1573
|
+
if (capitalizeKeys && keySource === "struct") {
|
|
1574
|
+
return key[0].toUpperCase() + key.slice(1);
|
|
1575
|
+
}
|
|
1576
|
+
return key;
|
|
1577
|
+
}
|
|
1578
|
+
writeKey(key) {
|
|
1579
|
+
if (key.endsWith(".")) {
|
|
1580
|
+
key = key.slice(0, key.length - 1);
|
|
1581
|
+
}
|
|
1582
|
+
this.buffer += `&${extendedEncodeURIComponent(key)}=`;
|
|
1583
|
+
}
|
|
1584
|
+
writeValue(value) {
|
|
1585
|
+
this.buffer += extendedEncodeURIComponent(value);
|
|
1586
|
+
}
|
|
1587
|
+
};
|
|
1588
|
+
|
|
1589
|
+
// ../../node_modules/.pnpm/@aws-sdk+core@3.975.3/node_modules/@aws-sdk/core/dist-es/submodules/protocols/query/AwsQueryProtocol.js
|
|
1590
|
+
var AwsQueryProtocol = class extends RpcProtocol {
|
|
1591
|
+
options;
|
|
1592
|
+
serializer;
|
|
1593
|
+
deserializer;
|
|
1594
|
+
mixin = new ProtocolLib();
|
|
1595
|
+
constructor(options) {
|
|
1596
|
+
super({
|
|
1597
|
+
defaultNamespace: options.defaultNamespace,
|
|
1598
|
+
errorTypeRegistries: options.errorTypeRegistries
|
|
1599
|
+
});
|
|
1600
|
+
this.options = options;
|
|
1601
|
+
const settings = {
|
|
1602
|
+
timestampFormat: {
|
|
1603
|
+
useTrait: true,
|
|
1604
|
+
default: 5
|
|
1605
|
+
},
|
|
1606
|
+
httpBindings: false,
|
|
1607
|
+
xmlNamespace: options.xmlNamespace,
|
|
1608
|
+
serviceNamespace: options.defaultNamespace,
|
|
1609
|
+
serializeEmptyLists: true
|
|
1610
|
+
};
|
|
1611
|
+
this.serializer = new QueryShapeSerializer(settings);
|
|
1612
|
+
this.deserializer = new XmlShapeDeserializer(settings);
|
|
1613
|
+
}
|
|
1614
|
+
getShapeId() {
|
|
1615
|
+
return "aws.protocols#awsQuery";
|
|
1616
|
+
}
|
|
1617
|
+
setSerdeContext(serdeContext) {
|
|
1618
|
+
this.serializer.setSerdeContext(serdeContext);
|
|
1619
|
+
this.deserializer.setSerdeContext(serdeContext);
|
|
1620
|
+
}
|
|
1621
|
+
getPayloadCodec() {
|
|
1622
|
+
throw new Error("AWSQuery protocol has no payload codec.");
|
|
1623
|
+
}
|
|
1624
|
+
async serializeRequest(operationSchema, input, context) {
|
|
1625
|
+
const request = await super.serializeRequest(operationSchema, input, context);
|
|
1626
|
+
if (!request.path.endsWith("/")) {
|
|
1627
|
+
request.path += "/";
|
|
1628
|
+
}
|
|
1629
|
+
request.headers["content-type"] = "application/x-www-form-urlencoded";
|
|
1630
|
+
if (deref(operationSchema.input) === "unit" || !request.body) {
|
|
1631
|
+
request.body = "";
|
|
1632
|
+
}
|
|
1633
|
+
const action = operationSchema.name.split("#")[1] ?? operationSchema.name;
|
|
1634
|
+
request.body = `Action=${action}&Version=${this.options.version}` + request.body;
|
|
1635
|
+
if (request.body.endsWith("&")) {
|
|
1636
|
+
request.body = request.body.slice(-1);
|
|
1637
|
+
}
|
|
1638
|
+
return request;
|
|
1639
|
+
}
|
|
1640
|
+
async deserializeResponse(operationSchema, context, response) {
|
|
1641
|
+
const deserializer = this.deserializer;
|
|
1642
|
+
const ns = NormalizedSchema.of(operationSchema.output);
|
|
1643
|
+
const dataObject = {};
|
|
1644
|
+
if (response.statusCode >= 300) {
|
|
1645
|
+
const bytes2 = await collectBody(response.body, context);
|
|
1646
|
+
if (bytes2.byteLength > 0) {
|
|
1647
|
+
Object.assign(dataObject, await deserializer.read(15, bytes2));
|
|
1648
|
+
}
|
|
1649
|
+
await this.handleError(operationSchema, context, response, dataObject, this.deserializeMetadata(response));
|
|
1650
|
+
}
|
|
1651
|
+
for (const header in response.headers) {
|
|
1652
|
+
const value = response.headers[header];
|
|
1653
|
+
delete response.headers[header];
|
|
1654
|
+
response.headers[header.toLowerCase()] = value;
|
|
1655
|
+
}
|
|
1656
|
+
const shortName = operationSchema.name.split("#")[1] ?? operationSchema.name;
|
|
1657
|
+
const awsQueryResultKey = ns.isStructSchema() && this.useNestedResult() ? shortName + "Result" : void 0;
|
|
1658
|
+
const bytes = await collectBody(response.body, context);
|
|
1659
|
+
if (bytes.byteLength > 0) {
|
|
1660
|
+
Object.assign(dataObject, await deserializer.read(ns, bytes, awsQueryResultKey));
|
|
1661
|
+
}
|
|
1662
|
+
dataObject.$metadata = this.deserializeMetadata(response);
|
|
1663
|
+
return dataObject;
|
|
1664
|
+
}
|
|
1665
|
+
useNestedResult() {
|
|
1666
|
+
return true;
|
|
1667
|
+
}
|
|
1668
|
+
async handleError(operationSchema, context, response, dataObject, metadata) {
|
|
1669
|
+
const errorIdentifier = this.loadQueryErrorCode(response, dataObject) ?? "Unknown";
|
|
1670
|
+
this.mixin.compose(this.compositeErrorRegistry, errorIdentifier, this.options.defaultNamespace);
|
|
1671
|
+
const errorData = this.loadQueryError(dataObject) ?? {};
|
|
1672
|
+
const message = this.loadQueryErrorMessage(dataObject);
|
|
1673
|
+
errorData.message = message;
|
|
1674
|
+
errorData.Error = {
|
|
1675
|
+
Type: errorData.Type,
|
|
1676
|
+
Code: errorData.Code,
|
|
1677
|
+
Message: message
|
|
1678
|
+
};
|
|
1679
|
+
const { errorSchema, errorMetadata } = await this.mixin.getErrorSchemaOrThrowBaseException(errorIdentifier, this.options.defaultNamespace, response, errorData, metadata, this.mixin.findQueryCompatibleError);
|
|
1680
|
+
const ns = NormalizedSchema.of(errorSchema);
|
|
1681
|
+
const ErrorCtor = this.compositeErrorRegistry.getErrorCtor(errorSchema) ?? Error;
|
|
1682
|
+
const exception = new ErrorCtor({});
|
|
1683
|
+
const output = {
|
|
1684
|
+
Type: errorData.Error.Type,
|
|
1685
|
+
Code: errorData.Error.Code,
|
|
1686
|
+
Error: errorData.Error
|
|
1687
|
+
};
|
|
1688
|
+
for (const [name, member] of ns.structIterator()) {
|
|
1689
|
+
const target = member.getMergedTraits().xmlName ?? name;
|
|
1690
|
+
const value = errorData[target] ?? dataObject[target];
|
|
1691
|
+
output[name] = this.deserializer.readSchema(member, value);
|
|
1692
|
+
}
|
|
1693
|
+
throw this.mixin.decorateServiceException(Object.assign(exception, errorMetadata, {
|
|
1694
|
+
$fault: ns.getMergedTraits().error,
|
|
1695
|
+
message
|
|
1696
|
+
}, output), dataObject);
|
|
1697
|
+
}
|
|
1698
|
+
loadQueryErrorCode(output, data) {
|
|
1699
|
+
const code = (data.Errors?.[0]?.Error ?? data.Errors?.Error ?? data.Error)?.Code;
|
|
1700
|
+
if (code !== void 0) {
|
|
1701
|
+
return code;
|
|
1702
|
+
}
|
|
1703
|
+
if (output.statusCode == 404) {
|
|
1704
|
+
return "NotFound";
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
loadQueryError(data) {
|
|
1708
|
+
return data.Errors?.[0]?.Error ?? data.Errors?.Error ?? data.Error;
|
|
1709
|
+
}
|
|
1710
|
+
loadQueryErrorMessage(data) {
|
|
1711
|
+
const errorData = this.loadQueryError(data);
|
|
1712
|
+
return errorData?.message ?? errorData?.Message ?? data.message ?? data.Message ?? "Unknown";
|
|
1713
|
+
}
|
|
1714
|
+
getDefaultContentType() {
|
|
1715
|
+
return "application/x-www-form-urlencoded";
|
|
1716
|
+
}
|
|
1717
|
+
};
|
|
1718
|
+
|
|
1719
|
+
export {
|
|
1720
|
+
AwsSdkSigV4Signer,
|
|
1721
|
+
AwsSdkSigV4ASigner,
|
|
1722
|
+
NODE_AUTH_SCHEME_PREFERENCE_OPTIONS,
|
|
1723
|
+
resolveAwsSdkSigV4AConfig,
|
|
1724
|
+
NODE_SIGV4A_CONFIG_OPTIONS,
|
|
1725
|
+
resolveAwsSdkSigV4Config,
|
|
1726
|
+
AwsRestJsonProtocol,
|
|
1727
|
+
AwsQueryProtocol
|
|
1728
|
+
};
|