Initial
This commit is contained in:
201
resources/app/node_modules/@smithy/util-endpoints/LICENSE
generated
vendored
Normal file
201
resources/app/node_modules/@smithy/util-endpoints/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/debug/debugId.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/debug/debugId.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/debug/index.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/debug/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/debug/toDebugString.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/debug/toDebugString.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/getEndpointUrlConfig.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/getEndpointUrlConfig.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
484
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/index.js
generated
vendored
Normal file
484
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/index.js
generated
vendored
Normal file
@@ -0,0 +1,484 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
||||
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/index.ts
|
||||
var src_exports = {};
|
||||
__export(src_exports, {
|
||||
EndpointError: () => EndpointError,
|
||||
customEndpointFunctions: () => customEndpointFunctions,
|
||||
isIpAddress: () => isIpAddress,
|
||||
isValidHostLabel: () => isValidHostLabel,
|
||||
resolveEndpoint: () => resolveEndpoint
|
||||
});
|
||||
module.exports = __toCommonJS(src_exports);
|
||||
|
||||
// src/lib/isIpAddress.ts
|
||||
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 = /* @__PURE__ */ __name((value) => IP_V4_REGEX.test(value) || value.startsWith("[") && value.endsWith("]"), "isIpAddress");
|
||||
|
||||
// src/lib/isValidHostLabel.ts
|
||||
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");
|
||||
|
||||
// src/utils/customEndpointFunctions.ts
|
||||
var customEndpointFunctions = {};
|
||||
|
||||
// src/debug/debugId.ts
|
||||
var debugId = "endpoints";
|
||||
|
||||
// src/debug/toDebugString.ts
|
||||
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");
|
||||
|
||||
// src/types/EndpointError.ts
|
||||
var _EndpointError = class _EndpointError extends Error {
|
||||
constructor(message) {
|
||||
super(message);
|
||||
this.name = "EndpointError";
|
||||
}
|
||||
};
|
||||
__name(_EndpointError, "EndpointError");
|
||||
var EndpointError = _EndpointError;
|
||||
|
||||
// src/lib/booleanEquals.ts
|
||||
var booleanEquals = /* @__PURE__ */ __name((value1, value2) => value1 === value2, "booleanEquals");
|
||||
|
||||
// src/lib/getAttrPathList.ts
|
||||
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 EndpointError(`Path: '${path}' does not end with ']'`);
|
||||
}
|
||||
const arrayIndex = part.slice(squareBracketIndex + 1, -1);
|
||||
if (Number.isNaN(parseInt(arrayIndex))) {
|
||||
throw new EndpointError(`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");
|
||||
|
||||
// src/lib/getAttr.ts
|
||||
var getAttr = /* @__PURE__ */ __name((value, path) => getAttrPathList(path).reduce((acc, index) => {
|
||||
if (typeof acc !== "object") {
|
||||
throw new EndpointError(`Index '${index}' in '${path}' not found in '${JSON.stringify(value)}'`);
|
||||
} else if (Array.isArray(acc)) {
|
||||
return acc[parseInt(index)];
|
||||
}
|
||||
return acc[index];
|
||||
}, value), "getAttr");
|
||||
|
||||
// src/lib/isSet.ts
|
||||
var isSet = /* @__PURE__ */ __name((value) => value != null, "isSet");
|
||||
|
||||
// src/lib/not.ts
|
||||
var not = /* @__PURE__ */ __name((value) => !value, "not");
|
||||
|
||||
// src/lib/parseURL.ts
|
||||
var import_types3 = require("@smithy/types");
|
||||
var DEFAULT_PORTS = {
|
||||
[import_types3.EndpointURLScheme.HTTP]: 80,
|
||||
[import_types3.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_types3.EndpointURLScheme).includes(scheme)) {
|
||||
return null;
|
||||
}
|
||||
const isIp = 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
|
||||
};
|
||||
}, "parseURL");
|
||||
|
||||
// src/lib/stringEquals.ts
|
||||
var stringEquals = /* @__PURE__ */ __name((value1, value2) => value1 === value2, "stringEquals");
|
||||
|
||||
// src/lib/substring.ts
|
||||
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");
|
||||
|
||||
// src/lib/uriEncode.ts
|
||||
var uriEncode = /* @__PURE__ */ __name((value) => encodeURIComponent(value).replace(/[!*'()]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`), "uriEncode");
|
||||
|
||||
// src/utils/endpointFunctions.ts
|
||||
var endpointFunctions = {
|
||||
booleanEquals,
|
||||
getAttr,
|
||||
isSet,
|
||||
isValidHostLabel,
|
||||
not,
|
||||
parseURL,
|
||||
stringEquals,
|
||||
substring,
|
||||
uriEncode
|
||||
};
|
||||
|
||||
// src/utils/evaluateTemplate.ts
|
||||
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");
|
||||
|
||||
// src/utils/getReferenceValue.ts
|
||||
var getReferenceValue = /* @__PURE__ */ __name(({ ref }, options) => {
|
||||
const referenceRecord = {
|
||||
...options.endpointParams,
|
||||
...options.referenceRecord
|
||||
};
|
||||
return referenceRecord[ref];
|
||||
}, "getReferenceValue");
|
||||
|
||||
// src/utils/evaluateExpression.ts
|
||||
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 EndpointError(`'${keyName}': ${String(obj)} is not a string, function or reference.`);
|
||||
}, "evaluateExpression");
|
||||
|
||||
// src/utils/callFunction.ts
|
||||
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");
|
||||
|
||||
// src/utils/evaluateCondition.ts
|
||||
var evaluateCondition = /* @__PURE__ */ __name(({ assign, ...fnArgs }, options) => {
|
||||
var _a, _b;
|
||||
if (assign && assign in options.referenceRecord) {
|
||||
throw new EndpointError(`'${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");
|
||||
|
||||
// src/utils/evaluateConditions.ts
|
||||
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");
|
||||
|
||||
// src/utils/getEndpointHeaders.ts
|
||||
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 EndpointError(`Header '${headerKey}' value '${processedExpr}' is not a string`);
|
||||
}
|
||||
return processedExpr;
|
||||
})
|
||||
}),
|
||||
{}
|
||||
), "getEndpointHeaders");
|
||||
|
||||
// src/utils/getEndpointProperty.ts
|
||||
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 EndpointError(`Unexpected endpoint property: ${property}`);
|
||||
}
|
||||
return getEndpointProperties(property, options);
|
||||
case "boolean":
|
||||
return property;
|
||||
default:
|
||||
throw new EndpointError(`Unexpected endpoint property type: ${typeof property}`);
|
||||
}
|
||||
}, "getEndpointProperty");
|
||||
|
||||
// src/utils/getEndpointProperties.ts
|
||||
var getEndpointProperties = /* @__PURE__ */ __name((properties, options) => Object.entries(properties).reduce(
|
||||
(acc, [propertyKey, propertyVal]) => ({
|
||||
...acc,
|
||||
[propertyKey]: getEndpointProperty(propertyVal, options)
|
||||
}),
|
||||
{}
|
||||
), "getEndpointProperties");
|
||||
|
||||
// src/utils/getEndpointUrl.ts
|
||||
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 EndpointError(`Endpoint URL must be a string, got ${typeof expression}`);
|
||||
}, "getEndpointUrl");
|
||||
|
||||
// src/utils/evaluateEndpointRule.ts
|
||||
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");
|
||||
|
||||
// src/utils/evaluateErrorRule.ts
|
||||
var evaluateErrorRule = /* @__PURE__ */ __name((errorRule, options) => {
|
||||
const { conditions, error } = errorRule;
|
||||
const { result, referenceRecord } = evaluateConditions(conditions, options);
|
||||
if (!result) {
|
||||
return;
|
||||
}
|
||||
throw new EndpointError(
|
||||
evaluateExpression(error, "Error", {
|
||||
...options,
|
||||
referenceRecord: { ...options.referenceRecord, ...referenceRecord }
|
||||
})
|
||||
);
|
||||
}, "evaluateErrorRule");
|
||||
|
||||
// src/utils/evaluateTreeRule.ts
|
||||
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");
|
||||
|
||||
// src/utils/evaluateRules.ts
|
||||
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 EndpointError(`Unknown endpoint rule: ${rule}`);
|
||||
}
|
||||
}
|
||||
throw new EndpointError(`Rules evaluation failed`);
|
||||
}, "evaluateRules");
|
||||
|
||||
// src/resolveEndpoint.ts
|
||||
var resolveEndpoint = /* @__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 EndpointError(`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");
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
|
||||
0 && (module.exports = {
|
||||
isIpAddress,
|
||||
isValidHostLabel,
|
||||
customEndpointFunctions,
|
||||
resolveEndpoint,
|
||||
EndpointError
|
||||
});
|
||||
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/lib/booleanEquals.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/lib/booleanEquals.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/lib/getAttr.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/lib/getAttr.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/lib/getAttrPathList.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/lib/getAttrPathList.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/lib/index.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/lib/isIpAddress.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/lib/isIpAddress.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/lib/isSet.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/lib/isSet.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/lib/isValidHostLabel.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/lib/isValidHostLabel.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/lib/not.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/lib/not.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/lib/parseURL.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/lib/parseURL.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/lib/stringEquals.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/lib/stringEquals.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/lib/substring.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/lib/substring.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/lib/uriEncode.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/lib/uriEncode.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/resolveEndpoint.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/resolveEndpoint.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/types/EndpointError.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/types/EndpointError.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/types/EndpointFunctions.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/types/EndpointFunctions.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/types/EndpointRuleObject.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/types/EndpointRuleObject.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/types/ErrorRuleObject.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/types/ErrorRuleObject.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/types/RuleSetObject.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/types/RuleSetObject.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/types/TreeRuleObject.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/types/TreeRuleObject.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/types/index.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/types/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/types/shared.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/types/shared.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/callFunction.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/callFunction.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/customEndpointFunctions.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/customEndpointFunctions.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/endpointFunctions.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/endpointFunctions.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/evaluateCondition.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/evaluateCondition.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/evaluateConditions.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/evaluateConditions.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/evaluateEndpointRule.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/evaluateEndpointRule.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/evaluateErrorRule.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/evaluateErrorRule.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/evaluateExpression.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/evaluateExpression.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/evaluateRules.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/evaluateRules.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/evaluateTemplate.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/evaluateTemplate.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/evaluateTreeRule.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/evaluateTreeRule.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/getEndpointHeaders.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/getEndpointHeaders.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/getEndpointProperties.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/getEndpointProperties.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/getEndpointProperty.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/getEndpointProperty.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/getEndpointUrl.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/getEndpointUrl.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/getReferenceValue.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/getReferenceValue.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/index.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-cjs/utils/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("../index.js");
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-es/debug/debugId.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-es/debug/debugId.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export const debugId = "endpoints";
|
||||
2
resources/app/node_modules/@smithy/util-endpoints/dist-es/debug/index.js
generated
vendored
Normal file
2
resources/app/node_modules/@smithy/util-endpoints/dist-es/debug/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./debugId";
|
||||
export * from "./toDebugString";
|
||||
12
resources/app/node_modules/@smithy/util-endpoints/dist-es/debug/toDebugString.js
generated
vendored
Normal file
12
resources/app/node_modules/@smithy/util-endpoints/dist-es/debug/toDebugString.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
export 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);
|
||||
}
|
||||
21
resources/app/node_modules/@smithy/util-endpoints/dist-es/getEndpointUrlConfig.js
generated
vendored
Normal file
21
resources/app/node_modules/@smithy/util-endpoints/dist-es/getEndpointUrlConfig.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
const ENV_ENDPOINT_URL = "AWS_ENDPOINT_URL";
|
||||
const CONFIG_ENDPOINT_URL = "endpoint_url";
|
||||
export const getEndpointUrlConfig = (serviceId) => ({
|
||||
environmentVariableSelector: (env) => {
|
||||
const serviceEndpointUrlSections = [ENV_ENDPOINT_URL, ...serviceId.split(" ").map((w) => w.toUpperCase())];
|
||||
const serviceEndpointUrl = env[serviceEndpointUrlSections.join("_")];
|
||||
if (serviceEndpointUrl)
|
||||
return serviceEndpointUrl;
|
||||
const endpointUrl = env[ENV_ENDPOINT_URL];
|
||||
if (endpointUrl)
|
||||
return endpointUrl;
|
||||
return undefined;
|
||||
},
|
||||
configFileSelector: (profile) => {
|
||||
const endpointUrl = profile[CONFIG_ENDPOINT_URL];
|
||||
if (endpointUrl)
|
||||
return endpointUrl;
|
||||
return undefined;
|
||||
},
|
||||
default: undefined,
|
||||
});
|
||||
5
resources/app/node_modules/@smithy/util-endpoints/dist-es/index.js
generated
vendored
Normal file
5
resources/app/node_modules/@smithy/util-endpoints/dist-es/index.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export * from "./lib/isIpAddress";
|
||||
export * from "./lib/isValidHostLabel";
|
||||
export * from "./utils/customEndpointFunctions";
|
||||
export * from "./resolveEndpoint";
|
||||
export * from "./types";
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-es/lib/booleanEquals.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-es/lib/booleanEquals.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export const booleanEquals = (value1, value2) => value1 === value2;
|
||||
11
resources/app/node_modules/@smithy/util-endpoints/dist-es/lib/getAttr.js
generated
vendored
Normal file
11
resources/app/node_modules/@smithy/util-endpoints/dist-es/lib/getAttr.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { EndpointError } from "../types";
|
||||
import { getAttrPathList } from "./getAttrPathList";
|
||||
export const getAttr = (value, path) => getAttrPathList(path).reduce((acc, index) => {
|
||||
if (typeof acc !== "object") {
|
||||
throw new EndpointError(`Index '${index}' in '${path}' not found in '${JSON.stringify(value)}'`);
|
||||
}
|
||||
else if (Array.isArray(acc)) {
|
||||
return acc[parseInt(index)];
|
||||
}
|
||||
return acc[index];
|
||||
}, value);
|
||||
25
resources/app/node_modules/@smithy/util-endpoints/dist-es/lib/getAttrPathList.js
generated
vendored
Normal file
25
resources/app/node_modules/@smithy/util-endpoints/dist-es/lib/getAttrPathList.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
import { EndpointError } from "../types";
|
||||
export const 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 EndpointError(`Path: '${path}' does not end with ']'`);
|
||||
}
|
||||
const arrayIndex = part.slice(squareBracketIndex + 1, -1);
|
||||
if (Number.isNaN(parseInt(arrayIndex))) {
|
||||
throw new EndpointError(`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;
|
||||
};
|
||||
9
resources/app/node_modules/@smithy/util-endpoints/dist-es/lib/index.js
generated
vendored
Normal file
9
resources/app/node_modules/@smithy/util-endpoints/dist-es/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export * from "./booleanEquals";
|
||||
export * from "./getAttr";
|
||||
export * from "./isSet";
|
||||
export * from "./isValidHostLabel";
|
||||
export * from "./not";
|
||||
export * from "./parseURL";
|
||||
export * from "./stringEquals";
|
||||
export * from "./substring";
|
||||
export * from "./uriEncode";
|
||||
2
resources/app/node_modules/@smithy/util-endpoints/dist-es/lib/isIpAddress.js
generated
vendored
Normal file
2
resources/app/node_modules/@smithy/util-endpoints/dist-es/lib/isIpAddress.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
const 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}$`);
|
||||
export const isIpAddress = (value) => IP_V4_REGEX.test(value) || (value.startsWith("[") && value.endsWith("]"));
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-es/lib/isSet.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-es/lib/isSet.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export const isSet = (value) => value != null;
|
||||
13
resources/app/node_modules/@smithy/util-endpoints/dist-es/lib/isValidHostLabel.js
generated
vendored
Normal file
13
resources/app/node_modules/@smithy/util-endpoints/dist-es/lib/isValidHostLabel.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
const VALID_HOST_LABEL_REGEX = new RegExp(`^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$`);
|
||||
export const isValidHostLabel = (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;
|
||||
};
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-es/lib/not.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-es/lib/not.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export const not = (value) => !value;
|
||||
51
resources/app/node_modules/@smithy/util-endpoints/dist-es/lib/parseURL.js
generated
vendored
Normal file
51
resources/app/node_modules/@smithy/util-endpoints/dist-es/lib/parseURL.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
import { EndpointURLScheme } from "@smithy/types";
|
||||
import { isIpAddress } from "./isIpAddress";
|
||||
const DEFAULT_PORTS = {
|
||||
[EndpointURLScheme.HTTP]: 80,
|
||||
[EndpointURLScheme.HTTPS]: 443,
|
||||
};
|
||||
export const parseURL = (value) => {
|
||||
const whatwgURL = (() => {
|
||||
try {
|
||||
if (value instanceof URL) {
|
||||
return value;
|
||||
}
|
||||
if (typeof value === "object" && "hostname" in value) {
|
||||
const { hostname, port, protocol = "", path = "", query = {} } = value;
|
||||
const url = new URL(`${protocol}//${hostname}${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(EndpointURLScheme).includes(scheme)) {
|
||||
return null;
|
||||
}
|
||||
const isIp = 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,
|
||||
};
|
||||
};
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-es/lib/stringEquals.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-es/lib/stringEquals.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export const stringEquals = (value1, value2) => value1 === value2;
|
||||
9
resources/app/node_modules/@smithy/util-endpoints/dist-es/lib/substring.js
generated
vendored
Normal file
9
resources/app/node_modules/@smithy/util-endpoints/dist-es/lib/substring.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export const substring = (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);
|
||||
};
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-es/lib/uriEncode.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-es/lib/uriEncode.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export const uriEncode = (value) => encodeURIComponent(value).replace(/[!*'()]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`);
|
||||
37
resources/app/node_modules/@smithy/util-endpoints/dist-es/resolveEndpoint.js
generated
vendored
Normal file
37
resources/app/node_modules/@smithy/util-endpoints/dist-es/resolveEndpoint.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
import { debugId, toDebugString } from "./debug";
|
||||
import { EndpointError } from "./types";
|
||||
import { evaluateRules } from "./utils";
|
||||
export const resolveEndpoint = (ruleSetObject, options) => {
|
||||
const { endpointParams, logger } = options;
|
||||
const { parameters, rules } = ruleSetObject;
|
||||
options.logger?.debug?.(`${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 EndpointError(`Missing required parameter: '${requiredParam}'`);
|
||||
}
|
||||
}
|
||||
const endpoint = evaluateRules(rules, { endpointParams, logger, referenceRecord: {} });
|
||||
if (options.endpointParams?.Endpoint) {
|
||||
try {
|
||||
const givenEndpoint = new URL(options.endpointParams.Endpoint);
|
||||
const { protocol, port } = givenEndpoint;
|
||||
endpoint.url.protocol = protocol;
|
||||
endpoint.url.port = port;
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
}
|
||||
options.logger?.debug?.(`${debugId} Resolved endpoint: ${toDebugString(endpoint)}`);
|
||||
return endpoint;
|
||||
};
|
||||
6
resources/app/node_modules/@smithy/util-endpoints/dist-es/types/EndpointError.js
generated
vendored
Normal file
6
resources/app/node_modules/@smithy/util-endpoints/dist-es/types/EndpointError.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export class EndpointError extends Error {
|
||||
constructor(message) {
|
||||
super(message);
|
||||
this.name = "EndpointError";
|
||||
}
|
||||
}
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-es/types/EndpointFunctions.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-es/types/EndpointFunctions.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-es/types/EndpointRuleObject.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-es/types/EndpointRuleObject.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-es/types/ErrorRuleObject.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-es/types/ErrorRuleObject.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-es/types/RuleSetObject.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-es/types/RuleSetObject.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-es/types/TreeRuleObject.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-es/types/TreeRuleObject.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
7
resources/app/node_modules/@smithy/util-endpoints/dist-es/types/index.js
generated
vendored
Normal file
7
resources/app/node_modules/@smithy/util-endpoints/dist-es/types/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
export * from "./EndpointError";
|
||||
export * from "./EndpointFunctions";
|
||||
export * from "./EndpointRuleObject";
|
||||
export * from "./ErrorRuleObject";
|
||||
export * from "./RuleSetObject";
|
||||
export * from "./TreeRuleObject";
|
||||
export * from "./shared";
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-es/types/shared.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-es/types/shared.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
11
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/callFunction.js
generated
vendored
Normal file
11
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/callFunction.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { customEndpointFunctions } from "./customEndpointFunctions";
|
||||
import { endpointFunctions } from "./endpointFunctions";
|
||||
import { evaluateExpression } from "./evaluateExpression";
|
||||
export const callFunction = ({ 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);
|
||||
};
|
||||
1
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/customEndpointFunctions.js
generated
vendored
Normal file
1
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/customEndpointFunctions.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export const customEndpointFunctions = {};
|
||||
12
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/endpointFunctions.js
generated
vendored
Normal file
12
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/endpointFunctions.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { booleanEquals, getAttr, isSet, isValidHostLabel, not, parseURL, stringEquals, substring, uriEncode, } from "../lib";
|
||||
export const endpointFunctions = {
|
||||
booleanEquals,
|
||||
getAttr,
|
||||
isSet,
|
||||
isValidHostLabel,
|
||||
not,
|
||||
parseURL,
|
||||
stringEquals,
|
||||
substring,
|
||||
uriEncode,
|
||||
};
|
||||
14
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateCondition.js
generated
vendored
Normal file
14
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateCondition.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { debugId, toDebugString } from "../debug";
|
||||
import { EndpointError } from "../types";
|
||||
import { callFunction } from "./callFunction";
|
||||
export const evaluateCondition = ({ assign, ...fnArgs }, options) => {
|
||||
if (assign && assign in options.referenceRecord) {
|
||||
throw new EndpointError(`'${assign}' is already defined in Reference Record.`);
|
||||
}
|
||||
const value = callFunction(fnArgs, options);
|
||||
options.logger?.debug?.(`${debugId} evaluateCondition: ${toDebugString(fnArgs)} = ${toDebugString(value)}`);
|
||||
return {
|
||||
result: value === "" ? true : !!value,
|
||||
...(assign != null && { toAssign: { name: assign, value } }),
|
||||
};
|
||||
};
|
||||
22
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateConditions.js
generated
vendored
Normal file
22
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateConditions.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import { debugId, toDebugString } from "../debug";
|
||||
import { evaluateCondition } from "./evaluateCondition";
|
||||
export const evaluateConditions = (conditions = [], options) => {
|
||||
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;
|
||||
options.logger?.debug?.(`${debugId} assign: ${toAssign.name} := ${toDebugString(toAssign.value)}`);
|
||||
}
|
||||
}
|
||||
return { result: true, referenceRecord: conditionsReferenceRecord };
|
||||
};
|
||||
27
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateEndpointRule.js
generated
vendored
Normal file
27
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateEndpointRule.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import { debugId, toDebugString } from "../debug";
|
||||
import { evaluateConditions } from "./evaluateConditions";
|
||||
import { getEndpointHeaders } from "./getEndpointHeaders";
|
||||
import { getEndpointProperties } from "./getEndpointProperties";
|
||||
import { getEndpointUrl } from "./getEndpointUrl";
|
||||
export const evaluateEndpointRule = (endpointRule, options) => {
|
||||
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;
|
||||
options.logger?.debug?.(`${debugId} Resolving endpoint from template: ${toDebugString(endpoint)}`);
|
||||
return {
|
||||
...(headers != undefined && {
|
||||
headers: getEndpointHeaders(headers, endpointRuleOptions),
|
||||
}),
|
||||
...(properties != undefined && {
|
||||
properties: getEndpointProperties(properties, endpointRuleOptions),
|
||||
}),
|
||||
url: getEndpointUrl(url, endpointRuleOptions),
|
||||
};
|
||||
};
|
||||
14
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateErrorRule.js
generated
vendored
Normal file
14
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateErrorRule.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { EndpointError } from "../types";
|
||||
import { evaluateConditions } from "./evaluateConditions";
|
||||
import { evaluateExpression } from "./evaluateExpression";
|
||||
export const evaluateErrorRule = (errorRule, options) => {
|
||||
const { conditions, error } = errorRule;
|
||||
const { result, referenceRecord } = evaluateConditions(conditions, options);
|
||||
if (!result) {
|
||||
return;
|
||||
}
|
||||
throw new EndpointError(evaluateExpression(error, "Error", {
|
||||
...options,
|
||||
referenceRecord: { ...options.referenceRecord, ...referenceRecord },
|
||||
}));
|
||||
};
|
||||
16
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateExpression.js
generated
vendored
Normal file
16
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateExpression.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { EndpointError } from "../types";
|
||||
import { callFunction } from "./callFunction";
|
||||
import { evaluateTemplate } from "./evaluateTemplate";
|
||||
import { getReferenceValue } from "./getReferenceValue";
|
||||
export const evaluateExpression = (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 EndpointError(`'${keyName}': ${String(obj)} is not a string, function or reference.`);
|
||||
};
|
||||
27
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateRules.js
generated
vendored
Normal file
27
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateRules.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import { EndpointError } from "../types";
|
||||
import { evaluateEndpointRule } from "./evaluateEndpointRule";
|
||||
import { evaluateErrorRule } from "./evaluateErrorRule";
|
||||
import { evaluateTreeRule } from "./evaluateTreeRule";
|
||||
export const evaluateRules = (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 EndpointError(`Unknown endpoint rule: ${rule}`);
|
||||
}
|
||||
}
|
||||
throw new EndpointError(`Rules evaluation failed`);
|
||||
};
|
||||
36
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateTemplate.js
generated
vendored
Normal file
36
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateTemplate.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
import { getAttr } from "../lib";
|
||||
export const 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(getAttr(templateContext[refName], attrName));
|
||||
}
|
||||
else {
|
||||
evaluatedTemplateArr.push(templateContext[parameterName]);
|
||||
}
|
||||
currentIndex = closingBraceIndex + 1;
|
||||
}
|
||||
return evaluatedTemplateArr.join("");
|
||||
};
|
||||
13
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateTreeRule.js
generated
vendored
Normal file
13
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateTreeRule.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import { evaluateConditions } from "./evaluateConditions";
|
||||
import { evaluateRules } from "./evaluateRules";
|
||||
export const evaluateTreeRule = (treeRule, options) => {
|
||||
const { conditions, rules } = treeRule;
|
||||
const { result, referenceRecord } = evaluateConditions(conditions, options);
|
||||
if (!result) {
|
||||
return;
|
||||
}
|
||||
return evaluateRules(rules, {
|
||||
...options,
|
||||
referenceRecord: { ...options.referenceRecord, ...referenceRecord },
|
||||
});
|
||||
};
|
||||
12
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/getEndpointHeaders.js
generated
vendored
Normal file
12
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/getEndpointHeaders.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { EndpointError } from "../types";
|
||||
import { evaluateExpression } from "./evaluateExpression";
|
||||
export const getEndpointHeaders = (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 EndpointError(`Header '${headerKey}' value '${processedExpr}' is not a string`);
|
||||
}
|
||||
return processedExpr;
|
||||
}),
|
||||
}), {});
|
||||
5
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/getEndpointProperties.js
generated
vendored
Normal file
5
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/getEndpointProperties.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { getEndpointProperty } from "./getEndpointProperty";
|
||||
export const getEndpointProperties = (properties, options) => Object.entries(properties).reduce((acc, [propertyKey, propertyVal]) => ({
|
||||
...acc,
|
||||
[propertyKey]: getEndpointProperty(propertyVal, options),
|
||||
}), {});
|
||||
21
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/getEndpointProperty.js
generated
vendored
Normal file
21
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/getEndpointProperty.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import { EndpointError } from "../types";
|
||||
import { evaluateTemplate } from "./evaluateTemplate";
|
||||
import { getEndpointProperties } from "./getEndpointProperties";
|
||||
export const getEndpointProperty = (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 EndpointError(`Unexpected endpoint property: ${property}`);
|
||||
}
|
||||
return getEndpointProperties(property, options);
|
||||
case "boolean":
|
||||
return property;
|
||||
default:
|
||||
throw new EndpointError(`Unexpected endpoint property type: ${typeof property}`);
|
||||
}
|
||||
};
|
||||
15
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/getEndpointUrl.js
generated
vendored
Normal file
15
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/getEndpointUrl.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import { EndpointError } from "../types";
|
||||
import { evaluateExpression } from "./evaluateExpression";
|
||||
export const getEndpointUrl = (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 EndpointError(`Endpoint URL must be a string, got ${typeof expression}`);
|
||||
};
|
||||
7
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/getReferenceValue.js
generated
vendored
Normal file
7
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/getReferenceValue.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
export const getReferenceValue = ({ ref }, options) => {
|
||||
const referenceRecord = {
|
||||
...options.endpointParams,
|
||||
...options.referenceRecord,
|
||||
};
|
||||
return referenceRecord[ref];
|
||||
};
|
||||
2
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/index.js
generated
vendored
Normal file
2
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./customEndpointFunctions";
|
||||
export * from "./evaluateRules";
|
||||
50
resources/app/node_modules/@smithy/util-endpoints/package.json
generated
vendored
Normal file
50
resources/app/node_modules/@smithy/util-endpoints/package.json
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "@smithy/util-endpoints",
|
||||
"version": "2.0.0",
|
||||
"description": "Utilities to help with endpoint resolution.",
|
||||
"main": "./dist-cjs/index.js",
|
||||
"module": "./dist-es/index.js",
|
||||
"author": {
|
||||
"name": "AWS SDK for JavaScript Team",
|
||||
"url": "https://aws.amazon.com/javascript/"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@smithy/node-config-provider": "^3.0.0",
|
||||
"@smithy/types": "^3.0.0",
|
||||
"tslib": "^2.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^16.18.96",
|
||||
"concurrently": "7.0.0",
|
||||
"downlevel-dts": "0.10.1",
|
||||
"rimraf": "3.0.2",
|
||||
"typedoc": "0.23.23"
|
||||
},
|
||||
"types": "./dist-types/index.d.ts",
|
||||
"engines": {
|
||||
"node": ">=16.0.0"
|
||||
},
|
||||
"typesVersions": {
|
||||
"<4.0": {
|
||||
"types/*": [
|
||||
"types/ts3.4/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist-*/**"
|
||||
],
|
||||
"homepage": "https://github.com/awslabs/smithy-typescript/tree/master/packages/util-endpoints",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/awslabs/smithy-typescript.git",
|
||||
"directory": "packages/util-endpoints"
|
||||
},
|
||||
"typedoc": {
|
||||
"entryPoint": "src/index.ts"
|
||||
},
|
||||
"publishConfig": {
|
||||
"directory": ".release/package"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user