@aws-sdk/util-endpoints 3.167.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.
Files changed (68) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist-cjs/lib/aws/index.js +5 -0
  3. package/dist-cjs/lib/aws/parseArn.js +19 -0
  4. package/dist-cjs/lib/aws/partition.js +37 -0
  5. package/dist-cjs/lib/aws/partitions.json +92 -0
  6. package/dist-cjs/lib/index.js +2 -0
  7. package/dist-cjs/lib/parseURL.js +1 -0
  8. package/dist-cjs/resolveEndpoint.js +8 -8
  9. package/dist-cjs/utils/callFunction.js +2 -2
  10. package/dist-cjs/utils/evaluateCondition.js +1 -1
  11. package/dist-cjs/utils/evaluateTemplate.js +2 -1
  12. package/dist-cjs/utils/getReferenceValue.js +0 -4
  13. package/dist-es/lib/aws/index.js +2 -0
  14. package/dist-es/lib/aws/parseArn.js +16 -0
  15. package/dist-es/lib/aws/partition.js +55 -0
  16. package/dist-es/lib/aws/partitions.json +92 -0
  17. package/dist-es/lib/index.js +1 -0
  18. package/dist-es/lib/parseURL.js +1 -0
  19. package/dist-es/resolveEndpoint.js +27 -27
  20. package/dist-es/utils/callFunction.js +4 -2
  21. package/dist-es/utils/evaluateCondition.js +1 -1
  22. package/dist-es/utils/evaluateTemplate.js +2 -1
  23. package/dist-es/utils/getReferenceValue.js +0 -4
  24. package/dist-types/lib/aws/index.d.ts +2 -0
  25. package/dist-types/lib/aws/parseArn.d.ts +7 -0
  26. package/dist-types/lib/aws/partition.d.ts +8 -0
  27. package/dist-types/lib/index.d.ts +1 -0
  28. package/dist-types/ts3.4/index.d.ts +2 -2
  29. package/dist-types/ts3.4/lib/aws/index.d.ts +2 -0
  30. package/dist-types/ts3.4/lib/aws/parseArn.d.ts +3 -0
  31. package/dist-types/ts3.4/lib/aws/partition.d.ts +3 -0
  32. package/dist-types/ts3.4/lib/booleanEquals.d.ts +4 -2
  33. package/dist-types/ts3.4/lib/getAttr.d.ts +12 -5
  34. package/dist-types/ts3.4/lib/getAttrPathList.d.ts +1 -2
  35. package/dist-types/ts3.4/lib/index.d.ts +11 -9
  36. package/dist-types/ts3.4/lib/isSet.d.ts +1 -2
  37. package/dist-types/ts3.4/lib/isValidHostLabel.d.ts +4 -2
  38. package/dist-types/ts3.4/lib/not.d.ts +1 -2
  39. package/dist-types/ts3.4/lib/parseURL.d.ts +3 -3
  40. package/dist-types/ts3.4/lib/stringEquals.d.ts +1 -2
  41. package/dist-types/ts3.4/lib/substring.d.ts +6 -2
  42. package/dist-types/ts3.4/lib/uriEncode.d.ts +1 -2
  43. package/dist-types/ts3.4/resolveEndpoint.d.ts +7 -4
  44. package/dist-types/ts3.4/types/EndpointError.d.ts +3 -3
  45. package/dist-types/ts3.4/types/EndpointRuleObject.d.ts +18 -15
  46. package/dist-types/ts3.4/types/ErrorRuleObject.d.ts +7 -7
  47. package/dist-types/ts3.4/types/RuleSetObject.d.ts +18 -18
  48. package/dist-types/ts3.4/types/TreeRuleObject.d.ts +12 -10
  49. package/dist-types/ts3.4/types/index.d.ts +6 -6
  50. package/dist-types/ts3.4/types/shared.d.ts +29 -25
  51. package/dist-types/ts3.4/utils/callFunction.d.ts +5 -2
  52. package/dist-types/ts3.4/utils/evaluateCondition.d.ts +13 -8
  53. package/dist-types/ts3.4/utils/evaluateConditions.d.ts +13 -8
  54. package/dist-types/ts3.4/utils/evaluateEndpointRule.d.ts +6 -3
  55. package/dist-types/ts3.4/utils/evaluateErrorRule.d.ts +5 -2
  56. package/dist-types/ts3.4/utils/evaluateExpression.d.ts +6 -2
  57. package/dist-types/ts3.4/utils/evaluateRules.d.ts +6 -3
  58. package/dist-types/ts3.4/utils/evaluateTemplate.d.ts +5 -2
  59. package/dist-types/ts3.4/utils/evaluateTreeRule.d.ts +6 -3
  60. package/dist-types/ts3.4/utils/getEndpointHeaders.d.ts +5 -2
  61. package/dist-types/ts3.4/utils/getEndpointProperties.d.ts +5 -2
  62. package/dist-types/ts3.4/utils/getEndpointProperty.d.ts +6 -3
  63. package/dist-types/ts3.4/utils/getEndpointUrl.d.ts +5 -2
  64. package/dist-types/ts3.4/utils/getReferenceValue.d.ts +5 -2
  65. package/dist-types/ts3.4/utils/index.d.ts +1 -1
  66. package/dist-types/types/shared.d.ts +1 -1
  67. package/dist-types/utils/evaluateExpression.d.ts +2 -2
  68. package/package.json +4 -3
