@aws-sdk/util-endpoints 3.168.0 → 3.170.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist-cjs/lib/aws/index.js +1 -0
- package/dist-cjs/lib/aws/parseArn.js +4 -2
- package/dist-cjs/lib/parseURL.js +1 -0
- package/dist-cjs/resolveEndpoint.js +8 -8
- package/dist-cjs/utils/callFunction.js +2 -2
- package/dist-cjs/utils/evaluateCondition.js +1 -1
- package/dist-cjs/utils/evaluateTemplate.js +2 -1
- package/dist-cjs/utils/getReferenceValue.js +0 -4
- package/dist-es/lib/aws/index.js +1 -0
- package/dist-es/lib/aws/parseArn.js +4 -2
- package/dist-es/lib/parseURL.js +1 -0
- package/dist-es/resolveEndpoint.js +27 -27
- package/dist-es/utils/callFunction.js +4 -2
- package/dist-es/utils/evaluateCondition.js +1 -1
- package/dist-es/utils/evaluateTemplate.js +2 -1
- package/dist-es/utils/getReferenceValue.js +0 -4
- package/dist-types/lib/aws/index.d.ts +1 -0
- package/dist-types/ts3.4/index.d.ts +2 -2
- package/dist-types/ts3.4/lib/aws/index.d.ts +2 -1
- package/dist-types/ts3.4/lib/aws/parseArn.d.ts +3 -3
- package/dist-types/ts3.4/lib/aws/partition.d.ts +3 -3
- package/dist-types/ts3.4/lib/booleanEquals.d.ts +4 -2
- package/dist-types/ts3.4/lib/getAttr.d.ts +12 -5
- package/dist-types/ts3.4/lib/getAttrPathList.d.ts +1 -2
- package/dist-types/ts3.4/lib/index.d.ts +11 -11
- package/dist-types/ts3.4/lib/isSet.d.ts +1 -2
- package/dist-types/ts3.4/lib/isValidHostLabel.d.ts +4 -2
- package/dist-types/ts3.4/lib/not.d.ts +1 -2
- package/dist-types/ts3.4/lib/parseURL.d.ts +3 -3
- package/dist-types/ts3.4/lib/stringEquals.d.ts +1 -2
- package/dist-types/ts3.4/lib/substring.d.ts +6 -2
- package/dist-types/ts3.4/lib/uriEncode.d.ts +1 -2
- package/dist-types/ts3.4/resolveEndpoint.d.ts +7 -4
- package/dist-types/ts3.4/types/EndpointError.d.ts +3 -3
- package/dist-types/ts3.4/types/EndpointRuleObject.d.ts +18 -15
- package/dist-types/ts3.4/types/ErrorRuleObject.d.ts +7 -7
- package/dist-types/ts3.4/types/RuleSetObject.d.ts +18 -18
- package/dist-types/ts3.4/types/TreeRuleObject.d.ts +12 -10
- package/dist-types/ts3.4/types/index.d.ts +6 -6
- package/dist-types/ts3.4/types/shared.d.ts +29 -25
- package/dist-types/ts3.4/utils/callFunction.d.ts +5 -2
- package/dist-types/ts3.4/utils/evaluateCondition.d.ts +13 -8
- package/dist-types/ts3.4/utils/evaluateConditions.d.ts +13 -8
- package/dist-types/ts3.4/utils/evaluateEndpointRule.d.ts +6 -3
- package/dist-types/ts3.4/utils/evaluateErrorRule.d.ts +5 -2
- package/dist-types/ts3.4/utils/evaluateExpression.d.ts +6 -2
- package/dist-types/ts3.4/utils/evaluateRules.d.ts +6 -3
- package/dist-types/ts3.4/utils/evaluateTemplate.d.ts +5 -2
- package/dist-types/ts3.4/utils/evaluateTreeRule.d.ts +6 -3
- package/dist-types/ts3.4/utils/getEndpointHeaders.d.ts +5 -2
- package/dist-types/ts3.4/utils/getEndpointProperties.d.ts +5 -2
- package/dist-types/ts3.4/utils/getEndpointProperty.d.ts +6 -3
- package/dist-types/ts3.4/utils/getEndpointUrl.d.ts +5 -2
- package/dist-types/ts3.4/utils/getReferenceValue.d.ts +5 -2
- package/dist-types/ts3.4/utils/index.d.ts +1 -1
- package/dist-types/types/shared.d.ts +1 -1
- package/dist-types/utils/evaluateExpression.d.ts +2 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.170.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.169.0...v3.170.0) (2022-09-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **util-endpoints:** call multi-level functions from callFunction ([#3929](https://github.com/aws/aws-sdk-js-v3/issues/3929)) ([1209cb1](https://github.com/aws/aws-sdk-js-v3/commit/1209cb1613891496b3e03e6a61ff87fc721d1ccf))
|
|
12
|
+
* **util-endpoints:** escape tilde when evaluating template ([#3934](https://github.com/aws/aws-sdk-js-v3/issues/3934)) ([5d7ef10](https://github.com/aws/aws-sdk-js-v3/commit/5d7ef10160456b7b872a1e7818dde7d73b4fb714))
|
|
13
|
+
* **util-endpoints:** export parseArn from lib/aws ([#3931](https://github.com/aws/aws-sdk-js-v3/issues/3931)) ([1cee1f4](https://github.com/aws/aws-sdk-js-v3/commit/1cee1f4e41d1a660b4fbb7e06eecc22f2a9a82db))
|
|
14
|
+
* **util-endpoints:** populate default params before checking for required values ([#3928](https://github.com/aws/aws-sdk-js-v3/issues/3928)) ([2561f60](https://github.com/aws/aws-sdk-js-v3/commit/2561f609f76b006bb39794a6cecfb6c0d68f9ef1))
|
|
15
|
+
* **util-endpoints:** return null in parseArn for some empty elements ([#3935](https://github.com/aws/aws-sdk-js-v3/issues/3935)) ([f8bc8b3](https://github.com/aws/aws-sdk-js-v3/commit/f8bc8b3da798cb0c4c4d6fb21e8e88c9109e649b))
|
|
16
|
+
* **util-endpoints:** skip evaluation for arg of type number ([#3936](https://github.com/aws/aws-sdk-js-v3/issues/3936)) ([aecd894](https://github.com/aws/aws-sdk-js-v3/commit/aecd89441ec92fc2be8cb4a3914ca7559e136d7d))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
# [3.168.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.167.0...v3.168.0) (2022-09-09)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @aws-sdk/util-endpoints
|
|
@@ -3,9 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.parseArn = void 0;
|
|
4
4
|
const parseArn = (value) => {
|
|
5
5
|
const segments = value.split(":");
|
|
6
|
-
if (segments.length < 6
|
|
6
|
+
if (segments.length < 6)
|
|
7
|
+
return null;
|
|
8
|
+
const [arn, partition, service, region, accountId, ...resourceId] = segments;
|
|
9
|
+
if (arn !== "arn" || partition === "" || service === "" || resourceId[0] === "")
|
|
7
10
|
return null;
|
|
8
|
-
const [, partition, service, region, accountId, ...resourceId] = segments;
|
|
9
11
|
return {
|
|
10
12
|
partition,
|
|
11
13
|
service,
|
package/dist-cjs/lib/parseURL.js
CHANGED
|
@@ -7,14 +7,6 @@ const resolveEndpoint = (ruleSetObject, options) => {
|
|
|
7
7
|
var _a;
|
|
8
8
|
const { endpointParams, logger } = options;
|
|
9
9
|
const { parameters, rules } = ruleSetObject;
|
|
10
|
-
const requiredParams = Object.entries(parameters)
|
|
11
|
-
.filter(([, v]) => v.required)
|
|
12
|
-
.map(([k]) => k);
|
|
13
|
-
for (const requiredParam of requiredParams) {
|
|
14
|
-
if (endpointParams[requiredParam] == null) {
|
|
15
|
-
throw new types_1.EndpointError(`Missing required parameter: '${requiredParam}'`);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
10
|
const paramsWithDefault = Object.entries(parameters)
|
|
19
11
|
.filter(([, v]) => v.default != null)
|
|
20
12
|
.map(([k, v]) => [k, v.default]);
|
|
@@ -23,6 +15,14 @@ const resolveEndpoint = (ruleSetObject, options) => {
|
|
|
23
15
|
endpointParams[paramKey] = (_a = endpointParams[paramKey]) !== null && _a !== void 0 ? _a : paramDefaultValue;
|
|
24
16
|
}
|
|
25
17
|
}
|
|
18
|
+
const requiredParams = Object.entries(parameters)
|
|
19
|
+
.filter(([, v]) => v.required)
|
|
20
|
+
.map(([k]) => k);
|
|
21
|
+
for (const requiredParam of requiredParams) {
|
|
22
|
+
if (endpointParams[requiredParam] == null) {
|
|
23
|
+
throw new types_1.EndpointError(`Missing required parameter: '${requiredParam}'`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
26
|
return (0, utils_1.evaluateRules)(rules, { endpointParams, logger, referenceRecord: {} });
|
|
27
27
|
};
|
|
28
28
|
exports.resolveEndpoint = resolveEndpoint;
|
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const lib = tslib_1.__importStar(require("../lib"));
|
|
6
6
|
const evaluateExpression_1 = require("./evaluateExpression");
|
|
7
7
|
const callFunction = ({ fn, argv }, options) => {
|
|
8
|
-
const
|
|
9
|
-
return
|
|
8
|
+
const evaluatedArgs = argv.map((arg) => ["boolean", "number"].includes(typeof arg) ? arg : (0, evaluateExpression_1.evaluateExpression)(arg, "arg", options));
|
|
9
|
+
return fn.split(".").reduce((acc, key) => acc[key], lib)(...evaluatedArgs);
|
|
10
10
|
};
|
|
11
11
|
exports.callFunction = callFunction;
|
|
@@ -9,7 +9,7 @@ const evaluateCondition = ({ assign, ...fnArgs }, options) => {
|
|
|
9
9
|
}
|
|
10
10
|
const value = (0, callFunction_1.callFunction)(fnArgs, options);
|
|
11
11
|
return {
|
|
12
|
-
result: !!value,
|
|
12
|
+
result: value === "" ? true : !!value,
|
|
13
13
|
...(assign != null && { toAssign: { name: assign, value } }),
|
|
14
14
|
};
|
|
15
15
|
};
|
|
@@ -22,6 +22,7 @@ const evaluateTemplate = (template, options) => {
|
|
|
22
22
|
const templateWithAttr = Object.entries(attrShortHandMap).reduce((acc, [shortHand, value]) => acc.replace(shortHand, value), templateToEvaluate);
|
|
23
23
|
const templateContextNames = Object.keys(templateContext);
|
|
24
24
|
const templateContextValues = Object.values(templateContext);
|
|
25
|
-
|
|
25
|
+
const templateWithTildeEscaped = templateWithAttr.replace(/\`/g, "\\`");
|
|
26
|
+
return new Function(...templateContextNames, `return \`${templateWithTildeEscaped}\``)(...templateContextValues);
|
|
26
27
|
};
|
|
27
28
|
exports.evaluateTemplate = evaluateTemplate;
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getReferenceValue = void 0;
|
|
4
|
-
const types_1 = require("../types");
|
|
5
4
|
const getReferenceValue = ({ ref }, options) => {
|
|
6
5
|
const referenceRecord = {
|
|
7
6
|
...options.endpointParams,
|
|
8
7
|
...options.referenceRecord,
|
|
9
8
|
};
|
|
10
|
-
if (referenceRecord[ref] == undefined) {
|
|
11
|
-
throw new types_1.EndpointError(`Reference '${ref}' not defined`);
|
|
12
|
-
}
|
|
13
9
|
return referenceRecord[ref];
|
|
14
10
|
};
|
|
15
11
|
exports.getReferenceValue = getReferenceValue;
|
package/dist-es/lib/aws/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { __read } from "tslib";
|
|
2
2
|
export var parseArn = function (value) {
|
|
3
3
|
var segments = value.split(":");
|
|
4
|
-
if (segments.length < 6
|
|
4
|
+
if (segments.length < 6)
|
|
5
|
+
return null;
|
|
6
|
+
var _a = __read(segments), arn = _a[0], partition = _a[1], service = _a[2], region = _a[3], accountId = _a[4], resourceId = _a.slice(5);
|
|
7
|
+
if (arn !== "arn" || partition === "" || service === "" || resourceId[0] === "")
|
|
5
8
|
return null;
|
|
6
|
-
var _a = __read(segments), partition = _a[1], service = _a[2], region = _a[3], accountId = _a[4], resourceId = _a.slice(5);
|
|
7
9
|
return {
|
|
8
10
|
partition: partition,
|
|
9
11
|
service: service,
|
package/dist-es/lib/parseURL.js
CHANGED
|
@@ -6,30 +6,6 @@ export var resolveEndpoint = function (ruleSetObject, options) {
|
|
|
6
6
|
var _c;
|
|
7
7
|
var endpointParams = options.endpointParams, logger = options.logger;
|
|
8
8
|
var parameters = ruleSetObject.parameters, rules = ruleSetObject.rules;
|
|
9
|
-
var requiredParams = Object.entries(parameters)
|
|
10
|
-
.filter(function (_a) {
|
|
11
|
-
var _b = __read(_a, 2), v = _b[1];
|
|
12
|
-
return v.required;
|
|
13
|
-
})
|
|
14
|
-
.map(function (_a) {
|
|
15
|
-
var _b = __read(_a, 1), k = _b[0];
|
|
16
|
-
return k;
|
|
17
|
-
});
|
|
18
|
-
try {
|
|
19
|
-
for (var requiredParams_1 = __values(requiredParams), requiredParams_1_1 = requiredParams_1.next(); !requiredParams_1_1.done; requiredParams_1_1 = requiredParams_1.next()) {
|
|
20
|
-
var requiredParam = requiredParams_1_1.value;
|
|
21
|
-
if (endpointParams[requiredParam] == null) {
|
|
22
|
-
throw new EndpointError("Missing required parameter: '".concat(requiredParam, "'"));
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
27
|
-
finally {
|
|
28
|
-
try {
|
|
29
|
-
if (requiredParams_1_1 && !requiredParams_1_1.done && (_a = requiredParams_1.return)) _a.call(requiredParams_1);
|
|
30
|
-
}
|
|
31
|
-
finally { if (e_1) throw e_1.error; }
|
|
32
|
-
}
|
|
33
9
|
var paramsWithDefault = Object.entries(parameters)
|
|
34
10
|
.filter(function (_a) {
|
|
35
11
|
var _b = __read(_a, 2), v = _b[1];
|
|
@@ -46,13 +22,37 @@ export var resolveEndpoint = function (ruleSetObject, options) {
|
|
|
46
22
|
endpointParams[paramKey] = (_c = endpointParams[paramKey]) !== null && _c !== void 0 ? _c : paramDefaultValue;
|
|
47
23
|
}
|
|
48
24
|
}
|
|
49
|
-
catch (
|
|
25
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
50
26
|
finally {
|
|
51
27
|
try {
|
|
52
|
-
if (paramsWithDefault_1_1 && !paramsWithDefault_1_1.done && (
|
|
28
|
+
if (paramsWithDefault_1_1 && !paramsWithDefault_1_1.done && (_a = paramsWithDefault_1.return)) _a.call(paramsWithDefault_1);
|
|
53
29
|
}
|
|
54
|
-
finally { if (
|
|
30
|
+
finally { if (e_1) throw e_1.error; }
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
var requiredParams = Object.entries(parameters)
|
|
34
|
+
.filter(function (_a) {
|
|
35
|
+
var _b = __read(_a, 2), v = _b[1];
|
|
36
|
+
return v.required;
|
|
37
|
+
})
|
|
38
|
+
.map(function (_a) {
|
|
39
|
+
var _b = __read(_a, 1), k = _b[0];
|
|
40
|
+
return k;
|
|
41
|
+
});
|
|
42
|
+
try {
|
|
43
|
+
for (var requiredParams_1 = __values(requiredParams), requiredParams_1_1 = requiredParams_1.next(); !requiredParams_1_1.done; requiredParams_1_1 = requiredParams_1.next()) {
|
|
44
|
+
var requiredParam = requiredParams_1_1.value;
|
|
45
|
+
if (endpointParams[requiredParam] == null) {
|
|
46
|
+
throw new EndpointError("Missing required parameter: '".concat(requiredParam, "'"));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
51
|
+
finally {
|
|
52
|
+
try {
|
|
53
|
+
if (requiredParams_1_1 && !requiredParams_1_1.done && (_b = requiredParams_1.return)) _b.call(requiredParams_1);
|
|
55
54
|
}
|
|
55
|
+
finally { if (e_2) throw e_2.error; }
|
|
56
56
|
}
|
|
57
57
|
return evaluateRules(rules, { endpointParams: endpointParams, logger: logger, referenceRecord: {} });
|
|
58
58
|
};
|
|
@@ -3,6 +3,8 @@ import * as lib from "../lib";
|
|
|
3
3
|
import { evaluateExpression } from "./evaluateExpression";
|
|
4
4
|
export var callFunction = function (_a, options) {
|
|
5
5
|
var fn = _a.fn, argv = _a.argv;
|
|
6
|
-
var
|
|
7
|
-
|
|
6
|
+
var evaluatedArgs = argv.map(function (arg) {
|
|
7
|
+
return ["boolean", "number"].includes(typeof arg) ? arg : evaluateExpression(arg, "arg", options);
|
|
8
|
+
});
|
|
9
|
+
return fn.split(".").reduce(function (acc, key) { return acc[key]; }, lib).apply(void 0, __spreadArray([], __read(evaluatedArgs), false));
|
|
8
10
|
};
|
|
@@ -7,5 +7,5 @@ export var evaluateCondition = function (_a, options) {
|
|
|
7
7
|
throw new EndpointError("'".concat(assign, "' is already defined in Reference Record."));
|
|
8
8
|
}
|
|
9
9
|
var value = callFunction(fnArgs, options);
|
|
10
|
-
return __assign({ result: !!value }, (assign != null && { toAssign: { name: assign, value: value } }));
|
|
10
|
+
return __assign({ result: value === "" ? true : !!value }, (assign != null && { toAssign: { name: assign, value: value } }));
|
|
11
11
|
};
|
|
@@ -20,5 +20,6 @@ export var evaluateTemplate = function (template, options) {
|
|
|
20
20
|
}, templateToEvaluate);
|
|
21
21
|
var templateContextNames = Object.keys(templateContext);
|
|
22
22
|
var templateContextValues = Object.values(templateContext);
|
|
23
|
-
|
|
23
|
+
var templateWithTildeEscaped = templateWithAttr.replace(/\`/g, "\\`");
|
|
24
|
+
return new (Function.bind.apply(Function, __spreadArray(__spreadArray([void 0], __read(templateContextNames), false), ["return `".concat(templateWithTildeEscaped, "`")], false)))().apply(void 0, __spreadArray([], __read(templateContextValues), false));
|
|
24
25
|
};
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { __assign } from "tslib";
|
|
2
|
-
import { EndpointError } from "../types";
|
|
3
2
|
export var getReferenceValue = function (_a, options) {
|
|
4
3
|
var ref = _a.ref;
|
|
5
4
|
var referenceRecord = __assign(__assign({}, options.endpointParams), options.referenceRecord);
|
|
6
|
-
if (referenceRecord[ref] == undefined) {
|
|
7
|
-
throw new EndpointError("Reference '".concat(ref, "' not defined"));
|
|
8
|
-
}
|
|
9
5
|
return referenceRecord[ref];
|
|
10
6
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./resolveEndpoint";
|
|
2
|
-
export * from "./types";
|
|
1
|
+
export * from "./resolveEndpoint";
|
|
2
|
+
export * from "./types";
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./parseArn";
|
|
2
|
+
export * from "./partition";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { EndpointARN } from "@aws-sdk/types";
|
|
2
|
-
|
|
3
|
-
export declare const parseArn: (value: string) => EndpointARN | null;
|
|
1
|
+
import { EndpointARN } from "@aws-sdk/types";
|
|
2
|
+
|
|
3
|
+
export declare const parseArn: (value: string) => EndpointARN | null;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { EndpointPartition } from "@aws-sdk/types";
|
|
2
|
-
|
|
3
|
-
export declare const partition: (value: string) => EndpointPartition;
|
|
1
|
+
import { EndpointPartition } from "@aws-sdk/types";
|
|
2
|
+
|
|
3
|
+
export declare const partition: (value: string) => EndpointPartition;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
export declare type GetAttrValue =
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export declare type GetAttrValue =
|
|
2
|
+
| string
|
|
3
|
+
| boolean
|
|
4
|
+
| {
|
|
5
|
+
[key: string]: GetAttrValue;
|
|
6
|
+
}
|
|
7
|
+
| Array<GetAttrValue>;
|
|
8
|
+
|
|
9
|
+
export declare const getAttr: (
|
|
10
|
+
value: GetAttrValue,
|
|
11
|
+
path: string
|
|
12
|
+
) => GetAttrValue;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const getAttrPathList: (path: string) => Array<string>;
|
|
1
|
+
export declare const getAttrPathList: (path: string) => Array<string>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as aws_1 from "./aws";
|
|
2
|
-
export { aws_1 as aws };
|
|
3
|
-
export * from "./booleanEquals";
|
|
4
|
-
export * from "./getAttr";
|
|
5
|
-
export * from "./isSet";
|
|
6
|
-
export * from "./isValidHostLabel";
|
|
7
|
-
export * from "./not";
|
|
8
|
-
export * from "./parseURL";
|
|
9
|
-
export * from "./stringEquals";
|
|
10
|
-
export * from "./substring";
|
|
11
|
-
export * from "./uriEncode";
|
|
1
|
+
import * as aws_1 from "./aws";
|
|
2
|
+
export { aws_1 as aws };
|
|
3
|
+
export * from "./booleanEquals";
|
|
4
|
+
export * from "./getAttr";
|
|
5
|
+
export * from "./isSet";
|
|
6
|
+
export * from "./isValidHostLabel";
|
|
7
|
+
export * from "./not";
|
|
8
|
+
export * from "./parseURL";
|
|
9
|
+
export * from "./stringEquals";
|
|
10
|
+
export * from "./substring";
|
|
11
|
+
export * from "./uriEncode";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const isSet: (value: unknown) => boolean;
|
|
1
|
+
export declare const isSet: (value: unknown) => boolean;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const not: (value: boolean) => boolean;
|
|
1
|
+
export declare const not: (value: boolean) => boolean;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { EndpointURL } from "@aws-sdk/types";
|
|
2
|
-
|
|
3
|
-
export declare const parseURL: (value: string) => EndpointURL | null;
|
|
1
|
+
import { EndpointURL } from "@aws-sdk/types";
|
|
2
|
+
|
|
3
|
+
export declare const parseURL: (value: string) => EndpointURL | null;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const stringEquals: (value1: string, value2: string) => boolean;
|
|
1
|
+
export declare const stringEquals: (value1: string, value2: string) => boolean;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const uriEncode: (value: string) => string;
|
|
1
|
+
export declare const uriEncode: (value: string) => string;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { EndpointV2 } from "@aws-sdk/types";
|
|
2
|
-
import { EndpointResolverOptions, RuleSetObject } from "./types";
|
|
3
|
-
|
|
4
|
-
export declare const resolveEndpoint: (
|
|
1
|
+
import { EndpointV2 } from "@aws-sdk/types";
|
|
2
|
+
import { EndpointResolverOptions, RuleSetObject } from "./types";
|
|
3
|
+
|
|
4
|
+
export declare const resolveEndpoint: (
|
|
5
|
+
ruleSetObject: RuleSetObject,
|
|
6
|
+
options: EndpointResolverOptions
|
|
7
|
+
) => EndpointV2;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare class EndpointError extends Error {
|
|
2
|
-
|
|
3
|
-
}
|
|
1
|
+
export declare class EndpointError extends Error {
|
|
2
|
+
constructor(message: string);
|
|
3
|
+
}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import { EndpointObjectProperty } from "@aws-sdk/types";
|
|
2
|
-
import { ConditionObject, Expression } from "./shared";
|
|
3
|
-
export declare type EndpointObjectProperties = Record<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { EndpointObjectProperty } from "@aws-sdk/types";
|
|
2
|
+
import { ConditionObject, Expression } from "./shared";
|
|
3
|
+
export declare type EndpointObjectProperties = Record<
|
|
4
|
+
string,
|
|
5
|
+
EndpointObjectProperty
|
|
6
|
+
>;
|
|
7
|
+
export declare type EndpointObjectHeaders = Record<string, Expression[]>;
|
|
8
|
+
export declare type EndpointObject = {
|
|
9
|
+
url: Expression;
|
|
10
|
+
properties?: EndpointObjectProperties;
|
|
11
|
+
headers?: EndpointObjectHeaders;
|
|
12
|
+
};
|
|
13
|
+
export declare type EndpointRuleObject = {
|
|
14
|
+
type: "endpoint";
|
|
15
|
+
conditions?: ConditionObject[];
|
|
16
|
+
endpoint: EndpointObject;
|
|
17
|
+
documentation?: string;
|
|
18
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ConditionObject, Expression } from "./shared";
|
|
2
|
-
export declare type ErrorRuleObject = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
1
|
+
import { ConditionObject, Expression } from "./shared";
|
|
2
|
+
export declare type ErrorRuleObject = {
|
|
3
|
+
type: "error";
|
|
4
|
+
conditions?: ConditionObject[];
|
|
5
|
+
error: Expression;
|
|
6
|
+
documentation?: string;
|
|
7
|
+
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { RuleSetRules } from "./TreeRuleObject";
|
|
2
|
-
export declare type DeprecatedObject = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
export declare type ParameterObject = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
export declare type RuleSetObject = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
1
|
+
import { RuleSetRules } from "./TreeRuleObject";
|
|
2
|
+
export declare type DeprecatedObject = {
|
|
3
|
+
message?: string;
|
|
4
|
+
since?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare type ParameterObject = {
|
|
7
|
+
type: "string" | "boolean";
|
|
8
|
+
default?: string | boolean;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
documentation?: string;
|
|
11
|
+
deprecated?: DeprecatedObject;
|
|
12
|
+
};
|
|
13
|
+
export declare type RuleSetObject = {
|
|
14
|
+
version: string;
|
|
15
|
+
serviceId: string;
|
|
16
|
+
parameters: Record<string, ParameterObject>;
|
|
17
|
+
rules: RuleSetRules;
|
|
18
|
+
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { EndpointRuleObject } from "./EndpointRuleObject";
|
|
2
|
-
import { ErrorRuleObject } from "./ErrorRuleObject";
|
|
3
|
-
import { ConditionObject } from "./shared";
|
|
4
|
-
export declare type RuleSetRules = Array<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { EndpointRuleObject } from "./EndpointRuleObject";
|
|
2
|
+
import { ErrorRuleObject } from "./ErrorRuleObject";
|
|
3
|
+
import { ConditionObject } from "./shared";
|
|
4
|
+
export declare type RuleSetRules = Array<
|
|
5
|
+
EndpointRuleObject | ErrorRuleObject | TreeRuleObject
|
|
6
|
+
>;
|
|
7
|
+
export declare type TreeRuleObject = {
|
|
8
|
+
type: "tree";
|
|
9
|
+
conditions?: ConditionObject[];
|
|
10
|
+
rules: RuleSetRules;
|
|
11
|
+
documentation?: string;
|
|
12
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from "./EndpointError";
|
|
2
|
-
export * from "./EndpointRuleObject";
|
|
3
|
-
export * from "./ErrorRuleObject";
|
|
4
|
-
export * from "./RuleSetObject";
|
|
5
|
-
export * from "./TreeRuleObject";
|
|
6
|
-
export * from "./shared";
|
|
1
|
+
export * from "./EndpointError";
|
|
2
|
+
export * from "./EndpointRuleObject";
|
|
3
|
+
export * from "./ErrorRuleObject";
|
|
4
|
+
export * from "./RuleSetObject";
|
|
5
|
+
export * from "./TreeRuleObject";
|
|
6
|
+
export * from "./shared";
|
|
@@ -1,25 +1,29 @@
|
|
|
1
|
-
import { Logger } from "@aws-sdk/types";
|
|
2
|
-
export declare type ReferenceObject = {
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
export declare type FunctionObject = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
export declare type FunctionArgv = Array<
|
|
10
|
-
export declare type FunctionReturn =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export declare type
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export declare type
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
1
|
+
import { Logger } from "@aws-sdk/types";
|
|
2
|
+
export declare type ReferenceObject = {
|
|
3
|
+
ref: string;
|
|
4
|
+
};
|
|
5
|
+
export declare type FunctionObject = {
|
|
6
|
+
fn: string;
|
|
7
|
+
argv: FunctionArgv;
|
|
8
|
+
};
|
|
9
|
+
export declare type FunctionArgv = Array<Expression | boolean | number>;
|
|
10
|
+
export declare type FunctionReturn =
|
|
11
|
+
| string
|
|
12
|
+
| boolean
|
|
13
|
+
| number
|
|
14
|
+
| {
|
|
15
|
+
[key: string]: FunctionReturn;
|
|
16
|
+
};
|
|
17
|
+
export declare type ConditionObject = FunctionObject & {
|
|
18
|
+
assign?: string;
|
|
19
|
+
};
|
|
20
|
+
export declare type Expression = string | ReferenceObject | FunctionObject;
|
|
21
|
+
export declare type EndpointParams = Record<string, string | boolean>;
|
|
22
|
+
export declare type EndpointResolverOptions = {
|
|
23
|
+
endpointParams: EndpointParams;
|
|
24
|
+
logger?: Logger;
|
|
25
|
+
};
|
|
26
|
+
export declare type ReferenceRecord = Record<string, FunctionReturn>;
|
|
27
|
+
export declare type EvaluateOptions = EndpointResolverOptions & {
|
|
28
|
+
referenceRecord: ReferenceRecord;
|
|
29
|
+
};
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import { EvaluateOptions, FunctionObject, FunctionReturn } from "../types";
|
|
2
|
-
export declare const callFunction: (
|
|
1
|
+
import { EvaluateOptions, FunctionObject, FunctionReturn } from "../types";
|
|
2
|
+
export declare const callFunction: (
|
|
3
|
+
{ fn, argv }: FunctionObject,
|
|
4
|
+
options: EvaluateOptions
|
|
5
|
+
) => FunctionReturn;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import { ConditionObject, EvaluateOptions } from "../types";
|
|
2
|
-
export declare const evaluateCondition: (
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { ConditionObject, EvaluateOptions } from "../types";
|
|
2
|
+
export declare const evaluateCondition: (
|
|
3
|
+
{ assign, ...fnArgs }: ConditionObject,
|
|
4
|
+
options: EvaluateOptions
|
|
5
|
+
) => {
|
|
6
|
+
toAssign?:
|
|
7
|
+
| {
|
|
8
|
+
name: string;
|
|
9
|
+
value: import("../types").FunctionReturn;
|
|
10
|
+
}
|
|
11
|
+
| undefined;
|
|
12
|
+
result: boolean;
|
|
13
|
+
};
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import { ConditionObject, EvaluateOptions, FunctionReturn } from "../types";
|
|
2
|
-
export declare const evaluateConditions: (
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { ConditionObject, EvaluateOptions, FunctionReturn } from "../types";
|
|
2
|
+
export declare const evaluateConditions: (
|
|
3
|
+
conditions: ConditionObject[] | undefined,
|
|
4
|
+
options: EvaluateOptions
|
|
5
|
+
) =>
|
|
6
|
+
| {
|
|
7
|
+
result: false;
|
|
8
|
+
referenceRecord?: undefined;
|
|
9
|
+
}
|
|
10
|
+
| {
|
|
11
|
+
result: boolean;
|
|
12
|
+
referenceRecord: Record<string, FunctionReturn>;
|
|
13
|
+
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import { EndpointV2 } from "@aws-sdk/types";
|
|
2
|
-
import { EndpointRuleObject, EvaluateOptions } from "../types";
|
|
3
|
-
export declare const evaluateEndpointRule: (
|
|
1
|
+
import { EndpointV2 } from "@aws-sdk/types";
|
|
2
|
+
import { EndpointRuleObject, EvaluateOptions } from "../types";
|
|
3
|
+
export declare const evaluateEndpointRule: (
|
|
4
|
+
endpointRule: EndpointRuleObject,
|
|
5
|
+
options: EvaluateOptions
|
|
6
|
+
) => EndpointV2 | undefined;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import { ErrorRuleObject, EvaluateOptions } from "../types";
|
|
2
|
-
export declare const evaluateErrorRule: (
|
|
1
|
+
import { ErrorRuleObject, EvaluateOptions } from "../types";
|
|
2
|
+
export declare const evaluateErrorRule: (
|
|
3
|
+
errorRule: ErrorRuleObject,
|
|
4
|
+
options: EvaluateOptions
|
|
5
|
+
) => void;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import { EvaluateOptions,
|
|
2
|
-
export declare const evaluateExpression: (
|
|
1
|
+
import { EvaluateOptions, Expression } from "../types";
|
|
2
|
+
export declare const evaluateExpression: (
|
|
3
|
+
obj: Expression,
|
|
4
|
+
keyName: string,
|
|
5
|
+
options: EvaluateOptions
|
|
6
|
+
) => any;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import { EndpointV2 } from "@aws-sdk/types";
|
|
2
|
-
import { EvaluateOptions, RuleSetRules } from "../types";
|
|
3
|
-
export declare const evaluateRules: (
|
|
1
|
+
import { EndpointV2 } from "@aws-sdk/types";
|
|
2
|
+
import { EvaluateOptions, RuleSetRules } from "../types";
|
|
3
|
+
export declare const evaluateRules: (
|
|
4
|
+
rules: RuleSetRules,
|
|
5
|
+
options: EvaluateOptions
|
|
6
|
+
) => EndpointV2;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import { EvaluateOptions } from "../types";
|
|
2
|
-
export declare const evaluateTemplate: (
|
|
1
|
+
import { EvaluateOptions } from "../types";
|
|
2
|
+
export declare const evaluateTemplate: (
|
|
3
|
+
template: string,
|
|
4
|
+
options: EvaluateOptions
|
|
5
|
+
) => any;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import { EndpointV2 } from "@aws-sdk/types";
|
|
2
|
-
import { EvaluateOptions, TreeRuleObject } from "../types";
|
|
3
|
-
export declare const evaluateTreeRule: (
|
|
1
|
+
import { EndpointV2 } from "@aws-sdk/types";
|
|
2
|
+
import { EvaluateOptions, TreeRuleObject } from "../types";
|
|
3
|
+
export declare const evaluateTreeRule: (
|
|
4
|
+
treeRule: TreeRuleObject,
|
|
5
|
+
options: EvaluateOptions
|
|
6
|
+
) => EndpointV2 | undefined;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import { EndpointObjectHeaders, EvaluateOptions } from "../types";
|
|
2
|
-
export declare const getEndpointHeaders: (
|
|
1
|
+
import { EndpointObjectHeaders, EvaluateOptions } from "../types";
|
|
2
|
+
export declare const getEndpointHeaders: (
|
|
3
|
+
headers: EndpointObjectHeaders,
|
|
4
|
+
options: EvaluateOptions
|
|
5
|
+
) => {};
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import { EndpointObjectProperties, EvaluateOptions } from "../types";
|
|
2
|
-
export declare const getEndpointProperties: (
|
|
1
|
+
import { EndpointObjectProperties, EvaluateOptions } from "../types";
|
|
2
|
+
export declare const getEndpointProperties: (
|
|
3
|
+
properties: EndpointObjectProperties,
|
|
4
|
+
options: EvaluateOptions
|
|
5
|
+
) => {};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import { EndpointObjectProperty } from "@aws-sdk/types";
|
|
2
|
-
import { EvaluateOptions } from "../types";
|
|
3
|
-
export declare const getEndpointProperty: (
|
|
1
|
+
import { EndpointObjectProperty } from "@aws-sdk/types";
|
|
2
|
+
import { EvaluateOptions } from "../types";
|
|
3
|
+
export declare const getEndpointProperty: (
|
|
4
|
+
property: EndpointObjectProperty,
|
|
5
|
+
options: EvaluateOptions
|
|
6
|
+
) => EndpointObjectProperty;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import { EvaluateOptions, Expression } from "../types";
|
|
2
|
-
export declare const getEndpointUrl: (
|
|
1
|
+
import { EvaluateOptions, Expression } from "../types";
|
|
2
|
+
export declare const getEndpointUrl: (
|
|
3
|
+
endpointUrl: Expression,
|
|
4
|
+
options: EvaluateOptions
|
|
5
|
+
) => URL;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import { EvaluateOptions, ReferenceObject } from "../types";
|
|
2
|
-
export declare const getReferenceValue: (
|
|
1
|
+
import { EvaluateOptions, ReferenceObject } from "../types";
|
|
2
|
+
export declare const getReferenceValue: (
|
|
3
|
+
{ ref }: ReferenceObject,
|
|
4
|
+
options: EvaluateOptions
|
|
5
|
+
) => import("../types").FunctionReturn;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./evaluateRules";
|
|
1
|
+
export * from "./evaluateRules";
|
|
@@ -6,7 +6,7 @@ export declare type FunctionObject = {
|
|
|
6
6
|
fn: string;
|
|
7
7
|
argv: FunctionArgv;
|
|
8
8
|
};
|
|
9
|
-
export declare type FunctionArgv = Array<
|
|
9
|
+
export declare type FunctionArgv = Array<Expression | boolean | number>;
|
|
10
10
|
export declare type FunctionReturn = string | boolean | number | {
|
|
11
11
|
[key: string]: FunctionReturn;
|
|
12
12
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { EvaluateOptions,
|
|
2
|
-
export declare const evaluateExpression: (obj:
|
|
1
|
+
import { EvaluateOptions, Expression } from "../types";
|
|
2
|
+
export declare const evaluateExpression: (obj: Expression, keyName: string, options: EvaluateOptions) => any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/util-endpoints",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.170.0",
|
|
4
4
|
"description": "Utilities to help with endpoint resolution",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"license": "Apache-2.0",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@aws-sdk/types": "3.
|
|
24
|
+
"@aws-sdk/types": "3.170.0",
|
|
25
25
|
"tslib": "^2.3.1"
|
|
26
26
|
},
|
|
27
27
|
"engines": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@tsconfig/recommended": "1.0.1",
|
|
48
48
|
"concurrently": "7.0.0",
|
|
49
|
-
"downlevel-dts": "0.
|
|
49
|
+
"downlevel-dts": "0.10.1",
|
|
50
50
|
"rimraf": "3.0.2",
|
|
51
51
|
"typedoc": "0.19.2",
|
|
52
52
|
"typescript": "~4.6.2"
|