From d1d179f617f83bbb3bf44d3cc629be8eed0d4e2b Mon Sep 17 00:00:00 2001 From: Samson Keung Date: Tue, 22 Oct 2024 17:18:18 -0700 Subject: [PATCH] fix(scheduler-targets-alpha): imported lambda function as schedule target throws synth error (#31837) ### Issue # (if applicable) Closes #29284. ### Reason for this change Removed the same env check between the Schedule and the Lambda target to allow use of imported Lambda function as target. ### Description of changes Removed the check that forces the Schedule and the Lambda function to be in the same account and region. ### Description of how you validated changes - Unit test added to ensure no synth error when using imported Lambda function. - Integ test added to ensure imported function works. The test ensures the lambda is executed and did what it is supposed to do (i.e. added tag to itself). ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../lib/lambda-invoke.ts | 23 +- .../index.js | 43473 +++++++++------- .../aws-cdk-schedule-lambda.assets.json | 32 + .../aws-cdk-schedule-lambda.template.json | 139 + .../aws-cdk-schedule.assets.json | 6 +- .../aws-cdk-schedule.template.json | 239 +- .../integ.lambda-invoke.js.snapshot/cdk.out | 2 +- .../integ.json | 2 +- ...efaultTestDeployAssertEC6565E6.assets.json | 12 +- ...aultTestDeployAssertEC6565E6.template.json | 260 +- .../manifest.json | 167 +- .../integ.lambda-invoke.js.snapshot/tree.json | 545 +- .../test/integ.lambda-invoke.ts | 112 +- .../test/lambda-invoke.test.ts | 60 +- 14 files changed, 24903 insertions(+), 20169 deletions(-) rename packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/{asset.eafc02f6925151c95ac6a6ae81a3e36d4cf4e77db52eec8e467ce2a69454a41a.bundle => asset.e77649078c9dea5bbb707b7fe68014cfa5d919a38d31b467f6a205b51ea63a83.bundle}/index.js (71%) create mode 100644 packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule-lambda.assets.json create mode 100644 packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule-lambda.template.json diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/lib/lambda-invoke.ts b/packages/@aws-cdk/aws-scheduler-targets-alpha/lib/lambda-invoke.ts index 69c26048c701f..bbd986780b6bd 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/lib/lambda-invoke.ts +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/lib/lambda-invoke.ts @@ -1,34 +1,23 @@ import { ISchedule, IScheduleTarget } from '@aws-cdk/aws-scheduler-alpha'; -import { Names } from 'aws-cdk-lib'; import { IRole } from 'aws-cdk-lib/aws-iam'; import * as lambda from 'aws-cdk-lib/aws-lambda'; import { ScheduleTargetBase, ScheduleTargetBaseProps } from './target'; -import { sameEnvDimension } from './util'; /** * Use an AWS Lambda function as a target for AWS EventBridge Scheduler. */ export class LambdaInvoke extends ScheduleTargetBase implements IScheduleTarget { + private readonly func: lambda.IFunction; + constructor( - private readonly func: lambda.IFunction, - private readonly props: ScheduleTargetBaseProps, + func: lambda.IFunction, + props: ScheduleTargetBaseProps, ) { super(props, func.functionArn); + this.func = func; } - protected addTargetActionToRole(schedule: ISchedule, role: IRole): void { - if (!sameEnvDimension(this.func.env.region, schedule.env.region)) { - throw new Error(`Cannot assign function in region ${this.func.env.region} to the schedule ${Names.nodeUniqueId(schedule.node)} in region ${schedule.env.region}. Both the schedule and the function must be in the same region.`); - } - - if (!sameEnvDimension(this.func.env.account, schedule.env.account)) { - throw new Error(`Cannot assign function in account ${this.func.env.account} to the schedule ${Names.nodeUniqueId(schedule.node)} in account ${schedule.env.region}. Both the schedule and the function must be in the same account.`); - } - - if (this.props.role && !sameEnvDimension(this.props.role.env.account, this.func.env.account)) { - throw new Error(`Cannot grant permission to execution role in account ${this.props.role.env.account} to invoke target ${Names.nodeUniqueId(this.func.node)} in account ${this.func.env.account}. Both the target and the execution role must be in the same account.`); - } - + protected addTargetActionToRole(_schedule: ISchedule, role: IRole): void { this.func.grantInvoke(role); } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/asset.eafc02f6925151c95ac6a6ae81a3e36d4cf4e77db52eec8e467ce2a69454a41a.bundle/index.js b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/asset.e77649078c9dea5bbb707b7fe68014cfa5d919a38d31b467f6a205b51ea63a83.bundle/index.js similarity index 71% rename from packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/asset.eafc02f6925151c95ac6a6ae81a3e36d4cf4e77db52eec8e467ce2a69454a41a.bundle/index.js rename to packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/asset.e77649078c9dea5bbb707b7fe68014cfa5d919a38d31b467f6a205b51ea63a83.bundle/index.js index b29fadc70c1e6..30d89ca8b59e8 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/asset.eafc02f6925151c95ac6a6ae81a3e36d4cf4e77db52eec8e467ce2a69454a41a.bundle/index.js +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/asset.e77649078c9dea5bbb707b7fe68014cfa5d919a38d31b467f6a205b51ea63a83.bundle/index.js @@ -1,3 +1,4 @@ +"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; @@ -815,652 +816,154 @@ var require_helpers_internal = __commonJS({ } }); -// ../../../node_modules/tslib/tslib.es6.mjs -var tslib_es6_exports = {}; -__export(tslib_es6_exports, { - __addDisposableResource: () => __addDisposableResource, - __assign: () => __assign, - __asyncDelegator: () => __asyncDelegator, - __asyncGenerator: () => __asyncGenerator, - __asyncValues: () => __asyncValues, - __await: () => __await, - __awaiter: () => __awaiter, - __classPrivateFieldGet: () => __classPrivateFieldGet, - __classPrivateFieldIn: () => __classPrivateFieldIn, - __classPrivateFieldSet: () => __classPrivateFieldSet, - __createBinding: () => __createBinding, - __decorate: () => __decorate, - __disposeResources: () => __disposeResources, - __esDecorate: () => __esDecorate, - __exportStar: () => __exportStar, - __extends: () => __extends, - __generator: () => __generator, - __importDefault: () => __importDefault, - __importStar: () => __importStar, - __makeTemplateObject: () => __makeTemplateObject, - __metadata: () => __metadata, - __param: () => __param, - __propKey: () => __propKey, - __read: () => __read, - __rest: () => __rest, - __runInitializers: () => __runInitializers, - __setFunctionName: () => __setFunctionName, - __spread: () => __spread, - __spreadArray: () => __spreadArray, - __spreadArrays: () => __spreadArrays, - __values: () => __values, - default: () => tslib_es6_default -}); -function __extends(d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { - this.constructor = d; - } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -} -function __rest(s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; -} -function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -} -function __param(paramIndex, decorator) { - return function(target, key) { - decorator(target, key, paramIndex); - }; -} -function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { - function accept(f) { - if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); - return f; - } - var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; - var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; - var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); - var _, done = false; - for (var i = decorators.length - 1; i >= 0; i--) { - var context = {}; - for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; - for (var p in contextIn.access) context.access[p] = contextIn.access[p]; - context.addInitializer = function(f) { - if (done) throw new TypeError("Cannot add initializers after decoration has completed"); - extraInitializers.push(accept(f || null)); +// ../../../node_modules/@smithy/types/dist-cjs/index.js +var require_dist_cjs = __commonJS({ + "../../../node_modules/@smithy/types/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); - if (kind === "accessor") { - if (result === void 0) continue; - if (result === null || typeof result !== "object") throw new TypeError("Object expected"); - if (_ = accept(result.get)) descriptor.get = _; - if (_ = accept(result.set)) descriptor.set = _; - if (_ = accept(result.init)) initializers.unshift(_); - } else if (_ = accept(result)) { - if (kind === "field") initializers.unshift(_); - else descriptor[key] = _; - } - } - if (target) Object.defineProperty(target, contextIn.name, descriptor); - done = true; -} -function __runInitializers(thisArg, initializers, value) { - var useValue = arguments.length > 2; - for (var i = 0; i < initializers.length; i++) { - value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); - } - return useValue ? value : void 0; -} -function __propKey(x) { - return typeof x === "symbol" ? x : "".concat(x); -} -function __setFunctionName(f, name, prefix) { - if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); -} -function __metadata(metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); -} -function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + AlgorithmId: () => AlgorithmId, + EndpointURLScheme: () => EndpointURLScheme, + FieldPosition: () => FieldPosition, + HttpApiKeyAuthLocation: () => HttpApiKeyAuthLocation2, + HttpAuthLocation: () => HttpAuthLocation, + IniSectionType: () => IniSectionType, + RequestHandlerProtocol: () => RequestHandlerProtocol, + SMITHY_CONTEXT_KEY: () => SMITHY_CONTEXT_KEY4, + getDefaultClientConfiguration: () => getDefaultClientConfiguration, + resolveDefaultRuntimeConfig: () => resolveDefaultRuntimeConfig }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); + module2.exports = __toCommonJS2(src_exports); + var HttpAuthLocation = /* @__PURE__ */ ((HttpAuthLocation2) => { + HttpAuthLocation2["HEADER"] = "header"; + HttpAuthLocation2["QUERY"] = "query"; + return HttpAuthLocation2; + })(HttpAuthLocation || {}); + var HttpApiKeyAuthLocation2 = /* @__PURE__ */ ((HttpApiKeyAuthLocation22) => { + HttpApiKeyAuthLocation22["HEADER"] = "header"; + HttpApiKeyAuthLocation22["QUERY"] = "query"; + return HttpApiKeyAuthLocation22; + })(HttpApiKeyAuthLocation2 || {}); + var EndpointURLScheme = /* @__PURE__ */ ((EndpointURLScheme2) => { + EndpointURLScheme2["HTTP"] = "http"; + EndpointURLScheme2["HTTPS"] = "https"; + return EndpointURLScheme2; + })(EndpointURLScheme || {}); + var AlgorithmId = /* @__PURE__ */ ((AlgorithmId2) => { + AlgorithmId2["MD5"] = "md5"; + AlgorithmId2["CRC32"] = "crc32"; + AlgorithmId2["CRC32C"] = "crc32c"; + AlgorithmId2["SHA1"] = "sha1"; + AlgorithmId2["SHA256"] = "sha256"; + return AlgorithmId2; + })(AlgorithmId || {}); + var getChecksumConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { + const checksumAlgorithms = []; + if (runtimeConfig.sha256 !== void 0) { + checksumAlgorithms.push({ + algorithmId: () => "sha256", + checksumConstructor: () => runtimeConfig.sha256 + }); } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); + if (runtimeConfig.md5 != void 0) { + checksumAlgorithms.push({ + algorithmId: () => "md5", + checksumConstructor: () => runtimeConfig.md5 + }); } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} -function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { - if (t[0] & 1) throw t[1]; - return t[1]; - }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { - return this; - }), g; - function verb(n) { - return function(v) { - return step([n, v]); - }; + return { + _checksumAlgorithms: checksumAlgorithms, + addChecksumAlgorithm(algo) { + this._checksumAlgorithms.push(algo); + }, + checksumAlgorithms() { + return this._checksumAlgorithms; + } + }; + }, "getChecksumConfiguration"); + var resolveChecksumRuntimeConfig = /* @__PURE__ */ __name((clientConfig) => { + const runtimeConfig = {}; + clientConfig.checksumAlgorithms().forEach((checksumAlgorithm) => { + runtimeConfig[checksumAlgorithm.algorithmId()] = checksumAlgorithm.checksumConstructor(); + }); + return runtimeConfig; + }, "resolveChecksumRuntimeConfig"); + var getDefaultClientConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { + return { + ...getChecksumConfiguration(runtimeConfig) + }; + }, "getDefaultClientConfiguration"); + var resolveDefaultRuntimeConfig = /* @__PURE__ */ __name((config) => { + return { + ...resolveChecksumRuntimeConfig(config) + }; + }, "resolveDefaultRuntimeConfig"); + var FieldPosition = /* @__PURE__ */ ((FieldPosition2) => { + FieldPosition2[FieldPosition2["HEADER"] = 0] = "HEADER"; + FieldPosition2[FieldPosition2["TRAILER"] = 1] = "TRAILER"; + return FieldPosition2; + })(FieldPosition || {}); + var SMITHY_CONTEXT_KEY4 = "__smithy_context"; + var IniSectionType = /* @__PURE__ */ ((IniSectionType2) => { + IniSectionType2["PROFILE"] = "profile"; + IniSectionType2["SSO_SESSION"] = "sso-session"; + IniSectionType2["SERVICES"] = "services"; + return IniSectionType2; + })(IniSectionType || {}); + var RequestHandlerProtocol = /* @__PURE__ */ ((RequestHandlerProtocol2) => { + RequestHandlerProtocol2["HTTP_0_9"] = "http/0.9"; + RequestHandlerProtocol2["HTTP_1_0"] = "http/1.0"; + RequestHandlerProtocol2["TDS_8_0"] = "tds/8.0"; + return RequestHandlerProtocol2; + })(RequestHandlerProtocol || {}); } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (g && (g = 0, op[0] && (_ = 0)), _) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: - case 1: - t = op; - break; - case 4: - _.label++; - return { value: op[1], done: false }; - case 5: - _.label++; - y = op[1]; - op = [0]; - continue; - case 7: - op = _.ops.pop(); - _.trys.pop(); - continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { - _ = 0; - continue; - } - if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { - _.label = op[1]; - break; - } - if (op[0] === 6 && _.label < t[1]) { - _.label = t[1]; - t = op; - break; - } - if (t && _.label < t[2]) { - _.label = t[2]; - _.ops.push(op); - break; - } - if (t[2]) _.ops.pop(); - _.trys.pop(); - continue; - } - op = body.call(thisArg, _); - } catch (e) { - op = [6, e]; - y = 0; - } finally { - f = t = 0; - } - if (op[0] & 5) throw op[1]; - return { value: op[0] ? op[1] : void 0, done: true }; - } -} -function __exportStar(m, o) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); -} -function __values(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function() { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -} -function __read(o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } catch (error) { - e = { error }; - } finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } finally { - if (e) throw e.error; - } - } - return ar; -} -function __spread() { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; -} -function __spreadArrays() { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; -} -function __spreadArray(to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -} -function __await(v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); -} -function __asyncGenerator(thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() { - return this; - }, i; - function awaitReturn(f) { - return function(v) { - return Promise.resolve(v).then(f, reject); - }; - } - function verb(n, f) { - if (g[n]) { - i[n] = function(v) { - return new Promise(function(a, b) { - q.push([n, v, a, b]) > 1 || resume(n, v); - }); - }; - if (f) i[n] = f(i[n]); - } - } - function resume(n, v) { - try { - step(g[n](v)); - } catch (e) { - settle(q[0][3], e); - } - } - function step(r) { - r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); - } - function fulfill(value) { - resume("next", value); - } - function reject(value) { - resume("throw", value); - } - function settle(f, v) { - if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); - } -} -function __asyncDelegator(o) { - var i, p; - return i = {}, verb("next"), verb("throw", function(e) { - throw e; - }), verb("return"), i[Symbol.iterator] = function() { - return this; - }, i; - function verb(n, f) { - i[n] = o[n] ? function(v) { - return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; - } : f; - } -} -function __asyncValues(o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { - return this; - }, i); - function verb(n) { - i[n] = o[n] && function(v) { - return new Promise(function(resolve, reject) { - v = o[n](v), settle(resolve, reject, v.done, v.value); - }); +}); + +// ../../../node_modules/@smithy/protocol-http/dist-cjs/index.js +var require_dist_cjs2 = __commonJS({ + "../../../node_modules/@smithy/protocol-http/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - } - function settle(resolve, reject, d, v) { - Promise.resolve(v).then(function(v2) { - resolve({ value: v2, done: d }); - }, reject); - } -} -function __makeTemplateObject(cooked, raw) { - if (Object.defineProperty) { - Object.defineProperty(cooked, "raw", { value: raw }); - } else { - cooked.raw = raw; - } - return cooked; -} -function __importStar(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - } - __setModuleDefault(result, mod); - return result; -} -function __importDefault(mod) { - return mod && mod.__esModule ? mod : { default: mod }; -} -function __classPrivateFieldGet(receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -} -function __classPrivateFieldSet(receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value; -} -function __classPrivateFieldIn(state, receiver) { - if (receiver === null || typeof receiver !== "object" && typeof receiver !== "function") throw new TypeError("Cannot use 'in' operator on non-object"); - return typeof state === "function" ? receiver === state : state.has(receiver); -} -function __addDisposableResource(env, value, async) { - if (value !== null && value !== void 0) { - if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); - var dispose, inner; - if (async) { - if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); - dispose = value[Symbol.asyncDispose]; - } - if (dispose === void 0) { - if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); - dispose = value[Symbol.dispose]; - if (async) inner = dispose; - } - if (typeof dispose !== "function") throw new TypeError("Object not disposable."); - if (inner) dispose = function() { - try { - inner.call(this); - } catch (e) { - return Promise.reject(e); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - }; - env.stack.push({ value, dispose, async }); - } else if (async) { - env.stack.push({ async: true }); - } - return value; -} -function __disposeResources(env) { - function fail(e) { - env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; - env.hasError = true; - } - function next() { - while (env.stack.length) { - var rec = env.stack.pop(); - try { - var result = rec.dispose && rec.dispose.call(rec.value); - if (rec.async) return Promise.resolve(result).then(next, function(e) { - fail(e); - return next(); - }); - } catch (e) { - fail(e); - } - } - if (env.hasError) throw env.error; - } - return next(); -} -var extendStatics, __assign, __createBinding, __setModuleDefault, _SuppressedError, tslib_es6_default; -var init_tslib_es6 = __esm({ - "../../../node_modules/tslib/tslib.es6.mjs"() { - extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { - d2.__proto__ = b2; - } || function(d2, b2) { - for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; - }; - return extendStatics(d, b); - }; - __assign = function() { - __assign = Object.assign || function __assign2(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); - }; - __createBinding = Object.create ? function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); - } : function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - }; - __setModuleDefault = Object.create ? function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } : function(o, v) { - o["default"] = v; - }; - _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) { - var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; - }; - tslib_es6_default = { - __extends, - __assign, - __rest, - __decorate, - __param, - __metadata, - __awaiter, - __generator, - __createBinding, - __exportStar, - __values, - __read, - __spread, - __spreadArrays, - __spreadArray, - __await, - __asyncGenerator, - __asyncDelegator, - __asyncValues, - __makeTemplateObject, - __importStar, - __importDefault, - __classPrivateFieldGet, - __classPrivateFieldSet, - __classPrivateFieldIn, - __addDisposableResource, - __disposeResources - }; - } -}); - -// ../../../node_modules/@smithy/types/dist-cjs/index.js -var require_dist_cjs = __commonJS({ - "../../../node_modules/@smithy/types/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - AlgorithmId: () => AlgorithmId, - EndpointURLScheme: () => EndpointURLScheme, - FieldPosition: () => FieldPosition, - HttpApiKeyAuthLocation: () => HttpApiKeyAuthLocation, - HttpAuthLocation: () => HttpAuthLocation, - IniSectionType: () => IniSectionType, - RequestHandlerProtocol: () => RequestHandlerProtocol, - SMITHY_CONTEXT_KEY: () => SMITHY_CONTEXT_KEY, - getDefaultClientConfiguration: () => getDefaultClientConfiguration, - resolveDefaultRuntimeConfig: () => resolveDefaultRuntimeConfig - }); - module2.exports = __toCommonJS2(src_exports); - var HttpAuthLocation = /* @__PURE__ */ ((HttpAuthLocation2) => { - HttpAuthLocation2["HEADER"] = "header"; - HttpAuthLocation2["QUERY"] = "query"; - return HttpAuthLocation2; - })(HttpAuthLocation || {}); - var HttpApiKeyAuthLocation = /* @__PURE__ */ ((HttpApiKeyAuthLocation2) => { - HttpApiKeyAuthLocation2["HEADER"] = "header"; - HttpApiKeyAuthLocation2["QUERY"] = "query"; - return HttpApiKeyAuthLocation2; - })(HttpApiKeyAuthLocation || {}); - var EndpointURLScheme = /* @__PURE__ */ ((EndpointURLScheme2) => { - EndpointURLScheme2["HTTP"] = "http"; - EndpointURLScheme2["HTTPS"] = "https"; - return EndpointURLScheme2; - })(EndpointURLScheme || {}); - var AlgorithmId = /* @__PURE__ */ ((AlgorithmId2) => { - AlgorithmId2["MD5"] = "md5"; - AlgorithmId2["CRC32"] = "crc32"; - AlgorithmId2["CRC32C"] = "crc32c"; - AlgorithmId2["SHA1"] = "sha1"; - AlgorithmId2["SHA256"] = "sha256"; - return AlgorithmId2; - })(AlgorithmId || {}); - var getChecksumConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { - const checksumAlgorithms = []; - if (runtimeConfig.sha256 !== void 0) { - checksumAlgorithms.push({ - algorithmId: () => "sha256", - checksumConstructor: () => runtimeConfig.sha256 - }); - } - if (runtimeConfig.md5 != void 0) { - checksumAlgorithms.push({ - algorithmId: () => "md5", - checksumConstructor: () => runtimeConfig.md5 - }); - } - return { - _checksumAlgorithms: checksumAlgorithms, - addChecksumAlgorithm(algo) { - this._checksumAlgorithms.push(algo); - }, - checksumAlgorithms() { - return this._checksumAlgorithms; - } - }; - }, "getChecksumConfiguration"); - var resolveChecksumRuntimeConfig = /* @__PURE__ */ __name((clientConfig) => { - const runtimeConfig = {}; - clientConfig.checksumAlgorithms().forEach((checksumAlgorithm) => { - runtimeConfig[checksumAlgorithm.algorithmId()] = checksumAlgorithm.checksumConstructor(); - }); - return runtimeConfig; - }, "resolveChecksumRuntimeConfig"); - var getDefaultClientConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { - return { - ...getChecksumConfiguration(runtimeConfig) - }; - }, "getDefaultClientConfiguration"); - var resolveDefaultRuntimeConfig = /* @__PURE__ */ __name((config) => { - return { - ...resolveChecksumRuntimeConfig(config) - }; - }, "resolveDefaultRuntimeConfig"); - var FieldPosition = /* @__PURE__ */ ((FieldPosition2) => { - FieldPosition2[FieldPosition2["HEADER"] = 0] = "HEADER"; - FieldPosition2[FieldPosition2["TRAILER"] = 1] = "TRAILER"; - return FieldPosition2; - })(FieldPosition || {}); - var SMITHY_CONTEXT_KEY = "__smithy_context"; - var IniSectionType = /* @__PURE__ */ ((IniSectionType2) => { - IniSectionType2["PROFILE"] = "profile"; - IniSectionType2["SSO_SESSION"] = "sso-session"; - IniSectionType2["SERVICES"] = "services"; - return IniSectionType2; - })(IniSectionType || {}); - var RequestHandlerProtocol = /* @__PURE__ */ ((RequestHandlerProtocol2) => { - RequestHandlerProtocol2["HTTP_0_9"] = "http/0.9"; - RequestHandlerProtocol2["HTTP_1_0"] = "http/1.0"; - RequestHandlerProtocol2["TDS_8_0"] = "tds/8.0"; - return RequestHandlerProtocol2; - })(RequestHandlerProtocol || {}); - } -}); - -// ../../../node_modules/@smithy/protocol-http/dist-cjs/index.js -var require_dist_cjs2 = __commonJS({ - "../../../node_modules/@smithy/protocol-http/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); - } - return to; + return to; }; var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var src_exports = {}; __export2(src_exports, { Field: () => Field, Fields: () => Fields, - HttpRequest: () => HttpRequest, - HttpResponse: () => HttpResponse, + HttpRequest: () => HttpRequest7, + HttpResponse: () => HttpResponse2, + IHttpRequest: () => import_types5.HttpRequest, getHttpHandlerExtensionConfiguration: () => getHttpHandlerExtensionConfiguration, isValidHostname: () => isValidHostname, resolveHttpHandlerRuntimeConfig: () => resolveHttpHandlerRuntimeConfig @@ -1488,9 +991,9 @@ var require_dist_cjs2 = __commonJS({ httpHandler: httpHandlerExtensionConfiguration.httpHandler() }; }, "resolveHttpHandlerRuntimeConfig"); - var import_types = require_dist_cjs(); + var import_types5 = require_dist_cjs(); var _Field = class _Field { - constructor({ name, kind = import_types.FieldPosition.HEADER, values = [] }) { + constructor({ name, kind = import_types5.FieldPosition.HEADER, values = [] }) { this.name = name; this.kind = kind; this.values = values; @@ -1599,24 +1102,44 @@ var require_dist_cjs2 = __commonJS({ this.password = options.password; this.fragment = options.fragment; } + /** + * Note: this does not deep-clone the body. + */ + static clone(request2) { + const cloned = new _HttpRequest2({ + ...request2, + headers: { ...request2.headers } + }); + if (cloned.query) { + cloned.query = cloneQuery(cloned.query); + } + return cloned; + } + /** + * This method only actually asserts that request is the interface {@link IHttpRequest}, + * and not necessarily this concrete class. Left in place for API stability. + * + * Do not call instance methods on the input of this function, and + * do not assume it has the HttpRequest prototype. + */ static isInstance(request2) { - if (!request2) + if (!request2) { return false; + } const req = request2; return "method" in req && "protocol" in req && "hostname" in req && "path" in req && typeof req["query"] === "object" && typeof req["headers"] === "object"; } + /** + * @deprecated use static HttpRequest.clone(request) instead. It's not safe to call + * this method because {@link HttpRequest.isInstance} incorrectly + * asserts that IHttpRequest (interface) objects are of type HttpRequest (class). + */ clone() { - const cloned = new _HttpRequest2({ - ...this, - headers: { ...this.headers } - }); - if (cloned.query) - cloned.query = cloneQuery(cloned.query); - return cloned; + return _HttpRequest2.clone(this); } }; __name(_HttpRequest, "HttpRequest"); - var HttpRequest = _HttpRequest; + var HttpRequest7 = _HttpRequest; function cloneQuery(query) { return Object.keys(query).reduce((carry, paramName) => { const param = query[paramName]; @@ -1642,7 +1165,7 @@ var require_dist_cjs2 = __commonJS({ } }; __name(_HttpResponse, "HttpResponse"); - var HttpResponse = _HttpResponse; + var HttpResponse2 = _HttpResponse; function isValidHostname(hostname) { const hostPattern = /^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/; return hostPattern.test(hostname); @@ -1653,64 +1176,109 @@ var require_dist_cjs2 = __commonJS({ // ../../../node_modules/@aws-sdk/middleware-host-header/dist-cjs/index.js var require_dist_cjs3 = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-host-header/dist-cjs/index.js"(exports2) { + "../../../node_modules/@aws-sdk/middleware-host-header/dist-cjs/index.js"(exports2, module2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getHostHeaderPlugin = exports2.hostHeaderMiddlewareOptions = exports2.hostHeaderMiddleware = exports2.resolveHostHeaderConfig = void 0; - var protocol_http_1 = require_dist_cjs2(); - function resolveHostHeaderConfig(input) { - return input; - } - exports2.resolveHostHeaderConfig = resolveHostHeaderConfig; - var hostHeaderMiddleware = (options) => (next) => async (args) => { - if (!protocol_http_1.HttpRequest.isInstance(args.request)) - return next(args); - const { request: request2 } = args; - const { handlerProtocol = "" } = options.requestHandler.metadata || {}; - if (handlerProtocol.indexOf("h2") >= 0 && !request2.headers[":authority"]) { - delete request2.headers["host"]; - request2.headers[":authority"] = ""; - } else if (!request2.headers["host"]) { - let host = request2.hostname; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + getHostHeaderPlugin: () => getHostHeaderPlugin, + hostHeaderMiddleware: () => hostHeaderMiddleware, + hostHeaderMiddlewareOptions: () => hostHeaderMiddlewareOptions, + resolveHostHeaderConfig: () => resolveHostHeaderConfig + }); + module2.exports = __toCommonJS2(src_exports); + var import_protocol_http8 = require_dist_cjs2(); + function resolveHostHeaderConfig(input) { + return input; + } + __name(resolveHostHeaderConfig, "resolveHostHeaderConfig"); + var hostHeaderMiddleware = /* @__PURE__ */ __name((options) => (next) => async (args) => { + if (!import_protocol_http8.HttpRequest.isInstance(args.request)) + return next(args); + const { request: request2 } = args; + const { handlerProtocol = "" } = options.requestHandler.metadata || {}; + if (handlerProtocol.indexOf("h2") >= 0 && !request2.headers[":authority"]) { + delete request2.headers["host"]; + request2.headers[":authority"] = request2.hostname + (request2.port ? ":" + request2.port : ""); + } else if (!request2.headers["host"]) { + let host = request2.hostname; if (request2.port != null) host += `:${request2.port}`; request2.headers["host"] = host; } return next(args); - }; - exports2.hostHeaderMiddleware = hostHeaderMiddleware; - exports2.hostHeaderMiddlewareOptions = { + }, "hostHeaderMiddleware"); + var hostHeaderMiddlewareOptions = { name: "hostHeaderMiddleware", step: "build", priority: "low", tags: ["HOST"], override: true }; - var getHostHeaderPlugin = (options) => ({ + var getHostHeaderPlugin = /* @__PURE__ */ __name((options) => ({ applyToStack: (clientStack) => { - clientStack.add((0, exports2.hostHeaderMiddleware)(options), exports2.hostHeaderMiddlewareOptions); + clientStack.add(hostHeaderMiddleware(options), hostHeaderMiddlewareOptions); } - }); - exports2.getHostHeaderPlugin = getHostHeaderPlugin; + }), "getHostHeaderPlugin"); } }); -// ../../../node_modules/@aws-sdk/middleware-logger/dist-cjs/loggerMiddleware.js -var require_loggerMiddleware = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-logger/dist-cjs/loggerMiddleware.js"(exports2) { +// ../../../node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js +var require_dist_cjs4 = __commonJS({ + "../../../node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js"(exports2, module2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getLoggerPlugin = exports2.loggerMiddlewareOptions = exports2.loggerMiddleware = void 0; - var loggerMiddleware = () => (next, context) => async (args) => { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + getLoggerPlugin: () => getLoggerPlugin, + loggerMiddleware: () => loggerMiddleware, + loggerMiddlewareOptions: () => loggerMiddlewareOptions + }); + module2.exports = __toCommonJS2(src_exports); + var loggerMiddleware = /* @__PURE__ */ __name(() => (next, context) => async (args) => { var _a, _b; try { const response = await next(args); const { clientName, commandName, logger, dynamoDbDocumentClientOptions = {} } = context; const { overrideInputFilterSensitiveLog, overrideOutputFilterSensitiveLog } = dynamoDbDocumentClientOptions; - const inputFilterSensitiveLog = overrideInputFilterSensitiveLog !== null && overrideInputFilterSensitiveLog !== void 0 ? overrideInputFilterSensitiveLog : context.inputFilterSensitiveLog; - const outputFilterSensitiveLog = overrideOutputFilterSensitiveLog !== null && overrideOutputFilterSensitiveLog !== void 0 ? overrideOutputFilterSensitiveLog : context.outputFilterSensitiveLog; + const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context.inputFilterSensitiveLog; + const outputFilterSensitiveLog = overrideOutputFilterSensitiveLog ?? context.outputFilterSensitiveLog; const { $metadata, ...outputWithoutMetadata } = response.output; - (_a = logger === null || logger === void 0 ? void 0 : logger.info) === null || _a === void 0 ? void 0 : _a.call(logger, { + (_a = logger == null ? void 0 : logger.info) == null ? void 0 : _a.call(logger, { clientName, commandName, input: inputFilterSensitiveLog(args.input), @@ -1721,8 +1289,8 @@ var require_loggerMiddleware = __commonJS({ } catch (error) { const { clientName, commandName, logger, dynamoDbDocumentClientOptions = {} } = context; const { overrideInputFilterSensitiveLog } = dynamoDbDocumentClientOptions; - const inputFilterSensitiveLog = overrideInputFilterSensitiveLog !== null && overrideInputFilterSensitiveLog !== void 0 ? overrideInputFilterSensitiveLog : context.inputFilterSensitiveLog; - (_b = logger === null || logger === void 0 ? void 0 : logger.error) === null || _b === void 0 ? void 0 : _b.call(logger, { + const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context.inputFilterSensitiveLog; + (_b = logger == null ? void 0 : logger.error) == null ? void 0 : _b.call(logger, { clientName, commandName, input: inputFilterSensitiveLog(args.input), @@ -1731,51 +1299,62 @@ var require_loggerMiddleware = __commonJS({ }); throw error; } - }; - exports2.loggerMiddleware = loggerMiddleware; - exports2.loggerMiddlewareOptions = { + }, "loggerMiddleware"); + var loggerMiddlewareOptions = { name: "loggerMiddleware", tags: ["LOGGER"], step: "initialize", override: true }; - var getLoggerPlugin = (options) => ({ + var getLoggerPlugin = /* @__PURE__ */ __name((options) => ({ applyToStack: (clientStack) => { - clientStack.add((0, exports2.loggerMiddleware)(), exports2.loggerMiddlewareOptions); + clientStack.add(loggerMiddleware(), loggerMiddlewareOptions); } - }); - exports2.getLoggerPlugin = getLoggerPlugin; - } -}); - -// ../../../node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js -var require_dist_cjs4 = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_loggerMiddleware(), exports2); + }), "getLoggerPlugin"); } }); // ../../../node_modules/@aws-sdk/middleware-recursion-detection/dist-cjs/index.js var require_dist_cjs5 = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-recursion-detection/dist-cjs/index.js"(exports2) { + "../../../node_modules/@aws-sdk/middleware-recursion-detection/dist-cjs/index.js"(exports2, module2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getRecursionDetectionPlugin = exports2.addRecursionDetectionMiddlewareOptions = exports2.recursionDetectionMiddleware = void 0; - var protocol_http_1 = require_dist_cjs2(); + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + addRecursionDetectionMiddlewareOptions: () => addRecursionDetectionMiddlewareOptions, + getRecursionDetectionPlugin: () => getRecursionDetectionPlugin, + recursionDetectionMiddleware: () => recursionDetectionMiddleware + }); + module2.exports = __toCommonJS2(src_exports); + var import_protocol_http8 = require_dist_cjs2(); var TRACE_ID_HEADER_NAME = "X-Amzn-Trace-Id"; var ENV_LAMBDA_FUNCTION_NAME = "AWS_LAMBDA_FUNCTION_NAME"; var ENV_TRACE_ID = "_X_AMZN_TRACE_ID"; - var recursionDetectionMiddleware = (options) => (next) => async (args) => { + var recursionDetectionMiddleware = /* @__PURE__ */ __name((options) => (next) => async (args) => { const { request: request2 } = args; - if (!protocol_http_1.HttpRequest.isInstance(request2) || options.runtime !== "node" || request2.headers.hasOwnProperty(TRACE_ID_HEADER_NAME)) { + if (!import_protocol_http8.HttpRequest.isInstance(request2) || options.runtime !== "node" || request2.headers.hasOwnProperty(TRACE_ID_HEADER_NAME)) { return next(args); } const functionName = process.env[ENV_LAMBDA_FUNCTION_NAME]; const traceId = process.env[ENV_TRACE_ID]; - const nonEmptyString = (str) => typeof str === "string" && str.length > 0; + const nonEmptyString = /* @__PURE__ */ __name((str) => typeof str === "string" && str.length > 0, "nonEmptyString"); if (nonEmptyString(functionName) && nonEmptyString(traceId)) { request2.headers[TRACE_ID_HEADER_NAME] = traceId; } @@ -1783,27 +1362,25 @@ var require_dist_cjs5 = __commonJS({ ...args, request: request2 }); - }; - exports2.recursionDetectionMiddleware = recursionDetectionMiddleware; - exports2.addRecursionDetectionMiddlewareOptions = { + }, "recursionDetectionMiddleware"); + var addRecursionDetectionMiddlewareOptions = { step: "build", tags: ["RECURSION_DETECTION"], name: "recursionDetectionMiddleware", override: true, priority: "low" }; - var getRecursionDetectionPlugin = (options) => ({ + var getRecursionDetectionPlugin = /* @__PURE__ */ __name((options) => ({ applyToStack: (clientStack) => { - clientStack.add((0, exports2.recursionDetectionMiddleware)(options), exports2.addRecursionDetectionMiddlewareOptions); + clientStack.add(recursionDetectionMiddleware(options), addRecursionDetectionMiddlewareOptions); } - }); - exports2.getRecursionDetectionPlugin = getRecursionDetectionPlugin; + }), "getRecursionDetectionPlugin"); } }); -// ../../../node_modules/@smithy/property-provider/dist-cjs/index.js +// ../../../node_modules/@smithy/util-endpoints/dist-cjs/index.js var require_dist_cjs6 = __commonJS({ - "../../../node_modules/@smithy/property-provider/dist-cjs/index.js"(exports2, module2) { + "../../../node_modules/@smithy/util-endpoints/dist-cjs/index.js"(exports2, module2) { var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames2 = Object.getOwnPropertyNames; @@ -1824,185 +1401,462 @@ var require_dist_cjs6 = __commonJS({ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var src_exports = {}; __export2(src_exports, { - CredentialsProviderError: () => CredentialsProviderError, - ProviderError: () => ProviderError, - TokenProviderError: () => TokenProviderError, - chain: () => chain, - fromStatic: () => fromStatic, - memoize: () => memoize + EndpointCache: () => EndpointCache, + EndpointError: () => EndpointError2, + customEndpointFunctions: () => customEndpointFunctions, + isIpAddress: () => isIpAddress2, + isValidHostLabel: () => isValidHostLabel, + resolveEndpoint: () => resolveEndpoint2 }); module2.exports = __toCommonJS2(src_exports); - var _ProviderError = class _ProviderError2 extends Error { - constructor(message, tryNextLink = true) { - super(message); - this.tryNextLink = tryNextLink; - this.name = "ProviderError"; - Object.setPrototypeOf(this, _ProviderError2.prototype); + var _EndpointCache = class _EndpointCache { + /** + * @param [size] - desired average maximum capacity. A buffer of 10 additional keys will be allowed + * before keys are dropped. + * @param [params] - list of params to consider as part of the cache key. + * + * If the params list is not populated, no caching will happen. + * This may be out of order depending on how the object is created and arrives to this class. + */ + constructor({ size, params }) { + this.data = /* @__PURE__ */ new Map(); + this.parameters = []; + this.capacity = size ?? 50; + if (params) { + this.parameters = params; + } } - static from(error, tryNextLink = true) { - return Object.assign(new this(error.message, tryNextLink), error); + /** + * @param endpointParams - query for endpoint. + * @param resolver - provider of the value if not present. + * @returns endpoint corresponding to the query. + */ + get(endpointParams, resolver) { + const key = this.hash(endpointParams); + if (key === false) { + return resolver(); + } + if (!this.data.has(key)) { + if (this.data.size > this.capacity + 10) { + const keys = this.data.keys(); + let i = 0; + while (true) { + const { value, done } = keys.next(); + this.data.delete(value); + if (done || ++i > 10) { + break; + } + } + } + this.data.set(key, resolver()); + } + return this.data.get(key); } - }; - __name(_ProviderError, "ProviderError"); - var ProviderError = _ProviderError; - var _CredentialsProviderError = class _CredentialsProviderError2 extends ProviderError { - constructor(message, tryNextLink = true) { - super(message, tryNextLink); - this.tryNextLink = tryNextLink; - this.name = "CredentialsProviderError"; - Object.setPrototypeOf(this, _CredentialsProviderError2.prototype); + size() { + return this.data.size; } - }; - __name(_CredentialsProviderError, "CredentialsProviderError"); - var CredentialsProviderError = _CredentialsProviderError; - var _TokenProviderError = class _TokenProviderError2 extends ProviderError { - constructor(message, tryNextLink = true) { - super(message, tryNextLink); - this.tryNextLink = tryNextLink; - this.name = "TokenProviderError"; - Object.setPrototypeOf(this, _TokenProviderError2.prototype); + /** + * @returns cache key or false if not cachable. + */ + hash(endpointParams) { + let buffer = ""; + const { parameters } = this; + if (parameters.length === 0) { + return false; + } + for (const param of parameters) { + const val2 = String(endpointParams[param] ?? ""); + if (val2.includes("|;")) { + return false; + } + buffer += val2 + "|;"; + } + return buffer; } }; - __name(_TokenProviderError, "TokenProviderError"); - var TokenProviderError = _TokenProviderError; - var chain = /* @__PURE__ */ __name((...providers) => async () => { - if (providers.length === 0) { - throw new ProviderError("No providers in chain"); + __name(_EndpointCache, "EndpointCache"); + var EndpointCache = _EndpointCache; + var IP_V4_REGEX = new RegExp( + `^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$` + ); + var isIpAddress2 = /* @__PURE__ */ __name((value) => IP_V4_REGEX.test(value) || value.startsWith("[") && value.endsWith("]"), "isIpAddress"); + var VALID_HOST_LABEL_REGEX = new RegExp(`^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$`); + var isValidHostLabel = /* @__PURE__ */ __name((value, allowSubDomains = false) => { + if (!allowSubDomains) { + return VALID_HOST_LABEL_REGEX.test(value); } - let lastProviderError; - for (const provider of providers) { - try { - const credentials = await provider(); - return credentials; - } catch (err) { - lastProviderError = err; - if (err == null ? void 0 : err.tryNextLink) { - continue; - } - throw err; + const labels = value.split("."); + for (const label of labels) { + if (!isValidHostLabel(label)) { + return false; } } - throw lastProviderError; - }, "chain"); - var fromStatic = /* @__PURE__ */ __name((staticValue) => () => Promise.resolve(staticValue), "fromStatic"); - var memoize = /* @__PURE__ */ __name((provider, isExpired, requiresRefresh) => { - let resolved; - let pending; - let hasResult; - let isConstant = false; - const coalesceProvider = /* @__PURE__ */ __name(async () => { - if (!pending) { - pending = provider(); + return true; + }, "isValidHostLabel"); + var customEndpointFunctions = {}; + var debugId = "endpoints"; + function toDebugString(input) { + if (typeof input !== "object" || input == null) { + return input; + } + if ("ref" in input) { + return `$${toDebugString(input.ref)}`; + } + if ("fn" in input) { + return `${input.fn}(${(input.argv || []).map(toDebugString).join(", ")})`; + } + return JSON.stringify(input, null, 2); + } + __name(toDebugString, "toDebugString"); + var _EndpointError = class _EndpointError extends Error { + constructor(message) { + super(message); + this.name = "EndpointError"; + } + }; + __name(_EndpointError, "EndpointError"); + var EndpointError2 = _EndpointError; + var booleanEquals = /* @__PURE__ */ __name((value1, value2) => value1 === value2, "booleanEquals"); + var getAttrPathList = /* @__PURE__ */ __name((path) => { + const parts = path.split("."); + const pathList = []; + for (const part of parts) { + const squareBracketIndex = part.indexOf("["); + if (squareBracketIndex !== -1) { + if (part.indexOf("]") !== part.length - 1) { + throw new EndpointError2(`Path: '${path}' does not end with ']'`); + } + const arrayIndex = part.slice(squareBracketIndex + 1, -1); + if (Number.isNaN(parseInt(arrayIndex))) { + throw new EndpointError2(`Invalid array index: '${arrayIndex}' in path: '${path}'`); + } + if (squareBracketIndex !== 0) { + pathList.push(part.slice(0, squareBracketIndex)); + } + pathList.push(arrayIndex); + } else { + pathList.push(part); } + } + return pathList; + }, "getAttrPathList"); + var getAttr = /* @__PURE__ */ __name((value, path) => getAttrPathList(path).reduce((acc, index) => { + if (typeof acc !== "object") { + throw new EndpointError2(`Index '${index}' in '${path}' not found in '${JSON.stringify(value)}'`); + } else if (Array.isArray(acc)) { + return acc[parseInt(index)]; + } + return acc[index]; + }, value), "getAttr"); + var isSet = /* @__PURE__ */ __name((value) => value != null, "isSet"); + var not = /* @__PURE__ */ __name((value) => !value, "not"); + var import_types32 = require_dist_cjs(); + var DEFAULT_PORTS = { + [import_types32.EndpointURLScheme.HTTP]: 80, + [import_types32.EndpointURLScheme.HTTPS]: 443 + }; + var parseURL = /* @__PURE__ */ __name((value) => { + const whatwgURL = (() => { try { - resolved = await pending; - hasResult = true; - isConstant = false; - } finally { - pending = void 0; - } - return resolved; - }, "coalesceProvider"); - if (isExpired === void 0) { - return async (options) => { - if (!hasResult || (options == null ? void 0 : options.forceRefresh)) { - resolved = await coalesceProvider(); + if (value instanceof URL) { + return value; } - return resolved; - }; - } - return async (options) => { - if (!hasResult || (options == null ? void 0 : options.forceRefresh)) { - resolved = await coalesceProvider(); - } - if (isConstant) { - return resolved; - } - if (requiresRefresh && !requiresRefresh(resolved)) { - isConstant = true; - return resolved; + if (typeof value === "object" && "hostname" in value) { + const { hostname: hostname2, port, protocol: protocol2 = "", path = "", query = {} } = value; + const url2 = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path}`); + url2.search = Object.entries(query).map(([k, v]) => `${k}=${v}`).join("&"); + return url2; + } + return new URL(value); + } catch (error) { + return null; } - if (isExpired(resolved)) { - await coalesceProvider(); - return resolved; + })(); + if (!whatwgURL) { + console.error(`Unable to parse ${JSON.stringify(value)} as a whatwg URL.`); + return null; + } + const urlString = whatwgURL.href; + const { host, hostname, pathname, protocol, search } = whatwgURL; + if (search) { + return null; + } + const scheme = protocol.slice(0, -1); + if (!Object.values(import_types32.EndpointURLScheme).includes(scheme)) { + return null; + } + const isIp = isIpAddress2(hostname); + const inputContainsDefaultPort = urlString.includes(`${host}:${DEFAULT_PORTS[scheme]}`) || typeof value === "string" && value.includes(`${host}:${DEFAULT_PORTS[scheme]}`); + const authority = `${host}${inputContainsDefaultPort ? `:${DEFAULT_PORTS[scheme]}` : ``}`; + return { + scheme, + authority, + path: pathname, + normalizedPath: pathname.endsWith("/") ? pathname : `${pathname}/`, + isIp + }; + }, "parseURL"); + var stringEquals = /* @__PURE__ */ __name((value1, value2) => value1 === value2, "stringEquals"); + var substring = /* @__PURE__ */ __name((input, start, stop, reverse) => { + if (start >= stop || input.length < stop) { + return null; + } + if (!reverse) { + return input.substring(start, stop); + } + return input.substring(input.length - stop, input.length - start); + }, "substring"); + var uriEncode = /* @__PURE__ */ __name((value) => encodeURIComponent(value).replace(/[!*'()]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`), "uriEncode"); + var endpointFunctions = { + booleanEquals, + getAttr, + isSet, + isValidHostLabel, + not, + parseURL, + stringEquals, + substring, + uriEncode + }; + var evaluateTemplate = /* @__PURE__ */ __name((template, options) => { + const evaluatedTemplateArr = []; + const templateContext = { + ...options.endpointParams, + ...options.referenceRecord + }; + let currentIndex = 0; + while (currentIndex < template.length) { + const openingBraceIndex = template.indexOf("{", currentIndex); + if (openingBraceIndex === -1) { + evaluatedTemplateArr.push(template.slice(currentIndex)); + break; } - return resolved; + evaluatedTemplateArr.push(template.slice(currentIndex, openingBraceIndex)); + const closingBraceIndex = template.indexOf("}", openingBraceIndex); + if (closingBraceIndex === -1) { + evaluatedTemplateArr.push(template.slice(openingBraceIndex)); + break; + } + if (template[openingBraceIndex + 1] === "{" && template[closingBraceIndex + 1] === "}") { + evaluatedTemplateArr.push(template.slice(openingBraceIndex + 1, closingBraceIndex)); + currentIndex = closingBraceIndex + 2; + } + const parameterName = template.substring(openingBraceIndex + 1, closingBraceIndex); + if (parameterName.includes("#")) { + const [refName, attrName] = parameterName.split("#"); + evaluatedTemplateArr.push(getAttr(templateContext[refName], attrName)); + } else { + evaluatedTemplateArr.push(templateContext[parameterName]); + } + currentIndex = closingBraceIndex + 1; + } + return evaluatedTemplateArr.join(""); + }, "evaluateTemplate"); + var getReferenceValue = /* @__PURE__ */ __name(({ ref }, options) => { + const referenceRecord = { + ...options.endpointParams, + ...options.referenceRecord }; - }, "memoize"); - } -}); - -// ../../../node_modules/@smithy/util-middleware/dist-cjs/index.js -var require_dist_cjs7 = __commonJS({ - "../../../node_modules/@smithy/util-middleware/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + return referenceRecord[ref]; + }, "getReferenceValue"); + var evaluateExpression = /* @__PURE__ */ __name((obj, keyName, options) => { + if (typeof obj === "string") { + return evaluateTemplate(obj, options); + } else if (obj["fn"]) { + return callFunction(obj, options); + } else if (obj["ref"]) { + return getReferenceValue(obj, options); } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - getSmithyContext: () => getSmithyContext, - normalizeProvider: () => normalizeProvider - }); - module2.exports = __toCommonJS2(src_exports); - var import_types = require_dist_cjs(); - var getSmithyContext = /* @__PURE__ */ __name((context) => context[import_types.SMITHY_CONTEXT_KEY] || (context[import_types.SMITHY_CONTEXT_KEY] = {}), "getSmithyContext"); - var normalizeProvider = /* @__PURE__ */ __name((input) => { - if (typeof input === "function") - return input; - const promisified = Promise.resolve(input); - return () => promisified; - }, "normalizeProvider"); - } -}); - -// ../../../node_modules/@smithy/is-array-buffer/dist-cjs/index.js -var require_dist_cjs8 = __commonJS({ - "../../../node_modules/@smithy/is-array-buffer/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + throw new EndpointError2(`'${keyName}': ${String(obj)} is not a string, function or reference.`); + }, "evaluateExpression"); + var callFunction = /* @__PURE__ */ __name(({ fn, argv }, options) => { + const evaluatedArgs = argv.map( + (arg) => ["boolean", "number"].includes(typeof arg) ? arg : evaluateExpression(arg, "arg", options) + ); + const fnSegments = fn.split("."); + if (fnSegments[0] in customEndpointFunctions && fnSegments[1] != null) { + return customEndpointFunctions[fnSegments[0]][fnSegments[1]](...evaluatedArgs); } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - isArrayBuffer: () => isArrayBuffer - }); - module2.exports = __toCommonJS2(src_exports); - var isArrayBuffer = /* @__PURE__ */ __name((arg) => typeof ArrayBuffer === "function" && arg instanceof ArrayBuffer || Object.prototype.toString.call(arg) === "[object ArrayBuffer]", "isArrayBuffer"); + return endpointFunctions[fn](...evaluatedArgs); + }, "callFunction"); + var evaluateCondition = /* @__PURE__ */ __name(({ assign, ...fnArgs }, options) => { + var _a, _b; + if (assign && assign in options.referenceRecord) { + throw new EndpointError2(`'${assign}' is already defined in Reference Record.`); + } + const value = callFunction(fnArgs, options); + (_b = (_a = options.logger) == null ? void 0 : _a.debug) == null ? void 0 : _b.call(_a, `${debugId} evaluateCondition: ${toDebugString(fnArgs)} = ${toDebugString(value)}`); + return { + result: value === "" ? true : !!value, + ...assign != null && { toAssign: { name: assign, value } } + }; + }, "evaluateCondition"); + var evaluateConditions = /* @__PURE__ */ __name((conditions = [], options) => { + var _a, _b; + const conditionsReferenceRecord = {}; + for (const condition of conditions) { + const { result, toAssign } = evaluateCondition(condition, { + ...options, + referenceRecord: { + ...options.referenceRecord, + ...conditionsReferenceRecord + } + }); + if (!result) { + return { result }; + } + if (toAssign) { + conditionsReferenceRecord[toAssign.name] = toAssign.value; + (_b = (_a = options.logger) == null ? void 0 : _a.debug) == null ? void 0 : _b.call(_a, `${debugId} assign: ${toAssign.name} := ${toDebugString(toAssign.value)}`); + } + } + return { result: true, referenceRecord: conditionsReferenceRecord }; + }, "evaluateConditions"); + var getEndpointHeaders = /* @__PURE__ */ __name((headers, options) => Object.entries(headers).reduce( + (acc, [headerKey, headerVal]) => ({ + ...acc, + [headerKey]: headerVal.map((headerValEntry) => { + const processedExpr = evaluateExpression(headerValEntry, "Header value entry", options); + if (typeof processedExpr !== "string") { + throw new EndpointError2(`Header '${headerKey}' value '${processedExpr}' is not a string`); + } + return processedExpr; + }) + }), + {} + ), "getEndpointHeaders"); + var getEndpointProperty = /* @__PURE__ */ __name((property, options) => { + if (Array.isArray(property)) { + return property.map((propertyEntry) => getEndpointProperty(propertyEntry, options)); + } + switch (typeof property) { + case "string": + return evaluateTemplate(property, options); + case "object": + if (property === null) { + throw new EndpointError2(`Unexpected endpoint property: ${property}`); + } + return getEndpointProperties(property, options); + case "boolean": + return property; + default: + throw new EndpointError2(`Unexpected endpoint property type: ${typeof property}`); + } + }, "getEndpointProperty"); + var getEndpointProperties = /* @__PURE__ */ __name((properties, options) => Object.entries(properties).reduce( + (acc, [propertyKey, propertyVal]) => ({ + ...acc, + [propertyKey]: getEndpointProperty(propertyVal, options) + }), + {} + ), "getEndpointProperties"); + var getEndpointUrl = /* @__PURE__ */ __name((endpointUrl, options) => { + const expression = evaluateExpression(endpointUrl, "Endpoint URL", options); + if (typeof expression === "string") { + try { + return new URL(expression); + } catch (error) { + console.error(`Failed to construct URL with ${expression}`, error); + throw error; + } + } + throw new EndpointError2(`Endpoint URL must be a string, got ${typeof expression}`); + }, "getEndpointUrl"); + var evaluateEndpointRule = /* @__PURE__ */ __name((endpointRule, options) => { + var _a, _b; + const { conditions, endpoint } = endpointRule; + const { result, referenceRecord } = evaluateConditions(conditions, options); + if (!result) { + return; + } + const endpointRuleOptions = { + ...options, + referenceRecord: { ...options.referenceRecord, ...referenceRecord } + }; + const { url: url2, properties, headers } = endpoint; + (_b = (_a = options.logger) == null ? void 0 : _a.debug) == null ? void 0 : _b.call(_a, `${debugId} Resolving endpoint from template: ${toDebugString(endpoint)}`); + return { + ...headers != void 0 && { + headers: getEndpointHeaders(headers, endpointRuleOptions) + }, + ...properties != void 0 && { + properties: getEndpointProperties(properties, endpointRuleOptions) + }, + url: getEndpointUrl(url2, endpointRuleOptions) + }; + }, "evaluateEndpointRule"); + var evaluateErrorRule = /* @__PURE__ */ __name((errorRule, options) => { + const { conditions, error } = errorRule; + const { result, referenceRecord } = evaluateConditions(conditions, options); + if (!result) { + return; + } + throw new EndpointError2( + evaluateExpression(error, "Error", { + ...options, + referenceRecord: { ...options.referenceRecord, ...referenceRecord } + }) + ); + }, "evaluateErrorRule"); + var evaluateTreeRule = /* @__PURE__ */ __name((treeRule, options) => { + const { conditions, rules } = treeRule; + const { result, referenceRecord } = evaluateConditions(conditions, options); + if (!result) { + return; + } + return evaluateRules(rules, { + ...options, + referenceRecord: { ...options.referenceRecord, ...referenceRecord } + }); + }, "evaluateTreeRule"); + var evaluateRules = /* @__PURE__ */ __name((rules, options) => { + for (const rule of rules) { + if (rule.type === "endpoint") { + const endpointOrUndefined = evaluateEndpointRule(rule, options); + if (endpointOrUndefined) { + return endpointOrUndefined; + } + } else if (rule.type === "error") { + evaluateErrorRule(rule, options); + } else if (rule.type === "tree") { + const endpointOrUndefined = evaluateTreeRule(rule, options); + if (endpointOrUndefined) { + return endpointOrUndefined; + } + } else { + throw new EndpointError2(`Unknown endpoint rule: ${rule}`); + } + } + throw new EndpointError2(`Rules evaluation failed`); + }, "evaluateRules"); + var resolveEndpoint2 = /* @__PURE__ */ __name((ruleSetObject, options) => { + var _a, _b, _c, _d; + const { endpointParams, logger } = options; + const { parameters, rules } = ruleSetObject; + (_b = (_a = options.logger) == null ? void 0 : _a.debug) == null ? void 0 : _b.call(_a, `${debugId} Initial EndpointParams: ${toDebugString(endpointParams)}`); + const paramsWithDefault = Object.entries(parameters).filter(([, v]) => v.default != null).map(([k, v]) => [k, v.default]); + if (paramsWithDefault.length > 0) { + for (const [paramKey, paramDefaultValue] of paramsWithDefault) { + endpointParams[paramKey] = endpointParams[paramKey] ?? paramDefaultValue; + } + } + const requiredParams = Object.entries(parameters).filter(([, v]) => v.required).map(([k]) => k); + for (const requiredParam of requiredParams) { + if (endpointParams[requiredParam] == null) { + throw new EndpointError2(`Missing required parameter: '${requiredParam}'`); + } + } + const endpoint = evaluateRules(rules, { endpointParams, logger, referenceRecord: {} }); + (_d = (_c = options.logger) == null ? void 0 : _c.debug) == null ? void 0 : _d.call(_c, `${debugId} Resolved endpoint: ${toDebugString(endpoint)}`); + return endpoint; + }, "resolveEndpoint"); } }); -// ../../../node_modules/@smithy/util-buffer-from/dist-cjs/index.js -var require_dist_cjs9 = __commonJS({ - "../../../node_modules/@smithy/util-buffer-from/dist-cjs/index.js"(exports2, module2) { +// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/index.js +var require_dist_cjs7 = __commonJS({ + "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/index.js"(exports2, module2) { + "use strict"; var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames2 = Object.getOwnPropertyNames; @@ -2023,184 +1877,352 @@ var require_dist_cjs9 = __commonJS({ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var src_exports = {}; __export2(src_exports, { - fromArrayBuffer: () => fromArrayBuffer, - fromString: () => fromString + ConditionObject: () => import_util_endpoints.ConditionObject, + DeprecatedObject: () => import_util_endpoints.DeprecatedObject, + EndpointError: () => import_util_endpoints.EndpointError, + EndpointObject: () => import_util_endpoints.EndpointObject, + EndpointObjectHeaders: () => import_util_endpoints.EndpointObjectHeaders, + EndpointObjectProperties: () => import_util_endpoints.EndpointObjectProperties, + EndpointParams: () => import_util_endpoints.EndpointParams, + EndpointResolverOptions: () => import_util_endpoints.EndpointResolverOptions, + EndpointRuleObject: () => import_util_endpoints.EndpointRuleObject, + ErrorRuleObject: () => import_util_endpoints.ErrorRuleObject, + EvaluateOptions: () => import_util_endpoints.EvaluateOptions, + Expression: () => import_util_endpoints.Expression, + FunctionArgv: () => import_util_endpoints.FunctionArgv, + FunctionObject: () => import_util_endpoints.FunctionObject, + FunctionReturn: () => import_util_endpoints.FunctionReturn, + ParameterObject: () => import_util_endpoints.ParameterObject, + ReferenceObject: () => import_util_endpoints.ReferenceObject, + ReferenceRecord: () => import_util_endpoints.ReferenceRecord, + RuleSetObject: () => import_util_endpoints.RuleSetObject, + RuleSetRules: () => import_util_endpoints.RuleSetRules, + TreeRuleObject: () => import_util_endpoints.TreeRuleObject, + awsEndpointFunctions: () => awsEndpointFunctions, + getUserAgentPrefix: () => getUserAgentPrefix, + isIpAddress: () => import_util_endpoints.isIpAddress, + partition: () => partition, + resolveEndpoint: () => import_util_endpoints.resolveEndpoint, + setPartitionInfo: () => setPartitionInfo, + useDefaultPartitionInfo: () => useDefaultPartitionInfo }); module2.exports = __toCommonJS2(src_exports); - var import_is_array_buffer = require_dist_cjs8(); - var import_buffer = require("buffer"); - var fromArrayBuffer = /* @__PURE__ */ __name((input, offset = 0, length = input.byteLength - offset) => { - if (!(0, import_is_array_buffer.isArrayBuffer)(input)) { - throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof input} (${input})`); + var import_util_endpoints = require_dist_cjs6(); + var isVirtualHostableS3Bucket = /* @__PURE__ */ __name((value, allowSubDomains = false) => { + if (allowSubDomains) { + for (const label of value.split(".")) { + if (!isVirtualHostableS3Bucket(label)) { + return false; + } + } + return true; } - return import_buffer.Buffer.from(input, offset, length); - }, "fromArrayBuffer"); - var fromString = /* @__PURE__ */ __name((input, encoding) => { - if (typeof input !== "string") { - throw new TypeError(`The "input" argument must be of type string. Received type ${typeof input} (${input})`); + if (!(0, import_util_endpoints.isValidHostLabel)(value)) { + return false; } - return encoding ? import_buffer.Buffer.from(input, encoding) : import_buffer.Buffer.from(input); - }, "fromString"); - } -}); - -// ../../../node_modules/@smithy/util-utf8/dist-cjs/index.js -var require_dist_cjs10 = __commonJS({ - "../../../node_modules/@smithy/util-utf8/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - fromUtf8: () => fromUtf8, - toUint8Array: () => toUint8Array, - toUtf8: () => toUtf8 - }); - module2.exports = __toCommonJS2(src_exports); - var import_util_buffer_from = require_dist_cjs9(); - var fromUtf8 = /* @__PURE__ */ __name((input) => { - const buf = (0, import_util_buffer_from.fromString)(input, "utf8"); - return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength / Uint8Array.BYTES_PER_ELEMENT); - }, "fromUtf8"); - var toUint8Array = /* @__PURE__ */ __name((data) => { - if (typeof data === "string") { - return fromUtf8(data); - } - if (ArrayBuffer.isView(data)) { - return new Uint8Array(data.buffer, data.byteOffset, data.byteLength / Uint8Array.BYTES_PER_ELEMENT); - } - return new Uint8Array(data); - }, "toUint8Array"); - var toUtf8 = /* @__PURE__ */ __name((input) => { - if (typeof input === "string") { - return input; - } - if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") { - throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array."); - } - return (0, import_util_buffer_from.fromArrayBuffer)(input.buffer, input.byteOffset, input.byteLength).toString("utf8"); - }, "toUtf8"); - } -}); - -// ../../../node_modules/@smithy/util-hex-encoding/dist-cjs/index.js -var require_dist_cjs11 = __commonJS({ - "../../../node_modules/@smithy/util-hex-encoding/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + if (value.length < 3 || value.length > 63) { + return false; } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - fromHex: () => fromHex, - toHex: () => toHex - }); - module2.exports = __toCommonJS2(src_exports); - var SHORT_TO_HEX = {}; - var HEX_TO_SHORT = {}; - for (let i = 0; i < 256; i++) { - let encodedByte = i.toString(16).toLowerCase(); - if (encodedByte.length === 1) { - encodedByte = `0${encodedByte}`; + if (value !== value.toLowerCase()) { + return false; } - SHORT_TO_HEX[i] = encodedByte; - HEX_TO_SHORT[encodedByte] = i; - } - function fromHex(encoded) { - if (encoded.length % 2 !== 0) { - throw new Error("Hex encoded strings must have an even number length"); + if ((0, import_util_endpoints.isIpAddress)(value)) { + return false; } - const out = new Uint8Array(encoded.length / 2); - for (let i = 0; i < encoded.length; i += 2) { - const encodedByte = encoded.slice(i, i + 2).toLowerCase(); - if (encodedByte in HEX_TO_SHORT) { - out[i / 2] = HEX_TO_SHORT[encodedByte]; - } else { - throw new Error(`Cannot decode unrecognized sequence ${encodedByte} as hexadecimal`); + return true; + }, "isVirtualHostableS3Bucket"); + var ARN_DELIMITER = ":"; + var RESOURCE_DELIMITER = "/"; + var parseArn = /* @__PURE__ */ __name((value) => { + const segments = value.split(ARN_DELIMITER); + if (segments.length < 6) + return null; + const [arn, partition2, service, region, accountId, ...resourcePath] = segments; + if (arn !== "arn" || partition2 === "" || service === "" || resourcePath.join(ARN_DELIMITER) === "") + return null; + const resourceId = resourcePath.map((resource) => resource.split(RESOURCE_DELIMITER)).flat(); + return { + partition: partition2, + service, + region, + accountId, + resourceId + }; + }, "parseArn"); + var partitions_default = { + partitions: [{ + id: "aws", + outputs: { + dnsSuffix: "amazonaws.com", + dualStackDnsSuffix: "api.aws", + implicitGlobalRegion: "us-east-1", + name: "aws", + supportsDualStack: true, + supportsFIPS: true + }, + regionRegex: "^(us|eu|ap|sa|ca|me|af|il)\\-\\w+\\-\\d+$", + regions: { + "af-south-1": { + description: "Africa (Cape Town)" + }, + "ap-east-1": { + description: "Asia Pacific (Hong Kong)" + }, + "ap-northeast-1": { + description: "Asia Pacific (Tokyo)" + }, + "ap-northeast-2": { + description: "Asia Pacific (Seoul)" + }, + "ap-northeast-3": { + description: "Asia Pacific (Osaka)" + }, + "ap-south-1": { + description: "Asia Pacific (Mumbai)" + }, + "ap-south-2": { + description: "Asia Pacific (Hyderabad)" + }, + "ap-southeast-1": { + description: "Asia Pacific (Singapore)" + }, + "ap-southeast-2": { + description: "Asia Pacific (Sydney)" + }, + "ap-southeast-3": { + description: "Asia Pacific (Jakarta)" + }, + "ap-southeast-4": { + description: "Asia Pacific (Melbourne)" + }, + "aws-global": { + description: "AWS Standard global region" + }, + "ca-central-1": { + description: "Canada (Central)" + }, + "ca-west-1": { + description: "Canada West (Calgary)" + }, + "eu-central-1": { + description: "Europe (Frankfurt)" + }, + "eu-central-2": { + description: "Europe (Zurich)" + }, + "eu-north-1": { + description: "Europe (Stockholm)" + }, + "eu-south-1": { + description: "Europe (Milan)" + }, + "eu-south-2": { + description: "Europe (Spain)" + }, + "eu-west-1": { + description: "Europe (Ireland)" + }, + "eu-west-2": { + description: "Europe (London)" + }, + "eu-west-3": { + description: "Europe (Paris)" + }, + "il-central-1": { + description: "Israel (Tel Aviv)" + }, + "me-central-1": { + description: "Middle East (UAE)" + }, + "me-south-1": { + description: "Middle East (Bahrain)" + }, + "sa-east-1": { + description: "South America (Sao Paulo)" + }, + "us-east-1": { + description: "US East (N. Virginia)" + }, + "us-east-2": { + description: "US East (Ohio)" + }, + "us-west-1": { + description: "US West (N. California)" + }, + "us-west-2": { + description: "US West (Oregon)" + } } - } - return out; - } - __name(fromHex, "fromHex"); - function toHex(bytes) { - let out = ""; - for (let i = 0; i < bytes.byteLength; i++) { - out += SHORT_TO_HEX[bytes[i]]; - } - return out; - } - __name(toHex, "toHex"); - } -}); - -// ../../../node_modules/@smithy/util-uri-escape/dist-cjs/index.js -var require_dist_cjs12 = __commonJS({ - "../../../node_modules/@smithy/util-uri-escape/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - escapeUri: () => escapeUri, - escapeUriPath: () => escapeUriPath - }); - module2.exports = __toCommonJS2(src_exports); - var escapeUri = /* @__PURE__ */ __name((uri) => ( - // AWS percent-encodes some extra non-standard characters in a URI - encodeURIComponent(uri).replace(/[!'()*]/g, hexEncode) - ), "escapeUri"); - var hexEncode = /* @__PURE__ */ __name((c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`, "hexEncode"); - var escapeUriPath = /* @__PURE__ */ __name((uri) => uri.split("/").map(escapeUri).join("/"), "escapeUriPath"); + }, { + id: "aws-cn", + outputs: { + dnsSuffix: "amazonaws.com.cn", + dualStackDnsSuffix: "api.amazonwebservices.com.cn", + implicitGlobalRegion: "cn-northwest-1", + name: "aws-cn", + supportsDualStack: true, + supportsFIPS: true + }, + regionRegex: "^cn\\-\\w+\\-\\d+$", + regions: { + "aws-cn-global": { + description: "AWS China global region" + }, + "cn-north-1": { + description: "China (Beijing)" + }, + "cn-northwest-1": { + description: "China (Ningxia)" + } + } + }, { + id: "aws-us-gov", + outputs: { + dnsSuffix: "amazonaws.com", + dualStackDnsSuffix: "api.aws", + implicitGlobalRegion: "us-gov-west-1", + name: "aws-us-gov", + supportsDualStack: true, + supportsFIPS: true + }, + regionRegex: "^us\\-gov\\-\\w+\\-\\d+$", + regions: { + "aws-us-gov-global": { + description: "AWS GovCloud (US) global region" + }, + "us-gov-east-1": { + description: "AWS GovCloud (US-East)" + }, + "us-gov-west-1": { + description: "AWS GovCloud (US-West)" + } + } + }, { + id: "aws-iso", + outputs: { + dnsSuffix: "c2s.ic.gov", + dualStackDnsSuffix: "c2s.ic.gov", + implicitGlobalRegion: "us-iso-east-1", + name: "aws-iso", + supportsDualStack: false, + supportsFIPS: true + }, + regionRegex: "^us\\-iso\\-\\w+\\-\\d+$", + regions: { + "aws-iso-global": { + description: "AWS ISO (US) global region" + }, + "us-iso-east-1": { + description: "US ISO East" + }, + "us-iso-west-1": { + description: "US ISO WEST" + } + } + }, { + id: "aws-iso-b", + outputs: { + dnsSuffix: "sc2s.sgov.gov", + dualStackDnsSuffix: "sc2s.sgov.gov", + implicitGlobalRegion: "us-isob-east-1", + name: "aws-iso-b", + supportsDualStack: false, + supportsFIPS: true + }, + regionRegex: "^us\\-isob\\-\\w+\\-\\d+$", + regions: { + "aws-iso-b-global": { + description: "AWS ISOB (US) global region" + }, + "us-isob-east-1": { + description: "US ISOB East (Ohio)" + } + } + }, { + id: "aws-iso-e", + outputs: { + dnsSuffix: "cloud.adc-e.uk", + dualStackDnsSuffix: "cloud.adc-e.uk", + implicitGlobalRegion: "eu-isoe-west-1", + name: "aws-iso-e", + supportsDualStack: false, + supportsFIPS: true + }, + regionRegex: "^eu\\-isoe\\-\\w+\\-\\d+$", + regions: { + "eu-isoe-west-1": { + description: "EU ISOE West" + } + } + }, { + id: "aws-iso-f", + outputs: { + dnsSuffix: "csp.hci.ic.gov", + dualStackDnsSuffix: "csp.hci.ic.gov", + implicitGlobalRegion: "us-isof-south-1", + name: "aws-iso-f", + supportsDualStack: false, + supportsFIPS: true + }, + regionRegex: "^us\\-isof\\-\\w+\\-\\d+$", + regions: {} + }], + version: "1.1" + }; + var selectedPartitionsInfo = partitions_default; + var selectedUserAgentPrefix = ""; + var partition = /* @__PURE__ */ __name((value) => { + const { partitions } = selectedPartitionsInfo; + for (const partition2 of partitions) { + const { regions, outputs } = partition2; + for (const [region, regionData] of Object.entries(regions)) { + if (region === value) { + return { + ...outputs, + ...regionData + }; + } + } + } + for (const partition2 of partitions) { + const { regionRegex, outputs } = partition2; + if (new RegExp(regionRegex).test(value)) { + return { + ...outputs + }; + } + } + const DEFAULT_PARTITION = partitions.find((partition2) => partition2.id === "aws"); + if (!DEFAULT_PARTITION) { + throw new Error( + "Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist." + ); + } + return { + ...DEFAULT_PARTITION.outputs + }; + }, "partition"); + var setPartitionInfo = /* @__PURE__ */ __name((partitionsInfo, userAgentPrefix = "") => { + selectedPartitionsInfo = partitionsInfo; + selectedUserAgentPrefix = userAgentPrefix; + }, "setPartitionInfo"); + var useDefaultPartitionInfo = /* @__PURE__ */ __name(() => { + setPartitionInfo(partitions_default, ""); + }, "useDefaultPartitionInfo"); + var getUserAgentPrefix = /* @__PURE__ */ __name(() => selectedUserAgentPrefix, "getUserAgentPrefix"); + var awsEndpointFunctions = { + isVirtualHostableS3Bucket, + parseArn, + partition + }; + import_util_endpoints.customEndpointFunctions.aws = awsEndpointFunctions; } }); -// ../../../node_modules/@smithy/signature-v4/dist-cjs/index.js -var require_dist_cjs13 = __commonJS({ - "../../../node_modules/@smithy/signature-v4/dist-cjs/index.js"(exports2, module2) { +// ../../../node_modules/@aws-sdk/middleware-user-agent/dist-cjs/index.js +var require_dist_cjs8 = __commonJS({ + "../../../node_modules/@aws-sdk/middleware-user-agent/dist-cjs/index.js"(exports2, module2) { + "use strict"; var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames2 = Object.getOwnPropertyNames; @@ -2221,2442 +2243,1766 @@ var require_dist_cjs13 = __commonJS({ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var src_exports = {}; __export2(src_exports, { - SignatureV4: () => SignatureV4, - clearCredentialCache: () => clearCredentialCache, - createScope: () => createScope, - getCanonicalHeaders: () => getCanonicalHeaders, - getCanonicalQuery: () => getCanonicalQuery, - getPayloadHash: () => getPayloadHash, - getSigningKey: () => getSigningKey, - moveHeadersToQuery: () => moveHeadersToQuery, - prepareRequest: () => prepareRequest + getUserAgentMiddlewareOptions: () => getUserAgentMiddlewareOptions, + getUserAgentPlugin: () => getUserAgentPlugin, + resolveUserAgentConfig: () => resolveUserAgentConfig, + userAgentMiddleware: () => userAgentMiddleware }); module2.exports = __toCommonJS2(src_exports); - var import_util_middleware = require_dist_cjs7(); - var import_util_utf84 = require_dist_cjs10(); - var ALGORITHM_QUERY_PARAM = "X-Amz-Algorithm"; - var CREDENTIAL_QUERY_PARAM = "X-Amz-Credential"; - var AMZ_DATE_QUERY_PARAM = "X-Amz-Date"; - var SIGNED_HEADERS_QUERY_PARAM = "X-Amz-SignedHeaders"; - var EXPIRES_QUERY_PARAM = "X-Amz-Expires"; - var SIGNATURE_QUERY_PARAM = "X-Amz-Signature"; - var TOKEN_QUERY_PARAM = "X-Amz-Security-Token"; - var AUTH_HEADER = "authorization"; - var AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase(); - var DATE_HEADER = "date"; - var GENERATED_HEADERS = [AUTH_HEADER, AMZ_DATE_HEADER, DATE_HEADER]; - var SIGNATURE_HEADER = SIGNATURE_QUERY_PARAM.toLowerCase(); - var SHA256_HEADER = "x-amz-content-sha256"; - var TOKEN_HEADER = TOKEN_QUERY_PARAM.toLowerCase(); - var ALWAYS_UNSIGNABLE_HEADERS = { - authorization: true, - "cache-control": true, - connection: true, - expect: true, - from: true, - "keep-alive": true, - "max-forwards": true, - pragma: true, - referer: true, - te: true, - trailer: true, - "transfer-encoding": true, - upgrade: true, - "user-agent": true, - "x-amzn-trace-id": true - }; - var PROXY_HEADER_PATTERN = /^proxy-/; - var SEC_HEADER_PATTERN = /^sec-/; - var ALGORITHM_IDENTIFIER = "AWS4-HMAC-SHA256"; - var EVENT_ALGORITHM_IDENTIFIER = "AWS4-HMAC-SHA256-PAYLOAD"; - var UNSIGNED_PAYLOAD = "UNSIGNED-PAYLOAD"; - var MAX_CACHE_SIZE = 50; - var KEY_TYPE_IDENTIFIER = "aws4_request"; - var MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7; - var import_util_hex_encoding = require_dist_cjs11(); - var import_util_utf8 = require_dist_cjs10(); - var signingKeyCache = {}; - var cacheQueue = []; - var createScope = /* @__PURE__ */ __name((shortDate, region, service) => `${shortDate}/${region}/${service}/${KEY_TYPE_IDENTIFIER}`, "createScope"); - var getSigningKey = /* @__PURE__ */ __name(async (sha256Constructor, credentials, shortDate, region, service) => { - const credsHash = await hmac(sha256Constructor, credentials.secretAccessKey, credentials.accessKeyId); - const cacheKey = `${shortDate}:${region}:${service}:${(0, import_util_hex_encoding.toHex)(credsHash)}:${credentials.sessionToken}`; - if (cacheKey in signingKeyCache) { - return signingKeyCache[cacheKey]; - } - cacheQueue.push(cacheKey); - while (cacheQueue.length > MAX_CACHE_SIZE) { - delete signingKeyCache[cacheQueue.shift()]; - } - let key = `AWS4${credentials.secretAccessKey}`; - for (const signable of [shortDate, region, service, KEY_TYPE_IDENTIFIER]) { - key = await hmac(sha256Constructor, key, signable); + function resolveUserAgentConfig(input) { + return { + ...input, + customUserAgent: typeof input.customUserAgent === "string" ? [[input.customUserAgent]] : input.customUserAgent + }; + } + __name(resolveUserAgentConfig, "resolveUserAgentConfig"); + var import_util_endpoints = require_dist_cjs7(); + var import_protocol_http8 = require_dist_cjs2(); + var USER_AGENT = "user-agent"; + var X_AMZ_USER_AGENT = "x-amz-user-agent"; + var SPACE = " "; + var UA_NAME_SEPARATOR = "/"; + var UA_NAME_ESCAPE_REGEX = /[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g; + var UA_VALUE_ESCAPE_REGEX = /[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g; + var UA_ESCAPE_CHAR = "-"; + var userAgentMiddleware = /* @__PURE__ */ __name((options) => (next, context) => async (args) => { + var _a, _b; + const { request: request2 } = args; + if (!import_protocol_http8.HttpRequest.isInstance(request2)) + return next(args); + const { headers } = request2; + const userAgent = ((_a = context == null ? void 0 : context.userAgent) == null ? void 0 : _a.map(escapeUserAgent)) || []; + const defaultUserAgent = (await options.defaultUserAgentProvider()).map(escapeUserAgent); + const customUserAgent = ((_b = options == null ? void 0 : options.customUserAgent) == null ? void 0 : _b.map(escapeUserAgent)) || []; + const prefix = (0, import_util_endpoints.getUserAgentPrefix)(); + const sdkUserAgentValue = (prefix ? [prefix] : []).concat([...defaultUserAgent, ...userAgent, ...customUserAgent]).join(SPACE); + const normalUAValue = [ + ...defaultUserAgent.filter((section) => section.startsWith("aws-sdk-")), + ...customUserAgent + ].join(SPACE); + if (options.runtime !== "browser") { + if (normalUAValue) { + headers[X_AMZ_USER_AGENT] = headers[X_AMZ_USER_AGENT] ? `${headers[USER_AGENT]} ${normalUAValue}` : normalUAValue; + } + headers[USER_AGENT] = sdkUserAgentValue; + } else { + headers[X_AMZ_USER_AGENT] = sdkUserAgentValue; } - return signingKeyCache[cacheKey] = key; - }, "getSigningKey"); - var clearCredentialCache = /* @__PURE__ */ __name(() => { - cacheQueue.length = 0; - Object.keys(signingKeyCache).forEach((cacheKey) => { - delete signingKeyCache[cacheKey]; + return next({ + ...args, + request: request2 }); - }, "clearCredentialCache"); - var hmac = /* @__PURE__ */ __name((ctor, secret, data) => { - const hash = new ctor(secret); - hash.update((0, import_util_utf8.toUint8Array)(data)); - return hash.digest(); - }, "hmac"); - var getCanonicalHeaders = /* @__PURE__ */ __name(({ headers }, unsignableHeaders, signableHeaders) => { - const canonical = {}; - for (const headerName of Object.keys(headers).sort()) { - if (headers[headerName] == void 0) { - continue; - } - const canonicalHeaderName = headerName.toLowerCase(); - if (canonicalHeaderName in ALWAYS_UNSIGNABLE_HEADERS || (unsignableHeaders == null ? void 0 : unsignableHeaders.has(canonicalHeaderName)) || PROXY_HEADER_PATTERN.test(canonicalHeaderName) || SEC_HEADER_PATTERN.test(canonicalHeaderName)) { - if (!signableHeaders || signableHeaders && !signableHeaders.has(canonicalHeaderName)) { - continue; - } - } - canonical[canonicalHeaderName] = headers[headerName].trim().replace(/\s+/g, " "); + }, "userAgentMiddleware"); + var escapeUserAgent = /* @__PURE__ */ __name((userAgentPair) => { + var _a; + const name = userAgentPair[0].split(UA_NAME_SEPARATOR).map((part) => part.replace(UA_NAME_ESCAPE_REGEX, UA_ESCAPE_CHAR)).join(UA_NAME_SEPARATOR); + const version2 = (_a = userAgentPair[1]) == null ? void 0 : _a.replace(UA_VALUE_ESCAPE_REGEX, UA_ESCAPE_CHAR); + const prefixSeparatorIndex = name.indexOf(UA_NAME_SEPARATOR); + const prefix = name.substring(0, prefixSeparatorIndex); + let uaName = name.substring(prefixSeparatorIndex + 1); + if (prefix === "api") { + uaName = uaName.toLowerCase(); } - return canonical; - }, "getCanonicalHeaders"); - var import_util_uri_escape = require_dist_cjs12(); - var getCanonicalQuery = /* @__PURE__ */ __name(({ query = {} }) => { - const keys = []; - const serialized = {}; - for (const key of Object.keys(query).sort()) { - if (key.toLowerCase() === SIGNATURE_HEADER) { - continue; - } - keys.push(key); - const value = query[key]; - if (typeof value === "string") { - serialized[key] = `${(0, import_util_uri_escape.escapeUri)(key)}=${(0, import_util_uri_escape.escapeUri)(value)}`; - } else if (Array.isArray(value)) { - serialized[key] = value.slice(0).reduce( - (encoded, value2) => encoded.concat([`${(0, import_util_uri_escape.escapeUri)(key)}=${(0, import_util_uri_escape.escapeUri)(value2)}`]), - [] - ).sort().join("&"); + return [prefix, uaName, version2].filter((item) => item && item.length > 0).reduce((acc, item, index) => { + switch (index) { + case 0: + return item; + case 1: + return `${acc}/${item}`; + default: + return `${acc}#${item}`; } + }, ""); + }, "escapeUserAgent"); + var getUserAgentMiddlewareOptions = { + name: "getUserAgentMiddleware", + step: "build", + priority: "low", + tags: ["SET_USER_AGENT", "USER_AGENT"], + override: true + }; + var getUserAgentPlugin = /* @__PURE__ */ __name((config) => ({ + applyToStack: (clientStack) => { + clientStack.add(userAgentMiddleware(config), getUserAgentMiddlewareOptions); } - return keys.map((key) => serialized[key]).filter((serialized2) => serialized2).join("&"); - }, "getCanonicalQuery"); - var import_is_array_buffer = require_dist_cjs8(); - var import_util_utf82 = require_dist_cjs10(); - var getPayloadHash = /* @__PURE__ */ __name(async ({ headers, body }, hashConstructor) => { - for (const headerName of Object.keys(headers)) { - if (headerName.toLowerCase() === SHA256_HEADER) { - return headers[headerName]; - } + }), "getUserAgentPlugin"); + } +}); + +// ../../../node_modules/@smithy/util-config-provider/dist-cjs/index.js +var require_dist_cjs9 = __commonJS({ + "../../../node_modules/@smithy/util-config-provider/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - if (body == void 0) { - return "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; - } else if (typeof body === "string" || ArrayBuffer.isView(body) || (0, import_is_array_buffer.isArrayBuffer)(body)) { - const hashCtor = new hashConstructor(); - hashCtor.update((0, import_util_utf82.toUint8Array)(body)); - return (0, import_util_hex_encoding.toHex)(await hashCtor.digest()); + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + SelectorType: () => SelectorType, + booleanSelector: () => booleanSelector, + numberSelector: () => numberSelector + }); + module2.exports = __toCommonJS2(src_exports); + var booleanSelector = /* @__PURE__ */ __name((obj, key, type) => { + if (!(key in obj)) + return void 0; + if (obj[key] === "true") + return true; + if (obj[key] === "false") + return false; + throw new Error(`Cannot load ${type} "${key}". Expected "true" or "false", got ${obj[key]}.`); + }, "booleanSelector"); + var numberSelector = /* @__PURE__ */ __name((obj, key, type) => { + if (!(key in obj)) + return void 0; + const numberValue = parseInt(obj[key], 10); + if (Number.isNaN(numberValue)) { + throw new TypeError(`Cannot load ${type} '${key}'. Expected number, got '${obj[key]}'.`); } - return UNSIGNED_PAYLOAD; - }, "getPayloadHash"); - var import_util_utf83 = require_dist_cjs10(); - var _HeaderFormatter = class _HeaderFormatter { - format(headers) { - const chunks = []; - for (const headerName of Object.keys(headers)) { - const bytes = (0, import_util_utf83.fromUtf8)(headerName); - chunks.push(Uint8Array.from([bytes.byteLength]), bytes, this.formatHeaderValue(headers[headerName])); - } - const out = new Uint8Array(chunks.reduce((carry, bytes) => carry + bytes.byteLength, 0)); - let position = 0; - for (const chunk of chunks) { - out.set(chunk, position); - position += chunk.byteLength; - } - return out; + return numberValue; + }, "numberSelector"); + var SelectorType = /* @__PURE__ */ ((SelectorType2) => { + SelectorType2["ENV"] = "env"; + SelectorType2["CONFIG"] = "shared config entry"; + return SelectorType2; + })(SelectorType || {}); + } +}); + +// ../../../node_modules/@smithy/util-middleware/dist-cjs/index.js +var require_dist_cjs10 = __commonJS({ + "../../../node_modules/@smithy/util-middleware/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - formatHeaderValue(header) { - switch (header.type) { - case "boolean": - return Uint8Array.from([ - header.value ? 0 : 1 - /* boolFalse */ - ]); - case "byte": - return Uint8Array.from([2, header.value]); - case "short": - const shortView = new DataView(new ArrayBuffer(3)); - shortView.setUint8( - 0, - 3 - /* short */ - ); - shortView.setInt16(1, header.value, false); - return new Uint8Array(shortView.buffer); - case "integer": - const intView = new DataView(new ArrayBuffer(5)); - intView.setUint8( - 0, - 4 - /* integer */ - ); - intView.setInt32(1, header.value, false); - return new Uint8Array(intView.buffer); - case "long": - const longBytes = new Uint8Array(9); - longBytes[0] = 5; - longBytes.set(header.value.bytes, 1); - return longBytes; - case "binary": - const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength)); - binView.setUint8( - 0, - 6 - /* byteArray */ - ); - binView.setUint16(1, header.value.byteLength, false); - const binBytes = new Uint8Array(binView.buffer); - binBytes.set(header.value, 3); - return binBytes; - case "string": - const utf8Bytes = (0, import_util_utf83.fromUtf8)(header.value); - const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength)); - strView.setUint8( - 0, - 7 - /* string */ - ); - strView.setUint16(1, utf8Bytes.byteLength, false); - const strBytes = new Uint8Array(strView.buffer); - strBytes.set(utf8Bytes, 3); - return strBytes; - case "timestamp": - const tsBytes = new Uint8Array(9); - tsBytes[0] = 8; - tsBytes.set(Int64.fromNumber(header.value.valueOf()).bytes, 1); - return tsBytes; - case "uuid": - if (!UUID_PATTERN.test(header.value)) { - throw new Error(`Invalid UUID received: ${header.value}`); - } - const uuidBytes = new Uint8Array(17); - uuidBytes[0] = 9; - uuidBytes.set((0, import_util_hex_encoding.fromHex)(header.value.replace(/\-/g, "")), 1); - return uuidBytes; - } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + getSmithyContext: () => getSmithyContext4, + normalizeProvider: () => normalizeProvider2 + }); + module2.exports = __toCommonJS2(src_exports); + var import_types5 = require_dist_cjs(); + var getSmithyContext4 = /* @__PURE__ */ __name((context) => context[import_types5.SMITHY_CONTEXT_KEY] || (context[import_types5.SMITHY_CONTEXT_KEY] = {}), "getSmithyContext"); + var normalizeProvider2 = /* @__PURE__ */ __name((input) => { + if (typeof input === "function") + return input; + const promisified = Promise.resolve(input); + return () => promisified; + }, "normalizeProvider"); + } +}); + +// ../../../node_modules/@smithy/config-resolver/dist-cjs/index.js +var require_dist_cjs11 = __commonJS({ + "../../../node_modules/@smithy/config-resolver/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - __name(_HeaderFormatter, "HeaderFormatter"); - var HeaderFormatter = _HeaderFormatter; - var UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/; - var _Int64 = class _Int642 { - constructor(bytes) { - this.bytes = bytes; - if (bytes.byteLength !== 8) { - throw new Error("Int64 buffers must be exactly 8 bytes"); - } - } - static fromNumber(number) { - if (number > 9223372036854776e3 || number < -9223372036854776e3) { - throw new Error(`${number} is too large (or, if negative, too small) to represent as an Int64`); - } - const bytes = new Uint8Array(8); - for (let i = 7, remaining = Math.abs(Math.round(number)); i > -1 && remaining > 0; i--, remaining /= 256) { - bytes[i] = remaining; - } - if (number < 0) { - negate(bytes); - } - return new _Int642(bytes); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + CONFIG_USE_DUALSTACK_ENDPOINT: () => CONFIG_USE_DUALSTACK_ENDPOINT, + CONFIG_USE_FIPS_ENDPOINT: () => CONFIG_USE_FIPS_ENDPOINT, + DEFAULT_USE_DUALSTACK_ENDPOINT: () => DEFAULT_USE_DUALSTACK_ENDPOINT, + DEFAULT_USE_FIPS_ENDPOINT: () => DEFAULT_USE_FIPS_ENDPOINT, + ENV_USE_DUALSTACK_ENDPOINT: () => ENV_USE_DUALSTACK_ENDPOINT, + ENV_USE_FIPS_ENDPOINT: () => ENV_USE_FIPS_ENDPOINT, + NODE_REGION_CONFIG_FILE_OPTIONS: () => NODE_REGION_CONFIG_FILE_OPTIONS, + NODE_REGION_CONFIG_OPTIONS: () => NODE_REGION_CONFIG_OPTIONS, + NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS: () => NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, + NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS: () => NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, + REGION_ENV_NAME: () => REGION_ENV_NAME, + REGION_INI_NAME: () => REGION_INI_NAME, + getRegionInfo: () => getRegionInfo, + resolveCustomEndpointsConfig: () => resolveCustomEndpointsConfig, + resolveEndpointsConfig: () => resolveEndpointsConfig, + resolveRegionConfig: () => resolveRegionConfig + }); + module2.exports = __toCommonJS2(src_exports); + var import_util_config_provider = require_dist_cjs9(); + var ENV_USE_DUALSTACK_ENDPOINT = "AWS_USE_DUALSTACK_ENDPOINT"; + var CONFIG_USE_DUALSTACK_ENDPOINT = "use_dualstack_endpoint"; + var DEFAULT_USE_DUALSTACK_ENDPOINT = false; + var NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => (0, import_util_config_provider.booleanSelector)(env, ENV_USE_DUALSTACK_ENDPOINT, import_util_config_provider.SelectorType.ENV), + configFileSelector: (profile) => (0, import_util_config_provider.booleanSelector)(profile, CONFIG_USE_DUALSTACK_ENDPOINT, import_util_config_provider.SelectorType.CONFIG), + default: false + }; + var ENV_USE_FIPS_ENDPOINT = "AWS_USE_FIPS_ENDPOINT"; + var CONFIG_USE_FIPS_ENDPOINT = "use_fips_endpoint"; + var DEFAULT_USE_FIPS_ENDPOINT = false; + var NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => (0, import_util_config_provider.booleanSelector)(env, ENV_USE_FIPS_ENDPOINT, import_util_config_provider.SelectorType.ENV), + configFileSelector: (profile) => (0, import_util_config_provider.booleanSelector)(profile, CONFIG_USE_FIPS_ENDPOINT, import_util_config_provider.SelectorType.CONFIG), + default: false + }; + var import_util_middleware3 = require_dist_cjs10(); + var resolveCustomEndpointsConfig = /* @__PURE__ */ __name((input) => { + const { endpoint, urlParser } = input; + return { + ...input, + tls: input.tls ?? true, + endpoint: (0, import_util_middleware3.normalizeProvider)(typeof endpoint === "string" ? urlParser(endpoint) : endpoint), + isCustomEndpoint: true, + useDualstackEndpoint: (0, import_util_middleware3.normalizeProvider)(input.useDualstackEndpoint ?? false) + }; + }, "resolveCustomEndpointsConfig"); + var getEndpointFromRegion = /* @__PURE__ */ __name(async (input) => { + const { tls = true } = input; + const region = await input.region(); + const dnsHostRegex = new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/); + if (!dnsHostRegex.test(region)) { + throw new Error("Invalid region in client config"); } - /** - * Called implicitly by infix arithmetic operators. - */ - valueOf() { - const bytes = this.bytes.slice(0); - const negative = bytes[0] & 128; - if (negative) { - negate(bytes); - } - return parseInt((0, import_util_hex_encoding.toHex)(bytes), 16) * (negative ? -1 : 1); + const useDualstackEndpoint = await input.useDualstackEndpoint(); + const useFipsEndpoint = await input.useFipsEndpoint(); + const { hostname } = await input.regionInfoProvider(region, { useDualstackEndpoint, useFipsEndpoint }) ?? {}; + if (!hostname) { + throw new Error("Cannot resolve hostname from client config"); } - toString() { - return String(this.valueOf()); + return input.urlParser(`${tls ? "https:" : "http:"}//${hostname}`); + }, "getEndpointFromRegion"); + var resolveEndpointsConfig = /* @__PURE__ */ __name((input) => { + const useDualstackEndpoint = (0, import_util_middleware3.normalizeProvider)(input.useDualstackEndpoint ?? false); + const { endpoint, useFipsEndpoint, urlParser } = input; + return { + ...input, + tls: input.tls ?? true, + endpoint: endpoint ? (0, import_util_middleware3.normalizeProvider)(typeof endpoint === "string" ? urlParser(endpoint) : endpoint) : () => getEndpointFromRegion({ ...input, useDualstackEndpoint, useFipsEndpoint }), + isCustomEndpoint: !!endpoint, + useDualstackEndpoint + }; + }, "resolveEndpointsConfig"); + var REGION_ENV_NAME = "AWS_REGION"; + var REGION_INI_NAME = "region"; + var NODE_REGION_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => env[REGION_ENV_NAME], + configFileSelector: (profile) => profile[REGION_INI_NAME], + default: () => { + throw new Error("Region is missing"); } }; - __name(_Int64, "Int64"); - var Int64 = _Int64; - function negate(bytes) { - for (let i = 0; i < 8; i++) { - bytes[i] ^= 255; - } - for (let i = 7; i > -1; i--) { - bytes[i]++; - if (bytes[i] !== 0) - break; - } - } - __name(negate, "negate"); - var hasHeader = /* @__PURE__ */ __name((soughtHeader, headers) => { - soughtHeader = soughtHeader.toLowerCase(); - for (const headerName of Object.keys(headers)) { - if (soughtHeader === headerName.toLowerCase()) { - return true; - } + var NODE_REGION_CONFIG_FILE_OPTIONS = { + preferredFile: "credentials" + }; + var isFipsRegion = /* @__PURE__ */ __name((region) => typeof region === "string" && (region.startsWith("fips-") || region.endsWith("-fips")), "isFipsRegion"); + var getRealRegion = /* @__PURE__ */ __name((region) => isFipsRegion(region) ? ["fips-aws-global", "aws-fips"].includes(region) ? "us-east-1" : region.replace(/fips-(dkr-|prod-)?|-fips/, "") : region, "getRealRegion"); + var resolveRegionConfig = /* @__PURE__ */ __name((input) => { + const { region, useFipsEndpoint } = input; + if (!region) { + throw new Error("Region is missing"); } - return false; - }, "hasHeader"); - var cloneRequest = /* @__PURE__ */ __name(({ headers, query, ...rest }) => ({ - ...rest, - headers: { ...headers }, - query: query ? cloneQuery(query) : void 0 - }), "cloneRequest"); - var cloneQuery = /* @__PURE__ */ __name((query) => Object.keys(query).reduce((carry, paramName) => { - const param = query[paramName]; return { - ...carry, - [paramName]: Array.isArray(param) ? [...param] : param + ...input, + region: async () => { + if (typeof region === "string") { + return getRealRegion(region); + } + const providedRegion = await region(); + return getRealRegion(providedRegion); + }, + useFipsEndpoint: async () => { + const providedRegion = typeof region === "string" ? region : await region(); + if (isFipsRegion(providedRegion)) { + return true; + } + return typeof useFipsEndpoint !== "function" ? Promise.resolve(!!useFipsEndpoint) : useFipsEndpoint(); + } }; - }, {}), "cloneQuery"); - var moveHeadersToQuery = /* @__PURE__ */ __name((request2, options = {}) => { + }, "resolveRegionConfig"); + var getHostnameFromVariants = /* @__PURE__ */ __name((variants = [], { useFipsEndpoint, useDualstackEndpoint }) => { var _a; - const { headers, query = {} } = typeof request2.clone === "function" ? request2.clone() : cloneRequest(request2); - for (const name of Object.keys(headers)) { - const lname = name.toLowerCase(); - if (lname.slice(0, 6) === "x-amz-" && !((_a = options.unhoistableHeaders) == null ? void 0 : _a.has(lname))) { - query[name] = headers[name]; - delete headers[name]; + return (_a = variants.find( + ({ tags }) => useFipsEndpoint === tags.includes("fips") && useDualstackEndpoint === tags.includes("dualstack") + )) == null ? void 0 : _a.hostname; + }, "getHostnameFromVariants"); + var getResolvedHostname = /* @__PURE__ */ __name((resolvedRegion, { regionHostname, partitionHostname }) => regionHostname ? regionHostname : partitionHostname ? partitionHostname.replace("{region}", resolvedRegion) : void 0, "getResolvedHostname"); + var getResolvedPartition = /* @__PURE__ */ __name((region, { partitionHash }) => Object.keys(partitionHash || {}).find((key) => partitionHash[key].regions.includes(region)) ?? "aws", "getResolvedPartition"); + var getResolvedSigningRegion = /* @__PURE__ */ __name((hostname, { signingRegion, regionRegex, useFipsEndpoint }) => { + if (signingRegion) { + return signingRegion; + } else if (useFipsEndpoint) { + const regionRegexJs = regionRegex.replace("\\\\", "\\").replace(/^\^/g, "\\.").replace(/\$$/g, "\\."); + const regionRegexmatchArray = hostname.match(regionRegexJs); + if (regionRegexmatchArray) { + return regionRegexmatchArray[0].slice(1, -1); } } + }, "getResolvedSigningRegion"); + var getRegionInfo = /* @__PURE__ */ __name((region, { + useFipsEndpoint = false, + useDualstackEndpoint = false, + signingService, + regionHash, + partitionHash + }) => { + var _a, _b, _c, _d, _e; + const partition = getResolvedPartition(region, { partitionHash }); + const resolvedRegion = region in regionHash ? region : ((_a = partitionHash[partition]) == null ? void 0 : _a.endpoint) ?? region; + const hostnameOptions = { useFipsEndpoint, useDualstackEndpoint }; + const regionHostname = getHostnameFromVariants((_b = regionHash[resolvedRegion]) == null ? void 0 : _b.variants, hostnameOptions); + const partitionHostname = getHostnameFromVariants((_c = partitionHash[partition]) == null ? void 0 : _c.variants, hostnameOptions); + const hostname = getResolvedHostname(resolvedRegion, { regionHostname, partitionHostname }); + if (hostname === void 0) { + throw new Error(`Endpoint resolution failed for: ${{ resolvedRegion, useFipsEndpoint, useDualstackEndpoint }}`); + } + const signingRegion = getResolvedSigningRegion(hostname, { + signingRegion: (_d = regionHash[resolvedRegion]) == null ? void 0 : _d.signingRegion, + regionRegex: partitionHash[partition].regionRegex, + useFipsEndpoint + }); return { - ...request2, - headers, - query + partition, + signingService, + hostname, + ...signingRegion && { signingRegion }, + ...((_e = regionHash[resolvedRegion]) == null ? void 0 : _e.signingService) && { + signingService: regionHash[resolvedRegion].signingService + } }; - }, "moveHeadersToQuery"); - var prepareRequest = /* @__PURE__ */ __name((request2) => { - request2 = typeof request2.clone === "function" ? request2.clone() : cloneRequest(request2); - for (const headerName of Object.keys(request2.headers)) { - if (GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) { - delete request2.headers[headerName]; + }, "getRegionInfo"); + } +}); + +// ../../../node_modules/@smithy/core/node_modules/@smithy/util-middleware/dist-cjs/index.js +var require_dist_cjs12 = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/util-middleware/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + getSmithyContext: () => getSmithyContext4, + normalizeProvider: () => normalizeProvider2 + }); + module2.exports = __toCommonJS2(src_exports); + var import_types5 = require_dist_cjs(); + var getSmithyContext4 = /* @__PURE__ */ __name((context) => context[import_types5.SMITHY_CONTEXT_KEY] || (context[import_types5.SMITHY_CONTEXT_KEY] = {}), "getSmithyContext"); + var normalizeProvider2 = /* @__PURE__ */ __name((input) => { + if (typeof input === "function") + return input; + const promisified = Promise.resolve(input); + return () => promisified; + }, "normalizeProvider"); + } +}); + +// ../../../node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/httpAuthSchemeMiddleware.js +function convertHttpAuthSchemesToMap(httpAuthSchemes) { + const map = /* @__PURE__ */ new Map(); + for (const scheme of httpAuthSchemes) { + map.set(scheme.schemeId, scheme); + } + return map; +} +var import_types, import_util_middleware, httpAuthSchemeMiddleware; +var init_httpAuthSchemeMiddleware = __esm({ + "../../../node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/httpAuthSchemeMiddleware.js"() { + import_types = __toESM(require_dist_cjs()); + import_util_middleware = __toESM(require_dist_cjs12()); + httpAuthSchemeMiddleware = (config, mwOptions) => (next, context) => async (args) => { + const options = config.httpAuthSchemeProvider(await mwOptions.httpAuthSchemeParametersProvider(config, context, args.input)); + const authSchemes = convertHttpAuthSchemesToMap(config.httpAuthSchemes); + const smithyContext = (0, import_util_middleware.getSmithyContext)(context); + const failureReasons = []; + for (const option of options) { + const scheme = authSchemes.get(option.schemeId); + if (!scheme) { + failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` was not enabled for this service.`); + continue; + } + const identityProvider = scheme.identityProvider(await mwOptions.identityProviderConfigProvider(config)); + if (!identityProvider) { + failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` did not have an IdentityProvider configured.`); + continue; } + const { identityProperties = {}, signingProperties = {} } = option.propertiesExtractor?.(config, context) || {}; + option.identityProperties = Object.assign(option.identityProperties || {}, identityProperties); + option.signingProperties = Object.assign(option.signingProperties || {}, signingProperties); + smithyContext.selectedHttpAuthScheme = { + httpAuthOption: option, + identity: await identityProvider(option.identityProperties), + signer: scheme.signer + }; + break; } - return request2; - }, "prepareRequest"); - var iso8601 = /* @__PURE__ */ __name((time) => toDate(time).toISOString().replace(/\.\d{3}Z$/, "Z"), "iso8601"); - var toDate = /* @__PURE__ */ __name((time) => { - if (typeof time === "number") { - return new Date(time * 1e3); + if (!smithyContext.selectedHttpAuthScheme) { + throw new Error(failureReasons.join("\n")); } - if (typeof time === "string") { - if (Number(time)) { - return new Date(Number(time) * 1e3); + return next(args); + }; + } +}); + +// ../../../node_modules/@smithy/core/node_modules/@smithy/property-provider/dist-cjs/index.js +var require_dist_cjs13 = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/property-provider/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + CredentialsProviderError: () => CredentialsProviderError, + ProviderError: () => ProviderError2, + TokenProviderError: () => TokenProviderError, + chain: () => chain, + fromStatic: () => fromStatic, + memoize: () => memoize + }); + module2.exports = __toCommonJS2(src_exports); + var _ProviderError = class _ProviderError2 extends Error { + constructor(message, options = true) { + var _a; + let logger; + let tryNextLink = true; + if (typeof options === "boolean") { + logger = void 0; + tryNextLink = options; + } else if (options != null && typeof options === "object") { + logger = options.logger; + tryNextLink = options.tryNextLink ?? true; } - return new Date(time); + super(message); + this.name = "ProviderError"; + this.tryNextLink = tryNextLink; + Object.setPrototypeOf(this, _ProviderError2.prototype); + (_a = logger == null ? void 0 : logger.debug) == null ? void 0 : _a.call(logger, `@smithy/property-provider ${tryNextLink ? "->" : "(!)"} ${message}`); } - return time; - }, "toDate"); - var _SignatureV4 = class _SignatureV4 { - constructor({ - applyChecksum, - credentials, - region, - service, - sha256, - uriEscapePath = true - }) { - this.headerFormatter = new HeaderFormatter(); - this.service = service; - this.sha256 = sha256; - this.uriEscapePath = uriEscapePath; - this.applyChecksum = typeof applyChecksum === "boolean" ? applyChecksum : true; - this.regionProvider = (0, import_util_middleware.normalizeProvider)(region); - this.credentialProvider = (0, import_util_middleware.normalizeProvider)(credentials); + /** + * @deprecated use new operator. + */ + static from(error, options = true) { + return Object.assign(new this(error.message, options), error); } - async presign(originalRequest, options = {}) { - const { - signingDate = /* @__PURE__ */ new Date(), - expiresIn = 3600, - unsignableHeaders, - unhoistableHeaders, - signableHeaders, - signingRegion, - signingService - } = options; - const credentials = await this.credentialProvider(); - this.validateResolvedCredentials(credentials); - const region = signingRegion ?? await this.regionProvider(); - const { longDate, shortDate } = formatDate(signingDate); - if (expiresIn > MAX_PRESIGNED_TTL) { - return Promise.reject( - "Signature version 4 presigned URLs must have an expiration date less than one week in the future" - ); - } - const scope = createScope(shortDate, region, signingService ?? this.service); - const request2 = moveHeadersToQuery(prepareRequest(originalRequest), { unhoistableHeaders }); - if (credentials.sessionToken) { - request2.query[TOKEN_QUERY_PARAM] = credentials.sessionToken; - } - request2.query[ALGORITHM_QUERY_PARAM] = ALGORITHM_IDENTIFIER; - request2.query[CREDENTIAL_QUERY_PARAM] = `${credentials.accessKeyId}/${scope}`; - request2.query[AMZ_DATE_QUERY_PARAM] = longDate; - request2.query[EXPIRES_QUERY_PARAM] = expiresIn.toString(10); - const canonicalHeaders = getCanonicalHeaders(request2, unsignableHeaders, signableHeaders); - request2.query[SIGNED_HEADERS_QUERY_PARAM] = getCanonicalHeaderList(canonicalHeaders); - request2.query[SIGNATURE_QUERY_PARAM] = await this.getSignature( - longDate, - scope, - this.getSigningKey(credentials, region, shortDate, signingService), - this.createCanonicalRequest(request2, canonicalHeaders, await getPayloadHash(originalRequest, this.sha256)) - ); - return request2; + }; + __name(_ProviderError, "ProviderError"); + var ProviderError2 = _ProviderError; + var _CredentialsProviderError = class _CredentialsProviderError2 extends ProviderError2 { + /** + * @override + */ + constructor(message, options = true) { + super(message, options); + this.name = "CredentialsProviderError"; + Object.setPrototypeOf(this, _CredentialsProviderError2.prototype); } - async sign(toSign, options) { - if (typeof toSign === "string") { - return this.signString(toSign, options); - } else if (toSign.headers && toSign.payload) { - return this.signEvent(toSign, options); - } else if (toSign.message) { - return this.signMessage(toSign, options); - } else { - return this.signRequest(toSign, options); - } + }; + __name(_CredentialsProviderError, "CredentialsProviderError"); + var CredentialsProviderError = _CredentialsProviderError; + var _TokenProviderError = class _TokenProviderError2 extends ProviderError2 { + /** + * @override + */ + constructor(message, options = true) { + super(message, options); + this.name = "TokenProviderError"; + Object.setPrototypeOf(this, _TokenProviderError2.prototype); } - async signEvent({ headers, payload }, { signingDate = /* @__PURE__ */ new Date(), priorSignature, signingRegion, signingService }) { - const region = signingRegion ?? await this.regionProvider(); - const { shortDate, longDate } = formatDate(signingDate); - const scope = createScope(shortDate, region, signingService ?? this.service); - const hashedPayload = await getPayloadHash({ headers: {}, body: payload }, this.sha256); - const hash = new this.sha256(); - hash.update(headers); - const hashedHeaders = (0, import_util_hex_encoding.toHex)(await hash.digest()); - const stringToSign = [ - EVENT_ALGORITHM_IDENTIFIER, - longDate, - scope, - priorSignature, - hashedHeaders, - hashedPayload - ].join("\n"); - return this.signString(stringToSign, { signingDate, signingRegion: region, signingService }); + }; + __name(_TokenProviderError, "TokenProviderError"); + var TokenProviderError = _TokenProviderError; + var chain = /* @__PURE__ */ __name((...providers) => async () => { + if (providers.length === 0) { + throw new ProviderError2("No providers in chain"); } - async signMessage(signableMessage, { signingDate = /* @__PURE__ */ new Date(), signingRegion, signingService }) { - const promise = this.signEvent( - { - headers: this.headerFormatter.format(signableMessage.message.headers), - payload: signableMessage.message.body - }, - { - signingDate, - signingRegion, - signingService, - priorSignature: signableMessage.priorSignature + let lastProviderError; + for (const provider of providers) { + try { + const credentials = await provider(); + return credentials; + } catch (err) { + lastProviderError = err; + if (err == null ? void 0 : err.tryNextLink) { + continue; } - ); - return promise.then((signature) => { - return { message: signableMessage.message, signature }; - }); - } - async signString(stringToSign, { signingDate = /* @__PURE__ */ new Date(), signingRegion, signingService } = {}) { - const credentials = await this.credentialProvider(); - this.validateResolvedCredentials(credentials); - const region = signingRegion ?? await this.regionProvider(); - const { shortDate } = formatDate(signingDate); - const hash = new this.sha256(await this.getSigningKey(credentials, region, shortDate, signingService)); - hash.update((0, import_util_utf84.toUint8Array)(stringToSign)); - return (0, import_util_hex_encoding.toHex)(await hash.digest()); + throw err; + } } - async signRequest(requestToSign, { - signingDate = /* @__PURE__ */ new Date(), - signableHeaders, - unsignableHeaders, - signingRegion, - signingService - } = {}) { - const credentials = await this.credentialProvider(); - this.validateResolvedCredentials(credentials); - const region = signingRegion ?? await this.regionProvider(); - const request2 = prepareRequest(requestToSign); - const { longDate, shortDate } = formatDate(signingDate); - const scope = createScope(shortDate, region, signingService ?? this.service); - request2.headers[AMZ_DATE_HEADER] = longDate; - if (credentials.sessionToken) { - request2.headers[TOKEN_HEADER] = credentials.sessionToken; + throw lastProviderError; + }, "chain"); + var fromStatic = /* @__PURE__ */ __name((staticValue) => () => Promise.resolve(staticValue), "fromStatic"); + var memoize = /* @__PURE__ */ __name((provider, isExpired, requiresRefresh) => { + let resolved; + let pending; + let hasResult; + let isConstant = false; + const coalesceProvider = /* @__PURE__ */ __name(async () => { + if (!pending) { + pending = provider(); } - const payloadHash = await getPayloadHash(request2, this.sha256); - if (!hasHeader(SHA256_HEADER, request2.headers) && this.applyChecksum) { - request2.headers[SHA256_HEADER] = payloadHash; + try { + resolved = await pending; + hasResult = true; + isConstant = false; + } finally { + pending = void 0; } - const canonicalHeaders = getCanonicalHeaders(request2, unsignableHeaders, signableHeaders); - const signature = await this.getSignature( - longDate, - scope, - this.getSigningKey(credentials, region, shortDate, signingService), - this.createCanonicalRequest(request2, canonicalHeaders, payloadHash) - ); - request2.headers[AUTH_HEADER] = `${ALGORITHM_IDENTIFIER} Credential=${credentials.accessKeyId}/${scope}, SignedHeaders=${getCanonicalHeaderList(canonicalHeaders)}, Signature=${signature}`; - return request2; - } - createCanonicalRequest(request2, canonicalHeaders, payloadHash) { - const sortedHeaders = Object.keys(canonicalHeaders).sort(); - return `${request2.method} -${this.getCanonicalPath(request2)} -${getCanonicalQuery(request2)} -${sortedHeaders.map((name) => `${name}:${canonicalHeaders[name]}`).join("\n")} - -${sortedHeaders.join(";")} -${payloadHash}`; - } - async createStringToSign(longDate, credentialScope, canonicalRequest) { - const hash = new this.sha256(); - hash.update((0, import_util_utf84.toUint8Array)(canonicalRequest)); - const hashedRequest = await hash.digest(); - return `${ALGORITHM_IDENTIFIER} -${longDate} -${credentialScope} -${(0, import_util_hex_encoding.toHex)(hashedRequest)}`; + return resolved; + }, "coalesceProvider"); + if (isExpired === void 0) { + return async (options) => { + if (!hasResult || (options == null ? void 0 : options.forceRefresh)) { + resolved = await coalesceProvider(); + } + return resolved; + }; } - getCanonicalPath({ path }) { - if (this.uriEscapePath) { - const normalizedPathSegments = []; - for (const pathSegment of path.split("/")) { - if ((pathSegment == null ? void 0 : pathSegment.length) === 0) - continue; - if (pathSegment === ".") - continue; - if (pathSegment === "..") { - normalizedPathSegments.pop(); - } else { - normalizedPathSegments.push(pathSegment); - } - } - const normalizedPath = `${(path == null ? void 0 : path.startsWith("/")) ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && (path == null ? void 0 : path.endsWith("/")) ? "/" : ""}`; - const doubleEncoded = (0, import_util_uri_escape.escapeUri)(normalizedPath); - return doubleEncoded.replace(/%2F/g, "/"); + return async (options) => { + if (!hasResult || (options == null ? void 0 : options.forceRefresh)) { + resolved = await coalesceProvider(); } - return path; - } - async getSignature(longDate, credentialScope, keyPromise, canonicalRequest) { - const stringToSign = await this.createStringToSign(longDate, credentialScope, canonicalRequest); - const hash = new this.sha256(await keyPromise); - hash.update((0, import_util_utf84.toUint8Array)(stringToSign)); - return (0, import_util_hex_encoding.toHex)(await hash.digest()); - } - getSigningKey(credentials, region, shortDate, service) { - return getSigningKey(this.sha256, credentials, shortDate, region, service || this.service); - } - validateResolvedCredentials(credentials) { - if (typeof credentials !== "object" || // @ts-expect-error: Property 'accessKeyId' does not exist on type 'object'.ts(2339) - typeof credentials.accessKeyId !== "string" || // @ts-expect-error: Property 'secretAccessKey' does not exist on type 'object'.ts(2339) - typeof credentials.secretAccessKey !== "string") { - throw new Error("Resolved credential object is not valid"); + if (isConstant) { + return resolved; } - } - }; - __name(_SignatureV4, "SignatureV4"); - var SignatureV4 = _SignatureV4; - var formatDate = /* @__PURE__ */ __name((now) => { - const longDate = iso8601(now).replace(/[\-:]/g, ""); - return { - longDate, - shortDate: longDate.slice(0, 8) + if (requiresRefresh && !requiresRefresh(resolved)) { + isConstant = true; + return resolved; + } + if (isExpired(resolved)) { + await coalesceProvider(); + return resolved; + } + return resolved; }; - }, "formatDate"); - var getCanonicalHeaderList = /* @__PURE__ */ __name((headers) => Object.keys(headers).sort().join(";"), "getCanonicalHeaderList"); + }, "memoize"); } }); -// ../../../node_modules/@aws-sdk/middleware-signing/dist-cjs/awsAuthConfiguration.js -var require_awsAuthConfiguration = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-signing/dist-cjs/awsAuthConfiguration.js"(exports2) { +// ../../../node_modules/@smithy/core/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getHomeDir.js +var require_getHomeDir = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getHomeDir.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveSigV4AuthConfig = exports2.resolveAwsAuthConfig = void 0; - var property_provider_1 = require_dist_cjs6(); - var signature_v4_1 = require_dist_cjs13(); - var util_middleware_1 = require_dist_cjs7(); - var CREDENTIAL_EXPIRE_WINDOW = 3e5; - var resolveAwsAuthConfig = (input) => { - const normalizedCreds = input.credentials ? normalizeCredentialProvider(input.credentials) : input.credentialDefaultProvider(input); - const { signingEscapePath = true, systemClockOffset = input.systemClockOffset || 0, sha256 } = input; - let signer; - if (input.signer) { - signer = (0, util_middleware_1.normalizeProvider)(input.signer); - } else if (input.regionInfoProvider) { - signer = () => (0, util_middleware_1.normalizeProvider)(input.region)().then(async (region) => [ - await input.regionInfoProvider(region, { - useFipsEndpoint: await input.useFipsEndpoint(), - useDualstackEndpoint: await input.useDualstackEndpoint() - }) || {}, - region - ]).then(([regionInfo, region]) => { - const { signingRegion, signingService } = regionInfo; - input.signingRegion = input.signingRegion || signingRegion || region; - input.signingName = input.signingName || signingService || input.serviceId; - const params = { - ...input, - credentials: normalizedCreds, - region: input.signingRegion, - service: input.signingName, - sha256, - uriEscapePath: signingEscapePath - }; - const SignerCtor = input.signerConstructor || signature_v4_1.SignatureV4; - return new SignerCtor(params); - }); - } else { - signer = async (authScheme) => { - authScheme = Object.assign({}, { - name: "sigv4", - signingName: input.signingName || input.defaultSigningName, - signingRegion: await (0, util_middleware_1.normalizeProvider)(input.region)(), - properties: {} - }, authScheme); - const signingRegion = authScheme.signingRegion; - const signingService = authScheme.signingName; - input.signingRegion = input.signingRegion || signingRegion; - input.signingName = input.signingName || signingService || input.serviceId; - const params = { - ...input, - credentials: normalizedCreds, - region: input.signingRegion, - service: input.signingName, - sha256, - uriEscapePath: signingEscapePath - }; - const SignerCtor = input.signerConstructor || signature_v4_1.SignatureV4; - return new SignerCtor(params); - }; - } - return { - ...input, - systemClockOffset, - signingEscapePath, - credentials: normalizedCreds, - signer - }; - }; - exports2.resolveAwsAuthConfig = resolveAwsAuthConfig; - var resolveSigV4AuthConfig = (input) => { - const normalizedCreds = input.credentials ? normalizeCredentialProvider(input.credentials) : input.credentialDefaultProvider(input); - const { signingEscapePath = true, systemClockOffset = input.systemClockOffset || 0, sha256 } = input; - let signer; - if (input.signer) { - signer = (0, util_middleware_1.normalizeProvider)(input.signer); - } else { - signer = (0, util_middleware_1.normalizeProvider)(new signature_v4_1.SignatureV4({ - credentials: normalizedCreds, - region: input.region, - service: input.signingName, - sha256, - uriEscapePath: signingEscapePath - })); + exports2.getHomeDir = void 0; + var os_1 = require("os"); + var path_1 = require("path"); + var homeDirCache = {}; + var getHomeDirCacheKey = () => { + if (process && process.geteuid) { + return `${process.geteuid()}`; } - return { - ...input, - systemClockOffset, - signingEscapePath, - credentials: normalizedCreds, - signer - }; + return "DEFAULT"; }; - exports2.resolveSigV4AuthConfig = resolveSigV4AuthConfig; - var normalizeCredentialProvider = (credentials) => { - if (typeof credentials === "function") { - return (0, property_provider_1.memoize)(credentials, (credentials2) => credentials2.expiration !== void 0 && credentials2.expiration.getTime() - Date.now() < CREDENTIAL_EXPIRE_WINDOW, (credentials2) => credentials2.expiration !== void 0); - } - return (0, util_middleware_1.normalizeProvider)(credentials); + var getHomeDir2 = () => { + const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${path_1.sep}` } = process.env; + if (HOME) + return HOME; + if (USERPROFILE) + return USERPROFILE; + if (HOMEPATH) + return `${HOMEDRIVE}${HOMEPATH}`; + const homeDirCacheKey = getHomeDirCacheKey(); + if (!homeDirCache[homeDirCacheKey]) + homeDirCache[homeDirCacheKey] = (0, os_1.homedir)(); + return homeDirCache[homeDirCacheKey]; }; + exports2.getHomeDir = getHomeDir2; } }); -// ../../../node_modules/@aws-sdk/middleware-signing/dist-cjs/utils/getSkewCorrectedDate.js -var require_getSkewCorrectedDate = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-signing/dist-cjs/utils/getSkewCorrectedDate.js"(exports2) { +// ../../../node_modules/@smithy/core/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFilepath.js +var require_getSSOTokenFilepath = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFilepath.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getSkewCorrectedDate = void 0; - var getSkewCorrectedDate = (systemClockOffset) => new Date(Date.now() + systemClockOffset); - exports2.getSkewCorrectedDate = getSkewCorrectedDate; + exports2.getSSOTokenFilepath = void 0; + var crypto_1 = require("crypto"); + var path_1 = require("path"); + var getHomeDir_1 = require_getHomeDir(); + var getSSOTokenFilepath2 = (id) => { + const hasher = (0, crypto_1.createHash)("sha1"); + const cacheName = hasher.update(id).digest("hex"); + return (0, path_1.join)((0, getHomeDir_1.getHomeDir)(), ".aws", "sso", "cache", `${cacheName}.json`); + }; + exports2.getSSOTokenFilepath = getSSOTokenFilepath2; } }); -// ../../../node_modules/@aws-sdk/middleware-signing/dist-cjs/utils/isClockSkewed.js -var require_isClockSkewed = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-signing/dist-cjs/utils/isClockSkewed.js"(exports2) { +// ../../../node_modules/@smithy/core/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFromFile.js +var require_getSSOTokenFromFile = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFromFile.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isClockSkewed = void 0; - var getSkewCorrectedDate_1 = require_getSkewCorrectedDate(); - var isClockSkewed = (clockTime, systemClockOffset) => Math.abs((0, getSkewCorrectedDate_1.getSkewCorrectedDate)(systemClockOffset).getTime() - clockTime) >= 3e5; - exports2.isClockSkewed = isClockSkewed; + exports2.getSSOTokenFromFile = void 0; + var fs_1 = require("fs"); + var getSSOTokenFilepath_1 = require_getSSOTokenFilepath(); + var { readFile } = fs_1.promises; + var getSSOTokenFromFile2 = async (id) => { + const ssoTokenFilepath = (0, getSSOTokenFilepath_1.getSSOTokenFilepath)(id); + const ssoTokenText = await readFile(ssoTokenFilepath, "utf8"); + return JSON.parse(ssoTokenText); + }; + exports2.getSSOTokenFromFile = getSSOTokenFromFile2; } }); -// ../../../node_modules/@aws-sdk/middleware-signing/dist-cjs/utils/getUpdatedSystemClockOffset.js -var require_getUpdatedSystemClockOffset = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-signing/dist-cjs/utils/getUpdatedSystemClockOffset.js"(exports2) { +// ../../../node_modules/@smithy/core/node_modules/@smithy/shared-ini-file-loader/dist-cjs/slurpFile.js +var require_slurpFile = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/shared-ini-file-loader/dist-cjs/slurpFile.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getUpdatedSystemClockOffset = void 0; - var isClockSkewed_1 = require_isClockSkewed(); - var getUpdatedSystemClockOffset = (clockTime, currentSystemClockOffset) => { - const clockTimeInMs = Date.parse(clockTime); - if ((0, isClockSkewed_1.isClockSkewed)(clockTimeInMs, currentSystemClockOffset)) { - return clockTimeInMs - Date.now(); + exports2.slurpFile = void 0; + var fs_1 = require("fs"); + var { readFile } = fs_1.promises; + var filePromisesHash = {}; + var slurpFile = (path, options) => { + if (!filePromisesHash[path] || (options === null || options === void 0 ? void 0 : options.ignoreCache)) { + filePromisesHash[path] = readFile(path, "utf8"); } - return currentSystemClockOffset; + return filePromisesHash[path]; }; - exports2.getUpdatedSystemClockOffset = getUpdatedSystemClockOffset; + exports2.slurpFile = slurpFile; } }); -// ../../../node_modules/@aws-sdk/middleware-signing/dist-cjs/awsAuthMiddleware.js -var require_awsAuthMiddleware = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-signing/dist-cjs/awsAuthMiddleware.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getSigV4AuthPlugin = exports2.getAwsAuthPlugin = exports2.awsAuthMiddlewareOptions = exports2.awsAuthMiddleware = void 0; - var protocol_http_1 = require_dist_cjs2(); - var getSkewCorrectedDate_1 = require_getSkewCorrectedDate(); - var getUpdatedSystemClockOffset_1 = require_getUpdatedSystemClockOffset(); - var awsAuthMiddleware = (options) => (next, context) => async function(args) { - var _a, _b, _c, _d; - if (!protocol_http_1.HttpRequest.isInstance(args.request)) - return next(args); - const authScheme = (_c = (_b = (_a = context.endpointV2) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.authSchemes) === null || _c === void 0 ? void 0 : _c[0]; - const multiRegionOverride = (authScheme === null || authScheme === void 0 ? void 0 : authScheme.name) === "sigv4a" ? (_d = authScheme === null || authScheme === void 0 ? void 0 : authScheme.signingRegionSet) === null || _d === void 0 ? void 0 : _d.join(",") : void 0; - const signer = await options.signer(authScheme); - const output = await next({ - ...args, - request: await signer.sign(args.request, { - signingDate: (0, getSkewCorrectedDate_1.getSkewCorrectedDate)(options.systemClockOffset), - signingRegion: multiRegionOverride || context["signing_region"], - signingService: context["signing_service"] - }) - }).catch((error) => { - var _a2; - const serverTime = (_a2 = error.ServerTime) !== null && _a2 !== void 0 ? _a2 : getDateHeader(error.$response); - if (serverTime) { - options.systemClockOffset = (0, getUpdatedSystemClockOffset_1.getUpdatedSystemClockOffset)(serverTime, options.systemClockOffset); - } - throw error; - }); - const dateHeader = getDateHeader(output.response); - if (dateHeader) { - options.systemClockOffset = (0, getUpdatedSystemClockOffset_1.getUpdatedSystemClockOffset)(dateHeader, options.systemClockOffset); - } - return output; - }; - exports2.awsAuthMiddleware = awsAuthMiddleware; - var getDateHeader = (response) => { - var _a, _b, _c; - return protocol_http_1.HttpResponse.isInstance(response) ? (_b = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.date) !== null && _b !== void 0 ? _b : (_c = response.headers) === null || _c === void 0 ? void 0 : _c.Date : void 0; - }; - exports2.awsAuthMiddlewareOptions = { - name: "awsAuthMiddleware", - tags: ["SIGNATURE", "AWSAUTH"], - relation: "after", - toMiddleware: "retryMiddleware", - override: true +// ../../../node_modules/@smithy/core/node_modules/@smithy/shared-ini-file-loader/dist-cjs/index.js +var require_dist_cjs14 = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/shared-ini-file-loader/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var getAwsAuthPlugin = (options) => ({ - applyToStack: (clientStack) => { - clientStack.addRelativeTo((0, exports2.awsAuthMiddleware)(options), exports2.awsAuthMiddlewareOptions); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; + }; + var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + CONFIG_PREFIX_SEPARATOR: () => CONFIG_PREFIX_SEPARATOR, + DEFAULT_PROFILE: () => DEFAULT_PROFILE, + ENV_PROFILE: () => ENV_PROFILE, + getProfileName: () => getProfileName, + loadSharedConfigFiles: () => loadSharedConfigFiles, + loadSsoSessionData: () => loadSsoSessionData, + parseKnownFiles: () => parseKnownFiles }); - exports2.getAwsAuthPlugin = getAwsAuthPlugin; - exports2.getSigV4AuthPlugin = exports2.getAwsAuthPlugin; - } -}); - -// ../../../node_modules/@aws-sdk/middleware-signing/dist-cjs/index.js -var require_dist_cjs14 = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-signing/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_awsAuthConfiguration(), exports2); - tslib_1.__exportStar(require_awsAuthMiddleware(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/middleware-user-agent/dist-cjs/configurations.js -var require_configurations = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-user-agent/dist-cjs/configurations.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveUserAgentConfig = void 0; - function resolveUserAgentConfig(input) { - return { - ...input, - customUserAgent: typeof input.customUserAgent === "string" ? [[input.customUserAgent]] : input.customUserAgent - }; - } - exports2.resolveUserAgentConfig = resolveUserAgentConfig; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/aws/partitions.json -var require_partitions = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/aws/partitions.json"(exports2, module2) { - module2.exports = { - partitions: [{ - id: "aws", - outputs: { - dnsSuffix: "amazonaws.com", - dualStackDnsSuffix: "api.aws", - implicitGlobalRegion: "us-east-1", - name: "aws", - supportsDualStack: true, - supportsFIPS: true - }, - regionRegex: "^(us|eu|ap|sa|ca|me|af|il)\\-\\w+\\-\\d+$", - regions: { - "af-south-1": { - description: "Africa (Cape Town)" - }, - "ap-east-1": { - description: "Asia Pacific (Hong Kong)" - }, - "ap-northeast-1": { - description: "Asia Pacific (Tokyo)" - }, - "ap-northeast-2": { - description: "Asia Pacific (Seoul)" - }, - "ap-northeast-3": { - description: "Asia Pacific (Osaka)" - }, - "ap-south-1": { - description: "Asia Pacific (Mumbai)" - }, - "ap-south-2": { - description: "Asia Pacific (Hyderabad)" - }, - "ap-southeast-1": { - description: "Asia Pacific (Singapore)" - }, - "ap-southeast-2": { - description: "Asia Pacific (Sydney)" - }, - "ap-southeast-3": { - description: "Asia Pacific (Jakarta)" - }, - "ap-southeast-4": { - description: "Asia Pacific (Melbourne)" - }, - "aws-global": { - description: "AWS Standard global region" - }, - "ca-central-1": { - description: "Canada (Central)" - }, - "eu-central-1": { - description: "Europe (Frankfurt)" - }, - "eu-central-2": { - description: "Europe (Zurich)" - }, - "eu-north-1": { - description: "Europe (Stockholm)" - }, - "eu-south-1": { - description: "Europe (Milan)" - }, - "eu-south-2": { - description: "Europe (Spain)" - }, - "eu-west-1": { - description: "Europe (Ireland)" - }, - "eu-west-2": { - description: "Europe (London)" - }, - "eu-west-3": { - description: "Europe (Paris)" - }, - "il-central-1": { - description: "Israel (Tel Aviv)" - }, - "me-central-1": { - description: "Middle East (UAE)" - }, - "me-south-1": { - description: "Middle East (Bahrain)" - }, - "sa-east-1": { - description: "South America (Sao Paulo)" - }, - "us-east-1": { - description: "US East (N. Virginia)" - }, - "us-east-2": { - description: "US East (Ohio)" - }, - "us-west-1": { - description: "US West (N. California)" - }, - "us-west-2": { - description: "US West (Oregon)" - } - } - }, { - id: "aws-cn", - outputs: { - dnsSuffix: "amazonaws.com.cn", - dualStackDnsSuffix: "api.amazonwebservices.com.cn", - implicitGlobalRegion: "cn-northwest-1", - name: "aws-cn", - supportsDualStack: true, - supportsFIPS: true - }, - regionRegex: "^cn\\-\\w+\\-\\d+$", - regions: { - "aws-cn-global": { - description: "AWS China global region" - }, - "cn-north-1": { - description: "China (Beijing)" - }, - "cn-northwest-1": { - description: "China (Ningxia)" + module2.exports = __toCommonJS2(src_exports); + __reExport(src_exports, require_getHomeDir(), module2.exports); + var ENV_PROFILE = "AWS_PROFILE"; + var DEFAULT_PROFILE = "default"; + var getProfileName = /* @__PURE__ */ __name((init) => init.profile || process.env[ENV_PROFILE] || DEFAULT_PROFILE, "getProfileName"); + __reExport(src_exports, require_getSSOTokenFilepath(), module2.exports); + __reExport(src_exports, require_getSSOTokenFromFile(), module2.exports); + var import_types5 = require_dist_cjs(); + var getConfigData = /* @__PURE__ */ __name((data) => Object.entries(data).filter(([key]) => { + const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR); + if (indexOfSeparator === -1) { + return false; + } + return Object.values(import_types5.IniSectionType).includes(key.substring(0, indexOfSeparator)); + }).reduce( + (acc, [key, value]) => { + const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR); + const updatedKey = key.substring(0, indexOfSeparator) === import_types5.IniSectionType.PROFILE ? key.substring(indexOfSeparator + 1) : key; + acc[updatedKey] = value; + return acc; + }, + { + // Populate default profile, if present. + ...data.default && { default: data.default } + } + ), "getConfigData"); + var import_path = require("path"); + var import_getHomeDir = require_getHomeDir(); + var ENV_CONFIG_PATH = "AWS_CONFIG_FILE"; + var getConfigFilepath = /* @__PURE__ */ __name(() => process.env[ENV_CONFIG_PATH] || (0, import_path.join)((0, import_getHomeDir.getHomeDir)(), ".aws", "config"), "getConfigFilepath"); + var import_getHomeDir2 = require_getHomeDir(); + var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE"; + var getCredentialsFilepath = /* @__PURE__ */ __name(() => process.env[ENV_CREDENTIALS_PATH] || (0, import_path.join)((0, import_getHomeDir2.getHomeDir)(), ".aws", "credentials"), "getCredentialsFilepath"); + var import_getHomeDir3 = require_getHomeDir(); + var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/; + var profileNameBlockList = ["__proto__", "profile __proto__"]; + var parseIni = /* @__PURE__ */ __name((iniData) => { + const map = {}; + let currentSection; + let currentSubSection; + for (const iniLine of iniData.split(/\r?\n/)) { + const trimmedLine = iniLine.split(/(^|\s)[;#]/)[0].trim(); + const isSection = trimmedLine[0] === "[" && trimmedLine[trimmedLine.length - 1] === "]"; + if (isSection) { + currentSection = void 0; + currentSubSection = void 0; + const sectionName = trimmedLine.substring(1, trimmedLine.length - 1); + const matches = prefixKeyRegex.exec(sectionName); + if (matches) { + const [, prefix, , name] = matches; + if (Object.values(import_types5.IniSectionType).includes(prefix)) { + currentSection = [prefix, name].join(CONFIG_PREFIX_SEPARATOR); + } + } else { + currentSection = sectionName; } - } - }, { - id: "aws-us-gov", - outputs: { - dnsSuffix: "amazonaws.com", - dualStackDnsSuffix: "api.aws", - implicitGlobalRegion: "us-gov-west-1", - name: "aws-us-gov", - supportsDualStack: true, - supportsFIPS: true - }, - regionRegex: "^us\\-gov\\-\\w+\\-\\d+$", - regions: { - "aws-us-gov-global": { - description: "AWS GovCloud (US) global region" - }, - "us-gov-east-1": { - description: "AWS GovCloud (US-East)" - }, - "us-gov-west-1": { - description: "AWS GovCloud (US-West)" + if (profileNameBlockList.includes(sectionName)) { + throw new Error(`Found invalid profile name "${sectionName}"`); } - } - }, { - id: "aws-iso", - outputs: { - dnsSuffix: "c2s.ic.gov", - dualStackDnsSuffix: "c2s.ic.gov", - implicitGlobalRegion: "us-iso-east-1", - name: "aws-iso", - supportsDualStack: false, - supportsFIPS: true - }, - regionRegex: "^us\\-iso\\-\\w+\\-\\d+$", - regions: { - "aws-iso-global": { - description: "AWS ISO (US) global region" - }, - "us-iso-east-1": { - description: "US ISO East" - }, - "us-iso-west-1": { - description: "US ISO WEST" + } else if (currentSection) { + const indexOfEqualsSign = trimmedLine.indexOf("="); + if (![0, -1].includes(indexOfEqualsSign)) { + const [name, value] = [ + trimmedLine.substring(0, indexOfEqualsSign).trim(), + trimmedLine.substring(indexOfEqualsSign + 1).trim() + ]; + if (value === "") { + currentSubSection = name; + } else { + if (currentSubSection && iniLine.trimStart() === iniLine) { + currentSubSection = void 0; + } + map[currentSection] = map[currentSection] || {}; + const key = currentSubSection ? [currentSubSection, name].join(CONFIG_PREFIX_SEPARATOR) : name; + map[currentSection][key] = value; + } } } - }, { - id: "aws-iso-b", - outputs: { - dnsSuffix: "sc2s.sgov.gov", - dualStackDnsSuffix: "sc2s.sgov.gov", - implicitGlobalRegion: "us-isob-east-1", - name: "aws-iso-b", - supportsDualStack: false, - supportsFIPS: true - }, - regionRegex: "^us\\-isob\\-\\w+\\-\\d+$", - regions: { - "aws-iso-b-global": { - description: "AWS ISOB (US) global region" - }, - "us-isob-east-1": { - description: "US ISOB East (Ohio)" + } + return map; + }, "parseIni"); + var import_slurpFile = require_slurpFile(); + var swallowError = /* @__PURE__ */ __name(() => ({}), "swallowError"); + var CONFIG_PREFIX_SEPARATOR = "."; + var loadSharedConfigFiles = /* @__PURE__ */ __name(async (init = {}) => { + const { filepath = getCredentialsFilepath(), configFilepath = getConfigFilepath() } = init; + const homeDir = (0, import_getHomeDir3.getHomeDir)(); + const relativeHomeDirPrefix = "~/"; + let resolvedFilepath = filepath; + if (filepath.startsWith(relativeHomeDirPrefix)) { + resolvedFilepath = (0, import_path.join)(homeDir, filepath.slice(2)); + } + let resolvedConfigFilepath = configFilepath; + if (configFilepath.startsWith(relativeHomeDirPrefix)) { + resolvedConfigFilepath = (0, import_path.join)(homeDir, configFilepath.slice(2)); + } + const parsedFiles = await Promise.all([ + (0, import_slurpFile.slurpFile)(resolvedConfigFilepath, { + ignoreCache: init.ignoreCache + }).then(parseIni).then(getConfigData).catch(swallowError), + (0, import_slurpFile.slurpFile)(resolvedFilepath, { + ignoreCache: init.ignoreCache + }).then(parseIni).catch(swallowError) + ]); + return { + configFile: parsedFiles[0], + credentialsFile: parsedFiles[1] + }; + }, "loadSharedConfigFiles"); + var getSsoSessionData = /* @__PURE__ */ __name((data) => Object.entries(data).filter(([key]) => key.startsWith(import_types5.IniSectionType.SSO_SESSION + CONFIG_PREFIX_SEPARATOR)).reduce((acc, [key, value]) => ({ ...acc, [key.substring(key.indexOf(CONFIG_PREFIX_SEPARATOR) + 1)]: value }), {}), "getSsoSessionData"); + var import_slurpFile2 = require_slurpFile(); + var swallowError2 = /* @__PURE__ */ __name(() => ({}), "swallowError"); + var loadSsoSessionData = /* @__PURE__ */ __name(async (init = {}) => (0, import_slurpFile2.slurpFile)(init.configFilepath ?? getConfigFilepath()).then(parseIni).then(getSsoSessionData).catch(swallowError2), "loadSsoSessionData"); + var mergeConfigFiles = /* @__PURE__ */ __name((...files) => { + const merged = {}; + for (const file of files) { + for (const [key, values] of Object.entries(file)) { + if (merged[key] !== void 0) { + Object.assign(merged[key], values); + } else { + merged[key] = values; } } - }, { - id: "aws-iso-e", - outputs: { - dnsSuffix: "cloud.adc-e.uk", - dualStackDnsSuffix: "cloud.adc-e.uk", - implicitGlobalRegion: "eu-isoe-west-1", - name: "aws-iso-e", - supportsDualStack: false, - supportsFIPS: true - }, - regionRegex: "^eu\\-isoe\\-\\w+\\-\\d+$", - regions: {} - }, { - id: "aws-iso-f", - outputs: { - dnsSuffix: "csp.hci.ic.gov", - dualStackDnsSuffix: "csp.hci.ic.gov", - implicitGlobalRegion: "us-isof-south-1", - name: "aws-iso-f", - supportsDualStack: false, - supportsFIPS: true - }, - regionRegex: "^us\\-isof\\-\\w+\\-\\d+$", - regions: {} - }], - version: "1.1" - }; + } + return merged; + }, "mergeConfigFiles"); + var parseKnownFiles = /* @__PURE__ */ __name(async (init) => { + const parsedFiles = await loadSharedConfigFiles(init); + return mergeConfigFiles(parsedFiles.configFile, parsedFiles.credentialsFile); + }, "parseKnownFiles"); } }); -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/aws/partition.js -var require_partition = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/aws/partition.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getUserAgentPrefix = exports2.useDefaultPartitionInfo = exports2.setPartitionInfo = exports2.partition = void 0; - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - var partitions_json_1 = tslib_1.__importDefault(require_partitions()); - var selectedPartitionsInfo = partitions_json_1.default; - var selectedUserAgentPrefix = ""; - var partition = (value) => { - const { partitions } = selectedPartitionsInfo; - for (const partition2 of partitions) { - const { regions, outputs } = partition2; - for (const [region, regionData] of Object.entries(regions)) { - if (region === value) { - return { - ...outputs, - ...regionData - }; - } - } +// ../../../node_modules/@smithy/core/node_modules/@smithy/node-config-provider/dist-cjs/index.js +var require_dist_cjs15 = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/node-config-provider/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - for (const partition2 of partitions) { - const { regionRegex, outputs } = partition2; - if (new RegExp(regionRegex).test(value)) { - return { - ...outputs - }; + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + loadConfig: () => loadConfig + }); + module2.exports = __toCommonJS2(src_exports); + var import_property_provider2 = require_dist_cjs13(); + function getSelectorName(functionString) { + try { + const constants = new Set(Array.from(functionString.match(/([A-Z_]){3,}/g) ?? [])); + constants.delete("CONFIG"); + constants.delete("CONFIG_PREFIX_SEPARATOR"); + constants.delete("ENV"); + return [...constants].join(", "); + } catch (e) { + return functionString; + } + } + __name(getSelectorName, "getSelectorName"); + var fromEnv = /* @__PURE__ */ __name((envVarSelector, logger) => async () => { + try { + const config = envVarSelector(process.env); + if (config === void 0) { + throw new Error(); } + return config; + } catch (e) { + throw new import_property_provider2.CredentialsProviderError( + e.message || `Not found in ENV: ${getSelectorName(envVarSelector.toString())}`, + { logger } + ); } - const DEFAULT_PARTITION = partitions.find((partition2) => partition2.id === "aws"); - if (!DEFAULT_PARTITION) { - throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist."); + }, "fromEnv"); + var import_shared_ini_file_loader = require_dist_cjs14(); + var fromSharedConfigFiles = /* @__PURE__ */ __name((configSelector, { preferredFile = "config", ...init } = {}) => async () => { + const profile = (0, import_shared_ini_file_loader.getProfileName)(init); + const { configFile, credentialsFile } = await (0, import_shared_ini_file_loader.loadSharedConfigFiles)(init); + const profileFromCredentials = credentialsFile[profile] || {}; + const profileFromConfig = configFile[profile] || {}; + const mergedProfile = preferredFile === "config" ? { ...profileFromCredentials, ...profileFromConfig } : { ...profileFromConfig, ...profileFromCredentials }; + try { + const cfgFile = preferredFile === "config" ? configFile : credentialsFile; + const configValue = configSelector(mergedProfile, cfgFile); + if (configValue === void 0) { + throw new Error(); + } + return configValue; + } catch (e) { + throw new import_property_provider2.CredentialsProviderError( + e.message || `Not found in config files w/ profile [${profile}]: ${getSelectorName(configSelector.toString())}`, + { logger: init.logger } + ); } - return { - ...DEFAULT_PARTITION.outputs - }; - }; - exports2.partition = partition; - var setPartitionInfo = (partitionsInfo, userAgentPrefix = "") => { - selectedPartitionsInfo = partitionsInfo; - selectedUserAgentPrefix = userAgentPrefix; - }; - exports2.setPartitionInfo = setPartitionInfo; - var useDefaultPartitionInfo = () => { - (0, exports2.setPartitionInfo)(partitions_json_1.default, ""); - }; - exports2.useDefaultPartitionInfo = useDefaultPartitionInfo; - var getUserAgentPrefix = () => selectedUserAgentPrefix; - exports2.getUserAgentPrefix = getUserAgentPrefix; + }, "fromSharedConfigFiles"); + var isFunction = /* @__PURE__ */ __name((func) => typeof func === "function", "isFunction"); + var fromStatic = /* @__PURE__ */ __name((defaultValue) => isFunction(defaultValue) ? async () => await defaultValue() : (0, import_property_provider2.fromStatic)(defaultValue), "fromStatic"); + var loadConfig = /* @__PURE__ */ __name(({ environmentVariableSelector, configFileSelector, default: defaultValue }, configuration = {}) => (0, import_property_provider2.memoize)( + (0, import_property_provider2.chain)( + fromEnv(environmentVariableSelector), + fromSharedConfigFiles(configFileSelector, configuration), + fromStatic(defaultValue) + ) + ), "loadConfig"); } }); -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/isIpAddress.js -var require_isIpAddress = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/isIpAddress.js"(exports2) { +// ../../../node_modules/@smithy/core/node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointUrlConfig.js +var require_getEndpointUrlConfig = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointUrlConfig.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isIpAddress = void 0; - var IP_V4_REGEX = new RegExp(`^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$`); - var isIpAddress = (value) => IP_V4_REGEX.test(value) || value.startsWith("[") && value.endsWith("]"); - exports2.isIpAddress = isIpAddress; + exports2.getEndpointUrlConfig = void 0; + var shared_ini_file_loader_1 = require_dist_cjs14(); + var ENV_ENDPOINT_URL = "AWS_ENDPOINT_URL"; + var CONFIG_ENDPOINT_URL = "endpoint_url"; + var getEndpointUrlConfig = (serviceId) => ({ + environmentVariableSelector: (env) => { + const serviceSuffixParts = serviceId.split(" ").map((w) => w.toUpperCase()); + const serviceEndpointUrl = env[[ENV_ENDPOINT_URL, ...serviceSuffixParts].join("_")]; + if (serviceEndpointUrl) + return serviceEndpointUrl; + const endpointUrl = env[ENV_ENDPOINT_URL]; + if (endpointUrl) + return endpointUrl; + return void 0; + }, + configFileSelector: (profile, config) => { + if (config && profile.services) { + const servicesSection = config[["services", profile.services].join(shared_ini_file_loader_1.CONFIG_PREFIX_SEPARATOR)]; + if (servicesSection) { + const servicePrefixParts = serviceId.split(" ").map((w) => w.toLowerCase()); + const endpointUrl2 = servicesSection[[servicePrefixParts.join("_"), CONFIG_ENDPOINT_URL].join(shared_ini_file_loader_1.CONFIG_PREFIX_SEPARATOR)]; + if (endpointUrl2) + return endpointUrl2; + } + } + const endpointUrl = profile[CONFIG_ENDPOINT_URL]; + if (endpointUrl) + return endpointUrl; + return void 0; + }, + default: void 0 + }); + exports2.getEndpointUrlConfig = getEndpointUrlConfig; } }); -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/debug/debugId.js -var require_debugId = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/debug/debugId.js"(exports2) { +// ../../../node_modules/@smithy/core/node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointFromConfig.js +var require_getEndpointFromConfig = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointFromConfig.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.debugId = void 0; - exports2.debugId = "endpoints"; + exports2.getEndpointFromConfig = void 0; + var node_config_provider_1 = require_dist_cjs15(); + var getEndpointUrlConfig_1 = require_getEndpointUrlConfig(); + var getEndpointFromConfig = async (serviceId) => (0, node_config_provider_1.loadConfig)((0, getEndpointUrlConfig_1.getEndpointUrlConfig)(serviceId !== null && serviceId !== void 0 ? serviceId : ""))(); + exports2.getEndpointFromConfig = getEndpointFromConfig; } }); -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/debug/toDebugString.js -var require_toDebugString = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/debug/toDebugString.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.toDebugString = void 0; - function toDebugString(input) { - if (typeof input !== "object" || input == null) { - return input; - } - if ("ref" in input) { - return `$${toDebugString(input.ref)}`; +// ../../../node_modules/@smithy/core/node_modules/@smithy/querystring-parser/dist-cjs/index.js +var require_dist_cjs16 = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/querystring-parser/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - if ("fn" in input) { - return `${input.fn}(${(input.argv || []).map(toDebugString).join(", ")})`; + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + parseQueryString: () => parseQueryString + }); + module2.exports = __toCommonJS2(src_exports); + function parseQueryString(querystring) { + const query = {}; + querystring = querystring.replace(/^\?/, ""); + if (querystring) { + for (const pair of querystring.split("&")) { + let [key, value = null] = pair.split("="); + key = decodeURIComponent(key); + if (value) { + value = decodeURIComponent(value); + } + if (!(key in query)) { + query[key] = value; + } else if (Array.isArray(query[key])) { + query[key].push(value); + } else { + query[key] = [query[key], value]; + } + } } - return JSON.stringify(input, null, 2); + return query; } - exports2.toDebugString = toDebugString; + __name(parseQueryString, "parseQueryString"); } }); -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/debug/index.js -var require_debug = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/debug/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_debugId(), exports2); - tslib_1.__exportStar(require_toDebugString(), exports2); +// ../../../node_modules/@smithy/core/node_modules/@smithy/url-parser/dist-cjs/index.js +var require_dist_cjs17 = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/url-parser/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + parseUrl: () => parseUrl + }); + module2.exports = __toCommonJS2(src_exports); + var import_querystring_parser = require_dist_cjs16(); + var parseUrl = /* @__PURE__ */ __name((url2) => { + if (typeof url2 === "string") { + return parseUrl(new URL(url2)); + } + const { hostname, pathname, port, protocol, search } = url2; + let query; + if (search) { + query = (0, import_querystring_parser.parseQueryString)(search); + } + return { + hostname, + port: port ? parseInt(port) : void 0, + protocol, + path: pathname, + query + }; + }, "parseUrl"); } }); -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/EndpointError.js -var require_EndpointError = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/EndpointError.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.EndpointError = void 0; - var EndpointError = class extends Error { - constructor(message) { - super(message); - this.name = "EndpointError"; - } +// ../../../node_modules/@smithy/core/node_modules/@smithy/middleware-serde/dist-cjs/index.js +var require_dist_cjs18 = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/middleware-serde/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - exports2.EndpointError = EndpointError; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/EndpointRuleObject.js -var require_EndpointRuleObject = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/EndpointRuleObject.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/ErrorRuleObject.js -var require_ErrorRuleObject = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/ErrorRuleObject.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/RuleSetObject.js -var require_RuleSetObject = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/RuleSetObject.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/TreeRuleObject.js -var require_TreeRuleObject = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/TreeRuleObject.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/shared.js -var require_shared = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/shared.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/index.js -var require_types = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/types/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_EndpointError(), exports2); - tslib_1.__exportStar(require_EndpointRuleObject(), exports2); - tslib_1.__exportStar(require_ErrorRuleObject(), exports2); - tslib_1.__exportStar(require_RuleSetObject(), exports2); - tslib_1.__exportStar(require_TreeRuleObject(), exports2); - tslib_1.__exportStar(require_shared(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/isValidHostLabel.js -var require_isValidHostLabel = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/isValidHostLabel.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isValidHostLabel = void 0; - var VALID_HOST_LABEL_REGEX = new RegExp(`^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$`); - var isValidHostLabel = (value, allowSubDomains = false) => { - if (!allowSubDomains) { - return VALID_HOST_LABEL_REGEX.test(value); - } - const labels = value.split("."); - for (const label of labels) { - if (!(0, exports2.isValidHostLabel)(label)) { - return false; - } + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - return true; + return to; }; - exports2.isValidHostLabel = isValidHostLabel; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/aws/isVirtualHostableS3Bucket.js -var require_isVirtualHostableS3Bucket = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/aws/isVirtualHostableS3Bucket.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isVirtualHostableS3Bucket = void 0; - var isIpAddress_1 = require_isIpAddress(); - var isValidHostLabel_1 = require_isValidHostLabel(); - var isVirtualHostableS3Bucket = (value, allowSubDomains = false) => { - if (allowSubDomains) { - for (const label of value.split(".")) { - if (!(0, exports2.isVirtualHostableS3Bucket)(label)) { - return false; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + deserializerMiddleware: () => deserializerMiddleware, + deserializerMiddlewareOption: () => deserializerMiddlewareOption, + getSerdePlugin: () => getSerdePlugin, + serializerMiddleware: () => serializerMiddleware, + serializerMiddlewareOption: () => serializerMiddlewareOption2 + }); + module2.exports = __toCommonJS2(src_exports); + var deserializerMiddleware = /* @__PURE__ */ __name((options, deserializer) => (next) => async (args) => { + const { response } = await next(args); + try { + const parsed = await deserializer(response, options); + return { + response, + output: parsed + }; + } catch (error) { + Object.defineProperty(error, "$response", { + value: response + }); + if (!("$metadata" in error)) { + const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`; + error.message += "\n " + hint; + if (typeof error.$responseBodyText !== "undefined") { + if (error.$response) { + error.$response.body = error.$responseBodyText; + } } } - return true; - } - if (!(0, isValidHostLabel_1.isValidHostLabel)(value)) { - return false; - } - if (value.length < 3 || value.length > 63) { - return false; - } - if (value !== value.toLowerCase()) { - return false; + throw error; } - if ((0, isIpAddress_1.isIpAddress)(value)) { - return false; + }, "deserializerMiddleware"); + var serializerMiddleware = /* @__PURE__ */ __name((options, serializer) => (next, context) => async (args) => { + var _a; + const endpoint = ((_a = context.endpointV2) == null ? void 0 : _a.url) && options.urlParser ? async () => options.urlParser(context.endpointV2.url) : options.endpoint; + if (!endpoint) { + throw new Error("No valid endpoint provider available."); } - return true; + const request2 = await serializer(args.input, { ...options, endpoint }); + return next({ + ...args, + request: request2 + }); + }, "serializerMiddleware"); + var deserializerMiddlewareOption = { + name: "deserializerMiddleware", + step: "deserialize", + tags: ["DESERIALIZER"], + override: true }; - exports2.isVirtualHostableS3Bucket = isVirtualHostableS3Bucket; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/aws/parseArn.js -var require_parseArn = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/aws/parseArn.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.parseArn = void 0; - var parseArn = (value) => { - const segments = value.split(":"); - if (segments.length < 6) - return null; - const [arn, partition, service, region, accountId, ...resourceId] = segments; - if (arn !== "arn" || partition === "" || service === "" || resourceId[0] === "") - return null; + var serializerMiddlewareOption2 = { + name: "serializerMiddleware", + step: "serialize", + tags: ["SERIALIZER"], + override: true + }; + function getSerdePlugin(config, serializer, deserializer) { return { - partition, - service, - region, - accountId, - resourceId: resourceId[0].includes("/") ? resourceId[0].split("/") : resourceId + applyToStack: (commandStack) => { + commandStack.add(deserializerMiddleware(config, deserializer), deserializerMiddlewareOption); + commandStack.add(serializerMiddleware(config, serializer), serializerMiddlewareOption2); + } }; - }; - exports2.parseArn = parseArn; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/aws/index.js -var require_aws = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/aws/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_isVirtualHostableS3Bucket(), exports2); - tslib_1.__exportStar(require_parseArn(), exports2); - tslib_1.__exportStar(require_partition(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/booleanEquals.js -var require_booleanEquals = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/booleanEquals.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.booleanEquals = void 0; - var booleanEquals = (value1, value2) => value1 === value2; - exports2.booleanEquals = booleanEquals; + } + __name(getSerdePlugin, "getSerdePlugin"); } }); -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/getAttrPathList.js -var require_getAttrPathList = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/getAttrPathList.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getAttrPathList = void 0; - var types_1 = require_types(); - var getAttrPathList = (path) => { - const parts = path.split("."); - const pathList = []; - for (const part of parts) { - const squareBracketIndex = part.indexOf("["); - if (squareBracketIndex !== -1) { - if (part.indexOf("]") !== part.length - 1) { - throw new types_1.EndpointError(`Path: '${path}' does not end with ']'`); - } - const arrayIndex = part.slice(squareBracketIndex + 1, -1); - if (Number.isNaN(parseInt(arrayIndex))) { - throw new types_1.EndpointError(`Invalid array index: '${arrayIndex}' in path: '${path}'`); - } - if (squareBracketIndex !== 0) { - pathList.push(part.slice(0, squareBracketIndex)); - } - pathList.push(arrayIndex); - } else { - pathList.push(part); - } +// ../../../node_modules/@smithy/core/node_modules/@smithy/middleware-endpoint/dist-cjs/index.js +var require_dist_cjs19 = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/middleware-endpoint/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - return pathList; + return to; }; - exports2.getAttrPathList = getAttrPathList; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/getAttr.js -var require_getAttr = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/getAttr.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getAttr = void 0; - var types_1 = require_types(); - var getAttrPathList_1 = require_getAttrPathList(); - var getAttr = (value, path) => (0, getAttrPathList_1.getAttrPathList)(path).reduce((acc, index) => { - if (typeof acc !== "object") { - throw new types_1.EndpointError(`Index '${index}' in '${path}' not found in '${JSON.stringify(value)}'`); - } else if (Array.isArray(acc)) { - return acc[parseInt(index)]; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + endpointMiddleware: () => endpointMiddleware, + endpointMiddlewareOptions: () => endpointMiddlewareOptions2, + getEndpointFromInstructions: () => getEndpointFromInstructions, + getEndpointPlugin: () => getEndpointPlugin, + resolveEndpointConfig: () => resolveEndpointConfig, + resolveParams: () => resolveParams, + toEndpointV1: () => toEndpointV1 + }); + module2.exports = __toCommonJS2(src_exports); + var resolveParamsForS3 = /* @__PURE__ */ __name(async (endpointParams) => { + const bucket = (endpointParams == null ? void 0 : endpointParams.Bucket) || ""; + if (typeof endpointParams.Bucket === "string") { + endpointParams.Bucket = bucket.replace(/#/g, encodeURIComponent("#")).replace(/\?/g, encodeURIComponent("?")); } - return acc[index]; - }, value); - exports2.getAttr = getAttr; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/isSet.js -var require_isSet = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/isSet.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isSet = void 0; - var isSet = (value) => value != null; - exports2.isSet = isSet; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/not.js -var require_not = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/not.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.not = void 0; - var not = (value) => !value; - exports2.not = not; - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/abort.js -var require_abort = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/abort.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/auth.js -var require_auth = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/auth.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.HttpAuthLocation = void 0; - var types_1 = require_dist_cjs(); - Object.defineProperty(exports2, "HttpAuthLocation", { enumerable: true, get: function() { - return types_1.HttpAuthLocation; - } }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/blob/blob-types.js -var require_blob_types = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/blob/blob-types.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/checksum.js -var require_checksum = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/checksum.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/client.js -var require_client = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/client.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/command.js -var require_command = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/command.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/connection.js -var require_connection = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/connection.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/credentials.js -var require_credentials = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/credentials.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/crypto.js -var require_crypto = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/crypto.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/dns.js -var require_dns = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/dns.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.HostAddressType = void 0; - var HostAddressType; - (function(HostAddressType2) { - HostAddressType2["AAAA"] = "AAAA"; - HostAddressType2["A"] = "A"; - })(HostAddressType = exports2.HostAddressType || (exports2.HostAddressType = {})); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/encode.js -var require_encode = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/encode.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/endpoint.js -var require_endpoint = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/endpoint.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.EndpointURLScheme = void 0; - var types_1 = require_dist_cjs(); - Object.defineProperty(exports2, "EndpointURLScheme", { enumerable: true, get: function() { - return types_1.EndpointURLScheme; - } }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/eventStream.js -var require_eventStream = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/eventStream.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/extensions/index.js -var require_extensions = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/extensions/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); + if (isArnBucketName(bucket)) { + if (endpointParams.ForcePathStyle === true) { + throw new Error("Path-style addressing cannot be used with ARN buckets"); + } + } else if (!isDnsCompatibleBucketName(bucket) || bucket.indexOf(".") !== -1 && !String(endpointParams.Endpoint).startsWith("http:") || bucket.toLowerCase() !== bucket || bucket.length < 3) { + endpointParams.ForcePathStyle = true; + } + if (endpointParams.DisableMultiRegionAccessPoints) { + endpointParams.disableMultiRegionAccessPoints = true; + endpointParams.DisableMRAP = true; + } + return endpointParams; + }, "resolveParamsForS3"); + var DOMAIN_PATTERN = /^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/; + var IP_ADDRESS_PATTERN = /(\d+\.){3}\d+/; + var DOTS_PATTERN = /\.\./; + var isDnsCompatibleBucketName = /* @__PURE__ */ __name((bucketName) => DOMAIN_PATTERN.test(bucketName) && !IP_ADDRESS_PATTERN.test(bucketName) && !DOTS_PATTERN.test(bucketName), "isDnsCompatibleBucketName"); + var isArnBucketName = /* @__PURE__ */ __name((bucketName) => { + const [arn, partition, service, , , bucket] = bucketName.split(":"); + const isArn = arn === "arn" && bucketName.split(":").length >= 6; + const isValidArn = Boolean(isArn && partition && service && bucket); + if (isArn && !isValidArn) { + throw new Error(`Invalid ARN: ${bucketName} was an invalid ARN.`); + } + return isValidArn; + }, "isArnBucketName"); + var createConfigValueProvider = /* @__PURE__ */ __name((configKey, canonicalEndpointParamKey, config) => { + const configProvider = /* @__PURE__ */ __name(async () => { + const configValue = config[configKey] ?? config[canonicalEndpointParamKey]; + if (typeof configValue === "function") { + return configValue(); + } + return configValue; + }, "configProvider"); + if (configKey === "credentialScope" || canonicalEndpointParamKey === "CredentialScope") { + return async () => { + const credentials = typeof config.credentials === "function" ? await config.credentials() : config.credentials; + const configValue = (credentials == null ? void 0 : credentials.credentialScope) ?? (credentials == null ? void 0 : credentials.CredentialScope); + return configValue; + }; + } + if (configKey === "accountId" || canonicalEndpointParamKey === "AccountId") { + return async () => { + const credentials = typeof config.credentials === "function" ? await config.credentials() : config.credentials; + const configValue = (credentials == null ? void 0 : credentials.accountId) ?? (credentials == null ? void 0 : credentials.AccountId); + return configValue; + }; + } + if (configKey === "endpoint" || canonicalEndpointParamKey === "endpoint") { + return async () => { + const endpoint = await configProvider(); + if (endpoint && typeof endpoint === "object") { + if ("url" in endpoint) { + return endpoint.url.href; + } + if ("hostname" in endpoint) { + const { protocol, hostname, port, path } = endpoint; + return `${protocol}//${hostname}${port ? ":" + port : ""}${path}`; + } + } + return endpoint; + }; + } + return configProvider; + }, "createConfigValueProvider"); + var import_getEndpointFromConfig = require_getEndpointFromConfig(); + var import_url_parser = require_dist_cjs17(); + var toEndpointV1 = /* @__PURE__ */ __name((endpoint) => { + if (typeof endpoint === "object") { + if ("url" in endpoint) { + return (0, import_url_parser.parseUrl)(endpoint.url); + } + return endpoint; + } + return (0, import_url_parser.parseUrl)(endpoint); + }, "toEndpointV1"); + var getEndpointFromInstructions = /* @__PURE__ */ __name(async (commandInput, instructionsSupplier, clientConfig, context) => { + if (!clientConfig.endpoint) { + let endpointFromConfig; + if (clientConfig.serviceConfiguredEndpoint) { + endpointFromConfig = await clientConfig.serviceConfiguredEndpoint(); + } else { + endpointFromConfig = await (0, import_getEndpointFromConfig.getEndpointFromConfig)(clientConfig.serviceId); + } + if (endpointFromConfig) { + clientConfig.endpoint = () => Promise.resolve(toEndpointV1(endpointFromConfig)); + } + } + const endpointParams = await resolveParams(commandInput, instructionsSupplier, clientConfig); + if (typeof clientConfig.endpointProvider !== "function") { + throw new Error("config.endpointProvider is not set."); + } + const endpoint = clientConfig.endpointProvider(endpointParams, context); + return endpoint; + }, "getEndpointFromInstructions"); + var resolveParams = /* @__PURE__ */ __name(async (commandInput, instructionsSupplier, clientConfig) => { + var _a; + const endpointParams = {}; + const instructions = ((_a = instructionsSupplier == null ? void 0 : instructionsSupplier.getEndpointParameterInstructions) == null ? void 0 : _a.call(instructionsSupplier)) || {}; + for (const [name, instruction] of Object.entries(instructions)) { + switch (instruction.type) { + case "staticContextParams": + endpointParams[name] = instruction.value; + break; + case "contextParams": + endpointParams[name] = commandInput[instruction.name]; + break; + case "clientContextParams": + case "builtInParams": + endpointParams[name] = await createConfigValueProvider(instruction.name, name, clientConfig)(); + break; + default: + throw new Error("Unrecognized endpoint parameter instruction: " + JSON.stringify(instruction)); + } + } + if (Object.keys(instructions).length === 0) { + Object.assign(endpointParams, clientConfig); + } + if (String(clientConfig.serviceId).toLowerCase() === "s3") { + await resolveParamsForS3(endpointParams); + } + return endpointParams; + }, "resolveParams"); + var import_util_middleware3 = require_dist_cjs12(); + var endpointMiddleware = /* @__PURE__ */ __name(({ + config, + instructions + }) => { + return (next, context) => async (args) => { + var _a, _b, _c; + const endpoint = await getEndpointFromInstructions( + args.input, + { + getEndpointParameterInstructions() { + return instructions; + } + }, + { ...config }, + context + ); + context.endpointV2 = endpoint; + context.authSchemes = (_a = endpoint.properties) == null ? void 0 : _a.authSchemes; + const authScheme = (_b = context.authSchemes) == null ? void 0 : _b[0]; + if (authScheme) { + context["signing_region"] = authScheme.signingRegion; + context["signing_service"] = authScheme.signingName; + const smithyContext = (0, import_util_middleware3.getSmithyContext)(context); + const httpAuthOption = (_c = smithyContext == null ? void 0 : smithyContext.selectedHttpAuthScheme) == null ? void 0 : _c.httpAuthOption; + if (httpAuthOption) { + httpAuthOption.signingProperties = Object.assign( + httpAuthOption.signingProperties || {}, + { + signing_region: authScheme.signingRegion, + signingRegion: authScheme.signingRegion, + signing_service: authScheme.signingName, + signingName: authScheme.signingName, + signingRegionSet: authScheme.signingRegionSet + }, + authScheme.properties + ); + } + } + return next({ + ...args + }); + }; + }, "endpointMiddleware"); + var import_middleware_serde2 = require_dist_cjs18(); + var endpointMiddlewareOptions2 = { + step: "serialize", + tags: ["ENDPOINT_PARAMETERS", "ENDPOINT_V2", "ENDPOINT"], + name: "endpointV2Middleware", + override: true, + relation: "before", + toMiddleware: import_middleware_serde2.serializerMiddlewareOption.name + }; + var getEndpointPlugin = /* @__PURE__ */ __name((config, instructions) => ({ + applyToStack: (clientStack) => { + clientStack.addRelativeTo( + endpointMiddleware({ + config, + instructions + }), + endpointMiddlewareOptions2 + ); + } + }), "getEndpointPlugin"); + var import_getEndpointFromConfig2 = require_getEndpointFromConfig(); + var resolveEndpointConfig = /* @__PURE__ */ __name((input) => { + const tls = input.tls ?? true; + const { endpoint } = input; + const customEndpointProvider = endpoint != null ? async () => toEndpointV1(await (0, import_util_middleware3.normalizeProvider)(endpoint)()) : void 0; + const isCustomEndpoint = !!endpoint; + const resolvedConfig = { + ...input, + endpoint: customEndpointProvider, + tls, + isCustomEndpoint, + useDualstackEndpoint: (0, import_util_middleware3.normalizeProvider)(input.useDualstackEndpoint ?? false), + useFipsEndpoint: (0, import_util_middleware3.normalizeProvider)(input.useFipsEndpoint ?? false) + }; + let configuredEndpointPromise = void 0; + resolvedConfig.serviceConfiguredEndpoint = async () => { + if (input.serviceId && !configuredEndpointPromise) { + configuredEndpointPromise = (0, import_getEndpointFromConfig2.getEndpointFromConfig)(input.serviceId); + } + return configuredEndpointPromise; + }; + return resolvedConfig; + }, "resolveEndpointConfig"); } }); -// ../../../node_modules/@aws-sdk/types/dist-cjs/http.js -var require_http = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/http.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); +// ../../../node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/getHttpAuthSchemeEndpointRuleSetPlugin.js +var import_middleware_endpoint, httpAuthSchemeEndpointRuleSetMiddlewareOptions, getHttpAuthSchemeEndpointRuleSetPlugin; +var init_getHttpAuthSchemeEndpointRuleSetPlugin = __esm({ + "../../../node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/getHttpAuthSchemeEndpointRuleSetPlugin.js"() { + import_middleware_endpoint = __toESM(require_dist_cjs19()); + init_httpAuthSchemeMiddleware(); + httpAuthSchemeEndpointRuleSetMiddlewareOptions = { + step: "serialize", + tags: ["HTTP_AUTH_SCHEME"], + name: "httpAuthSchemeMiddleware", + override: true, + relation: "before", + toMiddleware: import_middleware_endpoint.endpointMiddlewareOptions.name + }; + getHttpAuthSchemeEndpointRuleSetPlugin = (config, { httpAuthSchemeParametersProvider, identityProviderConfigProvider }) => ({ + applyToStack: (clientStack) => { + clientStack.addRelativeTo(httpAuthSchemeMiddleware(config, { + httpAuthSchemeParametersProvider, + identityProviderConfigProvider + }), httpAuthSchemeEndpointRuleSetMiddlewareOptions); + } + }); } }); -// ../../../node_modules/@aws-sdk/types/dist-cjs/identity/AnonymousIdentity.js -var require_AnonymousIdentity = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/identity/AnonymousIdentity.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); +// ../../../node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/getHttpAuthSchemePlugin.js +var import_middleware_serde, httpAuthSchemeMiddlewareOptions, getHttpAuthSchemePlugin; +var init_getHttpAuthSchemePlugin = __esm({ + "../../../node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/getHttpAuthSchemePlugin.js"() { + import_middleware_serde = __toESM(require_dist_cjs18()); + init_httpAuthSchemeMiddleware(); + httpAuthSchemeMiddlewareOptions = { + step: "serialize", + tags: ["HTTP_AUTH_SCHEME"], + name: "httpAuthSchemeMiddleware", + override: true, + relation: "before", + toMiddleware: import_middleware_serde.serializerMiddlewareOption.name + }; + getHttpAuthSchemePlugin = (config, { httpAuthSchemeParametersProvider, identityProviderConfigProvider }) => ({ + applyToStack: (clientStack) => { + clientStack.addRelativeTo(httpAuthSchemeMiddleware(config, { + httpAuthSchemeParametersProvider, + identityProviderConfigProvider + }), httpAuthSchemeMiddlewareOptions); + } + }); } }); -// ../../../node_modules/@aws-sdk/types/dist-cjs/identity/AwsCredentialIdentity.js -var require_AwsCredentialIdentity = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/identity/AwsCredentialIdentity.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); +// ../../../node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/index.js +var init_middleware_http_auth_scheme = __esm({ + "../../../node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/index.js"() { + init_httpAuthSchemeMiddleware(); + init_getHttpAuthSchemeEndpointRuleSetPlugin(); + init_getHttpAuthSchemePlugin(); } }); -// ../../../node_modules/@aws-sdk/types/dist-cjs/identity/Identity.js -var require_Identity = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/identity/Identity.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/identity/LoginIdentity.js -var require_LoginIdentity = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/identity/LoginIdentity.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/identity/TokenIdentity.js -var require_TokenIdentity = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/identity/TokenIdentity.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/identity/index.js -var require_identity = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/identity/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_AnonymousIdentity(), exports2); - tslib_1.__exportStar(require_AwsCredentialIdentity(), exports2); - tslib_1.__exportStar(require_Identity(), exports2); - tslib_1.__exportStar(require_LoginIdentity(), exports2); - tslib_1.__exportStar(require_TokenIdentity(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/logger.js -var require_logger = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/logger.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/middleware.js -var require_middleware = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/middleware.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/pagination.js -var require_pagination = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/pagination.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/profile.js -var require_profile = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/profile.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/request.js -var require_request = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/request.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/response.js -var require_response = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/response.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/retry.js -var require_retry = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/retry.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/serde.js -var require_serde = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/serde.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/shapes.js -var require_shapes = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/shapes.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/signature.js -var require_signature = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/signature.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/stream.js -var require_stream = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/stream.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/token.js -var require_token = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/token.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/transfer.js -var require_transfer = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/transfer.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.RequestHandlerProtocol = void 0; - var types_1 = require_dist_cjs(); - Object.defineProperty(exports2, "RequestHandlerProtocol", { enumerable: true, get: function() { - return types_1.RequestHandlerProtocol; - } }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/uri.js -var require_uri = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/uri.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/util.js -var require_util = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/util.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/waiter.js -var require_waiter = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/waiter.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/types/dist-cjs/index.js -var require_dist_cjs15 = __commonJS({ - "../../../node_modules/@aws-sdk/types/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_abort(), exports2); - tslib_1.__exportStar(require_auth(), exports2); - tslib_1.__exportStar(require_blob_types(), exports2); - tslib_1.__exportStar(require_checksum(), exports2); - tslib_1.__exportStar(require_client(), exports2); - tslib_1.__exportStar(require_command(), exports2); - tslib_1.__exportStar(require_connection(), exports2); - tslib_1.__exportStar(require_credentials(), exports2); - tslib_1.__exportStar(require_crypto(), exports2); - tslib_1.__exportStar(require_dns(), exports2); - tslib_1.__exportStar(require_encode(), exports2); - tslib_1.__exportStar(require_endpoint(), exports2); - tslib_1.__exportStar(require_eventStream(), exports2); - tslib_1.__exportStar(require_extensions(), exports2); - tslib_1.__exportStar(require_http(), exports2); - tslib_1.__exportStar(require_identity(), exports2); - tslib_1.__exportStar(require_logger(), exports2); - tslib_1.__exportStar(require_middleware(), exports2); - tslib_1.__exportStar(require_pagination(), exports2); - tslib_1.__exportStar(require_profile(), exports2); - tslib_1.__exportStar(require_request(), exports2); - tslib_1.__exportStar(require_response(), exports2); - tslib_1.__exportStar(require_retry(), exports2); - tslib_1.__exportStar(require_serde(), exports2); - tslib_1.__exportStar(require_shapes(), exports2); - tslib_1.__exportStar(require_signature(), exports2); - tslib_1.__exportStar(require_stream(), exports2); - tslib_1.__exportStar(require_token(), exports2); - tslib_1.__exportStar(require_transfer(), exports2); - tslib_1.__exportStar(require_uri(), exports2); - tslib_1.__exportStar(require_util(), exports2); - tslib_1.__exportStar(require_waiter(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/parseURL.js -var require_parseURL = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/parseURL.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.parseURL = void 0; - var types_1 = require_dist_cjs15(); - var isIpAddress_1 = require_isIpAddress(); - var DEFAULT_PORTS = { - [types_1.EndpointURLScheme.HTTP]: 80, - [types_1.EndpointURLScheme.HTTPS]: 443 +// ../../../node_modules/@smithy/core/node_modules/@smithy/protocol-http/dist-cjs/index.js +var require_dist_cjs20 = __commonJS({ + "../../../node_modules/@smithy/core/node_modules/@smithy/protocol-http/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var parseURL = (value) => { - const whatwgURL = (() => { - try { - if (value instanceof URL) { - return value; - } - if (typeof value === "object" && "hostname" in value) { - const { hostname: hostname2, port, protocol: protocol2 = "", path = "", query = {} } = value; - const url2 = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path}`); - url2.search = Object.entries(query).map(([k, v]) => `${k}=${v}`).join("&"); - return url2; - } - return new URL(value); - } catch (error) { - return null; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + Field: () => Field, + Fields: () => Fields, + HttpRequest: () => HttpRequest7, + HttpResponse: () => HttpResponse2, + IHttpRequest: () => import_types5.HttpRequest, + getHttpHandlerExtensionConfiguration: () => getHttpHandlerExtensionConfiguration, + isValidHostname: () => isValidHostname, + resolveHttpHandlerRuntimeConfig: () => resolveHttpHandlerRuntimeConfig + }); + module2.exports = __toCommonJS2(src_exports); + var getHttpHandlerExtensionConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { + let httpHandler = runtimeConfig.httpHandler; + return { + setHttpHandler(handler2) { + httpHandler = handler2; + }, + httpHandler() { + return httpHandler; + }, + updateHttpClientConfig(key, value) { + httpHandler.updateHttpClientConfig(key, value); + }, + httpHandlerConfigs() { + return httpHandler.httpHandlerConfigs(); } - })(); - if (!whatwgURL) { - console.error(`Unable to parse ${JSON.stringify(value)} as a whatwg URL.`); - return null; + }; + }, "getHttpHandlerExtensionConfiguration"); + var resolveHttpHandlerRuntimeConfig = /* @__PURE__ */ __name((httpHandlerExtensionConfiguration) => { + return { + httpHandler: httpHandlerExtensionConfiguration.httpHandler() + }; + }, "resolveHttpHandlerRuntimeConfig"); + var import_types5 = require_dist_cjs(); + var _Field = class _Field { + constructor({ name, kind = import_types5.FieldPosition.HEADER, values = [] }) { + this.name = name; + this.kind = kind; + this.values = values; } - const urlString = whatwgURL.href; - const { host, hostname, pathname, protocol, search } = whatwgURL; - if (search) { - return null; + /** + * Appends a value to the field. + * + * @param value The value to append. + */ + add(value) { + this.values.push(value); } - const scheme = protocol.slice(0, -1); - if (!Object.values(types_1.EndpointURLScheme).includes(scheme)) { - return null; + /** + * Overwrite existing field values. + * + * @param values The new field values. + */ + set(values) { + this.values = values; } - const isIp = (0, isIpAddress_1.isIpAddress)(hostname); - const inputContainsDefaultPort = urlString.includes(`${host}:${DEFAULT_PORTS[scheme]}`) || typeof value === "string" && value.includes(`${host}:${DEFAULT_PORTS[scheme]}`); - const authority = `${host}${inputContainsDefaultPort ? `:${DEFAULT_PORTS[scheme]}` : ``}`; - return { - scheme, - authority, - path: pathname, - normalizedPath: pathname.endsWith("/") ? pathname : `${pathname}/`, - isIp - }; - }; - exports2.parseURL = parseURL; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/stringEquals.js -var require_stringEquals = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/stringEquals.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.stringEquals = void 0; - var stringEquals = (value1, value2) => value1 === value2; - exports2.stringEquals = stringEquals; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/substring.js -var require_substring = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/substring.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.substring = void 0; - var substring = (input, start, stop, reverse) => { - if (start >= stop || input.length < stop) { - return null; + /** + * Remove all matching entries from list. + * + * @param value Value to remove. + */ + remove(value) { + this.values = this.values.filter((v) => v !== value); } - if (!reverse) { - return input.substring(start, stop); + /** + * Get comma-delimited string. + * + * @returns String representation of {@link Field}. + */ + toString() { + return this.values.map((v) => v.includes(",") || v.includes(" ") ? `"${v}"` : v).join(", "); + } + /** + * Get string values as a list + * + * @returns Values in {@link Field} as a list. + */ + get() { + return this.values; } - return input.substring(input.length - stop, input.length - start); }; - exports2.substring = substring; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/uriEncode.js -var require_uriEncode = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/uriEncode.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.uriEncode = void 0; - var uriEncode = (value) => encodeURIComponent(value).replace(/[!*'()]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`); - exports2.uriEncode = uriEncode; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/index.js -var require_lib = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.aws = void 0; - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - exports2.aws = tslib_1.__importStar(require_aws()); - tslib_1.__exportStar(require_booleanEquals(), exports2); - tslib_1.__exportStar(require_getAttr(), exports2); - tslib_1.__exportStar(require_isSet(), exports2); - tslib_1.__exportStar(require_isValidHostLabel(), exports2); - tslib_1.__exportStar(require_not(), exports2); - tslib_1.__exportStar(require_parseURL(), exports2); - tslib_1.__exportStar(require_stringEquals(), exports2); - tslib_1.__exportStar(require_substring(), exports2); - tslib_1.__exportStar(require_uriEncode(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateTemplate.js -var require_evaluateTemplate = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateTemplate.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.evaluateTemplate = void 0; - var lib_1 = require_lib(); - var evaluateTemplate = (template, options) => { - const evaluatedTemplateArr = []; - const templateContext = { - ...options.endpointParams, - ...options.referenceRecord - }; - let currentIndex = 0; - while (currentIndex < template.length) { - const openingBraceIndex = template.indexOf("{", currentIndex); - if (openingBraceIndex === -1) { - evaluatedTemplateArr.push(template.slice(currentIndex)); - break; - } - evaluatedTemplateArr.push(template.slice(currentIndex, openingBraceIndex)); - const closingBraceIndex = template.indexOf("}", openingBraceIndex); - if (closingBraceIndex === -1) { - evaluatedTemplateArr.push(template.slice(openingBraceIndex)); - break; - } - if (template[openingBraceIndex + 1] === "{" && template[closingBraceIndex + 1] === "}") { - evaluatedTemplateArr.push(template.slice(openingBraceIndex + 1, closingBraceIndex)); - currentIndex = closingBraceIndex + 2; - } - const parameterName = template.substring(openingBraceIndex + 1, closingBraceIndex); - if (parameterName.includes("#")) { - const [refName, attrName] = parameterName.split("#"); - evaluatedTemplateArr.push((0, lib_1.getAttr)(templateContext[refName], attrName)); - } else { - evaluatedTemplateArr.push(templateContext[parameterName]); - } - currentIndex = closingBraceIndex + 1; + __name(_Field, "Field"); + var Field = _Field; + var _Fields = class _Fields { + constructor({ fields = [], encoding = "utf-8" }) { + this.entries = {}; + fields.forEach(this.setField.bind(this)); + this.encoding = encoding; } - return evaluatedTemplateArr.join(""); - }; - exports2.evaluateTemplate = evaluateTemplate; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/getReferenceValue.js -var require_getReferenceValue = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/getReferenceValue.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getReferenceValue = void 0; - var getReferenceValue = ({ ref }, options) => { - const referenceRecord = { - ...options.endpointParams, - ...options.referenceRecord - }; - return referenceRecord[ref]; - }; - exports2.getReferenceValue = getReferenceValue; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateExpression.js -var require_evaluateExpression = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateExpression.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.evaluateExpression = void 0; - var types_1 = require_types(); - var callFunction_1 = require_callFunction(); - var evaluateTemplate_1 = require_evaluateTemplate(); - var getReferenceValue_1 = require_getReferenceValue(); - var evaluateExpression = (obj, keyName, options) => { - if (typeof obj === "string") { - return (0, evaluateTemplate_1.evaluateTemplate)(obj, options); - } else if (obj["fn"]) { - return (0, callFunction_1.callFunction)(obj, options); - } else if (obj["ref"]) { - return (0, getReferenceValue_1.getReferenceValue)(obj, options); + /** + * Set entry for a {@link Field} name. The `name` + * attribute will be used to key the collection. + * + * @param field The {@link Field} to set. + */ + setField(field) { + this.entries[field.name.toLowerCase()] = field; } - throw new types_1.EndpointError(`'${keyName}': ${String(obj)} is not a string, function or reference.`); - }; - exports2.evaluateExpression = evaluateExpression; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/callFunction.js -var require_callFunction = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/callFunction.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.callFunction = void 0; - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - var lib = tslib_1.__importStar(require_lib()); - var evaluateExpression_1 = require_evaluateExpression(); - var callFunction = ({ fn, argv }, options) => { - const evaluatedArgs = argv.map((arg) => ["boolean", "number"].includes(typeof arg) ? arg : (0, evaluateExpression_1.evaluateExpression)(arg, "arg", options)); - return fn.split(".").reduce((acc, key) => acc[key], lib)(...evaluatedArgs); - }; - exports2.callFunction = callFunction; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateCondition.js -var require_evaluateCondition = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateCondition.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.evaluateCondition = void 0; - var debug_1 = require_debug(); - var types_1 = require_types(); - var callFunction_1 = require_callFunction(); - var evaluateCondition = ({ assign, ...fnArgs }, options) => { - var _a, _b; - if (assign && assign in options.referenceRecord) { - throw new types_1.EndpointError(`'${assign}' is already defined in Reference Record.`); + /** + * Retrieve {@link Field} entry by name. + * + * @param name The name of the {@link Field} entry + * to retrieve + * @returns The {@link Field} if it exists. + */ + getField(name) { + return this.entries[name.toLowerCase()]; + } + /** + * Delete entry from collection. + * + * @param name Name of the entry to delete. + */ + removeField(name) { + delete this.entries[name.toLowerCase()]; + } + /** + * Helper function for retrieving specific types of fields. + * Used to grab all headers or all trailers. + * + * @param kind {@link FieldPosition} of entries to retrieve. + * @returns The {@link Field} entries with the specified + * {@link FieldPosition}. + */ + getByType(kind) { + return Object.values(this.entries).filter((field) => field.kind === kind); } - const value = (0, callFunction_1.callFunction)(fnArgs, options); - (_b = (_a = options.logger) === null || _a === void 0 ? void 0 : _a.debug) === null || _b === void 0 ? void 0 : _b.call(_a, debug_1.debugId, `evaluateCondition: ${(0, debug_1.toDebugString)(fnArgs)} = ${(0, debug_1.toDebugString)(value)}`); - return { - result: value === "" ? true : !!value, - ...assign != null && { toAssign: { name: assign, value } } - }; }; - exports2.evaluateCondition = evaluateCondition; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateConditions.js -var require_evaluateConditions = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateConditions.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.evaluateConditions = void 0; - var debug_1 = require_debug(); - var evaluateCondition_1 = require_evaluateCondition(); - var evaluateConditions = (conditions = [], options) => { - var _a, _b; - const conditionsReferenceRecord = {}; - for (const condition of conditions) { - const { result, toAssign } = (0, evaluateCondition_1.evaluateCondition)(condition, { - ...options, - referenceRecord: { - ...options.referenceRecord, - ...conditionsReferenceRecord - } + __name(_Fields, "Fields"); + var Fields = _Fields; + var _HttpRequest = class _HttpRequest2 { + constructor(options) { + this.method = options.method || "GET"; + this.hostname = options.hostname || "localhost"; + this.port = options.port; + this.query = options.query || {}; + this.headers = options.headers || {}; + this.body = options.body; + this.protocol = options.protocol ? options.protocol.slice(-1) !== ":" ? `${options.protocol}:` : options.protocol : "https:"; + this.path = options.path ? options.path.charAt(0) !== "/" ? `/${options.path}` : options.path : "/"; + this.username = options.username; + this.password = options.password; + this.fragment = options.fragment; + } + /** + * Note: this does not deep-clone the body. + */ + static clone(request2) { + const cloned = new _HttpRequest2({ + ...request2, + headers: { ...request2.headers } }); - if (!result) { - return { result }; + if (cloned.query) { + cloned.query = cloneQuery(cloned.query); } - if (toAssign) { - conditionsReferenceRecord[toAssign.name] = toAssign.value; - (_b = (_a = options.logger) === null || _a === void 0 ? void 0 : _a.debug) === null || _b === void 0 ? void 0 : _b.call(_a, debug_1.debugId, `assign: ${toAssign.name} := ${(0, debug_1.toDebugString)(toAssign.value)}`); + return cloned; + } + /** + * This method only actually asserts that request is the interface {@link IHttpRequest}, + * and not necessarily this concrete class. Left in place for API stability. + * + * Do not call instance methods on the input of this function, and + * do not assume it has the HttpRequest prototype. + */ + static isInstance(request2) { + if (!request2) { + return false; } + const req = request2; + return "method" in req && "protocol" in req && "hostname" in req && "path" in req && typeof req["query"] === "object" && typeof req["headers"] === "object"; + } + /** + * @deprecated use static HttpRequest.clone(request) instead. It's not safe to call + * this method because {@link HttpRequest.isInstance} incorrectly + * asserts that IHttpRequest (interface) objects are of type HttpRequest (class). + */ + clone() { + return _HttpRequest2.clone(this); } - return { result: true, referenceRecord: conditionsReferenceRecord }; }; - exports2.evaluateConditions = evaluateConditions; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/getEndpointHeaders.js -var require_getEndpointHeaders = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/getEndpointHeaders.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getEndpointHeaders = void 0; - var types_1 = require_types(); - var evaluateExpression_1 = require_evaluateExpression(); - var getEndpointHeaders = (headers, options) => Object.entries(headers).reduce((acc, [headerKey, headerVal]) => ({ - ...acc, - [headerKey]: headerVal.map((headerValEntry) => { - const processedExpr = (0, evaluateExpression_1.evaluateExpression)(headerValEntry, "Header value entry", options); - if (typeof processedExpr !== "string") { - throw new types_1.EndpointError(`Header '${headerKey}' value '${processedExpr}' is not a string`); - } - return processedExpr; - }) - }), {}); - exports2.getEndpointHeaders = getEndpointHeaders; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/getEndpointProperty.js -var require_getEndpointProperty = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/getEndpointProperty.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getEndpointProperty = void 0; - var types_1 = require_types(); - var evaluateTemplate_1 = require_evaluateTemplate(); - var getEndpointProperties_1 = require_getEndpointProperties(); - var getEndpointProperty = (property, options) => { - if (Array.isArray(property)) { - return property.map((propertyEntry) => (0, exports2.getEndpointProperty)(propertyEntry, options)); + __name(_HttpRequest, "HttpRequest"); + var HttpRequest7 = _HttpRequest; + function cloneQuery(query) { + return Object.keys(query).reduce((carry, paramName) => { + const param = query[paramName]; + return { + ...carry, + [paramName]: Array.isArray(param) ? [...param] : param + }; + }, {}); + } + __name(cloneQuery, "cloneQuery"); + var _HttpResponse = class _HttpResponse { + constructor(options) { + this.statusCode = options.statusCode; + this.reason = options.reason; + this.headers = options.headers || {}; + this.body = options.body; } - switch (typeof property) { - case "string": - return (0, evaluateTemplate_1.evaluateTemplate)(property, options); - case "object": - if (property === null) { - throw new types_1.EndpointError(`Unexpected endpoint property: ${property}`); - } - return (0, getEndpointProperties_1.getEndpointProperties)(property, options); - case "boolean": - return property; - default: - throw new types_1.EndpointError(`Unexpected endpoint property type: ${typeof property}`); + static isInstance(response) { + if (!response) + return false; + const resp = response; + return typeof resp.statusCode === "number" && typeof resp.headers === "object"; } }; - exports2.getEndpointProperty = getEndpointProperty; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/getEndpointProperties.js -var require_getEndpointProperties = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/getEndpointProperties.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getEndpointProperties = void 0; - var getEndpointProperty_1 = require_getEndpointProperty(); - var getEndpointProperties = (properties, options) => Object.entries(properties).reduce((acc, [propertyKey, propertyVal]) => ({ - ...acc, - [propertyKey]: (0, getEndpointProperty_1.getEndpointProperty)(propertyVal, options) - }), {}); - exports2.getEndpointProperties = getEndpointProperties; + __name(_HttpResponse, "HttpResponse"); + var HttpResponse2 = _HttpResponse; + function isValidHostname(hostname) { + const hostPattern = /^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/; + return hostPattern.test(hostname); + } + __name(isValidHostname, "isValidHostname"); } }); -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/getEndpointUrl.js -var require_getEndpointUrl = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/getEndpointUrl.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getEndpointUrl = void 0; - var types_1 = require_types(); - var evaluateExpression_1 = require_evaluateExpression(); - var getEndpointUrl = (endpointUrl, options) => { - const expression = (0, evaluateExpression_1.evaluateExpression)(endpointUrl, "Endpoint URL", options); - if (typeof expression === "string") { - try { - return new URL(expression); - } catch (error) { - console.error(`Failed to construct URL with ${expression}`, error); - throw error; - } - } - throw new types_1.EndpointError(`Endpoint URL must be a string, got ${typeof expression}`); +// ../../../node_modules/@smithy/core/dist-es/middleware-http-signing/httpSigningMiddleware.js +var import_protocol_http, import_types2, import_util_middleware2, defaultErrorHandler, defaultSuccessHandler, httpSigningMiddleware; +var init_httpSigningMiddleware = __esm({ + "../../../node_modules/@smithy/core/dist-es/middleware-http-signing/httpSigningMiddleware.js"() { + import_protocol_http = __toESM(require_dist_cjs20()); + import_types2 = __toESM(require_dist_cjs()); + import_util_middleware2 = __toESM(require_dist_cjs12()); + defaultErrorHandler = (signingProperties) => (error) => { + throw error; }; - exports2.getEndpointUrl = getEndpointUrl; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateEndpointRule.js -var require_evaluateEndpointRule = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateEndpointRule.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.evaluateEndpointRule = void 0; - var debug_1 = require_debug(); - var evaluateConditions_1 = require_evaluateConditions(); - var getEndpointHeaders_1 = require_getEndpointHeaders(); - var getEndpointProperties_1 = require_getEndpointProperties(); - var getEndpointUrl_1 = require_getEndpointUrl(); - var evaluateEndpointRule = (endpointRule, options) => { - var _a, _b; - const { conditions, endpoint } = endpointRule; - const { result, referenceRecord } = (0, evaluateConditions_1.evaluateConditions)(conditions, options); - if (!result) { - return; + defaultSuccessHandler = (httpResponse, signingProperties) => { + }; + httpSigningMiddleware = (config) => (next, context) => async (args) => { + if (!import_protocol_http.HttpRequest.isInstance(args.request)) { + return next(args); } - const endpointRuleOptions = { - ...options, - referenceRecord: { ...options.referenceRecord, ...referenceRecord } - }; - const { url: url2, properties, headers } = endpoint; - (_b = (_a = options.logger) === null || _a === void 0 ? void 0 : _a.debug) === null || _b === void 0 ? void 0 : _b.call(_a, debug_1.debugId, `Resolving endpoint from template: ${(0, debug_1.toDebugString)(endpoint)}`); - return { - ...headers != void 0 && { - headers: (0, getEndpointHeaders_1.getEndpointHeaders)(headers, endpointRuleOptions) - }, - ...properties != void 0 && { - properties: (0, getEndpointProperties_1.getEndpointProperties)(properties, endpointRuleOptions) - }, - url: (0, getEndpointUrl_1.getEndpointUrl)(url2, endpointRuleOptions) - }; + const smithyContext = (0, import_util_middleware2.getSmithyContext)(context); + const scheme = smithyContext.selectedHttpAuthScheme; + if (!scheme) { + throw new Error(`No HttpAuthScheme was selected: unable to sign request`); + } + const { httpAuthOption: { signingProperties = {} }, identity, signer } = scheme; + const output = await next({ + ...args, + request: await signer.sign(args.request, identity, signingProperties) + }).catch((signer.errorHandler || defaultErrorHandler)(signingProperties)); + (signer.successHandler || defaultSuccessHandler)(output.response, signingProperties); + return output; }; - exports2.evaluateEndpointRule = evaluateEndpointRule; } }); -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateErrorRule.js -var require_evaluateErrorRule = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateErrorRule.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.evaluateErrorRule = void 0; - var types_1 = require_types(); - var evaluateConditions_1 = require_evaluateConditions(); - var evaluateExpression_1 = require_evaluateExpression(); - var evaluateErrorRule = (errorRule, options) => { - const { conditions, error } = errorRule; - const { result, referenceRecord } = (0, evaluateConditions_1.evaluateConditions)(conditions, options); - if (!result) { - return; - } - throw new types_1.EndpointError((0, evaluateExpression_1.evaluateExpression)(error, "Error", { - ...options, - referenceRecord: { ...options.referenceRecord, ...referenceRecord } - })); - }; - exports2.evaluateErrorRule = evaluateErrorRule; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateTreeRule.js -var require_evaluateTreeRule = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateTreeRule.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.evaluateTreeRule = void 0; - var evaluateConditions_1 = require_evaluateConditions(); - var evaluateRules_1 = require_evaluateRules(); - var evaluateTreeRule = (treeRule, options) => { - const { conditions, rules } = treeRule; - const { result, referenceRecord } = (0, evaluateConditions_1.evaluateConditions)(conditions, options); - if (!result) { - return; - } - return (0, evaluateRules_1.evaluateRules)(rules, { - ...options, - referenceRecord: { ...options.referenceRecord, ...referenceRecord } - }); - }; - exports2.evaluateTreeRule = evaluateTreeRule; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateRules.js -var require_evaluateRules = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/evaluateRules.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.evaluateRules = void 0; - var types_1 = require_types(); - var evaluateEndpointRule_1 = require_evaluateEndpointRule(); - var evaluateErrorRule_1 = require_evaluateErrorRule(); - var evaluateTreeRule_1 = require_evaluateTreeRule(); - var evaluateRules = (rules, options) => { - for (const rule of rules) { - if (rule.type === "endpoint") { - const endpointOrUndefined = (0, evaluateEndpointRule_1.evaluateEndpointRule)(rule, options); - if (endpointOrUndefined) { - return endpointOrUndefined; - } - } else if (rule.type === "error") { - (0, evaluateErrorRule_1.evaluateErrorRule)(rule, options); - } else if (rule.type === "tree") { - const endpointOrUndefined = (0, evaluateTreeRule_1.evaluateTreeRule)(rule, options); - if (endpointOrUndefined) { - return endpointOrUndefined; - } - } else { - throw new types_1.EndpointError(`Unknown endpoint rule: ${rule}`); - } - } - throw new types_1.EndpointError(`Rules evaluation failed`); - }; - exports2.evaluateRules = evaluateRules; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/index.js -var require_utils = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/utils/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_evaluateRules(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/resolveEndpoint.js -var require_resolveEndpoint = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/resolveEndpoint.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveEndpoint = void 0; - var debug_1 = require_debug(); - var types_1 = require_types(); - var utils_1 = require_utils(); - var resolveEndpoint = (ruleSetObject, options) => { - var _a, _b, _c, _d, _e, _f; - const { endpointParams, logger } = options; - const { parameters, rules } = ruleSetObject; - (_b = (_a = options.logger) === null || _a === void 0 ? void 0 : _a.debug) === null || _b === void 0 ? void 0 : _b.call(_a, `${debug_1.debugId} Initial EndpointParams: ${(0, debug_1.toDebugString)(endpointParams)}`); - const paramsWithDefault = Object.entries(parameters).filter(([, v]) => v.default != null).map(([k, v]) => [k, v.default]); - if (paramsWithDefault.length > 0) { - for (const [paramKey, paramDefaultValue] of paramsWithDefault) { - endpointParams[paramKey] = (_c = endpointParams[paramKey]) !== null && _c !== void 0 ? _c : paramDefaultValue; - } - } - const requiredParams = Object.entries(parameters).filter(([, v]) => v.required).map(([k]) => k); - for (const requiredParam of requiredParams) { - if (endpointParams[requiredParam] == null) { - throw new types_1.EndpointError(`Missing required parameter: '${requiredParam}'`); - } - } - const endpoint = (0, utils_1.evaluateRules)(rules, { endpointParams, logger, referenceRecord: {} }); - if ((_d = options.endpointParams) === null || _d === void 0 ? void 0 : _d.Endpoint) { - try { - const givenEndpoint = new URL(options.endpointParams.Endpoint); - const { protocol, port } = givenEndpoint; - endpoint.url.protocol = protocol; - endpoint.url.port = port; - } catch (e) { - } - } - (_f = (_e = options.logger) === null || _e === void 0 ? void 0 : _e.debug) === null || _f === void 0 ? void 0 : _f.call(_e, `${debug_1.debugId} Resolved endpoint: ${(0, debug_1.toDebugString)(endpoint)}`); - return endpoint; - }; - exports2.resolveEndpoint = resolveEndpoint; - } -}); - -// ../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/index.js -var require_dist_cjs16 = __commonJS({ - "../../../node_modules/@aws-sdk/util-endpoints/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_partition(), exports2); - tslib_1.__exportStar(require_isIpAddress(), exports2); - tslib_1.__exportStar(require_resolveEndpoint(), exports2); - tslib_1.__exportStar(require_types(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/middleware-user-agent/dist-cjs/constants.js -var require_constants = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-user-agent/dist-cjs/constants.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.UA_ESCAPE_CHAR = exports2.UA_VALUE_ESCAPE_REGEX = exports2.UA_NAME_ESCAPE_REGEX = exports2.UA_NAME_SEPARATOR = exports2.SPACE = exports2.X_AMZ_USER_AGENT = exports2.USER_AGENT = void 0; - exports2.USER_AGENT = "user-agent"; - exports2.X_AMZ_USER_AGENT = "x-amz-user-agent"; - exports2.SPACE = " "; - exports2.UA_NAME_SEPARATOR = "/"; - exports2.UA_NAME_ESCAPE_REGEX = /[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g; - exports2.UA_VALUE_ESCAPE_REGEX = /[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g; - exports2.UA_ESCAPE_CHAR = "-"; - } -}); - -// ../../../node_modules/@aws-sdk/middleware-user-agent/dist-cjs/user-agent-middleware.js -var require_user_agent_middleware = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-user-agent/dist-cjs/user-agent-middleware.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getUserAgentPlugin = exports2.getUserAgentMiddlewareOptions = exports2.userAgentMiddleware = void 0; - var util_endpoints_1 = require_dist_cjs16(); - var protocol_http_1 = require_dist_cjs2(); - var constants_1 = require_constants(); - var userAgentMiddleware = (options) => (next, context) => async (args) => { - var _a, _b; - const { request: request2 } = args; - if (!protocol_http_1.HttpRequest.isInstance(request2)) - return next(args); - const { headers } = request2; - const userAgent = ((_a = context === null || context === void 0 ? void 0 : context.userAgent) === null || _a === void 0 ? void 0 : _a.map(escapeUserAgent)) || []; - const defaultUserAgent = (await options.defaultUserAgentProvider()).map(escapeUserAgent); - const customUserAgent = ((_b = options === null || options === void 0 ? void 0 : options.customUserAgent) === null || _b === void 0 ? void 0 : _b.map(escapeUserAgent)) || []; - const prefix = (0, util_endpoints_1.getUserAgentPrefix)(); - const sdkUserAgentValue = (prefix ? [prefix] : []).concat([...defaultUserAgent, ...userAgent, ...customUserAgent]).join(constants_1.SPACE); - const normalUAValue = [ - ...defaultUserAgent.filter((section) => section.startsWith("aws-sdk-")), - ...customUserAgent - ].join(constants_1.SPACE); - if (options.runtime !== "browser") { - if (normalUAValue) { - headers[constants_1.X_AMZ_USER_AGENT] = headers[constants_1.X_AMZ_USER_AGENT] ? `${headers[constants_1.USER_AGENT]} ${normalUAValue}` : normalUAValue; - } - headers[constants_1.USER_AGENT] = sdkUserAgentValue; - } else { - headers[constants_1.X_AMZ_USER_AGENT] = sdkUserAgentValue; - } - return next({ - ...args, - request: request2 - }); - }; - exports2.userAgentMiddleware = userAgentMiddleware; - var escapeUserAgent = (userAgentPair) => { - var _a; - const name = userAgentPair[0].split(constants_1.UA_NAME_SEPARATOR).map((part) => part.replace(constants_1.UA_NAME_ESCAPE_REGEX, constants_1.UA_ESCAPE_CHAR)).join(constants_1.UA_NAME_SEPARATOR); - const version2 = (_a = userAgentPair[1]) === null || _a === void 0 ? void 0 : _a.replace(constants_1.UA_VALUE_ESCAPE_REGEX, constants_1.UA_ESCAPE_CHAR); - const prefixSeparatorIndex = name.indexOf(constants_1.UA_NAME_SEPARATOR); - const prefix = name.substring(0, prefixSeparatorIndex); - let uaName = name.substring(prefixSeparatorIndex + 1); - if (prefix === "api") { - uaName = uaName.toLowerCase(); - } - return [prefix, uaName, version2].filter((item) => item && item.length > 0).reduce((acc, item, index) => { - switch (index) { - case 0: - return item; - case 1: - return `${acc}/${item}`; - default: - return `${acc}#${item}`; - } - }, ""); - }; - exports2.getUserAgentMiddlewareOptions = { - name: "getUserAgentMiddleware", - step: "build", - priority: "low", - tags: ["SET_USER_AGENT", "USER_AGENT"], - override: true - }; - var getUserAgentPlugin = (config) => ({ - applyToStack: (clientStack) => { - clientStack.add((0, exports2.userAgentMiddleware)(config), exports2.getUserAgentMiddlewareOptions); - } - }); - exports2.getUserAgentPlugin = getUserAgentPlugin; - } -}); - -// ../../../node_modules/@aws-sdk/middleware-user-agent/dist-cjs/index.js -var require_dist_cjs17 = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-user-agent/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_configurations(), exports2); - tslib_1.__exportStar(require_user_agent_middleware(), exports2); - } -}); - -// ../../../node_modules/@smithy/util-config-provider/dist-cjs/index.js -var require_dist_cjs18 = __commonJS({ - "../../../node_modules/@smithy/util-config-provider/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - SelectorType: () => SelectorType, - booleanSelector: () => booleanSelector, - numberSelector: () => numberSelector - }); - module2.exports = __toCommonJS2(src_exports); - var booleanSelector = /* @__PURE__ */ __name((obj, key, type) => { - if (!(key in obj)) - return void 0; - if (obj[key] === "true") - return true; - if (obj[key] === "false") - return false; - throw new Error(`Cannot load ${type} "${key}". Expected "true" or "false", got ${obj[key]}.`); - }, "booleanSelector"); - var numberSelector = /* @__PURE__ */ __name((obj, key, type) => { - if (!(key in obj)) - return void 0; - const numberValue = parseInt(obj[key], 10); - if (Number.isNaN(numberValue)) { - throw new TypeError(`Cannot load ${type} '${key}'. Expected number, got '${obj[key]}'.`); - } - return numberValue; - }, "numberSelector"); - var SelectorType = /* @__PURE__ */ ((SelectorType2) => { - SelectorType2["ENV"] = "env"; - SelectorType2["CONFIG"] = "shared config entry"; - return SelectorType2; - })(SelectorType || {}); - } -}); - -// ../../../node_modules/@smithy/config-resolver/dist-cjs/index.js -var require_dist_cjs19 = __commonJS({ - "../../../node_modules/@smithy/config-resolver/dist-cjs/index.js"(exports2, module2) { +// ../../../node_modules/@smithy/middleware-retry/node_modules/@smithy/protocol-http/dist-cjs/index.js +var require_dist_cjs21 = __commonJS({ + "../../../node_modules/@smithy/middleware-retry/node_modules/@smithy/protocol-http/dist-cjs/index.js"(exports2, module2) { var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames2 = Object.getOwnPropertyNames; @@ -4677,657 +4023,576 @@ var require_dist_cjs19 = __commonJS({ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var src_exports = {}; __export2(src_exports, { - CONFIG_USE_DUALSTACK_ENDPOINT: () => CONFIG_USE_DUALSTACK_ENDPOINT, - CONFIG_USE_FIPS_ENDPOINT: () => CONFIG_USE_FIPS_ENDPOINT, - DEFAULT_USE_DUALSTACK_ENDPOINT: () => DEFAULT_USE_DUALSTACK_ENDPOINT, - DEFAULT_USE_FIPS_ENDPOINT: () => DEFAULT_USE_FIPS_ENDPOINT, - ENV_USE_DUALSTACK_ENDPOINT: () => ENV_USE_DUALSTACK_ENDPOINT, - ENV_USE_FIPS_ENDPOINT: () => ENV_USE_FIPS_ENDPOINT, - NODE_REGION_CONFIG_FILE_OPTIONS: () => NODE_REGION_CONFIG_FILE_OPTIONS, - NODE_REGION_CONFIG_OPTIONS: () => NODE_REGION_CONFIG_OPTIONS, - NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS: () => NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, - NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS: () => NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, - REGION_ENV_NAME: () => REGION_ENV_NAME, - REGION_INI_NAME: () => REGION_INI_NAME, - getRegionInfo: () => getRegionInfo, - resolveCustomEndpointsConfig: () => resolveCustomEndpointsConfig, - resolveEndpointsConfig: () => resolveEndpointsConfig, - resolveRegionConfig: () => resolveRegionConfig + Field: () => Field, + Fields: () => Fields, + HttpRequest: () => HttpRequest7, + HttpResponse: () => HttpResponse2, + IHttpRequest: () => import_types5.HttpRequest, + getHttpHandlerExtensionConfiguration: () => getHttpHandlerExtensionConfiguration, + isValidHostname: () => isValidHostname, + resolveHttpHandlerRuntimeConfig: () => resolveHttpHandlerRuntimeConfig }); module2.exports = __toCommonJS2(src_exports); - var import_util_config_provider = require_dist_cjs18(); - var ENV_USE_DUALSTACK_ENDPOINT = "AWS_USE_DUALSTACK_ENDPOINT"; - var CONFIG_USE_DUALSTACK_ENDPOINT = "use_dualstack_endpoint"; - var DEFAULT_USE_DUALSTACK_ENDPOINT = false; - var NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS = { - environmentVariableSelector: (env) => (0, import_util_config_provider.booleanSelector)(env, ENV_USE_DUALSTACK_ENDPOINT, import_util_config_provider.SelectorType.ENV), - configFileSelector: (profile) => (0, import_util_config_provider.booleanSelector)(profile, CONFIG_USE_DUALSTACK_ENDPOINT, import_util_config_provider.SelectorType.CONFIG), - default: false - }; - var ENV_USE_FIPS_ENDPOINT = "AWS_USE_FIPS_ENDPOINT"; - var CONFIG_USE_FIPS_ENDPOINT = "use_fips_endpoint"; - var DEFAULT_USE_FIPS_ENDPOINT = false; - var NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS = { - environmentVariableSelector: (env) => (0, import_util_config_provider.booleanSelector)(env, ENV_USE_FIPS_ENDPOINT, import_util_config_provider.SelectorType.ENV), - configFileSelector: (profile) => (0, import_util_config_provider.booleanSelector)(profile, CONFIG_USE_FIPS_ENDPOINT, import_util_config_provider.SelectorType.CONFIG), - default: false - }; - var import_util_middleware = require_dist_cjs7(); - var resolveCustomEndpointsConfig = /* @__PURE__ */ __name((input) => { - const { endpoint, urlParser } = input; + var getHttpHandlerExtensionConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { + let httpHandler = runtimeConfig.httpHandler; return { - ...input, - tls: input.tls ?? true, - endpoint: (0, import_util_middleware.normalizeProvider)(typeof endpoint === "string" ? urlParser(endpoint) : endpoint), - isCustomEndpoint: true, - useDualstackEndpoint: (0, import_util_middleware.normalizeProvider)(input.useDualstackEndpoint ?? false) + setHttpHandler(handler2) { + httpHandler = handler2; + }, + httpHandler() { + return httpHandler; + }, + updateHttpClientConfig(key, value) { + httpHandler.updateHttpClientConfig(key, value); + }, + httpHandlerConfigs() { + return httpHandler.httpHandlerConfigs(); + } }; - }, "resolveCustomEndpointsConfig"); - var getEndpointFromRegion = /* @__PURE__ */ __name(async (input) => { - const { tls = true } = input; - const region = await input.region(); - const dnsHostRegex = new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/); - if (!dnsHostRegex.test(region)) { - throw new Error("Invalid region in client config"); - } - const useDualstackEndpoint = await input.useDualstackEndpoint(); - const useFipsEndpoint = await input.useFipsEndpoint(); - const { hostname } = await input.regionInfoProvider(region, { useDualstackEndpoint, useFipsEndpoint }) ?? {}; - if (!hostname) { - throw new Error("Cannot resolve hostname from client config"); - } - return input.urlParser(`${tls ? "https:" : "http:"}//${hostname}`); - }, "getEndpointFromRegion"); - var resolveEndpointsConfig = /* @__PURE__ */ __name((input) => { - const useDualstackEndpoint = (0, import_util_middleware.normalizeProvider)(input.useDualstackEndpoint ?? false); - const { endpoint, useFipsEndpoint, urlParser } = input; + }, "getHttpHandlerExtensionConfiguration"); + var resolveHttpHandlerRuntimeConfig = /* @__PURE__ */ __name((httpHandlerExtensionConfiguration) => { return { - ...input, - tls: input.tls ?? true, - endpoint: endpoint ? (0, import_util_middleware.normalizeProvider)(typeof endpoint === "string" ? urlParser(endpoint) : endpoint) : () => getEndpointFromRegion({ ...input, useDualstackEndpoint, useFipsEndpoint }), - isCustomEndpoint: !!endpoint, - useDualstackEndpoint + httpHandler: httpHandlerExtensionConfiguration.httpHandler() }; - }, "resolveEndpointsConfig"); - var REGION_ENV_NAME = "AWS_REGION"; - var REGION_INI_NAME = "region"; - var NODE_REGION_CONFIG_OPTIONS = { - environmentVariableSelector: (env) => env[REGION_ENV_NAME], - configFileSelector: (profile) => profile[REGION_INI_NAME], - default: () => { - throw new Error("Region is missing"); + }, "resolveHttpHandlerRuntimeConfig"); + var import_types5 = require_dist_cjs(); + var _Field = class _Field { + constructor({ name, kind = import_types5.FieldPosition.HEADER, values = [] }) { + this.name = name; + this.kind = kind; + this.values = values; + } + /** + * Appends a value to the field. + * + * @param value The value to append. + */ + add(value) { + this.values.push(value); + } + /** + * Overwrite existing field values. + * + * @param values The new field values. + */ + set(values) { + this.values = values; + } + /** + * Remove all matching entries from list. + * + * @param value Value to remove. + */ + remove(value) { + this.values = this.values.filter((v) => v !== value); + } + /** + * Get comma-delimited string. + * + * @returns String representation of {@link Field}. + */ + toString() { + return this.values.map((v) => v.includes(",") || v.includes(" ") ? `"${v}"` : v).join(", "); + } + /** + * Get string values as a list + * + * @returns Values in {@link Field} as a list. + */ + get() { + return this.values; } }; - var NODE_REGION_CONFIG_FILE_OPTIONS = { - preferredFile: "credentials" + __name(_Field, "Field"); + var Field = _Field; + var _Fields = class _Fields { + constructor({ fields = [], encoding = "utf-8" }) { + this.entries = {}; + fields.forEach(this.setField.bind(this)); + this.encoding = encoding; + } + /** + * Set entry for a {@link Field} name. The `name` + * attribute will be used to key the collection. + * + * @param field The {@link Field} to set. + */ + setField(field) { + this.entries[field.name.toLowerCase()] = field; + } + /** + * Retrieve {@link Field} entry by name. + * + * @param name The name of the {@link Field} entry + * to retrieve + * @returns The {@link Field} if it exists. + */ + getField(name) { + return this.entries[name.toLowerCase()]; + } + /** + * Delete entry from collection. + * + * @param name Name of the entry to delete. + */ + removeField(name) { + delete this.entries[name.toLowerCase()]; + } + /** + * Helper function for retrieving specific types of fields. + * Used to grab all headers or all trailers. + * + * @param kind {@link FieldPosition} of entries to retrieve. + * @returns The {@link Field} entries with the specified + * {@link FieldPosition}. + */ + getByType(kind) { + return Object.values(this.entries).filter((field) => field.kind === kind); + } }; - var isFipsRegion = /* @__PURE__ */ __name((region) => typeof region === "string" && (region.startsWith("fips-") || region.endsWith("-fips")), "isFipsRegion"); - var getRealRegion = /* @__PURE__ */ __name((region) => isFipsRegion(region) ? ["fips-aws-global", "aws-fips"].includes(region) ? "us-east-1" : region.replace(/fips-(dkr-|prod-)?|-fips/, "") : region, "getRealRegion"); - var resolveRegionConfig = /* @__PURE__ */ __name((input) => { - const { region, useFipsEndpoint } = input; - if (!region) { - throw new Error("Region is missing"); + __name(_Fields, "Fields"); + var Fields = _Fields; + var _HttpRequest = class _HttpRequest2 { + constructor(options) { + this.method = options.method || "GET"; + this.hostname = options.hostname || "localhost"; + this.port = options.port; + this.query = options.query || {}; + this.headers = options.headers || {}; + this.body = options.body; + this.protocol = options.protocol ? options.protocol.slice(-1) !== ":" ? `${options.protocol}:` : options.protocol : "https:"; + this.path = options.path ? options.path.charAt(0) !== "/" ? `/${options.path}` : options.path : "/"; + this.username = options.username; + this.password = options.password; + this.fragment = options.fragment; } - return { - ...input, - region: async () => { - if (typeof region === "string") { - return getRealRegion(region); - } - const providedRegion = await region(); - return getRealRegion(providedRegion); - }, - useFipsEndpoint: async () => { - const providedRegion = typeof region === "string" ? region : await region(); - if (isFipsRegion(providedRegion)) { - return true; - } - return typeof useFipsEndpoint !== "function" ? Promise.resolve(!!useFipsEndpoint) : useFipsEndpoint(); - } - }; - }, "resolveRegionConfig"); - var getHostnameFromVariants = /* @__PURE__ */ __name((variants = [], { useFipsEndpoint, useDualstackEndpoint }) => { - var _a; - return (_a = variants.find( - ({ tags }) => useFipsEndpoint === tags.includes("fips") && useDualstackEndpoint === tags.includes("dualstack") - )) == null ? void 0 : _a.hostname; - }, "getHostnameFromVariants"); - var getResolvedHostname = /* @__PURE__ */ __name((resolvedRegion, { regionHostname, partitionHostname }) => regionHostname ? regionHostname : partitionHostname ? partitionHostname.replace("{region}", resolvedRegion) : void 0, "getResolvedHostname"); - var getResolvedPartition = /* @__PURE__ */ __name((region, { partitionHash }) => Object.keys(partitionHash || {}).find((key) => partitionHash[key].regions.includes(region)) ?? "aws", "getResolvedPartition"); - var getResolvedSigningRegion = /* @__PURE__ */ __name((hostname, { signingRegion, regionRegex, useFipsEndpoint }) => { - if (signingRegion) { - return signingRegion; - } else if (useFipsEndpoint) { - const regionRegexJs = regionRegex.replace("\\\\", "\\").replace(/^\^/g, "\\.").replace(/\$$/g, "\\."); - const regionRegexmatchArray = hostname.match(regionRegexJs); - if (regionRegexmatchArray) { - return regionRegexmatchArray[0].slice(1, -1); + /** + * Note: this does not deep-clone the body. + */ + static clone(request2) { + const cloned = new _HttpRequest2({ + ...request2, + headers: { ...request2.headers } + }); + if (cloned.query) { + cloned.query = cloneQuery(cloned.query); } + return cloned; } - }, "getResolvedSigningRegion"); - var getRegionInfo = /* @__PURE__ */ __name((region, { - useFipsEndpoint = false, - useDualstackEndpoint = false, - signingService, - regionHash, - partitionHash - }) => { - var _a, _b, _c, _d, _e; - const partition = getResolvedPartition(region, { partitionHash }); - const resolvedRegion = region in regionHash ? region : ((_a = partitionHash[partition]) == null ? void 0 : _a.endpoint) ?? region; - const hostnameOptions = { useFipsEndpoint, useDualstackEndpoint }; - const regionHostname = getHostnameFromVariants((_b = regionHash[resolvedRegion]) == null ? void 0 : _b.variants, hostnameOptions); - const partitionHostname = getHostnameFromVariants((_c = partitionHash[partition]) == null ? void 0 : _c.variants, hostnameOptions); - const hostname = getResolvedHostname(resolvedRegion, { regionHostname, partitionHostname }); - if (hostname === void 0) { - throw new Error(`Endpoint resolution failed for: ${{ resolvedRegion, useFipsEndpoint, useDualstackEndpoint }}`); - } - const signingRegion = getResolvedSigningRegion(hostname, { - signingRegion: (_d = regionHash[resolvedRegion]) == null ? void 0 : _d.signingRegion, - regionRegex: partitionHash[partition].regionRegex, - useFipsEndpoint - }); - return { - partition, - signingService, - hostname, - ...signingRegion && { signingRegion }, - ...((_e = regionHash[resolvedRegion]) == null ? void 0 : _e.signingService) && { - signingService: regionHash[resolvedRegion].signingService + /** + * This method only actually asserts that request is the interface {@link IHttpRequest}, + * and not necessarily this concrete class. Left in place for API stability. + * + * Do not call instance methods on the input of this function, and + * do not assume it has the HttpRequest prototype. + */ + static isInstance(request2) { + if (!request2) { + return false; } - }; - }, "getRegionInfo"); - } -}); - -// ../../../node_modules/@smithy/middleware-content-length/dist-cjs/index.js -var require_dist_cjs20 = __commonJS({ - "../../../node_modules/@smithy/middleware-content-length/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + const req = request2; + return "method" in req && "protocol" in req && "hostname" in req && "path" in req && typeof req["query"] === "object" && typeof req["headers"] === "object"; + } + /** + * @deprecated use static HttpRequest.clone(request) instead. It's not safe to call + * this method because {@link HttpRequest.isInstance} incorrectly + * asserts that IHttpRequest (interface) objects are of type HttpRequest (class). + */ + clone() { + return _HttpRequest2.clone(this); } - return to; }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - contentLengthMiddleware: () => contentLengthMiddleware, - contentLengthMiddlewareOptions: () => contentLengthMiddlewareOptions, - getContentLengthPlugin: () => getContentLengthPlugin - }); - module2.exports = __toCommonJS2(src_exports); - var import_protocol_http = require_dist_cjs2(); - var CONTENT_LENGTH_HEADER = "content-length"; - function contentLengthMiddleware(bodyLengthChecker) { - return (next) => async (args) => { - const request2 = args.request; - if (import_protocol_http.HttpRequest.isInstance(request2)) { - const { body, headers } = request2; - if (body && Object.keys(headers).map((str) => str.toLowerCase()).indexOf(CONTENT_LENGTH_HEADER) === -1) { - try { - const length = bodyLengthChecker(body); - request2.headers = { - ...request2.headers, - [CONTENT_LENGTH_HEADER]: String(length) - }; - } catch (error) { - } - } - } - return next({ - ...args, - request: request2 - }); - }; + __name(_HttpRequest, "HttpRequest"); + var HttpRequest7 = _HttpRequest; + function cloneQuery(query) { + return Object.keys(query).reduce((carry, paramName) => { + const param = query[paramName]; + return { + ...carry, + [paramName]: Array.isArray(param) ? [...param] : param + }; + }, {}); } - __name(contentLengthMiddleware, "contentLengthMiddleware"); - var contentLengthMiddlewareOptions = { - step: "build", - tags: ["SET_CONTENT_LENGTH", "CONTENT_LENGTH"], - name: "contentLengthMiddleware", - override: true - }; - var getContentLengthPlugin = /* @__PURE__ */ __name((options) => ({ - applyToStack: (clientStack) => { - clientStack.add(contentLengthMiddleware(options.bodyLengthChecker), contentLengthMiddlewareOptions); + __name(cloneQuery, "cloneQuery"); + var _HttpResponse = class _HttpResponse { + constructor(options) { + this.statusCode = options.statusCode; + this.reason = options.reason; + this.headers = options.headers || {}; + this.body = options.body; } - }), "getContentLengthPlugin"); + static isInstance(response) { + if (!response) + return false; + const resp = response; + return typeof resp.statusCode === "number" && typeof resp.headers === "object"; + } + }; + __name(_HttpResponse, "HttpResponse"); + var HttpResponse2 = _HttpResponse; + function isValidHostname(hostname) { + const hostPattern = /^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/; + return hostPattern.test(hostname); + } + __name(isValidHostname, "isValidHostname"); } }); -// ../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/getHomeDir.js -var require_getHomeDir = __commonJS({ - "../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/getHomeDir.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getHomeDir = void 0; - var os_1 = require("os"); - var path_1 = require("path"); - var homeDirCache = {}; - var getHomeDirCacheKey = () => { - if (process && process.geteuid) { - return `${process.geteuid()}`; - } - return "DEFAULT"; - }; - var getHomeDir2 = () => { - const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${path_1.sep}` } = process.env; - if (HOME) - return HOME; - if (USERPROFILE) - return USERPROFILE; - if (HOMEPATH) - return `${HOMEDRIVE}${HOMEPATH}`; - const homeDirCacheKey = getHomeDirCacheKey(); - if (!homeDirCache[homeDirCacheKey]) - homeDirCache[homeDirCacheKey] = (0, os_1.homedir)(); - return homeDirCache[homeDirCacheKey]; - }; - exports2.getHomeDir = getHomeDir2; +// ../../../node_modules/uuid/dist/esm-node/rng.js +function rng() { + if (poolPtr > rnds8Pool.length - 16) { + import_crypto.default.randomFillSync(rnds8Pool); + poolPtr = 0; + } + return rnds8Pool.slice(poolPtr, poolPtr += 16); +} +var import_crypto, rnds8Pool, poolPtr; +var init_rng = __esm({ + "../../../node_modules/uuid/dist/esm-node/rng.js"() { + import_crypto = __toESM(require("crypto")); + rnds8Pool = new Uint8Array(256); + poolPtr = rnds8Pool.length; } }); -// ../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFilepath.js -var require_getSSOTokenFilepath = __commonJS({ - "../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFilepath.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getSSOTokenFilepath = void 0; - var crypto_1 = require("crypto"); - var path_1 = require("path"); - var getHomeDir_1 = require_getHomeDir(); - var getSSOTokenFilepath2 = (id) => { - const hasher = (0, crypto_1.createHash)("sha1"); - const cacheName = hasher.update(id).digest("hex"); - return (0, path_1.join)((0, getHomeDir_1.getHomeDir)(), ".aws", "sso", "cache", `${cacheName}.json`); - }; - exports2.getSSOTokenFilepath = getSSOTokenFilepath2; +// ../../../node_modules/uuid/dist/esm-node/regex.js +var regex_default; +var init_regex = __esm({ + "../../../node_modules/uuid/dist/esm-node/regex.js"() { + regex_default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; } }); -// ../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFromFile.js -var require_getSSOTokenFromFile = __commonJS({ - "../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFromFile.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getSSOTokenFromFile = void 0; - var fs_1 = require("fs"); - var getSSOTokenFilepath_1 = require_getSSOTokenFilepath(); - var { readFile } = fs_1.promises; - var getSSOTokenFromFile2 = async (id) => { - const ssoTokenFilepath = (0, getSSOTokenFilepath_1.getSSOTokenFilepath)(id); - const ssoTokenText = await readFile(ssoTokenFilepath, "utf8"); - return JSON.parse(ssoTokenText); - }; - exports2.getSSOTokenFromFile = getSSOTokenFromFile2; +// ../../../node_modules/uuid/dist/esm-node/validate.js +function validate(uuid) { + return typeof uuid === "string" && regex_default.test(uuid); +} +var validate_default; +var init_validate = __esm({ + "../../../node_modules/uuid/dist/esm-node/validate.js"() { + init_regex(); + validate_default = validate; } }); -// ../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/slurpFile.js -var require_slurpFile = __commonJS({ - "../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/slurpFile.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.slurpFile = void 0; - var fs_1 = require("fs"); - var { readFile } = fs_1.promises; - var filePromisesHash = {}; - var slurpFile = (path, options) => { - if (!filePromisesHash[path] || (options === null || options === void 0 ? void 0 : options.ignoreCache)) { - filePromisesHash[path] = readFile(path, "utf8"); - } - return filePromisesHash[path]; - }; - exports2.slurpFile = slurpFile; +// ../../../node_modules/uuid/dist/esm-node/stringify.js +function unsafeStringify(arr, offset = 0) { + return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]; +} +function stringify(arr, offset = 0) { + const uuid = unsafeStringify(arr, offset); + if (!validate_default(uuid)) { + throw TypeError("Stringified UUID is invalid"); + } + return uuid; +} +var byteToHex, stringify_default; +var init_stringify = __esm({ + "../../../node_modules/uuid/dist/esm-node/stringify.js"() { + init_validate(); + byteToHex = []; + for (let i = 0; i < 256; ++i) { + byteToHex.push((i + 256).toString(16).slice(1)); + } + stringify_default = stringify; } }); -// ../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/index.js -var require_dist_cjs21 = __commonJS({ - "../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); - } - return to; - }; - var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")); - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - CONFIG_PREFIX_SEPARATOR: () => CONFIG_PREFIX_SEPARATOR, - DEFAULT_PROFILE: () => DEFAULT_PROFILE, - ENV_PROFILE: () => ENV_PROFILE, - getProfileName: () => getProfileName, - loadSharedConfigFiles: () => loadSharedConfigFiles, - loadSsoSessionData: () => loadSsoSessionData, - parseKnownFiles: () => parseKnownFiles - }); - module2.exports = __toCommonJS2(src_exports); - __reExport(src_exports, require_getHomeDir(), module2.exports); - var ENV_PROFILE = "AWS_PROFILE"; - var DEFAULT_PROFILE = "default"; - var getProfileName = /* @__PURE__ */ __name((init) => init.profile || process.env[ENV_PROFILE] || DEFAULT_PROFILE, "getProfileName"); - __reExport(src_exports, require_getSSOTokenFilepath(), module2.exports); - __reExport(src_exports, require_getSSOTokenFromFile(), module2.exports); - var import_types = require_dist_cjs(); - var getConfigData = /* @__PURE__ */ __name((data) => Object.entries(data).filter(([key]) => { - const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR); - if (indexOfSeparator === -1) { - return false; - } - return Object.values(import_types.IniSectionType).includes(key.substring(0, indexOfSeparator)); - }).reduce( - (acc, [key, value]) => { - const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR); - const updatedKey = key.substring(0, indexOfSeparator) === import_types.IniSectionType.PROFILE ? key.substring(indexOfSeparator + 1) : key; - acc[updatedKey] = value; - return acc; - }, - { - // Populate default profile, if present. - ...data.default && { default: data.default } - } - ), "getConfigData"); - var import_path = require("path"); - var import_getHomeDir = require_getHomeDir(); - var ENV_CONFIG_PATH = "AWS_CONFIG_FILE"; - var getConfigFilepath = /* @__PURE__ */ __name(() => process.env[ENV_CONFIG_PATH] || (0, import_path.join)((0, import_getHomeDir.getHomeDir)(), ".aws", "config"), "getConfigFilepath"); - var import_getHomeDir2 = require_getHomeDir(); - var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE"; - var getCredentialsFilepath = /* @__PURE__ */ __name(() => process.env[ENV_CREDENTIALS_PATH] || (0, import_path.join)((0, import_getHomeDir2.getHomeDir)(), ".aws", "credentials"), "getCredentialsFilepath"); - var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/; - var profileNameBlockList = ["__proto__", "profile __proto__"]; - var parseIni = /* @__PURE__ */ __name((iniData) => { - const map = {}; - let currentSection; - let currentSubSection; - for (const iniLine of iniData.split(/\r?\n/)) { - const trimmedLine = iniLine.split(/(^|\s)[;#]/)[0].trim(); - const isSection = trimmedLine[0] === "[" && trimmedLine[trimmedLine.length - 1] === "]"; - if (isSection) { - currentSection = void 0; - currentSubSection = void 0; - const sectionName = trimmedLine.substring(1, trimmedLine.length - 1); - const matches = prefixKeyRegex.exec(sectionName); - if (matches) { - const [, prefix, , name] = matches; - if (Object.values(import_types.IniSectionType).includes(prefix)) { - currentSection = [prefix, name].join(CONFIG_PREFIX_SEPARATOR); - } - } else { - currentSection = sectionName; - } - if (profileNameBlockList.includes(sectionName)) { - throw new Error(`Found invalid profile name "${sectionName}"`); - } - } else if (currentSection) { - const indexOfEqualsSign = trimmedLine.indexOf("="); - if (![0, -1].includes(indexOfEqualsSign)) { - const [name, value] = [ - trimmedLine.substring(0, indexOfEqualsSign).trim(), - trimmedLine.substring(indexOfEqualsSign + 1).trim() - ]; - if (value === "") { - currentSubSection = name; - } else { - if (currentSubSection && iniLine.trimStart() === iniLine) { - currentSubSection = void 0; - } - map[currentSection] = map[currentSection] || {}; - const key = currentSubSection ? [currentSubSection, name].join(CONFIG_PREFIX_SEPARATOR) : name; - map[currentSection][key] = value; - } - } - } - } - return map; - }, "parseIni"); - var import_slurpFile = require_slurpFile(); - var swallowError = /* @__PURE__ */ __name(() => ({}), "swallowError"); - var CONFIG_PREFIX_SEPARATOR = "."; - var loadSharedConfigFiles = /* @__PURE__ */ __name(async (init = {}) => { - const { filepath = getCredentialsFilepath(), configFilepath = getConfigFilepath() } = init; - const parsedFiles = await Promise.all([ - (0, import_slurpFile.slurpFile)(configFilepath, { - ignoreCache: init.ignoreCache - }).then(parseIni).then(getConfigData).catch(swallowError), - (0, import_slurpFile.slurpFile)(filepath, { - ignoreCache: init.ignoreCache - }).then(parseIni).catch(swallowError) - ]); - return { - configFile: parsedFiles[0], - credentialsFile: parsedFiles[1] - }; - }, "loadSharedConfigFiles"); - var getSsoSessionData = /* @__PURE__ */ __name((data) => Object.entries(data).filter(([key]) => key.startsWith(import_types.IniSectionType.SSO_SESSION + CONFIG_PREFIX_SEPARATOR)).reduce((acc, [key, value]) => ({ ...acc, [key.substring(key.indexOf(CONFIG_PREFIX_SEPARATOR) + 1)]: value }), {}), "getSsoSessionData"); - var import_slurpFile2 = require_slurpFile(); - var swallowError2 = /* @__PURE__ */ __name(() => ({}), "swallowError"); - var loadSsoSessionData = /* @__PURE__ */ __name(async (init = {}) => (0, import_slurpFile2.slurpFile)(init.configFilepath ?? getConfigFilepath()).then(parseIni).then(getSsoSessionData).catch(swallowError2), "loadSsoSessionData"); - var mergeConfigFiles = /* @__PURE__ */ __name((...files) => { - const merged = {}; - for (const file of files) { - for (const [key, values] of Object.entries(file)) { - if (merged[key] !== void 0) { - Object.assign(merged[key], values); - } else { - merged[key] = values; - } - } - } - return merged; - }, "mergeConfigFiles"); - var parseKnownFiles = /* @__PURE__ */ __name(async (init) => { - const parsedFiles = await loadSharedConfigFiles(init); - return mergeConfigFiles(parsedFiles.configFile, parsedFiles.credentialsFile); - }, "parseKnownFiles"); +// ../../../node_modules/uuid/dist/esm-node/v1.js +function v1(options, buf, offset) { + let i = buf && offset || 0; + const b = buf || new Array(16); + options = options || {}; + let node = options.node || _nodeId; + let clockseq = options.clockseq !== void 0 ? options.clockseq : _clockseq; + if (node == null || clockseq == null) { + const seedBytes = options.random || (options.rng || rng)(); + if (node == null) { + node = _nodeId = [seedBytes[0] | 1, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; + } + if (clockseq == null) { + clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 16383; + } } -}); - -// ../../../node_modules/@smithy/node-config-provider/dist-cjs/index.js -var require_dist_cjs22 = __commonJS({ - "../../../node_modules/@smithy/node-config-provider/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - loadConfig: () => loadConfig - }); - module2.exports = __toCommonJS2(src_exports); - var import_property_provider = require_dist_cjs6(); - var fromEnv = /* @__PURE__ */ __name((envVarSelector) => async () => { - try { - const config = envVarSelector(process.env); - if (config === void 0) { - throw new Error(); - } - return config; - } catch (e) { - throw new import_property_provider.CredentialsProviderError( - e.message || `Cannot load config from environment variables with getter: ${envVarSelector}` - ); - } - }, "fromEnv"); - var import_shared_ini_file_loader = require_dist_cjs21(); - var fromSharedConfigFiles = /* @__PURE__ */ __name((configSelector, { preferredFile = "config", ...init } = {}) => async () => { - const profile = (0, import_shared_ini_file_loader.getProfileName)(init); - const { configFile, credentialsFile } = await (0, import_shared_ini_file_loader.loadSharedConfigFiles)(init); - const profileFromCredentials = credentialsFile[profile] || {}; - const profileFromConfig = configFile[profile] || {}; - const mergedProfile = preferredFile === "config" ? { ...profileFromCredentials, ...profileFromConfig } : { ...profileFromConfig, ...profileFromCredentials }; - try { - const cfgFile = preferredFile === "config" ? configFile : credentialsFile; - const configValue = configSelector(mergedProfile, cfgFile); - if (configValue === void 0) { - throw new Error(); - } - return configValue; - } catch (e) { - throw new import_property_provider.CredentialsProviderError( - e.message || `Cannot load config for profile ${profile} in SDK configuration files with getter: ${configSelector}` - ); - } - }, "fromSharedConfigFiles"); - var isFunction = /* @__PURE__ */ __name((func) => typeof func === "function", "isFunction"); - var fromStatic = /* @__PURE__ */ __name((defaultValue) => isFunction(defaultValue) ? async () => await defaultValue() : (0, import_property_provider.fromStatic)(defaultValue), "fromStatic"); - var loadConfig = /* @__PURE__ */ __name(({ environmentVariableSelector, configFileSelector, default: defaultValue }, configuration = {}) => (0, import_property_provider.memoize)( - (0, import_property_provider.chain)( - fromEnv(environmentVariableSelector), - fromSharedConfigFiles(configFileSelector, configuration), - fromStatic(defaultValue) - ) - ), "loadConfig"); + let msecs = options.msecs !== void 0 ? options.msecs : Date.now(); + let nsecs = options.nsecs !== void 0 ? options.nsecs : _lastNSecs + 1; + const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 1e4; + if (dt < 0 && options.clockseq === void 0) { + clockseq = clockseq + 1 & 16383; } -}); - -// ../../../node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointUrlConfig.js -var require_getEndpointUrlConfig = __commonJS({ - "../../../node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointUrlConfig.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getEndpointUrlConfig = void 0; - var shared_ini_file_loader_1 = require_dist_cjs21(); - var ENV_ENDPOINT_URL = "AWS_ENDPOINT_URL"; - var CONFIG_ENDPOINT_URL = "endpoint_url"; - var getEndpointUrlConfig = (serviceId) => ({ - environmentVariableSelector: (env) => { - const serviceSuffixParts = serviceId.split(" ").map((w) => w.toUpperCase()); - const serviceEndpointUrl = env[[ENV_ENDPOINT_URL, ...serviceSuffixParts].join("_")]; - if (serviceEndpointUrl) - return serviceEndpointUrl; - const endpointUrl = env[ENV_ENDPOINT_URL]; - if (endpointUrl) - return endpointUrl; - return void 0; - }, - configFileSelector: (profile, config) => { - if (config && profile.services) { - const servicesSection = config[["services", profile.services].join(shared_ini_file_loader_1.CONFIG_PREFIX_SEPARATOR)]; - if (servicesSection) { - const servicePrefixParts = serviceId.split(" ").map((w) => w.toLowerCase()); - const endpointUrl2 = servicesSection[[servicePrefixParts.join("_"), CONFIG_ENDPOINT_URL].join(shared_ini_file_loader_1.CONFIG_PREFIX_SEPARATOR)]; - if (endpointUrl2) - return endpointUrl2; - } - } - const endpointUrl = profile[CONFIG_ENDPOINT_URL]; - if (endpointUrl) - return endpointUrl; - return void 0; - }, - default: void 0 - }); - exports2.getEndpointUrlConfig = getEndpointUrlConfig; + if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === void 0) { + nsecs = 0; + } + if (nsecs >= 1e4) { + throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); + } + _lastMSecs = msecs; + _lastNSecs = nsecs; + _clockseq = clockseq; + msecs += 122192928e5; + const tl = ((msecs & 268435455) * 1e4 + nsecs) % 4294967296; + b[i++] = tl >>> 24 & 255; + b[i++] = tl >>> 16 & 255; + b[i++] = tl >>> 8 & 255; + b[i++] = tl & 255; + const tmh = msecs / 4294967296 * 1e4 & 268435455; + b[i++] = tmh >>> 8 & 255; + b[i++] = tmh & 255; + b[i++] = tmh >>> 24 & 15 | 16; + b[i++] = tmh >>> 16 & 255; + b[i++] = clockseq >>> 8 | 128; + b[i++] = clockseq & 255; + for (let n = 0; n < 6; ++n) { + b[i + n] = node[n]; + } + return buf || unsafeStringify(b); +} +var _nodeId, _clockseq, _lastMSecs, _lastNSecs, v1_default; +var init_v1 = __esm({ + "../../../node_modules/uuid/dist/esm-node/v1.js"() { + init_rng(); + init_stringify(); + _lastMSecs = 0; + _lastNSecs = 0; + v1_default = v1; } }); -// ../../../node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointFromConfig.js -var require_getEndpointFromConfig = __commonJS({ - "../../../node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointFromConfig.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getEndpointFromConfig = void 0; - var node_config_provider_1 = require_dist_cjs22(); - var getEndpointUrlConfig_1 = require_getEndpointUrlConfig(); - var getEndpointFromConfig = async (serviceId) => (0, node_config_provider_1.loadConfig)((0, getEndpointUrlConfig_1.getEndpointUrlConfig)(serviceId))(); - exports2.getEndpointFromConfig = getEndpointFromConfig; +// ../../../node_modules/uuid/dist/esm-node/parse.js +function parse(uuid) { + if (!validate_default(uuid)) { + throw TypeError("Invalid UUID"); + } + let v; + const arr = new Uint8Array(16); + arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; + arr[1] = v >>> 16 & 255; + arr[2] = v >>> 8 & 255; + arr[3] = v & 255; + arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; + arr[5] = v & 255; + arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; + arr[7] = v & 255; + arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; + arr[9] = v & 255; + arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 1099511627776 & 255; + arr[11] = v / 4294967296 & 255; + arr[12] = v >>> 24 & 255; + arr[13] = v >>> 16 & 255; + arr[14] = v >>> 8 & 255; + arr[15] = v & 255; + return arr; +} +var parse_default; +var init_parse = __esm({ + "../../../node_modules/uuid/dist/esm-node/parse.js"() { + init_validate(); + parse_default = parse; } }); -// ../../../node_modules/@smithy/querystring-parser/dist-cjs/index.js -var require_dist_cjs23 = __commonJS({ - "../../../node_modules/@smithy/querystring-parser/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); +// ../../../node_modules/uuid/dist/esm-node/v35.js +function stringToBytes(str) { + str = unescape(encodeURIComponent(str)); + const bytes = []; + for (let i = 0; i < str.length; ++i) { + bytes.push(str.charCodeAt(i)); + } + return bytes; +} +function v35(name, version2, hashfunc) { + function generateUUID(value, namespace, buf, offset) { + var _namespace; + if (typeof value === "string") { + value = stringToBytes(value); + } + if (typeof namespace === "string") { + namespace = parse_default(namespace); + } + if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) { + throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)"); + } + let bytes = new Uint8Array(16 + value.length); + bytes.set(namespace); + bytes.set(value, namespace.length); + bytes = hashfunc(bytes); + bytes[6] = bytes[6] & 15 | version2; + bytes[8] = bytes[8] & 63 | 128; + if (buf) { + offset = offset || 0; + for (let i = 0; i < 16; ++i) { + buf[offset + i] = bytes[i]; } - return to; + return buf; + } + return unsafeStringify(bytes); + } + try { + generateUUID.name = name; + } catch (err) { + } + generateUUID.DNS = DNS; + generateUUID.URL = URL2; + return generateUUID; +} +var DNS, URL2; +var init_v35 = __esm({ + "../../../node_modules/uuid/dist/esm-node/v35.js"() { + init_stringify(); + init_parse(); + DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8"; + URL2 = "6ba7b811-9dad-11d1-80b4-00c04fd430c8"; + } +}); + +// ../../../node_modules/uuid/dist/esm-node/md5.js +function md5(bytes) { + if (Array.isArray(bytes)) { + bytes = Buffer.from(bytes); + } else if (typeof bytes === "string") { + bytes = Buffer.from(bytes, "utf8"); + } + return import_crypto2.default.createHash("md5").update(bytes).digest(); +} +var import_crypto2, md5_default; +var init_md5 = __esm({ + "../../../node_modules/uuid/dist/esm-node/md5.js"() { + import_crypto2 = __toESM(require("crypto")); + md5_default = md5; + } +}); + +// ../../../node_modules/uuid/dist/esm-node/v3.js +var v3, v3_default; +var init_v3 = __esm({ + "../../../node_modules/uuid/dist/esm-node/v3.js"() { + init_v35(); + init_md5(); + v3 = v35("v3", 48, md5_default); + v3_default = v3; + } +}); + +// ../../../node_modules/uuid/dist/esm-node/native.js +var import_crypto3, native_default; +var init_native = __esm({ + "../../../node_modules/uuid/dist/esm-node/native.js"() { + import_crypto3 = __toESM(require("crypto")); + native_default = { + randomUUID: import_crypto3.default.randomUUID }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - parseQueryString: () => parseQueryString - }); - module2.exports = __toCommonJS2(src_exports); - function parseQueryString(querystring) { - const query = {}; - querystring = querystring.replace(/^\?/, ""); - if (querystring) { - for (const pair of querystring.split("&")) { - let [key, value = null] = pair.split("="); - key = decodeURIComponent(key); - if (value) { - value = decodeURIComponent(value); - } - if (!(key in query)) { - query[key] = value; - } else if (Array.isArray(query[key])) { - query[key].push(value); - } else { - query[key] = [query[key], value]; - } - } - } - return query; + } +}); + +// ../../../node_modules/uuid/dist/esm-node/v4.js +function v4(options, buf, offset) { + if (native_default.randomUUID && !buf && !options) { + return native_default.randomUUID(); + } + options = options || {}; + const rnds = options.random || (options.rng || rng)(); + rnds[6] = rnds[6] & 15 | 64; + rnds[8] = rnds[8] & 63 | 128; + if (buf) { + offset = offset || 0; + for (let i = 0; i < 16; ++i) { + buf[offset + i] = rnds[i]; } - __name(parseQueryString, "parseQueryString"); + return buf; + } + return unsafeStringify(rnds); +} +var v4_default; +var init_v4 = __esm({ + "../../../node_modules/uuid/dist/esm-node/v4.js"() { + init_native(); + init_rng(); + init_stringify(); + v4_default = v4; } }); -// ../../../node_modules/@smithy/url-parser/dist-cjs/index.js -var require_dist_cjs24 = __commonJS({ - "../../../node_modules/@smithy/url-parser/dist-cjs/index.js"(exports2, module2) { +// ../../../node_modules/uuid/dist/esm-node/sha1.js +function sha1(bytes) { + if (Array.isArray(bytes)) { + bytes = Buffer.from(bytes); + } else if (typeof bytes === "string") { + bytes = Buffer.from(bytes, "utf8"); + } + return import_crypto4.default.createHash("sha1").update(bytes).digest(); +} +var import_crypto4, sha1_default; +var init_sha1 = __esm({ + "../../../node_modules/uuid/dist/esm-node/sha1.js"() { + import_crypto4 = __toESM(require("crypto")); + sha1_default = sha1; + } +}); + +// ../../../node_modules/uuid/dist/esm-node/v5.js +var v5, v5_default; +var init_v5 = __esm({ + "../../../node_modules/uuid/dist/esm-node/v5.js"() { + init_v35(); + init_sha1(); + v5 = v35("v5", 80, sha1_default); + v5_default = v5; + } +}); + +// ../../../node_modules/uuid/dist/esm-node/nil.js +var nil_default; +var init_nil = __esm({ + "../../../node_modules/uuid/dist/esm-node/nil.js"() { + nil_default = "00000000-0000-0000-0000-000000000000"; + } +}); + +// ../../../node_modules/uuid/dist/esm-node/version.js +function version(uuid) { + if (!validate_default(uuid)) { + throw TypeError("Invalid UUID"); + } + return parseInt(uuid.slice(14, 15), 16); +} +var version_default; +var init_version = __esm({ + "../../../node_modules/uuid/dist/esm-node/version.js"() { + init_validate(); + version_default = version; + } +}); + +// ../../../node_modules/uuid/dist/esm-node/index.js +var esm_node_exports = {}; +__export(esm_node_exports, { + NIL: () => nil_default, + parse: () => parse_default, + stringify: () => stringify_default, + v1: () => v1_default, + v3: () => v3_default, + v4: () => v4_default, + v5: () => v5_default, + validate: () => validate_default, + version: () => version_default +}); +var init_esm_node = __esm({ + "../../../node_modules/uuid/dist/esm-node/index.js"() { + init_v1(); + init_v3(); + init_v4(); + init_v5(); + init_nil(); + init_version(); + init_validate(); + init_stringify(); + init_parse(); + } +}); + +// ../../../node_modules/@smithy/service-error-classification/dist-cjs/index.js +var require_dist_cjs22 = __commonJS({ + "../../../node_modules/@smithy/service-error-classification/dist-cjs/index.js"(exports2, module2) { var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames2 = Object.getOwnPropertyNames; @@ -5348,123 +4613,73 @@ var require_dist_cjs24 = __commonJS({ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var src_exports = {}; __export2(src_exports, { - parseUrl: () => parseUrl + isClockSkewCorrectedError: () => isClockSkewCorrectedError, + isClockSkewError: () => isClockSkewError, + isRetryableByTrait: () => isRetryableByTrait, + isServerError: () => isServerError, + isThrottlingError: () => isThrottlingError, + isTransientError: () => isTransientError }); module2.exports = __toCommonJS2(src_exports); - var import_querystring_parser = require_dist_cjs23(); - var parseUrl = /* @__PURE__ */ __name((url2) => { - if (typeof url2 === "string") { - return parseUrl(new URL(url2)); - } - const { hostname, pathname, port, protocol, search } = url2; - let query; - if (search) { - query = (0, import_querystring_parser.parseQueryString)(search); - } - return { - hostname, - port: port ? parseInt(port) : void 0, - protocol, - path: pathname, - query - }; - }, "parseUrl"); - } -}); - -// ../../../node_modules/@smithy/middleware-serde/dist-cjs/index.js -var require_dist_cjs25 = __commonJS({ - "../../../node_modules/@smithy/middleware-serde/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - deserializerMiddleware: () => deserializerMiddleware, - deserializerMiddlewareOption: () => deserializerMiddlewareOption, - getSerdePlugin: () => getSerdePlugin, - serializerMiddleware: () => serializerMiddleware, - serializerMiddlewareOption: () => serializerMiddlewareOption - }); - module2.exports = __toCommonJS2(src_exports); - var deserializerMiddleware = /* @__PURE__ */ __name((options, deserializer) => (next, context) => async (args) => { - const { response } = await next(args); - try { - const parsed = await deserializer(response, options); - return { - response, - output: parsed - }; - } catch (error) { - Object.defineProperty(error, "$response", { - value: response - }); - if (!("$metadata" in error)) { - const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`; - error.message += "\n " + hint; - if (typeof error.$responseBodyText !== "undefined") { - if (error.$response) { - error.$response.body = error.$responseBodyText; - } - } - } - throw error; - } - }, "deserializerMiddleware"); - var serializerMiddleware = /* @__PURE__ */ __name((options, serializer) => (next, context) => async (args) => { + var CLOCK_SKEW_ERROR_CODES = [ + "AuthFailure", + "InvalidSignatureException", + "RequestExpired", + "RequestInTheFuture", + "RequestTimeTooSkewed", + "SignatureDoesNotMatch" + ]; + var THROTTLING_ERROR_CODES = [ + "BandwidthLimitExceeded", + "EC2ThrottledException", + "LimitExceededException", + "PriorRequestNotComplete", + "ProvisionedThroughputExceededException", + "RequestLimitExceeded", + "RequestThrottled", + "RequestThrottledException", + "SlowDown", + "ThrottledException", + "Throttling", + "ThrottlingException", + "TooManyRequestsException", + "TransactionInProgressException" + // DynamoDB + ]; + var TRANSIENT_ERROR_CODES = ["TimeoutError", "RequestTimeout", "RequestTimeoutException"]; + var TRANSIENT_ERROR_STATUS_CODES = [500, 502, 503, 504]; + var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "ECONNREFUSED", "EPIPE", "ETIMEDOUT"]; + var isRetryableByTrait = /* @__PURE__ */ __name((error) => error.$retryable !== void 0, "isRetryableByTrait"); + var isClockSkewError = /* @__PURE__ */ __name((error) => CLOCK_SKEW_ERROR_CODES.includes(error.name), "isClockSkewError"); + var isClockSkewCorrectedError = /* @__PURE__ */ __name((error) => { var _a; - const endpoint = ((_a = context.endpointV2) == null ? void 0 : _a.url) && options.urlParser ? async () => options.urlParser(context.endpointV2.url) : options.endpoint; - if (!endpoint) { - throw new Error("No valid endpoint provider available."); - } - const request2 = await serializer(args.input, { ...options, endpoint }); - return next({ - ...args, - request: request2 - }); - }, "serializerMiddleware"); - var deserializerMiddlewareOption = { - name: "deserializerMiddleware", - step: "deserialize", - tags: ["DESERIALIZER"], - override: true - }; - var serializerMiddlewareOption = { - name: "serializerMiddleware", - step: "serialize", - tags: ["SERIALIZER"], - override: true - }; - function getSerdePlugin(config, serializer, deserializer) { - return { - applyToStack: (commandStack) => { - commandStack.add(deserializerMiddleware(config, deserializer), deserializerMiddlewareOption); - commandStack.add(serializerMiddleware(config, serializer), serializerMiddlewareOption); + return (_a = error.$metadata) == null ? void 0 : _a.clockSkewCorrected; + }, "isClockSkewCorrectedError"); + var isThrottlingError = /* @__PURE__ */ __name((error) => { + var _a, _b; + return ((_a = error.$metadata) == null ? void 0 : _a.httpStatusCode) === 429 || THROTTLING_ERROR_CODES.includes(error.name) || ((_b = error.$retryable) == null ? void 0 : _b.throttling) == true; + }, "isThrottlingError"); + var isTransientError = /* @__PURE__ */ __name((error) => { + var _a; + return isClockSkewCorrectedError(error) || TRANSIENT_ERROR_CODES.includes(error.name) || NODEJS_TIMEOUT_ERROR_CODES.includes((error == null ? void 0 : error.code) || "") || TRANSIENT_ERROR_STATUS_CODES.includes(((_a = error.$metadata) == null ? void 0 : _a.httpStatusCode) || 0); + }, "isTransientError"); + var isServerError = /* @__PURE__ */ __name((error) => { + var _a; + if (((_a = error.$metadata) == null ? void 0 : _a.httpStatusCode) !== void 0) { + const statusCode = error.$metadata.httpStatusCode; + if (500 <= statusCode && statusCode <= 599 && !isTransientError(error)) { + return true; } - }; - } - __name(getSerdePlugin, "getSerdePlugin"); + return false; + } + return false; + }, "isServerError"); } }); -// ../../../node_modules/@smithy/middleware-endpoint/dist-cjs/index.js -var require_dist_cjs26 = __commonJS({ - "../../../node_modules/@smithy/middleware-endpoint/dist-cjs/index.js"(exports2, module2) { +// ../../../node_modules/@smithy/middleware-retry/node_modules/@smithy/util-retry/dist-cjs/index.js +var require_dist_cjs23 = __commonJS({ + "../../../node_modules/@smithy/middleware-retry/node_modules/@smithy/util-retry/dist-cjs/index.js"(exports2, module2) { var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames2 = Object.getOwnPropertyNames; @@ -5485,567 +4700,338 @@ var require_dist_cjs26 = __commonJS({ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var src_exports = {}; __export2(src_exports, { - endpointMiddleware: () => endpointMiddleware, - endpointMiddlewareOptions: () => endpointMiddlewareOptions, - getEndpointFromInstructions: () => getEndpointFromInstructions, - getEndpointPlugin: () => getEndpointPlugin, - resolveEndpointConfig: () => resolveEndpointConfig, - resolveParams: () => resolveParams, - toEndpointV1: () => toEndpointV1 + AdaptiveRetryStrategy: () => AdaptiveRetryStrategy, + ConfiguredRetryStrategy: () => ConfiguredRetryStrategy, + DEFAULT_MAX_ATTEMPTS: () => DEFAULT_MAX_ATTEMPTS, + DEFAULT_RETRY_DELAY_BASE: () => DEFAULT_RETRY_DELAY_BASE, + DEFAULT_RETRY_MODE: () => DEFAULT_RETRY_MODE, + DefaultRateLimiter: () => DefaultRateLimiter, + INITIAL_RETRY_TOKENS: () => INITIAL_RETRY_TOKENS, + INVOCATION_ID_HEADER: () => INVOCATION_ID_HEADER, + MAXIMUM_RETRY_DELAY: () => MAXIMUM_RETRY_DELAY, + NO_RETRY_INCREMENT: () => NO_RETRY_INCREMENT, + REQUEST_HEADER: () => REQUEST_HEADER, + RETRY_COST: () => RETRY_COST, + RETRY_MODES: () => RETRY_MODES, + StandardRetryStrategy: () => StandardRetryStrategy, + THROTTLING_RETRY_DELAY_BASE: () => THROTTLING_RETRY_DELAY_BASE, + TIMEOUT_RETRY_COST: () => TIMEOUT_RETRY_COST }); module2.exports = __toCommonJS2(src_exports); - var resolveParamsForS3 = /* @__PURE__ */ __name(async (endpointParams) => { - const bucket = (endpointParams == null ? void 0 : endpointParams.Bucket) || ""; - if (typeof endpointParams.Bucket === "string") { - endpointParams.Bucket = bucket.replace(/#/g, encodeURIComponent("#")).replace(/\?/g, encodeURIComponent("?")); - } - if (isArnBucketName(bucket)) { - if (endpointParams.ForcePathStyle === true) { - throw new Error("Path-style addressing cannot be used with ARN buckets"); - } - } else if (!isDnsCompatibleBucketName(bucket) || bucket.indexOf(".") !== -1 && !String(endpointParams.Endpoint).startsWith("http:") || bucket.toLowerCase() !== bucket || bucket.length < 3) { - endpointParams.ForcePathStyle = true; + var RETRY_MODES = /* @__PURE__ */ ((RETRY_MODES2) => { + RETRY_MODES2["STANDARD"] = "standard"; + RETRY_MODES2["ADAPTIVE"] = "adaptive"; + return RETRY_MODES2; + })(RETRY_MODES || {}); + var DEFAULT_MAX_ATTEMPTS = 3; + var DEFAULT_RETRY_MODE = "standard"; + var import_service_error_classification = require_dist_cjs22(); + var _DefaultRateLimiter = class _DefaultRateLimiter { + constructor(options) { + this.currentCapacity = 0; + this.enabled = false; + this.lastMaxRate = 0; + this.measuredTxRate = 0; + this.requestCount = 0; + this.lastTimestamp = 0; + this.timeWindow = 0; + this.beta = (options == null ? void 0 : options.beta) ?? 0.7; + this.minCapacity = (options == null ? void 0 : options.minCapacity) ?? 1; + this.minFillRate = (options == null ? void 0 : options.minFillRate) ?? 0.5; + this.scaleConstant = (options == null ? void 0 : options.scaleConstant) ?? 0.4; + this.smooth = (options == null ? void 0 : options.smooth) ?? 0.8; + const currentTimeInSeconds = this.getCurrentTimeInSeconds(); + this.lastThrottleTime = currentTimeInSeconds; + this.lastTxRateBucket = Math.floor(this.getCurrentTimeInSeconds()); + this.fillRate = this.minFillRate; + this.maxCapacity = this.minCapacity; } - if (endpointParams.DisableMultiRegionAccessPoints) { - endpointParams.disableMultiRegionAccessPoints = true; - endpointParams.DisableMRAP = true; + getCurrentTimeInSeconds() { + return Date.now() / 1e3; } - return endpointParams; - }, "resolveParamsForS3"); - var DOMAIN_PATTERN = /^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/; - var IP_ADDRESS_PATTERN = /(\d+\.){3}\d+/; - var DOTS_PATTERN = /\.\./; - var isDnsCompatibleBucketName = /* @__PURE__ */ __name((bucketName) => DOMAIN_PATTERN.test(bucketName) && !IP_ADDRESS_PATTERN.test(bucketName) && !DOTS_PATTERN.test(bucketName), "isDnsCompatibleBucketName"); - var isArnBucketName = /* @__PURE__ */ __name((bucketName) => { - const [arn, partition, service, , , bucket] = bucketName.split(":"); - const isArn = arn === "arn" && bucketName.split(":").length >= 6; - const isValidArn = Boolean(isArn && partition && service && bucket); - if (isArn && !isValidArn) { - throw new Error(`Invalid ARN: ${bucketName} was an invalid ARN.`); + async getSendToken() { + return this.acquireTokenBucket(1); } - return isValidArn; - }, "isArnBucketName"); - var createConfigValueProvider = /* @__PURE__ */ __name((configKey, canonicalEndpointParamKey, config) => { - const configProvider = /* @__PURE__ */ __name(async () => { - const configValue = config[configKey] ?? config[canonicalEndpointParamKey]; - if (typeof configValue === "function") { - return configValue(); + async acquireTokenBucket(amount) { + if (!this.enabled) { + return; } - return configValue; - }, "configProvider"); - if (configKey === "credentialScope" || canonicalEndpointParamKey === "CredentialScope") { - return async () => { - const credentials = typeof config.credentials === "function" ? await config.credentials() : config.credentials; - const configValue = (credentials == null ? void 0 : credentials.credentialScope) ?? (credentials == null ? void 0 : credentials.CredentialScope); - return configValue; - }; - } - if (configKey === "endpoint" || canonicalEndpointParamKey === "endpoint") { - return async () => { - const endpoint = await configProvider(); - if (endpoint && typeof endpoint === "object") { - if ("url" in endpoint) { - return endpoint.url.href; - } - if ("hostname" in endpoint) { - const { protocol, hostname, port, path } = endpoint; - return `${protocol}//${hostname}${port ? ":" + port : ""}${path}`; - } - } - return endpoint; - }; - } - return configProvider; - }, "createConfigValueProvider"); - var import_getEndpointFromConfig = require_getEndpointFromConfig(); - var import_url_parser = require_dist_cjs24(); - var toEndpointV1 = /* @__PURE__ */ __name((endpoint) => { - if (typeof endpoint === "object") { - if ("url" in endpoint) { - return (0, import_url_parser.parseUrl)(endpoint.url); + this.refillTokenBucket(); + if (amount > this.currentCapacity) { + const delay = (amount - this.currentCapacity) / this.fillRate * 1e3; + await new Promise((resolve) => setTimeout(resolve, delay)); } - return endpoint; + this.currentCapacity = this.currentCapacity - amount; } - return (0, import_url_parser.parseUrl)(endpoint); - }, "toEndpointV1"); - var getEndpointFromInstructions = /* @__PURE__ */ __name(async (commandInput, instructionsSupplier, clientConfig, context) => { - if (!clientConfig.endpoint) { - const endpointFromConfig = await (0, import_getEndpointFromConfig.getEndpointFromConfig)(clientConfig.serviceId || ""); - if (endpointFromConfig) { - clientConfig.endpoint = () => Promise.resolve(toEndpointV1(endpointFromConfig)); + refillTokenBucket() { + const timestamp = this.getCurrentTimeInSeconds(); + if (!this.lastTimestamp) { + this.lastTimestamp = timestamp; + return; } + const fillAmount = (timestamp - this.lastTimestamp) * this.fillRate; + this.currentCapacity = Math.min(this.maxCapacity, this.currentCapacity + fillAmount); + this.lastTimestamp = timestamp; } - const endpointParams = await resolveParams(commandInput, instructionsSupplier, clientConfig); - if (typeof clientConfig.endpointProvider !== "function") { - throw new Error("config.endpointProvider is not set."); - } - const endpoint = clientConfig.endpointProvider(endpointParams, context); - return endpoint; - }, "getEndpointFromInstructions"); - var resolveParams = /* @__PURE__ */ __name(async (commandInput, instructionsSupplier, clientConfig) => { - var _a; - const endpointParams = {}; - const instructions = ((_a = instructionsSupplier == null ? void 0 : instructionsSupplier.getEndpointParameterInstructions) == null ? void 0 : _a.call(instructionsSupplier)) || {}; - for (const [name, instruction] of Object.entries(instructions)) { - switch (instruction.type) { - case "staticContextParams": - endpointParams[name] = instruction.value; - break; - case "contextParams": - endpointParams[name] = commandInput[instruction.name]; - break; - case "clientContextParams": - case "builtInParams": - endpointParams[name] = await createConfigValueProvider(instruction.name, name, clientConfig)(); - break; - default: - throw new Error("Unrecognized endpoint parameter instruction: " + JSON.stringify(instruction)); + updateClientSendingRate(response) { + let calculatedRate; + this.updateMeasuredRate(); + if ((0, import_service_error_classification.isThrottlingError)(response)) { + const rateToUse = !this.enabled ? this.measuredTxRate : Math.min(this.measuredTxRate, this.fillRate); + this.lastMaxRate = rateToUse; + this.calculateTimeWindow(); + this.lastThrottleTime = this.getCurrentTimeInSeconds(); + calculatedRate = this.cubicThrottle(rateToUse); + this.enableTokenBucket(); + } else { + this.calculateTimeWindow(); + calculatedRate = this.cubicSuccess(this.getCurrentTimeInSeconds()); } + const newRate = Math.min(calculatedRate, 2 * this.measuredTxRate); + this.updateTokenBucketRate(newRate); } - if (Object.keys(instructions).length === 0) { - Object.assign(endpointParams, clientConfig); + calculateTimeWindow() { + this.timeWindow = this.getPrecise(Math.pow(this.lastMaxRate * (1 - this.beta) / this.scaleConstant, 1 / 3)); } - if (String(clientConfig.serviceId).toLowerCase() === "s3") { - await resolveParamsForS3(endpointParams); + cubicThrottle(rateToUse) { + return this.getPrecise(rateToUse * this.beta); } - return endpointParams; - }, "resolveParams"); - var import_util_middleware = require_dist_cjs7(); - var endpointMiddleware = /* @__PURE__ */ __name(({ - config, - instructions - }) => { - return (next, context) => async (args) => { - var _a, _b, _c; - const endpoint = await getEndpointFromInstructions( - args.input, - { - getEndpointParameterInstructions() { - return instructions; - } - }, - { ...config }, - context + cubicSuccess(timestamp) { + return this.getPrecise( + this.scaleConstant * Math.pow(timestamp - this.lastThrottleTime - this.timeWindow, 3) + this.lastMaxRate ); - context.endpointV2 = endpoint; - context.authSchemes = (_a = endpoint.properties) == null ? void 0 : _a.authSchemes; - const authScheme = (_b = context.authSchemes) == null ? void 0 : _b[0]; - if (authScheme) { - context["signing_region"] = authScheme.signingRegion; - context["signing_service"] = authScheme.signingName; - const smithyContext = (0, import_util_middleware.getSmithyContext)(context); - const httpAuthOption = (_c = smithyContext == null ? void 0 : smithyContext.selectedHttpAuthScheme) == null ? void 0 : _c.httpAuthOption; - if (httpAuthOption) { - httpAuthOption.signingProperties = Object.assign( - httpAuthOption.signingProperties || {}, - { - signing_region: authScheme.signingRegion, - signingRegion: authScheme.signingRegion, - signing_service: authScheme.signingName, - signingName: authScheme.signingName, - signingRegionSet: authScheme.signingRegionSet - }, - authScheme.properties - ); - } + } + enableTokenBucket() { + this.enabled = true; + } + updateTokenBucketRate(newRate) { + this.refillTokenBucket(); + this.fillRate = Math.max(newRate, this.minFillRate); + this.maxCapacity = Math.max(newRate, this.minCapacity); + this.currentCapacity = Math.min(this.currentCapacity, this.maxCapacity); + } + updateMeasuredRate() { + const t = this.getCurrentTimeInSeconds(); + const timeBucket = Math.floor(t * 2) / 2; + this.requestCount++; + if (timeBucket > this.lastTxRateBucket) { + const currentRate = this.requestCount / (timeBucket - this.lastTxRateBucket); + this.measuredTxRate = this.getPrecise(currentRate * this.smooth + this.measuredTxRate * (1 - this.smooth)); + this.requestCount = 0; + this.lastTxRateBucket = timeBucket; } - return next({ - ...args - }); - }; - }, "endpointMiddleware"); - var import_middleware_serde = require_dist_cjs25(); - var endpointMiddlewareOptions = { - step: "serialize", - tags: ["ENDPOINT_PARAMETERS", "ENDPOINT_V2", "ENDPOINT"], - name: "endpointV2Middleware", - override: true, - relation: "before", - toMiddleware: import_middleware_serde.serializerMiddlewareOption.name - }; - var getEndpointPlugin = /* @__PURE__ */ __name((config, instructions) => ({ - applyToStack: (clientStack) => { - clientStack.addRelativeTo( - endpointMiddleware({ - config, - instructions - }), - endpointMiddlewareOptions - ); } - }), "getEndpointPlugin"); - var resolveEndpointConfig = /* @__PURE__ */ __name((input) => { - const tls = input.tls ?? true; - const { endpoint } = input; - const customEndpointProvider = endpoint != null ? async () => toEndpointV1(await (0, import_util_middleware.normalizeProvider)(endpoint)()) : void 0; - const isCustomEndpoint = !!endpoint; + getPrecise(num) { + return parseFloat(num.toFixed(8)); + } + }; + __name(_DefaultRateLimiter, "DefaultRateLimiter"); + var DefaultRateLimiter = _DefaultRateLimiter; + var DEFAULT_RETRY_DELAY_BASE = 100; + var MAXIMUM_RETRY_DELAY = 20 * 1e3; + var THROTTLING_RETRY_DELAY_BASE = 500; + var INITIAL_RETRY_TOKENS = 500; + var RETRY_COST = 5; + var TIMEOUT_RETRY_COST = 10; + var NO_RETRY_INCREMENT = 1; + var INVOCATION_ID_HEADER = "amz-sdk-invocation-id"; + var REQUEST_HEADER = "amz-sdk-request"; + var getDefaultRetryBackoffStrategy = /* @__PURE__ */ __name(() => { + let delayBase = DEFAULT_RETRY_DELAY_BASE; + const computeNextBackoffDelay = /* @__PURE__ */ __name((attempts) => { + return Math.floor(Math.min(MAXIMUM_RETRY_DELAY, Math.random() * 2 ** attempts * delayBase)); + }, "computeNextBackoffDelay"); + const setDelayBase = /* @__PURE__ */ __name((delay) => { + delayBase = delay; + }, "setDelayBase"); return { - ...input, - endpoint: customEndpointProvider, - tls, - isCustomEndpoint, - useDualstackEndpoint: (0, import_util_middleware.normalizeProvider)(input.useDualstackEndpoint ?? false), - useFipsEndpoint: (0, import_util_middleware.normalizeProvider)(input.useFipsEndpoint ?? false) + computeNextBackoffDelay, + setDelayBase }; - }, "resolveEndpointConfig"); - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/rng.js -function rng() { - if (poolPtr > rnds8Pool.length - 16) { - import_crypto.default.randomFillSync(rnds8Pool); - poolPtr = 0; - } - return rnds8Pool.slice(poolPtr, poolPtr += 16); -} -var import_crypto, rnds8Pool, poolPtr; -var init_rng = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/rng.js"() { - import_crypto = __toESM(require("crypto")); - rnds8Pool = new Uint8Array(256); - poolPtr = rnds8Pool.length; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/regex.js -var regex_default; -var init_regex = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/regex.js"() { - regex_default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/validate.js -function validate(uuid) { - return typeof uuid === "string" && regex_default.test(uuid); -} -var validate_default; -var init_validate = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/validate.js"() { - init_regex(); - validate_default = validate; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/stringify.js -function unsafeStringify(arr, offset = 0) { - return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]; -} -function stringify(arr, offset = 0) { - const uuid = unsafeStringify(arr, offset); - if (!validate_default(uuid)) { - throw TypeError("Stringified UUID is invalid"); - } - return uuid; -} -var byteToHex, stringify_default; -var init_stringify = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/stringify.js"() { - init_validate(); - byteToHex = []; - for (let i = 0; i < 256; ++i) { - byteToHex.push((i + 256).toString(16).slice(1)); - } - stringify_default = stringify; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/v1.js -function v1(options, buf, offset) { - let i = buf && offset || 0; - const b = buf || new Array(16); - options = options || {}; - let node = options.node || _nodeId; - let clockseq = options.clockseq !== void 0 ? options.clockseq : _clockseq; - if (node == null || clockseq == null) { - const seedBytes = options.random || (options.rng || rng)(); - if (node == null) { - node = _nodeId = [seedBytes[0] | 1, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; - } - if (clockseq == null) { - clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 16383; - } - } - let msecs = options.msecs !== void 0 ? options.msecs : Date.now(); - let nsecs = options.nsecs !== void 0 ? options.nsecs : _lastNSecs + 1; - const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 1e4; - if (dt < 0 && options.clockseq === void 0) { - clockseq = clockseq + 1 & 16383; - } - if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === void 0) { - nsecs = 0; - } - if (nsecs >= 1e4) { - throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); - } - _lastMSecs = msecs; - _lastNSecs = nsecs; - _clockseq = clockseq; - msecs += 122192928e5; - const tl = ((msecs & 268435455) * 1e4 + nsecs) % 4294967296; - b[i++] = tl >>> 24 & 255; - b[i++] = tl >>> 16 & 255; - b[i++] = tl >>> 8 & 255; - b[i++] = tl & 255; - const tmh = msecs / 4294967296 * 1e4 & 268435455; - b[i++] = tmh >>> 8 & 255; - b[i++] = tmh & 255; - b[i++] = tmh >>> 24 & 15 | 16; - b[i++] = tmh >>> 16 & 255; - b[i++] = clockseq >>> 8 | 128; - b[i++] = clockseq & 255; - for (let n = 0; n < 6; ++n) { - b[i + n] = node[n]; - } - return buf || unsafeStringify(b); -} -var _nodeId, _clockseq, _lastMSecs, _lastNSecs, v1_default; -var init_v1 = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/v1.js"() { - init_rng(); - init_stringify(); - _lastMSecs = 0; - _lastNSecs = 0; - v1_default = v1; + }, "getDefaultRetryBackoffStrategy"); + var createDefaultRetryToken = /* @__PURE__ */ __name(({ + retryDelay, + retryCount, + retryCost + }) => { + const getRetryCount = /* @__PURE__ */ __name(() => retryCount, "getRetryCount"); + const getRetryDelay = /* @__PURE__ */ __name(() => Math.min(MAXIMUM_RETRY_DELAY, retryDelay), "getRetryDelay"); + const getRetryCost = /* @__PURE__ */ __name(() => retryCost, "getRetryCost"); + return { + getRetryCount, + getRetryDelay, + getRetryCost + }; + }, "createDefaultRetryToken"); + var _StandardRetryStrategy = class _StandardRetryStrategy { + constructor(maxAttempts) { + this.maxAttempts = maxAttempts; + this.mode = "standard"; + this.capacity = INITIAL_RETRY_TOKENS; + this.retryBackoffStrategy = getDefaultRetryBackoffStrategy(); + this.maxAttemptsProvider = typeof maxAttempts === "function" ? maxAttempts : async () => maxAttempts; + } + // eslint-disable-next-line @typescript-eslint/no-unused-vars + async acquireInitialRetryToken(retryTokenScope) { + return createDefaultRetryToken({ + retryDelay: DEFAULT_RETRY_DELAY_BASE, + retryCount: 0 + }); + } + async refreshRetryTokenForRetry(token, errorInfo) { + const maxAttempts = await this.getMaxAttempts(); + if (this.shouldRetry(token, errorInfo, maxAttempts)) { + const errorType = errorInfo.errorType; + this.retryBackoffStrategy.setDelayBase( + errorType === "THROTTLING" ? THROTTLING_RETRY_DELAY_BASE : DEFAULT_RETRY_DELAY_BASE + ); + const delayFromErrorType = this.retryBackoffStrategy.computeNextBackoffDelay(token.getRetryCount()); + const retryDelay = errorInfo.retryAfterHint ? Math.max(errorInfo.retryAfterHint.getTime() - Date.now() || 0, delayFromErrorType) : delayFromErrorType; + const capacityCost = this.getCapacityCost(errorType); + this.capacity -= capacityCost; + return createDefaultRetryToken({ + retryDelay, + retryCount: token.getRetryCount() + 1, + retryCost: capacityCost + }); + } + throw new Error("No retry token available"); + } + recordSuccess(token) { + this.capacity = Math.max(INITIAL_RETRY_TOKENS, this.capacity + (token.getRetryCost() ?? NO_RETRY_INCREMENT)); + } + /** + * @returns the current available retry capacity. + * + * This number decreases when retries are executed and refills when requests or retries succeed. + */ + getCapacity() { + return this.capacity; + } + async getMaxAttempts() { + try { + return await this.maxAttemptsProvider(); + } catch (error) { + console.warn(`Max attempts provider could not resolve. Using default of ${DEFAULT_MAX_ATTEMPTS}`); + return DEFAULT_MAX_ATTEMPTS; + } + } + shouldRetry(tokenToRenew, errorInfo, maxAttempts) { + const attempts = tokenToRenew.getRetryCount() + 1; + return attempts < maxAttempts && this.capacity >= this.getCapacityCost(errorInfo.errorType) && this.isRetryableError(errorInfo.errorType); + } + getCapacityCost(errorType) { + return errorType === "TRANSIENT" ? TIMEOUT_RETRY_COST : RETRY_COST; + } + isRetryableError(errorType) { + return errorType === "THROTTLING" || errorType === "TRANSIENT"; + } + }; + __name(_StandardRetryStrategy, "StandardRetryStrategy"); + var StandardRetryStrategy = _StandardRetryStrategy; + var _AdaptiveRetryStrategy = class _AdaptiveRetryStrategy { + constructor(maxAttemptsProvider, options) { + this.maxAttemptsProvider = maxAttemptsProvider; + this.mode = "adaptive"; + const { rateLimiter } = options ?? {}; + this.rateLimiter = rateLimiter ?? new DefaultRateLimiter(); + this.standardRetryStrategy = new StandardRetryStrategy(maxAttemptsProvider); + } + async acquireInitialRetryToken(retryTokenScope) { + await this.rateLimiter.getSendToken(); + return this.standardRetryStrategy.acquireInitialRetryToken(retryTokenScope); + } + async refreshRetryTokenForRetry(tokenToRenew, errorInfo) { + this.rateLimiter.updateClientSendingRate(errorInfo); + return this.standardRetryStrategy.refreshRetryTokenForRetry(tokenToRenew, errorInfo); + } + recordSuccess(token) { + this.rateLimiter.updateClientSendingRate({}); + this.standardRetryStrategy.recordSuccess(token); + } + }; + __name(_AdaptiveRetryStrategy, "AdaptiveRetryStrategy"); + var AdaptiveRetryStrategy = _AdaptiveRetryStrategy; + var _ConfiguredRetryStrategy = class _ConfiguredRetryStrategy extends StandardRetryStrategy { + /** + * @param maxAttempts - the maximum number of retry attempts allowed. + * e.g., if set to 3, then 4 total requests are possible. + * @param computeNextBackoffDelay - a millisecond delay for each retry or a function that takes the retry attempt + * and returns the delay. + * + * @example exponential backoff. + * ```js + * new Client({ + * retryStrategy: new ConfiguredRetryStrategy(3, (attempt) => attempt ** 2) + * }); + * ``` + * @example constant delay. + * ```js + * new Client({ + * retryStrategy: new ConfiguredRetryStrategy(3, 2000) + * }); + * ``` + */ + constructor(maxAttempts, computeNextBackoffDelay = DEFAULT_RETRY_DELAY_BASE) { + super(typeof maxAttempts === "function" ? maxAttempts : async () => maxAttempts); + if (typeof computeNextBackoffDelay === "number") { + this.computeNextBackoffDelay = () => computeNextBackoffDelay; + } else { + this.computeNextBackoffDelay = computeNextBackoffDelay; + } + } + async refreshRetryTokenForRetry(tokenToRenew, errorInfo) { + const token = await super.refreshRetryTokenForRetry(tokenToRenew, errorInfo); + token.getRetryDelay = () => this.computeNextBackoffDelay(token.getRetryCount()); + return token; + } + }; + __name(_ConfiguredRetryStrategy, "ConfiguredRetryStrategy"); + var ConfiguredRetryStrategy = _ConfiguredRetryStrategy; } }); -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/parse.js -function parse(uuid) { - if (!validate_default(uuid)) { - throw TypeError("Invalid UUID"); - } - let v; - const arr = new Uint8Array(16); - arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; - arr[1] = v >>> 16 & 255; - arr[2] = v >>> 8 & 255; - arr[3] = v & 255; - arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; - arr[5] = v & 255; - arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; - arr[7] = v & 255; - arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; - arr[9] = v & 255; - arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 1099511627776 & 255; - arr[11] = v / 4294967296 & 255; - arr[12] = v >>> 24 & 255; - arr[13] = v >>> 16 & 255; - arr[14] = v >>> 8 & 255; - arr[15] = v & 255; - return arr; -} -var parse_default; -var init_parse = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/parse.js"() { - init_validate(); - parse_default = parse; +// ../../../node_modules/@smithy/middleware-retry/node_modules/@smithy/util-middleware/dist-cjs/index.js +var require_dist_cjs24 = __commonJS({ + "../../../node_modules/@smithy/middleware-retry/node_modules/@smithy/util-middleware/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + getSmithyContext: () => getSmithyContext4, + normalizeProvider: () => normalizeProvider2 + }); + module2.exports = __toCommonJS2(src_exports); + var import_types5 = require_dist_cjs(); + var getSmithyContext4 = /* @__PURE__ */ __name((context) => context[import_types5.SMITHY_CONTEXT_KEY] || (context[import_types5.SMITHY_CONTEXT_KEY] = {}), "getSmithyContext"); + var normalizeProvider2 = /* @__PURE__ */ __name((input) => { + if (typeof input === "function") + return input; + const promisified = Promise.resolve(input); + return () => promisified; + }, "normalizeProvider"); } }); -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/v35.js -function stringToBytes(str) { - str = unescape(encodeURIComponent(str)); - const bytes = []; - for (let i = 0; i < str.length; ++i) { - bytes.push(str.charCodeAt(i)); - } - return bytes; -} -function v35(name, version2, hashfunc) { - function generateUUID(value, namespace, buf, offset) { - var _namespace; - if (typeof value === "string") { - value = stringToBytes(value); - } - if (typeof namespace === "string") { - namespace = parse_default(namespace); - } - if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) { - throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)"); - } - let bytes = new Uint8Array(16 + value.length); - bytes.set(namespace); - bytes.set(value, namespace.length); - bytes = hashfunc(bytes); - bytes[6] = bytes[6] & 15 | version2; - bytes[8] = bytes[8] & 63 | 128; - if (buf) { - offset = offset || 0; - for (let i = 0; i < 16; ++i) { - buf[offset + i] = bytes[i]; - } - return buf; - } - return unsafeStringify(bytes); - } - try { - generateUUID.name = name; - } catch (err) { - } - generateUUID.DNS = DNS; - generateUUID.URL = URL2; - return generateUUID; -} -var DNS, URL2; -var init_v35 = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/v35.js"() { - init_stringify(); - init_parse(); - DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8"; - URL2 = "6ba7b811-9dad-11d1-80b4-00c04fd430c8"; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/md5.js -function md5(bytes) { - if (Array.isArray(bytes)) { - bytes = Buffer.from(bytes); - } else if (typeof bytes === "string") { - bytes = Buffer.from(bytes, "utf8"); - } - return import_crypto2.default.createHash("md5").update(bytes).digest(); -} -var import_crypto2, md5_default; -var init_md5 = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/md5.js"() { - import_crypto2 = __toESM(require("crypto")); - md5_default = md5; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/v3.js -var v3, v3_default; -var init_v3 = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/v3.js"() { - init_v35(); - init_md5(); - v3 = v35("v3", 48, md5_default); - v3_default = v3; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/native.js -var import_crypto3, native_default; -var init_native = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/native.js"() { - import_crypto3 = __toESM(require("crypto")); - native_default = { - randomUUID: import_crypto3.default.randomUUID - }; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/v4.js -function v4(options, buf, offset) { - if (native_default.randomUUID && !buf && !options) { - return native_default.randomUUID(); - } - options = options || {}; - const rnds = options.random || (options.rng || rng)(); - rnds[6] = rnds[6] & 15 | 64; - rnds[8] = rnds[8] & 63 | 128; - if (buf) { - offset = offset || 0; - for (let i = 0; i < 16; ++i) { - buf[offset + i] = rnds[i]; - } - return buf; - } - return unsafeStringify(rnds); -} -var v4_default; -var init_v4 = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/v4.js"() { - init_native(); - init_rng(); - init_stringify(); - v4_default = v4; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/sha1.js -function sha1(bytes) { - if (Array.isArray(bytes)) { - bytes = Buffer.from(bytes); - } else if (typeof bytes === "string") { - bytes = Buffer.from(bytes, "utf8"); - } - return import_crypto4.default.createHash("sha1").update(bytes).digest(); -} -var import_crypto4, sha1_default; -var init_sha1 = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/sha1.js"() { - import_crypto4 = __toESM(require("crypto")); - sha1_default = sha1; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/v5.js -var v5, v5_default; -var init_v5 = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/v5.js"() { - init_v35(); - init_sha1(); - v5 = v35("v5", 80, sha1_default); - v5_default = v5; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/nil.js -var nil_default; -var init_nil = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/nil.js"() { - nil_default = "00000000-0000-0000-0000-000000000000"; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/version.js -function version(uuid) { - if (!validate_default(uuid)) { - throw TypeError("Invalid UUID"); - } - return parseInt(uuid.slice(14, 15), 16); -} -var version_default; -var init_version = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/version.js"() { - init_validate(); - version_default = version; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/index.js -var esm_node_exports = {}; -__export(esm_node_exports, { - NIL: () => nil_default, - parse: () => parse_default, - stringify: () => stringify_default, - v1: () => v1_default, - v3: () => v3_default, - v4: () => v4_default, - v5: () => v5_default, - validate: () => validate_default, - version: () => version_default -}); -var init_esm_node = __esm({ - "../../../node_modules/@smithy/middleware-retry/node_modules/uuid/dist/esm-node/index.js"() { - init_v1(); - init_v3(); - init_v4(); - init_v5(); - init_nil(); - init_version(); - init_validate(); - init_stringify(); - init_parse(); - } -}); - -// ../../../node_modules/@smithy/service-error-classification/dist-cjs/index.js -var require_dist_cjs27 = __commonJS({ - "../../../node_modules/@smithy/service-error-classification/dist-cjs/index.js"(exports2, module2) { +// ../../../node_modules/@smithy/smithy-client/node_modules/@smithy/middleware-stack/dist-cjs/index.js +var require_dist_cjs25 = __commonJS({ + "../../../node_modules/@smithy/smithy-client/node_modules/@smithy/middleware-stack/dist-cjs/index.js"(exports2, module2) { var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames2 = Object.getOwnPropertyNames; @@ -6066,1561 +5052,399 @@ var require_dist_cjs27 = __commonJS({ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var src_exports = {}; __export2(src_exports, { - isClockSkewCorrectedError: () => isClockSkewCorrectedError, - isClockSkewError: () => isClockSkewError, - isRetryableByTrait: () => isRetryableByTrait, - isServerError: () => isServerError, - isThrottlingError: () => isThrottlingError, - isTransientError: () => isTransientError + constructStack: () => constructStack }); module2.exports = __toCommonJS2(src_exports); - var CLOCK_SKEW_ERROR_CODES = [ - "AuthFailure", - "InvalidSignatureException", - "RequestExpired", - "RequestInTheFuture", - "RequestTimeTooSkewed", - "SignatureDoesNotMatch" - ]; - var THROTTLING_ERROR_CODES = [ - "BandwidthLimitExceeded", - "EC2ThrottledException", - "LimitExceededException", - "PriorRequestNotComplete", - "ProvisionedThroughputExceededException", - "RequestLimitExceeded", - "RequestThrottled", - "RequestThrottledException", - "SlowDown", - "ThrottledException", - "Throttling", - "ThrottlingException", - "TooManyRequestsException", - "TransactionInProgressException" - // DynamoDB - ]; - var TRANSIENT_ERROR_CODES = ["TimeoutError", "RequestTimeout", "RequestTimeoutException"]; - var TRANSIENT_ERROR_STATUS_CODES = [500, 502, 503, 504]; - var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "ECONNREFUSED", "EPIPE", "ETIMEDOUT"]; - var isRetryableByTrait = /* @__PURE__ */ __name((error) => error.$retryable !== void 0, "isRetryableByTrait"); - var isClockSkewError = /* @__PURE__ */ __name((error) => CLOCK_SKEW_ERROR_CODES.includes(error.name), "isClockSkewError"); - var isClockSkewCorrectedError = /* @__PURE__ */ __name((error) => { - var _a; - return (_a = error.$metadata) == null ? void 0 : _a.clockSkewCorrected; - }, "isClockSkewCorrectedError"); - var isThrottlingError = /* @__PURE__ */ __name((error) => { - var _a, _b; - return ((_a = error.$metadata) == null ? void 0 : _a.httpStatusCode) === 429 || THROTTLING_ERROR_CODES.includes(error.name) || ((_b = error.$retryable) == null ? void 0 : _b.throttling) == true; - }, "isThrottlingError"); - var isTransientError = /* @__PURE__ */ __name((error) => { - var _a; - return isClockSkewCorrectedError(error) || TRANSIENT_ERROR_CODES.includes(error.name) || NODEJS_TIMEOUT_ERROR_CODES.includes((error == null ? void 0 : error.code) || "") || TRANSIENT_ERROR_STATUS_CODES.includes(((_a = error.$metadata) == null ? void 0 : _a.httpStatusCode) || 0); - }, "isTransientError"); - var isServerError = /* @__PURE__ */ __name((error) => { - var _a; - if (((_a = error.$metadata) == null ? void 0 : _a.httpStatusCode) !== void 0) { - const statusCode = error.$metadata.httpStatusCode; - if (500 <= statusCode && statusCode <= 599 && !isTransientError(error)) { - return true; - } - return false; + var getAllAliases = /* @__PURE__ */ __name((name, aliases) => { + const _aliases = []; + if (name) { + _aliases.push(name); } - return false; - }, "isServerError"); - } -}); - -// ../../../node_modules/@smithy/util-retry/dist-cjs/index.js -var require_dist_cjs28 = __commonJS({ - "../../../node_modules/@smithy/util-retry/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + if (aliases) { + for (const alias of aliases) { + _aliases.push(alias); + } } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - AdaptiveRetryStrategy: () => AdaptiveRetryStrategy, - ConfiguredRetryStrategy: () => ConfiguredRetryStrategy, - DEFAULT_MAX_ATTEMPTS: () => DEFAULT_MAX_ATTEMPTS, - DEFAULT_RETRY_DELAY_BASE: () => DEFAULT_RETRY_DELAY_BASE, - DEFAULT_RETRY_MODE: () => DEFAULT_RETRY_MODE, - DefaultRateLimiter: () => DefaultRateLimiter, - INITIAL_RETRY_TOKENS: () => INITIAL_RETRY_TOKENS, - INVOCATION_ID_HEADER: () => INVOCATION_ID_HEADER, - MAXIMUM_RETRY_DELAY: () => MAXIMUM_RETRY_DELAY, - NO_RETRY_INCREMENT: () => NO_RETRY_INCREMENT, - REQUEST_HEADER: () => REQUEST_HEADER, - RETRY_COST: () => RETRY_COST, - RETRY_MODES: () => RETRY_MODES, - StandardRetryStrategy: () => StandardRetryStrategy, - THROTTLING_RETRY_DELAY_BASE: () => THROTTLING_RETRY_DELAY_BASE, - TIMEOUT_RETRY_COST: () => TIMEOUT_RETRY_COST - }); - module2.exports = __toCommonJS2(src_exports); - var RETRY_MODES = /* @__PURE__ */ ((RETRY_MODES2) => { - RETRY_MODES2["STANDARD"] = "standard"; - RETRY_MODES2["ADAPTIVE"] = "adaptive"; - return RETRY_MODES2; - })(RETRY_MODES || {}); - var DEFAULT_MAX_ATTEMPTS = 3; - var DEFAULT_RETRY_MODE = "standard"; - var import_service_error_classification = require_dist_cjs27(); - var _DefaultRateLimiter = class _DefaultRateLimiter { - constructor(options) { - this.currentCapacity = 0; - this.enabled = false; - this.lastMaxRate = 0; - this.measuredTxRate = 0; - this.requestCount = 0; - this.lastTimestamp = 0; - this.timeWindow = 0; - this.beta = (options == null ? void 0 : options.beta) ?? 0.7; - this.minCapacity = (options == null ? void 0 : options.minCapacity) ?? 1; - this.minFillRate = (options == null ? void 0 : options.minFillRate) ?? 0.5; - this.scaleConstant = (options == null ? void 0 : options.scaleConstant) ?? 0.4; - this.smooth = (options == null ? void 0 : options.smooth) ?? 0.8; - const currentTimeInSeconds = this.getCurrentTimeInSeconds(); - this.lastThrottleTime = currentTimeInSeconds; - this.lastTxRateBucket = Math.floor(this.getCurrentTimeInSeconds()); - this.fillRate = this.minFillRate; - this.maxCapacity = this.minCapacity; - } - getCurrentTimeInSeconds() { - return Date.now() / 1e3; - } - async getSendToken() { - return this.acquireTokenBucket(1); - } - async acquireTokenBucket(amount) { - if (!this.enabled) { - return; - } - this.refillTokenBucket(); - if (amount > this.currentCapacity) { - const delay = (amount - this.currentCapacity) / this.fillRate * 1e3; - await new Promise((resolve) => setTimeout(resolve, delay)); - } - this.currentCapacity = this.currentCapacity - amount; - } - refillTokenBucket() { - const timestamp = this.getCurrentTimeInSeconds(); - if (!this.lastTimestamp) { - this.lastTimestamp = timestamp; - return; - } - const fillAmount = (timestamp - this.lastTimestamp) * this.fillRate; - this.currentCapacity = Math.min(this.maxCapacity, this.currentCapacity + fillAmount); - this.lastTimestamp = timestamp; - } - updateClientSendingRate(response) { - let calculatedRate; - this.updateMeasuredRate(); - if ((0, import_service_error_classification.isThrottlingError)(response)) { - const rateToUse = !this.enabled ? this.measuredTxRate : Math.min(this.measuredTxRate, this.fillRate); - this.lastMaxRate = rateToUse; - this.calculateTimeWindow(); - this.lastThrottleTime = this.getCurrentTimeInSeconds(); - calculatedRate = this.cubicThrottle(rateToUse); - this.enableTokenBucket(); - } else { - this.calculateTimeWindow(); - calculatedRate = this.cubicSuccess(this.getCurrentTimeInSeconds()); - } - const newRate = Math.min(calculatedRate, 2 * this.measuredTxRate); - this.updateTokenBucketRate(newRate); - } - calculateTimeWindow() { - this.timeWindow = this.getPrecise(Math.pow(this.lastMaxRate * (1 - this.beta) / this.scaleConstant, 1 / 3)); - } - cubicThrottle(rateToUse) { - return this.getPrecise(rateToUse * this.beta); - } - cubicSuccess(timestamp) { - return this.getPrecise( - this.scaleConstant * Math.pow(timestamp - this.lastThrottleTime - this.timeWindow, 3) + this.lastMaxRate - ); - } - enableTokenBucket() { - this.enabled = true; - } - updateTokenBucketRate(newRate) { - this.refillTokenBucket(); - this.fillRate = Math.max(newRate, this.minFillRate); - this.maxCapacity = Math.max(newRate, this.minCapacity); - this.currentCapacity = Math.min(this.currentCapacity, this.maxCapacity); - } - updateMeasuredRate() { - const t = this.getCurrentTimeInSeconds(); - const timeBucket = Math.floor(t * 2) / 2; - this.requestCount++; - if (timeBucket > this.lastTxRateBucket) { - const currentRate = this.requestCount / (timeBucket - this.lastTxRateBucket); - this.measuredTxRate = this.getPrecise(currentRate * this.smooth + this.measuredTxRate * (1 - this.smooth)); - this.requestCount = 0; - this.lastTxRateBucket = timeBucket; - } - } - getPrecise(num) { - return parseFloat(num.toFixed(8)); - } - }; - __name(_DefaultRateLimiter, "DefaultRateLimiter"); - var DefaultRateLimiter = _DefaultRateLimiter; - var DEFAULT_RETRY_DELAY_BASE = 100; - var MAXIMUM_RETRY_DELAY = 20 * 1e3; - var THROTTLING_RETRY_DELAY_BASE = 500; - var INITIAL_RETRY_TOKENS = 500; - var RETRY_COST = 5; - var TIMEOUT_RETRY_COST = 10; - var NO_RETRY_INCREMENT = 1; - var INVOCATION_ID_HEADER = "amz-sdk-invocation-id"; - var REQUEST_HEADER = "amz-sdk-request"; - var getDefaultRetryBackoffStrategy = /* @__PURE__ */ __name(() => { - let delayBase = DEFAULT_RETRY_DELAY_BASE; - const computeNextBackoffDelay = /* @__PURE__ */ __name((attempts) => { - return Math.floor(Math.min(MAXIMUM_RETRY_DELAY, Math.random() * 2 ** attempts * delayBase)); - }, "computeNextBackoffDelay"); - const setDelayBase = /* @__PURE__ */ __name((delay) => { - delayBase = delay; - }, "setDelayBase"); - return { - computeNextBackoffDelay, - setDelayBase - }; - }, "getDefaultRetryBackoffStrategy"); - var createDefaultRetryToken = /* @__PURE__ */ __name(({ - retryDelay, - retryCount, - retryCost - }) => { - const getRetryCount = /* @__PURE__ */ __name(() => retryCount, "getRetryCount"); - const getRetryDelay = /* @__PURE__ */ __name(() => Math.min(MAXIMUM_RETRY_DELAY, retryDelay), "getRetryDelay"); - const getRetryCost = /* @__PURE__ */ __name(() => retryCost, "getRetryCost"); - return { - getRetryCount, - getRetryDelay, - getRetryCost - }; - }, "createDefaultRetryToken"); - var _StandardRetryStrategy = class _StandardRetryStrategy { - constructor(maxAttempts) { - this.maxAttempts = maxAttempts; - this.mode = "standard"; - this.capacity = INITIAL_RETRY_TOKENS; - this.retryBackoffStrategy = getDefaultRetryBackoffStrategy(); - this.maxAttemptsProvider = typeof maxAttempts === "function" ? maxAttempts : async () => maxAttempts; - } - async acquireInitialRetryToken(retryTokenScope) { - return createDefaultRetryToken({ - retryDelay: DEFAULT_RETRY_DELAY_BASE, - retryCount: 0 - }); - } - async refreshRetryTokenForRetry(token, errorInfo) { - const maxAttempts = await this.getMaxAttempts(); - if (this.shouldRetry(token, errorInfo, maxAttempts)) { - const errorType = errorInfo.errorType; - this.retryBackoffStrategy.setDelayBase( - errorType === "THROTTLING" ? THROTTLING_RETRY_DELAY_BASE : DEFAULT_RETRY_DELAY_BASE - ); - const delayFromErrorType = this.retryBackoffStrategy.computeNextBackoffDelay(token.getRetryCount()); - const retryDelay = errorInfo.retryAfterHint ? Math.max(errorInfo.retryAfterHint.getTime() - Date.now() || 0, delayFromErrorType) : delayFromErrorType; - const capacityCost = this.getCapacityCost(errorType); - this.capacity -= capacityCost; - return createDefaultRetryToken({ - retryDelay, - retryCount: token.getRetryCount() + 1, - retryCost: capacityCost - }); - } - throw new Error("No retry token available"); - } - recordSuccess(token) { - this.capacity = Math.max(INITIAL_RETRY_TOKENS, this.capacity + (token.getRetryCost() ?? NO_RETRY_INCREMENT)); - } - /** - * @returns the current available retry capacity. - * - * This number decreases when retries are executed and refills when requests or retries succeed. - */ - getCapacity() { - return this.capacity; - } - async getMaxAttempts() { - try { - return await this.maxAttemptsProvider(); - } catch (error) { - console.warn(`Max attempts provider could not resolve. Using default of ${DEFAULT_MAX_ATTEMPTS}`); - return DEFAULT_MAX_ATTEMPTS; - } - } - shouldRetry(tokenToRenew, errorInfo, maxAttempts) { - const attempts = tokenToRenew.getRetryCount() + 1; - return attempts < maxAttempts && this.capacity >= this.getCapacityCost(errorInfo.errorType) && this.isRetryableError(errorInfo.errorType); - } - getCapacityCost(errorType) { - return errorType === "TRANSIENT" ? TIMEOUT_RETRY_COST : RETRY_COST; - } - isRetryableError(errorType) { - return errorType === "THROTTLING" || errorType === "TRANSIENT"; - } - }; - __name(_StandardRetryStrategy, "StandardRetryStrategy"); - var StandardRetryStrategy = _StandardRetryStrategy; - var _AdaptiveRetryStrategy = class _AdaptiveRetryStrategy { - constructor(maxAttemptsProvider, options) { - this.maxAttemptsProvider = maxAttemptsProvider; - this.mode = "adaptive"; - const { rateLimiter } = options ?? {}; - this.rateLimiter = rateLimiter ?? new DefaultRateLimiter(); - this.standardRetryStrategy = new StandardRetryStrategy(maxAttemptsProvider); - } - async acquireInitialRetryToken(retryTokenScope) { - await this.rateLimiter.getSendToken(); - return this.standardRetryStrategy.acquireInitialRetryToken(retryTokenScope); - } - async refreshRetryTokenForRetry(tokenToRenew, errorInfo) { - this.rateLimiter.updateClientSendingRate(errorInfo); - return this.standardRetryStrategy.refreshRetryTokenForRetry(tokenToRenew, errorInfo); - } - recordSuccess(token) { - this.rateLimiter.updateClientSendingRate({}); - this.standardRetryStrategy.recordSuccess(token); - } - }; - __name(_AdaptiveRetryStrategy, "AdaptiveRetryStrategy"); - var AdaptiveRetryStrategy = _AdaptiveRetryStrategy; - var _ConfiguredRetryStrategy = class _ConfiguredRetryStrategy extends StandardRetryStrategy { - /** - * @param maxAttempts - the maximum number of retry attempts allowed. - * e.g., if set to 3, then 4 total requests are possible. - * @param computeNextBackoffDelay - a millisecond delay for each retry or a function that takes the retry attempt - * and returns the delay. - * - * @example exponential backoff. - * ```js - * new Client({ - * retryStrategy: new ConfiguredRetryStrategy(3, (attempt) => attempt ** 2) - * }); - * ``` - * @example constant delay. - * ```js - * new Client({ - * retryStrategy: new ConfiguredRetryStrategy(3, 2000) - * }); - * ``` - */ - constructor(maxAttempts, computeNextBackoffDelay = DEFAULT_RETRY_DELAY_BASE) { - super(typeof maxAttempts === "function" ? maxAttempts : async () => maxAttempts); - if (typeof computeNextBackoffDelay === "number") { - this.computeNextBackoffDelay = () => computeNextBackoffDelay; - } else { - this.computeNextBackoffDelay = computeNextBackoffDelay; - } - } - async refreshRetryTokenForRetry(tokenToRenew, errorInfo) { - const token = await super.refreshRetryTokenForRetry(tokenToRenew, errorInfo); - token.getRetryDelay = () => this.computeNextBackoffDelay(token.getRetryCount()); - return token; - } - }; - __name(_ConfiguredRetryStrategy, "ConfiguredRetryStrategy"); - var ConfiguredRetryStrategy = _ConfiguredRetryStrategy; - } -}); - -// ../../../node_modules/@smithy/middleware-stack/dist-cjs/index.js -var require_dist_cjs29 = __commonJS({ - "../../../node_modules/@smithy/middleware-stack/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - constructStack: () => constructStack - }); - module2.exports = __toCommonJS2(src_exports); - var getAllAliases = /* @__PURE__ */ __name((name, aliases) => { - const _aliases = []; - if (name) { - _aliases.push(name); - } - if (aliases) { - for (const alias of aliases) { - _aliases.push(alias); - } - } - return _aliases; - }, "getAllAliases"); - var getMiddlewareNameWithAliases = /* @__PURE__ */ __name((name, aliases) => { - return `${name || "anonymous"}${aliases && aliases.length > 0 ? ` (a.k.a. ${aliases.join(",")})` : ""}`; - }, "getMiddlewareNameWithAliases"); - var constructStack = /* @__PURE__ */ __name(() => { - let absoluteEntries = []; - let relativeEntries = []; - let identifyOnResolve = false; - const entriesNameSet = /* @__PURE__ */ new Set(); - const sort = /* @__PURE__ */ __name((entries) => entries.sort( - (a, b) => stepWeights[b.step] - stepWeights[a.step] || priorityWeights[b.priority || "normal"] - priorityWeights[a.priority || "normal"] - ), "sort"); - const removeByName = /* @__PURE__ */ __name((toRemove) => { - let isRemoved = false; - const filterCb = /* @__PURE__ */ __name((entry) => { - const aliases = getAllAliases(entry.name, entry.aliases); - if (aliases.includes(toRemove)) { - isRemoved = true; - for (const alias of aliases) { - entriesNameSet.delete(alias); - } - return false; - } - return true; - }, "filterCb"); - absoluteEntries = absoluteEntries.filter(filterCb); - relativeEntries = relativeEntries.filter(filterCb); - return isRemoved; - }, "removeByName"); - const removeByReference = /* @__PURE__ */ __name((toRemove) => { - let isRemoved = false; - const filterCb = /* @__PURE__ */ __name((entry) => { - if (entry.middleware === toRemove) { - isRemoved = true; - for (const alias of getAllAliases(entry.name, entry.aliases)) { - entriesNameSet.delete(alias); - } - return false; - } - return true; - }, "filterCb"); - absoluteEntries = absoluteEntries.filter(filterCb); - relativeEntries = relativeEntries.filter(filterCb); - return isRemoved; - }, "removeByReference"); - const cloneTo = /* @__PURE__ */ __name((toStack) => { - var _a; - absoluteEntries.forEach((entry) => { - toStack.add(entry.middleware, { ...entry }); - }); - relativeEntries.forEach((entry) => { - toStack.addRelativeTo(entry.middleware, { ...entry }); - }); - (_a = toStack.identifyOnResolve) == null ? void 0 : _a.call(toStack, stack.identifyOnResolve()); - return toStack; - }, "cloneTo"); - const expandRelativeMiddlewareList = /* @__PURE__ */ __name((from) => { - const expandedMiddlewareList = []; - from.before.forEach((entry) => { - if (entry.before.length === 0 && entry.after.length === 0) { - expandedMiddlewareList.push(entry); - } else { - expandedMiddlewareList.push(...expandRelativeMiddlewareList(entry)); - } - }); - expandedMiddlewareList.push(from); - from.after.reverse().forEach((entry) => { - if (entry.before.length === 0 && entry.after.length === 0) { - expandedMiddlewareList.push(entry); - } else { - expandedMiddlewareList.push(...expandRelativeMiddlewareList(entry)); - } - }); - return expandedMiddlewareList; - }, "expandRelativeMiddlewareList"); - const getMiddlewareList = /* @__PURE__ */ __name((debug = false) => { - const normalizedAbsoluteEntries = []; - const normalizedRelativeEntries = []; - const normalizedEntriesNameMap = {}; - absoluteEntries.forEach((entry) => { - const normalizedEntry = { - ...entry, - before: [], - after: [] - }; - for (const alias of getAllAliases(normalizedEntry.name, normalizedEntry.aliases)) { - normalizedEntriesNameMap[alias] = normalizedEntry; - } - normalizedAbsoluteEntries.push(normalizedEntry); - }); - relativeEntries.forEach((entry) => { - const normalizedEntry = { - ...entry, - before: [], - after: [] - }; - for (const alias of getAllAliases(normalizedEntry.name, normalizedEntry.aliases)) { - normalizedEntriesNameMap[alias] = normalizedEntry; - } - normalizedRelativeEntries.push(normalizedEntry); - }); - normalizedRelativeEntries.forEach((entry) => { - if (entry.toMiddleware) { - const toMiddleware = normalizedEntriesNameMap[entry.toMiddleware]; - if (toMiddleware === void 0) { - if (debug) { - return; - } - throw new Error( - `${entry.toMiddleware} is not found when adding ${getMiddlewareNameWithAliases(entry.name, entry.aliases)} middleware ${entry.relation} ${entry.toMiddleware}` - ); - } - if (entry.relation === "after") { - toMiddleware.after.push(entry); - } - if (entry.relation === "before") { - toMiddleware.before.push(entry); - } - } - }); - const mainChain = sort(normalizedAbsoluteEntries).map(expandRelativeMiddlewareList).reduce((wholeList, expandedMiddlewareList) => { - wholeList.push(...expandedMiddlewareList); - return wholeList; - }, []); - return mainChain; - }, "getMiddlewareList"); - const stack = { - add: (middleware, options = {}) => { - const { name, override, aliases: _aliases } = options; - const entry = { - step: "initialize", - priority: "normal", - middleware, - ...options - }; - const aliases = getAllAliases(name, _aliases); - if (aliases.length > 0) { - if (aliases.some((alias) => entriesNameSet.has(alias))) { - if (!override) - throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(name, _aliases)}'`); - for (const alias of aliases) { - const toOverrideIndex = absoluteEntries.findIndex( - (entry2) => { - var _a; - return entry2.name === alias || ((_a = entry2.aliases) == null ? void 0 : _a.some((a) => a === alias)); - } - ); - if (toOverrideIndex === -1) { - continue; - } - const toOverride = absoluteEntries[toOverrideIndex]; - if (toOverride.step !== entry.step || entry.priority !== toOverride.priority) { - throw new Error( - `"${getMiddlewareNameWithAliases(toOverride.name, toOverride.aliases)}" middleware with ${toOverride.priority} priority in ${toOverride.step} step cannot be overridden by "${getMiddlewareNameWithAliases(name, _aliases)}" middleware with ${entry.priority} priority in ${entry.step} step.` - ); - } - absoluteEntries.splice(toOverrideIndex, 1); - } - } - for (const alias of aliases) { - entriesNameSet.add(alias); - } - } - absoluteEntries.push(entry); - }, - addRelativeTo: (middleware, options) => { - const { name, override, aliases: _aliases } = options; - const entry = { - middleware, - ...options - }; - const aliases = getAllAliases(name, _aliases); - if (aliases.length > 0) { - if (aliases.some((alias) => entriesNameSet.has(alias))) { - if (!override) - throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(name, _aliases)}'`); - for (const alias of aliases) { - const toOverrideIndex = relativeEntries.findIndex( - (entry2) => { - var _a; - return entry2.name === alias || ((_a = entry2.aliases) == null ? void 0 : _a.some((a) => a === alias)); - } - ); - if (toOverrideIndex === -1) { - continue; - } - const toOverride = relativeEntries[toOverrideIndex]; - if (toOverride.toMiddleware !== entry.toMiddleware || toOverride.relation !== entry.relation) { - throw new Error( - `"${getMiddlewareNameWithAliases(toOverride.name, toOverride.aliases)}" middleware ${toOverride.relation} "${toOverride.toMiddleware}" middleware cannot be overridden by "${getMiddlewareNameWithAliases(name, _aliases)}" middleware ${entry.relation} "${entry.toMiddleware}" middleware.` - ); - } - relativeEntries.splice(toOverrideIndex, 1); - } - } - for (const alias of aliases) { - entriesNameSet.add(alias); - } - } - relativeEntries.push(entry); - }, - clone: () => cloneTo(constructStack()), - use: (plugin) => { - plugin.applyToStack(stack); - }, - remove: (toRemove) => { - if (typeof toRemove === "string") - return removeByName(toRemove); - else - return removeByReference(toRemove); - }, - removeByTag: (toRemove) => { - let isRemoved = false; - const filterCb = /* @__PURE__ */ __name((entry) => { - const { tags, name, aliases: _aliases } = entry; - if (tags && tags.includes(toRemove)) { - const aliases = getAllAliases(name, _aliases); - for (const alias of aliases) { - entriesNameSet.delete(alias); - } - isRemoved = true; - return false; - } - return true; - }, "filterCb"); - absoluteEntries = absoluteEntries.filter(filterCb); - relativeEntries = relativeEntries.filter(filterCb); - return isRemoved; - }, - concat: (from) => { - var _a; - const cloned = cloneTo(constructStack()); - cloned.use(from); - cloned.identifyOnResolve( - identifyOnResolve || cloned.identifyOnResolve() || (((_a = from.identifyOnResolve) == null ? void 0 : _a.call(from)) ?? false) - ); - return cloned; - }, - applyToStack: cloneTo, - identify: () => { - return getMiddlewareList(true).map((mw) => { - const step = mw.step ?? mw.relation + " " + mw.toMiddleware; - return getMiddlewareNameWithAliases(mw.name, mw.aliases) + " - " + step; - }); - }, - identifyOnResolve(toggle) { - if (typeof toggle === "boolean") - identifyOnResolve = toggle; - return identifyOnResolve; - }, - resolve: (handler2, context) => { - for (const middleware of getMiddlewareList().map((entry) => entry.middleware).reverse()) { - handler2 = middleware(handler2, context); - } - if (identifyOnResolve) { - console.log(stack.identify()); - } - return handler2; - } - }; - return stack; - }, "constructStack"); - var stepWeights = { - initialize: 5, - serialize: 4, - build: 3, - finalizeRequest: 2, - deserialize: 1 - }; - var priorityWeights = { - high: 3, - normal: 2, - low: 1 - }; - } -}); - -// ../../../node_modules/@smithy/util-base64/dist-cjs/fromBase64.js -var require_fromBase64 = __commonJS({ - "../../../node_modules/@smithy/util-base64/dist-cjs/fromBase64.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.fromBase64 = void 0; - var util_buffer_from_1 = require_dist_cjs9(); - var BASE64_REGEX = /^[A-Za-z0-9+/]*={0,2}$/; - var fromBase642 = (input) => { - if (input.length * 3 % 4 !== 0) { - throw new TypeError(`Incorrect padding on base64 string.`); - } - if (!BASE64_REGEX.exec(input)) { - throw new TypeError(`Invalid base64 string.`); - } - const buffer = (0, util_buffer_from_1.fromString)(input, "base64"); - return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength); - }; - exports2.fromBase64 = fromBase642; - } -}); - -// ../../../node_modules/@smithy/util-base64/dist-cjs/toBase64.js -var require_toBase64 = __commonJS({ - "../../../node_modules/@smithy/util-base64/dist-cjs/toBase64.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.toBase64 = void 0; - var util_buffer_from_1 = require_dist_cjs9(); - var util_utf8_1 = require_dist_cjs10(); - var toBase642 = (_input) => { - let input; - if (typeof _input === "string") { - input = (0, util_utf8_1.fromUtf8)(_input); - } else { - input = _input; - } - if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") { - throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array."); - } - return (0, util_buffer_from_1.fromArrayBuffer)(input.buffer, input.byteOffset, input.byteLength).toString("base64"); - }; - exports2.toBase64 = toBase642; - } -}); - -// ../../../node_modules/@smithy/util-base64/dist-cjs/index.js -var require_dist_cjs30 = __commonJS({ - "../../../node_modules/@smithy/util-base64/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); - } - return to; - }; - var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")); - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - module2.exports = __toCommonJS2(src_exports); - __reExport(src_exports, require_fromBase64(), module2.exports); - __reExport(src_exports, require_toBase64(), module2.exports); - } -}); - -// ../../../node_modules/@smithy/util-stream/dist-cjs/getAwsChunkedEncodingStream.js -var require_getAwsChunkedEncodingStream = __commonJS({ - "../../../node_modules/@smithy/util-stream/dist-cjs/getAwsChunkedEncodingStream.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getAwsChunkedEncodingStream = void 0; - var stream_1 = require("stream"); - var getAwsChunkedEncodingStream2 = (readableStream, options) => { - const { base64Encoder, bodyLengthChecker, checksumAlgorithmFn, checksumLocationName, streamHasher } = options; - const checksumRequired = base64Encoder !== void 0 && checksumAlgorithmFn !== void 0 && checksumLocationName !== void 0 && streamHasher !== void 0; - const digest = checksumRequired ? streamHasher(checksumAlgorithmFn, readableStream) : void 0; - const awsChunkedEncodingStream = new stream_1.Readable({ read: () => { - } }); - readableStream.on("data", (data) => { - const length = bodyLengthChecker(data) || 0; - awsChunkedEncodingStream.push(`${length.toString(16)}\r -`); - awsChunkedEncodingStream.push(data); - awsChunkedEncodingStream.push("\r\n"); - }); - readableStream.on("end", async () => { - awsChunkedEncodingStream.push(`0\r -`); - if (checksumRequired) { - const checksum = base64Encoder(await digest); - awsChunkedEncodingStream.push(`${checksumLocationName}:${checksum}\r -`); - awsChunkedEncodingStream.push(`\r -`); - } - awsChunkedEncodingStream.push(null); - }); - return awsChunkedEncodingStream; - }; - exports2.getAwsChunkedEncodingStream = getAwsChunkedEncodingStream2; - } -}); - -// ../../../node_modules/@smithy/querystring-builder/dist-cjs/index.js -var require_dist_cjs31 = __commonJS({ - "../../../node_modules/@smithy/querystring-builder/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - buildQueryString: () => buildQueryString - }); - module2.exports = __toCommonJS2(src_exports); - var import_util_uri_escape = require_dist_cjs12(); - function buildQueryString(query) { - const parts = []; - for (let key of Object.keys(query).sort()) { - const value = query[key]; - key = (0, import_util_uri_escape.escapeUri)(key); - if (Array.isArray(value)) { - for (let i = 0, iLen = value.length; i < iLen; i++) { - parts.push(`${key}=${(0, import_util_uri_escape.escapeUri)(value[i])}`); - } - } else { - let qsEntry = key; - if (value || typeof value === "string") { - qsEntry += `=${(0, import_util_uri_escape.escapeUri)(value)}`; - } - parts.push(qsEntry); - } - } - return parts.join("&"); - } - __name(buildQueryString, "buildQueryString"); - } -}); - -// ../../../node_modules/@smithy/node-http-handler/dist-cjs/index.js -var require_dist_cjs32 = __commonJS({ - "../../../node_modules/@smithy/node-http-handler/dist-cjs/index.js"(exports2, module2) { - var __create2 = Object.create; - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __getProtoOf2 = Object.getPrototypeOf; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); - } - return to; - }; - var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2( - // If the importer is in node compatibility mode or this is not an ESM - // file that has been converted to a CommonJS file using a Babel- - // compatible transform (i.e. "__esModule" has not been set), then set - // "default" to the CommonJS "module.exports" for node compatibility. - isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, - mod - )); - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - DEFAULT_REQUEST_TIMEOUT: () => DEFAULT_REQUEST_TIMEOUT, - NodeHttp2Handler: () => NodeHttp2Handler, - NodeHttpHandler: () => NodeHttpHandler, - streamCollector: () => streamCollector - }); - module2.exports = __toCommonJS2(src_exports); - var import_protocol_http = require_dist_cjs2(); - var import_querystring_builder = require_dist_cjs31(); - var import_http2 = require("http"); - var import_https = require("https"); - var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "EPIPE", "ETIMEDOUT"]; - var getTransformedHeaders = /* @__PURE__ */ __name((headers) => { - const transformedHeaders = {}; - for (const name of Object.keys(headers)) { - const headerValues = headers[name]; - transformedHeaders[name] = Array.isArray(headerValues) ? headerValues.join(",") : headerValues; - } - return transformedHeaders; - }, "getTransformedHeaders"); - var setConnectionTimeout = /* @__PURE__ */ __name((request2, reject, timeoutInMs = 0) => { - if (!timeoutInMs) { - return; - } - const timeoutId = setTimeout(() => { - request2.destroy(); - reject( - Object.assign(new Error(`Socket timed out without establishing a connection within ${timeoutInMs} ms`), { - name: "TimeoutError" - }) - ); - }, timeoutInMs); - request2.on("socket", (socket) => { - if (socket.connecting) { - socket.on("connect", () => { - clearTimeout(timeoutId); - }); - } else { - clearTimeout(timeoutId); - } - }); - }, "setConnectionTimeout"); - var setSocketKeepAlive = /* @__PURE__ */ __name((request2, { keepAlive, keepAliveMsecs }) => { - if (keepAlive !== true) { - return; - } - request2.on("socket", (socket) => { - socket.setKeepAlive(keepAlive, keepAliveMsecs || 0); - }); - }, "setSocketKeepAlive"); - var setSocketTimeout = /* @__PURE__ */ __name((request2, reject, timeoutInMs = 0) => { - request2.setTimeout(timeoutInMs, () => { - request2.destroy(); - reject(Object.assign(new Error(`Connection timed out after ${timeoutInMs} ms`), { name: "TimeoutError" })); - }); - }, "setSocketTimeout"); - var import_stream = require("stream"); - var MIN_WAIT_TIME = 1e3; - async function writeRequestBody(httpRequest, request2, maxContinueTimeoutMs = MIN_WAIT_TIME) { - const headers = request2.headers ?? {}; - const expect = headers["Expect"] || headers["expect"]; - let timeoutId = -1; - let hasError = false; - if (expect === "100-continue") { - await Promise.race([ - new Promise((resolve) => { - timeoutId = Number(setTimeout(resolve, Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs))); - }), - new Promise((resolve) => { - httpRequest.on("continue", () => { - clearTimeout(timeoutId); - resolve(); - }); - httpRequest.on("error", () => { - hasError = true; - clearTimeout(timeoutId); - resolve(); - }); - }) - ]); - } - if (!hasError) { - writeBody(httpRequest, request2.body); - } - } - __name(writeRequestBody, "writeRequestBody"); - function writeBody(httpRequest, body) { - if (body instanceof import_stream.Readable) { - body.pipe(httpRequest); - return; - } - if (body) { - if (Buffer.isBuffer(body) || typeof body === "string") { - httpRequest.end(body); - return; - } - const uint8 = body; - if (typeof uint8 === "object" && uint8.buffer && typeof uint8.byteOffset === "number" && typeof uint8.byteLength === "number") { - httpRequest.end(Buffer.from(uint8.buffer, uint8.byteOffset, uint8.byteLength)); - return; - } - httpRequest.end(Buffer.from(body)); - return; - } - httpRequest.end(); - } - __name(writeBody, "writeBody"); - var DEFAULT_REQUEST_TIMEOUT = 0; - var _NodeHttpHandler = class _NodeHttpHandler2 { - constructor(options) { - this.socketWarningTimestamp = 0; - this.metadata = { handlerProtocol: "http/1.1" }; - this.configProvider = new Promise((resolve, reject) => { - if (typeof options === "function") { - options().then((_options) => { - resolve(this.resolveDefaultConfig(_options)); - }).catch(reject); - } else { - resolve(this.resolveDefaultConfig(options)); - } - }); - } - /** - * @returns the input if it is an HttpHandler of any class, - * or instantiates a new instance of this handler. - */ - static create(instanceOrOptions) { - if (typeof (instanceOrOptions == null ? void 0 : instanceOrOptions.handle) === "function") { - return instanceOrOptions; - } - return new _NodeHttpHandler2(instanceOrOptions); - } - /** - * @internal - * - * @param agent - http(s) agent in use by the NodeHttpHandler instance. - * @returns timestamp of last emitted warning. - */ - static checkSocketUsage(agent, socketWarningTimestamp) { - var _a, _b; - const { sockets, requests, maxSockets } = agent; - if (typeof maxSockets !== "number" || maxSockets === Infinity) { - return socketWarningTimestamp; - } - const interval = 15e3; - if (Date.now() - interval < socketWarningTimestamp) { - return socketWarningTimestamp; - } - if (sockets && requests) { - for (const origin in sockets) { - const socketsInUse = ((_a = sockets[origin]) == null ? void 0 : _a.length) ?? 0; - const requestsEnqueued = ((_b = requests[origin]) == null ? void 0 : _b.length) ?? 0; - if (socketsInUse >= maxSockets && requestsEnqueued >= 2 * maxSockets) { - console.warn( - "@smithy/node-http-handler:WARN", - `socket usage at capacity=${socketsInUse} and ${requestsEnqueued} additional requests are enqueued.`, - "See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html", - "or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config." - ); - return Date.now(); - } - } - } - return socketWarningTimestamp; - } - resolveDefaultConfig(options) { - const { requestTimeout, connectionTimeout, socketTimeout, httpAgent, httpsAgent } = options || {}; - const keepAlive = true; - const maxSockets = 50; - return { - connectionTimeout, - requestTimeout: requestTimeout ?? socketTimeout, - httpAgent: (() => { - if (httpAgent instanceof import_http2.Agent || typeof (httpAgent == null ? void 0 : httpAgent.destroy) === "function") { - return httpAgent; - } - return new import_http2.Agent({ keepAlive, maxSockets, ...httpAgent }); - })(), - httpsAgent: (() => { - if (httpsAgent instanceof import_https.Agent || typeof (httpsAgent == null ? void 0 : httpsAgent.destroy) === "function") { - return httpsAgent; - } - return new import_https.Agent({ keepAlive, maxSockets, ...httpsAgent }); - })() - }; - } - destroy() { - var _a, _b, _c, _d; - (_b = (_a = this.config) == null ? void 0 : _a.httpAgent) == null ? void 0 : _b.destroy(); - (_d = (_c = this.config) == null ? void 0 : _c.httpsAgent) == null ? void 0 : _d.destroy(); - } - async handle(request2, { abortSignal } = {}) { - if (!this.config) { - this.config = await this.configProvider; - } - let socketCheckTimeoutId; - return new Promise((_resolve, _reject) => { - let writeRequestBodyPromise = void 0; - const resolve = /* @__PURE__ */ __name(async (arg) => { - await writeRequestBodyPromise; - clearTimeout(socketCheckTimeoutId); - _resolve(arg); - }, "resolve"); - const reject = /* @__PURE__ */ __name(async (arg) => { - await writeRequestBodyPromise; - _reject(arg); - }, "reject"); - if (!this.config) { - throw new Error("Node HTTP request handler config is not resolved"); - } - if (abortSignal == null ? void 0 : abortSignal.aborted) { - const abortError = new Error("Request aborted"); - abortError.name = "AbortError"; - reject(abortError); - return; - } - const isSSL = request2.protocol === "https:"; - const agent = isSSL ? this.config.httpsAgent : this.config.httpAgent; - socketCheckTimeoutId = setTimeout(() => { - this.socketWarningTimestamp = _NodeHttpHandler2.checkSocketUsage(agent, this.socketWarningTimestamp); - }, this.config.socketAcquisitionWarningTimeout ?? (this.config.requestTimeout ?? 2e3) + (this.config.connectionTimeout ?? 1e3)); - const queryString = (0, import_querystring_builder.buildQueryString)(request2.query || {}); - let auth = void 0; - if (request2.username != null || request2.password != null) { - const username = request2.username ?? ""; - const password = request2.password ?? ""; - auth = `${username}:${password}`; - } - let path = request2.path; - if (queryString) { - path += `?${queryString}`; - } - if (request2.fragment) { - path += `#${request2.fragment}`; - } - const nodeHttpsOptions = { - headers: request2.headers, - host: request2.hostname, - method: request2.method, - path, - port: request2.port, - agent, - auth - }; - const requestFunc = isSSL ? import_https.request : import_http2.request; - const req = requestFunc(nodeHttpsOptions, (res) => { - const httpResponse = new import_protocol_http.HttpResponse({ - statusCode: res.statusCode || -1, - reason: res.statusMessage, - headers: getTransformedHeaders(res.headers), - body: res - }); - resolve({ response: httpResponse }); - }); - req.on("error", (err) => { - if (NODEJS_TIMEOUT_ERROR_CODES.includes(err.code)) { - reject(Object.assign(err, { name: "TimeoutError" })); - } else { - reject(err); - } - }); - setConnectionTimeout(req, reject, this.config.connectionTimeout); - setSocketTimeout(req, reject, this.config.requestTimeout); - if (abortSignal) { - abortSignal.onabort = () => { - req.abort(); - const abortError = new Error("Request aborted"); - abortError.name = "AbortError"; - reject(abortError); - }; - } - const httpAgent = nodeHttpsOptions.agent; - if (typeof httpAgent === "object" && "keepAlive" in httpAgent) { - setSocketKeepAlive(req, { - // @ts-expect-error keepAlive is not public on httpAgent. - keepAlive: httpAgent.keepAlive, - // @ts-expect-error keepAliveMsecs is not public on httpAgent. - keepAliveMsecs: httpAgent.keepAliveMsecs - }); - } - writeRequestBodyPromise = writeRequestBody(req, request2, this.config.requestTimeout).catch(_reject); - }); - } - updateHttpClientConfig(key, value) { - this.config = void 0; - this.configProvider = this.configProvider.then((config) => { - return { - ...config, - [key]: value - }; - }); - } - httpHandlerConfigs() { - return this.config ?? {}; - } - }; - __name(_NodeHttpHandler, "NodeHttpHandler"); - var NodeHttpHandler = _NodeHttpHandler; - var import_http22 = require("http2"); - var import_http23 = __toESM2(require("http2")); - var _NodeHttp2ConnectionPool = class _NodeHttp2ConnectionPool { - constructor(sessions) { - this.sessions = []; - this.sessions = sessions ?? []; - } - poll() { - if (this.sessions.length > 0) { - return this.sessions.shift(); - } - } - offerLast(session) { - this.sessions.push(session); - } - contains(session) { - return this.sessions.includes(session); - } - remove(session) { - this.sessions = this.sessions.filter((s) => s !== session); - } - [Symbol.iterator]() { - return this.sessions[Symbol.iterator](); - } - destroy(connection) { - for (const session of this.sessions) { - if (session === connection) { - if (!session.destroyed) { - session.destroy(); + return _aliases; + }, "getAllAliases"); + var getMiddlewareNameWithAliases = /* @__PURE__ */ __name((name, aliases) => { + return `${name || "anonymous"}${aliases && aliases.length > 0 ? ` (a.k.a. ${aliases.join(",")})` : ""}`; + }, "getMiddlewareNameWithAliases"); + var constructStack = /* @__PURE__ */ __name(() => { + let absoluteEntries = []; + let relativeEntries = []; + let identifyOnResolve = false; + const entriesNameSet = /* @__PURE__ */ new Set(); + const sort = /* @__PURE__ */ __name((entries) => entries.sort( + (a, b) => stepWeights[b.step] - stepWeights[a.step] || priorityWeights[b.priority || "normal"] - priorityWeights[a.priority || "normal"] + ), "sort"); + const removeByName = /* @__PURE__ */ __name((toRemove) => { + let isRemoved = false; + const filterCb = /* @__PURE__ */ __name((entry) => { + const aliases = getAllAliases(entry.name, entry.aliases); + if (aliases.includes(toRemove)) { + isRemoved = true; + for (const alias of aliases) { + entriesNameSet.delete(alias); } + return false; } - } - } - }; - __name(_NodeHttp2ConnectionPool, "NodeHttp2ConnectionPool"); - var NodeHttp2ConnectionPool = _NodeHttp2ConnectionPool; - var _NodeHttp2ConnectionManager = class _NodeHttp2ConnectionManager { - constructor(config) { - this.sessionCache = /* @__PURE__ */ new Map(); - this.config = config; - if (this.config.maxConcurrency && this.config.maxConcurrency <= 0) { - throw new RangeError("maxConcurrency must be greater than zero."); - } - } - lease(requestContext, connectionConfiguration) { - const url2 = this.getUrlString(requestContext); - const existingPool = this.sessionCache.get(url2); - if (existingPool) { - const existingSession = existingPool.poll(); - if (existingSession && !this.config.disableConcurrency) { - return existingSession; - } - } - const session = import_http23.default.connect(url2); - if (this.config.maxConcurrency) { - session.settings({ maxConcurrentStreams: this.config.maxConcurrency }, (err) => { - if (err) { - throw new Error( - "Fail to set maxConcurrentStreams to " + this.config.maxConcurrency + "when creating new session for " + requestContext.destination.toString() - ); - } - }); - } - session.unref(); - const destroySessionCb = /* @__PURE__ */ __name(() => { - session.destroy(); - this.deleteSession(url2, session); - }, "destroySessionCb"); - session.on("goaway", destroySessionCb); - session.on("error", destroySessionCb); - session.on("frameError", destroySessionCb); - session.on("close", () => this.deleteSession(url2, session)); - if (connectionConfiguration.requestTimeout) { - session.setTimeout(connectionConfiguration.requestTimeout, destroySessionCb); - } - const connectionPool = this.sessionCache.get(url2) || new NodeHttp2ConnectionPool(); - connectionPool.offerLast(session); - this.sessionCache.set(url2, connectionPool); - return session; - } - /** - * Delete a session from the connection pool. - * @param authority The authority of the session to delete. - * @param session The session to delete. - */ - deleteSession(authority, session) { - const existingConnectionPool = this.sessionCache.get(authority); - if (!existingConnectionPool) { - return; - } - if (!existingConnectionPool.contains(session)) { - return; - } - existingConnectionPool.remove(session); - this.sessionCache.set(authority, existingConnectionPool); - } - release(requestContext, session) { - var _a; - const cacheKey = this.getUrlString(requestContext); - (_a = this.sessionCache.get(cacheKey)) == null ? void 0 : _a.offerLast(session); - } - destroy() { - for (const [key, connectionPool] of this.sessionCache) { - for (const session of connectionPool) { - if (!session.destroyed) { - session.destroy(); + return true; + }, "filterCb"); + absoluteEntries = absoluteEntries.filter(filterCb); + relativeEntries = relativeEntries.filter(filterCb); + return isRemoved; + }, "removeByName"); + const removeByReference = /* @__PURE__ */ __name((toRemove) => { + let isRemoved = false; + const filterCb = /* @__PURE__ */ __name((entry) => { + if (entry.middleware === toRemove) { + isRemoved = true; + for (const alias of getAllAliases(entry.name, entry.aliases)) { + entriesNameSet.delete(alias); } - connectionPool.remove(session); - } - this.sessionCache.delete(key); - } - } - setMaxConcurrentStreams(maxConcurrentStreams) { - if (this.config.maxConcurrency && this.config.maxConcurrency <= 0) { - throw new RangeError("maxConcurrentStreams must be greater than zero."); - } - this.config.maxConcurrency = maxConcurrentStreams; - } - setDisableConcurrentStreams(disableConcurrentStreams) { - this.config.disableConcurrency = disableConcurrentStreams; - } - getUrlString(request2) { - return request2.destination.toString(); - } - }; - __name(_NodeHttp2ConnectionManager, "NodeHttp2ConnectionManager"); - var NodeHttp2ConnectionManager = _NodeHttp2ConnectionManager; - var _NodeHttp2Handler = class _NodeHttp2Handler2 { - constructor(options) { - this.metadata = { handlerProtocol: "h2" }; - this.connectionManager = new NodeHttp2ConnectionManager({}); - this.configProvider = new Promise((resolve, reject) => { - if (typeof options === "function") { - options().then((opts) => { - resolve(opts || {}); - }).catch(reject); - } else { - resolve(options || {}); - } - }); - } - /** - * @returns the input if it is an HttpHandler of any class, - * or instantiates a new instance of this handler. - */ - static create(instanceOrOptions) { - if (typeof (instanceOrOptions == null ? void 0 : instanceOrOptions.handle) === "function") { - return instanceOrOptions; - } - return new _NodeHttp2Handler2(instanceOrOptions); - } - destroy() { - this.connectionManager.destroy(); - } - async handle(request2, { abortSignal } = {}) { - if (!this.config) { - this.config = await this.configProvider; - this.connectionManager.setDisableConcurrentStreams(this.config.disableConcurrentStreams || false); - if (this.config.maxConcurrentStreams) { - this.connectionManager.setMaxConcurrentStreams(this.config.maxConcurrentStreams); + return false; } - } - const { requestTimeout, disableConcurrentStreams } = this.config; - return new Promise((_resolve, _reject) => { - var _a; - let fulfilled = false; - let writeRequestBodyPromise = void 0; - const resolve = /* @__PURE__ */ __name(async (arg) => { - await writeRequestBodyPromise; - _resolve(arg); - }, "resolve"); - const reject = /* @__PURE__ */ __name(async (arg) => { - await writeRequestBodyPromise; - _reject(arg); - }, "reject"); - if (abortSignal == null ? void 0 : abortSignal.aborted) { - fulfilled = true; - const abortError = new Error("Request aborted"); - abortError.name = "AbortError"; - reject(abortError); - return; + return true; + }, "filterCb"); + absoluteEntries = absoluteEntries.filter(filterCb); + relativeEntries = relativeEntries.filter(filterCb); + return isRemoved; + }, "removeByReference"); + const cloneTo = /* @__PURE__ */ __name((toStack) => { + var _a; + absoluteEntries.forEach((entry) => { + toStack.add(entry.middleware, { ...entry }); + }); + relativeEntries.forEach((entry) => { + toStack.addRelativeTo(entry.middleware, { ...entry }); + }); + (_a = toStack.identifyOnResolve) == null ? void 0 : _a.call(toStack, stack.identifyOnResolve()); + return toStack; + }, "cloneTo"); + const expandRelativeMiddlewareList = /* @__PURE__ */ __name((from) => { + const expandedMiddlewareList = []; + from.before.forEach((entry) => { + if (entry.before.length === 0 && entry.after.length === 0) { + expandedMiddlewareList.push(entry); + } else { + expandedMiddlewareList.push(...expandRelativeMiddlewareList(entry)); } - const { hostname, method, port, protocol, query } = request2; - let auth = ""; - if (request2.username != null || request2.password != null) { - const username = request2.username ?? ""; - const password = request2.password ?? ""; - auth = `${username}:${password}@`; + }); + expandedMiddlewareList.push(from); + from.after.reverse().forEach((entry) => { + if (entry.before.length === 0 && entry.after.length === 0) { + expandedMiddlewareList.push(entry); + } else { + expandedMiddlewareList.push(...expandRelativeMiddlewareList(entry)); } - const authority = `${protocol}//${auth}${hostname}${port ? `:${port}` : ""}`; - const requestContext = { destination: new URL(authority) }; - const session = this.connectionManager.lease(requestContext, { - requestTimeout: (_a = this.config) == null ? void 0 : _a.sessionTimeout, - disableConcurrentStreams: disableConcurrentStreams || false - }); - const rejectWithDestroy = /* @__PURE__ */ __name((err) => { - if (disableConcurrentStreams) { - this.destroySession(session); - } - fulfilled = true; - reject(err); - }, "rejectWithDestroy"); - const queryString = (0, import_querystring_builder.buildQueryString)(query || {}); - let path = request2.path; - if (queryString) { - path += `?${queryString}`; + }); + return expandedMiddlewareList; + }, "expandRelativeMiddlewareList"); + const getMiddlewareList = /* @__PURE__ */ __name((debug = false) => { + const normalizedAbsoluteEntries = []; + const normalizedRelativeEntries = []; + const normalizedEntriesNameMap = {}; + absoluteEntries.forEach((entry) => { + const normalizedEntry = { + ...entry, + before: [], + after: [] + }; + for (const alias of getAllAliases(normalizedEntry.name, normalizedEntry.aliases)) { + normalizedEntriesNameMap[alias] = normalizedEntry; } - if (request2.fragment) { - path += `#${request2.fragment}`; + normalizedAbsoluteEntries.push(normalizedEntry); + }); + relativeEntries.forEach((entry) => { + const normalizedEntry = { + ...entry, + before: [], + after: [] + }; + for (const alias of getAllAliases(normalizedEntry.name, normalizedEntry.aliases)) { + normalizedEntriesNameMap[alias] = normalizedEntry; } - const req = session.request({ - ...request2.headers, - [import_http22.constants.HTTP2_HEADER_PATH]: path, - [import_http22.constants.HTTP2_HEADER_METHOD]: method - }); - session.ref(); - req.on("response", (headers) => { - const httpResponse = new import_protocol_http.HttpResponse({ - statusCode: headers[":status"] || -1, - headers: getTransformedHeaders(headers), - body: req - }); - fulfilled = true; - resolve({ response: httpResponse }); - if (disableConcurrentStreams) { - session.close(); - this.connectionManager.deleteSession(authority, session); + normalizedRelativeEntries.push(normalizedEntry); + }); + normalizedRelativeEntries.forEach((entry) => { + if (entry.toMiddleware) { + const toMiddleware = normalizedEntriesNameMap[entry.toMiddleware]; + if (toMiddleware === void 0) { + if (debug) { + return; + } + throw new Error( + `${entry.toMiddleware} is not found when adding ${getMiddlewareNameWithAliases(entry.name, entry.aliases)} middleware ${entry.relation} ${entry.toMiddleware}` + ); + } + if (entry.relation === "after") { + toMiddleware.after.push(entry); + } + if (entry.relation === "before") { + toMiddleware.before.push(entry); } - }); - if (requestTimeout) { - req.setTimeout(requestTimeout, () => { - req.close(); - const timeoutError = new Error(`Stream timed out because of no activity for ${requestTimeout} ms`); - timeoutError.name = "TimeoutError"; - rejectWithDestroy(timeoutError); - }); } - if (abortSignal) { - abortSignal.onabort = () => { - req.close(); - const abortError = new Error("Request aborted"); - abortError.name = "AbortError"; - rejectWithDestroy(abortError); - }; + }); + const mainChain = sort(normalizedAbsoluteEntries).map(expandRelativeMiddlewareList).reduce( + (wholeList, expandedMiddlewareList) => { + wholeList.push(...expandedMiddlewareList); + return wholeList; + }, + [] + ); + return mainChain; + }, "getMiddlewareList"); + const stack = { + add: (middleware, options = {}) => { + const { name, override, aliases: _aliases } = options; + const entry = { + step: "initialize", + priority: "normal", + middleware, + ...options + }; + const aliases = getAllAliases(name, _aliases); + if (aliases.length > 0) { + if (aliases.some((alias) => entriesNameSet.has(alias))) { + if (!override) + throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(name, _aliases)}'`); + for (const alias of aliases) { + const toOverrideIndex = absoluteEntries.findIndex( + (entry2) => { + var _a; + return entry2.name === alias || ((_a = entry2.aliases) == null ? void 0 : _a.some((a) => a === alias)); + } + ); + if (toOverrideIndex === -1) { + continue; + } + const toOverride = absoluteEntries[toOverrideIndex]; + if (toOverride.step !== entry.step || entry.priority !== toOverride.priority) { + throw new Error( + `"${getMiddlewareNameWithAliases(toOverride.name, toOverride.aliases)}" middleware with ${toOverride.priority} priority in ${toOverride.step} step cannot be overridden by "${getMiddlewareNameWithAliases(name, _aliases)}" middleware with ${entry.priority} priority in ${entry.step} step.` + ); + } + absoluteEntries.splice(toOverrideIndex, 1); + } + } + for (const alias of aliases) { + entriesNameSet.add(alias); + } } - req.on("frameError", (type, code, id) => { - rejectWithDestroy(new Error(`Frame type id ${type} in stream id ${id} has failed with code ${code}.`)); - }); - req.on("error", rejectWithDestroy); - req.on("aborted", () => { - rejectWithDestroy( - new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${req.rstCode}.`) - ); - }); - req.on("close", () => { - session.unref(); - if (disableConcurrentStreams) { - session.destroy(); + absoluteEntries.push(entry); + }, + addRelativeTo: (middleware, options) => { + const { name, override, aliases: _aliases } = options; + const entry = { + middleware, + ...options + }; + const aliases = getAllAliases(name, _aliases); + if (aliases.length > 0) { + if (aliases.some((alias) => entriesNameSet.has(alias))) { + if (!override) + throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(name, _aliases)}'`); + for (const alias of aliases) { + const toOverrideIndex = relativeEntries.findIndex( + (entry2) => { + var _a; + return entry2.name === alias || ((_a = entry2.aliases) == null ? void 0 : _a.some((a) => a === alias)); + } + ); + if (toOverrideIndex === -1) { + continue; + } + const toOverride = relativeEntries[toOverrideIndex]; + if (toOverride.toMiddleware !== entry.toMiddleware || toOverride.relation !== entry.relation) { + throw new Error( + `"${getMiddlewareNameWithAliases(toOverride.name, toOverride.aliases)}" middleware ${toOverride.relation} "${toOverride.toMiddleware}" middleware cannot be overridden by "${getMiddlewareNameWithAliases(name, _aliases)}" middleware ${entry.relation} "${entry.toMiddleware}" middleware.` + ); + } + relativeEntries.splice(toOverrideIndex, 1); + } } - if (!fulfilled) { - rejectWithDestroy(new Error("Unexpected error: http2 request did not get a response")); + for (const alias of aliases) { + entriesNameSet.add(alias); + } + } + relativeEntries.push(entry); + }, + clone: () => cloneTo(constructStack()), + use: (plugin) => { + plugin.applyToStack(stack); + }, + remove: (toRemove) => { + if (typeof toRemove === "string") + return removeByName(toRemove); + else + return removeByReference(toRemove); + }, + removeByTag: (toRemove) => { + let isRemoved = false; + const filterCb = /* @__PURE__ */ __name((entry) => { + const { tags, name, aliases: _aliases } = entry; + if (tags && tags.includes(toRemove)) { + const aliases = getAllAliases(name, _aliases); + for (const alias of aliases) { + entriesNameSet.delete(alias); + } + isRemoved = true; + return false; } + return true; + }, "filterCb"); + absoluteEntries = absoluteEntries.filter(filterCb); + relativeEntries = relativeEntries.filter(filterCb); + return isRemoved; + }, + concat: (from) => { + var _a; + const cloned = cloneTo(constructStack()); + cloned.use(from); + cloned.identifyOnResolve( + identifyOnResolve || cloned.identifyOnResolve() || (((_a = from.identifyOnResolve) == null ? void 0 : _a.call(from)) ?? false) + ); + return cloned; + }, + applyToStack: cloneTo, + identify: () => { + return getMiddlewareList(true).map((mw) => { + const step = mw.step ?? mw.relation + " " + mw.toMiddleware; + return getMiddlewareNameWithAliases(mw.name, mw.aliases) + " - " + step; }); - writeRequestBodyPromise = writeRequestBody(req, request2, requestTimeout); - }); - } - updateHttpClientConfig(key, value) { - this.config = void 0; - this.configProvider = this.configProvider.then((config) => { - return { - ...config, - [key]: value - }; - }); - } - httpHandlerConfigs() { - return this.config ?? {}; - } - /** - * Destroys a session. - * @param session The session to destroy. - */ - destroySession(session) { - if (!session.destroyed) { - session.destroy(); + }, + identifyOnResolve(toggle) { + if (typeof toggle === "boolean") + identifyOnResolve = toggle; + return identifyOnResolve; + }, + resolve: (handler2, context) => { + for (const middleware of getMiddlewareList().map((entry) => entry.middleware).reverse()) { + handler2 = middleware(handler2, context); + } + if (identifyOnResolve) { + console.log(stack.identify()); + } + return handler2; } - } + }; + return stack; + }, "constructStack"); + var stepWeights = { + initialize: 5, + serialize: 4, + build: 3, + finalizeRequest: 2, + deserialize: 1 }; - __name(_NodeHttp2Handler, "NodeHttp2Handler"); - var NodeHttp2Handler = _NodeHttp2Handler; - var _Collector = class _Collector extends import_stream.Writable { - constructor() { - super(...arguments); - this.bufferedBytes = []; + var priorityWeights = { + high: 3, + normal: 2, + low: 1 + }; + } +}); + +// ../../../node_modules/@smithy/is-array-buffer/dist-cjs/index.js +var require_dist_cjs26 = __commonJS({ + "../../../node_modules/@smithy/is-array-buffer/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - _write(chunk, encoding, callback) { - this.bufferedBytes.push(chunk); - callback(); + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + isArrayBuffer: () => isArrayBuffer + }); + module2.exports = __toCommonJS2(src_exports); + var isArrayBuffer = /* @__PURE__ */ __name((arg) => typeof ArrayBuffer === "function" && arg instanceof ArrayBuffer || Object.prototype.toString.call(arg) === "[object ArrayBuffer]", "isArrayBuffer"); + } +}); + +// ../../../node_modules/@smithy/util-buffer-from/dist-cjs/index.js +var require_dist_cjs27 = __commonJS({ + "../../../node_modules/@smithy/util-buffer-from/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - __name(_Collector, "Collector"); - var Collector = _Collector; - var streamCollector = /* @__PURE__ */ __name((stream) => new Promise((resolve, reject) => { - const collector = new Collector(); - stream.pipe(collector); - stream.on("error", (err) => { - collector.end(); - reject(err); - }); - collector.on("error", reject); - collector.on("finish", function() { - const bytes = new Uint8Array(Buffer.concat(this.bufferedBytes)); - resolve(bytes); - }); - }), "streamCollector"); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + fromArrayBuffer: () => fromArrayBuffer, + fromString: () => fromString + }); + module2.exports = __toCommonJS2(src_exports); + var import_is_array_buffer = require_dist_cjs26(); + var import_buffer = require("buffer"); + var fromArrayBuffer = /* @__PURE__ */ __name((input, offset = 0, length = input.byteLength - offset) => { + if (!(0, import_is_array_buffer.isArrayBuffer)(input)) { + throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof input} (${input})`); + } + return import_buffer.Buffer.from(input, offset, length); + }, "fromArrayBuffer"); + var fromString = /* @__PURE__ */ __name((input, encoding) => { + if (typeof input !== "string") { + throw new TypeError(`The "input" argument must be of type string. Received type ${typeof input} (${input})`); + } + return encoding ? import_buffer.Buffer.from(input, encoding) : import_buffer.Buffer.from(input); + }, "fromString"); } }); -// ../../../node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.js -var require_sdk_stream_mixin = __commonJS({ - "../../../node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.js"(exports2) { +// ../../../node_modules/@smithy/util-base64/dist-cjs/fromBase64.js +var require_fromBase64 = __commonJS({ + "../../../node_modules/@smithy/util-base64/dist-cjs/fromBase64.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.sdkStreamMixin = void 0; - var node_http_handler_1 = require_dist_cjs32(); - var util_buffer_from_1 = require_dist_cjs9(); - var stream_1 = require("stream"); - var util_1 = require("util"); - var ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED = "The stream has already been transformed."; - var sdkStreamMixin2 = (stream) => { - var _a, _b; - if (!(stream instanceof stream_1.Readable)) { - const name = ((_b = (_a = stream === null || stream === void 0 ? void 0 : stream.__proto__) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) || stream; - throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${name}`); + exports2.fromBase64 = void 0; + var util_buffer_from_1 = require_dist_cjs27(); + var BASE64_REGEX = /^[A-Za-z0-9+/]*={0,2}$/; + var fromBase642 = (input) => { + if (input.length * 3 % 4 !== 0) { + throw new TypeError(`Incorrect padding on base64 string.`); } - let transformed = false; - const transformToByteArray = async () => { - if (transformed) { - throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED); - } - transformed = true; - return await (0, node_http_handler_1.streamCollector)(stream); - }; - return Object.assign(stream, { - transformToByteArray, - transformToString: async (encoding) => { - const buf = await transformToByteArray(); - if (encoding === void 0 || Buffer.isEncoding(encoding)) { - return (0, util_buffer_from_1.fromArrayBuffer)(buf.buffer, buf.byteOffset, buf.byteLength).toString(encoding); - } else { - const decoder2 = new util_1.TextDecoder(encoding); - return decoder2.decode(buf); - } - }, - transformToWebStream: () => { - if (transformed) { - throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED); - } - if (stream.readableFlowing !== null) { - throw new Error("The stream has been consumed by other callbacks."); - } - if (typeof stream_1.Readable.toWeb !== "function") { - throw new Error("Readable.toWeb() is not supported. Please make sure you are using Node.js >= 17.0.0, or polyfill is available."); - } - transformed = true; - return stream_1.Readable.toWeb(stream); - } - }); + if (!BASE64_REGEX.exec(input)) { + throw new TypeError(`Invalid base64 string.`); + } + const buffer = (0, util_buffer_from_1.fromString)(input, "base64"); + return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength); }; - exports2.sdkStreamMixin = sdkStreamMixin2; + exports2.fromBase64 = fromBase642; } }); -// ../../../node_modules/@smithy/util-stream/dist-cjs/index.js -var require_dist_cjs33 = __commonJS({ - "../../../node_modules/@smithy/util-stream/dist-cjs/index.js"(exports2, module2) { +// ../../../node_modules/@smithy/util-utf8/dist-cjs/index.js +var require_dist_cjs28 = __commonJS({ + "../../../node_modules/@smithy/util-utf8/dist-cjs/index.js"(exports2, module2) { var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames2 = Object.getOwnPropertyNames; @@ -7638,77 +5462,71 @@ var require_dist_cjs33 = __commonJS({ } return to; }; - var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")); var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var src_exports = {}; __export2(src_exports, { - Uint8ArrayBlobAdapter: () => Uint8ArrayBlobAdapter + fromUtf8: () => fromUtf8, + toUint8Array: () => toUint8Array, + toUtf8: () => toUtf8 }); module2.exports = __toCommonJS2(src_exports); - var import_util_base64 = require_dist_cjs30(); - var import_util_utf8 = require_dist_cjs10(); - function transformToString(payload, encoding = "utf-8") { - if (encoding === "base64") { - return (0, import_util_base64.toBase64)(payload); + var import_util_buffer_from = require_dist_cjs27(); + var fromUtf8 = /* @__PURE__ */ __name((input) => { + const buf = (0, import_util_buffer_from.fromString)(input, "utf8"); + return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength / Uint8Array.BYTES_PER_ELEMENT); + }, "fromUtf8"); + var toUint8Array = /* @__PURE__ */ __name((data) => { + if (typeof data === "string") { + return fromUtf8(data); } - return (0, import_util_utf8.toUtf8)(payload); - } - __name(transformToString, "transformToString"); - function transformFromString(str, encoding) { - if (encoding === "base64") { - return Uint8ArrayBlobAdapter.mutate((0, import_util_base64.fromBase64)(str)); + if (ArrayBuffer.isView(data)) { + return new Uint8Array(data.buffer, data.byteOffset, data.byteLength / Uint8Array.BYTES_PER_ELEMENT); } - return Uint8ArrayBlobAdapter.mutate((0, import_util_utf8.fromUtf8)(str)); - } - __name(transformFromString, "transformFromString"); - var _Uint8ArrayBlobAdapter = class _Uint8ArrayBlobAdapter2 extends Uint8Array { - /** - * @param source - such as a string or Stream. - * @returns a new Uint8ArrayBlobAdapter extending Uint8Array. - */ - static fromString(source, encoding = "utf-8") { - switch (typeof source) { - case "string": - return transformFromString(source, encoding); - default: - throw new Error(`Unsupported conversion from ${typeof source} to Uint8ArrayBlobAdapter.`); - } + return new Uint8Array(data); + }, "toUint8Array"); + var toUtf8 = /* @__PURE__ */ __name((input) => { + if (typeof input === "string") { + return input; } - /** - * @param source - Uint8Array to be mutated. - * @returns the same Uint8Array but with prototype switched to Uint8ArrayBlobAdapter. - */ - static mutate(source) { - Object.setPrototypeOf(source, _Uint8ArrayBlobAdapter2.prototype); - return source; + if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") { + throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array."); } - /** - * @param encoding - default 'utf-8'. - * @returns the blob as string. - */ - transformToString(encoding = "utf-8") { - return transformToString(this, encoding); + return (0, import_util_buffer_from.fromArrayBuffer)(input.buffer, input.byteOffset, input.byteLength).toString("utf8"); + }, "toUtf8"); + } +}); + +// ../../../node_modules/@smithy/util-base64/dist-cjs/toBase64.js +var require_toBase64 = __commonJS({ + "../../../node_modules/@smithy/util-base64/dist-cjs/toBase64.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.toBase64 = void 0; + var util_buffer_from_1 = require_dist_cjs27(); + var util_utf8_1 = require_dist_cjs28(); + var toBase642 = (_input) => { + let input; + if (typeof _input === "string") { + input = (0, util_utf8_1.fromUtf8)(_input); + } else { + input = _input; + } + if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") { + throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array."); } + return (0, util_buffer_from_1.fromArrayBuffer)(input.buffer, input.byteOffset, input.byteLength).toString("base64"); }; - __name(_Uint8ArrayBlobAdapter, "Uint8ArrayBlobAdapter"); - var Uint8ArrayBlobAdapter = _Uint8ArrayBlobAdapter; - __reExport(src_exports, require_getAwsChunkedEncodingStream(), module2.exports); - __reExport(src_exports, require_sdk_stream_mixin(), module2.exports); + exports2.toBase64 = toBase642; } }); -// ../../../node_modules/@smithy/smithy-client/dist-cjs/index.js -var require_dist_cjs34 = __commonJS({ - "../../../node_modules/@smithy/smithy-client/dist-cjs/index.js"(exports2, module2) { +// ../../../node_modules/@smithy/util-base64/dist-cjs/index.js +var require_dist_cjs29 = __commonJS({ + "../../../node_modules/@smithy/util-base64/dist-cjs/index.js"(exports2, module2) { var __defProp2 = Object.defineProperty; var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; var __getOwnPropNames2 = Object.getOwnPropertyNames; var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; var __copyProps2 = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames2(from)) @@ -7717,11293 +5535,13107 @@ var require_dist_cjs34 = __commonJS({ } return to; }; + var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")); var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); var src_exports = {}; - __export2(src_exports, { - Client: () => Client, - Command: () => Command, - LazyJsonString: () => LazyJsonString, - NoOpLogger: () => NoOpLogger, - SENSITIVE_STRING: () => SENSITIVE_STRING, - ServiceException: () => ServiceException, - StringWrapper: () => StringWrapper, - _json: () => _json, - collectBody: () => collectBody, - convertMap: () => convertMap, - createAggregatedClient: () => createAggregatedClient, - dateToUtcString: () => dateToUtcString, - decorateServiceException: () => decorateServiceException, - emitWarningIfUnsupportedVersion: () => emitWarningIfUnsupportedVersion, - expectBoolean: () => expectBoolean, - expectByte: () => expectByte, - expectFloat32: () => expectFloat32, - expectInt: () => expectInt, - expectInt32: () => expectInt32, - expectLong: () => expectLong, - expectNonNull: () => expectNonNull, - expectNumber: () => expectNumber, - expectObject: () => expectObject, - expectShort: () => expectShort, - expectString: () => expectString, - expectUnion: () => expectUnion, - extendedEncodeURIComponent: () => extendedEncodeURIComponent, - getArrayIfSingleItem: () => getArrayIfSingleItem, - getDefaultClientConfiguration: () => getDefaultClientConfiguration, - getDefaultExtensionConfiguration: () => getDefaultExtensionConfiguration, - getValueFromTextNode: () => getValueFromTextNode, - handleFloat: () => handleFloat, - limitedParseDouble: () => limitedParseDouble, - limitedParseFloat: () => limitedParseFloat, - limitedParseFloat32: () => limitedParseFloat32, - loadConfigsForDefaultMode: () => loadConfigsForDefaultMode, - logger: () => logger, - map: () => map, - parseBoolean: () => parseBoolean, - parseEpochTimestamp: () => parseEpochTimestamp, - parseRfc3339DateTime: () => parseRfc3339DateTime, - parseRfc3339DateTimeWithOffset: () => parseRfc3339DateTimeWithOffset, - parseRfc7231DateTime: () => parseRfc7231DateTime, - resolveDefaultRuntimeConfig: () => resolveDefaultRuntimeConfig, - resolvedPath: () => resolvedPath, - serializeFloat: () => serializeFloat, - splitEvery: () => splitEvery, - strictParseByte: () => strictParseByte, - strictParseDouble: () => strictParseDouble, - strictParseFloat: () => strictParseFloat, - strictParseFloat32: () => strictParseFloat32, - strictParseInt: () => strictParseInt, - strictParseInt32: () => strictParseInt32, - strictParseLong: () => strictParseLong, - strictParseShort: () => strictParseShort, - take: () => take, - throwDefaultError: () => throwDefaultError, - withBaseException: () => withBaseException - }); module2.exports = __toCommonJS2(src_exports); - var _NoOpLogger = class _NoOpLogger { - trace() { - } - debug() { - } - info() { - } - warn() { - } - error() { - } - }; - __name(_NoOpLogger, "NoOpLogger"); - var NoOpLogger = _NoOpLogger; - var import_middleware_stack = require_dist_cjs29(); - var _Client = class _Client { - constructor(config) { - this.middlewareStack = (0, import_middleware_stack.constructStack)(); - this.config = config; - } - send(command, optionsOrCb, cb) { - const options = typeof optionsOrCb !== "function" ? optionsOrCb : void 0; - const callback = typeof optionsOrCb === "function" ? optionsOrCb : cb; - const handler2 = command.resolveMiddleware(this.middlewareStack, this.config, options); - if (callback) { - handler2(command).then( - (result) => callback(null, result.output), - (err) => callback(err) - ).catch( - // prevent any errors thrown in the callback from triggering an - // unhandled promise rejection - () => { - } - ); - } else { - return handler2(command).then((result) => result.output); - } - } - destroy() { - if (this.config.requestHandler.destroy) - this.config.requestHandler.destroy(); - } - }; - __name(_Client, "Client"); - var Client = _Client; - var import_util_stream = require_dist_cjs33(); - var collectBody = /* @__PURE__ */ __name(async (streamBody = new Uint8Array(), context) => { - if (streamBody instanceof Uint8Array) { - return import_util_stream.Uint8ArrayBlobAdapter.mutate(streamBody); - } - if (!streamBody) { - return import_util_stream.Uint8ArrayBlobAdapter.mutate(new Uint8Array()); - } - const fromContext = context.streamCollector(streamBody); - return import_util_stream.Uint8ArrayBlobAdapter.mutate(await fromContext); - }, "collectBody"); - var import_types = require_dist_cjs(); - var _Command = class _Command { - constructor() { - this.middlewareStack = (0, import_middleware_stack.constructStack)(); - } - /** - * Factory for Command ClassBuilder. - * @internal - */ - static classBuilder() { - return new ClassBuilder(); - } - /** - * @internal - */ - resolveMiddlewareWithContext(clientStack, configuration, options, { - middlewareFn, - clientName, - commandName, - inputFilterSensitiveLog, - outputFilterSensitiveLog, - smithyContext, - additionalContext, - CommandCtor - }) { - for (const mw of middlewareFn.bind(this)(CommandCtor, clientStack, configuration, options)) { - this.middlewareStack.use(mw); + __reExport(src_exports, require_fromBase64(), module2.exports); + __reExport(src_exports, require_toBase64(), module2.exports); + } +}); + +// ../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/getAwsChunkedEncodingStream.js +var require_getAwsChunkedEncodingStream = __commonJS({ + "../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/getAwsChunkedEncodingStream.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getAwsChunkedEncodingStream = void 0; + var stream_1 = require("stream"); + var getAwsChunkedEncodingStream2 = (readableStream, options) => { + const { base64Encoder, bodyLengthChecker, checksumAlgorithmFn, checksumLocationName, streamHasher } = options; + const checksumRequired = base64Encoder !== void 0 && checksumAlgorithmFn !== void 0 && checksumLocationName !== void 0 && streamHasher !== void 0; + const digest = checksumRequired ? streamHasher(checksumAlgorithmFn, readableStream) : void 0; + const awsChunkedEncodingStream = new stream_1.Readable({ read: () => { + } }); + readableStream.on("data", (data) => { + const length = bodyLengthChecker(data) || 0; + awsChunkedEncodingStream.push(`${length.toString(16)}\r +`); + awsChunkedEncodingStream.push(data); + awsChunkedEncodingStream.push("\r\n"); + }); + readableStream.on("end", async () => { + awsChunkedEncodingStream.push(`0\r +`); + if (checksumRequired) { + const checksum = base64Encoder(await digest); + awsChunkedEncodingStream.push(`${checksumLocationName}:${checksum}\r +`); + awsChunkedEncodingStream.push(`\r +`); } - const stack = clientStack.concat(this.middlewareStack); - const { logger: logger2 } = configuration; - const handlerExecutionContext = { - logger: logger2, - clientName, - commandName, - inputFilterSensitiveLog, - outputFilterSensitiveLog, - [import_types.SMITHY_CONTEXT_KEY]: { - ...smithyContext - }, - ...additionalContext - }; - const { requestHandler } = configuration; - return stack.resolve( - (request2) => requestHandler.handle(request2.request, options || {}), - handlerExecutionContext - ); - } + awsChunkedEncodingStream.push(null); + }); + return awsChunkedEncodingStream; }; - __name(_Command, "Command"); - var Command = _Command; - var _ClassBuilder = class _ClassBuilder { - constructor() { - this._init = () => { - }; - this._ep = {}; - this._middlewareFn = () => []; - this._commandName = ""; - this._clientName = ""; - this._additionalContext = {}; - this._smithyContext = {}; - this._inputFilterSensitiveLog = (_) => _; - this._outputFilterSensitiveLog = (_) => _; - this._serializer = null; - this._deserializer = null; - } - /** - * Optional init callback. - */ - init(cb) { - this._init = cb; + exports2.getAwsChunkedEncodingStream = getAwsChunkedEncodingStream2; + } +}); + +// ../../../node_modules/@smithy/smithy-client/node_modules/@smithy/protocol-http/dist-cjs/index.js +var require_dist_cjs30 = __commonJS({ + "../../../node_modules/@smithy/smithy-client/node_modules/@smithy/protocol-http/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - /** - * Set the endpoint parameter instructions. - */ - ep(endpointParameterInstructions) { - this._ep = endpointParameterInstructions; - return this; + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + Field: () => Field, + Fields: () => Fields, + HttpRequest: () => HttpRequest7, + HttpResponse: () => HttpResponse2, + IHttpRequest: () => import_types5.HttpRequest, + getHttpHandlerExtensionConfiguration: () => getHttpHandlerExtensionConfiguration, + isValidHostname: () => isValidHostname, + resolveHttpHandlerRuntimeConfig: () => resolveHttpHandlerRuntimeConfig + }); + module2.exports = __toCommonJS2(src_exports); + var getHttpHandlerExtensionConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { + let httpHandler = runtimeConfig.httpHandler; + return { + setHttpHandler(handler2) { + httpHandler = handler2; + }, + httpHandler() { + return httpHandler; + }, + updateHttpClientConfig(key, value) { + httpHandler.updateHttpClientConfig(key, value); + }, + httpHandlerConfigs() { + return httpHandler.httpHandlerConfigs(); + } + }; + }, "getHttpHandlerExtensionConfiguration"); + var resolveHttpHandlerRuntimeConfig = /* @__PURE__ */ __name((httpHandlerExtensionConfiguration) => { + return { + httpHandler: httpHandlerExtensionConfiguration.httpHandler() + }; + }, "resolveHttpHandlerRuntimeConfig"); + var import_types5 = require_dist_cjs(); + var _Field = class _Field { + constructor({ name, kind = import_types5.FieldPosition.HEADER, values = [] }) { + this.name = name; + this.kind = kind; + this.values = values; } /** - * Add any number of middleware. + * Appends a value to the field. + * + * @param value The value to append. */ - m(middlewareSupplier) { - this._middlewareFn = middlewareSupplier; - return this; + add(value) { + this.values.push(value); } /** - * Set the initial handler execution context Smithy field. + * Overwrite existing field values. + * + * @param values The new field values. */ - s(service, operation, smithyContext = {}) { - this._smithyContext = { - service, - operation, - ...smithyContext - }; - return this; + set(values) { + this.values = values; } /** - * Set the initial handler execution context. + * Remove all matching entries from list. + * + * @param value Value to remove. */ - c(additionalContext = {}) { - this._additionalContext = additionalContext; - return this; + remove(value) { + this.values = this.values.filter((v) => v !== value); } /** - * Set constant string identifiers for the operation. + * Get comma-delimited string. + * + * @returns String representation of {@link Field}. */ - n(clientName, commandName) { - this._clientName = clientName; - this._commandName = commandName; - return this; + toString() { + return this.values.map((v) => v.includes(",") || v.includes(" ") ? `"${v}"` : v).join(", "); } /** - * Set the input and output sensistive log filters. + * Get string values as a list + * + * @returns Values in {@link Field} as a list. */ - f(inputFilter = (_) => _, outputFilter = (_) => _) { - this._inputFilterSensitiveLog = inputFilter; - this._outputFilterSensitiveLog = outputFilter; - return this; + get() { + return this.values; } - /** - * Sets the serializer. - */ - ser(serializer) { - this._serializer = serializer; - return this; + }; + __name(_Field, "Field"); + var Field = _Field; + var _Fields = class _Fields { + constructor({ fields = [], encoding = "utf-8" }) { + this.entries = {}; + fields.forEach(this.setField.bind(this)); + this.encoding = encoding; } /** - * Sets the deserializer. + * Set entry for a {@link Field} name. The `name` + * attribute will be used to key the collection. + * + * @param field The {@link Field} to set. */ - de(deserializer) { - this._deserializer = deserializer; - return this; + setField(field) { + this.entries[field.name.toLowerCase()] = field; } /** - * @returns a Command class with the classBuilder properties. + * Retrieve {@link Field} entry by name. + * + * @param name The name of the {@link Field} entry + * to retrieve + * @returns The {@link Field} if it exists. */ - build() { - var _a; - const closure = this; - let CommandRef; - return CommandRef = (_a = class extends Command { - /** - * @public - */ - constructor(...[input]) { - super(); - this.serialize = closure._serializer; - this.deserialize = closure._deserializer; - this.input = input ?? {}; - closure._init(this); - } - /** - * @public - */ - static getEndpointParameterInstructions() { - return closure._ep; - } - /** - * @internal - */ - resolveMiddleware(stack, configuration, options) { - return this.resolveMiddlewareWithContext(stack, configuration, options, { - CommandCtor: CommandRef, - middlewareFn: closure._middlewareFn, - clientName: closure._clientName, - commandName: closure._commandName, - inputFilterSensitiveLog: closure._inputFilterSensitiveLog, - outputFilterSensitiveLog: closure._outputFilterSensitiveLog, - smithyContext: closure._smithyContext, - additionalContext: closure._additionalContext - }); - } - }, __name(_a, "CommandRef"), _a); - } - }; - __name(_ClassBuilder, "ClassBuilder"); - var ClassBuilder = _ClassBuilder; - var SENSITIVE_STRING = "***SensitiveInformation***"; - var createAggregatedClient = /* @__PURE__ */ __name((commands, Client2) => { - for (const command of Object.keys(commands)) { - const CommandCtor = commands[command]; - const methodImpl = /* @__PURE__ */ __name(async function(args, optionsOrCb, cb) { - const command2 = new CommandCtor(args); - if (typeof optionsOrCb === "function") { - this.send(command2, optionsOrCb); - } else if (typeof cb === "function") { - if (typeof optionsOrCb !== "object") - throw new Error(`Expected http options but got ${typeof optionsOrCb}`); - this.send(command2, optionsOrCb || {}, cb); - } else { - return this.send(command2, optionsOrCb); - } - }, "methodImpl"); - const methodName = (command[0].toLowerCase() + command.slice(1)).replace(/Command$/, ""); - Client2.prototype[methodName] = methodImpl; - } - }, "createAggregatedClient"); - var parseBoolean = /* @__PURE__ */ __name((value) => { - switch (value) { - case "true": - return true; - case "false": - return false; - default: - throw new Error(`Unable to parse boolean value "${value}"`); - } - }, "parseBoolean"); - var expectBoolean = /* @__PURE__ */ __name((value) => { - if (value === null || value === void 0) { - return void 0; - } - if (typeof value === "number") { - if (value === 0 || value === 1) { - logger.warn(stackTraceWarning(`Expected boolean, got ${typeof value}: ${value}`)); - } - if (value === 0) { - return false; - } - if (value === 1) { - return true; - } - } - if (typeof value === "string") { - const lower = value.toLowerCase(); - if (lower === "false" || lower === "true") { - logger.warn(stackTraceWarning(`Expected boolean, got ${typeof value}: ${value}`)); - } - if (lower === "false") { - return false; - } - if (lower === "true") { - return true; - } - } - if (typeof value === "boolean") { - return value; - } - throw new TypeError(`Expected boolean, got ${typeof value}: ${value}`); - }, "expectBoolean"); - var expectNumber = /* @__PURE__ */ __name((value) => { - if (value === null || value === void 0) { - return void 0; - } - if (typeof value === "string") { - const parsed = parseFloat(value); - if (!Number.isNaN(parsed)) { - if (String(parsed) !== String(value)) { - logger.warn(stackTraceWarning(`Expected number but observed string: ${value}`)); - } - return parsed; - } + getField(name) { + return this.entries[name.toLowerCase()]; } - if (typeof value === "number") { - return value; + /** + * Delete entry from collection. + * + * @param name Name of the entry to delete. + */ + removeField(name) { + delete this.entries[name.toLowerCase()]; } - throw new TypeError(`Expected number, got ${typeof value}: ${value}`); - }, "expectNumber"); - var MAX_FLOAT = Math.ceil(2 ** 127 * (2 - 2 ** -23)); - var expectFloat32 = /* @__PURE__ */ __name((value) => { - const expected = expectNumber(value); - if (expected !== void 0 && !Number.isNaN(expected) && expected !== Infinity && expected !== -Infinity) { - if (Math.abs(expected) > MAX_FLOAT) { - throw new TypeError(`Expected 32-bit float, got ${value}`); - } + /** + * Helper function for retrieving specific types of fields. + * Used to grab all headers or all trailers. + * + * @param kind {@link FieldPosition} of entries to retrieve. + * @returns The {@link Field} entries with the specified + * {@link FieldPosition}. + */ + getByType(kind) { + return Object.values(this.entries).filter((field) => field.kind === kind); } - return expected; - }, "expectFloat32"); - var expectLong = /* @__PURE__ */ __name((value) => { - if (value === null || value === void 0) { - return void 0; + }; + __name(_Fields, "Fields"); + var Fields = _Fields; + var _HttpRequest = class _HttpRequest2 { + constructor(options) { + this.method = options.method || "GET"; + this.hostname = options.hostname || "localhost"; + this.port = options.port; + this.query = options.query || {}; + this.headers = options.headers || {}; + this.body = options.body; + this.protocol = options.protocol ? options.protocol.slice(-1) !== ":" ? `${options.protocol}:` : options.protocol : "https:"; + this.path = options.path ? options.path.charAt(0) !== "/" ? `/${options.path}` : options.path : "/"; + this.username = options.username; + this.password = options.password; + this.fragment = options.fragment; } - if (Number.isInteger(value) && !Number.isNaN(value)) { - return value; + /** + * Note: this does not deep-clone the body. + */ + static clone(request2) { + const cloned = new _HttpRequest2({ + ...request2, + headers: { ...request2.headers } + }); + if (cloned.query) { + cloned.query = cloneQuery(cloned.query); + } + return cloned; } - throw new TypeError(`Expected integer, got ${typeof value}: ${value}`); - }, "expectLong"); - var expectInt = expectLong; - var expectInt32 = /* @__PURE__ */ __name((value) => expectSizedInt(value, 32), "expectInt32"); - var expectShort = /* @__PURE__ */ __name((value) => expectSizedInt(value, 16), "expectShort"); - var expectByte = /* @__PURE__ */ __name((value) => expectSizedInt(value, 8), "expectByte"); - var expectSizedInt = /* @__PURE__ */ __name((value, size) => { - const expected = expectLong(value); - if (expected !== void 0 && castInt(expected, size) !== expected) { - throw new TypeError(`Expected ${size}-bit integer, got ${value}`); + /** + * This method only actually asserts that request is the interface {@link IHttpRequest}, + * and not necessarily this concrete class. Left in place for API stability. + * + * Do not call instance methods on the input of this function, and + * do not assume it has the HttpRequest prototype. + */ + static isInstance(request2) { + if (!request2) { + return false; + } + const req = request2; + return "method" in req && "protocol" in req && "hostname" in req && "path" in req && typeof req["query"] === "object" && typeof req["headers"] === "object"; } - return expected; - }, "expectSizedInt"); - var castInt = /* @__PURE__ */ __name((value, size) => { - switch (size) { - case 32: - return Int32Array.of(value)[0]; - case 16: - return Int16Array.of(value)[0]; - case 8: - return Int8Array.of(value)[0]; + /** + * @deprecated use static HttpRequest.clone(request) instead. It's not safe to call + * this method because {@link HttpRequest.isInstance} incorrectly + * asserts that IHttpRequest (interface) objects are of type HttpRequest (class). + */ + clone() { + return _HttpRequest2.clone(this); } - }, "castInt"); - var expectNonNull = /* @__PURE__ */ __name((value, location) => { - if (value === null || value === void 0) { - if (location) { - throw new TypeError(`Expected a non-null value for ${location}`); - } - throw new TypeError("Expected a non-null value"); + }; + __name(_HttpRequest, "HttpRequest"); + var HttpRequest7 = _HttpRequest; + function cloneQuery(query) { + return Object.keys(query).reduce((carry, paramName) => { + const param = query[paramName]; + return { + ...carry, + [paramName]: Array.isArray(param) ? [...param] : param + }; + }, {}); + } + __name(cloneQuery, "cloneQuery"); + var _HttpResponse = class _HttpResponse { + constructor(options) { + this.statusCode = options.statusCode; + this.reason = options.reason; + this.headers = options.headers || {}; + this.body = options.body; } - return value; - }, "expectNonNull"); - var expectObject = /* @__PURE__ */ __name((value) => { - if (value === null || value === void 0) { - return void 0; + static isInstance(response) { + if (!response) + return false; + const resp = response; + return typeof resp.statusCode === "number" && typeof resp.headers === "object"; } - if (typeof value === "object" && !Array.isArray(value)) { - return value; + }; + __name(_HttpResponse, "HttpResponse"); + var HttpResponse2 = _HttpResponse; + function isValidHostname(hostname) { + const hostPattern = /^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/; + return hostPattern.test(hostname); + } + __name(isValidHostname, "isValidHostname"); + } +}); + +// ../../../node_modules/@smithy/util-uri-escape/dist-cjs/index.js +var require_dist_cjs31 = __commonJS({ + "../../../node_modules/@smithy/util-uri-escape/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - const receivedType = Array.isArray(value) ? "array" : typeof value; - throw new TypeError(`Expected object, got ${receivedType}: ${value}`); - }, "expectObject"); - var expectString = /* @__PURE__ */ __name((value) => { - if (value === null || value === void 0) { - return void 0; + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + escapeUri: () => escapeUri, + escapeUriPath: () => escapeUriPath + }); + module2.exports = __toCommonJS2(src_exports); + var escapeUri = /* @__PURE__ */ __name((uri) => ( + // AWS percent-encodes some extra non-standard characters in a URI + encodeURIComponent(uri).replace(/[!'()*]/g, hexEncode) + ), "escapeUri"); + var hexEncode = /* @__PURE__ */ __name((c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`, "hexEncode"); + var escapeUriPath = /* @__PURE__ */ __name((uri) => uri.split("/").map(escapeUri).join("/"), "escapeUriPath"); + } +}); + +// ../../../node_modules/@smithy/querystring-builder/dist-cjs/index.js +var require_dist_cjs32 = __commonJS({ + "../../../node_modules/@smithy/querystring-builder/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - if (typeof value === "string") { - return value; + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + buildQueryString: () => buildQueryString + }); + module2.exports = __toCommonJS2(src_exports); + var import_util_uri_escape = require_dist_cjs31(); + function buildQueryString(query) { + const parts = []; + for (let key of Object.keys(query).sort()) { + const value = query[key]; + key = (0, import_util_uri_escape.escapeUri)(key); + if (Array.isArray(value)) { + for (let i = 0, iLen = value.length; i < iLen; i++) { + parts.push(`${key}=${(0, import_util_uri_escape.escapeUri)(value[i])}`); + } + } else { + let qsEntry = key; + if (value || typeof value === "string") { + qsEntry += `=${(0, import_util_uri_escape.escapeUri)(value)}`; + } + parts.push(qsEntry); + } } - if (["boolean", "number", "bigint"].includes(typeof value)) { - logger.warn(stackTraceWarning(`Expected string, got ${typeof value}: ${value}`)); - return String(value); + return parts.join("&"); + } + __name(buildQueryString, "buildQueryString"); + } +}); + +// ../../../node_modules/@smithy/smithy-client/node_modules/@smithy/node-http-handler/dist-cjs/index.js +var require_dist_cjs33 = __commonJS({ + "../../../node_modules/@smithy/smithy-client/node_modules/@smithy/node-http-handler/dist-cjs/index.js"(exports2, module2) { + var __create2 = Object.create; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __getProtoOf2 = Object.getPrototypeOf; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - throw new TypeError(`Expected string, got ${typeof value}: ${value}`); - }, "expectString"); - var expectUnion = /* @__PURE__ */ __name((value) => { - if (value === null || value === void 0) { - return void 0; + return to; + }; + var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, + mod + )); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + DEFAULT_REQUEST_TIMEOUT: () => DEFAULT_REQUEST_TIMEOUT, + NodeHttp2Handler: () => NodeHttp2Handler, + NodeHttpHandler: () => NodeHttpHandler, + streamCollector: () => streamCollector + }); + module2.exports = __toCommonJS2(src_exports); + var import_protocol_http8 = require_dist_cjs30(); + var import_querystring_builder = require_dist_cjs32(); + var import_http2 = require("http"); + var import_https = require("https"); + var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "EPIPE", "ETIMEDOUT"]; + var getTransformedHeaders = /* @__PURE__ */ __name((headers) => { + const transformedHeaders = {}; + for (const name of Object.keys(headers)) { + const headerValues = headers[name]; + transformedHeaders[name] = Array.isArray(headerValues) ? headerValues.join(",") : headerValues; } - const asObject = expectObject(value); - const setKeys = Object.entries(asObject).filter(([, v]) => v != null).map(([k]) => k); - if (setKeys.length === 0) { - throw new TypeError(`Unions must have exactly one non-null member. None were found.`); + return transformedHeaders; + }, "getTransformedHeaders"); + var DEFER_EVENT_LISTENER_TIME = 1e3; + var setConnectionTimeout = /* @__PURE__ */ __name((request2, reject, timeoutInMs = 0) => { + if (!timeoutInMs) { + return -1; } - if (setKeys.length > 1) { - throw new TypeError(`Unions must have exactly one non-null member. Keys ${setKeys} were not null.`); + const registerTimeout = /* @__PURE__ */ __name((offset) => { + const timeoutId = setTimeout(() => { + request2.destroy(); + reject( + Object.assign(new Error(`Socket timed out without establishing a connection within ${timeoutInMs} ms`), { + name: "TimeoutError" + }) + ); + }, timeoutInMs - offset); + const doWithSocket = /* @__PURE__ */ __name((socket) => { + if (socket == null ? void 0 : socket.connecting) { + socket.on("connect", () => { + clearTimeout(timeoutId); + }); + } else { + clearTimeout(timeoutId); + } + }, "doWithSocket"); + if (request2.socket) { + doWithSocket(request2.socket); + } else { + request2.on("socket", doWithSocket); + } + }, "registerTimeout"); + if (timeoutInMs < 2e3) { + registerTimeout(0); + return 0; } - return asObject; - }, "expectUnion"); - var strictParseDouble = /* @__PURE__ */ __name((value) => { - if (typeof value == "string") { - return expectNumber(parseNumber(value)); + return setTimeout(registerTimeout.bind(null, DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME); + }, "setConnectionTimeout"); + var DEFER_EVENT_LISTENER_TIME2 = 3e3; + var setSocketKeepAlive = /* @__PURE__ */ __name((request2, { keepAlive, keepAliveMsecs }, deferTimeMs = DEFER_EVENT_LISTENER_TIME2) => { + if (keepAlive !== true) { + return -1; } - return expectNumber(value); - }, "strictParseDouble"); - var strictParseFloat = strictParseDouble; - var strictParseFloat32 = /* @__PURE__ */ __name((value) => { - if (typeof value == "string") { - return expectFloat32(parseNumber(value)); + const registerListener = /* @__PURE__ */ __name(() => { + if (request2.socket) { + request2.socket.setKeepAlive(keepAlive, keepAliveMsecs || 0); + } else { + request2.on("socket", (socket) => { + socket.setKeepAlive(keepAlive, keepAliveMsecs || 0); + }); + } + }, "registerListener"); + if (deferTimeMs === 0) { + registerListener(); + return 0; } - return expectFloat32(value); - }, "strictParseFloat32"); - var NUMBER_REGEX = /(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g; - var parseNumber = /* @__PURE__ */ __name((value) => { - const matches = value.match(NUMBER_REGEX); - if (matches === null || matches[0].length !== value.length) { - throw new TypeError(`Expected real number, got implicit NaN`); + return setTimeout(registerListener, deferTimeMs); + }, "setSocketKeepAlive"); + var DEFER_EVENT_LISTENER_TIME3 = 3e3; + var setSocketTimeout = /* @__PURE__ */ __name((request2, reject, timeoutInMs = 0) => { + const registerTimeout = /* @__PURE__ */ __name((offset) => { + request2.setTimeout(timeoutInMs - offset, () => { + request2.destroy(); + reject(Object.assign(new Error(`Connection timed out after ${timeoutInMs} ms`), { name: "TimeoutError" })); + }); + }, "registerTimeout"); + if (0 < timeoutInMs && timeoutInMs < 6e3) { + registerTimeout(0); + return 0; } - return parseFloat(value); - }, "parseNumber"); - var limitedParseDouble = /* @__PURE__ */ __name((value) => { - if (typeof value == "string") { - return parseFloatString(value); + return setTimeout( + registerTimeout.bind(null, timeoutInMs === 0 ? 0 : DEFER_EVENT_LISTENER_TIME3), + DEFER_EVENT_LISTENER_TIME3 + ); + }, "setSocketTimeout"); + var import_stream = require("stream"); + var MIN_WAIT_TIME = 1e3; + async function writeRequestBody(httpRequest, request2, maxContinueTimeoutMs = MIN_WAIT_TIME) { + const headers = request2.headers ?? {}; + const expect = headers["Expect"] || headers["expect"]; + let timeoutId = -1; + let hasError = false; + if (expect === "100-continue") { + await Promise.race([ + new Promise((resolve) => { + timeoutId = Number(setTimeout(resolve, Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs))); + }), + new Promise((resolve) => { + httpRequest.on("continue", () => { + clearTimeout(timeoutId); + resolve(); + }); + httpRequest.on("error", () => { + hasError = true; + clearTimeout(timeoutId); + resolve(); + }); + }) + ]); } - return expectNumber(value); - }, "limitedParseDouble"); - var handleFloat = limitedParseDouble; - var limitedParseFloat = limitedParseDouble; - var limitedParseFloat32 = /* @__PURE__ */ __name((value) => { - if (typeof value == "string") { - return parseFloatString(value); + if (!hasError) { + writeBody(httpRequest, request2.body); } - return expectFloat32(value); - }, "limitedParseFloat32"); - var parseFloatString = /* @__PURE__ */ __name((value) => { - switch (value) { - case "NaN": - return NaN; - case "Infinity": - return Infinity; - case "-Infinity": - return -Infinity; - default: - throw new Error(`Unable to parse float value: ${value}`); + } + __name(writeRequestBody, "writeRequestBody"); + function writeBody(httpRequest, body) { + if (body instanceof import_stream.Readable) { + body.pipe(httpRequest); + return; } - }, "parseFloatString"); - var strictParseLong = /* @__PURE__ */ __name((value) => { - if (typeof value === "string") { - return expectLong(parseNumber(value)); + if (body) { + if (Buffer.isBuffer(body) || typeof body === "string") { + httpRequest.end(body); + return; + } + const uint8 = body; + if (typeof uint8 === "object" && uint8.buffer && typeof uint8.byteOffset === "number" && typeof uint8.byteLength === "number") { + httpRequest.end(Buffer.from(uint8.buffer, uint8.byteOffset, uint8.byteLength)); + return; + } + httpRequest.end(Buffer.from(body)); + return; } - return expectLong(value); - }, "strictParseLong"); - var strictParseInt = strictParseLong; - var strictParseInt32 = /* @__PURE__ */ __name((value) => { - if (typeof value === "string") { - return expectInt32(parseNumber(value)); + httpRequest.end(); + } + __name(writeBody, "writeBody"); + var DEFAULT_REQUEST_TIMEOUT = 0; + var _NodeHttpHandler = class _NodeHttpHandler2 { + constructor(options) { + this.socketWarningTimestamp = 0; + this.metadata = { handlerProtocol: "http/1.1" }; + this.configProvider = new Promise((resolve, reject) => { + if (typeof options === "function") { + options().then((_options) => { + resolve(this.resolveDefaultConfig(_options)); + }).catch(reject); + } else { + resolve(this.resolveDefaultConfig(options)); + } + }); } - return expectInt32(value); - }, "strictParseInt32"); - var strictParseShort = /* @__PURE__ */ __name((value) => { - if (typeof value === "string") { - return expectShort(parseNumber(value)); + /** + * @returns the input if it is an HttpHandler of any class, + * or instantiates a new instance of this handler. + */ + static create(instanceOrOptions) { + if (typeof (instanceOrOptions == null ? void 0 : instanceOrOptions.handle) === "function") { + return instanceOrOptions; + } + return new _NodeHttpHandler2(instanceOrOptions); } - return expectShort(value); - }, "strictParseShort"); - var strictParseByte = /* @__PURE__ */ __name((value) => { - if (typeof value === "string") { - return expectByte(parseNumber(value)); + /** + * @internal + * + * @param agent - http(s) agent in use by the NodeHttpHandler instance. + * @param socketWarningTimestamp - last socket usage check timestamp. + * @param logger - channel for the warning. + * @returns timestamp of last emitted warning. + */ + static checkSocketUsage(agent, socketWarningTimestamp, logger = console) { + var _a, _b, _c; + const { sockets, requests, maxSockets } = agent; + if (typeof maxSockets !== "number" || maxSockets === Infinity) { + return socketWarningTimestamp; + } + const interval = 15e3; + if (Date.now() - interval < socketWarningTimestamp) { + return socketWarningTimestamp; + } + if (sockets && requests) { + for (const origin in sockets) { + const socketsInUse = ((_a = sockets[origin]) == null ? void 0 : _a.length) ?? 0; + const requestsEnqueued = ((_b = requests[origin]) == null ? void 0 : _b.length) ?? 0; + if (socketsInUse >= maxSockets && requestsEnqueued >= 2 * maxSockets) { + (_c = logger == null ? void 0 : logger.warn) == null ? void 0 : _c.call( + logger, + `@smithy/node-http-handler:WARN - socket usage at capacity=${socketsInUse} and ${requestsEnqueued} additional requests are enqueued. +See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html +or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.` + ); + return Date.now(); + } + } + } + return socketWarningTimestamp; } - return expectByte(value); - }, "strictParseByte"); - var stackTraceWarning = /* @__PURE__ */ __name((message) => { - return String(new TypeError(message).stack || message).split("\n").slice(0, 5).filter((s) => !s.includes("stackTraceWarning")).join("\n"); - }, "stackTraceWarning"); - var logger = { - warn: console.warn - }; - var DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; - var MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; - function dateToUtcString(date) { - const year = date.getUTCFullYear(); - const month = date.getUTCMonth(); - const dayOfWeek = date.getUTCDay(); - const dayOfMonthInt = date.getUTCDate(); - const hoursInt = date.getUTCHours(); - const minutesInt = date.getUTCMinutes(); - const secondsInt = date.getUTCSeconds(); - const dayOfMonthString = dayOfMonthInt < 10 ? `0${dayOfMonthInt}` : `${dayOfMonthInt}`; - const hoursString = hoursInt < 10 ? `0${hoursInt}` : `${hoursInt}`; - const minutesString = minutesInt < 10 ? `0${minutesInt}` : `${minutesInt}`; - const secondsString = secondsInt < 10 ? `0${secondsInt}` : `${secondsInt}`; - return `${DAYS[dayOfWeek]}, ${dayOfMonthString} ${MONTHS[month]} ${year} ${hoursString}:${minutesString}:${secondsString} GMT`; - } - __name(dateToUtcString, "dateToUtcString"); - var RFC3339 = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/); - var parseRfc3339DateTime = /* @__PURE__ */ __name((value) => { - if (value === null || value === void 0) { - return void 0; + resolveDefaultConfig(options) { + const { requestTimeout, connectionTimeout, socketTimeout, httpAgent, httpsAgent } = options || {}; + const keepAlive = true; + const maxSockets = 50; + return { + connectionTimeout, + requestTimeout: requestTimeout ?? socketTimeout, + httpAgent: (() => { + if (httpAgent instanceof import_http2.Agent || typeof (httpAgent == null ? void 0 : httpAgent.destroy) === "function") { + return httpAgent; + } + return new import_http2.Agent({ keepAlive, maxSockets, ...httpAgent }); + })(), + httpsAgent: (() => { + if (httpsAgent instanceof import_https.Agent || typeof (httpsAgent == null ? void 0 : httpsAgent.destroy) === "function") { + return httpsAgent; + } + return new import_https.Agent({ keepAlive, maxSockets, ...httpsAgent }); + })(), + logger: console + }; } - if (typeof value !== "string") { - throw new TypeError("RFC-3339 date-times must be expressed as strings"); + destroy() { + var _a, _b, _c, _d; + (_b = (_a = this.config) == null ? void 0 : _a.httpAgent) == null ? void 0 : _b.destroy(); + (_d = (_c = this.config) == null ? void 0 : _c.httpsAgent) == null ? void 0 : _d.destroy(); } - const match = RFC3339.exec(value); - if (!match) { - throw new TypeError("Invalid RFC-3339 date-time value"); + async handle(request2, { abortSignal } = {}) { + if (!this.config) { + this.config = await this.configProvider; + } + return new Promise((_resolve, _reject) => { + let writeRequestBodyPromise = void 0; + const timeouts = []; + const resolve = /* @__PURE__ */ __name(async (arg) => { + await writeRequestBodyPromise; + timeouts.forEach(clearTimeout); + _resolve(arg); + }, "resolve"); + const reject = /* @__PURE__ */ __name(async (arg) => { + await writeRequestBodyPromise; + timeouts.forEach(clearTimeout); + _reject(arg); + }, "reject"); + if (!this.config) { + throw new Error("Node HTTP request handler config is not resolved"); + } + if (abortSignal == null ? void 0 : abortSignal.aborted) { + const abortError = new Error("Request aborted"); + abortError.name = "AbortError"; + reject(abortError); + return; + } + const isSSL = request2.protocol === "https:"; + const agent = isSSL ? this.config.httpsAgent : this.config.httpAgent; + timeouts.push( + setTimeout( + () => { + this.socketWarningTimestamp = _NodeHttpHandler2.checkSocketUsage( + agent, + this.socketWarningTimestamp, + this.config.logger + ); + }, + this.config.socketAcquisitionWarningTimeout ?? (this.config.requestTimeout ?? 2e3) + (this.config.connectionTimeout ?? 1e3) + ) + ); + const queryString = (0, import_querystring_builder.buildQueryString)(request2.query || {}); + let auth = void 0; + if (request2.username != null || request2.password != null) { + const username = request2.username ?? ""; + const password = request2.password ?? ""; + auth = `${username}:${password}`; + } + let path = request2.path; + if (queryString) { + path += `?${queryString}`; + } + if (request2.fragment) { + path += `#${request2.fragment}`; + } + let hostname = request2.hostname ?? ""; + if (hostname[0] === "[" && hostname.endsWith("]")) { + hostname = request2.hostname.slice(1, -1); + } else { + hostname = request2.hostname; + } + const nodeHttpsOptions = { + headers: request2.headers, + host: hostname, + method: request2.method, + path, + port: request2.port, + agent, + auth + }; + const requestFunc = isSSL ? import_https.request : import_http2.request; + const req = requestFunc(nodeHttpsOptions, (res) => { + const httpResponse = new import_protocol_http8.HttpResponse({ + statusCode: res.statusCode || -1, + reason: res.statusMessage, + headers: getTransformedHeaders(res.headers), + body: res + }); + resolve({ response: httpResponse }); + }); + req.on("error", (err) => { + if (NODEJS_TIMEOUT_ERROR_CODES.includes(err.code)) { + reject(Object.assign(err, { name: "TimeoutError" })); + } else { + reject(err); + } + }); + if (abortSignal) { + const onAbort = /* @__PURE__ */ __name(() => { + req.destroy(); + const abortError = new Error("Request aborted"); + abortError.name = "AbortError"; + reject(abortError); + }, "onAbort"); + if (typeof abortSignal.addEventListener === "function") { + const signal = abortSignal; + signal.addEventListener("abort", onAbort, { once: true }); + req.once("close", () => signal.removeEventListener("abort", onAbort)); + } else { + abortSignal.onabort = onAbort; + } + } + timeouts.push(setConnectionTimeout(req, reject, this.config.connectionTimeout)); + timeouts.push(setSocketTimeout(req, reject, this.config.requestTimeout)); + const httpAgent = nodeHttpsOptions.agent; + if (typeof httpAgent === "object" && "keepAlive" in httpAgent) { + timeouts.push( + setSocketKeepAlive(req, { + // @ts-expect-error keepAlive is not public on httpAgent. + keepAlive: httpAgent.keepAlive, + // @ts-expect-error keepAliveMsecs is not public on httpAgent. + keepAliveMsecs: httpAgent.keepAliveMsecs + }) + ); + } + writeRequestBodyPromise = writeRequestBody(req, request2, this.config.requestTimeout).catch((e) => { + timeouts.forEach(clearTimeout); + return _reject(e); + }); + }); } - const [_, yearStr, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds] = match; - const year = strictParseShort(stripLeadingZeroes(yearStr)); - const month = parseDateValue(monthStr, "month", 1, 12); - const day = parseDateValue(dayStr, "day", 1, 31); - return buildDate(year, month, day, { hours, minutes, seconds, fractionalMilliseconds }); - }, "parseRfc3339DateTime"); - var RFC3339_WITH_OFFSET = new RegExp( - /^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/ - ); - var parseRfc3339DateTimeWithOffset = /* @__PURE__ */ __name((value) => { - if (value === null || value === void 0) { - return void 0; + updateHttpClientConfig(key, value) { + this.config = void 0; + this.configProvider = this.configProvider.then((config) => { + return { + ...config, + [key]: value + }; + }); } - if (typeof value !== "string") { - throw new TypeError("RFC-3339 date-times must be expressed as strings"); + httpHandlerConfigs() { + return this.config ?? {}; } - const match = RFC3339_WITH_OFFSET.exec(value); - if (!match) { - throw new TypeError("Invalid RFC-3339 date-time value"); + }; + __name(_NodeHttpHandler, "NodeHttpHandler"); + var NodeHttpHandler = _NodeHttpHandler; + var import_http22 = require("http2"); + var import_http23 = __toESM2(require("http2")); + var _NodeHttp2ConnectionPool = class _NodeHttp2ConnectionPool { + constructor(sessions) { + this.sessions = []; + this.sessions = sessions ?? []; } - const [_, yearStr, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds, offsetStr] = match; - const year = strictParseShort(stripLeadingZeroes(yearStr)); - const month = parseDateValue(monthStr, "month", 1, 12); - const day = parseDateValue(dayStr, "day", 1, 31); - const date = buildDate(year, month, day, { hours, minutes, seconds, fractionalMilliseconds }); - if (offsetStr.toUpperCase() != "Z") { - date.setTime(date.getTime() - parseOffsetToMilliseconds(offsetStr)); + poll() { + if (this.sessions.length > 0) { + return this.sessions.shift(); + } } - return date; - }, "parseRfc3339DateTimeWithOffset"); - var IMF_FIXDATE = new RegExp( - /^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/ - ); - var RFC_850_DATE = new RegExp( - /^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/ - ); - var ASC_TIME = new RegExp( - /^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/ - ); - var parseRfc7231DateTime = /* @__PURE__ */ __name((value) => { - if (value === null || value === void 0) { - return void 0; + offerLast(session) { + this.sessions.push(session); } - if (typeof value !== "string") { - throw new TypeError("RFC-7231 date-times must be expressed as strings"); + contains(session) { + return this.sessions.includes(session); } - let match = IMF_FIXDATE.exec(value); - if (match) { - const [_, dayStr, monthStr, yearStr, hours, minutes, seconds, fractionalMilliseconds] = match; - return buildDate( - strictParseShort(stripLeadingZeroes(yearStr)), - parseMonthByShortName(monthStr), - parseDateValue(dayStr, "day", 1, 31), - { hours, minutes, seconds, fractionalMilliseconds } - ); + remove(session) { + this.sessions = this.sessions.filter((s) => s !== session); } - match = RFC_850_DATE.exec(value); - if (match) { - const [_, dayStr, monthStr, yearStr, hours, minutes, seconds, fractionalMilliseconds] = match; - return adjustRfc850Year( - buildDate(parseTwoDigitYear(yearStr), parseMonthByShortName(monthStr), parseDateValue(dayStr, "day", 1, 31), { - hours, - minutes, - seconds, - fractionalMilliseconds - }) - ); + [Symbol.iterator]() { + return this.sessions[Symbol.iterator](); } - match = ASC_TIME.exec(value); - if (match) { - const [_, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds, yearStr] = match; - return buildDate( - strictParseShort(stripLeadingZeroes(yearStr)), - parseMonthByShortName(monthStr), - parseDateValue(dayStr.trimLeft(), "day", 1, 31), - { hours, minutes, seconds, fractionalMilliseconds } - ); + destroy(connection) { + for (const session of this.sessions) { + if (session === connection) { + if (!session.destroyed) { + session.destroy(); + } + } + } } - throw new TypeError("Invalid RFC-7231 date-time value"); - }, "parseRfc7231DateTime"); - var parseEpochTimestamp = /* @__PURE__ */ __name((value) => { - if (value === null || value === void 0) { - return void 0; + }; + __name(_NodeHttp2ConnectionPool, "NodeHttp2ConnectionPool"); + var NodeHttp2ConnectionPool = _NodeHttp2ConnectionPool; + var _NodeHttp2ConnectionManager = class _NodeHttp2ConnectionManager { + constructor(config) { + this.sessionCache = /* @__PURE__ */ new Map(); + this.config = config; + if (this.config.maxConcurrency && this.config.maxConcurrency <= 0) { + throw new RangeError("maxConcurrency must be greater than zero."); + } } - let valueAsDouble; - if (typeof value === "number") { - valueAsDouble = value; - } else if (typeof value === "string") { - valueAsDouble = strictParseDouble(value); - } else { - throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation"); + lease(requestContext, connectionConfiguration) { + const url2 = this.getUrlString(requestContext); + const existingPool = this.sessionCache.get(url2); + if (existingPool) { + const existingSession = existingPool.poll(); + if (existingSession && !this.config.disableConcurrency) { + return existingSession; + } + } + const session = import_http23.default.connect(url2); + if (this.config.maxConcurrency) { + session.settings({ maxConcurrentStreams: this.config.maxConcurrency }, (err) => { + if (err) { + throw new Error( + "Fail to set maxConcurrentStreams to " + this.config.maxConcurrency + "when creating new session for " + requestContext.destination.toString() + ); + } + }); + } + session.unref(); + const destroySessionCb = /* @__PURE__ */ __name(() => { + session.destroy(); + this.deleteSession(url2, session); + }, "destroySessionCb"); + session.on("goaway", destroySessionCb); + session.on("error", destroySessionCb); + session.on("frameError", destroySessionCb); + session.on("close", () => this.deleteSession(url2, session)); + if (connectionConfiguration.requestTimeout) { + session.setTimeout(connectionConfiguration.requestTimeout, destroySessionCb); + } + const connectionPool = this.sessionCache.get(url2) || new NodeHttp2ConnectionPool(); + connectionPool.offerLast(session); + this.sessionCache.set(url2, connectionPool); + return session; } - if (Number.isNaN(valueAsDouble) || valueAsDouble === Infinity || valueAsDouble === -Infinity) { - throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics"); + /** + * Delete a session from the connection pool. + * @param authority The authority of the session to delete. + * @param session The session to delete. + */ + deleteSession(authority, session) { + const existingConnectionPool = this.sessionCache.get(authority); + if (!existingConnectionPool) { + return; + } + if (!existingConnectionPool.contains(session)) { + return; + } + existingConnectionPool.remove(session); + this.sessionCache.set(authority, existingConnectionPool); } - return new Date(Math.round(valueAsDouble * 1e3)); - }, "parseEpochTimestamp"); - var buildDate = /* @__PURE__ */ __name((year, month, day, time) => { - const adjustedMonth = month - 1; - validateDayOfMonth(year, adjustedMonth, day); - return new Date( - Date.UTC( - year, - adjustedMonth, - day, - parseDateValue(time.hours, "hour", 0, 23), - parseDateValue(time.minutes, "minute", 0, 59), - // seconds can go up to 60 for leap seconds - parseDateValue(time.seconds, "seconds", 0, 60), - parseMilliseconds(time.fractionalMilliseconds) - ) - ); - }, "buildDate"); - var parseTwoDigitYear = /* @__PURE__ */ __name((value) => { - const thisYear = (/* @__PURE__ */ new Date()).getUTCFullYear(); - const valueInThisCentury = Math.floor(thisYear / 100) * 100 + strictParseShort(stripLeadingZeroes(value)); - if (valueInThisCentury < thisYear) { - return valueInThisCentury + 100; + release(requestContext, session) { + var _a; + const cacheKey = this.getUrlString(requestContext); + (_a = this.sessionCache.get(cacheKey)) == null ? void 0 : _a.offerLast(session); } - return valueInThisCentury; - }, "parseTwoDigitYear"); - var FIFTY_YEARS_IN_MILLIS = 50 * 365 * 24 * 60 * 60 * 1e3; - var adjustRfc850Year = /* @__PURE__ */ __name((input) => { - if (input.getTime() - (/* @__PURE__ */ new Date()).getTime() > FIFTY_YEARS_IN_MILLIS) { - return new Date( - Date.UTC( - input.getUTCFullYear() - 100, - input.getUTCMonth(), - input.getUTCDate(), - input.getUTCHours(), - input.getUTCMinutes(), - input.getUTCSeconds(), - input.getUTCMilliseconds() - ) - ); + destroy() { + for (const [key, connectionPool] of this.sessionCache) { + for (const session of connectionPool) { + if (!session.destroyed) { + session.destroy(); + } + connectionPool.remove(session); + } + this.sessionCache.delete(key); + } } - return input; - }, "adjustRfc850Year"); - var parseMonthByShortName = /* @__PURE__ */ __name((value) => { - const monthIdx = MONTHS.indexOf(value); - if (monthIdx < 0) { - throw new TypeError(`Invalid month: ${value}`); + setMaxConcurrentStreams(maxConcurrentStreams) { + if (this.config.maxConcurrency && this.config.maxConcurrency <= 0) { + throw new RangeError("maxConcurrentStreams must be greater than zero."); + } + this.config.maxConcurrency = maxConcurrentStreams; } - return monthIdx + 1; - }, "parseMonthByShortName"); - var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; - var validateDayOfMonth = /* @__PURE__ */ __name((year, month, day) => { - let maxDays = DAYS_IN_MONTH[month]; - if (month === 1 && isLeapYear(year)) { - maxDays = 29; + setDisableConcurrentStreams(disableConcurrentStreams) { + this.config.disableConcurrency = disableConcurrentStreams; } - if (day > maxDays) { - throw new TypeError(`Invalid day for ${MONTHS[month]} in ${year}: ${day}`); + getUrlString(request2) { + return request2.destination.toString(); } - }, "validateDayOfMonth"); - var isLeapYear = /* @__PURE__ */ __name((year) => { - return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); - }, "isLeapYear"); - var parseDateValue = /* @__PURE__ */ __name((value, type, lower, upper) => { - const dateVal = strictParseByte(stripLeadingZeroes(value)); - if (dateVal < lower || dateVal > upper) { - throw new TypeError(`${type} must be between ${lower} and ${upper}, inclusive`); + }; + __name(_NodeHttp2ConnectionManager, "NodeHttp2ConnectionManager"); + var NodeHttp2ConnectionManager = _NodeHttp2ConnectionManager; + var _NodeHttp2Handler = class _NodeHttp2Handler2 { + constructor(options) { + this.metadata = { handlerProtocol: "h2" }; + this.connectionManager = new NodeHttp2ConnectionManager({}); + this.configProvider = new Promise((resolve, reject) => { + if (typeof options === "function") { + options().then((opts) => { + resolve(opts || {}); + }).catch(reject); + } else { + resolve(options || {}); + } + }); } - return dateVal; - }, "parseDateValue"); - var parseMilliseconds = /* @__PURE__ */ __name((value) => { - if (value === null || value === void 0) { - return 0; + /** + * @returns the input if it is an HttpHandler of any class, + * or instantiates a new instance of this handler. + */ + static create(instanceOrOptions) { + if (typeof (instanceOrOptions == null ? void 0 : instanceOrOptions.handle) === "function") { + return instanceOrOptions; + } + return new _NodeHttp2Handler2(instanceOrOptions); } - return strictParseFloat32("0." + value) * 1e3; - }, "parseMilliseconds"); - var parseOffsetToMilliseconds = /* @__PURE__ */ __name((value) => { - const directionStr = value[0]; - let direction = 1; - if (directionStr == "+") { - direction = 1; - } else if (directionStr == "-") { - direction = -1; - } else { - throw new TypeError(`Offset direction, ${directionStr}, must be "+" or "-"`); + destroy() { + this.connectionManager.destroy(); + } + async handle(request2, { abortSignal } = {}) { + if (!this.config) { + this.config = await this.configProvider; + this.connectionManager.setDisableConcurrentStreams(this.config.disableConcurrentStreams || false); + if (this.config.maxConcurrentStreams) { + this.connectionManager.setMaxConcurrentStreams(this.config.maxConcurrentStreams); + } + } + const { requestTimeout, disableConcurrentStreams } = this.config; + return new Promise((_resolve, _reject) => { + var _a; + let fulfilled = false; + let writeRequestBodyPromise = void 0; + const resolve = /* @__PURE__ */ __name(async (arg) => { + await writeRequestBodyPromise; + _resolve(arg); + }, "resolve"); + const reject = /* @__PURE__ */ __name(async (arg) => { + await writeRequestBodyPromise; + _reject(arg); + }, "reject"); + if (abortSignal == null ? void 0 : abortSignal.aborted) { + fulfilled = true; + const abortError = new Error("Request aborted"); + abortError.name = "AbortError"; + reject(abortError); + return; + } + const { hostname, method, port, protocol, query } = request2; + let auth = ""; + if (request2.username != null || request2.password != null) { + const username = request2.username ?? ""; + const password = request2.password ?? ""; + auth = `${username}:${password}@`; + } + const authority = `${protocol}//${auth}${hostname}${port ? `:${port}` : ""}`; + const requestContext = { destination: new URL(authority) }; + const session = this.connectionManager.lease(requestContext, { + requestTimeout: (_a = this.config) == null ? void 0 : _a.sessionTimeout, + disableConcurrentStreams: disableConcurrentStreams || false + }); + const rejectWithDestroy = /* @__PURE__ */ __name((err) => { + if (disableConcurrentStreams) { + this.destroySession(session); + } + fulfilled = true; + reject(err); + }, "rejectWithDestroy"); + const queryString = (0, import_querystring_builder.buildQueryString)(query || {}); + let path = request2.path; + if (queryString) { + path += `?${queryString}`; + } + if (request2.fragment) { + path += `#${request2.fragment}`; + } + const req = session.request({ + ...request2.headers, + [import_http22.constants.HTTP2_HEADER_PATH]: path, + [import_http22.constants.HTTP2_HEADER_METHOD]: method + }); + session.ref(); + req.on("response", (headers) => { + const httpResponse = new import_protocol_http8.HttpResponse({ + statusCode: headers[":status"] || -1, + headers: getTransformedHeaders(headers), + body: req + }); + fulfilled = true; + resolve({ response: httpResponse }); + if (disableConcurrentStreams) { + session.close(); + this.connectionManager.deleteSession(authority, session); + } + }); + if (requestTimeout) { + req.setTimeout(requestTimeout, () => { + req.close(); + const timeoutError = new Error(`Stream timed out because of no activity for ${requestTimeout} ms`); + timeoutError.name = "TimeoutError"; + rejectWithDestroy(timeoutError); + }); + } + if (abortSignal) { + const onAbort = /* @__PURE__ */ __name(() => { + req.close(); + const abortError = new Error("Request aborted"); + abortError.name = "AbortError"; + rejectWithDestroy(abortError); + }, "onAbort"); + if (typeof abortSignal.addEventListener === "function") { + const signal = abortSignal; + signal.addEventListener("abort", onAbort, { once: true }); + req.once("close", () => signal.removeEventListener("abort", onAbort)); + } else { + abortSignal.onabort = onAbort; + } + } + req.on("frameError", (type, code, id) => { + rejectWithDestroy(new Error(`Frame type id ${type} in stream id ${id} has failed with code ${code}.`)); + }); + req.on("error", rejectWithDestroy); + req.on("aborted", () => { + rejectWithDestroy( + new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${req.rstCode}.`) + ); + }); + req.on("close", () => { + session.unref(); + if (disableConcurrentStreams) { + session.destroy(); + } + if (!fulfilled) { + rejectWithDestroy(new Error("Unexpected error: http2 request did not get a response")); + } + }); + writeRequestBodyPromise = writeRequestBody(req, request2, requestTimeout); + }); } - const hour = Number(value.substring(1, 3)); - const minute = Number(value.substring(4, 6)); - return direction * (hour * 60 + minute) * 60 * 1e3; - }, "parseOffsetToMilliseconds"); - var stripLeadingZeroes = /* @__PURE__ */ __name((value) => { - let idx = 0; - while (idx < value.length - 1 && value.charAt(idx) === "0") { - idx++; + updateHttpClientConfig(key, value) { + this.config = void 0; + this.configProvider = this.configProvider.then((config) => { + return { + ...config, + [key]: value + }; + }); } - if (idx === 0) { - return value; + httpHandlerConfigs() { + return this.config ?? {}; } - return value.slice(idx); - }, "stripLeadingZeroes"); - var _ServiceException = class _ServiceException2 extends Error { - constructor(options) { - super(options.message); - Object.setPrototypeOf(this, _ServiceException2.prototype); - this.name = options.name; - this.$fault = options.$fault; - this.$metadata = options.$metadata; + /** + * Destroys a session. + * @param session The session to destroy. + */ + destroySession(session) { + if (!session.destroyed) { + session.destroy(); + } } }; - __name(_ServiceException, "ServiceException"); - var ServiceException = _ServiceException; - var decorateServiceException = /* @__PURE__ */ __name((exception, additions = {}) => { - Object.entries(additions).filter(([, v]) => v !== void 0).forEach(([k, v]) => { - if (exception[k] == void 0 || exception[k] === "") { - exception[k] = v; - } - }); - const message = exception.message || exception.Message || "UnknownError"; - exception.message = message; - delete exception.Message; - return exception; - }, "decorateServiceException"); - var throwDefaultError = /* @__PURE__ */ __name(({ output, parsedBody, exceptionCtor, errorCode }) => { - const $metadata = deserializeMetadata(output); - const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : void 0; - const response = new exceptionCtor({ - name: (parsedBody == null ? void 0 : parsedBody.code) || (parsedBody == null ? void 0 : parsedBody.Code) || errorCode || statusCode || "UnknownError", - $fault: "client", - $metadata - }); - throw decorateServiceException(response, parsedBody); - }, "throwDefaultError"); - var withBaseException = /* @__PURE__ */ __name((ExceptionCtor) => { - return ({ output, parsedBody, errorCode }) => { - throwDefaultError({ output, parsedBody, exceptionCtor: ExceptionCtor, errorCode }); - }; - }, "withBaseException"); - var deserializeMetadata = /* @__PURE__ */ __name((output) => ({ - httpStatusCode: output.statusCode, - requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"], - extendedRequestId: output.headers["x-amz-id-2"], - cfId: output.headers["x-amz-cf-id"] - }), "deserializeMetadata"); - var loadConfigsForDefaultMode = /* @__PURE__ */ __name((mode) => { - switch (mode) { - case "standard": - return { - retryMode: "standard", - connectionTimeout: 3100 - }; - case "in-region": - return { - retryMode: "standard", - connectionTimeout: 1100 - }; - case "cross-region": - return { - retryMode: "standard", - connectionTimeout: 3100 - }; - case "mobile": - return { - retryMode: "standard", - connectionTimeout: 3e4 - }; - default: - return {}; + __name(_NodeHttp2Handler, "NodeHttp2Handler"); + var NodeHttp2Handler = _NodeHttp2Handler; + var _Collector = class _Collector extends import_stream.Writable { + constructor() { + super(...arguments); + this.bufferedBytes = []; } - }, "loadConfigsForDefaultMode"); - var warningEmitted = false; - var emitWarningIfUnsupportedVersion = /* @__PURE__ */ __name((version2) => { - if (version2 && !warningEmitted && parseInt(version2.substring(1, version2.indexOf("."))) < 14) { - warningEmitted = true; + _write(chunk, encoding, callback) { + this.bufferedBytes.push(chunk); + callback(); } - }, "emitWarningIfUnsupportedVersion"); - var getChecksumConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { - const checksumAlgorithms = []; - for (const id in import_types.AlgorithmId) { - const algorithmId = import_types.AlgorithmId[id]; - if (runtimeConfig[algorithmId] === void 0) { - continue; - } - checksumAlgorithms.push({ - algorithmId: () => algorithmId, - checksumConstructor: () => runtimeConfig[algorithmId] - }); + }; + __name(_Collector, "Collector"); + var Collector = _Collector; + var streamCollector = /* @__PURE__ */ __name((stream) => { + if (isReadableStreamInstance(stream)) { + return collectReadableStream(stream); } - return { - _checksumAlgorithms: checksumAlgorithms, - addChecksumAlgorithm(algo) { - this._checksumAlgorithms.push(algo); - }, - checksumAlgorithms() { - return this._checksumAlgorithms; - } - }; - }, "getChecksumConfiguration"); - var resolveChecksumRuntimeConfig = /* @__PURE__ */ __name((clientConfig) => { - const runtimeConfig = {}; - clientConfig.checksumAlgorithms().forEach((checksumAlgorithm) => { - runtimeConfig[checksumAlgorithm.algorithmId()] = checksumAlgorithm.checksumConstructor(); + return new Promise((resolve, reject) => { + const collector = new Collector(); + stream.pipe(collector); + stream.on("error", (err) => { + collector.end(); + reject(err); + }); + collector.on("error", reject); + collector.on("finish", function() { + const bytes = new Uint8Array(Buffer.concat(this.bufferedBytes)); + resolve(bytes); + }); }); - return runtimeConfig; - }, "resolveChecksumRuntimeConfig"); - var getRetryConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { - let _retryStrategy = runtimeConfig.retryStrategy; - return { - setRetryStrategy(retryStrategy) { - _retryStrategy = retryStrategy; - }, - retryStrategy() { - return _retryStrategy; + }, "streamCollector"); + var isReadableStreamInstance = /* @__PURE__ */ __name((stream) => typeof ReadableStream === "function" && stream instanceof ReadableStream, "isReadableStreamInstance"); + async function collectReadableStream(stream) { + const chunks = []; + const reader = stream.getReader(); + let isDone = false; + let length = 0; + while (!isDone) { + const { done, value } = await reader.read(); + if (value) { + chunks.push(value); + length += value.length; + } + isDone = done; + } + const collected = new Uint8Array(length); + let offset = 0; + for (const chunk of chunks) { + collected.set(chunk, offset); + offset += chunk.length; + } + return collected; + } + __name(collectReadableStream, "collectReadableStream"); + } +}); + +// ../../../node_modules/@smithy/smithy-client/node_modules/@smithy/fetch-http-handler/dist-cjs/index.js +var require_dist_cjs34 = __commonJS({ + "../../../node_modules/@smithy/smithy-client/node_modules/@smithy/fetch-http-handler/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + FetchHttpHandler: () => FetchHttpHandler, + keepAliveSupport: () => keepAliveSupport, + streamCollector: () => streamCollector + }); + module2.exports = __toCommonJS2(src_exports); + var import_protocol_http8 = require_dist_cjs30(); + var import_querystring_builder = require_dist_cjs32(); + function requestTimeout(timeoutInMs = 0) { + return new Promise((resolve, reject) => { + if (timeoutInMs) { + setTimeout(() => { + const timeoutError = new Error(`Request did not complete within ${timeoutInMs} ms`); + timeoutError.name = "TimeoutError"; + reject(timeoutError); + }, timeoutInMs); } - }; - }, "getRetryConfiguration"); - var resolveRetryRuntimeConfig = /* @__PURE__ */ __name((retryStrategyConfiguration) => { - const runtimeConfig = {}; - runtimeConfig.retryStrategy = retryStrategyConfiguration.retryStrategy(); - return runtimeConfig; - }, "resolveRetryRuntimeConfig"); - var getDefaultExtensionConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { - return { - ...getChecksumConfiguration(runtimeConfig), - ...getRetryConfiguration(runtimeConfig) - }; - }, "getDefaultExtensionConfiguration"); - var getDefaultClientConfiguration = getDefaultExtensionConfiguration; - var resolveDefaultRuntimeConfig = /* @__PURE__ */ __name((config) => { - return { - ...resolveChecksumRuntimeConfig(config), - ...resolveRetryRuntimeConfig(config) - }; - }, "resolveDefaultRuntimeConfig"); - function extendedEncodeURIComponent(str) { - return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { - return "%" + c.charCodeAt(0).toString(16).toUpperCase(); }); } - __name(extendedEncodeURIComponent, "extendedEncodeURIComponent"); - var getArrayIfSingleItem = /* @__PURE__ */ __name((mayBeArray) => Array.isArray(mayBeArray) ? mayBeArray : [mayBeArray], "getArrayIfSingleItem"); - var getValueFromTextNode = /* @__PURE__ */ __name((obj) => { - const textNodeName = "#text"; - for (const key in obj) { - if (obj.hasOwnProperty(key) && obj[key][textNodeName] !== void 0) { - obj[key] = obj[key][textNodeName]; - } else if (typeof obj[key] === "object" && obj[key] !== null) { - obj[key] = getValueFromTextNode(obj[key]); + __name(requestTimeout, "requestTimeout"); + var keepAliveSupport = { + supported: void 0 + }; + var _FetchHttpHandler = class _FetchHttpHandler2 { + /** + * @returns the input if it is an HttpHandler of any class, + * or instantiates a new instance of this handler. + */ + static create(instanceOrOptions) { + if (typeof (instanceOrOptions == null ? void 0 : instanceOrOptions.handle) === "function") { + return instanceOrOptions; } + return new _FetchHttpHandler2(instanceOrOptions); } - return obj; - }, "getValueFromTextNode"); - var StringWrapper = /* @__PURE__ */ __name(function() { - const Class = Object.getPrototypeOf(this).constructor; - const Constructor = Function.bind.apply(String, [null, ...arguments]); - const instance = new Constructor(); - Object.setPrototypeOf(instance, Class.prototype); - return instance; - }, "StringWrapper"); - StringWrapper.prototype = Object.create(String.prototype, { - constructor: { - value: StringWrapper, - enumerable: false, - writable: true, - configurable: true + constructor(options) { + if (typeof options === "function") { + this.configProvider = options().then((opts) => opts || {}); + } else { + this.config = options ?? {}; + this.configProvider = Promise.resolve(this.config); + } + if (keepAliveSupport.supported === void 0) { + keepAliveSupport.supported = Boolean( + typeof Request !== "undefined" && "keepalive" in new Request("https://[::1]") + ); + } + } + destroy() { + } + async handle(request2, { abortSignal } = {}) { + var _a; + if (!this.config) { + this.config = await this.configProvider; + } + const requestTimeoutInMs = this.config.requestTimeout; + const keepAlive = this.config.keepAlive === true; + const credentials = this.config.credentials; + if (abortSignal == null ? void 0 : abortSignal.aborted) { + const abortError = new Error("Request aborted"); + abortError.name = "AbortError"; + return Promise.reject(abortError); + } + let path = request2.path; + const queryString = (0, import_querystring_builder.buildQueryString)(request2.query || {}); + if (queryString) { + path += `?${queryString}`; + } + if (request2.fragment) { + path += `#${request2.fragment}`; + } + let auth = ""; + if (request2.username != null || request2.password != null) { + const username = request2.username ?? ""; + const password = request2.password ?? ""; + auth = `${username}:${password}@`; + } + const { port, method } = request2; + const url2 = `${request2.protocol}//${auth}${request2.hostname}${port ? `:${port}` : ""}${path}`; + const body = method === "GET" || method === "HEAD" ? void 0 : request2.body; + const requestOptions = { + body, + headers: new Headers(request2.headers), + method, + credentials + }; + if ((_a = this.config) == null ? void 0 : _a.cache) { + requestOptions.cache = this.config.cache; + } + if (body) { + requestOptions.duplex = "half"; + } + if (typeof AbortController !== "undefined") { + requestOptions.signal = abortSignal; + } + if (keepAliveSupport.supported) { + requestOptions.keepalive = keepAlive; + } + if (typeof this.config.requestInit === "function") { + Object.assign(requestOptions, this.config.requestInit(request2)); + } + let removeSignalEventListener = /* @__PURE__ */ __name(() => { + }, "removeSignalEventListener"); + const fetchRequest = new Request(url2, requestOptions); + const raceOfPromises = [ + fetch(fetchRequest).then((response) => { + const fetchHeaders = response.headers; + const transformedHeaders = {}; + for (const pair of fetchHeaders.entries()) { + transformedHeaders[pair[0]] = pair[1]; + } + const hasReadableStream = response.body != void 0; + if (!hasReadableStream) { + return response.blob().then((body2) => ({ + response: new import_protocol_http8.HttpResponse({ + headers: transformedHeaders, + reason: response.statusText, + statusCode: response.status, + body: body2 + }) + })); + } + return { + response: new import_protocol_http8.HttpResponse({ + headers: transformedHeaders, + reason: response.statusText, + statusCode: response.status, + body: response.body + }) + }; + }), + requestTimeout(requestTimeoutInMs) + ]; + if (abortSignal) { + raceOfPromises.push( + new Promise((resolve, reject) => { + const onAbort = /* @__PURE__ */ __name(() => { + const abortError = new Error("Request aborted"); + abortError.name = "AbortError"; + reject(abortError); + }, "onAbort"); + if (typeof abortSignal.addEventListener === "function") { + const signal = abortSignal; + signal.addEventListener("abort", onAbort, { once: true }); + removeSignalEventListener = /* @__PURE__ */ __name(() => signal.removeEventListener("abort", onAbort), "removeSignalEventListener"); + } else { + abortSignal.onabort = onAbort; + } + }) + ); + } + return Promise.race(raceOfPromises).finally(removeSignalEventListener); } - }); - Object.setPrototypeOf(StringWrapper, String); - var _LazyJsonString = class _LazyJsonString2 extends StringWrapper { - deserializeJSON() { - return JSON.parse(super.toString()); + updateHttpClientConfig(key, value) { + this.config = void 0; + this.configProvider = this.configProvider.then((config) => { + config[key] = value; + return config; + }); } - toJSON() { - return super.toString(); + httpHandlerConfigs() { + return this.config ?? {}; } - static fromObject(object) { - if (object instanceof _LazyJsonString2) { - return object; - } else if (object instanceof String || typeof object === "string") { - return new _LazyJsonString2(object); - } - return new _LazyJsonString2(JSON.stringify(object)); + }; + __name(_FetchHttpHandler, "FetchHttpHandler"); + var FetchHttpHandler = _FetchHttpHandler; + var import_util_base64 = require_dist_cjs29(); + var streamCollector = /* @__PURE__ */ __name((stream) => { + if (typeof Blob === "function" && stream instanceof Blob) { + return collectBlob(stream); } + return collectStream(stream); + }, "streamCollector"); + async function collectBlob(blob) { + const base64 = await readToBase64(blob); + const arrayBuffer = (0, import_util_base64.fromBase64)(base64); + return new Uint8Array(arrayBuffer); + } + __name(collectBlob, "collectBlob"); + async function collectStream(stream) { + const chunks = []; + const reader = stream.getReader(); + let isDone = false; + let length = 0; + while (!isDone) { + const { done, value } = await reader.read(); + if (value) { + chunks.push(value); + length += value.length; + } + isDone = done; + } + const collected = new Uint8Array(length); + let offset = 0; + for (const chunk of chunks) { + collected.set(chunk, offset); + offset += chunk.length; + } + return collected; + } + __name(collectStream, "collectStream"); + function readToBase64(blob) { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.onloadend = () => { + if (reader.readyState !== 2) { + return reject(new Error("Reader aborted too early")); + } + const result = reader.result ?? ""; + const commaIndex = result.indexOf(","); + const dataOffset = commaIndex > -1 ? commaIndex + 1 : result.length; + resolve(result.substring(dataOffset)); + }; + reader.onabort = () => reject(new Error("Read aborted")); + reader.onerror = () => reject(reader.error); + reader.readAsDataURL(blob); + }); + } + __name(readToBase64, "readToBase64"); + } +}); + +// ../../../node_modules/@smithy/util-hex-encoding/dist-cjs/index.js +var require_dist_cjs35 = __commonJS({ + "../../../node_modules/@smithy/util-hex-encoding/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - __name(_LazyJsonString, "LazyJsonString"); - var LazyJsonString = _LazyJsonString; - function map(arg0, arg1, arg2) { - let target; - let filter; - let instructions; - if (typeof arg1 === "undefined" && typeof arg2 === "undefined") { - target = {}; - instructions = arg0; - } else { - target = arg0; - if (typeof arg1 === "function") { - filter = arg1; - instructions = arg2; - return mapWithFilter(target, filter, instructions); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + fromHex: () => fromHex, + toHex: () => toHex + }); + module2.exports = __toCommonJS2(src_exports); + var SHORT_TO_HEX = {}; + var HEX_TO_SHORT = {}; + for (let i = 0; i < 256; i++) { + let encodedByte = i.toString(16).toLowerCase(); + if (encodedByte.length === 1) { + encodedByte = `0${encodedByte}`; + } + SHORT_TO_HEX[i] = encodedByte; + HEX_TO_SHORT[encodedByte] = i; + } + function fromHex(encoded) { + if (encoded.length % 2 !== 0) { + throw new Error("Hex encoded strings must have an even number length"); + } + const out = new Uint8Array(encoded.length / 2); + for (let i = 0; i < encoded.length; i += 2) { + const encodedByte = encoded.slice(i, i + 2).toLowerCase(); + if (encodedByte in HEX_TO_SHORT) { + out[i / 2] = HEX_TO_SHORT[encodedByte]; } else { - instructions = arg1; + throw new Error(`Cannot decode unrecognized sequence ${encodedByte} as hexadecimal`); } } - for (const key of Object.keys(instructions)) { - if (!Array.isArray(instructions[key])) { - target[key] = instructions[key]; - continue; - } - applyInstruction(target, null, instructions, key); + return out; + } + __name(fromHex, "fromHex"); + function toHex(bytes) { + let out = ""; + for (let i = 0; i < bytes.byteLength; i++) { + out += SHORT_TO_HEX[bytes[i]]; } - return target; + return out; } - __name(map, "map"); - var convertMap = /* @__PURE__ */ __name((target) => { - const output = {}; - for (const [k, v] of Object.entries(target || {})) { - output[k] = [, v]; + __name(toHex, "toHex"); + } +}); + +// ../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/stream-type-check.js +var require_stream_type_check = __commonJS({ + "../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/stream-type-check.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.isReadableStream = void 0; + var isReadableStream2 = (stream) => { + var _a; + return typeof ReadableStream === "function" && (((_a = stream === null || stream === void 0 ? void 0 : stream.constructor) === null || _a === void 0 ? void 0 : _a.name) === ReadableStream.name || stream instanceof ReadableStream); + }; + exports2.isReadableStream = isReadableStream2; + } +}); + +// ../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.browser.js +var require_sdk_stream_mixin_browser = __commonJS({ + "../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.browser.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.sdkStreamMixin = void 0; + var fetch_http_handler_1 = require_dist_cjs34(); + var util_base64_1 = require_dist_cjs29(); + var util_hex_encoding_1 = require_dist_cjs35(); + var util_utf8_1 = require_dist_cjs28(); + var stream_type_check_1 = require_stream_type_check(); + var ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED = "The stream has already been transformed."; + var sdkStreamMixin2 = (stream) => { + var _a, _b; + if (!isBlobInstance(stream) && !(0, stream_type_check_1.isReadableStream)(stream)) { + const name = ((_b = (_a = stream === null || stream === void 0 ? void 0 : stream.__proto__) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) || stream; + throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${name}`); } - return output; - }, "convertMap"); - var take = /* @__PURE__ */ __name((source, instructions) => { - const out = {}; - for (const key in instructions) { - applyInstruction(out, source, instructions, key); + let transformed = false; + const transformToByteArray = async () => { + if (transformed) { + throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED); + } + transformed = true; + return await (0, fetch_http_handler_1.streamCollector)(stream); + }; + const blobToWebStream = (blob) => { + if (typeof blob.stream !== "function") { + throw new Error("Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.\nIf you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body"); + } + return blob.stream(); + }; + return Object.assign(stream, { + transformToByteArray, + transformToString: async (encoding) => { + const buf = await transformToByteArray(); + if (encoding === "base64") { + return (0, util_base64_1.toBase64)(buf); + } else if (encoding === "hex") { + return (0, util_hex_encoding_1.toHex)(buf); + } else if (encoding === void 0 || encoding === "utf8" || encoding === "utf-8") { + return (0, util_utf8_1.toUtf8)(buf); + } else if (typeof TextDecoder === "function") { + return new TextDecoder(encoding).decode(buf); + } else { + throw new Error("TextDecoder is not available, please make sure polyfill is provided."); + } + }, + transformToWebStream: () => { + if (transformed) { + throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED); + } + transformed = true; + if (isBlobInstance(stream)) { + return blobToWebStream(stream); + } else if ((0, stream_type_check_1.isReadableStream)(stream)) { + return stream; + } else { + throw new Error(`Cannot transform payload to web stream, got ${stream}`); + } + } + }); + }; + exports2.sdkStreamMixin = sdkStreamMixin2; + var isBlobInstance = (stream) => typeof Blob === "function" && stream instanceof Blob; + } +}); + +// ../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.js +var require_sdk_stream_mixin = __commonJS({ + "../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.sdkStreamMixin = void 0; + var node_http_handler_1 = require_dist_cjs33(); + var util_buffer_from_1 = require_dist_cjs27(); + var stream_1 = require("stream"); + var util_1 = require("util"); + var sdk_stream_mixin_browser_1 = require_sdk_stream_mixin_browser(); + var ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED = "The stream has already been transformed."; + var sdkStreamMixin2 = (stream) => { + var _a, _b; + if (!(stream instanceof stream_1.Readable)) { + try { + return (0, sdk_stream_mixin_browser_1.sdkStreamMixin)(stream); + } catch (e) { + const name = ((_b = (_a = stream === null || stream === void 0 ? void 0 : stream.__proto__) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) || stream; + throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${name}`); + } } - return out; - }, "take"); - var mapWithFilter = /* @__PURE__ */ __name((target, filter, instructions) => { - return map( - target, - Object.entries(instructions).reduce( - (_instructions, [key, value]) => { - if (Array.isArray(value)) { - _instructions[key] = value; - } else { - if (typeof value === "function") { - _instructions[key] = [filter, value()]; - } else { - _instructions[key] = [filter, value]; - } - } - return _instructions; - }, - {} - ) - ); - }, "mapWithFilter"); - var applyInstruction = /* @__PURE__ */ __name((target, source, instructions, targetKey) => { - if (source !== null) { - let instruction = instructions[targetKey]; - if (typeof instruction === "function") { - instruction = [, instruction]; + let transformed = false; + const transformToByteArray = async () => { + if (transformed) { + throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED); } - const [filter2 = nonNullish, valueFn = pass, sourceKey = targetKey] = instruction; - if (typeof filter2 === "function" && filter2(source[sourceKey]) || typeof filter2 !== "function" && !!filter2) { - target[targetKey] = valueFn(source[sourceKey]); + transformed = true; + return await (0, node_http_handler_1.streamCollector)(stream); + }; + return Object.assign(stream, { + transformToByteArray, + transformToString: async (encoding) => { + const buf = await transformToByteArray(); + if (encoding === void 0 || Buffer.isEncoding(encoding)) { + return (0, util_buffer_from_1.fromArrayBuffer)(buf.buffer, buf.byteOffset, buf.byteLength).toString(encoding); + } else { + const decoder2 = new util_1.TextDecoder(encoding); + return decoder2.decode(buf); + } + }, + transformToWebStream: () => { + if (transformed) { + throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED); + } + if (stream.readableFlowing !== null) { + throw new Error("The stream has been consumed by other callbacks."); + } + if (typeof stream_1.Readable.toWeb !== "function") { + throw new Error("Readable.toWeb() is not supported. Please make sure you are using Node.js >= 17.0.0, or polyfill is available."); + } + transformed = true; + return stream_1.Readable.toWeb(stream); + } + }); + }; + exports2.sdkStreamMixin = sdkStreamMixin2; + } +}); + +// ../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/splitStream.browser.js +var require_splitStream_browser = __commonJS({ + "../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/splitStream.browser.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.splitStream = void 0; + async function splitStream2(stream) { + if (typeof stream.stream === "function") { + stream = stream.stream(); + } + const readableStream = stream; + return readableStream.tee(); + } + exports2.splitStream = splitStream2; + } +}); + +// ../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/splitStream.js +var require_splitStream = __commonJS({ + "../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/splitStream.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.splitStream = void 0; + var stream_1 = require("stream"); + var splitStream_browser_1 = require_splitStream_browser(); + var stream_type_check_1 = require_stream_type_check(); + async function splitStream2(stream) { + if ((0, stream_type_check_1.isReadableStream)(stream)) { + return (0, splitStream_browser_1.splitStream)(stream); + } + const stream1 = new stream_1.PassThrough(); + const stream2 = new stream_1.PassThrough(); + stream.pipe(stream1); + stream.pipe(stream2); + return [stream1, stream2]; + } + exports2.splitStream = splitStream2; + } +}); + +// ../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/headStream.browser.js +var require_headStream_browser = __commonJS({ + "../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/headStream.browser.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.headStream = void 0; + async function headStream2(stream, bytes) { + var _a; + let byteLengthCounter = 0; + const chunks = []; + const reader = stream.getReader(); + let isDone = false; + while (!isDone) { + const { done, value } = await reader.read(); + if (value) { + chunks.push(value); + byteLengthCounter += (_a = value === null || value === void 0 ? void 0 : value.byteLength) !== null && _a !== void 0 ? _a : 0; + } + if (byteLengthCounter >= bytes) { + break; } - return; + isDone = done; } - let [filter, value] = instructions[targetKey]; - if (typeof value === "function") { - let _value; - const defaultFilterPassed = filter === void 0 && (_value = value()) != null; - const customFilterPassed = typeof filter === "function" && !!filter(void 0) || typeof filter !== "function" && !!filter; - if (defaultFilterPassed) { - target[targetKey] = _value; - } else if (customFilterPassed) { - target[targetKey] = value(); - } - } else { - const defaultFilterPassed = filter === void 0 && value != null; - const customFilterPassed = typeof filter === "function" && !!filter(value) || typeof filter !== "function" && !!filter; - if (defaultFilterPassed || customFilterPassed) { - target[targetKey] = value; + reader.releaseLock(); + const collected = new Uint8Array(Math.min(bytes, byteLengthCounter)); + let offset = 0; + for (const chunk of chunks) { + if (chunk.byteLength > collected.byteLength - offset) { + collected.set(chunk.subarray(0, collected.byteLength - offset), offset); + break; + } else { + collected.set(chunk, offset); } + offset += chunk.length; } - }, "applyInstruction"); - var nonNullish = /* @__PURE__ */ __name((_) => _ != null, "nonNullish"); - var pass = /* @__PURE__ */ __name((_) => _, "pass"); - var resolvedPath = /* @__PURE__ */ __name((resolvedPath2, input, memberName, labelValueProvider, uriLabel, isGreedyLabel) => { - if (input != null && input[memberName] !== void 0) { - const labelValue = labelValueProvider(); - if (labelValue.length <= 0) { - throw new Error("Empty value provided for input HTTP label: " + memberName + "."); - } - resolvedPath2 = resolvedPath2.replace( - uriLabel, - isGreedyLabel ? labelValue.split("/").map((segment) => extendedEncodeURIComponent(segment)).join("/") : extendedEncodeURIComponent(labelValue) - ); - } else { - throw new Error("No value provided for input HTTP label: " + memberName + "."); + return collected; + } + exports2.headStream = headStream2; + } +}); + +// ../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/headStream.js +var require_headStream = __commonJS({ + "../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/headStream.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.headStream = void 0; + var stream_1 = require("stream"); + var headStream_browser_1 = require_headStream_browser(); + var stream_type_check_1 = require_stream_type_check(); + var headStream2 = (stream, bytes) => { + if ((0, stream_type_check_1.isReadableStream)(stream)) { + return (0, headStream_browser_1.headStream)(stream, bytes); } - return resolvedPath2; - }, "resolvedPath"); - var serializeFloat = /* @__PURE__ */ __name((value) => { - if (value !== value) { - return "NaN"; + return new Promise((resolve, reject) => { + const collector = new Collector(); + collector.limit = bytes; + stream.pipe(collector); + stream.on("error", (err) => { + collector.end(); + reject(err); + }); + collector.on("error", reject); + collector.on("finish", function() { + const bytes2 = new Uint8Array(Buffer.concat(this.buffers)); + resolve(bytes2); + }); + }); + }; + exports2.headStream = headStream2; + var Collector = class extends stream_1.Writable { + constructor() { + super(...arguments); + this.buffers = []; + this.limit = Infinity; + this.bytesBuffered = 0; } - switch (value) { - case Infinity: - return "Infinity"; - case -Infinity: - return "-Infinity"; - default: - return value; + _write(chunk, encoding, callback) { + var _a; + this.buffers.push(chunk); + this.bytesBuffered += (_a = chunk.byteLength) !== null && _a !== void 0 ? _a : 0; + if (this.bytesBuffered >= this.limit) { + const excess = this.bytesBuffered - this.limit; + const tailBuffer = this.buffers[this.buffers.length - 1]; + this.buffers[this.buffers.length - 1] = tailBuffer.subarray(0, tailBuffer.byteLength - excess); + this.emit("finish"); + } + callback(); } - }, "serializeFloat"); - var _json = /* @__PURE__ */ __name((obj) => { - if (obj == null) { - return {}; + }; + } +}); + +// ../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/index.js +var require_dist_cjs36 = __commonJS({ + "../../../node_modules/@smithy/smithy-client/node_modules/@smithy/util-stream/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - if (Array.isArray(obj)) { - return obj.filter((_) => _ != null).map(_json); + return to; + }; + var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + Uint8ArrayBlobAdapter: () => Uint8ArrayBlobAdapter + }); + module2.exports = __toCommonJS2(src_exports); + var import_util_base64 = require_dist_cjs29(); + var import_util_utf8 = require_dist_cjs28(); + function transformToString(payload, encoding = "utf-8") { + if (encoding === "base64") { + return (0, import_util_base64.toBase64)(payload); } - if (typeof obj === "object") { - const target = {}; - for (const key of Object.keys(obj)) { - if (obj[key] == null) { - continue; - } - target[key] = _json(obj[key]); + return (0, import_util_utf8.toUtf8)(payload); + } + __name(transformToString, "transformToString"); + function transformFromString(str, encoding) { + if (encoding === "base64") { + return Uint8ArrayBlobAdapter.mutate((0, import_util_base64.fromBase64)(str)); + } + return Uint8ArrayBlobAdapter.mutate((0, import_util_utf8.fromUtf8)(str)); + } + __name(transformFromString, "transformFromString"); + var _Uint8ArrayBlobAdapter = class _Uint8ArrayBlobAdapter2 extends Uint8Array { + /** + * @param source - such as a string or Stream. + * @returns a new Uint8ArrayBlobAdapter extending Uint8Array. + */ + static fromString(source, encoding = "utf-8") { + switch (typeof source) { + case "string": + return transformFromString(source, encoding); + default: + throw new Error(`Unsupported conversion from ${typeof source} to Uint8ArrayBlobAdapter.`); } - return target; } - return obj; - }, "_json"); - function splitEvery(value, delimiter, numDelimiters) { - if (numDelimiters <= 0 || !Number.isInteger(numDelimiters)) { - throw new Error("Invalid number of delimiters (" + numDelimiters + ") for splitEvery."); + /** + * @param source - Uint8Array to be mutated. + * @returns the same Uint8Array but with prototype switched to Uint8ArrayBlobAdapter. + */ + static mutate(source) { + Object.setPrototypeOf(source, _Uint8ArrayBlobAdapter2.prototype); + return source; } - const segments = value.split(delimiter); - if (numDelimiters === 1) { - return segments; + /** + * @param encoding - default 'utf-8'. + * @returns the blob as string. + */ + transformToString(encoding = "utf-8") { + return transformToString(this, encoding); } - const compoundSegments = []; - let currentSegment = ""; - for (let i = 0; i < segments.length; i++) { - if (currentSegment === "") { - currentSegment = segments[i]; + }; + __name(_Uint8ArrayBlobAdapter, "Uint8ArrayBlobAdapter"); + var Uint8ArrayBlobAdapter = _Uint8ArrayBlobAdapter; + __reExport(src_exports, require_getAwsChunkedEncodingStream(), module2.exports); + __reExport(src_exports, require_sdk_stream_mixin(), module2.exports); + __reExport(src_exports, require_splitStream(), module2.exports); + __reExport(src_exports, require_headStream(), module2.exports); + __reExport(src_exports, require_stream_type_check(), module2.exports); + } +}); + +// ../../../node_modules/@smithy/smithy-client/dist-cjs/index.js +var require_dist_cjs37 = __commonJS({ + "../../../node_modules/@smithy/smithy-client/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + Client: () => Client, + Command: () => Command, + LazyJsonString: () => LazyJsonString, + NoOpLogger: () => NoOpLogger, + SENSITIVE_STRING: () => SENSITIVE_STRING, + ServiceException: () => ServiceException, + StringWrapper: () => StringWrapper, + _json: () => _json, + collectBody: () => collectBody2, + convertMap: () => convertMap, + createAggregatedClient: () => createAggregatedClient, + dateToUtcString: () => dateToUtcString, + decorateServiceException: () => decorateServiceException, + emitWarningIfUnsupportedVersion: () => emitWarningIfUnsupportedVersion2, + expectBoolean: () => expectBoolean, + expectByte: () => expectByte, + expectFloat32: () => expectFloat32, + expectInt: () => expectInt, + expectInt32: () => expectInt32, + expectLong: () => expectLong, + expectNonNull: () => expectNonNull, + expectNumber: () => expectNumber, + expectObject: () => expectObject, + expectShort: () => expectShort, + expectString: () => expectString, + expectUnion: () => expectUnion2, + extendedEncodeURIComponent: () => extendedEncodeURIComponent, + getArrayIfSingleItem: () => getArrayIfSingleItem, + getDefaultClientConfiguration: () => getDefaultClientConfiguration, + getDefaultExtensionConfiguration: () => getDefaultExtensionConfiguration, + getValueFromTextNode: () => getValueFromTextNode2, + handleFloat: () => handleFloat, + isSerializableHeaderValue: () => isSerializableHeaderValue, + limitedParseDouble: () => limitedParseDouble, + limitedParseFloat: () => limitedParseFloat, + limitedParseFloat32: () => limitedParseFloat32, + loadConfigsForDefaultMode: () => loadConfigsForDefaultMode, + logger: () => logger, + map: () => map, + parseBoolean: () => parseBoolean, + parseEpochTimestamp: () => parseEpochTimestamp, + parseRfc3339DateTime: () => parseRfc3339DateTime, + parseRfc3339DateTimeWithOffset: () => parseRfc3339DateTimeWithOffset, + parseRfc7231DateTime: () => parseRfc7231DateTime, + quoteHeader: () => quoteHeader, + resolveDefaultRuntimeConfig: () => resolveDefaultRuntimeConfig, + resolvedPath: () => resolvedPath2, + serializeDateTime: () => serializeDateTime, + serializeFloat: () => serializeFloat, + splitEvery: () => splitEvery, + splitHeader: () => splitHeader, + strictParseByte: () => strictParseByte, + strictParseDouble: () => strictParseDouble, + strictParseFloat: () => strictParseFloat, + strictParseFloat32: () => strictParseFloat32, + strictParseInt: () => strictParseInt, + strictParseInt32: () => strictParseInt32, + strictParseLong: () => strictParseLong, + strictParseShort: () => strictParseShort, + take: () => take, + throwDefaultError: () => throwDefaultError, + withBaseException: () => withBaseException + }); + module2.exports = __toCommonJS2(src_exports); + var import_middleware_stack = require_dist_cjs25(); + var _Client = class _Client { + constructor(config) { + this.config = config; + this.middlewareStack = (0, import_middleware_stack.constructStack)(); + } + send(command, optionsOrCb, cb) { + const options = typeof optionsOrCb !== "function" ? optionsOrCb : void 0; + const callback = typeof optionsOrCb === "function" ? optionsOrCb : cb; + const useHandlerCache = options === void 0 && this.config.cacheMiddleware === true; + let handler2; + if (useHandlerCache) { + if (!this.handlers) { + this.handlers = /* @__PURE__ */ new WeakMap(); + } + const handlers = this.handlers; + if (handlers.has(command.constructor)) { + handler2 = handlers.get(command.constructor); + } else { + handler2 = command.resolveMiddleware(this.middlewareStack, this.config, options); + handlers.set(command.constructor, handler2); + } } else { - currentSegment += delimiter + segments[i]; + delete this.handlers; + handler2 = command.resolveMiddleware(this.middlewareStack, this.config, options); } - if ((i + 1) % numDelimiters === 0) { - compoundSegments.push(currentSegment); - currentSegment = ""; + if (callback) { + handler2(command).then( + (result) => callback(null, result.output), + (err) => callback(err) + ).catch( + // prevent any errors thrown in the callback from triggering an + // unhandled promise rejection + () => { + } + ); + } else { + return handler2(command).then((result) => result.output); } } - if (currentSegment !== "") { - compoundSegments.push(currentSegment); + destroy() { + var _a, _b, _c; + (_c = (_b = (_a = this.config) == null ? void 0 : _a.requestHandler) == null ? void 0 : _b.destroy) == null ? void 0 : _c.call(_b); + delete this.handlers; } - return compoundSegments; - } - __name(splitEvery, "splitEvery"); - } -}); - -// ../../../node_modules/@smithy/middleware-retry/dist-cjs/isStreamingPayload/isStreamingPayload.js -var require_isStreamingPayload = __commonJS({ - "../../../node_modules/@smithy/middleware-retry/dist-cjs/isStreamingPayload/isStreamingPayload.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isStreamingPayload = void 0; - var stream_1 = require("stream"); - var isStreamingPayload = (request2) => (request2 === null || request2 === void 0 ? void 0 : request2.body) instanceof stream_1.Readable || typeof ReadableStream !== "undefined" && (request2 === null || request2 === void 0 ? void 0 : request2.body) instanceof ReadableStream; - exports2.isStreamingPayload = isStreamingPayload; - } -}); - -// ../../../node_modules/@smithy/middleware-retry/dist-cjs/index.js -var require_dist_cjs35 = __commonJS({ - "../../../node_modules/@smithy/middleware-retry/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + __name(_Client, "Client"); + var Client = _Client; + var import_util_stream = require_dist_cjs36(); + var collectBody2 = /* @__PURE__ */ __name(async (streamBody = new Uint8Array(), context) => { + if (streamBody instanceof Uint8Array) { + return import_util_stream.Uint8ArrayBlobAdapter.mutate(streamBody); } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - AdaptiveRetryStrategy: () => AdaptiveRetryStrategy, - CONFIG_MAX_ATTEMPTS: () => CONFIG_MAX_ATTEMPTS, - CONFIG_RETRY_MODE: () => CONFIG_RETRY_MODE, - ENV_MAX_ATTEMPTS: () => ENV_MAX_ATTEMPTS, - ENV_RETRY_MODE: () => ENV_RETRY_MODE, - NODE_MAX_ATTEMPT_CONFIG_OPTIONS: () => NODE_MAX_ATTEMPT_CONFIG_OPTIONS, - NODE_RETRY_MODE_CONFIG_OPTIONS: () => NODE_RETRY_MODE_CONFIG_OPTIONS, - StandardRetryStrategy: () => StandardRetryStrategy, - defaultDelayDecider: () => defaultDelayDecider, - defaultRetryDecider: () => defaultRetryDecider, - getOmitRetryHeadersPlugin: () => getOmitRetryHeadersPlugin, - getRetryAfterHint: () => getRetryAfterHint, - getRetryPlugin: () => getRetryPlugin, - omitRetryHeadersMiddleware: () => omitRetryHeadersMiddleware, - omitRetryHeadersMiddlewareOptions: () => omitRetryHeadersMiddlewareOptions, - resolveRetryConfig: () => resolveRetryConfig, - retryMiddleware: () => retryMiddleware, - retryMiddlewareOptions: () => retryMiddlewareOptions - }); - module2.exports = __toCommonJS2(src_exports); - var import_protocol_http = require_dist_cjs2(); - var import_uuid = (init_esm_node(), __toCommonJS(esm_node_exports)); - var import_util_retry = require_dist_cjs28(); - var getDefaultRetryQuota = /* @__PURE__ */ __name((initialRetryTokens, options) => { - const MAX_CAPACITY = initialRetryTokens; - const noRetryIncrement = (options == null ? void 0 : options.noRetryIncrement) ?? import_util_retry.NO_RETRY_INCREMENT; - const retryCost = (options == null ? void 0 : options.retryCost) ?? import_util_retry.RETRY_COST; - const timeoutRetryCost = (options == null ? void 0 : options.timeoutRetryCost) ?? import_util_retry.TIMEOUT_RETRY_COST; - let availableCapacity = initialRetryTokens; - const getCapacityAmount = /* @__PURE__ */ __name((error) => error.name === "TimeoutError" ? timeoutRetryCost : retryCost, "getCapacityAmount"); - const hasRetryTokens = /* @__PURE__ */ __name((error) => getCapacityAmount(error) <= availableCapacity, "hasRetryTokens"); - const retrieveRetryTokens = /* @__PURE__ */ __name((error) => { - if (!hasRetryTokens(error)) { - throw new Error("No retry token available"); - } - const capacityAmount = getCapacityAmount(error); - availableCapacity -= capacityAmount; - return capacityAmount; - }, "retrieveRetryTokens"); - const releaseRetryTokens = /* @__PURE__ */ __name((capacityReleaseAmount) => { - availableCapacity += capacityReleaseAmount ?? noRetryIncrement; - availableCapacity = Math.min(availableCapacity, MAX_CAPACITY); - }, "releaseRetryTokens"); - return Object.freeze({ - hasRetryTokens, - retrieveRetryTokens, - releaseRetryTokens - }); - }, "getDefaultRetryQuota"); - var defaultDelayDecider = /* @__PURE__ */ __name((delayBase, attempts) => Math.floor(Math.min(import_util_retry.MAXIMUM_RETRY_DELAY, Math.random() * 2 ** attempts * delayBase)), "defaultDelayDecider"); - var import_service_error_classification = require_dist_cjs27(); - var defaultRetryDecider = /* @__PURE__ */ __name((error) => { - if (!error) { - return false; + if (!streamBody) { + return import_util_stream.Uint8ArrayBlobAdapter.mutate(new Uint8Array()); } - return (0, import_service_error_classification.isRetryableByTrait)(error) || (0, import_service_error_classification.isClockSkewError)(error) || (0, import_service_error_classification.isThrottlingError)(error) || (0, import_service_error_classification.isTransientError)(error); - }, "defaultRetryDecider"); - var asSdkError = /* @__PURE__ */ __name((error) => { - if (error instanceof Error) - return error; - if (error instanceof Object) - return Object.assign(new Error(), error); - if (typeof error === "string") - return new Error(error); - return new Error(`AWS SDK error wrapper for ${error}`); - }, "asSdkError"); - var _StandardRetryStrategy = class _StandardRetryStrategy { - constructor(maxAttemptsProvider, options) { - this.maxAttemptsProvider = maxAttemptsProvider; - this.mode = import_util_retry.RETRY_MODES.STANDARD; - this.retryDecider = (options == null ? void 0 : options.retryDecider) ?? defaultRetryDecider; - this.delayDecider = (options == null ? void 0 : options.delayDecider) ?? defaultDelayDecider; - this.retryQuota = (options == null ? void 0 : options.retryQuota) ?? getDefaultRetryQuota(import_util_retry.INITIAL_RETRY_TOKENS); + const fromContext = context.streamCollector(streamBody); + return import_util_stream.Uint8ArrayBlobAdapter.mutate(await fromContext); + }, "collectBody"); + var import_types5 = require_dist_cjs(); + var _Command = class _Command { + constructor() { + this.middlewareStack = (0, import_middleware_stack.constructStack)(); } - shouldRetry(error, attempts, maxAttempts) { - return attempts < maxAttempts && this.retryDecider(error) && this.retryQuota.hasRetryTokens(error); + /** + * Factory for Command ClassBuilder. + * @internal + */ + static classBuilder() { + return new ClassBuilder(); } - async getMaxAttempts() { - let maxAttempts; - try { - maxAttempts = await this.maxAttemptsProvider(); - } catch (error) { - maxAttempts = import_util_retry.DEFAULT_MAX_ATTEMPTS; + /** + * @internal + */ + resolveMiddlewareWithContext(clientStack, configuration, options, { + middlewareFn, + clientName, + commandName, + inputFilterSensitiveLog, + outputFilterSensitiveLog, + smithyContext, + additionalContext, + CommandCtor + }) { + for (const mw of middlewareFn.bind(this)(CommandCtor, clientStack, configuration, options)) { + this.middlewareStack.use(mw); } - return maxAttempts; + const stack = clientStack.concat(this.middlewareStack); + const { logger: logger2 } = configuration; + const handlerExecutionContext = { + logger: logger2, + clientName, + commandName, + inputFilterSensitiveLog, + outputFilterSensitiveLog, + [import_types5.SMITHY_CONTEXT_KEY]: { + commandInstance: this, + ...smithyContext + }, + ...additionalContext + }; + const { requestHandler } = configuration; + return stack.resolve( + (request2) => requestHandler.handle(request2.request, options || {}), + handlerExecutionContext + ); + } + }; + __name(_Command, "Command"); + var Command = _Command; + var _ClassBuilder = class _ClassBuilder { + constructor() { + this._init = () => { + }; + this._ep = {}; + this._middlewareFn = () => []; + this._commandName = ""; + this._clientName = ""; + this._additionalContext = {}; + this._smithyContext = {}; + this._inputFilterSensitiveLog = (_) => _; + this._outputFilterSensitiveLog = (_) => _; + this._serializer = null; + this._deserializer = null; + } + /** + * Optional init callback. + */ + init(cb) { + this._init = cb; + } + /** + * Set the endpoint parameter instructions. + */ + ep(endpointParameterInstructions) { + this._ep = endpointParameterInstructions; + return this; + } + /** + * Add any number of middleware. + */ + m(middlewareSupplier) { + this._middlewareFn = middlewareSupplier; + return this; + } + /** + * Set the initial handler execution context Smithy field. + */ + s(service, operation, smithyContext = {}) { + this._smithyContext = { + service, + operation, + ...smithyContext + }; + return this; + } + /** + * Set the initial handler execution context. + */ + c(additionalContext = {}) { + this._additionalContext = additionalContext; + return this; + } + /** + * Set constant string identifiers for the operation. + */ + n(clientName, commandName) { + this._clientName = clientName; + this._commandName = commandName; + return this; + } + /** + * Set the input and output sensistive log filters. + */ + f(inputFilter = (_) => _, outputFilter = (_) => _) { + this._inputFilterSensitiveLog = inputFilter; + this._outputFilterSensitiveLog = outputFilter; + return this; } - async retry(next, args, options) { - let retryTokenAmount; - let attempts = 0; - let totalDelay = 0; - const maxAttempts = await this.getMaxAttempts(); - const { request: request2 } = args; - if (import_protocol_http.HttpRequest.isInstance(request2)) { - request2.headers[import_util_retry.INVOCATION_ID_HEADER] = (0, import_uuid.v4)(); - } - while (true) { - try { - if (import_protocol_http.HttpRequest.isInstance(request2)) { - request2.headers[import_util_retry.REQUEST_HEADER] = `attempt=${attempts + 1}; max=${maxAttempts}`; - } - if (options == null ? void 0 : options.beforeRequest) { - await options.beforeRequest(); - } - const { response, output } = await next(args); - if (options == null ? void 0 : options.afterRequest) { - options.afterRequest(response); - } - this.retryQuota.releaseRetryTokens(retryTokenAmount); - output.$metadata.attempts = attempts + 1; - output.$metadata.totalRetryDelay = totalDelay; - return { response, output }; - } catch (e) { - const err = asSdkError(e); - attempts++; - if (this.shouldRetry(err, attempts, maxAttempts)) { - retryTokenAmount = this.retryQuota.retrieveRetryTokens(err); - const delayFromDecider = this.delayDecider( - (0, import_service_error_classification.isThrottlingError)(err) ? import_util_retry.THROTTLING_RETRY_DELAY_BASE : import_util_retry.DEFAULT_RETRY_DELAY_BASE, - attempts - ); - const delayFromResponse = getDelayFromRetryAfterHeader(err.$response); - const delay = Math.max(delayFromResponse || 0, delayFromDecider); - totalDelay += delay; - await new Promise((resolve) => setTimeout(resolve, delay)); - continue; - } - if (!err.$metadata) { - err.$metadata = {}; - } - err.$metadata.attempts = attempts; - err.$metadata.totalRetryDelay = totalDelay; - throw err; - } - } + /** + * Sets the serializer. + */ + ser(serializer) { + this._serializer = serializer; + return this; } - }; - __name(_StandardRetryStrategy, "StandardRetryStrategy"); - var StandardRetryStrategy = _StandardRetryStrategy; - var getDelayFromRetryAfterHeader = /* @__PURE__ */ __name((response) => { - if (!import_protocol_http.HttpResponse.isInstance(response)) - return; - const retryAfterHeaderName = Object.keys(response.headers).find((key) => key.toLowerCase() === "retry-after"); - if (!retryAfterHeaderName) - return; - const retryAfter = response.headers[retryAfterHeaderName]; - const retryAfterSeconds = Number(retryAfter); - if (!Number.isNaN(retryAfterSeconds)) - return retryAfterSeconds * 1e3; - const retryAfterDate = new Date(retryAfter); - return retryAfterDate.getTime() - Date.now(); - }, "getDelayFromRetryAfterHeader"); - var _AdaptiveRetryStrategy = class _AdaptiveRetryStrategy extends StandardRetryStrategy { - constructor(maxAttemptsProvider, options) { - const { rateLimiter, ...superOptions } = options ?? {}; - super(maxAttemptsProvider, superOptions); - this.rateLimiter = rateLimiter ?? new import_util_retry.DefaultRateLimiter(); - this.mode = import_util_retry.RETRY_MODES.ADAPTIVE; + /** + * Sets the deserializer. + */ + de(deserializer) { + this._deserializer = deserializer; + return this; } - async retry(next, args) { - return super.retry(next, args, { - beforeRequest: async () => { - return this.rateLimiter.getSendToken(); - }, - afterRequest: (response) => { - this.rateLimiter.updateClientSendingRate(response); + /** + * @returns a Command class with the classBuilder properties. + */ + build() { + var _a; + const closure = this; + let CommandRef; + return CommandRef = (_a = class extends Command { + /** + * @public + */ + constructor(...[input]) { + super(); + this.serialize = closure._serializer; + this.deserialize = closure._deserializer; + this.input = input ?? {}; + closure._init(this); } - }); - } - }; - __name(_AdaptiveRetryStrategy, "AdaptiveRetryStrategy"); - var AdaptiveRetryStrategy = _AdaptiveRetryStrategy; - var import_util_middleware = require_dist_cjs7(); - var ENV_MAX_ATTEMPTS = "AWS_MAX_ATTEMPTS"; - var CONFIG_MAX_ATTEMPTS = "max_attempts"; - var NODE_MAX_ATTEMPT_CONFIG_OPTIONS = { - environmentVariableSelector: (env) => { - const value = env[ENV_MAX_ATTEMPTS]; - if (!value) - return void 0; - const maxAttempt = parseInt(value); - if (Number.isNaN(maxAttempt)) { - throw new Error(`Environment variable ${ENV_MAX_ATTEMPTS} mast be a number, got "${value}"`); - } - return maxAttempt; - }, - configFileSelector: (profile) => { - const value = profile[CONFIG_MAX_ATTEMPTS]; - if (!value) - return void 0; - const maxAttempt = parseInt(value); - if (Number.isNaN(maxAttempt)) { - throw new Error(`Shared config file entry ${CONFIG_MAX_ATTEMPTS} mast be a number, got "${value}"`); - } - return maxAttempt; - }, - default: import_util_retry.DEFAULT_MAX_ATTEMPTS - }; - var resolveRetryConfig = /* @__PURE__ */ __name((input) => { - const { retryStrategy } = input; - const maxAttempts = (0, import_util_middleware.normalizeProvider)(input.maxAttempts ?? import_util_retry.DEFAULT_MAX_ATTEMPTS); - return { - ...input, - maxAttempts, - retryStrategy: async () => { - if (retryStrategy) { - return retryStrategy; + /** + * @public + */ + static getEndpointParameterInstructions() { + return closure._ep; } - const retryMode = await (0, import_util_middleware.normalizeProvider)(input.retryMode)(); - if (retryMode === import_util_retry.RETRY_MODES.ADAPTIVE) { - return new import_util_retry.AdaptiveRetryStrategy(maxAttempts); + /** + * @internal + */ + resolveMiddleware(stack, configuration, options) { + return this.resolveMiddlewareWithContext(stack, configuration, options, { + CommandCtor: CommandRef, + middlewareFn: closure._middlewareFn, + clientName: closure._clientName, + commandName: closure._commandName, + inputFilterSensitiveLog: closure._inputFilterSensitiveLog, + outputFilterSensitiveLog: closure._outputFilterSensitiveLog, + smithyContext: closure._smithyContext, + additionalContext: closure._additionalContext + }); } - return new import_util_retry.StandardRetryStrategy(maxAttempts); - } - }; - }, "resolveRetryConfig"); - var ENV_RETRY_MODE = "AWS_RETRY_MODE"; - var CONFIG_RETRY_MODE = "retry_mode"; - var NODE_RETRY_MODE_CONFIG_OPTIONS = { - environmentVariableSelector: (env) => env[ENV_RETRY_MODE], - configFileSelector: (profile) => profile[CONFIG_RETRY_MODE], - default: import_util_retry.DEFAULT_RETRY_MODE - }; - var omitRetryHeadersMiddleware = /* @__PURE__ */ __name(() => (next) => async (args) => { - const { request: request2 } = args; - if (import_protocol_http.HttpRequest.isInstance(request2)) { - delete request2.headers[import_util_retry.INVOCATION_ID_HEADER]; - delete request2.headers[import_util_retry.REQUEST_HEADER]; + }, __name(_a, "CommandRef"), _a); } - return next(args); - }, "omitRetryHeadersMiddleware"); - var omitRetryHeadersMiddlewareOptions = { - name: "omitRetryHeadersMiddleware", - tags: ["RETRY", "HEADERS", "OMIT_RETRY_HEADERS"], - relation: "before", - toMiddleware: "awsAuthMiddleware", - override: true }; - var getOmitRetryHeadersPlugin = /* @__PURE__ */ __name((options) => ({ - applyToStack: (clientStack) => { - clientStack.addRelativeTo(omitRetryHeadersMiddleware(), omitRetryHeadersMiddlewareOptions); - } - }), "getOmitRetryHeadersPlugin"); - var import_smithy_client = require_dist_cjs34(); - var import_isStreamingPayload = require_isStreamingPayload(); - var retryMiddleware = /* @__PURE__ */ __name((options) => (next, context) => async (args) => { - var _a; - let retryStrategy = await options.retryStrategy(); - const maxAttempts = await options.maxAttempts(); - if (isRetryStrategyV2(retryStrategy)) { - retryStrategy = retryStrategy; - let retryToken = await retryStrategy.acquireInitialRetryToken(context["partition_id"]); - let lastError = new Error(); - let attempts = 0; - let totalRetryDelay = 0; - const { request: request2 } = args; - const isRequest = import_protocol_http.HttpRequest.isInstance(request2); - if (isRequest) { - request2.headers[import_util_retry.INVOCATION_ID_HEADER] = (0, import_uuid.v4)(); - } - while (true) { - try { - if (isRequest) { - request2.headers[import_util_retry.REQUEST_HEADER] = `attempt=${attempts + 1}; max=${maxAttempts}`; - } - const { response, output } = await next(args); - retryStrategy.recordSuccess(retryToken); - output.$metadata.attempts = attempts + 1; - output.$metadata.totalRetryDelay = totalRetryDelay; - return { response, output }; - } catch (e) { - const retryErrorInfo = getRetryErrorInfo(e); - lastError = asSdkError(e); - if (isRequest && (0, import_isStreamingPayload.isStreamingPayload)(request2)) { - (_a = context.logger instanceof import_smithy_client.NoOpLogger ? console : context.logger) == null ? void 0 : _a.warn( - "An error was encountered in a non-retryable streaming request." - ); - throw lastError; - } - try { - retryToken = await retryStrategy.refreshRetryTokenForRetry(retryToken, retryErrorInfo); - } catch (refreshError) { - if (!lastError.$metadata) { - lastError.$metadata = {}; - } - lastError.$metadata.attempts = attempts + 1; - lastError.$metadata.totalRetryDelay = totalRetryDelay; - throw lastError; - } - attempts = retryToken.getRetryCount(); - const delay = retryToken.getRetryDelay(); - totalRetryDelay += delay; - await new Promise((resolve) => setTimeout(resolve, delay)); + __name(_ClassBuilder, "ClassBuilder"); + var ClassBuilder = _ClassBuilder; + var SENSITIVE_STRING = "***SensitiveInformation***"; + var createAggregatedClient = /* @__PURE__ */ __name((commands, Client2) => { + for (const command of Object.keys(commands)) { + const CommandCtor = commands[command]; + const methodImpl = /* @__PURE__ */ __name(async function(args, optionsOrCb, cb) { + const command2 = new CommandCtor(args); + if (typeof optionsOrCb === "function") { + this.send(command2, optionsOrCb); + } else if (typeof cb === "function") { + if (typeof optionsOrCb !== "object") + throw new Error(`Expected http options but got ${typeof optionsOrCb}`); + this.send(command2, optionsOrCb || {}, cb); + } else { + return this.send(command2, optionsOrCb); } + }, "methodImpl"); + const methodName = (command[0].toLowerCase() + command.slice(1)).replace(/Command$/, ""); + Client2.prototype[methodName] = methodImpl; + } + }, "createAggregatedClient"); + var parseBoolean = /* @__PURE__ */ __name((value) => { + switch (value) { + case "true": + return true; + case "false": + return false; + default: + throw new Error(`Unable to parse boolean value "${value}"`); + } + }, "parseBoolean"); + var expectBoolean = /* @__PURE__ */ __name((value) => { + if (value === null || value === void 0) { + return void 0; + } + if (typeof value === "number") { + if (value === 0 || value === 1) { + logger.warn(stackTraceWarning(`Expected boolean, got ${typeof value}: ${value}`)); + } + if (value === 0) { + return false; + } + if (value === 1) { + return true; } - } else { - retryStrategy = retryStrategy; - if (retryStrategy == null ? void 0 : retryStrategy.mode) - context.userAgent = [...context.userAgent || [], ["cfg/retry-mode", retryStrategy.mode]]; - return retryStrategy.retry(next, args); } - }, "retryMiddleware"); - var isRetryStrategyV2 = /* @__PURE__ */ __name((retryStrategy) => typeof retryStrategy.acquireInitialRetryToken !== "undefined" && typeof retryStrategy.refreshRetryTokenForRetry !== "undefined" && typeof retryStrategy.recordSuccess !== "undefined", "isRetryStrategyV2"); - var getRetryErrorInfo = /* @__PURE__ */ __name((error) => { - const errorInfo = { - error, - errorType: getRetryErrorType(error) - }; - const retryAfterHint = getRetryAfterHint(error.$response); - if (retryAfterHint) { - errorInfo.retryAfterHint = retryAfterHint; + if (typeof value === "string") { + const lower = value.toLowerCase(); + if (lower === "false" || lower === "true") { + logger.warn(stackTraceWarning(`Expected boolean, got ${typeof value}: ${value}`)); + } + if (lower === "false") { + return false; + } + if (lower === "true") { + return true; + } } - return errorInfo; - }, "getRetryErrorInfo"); - var getRetryErrorType = /* @__PURE__ */ __name((error) => { - if ((0, import_service_error_classification.isThrottlingError)(error)) - return "THROTTLING"; - if ((0, import_service_error_classification.isTransientError)(error)) - return "TRANSIENT"; - if ((0, import_service_error_classification.isServerError)(error)) - return "SERVER_ERROR"; - return "CLIENT_ERROR"; - }, "getRetryErrorType"); - var retryMiddlewareOptions = { - name: "retryMiddleware", - tags: ["RETRY"], - step: "finalizeRequest", - priority: "high", - override: true - }; - var getRetryPlugin = /* @__PURE__ */ __name((options) => ({ - applyToStack: (clientStack) => { - clientStack.add(retryMiddleware(options), retryMiddlewareOptions); + if (typeof value === "boolean") { + return value; } - }), "getRetryPlugin"); - var getRetryAfterHint = /* @__PURE__ */ __name((response) => { - if (!import_protocol_http.HttpResponse.isInstance(response)) - return; - const retryAfterHeaderName = Object.keys(response.headers).find((key) => key.toLowerCase() === "retry-after"); - if (!retryAfterHeaderName) - return; - const retryAfter = response.headers[retryAfterHeaderName]; - const retryAfterSeconds = Number(retryAfter); - if (!Number.isNaN(retryAfterSeconds)) - return new Date(retryAfterSeconds * 1e3); - const retryAfterDate = new Date(retryAfter); - return retryAfterDate; - }, "getRetryAfterHint"); - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/endpoint/EndpointParameters.js -var require_EndpointParameters = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/endpoint/EndpointParameters.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveClientEndpointParameters = void 0; - var resolveClientEndpointParameters = (options) => { - return { - ...options, - useDualstackEndpoint: options.useDualstackEndpoint ?? false, - useFipsEndpoint: options.useFipsEndpoint ?? false, - defaultSigningName: "states" - }; - }; - exports2.resolveClientEndpointParameters = resolveClientEndpointParameters; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/package.json -var require_package = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/package.json"(exports2, module2) { - module2.exports = { - name: "@aws-sdk/client-sfn", - description: "AWS SDK for JavaScript Sfn Client for Node.js, Browser and React Native", - version: "3.421.0", - scripts: { - build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", - "build:docs": "typedoc", - "build:es": "tsc -p tsconfig.es.json", - "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", - "build:types": "tsc -p tsconfig.types.json", - "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4", - clean: "rimraf ./dist-* && rimraf *.tsbuildinfo", - "extract:docs": "api-extractor run --local", - "generate:client": "node ../../scripts/generate-clients/single-service --solo sfn" - }, - main: "./dist-cjs/index.js", - types: "./dist-types/index.d.ts", - module: "./dist-es/index.js", - sideEffects: false, - dependencies: { - "@aws-crypto/sha256-browser": "3.0.0", - "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/client-sts": "3.421.0", - "@aws-sdk/credential-provider-node": "3.421.0", - "@aws-sdk/middleware-host-header": "3.418.0", - "@aws-sdk/middleware-logger": "3.418.0", - "@aws-sdk/middleware-recursion-detection": "3.418.0", - "@aws-sdk/middleware-signing": "3.418.0", - "@aws-sdk/middleware-user-agent": "3.418.0", - "@aws-sdk/region-config-resolver": "3.418.0", - "@aws-sdk/types": "3.418.0", - "@aws-sdk/util-endpoints": "3.418.0", - "@aws-sdk/util-user-agent-browser": "3.418.0", - "@aws-sdk/util-user-agent-node": "3.418.0", - "@smithy/config-resolver": "^2.0.10", - "@smithy/fetch-http-handler": "^2.1.5", - "@smithy/hash-node": "^2.0.9", - "@smithy/invalid-dependency": "^2.0.9", - "@smithy/middleware-content-length": "^2.0.11", - "@smithy/middleware-endpoint": "^2.0.9", - "@smithy/middleware-retry": "^2.0.12", - "@smithy/middleware-serde": "^2.0.9", - "@smithy/middleware-stack": "^2.0.2", - "@smithy/node-config-provider": "^2.0.12", - "@smithy/node-http-handler": "^2.1.5", - "@smithy/protocol-http": "^3.0.5", - "@smithy/smithy-client": "^2.1.6", - "@smithy/types": "^2.3.3", - "@smithy/url-parser": "^2.0.9", - "@smithy/util-base64": "^2.0.0", - "@smithy/util-body-length-browser": "^2.0.0", - "@smithy/util-body-length-node": "^2.1.0", - "@smithy/util-defaults-mode-browser": "^2.0.10", - "@smithy/util-defaults-mode-node": "^2.0.12", - "@smithy/util-retry": "^2.0.2", - "@smithy/util-utf8": "^2.0.0", - tslib: "^2.5.0" - }, - devDependencies: { - "@smithy/service-client-documentation-generator": "^2.0.0", - "@tsconfig/node14": "1.0.3", - "@types/node": "^14.14.31", - concurrently: "7.0.0", - "downlevel-dts": "0.10.1", - rimraf: "3.0.2", - typedoc: "0.23.23", - typescript: "~4.9.5" - }, - engines: { - node: ">=14.0.0" - }, - typesVersions: { - "<4.0": { - "dist-types/*": [ - "dist-types/ts3.4/*" - ] + throw new TypeError(`Expected boolean, got ${typeof value}: ${value}`); + }, "expectBoolean"); + var expectNumber = /* @__PURE__ */ __name((value) => { + if (value === null || value === void 0) { + return void 0; + } + if (typeof value === "string") { + const parsed = parseFloat(value); + if (!Number.isNaN(parsed)) { + if (String(parsed) !== String(value)) { + logger.warn(stackTraceWarning(`Expected number but observed string: ${value}`)); + } + return parsed; } - }, - files: [ - "dist-*/**" - ], - author: { - name: "AWS SDK for JavaScript Team", - url: "https://aws.amazon.com/javascript/" - }, - license: "Apache-2.0", - browser: { - "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" - }, - "react-native": { - "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" - }, - homepage: "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-sfn", - repository: { - type: "git", - url: "https://github.com/aws/aws-sdk-js-v3.git", - directory: "clients/client-sfn" } - }; - } -}); - -// ../../../node_modules/@aws-sdk/middleware-sdk-sts/dist-cjs/index.js -var require_dist_cjs36 = __commonJS({ - "../../../node_modules/@aws-sdk/middleware-sdk-sts/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveStsAuthConfig = void 0; - var middleware_signing_1 = require_dist_cjs14(); - var resolveStsAuthConfig = (input, { stsClientCtor }) => (0, middleware_signing_1.resolveAwsAuthConfig)({ - ...input, - stsClientCtor - }); - exports2.resolveStsAuthConfig = resolveStsAuthConfig; - } -}); - -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/EndpointParameters.js -var require_EndpointParameters2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/EndpointParameters.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveClientEndpointParameters = void 0; - var resolveClientEndpointParameters = (options) => { - return { - ...options, - useDualstackEndpoint: options.useDualstackEndpoint ?? false, - useFipsEndpoint: options.useFipsEndpoint ?? false, - useGlobalEndpoint: options.useGlobalEndpoint ?? false, - defaultSigningName: "sts" - }; - }; - exports2.resolveClientEndpointParameters = resolveClientEndpointParameters; - } -}); - -// ../../../node_modules/@aws-sdk/client-sts/package.json -var require_package2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/package.json"(exports2, module2) { - module2.exports = { - name: "@aws-sdk/client-sts", - description: "AWS SDK for JavaScript Sts Client for Node.js, Browser and React Native", - version: "3.421.0", - scripts: { - build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", - "build:docs": "typedoc", - "build:es": "tsc -p tsconfig.es.json", - "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", - "build:types": "tsc -p tsconfig.types.json", - "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4", - clean: "rimraf ./dist-* && rimraf *.tsbuildinfo", - "extract:docs": "api-extractor run --local", - "generate:client": "node ../../scripts/generate-clients/single-service --solo sts", - test: "yarn test:unit", - "test:unit": "jest" - }, - main: "./dist-cjs/index.js", - types: "./dist-types/index.d.ts", - module: "./dist-es/index.js", - sideEffects: false, - dependencies: { - "@aws-crypto/sha256-browser": "3.0.0", - "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/credential-provider-node": "3.421.0", - "@aws-sdk/middleware-host-header": "3.418.0", - "@aws-sdk/middleware-logger": "3.418.0", - "@aws-sdk/middleware-recursion-detection": "3.418.0", - "@aws-sdk/middleware-sdk-sts": "3.418.0", - "@aws-sdk/middleware-signing": "3.418.0", - "@aws-sdk/middleware-user-agent": "3.418.0", - "@aws-sdk/region-config-resolver": "3.418.0", - "@aws-sdk/types": "3.418.0", - "@aws-sdk/util-endpoints": "3.418.0", - "@aws-sdk/util-user-agent-browser": "3.418.0", - "@aws-sdk/util-user-agent-node": "3.418.0", - "@smithy/config-resolver": "^2.0.10", - "@smithy/fetch-http-handler": "^2.1.5", - "@smithy/hash-node": "^2.0.9", - "@smithy/invalid-dependency": "^2.0.9", - "@smithy/middleware-content-length": "^2.0.11", - "@smithy/middleware-endpoint": "^2.0.9", - "@smithy/middleware-retry": "^2.0.12", - "@smithy/middleware-serde": "^2.0.9", - "@smithy/middleware-stack": "^2.0.2", - "@smithy/node-config-provider": "^2.0.12", - "@smithy/node-http-handler": "^2.1.5", - "@smithy/protocol-http": "^3.0.5", - "@smithy/smithy-client": "^2.1.6", - "@smithy/types": "^2.3.3", - "@smithy/url-parser": "^2.0.9", - "@smithy/util-base64": "^2.0.0", - "@smithy/util-body-length-browser": "^2.0.0", - "@smithy/util-body-length-node": "^2.1.0", - "@smithy/util-defaults-mode-browser": "^2.0.10", - "@smithy/util-defaults-mode-node": "^2.0.12", - "@smithy/util-retry": "^2.0.2", - "@smithy/util-utf8": "^2.0.0", - "fast-xml-parser": "4.2.5", - tslib: "^2.5.0" - }, - devDependencies: { - "@smithy/service-client-documentation-generator": "^2.0.0", - "@tsconfig/node14": "1.0.3", - "@types/node": "^14.14.31", - concurrently: "7.0.0", - "downlevel-dts": "0.10.1", - rimraf: "3.0.2", - typedoc: "0.23.23", - typescript: "~4.9.5" - }, - engines: { - node: ">=14.0.0" - }, - typesVersions: { - "<4.0": { - "dist-types/*": [ - "dist-types/ts3.4/*" - ] + if (typeof value === "number") { + return value; + } + throw new TypeError(`Expected number, got ${typeof value}: ${value}`); + }, "expectNumber"); + var MAX_FLOAT = Math.ceil(2 ** 127 * (2 - 2 ** -23)); + var expectFloat32 = /* @__PURE__ */ __name((value) => { + const expected = expectNumber(value); + if (expected !== void 0 && !Number.isNaN(expected) && expected !== Infinity && expected !== -Infinity) { + if (Math.abs(expected) > MAX_FLOAT) { + throw new TypeError(`Expected 32-bit float, got ${value}`); + } + } + return expected; + }, "expectFloat32"); + var expectLong = /* @__PURE__ */ __name((value) => { + if (value === null || value === void 0) { + return void 0; + } + if (Number.isInteger(value) && !Number.isNaN(value)) { + return value; + } + throw new TypeError(`Expected integer, got ${typeof value}: ${value}`); + }, "expectLong"); + var expectInt = expectLong; + var expectInt32 = /* @__PURE__ */ __name((value) => expectSizedInt(value, 32), "expectInt32"); + var expectShort = /* @__PURE__ */ __name((value) => expectSizedInt(value, 16), "expectShort"); + var expectByte = /* @__PURE__ */ __name((value) => expectSizedInt(value, 8), "expectByte"); + var expectSizedInt = /* @__PURE__ */ __name((value, size) => { + const expected = expectLong(value); + if (expected !== void 0 && castInt(expected, size) !== expected) { + throw new TypeError(`Expected ${size}-bit integer, got ${value}`); + } + return expected; + }, "expectSizedInt"); + var castInt = /* @__PURE__ */ __name((value, size) => { + switch (size) { + case 32: + return Int32Array.of(value)[0]; + case 16: + return Int16Array.of(value)[0]; + case 8: + return Int8Array.of(value)[0]; + } + }, "castInt"); + var expectNonNull = /* @__PURE__ */ __name((value, location) => { + if (value === null || value === void 0) { + if (location) { + throw new TypeError(`Expected a non-null value for ${location}`); } - }, - files: [ - "dist-*/**" - ], - author: { - name: "AWS SDK for JavaScript Team", - url: "https://aws.amazon.com/javascript/" - }, - license: "Apache-2.0", - browser: { - "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" - }, - "react-native": { - "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" - }, - homepage: "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-sts", - repository: { - type: "git", - url: "https://github.com/aws/aws-sdk-js-v3.git", - directory: "clients/client-sts" + throw new TypeError("Expected a non-null value"); } - }; - } -}); - -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/models/STSServiceException.js -var require_STSServiceException = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/models/STSServiceException.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.STSServiceException = exports2.__ServiceException = void 0; - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "__ServiceException", { enumerable: true, get: function() { - return smithy_client_1.ServiceException; - } }); - var STSServiceException = class _STSServiceException extends smithy_client_1.ServiceException { - constructor(options) { - super(options); - Object.setPrototypeOf(this, _STSServiceException.prototype); + return value; + }, "expectNonNull"); + var expectObject = /* @__PURE__ */ __name((value) => { + if (value === null || value === void 0) { + return void 0; } - }; - exports2.STSServiceException = STSServiceException; - } -}); - -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/models/models_0.js -var require_models_0 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/models/models_0.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.GetSessionTokenResponseFilterSensitiveLog = exports2.GetFederationTokenResponseFilterSensitiveLog = exports2.AssumeRoleWithWebIdentityResponseFilterSensitiveLog = exports2.AssumeRoleWithWebIdentityRequestFilterSensitiveLog = exports2.AssumeRoleWithSAMLResponseFilterSensitiveLog = exports2.AssumeRoleWithSAMLRequestFilterSensitiveLog = exports2.AssumeRoleResponseFilterSensitiveLog = exports2.CredentialsFilterSensitiveLog = exports2.InvalidAuthorizationMessageException = exports2.IDPCommunicationErrorException = exports2.InvalidIdentityTokenException = exports2.IDPRejectedClaimException = exports2.RegionDisabledException = exports2.PackedPolicyTooLargeException = exports2.MalformedPolicyDocumentException = exports2.ExpiredTokenException = void 0; - var smithy_client_1 = require_dist_cjs34(); - var STSServiceException_1 = require_STSServiceException(); - var ExpiredTokenException = class _ExpiredTokenException extends STSServiceException_1.STSServiceException { - constructor(opts) { - super({ - name: "ExpiredTokenException", - $fault: "client", - ...opts - }); - this.name = "ExpiredTokenException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _ExpiredTokenException.prototype); + if (typeof value === "object" && !Array.isArray(value)) { + return value; } - }; - exports2.ExpiredTokenException = ExpiredTokenException; - var MalformedPolicyDocumentException = class _MalformedPolicyDocumentException extends STSServiceException_1.STSServiceException { - constructor(opts) { - super({ - name: "MalformedPolicyDocumentException", - $fault: "client", - ...opts - }); - this.name = "MalformedPolicyDocumentException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _MalformedPolicyDocumentException.prototype); + const receivedType = Array.isArray(value) ? "array" : typeof value; + throw new TypeError(`Expected object, got ${receivedType}: ${value}`); + }, "expectObject"); + var expectString = /* @__PURE__ */ __name((value) => { + if (value === null || value === void 0) { + return void 0; } - }; - exports2.MalformedPolicyDocumentException = MalformedPolicyDocumentException; - var PackedPolicyTooLargeException = class _PackedPolicyTooLargeException extends STSServiceException_1.STSServiceException { - constructor(opts) { - super({ - name: "PackedPolicyTooLargeException", - $fault: "client", - ...opts - }); - this.name = "PackedPolicyTooLargeException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _PackedPolicyTooLargeException.prototype); + if (typeof value === "string") { + return value; } - }; - exports2.PackedPolicyTooLargeException = PackedPolicyTooLargeException; - var RegionDisabledException = class _RegionDisabledException extends STSServiceException_1.STSServiceException { - constructor(opts) { - super({ - name: "RegionDisabledException", - $fault: "client", - ...opts - }); - this.name = "RegionDisabledException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _RegionDisabledException.prototype); + if (["boolean", "number", "bigint"].includes(typeof value)) { + logger.warn(stackTraceWarning(`Expected string, got ${typeof value}: ${value}`)); + return String(value); } - }; - exports2.RegionDisabledException = RegionDisabledException; - var IDPRejectedClaimException = class _IDPRejectedClaimException extends STSServiceException_1.STSServiceException { - constructor(opts) { - super({ - name: "IDPRejectedClaimException", - $fault: "client", - ...opts - }); - this.name = "IDPRejectedClaimException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _IDPRejectedClaimException.prototype); + throw new TypeError(`Expected string, got ${typeof value}: ${value}`); + }, "expectString"); + var expectUnion2 = /* @__PURE__ */ __name((value) => { + if (value === null || value === void 0) { + return void 0; } - }; - exports2.IDPRejectedClaimException = IDPRejectedClaimException; - var InvalidIdentityTokenException = class _InvalidIdentityTokenException extends STSServiceException_1.STSServiceException { - constructor(opts) { - super({ - name: "InvalidIdentityTokenException", - $fault: "client", - ...opts - }); - this.name = "InvalidIdentityTokenException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidIdentityTokenException.prototype); + const asObject = expectObject(value); + const setKeys = Object.entries(asObject).filter(([, v]) => v != null).map(([k]) => k); + if (setKeys.length === 0) { + throw new TypeError(`Unions must have exactly one non-null member. None were found.`); + } + if (setKeys.length > 1) { + throw new TypeError(`Unions must have exactly one non-null member. Keys ${setKeys} were not null.`); + } + return asObject; + }, "expectUnion"); + var strictParseDouble = /* @__PURE__ */ __name((value) => { + if (typeof value == "string") { + return expectNumber(parseNumber(value)); + } + return expectNumber(value); + }, "strictParseDouble"); + var strictParseFloat = strictParseDouble; + var strictParseFloat32 = /* @__PURE__ */ __name((value) => { + if (typeof value == "string") { + return expectFloat32(parseNumber(value)); + } + return expectFloat32(value); + }, "strictParseFloat32"); + var NUMBER_REGEX = /(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g; + var parseNumber = /* @__PURE__ */ __name((value) => { + const matches = value.match(NUMBER_REGEX); + if (matches === null || matches[0].length !== value.length) { + throw new TypeError(`Expected real number, got implicit NaN`); + } + return parseFloat(value); + }, "parseNumber"); + var limitedParseDouble = /* @__PURE__ */ __name((value) => { + if (typeof value == "string") { + return parseFloatString(value); + } + return expectNumber(value); + }, "limitedParseDouble"); + var handleFloat = limitedParseDouble; + var limitedParseFloat = limitedParseDouble; + var limitedParseFloat32 = /* @__PURE__ */ __name((value) => { + if (typeof value == "string") { + return parseFloatString(value); + } + return expectFloat32(value); + }, "limitedParseFloat32"); + var parseFloatString = /* @__PURE__ */ __name((value) => { + switch (value) { + case "NaN": + return NaN; + case "Infinity": + return Infinity; + case "-Infinity": + return -Infinity; + default: + throw new Error(`Unable to parse float value: ${value}`); + } + }, "parseFloatString"); + var strictParseLong = /* @__PURE__ */ __name((value) => { + if (typeof value === "string") { + return expectLong(parseNumber(value)); + } + return expectLong(value); + }, "strictParseLong"); + var strictParseInt = strictParseLong; + var strictParseInt32 = /* @__PURE__ */ __name((value) => { + if (typeof value === "string") { + return expectInt32(parseNumber(value)); + } + return expectInt32(value); + }, "strictParseInt32"); + var strictParseShort = /* @__PURE__ */ __name((value) => { + if (typeof value === "string") { + return expectShort(parseNumber(value)); + } + return expectShort(value); + }, "strictParseShort"); + var strictParseByte = /* @__PURE__ */ __name((value) => { + if (typeof value === "string") { + return expectByte(parseNumber(value)); } + return expectByte(value); + }, "strictParseByte"); + var stackTraceWarning = /* @__PURE__ */ __name((message) => { + return String(new TypeError(message).stack || message).split("\n").slice(0, 5).filter((s) => !s.includes("stackTraceWarning")).join("\n"); + }, "stackTraceWarning"); + var logger = { + warn: console.warn }; - exports2.InvalidIdentityTokenException = InvalidIdentityTokenException; - var IDPCommunicationErrorException = class _IDPCommunicationErrorException extends STSServiceException_1.STSServiceException { - constructor(opts) { - super({ - name: "IDPCommunicationErrorException", - $fault: "client", - ...opts - }); - this.name = "IDPCommunicationErrorException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _IDPCommunicationErrorException.prototype); + var DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; + var MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; + function dateToUtcString(date) { + const year = date.getUTCFullYear(); + const month = date.getUTCMonth(); + const dayOfWeek = date.getUTCDay(); + const dayOfMonthInt = date.getUTCDate(); + const hoursInt = date.getUTCHours(); + const minutesInt = date.getUTCMinutes(); + const secondsInt = date.getUTCSeconds(); + const dayOfMonthString = dayOfMonthInt < 10 ? `0${dayOfMonthInt}` : `${dayOfMonthInt}`; + const hoursString = hoursInt < 10 ? `0${hoursInt}` : `${hoursInt}`; + const minutesString = minutesInt < 10 ? `0${minutesInt}` : `${minutesInt}`; + const secondsString = secondsInt < 10 ? `0${secondsInt}` : `${secondsInt}`; + return `${DAYS[dayOfWeek]}, ${dayOfMonthString} ${MONTHS[month]} ${year} ${hoursString}:${minutesString}:${secondsString} GMT`; + } + __name(dateToUtcString, "dateToUtcString"); + var RFC3339 = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/); + var parseRfc3339DateTime = /* @__PURE__ */ __name((value) => { + if (value === null || value === void 0) { + return void 0; } - }; - exports2.IDPCommunicationErrorException = IDPCommunicationErrorException; - var InvalidAuthorizationMessageException = class _InvalidAuthorizationMessageException extends STSServiceException_1.STSServiceException { - constructor(opts) { - super({ - name: "InvalidAuthorizationMessageException", - $fault: "client", - ...opts - }); - this.name = "InvalidAuthorizationMessageException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidAuthorizationMessageException.prototype); + if (typeof value !== "string") { + throw new TypeError("RFC-3339 date-times must be expressed as strings"); } - }; - exports2.InvalidAuthorizationMessageException = InvalidAuthorizationMessageException; - var CredentialsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.SecretAccessKey && { SecretAccessKey: smithy_client_1.SENSITIVE_STRING } - }); - exports2.CredentialsFilterSensitiveLog = CredentialsFilterSensitiveLog; - var AssumeRoleResponseFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.Credentials && { Credentials: (0, exports2.CredentialsFilterSensitiveLog)(obj.Credentials) } - }); - exports2.AssumeRoleResponseFilterSensitiveLog = AssumeRoleResponseFilterSensitiveLog; - var AssumeRoleWithSAMLRequestFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.SAMLAssertion && { SAMLAssertion: smithy_client_1.SENSITIVE_STRING } - }); - exports2.AssumeRoleWithSAMLRequestFilterSensitiveLog = AssumeRoleWithSAMLRequestFilterSensitiveLog; - var AssumeRoleWithSAMLResponseFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.Credentials && { Credentials: (0, exports2.CredentialsFilterSensitiveLog)(obj.Credentials) } - }); - exports2.AssumeRoleWithSAMLResponseFilterSensitiveLog = AssumeRoleWithSAMLResponseFilterSensitiveLog; - var AssumeRoleWithWebIdentityRequestFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.WebIdentityToken && { WebIdentityToken: smithy_client_1.SENSITIVE_STRING } - }); - exports2.AssumeRoleWithWebIdentityRequestFilterSensitiveLog = AssumeRoleWithWebIdentityRequestFilterSensitiveLog; - var AssumeRoleWithWebIdentityResponseFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.Credentials && { Credentials: (0, exports2.CredentialsFilterSensitiveLog)(obj.Credentials) } - }); - exports2.AssumeRoleWithWebIdentityResponseFilterSensitiveLog = AssumeRoleWithWebIdentityResponseFilterSensitiveLog; - var GetFederationTokenResponseFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.Credentials && { Credentials: (0, exports2.CredentialsFilterSensitiveLog)(obj.Credentials) } - }); - exports2.GetFederationTokenResponseFilterSensitiveLog = GetFederationTokenResponseFilterSensitiveLog; - var GetSessionTokenResponseFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.Credentials && { Credentials: (0, exports2.CredentialsFilterSensitiveLog)(obj.Credentials) } - }); - exports2.GetSessionTokenResponseFilterSensitiveLog = GetSessionTokenResponseFilterSensitiveLog; - } -}); - -// ../../../node_modules/fast-xml-parser/src/util.js -var require_util2 = __commonJS({ - "../../../node_modules/fast-xml-parser/src/util.js"(exports2) { - "use strict"; - var nameStartChar = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD"; - var nameChar = nameStartChar + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040"; - var nameRegexp = "[" + nameStartChar + "][" + nameChar + "]*"; - var regexName = new RegExp("^" + nameRegexp + "$"); - var getAllMatches = function(string, regex) { - const matches = []; - let match = regex.exec(string); - while (match) { - const allmatches = []; - allmatches.startIndex = regex.lastIndex - match[0].length; - const len = match.length; - for (let index = 0; index < len; index++) { - allmatches.push(match[index]); - } - matches.push(allmatches); - match = regex.exec(string); + const match = RFC3339.exec(value); + if (!match) { + throw new TypeError("Invalid RFC-3339 date-time value"); } - return matches; - }; - var isName = function(string) { - const match = regexName.exec(string); - return !(match === null || typeof match === "undefined"); - }; - exports2.isExist = function(v) { - return typeof v !== "undefined"; - }; - exports2.isEmptyObject = function(obj) { - return Object.keys(obj).length === 0; - }; - exports2.merge = function(target, a, arrayMode) { - if (a) { - const keys = Object.keys(a); - const len = keys.length; - for (let i = 0; i < len; i++) { - if (arrayMode === "strict") { - target[keys[i]] = [a[keys[i]]]; - } else { - target[keys[i]] = a[keys[i]]; - } - } + const [_, yearStr, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds] = match; + const year = strictParseShort(stripLeadingZeroes(yearStr)); + const month = parseDateValue(monthStr, "month", 1, 12); + const day = parseDateValue(dayStr, "day", 1, 31); + return buildDate(year, month, day, { hours, minutes, seconds, fractionalMilliseconds }); + }, "parseRfc3339DateTime"); + var RFC3339_WITH_OFFSET = new RegExp( + /^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/ + ); + var parseRfc3339DateTimeWithOffset = /* @__PURE__ */ __name((value) => { + if (value === null || value === void 0) { + return void 0; } - }; - exports2.getValue = function(v) { - if (exports2.isExist(v)) { - return v; - } else { - return ""; + if (typeof value !== "string") { + throw new TypeError("RFC-3339 date-times must be expressed as strings"); } - }; - exports2.isName = isName; - exports2.getAllMatches = getAllMatches; - exports2.nameRegexp = nameRegexp; - } -}); - -// ../../../node_modules/fast-xml-parser/src/validator.js -var require_validator = __commonJS({ - "../../../node_modules/fast-xml-parser/src/validator.js"(exports2) { - "use strict"; - var util = require_util2(); - var defaultOptions = { - allowBooleanAttributes: false, - //A tag can have attributes without any value - unpairedTags: [] - }; - exports2.validate = function(xmlData, options) { - options = Object.assign({}, defaultOptions, options); - const tags = []; - let tagFound = false; - let reachedRoot = false; - if (xmlData[0] === "\uFEFF") { - xmlData = xmlData.substr(1); + const match = RFC3339_WITH_OFFSET.exec(value); + if (!match) { + throw new TypeError("Invalid RFC-3339 date-time value"); } - for (let i = 0; i < xmlData.length; i++) { - if (xmlData[i] === "<" && xmlData[i + 1] === "?") { - i += 2; - i = readPI(xmlData, i); - if (i.err) return i; - } else if (xmlData[i] === "<") { - let tagStartPos = i; - i++; - if (xmlData[i] === "!") { - i = readCommentAndCDATA(xmlData, i); - continue; - } else { - let closingTag = false; - if (xmlData[i] === "/") { - closingTag = true; - i++; - } - let tagName = ""; - for (; i < xmlData.length && xmlData[i] !== ">" && xmlData[i] !== " " && xmlData[i] !== " " && xmlData[i] !== "\n" && xmlData[i] !== "\r"; i++) { - tagName += xmlData[i]; - } - tagName = tagName.trim(); - if (tagName[tagName.length - 1] === "/") { - tagName = tagName.substring(0, tagName.length - 1); - i--; - } - if (!validateTagName(tagName)) { - let msg; - if (tagName.trim().length === 0) { - msg = "Invalid space after '<'."; - } else { - msg = "Tag '" + tagName + "' is an invalid name."; - } - return getErrorObject("InvalidTag", msg, getLineNumberForPosition(xmlData, i)); - } - const result = readAttributeStr(xmlData, i); - if (result === false) { - return getErrorObject("InvalidAttr", "Attributes for '" + tagName + "' have open quote.", getLineNumberForPosition(xmlData, i)); - } - let attrStr = result.value; - i = result.index; - if (attrStr[attrStr.length - 1] === "/") { - const attrStrStart = i - attrStr.length; - attrStr = attrStr.substring(0, attrStr.length - 1); - const isValid = validateAttributeString(attrStr, options); - if (isValid === true) { - tagFound = true; - } else { - return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, attrStrStart + isValid.err.line)); - } - } else if (closingTag) { - if (!result.tagClosed) { - return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' doesn't have proper closing.", getLineNumberForPosition(xmlData, i)); - } else if (attrStr.trim().length > 0) { - return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' can't have attributes or invalid starting.", getLineNumberForPosition(xmlData, tagStartPos)); - } else { - const otg = tags.pop(); - if (tagName !== otg.tagName) { - let openPos = getLineNumberForPosition(xmlData, otg.tagStartPos); - return getErrorObject( - "InvalidTag", - "Expected closing tag '" + otg.tagName + "' (opened in line " + openPos.line + ", col " + openPos.col + ") instead of closing tag '" + tagName + "'.", - getLineNumberForPosition(xmlData, tagStartPos) - ); - } - if (tags.length == 0) { - reachedRoot = true; - } - } - } else { - const isValid = validateAttributeString(attrStr, options); - if (isValid !== true) { - return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, i - attrStr.length + isValid.err.line)); - } - if (reachedRoot === true) { - return getErrorObject("InvalidXml", "Multiple possible root nodes found.", getLineNumberForPosition(xmlData, i)); - } else if (options.unpairedTags.indexOf(tagName) !== -1) { - } else { - tags.push({ tagName, tagStartPos }); - } - tagFound = true; - } - for (i++; i < xmlData.length; i++) { - if (xmlData[i] === "<") { - if (xmlData[i + 1] === "!") { - i++; - i = readCommentAndCDATA(xmlData, i); - continue; - } else if (xmlData[i + 1] === "?") { - i = readPI(xmlData, ++i); - if (i.err) return i; - } else { - break; - } - } else if (xmlData[i] === "&") { - const afterAmp = validateAmpersand(xmlData, i); - if (afterAmp == -1) - return getErrorObject("InvalidChar", "char '&' is not expected.", getLineNumberForPosition(xmlData, i)); - i = afterAmp; - } else { - if (reachedRoot === true && !isWhiteSpace(xmlData[i])) { - return getErrorObject("InvalidXml", "Extra text at the end", getLineNumberForPosition(xmlData, i)); - } - } - } - if (xmlData[i] === "<") { - i--; - } - } - } else { - if (isWhiteSpace(xmlData[i])) { - continue; - } - return getErrorObject("InvalidChar", "char '" + xmlData[i] + "' is not expected.", getLineNumberForPosition(xmlData, i)); - } + const [_, yearStr, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds, offsetStr] = match; + const year = strictParseShort(stripLeadingZeroes(yearStr)); + const month = parseDateValue(monthStr, "month", 1, 12); + const day = parseDateValue(dayStr, "day", 1, 31); + const date = buildDate(year, month, day, { hours, minutes, seconds, fractionalMilliseconds }); + if (offsetStr.toUpperCase() != "Z") { + date.setTime(date.getTime() - parseOffsetToMilliseconds(offsetStr)); + } + return date; + }, "parseRfc3339DateTimeWithOffset"); + var IMF_FIXDATE = new RegExp( + /^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/ + ); + var RFC_850_DATE = new RegExp( + /^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/ + ); + var ASC_TIME = new RegExp( + /^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/ + ); + var parseRfc7231DateTime = /* @__PURE__ */ __name((value) => { + if (value === null || value === void 0) { + return void 0; } - if (!tagFound) { - return getErrorObject("InvalidXml", "Start tag expected.", 1); - } else if (tags.length == 1) { - return getErrorObject("InvalidTag", "Unclosed tag '" + tags[0].tagName + "'.", getLineNumberForPosition(xmlData, tags[0].tagStartPos)); - } else if (tags.length > 0) { - return getErrorObject("InvalidXml", "Invalid '" + JSON.stringify(tags.map((t) => t.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }); + if (typeof value !== "string") { + throw new TypeError("RFC-7231 date-times must be expressed as strings"); } - return true; - }; - function isWhiteSpace(char) { - return char === " " || char === " " || char === "\n" || char === "\r"; - } - function readPI(xmlData, i) { - const start = i; - for (; i < xmlData.length; i++) { - if (xmlData[i] == "?" || xmlData[i] == " ") { - const tagname = xmlData.substr(start, i - start); - if (i > 5 && tagname === "xml") { - return getErrorObject("InvalidXml", "XML declaration allowed only at the start of the document.", getLineNumberForPosition(xmlData, i)); - } else if (xmlData[i] == "?" && xmlData[i + 1] == ">") { - i++; - break; - } else { - continue; - } - } + let match = IMF_FIXDATE.exec(value); + if (match) { + const [_, dayStr, monthStr, yearStr, hours, minutes, seconds, fractionalMilliseconds] = match; + return buildDate( + strictParseShort(stripLeadingZeroes(yearStr)), + parseMonthByShortName(monthStr), + parseDateValue(dayStr, "day", 1, 31), + { hours, minutes, seconds, fractionalMilliseconds } + ); } - return i; - } - function readCommentAndCDATA(xmlData, i) { - if (xmlData.length > i + 5 && xmlData[i + 1] === "-" && xmlData[i + 2] === "-") { - for (i += 3; i < xmlData.length; i++) { - if (xmlData[i] === "-" && xmlData[i + 1] === "-" && xmlData[i + 2] === ">") { - i += 2; - break; - } - } - } else if (xmlData.length > i + 8 && xmlData[i + 1] === "D" && xmlData[i + 2] === "O" && xmlData[i + 3] === "C" && xmlData[i + 4] === "T" && xmlData[i + 5] === "Y" && xmlData[i + 6] === "P" && xmlData[i + 7] === "E") { - let angleBracketsCount = 1; - for (i += 8; i < xmlData.length; i++) { - if (xmlData[i] === "<") { - angleBracketsCount++; - } else if (xmlData[i] === ">") { - angleBracketsCount--; - if (angleBracketsCount === 0) { - break; - } - } - } - } else if (xmlData.length > i + 9 && xmlData[i + 1] === "[" && xmlData[i + 2] === "C" && xmlData[i + 3] === "D" && xmlData[i + 4] === "A" && xmlData[i + 5] === "T" && xmlData[i + 6] === "A" && xmlData[i + 7] === "[") { - for (i += 8; i < xmlData.length; i++) { - if (xmlData[i] === "]" && xmlData[i + 1] === "]" && xmlData[i + 2] === ">") { - i += 2; - break; - } - } + match = RFC_850_DATE.exec(value); + if (match) { + const [_, dayStr, monthStr, yearStr, hours, minutes, seconds, fractionalMilliseconds] = match; + return adjustRfc850Year( + buildDate(parseTwoDigitYear(yearStr), parseMonthByShortName(monthStr), parseDateValue(dayStr, "day", 1, 31), { + hours, + minutes, + seconds, + fractionalMilliseconds + }) + ); } - return i; - } - var doubleQuote = '"'; - var singleQuote = "'"; - function readAttributeStr(xmlData, i) { - let attrStr = ""; - let startChar = ""; - let tagClosed = false; - for (; i < xmlData.length; i++) { - if (xmlData[i] === doubleQuote || xmlData[i] === singleQuote) { - if (startChar === "") { - startChar = xmlData[i]; - } else if (startChar !== xmlData[i]) { - } else { - startChar = ""; - } - } else if (xmlData[i] === ">") { - if (startChar === "") { - tagClosed = true; - break; - } - } - attrStr += xmlData[i]; + match = ASC_TIME.exec(value); + if (match) { + const [_, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds, yearStr] = match; + return buildDate( + strictParseShort(stripLeadingZeroes(yearStr)), + parseMonthByShortName(monthStr), + parseDateValue(dayStr.trimLeft(), "day", 1, 31), + { hours, minutes, seconds, fractionalMilliseconds } + ); } - if (startChar !== "") { - return false; + throw new TypeError("Invalid RFC-7231 date-time value"); + }, "parseRfc7231DateTime"); + var parseEpochTimestamp = /* @__PURE__ */ __name((value) => { + if (value === null || value === void 0) { + return void 0; } - return { - value: attrStr, - index: i, - tagClosed - }; - } - var validAttrStrRegxp = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); - function validateAttributeString(attrStr, options) { - const matches = util.getAllMatches(attrStr, validAttrStrRegxp); - const attrNames = {}; - for (let i = 0; i < matches.length; i++) { - if (matches[i][1].length === 0) { - return getErrorObject("InvalidAttr", "Attribute '" + matches[i][2] + "' has no space in starting.", getPositionFromMatch(matches[i])); - } else if (matches[i][3] !== void 0 && matches[i][4] === void 0) { - return getErrorObject("InvalidAttr", "Attribute '" + matches[i][2] + "' is without value.", getPositionFromMatch(matches[i])); - } else if (matches[i][3] === void 0 && !options.allowBooleanAttributes) { - return getErrorObject("InvalidAttr", "boolean attribute '" + matches[i][2] + "' is not allowed.", getPositionFromMatch(matches[i])); - } - const attrName = matches[i][2]; - if (!validateAttrName(attrName)) { - return getErrorObject("InvalidAttr", "Attribute '" + attrName + "' is an invalid name.", getPositionFromMatch(matches[i])); - } - if (!attrNames.hasOwnProperty(attrName)) { - attrNames[attrName] = 1; - } else { - return getErrorObject("InvalidAttr", "Attribute '" + attrName + "' is repeated.", getPositionFromMatch(matches[i])); - } + let valueAsDouble; + if (typeof value === "number") { + valueAsDouble = value; + } else if (typeof value === "string") { + valueAsDouble = strictParseDouble(value); + } else if (typeof value === "object" && value.tag === 1) { + valueAsDouble = value.value; + } else { + throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation"); + } + if (Number.isNaN(valueAsDouble) || valueAsDouble === Infinity || valueAsDouble === -Infinity) { + throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics"); + } + return new Date(Math.round(valueAsDouble * 1e3)); + }, "parseEpochTimestamp"); + var buildDate = /* @__PURE__ */ __name((year, month, day, time) => { + const adjustedMonth = month - 1; + validateDayOfMonth(year, adjustedMonth, day); + return new Date( + Date.UTC( + year, + adjustedMonth, + day, + parseDateValue(time.hours, "hour", 0, 23), + parseDateValue(time.minutes, "minute", 0, 59), + // seconds can go up to 60 for leap seconds + parseDateValue(time.seconds, "seconds", 0, 60), + parseMilliseconds(time.fractionalMilliseconds) + ) + ); + }, "buildDate"); + var parseTwoDigitYear = /* @__PURE__ */ __name((value) => { + const thisYear = (/* @__PURE__ */ new Date()).getUTCFullYear(); + const valueInThisCentury = Math.floor(thisYear / 100) * 100 + strictParseShort(stripLeadingZeroes(value)); + if (valueInThisCentury < thisYear) { + return valueInThisCentury + 100; + } + return valueInThisCentury; + }, "parseTwoDigitYear"); + var FIFTY_YEARS_IN_MILLIS = 50 * 365 * 24 * 60 * 60 * 1e3; + var adjustRfc850Year = /* @__PURE__ */ __name((input) => { + if (input.getTime() - (/* @__PURE__ */ new Date()).getTime() > FIFTY_YEARS_IN_MILLIS) { + return new Date( + Date.UTC( + input.getUTCFullYear() - 100, + input.getUTCMonth(), + input.getUTCDate(), + input.getUTCHours(), + input.getUTCMinutes(), + input.getUTCSeconds(), + input.getUTCMilliseconds() + ) + ); + } + return input; + }, "adjustRfc850Year"); + var parseMonthByShortName = /* @__PURE__ */ __name((value) => { + const monthIdx = MONTHS.indexOf(value); + if (monthIdx < 0) { + throw new TypeError(`Invalid month: ${value}`); + } + return monthIdx + 1; + }, "parseMonthByShortName"); + var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + var validateDayOfMonth = /* @__PURE__ */ __name((year, month, day) => { + let maxDays = DAYS_IN_MONTH[month]; + if (month === 1 && isLeapYear(year)) { + maxDays = 29; + } + if (day > maxDays) { + throw new TypeError(`Invalid day for ${MONTHS[month]} in ${year}: ${day}`); + } + }, "validateDayOfMonth"); + var isLeapYear = /* @__PURE__ */ __name((year) => { + return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); + }, "isLeapYear"); + var parseDateValue = /* @__PURE__ */ __name((value, type, lower, upper) => { + const dateVal = strictParseByte(stripLeadingZeroes(value)); + if (dateVal < lower || dateVal > upper) { + throw new TypeError(`${type} must be between ${lower} and ${upper}, inclusive`); + } + return dateVal; + }, "parseDateValue"); + var parseMilliseconds = /* @__PURE__ */ __name((value) => { + if (value === null || value === void 0) { + return 0; + } + return strictParseFloat32("0." + value) * 1e3; + }, "parseMilliseconds"); + var parseOffsetToMilliseconds = /* @__PURE__ */ __name((value) => { + const directionStr = value[0]; + let direction = 1; + if (directionStr == "+") { + direction = 1; + } else if (directionStr == "-") { + direction = -1; + } else { + throw new TypeError(`Offset direction, ${directionStr}, must be "+" or "-"`); + } + const hour = Number(value.substring(1, 3)); + const minute = Number(value.substring(4, 6)); + return direction * (hour * 60 + minute) * 60 * 1e3; + }, "parseOffsetToMilliseconds"); + var stripLeadingZeroes = /* @__PURE__ */ __name((value) => { + let idx = 0; + while (idx < value.length - 1 && value.charAt(idx) === "0") { + idx++; + } + if (idx === 0) { + return value; } - return true; - } - function validateNumberAmpersand(xmlData, i) { - let re = /\d/; - if (xmlData[i] === "x") { - i++; - re = /[\da-fA-F]/; + return value.slice(idx); + }, "stripLeadingZeroes"); + var _ServiceException = class _ServiceException2 extends Error { + constructor(options) { + super(options.message); + Object.setPrototypeOf(this, _ServiceException2.prototype); + this.name = options.name; + this.$fault = options.$fault; + this.$metadata = options.$metadata; } - for (; i < xmlData.length; i++) { - if (xmlData[i] === ";") - return i; - if (!xmlData[i].match(re)) - break; + }; + __name(_ServiceException, "ServiceException"); + var ServiceException = _ServiceException; + var decorateServiceException = /* @__PURE__ */ __name((exception, additions = {}) => { + Object.entries(additions).filter(([, v]) => v !== void 0).forEach(([k, v]) => { + if (exception[k] == void 0 || exception[k] === "") { + exception[k] = v; + } + }); + const message = exception.message || exception.Message || "UnknownError"; + exception.message = message; + delete exception.Message; + return exception; + }, "decorateServiceException"); + var throwDefaultError = /* @__PURE__ */ __name(({ output, parsedBody, exceptionCtor, errorCode }) => { + const $metadata = deserializeMetadata(output); + const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : void 0; + const response = new exceptionCtor({ + name: (parsedBody == null ? void 0 : parsedBody.code) || (parsedBody == null ? void 0 : parsedBody.Code) || errorCode || statusCode || "UnknownError", + $fault: "client", + $metadata + }); + throw decorateServiceException(response, parsedBody); + }, "throwDefaultError"); + var withBaseException = /* @__PURE__ */ __name((ExceptionCtor) => { + return ({ output, parsedBody, errorCode }) => { + throwDefaultError({ output, parsedBody, exceptionCtor: ExceptionCtor, errorCode }); + }; + }, "withBaseException"); + var deserializeMetadata = /* @__PURE__ */ __name((output) => ({ + httpStatusCode: output.statusCode, + requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"], + extendedRequestId: output.headers["x-amz-id-2"], + cfId: output.headers["x-amz-cf-id"] + }), "deserializeMetadata"); + var loadConfigsForDefaultMode = /* @__PURE__ */ __name((mode) => { + switch (mode) { + case "standard": + return { + retryMode: "standard", + connectionTimeout: 3100 + }; + case "in-region": + return { + retryMode: "standard", + connectionTimeout: 1100 + }; + case "cross-region": + return { + retryMode: "standard", + connectionTimeout: 3100 + }; + case "mobile": + return { + retryMode: "standard", + connectionTimeout: 3e4 + }; + default: + return {}; } - return -1; - } - function validateAmpersand(xmlData, i) { - i++; - if (xmlData[i] === ";") - return -1; - if (xmlData[i] === "#") { - i++; - return validateNumberAmpersand(xmlData, i); + }, "loadConfigsForDefaultMode"); + var warningEmitted2 = false; + var emitWarningIfUnsupportedVersion2 = /* @__PURE__ */ __name((version2) => { + if (version2 && !warningEmitted2 && parseInt(version2.substring(1, version2.indexOf("."))) < 16) { + warningEmitted2 = true; } - let count = 0; - for (; i < xmlData.length; i++, count++) { - if (xmlData[i].match(/\w/) && count < 20) + }, "emitWarningIfUnsupportedVersion"); + function extendedEncodeURIComponent(str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function(c) { + return "%" + c.charCodeAt(0).toString(16).toUpperCase(); + }); + } + __name(extendedEncodeURIComponent, "extendedEncodeURIComponent"); + var getChecksumConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { + const checksumAlgorithms = []; + for (const id in import_types5.AlgorithmId) { + const algorithmId = import_types5.AlgorithmId[id]; + if (runtimeConfig[algorithmId] === void 0) { continue; - if (xmlData[i] === ";") - break; - return -1; + } + checksumAlgorithms.push({ + algorithmId: () => algorithmId, + checksumConstructor: () => runtimeConfig[algorithmId] + }); } - return i; - } - function getErrorObject(code, message, lineNumber) { return { - err: { - code, - msg: message, - line: lineNumber.line || lineNumber, - col: lineNumber.col + _checksumAlgorithms: checksumAlgorithms, + addChecksumAlgorithm(algo) { + this._checksumAlgorithms.push(algo); + }, + checksumAlgorithms() { + return this._checksumAlgorithms; } }; - } - function validateAttrName(attrName) { - return util.isName(attrName); - } - function validateTagName(tagname) { - return util.isName(tagname); - } - function getLineNumberForPosition(xmlData, index) { - const lines = xmlData.substring(0, index).split(/\r?\n/); + }, "getChecksumConfiguration"); + var resolveChecksumRuntimeConfig = /* @__PURE__ */ __name((clientConfig) => { + const runtimeConfig = {}; + clientConfig.checksumAlgorithms().forEach((checksumAlgorithm) => { + runtimeConfig[checksumAlgorithm.algorithmId()] = checksumAlgorithm.checksumConstructor(); + }); + return runtimeConfig; + }, "resolveChecksumRuntimeConfig"); + var getRetryConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { + let _retryStrategy = runtimeConfig.retryStrategy; return { - line: lines.length, - // column number is last line's length + 1, because column numbering starts at 1: - col: lines[lines.length - 1].length + 1 + setRetryStrategy(retryStrategy) { + _retryStrategy = retryStrategy; + }, + retryStrategy() { + return _retryStrategy; + } }; - } - function getPositionFromMatch(match) { - return match.startIndex + match[1].length; - } - } -}); - -// ../../../node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js -var require_OptionsBuilder = __commonJS({ - "../../../node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js"(exports2) { - var defaultOptions = { - preserveOrder: false, - attributeNamePrefix: "@_", - attributesGroupName: false, - textNodeName: "#text", - ignoreAttributes: true, - removeNSPrefix: false, - // remove NS from tag name or attribute name if true - allowBooleanAttributes: false, - //a tag can have attributes without any value - //ignoreRootElement : false, - parseTagValue: true, - parseAttributeValue: false, - trimValues: true, - //Trim string values of tag and attributes - cdataPropName: false, - numberParseOptions: { - hex: true, - leadingZeros: true, - eNotation: true - }, - tagValueProcessor: function(tagName, val2) { - return val2; - }, - attributeValueProcessor: function(attrName, val2) { - return val2; - }, - stopNodes: [], - //nested tags will not be parsed even for errors - alwaysCreateTextNode: false, - isArray: () => false, - commentPropName: false, - unpairedTags: [], - processEntities: true, - htmlEntities: false, - ignoreDeclaration: false, - ignorePiTags: false, - transformTagName: false, - transformAttributeName: false, - updateTag: function(tagName, jPath, attrs) { - return tagName; + }, "getRetryConfiguration"); + var resolveRetryRuntimeConfig = /* @__PURE__ */ __name((retryStrategyConfiguration) => { + const runtimeConfig = {}; + runtimeConfig.retryStrategy = retryStrategyConfiguration.retryStrategy(); + return runtimeConfig; + }, "resolveRetryRuntimeConfig"); + var getDefaultExtensionConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { + return { + ...getChecksumConfiguration(runtimeConfig), + ...getRetryConfiguration(runtimeConfig) + }; + }, "getDefaultExtensionConfiguration"); + var getDefaultClientConfiguration = getDefaultExtensionConfiguration; + var resolveDefaultRuntimeConfig = /* @__PURE__ */ __name((config) => { + return { + ...resolveChecksumRuntimeConfig(config), + ...resolveRetryRuntimeConfig(config) + }; + }, "resolveDefaultRuntimeConfig"); + var getArrayIfSingleItem = /* @__PURE__ */ __name((mayBeArray) => Array.isArray(mayBeArray) ? mayBeArray : [mayBeArray], "getArrayIfSingleItem"); + var getValueFromTextNode2 = /* @__PURE__ */ __name((obj) => { + const textNodeName = "#text"; + for (const key in obj) { + if (obj.hasOwnProperty(key) && obj[key][textNodeName] !== void 0) { + obj[key] = obj[key][textNodeName]; + } else if (typeof obj[key] === "object" && obj[key] !== null) { + obj[key] = getValueFromTextNode2(obj[key]); + } + } + return obj; + }, "getValueFromTextNode"); + var isSerializableHeaderValue = /* @__PURE__ */ __name((value) => { + return value != null; + }, "isSerializableHeaderValue"); + var StringWrapper = /* @__PURE__ */ __name(function() { + const Class = Object.getPrototypeOf(this).constructor; + const Constructor = Function.bind.apply(String, [null, ...arguments]); + const instance = new Constructor(); + Object.setPrototypeOf(instance, Class.prototype); + return instance; + }, "StringWrapper"); + StringWrapper.prototype = Object.create(String.prototype, { + constructor: { + value: StringWrapper, + enumerable: false, + writable: true, + configurable: true + } + }); + Object.setPrototypeOf(StringWrapper, String); + var _LazyJsonString = class _LazyJsonString2 extends StringWrapper { + deserializeJSON() { + return JSON.parse(super.toString()); + } + toJSON() { + return super.toString(); + } + static fromObject(object) { + if (object instanceof _LazyJsonString2) { + return object; + } else if (object instanceof String || typeof object === "string") { + return new _LazyJsonString2(object); + } + return new _LazyJsonString2(JSON.stringify(object)); } - // skipEmptyListItem: false - }; - var buildOptions = function(options) { - return Object.assign({}, defaultOptions, options); }; - exports2.buildOptions = buildOptions; - exports2.defaultOptions = defaultOptions; - } -}); - -// ../../../node_modules/fast-xml-parser/src/xmlparser/xmlNode.js -var require_xmlNode = __commonJS({ - "../../../node_modules/fast-xml-parser/src/xmlparser/xmlNode.js"(exports2, module2) { - "use strict"; - var XmlNode = class { - constructor(tagname) { - this.tagname = tagname; - this.child = []; - this[":@"] = {}; + __name(_LazyJsonString, "LazyJsonString"); + var LazyJsonString = _LazyJsonString; + var _NoOpLogger = class _NoOpLogger { + trace() { } - add(key, val2) { - if (key === "__proto__") key = "#__proto__"; - this.child.push({ [key]: val2 }); + debug() { } - addChild(node) { - if (node.tagname === "__proto__") node.tagname = "#__proto__"; - if (node[":@"] && Object.keys(node[":@"]).length > 0) { - this.child.push({ [node.tagname]: node.child, [":@"]: node[":@"] }); + info() { + } + warn() { + } + error() { + } + }; + __name(_NoOpLogger, "NoOpLogger"); + var NoOpLogger = _NoOpLogger; + function map(arg0, arg1, arg2) { + let target; + let filter; + let instructions; + if (typeof arg1 === "undefined" && typeof arg2 === "undefined") { + target = {}; + instructions = arg0; + } else { + target = arg0; + if (typeof arg1 === "function") { + filter = arg1; + instructions = arg2; + return mapWithFilter(target, filter, instructions); } else { - this.child.push({ [node.tagname]: node.child }); + instructions = arg1; } } - }; - module2.exports = XmlNode; - } -}); - -// ../../../node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js -var require_DocTypeReader = __commonJS({ - "../../../node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js"(exports2, module2) { - var util = require_util2(); - function readDocType(xmlData, i) { - const entities = {}; - if (xmlData[i + 3] === "O" && xmlData[i + 4] === "C" && xmlData[i + 5] === "T" && xmlData[i + 6] === "Y" && xmlData[i + 7] === "P" && xmlData[i + 8] === "E") { - i = i + 9; - let angleBracketsCount = 1; - let hasBody = false, comment = false; - let exp = ""; - for (; i < xmlData.length; i++) { - if (xmlData[i] === "<" && !comment) { - if (hasBody && isEntity(xmlData, i)) { - i += 7; - [entityName, val, i] = readEntityExp(xmlData, i + 1); - if (val.indexOf("&") === -1) - entities[validateEntityName(entityName)] = { - regx: RegExp(`&${entityName};`, "g"), - val - }; - } else if (hasBody && isElement(xmlData, i)) i += 8; - else if (hasBody && isAttlist(xmlData, i)) i += 8; - else if (hasBody && isNotation(xmlData, i)) i += 9; - else if (isComment) comment = true; - else throw new Error("Invalid DOCTYPE"); - angleBracketsCount++; - exp = ""; - } else if (xmlData[i] === ">") { - if (comment) { - if (xmlData[i - 1] === "-" && xmlData[i - 2] === "-") { - comment = false; - angleBracketsCount--; - } + for (const key of Object.keys(instructions)) { + if (!Array.isArray(instructions[key])) { + target[key] = instructions[key]; + continue; + } + applyInstruction(target, null, instructions, key); + } + return target; + } + __name(map, "map"); + var convertMap = /* @__PURE__ */ __name((target) => { + const output = {}; + for (const [k, v] of Object.entries(target || {})) { + output[k] = [, v]; + } + return output; + }, "convertMap"); + var take = /* @__PURE__ */ __name((source, instructions) => { + const out = {}; + for (const key in instructions) { + applyInstruction(out, source, instructions, key); + } + return out; + }, "take"); + var mapWithFilter = /* @__PURE__ */ __name((target, filter, instructions) => { + return map( + target, + Object.entries(instructions).reduce( + (_instructions, [key, value]) => { + if (Array.isArray(value)) { + _instructions[key] = value; } else { - angleBracketsCount--; - } - if (angleBracketsCount === 0) { - break; + if (typeof value === "function") { + _instructions[key] = [filter, value()]; + } else { + _instructions[key] = [filter, value]; + } } - } else if (xmlData[i] === "[") { - hasBody = true; - } else { - exp += xmlData[i]; - } + return _instructions; + }, + {} + ) + ); + }, "mapWithFilter"); + var applyInstruction = /* @__PURE__ */ __name((target, source, instructions, targetKey) => { + if (source !== null) { + let instruction = instructions[targetKey]; + if (typeof instruction === "function") { + instruction = [, instruction]; } - if (angleBracketsCount !== 0) { - throw new Error(`Unclosed DOCTYPE`); + const [filter2 = nonNullish, valueFn = pass, sourceKey = targetKey] = instruction; + if (typeof filter2 === "function" && filter2(source[sourceKey]) || typeof filter2 !== "function" && !!filter2) { + target[targetKey] = valueFn(source[sourceKey]); } - } else { - throw new Error(`Invalid Tag instead of DOCTYPE`); + return; } - return { entities, i }; - } - function readEntityExp(xmlData, i) { - let entityName2 = ""; - for (; i < xmlData.length && (xmlData[i] !== "'" && xmlData[i] !== '"'); i++) { - entityName2 += xmlData[i]; + let [filter, value] = instructions[targetKey]; + if (typeof value === "function") { + let _value; + const defaultFilterPassed = filter === void 0 && (_value = value()) != null; + const customFilterPassed = typeof filter === "function" && !!filter(void 0) || typeof filter !== "function" && !!filter; + if (defaultFilterPassed) { + target[targetKey] = _value; + } else if (customFilterPassed) { + target[targetKey] = value(); + } + } else { + const defaultFilterPassed = filter === void 0 && value != null; + const customFilterPassed = typeof filter === "function" && !!filter(value) || typeof filter !== "function" && !!filter; + if (defaultFilterPassed || customFilterPassed) { + target[targetKey] = value; + } } - entityName2 = entityName2.trim(); - if (entityName2.indexOf(" ") !== -1) throw new Error("External entites are not supported"); - const startChar = xmlData[i++]; - let val2 = ""; - for (; i < xmlData.length && xmlData[i] !== startChar; i++) { - val2 += xmlData[i]; + }, "applyInstruction"); + var nonNullish = /* @__PURE__ */ __name((_) => _ != null, "nonNullish"); + var pass = /* @__PURE__ */ __name((_) => _, "pass"); + function quoteHeader(part) { + if (part.includes(",") || part.includes('"')) { + part = `"${part.replace(/"/g, '\\"')}"`; } - return [entityName2, val2, i]; - } - function isComment(xmlData, i) { - if (xmlData[i + 1] === "!" && xmlData[i + 2] === "-" && xmlData[i + 3] === "-") return true; - return false; - } - function isEntity(xmlData, i) { - if (xmlData[i + 1] === "!" && xmlData[i + 2] === "E" && xmlData[i + 3] === "N" && xmlData[i + 4] === "T" && xmlData[i + 5] === "I" && xmlData[i + 6] === "T" && xmlData[i + 7] === "Y") return true; - return false; - } - function isElement(xmlData, i) { - if (xmlData[i + 1] === "!" && xmlData[i + 2] === "E" && xmlData[i + 3] === "L" && xmlData[i + 4] === "E" && xmlData[i + 5] === "M" && xmlData[i + 6] === "E" && xmlData[i + 7] === "N" && xmlData[i + 8] === "T") return true; - return false; - } - function isAttlist(xmlData, i) { - if (xmlData[i + 1] === "!" && xmlData[i + 2] === "A" && xmlData[i + 3] === "T" && xmlData[i + 4] === "T" && xmlData[i + 5] === "L" && xmlData[i + 6] === "I" && xmlData[i + 7] === "S" && xmlData[i + 8] === "T") return true; - return false; - } - function isNotation(xmlData, i) { - if (xmlData[i + 1] === "!" && xmlData[i + 2] === "N" && xmlData[i + 3] === "O" && xmlData[i + 4] === "T" && xmlData[i + 5] === "A" && xmlData[i + 6] === "T" && xmlData[i + 7] === "I" && xmlData[i + 8] === "O" && xmlData[i + 9] === "N") return true; - return false; - } - function validateEntityName(name) { - if (util.isName(name)) - return name; - else - throw new Error(`Invalid entity name ${name}`); - } - module2.exports = readDocType; - } -}); - -// ../../../node_modules/strnum/strnum.js -var require_strnum = __commonJS({ - "../../../node_modules/strnum/strnum.js"(exports2, module2) { - var hexRegex = /^[-+]?0x[a-fA-F0-9]+$/; - var numRegex = /^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/; - if (!Number.parseInt && window.parseInt) { - Number.parseInt = window.parseInt; - } - if (!Number.parseFloat && window.parseFloat) { - Number.parseFloat = window.parseFloat; + return part; } - var consider = { - hex: true, - leadingZeros: true, - decimalPoint: ".", - eNotation: true - //skipLike: /regex/ - }; - function toNumber(str, options = {}) { - options = Object.assign({}, consider, options); - if (!str || typeof str !== "string") return str; - let trimmedStr = str.trim(); - if (options.skipLike !== void 0 && options.skipLike.test(trimmedStr)) return str; - else if (options.hex && hexRegex.test(trimmedStr)) { - return Number.parseInt(trimmedStr, 16); + __name(quoteHeader, "quoteHeader"); + var resolvedPath2 = /* @__PURE__ */ __name((resolvedPath22, input, memberName, labelValueProvider, uriLabel, isGreedyLabel) => { + if (input != null && input[memberName] !== void 0) { + const labelValue = labelValueProvider(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: " + memberName + "."); + } + resolvedPath22 = resolvedPath22.replace( + uriLabel, + isGreedyLabel ? labelValue.split("/").map((segment) => extendedEncodeURIComponent(segment)).join("/") : extendedEncodeURIComponent(labelValue) + ); } else { - const match = numRegex.exec(trimmedStr); - if (match) { - const sign = match[1]; - const leadingZeros = match[2]; - let numTrimmedByZeros = trimZeros(match[3]); - const eNotation = match[4] || match[6]; - if (!options.leadingZeros && leadingZeros.length > 0 && sign && trimmedStr[2] !== ".") return str; - else if (!options.leadingZeros && leadingZeros.length > 0 && !sign && trimmedStr[1] !== ".") return str; - else { - const num = Number(trimmedStr); - const numStr = "" + num; - if (numStr.search(/[eE]/) !== -1) { - if (options.eNotation) return num; - else return str; - } else if (eNotation) { - if (options.eNotation) return num; - else return str; - } else if (trimmedStr.indexOf(".") !== -1) { - if (numStr === "0" && numTrimmedByZeros === "") return num; - else if (numStr === numTrimmedByZeros) return num; - else if (sign && numStr === "-" + numTrimmedByZeros) return num; - else return str; - } - if (leadingZeros) { - if (numTrimmedByZeros === numStr) return num; - else if (sign + numTrimmedByZeros === numStr) return num; - else return str; - } - if (trimmedStr === numStr) return num; - else if (trimmedStr === sign + numStr) return num; - return str; + throw new Error("No value provided for input HTTP label: " + memberName + "."); + } + return resolvedPath22; + }, "resolvedPath"); + var serializeFloat = /* @__PURE__ */ __name((value) => { + if (value !== value) { + return "NaN"; + } + switch (value) { + case Infinity: + return "Infinity"; + case -Infinity: + return "-Infinity"; + default: + return value; + } + }, "serializeFloat"); + var serializeDateTime = /* @__PURE__ */ __name((date) => date.toISOString().replace(".000Z", "Z"), "serializeDateTime"); + var _json = /* @__PURE__ */ __name((obj) => { + if (obj == null) { + return {}; + } + if (Array.isArray(obj)) { + return obj.filter((_) => _ != null).map(_json); + } + if (typeof obj === "object") { + const target = {}; + for (const key of Object.keys(obj)) { + if (obj[key] == null) { + continue; } + target[key] = _json(obj[key]); + } + return target; + } + return obj; + }, "_json"); + function splitEvery(value, delimiter, numDelimiters) { + if (numDelimiters <= 0 || !Number.isInteger(numDelimiters)) { + throw new Error("Invalid number of delimiters (" + numDelimiters + ") for splitEvery."); + } + const segments = value.split(delimiter); + if (numDelimiters === 1) { + return segments; + } + const compoundSegments = []; + let currentSegment = ""; + for (let i = 0; i < segments.length; i++) { + if (currentSegment === "") { + currentSegment = segments[i]; } else { - return str; + currentSegment += delimiter + segments[i]; + } + if ((i + 1) % numDelimiters === 0) { + compoundSegments.push(currentSegment); + currentSegment = ""; } } - } - function trimZeros(numStr) { - if (numStr && numStr.indexOf(".") !== -1) { - numStr = numStr.replace(/0+$/, ""); - if (numStr === ".") numStr = "0"; - else if (numStr[0] === ".") numStr = "0" + numStr; - else if (numStr[numStr.length - 1] === ".") numStr = numStr.substr(0, numStr.length - 1); - return numStr; + if (currentSegment !== "") { + compoundSegments.push(currentSegment); } - return numStr; + return compoundSegments; } - module2.exports = toNumber; + __name(splitEvery, "splitEvery"); + var splitHeader = /* @__PURE__ */ __name((value) => { + const z = value.length; + const values = []; + let withinQuotes = false; + let prevChar = void 0; + let anchor = 0; + for (let i = 0; i < z; ++i) { + const char = value[i]; + switch (char) { + case `"`: + if (prevChar !== "\\") { + withinQuotes = !withinQuotes; + } + break; + case ",": + if (!withinQuotes) { + values.push(value.slice(anchor, i)); + anchor = i + 1; + } + break; + default: + } + prevChar = char; + } + values.push(value.slice(anchor)); + return values.map((v) => { + v = v.trim(); + const z2 = v.length; + if (z2 < 2) { + return v; + } + if (v[0] === `"` && v[z2 - 1] === `"`) { + v = v.slice(1, z2 - 1); + } + return v.replace(/\\"/g, '"'); + }); + }, "splitHeader"); } }); -// ../../../node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js -var require_OrderedObjParser = __commonJS({ - "../../../node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js"(exports2, module2) { +// ../../../node_modules/@smithy/middleware-retry/dist-cjs/isStreamingPayload/isStreamingPayload.js +var require_isStreamingPayload = __commonJS({ + "../../../node_modules/@smithy/middleware-retry/dist-cjs/isStreamingPayload/isStreamingPayload.js"(exports2) { "use strict"; - var util = require_util2(); - var xmlNode = require_xmlNode(); - var readDocType = require_DocTypeReader(); - var toNumber = require_strnum(); - var regx = "<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)".replace(/NAME/g, util.nameRegexp); - var OrderedObjParser = class { - constructor(options) { - this.options = options; - this.currentNode = null; - this.tagsNodeStack = []; - this.docTypeEntities = {}; - this.lastEntities = { - "apos": { regex: /&(apos|#39|#x27);/g, val: "'" }, - "gt": { regex: /&(gt|#62|#x3E);/g, val: ">" }, - "lt": { regex: /&(lt|#60|#x3C);/g, val: "<" }, - "quot": { regex: /&(quot|#34|#x22);/g, val: '"' } - }; - this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }; - this.htmlEntities = { - "space": { regex: /&(nbsp|#160);/g, val: " " }, - // "lt" : { regex: /&(lt|#60);/g, val: "<" }, - // "gt" : { regex: /&(gt|#62);/g, val: ">" }, - // "amp" : { regex: /&(amp|#38);/g, val: "&" }, - // "quot" : { regex: /&(quot|#34);/g, val: "\"" }, - // "apos" : { regex: /&(apos|#39);/g, val: "'" }, - "cent": { regex: /&(cent|#162);/g, val: "\xA2" }, - "pound": { regex: /&(pound|#163);/g, val: "\xA3" }, - "yen": { regex: /&(yen|#165);/g, val: "\xA5" }, - "euro": { regex: /&(euro|#8364);/g, val: "\u20AC" }, - "copyright": { regex: /&(copy|#169);/g, val: "\xA9" }, - "reg": { regex: /&(reg|#174);/g, val: "\xAE" }, - "inr": { regex: /&(inr|#8377);/g, val: "\u20B9" } - }; - this.addExternalEntities = addExternalEntities; - this.parseXml = parseXml; - this.parseTextData = parseTextData; - this.resolveNameSpace = resolveNameSpace; - this.buildAttributesMap = buildAttributesMap; - this.isItStopNode = isItStopNode; - this.replaceEntitiesValue = replaceEntitiesValue; - this.readStopNodeData = readStopNodeData; - this.saveTextToParentTag = saveTextToParentTag; - this.addChild = addChild; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.isStreamingPayload = void 0; + var stream_1 = require("stream"); + var isStreamingPayload = (request2) => (request2 === null || request2 === void 0 ? void 0 : request2.body) instanceof stream_1.Readable || typeof ReadableStream !== "undefined" && (request2 === null || request2 === void 0 ? void 0 : request2.body) instanceof ReadableStream; + exports2.isStreamingPayload = isStreamingPayload; + } +}); + +// ../../../node_modules/@smithy/middleware-retry/dist-cjs/index.js +var require_dist_cjs38 = __commonJS({ + "../../../node_modules/@smithy/middleware-retry/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - function addExternalEntities(externalEntities) { - const entKeys = Object.keys(externalEntities); - for (let i = 0; i < entKeys.length; i++) { - const ent = entKeys[i]; - this.lastEntities[ent] = { - regex: new RegExp("&" + ent + ";", "g"), - val: externalEntities[ent] - }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + AdaptiveRetryStrategy: () => AdaptiveRetryStrategy, + CONFIG_MAX_ATTEMPTS: () => CONFIG_MAX_ATTEMPTS, + CONFIG_RETRY_MODE: () => CONFIG_RETRY_MODE, + ENV_MAX_ATTEMPTS: () => ENV_MAX_ATTEMPTS, + ENV_RETRY_MODE: () => ENV_RETRY_MODE, + NODE_MAX_ATTEMPT_CONFIG_OPTIONS: () => NODE_MAX_ATTEMPT_CONFIG_OPTIONS, + NODE_RETRY_MODE_CONFIG_OPTIONS: () => NODE_RETRY_MODE_CONFIG_OPTIONS, + StandardRetryStrategy: () => StandardRetryStrategy, + defaultDelayDecider: () => defaultDelayDecider, + defaultRetryDecider: () => defaultRetryDecider, + getOmitRetryHeadersPlugin: () => getOmitRetryHeadersPlugin, + getRetryAfterHint: () => getRetryAfterHint, + getRetryPlugin: () => getRetryPlugin, + omitRetryHeadersMiddleware: () => omitRetryHeadersMiddleware, + omitRetryHeadersMiddlewareOptions: () => omitRetryHeadersMiddlewareOptions, + resolveRetryConfig: () => resolveRetryConfig, + retryMiddleware: () => retryMiddleware, + retryMiddlewareOptions: () => retryMiddlewareOptions2 + }); + module2.exports = __toCommonJS2(src_exports); + var import_protocol_http8 = require_dist_cjs21(); + var import_uuid = (init_esm_node(), __toCommonJS(esm_node_exports)); + var import_util_retry = require_dist_cjs23(); + var getDefaultRetryQuota = /* @__PURE__ */ __name((initialRetryTokens, options) => { + const MAX_CAPACITY = initialRetryTokens; + const noRetryIncrement = (options == null ? void 0 : options.noRetryIncrement) ?? import_util_retry.NO_RETRY_INCREMENT; + const retryCost = (options == null ? void 0 : options.retryCost) ?? import_util_retry.RETRY_COST; + const timeoutRetryCost = (options == null ? void 0 : options.timeoutRetryCost) ?? import_util_retry.TIMEOUT_RETRY_COST; + let availableCapacity = initialRetryTokens; + const getCapacityAmount = /* @__PURE__ */ __name((error) => error.name === "TimeoutError" ? timeoutRetryCost : retryCost, "getCapacityAmount"); + const hasRetryTokens = /* @__PURE__ */ __name((error) => getCapacityAmount(error) <= availableCapacity, "hasRetryTokens"); + const retrieveRetryTokens = /* @__PURE__ */ __name((error) => { + if (!hasRetryTokens(error)) { + throw new Error("No retry token available"); + } + const capacityAmount = getCapacityAmount(error); + availableCapacity -= capacityAmount; + return capacityAmount; + }, "retrieveRetryTokens"); + const releaseRetryTokens = /* @__PURE__ */ __name((capacityReleaseAmount) => { + availableCapacity += capacityReleaseAmount ?? noRetryIncrement; + availableCapacity = Math.min(availableCapacity, MAX_CAPACITY); + }, "releaseRetryTokens"); + return Object.freeze({ + hasRetryTokens, + retrieveRetryTokens, + releaseRetryTokens + }); + }, "getDefaultRetryQuota"); + var defaultDelayDecider = /* @__PURE__ */ __name((delayBase, attempts) => Math.floor(Math.min(import_util_retry.MAXIMUM_RETRY_DELAY, Math.random() * 2 ** attempts * delayBase)), "defaultDelayDecider"); + var import_service_error_classification = require_dist_cjs22(); + var defaultRetryDecider = /* @__PURE__ */ __name((error) => { + if (!error) { + return false; + } + return (0, import_service_error_classification.isRetryableByTrait)(error) || (0, import_service_error_classification.isClockSkewError)(error) || (0, import_service_error_classification.isThrottlingError)(error) || (0, import_service_error_classification.isTransientError)(error); + }, "defaultRetryDecider"); + var asSdkError = /* @__PURE__ */ __name((error) => { + if (error instanceof Error) + return error; + if (error instanceof Object) + return Object.assign(new Error(), error); + if (typeof error === "string") + return new Error(error); + return new Error(`AWS SDK error wrapper for ${error}`); + }, "asSdkError"); + var _StandardRetryStrategy = class _StandardRetryStrategy { + constructor(maxAttemptsProvider, options) { + this.maxAttemptsProvider = maxAttemptsProvider; + this.mode = import_util_retry.RETRY_MODES.STANDARD; + this.retryDecider = (options == null ? void 0 : options.retryDecider) ?? defaultRetryDecider; + this.delayDecider = (options == null ? void 0 : options.delayDecider) ?? defaultDelayDecider; + this.retryQuota = (options == null ? void 0 : options.retryQuota) ?? getDefaultRetryQuota(import_util_retry.INITIAL_RETRY_TOKENS); } - } - function parseTextData(val2, tagName, jPath, dontTrim, hasAttributes, isLeafNode, escapeEntities) { - if (val2 !== void 0) { - if (this.options.trimValues && !dontTrim) { - val2 = val2.trim(); - } - if (val2.length > 0) { - if (!escapeEntities) val2 = this.replaceEntitiesValue(val2); - const newval = this.options.tagValueProcessor(tagName, val2, jPath, hasAttributes, isLeafNode); - if (newval === null || newval === void 0) { - return val2; - } else if (typeof newval !== typeof val2 || newval !== val2) { - return newval; - } else if (this.options.trimValues) { - return parseValue(val2, this.options.parseTagValue, this.options.numberParseOptions); - } else { - const trimmedVal = val2.trim(); - if (trimmedVal === val2) { - return parseValue(val2, this.options.parseTagValue, this.options.numberParseOptions); - } else { - return val2; - } - } - } + shouldRetry(error, attempts, maxAttempts) { + return attempts < maxAttempts && this.retryDecider(error) && this.retryQuota.hasRetryTokens(error); } - } - function resolveNameSpace(tagname) { - if (this.options.removeNSPrefix) { - const tags = tagname.split(":"); - const prefix = tagname.charAt(0) === "/" ? "/" : ""; - if (tags[0] === "xmlns") { - return ""; - } - if (tags.length === 2) { - tagname = prefix + tags[1]; + async getMaxAttempts() { + let maxAttempts; + try { + maxAttempts = await this.maxAttemptsProvider(); + } catch (error) { + maxAttempts = import_util_retry.DEFAULT_MAX_ATTEMPTS; } + return maxAttempts; } - return tagname; - } - var attrsRegx = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); - function buildAttributesMap(attrStr, jPath, tagName) { - if (!this.options.ignoreAttributes && typeof attrStr === "string") { - const matches = util.getAllMatches(attrStr, attrsRegx); - const len = matches.length; - const attrs = {}; - for (let i = 0; i < len; i++) { - const attrName = this.resolveNameSpace(matches[i][1]); - let oldVal = matches[i][4]; - let aName = this.options.attributeNamePrefix + attrName; - if (attrName.length) { - if (this.options.transformAttributeName) { - aName = this.options.transformAttributeName(aName); - } - if (aName === "__proto__") aName = "#__proto__"; - if (oldVal !== void 0) { - if (this.options.trimValues) { - oldVal = oldVal.trim(); - } - oldVal = this.replaceEntitiesValue(oldVal); - const newVal = this.options.attributeValueProcessor(attrName, oldVal, jPath); - if (newVal === null || newVal === void 0) { - attrs[aName] = oldVal; - } else if (typeof newVal !== typeof oldVal || newVal !== oldVal) { - attrs[aName] = newVal; - } else { - attrs[aName] = parseValue( - oldVal, - this.options.parseAttributeValue, - this.options.numberParseOptions - ); - } - } else if (this.options.allowBooleanAttributes) { - attrs[aName] = true; - } - } - } - if (!Object.keys(attrs).length) { - return; - } - if (this.options.attributesGroupName) { - const attrCollection = {}; - attrCollection[this.options.attributesGroupName] = attrs; - return attrCollection; + async retry(next, args, options) { + let retryTokenAmount; + let attempts = 0; + let totalDelay = 0; + const maxAttempts = await this.getMaxAttempts(); + const { request: request2 } = args; + if (import_protocol_http8.HttpRequest.isInstance(request2)) { + request2.headers[import_util_retry.INVOCATION_ID_HEADER] = (0, import_uuid.v4)(); } - return attrs; - } - } - var parseXml = function(xmlData) { - xmlData = xmlData.replace(/\r\n?/g, "\n"); - const xmlObj = new xmlNode("!xml"); - let currentNode = xmlObj; - let textData = ""; - let jPath = ""; - for (let i = 0; i < xmlData.length; i++) { - const ch = xmlData[i]; - if (ch === "<") { - if (xmlData[i + 1] === "/") { - const closeIndex = findClosingIndex(xmlData, ">", i, "Closing Tag is not closed."); - let tagName = xmlData.substring(i + 2, closeIndex).trim(); - if (this.options.removeNSPrefix) { - const colonIndex = tagName.indexOf(":"); - if (colonIndex !== -1) { - tagName = tagName.substr(colonIndex + 1); - } - } - if (this.options.transformTagName) { - tagName = this.options.transformTagName(tagName); - } - if (currentNode) { - textData = this.saveTextToParentTag(textData, currentNode, jPath); - } - const lastTagName = jPath.substring(jPath.lastIndexOf(".") + 1); - if (tagName && this.options.unpairedTags.indexOf(tagName) !== -1) { - throw new Error(`Unpaired tag can not be used as closing tag: `); - } - let propIndex = 0; - if (lastTagName && this.options.unpairedTags.indexOf(lastTagName) !== -1) { - propIndex = jPath.lastIndexOf(".", jPath.lastIndexOf(".") - 1); - this.tagsNodeStack.pop(); - } else { - propIndex = jPath.lastIndexOf("."); - } - jPath = jPath.substring(0, propIndex); - currentNode = this.tagsNodeStack.pop(); - textData = ""; - i = closeIndex; - } else if (xmlData[i + 1] === "?") { - let tagData = readTagExp(xmlData, i, false, "?>"); - if (!tagData) throw new Error("Pi Tag is not closed."); - textData = this.saveTextToParentTag(textData, currentNode, jPath); - if (this.options.ignoreDeclaration && tagData.tagName === "?xml" || this.options.ignorePiTags) { - } else { - const childNode = new xmlNode(tagData.tagName); - childNode.add(this.options.textNodeName, ""); - if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent) { - childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath, tagData.tagName); - } - this.addChild(currentNode, childNode, jPath); - } - i = tagData.closeIndex + 1; - } else if (xmlData.substr(i + 1, 3) === "!--") { - const endIndex = findClosingIndex(xmlData, "-->", i + 4, "Comment is not closed."); - if (this.options.commentPropName) { - const comment = xmlData.substring(i + 4, endIndex - 2); - textData = this.saveTextToParentTag(textData, currentNode, jPath); - currentNode.add(this.options.commentPropName, [{ [this.options.textNodeName]: comment }]); - } - i = endIndex; - } else if (xmlData.substr(i + 1, 2) === "!D") { - const result = readDocType(xmlData, i); - this.docTypeEntities = result.entities; - i = result.i; - } else if (xmlData.substr(i + 1, 2) === "![") { - const closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2; - const tagExp = xmlData.substring(i + 9, closeIndex); - textData = this.saveTextToParentTag(textData, currentNode, jPath); - if (this.options.cdataPropName) { - currentNode.add(this.options.cdataPropName, [{ [this.options.textNodeName]: tagExp }]); - } else { - let val2 = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true); - if (val2 == void 0) val2 = ""; - currentNode.add(this.options.textNodeName, val2); - } - i = closeIndex + 2; - } else { - let result = readTagExp(xmlData, i, this.options.removeNSPrefix); - let tagName = result.tagName; - let tagExp = result.tagExp; - let attrExpPresent = result.attrExpPresent; - let closeIndex = result.closeIndex; - if (this.options.transformTagName) { - tagName = this.options.transformTagName(tagName); - } - if (currentNode && textData) { - if (currentNode.tagname !== "!xml") { - textData = this.saveTextToParentTag(textData, currentNode, jPath, false); - } - } - const lastTag = currentNode; - if (lastTag && this.options.unpairedTags.indexOf(lastTag.tagname) !== -1) { - currentNode = this.tagsNodeStack.pop(); - jPath = jPath.substring(0, jPath.lastIndexOf(".")); - } - if (tagName !== xmlObj.tagname) { - jPath += jPath ? "." + tagName : tagName; + while (true) { + try { + if (import_protocol_http8.HttpRequest.isInstance(request2)) { + request2.headers[import_util_retry.REQUEST_HEADER] = `attempt=${attempts + 1}; max=${maxAttempts}`; } - if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) { - let tagContent = ""; - if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) { - i = result.closeIndex; - } else if (this.options.unpairedTags.indexOf(tagName) !== -1) { - i = result.closeIndex; - } else { - const result2 = this.readStopNodeData(xmlData, tagName, closeIndex + 1); - if (!result2) throw new Error(`Unexpected end of ${tagName}`); - i = result2.i; - tagContent = result2.tagContent; - } - const childNode = new xmlNode(tagName); - if (tagName !== tagExp && attrExpPresent) { - childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName); - } - if (tagContent) { - tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true); - } - jPath = jPath.substr(0, jPath.lastIndexOf(".")); - childNode.add(this.options.textNodeName, tagContent); - this.addChild(currentNode, childNode, jPath); - } else { - if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) { - if (tagName[tagName.length - 1] === "/") { - tagName = tagName.substr(0, tagName.length - 1); - tagExp = tagName; - } else { - tagExp = tagExp.substr(0, tagExp.length - 1); - } - if (this.options.transformTagName) { - tagName = this.options.transformTagName(tagName); - } - const childNode = new xmlNode(tagName); - if (tagName !== tagExp && attrExpPresent) { - childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName); - } - this.addChild(currentNode, childNode, jPath); - jPath = jPath.substr(0, jPath.lastIndexOf(".")); - } else { - const childNode = new xmlNode(tagName); - this.tagsNodeStack.push(currentNode); - if (tagName !== tagExp && attrExpPresent) { - childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName); - } - this.addChild(currentNode, childNode, jPath); - currentNode = childNode; - } - textData = ""; - i = closeIndex; + if (options == null ? void 0 : options.beforeRequest) { + await options.beforeRequest(); } + const { response, output } = await next(args); + if (options == null ? void 0 : options.afterRequest) { + options.afterRequest(response); + } + this.retryQuota.releaseRetryTokens(retryTokenAmount); + output.$metadata.attempts = attempts + 1; + output.$metadata.totalRetryDelay = totalDelay; + return { response, output }; + } catch (e) { + const err = asSdkError(e); + attempts++; + if (this.shouldRetry(err, attempts, maxAttempts)) { + retryTokenAmount = this.retryQuota.retrieveRetryTokens(err); + const delayFromDecider = this.delayDecider( + (0, import_service_error_classification.isThrottlingError)(err) ? import_util_retry.THROTTLING_RETRY_DELAY_BASE : import_util_retry.DEFAULT_RETRY_DELAY_BASE, + attempts + ); + const delayFromResponse = getDelayFromRetryAfterHeader(err.$response); + const delay = Math.max(delayFromResponse || 0, delayFromDecider); + totalDelay += delay; + await new Promise((resolve) => setTimeout(resolve, delay)); + continue; + } + if (!err.$metadata) { + err.$metadata = {}; + } + err.$metadata.attempts = attempts; + err.$metadata.totalRetryDelay = totalDelay; + throw err; } - } else { - textData += xmlData[i]; } } - return xmlObj.child; }; - function addChild(currentNode, childNode, jPath) { - const result = this.options.updateTag(childNode.tagname, jPath, childNode[":@"]); - if (result === false) { - } else if (typeof result === "string") { - childNode.tagname = result; - currentNode.addChild(childNode); - } else { - currentNode.addChild(childNode); + __name(_StandardRetryStrategy, "StandardRetryStrategy"); + var StandardRetryStrategy = _StandardRetryStrategy; + var getDelayFromRetryAfterHeader = /* @__PURE__ */ __name((response) => { + if (!import_protocol_http8.HttpResponse.isInstance(response)) + return; + const retryAfterHeaderName = Object.keys(response.headers).find((key) => key.toLowerCase() === "retry-after"); + if (!retryAfterHeaderName) + return; + const retryAfter = response.headers[retryAfterHeaderName]; + const retryAfterSeconds = Number(retryAfter); + if (!Number.isNaN(retryAfterSeconds)) + return retryAfterSeconds * 1e3; + const retryAfterDate = new Date(retryAfter); + return retryAfterDate.getTime() - Date.now(); + }, "getDelayFromRetryAfterHeader"); + var _AdaptiveRetryStrategy = class _AdaptiveRetryStrategy extends StandardRetryStrategy { + constructor(maxAttemptsProvider, options) { + const { rateLimiter, ...superOptions } = options ?? {}; + super(maxAttemptsProvider, superOptions); + this.rateLimiter = rateLimiter ?? new import_util_retry.DefaultRateLimiter(); + this.mode = import_util_retry.RETRY_MODES.ADAPTIVE; } - } - var replaceEntitiesValue = function(val2) { - if (this.options.processEntities) { - for (let entityName2 in this.docTypeEntities) { - const entity = this.docTypeEntities[entityName2]; - val2 = val2.replace(entity.regx, entity.val); - } - for (let entityName2 in this.lastEntities) { - const entity = this.lastEntities[entityName2]; - val2 = val2.replace(entity.regex, entity.val); - } - if (this.options.htmlEntities) { - for (let entityName2 in this.htmlEntities) { - const entity = this.htmlEntities[entityName2]; - val2 = val2.replace(entity.regex, entity.val); + async retry(next, args) { + return super.retry(next, args, { + beforeRequest: async () => { + return this.rateLimiter.getSendToken(); + }, + afterRequest: (response) => { + this.rateLimiter.updateClientSendingRate(response); } - } - val2 = val2.replace(this.ampEntity.regex, this.ampEntity.val); + }); } - return val2; }; - function saveTextToParentTag(textData, currentNode, jPath, isLeafNode) { - if (textData) { - if (isLeafNode === void 0) isLeafNode = Object.keys(currentNode.child).length === 0; - textData = this.parseTextData( - textData, - currentNode.tagname, - jPath, - false, - currentNode[":@"] ? Object.keys(currentNode[":@"]).length !== 0 : false, - isLeafNode - ); - if (textData !== void 0 && textData !== "") - currentNode.add(this.options.textNodeName, textData); - textData = ""; - } - return textData; - } - function isItStopNode(stopNodes, jPath, currentTagName) { - const allNodesExp = "*." + currentTagName; - for (const stopNodePath in stopNodes) { - const stopNodeExp = stopNodes[stopNodePath]; - if (allNodesExp === stopNodeExp || jPath === stopNodeExp) return true; - } - return false; - } - function tagExpWithClosingIndex(xmlData, i, closingChar = ">") { - let attrBoundary; - let tagExp = ""; - for (let index = i; index < xmlData.length; index++) { - let ch = xmlData[index]; - if (attrBoundary) { - if (ch === attrBoundary) attrBoundary = ""; - } else if (ch === '"' || ch === "'") { - attrBoundary = ch; - } else if (ch === closingChar[0]) { - if (closingChar[1]) { - if (xmlData[index + 1] === closingChar[1]) { - return { - data: tagExp, - index - }; - } - } else { - return { - data: tagExp, - index - }; - } - } else if (ch === " ") { - ch = " "; + __name(_AdaptiveRetryStrategy, "AdaptiveRetryStrategy"); + var AdaptiveRetryStrategy = _AdaptiveRetryStrategy; + var import_util_middleware3 = require_dist_cjs24(); + var ENV_MAX_ATTEMPTS = "AWS_MAX_ATTEMPTS"; + var CONFIG_MAX_ATTEMPTS = "max_attempts"; + var NODE_MAX_ATTEMPT_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => { + const value = env[ENV_MAX_ATTEMPTS]; + if (!value) + return void 0; + const maxAttempt = parseInt(value); + if (Number.isNaN(maxAttempt)) { + throw new Error(`Environment variable ${ENV_MAX_ATTEMPTS} mast be a number, got "${value}"`); } - tagExp += ch; - } - } - function findClosingIndex(xmlData, str, i, errMsg) { - const closingIndex = xmlData.indexOf(str, i); - if (closingIndex === -1) { - throw new Error(errMsg); - } else { - return closingIndex + str.length - 1; - } - } - function readTagExp(xmlData, i, removeNSPrefix, closingChar = ">") { - const result = tagExpWithClosingIndex(xmlData, i + 1, closingChar); - if (!result) return; - let tagExp = result.data; - const closeIndex = result.index; - const separatorIndex = tagExp.search(/\s/); - let tagName = tagExp; - let attrExpPresent = true; - if (separatorIndex !== -1) { - tagName = tagExp.substr(0, separatorIndex).replace(/\s\s*$/, ""); - tagExp = tagExp.substr(separatorIndex + 1); - } - if (removeNSPrefix) { - const colonIndex = tagName.indexOf(":"); - if (colonIndex !== -1) { - tagName = tagName.substr(colonIndex + 1); - attrExpPresent = tagName !== result.data.substr(colonIndex + 1); + return maxAttempt; + }, + configFileSelector: (profile) => { + const value = profile[CONFIG_MAX_ATTEMPTS]; + if (!value) + return void 0; + const maxAttempt = parseInt(value); + if (Number.isNaN(maxAttempt)) { + throw new Error(`Shared config file entry ${CONFIG_MAX_ATTEMPTS} mast be a number, got "${value}"`); } - } + return maxAttempt; + }, + default: import_util_retry.DEFAULT_MAX_ATTEMPTS + }; + var resolveRetryConfig = /* @__PURE__ */ __name((input) => { + const { retryStrategy } = input; + const maxAttempts = (0, import_util_middleware3.normalizeProvider)(input.maxAttempts ?? import_util_retry.DEFAULT_MAX_ATTEMPTS); return { - tagName, - tagExp, - closeIndex, - attrExpPresent + ...input, + maxAttempts, + retryStrategy: async () => { + if (retryStrategy) { + return retryStrategy; + } + const retryMode = await (0, import_util_middleware3.normalizeProvider)(input.retryMode)(); + if (retryMode === import_util_retry.RETRY_MODES.ADAPTIVE) { + return new import_util_retry.AdaptiveRetryStrategy(maxAttempts); + } + return new import_util_retry.StandardRetryStrategy(maxAttempts); + } }; - } - function readStopNodeData(xmlData, tagName, i) { - const startIndex = i; - let openTagCount = 1; - for (; i < xmlData.length; i++) { - if (xmlData[i] === "<") { - if (xmlData[i + 1] === "/") { - const closeIndex = findClosingIndex(xmlData, ">", i, `${tagName} is not closed`); - let closeTagName = xmlData.substring(i + 2, closeIndex).trim(); - if (closeTagName === tagName) { - openTagCount--; - if (openTagCount === 0) { - return { - tagContent: xmlData.substring(startIndex, i), - i: closeIndex - }; - } + }, "resolveRetryConfig"); + var ENV_RETRY_MODE = "AWS_RETRY_MODE"; + var CONFIG_RETRY_MODE = "retry_mode"; + var NODE_RETRY_MODE_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => env[ENV_RETRY_MODE], + configFileSelector: (profile) => profile[CONFIG_RETRY_MODE], + default: import_util_retry.DEFAULT_RETRY_MODE + }; + var omitRetryHeadersMiddleware = /* @__PURE__ */ __name(() => (next) => async (args) => { + const { request: request2 } = args; + if (import_protocol_http8.HttpRequest.isInstance(request2)) { + delete request2.headers[import_util_retry.INVOCATION_ID_HEADER]; + delete request2.headers[import_util_retry.REQUEST_HEADER]; + } + return next(args); + }, "omitRetryHeadersMiddleware"); + var omitRetryHeadersMiddlewareOptions = { + name: "omitRetryHeadersMiddleware", + tags: ["RETRY", "HEADERS", "OMIT_RETRY_HEADERS"], + relation: "before", + toMiddleware: "awsAuthMiddleware", + override: true + }; + var getOmitRetryHeadersPlugin = /* @__PURE__ */ __name((options) => ({ + applyToStack: (clientStack) => { + clientStack.addRelativeTo(omitRetryHeadersMiddleware(), omitRetryHeadersMiddlewareOptions); + } + }), "getOmitRetryHeadersPlugin"); + var import_smithy_client5 = require_dist_cjs37(); + var import_isStreamingPayload = require_isStreamingPayload(); + var retryMiddleware = /* @__PURE__ */ __name((options) => (next, context) => async (args) => { + var _a; + let retryStrategy = await options.retryStrategy(); + const maxAttempts = await options.maxAttempts(); + if (isRetryStrategyV2(retryStrategy)) { + retryStrategy = retryStrategy; + let retryToken = await retryStrategy.acquireInitialRetryToken(context["partition_id"]); + let lastError = new Error(); + let attempts = 0; + let totalRetryDelay = 0; + const { request: request2 } = args; + const isRequest = import_protocol_http8.HttpRequest.isInstance(request2); + if (isRequest) { + request2.headers[import_util_retry.INVOCATION_ID_HEADER] = (0, import_uuid.v4)(); + } + while (true) { + try { + if (isRequest) { + request2.headers[import_util_retry.REQUEST_HEADER] = `attempt=${attempts + 1}; max=${maxAttempts}`; } - i = closeIndex; - } else if (xmlData[i + 1] === "?") { - const closeIndex = findClosingIndex(xmlData, "?>", i + 1, "StopNode is not closed."); - i = closeIndex; - } else if (xmlData.substr(i + 1, 3) === "!--") { - const closeIndex = findClosingIndex(xmlData, "-->", i + 3, "StopNode is not closed."); - i = closeIndex; - } else if (xmlData.substr(i + 1, 2) === "![") { - const closeIndex = findClosingIndex(xmlData, "]]>", i, "StopNode is not closed.") - 2; - i = closeIndex; - } else { - const tagData = readTagExp(xmlData, i, ">"); - if (tagData) { - const openTagName = tagData && tagData.tagName; - if (openTagName === tagName && tagData.tagExp[tagData.tagExp.length - 1] !== "/") { - openTagCount++; + const { response, output } = await next(args); + retryStrategy.recordSuccess(retryToken); + output.$metadata.attempts = attempts + 1; + output.$metadata.totalRetryDelay = totalRetryDelay; + return { response, output }; + } catch (e) { + const retryErrorInfo = getRetryErrorInfo(e); + lastError = asSdkError(e); + if (isRequest && (0, import_isStreamingPayload.isStreamingPayload)(request2)) { + (_a = context.logger instanceof import_smithy_client5.NoOpLogger ? console : context.logger) == null ? void 0 : _a.warn( + "An error was encountered in a non-retryable streaming request." + ); + throw lastError; + } + try { + retryToken = await retryStrategy.refreshRetryTokenForRetry(retryToken, retryErrorInfo); + } catch (refreshError) { + if (!lastError.$metadata) { + lastError.$metadata = {}; } - i = tagData.closeIndex; + lastError.$metadata.attempts = attempts + 1; + lastError.$metadata.totalRetryDelay = totalRetryDelay; + throw lastError; } + attempts = retryToken.getRetryCount(); + const delay = retryToken.getRetryDelay(); + totalRetryDelay += delay; + await new Promise((resolve) => setTimeout(resolve, delay)); } } - } - } - function parseValue(val2, shouldParse, options) { - if (shouldParse && typeof val2 === "string") { - const newval = val2.trim(); - if (newval === "true") return true; - else if (newval === "false") return false; - else return toNumber(val2, options); } else { - if (util.isExist(val2)) { - return val2; - } else { - return ""; - } + retryStrategy = retryStrategy; + if (retryStrategy == null ? void 0 : retryStrategy.mode) + context.userAgent = [...context.userAgent || [], ["cfg/retry-mode", retryStrategy.mode]]; + return retryStrategy.retry(next, args); } - } - module2.exports = OrderedObjParser; + }, "retryMiddleware"); + var isRetryStrategyV2 = /* @__PURE__ */ __name((retryStrategy) => typeof retryStrategy.acquireInitialRetryToken !== "undefined" && typeof retryStrategy.refreshRetryTokenForRetry !== "undefined" && typeof retryStrategy.recordSuccess !== "undefined", "isRetryStrategyV2"); + var getRetryErrorInfo = /* @__PURE__ */ __name((error) => { + const errorInfo = { + error, + errorType: getRetryErrorType(error) + }; + const retryAfterHint = getRetryAfterHint(error.$response); + if (retryAfterHint) { + errorInfo.retryAfterHint = retryAfterHint; + } + return errorInfo; + }, "getRetryErrorInfo"); + var getRetryErrorType = /* @__PURE__ */ __name((error) => { + if ((0, import_service_error_classification.isThrottlingError)(error)) + return "THROTTLING"; + if ((0, import_service_error_classification.isTransientError)(error)) + return "TRANSIENT"; + if ((0, import_service_error_classification.isServerError)(error)) + return "SERVER_ERROR"; + return "CLIENT_ERROR"; + }, "getRetryErrorType"); + var retryMiddlewareOptions2 = { + name: "retryMiddleware", + tags: ["RETRY"], + step: "finalizeRequest", + priority: "high", + override: true + }; + var getRetryPlugin = /* @__PURE__ */ __name((options) => ({ + applyToStack: (clientStack) => { + clientStack.add(retryMiddleware(options), retryMiddlewareOptions2); + } + }), "getRetryPlugin"); + var getRetryAfterHint = /* @__PURE__ */ __name((response) => { + if (!import_protocol_http8.HttpResponse.isInstance(response)) + return; + const retryAfterHeaderName = Object.keys(response.headers).find((key) => key.toLowerCase() === "retry-after"); + if (!retryAfterHeaderName) + return; + const retryAfter = response.headers[retryAfterHeaderName]; + const retryAfterSeconds = Number(retryAfter); + if (!Number.isNaN(retryAfterSeconds)) + return new Date(retryAfterSeconds * 1e3); + const retryAfterDate = new Date(retryAfter); + return retryAfterDate; + }, "getRetryAfterHint"); } }); -// ../../../node_modules/fast-xml-parser/src/xmlparser/node2json.js -var require_node2json = __commonJS({ - "../../../node_modules/fast-xml-parser/src/xmlparser/node2json.js"(exports2) { - "use strict"; - function prettify(node, options) { - return compress(node, options); - } - function compress(arr, options, jPath) { - let text; - const compressedObj = {}; - for (let i = 0; i < arr.length; i++) { - const tagObj = arr[i]; - const property = propName(tagObj); - let newJpath = ""; - if (jPath === void 0) newJpath = property; - else newJpath = jPath + "." + property; - if (property === options.textNodeName) { - if (text === void 0) text = tagObj[property]; - else text += "" + tagObj[property]; - } else if (property === void 0) { - continue; - } else if (tagObj[property]) { - let val2 = compress(tagObj[property], options, newJpath); - const isLeaf = isLeafTag(val2, options); - if (tagObj[":@"]) { - assignAttributes(val2, tagObj[":@"], newJpath, options); - } else if (Object.keys(val2).length === 1 && val2[options.textNodeName] !== void 0 && !options.alwaysCreateTextNode) { - val2 = val2[options.textNodeName]; - } else if (Object.keys(val2).length === 0) { - if (options.alwaysCreateTextNode) val2[options.textNodeName] = ""; - else val2 = ""; - } - if (compressedObj[property] !== void 0 && compressedObj.hasOwnProperty(property)) { - if (!Array.isArray(compressedObj[property])) { - compressedObj[property] = [compressedObj[property]]; - } - compressedObj[property].push(val2); - } else { - if (options.isArray(property, newJpath, isLeaf)) { - compressedObj[property] = [val2]; - } else { - compressedObj[property] = val2; - } - } - } - } - if (typeof text === "string") { - if (text.length > 0) compressedObj[options.textNodeName] = text; - } else if (text !== void 0) compressedObj[options.textNodeName] = text; - return compressedObj; - } - function propName(obj) { - const keys = Object.keys(obj); - for (let i = 0; i < keys.length; i++) { - const key = keys[i]; - if (key !== ":@") return key; +// ../../../node_modules/@smithy/core/dist-es/middleware-http-signing/getHttpSigningMiddleware.js +var import_middleware_retry, httpSigningMiddlewareOptions, getHttpSigningPlugin; +var init_getHttpSigningMiddleware = __esm({ + "../../../node_modules/@smithy/core/dist-es/middleware-http-signing/getHttpSigningMiddleware.js"() { + import_middleware_retry = __toESM(require_dist_cjs38()); + init_httpSigningMiddleware(); + httpSigningMiddlewareOptions = { + step: "finalizeRequest", + tags: ["HTTP_SIGNING"], + name: "httpSigningMiddleware", + aliases: ["apiKeyMiddleware", "tokenMiddleware", "awsAuthMiddleware"], + override: true, + relation: "after", + toMiddleware: import_middleware_retry.retryMiddlewareOptions.name + }; + getHttpSigningPlugin = (config) => ({ + applyToStack: (clientStack) => { + clientStack.addRelativeTo(httpSigningMiddleware(config), httpSigningMiddlewareOptions); } - } - function assignAttributes(obj, attrMap, jpath, options) { - if (attrMap) { - const keys = Object.keys(attrMap); - const len = keys.length; - for (let i = 0; i < len; i++) { - const atrrName = keys[i]; - if (options.isArray(atrrName, jpath + "." + atrrName, true, true)) { - obj[atrrName] = [attrMap[atrrName]]; - } else { - obj[atrrName] = attrMap[atrrName]; + }); + } +}); + +// ../../../node_modules/@smithy/core/dist-es/middleware-http-signing/index.js +var init_middleware_http_signing = __esm({ + "../../../node_modules/@smithy/core/dist-es/middleware-http-signing/index.js"() { + init_httpSigningMiddleware(); + init_getHttpSigningMiddleware(); + } +}); + +// ../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/DefaultIdentityProviderConfig.js +var DefaultIdentityProviderConfig; +var init_DefaultIdentityProviderConfig = __esm({ + "../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/DefaultIdentityProviderConfig.js"() { + DefaultIdentityProviderConfig = class { + constructor(config) { + this.authSchemes = /* @__PURE__ */ new Map(); + for (const [key, value] of Object.entries(config)) { + if (value !== void 0) { + this.authSchemes.set(key, value); } } } - } - function isLeafTag(obj, options) { - const { textNodeName } = options; - const propCount = Object.keys(obj).length; - if (propCount === 0) { - return true; - } - if (propCount === 1 && (obj[textNodeName] || typeof obj[textNodeName] === "boolean" || obj[textNodeName] === 0)) { - return true; + getIdentityProvider(schemeId) { + return this.authSchemes.get(schemeId); } - return false; - } - exports2.prettify = prettify; + }; } }); -// ../../../node_modules/fast-xml-parser/src/xmlparser/XMLParser.js -var require_XMLParser = __commonJS({ - "../../../node_modules/fast-xml-parser/src/xmlparser/XMLParser.js"(exports2, module2) { - var { buildOptions } = require_OptionsBuilder(); - var OrderedObjParser = require_OrderedObjParser(); - var { prettify } = require_node2json(); - var validator = require_validator(); - var XMLParser = class { - constructor(options) { - this.externalEntities = {}; - this.options = buildOptions(options); - } - /** - * Parse XML dats to JS object - * @param {string|Buffer} xmlData - * @param {boolean|Object} validationOption - */ - parse(xmlData, validationOption) { - if (typeof xmlData === "string") { - } else if (xmlData.toString) { - xmlData = xmlData.toString(); - } else { - throw new Error("XML data is accepted in String or Bytes[] form."); +// ../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/httpAuthSchemes/httpApiKeyAuth.js +var import_protocol_http2, import_types3, HttpApiKeyAuthSigner; +var init_httpApiKeyAuth = __esm({ + "../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/httpAuthSchemes/httpApiKeyAuth.js"() { + import_protocol_http2 = __toESM(require_dist_cjs20()); + import_types3 = __toESM(require_dist_cjs()); + HttpApiKeyAuthSigner = class { + async sign(httpRequest, identity, signingProperties) { + if (!signingProperties) { + throw new Error("request could not be signed with `apiKey` since the `name` and `in` signer properties are missing"); } - if (validationOption) { - if (validationOption === true) validationOption = {}; - const result = validator.validate(xmlData, validationOption); - if (result !== true) { - throw Error(`${result.err.msg}:${result.err.line}:${result.err.col}`); - } + if (!signingProperties.name) { + throw new Error("request could not be signed with `apiKey` since the `name` signer property is missing"); } - const orderedObjParser = new OrderedObjParser(this.options); - orderedObjParser.addExternalEntities(this.externalEntities); - const orderedResult = orderedObjParser.parseXml(xmlData); - if (this.options.preserveOrder || orderedResult === void 0) return orderedResult; - else return prettify(orderedResult, this.options); - } - /** - * Add Entity which is not by default supported by this library - * @param {string} key - * @param {string} value - */ - addEntity(key, value) { - if (value.indexOf("&") !== -1) { - throw new Error("Entity value can't have '&'"); - } else if (key.indexOf("&") !== -1 || key.indexOf(";") !== -1) { - throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for ' '"); - } else if (value === "&") { - throw new Error("An entity with value '&' is not permitted"); + if (!signingProperties.in) { + throw new Error("request could not be signed with `apiKey` since the `in` signer property is missing"); + } + if (!identity.apiKey) { + throw new Error("request could not be signed with `apiKey` since the `apiKey` is not defined"); + } + const clonedRequest = import_protocol_http2.HttpRequest.clone(httpRequest); + if (signingProperties.in === import_types3.HttpApiKeyAuthLocation.QUERY) { + clonedRequest.query[signingProperties.name] = identity.apiKey; + } else if (signingProperties.in === import_types3.HttpApiKeyAuthLocation.HEADER) { + clonedRequest.headers[signingProperties.name] = signingProperties.scheme ? `${signingProperties.scheme} ${identity.apiKey}` : identity.apiKey; } else { - this.externalEntities[key] = value; + throw new Error("request can only be signed with `apiKey` locations `query` or `header`, but found: `" + signingProperties.in + "`"); } + return clonedRequest; } }; - module2.exports = XMLParser; } }); -// ../../../node_modules/fast-xml-parser/src/xmlbuilder/orderedJs2Xml.js -var require_orderedJs2Xml = __commonJS({ - "../../../node_modules/fast-xml-parser/src/xmlbuilder/orderedJs2Xml.js"(exports2, module2) { - var EOL = "\n"; - function toXml(jArray, options) { - let indentation = ""; - if (options.format && options.indentBy.length > 0) { - indentation = EOL; +// ../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/httpAuthSchemes/httpBearerAuth.js +var import_protocol_http3, HttpBearerAuthSigner; +var init_httpBearerAuth = __esm({ + "../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/httpAuthSchemes/httpBearerAuth.js"() { + import_protocol_http3 = __toESM(require_dist_cjs20()); + HttpBearerAuthSigner = class { + async sign(httpRequest, identity, signingProperties) { + const clonedRequest = import_protocol_http3.HttpRequest.clone(httpRequest); + if (!identity.token) { + throw new Error("request could not be signed with `token` since the `token` is not defined"); + } + clonedRequest.headers["Authorization"] = `Bearer ${identity.token}`; + return clonedRequest; } - return arrToStr(jArray, options, "", indentation); - } - function arrToStr(arr, options, jPath, indentation) { - let xmlStr = ""; - let isPreviousElementTag = false; - for (let i = 0; i < arr.length; i++) { - const tagObj = arr[i]; - const tagName = propName(tagObj); - let newJPath = ""; - if (jPath.length === 0) newJPath = tagName; - else newJPath = `${jPath}.${tagName}`; - if (tagName === options.textNodeName) { - let tagText = tagObj[tagName]; - if (!isStopNode(newJPath, options)) { - tagText = options.tagValueProcessor(tagName, tagText); - tagText = replaceEntitiesValue(tagText, options); - } - if (isPreviousElementTag) { - xmlStr += indentation; - } - xmlStr += tagText; - isPreviousElementTag = false; - continue; - } else if (tagName === options.cdataPropName) { - if (isPreviousElementTag) { - xmlStr += indentation; - } - xmlStr += ``; - isPreviousElementTag = false; - continue; - } else if (tagName === options.commentPropName) { - xmlStr += indentation + ``; - isPreviousElementTag = true; - continue; - } else if (tagName[0] === "?") { - const attStr2 = attr_to_str(tagObj[":@"], options); - const tempInd = tagName === "?xml" ? "" : indentation; - let piTextNodeName = tagObj[tagName][0][options.textNodeName]; - piTextNodeName = piTextNodeName.length !== 0 ? " " + piTextNodeName : ""; - xmlStr += tempInd + `<${tagName}${piTextNodeName}${attStr2}?>`; - isPreviousElementTag = true; - continue; + }; + } +}); + +// ../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/httpAuthSchemes/noAuth.js +var NoAuthSigner; +var init_noAuth = __esm({ + "../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/httpAuthSchemes/noAuth.js"() { + NoAuthSigner = class { + async sign(httpRequest, identity, signingProperties) { + return httpRequest; + } + }; + } +}); + +// ../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/httpAuthSchemes/index.js +var init_httpAuthSchemes = __esm({ + "../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/httpAuthSchemes/index.js"() { + init_httpApiKeyAuth(); + init_httpBearerAuth(); + init_noAuth(); + } +}); + +// ../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/memoizeIdentityProvider.js +var createIsIdentityExpiredFunction, EXPIRATION_MS, isIdentityExpired, doesIdentityRequireRefresh, memoizeIdentityProvider; +var init_memoizeIdentityProvider = __esm({ + "../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/memoizeIdentityProvider.js"() { + createIsIdentityExpiredFunction = (expirationMs) => (identity) => doesIdentityRequireRefresh(identity) && identity.expiration.getTime() - Date.now() < expirationMs; + EXPIRATION_MS = 3e5; + isIdentityExpired = createIsIdentityExpiredFunction(EXPIRATION_MS); + doesIdentityRequireRefresh = (identity) => identity.expiration !== void 0; + memoizeIdentityProvider = (provider, isExpired, requiresRefresh) => { + if (provider === void 0) { + return void 0; + } + const normalizedProvider = typeof provider !== "function" ? async () => Promise.resolve(provider) : provider; + let resolved; + let pending; + let hasResult; + let isConstant = false; + const coalesceProvider = async (options) => { + if (!pending) { + pending = normalizedProvider(options); } - let newIdentation = indentation; - if (newIdentation !== "") { - newIdentation += options.indentBy; + try { + resolved = await pending; + hasResult = true; + isConstant = false; + } finally { + pending = void 0; } - const attStr = attr_to_str(tagObj[":@"], options); - const tagStart = indentation + `<${tagName}${attStr}`; - const tagValue = arrToStr(tagObj[tagName], options, newJPath, newIdentation); - if (options.unpairedTags.indexOf(tagName) !== -1) { - if (options.suppressUnpairedNode) xmlStr += tagStart + ">"; - else xmlStr += tagStart + "/>"; - } else if ((!tagValue || tagValue.length === 0) && options.suppressEmptyNode) { - xmlStr += tagStart + "/>"; - } else if (tagValue && tagValue.endsWith(">")) { - xmlStr += tagStart + `>${tagValue}${indentation}`; - } else { - xmlStr += tagStart + ">"; - if (tagValue && indentation !== "" && (tagValue.includes("/>") || tagValue.includes(" { + if (!hasResult || options?.forceRefresh) { + resolved = await coalesceProvider(options); } - xmlStr += ``; + return resolved; + }; + } + return async (options) => { + if (!hasResult || options?.forceRefresh) { + resolved = await coalesceProvider(options); } - isPreviousElementTag = true; + if (isConstant) { + return resolved; + } + if (!requiresRefresh(resolved)) { + isConstant = true; + return resolved; + } + if (isExpired(resolved)) { + await coalesceProvider(options); + return resolved; + } + return resolved; + }; + }; + } +}); + +// ../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/index.js +var init_util_identity_and_auth = __esm({ + "../../../node_modules/@smithy/core/dist-es/util-identity-and-auth/index.js"() { + init_DefaultIdentityProviderConfig(); + init_httpAuthSchemes(); + init_memoizeIdentityProvider(); + } +}); + +// ../../../node_modules/@smithy/core/dist-es/getSmithyContext.js +var import_types4, getSmithyContext3; +var init_getSmithyContext = __esm({ + "../../../node_modules/@smithy/core/dist-es/getSmithyContext.js"() { + import_types4 = __toESM(require_dist_cjs()); + getSmithyContext3 = (context) => context[import_types4.SMITHY_CONTEXT_KEY] || (context[import_types4.SMITHY_CONTEXT_KEY] = {}); + } +}); + +// ../../../node_modules/@smithy/core/dist-es/normalizeProvider.js +var normalizeProvider; +var init_normalizeProvider = __esm({ + "../../../node_modules/@smithy/core/dist-es/normalizeProvider.js"() { + normalizeProvider = (input) => { + if (typeof input === "function") + return input; + const promisified = Promise.resolve(input); + return () => promisified; + }; + } +}); + +// ../../../node_modules/@smithy/core/dist-es/protocols/requestBuilder.js +function requestBuilder(input, context) { + return new RequestBuilder(input, context); +} +var import_protocol_http4, import_smithy_client, RequestBuilder; +var init_requestBuilder = __esm({ + "../../../node_modules/@smithy/core/dist-es/protocols/requestBuilder.js"() { + import_protocol_http4 = __toESM(require_dist_cjs20()); + import_smithy_client = __toESM(require_dist_cjs37()); + RequestBuilder = class { + constructor(input, context) { + this.input = input; + this.context = context; + this.query = {}; + this.method = ""; + this.headers = {}; + this.path = ""; + this.body = null; + this.hostname = ""; + this.resolvePathStack = []; + } + async build() { + const { hostname, protocol = "https", port, path: basePath } = await this.context.endpoint(); + this.path = basePath; + for (const resolvePath of this.resolvePathStack) { + resolvePath(this.path); + } + return new import_protocol_http4.HttpRequest({ + protocol, + hostname: this.hostname || hostname, + port, + method: this.method, + path: this.path, + query: this.query, + body: this.body, + headers: this.headers + }); } - return xmlStr; - } - function propName(obj) { - const keys = Object.keys(obj); - for (let i = 0; i < keys.length; i++) { - const key = keys[i]; - if (key !== ":@") return key; + hn(hostname) { + this.hostname = hostname; + return this; } - } - function attr_to_str(attrMap, options) { - let attrStr = ""; - if (attrMap && !options.ignoreAttributes) { - for (let attr in attrMap) { - let attrVal = options.attributeValueProcessor(attr, attrMap[attr]); - attrVal = replaceEntitiesValue(attrVal, options); - if (attrVal === true && options.suppressBooleanAttributes) { - attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}`; - } else { - attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}="${attrVal}"`; - } - } + bp(uriLabel) { + this.resolvePathStack.push((basePath) => { + this.path = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + uriLabel; + }); + return this; } - return attrStr; - } - function isStopNode(jPath, options) { - jPath = jPath.substr(0, jPath.length - options.textNodeName.length - 1); - let tagName = jPath.substr(jPath.lastIndexOf(".") + 1); - for (let index in options.stopNodes) { - if (options.stopNodes[index] === jPath || options.stopNodes[index] === "*." + tagName) return true; + p(memberName, labelValueProvider, uriLabel, isGreedyLabel) { + this.resolvePathStack.push((path) => { + this.path = (0, import_smithy_client.resolvedPath)(path, this.input, memberName, labelValueProvider, uriLabel, isGreedyLabel); + }); + return this; } - return false; - } - function replaceEntitiesValue(textValue, options) { - if (textValue && textValue.length > 0 && options.processEntities) { - for (let i = 0; i < options.entities.length; i++) { - const entity = options.entities[i]; - textValue = textValue.replace(entity.regex, entity.val); - } + h(headers) { + this.headers = headers; + return this; } - return textValue; - } - module2.exports = toXml; + q(query) { + this.query = query; + return this; + } + b(body) { + this.body = body; + return this; + } + m(method) { + this.method = method; + return this; + } + }; } }); -// ../../../node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js -var require_json2xml = __commonJS({ - "../../../node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js"(exports2, module2) { - "use strict"; - var buildFromOrderedJs = require_orderedJs2Xml(); - var defaultOptions = { - attributeNamePrefix: "@_", - attributesGroupName: false, - textNodeName: "#text", - ignoreAttributes: true, - cdataPropName: false, - format: false, - indentBy: " ", - suppressEmptyNode: false, - suppressUnpairedNode: true, - suppressBooleanAttributes: true, - tagValueProcessor: function(key, a) { - return a; - }, - attributeValueProcessor: function(attrName, a) { - return a; - }, - preserveOrder: false, - commentPropName: false, - unpairedTags: [], - entities: [ - { regex: new RegExp("&", "g"), val: "&" }, - //it must be on top - { regex: new RegExp(">", "g"), val: ">" }, - { regex: new RegExp("<", "g"), val: "<" }, - { regex: new RegExp("'", "g"), val: "'" }, - { regex: new RegExp('"', "g"), val: """ } - ], - processEntities: true, - stopNodes: [], - // transformTagName: false, - // transformAttributeName: false, - oneListGroup: false - }; - function Builder(options) { - this.options = Object.assign({}, defaultOptions, options); - if (this.options.ignoreAttributes || this.options.attributesGroupName) { - this.isAttribute = function() { - return false; - }; - } else { - this.attrPrefixLen = this.options.attributeNamePrefix.length; - this.isAttribute = isAttribute; +// ../../../node_modules/@smithy/core/dist-es/pagination/createPaginator.js +function createPaginator(ClientCtor, CommandCtor, inputTokenName, outputTokenName, pageSizeTokenName) { + return async function* paginateOperation(config, input, ...additionalArguments) { + let token = config.startingToken || void 0; + let hasNext = true; + let page; + while (hasNext) { + input[inputTokenName] = token; + if (pageSizeTokenName) { + input[pageSizeTokenName] = input[pageSizeTokenName] ?? config.pageSize; } - this.processTextOrObjNode = processTextOrObjNode; - if (this.options.format) { - this.indentate = indentate; - this.tagEndChar = ">\n"; - this.newLine = "\n"; + if (config.client instanceof ClientCtor) { + page = await makePagedClientRequest(CommandCtor, config.client, input, ...additionalArguments); } else { - this.indentate = function() { - return ""; - }; - this.tagEndChar = ">"; - this.newLine = ""; + throw new Error(`Invalid client, expected instance of ${ClientCtor.name}`); } + yield page; + const prevToken = token; + token = get(page, outputTokenName); + hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); } - Builder.prototype.build = function(jObj) { - if (this.options.preserveOrder) { - return buildFromOrderedJs(jObj, this.options); - } else { - if (Array.isArray(jObj) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1) { - jObj = { - [this.options.arrayNodeName]: jObj - }; + return void 0; + }; +} +var makePagedClientRequest, get; +var init_createPaginator = __esm({ + "../../../node_modules/@smithy/core/dist-es/pagination/createPaginator.js"() { + makePagedClientRequest = async (CommandCtor, client, input, ...args) => { + return await client.send(new CommandCtor(input), ...args); + }; + get = (fromObject, path) => { + let cursor = fromObject; + const pathComponents = path.split("."); + for (const step of pathComponents) { + if (!cursor || typeof cursor !== "object") { + return void 0; } - return this.j2x(jObj, 0).val; + cursor = cursor[step]; + } + return cursor; + }; + } +}); + +// ../../../node_modules/@smithy/core/dist-es/index.js +var dist_es_exports = {}; +__export(dist_es_exports, { + DefaultIdentityProviderConfig: () => DefaultIdentityProviderConfig, + EXPIRATION_MS: () => EXPIRATION_MS, + HttpApiKeyAuthSigner: () => HttpApiKeyAuthSigner, + HttpBearerAuthSigner: () => HttpBearerAuthSigner, + NoAuthSigner: () => NoAuthSigner, + RequestBuilder: () => RequestBuilder, + createIsIdentityExpiredFunction: () => createIsIdentityExpiredFunction, + createPaginator: () => createPaginator, + doesIdentityRequireRefresh: () => doesIdentityRequireRefresh, + getHttpAuthSchemeEndpointRuleSetPlugin: () => getHttpAuthSchemeEndpointRuleSetPlugin, + getHttpAuthSchemePlugin: () => getHttpAuthSchemePlugin, + getHttpSigningPlugin: () => getHttpSigningPlugin, + getSmithyContext: () => getSmithyContext3, + httpAuthSchemeEndpointRuleSetMiddlewareOptions: () => httpAuthSchemeEndpointRuleSetMiddlewareOptions, + httpAuthSchemeMiddleware: () => httpAuthSchemeMiddleware, + httpAuthSchemeMiddlewareOptions: () => httpAuthSchemeMiddlewareOptions, + httpSigningMiddleware: () => httpSigningMiddleware, + httpSigningMiddlewareOptions: () => httpSigningMiddlewareOptions, + isIdentityExpired: () => isIdentityExpired, + memoizeIdentityProvider: () => memoizeIdentityProvider, + normalizeProvider: () => normalizeProvider, + requestBuilder: () => requestBuilder +}); +var init_dist_es = __esm({ + "../../../node_modules/@smithy/core/dist-es/index.js"() { + init_middleware_http_auth_scheme(); + init_middleware_http_signing(); + init_util_identity_and_auth(); + init_getSmithyContext(); + init_normalizeProvider(); + init_requestBuilder(); + init_createPaginator(); + } +}); + +// ../../../node_modules/@smithy/middleware-content-length/dist-cjs/index.js +var require_dist_cjs39 = __commonJS({ + "../../../node_modules/@smithy/middleware-content-length/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - Builder.prototype.j2x = function(jObj, level) { - let attrStr = ""; - let val2 = ""; - for (let key in jObj) { - if (typeof jObj[key] === "undefined") { - } else if (jObj[key] === null) { - if (key[0] === "?") val2 += this.indentate(level) + "<" + key + "?" + this.tagEndChar; - else val2 += this.indentate(level) + "<" + key + "/" + this.tagEndChar; - } else if (jObj[key] instanceof Date) { - val2 += this.buildTextValNode(jObj[key], key, "", level); - } else if (typeof jObj[key] !== "object") { - const attr = this.isAttribute(key); - if (attr) { - attrStr += this.buildAttrPairStr(attr, "" + jObj[key]); - } else { - if (key === this.options.textNodeName) { - let newval = this.options.tagValueProcessor(key, "" + jObj[key]); - val2 += this.replaceEntitiesValue(newval); - } else { - val2 += this.buildTextValNode(jObj[key], key, "", level); - } - } - } else if (Array.isArray(jObj[key])) { - const arrLen = jObj[key].length; - let listTagVal = ""; - for (let j = 0; j < arrLen; j++) { - const item = jObj[key][j]; - if (typeof item === "undefined") { - } else if (item === null) { - if (key[0] === "?") val2 += this.indentate(level) + "<" + key + "?" + this.tagEndChar; - else val2 += this.indentate(level) + "<" + key + "/" + this.tagEndChar; - } else if (typeof item === "object") { - if (this.options.oneListGroup) { - listTagVal += this.j2x(item, level + 1).val; - } else { - listTagVal += this.processTextOrObjNode(item, key, level); - } - } else { - listTagVal += this.buildTextValNode(item, key, "", level); - } - } - if (this.options.oneListGroup) { - listTagVal = this.buildObjectNode(listTagVal, key, "", level); - } - val2 += listTagVal; - } else { - if (this.options.attributesGroupName && key === this.options.attributesGroupName) { - const Ks = Object.keys(jObj[key]); - const L = Ks.length; - for (let j = 0; j < L; j++) { - attrStr += this.buildAttrPairStr(Ks[j], "" + jObj[key][Ks[j]]); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + contentLengthMiddleware: () => contentLengthMiddleware, + contentLengthMiddlewareOptions: () => contentLengthMiddlewareOptions, + getContentLengthPlugin: () => getContentLengthPlugin + }); + module2.exports = __toCommonJS2(src_exports); + var import_protocol_http8 = require_dist_cjs2(); + var CONTENT_LENGTH_HEADER = "content-length"; + function contentLengthMiddleware(bodyLengthChecker) { + return (next) => async (args) => { + const request2 = args.request; + if (import_protocol_http8.HttpRequest.isInstance(request2)) { + const { body, headers } = request2; + if (body && Object.keys(headers).map((str) => str.toLowerCase()).indexOf(CONTENT_LENGTH_HEADER) === -1) { + try { + const length = bodyLengthChecker(body); + request2.headers = { + ...request2.headers, + [CONTENT_LENGTH_HEADER]: String(length) + }; + } catch (error) { } - } else { - val2 += this.processTextOrObjNode(jObj[key], key, level); } } - } - return { attrStr, val: val2 }; + return next({ + ...args, + request: request2 + }); + }; + } + __name(contentLengthMiddleware, "contentLengthMiddleware"); + var contentLengthMiddlewareOptions = { + step: "build", + tags: ["SET_CONTENT_LENGTH", "CONTENT_LENGTH"], + name: "contentLengthMiddleware", + override: true }; - Builder.prototype.buildAttrPairStr = function(attrName, val2) { - val2 = this.options.attributeValueProcessor(attrName, "" + val2); - val2 = this.replaceEntitiesValue(val2); - if (this.options.suppressBooleanAttributes && val2 === "true") { - return " " + attrName; - } else return " " + attrName + '="' + val2 + '"'; + var getContentLengthPlugin = /* @__PURE__ */ __name((options) => ({ + applyToStack: (clientStack) => { + clientStack.add(contentLengthMiddleware(options.bodyLengthChecker), contentLengthMiddlewareOptions); + } + }), "getContentLengthPlugin"); + } +}); + +// ../../../node_modules/@smithy/property-provider/dist-cjs/index.js +var require_dist_cjs40 = __commonJS({ + "../../../node_modules/@smithy/property-provider/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - function processTextOrObjNode(object, key, level) { - const result = this.j2x(object, level + 1); - if (object[this.options.textNodeName] !== void 0 && Object.keys(object).length === 1) { - return this.buildTextValNode(object[this.options.textNodeName], key, result.attrStr, level); - } else { - return this.buildObjectNode(result.val, key, result.attrStr, level); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - } - Builder.prototype.buildObjectNode = function(val2, key, attrStr, level) { - if (val2 === "") { - if (key[0] === "?") return this.indentate(level) + "<" + key + attrStr + "?" + this.tagEndChar; - else { - return this.indentate(level) + "<" + key + attrStr + this.closeTag(key) + this.tagEndChar; - } - } else { - let tagEndExp = "" + val2 + tagEndExp; - } else if (this.options.commentPropName !== false && key === this.options.commentPropName && piClosingChar.length === 0) { - return this.indentate(level) + `` + this.newLine; - } else { - return this.indentate(level) + "<" + key + attrStr + piClosingChar + this.tagEndChar + val2 + this.indentate(level) + tagEndExp; + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + CredentialsProviderError: () => CredentialsProviderError, + ProviderError: () => ProviderError2, + TokenProviderError: () => TokenProviderError, + chain: () => chain, + fromStatic: () => fromStatic, + memoize: () => memoize + }); + module2.exports = __toCommonJS2(src_exports); + var _ProviderError = class _ProviderError2 extends Error { + constructor(message, options = true) { + var _a; + let logger; + let tryNextLink = true; + if (typeof options === "boolean") { + logger = void 0; + tryNextLink = options; + } else if (options != null && typeof options === "object") { + logger = options.logger; + tryNextLink = options.tryNextLink ?? true; } + super(message); + this.name = "ProviderError"; + this.tryNextLink = tryNextLink; + Object.setPrototypeOf(this, _ProviderError2.prototype); + (_a = logger == null ? void 0 : logger.debug) == null ? void 0 : _a.call(logger, `@smithy/property-provider ${tryNextLink ? "->" : "(!)"} ${message}`); + } + /** + * @deprecated use new operator. + */ + static from(error, options = true) { + return Object.assign(new this(error.message, options), error); } }; - Builder.prototype.closeTag = function(key) { - let closeTag = ""; - if (this.options.unpairedTags.indexOf(key) !== -1) { - if (!this.options.suppressUnpairedNode) closeTag = "/"; - } else if (this.options.suppressEmptyNode) { - closeTag = "/"; - } else { - closeTag = `>` + this.newLine; - } else if (this.options.commentPropName !== false && key === this.options.commentPropName) { - return this.indentate(level) + `` + this.newLine; - } else if (key[0] === "?") { - return this.indentate(level) + "<" + key + attrStr + "?" + this.tagEndChar; - } else { - let textValue = this.options.tagValueProcessor(key, val2); - textValue = this.replaceEntitiesValue(textValue); - if (textValue === "") { - return this.indentate(level) + "<" + key + attrStr + this.closeTag(key) + this.tagEndChar; - } else { - return this.indentate(level) + "<" + key + attrStr + ">" + textValue + " async () => { + if (providers.length === 0) { + throw new ProviderError2("No providers in chain"); + } + let lastProviderError; + for (const provider of providers) { + try { + const credentials = await provider(); + return credentials; + } catch (err) { + lastProviderError = err; + if (err == null ? void 0 : err.tryNextLink) { + continue; + } + throw err; + } + } + throw lastProviderError; + }, "chain"); + var fromStatic = /* @__PURE__ */ __name((staticValue) => () => Promise.resolve(staticValue), "fromStatic"); + var memoize = /* @__PURE__ */ __name((provider, isExpired, requiresRefresh) => { + let resolved; + let pending; + let hasResult; + let isConstant = false; + const coalesceProvider = /* @__PURE__ */ __name(async () => { + if (!pending) { + pending = provider(); + } + try { + resolved = await pending; + hasResult = true; + isConstant = false; + } finally { + pending = void 0; } + return resolved; + }, "coalesceProvider"); + if (isExpired === void 0) { + return async (options) => { + if (!hasResult || (options == null ? void 0 : options.forceRefresh)) { + resolved = await coalesceProvider(); + } + return resolved; + }; } - }; - Builder.prototype.replaceEntitiesValue = function(textValue) { - if (textValue && textValue.length > 0 && this.options.processEntities) { - for (let i = 0; i < this.options.entities.length; i++) { - const entity = this.options.entities[i]; - textValue = textValue.replace(entity.regex, entity.val); + return async (options) => { + if (!hasResult || (options == null ? void 0 : options.forceRefresh)) { + resolved = await coalesceProvider(); + } + if (isConstant) { + return resolved; + } + if (requiresRefresh && !requiresRefresh(resolved)) { + isConstant = true; + return resolved; + } + if (isExpired(resolved)) { + await coalesceProvider(); + return resolved; } + return resolved; + }; + }, "memoize"); + } +}); + +// ../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/getHomeDir.js +var require_getHomeDir2 = __commonJS({ + "../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/getHomeDir.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getHomeDir = void 0; + var os_1 = require("os"); + var path_1 = require("path"); + var homeDirCache = {}; + var getHomeDirCacheKey = () => { + if (process && process.geteuid) { + return `${process.geteuid()}`; } - return textValue; + return "DEFAULT"; }; - function indentate(level) { - return this.options.indentBy.repeat(level); - } - function isAttribute(name) { - if (name.startsWith(this.options.attributeNamePrefix)) { - return name.substr(this.attrPrefixLen); - } else { - return false; - } - } - module2.exports = Builder; + var getHomeDir2 = () => { + const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${path_1.sep}` } = process.env; + if (HOME) + return HOME; + if (USERPROFILE) + return USERPROFILE; + if (HOMEPATH) + return `${HOMEDRIVE}${HOMEPATH}`; + const homeDirCacheKey = getHomeDirCacheKey(); + if (!homeDirCache[homeDirCacheKey]) + homeDirCache[homeDirCacheKey] = (0, os_1.homedir)(); + return homeDirCache[homeDirCacheKey]; + }; + exports2.getHomeDir = getHomeDir2; } }); -// ../../../node_modules/fast-xml-parser/src/fxp.js -var require_fxp = __commonJS({ - "../../../node_modules/fast-xml-parser/src/fxp.js"(exports2, module2) { +// ../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFilepath.js +var require_getSSOTokenFilepath2 = __commonJS({ + "../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFilepath.js"(exports2) { "use strict"; - var validator = require_validator(); - var XMLParser = require_XMLParser(); - var XMLBuilder = require_json2xml(); - module2.exports = { - XMLParser, - XMLValidator: validator, - XMLBuilder + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getSSOTokenFilepath = void 0; + var crypto_1 = require("crypto"); + var path_1 = require("path"); + var getHomeDir_1 = require_getHomeDir2(); + var getSSOTokenFilepath2 = (id) => { + const hasher = (0, crypto_1.createHash)("sha1"); + const cacheName = hasher.update(id).digest("hex"); + return (0, path_1.join)((0, getHomeDir_1.getHomeDir)(), ".aws", "sso", "cache", `${cacheName}.json`); }; + exports2.getSSOTokenFilepath = getSSOTokenFilepath2; } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/protocols/Aws_query.js -var require_Aws_query = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/protocols/Aws_query.js"(exports2) { +// ../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFromFile.js +var require_getSSOTokenFromFile2 = __commonJS({ + "../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFromFile.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.de_GetSessionTokenCommand = exports2.de_GetFederationTokenCommand = exports2.de_GetCallerIdentityCommand = exports2.de_GetAccessKeyInfoCommand = exports2.de_DecodeAuthorizationMessageCommand = exports2.de_AssumeRoleWithWebIdentityCommand = exports2.de_AssumeRoleWithSAMLCommand = exports2.de_AssumeRoleCommand = exports2.se_GetSessionTokenCommand = exports2.se_GetFederationTokenCommand = exports2.se_GetCallerIdentityCommand = exports2.se_GetAccessKeyInfoCommand = exports2.se_DecodeAuthorizationMessageCommand = exports2.se_AssumeRoleWithWebIdentityCommand = exports2.se_AssumeRoleWithSAMLCommand = exports2.se_AssumeRoleCommand = void 0; - var protocol_http_1 = require_dist_cjs2(); - var smithy_client_1 = require_dist_cjs34(); - var fast_xml_parser_1 = require_fxp(); - var models_0_1 = require_models_0(); - var STSServiceException_1 = require_STSServiceException(); - var se_AssumeRoleCommand = async (input, context) => { - const headers = SHARED_HEADERS; - let body; - body = buildFormUrlencodedString({ - ...se_AssumeRoleRequest(input, context), - Action: "AssumeRole", - Version: "2011-06-15" - }); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_AssumeRoleCommand = se_AssumeRoleCommand; - var se_AssumeRoleWithSAMLCommand = async (input, context) => { - const headers = SHARED_HEADERS; - let body; - body = buildFormUrlencodedString({ - ...se_AssumeRoleWithSAMLRequest(input, context), - Action: "AssumeRoleWithSAML", - Version: "2011-06-15" - }); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_AssumeRoleWithSAMLCommand = se_AssumeRoleWithSAMLCommand; - var se_AssumeRoleWithWebIdentityCommand = async (input, context) => { - const headers = SHARED_HEADERS; - let body; - body = buildFormUrlencodedString({ - ...se_AssumeRoleWithWebIdentityRequest(input, context), - Action: "AssumeRoleWithWebIdentity", - Version: "2011-06-15" - }); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_AssumeRoleWithWebIdentityCommand = se_AssumeRoleWithWebIdentityCommand; - var se_DecodeAuthorizationMessageCommand = async (input, context) => { - const headers = SHARED_HEADERS; - let body; - body = buildFormUrlencodedString({ - ...se_DecodeAuthorizationMessageRequest(input, context), - Action: "DecodeAuthorizationMessage", - Version: "2011-06-15" - }); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_DecodeAuthorizationMessageCommand = se_DecodeAuthorizationMessageCommand; - var se_GetAccessKeyInfoCommand = async (input, context) => { - const headers = SHARED_HEADERS; - let body; - body = buildFormUrlencodedString({ - ...se_GetAccessKeyInfoRequest(input, context), - Action: "GetAccessKeyInfo", - Version: "2011-06-15" - }); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + exports2.getSSOTokenFromFile = void 0; + var fs_1 = require("fs"); + var getSSOTokenFilepath_1 = require_getSSOTokenFilepath2(); + var { readFile } = fs_1.promises; + var getSSOTokenFromFile2 = async (id) => { + const ssoTokenFilepath = (0, getSSOTokenFilepath_1.getSSOTokenFilepath)(id); + const ssoTokenText = await readFile(ssoTokenFilepath, "utf8"); + return JSON.parse(ssoTokenText); }; - exports2.se_GetAccessKeyInfoCommand = se_GetAccessKeyInfoCommand; - var se_GetCallerIdentityCommand = async (input, context) => { - const headers = SHARED_HEADERS; - let body; - body = buildFormUrlencodedString({ - ...se_GetCallerIdentityRequest(input, context), - Action: "GetCallerIdentity", - Version: "2011-06-15" - }); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + exports2.getSSOTokenFromFile = getSSOTokenFromFile2; + } +}); + +// ../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/slurpFile.js +var require_slurpFile2 = __commonJS({ + "../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/slurpFile.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.slurpFile = void 0; + var fs_1 = require("fs"); + var { readFile } = fs_1.promises; + var filePromisesHash = {}; + var slurpFile = (path, options) => { + if (!filePromisesHash[path] || (options === null || options === void 0 ? void 0 : options.ignoreCache)) { + filePromisesHash[path] = readFile(path, "utf8"); + } + return filePromisesHash[path]; }; - exports2.se_GetCallerIdentityCommand = se_GetCallerIdentityCommand; - var se_GetFederationTokenCommand = async (input, context) => { - const headers = SHARED_HEADERS; - let body; - body = buildFormUrlencodedString({ - ...se_GetFederationTokenRequest(input, context), - Action: "GetFederationToken", - Version: "2011-06-15" - }); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + exports2.slurpFile = slurpFile; + } +}); + +// ../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/index.js +var require_dist_cjs41 = __commonJS({ + "../../../node_modules/@smithy/shared-ini-file-loader/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - exports2.se_GetFederationTokenCommand = se_GetFederationTokenCommand; - var se_GetSessionTokenCommand = async (input, context) => { - const headers = SHARED_HEADERS; - let body; - body = buildFormUrlencodedString({ - ...se_GetSessionTokenRequest(input, context), - Action: "GetSessionToken", - Version: "2011-06-15" - }); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; }; - exports2.se_GetSessionTokenCommand = se_GetSessionTokenCommand; - var de_AssumeRoleCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_AssumeRoleCommandError(output, context); + var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + CONFIG_PREFIX_SEPARATOR: () => CONFIG_PREFIX_SEPARATOR, + DEFAULT_PROFILE: () => DEFAULT_PROFILE, + ENV_PROFILE: () => ENV_PROFILE, + getProfileName: () => getProfileName, + loadSharedConfigFiles: () => loadSharedConfigFiles, + loadSsoSessionData: () => loadSsoSessionData, + parseKnownFiles: () => parseKnownFiles + }); + module2.exports = __toCommonJS2(src_exports); + __reExport(src_exports, require_getHomeDir2(), module2.exports); + var ENV_PROFILE = "AWS_PROFILE"; + var DEFAULT_PROFILE = "default"; + var getProfileName = /* @__PURE__ */ __name((init) => init.profile || process.env[ENV_PROFILE] || DEFAULT_PROFILE, "getProfileName"); + __reExport(src_exports, require_getSSOTokenFilepath2(), module2.exports); + __reExport(src_exports, require_getSSOTokenFromFile2(), module2.exports); + var import_types5 = require_dist_cjs(); + var getConfigData = /* @__PURE__ */ __name((data) => Object.entries(data).filter(([key]) => { + const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR); + if (indexOfSeparator === -1) { + return false; + } + return Object.values(import_types5.IniSectionType).includes(key.substring(0, indexOfSeparator)); + }).reduce( + (acc, [key, value]) => { + const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR); + const updatedKey = key.substring(0, indexOfSeparator) === import_types5.IniSectionType.PROFILE ? key.substring(indexOfSeparator + 1) : key; + acc[updatedKey] = value; + return acc; + }, + { + // Populate default profile, if present. + ...data.default && { default: data.default } + } + ), "getConfigData"); + var import_path = require("path"); + var import_getHomeDir = require_getHomeDir2(); + var ENV_CONFIG_PATH = "AWS_CONFIG_FILE"; + var getConfigFilepath = /* @__PURE__ */ __name(() => process.env[ENV_CONFIG_PATH] || (0, import_path.join)((0, import_getHomeDir.getHomeDir)(), ".aws", "config"), "getConfigFilepath"); + var import_getHomeDir2 = require_getHomeDir2(); + var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE"; + var getCredentialsFilepath = /* @__PURE__ */ __name(() => process.env[ENV_CREDENTIALS_PATH] || (0, import_path.join)((0, import_getHomeDir2.getHomeDir)(), ".aws", "credentials"), "getCredentialsFilepath"); + var import_getHomeDir3 = require_getHomeDir2(); + var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/; + var profileNameBlockList = ["__proto__", "profile __proto__"]; + var parseIni = /* @__PURE__ */ __name((iniData) => { + const map = {}; + let currentSection; + let currentSubSection; + for (const iniLine of iniData.split(/\r?\n/)) { + const trimmedLine = iniLine.split(/(^|\s)[;#]/)[0].trim(); + const isSection = trimmedLine[0] === "[" && trimmedLine[trimmedLine.length - 1] === "]"; + if (isSection) { + currentSection = void 0; + currentSubSection = void 0; + const sectionName = trimmedLine.substring(1, trimmedLine.length - 1); + const matches = prefixKeyRegex.exec(sectionName); + if (matches) { + const [, prefix, , name] = matches; + if (Object.values(import_types5.IniSectionType).includes(prefix)) { + currentSection = [prefix, name].join(CONFIG_PREFIX_SEPARATOR); + } + } else { + currentSection = sectionName; + } + if (profileNameBlockList.includes(sectionName)) { + throw new Error(`Found invalid profile name "${sectionName}"`); + } + } else if (currentSection) { + const indexOfEqualsSign = trimmedLine.indexOf("="); + if (![0, -1].includes(indexOfEqualsSign)) { + const [name, value] = [ + trimmedLine.substring(0, indexOfEqualsSign).trim(), + trimmedLine.substring(indexOfEqualsSign + 1).trim() + ]; + if (value === "") { + currentSubSection = name; + } else { + if (currentSubSection && iniLine.trimStart() === iniLine) { + currentSubSection = void 0; + } + map[currentSection] = map[currentSection] || {}; + const key = currentSubSection ? [currentSubSection, name].join(CONFIG_PREFIX_SEPARATOR) : name; + map[currentSection][key] = value; + } + } + } } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_AssumeRoleResponse(data.AssumeRoleResult, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; - }; - exports2.de_AssumeRoleCommand = de_AssumeRoleCommand; - var de_AssumeRoleCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadQueryErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ExpiredTokenException": - case "com.amazonaws.sts#ExpiredTokenException": - throw await de_ExpiredTokenExceptionRes(parsedOutput, context); - case "MalformedPolicyDocument": - case "com.amazonaws.sts#MalformedPolicyDocumentException": - throw await de_MalformedPolicyDocumentExceptionRes(parsedOutput, context); - case "PackedPolicyTooLarge": - case "com.amazonaws.sts#PackedPolicyTooLargeException": - throw await de_PackedPolicyTooLargeExceptionRes(parsedOutput, context); - case "RegionDisabledException": - case "com.amazonaws.sts#RegionDisabledException": - throw await de_RegionDisabledExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody: parsedBody.Error, - errorCode - }); + return map; + }, "parseIni"); + var import_slurpFile = require_slurpFile2(); + var swallowError = /* @__PURE__ */ __name(() => ({}), "swallowError"); + var CONFIG_PREFIX_SEPARATOR = "."; + var loadSharedConfigFiles = /* @__PURE__ */ __name(async (init = {}) => { + const { filepath = getCredentialsFilepath(), configFilepath = getConfigFilepath() } = init; + const homeDir = (0, import_getHomeDir3.getHomeDir)(); + const relativeHomeDirPrefix = "~/"; + let resolvedFilepath = filepath; + if (filepath.startsWith(relativeHomeDirPrefix)) { + resolvedFilepath = (0, import_path.join)(homeDir, filepath.slice(2)); } - }; - var de_AssumeRoleWithSAMLCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_AssumeRoleWithSAMLCommandError(output, context); + let resolvedConfigFilepath = configFilepath; + if (configFilepath.startsWith(relativeHomeDirPrefix)) { + resolvedConfigFilepath = (0, import_path.join)(homeDir, configFilepath.slice(2)); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_AssumeRoleWithSAMLResponse(data.AssumeRoleWithSAMLResult, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; - }; - exports2.de_AssumeRoleWithSAMLCommand = de_AssumeRoleWithSAMLCommand; - var de_AssumeRoleWithSAMLCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) + const parsedFiles = await Promise.all([ + (0, import_slurpFile.slurpFile)(resolvedConfigFilepath, { + ignoreCache: init.ignoreCache + }).then(parseIni).then(getConfigData).catch(swallowError), + (0, import_slurpFile.slurpFile)(resolvedFilepath, { + ignoreCache: init.ignoreCache + }).then(parseIni).catch(swallowError) + ]); + return { + configFile: parsedFiles[0], + credentialsFile: parsedFiles[1] }; - const errorCode = loadQueryErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ExpiredTokenException": - case "com.amazonaws.sts#ExpiredTokenException": - throw await de_ExpiredTokenExceptionRes(parsedOutput, context); - case "IDPRejectedClaim": - case "com.amazonaws.sts#IDPRejectedClaimException": - throw await de_IDPRejectedClaimExceptionRes(parsedOutput, context); - case "InvalidIdentityToken": - case "com.amazonaws.sts#InvalidIdentityTokenException": - throw await de_InvalidIdentityTokenExceptionRes(parsedOutput, context); - case "MalformedPolicyDocument": - case "com.amazonaws.sts#MalformedPolicyDocumentException": - throw await de_MalformedPolicyDocumentExceptionRes(parsedOutput, context); - case "PackedPolicyTooLarge": - case "com.amazonaws.sts#PackedPolicyTooLargeException": - throw await de_PackedPolicyTooLargeExceptionRes(parsedOutput, context); - case "RegionDisabledException": - case "com.amazonaws.sts#RegionDisabledException": - throw await de_RegionDisabledExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody: parsedBody.Error, - errorCode - }); + }, "loadSharedConfigFiles"); + var getSsoSessionData = /* @__PURE__ */ __name((data) => Object.entries(data).filter(([key]) => key.startsWith(import_types5.IniSectionType.SSO_SESSION + CONFIG_PREFIX_SEPARATOR)).reduce((acc, [key, value]) => ({ ...acc, [key.substring(key.indexOf(CONFIG_PREFIX_SEPARATOR) + 1)]: value }), {}), "getSsoSessionData"); + var import_slurpFile2 = require_slurpFile2(); + var swallowError2 = /* @__PURE__ */ __name(() => ({}), "swallowError"); + var loadSsoSessionData = /* @__PURE__ */ __name(async (init = {}) => (0, import_slurpFile2.slurpFile)(init.configFilepath ?? getConfigFilepath()).then(parseIni).then(getSsoSessionData).catch(swallowError2), "loadSsoSessionData"); + var mergeConfigFiles = /* @__PURE__ */ __name((...files) => { + const merged = {}; + for (const file of files) { + for (const [key, values] of Object.entries(file)) { + if (merged[key] !== void 0) { + Object.assign(merged[key], values); + } else { + merged[key] = values; + } + } } + return merged; + }, "mergeConfigFiles"); + var parseKnownFiles = /* @__PURE__ */ __name(async (init) => { + const parsedFiles = await loadSharedConfigFiles(init); + return mergeConfigFiles(parsedFiles.configFile, parsedFiles.credentialsFile); + }, "parseKnownFiles"); + } +}); + +// ../../../node_modules/@smithy/node-config-provider/dist-cjs/index.js +var require_dist_cjs42 = __commonJS({ + "../../../node_modules/@smithy/node-config-provider/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var de_AssumeRoleWithWebIdentityCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_AssumeRoleWithWebIdentityCommandError(output, context); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_AssumeRoleWithWebIdentityResponse(data.AssumeRoleWithWebIdentityResult, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; + return to; }; - exports2.de_AssumeRoleWithWebIdentityCommand = de_AssumeRoleWithWebIdentityCommand; - var de_AssumeRoleWithWebIdentityCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadQueryErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ExpiredTokenException": - case "com.amazonaws.sts#ExpiredTokenException": - throw await de_ExpiredTokenExceptionRes(parsedOutput, context); - case "IDPCommunicationError": - case "com.amazonaws.sts#IDPCommunicationErrorException": - throw await de_IDPCommunicationErrorExceptionRes(parsedOutput, context); - case "IDPRejectedClaim": - case "com.amazonaws.sts#IDPRejectedClaimException": - throw await de_IDPRejectedClaimExceptionRes(parsedOutput, context); - case "InvalidIdentityToken": - case "com.amazonaws.sts#InvalidIdentityTokenException": - throw await de_InvalidIdentityTokenExceptionRes(parsedOutput, context); - case "MalformedPolicyDocument": - case "com.amazonaws.sts#MalformedPolicyDocumentException": - throw await de_MalformedPolicyDocumentExceptionRes(parsedOutput, context); - case "PackedPolicyTooLarge": - case "com.amazonaws.sts#PackedPolicyTooLargeException": - throw await de_PackedPolicyTooLargeExceptionRes(parsedOutput, context); - case "RegionDisabledException": - case "com.amazonaws.sts#RegionDisabledException": - throw await de_RegionDisabledExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody: parsedBody.Error, - errorCode - }); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + loadConfig: () => loadConfig + }); + module2.exports = __toCommonJS2(src_exports); + var import_property_provider2 = require_dist_cjs40(); + function getSelectorName(functionString) { + try { + const constants = new Set(Array.from(functionString.match(/([A-Z_]){3,}/g) ?? [])); + constants.delete("CONFIG"); + constants.delete("CONFIG_PREFIX_SEPARATOR"); + constants.delete("ENV"); + return [...constants].join(", "); + } catch (e) { + return functionString; } - }; - var de_DecodeAuthorizationMessageCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_DecodeAuthorizationMessageCommandError(output, context); + } + __name(getSelectorName, "getSelectorName"); + var fromEnv = /* @__PURE__ */ __name((envVarSelector, logger) => async () => { + try { + const config = envVarSelector(process.env); + if (config === void 0) { + throw new Error(); + } + return config; + } catch (e) { + throw new import_property_provider2.CredentialsProviderError( + e.message || `Not found in ENV: ${getSelectorName(envVarSelector.toString())}`, + { logger } + ); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_DecodeAuthorizationMessageResponse(data.DecodeAuthorizationMessageResult, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; - }; - exports2.de_DecodeAuthorizationMessageCommand = de_DecodeAuthorizationMessageCommand; - var de_DecodeAuthorizationMessageCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadQueryErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidAuthorizationMessageException": - case "com.amazonaws.sts#InvalidAuthorizationMessageException": - throw await de_InvalidAuthorizationMessageExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody: parsedBody.Error, - errorCode - }); + }, "fromEnv"); + var import_shared_ini_file_loader = require_dist_cjs41(); + var fromSharedConfigFiles = /* @__PURE__ */ __name((configSelector, { preferredFile = "config", ...init } = {}) => async () => { + const profile = (0, import_shared_ini_file_loader.getProfileName)(init); + const { configFile, credentialsFile } = await (0, import_shared_ini_file_loader.loadSharedConfigFiles)(init); + const profileFromCredentials = credentialsFile[profile] || {}; + const profileFromConfig = configFile[profile] || {}; + const mergedProfile = preferredFile === "config" ? { ...profileFromCredentials, ...profileFromConfig } : { ...profileFromConfig, ...profileFromCredentials }; + try { + const cfgFile = preferredFile === "config" ? configFile : credentialsFile; + const configValue = configSelector(mergedProfile, cfgFile); + if (configValue === void 0) { + throw new Error(); + } + return configValue; + } catch (e) { + throw new import_property_provider2.CredentialsProviderError( + e.message || `Not found in config files w/ profile [${profile}]: ${getSelectorName(configSelector.toString())}`, + { logger: init.logger } + ); } + }, "fromSharedConfigFiles"); + var isFunction = /* @__PURE__ */ __name((func) => typeof func === "function", "isFunction"); + var fromStatic = /* @__PURE__ */ __name((defaultValue) => isFunction(defaultValue) ? async () => await defaultValue() : (0, import_property_provider2.fromStatic)(defaultValue), "fromStatic"); + var loadConfig = /* @__PURE__ */ __name(({ environmentVariableSelector, configFileSelector, default: defaultValue }, configuration = {}) => (0, import_property_provider2.memoize)( + (0, import_property_provider2.chain)( + fromEnv(environmentVariableSelector), + fromSharedConfigFiles(configFileSelector, configuration), + fromStatic(defaultValue) + ) + ), "loadConfig"); + } +}); + +// ../../../node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointUrlConfig.js +var require_getEndpointUrlConfig2 = __commonJS({ + "../../../node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointUrlConfig.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getEndpointUrlConfig = void 0; + var shared_ini_file_loader_1 = require_dist_cjs41(); + var ENV_ENDPOINT_URL = "AWS_ENDPOINT_URL"; + var CONFIG_ENDPOINT_URL = "endpoint_url"; + var getEndpointUrlConfig = (serviceId) => ({ + environmentVariableSelector: (env) => { + const serviceSuffixParts = serviceId.split(" ").map((w) => w.toUpperCase()); + const serviceEndpointUrl = env[[ENV_ENDPOINT_URL, ...serviceSuffixParts].join("_")]; + if (serviceEndpointUrl) + return serviceEndpointUrl; + const endpointUrl = env[ENV_ENDPOINT_URL]; + if (endpointUrl) + return endpointUrl; + return void 0; + }, + configFileSelector: (profile, config) => { + if (config && profile.services) { + const servicesSection = config[["services", profile.services].join(shared_ini_file_loader_1.CONFIG_PREFIX_SEPARATOR)]; + if (servicesSection) { + const servicePrefixParts = serviceId.split(" ").map((w) => w.toLowerCase()); + const endpointUrl2 = servicesSection[[servicePrefixParts.join("_"), CONFIG_ENDPOINT_URL].join(shared_ini_file_loader_1.CONFIG_PREFIX_SEPARATOR)]; + if (endpointUrl2) + return endpointUrl2; + } + } + const endpointUrl = profile[CONFIG_ENDPOINT_URL]; + if (endpointUrl) + return endpointUrl; + return void 0; + }, + default: void 0 + }); + exports2.getEndpointUrlConfig = getEndpointUrlConfig; + } +}); + +// ../../../node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointFromConfig.js +var require_getEndpointFromConfig2 = __commonJS({ + "../../../node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointFromConfig.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getEndpointFromConfig = void 0; + var node_config_provider_1 = require_dist_cjs42(); + var getEndpointUrlConfig_1 = require_getEndpointUrlConfig2(); + var getEndpointFromConfig = async (serviceId) => (0, node_config_provider_1.loadConfig)((0, getEndpointUrlConfig_1.getEndpointUrlConfig)(serviceId !== null && serviceId !== void 0 ? serviceId : ""))(); + exports2.getEndpointFromConfig = getEndpointFromConfig; + } +}); + +// ../../../node_modules/@smithy/querystring-parser/dist-cjs/index.js +var require_dist_cjs43 = __commonJS({ + "../../../node_modules/@smithy/querystring-parser/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var de_GetAccessKeyInfoCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_GetAccessKeyInfoCommandError(output, context); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_GetAccessKeyInfoResponse(data.GetAccessKeyInfoResult, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; - }; - exports2.de_GetAccessKeyInfoCommand = de_GetAccessKeyInfoCommand; - var de_GetAccessKeyInfoCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadQueryErrorCode(output, parsedOutput.body); - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody: parsedBody.Error, - errorCode - }); + return to; }; - var de_GetCallerIdentityCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_GetCallerIdentityCommandError(output, context); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + parseQueryString: () => parseQueryString + }); + module2.exports = __toCommonJS2(src_exports); + function parseQueryString(querystring) { + const query = {}; + querystring = querystring.replace(/^\?/, ""); + if (querystring) { + for (const pair of querystring.split("&")) { + let [key, value = null] = pair.split("="); + key = decodeURIComponent(key); + if (value) { + value = decodeURIComponent(value); + } + if (!(key in query)) { + query[key] = value; + } else if (Array.isArray(query[key])) { + query[key].push(value); + } else { + query[key] = [query[key], value]; + } + } } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_GetCallerIdentityResponse(data.GetCallerIdentityResult, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; - }; - exports2.de_GetCallerIdentityCommand = de_GetCallerIdentityCommand; - var de_GetCallerIdentityCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadQueryErrorCode(output, parsedOutput.body); - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody: parsedBody.Error, - errorCode - }); + return query; + } + __name(parseQueryString, "parseQueryString"); + } +}); + +// ../../../node_modules/@smithy/url-parser/dist-cjs/index.js +var require_dist_cjs44 = __commonJS({ + "../../../node_modules/@smithy/url-parser/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var de_GetFederationTokenCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_GetFederationTokenCommandError(output, context); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_GetFederationTokenResponse(data.GetFederationTokenResult, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; + return to; }; - exports2.de_GetFederationTokenCommand = de_GetFederationTokenCommand; - var de_GetFederationTokenCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadQueryErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "MalformedPolicyDocument": - case "com.amazonaws.sts#MalformedPolicyDocumentException": - throw await de_MalformedPolicyDocumentExceptionRes(parsedOutput, context); - case "PackedPolicyTooLarge": - case "com.amazonaws.sts#PackedPolicyTooLargeException": - throw await de_PackedPolicyTooLargeExceptionRes(parsedOutput, context); - case "RegionDisabledException": - case "com.amazonaws.sts#RegionDisabledException": - throw await de_RegionDisabledExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody: parsedBody.Error, - errorCode - }); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + parseUrl: () => parseUrl + }); + module2.exports = __toCommonJS2(src_exports); + var import_querystring_parser = require_dist_cjs43(); + var parseUrl = /* @__PURE__ */ __name((url2) => { + if (typeof url2 === "string") { + return parseUrl(new URL(url2)); } - }; - var de_GetSessionTokenCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_GetSessionTokenCommandError(output, context); + const { hostname, pathname, port, protocol, search } = url2; + let query; + if (search) { + query = (0, import_querystring_parser.parseQueryString)(search); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_GetSessionTokenResponse(data.GetSessionTokenResult, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; - }; - exports2.de_GetSessionTokenCommand = de_GetSessionTokenCommand; - var de_GetSessionTokenCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) + return { + hostname, + port: port ? parseInt(port) : void 0, + protocol, + path: pathname, + query }; - const errorCode = loadQueryErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "RegionDisabledException": - case "com.amazonaws.sts#RegionDisabledException": - throw await de_RegionDisabledExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody: parsedBody.Error, - errorCode - }); - } - }; - var de_ExpiredTokenExceptionRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = de_ExpiredTokenException(body.Error, context); - const exception = new models_0_1.ExpiredTokenException({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized - }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_IDPCommunicationErrorExceptionRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = de_IDPCommunicationErrorException(body.Error, context); - const exception = new models_0_1.IDPCommunicationErrorException({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized - }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_IDPRejectedClaimExceptionRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = de_IDPRejectedClaimException(body.Error, context); - const exception = new models_0_1.IDPRejectedClaimException({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized - }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_InvalidAuthorizationMessageExceptionRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = de_InvalidAuthorizationMessageException(body.Error, context); - const exception = new models_0_1.InvalidAuthorizationMessageException({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized - }); - return (0, smithy_client_1.decorateServiceException)(exception, body); + }, "parseUrl"); + } +}); + +// ../../../node_modules/@smithy/middleware-serde/dist-cjs/index.js +var require_dist_cjs45 = __commonJS({ + "../../../node_modules/@smithy/middleware-serde/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var de_InvalidIdentityTokenExceptionRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = de_InvalidIdentityTokenException(body.Error, context); - const exception = new models_0_1.InvalidIdentityTokenException({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized - }); - return (0, smithy_client_1.decorateServiceException)(exception, body); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; }; - var de_MalformedPolicyDocumentExceptionRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = de_MalformedPolicyDocumentException(body.Error, context); - const exception = new models_0_1.MalformedPolicyDocumentException({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + deserializerMiddleware: () => deserializerMiddleware, + deserializerMiddlewareOption: () => deserializerMiddlewareOption, + getSerdePlugin: () => getSerdePlugin, + serializerMiddleware: () => serializerMiddleware, + serializerMiddlewareOption: () => serializerMiddlewareOption2 + }); + module2.exports = __toCommonJS2(src_exports); + var deserializerMiddleware = /* @__PURE__ */ __name((options, deserializer) => (next) => async (args) => { + const { response } = await next(args); + try { + const parsed = await deserializer(response, options); + return { + response, + output: parsed + }; + } catch (error) { + Object.defineProperty(error, "$response", { + value: response + }); + if (!("$metadata" in error)) { + const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`; + error.message += "\n " + hint; + if (typeof error.$responseBodyText !== "undefined") { + if (error.$response) { + error.$response.body = error.$responseBodyText; + } + } + } + throw error; + } + }, "deserializerMiddleware"); + var serializerMiddleware = /* @__PURE__ */ __name((options, serializer) => (next, context) => async (args) => { + var _a; + const endpoint = ((_a = context.endpointV2) == null ? void 0 : _a.url) && options.urlParser ? async () => options.urlParser(context.endpointV2.url) : options.endpoint; + if (!endpoint) { + throw new Error("No valid endpoint provider available."); + } + const request2 = await serializer(args.input, { ...options, endpoint }); + return next({ + ...args, + request: request2 }); - return (0, smithy_client_1.decorateServiceException)(exception, body); + }, "serializerMiddleware"); + var deserializerMiddlewareOption = { + name: "deserializerMiddleware", + step: "deserialize", + tags: ["DESERIALIZER"], + override: true }; - var de_PackedPolicyTooLargeExceptionRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = de_PackedPolicyTooLargeException(body.Error, context); - const exception = new models_0_1.PackedPolicyTooLargeException({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized - }); - return (0, smithy_client_1.decorateServiceException)(exception, body); + var serializerMiddlewareOption2 = { + name: "serializerMiddleware", + step: "serialize", + tags: ["SERIALIZER"], + override: true }; - var de_RegionDisabledExceptionRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = de_RegionDisabledException(body.Error, context); - const exception = new models_0_1.RegionDisabledException({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized - }); - return (0, smithy_client_1.decorateServiceException)(exception, body); + function getSerdePlugin(config, serializer, deserializer) { + return { + applyToStack: (commandStack) => { + commandStack.add(deserializerMiddleware(config, deserializer), deserializerMiddlewareOption); + commandStack.add(serializerMiddleware(config, serializer), serializerMiddlewareOption2); + } + }; + } + __name(getSerdePlugin, "getSerdePlugin"); + } +}); + +// ../../../node_modules/@smithy/middleware-endpoint/dist-cjs/index.js +var require_dist_cjs46 = __commonJS({ + "../../../node_modules/@smithy/middleware-endpoint/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var se_AssumeRoleRequest = (input, context) => { - const entries = {}; - if (input.RoleArn != null) { - entries["RoleArn"] = input.RoleArn; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - if (input.RoleSessionName != null) { - entries["RoleSessionName"] = input.RoleSessionName; + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + endpointMiddleware: () => endpointMiddleware, + endpointMiddlewareOptions: () => endpointMiddlewareOptions2, + getEndpointFromInstructions: () => getEndpointFromInstructions, + getEndpointPlugin: () => getEndpointPlugin, + resolveEndpointConfig: () => resolveEndpointConfig, + resolveParams: () => resolveParams, + toEndpointV1: () => toEndpointV1 + }); + module2.exports = __toCommonJS2(src_exports); + var resolveParamsForS3 = /* @__PURE__ */ __name(async (endpointParams) => { + const bucket = (endpointParams == null ? void 0 : endpointParams.Bucket) || ""; + if (typeof endpointParams.Bucket === "string") { + endpointParams.Bucket = bucket.replace(/#/g, encodeURIComponent("#")).replace(/\?/g, encodeURIComponent("?")); } - if (input.PolicyArns != null) { - const memberEntries = se_policyDescriptorListType(input.PolicyArns, context); - if (input.PolicyArns?.length === 0) { - entries.PolicyArns = []; + if (isArnBucketName(bucket)) { + if (endpointParams.ForcePathStyle === true) { + throw new Error("Path-style addressing cannot be used with ARN buckets"); } - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `PolicyArns.${key}`; - entries[loc] = value; - }); + } else if (!isDnsCompatibleBucketName(bucket) || bucket.indexOf(".") !== -1 && !String(endpointParams.Endpoint).startsWith("http:") || bucket.toLowerCase() !== bucket || bucket.length < 3) { + endpointParams.ForcePathStyle = true; } - if (input.Policy != null) { - entries["Policy"] = input.Policy; + if (endpointParams.DisableMultiRegionAccessPoints) { + endpointParams.disableMultiRegionAccessPoints = true; + endpointParams.DisableMRAP = true; } - if (input.DurationSeconds != null) { - entries["DurationSeconds"] = input.DurationSeconds; + return endpointParams; + }, "resolveParamsForS3"); + var DOMAIN_PATTERN = /^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/; + var IP_ADDRESS_PATTERN = /(\d+\.){3}\d+/; + var DOTS_PATTERN = /\.\./; + var isDnsCompatibleBucketName = /* @__PURE__ */ __name((bucketName) => DOMAIN_PATTERN.test(bucketName) && !IP_ADDRESS_PATTERN.test(bucketName) && !DOTS_PATTERN.test(bucketName), "isDnsCompatibleBucketName"); + var isArnBucketName = /* @__PURE__ */ __name((bucketName) => { + const [arn, partition, service, , , bucket] = bucketName.split(":"); + const isArn = arn === "arn" && bucketName.split(":").length >= 6; + const isValidArn = Boolean(isArn && partition && service && bucket); + if (isArn && !isValidArn) { + throw new Error(`Invalid ARN: ${bucketName} was an invalid ARN.`); } - if (input.Tags != null) { - const memberEntries = se_tagListType(input.Tags, context); - if (input.Tags?.length === 0) { - entries.Tags = []; + return isValidArn; + }, "isArnBucketName"); + var createConfigValueProvider = /* @__PURE__ */ __name((configKey, canonicalEndpointParamKey, config) => { + const configProvider = /* @__PURE__ */ __name(async () => { + const configValue = config[configKey] ?? config[canonicalEndpointParamKey]; + if (typeof configValue === "function") { + return configValue(); } - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `Tags.${key}`; - entries[loc] = value; - }); + return configValue; + }, "configProvider"); + if (configKey === "credentialScope" || canonicalEndpointParamKey === "CredentialScope") { + return async () => { + const credentials = typeof config.credentials === "function" ? await config.credentials() : config.credentials; + const configValue = (credentials == null ? void 0 : credentials.credentialScope) ?? (credentials == null ? void 0 : credentials.CredentialScope); + return configValue; + }; } - if (input.TransitiveTagKeys != null) { - const memberEntries = se_tagKeyListType(input.TransitiveTagKeys, context); - if (input.TransitiveTagKeys?.length === 0) { - entries.TransitiveTagKeys = []; - } - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `TransitiveTagKeys.${key}`; - entries[loc] = value; - }); + if (configKey === "accountId" || canonicalEndpointParamKey === "AccountId") { + return async () => { + const credentials = typeof config.credentials === "function" ? await config.credentials() : config.credentials; + const configValue = (credentials == null ? void 0 : credentials.accountId) ?? (credentials == null ? void 0 : credentials.AccountId); + return configValue; + }; } - if (input.ExternalId != null) { - entries["ExternalId"] = input.ExternalId; + if (configKey === "endpoint" || canonicalEndpointParamKey === "endpoint") { + return async () => { + const endpoint = await configProvider(); + if (endpoint && typeof endpoint === "object") { + if ("url" in endpoint) { + return endpoint.url.href; + } + if ("hostname" in endpoint) { + const { protocol, hostname, port, path } = endpoint; + return `${protocol}//${hostname}${port ? ":" + port : ""}${path}`; + } + } + return endpoint; + }; } - if (input.SerialNumber != null) { - entries["SerialNumber"] = input.SerialNumber; + return configProvider; + }, "createConfigValueProvider"); + var import_getEndpointFromConfig = require_getEndpointFromConfig2(); + var import_url_parser = require_dist_cjs44(); + var toEndpointV1 = /* @__PURE__ */ __name((endpoint) => { + if (typeof endpoint === "object") { + if ("url" in endpoint) { + return (0, import_url_parser.parseUrl)(endpoint.url); + } + return endpoint; } - if (input.TokenCode != null) { - entries["TokenCode"] = input.TokenCode; + return (0, import_url_parser.parseUrl)(endpoint); + }, "toEndpointV1"); + var getEndpointFromInstructions = /* @__PURE__ */ __name(async (commandInput, instructionsSupplier, clientConfig, context) => { + if (!clientConfig.endpoint) { + let endpointFromConfig; + if (clientConfig.serviceConfiguredEndpoint) { + endpointFromConfig = await clientConfig.serviceConfiguredEndpoint(); + } else { + endpointFromConfig = await (0, import_getEndpointFromConfig.getEndpointFromConfig)(clientConfig.serviceId); + } + if (endpointFromConfig) { + clientConfig.endpoint = () => Promise.resolve(toEndpointV1(endpointFromConfig)); + } } - if (input.SourceIdentity != null) { - entries["SourceIdentity"] = input.SourceIdentity; + const endpointParams = await resolveParams(commandInput, instructionsSupplier, clientConfig); + if (typeof clientConfig.endpointProvider !== "function") { + throw new Error("config.endpointProvider is not set."); } - if (input.ProvidedContexts != null) { - const memberEntries = se_ProvidedContextsListType(input.ProvidedContexts, context); - if (input.ProvidedContexts?.length === 0) { - entries.ProvidedContexts = []; + const endpoint = clientConfig.endpointProvider(endpointParams, context); + return endpoint; + }, "getEndpointFromInstructions"); + var resolveParams = /* @__PURE__ */ __name(async (commandInput, instructionsSupplier, clientConfig) => { + var _a; + const endpointParams = {}; + const instructions = ((_a = instructionsSupplier == null ? void 0 : instructionsSupplier.getEndpointParameterInstructions) == null ? void 0 : _a.call(instructionsSupplier)) || {}; + for (const [name, instruction] of Object.entries(instructions)) { + switch (instruction.type) { + case "staticContextParams": + endpointParams[name] = instruction.value; + break; + case "contextParams": + endpointParams[name] = commandInput[instruction.name]; + break; + case "clientContextParams": + case "builtInParams": + endpointParams[name] = await createConfigValueProvider(instruction.name, name, clientConfig)(); + break; + default: + throw new Error("Unrecognized endpoint parameter instruction: " + JSON.stringify(instruction)); } - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `ProvidedContexts.${key}`; - entries[loc] = value; - }); - } - return entries; - }; - var se_AssumeRoleWithSAMLRequest = (input, context) => { - const entries = {}; - if (input.RoleArn != null) { - entries["RoleArn"] = input.RoleArn; } - if (input.PrincipalArn != null) { - entries["PrincipalArn"] = input.PrincipalArn; + if (Object.keys(instructions).length === 0) { + Object.assign(endpointParams, clientConfig); } - if (input.SAMLAssertion != null) { - entries["SAMLAssertion"] = input.SAMLAssertion; + if (String(clientConfig.serviceId).toLowerCase() === "s3") { + await resolveParamsForS3(endpointParams); } - if (input.PolicyArns != null) { - const memberEntries = se_policyDescriptorListType(input.PolicyArns, context); - if (input.PolicyArns?.length === 0) { - entries.PolicyArns = []; + return endpointParams; + }, "resolveParams"); + var import_util_middleware3 = require_dist_cjs10(); + var endpointMiddleware = /* @__PURE__ */ __name(({ + config, + instructions + }) => { + return (next, context) => async (args) => { + var _a, _b, _c; + const endpoint = await getEndpointFromInstructions( + args.input, + { + getEndpointParameterInstructions() { + return instructions; + } + }, + { ...config }, + context + ); + context.endpointV2 = endpoint; + context.authSchemes = (_a = endpoint.properties) == null ? void 0 : _a.authSchemes; + const authScheme = (_b = context.authSchemes) == null ? void 0 : _b[0]; + if (authScheme) { + context["signing_region"] = authScheme.signingRegion; + context["signing_service"] = authScheme.signingName; + const smithyContext = (0, import_util_middleware3.getSmithyContext)(context); + const httpAuthOption = (_c = smithyContext == null ? void 0 : smithyContext.selectedHttpAuthScheme) == null ? void 0 : _c.httpAuthOption; + if (httpAuthOption) { + httpAuthOption.signingProperties = Object.assign( + httpAuthOption.signingProperties || {}, + { + signing_region: authScheme.signingRegion, + signingRegion: authScheme.signingRegion, + signing_service: authScheme.signingName, + signingName: authScheme.signingName, + signingRegionSet: authScheme.signingRegionSet + }, + authScheme.properties + ); + } } - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `PolicyArns.${key}`; - entries[loc] = value; + return next({ + ...args }); - } - if (input.Policy != null) { - entries["Policy"] = input.Policy; - } - if (input.DurationSeconds != null) { - entries["DurationSeconds"] = input.DurationSeconds; - } - return entries; + }; + }, "endpointMiddleware"); + var import_middleware_serde2 = require_dist_cjs45(); + var endpointMiddlewareOptions2 = { + step: "serialize", + tags: ["ENDPOINT_PARAMETERS", "ENDPOINT_V2", "ENDPOINT"], + name: "endpointV2Middleware", + override: true, + relation: "before", + toMiddleware: import_middleware_serde2.serializerMiddlewareOption.name }; - var se_AssumeRoleWithWebIdentityRequest = (input, context) => { - const entries = {}; - if (input.RoleArn != null) { - entries["RoleArn"] = input.RoleArn; - } - if (input.RoleSessionName != null) { - entries["RoleSessionName"] = input.RoleSessionName; - } - if (input.WebIdentityToken != null) { - entries["WebIdentityToken"] = input.WebIdentityToken; - } - if (input.ProviderId != null) { - entries["ProviderId"] = input.ProviderId; + var getEndpointPlugin = /* @__PURE__ */ __name((config, instructions) => ({ + applyToStack: (clientStack) => { + clientStack.addRelativeTo( + endpointMiddleware({ + config, + instructions + }), + endpointMiddlewareOptions2 + ); } - if (input.PolicyArns != null) { - const memberEntries = se_policyDescriptorListType(input.PolicyArns, context); - if (input.PolicyArns?.length === 0) { - entries.PolicyArns = []; + }), "getEndpointPlugin"); + var import_getEndpointFromConfig2 = require_getEndpointFromConfig2(); + var resolveEndpointConfig = /* @__PURE__ */ __name((input) => { + const tls = input.tls ?? true; + const { endpoint } = input; + const customEndpointProvider = endpoint != null ? async () => toEndpointV1(await (0, import_util_middleware3.normalizeProvider)(endpoint)()) : void 0; + const isCustomEndpoint = !!endpoint; + const resolvedConfig = { + ...input, + endpoint: customEndpointProvider, + tls, + isCustomEndpoint, + useDualstackEndpoint: (0, import_util_middleware3.normalizeProvider)(input.useDualstackEndpoint ?? false), + useFipsEndpoint: (0, import_util_middleware3.normalizeProvider)(input.useFipsEndpoint ?? false) + }; + let configuredEndpointPromise = void 0; + resolvedConfig.serviceConfiguredEndpoint = async () => { + if (input.serviceId && !configuredEndpointPromise) { + configuredEndpointPromise = (0, import_getEndpointFromConfig2.getEndpointFromConfig)(input.serviceId); } - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `PolicyArns.${key}`; - entries[loc] = value; - }); - } - if (input.Policy != null) { - entries["Policy"] = input.Policy; - } - if (input.DurationSeconds != null) { - entries["DurationSeconds"] = input.DurationSeconds; + return configuredEndpointPromise; + }; + return resolvedConfig; + }, "resolveEndpointConfig"); + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/client/emitWarningIfUnsupportedVersion.js +var warningEmitted, emitWarningIfUnsupportedVersion; +var init_emitWarningIfUnsupportedVersion = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/client/emitWarningIfUnsupportedVersion.js"() { + warningEmitted = false; + emitWarningIfUnsupportedVersion = (version2) => { + if (version2 && !warningEmitted && parseInt(version2.substring(1, version2.indexOf("."))) < 18) { + warningEmitted = true; + process.emitWarning(`NodeDeprecationWarning: The AWS SDK for JavaScript (v3) will +no longer support Node.js 16.x on January 6, 2025. + +To continue receiving updates to AWS services, bug fixes, and security +updates please upgrade to a supported Node.js LTS version. + +More information can be found at: https://a.co/74kJMmI`); } - return entries; }; - var se_DecodeAuthorizationMessageRequest = (input, context) => { - const entries = {}; - if (input.EncodedMessage != null) { - entries["EncodedMessage"] = input.EncodedMessage; + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/client/index.js +var init_client = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/client/index.js"() { + init_emitWarningIfUnsupportedVersion(); + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getDateHeader.js +var import_protocol_http5, getDateHeader; +var init_getDateHeader = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getDateHeader.js"() { + import_protocol_http5 = __toESM(require_dist_cjs2()); + getDateHeader = (response) => import_protocol_http5.HttpResponse.isInstance(response) ? response.headers?.date ?? response.headers?.Date : void 0; + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getSkewCorrectedDate.js +var getSkewCorrectedDate; +var init_getSkewCorrectedDate = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getSkewCorrectedDate.js"() { + getSkewCorrectedDate = (systemClockOffset) => new Date(Date.now() + systemClockOffset); + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/isClockSkewed.js +var isClockSkewed; +var init_isClockSkewed = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/isClockSkewed.js"() { + init_getSkewCorrectedDate(); + isClockSkewed = (clockTime, systemClockOffset) => Math.abs(getSkewCorrectedDate(systemClockOffset).getTime() - clockTime) >= 3e5; + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getUpdatedSystemClockOffset.js +var getUpdatedSystemClockOffset; +var init_getUpdatedSystemClockOffset = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getUpdatedSystemClockOffset.js"() { + init_isClockSkewed(); + getUpdatedSystemClockOffset = (clockTime, currentSystemClockOffset) => { + const clockTimeInMs = Date.parse(clockTime); + if (isClockSkewed(clockTimeInMs, currentSystemClockOffset)) { + return clockTimeInMs - Date.now(); } - return entries; + return currentSystemClockOffset; }; - var se_GetAccessKeyInfoRequest = (input, context) => { - const entries = {}; - if (input.AccessKeyId != null) { - entries["AccessKeyId"] = input.AccessKeyId; + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/index.js +var init_utils = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/index.js"() { + init_getDateHeader(); + init_getSkewCorrectedDate(); + init_getUpdatedSystemClockOffset(); + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.js +var import_protocol_http6, throwSigningPropertyError, validateSigningProperties, AwsSdkSigV4Signer, AWSSDKSigV4Signer; +var init_AwsSdkSigV4Signer = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.js"() { + import_protocol_http6 = __toESM(require_dist_cjs2()); + init_utils(); + throwSigningPropertyError = (name, property) => { + if (!property) { + throw new Error(`Property \`${name}\` is not resolved for AWS SDK SigV4Auth`); } - return entries; + return property; }; - var se_GetCallerIdentityRequest = (input, context) => { - const entries = {}; - return entries; + validateSigningProperties = async (signingProperties) => { + const context = throwSigningPropertyError("context", signingProperties.context); + const config = throwSigningPropertyError("config", signingProperties.config); + const authScheme = context.endpointV2?.properties?.authSchemes?.[0]; + const signerFunction = throwSigningPropertyError("signer", config.signer); + const signer = await signerFunction(authScheme); + const signingRegion = signingProperties?.signingRegion; + const signingRegionSet = signingProperties?.signingRegionSet; + const signingName = signingProperties?.signingName; + return { + config, + signer, + signingRegion, + signingRegionSet, + signingName + }; }; - var se_GetFederationTokenRequest = (input, context) => { - const entries = {}; - if (input.Name != null) { - entries["Name"] = input.Name; - } - if (input.Policy != null) { - entries["Policy"] = input.Policy; - } - if (input.PolicyArns != null) { - const memberEntries = se_policyDescriptorListType(input.PolicyArns, context); - if (input.PolicyArns?.length === 0) { - entries.PolicyArns = []; + AwsSdkSigV4Signer = class { + async sign(httpRequest, identity, signingProperties) { + if (!import_protocol_http6.HttpRequest.isInstance(httpRequest)) { + throw new Error("The request is not an instance of `HttpRequest` and cannot be signed"); } - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `PolicyArns.${key}`; - entries[loc] = value; - }); - } - if (input.DurationSeconds != null) { - entries["DurationSeconds"] = input.DurationSeconds; - } - if (input.Tags != null) { - const memberEntries = se_tagListType(input.Tags, context); - if (input.Tags?.length === 0) { - entries.Tags = []; + const validatedProps = await validateSigningProperties(signingProperties); + const { config, signer } = validatedProps; + let { signingRegion, signingName } = validatedProps; + const handlerExecutionContext = signingProperties.context; + if (handlerExecutionContext?.authSchemes?.length ?? 0 > 1) { + const [first, second] = handlerExecutionContext.authSchemes; + if (first?.name === "sigv4a" && second?.name === "sigv4") { + signingRegion = second?.signingRegion ?? signingRegion; + signingName = second?.signingName ?? signingName; + } } - Object.entries(memberEntries).forEach(([key, value]) => { - const loc = `Tags.${key}`; - entries[loc] = value; + const signedRequest = await signer.sign(httpRequest, { + signingDate: getSkewCorrectedDate(config.systemClockOffset), + signingRegion, + signingService: signingName }); + return signedRequest; + } + errorHandler(signingProperties) { + return (error) => { + const serverTime = error.ServerTime ?? getDateHeader(error.$response); + if (serverTime) { + const config = throwSigningPropertyError("config", signingProperties.config); + const initialSystemClockOffset = config.systemClockOffset; + config.systemClockOffset = getUpdatedSystemClockOffset(serverTime, config.systemClockOffset); + const clockSkewCorrected = config.systemClockOffset !== initialSystemClockOffset; + if (clockSkewCorrected && error.$metadata) { + error.$metadata.clockSkewCorrected = true; + } + } + throw error; + }; } - return entries; - }; - var se_GetSessionTokenRequest = (input, context) => { - const entries = {}; - if (input.DurationSeconds != null) { - entries["DurationSeconds"] = input.DurationSeconds; - } - if (input.SerialNumber != null) { - entries["SerialNumber"] = input.SerialNumber; - } - if (input.TokenCode != null) { - entries["TokenCode"] = input.TokenCode; - } - return entries; - }; - var se_policyDescriptorListType = (input, context) => { - const entries = {}; - let counter = 1; - for (const entry of input) { - if (entry === null) { - continue; + successHandler(httpResponse, signingProperties) { + const dateHeader = getDateHeader(httpResponse); + if (dateHeader) { + const config = throwSigningPropertyError("config", signingProperties.config); + config.systemClockOffset = getUpdatedSystemClockOffset(dateHeader, config.systemClockOffset); } - const memberEntries = se_PolicyDescriptorType(entry, context); - Object.entries(memberEntries).forEach(([key, value]) => { - entries[`member.${counter}.${key}`] = value; - }); - counter++; - } - return entries; - }; - var se_PolicyDescriptorType = (input, context) => { - const entries = {}; - if (input.arn != null) { - entries["arn"] = input.arn; - } - return entries; - }; - var se_ProvidedContext = (input, context) => { - const entries = {}; - if (input.ProviderArn != null) { - entries["ProviderArn"] = input.ProviderArn; } - if (input.ContextAssertion != null) { - entries["ContextAssertion"] = input.ContextAssertion; - } - return entries; }; - var se_ProvidedContextsListType = (input, context) => { - const entries = {}; - let counter = 1; - for (const entry of input) { - if (entry === null) { - continue; + AWSSDKSigV4Signer = AwsSdkSigV4Signer; + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4ASigner.js +var import_protocol_http7, AwsSdkSigV4ASigner; +var init_AwsSdkSigV4ASigner = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4ASigner.js"() { + import_protocol_http7 = __toESM(require_dist_cjs2()); + init_utils(); + init_AwsSdkSigV4Signer(); + AwsSdkSigV4ASigner = class extends AwsSdkSigV4Signer { + async sign(httpRequest, identity, signingProperties) { + if (!import_protocol_http7.HttpRequest.isInstance(httpRequest)) { + throw new Error("The request is not an instance of `HttpRequest` and cannot be signed"); } - const memberEntries = se_ProvidedContext(entry, context); - Object.entries(memberEntries).forEach(([key, value]) => { - entries[`member.${counter}.${key}`] = value; + const { config, signer, signingRegion, signingRegionSet, signingName } = await validateSigningProperties(signingProperties); + const configResolvedSigningRegionSet = await config.sigv4aSigningRegionSet?.(); + const multiRegionOverride = (configResolvedSigningRegionSet ?? signingRegionSet ?? [signingRegion]).join(","); + const signedRequest = await signer.sign(httpRequest, { + signingDate: getSkewCorrectedDate(config.systemClockOffset), + signingRegion: multiRegionOverride, + signingService: signingName }); - counter++; + return signedRequest; } - return entries; }; - var se_Tag = (input, context) => { - const entries = {}; - if (input.Key != null) { - entries["Key"] = input.Key; - } - if (input.Value != null) { - entries["Value"] = input.Value; - } - return entries; + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4AConfig.js +var import_property_provider, resolveAwsSdkSigV4AConfig, NODE_SIGV4A_CONFIG_OPTIONS; +var init_resolveAwsSdkSigV4AConfig = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4AConfig.js"() { + init_dist_es(); + import_property_provider = __toESM(require_dist_cjs40()); + resolveAwsSdkSigV4AConfig = (config) => { + config.sigv4aSigningRegionSet = normalizeProvider(config.sigv4aSigningRegionSet); + return config; }; - var se_tagKeyListType = (input, context) => { - const entries = {}; - let counter = 1; - for (const entry of input) { - if (entry === null) { - continue; + NODE_SIGV4A_CONFIG_OPTIONS = { + environmentVariableSelector(env) { + if (env.AWS_SIGV4A_SIGNING_REGION_SET) { + return env.AWS_SIGV4A_SIGNING_REGION_SET.split(",").map((_) => _.trim()); } - entries[`member.${counter}`] = entry; - counter++; - } - return entries; - }; - var se_tagListType = (input, context) => { - const entries = {}; - let counter = 1; - for (const entry of input) { - if (entry === null) { - continue; + throw new import_property_provider.ProviderError("AWS_SIGV4A_SIGNING_REGION_SET not set in env.", { + tryNextLink: true + }); + }, + configFileSelector(profile) { + if (profile.sigv4a_signing_region_set) { + return (profile.sigv4a_signing_region_set ?? "").split(",").map((_) => _.trim()); } - const memberEntries = se_Tag(entry, context); - Object.entries(memberEntries).forEach(([key, value]) => { - entries[`member.${counter}.${key}`] = value; + throw new import_property_provider.ProviderError("sigv4a_signing_region_set not set in profile.", { + tryNextLink: true }); - counter++; - } - return entries; - }; - var de_AssumedRoleUser = (output, context) => { - const contents = {}; - if (output["AssumedRoleId"] !== void 0) { - contents.AssumedRoleId = (0, smithy_client_1.expectString)(output["AssumedRoleId"]); - } - if (output["Arn"] !== void 0) { - contents.Arn = (0, smithy_client_1.expectString)(output["Arn"]); - } - return contents; - }; - var de_AssumeRoleResponse = (output, context) => { - const contents = {}; - if (output["Credentials"] !== void 0) { - contents.Credentials = de_Credentials(output["Credentials"], context); - } - if (output["AssumedRoleUser"] !== void 0) { - contents.AssumedRoleUser = de_AssumedRoleUser(output["AssumedRoleUser"], context); - } - if (output["PackedPolicySize"] !== void 0) { - contents.PackedPolicySize = (0, smithy_client_1.strictParseInt32)(output["PackedPolicySize"]); - } - if (output["SourceIdentity"] !== void 0) { - contents.SourceIdentity = (0, smithy_client_1.expectString)(output["SourceIdentity"]); - } - return contents; - }; - var de_AssumeRoleWithSAMLResponse = (output, context) => { - const contents = {}; - if (output["Credentials"] !== void 0) { - contents.Credentials = de_Credentials(output["Credentials"], context); - } - if (output["AssumedRoleUser"] !== void 0) { - contents.AssumedRoleUser = de_AssumedRoleUser(output["AssumedRoleUser"], context); - } - if (output["PackedPolicySize"] !== void 0) { - contents.PackedPolicySize = (0, smithy_client_1.strictParseInt32)(output["PackedPolicySize"]); - } - if (output["Subject"] !== void 0) { - contents.Subject = (0, smithy_client_1.expectString)(output["Subject"]); - } - if (output["SubjectType"] !== void 0) { - contents.SubjectType = (0, smithy_client_1.expectString)(output["SubjectType"]); - } - if (output["Issuer"] !== void 0) { - contents.Issuer = (0, smithy_client_1.expectString)(output["Issuer"]); - } - if (output["Audience"] !== void 0) { - contents.Audience = (0, smithy_client_1.expectString)(output["Audience"]); - } - if (output["NameQualifier"] !== void 0) { - contents.NameQualifier = (0, smithy_client_1.expectString)(output["NameQualifier"]); - } - if (output["SourceIdentity"] !== void 0) { - contents.SourceIdentity = (0, smithy_client_1.expectString)(output["SourceIdentity"]); - } - return contents; - }; - var de_AssumeRoleWithWebIdentityResponse = (output, context) => { - const contents = {}; - if (output["Credentials"] !== void 0) { - contents.Credentials = de_Credentials(output["Credentials"], context); - } - if (output["SubjectFromWebIdentityToken"] !== void 0) { - contents.SubjectFromWebIdentityToken = (0, smithy_client_1.expectString)(output["SubjectFromWebIdentityToken"]); - } - if (output["AssumedRoleUser"] !== void 0) { - contents.AssumedRoleUser = de_AssumedRoleUser(output["AssumedRoleUser"], context); - } - if (output["PackedPolicySize"] !== void 0) { - contents.PackedPolicySize = (0, smithy_client_1.strictParseInt32)(output["PackedPolicySize"]); - } - if (output["Provider"] !== void 0) { - contents.Provider = (0, smithy_client_1.expectString)(output["Provider"]); - } - if (output["Audience"] !== void 0) { - contents.Audience = (0, smithy_client_1.expectString)(output["Audience"]); - } - if (output["SourceIdentity"] !== void 0) { - contents.SourceIdentity = (0, smithy_client_1.expectString)(output["SourceIdentity"]); - } - return contents; - }; - var de_Credentials = (output, context) => { - const contents = {}; - if (output["AccessKeyId"] !== void 0) { - contents.AccessKeyId = (0, smithy_client_1.expectString)(output["AccessKeyId"]); - } - if (output["SecretAccessKey"] !== void 0) { - contents.SecretAccessKey = (0, smithy_client_1.expectString)(output["SecretAccessKey"]); - } - if (output["SessionToken"] !== void 0) { - contents.SessionToken = (0, smithy_client_1.expectString)(output["SessionToken"]); - } - if (output["Expiration"] !== void 0) { - contents.Expiration = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTimeWithOffset)(output["Expiration"])); - } - return contents; - }; - var de_DecodeAuthorizationMessageResponse = (output, context) => { - const contents = {}; - if (output["DecodedMessage"] !== void 0) { - contents.DecodedMessage = (0, smithy_client_1.expectString)(output["DecodedMessage"]); - } - return contents; - }; - var de_ExpiredTokenException = (output, context) => { - const contents = {}; - if (output["message"] !== void 0) { - contents.message = (0, smithy_client_1.expectString)(output["message"]); - } - return contents; + }, + default: void 0 }; - var de_FederatedUser = (output, context) => { - const contents = {}; - if (output["FederatedUserId"] !== void 0) { - contents.FederatedUserId = (0, smithy_client_1.expectString)(output["FederatedUserId"]); - } - if (output["Arn"] !== void 0) { - contents.Arn = (0, smithy_client_1.expectString)(output["Arn"]); - } - return contents; + } +}); + +// ../../../node_modules/@smithy/signature-v4/dist-cjs/index.js +var require_dist_cjs47 = __commonJS({ + "../../../node_modules/@smithy/signature-v4/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var de_GetAccessKeyInfoResponse = (output, context) => { - const contents = {}; - if (output["Account"] !== void 0) { - contents.Account = (0, smithy_client_1.expectString)(output["Account"]); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - return contents; + return to; }; - var de_GetCallerIdentityResponse = (output, context) => { - const contents = {}; - if (output["UserId"] !== void 0) { - contents.UserId = (0, smithy_client_1.expectString)(output["UserId"]); - } - if (output["Account"] !== void 0) { - contents.Account = (0, smithy_client_1.expectString)(output["Account"]); - } - if (output["Arn"] !== void 0) { - contents.Arn = (0, smithy_client_1.expectString)(output["Arn"]); - } - return contents; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + SignatureV4: () => SignatureV42, + clearCredentialCache: () => clearCredentialCache, + createScope: () => createScope, + getCanonicalHeaders: () => getCanonicalHeaders, + getCanonicalQuery: () => getCanonicalQuery, + getPayloadHash: () => getPayloadHash, + getSigningKey: () => getSigningKey, + moveHeadersToQuery: () => moveHeadersToQuery, + prepareRequest: () => prepareRequest + }); + module2.exports = __toCommonJS2(src_exports); + var import_util_middleware3 = require_dist_cjs10(); + var import_util_utf84 = require_dist_cjs28(); + var ALGORITHM_QUERY_PARAM = "X-Amz-Algorithm"; + var CREDENTIAL_QUERY_PARAM = "X-Amz-Credential"; + var AMZ_DATE_QUERY_PARAM = "X-Amz-Date"; + var SIGNED_HEADERS_QUERY_PARAM = "X-Amz-SignedHeaders"; + var EXPIRES_QUERY_PARAM = "X-Amz-Expires"; + var SIGNATURE_QUERY_PARAM = "X-Amz-Signature"; + var TOKEN_QUERY_PARAM = "X-Amz-Security-Token"; + var AUTH_HEADER = "authorization"; + var AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase(); + var DATE_HEADER = "date"; + var GENERATED_HEADERS = [AUTH_HEADER, AMZ_DATE_HEADER, DATE_HEADER]; + var SIGNATURE_HEADER = SIGNATURE_QUERY_PARAM.toLowerCase(); + var SHA256_HEADER = "x-amz-content-sha256"; + var TOKEN_HEADER = TOKEN_QUERY_PARAM.toLowerCase(); + var ALWAYS_UNSIGNABLE_HEADERS = { + authorization: true, + "cache-control": true, + connection: true, + expect: true, + from: true, + "keep-alive": true, + "max-forwards": true, + pragma: true, + referer: true, + te: true, + trailer: true, + "transfer-encoding": true, + upgrade: true, + "user-agent": true, + "x-amzn-trace-id": true }; - var de_GetFederationTokenResponse = (output, context) => { - const contents = {}; - if (output["Credentials"] !== void 0) { - contents.Credentials = de_Credentials(output["Credentials"], context); - } - if (output["FederatedUser"] !== void 0) { - contents.FederatedUser = de_FederatedUser(output["FederatedUser"], context); - } - if (output["PackedPolicySize"] !== void 0) { - contents.PackedPolicySize = (0, smithy_client_1.strictParseInt32)(output["PackedPolicySize"]); + var PROXY_HEADER_PATTERN = /^proxy-/; + var SEC_HEADER_PATTERN = /^sec-/; + var ALGORITHM_IDENTIFIER = "AWS4-HMAC-SHA256"; + var EVENT_ALGORITHM_IDENTIFIER = "AWS4-HMAC-SHA256-PAYLOAD"; + var UNSIGNED_PAYLOAD = "UNSIGNED-PAYLOAD"; + var MAX_CACHE_SIZE = 50; + var KEY_TYPE_IDENTIFIER = "aws4_request"; + var MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7; + var import_util_hex_encoding = require_dist_cjs35(); + var import_util_utf8 = require_dist_cjs28(); + var signingKeyCache = {}; + var cacheQueue = []; + var createScope = /* @__PURE__ */ __name((shortDate, region, service) => `${shortDate}/${region}/${service}/${KEY_TYPE_IDENTIFIER}`, "createScope"); + var getSigningKey = /* @__PURE__ */ __name(async (sha256Constructor, credentials, shortDate, region, service) => { + const credsHash = await hmac(sha256Constructor, credentials.secretAccessKey, credentials.accessKeyId); + const cacheKey = `${shortDate}:${region}:${service}:${(0, import_util_hex_encoding.toHex)(credsHash)}:${credentials.sessionToken}`; + if (cacheKey in signingKeyCache) { + return signingKeyCache[cacheKey]; } - return contents; - }; - var de_GetSessionTokenResponse = (output, context) => { - const contents = {}; - if (output["Credentials"] !== void 0) { - contents.Credentials = de_Credentials(output["Credentials"], context); + cacheQueue.push(cacheKey); + while (cacheQueue.length > MAX_CACHE_SIZE) { + delete signingKeyCache[cacheQueue.shift()]; } - return contents; - }; - var de_IDPCommunicationErrorException = (output, context) => { - const contents = {}; - if (output["message"] !== void 0) { - contents.message = (0, smithy_client_1.expectString)(output["message"]); + let key = `AWS4${credentials.secretAccessKey}`; + for (const signable of [shortDate, region, service, KEY_TYPE_IDENTIFIER]) { + key = await hmac(sha256Constructor, key, signable); } - return contents; - }; - var de_IDPRejectedClaimException = (output, context) => { - const contents = {}; - if (output["message"] !== void 0) { - contents.message = (0, smithy_client_1.expectString)(output["message"]); + return signingKeyCache[cacheKey] = key; + }, "getSigningKey"); + var clearCredentialCache = /* @__PURE__ */ __name(() => { + cacheQueue.length = 0; + Object.keys(signingKeyCache).forEach((cacheKey) => { + delete signingKeyCache[cacheKey]; + }); + }, "clearCredentialCache"); + var hmac = /* @__PURE__ */ __name((ctor, secret, data) => { + const hash = new ctor(secret); + hash.update((0, import_util_utf8.toUint8Array)(data)); + return hash.digest(); + }, "hmac"); + var getCanonicalHeaders = /* @__PURE__ */ __name(({ headers }, unsignableHeaders, signableHeaders) => { + const canonical = {}; + for (const headerName of Object.keys(headers).sort()) { + if (headers[headerName] == void 0) { + continue; + } + const canonicalHeaderName = headerName.toLowerCase(); + if (canonicalHeaderName in ALWAYS_UNSIGNABLE_HEADERS || (unsignableHeaders == null ? void 0 : unsignableHeaders.has(canonicalHeaderName)) || PROXY_HEADER_PATTERN.test(canonicalHeaderName) || SEC_HEADER_PATTERN.test(canonicalHeaderName)) { + if (!signableHeaders || signableHeaders && !signableHeaders.has(canonicalHeaderName)) { + continue; + } + } + canonical[canonicalHeaderName] = headers[headerName].trim().replace(/\s+/g, " "); } - return contents; - }; - var de_InvalidAuthorizationMessageException = (output, context) => { - const contents = {}; - if (output["message"] !== void 0) { - contents.message = (0, smithy_client_1.expectString)(output["message"]); + return canonical; + }, "getCanonicalHeaders"); + var import_util_uri_escape = require_dist_cjs31(); + var getCanonicalQuery = /* @__PURE__ */ __name(({ query = {} }) => { + const keys = []; + const serialized = {}; + for (const key of Object.keys(query).sort()) { + if (key.toLowerCase() === SIGNATURE_HEADER) { + continue; + } + keys.push(key); + const value = query[key]; + if (typeof value === "string") { + serialized[key] = `${(0, import_util_uri_escape.escapeUri)(key)}=${(0, import_util_uri_escape.escapeUri)(value)}`; + } else if (Array.isArray(value)) { + serialized[key] = value.slice(0).reduce( + (encoded, value2) => encoded.concat([`${(0, import_util_uri_escape.escapeUri)(key)}=${(0, import_util_uri_escape.escapeUri)(value2)}`]), + [] + ).sort().join("&"); + } } - return contents; - }; - var de_InvalidIdentityTokenException = (output, context) => { - const contents = {}; - if (output["message"] !== void 0) { - contents.message = (0, smithy_client_1.expectString)(output["message"]); + return keys.map((key) => serialized[key]).filter((serialized2) => serialized2).join("&"); + }, "getCanonicalQuery"); + var import_is_array_buffer = require_dist_cjs26(); + var import_util_utf82 = require_dist_cjs28(); + var getPayloadHash = /* @__PURE__ */ __name(async ({ headers, body }, hashConstructor) => { + for (const headerName of Object.keys(headers)) { + if (headerName.toLowerCase() === SHA256_HEADER) { + return headers[headerName]; + } } - return contents; - }; - var de_MalformedPolicyDocumentException = (output, context) => { - const contents = {}; - if (output["message"] !== void 0) { - contents.message = (0, smithy_client_1.expectString)(output["message"]); + if (body == void 0) { + return "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; + } else if (typeof body === "string" || ArrayBuffer.isView(body) || (0, import_is_array_buffer.isArrayBuffer)(body)) { + const hashCtor = new hashConstructor(); + hashCtor.update((0, import_util_utf82.toUint8Array)(body)); + return (0, import_util_hex_encoding.toHex)(await hashCtor.digest()); } - return contents; - }; - var de_PackedPolicyTooLargeException = (output, context) => { - const contents = {}; - if (output["message"] !== void 0) { - contents.message = (0, smithy_client_1.expectString)(output["message"]); + return UNSIGNED_PAYLOAD; + }, "getPayloadHash"); + var import_util_utf83 = require_dist_cjs28(); + var _HeaderFormatter = class _HeaderFormatter { + format(headers) { + const chunks = []; + for (const headerName of Object.keys(headers)) { + const bytes = (0, import_util_utf83.fromUtf8)(headerName); + chunks.push(Uint8Array.from([bytes.byteLength]), bytes, this.formatHeaderValue(headers[headerName])); + } + const out = new Uint8Array(chunks.reduce((carry, bytes) => carry + bytes.byteLength, 0)); + let position = 0; + for (const chunk of chunks) { + out.set(chunk, position); + position += chunk.byteLength; + } + return out; } - return contents; - }; - var de_RegionDisabledException = (output, context) => { - const contents = {}; - if (output["message"] !== void 0) { - contents.message = (0, smithy_client_1.expectString)(output["message"]); + formatHeaderValue(header) { + switch (header.type) { + case "boolean": + return Uint8Array.from([ + header.value ? 0 : 1 + /* boolFalse */ + ]); + case "byte": + return Uint8Array.from([2, header.value]); + case "short": + const shortView = new DataView(new ArrayBuffer(3)); + shortView.setUint8( + 0, + 3 + /* short */ + ); + shortView.setInt16(1, header.value, false); + return new Uint8Array(shortView.buffer); + case "integer": + const intView = new DataView(new ArrayBuffer(5)); + intView.setUint8( + 0, + 4 + /* integer */ + ); + intView.setInt32(1, header.value, false); + return new Uint8Array(intView.buffer); + case "long": + const longBytes = new Uint8Array(9); + longBytes[0] = 5; + longBytes.set(header.value.bytes, 1); + return longBytes; + case "binary": + const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength)); + binView.setUint8( + 0, + 6 + /* byteArray */ + ); + binView.setUint16(1, header.value.byteLength, false); + const binBytes = new Uint8Array(binView.buffer); + binBytes.set(header.value, 3); + return binBytes; + case "string": + const utf8Bytes = (0, import_util_utf83.fromUtf8)(header.value); + const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength)); + strView.setUint8( + 0, + 7 + /* string */ + ); + strView.setUint16(1, utf8Bytes.byteLength, false); + const strBytes = new Uint8Array(strView.buffer); + strBytes.set(utf8Bytes, 3); + return strBytes; + case "timestamp": + const tsBytes = new Uint8Array(9); + tsBytes[0] = 8; + tsBytes.set(Int64.fromNumber(header.value.valueOf()).bytes, 1); + return tsBytes; + case "uuid": + if (!UUID_PATTERN.test(header.value)) { + throw new Error(`Invalid UUID received: ${header.value}`); + } + const uuidBytes = new Uint8Array(17); + uuidBytes[0] = 9; + uuidBytes.set((0, import_util_hex_encoding.fromHex)(header.value.replace(/\-/g, "")), 1); + return uuidBytes; + } } - return contents; }; - var deserializeMetadata = (output) => ({ - httpStatusCode: output.statusCode, - requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"], - extendedRequestId: output.headers["x-amz-id-2"], - cfId: output.headers["x-amz-cf-id"] - }); - var collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)); - var throwDefaultError = (0, smithy_client_1.withBaseException)(STSServiceException_1.STSServiceException); - var buildHttpRpcRequest = async (context, headers, path, resolvedHostname, body) => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const contents = { - protocol, - hostname, - port, - method: "POST", - path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path, - headers - }; - if (resolvedHostname !== void 0) { - contents.hostname = resolvedHostname; + __name(_HeaderFormatter, "HeaderFormatter"); + var HeaderFormatter = _HeaderFormatter; + var UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/; + var _Int64 = class _Int642 { + constructor(bytes) { + this.bytes = bytes; + if (bytes.byteLength !== 8) { + throw new Error("Int64 buffers must be exactly 8 bytes"); + } } - if (body !== void 0) { - contents.body = body; + static fromNumber(number) { + if (number > 9223372036854776e3 || number < -9223372036854776e3) { + throw new Error(`${number} is too large (or, if negative, too small) to represent as an Int64`); + } + const bytes = new Uint8Array(8); + for (let i = 7, remaining = Math.abs(Math.round(number)); i > -1 && remaining > 0; i--, remaining /= 256) { + bytes[i] = remaining; + } + if (number < 0) { + negate(bytes); + } + return new _Int642(bytes); } - return new protocol_http_1.HttpRequest(contents); - }; - var SHARED_HEADERS = { - "content-type": "application/x-www-form-urlencoded" - }; - var parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => { - if (encoded.length) { - const parser = new fast_xml_parser_1.XMLParser({ - attributeNamePrefix: "", - htmlEntities: true, - ignoreAttributes: false, - ignoreDeclaration: true, - parseTagValue: false, - trimValues: false, - tagValueProcessor: (_, val2) => val2.trim() === "" && val2.includes("\n") ? "" : void 0 - }); - parser.addEntity("#xD", "\r"); - parser.addEntity("#10", "\n"); - const parsedObj = parser.parse(encoded); - const textNodeName = "#text"; - const key = Object.keys(parsedObj)[0]; - const parsedObjToReturn = parsedObj[key]; - if (parsedObjToReturn[textNodeName]) { - parsedObjToReturn[key] = parsedObjToReturn[textNodeName]; - delete parsedObjToReturn[textNodeName]; + /** + * Called implicitly by infix arithmetic operators. + */ + valueOf() { + const bytes = this.bytes.slice(0); + const negative = bytes[0] & 128; + if (negative) { + negate(bytes); } - return (0, smithy_client_1.getValueFromTextNode)(parsedObjToReturn); + return parseInt((0, import_util_hex_encoding.toHex)(bytes), 16) * (negative ? -1 : 1); } - return {}; - }); - var parseErrorBody = async (errorBody, context) => { - const value = await parseBody(errorBody, context); - if (value.Error) { - value.Error.message = value.Error.message ?? value.Error.Message; + toString() { + return String(this.valueOf()); } - return value; }; - var buildFormUrlencodedString = (formEntries) => Object.entries(formEntries).map(([key, value]) => (0, smithy_client_1.extendedEncodeURIComponent)(key) + "=" + (0, smithy_client_1.extendedEncodeURIComponent)(value)).join("&"); - var loadQueryErrorCode = (output, data) => { - if (data.Error?.Code !== void 0) { - return data.Error.Code; + __name(_Int64, "Int64"); + var Int64 = _Int64; + function negate(bytes) { + for (let i = 0; i < 8; i++) { + bytes[i] ^= 255; } - if (output.statusCode == 404) { - return "NotFound"; + for (let i = 7; i > -1; i--) { + bytes[i]++; + if (bytes[i] !== 0) + break; } - }; - } -}); - -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/AssumeRoleCommand.js -var require_AssumeRoleCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/AssumeRoleCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.AssumeRoleCommand = exports2.$Command = void 0; - var middleware_signing_1 = require_dist_cjs14(); - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_0(); - var Aws_query_1 = require_Aws_query(); - var AssumeRoleCommand = class _AssumeRoleCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseGlobalEndpoint: { type: "builtInParams", name: "useGlobalEndpoint" }, - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + } + __name(negate, "negate"); + var hasHeader = /* @__PURE__ */ __name((soughtHeader, headers) => { + soughtHeader = soughtHeader.toLowerCase(); + for (const headerName of Object.keys(headers)) { + if (soughtHeader === headerName.toLowerCase()) { + return true; + } } - constructor(input) { - super(); - this.input = input; + return false; + }, "hasHeader"); + var import_protocol_http8 = require_dist_cjs2(); + var moveHeadersToQuery = /* @__PURE__ */ __name((request2, options = {}) => { + var _a; + const { headers, query = {} } = import_protocol_http8.HttpRequest.clone(request2); + for (const name of Object.keys(headers)) { + const lname = name.toLowerCase(); + if (lname.slice(0, 6) === "x-amz-" && !((_a = options.unhoistableHeaders) == null ? void 0 : _a.has(lname))) { + query[name] = headers[name]; + delete headers[name]; + } } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _AssumeRoleCommand.getEndpointParameterInstructions())); - this.middlewareStack.use((0, middleware_signing_1.getAwsAuthPlugin)(configuration)); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "STSClient"; - const commandName = "AssumeRoleCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: models_0_1.AssumeRoleResponseFilterSensitiveLog, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSSecurityTokenServiceV20110615", - operation: "AssumeRole" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + return { + ...request2, + headers, + query + }; + }, "moveHeadersToQuery"); + var prepareRequest = /* @__PURE__ */ __name((request2) => { + request2 = import_protocol_http8.HttpRequest.clone(request2); + for (const headerName of Object.keys(request2.headers)) { + if (GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) { + delete request2.headers[headerName]; + } } - serialize(input, context) { - return (0, Aws_query_1.se_AssumeRoleCommand)(input, context); + return request2; + }, "prepareRequest"); + var iso8601 = /* @__PURE__ */ __name((time) => toDate(time).toISOString().replace(/\.\d{3}Z$/, "Z"), "iso8601"); + var toDate = /* @__PURE__ */ __name((time) => { + if (typeof time === "number") { + return new Date(time * 1e3); } - deserialize(output, context) { - return (0, Aws_query_1.de_AssumeRoleCommand)(output, context); + if (typeof time === "string") { + if (Number(time)) { + return new Date(Number(time) * 1e3); + } + return new Date(time); } - }; - exports2.AssumeRoleCommand = AssumeRoleCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/AssumeRoleWithWebIdentityCommand.js -var require_AssumeRoleWithWebIdentityCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/AssumeRoleWithWebIdentityCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.AssumeRoleWithWebIdentityCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_0(); - var Aws_query_1 = require_Aws_query(); - var AssumeRoleWithWebIdentityCommand = class _AssumeRoleWithWebIdentityCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseGlobalEndpoint: { type: "builtInParams", name: "useGlobalEndpoint" }, - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + return time; + }, "toDate"); + var _SignatureV4 = class _SignatureV4 { + constructor({ + applyChecksum, + credentials, + region, + service, + sha256, + uriEscapePath = true + }) { + this.headerFormatter = new HeaderFormatter(); + this.service = service; + this.sha256 = sha256; + this.uriEscapePath = uriEscapePath; + this.applyChecksum = typeof applyChecksum === "boolean" ? applyChecksum : true; + this.regionProvider = (0, import_util_middleware3.normalizeProvider)(region); + this.credentialProvider = (0, import_util_middleware3.normalizeProvider)(credentials); } - constructor(input) { - super(); - this.input = input; + async presign(originalRequest, options = {}) { + const { + signingDate = /* @__PURE__ */ new Date(), + expiresIn = 3600, + unsignableHeaders, + unhoistableHeaders, + signableHeaders, + signingRegion, + signingService + } = options; + const credentials = await this.credentialProvider(); + this.validateResolvedCredentials(credentials); + const region = signingRegion ?? await this.regionProvider(); + const { longDate, shortDate } = formatDate(signingDate); + if (expiresIn > MAX_PRESIGNED_TTL) { + return Promise.reject( + "Signature version 4 presigned URLs must have an expiration date less than one week in the future" + ); + } + const scope = createScope(shortDate, region, signingService ?? this.service); + const request2 = moveHeadersToQuery(prepareRequest(originalRequest), { unhoistableHeaders }); + if (credentials.sessionToken) { + request2.query[TOKEN_QUERY_PARAM] = credentials.sessionToken; + } + request2.query[ALGORITHM_QUERY_PARAM] = ALGORITHM_IDENTIFIER; + request2.query[CREDENTIAL_QUERY_PARAM] = `${credentials.accessKeyId}/${scope}`; + request2.query[AMZ_DATE_QUERY_PARAM] = longDate; + request2.query[EXPIRES_QUERY_PARAM] = expiresIn.toString(10); + const canonicalHeaders = getCanonicalHeaders(request2, unsignableHeaders, signableHeaders); + request2.query[SIGNED_HEADERS_QUERY_PARAM] = getCanonicalHeaderList(canonicalHeaders); + request2.query[SIGNATURE_QUERY_PARAM] = await this.getSignature( + longDate, + scope, + this.getSigningKey(credentials, region, shortDate, signingService), + this.createCanonicalRequest(request2, canonicalHeaders, await getPayloadHash(originalRequest, this.sha256)) + ); + return request2; } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _AssumeRoleWithWebIdentityCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "STSClient"; - const commandName = "AssumeRoleWithWebIdentityCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.AssumeRoleWithWebIdentityRequestFilterSensitiveLog, - outputFilterSensitiveLog: models_0_1.AssumeRoleWithWebIdentityResponseFilterSensitiveLog, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSSecurityTokenServiceV20110615", - operation: "AssumeRoleWithWebIdentity" + async sign(toSign, options) { + if (typeof toSign === "string") { + return this.signString(toSign, options); + } else if (toSign.headers && toSign.payload) { + return this.signEvent(toSign, options); + } else if (toSign.message) { + return this.signMessage(toSign, options); + } else { + return this.signRequest(toSign, options); + } + } + async signEvent({ headers, payload }, { signingDate = /* @__PURE__ */ new Date(), priorSignature, signingRegion, signingService }) { + const region = signingRegion ?? await this.regionProvider(); + const { shortDate, longDate } = formatDate(signingDate); + const scope = createScope(shortDate, region, signingService ?? this.service); + const hashedPayload = await getPayloadHash({ headers: {}, body: payload }, this.sha256); + const hash = new this.sha256(); + hash.update(headers); + const hashedHeaders = (0, import_util_hex_encoding.toHex)(await hash.digest()); + const stringToSign = [ + EVENT_ALGORITHM_IDENTIFIER, + longDate, + scope, + priorSignature, + hashedHeaders, + hashedPayload + ].join("\n"); + return this.signString(stringToSign, { signingDate, signingRegion: region, signingService }); + } + async signMessage(signableMessage, { signingDate = /* @__PURE__ */ new Date(), signingRegion, signingService }) { + const promise = this.signEvent( + { + headers: this.headerFormatter.format(signableMessage.message.headers), + payload: signableMessage.message.body + }, + { + signingDate, + signingRegion, + signingService, + priorSignature: signableMessage.priorSignature } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_query_1.se_AssumeRoleWithWebIdentityCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_query_1.de_AssumeRoleWithWebIdentityCommand)(output, context); + ); + return promise.then((signature) => { + return { message: signableMessage.message, signature }; + }); } - }; - exports2.AssumeRoleWithWebIdentityCommand = AssumeRoleWithWebIdentityCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/defaultStsRoleAssumers.js -var require_defaultStsRoleAssumers = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/defaultStsRoleAssumers.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.decorateDefaultCredentialProvider = exports2.getDefaultRoleAssumerWithWebIdentity = exports2.getDefaultRoleAssumer = void 0; - var AssumeRoleCommand_1 = require_AssumeRoleCommand(); - var AssumeRoleWithWebIdentityCommand_1 = require_AssumeRoleWithWebIdentityCommand(); - var ASSUME_ROLE_DEFAULT_REGION = "us-east-1"; - var decorateDefaultRegion = (region) => { - if (typeof region !== "function") { - return region === void 0 ? ASSUME_ROLE_DEFAULT_REGION : region; + async signString(stringToSign, { signingDate = /* @__PURE__ */ new Date(), signingRegion, signingService } = {}) { + const credentials = await this.credentialProvider(); + this.validateResolvedCredentials(credentials); + const region = signingRegion ?? await this.regionProvider(); + const { shortDate } = formatDate(signingDate); + const hash = new this.sha256(await this.getSigningKey(credentials, region, shortDate, signingService)); + hash.update((0, import_util_utf84.toUint8Array)(stringToSign)); + return (0, import_util_hex_encoding.toHex)(await hash.digest()); } - return async () => { - try { - return await region(); - } catch (e) { - return ASSUME_ROLE_DEFAULT_REGION; - } - }; - }; - var getDefaultRoleAssumer = (stsOptions, stsClientCtor) => { - let stsClient; - let closureSourceCreds; - return async (sourceCreds, params) => { - closureSourceCreds = sourceCreds; - if (!stsClient) { - const { logger, region, requestHandler } = stsOptions; - stsClient = new stsClientCtor({ - logger, - credentialDefaultProvider: () => async () => closureSourceCreds, - region: decorateDefaultRegion(region || stsOptions.region), - ...requestHandler ? { requestHandler } : {} - }); - } - const { Credentials } = await stsClient.send(new AssumeRoleCommand_1.AssumeRoleCommand(params)); - if (!Credentials || !Credentials.AccessKeyId || !Credentials.SecretAccessKey) { - throw new Error(`Invalid response from STS.assumeRole call with role ${params.RoleArn}`); - } - return { - accessKeyId: Credentials.AccessKeyId, - secretAccessKey: Credentials.SecretAccessKey, - sessionToken: Credentials.SessionToken, - expiration: Credentials.Expiration - }; - }; - }; - exports2.getDefaultRoleAssumer = getDefaultRoleAssumer; - var getDefaultRoleAssumerWithWebIdentity = (stsOptions, stsClientCtor) => { - let stsClient; - return async (params) => { - if (!stsClient) { - const { logger, region, requestHandler } = stsOptions; - stsClient = new stsClientCtor({ - logger, - region: decorateDefaultRegion(region || stsOptions.region), - ...requestHandler ? { requestHandler } : {} - }); + async signRequest(requestToSign, { + signingDate = /* @__PURE__ */ new Date(), + signableHeaders, + unsignableHeaders, + signingRegion, + signingService + } = {}) { + const credentials = await this.credentialProvider(); + this.validateResolvedCredentials(credentials); + const region = signingRegion ?? await this.regionProvider(); + const request2 = prepareRequest(requestToSign); + const { longDate, shortDate } = formatDate(signingDate); + const scope = createScope(shortDate, region, signingService ?? this.service); + request2.headers[AMZ_DATE_HEADER] = longDate; + if (credentials.sessionToken) { + request2.headers[TOKEN_HEADER] = credentials.sessionToken; } - const { Credentials } = await stsClient.send(new AssumeRoleWithWebIdentityCommand_1.AssumeRoleWithWebIdentityCommand(params)); - if (!Credentials || !Credentials.AccessKeyId || !Credentials.SecretAccessKey) { - throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${params.RoleArn}`); + const payloadHash = await getPayloadHash(request2, this.sha256); + if (!hasHeader(SHA256_HEADER, request2.headers) && this.applyChecksum) { + request2.headers[SHA256_HEADER] = payloadHash; } - return { - accessKeyId: Credentials.AccessKeyId, - secretAccessKey: Credentials.SecretAccessKey, - sessionToken: Credentials.SessionToken, - expiration: Credentials.Expiration - }; - }; - }; - exports2.getDefaultRoleAssumerWithWebIdentity = getDefaultRoleAssumerWithWebIdentity; - var decorateDefaultCredentialProvider = (provider) => (input) => provider({ - roleAssumer: (0, exports2.getDefaultRoleAssumer)(input, input.stsClientCtor), - roleAssumerWithWebIdentity: (0, exports2.getDefaultRoleAssumerWithWebIdentity)(input, input.stsClientCtor), - ...input - }); - exports2.decorateDefaultCredentialProvider = decorateDefaultCredentialProvider; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-env/dist-cjs/fromEnv.js -var require_fromEnv = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-env/dist-cjs/fromEnv.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.fromEnv = exports2.ENV_EXPIRATION = exports2.ENV_SESSION = exports2.ENV_SECRET = exports2.ENV_KEY = void 0; - var property_provider_1 = require_dist_cjs6(); - exports2.ENV_KEY = "AWS_ACCESS_KEY_ID"; - exports2.ENV_SECRET = "AWS_SECRET_ACCESS_KEY"; - exports2.ENV_SESSION = "AWS_SESSION_TOKEN"; - exports2.ENV_EXPIRATION = "AWS_CREDENTIAL_EXPIRATION"; - var fromEnv = () => async () => { - const accessKeyId = process.env[exports2.ENV_KEY]; - const secretAccessKey = process.env[exports2.ENV_SECRET]; - const sessionToken = process.env[exports2.ENV_SESSION]; - const expiry = process.env[exports2.ENV_EXPIRATION]; - if (accessKeyId && secretAccessKey) { - return { - accessKeyId, - secretAccessKey, - ...sessionToken && { sessionToken }, - ...expiry && { expiration: new Date(expiry) } - }; + const canonicalHeaders = getCanonicalHeaders(request2, unsignableHeaders, signableHeaders); + const signature = await this.getSignature( + longDate, + scope, + this.getSigningKey(credentials, region, shortDate, signingService), + this.createCanonicalRequest(request2, canonicalHeaders, payloadHash) + ); + request2.headers[AUTH_HEADER] = `${ALGORITHM_IDENTIFIER} Credential=${credentials.accessKeyId}/${scope}, SignedHeaders=${getCanonicalHeaderList(canonicalHeaders)}, Signature=${signature}`; + return request2; } - throw new property_provider_1.CredentialsProviderError("Unable to find environment variable credentials."); - }; - exports2.fromEnv = fromEnv; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-env/dist-cjs/index.js -var require_dist_cjs37 = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-env/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_fromEnv(), exports2); - } -}); + createCanonicalRequest(request2, canonicalHeaders, payloadHash) { + const sortedHeaders = Object.keys(canonicalHeaders).sort(); + return `${request2.method} +${this.getCanonicalPath(request2)} +${getCanonicalQuery(request2)} +${sortedHeaders.map((name) => `${name}:${canonicalHeaders[name]}`).join("\n")} -// ../../../node_modules/@smithy/credential-provider-imds/dist-cjs/index.js -var require_dist_cjs38 = __commonJS({ - "../../../node_modules/@smithy/credential-provider-imds/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); +${sortedHeaders.join(";")} +${payloadHash}`; } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - DEFAULT_MAX_RETRIES: () => DEFAULT_MAX_RETRIES, - DEFAULT_TIMEOUT: () => DEFAULT_TIMEOUT, - ENV_CMDS_AUTH_TOKEN: () => ENV_CMDS_AUTH_TOKEN, - ENV_CMDS_FULL_URI: () => ENV_CMDS_FULL_URI, - ENV_CMDS_RELATIVE_URI: () => ENV_CMDS_RELATIVE_URI, - Endpoint: () => Endpoint, - fromContainerMetadata: () => fromContainerMetadata, - fromInstanceMetadata: () => fromInstanceMetadata, - getInstanceMetadataEndpoint: () => getInstanceMetadataEndpoint, - httpRequest: () => httpRequest, - providerConfigFromInit: () => providerConfigFromInit - }); - module2.exports = __toCommonJS2(src_exports); - var import_url = require("url"); - var import_property_provider = require_dist_cjs6(); - var import_buffer = require("buffer"); - var import_http2 = require("http"); - function httpRequest(options) { - return new Promise((resolve, reject) => { - var _a; - const req = (0, import_http2.request)({ - method: "GET", - ...options, - // Node.js http module doesn't accept hostname with square brackets - // Refs: https://github.com/nodejs/node/issues/39738 - hostname: (_a = options.hostname) == null ? void 0 : _a.replace(/^\[(.+)\]$/, "$1") - }); - req.on("error", (err) => { - reject(Object.assign(new import_property_provider.ProviderError("Unable to connect to instance metadata service"), err)); - req.destroy(); - }); - req.on("timeout", () => { - reject(new import_property_provider.ProviderError("TimeoutError from instance metadata service")); - req.destroy(); - }); - req.on("response", (res) => { - const { statusCode = 400 } = res; - if (statusCode < 200 || 300 <= statusCode) { - reject( - Object.assign(new import_property_provider.ProviderError("Error response received from instance metadata service"), { statusCode }) - ); - req.destroy(); + async createStringToSign(longDate, credentialScope, canonicalRequest) { + const hash = new this.sha256(); + hash.update((0, import_util_utf84.toUint8Array)(canonicalRequest)); + const hashedRequest = await hash.digest(); + return `${ALGORITHM_IDENTIFIER} +${longDate} +${credentialScope} +${(0, import_util_hex_encoding.toHex)(hashedRequest)}`; + } + getCanonicalPath({ path }) { + if (this.uriEscapePath) { + const normalizedPathSegments = []; + for (const pathSegment of path.split("/")) { + if ((pathSegment == null ? void 0 : pathSegment.length) === 0) + continue; + if (pathSegment === ".") + continue; + if (pathSegment === "..") { + normalizedPathSegments.pop(); + } else { + normalizedPathSegments.push(pathSegment); + } } - const chunks = []; - res.on("data", (chunk) => { - chunks.push(chunk); - }); - res.on("end", () => { - resolve(import_buffer.Buffer.concat(chunks)); - req.destroy(); - }); - }); - req.end(); - }); - } - __name(httpRequest, "httpRequest"); - var isImdsCredentials = /* @__PURE__ */ __name((arg) => Boolean(arg) && typeof arg === "object" && typeof arg.AccessKeyId === "string" && typeof arg.SecretAccessKey === "string" && typeof arg.Token === "string" && typeof arg.Expiration === "string", "isImdsCredentials"); - var fromImdsCredentials = /* @__PURE__ */ __name((creds) => ({ - accessKeyId: creds.AccessKeyId, - secretAccessKey: creds.SecretAccessKey, - sessionToken: creds.Token, - expiration: new Date(creds.Expiration) - }), "fromImdsCredentials"); - var DEFAULT_TIMEOUT = 1e3; - var DEFAULT_MAX_RETRIES = 0; - var providerConfigFromInit = /* @__PURE__ */ __name(({ - maxRetries = DEFAULT_MAX_RETRIES, - timeout = DEFAULT_TIMEOUT - }) => ({ maxRetries, timeout }), "providerConfigFromInit"); - var retry = /* @__PURE__ */ __name((toRetry, maxRetries) => { - let promise = toRetry(); - for (let i = 0; i < maxRetries; i++) { - promise = promise.catch(toRetry); + const normalizedPath = `${(path == null ? void 0 : path.startsWith("/")) ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && (path == null ? void 0 : path.endsWith("/")) ? "/" : ""}`; + const doubleEncoded = (0, import_util_uri_escape.escapeUri)(normalizedPath); + return doubleEncoded.replace(/%2F/g, "/"); + } + return path; } - return promise; - }, "retry"); - var ENV_CMDS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI"; - var ENV_CMDS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"; - var ENV_CMDS_AUTH_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN"; - var fromContainerMetadata = /* @__PURE__ */ __name((init = {}) => { - const { timeout, maxRetries } = providerConfigFromInit(init); - return () => retry(async () => { - const requestOptions = await getCmdsUri(); - const credsResponse = JSON.parse(await requestFromEcsImds(timeout, requestOptions)); - if (!isImdsCredentials(credsResponse)) { - throw new import_property_provider.CredentialsProviderError("Invalid response received from instance metadata service."); + async getSignature(longDate, credentialScope, keyPromise, canonicalRequest) { + const stringToSign = await this.createStringToSign(longDate, credentialScope, canonicalRequest); + const hash = new this.sha256(await keyPromise); + hash.update((0, import_util_utf84.toUint8Array)(stringToSign)); + return (0, import_util_hex_encoding.toHex)(await hash.digest()); + } + getSigningKey(credentials, region, shortDate, service) { + return getSigningKey(this.sha256, credentials, shortDate, region, service || this.service); + } + validateResolvedCredentials(credentials) { + if (typeof credentials !== "object" || // @ts-expect-error: Property 'accessKeyId' does not exist on type 'object'.ts(2339) + typeof credentials.accessKeyId !== "string" || // @ts-expect-error: Property 'secretAccessKey' does not exist on type 'object'.ts(2339) + typeof credentials.secretAccessKey !== "string") { + throw new Error("Resolved credential object is not valid"); } - return fromImdsCredentials(credsResponse); - }, maxRetries); - }, "fromContainerMetadata"); - var requestFromEcsImds = /* @__PURE__ */ __name(async (timeout, options) => { - if (process.env[ENV_CMDS_AUTH_TOKEN]) { - options.headers = { - ...options.headers, - Authorization: process.env[ENV_CMDS_AUTH_TOKEN] - }; } - const buffer = await httpRequest({ - ...options, - timeout - }); - return buffer.toString(); - }, "requestFromEcsImds"); - var CMDS_IP = "169.254.170.2"; - var GREENGRASS_HOSTS = { - localhost: true, - "127.0.0.1": true - }; - var GREENGRASS_PROTOCOLS = { - "http:": true, - "https:": true }; - var getCmdsUri = /* @__PURE__ */ __name(async () => { - if (process.env[ENV_CMDS_RELATIVE_URI]) { - return { - hostname: CMDS_IP, - path: process.env[ENV_CMDS_RELATIVE_URI] - }; + __name(_SignatureV4, "SignatureV4"); + var SignatureV42 = _SignatureV4; + var formatDate = /* @__PURE__ */ __name((now) => { + const longDate = iso8601(now).replace(/[\-:]/g, ""); + return { + longDate, + shortDate: longDate.slice(0, 8) + }; + }, "formatDate"); + var getCanonicalHeaderList = /* @__PURE__ */ __name((headers) => Object.keys(headers).sort().join(";"), "getCanonicalHeaderList"); + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.js +var import_signature_v4, resolveAwsSdkSigV4Config, resolveAWSSDKSigV4Config; +var init_resolveAwsSdkSigV4Config = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.js"() { + init_dist_es(); + import_signature_v4 = __toESM(require_dist_cjs47()); + resolveAwsSdkSigV4Config = (config) => { + let normalizedCreds; + if (config.credentials) { + normalizedCreds = memoizeIdentityProvider(config.credentials, isIdentityExpired, doesIdentityRequireRefresh); } - if (process.env[ENV_CMDS_FULL_URI]) { - const parsed = (0, import_url.parse)(process.env[ENV_CMDS_FULL_URI]); - if (!parsed.hostname || !(parsed.hostname in GREENGRASS_HOSTS)) { - throw new import_property_provider.CredentialsProviderError( - `${parsed.hostname} is not a valid container metadata service hostname`, - false - ); - } - if (!parsed.protocol || !(parsed.protocol in GREENGRASS_PROTOCOLS)) { - throw new import_property_provider.CredentialsProviderError( - `${parsed.protocol} is not a valid container metadata service protocol`, - false - ); + if (!normalizedCreds) { + if (config.credentialDefaultProvider) { + normalizedCreds = normalizeProvider(config.credentialDefaultProvider(Object.assign({}, config, { + parentClientConfig: config + }))); + } else { + normalizedCreds = async () => { + throw new Error("`credentials` is missing"); + }; } - return { - ...parsed, - port: parsed.port ? parseInt(parsed.port, 10) : void 0 + } + const { signingEscapePath = true, systemClockOffset = config.systemClockOffset || 0, sha256 } = config; + let signer; + if (config.signer) { + signer = normalizeProvider(config.signer); + } else if (config.regionInfoProvider) { + signer = () => normalizeProvider(config.region)().then(async (region) => [ + await config.regionInfoProvider(region, { + useFipsEndpoint: await config.useFipsEndpoint(), + useDualstackEndpoint: await config.useDualstackEndpoint() + }) || {}, + region + ]).then(([regionInfo, region]) => { + const { signingRegion, signingService } = regionInfo; + config.signingRegion = config.signingRegion || signingRegion || region; + config.signingName = config.signingName || signingService || config.serviceId; + const params = { + ...config, + credentials: normalizedCreds, + region: config.signingRegion, + service: config.signingName, + sha256, + uriEscapePath: signingEscapePath + }; + const SignerCtor = config.signerConstructor || import_signature_v4.SignatureV4; + return new SignerCtor(params); + }); + } else { + signer = async (authScheme) => { + authScheme = Object.assign({}, { + name: "sigv4", + signingName: config.signingName || config.defaultSigningName, + signingRegion: await normalizeProvider(config.region)(), + properties: {} + }, authScheme); + const signingRegion = authScheme.signingRegion; + const signingService = authScheme.signingName; + config.signingRegion = config.signingRegion || signingRegion; + config.signingName = config.signingName || signingService || config.serviceId; + const params = { + ...config, + credentials: normalizedCreds, + region: config.signingRegion, + service: config.signingName, + sha256, + uriEscapePath: signingEscapePath + }; + const SignerCtor = config.signerConstructor || import_signature_v4.SignatureV4; + return new SignerCtor(params); }; } - throw new import_property_provider.CredentialsProviderError( - `The container metadata credential provider cannot be used unless the ${ENV_CMDS_RELATIVE_URI} or ${ENV_CMDS_FULL_URI} environment variable is set`, - false - ); - }, "getCmdsUri"); - var _InstanceMetadataV1FallbackError = class _InstanceMetadataV1FallbackError2 extends import_property_provider.CredentialsProviderError { - constructor(message, tryNextLink = true) { - super(message, tryNextLink); - this.tryNextLink = tryNextLink; - this.name = "InstanceMetadataV1FallbackError"; - Object.setPrototypeOf(this, _InstanceMetadataV1FallbackError2.prototype); + return { + ...config, + systemClockOffset, + signingEscapePath, + credentials: normalizedCreds, + signer + }; + }; + resolveAWSSDKSigV4Config = resolveAwsSdkSigV4Config; + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/index.js +var init_aws_sdk = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/index.js"() { + init_AwsSdkSigV4Signer(); + init_AwsSdkSigV4ASigner(); + init_resolveAwsSdkSigV4AConfig(); + init_resolveAwsSdkSigV4Config(); + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/index.js +var init_httpAuthSchemes2 = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/index.js"() { + init_aws_sdk(); + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/coercing-serializers.js +var _toStr, _toBool, _toNum; +var init_coercing_serializers = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/coercing-serializers.js"() { + _toStr = (val2) => { + if (val2 == null) { + return val2; } + if (typeof val2 === "number" || typeof val2 === "bigint") { + const warning = new Error(`Received number ${val2} where a string was expected.`); + warning.name = "Warning"; + console.warn(warning); + return String(val2); + } + if (typeof val2 === "boolean") { + const warning = new Error(`Received boolean ${val2} where a string was expected.`); + warning.name = "Warning"; + console.warn(warning); + return String(val2); + } + return val2; }; - __name(_InstanceMetadataV1FallbackError, "InstanceMetadataV1FallbackError"); - var InstanceMetadataV1FallbackError = _InstanceMetadataV1FallbackError; - var import_node_config_provider = require_dist_cjs22(); - var import_url_parser = require_dist_cjs24(); - var Endpoint = /* @__PURE__ */ ((Endpoint2) => { - Endpoint2["IPv4"] = "http://169.254.169.254"; - Endpoint2["IPv6"] = "http://[fd00:ec2::254]"; - return Endpoint2; - })(Endpoint || {}); - var ENV_ENDPOINT_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT"; - var CONFIG_ENDPOINT_NAME = "ec2_metadata_service_endpoint"; - var ENDPOINT_CONFIG_OPTIONS = { - environmentVariableSelector: (env) => env[ENV_ENDPOINT_NAME], - configFileSelector: (profile) => profile[CONFIG_ENDPOINT_NAME], - default: void 0 + _toBool = (val2) => { + if (val2 == null) { + return val2; + } + if (typeof val2 === "number") { + } + if (typeof val2 === "string") { + const lowercase = val2.toLowerCase(); + if (val2 !== "" && lowercase !== "false" && lowercase !== "true") { + const warning = new Error(`Received string "${val2}" where a boolean was expected.`); + warning.name = "Warning"; + console.warn(warning); + } + return val2 !== "" && lowercase !== "false"; + } + return val2; }; - var EndpointMode = /* @__PURE__ */ ((EndpointMode2) => { - EndpointMode2["IPv4"] = "IPv4"; - EndpointMode2["IPv6"] = "IPv6"; - return EndpointMode2; - })(EndpointMode || {}); - var ENV_ENDPOINT_MODE_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE"; - var CONFIG_ENDPOINT_MODE_NAME = "ec2_metadata_service_endpoint_mode"; - var ENDPOINT_MODE_CONFIG_OPTIONS = { - environmentVariableSelector: (env) => env[ENV_ENDPOINT_MODE_NAME], - configFileSelector: (profile) => profile[CONFIG_ENDPOINT_MODE_NAME], - default: "IPv4" - /* IPv4 */ + _toNum = (val2) => { + if (val2 == null) { + return val2; + } + if (typeof val2 === "boolean") { + } + if (typeof val2 === "string") { + const num = Number(val2); + if (num.toString() !== val2) { + const warning = new Error(`Received string "${val2}" where a number was expected.`); + warning.name = "Warning"; + console.warn(warning); + return val2; + } + return num; + } + return val2; }; - var getInstanceMetadataEndpoint = /* @__PURE__ */ __name(async () => (0, import_url_parser.parseUrl)(await getFromEndpointConfig() || await getFromEndpointModeConfig()), "getInstanceMetadataEndpoint"); - var getFromEndpointConfig = /* @__PURE__ */ __name(async () => (0, import_node_config_provider.loadConfig)(ENDPOINT_CONFIG_OPTIONS)(), "getFromEndpointConfig"); - var getFromEndpointModeConfig = /* @__PURE__ */ __name(async () => { - const endpointMode = await (0, import_node_config_provider.loadConfig)(ENDPOINT_MODE_CONFIG_OPTIONS)(); - switch (endpointMode) { - case "IPv4": - return "http://169.254.169.254"; - case "IPv6": - return "http://[fd00:ec2::254]"; - default: - throw new Error(`Unsupported endpoint mode: ${endpointMode}. Select from ${Object.values(EndpointMode)}`); + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/awsExpectUnion.js +var import_smithy_client2, awsExpectUnion; +var init_awsExpectUnion = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/awsExpectUnion.js"() { + import_smithy_client2 = __toESM(require_dist_cjs37()); + awsExpectUnion = (value) => { + if (value == null) { + return void 0; } - }, "getFromEndpointModeConfig"); - var STATIC_STABILITY_REFRESH_INTERVAL_SECONDS = 5 * 60; - var STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS = 5 * 60; - var STATIC_STABILITY_DOC_URL = "https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html"; - var getExtendedInstanceMetadataCredentials = /* @__PURE__ */ __name((credentials, logger) => { - const refreshInterval = STATIC_STABILITY_REFRESH_INTERVAL_SECONDS + Math.floor(Math.random() * STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS); - const newExpiration = new Date(Date.now() + refreshInterval * 1e3); - logger.warn( - `Attempting credential expiration extension due to a credential service availability issue. A refresh of these credentials will be attempted after ${new Date(newExpiration)}. -For more information, please visit: ` + STATIC_STABILITY_DOC_URL - ); - const originalExpiration = credentials.originalExpiration ?? credentials.expiration; - return { - ...credentials, - ...originalExpiration ? { originalExpiration } : {}, - expiration: newExpiration - }; - }, "getExtendedInstanceMetadataCredentials"); - var staticStabilityProvider = /* @__PURE__ */ __name((provider, options = {}) => { - const logger = (options == null ? void 0 : options.logger) || console; - let pastCredentials; - return async () => { - let credentials; + if (typeof value === "object" && "__type" in value) { + delete value.__type; + } + return (0, import_smithy_client2.expectUnion)(value); + }; + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/common.js +var import_smithy_client3, collectBodyString; +var init_common = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/common.js"() { + import_smithy_client3 = __toESM(require_dist_cjs37()); + collectBodyString = (streamBody, context) => (0, import_smithy_client3.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)); + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/parseJsonBody.js +var parseJsonBody, parseJsonErrorBody, loadRestJsonErrorCode; +var init_parseJsonBody = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/parseJsonBody.js"() { + init_common(); + parseJsonBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => { + if (encoded.length) { try { - credentials = await provider(); - if (credentials.expiration && credentials.expiration.getTime() < Date.now()) { - credentials = getExtendedInstanceMetadataCredentials(credentials, logger); - } + return JSON.parse(encoded); } catch (e) { - if (pastCredentials) { - logger.warn("Credential renew failed: ", e); - credentials = getExtendedInstanceMetadataCredentials(pastCredentials, logger); + if (e?.name === "SyntaxError") { + Object.defineProperty(e, "$responseBodyText", { + value: encoded + }); + } + throw e; + } + } + return {}; + }); + parseJsonErrorBody = async (errorBody, context) => { + const value = await parseJsonBody(errorBody, context); + value.message = value.message ?? value.Message; + return value; + }; + loadRestJsonErrorCode = (output, data) => { + const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()); + const sanitizeErrorCode = (rawValue) => { + let cleanValue = rawValue; + if (typeof cleanValue === "number") { + cleanValue = cleanValue.toString(); + } + if (cleanValue.indexOf(",") >= 0) { + cleanValue = cleanValue.split(",")[0]; + } + if (cleanValue.indexOf(":") >= 0) { + cleanValue = cleanValue.split(":")[0]; + } + if (cleanValue.indexOf("#") >= 0) { + cleanValue = cleanValue.split("#")[1]; + } + return cleanValue; + }; + const headerKey = findKey(output.headers, "x-amzn-errortype"); + if (headerKey !== void 0) { + return sanitizeErrorCode(output.headers[headerKey]); + } + if (data.code !== void 0) { + return sanitizeErrorCode(data.code); + } + if (data["__type"] !== void 0) { + return sanitizeErrorCode(data["__type"]); + } + }; + } +}); + +// ../../../node_modules/fast-xml-parser/src/util.js +var require_util = __commonJS({ + "../../../node_modules/fast-xml-parser/src/util.js"(exports2) { + "use strict"; + var nameStartChar = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD"; + var nameChar = nameStartChar + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040"; + var nameRegexp = "[" + nameStartChar + "][" + nameChar + "]*"; + var regexName = new RegExp("^" + nameRegexp + "$"); + var getAllMatches = function(string, regex) { + const matches = []; + let match = regex.exec(string); + while (match) { + const allmatches = []; + allmatches.startIndex = regex.lastIndex - match[0].length; + const len = match.length; + for (let index = 0; index < len; index++) { + allmatches.push(match[index]); + } + matches.push(allmatches); + match = regex.exec(string); + } + return matches; + }; + var isName = function(string) { + const match = regexName.exec(string); + return !(match === null || typeof match === "undefined"); + }; + exports2.isExist = function(v) { + return typeof v !== "undefined"; + }; + exports2.isEmptyObject = function(obj) { + return Object.keys(obj).length === 0; + }; + exports2.merge = function(target, a, arrayMode) { + if (a) { + const keys = Object.keys(a); + const len = keys.length; + for (let i = 0; i < len; i++) { + if (arrayMode === "strict") { + target[keys[i]] = [a[keys[i]]]; } else { - throw e; + target[keys[i]] = a[keys[i]]; } } - pastCredentials = credentials; - return credentials; - }; - }, "staticStabilityProvider"); - var IMDS_PATH = "/latest/meta-data/iam/security-credentials/"; - var IMDS_TOKEN_PATH = "/latest/api/token"; - var AWS_EC2_METADATA_V1_DISABLED = "AWS_EC2_METADATA_V1_DISABLED"; - var PROFILE_AWS_EC2_METADATA_V1_DISABLED = "ec2_metadata_v1_disabled"; - var X_AWS_EC2_METADATA_TOKEN = "x-aws-ec2-metadata-token"; - var fromInstanceMetadata = /* @__PURE__ */ __name((init = {}) => staticStabilityProvider(getInstanceImdsProvider(init), { logger: init.logger }), "fromInstanceMetadata"); - var getInstanceImdsProvider = /* @__PURE__ */ __name((init) => { - let disableFetchToken = false; - const { logger, profile } = init; - const { timeout, maxRetries } = providerConfigFromInit(init); - const getCredentials = /* @__PURE__ */ __name(async (maxRetries2, options) => { - var _a; - const isImdsV1Fallback = disableFetchToken || ((_a = options.headers) == null ? void 0 : _a[X_AWS_EC2_METADATA_TOKEN]) == null; - if (isImdsV1Fallback) { - let fallbackBlockedFromProfile = false; - let fallbackBlockedFromProcessEnv = false; - const configValue = await (0, import_node_config_provider.loadConfig)( - { - environmentVariableSelector: (env) => { - const envValue = env[AWS_EC2_METADATA_V1_DISABLED]; - fallbackBlockedFromProcessEnv = !!envValue && envValue !== "false"; - if (envValue === void 0) { - throw new import_property_provider.CredentialsProviderError( - `${AWS_EC2_METADATA_V1_DISABLED} not set in env, checking config file next.` + } + }; + exports2.getValue = function(v) { + if (exports2.isExist(v)) { + return v; + } else { + return ""; + } + }; + exports2.isName = isName; + exports2.getAllMatches = getAllMatches; + exports2.nameRegexp = nameRegexp; + } +}); + +// ../../../node_modules/fast-xml-parser/src/validator.js +var require_validator = __commonJS({ + "../../../node_modules/fast-xml-parser/src/validator.js"(exports2) { + "use strict"; + var util = require_util(); + var defaultOptions = { + allowBooleanAttributes: false, + //A tag can have attributes without any value + unpairedTags: [] + }; + exports2.validate = function(xmlData, options) { + options = Object.assign({}, defaultOptions, options); + const tags = []; + let tagFound = false; + let reachedRoot = false; + if (xmlData[0] === "\uFEFF") { + xmlData = xmlData.substr(1); + } + for (let i = 0; i < xmlData.length; i++) { + if (xmlData[i] === "<" && xmlData[i + 1] === "?") { + i += 2; + i = readPI(xmlData, i); + if (i.err) return i; + } else if (xmlData[i] === "<") { + let tagStartPos = i; + i++; + if (xmlData[i] === "!") { + i = readCommentAndCDATA(xmlData, i); + continue; + } else { + let closingTag = false; + if (xmlData[i] === "/") { + closingTag = true; + i++; + } + let tagName = ""; + for (; i < xmlData.length && xmlData[i] !== ">" && xmlData[i] !== " " && xmlData[i] !== " " && xmlData[i] !== "\n" && xmlData[i] !== "\r"; i++) { + tagName += xmlData[i]; + } + tagName = tagName.trim(); + if (tagName[tagName.length - 1] === "/") { + tagName = tagName.substring(0, tagName.length - 1); + i--; + } + if (!validateTagName(tagName)) { + let msg; + if (tagName.trim().length === 0) { + msg = "Invalid space after '<'."; + } else { + msg = "Tag '" + tagName + "' is an invalid name."; + } + return getErrorObject("InvalidTag", msg, getLineNumberForPosition(xmlData, i)); + } + const result = readAttributeStr(xmlData, i); + if (result === false) { + return getErrorObject("InvalidAttr", "Attributes for '" + tagName + "' have open quote.", getLineNumberForPosition(xmlData, i)); + } + let attrStr = result.value; + i = result.index; + if (attrStr[attrStr.length - 1] === "/") { + const attrStrStart = i - attrStr.length; + attrStr = attrStr.substring(0, attrStr.length - 1); + const isValid = validateAttributeString(attrStr, options); + if (isValid === true) { + tagFound = true; + } else { + return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, attrStrStart + isValid.err.line)); + } + } else if (closingTag) { + if (!result.tagClosed) { + return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' doesn't have proper closing.", getLineNumberForPosition(xmlData, i)); + } else if (attrStr.trim().length > 0) { + return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' can't have attributes or invalid starting.", getLineNumberForPosition(xmlData, tagStartPos)); + } else if (tags.length === 0) { + return getErrorObject("InvalidTag", "Closing tag '" + tagName + "' has not been opened.", getLineNumberForPosition(xmlData, tagStartPos)); + } else { + const otg = tags.pop(); + if (tagName !== otg.tagName) { + let openPos = getLineNumberForPosition(xmlData, otg.tagStartPos); + return getErrorObject( + "InvalidTag", + "Expected closing tag '" + otg.tagName + "' (opened in line " + openPos.line + ", col " + openPos.col + ") instead of closing tag '" + tagName + "'.", + getLineNumberForPosition(xmlData, tagStartPos) ); } - return fallbackBlockedFromProcessEnv; - }, - configFileSelector: (profile2) => { - const profileValue = profile2[PROFILE_AWS_EC2_METADATA_V1_DISABLED]; - fallbackBlockedFromProfile = !!profileValue && profileValue !== "false"; - return fallbackBlockedFromProfile; - }, - default: false - }, - { - profile - } - )(); - if (init.ec2MetadataV1Disabled || configValue) { - const causes = []; - if (init.ec2MetadataV1Disabled) - causes.push("credential provider initialization (runtime option ec2MetadataV1Disabled)"); - if (fallbackBlockedFromProfile) - causes.push(`config file profile (${PROFILE_AWS_EC2_METADATA_V1_DISABLED})`); - if (fallbackBlockedFromProcessEnv) - causes.push(`process environment variable (${AWS_EC2_METADATA_V1_DISABLED})`); - throw new InstanceMetadataV1FallbackError( - `AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${causes.join( - ", " - )}].` - ); - } - } - const imdsProfile = (await retry(async () => { - let profile2; - try { - profile2 = await getProfile(options); - } catch (err) { - if (err.statusCode === 401) { - disableFetchToken = false; + if (tags.length == 0) { + reachedRoot = true; + } + } + } else { + const isValid = validateAttributeString(attrStr, options); + if (isValid !== true) { + return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, i - attrStr.length + isValid.err.line)); + } + if (reachedRoot === true) { + return getErrorObject("InvalidXml", "Multiple possible root nodes found.", getLineNumberForPosition(xmlData, i)); + } else if (options.unpairedTags.indexOf(tagName) !== -1) { + } else { + tags.push({ tagName, tagStartPos }); + } + tagFound = true; } - throw err; - } - return profile2; - }, maxRetries2)).trim(); - return retry(async () => { - let creds; - try { - creds = await getCredentialsFromProfile(imdsProfile, options); - } catch (err) { - if (err.statusCode === 401) { - disableFetchToken = false; + for (i++; i < xmlData.length; i++) { + if (xmlData[i] === "<") { + if (xmlData[i + 1] === "!") { + i++; + i = readCommentAndCDATA(xmlData, i); + continue; + } else if (xmlData[i + 1] === "?") { + i = readPI(xmlData, ++i); + if (i.err) return i; + } else { + break; + } + } else if (xmlData[i] === "&") { + const afterAmp = validateAmpersand(xmlData, i); + if (afterAmp == -1) + return getErrorObject("InvalidChar", "char '&' is not expected.", getLineNumberForPosition(xmlData, i)); + i = afterAmp; + } else { + if (reachedRoot === true && !isWhiteSpace(xmlData[i])) { + return getErrorObject("InvalidXml", "Extra text at the end", getLineNumberForPosition(xmlData, i)); + } + } } - throw err; - } - return creds; - }, maxRetries2); - }, "getCredentials"); - return async () => { - const endpoint = await getInstanceMetadataEndpoint(); - if (disableFetchToken) { - logger == null ? void 0 : logger.debug("AWS SDK Instance Metadata", "using v1 fallback (no token fetch)"); - return getCredentials(maxRetries, { ...endpoint, timeout }); - } else { - let token; - try { - token = (await getMetadataToken({ ...endpoint, timeout })).toString(); - } catch (error) { - if ((error == null ? void 0 : error.statusCode) === 400) { - throw Object.assign(error, { - message: "EC2 Metadata token request returned error" - }); - } else if (error.message === "TimeoutError" || [403, 404, 405].includes(error.statusCode)) { - disableFetchToken = true; + if (xmlData[i] === "<") { + i--; } - logger == null ? void 0 : logger.debug("AWS SDK Instance Metadata", "using v1 fallback (initial)"); - return getCredentials(maxRetries, { ...endpoint, timeout }); } - return getCredentials(maxRetries, { - ...endpoint, - headers: { - [X_AWS_EC2_METADATA_TOKEN]: token - }, - timeout - }); + } else { + if (isWhiteSpace(xmlData[i])) { + continue; + } + return getErrorObject("InvalidChar", "char '" + xmlData[i] + "' is not expected.", getLineNumberForPosition(xmlData, i)); } - }; - }, "getInstanceImdsProvider"); - var getMetadataToken = /* @__PURE__ */ __name(async (options) => httpRequest({ - ...options, - path: IMDS_TOKEN_PATH, - method: "PUT", - headers: { - "x-aws-ec2-metadata-token-ttl-seconds": "21600" - } - }), "getMetadataToken"); - var getProfile = /* @__PURE__ */ __name(async (options) => (await httpRequest({ ...options, path: IMDS_PATH })).toString(), "getProfile"); - var getCredentialsFromProfile = /* @__PURE__ */ __name(async (profile, options) => { - const credsResponse = JSON.parse( - (await httpRequest({ - ...options, - path: IMDS_PATH + profile - })).toString() - ); - if (!isImdsCredentials(credsResponse)) { - throw new import_property_provider.CredentialsProviderError("Invalid response received from instance metadata service."); } - return fromImdsCredentials(credsResponse); - }, "getCredentialsFromProfile"); - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveCredentialSource.js -var require_resolveCredentialSource = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveCredentialSource.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveCredentialSource = void 0; - var credential_provider_env_1 = require_dist_cjs37(); - var credential_provider_imds_1 = require_dist_cjs38(); - var property_provider_1 = require_dist_cjs6(); - var resolveCredentialSource = (credentialSource, profileName) => { - const sourceProvidersMap = { - EcsContainer: credential_provider_imds_1.fromContainerMetadata, - Ec2InstanceMetadata: credential_provider_imds_1.fromInstanceMetadata, - Environment: credential_provider_env_1.fromEnv - }; - if (credentialSource in sourceProvidersMap) { - return sourceProvidersMap[credentialSource](); - } else { - throw new property_provider_1.CredentialsProviderError(`Unsupported credential source in profile ${profileName}. Got ${credentialSource}, expected EcsContainer or Ec2InstanceMetadata or Environment.`); + if (!tagFound) { + return getErrorObject("InvalidXml", "Start tag expected.", 1); + } else if (tags.length == 1) { + return getErrorObject("InvalidTag", "Unclosed tag '" + tags[0].tagName + "'.", getLineNumberForPosition(xmlData, tags[0].tagStartPos)); + } else if (tags.length > 0) { + return getErrorObject("InvalidXml", "Invalid '" + JSON.stringify(tags.map((t) => t.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }); } + return true; }; - exports2.resolveCredentialSource = resolveCredentialSource; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveAssumeRoleCredentials.js -var require_resolveAssumeRoleCredentials = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveAssumeRoleCredentials.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveAssumeRoleCredentials = exports2.isAssumeRoleProfile = void 0; - var property_provider_1 = require_dist_cjs6(); - var shared_ini_file_loader_1 = require_dist_cjs21(); - var resolveCredentialSource_1 = require_resolveCredentialSource(); - var resolveProfileData_1 = require_resolveProfileData(); - var isAssumeRoleProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.role_arn === "string" && ["undefined", "string"].indexOf(typeof arg.role_session_name) > -1 && ["undefined", "string"].indexOf(typeof arg.external_id) > -1 && ["undefined", "string"].indexOf(typeof arg.mfa_serial) > -1 && (isAssumeRoleWithSourceProfile(arg) || isAssumeRoleWithProviderProfile(arg)); - exports2.isAssumeRoleProfile = isAssumeRoleProfile; - var isAssumeRoleWithSourceProfile = (arg) => typeof arg.source_profile === "string" && typeof arg.credential_source === "undefined"; - var isAssumeRoleWithProviderProfile = (arg) => typeof arg.credential_source === "string" && typeof arg.source_profile === "undefined"; - var resolveAssumeRoleCredentials = async (profileName, profiles, options, visitedProfiles = {}) => { - const data = profiles[profileName]; - if (!options.roleAssumer) { - throw new property_provider_1.CredentialsProviderError(`Profile ${profileName} requires a role to be assumed, but no role assumption callback was provided.`, false); - } - const { source_profile } = data; - if (source_profile && source_profile in visitedProfiles) { - throw new property_provider_1.CredentialsProviderError(`Detected a cycle attempting to resolve credentials for profile ${(0, shared_ini_file_loader_1.getProfileName)(options)}. Profiles visited: ` + Object.keys(visitedProfiles).join(", "), false); - } - const sourceCredsProvider = source_profile ? (0, resolveProfileData_1.resolveProfileData)(source_profile, profiles, options, { - ...visitedProfiles, - [source_profile]: true - }) : (0, resolveCredentialSource_1.resolveCredentialSource)(data.credential_source, profileName)(); - const params = { - RoleArn: data.role_arn, - RoleSessionName: data.role_session_name || `aws-sdk-js-${Date.now()}`, - ExternalId: data.external_id, - DurationSeconds: parseInt(data.duration_seconds || "3600", 10) - }; - const { mfa_serial } = data; - if (mfa_serial) { - if (!options.mfaCodeProvider) { - throw new property_provider_1.CredentialsProviderError(`Profile ${profileName} requires multi-factor authentication, but no MFA code callback was provided.`, false); + function isWhiteSpace(char) { + return char === " " || char === " " || char === "\n" || char === "\r"; + } + function readPI(xmlData, i) { + const start = i; + for (; i < xmlData.length; i++) { + if (xmlData[i] == "?" || xmlData[i] == " ") { + const tagname = xmlData.substr(start, i - start); + if (i > 5 && tagname === "xml") { + return getErrorObject("InvalidXml", "XML declaration allowed only at the start of the document.", getLineNumberForPosition(xmlData, i)); + } else if (xmlData[i] == "?" && xmlData[i + 1] == ">") { + i++; + break; + } else { + continue; + } } - params.SerialNumber = mfa_serial; - params.TokenCode = await options.mfaCodeProvider(mfa_serial); - } - const sourceCreds = await sourceCredsProvider; - return options.roleAssumer(sourceCreds, params); - }; - exports2.resolveAssumeRoleCredentials = resolveAssumeRoleCredentials; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-process/dist-cjs/getValidatedProcessCredentials.js -var require_getValidatedProcessCredentials = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-process/dist-cjs/getValidatedProcessCredentials.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getValidatedProcessCredentials = void 0; - var getValidatedProcessCredentials = (profileName, data) => { - if (data.Version !== 1) { - throw Error(`Profile ${profileName} credential_process did not return Version 1.`); } - if (data.AccessKeyId === void 0 || data.SecretAccessKey === void 0) { - throw Error(`Profile ${profileName} credential_process returned invalid credentials.`); + return i; + } + function readCommentAndCDATA(xmlData, i) { + if (xmlData.length > i + 5 && xmlData[i + 1] === "-" && xmlData[i + 2] === "-") { + for (i += 3; i < xmlData.length; i++) { + if (xmlData[i] === "-" && xmlData[i + 1] === "-" && xmlData[i + 2] === ">") { + i += 2; + break; + } + } + } else if (xmlData.length > i + 8 && xmlData[i + 1] === "D" && xmlData[i + 2] === "O" && xmlData[i + 3] === "C" && xmlData[i + 4] === "T" && xmlData[i + 5] === "Y" && xmlData[i + 6] === "P" && xmlData[i + 7] === "E") { + let angleBracketsCount = 1; + for (i += 8; i < xmlData.length; i++) { + if (xmlData[i] === "<") { + angleBracketsCount++; + } else if (xmlData[i] === ">") { + angleBracketsCount--; + if (angleBracketsCount === 0) { + break; + } + } + } + } else if (xmlData.length > i + 9 && xmlData[i + 1] === "[" && xmlData[i + 2] === "C" && xmlData[i + 3] === "D" && xmlData[i + 4] === "A" && xmlData[i + 5] === "T" && xmlData[i + 6] === "A" && xmlData[i + 7] === "[") { + for (i += 8; i < xmlData.length; i++) { + if (xmlData[i] === "]" && xmlData[i + 1] === "]" && xmlData[i + 2] === ">") { + i += 2; + break; + } + } } - if (data.Expiration) { - const currentTime = /* @__PURE__ */ new Date(); - const expireTime = new Date(data.Expiration); - if (expireTime < currentTime) { - throw Error(`Profile ${profileName} credential_process returned expired credentials.`); + return i; + } + var doubleQuote = '"'; + var singleQuote = "'"; + function readAttributeStr(xmlData, i) { + let attrStr = ""; + let startChar = ""; + let tagClosed = false; + for (; i < xmlData.length; i++) { + if (xmlData[i] === doubleQuote || xmlData[i] === singleQuote) { + if (startChar === "") { + startChar = xmlData[i]; + } else if (startChar !== xmlData[i]) { + } else { + startChar = ""; + } + } else if (xmlData[i] === ">") { + if (startChar === "") { + tagClosed = true; + break; + } } + attrStr += xmlData[i]; + } + if (startChar !== "") { + return false; } return { - accessKeyId: data.AccessKeyId, - secretAccessKey: data.SecretAccessKey, - ...data.SessionToken && { sessionToken: data.SessionToken }, - ...data.Expiration && { expiration: new Date(data.Expiration) } + value: attrStr, + index: i, + tagClosed }; - }; - exports2.getValidatedProcessCredentials = getValidatedProcessCredentials; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-process/dist-cjs/resolveProcessCredentials.js -var require_resolveProcessCredentials = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-process/dist-cjs/resolveProcessCredentials.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveProcessCredentials = void 0; - var property_provider_1 = require_dist_cjs6(); - var child_process_1 = require("child_process"); - var util_1 = require("util"); - var getValidatedProcessCredentials_1 = require_getValidatedProcessCredentials(); - var resolveProcessCredentials = async (profileName, profiles) => { - const profile = profiles[profileName]; - if (profiles[profileName]) { - const credentialProcess = profile["credential_process"]; - if (credentialProcess !== void 0) { - const execPromise = (0, util_1.promisify)(child_process_1.exec); - try { - const { stdout } = await execPromise(credentialProcess); - let data; - try { - data = JSON.parse(stdout.trim()); - } catch (_a) { - throw Error(`Profile ${profileName} credential_process returned invalid JSON.`); - } - return (0, getValidatedProcessCredentials_1.getValidatedProcessCredentials)(profileName, data); - } catch (error) { - throw new property_provider_1.CredentialsProviderError(error.message); - } + } + var validAttrStrRegxp = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); + function validateAttributeString(attrStr, options) { + const matches = util.getAllMatches(attrStr, validAttrStrRegxp); + const attrNames = {}; + for (let i = 0; i < matches.length; i++) { + if (matches[i][1].length === 0) { + return getErrorObject("InvalidAttr", "Attribute '" + matches[i][2] + "' has no space in starting.", getPositionFromMatch(matches[i])); + } else if (matches[i][3] !== void 0 && matches[i][4] === void 0) { + return getErrorObject("InvalidAttr", "Attribute '" + matches[i][2] + "' is without value.", getPositionFromMatch(matches[i])); + } else if (matches[i][3] === void 0 && !options.allowBooleanAttributes) { + return getErrorObject("InvalidAttr", "boolean attribute '" + matches[i][2] + "' is not allowed.", getPositionFromMatch(matches[i])); + } + const attrName = matches[i][2]; + if (!validateAttrName(attrName)) { + return getErrorObject("InvalidAttr", "Attribute '" + attrName + "' is an invalid name.", getPositionFromMatch(matches[i])); + } + if (!attrNames.hasOwnProperty(attrName)) { + attrNames[attrName] = 1; } else { - throw new property_provider_1.CredentialsProviderError(`Profile ${profileName} did not contain credential_process.`); + return getErrorObject("InvalidAttr", "Attribute '" + attrName + "' is repeated.", getPositionFromMatch(matches[i])); } - } else { - throw new property_provider_1.CredentialsProviderError(`Profile ${profileName} could not be found in shared credentials file.`); } - }; - exports2.resolveProcessCredentials = resolveProcessCredentials; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-process/dist-cjs/fromProcess.js -var require_fromProcess = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-process/dist-cjs/fromProcess.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.fromProcess = void 0; - var shared_ini_file_loader_1 = require_dist_cjs21(); - var resolveProcessCredentials_1 = require_resolveProcessCredentials(); - var fromProcess = (init = {}) => async () => { - const profiles = await (0, shared_ini_file_loader_1.parseKnownFiles)(init); - return (0, resolveProcessCredentials_1.resolveProcessCredentials)((0, shared_ini_file_loader_1.getProfileName)(init), profiles); - }; - exports2.fromProcess = fromProcess; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-process/dist-cjs/index.js -var require_dist_cjs39 = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-process/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_fromProcess(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveProcessCredentials.js -var require_resolveProcessCredentials2 = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveProcessCredentials.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveProcessCredentials = exports2.isProcessProfile = void 0; - var credential_provider_process_1 = require_dist_cjs39(); - var isProcessProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.credential_process === "string"; - exports2.isProcessProfile = isProcessProfile; - var resolveProcessCredentials = async (options, profile) => (0, credential_provider_process_1.fromProcess)({ - ...options, - profile - })(); - exports2.resolveProcessCredentials = resolveProcessCredentials; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/isSsoProfile.js -var require_isSsoProfile = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/isSsoProfile.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isSsoProfile = void 0; - var isSsoProfile = (arg) => arg && (typeof arg.sso_start_url === "string" || typeof arg.sso_account_id === "string" || typeof arg.sso_session === "string" || typeof arg.sso_region === "string" || typeof arg.sso_role_name === "string"); - exports2.isSsoProfile = isSsoProfile; - } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/endpoint/EndpointParameters.js -var require_EndpointParameters3 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/endpoint/EndpointParameters.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveClientEndpointParameters = void 0; - var resolveClientEndpointParameters = (options) => { + return true; + } + function validateNumberAmpersand(xmlData, i) { + let re = /\d/; + if (xmlData[i] === "x") { + i++; + re = /[\da-fA-F]/; + } + for (; i < xmlData.length; i++) { + if (xmlData[i] === ";") + return i; + if (!xmlData[i].match(re)) + break; + } + return -1; + } + function validateAmpersand(xmlData, i) { + i++; + if (xmlData[i] === ";") + return -1; + if (xmlData[i] === "#") { + i++; + return validateNumberAmpersand(xmlData, i); + } + let count = 0; + for (; i < xmlData.length; i++, count++) { + if (xmlData[i].match(/\w/) && count < 20) + continue; + if (xmlData[i] === ";") + break; + return -1; + } + return i; + } + function getErrorObject(code, message, lineNumber) { return { - ...options, - useDualstackEndpoint: options.useDualstackEndpoint ?? false, - useFipsEndpoint: options.useFipsEndpoint ?? false, - defaultSigningName: "awsssoportal" + err: { + code, + msg: message, + line: lineNumber.line || lineNumber, + col: lineNumber.col + } }; - }; - exports2.resolveClientEndpointParameters = resolveClientEndpointParameters; + } + function validateAttrName(attrName) { + return util.isName(attrName); + } + function validateTagName(tagname) { + return util.isName(tagname); + } + function getLineNumberForPosition(xmlData, index) { + const lines = xmlData.substring(0, index).split(/\r?\n/); + return { + line: lines.length, + // column number is last line's length + 1, because column numbering starts at 1: + col: lines[lines.length - 1].length + 1 + }; + } + function getPositionFromMatch(match) { + return match.startIndex + match[1].length; + } } }); -// ../../../node_modules/@aws-sdk/client-sso/package.json -var require_package3 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/package.json"(exports2, module2) { - module2.exports = { - name: "@aws-sdk/client-sso", - description: "AWS SDK for JavaScript Sso Client for Node.js, Browser and React Native", - version: "3.421.0", - scripts: { - build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", - "build:docs": "typedoc", - "build:es": "tsc -p tsconfig.es.json", - "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", - "build:types": "tsc -p tsconfig.types.json", - "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4", - clean: "rimraf ./dist-* && rimraf *.tsbuildinfo", - "extract:docs": "api-extractor run --local", - "generate:client": "node ../../scripts/generate-clients/single-service --solo sso" - }, - main: "./dist-cjs/index.js", - types: "./dist-types/index.d.ts", - module: "./dist-es/index.js", - sideEffects: false, - dependencies: { - "@aws-crypto/sha256-browser": "3.0.0", - "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/middleware-host-header": "3.418.0", - "@aws-sdk/middleware-logger": "3.418.0", - "@aws-sdk/middleware-recursion-detection": "3.418.0", - "@aws-sdk/middleware-user-agent": "3.418.0", - "@aws-sdk/region-config-resolver": "3.418.0", - "@aws-sdk/types": "3.418.0", - "@aws-sdk/util-endpoints": "3.418.0", - "@aws-sdk/util-user-agent-browser": "3.418.0", - "@aws-sdk/util-user-agent-node": "3.418.0", - "@smithy/config-resolver": "^2.0.10", - "@smithy/fetch-http-handler": "^2.1.5", - "@smithy/hash-node": "^2.0.9", - "@smithy/invalid-dependency": "^2.0.9", - "@smithy/middleware-content-length": "^2.0.11", - "@smithy/middleware-endpoint": "^2.0.9", - "@smithy/middleware-retry": "^2.0.12", - "@smithy/middleware-serde": "^2.0.9", - "@smithy/middleware-stack": "^2.0.2", - "@smithy/node-config-provider": "^2.0.12", - "@smithy/node-http-handler": "^2.1.5", - "@smithy/protocol-http": "^3.0.5", - "@smithy/smithy-client": "^2.1.6", - "@smithy/types": "^2.3.3", - "@smithy/url-parser": "^2.0.9", - "@smithy/util-base64": "^2.0.0", - "@smithy/util-body-length-browser": "^2.0.0", - "@smithy/util-body-length-node": "^2.1.0", - "@smithy/util-defaults-mode-browser": "^2.0.10", - "@smithy/util-defaults-mode-node": "^2.0.12", - "@smithy/util-retry": "^2.0.2", - "@smithy/util-utf8": "^2.0.0", - tslib: "^2.5.0" - }, - devDependencies: { - "@smithy/service-client-documentation-generator": "^2.0.0", - "@tsconfig/node14": "1.0.3", - "@types/node": "^14.14.31", - concurrently: "7.0.0", - "downlevel-dts": "0.10.1", - rimraf: "3.0.2", - typedoc: "0.23.23", - typescript: "~4.9.5" - }, - engines: { - node: ">=14.0.0" - }, - typesVersions: { - "<4.0": { - "dist-types/*": [ - "dist-types/ts3.4/*" - ] - } - }, - files: [ - "dist-*/**" - ], - author: { - name: "AWS SDK for JavaScript Team", - url: "https://aws.amazon.com/javascript/" +// ../../../node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +var require_OptionsBuilder = __commonJS({ + "../../../node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js"(exports2) { + var defaultOptions = { + preserveOrder: false, + attributeNamePrefix: "@_", + attributesGroupName: false, + textNodeName: "#text", + ignoreAttributes: true, + removeNSPrefix: false, + // remove NS from tag name or attribute name if true + allowBooleanAttributes: false, + //a tag can have attributes without any value + //ignoreRootElement : false, + parseTagValue: true, + parseAttributeValue: false, + trimValues: true, + //Trim string values of tag and attributes + cdataPropName: false, + numberParseOptions: { + hex: true, + leadingZeros: true, + eNotation: true }, - license: "Apache-2.0", - browser: { - "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" + tagValueProcessor: function(tagName, val2) { + return val2; }, - "react-native": { - "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" + attributeValueProcessor: function(attrName, val2) { + return val2; }, - homepage: "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-sso", - repository: { - type: "git", - url: "https://github.com/aws/aws-sdk-js-v3.git", - directory: "clients/client-sso" + stopNodes: [], + //nested tags will not be parsed even for errors + alwaysCreateTextNode: false, + isArray: () => false, + commentPropName: false, + unpairedTags: [], + processEntities: true, + htmlEntities: false, + ignoreDeclaration: false, + ignorePiTags: false, + transformTagName: false, + transformAttributeName: false, + updateTag: function(tagName, jPath, attrs) { + return tagName; } + // skipEmptyListItem: false }; - } -}); - -// ../../../node_modules/@aws-sdk/util-user-agent-node/dist-cjs/is-crt-available.js -var require_is_crt_available = __commonJS({ - "../../../node_modules/@aws-sdk/util-user-agent-node/dist-cjs/is-crt-available.js"(exports2, module2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isCrtAvailable = void 0; - var isCrtAvailable = () => { - try { - if (typeof require === "function" && typeof module2 !== "undefined" && require("aws-crt")) { - return ["md/crt-avail"]; - } - return null; - } catch (e) { - return null; - } + var buildOptions = function(options) { + return Object.assign({}, defaultOptions, options); }; - exports2.isCrtAvailable = isCrtAvailable; + exports2.buildOptions = buildOptions; + exports2.defaultOptions = defaultOptions; } }); -// ../../../node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js -var require_dist_cjs40 = __commonJS({ - "../../../node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js"(exports2) { +// ../../../node_modules/fast-xml-parser/src/xmlparser/xmlNode.js +var require_xmlNode = __commonJS({ + "../../../node_modules/fast-xml-parser/src/xmlparser/xmlNode.js"(exports2, module2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.defaultUserAgent = exports2.UA_APP_ID_INI_NAME = exports2.UA_APP_ID_ENV_NAME = void 0; - var node_config_provider_1 = require_dist_cjs22(); - var os_1 = require("os"); - var process_1 = require("process"); - var is_crt_available_1 = require_is_crt_available(); - exports2.UA_APP_ID_ENV_NAME = "AWS_SDK_UA_APP_ID"; - exports2.UA_APP_ID_INI_NAME = "sdk-ua-app-id"; - var defaultUserAgent = ({ serviceId, clientVersion }) => { - const sections = [ - ["aws-sdk-js", clientVersion], - ["ua", "2.0"], - [`os/${(0, os_1.platform)()}`, (0, os_1.release)()], - ["lang/js"], - ["md/nodejs", `${process_1.versions.node}`] - ]; - const crtAvailable = (0, is_crt_available_1.isCrtAvailable)(); - if (crtAvailable) { - sections.push(crtAvailable); - } - if (serviceId) { - sections.push([`api/${serviceId}`, clientVersion]); + var XmlNode = class { + constructor(tagname) { + this.tagname = tagname; + this.child = []; + this[":@"] = {}; } - if (process_1.env.AWS_EXECUTION_ENV) { - sections.push([`exec-env/${process_1.env.AWS_EXECUTION_ENV}`]); + add(key, val2) { + if (key === "__proto__") key = "#__proto__"; + this.child.push({ [key]: val2 }); } - const appIdPromise = (0, node_config_provider_1.loadConfig)({ - environmentVariableSelector: (env) => env[exports2.UA_APP_ID_ENV_NAME], - configFileSelector: (profile) => profile[exports2.UA_APP_ID_INI_NAME], - default: void 0 - })(); - let resolvedUserAgent = void 0; - return async () => { - if (!resolvedUserAgent) { - const appId = await appIdPromise; - resolvedUserAgent = appId ? [...sections, [`app/${appId}`]] : [...sections]; + addChild(node) { + if (node.tagname === "__proto__") node.tagname = "#__proto__"; + if (node[":@"] && Object.keys(node[":@"]).length > 0) { + this.child.push({ [node.tagname]: node.child, [":@"]: node[":@"] }); + } else { + this.child.push({ [node.tagname]: node.child }); } - return resolvedUserAgent; - }; + } }; - exports2.defaultUserAgent = defaultUserAgent; + module2.exports = XmlNode; } }); -// ../../../node_modules/@smithy/hash-node/dist-cjs/index.js -var require_dist_cjs41 = __commonJS({ - "../../../node_modules/@smithy/hash-node/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - Hash: () => Hash - }); - module2.exports = __toCommonJS2(src_exports); - var import_util_buffer_from = require_dist_cjs9(); - var import_util_utf8 = require_dist_cjs10(); - var import_buffer = require("buffer"); - var import_crypto5 = require("crypto"); - var _Hash = class _Hash { - constructor(algorithmIdentifier, secret) { - this.algorithmIdentifier = algorithmIdentifier; - this.secret = secret; - this.reset(); - } - update(toHash, encoding) { - this.hash.update((0, import_util_utf8.toUint8Array)(castSourceData(toHash, encoding))); +// ../../../node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +var require_DocTypeReader = __commonJS({ + "../../../node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js"(exports2, module2) { + var util = require_util(); + function readDocType(xmlData, i) { + const entities = {}; + if (xmlData[i + 3] === "O" && xmlData[i + 4] === "C" && xmlData[i + 5] === "T" && xmlData[i + 6] === "Y" && xmlData[i + 7] === "P" && xmlData[i + 8] === "E") { + i = i + 9; + let angleBracketsCount = 1; + let hasBody = false, comment = false; + let exp = ""; + for (; i < xmlData.length; i++) { + if (xmlData[i] === "<" && !comment) { + if (hasBody && isEntity(xmlData, i)) { + i += 7; + [entityName, val, i] = readEntityExp(xmlData, i + 1); + if (val.indexOf("&") === -1) + entities[validateEntityName(entityName)] = { + regx: RegExp(`&${entityName};`, "g"), + val + }; + } else if (hasBody && isElement(xmlData, i)) i += 8; + else if (hasBody && isAttlist(xmlData, i)) i += 8; + else if (hasBody && isNotation(xmlData, i)) i += 9; + else if (isComment) comment = true; + else throw new Error("Invalid DOCTYPE"); + angleBracketsCount++; + exp = ""; + } else if (xmlData[i] === ">") { + if (comment) { + if (xmlData[i - 1] === "-" && xmlData[i - 2] === "-") { + comment = false; + angleBracketsCount--; + } + } else { + angleBracketsCount--; + } + if (angleBracketsCount === 0) { + break; + } + } else if (xmlData[i] === "[") { + hasBody = true; + } else { + exp += xmlData[i]; + } + } + if (angleBracketsCount !== 0) { + throw new Error(`Unclosed DOCTYPE`); + } + } else { + throw new Error(`Invalid Tag instead of DOCTYPE`); } - digest() { - return Promise.resolve(this.hash.digest()); + return { entities, i }; + } + function readEntityExp(xmlData, i) { + let entityName2 = ""; + for (; i < xmlData.length && (xmlData[i] !== "'" && xmlData[i] !== '"'); i++) { + entityName2 += xmlData[i]; } - reset() { - this.hash = this.secret ? (0, import_crypto5.createHmac)(this.algorithmIdentifier, castSourceData(this.secret)) : (0, import_crypto5.createHash)(this.algorithmIdentifier); + entityName2 = entityName2.trim(); + if (entityName2.indexOf(" ") !== -1) throw new Error("External entites are not supported"); + const startChar = xmlData[i++]; + let val2 = ""; + for (; i < xmlData.length && xmlData[i] !== startChar; i++) { + val2 += xmlData[i]; } + return [entityName2, val2, i]; + } + function isComment(xmlData, i) { + if (xmlData[i + 1] === "!" && xmlData[i + 2] === "-" && xmlData[i + 3] === "-") return true; + return false; + } + function isEntity(xmlData, i) { + if (xmlData[i + 1] === "!" && xmlData[i + 2] === "E" && xmlData[i + 3] === "N" && xmlData[i + 4] === "T" && xmlData[i + 5] === "I" && xmlData[i + 6] === "T" && xmlData[i + 7] === "Y") return true; + return false; + } + function isElement(xmlData, i) { + if (xmlData[i + 1] === "!" && xmlData[i + 2] === "E" && xmlData[i + 3] === "L" && xmlData[i + 4] === "E" && xmlData[i + 5] === "M" && xmlData[i + 6] === "E" && xmlData[i + 7] === "N" && xmlData[i + 8] === "T") return true; + return false; + } + function isAttlist(xmlData, i) { + if (xmlData[i + 1] === "!" && xmlData[i + 2] === "A" && xmlData[i + 3] === "T" && xmlData[i + 4] === "T" && xmlData[i + 5] === "L" && xmlData[i + 6] === "I" && xmlData[i + 7] === "S" && xmlData[i + 8] === "T") return true; + return false; + } + function isNotation(xmlData, i) { + if (xmlData[i + 1] === "!" && xmlData[i + 2] === "N" && xmlData[i + 3] === "O" && xmlData[i + 4] === "T" && xmlData[i + 5] === "A" && xmlData[i + 6] === "T" && xmlData[i + 7] === "I" && xmlData[i + 8] === "O" && xmlData[i + 9] === "N") return true; + return false; + } + function validateEntityName(name) { + if (util.isName(name)) + return name; + else + throw new Error(`Invalid entity name ${name}`); + } + module2.exports = readDocType; + } +}); + +// ../../../node_modules/strnum/strnum.js +var require_strnum = __commonJS({ + "../../../node_modules/strnum/strnum.js"(exports2, module2) { + var hexRegex = /^[-+]?0x[a-fA-F0-9]+$/; + var numRegex = /^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/; + if (!Number.parseInt && window.parseInt) { + Number.parseInt = window.parseInt; + } + if (!Number.parseFloat && window.parseFloat) { + Number.parseFloat = window.parseFloat; + } + var consider = { + hex: true, + leadingZeros: true, + decimalPoint: ".", + eNotation: true + //skipLike: /regex/ }; - __name(_Hash, "Hash"); - var Hash = _Hash; - function castSourceData(toCast, encoding) { - if (import_buffer.Buffer.isBuffer(toCast)) { - return toCast; - } - if (typeof toCast === "string") { - return (0, import_util_buffer_from.fromString)(toCast, encoding); + function toNumber(str, options = {}) { + options = Object.assign({}, consider, options); + if (!str || typeof str !== "string") return str; + let trimmedStr = str.trim(); + if (options.skipLike !== void 0 && options.skipLike.test(trimmedStr)) return str; + else if (options.hex && hexRegex.test(trimmedStr)) { + return Number.parseInt(trimmedStr, 16); + } else { + const match = numRegex.exec(trimmedStr); + if (match) { + const sign = match[1]; + const leadingZeros = match[2]; + let numTrimmedByZeros = trimZeros(match[3]); + const eNotation = match[4] || match[6]; + if (!options.leadingZeros && leadingZeros.length > 0 && sign && trimmedStr[2] !== ".") return str; + else if (!options.leadingZeros && leadingZeros.length > 0 && !sign && trimmedStr[1] !== ".") return str; + else { + const num = Number(trimmedStr); + const numStr = "" + num; + if (numStr.search(/[eE]/) !== -1) { + if (options.eNotation) return num; + else return str; + } else if (eNotation) { + if (options.eNotation) return num; + else return str; + } else if (trimmedStr.indexOf(".") !== -1) { + if (numStr === "0" && numTrimmedByZeros === "") return num; + else if (numStr === numTrimmedByZeros) return num; + else if (sign && numStr === "-" + numTrimmedByZeros) return num; + else return str; + } + if (leadingZeros) { + if (numTrimmedByZeros === numStr) return num; + else if (sign + numTrimmedByZeros === numStr) return num; + else return str; + } + if (trimmedStr === numStr) return num; + else if (trimmedStr === sign + numStr) return num; + return str; + } + } else { + return str; + } } - if (ArrayBuffer.isView(toCast)) { - return (0, import_util_buffer_from.fromArrayBuffer)(toCast.buffer, toCast.byteOffset, toCast.byteLength); + } + function trimZeros(numStr) { + if (numStr && numStr.indexOf(".") !== -1) { + numStr = numStr.replace(/0+$/, ""); + if (numStr === ".") numStr = "0"; + else if (numStr[0] === ".") numStr = "0" + numStr; + else if (numStr[numStr.length - 1] === ".") numStr = numStr.substr(0, numStr.length - 1); + return numStr; } - return (0, import_util_buffer_from.fromArrayBuffer)(toCast); + return numStr; } - __name(castSourceData, "castSourceData"); + module2.exports = toNumber; } }); -// ../../../node_modules/@smithy/util-body-length-node/dist-cjs/index.js -var require_dist_cjs42 = __commonJS({ - "../../../node_modules/@smithy/util-body-length-node/dist-cjs/index.js"(exports2, module2) { - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); +// ../../../node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +var require_OrderedObjParser = __commonJS({ + "../../../node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js"(exports2, module2) { + "use strict"; + var util = require_util(); + var xmlNode = require_xmlNode(); + var readDocType = require_DocTypeReader(); + var toNumber = require_strnum(); + var OrderedObjParser = class { + constructor(options) { + this.options = options; + this.currentNode = null; + this.tagsNodeStack = []; + this.docTypeEntities = {}; + this.lastEntities = { + "apos": { regex: /&(apos|#39|#x27);/g, val: "'" }, + "gt": { regex: /&(gt|#62|#x3E);/g, val: ">" }, + "lt": { regex: /&(lt|#60|#x3C);/g, val: "<" }, + "quot": { regex: /&(quot|#34|#x22);/g, val: '"' } + }; + this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }; + this.htmlEntities = { + "space": { regex: /&(nbsp|#160);/g, val: " " }, + // "lt" : { regex: /&(lt|#60);/g, val: "<" }, + // "gt" : { regex: /&(gt|#62);/g, val: ">" }, + // "amp" : { regex: /&(amp|#38);/g, val: "&" }, + // "quot" : { regex: /&(quot|#34);/g, val: "\"" }, + // "apos" : { regex: /&(apos|#39);/g, val: "'" }, + "cent": { regex: /&(cent|#162);/g, val: "\xA2" }, + "pound": { regex: /&(pound|#163);/g, val: "\xA3" }, + "yen": { regex: /&(yen|#165);/g, val: "\xA5" }, + "euro": { regex: /&(euro|#8364);/g, val: "\u20AC" }, + "copyright": { regex: /&(copy|#169);/g, val: "\xA9" }, + "reg": { regex: /&(reg|#174);/g, val: "\xAE" }, + "inr": { regex: /&(inr|#8377);/g, val: "\u20B9" }, + "num_dec": { regex: /&#([0-9]{1,7});/g, val: (_, str) => String.fromCharCode(Number.parseInt(str, 10)) }, + "num_hex": { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (_, str) => String.fromCharCode(Number.parseInt(str, 16)) } + }; + this.addExternalEntities = addExternalEntities; + this.parseXml = parseXml; + this.parseTextData = parseTextData; + this.resolveNameSpace = resolveNameSpace; + this.buildAttributesMap = buildAttributesMap; + this.isItStopNode = isItStopNode; + this.replaceEntitiesValue = replaceEntitiesValue; + this.readStopNodeData = readStopNodeData; + this.saveTextToParentTag = saveTextToParentTag; + this.addChild = addChild; } - return to; }; - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - calculateBodyLength: () => calculateBodyLength - }); - module2.exports = __toCommonJS2(src_exports); - var import_fs = require("fs"); - var calculateBodyLength = /* @__PURE__ */ __name((body) => { - if (!body) { - return 0; + function addExternalEntities(externalEntities) { + const entKeys = Object.keys(externalEntities); + for (let i = 0; i < entKeys.length; i++) { + const ent = entKeys[i]; + this.lastEntities[ent] = { + regex: new RegExp("&" + ent + ";", "g"), + val: externalEntities[ent] + }; + } + } + function parseTextData(val2, tagName, jPath, dontTrim, hasAttributes, isLeafNode, escapeEntities) { + if (val2 !== void 0) { + if (this.options.trimValues && !dontTrim) { + val2 = val2.trim(); + } + if (val2.length > 0) { + if (!escapeEntities) val2 = this.replaceEntitiesValue(val2); + const newval = this.options.tagValueProcessor(tagName, val2, jPath, hasAttributes, isLeafNode); + if (newval === null || newval === void 0) { + return val2; + } else if (typeof newval !== typeof val2 || newval !== val2) { + return newval; + } else if (this.options.trimValues) { + return parseValue(val2, this.options.parseTagValue, this.options.numberParseOptions); + } else { + const trimmedVal = val2.trim(); + if (trimmedVal === val2) { + return parseValue(val2, this.options.parseTagValue, this.options.numberParseOptions); + } else { + return val2; + } + } + } } - if (typeof body === "string") { - return Buffer.byteLength(body); - } else if (typeof body.byteLength === "number") { - return body.byteLength; - } else if (typeof body.size === "number") { - return body.size; - } else if (typeof body.start === "number" && typeof body.end === "number") { - return body.end + 1 - body.start; - } else if (typeof body.path === "string" || Buffer.isBuffer(body.path)) { - return (0, import_fs.lstatSync)(body.path).size; - } else if (typeof body.fd === "number") { - return (0, import_fs.fstatSync)(body.fd).size; + } + function resolveNameSpace(tagname) { + if (this.options.removeNSPrefix) { + const tags = tagname.split(":"); + const prefix = tagname.charAt(0) === "/" ? "/" : ""; + if (tags[0] === "xmlns") { + return ""; + } + if (tags.length === 2) { + tagname = prefix + tags[1]; + } } - throw new Error(`Body Length computation failed for ${body}`); - }, "calculateBodyLength"); - } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/endpoint/ruleset.js -var require_ruleset = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/endpoint/ruleset.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ruleSet = void 0; - var q = "required"; - var r = "fn"; - var s = "argv"; - var t = "ref"; - var a = "isSet"; - var b = "tree"; - var c = "error"; - var d = "endpoint"; - var e = "PartitionResult"; - var f = { [q]: false, "type": "String" }; - var g = { [q]: true, "default": false, "type": "Boolean" }; - var h = { [t]: "Endpoint" }; - var i = { [r]: "booleanEquals", [s]: [{ [t]: "UseFIPS" }, true] }; - var j = { [r]: "booleanEquals", [s]: [{ [t]: "UseDualStack" }, true] }; - var k = {}; - var l = { [r]: "booleanEquals", [s]: [true, { [r]: "getAttr", [s]: [{ [t]: e }, "supportsFIPS"] }] }; - var m = { [r]: "booleanEquals", [s]: [true, { [r]: "getAttr", [s]: [{ [t]: e }, "supportsDualStack"] }] }; - var n = [i]; - var o = [j]; - var p = [{ [t]: "Region" }]; - var _data = { version: "1.0", parameters: { Region: f, UseDualStack: g, UseFIPS: g, Endpoint: f }, rules: [{ conditions: [{ [r]: a, [s]: [h] }], type: b, rules: [{ conditions: n, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: c }, { conditions: o, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: c }, { endpoint: { url: h, properties: k, headers: k }, type: d }] }, { conditions: [{ [r]: a, [s]: p }], type: b, rules: [{ conditions: [{ [r]: "aws.partition", [s]: p, assign: e }], type: b, rules: [{ conditions: [i, j], type: b, rules: [{ conditions: [l, m], type: b, rules: [{ endpoint: { url: "https://portal.sso-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: k, headers: k }, type: d }] }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: c }] }, { conditions: n, type: b, rules: [{ conditions: [l], type: b, rules: [{ endpoint: { url: "https://portal.sso-fips.{Region}.{PartitionResult#dnsSuffix}", properties: k, headers: k }, type: d }] }, { error: "FIPS is enabled but this partition does not support FIPS", type: c }] }, { conditions: o, type: b, rules: [{ conditions: [m], type: b, rules: [{ endpoint: { url: "https://portal.sso.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: k, headers: k }, type: d }] }, { error: "DualStack is enabled but this partition does not support DualStack", type: c }] }, { endpoint: { url: "https://portal.sso.{Region}.{PartitionResult#dnsSuffix}", properties: k, headers: k }, type: d }] }] }, { error: "Invalid Configuration: Missing Region", type: c }] }; - exports2.ruleSet = _data; - } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/endpoint/endpointResolver.js -var require_endpointResolver = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/endpoint/endpointResolver.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.defaultEndpointResolver = void 0; - var util_endpoints_1 = require_dist_cjs16(); - var ruleset_1 = require_ruleset(); - var defaultEndpointResolver = (endpointParams, context = {}) => { - return (0, util_endpoints_1.resolveEndpoint)(ruleset_1.ruleSet, { - endpointParams, - logger: context.logger - }); - }; - exports2.defaultEndpointResolver = defaultEndpointResolver; - } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/runtimeConfig.shared.js -var require_runtimeConfig_shared = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/runtimeConfig.shared.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getRuntimeConfig = void 0; - var smithy_client_1 = require_dist_cjs34(); - var url_parser_1 = require_dist_cjs24(); - var util_base64_1 = require_dist_cjs30(); - var util_utf8_1 = require_dist_cjs10(); - var endpointResolver_1 = require_endpointResolver(); - var getRuntimeConfig = (config) => ({ - apiVersion: "2019-06-10", - base64Decoder: config?.base64Decoder ?? util_base64_1.fromBase64, - base64Encoder: config?.base64Encoder ?? util_base64_1.toBase64, - disableHostPrefix: config?.disableHostPrefix ?? false, - endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver, - extensions: config?.extensions ?? [], - logger: config?.logger ?? new smithy_client_1.NoOpLogger(), - serviceId: config?.serviceId ?? "SSO", - urlParser: config?.urlParser ?? url_parser_1.parseUrl, - utf8Decoder: config?.utf8Decoder ?? util_utf8_1.fromUtf8, - utf8Encoder: config?.utf8Encoder ?? util_utf8_1.toUtf8 - }); - exports2.getRuntimeConfig = getRuntimeConfig; - } -}); - -// ../../../node_modules/@smithy/util-defaults-mode-node/dist-cjs/index.js -var require_dist_cjs43 = __commonJS({ - "../../../node_modules/@smithy/util-defaults-mode-node/dist-cjs/index.js"(exports2, module2) { - var __create2 = Object.create; - var __defProp2 = Object.defineProperty; - var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; - var __getOwnPropNames2 = Object.getOwnPropertyNames; - var __getProtoOf2 = Object.getPrototypeOf; - var __hasOwnProp2 = Object.prototype.hasOwnProperty; - var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); - var __export2 = (target, all) => { - for (var name in all) - __defProp2(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps2 = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames2(from)) - if (!__hasOwnProp2.call(to, key) && key !== except) - __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + return tagname; + } + var attrsRegx = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); + function buildAttributesMap(attrStr, jPath, tagName) { + if (!this.options.ignoreAttributes && typeof attrStr === "string") { + const matches = util.getAllMatches(attrStr, attrsRegx); + const len = matches.length; + const attrs = {}; + for (let i = 0; i < len; i++) { + const attrName = this.resolveNameSpace(matches[i][1]); + let oldVal = matches[i][4]; + let aName = this.options.attributeNamePrefix + attrName; + if (attrName.length) { + if (this.options.transformAttributeName) { + aName = this.options.transformAttributeName(aName); + } + if (aName === "__proto__") aName = "#__proto__"; + if (oldVal !== void 0) { + if (this.options.trimValues) { + oldVal = oldVal.trim(); + } + oldVal = this.replaceEntitiesValue(oldVal); + const newVal = this.options.attributeValueProcessor(attrName, oldVal, jPath); + if (newVal === null || newVal === void 0) { + attrs[aName] = oldVal; + } else if (typeof newVal !== typeof oldVal || newVal !== oldVal) { + attrs[aName] = newVal; + } else { + attrs[aName] = parseValue( + oldVal, + this.options.parseAttributeValue, + this.options.numberParseOptions + ); + } + } else if (this.options.allowBooleanAttributes) { + attrs[aName] = true; + } + } + } + if (!Object.keys(attrs).length) { + return; + } + if (this.options.attributesGroupName) { + const attrCollection = {}; + attrCollection[this.options.attributesGroupName] = attrs; + return attrCollection; + } + return attrs; + } + } + var parseXml = function(xmlData) { + xmlData = xmlData.replace(/\r\n?/g, "\n"); + const xmlObj = new xmlNode("!xml"); + let currentNode = xmlObj; + let textData = ""; + let jPath = ""; + for (let i = 0; i < xmlData.length; i++) { + const ch = xmlData[i]; + if (ch === "<") { + if (xmlData[i + 1] === "/") { + const closeIndex = findClosingIndex(xmlData, ">", i, "Closing Tag is not closed."); + let tagName = xmlData.substring(i + 2, closeIndex).trim(); + if (this.options.removeNSPrefix) { + const colonIndex = tagName.indexOf(":"); + if (colonIndex !== -1) { + tagName = tagName.substr(colonIndex + 1); + } + } + if (this.options.transformTagName) { + tagName = this.options.transformTagName(tagName); + } + if (currentNode) { + textData = this.saveTextToParentTag(textData, currentNode, jPath); + } + const lastTagName = jPath.substring(jPath.lastIndexOf(".") + 1); + if (tagName && this.options.unpairedTags.indexOf(tagName) !== -1) { + throw new Error(`Unpaired tag can not be used as closing tag: `); + } + let propIndex = 0; + if (lastTagName && this.options.unpairedTags.indexOf(lastTagName) !== -1) { + propIndex = jPath.lastIndexOf(".", jPath.lastIndexOf(".") - 1); + this.tagsNodeStack.pop(); + } else { + propIndex = jPath.lastIndexOf("."); + } + jPath = jPath.substring(0, propIndex); + currentNode = this.tagsNodeStack.pop(); + textData = ""; + i = closeIndex; + } else if (xmlData[i + 1] === "?") { + let tagData = readTagExp(xmlData, i, false, "?>"); + if (!tagData) throw new Error("Pi Tag is not closed."); + textData = this.saveTextToParentTag(textData, currentNode, jPath); + if (this.options.ignoreDeclaration && tagData.tagName === "?xml" || this.options.ignorePiTags) { + } else { + const childNode = new xmlNode(tagData.tagName); + childNode.add(this.options.textNodeName, ""); + if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent) { + childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath, tagData.tagName); + } + this.addChild(currentNode, childNode, jPath); + } + i = tagData.closeIndex + 1; + } else if (xmlData.substr(i + 1, 3) === "!--") { + const endIndex = findClosingIndex(xmlData, "-->", i + 4, "Comment is not closed."); + if (this.options.commentPropName) { + const comment = xmlData.substring(i + 4, endIndex - 2); + textData = this.saveTextToParentTag(textData, currentNode, jPath); + currentNode.add(this.options.commentPropName, [{ [this.options.textNodeName]: comment }]); + } + i = endIndex; + } else if (xmlData.substr(i + 1, 2) === "!D") { + const result = readDocType(xmlData, i); + this.docTypeEntities = result.entities; + i = result.i; + } else if (xmlData.substr(i + 1, 2) === "![") { + const closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2; + const tagExp = xmlData.substring(i + 9, closeIndex); + textData = this.saveTextToParentTag(textData, currentNode, jPath); + let val2 = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true, true); + if (val2 == void 0) val2 = ""; + if (this.options.cdataPropName) { + currentNode.add(this.options.cdataPropName, [{ [this.options.textNodeName]: tagExp }]); + } else { + currentNode.add(this.options.textNodeName, val2); + } + i = closeIndex + 2; + } else { + let result = readTagExp(xmlData, i, this.options.removeNSPrefix); + let tagName = result.tagName; + const rawTagName = result.rawTagName; + let tagExp = result.tagExp; + let attrExpPresent = result.attrExpPresent; + let closeIndex = result.closeIndex; + if (this.options.transformTagName) { + tagName = this.options.transformTagName(tagName); + } + if (currentNode && textData) { + if (currentNode.tagname !== "!xml") { + textData = this.saveTextToParentTag(textData, currentNode, jPath, false); + } + } + const lastTag = currentNode; + if (lastTag && this.options.unpairedTags.indexOf(lastTag.tagname) !== -1) { + currentNode = this.tagsNodeStack.pop(); + jPath = jPath.substring(0, jPath.lastIndexOf(".")); + } + if (tagName !== xmlObj.tagname) { + jPath += jPath ? "." + tagName : tagName; + } + if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) { + let tagContent = ""; + if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) { + if (tagName[tagName.length - 1] === "/") { + tagName = tagName.substr(0, tagName.length - 1); + jPath = jPath.substr(0, jPath.length - 1); + tagExp = tagName; + } else { + tagExp = tagExp.substr(0, tagExp.length - 1); + } + i = result.closeIndex; + } else if (this.options.unpairedTags.indexOf(tagName) !== -1) { + i = result.closeIndex; + } else { + const result2 = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1); + if (!result2) throw new Error(`Unexpected end of ${rawTagName}`); + i = result2.i; + tagContent = result2.tagContent; + } + const childNode = new xmlNode(tagName); + if (tagName !== tagExp && attrExpPresent) { + childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName); + } + if (tagContent) { + tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true); + } + jPath = jPath.substr(0, jPath.lastIndexOf(".")); + childNode.add(this.options.textNodeName, tagContent); + this.addChild(currentNode, childNode, jPath); + } else { + if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) { + if (tagName[tagName.length - 1] === "/") { + tagName = tagName.substr(0, tagName.length - 1); + jPath = jPath.substr(0, jPath.length - 1); + tagExp = tagName; + } else { + tagExp = tagExp.substr(0, tagExp.length - 1); + } + if (this.options.transformTagName) { + tagName = this.options.transformTagName(tagName); + } + const childNode = new xmlNode(tagName); + if (tagName !== tagExp && attrExpPresent) { + childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName); + } + this.addChild(currentNode, childNode, jPath); + jPath = jPath.substr(0, jPath.lastIndexOf(".")); + } else { + const childNode = new xmlNode(tagName); + this.tagsNodeStack.push(currentNode); + if (tagName !== tagExp && attrExpPresent) { + childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName); + } + this.addChild(currentNode, childNode, jPath); + currentNode = childNode; + } + textData = ""; + i = closeIndex; + } + } + } else { + textData += xmlData[i]; + } } - return to; + return xmlObj.child; }; - var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2( - // If the importer is in node compatibility mode or this is not an ESM - // file that has been converted to a CommonJS file using a Babel- - // compatible transform (i.e. "__esModule" has not been set), then set - // "default" to the CommonJS "module.exports" for node compatibility. - isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, - mod - )); - var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); - var src_exports = {}; - __export2(src_exports, { - resolveDefaultsModeConfig: () => resolveDefaultsModeConfig - }); - module2.exports = __toCommonJS2(src_exports); - var import_config_resolver = require_dist_cjs19(); - var import_node_config_provider = require_dist_cjs22(); - var import_property_provider = require_dist_cjs6(); - var AWS_EXECUTION_ENV = "AWS_EXECUTION_ENV"; - var AWS_REGION_ENV = "AWS_REGION"; - var AWS_DEFAULT_REGION_ENV = "AWS_DEFAULT_REGION"; - var ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED"; - var DEFAULTS_MODE_OPTIONS = ["in-region", "cross-region", "mobile", "standard", "legacy"]; - var IMDS_REGION_PATH = "/latest/meta-data/placement/region"; - var AWS_DEFAULTS_MODE_ENV = "AWS_DEFAULTS_MODE"; - var AWS_DEFAULTS_MODE_CONFIG = "defaults_mode"; - var NODE_DEFAULTS_MODE_CONFIG_OPTIONS = { - environmentVariableSelector: (env) => { - return env[AWS_DEFAULTS_MODE_ENV]; - }, - configFileSelector: (profile) => { - return profile[AWS_DEFAULTS_MODE_CONFIG]; - }, - default: "legacy" + function addChild(currentNode, childNode, jPath) { + const result = this.options.updateTag(childNode.tagname, jPath, childNode[":@"]); + if (result === false) { + } else if (typeof result === "string") { + childNode.tagname = result; + currentNode.addChild(childNode); + } else { + currentNode.addChild(childNode); + } + } + var replaceEntitiesValue = function(val2) { + if (this.options.processEntities) { + for (let entityName2 in this.docTypeEntities) { + const entity = this.docTypeEntities[entityName2]; + val2 = val2.replace(entity.regx, entity.val); + } + for (let entityName2 in this.lastEntities) { + const entity = this.lastEntities[entityName2]; + val2 = val2.replace(entity.regex, entity.val); + } + if (this.options.htmlEntities) { + for (let entityName2 in this.htmlEntities) { + const entity = this.htmlEntities[entityName2]; + val2 = val2.replace(entity.regex, entity.val); + } + } + val2 = val2.replace(this.ampEntity.regex, this.ampEntity.val); + } + return val2; }; - var resolveDefaultsModeConfig = /* @__PURE__ */ __name(({ - region = (0, import_node_config_provider.loadConfig)(import_config_resolver.NODE_REGION_CONFIG_OPTIONS), - defaultsMode = (0, import_node_config_provider.loadConfig)(NODE_DEFAULTS_MODE_CONFIG_OPTIONS) - } = {}) => (0, import_property_provider.memoize)(async () => { - const mode = typeof defaultsMode === "function" ? await defaultsMode() : defaultsMode; - switch (mode == null ? void 0 : mode.toLowerCase()) { - case "auto": - return resolveNodeDefaultsModeAuto(region); - case "in-region": - case "cross-region": - case "mobile": - case "standard": - case "legacy": - return Promise.resolve(mode == null ? void 0 : mode.toLocaleLowerCase()); - case void 0: - return Promise.resolve("legacy"); - default: - throw new Error( - `Invalid parameter for "defaultsMode", expect ${DEFAULTS_MODE_OPTIONS.join(", ")}, got ${mode}` - ); + function saveTextToParentTag(textData, currentNode, jPath, isLeafNode) { + if (textData) { + if (isLeafNode === void 0) isLeafNode = Object.keys(currentNode.child).length === 0; + textData = this.parseTextData( + textData, + currentNode.tagname, + jPath, + false, + currentNode[":@"] ? Object.keys(currentNode[":@"]).length !== 0 : false, + isLeafNode + ); + if (textData !== void 0 && textData !== "") + currentNode.add(this.options.textNodeName, textData); + textData = ""; } - }), "resolveDefaultsModeConfig"); - var resolveNodeDefaultsModeAuto = /* @__PURE__ */ __name(async (clientRegion) => { - if (clientRegion) { - const resolvedRegion = typeof clientRegion === "function" ? await clientRegion() : clientRegion; - const inferredRegion = await inferPhysicalRegion(); - if (!inferredRegion) { - return "standard"; + return textData; + } + function isItStopNode(stopNodes, jPath, currentTagName) { + const allNodesExp = "*." + currentTagName; + for (const stopNodePath in stopNodes) { + const stopNodeExp = stopNodes[stopNodePath]; + if (allNodesExp === stopNodeExp || jPath === stopNodeExp) return true; + } + return false; + } + function tagExpWithClosingIndex(xmlData, i, closingChar = ">") { + let attrBoundary; + let tagExp = ""; + for (let index = i; index < xmlData.length; index++) { + let ch = xmlData[index]; + if (attrBoundary) { + if (ch === attrBoundary) attrBoundary = ""; + } else if (ch === '"' || ch === "'") { + attrBoundary = ch; + } else if (ch === closingChar[0]) { + if (closingChar[1]) { + if (xmlData[index + 1] === closingChar[1]) { + return { + data: tagExp, + index + }; + } + } else { + return { + data: tagExp, + index + }; + } + } else if (ch === " ") { + ch = " "; } - if (resolvedRegion === inferredRegion) { - return "in-region"; - } else { - return "cross-region"; + tagExp += ch; + } + } + function findClosingIndex(xmlData, str, i, errMsg) { + const closingIndex = xmlData.indexOf(str, i); + if (closingIndex === -1) { + throw new Error(errMsg); + } else { + return closingIndex + str.length - 1; + } + } + function readTagExp(xmlData, i, removeNSPrefix, closingChar = ">") { + const result = tagExpWithClosingIndex(xmlData, i + 1, closingChar); + if (!result) return; + let tagExp = result.data; + const closeIndex = result.index; + const separatorIndex = tagExp.search(/\s/); + let tagName = tagExp; + let attrExpPresent = true; + if (separatorIndex !== -1) { + tagName = tagExp.substring(0, separatorIndex); + tagExp = tagExp.substring(separatorIndex + 1).trimStart(); + } + const rawTagName = tagName; + if (removeNSPrefix) { + const colonIndex = tagName.indexOf(":"); + if (colonIndex !== -1) { + tagName = tagName.substr(colonIndex + 1); + attrExpPresent = tagName !== result.data.substr(colonIndex + 1); } } - return "standard"; - }, "resolveNodeDefaultsModeAuto"); - var inferPhysicalRegion = /* @__PURE__ */ __name(async () => { - if (process.env[AWS_EXECUTION_ENV] && (process.env[AWS_REGION_ENV] || process.env[AWS_DEFAULT_REGION_ENV])) { - return process.env[AWS_REGION_ENV] ?? process.env[AWS_DEFAULT_REGION_ENV]; + return { + tagName, + tagExp, + closeIndex, + attrExpPresent, + rawTagName + }; + } + function readStopNodeData(xmlData, tagName, i) { + const startIndex = i; + let openTagCount = 1; + for (; i < xmlData.length; i++) { + if (xmlData[i] === "<") { + if (xmlData[i + 1] === "/") { + const closeIndex = findClosingIndex(xmlData, ">", i, `${tagName} is not closed`); + let closeTagName = xmlData.substring(i + 2, closeIndex).trim(); + if (closeTagName === tagName) { + openTagCount--; + if (openTagCount === 0) { + return { + tagContent: xmlData.substring(startIndex, i), + i: closeIndex + }; + } + } + i = closeIndex; + } else if (xmlData[i + 1] === "?") { + const closeIndex = findClosingIndex(xmlData, "?>", i + 1, "StopNode is not closed."); + i = closeIndex; + } else if (xmlData.substr(i + 1, 3) === "!--") { + const closeIndex = findClosingIndex(xmlData, "-->", i + 3, "StopNode is not closed."); + i = closeIndex; + } else if (xmlData.substr(i + 1, 2) === "![") { + const closeIndex = findClosingIndex(xmlData, "]]>", i, "StopNode is not closed.") - 2; + i = closeIndex; + } else { + const tagData = readTagExp(xmlData, i, ">"); + if (tagData) { + const openTagName = tagData && tagData.tagName; + if (openTagName === tagName && tagData.tagExp[tagData.tagExp.length - 1] !== "/") { + openTagCount++; + } + i = tagData.closeIndex; + } + } + } } - if (!process.env[ENV_IMDS_DISABLED]) { - try { - const { getInstanceMetadataEndpoint, httpRequest } = await Promise.resolve().then(() => __toESM2(require_dist_cjs38())); - const endpoint = await getInstanceMetadataEndpoint(); - return (await httpRequest({ ...endpoint, path: IMDS_REGION_PATH })).toString(); - } catch (e) { + } + function parseValue(val2, shouldParse, options) { + if (shouldParse && typeof val2 === "string") { + const newval = val2.trim(); + if (newval === "true") return true; + else if (newval === "false") return false; + else return toNumber(val2, options); + } else { + if (util.isExist(val2)) { + return val2; + } else { + return ""; } } - }, "inferPhysicalRegion"); - } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/runtimeConfig.js -var require_runtimeConfig = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/runtimeConfig.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getRuntimeConfig = void 0; - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - var package_json_1 = tslib_1.__importDefault(require_package3()); - var util_user_agent_node_1 = require_dist_cjs40(); - var config_resolver_1 = require_dist_cjs19(); - var hash_node_1 = require_dist_cjs41(); - var middleware_retry_1 = require_dist_cjs35(); - var node_config_provider_1 = require_dist_cjs22(); - var node_http_handler_1 = require_dist_cjs32(); - var util_body_length_node_1 = require_dist_cjs42(); - var util_retry_1 = require_dist_cjs28(); - var runtimeConfig_shared_1 = require_runtimeConfig_shared(); - var smithy_client_1 = require_dist_cjs34(); - var util_defaults_mode_node_1 = require_dist_cjs43(); - var smithy_client_2 = require_dist_cjs34(); - var getRuntimeConfig = (config) => { - (0, smithy_client_2.emitWarningIfUnsupportedVersion)(process.version); - const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config); - const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode); - const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config); - return { - ...clientSharedValues, - ...config, - runtime: "node", - defaultsMode, - bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength, - defaultUserAgentProvider: config?.defaultUserAgentProvider ?? (0, util_user_agent_node_1.defaultUserAgent)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }), - maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: config?.region ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_REGION_CONFIG_OPTIONS, config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: config?.requestHandler ?? new node_http_handler_1.NodeHttpHandler(defaultConfigProvider), - retryMode: config?.retryMode ?? (0, node_config_provider_1.loadConfig)({ - ...middleware_retry_1.NODE_RETRY_MODE_CONFIG_OPTIONS, - default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE - }), - sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, "sha256"), - streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector, - useDualstackEndpoint: config?.useDualstackEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), - useFipsEndpoint: config?.useFipsEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS) - }; - }; - exports2.getRuntimeConfig = getRuntimeConfig; + } + module2.exports = OrderedObjParser; } }); -// ../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/extensions/index.js -var require_extensions2 = __commonJS({ - "../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/extensions/index.js"(exports2) { +// ../../../node_modules/fast-xml-parser/src/xmlparser/node2json.js +var require_node2json = __commonJS({ + "../../../node_modules/fast-xml-parser/src/xmlparser/node2json.js"(exports2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveAwsRegionExtensionConfiguration = exports2.getAwsRegionExtensionConfiguration = void 0; - var getAwsRegionExtensionConfiguration = (runtimeConfig) => { - let runtimeConfigRegion = async () => { - if (runtimeConfig.region === void 0) { - throw new Error("Region is missing from runtimeConfig"); - } - const region = runtimeConfig.region; - if (typeof region === "string") { - return region; - } - return region(); - }; - return { - setRegion(region) { - runtimeConfigRegion = region; - }, - region() { - return runtimeConfigRegion; + function prettify(node, options) { + return compress(node, options); + } + function compress(arr, options, jPath) { + let text; + const compressedObj = {}; + for (let i = 0; i < arr.length; i++) { + const tagObj = arr[i]; + const property = propName(tagObj); + let newJpath = ""; + if (jPath === void 0) newJpath = property; + else newJpath = jPath + "." + property; + if (property === options.textNodeName) { + if (text === void 0) text = tagObj[property]; + else text += "" + tagObj[property]; + } else if (property === void 0) { + continue; + } else if (tagObj[property]) { + let val2 = compress(tagObj[property], options, newJpath); + const isLeaf = isLeafTag(val2, options); + if (tagObj[":@"]) { + assignAttributes(val2, tagObj[":@"], newJpath, options); + } else if (Object.keys(val2).length === 1 && val2[options.textNodeName] !== void 0 && !options.alwaysCreateTextNode) { + val2 = val2[options.textNodeName]; + } else if (Object.keys(val2).length === 0) { + if (options.alwaysCreateTextNode) val2[options.textNodeName] = ""; + else val2 = ""; + } + if (compressedObj[property] !== void 0 && compressedObj.hasOwnProperty(property)) { + if (!Array.isArray(compressedObj[property])) { + compressedObj[property] = [compressedObj[property]]; + } + compressedObj[property].push(val2); + } else { + if (options.isArray(property, newJpath, isLeaf)) { + compressedObj[property] = [val2]; + } else { + compressedObj[property] = val2; + } + } } - }; - }; - exports2.getAwsRegionExtensionConfiguration = getAwsRegionExtensionConfiguration; - var resolveAwsRegionExtensionConfiguration = (awsRegionExtensionConfiguration) => { - return { - region: awsRegionExtensionConfiguration.region() - }; - }; - exports2.resolveAwsRegionExtensionConfiguration = resolveAwsRegionExtensionConfiguration; - } -}); - -// ../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/regionConfig/config.js -var require_config = __commonJS({ - "../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/regionConfig/config.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.NODE_REGION_CONFIG_FILE_OPTIONS = exports2.NODE_REGION_CONFIG_OPTIONS = exports2.REGION_INI_NAME = exports2.REGION_ENV_NAME = void 0; - exports2.REGION_ENV_NAME = "AWS_REGION"; - exports2.REGION_INI_NAME = "region"; - exports2.NODE_REGION_CONFIG_OPTIONS = { - environmentVariableSelector: (env) => env[exports2.REGION_ENV_NAME], - configFileSelector: (profile) => profile[exports2.REGION_INI_NAME], - default: () => { - throw new Error("Region is missing"); } - }; - exports2.NODE_REGION_CONFIG_FILE_OPTIONS = { - preferredFile: "credentials" - }; - } -}); - -// ../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/regionConfig/isFipsRegion.js -var require_isFipsRegion = __commonJS({ - "../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/regionConfig/isFipsRegion.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isFipsRegion = void 0; - var isFipsRegion = (region) => typeof region === "string" && (region.startsWith("fips-") || region.endsWith("-fips")); - exports2.isFipsRegion = isFipsRegion; - } -}); - -// ../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/regionConfig/getRealRegion.js -var require_getRealRegion = __commonJS({ - "../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/regionConfig/getRealRegion.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getRealRegion = void 0; - var isFipsRegion_1 = require_isFipsRegion(); - var getRealRegion = (region) => (0, isFipsRegion_1.isFipsRegion)(region) ? ["fips-aws-global", "aws-fips"].includes(region) ? "us-east-1" : region.replace(/fips-(dkr-|prod-)?|-fips/, "") : region; - exports2.getRealRegion = getRealRegion; - } -}); - -// ../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/regionConfig/resolveRegionConfig.js -var require_resolveRegionConfig = __commonJS({ - "../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/regionConfig/resolveRegionConfig.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveRegionConfig = void 0; - var getRealRegion_1 = require_getRealRegion(); - var isFipsRegion_1 = require_isFipsRegion(); - var resolveRegionConfig = (input) => { - const { region, useFipsEndpoint } = input; - if (!region) { - throw new Error("Region is missing"); + if (typeof text === "string") { + if (text.length > 0) compressedObj[options.textNodeName] = text; + } else if (text !== void 0) compressedObj[options.textNodeName] = text; + return compressedObj; + } + function propName(obj) { + const keys = Object.keys(obj); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + if (key !== ":@") return key; } - return { - ...input, - region: async () => { - if (typeof region === "string") { - return (0, getRealRegion_1.getRealRegion)(region); - } - const providedRegion = await region(); - return (0, getRealRegion_1.getRealRegion)(providedRegion); - }, - useFipsEndpoint: async () => { - const providedRegion = typeof region === "string" ? region : await region(); - if ((0, isFipsRegion_1.isFipsRegion)(providedRegion)) { - return true; + } + function assignAttributes(obj, attrMap, jpath, options) { + if (attrMap) { + const keys = Object.keys(attrMap); + const len = keys.length; + for (let i = 0; i < len; i++) { + const atrrName = keys[i]; + if (options.isArray(atrrName, jpath + "." + atrrName, true, true)) { + obj[atrrName] = [attrMap[atrrName]]; + } else { + obj[atrrName] = attrMap[atrrName]; } - return typeof useFipsEndpoint !== "function" ? Promise.resolve(!!useFipsEndpoint) : useFipsEndpoint(); } - }; - }; - exports2.resolveRegionConfig = resolveRegionConfig; - } -}); - -// ../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/regionConfig/index.js -var require_regionConfig = __commonJS({ - "../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/regionConfig/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_config(), exports2); - tslib_1.__exportStar(require_resolveRegionConfig(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/index.js -var require_dist_cjs44 = __commonJS({ - "../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_extensions2(), exports2); - tslib_1.__exportStar(require_regionConfig(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/runtimeExtensions.js -var require_runtimeExtensions = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/runtimeExtensions.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveRuntimeExtensions = void 0; - var region_config_resolver_1 = require_dist_cjs44(); - var protocol_http_1 = require_dist_cjs2(); - var smithy_client_1 = require_dist_cjs34(); - var asPartial = (t) => t; - var resolveRuntimeExtensions = (runtimeConfig, extensions) => { - const extensionConfiguration = { - ...asPartial((0, region_config_resolver_1.getAwsRegionExtensionConfiguration)(runtimeConfig)), - ...asPartial((0, smithy_client_1.getDefaultExtensionConfiguration)(runtimeConfig)), - ...asPartial((0, protocol_http_1.getHttpHandlerExtensionConfiguration)(runtimeConfig)) - }; - extensions.forEach((extension) => extension.configure(extensionConfiguration)); - return { - ...runtimeConfig, - ...(0, region_config_resolver_1.resolveAwsRegionExtensionConfiguration)(extensionConfiguration), - ...(0, smithy_client_1.resolveDefaultRuntimeConfig)(extensionConfiguration), - ...(0, protocol_http_1.resolveHttpHandlerRuntimeConfig)(extensionConfiguration) - }; - }; - exports2.resolveRuntimeExtensions = resolveRuntimeExtensions; - } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/SSOClient.js -var require_SSOClient = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/SSOClient.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SSOClient = exports2.__Client = void 0; - var middleware_host_header_1 = require_dist_cjs3(); - var middleware_logger_1 = require_dist_cjs4(); - var middleware_recursion_detection_1 = require_dist_cjs5(); - var middleware_user_agent_1 = require_dist_cjs17(); - var config_resolver_1 = require_dist_cjs19(); - var middleware_content_length_1 = require_dist_cjs20(); - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_retry_1 = require_dist_cjs35(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "__Client", { enumerable: true, get: function() { - return smithy_client_1.Client; - } }); - var EndpointParameters_1 = require_EndpointParameters3(); - var runtimeConfig_1 = require_runtimeConfig(); - var runtimeExtensions_1 = require_runtimeExtensions(); - var SSOClient = class extends smithy_client_1.Client { - constructor(...[configuration]) { - const _config_0 = (0, runtimeConfig_1.getRuntimeConfig)(configuration || {}); - const _config_1 = (0, EndpointParameters_1.resolveClientEndpointParameters)(_config_0); - const _config_2 = (0, config_resolver_1.resolveRegionConfig)(_config_1); - const _config_3 = (0, middleware_endpoint_1.resolveEndpointConfig)(_config_2); - const _config_4 = (0, middleware_retry_1.resolveRetryConfig)(_config_3); - const _config_5 = (0, middleware_host_header_1.resolveHostHeaderConfig)(_config_4); - const _config_6 = (0, middleware_user_agent_1.resolveUserAgentConfig)(_config_5); - const _config_7 = (0, runtimeExtensions_1.resolveRuntimeExtensions)(_config_6, configuration?.extensions || []); - super(_config_7); - this.config = _config_7; - this.middlewareStack.use((0, middleware_retry_1.getRetryPlugin)(this.config)); - this.middlewareStack.use((0, middleware_content_length_1.getContentLengthPlugin)(this.config)); - this.middlewareStack.use((0, middleware_host_header_1.getHostHeaderPlugin)(this.config)); - this.middlewareStack.use((0, middleware_logger_1.getLoggerPlugin)(this.config)); - this.middlewareStack.use((0, middleware_recursion_detection_1.getRecursionDetectionPlugin)(this.config)); - this.middlewareStack.use((0, middleware_user_agent_1.getUserAgentPlugin)(this.config)); } - destroy() { - super.destroy(); + } + function isLeafTag(obj, options) { + const { textNodeName } = options; + const propCount = Object.keys(obj).length; + if (propCount === 0) { + return true; } - }; - exports2.SSOClient = SSOClient; + if (propCount === 1 && (obj[textNodeName] || typeof obj[textNodeName] === "boolean" || obj[textNodeName] === 0)) { + return true; + } + return false; + } + exports2.prettify = prettify; } }); -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/models/SSOServiceException.js -var require_SSOServiceException = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/models/SSOServiceException.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SSOServiceException = exports2.__ServiceException = void 0; - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "__ServiceException", { enumerable: true, get: function() { - return smithy_client_1.ServiceException; - } }); - var SSOServiceException = class _SSOServiceException extends smithy_client_1.ServiceException { +// ../../../node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +var require_XMLParser = __commonJS({ + "../../../node_modules/fast-xml-parser/src/xmlparser/XMLParser.js"(exports2, module2) { + var { buildOptions } = require_OptionsBuilder(); + var OrderedObjParser = require_OrderedObjParser(); + var { prettify } = require_node2json(); + var validator = require_validator(); + var XMLParser2 = class { constructor(options) { - super(options); - Object.setPrototypeOf(this, _SSOServiceException.prototype); + this.externalEntities = {}; + this.options = buildOptions(options); + } + /** + * Parse XML dats to JS object + * @param {string|Buffer} xmlData + * @param {boolean|Object} validationOption + */ + parse(xmlData, validationOption) { + if (typeof xmlData === "string") { + } else if (xmlData.toString) { + xmlData = xmlData.toString(); + } else { + throw new Error("XML data is accepted in String or Bytes[] form."); + } + if (validationOption) { + if (validationOption === true) validationOption = {}; + const result = validator.validate(xmlData, validationOption); + if (result !== true) { + throw Error(`${result.err.msg}:${result.err.line}:${result.err.col}`); + } + } + const orderedObjParser = new OrderedObjParser(this.options); + orderedObjParser.addExternalEntities(this.externalEntities); + const orderedResult = orderedObjParser.parseXml(xmlData); + if (this.options.preserveOrder || orderedResult === void 0) return orderedResult; + else return prettify(orderedResult, this.options); + } + /** + * Add Entity which is not by default supported by this library + * @param {string} key + * @param {string} value + */ + addEntity(key, value) { + if (value.indexOf("&") !== -1) { + throw new Error("Entity value can't have '&'"); + } else if (key.indexOf("&") !== -1 || key.indexOf(";") !== -1) { + throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for ' '"); + } else if (value === "&") { + throw new Error("An entity with value '&' is not permitted"); + } else { + this.externalEntities[key] = value; + } } }; - exports2.SSOServiceException = SSOServiceException; + module2.exports = XMLParser2; } }); -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/models/models_0.js -var require_models_02 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/models/models_0.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.LogoutRequestFilterSensitiveLog = exports2.ListAccountsRequestFilterSensitiveLog = exports2.ListAccountRolesRequestFilterSensitiveLog = exports2.GetRoleCredentialsResponseFilterSensitiveLog = exports2.RoleCredentialsFilterSensitiveLog = exports2.GetRoleCredentialsRequestFilterSensitiveLog = exports2.UnauthorizedException = exports2.TooManyRequestsException = exports2.ResourceNotFoundException = exports2.InvalidRequestException = void 0; - var smithy_client_1 = require_dist_cjs34(); - var SSOServiceException_1 = require_SSOServiceException(); - var InvalidRequestException = class _InvalidRequestException extends SSOServiceException_1.SSOServiceException { - constructor(opts) { - super({ - name: "InvalidRequestException", - $fault: "client", - ...opts - }); - this.name = "InvalidRequestException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidRequestException.prototype); +// ../../../node_modules/fast-xml-parser/src/xmlbuilder/orderedJs2Xml.js +var require_orderedJs2Xml = __commonJS({ + "../../../node_modules/fast-xml-parser/src/xmlbuilder/orderedJs2Xml.js"(exports2, module2) { + var EOL = "\n"; + function toXml(jArray, options) { + let indentation = ""; + if (options.format && options.indentBy.length > 0) { + indentation = EOL; } - }; - exports2.InvalidRequestException = InvalidRequestException; - var ResourceNotFoundException = class _ResourceNotFoundException extends SSOServiceException_1.SSOServiceException { - constructor(opts) { - super({ - name: "ResourceNotFoundException", - $fault: "client", - ...opts - }); - this.name = "ResourceNotFoundException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _ResourceNotFoundException.prototype); + return arrToStr(jArray, options, "", indentation); + } + function arrToStr(arr, options, jPath, indentation) { + let xmlStr = ""; + let isPreviousElementTag = false; + for (let i = 0; i < arr.length; i++) { + const tagObj = arr[i]; + const tagName = propName(tagObj); + if (tagName === void 0) continue; + let newJPath = ""; + if (jPath.length === 0) newJPath = tagName; + else newJPath = `${jPath}.${tagName}`; + if (tagName === options.textNodeName) { + let tagText = tagObj[tagName]; + if (!isStopNode(newJPath, options)) { + tagText = options.tagValueProcessor(tagName, tagText); + tagText = replaceEntitiesValue(tagText, options); + } + if (isPreviousElementTag) { + xmlStr += indentation; + } + xmlStr += tagText; + isPreviousElementTag = false; + continue; + } else if (tagName === options.cdataPropName) { + if (isPreviousElementTag) { + xmlStr += indentation; + } + xmlStr += ``; + isPreviousElementTag = false; + continue; + } else if (tagName === options.commentPropName) { + xmlStr += indentation + ``; + isPreviousElementTag = true; + continue; + } else if (tagName[0] === "?") { + const attStr2 = attr_to_str(tagObj[":@"], options); + const tempInd = tagName === "?xml" ? "" : indentation; + let piTextNodeName = tagObj[tagName][0][options.textNodeName]; + piTextNodeName = piTextNodeName.length !== 0 ? " " + piTextNodeName : ""; + xmlStr += tempInd + `<${tagName}${piTextNodeName}${attStr2}?>`; + isPreviousElementTag = true; + continue; + } + let newIdentation = indentation; + if (newIdentation !== "") { + newIdentation += options.indentBy; + } + const attStr = attr_to_str(tagObj[":@"], options); + const tagStart = indentation + `<${tagName}${attStr}`; + const tagValue = arrToStr(tagObj[tagName], options, newJPath, newIdentation); + if (options.unpairedTags.indexOf(tagName) !== -1) { + if (options.suppressUnpairedNode) xmlStr += tagStart + ">"; + else xmlStr += tagStart + "/>"; + } else if ((!tagValue || tagValue.length === 0) && options.suppressEmptyNode) { + xmlStr += tagStart + "/>"; + } else if (tagValue && tagValue.endsWith(">")) { + xmlStr += tagStart + `>${tagValue}${indentation}`; + } else { + xmlStr += tagStart + ">"; + if (tagValue && indentation !== "" && (tagValue.includes("/>") || tagValue.includes("`; + } + isPreviousElementTag = true; } - }; - exports2.ResourceNotFoundException = ResourceNotFoundException; - var TooManyRequestsException = class _TooManyRequestsException extends SSOServiceException_1.SSOServiceException { - constructor(opts) { - super({ - name: "TooManyRequestsException", - $fault: "client", - ...opts - }); - this.name = "TooManyRequestsException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _TooManyRequestsException.prototype); + return xmlStr; + } + function propName(obj) { + const keys = Object.keys(obj); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + if (!obj.hasOwnProperty(key)) continue; + if (key !== ":@") return key; } - }; - exports2.TooManyRequestsException = TooManyRequestsException; - var UnauthorizedException = class _UnauthorizedException extends SSOServiceException_1.SSOServiceException { - constructor(opts) { - super({ - name: "UnauthorizedException", - $fault: "client", - ...opts - }); - this.name = "UnauthorizedException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _UnauthorizedException.prototype); + } + function attr_to_str(attrMap, options) { + let attrStr = ""; + if (attrMap && !options.ignoreAttributes) { + for (let attr in attrMap) { + if (!attrMap.hasOwnProperty(attr)) continue; + let attrVal = options.attributeValueProcessor(attr, attrMap[attr]); + attrVal = replaceEntitiesValue(attrVal, options); + if (attrVal === true && options.suppressBooleanAttributes) { + attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}`; + } else { + attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}="${attrVal}"`; + } + } } - }; - exports2.UnauthorizedException = UnauthorizedException; - var GetRoleCredentialsRequestFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.accessToken && { accessToken: smithy_client_1.SENSITIVE_STRING } - }); - exports2.GetRoleCredentialsRequestFilterSensitiveLog = GetRoleCredentialsRequestFilterSensitiveLog; - var RoleCredentialsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.secretAccessKey && { secretAccessKey: smithy_client_1.SENSITIVE_STRING }, - ...obj.sessionToken && { sessionToken: smithy_client_1.SENSITIVE_STRING } - }); - exports2.RoleCredentialsFilterSensitiveLog = RoleCredentialsFilterSensitiveLog; - var GetRoleCredentialsResponseFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.roleCredentials && { roleCredentials: (0, exports2.RoleCredentialsFilterSensitiveLog)(obj.roleCredentials) } - }); - exports2.GetRoleCredentialsResponseFilterSensitiveLog = GetRoleCredentialsResponseFilterSensitiveLog; - var ListAccountRolesRequestFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.accessToken && { accessToken: smithy_client_1.SENSITIVE_STRING } - }); - exports2.ListAccountRolesRequestFilterSensitiveLog = ListAccountRolesRequestFilterSensitiveLog; - var ListAccountsRequestFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.accessToken && { accessToken: smithy_client_1.SENSITIVE_STRING } - }); - exports2.ListAccountsRequestFilterSensitiveLog = ListAccountsRequestFilterSensitiveLog; - var LogoutRequestFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.accessToken && { accessToken: smithy_client_1.SENSITIVE_STRING } - }); - exports2.LogoutRequestFilterSensitiveLog = LogoutRequestFilterSensitiveLog; - } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/protocols/Aws_restJson1.js -var require_Aws_restJson1 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/protocols/Aws_restJson1.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.de_LogoutCommand = exports2.de_ListAccountsCommand = exports2.de_ListAccountRolesCommand = exports2.de_GetRoleCredentialsCommand = exports2.se_LogoutCommand = exports2.se_ListAccountsCommand = exports2.se_ListAccountRolesCommand = exports2.se_GetRoleCredentialsCommand = void 0; - var protocol_http_1 = require_dist_cjs2(); - var smithy_client_1 = require_dist_cjs34(); - var models_0_1 = require_models_02(); - var SSOServiceException_1 = require_SSOServiceException(); - var se_GetRoleCredentialsCommand = async (input, context) => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, { - "x-amz-sso_bearer_token": input.accessToken - }); - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}/federation/credentials`; - const query = (0, smithy_client_1.map)({ - role_name: [, (0, smithy_client_1.expectNonNull)(input.roleName, `roleName`)], - account_id: [, (0, smithy_client_1.expectNonNull)(input.accountId, `accountId`)] - }); - let body; - return new protocol_http_1.HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - query, - body - }); - }; - exports2.se_GetRoleCredentialsCommand = se_GetRoleCredentialsCommand; - var se_ListAccountRolesCommand = async (input, context) => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, { - "x-amz-sso_bearer_token": input.accessToken - }); - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}/assignment/roles`; - const query = (0, smithy_client_1.map)({ - next_token: [, input.nextToken], - max_result: [() => input.maxResults !== void 0, () => input.maxResults.toString()], - account_id: [, (0, smithy_client_1.expectNonNull)(input.accountId, `accountId`)] - }); - let body; - return new protocol_http_1.HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - query, - body - }); - }; - exports2.se_ListAccountRolesCommand = se_ListAccountRolesCommand; - var se_ListAccountsCommand = async (input, context) => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, { - "x-amz-sso_bearer_token": input.accessToken - }); - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}/assignment/accounts`; - const query = (0, smithy_client_1.map)({ - next_token: [, input.nextToken], - max_result: [() => input.maxResults !== void 0, () => input.maxResults.toString()] - }); - let body; - return new protocol_http_1.HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - query, - body - }); - }; - exports2.se_ListAccountsCommand = se_ListAccountsCommand; - var se_LogoutCommand = async (input, context) => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, { - "x-amz-sso_bearer_token": input.accessToken - }); - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}/logout`; - let body; - return new protocol_http_1.HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body - }); - }; - exports2.se_LogoutCommand = se_LogoutCommand; - var de_GetRoleCredentialsCommand = async (output, context) => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return de_GetRoleCredentialsCommandError(output, context); + return attrStr; + } + function isStopNode(jPath, options) { + jPath = jPath.substr(0, jPath.length - options.textNodeName.length - 1); + let tagName = jPath.substr(jPath.lastIndexOf(".") + 1); + for (let index in options.stopNodes) { + if (options.stopNodes[index] === jPath || options.stopNodes[index] === "*." + tagName) return true; } - const contents = (0, smithy_client_1.map)({ - $metadata: deserializeMetadata(output) - }); - const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body"); - const doc = (0, smithy_client_1.take)(data, { - roleCredentials: smithy_client_1._json - }); - Object.assign(contents, doc); - return contents; - }; - exports2.de_GetRoleCredentialsCommand = de_GetRoleCredentialsCommand; - var de_GetRoleCredentialsCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidRequestException": - case "com.amazonaws.sso#InvalidRequestException": - throw await de_InvalidRequestExceptionRes(parsedOutput, context); - case "ResourceNotFoundException": - case "com.amazonaws.sso#ResourceNotFoundException": - throw await de_ResourceNotFoundExceptionRes(parsedOutput, context); - case "TooManyRequestsException": - case "com.amazonaws.sso#TooManyRequestsException": - throw await de_TooManyRequestsExceptionRes(parsedOutput, context); - case "UnauthorizedException": - case "com.amazonaws.sso#UnauthorizedException": - throw await de_UnauthorizedExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + return false; + } + function replaceEntitiesValue(textValue, options) { + if (textValue && textValue.length > 0 && options.processEntities) { + for (let i = 0; i < options.entities.length; i++) { + const entity = options.entities[i]; + textValue = textValue.replace(entity.regex, entity.val); + } } + return textValue; + } + module2.exports = toXml; + } +}); + +// ../../../node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js +var require_json2xml = __commonJS({ + "../../../node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js"(exports2, module2) { + "use strict"; + var buildFromOrderedJs = require_orderedJs2Xml(); + var defaultOptions = { + attributeNamePrefix: "@_", + attributesGroupName: false, + textNodeName: "#text", + ignoreAttributes: true, + cdataPropName: false, + format: false, + indentBy: " ", + suppressEmptyNode: false, + suppressUnpairedNode: true, + suppressBooleanAttributes: true, + tagValueProcessor: function(key, a) { + return a; + }, + attributeValueProcessor: function(attrName, a) { + return a; + }, + preserveOrder: false, + commentPropName: false, + unpairedTags: [], + entities: [ + { regex: new RegExp("&", "g"), val: "&" }, + //it must be on top + { regex: new RegExp(">", "g"), val: ">" }, + { regex: new RegExp("<", "g"), val: "<" }, + { regex: new RegExp("'", "g"), val: "'" }, + { regex: new RegExp('"', "g"), val: """ } + ], + processEntities: true, + stopNodes: [], + // transformTagName: false, + // transformAttributeName: false, + oneListGroup: false }; - var de_ListAccountRolesCommand = async (output, context) => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return de_ListAccountRolesCommandError(output, context); + function Builder(options) { + this.options = Object.assign({}, defaultOptions, options); + if (this.options.ignoreAttributes || this.options.attributesGroupName) { + this.isAttribute = function() { + return false; + }; + } else { + this.attrPrefixLen = this.options.attributeNamePrefix.length; + this.isAttribute = isAttribute; } - const contents = (0, smithy_client_1.map)({ - $metadata: deserializeMetadata(output) - }); - const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body"); - const doc = (0, smithy_client_1.take)(data, { - nextToken: smithy_client_1.expectString, - roleList: smithy_client_1._json - }); - Object.assign(contents, doc); - return contents; - }; - exports2.de_ListAccountRolesCommand = de_ListAccountRolesCommand; - var de_ListAccountRolesCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidRequestException": - case "com.amazonaws.sso#InvalidRequestException": - throw await de_InvalidRequestExceptionRes(parsedOutput, context); - case "ResourceNotFoundException": - case "com.amazonaws.sso#ResourceNotFoundException": - throw await de_ResourceNotFoundExceptionRes(parsedOutput, context); - case "TooManyRequestsException": - case "com.amazonaws.sso#TooManyRequestsException": - throw await de_TooManyRequestsExceptionRes(parsedOutput, context); - case "UnauthorizedException": - case "com.amazonaws.sso#UnauthorizedException": - throw await de_UnauthorizedExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + this.processTextOrObjNode = processTextOrObjNode; + if (this.options.format) { + this.indentate = indentate; + this.tagEndChar = ">\n"; + this.newLine = "\n"; + } else { + this.indentate = function() { + return ""; + }; + this.tagEndChar = ">"; + this.newLine = ""; + } + } + Builder.prototype.build = function(jObj) { + if (this.options.preserveOrder) { + return buildFromOrderedJs(jObj, this.options); + } else { + if (Array.isArray(jObj) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1) { + jObj = { + [this.options.arrayNodeName]: jObj + }; + } + return this.j2x(jObj, 0).val; } }; - var de_ListAccountsCommand = async (output, context) => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return de_ListAccountsCommandError(output, context); + Builder.prototype.j2x = function(jObj, level) { + let attrStr = ""; + let val2 = ""; + for (let key in jObj) { + if (!Object.prototype.hasOwnProperty.call(jObj, key)) continue; + if (typeof jObj[key] === "undefined") { + if (this.isAttribute(key)) { + val2 += ""; + } + } else if (jObj[key] === null) { + if (this.isAttribute(key)) { + val2 += ""; + } else if (key[0] === "?") { + val2 += this.indentate(level) + "<" + key + "?" + this.tagEndChar; + } else { + val2 += this.indentate(level) + "<" + key + "/" + this.tagEndChar; + } + } else if (jObj[key] instanceof Date) { + val2 += this.buildTextValNode(jObj[key], key, "", level); + } else if (typeof jObj[key] !== "object") { + const attr = this.isAttribute(key); + if (attr) { + attrStr += this.buildAttrPairStr(attr, "" + jObj[key]); + } else { + if (key === this.options.textNodeName) { + let newval = this.options.tagValueProcessor(key, "" + jObj[key]); + val2 += this.replaceEntitiesValue(newval); + } else { + val2 += this.buildTextValNode(jObj[key], key, "", level); + } + } + } else if (Array.isArray(jObj[key])) { + const arrLen = jObj[key].length; + let listTagVal = ""; + let listTagAttr = ""; + for (let j = 0; j < arrLen; j++) { + const item = jObj[key][j]; + if (typeof item === "undefined") { + } else if (item === null) { + if (key[0] === "?") val2 += this.indentate(level) + "<" + key + "?" + this.tagEndChar; + else val2 += this.indentate(level) + "<" + key + "/" + this.tagEndChar; + } else if (typeof item === "object") { + if (this.options.oneListGroup) { + const result = this.j2x(item, level + 1); + listTagVal += result.val; + if (this.options.attributesGroupName && item.hasOwnProperty(this.options.attributesGroupName)) { + listTagAttr += result.attrStr; + } + } else { + listTagVal += this.processTextOrObjNode(item, key, level); + } + } else { + if (this.options.oneListGroup) { + let textValue = this.options.tagValueProcessor(key, item); + textValue = this.replaceEntitiesValue(textValue); + listTagVal += textValue; + } else { + listTagVal += this.buildTextValNode(item, key, "", level); + } + } + } + if (this.options.oneListGroup) { + listTagVal = this.buildObjectNode(listTagVal, key, listTagAttr, level); + } + val2 += listTagVal; + } else { + if (this.options.attributesGroupName && key === this.options.attributesGroupName) { + const Ks = Object.keys(jObj[key]); + const L = Ks.length; + for (let j = 0; j < L; j++) { + attrStr += this.buildAttrPairStr(Ks[j], "" + jObj[key][Ks[j]]); + } + } else { + val2 += this.processTextOrObjNode(jObj[key], key, level); + } + } } - const contents = (0, smithy_client_1.map)({ - $metadata: deserializeMetadata(output) - }); - const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body"); - const doc = (0, smithy_client_1.take)(data, { - accountList: smithy_client_1._json, - nextToken: smithy_client_1.expectString - }); - Object.assign(contents, doc); - return contents; + return { attrStr, val: val2 }; }; - exports2.de_ListAccountsCommand = de_ListAccountsCommand; - var de_ListAccountsCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidRequestException": - case "com.amazonaws.sso#InvalidRequestException": - throw await de_InvalidRequestExceptionRes(parsedOutput, context); - case "ResourceNotFoundException": - case "com.amazonaws.sso#ResourceNotFoundException": - throw await de_ResourceNotFoundExceptionRes(parsedOutput, context); - case "TooManyRequestsException": - case "com.amazonaws.sso#TooManyRequestsException": - throw await de_TooManyRequestsExceptionRes(parsedOutput, context); - case "UnauthorizedException": - case "com.amazonaws.sso#UnauthorizedException": - throw await de_UnauthorizedExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + Builder.prototype.buildAttrPairStr = function(attrName, val2) { + val2 = this.options.attributeValueProcessor(attrName, "" + val2); + val2 = this.replaceEntitiesValue(val2); + if (this.options.suppressBooleanAttributes && val2 === "true") { + return " " + attrName; + } else return " " + attrName + '="' + val2 + '"'; + }; + function processTextOrObjNode(object, key, level) { + const result = this.j2x(object, level + 1); + if (object[this.options.textNodeName] !== void 0 && Object.keys(object).length === 1) { + return this.buildTextValNode(object[this.options.textNodeName], key, result.attrStr, level); + } else { + return this.buildObjectNode(result.val, key, result.attrStr, level); + } + } + Builder.prototype.buildObjectNode = function(val2, key, attrStr, level) { + if (val2 === "") { + if (key[0] === "?") return this.indentate(level) + "<" + key + attrStr + "?" + this.tagEndChar; + else { + return this.indentate(level) + "<" + key + attrStr + this.closeTag(key) + this.tagEndChar; + } + } else { + let tagEndExp = "" + val2 + tagEndExp; + } else if (this.options.commentPropName !== false && key === this.options.commentPropName && piClosingChar.length === 0) { + return this.indentate(level) + `` + this.newLine; + } else { + return this.indentate(level) + "<" + key + attrStr + piClosingChar + this.tagEndChar + val2 + this.indentate(level) + tagEndExp; + } } }; - var de_LogoutCommand = async (output, context) => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return de_LogoutCommandError(output, context); + Builder.prototype.closeTag = function(key) { + let closeTag = ""; + if (this.options.unpairedTags.indexOf(key) !== -1) { + if (!this.options.suppressUnpairedNode) closeTag = "/"; + } else if (this.options.suppressEmptyNode) { + closeTag = "/"; + } else { + closeTag = `> { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidRequestException": - case "com.amazonaws.sso#InvalidRequestException": - throw await de_InvalidRequestExceptionRes(parsedOutput, context); - case "TooManyRequestsException": - case "com.amazonaws.sso#TooManyRequestsException": - throw await de_TooManyRequestsExceptionRes(parsedOutput, context); - case "UnauthorizedException": - case "com.amazonaws.sso#UnauthorizedException": - throw await de_UnauthorizedExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + Builder.prototype.buildTextValNode = function(val2, key, attrStr, level) { + if (this.options.cdataPropName !== false && key === this.options.cdataPropName) { + return this.indentate(level) + `` + this.newLine; + } else if (this.options.commentPropName !== false && key === this.options.commentPropName) { + return this.indentate(level) + `` + this.newLine; + } else if (key[0] === "?") { + return this.indentate(level) + "<" + key + attrStr + "?" + this.tagEndChar; + } else { + let textValue = this.options.tagValueProcessor(key, val2); + textValue = this.replaceEntitiesValue(textValue); + if (textValue === "") { + return this.indentate(level) + "<" + key + attrStr + this.closeTag(key) + this.tagEndChar; + } else { + return this.indentate(level) + "<" + key + attrStr + ">" + textValue + " { - const contents = (0, smithy_client_1.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_1.take)(data, { - message: smithy_client_1.expectString - }); - Object.assign(contents, doc); - const exception = new models_0_1.InvalidRequestException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body); - }; - var de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_1.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_1.take)(data, { - message: smithy_client_1.expectString - }); - Object.assign(contents, doc); - const exception = new models_0_1.ResourceNotFoundException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body); - }; - var de_TooManyRequestsExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_1.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_1.take)(data, { - message: smithy_client_1.expectString - }); - Object.assign(contents, doc); - const exception = new models_0_1.TooManyRequestsException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body); + Builder.prototype.replaceEntitiesValue = function(textValue) { + if (textValue && textValue.length > 0 && this.options.processEntities) { + for (let i = 0; i < this.options.entities.length; i++) { + const entity = this.options.entities[i]; + textValue = textValue.replace(entity.regex, entity.val); + } + } + return textValue; }; - var de_UnauthorizedExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_1.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_1.take)(data, { - message: smithy_client_1.expectString - }); - Object.assign(contents, doc); - const exception = new models_0_1.UnauthorizedException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body); + function indentate(level) { + return this.options.indentBy.repeat(level); + } + function isAttribute(name) { + if (name.startsWith(this.options.attributeNamePrefix) && name !== this.options.textNodeName) { + return name.substr(this.attrPrefixLen); + } else { + return false; + } + } + module2.exports = Builder; + } +}); + +// ../../../node_modules/fast-xml-parser/src/fxp.js +var require_fxp = __commonJS({ + "../../../node_modules/fast-xml-parser/src/fxp.js"(exports2, module2) { + "use strict"; + var validator = require_validator(); + var XMLParser2 = require_XMLParser(); + var XMLBuilder = require_json2xml(); + module2.exports = { + XMLParser: XMLParser2, + XMLValidator: validator, + XMLBuilder }; - var deserializeMetadata = (output) => ({ - httpStatusCode: output.statusCode, - requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"], - extendedRequestId: output.headers["x-amz-id-2"], - cfId: output.headers["x-amz-cf-id"] - }); - var collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)); - var isSerializableHeaderValue = (value) => value !== void 0 && value !== null && value !== "" && (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) && (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0); - var parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => { + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/parseXmlBody.js +var import_smithy_client4, import_fast_xml_parser, parseXmlBody, parseXmlErrorBody, loadRestXmlErrorCode; +var init_parseXmlBody = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/parseXmlBody.js"() { + import_smithy_client4 = __toESM(require_dist_cjs37()); + import_fast_xml_parser = __toESM(require_fxp()); + init_common(); + parseXmlBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => { if (encoded.length) { - return JSON.parse(encoded); + const parser = new import_fast_xml_parser.XMLParser({ + attributeNamePrefix: "", + htmlEntities: true, + ignoreAttributes: false, + ignoreDeclaration: true, + parseTagValue: false, + trimValues: false, + tagValueProcessor: (_, val2) => val2.trim() === "" && val2.includes("\n") ? "" : void 0 + }); + parser.addEntity("#xD", "\r"); + parser.addEntity("#10", "\n"); + let parsedObj; + try { + parsedObj = parser.parse(encoded, true); + } catch (e) { + if (e && typeof e === "object") { + Object.defineProperty(e, "$responseBodyText", { + value: encoded + }); + } + throw e; + } + const textNodeName = "#text"; + const key = Object.keys(parsedObj)[0]; + const parsedObjToReturn = parsedObj[key]; + if (parsedObjToReturn[textNodeName]) { + parsedObjToReturn[key] = parsedObjToReturn[textNodeName]; + delete parsedObjToReturn[textNodeName]; + } + return (0, import_smithy_client4.getValueFromTextNode)(parsedObjToReturn); } return {}; }); - var parseErrorBody = async (errorBody, context) => { - const value = await parseBody(errorBody, context); - value.message = value.message ?? value.Message; + parseXmlErrorBody = async (errorBody, context) => { + const value = await parseXmlBody(errorBody, context); + if (value.Error) { + value.Error.message = value.Error.message ?? value.Error.Message; + } return value; }; - var loadRestJsonErrorCode = (output, data) => { - const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()); - const sanitizeErrorCode = (rawValue) => { - let cleanValue = rawValue; - if (typeof cleanValue === "number") { - cleanValue = cleanValue.toString(); - } - if (cleanValue.indexOf(",") >= 0) { - cleanValue = cleanValue.split(",")[0]; - } - if (cleanValue.indexOf(":") >= 0) { - cleanValue = cleanValue.split(":")[0]; - } - if (cleanValue.indexOf("#") >= 0) { - cleanValue = cleanValue.split("#")[1]; - } - return cleanValue; - }; - const headerKey = findKey(output.headers, "x-amzn-errortype"); - if (headerKey !== void 0) { - return sanitizeErrorCode(output.headers[headerKey]); + loadRestXmlErrorCode = (output, data) => { + if (data?.Error?.Code !== void 0) { + return data.Error.Code; } - if (data.code !== void 0) { - return sanitizeErrorCode(data.code); + if (data?.Code !== void 0) { + return data.Code; } - if (data["__type"] !== void 0) { - return sanitizeErrorCode(data["__type"]); + if (output.statusCode == 404) { + return "NotFound"; + } + }; + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/index.js +var init_protocols = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/index.js"() { + init_coercing_serializers(); + init_awsExpectUnion(); + init_parseJsonBody(); + init_parseXmlBody(); + } +}); + +// ../../../node_modules/@aws-sdk/core/dist-es/index.js +var dist_es_exports2 = {}; +__export(dist_es_exports2, { + AWSSDKSigV4Signer: () => AWSSDKSigV4Signer, + AwsSdkSigV4ASigner: () => AwsSdkSigV4ASigner, + AwsSdkSigV4Signer: () => AwsSdkSigV4Signer, + NODE_SIGV4A_CONFIG_OPTIONS: () => NODE_SIGV4A_CONFIG_OPTIONS, + _toBool: () => _toBool, + _toNum: () => _toNum, + _toStr: () => _toStr, + awsExpectUnion: () => awsExpectUnion, + emitWarningIfUnsupportedVersion: () => emitWarningIfUnsupportedVersion, + loadRestJsonErrorCode: () => loadRestJsonErrorCode, + loadRestXmlErrorCode: () => loadRestXmlErrorCode, + parseJsonBody: () => parseJsonBody, + parseJsonErrorBody: () => parseJsonErrorBody, + parseXmlBody: () => parseXmlBody, + parseXmlErrorBody: () => parseXmlErrorBody, + resolveAWSSDKSigV4Config: () => resolveAWSSDKSigV4Config, + resolveAwsSdkSigV4AConfig: () => resolveAwsSdkSigV4AConfig, + resolveAwsSdkSigV4Config: () => resolveAwsSdkSigV4Config, + validateSigningProperties: () => validateSigningProperties +}); +var init_dist_es2 = __esm({ + "../../../node_modules/@aws-sdk/core/dist-es/index.js"() { + init_client(); + init_httpAuthSchemes2(); + init_protocols(); + } +}); + +// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/auth/httpAuthSchemeProvider.js +var require_httpAuthSchemeProvider = __commonJS({ + "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/auth/httpAuthSchemeProvider.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.resolveHttpAuthSchemeConfig = exports2.defaultSFNHttpAuthSchemeProvider = exports2.defaultSFNHttpAuthSchemeParametersProvider = void 0; + var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var util_middleware_1 = require_dist_cjs10(); + var defaultSFNHttpAuthSchemeParametersProvider = async (config, context, input) => { + return { + operation: (0, util_middleware_1.getSmithyContext)(context).operation, + region: await (0, util_middleware_1.normalizeProvider)(config.region)() || (() => { + throw new Error("expected `region` to be configured for `aws.auth#sigv4`"); + })() + }; + }; + exports2.defaultSFNHttpAuthSchemeParametersProvider = defaultSFNHttpAuthSchemeParametersProvider; + function createAwsAuthSigv4HttpAuthOption(authParameters) { + return { + schemeId: "aws.auth#sigv4", + signingProperties: { + name: "states", + region: authParameters.region + }, + propertiesExtractor: (config, context) => ({ + signingProperties: { + config, + context + } + }) + }; + } + var defaultSFNHttpAuthSchemeProvider = (authParameters) => { + const options = []; + switch (authParameters.operation) { + default: { + options.push(createAwsAuthSigv4HttpAuthOption(authParameters)); + } } + return options; + }; + exports2.defaultSFNHttpAuthSchemeProvider = defaultSFNHttpAuthSchemeProvider; + var resolveHttpAuthSchemeConfig = (config) => { + const config_0 = (0, core_1.resolveAwsSdkSigV4Config)(config); + return { + ...config_0 + }; + }; + exports2.resolveHttpAuthSchemeConfig = resolveHttpAuthSchemeConfig; + } +}); + +// ../../../node_modules/tslib/tslib.es6.mjs +var tslib_es6_exports = {}; +__export(tslib_es6_exports, { + __addDisposableResource: () => __addDisposableResource, + __assign: () => __assign, + __asyncDelegator: () => __asyncDelegator, + __asyncGenerator: () => __asyncGenerator, + __asyncValues: () => __asyncValues, + __await: () => __await, + __awaiter: () => __awaiter, + __classPrivateFieldGet: () => __classPrivateFieldGet, + __classPrivateFieldIn: () => __classPrivateFieldIn, + __classPrivateFieldSet: () => __classPrivateFieldSet, + __createBinding: () => __createBinding, + __decorate: () => __decorate, + __disposeResources: () => __disposeResources, + __esDecorate: () => __esDecorate, + __exportStar: () => __exportStar, + __extends: () => __extends, + __generator: () => __generator, + __importDefault: () => __importDefault, + __importStar: () => __importStar, + __makeTemplateObject: () => __makeTemplateObject, + __metadata: () => __metadata, + __param: () => __param, + __propKey: () => __propKey, + __read: () => __read, + __rest: () => __rest, + __runInitializers: () => __runInitializers, + __setFunctionName: () => __setFunctionName, + __spread: () => __spread, + __spreadArray: () => __spreadArray, + __spreadArrays: () => __spreadArrays, + __values: () => __values, + default: () => tslib_es6_default +}); +function __extends(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} +function __rest(s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +} +function __decorate(decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +} +function __param(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; +} +function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { + if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); + return f; + } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _, done = false; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function(f) { + if (done) throw new TypeError("Cannot add initializers after decoration has completed"); + extraInitializers.push(accept(f || null)); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.unshift(_); + } else if (_ = accept(result)) { + if (kind === "field") initializers.unshift(_); + else descriptor[key] = _; + } } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/commands/GetRoleCredentialsCommand.js -var require_GetRoleCredentialsCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/commands/GetRoleCredentialsCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.GetRoleCredentialsCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_02(); - var Aws_restJson1_1 = require_Aws_restJson1(); - var GetRoleCredentialsCommand = class _GetRoleCredentialsCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _GetRoleCredentialsCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SSOClient"; - const commandName = "GetRoleCredentialsCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.GetRoleCredentialsRequestFilterSensitiveLog, - outputFilterSensitiveLog: models_0_1.GetRoleCredentialsResponseFilterSensitiveLog, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "SWBPortalService", - operation: "GetRoleCredentials" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_restJson1_1.se_GetRoleCredentialsCommand)(input, context); + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; +} +function __runInitializers(thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; +} +function __propKey(x) { + return typeof x === "symbol" ? x : "".concat(x); +} +function __setFunctionName(f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); +} +function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); +} +function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); } - deserialize(output, context) { - return (0, Aws_restJson1_1.de_GetRoleCredentialsCommand)(output, context); + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} +function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); + return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); }; - exports2.GetRoleCredentialsCommand = GetRoleCredentialsCommand; } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/commands/ListAccountRolesCommand.js -var require_ListAccountRolesCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/commands/ListAccountRolesCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ListAccountRolesCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_02(); - var Aws_restJson1_1 = require_Aws_restJson1(); - var ListAccountRolesCommand = class _ListAccountRolesCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _ListAccountRolesCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SSOClient"; - const commandName = "ListAccountRolesCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.ListAccountRolesRequestFilterSensitiveLog, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "SWBPortalService", - operation: "ListAccountRoles" + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_restJson1_1.se_ListAccountRolesCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_restJson1_1.de_ListAccountRolesCommand)(output, context); + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } +} +function __exportStar(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); +} +function __values(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function() { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +} +function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } catch (error) { + e = { error }; + } finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } finally { + if (e) throw e.error; + } + } + return ar; +} +function __spread() { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; +} +function __spreadArrays() { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; +} +function __spreadArray(to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +} +function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); +} +function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() { + return this; + }, i; + function awaitReturn(f) { + return function(v) { + return Promise.resolve(v).then(f, reject); }; - exports2.ListAccountRolesCommand = ListAccountRolesCommand; } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/commands/ListAccountsCommand.js -var require_ListAccountsCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/commands/ListAccountsCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ListAccountsCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_02(); - var Aws_restJson1_1 = require_Aws_restJson1(); - var ListAccountsCommand = class _ListAccountsCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _ListAccountsCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SSOClient"; - const commandName = "ListAccountsCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.ListAccountsRequestFilterSensitiveLog, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "SWBPortalService", - operation: "ListAccounts" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_restJson1_1.se_ListAccountsCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_restJson1_1.de_ListAccountsCommand)(output, context); - } - }; - exports2.ListAccountsCommand = ListAccountsCommand; + function verb(n, f) { + if (g[n]) { + i[n] = function(v) { + return new Promise(function(a, b) { + q.push([n, v, a, b]) > 1 || resume(n, v); + }); + }; + if (f) i[n] = f(i[n]); + } } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/commands/LogoutCommand.js -var require_LogoutCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/commands/LogoutCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.LogoutCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_02(); - var Aws_restJson1_1 = require_Aws_restJson1(); - var LogoutCommand = class _LogoutCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _LogoutCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SSOClient"; - const commandName = "LogoutCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.LogoutRequestFilterSensitiveLog, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "SWBPortalService", - operation: "Logout" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_restJson1_1.se_LogoutCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_restJson1_1.de_LogoutCommand)(output, context); - } - }; - exports2.LogoutCommand = LogoutCommand; + function resume(n, v) { + try { + step(g[n](v)); + } catch (e) { + settle(q[0][3], e); + } } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/SSO.js -var require_SSO = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/SSO.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SSO = void 0; - var smithy_client_1 = require_dist_cjs34(); - var GetRoleCredentialsCommand_1 = require_GetRoleCredentialsCommand(); - var ListAccountRolesCommand_1 = require_ListAccountRolesCommand(); - var ListAccountsCommand_1 = require_ListAccountsCommand(); - var LogoutCommand_1 = require_LogoutCommand(); - var SSOClient_1 = require_SSOClient(); - var commands = { - GetRoleCredentialsCommand: GetRoleCredentialsCommand_1.GetRoleCredentialsCommand, - ListAccountRolesCommand: ListAccountRolesCommand_1.ListAccountRolesCommand, - ListAccountsCommand: ListAccountsCommand_1.ListAccountsCommand, - LogoutCommand: LogoutCommand_1.LogoutCommand - }; - var SSO = class extends SSOClient_1.SSOClient { - }; - exports2.SSO = SSO; - (0, smithy_client_1.createAggregatedClient)(commands, SSO); + function step(r) { + r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/commands/index.js -var require_commands = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/commands/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_GetRoleCredentialsCommand(), exports2); - tslib_1.__exportStar(require_ListAccountRolesCommand(), exports2); - tslib_1.__exportStar(require_ListAccountsCommand(), exports2); - tslib_1.__exportStar(require_LogoutCommand(), exports2); + function fulfill(value) { + resume("next", value); } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/pagination/Interfaces.js -var require_Interfaces = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/pagination/Interfaces.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); + function reject(value) { + resume("throw", value); } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/pagination/ListAccountRolesPaginator.js -var require_ListAccountRolesPaginator = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/pagination/ListAccountRolesPaginator.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.paginateListAccountRoles = void 0; - var ListAccountRolesCommand_1 = require_ListAccountRolesCommand(); - var SSOClient_1 = require_SSOClient(); - var makePagedClientRequest = async (client, input, ...args) => { - return await client.send(new ListAccountRolesCommand_1.ListAccountRolesCommand(input), ...args); - }; - async function* paginateListAccountRoles(config, input, ...additionalArguments) { - let token = config.startingToken || void 0; - let hasNext = true; - let page; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SSOClient_1.SSOClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSO | SSOClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - return void 0; - } - exports2.paginateListAccountRoles = paginateListAccountRoles; + function settle(f, v) { + if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/pagination/ListAccountsPaginator.js -var require_ListAccountsPaginator = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/pagination/ListAccountsPaginator.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.paginateListAccounts = void 0; - var ListAccountsCommand_1 = require_ListAccountsCommand(); - var SSOClient_1 = require_SSOClient(); - var makePagedClientRequest = async (client, input, ...args) => { - return await client.send(new ListAccountsCommand_1.ListAccountsCommand(input), ...args); - }; - async function* paginateListAccounts(config, input, ...additionalArguments) { - let token = config.startingToken || void 0; - let hasNext = true; - let page; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SSOClient_1.SSOClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSO | SSOClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - return void 0; - } - exports2.paginateListAccounts = paginateListAccounts; +} +function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function(e) { + throw e; + }), verb("return"), i[Symbol.iterator] = function() { + return this; + }, i; + function verb(n, f) { + i[n] = o[n] ? function(v) { + return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; + } : f; } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/pagination/index.js -var require_pagination2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/pagination/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_Interfaces(), exports2); - tslib_1.__exportStar(require_ListAccountRolesPaginator(), exports2); - tslib_1.__exportStar(require_ListAccountsPaginator(), exports2); +} +function __asyncValues(o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { + return this; + }, i); + function verb(n) { + i[n] = o[n] && function(v) { + return new Promise(function(resolve, reject) { + v = o[n](v), settle(resolve, reject, v.done, v.value); + }); + }; } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/models/index.js -var require_models = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/models/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_models_02(), exports2); + function settle(resolve, reject, d, v) { + Promise.resolve(v).then(function(v2) { + resolve({ value: v2, done: d }); + }, reject); } -}); - -// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/index.js -var require_dist_cjs45 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sso/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SSOServiceException = void 0; - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_SSOClient(), exports2); - tslib_1.__exportStar(require_SSO(), exports2); - tslib_1.__exportStar(require_commands(), exports2); - tslib_1.__exportStar(require_pagination2(), exports2); - tslib_1.__exportStar(require_models(), exports2); - var SSOServiceException_1 = require_SSOServiceException(); - Object.defineProperty(exports2, "SSOServiceException", { enumerable: true, get: function() { - return SSOServiceException_1.SSOServiceException; - } }); +} +function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { + Object.defineProperty(cooked, "raw", { value: raw }); + } else { + cooked.raw = raw; } -}); - -// ../../../node_modules/@aws-sdk/token-providers/dist-cjs/bundle/client-sso-oidc-node.js -var require_client_sso_oidc_node = __commonJS({ - "../../../node_modules/@aws-sdk/token-providers/dist-cjs/bundle/client-sso-oidc-node.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.UnsupportedGrantTypeException = exports2.UnauthorizedClientException = exports2.SlowDownException = exports2.SSOOIDCClient = exports2.InvalidScopeException = exports2.InvalidRequestException = exports2.InvalidClientException = exports2.InternalServerException = exports2.ExpiredTokenException = exports2.CreateTokenCommand = exports2.AuthorizationPendingException = exports2.AccessDeniedException = void 0; - var middleware_host_header_1 = require_dist_cjs3(); - var middleware_logger_1 = require_dist_cjs4(); - var middleware_recursion_detection_1 = require_dist_cjs5(); - var middleware_user_agent_1 = require_dist_cjs17(); - var config_resolver_1 = require_dist_cjs19(); - var middleware_content_length_1 = require_dist_cjs20(); - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_retry_1 = require_dist_cjs35(); - var smithy_client_1 = require_dist_cjs34(); - var resolveClientEndpointParameters = (options) => { - var _a, _b; - return { - ...options, - useDualstackEndpoint: (_a = options.useDualstackEndpoint) !== null && _a !== void 0 ? _a : false, - useFipsEndpoint: (_b = options.useFipsEndpoint) !== null && _b !== void 0 ? _b : false, - defaultSigningName: "awsssooidc" - }; - }; - var package_default = { version: "3.387.0" }; - var util_user_agent_node_1 = require_dist_cjs40(); - var config_resolver_2 = require_dist_cjs19(); - var hash_node_1 = require_dist_cjs41(); - var middleware_retry_2 = require_dist_cjs35(); - var node_config_provider_1 = require_dist_cjs22(); - var node_http_handler_1 = require_dist_cjs32(); - var util_body_length_node_1 = require_dist_cjs42(); - var util_retry_1 = require_dist_cjs28(); - var smithy_client_2 = require_dist_cjs34(); - var url_parser_1 = require_dist_cjs24(); - var util_base64_1 = require_dist_cjs30(); - var util_utf8_1 = require_dist_cjs10(); - var util_endpoints_1 = require_dist_cjs16(); - var p = "required"; - var q = "fn"; - var r = "argv"; - var s = "ref"; - var a = "PartitionResult"; - var b = "tree"; - var c = "error"; - var d = "endpoint"; - var e = { [p]: false, "type": "String" }; - var f = { [p]: true, "default": false, "type": "Boolean" }; - var g = { [s]: "Endpoint" }; - var h = { [q]: "booleanEquals", [r]: [{ [s]: "UseFIPS" }, true] }; - var i = { [q]: "booleanEquals", [r]: [{ [s]: "UseDualStack" }, true] }; - var j = {}; - var k = { [q]: "booleanEquals", [r]: [true, { [q]: "getAttr", [r]: [{ [s]: a }, "supportsFIPS"] }] }; - var l = { [q]: "booleanEquals", [r]: [true, { [q]: "getAttr", [r]: [{ [s]: a }, "supportsDualStack"] }] }; - var m = [g]; - var n = [h]; - var o = [i]; - var _data = { version: "1.0", parameters: { Region: e, UseDualStack: f, UseFIPS: f, Endpoint: e }, rules: [{ conditions: [{ [q]: "aws.partition", [r]: [{ [s]: "Region" }], assign: a }], type: b, rules: [{ conditions: [{ [q]: "isSet", [r]: m }, { [q]: "parseURL", [r]: m, assign: "url" }], type: b, rules: [{ conditions: n, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: c }, { type: b, rules: [{ conditions: o, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: c }, { endpoint: { url: g, properties: j, headers: j }, type: d }] }] }, { conditions: [h, i], type: b, rules: [{ conditions: [k, l], type: b, rules: [{ endpoint: { url: "https://oidc-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: j, headers: j }, type: d }] }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: c }] }, { conditions: n, type: b, rules: [{ conditions: [k], type: b, rules: [{ type: b, rules: [{ endpoint: { url: "https://oidc-fips.{Region}.{PartitionResult#dnsSuffix}", properties: j, headers: j }, type: d }] }] }, { error: "FIPS is enabled but this partition does not support FIPS", type: c }] }, { conditions: o, type: b, rules: [{ conditions: [l], type: b, rules: [{ endpoint: { url: "https://oidc.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: j, headers: j }, type: d }] }, { error: "DualStack is enabled but this partition does not support DualStack", type: c }] }, { endpoint: { url: "https://oidc.{Region}.{PartitionResult#dnsSuffix}", properties: j, headers: j }, type: d }] }] }; - var ruleSet = _data; - var defaultEndpointResolver = (endpointParams, context = {}) => { - return (0, util_endpoints_1.resolveEndpoint)(ruleSet, { - endpointParams, - logger: context.logger - }); + return cooked; +} +function __importStar(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; +} +function __importDefault(mod) { + return mod && mod.__esModule ? mod : { default: mod }; +} +function __classPrivateFieldGet(receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +} +function __classPrivateFieldSet(receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value; +} +function __classPrivateFieldIn(state, receiver) { + if (receiver === null || typeof receiver !== "object" && typeof receiver !== "function") throw new TypeError("Cannot use 'in' operator on non-object"); + return typeof state === "function" ? receiver === state : state.has(receiver); +} +function __addDisposableResource(env, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); + var dispose, inner; + if (async) { + if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + if (async) inner = dispose; + } + if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + if (inner) dispose = function() { + try { + inner.call(this); + } catch (e) { + return Promise.reject(e); + } }; - var getRuntimeConfig = (config) => { - var _a, _b, _c, _d, _e, _f, _g, _h, _j; - return { - apiVersion: "2019-06-10", - base64Decoder: (_a = config === null || config === void 0 ? void 0 : config.base64Decoder) !== null && _a !== void 0 ? _a : util_base64_1.fromBase64, - base64Encoder: (_b = config === null || config === void 0 ? void 0 : config.base64Encoder) !== null && _b !== void 0 ? _b : util_base64_1.toBase64, - disableHostPrefix: (_c = config === null || config === void 0 ? void 0 : config.disableHostPrefix) !== null && _c !== void 0 ? _c : false, - endpointProvider: (_d = config === null || config === void 0 ? void 0 : config.endpointProvider) !== null && _d !== void 0 ? _d : defaultEndpointResolver, - logger: (_e = config === null || config === void 0 ? void 0 : config.logger) !== null && _e !== void 0 ? _e : new smithy_client_2.NoOpLogger(), - serviceId: (_f = config === null || config === void 0 ? void 0 : config.serviceId) !== null && _f !== void 0 ? _f : "SSO OIDC", - urlParser: (_g = config === null || config === void 0 ? void 0 : config.urlParser) !== null && _g !== void 0 ? _g : url_parser_1.parseUrl, - utf8Decoder: (_h = config === null || config === void 0 ? void 0 : config.utf8Decoder) !== null && _h !== void 0 ? _h : util_utf8_1.fromUtf8, - utf8Encoder: (_j = config === null || config === void 0 ? void 0 : config.utf8Encoder) !== null && _j !== void 0 ? _j : util_utf8_1.toUtf8 + env.stack.push({ value, dispose, async }); + } else if (async) { + env.stack.push({ async: true }); + } + return value; +} +function __disposeResources(env) { + function fail(e) { + env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; + env.hasError = true; + } + var r, s = 0; + function next() { + while (r = env.stack.pop()) { + try { + if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); + if (r.dispose) { + var result = r.dispose.call(r.value); + if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { + fail(e); + return next(); + }); + } else s |= 1; + } catch (e) { + fail(e); + } + } + if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); + if (env.hasError) throw env.error; + } + return next(); +} +var extendStatics, __assign, __createBinding, __setModuleDefault, _SuppressedError, tslib_es6_default; +var init_tslib_es6 = __esm({ + "../../../node_modules/tslib/tslib.es6.mjs"() { + extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; }; + return extendStatics(d, b); }; - var smithy_client_3 = require_dist_cjs34(); - var util_defaults_mode_node_1 = require_dist_cjs43(); - var smithy_client_4 = require_dist_cjs34(); - var getRuntimeConfig2 = (config) => { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; - (0, smithy_client_4.emitWarningIfUnsupportedVersion)(process.version); - const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config); - const defaultConfigProvider = () => defaultsMode().then(smithy_client_3.loadConfigsForDefaultMode); - const clientSharedValues = getRuntimeConfig(config); - return { - ...clientSharedValues, - ...config, - runtime: "node", - defaultsMode, - bodyLengthChecker: (_a = config === null || config === void 0 ? void 0 : config.bodyLengthChecker) !== null && _a !== void 0 ? _a : util_body_length_node_1.calculateBodyLength, - defaultUserAgentProvider: (_b = config === null || config === void 0 ? void 0 : config.defaultUserAgentProvider) !== null && _b !== void 0 ? _b : (0, util_user_agent_node_1.defaultUserAgent)({ serviceId: clientSharedValues.serviceId, clientVersion: package_default.version }), - maxAttempts: (_c = config === null || config === void 0 ? void 0 : config.maxAttempts) !== null && _c !== void 0 ? _c : (0, node_config_provider_1.loadConfig)(middleware_retry_2.NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: (_d = config === null || config === void 0 ? void 0 : config.region) !== null && _d !== void 0 ? _d : (0, node_config_provider_1.loadConfig)(config_resolver_2.NODE_REGION_CONFIG_OPTIONS, config_resolver_2.NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: (_e = config === null || config === void 0 ? void 0 : config.requestHandler) !== null && _e !== void 0 ? _e : new node_http_handler_1.NodeHttpHandler(defaultConfigProvider), - retryMode: (_f = config === null || config === void 0 ? void 0 : config.retryMode) !== null && _f !== void 0 ? _f : (0, node_config_provider_1.loadConfig)({ - ...middleware_retry_2.NODE_RETRY_MODE_CONFIG_OPTIONS, - default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE - }), - sha256: (_g = config === null || config === void 0 ? void 0 : config.sha256) !== null && _g !== void 0 ? _g : hash_node_1.Hash.bind(null, "sha256"), - streamCollector: (_h = config === null || config === void 0 ? void 0 : config.streamCollector) !== null && _h !== void 0 ? _h : node_http_handler_1.streamCollector, - useDualstackEndpoint: (_j = config === null || config === void 0 ? void 0 : config.useDualstackEndpoint) !== null && _j !== void 0 ? _j : (0, node_config_provider_1.loadConfig)(config_resolver_2.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), - useFipsEndpoint: (_k = config === null || config === void 0 ? void 0 : config.useFipsEndpoint) !== null && _k !== void 0 ? _k : (0, node_config_provider_1.loadConfig)(config_resolver_2.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS) + __assign = function() { + __assign = Object.assign || function __assign2(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; }; + return __assign.apply(this, arguments); }; - var SSOOIDCClient = class extends smithy_client_1.Client { - constructor(...[configuration]) { - const _config_0 = getRuntimeConfig2(configuration || {}); - const _config_1 = resolveClientEndpointParameters(_config_0); - const _config_2 = (0, config_resolver_1.resolveRegionConfig)(_config_1); - const _config_3 = (0, middleware_endpoint_1.resolveEndpointConfig)(_config_2); - const _config_4 = (0, middleware_retry_1.resolveRetryConfig)(_config_3); - const _config_5 = (0, middleware_host_header_1.resolveHostHeaderConfig)(_config_4); - const _config_6 = (0, middleware_user_agent_1.resolveUserAgentConfig)(_config_5); - super(_config_6); - this.config = _config_6; - this.middlewareStack.use((0, middleware_retry_1.getRetryPlugin)(this.config)); - this.middlewareStack.use((0, middleware_content_length_1.getContentLengthPlugin)(this.config)); - this.middlewareStack.use((0, middleware_host_header_1.getHostHeaderPlugin)(this.config)); - this.middlewareStack.use((0, middleware_logger_1.getLoggerPlugin)(this.config)); - this.middlewareStack.use((0, middleware_recursion_detection_1.getRecursionDetectionPlugin)(this.config)); - this.middlewareStack.use((0, middleware_user_agent_1.getUserAgentPlugin)(this.config)); - } - destroy() { - super.destroy(); - } - }; - exports2.SSOOIDCClient = SSOOIDCClient; - var smithy_client_5 = require_dist_cjs34(); - var middleware_endpoint_2 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_6 = require_dist_cjs34(); - var protocol_http_1 = require_dist_cjs2(); - var smithy_client_7 = require_dist_cjs34(); - var smithy_client_8 = require_dist_cjs34(); - var SSOOIDCServiceException = class _SSOOIDCServiceException extends smithy_client_8.ServiceException { - constructor(options) { - super(options); - Object.setPrototypeOf(this, _SSOOIDCServiceException.prototype); - } - }; - var AccessDeniedException = class _AccessDeniedException extends SSOOIDCServiceException { - constructor(opts) { - super({ - name: "AccessDeniedException", - $fault: "client", - ...opts - }); - this.name = "AccessDeniedException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _AccessDeniedException.prototype); - this.error = opts.error; - this.error_description = opts.error_description; + __createBinding = Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; } + Object.defineProperty(o, k2, desc); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; }; - exports2.AccessDeniedException = AccessDeniedException; - var AuthorizationPendingException = class _AuthorizationPendingException extends SSOOIDCServiceException { - constructor(opts) { - super({ - name: "AuthorizationPendingException", - $fault: "client", - ...opts - }); - this.name = "AuthorizationPendingException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _AuthorizationPendingException.prototype); - this.error = opts.error; - this.error_description = opts.error_description; - } + __setModuleDefault = Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; }; - exports2.AuthorizationPendingException = AuthorizationPendingException; - var ExpiredTokenException = class _ExpiredTokenException extends SSOOIDCServiceException { - constructor(opts) { - super({ - name: "ExpiredTokenException", - $fault: "client", - ...opts - }); - this.name = "ExpiredTokenException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _ExpiredTokenException.prototype); - this.error = opts.error; - this.error_description = opts.error_description; - } + _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; }; - exports2.ExpiredTokenException = ExpiredTokenException; - var InternalServerException = class _InternalServerException extends SSOOIDCServiceException { - constructor(opts) { - super({ - name: "InternalServerException", - $fault: "server", - ...opts - }); - this.name = "InternalServerException"; - this.$fault = "server"; - Object.setPrototypeOf(this, _InternalServerException.prototype); - this.error = opts.error; - this.error_description = opts.error_description; - } + tslib_es6_default = { + __extends, + __assign, + __rest, + __decorate, + __param, + __metadata, + __awaiter, + __generator, + __createBinding, + __exportStar, + __values, + __read, + __spread, + __spreadArrays, + __spreadArray, + __await, + __asyncGenerator, + __asyncDelegator, + __asyncValues, + __makeTemplateObject, + __importStar, + __importDefault, + __classPrivateFieldGet, + __classPrivateFieldSet, + __classPrivateFieldIn, + __addDisposableResource, + __disposeResources }; - exports2.InternalServerException = InternalServerException; - var InvalidClientException = class _InvalidClientException extends SSOOIDCServiceException { - constructor(opts) { - super({ - name: "InvalidClientException", - $fault: "client", - ...opts - }); - this.name = "InvalidClientException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidClientException.prototype); - this.error = opts.error; - this.error_description = opts.error_description; + } +}); + +// ../../../node_modules/@aws-sdk/client-sfn/package.json +var require_package = __commonJS({ + "../../../node_modules/@aws-sdk/client-sfn/package.json"(exports2, module2) { + module2.exports = { + name: "@aws-sdk/client-sfn", + description: "AWS SDK for JavaScript Sfn Client for Node.js, Browser and React Native", + version: "3.632.0", + scripts: { + build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", + "build:cjs": "node ../../scripts/compilation/inline client-sfn", + "build:es": "tsc -p tsconfig.es.json", + "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", + "build:types": "tsc -p tsconfig.types.json", + "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4", + clean: "rimraf ./dist-* && rimraf *.tsbuildinfo", + "extract:docs": "api-extractor run --local", + "generate:client": "node ../../scripts/generate-clients/single-service --solo sfn" + }, + main: "./dist-cjs/index.js", + types: "./dist-types/index.d.ts", + module: "./dist-es/index.js", + sideEffects: false, + dependencies: { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/client-sso-oidc": "3.632.0", + "@aws-sdk/client-sts": "3.632.0", + "@aws-sdk/core": "3.629.0", + "@aws-sdk/credential-provider-node": "3.632.0", + "@aws-sdk/middleware-host-header": "3.620.0", + "@aws-sdk/middleware-logger": "3.609.0", + "@aws-sdk/middleware-recursion-detection": "3.620.0", + "@aws-sdk/middleware-user-agent": "3.632.0", + "@aws-sdk/region-config-resolver": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.632.0", + "@aws-sdk/util-user-agent-browser": "3.609.0", + "@aws-sdk/util-user-agent-node": "3.614.0", + "@smithy/config-resolver": "^3.0.5", + "@smithy/core": "^2.3.2", + "@smithy/fetch-http-handler": "^3.2.4", + "@smithy/hash-node": "^3.0.3", + "@smithy/invalid-dependency": "^3.0.3", + "@smithy/middleware-content-length": "^3.0.5", + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.14", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", + "@smithy/util-base64": "^3.0.0", + "@smithy/util-body-length-browser": "^3.0.0", + "@smithy/util-body-length-node": "^3.0.0", + "@smithy/util-defaults-mode-browser": "^3.0.14", + "@smithy/util-defaults-mode-node": "^3.0.14", + "@smithy/util-endpoints": "^2.0.5", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", + "@smithy/util-utf8": "^3.0.0", + tslib: "^2.6.2", + uuid: "^9.0.1" + }, + devDependencies: { + "@tsconfig/node16": "16.1.3", + "@types/node": "^16.18.96", + "@types/uuid": "^9.0.4", + concurrently: "7.0.0", + "downlevel-dts": "0.10.1", + rimraf: "3.0.2", + typescript: "~4.9.5" + }, + engines: { + node: ">=16.0.0" + }, + typesVersions: { + "<4.0": { + "dist-types/*": [ + "dist-types/ts3.4/*" + ] + } + }, + files: [ + "dist-*/**" + ], + author: { + name: "AWS SDK for JavaScript Team", + url: "https://aws.amazon.com/javascript/" + }, + license: "Apache-2.0", + browser: { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" + }, + "react-native": { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" + }, + homepage: "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-sfn", + repository: { + type: "git", + url: "https://github.com/aws/aws-sdk-js-v3.git", + directory: "clients/client-sfn" } }; - exports2.InvalidClientException = InvalidClientException; - var InvalidGrantException = class _InvalidGrantException extends SSOOIDCServiceException { - constructor(opts) { - super({ - name: "InvalidGrantException", - $fault: "client", - ...opts - }); - this.name = "InvalidGrantException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidGrantException.prototype); - this.error = opts.error; - this.error_description = opts.error_description; - } + } +}); + +// ../../../node_modules/@aws-sdk/credential-provider-env/dist-cjs/index.js +var require_dist_cjs48 = __commonJS({ + "../../../node_modules/@aws-sdk/credential-provider-env/dist-cjs/index.js"(exports2, module2) { + "use strict"; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var InvalidRequestException = class _InvalidRequestException extends SSOOIDCServiceException { - constructor(opts) { - super({ - name: "InvalidRequestException", - $fault: "client", - ...opts - }); - this.name = "InvalidRequestException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidRequestException.prototype); - this.error = opts.error; - this.error_description = opts.error_description; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - exports2.InvalidRequestException = InvalidRequestException; - var InvalidScopeException = class _InvalidScopeException extends SSOOIDCServiceException { - constructor(opts) { - super({ - name: "InvalidScopeException", - $fault: "client", - ...opts - }); - this.name = "InvalidScopeException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidScopeException.prototype); - this.error = opts.error; - this.error_description = opts.error_description; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + ENV_ACCOUNT_ID: () => ENV_ACCOUNT_ID, + ENV_CREDENTIAL_SCOPE: () => ENV_CREDENTIAL_SCOPE, + ENV_EXPIRATION: () => ENV_EXPIRATION, + ENV_KEY: () => ENV_KEY, + ENV_SECRET: () => ENV_SECRET, + ENV_SESSION: () => ENV_SESSION, + fromEnv: () => fromEnv + }); + module2.exports = __toCommonJS2(src_exports); + var import_property_provider2 = require_dist_cjs40(); + var ENV_KEY = "AWS_ACCESS_KEY_ID"; + var ENV_SECRET = "AWS_SECRET_ACCESS_KEY"; + var ENV_SESSION = "AWS_SESSION_TOKEN"; + var ENV_EXPIRATION = "AWS_CREDENTIAL_EXPIRATION"; + var ENV_CREDENTIAL_SCOPE = "AWS_CREDENTIAL_SCOPE"; + var ENV_ACCOUNT_ID = "AWS_ACCOUNT_ID"; + var fromEnv = /* @__PURE__ */ __name((init) => async () => { + var _a; + (_a = init == null ? void 0 : init.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-env - fromEnv"); + const accessKeyId = process.env[ENV_KEY]; + const secretAccessKey = process.env[ENV_SECRET]; + const sessionToken = process.env[ENV_SESSION]; + const expiry = process.env[ENV_EXPIRATION]; + const credentialScope = process.env[ENV_CREDENTIAL_SCOPE]; + const accountId = process.env[ENV_ACCOUNT_ID]; + if (accessKeyId && secretAccessKey) { + return { + accessKeyId, + secretAccessKey, + ...sessionToken && { sessionToken }, + ...expiry && { expiration: new Date(expiry) }, + ...credentialScope && { credentialScope }, + ...accountId && { accountId } + }; } + throw new import_property_provider2.CredentialsProviderError("Unable to find environment variable credentials.", { logger: init == null ? void 0 : init.logger }); + }, "fromEnv"); + } +}); + +// ../../../node_modules/@smithy/credential-provider-imds/dist-cjs/index.js +var require_dist_cjs49 = __commonJS({ + "../../../node_modules/@smithy/credential-provider-imds/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - exports2.InvalidScopeException = InvalidScopeException; - var SlowDownException = class _SlowDownException extends SSOOIDCServiceException { - constructor(opts) { - super({ - name: "SlowDownException", - $fault: "client", - ...opts - }); - this.name = "SlowDownException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _SlowDownException.prototype); - this.error = opts.error; - this.error_description = opts.error_description; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - exports2.SlowDownException = SlowDownException; - var UnauthorizedClientException = class _UnauthorizedClientException extends SSOOIDCServiceException { - constructor(opts) { - super({ - name: "UnauthorizedClientException", - $fault: "client", - ...opts + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + DEFAULT_MAX_RETRIES: () => DEFAULT_MAX_RETRIES, + DEFAULT_TIMEOUT: () => DEFAULT_TIMEOUT, + ENV_CMDS_AUTH_TOKEN: () => ENV_CMDS_AUTH_TOKEN, + ENV_CMDS_FULL_URI: () => ENV_CMDS_FULL_URI, + ENV_CMDS_RELATIVE_URI: () => ENV_CMDS_RELATIVE_URI, + Endpoint: () => Endpoint, + fromContainerMetadata: () => fromContainerMetadata, + fromInstanceMetadata: () => fromInstanceMetadata, + getInstanceMetadataEndpoint: () => getInstanceMetadataEndpoint, + httpRequest: () => httpRequest, + providerConfigFromInit: () => providerConfigFromInit + }); + module2.exports = __toCommonJS2(src_exports); + var import_url = require("url"); + var import_property_provider2 = require_dist_cjs40(); + var import_buffer = require("buffer"); + var import_http2 = require("http"); + function httpRequest(options) { + return new Promise((resolve, reject) => { + var _a; + const req = (0, import_http2.request)({ + method: "GET", + ...options, + // Node.js http module doesn't accept hostname with square brackets + // Refs: https://github.com/nodejs/node/issues/39738 + hostname: (_a = options.hostname) == null ? void 0 : _a.replace(/^\[(.+)\]$/, "$1") }); - this.name = "UnauthorizedClientException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _UnauthorizedClientException.prototype); - this.error = opts.error; - this.error_description = opts.error_description; - } - }; - exports2.UnauthorizedClientException = UnauthorizedClientException; - var UnsupportedGrantTypeException = class _UnsupportedGrantTypeException extends SSOOIDCServiceException { - constructor(opts) { - super({ - name: "UnsupportedGrantTypeException", - $fault: "client", - ...opts + req.on("error", (err) => { + reject(Object.assign(new import_property_provider2.ProviderError("Unable to connect to instance metadata service"), err)); + req.destroy(); }); - this.name = "UnsupportedGrantTypeException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _UnsupportedGrantTypeException.prototype); - this.error = opts.error; - this.error_description = opts.error_description; - } - }; - exports2.UnsupportedGrantTypeException = UnsupportedGrantTypeException; - var InvalidClientMetadataException = class _InvalidClientMetadataException extends SSOOIDCServiceException { - constructor(opts) { - super({ - name: "InvalidClientMetadataException", - $fault: "client", - ...opts + req.on("timeout", () => { + reject(new import_property_provider2.ProviderError("TimeoutError from instance metadata service")); + req.destroy(); }); - this.name = "InvalidClientMetadataException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidClientMetadataException.prototype); - this.error = opts.error; - this.error_description = opts.error_description; - } - }; - var se_CreateTokenCommand = async (input, context) => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers = { - "content-type": "application/json" - }; - const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}/token`; - let body; - body = JSON.stringify((0, smithy_client_7.take)(input, { - clientId: [], - clientSecret: [], - code: [], - deviceCode: [], - grantType: [], - redirectUri: [], - refreshToken: [], - scope: (_) => (0, smithy_client_7._json)(_) - })); - return new protocol_http_1.HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body - }); - }; - var se_RegisterClientCommand = async (input, context) => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers = { - "content-type": "application/json" - }; - const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}/client/register`; - let body; - body = JSON.stringify((0, smithy_client_7.take)(input, { - clientName: [], - clientType: [], - scopes: (_) => (0, smithy_client_7._json)(_) - })); - return new protocol_http_1.HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body - }); - }; - var se_StartDeviceAuthorizationCommand = async (input, context) => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); - const headers = { - "content-type": "application/json" - }; - const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}/device_authorization`; - let body; - body = JSON.stringify((0, smithy_client_7.take)(input, { - clientId: [], - clientSecret: [], - startUrl: [] - })); - return new protocol_http_1.HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body + req.on("response", (res) => { + const { statusCode = 400 } = res; + if (statusCode < 200 || 300 <= statusCode) { + reject( + Object.assign(new import_property_provider2.ProviderError("Error response received from instance metadata service"), { statusCode }) + ); + req.destroy(); + } + const chunks = []; + res.on("data", (chunk) => { + chunks.push(chunk); + }); + res.on("end", () => { + resolve(import_buffer.Buffer.concat(chunks)); + req.destroy(); + }); + }); + req.end(); }); - }; - var de_CreateTokenCommand = async (output, context) => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return de_CreateTokenCommandError(output, context); + } + __name(httpRequest, "httpRequest"); + var isImdsCredentials = /* @__PURE__ */ __name((arg) => Boolean(arg) && typeof arg === "object" && typeof arg.AccessKeyId === "string" && typeof arg.SecretAccessKey === "string" && typeof arg.Token === "string" && typeof arg.Expiration === "string", "isImdsCredentials"); + var fromImdsCredentials = /* @__PURE__ */ __name((creds) => ({ + accessKeyId: creds.AccessKeyId, + secretAccessKey: creds.SecretAccessKey, + sessionToken: creds.Token, + expiration: new Date(creds.Expiration), + ...creds.AccountId && { accountId: creds.AccountId } + }), "fromImdsCredentials"); + var DEFAULT_TIMEOUT = 1e3; + var DEFAULT_MAX_RETRIES = 0; + var providerConfigFromInit = /* @__PURE__ */ __name(({ + maxRetries = DEFAULT_MAX_RETRIES, + timeout = DEFAULT_TIMEOUT + }) => ({ maxRetries, timeout }), "providerConfigFromInit"); + var retry = /* @__PURE__ */ __name((toRetry, maxRetries) => { + let promise = toRetry(); + for (let i = 0; i < maxRetries; i++) { + promise = promise.catch(toRetry); } - const contents = (0, smithy_client_7.map)({ - $metadata: deserializeMetadata(output) - }); - const data = (0, smithy_client_7.expectNonNull)((0, smithy_client_7.expectObject)(await parseBody(output.body, context)), "body"); - const doc = (0, smithy_client_7.take)(data, { - accessToken: smithy_client_7.expectString, - expiresIn: smithy_client_7.expectInt32, - idToken: smithy_client_7.expectString, - refreshToken: smithy_client_7.expectString, - tokenType: smithy_client_7.expectString + return promise; + }, "retry"); + var ENV_CMDS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI"; + var ENV_CMDS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"; + var ENV_CMDS_AUTH_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN"; + var fromContainerMetadata = /* @__PURE__ */ __name((init = {}) => { + const { timeout, maxRetries } = providerConfigFromInit(init); + return () => retry(async () => { + const requestOptions = await getCmdsUri({ logger: init.logger }); + const credsResponse = JSON.parse(await requestFromEcsImds(timeout, requestOptions)); + if (!isImdsCredentials(credsResponse)) { + throw new import_property_provider2.CredentialsProviderError("Invalid response received from instance metadata service.", { + logger: init.logger + }); + } + return fromImdsCredentials(credsResponse); + }, maxRetries); + }, "fromContainerMetadata"); + var requestFromEcsImds = /* @__PURE__ */ __name(async (timeout, options) => { + if (process.env[ENV_CMDS_AUTH_TOKEN]) { + options.headers = { + ...options.headers, + Authorization: process.env[ENV_CMDS_AUTH_TOKEN] + }; + } + const buffer = await httpRequest({ + ...options, + timeout }); - Object.assign(contents, doc); - return contents; + return buffer.toString(); + }, "requestFromEcsImds"); + var CMDS_IP = "169.254.170.2"; + var GREENGRASS_HOSTS = { + localhost: true, + "127.0.0.1": true }; - var de_CreateTokenCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "AccessDeniedException": - case "com.amazonaws.ssooidc#AccessDeniedException": - throw await de_AccessDeniedExceptionRes(parsedOutput, context); - case "AuthorizationPendingException": - case "com.amazonaws.ssooidc#AuthorizationPendingException": - throw await de_AuthorizationPendingExceptionRes(parsedOutput, context); - case "ExpiredTokenException": - case "com.amazonaws.ssooidc#ExpiredTokenException": - throw await de_ExpiredTokenExceptionRes(parsedOutput, context); - case "InternalServerException": - case "com.amazonaws.ssooidc#InternalServerException": - throw await de_InternalServerExceptionRes(parsedOutput, context); - case "InvalidClientException": - case "com.amazonaws.ssooidc#InvalidClientException": - throw await de_InvalidClientExceptionRes(parsedOutput, context); - case "InvalidGrantException": - case "com.amazonaws.ssooidc#InvalidGrantException": - throw await de_InvalidGrantExceptionRes(parsedOutput, context); - case "InvalidRequestException": - case "com.amazonaws.ssooidc#InvalidRequestException": - throw await de_InvalidRequestExceptionRes(parsedOutput, context); - case "InvalidScopeException": - case "com.amazonaws.ssooidc#InvalidScopeException": - throw await de_InvalidScopeExceptionRes(parsedOutput, context); - case "SlowDownException": - case "com.amazonaws.ssooidc#SlowDownException": - throw await de_SlowDownExceptionRes(parsedOutput, context); - case "UnauthorizedClientException": - case "com.amazonaws.ssooidc#UnauthorizedClientException": - throw await de_UnauthorizedClientExceptionRes(parsedOutput, context); - case "UnsupportedGrantTypeException": - case "com.amazonaws.ssooidc#UnsupportedGrantTypeException": - throw await de_UnsupportedGrantTypeExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode + var GREENGRASS_PROTOCOLS = { + "http:": true, + "https:": true + }; + var getCmdsUri = /* @__PURE__ */ __name(async ({ logger }) => { + if (process.env[ENV_CMDS_RELATIVE_URI]) { + return { + hostname: CMDS_IP, + path: process.env[ENV_CMDS_RELATIVE_URI] + }; + } + if (process.env[ENV_CMDS_FULL_URI]) { + const parsed = (0, import_url.parse)(process.env[ENV_CMDS_FULL_URI]); + if (!parsed.hostname || !(parsed.hostname in GREENGRASS_HOSTS)) { + throw new import_property_provider2.CredentialsProviderError(`${parsed.hostname} is not a valid container metadata service hostname`, { + tryNextLink: false, + logger + }); + } + if (!parsed.protocol || !(parsed.protocol in GREENGRASS_PROTOCOLS)) { + throw new import_property_provider2.CredentialsProviderError(`${parsed.protocol} is not a valid container metadata service protocol`, { + tryNextLink: false, + logger }); + } + return { + ...parsed, + port: parsed.port ? parseInt(parsed.port, 10) : void 0 + }; } - }; - var de_RegisterClientCommand = async (output, context) => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return de_RegisterClientCommandError(output, context); + throw new import_property_provider2.CredentialsProviderError( + `The container metadata credential provider cannot be used unless the ${ENV_CMDS_RELATIVE_URI} or ${ENV_CMDS_FULL_URI} environment variable is set`, + { + tryNextLink: false, + logger + } + ); + }, "getCmdsUri"); + var _InstanceMetadataV1FallbackError = class _InstanceMetadataV1FallbackError2 extends import_property_provider2.CredentialsProviderError { + constructor(message, tryNextLink = true) { + super(message, tryNextLink); + this.tryNextLink = tryNextLink; + this.name = "InstanceMetadataV1FallbackError"; + Object.setPrototypeOf(this, _InstanceMetadataV1FallbackError2.prototype); } - const contents = (0, smithy_client_7.map)({ - $metadata: deserializeMetadata(output) - }); - const data = (0, smithy_client_7.expectNonNull)((0, smithy_client_7.expectObject)(await parseBody(output.body, context)), "body"); - const doc = (0, smithy_client_7.take)(data, { - authorizationEndpoint: smithy_client_7.expectString, - clientId: smithy_client_7.expectString, - clientIdIssuedAt: smithy_client_7.expectLong, - clientSecret: smithy_client_7.expectString, - clientSecretExpiresAt: smithy_client_7.expectLong, - tokenEndpoint: smithy_client_7.expectString - }); - Object.assign(contents, doc); - return contents; }; - var de_RegisterClientCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InternalServerException": - case "com.amazonaws.ssooidc#InternalServerException": - throw await de_InternalServerExceptionRes(parsedOutput, context); - case "InvalidClientMetadataException": - case "com.amazonaws.ssooidc#InvalidClientMetadataException": - throw await de_InvalidClientMetadataExceptionRes(parsedOutput, context); - case "InvalidRequestException": - case "com.amazonaws.ssooidc#InvalidRequestException": - throw await de_InvalidRequestExceptionRes(parsedOutput, context); - case "InvalidScopeException": - case "com.amazonaws.ssooidc#InvalidScopeException": - throw await de_InvalidScopeExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); - } + __name(_InstanceMetadataV1FallbackError, "InstanceMetadataV1FallbackError"); + var InstanceMetadataV1FallbackError = _InstanceMetadataV1FallbackError; + var import_node_config_provider = require_dist_cjs42(); + var import_url_parser = require_dist_cjs44(); + var Endpoint = /* @__PURE__ */ ((Endpoint2) => { + Endpoint2["IPv4"] = "http://169.254.169.254"; + Endpoint2["IPv6"] = "http://[fd00:ec2::254]"; + return Endpoint2; + })(Endpoint || {}); + var ENV_ENDPOINT_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT"; + var CONFIG_ENDPOINT_NAME = "ec2_metadata_service_endpoint"; + var ENDPOINT_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => env[ENV_ENDPOINT_NAME], + configFileSelector: (profile) => profile[CONFIG_ENDPOINT_NAME], + default: void 0 }; - var de_StartDeviceAuthorizationCommand = async (output, context) => { - if (output.statusCode !== 200 && output.statusCode >= 300) { - return de_StartDeviceAuthorizationCommandError(output, context); - } - const contents = (0, smithy_client_7.map)({ - $metadata: deserializeMetadata(output) - }); - const data = (0, smithy_client_7.expectNonNull)((0, smithy_client_7.expectObject)(await parseBody(output.body, context)), "body"); - const doc = (0, smithy_client_7.take)(data, { - deviceCode: smithy_client_7.expectString, - expiresIn: smithy_client_7.expectInt32, - interval: smithy_client_7.expectInt32, - userCode: smithy_client_7.expectString, - verificationUri: smithy_client_7.expectString, - verificationUriComplete: smithy_client_7.expectString - }); - Object.assign(contents, doc); - return contents; + var EndpointMode = /* @__PURE__ */ ((EndpointMode2) => { + EndpointMode2["IPv4"] = "IPv4"; + EndpointMode2["IPv6"] = "IPv6"; + return EndpointMode2; + })(EndpointMode || {}); + var ENV_ENDPOINT_MODE_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE"; + var CONFIG_ENDPOINT_MODE_NAME = "ec2_metadata_service_endpoint_mode"; + var ENDPOINT_MODE_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => env[ENV_ENDPOINT_MODE_NAME], + configFileSelector: (profile) => profile[CONFIG_ENDPOINT_MODE_NAME], + default: "IPv4" + /* IPv4 */ }; - var de_StartDeviceAuthorizationCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InternalServerException": - case "com.amazonaws.ssooidc#InternalServerException": - throw await de_InternalServerExceptionRes(parsedOutput, context); - case "InvalidClientException": - case "com.amazonaws.ssooidc#InvalidClientException": - throw await de_InvalidClientExceptionRes(parsedOutput, context); - case "InvalidRequestException": - case "com.amazonaws.ssooidc#InvalidRequestException": - throw await de_InvalidRequestExceptionRes(parsedOutput, context); - case "SlowDownException": - case "com.amazonaws.ssooidc#SlowDownException": - throw await de_SlowDownExceptionRes(parsedOutput, context); - case "UnauthorizedClientException": - case "com.amazonaws.ssooidc#UnauthorizedClientException": - throw await de_UnauthorizedClientExceptionRes(parsedOutput, context); + var getInstanceMetadataEndpoint = /* @__PURE__ */ __name(async () => (0, import_url_parser.parseUrl)(await getFromEndpointConfig() || await getFromEndpointModeConfig()), "getInstanceMetadataEndpoint"); + var getFromEndpointConfig = /* @__PURE__ */ __name(async () => (0, import_node_config_provider.loadConfig)(ENDPOINT_CONFIG_OPTIONS)(), "getFromEndpointConfig"); + var getFromEndpointModeConfig = /* @__PURE__ */ __name(async () => { + const endpointMode = await (0, import_node_config_provider.loadConfig)(ENDPOINT_MODE_CONFIG_OPTIONS)(); + switch (endpointMode) { + case "IPv4": + return "http://169.254.169.254"; + case "IPv6": + return "http://[fd00:ec2::254]"; default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode + throw new Error(`Unsupported endpoint mode: ${endpointMode}. Select from ${Object.values(EndpointMode)}`); + } + }, "getFromEndpointModeConfig"); + var STATIC_STABILITY_REFRESH_INTERVAL_SECONDS = 5 * 60; + var STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS = 5 * 60; + var STATIC_STABILITY_DOC_URL = "https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html"; + var getExtendedInstanceMetadataCredentials = /* @__PURE__ */ __name((credentials, logger) => { + const refreshInterval = STATIC_STABILITY_REFRESH_INTERVAL_SECONDS + Math.floor(Math.random() * STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS); + const newExpiration = new Date(Date.now() + refreshInterval * 1e3); + logger.warn( + `Attempting credential expiration extension due to a credential service availability issue. A refresh of these credentials will be attempted after ${new Date(newExpiration)}. +For more information, please visit: ` + STATIC_STABILITY_DOC_URL + ); + const originalExpiration = credentials.originalExpiration ?? credentials.expiration; + return { + ...credentials, + ...originalExpiration ? { originalExpiration } : {}, + expiration: newExpiration + }; + }, "getExtendedInstanceMetadataCredentials"); + var staticStabilityProvider = /* @__PURE__ */ __name((provider, options = {}) => { + const logger = (options == null ? void 0 : options.logger) || console; + let pastCredentials; + return async () => { + let credentials; + try { + credentials = await provider(); + if (credentials.expiration && credentials.expiration.getTime() < Date.now()) { + credentials = getExtendedInstanceMetadataCredentials(credentials, logger); + } + } catch (e) { + if (pastCredentials) { + logger.warn("Credential renew failed: ", e); + credentials = getExtendedInstanceMetadataCredentials(pastCredentials, logger); + } else { + throw e; + } + } + pastCredentials = credentials; + return credentials; + }; + }, "staticStabilityProvider"); + var IMDS_PATH = "/latest/meta-data/iam/security-credentials/"; + var IMDS_TOKEN_PATH = "/latest/api/token"; + var AWS_EC2_METADATA_V1_DISABLED = "AWS_EC2_METADATA_V1_DISABLED"; + var PROFILE_AWS_EC2_METADATA_V1_DISABLED = "ec2_metadata_v1_disabled"; + var X_AWS_EC2_METADATA_TOKEN = "x-aws-ec2-metadata-token"; + var fromInstanceMetadata = /* @__PURE__ */ __name((init = {}) => staticStabilityProvider(getInstanceMetadataProvider(init), { logger: init.logger }), "fromInstanceMetadata"); + var getInstanceMetadataProvider = /* @__PURE__ */ __name((init = {}) => { + let disableFetchToken = false; + const { logger, profile } = init; + const { timeout, maxRetries } = providerConfigFromInit(init); + const getCredentials = /* @__PURE__ */ __name(async (maxRetries2, options) => { + var _a; + const isImdsV1Fallback = disableFetchToken || ((_a = options.headers) == null ? void 0 : _a[X_AWS_EC2_METADATA_TOKEN]) == null; + if (isImdsV1Fallback) { + let fallbackBlockedFromProfile = false; + let fallbackBlockedFromProcessEnv = false; + const configValue = await (0, import_node_config_provider.loadConfig)( + { + environmentVariableSelector: (env) => { + const envValue = env[AWS_EC2_METADATA_V1_DISABLED]; + fallbackBlockedFromProcessEnv = !!envValue && envValue !== "false"; + if (envValue === void 0) { + throw new import_property_provider2.CredentialsProviderError( + `${AWS_EC2_METADATA_V1_DISABLED} not set in env, checking config file next.`, + { logger: init.logger } + ); + } + return fallbackBlockedFromProcessEnv; + }, + configFileSelector: (profile2) => { + const profileValue = profile2[PROFILE_AWS_EC2_METADATA_V1_DISABLED]; + fallbackBlockedFromProfile = !!profileValue && profileValue !== "false"; + return fallbackBlockedFromProfile; + }, + default: false + }, + { + profile + } + )(); + if (init.ec2MetadataV1Disabled || configValue) { + const causes = []; + if (init.ec2MetadataV1Disabled) + causes.push("credential provider initialization (runtime option ec2MetadataV1Disabled)"); + if (fallbackBlockedFromProfile) + causes.push(`config file profile (${PROFILE_AWS_EC2_METADATA_V1_DISABLED})`); + if (fallbackBlockedFromProcessEnv) + causes.push(`process environment variable (${AWS_EC2_METADATA_V1_DISABLED})`); + throw new InstanceMetadataV1FallbackError( + `AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${causes.join( + ", " + )}].` + ); + } + } + const imdsProfile = (await retry(async () => { + let profile2; + try { + profile2 = await getProfile(options); + } catch (err) { + if (err.statusCode === 401) { + disableFetchToken = false; + } + throw err; + } + return profile2; + }, maxRetries2)).trim(); + return retry(async () => { + let creds; + try { + creds = await getCredentialsFromProfile(imdsProfile, options, init); + } catch (err) { + if (err.statusCode === 401) { + disableFetchToken = false; + } + throw err; + } + return creds; + }, maxRetries2); + }, "getCredentials"); + return async () => { + const endpoint = await getInstanceMetadataEndpoint(); + if (disableFetchToken) { + logger == null ? void 0 : logger.debug("AWS SDK Instance Metadata", "using v1 fallback (no token fetch)"); + return getCredentials(maxRetries, { ...endpoint, timeout }); + } else { + let token; + try { + token = (await getMetadataToken({ ...endpoint, timeout })).toString(); + } catch (error) { + if ((error == null ? void 0 : error.statusCode) === 400) { + throw Object.assign(error, { + message: "EC2 Metadata token request returned error" + }); + } else if (error.message === "TimeoutError" || [403, 404, 405].includes(error.statusCode)) { + disableFetchToken = true; + } + logger == null ? void 0 : logger.debug("AWS SDK Instance Metadata", "using v1 fallback (initial)"); + return getCredentials(maxRetries, { ...endpoint, timeout }); + } + return getCredentials(maxRetries, { + ...endpoint, + headers: { + [X_AWS_EC2_METADATA_TOKEN]: token + }, + timeout }); - } - }; - var throwDefaultError = (0, smithy_client_7.withBaseException)(SSOOIDCServiceException); - var de_AccessDeniedExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_7.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_7.take)(data, { - error: smithy_client_7.expectString, - error_description: smithy_client_7.expectString - }); - Object.assign(contents, doc); - const exception = new AccessDeniedException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); - }; - var de_AuthorizationPendingExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_7.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_7.take)(data, { - error: smithy_client_7.expectString, - error_description: smithy_client_7.expectString - }); - Object.assign(contents, doc); - const exception = new AuthorizationPendingException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); - }; - var de_ExpiredTokenExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_7.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_7.take)(data, { - error: smithy_client_7.expectString, - error_description: smithy_client_7.expectString - }); - Object.assign(contents, doc); - const exception = new ExpiredTokenException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); - }; - var de_InternalServerExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_7.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_7.take)(data, { - error: smithy_client_7.expectString, - error_description: smithy_client_7.expectString - }); - Object.assign(contents, doc); - const exception = new InternalServerException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); - }; - var de_InvalidClientExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_7.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_7.take)(data, { - error: smithy_client_7.expectString, - error_description: smithy_client_7.expectString - }); - Object.assign(contents, doc); - const exception = new InvalidClientException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); - }; - var de_InvalidClientMetadataExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_7.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_7.take)(data, { - error: smithy_client_7.expectString, - error_description: smithy_client_7.expectString - }); - Object.assign(contents, doc); - const exception = new InvalidClientMetadataException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); - }; - var de_InvalidGrantExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_7.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_7.take)(data, { - error: smithy_client_7.expectString, - error_description: smithy_client_7.expectString - }); - Object.assign(contents, doc); - const exception = new InvalidGrantException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); - }; - var de_InvalidRequestExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_7.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_7.take)(data, { - error: smithy_client_7.expectString, - error_description: smithy_client_7.expectString - }); - Object.assign(contents, doc); - const exception = new InvalidRequestException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); - }; - var de_InvalidScopeExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_7.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_7.take)(data, { - error: smithy_client_7.expectString, - error_description: smithy_client_7.expectString - }); - Object.assign(contents, doc); - const exception = new InvalidScopeException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); - }; - var de_SlowDownExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_7.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_7.take)(data, { - error: smithy_client_7.expectString, - error_description: smithy_client_7.expectString - }); - Object.assign(contents, doc); - const exception = new SlowDownException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); - }; - var de_UnauthorizedClientExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_7.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_7.take)(data, { - error: smithy_client_7.expectString, - error_description: smithy_client_7.expectString - }); - Object.assign(contents, doc); - const exception = new UnauthorizedClientException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); - }; - var de_UnsupportedGrantTypeExceptionRes = async (parsedOutput, context) => { - const contents = (0, smithy_client_7.map)({}); - const data = parsedOutput.body; - const doc = (0, smithy_client_7.take)(data, { - error: smithy_client_7.expectString, - error_description: smithy_client_7.expectString - }); - Object.assign(contents, doc); - const exception = new UnsupportedGrantTypeException({ - $metadata: deserializeMetadata(parsedOutput), - ...contents - }); - return (0, smithy_client_7.decorateServiceException)(exception, parsedOutput.body); - }; - var deserializeMetadata = (output) => { - var _a, _b; - return { - httpStatusCode: output.statusCode, - requestId: (_b = (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"]) !== null && _b !== void 0 ? _b : output.headers["x-amz-request-id"], - extendedRequestId: output.headers["x-amz-id-2"], - cfId: output.headers["x-amz-cf-id"] + } }; + }, "getInstanceMetadataProvider"); + var getMetadataToken = /* @__PURE__ */ __name(async (options) => httpRequest({ + ...options, + path: IMDS_TOKEN_PATH, + method: "PUT", + headers: { + "x-aws-ec2-metadata-token-ttl-seconds": "21600" + } + }), "getMetadataToken"); + var getProfile = /* @__PURE__ */ __name(async (options) => (await httpRequest({ ...options, path: IMDS_PATH })).toString(), "getProfile"); + var getCredentialsFromProfile = /* @__PURE__ */ __name(async (profile, options, init) => { + const credentialsResponse = JSON.parse( + (await httpRequest({ + ...options, + path: IMDS_PATH + profile + })).toString() + ); + if (!isImdsCredentials(credentialsResponse)) { + throw new import_property_provider2.CredentialsProviderError("Invalid response received from instance metadata service.", { + logger: init.logger + }); + } + return fromImdsCredentials(credentialsResponse); + }, "getCredentialsFromProfile"); + } +}); + +// ../../../node_modules/@smithy/node-http-handler/node_modules/@smithy/querystring-builder/dist-cjs/index.js +var require_dist_cjs50 = __commonJS({ + "../../../node_modules/@smithy/node-http-handler/node_modules/@smithy/querystring-builder/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var collectBodyString = (streamBody, context) => (0, smithy_client_7.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)); - var parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => { - if (encoded.length) { - return JSON.parse(encoded); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - return {}; - }); - var parseErrorBody = async (errorBody, context) => { - var _a; - const value = await parseBody(errorBody, context); - value.message = (_a = value.message) !== null && _a !== void 0 ? _a : value.Message; - return value; + return to; }; - var loadRestJsonErrorCode = (output, data) => { - const findKey = (object, key) => Object.keys(object).find((k2) => k2.toLowerCase() === key.toLowerCase()); - const sanitizeErrorCode = (rawValue) => { - let cleanValue = rawValue; - if (typeof cleanValue === "number") { - cleanValue = cleanValue.toString(); - } - if (cleanValue.indexOf(",") >= 0) { - cleanValue = cleanValue.split(",")[0]; - } - if (cleanValue.indexOf(":") >= 0) { - cleanValue = cleanValue.split(":")[0]; - } - if (cleanValue.indexOf("#") >= 0) { - cleanValue = cleanValue.split("#")[1]; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + buildQueryString: () => buildQueryString + }); + module2.exports = __toCommonJS2(src_exports); + var import_util_uri_escape = require_dist_cjs31(); + function buildQueryString(query) { + const parts = []; + for (let key of Object.keys(query).sort()) { + const value = query[key]; + key = (0, import_util_uri_escape.escapeUri)(key); + if (Array.isArray(value)) { + for (let i = 0, iLen = value.length; i < iLen; i++) { + parts.push(`${key}=${(0, import_util_uri_escape.escapeUri)(value[i])}`); + } + } else { + let qsEntry = key; + if (value || typeof value === "string") { + qsEntry += `=${(0, import_util_uri_escape.escapeUri)(value)}`; + } + parts.push(qsEntry); } - return cleanValue; - }; - const headerKey = findKey(output.headers, "x-amzn-errortype"); - if (headerKey !== void 0) { - return sanitizeErrorCode(output.headers[headerKey]); - } - if (data.code !== void 0) { - return sanitizeErrorCode(data.code); } - if (data["__type"] !== void 0) { - return sanitizeErrorCode(data["__type"]); + return parts.join("&"); + } + __name(buildQueryString, "buildQueryString"); + } +}); + +// ../../../node_modules/@smithy/node-http-handler/dist-cjs/index.js +var require_dist_cjs51 = __commonJS({ + "../../../node_modules/@smithy/node-http-handler/dist-cjs/index.js"(exports2, module2) { + var __create2 = Object.create; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __getProtoOf2 = Object.getPrototypeOf; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - var CreateTokenCommand = class _CreateTokenCommand extends smithy_client_6.Command { - constructor(input) { - super(); - this.input = input; + var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, + mod + )); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + DEFAULT_REQUEST_TIMEOUT: () => DEFAULT_REQUEST_TIMEOUT, + NodeHttp2Handler: () => NodeHttp2Handler, + NodeHttpHandler: () => NodeHttpHandler, + streamCollector: () => streamCollector + }); + module2.exports = __toCommonJS2(src_exports); + var import_protocol_http8 = require_dist_cjs2(); + var import_querystring_builder = require_dist_cjs50(); + var import_http2 = require("http"); + var import_https = require("https"); + var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "EPIPE", "ETIMEDOUT"]; + var getTransformedHeaders = /* @__PURE__ */ __name((headers) => { + const transformedHeaders = {}; + for (const name of Object.keys(headers)) { + const headerValues = headers[name]; + transformedHeaders[name] = Array.isArray(headerValues) ? headerValues.join(",") : headerValues; + } + return transformedHeaders; + }, "getTransformedHeaders"); + var DEFER_EVENT_LISTENER_TIME = 1e3; + var setConnectionTimeout = /* @__PURE__ */ __name((request2, reject, timeoutInMs = 0) => { + if (!timeoutInMs) { + return -1; + } + const registerTimeout = /* @__PURE__ */ __name((offset) => { + const timeoutId = setTimeout(() => { + request2.destroy(); + reject( + Object.assign(new Error(`Socket timed out without establishing a connection within ${timeoutInMs} ms`), { + name: "TimeoutError" + }) + ); + }, timeoutInMs - offset); + const doWithSocket = /* @__PURE__ */ __name((socket) => { + if (socket == null ? void 0 : socket.connecting) { + socket.on("connect", () => { + clearTimeout(timeoutId); + }); + } else { + clearTimeout(timeoutId); + } + }, "doWithSocket"); + if (request2.socket) { + doWithSocket(request2.socket); + } else { + request2.on("socket", doWithSocket); + } + }, "registerTimeout"); + if (timeoutInMs < 2e3) { + registerTimeout(0); + return 0; } - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + return setTimeout(registerTimeout.bind(null, DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME); + }, "setConnectionTimeout"); + var DEFER_EVENT_LISTENER_TIME2 = 3e3; + var setSocketKeepAlive = /* @__PURE__ */ __name((request2, { keepAlive, keepAliveMsecs }, deferTimeMs = DEFER_EVENT_LISTENER_TIME2) => { + if (keepAlive !== true) { + return -1; } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_2.getEndpointPlugin)(configuration, _CreateTokenCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SSOOIDCClient"; - const commandName = "CreateTokenCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _ - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + const registerListener = /* @__PURE__ */ __name(() => { + if (request2.socket) { + request2.socket.setKeepAlive(keepAlive, keepAliveMsecs || 0); + } else { + request2.on("socket", (socket) => { + socket.setKeepAlive(keepAlive, keepAliveMsecs || 0); + }); + } + }, "registerListener"); + if (deferTimeMs === 0) { + registerListener(); + return 0; } - serialize(input, context) { - return se_CreateTokenCommand(input, context); + return setTimeout(registerListener, deferTimeMs); + }, "setSocketKeepAlive"); + var DEFER_EVENT_LISTENER_TIME3 = 3e3; + var setSocketTimeout = /* @__PURE__ */ __name((request2, reject, timeoutInMs = 0) => { + const registerTimeout = /* @__PURE__ */ __name((offset) => { + request2.setTimeout(timeoutInMs - offset, () => { + request2.destroy(); + reject(Object.assign(new Error(`Connection timed out after ${timeoutInMs} ms`), { name: "TimeoutError" })); + }); + }, "registerTimeout"); + if (0 < timeoutInMs && timeoutInMs < 6e3) { + registerTimeout(0); + return 0; } - deserialize(output, context) { - return de_CreateTokenCommand(output, context); + return setTimeout( + registerTimeout.bind(null, timeoutInMs === 0 ? 0 : DEFER_EVENT_LISTENER_TIME3), + DEFER_EVENT_LISTENER_TIME3 + ); + }, "setSocketTimeout"); + var import_stream = require("stream"); + var MIN_WAIT_TIME = 1e3; + async function writeRequestBody(httpRequest, request2, maxContinueTimeoutMs = MIN_WAIT_TIME) { + const headers = request2.headers ?? {}; + const expect = headers["Expect"] || headers["expect"]; + let timeoutId = -1; + let hasError = false; + if (expect === "100-continue") { + await Promise.race([ + new Promise((resolve) => { + timeoutId = Number(setTimeout(resolve, Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs))); + }), + new Promise((resolve) => { + httpRequest.on("continue", () => { + clearTimeout(timeoutId); + resolve(); + }); + httpRequest.on("error", () => { + hasError = true; + clearTimeout(timeoutId); + resolve(); + }); + }) + ]); } - }; - exports2.CreateTokenCommand = CreateTokenCommand; - var middleware_endpoint_3 = require_dist_cjs26(); - var middleware_serde_2 = require_dist_cjs25(); - var smithy_client_9 = require_dist_cjs34(); - var RegisterClientCommand = class _RegisterClientCommand extends smithy_client_9.Command { - constructor(input) { - super(); - this.input = input; + if (!hasError) { + writeBody(httpRequest, request2.body); } - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + } + __name(writeRequestBody, "writeRequestBody"); + function writeBody(httpRequest, body) { + if (body instanceof import_stream.Readable) { + body.pipe(httpRequest); + return; } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_2.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_3.getEndpointPlugin)(configuration, _RegisterClientCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SSOOIDCClient"; - const commandName = "RegisterClientCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _ - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + if (body) { + if (Buffer.isBuffer(body) || typeof body === "string") { + httpRequest.end(body); + return; + } + const uint8 = body; + if (typeof uint8 === "object" && uint8.buffer && typeof uint8.byteOffset === "number" && typeof uint8.byteLength === "number") { + httpRequest.end(Buffer.from(uint8.buffer, uint8.byteOffset, uint8.byteLength)); + return; + } + httpRequest.end(Buffer.from(body)); + return; } - serialize(input, context) { - return se_RegisterClientCommand(input, context); + httpRequest.end(); + } + __name(writeBody, "writeBody"); + var DEFAULT_REQUEST_TIMEOUT = 0; + var _NodeHttpHandler = class _NodeHttpHandler2 { + constructor(options) { + this.socketWarningTimestamp = 0; + this.metadata = { handlerProtocol: "http/1.1" }; + this.configProvider = new Promise((resolve, reject) => { + if (typeof options === "function") { + options().then((_options) => { + resolve(this.resolveDefaultConfig(_options)); + }).catch(reject); + } else { + resolve(this.resolveDefaultConfig(options)); + } + }); } - deserialize(output, context) { - return de_RegisterClientCommand(output, context); + /** + * @returns the input if it is an HttpHandler of any class, + * or instantiates a new instance of this handler. + */ + static create(instanceOrOptions) { + if (typeof (instanceOrOptions == null ? void 0 : instanceOrOptions.handle) === "function") { + return instanceOrOptions; + } + return new _NodeHttpHandler2(instanceOrOptions); } - }; - var middleware_endpoint_4 = require_dist_cjs26(); - var middleware_serde_3 = require_dist_cjs25(); - var smithy_client_10 = require_dist_cjs34(); - var StartDeviceAuthorizationCommand = class _StartDeviceAuthorizationCommand extends smithy_client_10.Command { - constructor(input) { - super(); - this.input = input; + /** + * @internal + * + * @param agent - http(s) agent in use by the NodeHttpHandler instance. + * @param socketWarningTimestamp - last socket usage check timestamp. + * @param logger - channel for the warning. + * @returns timestamp of last emitted warning. + */ + static checkSocketUsage(agent, socketWarningTimestamp, logger = console) { + var _a, _b, _c; + const { sockets, requests, maxSockets } = agent; + if (typeof maxSockets !== "number" || maxSockets === Infinity) { + return socketWarningTimestamp; + } + const interval = 15e3; + if (Date.now() - interval < socketWarningTimestamp) { + return socketWarningTimestamp; + } + if (sockets && requests) { + for (const origin in sockets) { + const socketsInUse = ((_a = sockets[origin]) == null ? void 0 : _a.length) ?? 0; + const requestsEnqueued = ((_b = requests[origin]) == null ? void 0 : _b.length) ?? 0; + if (socketsInUse >= maxSockets && requestsEnqueued >= 2 * maxSockets) { + (_c = logger == null ? void 0 : logger.warn) == null ? void 0 : _c.call( + logger, + `@smithy/node-http-handler:WARN - socket usage at capacity=${socketsInUse} and ${requestsEnqueued} additional requests are enqueued. +See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html +or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.` + ); + return Date.now(); + } + } + } + return socketWarningTimestamp; } - static getEndpointParameterInstructions() { + resolveDefaultConfig(options) { + const { requestTimeout, connectionTimeout, socketTimeout, httpAgent, httpsAgent } = options || {}; + const keepAlive = true; + const maxSockets = 50; return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_3.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_4.getEndpointPlugin)(configuration, _StartDeviceAuthorizationCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SSOOIDCClient"; - const commandName = "StartDeviceAuthorizationCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _ + connectionTimeout, + requestTimeout: requestTimeout ?? socketTimeout, + httpAgent: (() => { + if (httpAgent instanceof import_http2.Agent || typeof (httpAgent == null ? void 0 : httpAgent.destroy) === "function") { + return httpAgent; + } + return new import_http2.Agent({ keepAlive, maxSockets, ...httpAgent }); + })(), + httpsAgent: (() => { + if (httpsAgent instanceof import_https.Agent || typeof (httpsAgent == null ? void 0 : httpsAgent.destroy) === "function") { + return httpsAgent; + } + return new import_https.Agent({ keepAlive, maxSockets, ...httpsAgent }); + })(), + logger: console }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return se_StartDeviceAuthorizationCommand(input, context); } - deserialize(output, context) { - return de_StartDeviceAuthorizationCommand(output, context); + destroy() { + var _a, _b, _c, _d; + (_b = (_a = this.config) == null ? void 0 : _a.httpAgent) == null ? void 0 : _b.destroy(); + (_d = (_c = this.config) == null ? void 0 : _c.httpsAgent) == null ? void 0 : _d.destroy(); } - }; - var commands = { - CreateTokenCommand, - RegisterClientCommand, - StartDeviceAuthorizationCommand - }; - var SSOOIDC = class extends SSOOIDCClient { - }; - (0, smithy_client_5.createAggregatedClient)(commands, SSOOIDC); - } -}); - -// ../../../node_modules/@aws-sdk/token-providers/dist-cjs/constants.js -var require_constants2 = __commonJS({ - "../../../node_modules/@aws-sdk/token-providers/dist-cjs/constants.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.REFRESH_MESSAGE = exports2.EXPIRE_WINDOW_MS = void 0; - exports2.EXPIRE_WINDOW_MS = 5 * 60 * 1e3; - exports2.REFRESH_MESSAGE = `To refresh this SSO session run 'aws sso login' with the corresponding profile.`; - } -}); - -// ../../../node_modules/@aws-sdk/token-providers/dist-cjs/getSsoOidcClient.js -var require_getSsoOidcClient = __commonJS({ - "../../../node_modules/@aws-sdk/token-providers/dist-cjs/getSsoOidcClient.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getSsoOidcClient = void 0; - var client_sso_oidc_node_1 = require_client_sso_oidc_node(); - var ssoOidcClientsHash = {}; - var getSsoOidcClient = (ssoRegion) => { - if (ssoOidcClientsHash[ssoRegion]) { - return ssoOidcClientsHash[ssoRegion]; + async handle(request2, { abortSignal } = {}) { + if (!this.config) { + this.config = await this.configProvider; + } + return new Promise((_resolve, _reject) => { + let writeRequestBodyPromise = void 0; + const timeouts = []; + const resolve = /* @__PURE__ */ __name(async (arg) => { + await writeRequestBodyPromise; + timeouts.forEach(clearTimeout); + _resolve(arg); + }, "resolve"); + const reject = /* @__PURE__ */ __name(async (arg) => { + await writeRequestBodyPromise; + timeouts.forEach(clearTimeout); + _reject(arg); + }, "reject"); + if (!this.config) { + throw new Error("Node HTTP request handler config is not resolved"); + } + if (abortSignal == null ? void 0 : abortSignal.aborted) { + const abortError = new Error("Request aborted"); + abortError.name = "AbortError"; + reject(abortError); + return; + } + const isSSL = request2.protocol === "https:"; + const agent = isSSL ? this.config.httpsAgent : this.config.httpAgent; + timeouts.push( + setTimeout( + () => { + this.socketWarningTimestamp = _NodeHttpHandler2.checkSocketUsage( + agent, + this.socketWarningTimestamp, + this.config.logger + ); + }, + this.config.socketAcquisitionWarningTimeout ?? (this.config.requestTimeout ?? 2e3) + (this.config.connectionTimeout ?? 1e3) + ) + ); + const queryString = (0, import_querystring_builder.buildQueryString)(request2.query || {}); + let auth = void 0; + if (request2.username != null || request2.password != null) { + const username = request2.username ?? ""; + const password = request2.password ?? ""; + auth = `${username}:${password}`; + } + let path = request2.path; + if (queryString) { + path += `?${queryString}`; + } + if (request2.fragment) { + path += `#${request2.fragment}`; + } + const nodeHttpsOptions = { + headers: request2.headers, + host: request2.hostname, + method: request2.method, + path, + port: request2.port, + agent, + auth + }; + const requestFunc = isSSL ? import_https.request : import_http2.request; + const req = requestFunc(nodeHttpsOptions, (res) => { + const httpResponse = new import_protocol_http8.HttpResponse({ + statusCode: res.statusCode || -1, + reason: res.statusMessage, + headers: getTransformedHeaders(res.headers), + body: res + }); + resolve({ response: httpResponse }); + }); + req.on("error", (err) => { + if (NODEJS_TIMEOUT_ERROR_CODES.includes(err.code)) { + reject(Object.assign(err, { name: "TimeoutError" })); + } else { + reject(err); + } + }); + if (abortSignal) { + const onAbort = /* @__PURE__ */ __name(() => { + req.destroy(); + const abortError = new Error("Request aborted"); + abortError.name = "AbortError"; + reject(abortError); + }, "onAbort"); + if (typeof abortSignal.addEventListener === "function") { + const signal = abortSignal; + signal.addEventListener("abort", onAbort, { once: true }); + req.once("close", () => signal.removeEventListener("abort", onAbort)); + } else { + abortSignal.onabort = onAbort; + } + } + timeouts.push(setConnectionTimeout(req, reject, this.config.connectionTimeout)); + timeouts.push(setSocketTimeout(req, reject, this.config.requestTimeout)); + const httpAgent = nodeHttpsOptions.agent; + if (typeof httpAgent === "object" && "keepAlive" in httpAgent) { + timeouts.push( + setSocketKeepAlive(req, { + // @ts-expect-error keepAlive is not public on httpAgent. + keepAlive: httpAgent.keepAlive, + // @ts-expect-error keepAliveMsecs is not public on httpAgent. + keepAliveMsecs: httpAgent.keepAliveMsecs + }) + ); + } + writeRequestBodyPromise = writeRequestBody(req, request2, this.config.requestTimeout).catch((e) => { + timeouts.forEach(clearTimeout); + return _reject(e); + }); + }); } - const ssoOidcClient = new client_sso_oidc_node_1.SSOOIDCClient({ region: ssoRegion }); - ssoOidcClientsHash[ssoRegion] = ssoOidcClient; - return ssoOidcClient; - }; - exports2.getSsoOidcClient = getSsoOidcClient; - } -}); - -// ../../../node_modules/@aws-sdk/token-providers/dist-cjs/getNewSsoOidcToken.js -var require_getNewSsoOidcToken = __commonJS({ - "../../../node_modules/@aws-sdk/token-providers/dist-cjs/getNewSsoOidcToken.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getNewSsoOidcToken = void 0; - var client_sso_oidc_node_1 = require_client_sso_oidc_node(); - var getSsoOidcClient_1 = require_getSsoOidcClient(); - var getNewSsoOidcToken = (ssoToken, ssoRegion) => { - const ssoOidcClient = (0, getSsoOidcClient_1.getSsoOidcClient)(ssoRegion); - return ssoOidcClient.send(new client_sso_oidc_node_1.CreateTokenCommand({ - clientId: ssoToken.clientId, - clientSecret: ssoToken.clientSecret, - refreshToken: ssoToken.refreshToken, - grantType: "refresh_token" - })); - }; - exports2.getNewSsoOidcToken = getNewSsoOidcToken; - } -}); - -// ../../../node_modules/@aws-sdk/token-providers/dist-cjs/validateTokenExpiry.js -var require_validateTokenExpiry = __commonJS({ - "../../../node_modules/@aws-sdk/token-providers/dist-cjs/validateTokenExpiry.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.validateTokenExpiry = void 0; - var property_provider_1 = require_dist_cjs6(); - var constants_1 = require_constants2(); - var validateTokenExpiry = (token) => { - if (token.expiration && token.expiration.getTime() < Date.now()) { - throw new property_provider_1.TokenProviderError(`Token is expired. ${constants_1.REFRESH_MESSAGE}`, false); + updateHttpClientConfig(key, value) { + this.config = void 0; + this.configProvider = this.configProvider.then((config) => { + return { + ...config, + [key]: value + }; + }); } - }; - exports2.validateTokenExpiry = validateTokenExpiry; - } -}); - -// ../../../node_modules/@aws-sdk/token-providers/dist-cjs/validateTokenKey.js -var require_validateTokenKey = __commonJS({ - "../../../node_modules/@aws-sdk/token-providers/dist-cjs/validateTokenKey.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.validateTokenKey = void 0; - var property_provider_1 = require_dist_cjs6(); - var constants_1 = require_constants2(); - var validateTokenKey = (key, value, forRefresh = false) => { - if (typeof value === "undefined") { - throw new property_provider_1.TokenProviderError(`Value not present for '${key}' in SSO Token${forRefresh ? ". Cannot refresh" : ""}. ${constants_1.REFRESH_MESSAGE}`, false); + httpHandlerConfigs() { + return this.config ?? {}; } }; - exports2.validateTokenKey = validateTokenKey; - } -}); - -// ../../../node_modules/@aws-sdk/token-providers/dist-cjs/writeSSOTokenToFile.js -var require_writeSSOTokenToFile = __commonJS({ - "../../../node_modules/@aws-sdk/token-providers/dist-cjs/writeSSOTokenToFile.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.writeSSOTokenToFile = void 0; - var shared_ini_file_loader_1 = require_dist_cjs21(); - var fs_1 = require("fs"); - var { writeFile } = fs_1.promises; - var writeSSOTokenToFile = (id, ssoToken) => { - const tokenFilepath = (0, shared_ini_file_loader_1.getSSOTokenFilepath)(id); - const tokenString = JSON.stringify(ssoToken, null, 2); - return writeFile(tokenFilepath, tokenString); - }; - exports2.writeSSOTokenToFile = writeSSOTokenToFile; - } -}); - -// ../../../node_modules/@aws-sdk/token-providers/dist-cjs/fromSso.js -var require_fromSso = __commonJS({ - "../../../node_modules/@aws-sdk/token-providers/dist-cjs/fromSso.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.fromSso = void 0; - var property_provider_1 = require_dist_cjs6(); - var shared_ini_file_loader_1 = require_dist_cjs21(); - var constants_1 = require_constants2(); - var getNewSsoOidcToken_1 = require_getNewSsoOidcToken(); - var validateTokenExpiry_1 = require_validateTokenExpiry(); - var validateTokenKey_1 = require_validateTokenKey(); - var writeSSOTokenToFile_1 = require_writeSSOTokenToFile(); - var lastRefreshAttemptTime = /* @__PURE__ */ new Date(0); - var fromSso = (init = {}) => async () => { - const profiles = await (0, shared_ini_file_loader_1.parseKnownFiles)(init); - const profileName = (0, shared_ini_file_loader_1.getProfileName)(init); - const profile = profiles[profileName]; - if (!profile) { - throw new property_provider_1.TokenProviderError(`Profile '${profileName}' could not be found in shared credentials file.`, false); - } else if (!profile["sso_session"]) { - throw new property_provider_1.TokenProviderError(`Profile '${profileName}' is missing required property 'sso_session'.`); - } - const ssoSessionName = profile["sso_session"]; - const ssoSessions = await (0, shared_ini_file_loader_1.loadSsoSessionData)(init); - const ssoSession = ssoSessions[ssoSessionName]; - if (!ssoSession) { - throw new property_provider_1.TokenProviderError(`Sso session '${ssoSessionName}' could not be found in shared credentials file.`, false); + __name(_NodeHttpHandler, "NodeHttpHandler"); + var NodeHttpHandler = _NodeHttpHandler; + var import_http22 = require("http2"); + var import_http23 = __toESM2(require("http2")); + var _NodeHttp2ConnectionPool = class _NodeHttp2ConnectionPool { + constructor(sessions) { + this.sessions = []; + this.sessions = sessions ?? []; } - for (const ssoSessionRequiredKey of ["sso_start_url", "sso_region"]) { - if (!ssoSession[ssoSessionRequiredKey]) { - throw new property_provider_1.TokenProviderError(`Sso session '${ssoSessionName}' is missing required property '${ssoSessionRequiredKey}'.`, false); + poll() { + if (this.sessions.length > 0) { + return this.sessions.shift(); } } - const ssoStartUrl = ssoSession["sso_start_url"]; - const ssoRegion = ssoSession["sso_region"]; - let ssoToken; - try { - ssoToken = await (0, shared_ini_file_loader_1.getSSOTokenFromFile)(ssoSessionName); - } catch (e) { - throw new property_provider_1.TokenProviderError(`The SSO session token associated with profile=${profileName} was not found or is invalid. ${constants_1.REFRESH_MESSAGE}`, false); + offerLast(session) { + this.sessions.push(session); } - (0, validateTokenKey_1.validateTokenKey)("accessToken", ssoToken.accessToken); - (0, validateTokenKey_1.validateTokenKey)("expiresAt", ssoToken.expiresAt); - const { accessToken, expiresAt } = ssoToken; - const existingToken = { token: accessToken, expiration: new Date(expiresAt) }; - if (existingToken.expiration.getTime() - Date.now() > constants_1.EXPIRE_WINDOW_MS) { - return existingToken; + contains(session) { + return this.sessions.includes(session); } - if (Date.now() - lastRefreshAttemptTime.getTime() < 30 * 1e3) { - (0, validateTokenExpiry_1.validateTokenExpiry)(existingToken); - return existingToken; + remove(session) { + this.sessions = this.sessions.filter((s) => s !== session); } - (0, validateTokenKey_1.validateTokenKey)("clientId", ssoToken.clientId, true); - (0, validateTokenKey_1.validateTokenKey)("clientSecret", ssoToken.clientSecret, true); - (0, validateTokenKey_1.validateTokenKey)("refreshToken", ssoToken.refreshToken, true); - try { - lastRefreshAttemptTime.setTime(Date.now()); - const newSsoOidcToken = await (0, getNewSsoOidcToken_1.getNewSsoOidcToken)(ssoToken, ssoRegion); - (0, validateTokenKey_1.validateTokenKey)("accessToken", newSsoOidcToken.accessToken); - (0, validateTokenKey_1.validateTokenKey)("expiresIn", newSsoOidcToken.expiresIn); - const newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1e3); - try { - await (0, writeSSOTokenToFile_1.writeSSOTokenToFile)(ssoSessionName, { - ...ssoToken, - accessToken: newSsoOidcToken.accessToken, - expiresAt: newTokenExpiration.toISOString(), - refreshToken: newSsoOidcToken.refreshToken - }); - } catch (error) { + [Symbol.iterator]() { + return this.sessions[Symbol.iterator](); + } + destroy(connection) { + for (const session of this.sessions) { + if (session === connection) { + if (!session.destroyed) { + session.destroy(); + } + } } - return { - token: newSsoOidcToken.accessToken, - expiration: newTokenExpiration - }; - } catch (error) { - (0, validateTokenExpiry_1.validateTokenExpiry)(existingToken); - return existingToken; } }; - exports2.fromSso = fromSso; - } -}); - -// ../../../node_modules/@aws-sdk/token-providers/dist-cjs/fromStatic.js -var require_fromStatic = __commonJS({ - "../../../node_modules/@aws-sdk/token-providers/dist-cjs/fromStatic.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.fromStatic = void 0; - var property_provider_1 = require_dist_cjs6(); - var fromStatic = ({ token }) => async () => { - if (!token || !token.token) { - throw new property_provider_1.TokenProviderError(`Please pass a valid token to fromStatic`, false); + __name(_NodeHttp2ConnectionPool, "NodeHttp2ConnectionPool"); + var NodeHttp2ConnectionPool = _NodeHttp2ConnectionPool; + var _NodeHttp2ConnectionManager = class _NodeHttp2ConnectionManager { + constructor(config) { + this.sessionCache = /* @__PURE__ */ new Map(); + this.config = config; + if (this.config.maxConcurrency && this.config.maxConcurrency <= 0) { + throw new RangeError("maxConcurrency must be greater than zero."); + } } - return token; - }; - exports2.fromStatic = fromStatic; - } -}); - -// ../../../node_modules/@aws-sdk/token-providers/dist-cjs/nodeProvider.js -var require_nodeProvider = __commonJS({ - "../../../node_modules/@aws-sdk/token-providers/dist-cjs/nodeProvider.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.nodeProvider = void 0; - var property_provider_1 = require_dist_cjs6(); - var fromSso_1 = require_fromSso(); - var nodeProvider = (init = {}) => (0, property_provider_1.memoize)((0, property_provider_1.chain)((0, fromSso_1.fromSso)(init), async () => { - throw new property_provider_1.TokenProviderError("Could not load token from any providers", false); - }), (token) => token.expiration !== void 0 && token.expiration.getTime() - Date.now() < 3e5, (token) => token.expiration !== void 0); - exports2.nodeProvider = nodeProvider; - } -}); - -// ../../../node_modules/@aws-sdk/token-providers/dist-cjs/index.js -var require_dist_cjs46 = __commonJS({ - "../../../node_modules/@aws-sdk/token-providers/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_client_sso_oidc_node(), exports2); - tslib_1.__exportStar(require_fromSso(), exports2); - tslib_1.__exportStar(require_fromStatic(), exports2); - tslib_1.__exportStar(require_nodeProvider(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/resolveSSOCredentials.js -var require_resolveSSOCredentials = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/resolveSSOCredentials.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveSSOCredentials = void 0; - var client_sso_1 = require_dist_cjs45(); - var token_providers_1 = require_dist_cjs46(); - var property_provider_1 = require_dist_cjs6(); - var shared_ini_file_loader_1 = require_dist_cjs21(); - var SHOULD_FAIL_CREDENTIAL_CHAIN = false; - var resolveSSOCredentials = async ({ ssoStartUrl, ssoSession, ssoAccountId, ssoRegion, ssoRoleName, ssoClient, profile }) => { - let token; - const refreshMessage = `To refresh this SSO session run aws sso login with the corresponding profile.`; - if (ssoSession) { - try { - const _token = await (0, token_providers_1.fromSso)({ profile })(); - token = { - accessToken: _token.token, - expiresAt: new Date(_token.expiration).toISOString() - }; - } catch (e) { - throw new property_provider_1.CredentialsProviderError(e.message, SHOULD_FAIL_CREDENTIAL_CHAIN); + lease(requestContext, connectionConfiguration) { + const url2 = this.getUrlString(requestContext); + const existingPool = this.sessionCache.get(url2); + if (existingPool) { + const existingSession = existingPool.poll(); + if (existingSession && !this.config.disableConcurrency) { + return existingSession; + } } - } else { - try { - token = await (0, shared_ini_file_loader_1.getSSOTokenFromFile)(ssoStartUrl); - } catch (e) { - throw new property_provider_1.CredentialsProviderError(`The SSO session associated with this profile is invalid. ${refreshMessage}`, SHOULD_FAIL_CREDENTIAL_CHAIN); + const session = import_http23.default.connect(url2); + if (this.config.maxConcurrency) { + session.settings({ maxConcurrentStreams: this.config.maxConcurrency }, (err) => { + if (err) { + throw new Error( + "Fail to set maxConcurrentStreams to " + this.config.maxConcurrency + "when creating new session for " + requestContext.destination.toString() + ); + } + }); + } + session.unref(); + const destroySessionCb = /* @__PURE__ */ __name(() => { + session.destroy(); + this.deleteSession(url2, session); + }, "destroySessionCb"); + session.on("goaway", destroySessionCb); + session.on("error", destroySessionCb); + session.on("frameError", destroySessionCb); + session.on("close", () => this.deleteSession(url2, session)); + if (connectionConfiguration.requestTimeout) { + session.setTimeout(connectionConfiguration.requestTimeout, destroySessionCb); } + const connectionPool = this.sessionCache.get(url2) || new NodeHttp2ConnectionPool(); + connectionPool.offerLast(session); + this.sessionCache.set(url2, connectionPool); + return session; } - if (new Date(token.expiresAt).getTime() - Date.now() <= 0) { - throw new property_provider_1.CredentialsProviderError(`The SSO session associated with this profile has expired. ${refreshMessage}`, SHOULD_FAIL_CREDENTIAL_CHAIN); + /** + * Delete a session from the connection pool. + * @param authority The authority of the session to delete. + * @param session The session to delete. + */ + deleteSession(authority, session) { + const existingConnectionPool = this.sessionCache.get(authority); + if (!existingConnectionPool) { + return; + } + if (!existingConnectionPool.contains(session)) { + return; + } + existingConnectionPool.remove(session); + this.sessionCache.set(authority, existingConnectionPool); } - const { accessToken } = token; - const sso = ssoClient || new client_sso_1.SSOClient({ region: ssoRegion }); - let ssoResp; - try { - ssoResp = await sso.send(new client_sso_1.GetRoleCredentialsCommand({ - accountId: ssoAccountId, - roleName: ssoRoleName, - accessToken - })); - } catch (e) { - throw property_provider_1.CredentialsProviderError.from(e, SHOULD_FAIL_CREDENTIAL_CHAIN); + release(requestContext, session) { + var _a; + const cacheKey = this.getUrlString(requestContext); + (_a = this.sessionCache.get(cacheKey)) == null ? void 0 : _a.offerLast(session); } - const { roleCredentials: { accessKeyId, secretAccessKey, sessionToken, expiration } = {} } = ssoResp; - if (!accessKeyId || !secretAccessKey || !sessionToken || !expiration) { - throw new property_provider_1.CredentialsProviderError("SSO returns an invalid temporary credential.", SHOULD_FAIL_CREDENTIAL_CHAIN); + destroy() { + for (const [key, connectionPool] of this.sessionCache) { + for (const session of connectionPool) { + if (!session.destroyed) { + session.destroy(); + } + connectionPool.remove(session); + } + this.sessionCache.delete(key); + } } - return { accessKeyId, secretAccessKey, sessionToken, expiration: new Date(expiration) }; - }; - exports2.resolveSSOCredentials = resolveSSOCredentials; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/validateSsoProfile.js -var require_validateSsoProfile = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/validateSsoProfile.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.validateSsoProfile = void 0; - var property_provider_1 = require_dist_cjs6(); - var validateSsoProfile = (profile) => { - const { sso_start_url, sso_account_id, sso_region, sso_role_name } = profile; - if (!sso_start_url || !sso_account_id || !sso_region || !sso_role_name) { - throw new property_provider_1.CredentialsProviderError(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", "sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(profile).join(", ")} -Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`, false); + setMaxConcurrentStreams(maxConcurrentStreams) { + if (this.config.maxConcurrency && this.config.maxConcurrency <= 0) { + throw new RangeError("maxConcurrentStreams must be greater than zero."); + } + this.config.maxConcurrency = maxConcurrentStreams; + } + setDisableConcurrentStreams(disableConcurrentStreams) { + this.config.disableConcurrency = disableConcurrentStreams; + } + getUrlString(request2) { + return request2.destination.toString(); } - return profile; }; - exports2.validateSsoProfile = validateSsoProfile; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/fromSSO.js -var require_fromSSO = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/fromSSO.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.fromSSO = void 0; - var property_provider_1 = require_dist_cjs6(); - var shared_ini_file_loader_1 = require_dist_cjs21(); - var isSsoProfile_1 = require_isSsoProfile(); - var resolveSSOCredentials_1 = require_resolveSSOCredentials(); - var validateSsoProfile_1 = require_validateSsoProfile(); - var fromSSO = (init = {}) => async () => { - const { ssoStartUrl, ssoAccountId, ssoRegion, ssoRoleName, ssoClient, ssoSession } = init; - const profileName = (0, shared_ini_file_loader_1.getProfileName)(init); - if (!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession) { - const profiles = await (0, shared_ini_file_loader_1.parseKnownFiles)(init); - const profile = profiles[profileName]; - if (!profile) { - throw new property_provider_1.CredentialsProviderError(`Profile ${profileName} was not found.`); + __name(_NodeHttp2ConnectionManager, "NodeHttp2ConnectionManager"); + var NodeHttp2ConnectionManager = _NodeHttp2ConnectionManager; + var _NodeHttp2Handler = class _NodeHttp2Handler2 { + constructor(options) { + this.metadata = { handlerProtocol: "h2" }; + this.connectionManager = new NodeHttp2ConnectionManager({}); + this.configProvider = new Promise((resolve, reject) => { + if (typeof options === "function") { + options().then((opts) => { + resolve(opts || {}); + }).catch(reject); + } else { + resolve(options || {}); + } + }); + } + /** + * @returns the input if it is an HttpHandler of any class, + * or instantiates a new instance of this handler. + */ + static create(instanceOrOptions) { + if (typeof (instanceOrOptions == null ? void 0 : instanceOrOptions.handle) === "function") { + return instanceOrOptions; } - if (!(0, isSsoProfile_1.isSsoProfile)(profile)) { - throw new property_provider_1.CredentialsProviderError(`Profile ${profileName} is not configured with SSO credentials.`); + return new _NodeHttp2Handler2(instanceOrOptions); + } + destroy() { + this.connectionManager.destroy(); + } + async handle(request2, { abortSignal } = {}) { + if (!this.config) { + this.config = await this.configProvider; + this.connectionManager.setDisableConcurrentStreams(this.config.disableConcurrentStreams || false); + if (this.config.maxConcurrentStreams) { + this.connectionManager.setMaxConcurrentStreams(this.config.maxConcurrentStreams); + } } - if (profile === null || profile === void 0 ? void 0 : profile.sso_session) { - const ssoSessions = await (0, shared_ini_file_loader_1.loadSsoSessionData)(init); - const session = ssoSessions[profile.sso_session]; - const conflictMsg = ` configurations in profile ${profileName} and sso-session ${profile.sso_session}`; - if (ssoRegion && ssoRegion !== session.sso_region) { - throw new property_provider_1.CredentialsProviderError(`Conflicting SSO region` + conflictMsg, false); + const { requestTimeout, disableConcurrentStreams } = this.config; + return new Promise((_resolve, _reject) => { + var _a; + let fulfilled = false; + let writeRequestBodyPromise = void 0; + const resolve = /* @__PURE__ */ __name(async (arg) => { + await writeRequestBodyPromise; + _resolve(arg); + }, "resolve"); + const reject = /* @__PURE__ */ __name(async (arg) => { + await writeRequestBodyPromise; + _reject(arg); + }, "reject"); + if (abortSignal == null ? void 0 : abortSignal.aborted) { + fulfilled = true; + const abortError = new Error("Request aborted"); + abortError.name = "AbortError"; + reject(abortError); + return; } - if (ssoStartUrl && ssoStartUrl !== session.sso_start_url) { - throw new property_provider_1.CredentialsProviderError(`Conflicting SSO start_url` + conflictMsg, false); + const { hostname, method, port, protocol, query } = request2; + let auth = ""; + if (request2.username != null || request2.password != null) { + const username = request2.username ?? ""; + const password = request2.password ?? ""; + auth = `${username}:${password}@`; } - profile.sso_region = session.sso_region; - profile.sso_start_url = session.sso_start_url; - } - const { sso_start_url, sso_account_id, sso_region, sso_role_name, sso_session } = (0, validateSsoProfile_1.validateSsoProfile)(profile); - return (0, resolveSSOCredentials_1.resolveSSOCredentials)({ - ssoStartUrl: sso_start_url, - ssoSession: sso_session, - ssoAccountId: sso_account_id, - ssoRegion: sso_region, - ssoRoleName: sso_role_name, - ssoClient, - profile: profileName + const authority = `${protocol}//${auth}${hostname}${port ? `:${port}` : ""}`; + const requestContext = { destination: new URL(authority) }; + const session = this.connectionManager.lease(requestContext, { + requestTimeout: (_a = this.config) == null ? void 0 : _a.sessionTimeout, + disableConcurrentStreams: disableConcurrentStreams || false + }); + const rejectWithDestroy = /* @__PURE__ */ __name((err) => { + if (disableConcurrentStreams) { + this.destroySession(session); + } + fulfilled = true; + reject(err); + }, "rejectWithDestroy"); + const queryString = (0, import_querystring_builder.buildQueryString)(query || {}); + let path = request2.path; + if (queryString) { + path += `?${queryString}`; + } + if (request2.fragment) { + path += `#${request2.fragment}`; + } + const req = session.request({ + ...request2.headers, + [import_http22.constants.HTTP2_HEADER_PATH]: path, + [import_http22.constants.HTTP2_HEADER_METHOD]: method + }); + session.ref(); + req.on("response", (headers) => { + const httpResponse = new import_protocol_http8.HttpResponse({ + statusCode: headers[":status"] || -1, + headers: getTransformedHeaders(headers), + body: req + }); + fulfilled = true; + resolve({ response: httpResponse }); + if (disableConcurrentStreams) { + session.close(); + this.connectionManager.deleteSession(authority, session); + } + }); + if (requestTimeout) { + req.setTimeout(requestTimeout, () => { + req.close(); + const timeoutError = new Error(`Stream timed out because of no activity for ${requestTimeout} ms`); + timeoutError.name = "TimeoutError"; + rejectWithDestroy(timeoutError); + }); + } + if (abortSignal) { + const onAbort = /* @__PURE__ */ __name(() => { + req.close(); + const abortError = new Error("Request aborted"); + abortError.name = "AbortError"; + rejectWithDestroy(abortError); + }, "onAbort"); + if (typeof abortSignal.addEventListener === "function") { + const signal = abortSignal; + signal.addEventListener("abort", onAbort, { once: true }); + req.once("close", () => signal.removeEventListener("abort", onAbort)); + } else { + abortSignal.onabort = onAbort; + } + } + req.on("frameError", (type, code, id) => { + rejectWithDestroy(new Error(`Frame type id ${type} in stream id ${id} has failed with code ${code}.`)); + }); + req.on("error", rejectWithDestroy); + req.on("aborted", () => { + rejectWithDestroy( + new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${req.rstCode}.`) + ); + }); + req.on("close", () => { + session.unref(); + if (disableConcurrentStreams) { + session.destroy(); + } + if (!fulfilled) { + rejectWithDestroy(new Error("Unexpected error: http2 request did not get a response")); + } + }); + writeRequestBodyPromise = writeRequestBody(req, request2, requestTimeout); }); - } else if (!ssoStartUrl || !ssoAccountId || !ssoRegion || !ssoRoleName) { - throw new property_provider_1.CredentialsProviderError('Incomplete configuration. The fromSSO() argument hash must include "ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"'); - } else { - return (0, resolveSSOCredentials_1.resolveSSOCredentials)({ - ssoStartUrl, - ssoSession, - ssoAccountId, - ssoRegion, - ssoRoleName, - ssoClient, - profile: profileName + } + updateHttpClientConfig(key, value) { + this.config = void 0; + this.configProvider = this.configProvider.then((config) => { + return { + ...config, + [key]: value + }; }); } - }; - exports2.fromSSO = fromSSO; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/types.js -var require_types2 = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/types.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/index.js -var require_dist_cjs47 = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_fromSSO(), exports2); - tslib_1.__exportStar(require_isSsoProfile(), exports2); - tslib_1.__exportStar(require_types2(), exports2); - tslib_1.__exportStar(require_validateSsoProfile(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveSsoCredentials.js -var require_resolveSsoCredentials = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveSsoCredentials.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveSsoCredentials = exports2.isSsoProfile = void 0; - var credential_provider_sso_1 = require_dist_cjs47(); - var credential_provider_sso_2 = require_dist_cjs47(); - Object.defineProperty(exports2, "isSsoProfile", { enumerable: true, get: function() { - return credential_provider_sso_2.isSsoProfile; - } }); - var resolveSsoCredentials = (data) => { - const { sso_start_url, sso_account_id, sso_session, sso_region, sso_role_name } = (0, credential_provider_sso_1.validateSsoProfile)(data); - return (0, credential_provider_sso_1.fromSSO)({ - ssoStartUrl: sso_start_url, - ssoAccountId: sso_account_id, - ssoSession: sso_session, - ssoRegion: sso_region, - ssoRoleName: sso_role_name - })(); - }; - exports2.resolveSsoCredentials = resolveSsoCredentials; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveStaticCredentials.js -var require_resolveStaticCredentials = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveStaticCredentials.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveStaticCredentials = exports2.isStaticCredsProfile = void 0; - var isStaticCredsProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.aws_access_key_id === "string" && typeof arg.aws_secret_access_key === "string" && ["undefined", "string"].indexOf(typeof arg.aws_session_token) > -1; - exports2.isStaticCredsProfile = isStaticCredsProfile; - var resolveStaticCredentials = (profile) => Promise.resolve({ - accessKeyId: profile.aws_access_key_id, - secretAccessKey: profile.aws_secret_access_key, - sessionToken: profile.aws_session_token - }); - exports2.resolveStaticCredentials = resolveStaticCredentials; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromWebToken.js -var require_fromWebToken = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromWebToken.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.fromWebToken = void 0; - var property_provider_1 = require_dist_cjs6(); - var fromWebToken = (init) => () => { - const { roleArn, roleSessionName, webIdentityToken, providerId, policyArns, policy, durationSeconds, roleAssumerWithWebIdentity } = init; - if (!roleAssumerWithWebIdentity) { - throw new property_provider_1.CredentialsProviderError(`Role Arn '${roleArn}' needs to be assumed with web identity, but no role assumption callback was provided.`, false); + httpHandlerConfigs() { + return this.config ?? {}; + } + /** + * Destroys a session. + * @param session The session to destroy. + */ + destroySession(session) { + if (!session.destroyed) { + session.destroy(); + } } - return roleAssumerWithWebIdentity({ - RoleArn: roleArn, - RoleSessionName: roleSessionName !== null && roleSessionName !== void 0 ? roleSessionName : `aws-sdk-js-session-${Date.now()}`, - WebIdentityToken: webIdentityToken, - ProviderId: providerId, - PolicyArns: policyArns, - Policy: policy, - DurationSeconds: durationSeconds - }); }; - exports2.fromWebToken = fromWebToken; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromTokenFile.js -var require_fromTokenFile = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromTokenFile.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.fromTokenFile = void 0; - var property_provider_1 = require_dist_cjs6(); - var fs_1 = require("fs"); - var fromWebToken_1 = require_fromWebToken(); - var ENV_TOKEN_FILE = "AWS_WEB_IDENTITY_TOKEN_FILE"; - var ENV_ROLE_ARN = "AWS_ROLE_ARN"; - var ENV_ROLE_SESSION_NAME = "AWS_ROLE_SESSION_NAME"; - var fromTokenFile = (init = {}) => async () => { - var _a, _b, _c; - const webIdentityTokenFile = (_a = init === null || init === void 0 ? void 0 : init.webIdentityTokenFile) !== null && _a !== void 0 ? _a : process.env[ENV_TOKEN_FILE]; - const roleArn = (_b = init === null || init === void 0 ? void 0 : init.roleArn) !== null && _b !== void 0 ? _b : process.env[ENV_ROLE_ARN]; - const roleSessionName = (_c = init === null || init === void 0 ? void 0 : init.roleSessionName) !== null && _c !== void 0 ? _c : process.env[ENV_ROLE_SESSION_NAME]; - if (!webIdentityTokenFile || !roleArn) { - throw new property_provider_1.CredentialsProviderError("Web identity configuration not specified"); + __name(_NodeHttp2Handler, "NodeHttp2Handler"); + var NodeHttp2Handler = _NodeHttp2Handler; + var _Collector = class _Collector extends import_stream.Writable { + constructor() { + super(...arguments); + this.bufferedBytes = []; + } + _write(chunk, encoding, callback) { + this.bufferedBytes.push(chunk); + callback(); } - return (0, fromWebToken_1.fromWebToken)({ - ...init, - webIdentityToken: (0, fs_1.readFileSync)(webIdentityTokenFile, { encoding: "ascii" }), - roleArn, - roleSessionName - })(); }; - exports2.fromTokenFile = fromTokenFile; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/index.js -var require_dist_cjs48 = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_fromTokenFile(), exports2); - tslib_1.__exportStar(require_fromWebToken(), exports2); + __name(_Collector, "Collector"); + var Collector = _Collector; + var streamCollector = /* @__PURE__ */ __name((stream) => { + if (isReadableStreamInstance(stream)) { + return collectReadableStream(stream); + } + return new Promise((resolve, reject) => { + const collector = new Collector(); + stream.pipe(collector); + stream.on("error", (err) => { + collector.end(); + reject(err); + }); + collector.on("error", reject); + collector.on("finish", function() { + const bytes = new Uint8Array(Buffer.concat(this.bufferedBytes)); + resolve(bytes); + }); + }); + }, "streamCollector"); + var isReadableStreamInstance = /* @__PURE__ */ __name((stream) => typeof ReadableStream === "function" && stream instanceof ReadableStream, "isReadableStreamInstance"); + async function collectReadableStream(stream) { + const chunks = []; + const reader = stream.getReader(); + let isDone = false; + let length = 0; + while (!isDone) { + const { done, value } = await reader.read(); + if (value) { + chunks.push(value); + length += value.length; + } + isDone = done; + } + const collected = new Uint8Array(length); + let offset = 0; + for (const chunk of chunks) { + collected.set(chunk, offset); + offset += chunk.length; + } + return collected; + } + __name(collectReadableStream, "collectReadableStream"); } }); -// ../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveWebIdentityCredentials.js -var require_resolveWebIdentityCredentials = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveWebIdentityCredentials.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveWebIdentityCredentials = exports2.isWebIdentityProfile = void 0; - var credential_provider_web_identity_1 = require_dist_cjs48(); - var isWebIdentityProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.web_identity_token_file === "string" && typeof arg.role_arn === "string" && ["undefined", "string"].indexOf(typeof arg.role_session_name) > -1; - exports2.isWebIdentityProfile = isWebIdentityProfile; - var resolveWebIdentityCredentials = async (profile, options) => (0, credential_provider_web_identity_1.fromTokenFile)({ - webIdentityTokenFile: profile.web_identity_token_file, - roleArn: profile.role_arn, - roleSessionName: profile.role_session_name, - roleAssumerWithWebIdentity: options.roleAssumerWithWebIdentity - })(); - exports2.resolveWebIdentityCredentials = resolveWebIdentityCredentials; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveProfileData.js -var require_resolveProfileData = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveProfileData.js"(exports2) { +// ../../../node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/checkUrl.js +var require_checkUrl = __commonJS({ + "../../../node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/checkUrl.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveProfileData = void 0; - var property_provider_1 = require_dist_cjs6(); - var resolveAssumeRoleCredentials_1 = require_resolveAssumeRoleCredentials(); - var resolveProcessCredentials_1 = require_resolveProcessCredentials2(); - var resolveSsoCredentials_1 = require_resolveSsoCredentials(); - var resolveStaticCredentials_1 = require_resolveStaticCredentials(); - var resolveWebIdentityCredentials_1 = require_resolveWebIdentityCredentials(); - var resolveProfileData = async (profileName, profiles, options, visitedProfiles = {}) => { - const data = profiles[profileName]; - if (Object.keys(visitedProfiles).length > 0 && (0, resolveStaticCredentials_1.isStaticCredsProfile)(data)) { - return (0, resolveStaticCredentials_1.resolveStaticCredentials)(data); - } - if ((0, resolveAssumeRoleCredentials_1.isAssumeRoleProfile)(data)) { - return (0, resolveAssumeRoleCredentials_1.resolveAssumeRoleCredentials)(profileName, profiles, options, visitedProfiles); - } - if ((0, resolveStaticCredentials_1.isStaticCredsProfile)(data)) { - return (0, resolveStaticCredentials_1.resolveStaticCredentials)(data); - } - if ((0, resolveWebIdentityCredentials_1.isWebIdentityProfile)(data)) { - return (0, resolveWebIdentityCredentials_1.resolveWebIdentityCredentials)(data, options); + exports2.checkUrl = void 0; + var property_provider_1 = require_dist_cjs40(); + var ECS_CONTAINER_HOST = "169.254.170.2"; + var EKS_CONTAINER_HOST_IPv4 = "169.254.170.23"; + var EKS_CONTAINER_HOST_IPv6 = "[fd00:ec2::23]"; + var checkUrl = (url2, logger) => { + if (url2.protocol === "https:") { + return; } - if ((0, resolveProcessCredentials_1.isProcessProfile)(data)) { - return (0, resolveProcessCredentials_1.resolveProcessCredentials)(options, profileName); + if (url2.hostname === ECS_CONTAINER_HOST || url2.hostname === EKS_CONTAINER_HOST_IPv4 || url2.hostname === EKS_CONTAINER_HOST_IPv6) { + return; } - if ((0, resolveSsoCredentials_1.isSsoProfile)(data)) { - return (0, resolveSsoCredentials_1.resolveSsoCredentials)(data); + if (url2.hostname.includes("[")) { + if (url2.hostname === "[::1]" || url2.hostname === "[0000:0000:0000:0000:0000:0000:0000:0001]") { + return; + } + } else { + if (url2.hostname === "localhost") { + return; + } + const ipComponents = url2.hostname.split("."); + const inRange = (component) => { + const num = parseInt(component, 10); + return 0 <= num && num <= 255; + }; + if (ipComponents[0] === "127" && inRange(ipComponents[1]) && inRange(ipComponents[2]) && inRange(ipComponents[3]) && ipComponents.length === 4) { + return; + } } - throw new property_provider_1.CredentialsProviderError(`Profile ${profileName} could not be found or parsed in shared credentials file.`); + throw new property_provider_1.CredentialsProviderError(`URL not accepted. It must either be HTTPS or match one of the following: + - loopback CIDR 127.0.0.0/8 or [::1/128] + - ECS container host 169.254.170.2 + - EKS container host 169.254.170.23 or [fd00:ec2::23]`, { logger }); }; - exports2.resolveProfileData = resolveProfileData; + exports2.checkUrl = checkUrl; } }); -// ../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/fromIni.js -var require_fromIni = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/fromIni.js"(exports2) { +// ../../../node_modules/@smithy/util-stream/dist-cjs/getAwsChunkedEncodingStream.js +var require_getAwsChunkedEncodingStream2 = __commonJS({ + "../../../node_modules/@smithy/util-stream/dist-cjs/getAwsChunkedEncodingStream.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.fromIni = void 0; - var shared_ini_file_loader_1 = require_dist_cjs21(); - var resolveProfileData_1 = require_resolveProfileData(); - var fromIni = (init = {}) => async () => { - const profiles = await (0, shared_ini_file_loader_1.parseKnownFiles)(init); - return (0, resolveProfileData_1.resolveProfileData)((0, shared_ini_file_loader_1.getProfileName)(init), profiles, init); + exports2.getAwsChunkedEncodingStream = void 0; + var stream_1 = require("stream"); + var getAwsChunkedEncodingStream2 = (readableStream, options) => { + const { base64Encoder, bodyLengthChecker, checksumAlgorithmFn, checksumLocationName, streamHasher } = options; + const checksumRequired = base64Encoder !== void 0 && checksumAlgorithmFn !== void 0 && checksumLocationName !== void 0 && streamHasher !== void 0; + const digest = checksumRequired ? streamHasher(checksumAlgorithmFn, readableStream) : void 0; + const awsChunkedEncodingStream = new stream_1.Readable({ read: () => { + } }); + readableStream.on("data", (data) => { + const length = bodyLengthChecker(data) || 0; + awsChunkedEncodingStream.push(`${length.toString(16)}\r +`); + awsChunkedEncodingStream.push(data); + awsChunkedEncodingStream.push("\r\n"); + }); + readableStream.on("end", async () => { + awsChunkedEncodingStream.push(`0\r +`); + if (checksumRequired) { + const checksum = base64Encoder(await digest); + awsChunkedEncodingStream.push(`${checksumLocationName}:${checksum}\r +`); + awsChunkedEncodingStream.push(`\r +`); + } + awsChunkedEncodingStream.push(null); + }); + return awsChunkedEncodingStream; }; - exports2.fromIni = fromIni; + exports2.getAwsChunkedEncodingStream = getAwsChunkedEncodingStream2; } }); -// ../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js -var require_dist_cjs49 = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_fromIni(), exports2); +// ../../../node_modules/@smithy/fetch-http-handler/node_modules/@smithy/querystring-builder/dist-cjs/index.js +var require_dist_cjs52 = __commonJS({ + "../../../node_modules/@smithy/fetch-http-handler/node_modules/@smithy/querystring-builder/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + buildQueryString: () => buildQueryString + }); + module2.exports = __toCommonJS2(src_exports); + var import_util_uri_escape = require_dist_cjs31(); + function buildQueryString(query) { + const parts = []; + for (let key of Object.keys(query).sort()) { + const value = query[key]; + key = (0, import_util_uri_escape.escapeUri)(key); + if (Array.isArray(value)) { + for (let i = 0, iLen = value.length; i < iLen; i++) { + parts.push(`${key}=${(0, import_util_uri_escape.escapeUri)(value[i])}`); + } + } else { + let qsEntry = key; + if (value || typeof value === "string") { + qsEntry += `=${(0, import_util_uri_escape.escapeUri)(value)}`; + } + parts.push(qsEntry); + } + } + return parts.join("&"); + } + __name(buildQueryString, "buildQueryString"); } }); -// ../../../node_modules/@aws-sdk/credential-provider-node/dist-cjs/remoteProvider.js -var require_remoteProvider = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-node/dist-cjs/remoteProvider.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.remoteProvider = exports2.ENV_IMDS_DISABLED = void 0; - var credential_provider_imds_1 = require_dist_cjs38(); - var property_provider_1 = require_dist_cjs6(); - exports2.ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED"; - var remoteProvider = (init) => { - if (process.env[credential_provider_imds_1.ENV_CMDS_RELATIVE_URI] || process.env[credential_provider_imds_1.ENV_CMDS_FULL_URI]) { - return (0, credential_provider_imds_1.fromContainerMetadata)(init); - } - if (process.env[exports2.ENV_IMDS_DISABLED]) { - return async () => { - throw new property_provider_1.CredentialsProviderError("EC2 Instance Metadata Service access disabled"); +// ../../../node_modules/@smithy/fetch-http-handler/dist-cjs/index.js +var require_dist_cjs53 = __commonJS({ + "../../../node_modules/@smithy/fetch-http-handler/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + FetchHttpHandler: () => FetchHttpHandler, + keepAliveSupport: () => keepAliveSupport, + streamCollector: () => streamCollector + }); + module2.exports = __toCommonJS2(src_exports); + var import_protocol_http8 = require_dist_cjs2(); + var import_querystring_builder = require_dist_cjs52(); + function requestTimeout(timeoutInMs = 0) { + return new Promise((resolve, reject) => { + if (timeoutInMs) { + setTimeout(() => { + const timeoutError = new Error(`Request did not complete within ${timeoutInMs} ms`); + timeoutError.name = "TimeoutError"; + reject(timeoutError); + }, timeoutInMs); + } + }); + } + __name(requestTimeout, "requestTimeout"); + var keepAliveSupport = { + supported: void 0 + }; + var _FetchHttpHandler = class _FetchHttpHandler2 { + /** + * @returns the input if it is an HttpHandler of any class, + * or instantiates a new instance of this handler. + */ + static create(instanceOrOptions) { + if (typeof (instanceOrOptions == null ? void 0 : instanceOrOptions.handle) === "function") { + return instanceOrOptions; + } + return new _FetchHttpHandler2(instanceOrOptions); + } + constructor(options) { + if (typeof options === "function") { + this.configProvider = options().then((opts) => opts || {}); + } else { + this.config = options ?? {}; + this.configProvider = Promise.resolve(this.config); + } + if (keepAliveSupport.supported === void 0) { + keepAliveSupport.supported = Boolean( + typeof Request !== "undefined" && "keepalive" in new Request("https://[::1]") + ); + } + } + destroy() { + } + async handle(request2, { abortSignal } = {}) { + if (!this.config) { + this.config = await this.configProvider; + } + const requestTimeoutInMs = this.config.requestTimeout; + const keepAlive = this.config.keepAlive === true; + const credentials = this.config.credentials; + if (abortSignal == null ? void 0 : abortSignal.aborted) { + const abortError = new Error("Request aborted"); + abortError.name = "AbortError"; + return Promise.reject(abortError); + } + let path = request2.path; + const queryString = (0, import_querystring_builder.buildQueryString)(request2.query || {}); + if (queryString) { + path += `?${queryString}`; + } + if (request2.fragment) { + path += `#${request2.fragment}`; + } + let auth = ""; + if (request2.username != null || request2.password != null) { + const username = request2.username ?? ""; + const password = request2.password ?? ""; + auth = `${username}:${password}@`; + } + const { port, method } = request2; + const url2 = `${request2.protocol}//${auth}${request2.hostname}${port ? `:${port}` : ""}${path}`; + const body = method === "GET" || method === "HEAD" ? void 0 : request2.body; + const requestOptions = { + body, + headers: new Headers(request2.headers), + method, + credentials }; + if (body) { + requestOptions.duplex = "half"; + } + if (typeof AbortController !== "undefined") { + requestOptions.signal = abortSignal; + } + if (keepAliveSupport.supported) { + requestOptions.keepalive = keepAlive; + } + let removeSignalEventListener = /* @__PURE__ */ __name(() => { + }, "removeSignalEventListener"); + const fetchRequest = new Request(url2, requestOptions); + const raceOfPromises = [ + fetch(fetchRequest).then((response) => { + const fetchHeaders = response.headers; + const transformedHeaders = {}; + for (const pair of fetchHeaders.entries()) { + transformedHeaders[pair[0]] = pair[1]; + } + const hasReadableStream = response.body != void 0; + if (!hasReadableStream) { + return response.blob().then((body2) => ({ + response: new import_protocol_http8.HttpResponse({ + headers: transformedHeaders, + reason: response.statusText, + statusCode: response.status, + body: body2 + }) + })); + } + return { + response: new import_protocol_http8.HttpResponse({ + headers: transformedHeaders, + reason: response.statusText, + statusCode: response.status, + body: response.body + }) + }; + }), + requestTimeout(requestTimeoutInMs) + ]; + if (abortSignal) { + raceOfPromises.push( + new Promise((resolve, reject) => { + const onAbort = /* @__PURE__ */ __name(() => { + const abortError = new Error("Request aborted"); + abortError.name = "AbortError"; + reject(abortError); + }, "onAbort"); + if (typeof abortSignal.addEventListener === "function") { + const signal = abortSignal; + signal.addEventListener("abort", onAbort, { once: true }); + removeSignalEventListener = /* @__PURE__ */ __name(() => signal.removeEventListener("abort", onAbort), "removeSignalEventListener"); + } else { + abortSignal.onabort = onAbort; + } + }) + ); + } + return Promise.race(raceOfPromises).finally(removeSignalEventListener); + } + updateHttpClientConfig(key, value) { + this.config = void 0; + this.configProvider = this.configProvider.then((config) => { + config[key] = value; + return config; + }); + } + httpHandlerConfigs() { + return this.config ?? {}; } - return (0, credential_provider_imds_1.fromInstanceMetadata)(init); }; - exports2.remoteProvider = remoteProvider; - } -}); - -// ../../../node_modules/@aws-sdk/credential-provider-node/dist-cjs/defaultProvider.js -var require_defaultProvider = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-node/dist-cjs/defaultProvider.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.defaultProvider = void 0; - var credential_provider_env_1 = require_dist_cjs37(); - var credential_provider_ini_1 = require_dist_cjs49(); - var credential_provider_process_1 = require_dist_cjs39(); - var credential_provider_sso_1 = require_dist_cjs47(); - var credential_provider_web_identity_1 = require_dist_cjs48(); - var property_provider_1 = require_dist_cjs6(); - var shared_ini_file_loader_1 = require_dist_cjs21(); - var remoteProvider_1 = require_remoteProvider(); - var defaultProvider = (init = {}) => (0, property_provider_1.memoize)((0, property_provider_1.chain)(...init.profile || process.env[shared_ini_file_loader_1.ENV_PROFILE] ? [] : [(0, credential_provider_env_1.fromEnv)()], (0, credential_provider_sso_1.fromSSO)(init), (0, credential_provider_ini_1.fromIni)(init), (0, credential_provider_process_1.fromProcess)(init), (0, credential_provider_web_identity_1.fromTokenFile)(init), (0, remoteProvider_1.remoteProvider)(init), async () => { - throw new property_provider_1.CredentialsProviderError("Could not load credentials from any providers", false); - }), (credentials) => credentials.expiration !== void 0 && credentials.expiration.getTime() - Date.now() < 3e5, (credentials) => credentials.expiration !== void 0); - exports2.defaultProvider = defaultProvider; + __name(_FetchHttpHandler, "FetchHttpHandler"); + var FetchHttpHandler = _FetchHttpHandler; + var import_util_base64 = require_dist_cjs29(); + var streamCollector = /* @__PURE__ */ __name((stream) => { + if (typeof Blob === "function" && stream instanceof Blob) { + return collectBlob(stream); + } + return collectStream(stream); + }, "streamCollector"); + async function collectBlob(blob) { + const base64 = await readToBase64(blob); + const arrayBuffer = (0, import_util_base64.fromBase64)(base64); + return new Uint8Array(arrayBuffer); + } + __name(collectBlob, "collectBlob"); + async function collectStream(stream) { + const chunks = []; + const reader = stream.getReader(); + let isDone = false; + let length = 0; + while (!isDone) { + const { done, value } = await reader.read(); + if (value) { + chunks.push(value); + length += value.length; + } + isDone = done; + } + const collected = new Uint8Array(length); + let offset = 0; + for (const chunk of chunks) { + collected.set(chunk, offset); + offset += chunk.length; + } + return collected; + } + __name(collectStream, "collectStream"); + function readToBase64(blob) { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.onloadend = () => { + if (reader.readyState !== 2) { + return reject(new Error("Reader aborted too early")); + } + const result = reader.result ?? ""; + const commaIndex = result.indexOf(","); + const dataOffset = commaIndex > -1 ? commaIndex + 1 : result.length; + resolve(result.substring(dataOffset)); + }; + reader.onabort = () => reject(new Error("Read aborted")); + reader.onerror = () => reject(reader.error); + reader.readAsDataURL(blob); + }); + } + __name(readToBase64, "readToBase64"); } }); -// ../../../node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js -var require_dist_cjs50 = __commonJS({ - "../../../node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js"(exports2) { +// ../../../node_modules/@smithy/util-stream/dist-cjs/stream-type-check.js +var require_stream_type_check2 = __commonJS({ + "../../../node_modules/@smithy/util-stream/dist-cjs/stream-type-check.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_defaultProvider(), exports2); + exports2.isReadableStream = void 0; + var isReadableStream2 = (stream) => { + var _a; + return typeof ReadableStream === "function" && (((_a = stream === null || stream === void 0 ? void 0 : stream.constructor) === null || _a === void 0 ? void 0 : _a.name) === ReadableStream.name || stream instanceof ReadableStream); + }; + exports2.isReadableStream = isReadableStream2; } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/ruleset.js -var require_ruleset2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/ruleset.js"(exports2) { +// ../../../node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.browser.js +var require_sdk_stream_mixin_browser2 = __commonJS({ + "../../../node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.browser.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ruleSet = void 0; - var F = "required"; - var G = "type"; - var H = "fn"; - var I = "argv"; - var J = "ref"; - var a = false; - var b = true; - var c = "booleanEquals"; - var d = "tree"; - var e = "stringEquals"; - var f = "sigv4"; - var g = "sts"; - var h = "us-east-1"; - var i = "endpoint"; - var j = "https://sts.{Region}.{PartitionResult#dnsSuffix}"; - var k = "error"; - var l = "getAttr"; - var m = { [F]: false, [G]: "String" }; - var n = { [F]: true, "default": false, [G]: "Boolean" }; - var o = { [J]: "Endpoint" }; - var p = { [H]: "isSet", [I]: [{ [J]: "Region" }] }; - var q = { [J]: "Region" }; - var r = { [H]: "aws.partition", [I]: [q], "assign": "PartitionResult" }; - var s = { [J]: "UseFIPS" }; - var t = { [J]: "UseDualStack" }; - var u = { "url": "https://sts.amazonaws.com", "properties": { "authSchemes": [{ "name": f, "signingName": g, "signingRegion": h }] }, "headers": {} }; - var v = {}; - var w = { "conditions": [{ [H]: e, [I]: [q, "aws-global"] }], [i]: u, [G]: i }; - var x = { [H]: c, [I]: [s, true] }; - var y = { [H]: c, [I]: [t, true] }; - var z = { [H]: c, [I]: [true, { [H]: l, [I]: [{ [J]: "PartitionResult" }, "supportsFIPS"] }] }; - var A = { [J]: "PartitionResult" }; - var B = { [H]: c, [I]: [true, { [H]: l, [I]: [A, "supportsDualStack"] }] }; - var C = [{ [H]: "isSet", [I]: [o] }]; - var D = [x]; - var E = [y]; - var _data = { version: "1.0", parameters: { Region: m, UseDualStack: n, UseFIPS: n, Endpoint: m, UseGlobalEndpoint: n }, rules: [{ conditions: [{ [H]: c, [I]: [{ [J]: "UseGlobalEndpoint" }, b] }, { [H]: "not", [I]: C }, p, r, { [H]: c, [I]: [s, a] }, { [H]: c, [I]: [t, a] }], [G]: d, rules: [{ conditions: [{ [H]: e, [I]: [q, "ap-northeast-1"] }], endpoint: u, [G]: i }, { conditions: [{ [H]: e, [I]: [q, "ap-south-1"] }], endpoint: u, [G]: i }, { conditions: [{ [H]: e, [I]: [q, "ap-southeast-1"] }], endpoint: u, [G]: i }, { conditions: [{ [H]: e, [I]: [q, "ap-southeast-2"] }], endpoint: u, [G]: i }, w, { conditions: [{ [H]: e, [I]: [q, "ca-central-1"] }], endpoint: u, [G]: i }, { conditions: [{ [H]: e, [I]: [q, "eu-central-1"] }], endpoint: u, [G]: i }, { conditions: [{ [H]: e, [I]: [q, "eu-north-1"] }], endpoint: u, [G]: i }, { conditions: [{ [H]: e, [I]: [q, "eu-west-1"] }], endpoint: u, [G]: i }, { conditions: [{ [H]: e, [I]: [q, "eu-west-2"] }], endpoint: u, [G]: i }, { conditions: [{ [H]: e, [I]: [q, "eu-west-3"] }], endpoint: u, [G]: i }, { conditions: [{ [H]: e, [I]: [q, "sa-east-1"] }], endpoint: u, [G]: i }, { conditions: [{ [H]: e, [I]: [q, h] }], endpoint: u, [G]: i }, { conditions: [{ [H]: e, [I]: [q, "us-east-2"] }], endpoint: u, [G]: i }, { conditions: [{ [H]: e, [I]: [q, "us-west-1"] }], endpoint: u, [G]: i }, { conditions: [{ [H]: e, [I]: [q, "us-west-2"] }], endpoint: u, [G]: i }, { endpoint: { url: j, properties: { authSchemes: [{ name: f, signingName: g, signingRegion: "{Region}" }] }, headers: v }, [G]: i }] }, { conditions: C, [G]: d, rules: [{ conditions: D, error: "Invalid Configuration: FIPS and custom endpoint are not supported", [G]: k }, { conditions: E, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", [G]: k }, { endpoint: { url: o, properties: v, headers: v }, [G]: i }] }, { conditions: [p], [G]: d, rules: [{ conditions: [r], [G]: d, rules: [{ conditions: [x, y], [G]: d, rules: [{ conditions: [z, B], [G]: d, rules: [{ endpoint: { url: "https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: v, headers: v }, [G]: i }] }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", [G]: k }] }, { conditions: D, [G]: d, rules: [{ conditions: [z], [G]: d, rules: [{ conditions: [{ [H]: e, [I]: ["aws-us-gov", { [H]: l, [I]: [A, "name"] }] }], endpoint: { url: "https://sts.{Region}.amazonaws.com", properties: v, headers: v }, [G]: i }, { endpoint: { url: "https://sts-fips.{Region}.{PartitionResult#dnsSuffix}", properties: v, headers: v }, [G]: i }] }, { error: "FIPS is enabled but this partition does not support FIPS", [G]: k }] }, { conditions: E, [G]: d, rules: [{ conditions: [B], [G]: d, rules: [{ endpoint: { url: "https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: v, headers: v }, [G]: i }] }, { error: "DualStack is enabled but this partition does not support DualStack", [G]: k }] }, w, { endpoint: { url: j, properties: v, headers: v }, [G]: i }] }] }, { error: "Invalid Configuration: Missing Region", [G]: k }] }; - exports2.ruleSet = _data; + exports2.sdkStreamMixin = void 0; + var fetch_http_handler_1 = require_dist_cjs53(); + var util_base64_1 = require_dist_cjs29(); + var util_hex_encoding_1 = require_dist_cjs35(); + var util_utf8_1 = require_dist_cjs28(); + var stream_type_check_1 = require_stream_type_check2(); + var ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED = "The stream has already been transformed."; + var sdkStreamMixin2 = (stream) => { + var _a, _b; + if (!isBlobInstance(stream) && !(0, stream_type_check_1.isReadableStream)(stream)) { + const name = ((_b = (_a = stream === null || stream === void 0 ? void 0 : stream.__proto__) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) || stream; + throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${name}`); + } + let transformed = false; + const transformToByteArray = async () => { + if (transformed) { + throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED); + } + transformed = true; + return await (0, fetch_http_handler_1.streamCollector)(stream); + }; + const blobToWebStream = (blob) => { + if (typeof blob.stream !== "function") { + throw new Error("Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.\nIf you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body"); + } + return blob.stream(); + }; + return Object.assign(stream, { + transformToByteArray, + transformToString: async (encoding) => { + const buf = await transformToByteArray(); + if (encoding === "base64") { + return (0, util_base64_1.toBase64)(buf); + } else if (encoding === "hex") { + return (0, util_hex_encoding_1.toHex)(buf); + } else if (encoding === void 0 || encoding === "utf8" || encoding === "utf-8") { + return (0, util_utf8_1.toUtf8)(buf); + } else if (typeof TextDecoder === "function") { + return new TextDecoder(encoding).decode(buf); + } else { + throw new Error("TextDecoder is not available, please make sure polyfill is provided."); + } + }, + transformToWebStream: () => { + if (transformed) { + throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED); + } + transformed = true; + if (isBlobInstance(stream)) { + return blobToWebStream(stream); + } else if ((0, stream_type_check_1.isReadableStream)(stream)) { + return stream; + } else { + throw new Error(`Cannot transform payload to web stream, got ${stream}`); + } + } + }); + }; + exports2.sdkStreamMixin = sdkStreamMixin2; + var isBlobInstance = (stream) => typeof Blob === "function" && stream instanceof Blob; } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/endpointResolver.js -var require_endpointResolver2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/endpointResolver.js"(exports2) { +// ../../../node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.js +var require_sdk_stream_mixin2 = __commonJS({ + "../../../node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.defaultEndpointResolver = void 0; - var util_endpoints_1 = require_dist_cjs16(); - var ruleset_1 = require_ruleset2(); - var defaultEndpointResolver = (endpointParams, context = {}) => { - return (0, util_endpoints_1.resolveEndpoint)(ruleset_1.ruleSet, { - endpointParams, - logger: context.logger + exports2.sdkStreamMixin = void 0; + var node_http_handler_1 = require_dist_cjs51(); + var util_buffer_from_1 = require_dist_cjs27(); + var stream_1 = require("stream"); + var util_1 = require("util"); + var sdk_stream_mixin_browser_1 = require_sdk_stream_mixin_browser2(); + var ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED = "The stream has already been transformed."; + var sdkStreamMixin2 = (stream) => { + var _a, _b; + if (!(stream instanceof stream_1.Readable)) { + try { + return (0, sdk_stream_mixin_browser_1.sdkStreamMixin)(stream); + } catch (e) { + const name = ((_b = (_a = stream === null || stream === void 0 ? void 0 : stream.__proto__) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) || stream; + throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${name}`); + } + } + let transformed = false; + const transformToByteArray = async () => { + if (transformed) { + throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED); + } + transformed = true; + return await (0, node_http_handler_1.streamCollector)(stream); + }; + return Object.assign(stream, { + transformToByteArray, + transformToString: async (encoding) => { + const buf = await transformToByteArray(); + if (encoding === void 0 || Buffer.isEncoding(encoding)) { + return (0, util_buffer_from_1.fromArrayBuffer)(buf.buffer, buf.byteOffset, buf.byteLength).toString(encoding); + } else { + const decoder2 = new util_1.TextDecoder(encoding); + return decoder2.decode(buf); + } + }, + transformToWebStream: () => { + if (transformed) { + throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED); + } + if (stream.readableFlowing !== null) { + throw new Error("The stream has been consumed by other callbacks."); + } + if (typeof stream_1.Readable.toWeb !== "function") { + throw new Error("Readable.toWeb() is not supported. Please make sure you are using Node.js >= 17.0.0, or polyfill is available."); + } + transformed = true; + return stream_1.Readable.toWeb(stream); + } }); }; - exports2.defaultEndpointResolver = defaultEndpointResolver; + exports2.sdkStreamMixin = sdkStreamMixin2; } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.shared.js -var require_runtimeConfig_shared2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.shared.js"(exports2) { +// ../../../node_modules/@smithy/util-stream/dist-cjs/splitStream.browser.js +var require_splitStream_browser2 = __commonJS({ + "../../../node_modules/@smithy/util-stream/dist-cjs/splitStream.browser.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getRuntimeConfig = void 0; - var smithy_client_1 = require_dist_cjs34(); - var url_parser_1 = require_dist_cjs24(); - var util_base64_1 = require_dist_cjs30(); - var util_utf8_1 = require_dist_cjs10(); - var endpointResolver_1 = require_endpointResolver2(); - var getRuntimeConfig = (config) => ({ - apiVersion: "2011-06-15", - base64Decoder: config?.base64Decoder ?? util_base64_1.fromBase64, - base64Encoder: config?.base64Encoder ?? util_base64_1.toBase64, - disableHostPrefix: config?.disableHostPrefix ?? false, - endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver, - extensions: config?.extensions ?? [], - logger: config?.logger ?? new smithy_client_1.NoOpLogger(), - serviceId: config?.serviceId ?? "STS", - urlParser: config?.urlParser ?? url_parser_1.parseUrl, - utf8Decoder: config?.utf8Decoder ?? util_utf8_1.fromUtf8, - utf8Encoder: config?.utf8Encoder ?? util_utf8_1.toUtf8 - }); - exports2.getRuntimeConfig = getRuntimeConfig; + exports2.splitStream = void 0; + async function splitStream2(stream) { + if (typeof stream.stream === "function") { + stream = stream.stream(); + } + const readableStream = stream; + return readableStream.tee(); + } + exports2.splitStream = splitStream2; } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.js -var require_runtimeConfig2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.js"(exports2) { +// ../../../node_modules/@smithy/util-stream/dist-cjs/splitStream.js +var require_splitStream2 = __commonJS({ + "../../../node_modules/@smithy/util-stream/dist-cjs/splitStream.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getRuntimeConfig = void 0; - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - var package_json_1 = tslib_1.__importDefault(require_package2()); - var defaultStsRoleAssumers_1 = require_defaultStsRoleAssumers(); - var credential_provider_node_1 = require_dist_cjs50(); - var util_user_agent_node_1 = require_dist_cjs40(); - var config_resolver_1 = require_dist_cjs19(); - var hash_node_1 = require_dist_cjs41(); - var middleware_retry_1 = require_dist_cjs35(); - var node_config_provider_1 = require_dist_cjs22(); - var node_http_handler_1 = require_dist_cjs32(); - var util_body_length_node_1 = require_dist_cjs42(); - var util_retry_1 = require_dist_cjs28(); - var runtimeConfig_shared_1 = require_runtimeConfig_shared2(); - var smithy_client_1 = require_dist_cjs34(); - var util_defaults_mode_node_1 = require_dist_cjs43(); - var smithy_client_2 = require_dist_cjs34(); - var getRuntimeConfig = (config) => { - (0, smithy_client_2.emitWarningIfUnsupportedVersion)(process.version); - const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config); - const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode); - const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config); - return { - ...clientSharedValues, - ...config, - runtime: "node", - defaultsMode, - bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength, - credentialDefaultProvider: config?.credentialDefaultProvider ?? (0, defaultStsRoleAssumers_1.decorateDefaultCredentialProvider)(credential_provider_node_1.defaultProvider), - defaultUserAgentProvider: config?.defaultUserAgentProvider ?? (0, util_user_agent_node_1.defaultUserAgent)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }), - maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: config?.region ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_REGION_CONFIG_OPTIONS, config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: config?.requestHandler ?? new node_http_handler_1.NodeHttpHandler(defaultConfigProvider), - retryMode: config?.retryMode ?? (0, node_config_provider_1.loadConfig)({ - ...middleware_retry_1.NODE_RETRY_MODE_CONFIG_OPTIONS, - default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE - }), - sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, "sha256"), - streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector, - useDualstackEndpoint: config?.useDualstackEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), - useFipsEndpoint: config?.useFipsEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS) - }; - }; - exports2.getRuntimeConfig = getRuntimeConfig; + exports2.splitStream = void 0; + var stream_1 = require("stream"); + var splitStream_browser_1 = require_splitStream_browser2(); + var stream_type_check_1 = require_stream_type_check2(); + async function splitStream2(stream) { + if ((0, stream_type_check_1.isReadableStream)(stream)) { + return (0, splitStream_browser_1.splitStream)(stream); + } + const stream1 = new stream_1.PassThrough(); + const stream2 = new stream_1.PassThrough(); + stream.pipe(stream1); + stream.pipe(stream2); + return [stream1, stream2]; + } + exports2.splitStream = splitStream2; } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeExtensions.js -var require_runtimeExtensions2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeExtensions.js"(exports2) { +// ../../../node_modules/@smithy/util-stream/dist-cjs/headStream.browser.js +var require_headStream_browser2 = __commonJS({ + "../../../node_modules/@smithy/util-stream/dist-cjs/headStream.browser.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveRuntimeExtensions = void 0; - var region_config_resolver_1 = require_dist_cjs44(); - var protocol_http_1 = require_dist_cjs2(); - var smithy_client_1 = require_dist_cjs34(); - var asPartial = (t) => t; - var resolveRuntimeExtensions = (runtimeConfig, extensions) => { - const extensionConfiguration = { - ...asPartial((0, region_config_resolver_1.getAwsRegionExtensionConfiguration)(runtimeConfig)), - ...asPartial((0, smithy_client_1.getDefaultExtensionConfiguration)(runtimeConfig)), - ...asPartial((0, protocol_http_1.getHttpHandlerExtensionConfiguration)(runtimeConfig)) - }; - extensions.forEach((extension) => extension.configure(extensionConfiguration)); - return { - ...runtimeConfig, - ...(0, region_config_resolver_1.resolveAwsRegionExtensionConfiguration)(extensionConfiguration), - ...(0, smithy_client_1.resolveDefaultRuntimeConfig)(extensionConfiguration), - ...(0, protocol_http_1.resolveHttpHandlerRuntimeConfig)(extensionConfiguration) - }; - }; - exports2.resolveRuntimeExtensions = resolveRuntimeExtensions; + exports2.headStream = void 0; + async function headStream2(stream, bytes) { + var _a; + let byteLengthCounter = 0; + const chunks = []; + const reader = stream.getReader(); + let isDone = false; + while (!isDone) { + const { done, value } = await reader.read(); + if (value) { + chunks.push(value); + byteLengthCounter += (_a = value === null || value === void 0 ? void 0 : value.byteLength) !== null && _a !== void 0 ? _a : 0; + } + if (byteLengthCounter >= bytes) { + break; + } + isDone = done; + } + reader.releaseLock(); + const collected = new Uint8Array(Math.min(bytes, byteLengthCounter)); + let offset = 0; + for (const chunk of chunks) { + if (chunk.byteLength > collected.byteLength - offset) { + collected.set(chunk.subarray(0, collected.byteLength - offset), offset); + break; + } else { + collected.set(chunk, offset); + } + offset += chunk.length; + } + return collected; + } + exports2.headStream = headStream2; } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/STSClient.js -var require_STSClient = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/STSClient.js"(exports2) { +// ../../../node_modules/@smithy/util-stream/dist-cjs/headStream.js +var require_headStream2 = __commonJS({ + "../../../node_modules/@smithy/util-stream/dist-cjs/headStream.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.STSClient = exports2.__Client = void 0; - var middleware_host_header_1 = require_dist_cjs3(); - var middleware_logger_1 = require_dist_cjs4(); - var middleware_recursion_detection_1 = require_dist_cjs5(); - var middleware_sdk_sts_1 = require_dist_cjs36(); - var middleware_user_agent_1 = require_dist_cjs17(); - var config_resolver_1 = require_dist_cjs19(); - var middleware_content_length_1 = require_dist_cjs20(); - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_retry_1 = require_dist_cjs35(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "__Client", { enumerable: true, get: function() { - return smithy_client_1.Client; - } }); - var EndpointParameters_1 = require_EndpointParameters2(); - var runtimeConfig_1 = require_runtimeConfig2(); - var runtimeExtensions_1 = require_runtimeExtensions2(); - var STSClient = class _STSClient extends smithy_client_1.Client { - constructor(...[configuration]) { - const _config_0 = (0, runtimeConfig_1.getRuntimeConfig)(configuration || {}); - const _config_1 = (0, EndpointParameters_1.resolveClientEndpointParameters)(_config_0); - const _config_2 = (0, config_resolver_1.resolveRegionConfig)(_config_1); - const _config_3 = (0, middleware_endpoint_1.resolveEndpointConfig)(_config_2); - const _config_4 = (0, middleware_retry_1.resolveRetryConfig)(_config_3); - const _config_5 = (0, middleware_host_header_1.resolveHostHeaderConfig)(_config_4); - const _config_6 = (0, middleware_sdk_sts_1.resolveStsAuthConfig)(_config_5, { stsClientCtor: _STSClient }); - const _config_7 = (0, middleware_user_agent_1.resolveUserAgentConfig)(_config_6); - const _config_8 = (0, runtimeExtensions_1.resolveRuntimeExtensions)(_config_7, configuration?.extensions || []); - super(_config_8); - this.config = _config_8; - this.middlewareStack.use((0, middleware_retry_1.getRetryPlugin)(this.config)); - this.middlewareStack.use((0, middleware_content_length_1.getContentLengthPlugin)(this.config)); - this.middlewareStack.use((0, middleware_host_header_1.getHostHeaderPlugin)(this.config)); - this.middlewareStack.use((0, middleware_logger_1.getLoggerPlugin)(this.config)); - this.middlewareStack.use((0, middleware_recursion_detection_1.getRecursionDetectionPlugin)(this.config)); - this.middlewareStack.use((0, middleware_user_agent_1.getUserAgentPlugin)(this.config)); + exports2.headStream = void 0; + var stream_1 = require("stream"); + var headStream_browser_1 = require_headStream_browser2(); + var stream_type_check_1 = require_stream_type_check2(); + var headStream2 = (stream, bytes) => { + if ((0, stream_type_check_1.isReadableStream)(stream)) { + return (0, headStream_browser_1.headStream)(stream, bytes); } - destroy() { - super.destroy(); + return new Promise((resolve, reject) => { + const collector = new Collector(); + collector.limit = bytes; + stream.pipe(collector); + stream.on("error", (err) => { + collector.end(); + reject(err); + }); + collector.on("error", reject); + collector.on("finish", function() { + const bytes2 = new Uint8Array(Buffer.concat(this.buffers)); + resolve(bytes2); + }); + }); + }; + exports2.headStream = headStream2; + var Collector = class extends stream_1.Writable { + constructor() { + super(...arguments); + this.buffers = []; + this.limit = Infinity; + this.bytesBuffered = 0; + } + _write(chunk, encoding, callback) { + var _a; + this.buffers.push(chunk); + this.bytesBuffered += (_a = chunk.byteLength) !== null && _a !== void 0 ? _a : 0; + if (this.bytesBuffered >= this.limit) { + const excess = this.bytesBuffered - this.limit; + const tailBuffer = this.buffers[this.buffers.length - 1]; + this.buffers[this.buffers.length - 1] = tailBuffer.subarray(0, tailBuffer.byteLength - excess); + this.emit("finish"); + } + callback(); } }; - exports2.STSClient = STSClient; } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/AssumeRoleWithSAMLCommand.js -var require_AssumeRoleWithSAMLCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/AssumeRoleWithSAMLCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.AssumeRoleWithSAMLCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_0(); - var Aws_query_1 = require_Aws_query(); - var AssumeRoleWithSAMLCommand = class _AssumeRoleWithSAMLCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseGlobalEndpoint: { type: "builtInParams", name: "useGlobalEndpoint" }, - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; +// ../../../node_modules/@smithy/util-stream/dist-cjs/index.js +var require_dist_cjs54 = __commonJS({ + "../../../node_modules/@smithy/util-stream/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - constructor(input) { - super(); - this.input = input; + return to; + }; + var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + Uint8ArrayBlobAdapter: () => Uint8ArrayBlobAdapter + }); + module2.exports = __toCommonJS2(src_exports); + var import_util_base64 = require_dist_cjs29(); + var import_util_utf8 = require_dist_cjs28(); + function transformToString(payload, encoding = "utf-8") { + if (encoding === "base64") { + return (0, import_util_base64.toBase64)(payload); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _AssumeRoleWithSAMLCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "STSClient"; - const commandName = "AssumeRoleWithSAMLCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.AssumeRoleWithSAMLRequestFilterSensitiveLog, - outputFilterSensitiveLog: models_0_1.AssumeRoleWithSAMLResponseFilterSensitiveLog, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSSecurityTokenServiceV20110615", - operation: "AssumeRoleWithSAML" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + return (0, import_util_utf8.toUtf8)(payload); + } + __name(transformToString, "transformToString"); + function transformFromString(str, encoding) { + if (encoding === "base64") { + return Uint8ArrayBlobAdapter.mutate((0, import_util_base64.fromBase64)(str)); + } + return Uint8ArrayBlobAdapter.mutate((0, import_util_utf8.fromUtf8)(str)); + } + __name(transformFromString, "transformFromString"); + var _Uint8ArrayBlobAdapter = class _Uint8ArrayBlobAdapter2 extends Uint8Array { + /** + * @param source - such as a string or Stream. + * @returns a new Uint8ArrayBlobAdapter extending Uint8Array. + */ + static fromString(source, encoding = "utf-8") { + switch (typeof source) { + case "string": + return transformFromString(source, encoding); + default: + throw new Error(`Unsupported conversion from ${typeof source} to Uint8ArrayBlobAdapter.`); + } } - serialize(input, context) { - return (0, Aws_query_1.se_AssumeRoleWithSAMLCommand)(input, context); + /** + * @param source - Uint8Array to be mutated. + * @returns the same Uint8Array but with prototype switched to Uint8ArrayBlobAdapter. + */ + static mutate(source) { + Object.setPrototypeOf(source, _Uint8ArrayBlobAdapter2.prototype); + return source; } - deserialize(output, context) { - return (0, Aws_query_1.de_AssumeRoleWithSAMLCommand)(output, context); + /** + * @param encoding - default 'utf-8'. + * @returns the blob as string. + */ + transformToString(encoding = "utf-8") { + return transformToString(this, encoding); } }; - exports2.AssumeRoleWithSAMLCommand = AssumeRoleWithSAMLCommand; + __name(_Uint8ArrayBlobAdapter, "Uint8ArrayBlobAdapter"); + var Uint8ArrayBlobAdapter = _Uint8ArrayBlobAdapter; + __reExport(src_exports, require_getAwsChunkedEncodingStream2(), module2.exports); + __reExport(src_exports, require_sdk_stream_mixin2(), module2.exports); + __reExport(src_exports, require_splitStream2(), module2.exports); + __reExport(src_exports, require_headStream2(), module2.exports); + __reExport(src_exports, require_stream_type_check2(), module2.exports); } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/DecodeAuthorizationMessageCommand.js -var require_DecodeAuthorizationMessageCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/DecodeAuthorizationMessageCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/requestHelpers.js +var require_requestHelpers = __commonJS({ + "../../../node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/requestHelpers.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DecodeAuthorizationMessageCommand = exports2.$Command = void 0; - var middleware_signing_1 = require_dist_cjs14(); - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_query_1 = require_Aws_query(); - var DecodeAuthorizationMessageCommand = class _DecodeAuthorizationMessageCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { + exports2.getCredentials = exports2.createGetRequest = void 0; + var property_provider_1 = require_dist_cjs40(); + var protocol_http_1 = require_dist_cjs2(); + var smithy_client_1 = require_dist_cjs37(); + var util_stream_1 = require_dist_cjs54(); + function createGetRequest(url2) { + return new protocol_http_1.HttpRequest({ + protocol: url2.protocol, + hostname: url2.hostname, + port: Number(url2.port), + path: url2.pathname, + query: Array.from(url2.searchParams.entries()).reduce((acc, [k, v]) => { + acc[k] = v; + return acc; + }, {}), + fragment: url2.hash + }); + } + exports2.createGetRequest = createGetRequest; + async function getCredentials(response, logger) { + const stream = (0, util_stream_1.sdkStreamMixin)(response.body); + const str = await stream.transformToString(); + if (response.statusCode === 200) { + const parsed = JSON.parse(str); + if (typeof parsed.AccessKeyId !== "string" || typeof parsed.SecretAccessKey !== "string" || typeof parsed.Token !== "string" || typeof parsed.Expiration !== "string") { + throw new property_provider_1.CredentialsProviderError("HTTP credential provider response not of the required format, an object matching: { AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }", { logger }); + } return { - UseGlobalEndpoint: { type: "builtInParams", name: "useGlobalEndpoint" }, - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } + accessKeyId: parsed.AccessKeyId, + secretAccessKey: parsed.SecretAccessKey, + sessionToken: parsed.Token, + expiration: (0, smithy_client_1.parseRfc3339DateTime)(parsed.Expiration) }; } - constructor(input) { - super(); - this.input = input; + if (response.statusCode >= 400 && response.statusCode < 500) { + let parsedBody = {}; + try { + parsedBody = JSON.parse(str); + } catch (e) { + } + throw Object.assign(new property_provider_1.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger }), { + Code: parsedBody.Code, + Message: parsedBody.Message + }); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _DecodeAuthorizationMessageCommand.getEndpointParameterInstructions())); - this.middlewareStack.use((0, middleware_signing_1.getAwsAuthPlugin)(configuration)); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "STSClient"; - const commandName = "DecodeAuthorizationMessageCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSSecurityTokenServiceV20110615", - operation: "DecodeAuthorizationMessage" + throw new property_provider_1.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger }); + } + exports2.getCredentials = getCredentials; + } +}); + +// ../../../node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/retry-wrapper.js +var require_retry_wrapper = __commonJS({ + "../../../node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/retry-wrapper.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.retryWrapper = void 0; + var retryWrapper = (toRetry, maxRetries, delayMs) => { + return async () => { + for (let i = 0; i < maxRetries; ++i) { + try { + return await toRetry(); + } catch (e) { + await new Promise((resolve) => setTimeout(resolve, delayMs)); } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_query_1.se_DecodeAuthorizationMessageCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_query_1.de_DecodeAuthorizationMessageCommand)(output, context); - } + } + return await toRetry(); + }; }; - exports2.DecodeAuthorizationMessageCommand = DecodeAuthorizationMessageCommand; + exports2.retryWrapper = retryWrapper; } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/GetAccessKeyInfoCommand.js -var require_GetAccessKeyInfoCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/GetAccessKeyInfoCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/fromHttp.js +var require_fromHttp = __commonJS({ + "../../../node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/fromHttp.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.GetAccessKeyInfoCommand = exports2.$Command = void 0; - var middleware_signing_1 = require_dist_cjs14(); - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_query_1 = require_Aws_query(); - var GetAccessKeyInfoCommand = class _GetAccessKeyInfoCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseGlobalEndpoint: { type: "builtInParams", name: "useGlobalEndpoint" }, - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _GetAccessKeyInfoCommand.getEndpointParameterInstructions())); - this.middlewareStack.use((0, middleware_signing_1.getAwsAuthPlugin)(configuration)); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "STSClient"; - const commandName = "GetAccessKeyInfoCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSSecurityTokenServiceV20110615", - operation: "GetAccessKeyInfo" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_query_1.se_GetAccessKeyInfoCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_query_1.de_GetAccessKeyInfoCommand)(output, context); - } + exports2.fromHttp = void 0; + var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); + var node_http_handler_1 = require_dist_cjs51(); + var property_provider_1 = require_dist_cjs40(); + var promises_1 = tslib_1.__importDefault(require("fs/promises")); + var checkUrl_1 = require_checkUrl(); + var requestHelpers_1 = require_requestHelpers(); + var retry_wrapper_1 = require_retry_wrapper(); + var AWS_CONTAINER_CREDENTIALS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"; + var DEFAULT_LINK_LOCAL_HOST = "http://169.254.170.2"; + var AWS_CONTAINER_CREDENTIALS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI"; + var AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE = "AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE"; + var AWS_CONTAINER_AUTHORIZATION_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN"; + var fromHttp = (options = {}) => { + options.logger?.debug("@aws-sdk/credential-provider-http - fromHttp"); + let host; + const relative = options.awsContainerCredentialsRelativeUri ?? process.env[AWS_CONTAINER_CREDENTIALS_RELATIVE_URI]; + const full = options.awsContainerCredentialsFullUri ?? process.env[AWS_CONTAINER_CREDENTIALS_FULL_URI]; + const token = options.awsContainerAuthorizationToken ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN]; + const tokenFile = options.awsContainerAuthorizationTokenFile ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE]; + const warn = options.logger?.constructor?.name === "NoOpLogger" || !options.logger ? console.warn : options.logger.warn; + if (relative && full) { + warn("@aws-sdk/credential-provider-http: you have set both awsContainerCredentialsRelativeUri and awsContainerCredentialsFullUri."); + warn("awsContainerCredentialsFullUri will take precedence."); + } + if (token && tokenFile) { + warn("@aws-sdk/credential-provider-http: you have set both awsContainerAuthorizationToken and awsContainerAuthorizationTokenFile."); + warn("awsContainerAuthorizationToken will take precedence."); + } + if (full) { + host = full; + } else if (relative) { + host = `${DEFAULT_LINK_LOCAL_HOST}${relative}`; + } else { + throw new property_provider_1.CredentialsProviderError(`No HTTP credential provider host provided. +Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.`, { logger: options.logger }); + } + const url2 = new URL(host); + (0, checkUrl_1.checkUrl)(url2, options.logger); + const requestHandler = new node_http_handler_1.NodeHttpHandler({ + requestTimeout: options.timeout ?? 1e3, + connectionTimeout: options.timeout ?? 1e3 + }); + return (0, retry_wrapper_1.retryWrapper)(async () => { + const request2 = (0, requestHelpers_1.createGetRequest)(url2); + if (token) { + request2.headers.Authorization = token; + } else if (tokenFile) { + request2.headers.Authorization = (await promises_1.default.readFile(tokenFile)).toString(); + } + try { + const result = await requestHandler.handle(request2); + return (0, requestHelpers_1.getCredentials)(result.response); + } catch (e) { + throw new property_provider_1.CredentialsProviderError(String(e), { logger: options.logger }); + } + }, options.maxRetries ?? 3, options.timeout ?? 1e3); }; - exports2.GetAccessKeyInfoCommand = GetAccessKeyInfoCommand; + exports2.fromHttp = fromHttp; } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/GetCallerIdentityCommand.js -var require_GetCallerIdentityCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/GetCallerIdentityCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/credential-provider-http/dist-cjs/index.js +var require_dist_cjs55 = __commonJS({ + "../../../node_modules/@aws-sdk/credential-provider-http/dist-cjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.GetCallerIdentityCommand = exports2.$Command = void 0; - var middleware_signing_1 = require_dist_cjs14(); - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; + exports2.fromHttp = void 0; + var fromHttp_1 = require_fromHttp(); + Object.defineProperty(exports2, "fromHttp", { enumerable: true, get: function() { + return fromHttp_1.fromHttp; } }); - var types_1 = require_dist_cjs(); - var Aws_query_1 = require_Aws_query(); - var GetCallerIdentityCommand = class _GetCallerIdentityCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseGlobalEndpoint: { type: "builtInParams", name: "useGlobalEndpoint" }, - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _GetCallerIdentityCommand.getEndpointParameterInstructions())); - this.middlewareStack.use((0, middleware_signing_1.getAwsAuthPlugin)(configuration)); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "STSClient"; - const commandName = "GetCallerIdentityCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSSecurityTokenServiceV20110615", - operation: "GetCallerIdentity" + } +}); + +// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/auth/httpAuthSchemeProvider.js +var require_httpAuthSchemeProvider2 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso/dist-cjs/auth/httpAuthSchemeProvider.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.resolveHttpAuthSchemeConfig = exports2.defaultSSOHttpAuthSchemeProvider = exports2.defaultSSOHttpAuthSchemeParametersProvider = void 0; + var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var util_middleware_1 = require_dist_cjs10(); + var defaultSSOHttpAuthSchemeParametersProvider = async (config, context, input) => { + return { + operation: (0, util_middleware_1.getSmithyContext)(context).operation, + region: await (0, util_middleware_1.normalizeProvider)(config.region)() || (() => { + throw new Error("expected `region` to be configured for `aws.auth#sigv4`"); + })() + }; + }; + exports2.defaultSSOHttpAuthSchemeParametersProvider = defaultSSOHttpAuthSchemeParametersProvider; + function createAwsAuthSigv4HttpAuthOption(authParameters) { + return { + schemeId: "aws.auth#sigv4", + signingProperties: { + name: "awsssoportal", + region: authParameters.region + }, + propertiesExtractor: (config, context) => ({ + signingProperties: { + config, + context } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_query_1.se_GetCallerIdentityCommand)(input, context); + }) + }; + } + function createSmithyApiNoAuthHttpAuthOption(authParameters) { + return { + schemeId: "smithy.api#noAuth" + }; + } + var defaultSSOHttpAuthSchemeProvider = (authParameters) => { + const options = []; + switch (authParameters.operation) { + case "GetRoleCredentials": { + options.push(createSmithyApiNoAuthHttpAuthOption(authParameters)); + break; + } + case "ListAccountRoles": { + options.push(createSmithyApiNoAuthHttpAuthOption(authParameters)); + break; + } + case "ListAccounts": { + options.push(createSmithyApiNoAuthHttpAuthOption(authParameters)); + break; + } + case "Logout": { + options.push(createSmithyApiNoAuthHttpAuthOption(authParameters)); + break; + } + default: { + options.push(createAwsAuthSigv4HttpAuthOption(authParameters)); + } } - deserialize(output, context) { - return (0, Aws_query_1.de_GetCallerIdentityCommand)(output, context); + return options; + }; + exports2.defaultSSOHttpAuthSchemeProvider = defaultSSOHttpAuthSchemeProvider; + var resolveHttpAuthSchemeConfig = (config) => { + const config_0 = (0, core_1.resolveAwsSdkSigV4Config)(config); + return { + ...config_0 + }; + }; + exports2.resolveHttpAuthSchemeConfig = resolveHttpAuthSchemeConfig; + } +}); + +// ../../../node_modules/@aws-sdk/client-sso/package.json +var require_package2 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso/package.json"(exports2, module2) { + module2.exports = { + name: "@aws-sdk/client-sso", + description: "AWS SDK for JavaScript Sso Client for Node.js, Browser and React Native", + version: "3.632.0", + scripts: { + build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", + "build:cjs": "node ../../scripts/compilation/inline client-sso", + "build:es": "tsc -p tsconfig.es.json", + "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", + "build:types": "tsc -p tsconfig.types.json", + "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4", + clean: "rimraf ./dist-* && rimraf *.tsbuildinfo", + "extract:docs": "api-extractor run --local", + "generate:client": "node ../../scripts/generate-clients/single-service --solo sso" + }, + main: "./dist-cjs/index.js", + types: "./dist-types/index.d.ts", + module: "./dist-es/index.js", + sideEffects: false, + dependencies: { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/core": "3.629.0", + "@aws-sdk/middleware-host-header": "3.620.0", + "@aws-sdk/middleware-logger": "3.609.0", + "@aws-sdk/middleware-recursion-detection": "3.620.0", + "@aws-sdk/middleware-user-agent": "3.632.0", + "@aws-sdk/region-config-resolver": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.632.0", + "@aws-sdk/util-user-agent-browser": "3.609.0", + "@aws-sdk/util-user-agent-node": "3.614.0", + "@smithy/config-resolver": "^3.0.5", + "@smithy/core": "^2.3.2", + "@smithy/fetch-http-handler": "^3.2.4", + "@smithy/hash-node": "^3.0.3", + "@smithy/invalid-dependency": "^3.0.3", + "@smithy/middleware-content-length": "^3.0.5", + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.14", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", + "@smithy/util-base64": "^3.0.0", + "@smithy/util-body-length-browser": "^3.0.0", + "@smithy/util-body-length-node": "^3.0.0", + "@smithy/util-defaults-mode-browser": "^3.0.14", + "@smithy/util-defaults-mode-node": "^3.0.14", + "@smithy/util-endpoints": "^2.0.5", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", + "@smithy/util-utf8": "^3.0.0", + tslib: "^2.6.2" + }, + devDependencies: { + "@tsconfig/node16": "16.1.3", + "@types/node": "^16.18.96", + concurrently: "7.0.0", + "downlevel-dts": "0.10.1", + rimraf: "3.0.2", + typescript: "~4.9.5" + }, + engines: { + node: ">=16.0.0" + }, + typesVersions: { + "<4.0": { + "dist-types/*": [ + "dist-types/ts3.4/*" + ] + } + }, + files: [ + "dist-*/**" + ], + author: { + name: "AWS SDK for JavaScript Team", + url: "https://aws.amazon.com/javascript/" + }, + license: "Apache-2.0", + browser: { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" + }, + "react-native": { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" + }, + homepage: "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-sso", + repository: { + type: "git", + url: "https://github.com/aws/aws-sdk-js-v3.git", + directory: "clients/client-sso" } }; - exports2.GetCallerIdentityCommand = GetCallerIdentityCommand; } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/GetFederationTokenCommand.js -var require_GetFederationTokenCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/GetFederationTokenCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js +var require_dist_cjs56 = __commonJS({ + "../../../node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js"(exports2, module2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.GetFederationTokenCommand = exports2.$Command = void 0; - var middleware_signing_1 = require_dist_cjs14(); - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_0(); - var Aws_query_1 = require_Aws_query(); - var GetFederationTokenCommand = class _GetFederationTokenCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseGlobalEndpoint: { type: "builtInParams", name: "useGlobalEndpoint" }, - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - constructor(input) { - super(); - this.input = input; + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + UA_APP_ID_ENV_NAME: () => UA_APP_ID_ENV_NAME, + UA_APP_ID_INI_NAME: () => UA_APP_ID_INI_NAME, + crtAvailability: () => crtAvailability, + defaultUserAgent: () => defaultUserAgent + }); + module2.exports = __toCommonJS2(src_exports); + var import_node_config_provider = require_dist_cjs42(); + var import_os = require("os"); + var import_process = require("process"); + var crtAvailability = { + isCrtAvailable: false + }; + var isCrtAvailable = /* @__PURE__ */ __name(() => { + if (crtAvailability.isCrtAvailable) { + return ["md/crt-avail"]; } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _GetFederationTokenCommand.getEndpointParameterInstructions())); - this.middlewareStack.use((0, middleware_signing_1.getAwsAuthPlugin)(configuration)); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "STSClient"; - const commandName = "GetFederationTokenCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: models_0_1.GetFederationTokenResponseFilterSensitiveLog, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSSecurityTokenServiceV20110615", - operation: "GetFederationToken" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + return null; + }, "isCrtAvailable"); + var UA_APP_ID_ENV_NAME = "AWS_SDK_UA_APP_ID"; + var UA_APP_ID_INI_NAME = "sdk-ua-app-id"; + var defaultUserAgent = /* @__PURE__ */ __name(({ serviceId, clientVersion }) => { + const sections = [ + // sdk-metadata + ["aws-sdk-js", clientVersion], + // ua-metadata + ["ua", "2.0"], + // os-metadata + [`os/${(0, import_os.platform)()}`, (0, import_os.release)()], + // language-metadata + // ECMAScript edition doesn't matter in JS, so no version needed. + ["lang/js"], + ["md/nodejs", `${import_process.versions.node}`] + ]; + const crtAvailable = isCrtAvailable(); + if (crtAvailable) { + sections.push(crtAvailable); } - serialize(input, context) { - return (0, Aws_query_1.se_GetFederationTokenCommand)(input, context); + if (serviceId) { + sections.push([`api/${serviceId}`, clientVersion]); } - deserialize(output, context) { - return (0, Aws_query_1.de_GetFederationTokenCommand)(output, context); + if (import_process.env.AWS_EXECUTION_ENV) { + sections.push([`exec-env/${import_process.env.AWS_EXECUTION_ENV}`]); } - }; - exports2.GetFederationTokenCommand = GetFederationTokenCommand; + const appIdPromise = (0, import_node_config_provider.loadConfig)({ + environmentVariableSelector: (env2) => env2[UA_APP_ID_ENV_NAME], + configFileSelector: (profile) => profile[UA_APP_ID_INI_NAME], + default: void 0 + })(); + let resolvedUserAgent = void 0; + return async () => { + if (!resolvedUserAgent) { + const appId = await appIdPromise; + resolvedUserAgent = appId ? [...sections, [`app/${appId}`]] : [...sections]; + } + return resolvedUserAgent; + }; + }, "defaultUserAgent"); } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/GetSessionTokenCommand.js -var require_GetSessionTokenCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/GetSessionTokenCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.GetSessionTokenCommand = exports2.$Command = void 0; - var middleware_signing_1 = require_dist_cjs14(); - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_0(); - var Aws_query_1 = require_Aws_query(); - var GetSessionTokenCommand = class _GetSessionTokenCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseGlobalEndpoint: { type: "builtInParams", name: "useGlobalEndpoint" }, - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; +// ../../../node_modules/@smithy/hash-node/dist-cjs/index.js +var require_dist_cjs57 = __commonJS({ + "../../../node_modules/@smithy/hash-node/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - constructor(input) { - super(); - this.input = input; + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + Hash: () => Hash + }); + module2.exports = __toCommonJS2(src_exports); + var import_util_buffer_from = require_dist_cjs27(); + var import_util_utf8 = require_dist_cjs28(); + var import_buffer = require("buffer"); + var import_crypto5 = require("crypto"); + var _Hash = class _Hash { + constructor(algorithmIdentifier, secret) { + this.algorithmIdentifier = algorithmIdentifier; + this.secret = secret; + this.reset(); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _GetSessionTokenCommand.getEndpointParameterInstructions())); - this.middlewareStack.use((0, middleware_signing_1.getAwsAuthPlugin)(configuration)); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "STSClient"; - const commandName = "GetSessionTokenCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: models_0_1.GetSessionTokenResponseFilterSensitiveLog, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSSecurityTokenServiceV20110615", - operation: "GetSessionToken" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + update(toHash, encoding) { + this.hash.update((0, import_util_utf8.toUint8Array)(castSourceData(toHash, encoding))); } - serialize(input, context) { - return (0, Aws_query_1.se_GetSessionTokenCommand)(input, context); + digest() { + return Promise.resolve(this.hash.digest()); } - deserialize(output, context) { - return (0, Aws_query_1.de_GetSessionTokenCommand)(output, context); + reset() { + this.hash = this.secret ? (0, import_crypto5.createHmac)(this.algorithmIdentifier, castSourceData(this.secret)) : (0, import_crypto5.createHash)(this.algorithmIdentifier); } }; - exports2.GetSessionTokenCommand = GetSessionTokenCommand; + __name(_Hash, "Hash"); + var Hash = _Hash; + function castSourceData(toCast, encoding) { + if (import_buffer.Buffer.isBuffer(toCast)) { + return toCast; + } + if (typeof toCast === "string") { + return (0, import_util_buffer_from.fromString)(toCast, encoding); + } + if (ArrayBuffer.isView(toCast)) { + return (0, import_util_buffer_from.fromArrayBuffer)(toCast.buffer, toCast.byteOffset, toCast.byteLength); + } + return (0, import_util_buffer_from.fromArrayBuffer)(toCast); + } + __name(castSourceData, "castSourceData"); } }); -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/STS.js -var require_STS = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/STS.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.STS = void 0; - var smithy_client_1 = require_dist_cjs34(); - var AssumeRoleCommand_1 = require_AssumeRoleCommand(); - var AssumeRoleWithSAMLCommand_1 = require_AssumeRoleWithSAMLCommand(); - var AssumeRoleWithWebIdentityCommand_1 = require_AssumeRoleWithWebIdentityCommand(); - var DecodeAuthorizationMessageCommand_1 = require_DecodeAuthorizationMessageCommand(); - var GetAccessKeyInfoCommand_1 = require_GetAccessKeyInfoCommand(); - var GetCallerIdentityCommand_1 = require_GetCallerIdentityCommand(); - var GetFederationTokenCommand_1 = require_GetFederationTokenCommand(); - var GetSessionTokenCommand_1 = require_GetSessionTokenCommand(); - var STSClient_1 = require_STSClient(); - var commands = { - AssumeRoleCommand: AssumeRoleCommand_1.AssumeRoleCommand, - AssumeRoleWithSAMLCommand: AssumeRoleWithSAMLCommand_1.AssumeRoleWithSAMLCommand, - AssumeRoleWithWebIdentityCommand: AssumeRoleWithWebIdentityCommand_1.AssumeRoleWithWebIdentityCommand, - DecodeAuthorizationMessageCommand: DecodeAuthorizationMessageCommand_1.DecodeAuthorizationMessageCommand, - GetAccessKeyInfoCommand: GetAccessKeyInfoCommand_1.GetAccessKeyInfoCommand, - GetCallerIdentityCommand: GetCallerIdentityCommand_1.GetCallerIdentityCommand, - GetFederationTokenCommand: GetFederationTokenCommand_1.GetFederationTokenCommand, - GetSessionTokenCommand: GetSessionTokenCommand_1.GetSessionTokenCommand - }; - var STS = class extends STSClient_1.STSClient { +// ../../../node_modules/@smithy/util-body-length-node/dist-cjs/index.js +var require_dist_cjs58 = __commonJS({ + "../../../node_modules/@smithy/util-body-length-node/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - exports2.STS = STS; - (0, smithy_client_1.createAggregatedClient)(commands, STS); - } -}); - -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/index.js -var require_commands2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/commands/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_AssumeRoleCommand(), exports2); - tslib_1.__exportStar(require_AssumeRoleWithSAMLCommand(), exports2); - tslib_1.__exportStar(require_AssumeRoleWithWebIdentityCommand(), exports2); - tslib_1.__exportStar(require_DecodeAuthorizationMessageCommand(), exports2); - tslib_1.__exportStar(require_GetAccessKeyInfoCommand(), exports2); - tslib_1.__exportStar(require_GetCallerIdentityCommand(), exports2); - tslib_1.__exportStar(require_GetFederationTokenCommand(), exports2); - tslib_1.__exportStar(require_GetSessionTokenCommand(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/models/index.js -var require_models2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/models/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_models_0(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/defaultRoleAssumers.js -var require_defaultRoleAssumers = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/defaultRoleAssumers.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.decorateDefaultCredentialProvider = exports2.getDefaultRoleAssumerWithWebIdentity = exports2.getDefaultRoleAssumer = void 0; - var defaultStsRoleAssumers_1 = require_defaultStsRoleAssumers(); - var STSClient_1 = require_STSClient(); - var getCustomizableStsClientCtor = (baseCtor, customizations) => { - if (!customizations) - return baseCtor; - else - return class CustomizableSTSClient extends baseCtor { - constructor(config) { - super(config); - for (const customization of customizations) { - this.middlewareStack.use(customization); - } - } - }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; }; - var getDefaultRoleAssumer = (stsOptions = {}, stsPlugins) => (0, defaultStsRoleAssumers_1.getDefaultRoleAssumer)(stsOptions, getCustomizableStsClientCtor(STSClient_1.STSClient, stsPlugins)); - exports2.getDefaultRoleAssumer = getDefaultRoleAssumer; - var getDefaultRoleAssumerWithWebIdentity = (stsOptions = {}, stsPlugins) => (0, defaultStsRoleAssumers_1.getDefaultRoleAssumerWithWebIdentity)(stsOptions, getCustomizableStsClientCtor(STSClient_1.STSClient, stsPlugins)); - exports2.getDefaultRoleAssumerWithWebIdentity = getDefaultRoleAssumerWithWebIdentity; - var decorateDefaultCredentialProvider = (provider) => (input) => provider({ - roleAssumer: (0, exports2.getDefaultRoleAssumer)(input), - roleAssumerWithWebIdentity: (0, exports2.getDefaultRoleAssumerWithWebIdentity)(input), - ...input + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + calculateBodyLength: () => calculateBodyLength }); - exports2.decorateDefaultCredentialProvider = decorateDefaultCredentialProvider; - } -}); - -// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/index.js -var require_dist_cjs51 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sts/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.STSServiceException = void 0; - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_STSClient(), exports2); - tslib_1.__exportStar(require_STS(), exports2); - tslib_1.__exportStar(require_commands2(), exports2); - tslib_1.__exportStar(require_models2(), exports2); - tslib_1.__exportStar(require_defaultRoleAssumers(), exports2); - var STSServiceException_1 = require_STSServiceException(); - Object.defineProperty(exports2, "STSServiceException", { enumerable: true, get: function() { - return STSServiceException_1.STSServiceException; - } }); - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/endpoint/ruleset.js -var require_ruleset3 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/endpoint/ruleset.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ruleSet = void 0; - var r = "required"; - var s = "fn"; - var t = "argv"; - var u = "ref"; - var a = "isSet"; - var b = "tree"; - var c = "error"; - var d = "endpoint"; - var e = "PartitionResult"; - var f = { [r]: false, "type": "String" }; - var g = { [r]: true, "default": false, "type": "Boolean" }; - var h = { [u]: "Endpoint" }; - var i = { [s]: "booleanEquals", [t]: [{ [u]: "UseFIPS" }, true] }; - var j = { [s]: "booleanEquals", [t]: [{ [u]: "UseDualStack" }, true] }; - var k = {}; - var l = { [u]: "Region" }; - var m = { [s]: "booleanEquals", [t]: [true, { [s]: "getAttr", [t]: [{ [u]: e }, "supportsFIPS"] }] }; - var n = { [s]: "booleanEquals", [t]: [true, { [s]: "getAttr", [t]: [{ [u]: e }, "supportsDualStack"] }] }; - var o = [i]; - var p = [j]; - var q = [l]; - var _data = { version: "1.0", parameters: { Region: f, UseDualStack: g, UseFIPS: g, Endpoint: f }, rules: [{ conditions: [{ [s]: a, [t]: [h] }], type: b, rules: [{ conditions: o, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: c }, { conditions: p, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: c }, { endpoint: { url: h, properties: k, headers: k }, type: d }] }, { conditions: [{ [s]: a, [t]: q }], type: b, rules: [{ conditions: [{ [s]: "aws.partition", [t]: q, assign: e }], type: b, rules: [{ conditions: [i, j], type: b, rules: [{ conditions: [m, n], type: b, rules: [{ endpoint: { url: "https://states-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: k, headers: k }, type: d }] }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: c }] }, { conditions: o, type: b, rules: [{ conditions: [m], type: b, rules: [{ conditions: [{ [s]: "stringEquals", [t]: [l, "us-gov-west-1"] }], endpoint: { url: "https://states.us-gov-west-1.amazonaws.com", properties: k, headers: k }, type: d }, { endpoint: { url: "https://states-fips.{Region}.{PartitionResult#dnsSuffix}", properties: k, headers: k }, type: d }] }, { error: "FIPS is enabled but this partition does not support FIPS", type: c }] }, { conditions: p, type: b, rules: [{ conditions: [n], type: b, rules: [{ endpoint: { url: "https://states.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: k, headers: k }, type: d }] }, { error: "DualStack is enabled but this partition does not support DualStack", type: c }] }, { endpoint: { url: "https://states.{Region}.{PartitionResult#dnsSuffix}", properties: k, headers: k }, type: d }] }] }, { error: "Invalid Configuration: Missing Region", type: c }] }; - exports2.ruleSet = _data; + module2.exports = __toCommonJS2(src_exports); + var import_fs = require("fs"); + var calculateBodyLength = /* @__PURE__ */ __name((body) => { + if (!body) { + return 0; + } + if (typeof body === "string") { + return Buffer.byteLength(body); + } else if (typeof body.byteLength === "number") { + return body.byteLength; + } else if (typeof body.size === "number") { + return body.size; + } else if (typeof body.start === "number" && typeof body.end === "number") { + return body.end + 1 - body.start; + } else if (typeof body.path === "string" || Buffer.isBuffer(body.path)) { + return (0, import_fs.lstatSync)(body.path).size; + } else if (typeof body.fd === "number") { + return (0, import_fs.fstatSync)(body.fd).size; + } + throw new Error(`Body Length computation failed for ${body}`); + }, "calculateBodyLength"); } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/endpoint/endpointResolver.js -var require_endpointResolver3 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/endpoint/endpointResolver.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.defaultEndpointResolver = void 0; - var util_endpoints_1 = require_dist_cjs16(); - var ruleset_1 = require_ruleset3(); - var defaultEndpointResolver = (endpointParams, context = {}) => { - return (0, util_endpoints_1.resolveEndpoint)(ruleset_1.ruleSet, { - endpointParams, - logger: context.logger - }); +// ../../../node_modules/@smithy/util-retry/node_modules/@smithy/service-error-classification/dist-cjs/index.js +var require_dist_cjs59 = __commonJS({ + "../../../node_modules/@smithy/util-retry/node_modules/@smithy/service-error-classification/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - exports2.defaultEndpointResolver = defaultEndpointResolver; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/runtimeConfig.shared.js -var require_runtimeConfig_shared3 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/runtimeConfig.shared.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getRuntimeConfig = void 0; - var smithy_client_1 = require_dist_cjs34(); - var url_parser_1 = require_dist_cjs24(); - var util_base64_1 = require_dist_cjs30(); - var util_utf8_1 = require_dist_cjs10(); - var endpointResolver_1 = require_endpointResolver3(); - var getRuntimeConfig = (config) => ({ - apiVersion: "2016-11-23", - base64Decoder: config?.base64Decoder ?? util_base64_1.fromBase64, - base64Encoder: config?.base64Encoder ?? util_base64_1.toBase64, - disableHostPrefix: config?.disableHostPrefix ?? false, - endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver, - extensions: config?.extensions ?? [], - logger: config?.logger ?? new smithy_client_1.NoOpLogger(), - serviceId: config?.serviceId ?? "SFN", - urlParser: config?.urlParser ?? url_parser_1.parseUrl, - utf8Decoder: config?.utf8Decoder ?? util_utf8_1.fromUtf8, - utf8Encoder: config?.utf8Encoder ?? util_utf8_1.toUtf8 - }); - exports2.getRuntimeConfig = getRuntimeConfig; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/runtimeConfig.js -var require_runtimeConfig3 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/runtimeConfig.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.getRuntimeConfig = void 0; - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - var package_json_1 = tslib_1.__importDefault(require_package()); - var client_sts_1 = require_dist_cjs51(); - var credential_provider_node_1 = require_dist_cjs50(); - var util_user_agent_node_1 = require_dist_cjs40(); - var config_resolver_1 = require_dist_cjs19(); - var hash_node_1 = require_dist_cjs41(); - var middleware_retry_1 = require_dist_cjs35(); - var node_config_provider_1 = require_dist_cjs22(); - var node_http_handler_1 = require_dist_cjs32(); - var util_body_length_node_1 = require_dist_cjs42(); - var util_retry_1 = require_dist_cjs28(); - var runtimeConfig_shared_1 = require_runtimeConfig_shared3(); - var smithy_client_1 = require_dist_cjs34(); - var util_defaults_mode_node_1 = require_dist_cjs43(); - var smithy_client_2 = require_dist_cjs34(); - var getRuntimeConfig = (config) => { - (0, smithy_client_2.emitWarningIfUnsupportedVersion)(process.version); - const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config); - const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode); - const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config); - return { - ...clientSharedValues, - ...config, - runtime: "node", - defaultsMode, - bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength, - credentialDefaultProvider: config?.credentialDefaultProvider ?? (0, client_sts_1.decorateDefaultCredentialProvider)(credential_provider_node_1.defaultProvider), - defaultUserAgentProvider: config?.defaultUserAgentProvider ?? (0, util_user_agent_node_1.defaultUserAgent)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }), - maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS), - region: config?.region ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_REGION_CONFIG_OPTIONS, config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS), - requestHandler: config?.requestHandler ?? new node_http_handler_1.NodeHttpHandler(defaultConfigProvider), - retryMode: config?.retryMode ?? (0, node_config_provider_1.loadConfig)({ - ...middleware_retry_1.NODE_RETRY_MODE_CONFIG_OPTIONS, - default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE - }), - sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, "sha256"), - streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector, - useDualstackEndpoint: config?.useDualstackEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), - useFipsEndpoint: config?.useFipsEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS) - }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; }; - exports2.getRuntimeConfig = getRuntimeConfig; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + isClockSkewCorrectedError: () => isClockSkewCorrectedError, + isClockSkewError: () => isClockSkewError, + isRetryableByTrait: () => isRetryableByTrait, + isServerError: () => isServerError, + isThrottlingError: () => isThrottlingError, + isTransientError: () => isTransientError + }); + module2.exports = __toCommonJS2(src_exports); + var CLOCK_SKEW_ERROR_CODES = [ + "AuthFailure", + "InvalidSignatureException", + "RequestExpired", + "RequestInTheFuture", + "RequestTimeTooSkewed", + "SignatureDoesNotMatch" + ]; + var THROTTLING_ERROR_CODES = [ + "BandwidthLimitExceeded", + "EC2ThrottledException", + "LimitExceededException", + "PriorRequestNotComplete", + "ProvisionedThroughputExceededException", + "RequestLimitExceeded", + "RequestThrottled", + "RequestThrottledException", + "SlowDown", + "ThrottledException", + "Throttling", + "ThrottlingException", + "TooManyRequestsException", + "TransactionInProgressException" + // DynamoDB + ]; + var TRANSIENT_ERROR_CODES = ["TimeoutError", "RequestTimeout", "RequestTimeoutException"]; + var TRANSIENT_ERROR_STATUS_CODES = [500, 502, 503, 504]; + var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "ECONNREFUSED", "EPIPE", "ETIMEDOUT"]; + var isRetryableByTrait = /* @__PURE__ */ __name((error) => error.$retryable !== void 0, "isRetryableByTrait"); + var isClockSkewError = /* @__PURE__ */ __name((error) => CLOCK_SKEW_ERROR_CODES.includes(error.name), "isClockSkewError"); + var isClockSkewCorrectedError = /* @__PURE__ */ __name((error) => { + var _a; + return (_a = error.$metadata) == null ? void 0 : _a.clockSkewCorrected; + }, "isClockSkewCorrectedError"); + var isThrottlingError = /* @__PURE__ */ __name((error) => { + var _a, _b; + return ((_a = error.$metadata) == null ? void 0 : _a.httpStatusCode) === 429 || THROTTLING_ERROR_CODES.includes(error.name) || ((_b = error.$retryable) == null ? void 0 : _b.throttling) == true; + }, "isThrottlingError"); + var isTransientError = /* @__PURE__ */ __name((error) => { + var _a; + return isClockSkewCorrectedError(error) || TRANSIENT_ERROR_CODES.includes(error.name) || NODEJS_TIMEOUT_ERROR_CODES.includes((error == null ? void 0 : error.code) || "") || TRANSIENT_ERROR_STATUS_CODES.includes(((_a = error.$metadata) == null ? void 0 : _a.httpStatusCode) || 0); + }, "isTransientError"); + var isServerError = /* @__PURE__ */ __name((error) => { + var _a; + if (((_a = error.$metadata) == null ? void 0 : _a.httpStatusCode) !== void 0) { + const statusCode = error.$metadata.httpStatusCode; + if (500 <= statusCode && statusCode <= 599 && !isTransientError(error)) { + return true; + } + return false; + } + return false; + }, "isServerError"); } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/runtimeExtensions.js -var require_runtimeExtensions3 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/runtimeExtensions.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.resolveRuntimeExtensions = void 0; - var region_config_resolver_1 = require_dist_cjs44(); - var protocol_http_1 = require_dist_cjs2(); - var smithy_client_1 = require_dist_cjs34(); - var asPartial = (t) => t; - var resolveRuntimeExtensions = (runtimeConfig, extensions) => { - const extensionConfiguration = { - ...asPartial((0, region_config_resolver_1.getAwsRegionExtensionConfiguration)(runtimeConfig)), - ...asPartial((0, smithy_client_1.getDefaultExtensionConfiguration)(runtimeConfig)), - ...asPartial((0, protocol_http_1.getHttpHandlerExtensionConfiguration)(runtimeConfig)) - }; - extensions.forEach((extension) => extension.configure(extensionConfiguration)); - return { - ...runtimeConfig, - ...(0, region_config_resolver_1.resolveAwsRegionExtensionConfiguration)(extensionConfiguration), - ...(0, smithy_client_1.resolveDefaultRuntimeConfig)(extensionConfiguration), - ...(0, protocol_http_1.resolveHttpHandlerRuntimeConfig)(extensionConfiguration) - }; +// ../../../node_modules/@smithy/util-retry/dist-cjs/index.js +var require_dist_cjs60 = __commonJS({ + "../../../node_modules/@smithy/util-retry/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - exports2.resolveRuntimeExtensions = resolveRuntimeExtensions; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/SFNClient.js -var require_SFNClient = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/SFNClient.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SFNClient = exports2.__Client = void 0; - var middleware_host_header_1 = require_dist_cjs3(); - var middleware_logger_1 = require_dist_cjs4(); - var middleware_recursion_detection_1 = require_dist_cjs5(); - var middleware_signing_1 = require_dist_cjs14(); - var middleware_user_agent_1 = require_dist_cjs17(); - var config_resolver_1 = require_dist_cjs19(); - var middleware_content_length_1 = require_dist_cjs20(); - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_retry_1 = require_dist_cjs35(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "__Client", { enumerable: true, get: function() { - return smithy_client_1.Client; - } }); - var EndpointParameters_1 = require_EndpointParameters(); - var runtimeConfig_1 = require_runtimeConfig3(); - var runtimeExtensions_1 = require_runtimeExtensions3(); - var SFNClient = class extends smithy_client_1.Client { - constructor(...[configuration]) { - const _config_0 = (0, runtimeConfig_1.getRuntimeConfig)(configuration || {}); - const _config_1 = (0, EndpointParameters_1.resolveClientEndpointParameters)(_config_0); - const _config_2 = (0, config_resolver_1.resolveRegionConfig)(_config_1); - const _config_3 = (0, middleware_endpoint_1.resolveEndpointConfig)(_config_2); - const _config_4 = (0, middleware_retry_1.resolveRetryConfig)(_config_3); - const _config_5 = (0, middleware_host_header_1.resolveHostHeaderConfig)(_config_4); - const _config_6 = (0, middleware_signing_1.resolveAwsAuthConfig)(_config_5); - const _config_7 = (0, middleware_user_agent_1.resolveUserAgentConfig)(_config_6); - const _config_8 = (0, runtimeExtensions_1.resolveRuntimeExtensions)(_config_7, configuration?.extensions || []); - super(_config_8); - this.config = _config_8; - this.middlewareStack.use((0, middleware_retry_1.getRetryPlugin)(this.config)); - this.middlewareStack.use((0, middleware_content_length_1.getContentLengthPlugin)(this.config)); - this.middlewareStack.use((0, middleware_host_header_1.getHostHeaderPlugin)(this.config)); - this.middlewareStack.use((0, middleware_logger_1.getLoggerPlugin)(this.config)); - this.middlewareStack.use((0, middleware_recursion_detection_1.getRecursionDetectionPlugin)(this.config)); - this.middlewareStack.use((0, middleware_signing_1.getAwsAuthPlugin)(this.config)); - this.middlewareStack.use((0, middleware_user_agent_1.getUserAgentPlugin)(this.config)); - } - destroy() { - super.destroy(); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - exports2.SFNClient = SFNClient; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/models/SFNServiceException.js -var require_SFNServiceException = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/models/SFNServiceException.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SFNServiceException = exports2.__ServiceException = void 0; - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "__ServiceException", { enumerable: true, get: function() { - return smithy_client_1.ServiceException; - } }); - var SFNServiceException = class _SFNServiceException extends smithy_client_1.ServiceException { + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + AdaptiveRetryStrategy: () => AdaptiveRetryStrategy, + ConfiguredRetryStrategy: () => ConfiguredRetryStrategy, + DEFAULT_MAX_ATTEMPTS: () => DEFAULT_MAX_ATTEMPTS, + DEFAULT_RETRY_DELAY_BASE: () => DEFAULT_RETRY_DELAY_BASE, + DEFAULT_RETRY_MODE: () => DEFAULT_RETRY_MODE, + DefaultRateLimiter: () => DefaultRateLimiter, + INITIAL_RETRY_TOKENS: () => INITIAL_RETRY_TOKENS, + INVOCATION_ID_HEADER: () => INVOCATION_ID_HEADER, + MAXIMUM_RETRY_DELAY: () => MAXIMUM_RETRY_DELAY, + NO_RETRY_INCREMENT: () => NO_RETRY_INCREMENT, + REQUEST_HEADER: () => REQUEST_HEADER, + RETRY_COST: () => RETRY_COST, + RETRY_MODES: () => RETRY_MODES, + StandardRetryStrategy: () => StandardRetryStrategy, + THROTTLING_RETRY_DELAY_BASE: () => THROTTLING_RETRY_DELAY_BASE, + TIMEOUT_RETRY_COST: () => TIMEOUT_RETRY_COST + }); + module2.exports = __toCommonJS2(src_exports); + var RETRY_MODES = /* @__PURE__ */ ((RETRY_MODES2) => { + RETRY_MODES2["STANDARD"] = "standard"; + RETRY_MODES2["ADAPTIVE"] = "adaptive"; + return RETRY_MODES2; + })(RETRY_MODES || {}); + var DEFAULT_MAX_ATTEMPTS = 3; + var DEFAULT_RETRY_MODE = "standard"; + var import_service_error_classification = require_dist_cjs59(); + var _DefaultRateLimiter = class _DefaultRateLimiter { constructor(options) { - super(options); - Object.setPrototypeOf(this, _SFNServiceException.prototype); + this.currentCapacity = 0; + this.enabled = false; + this.lastMaxRate = 0; + this.measuredTxRate = 0; + this.requestCount = 0; + this.lastTimestamp = 0; + this.timeWindow = 0; + this.beta = (options == null ? void 0 : options.beta) ?? 0.7; + this.minCapacity = (options == null ? void 0 : options.minCapacity) ?? 1; + this.minFillRate = (options == null ? void 0 : options.minFillRate) ?? 0.5; + this.scaleConstant = (options == null ? void 0 : options.scaleConstant) ?? 0.4; + this.smooth = (options == null ? void 0 : options.smooth) ?? 0.8; + const currentTimeInSeconds = this.getCurrentTimeInSeconds(); + this.lastThrottleTime = currentTimeInSeconds; + this.lastTxRateBucket = Math.floor(this.getCurrentTimeInSeconds()); + this.fillRate = this.minFillRate; + this.maxCapacity = this.minCapacity; } - }; - exports2.SFNServiceException = SFNServiceException; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/models/models_0.js -var require_models_03 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/models/models_0.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ExecutionStartedEventDetailsFilterSensitiveLog = exports2.ExecutionFailedEventDetailsFilterSensitiveLog = exports2.ExecutionAbortedEventDetailsFilterSensitiveLog = exports2.GetActivityTaskOutputFilterSensitiveLog = exports2.DescribeStateMachineForExecutionOutputFilterSensitiveLog = exports2.DescribeStateMachineAliasOutputFilterSensitiveLog = exports2.DescribeStateMachineOutputFilterSensitiveLog = exports2.DescribeExecutionOutputFilterSensitiveLog = exports2.CreateStateMachineAliasInputFilterSensitiveLog = exports2.CreateStateMachineInputFilterSensitiveLog = exports2.ActivityTimedOutEventDetailsFilterSensitiveLog = exports2.ActivitySucceededEventDetailsFilterSensitiveLog = exports2.ActivityScheduleFailedEventDetailsFilterSensitiveLog = exports2.ActivityScheduledEventDetailsFilterSensitiveLog = exports2.ActivityFailedEventDetailsFilterSensitiveLog = exports2.MissingRequiredParameter = exports2.SyncExecutionStatus = exports2.InvalidExecutionInput = exports2.ExecutionLimitExceeded = exports2.ExecutionAlreadyExists = exports2.InvalidOutput = exports2.TaskTimedOut = exports2.TaskDoesNotExist = exports2.InvalidToken = exports2.HistoryEventType = exports2.StateMachineDoesNotExist = exports2.StateMachineStatus = exports2.MapRunStatus = exports2.ExecutionDoesNotExist = exports2.ExecutionStatus = exports2.ServiceQuotaExceededException = exports2.ResourceNotFound = exports2.ValidationException = exports2.ValidationExceptionReason = exports2.StateMachineTypeNotSupported = exports2.StateMachineLimitExceeded = exports2.StateMachineDeleting = exports2.StateMachineAlreadyExists = exports2.InvalidTracingConfiguration = exports2.InvalidLoggingConfiguration = exports2.InvalidDefinition = exports2.InvalidArn = exports2.StateMachineType = exports2.LogLevel = exports2.ConflictException = exports2.TooManyTags = exports2.InvalidName = exports2.ActivityWorkerLimitExceeded = exports2.ActivityLimitExceeded = exports2.ActivityDoesNotExist = void 0; - exports2.UpdateStateMachineAliasInputFilterSensitiveLog = exports2.UpdateStateMachineInputFilterSensitiveLog = exports2.StopExecutionInputFilterSensitiveLog = exports2.StartSyncExecutionOutputFilterSensitiveLog = exports2.StartSyncExecutionInputFilterSensitiveLog = exports2.StartExecutionInputFilterSensitiveLog = exports2.SendTaskSuccessInputFilterSensitiveLog = exports2.SendTaskFailureInputFilterSensitiveLog = exports2.PublishStateMachineVersionInputFilterSensitiveLog = exports2.GetExecutionHistoryOutputFilterSensitiveLog = exports2.HistoryEventFilterSensitiveLog = exports2.TaskTimedOutEventDetailsFilterSensitiveLog = exports2.TaskSucceededEventDetailsFilterSensitiveLog = exports2.TaskSubmittedEventDetailsFilterSensitiveLog = exports2.TaskSubmitFailedEventDetailsFilterSensitiveLog = exports2.TaskStartFailedEventDetailsFilterSensitiveLog = exports2.TaskScheduledEventDetailsFilterSensitiveLog = exports2.TaskFailedEventDetailsFilterSensitiveLog = exports2.StateExitedEventDetailsFilterSensitiveLog = exports2.StateEnteredEventDetailsFilterSensitiveLog = exports2.MapRunFailedEventDetailsFilterSensitiveLog = exports2.LambdaFunctionTimedOutEventDetailsFilterSensitiveLog = exports2.LambdaFunctionSucceededEventDetailsFilterSensitiveLog = exports2.LambdaFunctionStartFailedEventDetailsFilterSensitiveLog = exports2.LambdaFunctionScheduleFailedEventDetailsFilterSensitiveLog = exports2.LambdaFunctionScheduledEventDetailsFilterSensitiveLog = exports2.LambdaFunctionFailedEventDetailsFilterSensitiveLog = exports2.ExecutionTimedOutEventDetailsFilterSensitiveLog = exports2.ExecutionSucceededEventDetailsFilterSensitiveLog = void 0; - var smithy_client_1 = require_dist_cjs34(); - var SFNServiceException_1 = require_SFNServiceException(); - var ActivityDoesNotExist = class _ActivityDoesNotExist extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "ActivityDoesNotExist", - $fault: "client", - ...opts - }); - this.name = "ActivityDoesNotExist"; - this.$fault = "client"; - Object.setPrototypeOf(this, _ActivityDoesNotExist.prototype); + getCurrentTimeInSeconds() { + return Date.now() / 1e3; } - }; - exports2.ActivityDoesNotExist = ActivityDoesNotExist; - var ActivityLimitExceeded = class _ActivityLimitExceeded extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "ActivityLimitExceeded", - $fault: "client", - ...opts - }); - this.name = "ActivityLimitExceeded"; - this.$fault = "client"; - Object.setPrototypeOf(this, _ActivityLimitExceeded.prototype); + async getSendToken() { + return this.acquireTokenBucket(1); } - }; - exports2.ActivityLimitExceeded = ActivityLimitExceeded; - var ActivityWorkerLimitExceeded = class _ActivityWorkerLimitExceeded extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "ActivityWorkerLimitExceeded", - $fault: "client", - ...opts - }); - this.name = "ActivityWorkerLimitExceeded"; - this.$fault = "client"; - Object.setPrototypeOf(this, _ActivityWorkerLimitExceeded.prototype); + async acquireTokenBucket(amount) { + if (!this.enabled) { + return; + } + this.refillTokenBucket(); + if (amount > this.currentCapacity) { + const delay = (amount - this.currentCapacity) / this.fillRate * 1e3; + await new Promise((resolve) => setTimeout(resolve, delay)); + } + this.currentCapacity = this.currentCapacity - amount; } - }; - exports2.ActivityWorkerLimitExceeded = ActivityWorkerLimitExceeded; - var InvalidName = class _InvalidName extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "InvalidName", - $fault: "client", - ...opts - }); - this.name = "InvalidName"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidName.prototype); + refillTokenBucket() { + const timestamp = this.getCurrentTimeInSeconds(); + if (!this.lastTimestamp) { + this.lastTimestamp = timestamp; + return; + } + const fillAmount = (timestamp - this.lastTimestamp) * this.fillRate; + this.currentCapacity = Math.min(this.maxCapacity, this.currentCapacity + fillAmount); + this.lastTimestamp = timestamp; } - }; - exports2.InvalidName = InvalidName; - var TooManyTags = class _TooManyTags extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "TooManyTags", - $fault: "client", - ...opts - }); - this.name = "TooManyTags"; - this.$fault = "client"; - Object.setPrototypeOf(this, _TooManyTags.prototype); - this.resourceName = opts.resourceName; + updateClientSendingRate(response) { + let calculatedRate; + this.updateMeasuredRate(); + if ((0, import_service_error_classification.isThrottlingError)(response)) { + const rateToUse = !this.enabled ? this.measuredTxRate : Math.min(this.measuredTxRate, this.fillRate); + this.lastMaxRate = rateToUse; + this.calculateTimeWindow(); + this.lastThrottleTime = this.getCurrentTimeInSeconds(); + calculatedRate = this.cubicThrottle(rateToUse); + this.enableTokenBucket(); + } else { + this.calculateTimeWindow(); + calculatedRate = this.cubicSuccess(this.getCurrentTimeInSeconds()); + } + const newRate = Math.min(calculatedRate, 2 * this.measuredTxRate); + this.updateTokenBucketRate(newRate); } - }; - exports2.TooManyTags = TooManyTags; - var ConflictException = class _ConflictException extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "ConflictException", - $fault: "client", - ...opts - }); - this.name = "ConflictException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _ConflictException.prototype); + calculateTimeWindow() { + this.timeWindow = this.getPrecise(Math.pow(this.lastMaxRate * (1 - this.beta) / this.scaleConstant, 1 / 3)); + } + cubicThrottle(rateToUse) { + return this.getPrecise(rateToUse * this.beta); + } + cubicSuccess(timestamp) { + return this.getPrecise( + this.scaleConstant * Math.pow(timestamp - this.lastThrottleTime - this.timeWindow, 3) + this.lastMaxRate + ); + } + enableTokenBucket() { + this.enabled = true; + } + updateTokenBucketRate(newRate) { + this.refillTokenBucket(); + this.fillRate = Math.max(newRate, this.minFillRate); + this.maxCapacity = Math.max(newRate, this.minCapacity); + this.currentCapacity = Math.min(this.currentCapacity, this.maxCapacity); + } + updateMeasuredRate() { + const t = this.getCurrentTimeInSeconds(); + const timeBucket = Math.floor(t * 2) / 2; + this.requestCount++; + if (timeBucket > this.lastTxRateBucket) { + const currentRate = this.requestCount / (timeBucket - this.lastTxRateBucket); + this.measuredTxRate = this.getPrecise(currentRate * this.smooth + this.measuredTxRate * (1 - this.smooth)); + this.requestCount = 0; + this.lastTxRateBucket = timeBucket; + } + } + getPrecise(num) { + return parseFloat(num.toFixed(8)); } }; - exports2.ConflictException = ConflictException; - exports2.LogLevel = { - ALL: "ALL", - ERROR: "ERROR", - FATAL: "FATAL", - OFF: "OFF" - }; - exports2.StateMachineType = { - EXPRESS: "EXPRESS", - STANDARD: "STANDARD" - }; - var InvalidArn = class _InvalidArn extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "InvalidArn", - $fault: "client", - ...opts - }); - this.name = "InvalidArn"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidArn.prototype); + __name(_DefaultRateLimiter, "DefaultRateLimiter"); + var DefaultRateLimiter = _DefaultRateLimiter; + var DEFAULT_RETRY_DELAY_BASE = 100; + var MAXIMUM_RETRY_DELAY = 20 * 1e3; + var THROTTLING_RETRY_DELAY_BASE = 500; + var INITIAL_RETRY_TOKENS = 500; + var RETRY_COST = 5; + var TIMEOUT_RETRY_COST = 10; + var NO_RETRY_INCREMENT = 1; + var INVOCATION_ID_HEADER = "amz-sdk-invocation-id"; + var REQUEST_HEADER = "amz-sdk-request"; + var getDefaultRetryBackoffStrategy = /* @__PURE__ */ __name(() => { + let delayBase = DEFAULT_RETRY_DELAY_BASE; + const computeNextBackoffDelay = /* @__PURE__ */ __name((attempts) => { + return Math.floor(Math.min(MAXIMUM_RETRY_DELAY, Math.random() * 2 ** attempts * delayBase)); + }, "computeNextBackoffDelay"); + const setDelayBase = /* @__PURE__ */ __name((delay) => { + delayBase = delay; + }, "setDelayBase"); + return { + computeNextBackoffDelay, + setDelayBase + }; + }, "getDefaultRetryBackoffStrategy"); + var createDefaultRetryToken = /* @__PURE__ */ __name(({ + retryDelay, + retryCount, + retryCost + }) => { + const getRetryCount = /* @__PURE__ */ __name(() => retryCount, "getRetryCount"); + const getRetryDelay = /* @__PURE__ */ __name(() => Math.min(MAXIMUM_RETRY_DELAY, retryDelay), "getRetryDelay"); + const getRetryCost = /* @__PURE__ */ __name(() => retryCost, "getRetryCost"); + return { + getRetryCount, + getRetryDelay, + getRetryCost + }; + }, "createDefaultRetryToken"); + var _StandardRetryStrategy = class _StandardRetryStrategy { + constructor(maxAttempts) { + this.maxAttempts = maxAttempts; + this.mode = "standard"; + this.capacity = INITIAL_RETRY_TOKENS; + this.retryBackoffStrategy = getDefaultRetryBackoffStrategy(); + this.maxAttemptsProvider = typeof maxAttempts === "function" ? maxAttempts : async () => maxAttempts; } - }; - exports2.InvalidArn = InvalidArn; - var InvalidDefinition = class _InvalidDefinition extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "InvalidDefinition", - $fault: "client", - ...opts + // eslint-disable-next-line @typescript-eslint/no-unused-vars + async acquireInitialRetryToken(retryTokenScope) { + return createDefaultRetryToken({ + retryDelay: DEFAULT_RETRY_DELAY_BASE, + retryCount: 0 }); - this.name = "InvalidDefinition"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidDefinition.prototype); } - }; - exports2.InvalidDefinition = InvalidDefinition; - var InvalidLoggingConfiguration = class _InvalidLoggingConfiguration extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "InvalidLoggingConfiguration", - $fault: "client", - ...opts - }); - this.name = "InvalidLoggingConfiguration"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidLoggingConfiguration.prototype); + async refreshRetryTokenForRetry(token, errorInfo) { + const maxAttempts = await this.getMaxAttempts(); + if (this.shouldRetry(token, errorInfo, maxAttempts)) { + const errorType = errorInfo.errorType; + this.retryBackoffStrategy.setDelayBase( + errorType === "THROTTLING" ? THROTTLING_RETRY_DELAY_BASE : DEFAULT_RETRY_DELAY_BASE + ); + const delayFromErrorType = this.retryBackoffStrategy.computeNextBackoffDelay(token.getRetryCount()); + const retryDelay = errorInfo.retryAfterHint ? Math.max(errorInfo.retryAfterHint.getTime() - Date.now() || 0, delayFromErrorType) : delayFromErrorType; + const capacityCost = this.getCapacityCost(errorType); + this.capacity -= capacityCost; + return createDefaultRetryToken({ + retryDelay, + retryCount: token.getRetryCount() + 1, + retryCost: capacityCost + }); + } + throw new Error("No retry token available"); } - }; - exports2.InvalidLoggingConfiguration = InvalidLoggingConfiguration; - var InvalidTracingConfiguration = class _InvalidTracingConfiguration extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "InvalidTracingConfiguration", - $fault: "client", - ...opts - }); - this.name = "InvalidTracingConfiguration"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidTracingConfiguration.prototype); + recordSuccess(token) { + this.capacity = Math.max(INITIAL_RETRY_TOKENS, this.capacity + (token.getRetryCost() ?? NO_RETRY_INCREMENT)); } - }; - exports2.InvalidTracingConfiguration = InvalidTracingConfiguration; - var StateMachineAlreadyExists = class _StateMachineAlreadyExists extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "StateMachineAlreadyExists", - $fault: "client", - ...opts - }); - this.name = "StateMachineAlreadyExists"; - this.$fault = "client"; - Object.setPrototypeOf(this, _StateMachineAlreadyExists.prototype); + /** + * @returns the current available retry capacity. + * + * This number decreases when retries are executed and refills when requests or retries succeed. + */ + getCapacity() { + return this.capacity; } - }; - exports2.StateMachineAlreadyExists = StateMachineAlreadyExists; - var StateMachineDeleting = class _StateMachineDeleting extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "StateMachineDeleting", - $fault: "client", - ...opts - }); - this.name = "StateMachineDeleting"; - this.$fault = "client"; - Object.setPrototypeOf(this, _StateMachineDeleting.prototype); + async getMaxAttempts() { + try { + return await this.maxAttemptsProvider(); + } catch (error) { + console.warn(`Max attempts provider could not resolve. Using default of ${DEFAULT_MAX_ATTEMPTS}`); + return DEFAULT_MAX_ATTEMPTS; + } } - }; - exports2.StateMachineDeleting = StateMachineDeleting; - var StateMachineLimitExceeded = class _StateMachineLimitExceeded extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "StateMachineLimitExceeded", - $fault: "client", - ...opts - }); - this.name = "StateMachineLimitExceeded"; - this.$fault = "client"; - Object.setPrototypeOf(this, _StateMachineLimitExceeded.prototype); + shouldRetry(tokenToRenew, errorInfo, maxAttempts) { + const attempts = tokenToRenew.getRetryCount() + 1; + return attempts < maxAttempts && this.capacity >= this.getCapacityCost(errorInfo.errorType) && this.isRetryableError(errorInfo.errorType); } - }; - exports2.StateMachineLimitExceeded = StateMachineLimitExceeded; - var StateMachineTypeNotSupported = class _StateMachineTypeNotSupported extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "StateMachineTypeNotSupported", - $fault: "client", - ...opts - }); - this.name = "StateMachineTypeNotSupported"; - this.$fault = "client"; - Object.setPrototypeOf(this, _StateMachineTypeNotSupported.prototype); + getCapacityCost(errorType) { + return errorType === "TRANSIENT" ? TIMEOUT_RETRY_COST : RETRY_COST; } - }; - exports2.StateMachineTypeNotSupported = StateMachineTypeNotSupported; - exports2.ValidationExceptionReason = { - API_DOES_NOT_SUPPORT_LABELED_ARNS: "API_DOES_NOT_SUPPORT_LABELED_ARNS", - CANNOT_UPDATE_COMPLETED_MAP_RUN: "CANNOT_UPDATE_COMPLETED_MAP_RUN", - INVALID_ROUTING_CONFIGURATION: "INVALID_ROUTING_CONFIGURATION", - MISSING_REQUIRED_PARAMETER: "MISSING_REQUIRED_PARAMETER" - }; - var ValidationException = class _ValidationException extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "ValidationException", - $fault: "client", - ...opts - }); - this.name = "ValidationException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _ValidationException.prototype); - this.reason = opts.reason; + isRetryableError(errorType) { + return errorType === "THROTTLING" || errorType === "TRANSIENT"; } }; - exports2.ValidationException = ValidationException; - var ResourceNotFound = class _ResourceNotFound extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "ResourceNotFound", - $fault: "client", - ...opts - }); - this.name = "ResourceNotFound"; - this.$fault = "client"; - Object.setPrototypeOf(this, _ResourceNotFound.prototype); - this.resourceName = opts.resourceName; + __name(_StandardRetryStrategy, "StandardRetryStrategy"); + var StandardRetryStrategy = _StandardRetryStrategy; + var _AdaptiveRetryStrategy = class _AdaptiveRetryStrategy { + constructor(maxAttemptsProvider, options) { + this.maxAttemptsProvider = maxAttemptsProvider; + this.mode = "adaptive"; + const { rateLimiter } = options ?? {}; + this.rateLimiter = rateLimiter ?? new DefaultRateLimiter(); + this.standardRetryStrategy = new StandardRetryStrategy(maxAttemptsProvider); } - }; - exports2.ResourceNotFound = ResourceNotFound; - var ServiceQuotaExceededException = class _ServiceQuotaExceededException extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "ServiceQuotaExceededException", - $fault: "client", - ...opts - }); - this.name = "ServiceQuotaExceededException"; - this.$fault = "client"; - Object.setPrototypeOf(this, _ServiceQuotaExceededException.prototype); + async acquireInitialRetryToken(retryTokenScope) { + await this.rateLimiter.getSendToken(); + return this.standardRetryStrategy.acquireInitialRetryToken(retryTokenScope); + } + async refreshRetryTokenForRetry(tokenToRenew, errorInfo) { + this.rateLimiter.updateClientSendingRate(errorInfo); + return this.standardRetryStrategy.refreshRetryTokenForRetry(tokenToRenew, errorInfo); + } + recordSuccess(token) { + this.rateLimiter.updateClientSendingRate({}); + this.standardRetryStrategy.recordSuccess(token); } }; - exports2.ServiceQuotaExceededException = ServiceQuotaExceededException; - exports2.ExecutionStatus = { - ABORTED: "ABORTED", - FAILED: "FAILED", - RUNNING: "RUNNING", - SUCCEEDED: "SUCCEEDED", - TIMED_OUT: "TIMED_OUT" - }; - var ExecutionDoesNotExist = class _ExecutionDoesNotExist extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "ExecutionDoesNotExist", - $fault: "client", - ...opts - }); - this.name = "ExecutionDoesNotExist"; - this.$fault = "client"; - Object.setPrototypeOf(this, _ExecutionDoesNotExist.prototype); + __name(_AdaptiveRetryStrategy, "AdaptiveRetryStrategy"); + var AdaptiveRetryStrategy = _AdaptiveRetryStrategy; + var _ConfiguredRetryStrategy = class _ConfiguredRetryStrategy extends StandardRetryStrategy { + /** + * @param maxAttempts - the maximum number of retry attempts allowed. + * e.g., if set to 3, then 4 total requests are possible. + * @param computeNextBackoffDelay - a millisecond delay for each retry or a function that takes the retry attempt + * and returns the delay. + * + * @example exponential backoff. + * ```js + * new Client({ + * retryStrategy: new ConfiguredRetryStrategy(3, (attempt) => attempt ** 2) + * }); + * ``` + * @example constant delay. + * ```js + * new Client({ + * retryStrategy: new ConfiguredRetryStrategy(3, 2000) + * }); + * ``` + */ + constructor(maxAttempts, computeNextBackoffDelay = DEFAULT_RETRY_DELAY_BASE) { + super(typeof maxAttempts === "function" ? maxAttempts : async () => maxAttempts); + if (typeof computeNextBackoffDelay === "number") { + this.computeNextBackoffDelay = () => computeNextBackoffDelay; + } else { + this.computeNextBackoffDelay = computeNextBackoffDelay; + } + } + async refreshRetryTokenForRetry(tokenToRenew, errorInfo) { + const token = await super.refreshRetryTokenForRetry(tokenToRenew, errorInfo); + token.getRetryDelay = () => this.computeNextBackoffDelay(token.getRetryCount()); + return token; } }; - exports2.ExecutionDoesNotExist = ExecutionDoesNotExist; - exports2.MapRunStatus = { - ABORTED: "ABORTED", - FAILED: "FAILED", - RUNNING: "RUNNING", - SUCCEEDED: "SUCCEEDED" - }; - exports2.StateMachineStatus = { - ACTIVE: "ACTIVE", - DELETING: "DELETING" + __name(_ConfiguredRetryStrategy, "ConfiguredRetryStrategy"); + var ConfiguredRetryStrategy = _ConfiguredRetryStrategy; + } +}); + +// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/endpoint/ruleset.js +var require_ruleset = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso/dist-cjs/endpoint/ruleset.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ruleSet = void 0; + var u = "required"; + var v = "fn"; + var w = "argv"; + var x = "ref"; + var a = true; + var b = "isSet"; + var c = "booleanEquals"; + var d = "error"; + var e = "endpoint"; + var f = "tree"; + var g = "PartitionResult"; + var h = "getAttr"; + var i = { [u]: false, "type": "String" }; + var j = { [u]: true, "default": false, "type": "Boolean" }; + var k = { [x]: "Endpoint" }; + var l = { [v]: c, [w]: [{ [x]: "UseFIPS" }, true] }; + var m = { [v]: c, [w]: [{ [x]: "UseDualStack" }, true] }; + var n = {}; + var o = { [v]: h, [w]: [{ [x]: g }, "supportsFIPS"] }; + var p = { [x]: g }; + var q = { [v]: c, [w]: [true, { [v]: h, [w]: [p, "supportsDualStack"] }] }; + var r = [l]; + var s = [m]; + var t = [{ [x]: "Region" }]; + var _data = { version: "1.0", parameters: { Region: i, UseDualStack: j, UseFIPS: j, Endpoint: i }, rules: [{ conditions: [{ [v]: b, [w]: [k] }], rules: [{ conditions: r, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: d }, { conditions: s, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: d }, { endpoint: { url: k, properties: n, headers: n }, type: e }], type: f }, { conditions: [{ [v]: b, [w]: t }], rules: [{ conditions: [{ [v]: "aws.partition", [w]: t, assign: g }], rules: [{ conditions: [l, m], rules: [{ conditions: [{ [v]: c, [w]: [a, o] }, q], rules: [{ endpoint: { url: "https://portal.sso-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: d }], type: f }, { conditions: r, rules: [{ conditions: [{ [v]: c, [w]: [o, a] }], rules: [{ conditions: [{ [v]: "stringEquals", [w]: [{ [v]: h, [w]: [p, "name"] }, "aws-us-gov"] }], endpoint: { url: "https://portal.sso.{Region}.amazonaws.com", properties: n, headers: n }, type: e }, { endpoint: { url: "https://portal.sso-fips.{Region}.{PartitionResult#dnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "FIPS is enabled but this partition does not support FIPS", type: d }], type: f }, { conditions: s, rules: [{ conditions: [q], rules: [{ endpoint: { url: "https://portal.sso.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "DualStack is enabled but this partition does not support DualStack", type: d }], type: f }, { endpoint: { url: "https://portal.sso.{Region}.{PartitionResult#dnsSuffix}", properties: n, headers: n }, type: e }], type: f }], type: f }, { error: "Invalid Configuration: Missing Region", type: d }] }; + exports2.ruleSet = _data; + } +}); + +// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/endpoint/endpointResolver.js +var require_endpointResolver = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso/dist-cjs/endpoint/endpointResolver.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.defaultEndpointResolver = void 0; + var util_endpoints_1 = require_dist_cjs7(); + var util_endpoints_2 = require_dist_cjs6(); + var ruleset_1 = require_ruleset(); + var defaultEndpointResolver = (endpointParams, context = {}) => { + return (0, util_endpoints_2.resolveEndpoint)(ruleset_1.ruleSet, { + endpointParams, + logger: context.logger + }); }; - var StateMachineDoesNotExist = class _StateMachineDoesNotExist extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "StateMachineDoesNotExist", - $fault: "client", - ...opts - }); - this.name = "StateMachineDoesNotExist"; - this.$fault = "client"; - Object.setPrototypeOf(this, _StateMachineDoesNotExist.prototype); - } + exports2.defaultEndpointResolver = defaultEndpointResolver; + util_endpoints_2.customEndpointFunctions.aws = util_endpoints_1.awsEndpointFunctions; + } +}); + +// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/runtimeConfig.shared.js +var require_runtimeConfig_shared = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso/dist-cjs/runtimeConfig.shared.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getRuntimeConfig = void 0; + var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var core_2 = (init_dist_es(), __toCommonJS(dist_es_exports)); + var smithy_client_1 = require_dist_cjs37(); + var url_parser_1 = require_dist_cjs44(); + var util_base64_1 = require_dist_cjs29(); + var util_utf8_1 = require_dist_cjs28(); + var httpAuthSchemeProvider_1 = require_httpAuthSchemeProvider2(); + var endpointResolver_1 = require_endpointResolver(); + var getRuntimeConfig = (config) => { + return { + apiVersion: "2019-06-10", + base64Decoder: config?.base64Decoder ?? util_base64_1.fromBase64, + base64Encoder: config?.base64Encoder ?? util_base64_1.toBase64, + disableHostPrefix: config?.disableHostPrefix ?? false, + endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver, + extensions: config?.extensions ?? [], + httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? httpAuthSchemeProvider_1.defaultSSOHttpAuthSchemeProvider, + httpAuthSchemes: config?.httpAuthSchemes ?? [ + { + schemeId: "aws.auth#sigv4", + identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"), + signer: new core_1.AwsSdkSigV4Signer() + }, + { + schemeId: "smithy.api#noAuth", + identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})), + signer: new core_2.NoAuthSigner() + } + ], + logger: config?.logger ?? new smithy_client_1.NoOpLogger(), + serviceId: config?.serviceId ?? "SSO", + urlParser: config?.urlParser ?? url_parser_1.parseUrl, + utf8Decoder: config?.utf8Decoder ?? util_utf8_1.fromUtf8, + utf8Encoder: config?.utf8Encoder ?? util_utf8_1.toUtf8 + }; }; - exports2.StateMachineDoesNotExist = StateMachineDoesNotExist; - exports2.HistoryEventType = { - ActivityFailed: "ActivityFailed", - ActivityScheduleFailed: "ActivityScheduleFailed", - ActivityScheduled: "ActivityScheduled", - ActivityStarted: "ActivityStarted", - ActivitySucceeded: "ActivitySucceeded", - ActivityTimedOut: "ActivityTimedOut", - ChoiceStateEntered: "ChoiceStateEntered", - ChoiceStateExited: "ChoiceStateExited", - ExecutionAborted: "ExecutionAborted", - ExecutionFailed: "ExecutionFailed", - ExecutionStarted: "ExecutionStarted", - ExecutionSucceeded: "ExecutionSucceeded", - ExecutionTimedOut: "ExecutionTimedOut", - FailStateEntered: "FailStateEntered", - LambdaFunctionFailed: "LambdaFunctionFailed", - LambdaFunctionScheduleFailed: "LambdaFunctionScheduleFailed", - LambdaFunctionScheduled: "LambdaFunctionScheduled", - LambdaFunctionStartFailed: "LambdaFunctionStartFailed", - LambdaFunctionStarted: "LambdaFunctionStarted", - LambdaFunctionSucceeded: "LambdaFunctionSucceeded", - LambdaFunctionTimedOut: "LambdaFunctionTimedOut", - MapIterationAborted: "MapIterationAborted", - MapIterationFailed: "MapIterationFailed", - MapIterationStarted: "MapIterationStarted", - MapIterationSucceeded: "MapIterationSucceeded", - MapRunAborted: "MapRunAborted", - MapRunFailed: "MapRunFailed", - MapRunStarted: "MapRunStarted", - MapRunSucceeded: "MapRunSucceeded", - MapStateAborted: "MapStateAborted", - MapStateEntered: "MapStateEntered", - MapStateExited: "MapStateExited", - MapStateFailed: "MapStateFailed", - MapStateStarted: "MapStateStarted", - MapStateSucceeded: "MapStateSucceeded", - ParallelStateAborted: "ParallelStateAborted", - ParallelStateEntered: "ParallelStateEntered", - ParallelStateExited: "ParallelStateExited", - ParallelStateFailed: "ParallelStateFailed", - ParallelStateStarted: "ParallelStateStarted", - ParallelStateSucceeded: "ParallelStateSucceeded", - PassStateEntered: "PassStateEntered", - PassStateExited: "PassStateExited", - SucceedStateEntered: "SucceedStateEntered", - SucceedStateExited: "SucceedStateExited", - TaskFailed: "TaskFailed", - TaskScheduled: "TaskScheduled", - TaskStartFailed: "TaskStartFailed", - TaskStarted: "TaskStarted", - TaskStateAborted: "TaskStateAborted", - TaskStateEntered: "TaskStateEntered", - TaskStateExited: "TaskStateExited", - TaskSubmitFailed: "TaskSubmitFailed", - TaskSubmitted: "TaskSubmitted", - TaskSucceeded: "TaskSucceeded", - TaskTimedOut: "TaskTimedOut", - WaitStateAborted: "WaitStateAborted", - WaitStateEntered: "WaitStateEntered", - WaitStateExited: "WaitStateExited" + exports2.getRuntimeConfig = getRuntimeConfig; + } +}); + +// ../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/util-middleware/dist-cjs/index.js +var require_dist_cjs61 = __commonJS({ + "../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/util-middleware/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var InvalidToken = class _InvalidToken extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "InvalidToken", - $fault: "client", - ...opts - }); - this.name = "InvalidToken"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidToken.prototype); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - exports2.InvalidToken = InvalidToken; - var TaskDoesNotExist = class _TaskDoesNotExist extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "TaskDoesNotExist", - $fault: "client", - ...opts - }); - this.name = "TaskDoesNotExist"; - this.$fault = "client"; - Object.setPrototypeOf(this, _TaskDoesNotExist.prototype); - } + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + getSmithyContext: () => getSmithyContext4, + normalizeProvider: () => normalizeProvider2 + }); + module2.exports = __toCommonJS2(src_exports); + var import_types5 = require_dist_cjs(); + var getSmithyContext4 = /* @__PURE__ */ __name((context) => context[import_types5.SMITHY_CONTEXT_KEY] || (context[import_types5.SMITHY_CONTEXT_KEY] = {}), "getSmithyContext"); + var normalizeProvider2 = /* @__PURE__ */ __name((input) => { + if (typeof input === "function") + return input; + const promisified = Promise.resolve(input); + return () => promisified; + }, "normalizeProvider"); + } +}); + +// ../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/config-resolver/dist-cjs/index.js +var require_dist_cjs62 = __commonJS({ + "../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/config-resolver/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - exports2.TaskDoesNotExist = TaskDoesNotExist; - var TaskTimedOut = class _TaskTimedOut extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "TaskTimedOut", - $fault: "client", - ...opts - }); - this.name = "TaskTimedOut"; - this.$fault = "client"; - Object.setPrototypeOf(this, _TaskTimedOut.prototype); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - exports2.TaskTimedOut = TaskTimedOut; - var InvalidOutput = class _InvalidOutput extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "InvalidOutput", - $fault: "client", - ...opts - }); - this.name = "InvalidOutput"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidOutput.prototype); - } + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + CONFIG_USE_DUALSTACK_ENDPOINT: () => CONFIG_USE_DUALSTACK_ENDPOINT, + CONFIG_USE_FIPS_ENDPOINT: () => CONFIG_USE_FIPS_ENDPOINT, + DEFAULT_USE_DUALSTACK_ENDPOINT: () => DEFAULT_USE_DUALSTACK_ENDPOINT, + DEFAULT_USE_FIPS_ENDPOINT: () => DEFAULT_USE_FIPS_ENDPOINT, + ENV_USE_DUALSTACK_ENDPOINT: () => ENV_USE_DUALSTACK_ENDPOINT, + ENV_USE_FIPS_ENDPOINT: () => ENV_USE_FIPS_ENDPOINT, + NODE_REGION_CONFIG_FILE_OPTIONS: () => NODE_REGION_CONFIG_FILE_OPTIONS, + NODE_REGION_CONFIG_OPTIONS: () => NODE_REGION_CONFIG_OPTIONS, + NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS: () => NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, + NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS: () => NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, + REGION_ENV_NAME: () => REGION_ENV_NAME, + REGION_INI_NAME: () => REGION_INI_NAME, + getRegionInfo: () => getRegionInfo, + resolveCustomEndpointsConfig: () => resolveCustomEndpointsConfig, + resolveEndpointsConfig: () => resolveEndpointsConfig, + resolveRegionConfig: () => resolveRegionConfig + }); + module2.exports = __toCommonJS2(src_exports); + var import_util_config_provider = require_dist_cjs9(); + var ENV_USE_DUALSTACK_ENDPOINT = "AWS_USE_DUALSTACK_ENDPOINT"; + var CONFIG_USE_DUALSTACK_ENDPOINT = "use_dualstack_endpoint"; + var DEFAULT_USE_DUALSTACK_ENDPOINT = false; + var NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => (0, import_util_config_provider.booleanSelector)(env, ENV_USE_DUALSTACK_ENDPOINT, import_util_config_provider.SelectorType.ENV), + configFileSelector: (profile) => (0, import_util_config_provider.booleanSelector)(profile, CONFIG_USE_DUALSTACK_ENDPOINT, import_util_config_provider.SelectorType.CONFIG), + default: false }; - exports2.InvalidOutput = InvalidOutput; - var ExecutionAlreadyExists = class _ExecutionAlreadyExists extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "ExecutionAlreadyExists", - $fault: "client", - ...opts - }); - this.name = "ExecutionAlreadyExists"; - this.$fault = "client"; - Object.setPrototypeOf(this, _ExecutionAlreadyExists.prototype); - } + var ENV_USE_FIPS_ENDPOINT = "AWS_USE_FIPS_ENDPOINT"; + var CONFIG_USE_FIPS_ENDPOINT = "use_fips_endpoint"; + var DEFAULT_USE_FIPS_ENDPOINT = false; + var NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => (0, import_util_config_provider.booleanSelector)(env, ENV_USE_FIPS_ENDPOINT, import_util_config_provider.SelectorType.ENV), + configFileSelector: (profile) => (0, import_util_config_provider.booleanSelector)(profile, CONFIG_USE_FIPS_ENDPOINT, import_util_config_provider.SelectorType.CONFIG), + default: false }; - exports2.ExecutionAlreadyExists = ExecutionAlreadyExists; - var ExecutionLimitExceeded = class _ExecutionLimitExceeded extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "ExecutionLimitExceeded", - $fault: "client", - ...opts - }); - this.name = "ExecutionLimitExceeded"; - this.$fault = "client"; - Object.setPrototypeOf(this, _ExecutionLimitExceeded.prototype); + var import_util_middleware3 = require_dist_cjs61(); + var resolveCustomEndpointsConfig = /* @__PURE__ */ __name((input) => { + const { endpoint, urlParser } = input; + return { + ...input, + tls: input.tls ?? true, + endpoint: (0, import_util_middleware3.normalizeProvider)(typeof endpoint === "string" ? urlParser(endpoint) : endpoint), + isCustomEndpoint: true, + useDualstackEndpoint: (0, import_util_middleware3.normalizeProvider)(input.useDualstackEndpoint ?? false) + }; + }, "resolveCustomEndpointsConfig"); + var getEndpointFromRegion = /* @__PURE__ */ __name(async (input) => { + const { tls = true } = input; + const region = await input.region(); + const dnsHostRegex = new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/); + if (!dnsHostRegex.test(region)) { + throw new Error("Invalid region in client config"); } - }; - exports2.ExecutionLimitExceeded = ExecutionLimitExceeded; - var InvalidExecutionInput = class _InvalidExecutionInput extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "InvalidExecutionInput", - $fault: "client", - ...opts - }); - this.name = "InvalidExecutionInput"; - this.$fault = "client"; - Object.setPrototypeOf(this, _InvalidExecutionInput.prototype); + const useDualstackEndpoint = await input.useDualstackEndpoint(); + const useFipsEndpoint = await input.useFipsEndpoint(); + const { hostname } = await input.regionInfoProvider(region, { useDualstackEndpoint, useFipsEndpoint }) ?? {}; + if (!hostname) { + throw new Error("Cannot resolve hostname from client config"); + } + return input.urlParser(`${tls ? "https:" : "http:"}//${hostname}`); + }, "getEndpointFromRegion"); + var resolveEndpointsConfig = /* @__PURE__ */ __name((input) => { + const useDualstackEndpoint = (0, import_util_middleware3.normalizeProvider)(input.useDualstackEndpoint ?? false); + const { endpoint, useFipsEndpoint, urlParser } = input; + return { + ...input, + tls: input.tls ?? true, + endpoint: endpoint ? (0, import_util_middleware3.normalizeProvider)(typeof endpoint === "string" ? urlParser(endpoint) : endpoint) : () => getEndpointFromRegion({ ...input, useDualstackEndpoint, useFipsEndpoint }), + isCustomEndpoint: !!endpoint, + useDualstackEndpoint + }; + }, "resolveEndpointsConfig"); + var REGION_ENV_NAME = "AWS_REGION"; + var REGION_INI_NAME = "region"; + var NODE_REGION_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => env[REGION_ENV_NAME], + configFileSelector: (profile) => profile[REGION_INI_NAME], + default: () => { + throw new Error("Region is missing"); } }; - exports2.InvalidExecutionInput = InvalidExecutionInput; - exports2.SyncExecutionStatus = { - FAILED: "FAILED", - SUCCEEDED: "SUCCEEDED", - TIMED_OUT: "TIMED_OUT" + var NODE_REGION_CONFIG_FILE_OPTIONS = { + preferredFile: "credentials" }; - var MissingRequiredParameter = class _MissingRequiredParameter extends SFNServiceException_1.SFNServiceException { - constructor(opts) { - super({ - name: "MissingRequiredParameter", - $fault: "client", - ...opts - }); - this.name = "MissingRequiredParameter"; - this.$fault = "client"; - Object.setPrototypeOf(this, _MissingRequiredParameter.prototype); + var isFipsRegion = /* @__PURE__ */ __name((region) => typeof region === "string" && (region.startsWith("fips-") || region.endsWith("-fips")), "isFipsRegion"); + var getRealRegion = /* @__PURE__ */ __name((region) => isFipsRegion(region) ? ["fips-aws-global", "aws-fips"].includes(region) ? "us-east-1" : region.replace(/fips-(dkr-|prod-)?|-fips/, "") : region, "getRealRegion"); + var resolveRegionConfig = /* @__PURE__ */ __name((input) => { + const { region, useFipsEndpoint } = input; + if (!region) { + throw new Error("Region is missing"); } - }; - exports2.MissingRequiredParameter = MissingRequiredParameter; - var ActivityFailedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.ActivityFailedEventDetailsFilterSensitiveLog = ActivityFailedEventDetailsFilterSensitiveLog; - var ActivityScheduledEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.input && { input: smithy_client_1.SENSITIVE_STRING } - }); - exports2.ActivityScheduledEventDetailsFilterSensitiveLog = ActivityScheduledEventDetailsFilterSensitiveLog; - var ActivityScheduleFailedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.ActivityScheduleFailedEventDetailsFilterSensitiveLog = ActivityScheduleFailedEventDetailsFilterSensitiveLog; - var ActivitySucceededEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.output && { output: smithy_client_1.SENSITIVE_STRING } - }); - exports2.ActivitySucceededEventDetailsFilterSensitiveLog = ActivitySucceededEventDetailsFilterSensitiveLog; - var ActivityTimedOutEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.ActivityTimedOutEventDetailsFilterSensitiveLog = ActivityTimedOutEventDetailsFilterSensitiveLog; - var CreateStateMachineInputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.definition && { definition: smithy_client_1.SENSITIVE_STRING }, - ...obj.versionDescription && { versionDescription: smithy_client_1.SENSITIVE_STRING } - }); - exports2.CreateStateMachineInputFilterSensitiveLog = CreateStateMachineInputFilterSensitiveLog; - var CreateStateMachineAliasInputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.description && { description: smithy_client_1.SENSITIVE_STRING } - }); - exports2.CreateStateMachineAliasInputFilterSensitiveLog = CreateStateMachineAliasInputFilterSensitiveLog; - var DescribeExecutionOutputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.input && { input: smithy_client_1.SENSITIVE_STRING }, - ...obj.output && { output: smithy_client_1.SENSITIVE_STRING }, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.DescribeExecutionOutputFilterSensitiveLog = DescribeExecutionOutputFilterSensitiveLog; - var DescribeStateMachineOutputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.definition && { definition: smithy_client_1.SENSITIVE_STRING }, - ...obj.description && { description: smithy_client_1.SENSITIVE_STRING } - }); - exports2.DescribeStateMachineOutputFilterSensitiveLog = DescribeStateMachineOutputFilterSensitiveLog; - var DescribeStateMachineAliasOutputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.description && { description: smithy_client_1.SENSITIVE_STRING } - }); - exports2.DescribeStateMachineAliasOutputFilterSensitiveLog = DescribeStateMachineAliasOutputFilterSensitiveLog; - var DescribeStateMachineForExecutionOutputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.definition && { definition: smithy_client_1.SENSITIVE_STRING } - }); - exports2.DescribeStateMachineForExecutionOutputFilterSensitiveLog = DescribeStateMachineForExecutionOutputFilterSensitiveLog; - var GetActivityTaskOutputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.input && { input: smithy_client_1.SENSITIVE_STRING } - }); - exports2.GetActivityTaskOutputFilterSensitiveLog = GetActivityTaskOutputFilterSensitiveLog; - var ExecutionAbortedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.ExecutionAbortedEventDetailsFilterSensitiveLog = ExecutionAbortedEventDetailsFilterSensitiveLog; - var ExecutionFailedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.ExecutionFailedEventDetailsFilterSensitiveLog = ExecutionFailedEventDetailsFilterSensitiveLog; - var ExecutionStartedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.input && { input: smithy_client_1.SENSITIVE_STRING } - }); - exports2.ExecutionStartedEventDetailsFilterSensitiveLog = ExecutionStartedEventDetailsFilterSensitiveLog; - var ExecutionSucceededEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.output && { output: smithy_client_1.SENSITIVE_STRING } - }); - exports2.ExecutionSucceededEventDetailsFilterSensitiveLog = ExecutionSucceededEventDetailsFilterSensitiveLog; - var ExecutionTimedOutEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.ExecutionTimedOutEventDetailsFilterSensitiveLog = ExecutionTimedOutEventDetailsFilterSensitiveLog; - var LambdaFunctionFailedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.LambdaFunctionFailedEventDetailsFilterSensitiveLog = LambdaFunctionFailedEventDetailsFilterSensitiveLog; - var LambdaFunctionScheduledEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.input && { input: smithy_client_1.SENSITIVE_STRING } - }); - exports2.LambdaFunctionScheduledEventDetailsFilterSensitiveLog = LambdaFunctionScheduledEventDetailsFilterSensitiveLog; - var LambdaFunctionScheduleFailedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.LambdaFunctionScheduleFailedEventDetailsFilterSensitiveLog = LambdaFunctionScheduleFailedEventDetailsFilterSensitiveLog; - var LambdaFunctionStartFailedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.LambdaFunctionStartFailedEventDetailsFilterSensitiveLog = LambdaFunctionStartFailedEventDetailsFilterSensitiveLog; - var LambdaFunctionSucceededEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.output && { output: smithy_client_1.SENSITIVE_STRING } - }); - exports2.LambdaFunctionSucceededEventDetailsFilterSensitiveLog = LambdaFunctionSucceededEventDetailsFilterSensitiveLog; - var LambdaFunctionTimedOutEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.LambdaFunctionTimedOutEventDetailsFilterSensitiveLog = LambdaFunctionTimedOutEventDetailsFilterSensitiveLog; - var MapRunFailedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.MapRunFailedEventDetailsFilterSensitiveLog = MapRunFailedEventDetailsFilterSensitiveLog; - var StateEnteredEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.input && { input: smithy_client_1.SENSITIVE_STRING } - }); - exports2.StateEnteredEventDetailsFilterSensitiveLog = StateEnteredEventDetailsFilterSensitiveLog; - var StateExitedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.output && { output: smithy_client_1.SENSITIVE_STRING } - }); - exports2.StateExitedEventDetailsFilterSensitiveLog = StateExitedEventDetailsFilterSensitiveLog; - var TaskFailedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.TaskFailedEventDetailsFilterSensitiveLog = TaskFailedEventDetailsFilterSensitiveLog; - var TaskScheduledEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.parameters && { parameters: smithy_client_1.SENSITIVE_STRING } - }); - exports2.TaskScheduledEventDetailsFilterSensitiveLog = TaskScheduledEventDetailsFilterSensitiveLog; - var TaskStartFailedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.TaskStartFailedEventDetailsFilterSensitiveLog = TaskStartFailedEventDetailsFilterSensitiveLog; - var TaskSubmitFailedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.TaskSubmitFailedEventDetailsFilterSensitiveLog = TaskSubmitFailedEventDetailsFilterSensitiveLog; - var TaskSubmittedEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.output && { output: smithy_client_1.SENSITIVE_STRING } - }); - exports2.TaskSubmittedEventDetailsFilterSensitiveLog = TaskSubmittedEventDetailsFilterSensitiveLog; - var TaskSucceededEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.output && { output: smithy_client_1.SENSITIVE_STRING } - }); - exports2.TaskSucceededEventDetailsFilterSensitiveLog = TaskSucceededEventDetailsFilterSensitiveLog; - var TaskTimedOutEventDetailsFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.TaskTimedOutEventDetailsFilterSensitiveLog = TaskTimedOutEventDetailsFilterSensitiveLog; - var HistoryEventFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.activityFailedEventDetails && { - activityFailedEventDetails: (0, exports2.ActivityFailedEventDetailsFilterSensitiveLog)(obj.activityFailedEventDetails) - }, - ...obj.activityScheduleFailedEventDetails && { - activityScheduleFailedEventDetails: (0, exports2.ActivityScheduleFailedEventDetailsFilterSensitiveLog)(obj.activityScheduleFailedEventDetails) - }, - ...obj.activityScheduledEventDetails && { - activityScheduledEventDetails: (0, exports2.ActivityScheduledEventDetailsFilterSensitiveLog)(obj.activityScheduledEventDetails) - }, - ...obj.activitySucceededEventDetails && { - activitySucceededEventDetails: (0, exports2.ActivitySucceededEventDetailsFilterSensitiveLog)(obj.activitySucceededEventDetails) - }, - ...obj.activityTimedOutEventDetails && { - activityTimedOutEventDetails: (0, exports2.ActivityTimedOutEventDetailsFilterSensitiveLog)(obj.activityTimedOutEventDetails) - }, - ...obj.taskFailedEventDetails && { - taskFailedEventDetails: (0, exports2.TaskFailedEventDetailsFilterSensitiveLog)(obj.taskFailedEventDetails) - }, - ...obj.taskScheduledEventDetails && { - taskScheduledEventDetails: (0, exports2.TaskScheduledEventDetailsFilterSensitiveLog)(obj.taskScheduledEventDetails) - }, - ...obj.taskStartFailedEventDetails && { - taskStartFailedEventDetails: (0, exports2.TaskStartFailedEventDetailsFilterSensitiveLog)(obj.taskStartFailedEventDetails) - }, - ...obj.taskSubmitFailedEventDetails && { - taskSubmitFailedEventDetails: (0, exports2.TaskSubmitFailedEventDetailsFilterSensitiveLog)(obj.taskSubmitFailedEventDetails) - }, - ...obj.taskSubmittedEventDetails && { - taskSubmittedEventDetails: (0, exports2.TaskSubmittedEventDetailsFilterSensitiveLog)(obj.taskSubmittedEventDetails) - }, - ...obj.taskSucceededEventDetails && { - taskSucceededEventDetails: (0, exports2.TaskSucceededEventDetailsFilterSensitiveLog)(obj.taskSucceededEventDetails) - }, - ...obj.taskTimedOutEventDetails && { - taskTimedOutEventDetails: (0, exports2.TaskTimedOutEventDetailsFilterSensitiveLog)(obj.taskTimedOutEventDetails) - }, - ...obj.executionFailedEventDetails && { - executionFailedEventDetails: (0, exports2.ExecutionFailedEventDetailsFilterSensitiveLog)(obj.executionFailedEventDetails) - }, - ...obj.executionStartedEventDetails && { - executionStartedEventDetails: (0, exports2.ExecutionStartedEventDetailsFilterSensitiveLog)(obj.executionStartedEventDetails) - }, - ...obj.executionSucceededEventDetails && { - executionSucceededEventDetails: (0, exports2.ExecutionSucceededEventDetailsFilterSensitiveLog)(obj.executionSucceededEventDetails) - }, - ...obj.executionAbortedEventDetails && { - executionAbortedEventDetails: (0, exports2.ExecutionAbortedEventDetailsFilterSensitiveLog)(obj.executionAbortedEventDetails) - }, - ...obj.executionTimedOutEventDetails && { - executionTimedOutEventDetails: (0, exports2.ExecutionTimedOutEventDetailsFilterSensitiveLog)(obj.executionTimedOutEventDetails) - }, - ...obj.lambdaFunctionFailedEventDetails && { - lambdaFunctionFailedEventDetails: (0, exports2.LambdaFunctionFailedEventDetailsFilterSensitiveLog)(obj.lambdaFunctionFailedEventDetails) - }, - ...obj.lambdaFunctionScheduleFailedEventDetails && { - lambdaFunctionScheduleFailedEventDetails: (0, exports2.LambdaFunctionScheduleFailedEventDetailsFilterSensitiveLog)(obj.lambdaFunctionScheduleFailedEventDetails) - }, - ...obj.lambdaFunctionScheduledEventDetails && { - lambdaFunctionScheduledEventDetails: (0, exports2.LambdaFunctionScheduledEventDetailsFilterSensitiveLog)(obj.lambdaFunctionScheduledEventDetails) - }, - ...obj.lambdaFunctionStartFailedEventDetails && { - lambdaFunctionStartFailedEventDetails: (0, exports2.LambdaFunctionStartFailedEventDetailsFilterSensitiveLog)(obj.lambdaFunctionStartFailedEventDetails) - }, - ...obj.lambdaFunctionSucceededEventDetails && { - lambdaFunctionSucceededEventDetails: (0, exports2.LambdaFunctionSucceededEventDetailsFilterSensitiveLog)(obj.lambdaFunctionSucceededEventDetails) - }, - ...obj.lambdaFunctionTimedOutEventDetails && { - lambdaFunctionTimedOutEventDetails: (0, exports2.LambdaFunctionTimedOutEventDetailsFilterSensitiveLog)(obj.lambdaFunctionTimedOutEventDetails) - }, - ...obj.stateEnteredEventDetails && { - stateEnteredEventDetails: (0, exports2.StateEnteredEventDetailsFilterSensitiveLog)(obj.stateEnteredEventDetails) - }, - ...obj.stateExitedEventDetails && { - stateExitedEventDetails: (0, exports2.StateExitedEventDetailsFilterSensitiveLog)(obj.stateExitedEventDetails) - }, - ...obj.mapRunFailedEventDetails && { - mapRunFailedEventDetails: (0, exports2.MapRunFailedEventDetailsFilterSensitiveLog)(obj.mapRunFailedEventDetails) + return { + ...input, + region: async () => { + if (typeof region === "string") { + return getRealRegion(region); + } + const providedRegion = await region(); + return getRealRegion(providedRegion); + }, + useFipsEndpoint: async () => { + const providedRegion = typeof region === "string" ? region : await region(); + if (isFipsRegion(providedRegion)) { + return true; + } + return typeof useFipsEndpoint !== "function" ? Promise.resolve(!!useFipsEndpoint) : useFipsEndpoint(); + } + }; + }, "resolveRegionConfig"); + var getHostnameFromVariants = /* @__PURE__ */ __name((variants = [], { useFipsEndpoint, useDualstackEndpoint }) => { + var _a; + return (_a = variants.find( + ({ tags }) => useFipsEndpoint === tags.includes("fips") && useDualstackEndpoint === tags.includes("dualstack") + )) == null ? void 0 : _a.hostname; + }, "getHostnameFromVariants"); + var getResolvedHostname = /* @__PURE__ */ __name((resolvedRegion, { regionHostname, partitionHostname }) => regionHostname ? regionHostname : partitionHostname ? partitionHostname.replace("{region}", resolvedRegion) : void 0, "getResolvedHostname"); + var getResolvedPartition = /* @__PURE__ */ __name((region, { partitionHash }) => Object.keys(partitionHash || {}).find((key) => partitionHash[key].regions.includes(region)) ?? "aws", "getResolvedPartition"); + var getResolvedSigningRegion = /* @__PURE__ */ __name((hostname, { signingRegion, regionRegex, useFipsEndpoint }) => { + if (signingRegion) { + return signingRegion; + } else if (useFipsEndpoint) { + const regionRegexJs = regionRegex.replace("\\\\", "\\").replace(/^\^/g, "\\.").replace(/\$$/g, "\\."); + const regionRegexmatchArray = hostname.match(regionRegexJs); + if (regionRegexmatchArray) { + return regionRegexmatchArray[0].slice(1, -1); + } } - }); - exports2.HistoryEventFilterSensitiveLog = HistoryEventFilterSensitiveLog; - var GetExecutionHistoryOutputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.events && { events: obj.events.map((item) => (0, exports2.HistoryEventFilterSensitiveLog)(item)) } - }); - exports2.GetExecutionHistoryOutputFilterSensitiveLog = GetExecutionHistoryOutputFilterSensitiveLog; - var PublishStateMachineVersionInputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.description && { description: smithy_client_1.SENSITIVE_STRING } - }); - exports2.PublishStateMachineVersionInputFilterSensitiveLog = PublishStateMachineVersionInputFilterSensitiveLog; - var SendTaskFailureInputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.SendTaskFailureInputFilterSensitiveLog = SendTaskFailureInputFilterSensitiveLog; - var SendTaskSuccessInputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.output && { output: smithy_client_1.SENSITIVE_STRING } - }); - exports2.SendTaskSuccessInputFilterSensitiveLog = SendTaskSuccessInputFilterSensitiveLog; - var StartExecutionInputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.input && { input: smithy_client_1.SENSITIVE_STRING } - }); - exports2.StartExecutionInputFilterSensitiveLog = StartExecutionInputFilterSensitiveLog; - var StartSyncExecutionInputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.input && { input: smithy_client_1.SENSITIVE_STRING } - }); - exports2.StartSyncExecutionInputFilterSensitiveLog = StartSyncExecutionInputFilterSensitiveLog; - var StartSyncExecutionOutputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING }, - ...obj.input && { input: smithy_client_1.SENSITIVE_STRING }, - ...obj.output && { output: smithy_client_1.SENSITIVE_STRING } - }); - exports2.StartSyncExecutionOutputFilterSensitiveLog = StartSyncExecutionOutputFilterSensitiveLog; - var StopExecutionInputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.error && { error: smithy_client_1.SENSITIVE_STRING }, - ...obj.cause && { cause: smithy_client_1.SENSITIVE_STRING } - }); - exports2.StopExecutionInputFilterSensitiveLog = StopExecutionInputFilterSensitiveLog; - var UpdateStateMachineInputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.definition && { definition: smithy_client_1.SENSITIVE_STRING }, - ...obj.versionDescription && { versionDescription: smithy_client_1.SENSITIVE_STRING } - }); - exports2.UpdateStateMachineInputFilterSensitiveLog = UpdateStateMachineInputFilterSensitiveLog; - var UpdateStateMachineAliasInputFilterSensitiveLog = (obj) => ({ - ...obj, - ...obj.description && { description: smithy_client_1.SENSITIVE_STRING } - }); - exports2.UpdateStateMachineAliasInputFilterSensitiveLog = UpdateStateMachineAliasInputFilterSensitiveLog; + }, "getResolvedSigningRegion"); + var getRegionInfo = /* @__PURE__ */ __name((region, { + useFipsEndpoint = false, + useDualstackEndpoint = false, + signingService, + regionHash, + partitionHash + }) => { + var _a, _b, _c, _d, _e; + const partition = getResolvedPartition(region, { partitionHash }); + const resolvedRegion = region in regionHash ? region : ((_a = partitionHash[partition]) == null ? void 0 : _a.endpoint) ?? region; + const hostnameOptions = { useFipsEndpoint, useDualstackEndpoint }; + const regionHostname = getHostnameFromVariants((_b = regionHash[resolvedRegion]) == null ? void 0 : _b.variants, hostnameOptions); + const partitionHostname = getHostnameFromVariants((_c = partitionHash[partition]) == null ? void 0 : _c.variants, hostnameOptions); + const hostname = getResolvedHostname(resolvedRegion, { regionHostname, partitionHostname }); + if (hostname === void 0) { + throw new Error(`Endpoint resolution failed for: ${{ resolvedRegion, useFipsEndpoint, useDualstackEndpoint }}`); + } + const signingRegion = getResolvedSigningRegion(hostname, { + signingRegion: (_d = regionHash[resolvedRegion]) == null ? void 0 : _d.signingRegion, + regionRegex: partitionHash[partition].regionRegex, + useFipsEndpoint + }); + return { + partition, + signingService, + hostname, + ...signingRegion && { signingRegion }, + ...((_e = regionHash[resolvedRegion]) == null ? void 0 : _e.signingService) && { + signingService: regionHash[resolvedRegion].signingService + } + }; + }, "getRegionInfo"); } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/protocols/Aws_json1_0.js -var require_Aws_json1_0 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/protocols/Aws_json1_0.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.de_ListActivitiesCommand = exports2.de_GetExecutionHistoryCommand = exports2.de_GetActivityTaskCommand = exports2.de_DescribeStateMachineForExecutionCommand = exports2.de_DescribeStateMachineAliasCommand = exports2.de_DescribeStateMachineCommand = exports2.de_DescribeMapRunCommand = exports2.de_DescribeExecutionCommand = exports2.de_DescribeActivityCommand = exports2.de_DeleteStateMachineVersionCommand = exports2.de_DeleteStateMachineAliasCommand = exports2.de_DeleteStateMachineCommand = exports2.de_DeleteActivityCommand = exports2.de_CreateStateMachineAliasCommand = exports2.de_CreateStateMachineCommand = exports2.de_CreateActivityCommand = exports2.se_UpdateStateMachineAliasCommand = exports2.se_UpdateStateMachineCommand = exports2.se_UpdateMapRunCommand = exports2.se_UntagResourceCommand = exports2.se_TagResourceCommand = exports2.se_StopExecutionCommand = exports2.se_StartSyncExecutionCommand = exports2.se_StartExecutionCommand = exports2.se_SendTaskSuccessCommand = exports2.se_SendTaskHeartbeatCommand = exports2.se_SendTaskFailureCommand = exports2.se_PublishStateMachineVersionCommand = exports2.se_ListTagsForResourceCommand = exports2.se_ListStateMachineVersionsCommand = exports2.se_ListStateMachinesCommand = exports2.se_ListStateMachineAliasesCommand = exports2.se_ListMapRunsCommand = exports2.se_ListExecutionsCommand = exports2.se_ListActivitiesCommand = exports2.se_GetExecutionHistoryCommand = exports2.se_GetActivityTaskCommand = exports2.se_DescribeStateMachineForExecutionCommand = exports2.se_DescribeStateMachineAliasCommand = exports2.se_DescribeStateMachineCommand = exports2.se_DescribeMapRunCommand = exports2.se_DescribeExecutionCommand = exports2.se_DescribeActivityCommand = exports2.se_DeleteStateMachineVersionCommand = exports2.se_DeleteStateMachineAliasCommand = exports2.se_DeleteStateMachineCommand = exports2.se_DeleteActivityCommand = exports2.se_CreateStateMachineAliasCommand = exports2.se_CreateStateMachineCommand = exports2.se_CreateActivityCommand = void 0; - exports2.de_UpdateStateMachineAliasCommand = exports2.de_UpdateStateMachineCommand = exports2.de_UpdateMapRunCommand = exports2.de_UntagResourceCommand = exports2.de_TagResourceCommand = exports2.de_StopExecutionCommand = exports2.de_StartSyncExecutionCommand = exports2.de_StartExecutionCommand = exports2.de_SendTaskSuccessCommand = exports2.de_SendTaskHeartbeatCommand = exports2.de_SendTaskFailureCommand = exports2.de_PublishStateMachineVersionCommand = exports2.de_ListTagsForResourceCommand = exports2.de_ListStateMachineVersionsCommand = exports2.de_ListStateMachinesCommand = exports2.de_ListStateMachineAliasesCommand = exports2.de_ListMapRunsCommand = exports2.de_ListExecutionsCommand = void 0; - var protocol_http_1 = require_dist_cjs2(); - var smithy_client_1 = require_dist_cjs34(); - var models_0_1 = require_models_03(); - var SFNServiceException_1 = require_SFNServiceException(); - var se_CreateActivityCommand = async (input, context) => { - const headers = sharedHeaders("CreateActivity"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_CreateActivityCommand = se_CreateActivityCommand; - var se_CreateStateMachineCommand = async (input, context) => { - const headers = sharedHeaders("CreateStateMachine"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_CreateStateMachineCommand = se_CreateStateMachineCommand; - var se_CreateStateMachineAliasCommand = async (input, context) => { - const headers = sharedHeaders("CreateStateMachineAlias"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_CreateStateMachineAliasCommand = se_CreateStateMachineAliasCommand; - var se_DeleteActivityCommand = async (input, context) => { - const headers = sharedHeaders("DeleteActivity"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_DeleteActivityCommand = se_DeleteActivityCommand; - var se_DeleteStateMachineCommand = async (input, context) => { - const headers = sharedHeaders("DeleteStateMachine"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_DeleteStateMachineCommand = se_DeleteStateMachineCommand; - var se_DeleteStateMachineAliasCommand = async (input, context) => { - const headers = sharedHeaders("DeleteStateMachineAlias"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_DeleteStateMachineAliasCommand = se_DeleteStateMachineAliasCommand; - var se_DeleteStateMachineVersionCommand = async (input, context) => { - const headers = sharedHeaders("DeleteStateMachineVersion"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_DeleteStateMachineVersionCommand = se_DeleteStateMachineVersionCommand; - var se_DescribeActivityCommand = async (input, context) => { - const headers = sharedHeaders("DescribeActivity"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_DescribeActivityCommand = se_DescribeActivityCommand; - var se_DescribeExecutionCommand = async (input, context) => { - const headers = sharedHeaders("DescribeExecution"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_DescribeExecutionCommand = se_DescribeExecutionCommand; - var se_DescribeMapRunCommand = async (input, context) => { - const headers = sharedHeaders("DescribeMapRun"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_DescribeMapRunCommand = se_DescribeMapRunCommand; - var se_DescribeStateMachineCommand = async (input, context) => { - const headers = sharedHeaders("DescribeStateMachine"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_DescribeStateMachineCommand = se_DescribeStateMachineCommand; - var se_DescribeStateMachineAliasCommand = async (input, context) => { - const headers = sharedHeaders("DescribeStateMachineAlias"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_DescribeStateMachineAliasCommand = se_DescribeStateMachineAliasCommand; - var se_DescribeStateMachineForExecutionCommand = async (input, context) => { - const headers = sharedHeaders("DescribeStateMachineForExecution"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_DescribeStateMachineForExecutionCommand = se_DescribeStateMachineForExecutionCommand; - var se_GetActivityTaskCommand = async (input, context) => { - const headers = sharedHeaders("GetActivityTask"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_GetActivityTaskCommand = se_GetActivityTaskCommand; - var se_GetExecutionHistoryCommand = async (input, context) => { - const headers = sharedHeaders("GetExecutionHistory"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_GetExecutionHistoryCommand = se_GetExecutionHistoryCommand; - var se_ListActivitiesCommand = async (input, context) => { - const headers = sharedHeaders("ListActivities"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_ListActivitiesCommand = se_ListActivitiesCommand; - var se_ListExecutionsCommand = async (input, context) => { - const headers = sharedHeaders("ListExecutions"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_ListExecutionsCommand = se_ListExecutionsCommand; - var se_ListMapRunsCommand = async (input, context) => { - const headers = sharedHeaders("ListMapRuns"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_ListMapRunsCommand = se_ListMapRunsCommand; - var se_ListStateMachineAliasesCommand = async (input, context) => { - const headers = sharedHeaders("ListStateMachineAliases"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_ListStateMachineAliasesCommand = se_ListStateMachineAliasesCommand; - var se_ListStateMachinesCommand = async (input, context) => { - const headers = sharedHeaders("ListStateMachines"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_ListStateMachinesCommand = se_ListStateMachinesCommand; - var se_ListStateMachineVersionsCommand = async (input, context) => { - const headers = sharedHeaders("ListStateMachineVersions"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_ListStateMachineVersionsCommand = se_ListStateMachineVersionsCommand; - var se_ListTagsForResourceCommand = async (input, context) => { - const headers = sharedHeaders("ListTagsForResource"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); - }; - exports2.se_ListTagsForResourceCommand = se_ListTagsForResourceCommand; - var se_PublishStateMachineVersionCommand = async (input, context) => { - const headers = sharedHeaders("PublishStateMachineVersion"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); +// ../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/property-provider/dist-cjs/index.js +var require_dist_cjs63 = __commonJS({ + "../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/property-provider/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - exports2.se_PublishStateMachineVersionCommand = se_PublishStateMachineVersionCommand; - var se_SendTaskFailureCommand = async (input, context) => { - const headers = sharedHeaders("SendTaskFailure"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; }; - exports2.se_SendTaskFailureCommand = se_SendTaskFailureCommand; - var se_SendTaskHeartbeatCommand = async (input, context) => { - const headers = sharedHeaders("SendTaskHeartbeat"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + CredentialsProviderError: () => CredentialsProviderError, + ProviderError: () => ProviderError2, + TokenProviderError: () => TokenProviderError, + chain: () => chain, + fromStatic: () => fromStatic, + memoize: () => memoize + }); + module2.exports = __toCommonJS2(src_exports); + var _ProviderError = class _ProviderError2 extends Error { + constructor(message, options = true) { + var _a; + let logger; + let tryNextLink = true; + if (typeof options === "boolean") { + logger = void 0; + tryNextLink = options; + } else if (options != null && typeof options === "object") { + logger = options.logger; + tryNextLink = options.tryNextLink ?? true; + } + super(message); + this.name = "ProviderError"; + this.tryNextLink = tryNextLink; + Object.setPrototypeOf(this, _ProviderError2.prototype); + (_a = logger == null ? void 0 : logger.debug) == null ? void 0 : _a.call(logger, `@smithy/property-provider ${tryNextLink ? "->" : "(!)"} ${message}`); + } + /** + * @deprecated use new operator. + */ + static from(error, options = true) { + return Object.assign(new this(error.message, options), error); + } }; - exports2.se_SendTaskHeartbeatCommand = se_SendTaskHeartbeatCommand; - var se_SendTaskSuccessCommand = async (input, context) => { - const headers = sharedHeaders("SendTaskSuccess"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + __name(_ProviderError, "ProviderError"); + var ProviderError2 = _ProviderError; + var _CredentialsProviderError = class _CredentialsProviderError2 extends ProviderError2 { + /** + * @override + */ + constructor(message, options = true) { + super(message, options); + this.name = "CredentialsProviderError"; + Object.setPrototypeOf(this, _CredentialsProviderError2.prototype); + } }; - exports2.se_SendTaskSuccessCommand = se_SendTaskSuccessCommand; - var se_StartExecutionCommand = async (input, context) => { - const headers = sharedHeaders("StartExecution"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + __name(_CredentialsProviderError, "CredentialsProviderError"); + var CredentialsProviderError = _CredentialsProviderError; + var _TokenProviderError = class _TokenProviderError2 extends ProviderError2 { + /** + * @override + */ + constructor(message, options = true) { + super(message, options); + this.name = "TokenProviderError"; + Object.setPrototypeOf(this, _TokenProviderError2.prototype); + } }; - exports2.se_StartExecutionCommand = se_StartExecutionCommand; - var se_StartSyncExecutionCommand = async (input, context) => { - const headers = sharedHeaders("StartSyncExecution"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - let { hostname: resolvedHostname } = await context.endpoint(); - if (context.disableHostPrefix !== true) { - resolvedHostname = "sync-" + resolvedHostname; - if (!(0, protocol_http_1.isValidHostname)(resolvedHostname)) { - throw new Error("ValidationError: prefixed hostname must be hostname compatible."); + __name(_TokenProviderError, "TokenProviderError"); + var TokenProviderError = _TokenProviderError; + var chain = /* @__PURE__ */ __name((...providers) => async () => { + if (providers.length === 0) { + throw new ProviderError2("No providers in chain"); + } + let lastProviderError; + for (const provider of providers) { + try { + const credentials = await provider(); + return credentials; + } catch (err) { + lastProviderError = err; + if (err == null ? void 0 : err.tryNextLink) { + continue; + } + throw err; + } + } + throw lastProviderError; + }, "chain"); + var fromStatic = /* @__PURE__ */ __name((staticValue) => () => Promise.resolve(staticValue), "fromStatic"); + var memoize = /* @__PURE__ */ __name((provider, isExpired, requiresRefresh) => { + let resolved; + let pending; + let hasResult; + let isConstant = false; + const coalesceProvider = /* @__PURE__ */ __name(async () => { + if (!pending) { + pending = provider(); + } + try { + resolved = await pending; + hasResult = true; + isConstant = false; + } finally { + pending = void 0; + } + return resolved; + }, "coalesceProvider"); + if (isExpired === void 0) { + return async (options) => { + if (!hasResult || (options == null ? void 0 : options.forceRefresh)) { + resolved = await coalesceProvider(); + } + return resolved; + }; + } + return async (options) => { + if (!hasResult || (options == null ? void 0 : options.forceRefresh)) { + resolved = await coalesceProvider(); + } + if (isConstant) { + return resolved; } + if (requiresRefresh && !requiresRefresh(resolved)) { + isConstant = true; + return resolved; + } + if (isExpired(resolved)) { + await coalesceProvider(); + return resolved; + } + return resolved; + }; + }, "memoize"); + } +}); + +// ../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getHomeDir.js +var require_getHomeDir3 = __commonJS({ + "../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getHomeDir.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getHomeDir = void 0; + var os_1 = require("os"); + var path_1 = require("path"); + var homeDirCache = {}; + var getHomeDirCacheKey = () => { + if (process && process.geteuid) { + return `${process.geteuid()}`; } - return buildHttpRpcRequest(context, headers, "/", resolvedHostname, body); + return "DEFAULT"; }; - exports2.se_StartSyncExecutionCommand = se_StartSyncExecutionCommand; - var se_StopExecutionCommand = async (input, context) => { - const headers = sharedHeaders("StopExecution"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + var getHomeDir2 = () => { + const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${path_1.sep}` } = process.env; + if (HOME) + return HOME; + if (USERPROFILE) + return USERPROFILE; + if (HOMEPATH) + return `${HOMEDRIVE}${HOMEPATH}`; + const homeDirCacheKey = getHomeDirCacheKey(); + if (!homeDirCache[homeDirCacheKey]) + homeDirCache[homeDirCacheKey] = (0, os_1.homedir)(); + return homeDirCache[homeDirCacheKey]; }; - exports2.se_StopExecutionCommand = se_StopExecutionCommand; - var se_TagResourceCommand = async (input, context) => { - const headers = sharedHeaders("TagResource"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + exports2.getHomeDir = getHomeDir2; + } +}); + +// ../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFilepath.js +var require_getSSOTokenFilepath3 = __commonJS({ + "../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFilepath.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getSSOTokenFilepath = void 0; + var crypto_1 = require("crypto"); + var path_1 = require("path"); + var getHomeDir_1 = require_getHomeDir3(); + var getSSOTokenFilepath2 = (id) => { + const hasher = (0, crypto_1.createHash)("sha1"); + const cacheName = hasher.update(id).digest("hex"); + return (0, path_1.join)((0, getHomeDir_1.getHomeDir)(), ".aws", "sso", "cache", `${cacheName}.json`); }; - exports2.se_TagResourceCommand = se_TagResourceCommand; - var se_UntagResourceCommand = async (input, context) => { - const headers = sharedHeaders("UntagResource"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + exports2.getSSOTokenFilepath = getSSOTokenFilepath2; + } +}); + +// ../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFromFile.js +var require_getSSOTokenFromFile3 = __commonJS({ + "../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFromFile.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getSSOTokenFromFile = void 0; + var fs_1 = require("fs"); + var getSSOTokenFilepath_1 = require_getSSOTokenFilepath3(); + var { readFile } = fs_1.promises; + var getSSOTokenFromFile2 = async (id) => { + const ssoTokenFilepath = (0, getSSOTokenFilepath_1.getSSOTokenFilepath)(id); + const ssoTokenText = await readFile(ssoTokenFilepath, "utf8"); + return JSON.parse(ssoTokenText); }; - exports2.se_UntagResourceCommand = se_UntagResourceCommand; - var se_UpdateMapRunCommand = async (input, context) => { - const headers = sharedHeaders("UpdateMapRun"); - let body; - body = JSON.stringify(se_UpdateMapRunInput(input, context)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + exports2.getSSOTokenFromFile = getSSOTokenFromFile2; + } +}); + +// ../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/shared-ini-file-loader/dist-cjs/slurpFile.js +var require_slurpFile3 = __commonJS({ + "../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/shared-ini-file-loader/dist-cjs/slurpFile.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.slurpFile = void 0; + var fs_1 = require("fs"); + var { readFile } = fs_1.promises; + var filePromisesHash = {}; + var slurpFile = (path, options) => { + if (!filePromisesHash[path] || (options === null || options === void 0 ? void 0 : options.ignoreCache)) { + filePromisesHash[path] = readFile(path, "utf8"); + } + return filePromisesHash[path]; }; - exports2.se_UpdateMapRunCommand = se_UpdateMapRunCommand; - var se_UpdateStateMachineCommand = async (input, context) => { - const headers = sharedHeaders("UpdateStateMachine"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + exports2.slurpFile = slurpFile; + } +}); + +// ../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/shared-ini-file-loader/dist-cjs/index.js +var require_dist_cjs64 = __commonJS({ + "../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/shared-ini-file-loader/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - exports2.se_UpdateStateMachineCommand = se_UpdateStateMachineCommand; - var se_UpdateStateMachineAliasCommand = async (input, context) => { - const headers = sharedHeaders("UpdateStateMachineAlias"); - let body; - body = JSON.stringify((0, smithy_client_1._json)(input)); - return buildHttpRpcRequest(context, headers, "/", void 0, body); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; }; - exports2.se_UpdateStateMachineAliasCommand = se_UpdateStateMachineAliasCommand; - var de_CreateActivityCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_CreateActivityCommandError(output, context); + var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + CONFIG_PREFIX_SEPARATOR: () => CONFIG_PREFIX_SEPARATOR, + DEFAULT_PROFILE: () => DEFAULT_PROFILE, + ENV_PROFILE: () => ENV_PROFILE, + getProfileName: () => getProfileName, + loadSharedConfigFiles: () => loadSharedConfigFiles, + loadSsoSessionData: () => loadSsoSessionData, + parseKnownFiles: () => parseKnownFiles + }); + module2.exports = __toCommonJS2(src_exports); + __reExport(src_exports, require_getHomeDir3(), module2.exports); + var ENV_PROFILE = "AWS_PROFILE"; + var DEFAULT_PROFILE = "default"; + var getProfileName = /* @__PURE__ */ __name((init) => init.profile || process.env[ENV_PROFILE] || DEFAULT_PROFILE, "getProfileName"); + __reExport(src_exports, require_getSSOTokenFilepath3(), module2.exports); + __reExport(src_exports, require_getSSOTokenFromFile3(), module2.exports); + var import_types5 = require_dist_cjs(); + var getConfigData = /* @__PURE__ */ __name((data) => Object.entries(data).filter(([key]) => { + const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR); + if (indexOfSeparator === -1) { + return false; } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_CreateActivityOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents + return Object.values(import_types5.IniSectionType).includes(key.substring(0, indexOfSeparator)); + }).reduce( + (acc, [key, value]) => { + const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR); + const updatedKey = key.substring(0, indexOfSeparator) === import_types5.IniSectionType.PROFILE ? key.substring(indexOfSeparator + 1) : key; + acc[updatedKey] = value; + return acc; + }, + { + // Populate default profile, if present. + ...data.default && { default: data.default } + } + ), "getConfigData"); + var import_path = require("path"); + var import_getHomeDir = require_getHomeDir3(); + var ENV_CONFIG_PATH = "AWS_CONFIG_FILE"; + var getConfigFilepath = /* @__PURE__ */ __name(() => process.env[ENV_CONFIG_PATH] || (0, import_path.join)((0, import_getHomeDir.getHomeDir)(), ".aws", "config"), "getConfigFilepath"); + var import_getHomeDir2 = require_getHomeDir3(); + var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE"; + var getCredentialsFilepath = /* @__PURE__ */ __name(() => process.env[ENV_CREDENTIALS_PATH] || (0, import_path.join)((0, import_getHomeDir2.getHomeDir)(), ".aws", "credentials"), "getCredentialsFilepath"); + var import_getHomeDir3 = require_getHomeDir3(); + var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/; + var profileNameBlockList = ["__proto__", "profile __proto__"]; + var parseIni = /* @__PURE__ */ __name((iniData) => { + const map = {}; + let currentSection; + let currentSubSection; + for (const iniLine of iniData.split(/\r?\n/)) { + const trimmedLine = iniLine.split(/(^|\s)[;#]/)[0].trim(); + const isSection = trimmedLine[0] === "[" && trimmedLine[trimmedLine.length - 1] === "]"; + if (isSection) { + currentSection = void 0; + currentSubSection = void 0; + const sectionName = trimmedLine.substring(1, trimmedLine.length - 1); + const matches = prefixKeyRegex.exec(sectionName); + if (matches) { + const [, prefix, , name] = matches; + if (Object.values(import_types5.IniSectionType).includes(prefix)) { + currentSection = [prefix, name].join(CONFIG_PREFIX_SEPARATOR); + } + } else { + currentSection = sectionName; + } + if (profileNameBlockList.includes(sectionName)) { + throw new Error(`Found invalid profile name "${sectionName}"`); + } + } else if (currentSection) { + const indexOfEqualsSign = trimmedLine.indexOf("="); + if (![0, -1].includes(indexOfEqualsSign)) { + const [name, value] = [ + trimmedLine.substring(0, indexOfEqualsSign).trim(), + trimmedLine.substring(indexOfEqualsSign + 1).trim() + ]; + if (value === "") { + currentSubSection = name; + } else { + if (currentSubSection && iniLine.trimStart() === iniLine) { + currentSubSection = void 0; + } + map[currentSection] = map[currentSection] || {}; + const key = currentSubSection ? [currentSubSection, name].join(CONFIG_PREFIX_SEPARATOR) : name; + map[currentSection][key] = value; + } + } + } + } + return map; + }, "parseIni"); + var import_slurpFile = require_slurpFile3(); + var swallowError = /* @__PURE__ */ __name(() => ({}), "swallowError"); + var CONFIG_PREFIX_SEPARATOR = "."; + var loadSharedConfigFiles = /* @__PURE__ */ __name(async (init = {}) => { + const { filepath = getCredentialsFilepath(), configFilepath = getConfigFilepath() } = init; + const homeDir = (0, import_getHomeDir3.getHomeDir)(); + const relativeHomeDirPrefix = "~/"; + let resolvedFilepath = filepath; + if (filepath.startsWith(relativeHomeDirPrefix)) { + resolvedFilepath = (0, import_path.join)(homeDir, filepath.slice(2)); + } + let resolvedConfigFilepath = configFilepath; + if (configFilepath.startsWith(relativeHomeDirPrefix)) { + resolvedConfigFilepath = (0, import_path.join)(homeDir, configFilepath.slice(2)); + } + const parsedFiles = await Promise.all([ + (0, import_slurpFile.slurpFile)(resolvedConfigFilepath, { + ignoreCache: init.ignoreCache + }).then(parseIni).then(getConfigData).catch(swallowError), + (0, import_slurpFile.slurpFile)(resolvedFilepath, { + ignoreCache: init.ignoreCache + }).then(parseIni).catch(swallowError) + ]); + return { + configFile: parsedFiles[0], + credentialsFile: parsedFiles[1] }; - return response; + }, "loadSharedConfigFiles"); + var getSsoSessionData = /* @__PURE__ */ __name((data) => Object.entries(data).filter(([key]) => key.startsWith(import_types5.IniSectionType.SSO_SESSION + CONFIG_PREFIX_SEPARATOR)).reduce((acc, [key, value]) => ({ ...acc, [key.substring(key.indexOf(CONFIG_PREFIX_SEPARATOR) + 1)]: value }), {}), "getSsoSessionData"); + var import_slurpFile2 = require_slurpFile3(); + var swallowError2 = /* @__PURE__ */ __name(() => ({}), "swallowError"); + var loadSsoSessionData = /* @__PURE__ */ __name(async (init = {}) => (0, import_slurpFile2.slurpFile)(init.configFilepath ?? getConfigFilepath()).then(parseIni).then(getSsoSessionData).catch(swallowError2), "loadSsoSessionData"); + var mergeConfigFiles = /* @__PURE__ */ __name((...files) => { + const merged = {}; + for (const file of files) { + for (const [key, values] of Object.entries(file)) { + if (merged[key] !== void 0) { + Object.assign(merged[key], values); + } else { + merged[key] = values; + } + } + } + return merged; + }, "mergeConfigFiles"); + var parseKnownFiles = /* @__PURE__ */ __name(async (init) => { + const parsedFiles = await loadSharedConfigFiles(init); + return mergeConfigFiles(parsedFiles.configFile, parsedFiles.credentialsFile); + }, "parseKnownFiles"); + } +}); + +// ../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/node-config-provider/dist-cjs/index.js +var require_dist_cjs65 = __commonJS({ + "../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/node-config-provider/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - exports2.de_CreateActivityCommand = de_CreateActivityCommand; - var de_CreateActivityCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ActivityLimitExceeded": - case "com.amazonaws.sfn#ActivityLimitExceeded": - throw await de_ActivityLimitExceededRes(parsedOutput, context); - case "InvalidName": - case "com.amazonaws.sfn#InvalidName": - throw await de_InvalidNameRes(parsedOutput, context); - case "TooManyTags": - case "com.amazonaws.sfn#TooManyTags": - throw await de_TooManyTagsRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - var de_CreateStateMachineCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_CreateStateMachineCommandError(output, context); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + loadConfig: () => loadConfig + }); + module2.exports = __toCommonJS2(src_exports); + var import_property_provider2 = require_dist_cjs63(); + function getSelectorName(functionString) { + try { + const constants = new Set(Array.from(functionString.match(/([A-Z_]){3,}/g) ?? [])); + constants.delete("CONFIG"); + constants.delete("CONFIG_PREFIX_SEPARATOR"); + constants.delete("ENV"); + return [...constants].join(", "); + } catch (e) { + return functionString; } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_CreateStateMachineOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; - }; - exports2.de_CreateStateMachineCommand = de_CreateStateMachineCommand; - var de_CreateStateMachineCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ConflictException": - case "com.amazonaws.sfn#ConflictException": - throw await de_ConflictExceptionRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "InvalidDefinition": - case "com.amazonaws.sfn#InvalidDefinition": - throw await de_InvalidDefinitionRes(parsedOutput, context); - case "InvalidLoggingConfiguration": - case "com.amazonaws.sfn#InvalidLoggingConfiguration": - throw await de_InvalidLoggingConfigurationRes(parsedOutput, context); - case "InvalidName": - case "com.amazonaws.sfn#InvalidName": - throw await de_InvalidNameRes(parsedOutput, context); - case "InvalidTracingConfiguration": - case "com.amazonaws.sfn#InvalidTracingConfiguration": - throw await de_InvalidTracingConfigurationRes(parsedOutput, context); - case "StateMachineAlreadyExists": - case "com.amazonaws.sfn#StateMachineAlreadyExists": - throw await de_StateMachineAlreadyExistsRes(parsedOutput, context); - case "StateMachineDeleting": - case "com.amazonaws.sfn#StateMachineDeleting": - throw await de_StateMachineDeletingRes(parsedOutput, context); - case "StateMachineLimitExceeded": - case "com.amazonaws.sfn#StateMachineLimitExceeded": - throw await de_StateMachineLimitExceededRes(parsedOutput, context); - case "StateMachineTypeNotSupported": - case "com.amazonaws.sfn#StateMachineTypeNotSupported": - throw await de_StateMachineTypeNotSupportedRes(parsedOutput, context); - case "TooManyTags": - case "com.amazonaws.sfn#TooManyTags": - throw await de_TooManyTagsRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + } + __name(getSelectorName, "getSelectorName"); + var fromEnv = /* @__PURE__ */ __name((envVarSelector, logger) => async () => { + try { + const config = envVarSelector(process.env); + if (config === void 0) { + throw new Error(); + } + return config; + } catch (e) { + throw new import_property_provider2.CredentialsProviderError( + e.message || `Not found in ENV: ${getSelectorName(envVarSelector.toString())}`, + { logger } + ); + } + }, "fromEnv"); + var import_shared_ini_file_loader = require_dist_cjs64(); + var fromSharedConfigFiles = /* @__PURE__ */ __name((configSelector, { preferredFile = "config", ...init } = {}) => async () => { + const profile = (0, import_shared_ini_file_loader.getProfileName)(init); + const { configFile, credentialsFile } = await (0, import_shared_ini_file_loader.loadSharedConfigFiles)(init); + const profileFromCredentials = credentialsFile[profile] || {}; + const profileFromConfig = configFile[profile] || {}; + const mergedProfile = preferredFile === "config" ? { ...profileFromCredentials, ...profileFromConfig } : { ...profileFromConfig, ...profileFromCredentials }; + try { + const cfgFile = preferredFile === "config" ? configFile : credentialsFile; + const configValue = configSelector(mergedProfile, cfgFile); + if (configValue === void 0) { + throw new Error(); + } + return configValue; + } catch (e) { + throw new import_property_provider2.CredentialsProviderError( + e.message || `Not found in config files w/ profile [${profile}]: ${getSelectorName(configSelector.toString())}`, + { logger: init.logger } + ); } + }, "fromSharedConfigFiles"); + var isFunction = /* @__PURE__ */ __name((func) => typeof func === "function", "isFunction"); + var fromStatic = /* @__PURE__ */ __name((defaultValue) => isFunction(defaultValue) ? async () => await defaultValue() : (0, import_property_provider2.fromStatic)(defaultValue), "fromStatic"); + var loadConfig = /* @__PURE__ */ __name(({ environmentVariableSelector, configFileSelector, default: defaultValue }, configuration = {}) => (0, import_property_provider2.memoize)( + (0, import_property_provider2.chain)( + fromEnv(environmentVariableSelector), + fromSharedConfigFiles(configFileSelector, configuration), + fromStatic(defaultValue) + ) + ), "loadConfig"); + } +}); + +// ../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/querystring-parser/dist-cjs/index.js +var require_dist_cjs66 = __commonJS({ + "../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/querystring-parser/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var de_CreateStateMachineAliasCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_CreateStateMachineAliasCommandError(output, context); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_CreateStateMachineAliasOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; + return to; }; - exports2.de_CreateStateMachineAliasCommand = de_CreateStateMachineAliasCommand; - var de_CreateStateMachineAliasCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ConflictException": - case "com.amazonaws.sfn#ConflictException": - throw await de_ConflictExceptionRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "InvalidName": - case "com.amazonaws.sfn#InvalidName": - throw await de_InvalidNameRes(parsedOutput, context); - case "ResourceNotFound": - case "com.amazonaws.sfn#ResourceNotFound": - throw await de_ResourceNotFoundRes(parsedOutput, context); - case "ServiceQuotaExceededException": - case "com.amazonaws.sfn#ServiceQuotaExceededException": - throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context); - case "StateMachineDeleting": - case "com.amazonaws.sfn#StateMachineDeleting": - throw await de_StateMachineDeletingRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + parseQueryString: () => parseQueryString + }); + module2.exports = __toCommonJS2(src_exports); + function parseQueryString(querystring) { + const query = {}; + querystring = querystring.replace(/^\?/, ""); + if (querystring) { + for (const pair of querystring.split("&")) { + let [key, value = null] = pair.split("="); + key = decodeURIComponent(key); + if (value) { + value = decodeURIComponent(value); + } + if (!(key in query)) { + query[key] = value; + } else if (Array.isArray(query[key])) { + query[key].push(value); + } else { + query[key] = [query[key], value]; + } + } } + return query; + } + __name(parseQueryString, "parseQueryString"); + } +}); + +// ../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/url-parser/dist-cjs/index.js +var require_dist_cjs67 = __commonJS({ + "../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/url-parser/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var de_DeleteActivityCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_DeleteActivityCommandError(output, context); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = (0, smithy_client_1._json)(data); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; + return to; }; - exports2.de_DeleteActivityCommand = de_DeleteActivityCommand; - var de_DeleteActivityCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + parseUrl: () => parseUrl + }); + module2.exports = __toCommonJS2(src_exports); + var import_querystring_parser = require_dist_cjs66(); + var parseUrl = /* @__PURE__ */ __name((url2) => { + if (typeof url2 === "string") { + return parseUrl(new URL(url2)); + } + const { hostname, pathname, port, protocol, search } = url2; + let query; + if (search) { + query = (0, import_querystring_parser.parseQueryString)(search); } + return { + hostname, + port: port ? parseInt(port) : void 0, + protocol, + path: pathname, + query + }; + }, "parseUrl"); + } +}); + +// ../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/credential-provider-imds/dist-cjs/index.js +var require_dist_cjs68 = __commonJS({ + "../../../node_modules/@smithy/util-defaults-mode-node/node_modules/@smithy/credential-provider-imds/dist-cjs/index.js"(exports2, module2) { + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var de_DeleteStateMachineCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_DeleteStateMachineCommandError(output, context); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = (0, smithy_client_1._json)(data); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; + return to; }; - exports2.de_DeleteStateMachineCommand = de_DeleteStateMachineCommand; - var de_DeleteStateMachineCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + DEFAULT_MAX_RETRIES: () => DEFAULT_MAX_RETRIES, + DEFAULT_TIMEOUT: () => DEFAULT_TIMEOUT, + ENV_CMDS_AUTH_TOKEN: () => ENV_CMDS_AUTH_TOKEN, + ENV_CMDS_FULL_URI: () => ENV_CMDS_FULL_URI, + ENV_CMDS_RELATIVE_URI: () => ENV_CMDS_RELATIVE_URI, + Endpoint: () => Endpoint, + fromContainerMetadata: () => fromContainerMetadata, + fromInstanceMetadata: () => fromInstanceMetadata, + getInstanceMetadataEndpoint: () => getInstanceMetadataEndpoint, + httpRequest: () => httpRequest, + providerConfigFromInit: () => providerConfigFromInit + }); + module2.exports = __toCommonJS2(src_exports); + var import_url = require("url"); + var import_property_provider2 = require_dist_cjs63(); + var import_buffer = require("buffer"); + var import_http2 = require("http"); + function httpRequest(options) { + return new Promise((resolve, reject) => { + var _a; + const req = (0, import_http2.request)({ + method: "GET", + ...options, + // Node.js http module doesn't accept hostname with square brackets + // Refs: https://github.com/nodejs/node/issues/39738 + hostname: (_a = options.hostname) == null ? void 0 : _a.replace(/^\[(.+)\]$/, "$1") + }); + req.on("error", (err) => { + reject(Object.assign(new import_property_provider2.ProviderError("Unable to connect to instance metadata service"), err)); + req.destroy(); + }); + req.on("timeout", () => { + reject(new import_property_provider2.ProviderError("TimeoutError from instance metadata service")); + req.destroy(); + }); + req.on("response", (res) => { + const { statusCode = 400 } = res; + if (statusCode < 200 || 300 <= statusCode) { + reject( + Object.assign(new import_property_provider2.ProviderError("Error response received from instance metadata service"), { statusCode }) + ); + req.destroy(); + } + const chunks = []; + res.on("data", (chunk) => { + chunks.push(chunk); }); + res.on("end", () => { + resolve(import_buffer.Buffer.concat(chunks)); + req.destroy(); + }); + }); + req.end(); + }); + } + __name(httpRequest, "httpRequest"); + var isImdsCredentials = /* @__PURE__ */ __name((arg) => Boolean(arg) && typeof arg === "object" && typeof arg.AccessKeyId === "string" && typeof arg.SecretAccessKey === "string" && typeof arg.Token === "string" && typeof arg.Expiration === "string", "isImdsCredentials"); + var fromImdsCredentials = /* @__PURE__ */ __name((creds) => ({ + accessKeyId: creds.AccessKeyId, + secretAccessKey: creds.SecretAccessKey, + sessionToken: creds.Token, + expiration: new Date(creds.Expiration), + ...creds.AccountId && { accountId: creds.AccountId } + }), "fromImdsCredentials"); + var DEFAULT_TIMEOUT = 1e3; + var DEFAULT_MAX_RETRIES = 0; + var providerConfigFromInit = /* @__PURE__ */ __name(({ + maxRetries = DEFAULT_MAX_RETRIES, + timeout = DEFAULT_TIMEOUT + }) => ({ maxRetries, timeout }), "providerConfigFromInit"); + var retry = /* @__PURE__ */ __name((toRetry, maxRetries) => { + let promise = toRetry(); + for (let i = 0; i < maxRetries; i++) { + promise = promise.catch(toRetry); } - }; - var de_DeleteStateMachineAliasCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_DeleteStateMachineAliasCommandError(output, context); - } - const data = await parseBody(output.body, context); - let contents = {}; - contents = (0, smithy_client_1._json)(data); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; - }; - exports2.de_DeleteStateMachineAliasCommand = de_DeleteStateMachineAliasCommand; - var de_DeleteStateMachineAliasCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ConflictException": - case "com.amazonaws.sfn#ConflictException": - throw await de_ConflictExceptionRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "ResourceNotFound": - case "com.amazonaws.sfn#ResourceNotFound": - throw await de_ResourceNotFoundRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode + return promise; + }, "retry"); + var ENV_CMDS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI"; + var ENV_CMDS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"; + var ENV_CMDS_AUTH_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN"; + var fromContainerMetadata = /* @__PURE__ */ __name((init = {}) => { + const { timeout, maxRetries } = providerConfigFromInit(init); + return () => retry(async () => { + const requestOptions = await getCmdsUri({ logger: init.logger }); + const credsResponse = JSON.parse(await requestFromEcsImds(timeout, requestOptions)); + if (!isImdsCredentials(credsResponse)) { + throw new import_property_provider2.CredentialsProviderError("Invalid response received from instance metadata service.", { + logger: init.logger }); + } + return fromImdsCredentials(credsResponse); + }, maxRetries); + }, "fromContainerMetadata"); + var requestFromEcsImds = /* @__PURE__ */ __name(async (timeout, options) => { + if (process.env[ENV_CMDS_AUTH_TOKEN]) { + options.headers = { + ...options.headers, + Authorization: process.env[ENV_CMDS_AUTH_TOKEN] + }; } + const buffer = await httpRequest({ + ...options, + timeout + }); + return buffer.toString(); + }, "requestFromEcsImds"); + var CMDS_IP = "169.254.170.2"; + var GREENGRASS_HOSTS = { + localhost: true, + "127.0.0.1": true }; - var de_DeleteStateMachineVersionCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_DeleteStateMachineVersionCommandError(output, context); - } - const data = await parseBody(output.body, context); - let contents = {}; - contents = (0, smithy_client_1._json)(data); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; + var GREENGRASS_PROTOCOLS = { + "http:": true, + "https:": true }; - exports2.de_DeleteStateMachineVersionCommand = de_DeleteStateMachineVersionCommand; - var de_DeleteStateMachineVersionCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ConflictException": - case "com.amazonaws.sfn#ConflictException": - throw await de_ConflictExceptionRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode + var getCmdsUri = /* @__PURE__ */ __name(async ({ logger }) => { + if (process.env[ENV_CMDS_RELATIVE_URI]) { + return { + hostname: CMDS_IP, + path: process.env[ENV_CMDS_RELATIVE_URI] + }; + } + if (process.env[ENV_CMDS_FULL_URI]) { + const parsed = (0, import_url.parse)(process.env[ENV_CMDS_FULL_URI]); + if (!parsed.hostname || !(parsed.hostname in GREENGRASS_HOSTS)) { + throw new import_property_provider2.CredentialsProviderError(`${parsed.hostname} is not a valid container metadata service hostname`, { + tryNextLink: false, + logger + }); + } + if (!parsed.protocol || !(parsed.protocol in GREENGRASS_PROTOCOLS)) { + throw new import_property_provider2.CredentialsProviderError(`${parsed.protocol} is not a valid container metadata service protocol`, { + tryNextLink: false, + logger }); + } + return { + ...parsed, + port: parsed.port ? parseInt(parsed.port, 10) : void 0 + }; + } + throw new import_property_provider2.CredentialsProviderError( + `The container metadata credential provider cannot be used unless the ${ENV_CMDS_RELATIVE_URI} or ${ENV_CMDS_FULL_URI} environment variable is set`, + { + tryNextLink: false, + logger + } + ); + }, "getCmdsUri"); + var _InstanceMetadataV1FallbackError = class _InstanceMetadataV1FallbackError2 extends import_property_provider2.CredentialsProviderError { + constructor(message, tryNextLink = true) { + super(message, tryNextLink); + this.tryNextLink = tryNextLink; + this.name = "InstanceMetadataV1FallbackError"; + Object.setPrototypeOf(this, _InstanceMetadataV1FallbackError2.prototype); } }; - var de_DescribeActivityCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_DescribeActivityCommandError(output, context); + __name(_InstanceMetadataV1FallbackError, "InstanceMetadataV1FallbackError"); + var InstanceMetadataV1FallbackError = _InstanceMetadataV1FallbackError; + var import_node_config_provider = require_dist_cjs65(); + var import_url_parser = require_dist_cjs67(); + var Endpoint = /* @__PURE__ */ ((Endpoint2) => { + Endpoint2["IPv4"] = "http://169.254.169.254"; + Endpoint2["IPv6"] = "http://[fd00:ec2::254]"; + return Endpoint2; + })(Endpoint || {}); + var ENV_ENDPOINT_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT"; + var CONFIG_ENDPOINT_NAME = "ec2_metadata_service_endpoint"; + var ENDPOINT_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => env[ENV_ENDPOINT_NAME], + configFileSelector: (profile) => profile[CONFIG_ENDPOINT_NAME], + default: void 0 + }; + var EndpointMode = /* @__PURE__ */ ((EndpointMode2) => { + EndpointMode2["IPv4"] = "IPv4"; + EndpointMode2["IPv6"] = "IPv6"; + return EndpointMode2; + })(EndpointMode || {}); + var ENV_ENDPOINT_MODE_NAME = "AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE"; + var CONFIG_ENDPOINT_MODE_NAME = "ec2_metadata_service_endpoint_mode"; + var ENDPOINT_MODE_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => env[ENV_ENDPOINT_MODE_NAME], + configFileSelector: (profile) => profile[CONFIG_ENDPOINT_MODE_NAME], + default: "IPv4" + /* IPv4 */ + }; + var getInstanceMetadataEndpoint = /* @__PURE__ */ __name(async () => (0, import_url_parser.parseUrl)(await getFromEndpointConfig() || await getFromEndpointModeConfig()), "getInstanceMetadataEndpoint"); + var getFromEndpointConfig = /* @__PURE__ */ __name(async () => (0, import_node_config_provider.loadConfig)(ENDPOINT_CONFIG_OPTIONS)(), "getFromEndpointConfig"); + var getFromEndpointModeConfig = /* @__PURE__ */ __name(async () => { + const endpointMode = await (0, import_node_config_provider.loadConfig)(ENDPOINT_MODE_CONFIG_OPTIONS)(); + switch (endpointMode) { + case "IPv4": + return "http://169.254.169.254"; + case "IPv6": + return "http://[fd00:ec2::254]"; + default: + throw new Error(`Unsupported endpoint mode: ${endpointMode}. Select from ${Object.values(EndpointMode)}`); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_DescribeActivityOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents + }, "getFromEndpointModeConfig"); + var STATIC_STABILITY_REFRESH_INTERVAL_SECONDS = 5 * 60; + var STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS = 5 * 60; + var STATIC_STABILITY_DOC_URL = "https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html"; + var getExtendedInstanceMetadataCredentials = /* @__PURE__ */ __name((credentials, logger) => { + const refreshInterval = STATIC_STABILITY_REFRESH_INTERVAL_SECONDS + Math.floor(Math.random() * STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS); + const newExpiration = new Date(Date.now() + refreshInterval * 1e3); + logger.warn( + `Attempting credential expiration extension due to a credential service availability issue. A refresh of these credentials will be attempted after ${new Date(newExpiration)}. +For more information, please visit: ` + STATIC_STABILITY_DOC_URL + ); + const originalExpiration = credentials.originalExpiration ?? credentials.expiration; + return { + ...credentials, + ...originalExpiration ? { originalExpiration } : {}, + expiration: newExpiration }; - return response; - }; - exports2.de_DescribeActivityCommand = de_DescribeActivityCommand; - var de_DescribeActivityCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) + }, "getExtendedInstanceMetadataCredentials"); + var staticStabilityProvider = /* @__PURE__ */ __name((provider, options = {}) => { + const logger = (options == null ? void 0 : options.logger) || console; + let pastCredentials; + return async () => { + let credentials; + try { + credentials = await provider(); + if (credentials.expiration && credentials.expiration.getTime() < Date.now()) { + credentials = getExtendedInstanceMetadataCredentials(credentials, logger); + } + } catch (e) { + if (pastCredentials) { + logger.warn("Credential renew failed: ", e); + credentials = getExtendedInstanceMetadataCredentials(pastCredentials, logger); + } else { + throw e; + } + } + pastCredentials = credentials; + return credentials; }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ActivityDoesNotExist": - case "com.amazonaws.sfn#ActivityDoesNotExist": - throw await de_ActivityDoesNotExistRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode + }, "staticStabilityProvider"); + var IMDS_PATH = "/latest/meta-data/iam/security-credentials/"; + var IMDS_TOKEN_PATH = "/latest/api/token"; + var AWS_EC2_METADATA_V1_DISABLED = "AWS_EC2_METADATA_V1_DISABLED"; + var PROFILE_AWS_EC2_METADATA_V1_DISABLED = "ec2_metadata_v1_disabled"; + var X_AWS_EC2_METADATA_TOKEN = "x-aws-ec2-metadata-token"; + var fromInstanceMetadata = /* @__PURE__ */ __name((init = {}) => staticStabilityProvider(getInstanceMetadataProvider(init), { logger: init.logger }), "fromInstanceMetadata"); + var getInstanceMetadataProvider = /* @__PURE__ */ __name((init = {}) => { + let disableFetchToken = false; + const { logger, profile } = init; + const { timeout, maxRetries } = providerConfigFromInit(init); + const getCredentials = /* @__PURE__ */ __name(async (maxRetries2, options) => { + var _a; + const isImdsV1Fallback = disableFetchToken || ((_a = options.headers) == null ? void 0 : _a[X_AWS_EC2_METADATA_TOKEN]) == null; + if (isImdsV1Fallback) { + let fallbackBlockedFromProfile = false; + let fallbackBlockedFromProcessEnv = false; + const configValue = await (0, import_node_config_provider.loadConfig)( + { + environmentVariableSelector: (env) => { + const envValue = env[AWS_EC2_METADATA_V1_DISABLED]; + fallbackBlockedFromProcessEnv = !!envValue && envValue !== "false"; + if (envValue === void 0) { + throw new import_property_provider2.CredentialsProviderError( + `${AWS_EC2_METADATA_V1_DISABLED} not set in env, checking config file next.`, + { logger: init.logger } + ); + } + return fallbackBlockedFromProcessEnv; + }, + configFileSelector: (profile2) => { + const profileValue = profile2[PROFILE_AWS_EC2_METADATA_V1_DISABLED]; + fallbackBlockedFromProfile = !!profileValue && profileValue !== "false"; + return fallbackBlockedFromProfile; + }, + default: false + }, + { + profile + } + )(); + if (init.ec2MetadataV1Disabled || configValue) { + const causes = []; + if (init.ec2MetadataV1Disabled) + causes.push("credential provider initialization (runtime option ec2MetadataV1Disabled)"); + if (fallbackBlockedFromProfile) + causes.push(`config file profile (${PROFILE_AWS_EC2_METADATA_V1_DISABLED})`); + if (fallbackBlockedFromProcessEnv) + causes.push(`process environment variable (${AWS_EC2_METADATA_V1_DISABLED})`); + throw new InstanceMetadataV1FallbackError( + `AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${causes.join( + ", " + )}].` + ); + } + } + const imdsProfile = (await retry(async () => { + let profile2; + try { + profile2 = await getProfile(options); + } catch (err) { + if (err.statusCode === 401) { + disableFetchToken = false; + } + throw err; + } + return profile2; + }, maxRetries2)).trim(); + return retry(async () => { + let creds; + try { + creds = await getCredentialsFromProfile(imdsProfile, options, init); + } catch (err) { + if (err.statusCode === 401) { + disableFetchToken = false; + } + throw err; + } + return creds; + }, maxRetries2); + }, "getCredentials"); + return async () => { + const endpoint = await getInstanceMetadataEndpoint(); + if (disableFetchToken) { + logger == null ? void 0 : logger.debug("AWS SDK Instance Metadata", "using v1 fallback (no token fetch)"); + return getCredentials(maxRetries, { ...endpoint, timeout }); + } else { + let token; + try { + token = (await getMetadataToken({ ...endpoint, timeout })).toString(); + } catch (error) { + if ((error == null ? void 0 : error.statusCode) === 400) { + throw Object.assign(error, { + message: "EC2 Metadata token request returned error" + }); + } else if (error.message === "TimeoutError" || [403, 404, 405].includes(error.statusCode)) { + disableFetchToken = true; + } + logger == null ? void 0 : logger.debug("AWS SDK Instance Metadata", "using v1 fallback (initial)"); + return getCredentials(maxRetries, { ...endpoint, timeout }); + } + return getCredentials(maxRetries, { + ...endpoint, + headers: { + [X_AWS_EC2_METADATA_TOKEN]: token + }, + timeout }); + } + }; + }, "getInstanceMetadataProvider"); + var getMetadataToken = /* @__PURE__ */ __name(async (options) => httpRequest({ + ...options, + path: IMDS_TOKEN_PATH, + method: "PUT", + headers: { + "x-aws-ec2-metadata-token-ttl-seconds": "21600" + } + }), "getMetadataToken"); + var getProfile = /* @__PURE__ */ __name(async (options) => (await httpRequest({ ...options, path: IMDS_PATH })).toString(), "getProfile"); + var getCredentialsFromProfile = /* @__PURE__ */ __name(async (profile, options, init) => { + const credentialsResponse = JSON.parse( + (await httpRequest({ + ...options, + path: IMDS_PATH + profile + })).toString() + ); + if (!isImdsCredentials(credentialsResponse)) { + throw new import_property_provider2.CredentialsProviderError("Invalid response received from instance metadata service.", { + logger: init.logger + }); } + return fromImdsCredentials(credentialsResponse); + }, "getCredentialsFromProfile"); + } +}); + +// ../../../node_modules/@smithy/util-defaults-mode-node/dist-cjs/index.js +var require_dist_cjs69 = __commonJS({ + "../../../node_modules/@smithy/util-defaults-mode-node/dist-cjs/index.js"(exports2, module2) { + var __create2 = Object.create; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __getProtoOf2 = Object.getPrototypeOf; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var de_DescribeExecutionCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_DescribeExecutionCommandError(output, context); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_DescribeExecutionOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; + return to; }; - exports2.de_DescribeExecutionCommand = de_DescribeExecutionCommand; - var de_DescribeExecutionCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ExecutionDoesNotExist": - case "com.amazonaws.sfn#ExecutionDoesNotExist": - throw await de_ExecutionDoesNotExistRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); + var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, + mod + )); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + resolveDefaultsModeConfig: () => resolveDefaultsModeConfig + }); + module2.exports = __toCommonJS2(src_exports); + var import_config_resolver = require_dist_cjs62(); + var import_node_config_provider = require_dist_cjs65(); + var import_property_provider2 = require_dist_cjs63(); + var AWS_EXECUTION_ENV = "AWS_EXECUTION_ENV"; + var AWS_REGION_ENV = "AWS_REGION"; + var AWS_DEFAULT_REGION_ENV = "AWS_DEFAULT_REGION"; + var ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED"; + var DEFAULTS_MODE_OPTIONS = ["in-region", "cross-region", "mobile", "standard", "legacy"]; + var IMDS_REGION_PATH = "/latest/meta-data/placement/region"; + var AWS_DEFAULTS_MODE_ENV = "AWS_DEFAULTS_MODE"; + var AWS_DEFAULTS_MODE_CONFIG = "defaults_mode"; + var NODE_DEFAULTS_MODE_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => { + return env[AWS_DEFAULTS_MODE_ENV]; + }, + configFileSelector: (profile) => { + return profile[AWS_DEFAULTS_MODE_CONFIG]; + }, + default: "legacy" + }; + var resolveDefaultsModeConfig = /* @__PURE__ */ __name(({ + region = (0, import_node_config_provider.loadConfig)(import_config_resolver.NODE_REGION_CONFIG_OPTIONS), + defaultsMode = (0, import_node_config_provider.loadConfig)(NODE_DEFAULTS_MODE_CONFIG_OPTIONS) + } = {}) => (0, import_property_provider2.memoize)(async () => { + const mode = typeof defaultsMode === "function" ? await defaultsMode() : defaultsMode; + switch (mode == null ? void 0 : mode.toLowerCase()) { + case "auto": + return resolveNodeDefaultsModeAuto(region); + case "in-region": + case "cross-region": + case "mobile": + case "standard": + case "legacy": + return Promise.resolve(mode == null ? void 0 : mode.toLocaleLowerCase()); + case void 0: + return Promise.resolve("legacy"); default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + throw new Error( + `Invalid parameter for "defaultsMode", expect ${DEFAULTS_MODE_OPTIONS.join(", ")}, got ${mode}` + ); } - }; - var de_DescribeMapRunCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_DescribeMapRunCommandError(output, context); + }), "resolveDefaultsModeConfig"); + var resolveNodeDefaultsModeAuto = /* @__PURE__ */ __name(async (clientRegion) => { + if (clientRegion) { + const resolvedRegion = typeof clientRegion === "function" ? await clientRegion() : clientRegion; + const inferredRegion = await inferPhysicalRegion(); + if (!inferredRegion) { + return "standard"; + } + if (resolvedRegion === inferredRegion) { + return "in-region"; + } else { + return "cross-region"; + } } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_DescribeMapRunOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; - }; - exports2.de_DescribeMapRunCommand = de_DescribeMapRunCommand; - var de_DescribeMapRunCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "ResourceNotFound": - case "com.amazonaws.sfn#ResourceNotFound": - throw await de_ResourceNotFoundRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + return "standard"; + }, "resolveNodeDefaultsModeAuto"); + var inferPhysicalRegion = /* @__PURE__ */ __name(async () => { + if (process.env[AWS_EXECUTION_ENV] && (process.env[AWS_REGION_ENV] || process.env[AWS_DEFAULT_REGION_ENV])) { + return process.env[AWS_REGION_ENV] ?? process.env[AWS_DEFAULT_REGION_ENV]; } - }; - var de_DescribeStateMachineCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_DescribeStateMachineCommandError(output, context); + if (!process.env[ENV_IMDS_DISABLED]) { + try { + const { getInstanceMetadataEndpoint, httpRequest } = await Promise.resolve().then(() => __toESM2(require_dist_cjs68())); + const endpoint = await getInstanceMetadataEndpoint(); + return (await httpRequest({ ...endpoint, path: IMDS_REGION_PATH })).toString(); + } catch (e) { + } } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_DescribeStateMachineOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents + }, "inferPhysicalRegion"); + } +}); + +// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/runtimeConfig.js +var require_runtimeConfig = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso/dist-cjs/runtimeConfig.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getRuntimeConfig = void 0; + var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); + var package_json_1 = tslib_1.__importDefault(require_package2()); + var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var util_user_agent_node_1 = require_dist_cjs56(); + var config_resolver_1 = require_dist_cjs11(); + var hash_node_1 = require_dist_cjs57(); + var middleware_retry_1 = require_dist_cjs38(); + var node_config_provider_1 = require_dist_cjs42(); + var node_http_handler_1 = require_dist_cjs51(); + var util_body_length_node_1 = require_dist_cjs58(); + var util_retry_1 = require_dist_cjs60(); + var runtimeConfig_shared_1 = require_runtimeConfig_shared(); + var smithy_client_1 = require_dist_cjs37(); + var util_defaults_mode_node_1 = require_dist_cjs69(); + var smithy_client_2 = require_dist_cjs37(); + var getRuntimeConfig = (config) => { + (0, smithy_client_2.emitWarningIfUnsupportedVersion)(process.version); + const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config); + const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode); + const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config); + (0, core_1.emitWarningIfUnsupportedVersion)(process.version); + return { + ...clientSharedValues, + ...config, + runtime: "node", + defaultsMode, + bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength, + defaultUserAgentProvider: config?.defaultUserAgentProvider ?? (0, util_user_agent_node_1.defaultUserAgent)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }), + maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config?.region ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_REGION_CONFIG_OPTIONS, config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: node_http_handler_1.NodeHttpHandler.create(config?.requestHandler ?? defaultConfigProvider), + retryMode: config?.retryMode ?? (0, node_config_provider_1.loadConfig)({ + ...middleware_retry_1.NODE_RETRY_MODE_CONFIG_OPTIONS, + default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE + }), + sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, "sha256"), + streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector, + useDualstackEndpoint: config?.useDualstackEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), + useFipsEndpoint: config?.useFipsEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS) }; - return response; }; - exports2.de_DescribeStateMachineCommand = de_DescribeStateMachineCommand; - var de_DescribeStateMachineCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "StateMachineDoesNotExist": - case "com.amazonaws.sfn#StateMachineDoesNotExist": - throw await de_StateMachineDoesNotExistRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); - } + exports2.getRuntimeConfig = getRuntimeConfig; + } +}); + +// ../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/index.js +var require_dist_cjs70 = __commonJS({ + "../../../node_modules/@aws-sdk/region-config-resolver/dist-cjs/index.js"(exports2, module2) { + "use strict"; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var de_DescribeStateMachineAliasCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_DescribeStateMachineAliasCommandError(output, context); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_DescribeStateMachineAliasOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; + return to; }; - exports2.de_DescribeStateMachineAliasCommand = de_DescribeStateMachineAliasCommand; - var de_DescribeStateMachineAliasCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + NODE_REGION_CONFIG_FILE_OPTIONS: () => NODE_REGION_CONFIG_FILE_OPTIONS, + NODE_REGION_CONFIG_OPTIONS: () => NODE_REGION_CONFIG_OPTIONS, + REGION_ENV_NAME: () => REGION_ENV_NAME, + REGION_INI_NAME: () => REGION_INI_NAME, + getAwsRegionExtensionConfiguration: () => getAwsRegionExtensionConfiguration, + resolveAwsRegionExtensionConfiguration: () => resolveAwsRegionExtensionConfiguration, + resolveRegionConfig: () => resolveRegionConfig + }); + module2.exports = __toCommonJS2(src_exports); + var getAwsRegionExtensionConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { + let runtimeConfigRegion = /* @__PURE__ */ __name(async () => { + if (runtimeConfig.region === void 0) { + throw new Error("Region is missing from runtimeConfig"); + } + const region = runtimeConfig.region; + if (typeof region === "string") { + return region; + } + return region(); + }, "runtimeConfigRegion"); + return { + setRegion(region) { + runtimeConfigRegion = region; + }, + region() { + return runtimeConfigRegion; + } }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "ResourceNotFound": - case "com.amazonaws.sfn#ResourceNotFound": - throw await de_ResourceNotFoundRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + }, "getAwsRegionExtensionConfiguration"); + var resolveAwsRegionExtensionConfiguration = /* @__PURE__ */ __name((awsRegionExtensionConfiguration) => { + return { + region: awsRegionExtensionConfiguration.region() + }; + }, "resolveAwsRegionExtensionConfiguration"); + var REGION_ENV_NAME = "AWS_REGION"; + var REGION_INI_NAME = "region"; + var NODE_REGION_CONFIG_OPTIONS = { + environmentVariableSelector: (env) => env[REGION_ENV_NAME], + configFileSelector: (profile) => profile[REGION_INI_NAME], + default: () => { + throw new Error("Region is missing"); } }; - var de_DescribeStateMachineForExecutionCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_DescribeStateMachineForExecutionCommandError(output, context); + var NODE_REGION_CONFIG_FILE_OPTIONS = { + preferredFile: "credentials" + }; + var isFipsRegion = /* @__PURE__ */ __name((region) => typeof region === "string" && (region.startsWith("fips-") || region.endsWith("-fips")), "isFipsRegion"); + var getRealRegion = /* @__PURE__ */ __name((region) => isFipsRegion(region) ? ["fips-aws-global", "aws-fips"].includes(region) ? "us-east-1" : region.replace(/fips-(dkr-|prod-)?|-fips/, "") : region, "getRealRegion"); + var resolveRegionConfig = /* @__PURE__ */ __name((input) => { + const { region, useFipsEndpoint } = input; + if (!region) { + throw new Error("Region is missing"); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_DescribeStateMachineForExecutionOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents + return { + ...input, + region: async () => { + if (typeof region === "string") { + return getRealRegion(region); + } + const providedRegion = await region(); + return getRealRegion(providedRegion); + }, + useFipsEndpoint: async () => { + const providedRegion = typeof region === "string" ? region : await region(); + if (isFipsRegion(providedRegion)) { + return true; + } + return typeof useFipsEndpoint !== "function" ? Promise.resolve(!!useFipsEndpoint) : useFipsEndpoint(); + } }; - return response; + }, "resolveRegionConfig"); + } +}); + +// ../../../node_modules/@aws-sdk/client-sso/dist-cjs/index.js +var require_dist_cjs71 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso/dist-cjs/index.js"(exports2, module2) { + "use strict"; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - exports2.de_DescribeStateMachineForExecutionCommand = de_DescribeStateMachineForExecutionCommand; - var de_DescribeStateMachineForExecutionCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ExecutionDoesNotExist": - case "com.amazonaws.sfn#ExecutionDoesNotExist": - throw await de_ExecutionDoesNotExistRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - var de_GetActivityTaskCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_GetActivityTaskCommandError(output, context); - } - const data = await parseBody(output.body, context); - let contents = {}; - contents = (0, smithy_client_1._json)(data); - const response = { - $metadata: deserializeMetadata(output), - ...contents + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + GetRoleCredentialsCommand: () => GetRoleCredentialsCommand, + GetRoleCredentialsRequestFilterSensitiveLog: () => GetRoleCredentialsRequestFilterSensitiveLog, + GetRoleCredentialsResponseFilterSensitiveLog: () => GetRoleCredentialsResponseFilterSensitiveLog, + InvalidRequestException: () => InvalidRequestException, + ListAccountRolesCommand: () => ListAccountRolesCommand, + ListAccountRolesRequestFilterSensitiveLog: () => ListAccountRolesRequestFilterSensitiveLog, + ListAccountsCommand: () => ListAccountsCommand, + ListAccountsRequestFilterSensitiveLog: () => ListAccountsRequestFilterSensitiveLog, + LogoutCommand: () => LogoutCommand, + LogoutRequestFilterSensitiveLog: () => LogoutRequestFilterSensitiveLog, + ResourceNotFoundException: () => ResourceNotFoundException, + RoleCredentialsFilterSensitiveLog: () => RoleCredentialsFilterSensitiveLog, + SSO: () => SSO, + SSOClient: () => SSOClient, + SSOServiceException: () => SSOServiceException, + TooManyRequestsException: () => TooManyRequestsException, + UnauthorizedException: () => UnauthorizedException, + __Client: () => import_smithy_client5.Client, + paginateListAccountRoles: () => paginateListAccountRoles, + paginateListAccounts: () => paginateListAccounts + }); + module2.exports = __toCommonJS2(src_exports); + var import_middleware_host_header = require_dist_cjs3(); + var import_middleware_logger = require_dist_cjs4(); + var import_middleware_recursion_detection = require_dist_cjs5(); + var import_middleware_user_agent = require_dist_cjs8(); + var import_config_resolver = require_dist_cjs11(); + var import_core3 = (init_dist_es(), __toCommonJS(dist_es_exports)); + var import_middleware_content_length = require_dist_cjs39(); + var import_middleware_endpoint2 = require_dist_cjs46(); + var import_middleware_retry2 = require_dist_cjs38(); + var import_httpAuthSchemeProvider = require_httpAuthSchemeProvider2(); + var resolveClientEndpointParameters = /* @__PURE__ */ __name((options) => { + return { + ...options, + useDualstackEndpoint: options.useDualstackEndpoint ?? false, + useFipsEndpoint: options.useFipsEndpoint ?? false, + defaultSigningName: "awsssoportal" }; - return response; - }; - exports2.de_GetActivityTaskCommand = de_GetActivityTaskCommand; - var de_GetActivityTaskCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) + }, "resolveClientEndpointParameters"); + var commonParams = { + UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, + Endpoint: { type: "builtInParams", name: "endpoint" }, + Region: { type: "builtInParams", name: "region" }, + UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } + }; + var import_runtimeConfig = require_runtimeConfig(); + var import_region_config_resolver = require_dist_cjs70(); + var import_protocol_http8 = require_dist_cjs2(); + var import_smithy_client5 = require_dist_cjs37(); + var getHttpAuthExtensionConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { + const _httpAuthSchemes = runtimeConfig.httpAuthSchemes; + let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider; + let _credentials = runtimeConfig.credentials; + return { + setHttpAuthScheme(httpAuthScheme) { + const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId); + if (index === -1) { + _httpAuthSchemes.push(httpAuthScheme); + } else { + _httpAuthSchemes.splice(index, 1, httpAuthScheme); + } + }, + httpAuthSchemes() { + return _httpAuthSchemes; + }, + setHttpAuthSchemeProvider(httpAuthSchemeProvider) { + _httpAuthSchemeProvider = httpAuthSchemeProvider; + }, + httpAuthSchemeProvider() { + return _httpAuthSchemeProvider; + }, + setCredentials(credentials) { + _credentials = credentials; + }, + credentials() { + return _credentials; + } }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ActivityDoesNotExist": - case "com.amazonaws.sfn#ActivityDoesNotExist": - throw await de_ActivityDoesNotExistRes(parsedOutput, context); - case "ActivityWorkerLimitExceeded": - case "com.amazonaws.sfn#ActivityWorkerLimitExceeded": - throw await de_ActivityWorkerLimitExceededRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + }, "getHttpAuthExtensionConfiguration"); + var resolveHttpAuthRuntimeConfig = /* @__PURE__ */ __name((config) => { + return { + httpAuthSchemes: config.httpAuthSchemes(), + httpAuthSchemeProvider: config.httpAuthSchemeProvider(), + credentials: config.credentials() + }; + }, "resolveHttpAuthRuntimeConfig"); + var asPartial = /* @__PURE__ */ __name((t) => t, "asPartial"); + var resolveRuntimeExtensions = /* @__PURE__ */ __name((runtimeConfig, extensions) => { + const extensionConfiguration = { + ...asPartial((0, import_region_config_resolver.getAwsRegionExtensionConfiguration)(runtimeConfig)), + ...asPartial((0, import_smithy_client5.getDefaultExtensionConfiguration)(runtimeConfig)), + ...asPartial((0, import_protocol_http8.getHttpHandlerExtensionConfiguration)(runtimeConfig)), + ...asPartial(getHttpAuthExtensionConfiguration(runtimeConfig)) + }; + extensions.forEach((extension) => extension.configure(extensionConfiguration)); + return { + ...runtimeConfig, + ...(0, import_region_config_resolver.resolveAwsRegionExtensionConfiguration)(extensionConfiguration), + ...(0, import_smithy_client5.resolveDefaultRuntimeConfig)(extensionConfiguration), + ...(0, import_protocol_http8.resolveHttpHandlerRuntimeConfig)(extensionConfiguration), + ...resolveHttpAuthRuntimeConfig(extensionConfiguration) + }; + }, "resolveRuntimeExtensions"); + var _SSOClient = class _SSOClient extends import_smithy_client5.Client { + constructor(...[configuration]) { + const _config_0 = (0, import_runtimeConfig.getRuntimeConfig)(configuration || {}); + const _config_1 = resolveClientEndpointParameters(_config_0); + const _config_2 = (0, import_middleware_user_agent.resolveUserAgentConfig)(_config_1); + const _config_3 = (0, import_middleware_retry2.resolveRetryConfig)(_config_2); + const _config_4 = (0, import_config_resolver.resolveRegionConfig)(_config_3); + const _config_5 = (0, import_middleware_host_header.resolveHostHeaderConfig)(_config_4); + const _config_6 = (0, import_middleware_endpoint2.resolveEndpointConfig)(_config_5); + const _config_7 = (0, import_httpAuthSchemeProvider.resolveHttpAuthSchemeConfig)(_config_6); + const _config_8 = resolveRuntimeExtensions(_config_7, (configuration == null ? void 0 : configuration.extensions) || []); + super(_config_8); + this.config = _config_8; + this.middlewareStack.use((0, import_middleware_user_agent.getUserAgentPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_retry2.getRetryPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_content_length.getContentLengthPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_host_header.getHostHeaderPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_logger.getLoggerPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_recursion_detection.getRecursionDetectionPlugin)(this.config)); + this.middlewareStack.use( + (0, import_core3.getHttpAuthSchemeEndpointRuleSetPlugin)(this.config, { + httpAuthSchemeParametersProvider: import_httpAuthSchemeProvider.defaultSSOHttpAuthSchemeParametersProvider, + identityProviderConfigProvider: async (config) => new import_core3.DefaultIdentityProviderConfig({ + "aws.auth#sigv4": config.credentials + }) + }) + ); + this.middlewareStack.use((0, import_core3.getHttpSigningPlugin)(this.config)); + } + /** + * Destroy underlying resources, like sockets. It's usually not necessary to do this. + * However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed. + * Otherwise, sockets might stay open for quite a long time before the server terminates them. + */ + destroy() { + super.destroy(); } }; - var de_GetExecutionHistoryCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_GetExecutionHistoryCommandError(output, context); + __name(_SSOClient, "SSOClient"); + var SSOClient = _SSOClient; + var import_middleware_serde2 = require_dist_cjs45(); + var _SSOServiceException = class _SSOServiceException2 extends import_smithy_client5.ServiceException { + /** + * @internal + */ + constructor(options) { + super(options); + Object.setPrototypeOf(this, _SSOServiceException2.prototype); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_GetExecutionHistoryOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; }; - exports2.de_GetExecutionHistoryCommand = de_GetExecutionHistoryCommand; - var de_GetExecutionHistoryCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ExecutionDoesNotExist": - case "com.amazonaws.sfn#ExecutionDoesNotExist": - throw await de_ExecutionDoesNotExistRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "InvalidToken": - case "com.amazonaws.sfn#InvalidToken": - throw await de_InvalidTokenRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + __name(_SSOServiceException, "SSOServiceException"); + var SSOServiceException = _SSOServiceException; + var _InvalidRequestException = class _InvalidRequestException2 extends SSOServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidRequestException", + $fault: "client", + ...opts + }); + this.name = "InvalidRequestException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidRequestException2.prototype); } }; - var de_ListActivitiesCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_ListActivitiesCommandError(output, context); + __name(_InvalidRequestException, "InvalidRequestException"); + var InvalidRequestException = _InvalidRequestException; + var _ResourceNotFoundException = class _ResourceNotFoundException2 extends SSOServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ResourceNotFoundException", + $fault: "client", + ...opts + }); + this.name = "ResourceNotFoundException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ResourceNotFoundException2.prototype); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_ListActivitiesOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; }; - exports2.de_ListActivitiesCommand = de_ListActivitiesCommand; - var de_ListActivitiesCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidToken": - case "com.amazonaws.sfn#InvalidToken": - throw await de_InvalidTokenRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + __name(_ResourceNotFoundException, "ResourceNotFoundException"); + var ResourceNotFoundException = _ResourceNotFoundException; + var _TooManyRequestsException = class _TooManyRequestsException2 extends SSOServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "TooManyRequestsException", + $fault: "client", + ...opts + }); + this.name = "TooManyRequestsException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _TooManyRequestsException2.prototype); } }; - var de_ListExecutionsCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_ListExecutionsCommandError(output, context); + __name(_TooManyRequestsException, "TooManyRequestsException"); + var TooManyRequestsException = _TooManyRequestsException; + var _UnauthorizedException = class _UnauthorizedException2 extends SSOServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "UnauthorizedException", + $fault: "client", + ...opts + }); + this.name = "UnauthorizedException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _UnauthorizedException2.prototype); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_ListExecutionsOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; }; - exports2.de_ListExecutionsCommand = de_ListExecutionsCommand; - var de_ListExecutionsCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "InvalidToken": - case "com.amazonaws.sfn#InvalidToken": - throw await de_InvalidTokenRes(parsedOutput, context); - case "ResourceNotFound": - case "com.amazonaws.sfn#ResourceNotFound": - throw await de_ResourceNotFoundRes(parsedOutput, context); - case "StateMachineDoesNotExist": - case "com.amazonaws.sfn#StateMachineDoesNotExist": - throw await de_StateMachineDoesNotExistRes(parsedOutput, context); - case "StateMachineTypeNotSupported": - case "com.amazonaws.sfn#StateMachineTypeNotSupported": - throw await de_StateMachineTypeNotSupportedRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + __name(_UnauthorizedException, "UnauthorizedException"); + var UnauthorizedException = _UnauthorizedException; + var GetRoleCredentialsRequestFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.accessToken && { accessToken: import_smithy_client5.SENSITIVE_STRING } + }), "GetRoleCredentialsRequestFilterSensitiveLog"); + var RoleCredentialsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.secretAccessKey && { secretAccessKey: import_smithy_client5.SENSITIVE_STRING }, + ...obj.sessionToken && { sessionToken: import_smithy_client5.SENSITIVE_STRING } + }), "RoleCredentialsFilterSensitiveLog"); + var GetRoleCredentialsResponseFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.roleCredentials && { roleCredentials: RoleCredentialsFilterSensitiveLog(obj.roleCredentials) } + }), "GetRoleCredentialsResponseFilterSensitiveLog"); + var ListAccountRolesRequestFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.accessToken && { accessToken: import_smithy_client5.SENSITIVE_STRING } + }), "ListAccountRolesRequestFilterSensitiveLog"); + var ListAccountsRequestFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.accessToken && { accessToken: import_smithy_client5.SENSITIVE_STRING } + }), "ListAccountsRequestFilterSensitiveLog"); + var LogoutRequestFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.accessToken && { accessToken: import_smithy_client5.SENSITIVE_STRING } + }), "LogoutRequestFilterSensitiveLog"); + var import_core22 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var se_GetRoleCredentialsCommand = /* @__PURE__ */ __name(async (input, context) => { + const b = (0, import_core3.requestBuilder)(input, context); + const headers = (0, import_smithy_client5.map)({}, isSerializableHeaderValue, { + [_xasbt]: input[_aT] + }); + b.bp("/federation/credentials"); + const query = (0, import_smithy_client5.map)({ + [_rn]: [, (0, import_smithy_client5.expectNonNull)(input[_rN], `roleName`)], + [_ai]: [, (0, import_smithy_client5.expectNonNull)(input[_aI], `accountId`)] + }); + let body; + b.m("GET").h(headers).q(query).b(body); + return b.build(); + }, "se_GetRoleCredentialsCommand"); + var se_ListAccountRolesCommand = /* @__PURE__ */ __name(async (input, context) => { + const b = (0, import_core3.requestBuilder)(input, context); + const headers = (0, import_smithy_client5.map)({}, isSerializableHeaderValue, { + [_xasbt]: input[_aT] + }); + b.bp("/assignment/roles"); + const query = (0, import_smithy_client5.map)({ + [_nt]: [, input[_nT]], + [_mr]: [() => input.maxResults !== void 0, () => input[_mR].toString()], + [_ai]: [, (0, import_smithy_client5.expectNonNull)(input[_aI], `accountId`)] + }); + let body; + b.m("GET").h(headers).q(query).b(body); + return b.build(); + }, "se_ListAccountRolesCommand"); + var se_ListAccountsCommand = /* @__PURE__ */ __name(async (input, context) => { + const b = (0, import_core3.requestBuilder)(input, context); + const headers = (0, import_smithy_client5.map)({}, isSerializableHeaderValue, { + [_xasbt]: input[_aT] + }); + b.bp("/assignment/accounts"); + const query = (0, import_smithy_client5.map)({ + [_nt]: [, input[_nT]], + [_mr]: [() => input.maxResults !== void 0, () => input[_mR].toString()] + }); + let body; + b.m("GET").h(headers).q(query).b(body); + return b.build(); + }, "se_ListAccountsCommand"); + var se_LogoutCommand = /* @__PURE__ */ __name(async (input, context) => { + const b = (0, import_core3.requestBuilder)(input, context); + const headers = (0, import_smithy_client5.map)({}, isSerializableHeaderValue, { + [_xasbt]: input[_aT] + }); + b.bp("/logout"); + let body; + b.m("POST").h(headers).b(body); + return b.build(); + }, "se_LogoutCommand"); + var de_GetRoleCredentialsCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); + } + const contents = (0, import_smithy_client5.map)({ + $metadata: deserializeMetadata(output) + }); + const data = (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.expectObject)(await (0, import_core22.parseJsonBody)(output.body, context)), "body"); + const doc = (0, import_smithy_client5.take)(data, { + roleCredentials: import_smithy_client5._json + }); + Object.assign(contents, doc); + return contents; + }, "de_GetRoleCredentialsCommand"); + var de_ListAccountRolesCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); + } + const contents = (0, import_smithy_client5.map)({ + $metadata: deserializeMetadata(output) + }); + const data = (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.expectObject)(await (0, import_core22.parseJsonBody)(output.body, context)), "body"); + const doc = (0, import_smithy_client5.take)(data, { + nextToken: import_smithy_client5.expectString, + roleList: import_smithy_client5._json + }); + Object.assign(contents, doc); + return contents; + }, "de_ListAccountRolesCommand"); + var de_ListAccountsCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); } - }; - var de_ListMapRunsCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_ListMapRunsCommandError(output, context); + const contents = (0, import_smithy_client5.map)({ + $metadata: deserializeMetadata(output) + }); + const data = (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.expectObject)(await (0, import_core22.parseJsonBody)(output.body, context)), "body"); + const doc = (0, import_smithy_client5.take)(data, { + accountList: import_smithy_client5._json, + nextToken: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + return contents; + }, "de_ListAccountsCommand"); + var de_LogoutCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_ListMapRunsOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; - }; - exports2.de_ListMapRunsCommand = de_ListMapRunsCommand; - var de_ListMapRunsCommandError = async (output, context) => { + const contents = (0, import_smithy_client5.map)({ + $metadata: deserializeMetadata(output) + }); + await (0, import_smithy_client5.collectBody)(output.body, context); + return contents; + }, "de_LogoutCommand"); + var de_CommandError = /* @__PURE__ */ __name(async (output, context) => { const parsedOutput = { ...output, - body: await parseErrorBody(output.body, context) + body: await (0, import_core22.parseJsonErrorBody)(output.body, context) }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + const errorCode = (0, import_core22.loadRestJsonErrorCode)(output, parsedOutput.body); switch (errorCode) { - case "ExecutionDoesNotExist": - case "com.amazonaws.sfn#ExecutionDoesNotExist": - throw await de_ExecutionDoesNotExistRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "InvalidToken": - case "com.amazonaws.sfn#InvalidToken": - throw await de_InvalidTokenRes(parsedOutput, context); + case "InvalidRequestException": + case "com.amazonaws.sso#InvalidRequestException": + throw await de_InvalidRequestExceptionRes(parsedOutput, context); + case "ResourceNotFoundException": + case "com.amazonaws.sso#ResourceNotFoundException": + throw await de_ResourceNotFoundExceptionRes(parsedOutput, context); + case "TooManyRequestsException": + case "com.amazonaws.sso#TooManyRequestsException": + throw await de_TooManyRequestsExceptionRes(parsedOutput, context); + case "UnauthorizedException": + case "com.amazonaws.sso#UnauthorizedException": + throw await de_UnauthorizedExceptionRes(parsedOutput, context); default: const parsedBody = parsedOutput.body; return throwDefaultError({ @@ -19012,676 +18644,1172 @@ var require_Aws_json1_0 = __commonJS({ errorCode }); } - }; - var de_ListStateMachineAliasesCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_ListStateMachineAliasesCommandError(output, context); - } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_ListStateMachineAliasesOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), + }, "de_CommandError"); + var throwDefaultError = (0, import_smithy_client5.withBaseException)(SSOServiceException); + var de_InvalidRequestExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + message: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + const exception = new InvalidRequestException({ + $metadata: deserializeMetadata(parsedOutput), ...contents - }; - return response; + }); + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_InvalidRequestExceptionRes"); + var de_ResourceNotFoundExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + message: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + const exception = new ResourceNotFoundException({ + $metadata: deserializeMetadata(parsedOutput), + ...contents + }); + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_ResourceNotFoundExceptionRes"); + var de_TooManyRequestsExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + message: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + const exception = new TooManyRequestsException({ + $metadata: deserializeMetadata(parsedOutput), + ...contents + }); + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_TooManyRequestsExceptionRes"); + var de_UnauthorizedExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + message: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + const exception = new UnauthorizedException({ + $metadata: deserializeMetadata(parsedOutput), + ...contents + }); + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_UnauthorizedExceptionRes"); + var deserializeMetadata = /* @__PURE__ */ __name((output) => ({ + httpStatusCode: output.statusCode, + requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"], + extendedRequestId: output.headers["x-amz-id-2"], + cfId: output.headers["x-amz-cf-id"] + }), "deserializeMetadata"); + var isSerializableHeaderValue = /* @__PURE__ */ __name((value) => value !== void 0 && value !== null && value !== "" && (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) && (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0), "isSerializableHeaderValue"); + var _aI = "accountId"; + var _aT = "accessToken"; + var _ai = "account_id"; + var _mR = "maxResults"; + var _mr = "max_result"; + var _nT = "nextToken"; + var _nt = "next_token"; + var _rN = "roleName"; + var _rn = "role_name"; + var _xasbt = "x-amz-sso_bearer_token"; + var _GetRoleCredentialsCommand = class _GetRoleCredentialsCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("SWBPortalService", "GetRoleCredentials", {}).n("SSOClient", "GetRoleCredentialsCommand").f(GetRoleCredentialsRequestFilterSensitiveLog, GetRoleCredentialsResponseFilterSensitiveLog).ser(se_GetRoleCredentialsCommand).de(de_GetRoleCredentialsCommand).build() { + }; + __name(_GetRoleCredentialsCommand, "GetRoleCredentialsCommand"); + var GetRoleCredentialsCommand = _GetRoleCredentialsCommand; + var _ListAccountRolesCommand = class _ListAccountRolesCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("SWBPortalService", "ListAccountRoles", {}).n("SSOClient", "ListAccountRolesCommand").f(ListAccountRolesRequestFilterSensitiveLog, void 0).ser(se_ListAccountRolesCommand).de(de_ListAccountRolesCommand).build() { + }; + __name(_ListAccountRolesCommand, "ListAccountRolesCommand"); + var ListAccountRolesCommand = _ListAccountRolesCommand; + var _ListAccountsCommand = class _ListAccountsCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("SWBPortalService", "ListAccounts", {}).n("SSOClient", "ListAccountsCommand").f(ListAccountsRequestFilterSensitiveLog, void 0).ser(se_ListAccountsCommand).de(de_ListAccountsCommand).build() { + }; + __name(_ListAccountsCommand, "ListAccountsCommand"); + var ListAccountsCommand = _ListAccountsCommand; + var _LogoutCommand = class _LogoutCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("SWBPortalService", "Logout", {}).n("SSOClient", "LogoutCommand").f(LogoutRequestFilterSensitiveLog, void 0).ser(se_LogoutCommand).de(de_LogoutCommand).build() { }; - exports2.de_ListStateMachineAliasesCommand = de_ListStateMachineAliasesCommand; - var de_ListStateMachineAliasesCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "InvalidToken": - case "com.amazonaws.sfn#InvalidToken": - throw await de_InvalidTokenRes(parsedOutput, context); - case "ResourceNotFound": - case "com.amazonaws.sfn#ResourceNotFound": - throw await de_ResourceNotFoundRes(parsedOutput, context); - case "StateMachineDeleting": - case "com.amazonaws.sfn#StateMachineDeleting": - throw await de_StateMachineDeletingRes(parsedOutput, context); - case "StateMachineDoesNotExist": - case "com.amazonaws.sfn#StateMachineDoesNotExist": - throw await de_StateMachineDoesNotExistRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); - } + __name(_LogoutCommand, "LogoutCommand"); + var LogoutCommand = _LogoutCommand; + var commands = { + GetRoleCredentialsCommand, + ListAccountRolesCommand, + ListAccountsCommand, + LogoutCommand }; - var de_ListStateMachinesCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_ListStateMachinesCommandError(output, context); - } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_ListStateMachinesOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents + var _SSO = class _SSO extends SSOClient { + }; + __name(_SSO, "SSO"); + var SSO = _SSO; + (0, import_smithy_client5.createAggregatedClient)(commands, SSO); + var paginateListAccountRoles = (0, import_core3.createPaginator)(SSOClient, ListAccountRolesCommand, "nextToken", "nextToken", "maxResults"); + var paginateListAccounts = (0, import_core3.createPaginator)(SSOClient, ListAccountsCommand, "nextToken", "nextToken", "maxResults"); + } +}); + +// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/auth/httpAuthSchemeProvider.js +var require_httpAuthSchemeProvider3 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/auth/httpAuthSchemeProvider.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.resolveHttpAuthSchemeConfig = exports2.defaultSSOOIDCHttpAuthSchemeProvider = exports2.defaultSSOOIDCHttpAuthSchemeParametersProvider = void 0; + var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var util_middleware_1 = require_dist_cjs10(); + var defaultSSOOIDCHttpAuthSchemeParametersProvider = async (config, context, input) => { + return { + operation: (0, util_middleware_1.getSmithyContext)(context).operation, + region: await (0, util_middleware_1.normalizeProvider)(config.region)() || (() => { + throw new Error("expected `region` to be configured for `aws.auth#sigv4`"); + })() }; - return response; }; - exports2.de_ListStateMachinesCommand = de_ListStateMachinesCommand; - var de_ListStateMachinesCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) + exports2.defaultSSOOIDCHttpAuthSchemeParametersProvider = defaultSSOOIDCHttpAuthSchemeParametersProvider; + function createAwsAuthSigv4HttpAuthOption(authParameters) { + return { + schemeId: "aws.auth#sigv4", + signingProperties: { + name: "sso-oauth", + region: authParameters.region + }, + propertiesExtractor: (config, context) => ({ + signingProperties: { + config, + context + } + }) }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidToken": - case "com.amazonaws.sfn#InvalidToken": - throw await de_InvalidTokenRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + } + function createSmithyApiNoAuthHttpAuthOption(authParameters) { + return { + schemeId: "smithy.api#noAuth" + }; + } + var defaultSSOOIDCHttpAuthSchemeProvider = (authParameters) => { + const options = []; + switch (authParameters.operation) { + case "CreateToken": { + options.push(createSmithyApiNoAuthHttpAuthOption(authParameters)); + break; + } + case "RegisterClient": { + options.push(createSmithyApiNoAuthHttpAuthOption(authParameters)); + break; + } + case "StartDeviceAuthorization": { + options.push(createSmithyApiNoAuthHttpAuthOption(authParameters)); + break; + } + default: { + options.push(createAwsAuthSigv4HttpAuthOption(authParameters)); + } } + return options; }; - var de_ListStateMachineVersionsCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_ListStateMachineVersionsCommandError(output, context); - } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_ListStateMachineVersionsOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents + exports2.defaultSSOOIDCHttpAuthSchemeProvider = defaultSSOOIDCHttpAuthSchemeProvider; + var resolveHttpAuthSchemeConfig = (config) => { + const config_0 = (0, core_1.resolveAwsSdkSigV4Config)(config); + return { + ...config_0 }; - return response; }; - exports2.de_ListStateMachineVersionsCommand = de_ListStateMachineVersionsCommand; - var de_ListStateMachineVersionsCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "InvalidToken": - case "com.amazonaws.sfn#InvalidToken": - throw await de_InvalidTokenRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + exports2.resolveHttpAuthSchemeConfig = resolveHttpAuthSchemeConfig; + } +}); + +// ../../../node_modules/@aws-sdk/client-sso-oidc/package.json +var require_package3 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso-oidc/package.json"(exports2, module2) { + module2.exports = { + name: "@aws-sdk/client-sso-oidc", + description: "AWS SDK for JavaScript Sso Oidc Client for Node.js, Browser and React Native", + version: "3.632.0", + scripts: { + build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", + "build:cjs": "node ../../scripts/compilation/inline client-sso-oidc", + "build:es": "tsc -p tsconfig.es.json", + "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", + "build:types": "tsc -p tsconfig.types.json", + "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4", + clean: "rimraf ./dist-* && rimraf *.tsbuildinfo", + "extract:docs": "api-extractor run --local", + "generate:client": "node ../../scripts/generate-clients/single-service --solo sso-oidc" + }, + main: "./dist-cjs/index.js", + types: "./dist-types/index.d.ts", + module: "./dist-es/index.js", + sideEffects: false, + dependencies: { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/core": "3.629.0", + "@aws-sdk/credential-provider-node": "3.632.0", + "@aws-sdk/middleware-host-header": "3.620.0", + "@aws-sdk/middleware-logger": "3.609.0", + "@aws-sdk/middleware-recursion-detection": "3.620.0", + "@aws-sdk/middleware-user-agent": "3.632.0", + "@aws-sdk/region-config-resolver": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.632.0", + "@aws-sdk/util-user-agent-browser": "3.609.0", + "@aws-sdk/util-user-agent-node": "3.614.0", + "@smithy/config-resolver": "^3.0.5", + "@smithy/core": "^2.3.2", + "@smithy/fetch-http-handler": "^3.2.4", + "@smithy/hash-node": "^3.0.3", + "@smithy/invalid-dependency": "^3.0.3", + "@smithy/middleware-content-length": "^3.0.5", + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.14", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", + "@smithy/util-base64": "^3.0.0", + "@smithy/util-body-length-browser": "^3.0.0", + "@smithy/util-body-length-node": "^3.0.0", + "@smithy/util-defaults-mode-browser": "^3.0.14", + "@smithy/util-defaults-mode-node": "^3.0.14", + "@smithy/util-endpoints": "^2.0.5", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", + "@smithy/util-utf8": "^3.0.0", + tslib: "^2.6.2" + }, + devDependencies: { + "@tsconfig/node16": "16.1.3", + "@types/node": "^16.18.96", + concurrently: "7.0.0", + "downlevel-dts": "0.10.1", + rimraf: "3.0.2", + typescript: "~4.9.5" + }, + engines: { + node: ">=16.0.0" + }, + typesVersions: { + "<4.0": { + "dist-types/*": [ + "dist-types/ts3.4/*" + ] + } + }, + files: [ + "dist-*/**" + ], + author: { + name: "AWS SDK for JavaScript Team", + url: "https://aws.amazon.com/javascript/" + }, + license: "Apache-2.0", + peerDependencies: { + "@aws-sdk/client-sts": "^3.632.0" + }, + browser: { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" + }, + "react-native": { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" + }, + homepage: "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-sso-oidc", + repository: { + type: "git", + url: "https://github.com/aws/aws-sdk-js-v3.git", + directory: "clients/client-sso-oidc" } }; - var de_ListTagsForResourceCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_ListTagsForResourceCommandError(output, context); - } - const data = await parseBody(output.body, context); - let contents = {}; - contents = (0, smithy_client_1._json)(data); - const response = { - $metadata: deserializeMetadata(output), - ...contents + } +}); + +// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/ruleset.js +var require_ruleset2 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/ruleset.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ruleSet = void 0; + var u = "required"; + var v = "fn"; + var w = "argv"; + var x = "ref"; + var a = true; + var b = "isSet"; + var c = "booleanEquals"; + var d = "error"; + var e = "endpoint"; + var f = "tree"; + var g = "PartitionResult"; + var h = "getAttr"; + var i = { [u]: false, "type": "String" }; + var j = { [u]: true, "default": false, "type": "Boolean" }; + var k = { [x]: "Endpoint" }; + var l = { [v]: c, [w]: [{ [x]: "UseFIPS" }, true] }; + var m = { [v]: c, [w]: [{ [x]: "UseDualStack" }, true] }; + var n = {}; + var o = { [v]: h, [w]: [{ [x]: g }, "supportsFIPS"] }; + var p = { [x]: g }; + var q = { [v]: c, [w]: [true, { [v]: h, [w]: [p, "supportsDualStack"] }] }; + var r = [l]; + var s = [m]; + var t = [{ [x]: "Region" }]; + var _data = { version: "1.0", parameters: { Region: i, UseDualStack: j, UseFIPS: j, Endpoint: i }, rules: [{ conditions: [{ [v]: b, [w]: [k] }], rules: [{ conditions: r, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: d }, { conditions: s, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: d }, { endpoint: { url: k, properties: n, headers: n }, type: e }], type: f }, { conditions: [{ [v]: b, [w]: t }], rules: [{ conditions: [{ [v]: "aws.partition", [w]: t, assign: g }], rules: [{ conditions: [l, m], rules: [{ conditions: [{ [v]: c, [w]: [a, o] }, q], rules: [{ endpoint: { url: "https://oidc-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: d }], type: f }, { conditions: r, rules: [{ conditions: [{ [v]: c, [w]: [o, a] }], rules: [{ conditions: [{ [v]: "stringEquals", [w]: [{ [v]: h, [w]: [p, "name"] }, "aws-us-gov"] }], endpoint: { url: "https://oidc.{Region}.amazonaws.com", properties: n, headers: n }, type: e }, { endpoint: { url: "https://oidc-fips.{Region}.{PartitionResult#dnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "FIPS is enabled but this partition does not support FIPS", type: d }], type: f }, { conditions: s, rules: [{ conditions: [q], rules: [{ endpoint: { url: "https://oidc.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: n, headers: n }, type: e }], type: f }, { error: "DualStack is enabled but this partition does not support DualStack", type: d }], type: f }, { endpoint: { url: "https://oidc.{Region}.{PartitionResult#dnsSuffix}", properties: n, headers: n }, type: e }], type: f }], type: f }, { error: "Invalid Configuration: Missing Region", type: d }] }; + exports2.ruleSet = _data; + } +}); + +// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/endpointResolver.js +var require_endpointResolver2 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/endpointResolver.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.defaultEndpointResolver = void 0; + var util_endpoints_1 = require_dist_cjs7(); + var util_endpoints_2 = require_dist_cjs6(); + var ruleset_1 = require_ruleset2(); + var defaultEndpointResolver = (endpointParams, context = {}) => { + return (0, util_endpoints_2.resolveEndpoint)(ruleset_1.ruleSet, { + endpointParams, + logger: context.logger + }); + }; + exports2.defaultEndpointResolver = defaultEndpointResolver; + util_endpoints_2.customEndpointFunctions.aws = util_endpoints_1.awsEndpointFunctions; + } +}); + +// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.shared.js +var require_runtimeConfig_shared2 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.shared.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getRuntimeConfig = void 0; + var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var core_2 = (init_dist_es(), __toCommonJS(dist_es_exports)); + var smithy_client_1 = require_dist_cjs37(); + var url_parser_1 = require_dist_cjs44(); + var util_base64_1 = require_dist_cjs29(); + var util_utf8_1 = require_dist_cjs28(); + var httpAuthSchemeProvider_1 = require_httpAuthSchemeProvider3(); + var endpointResolver_1 = require_endpointResolver2(); + var getRuntimeConfig = (config) => { + return { + apiVersion: "2019-06-10", + base64Decoder: config?.base64Decoder ?? util_base64_1.fromBase64, + base64Encoder: config?.base64Encoder ?? util_base64_1.toBase64, + disableHostPrefix: config?.disableHostPrefix ?? false, + endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver, + extensions: config?.extensions ?? [], + httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? httpAuthSchemeProvider_1.defaultSSOOIDCHttpAuthSchemeProvider, + httpAuthSchemes: config?.httpAuthSchemes ?? [ + { + schemeId: "aws.auth#sigv4", + identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"), + signer: new core_1.AwsSdkSigV4Signer() + }, + { + schemeId: "smithy.api#noAuth", + identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})), + signer: new core_2.NoAuthSigner() + } + ], + logger: config?.logger ?? new smithy_client_1.NoOpLogger(), + serviceId: config?.serviceId ?? "SSO OIDC", + urlParser: config?.urlParser ?? url_parser_1.parseUrl, + utf8Decoder: config?.utf8Decoder ?? util_utf8_1.fromUtf8, + utf8Encoder: config?.utf8Encoder ?? util_utf8_1.toUtf8 }; - return response; }; - exports2.de_ListTagsForResourceCommand = de_ListTagsForResourceCommand; - var de_ListTagsForResourceCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) + exports2.getRuntimeConfig = getRuntimeConfig; + } +}); + +// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.js +var require_runtimeConfig2 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getRuntimeConfig = void 0; + var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); + var package_json_1 = tslib_1.__importDefault(require_package3()); + var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var credential_provider_node_1 = require_dist_cjs79(); + var util_user_agent_node_1 = require_dist_cjs56(); + var config_resolver_1 = require_dist_cjs11(); + var hash_node_1 = require_dist_cjs57(); + var middleware_retry_1 = require_dist_cjs38(); + var node_config_provider_1 = require_dist_cjs42(); + var node_http_handler_1 = require_dist_cjs51(); + var util_body_length_node_1 = require_dist_cjs58(); + var util_retry_1 = require_dist_cjs60(); + var runtimeConfig_shared_1 = require_runtimeConfig_shared2(); + var smithy_client_1 = require_dist_cjs37(); + var util_defaults_mode_node_1 = require_dist_cjs69(); + var smithy_client_2 = require_dist_cjs37(); + var getRuntimeConfig = (config) => { + (0, smithy_client_2.emitWarningIfUnsupportedVersion)(process.version); + const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config); + const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode); + const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config); + (0, core_1.emitWarningIfUnsupportedVersion)(process.version); + return { + ...clientSharedValues, + ...config, + runtime: "node", + defaultsMode, + bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength, + credentialDefaultProvider: config?.credentialDefaultProvider ?? credential_provider_node_1.defaultProvider, + defaultUserAgentProvider: config?.defaultUserAgentProvider ?? (0, util_user_agent_node_1.defaultUserAgent)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }), + maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config?.region ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_REGION_CONFIG_OPTIONS, config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: node_http_handler_1.NodeHttpHandler.create(config?.requestHandler ?? defaultConfigProvider), + retryMode: config?.retryMode ?? (0, node_config_provider_1.loadConfig)({ + ...middleware_retry_1.NODE_RETRY_MODE_CONFIG_OPTIONS, + default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE + }), + sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, "sha256"), + streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector, + useDualstackEndpoint: config?.useDualstackEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), + useFipsEndpoint: config?.useFipsEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS) }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "ResourceNotFound": - case "com.amazonaws.sfn#ResourceNotFound": - throw await de_ResourceNotFoundRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); - } }; - var de_PublishStateMachineVersionCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_PublishStateMachineVersionCommandError(output, context); - } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_PublishStateMachineVersionOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; + exports2.getRuntimeConfig = getRuntimeConfig; + } +}); + +// ../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/index.js +var require_dist_cjs72 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sso-oidc/dist-cjs/index.js"(exports2, module2) { + "use strict"; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - exports2.de_PublishStateMachineVersionCommand = de_PublishStateMachineVersionCommand; - var de_PublishStateMachineVersionCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ConflictException": - case "com.amazonaws.sfn#ConflictException": - throw await de_ConflictExceptionRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "ServiceQuotaExceededException": - case "com.amazonaws.sfn#ServiceQuotaExceededException": - throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context); - case "StateMachineDeleting": - case "com.amazonaws.sfn#StateMachineDeleting": - throw await de_StateMachineDeletingRes(parsedOutput, context); - case "StateMachineDoesNotExist": - case "com.amazonaws.sfn#StateMachineDoesNotExist": - throw await de_StateMachineDoesNotExistRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - var de_SendTaskFailureCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_SendTaskFailureCommandError(output, context); - } - const data = await parseBody(output.body, context); - let contents = {}; - contents = (0, smithy_client_1._json)(data); - const response = { - $metadata: deserializeMetadata(output), - ...contents + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + AccessDeniedException: () => AccessDeniedException, + AuthorizationPendingException: () => AuthorizationPendingException, + CreateTokenCommand: () => CreateTokenCommand, + CreateTokenRequestFilterSensitiveLog: () => CreateTokenRequestFilterSensitiveLog, + CreateTokenResponseFilterSensitiveLog: () => CreateTokenResponseFilterSensitiveLog, + CreateTokenWithIAMCommand: () => CreateTokenWithIAMCommand, + CreateTokenWithIAMRequestFilterSensitiveLog: () => CreateTokenWithIAMRequestFilterSensitiveLog, + CreateTokenWithIAMResponseFilterSensitiveLog: () => CreateTokenWithIAMResponseFilterSensitiveLog, + ExpiredTokenException: () => ExpiredTokenException, + InternalServerException: () => InternalServerException, + InvalidClientException: () => InvalidClientException, + InvalidClientMetadataException: () => InvalidClientMetadataException, + InvalidGrantException: () => InvalidGrantException, + InvalidRedirectUriException: () => InvalidRedirectUriException, + InvalidRequestException: () => InvalidRequestException, + InvalidRequestRegionException: () => InvalidRequestRegionException, + InvalidScopeException: () => InvalidScopeException, + RegisterClientCommand: () => RegisterClientCommand, + RegisterClientResponseFilterSensitiveLog: () => RegisterClientResponseFilterSensitiveLog, + SSOOIDC: () => SSOOIDC, + SSOOIDCClient: () => SSOOIDCClient, + SSOOIDCServiceException: () => SSOOIDCServiceException, + SlowDownException: () => SlowDownException, + StartDeviceAuthorizationCommand: () => StartDeviceAuthorizationCommand, + StartDeviceAuthorizationRequestFilterSensitiveLog: () => StartDeviceAuthorizationRequestFilterSensitiveLog, + UnauthorizedClientException: () => UnauthorizedClientException, + UnsupportedGrantTypeException: () => UnsupportedGrantTypeException, + __Client: () => import_smithy_client5.Client + }); + module2.exports = __toCommonJS2(src_exports); + var import_middleware_host_header = require_dist_cjs3(); + var import_middleware_logger = require_dist_cjs4(); + var import_middleware_recursion_detection = require_dist_cjs5(); + var import_middleware_user_agent = require_dist_cjs8(); + var import_config_resolver = require_dist_cjs11(); + var import_core3 = (init_dist_es(), __toCommonJS(dist_es_exports)); + var import_middleware_content_length = require_dist_cjs39(); + var import_middleware_endpoint2 = require_dist_cjs46(); + var import_middleware_retry2 = require_dist_cjs38(); + var import_httpAuthSchemeProvider = require_httpAuthSchemeProvider3(); + var resolveClientEndpointParameters = /* @__PURE__ */ __name((options) => { + return { + ...options, + useDualstackEndpoint: options.useDualstackEndpoint ?? false, + useFipsEndpoint: options.useFipsEndpoint ?? false, + defaultSigningName: "sso-oauth" }; - return response; - }; - exports2.de_SendTaskFailureCommand = de_SendTaskFailureCommand; - var de_SendTaskFailureCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) + }, "resolveClientEndpointParameters"); + var commonParams = { + UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, + Endpoint: { type: "builtInParams", name: "endpoint" }, + Region: { type: "builtInParams", name: "region" }, + UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } + }; + var import_runtimeConfig = require_runtimeConfig2(); + var import_region_config_resolver = require_dist_cjs70(); + var import_protocol_http8 = require_dist_cjs2(); + var import_smithy_client5 = require_dist_cjs37(); + var getHttpAuthExtensionConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { + const _httpAuthSchemes = runtimeConfig.httpAuthSchemes; + let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider; + let _credentials = runtimeConfig.credentials; + return { + setHttpAuthScheme(httpAuthScheme) { + const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId); + if (index === -1) { + _httpAuthSchemes.push(httpAuthScheme); + } else { + _httpAuthSchemes.splice(index, 1, httpAuthScheme); + } + }, + httpAuthSchemes() { + return _httpAuthSchemes; + }, + setHttpAuthSchemeProvider(httpAuthSchemeProvider) { + _httpAuthSchemeProvider = httpAuthSchemeProvider; + }, + httpAuthSchemeProvider() { + return _httpAuthSchemeProvider; + }, + setCredentials(credentials) { + _credentials = credentials; + }, + credentials() { + return _credentials; + } }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidToken": - case "com.amazonaws.sfn#InvalidToken": - throw await de_InvalidTokenRes(parsedOutput, context); - case "TaskDoesNotExist": - case "com.amazonaws.sfn#TaskDoesNotExist": - throw await de_TaskDoesNotExistRes(parsedOutput, context); - case "TaskTimedOut": - case "com.amazonaws.sfn#TaskTimedOut": - throw await de_TaskTimedOutRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); - } - }; - var de_SendTaskHeartbeatCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_SendTaskHeartbeatCommandError(output, context); - } - const data = await parseBody(output.body, context); - let contents = {}; - contents = (0, smithy_client_1._json)(data); - const response = { - $metadata: deserializeMetadata(output), - ...contents + }, "getHttpAuthExtensionConfiguration"); + var resolveHttpAuthRuntimeConfig = /* @__PURE__ */ __name((config) => { + return { + httpAuthSchemes: config.httpAuthSchemes(), + httpAuthSchemeProvider: config.httpAuthSchemeProvider(), + credentials: config.credentials() }; - return response; - }; - exports2.de_SendTaskHeartbeatCommand = de_SendTaskHeartbeatCommand; - var de_SendTaskHeartbeatCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) + }, "resolveHttpAuthRuntimeConfig"); + var asPartial = /* @__PURE__ */ __name((t) => t, "asPartial"); + var resolveRuntimeExtensions = /* @__PURE__ */ __name((runtimeConfig, extensions) => { + const extensionConfiguration = { + ...asPartial((0, import_region_config_resolver.getAwsRegionExtensionConfiguration)(runtimeConfig)), + ...asPartial((0, import_smithy_client5.getDefaultExtensionConfiguration)(runtimeConfig)), + ...asPartial((0, import_protocol_http8.getHttpHandlerExtensionConfiguration)(runtimeConfig)), + ...asPartial(getHttpAuthExtensionConfiguration(runtimeConfig)) }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidToken": - case "com.amazonaws.sfn#InvalidToken": - throw await de_InvalidTokenRes(parsedOutput, context); - case "TaskDoesNotExist": - case "com.amazonaws.sfn#TaskDoesNotExist": - throw await de_TaskDoesNotExistRes(parsedOutput, context); - case "TaskTimedOut": - case "com.amazonaws.sfn#TaskTimedOut": - throw await de_TaskTimedOutRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + extensions.forEach((extension) => extension.configure(extensionConfiguration)); + return { + ...runtimeConfig, + ...(0, import_region_config_resolver.resolveAwsRegionExtensionConfiguration)(extensionConfiguration), + ...(0, import_smithy_client5.resolveDefaultRuntimeConfig)(extensionConfiguration), + ...(0, import_protocol_http8.resolveHttpHandlerRuntimeConfig)(extensionConfiguration), + ...resolveHttpAuthRuntimeConfig(extensionConfiguration) + }; + }, "resolveRuntimeExtensions"); + var _SSOOIDCClient = class _SSOOIDCClient extends import_smithy_client5.Client { + constructor(...[configuration]) { + const _config_0 = (0, import_runtimeConfig.getRuntimeConfig)(configuration || {}); + const _config_1 = resolveClientEndpointParameters(_config_0); + const _config_2 = (0, import_middleware_user_agent.resolveUserAgentConfig)(_config_1); + const _config_3 = (0, import_middleware_retry2.resolveRetryConfig)(_config_2); + const _config_4 = (0, import_config_resolver.resolveRegionConfig)(_config_3); + const _config_5 = (0, import_middleware_host_header.resolveHostHeaderConfig)(_config_4); + const _config_6 = (0, import_middleware_endpoint2.resolveEndpointConfig)(_config_5); + const _config_7 = (0, import_httpAuthSchemeProvider.resolveHttpAuthSchemeConfig)(_config_6); + const _config_8 = resolveRuntimeExtensions(_config_7, (configuration == null ? void 0 : configuration.extensions) || []); + super(_config_8); + this.config = _config_8; + this.middlewareStack.use((0, import_middleware_user_agent.getUserAgentPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_retry2.getRetryPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_content_length.getContentLengthPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_host_header.getHostHeaderPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_logger.getLoggerPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_recursion_detection.getRecursionDetectionPlugin)(this.config)); + this.middlewareStack.use( + (0, import_core3.getHttpAuthSchemeEndpointRuleSetPlugin)(this.config, { + httpAuthSchemeParametersProvider: import_httpAuthSchemeProvider.defaultSSOOIDCHttpAuthSchemeParametersProvider, + identityProviderConfigProvider: async (config) => new import_core3.DefaultIdentityProviderConfig({ + "aws.auth#sigv4": config.credentials + }) + }) + ); + this.middlewareStack.use((0, import_core3.getHttpSigningPlugin)(this.config)); } - }; - var de_SendTaskSuccessCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_SendTaskSuccessCommandError(output, context); + /** + * Destroy underlying resources, like sockets. It's usually not necessary to do this. + * However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed. + * Otherwise, sockets might stay open for quite a long time before the server terminates them. + */ + destroy() { + super.destroy(); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = (0, smithy_client_1._json)(data); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; }; - exports2.de_SendTaskSuccessCommand = de_SendTaskSuccessCommand; - var de_SendTaskSuccessCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidOutput": - case "com.amazonaws.sfn#InvalidOutput": - throw await de_InvalidOutputRes(parsedOutput, context); - case "InvalidToken": - case "com.amazonaws.sfn#InvalidToken": - throw await de_InvalidTokenRes(parsedOutput, context); - case "TaskDoesNotExist": - case "com.amazonaws.sfn#TaskDoesNotExist": - throw await de_TaskDoesNotExistRes(parsedOutput, context); - case "TaskTimedOut": - case "com.amazonaws.sfn#TaskTimedOut": - throw await de_TaskTimedOutRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + __name(_SSOOIDCClient, "SSOOIDCClient"); + var SSOOIDCClient = _SSOOIDCClient; + var import_middleware_serde2 = require_dist_cjs45(); + var _SSOOIDCServiceException = class _SSOOIDCServiceException2 extends import_smithy_client5.ServiceException { + /** + * @internal + */ + constructor(options) { + super(options); + Object.setPrototypeOf(this, _SSOOIDCServiceException2.prototype); } }; - var de_StartExecutionCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_StartExecutionCommandError(output, context); + __name(_SSOOIDCServiceException, "SSOOIDCServiceException"); + var SSOOIDCServiceException = _SSOOIDCServiceException; + var _AccessDeniedException = class _AccessDeniedException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "AccessDeniedException", + $fault: "client", + ...opts + }); + this.name = "AccessDeniedException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _AccessDeniedException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_StartExecutionOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; }; - exports2.de_StartExecutionCommand = de_StartExecutionCommand; - var de_StartExecutionCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ExecutionAlreadyExists": - case "com.amazonaws.sfn#ExecutionAlreadyExists": - throw await de_ExecutionAlreadyExistsRes(parsedOutput, context); - case "ExecutionLimitExceeded": - case "com.amazonaws.sfn#ExecutionLimitExceeded": - throw await de_ExecutionLimitExceededRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "InvalidExecutionInput": - case "com.amazonaws.sfn#InvalidExecutionInput": - throw await de_InvalidExecutionInputRes(parsedOutput, context); - case "InvalidName": - case "com.amazonaws.sfn#InvalidName": - throw await de_InvalidNameRes(parsedOutput, context); - case "StateMachineDeleting": - case "com.amazonaws.sfn#StateMachineDeleting": - throw await de_StateMachineDeletingRes(parsedOutput, context); - case "StateMachineDoesNotExist": - case "com.amazonaws.sfn#StateMachineDoesNotExist": - throw await de_StateMachineDoesNotExistRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + __name(_AccessDeniedException, "AccessDeniedException"); + var AccessDeniedException = _AccessDeniedException; + var _AuthorizationPendingException = class _AuthorizationPendingException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "AuthorizationPendingException", + $fault: "client", + ...opts + }); + this.name = "AuthorizationPendingException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _AuthorizationPendingException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; } }; - var de_StartSyncExecutionCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_StartSyncExecutionCommandError(output, context); + __name(_AuthorizationPendingException, "AuthorizationPendingException"); + var AuthorizationPendingException = _AuthorizationPendingException; + var _ExpiredTokenException = class _ExpiredTokenException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ExpiredTokenException", + $fault: "client", + ...opts + }); + this.name = "ExpiredTokenException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ExpiredTokenException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_StartSyncExecutionOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; }; - exports2.de_StartSyncExecutionCommand = de_StartSyncExecutionCommand; - var de_StartSyncExecutionCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "InvalidExecutionInput": - case "com.amazonaws.sfn#InvalidExecutionInput": - throw await de_InvalidExecutionInputRes(parsedOutput, context); - case "InvalidName": - case "com.amazonaws.sfn#InvalidName": - throw await de_InvalidNameRes(parsedOutput, context); - case "StateMachineDeleting": - case "com.amazonaws.sfn#StateMachineDeleting": - throw await de_StateMachineDeletingRes(parsedOutput, context); - case "StateMachineDoesNotExist": - case "com.amazonaws.sfn#StateMachineDoesNotExist": - throw await de_StateMachineDoesNotExistRes(parsedOutput, context); - case "StateMachineTypeNotSupported": - case "com.amazonaws.sfn#StateMachineTypeNotSupported": - throw await de_StateMachineTypeNotSupportedRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + __name(_ExpiredTokenException, "ExpiredTokenException"); + var ExpiredTokenException = _ExpiredTokenException; + var _InternalServerException = class _InternalServerException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InternalServerException", + $fault: "server", + ...opts + }); + this.name = "InternalServerException"; + this.$fault = "server"; + Object.setPrototypeOf(this, _InternalServerException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; } }; - var de_StopExecutionCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_StopExecutionCommandError(output, context); + __name(_InternalServerException, "InternalServerException"); + var InternalServerException = _InternalServerException; + var _InvalidClientException = class _InvalidClientException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidClientException", + $fault: "client", + ...opts + }); + this.name = "InvalidClientException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidClientException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_StopExecutionOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; }; - exports2.de_StopExecutionCommand = de_StopExecutionCommand; - var de_StopExecutionCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ExecutionDoesNotExist": - case "com.amazonaws.sfn#ExecutionDoesNotExist": - throw await de_ExecutionDoesNotExistRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + __name(_InvalidClientException, "InvalidClientException"); + var InvalidClientException = _InvalidClientException; + var _InvalidGrantException = class _InvalidGrantException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidGrantException", + $fault: "client", + ...opts + }); + this.name = "InvalidGrantException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidGrantException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; } }; - var de_TagResourceCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_TagResourceCommandError(output, context); + __name(_InvalidGrantException, "InvalidGrantException"); + var InvalidGrantException = _InvalidGrantException; + var _InvalidRequestException = class _InvalidRequestException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidRequestException", + $fault: "client", + ...opts + }); + this.name = "InvalidRequestException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidRequestException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; } - const data = await parseBody(output.body, context); - let contents = {}; - contents = (0, smithy_client_1._json)(data); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; }; - exports2.de_TagResourceCommand = de_TagResourceCommand; - var de_TagResourceCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "ResourceNotFound": - case "com.amazonaws.sfn#ResourceNotFound": - throw await de_ResourceNotFoundRes(parsedOutput, context); - case "TooManyTags": - case "com.amazonaws.sfn#TooManyTags": - throw await de_TooManyTagsRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + __name(_InvalidRequestException, "InvalidRequestException"); + var InvalidRequestException = _InvalidRequestException; + var _InvalidScopeException = class _InvalidScopeException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidScopeException", + $fault: "client", + ...opts + }); + this.name = "InvalidScopeException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidScopeException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; + } + }; + __name(_InvalidScopeException, "InvalidScopeException"); + var InvalidScopeException = _InvalidScopeException; + var _SlowDownException = class _SlowDownException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "SlowDownException", + $fault: "client", + ...opts + }); + this.name = "SlowDownException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _SlowDownException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; } }; - var de_UntagResourceCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_UntagResourceCommandError(output, context); + __name(_SlowDownException, "SlowDownException"); + var SlowDownException = _SlowDownException; + var _UnauthorizedClientException = class _UnauthorizedClientException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "UnauthorizedClientException", + $fault: "client", + ...opts + }); + this.name = "UnauthorizedClientException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _UnauthorizedClientException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; } - const data = await parseBody(output.body, context); - let contents = {}; - contents = (0, smithy_client_1._json)(data); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; }; - exports2.de_UntagResourceCommand = de_UntagResourceCommand; - var de_UntagResourceCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "ResourceNotFound": - case "com.amazonaws.sfn#ResourceNotFound": - throw await de_ResourceNotFoundRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + __name(_UnauthorizedClientException, "UnauthorizedClientException"); + var UnauthorizedClientException = _UnauthorizedClientException; + var _UnsupportedGrantTypeException = class _UnsupportedGrantTypeException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "UnsupportedGrantTypeException", + $fault: "client", + ...opts + }); + this.name = "UnsupportedGrantTypeException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _UnsupportedGrantTypeException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; } }; - var de_UpdateMapRunCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_UpdateMapRunCommandError(output, context); + __name(_UnsupportedGrantTypeException, "UnsupportedGrantTypeException"); + var UnsupportedGrantTypeException = _UnsupportedGrantTypeException; + var _InvalidRequestRegionException = class _InvalidRequestRegionException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidRequestRegionException", + $fault: "client", + ...opts + }); + this.name = "InvalidRequestRegionException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidRequestRegionException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; + this.endpoint = opts.endpoint; + this.region = opts.region; } - const data = await parseBody(output.body, context); - let contents = {}; - contents = (0, smithy_client_1._json)(data); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; }; - exports2.de_UpdateMapRunCommand = de_UpdateMapRunCommand; - var de_UpdateMapRunCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) - }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "ResourceNotFound": - case "com.amazonaws.sfn#ResourceNotFound": - throw await de_ResourceNotFoundRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + __name(_InvalidRequestRegionException, "InvalidRequestRegionException"); + var InvalidRequestRegionException = _InvalidRequestRegionException; + var _InvalidClientMetadataException = class _InvalidClientMetadataException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidClientMetadataException", + $fault: "client", + ...opts + }); + this.name = "InvalidClientMetadataException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidClientMetadataException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; } }; - var de_UpdateStateMachineCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_UpdateStateMachineCommandError(output, context); + __name(_InvalidClientMetadataException, "InvalidClientMetadataException"); + var InvalidClientMetadataException = _InvalidClientMetadataException; + var _InvalidRedirectUriException = class _InvalidRedirectUriException2 extends SSOOIDCServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidRedirectUriException", + $fault: "client", + ...opts + }); + this.name = "InvalidRedirectUriException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidRedirectUriException2.prototype); + this.error = opts.error; + this.error_description = opts.error_description; } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_UpdateStateMachineOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; }; - exports2.de_UpdateStateMachineCommand = de_UpdateStateMachineCommand; - var de_UpdateStateMachineCommandError = async (output, context) => { - const parsedOutput = { - ...output, - body: await parseErrorBody(output.body, context) + __name(_InvalidRedirectUriException, "InvalidRedirectUriException"); + var InvalidRedirectUriException = _InvalidRedirectUriException; + var CreateTokenRequestFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.clientSecret && { clientSecret: import_smithy_client5.SENSITIVE_STRING }, + ...obj.refreshToken && { refreshToken: import_smithy_client5.SENSITIVE_STRING }, + ...obj.codeVerifier && { codeVerifier: import_smithy_client5.SENSITIVE_STRING } + }), "CreateTokenRequestFilterSensitiveLog"); + var CreateTokenResponseFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.accessToken && { accessToken: import_smithy_client5.SENSITIVE_STRING }, + ...obj.refreshToken && { refreshToken: import_smithy_client5.SENSITIVE_STRING }, + ...obj.idToken && { idToken: import_smithy_client5.SENSITIVE_STRING } + }), "CreateTokenResponseFilterSensitiveLog"); + var CreateTokenWithIAMRequestFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.refreshToken && { refreshToken: import_smithy_client5.SENSITIVE_STRING }, + ...obj.assertion && { assertion: import_smithy_client5.SENSITIVE_STRING }, + ...obj.subjectToken && { subjectToken: import_smithy_client5.SENSITIVE_STRING }, + ...obj.codeVerifier && { codeVerifier: import_smithy_client5.SENSITIVE_STRING } + }), "CreateTokenWithIAMRequestFilterSensitiveLog"); + var CreateTokenWithIAMResponseFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.accessToken && { accessToken: import_smithy_client5.SENSITIVE_STRING }, + ...obj.refreshToken && { refreshToken: import_smithy_client5.SENSITIVE_STRING }, + ...obj.idToken && { idToken: import_smithy_client5.SENSITIVE_STRING } + }), "CreateTokenWithIAMResponseFilterSensitiveLog"); + var RegisterClientResponseFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.clientSecret && { clientSecret: import_smithy_client5.SENSITIVE_STRING } + }), "RegisterClientResponseFilterSensitiveLog"); + var StartDeviceAuthorizationRequestFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.clientSecret && { clientSecret: import_smithy_client5.SENSITIVE_STRING } + }), "StartDeviceAuthorizationRequestFilterSensitiveLog"); + var import_core22 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var se_CreateTokenCommand = /* @__PURE__ */ __name(async (input, context) => { + const b = (0, import_core3.requestBuilder)(input, context); + const headers = { + "content-type": "application/json" }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); - switch (errorCode) { - case "ConflictException": - case "com.amazonaws.sfn#ConflictException": - throw await de_ConflictExceptionRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "InvalidDefinition": - case "com.amazonaws.sfn#InvalidDefinition": - throw await de_InvalidDefinitionRes(parsedOutput, context); - case "InvalidLoggingConfiguration": - case "com.amazonaws.sfn#InvalidLoggingConfiguration": - throw await de_InvalidLoggingConfigurationRes(parsedOutput, context); - case "InvalidTracingConfiguration": - case "com.amazonaws.sfn#InvalidTracingConfiguration": - throw await de_InvalidTracingConfigurationRes(parsedOutput, context); - case "MissingRequiredParameter": - case "com.amazonaws.sfn#MissingRequiredParameter": - throw await de_MissingRequiredParameterRes(parsedOutput, context); - case "ServiceQuotaExceededException": - case "com.amazonaws.sfn#ServiceQuotaExceededException": - throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context); - case "StateMachineDeleting": - case "com.amazonaws.sfn#StateMachineDeleting": - throw await de_StateMachineDeletingRes(parsedOutput, context); - case "StateMachineDoesNotExist": - case "com.amazonaws.sfn#StateMachineDoesNotExist": - throw await de_StateMachineDoesNotExistRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); - default: - const parsedBody = parsedOutput.body; - return throwDefaultError({ - output, - parsedBody, - errorCode - }); + b.bp("/token"); + let body; + body = JSON.stringify( + (0, import_smithy_client5.take)(input, { + clientId: [], + clientSecret: [], + code: [], + codeVerifier: [], + deviceCode: [], + grantType: [], + redirectUri: [], + refreshToken: [], + scope: (_) => (0, import_smithy_client5._json)(_) + }) + ); + b.m("POST").h(headers).b(body); + return b.build(); + }, "se_CreateTokenCommand"); + var se_CreateTokenWithIAMCommand = /* @__PURE__ */ __name(async (input, context) => { + const b = (0, import_core3.requestBuilder)(input, context); + const headers = { + "content-type": "application/json" + }; + b.bp("/token"); + const query = (0, import_smithy_client5.map)({ + [_ai]: [, "t"] + }); + let body; + body = JSON.stringify( + (0, import_smithy_client5.take)(input, { + assertion: [], + clientId: [], + code: [], + codeVerifier: [], + grantType: [], + redirectUri: [], + refreshToken: [], + requestedTokenType: [], + scope: (_) => (0, import_smithy_client5._json)(_), + subjectToken: [], + subjectTokenType: [] + }) + ); + b.m("POST").h(headers).q(query).b(body); + return b.build(); + }, "se_CreateTokenWithIAMCommand"); + var se_RegisterClientCommand = /* @__PURE__ */ __name(async (input, context) => { + const b = (0, import_core3.requestBuilder)(input, context); + const headers = { + "content-type": "application/json" + }; + b.bp("/client/register"); + let body; + body = JSON.stringify( + (0, import_smithy_client5.take)(input, { + clientName: [], + clientType: [], + entitledApplicationArn: [], + grantTypes: (_) => (0, import_smithy_client5._json)(_), + issuerUrl: [], + redirectUris: (_) => (0, import_smithy_client5._json)(_), + scopes: (_) => (0, import_smithy_client5._json)(_) + }) + ); + b.m("POST").h(headers).b(body); + return b.build(); + }, "se_RegisterClientCommand"); + var se_StartDeviceAuthorizationCommand = /* @__PURE__ */ __name(async (input, context) => { + const b = (0, import_core3.requestBuilder)(input, context); + const headers = { + "content-type": "application/json" + }; + b.bp("/device_authorization"); + let body; + body = JSON.stringify( + (0, import_smithy_client5.take)(input, { + clientId: [], + clientSecret: [], + startUrl: [] + }) + ); + b.m("POST").h(headers).b(body); + return b.build(); + }, "se_StartDeviceAuthorizationCommand"); + var de_CreateTokenCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); } - }; - var de_UpdateStateMachineAliasCommand = async (output, context) => { - if (output.statusCode >= 300) { - return de_UpdateStateMachineAliasCommandError(output, context); + const contents = (0, import_smithy_client5.map)({ + $metadata: deserializeMetadata(output) + }); + const data = (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.expectObject)(await (0, import_core22.parseJsonBody)(output.body, context)), "body"); + const doc = (0, import_smithy_client5.take)(data, { + accessToken: import_smithy_client5.expectString, + expiresIn: import_smithy_client5.expectInt32, + idToken: import_smithy_client5.expectString, + refreshToken: import_smithy_client5.expectString, + tokenType: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + return contents; + }, "de_CreateTokenCommand"); + var de_CreateTokenWithIAMCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); } - const data = await parseBody(output.body, context); - let contents = {}; - contents = de_UpdateStateMachineAliasOutput(data, context); - const response = { - $metadata: deserializeMetadata(output), - ...contents - }; - return response; - }; - exports2.de_UpdateStateMachineAliasCommand = de_UpdateStateMachineAliasCommand; - var de_UpdateStateMachineAliasCommandError = async (output, context) => { + const contents = (0, import_smithy_client5.map)({ + $metadata: deserializeMetadata(output) + }); + const data = (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.expectObject)(await (0, import_core22.parseJsonBody)(output.body, context)), "body"); + const doc = (0, import_smithy_client5.take)(data, { + accessToken: import_smithy_client5.expectString, + expiresIn: import_smithy_client5.expectInt32, + idToken: import_smithy_client5.expectString, + issuedTokenType: import_smithy_client5.expectString, + refreshToken: import_smithy_client5.expectString, + scope: import_smithy_client5._json, + tokenType: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + return contents; + }, "de_CreateTokenWithIAMCommand"); + var de_RegisterClientCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); + } + const contents = (0, import_smithy_client5.map)({ + $metadata: deserializeMetadata(output) + }); + const data = (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.expectObject)(await (0, import_core22.parseJsonBody)(output.body, context)), "body"); + const doc = (0, import_smithy_client5.take)(data, { + authorizationEndpoint: import_smithy_client5.expectString, + clientId: import_smithy_client5.expectString, + clientIdIssuedAt: import_smithy_client5.expectLong, + clientSecret: import_smithy_client5.expectString, + clientSecretExpiresAt: import_smithy_client5.expectLong, + tokenEndpoint: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + return contents; + }, "de_RegisterClientCommand"); + var de_StartDeviceAuthorizationCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); + } + const contents = (0, import_smithy_client5.map)({ + $metadata: deserializeMetadata(output) + }); + const data = (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.expectObject)(await (0, import_core22.parseJsonBody)(output.body, context)), "body"); + const doc = (0, import_smithy_client5.take)(data, { + deviceCode: import_smithy_client5.expectString, + expiresIn: import_smithy_client5.expectInt32, + interval: import_smithy_client5.expectInt32, + userCode: import_smithy_client5.expectString, + verificationUri: import_smithy_client5.expectString, + verificationUriComplete: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + return contents; + }, "de_StartDeviceAuthorizationCommand"); + var de_CommandError = /* @__PURE__ */ __name(async (output, context) => { const parsedOutput = { ...output, - body: await parseErrorBody(output.body, context) + body: await (0, import_core22.parseJsonErrorBody)(output.body, context) }; - const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + const errorCode = (0, import_core22.loadRestJsonErrorCode)(output, parsedOutput.body); switch (errorCode) { - case "ConflictException": - case "com.amazonaws.sfn#ConflictException": - throw await de_ConflictExceptionRes(parsedOutput, context); - case "InvalidArn": - case "com.amazonaws.sfn#InvalidArn": - throw await de_InvalidArnRes(parsedOutput, context); - case "ResourceNotFound": - case "com.amazonaws.sfn#ResourceNotFound": - throw await de_ResourceNotFoundRes(parsedOutput, context); - case "ValidationException": - case "com.amazonaws.sfn#ValidationException": - throw await de_ValidationExceptionRes(parsedOutput, context); + case "AccessDeniedException": + case "com.amazonaws.ssooidc#AccessDeniedException": + throw await de_AccessDeniedExceptionRes(parsedOutput, context); + case "AuthorizationPendingException": + case "com.amazonaws.ssooidc#AuthorizationPendingException": + throw await de_AuthorizationPendingExceptionRes(parsedOutput, context); + case "ExpiredTokenException": + case "com.amazonaws.ssooidc#ExpiredTokenException": + throw await de_ExpiredTokenExceptionRes(parsedOutput, context); + case "InternalServerException": + case "com.amazonaws.ssooidc#InternalServerException": + throw await de_InternalServerExceptionRes(parsedOutput, context); + case "InvalidClientException": + case "com.amazonaws.ssooidc#InvalidClientException": + throw await de_InvalidClientExceptionRes(parsedOutput, context); + case "InvalidGrantException": + case "com.amazonaws.ssooidc#InvalidGrantException": + throw await de_InvalidGrantExceptionRes(parsedOutput, context); + case "InvalidRequestException": + case "com.amazonaws.ssooidc#InvalidRequestException": + throw await de_InvalidRequestExceptionRes(parsedOutput, context); + case "InvalidScopeException": + case "com.amazonaws.ssooidc#InvalidScopeException": + throw await de_InvalidScopeExceptionRes(parsedOutput, context); + case "SlowDownException": + case "com.amazonaws.ssooidc#SlowDownException": + throw await de_SlowDownExceptionRes(parsedOutput, context); + case "UnauthorizedClientException": + case "com.amazonaws.ssooidc#UnauthorizedClientException": + throw await de_UnauthorizedClientExceptionRes(parsedOutput, context); + case "UnsupportedGrantTypeException": + case "com.amazonaws.ssooidc#UnsupportedGrantTypeException": + throw await de_UnsupportedGrantTypeExceptionRes(parsedOutput, context); + case "InvalidRequestRegionException": + case "com.amazonaws.ssooidc#InvalidRequestRegionException": + throw await de_InvalidRequestRegionExceptionRes(parsedOutput, context); + case "InvalidClientMetadataException": + case "com.amazonaws.ssooidc#InvalidClientMetadataException": + throw await de_InvalidClientMetadataExceptionRes(parsedOutput, context); + case "InvalidRedirectUriException": + case "com.amazonaws.ssooidc#InvalidRedirectUriException": + throw await de_InvalidRedirectUriExceptionRes(parsedOutput, context); default: const parsedBody = parsedOutput.body; return throwDefaultError({ @@ -19690,590 +19818,2227 @@ var require_Aws_json1_0 = __commonJS({ errorCode }); } - }; - var de_ActivityDoesNotExistRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.ActivityDoesNotExist({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized + }, "de_CommandError"); + var throwDefaultError = (0, import_smithy_client5.withBaseException)(SSOOIDCServiceException); + var de_AccessDeniedExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_ActivityLimitExceededRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.ActivityLimitExceeded({ + Object.assign(contents, doc); + const exception = new AccessDeniedException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_ActivityWorkerLimitExceededRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.ActivityWorkerLimitExceeded({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_AccessDeniedExceptionRes"); + var de_AuthorizationPendingExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_ConflictExceptionRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.ConflictException({ + Object.assign(contents, doc); + const exception = new AuthorizationPendingException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_ExecutionAlreadyExistsRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.ExecutionAlreadyExists({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_AuthorizationPendingExceptionRes"); + var de_ExpiredTokenExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_ExecutionDoesNotExistRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.ExecutionDoesNotExist({ + Object.assign(contents, doc); + const exception = new ExpiredTokenException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_ExecutionLimitExceededRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.ExecutionLimitExceeded({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_ExpiredTokenExceptionRes"); + var de_InternalServerExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_InvalidArnRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.InvalidArn({ + Object.assign(contents, doc); + const exception = new InternalServerException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_InvalidDefinitionRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.InvalidDefinition({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_InternalServerExceptionRes"); + var de_InvalidClientExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_InvalidExecutionInputRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.InvalidExecutionInput({ + Object.assign(contents, doc); + const exception = new InvalidClientException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_InvalidLoggingConfigurationRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.InvalidLoggingConfiguration({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_InvalidClientExceptionRes"); + var de_InvalidClientMetadataExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_InvalidNameRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.InvalidName({ + Object.assign(contents, doc); + const exception = new InvalidClientMetadataException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_InvalidOutputRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.InvalidOutput({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_InvalidClientMetadataExceptionRes"); + var de_InvalidGrantExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_InvalidTokenRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.InvalidToken({ + Object.assign(contents, doc); + const exception = new InvalidGrantException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_InvalidTracingConfigurationRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.InvalidTracingConfiguration({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_InvalidGrantExceptionRes"); + var de_InvalidRedirectUriExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_MissingRequiredParameterRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.MissingRequiredParameter({ + Object.assign(contents, doc); + const exception = new InvalidRedirectUriException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_ResourceNotFoundRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.ResourceNotFound({ + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_InvalidRedirectUriExceptionRes"); + var de_InvalidRequestExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + const exception = new InvalidRequestException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_ServiceQuotaExceededExceptionRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.ServiceQuotaExceededException({ + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_InvalidRequestExceptionRes"); + var de_InvalidRequestRegionExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + endpoint: import_smithy_client5.expectString, + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString, + region: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + const exception = new InvalidRequestRegionException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_StateMachineAlreadyExistsRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.StateMachineAlreadyExists({ + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_InvalidRequestRegionExceptionRes"); + var de_InvalidScopeExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + const exception = new InvalidScopeException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_StateMachineDeletingRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.StateMachineDeleting({ + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_InvalidScopeExceptionRes"); + var de_SlowDownExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + const exception = new SlowDownException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_StateMachineDoesNotExistRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.StateMachineDoesNotExist({ + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_SlowDownExceptionRes"); + var de_UnauthorizedClientExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + const exception = new UnauthorizedClientException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); - }; - var de_StateMachineLimitExceededRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.StateMachineLimitExceeded({ + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_UnauthorizedClientExceptionRes"); + var de_UnsupportedGrantTypeExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const contents = (0, import_smithy_client5.map)({}); + const data = parsedOutput.body; + const doc = (0, import_smithy_client5.take)(data, { + error: import_smithy_client5.expectString, + error_description: import_smithy_client5.expectString + }); + Object.assign(contents, doc); + const exception = new UnsupportedGrantTypeException({ $metadata: deserializeMetadata(parsedOutput), - ...deserialized + ...contents }); - return (0, smithy_client_1.decorateServiceException)(exception, body); + return (0, import_smithy_client5.decorateServiceException)(exception, parsedOutput.body); + }, "de_UnsupportedGrantTypeExceptionRes"); + var deserializeMetadata = /* @__PURE__ */ __name((output) => ({ + httpStatusCode: output.statusCode, + requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"], + extendedRequestId: output.headers["x-amz-id-2"], + cfId: output.headers["x-amz-cf-id"] + }), "deserializeMetadata"); + var _ai = "aws_iam"; + var _CreateTokenCommand = class _CreateTokenCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSSSOOIDCService", "CreateToken", {}).n("SSOOIDCClient", "CreateTokenCommand").f(CreateTokenRequestFilterSensitiveLog, CreateTokenResponseFilterSensitiveLog).ser(se_CreateTokenCommand).de(de_CreateTokenCommand).build() { + }; + __name(_CreateTokenCommand, "CreateTokenCommand"); + var CreateTokenCommand = _CreateTokenCommand; + var _CreateTokenWithIAMCommand = class _CreateTokenWithIAMCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSSSOOIDCService", "CreateTokenWithIAM", {}).n("SSOOIDCClient", "CreateTokenWithIAMCommand").f(CreateTokenWithIAMRequestFilterSensitiveLog, CreateTokenWithIAMResponseFilterSensitiveLog).ser(se_CreateTokenWithIAMCommand).de(de_CreateTokenWithIAMCommand).build() { + }; + __name(_CreateTokenWithIAMCommand, "CreateTokenWithIAMCommand"); + var CreateTokenWithIAMCommand = _CreateTokenWithIAMCommand; + var _RegisterClientCommand = class _RegisterClientCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSSSOOIDCService", "RegisterClient", {}).n("SSOOIDCClient", "RegisterClientCommand").f(void 0, RegisterClientResponseFilterSensitiveLog).ser(se_RegisterClientCommand).de(de_RegisterClientCommand).build() { + }; + __name(_RegisterClientCommand, "RegisterClientCommand"); + var RegisterClientCommand = _RegisterClientCommand; + var _StartDeviceAuthorizationCommand = class _StartDeviceAuthorizationCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSSSOOIDCService", "StartDeviceAuthorization", {}).n("SSOOIDCClient", "StartDeviceAuthorizationCommand").f(StartDeviceAuthorizationRequestFilterSensitiveLog, void 0).ser(se_StartDeviceAuthorizationCommand).de(de_StartDeviceAuthorizationCommand).build() { + }; + __name(_StartDeviceAuthorizationCommand, "StartDeviceAuthorizationCommand"); + var StartDeviceAuthorizationCommand = _StartDeviceAuthorizationCommand; + var commands = { + CreateTokenCommand, + CreateTokenWithIAMCommand, + RegisterClientCommand, + StartDeviceAuthorizationCommand + }; + var _SSOOIDC = class _SSOOIDC extends SSOOIDCClient { + }; + __name(_SSOOIDC, "SSOOIDC"); + var SSOOIDC = _SSOOIDC; + (0, import_smithy_client5.createAggregatedClient)(commands, SSOOIDC); + } +}); + +// ../../../node_modules/@aws-sdk/token-providers/dist-cjs/index.js +var require_dist_cjs73 = __commonJS({ + "../../../node_modules/@aws-sdk/token-providers/dist-cjs/index.js"(exports2, module2) { + "use strict"; + var __create2 = Object.create; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __getProtoOf2 = Object.getPrototypeOf; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; + }; + var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, + mod + )); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + fromSso: () => fromSso, + fromStatic: () => fromStatic, + nodeProvider: () => nodeProvider + }); + module2.exports = __toCommonJS2(src_exports); + var EXPIRE_WINDOW_MS = 5 * 60 * 1e3; + var REFRESH_MESSAGE = `To refresh this SSO session run 'aws sso login' with the corresponding profile.`; + var ssoOidcClientsHash = {}; + var getSsoOidcClient = /* @__PURE__ */ __name(async (ssoRegion) => { + const { SSOOIDCClient } = await Promise.resolve().then(() => __toESM2(require_dist_cjs72())); + if (ssoOidcClientsHash[ssoRegion]) { + return ssoOidcClientsHash[ssoRegion]; + } + const ssoOidcClient = new SSOOIDCClient({ region: ssoRegion }); + ssoOidcClientsHash[ssoRegion] = ssoOidcClient; + return ssoOidcClient; + }, "getSsoOidcClient"); + var getNewSsoOidcToken = /* @__PURE__ */ __name(async (ssoToken, ssoRegion) => { + const { CreateTokenCommand } = await Promise.resolve().then(() => __toESM2(require_dist_cjs72())); + const ssoOidcClient = await getSsoOidcClient(ssoRegion); + return ssoOidcClient.send( + new CreateTokenCommand({ + clientId: ssoToken.clientId, + clientSecret: ssoToken.clientSecret, + refreshToken: ssoToken.refreshToken, + grantType: "refresh_token" + }) + ); + }, "getNewSsoOidcToken"); + var import_property_provider2 = require_dist_cjs40(); + var validateTokenExpiry = /* @__PURE__ */ __name((token) => { + if (token.expiration && token.expiration.getTime() < Date.now()) { + throw new import_property_provider2.TokenProviderError(`Token is expired. ${REFRESH_MESSAGE}`, false); + } + }, "validateTokenExpiry"); + var validateTokenKey = /* @__PURE__ */ __name((key, value, forRefresh = false) => { + if (typeof value === "undefined") { + throw new import_property_provider2.TokenProviderError( + `Value not present for '${key}' in SSO Token${forRefresh ? ". Cannot refresh" : ""}. ${REFRESH_MESSAGE}`, + false + ); + } + }, "validateTokenKey"); + var import_shared_ini_file_loader = require_dist_cjs41(); + var import_fs = require("fs"); + var { writeFile } = import_fs.promises; + var writeSSOTokenToFile = /* @__PURE__ */ __name((id, ssoToken) => { + const tokenFilepath = (0, import_shared_ini_file_loader.getSSOTokenFilepath)(id); + const tokenString = JSON.stringify(ssoToken, null, 2); + return writeFile(tokenFilepath, tokenString); + }, "writeSSOTokenToFile"); + var lastRefreshAttemptTime = /* @__PURE__ */ new Date(0); + var fromSso = /* @__PURE__ */ __name((init = {}) => async () => { + var _a; + (_a = init.logger) == null ? void 0 : _a.debug("@aws-sdk/token-providers - fromSso"); + const profiles = await (0, import_shared_ini_file_loader.parseKnownFiles)(init); + const profileName = (0, import_shared_ini_file_loader.getProfileName)(init); + const profile = profiles[profileName]; + if (!profile) { + throw new import_property_provider2.TokenProviderError(`Profile '${profileName}' could not be found in shared credentials file.`, false); + } else if (!profile["sso_session"]) { + throw new import_property_provider2.TokenProviderError(`Profile '${profileName}' is missing required property 'sso_session'.`); + } + const ssoSessionName = profile["sso_session"]; + const ssoSessions = await (0, import_shared_ini_file_loader.loadSsoSessionData)(init); + const ssoSession = ssoSessions[ssoSessionName]; + if (!ssoSession) { + throw new import_property_provider2.TokenProviderError( + `Sso session '${ssoSessionName}' could not be found in shared credentials file.`, + false + ); + } + for (const ssoSessionRequiredKey of ["sso_start_url", "sso_region"]) { + if (!ssoSession[ssoSessionRequiredKey]) { + throw new import_property_provider2.TokenProviderError( + `Sso session '${ssoSessionName}' is missing required property '${ssoSessionRequiredKey}'.`, + false + ); + } + } + const ssoStartUrl = ssoSession["sso_start_url"]; + const ssoRegion = ssoSession["sso_region"]; + let ssoToken; + try { + ssoToken = await (0, import_shared_ini_file_loader.getSSOTokenFromFile)(ssoSessionName); + } catch (e) { + throw new import_property_provider2.TokenProviderError( + `The SSO session token associated with profile=${profileName} was not found or is invalid. ${REFRESH_MESSAGE}`, + false + ); + } + validateTokenKey("accessToken", ssoToken.accessToken); + validateTokenKey("expiresAt", ssoToken.expiresAt); + const { accessToken, expiresAt } = ssoToken; + const existingToken = { token: accessToken, expiration: new Date(expiresAt) }; + if (existingToken.expiration.getTime() - Date.now() > EXPIRE_WINDOW_MS) { + return existingToken; + } + if (Date.now() - lastRefreshAttemptTime.getTime() < 30 * 1e3) { + validateTokenExpiry(existingToken); + return existingToken; + } + validateTokenKey("clientId", ssoToken.clientId, true); + validateTokenKey("clientSecret", ssoToken.clientSecret, true); + validateTokenKey("refreshToken", ssoToken.refreshToken, true); + try { + lastRefreshAttemptTime.setTime(Date.now()); + const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion); + validateTokenKey("accessToken", newSsoOidcToken.accessToken); + validateTokenKey("expiresIn", newSsoOidcToken.expiresIn); + const newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1e3); + try { + await writeSSOTokenToFile(ssoSessionName, { + ...ssoToken, + accessToken: newSsoOidcToken.accessToken, + expiresAt: newTokenExpiration.toISOString(), + refreshToken: newSsoOidcToken.refreshToken + }); + } catch (error) { + } + return { + token: newSsoOidcToken.accessToken, + expiration: newTokenExpiration + }; + } catch (error) { + validateTokenExpiry(existingToken); + return existingToken; + } + }, "fromSso"); + var fromStatic = /* @__PURE__ */ __name(({ token, logger }) => async () => { + logger == null ? void 0 : logger.debug("@aws-sdk/token-providers - fromStatic"); + if (!token || !token.token) { + throw new import_property_provider2.TokenProviderError(`Please pass a valid token to fromStatic`, false); + } + return token; + }, "fromStatic"); + var nodeProvider = /* @__PURE__ */ __name((init = {}) => (0, import_property_provider2.memoize)( + (0, import_property_provider2.chain)(fromSso(init), async () => { + throw new import_property_provider2.TokenProviderError("Could not load token from any providers", false); + }), + (token) => token.expiration !== void 0 && token.expiration.getTime() - Date.now() < 3e5, + (token) => token.expiration !== void 0 + ), "nodeProvider"); + } +}); + +// ../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/index.js +var require_dist_cjs74 = __commonJS({ + "../../../node_modules/@aws-sdk/credential-provider-sso/dist-cjs/index.js"(exports2, module2) { + "use strict"; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __esm2 = (fn, res) => function __init() { + return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res; }; - var de_StateMachineTypeNotSupportedRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.StateMachineTypeNotSupported({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized - }); - return (0, smithy_client_1.decorateServiceException)(exception, body); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var de_TaskDoesNotExistRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.TaskDoesNotExist({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized - }); - return (0, smithy_client_1.decorateServiceException)(exception, body); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; }; - var de_TaskTimedOutRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.TaskTimedOut({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized - }); - return (0, smithy_client_1.decorateServiceException)(exception, body); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var loadSso_exports = {}; + __export2(loadSso_exports, { + GetRoleCredentialsCommand: () => import_client_sso.GetRoleCredentialsCommand, + SSOClient: () => import_client_sso.SSOClient + }); + var import_client_sso; + var init_loadSso = __esm2({ + "src/loadSso.ts"() { + "use strict"; + import_client_sso = require_dist_cjs71(); + } + }); + var src_exports = {}; + __export2(src_exports, { + fromSSO: () => fromSSO, + isSsoProfile: () => isSsoProfile, + validateSsoProfile: () => validateSsoProfile + }); + module2.exports = __toCommonJS2(src_exports); + var isSsoProfile = /* @__PURE__ */ __name((arg) => arg && (typeof arg.sso_start_url === "string" || typeof arg.sso_account_id === "string" || typeof arg.sso_session === "string" || typeof arg.sso_region === "string" || typeof arg.sso_role_name === "string"), "isSsoProfile"); + var import_token_providers = require_dist_cjs73(); + var import_property_provider2 = require_dist_cjs40(); + var import_shared_ini_file_loader = require_dist_cjs41(); + var SHOULD_FAIL_CREDENTIAL_CHAIN = false; + var resolveSSOCredentials = /* @__PURE__ */ __name(async ({ + ssoStartUrl, + ssoSession, + ssoAccountId, + ssoRegion, + ssoRoleName, + ssoClient, + clientConfig, + profile, + logger + }) => { + let token; + const refreshMessage = `To refresh this SSO session run aws sso login with the corresponding profile.`; + if (ssoSession) { + try { + const _token = await (0, import_token_providers.fromSso)({ profile })(); + token = { + accessToken: _token.token, + expiresAt: new Date(_token.expiration).toISOString() + }; + } catch (e) { + throw new import_property_provider2.CredentialsProviderError(e.message, { + tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN, + logger + }); + } + } else { + try { + token = await (0, import_shared_ini_file_loader.getSSOTokenFromFile)(ssoStartUrl); + } catch (e) { + throw new import_property_provider2.CredentialsProviderError(`The SSO session associated with this profile is invalid. ${refreshMessage}`, { + tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN, + logger + }); + } + } + if (new Date(token.expiresAt).getTime() - Date.now() <= 0) { + throw new import_property_provider2.CredentialsProviderError(`The SSO session associated with this profile has expired. ${refreshMessage}`, { + tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN, + logger + }); + } + const { accessToken } = token; + const { SSOClient: SSOClient2, GetRoleCredentialsCommand: GetRoleCredentialsCommand2 } = await Promise.resolve().then(() => (init_loadSso(), loadSso_exports)); + const sso = ssoClient || new SSOClient2( + Object.assign({}, clientConfig ?? {}, { + region: (clientConfig == null ? void 0 : clientConfig.region) ?? ssoRegion + }) + ); + let ssoResp; + try { + ssoResp = await sso.send( + new GetRoleCredentialsCommand2({ + accountId: ssoAccountId, + roleName: ssoRoleName, + accessToken + }) + ); + } catch (e) { + throw new import_property_provider2.CredentialsProviderError(e, { + tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN, + logger + }); + } + const { + roleCredentials: { accessKeyId, secretAccessKey, sessionToken, expiration, credentialScope, accountId } = {} + } = ssoResp; + if (!accessKeyId || !secretAccessKey || !sessionToken || !expiration) { + throw new import_property_provider2.CredentialsProviderError("SSO returns an invalid temporary credential.", { + tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN, + logger + }); + } + return { + accessKeyId, + secretAccessKey, + sessionToken, + expiration: new Date(expiration), + ...credentialScope && { credentialScope }, + ...accountId && { accountId } + }; + }, "resolveSSOCredentials"); + var validateSsoProfile = /* @__PURE__ */ __name((profile, logger) => { + const { sso_start_url, sso_account_id, sso_region, sso_role_name } = profile; + if (!sso_start_url || !sso_account_id || !sso_region || !sso_role_name) { + throw new import_property_provider2.CredentialsProviderError( + `Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", "sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(profile).join( + ", " + )} +Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`, + { tryNextLink: false, logger } + ); + } + return profile; + }, "validateSsoProfile"); + var fromSSO = /* @__PURE__ */ __name((init = {}) => async () => { + var _a; + (_a = init.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-sso - fromSSO"); + const { ssoStartUrl, ssoAccountId, ssoRegion, ssoRoleName, ssoSession } = init; + const { ssoClient } = init; + const profileName = (0, import_shared_ini_file_loader.getProfileName)(init); + if (!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession) { + const profiles = await (0, import_shared_ini_file_loader.parseKnownFiles)(init); + const profile = profiles[profileName]; + if (!profile) { + throw new import_property_provider2.CredentialsProviderError(`Profile ${profileName} was not found.`, { logger: init.logger }); + } + if (!isSsoProfile(profile)) { + throw new import_property_provider2.CredentialsProviderError(`Profile ${profileName} is not configured with SSO credentials.`, { + logger: init.logger + }); + } + if (profile == null ? void 0 : profile.sso_session) { + const ssoSessions = await (0, import_shared_ini_file_loader.loadSsoSessionData)(init); + const session = ssoSessions[profile.sso_session]; + const conflictMsg = ` configurations in profile ${profileName} and sso-session ${profile.sso_session}`; + if (ssoRegion && ssoRegion !== session.sso_region) { + throw new import_property_provider2.CredentialsProviderError(`Conflicting SSO region` + conflictMsg, { + tryNextLink: false, + logger: init.logger + }); + } + if (ssoStartUrl && ssoStartUrl !== session.sso_start_url) { + throw new import_property_provider2.CredentialsProviderError(`Conflicting SSO start_url` + conflictMsg, { + tryNextLink: false, + logger: init.logger + }); + } + profile.sso_region = session.sso_region; + profile.sso_start_url = session.sso_start_url; + } + const { sso_start_url, sso_account_id, sso_region, sso_role_name, sso_session } = validateSsoProfile( + profile, + init.logger + ); + return resolveSSOCredentials({ + ssoStartUrl: sso_start_url, + ssoSession: sso_session, + ssoAccountId: sso_account_id, + ssoRegion: sso_region, + ssoRoleName: sso_role_name, + ssoClient, + clientConfig: init.clientConfig, + profile: profileName + }); + } else if (!ssoStartUrl || !ssoAccountId || !ssoRegion || !ssoRoleName) { + throw new import_property_provider2.CredentialsProviderError( + 'Incomplete configuration. The fromSSO() argument hash must include "ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"', + { tryNextLink: false, logger: init.logger } + ); + } else { + return resolveSSOCredentials({ + ssoStartUrl, + ssoSession, + ssoAccountId, + ssoRegion, + ssoRoleName, + ssoClient, + clientConfig: init.clientConfig, + profile: profileName + }); + } + }, "fromSSO"); + } +}); + +// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/auth/httpAuthSchemeProvider.js +var require_httpAuthSchemeProvider4 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sts/dist-cjs/auth/httpAuthSchemeProvider.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.resolveHttpAuthSchemeConfig = exports2.resolveStsAuthConfig = exports2.defaultSTSHttpAuthSchemeProvider = exports2.defaultSTSHttpAuthSchemeParametersProvider = void 0; + var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var util_middleware_1 = require_dist_cjs10(); + var STSClient_1 = require_STSClient(); + var defaultSTSHttpAuthSchemeParametersProvider = async (config, context, input) => { + return { + operation: (0, util_middleware_1.getSmithyContext)(context).operation, + region: await (0, util_middleware_1.normalizeProvider)(config.region)() || (() => { + throw new Error("expected `region` to be configured for `aws.auth#sigv4`"); + })() + }; }; - var de_TooManyTagsRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.TooManyTags({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized - }); - return (0, smithy_client_1.decorateServiceException)(exception, body); + exports2.defaultSTSHttpAuthSchemeParametersProvider = defaultSTSHttpAuthSchemeParametersProvider; + function createAwsAuthSigv4HttpAuthOption(authParameters) { + return { + schemeId: "aws.auth#sigv4", + signingProperties: { + name: "sts", + region: authParameters.region + }, + propertiesExtractor: (config, context) => ({ + signingProperties: { + config, + context + } + }) + }; + } + function createSmithyApiNoAuthHttpAuthOption(authParameters) { + return { + schemeId: "smithy.api#noAuth" + }; + } + var defaultSTSHttpAuthSchemeProvider = (authParameters) => { + const options = []; + switch (authParameters.operation) { + case "AssumeRoleWithSAML": { + options.push(createSmithyApiNoAuthHttpAuthOption(authParameters)); + break; + } + case "AssumeRoleWithWebIdentity": { + options.push(createSmithyApiNoAuthHttpAuthOption(authParameters)); + break; + } + default: { + options.push(createAwsAuthSigv4HttpAuthOption(authParameters)); + } + } + return options; }; - var de_ValidationExceptionRes = async (parsedOutput, context) => { - const body = parsedOutput.body; - const deserialized = (0, smithy_client_1._json)(body); - const exception = new models_0_1.ValidationException({ - $metadata: deserializeMetadata(parsedOutput), - ...deserialized - }); - return (0, smithy_client_1.decorateServiceException)(exception, body); + exports2.defaultSTSHttpAuthSchemeProvider = defaultSTSHttpAuthSchemeProvider; + var resolveStsAuthConfig = (input) => ({ + ...input, + stsClientCtor: STSClient_1.STSClient + }); + exports2.resolveStsAuthConfig = resolveStsAuthConfig; + var resolveHttpAuthSchemeConfig = (config) => { + const config_0 = (0, exports2.resolveStsAuthConfig)(config); + const config_1 = (0, core_1.resolveAwsSdkSigV4Config)(config_0); + return { + ...config_1 + }; }; - var se_UpdateMapRunInput = (input, context) => { - return (0, smithy_client_1.take)(input, { - mapRunArn: [], - maxConcurrency: [], - toleratedFailureCount: [], - toleratedFailurePercentage: smithy_client_1.serializeFloat - }); + exports2.resolveHttpAuthSchemeConfig = resolveHttpAuthSchemeConfig; + } +}); + +// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/EndpointParameters.js +var require_EndpointParameters = __commonJS({ + "../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/EndpointParameters.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.commonParams = exports2.resolveClientEndpointParameters = void 0; + var resolveClientEndpointParameters = (options) => { + return { + ...options, + useDualstackEndpoint: options.useDualstackEndpoint ?? false, + useFipsEndpoint: options.useFipsEndpoint ?? false, + useGlobalEndpoint: options.useGlobalEndpoint ?? false, + defaultSigningName: "sts" + }; }; - var de_ActivityList = (output, context) => { - const retVal = (output || []).filter((e) => e != null).map((entry) => { - return de_ActivityListItem(entry, context); - }); - return retVal; + exports2.resolveClientEndpointParameters = resolveClientEndpointParameters; + exports2.commonParams = { + UseGlobalEndpoint: { type: "builtInParams", name: "useGlobalEndpoint" }, + UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, + Endpoint: { type: "builtInParams", name: "endpoint" }, + Region: { type: "builtInParams", name: "region" }, + UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } }; - var de_ActivityListItem = (output, context) => { - return (0, smithy_client_1.take)(output, { - activityArn: smithy_client_1.expectString, - creationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - name: smithy_client_1.expectString - }); + } +}); + +// ../../../node_modules/@aws-sdk/client-sts/package.json +var require_package4 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sts/package.json"(exports2, module2) { + module2.exports = { + name: "@aws-sdk/client-sts", + description: "AWS SDK for JavaScript Sts Client for Node.js, Browser and React Native", + version: "3.632.0", + scripts: { + build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", + "build:cjs": "node ../../scripts/compilation/inline client-sts", + "build:es": "tsc -p tsconfig.es.json", + "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", + "build:types": "rimraf ./dist-types tsconfig.types.tsbuildinfo && tsc -p tsconfig.types.json", + "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4", + clean: "rimraf ./dist-* && rimraf *.tsbuildinfo", + "extract:docs": "api-extractor run --local", + "generate:client": "node ../../scripts/generate-clients/single-service --solo sts", + test: "yarn test:unit", + "test:unit": "jest" + }, + main: "./dist-cjs/index.js", + types: "./dist-types/index.d.ts", + module: "./dist-es/index.js", + sideEffects: false, + dependencies: { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/client-sso-oidc": "3.632.0", + "@aws-sdk/core": "3.629.0", + "@aws-sdk/credential-provider-node": "3.632.0", + "@aws-sdk/middleware-host-header": "3.620.0", + "@aws-sdk/middleware-logger": "3.609.0", + "@aws-sdk/middleware-recursion-detection": "3.620.0", + "@aws-sdk/middleware-user-agent": "3.632.0", + "@aws-sdk/region-config-resolver": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.632.0", + "@aws-sdk/util-user-agent-browser": "3.609.0", + "@aws-sdk/util-user-agent-node": "3.614.0", + "@smithy/config-resolver": "^3.0.5", + "@smithy/core": "^2.3.2", + "@smithy/fetch-http-handler": "^3.2.4", + "@smithy/hash-node": "^3.0.3", + "@smithy/invalid-dependency": "^3.0.3", + "@smithy/middleware-content-length": "^3.0.5", + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.14", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", + "@smithy/util-base64": "^3.0.0", + "@smithy/util-body-length-browser": "^3.0.0", + "@smithy/util-body-length-node": "^3.0.0", + "@smithy/util-defaults-mode-browser": "^3.0.14", + "@smithy/util-defaults-mode-node": "^3.0.14", + "@smithy/util-endpoints": "^2.0.5", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", + "@smithy/util-utf8": "^3.0.0", + tslib: "^2.6.2" + }, + devDependencies: { + "@tsconfig/node16": "16.1.3", + "@types/node": "^16.18.96", + concurrently: "7.0.0", + "downlevel-dts": "0.10.1", + rimraf: "3.0.2", + typescript: "~4.9.5" + }, + engines: { + node: ">=16.0.0" + }, + typesVersions: { + "<4.0": { + "dist-types/*": [ + "dist-types/ts3.4/*" + ] + } + }, + files: [ + "dist-*/**" + ], + author: { + name: "AWS SDK for JavaScript Team", + url: "https://aws.amazon.com/javascript/" + }, + license: "Apache-2.0", + browser: { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" + }, + "react-native": { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" + }, + homepage: "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-sts", + repository: { + type: "git", + url: "https://github.com/aws/aws-sdk-js-v3.git", + directory: "clients/client-sts" + } }; - var de_CreateActivityOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - activityArn: smithy_client_1.expectString, - creationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))) + } +}); + +// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/ruleset.js +var require_ruleset3 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/ruleset.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ruleSet = void 0; + var F = "required"; + var G = "type"; + var H = "fn"; + var I = "argv"; + var J = "ref"; + var a = false; + var b = true; + var c = "booleanEquals"; + var d = "stringEquals"; + var e = "sigv4"; + var f = "sts"; + var g = "us-east-1"; + var h = "endpoint"; + var i = "https://sts.{Region}.{PartitionResult#dnsSuffix}"; + var j = "tree"; + var k = "error"; + var l = "getAttr"; + var m = { [F]: false, [G]: "String" }; + var n = { [F]: true, "default": false, [G]: "Boolean" }; + var o = { [J]: "Endpoint" }; + var p = { [H]: "isSet", [I]: [{ [J]: "Region" }] }; + var q = { [J]: "Region" }; + var r = { [H]: "aws.partition", [I]: [q], "assign": "PartitionResult" }; + var s = { [J]: "UseFIPS" }; + var t = { [J]: "UseDualStack" }; + var u = { "url": "https://sts.amazonaws.com", "properties": { "authSchemes": [{ "name": e, "signingName": f, "signingRegion": g }] }, "headers": {} }; + var v = {}; + var w = { "conditions": [{ [H]: d, [I]: [q, "aws-global"] }], [h]: u, [G]: h }; + var x = { [H]: c, [I]: [s, true] }; + var y = { [H]: c, [I]: [t, true] }; + var z = { [H]: l, [I]: [{ [J]: "PartitionResult" }, "supportsFIPS"] }; + var A = { [J]: "PartitionResult" }; + var B = { [H]: c, [I]: [true, { [H]: l, [I]: [A, "supportsDualStack"] }] }; + var C = [{ [H]: "isSet", [I]: [o] }]; + var D = [x]; + var E = [y]; + var _data = { version: "1.0", parameters: { Region: m, UseDualStack: n, UseFIPS: n, Endpoint: m, UseGlobalEndpoint: n }, rules: [{ conditions: [{ [H]: c, [I]: [{ [J]: "UseGlobalEndpoint" }, b] }, { [H]: "not", [I]: C }, p, r, { [H]: c, [I]: [s, a] }, { [H]: c, [I]: [t, a] }], rules: [{ conditions: [{ [H]: d, [I]: [q, "ap-northeast-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "ap-south-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "ap-southeast-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "ap-southeast-2"] }], endpoint: u, [G]: h }, w, { conditions: [{ [H]: d, [I]: [q, "ca-central-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-central-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-north-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-west-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-west-2"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-west-3"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "sa-east-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, g] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "us-east-2"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "us-west-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "us-west-2"] }], endpoint: u, [G]: h }, { endpoint: { url: i, properties: { authSchemes: [{ name: e, signingName: f, signingRegion: "{Region}" }] }, headers: v }, [G]: h }], [G]: j }, { conditions: C, rules: [{ conditions: D, error: "Invalid Configuration: FIPS and custom endpoint are not supported", [G]: k }, { conditions: E, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", [G]: k }, { endpoint: { url: o, properties: v, headers: v }, [G]: h }], [G]: j }, { conditions: [p], rules: [{ conditions: [r], rules: [{ conditions: [x, y], rules: [{ conditions: [{ [H]: c, [I]: [b, z] }, B], rules: [{ endpoint: { url: "https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: v, headers: v }, [G]: h }], [G]: j }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", [G]: k }], [G]: j }, { conditions: D, rules: [{ conditions: [{ [H]: c, [I]: [z, b] }], rules: [{ conditions: [{ [H]: d, [I]: [{ [H]: l, [I]: [A, "name"] }, "aws-us-gov"] }], endpoint: { url: "https://sts.{Region}.amazonaws.com", properties: v, headers: v }, [G]: h }, { endpoint: { url: "https://sts-fips.{Region}.{PartitionResult#dnsSuffix}", properties: v, headers: v }, [G]: h }], [G]: j }, { error: "FIPS is enabled but this partition does not support FIPS", [G]: k }], [G]: j }, { conditions: E, rules: [{ conditions: [B], rules: [{ endpoint: { url: "https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: v, headers: v }, [G]: h }], [G]: j }, { error: "DualStack is enabled but this partition does not support DualStack", [G]: k }], [G]: j }, w, { endpoint: { url: i, properties: v, headers: v }, [G]: h }], [G]: j }], [G]: j }, { error: "Invalid Configuration: Missing Region", [G]: k }] }; + exports2.ruleSet = _data; + } +}); + +// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/endpointResolver.js +var require_endpointResolver3 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/endpointResolver.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.defaultEndpointResolver = void 0; + var util_endpoints_1 = require_dist_cjs7(); + var util_endpoints_2 = require_dist_cjs6(); + var ruleset_1 = require_ruleset3(); + var defaultEndpointResolver = (endpointParams, context = {}) => { + return (0, util_endpoints_2.resolveEndpoint)(ruleset_1.ruleSet, { + endpointParams, + logger: context.logger }); }; - var de_CreateStateMachineAliasOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - creationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - stateMachineAliasArn: smithy_client_1.expectString - }); + exports2.defaultEndpointResolver = defaultEndpointResolver; + util_endpoints_2.customEndpointFunctions.aws = util_endpoints_1.awsEndpointFunctions; + } +}); + +// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.shared.js +var require_runtimeConfig_shared3 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.shared.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getRuntimeConfig = void 0; + var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var core_2 = (init_dist_es(), __toCommonJS(dist_es_exports)); + var smithy_client_1 = require_dist_cjs37(); + var url_parser_1 = require_dist_cjs44(); + var util_base64_1 = require_dist_cjs29(); + var util_utf8_1 = require_dist_cjs28(); + var httpAuthSchemeProvider_1 = require_httpAuthSchemeProvider4(); + var endpointResolver_1 = require_endpointResolver3(); + var getRuntimeConfig = (config) => { + return { + apiVersion: "2011-06-15", + base64Decoder: config?.base64Decoder ?? util_base64_1.fromBase64, + base64Encoder: config?.base64Encoder ?? util_base64_1.toBase64, + disableHostPrefix: config?.disableHostPrefix ?? false, + endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver, + extensions: config?.extensions ?? [], + httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? httpAuthSchemeProvider_1.defaultSTSHttpAuthSchemeProvider, + httpAuthSchemes: config?.httpAuthSchemes ?? [ + { + schemeId: "aws.auth#sigv4", + identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"), + signer: new core_1.AwsSdkSigV4Signer() + }, + { + schemeId: "smithy.api#noAuth", + identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})), + signer: new core_2.NoAuthSigner() + } + ], + logger: config?.logger ?? new smithy_client_1.NoOpLogger(), + serviceId: config?.serviceId ?? "STS", + urlParser: config?.urlParser ?? url_parser_1.parseUrl, + utf8Decoder: config?.utf8Decoder ?? util_utf8_1.fromUtf8, + utf8Encoder: config?.utf8Encoder ?? util_utf8_1.toUtf8 + }; }; - var de_CreateStateMachineOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - creationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - stateMachineArn: smithy_client_1.expectString, - stateMachineVersionArn: smithy_client_1.expectString - }); + exports2.getRuntimeConfig = getRuntimeConfig; + } +}); + +// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.js +var require_runtimeConfig3 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getRuntimeConfig = void 0; + var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); + var package_json_1 = tslib_1.__importDefault(require_package4()); + var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var credential_provider_node_1 = require_dist_cjs79(); + var util_user_agent_node_1 = require_dist_cjs56(); + var config_resolver_1 = require_dist_cjs11(); + var core_2 = (init_dist_es(), __toCommonJS(dist_es_exports)); + var hash_node_1 = require_dist_cjs57(); + var middleware_retry_1 = require_dist_cjs38(); + var node_config_provider_1 = require_dist_cjs42(); + var node_http_handler_1 = require_dist_cjs51(); + var util_body_length_node_1 = require_dist_cjs58(); + var util_retry_1 = require_dist_cjs60(); + var runtimeConfig_shared_1 = require_runtimeConfig_shared3(); + var smithy_client_1 = require_dist_cjs37(); + var util_defaults_mode_node_1 = require_dist_cjs69(); + var smithy_client_2 = require_dist_cjs37(); + var getRuntimeConfig = (config) => { + (0, smithy_client_2.emitWarningIfUnsupportedVersion)(process.version); + const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config); + const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode); + const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config); + (0, core_1.emitWarningIfUnsupportedVersion)(process.version); + return { + ...clientSharedValues, + ...config, + runtime: "node", + defaultsMode, + bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength, + credentialDefaultProvider: config?.credentialDefaultProvider ?? credential_provider_node_1.defaultProvider, + defaultUserAgentProvider: config?.defaultUserAgentProvider ?? (0, util_user_agent_node_1.defaultUserAgent)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }), + httpAuthSchemes: config?.httpAuthSchemes ?? [ + { + schemeId: "aws.auth#sigv4", + identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4") || (async (idProps) => await (0, credential_provider_node_1.defaultProvider)(idProps?.__config || {})()), + signer: new core_1.AwsSdkSigV4Signer() + }, + { + schemeId: "smithy.api#noAuth", + identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})), + signer: new core_2.NoAuthSigner() + } + ], + maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config?.region ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_REGION_CONFIG_OPTIONS, config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: node_http_handler_1.NodeHttpHandler.create(config?.requestHandler ?? defaultConfigProvider), + retryMode: config?.retryMode ?? (0, node_config_provider_1.loadConfig)({ + ...middleware_retry_1.NODE_RETRY_MODE_CONFIG_OPTIONS, + default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE + }), + sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, "sha256"), + streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector, + useDualstackEndpoint: config?.useDualstackEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), + useFipsEndpoint: config?.useFipsEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS) + }; }; - var de_DescribeActivityOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - activityArn: smithy_client_1.expectString, - creationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - name: smithy_client_1.expectString - }); + exports2.getRuntimeConfig = getRuntimeConfig; + } +}); + +// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/auth/httpAuthExtensionConfiguration.js +var require_httpAuthExtensionConfiguration = __commonJS({ + "../../../node_modules/@aws-sdk/client-sts/dist-cjs/auth/httpAuthExtensionConfiguration.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.resolveHttpAuthRuntimeConfig = exports2.getHttpAuthExtensionConfiguration = void 0; + var getHttpAuthExtensionConfiguration = (runtimeConfig) => { + const _httpAuthSchemes = runtimeConfig.httpAuthSchemes; + let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider; + let _credentials = runtimeConfig.credentials; + return { + setHttpAuthScheme(httpAuthScheme) { + const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId); + if (index === -1) { + _httpAuthSchemes.push(httpAuthScheme); + } else { + _httpAuthSchemes.splice(index, 1, httpAuthScheme); + } + }, + httpAuthSchemes() { + return _httpAuthSchemes; + }, + setHttpAuthSchemeProvider(httpAuthSchemeProvider) { + _httpAuthSchemeProvider = httpAuthSchemeProvider; + }, + httpAuthSchemeProvider() { + return _httpAuthSchemeProvider; + }, + setCredentials(credentials) { + _credentials = credentials; + }, + credentials() { + return _credentials; + } + }; }; - var de_DescribeExecutionOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - cause: smithy_client_1.expectString, - error: smithy_client_1.expectString, - executionArn: smithy_client_1.expectString, - input: smithy_client_1.expectString, - inputDetails: smithy_client_1._json, - mapRunArn: smithy_client_1.expectString, - name: smithy_client_1.expectString, - output: smithy_client_1.expectString, - outputDetails: smithy_client_1._json, - startDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - stateMachineAliasArn: smithy_client_1.expectString, - stateMachineArn: smithy_client_1.expectString, - stateMachineVersionArn: smithy_client_1.expectString, - status: smithy_client_1.expectString, - stopDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - traceHeader: smithy_client_1.expectString - }); + exports2.getHttpAuthExtensionConfiguration = getHttpAuthExtensionConfiguration; + var resolveHttpAuthRuntimeConfig = (config) => { + return { + httpAuthSchemes: config.httpAuthSchemes(), + httpAuthSchemeProvider: config.httpAuthSchemeProvider(), + credentials: config.credentials() + }; }; - var de_DescribeMapRunOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - executionArn: smithy_client_1.expectString, - executionCounts: smithy_client_1._json, - itemCounts: smithy_client_1._json, - mapRunArn: smithy_client_1.expectString, - maxConcurrency: smithy_client_1.expectInt32, - startDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - status: smithy_client_1.expectString, - stopDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - toleratedFailureCount: smithy_client_1.expectLong, - toleratedFailurePercentage: smithy_client_1.limitedParseFloat32 - }); + exports2.resolveHttpAuthRuntimeConfig = resolveHttpAuthRuntimeConfig; + } +}); + +// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeExtensions.js +var require_runtimeExtensions = __commonJS({ + "../../../node_modules/@aws-sdk/client-sts/dist-cjs/runtimeExtensions.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.resolveRuntimeExtensions = void 0; + var region_config_resolver_1 = require_dist_cjs70(); + var protocol_http_1 = require_dist_cjs2(); + var smithy_client_1 = require_dist_cjs37(); + var httpAuthExtensionConfiguration_1 = require_httpAuthExtensionConfiguration(); + var asPartial = (t) => t; + var resolveRuntimeExtensions = (runtimeConfig, extensions) => { + const extensionConfiguration = { + ...asPartial((0, region_config_resolver_1.getAwsRegionExtensionConfiguration)(runtimeConfig)), + ...asPartial((0, smithy_client_1.getDefaultExtensionConfiguration)(runtimeConfig)), + ...asPartial((0, protocol_http_1.getHttpHandlerExtensionConfiguration)(runtimeConfig)), + ...asPartial((0, httpAuthExtensionConfiguration_1.getHttpAuthExtensionConfiguration)(runtimeConfig)) + }; + extensions.forEach((extension) => extension.configure(extensionConfiguration)); + return { + ...runtimeConfig, + ...(0, region_config_resolver_1.resolveAwsRegionExtensionConfiguration)(extensionConfiguration), + ...(0, smithy_client_1.resolveDefaultRuntimeConfig)(extensionConfiguration), + ...(0, protocol_http_1.resolveHttpHandlerRuntimeConfig)(extensionConfiguration), + ...(0, httpAuthExtensionConfiguration_1.resolveHttpAuthRuntimeConfig)(extensionConfiguration) + }; }; - var de_DescribeStateMachineAliasOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - creationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - description: smithy_client_1.expectString, - name: smithy_client_1.expectString, - routingConfiguration: smithy_client_1._json, - stateMachineAliasArn: smithy_client_1.expectString, - updateDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))) - }); + exports2.resolveRuntimeExtensions = resolveRuntimeExtensions; + } +}); + +// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/STSClient.js +var require_STSClient = __commonJS({ + "../../../node_modules/@aws-sdk/client-sts/dist-cjs/STSClient.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.STSClient = exports2.__Client = void 0; + var middleware_host_header_1 = require_dist_cjs3(); + var middleware_logger_1 = require_dist_cjs4(); + var middleware_recursion_detection_1 = require_dist_cjs5(); + var middleware_user_agent_1 = require_dist_cjs8(); + var config_resolver_1 = require_dist_cjs11(); + var core_1 = (init_dist_es(), __toCommonJS(dist_es_exports)); + var middleware_content_length_1 = require_dist_cjs39(); + var middleware_endpoint_1 = require_dist_cjs46(); + var middleware_retry_1 = require_dist_cjs38(); + var smithy_client_1 = require_dist_cjs37(); + Object.defineProperty(exports2, "__Client", { enumerable: true, get: function() { + return smithy_client_1.Client; + } }); + var httpAuthSchemeProvider_1 = require_httpAuthSchemeProvider4(); + var EndpointParameters_1 = require_EndpointParameters(); + var runtimeConfig_1 = require_runtimeConfig3(); + var runtimeExtensions_1 = require_runtimeExtensions(); + var STSClient2 = class extends smithy_client_1.Client { + constructor(...[configuration]) { + const _config_0 = (0, runtimeConfig_1.getRuntimeConfig)(configuration || {}); + const _config_1 = (0, EndpointParameters_1.resolveClientEndpointParameters)(_config_0); + const _config_2 = (0, middleware_user_agent_1.resolveUserAgentConfig)(_config_1); + const _config_3 = (0, middleware_retry_1.resolveRetryConfig)(_config_2); + const _config_4 = (0, config_resolver_1.resolveRegionConfig)(_config_3); + const _config_5 = (0, middleware_host_header_1.resolveHostHeaderConfig)(_config_4); + const _config_6 = (0, middleware_endpoint_1.resolveEndpointConfig)(_config_5); + const _config_7 = (0, httpAuthSchemeProvider_1.resolveHttpAuthSchemeConfig)(_config_6); + const _config_8 = (0, runtimeExtensions_1.resolveRuntimeExtensions)(_config_7, configuration?.extensions || []); + super(_config_8); + this.config = _config_8; + this.middlewareStack.use((0, middleware_user_agent_1.getUserAgentPlugin)(this.config)); + this.middlewareStack.use((0, middleware_retry_1.getRetryPlugin)(this.config)); + this.middlewareStack.use((0, middleware_content_length_1.getContentLengthPlugin)(this.config)); + this.middlewareStack.use((0, middleware_host_header_1.getHostHeaderPlugin)(this.config)); + this.middlewareStack.use((0, middleware_logger_1.getLoggerPlugin)(this.config)); + this.middlewareStack.use((0, middleware_recursion_detection_1.getRecursionDetectionPlugin)(this.config)); + this.middlewareStack.use((0, core_1.getHttpAuthSchemeEndpointRuleSetPlugin)(this.config, { + httpAuthSchemeParametersProvider: httpAuthSchemeProvider_1.defaultSTSHttpAuthSchemeParametersProvider, + identityProviderConfigProvider: async (config) => new core_1.DefaultIdentityProviderConfig({ + "aws.auth#sigv4": config.credentials + }) + })); + this.middlewareStack.use((0, core_1.getHttpSigningPlugin)(this.config)); + } + destroy() { + super.destroy(); + } }; - var de_DescribeStateMachineForExecutionOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - definition: smithy_client_1.expectString, - label: smithy_client_1.expectString, - loggingConfiguration: smithy_client_1._json, - mapRunArn: smithy_client_1.expectString, - name: smithy_client_1.expectString, - revisionId: smithy_client_1.expectString, - roleArn: smithy_client_1.expectString, - stateMachineArn: smithy_client_1.expectString, - tracingConfiguration: smithy_client_1._json, - updateDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))) - }); + exports2.STSClient = STSClient2; + } +}); + +// ../../../node_modules/@aws-sdk/client-sts/dist-cjs/index.js +var require_dist_cjs75 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sts/dist-cjs/index.js"(exports2, module2) { + "use strict"; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - var de_DescribeStateMachineOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - creationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - definition: smithy_client_1.expectString, - description: smithy_client_1.expectString, - label: smithy_client_1.expectString, - loggingConfiguration: smithy_client_1._json, - name: smithy_client_1.expectString, - revisionId: smithy_client_1.expectString, - roleArn: smithy_client_1.expectString, - stateMachineArn: smithy_client_1.expectString, - status: smithy_client_1.expectString, - tracingConfiguration: smithy_client_1._json, - type: smithy_client_1.expectString - }); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); + } + return to; }; - var de_ExecutionList = (output, context) => { - const retVal = (output || []).filter((e) => e != null).map((entry) => { - return de_ExecutionListItem(entry, context); - }); - return retVal; + var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + AssumeRoleCommand: () => AssumeRoleCommand, + AssumeRoleResponseFilterSensitiveLog: () => AssumeRoleResponseFilterSensitiveLog, + AssumeRoleWithSAMLCommand: () => AssumeRoleWithSAMLCommand, + AssumeRoleWithSAMLRequestFilterSensitiveLog: () => AssumeRoleWithSAMLRequestFilterSensitiveLog, + AssumeRoleWithSAMLResponseFilterSensitiveLog: () => AssumeRoleWithSAMLResponseFilterSensitiveLog, + AssumeRoleWithWebIdentityCommand: () => AssumeRoleWithWebIdentityCommand, + AssumeRoleWithWebIdentityRequestFilterSensitiveLog: () => AssumeRoleWithWebIdentityRequestFilterSensitiveLog, + AssumeRoleWithWebIdentityResponseFilterSensitiveLog: () => AssumeRoleWithWebIdentityResponseFilterSensitiveLog, + ClientInputEndpointParameters: () => import_EndpointParameters9.ClientInputEndpointParameters, + CredentialsFilterSensitiveLog: () => CredentialsFilterSensitiveLog, + DecodeAuthorizationMessageCommand: () => DecodeAuthorizationMessageCommand, + ExpiredTokenException: () => ExpiredTokenException, + GetAccessKeyInfoCommand: () => GetAccessKeyInfoCommand, + GetCallerIdentityCommand: () => GetCallerIdentityCommand, + GetFederationTokenCommand: () => GetFederationTokenCommand, + GetFederationTokenResponseFilterSensitiveLog: () => GetFederationTokenResponseFilterSensitiveLog, + GetSessionTokenCommand: () => GetSessionTokenCommand, + GetSessionTokenResponseFilterSensitiveLog: () => GetSessionTokenResponseFilterSensitiveLog, + IDPCommunicationErrorException: () => IDPCommunicationErrorException, + IDPRejectedClaimException: () => IDPRejectedClaimException, + InvalidAuthorizationMessageException: () => InvalidAuthorizationMessageException, + InvalidIdentityTokenException: () => InvalidIdentityTokenException, + MalformedPolicyDocumentException: () => MalformedPolicyDocumentException, + PackedPolicyTooLargeException: () => PackedPolicyTooLargeException, + RegionDisabledException: () => RegionDisabledException, + STS: () => STS, + STSServiceException: () => STSServiceException, + decorateDefaultCredentialProvider: () => decorateDefaultCredentialProvider, + getDefaultRoleAssumer: () => getDefaultRoleAssumer2, + getDefaultRoleAssumerWithWebIdentity: () => getDefaultRoleAssumerWithWebIdentity2 + }); + module2.exports = __toCommonJS2(src_exports); + __reExport(src_exports, require_STSClient(), module2.exports); + var import_middleware_endpoint2 = require_dist_cjs46(); + var import_middleware_serde2 = require_dist_cjs45(); + var import_EndpointParameters = require_EndpointParameters(); + var import_smithy_client5 = require_dist_cjs37(); + var _STSServiceException = class _STSServiceException2 extends import_smithy_client5.ServiceException { + /** + * @internal + */ + constructor(options) { + super(options); + Object.setPrototypeOf(this, _STSServiceException2.prototype); + } }; - var de_ExecutionListItem = (output, context) => { - return (0, smithy_client_1.take)(output, { - executionArn: smithy_client_1.expectString, - itemCount: smithy_client_1.expectInt32, - mapRunArn: smithy_client_1.expectString, - name: smithy_client_1.expectString, - startDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - stateMachineAliasArn: smithy_client_1.expectString, - stateMachineArn: smithy_client_1.expectString, - stateMachineVersionArn: smithy_client_1.expectString, - status: smithy_client_1.expectString, - stopDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))) - }); + __name(_STSServiceException, "STSServiceException"); + var STSServiceException = _STSServiceException; + var _ExpiredTokenException = class _ExpiredTokenException2 extends STSServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ExpiredTokenException", + $fault: "client", + ...opts + }); + this.name = "ExpiredTokenException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ExpiredTokenException2.prototype); + } }; - var de_GetExecutionHistoryOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - events: (_) => de_HistoryEventList(_, context), - nextToken: smithy_client_1.expectString - }); + __name(_ExpiredTokenException, "ExpiredTokenException"); + var ExpiredTokenException = _ExpiredTokenException; + var _MalformedPolicyDocumentException = class _MalformedPolicyDocumentException2 extends STSServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "MalformedPolicyDocumentException", + $fault: "client", + ...opts + }); + this.name = "MalformedPolicyDocumentException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _MalformedPolicyDocumentException2.prototype); + } }; - var de_HistoryEvent = (output, context) => { - return (0, smithy_client_1.take)(output, { - activityFailedEventDetails: smithy_client_1._json, - activityScheduleFailedEventDetails: smithy_client_1._json, - activityScheduledEventDetails: smithy_client_1._json, - activityStartedEventDetails: smithy_client_1._json, - activitySucceededEventDetails: smithy_client_1._json, - activityTimedOutEventDetails: smithy_client_1._json, - executionAbortedEventDetails: smithy_client_1._json, - executionFailedEventDetails: smithy_client_1._json, - executionStartedEventDetails: smithy_client_1._json, - executionSucceededEventDetails: smithy_client_1._json, - executionTimedOutEventDetails: smithy_client_1._json, - id: smithy_client_1.expectLong, - lambdaFunctionFailedEventDetails: smithy_client_1._json, - lambdaFunctionScheduleFailedEventDetails: smithy_client_1._json, - lambdaFunctionScheduledEventDetails: smithy_client_1._json, - lambdaFunctionStartFailedEventDetails: smithy_client_1._json, - lambdaFunctionSucceededEventDetails: smithy_client_1._json, - lambdaFunctionTimedOutEventDetails: smithy_client_1._json, - mapIterationAbortedEventDetails: smithy_client_1._json, - mapIterationFailedEventDetails: smithy_client_1._json, - mapIterationStartedEventDetails: smithy_client_1._json, - mapIterationSucceededEventDetails: smithy_client_1._json, - mapRunFailedEventDetails: smithy_client_1._json, - mapRunStartedEventDetails: smithy_client_1._json, - mapStateStartedEventDetails: smithy_client_1._json, - previousEventId: smithy_client_1.expectLong, - stateEnteredEventDetails: smithy_client_1._json, - stateExitedEventDetails: smithy_client_1._json, - taskFailedEventDetails: smithy_client_1._json, - taskScheduledEventDetails: smithy_client_1._json, - taskStartFailedEventDetails: smithy_client_1._json, - taskStartedEventDetails: smithy_client_1._json, - taskSubmitFailedEventDetails: smithy_client_1._json, - taskSubmittedEventDetails: smithy_client_1._json, - taskSucceededEventDetails: smithy_client_1._json, - taskTimedOutEventDetails: smithy_client_1._json, - timestamp: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - type: smithy_client_1.expectString - }); + __name(_MalformedPolicyDocumentException, "MalformedPolicyDocumentException"); + var MalformedPolicyDocumentException = _MalformedPolicyDocumentException; + var _PackedPolicyTooLargeException = class _PackedPolicyTooLargeException2 extends STSServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "PackedPolicyTooLargeException", + $fault: "client", + ...opts + }); + this.name = "PackedPolicyTooLargeException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _PackedPolicyTooLargeException2.prototype); + } }; - var de_HistoryEventList = (output, context) => { - const retVal = (output || []).filter((e) => e != null).map((entry) => { - return de_HistoryEvent(entry, context); - }); - return retVal; + __name(_PackedPolicyTooLargeException, "PackedPolicyTooLargeException"); + var PackedPolicyTooLargeException = _PackedPolicyTooLargeException; + var _RegionDisabledException = class _RegionDisabledException2 extends STSServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "RegionDisabledException", + $fault: "client", + ...opts + }); + this.name = "RegionDisabledException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _RegionDisabledException2.prototype); + } }; - var de_ListActivitiesOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - activities: (_) => de_ActivityList(_, context), - nextToken: smithy_client_1.expectString - }); + __name(_RegionDisabledException, "RegionDisabledException"); + var RegionDisabledException = _RegionDisabledException; + var _IDPRejectedClaimException = class _IDPRejectedClaimException2 extends STSServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "IDPRejectedClaimException", + $fault: "client", + ...opts + }); + this.name = "IDPRejectedClaimException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _IDPRejectedClaimException2.prototype); + } }; - var de_ListExecutionsOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - executions: (_) => de_ExecutionList(_, context), - nextToken: smithy_client_1.expectString - }); + __name(_IDPRejectedClaimException, "IDPRejectedClaimException"); + var IDPRejectedClaimException = _IDPRejectedClaimException; + var _InvalidIdentityTokenException = class _InvalidIdentityTokenException2 extends STSServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidIdentityTokenException", + $fault: "client", + ...opts + }); + this.name = "InvalidIdentityTokenException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidIdentityTokenException2.prototype); + } }; - var de_ListMapRunsOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - mapRuns: (_) => de_MapRunList(_, context), - nextToken: smithy_client_1.expectString - }); + __name(_InvalidIdentityTokenException, "InvalidIdentityTokenException"); + var InvalidIdentityTokenException = _InvalidIdentityTokenException; + var _IDPCommunicationErrorException = class _IDPCommunicationErrorException2 extends STSServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "IDPCommunicationErrorException", + $fault: "client", + ...opts + }); + this.name = "IDPCommunicationErrorException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _IDPCommunicationErrorException2.prototype); + } }; - var de_ListStateMachineAliasesOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - nextToken: smithy_client_1.expectString, - stateMachineAliases: (_) => de_StateMachineAliasList(_, context) - }); + __name(_IDPCommunicationErrorException, "IDPCommunicationErrorException"); + var IDPCommunicationErrorException = _IDPCommunicationErrorException; + var _InvalidAuthorizationMessageException = class _InvalidAuthorizationMessageException2 extends STSServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidAuthorizationMessageException", + $fault: "client", + ...opts + }); + this.name = "InvalidAuthorizationMessageException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidAuthorizationMessageException2.prototype); + } }; - var de_ListStateMachinesOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - nextToken: smithy_client_1.expectString, - stateMachines: (_) => de_StateMachineList(_, context) + __name(_InvalidAuthorizationMessageException, "InvalidAuthorizationMessageException"); + var InvalidAuthorizationMessageException = _InvalidAuthorizationMessageException; + var CredentialsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.SecretAccessKey && { SecretAccessKey: import_smithy_client5.SENSITIVE_STRING } + }), "CredentialsFilterSensitiveLog"); + var AssumeRoleResponseFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.Credentials && { Credentials: CredentialsFilterSensitiveLog(obj.Credentials) } + }), "AssumeRoleResponseFilterSensitiveLog"); + var AssumeRoleWithSAMLRequestFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.SAMLAssertion && { SAMLAssertion: import_smithy_client5.SENSITIVE_STRING } + }), "AssumeRoleWithSAMLRequestFilterSensitiveLog"); + var AssumeRoleWithSAMLResponseFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.Credentials && { Credentials: CredentialsFilterSensitiveLog(obj.Credentials) } + }), "AssumeRoleWithSAMLResponseFilterSensitiveLog"); + var AssumeRoleWithWebIdentityRequestFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.WebIdentityToken && { WebIdentityToken: import_smithy_client5.SENSITIVE_STRING } + }), "AssumeRoleWithWebIdentityRequestFilterSensitiveLog"); + var AssumeRoleWithWebIdentityResponseFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.Credentials && { Credentials: CredentialsFilterSensitiveLog(obj.Credentials) } + }), "AssumeRoleWithWebIdentityResponseFilterSensitiveLog"); + var GetFederationTokenResponseFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.Credentials && { Credentials: CredentialsFilterSensitiveLog(obj.Credentials) } + }), "GetFederationTokenResponseFilterSensitiveLog"); + var GetSessionTokenResponseFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.Credentials && { Credentials: CredentialsFilterSensitiveLog(obj.Credentials) } + }), "GetSessionTokenResponseFilterSensitiveLog"); + var import_core3 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var import_protocol_http8 = require_dist_cjs2(); + var se_AssumeRoleCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = SHARED_HEADERS; + let body; + body = buildFormUrlencodedString({ + ...se_AssumeRoleRequest(input, context), + [_A]: _AR, + [_V]: _ }); - }; - var de_ListStateMachineVersionsOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - nextToken: smithy_client_1.expectString, - stateMachineVersions: (_) => de_StateMachineVersionList(_, context) + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_AssumeRoleCommand"); + var se_AssumeRoleWithSAMLCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = SHARED_HEADERS; + let body; + body = buildFormUrlencodedString({ + ...se_AssumeRoleWithSAMLRequest(input, context), + [_A]: _ARWSAML, + [_V]: _ }); - }; - var de_MapRunList = (output, context) => { - const retVal = (output || []).filter((e) => e != null).map((entry) => { - return de_MapRunListItem(entry, context); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_AssumeRoleWithSAMLCommand"); + var se_AssumeRoleWithWebIdentityCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = SHARED_HEADERS; + let body; + body = buildFormUrlencodedString({ + ...se_AssumeRoleWithWebIdentityRequest(input, context), + [_A]: _ARWWI, + [_V]: _ }); - return retVal; - }; - var de_MapRunListItem = (output, context) => { - return (0, smithy_client_1.take)(output, { - executionArn: smithy_client_1.expectString, - mapRunArn: smithy_client_1.expectString, - startDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - stateMachineArn: smithy_client_1.expectString, - stopDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))) + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_AssumeRoleWithWebIdentityCommand"); + var se_DecodeAuthorizationMessageCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = SHARED_HEADERS; + let body; + body = buildFormUrlencodedString({ + ...se_DecodeAuthorizationMessageRequest(input, context), + [_A]: _DAM, + [_V]: _ }); - }; - var de_PublishStateMachineVersionOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - creationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - stateMachineVersionArn: smithy_client_1.expectString + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_DecodeAuthorizationMessageCommand"); + var se_GetAccessKeyInfoCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = SHARED_HEADERS; + let body; + body = buildFormUrlencodedString({ + ...se_GetAccessKeyInfoRequest(input, context), + [_A]: _GAKI, + [_V]: _ }); - }; - var de_StartExecutionOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - executionArn: smithy_client_1.expectString, - startDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))) + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_GetAccessKeyInfoCommand"); + var se_GetCallerIdentityCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = SHARED_HEADERS; + let body; + body = buildFormUrlencodedString({ + ...se_GetCallerIdentityRequest(input, context), + [_A]: _GCI, + [_V]: _ }); - }; - var de_StartSyncExecutionOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - billingDetails: smithy_client_1._json, - cause: smithy_client_1.expectString, - error: smithy_client_1.expectString, - executionArn: smithy_client_1.expectString, - input: smithy_client_1.expectString, - inputDetails: smithy_client_1._json, - name: smithy_client_1.expectString, - output: smithy_client_1.expectString, - outputDetails: smithy_client_1._json, - startDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - stateMachineArn: smithy_client_1.expectString, - status: smithy_client_1.expectString, - stopDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - traceHeader: smithy_client_1.expectString + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_GetCallerIdentityCommand"); + var se_GetFederationTokenCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = SHARED_HEADERS; + let body; + body = buildFormUrlencodedString({ + ...se_GetFederationTokenRequest(input, context), + [_A]: _GFT, + [_V]: _ }); - }; - var de_StateMachineAliasList = (output, context) => { - const retVal = (output || []).filter((e) => e != null).map((entry) => { - return de_StateMachineAliasListItem(entry, context); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_GetFederationTokenCommand"); + var se_GetSessionTokenCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = SHARED_HEADERS; + let body; + body = buildFormUrlencodedString({ + ...se_GetSessionTokenRequest(input, context), + [_A]: _GST, + [_V]: _ }); - return retVal; - }; - var de_StateMachineAliasListItem = (output, context) => { - return (0, smithy_client_1.take)(output, { - creationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - stateMachineAliasArn: smithy_client_1.expectString + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_GetSessionTokenCommand"); + var de_AssumeRoleCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); + } + const data = await (0, import_core3.parseXmlBody)(output.body, context); + let contents = {}; + contents = de_AssumeRoleResponse(data.AssumeRoleResult, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_AssumeRoleCommand"); + var de_AssumeRoleWithSAMLCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); + } + const data = await (0, import_core3.parseXmlBody)(output.body, context); + let contents = {}; + contents = de_AssumeRoleWithSAMLResponse(data.AssumeRoleWithSAMLResult, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_AssumeRoleWithSAMLCommand"); + var de_AssumeRoleWithWebIdentityCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); + } + const data = await (0, import_core3.parseXmlBody)(output.body, context); + let contents = {}; + contents = de_AssumeRoleWithWebIdentityResponse(data.AssumeRoleWithWebIdentityResult, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_AssumeRoleWithWebIdentityCommand"); + var de_DecodeAuthorizationMessageCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); + } + const data = await (0, import_core3.parseXmlBody)(output.body, context); + let contents = {}; + contents = de_DecodeAuthorizationMessageResponse(data.DecodeAuthorizationMessageResult, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_DecodeAuthorizationMessageCommand"); + var de_GetAccessKeyInfoCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); + } + const data = await (0, import_core3.parseXmlBody)(output.body, context); + let contents = {}; + contents = de_GetAccessKeyInfoResponse(data.GetAccessKeyInfoResult, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_GetAccessKeyInfoCommand"); + var de_GetCallerIdentityCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); + } + const data = await (0, import_core3.parseXmlBody)(output.body, context); + let contents = {}; + contents = de_GetCallerIdentityResponse(data.GetCallerIdentityResult, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_GetCallerIdentityCommand"); + var de_GetFederationTokenCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); + } + const data = await (0, import_core3.parseXmlBody)(output.body, context); + let contents = {}; + contents = de_GetFederationTokenResponse(data.GetFederationTokenResult, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_GetFederationTokenCommand"); + var de_GetSessionTokenCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); + } + const data = await (0, import_core3.parseXmlBody)(output.body, context); + let contents = {}; + contents = de_GetSessionTokenResponse(data.GetSessionTokenResult, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_GetSessionTokenCommand"); + var de_CommandError = /* @__PURE__ */ __name(async (output, context) => { + const parsedOutput = { + ...output, + body: await (0, import_core3.parseXmlErrorBody)(output.body, context) + }; + const errorCode = loadQueryErrorCode(output, parsedOutput.body); + switch (errorCode) { + case "ExpiredTokenException": + case "com.amazonaws.sts#ExpiredTokenException": + throw await de_ExpiredTokenExceptionRes(parsedOutput, context); + case "MalformedPolicyDocument": + case "com.amazonaws.sts#MalformedPolicyDocumentException": + throw await de_MalformedPolicyDocumentExceptionRes(parsedOutput, context); + case "PackedPolicyTooLarge": + case "com.amazonaws.sts#PackedPolicyTooLargeException": + throw await de_PackedPolicyTooLargeExceptionRes(parsedOutput, context); + case "RegionDisabledException": + case "com.amazonaws.sts#RegionDisabledException": + throw await de_RegionDisabledExceptionRes(parsedOutput, context); + case "IDPRejectedClaim": + case "com.amazonaws.sts#IDPRejectedClaimException": + throw await de_IDPRejectedClaimExceptionRes(parsedOutput, context); + case "InvalidIdentityToken": + case "com.amazonaws.sts#InvalidIdentityTokenException": + throw await de_InvalidIdentityTokenExceptionRes(parsedOutput, context); + case "IDPCommunicationError": + case "com.amazonaws.sts#IDPCommunicationErrorException": + throw await de_IDPCommunicationErrorExceptionRes(parsedOutput, context); + case "InvalidAuthorizationMessageException": + case "com.amazonaws.sts#InvalidAuthorizationMessageException": + throw await de_InvalidAuthorizationMessageExceptionRes(parsedOutput, context); + default: + const parsedBody = parsedOutput.body; + return throwDefaultError({ + output, + parsedBody: parsedBody.Error, + errorCode + }); + } + }, "de_CommandError"); + var de_ExpiredTokenExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = de_ExpiredTokenException(body.Error, context); + const exception = new ExpiredTokenException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized }); - }; - var de_StateMachineList = (output, context) => { - const retVal = (output || []).filter((e) => e != null).map((entry) => { - return de_StateMachineListItem(entry, context); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_ExpiredTokenExceptionRes"); + var de_IDPCommunicationErrorExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = de_IDPCommunicationErrorException(body.Error, context); + const exception = new IDPCommunicationErrorException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized }); - return retVal; - }; - var de_StateMachineListItem = (output, context) => { - return (0, smithy_client_1.take)(output, { - creationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - name: smithy_client_1.expectString, - stateMachineArn: smithy_client_1.expectString, - type: smithy_client_1.expectString + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_IDPCommunicationErrorExceptionRes"); + var de_IDPRejectedClaimExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = de_IDPRejectedClaimException(body.Error, context); + const exception = new IDPRejectedClaimException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized }); - }; - var de_StateMachineVersionList = (output, context) => { - const retVal = (output || []).filter((e) => e != null).map((entry) => { - return de_StateMachineVersionListItem(entry, context); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_IDPRejectedClaimExceptionRes"); + var de_InvalidAuthorizationMessageExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = de_InvalidAuthorizationMessageException(body.Error, context); + const exception = new InvalidAuthorizationMessageException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized }); - return retVal; - }; - var de_StateMachineVersionListItem = (output, context) => { - return (0, smithy_client_1.take)(output, { - creationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))), - stateMachineVersionArn: smithy_client_1.expectString + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_InvalidAuthorizationMessageExceptionRes"); + var de_InvalidIdentityTokenExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = de_InvalidIdentityTokenException(body.Error, context); + const exception = new InvalidIdentityTokenException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized }); - }; - var de_StopExecutionOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - stopDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))) + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_InvalidIdentityTokenExceptionRes"); + var de_MalformedPolicyDocumentExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = de_MalformedPolicyDocumentException(body.Error, context); + const exception = new MalformedPolicyDocumentException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized }); - }; - var de_UpdateStateMachineAliasOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - updateDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))) + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_MalformedPolicyDocumentExceptionRes"); + var de_PackedPolicyTooLargeExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = de_PackedPolicyTooLargeException(body.Error, context); + const exception = new PackedPolicyTooLargeException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized }); - }; - var de_UpdateStateMachineOutput = (output, context) => { - return (0, smithy_client_1.take)(output, { - revisionId: smithy_client_1.expectString, - stateMachineVersionArn: smithy_client_1.expectString, - updateDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))) + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_PackedPolicyTooLargeExceptionRes"); + var de_RegionDisabledExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = de_RegionDisabledException(body.Error, context); + const exception = new RegionDisabledException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized }); - }; - var deserializeMetadata = (output) => ({ + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_RegionDisabledExceptionRes"); + var se_AssumeRoleRequest = /* @__PURE__ */ __name((input, context) => { + var _a2, _b, _c, _d; + const entries = {}; + if (input[_RA] != null) { + entries[_RA] = input[_RA]; + } + if (input[_RSN] != null) { + entries[_RSN] = input[_RSN]; + } + if (input[_PA] != null) { + const memberEntries = se_policyDescriptorListType(input[_PA], context); + if (((_a2 = input[_PA]) == null ? void 0 : _a2.length) === 0) { + entries.PolicyArns = []; + } + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `PolicyArns.${key}`; + entries[loc] = value; + }); + } + if (input[_P] != null) { + entries[_P] = input[_P]; + } + if (input[_DS] != null) { + entries[_DS] = input[_DS]; + } + if (input[_T] != null) { + const memberEntries = se_tagListType(input[_T], context); + if (((_b = input[_T]) == null ? void 0 : _b.length) === 0) { + entries.Tags = []; + } + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `Tags.${key}`; + entries[loc] = value; + }); + } + if (input[_TTK] != null) { + const memberEntries = se_tagKeyListType(input[_TTK], context); + if (((_c = input[_TTK]) == null ? void 0 : _c.length) === 0) { + entries.TransitiveTagKeys = []; + } + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `TransitiveTagKeys.${key}`; + entries[loc] = value; + }); + } + if (input[_EI] != null) { + entries[_EI] = input[_EI]; + } + if (input[_SN] != null) { + entries[_SN] = input[_SN]; + } + if (input[_TC] != null) { + entries[_TC] = input[_TC]; + } + if (input[_SI] != null) { + entries[_SI] = input[_SI]; + } + if (input[_PC] != null) { + const memberEntries = se_ProvidedContextsListType(input[_PC], context); + if (((_d = input[_PC]) == null ? void 0 : _d.length) === 0) { + entries.ProvidedContexts = []; + } + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `ProvidedContexts.${key}`; + entries[loc] = value; + }); + } + return entries; + }, "se_AssumeRoleRequest"); + var se_AssumeRoleWithSAMLRequest = /* @__PURE__ */ __name((input, context) => { + var _a2; + const entries = {}; + if (input[_RA] != null) { + entries[_RA] = input[_RA]; + } + if (input[_PAr] != null) { + entries[_PAr] = input[_PAr]; + } + if (input[_SAMLA] != null) { + entries[_SAMLA] = input[_SAMLA]; + } + if (input[_PA] != null) { + const memberEntries = se_policyDescriptorListType(input[_PA], context); + if (((_a2 = input[_PA]) == null ? void 0 : _a2.length) === 0) { + entries.PolicyArns = []; + } + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `PolicyArns.${key}`; + entries[loc] = value; + }); + } + if (input[_P] != null) { + entries[_P] = input[_P]; + } + if (input[_DS] != null) { + entries[_DS] = input[_DS]; + } + return entries; + }, "se_AssumeRoleWithSAMLRequest"); + var se_AssumeRoleWithWebIdentityRequest = /* @__PURE__ */ __name((input, context) => { + var _a2; + const entries = {}; + if (input[_RA] != null) { + entries[_RA] = input[_RA]; + } + if (input[_RSN] != null) { + entries[_RSN] = input[_RSN]; + } + if (input[_WIT] != null) { + entries[_WIT] = input[_WIT]; + } + if (input[_PI] != null) { + entries[_PI] = input[_PI]; + } + if (input[_PA] != null) { + const memberEntries = se_policyDescriptorListType(input[_PA], context); + if (((_a2 = input[_PA]) == null ? void 0 : _a2.length) === 0) { + entries.PolicyArns = []; + } + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `PolicyArns.${key}`; + entries[loc] = value; + }); + } + if (input[_P] != null) { + entries[_P] = input[_P]; + } + if (input[_DS] != null) { + entries[_DS] = input[_DS]; + } + return entries; + }, "se_AssumeRoleWithWebIdentityRequest"); + var se_DecodeAuthorizationMessageRequest = /* @__PURE__ */ __name((input, context) => { + const entries = {}; + if (input[_EM] != null) { + entries[_EM] = input[_EM]; + } + return entries; + }, "se_DecodeAuthorizationMessageRequest"); + var se_GetAccessKeyInfoRequest = /* @__PURE__ */ __name((input, context) => { + const entries = {}; + if (input[_AKI] != null) { + entries[_AKI] = input[_AKI]; + } + return entries; + }, "se_GetAccessKeyInfoRequest"); + var se_GetCallerIdentityRequest = /* @__PURE__ */ __name((input, context) => { + const entries = {}; + return entries; + }, "se_GetCallerIdentityRequest"); + var se_GetFederationTokenRequest = /* @__PURE__ */ __name((input, context) => { + var _a2, _b; + const entries = {}; + if (input[_N] != null) { + entries[_N] = input[_N]; + } + if (input[_P] != null) { + entries[_P] = input[_P]; + } + if (input[_PA] != null) { + const memberEntries = se_policyDescriptorListType(input[_PA], context); + if (((_a2 = input[_PA]) == null ? void 0 : _a2.length) === 0) { + entries.PolicyArns = []; + } + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `PolicyArns.${key}`; + entries[loc] = value; + }); + } + if (input[_DS] != null) { + entries[_DS] = input[_DS]; + } + if (input[_T] != null) { + const memberEntries = se_tagListType(input[_T], context); + if (((_b = input[_T]) == null ? void 0 : _b.length) === 0) { + entries.Tags = []; + } + Object.entries(memberEntries).forEach(([key, value]) => { + const loc = `Tags.${key}`; + entries[loc] = value; + }); + } + return entries; + }, "se_GetFederationTokenRequest"); + var se_GetSessionTokenRequest = /* @__PURE__ */ __name((input, context) => { + const entries = {}; + if (input[_DS] != null) { + entries[_DS] = input[_DS]; + } + if (input[_SN] != null) { + entries[_SN] = input[_SN]; + } + if (input[_TC] != null) { + entries[_TC] = input[_TC]; + } + return entries; + }, "se_GetSessionTokenRequest"); + var se_policyDescriptorListType = /* @__PURE__ */ __name((input, context) => { + const entries = {}; + let counter = 1; + for (const entry of input) { + if (entry === null) { + continue; + } + const memberEntries = se_PolicyDescriptorType(entry, context); + Object.entries(memberEntries).forEach(([key, value]) => { + entries[`member.${counter}.${key}`] = value; + }); + counter++; + } + return entries; + }, "se_policyDescriptorListType"); + var se_PolicyDescriptorType = /* @__PURE__ */ __name((input, context) => { + const entries = {}; + if (input[_a] != null) { + entries[_a] = input[_a]; + } + return entries; + }, "se_PolicyDescriptorType"); + var se_ProvidedContext = /* @__PURE__ */ __name((input, context) => { + const entries = {}; + if (input[_PAro] != null) { + entries[_PAro] = input[_PAro]; + } + if (input[_CA] != null) { + entries[_CA] = input[_CA]; + } + return entries; + }, "se_ProvidedContext"); + var se_ProvidedContextsListType = /* @__PURE__ */ __name((input, context) => { + const entries = {}; + let counter = 1; + for (const entry of input) { + if (entry === null) { + continue; + } + const memberEntries = se_ProvidedContext(entry, context); + Object.entries(memberEntries).forEach(([key, value]) => { + entries[`member.${counter}.${key}`] = value; + }); + counter++; + } + return entries; + }, "se_ProvidedContextsListType"); + var se_Tag = /* @__PURE__ */ __name((input, context) => { + const entries = {}; + if (input[_K] != null) { + entries[_K] = input[_K]; + } + if (input[_Va] != null) { + entries[_Va] = input[_Va]; + } + return entries; + }, "se_Tag"); + var se_tagKeyListType = /* @__PURE__ */ __name((input, context) => { + const entries = {}; + let counter = 1; + for (const entry of input) { + if (entry === null) { + continue; + } + entries[`member.${counter}`] = entry; + counter++; + } + return entries; + }, "se_tagKeyListType"); + var se_tagListType = /* @__PURE__ */ __name((input, context) => { + const entries = {}; + let counter = 1; + for (const entry of input) { + if (entry === null) { + continue; + } + const memberEntries = se_Tag(entry, context); + Object.entries(memberEntries).forEach(([key, value]) => { + entries[`member.${counter}.${key}`] = value; + }); + counter++; + } + return entries; + }, "se_tagListType"); + var de_AssumedRoleUser = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_ARI] != null) { + contents[_ARI] = (0, import_smithy_client5.expectString)(output[_ARI]); + } + if (output[_Ar] != null) { + contents[_Ar] = (0, import_smithy_client5.expectString)(output[_Ar]); + } + return contents; + }, "de_AssumedRoleUser"); + var de_AssumeRoleResponse = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_C] != null) { + contents[_C] = de_Credentials(output[_C], context); + } + if (output[_ARU] != null) { + contents[_ARU] = de_AssumedRoleUser(output[_ARU], context); + } + if (output[_PPS] != null) { + contents[_PPS] = (0, import_smithy_client5.strictParseInt32)(output[_PPS]); + } + if (output[_SI] != null) { + contents[_SI] = (0, import_smithy_client5.expectString)(output[_SI]); + } + return contents; + }, "de_AssumeRoleResponse"); + var de_AssumeRoleWithSAMLResponse = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_C] != null) { + contents[_C] = de_Credentials(output[_C], context); + } + if (output[_ARU] != null) { + contents[_ARU] = de_AssumedRoleUser(output[_ARU], context); + } + if (output[_PPS] != null) { + contents[_PPS] = (0, import_smithy_client5.strictParseInt32)(output[_PPS]); + } + if (output[_S] != null) { + contents[_S] = (0, import_smithy_client5.expectString)(output[_S]); + } + if (output[_ST] != null) { + contents[_ST] = (0, import_smithy_client5.expectString)(output[_ST]); + } + if (output[_I] != null) { + contents[_I] = (0, import_smithy_client5.expectString)(output[_I]); + } + if (output[_Au] != null) { + contents[_Au] = (0, import_smithy_client5.expectString)(output[_Au]); + } + if (output[_NQ] != null) { + contents[_NQ] = (0, import_smithy_client5.expectString)(output[_NQ]); + } + if (output[_SI] != null) { + contents[_SI] = (0, import_smithy_client5.expectString)(output[_SI]); + } + return contents; + }, "de_AssumeRoleWithSAMLResponse"); + var de_AssumeRoleWithWebIdentityResponse = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_C] != null) { + contents[_C] = de_Credentials(output[_C], context); + } + if (output[_SFWIT] != null) { + contents[_SFWIT] = (0, import_smithy_client5.expectString)(output[_SFWIT]); + } + if (output[_ARU] != null) { + contents[_ARU] = de_AssumedRoleUser(output[_ARU], context); + } + if (output[_PPS] != null) { + contents[_PPS] = (0, import_smithy_client5.strictParseInt32)(output[_PPS]); + } + if (output[_Pr] != null) { + contents[_Pr] = (0, import_smithy_client5.expectString)(output[_Pr]); + } + if (output[_Au] != null) { + contents[_Au] = (0, import_smithy_client5.expectString)(output[_Au]); + } + if (output[_SI] != null) { + contents[_SI] = (0, import_smithy_client5.expectString)(output[_SI]); + } + return contents; + }, "de_AssumeRoleWithWebIdentityResponse"); + var de_Credentials = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_AKI] != null) { + contents[_AKI] = (0, import_smithy_client5.expectString)(output[_AKI]); + } + if (output[_SAK] != null) { + contents[_SAK] = (0, import_smithy_client5.expectString)(output[_SAK]); + } + if (output[_STe] != null) { + contents[_STe] = (0, import_smithy_client5.expectString)(output[_STe]); + } + if (output[_E] != null) { + contents[_E] = (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseRfc3339DateTimeWithOffset)(output[_E])); + } + return contents; + }, "de_Credentials"); + var de_DecodeAuthorizationMessageResponse = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_DM] != null) { + contents[_DM] = (0, import_smithy_client5.expectString)(output[_DM]); + } + return contents; + }, "de_DecodeAuthorizationMessageResponse"); + var de_ExpiredTokenException = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_m] != null) { + contents[_m] = (0, import_smithy_client5.expectString)(output[_m]); + } + return contents; + }, "de_ExpiredTokenException"); + var de_FederatedUser = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_FUI] != null) { + contents[_FUI] = (0, import_smithy_client5.expectString)(output[_FUI]); + } + if (output[_Ar] != null) { + contents[_Ar] = (0, import_smithy_client5.expectString)(output[_Ar]); + } + return contents; + }, "de_FederatedUser"); + var de_GetAccessKeyInfoResponse = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_Ac] != null) { + contents[_Ac] = (0, import_smithy_client5.expectString)(output[_Ac]); + } + return contents; + }, "de_GetAccessKeyInfoResponse"); + var de_GetCallerIdentityResponse = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_UI] != null) { + contents[_UI] = (0, import_smithy_client5.expectString)(output[_UI]); + } + if (output[_Ac] != null) { + contents[_Ac] = (0, import_smithy_client5.expectString)(output[_Ac]); + } + if (output[_Ar] != null) { + contents[_Ar] = (0, import_smithy_client5.expectString)(output[_Ar]); + } + return contents; + }, "de_GetCallerIdentityResponse"); + var de_GetFederationTokenResponse = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_C] != null) { + contents[_C] = de_Credentials(output[_C], context); + } + if (output[_FU] != null) { + contents[_FU] = de_FederatedUser(output[_FU], context); + } + if (output[_PPS] != null) { + contents[_PPS] = (0, import_smithy_client5.strictParseInt32)(output[_PPS]); + } + return contents; + }, "de_GetFederationTokenResponse"); + var de_GetSessionTokenResponse = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_C] != null) { + contents[_C] = de_Credentials(output[_C], context); + } + return contents; + }, "de_GetSessionTokenResponse"); + var de_IDPCommunicationErrorException = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_m] != null) { + contents[_m] = (0, import_smithy_client5.expectString)(output[_m]); + } + return contents; + }, "de_IDPCommunicationErrorException"); + var de_IDPRejectedClaimException = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_m] != null) { + contents[_m] = (0, import_smithy_client5.expectString)(output[_m]); + } + return contents; + }, "de_IDPRejectedClaimException"); + var de_InvalidAuthorizationMessageException = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_m] != null) { + contents[_m] = (0, import_smithy_client5.expectString)(output[_m]); + } + return contents; + }, "de_InvalidAuthorizationMessageException"); + var de_InvalidIdentityTokenException = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_m] != null) { + contents[_m] = (0, import_smithy_client5.expectString)(output[_m]); + } + return contents; + }, "de_InvalidIdentityTokenException"); + var de_MalformedPolicyDocumentException = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_m] != null) { + contents[_m] = (0, import_smithy_client5.expectString)(output[_m]); + } + return contents; + }, "de_MalformedPolicyDocumentException"); + var de_PackedPolicyTooLargeException = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_m] != null) { + contents[_m] = (0, import_smithy_client5.expectString)(output[_m]); + } + return contents; + }, "de_PackedPolicyTooLargeException"); + var de_RegionDisabledException = /* @__PURE__ */ __name((output, context) => { + const contents = {}; + if (output[_m] != null) { + contents[_m] = (0, import_smithy_client5.expectString)(output[_m]); + } + return contents; + }, "de_RegionDisabledException"); + var deserializeMetadata = /* @__PURE__ */ __name((output) => ({ httpStatusCode: output.statusCode, requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"], extendedRequestId: output.headers["x-amz-id-2"], cfId: output.headers["x-amz-cf-id"] - }); - var collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)); - var throwDefaultError = (0, smithy_client_1.withBaseException)(SFNServiceException_1.SFNServiceException); - var buildHttpRpcRequest = async (context, headers, path, resolvedHostname, body) => { + }), "deserializeMetadata"); + var throwDefaultError = (0, import_smithy_client5.withBaseException)(STSServiceException); + var buildHttpRpcRequest = /* @__PURE__ */ __name(async (context, headers, path, resolvedHostname, body) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const contents = { protocol, @@ -20289,2431 +22054,4360 @@ var require_Aws_json1_0 = __commonJS({ if (body !== void 0) { contents.body = body; } - return new protocol_http_1.HttpRequest(contents); + return new import_protocol_http8.HttpRequest(contents); + }, "buildHttpRpcRequest"); + var SHARED_HEADERS = { + "content-type": "application/x-www-form-urlencoded" }; - function sharedHeaders(operation) { - return { - "content-type": "application/x-amz-json-1.0", - "x-amz-target": `AWSStepFunctions.${operation}` - }; - } - var parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => { - if (encoded.length) { - return JSON.parse(encoded); + var _ = "2011-06-15"; + var _A = "Action"; + var _AKI = "AccessKeyId"; + var _AR = "AssumeRole"; + var _ARI = "AssumedRoleId"; + var _ARU = "AssumedRoleUser"; + var _ARWSAML = "AssumeRoleWithSAML"; + var _ARWWI = "AssumeRoleWithWebIdentity"; + var _Ac = "Account"; + var _Ar = "Arn"; + var _Au = "Audience"; + var _C = "Credentials"; + var _CA = "ContextAssertion"; + var _DAM = "DecodeAuthorizationMessage"; + var _DM = "DecodedMessage"; + var _DS = "DurationSeconds"; + var _E = "Expiration"; + var _EI = "ExternalId"; + var _EM = "EncodedMessage"; + var _FU = "FederatedUser"; + var _FUI = "FederatedUserId"; + var _GAKI = "GetAccessKeyInfo"; + var _GCI = "GetCallerIdentity"; + var _GFT = "GetFederationToken"; + var _GST = "GetSessionToken"; + var _I = "Issuer"; + var _K = "Key"; + var _N = "Name"; + var _NQ = "NameQualifier"; + var _P = "Policy"; + var _PA = "PolicyArns"; + var _PAr = "PrincipalArn"; + var _PAro = "ProviderArn"; + var _PC = "ProvidedContexts"; + var _PI = "ProviderId"; + var _PPS = "PackedPolicySize"; + var _Pr = "Provider"; + var _RA = "RoleArn"; + var _RSN = "RoleSessionName"; + var _S = "Subject"; + var _SAK = "SecretAccessKey"; + var _SAMLA = "SAMLAssertion"; + var _SFWIT = "SubjectFromWebIdentityToken"; + var _SI = "SourceIdentity"; + var _SN = "SerialNumber"; + var _ST = "SubjectType"; + var _STe = "SessionToken"; + var _T = "Tags"; + var _TC = "TokenCode"; + var _TTK = "TransitiveTagKeys"; + var _UI = "UserId"; + var _V = "Version"; + var _Va = "Value"; + var _WIT = "WebIdentityToken"; + var _a = "arn"; + var _m = "message"; + var buildFormUrlencodedString = /* @__PURE__ */ __name((formEntries) => Object.entries(formEntries).map(([key, value]) => (0, import_smithy_client5.extendedEncodeURIComponent)(key) + "=" + (0, import_smithy_client5.extendedEncodeURIComponent)(value)).join("&"), "buildFormUrlencodedString"); + var loadQueryErrorCode = /* @__PURE__ */ __name((output, data) => { + var _a2; + if (((_a2 = data.Error) == null ? void 0 : _a2.Code) !== void 0) { + return data.Error.Code; } - return {}; - }); - var parseErrorBody = async (errorBody, context) => { - const value = await parseBody(errorBody, context); - value.message = value.message ?? value.Message; - return value; + if (output.statusCode == 404) { + return "NotFound"; + } + }, "loadQueryErrorCode"); + var _AssumeRoleCommand = class _AssumeRoleCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...import_EndpointParameters.commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSSecurityTokenServiceV20110615", "AssumeRole", {}).n("STSClient", "AssumeRoleCommand").f(void 0, AssumeRoleResponseFilterSensitiveLog).ser(se_AssumeRoleCommand).de(de_AssumeRoleCommand).build() { + }; + __name(_AssumeRoleCommand, "AssumeRoleCommand"); + var AssumeRoleCommand = _AssumeRoleCommand; + var import_EndpointParameters2 = require_EndpointParameters(); + var _AssumeRoleWithSAMLCommand = class _AssumeRoleWithSAMLCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...import_EndpointParameters2.commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSSecurityTokenServiceV20110615", "AssumeRoleWithSAML", {}).n("STSClient", "AssumeRoleWithSAMLCommand").f(AssumeRoleWithSAMLRequestFilterSensitiveLog, AssumeRoleWithSAMLResponseFilterSensitiveLog).ser(se_AssumeRoleWithSAMLCommand).de(de_AssumeRoleWithSAMLCommand).build() { + }; + __name(_AssumeRoleWithSAMLCommand, "AssumeRoleWithSAMLCommand"); + var AssumeRoleWithSAMLCommand = _AssumeRoleWithSAMLCommand; + var import_EndpointParameters3 = require_EndpointParameters(); + var _AssumeRoleWithWebIdentityCommand = class _AssumeRoleWithWebIdentityCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...import_EndpointParameters3.commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSSecurityTokenServiceV20110615", "AssumeRoleWithWebIdentity", {}).n("STSClient", "AssumeRoleWithWebIdentityCommand").f(AssumeRoleWithWebIdentityRequestFilterSensitiveLog, AssumeRoleWithWebIdentityResponseFilterSensitiveLog).ser(se_AssumeRoleWithWebIdentityCommand).de(de_AssumeRoleWithWebIdentityCommand).build() { + }; + __name(_AssumeRoleWithWebIdentityCommand, "AssumeRoleWithWebIdentityCommand"); + var AssumeRoleWithWebIdentityCommand = _AssumeRoleWithWebIdentityCommand; + var import_EndpointParameters4 = require_EndpointParameters(); + var _DecodeAuthorizationMessageCommand = class _DecodeAuthorizationMessageCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...import_EndpointParameters4.commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSSecurityTokenServiceV20110615", "DecodeAuthorizationMessage", {}).n("STSClient", "DecodeAuthorizationMessageCommand").f(void 0, void 0).ser(se_DecodeAuthorizationMessageCommand).de(de_DecodeAuthorizationMessageCommand).build() { + }; + __name(_DecodeAuthorizationMessageCommand, "DecodeAuthorizationMessageCommand"); + var DecodeAuthorizationMessageCommand = _DecodeAuthorizationMessageCommand; + var import_EndpointParameters5 = require_EndpointParameters(); + var _GetAccessKeyInfoCommand = class _GetAccessKeyInfoCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...import_EndpointParameters5.commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSSecurityTokenServiceV20110615", "GetAccessKeyInfo", {}).n("STSClient", "GetAccessKeyInfoCommand").f(void 0, void 0).ser(se_GetAccessKeyInfoCommand).de(de_GetAccessKeyInfoCommand).build() { + }; + __name(_GetAccessKeyInfoCommand, "GetAccessKeyInfoCommand"); + var GetAccessKeyInfoCommand = _GetAccessKeyInfoCommand; + var import_EndpointParameters6 = require_EndpointParameters(); + var _GetCallerIdentityCommand = class _GetCallerIdentityCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...import_EndpointParameters6.commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSSecurityTokenServiceV20110615", "GetCallerIdentity", {}).n("STSClient", "GetCallerIdentityCommand").f(void 0, void 0).ser(se_GetCallerIdentityCommand).de(de_GetCallerIdentityCommand).build() { + }; + __name(_GetCallerIdentityCommand, "GetCallerIdentityCommand"); + var GetCallerIdentityCommand = _GetCallerIdentityCommand; + var import_EndpointParameters7 = require_EndpointParameters(); + var _GetFederationTokenCommand = class _GetFederationTokenCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...import_EndpointParameters7.commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSSecurityTokenServiceV20110615", "GetFederationToken", {}).n("STSClient", "GetFederationTokenCommand").f(void 0, GetFederationTokenResponseFilterSensitiveLog).ser(se_GetFederationTokenCommand).de(de_GetFederationTokenCommand).build() { + }; + __name(_GetFederationTokenCommand, "GetFederationTokenCommand"); + var GetFederationTokenCommand = _GetFederationTokenCommand; + var import_EndpointParameters8 = require_EndpointParameters(); + var _GetSessionTokenCommand = class _GetSessionTokenCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...import_EndpointParameters8.commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSSecurityTokenServiceV20110615", "GetSessionToken", {}).n("STSClient", "GetSessionTokenCommand").f(void 0, GetSessionTokenResponseFilterSensitiveLog).ser(se_GetSessionTokenCommand).de(de_GetSessionTokenCommand).build() { }; - var loadRestJsonErrorCode = (output, data) => { - const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()); - const sanitizeErrorCode = (rawValue) => { - let cleanValue = rawValue; - if (typeof cleanValue === "number") { - cleanValue = cleanValue.toString(); - } - if (cleanValue.indexOf(",") >= 0) { - cleanValue = cleanValue.split(",")[0]; + __name(_GetSessionTokenCommand, "GetSessionTokenCommand"); + var GetSessionTokenCommand = _GetSessionTokenCommand; + var import_STSClient = require_STSClient(); + var commands = { + AssumeRoleCommand, + AssumeRoleWithSAMLCommand, + AssumeRoleWithWebIdentityCommand, + DecodeAuthorizationMessageCommand, + GetAccessKeyInfoCommand, + GetCallerIdentityCommand, + GetFederationTokenCommand, + GetSessionTokenCommand + }; + var _STS = class _STS extends import_STSClient.STSClient { + }; + __name(_STS, "STS"); + var STS = _STS; + (0, import_smithy_client5.createAggregatedClient)(commands, STS); + var import_EndpointParameters9 = require_EndpointParameters(); + var ASSUME_ROLE_DEFAULT_REGION = "us-east-1"; + var getAccountIdFromAssumedRoleUser = /* @__PURE__ */ __name((assumedRoleUser) => { + if (typeof (assumedRoleUser == null ? void 0 : assumedRoleUser.Arn) === "string") { + const arnComponents = assumedRoleUser.Arn.split(":"); + if (arnComponents.length > 4 && arnComponents[4] !== "") { + return arnComponents[4]; } - if (cleanValue.indexOf(":") >= 0) { - cleanValue = cleanValue.split(":")[0]; + } + return void 0; + }, "getAccountIdFromAssumedRoleUser"); + var resolveRegion = /* @__PURE__ */ __name(async (_region, _parentRegion, credentialProviderLogger) => { + var _a2; + const region = typeof _region === "function" ? await _region() : _region; + const parentRegion = typeof _parentRegion === "function" ? await _parentRegion() : _parentRegion; + (_a2 = credentialProviderLogger == null ? void 0 : credentialProviderLogger.debug) == null ? void 0 : _a2.call( + credentialProviderLogger, + "@aws-sdk/client-sts::resolveRegion", + "accepting first of:", + `${region} (provider)`, + `${parentRegion} (parent client)`, + `${ASSUME_ROLE_DEFAULT_REGION} (STS default)` + ); + return region ?? parentRegion ?? ASSUME_ROLE_DEFAULT_REGION; + }, "resolveRegion"); + var getDefaultRoleAssumer = /* @__PURE__ */ __name((stsOptions, stsClientCtor) => { + let stsClient; + let closureSourceCreds; + return async (sourceCreds, params) => { + var _a2, _b, _c; + closureSourceCreds = sourceCreds; + if (!stsClient) { + const { + logger = (_a2 = stsOptions == null ? void 0 : stsOptions.parentClientConfig) == null ? void 0 : _a2.logger, + region, + requestHandler = (_b = stsOptions == null ? void 0 : stsOptions.parentClientConfig) == null ? void 0 : _b.requestHandler, + credentialProviderLogger + } = stsOptions; + const resolvedRegion = await resolveRegion( + region, + (_c = stsOptions == null ? void 0 : stsOptions.parentClientConfig) == null ? void 0 : _c.region, + credentialProviderLogger + ); + const isCompatibleRequestHandler = !isH2(requestHandler); + stsClient = new stsClientCtor({ + // A hack to make sts client uses the credential in current closure. + credentialDefaultProvider: () => async () => closureSourceCreds, + region: resolvedRegion, + requestHandler: isCompatibleRequestHandler ? requestHandler : void 0, + logger + }); } - if (cleanValue.indexOf("#") >= 0) { - cleanValue = cleanValue.split("#")[1]; + const { Credentials: Credentials2, AssumedRoleUser: AssumedRoleUser2 } = await stsClient.send(new AssumeRoleCommand(params)); + if (!Credentials2 || !Credentials2.AccessKeyId || !Credentials2.SecretAccessKey) { + throw new Error(`Invalid response from STS.assumeRole call with role ${params.RoleArn}`); } - return cleanValue; - }; - const headerKey = findKey(output.headers, "x-amzn-errortype"); - if (headerKey !== void 0) { - return sanitizeErrorCode(output.headers[headerKey]); - } - if (data.code !== void 0) { - return sanitizeErrorCode(data.code); - } - if (data["__type"] !== void 0) { - return sanitizeErrorCode(data["__type"]); - } - }; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/CreateActivityCommand.js -var require_CreateActivityCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/CreateActivityCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.CreateActivityCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var CreateActivityCommand = class _CreateActivityCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { + const accountId = getAccountIdFromAssumedRoleUser(AssumedRoleUser2); return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _CreateActivityCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "CreateActivityCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "CreateActivity" - } + accessKeyId: Credentials2.AccessKeyId, + secretAccessKey: Credentials2.SecretAccessKey, + sessionToken: Credentials2.SessionToken, + expiration: Credentials2.Expiration, + // TODO(credentialScope): access normally when shape is updated. + ...Credentials2.CredentialScope && { credentialScope: Credentials2.CredentialScope }, + ...accountId && { accountId } }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_CreateActivityCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_CreateActivityCommand)(output, context); - } - }; - exports2.CreateActivityCommand = CreateActivityCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/CreateStateMachineAliasCommand.js -var require_CreateStateMachineAliasCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/CreateStateMachineAliasCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.CreateStateMachineAliasCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var CreateStateMachineAliasCommand = class _CreateStateMachineAliasCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { + }; + }, "getDefaultRoleAssumer"); + var getDefaultRoleAssumerWithWebIdentity = /* @__PURE__ */ __name((stsOptions, stsClientCtor) => { + let stsClient; + return async (params) => { + var _a2, _b, _c; + if (!stsClient) { + const { + logger = (_a2 = stsOptions == null ? void 0 : stsOptions.parentClientConfig) == null ? void 0 : _a2.logger, + region, + requestHandler = (_b = stsOptions == null ? void 0 : stsOptions.parentClientConfig) == null ? void 0 : _b.requestHandler, + credentialProviderLogger + } = stsOptions; + const resolvedRegion = await resolveRegion( + region, + (_c = stsOptions == null ? void 0 : stsOptions.parentClientConfig) == null ? void 0 : _c.region, + credentialProviderLogger + ); + const isCompatibleRequestHandler = !isH2(requestHandler); + stsClient = new stsClientCtor({ + region: resolvedRegion, + requestHandler: isCompatibleRequestHandler ? requestHandler : void 0, + logger + }); + } + const { Credentials: Credentials2, AssumedRoleUser: AssumedRoleUser2 } = await stsClient.send(new AssumeRoleWithWebIdentityCommand(params)); + if (!Credentials2 || !Credentials2.AccessKeyId || !Credentials2.SecretAccessKey) { + throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${params.RoleArn}`); + } + const accountId = getAccountIdFromAssumedRoleUser(AssumedRoleUser2); return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } + accessKeyId: Credentials2.AccessKeyId, + secretAccessKey: Credentials2.SecretAccessKey, + sessionToken: Credentials2.SessionToken, + expiration: Credentials2.Expiration, + // TODO(credentialScope): access normally when shape is updated. + ...Credentials2.CredentialScope && { credentialScope: Credentials2.CredentialScope }, + ...accountId && { accountId } }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _CreateStateMachineAliasCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "CreateStateMachineAliasCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.CreateStateMachineAliasInputFilterSensitiveLog, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "CreateStateMachineAlias" + }; + }, "getDefaultRoleAssumerWithWebIdentity"); + var isH2 = /* @__PURE__ */ __name((requestHandler) => { + var _a2; + return ((_a2 = requestHandler == null ? void 0 : requestHandler.metadata) == null ? void 0 : _a2.handlerProtocol) === "h2"; + }, "isH2"); + var import_STSClient2 = require_STSClient(); + var getCustomizableStsClientCtor = /* @__PURE__ */ __name((baseCtor, customizations) => { + var _a2; + if (!customizations) + return baseCtor; + else + return _a2 = class extends baseCtor { + constructor(config) { + super(config); + for (const customization of customizations) { + this.middlewareStack.use(customization); + } } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_CreateStateMachineAliasCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_CreateStateMachineAliasCommand)(output, context); - } - }; - exports2.CreateStateMachineAliasCommand = CreateStateMachineAliasCommand; + }, __name(_a2, "CustomizableSTSClient"), _a2; + }, "getCustomizableStsClientCtor"); + var getDefaultRoleAssumer2 = /* @__PURE__ */ __name((stsOptions = {}, stsPlugins) => getDefaultRoleAssumer(stsOptions, getCustomizableStsClientCtor(import_STSClient2.STSClient, stsPlugins)), "getDefaultRoleAssumer"); + var getDefaultRoleAssumerWithWebIdentity2 = /* @__PURE__ */ __name((stsOptions = {}, stsPlugins) => getDefaultRoleAssumerWithWebIdentity(stsOptions, getCustomizableStsClientCtor(import_STSClient2.STSClient, stsPlugins)), "getDefaultRoleAssumerWithWebIdentity"); + var decorateDefaultCredentialProvider = /* @__PURE__ */ __name((provider) => (input) => provider({ + roleAssumer: getDefaultRoleAssumer2(input), + roleAssumerWithWebIdentity: getDefaultRoleAssumerWithWebIdentity2(input), + ...input + }), "decorateDefaultCredentialProvider"); } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/CreateStateMachineCommand.js -var require_CreateStateMachineCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/CreateStateMachineCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/credential-provider-process/dist-cjs/index.js +var require_dist_cjs76 = __commonJS({ + "../../../node_modules/@aws-sdk/credential-provider-process/dist-cjs/index.js"(exports2, module2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.CreateStateMachineCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var CreateStateMachineCommand = class _CreateStateMachineCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _CreateStateMachineCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "CreateStateMachineCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.CreateStateMachineInputFilterSensitiveLog, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "CreateStateMachine" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_CreateStateMachineCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_CreateStateMachineCommand)(output, context); - } + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); }; - exports2.CreateStateMachineCommand = CreateStateMachineCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DeleteActivityCommand.js -var require_DeleteActivityCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DeleteActivityCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DeleteActivityCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var DeleteActivityCommand = class _DeleteActivityCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _DeleteActivityCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "DeleteActivityCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "DeleteActivity" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_DeleteActivityCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_DeleteActivityCommand)(output, context); + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - exports2.DeleteActivityCommand = DeleteActivityCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DeleteStateMachineAliasCommand.js -var require_DeleteStateMachineAliasCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DeleteStateMachineAliasCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DeleteStateMachineAliasCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var DeleteStateMachineAliasCommand = class _DeleteStateMachineAliasCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _DeleteStateMachineAliasCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "DeleteStateMachineAliasCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "DeleteStateMachineAlias" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_DeleteStateMachineAliasCommand)(input, context); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + fromProcess: () => fromProcess + }); + module2.exports = __toCommonJS2(src_exports); + var import_shared_ini_file_loader = require_dist_cjs41(); + var import_property_provider2 = require_dist_cjs40(); + var import_child_process = require("child_process"); + var import_util = require("util"); + var getValidatedProcessCredentials = /* @__PURE__ */ __name((profileName, data, profiles) => { + var _a; + if (data.Version !== 1) { + throw Error(`Profile ${profileName} credential_process did not return Version 1.`); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_DeleteStateMachineAliasCommand)(output, context); + if (data.AccessKeyId === void 0 || data.SecretAccessKey === void 0) { + throw Error(`Profile ${profileName} credential_process returned invalid credentials.`); } - }; - exports2.DeleteStateMachineAliasCommand = DeleteStateMachineAliasCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DeleteStateMachineCommand.js -var require_DeleteStateMachineCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DeleteStateMachineCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DeleteStateMachineCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var DeleteStateMachineCommand = class _DeleteStateMachineCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + if (data.Expiration) { + const currentTime = /* @__PURE__ */ new Date(); + const expireTime = new Date(data.Expiration); + if (expireTime < currentTime) { + throw Error(`Profile ${profileName} credential_process returned expired credentials.`); + } } - constructor(input) { - super(); - this.input = input; + let accountId = data.AccountId; + if (!accountId && ((_a = profiles == null ? void 0 : profiles[profileName]) == null ? void 0 : _a.aws_account_id)) { + accountId = profiles[profileName].aws_account_id; } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _DeleteStateMachineCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "DeleteStateMachineCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "DeleteStateMachine" + return { + accessKeyId: data.AccessKeyId, + secretAccessKey: data.SecretAccessKey, + ...data.SessionToken && { sessionToken: data.SessionToken }, + ...data.Expiration && { expiration: new Date(data.Expiration) }, + ...data.CredentialScope && { credentialScope: data.CredentialScope }, + ...accountId && { accountId } + }; + }, "getValidatedProcessCredentials"); + var resolveProcessCredentials = /* @__PURE__ */ __name(async (profileName, profiles, logger) => { + const profile = profiles[profileName]; + if (profiles[profileName]) { + const credentialProcess = profile["credential_process"]; + if (credentialProcess !== void 0) { + const execPromise = (0, import_util.promisify)(import_child_process.exec); + try { + const { stdout } = await execPromise(credentialProcess); + let data; + try { + data = JSON.parse(stdout.trim()); + } catch { + throw Error(`Profile ${profileName} credential_process returned invalid JSON.`); + } + return getValidatedProcessCredentials(profileName, data, profiles); + } catch (error) { + throw new import_property_provider2.CredentialsProviderError(error.message, { logger }); } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_DeleteStateMachineCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_DeleteStateMachineCommand)(output, context); + } else { + throw new import_property_provider2.CredentialsProviderError(`Profile ${profileName} did not contain credential_process.`, { logger }); + } + } else { + throw new import_property_provider2.CredentialsProviderError(`Profile ${profileName} could not be found in shared credentials file.`, { + logger + }); } - }; - exports2.DeleteStateMachineCommand = DeleteStateMachineCommand; + }, "resolveProcessCredentials"); + var fromProcess = /* @__PURE__ */ __name((init = {}) => async () => { + var _a; + (_a = init.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-process - fromProcess"); + const profiles = await (0, import_shared_ini_file_loader.parseKnownFiles)(init); + return resolveProcessCredentials((0, import_shared_ini_file_loader.getProfileName)(init), profiles, init.logger); + }, "fromProcess"); } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DeleteStateMachineVersionCommand.js -var require_DeleteStateMachineVersionCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DeleteStateMachineVersionCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromWebToken.js +var require_fromWebToken = __commonJS({ + "../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromWebToken.js"(exports2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DeleteStateMachineVersionCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var DeleteStateMachineVersionCommand = class _DeleteStateMachineVersionCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _DeleteStateMachineVersionCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "DeleteStateMachineVersionCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "DeleteStateMachineVersion" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; } - serialize(input, context) { - return (0, Aws_json1_0_1.se_DeleteStateMachineVersionCommand)(input, context); + Object.defineProperty(o, k2, desc); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar2 = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_DeleteStateMachineVersionCommand)(output, context); + __setModuleDefault2(result, mod); + return result; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.fromWebToken = void 0; + var fromWebToken2 = (init) => async () => { + init.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken"); + const { roleArn, roleSessionName, webIdentityToken, providerId, policyArns, policy, durationSeconds } = init; + let { roleAssumerWithWebIdentity } = init; + if (!roleAssumerWithWebIdentity) { + const { getDefaultRoleAssumerWithWebIdentity } = await Promise.resolve().then(() => __importStar2(require_dist_cjs75())); + roleAssumerWithWebIdentity = getDefaultRoleAssumerWithWebIdentity({ + ...init.clientConfig, + credentialProviderLogger: init.logger, + parentClientConfig: init.parentClientConfig + }, init.clientPlugins); } + return roleAssumerWithWebIdentity({ + RoleArn: roleArn, + RoleSessionName: roleSessionName ?? `aws-sdk-js-session-${Date.now()}`, + WebIdentityToken: webIdentityToken, + ProviderId: providerId, + PolicyArns: policyArns, + Policy: policy, + DurationSeconds: durationSeconds + }); }; - exports2.DeleteStateMachineVersionCommand = DeleteStateMachineVersionCommand; + exports2.fromWebToken = fromWebToken2; } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DescribeActivityCommand.js -var require_DescribeActivityCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DescribeActivityCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromTokenFile.js +var require_fromTokenFile = __commonJS({ + "../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromTokenFile.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DescribeActivityCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var DescribeActivityCommand = class _DescribeActivityCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _DescribeActivityCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "DescribeActivityCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "DescribeActivity" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_DescribeActivityCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_DescribeActivityCommand)(output, context); + exports2.fromTokenFile = void 0; + var property_provider_1 = require_dist_cjs40(); + var fs_1 = require("fs"); + var fromWebToken_1 = require_fromWebToken(); + var ENV_TOKEN_FILE = "AWS_WEB_IDENTITY_TOKEN_FILE"; + var ENV_ROLE_ARN = "AWS_ROLE_ARN"; + var ENV_ROLE_SESSION_NAME = "AWS_ROLE_SESSION_NAME"; + var fromTokenFile2 = (init = {}) => async () => { + init.logger?.debug("@aws-sdk/credential-provider-web-identity - fromTokenFile"); + const webIdentityTokenFile = init?.webIdentityTokenFile ?? process.env[ENV_TOKEN_FILE]; + const roleArn = init?.roleArn ?? process.env[ENV_ROLE_ARN]; + const roleSessionName = init?.roleSessionName ?? process.env[ENV_ROLE_SESSION_NAME]; + if (!webIdentityTokenFile || !roleArn) { + throw new property_provider_1.CredentialsProviderError("Web identity configuration not specified", { + logger: init.logger + }); } + return (0, fromWebToken_1.fromWebToken)({ + ...init, + webIdentityToken: (0, fs_1.readFileSync)(webIdentityTokenFile, { encoding: "ascii" }), + roleArn, + roleSessionName + })(); }; - exports2.DescribeActivityCommand = DescribeActivityCommand; + exports2.fromTokenFile = fromTokenFile2; } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DescribeExecutionCommand.js -var require_DescribeExecutionCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DescribeExecutionCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/index.js +var require_dist_cjs77 = __commonJS({ + "../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/index.js"(exports2, module2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DescribeExecutionCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var DescribeExecutionCommand = class _DescribeExecutionCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _DescribeExecutionCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "DescribeExecutionCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: models_0_1.DescribeExecutionOutputFilterSensitiveLog, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "DescribeExecution" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_DescribeExecutionCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_DescribeExecutionCommand)(output, context); + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } + return to; }; - exports2.DescribeExecutionCommand = DescribeExecutionCommand; + var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + module2.exports = __toCommonJS2(src_exports); + __reExport(src_exports, require_fromTokenFile(), module2.exports); + __reExport(src_exports, require_fromWebToken(), module2.exports); } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DescribeMapRunCommand.js -var require_DescribeMapRunCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DescribeMapRunCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js +var require_dist_cjs78 = __commonJS({ + "../../../node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js"(exports2, module2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DescribeMapRunCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var DescribeMapRunCommand = class _DescribeMapRunCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; + var __create2 = Object.create; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __getProtoOf2 = Object.getPrototypeOf; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _DescribeMapRunCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "DescribeMapRunCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "DescribeMapRun" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + return to; + }; + var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, + mod + )); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + fromIni: () => fromIni + }); + module2.exports = __toCommonJS2(src_exports); + var import_shared_ini_file_loader = require_dist_cjs41(); + var import_property_provider2 = require_dist_cjs40(); + var resolveCredentialSource = /* @__PURE__ */ __name((credentialSource, profileName, logger) => { + const sourceProvidersMap = { + EcsContainer: async (options) => { + const { fromHttp } = await Promise.resolve().then(() => __toESM2(require_dist_cjs55())); + const { fromContainerMetadata } = await Promise.resolve().then(() => __toESM2(require_dist_cjs49())); + logger == null ? void 0 : logger.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer"); + return (0, import_property_provider2.chain)(fromHttp(options ?? {}), fromContainerMetadata(options)); + }, + Ec2InstanceMetadata: async (options) => { + logger == null ? void 0 : logger.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata"); + const { fromInstanceMetadata } = await Promise.resolve().then(() => __toESM2(require_dist_cjs49())); + return fromInstanceMetadata(options); + }, + Environment: async (options) => { + logger == null ? void 0 : logger.debug("@aws-sdk/credential-provider-ini - credential_source is Environment"); + const { fromEnv } = await Promise.resolve().then(() => __toESM2(require_dist_cjs48())); + return fromEnv(options); + } + }; + if (credentialSource in sourceProvidersMap) { + return sourceProvidersMap[credentialSource]; + } else { + throw new import_property_provider2.CredentialsProviderError( + `Unsupported credential source in profile ${profileName}. Got ${credentialSource}, expected EcsContainer or Ec2InstanceMetadata or Environment.`, + { logger } + ); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_DescribeMapRunCommand)(input, context); + }, "resolveCredentialSource"); + var isAssumeRoleProfile = /* @__PURE__ */ __name((arg, { profile = "default", logger } = {}) => { + return Boolean(arg) && typeof arg === "object" && typeof arg.role_arn === "string" && ["undefined", "string"].indexOf(typeof arg.role_session_name) > -1 && ["undefined", "string"].indexOf(typeof arg.external_id) > -1 && ["undefined", "string"].indexOf(typeof arg.mfa_serial) > -1 && (isAssumeRoleWithSourceProfile(arg, { profile, logger }) || isCredentialSourceProfile(arg, { profile, logger })); + }, "isAssumeRoleProfile"); + var isAssumeRoleWithSourceProfile = /* @__PURE__ */ __name((arg, { profile, logger }) => { + var _a; + const withSourceProfile = typeof arg.source_profile === "string" && typeof arg.credential_source === "undefined"; + if (withSourceProfile) { + (_a = logger == null ? void 0 : logger.debug) == null ? void 0 : _a.call(logger, ` ${profile} isAssumeRoleWithSourceProfile source_profile=${arg.source_profile}`); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_DescribeMapRunCommand)(output, context); + return withSourceProfile; + }, "isAssumeRoleWithSourceProfile"); + var isCredentialSourceProfile = /* @__PURE__ */ __name((arg, { profile, logger }) => { + var _a; + const withProviderProfile = typeof arg.credential_source === "string" && typeof arg.source_profile === "undefined"; + if (withProviderProfile) { + (_a = logger == null ? void 0 : logger.debug) == null ? void 0 : _a.call(logger, ` ${profile} isCredentialSourceProfile credential_source=${arg.credential_source}`); } - }; - exports2.DescribeMapRunCommand = DescribeMapRunCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DescribeStateMachineAliasCommand.js -var require_DescribeStateMachineAliasCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DescribeStateMachineAliasCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DescribeStateMachineAliasCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var DescribeStateMachineAliasCommand = class _DescribeStateMachineAliasCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + return withProviderProfile; + }, "isCredentialSourceProfile"); + var resolveAssumeRoleCredentials = /* @__PURE__ */ __name(async (profileName, profiles, options, visitedProfiles = {}) => { + var _a, _b; + (_a = options.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-ini - resolveAssumeRoleCredentials (STS)"); + const data = profiles[profileName]; + if (!options.roleAssumer) { + const { getDefaultRoleAssumer } = await Promise.resolve().then(() => __toESM2(require_dist_cjs75())); + options.roleAssumer = getDefaultRoleAssumer( + { + ...options.clientConfig, + credentialProviderLogger: options.logger, + parentClientConfig: options == null ? void 0 : options.parentClientConfig + }, + options.clientPlugins + ); } - constructor(input) { - super(); - this.input = input; + const { source_profile } = data; + if (source_profile && source_profile in visitedProfiles) { + throw new import_property_provider2.CredentialsProviderError( + `Detected a cycle attempting to resolve credentials for profile ${(0, import_shared_ini_file_loader.getProfileName)(options)}. Profiles visited: ` + Object.keys(visitedProfiles).join(", "), + { logger: options.logger } + ); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _DescribeStateMachineAliasCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "DescribeStateMachineAliasCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: models_0_1.DescribeStateMachineAliasOutputFilterSensitiveLog, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "DescribeStateMachineAlias" + (_b = options.logger) == null ? void 0 : _b.debug( + `@aws-sdk/credential-provider-ini - finding credential resolver using ${source_profile ? `source_profile=[${source_profile}]` : `profile=[${profileName}]`}` + ); + const sourceCredsProvider = source_profile ? resolveProfileData( + source_profile, + { + ...profiles, + [source_profile]: { + ...profiles[source_profile], + // This assigns the role_arn of the "root" profile + // to the credential_source profile so this recursive call knows + // what role to assume. + role_arn: data.role_arn ?? profiles[source_profile].role_arn } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_DescribeStateMachineAliasCommand)(input, context); + }, + options, + { + ...visitedProfiles, + [source_profile]: true + } + ) : (await resolveCredentialSource(data.credential_source, profileName, options.logger)(options))(); + const params = { + RoleArn: data.role_arn, + RoleSessionName: data.role_session_name || `aws-sdk-js-${Date.now()}`, + ExternalId: data.external_id, + DurationSeconds: parseInt(data.duration_seconds || "3600", 10) + }; + const { mfa_serial } = data; + if (mfa_serial) { + if (!options.mfaCodeProvider) { + throw new import_property_provider2.CredentialsProviderError( + `Profile ${profileName} requires multi-factor authentication, but no MFA code callback was provided.`, + { logger: options.logger, tryNextLink: false } + ); + } + params.SerialNumber = mfa_serial; + params.TokenCode = await options.mfaCodeProvider(mfa_serial); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_DescribeStateMachineAliasCommand)(output, context); + const sourceCreds = await sourceCredsProvider; + return options.roleAssumer(sourceCreds, params); + }, "resolveAssumeRoleCredentials"); + var isProcessProfile = /* @__PURE__ */ __name((arg) => Boolean(arg) && typeof arg === "object" && typeof arg.credential_process === "string", "isProcessProfile"); + var resolveProcessCredentials = /* @__PURE__ */ __name(async (options, profile) => Promise.resolve().then(() => __toESM2(require_dist_cjs76())).then( + ({ fromProcess }) => fromProcess({ + ...options, + profile + })() + ), "resolveProcessCredentials"); + var resolveSsoCredentials = /* @__PURE__ */ __name(async (profile, options = {}) => { + const { fromSSO } = await Promise.resolve().then(() => __toESM2(require_dist_cjs74())); + return fromSSO({ + profile, + logger: options.logger + })(); + }, "resolveSsoCredentials"); + var isSsoProfile = /* @__PURE__ */ __name((arg) => arg && (typeof arg.sso_start_url === "string" || typeof arg.sso_account_id === "string" || typeof arg.sso_session === "string" || typeof arg.sso_region === "string" || typeof arg.sso_role_name === "string"), "isSsoProfile"); + var isStaticCredsProfile = /* @__PURE__ */ __name((arg) => Boolean(arg) && typeof arg === "object" && typeof arg.aws_access_key_id === "string" && typeof arg.aws_secret_access_key === "string" && ["undefined", "string"].indexOf(typeof arg.aws_session_token) > -1 && ["undefined", "string"].indexOf(typeof arg.aws_account_id) > -1, "isStaticCredsProfile"); + var resolveStaticCredentials = /* @__PURE__ */ __name((profile, options) => { + var _a; + (_a = options == null ? void 0 : options.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-ini - resolveStaticCredentials"); + return Promise.resolve({ + accessKeyId: profile.aws_access_key_id, + secretAccessKey: profile.aws_secret_access_key, + sessionToken: profile.aws_session_token, + ...profile.aws_credential_scope && { credentialScope: profile.aws_credential_scope }, + ...profile.aws_account_id && { accountId: profile.aws_account_id } + }); + }, "resolveStaticCredentials"); + var isWebIdentityProfile = /* @__PURE__ */ __name((arg) => Boolean(arg) && typeof arg === "object" && typeof arg.web_identity_token_file === "string" && typeof arg.role_arn === "string" && ["undefined", "string"].indexOf(typeof arg.role_session_name) > -1, "isWebIdentityProfile"); + var resolveWebIdentityCredentials = /* @__PURE__ */ __name(async (profile, options) => Promise.resolve().then(() => __toESM2(require_dist_cjs77())).then( + ({ fromTokenFile: fromTokenFile2 }) => fromTokenFile2({ + webIdentityTokenFile: profile.web_identity_token_file, + roleArn: profile.role_arn, + roleSessionName: profile.role_session_name, + roleAssumerWithWebIdentity: options.roleAssumerWithWebIdentity, + logger: options.logger, + parentClientConfig: options.parentClientConfig + })() + ), "resolveWebIdentityCredentials"); + var resolveProfileData = /* @__PURE__ */ __name(async (profileName, profiles, options, visitedProfiles = {}) => { + const data = profiles[profileName]; + if (Object.keys(visitedProfiles).length > 0 && isStaticCredsProfile(data)) { + return resolveStaticCredentials(data, options); } - }; - exports2.DescribeStateMachineAliasCommand = DescribeStateMachineAliasCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DescribeStateMachineCommand.js -var require_DescribeStateMachineCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DescribeStateMachineCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DescribeStateMachineCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var DescribeStateMachineCommand = class _DescribeStateMachineCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + if (isAssumeRoleProfile(data, { profile: profileName, logger: options.logger })) { + return resolveAssumeRoleCredentials(profileName, profiles, options, visitedProfiles); } - constructor(input) { - super(); - this.input = input; + if (isStaticCredsProfile(data)) { + return resolveStaticCredentials(data, options); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _DescribeStateMachineCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "DescribeStateMachineCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: models_0_1.DescribeStateMachineOutputFilterSensitiveLog, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "DescribeStateMachine" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + if (isWebIdentityProfile(data)) { + return resolveWebIdentityCredentials(data, options); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_DescribeStateMachineCommand)(input, context); + if (isProcessProfile(data)) { + return resolveProcessCredentials(options, profileName); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_DescribeStateMachineCommand)(output, context); + if (isSsoProfile(data)) { + return await resolveSsoCredentials(profileName, options); } - }; - exports2.DescribeStateMachineCommand = DescribeStateMachineCommand; + throw new import_property_provider2.CredentialsProviderError( + `Could not resolve credentials using profile: [${profileName}] in configuration/credentials file(s).`, + { logger: options.logger } + ); + }, "resolveProfileData"); + var fromIni = /* @__PURE__ */ __name((init = {}) => async () => { + var _a; + (_a = init.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-ini - fromIni"); + const profiles = await (0, import_shared_ini_file_loader.parseKnownFiles)(init); + return resolveProfileData((0, import_shared_ini_file_loader.getProfileName)(init), profiles, init); + }, "fromIni"); } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DescribeStateMachineForExecutionCommand.js -var require_DescribeStateMachineForExecutionCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/DescribeStateMachineForExecutionCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js +var require_dist_cjs79 = __commonJS({ + "../../../node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js"(exports2, module2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.DescribeStateMachineForExecutionCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var DescribeStateMachineForExecutionCommand = class _DescribeStateMachineForExecutionCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + var __create2 = Object.create; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __getProtoOf2 = Object.getPrototypeOf; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - constructor(input) { - super(); - this.input = input; + return to; + }; + var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, + mod + )); + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + credentialsTreatedAsExpired: () => credentialsTreatedAsExpired, + credentialsWillNeedRefresh: () => credentialsWillNeedRefresh, + defaultProvider: () => defaultProvider + }); + module2.exports = __toCommonJS2(src_exports); + var import_credential_provider_env = require_dist_cjs48(); + var import_shared_ini_file_loader = require_dist_cjs41(); + var import_property_provider2 = require_dist_cjs40(); + var ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED"; + var remoteProvider = /* @__PURE__ */ __name(async (init) => { + var _a, _b; + const { ENV_CMDS_FULL_URI, ENV_CMDS_RELATIVE_URI, fromContainerMetadata, fromInstanceMetadata } = await Promise.resolve().then(() => __toESM2(require_dist_cjs49())); + if (process.env[ENV_CMDS_RELATIVE_URI] || process.env[ENV_CMDS_FULL_URI]) { + (_a = init.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-node - remoteProvider::fromHttp/fromContainerMetadata"); + const { fromHttp } = await Promise.resolve().then(() => __toESM2(require_dist_cjs55())); + return (0, import_property_provider2.chain)(fromHttp(init), fromContainerMetadata(init)); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _DescribeStateMachineForExecutionCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "DescribeStateMachineForExecutionCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: models_0_1.DescribeStateMachineForExecutionOutputFilterSensitiveLog, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "DescribeStateMachineForExecution" - } + if (process.env[ENV_IMDS_DISABLED]) { + return async () => { + throw new import_property_provider2.CredentialsProviderError("EC2 Instance Metadata Service access disabled", { logger: init.logger }); }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_DescribeStateMachineForExecutionCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_DescribeStateMachineForExecutionCommand)(output, context); } - }; - exports2.DescribeStateMachineForExecutionCommand = DescribeStateMachineForExecutionCommand; + (_b = init.logger) == null ? void 0 : _b.debug("@aws-sdk/credential-provider-node - remoteProvider::fromInstanceMetadata"); + return fromInstanceMetadata(init); + }, "remoteProvider"); + var multipleCredentialSourceWarningEmitted = false; + var defaultProvider = /* @__PURE__ */ __name((init = {}) => (0, import_property_provider2.memoize)( + (0, import_property_provider2.chain)( + async () => { + var _a, _b, _c, _d; + const profile = init.profile ?? process.env[import_shared_ini_file_loader.ENV_PROFILE]; + if (profile) { + const envStaticCredentialsAreSet = process.env[import_credential_provider_env.ENV_KEY] && process.env[import_credential_provider_env.ENV_SECRET]; + if (envStaticCredentialsAreSet) { + if (!multipleCredentialSourceWarningEmitted) { + const warnFn = ((_a = init.logger) == null ? void 0 : _a.warn) && ((_c = (_b = init.logger) == null ? void 0 : _b.constructor) == null ? void 0 : _c.name) !== "NoOpLogger" ? init.logger.warn : console.warn; + warnFn( + `@aws-sdk/credential-provider-node - defaultProvider::fromEnv WARNING: + Multiple credential sources detected: + Both AWS_PROFILE and the pair AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY static credentials are set. + This SDK will proceed with the AWS_PROFILE value. + + However, a future version may change this behavior to prefer the ENV static credentials. + Please ensure that your environment only sets either the AWS_PROFILE or the + AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY pair. +` + ); + multipleCredentialSourceWarningEmitted = true; + } + } + throw new import_property_provider2.CredentialsProviderError("AWS_PROFILE is set, skipping fromEnv provider.", { + logger: init.logger, + tryNextLink: true + }); + } + (_d = init.logger) == null ? void 0 : _d.debug("@aws-sdk/credential-provider-node - defaultProvider::fromEnv"); + return (0, import_credential_provider_env.fromEnv)(init)(); + }, + async () => { + var _a; + (_a = init.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-node - defaultProvider::fromSSO"); + const { ssoStartUrl, ssoAccountId, ssoRegion, ssoRoleName, ssoSession } = init; + if (!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession) { + throw new import_property_provider2.CredentialsProviderError( + "Skipping SSO provider in default chain (inputs do not include SSO fields).", + { logger: init.logger } + ); + } + const { fromSSO } = await Promise.resolve().then(() => __toESM2(require_dist_cjs74())); + return fromSSO(init)(); + }, + async () => { + var _a; + (_a = init.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-node - defaultProvider::fromIni"); + const { fromIni } = await Promise.resolve().then(() => __toESM2(require_dist_cjs78())); + return fromIni(init)(); + }, + async () => { + var _a; + (_a = init.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-node - defaultProvider::fromProcess"); + const { fromProcess } = await Promise.resolve().then(() => __toESM2(require_dist_cjs76())); + return fromProcess(init)(); + }, + async () => { + var _a; + (_a = init.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-node - defaultProvider::fromTokenFile"); + const { fromTokenFile: fromTokenFile2 } = await Promise.resolve().then(() => __toESM2(require_dist_cjs77())); + return fromTokenFile2(init)(); + }, + async () => { + var _a; + (_a = init.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-node - defaultProvider::remoteProvider"); + return (await remoteProvider(init))(); + }, + async () => { + throw new import_property_provider2.CredentialsProviderError("Could not load credentials from any providers", { + tryNextLink: false, + logger: init.logger + }); + } + ), + credentialsTreatedAsExpired, + credentialsWillNeedRefresh + ), "defaultProvider"); + var credentialsWillNeedRefresh = /* @__PURE__ */ __name((credentials) => (credentials == null ? void 0 : credentials.expiration) !== void 0, "credentialsWillNeedRefresh"); + var credentialsTreatedAsExpired = /* @__PURE__ */ __name((credentials) => (credentials == null ? void 0 : credentials.expiration) !== void 0 && credentials.expiration.getTime() - Date.now() < 3e5, "credentialsTreatedAsExpired"); } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/GetActivityTaskCommand.js -var require_GetActivityTaskCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/GetActivityTaskCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/endpoint/ruleset.js +var require_ruleset4 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/endpoint/ruleset.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.GetActivityTaskCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var GetActivityTaskCommand = class _GetActivityTaskCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _GetActivityTaskCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "GetActivityTaskCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: models_0_1.GetActivityTaskOutputFilterSensitiveLog, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "GetActivityTask" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_GetActivityTaskCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_GetActivityTaskCommand)(output, context); - } - }; - exports2.GetActivityTaskCommand = GetActivityTaskCommand; + exports2.ruleSet = void 0; + var t = "required"; + var u = "fn"; + var v = "argv"; + var w = "ref"; + var a = true; + var b = "isSet"; + var c = "booleanEquals"; + var d = "error"; + var e = "endpoint"; + var f = "tree"; + var g = "PartitionResult"; + var h = { [t]: false, "type": "String" }; + var i = { [t]: true, "default": false, "type": "Boolean" }; + var j = { [w]: "Endpoint" }; + var k = { [u]: c, [v]: [{ [w]: "UseFIPS" }, true] }; + var l = { [u]: c, [v]: [{ [w]: "UseDualStack" }, true] }; + var m = {}; + var n = { [w]: "Region" }; + var o = { [u]: "getAttr", [v]: [{ [w]: g }, "supportsFIPS"] }; + var p = { [u]: c, [v]: [true, { [u]: "getAttr", [v]: [{ [w]: g }, "supportsDualStack"] }] }; + var q = [k]; + var r = [l]; + var s = [n]; + var _data = { version: "1.0", parameters: { Region: h, UseDualStack: i, UseFIPS: i, Endpoint: h }, rules: [{ conditions: [{ [u]: b, [v]: [j] }], rules: [{ conditions: q, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: d }, { conditions: r, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: d }, { endpoint: { url: j, properties: m, headers: m }, type: e }], type: f }, { conditions: [{ [u]: b, [v]: s }], rules: [{ conditions: [{ [u]: "aws.partition", [v]: s, assign: g }], rules: [{ conditions: [k, l], rules: [{ conditions: [{ [u]: c, [v]: [a, o] }, p], rules: [{ endpoint: { url: "https://states-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: m, headers: m }, type: e }], type: f }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: d }], type: f }, { conditions: q, rules: [{ conditions: [{ [u]: c, [v]: [o, a] }], rules: [{ conditions: [{ [u]: "stringEquals", [v]: [n, "us-gov-west-1"] }], endpoint: { url: "https://states.us-gov-west-1.amazonaws.com", properties: m, headers: m }, type: e }, { endpoint: { url: "https://states-fips.{Region}.{PartitionResult#dnsSuffix}", properties: m, headers: m }, type: e }], type: f }, { error: "FIPS is enabled but this partition does not support FIPS", type: d }], type: f }, { conditions: r, rules: [{ conditions: [p], rules: [{ endpoint: { url: "https://states.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: m, headers: m }, type: e }], type: f }, { error: "DualStack is enabled but this partition does not support DualStack", type: d }], type: f }, { endpoint: { url: "https://states.{Region}.{PartitionResult#dnsSuffix}", properties: m, headers: m }, type: e }], type: f }], type: f }, { error: "Invalid Configuration: Missing Region", type: d }] }; + exports2.ruleSet = _data; } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/GetExecutionHistoryCommand.js -var require_GetExecutionHistoryCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/GetExecutionHistoryCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/endpoint/endpointResolver.js +var require_endpointResolver4 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/endpoint/endpointResolver.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.GetExecutionHistoryCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var GetExecutionHistoryCommand = class _GetExecutionHistoryCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _GetExecutionHistoryCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "GetExecutionHistoryCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: models_0_1.GetExecutionHistoryOutputFilterSensitiveLog, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "GetExecutionHistory" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_GetExecutionHistoryCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_GetExecutionHistoryCommand)(output, context); - } + exports2.defaultEndpointResolver = void 0; + var util_endpoints_1 = require_dist_cjs7(); + var util_endpoints_2 = require_dist_cjs6(); + var ruleset_1 = require_ruleset4(); + var defaultEndpointResolver = (endpointParams, context = {}) => { + return (0, util_endpoints_2.resolveEndpoint)(ruleset_1.ruleSet, { + endpointParams, + logger: context.logger + }); }; - exports2.GetExecutionHistoryCommand = GetExecutionHistoryCommand; + exports2.defaultEndpointResolver = defaultEndpointResolver; + util_endpoints_2.customEndpointFunctions.aws = util_endpoints_1.awsEndpointFunctions; } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListActivitiesCommand.js -var require_ListActivitiesCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListActivitiesCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/runtimeConfig.shared.js +var require_runtimeConfig_shared4 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/runtimeConfig.shared.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ListActivitiesCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var ListActivitiesCommand = class _ListActivitiesCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _ListActivitiesCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "ListActivitiesCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "ListActivities" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_ListActivitiesCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_ListActivitiesCommand)(output, context); - } + exports2.getRuntimeConfig = void 0; + var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var smithy_client_1 = require_dist_cjs37(); + var url_parser_1 = require_dist_cjs44(); + var util_base64_1 = require_dist_cjs29(); + var util_utf8_1 = require_dist_cjs28(); + var httpAuthSchemeProvider_1 = require_httpAuthSchemeProvider(); + var endpointResolver_1 = require_endpointResolver4(); + var getRuntimeConfig = (config) => { + return { + apiVersion: "2016-11-23", + base64Decoder: config?.base64Decoder ?? util_base64_1.fromBase64, + base64Encoder: config?.base64Encoder ?? util_base64_1.toBase64, + disableHostPrefix: config?.disableHostPrefix ?? false, + endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver, + extensions: config?.extensions ?? [], + httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? httpAuthSchemeProvider_1.defaultSFNHttpAuthSchemeProvider, + httpAuthSchemes: config?.httpAuthSchemes ?? [ + { + schemeId: "aws.auth#sigv4", + identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"), + signer: new core_1.AwsSdkSigV4Signer() + } + ], + logger: config?.logger ?? new smithy_client_1.NoOpLogger(), + serviceId: config?.serviceId ?? "SFN", + urlParser: config?.urlParser ?? url_parser_1.parseUrl, + utf8Decoder: config?.utf8Decoder ?? util_utf8_1.fromUtf8, + utf8Encoder: config?.utf8Encoder ?? util_utf8_1.toUtf8 + }; }; - exports2.ListActivitiesCommand = ListActivitiesCommand; + exports2.getRuntimeConfig = getRuntimeConfig; } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListExecutionsCommand.js -var require_ListExecutionsCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListExecutionsCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/runtimeConfig.js +var require_runtimeConfig4 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/runtimeConfig.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ListExecutionsCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var ListExecutionsCommand = class _ListExecutionsCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _ListExecutionsCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "ListExecutionsCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "ListExecutions" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_ListExecutionsCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_ListExecutionsCommand)(output, context); - } + exports2.getRuntimeConfig = void 0; + var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); + var package_json_1 = tslib_1.__importDefault(require_package()); + var core_1 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var credential_provider_node_1 = require_dist_cjs79(); + var util_user_agent_node_1 = require_dist_cjs56(); + var config_resolver_1 = require_dist_cjs11(); + var hash_node_1 = require_dist_cjs57(); + var middleware_retry_1 = require_dist_cjs38(); + var node_config_provider_1 = require_dist_cjs42(); + var node_http_handler_1 = require_dist_cjs51(); + var util_body_length_node_1 = require_dist_cjs58(); + var util_retry_1 = require_dist_cjs60(); + var runtimeConfig_shared_1 = require_runtimeConfig_shared4(); + var smithy_client_1 = require_dist_cjs37(); + var util_defaults_mode_node_1 = require_dist_cjs69(); + var smithy_client_2 = require_dist_cjs37(); + var getRuntimeConfig = (config) => { + (0, smithy_client_2.emitWarningIfUnsupportedVersion)(process.version); + const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config); + const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode); + const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config); + (0, core_1.emitWarningIfUnsupportedVersion)(process.version); + return { + ...clientSharedValues, + ...config, + runtime: "node", + defaultsMode, + bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength, + credentialDefaultProvider: config?.credentialDefaultProvider ?? credential_provider_node_1.defaultProvider, + defaultUserAgentProvider: config?.defaultUserAgentProvider ?? (0, util_user_agent_node_1.defaultUserAgent)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }), + maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS), + region: config?.region ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_REGION_CONFIG_OPTIONS, config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS), + requestHandler: node_http_handler_1.NodeHttpHandler.create(config?.requestHandler ?? defaultConfigProvider), + retryMode: config?.retryMode ?? (0, node_config_provider_1.loadConfig)({ + ...middleware_retry_1.NODE_RETRY_MODE_CONFIG_OPTIONS, + default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE + }), + sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, "sha256"), + streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector, + useDualstackEndpoint: config?.useDualstackEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), + useFipsEndpoint: config?.useFipsEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS) + }; }; - exports2.ListExecutionsCommand = ListExecutionsCommand; + exports2.getRuntimeConfig = getRuntimeConfig; } }); -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListMapRunsCommand.js -var require_ListMapRunsCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListMapRunsCommand.js"(exports2) { +// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/index.js +var require_dist_cjs80 = __commonJS({ + "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/index.js"(exports2, module2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ListMapRunsCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var ListMapRunsCommand = class _ListMapRunsCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; + var __defProp2 = Object.defineProperty; + var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + var __getOwnPropNames2 = Object.getOwnPropertyNames; + var __hasOwnProp2 = Object.prototype.hasOwnProperty; + var __name = (target, value) => __defProp2(target, "name", { value, configurable: true }); + var __export2 = (target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps2 = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames2(from)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable }); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _ListMapRunsCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "ListMapRunsCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "ListMapRuns" + return to; + }; + var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod); + var src_exports = {}; + __export2(src_exports, { + ActivityAlreadyExists: () => ActivityAlreadyExists, + ActivityDoesNotExist: () => ActivityDoesNotExist, + ActivityFailedEventDetailsFilterSensitiveLog: () => ActivityFailedEventDetailsFilterSensitiveLog, + ActivityLimitExceeded: () => ActivityLimitExceeded, + ActivityScheduleFailedEventDetailsFilterSensitiveLog: () => ActivityScheduleFailedEventDetailsFilterSensitiveLog, + ActivityScheduledEventDetailsFilterSensitiveLog: () => ActivityScheduledEventDetailsFilterSensitiveLog, + ActivitySucceededEventDetailsFilterSensitiveLog: () => ActivitySucceededEventDetailsFilterSensitiveLog, + ActivityTimedOutEventDetailsFilterSensitiveLog: () => ActivityTimedOutEventDetailsFilterSensitiveLog, + ActivityWorkerLimitExceeded: () => ActivityWorkerLimitExceeded, + ConflictException: () => ConflictException, + CreateActivityCommand: () => CreateActivityCommand, + CreateStateMachineAliasCommand: () => CreateStateMachineAliasCommand, + CreateStateMachineAliasInputFilterSensitiveLog: () => CreateStateMachineAliasInputFilterSensitiveLog, + CreateStateMachineCommand: () => CreateStateMachineCommand, + CreateStateMachineInputFilterSensitiveLog: () => CreateStateMachineInputFilterSensitiveLog, + DeleteActivityCommand: () => DeleteActivityCommand, + DeleteStateMachineAliasCommand: () => DeleteStateMachineAliasCommand, + DeleteStateMachineCommand: () => DeleteStateMachineCommand, + DeleteStateMachineVersionCommand: () => DeleteStateMachineVersionCommand, + DescribeActivityCommand: () => DescribeActivityCommand, + DescribeExecutionCommand: () => DescribeExecutionCommand, + DescribeExecutionOutputFilterSensitiveLog: () => DescribeExecutionOutputFilterSensitiveLog, + DescribeMapRunCommand: () => DescribeMapRunCommand, + DescribeStateMachineAliasCommand: () => DescribeStateMachineAliasCommand, + DescribeStateMachineAliasOutputFilterSensitiveLog: () => DescribeStateMachineAliasOutputFilterSensitiveLog, + DescribeStateMachineCommand: () => DescribeStateMachineCommand, + DescribeStateMachineForExecutionCommand: () => DescribeStateMachineForExecutionCommand, + DescribeStateMachineForExecutionOutputFilterSensitiveLog: () => DescribeStateMachineForExecutionOutputFilterSensitiveLog, + DescribeStateMachineOutputFilterSensitiveLog: () => DescribeStateMachineOutputFilterSensitiveLog, + EncryptionType: () => EncryptionType, + ExecutionAbortedEventDetailsFilterSensitiveLog: () => ExecutionAbortedEventDetailsFilterSensitiveLog, + ExecutionAlreadyExists: () => ExecutionAlreadyExists, + ExecutionDoesNotExist: () => ExecutionDoesNotExist, + ExecutionFailedEventDetailsFilterSensitiveLog: () => ExecutionFailedEventDetailsFilterSensitiveLog, + ExecutionLimitExceeded: () => ExecutionLimitExceeded, + ExecutionNotRedrivable: () => ExecutionNotRedrivable, + ExecutionRedriveFilter: () => ExecutionRedriveFilter, + ExecutionRedriveStatus: () => ExecutionRedriveStatus, + ExecutionStartedEventDetailsFilterSensitiveLog: () => ExecutionStartedEventDetailsFilterSensitiveLog, + ExecutionStatus: () => ExecutionStatus, + ExecutionSucceededEventDetailsFilterSensitiveLog: () => ExecutionSucceededEventDetailsFilterSensitiveLog, + ExecutionTimedOutEventDetailsFilterSensitiveLog: () => ExecutionTimedOutEventDetailsFilterSensitiveLog, + GetActivityTaskCommand: () => GetActivityTaskCommand, + GetActivityTaskOutputFilterSensitiveLog: () => GetActivityTaskOutputFilterSensitiveLog, + GetExecutionHistoryCommand: () => GetExecutionHistoryCommand, + GetExecutionHistoryOutputFilterSensitiveLog: () => GetExecutionHistoryOutputFilterSensitiveLog, + HistoryEventFilterSensitiveLog: () => HistoryEventFilterSensitiveLog, + HistoryEventType: () => HistoryEventType, + IncludedData: () => IncludedData, + InspectionDataFilterSensitiveLog: () => InspectionDataFilterSensitiveLog, + InspectionLevel: () => InspectionLevel, + InvalidArn: () => InvalidArn, + InvalidDefinition: () => InvalidDefinition, + InvalidEncryptionConfiguration: () => InvalidEncryptionConfiguration, + InvalidExecutionInput: () => InvalidExecutionInput, + InvalidLoggingConfiguration: () => InvalidLoggingConfiguration, + InvalidName: () => InvalidName, + InvalidOutput: () => InvalidOutput, + InvalidToken: () => InvalidToken, + InvalidTracingConfiguration: () => InvalidTracingConfiguration, + KmsAccessDeniedException: () => KmsAccessDeniedException, + KmsInvalidStateException: () => KmsInvalidStateException, + KmsKeyState: () => KmsKeyState, + KmsThrottlingException: () => KmsThrottlingException, + LambdaFunctionFailedEventDetailsFilterSensitiveLog: () => LambdaFunctionFailedEventDetailsFilterSensitiveLog, + LambdaFunctionScheduleFailedEventDetailsFilterSensitiveLog: () => LambdaFunctionScheduleFailedEventDetailsFilterSensitiveLog, + LambdaFunctionScheduledEventDetailsFilterSensitiveLog: () => LambdaFunctionScheduledEventDetailsFilterSensitiveLog, + LambdaFunctionStartFailedEventDetailsFilterSensitiveLog: () => LambdaFunctionStartFailedEventDetailsFilterSensitiveLog, + LambdaFunctionSucceededEventDetailsFilterSensitiveLog: () => LambdaFunctionSucceededEventDetailsFilterSensitiveLog, + LambdaFunctionTimedOutEventDetailsFilterSensitiveLog: () => LambdaFunctionTimedOutEventDetailsFilterSensitiveLog, + ListActivitiesCommand: () => ListActivitiesCommand, + ListExecutionsCommand: () => ListExecutionsCommand, + ListMapRunsCommand: () => ListMapRunsCommand, + ListStateMachineAliasesCommand: () => ListStateMachineAliasesCommand, + ListStateMachineVersionsCommand: () => ListStateMachineVersionsCommand, + ListStateMachinesCommand: () => ListStateMachinesCommand, + ListTagsForResourceCommand: () => ListTagsForResourceCommand, + LogLevel: () => LogLevel, + MapRunFailedEventDetailsFilterSensitiveLog: () => MapRunFailedEventDetailsFilterSensitiveLog, + MapRunStatus: () => MapRunStatus, + MissingRequiredParameter: () => MissingRequiredParameter, + PublishStateMachineVersionCommand: () => PublishStateMachineVersionCommand, + PublishStateMachineVersionInputFilterSensitiveLog: () => PublishStateMachineVersionInputFilterSensitiveLog, + RedriveExecutionCommand: () => RedriveExecutionCommand, + ResourceNotFound: () => ResourceNotFound, + SFN: () => SFN2, + SFNClient: () => SFNClient, + SFNServiceException: () => SFNServiceException, + SendTaskFailureCommand: () => SendTaskFailureCommand, + SendTaskFailureInputFilterSensitiveLog: () => SendTaskFailureInputFilterSensitiveLog, + SendTaskHeartbeatCommand: () => SendTaskHeartbeatCommand, + SendTaskSuccessCommand: () => SendTaskSuccessCommand, + SendTaskSuccessInputFilterSensitiveLog: () => SendTaskSuccessInputFilterSensitiveLog, + ServiceQuotaExceededException: () => ServiceQuotaExceededException, + StartExecutionCommand: () => StartExecutionCommand, + StartExecutionInputFilterSensitiveLog: () => StartExecutionInputFilterSensitiveLog, + StartSyncExecutionCommand: () => StartSyncExecutionCommand, + StartSyncExecutionInputFilterSensitiveLog: () => StartSyncExecutionInputFilterSensitiveLog, + StartSyncExecutionOutputFilterSensitiveLog: () => StartSyncExecutionOutputFilterSensitiveLog, + StateEnteredEventDetailsFilterSensitiveLog: () => StateEnteredEventDetailsFilterSensitiveLog, + StateExitedEventDetailsFilterSensitiveLog: () => StateExitedEventDetailsFilterSensitiveLog, + StateMachineAlreadyExists: () => StateMachineAlreadyExists, + StateMachineDeleting: () => StateMachineDeleting, + StateMachineDoesNotExist: () => StateMachineDoesNotExist, + StateMachineLimitExceeded: () => StateMachineLimitExceeded, + StateMachineStatus: () => StateMachineStatus, + StateMachineType: () => StateMachineType, + StateMachineTypeNotSupported: () => StateMachineTypeNotSupported, + StopExecutionCommand: () => StopExecutionCommand, + StopExecutionInputFilterSensitiveLog: () => StopExecutionInputFilterSensitiveLog, + SyncExecutionStatus: () => SyncExecutionStatus, + TagResourceCommand: () => TagResourceCommand, + TaskDoesNotExist: () => TaskDoesNotExist, + TaskFailedEventDetailsFilterSensitiveLog: () => TaskFailedEventDetailsFilterSensitiveLog, + TaskScheduledEventDetailsFilterSensitiveLog: () => TaskScheduledEventDetailsFilterSensitiveLog, + TaskStartFailedEventDetailsFilterSensitiveLog: () => TaskStartFailedEventDetailsFilterSensitiveLog, + TaskSubmitFailedEventDetailsFilterSensitiveLog: () => TaskSubmitFailedEventDetailsFilterSensitiveLog, + TaskSubmittedEventDetailsFilterSensitiveLog: () => TaskSubmittedEventDetailsFilterSensitiveLog, + TaskSucceededEventDetailsFilterSensitiveLog: () => TaskSucceededEventDetailsFilterSensitiveLog, + TaskTimedOut: () => TaskTimedOut, + TaskTimedOutEventDetailsFilterSensitiveLog: () => TaskTimedOutEventDetailsFilterSensitiveLog, + TestExecutionStatus: () => TestExecutionStatus, + TestStateCommand: () => TestStateCommand, + TestStateInputFilterSensitiveLog: () => TestStateInputFilterSensitiveLog, + TestStateOutputFilterSensitiveLog: () => TestStateOutputFilterSensitiveLog, + TooManyTags: () => TooManyTags, + UntagResourceCommand: () => UntagResourceCommand, + UpdateMapRunCommand: () => UpdateMapRunCommand, + UpdateStateMachineAliasCommand: () => UpdateStateMachineAliasCommand, + UpdateStateMachineAliasInputFilterSensitiveLog: () => UpdateStateMachineAliasInputFilterSensitiveLog, + UpdateStateMachineCommand: () => UpdateStateMachineCommand, + UpdateStateMachineInputFilterSensitiveLog: () => UpdateStateMachineInputFilterSensitiveLog, + ValidateStateMachineDefinitionCommand: () => ValidateStateMachineDefinitionCommand, + ValidateStateMachineDefinitionInputFilterSensitiveLog: () => ValidateStateMachineDefinitionInputFilterSensitiveLog, + ValidateStateMachineDefinitionResultCode: () => ValidateStateMachineDefinitionResultCode, + ValidateStateMachineDefinitionSeverity: () => ValidateStateMachineDefinitionSeverity, + ValidationException: () => ValidationException, + ValidationExceptionReason: () => ValidationExceptionReason, + __Client: () => import_smithy_client5.Client, + paginateGetExecutionHistory: () => paginateGetExecutionHistory, + paginateListActivities: () => paginateListActivities, + paginateListExecutions: () => paginateListExecutions, + paginateListMapRuns: () => paginateListMapRuns, + paginateListStateMachines: () => paginateListStateMachines + }); + module2.exports = __toCommonJS2(src_exports); + var import_middleware_host_header = require_dist_cjs3(); + var import_middleware_logger = require_dist_cjs4(); + var import_middleware_recursion_detection = require_dist_cjs5(); + var import_middleware_user_agent = require_dist_cjs8(); + var import_config_resolver = require_dist_cjs11(); + var import_core3 = (init_dist_es(), __toCommonJS(dist_es_exports)); + var import_middleware_content_length = require_dist_cjs39(); + var import_middleware_endpoint2 = require_dist_cjs46(); + var import_middleware_retry2 = require_dist_cjs38(); + var import_httpAuthSchemeProvider = require_httpAuthSchemeProvider(); + var resolveClientEndpointParameters = /* @__PURE__ */ __name((options) => { + return { + ...options, + useDualstackEndpoint: options.useDualstackEndpoint ?? false, + useFipsEndpoint: options.useFipsEndpoint ?? false, + defaultSigningName: "states" + }; + }, "resolveClientEndpointParameters"); + var commonParams = { + UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, + Endpoint: { type: "builtInParams", name: "endpoint" }, + Region: { type: "builtInParams", name: "region" }, + UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } + }; + var import_runtimeConfig = require_runtimeConfig4(); + var import_region_config_resolver = require_dist_cjs70(); + var import_protocol_http8 = require_dist_cjs2(); + var import_smithy_client5 = require_dist_cjs37(); + var getHttpAuthExtensionConfiguration = /* @__PURE__ */ __name((runtimeConfig) => { + const _httpAuthSchemes = runtimeConfig.httpAuthSchemes; + let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider; + let _credentials = runtimeConfig.credentials; + return { + setHttpAuthScheme(httpAuthScheme) { + const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId); + if (index === -1) { + _httpAuthSchemes.push(httpAuthScheme); + } else { + _httpAuthSchemes.splice(index, 1, httpAuthScheme); } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_ListMapRunsCommand)(input, context); + }, + httpAuthSchemes() { + return _httpAuthSchemes; + }, + setHttpAuthSchemeProvider(httpAuthSchemeProvider) { + _httpAuthSchemeProvider = httpAuthSchemeProvider; + }, + httpAuthSchemeProvider() { + return _httpAuthSchemeProvider; + }, + setCredentials(credentials) { + _credentials = credentials; + }, + credentials() { + return _credentials; + } + }; + }, "getHttpAuthExtensionConfiguration"); + var resolveHttpAuthRuntimeConfig = /* @__PURE__ */ __name((config) => { + return { + httpAuthSchemes: config.httpAuthSchemes(), + httpAuthSchemeProvider: config.httpAuthSchemeProvider(), + credentials: config.credentials() + }; + }, "resolveHttpAuthRuntimeConfig"); + var asPartial = /* @__PURE__ */ __name((t) => t, "asPartial"); + var resolveRuntimeExtensions = /* @__PURE__ */ __name((runtimeConfig, extensions) => { + const extensionConfiguration = { + ...asPartial((0, import_region_config_resolver.getAwsRegionExtensionConfiguration)(runtimeConfig)), + ...asPartial((0, import_smithy_client5.getDefaultExtensionConfiguration)(runtimeConfig)), + ...asPartial((0, import_protocol_http8.getHttpHandlerExtensionConfiguration)(runtimeConfig)), + ...asPartial(getHttpAuthExtensionConfiguration(runtimeConfig)) + }; + extensions.forEach((extension) => extension.configure(extensionConfiguration)); + return { + ...runtimeConfig, + ...(0, import_region_config_resolver.resolveAwsRegionExtensionConfiguration)(extensionConfiguration), + ...(0, import_smithy_client5.resolveDefaultRuntimeConfig)(extensionConfiguration), + ...(0, import_protocol_http8.resolveHttpHandlerRuntimeConfig)(extensionConfiguration), + ...resolveHttpAuthRuntimeConfig(extensionConfiguration) + }; + }, "resolveRuntimeExtensions"); + var _SFNClient = class _SFNClient extends import_smithy_client5.Client { + constructor(...[configuration]) { + const _config_0 = (0, import_runtimeConfig.getRuntimeConfig)(configuration || {}); + const _config_1 = resolveClientEndpointParameters(_config_0); + const _config_2 = (0, import_middleware_user_agent.resolveUserAgentConfig)(_config_1); + const _config_3 = (0, import_middleware_retry2.resolveRetryConfig)(_config_2); + const _config_4 = (0, import_config_resolver.resolveRegionConfig)(_config_3); + const _config_5 = (0, import_middleware_host_header.resolveHostHeaderConfig)(_config_4); + const _config_6 = (0, import_middleware_endpoint2.resolveEndpointConfig)(_config_5); + const _config_7 = (0, import_httpAuthSchemeProvider.resolveHttpAuthSchemeConfig)(_config_6); + const _config_8 = resolveRuntimeExtensions(_config_7, (configuration == null ? void 0 : configuration.extensions) || []); + super(_config_8); + this.config = _config_8; + this.middlewareStack.use((0, import_middleware_user_agent.getUserAgentPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_retry2.getRetryPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_content_length.getContentLengthPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_host_header.getHostHeaderPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_logger.getLoggerPlugin)(this.config)); + this.middlewareStack.use((0, import_middleware_recursion_detection.getRecursionDetectionPlugin)(this.config)); + this.middlewareStack.use( + (0, import_core3.getHttpAuthSchemeEndpointRuleSetPlugin)(this.config, { + httpAuthSchemeParametersProvider: import_httpAuthSchemeProvider.defaultSFNHttpAuthSchemeParametersProvider, + identityProviderConfigProvider: async (config) => new import_core3.DefaultIdentityProviderConfig({ + "aws.auth#sigv4": config.credentials + }) + }) + ); + this.middlewareStack.use((0, import_core3.getHttpSigningPlugin)(this.config)); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_ListMapRunsCommand)(output, context); + /** + * Destroy underlying resources, like sockets. It's usually not necessary to do this. + * However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed. + * Otherwise, sockets might stay open for quite a long time before the server terminates them. + */ + destroy() { + super.destroy(); } }; - exports2.ListMapRunsCommand = ListMapRunsCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListStateMachineAliasesCommand.js -var require_ListStateMachineAliasesCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListStateMachineAliasesCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ListStateMachineAliasesCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var ListStateMachineAliasesCommand = class _ListStateMachineAliasesCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + __name(_SFNClient, "SFNClient"); + var SFNClient = _SFNClient; + var import_middleware_serde2 = require_dist_cjs45(); + var import_core22 = (init_dist_es2(), __toCommonJS(dist_es_exports2)); + var import_uuid = (init_esm_node(), __toCommonJS(esm_node_exports)); + var _SFNServiceException = class _SFNServiceException2 extends import_smithy_client5.ServiceException { + /** + * @internal + */ + constructor(options) { + super(options); + Object.setPrototypeOf(this, _SFNServiceException2.prototype); } - constructor(input) { - super(); - this.input = input; + }; + __name(_SFNServiceException, "SFNServiceException"); + var SFNServiceException = _SFNServiceException; + var _ActivityAlreadyExists = class _ActivityAlreadyExists2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ActivityAlreadyExists", + $fault: "client", + ...opts + }); + this.name = "ActivityAlreadyExists"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ActivityAlreadyExists2.prototype); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _ListStateMachineAliasesCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "ListStateMachineAliasesCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "ListStateMachineAliases" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + }; + __name(_ActivityAlreadyExists, "ActivityAlreadyExists"); + var ActivityAlreadyExists = _ActivityAlreadyExists; + var _ActivityDoesNotExist = class _ActivityDoesNotExist2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ActivityDoesNotExist", + $fault: "client", + ...opts + }); + this.name = "ActivityDoesNotExist"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ActivityDoesNotExist2.prototype); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_ListStateMachineAliasesCommand)(input, context); + }; + __name(_ActivityDoesNotExist, "ActivityDoesNotExist"); + var ActivityDoesNotExist = _ActivityDoesNotExist; + var _ActivityLimitExceeded = class _ActivityLimitExceeded2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ActivityLimitExceeded", + $fault: "client", + ...opts + }); + this.name = "ActivityLimitExceeded"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ActivityLimitExceeded2.prototype); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_ListStateMachineAliasesCommand)(output, context); + }; + __name(_ActivityLimitExceeded, "ActivityLimitExceeded"); + var ActivityLimitExceeded = _ActivityLimitExceeded; + var _ActivityWorkerLimitExceeded = class _ActivityWorkerLimitExceeded2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ActivityWorkerLimitExceeded", + $fault: "client", + ...opts + }); + this.name = "ActivityWorkerLimitExceeded"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ActivityWorkerLimitExceeded2.prototype); } }; - exports2.ListStateMachineAliasesCommand = ListStateMachineAliasesCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListStateMachinesCommand.js -var require_ListStateMachinesCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListStateMachinesCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ListStateMachinesCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var ListStateMachinesCommand = class _ListStateMachinesCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + __name(_ActivityWorkerLimitExceeded, "ActivityWorkerLimitExceeded"); + var ActivityWorkerLimitExceeded = _ActivityWorkerLimitExceeded; + var EncryptionType = { + AWS_OWNED_KEY: "AWS_OWNED_KEY", + CUSTOMER_MANAGED_KMS_KEY: "CUSTOMER_MANAGED_KMS_KEY" + }; + var _InvalidEncryptionConfiguration = class _InvalidEncryptionConfiguration2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidEncryptionConfiguration", + $fault: "client", + ...opts + }); + this.name = "InvalidEncryptionConfiguration"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidEncryptionConfiguration2.prototype); } - constructor(input) { - super(); - this.input = input; + }; + __name(_InvalidEncryptionConfiguration, "InvalidEncryptionConfiguration"); + var InvalidEncryptionConfiguration = _InvalidEncryptionConfiguration; + var _InvalidName = class _InvalidName2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidName", + $fault: "client", + ...opts + }); + this.name = "InvalidName"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidName2.prototype); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _ListStateMachinesCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "ListStateMachinesCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "ListStateMachines" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + }; + __name(_InvalidName, "InvalidName"); + var InvalidName = _InvalidName; + var _KmsAccessDeniedException = class _KmsAccessDeniedException2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "KmsAccessDeniedException", + $fault: "client", + ...opts + }); + this.name = "KmsAccessDeniedException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _KmsAccessDeniedException2.prototype); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_ListStateMachinesCommand)(input, context); + }; + __name(_KmsAccessDeniedException, "KmsAccessDeniedException"); + var KmsAccessDeniedException = _KmsAccessDeniedException; + var _KmsThrottlingException = class _KmsThrottlingException2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "KmsThrottlingException", + $fault: "client", + ...opts + }); + this.name = "KmsThrottlingException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _KmsThrottlingException2.prototype); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_ListStateMachinesCommand)(output, context); + }; + __name(_KmsThrottlingException, "KmsThrottlingException"); + var KmsThrottlingException = _KmsThrottlingException; + var _TooManyTags = class _TooManyTags2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "TooManyTags", + $fault: "client", + ...opts + }); + this.name = "TooManyTags"; + this.$fault = "client"; + Object.setPrototypeOf(this, _TooManyTags2.prototype); + this.resourceName = opts.resourceName; } }; - exports2.ListStateMachinesCommand = ListStateMachinesCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListStateMachineVersionsCommand.js -var require_ListStateMachineVersionsCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListStateMachineVersionsCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ListStateMachineVersionsCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var ListStateMachineVersionsCommand = class _ListStateMachineVersionsCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + __name(_TooManyTags, "TooManyTags"); + var TooManyTags = _TooManyTags; + var _ConflictException = class _ConflictException2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ConflictException", + $fault: "client", + ...opts + }); + this.name = "ConflictException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ConflictException2.prototype); } - constructor(input) { - super(); - this.input = input; + }; + __name(_ConflictException, "ConflictException"); + var ConflictException = _ConflictException; + var LogLevel = { + ALL: "ALL", + ERROR: "ERROR", + FATAL: "FATAL", + OFF: "OFF" + }; + var StateMachineType = { + EXPRESS: "EXPRESS", + STANDARD: "STANDARD" + }; + var _InvalidArn = class _InvalidArn2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidArn", + $fault: "client", + ...opts + }); + this.name = "InvalidArn"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidArn2.prototype); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _ListStateMachineVersionsCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "ListStateMachineVersionsCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "ListStateMachineVersions" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + }; + __name(_InvalidArn, "InvalidArn"); + var InvalidArn = _InvalidArn; + var _InvalidDefinition = class _InvalidDefinition2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidDefinition", + $fault: "client", + ...opts + }); + this.name = "InvalidDefinition"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidDefinition2.prototype); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_ListStateMachineVersionsCommand)(input, context); + }; + __name(_InvalidDefinition, "InvalidDefinition"); + var InvalidDefinition = _InvalidDefinition; + var _InvalidLoggingConfiguration = class _InvalidLoggingConfiguration2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidLoggingConfiguration", + $fault: "client", + ...opts + }); + this.name = "InvalidLoggingConfiguration"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidLoggingConfiguration2.prototype); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_ListStateMachineVersionsCommand)(output, context); + }; + __name(_InvalidLoggingConfiguration, "InvalidLoggingConfiguration"); + var InvalidLoggingConfiguration = _InvalidLoggingConfiguration; + var _InvalidTracingConfiguration = class _InvalidTracingConfiguration2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidTracingConfiguration", + $fault: "client", + ...opts + }); + this.name = "InvalidTracingConfiguration"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidTracingConfiguration2.prototype); } }; - exports2.ListStateMachineVersionsCommand = ListStateMachineVersionsCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListTagsForResourceCommand.js -var require_ListTagsForResourceCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/ListTagsForResourceCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.ListTagsForResourceCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var ListTagsForResourceCommand = class _ListTagsForResourceCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + __name(_InvalidTracingConfiguration, "InvalidTracingConfiguration"); + var InvalidTracingConfiguration = _InvalidTracingConfiguration; + var _StateMachineAlreadyExists = class _StateMachineAlreadyExists2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "StateMachineAlreadyExists", + $fault: "client", + ...opts + }); + this.name = "StateMachineAlreadyExists"; + this.$fault = "client"; + Object.setPrototypeOf(this, _StateMachineAlreadyExists2.prototype); } - constructor(input) { - super(); - this.input = input; + }; + __name(_StateMachineAlreadyExists, "StateMachineAlreadyExists"); + var StateMachineAlreadyExists = _StateMachineAlreadyExists; + var _StateMachineDeleting = class _StateMachineDeleting2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "StateMachineDeleting", + $fault: "client", + ...opts + }); + this.name = "StateMachineDeleting"; + this.$fault = "client"; + Object.setPrototypeOf(this, _StateMachineDeleting2.prototype); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _ListTagsForResourceCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "ListTagsForResourceCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "ListTagsForResource" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + }; + __name(_StateMachineDeleting, "StateMachineDeleting"); + var StateMachineDeleting = _StateMachineDeleting; + var _StateMachineLimitExceeded = class _StateMachineLimitExceeded2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "StateMachineLimitExceeded", + $fault: "client", + ...opts + }); + this.name = "StateMachineLimitExceeded"; + this.$fault = "client"; + Object.setPrototypeOf(this, _StateMachineLimitExceeded2.prototype); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_ListTagsForResourceCommand)(input, context); + }; + __name(_StateMachineLimitExceeded, "StateMachineLimitExceeded"); + var StateMachineLimitExceeded = _StateMachineLimitExceeded; + var _StateMachineTypeNotSupported = class _StateMachineTypeNotSupported2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "StateMachineTypeNotSupported", + $fault: "client", + ...opts + }); + this.name = "StateMachineTypeNotSupported"; + this.$fault = "client"; + Object.setPrototypeOf(this, _StateMachineTypeNotSupported2.prototype); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_ListTagsForResourceCommand)(output, context); + }; + __name(_StateMachineTypeNotSupported, "StateMachineTypeNotSupported"); + var StateMachineTypeNotSupported = _StateMachineTypeNotSupported; + var ValidationExceptionReason = { + API_DOES_NOT_SUPPORT_LABELED_ARNS: "API_DOES_NOT_SUPPORT_LABELED_ARNS", + CANNOT_UPDATE_COMPLETED_MAP_RUN: "CANNOT_UPDATE_COMPLETED_MAP_RUN", + INVALID_ROUTING_CONFIGURATION: "INVALID_ROUTING_CONFIGURATION", + MISSING_REQUIRED_PARAMETER: "MISSING_REQUIRED_PARAMETER" + }; + var _ValidationException = class _ValidationException2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ValidationException", + $fault: "client", + ...opts + }); + this.name = "ValidationException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ValidationException2.prototype); + this.reason = opts.reason; } }; - exports2.ListTagsForResourceCommand = ListTagsForResourceCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/PublishStateMachineVersionCommand.js -var require_PublishStateMachineVersionCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/PublishStateMachineVersionCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.PublishStateMachineVersionCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var PublishStateMachineVersionCommand = class _PublishStateMachineVersionCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + __name(_ValidationException, "ValidationException"); + var ValidationException = _ValidationException; + var _ResourceNotFound = class _ResourceNotFound2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ResourceNotFound", + $fault: "client", + ...opts + }); + this.name = "ResourceNotFound"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ResourceNotFound2.prototype); + this.resourceName = opts.resourceName; } - constructor(input) { - super(); - this.input = input; + }; + __name(_ResourceNotFound, "ResourceNotFound"); + var ResourceNotFound = _ResourceNotFound; + var _ServiceQuotaExceededException = class _ServiceQuotaExceededException2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ServiceQuotaExceededException", + $fault: "client", + ...opts + }); + this.name = "ServiceQuotaExceededException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ServiceQuotaExceededException2.prototype); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _PublishStateMachineVersionCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "PublishStateMachineVersionCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.PublishStateMachineVersionInputFilterSensitiveLog, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "PublishStateMachineVersion" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + }; + __name(_ServiceQuotaExceededException, "ServiceQuotaExceededException"); + var ServiceQuotaExceededException = _ServiceQuotaExceededException; + var IncludedData = { + ALL_DATA: "ALL_DATA", + METADATA_ONLY: "METADATA_ONLY" + }; + var ExecutionRedriveStatus = { + NOT_REDRIVABLE: "NOT_REDRIVABLE", + REDRIVABLE: "REDRIVABLE", + REDRIVABLE_BY_MAP_RUN: "REDRIVABLE_BY_MAP_RUN" + }; + var ExecutionStatus = { + ABORTED: "ABORTED", + FAILED: "FAILED", + PENDING_REDRIVE: "PENDING_REDRIVE", + RUNNING: "RUNNING", + SUCCEEDED: "SUCCEEDED", + TIMED_OUT: "TIMED_OUT" + }; + var _ExecutionDoesNotExist = class _ExecutionDoesNotExist2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ExecutionDoesNotExist", + $fault: "client", + ...opts + }); + this.name = "ExecutionDoesNotExist"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ExecutionDoesNotExist2.prototype); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_PublishStateMachineVersionCommand)(input, context); + }; + __name(_ExecutionDoesNotExist, "ExecutionDoesNotExist"); + var ExecutionDoesNotExist = _ExecutionDoesNotExist; + var KmsKeyState = { + CREATING: "CREATING", + DISABLED: "DISABLED", + PENDING_DELETION: "PENDING_DELETION", + PENDING_IMPORT: "PENDING_IMPORT", + UNAVAILABLE: "UNAVAILABLE" + }; + var _KmsInvalidStateException = class _KmsInvalidStateException2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "KmsInvalidStateException", + $fault: "client", + ...opts + }); + this.name = "KmsInvalidStateException"; + this.$fault = "client"; + Object.setPrototypeOf(this, _KmsInvalidStateException2.prototype); + this.kmsKeyState = opts.kmsKeyState; } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_PublishStateMachineVersionCommand)(output, context); + }; + __name(_KmsInvalidStateException, "KmsInvalidStateException"); + var KmsInvalidStateException = _KmsInvalidStateException; + var MapRunStatus = { + ABORTED: "ABORTED", + FAILED: "FAILED", + RUNNING: "RUNNING", + SUCCEEDED: "SUCCEEDED" + }; + var StateMachineStatus = { + ACTIVE: "ACTIVE", + DELETING: "DELETING" + }; + var _StateMachineDoesNotExist = class _StateMachineDoesNotExist2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "StateMachineDoesNotExist", + $fault: "client", + ...opts + }); + this.name = "StateMachineDoesNotExist"; + this.$fault = "client"; + Object.setPrototypeOf(this, _StateMachineDoesNotExist2.prototype); } }; - exports2.PublishStateMachineVersionCommand = PublishStateMachineVersionCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/SendTaskFailureCommand.js -var require_SendTaskFailureCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/SendTaskFailureCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SendTaskFailureCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var SendTaskFailureCommand = class _SendTaskFailureCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; - } - constructor(input) { - super(); - this.input = input; - } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _SendTaskFailureCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "SendTaskFailureCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.SendTaskFailureInputFilterSensitiveLog, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "SendTaskFailure" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); - } - serialize(input, context) { - return (0, Aws_json1_0_1.se_SendTaskFailureCommand)(input, context); - } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_SendTaskFailureCommand)(output, context); + __name(_StateMachineDoesNotExist, "StateMachineDoesNotExist"); + var StateMachineDoesNotExist = _StateMachineDoesNotExist; + var HistoryEventType = { + ActivityFailed: "ActivityFailed", + ActivityScheduleFailed: "ActivityScheduleFailed", + ActivityScheduled: "ActivityScheduled", + ActivityStarted: "ActivityStarted", + ActivitySucceeded: "ActivitySucceeded", + ActivityTimedOut: "ActivityTimedOut", + ChoiceStateEntered: "ChoiceStateEntered", + ChoiceStateExited: "ChoiceStateExited", + ExecutionAborted: "ExecutionAborted", + ExecutionFailed: "ExecutionFailed", + ExecutionRedriven: "ExecutionRedriven", + ExecutionStarted: "ExecutionStarted", + ExecutionSucceeded: "ExecutionSucceeded", + ExecutionTimedOut: "ExecutionTimedOut", + FailStateEntered: "FailStateEntered", + LambdaFunctionFailed: "LambdaFunctionFailed", + LambdaFunctionScheduleFailed: "LambdaFunctionScheduleFailed", + LambdaFunctionScheduled: "LambdaFunctionScheduled", + LambdaFunctionStartFailed: "LambdaFunctionStartFailed", + LambdaFunctionStarted: "LambdaFunctionStarted", + LambdaFunctionSucceeded: "LambdaFunctionSucceeded", + LambdaFunctionTimedOut: "LambdaFunctionTimedOut", + MapIterationAborted: "MapIterationAborted", + MapIterationFailed: "MapIterationFailed", + MapIterationStarted: "MapIterationStarted", + MapIterationSucceeded: "MapIterationSucceeded", + MapRunAborted: "MapRunAborted", + MapRunFailed: "MapRunFailed", + MapRunRedriven: "MapRunRedriven", + MapRunStarted: "MapRunStarted", + MapRunSucceeded: "MapRunSucceeded", + MapStateAborted: "MapStateAborted", + MapStateEntered: "MapStateEntered", + MapStateExited: "MapStateExited", + MapStateFailed: "MapStateFailed", + MapStateStarted: "MapStateStarted", + MapStateSucceeded: "MapStateSucceeded", + ParallelStateAborted: "ParallelStateAborted", + ParallelStateEntered: "ParallelStateEntered", + ParallelStateExited: "ParallelStateExited", + ParallelStateFailed: "ParallelStateFailed", + ParallelStateStarted: "ParallelStateStarted", + ParallelStateSucceeded: "ParallelStateSucceeded", + PassStateEntered: "PassStateEntered", + PassStateExited: "PassStateExited", + SucceedStateEntered: "SucceedStateEntered", + SucceedStateExited: "SucceedStateExited", + TaskFailed: "TaskFailed", + TaskScheduled: "TaskScheduled", + TaskStartFailed: "TaskStartFailed", + TaskStarted: "TaskStarted", + TaskStateAborted: "TaskStateAborted", + TaskStateEntered: "TaskStateEntered", + TaskStateExited: "TaskStateExited", + TaskSubmitFailed: "TaskSubmitFailed", + TaskSubmitted: "TaskSubmitted", + TaskSucceeded: "TaskSucceeded", + TaskTimedOut: "TaskTimedOut", + WaitStateAborted: "WaitStateAborted", + WaitStateEntered: "WaitStateEntered", + WaitStateExited: "WaitStateExited" + }; + var _InvalidToken = class _InvalidToken2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidToken", + $fault: "client", + ...opts + }); + this.name = "InvalidToken"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidToken2.prototype); } }; - exports2.SendTaskFailureCommand = SendTaskFailureCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/SendTaskHeartbeatCommand.js -var require_SendTaskHeartbeatCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/SendTaskHeartbeatCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SendTaskHeartbeatCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var SendTaskHeartbeatCommand = class _SendTaskHeartbeatCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + __name(_InvalidToken, "InvalidToken"); + var InvalidToken = _InvalidToken; + var ExecutionRedriveFilter = { + NOT_REDRIVEN: "NOT_REDRIVEN", + REDRIVEN: "REDRIVEN" + }; + var _ExecutionLimitExceeded = class _ExecutionLimitExceeded2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ExecutionLimitExceeded", + $fault: "client", + ...opts + }); + this.name = "ExecutionLimitExceeded"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ExecutionLimitExceeded2.prototype); } - constructor(input) { - super(); - this.input = input; + }; + __name(_ExecutionLimitExceeded, "ExecutionLimitExceeded"); + var ExecutionLimitExceeded = _ExecutionLimitExceeded; + var _ExecutionNotRedrivable = class _ExecutionNotRedrivable2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ExecutionNotRedrivable", + $fault: "client", + ...opts + }); + this.name = "ExecutionNotRedrivable"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ExecutionNotRedrivable2.prototype); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _SendTaskHeartbeatCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "SendTaskHeartbeatCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "SendTaskHeartbeat" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + }; + __name(_ExecutionNotRedrivable, "ExecutionNotRedrivable"); + var ExecutionNotRedrivable = _ExecutionNotRedrivable; + var _TaskDoesNotExist = class _TaskDoesNotExist2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "TaskDoesNotExist", + $fault: "client", + ...opts + }); + this.name = "TaskDoesNotExist"; + this.$fault = "client"; + Object.setPrototypeOf(this, _TaskDoesNotExist2.prototype); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_SendTaskHeartbeatCommand)(input, context); + }; + __name(_TaskDoesNotExist, "TaskDoesNotExist"); + var TaskDoesNotExist = _TaskDoesNotExist; + var _TaskTimedOut = class _TaskTimedOut2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "TaskTimedOut", + $fault: "client", + ...opts + }); + this.name = "TaskTimedOut"; + this.$fault = "client"; + Object.setPrototypeOf(this, _TaskTimedOut2.prototype); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_SendTaskHeartbeatCommand)(output, context); + }; + __name(_TaskTimedOut, "TaskTimedOut"); + var TaskTimedOut = _TaskTimedOut; + var _InvalidOutput = class _InvalidOutput2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidOutput", + $fault: "client", + ...opts + }); + this.name = "InvalidOutput"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidOutput2.prototype); } }; - exports2.SendTaskHeartbeatCommand = SendTaskHeartbeatCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/SendTaskSuccessCommand.js -var require_SendTaskSuccessCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/SendTaskSuccessCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SendTaskSuccessCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var SendTaskSuccessCommand = class _SendTaskSuccessCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + __name(_InvalidOutput, "InvalidOutput"); + var InvalidOutput = _InvalidOutput; + var _ExecutionAlreadyExists = class _ExecutionAlreadyExists2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "ExecutionAlreadyExists", + $fault: "client", + ...opts + }); + this.name = "ExecutionAlreadyExists"; + this.$fault = "client"; + Object.setPrototypeOf(this, _ExecutionAlreadyExists2.prototype); } - constructor(input) { - super(); - this.input = input; + }; + __name(_ExecutionAlreadyExists, "ExecutionAlreadyExists"); + var ExecutionAlreadyExists = _ExecutionAlreadyExists; + var _InvalidExecutionInput = class _InvalidExecutionInput2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "InvalidExecutionInput", + $fault: "client", + ...opts + }); + this.name = "InvalidExecutionInput"; + this.$fault = "client"; + Object.setPrototypeOf(this, _InvalidExecutionInput2.prototype); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _SendTaskSuccessCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "SendTaskSuccessCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.SendTaskSuccessInputFilterSensitiveLog, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "SendTaskSuccess" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + }; + __name(_InvalidExecutionInput, "InvalidExecutionInput"); + var InvalidExecutionInput = _InvalidExecutionInput; + var SyncExecutionStatus = { + FAILED: "FAILED", + SUCCEEDED: "SUCCEEDED", + TIMED_OUT: "TIMED_OUT" + }; + var InspectionLevel = { + DEBUG: "DEBUG", + INFO: "INFO", + TRACE: "TRACE" + }; + var TestExecutionStatus = { + CAUGHT_ERROR: "CAUGHT_ERROR", + FAILED: "FAILED", + RETRIABLE: "RETRIABLE", + SUCCEEDED: "SUCCEEDED" + }; + var _MissingRequiredParameter = class _MissingRequiredParameter2 extends SFNServiceException { + /** + * @internal + */ + constructor(opts) { + super({ + name: "MissingRequiredParameter", + $fault: "client", + ...opts + }); + this.name = "MissingRequiredParameter"; + this.$fault = "client"; + Object.setPrototypeOf(this, _MissingRequiredParameter2.prototype); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_SendTaskSuccessCommand)(input, context); + }; + __name(_MissingRequiredParameter, "MissingRequiredParameter"); + var MissingRequiredParameter = _MissingRequiredParameter; + var ValidateStateMachineDefinitionSeverity = { + ERROR: "ERROR" + }; + var ValidateStateMachineDefinitionResultCode = { + FAIL: "FAIL", + OK: "OK" + }; + var ActivityFailedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "ActivityFailedEventDetailsFilterSensitiveLog"); + var ActivityScheduledEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.input && { input: import_smithy_client5.SENSITIVE_STRING } + }), "ActivityScheduledEventDetailsFilterSensitiveLog"); + var ActivityScheduleFailedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "ActivityScheduleFailedEventDetailsFilterSensitiveLog"); + var ActivitySucceededEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.output && { output: import_smithy_client5.SENSITIVE_STRING } + }), "ActivitySucceededEventDetailsFilterSensitiveLog"); + var ActivityTimedOutEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "ActivityTimedOutEventDetailsFilterSensitiveLog"); + var CreateStateMachineInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.definition && { definition: import_smithy_client5.SENSITIVE_STRING }, + ...obj.versionDescription && { versionDescription: import_smithy_client5.SENSITIVE_STRING } + }), "CreateStateMachineInputFilterSensitiveLog"); + var CreateStateMachineAliasInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.description && { description: import_smithy_client5.SENSITIVE_STRING } + }), "CreateStateMachineAliasInputFilterSensitiveLog"); + var DescribeExecutionOutputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.input && { input: import_smithy_client5.SENSITIVE_STRING }, + ...obj.output && { output: import_smithy_client5.SENSITIVE_STRING }, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING }, + ...obj.redriveStatusReason && { redriveStatusReason: import_smithy_client5.SENSITIVE_STRING } + }), "DescribeExecutionOutputFilterSensitiveLog"); + var DescribeStateMachineOutputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.definition && { definition: import_smithy_client5.SENSITIVE_STRING }, + ...obj.description && { description: import_smithy_client5.SENSITIVE_STRING } + }), "DescribeStateMachineOutputFilterSensitiveLog"); + var DescribeStateMachineAliasOutputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.description && { description: import_smithy_client5.SENSITIVE_STRING } + }), "DescribeStateMachineAliasOutputFilterSensitiveLog"); + var DescribeStateMachineForExecutionOutputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.definition && { definition: import_smithy_client5.SENSITIVE_STRING } + }), "DescribeStateMachineForExecutionOutputFilterSensitiveLog"); + var GetActivityTaskOutputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.input && { input: import_smithy_client5.SENSITIVE_STRING } + }), "GetActivityTaskOutputFilterSensitiveLog"); + var ExecutionAbortedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "ExecutionAbortedEventDetailsFilterSensitiveLog"); + var ExecutionFailedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "ExecutionFailedEventDetailsFilterSensitiveLog"); + var ExecutionStartedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.input && { input: import_smithy_client5.SENSITIVE_STRING } + }), "ExecutionStartedEventDetailsFilterSensitiveLog"); + var ExecutionSucceededEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.output && { output: import_smithy_client5.SENSITIVE_STRING } + }), "ExecutionSucceededEventDetailsFilterSensitiveLog"); + var ExecutionTimedOutEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "ExecutionTimedOutEventDetailsFilterSensitiveLog"); + var LambdaFunctionFailedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "LambdaFunctionFailedEventDetailsFilterSensitiveLog"); + var LambdaFunctionScheduledEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.input && { input: import_smithy_client5.SENSITIVE_STRING } + }), "LambdaFunctionScheduledEventDetailsFilterSensitiveLog"); + var LambdaFunctionScheduleFailedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "LambdaFunctionScheduleFailedEventDetailsFilterSensitiveLog"); + var LambdaFunctionStartFailedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "LambdaFunctionStartFailedEventDetailsFilterSensitiveLog"); + var LambdaFunctionSucceededEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.output && { output: import_smithy_client5.SENSITIVE_STRING } + }), "LambdaFunctionSucceededEventDetailsFilterSensitiveLog"); + var LambdaFunctionTimedOutEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "LambdaFunctionTimedOutEventDetailsFilterSensitiveLog"); + var MapRunFailedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "MapRunFailedEventDetailsFilterSensitiveLog"); + var StateEnteredEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.input && { input: import_smithy_client5.SENSITIVE_STRING } + }), "StateEnteredEventDetailsFilterSensitiveLog"); + var StateExitedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.output && { output: import_smithy_client5.SENSITIVE_STRING } + }), "StateExitedEventDetailsFilterSensitiveLog"); + var TaskFailedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "TaskFailedEventDetailsFilterSensitiveLog"); + var TaskScheduledEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.parameters && { parameters: import_smithy_client5.SENSITIVE_STRING } + }), "TaskScheduledEventDetailsFilterSensitiveLog"); + var TaskStartFailedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "TaskStartFailedEventDetailsFilterSensitiveLog"); + var TaskSubmitFailedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "TaskSubmitFailedEventDetailsFilterSensitiveLog"); + var TaskSubmittedEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.output && { output: import_smithy_client5.SENSITIVE_STRING } + }), "TaskSubmittedEventDetailsFilterSensitiveLog"); + var TaskSucceededEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.output && { output: import_smithy_client5.SENSITIVE_STRING } + }), "TaskSucceededEventDetailsFilterSensitiveLog"); + var TaskTimedOutEventDetailsFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "TaskTimedOutEventDetailsFilterSensitiveLog"); + var HistoryEventFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.activityFailedEventDetails && { + activityFailedEventDetails: ActivityFailedEventDetailsFilterSensitiveLog(obj.activityFailedEventDetails) + }, + ...obj.activityScheduleFailedEventDetails && { + activityScheduleFailedEventDetails: ActivityScheduleFailedEventDetailsFilterSensitiveLog( + obj.activityScheduleFailedEventDetails + ) + }, + ...obj.activityScheduledEventDetails && { + activityScheduledEventDetails: ActivityScheduledEventDetailsFilterSensitiveLog(obj.activityScheduledEventDetails) + }, + ...obj.activitySucceededEventDetails && { + activitySucceededEventDetails: ActivitySucceededEventDetailsFilterSensitiveLog(obj.activitySucceededEventDetails) + }, + ...obj.activityTimedOutEventDetails && { + activityTimedOutEventDetails: ActivityTimedOutEventDetailsFilterSensitiveLog(obj.activityTimedOutEventDetails) + }, + ...obj.taskFailedEventDetails && { + taskFailedEventDetails: TaskFailedEventDetailsFilterSensitiveLog(obj.taskFailedEventDetails) + }, + ...obj.taskScheduledEventDetails && { + taskScheduledEventDetails: TaskScheduledEventDetailsFilterSensitiveLog(obj.taskScheduledEventDetails) + }, + ...obj.taskStartFailedEventDetails && { + taskStartFailedEventDetails: TaskStartFailedEventDetailsFilterSensitiveLog(obj.taskStartFailedEventDetails) + }, + ...obj.taskSubmitFailedEventDetails && { + taskSubmitFailedEventDetails: TaskSubmitFailedEventDetailsFilterSensitiveLog(obj.taskSubmitFailedEventDetails) + }, + ...obj.taskSubmittedEventDetails && { + taskSubmittedEventDetails: TaskSubmittedEventDetailsFilterSensitiveLog(obj.taskSubmittedEventDetails) + }, + ...obj.taskSucceededEventDetails && { + taskSucceededEventDetails: TaskSucceededEventDetailsFilterSensitiveLog(obj.taskSucceededEventDetails) + }, + ...obj.taskTimedOutEventDetails && { + taskTimedOutEventDetails: TaskTimedOutEventDetailsFilterSensitiveLog(obj.taskTimedOutEventDetails) + }, + ...obj.executionFailedEventDetails && { + executionFailedEventDetails: ExecutionFailedEventDetailsFilterSensitiveLog(obj.executionFailedEventDetails) + }, + ...obj.executionStartedEventDetails && { + executionStartedEventDetails: ExecutionStartedEventDetailsFilterSensitiveLog(obj.executionStartedEventDetails) + }, + ...obj.executionSucceededEventDetails && { + executionSucceededEventDetails: ExecutionSucceededEventDetailsFilterSensitiveLog( + obj.executionSucceededEventDetails + ) + }, + ...obj.executionAbortedEventDetails && { + executionAbortedEventDetails: ExecutionAbortedEventDetailsFilterSensitiveLog(obj.executionAbortedEventDetails) + }, + ...obj.executionTimedOutEventDetails && { + executionTimedOutEventDetails: ExecutionTimedOutEventDetailsFilterSensitiveLog(obj.executionTimedOutEventDetails) + }, + ...obj.lambdaFunctionFailedEventDetails && { + lambdaFunctionFailedEventDetails: LambdaFunctionFailedEventDetailsFilterSensitiveLog( + obj.lambdaFunctionFailedEventDetails + ) + }, + ...obj.lambdaFunctionScheduleFailedEventDetails && { + lambdaFunctionScheduleFailedEventDetails: LambdaFunctionScheduleFailedEventDetailsFilterSensitiveLog( + obj.lambdaFunctionScheduleFailedEventDetails + ) + }, + ...obj.lambdaFunctionScheduledEventDetails && { + lambdaFunctionScheduledEventDetails: LambdaFunctionScheduledEventDetailsFilterSensitiveLog( + obj.lambdaFunctionScheduledEventDetails + ) + }, + ...obj.lambdaFunctionStartFailedEventDetails && { + lambdaFunctionStartFailedEventDetails: LambdaFunctionStartFailedEventDetailsFilterSensitiveLog( + obj.lambdaFunctionStartFailedEventDetails + ) + }, + ...obj.lambdaFunctionSucceededEventDetails && { + lambdaFunctionSucceededEventDetails: LambdaFunctionSucceededEventDetailsFilterSensitiveLog( + obj.lambdaFunctionSucceededEventDetails + ) + }, + ...obj.lambdaFunctionTimedOutEventDetails && { + lambdaFunctionTimedOutEventDetails: LambdaFunctionTimedOutEventDetailsFilterSensitiveLog( + obj.lambdaFunctionTimedOutEventDetails + ) + }, + ...obj.stateEnteredEventDetails && { + stateEnteredEventDetails: StateEnteredEventDetailsFilterSensitiveLog(obj.stateEnteredEventDetails) + }, + ...obj.stateExitedEventDetails && { + stateExitedEventDetails: StateExitedEventDetailsFilterSensitiveLog(obj.stateExitedEventDetails) + }, + ...obj.mapRunFailedEventDetails && { + mapRunFailedEventDetails: MapRunFailedEventDetailsFilterSensitiveLog(obj.mapRunFailedEventDetails) } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_SendTaskSuccessCommand)(output, context); + }), "HistoryEventFilterSensitiveLog"); + var GetExecutionHistoryOutputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.events && { events: obj.events.map((item) => HistoryEventFilterSensitiveLog(item)) } + }), "GetExecutionHistoryOutputFilterSensitiveLog"); + var PublishStateMachineVersionInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.description && { description: import_smithy_client5.SENSITIVE_STRING } + }), "PublishStateMachineVersionInputFilterSensitiveLog"); + var SendTaskFailureInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "SendTaskFailureInputFilterSensitiveLog"); + var SendTaskSuccessInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.output && { output: import_smithy_client5.SENSITIVE_STRING } + }), "SendTaskSuccessInputFilterSensitiveLog"); + var StartExecutionInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.input && { input: import_smithy_client5.SENSITIVE_STRING } + }), "StartExecutionInputFilterSensitiveLog"); + var StartSyncExecutionInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.input && { input: import_smithy_client5.SENSITIVE_STRING } + }), "StartSyncExecutionInputFilterSensitiveLog"); + var StartSyncExecutionOutputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING }, + ...obj.input && { input: import_smithy_client5.SENSITIVE_STRING }, + ...obj.output && { output: import_smithy_client5.SENSITIVE_STRING } + }), "StartSyncExecutionOutputFilterSensitiveLog"); + var StopExecutionInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING } + }), "StopExecutionInputFilterSensitiveLog"); + var TestStateInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.definition && { definition: import_smithy_client5.SENSITIVE_STRING }, + ...obj.input && { input: import_smithy_client5.SENSITIVE_STRING } + }), "TestStateInputFilterSensitiveLog"); + var InspectionDataFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.input && { input: import_smithy_client5.SENSITIVE_STRING }, + ...obj.afterInputPath && { afterInputPath: import_smithy_client5.SENSITIVE_STRING }, + ...obj.afterParameters && { afterParameters: import_smithy_client5.SENSITIVE_STRING }, + ...obj.result && { result: import_smithy_client5.SENSITIVE_STRING }, + ...obj.afterResultSelector && { afterResultSelector: import_smithy_client5.SENSITIVE_STRING }, + ...obj.afterResultPath && { afterResultPath: import_smithy_client5.SENSITIVE_STRING } + }), "InspectionDataFilterSensitiveLog"); + var TestStateOutputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.output && { output: import_smithy_client5.SENSITIVE_STRING }, + ...obj.error && { error: import_smithy_client5.SENSITIVE_STRING }, + ...obj.cause && { cause: import_smithy_client5.SENSITIVE_STRING }, + ...obj.inspectionData && { inspectionData: import_smithy_client5.SENSITIVE_STRING } + }), "TestStateOutputFilterSensitiveLog"); + var UpdateStateMachineInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.definition && { definition: import_smithy_client5.SENSITIVE_STRING }, + ...obj.versionDescription && { versionDescription: import_smithy_client5.SENSITIVE_STRING } + }), "UpdateStateMachineInputFilterSensitiveLog"); + var UpdateStateMachineAliasInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.description && { description: import_smithy_client5.SENSITIVE_STRING } + }), "UpdateStateMachineAliasInputFilterSensitiveLog"); + var ValidateStateMachineDefinitionInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({ + ...obj, + ...obj.definition && { definition: import_smithy_client5.SENSITIVE_STRING } + }), "ValidateStateMachineDefinitionInputFilterSensitiveLog"); + var se_CreateActivityCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("CreateActivity"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_CreateActivityCommand"); + var se_CreateStateMachineCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("CreateStateMachine"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_CreateStateMachineCommand"); + var se_CreateStateMachineAliasCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("CreateStateMachineAlias"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_CreateStateMachineAliasCommand"); + var se_DeleteActivityCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("DeleteActivity"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_DeleteActivityCommand"); + var se_DeleteStateMachineCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("DeleteStateMachine"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_DeleteStateMachineCommand"); + var se_DeleteStateMachineAliasCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("DeleteStateMachineAlias"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_DeleteStateMachineAliasCommand"); + var se_DeleteStateMachineVersionCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("DeleteStateMachineVersion"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_DeleteStateMachineVersionCommand"); + var se_DescribeActivityCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("DescribeActivity"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_DescribeActivityCommand"); + var se_DescribeExecutionCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("DescribeExecution"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_DescribeExecutionCommand"); + var se_DescribeMapRunCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("DescribeMapRun"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_DescribeMapRunCommand"); + var se_DescribeStateMachineCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("DescribeStateMachine"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_DescribeStateMachineCommand"); + var se_DescribeStateMachineAliasCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("DescribeStateMachineAlias"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_DescribeStateMachineAliasCommand"); + var se_DescribeStateMachineForExecutionCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("DescribeStateMachineForExecution"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_DescribeStateMachineForExecutionCommand"); + var se_GetActivityTaskCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("GetActivityTask"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_GetActivityTaskCommand"); + var se_GetExecutionHistoryCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("GetExecutionHistory"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_GetExecutionHistoryCommand"); + var se_ListActivitiesCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("ListActivities"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_ListActivitiesCommand"); + var se_ListExecutionsCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("ListExecutions"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_ListExecutionsCommand"); + var se_ListMapRunsCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("ListMapRuns"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_ListMapRunsCommand"); + var se_ListStateMachineAliasesCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("ListStateMachineAliases"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_ListStateMachineAliasesCommand"); + var se_ListStateMachinesCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("ListStateMachines"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_ListStateMachinesCommand"); + var se_ListStateMachineVersionsCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("ListStateMachineVersions"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_ListStateMachineVersionsCommand"); + var se_ListTagsForResourceCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("ListTagsForResource"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_ListTagsForResourceCommand"); + var se_PublishStateMachineVersionCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("PublishStateMachineVersion"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_PublishStateMachineVersionCommand"); + var se_RedriveExecutionCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("RedriveExecution"); + let body; + body = JSON.stringify(se_RedriveExecutionInput(input, context)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_RedriveExecutionCommand"); + var se_SendTaskFailureCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("SendTaskFailure"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_SendTaskFailureCommand"); + var se_SendTaskHeartbeatCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("SendTaskHeartbeat"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_SendTaskHeartbeatCommand"); + var se_SendTaskSuccessCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("SendTaskSuccess"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_SendTaskSuccessCommand"); + var se_StartExecutionCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("StartExecution"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_StartExecutionCommand"); + var se_StartSyncExecutionCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("StartSyncExecution"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + let { hostname: resolvedHostname } = await context.endpoint(); + if (context.disableHostPrefix !== true) { + resolvedHostname = "sync-" + resolvedHostname; + if (!(0, import_protocol_http8.isValidHostname)(resolvedHostname)) { + throw new Error("ValidationError: prefixed hostname must be hostname compatible."); + } } - }; - exports2.SendTaskSuccessCommand = SendTaskSuccessCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/StartExecutionCommand.js -var require_StartExecutionCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/StartExecutionCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.StartExecutionCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var StartExecutionCommand = class _StartExecutionCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + return buildHttpRpcRequest(context, headers, "/", resolvedHostname, body); + }, "se_StartSyncExecutionCommand"); + var se_StopExecutionCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("StopExecution"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_StopExecutionCommand"); + var se_TagResourceCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("TagResource"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_TagResourceCommand"); + var se_TestStateCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("TestState"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + let { hostname: resolvedHostname } = await context.endpoint(); + if (context.disableHostPrefix !== true) { + resolvedHostname = "sync-" + resolvedHostname; + if (!(0, import_protocol_http8.isValidHostname)(resolvedHostname)) { + throw new Error("ValidationError: prefixed hostname must be hostname compatible."); + } } - constructor(input) { - super(); - this.input = input; + return buildHttpRpcRequest(context, headers, "/", resolvedHostname, body); + }, "se_TestStateCommand"); + var se_UntagResourceCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("UntagResource"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_UntagResourceCommand"); + var se_UpdateMapRunCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("UpdateMapRun"); + let body; + body = JSON.stringify(se_UpdateMapRunInput(input, context)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_UpdateMapRunCommand"); + var se_UpdateStateMachineCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("UpdateStateMachine"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_UpdateStateMachineCommand"); + var se_UpdateStateMachineAliasCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("UpdateStateMachineAlias"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_UpdateStateMachineAliasCommand"); + var se_ValidateStateMachineDefinitionCommand = /* @__PURE__ */ __name(async (input, context) => { + const headers = sharedHeaders("ValidateStateMachineDefinition"); + let body; + body = JSON.stringify((0, import_smithy_client5._json)(input)); + return buildHttpRpcRequest(context, headers, "/", void 0, body); + }, "se_ValidateStateMachineDefinitionCommand"); + var de_CreateActivityCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _StartExecutionCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "StartExecutionCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.StartExecutionInputFilterSensitiveLog, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "StartExecution" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_CreateActivityOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_CreateActivityCommand"); + var de_CreateStateMachineCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_StartExecutionCommand)(input, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_CreateStateMachineOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_CreateStateMachineCommand"); + var de_CreateStateMachineAliasCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_StartExecutionCommand)(output, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_CreateStateMachineAliasOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_CreateStateMachineAliasCommand"); + var de_DeleteActivityCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - }; - exports2.StartExecutionCommand = StartExecutionCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/StartSyncExecutionCommand.js -var require_StartSyncExecutionCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/StartSyncExecutionCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.StartSyncExecutionCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var StartSyncExecutionCommand = class _StartSyncExecutionCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_DeleteActivityCommand"); + var de_DeleteStateMachineCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - constructor(input) { - super(); - this.input = input; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_DeleteStateMachineCommand"); + var de_DeleteStateMachineAliasCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _StartSyncExecutionCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "StartSyncExecutionCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.StartSyncExecutionInputFilterSensitiveLog, - outputFilterSensitiveLog: models_0_1.StartSyncExecutionOutputFilterSensitiveLog, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "StartSyncExecution" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_DeleteStateMachineAliasCommand"); + var de_DeleteStateMachineVersionCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_StartSyncExecutionCommand)(input, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_DeleteStateMachineVersionCommand"); + var de_DescribeActivityCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_StartSyncExecutionCommand)(output, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_DescribeActivityOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_DescribeActivityCommand"); + var de_DescribeExecutionCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - }; - exports2.StartSyncExecutionCommand = StartSyncExecutionCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/StopExecutionCommand.js -var require_StopExecutionCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/StopExecutionCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.StopExecutionCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var StopExecutionCommand = class _StopExecutionCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_DescribeExecutionOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_DescribeExecutionCommand"); + var de_DescribeMapRunCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - constructor(input) { - super(); - this.input = input; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_DescribeMapRunOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_DescribeMapRunCommand"); + var de_DescribeStateMachineCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _StopExecutionCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "StopExecutionCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.StopExecutionInputFilterSensitiveLog, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "StopExecution" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_DescribeStateMachineOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_DescribeStateMachineCommand"); + var de_DescribeStateMachineAliasCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_StopExecutionCommand)(input, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_DescribeStateMachineAliasOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_DescribeStateMachineAliasCommand"); + var de_DescribeStateMachineForExecutionCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_StopExecutionCommand)(output, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_DescribeStateMachineForExecutionOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_DescribeStateMachineForExecutionCommand"); + var de_GetActivityTaskCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - }; - exports2.StopExecutionCommand = StopExecutionCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/TagResourceCommand.js -var require_TagResourceCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/TagResourceCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.TagResourceCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var TagResourceCommand = class _TagResourceCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_GetActivityTaskCommand"); + var de_GetExecutionHistoryCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - constructor(input) { - super(); - this.input = input; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_GetExecutionHistoryOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_GetExecutionHistoryCommand"); + var de_ListActivitiesCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _TagResourceCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "TagResourceCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "TagResource" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_ListActivitiesOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_ListActivitiesCommand"); + var de_ListExecutionsCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_TagResourceCommand)(input, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_ListExecutionsOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_ListExecutionsCommand"); + var de_ListMapRunsCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_TagResourceCommand)(output, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_ListMapRunsOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_ListMapRunsCommand"); + var de_ListStateMachineAliasesCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - }; - exports2.TagResourceCommand = TagResourceCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/UntagResourceCommand.js -var require_UntagResourceCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/UntagResourceCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.UntagResourceCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var UntagResourceCommand = class _UntagResourceCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_ListStateMachineAliasesOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_ListStateMachineAliasesCommand"); + var de_ListStateMachinesCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - constructor(input) { - super(); - this.input = input; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_ListStateMachinesOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_ListStateMachinesCommand"); + var de_ListStateMachineVersionsCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _UntagResourceCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "UntagResourceCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "UntagResource" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_ListStateMachineVersionsOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_ListStateMachineVersionsCommand"); + var de_ListTagsForResourceCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_UntagResourceCommand)(input, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_ListTagsForResourceCommand"); + var de_PublishStateMachineVersionCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_UntagResourceCommand)(output, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_PublishStateMachineVersionOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_PublishStateMachineVersionCommand"); + var de_RedriveExecutionCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - }; - exports2.UntagResourceCommand = UntagResourceCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/UpdateMapRunCommand.js -var require_UpdateMapRunCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/UpdateMapRunCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.UpdateMapRunCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var UpdateMapRunCommand = class _UpdateMapRunCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_RedriveExecutionOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_RedriveExecutionCommand"); + var de_SendTaskFailureCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - constructor(input) { - super(); - this.input = input; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_SendTaskFailureCommand"); + var de_SendTaskHeartbeatCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _UpdateMapRunCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "UpdateMapRunCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: (_) => _, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "UpdateMapRun" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_SendTaskHeartbeatCommand"); + var de_SendTaskSuccessCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_UpdateMapRunCommand)(input, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_SendTaskSuccessCommand"); + var de_StartExecutionCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_UpdateMapRunCommand)(output, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_StartExecutionOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_StartExecutionCommand"); + var de_StartSyncExecutionCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - }; - exports2.UpdateMapRunCommand = UpdateMapRunCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/UpdateStateMachineAliasCommand.js -var require_UpdateStateMachineAliasCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/UpdateStateMachineAliasCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.UpdateStateMachineAliasCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var UpdateStateMachineAliasCommand = class _UpdateStateMachineAliasCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_StartSyncExecutionOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_StartSyncExecutionCommand"); + var de_StopExecutionCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - constructor(input) { - super(); - this.input = input; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_StopExecutionOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_StopExecutionCommand"); + var de_TagResourceCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _UpdateStateMachineAliasCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "UpdateStateMachineAliasCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.UpdateStateMachineAliasInputFilterSensitiveLog, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "UpdateStateMachineAlias" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_TagResourceCommand"); + var de_TestStateCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_UpdateStateMachineAliasCommand)(input, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_TestStateCommand"); + var de_UntagResourceCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_UpdateStateMachineAliasCommand)(output, context); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_UntagResourceCommand"); + var de_UpdateMapRunCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - }; - exports2.UpdateStateMachineAliasCommand = UpdateStateMachineAliasCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/UpdateStateMachineCommand.js -var require_UpdateStateMachineCommand = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/UpdateStateMachineCommand.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.UpdateStateMachineCommand = exports2.$Command = void 0; - var middleware_endpoint_1 = require_dist_cjs26(); - var middleware_serde_1 = require_dist_cjs25(); - var smithy_client_1 = require_dist_cjs34(); - Object.defineProperty(exports2, "$Command", { enumerable: true, get: function() { - return smithy_client_1.Command; - } }); - var types_1 = require_dist_cjs(); - var models_0_1 = require_models_03(); - var Aws_json1_0_1 = require_Aws_json1_0(); - var UpdateStateMachineCommand = class _UpdateStateMachineCommand extends smithy_client_1.Command { - static getEndpointParameterInstructions() { - return { - UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, - Endpoint: { type: "builtInParams", name: "endpoint" }, - Region: { type: "builtInParams", name: "region" }, - UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } - }; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_UpdateMapRunCommand"); + var de_UpdateStateMachineCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - constructor(input) { - super(); - this.input = input; + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_UpdateStateMachineOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_UpdateStateMachineCommand"); + var de_UpdateStateMachineAliasCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); } - resolveMiddleware(clientStack, configuration, options) { - this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize)); - this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, _UpdateStateMachineCommand.getEndpointParameterInstructions())); - const stack = clientStack.concat(this.middlewareStack); - const { logger } = configuration; - const clientName = "SFNClient"; - const commandName = "UpdateStateMachineCommand"; - const handlerExecutionContext = { - logger, - clientName, - commandName, - inputFilterSensitiveLog: models_0_1.UpdateStateMachineInputFilterSensitiveLog, - outputFilterSensitiveLog: (_) => _, - [types_1.SMITHY_CONTEXT_KEY]: { - service: "AWSStepFunctions", - operation: "UpdateStateMachine" - } - }; - const { requestHandler } = configuration; - return stack.resolve((request2) => requestHandler.handle(request2.request, options || {}), handlerExecutionContext); + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = de_UpdateStateMachineAliasOutput(data, context); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_UpdateStateMachineAliasCommand"); + var de_ValidateStateMachineDefinitionCommand = /* @__PURE__ */ __name(async (output, context) => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); + } + const data = await (0, import_core22.parseJsonBody)(output.body, context); + let contents = {}; + contents = (0, import_smithy_client5._json)(data); + const response = { + $metadata: deserializeMetadata(output), + ...contents + }; + return response; + }, "de_ValidateStateMachineDefinitionCommand"); + var de_CommandError = /* @__PURE__ */ __name(async (output, context) => { + const parsedOutput = { + ...output, + body: await (0, import_core22.parseJsonErrorBody)(output.body, context) + }; + const errorCode = (0, import_core22.loadRestJsonErrorCode)(output, parsedOutput.body); + switch (errorCode) { + case "ActivityAlreadyExists": + case "com.amazonaws.sfn#ActivityAlreadyExists": + throw await de_ActivityAlreadyExistsRes(parsedOutput, context); + case "ActivityLimitExceeded": + case "com.amazonaws.sfn#ActivityLimitExceeded": + throw await de_ActivityLimitExceededRes(parsedOutput, context); + case "InvalidEncryptionConfiguration": + case "com.amazonaws.sfn#InvalidEncryptionConfiguration": + throw await de_InvalidEncryptionConfigurationRes(parsedOutput, context); + case "InvalidName": + case "com.amazonaws.sfn#InvalidName": + throw await de_InvalidNameRes(parsedOutput, context); + case "KmsAccessDeniedException": + case "com.amazonaws.sfn#KmsAccessDeniedException": + throw await de_KmsAccessDeniedExceptionRes(parsedOutput, context); + case "KmsThrottlingException": + case "com.amazonaws.sfn#KmsThrottlingException": + throw await de_KmsThrottlingExceptionRes(parsedOutput, context); + case "TooManyTags": + case "com.amazonaws.sfn#TooManyTags": + throw await de_TooManyTagsRes(parsedOutput, context); + case "ConflictException": + case "com.amazonaws.sfn#ConflictException": + throw await de_ConflictExceptionRes(parsedOutput, context); + case "InvalidArn": + case "com.amazonaws.sfn#InvalidArn": + throw await de_InvalidArnRes(parsedOutput, context); + case "InvalidDefinition": + case "com.amazonaws.sfn#InvalidDefinition": + throw await de_InvalidDefinitionRes(parsedOutput, context); + case "InvalidLoggingConfiguration": + case "com.amazonaws.sfn#InvalidLoggingConfiguration": + throw await de_InvalidLoggingConfigurationRes(parsedOutput, context); + case "InvalidTracingConfiguration": + case "com.amazonaws.sfn#InvalidTracingConfiguration": + throw await de_InvalidTracingConfigurationRes(parsedOutput, context); + case "StateMachineAlreadyExists": + case "com.amazonaws.sfn#StateMachineAlreadyExists": + throw await de_StateMachineAlreadyExistsRes(parsedOutput, context); + case "StateMachineDeleting": + case "com.amazonaws.sfn#StateMachineDeleting": + throw await de_StateMachineDeletingRes(parsedOutput, context); + case "StateMachineLimitExceeded": + case "com.amazonaws.sfn#StateMachineLimitExceeded": + throw await de_StateMachineLimitExceededRes(parsedOutput, context); + case "StateMachineTypeNotSupported": + case "com.amazonaws.sfn#StateMachineTypeNotSupported": + throw await de_StateMachineTypeNotSupportedRes(parsedOutput, context); + case "ValidationException": + case "com.amazonaws.sfn#ValidationException": + throw await de_ValidationExceptionRes(parsedOutput, context); + case "ResourceNotFound": + case "com.amazonaws.sfn#ResourceNotFound": + throw await de_ResourceNotFoundRes(parsedOutput, context); + case "ServiceQuotaExceededException": + case "com.amazonaws.sfn#ServiceQuotaExceededException": + throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context); + case "ActivityDoesNotExist": + case "com.amazonaws.sfn#ActivityDoesNotExist": + throw await de_ActivityDoesNotExistRes(parsedOutput, context); + case "ExecutionDoesNotExist": + case "com.amazonaws.sfn#ExecutionDoesNotExist": + throw await de_ExecutionDoesNotExistRes(parsedOutput, context); + case "KmsInvalidStateException": + case "com.amazonaws.sfn#KmsInvalidStateException": + throw await de_KmsInvalidStateExceptionRes(parsedOutput, context); + case "StateMachineDoesNotExist": + case "com.amazonaws.sfn#StateMachineDoesNotExist": + throw await de_StateMachineDoesNotExistRes(parsedOutput, context); + case "ActivityWorkerLimitExceeded": + case "com.amazonaws.sfn#ActivityWorkerLimitExceeded": + throw await de_ActivityWorkerLimitExceededRes(parsedOutput, context); + case "InvalidToken": + case "com.amazonaws.sfn#InvalidToken": + throw await de_InvalidTokenRes(parsedOutput, context); + case "ExecutionLimitExceeded": + case "com.amazonaws.sfn#ExecutionLimitExceeded": + throw await de_ExecutionLimitExceededRes(parsedOutput, context); + case "ExecutionNotRedrivable": + case "com.amazonaws.sfn#ExecutionNotRedrivable": + throw await de_ExecutionNotRedrivableRes(parsedOutput, context); + case "TaskDoesNotExist": + case "com.amazonaws.sfn#TaskDoesNotExist": + throw await de_TaskDoesNotExistRes(parsedOutput, context); + case "TaskTimedOut": + case "com.amazonaws.sfn#TaskTimedOut": + throw await de_TaskTimedOutRes(parsedOutput, context); + case "InvalidOutput": + case "com.amazonaws.sfn#InvalidOutput": + throw await de_InvalidOutputRes(parsedOutput, context); + case "ExecutionAlreadyExists": + case "com.amazonaws.sfn#ExecutionAlreadyExists": + throw await de_ExecutionAlreadyExistsRes(parsedOutput, context); + case "InvalidExecutionInput": + case "com.amazonaws.sfn#InvalidExecutionInput": + throw await de_InvalidExecutionInputRes(parsedOutput, context); + case "MissingRequiredParameter": + case "com.amazonaws.sfn#MissingRequiredParameter": + throw await de_MissingRequiredParameterRes(parsedOutput, context); + default: + const parsedBody = parsedOutput.body; + return throwDefaultError({ + output, + parsedBody, + errorCode + }); } - serialize(input, context) { - return (0, Aws_json1_0_1.se_UpdateStateMachineCommand)(input, context); + }, "de_CommandError"); + var de_ActivityAlreadyExistsRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new ActivityAlreadyExists({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_ActivityAlreadyExistsRes"); + var de_ActivityDoesNotExistRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new ActivityDoesNotExist({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_ActivityDoesNotExistRes"); + var de_ActivityLimitExceededRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new ActivityLimitExceeded({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_ActivityLimitExceededRes"); + var de_ActivityWorkerLimitExceededRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new ActivityWorkerLimitExceeded({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_ActivityWorkerLimitExceededRes"); + var de_ConflictExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new ConflictException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_ConflictExceptionRes"); + var de_ExecutionAlreadyExistsRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new ExecutionAlreadyExists({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_ExecutionAlreadyExistsRes"); + var de_ExecutionDoesNotExistRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new ExecutionDoesNotExist({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_ExecutionDoesNotExistRes"); + var de_ExecutionLimitExceededRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new ExecutionLimitExceeded({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_ExecutionLimitExceededRes"); + var de_ExecutionNotRedrivableRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new ExecutionNotRedrivable({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_ExecutionNotRedrivableRes"); + var de_InvalidArnRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new InvalidArn({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_InvalidArnRes"); + var de_InvalidDefinitionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new InvalidDefinition({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_InvalidDefinitionRes"); + var de_InvalidEncryptionConfigurationRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new InvalidEncryptionConfiguration({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_InvalidEncryptionConfigurationRes"); + var de_InvalidExecutionInputRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new InvalidExecutionInput({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_InvalidExecutionInputRes"); + var de_InvalidLoggingConfigurationRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new InvalidLoggingConfiguration({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_InvalidLoggingConfigurationRes"); + var de_InvalidNameRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new InvalidName({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_InvalidNameRes"); + var de_InvalidOutputRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new InvalidOutput({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_InvalidOutputRes"); + var de_InvalidTokenRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new InvalidToken({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_InvalidTokenRes"); + var de_InvalidTracingConfigurationRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new InvalidTracingConfiguration({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_InvalidTracingConfigurationRes"); + var de_KmsAccessDeniedExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new KmsAccessDeniedException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_KmsAccessDeniedExceptionRes"); + var de_KmsInvalidStateExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new KmsInvalidStateException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_KmsInvalidStateExceptionRes"); + var de_KmsThrottlingExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new KmsThrottlingException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_KmsThrottlingExceptionRes"); + var de_MissingRequiredParameterRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new MissingRequiredParameter({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_MissingRequiredParameterRes"); + var de_ResourceNotFoundRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new ResourceNotFound({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_ResourceNotFoundRes"); + var de_ServiceQuotaExceededExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new ServiceQuotaExceededException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_ServiceQuotaExceededExceptionRes"); + var de_StateMachineAlreadyExistsRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new StateMachineAlreadyExists({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_StateMachineAlreadyExistsRes"); + var de_StateMachineDeletingRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new StateMachineDeleting({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_StateMachineDeletingRes"); + var de_StateMachineDoesNotExistRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new StateMachineDoesNotExist({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_StateMachineDoesNotExistRes"); + var de_StateMachineLimitExceededRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new StateMachineLimitExceeded({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_StateMachineLimitExceededRes"); + var de_StateMachineTypeNotSupportedRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new StateMachineTypeNotSupported({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_StateMachineTypeNotSupportedRes"); + var de_TaskDoesNotExistRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new TaskDoesNotExist({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_TaskDoesNotExistRes"); + var de_TaskTimedOutRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new TaskTimedOut({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_TaskTimedOutRes"); + var de_TooManyTagsRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new TooManyTags({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_TooManyTagsRes"); + var de_ValidationExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => { + const body = parsedOutput.body; + const deserialized = (0, import_smithy_client5._json)(body); + const exception = new ValidationException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized + }); + return (0, import_smithy_client5.decorateServiceException)(exception, body); + }, "de_ValidationExceptionRes"); + var se_RedriveExecutionInput = /* @__PURE__ */ __name((input, context) => { + return (0, import_smithy_client5.take)(input, { + clientToken: [true, (_) => _ ?? (0, import_uuid.v4)()], + executionArn: [] + }); + }, "se_RedriveExecutionInput"); + var se_UpdateMapRunInput = /* @__PURE__ */ __name((input, context) => { + return (0, import_smithy_client5.take)(input, { + mapRunArn: [], + maxConcurrency: [], + toleratedFailureCount: [], + toleratedFailurePercentage: import_smithy_client5.serializeFloat + }); + }, "se_UpdateMapRunInput"); + var de_ActivityList = /* @__PURE__ */ __name((output, context) => { + const retVal = (output || []).filter((e) => e != null).map((entry) => { + return de_ActivityListItem(entry, context); + }); + return retVal; + }, "de_ActivityList"); + var de_ActivityListItem = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + activityArn: import_smithy_client5.expectString, + creationDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + name: import_smithy_client5.expectString + }); + }, "de_ActivityListItem"); + var de_CreateActivityOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + activityArn: import_smithy_client5.expectString, + creationDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))) + }); + }, "de_CreateActivityOutput"); + var de_CreateStateMachineAliasOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + creationDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + stateMachineAliasArn: import_smithy_client5.expectString + }); + }, "de_CreateStateMachineAliasOutput"); + var de_CreateStateMachineOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + creationDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + stateMachineArn: import_smithy_client5.expectString, + stateMachineVersionArn: import_smithy_client5.expectString + }); + }, "de_CreateStateMachineOutput"); + var de_DescribeActivityOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + activityArn: import_smithy_client5.expectString, + creationDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + encryptionConfiguration: import_smithy_client5._json, + name: import_smithy_client5.expectString + }); + }, "de_DescribeActivityOutput"); + var de_DescribeExecutionOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + cause: import_smithy_client5.expectString, + error: import_smithy_client5.expectString, + executionArn: import_smithy_client5.expectString, + input: import_smithy_client5.expectString, + inputDetails: import_smithy_client5._json, + mapRunArn: import_smithy_client5.expectString, + name: import_smithy_client5.expectString, + output: import_smithy_client5.expectString, + outputDetails: import_smithy_client5._json, + redriveCount: import_smithy_client5.expectInt32, + redriveDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + redriveStatus: import_smithy_client5.expectString, + redriveStatusReason: import_smithy_client5.expectString, + startDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + stateMachineAliasArn: import_smithy_client5.expectString, + stateMachineArn: import_smithy_client5.expectString, + stateMachineVersionArn: import_smithy_client5.expectString, + status: import_smithy_client5.expectString, + stopDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + traceHeader: import_smithy_client5.expectString + }); + }, "de_DescribeExecutionOutput"); + var de_DescribeMapRunOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + executionArn: import_smithy_client5.expectString, + executionCounts: import_smithy_client5._json, + itemCounts: import_smithy_client5._json, + mapRunArn: import_smithy_client5.expectString, + maxConcurrency: import_smithy_client5.expectInt32, + redriveCount: import_smithy_client5.expectInt32, + redriveDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + startDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + status: import_smithy_client5.expectString, + stopDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + toleratedFailureCount: import_smithy_client5.expectLong, + toleratedFailurePercentage: import_smithy_client5.limitedParseFloat32 + }); + }, "de_DescribeMapRunOutput"); + var de_DescribeStateMachineAliasOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + creationDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + description: import_smithy_client5.expectString, + name: import_smithy_client5.expectString, + routingConfiguration: import_smithy_client5._json, + stateMachineAliasArn: import_smithy_client5.expectString, + updateDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))) + }); + }, "de_DescribeStateMachineAliasOutput"); + var de_DescribeStateMachineForExecutionOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + definition: import_smithy_client5.expectString, + encryptionConfiguration: import_smithy_client5._json, + label: import_smithy_client5.expectString, + loggingConfiguration: import_smithy_client5._json, + mapRunArn: import_smithy_client5.expectString, + name: import_smithy_client5.expectString, + revisionId: import_smithy_client5.expectString, + roleArn: import_smithy_client5.expectString, + stateMachineArn: import_smithy_client5.expectString, + tracingConfiguration: import_smithy_client5._json, + updateDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))) + }); + }, "de_DescribeStateMachineForExecutionOutput"); + var de_DescribeStateMachineOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + creationDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + definition: import_smithy_client5.expectString, + description: import_smithy_client5.expectString, + encryptionConfiguration: import_smithy_client5._json, + label: import_smithy_client5.expectString, + loggingConfiguration: import_smithy_client5._json, + name: import_smithy_client5.expectString, + revisionId: import_smithy_client5.expectString, + roleArn: import_smithy_client5.expectString, + stateMachineArn: import_smithy_client5.expectString, + status: import_smithy_client5.expectString, + tracingConfiguration: import_smithy_client5._json, + type: import_smithy_client5.expectString + }); + }, "de_DescribeStateMachineOutput"); + var de_ExecutionList = /* @__PURE__ */ __name((output, context) => { + const retVal = (output || []).filter((e) => e != null).map((entry) => { + return de_ExecutionListItem(entry, context); + }); + return retVal; + }, "de_ExecutionList"); + var de_ExecutionListItem = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + executionArn: import_smithy_client5.expectString, + itemCount: import_smithy_client5.expectInt32, + mapRunArn: import_smithy_client5.expectString, + name: import_smithy_client5.expectString, + redriveCount: import_smithy_client5.expectInt32, + redriveDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + startDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + stateMachineAliasArn: import_smithy_client5.expectString, + stateMachineArn: import_smithy_client5.expectString, + stateMachineVersionArn: import_smithy_client5.expectString, + status: import_smithy_client5.expectString, + stopDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))) + }); + }, "de_ExecutionListItem"); + var de_GetExecutionHistoryOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + events: (_) => de_HistoryEventList(_, context), + nextToken: import_smithy_client5.expectString + }); + }, "de_GetExecutionHistoryOutput"); + var de_HistoryEvent = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + activityFailedEventDetails: import_smithy_client5._json, + activityScheduleFailedEventDetails: import_smithy_client5._json, + activityScheduledEventDetails: import_smithy_client5._json, + activityStartedEventDetails: import_smithy_client5._json, + activitySucceededEventDetails: import_smithy_client5._json, + activityTimedOutEventDetails: import_smithy_client5._json, + executionAbortedEventDetails: import_smithy_client5._json, + executionFailedEventDetails: import_smithy_client5._json, + executionRedrivenEventDetails: import_smithy_client5._json, + executionStartedEventDetails: import_smithy_client5._json, + executionSucceededEventDetails: import_smithy_client5._json, + executionTimedOutEventDetails: import_smithy_client5._json, + id: import_smithy_client5.expectLong, + lambdaFunctionFailedEventDetails: import_smithy_client5._json, + lambdaFunctionScheduleFailedEventDetails: import_smithy_client5._json, + lambdaFunctionScheduledEventDetails: import_smithy_client5._json, + lambdaFunctionStartFailedEventDetails: import_smithy_client5._json, + lambdaFunctionSucceededEventDetails: import_smithy_client5._json, + lambdaFunctionTimedOutEventDetails: import_smithy_client5._json, + mapIterationAbortedEventDetails: import_smithy_client5._json, + mapIterationFailedEventDetails: import_smithy_client5._json, + mapIterationStartedEventDetails: import_smithy_client5._json, + mapIterationSucceededEventDetails: import_smithy_client5._json, + mapRunFailedEventDetails: import_smithy_client5._json, + mapRunRedrivenEventDetails: import_smithy_client5._json, + mapRunStartedEventDetails: import_smithy_client5._json, + mapStateStartedEventDetails: import_smithy_client5._json, + previousEventId: import_smithy_client5.expectLong, + stateEnteredEventDetails: import_smithy_client5._json, + stateExitedEventDetails: import_smithy_client5._json, + taskFailedEventDetails: import_smithy_client5._json, + taskScheduledEventDetails: import_smithy_client5._json, + taskStartFailedEventDetails: import_smithy_client5._json, + taskStartedEventDetails: import_smithy_client5._json, + taskSubmitFailedEventDetails: import_smithy_client5._json, + taskSubmittedEventDetails: import_smithy_client5._json, + taskSucceededEventDetails: import_smithy_client5._json, + taskTimedOutEventDetails: import_smithy_client5._json, + timestamp: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + type: import_smithy_client5.expectString + }); + }, "de_HistoryEvent"); + var de_HistoryEventList = /* @__PURE__ */ __name((output, context) => { + const retVal = (output || []).filter((e) => e != null).map((entry) => { + return de_HistoryEvent(entry, context); + }); + return retVal; + }, "de_HistoryEventList"); + var de_ListActivitiesOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + activities: (_) => de_ActivityList(_, context), + nextToken: import_smithy_client5.expectString + }); + }, "de_ListActivitiesOutput"); + var de_ListExecutionsOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + executions: (_) => de_ExecutionList(_, context), + nextToken: import_smithy_client5.expectString + }); + }, "de_ListExecutionsOutput"); + var de_ListMapRunsOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + mapRuns: (_) => de_MapRunList(_, context), + nextToken: import_smithy_client5.expectString + }); + }, "de_ListMapRunsOutput"); + var de_ListStateMachineAliasesOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + nextToken: import_smithy_client5.expectString, + stateMachineAliases: (_) => de_StateMachineAliasList(_, context) + }); + }, "de_ListStateMachineAliasesOutput"); + var de_ListStateMachinesOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + nextToken: import_smithy_client5.expectString, + stateMachines: (_) => de_StateMachineList(_, context) + }); + }, "de_ListStateMachinesOutput"); + var de_ListStateMachineVersionsOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + nextToken: import_smithy_client5.expectString, + stateMachineVersions: (_) => de_StateMachineVersionList(_, context) + }); + }, "de_ListStateMachineVersionsOutput"); + var de_MapRunList = /* @__PURE__ */ __name((output, context) => { + const retVal = (output || []).filter((e) => e != null).map((entry) => { + return de_MapRunListItem(entry, context); + }); + return retVal; + }, "de_MapRunList"); + var de_MapRunListItem = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + executionArn: import_smithy_client5.expectString, + mapRunArn: import_smithy_client5.expectString, + startDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + stateMachineArn: import_smithy_client5.expectString, + stopDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))) + }); + }, "de_MapRunListItem"); + var de_PublishStateMachineVersionOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + creationDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + stateMachineVersionArn: import_smithy_client5.expectString + }); + }, "de_PublishStateMachineVersionOutput"); + var de_RedriveExecutionOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + redriveDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))) + }); + }, "de_RedriveExecutionOutput"); + var de_StartExecutionOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + executionArn: import_smithy_client5.expectString, + startDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))) + }); + }, "de_StartExecutionOutput"); + var de_StartSyncExecutionOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + billingDetails: import_smithy_client5._json, + cause: import_smithy_client5.expectString, + error: import_smithy_client5.expectString, + executionArn: import_smithy_client5.expectString, + input: import_smithy_client5.expectString, + inputDetails: import_smithy_client5._json, + name: import_smithy_client5.expectString, + output: import_smithy_client5.expectString, + outputDetails: import_smithy_client5._json, + startDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + stateMachineArn: import_smithy_client5.expectString, + status: import_smithy_client5.expectString, + stopDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + traceHeader: import_smithy_client5.expectString + }); + }, "de_StartSyncExecutionOutput"); + var de_StateMachineAliasList = /* @__PURE__ */ __name((output, context) => { + const retVal = (output || []).filter((e) => e != null).map((entry) => { + return de_StateMachineAliasListItem(entry, context); + }); + return retVal; + }, "de_StateMachineAliasList"); + var de_StateMachineAliasListItem = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + creationDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + stateMachineAliasArn: import_smithy_client5.expectString + }); + }, "de_StateMachineAliasListItem"); + var de_StateMachineList = /* @__PURE__ */ __name((output, context) => { + const retVal = (output || []).filter((e) => e != null).map((entry) => { + return de_StateMachineListItem(entry, context); + }); + return retVal; + }, "de_StateMachineList"); + var de_StateMachineListItem = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + creationDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + name: import_smithy_client5.expectString, + stateMachineArn: import_smithy_client5.expectString, + type: import_smithy_client5.expectString + }); + }, "de_StateMachineListItem"); + var de_StateMachineVersionList = /* @__PURE__ */ __name((output, context) => { + const retVal = (output || []).filter((e) => e != null).map((entry) => { + return de_StateMachineVersionListItem(entry, context); + }); + return retVal; + }, "de_StateMachineVersionList"); + var de_StateMachineVersionListItem = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + creationDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))), + stateMachineVersionArn: import_smithy_client5.expectString + }); + }, "de_StateMachineVersionListItem"); + var de_StopExecutionOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + stopDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))) + }); + }, "de_StopExecutionOutput"); + var de_UpdateStateMachineAliasOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + updateDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))) + }); + }, "de_UpdateStateMachineAliasOutput"); + var de_UpdateStateMachineOutput = /* @__PURE__ */ __name((output, context) => { + return (0, import_smithy_client5.take)(output, { + revisionId: import_smithy_client5.expectString, + stateMachineVersionArn: import_smithy_client5.expectString, + updateDate: (_) => (0, import_smithy_client5.expectNonNull)((0, import_smithy_client5.parseEpochTimestamp)((0, import_smithy_client5.expectNumber)(_))) + }); + }, "de_UpdateStateMachineOutput"); + var deserializeMetadata = /* @__PURE__ */ __name((output) => ({ + httpStatusCode: output.statusCode, + requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"], + extendedRequestId: output.headers["x-amz-id-2"], + cfId: output.headers["x-amz-cf-id"] + }), "deserializeMetadata"); + var throwDefaultError = (0, import_smithy_client5.withBaseException)(SFNServiceException); + var buildHttpRpcRequest = /* @__PURE__ */ __name(async (context, headers, path, resolvedHostname, body) => { + const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const contents = { + protocol, + hostname, + port, + method: "POST", + path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path, + headers + }; + if (resolvedHostname !== void 0) { + contents.hostname = resolvedHostname; } - deserialize(output, context) { - return (0, Aws_json1_0_1.de_UpdateStateMachineCommand)(output, context); + if (body !== void 0) { + contents.body = body; } + return new import_protocol_http8.HttpRequest(contents); + }, "buildHttpRpcRequest"); + function sharedHeaders(operation) { + return { + "content-type": "application/x-amz-json-1.0", + "x-amz-target": `AWSStepFunctions.${operation}` + }; + } + __name(sharedHeaders, "sharedHeaders"); + var _CreateActivityCommand = class _CreateActivityCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "CreateActivity", {}).n("SFNClient", "CreateActivityCommand").f(void 0, void 0).ser(se_CreateActivityCommand).de(de_CreateActivityCommand).build() { + }; + __name(_CreateActivityCommand, "CreateActivityCommand"); + var CreateActivityCommand = _CreateActivityCommand; + var _CreateStateMachineAliasCommand = class _CreateStateMachineAliasCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "CreateStateMachineAlias", {}).n("SFNClient", "CreateStateMachineAliasCommand").f(CreateStateMachineAliasInputFilterSensitiveLog, void 0).ser(se_CreateStateMachineAliasCommand).de(de_CreateStateMachineAliasCommand).build() { + }; + __name(_CreateStateMachineAliasCommand, "CreateStateMachineAliasCommand"); + var CreateStateMachineAliasCommand = _CreateStateMachineAliasCommand; + var _CreateStateMachineCommand = class _CreateStateMachineCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "CreateStateMachine", {}).n("SFNClient", "CreateStateMachineCommand").f(CreateStateMachineInputFilterSensitiveLog, void 0).ser(se_CreateStateMachineCommand).de(de_CreateStateMachineCommand).build() { + }; + __name(_CreateStateMachineCommand, "CreateStateMachineCommand"); + var CreateStateMachineCommand = _CreateStateMachineCommand; + var _DeleteActivityCommand = class _DeleteActivityCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "DeleteActivity", {}).n("SFNClient", "DeleteActivityCommand").f(void 0, void 0).ser(se_DeleteActivityCommand).de(de_DeleteActivityCommand).build() { + }; + __name(_DeleteActivityCommand, "DeleteActivityCommand"); + var DeleteActivityCommand = _DeleteActivityCommand; + var _DeleteStateMachineAliasCommand = class _DeleteStateMachineAliasCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "DeleteStateMachineAlias", {}).n("SFNClient", "DeleteStateMachineAliasCommand").f(void 0, void 0).ser(se_DeleteStateMachineAliasCommand).de(de_DeleteStateMachineAliasCommand).build() { + }; + __name(_DeleteStateMachineAliasCommand, "DeleteStateMachineAliasCommand"); + var DeleteStateMachineAliasCommand = _DeleteStateMachineAliasCommand; + var _DeleteStateMachineCommand = class _DeleteStateMachineCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "DeleteStateMachine", {}).n("SFNClient", "DeleteStateMachineCommand").f(void 0, void 0).ser(se_DeleteStateMachineCommand).de(de_DeleteStateMachineCommand).build() { + }; + __name(_DeleteStateMachineCommand, "DeleteStateMachineCommand"); + var DeleteStateMachineCommand = _DeleteStateMachineCommand; + var _DeleteStateMachineVersionCommand = class _DeleteStateMachineVersionCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "DeleteStateMachineVersion", {}).n("SFNClient", "DeleteStateMachineVersionCommand").f(void 0, void 0).ser(se_DeleteStateMachineVersionCommand).de(de_DeleteStateMachineVersionCommand).build() { + }; + __name(_DeleteStateMachineVersionCommand, "DeleteStateMachineVersionCommand"); + var DeleteStateMachineVersionCommand = _DeleteStateMachineVersionCommand; + var _DescribeActivityCommand = class _DescribeActivityCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "DescribeActivity", {}).n("SFNClient", "DescribeActivityCommand").f(void 0, void 0).ser(se_DescribeActivityCommand).de(de_DescribeActivityCommand).build() { + }; + __name(_DescribeActivityCommand, "DescribeActivityCommand"); + var DescribeActivityCommand = _DescribeActivityCommand; + var _DescribeExecutionCommand = class _DescribeExecutionCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "DescribeExecution", {}).n("SFNClient", "DescribeExecutionCommand").f(void 0, DescribeExecutionOutputFilterSensitiveLog).ser(se_DescribeExecutionCommand).de(de_DescribeExecutionCommand).build() { + }; + __name(_DescribeExecutionCommand, "DescribeExecutionCommand"); + var DescribeExecutionCommand = _DescribeExecutionCommand; + var _DescribeMapRunCommand = class _DescribeMapRunCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "DescribeMapRun", {}).n("SFNClient", "DescribeMapRunCommand").f(void 0, void 0).ser(se_DescribeMapRunCommand).de(de_DescribeMapRunCommand).build() { + }; + __name(_DescribeMapRunCommand, "DescribeMapRunCommand"); + var DescribeMapRunCommand = _DescribeMapRunCommand; + var _DescribeStateMachineAliasCommand = class _DescribeStateMachineAliasCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "DescribeStateMachineAlias", {}).n("SFNClient", "DescribeStateMachineAliasCommand").f(void 0, DescribeStateMachineAliasOutputFilterSensitiveLog).ser(se_DescribeStateMachineAliasCommand).de(de_DescribeStateMachineAliasCommand).build() { + }; + __name(_DescribeStateMachineAliasCommand, "DescribeStateMachineAliasCommand"); + var DescribeStateMachineAliasCommand = _DescribeStateMachineAliasCommand; + var _DescribeStateMachineCommand = class _DescribeStateMachineCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "DescribeStateMachine", {}).n("SFNClient", "DescribeStateMachineCommand").f(void 0, DescribeStateMachineOutputFilterSensitiveLog).ser(se_DescribeStateMachineCommand).de(de_DescribeStateMachineCommand).build() { + }; + __name(_DescribeStateMachineCommand, "DescribeStateMachineCommand"); + var DescribeStateMachineCommand = _DescribeStateMachineCommand; + var _DescribeStateMachineForExecutionCommand = class _DescribeStateMachineForExecutionCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "DescribeStateMachineForExecution", {}).n("SFNClient", "DescribeStateMachineForExecutionCommand").f(void 0, DescribeStateMachineForExecutionOutputFilterSensitiveLog).ser(se_DescribeStateMachineForExecutionCommand).de(de_DescribeStateMachineForExecutionCommand).build() { + }; + __name(_DescribeStateMachineForExecutionCommand, "DescribeStateMachineForExecutionCommand"); + var DescribeStateMachineForExecutionCommand = _DescribeStateMachineForExecutionCommand; + var _GetActivityTaskCommand = class _GetActivityTaskCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "GetActivityTask", {}).n("SFNClient", "GetActivityTaskCommand").f(void 0, GetActivityTaskOutputFilterSensitiveLog).ser(se_GetActivityTaskCommand).de(de_GetActivityTaskCommand).build() { + }; + __name(_GetActivityTaskCommand, "GetActivityTaskCommand"); + var GetActivityTaskCommand = _GetActivityTaskCommand; + var _GetExecutionHistoryCommand = class _GetExecutionHistoryCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "GetExecutionHistory", {}).n("SFNClient", "GetExecutionHistoryCommand").f(void 0, GetExecutionHistoryOutputFilterSensitiveLog).ser(se_GetExecutionHistoryCommand).de(de_GetExecutionHistoryCommand).build() { + }; + __name(_GetExecutionHistoryCommand, "GetExecutionHistoryCommand"); + var GetExecutionHistoryCommand = _GetExecutionHistoryCommand; + var _ListActivitiesCommand = class _ListActivitiesCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "ListActivities", {}).n("SFNClient", "ListActivitiesCommand").f(void 0, void 0).ser(se_ListActivitiesCommand).de(de_ListActivitiesCommand).build() { + }; + __name(_ListActivitiesCommand, "ListActivitiesCommand"); + var ListActivitiesCommand = _ListActivitiesCommand; + var _ListExecutionsCommand = class _ListExecutionsCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "ListExecutions", {}).n("SFNClient", "ListExecutionsCommand").f(void 0, void 0).ser(se_ListExecutionsCommand).de(de_ListExecutionsCommand).build() { + }; + __name(_ListExecutionsCommand, "ListExecutionsCommand"); + var ListExecutionsCommand = _ListExecutionsCommand; + var _ListMapRunsCommand = class _ListMapRunsCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "ListMapRuns", {}).n("SFNClient", "ListMapRunsCommand").f(void 0, void 0).ser(se_ListMapRunsCommand).de(de_ListMapRunsCommand).build() { + }; + __name(_ListMapRunsCommand, "ListMapRunsCommand"); + var ListMapRunsCommand = _ListMapRunsCommand; + var _ListStateMachineAliasesCommand = class _ListStateMachineAliasesCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "ListStateMachineAliases", {}).n("SFNClient", "ListStateMachineAliasesCommand").f(void 0, void 0).ser(se_ListStateMachineAliasesCommand).de(de_ListStateMachineAliasesCommand).build() { + }; + __name(_ListStateMachineAliasesCommand, "ListStateMachineAliasesCommand"); + var ListStateMachineAliasesCommand = _ListStateMachineAliasesCommand; + var _ListStateMachinesCommand = class _ListStateMachinesCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "ListStateMachines", {}).n("SFNClient", "ListStateMachinesCommand").f(void 0, void 0).ser(se_ListStateMachinesCommand).de(de_ListStateMachinesCommand).build() { + }; + __name(_ListStateMachinesCommand, "ListStateMachinesCommand"); + var ListStateMachinesCommand = _ListStateMachinesCommand; + var _ListStateMachineVersionsCommand = class _ListStateMachineVersionsCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "ListStateMachineVersions", {}).n("SFNClient", "ListStateMachineVersionsCommand").f(void 0, void 0).ser(se_ListStateMachineVersionsCommand).de(de_ListStateMachineVersionsCommand).build() { + }; + __name(_ListStateMachineVersionsCommand, "ListStateMachineVersionsCommand"); + var ListStateMachineVersionsCommand = _ListStateMachineVersionsCommand; + var _ListTagsForResourceCommand = class _ListTagsForResourceCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "ListTagsForResource", {}).n("SFNClient", "ListTagsForResourceCommand").f(void 0, void 0).ser(se_ListTagsForResourceCommand).de(de_ListTagsForResourceCommand).build() { + }; + __name(_ListTagsForResourceCommand, "ListTagsForResourceCommand"); + var ListTagsForResourceCommand = _ListTagsForResourceCommand; + var _PublishStateMachineVersionCommand = class _PublishStateMachineVersionCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "PublishStateMachineVersion", {}).n("SFNClient", "PublishStateMachineVersionCommand").f(PublishStateMachineVersionInputFilterSensitiveLog, void 0).ser(se_PublishStateMachineVersionCommand).de(de_PublishStateMachineVersionCommand).build() { + }; + __name(_PublishStateMachineVersionCommand, "PublishStateMachineVersionCommand"); + var PublishStateMachineVersionCommand = _PublishStateMachineVersionCommand; + var _RedriveExecutionCommand = class _RedriveExecutionCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "RedriveExecution", {}).n("SFNClient", "RedriveExecutionCommand").f(void 0, void 0).ser(se_RedriveExecutionCommand).de(de_RedriveExecutionCommand).build() { + }; + __name(_RedriveExecutionCommand, "RedriveExecutionCommand"); + var RedriveExecutionCommand = _RedriveExecutionCommand; + var _SendTaskFailureCommand = class _SendTaskFailureCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "SendTaskFailure", {}).n("SFNClient", "SendTaskFailureCommand").f(SendTaskFailureInputFilterSensitiveLog, void 0).ser(se_SendTaskFailureCommand).de(de_SendTaskFailureCommand).build() { + }; + __name(_SendTaskFailureCommand, "SendTaskFailureCommand"); + var SendTaskFailureCommand = _SendTaskFailureCommand; + var _SendTaskHeartbeatCommand = class _SendTaskHeartbeatCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "SendTaskHeartbeat", {}).n("SFNClient", "SendTaskHeartbeatCommand").f(void 0, void 0).ser(se_SendTaskHeartbeatCommand).de(de_SendTaskHeartbeatCommand).build() { + }; + __name(_SendTaskHeartbeatCommand, "SendTaskHeartbeatCommand"); + var SendTaskHeartbeatCommand = _SendTaskHeartbeatCommand; + var _SendTaskSuccessCommand = class _SendTaskSuccessCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "SendTaskSuccess", {}).n("SFNClient", "SendTaskSuccessCommand").f(SendTaskSuccessInputFilterSensitiveLog, void 0).ser(se_SendTaskSuccessCommand).de(de_SendTaskSuccessCommand).build() { + }; + __name(_SendTaskSuccessCommand, "SendTaskSuccessCommand"); + var SendTaskSuccessCommand = _SendTaskSuccessCommand; + var _StartExecutionCommand = class _StartExecutionCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "StartExecution", {}).n("SFNClient", "StartExecutionCommand").f(StartExecutionInputFilterSensitiveLog, void 0).ser(se_StartExecutionCommand).de(de_StartExecutionCommand).build() { + }; + __name(_StartExecutionCommand, "StartExecutionCommand"); + var StartExecutionCommand = _StartExecutionCommand; + var _StartSyncExecutionCommand = class _StartSyncExecutionCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "StartSyncExecution", {}).n("SFNClient", "StartSyncExecutionCommand").f(StartSyncExecutionInputFilterSensitiveLog, StartSyncExecutionOutputFilterSensitiveLog).ser(se_StartSyncExecutionCommand).de(de_StartSyncExecutionCommand).build() { + }; + __name(_StartSyncExecutionCommand, "StartSyncExecutionCommand"); + var StartSyncExecutionCommand = _StartSyncExecutionCommand; + var _StopExecutionCommand = class _StopExecutionCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "StopExecution", {}).n("SFNClient", "StopExecutionCommand").f(StopExecutionInputFilterSensitiveLog, void 0).ser(se_StopExecutionCommand).de(de_StopExecutionCommand).build() { + }; + __name(_StopExecutionCommand, "StopExecutionCommand"); + var StopExecutionCommand = _StopExecutionCommand; + var _TagResourceCommand = class _TagResourceCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "TagResource", {}).n("SFNClient", "TagResourceCommand").f(void 0, void 0).ser(se_TagResourceCommand).de(de_TagResourceCommand).build() { + }; + __name(_TagResourceCommand, "TagResourceCommand"); + var TagResourceCommand = _TagResourceCommand; + var _TestStateCommand = class _TestStateCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "TestState", {}).n("SFNClient", "TestStateCommand").f(TestStateInputFilterSensitiveLog, TestStateOutputFilterSensitiveLog).ser(se_TestStateCommand).de(de_TestStateCommand).build() { + }; + __name(_TestStateCommand, "TestStateCommand"); + var TestStateCommand = _TestStateCommand; + var _UntagResourceCommand = class _UntagResourceCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "UntagResource", {}).n("SFNClient", "UntagResourceCommand").f(void 0, void 0).ser(se_UntagResourceCommand).de(de_UntagResourceCommand).build() { + }; + __name(_UntagResourceCommand, "UntagResourceCommand"); + var UntagResourceCommand = _UntagResourceCommand; + var _UpdateMapRunCommand = class _UpdateMapRunCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "UpdateMapRun", {}).n("SFNClient", "UpdateMapRunCommand").f(void 0, void 0).ser(se_UpdateMapRunCommand).de(de_UpdateMapRunCommand).build() { + }; + __name(_UpdateMapRunCommand, "UpdateMapRunCommand"); + var UpdateMapRunCommand = _UpdateMapRunCommand; + var _UpdateStateMachineAliasCommand = class _UpdateStateMachineAliasCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "UpdateStateMachineAlias", {}).n("SFNClient", "UpdateStateMachineAliasCommand").f(UpdateStateMachineAliasInputFilterSensitiveLog, void 0).ser(se_UpdateStateMachineAliasCommand).de(de_UpdateStateMachineAliasCommand).build() { + }; + __name(_UpdateStateMachineAliasCommand, "UpdateStateMachineAliasCommand"); + var UpdateStateMachineAliasCommand = _UpdateStateMachineAliasCommand; + var _UpdateStateMachineCommand = class _UpdateStateMachineCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "UpdateStateMachine", {}).n("SFNClient", "UpdateStateMachineCommand").f(UpdateStateMachineInputFilterSensitiveLog, void 0).ser(se_UpdateStateMachineCommand).de(de_UpdateStateMachineCommand).build() { + }; + __name(_UpdateStateMachineCommand, "UpdateStateMachineCommand"); + var UpdateStateMachineCommand = _UpdateStateMachineCommand; + var _ValidateStateMachineDefinitionCommand = class _ValidateStateMachineDefinitionCommand extends import_smithy_client5.Command.classBuilder().ep({ + ...commonParams + }).m(function(Command, cs, config, o) { + return [ + (0, import_middleware_serde2.getSerdePlugin)(config, this.serialize, this.deserialize), + (0, import_middleware_endpoint2.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()) + ]; + }).s("AWSStepFunctions", "ValidateStateMachineDefinition", {}).n("SFNClient", "ValidateStateMachineDefinitionCommand").f(ValidateStateMachineDefinitionInputFilterSensitiveLog, void 0).ser(se_ValidateStateMachineDefinitionCommand).de(de_ValidateStateMachineDefinitionCommand).build() { }; - exports2.UpdateStateMachineCommand = UpdateStateMachineCommand; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/SFN.js -var require_SFN = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/SFN.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SFN = void 0; - var smithy_client_1 = require_dist_cjs34(); - var CreateActivityCommand_1 = require_CreateActivityCommand(); - var CreateStateMachineAliasCommand_1 = require_CreateStateMachineAliasCommand(); - var CreateStateMachineCommand_1 = require_CreateStateMachineCommand(); - var DeleteActivityCommand_1 = require_DeleteActivityCommand(); - var DeleteStateMachineAliasCommand_1 = require_DeleteStateMachineAliasCommand(); - var DeleteStateMachineCommand_1 = require_DeleteStateMachineCommand(); - var DeleteStateMachineVersionCommand_1 = require_DeleteStateMachineVersionCommand(); - var DescribeActivityCommand_1 = require_DescribeActivityCommand(); - var DescribeExecutionCommand_1 = require_DescribeExecutionCommand(); - var DescribeMapRunCommand_1 = require_DescribeMapRunCommand(); - var DescribeStateMachineAliasCommand_1 = require_DescribeStateMachineAliasCommand(); - var DescribeStateMachineCommand_1 = require_DescribeStateMachineCommand(); - var DescribeStateMachineForExecutionCommand_1 = require_DescribeStateMachineForExecutionCommand(); - var GetActivityTaskCommand_1 = require_GetActivityTaskCommand(); - var GetExecutionHistoryCommand_1 = require_GetExecutionHistoryCommand(); - var ListActivitiesCommand_1 = require_ListActivitiesCommand(); - var ListExecutionsCommand_1 = require_ListExecutionsCommand(); - var ListMapRunsCommand_1 = require_ListMapRunsCommand(); - var ListStateMachineAliasesCommand_1 = require_ListStateMachineAliasesCommand(); - var ListStateMachinesCommand_1 = require_ListStateMachinesCommand(); - var ListStateMachineVersionsCommand_1 = require_ListStateMachineVersionsCommand(); - var ListTagsForResourceCommand_1 = require_ListTagsForResourceCommand(); - var PublishStateMachineVersionCommand_1 = require_PublishStateMachineVersionCommand(); - var SendTaskFailureCommand_1 = require_SendTaskFailureCommand(); - var SendTaskHeartbeatCommand_1 = require_SendTaskHeartbeatCommand(); - var SendTaskSuccessCommand_1 = require_SendTaskSuccessCommand(); - var StartExecutionCommand_1 = require_StartExecutionCommand(); - var StartSyncExecutionCommand_1 = require_StartSyncExecutionCommand(); - var StopExecutionCommand_1 = require_StopExecutionCommand(); - var TagResourceCommand_1 = require_TagResourceCommand(); - var UntagResourceCommand_1 = require_UntagResourceCommand(); - var UpdateMapRunCommand_1 = require_UpdateMapRunCommand(); - var UpdateStateMachineAliasCommand_1 = require_UpdateStateMachineAliasCommand(); - var UpdateStateMachineCommand_1 = require_UpdateStateMachineCommand(); - var SFNClient_1 = require_SFNClient(); + __name(_ValidateStateMachineDefinitionCommand, "ValidateStateMachineDefinitionCommand"); + var ValidateStateMachineDefinitionCommand = _ValidateStateMachineDefinitionCommand; var commands = { - CreateActivityCommand: CreateActivityCommand_1.CreateActivityCommand, - CreateStateMachineCommand: CreateStateMachineCommand_1.CreateStateMachineCommand, - CreateStateMachineAliasCommand: CreateStateMachineAliasCommand_1.CreateStateMachineAliasCommand, - DeleteActivityCommand: DeleteActivityCommand_1.DeleteActivityCommand, - DeleteStateMachineCommand: DeleteStateMachineCommand_1.DeleteStateMachineCommand, - DeleteStateMachineAliasCommand: DeleteStateMachineAliasCommand_1.DeleteStateMachineAliasCommand, - DeleteStateMachineVersionCommand: DeleteStateMachineVersionCommand_1.DeleteStateMachineVersionCommand, - DescribeActivityCommand: DescribeActivityCommand_1.DescribeActivityCommand, - DescribeExecutionCommand: DescribeExecutionCommand_1.DescribeExecutionCommand, - DescribeMapRunCommand: DescribeMapRunCommand_1.DescribeMapRunCommand, - DescribeStateMachineCommand: DescribeStateMachineCommand_1.DescribeStateMachineCommand, - DescribeStateMachineAliasCommand: DescribeStateMachineAliasCommand_1.DescribeStateMachineAliasCommand, - DescribeStateMachineForExecutionCommand: DescribeStateMachineForExecutionCommand_1.DescribeStateMachineForExecutionCommand, - GetActivityTaskCommand: GetActivityTaskCommand_1.GetActivityTaskCommand, - GetExecutionHistoryCommand: GetExecutionHistoryCommand_1.GetExecutionHistoryCommand, - ListActivitiesCommand: ListActivitiesCommand_1.ListActivitiesCommand, - ListExecutionsCommand: ListExecutionsCommand_1.ListExecutionsCommand, - ListMapRunsCommand: ListMapRunsCommand_1.ListMapRunsCommand, - ListStateMachineAliasesCommand: ListStateMachineAliasesCommand_1.ListStateMachineAliasesCommand, - ListStateMachinesCommand: ListStateMachinesCommand_1.ListStateMachinesCommand, - ListStateMachineVersionsCommand: ListStateMachineVersionsCommand_1.ListStateMachineVersionsCommand, - ListTagsForResourceCommand: ListTagsForResourceCommand_1.ListTagsForResourceCommand, - PublishStateMachineVersionCommand: PublishStateMachineVersionCommand_1.PublishStateMachineVersionCommand, - SendTaskFailureCommand: SendTaskFailureCommand_1.SendTaskFailureCommand, - SendTaskHeartbeatCommand: SendTaskHeartbeatCommand_1.SendTaskHeartbeatCommand, - SendTaskSuccessCommand: SendTaskSuccessCommand_1.SendTaskSuccessCommand, - StartExecutionCommand: StartExecutionCommand_1.StartExecutionCommand, - StartSyncExecutionCommand: StartSyncExecutionCommand_1.StartSyncExecutionCommand, - StopExecutionCommand: StopExecutionCommand_1.StopExecutionCommand, - TagResourceCommand: TagResourceCommand_1.TagResourceCommand, - UntagResourceCommand: UntagResourceCommand_1.UntagResourceCommand, - UpdateMapRunCommand: UpdateMapRunCommand_1.UpdateMapRunCommand, - UpdateStateMachineCommand: UpdateStateMachineCommand_1.UpdateStateMachineCommand, - UpdateStateMachineAliasCommand: UpdateStateMachineAliasCommand_1.UpdateStateMachineAliasCommand - }; - var SFN2 = class extends SFNClient_1.SFNClient { - }; - exports2.SFN = SFN2; - (0, smithy_client_1.createAggregatedClient)(commands, SFN2); - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/index.js -var require_commands3 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/commands/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_CreateActivityCommand(), exports2); - tslib_1.__exportStar(require_CreateStateMachineAliasCommand(), exports2); - tslib_1.__exportStar(require_CreateStateMachineCommand(), exports2); - tslib_1.__exportStar(require_DeleteActivityCommand(), exports2); - tslib_1.__exportStar(require_DeleteStateMachineAliasCommand(), exports2); - tslib_1.__exportStar(require_DeleteStateMachineCommand(), exports2); - tslib_1.__exportStar(require_DeleteStateMachineVersionCommand(), exports2); - tslib_1.__exportStar(require_DescribeActivityCommand(), exports2); - tslib_1.__exportStar(require_DescribeExecutionCommand(), exports2); - tslib_1.__exportStar(require_DescribeMapRunCommand(), exports2); - tslib_1.__exportStar(require_DescribeStateMachineAliasCommand(), exports2); - tslib_1.__exportStar(require_DescribeStateMachineCommand(), exports2); - tslib_1.__exportStar(require_DescribeStateMachineForExecutionCommand(), exports2); - tslib_1.__exportStar(require_GetActivityTaskCommand(), exports2); - tslib_1.__exportStar(require_GetExecutionHistoryCommand(), exports2); - tslib_1.__exportStar(require_ListActivitiesCommand(), exports2); - tslib_1.__exportStar(require_ListExecutionsCommand(), exports2); - tslib_1.__exportStar(require_ListMapRunsCommand(), exports2); - tslib_1.__exportStar(require_ListStateMachineAliasesCommand(), exports2); - tslib_1.__exportStar(require_ListStateMachineVersionsCommand(), exports2); - tslib_1.__exportStar(require_ListStateMachinesCommand(), exports2); - tslib_1.__exportStar(require_ListTagsForResourceCommand(), exports2); - tslib_1.__exportStar(require_PublishStateMachineVersionCommand(), exports2); - tslib_1.__exportStar(require_SendTaskFailureCommand(), exports2); - tslib_1.__exportStar(require_SendTaskHeartbeatCommand(), exports2); - tslib_1.__exportStar(require_SendTaskSuccessCommand(), exports2); - tslib_1.__exportStar(require_StartExecutionCommand(), exports2); - tslib_1.__exportStar(require_StartSyncExecutionCommand(), exports2); - tslib_1.__exportStar(require_StopExecutionCommand(), exports2); - tslib_1.__exportStar(require_TagResourceCommand(), exports2); - tslib_1.__exportStar(require_UntagResourceCommand(), exports2); - tslib_1.__exportStar(require_UpdateMapRunCommand(), exports2); - tslib_1.__exportStar(require_UpdateStateMachineAliasCommand(), exports2); - tslib_1.__exportStar(require_UpdateStateMachineCommand(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/GetExecutionHistoryPaginator.js -var require_GetExecutionHistoryPaginator = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/GetExecutionHistoryPaginator.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.paginateGetExecutionHistory = void 0; - var GetExecutionHistoryCommand_1 = require_GetExecutionHistoryCommand(); - var SFNClient_1 = require_SFNClient(); - var makePagedClientRequest = async (client, input, ...args) => { - return await client.send(new GetExecutionHistoryCommand_1.GetExecutionHistoryCommand(input), ...args); - }; - async function* paginateGetExecutionHistory(config, input, ...additionalArguments) { - let token = config.startingToken || void 0; - let hasNext = true; - let page; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SFNClient_1.SFNClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SFN | SFNClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - return void 0; - } - exports2.paginateGetExecutionHistory = paginateGetExecutionHistory; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/Interfaces.js -var require_Interfaces2 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/Interfaces.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/ListActivitiesPaginator.js -var require_ListActivitiesPaginator = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/ListActivitiesPaginator.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.paginateListActivities = void 0; - var ListActivitiesCommand_1 = require_ListActivitiesCommand(); - var SFNClient_1 = require_SFNClient(); - var makePagedClientRequest = async (client, input, ...args) => { - return await client.send(new ListActivitiesCommand_1.ListActivitiesCommand(input), ...args); - }; - async function* paginateListActivities(config, input, ...additionalArguments) { - let token = config.startingToken || void 0; - let hasNext = true; - let page; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SFNClient_1.SFNClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SFN | SFNClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - return void 0; - } - exports2.paginateListActivities = paginateListActivities; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/ListExecutionsPaginator.js -var require_ListExecutionsPaginator = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/ListExecutionsPaginator.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.paginateListExecutions = void 0; - var ListExecutionsCommand_1 = require_ListExecutionsCommand(); - var SFNClient_1 = require_SFNClient(); - var makePagedClientRequest = async (client, input, ...args) => { - return await client.send(new ListExecutionsCommand_1.ListExecutionsCommand(input), ...args); - }; - async function* paginateListExecutions(config, input, ...additionalArguments) { - let token = config.startingToken || void 0; - let hasNext = true; - let page; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SFNClient_1.SFNClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SFN | SFNClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - return void 0; - } - exports2.paginateListExecutions = paginateListExecutions; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/ListMapRunsPaginator.js -var require_ListMapRunsPaginator = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/ListMapRunsPaginator.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.paginateListMapRuns = void 0; - var ListMapRunsCommand_1 = require_ListMapRunsCommand(); - var SFNClient_1 = require_SFNClient(); - var makePagedClientRequest = async (client, input, ...args) => { - return await client.send(new ListMapRunsCommand_1.ListMapRunsCommand(input), ...args); - }; - async function* paginateListMapRuns(config, input, ...additionalArguments) { - let token = config.startingToken || void 0; - let hasNext = true; - let page; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SFNClient_1.SFNClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SFN | SFNClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - return void 0; - } - exports2.paginateListMapRuns = paginateListMapRuns; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/ListStateMachinesPaginator.js -var require_ListStateMachinesPaginator = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/ListStateMachinesPaginator.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.paginateListStateMachines = void 0; - var ListStateMachinesCommand_1 = require_ListStateMachinesCommand(); - var SFNClient_1 = require_SFNClient(); - var makePagedClientRequest = async (client, input, ...args) => { - return await client.send(new ListStateMachinesCommand_1.ListStateMachinesCommand(input), ...args); - }; - async function* paginateListStateMachines(config, input, ...additionalArguments) { - let token = config.startingToken || void 0; - let hasNext = true; - let page; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SFNClient_1.SFNClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SFN | SFNClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - return void 0; - } - exports2.paginateListStateMachines = paginateListStateMachines; - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/index.js -var require_pagination3 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/pagination/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_GetExecutionHistoryPaginator(), exports2); - tslib_1.__exportStar(require_Interfaces2(), exports2); - tslib_1.__exportStar(require_ListActivitiesPaginator(), exports2); - tslib_1.__exportStar(require_ListExecutionsPaginator(), exports2); - tslib_1.__exportStar(require_ListMapRunsPaginator(), exports2); - tslib_1.__exportStar(require_ListStateMachinesPaginator(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/models/index.js -var require_models3 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/models/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_models_03(), exports2); - } -}); - -// ../../../node_modules/@aws-sdk/client-sfn/dist-cjs/index.js -var require_dist_cjs52 = __commonJS({ - "../../../node_modules/@aws-sdk/client-sfn/dist-cjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.SFNServiceException = void 0; - var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports)); - tslib_1.__exportStar(require_SFNClient(), exports2); - tslib_1.__exportStar(require_SFN(), exports2); - tslib_1.__exportStar(require_commands3(), exports2); - tslib_1.__exportStar(require_pagination3(), exports2); - tslib_1.__exportStar(require_models3(), exports2); - var SFNServiceException_1 = require_SFNServiceException(); - Object.defineProperty(exports2, "SFNServiceException", { enumerable: true, get: function() { - return SFNServiceException_1.SFNServiceException; - } }); + CreateActivityCommand, + CreateStateMachineCommand, + CreateStateMachineAliasCommand, + DeleteActivityCommand, + DeleteStateMachineCommand, + DeleteStateMachineAliasCommand, + DeleteStateMachineVersionCommand, + DescribeActivityCommand, + DescribeExecutionCommand, + DescribeMapRunCommand, + DescribeStateMachineCommand, + DescribeStateMachineAliasCommand, + DescribeStateMachineForExecutionCommand, + GetActivityTaskCommand, + GetExecutionHistoryCommand, + ListActivitiesCommand, + ListExecutionsCommand, + ListMapRunsCommand, + ListStateMachineAliasesCommand, + ListStateMachinesCommand, + ListStateMachineVersionsCommand, + ListTagsForResourceCommand, + PublishStateMachineVersionCommand, + RedriveExecutionCommand, + SendTaskFailureCommand, + SendTaskHeartbeatCommand, + SendTaskSuccessCommand, + StartExecutionCommand, + StartSyncExecutionCommand, + StopExecutionCommand, + TagResourceCommand, + TestStateCommand, + UntagResourceCommand, + UpdateMapRunCommand, + UpdateStateMachineCommand, + UpdateStateMachineAliasCommand, + ValidateStateMachineDefinitionCommand + }; + var _SFN = class _SFN extends SFNClient { + }; + __name(_SFN, "SFN"); + var SFN2 = _SFN; + (0, import_smithy_client5.createAggregatedClient)(commands, SFN2); + var paginateGetExecutionHistory = (0, import_core3.createPaginator)(SFNClient, GetExecutionHistoryCommand, "nextToken", "nextToken", "maxResults"); + var paginateListActivities = (0, import_core3.createPaginator)(SFNClient, ListActivitiesCommand, "nextToken", "nextToken", "maxResults"); + var paginateListExecutions = (0, import_core3.createPaginator)(SFNClient, ListExecutionsCommand, "nextToken", "nextToken", "maxResults"); + var paginateListMapRuns = (0, import_core3.createPaginator)(SFNClient, ListMapRunsCommand, "nextToken", "nextToken", "maxResults"); + var paginateListStateMachines = (0, import_core3.createPaginator)(SFNClient, ListStateMachinesCommand, "nextToken", "nextToken", "maxResults"); } }); // ../../../node_modules/webidl-conversions/lib/index.js -var require_lib2 = __commonJS({ +var require_lib = __commonJS({ "../../../node_modules/webidl-conversions/lib/index.js"(exports2, module2) { "use strict"; var conversions = {}; @@ -22866,7 +26560,7 @@ var require_lib2 = __commonJS({ }); // ../../../node_modules/whatwg-url/lib/utils.js -var require_utils2 = __commonJS({ +var require_utils = __commonJS({ "../../../node_modules/whatwg-url/lib/utils.js"(exports2, module2) { "use strict"; module2.exports.mixin = function mixin(target, source) { @@ -24287,8 +27981,8 @@ var require_URL_impl = __commonJS({ var require_URL = __commonJS({ "../../../node_modules/whatwg-url/lib/URL.js"(exports2, module2) { "use strict"; - var conversions = require_lib2(); - var utils = require_utils2(); + var conversions = require_lib(); + var utils = require_utils(); var Impl = require_URL_impl(); var impl = utils.implSymbol; function URL3(url2) { @@ -27998,7 +31692,7 @@ var require_streams = __commonJS({ }); // ../../../node_modules/iconv-lite/lib/index.js -var require_lib3 = __commonJS({ +var require_lib2 = __commonJS({ "../../../node_modules/iconv-lite/lib/index.js"(exports2, module2) { "use strict"; var Buffer2 = require_safer().Buffer; @@ -28121,7 +31815,7 @@ var require_lib3 = __commonJS({ var require_encoding = __commonJS({ "../../../node_modules/encoding/lib/encoding.js"(exports2, module2) { "use strict"; - var iconvLite = require_lib3(); + var iconvLite = require_lib2(); module2.exports.convert = convert; function convert(str, to, from) { from = checkEncoding(from || "UTF-8"); @@ -28166,7 +31860,7 @@ var require_encoding = __commonJS({ }); // ../../../node_modules/node-fetch/lib/index.js -var require_lib4 = __commonJS({ +var require_lib3 = __commonJS({ "../../../node_modules/node-fetch/lib/index.js"(exports2, module2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -28182,7 +31876,7 @@ var require_lib4 = __commonJS({ var Readable = Stream.Readable; var BUFFER = Symbol("buffer"); var TYPE = Symbol("type"); - var Blob = class _Blob { + var Blob2 = class _Blob { constructor() { this[TYPE] = ""; const blobParts = arguments[0]; @@ -28268,12 +31962,12 @@ var require_lib4 = __commonJS({ return blob; } }; - Object.defineProperties(Blob.prototype, { + Object.defineProperties(Blob2.prototype, { size: { enumerable: true }, type: { enumerable: true }, slice: { enumerable: true } }); - Object.defineProperty(Blob.prototype, Symbol.toStringTag, { + Object.defineProperty(Blob2.prototype, Symbol.toStringTag, { value: "Blob", writable: false, enumerable: false, @@ -28359,7 +32053,7 @@ var require_lib4 = __commonJS({ return consumeBody.call(this).then(function(buf) { return Object.assign( // Prevent copying - new Blob([], { + new Blob2([], { type: ct.toLowerCase() }), { @@ -28637,7 +32331,7 @@ var require_lib4 = __commonJS({ return void 0; } var MAP = Symbol("map"); - var Headers = class _Headers { + var Headers2 = class _Headers { /** * Headers class * @@ -28815,14 +32509,14 @@ var require_lib4 = __commonJS({ return createHeadersIterator(this, "key+value"); } }; - Headers.prototype.entries = Headers.prototype[Symbol.iterator]; - Object.defineProperty(Headers.prototype, Symbol.toStringTag, { + Headers2.prototype.entries = Headers2.prototype[Symbol.iterator]; + Object.defineProperty(Headers2.prototype, Symbol.toStringTag, { value: "Headers", writable: false, enumerable: false, configurable: true }); - Object.defineProperties(Headers.prototype, { + Object.defineProperties(Headers2.prototype, { get: { enumerable: true }, forEach: { enumerable: true }, set: { enumerable: true }, @@ -28891,7 +32585,7 @@ var require_lib4 = __commonJS({ return obj; } function createHeadersLenient(obj) { - const headers = new Headers(); + const headers = new Headers2(); for (const name of Object.keys(obj)) { if (invalidTokenRegex.test(name)) { continue; @@ -28921,7 +32615,7 @@ var require_lib4 = __commonJS({ let opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; Body.call(this, body, opts); const status = opts.status || 200; - const headers = new Headers(opts.headers); + const headers = new Headers2(opts.headers); if (body != null && !headers.has("Content-Type")) { const contentType = extractContentType(body); if (contentType) { @@ -29007,7 +32701,7 @@ var require_lib4 = __commonJS({ const proto = signal && typeof signal === "object" && Object.getPrototypeOf(signal); return !!(proto && proto.constructor.name === "AbortSignal"); } - var Request = class _Request { + var Request2 = class _Request { constructor(input) { let init = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; let parsedURL; @@ -29031,7 +32725,7 @@ var require_lib4 = __commonJS({ timeout: init.timeout || input.timeout || 0, size: init.size || input.size || 0 }); - const headers = new Headers(init.headers || input.headers || {}); + const headers = new Headers2(init.headers || input.headers || {}); if (inputBody != null && !headers.has("Content-Type")) { const contentType = extractContentType(inputBody); if (contentType) { @@ -29079,14 +32773,14 @@ var require_lib4 = __commonJS({ return new _Request(this); } }; - Body.mixIn(Request.prototype); - Object.defineProperty(Request.prototype, Symbol.toStringTag, { + Body.mixIn(Request2.prototype); + Object.defineProperty(Request2.prototype, Symbol.toStringTag, { value: "Request", writable: false, enumerable: false, configurable: true }); - Object.defineProperties(Request.prototype, { + Object.defineProperties(Request2.prototype, { method: { enumerable: true }, url: { enumerable: true }, headers: { enumerable: true }, @@ -29096,7 +32790,7 @@ var require_lib4 = __commonJS({ }); function getNodeRequestOptions(request2) { const parsedURL = request2[INTERNALS$2].parsedURL; - const headers = new Headers(request2[INTERNALS$2].headers); + const headers = new Headers2(request2[INTERNALS$2].headers); if (!headers.has("Accept")) { headers.set("Accept", "*/*"); } @@ -29159,13 +32853,13 @@ var require_lib4 = __commonJS({ const dest = new URL$1(destination).protocol; return orig === dest; }; - function fetch2(url2, opts) { - if (!fetch2.Promise) { + function fetch3(url2, opts) { + if (!fetch3.Promise) { throw new Error("native promise missing, set fetch.Promise to your favorite alternative"); } - Body.Promise = fetch2.Promise; - return new fetch2.Promise(function(resolve, reject) { - const request2 = new Request(url2, opts); + Body.Promise = fetch3.Promise; + return new fetch3.Promise(function(resolve, reject) { + const request2 = new Request2(url2, opts); const options = getNodeRequestOptions(request2); const send = (options.protocol === "https:" ? https2 : http).request; const signal = request2.signal; @@ -29235,7 +32929,7 @@ var require_lib4 = __commonJS({ req.on("response", function(res) { clearTimeout(reqTimeout); const headers = createHeadersLenient(res.headers); - if (fetch2.isRedirect(res.statusCode)) { + if (fetch3.isRedirect(res.statusCode)) { const location = headers.get("Location"); let locationURL = null; try { @@ -29271,7 +32965,7 @@ var require_lib4 = __commonJS({ return; } const requestOpts = { - headers: new Headers(request2.headers), + headers: new Headers2(request2.headers), follow: request2.follow, counter: request2.counter + 1, agent: request2.agent, @@ -29297,7 +32991,7 @@ var require_lib4 = __commonJS({ requestOpts.body = void 0; requestOpts.headers.delete("content-length"); } - resolve(fetch2(new Request(locationURL, requestOpts))); + resolve(fetch3(new Request2(locationURL, requestOpts))); finalize(); return; } @@ -29389,15 +33083,15 @@ var require_lib4 = __commonJS({ stream.end(); } } - fetch2.isRedirect = function(code) { + fetch3.isRedirect = function(code) { return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; }; - fetch2.Promise = global.Promise; - module2.exports = exports2 = fetch2; + fetch3.Promise = global.Promise; + module2.exports = exports2 = fetch3; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.default = exports2; - exports2.Headers = Headers; - exports2.Request = Request; + exports2.Headers = Headers2; + exports2.Request = Request2; exports2.Response = Response2; exports2.FetchError = FetchError; exports2.AbortError = AbortError; @@ -30992,7 +34686,7 @@ var init_api_call = __esm({ }); // ../aws-custom-resource-sdk-adapter/lib/index.js -var require_lib5 = __commonJS({ +var require_lib4 = __commonJS({ "../aws-custom-resource-sdk-adapter/lib/index.js"(exports2) { "use strict"; var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { @@ -31047,11 +34741,12 @@ var import_helpers_internal = __toESM(require_helpers_internal()); // lib/assertions/providers/lambda-handler/base.ts var https = __toESM(require("https")); var url = __toESM(require("url")); -var import_client_sfn = __toESM(require_dist_cjs52()); +var import_client_sfn = __toESM(require_dist_cjs80()); var CustomResourceHandler = class { constructor(event, context) { this.event = event; this.context = context; + this.timedOut = false; this.timeout = setTimeout(async () => { await this.respond({ status: "FAILED", @@ -31063,9 +34758,6 @@ var CustomResourceHandler = class { this.event = event; this.physicalResourceId = extractPhysicalResourceId(event); } - physicalResourceId; - timeout; - timedOut = false; /** * Handles executing the custom resource event. If `stateMachineArn` is present * in the props then trigger the waiter statemachine @@ -31199,7 +34891,6 @@ var AssertionHandler = class extends CustomResourceHandler { } }; var MatchCreator = class { - parsedObj; constructor(obj) { this.parsedObj = { matcher: obj @@ -31303,7 +34994,7 @@ function decodeCall(call) { } // lib/assertions/providers/lambda-handler/http.ts -var import_node_fetch = __toESM(require_lib4()); +var import_node_fetch = __toESM(require_lib3()); var HttpHandler = class extends CustomResourceHandler { async processEvent(request2) { console.log("request", request2); @@ -31326,7 +35017,7 @@ var HttpHandler = class extends CustomResourceHandler { }; // lib/assertions/providers/lambda-handler/sdk.ts -var import_aws_custom_resource_sdk_adapter = __toESM(require_lib5()); +var import_aws_custom_resource_sdk_adapter = __toESM(require_lib4()); // lib/assertions/providers/lambda-handler/utils.ts function deepParseJson(x) { diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule-lambda.assets.json b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule-lambda.assets.json new file mode 100644 index 0000000000000..823f111659d45 --- /dev/null +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule-lambda.assets.json @@ -0,0 +1,32 @@ +{ + "version": "38.0.1", + "files": { + "7f6fc8a416807b6be0ca2397479cd45d43dfe989a95bc81708f269e993296d34": { + "source": { + "path": "asset.7f6fc8a416807b6be0ca2397479cd45d43dfe989a95bc81708f269e993296d34.handler", + "packaging": "zip" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "7f6fc8a416807b6be0ca2397479cd45d43dfe989a95bc81708f269e993296d34.zip", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "be833ee096af567e7c39c110f906891002888273cb55fdc71d72997bde436ab9": { + "source": { + "path": "aws-cdk-schedule-lambda.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "be833ee096af567e7c39c110f906891002888273cb55fdc71d72997bde436ab9.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule-lambda.template.json b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule-lambda.template.json new file mode 100644 index 0000000000000..08e63f8cbcf56 --- /dev/null +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule-lambda.template.json @@ -0,0 +1,139 @@ +{ + "Resources": { + "MyLambdaServiceRole4539ECB6": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "MyLambdaServiceRoleDefaultPolicy5BBC6F68": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "lambda:TagResource", + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "MyLambdaServiceRoleDefaultPolicy5BBC6F68", + "Roles": [ + { + "Ref": "MyLambdaServiceRole4539ECB6" + } + ] + } + }, + "MyLambdaCCE802FB": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "S3Key": "7f6fc8a416807b6be0ca2397479cd45d43dfe989a95bc81708f269e993296d34.zip" + }, + "Environment": { + "Variables": { + "FUNC_ARN": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:FirstSelfTaggingLambda" + ] + ] + } + } + }, + "FunctionName": "FirstSelfTaggingLambda", + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "MyLambdaServiceRole4539ECB6", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Timeout": 30 + }, + "DependsOn": [ + "MyLambdaServiceRoleDefaultPolicy5BBC6F68", + "MyLambdaServiceRole4539ECB6" + ] + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule.assets.json b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule.assets.json index 91cf1e99afd3e..d208fe31871d5 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule.assets.json +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "files": { "7f6fc8a416807b6be0ca2397479cd45d43dfe989a95bc81708f269e993296d34": { "source": { @@ -14,7 +14,7 @@ } } }, - "999dc2fc3701af82856f5e22b1837fa360a4730eb16cf047b9cf97b1050c1089": { + "a659d0e16232815135c40f60ac6045cae13287002f893f68edae8d5e9e5ef4b9": { "source": { "path": "aws-cdk-schedule.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "999dc2fc3701af82856f5e22b1837fa360a4730eb16cf047b9cf97b1050c1089.json", + "objectKey": "a659d0e16232815135c40f60ac6045cae13287002f893f68edae8d5e9e5ef4b9.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule.template.json b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule.template.json index 7d82a52fa3649..f56e65ac425f4 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule.template.json +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/aws-cdk-schedule.template.json @@ -1,5 +1,155 @@ { "Resources": { + "ScheduleWithImportedLambda1C2110DF": { + "Type": "AWS::Scheduler::Schedule", + "Properties": { + "FlexibleTimeWindow": { + "Mode": "OFF" + }, + "ScheduleExpression": "rate(1 minute)", + "ScheduleExpressionTimezone": "Etc/UTC", + "State": "ENABLED", + "Target": { + "Arn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:FirstSelfTaggingLambda" + ] + ] + }, + "Input": "\"importedLambdaTagValue\"", + "RetryPolicy": { + "MaximumEventAgeInSeconds": 86400, + "MaximumRetryAttempts": 185 + }, + "RoleArn": { + "Fn::GetAtt": [ + "SchedulerRoleForTarget1441a743A31888", + "Arn" + ] + } + } + } + }, + "SchedulerRoleForTarget1441a743A31888": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Condition": { + "StringEquals": { + "aws:SourceAccount": { + "Ref": "AWS::AccountId" + } + } + }, + "Effect": "Allow", + "Principal": { + "Service": "scheduler.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "SchedulerRoleForTarget1441a7DefaultPolicy885B6BFD": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "MyLambdaCCE802FB", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:FirstSelfTaggingLambda" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:FirstSelfTaggingLambda:*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "MyLambdaCCE802FB", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "SchedulerRoleForTarget1441a7DefaultPolicy885B6BFD", + "Roles": [ + { + "Ref": "SchedulerRoleForTarget1441a743A31888" + } + ] + } + }, "MyLambdaServiceRole4539ECB6": { "Type": "AWS::IAM::Role", "Properties": { @@ -79,13 +229,13 @@ { "Ref": "AWS::AccountId" }, - ":function:TestSchedulerLambdaInvokeTarget" + ":function:SecondSelfTaggingLambda" ] ] } } }, - "FunctionName": "TestSchedulerLambdaInvokeTarget", + "FunctionName": "SecondSelfTaggingLambda", "Handler": "index.handler", "Role": { "Fn::GetAtt": [ @@ -101,7 +251,7 @@ "MyLambdaServiceRole4539ECB6" ] }, - "Schedule83A77FD1": { + "ScheduleWithSameStackLambda41F66AE8": { "Type": "AWS::Scheduler::Schedule", "Properties": { "FlexibleTimeWindow": { @@ -117,7 +267,7 @@ "Arn" ] }, - "Input": "\"test\"", + "Input": "\"sameStackLambdaTagValue\"", "RetryPolicy": { "MaximumEventAgeInSeconds": 86400, "MaximumRetryAttempts": 185 @@ -131,73 +281,7 @@ } } }, - "SchedulerRoleForTarget1441a743A31888": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Condition": { - "StringEquals": { - "aws:SourceAccount": { - "Ref": "AWS::AccountId" - } - } - }, - "Effect": "Allow", - "Principal": { - "Service": "scheduler.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "SchedulerRoleForTarget1441a7DefaultPolicy885B6BFD": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "lambda:InvokeFunction", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "MyLambdaCCE802FB", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "MyLambdaCCE802FB", - "Arn" - ] - }, - ":*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "SchedulerRoleForTarget1441a7DefaultPolicy885B6BFD", - "Roles": [ - { - "Ref": "SchedulerRoleForTarget1441a743A31888" - } - ] - } - }, - "Schedule2750DFBB1": { + "ScheduleWithStaticDate9FC69014": { "Type": "AWS::Scheduler::Schedule", "Properties": { "FlexibleTimeWindow": { @@ -227,19 +311,6 @@ } } }, - "Outputs": { - "ExportsOutputFnGetAttMyLambdaCCE802FBArn91287F74": { - "Value": { - "Fn::GetAtt": [ - "MyLambdaCCE802FB", - "Arn" - ] - }, - "Export": { - "Name": "aws-cdk-schedule:ExportsOutputFnGetAttMyLambdaCCE802FBArn91287F74" - } - } - }, "Parameters": { "BootstrapVersion": { "Type": "AWS::SSM::Parameter::Value", diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/cdk.out b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/cdk.out index 1f0068d32659a..c6e612584e352 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.0"} \ No newline at end of file +{"version":"38.0.1"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/integ.json b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/integ.json index 478ac7e280963..245f481dea6a2 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/integ.json +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "testCases": { "integtest-lambda-invoke/DefaultTest": { "stacks": [ diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/integtestlambdainvokeDefaultTestDeployAssertEC6565E6.assets.json b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/integtestlambdainvokeDefaultTestDeployAssertEC6565E6.assets.json index 2123029a95082..ed6bef1660d69 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/integtestlambdainvokeDefaultTestDeployAssertEC6565E6.assets.json +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/integtestlambdainvokeDefaultTestDeployAssertEC6565E6.assets.json @@ -1,20 +1,20 @@ { - "version": "36.0.0", + "version": "38.0.1", "files": { - "eafc02f6925151c95ac6a6ae81a3e36d4cf4e77db52eec8e467ce2a69454a41a": { + "e77649078c9dea5bbb707b7fe68014cfa5d919a38d31b467f6a205b51ea63a83": { "source": { - "path": "asset.eafc02f6925151c95ac6a6ae81a3e36d4cf4e77db52eec8e467ce2a69454a41a.bundle", + "path": "asset.e77649078c9dea5bbb707b7fe68014cfa5d919a38d31b467f6a205b51ea63a83.bundle", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "eafc02f6925151c95ac6a6ae81a3e36d4cf4e77db52eec8e467ce2a69454a41a.zip", + "objectKey": "e77649078c9dea5bbb707b7fe68014cfa5d919a38d31b467f6a205b51ea63a83.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "2125a43ef383820f4e6b47f40aef7c18bae12b2dc5cce3d493f9dd1898d5259d": { + "02d1ab525daaf145591856547abf91ecf627687732633fdbcbc496886fa476c8": { "source": { "path": "integtestlambdainvokeDefaultTestDeployAssertEC6565E6.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "2125a43ef383820f4e6b47f40aef7c18bae12b2dc5cce3d493f9dd1898d5259d.json", + "objectKey": "02d1ab525daaf145591856547abf91ecf627687732633fdbcbc496886fa476c8.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/integtestlambdainvokeDefaultTestDeployAssertEC6565E6.template.json b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/integtestlambdainvokeDefaultTestDeployAssertEC6565E6.template.json index 11e6a7a4c1512..5ce528892e8ae 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/integtestlambdainvokeDefaultTestDeployAssertEC6565E6.template.json +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/integtestlambdainvokeDefaultTestDeployAssertEC6565E6.template.json @@ -1,6 +1,6 @@ { "Resources": { - "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068": { + "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5": { "Type": "Custom::DeployAssert@SdkCallLambdalistTags", "Properties": { "ServiceToken": { @@ -11,31 +11,39 @@ }, "service": "Lambda", "api": "listTags", - "expected": "{\"$ObjectLike\":{\"Tags\":{\"OutputValue\":\"InRlc3Qi\"}}}", + "expected": "{\"$ObjectLike\":{\"Tags\":{\"OutputValue\":\"ImltcG9ydGVkTGFtYmRhVGFnVmFsdWUi\"}}}", "stateMachineArn": { - "Ref": "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068WaitFor1F6E5BE8" + "Ref": "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5WaitForDC36C07E" }, "parameters": { "Resource": { "Fn::Join": [ "", [ - "\"", + "\"arn:", { - "Fn::ImportValue": "aws-cdk-schedule:ExportsOutputFnGetAttMyLambdaCCE802FBArn91287F74" + "Ref": "AWS::Partition" }, - "\"" + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:FirstSelfTaggingLambda\"" ] ] } }, "flattenResponse": "false", - "salt": "1719212944641" + "salt": "1729535442276" }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" }, - "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068WaitForIsCompleteProviderInvoke3952D0F2": { + "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5WaitForIsCompleteProviderInvoke660A76A6": { "Type": "AWS::Lambda::Permission", "Properties": { "Action": "lambda:InvokeFunction", @@ -47,13 +55,13 @@ }, "Principal": { "Fn::GetAtt": [ - "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068WaitForRole9ECC1C92", + "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5WaitForRole10BE3E13", "Arn" ] } } }, - "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068WaitForTimeoutProviderInvoke8BE88C64": { + "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5WaitForTimeoutProviderInvoke41B0F0A8": { "Type": "AWS::Lambda::Permission", "Properties": { "Action": "lambda:InvokeFunction", @@ -65,13 +73,13 @@ }, "Principal": { "Fn::GetAtt": [ - "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068WaitForRole9ECC1C92", + "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5WaitForRole10BE3E13", "Arn" ] } } }, - "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068WaitForRole9ECC1C92": { + "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5WaitForRole10BE3E13": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { @@ -116,14 +124,14 @@ ] } }, - "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068WaitFor1F6E5BE8": { + "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5WaitForDC36C07E": { "Type": "AWS::StepFunctions::StateMachine", "Properties": { "DefinitionString": { "Fn::Join": [ "", [ - "{\"StartAt\":\"framework-isComplete-task\",\"States\":{\"framework-isComplete-task\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"States.ALL\"],\"IntervalSeconds\":5,\"MaxAttempts\":120,\"BackoffRate\":1}],\"Catch\":[{\"ErrorEquals\":[\"States.ALL\"],\"Next\":\"framework-onTimeout-task\"}],\"Type\":\"Task\",\"Resource\":\"", + "{\"StartAt\":\"framework-isComplete-task\",\"States\":{\"framework-isComplete-task\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"States.ALL\"],\"IntervalSeconds\":10,\"MaxAttempts\":60,\"BackoffRate\":1}],\"Catch\":[{\"ErrorEquals\":[\"States.ALL\"],\"Next\":\"framework-onTimeout-task\"}],\"Type\":\"Task\",\"Resource\":\"", { "Fn::GetAtt": [ "SingletonFunction76b3e830a873425f8453eddd85c86925Handler81461ECE", @@ -143,13 +151,13 @@ }, "RoleArn": { "Fn::GetAtt": [ - "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068WaitForRole9ECC1C92", + "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5WaitForRole10BE3E13", "Arn" ] } }, "DependsOn": [ - "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068WaitForRole9ECC1C92" + "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5WaitForRole10BE3E13" ] }, "SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73": { @@ -178,6 +186,24 @@ "PolicyDocument": { "Version": "2012-10-17", "Statement": [ + { + "Action": [ + "lambda:ListTags" + ], + "Effect": "Allow", + "Resource": [ + "*" + ] + }, + { + "Action": [ + "states:StartExecution" + ], + "Effect": "Allow", + "Resource": [ + "*" + ] + }, { "Action": [ "lambda:ListTags" @@ -218,7 +244,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "eafc02f6925151c95ac6a6ae81a3e36d4cf4e77db52eec8e467ce2a69454a41a.zip" + "S3Key": "e77649078c9dea5bbb707b7fe68014cfa5d919a38d31b467f6a205b51ea63a83.zip" }, "Timeout": 120, "Handler": "index.handler", @@ -256,6 +282,15 @@ "PolicyDocument": { "Version": "2012-10-17", "Statement": [ + { + "Action": [ + "lambda:ListTags" + ], + "Effect": "Allow", + "Resource": [ + "*" + ] + }, { "Action": [ "lambda:ListTags" @@ -287,7 +322,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "eafc02f6925151c95ac6a6ae81a3e36d4cf4e77db52eec8e467ce2a69454a41a.zip" + "S3Key": "e77649078c9dea5bbb707b7fe68014cfa5d919a38d31b467f6a205b51ea63a83.zip" }, "Timeout": 120, "Handler": "index.isComplete", @@ -337,7 +372,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "eafc02f6925151c95ac6a6ae81a3e36d4cf4e77db52eec8e467ce2a69454a41a.zip" + "S3Key": "e77649078c9dea5bbb707b7fe68014cfa5d919a38d31b467f6a205b51ea63a83.zip" }, "Timeout": 120, "Handler": "index.onTimeout", @@ -348,13 +383,181 @@ ] } } + }, + "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276": { + "Type": "Custom::DeployAssert@SdkCallLambdalistTags", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F", + "Arn" + ] + }, + "service": "Lambda", + "api": "listTags", + "expected": "{\"$ObjectLike\":{\"Tags\":{\"OutputValue\":\"InNhbWVTdGFja0xhbWJkYVRhZ1ZhbHVlIg==\"}}}", + "stateMachineArn": { + "Ref": "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276WaitFor0F7A5AD8" + }, + "parameters": { + "Resource": { + "Fn::Join": [ + "", + [ + "\"arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:SecondSelfTaggingLambda\"" + ] + ] + } + }, + "flattenResponse": "false", + "salt": "1729535442282" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276WaitForIsCompleteProviderInvoke3F067184": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "SingletonFunction76b3e830a873425f8453eddd85c86925Handler81461ECE", + "Arn" + ] + }, + "Principal": { + "Fn::GetAtt": [ + "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276WaitForRole0D010B44", + "Arn" + ] + } + } + }, + "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276WaitForTimeoutProviderInvoke11B424C0": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "SingletonFunction5c1898e096fb4e3e95d5f6c67f3ce41aHandlerADF3E6EA", + "Arn" + ] + }, + "Principal": { + "Fn::GetAtt": [ + "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276WaitForRole0D010B44", + "Arn" + ] + } + } + }, + "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276WaitForRole0D010B44": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ] + }, + "Policies": [ + { + "PolicyName": "InlineInvokeFunctions", + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "SingletonFunction76b3e830a873425f8453eddd85c86925Handler81461ECE", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "SingletonFunction5c1898e096fb4e3e95d5f6c67f3ce41aHandlerADF3E6EA", + "Arn" + ] + } + ] + } + ] + } + } + ] + } + }, + "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276WaitFor0F7A5AD8": { + "Type": "AWS::StepFunctions::StateMachine", + "Properties": { + "DefinitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"framework-isComplete-task\",\"States\":{\"framework-isComplete-task\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"States.ALL\"],\"IntervalSeconds\":10,\"MaxAttempts\":60,\"BackoffRate\":1}],\"Catch\":[{\"ErrorEquals\":[\"States.ALL\"],\"Next\":\"framework-onTimeout-task\"}],\"Type\":\"Task\",\"Resource\":\"", + { + "Fn::GetAtt": [ + "SingletonFunction76b3e830a873425f8453eddd85c86925Handler81461ECE", + "Arn" + ] + }, + "\"},\"framework-onTimeout-task\":{\"End\":true,\"Type\":\"Task\",\"Resource\":\"", + { + "Fn::GetAtt": [ + "SingletonFunction5c1898e096fb4e3e95d5f6c67f3ce41aHandlerADF3E6EA", + "Arn" + ] + }, + "\"}}}" + ] + ] + }, + "RoleArn": { + "Fn::GetAtt": [ + "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276WaitForRole0D010B44", + "Arn" + ] + } + }, + "DependsOn": [ + "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276WaitForRole0D010B44" + ] } }, "Outputs": { - "AssertionResultsAwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068": { + "AssertionResultsAwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5": { "Value": { "Fn::GetAtt": [ - "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068", + "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5", + "assertion" + ] + } + }, + "AssertionResultsAwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276": { + "Value": { + "Fn::GetAtt": [ + "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276", "assertion" ] } @@ -395,9 +598,18 @@ "ap-southeast-4": { "value": "nodejs20.x" }, + "ap-southeast-5": { + "value": "nodejs20.x" + }, + "ap-southeast-7": { + "value": "nodejs20.x" + }, "ca-central-1": { "value": "nodejs20.x" }, + "ca-west-1": { + "value": "nodejs20.x" + }, "cn-north-1": { "value": "nodejs18.x" }, @@ -410,6 +622,9 @@ "eu-central-2": { "value": "nodejs20.x" }, + "eu-isoe-west-1": { + "value": "nodejs18.x" + }, "eu-north-1": { "value": "nodejs20.x" }, @@ -437,6 +652,9 @@ "me-south-1": { "value": "nodejs20.x" }, + "mx-central-1": { + "value": "nodejs20.x" + }, "sa-east-1": { "value": "nodejs20.x" }, diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/manifest.json b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/manifest.json index 4f02d619cafcc..befc4b1d88ea9 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/manifest.json @@ -1,28 +1,29 @@ { - "version": "36.0.0", + "version": "38.0.1", "artifacts": { - "aws-cdk-schedule.assets": { + "aws-cdk-schedule-lambda.assets": { "type": "cdk:asset-manifest", "properties": { - "file": "aws-cdk-schedule.assets.json", + "file": "aws-cdk-schedule-lambda.assets.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" } }, - "aws-cdk-schedule": { + "aws-cdk-schedule-lambda": { "type": "aws:cloudformation:stack", "environment": "aws://unknown-account/unknown-region", "properties": { - "templateFile": "aws-cdk-schedule.template.json", + "templateFile": "aws-cdk-schedule-lambda.template.json", "terminationProtection": false, "validateOnSynth": false, + "notificationArns": [], "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/999dc2fc3701af82856f5e22b1837fa360a4730eb16cf047b9cf97b1050c1089.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/be833ee096af567e7c39c110f906891002888273cb55fdc71d72997bde436ab9.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ - "aws-cdk-schedule.assets" + "aws-cdk-schedule-lambda.assets" ], "lookupRole": { "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", @@ -31,31 +32,81 @@ } }, "dependencies": [ - "aws-cdk-schedule.assets" + "aws-cdk-schedule-lambda.assets" ], "metadata": { - "/aws-cdk-schedule/MyLambda/ServiceRole/Resource": [ + "/aws-cdk-schedule-lambda/MyLambda/ServiceRole/Resource": [ { "type": "aws:cdk:logicalId", "data": "MyLambdaServiceRole4539ECB6" } ], - "/aws-cdk-schedule/MyLambda/ServiceRole/DefaultPolicy/Resource": [ + "/aws-cdk-schedule-lambda/MyLambda/ServiceRole/DefaultPolicy/Resource": [ { "type": "aws:cdk:logicalId", "data": "MyLambdaServiceRoleDefaultPolicy5BBC6F68" } ], - "/aws-cdk-schedule/MyLambda/Resource": [ + "/aws-cdk-schedule-lambda/MyLambda/Resource": [ { "type": "aws:cdk:logicalId", "data": "MyLambdaCCE802FB" } ], - "/aws-cdk-schedule/Schedule/Resource": [ + "/aws-cdk-schedule-lambda/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/aws-cdk-schedule-lambda/CheckBootstrapVersion": [ { "type": "aws:cdk:logicalId", - "data": "Schedule83A77FD1" + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "aws-cdk-schedule-lambda" + }, + "aws-cdk-schedule.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "aws-cdk-schedule.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "aws-cdk-schedule": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "aws-cdk-schedule.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "notificationArns": [], + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/a659d0e16232815135c40f60ac6045cae13287002f893f68edae8d5e9e5ef4b9.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "aws-cdk-schedule.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "aws-cdk-schedule-lambda", + "aws-cdk-schedule.assets" + ], + "metadata": { + "/aws-cdk-schedule/ScheduleWithImportedLambda/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ScheduleWithImportedLambda1C2110DF" } ], "/aws-cdk-schedule/SchedulerRoleForTarget-1441a7/Resource": [ @@ -70,16 +121,34 @@ "data": "SchedulerRoleForTarget1441a7DefaultPolicy885B6BFD" } ], - "/aws-cdk-schedule/Schedule2/Resource": [ + "/aws-cdk-schedule/MyLambda/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyLambdaServiceRole4539ECB6" + } + ], + "/aws-cdk-schedule/MyLambda/ServiceRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyLambdaServiceRoleDefaultPolicy5BBC6F68" + } + ], + "/aws-cdk-schedule/MyLambda/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyLambdaCCE802FB" + } + ], + "/aws-cdk-schedule/ScheduleWithSameStackLambda/Resource": [ { "type": "aws:cdk:logicalId", - "data": "Schedule2750DFBB1" + "data": "ScheduleWithSameStackLambda41F66AE8" } ], - "/aws-cdk-schedule/Exports/Output{\"Fn::GetAtt\":[\"MyLambdaCCE802FB\",\"Arn\"]}": [ + "/aws-cdk-schedule/ScheduleWithStaticDate/Resource": [ { "type": "aws:cdk:logicalId", - "data": "ExportsOutputFnGetAttMyLambdaCCE802FBArn91287F74" + "data": "ScheduleWithStaticDate9FC69014" } ], "/aws-cdk-schedule/BootstrapVersion": [ @@ -112,9 +181,10 @@ "templateFile": "integtestlambdainvokeDefaultTestDeployAssertEC6565E6.template.json", "terminationProtection": false, "validateOnSynth": false, + "notificationArns": [], "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/2125a43ef383820f4e6b47f40aef7c18bae12b2dc5cce3d493f9dd1898d5259d.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/02d1ab525daaf145591856547abf91ecf627687732633fdbcbc496886fa476c8.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -127,44 +197,43 @@ } }, "dependencies": [ - "aws-cdk-schedule", "integtestlambdainvokeDefaultTestDeployAssertEC6565E6.assets" ], "metadata": { - "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/Default/Default": [ + "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/Default/Default": [ { "type": "aws:cdk:logicalId", - "data": "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068" + "data": "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5" } ], - "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/WaitFor/IsCompleteProvider/Invoke": [ + "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/WaitFor/IsCompleteProvider/Invoke": [ { "type": "aws:cdk:logicalId", - "data": "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068WaitForIsCompleteProviderInvoke3952D0F2" + "data": "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5WaitForIsCompleteProviderInvoke660A76A6" } ], - "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/WaitFor/TimeoutProvider/Invoke": [ + "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/WaitFor/TimeoutProvider/Invoke": [ { "type": "aws:cdk:logicalId", - "data": "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068WaitForTimeoutProviderInvoke8BE88C64" + "data": "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5WaitForTimeoutProviderInvoke41B0F0A8" } ], - "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/WaitFor/Role": [ + "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/WaitFor/Role": [ { "type": "aws:cdk:logicalId", - "data": "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068WaitForRole9ECC1C92" + "data": "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5WaitForRole10BE3E13" } ], - "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/WaitFor/Resource": [ + "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/WaitFor/Resource": [ { "type": "aws:cdk:logicalId", - "data": "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068WaitFor1F6E5BE8" + "data": "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5WaitForDC36C07E" } ], - "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/AssertionResults": [ + "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/AssertionResults": [ { "type": "aws:cdk:logicalId", - "data": "AssertionResultsAwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068" + "data": "AssertionResultsAwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5" } ], "/integtest-lambda-invoke/DefaultTest/DeployAssert/SingletonFunction1488541a7b23466481b69b4408076b81/Role": [ @@ -209,6 +278,42 @@ "data": "SingletonFunction5c1898e096fb4e3e95d5f6c67f3ce41aHandlerADF3E6EA" } ], + "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/Default/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276" + } + ], + "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/WaitFor/IsCompleteProvider/Invoke": [ + { + "type": "aws:cdk:logicalId", + "data": "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276WaitForIsCompleteProviderInvoke3F067184" + } + ], + "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/WaitFor/TimeoutProvider/Invoke": [ + { + "type": "aws:cdk:logicalId", + "data": "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276WaitForTimeoutProviderInvoke11B424C0" + } + ], + "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/WaitFor/Role": [ + { + "type": "aws:cdk:logicalId", + "data": "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276WaitForRole0D010B44" + } + ], + "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/WaitFor/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276WaitFor0F7A5AD8" + } + ], + "/integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/AssertionResults": [ + { + "type": "aws:cdk:logicalId", + "data": "AssertionResultsAwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276" + } + ], "/integtest-lambda-invoke/DefaultTest/DeployAssert/BootstrapVersion": [ { "type": "aws:cdk:logicalId", diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/tree.json b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/tree.json index 5032f8774feae..d2ce12f85034e 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/tree.json +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.js.snapshot/tree.json @@ -4,21 +4,21 @@ "id": "App", "path": "", "children": { - "aws-cdk-schedule": { - "id": "aws-cdk-schedule", - "path": "aws-cdk-schedule", + "aws-cdk-schedule-lambda": { + "id": "aws-cdk-schedule-lambda", + "path": "aws-cdk-schedule-lambda", "children": { "MyLambda": { "id": "MyLambda", - "path": "aws-cdk-schedule/MyLambda", + "path": "aws-cdk-schedule-lambda/MyLambda", "children": { "ServiceRole": { "id": "ServiceRole", - "path": "aws-cdk-schedule/MyLambda/ServiceRole", + "path": "aws-cdk-schedule-lambda/MyLambda/ServiceRole", "children": { "ImportServiceRole": { "id": "ImportServiceRole", - "path": "aws-cdk-schedule/MyLambda/ServiceRole/ImportServiceRole", + "path": "aws-cdk-schedule-lambda/MyLambda/ServiceRole/ImportServiceRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", "version": "0.0.0" @@ -26,7 +26,7 @@ }, "Resource": { "id": "Resource", - "path": "aws-cdk-schedule/MyLambda/ServiceRole/Resource", + "path": "aws-cdk-schedule-lambda/MyLambda/ServiceRole/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::IAM::Role", "aws:cdk:cloudformation:props": { @@ -65,11 +65,11 @@ }, "DefaultPolicy": { "id": "DefaultPolicy", - "path": "aws-cdk-schedule/MyLambda/ServiceRole/DefaultPolicy", + "path": "aws-cdk-schedule-lambda/MyLambda/ServiceRole/DefaultPolicy", "children": { "Resource": { "id": "Resource", - "path": "aws-cdk-schedule/MyLambda/ServiceRole/DefaultPolicy/Resource", + "path": "aws-cdk-schedule-lambda/MyLambda/ServiceRole/DefaultPolicy/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::IAM::Policy", "aws:cdk:cloudformation:props": { @@ -110,11 +110,11 @@ }, "Code": { "id": "Code", - "path": "aws-cdk-schedule/MyLambda/Code", + "path": "aws-cdk-schedule-lambda/MyLambda/Code", "children": { "Stage": { "id": "Stage", - "path": "aws-cdk-schedule/MyLambda/Code/Stage", + "path": "aws-cdk-schedule-lambda/MyLambda/Code/Stage", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", "version": "0.0.0" @@ -122,7 +122,7 @@ }, "AssetBucket": { "id": "AssetBucket", - "path": "aws-cdk-schedule/MyLambda/Code/AssetBucket", + "path": "aws-cdk-schedule-lambda/MyLambda/Code/AssetBucket", "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketBase", "version": "0.0.0" @@ -136,7 +136,7 @@ }, "Resource": { "id": "Resource", - "path": "aws-cdk-schedule/MyLambda/Resource", + "path": "aws-cdk-schedule-lambda/MyLambda/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::Lambda::Function", "aws:cdk:cloudformation:props": { @@ -164,13 +164,13 @@ { "Ref": "AWS::AccountId" }, - ":function:TestSchedulerLambdaInvokeTarget" + ":function:FirstSelfTaggingLambda" ] ] } } }, - "functionName": "TestSchedulerLambdaInvokeTarget", + "functionName": "FirstSelfTaggingLambda", "handler": "index.handler", "role": { "Fn::GetAtt": [ @@ -193,13 +193,47 @@ "version": "0.0.0" } }, - "Schedule": { - "id": "Schedule", - "path": "aws-cdk-schedule/Schedule", + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "aws-cdk-schedule-lambda/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "aws-cdk-schedule-lambda/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "aws-cdk-schedule": { + "id": "aws-cdk-schedule", + "path": "aws-cdk-schedule", + "children": { + "importedFromFirstStack": { + "id": "importedFromFirstStack", + "path": "aws-cdk-schedule/importedFromFirstStack", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.FunctionBase", + "version": "0.0.0" + } + }, + "ScheduleWithImportedLambda": { + "id": "ScheduleWithImportedLambda", + "path": "aws-cdk-schedule/ScheduleWithImportedLambda", "children": { "Resource": { "id": "Resource", - "path": "aws-cdk-schedule/Schedule/Resource", + "path": "aws-cdk-schedule/ScheduleWithImportedLambda/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::Scheduler::Schedule", "aws:cdk:cloudformation:props": { @@ -211,9 +245,23 @@ "state": "ENABLED", "target": { "arn": { - "Fn::GetAtt": [ - "MyLambdaCCE802FB", - "Arn" + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:FirstSelfTaggingLambda" + ] ] }, "roleArn": { @@ -222,7 +270,7 @@ "Arn" ] }, - "input": "\"test\"", + "input": "\"importedLambdaTagValue\"", "retryPolicy": { "maximumEventAgeInSeconds": 86400, "maximumRetryAttempts": 185 @@ -307,6 +355,46 @@ "Arn" ] }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:FirstSelfTaggingLambda" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:FirstSelfTaggingLambda:*" + ] + ] + }, { "Fn::Join": [ "", @@ -351,20 +439,205 @@ "version": "0.0.0" } }, - "Schedule2": { - "id": "Schedule2", - "path": "aws-cdk-schedule/Schedule2", + "MyLambda": { + "id": "MyLambda", + "path": "aws-cdk-schedule/MyLambda", "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "aws-cdk-schedule/MyLambda/ServiceRole", + "children": { + "ImportServiceRole": { + "id": "ImportServiceRole", + "path": "aws-cdk-schedule/MyLambda/ServiceRole/ImportServiceRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-cdk-schedule/MyLambda/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "aws-cdk-schedule/MyLambda/ServiceRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-schedule/MyLambda/ServiceRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "lambda:TagResource", + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "policyName": "MyLambdaServiceRoleDefaultPolicy5BBC6F68", + "roles": [ + { + "Ref": "MyLambdaServiceRole4539ECB6" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Code": { + "id": "Code", + "path": "aws-cdk-schedule/MyLambda/Code", + "children": { + "Stage": { + "id": "Stage", + "path": "aws-cdk-schedule/MyLambda/Code/Stage", + "constructInfo": { + "fqn": "aws-cdk-lib.AssetStaging", + "version": "0.0.0" + } + }, + "AssetBucket": { + "id": "AssetBucket", + "path": "aws-cdk-schedule/MyLambda/Code/AssetBucket", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.BucketBase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3_assets.Asset", + "version": "0.0.0" + } + }, "Resource": { "id": "Resource", - "path": "aws-cdk-schedule/Schedule2/Resource", + "path": "aws-cdk-schedule/MyLambda/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Function", + "aws:cdk:cloudformation:props": { + "code": { + "s3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "s3Key": "7f6fc8a416807b6be0ca2397479cd45d43dfe989a95bc81708f269e993296d34.zip" + }, + "environment": { + "variables": { + "FUNC_ARN": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:SecondSelfTaggingLambda" + ] + ] + } + } + }, + "functionName": "SecondSelfTaggingLambda", + "handler": "index.handler", + "role": { + "Fn::GetAtt": [ + "MyLambdaServiceRole4539ECB6", + "Arn" + ] + }, + "runtime": "nodejs18.x", + "timeout": 30 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.Function", + "version": "0.0.0" + } + }, + "ScheduleWithSameStackLambda": { + "id": "ScheduleWithSameStackLambda", + "path": "aws-cdk-schedule/ScheduleWithSameStackLambda", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-schedule/ScheduleWithSameStackLambda/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::Scheduler::Schedule", "aws:cdk:cloudformation:props": { "flexibleTimeWindow": { "mode": "OFF" }, - "scheduleExpression": "at(2000-01-01T00:00:00)", + "scheduleExpression": "rate(1 minute)", "scheduleExpressionTimezone": "Etc/UTC", "state": "ENABLED", "target": { @@ -380,9 +653,10 @@ "Arn" ] }, + "input": "\"sameStackLambdaTagValue\"", "retryPolicy": { "maximumEventAgeInSeconds": 86400, - "maximumRetryAttempts": 0 + "maximumRetryAttempts": 185 } } } @@ -398,22 +672,51 @@ "version": "0.0.0" } }, - "Exports": { - "id": "Exports", - "path": "aws-cdk-schedule/Exports", + "ScheduleWithStaticDate": { + "id": "ScheduleWithStaticDate", + "path": "aws-cdk-schedule/ScheduleWithStaticDate", "children": { - "Output{\"Fn::GetAtt\":[\"MyLambdaCCE802FB\",\"Arn\"]}": { - "id": "Output{\"Fn::GetAtt\":[\"MyLambdaCCE802FB\",\"Arn\"]}", - "path": "aws-cdk-schedule/Exports/Output{\"Fn::GetAtt\":[\"MyLambdaCCE802FB\",\"Arn\"]}", + "Resource": { + "id": "Resource", + "path": "aws-cdk-schedule/ScheduleWithStaticDate/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Scheduler::Schedule", + "aws:cdk:cloudformation:props": { + "flexibleTimeWindow": { + "mode": "OFF" + }, + "scheduleExpression": "at(2000-01-01T00:00:00)", + "scheduleExpressionTimezone": "Etc/UTC", + "state": "ENABLED", + "target": { + "arn": { + "Fn::GetAtt": [ + "MyLambdaCCE802FB", + "Arn" + ] + }, + "roleArn": { + "Fn::GetAtt": [ + "SchedulerRoleForTarget1441a743A31888", + "Arn" + ] + }, + "retryPolicy": { + "maximumEventAgeInSeconds": 86400, + "maximumRetryAttempts": 0 + } + } + } + }, "constructInfo": { - "fqn": "aws-cdk-lib.CfnOutput", + "fqn": "aws-cdk-lib.aws_scheduler.CfnSchedule", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" + "fqn": "@aws-cdk/aws-scheduler-alpha.Schedule", + "version": "0.0.0" } }, "BootstrapVersion": { @@ -458,17 +761,17 @@ "id": "DeployAssert", "path": "integtest-lambda-invoke/DefaultTest/DeployAssert", "children": { - "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068": { - "id": "AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068", + "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5": { + "id": "AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5", "children": { "SdkProvider": { "id": "SdkProvider", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/SdkProvider", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/SdkProvider", "children": { "AssertionsProvider": { "id": "AssertionsProvider", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/SdkProvider/AssertionsProvider", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/SdkProvider/AssertionsProvider", "constructInfo": { "fqn": "constructs.Construct", "version": "10.3.0" @@ -482,11 +785,11 @@ }, "Default": { "id": "Default", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/Default", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/Default", "children": { "Default": { "id": "Default", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/Default/Default", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/Default/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", "version": "0.0.0" @@ -500,15 +803,15 @@ }, "WaitFor": { "id": "WaitFor", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/WaitFor", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/WaitFor", "children": { "IsCompleteProvider": { "id": "IsCompleteProvider", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/WaitFor/IsCompleteProvider", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/WaitFor/IsCompleteProvider", "children": { "AssertionsProvider": { "id": "AssertionsProvider", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/WaitFor/IsCompleteProvider/AssertionsProvider", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/WaitFor/IsCompleteProvider/AssertionsProvider", "constructInfo": { "fqn": "constructs.Construct", "version": "10.3.0" @@ -516,7 +819,7 @@ }, "Invoke": { "id": "Invoke", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/WaitFor/IsCompleteProvider/Invoke", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/WaitFor/IsCompleteProvider/Invoke", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", "version": "0.0.0" @@ -530,11 +833,11 @@ }, "TimeoutProvider": { "id": "TimeoutProvider", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/WaitFor/TimeoutProvider", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/WaitFor/TimeoutProvider", "children": { "AssertionsProvider": { "id": "AssertionsProvider", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/WaitFor/TimeoutProvider/AssertionsProvider", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/WaitFor/TimeoutProvider/AssertionsProvider", "constructInfo": { "fqn": "constructs.Construct", "version": "10.3.0" @@ -542,7 +845,7 @@ }, "Invoke": { "id": "Invoke", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/WaitFor/TimeoutProvider/Invoke", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/WaitFor/TimeoutProvider/Invoke", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", "version": "0.0.0" @@ -556,7 +859,7 @@ }, "Role": { "id": "Role", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/WaitFor/Role", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/WaitFor/Role", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", "version": "0.0.0" @@ -564,7 +867,7 @@ }, "Resource": { "id": "Resource", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/WaitFor/Resource", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/WaitFor/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", "version": "0.0.0" @@ -578,7 +881,7 @@ }, "AssertionResults": { "id": "AssertionResults", - "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTags945cd5006c8a66eb7345b9b56ea54068/AssertionResults", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsfa577ce284ecabe6c15ac48d4f4b77f5/AssertionResults", "constructInfo": { "fqn": "aws-cdk-lib.CfnOutput", "version": "0.0.0" @@ -700,6 +1003,138 @@ "version": "10.3.0" } }, + "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276": { + "id": "AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276", + "children": { + "SdkProvider": { + "id": "SdkProvider", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/SdkProvider", + "children": { + "AssertionsProvider": { + "id": "AssertionsProvider", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/SdkProvider/AssertionsProvider", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.AssertionsProvider", + "version": "0.0.0" + } + }, + "Default": { + "id": "Default", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/Default", + "children": { + "Default": { + "id": "Default", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/Default/Default", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResource", + "version": "0.0.0" + } + }, + "WaitFor": { + "id": "WaitFor", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/WaitFor", + "children": { + "IsCompleteProvider": { + "id": "IsCompleteProvider", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/WaitFor/IsCompleteProvider", + "children": { + "AssertionsProvider": { + "id": "AssertionsProvider", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/WaitFor/IsCompleteProvider/AssertionsProvider", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "Invoke": { + "id": "Invoke", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/WaitFor/IsCompleteProvider/Invoke", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.AssertionsProvider", + "version": "0.0.0" + } + }, + "TimeoutProvider": { + "id": "TimeoutProvider", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/WaitFor/TimeoutProvider", + "children": { + "AssertionsProvider": { + "id": "AssertionsProvider", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/WaitFor/TimeoutProvider/AssertionsProvider", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "Invoke": { + "id": "Invoke", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/WaitFor/TimeoutProvider/Invoke", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.AssertionsProvider", + "version": "0.0.0" + } + }, + "Role": { + "id": "Role", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/WaitFor/Role", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/WaitFor/Resource", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.WaiterStateMachine", + "version": "0.0.0" + } + }, + "AssertionResults": { + "id": "AssertionResults", + "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/AwsApiCallLambdalistTagsc9aff8891471a47d011153d8741b2276/AssertionResults", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.AwsApiCall", + "version": "0.0.0" + } + }, "BootstrapVersion": { "id": "BootstrapVersion", "path": "integtest-lambda-invoke/DefaultTest/DeployAssert/BootstrapVersion", diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.ts b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.ts index 1d97a5ebc2179..e2f4a14d2b890 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.ts +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.lambda-invoke.ts @@ -6,6 +6,13 @@ import * as iam from 'aws-cdk-lib/aws-iam'; import * as lambda from 'aws-cdk-lib/aws-lambda'; import { LambdaInvoke } from '../lib'; +const LAMBDA_TAGGING_PERMISSION = new iam.PolicyStatement( + new iam.PolicyStatement({ + actions: ['lambda:TagResource'], + resources: ['*'], + }), +); + /* * Stack verification steps: * The lambda function is implemented to add a tag: @@ -15,60 +22,111 @@ import { LambdaInvoke } from '../lib'; * The assertion checks that the expected tag is created by calling listTags on the lambda function */ const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-cdk-schedule'); +/** + * 1st stack creates a lambda which will be imported to 2nd stack to test using imported lambda + */ +const lambdaStack = new cdk.Stack(app, 'aws-cdk-schedule-lambda'); + +const funcName = 'FirstSelfTaggingLambda'; +const funcToBeImported = new lambda.Function(lambdaStack, 'MyLambda', { + code: lambda.AssetCode.fromAsset(path.join(__dirname, 'integ.schedule-lambda-target.handler')), + handler: 'index.handler', + timeout: cdk.Duration.seconds(30), + runtime: lambda.Runtime.NODEJS_LATEST, + functionName: funcName, +}); +funcToBeImported.addToRolePolicy(LAMBDA_TAGGING_PERMISSION); -const functionName = 'TestSchedulerLambdaInvokeTarget'; -const functionArn = stack.formatArn({ +const funcToBeImportedStaticArn = lambdaStack.formatArn({ service: 'lambda', resource: 'function', - resourceName: functionName, + resourceName: funcName, arnFormat: cdk.ArnFormat.COLON_RESOURCE_NAME, }); -const payload = 'test'; +funcToBeImported.addEnvironment('FUNC_ARN', lambdaStack.resolve(funcToBeImportedStaticArn)); + +/** + * 2nd stack creates a lambda and a schedule to check they integrate correctly. + * It also creates a schedule to use with an imported lambda from the 1st stack above. + */ + +const scheduleStack = new cdk.Stack(app, 'aws-cdk-schedule'); +scheduleStack.addDependency(lambdaStack); + +// 1st case with imported lambda +const importedFunc = lambda.Function.fromFunctionAttributes(scheduleStack, 'importedFromFirstStack', { + functionArn: funcToBeImportedStaticArn, + skipPermissions: true, +}); +const importedLambdaTagValue = 'importedLambdaTagValue'; +new scheduler.Schedule(scheduleStack, 'ScheduleWithImportedLambda', { + schedule: scheduler.ScheduleExpression.rate(cdk.Duration.minutes(1)), + target: new LambdaInvoke(importedFunc, { + input: scheduler.ScheduleTargetInput.fromText(importedLambdaTagValue), + }), +}); -const func = new lambda.Function(stack, 'MyLambda', { +// 2nd case with lambda and schedule in same stack +const secondFuncName = 'SecondSelfTaggingLambda'; +const sameStackFunc = new lambda.Function(scheduleStack, 'MyLambda', { code: lambda.AssetCode.fromAsset(path.join(__dirname, 'integ.schedule-lambda-target.handler')), handler: 'index.handler', timeout: cdk.Duration.seconds(30), runtime: lambda.Runtime.NODEJS_LATEST, - functionName: functionName, + functionName: secondFuncName, }); -func.addEnvironment('FUNC_ARN', stack.resolve(functionArn)); - -func.addToRolePolicy(new iam.PolicyStatement( - new iam.PolicyStatement({ - actions: ['lambda:TagResource'], - resources: ['*'], - }), -)); +sameStackFunc.addToRolePolicy(LAMBDA_TAGGING_PERMISSION); +const sameStackFuncStaticArn = scheduleStack.formatArn({ + service: 'lambda', + resource: 'function', + resourceName: secondFuncName, + arnFormat: cdk.ArnFormat.COLON_RESOURCE_NAME, +}); +sameStackFunc.addEnvironment('FUNC_ARN', scheduleStack.resolve(sameStackFuncStaticArn)); -new scheduler.Schedule(stack, 'Schedule', { +const sameStackLambdaTagValue = 'sameStackLambdaTagValue'; +new scheduler.Schedule(scheduleStack, 'ScheduleWithSameStackLambda', { schedule: scheduler.ScheduleExpression.rate(cdk.Duration.minutes(1)), - target: new LambdaInvoke(func, { - input: scheduler.ScheduleTargetInput.fromText(payload), + target: new LambdaInvoke(sameStackFunc, { + input: scheduler.ScheduleTargetInput.fromText(sameStackLambdaTagValue), }), }); -// test multiple schedules with same target ARN are created correctly -new scheduler.Schedule(stack, 'Schedule2', { + +// 3rd case testing reusing target lambda and static date +new scheduler.Schedule(scheduleStack, 'ScheduleWithStaticDate', { schedule: scheduler.ScheduleExpression.at(new Date('2000-01-01T00:00:00Z')), - target: new LambdaInvoke(func, { retryAttempts: 0 }), + target: new LambdaInvoke(sameStackFunc, { retryAttempts: 0 }), }); const integ = new IntegTest(app, 'integtest-lambda-invoke', { - testCases: [stack], + testCases: [scheduleStack], stackUpdateWorkflow: false, // this would cause the schedule to trigger with the old code }); -const invokeListTags = integ.assertions.awsApiCall('Lambda', 'listTags', { - Resource: func.functionArn, +const listTagsOnImportedLambda = integ.assertions.awsApiCall('Lambda', 'listTags', { + Resource: funcToBeImportedStaticArn, +}); + +// Verifies that expected tag is created for the lambda function +listTagsOnImportedLambda.expect(ExpectedResult.objectLike({ + Tags: { + OutputValue: Buffer.from(JSON.stringify(importedLambdaTagValue)).toString('base64'), + }, +})).waitForAssertions({ + totalTimeout: cdk.Duration.minutes(10), + interval: cdk.Duration.seconds(10), +}); + +const listTagsOnSameStackLambda = integ.assertions.awsApiCall('Lambda', 'listTags', { + Resource: sameStackFuncStaticArn, }); // Verifies that expected tag is created for the lambda function -invokeListTags.expect(ExpectedResult.objectLike({ +listTagsOnSameStackLambda.expect(ExpectedResult.objectLike({ Tags: { - OutputValue: Buffer.from(JSON.stringify(payload)).toString('base64'), + OutputValue: Buffer.from(JSON.stringify(sameStackLambdaTagValue)).toString('base64'), }, })).waitForAssertions({ totalTimeout: cdk.Duration.minutes(10), - interval: cdk.Duration.seconds(5), + interval: cdk.Duration.seconds(10), }); diff --git a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/lambda-invoke.test.ts b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/lambda-invoke.test.ts index 8439776023afd..2fcb2a8d30629 100644 --- a/packages/@aws-cdk/aws-scheduler-targets-alpha/test/lambda-invoke.test.ts +++ b/packages/@aws-cdk/aws-scheduler-targets-alpha/test/lambda-invoke.test.ts @@ -319,42 +319,38 @@ describe('schedule target', () => { }); }); - test('throws when lambda function is imported from different account', () => { - const importedFunc = lambda.Function.fromFunctionArn(stack, 'ImportedFunction', 'arn:aws:lambda:us-east-1:234567890123:function/somefunc'); - - const lambdaTarget = new LambdaInvoke(importedFunc, {}); - - expect(() => - new Schedule(stack, 'MyScheduleDummy', { - schedule: expr, - target: lambdaTarget, - })).toThrow(/Both the schedule and the function must be in the same account/); - }); - - test('throws when lambda function is imported from different region', () => { - const importedFunc = lambda.Function.fromFunctionArn(stack, 'ImportedFunction', 'arn:aws:lambda:us-west-2:123456789012:function/somefunc'); + test('using imported lambda function should not throw', () => { + const lambdaFuncArn = 'arn:aws:lambda:us-east-1:234567890123:function/somefunc'; + const importedFunc = lambda.Function.fromFunctionAttributes( + stack, + 'ImportedLambdaFunction', + { + functionArn: lambdaFuncArn, + skipPermissions: true, + }, + ); const lambdaTarget = new LambdaInvoke(importedFunc, {}); - - expect(() => - new Schedule(stack, 'MyScheduleDummy', { - schedule: expr, - target: lambdaTarget, - })).toThrow(/Both the schedule and the function must be in the same region/); - }); - - test('throws when IAM role is imported from different account', () => { - const importedRole = Role.fromRoleArn(stack, 'ImportedRole', 'arn:aws:iam::234567890123:role/someRole'); - - const lambdaTarget = new LambdaInvoke(func, { - role: importedRole, + new Schedule(stack, 'MyScheduleDummy', { + schedule: expr, + target: lambdaTarget, }); - expect(() => - new Schedule(stack, 'MyScheduleDummy', { - schedule: expr, - target: lambdaTarget, - })).toThrow(/Both the target and the execution role must be in the same account/); + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: 'lambda:InvokeFunction', + Effect: 'Allow', + Resource: [ + lambdaFuncArn, + `${lambdaFuncArn}:*`, + ], + }, + ], + }, + Roles: [{ Ref: 'SchedulerRoleForTargetfdfcef0FF637F7' }], + }); }); test('adds permissions to DLQ', () => {