package/CHANGELOG.md CHANGED
@@ -3,6 +3,30 @@
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
+
22
+ # [3.168.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.167.0...v3.168.0) (2022-09-09)
23
+
24
+ **Note:** Version bump only for package @aws-sdk/util-endpoints
25
+
26
+
27
+
28
+
29
+
6
30
  # [3.167.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.166.0...v3.167.0) (2022-09-08)
7
31
 
8
32
  **Note:** Version bump only for package @aws-sdk/util-endpoints
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./parseArn"), exports);
5
+ tslib_1.__exportStar(require("./partition"), exports);
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseArn = void 0;
4
+ const parseArn = (value) => {
5
+ const segments = value.split(":");
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] === "")
10
+ return null;
11
+ return {
12
+ partition,
13
+ service,
14
+ region,
15
+ accountId,
16
+ resourceId: resourceId[0].includes("/") ? resourceId[0].split("/") : resourceId,
17
+ };
18
+ };
19
+ exports.parseArn = parseArn;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.partition = void 0;
4
+ const partitions_json_1 = require("./partitions.json");
5
+ const DEFAULT_PARTITION = partitions_json_1.partitions.find((partition) => partition.id === "aws");
6
+ const partition = (value) => {
7
+ for (const partition of partitions_json_1.partitions) {
8
+ const { id, regions, outputs } = partition;
9
+ for (const [region, regionData] of Object.entries(regions)) {
10
+ if (region === value) {
11
+ return {
12
+ name: id,
13
+ ...outputs,
14
+ ...regionData,
15
+ };
16
+ }
17
+ }
18
+ }
19
+ for (const partition of partitions_json_1.partitions) {
20
+ const { id, regionRegex, outputs } = partition;
21
+ if (new RegExp(regionRegex).test(value)) {
22
+ return {
23
+ name: id,
24
+ ...outputs,
25
+ };
26
+ }
27
+ }
28
+ if (!DEFAULT_PARTITION) {
29
+ throw new Error("Provided region was not found in the partition array or regex," +
30
+ " and default partition with id 'aws' doesn't exist.");
31
+ }
32
+ return {
33
+ name: DEFAULT_PARTITION.id,
34
+ ...DEFAULT_PARTITION.outputs,
35
+ };
36
+ };
37
+ exports.partition = partition;
@@ -0,0 +1,92 @@
1
+ {
2
+ "version": "1.1",
3
+ "partitions": [
4
+ {
5
+ "id": "aws",
6
+ "regionRegex": "^(us|eu|ap|sa|ca|me|af)-\\w+-\\d+$",
7
+ "regions": {
8
+ "af-south-1": {},
9
+ "af-east-1": {},
10
+ "ap-northeast-1": {},
11
+ "ap-northeast-2": {},
12
+ "ap-northeast-3": {},
13
+ "ap-south-1": {},
14
+ "ap-southeast-1": {},
15
+ "ap-southeast-2": {},
16
+ "ap-southeast-3": {},
17
+ "ca-central-1": {},
18
+ "eu-central-1": {},
19
+ "eu-north-1": {},
20
+ "eu-south-1": {},
21
+ "eu-west-1": {},
22
+ "eu-west-2": {},
23
+ "eu-west-3": {},
24
+ "me-south-1": {},
25
+ "sa-east-1": {},
26
+ "us-east-1": {},
27
+ "us-east-2": {},
28
+ "us-west-1": {},
29
+ "us-west-2": {},
30
+ "aws-global": {}
31
+ },
32
+ "outputs": {
33
+ "dnsSuffix": "amazonaws.com",
34
+ "dualStackDnsSuffix": "api.aws",
35
+ "supportsFIPS": true,
36
+ "supportsDualStack": true
37
+ }
38
+ },
39
+ {
40
+ "id": "aws-us-gov",
41
+ "regionRegex": "^us\\-gov\\-\\w+\\-\\d+$",
42
+ "regions": {
43
+ "us-gov-west-1": {},
44
+ "us-gov-east-1": {},
45
+ "aws-us-gov-global": {}
46
+ },
47
+ "outputs": {
48
+ "dnsSuffix": "amazonaws.com",
49
+ "dualStackDnsSuffix": "api.aws",
50
+ "supportsFIPS": true,
51
+ "supportsDualStack": true
52
+ }
53
+ },
54
+ {
55
+ "id": "aws-cn",
56
+ "regionRegex": "^cn\\-\\w+\\-\\d+$",
57
+ "regions": {
58
+ "cn-north-1": {},
59
+ "cn-northwest-1": {},
60
+ "aws-cn-global": {}
61
+ },
62
+ "outputs": {
63
+ "dnsSuffix": "amazonaws.com.cn",
64
+ "dualStackDnsSuffix": "api.amazonwebservices.com.cn",
65
+ "supportsFIPS": true,
66
+ "supportsDualStack": true
67
+ }
68
+ },
69
+ {
70
+ "id": "aws-iso",
71
+ "regionRegex": "^us\\-iso\\-\\w+\\-\\d+$",
72
+ "outputs": {
73
+ "dnsSuffix": "c2s.ic.gov",
74
+ "supportsFIPS": true,
75
+ "supportsDualStack": false,
76
+ "dualStackDnsSuffix": "c2s.ic.gov"
77
+ },
78
+ "regions": {}
79
+ },
80
+ {
81
+ "id": "aws-iso-b",
82
+ "regionRegex": "^us\\-isob\\-\\w+\\-\\d+$",
83
+ "outputs": {
84
+ "dnsSuffix": "sc2s.sgov.gov",
85
+ "supportsFIPS": true,
86
+ "supportsDualStack": false,
87
+ "dualStackDnsSuffix": "sc2s.sgov.gov"
88
+ },
89
+ "regions": {}
90
+ }
91
+ ]
92
+ }
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.aws = void 0;
3
4
  const tslib_1 = require("tslib");
