UNPKG

cdk-amazon-chime-resources

Version:

![Experimental](https://img.shields.io/badge/experimental-important.svg?style=for-the-badge)

1,210 lines (1,202 loc) 1.73 MB
var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __esm = (fn, res) => function __init() { return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; }; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // 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 ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // 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: () => HttpApiKeyAuthLocation2, HttpAuthLocation: () => HttpAuthLocation, IniSectionType: () => IniSectionType, RequestHandlerProtocol: () => RequestHandlerProtocol, SMITHY_CONTEXT_KEY: () => SMITHY_CONTEXT_KEY4, getDefaultClientConfiguration: () => getDefaultClientConfiguration, resolveDefaultRuntimeConfig: () => resolveDefaultRuntimeConfig }); 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 }); } 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_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 || {}); } }); // 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; }; 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; } /** * 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; } }; __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); } }; __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(request) { const cloned = new _HttpRequest2({ ...request, headers: { ...request.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(request) { if (!request) { return false; } const req = request; 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); } }; __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; } static isInstance(response2) { if (!response2) return false; const resp = response2; 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/@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, 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 __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 } = args; const { handlerProtocol = "" } = options.requestHandler.metadata || {}; if (handlerProtocol.indexOf("h2") >= 0 && !request.headers[":authority"]) { delete request.headers["host"]; request.headers[":authority"] = request.hostname + (request.port ? ":" + request.port : ""); } else if (!request.headers["host"]) { let host = request.hostname; if (request.port != null) host += `:${request.port}`; request.headers["host"] = host; } return next(args); }, "hostHeaderMiddleware"); var hostHeaderMiddlewareOptions = { name: "hostHeaderMiddleware", step: "build", priority: "low", tags: ["HOST"], override: true }; var getHostHeaderPlugin = /* @__PURE__ */ __name((options) => ({ applyToStack: (clientStack) => { clientStack.add(hostHeaderMiddleware(options), hostHeaderMiddlewareOptions); } }), "getHostHeaderPlugin"); } }); // 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"; 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 response2 = await next(args); const { clientName, commandName, logger, dynamoDbDocumentClientOptions = {} } = context; const { overrideInputFilterSensitiveLog, overrideOutputFilterSensitiveLog } = dynamoDbDocumentClientOptions; const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context.inputFilterSensitiveLog; const outputFilterSensitiveLog = overrideOutputFilterSensitiveLog ?? context.outputFilterSensitiveLog; const { $metadata, ...outputWithoutMetadata } = response2.output; (_a = logger == null ? void 0 : logger.info) == null ? void 0 : _a.call(logger, { clientName, commandName, input: inputFilterSensitiveLog(args.input), output: outputFilterSensitiveLog(outputWithoutMetadata), metadata: $metadata }); return response2; } catch (error) { const { clientName, commandName, logger, dynamoDbDocumentClientOptions = {} } = context; const { overrideInputFilterSensitiveLog } = dynamoDbDocumentClientOptions; const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context.inputFilterSensitiveLog; (_b = logger == null ? void 0 : logger.error) == null ? void 0 : _b.call(logger, { clientName, commandName, input: inputFilterSensitiveLog(args.input), error, metadata: error.$metadata }); throw error; } }, "loggerMiddleware"); var loggerMiddlewareOptions = { name: "loggerMiddleware", tags: ["LOGGER"], step: "initialize", override: true }; var getLoggerPlugin = /* @__PURE__ */ __name((options) => ({ applyToStack: (clientStack) => { clientStack.add(loggerMiddleware(), loggerMiddlewareOptions); } }), "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, 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 __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 = /* @__PURE__ */ __name((options) => (next) => async (args) => { const { request } = args; if (!import_protocol_http8.HttpRequest.isInstance(request) || options.runtime !== "node" || request.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 = /* @__PURE__ */ __name((str) => typeof str === "string" && str.length > 0, "nonEmptyString"); if (nonEmptyString(functionName) && nonEmptyString(traceId)) { request.headers[TRACE_ID_HEADER_NAME] = traceId; } return next({ ...args, request }); }, "recursionDetectionMiddleware"); var addRecursionDetectionMiddlewareOptions = { step: "build", tags: ["RECURSION_DETECTION"], name: "recursionDetectionMiddleware", override: true, priority: "low" }; var getRecursionDetectionPlugin = /* @__PURE__ */ __name((options) => ({ applyToStack: (clientStack) => { clientStack.add(recursionDetectionMiddleware(options), addRecursionDetectionMiddlewareOptions); } }), "getRecursionDetectionPlugin"); } }); // node_modules/@smithy/util-endpoints/dist-cjs/index.js var require_dist_cjs6 = __commonJS({ "node_modules/@smithy/util-endpoints/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, { EndpointError: () => EndpointError2, customEndpointFunctions: () => customEndpointFunctions, isIpAddress: () => isIpAddress2, isValidHostLabel: () => isValidHostLabel, resolveEndpoint: () => resolveEndpoint2 }); module2.exports = __toCommonJS2(src_exports); 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); } const labels = value.split("."); for (const label of labels) { if (!isValidHostLabel(label)) { return false; } } 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 { if (value instanceof URL) { return value; } if (typeof value === "object" && "hostname" in value) { const { hostname: hostname2, port, protocol: protocol2 = "", path = "", query = {} } = value; const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path}`); url.search = Object.entries(query).map(([k, v]) => `${k}=${v}`).join("&"); return url; } return new URL(value); } catch (error) { return null; } })(); 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; } 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 }; 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); } 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 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, 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(url, 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, _e; 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: {} }); if ((_c = options.endpointParams) == null ? void 0 : _c.Endpoint) { try { const givenEndpoint = new URL(options.endpointParams.Endpoint); const { protocol, port } = givenEndpoint; endpoint.url.protocol = protocol; endpoint.url.port = port; } catch (e) { } } (_e = (_d = options.logger) == null ? void 0 : _d.debug) == null ? void 0 : _e.call(_d, `${debugId} Resolved endpoint: ${toDebugString(endpoint)}`); return endpoint; }, "resolveEndpoint"); } }); // 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; 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, { 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_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; } if (!(0, import_util_endpoints.isValidHostLabel)(value)) { return false; } if (value.length < 3 || value.length > 63) { return false; } if (value !== value.toLowerCase()) { return false; } if ((0, import_util_endpoints.isIpAddress)(value)) { return false; } 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)" }, "ap-southeast-5": { description: "Asia Pacific (Malaysia)" }, "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": {