5
+ exports.aws = tslib_1.__importStar(require("./aws"));
4
6
  tslib_1.__exportStar(require("./booleanEquals"), exports);
5
7
  tslib_1.__exportStar(require("./getAttr"), exports);
6
8
  tslib_1.__exportStar(require("./isSet"), exports);
@@ -33,6 +33,7 @@ const parseURL = (value) => {
33
33
  scheme,
34
34
  authority,
35
35
  path: pathname,
36
+ normalizedPath: pathname.endsWith("/") ? pathname : `${pathname}/`,
36
37
  isIp,
37
38
  };
38
39
  };
@@ -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 argvArray = argv.map((arg) => (typeof arg === "boolean" ? arg : (0, evaluateExpression_1.evaluateExpression)(arg, "arg", options)));
9
- return lib[fn](...argvArray);
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
- return new Function(...templateContextNames, `return \`${templateWithAttr}\``)(...templateContextValues);
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;
@@ -0,0 +1,2 @@
1
+ export * from "./parseArn";
2
+ export * from "./partition";
@@ -0,0 +1,16 @@
1
+ import { __read } from "tslib";
2
+ export var parseArn = function (value) {
3
+ var segments = value.split(":");
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] === "")
8
+ return null;
9
+ return {
10
+ partition: partition,
11
+ service: service,
12
+ region: region,
13
+ accountId: accountId,
14
+ resourceId: resourceId[0].includes("/") ? resourceId[0].split("/") : resourceId,
15
+ };
16
+ };
@@ -0,0 +1,55 @@
1
+ import { __assign, __read, __values } from "tslib";
2
+ import { partitions } from "./partitions.json";
3
+ var DEFAULT_PARTITION = partitions.find(function (partition) { return partition.id === "aws"; });
4
+ export var partition = function (value) {
5
+ var e_1, _a, e_2, _b, e_3, _c;
6
+ try {
7
+ for (var partitions_1 = __values(partitions), partitions_1_1 = partitions_1.next(); !partitions_1_1.done; partitions_1_1 = partitions_1.next()) {
8
+ var partition_1 = partitions_1_1.value;
9
+ var id = partition_1.id, regions = partition_1.regions, outputs = partition_1.outputs;
10
+ try {
11
+ for (var _d = (e_2 = void 0, __values(Object.entries(regions))), _e = _d.next(); !_e.done; _e = _d.next()) {
12
+ var _f = __read(_e.value, 2), region = _f[0], regionData = _f[1];
13
+ if (region === value) {
14
+ return __assign(__assign({ name: id }, outputs), regionData);
15
+ }
16
+ }
17
+ }
18
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
19
+ finally {
20
+ try {
21
+ if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
22
+ }
23
+ finally { if (e_2) throw e_2.error; }
24
+ }
25
+ }
26
+ }
27
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
28
+ finally {
29
+ try {
30
+ if (partitions_1_1 && !partitions_1_1.done && (_a = partitions_1.return)) _a.call(partitions_1);
31
+ }
32
+ finally { if (e_1) throw e_1.error; }
33
+ }
34
+ try {
35
+ for (var partitions_2 = __values(partitions), partitions_2_1 = partitions_2.next(); !partitions_2_1.done; partitions_2_1 = partitions_2.next()) {
36
+ var partition_2 = partitions_2_1.value;
37
+ var id = partition_2.id, regionRegex = partition_2.regionRegex, outputs = partition_2.outputs;
38
+ if (new RegExp(regionRegex).test(value)) {
39
+ return __assign({ name: id }, outputs);
40
+ }
41
+ }
42
+ }
43
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
44
+ finally {
45
+ try {
46
+ if (partitions_2_1 && !partitions_2_1.done && (_c = partitions_2.return)) _c.call(partitions_2);
47
+ }
48
+ finally { if (e_3) throw e_3.error; }
49
+ }
50
+ if (!DEFAULT_PARTITION) {
51
+ throw new Error("Provided region was not found in the partition array or regex," +
52
+ " and default partition with id 'aws' doesn't exist.");
53
+ }
54
+ return __assign({ name: DEFAULT_PARTITION.id }, DEFAULT_PARTITION.outputs);
55
+ };
@@ -0,0 +1,92 @@
1
+ {
2
+ "version": "1.1",
3
+ "partitions": [
4
+ {
5
+ "id": "aws",
6
+ "regionRegex": "^(us|eu|ap|sa|ca|me|af)-\\w+-\\d+$",
7
+ "regions": {
8
+ "af-south-1": {},
9
+ "af-east-1": {},
10
+ "ap-northeast-1": {},
11
+ "ap-northeast-2": {},
12
+ "ap-northeast-3": {},
13
+ "ap-south-1": {},
14
+ "ap-southeast-1": {},
15
+ "ap-southeast-2": {},
16
+ "ap-southeast-3": {},
17
+ "ca-central-1": {},
18
+ "eu-central-1": {},
19
+ "eu-north-1": {},
20
+ "eu-south-1": {},
21
+ "eu-west-1": {},
22
+ "eu-west-2": {},
23
+ "eu-west-3": {},
24
+ "me-south-1": {},
25
+ "sa-east-1": {},
26
+ "us-east-1": {},
27
+ "us-east-2": {},
28
+ "us-west-1": {},
29
+ "us-west-2": {},
30
+ "aws-global": {}
31
+ },
32
+ "outputs": {
33
+ "dnsSuffix": "amazonaws.com",
34
+ "dualStackDnsSuffix": "api.aws",
35
+ "supportsFIPS": true,
36
+ "supportsDualStack": true
37
+ }
38
+ },
39
+ {
40
+ "id": "aws-us-gov",
41
+ "regionRegex": "^us\\-gov\\-\\w+\\-\\d+$",
42
+ "regions": {
43
+ "us-gov-west-1": {},
44
+ "us-gov-east-1": {},
45
+ "aws-us-gov-global": {}
46
+ },
47
+ "outputs": {
48
+ "dnsSuffix": "amazonaws.com",
49
+ "dualStackDnsSuffix": "api.aws",
50
+ "supportsFIPS": true,
51
+ "supportsDualStack": true
52
+ }
53
+ },
54
+ {
55
+ "id": "aws-cn",
56
+ "regionRegex": "^cn\\-\\w+\\-\\d+$",
57
+ "regions": {
58
+ "cn-north-1": {},
59
+ "cn-northwest-1": {},
60
+ "aws-cn-global": {}
61
+ },
62
+ "outputs": {
63
+ "dnsSuffix": "amazonaws.com.cn",
64
+ "dualStackDnsSuffix": "api.amazonwebservices.com.cn",
65
+ "supportsFIPS": true,
66
+ "supportsDualStack": true
67
+ }
68
+ },
69
+ {
70
+ "id": "aws-iso",
71
+ "regionRegex": "^us\\-iso\\-\\w+\\-\\d+$",
72
+ "outputs": {
73
+ "dnsSuffix": "c2s.ic.gov",
74
+ "supportsFIPS": true,
75
+ "supportsDualStack": false,
76
+ "dualStackDnsSuffix": "c2s.ic.gov"
77
+ },
78
+ "regions": {}
79
+ },
80
+ {
81
+ "id": "aws-iso-b",
82
+ "regionRegex": "^us\\-isob\\-\\w+\\-\\d+$",
83
+ "outputs": {
84
+ "dnsSuffix": "sc2s.sgov.gov",
85
+ "supportsFIPS": true,
86
+ "supportsDualStack": false,
87
+ "dualStackDnsSuffix": "sc2s.sgov.gov"
88
+ },
89
+ "regions": {}
90
+ }
91
+ ]
92
+ }
@@ -1,3 +1,4 @@
1
+ export * as aws from "./aws";
1
2
  export * from "./booleanEquals";
2
3
  export * from "./getAttr";
3
4
  export * from "./isSet";
@@ -31,6 +31,7 @@ export var parseURL = function (value) {
31
31
  scheme: scheme,
32
32
  authority: authority,
33
33
  path: pathname,
34
+ normalizedPath: pathname.endsWith("/") ? pathname : "".concat(pathname, "/"),
34
35
  isIp: isIp,
35
36
  };
36
37
  };
@@ -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 (e_2_1) { e_2 = { error: e_2_1 }; }
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 && (_b = paramsWithDefault_1.return)) _b.call(paramsWithDefault_1);
28
+ if (paramsWithDefault_1_1 && !paramsWithDefault_1_1.done && (_a = paramsWithDefault_1.return)) _a.call(paramsWithDefault_1);
53
29
  }
54
- finally { if (e_2) throw e_2.error; }
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 argvArray = argv.map(function (arg) { return (typeof arg === "boolean" ? arg : evaluateExpression(arg, "arg", options)); });
7
- return lib[fn].apply(lib, __spreadArray([], __read(argvArray), false));
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
- return new (Function.bind.apply(Function, __spreadArray(__spreadArray([void 0], __read(templateContextNames), false), ["return `".concat(templateWithAttr, "`")], false)))().apply(void 0, __spreadArray([], __read(templateContextValues), false));
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
  };
@@ -0,0 +1,2 @@
1
+ export * from "./parseArn";
2
+ export * from "./partition";
@@ -0,0 +1,7 @@
1
+ import { EndpointARN } from "@aws-sdk/types";
2
+ /**
3
+ * Evaluates a single string argument value, and returns an object containing
4
+ * details about the parsed ARN.
5
+ * If the input was not a valid ARN, the function returns null.
6
+ */
7
+ export declare const parseArn: (value: string) => EndpointARN | null;
@@ -0,0 +1,8 @@
1
+ import { EndpointPartition } from "@aws-sdk/types";
2
+ /**
3
+ * Evaluates a single string argument value as a region, and matches the
4
+ * string value to an AWS partition.
5
+ * The matcher MUST always return a successful object describing the partition
6
+ * that the region has been determined to be a part of.
7
+ */
8
+ export declare const partition: (value: string) => EndpointPartition;
@@ -1,3 +1,4 @@
1
+ export * as aws from "./aws";
1
2
  export * from "./booleanEquals";
2
3
  export * from "./getAttr";
3
4
  export * from "./isSet";
@@ -1,2 +1,2 @@
1
- export * from "./resolveEndpoint";
2
- export * from "./types";
1
+ export * from "./resolveEndpoint";
2
+ export * from "./types";
@@ -0,0 +1,2 @@
1
+ export * from "./parseArn";
2
+ export * from "./partition";
@@ -0,0 +1,3 @@
1
+ import { EndpointARN } from "@aws-sdk/types";
2
+
3
+ export declare const parseArn: (value: string) => EndpointARN | null;
@@ -0,0 +1,3 @@
1
+ import { EndpointPartition } from "@aws-sdk/types";
2
+
3
+ export declare const partition: (value: string) => EndpointPartition;
@@ -1,2 +1,4 @@
1
-
2
- export declare const booleanEquals: (value1: boolean, value2: boolean) => boolean;
1
+ export declare const booleanEquals: (
2
+ value1: boolean,
3
+ value2: boolean
4
+ ) => boolean;
@@ -1,5 +1,12 @@
1
- export declare type GetAttrValue = string | boolean | {
2
- [key: string]: GetAttrValue;
3
- } | Array<GetAttrValue>;
4
-
5
- export declare const getAttr: (value: GetAttrValue, path: string) => GetAttrValue;
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,9 +1,11 @@
1
- export * from "./booleanEquals";
2
- export * from "./getAttr";
3
- export * from "./isSet";
4
- export * from "./isValidHostLabel";
5
- export * from "./not";
6
- export * from "./parseURL";
7
- export * from "./stringEquals";
8
- export * from "./substring";
9
- 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,4 @@
1
-
2
- export declare const isValidHostLabel: (value: string, allowSubDomains?: boolean) => boolean;
1
+ export declare const isValidHostLabel: (
2
+ value: string,
3
+ allowSubDomains?: boolean
4
+ ) => 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,6 @@
1
-
2
- export declare const substring: (input: string, start: number, stop: number, reverse: boolean) => string | null;
1
+ export declare const substring: (
2
+ input: string,
3
+ start: number,
4
+ stop: number,
5
+ reverse: boolean
6
+ ) => string | null;
@@ -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: (ruleSetObject: RuleSetObject, options: EndpointResolverOptions) => EndpointV2;
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
- constructor(message: string);
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<string, EndpointObjectProperty>;
4
- export declare type EndpointObjectHeaders = Record<string, Expression[]>;
5
- export declare type EndpointObject = {
6
- url: Expression;
7
- properties?: EndpointObjectProperties;
8
- headers?: EndpointObjectHeaders;
9
- };
10
- export declare type EndpointRuleObject = {
11
- type: "endpoint";
12
- conditions?: ConditionObject[];
13
- endpoint: EndpointObject;
14
- documentation?: string;
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
- type: "error";
4
- conditions?: ConditionObject[];
5
- error: Expression;
6
- documentation?: string;
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
- 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
+ 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<EndpointRuleObject | ErrorRuleObject | TreeRuleObject>;
5
- export declare type TreeRuleObject = {
6
- type: "tree";
7
- conditions?: ConditionObject[];
8
- rules: RuleSetRules;
9
- documentation?: string;
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
- ref: string;
4
- };
5
- export declare type FunctionObject = {
6
- fn: string;
7
- argv: FunctionArgv;
8
- };
9
- export declare type FunctionArgv = Array<string | boolean | ReferenceObject | FunctionObject>;
10
- export declare type FunctionReturn = string | boolean | number | {
11
- [key: string]: FunctionReturn;
12
- };
13
- export declare type ConditionObject = FunctionObject & {
14
- assign?: string;
15
- };
16
- export declare type Expression = string | ReferenceObject | FunctionObject;
17
- export declare type EndpointParams = Record<string, string | boolean>;
18
- export declare type EndpointResolverOptions = {
19
- endpointParams: EndpointParams;
20
- logger?: Logger;
21
- };
22
- export declare type ReferenceRecord = Record<string, FunctionReturn>;
23
- export declare type EvaluateOptions = EndpointResolverOptions & {
24
- referenceRecord: ReferenceRecord;
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: ({ fn, argv }: FunctionObject, options: EvaluateOptions) => FunctionReturn;
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: ({ assign, ...fnArgs }: ConditionObject, options: EvaluateOptions) => {
3
- toAssign?: {
4
- name: string;
5
- value: import("../types").FunctionReturn;
6
- } | undefined;
7
- result: boolean;
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: (conditions: ConditionObject[] | undefined, options: EvaluateOptions) => {
3
- result: false;
4
- referenceRecord?: undefined;
5
- } | {
6
- result: boolean;
7
- referenceRecord: Record<string, FunctionReturn>;
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: (endpointRule: EndpointRuleObject, options: EvaluateOptions) => EndpointV2 | undefined;
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: (errorRule: ErrorRuleObject, options: EvaluateOptions) => void;
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, FunctionObject, ReferenceObject } from "../types";
2
- export declare const evaluateExpression: (obj: string | FunctionObject | ReferenceObject, keyName: string, options: EvaluateOptions) => any;
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: (rules: RuleSetRules, options: EvaluateOptions) => EndpointV2;
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: (template: string, options: EvaluateOptions) => any;
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: (treeRule: TreeRuleObject, options: EvaluateOptions) => EndpointV2 | undefined;
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: (headers: EndpointObjectHeaders, options: EvaluateOptions) => {};
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: (properties: EndpointObjectProperties, options: EvaluateOptions) => {};
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: (property: EndpointObjectProperty, options: EvaluateOptions) => EndpointObjectProperty;
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: (endpointUrl: Expression, options: EvaluateOptions) => URL;
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: ({ ref }: ReferenceObject, options: EvaluateOptions) => import("../types").FunctionReturn;
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<string | boolean | ReferenceObject | FunctionObject>;
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, FunctionObject, ReferenceObject } from "../types";
2
- export declare const evaluateExpression: (obj: string | FunctionObject | ReferenceObject, keyName: string, options: EvaluateOptions) => any;
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.167.0",
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",
@@ -9,6 +9,7 @@
9
9
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
10
10
  "build:cjs": "tsc -p tsconfig.cjs.json",
11
11
  "build:es": "tsc -p tsconfig.es.json",
12
+ "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build",
12
13
  "build:types": "tsc -p tsconfig.types.json",
13
14
  "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
14
15
  "clean": "rimraf ./dist-* && rimraf *.tsbuildinfo",
@@ -20,7 +21,7 @@
20
21
  },
21
22
  "license": "Apache-2.0",
22
23
  "dependencies": {
23
- "@aws-sdk/types": "3.162.0",
24
+ "@aws-sdk/types": "3.170.0",
24
25
  "tslib": "^2.3.1"
25
26
  },
26
27
  "engines": {
@@ -45,7 +46,7 @@
45
46
  "devDependencies": {
46
47
  "@tsconfig/recommended": "1.0.1",
47
48
  "concurrently": "7.0.0",
48
- "downlevel-dts": "0.7.0",
49
+ "downlevel-dts": "0.10.1",
49
50
  "rimraf": "3.0.2",
50
51
  "typedoc": "0.19.2",
51
52
  "typescript": "~4.6.2"