@aws-sdk/util-endpoints 3.433.0 → 3.449.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 (153) hide show
  1. package/dist-cjs/aws.js +12 -0
  2. package/dist-cjs/index.js +1 -0
  3. package/dist-cjs/lib/aws/isVirtualHostableS3Bucket.js +2 -2
  4. package/dist-cjs/lib/isIpAddress.js +2 -3
  5. package/dist-cjs/resolveEndpoint.js +2 -39
  6. package/dist-cjs/types/EndpointError.js +2 -7
  7. package/dist-es/aws.js +10 -0
  8. package/dist-es/index.js +1 -0
  9. package/dist-es/lib/aws/isVirtualHostableS3Bucket.js +1 -1
  10. package/dist-es/lib/isIpAddress.js +1 -2
  11. package/dist-es/resolveEndpoint.js +1 -37
  12. package/dist-es/types/EndpointError.js +1 -6
  13. package/dist-types/aws.d.ts +1 -0
  14. package/dist-types/index.d.ts +1 -0
  15. package/dist-types/lib/aws/parseArn.d.ts +1 -1
  16. package/dist-types/lib/aws/partition.d.ts +1 -1
  17. package/dist-types/lib/isIpAddress.d.ts +1 -4
  18. package/dist-types/resolveEndpoint.d.ts +1 -6
  19. package/dist-types/ts3.4/aws.d.ts +1 -0
  20. package/dist-types/ts3.4/index.d.ts +1 -0
  21. package/dist-types/ts3.4/lib/aws/parseArn.d.ts +1 -1
  22. package/dist-types/ts3.4/lib/aws/partition.d.ts +1 -1
  23. package/dist-types/ts3.4/lib/isIpAddress.d.ts +1 -1
  24. package/dist-types/ts3.4/resolveEndpoint.d.ts +1 -6
  25. package/dist-types/ts3.4/types/EndpointError.d.ts +1 -3
  26. package/dist-types/ts3.4/types/EndpointRuleObject.d.ts +6 -15
  27. package/dist-types/ts3.4/types/ErrorRuleObject.d.ts +1 -7
  28. package/dist-types/ts3.4/types/RuleSetObject.d.ts +5 -19
  29. package/dist-types/ts3.4/types/TreeRuleObject.d.ts +1 -12
  30. package/dist-types/ts3.4/types/shared.d.ts +12 -29
  31. package/dist-types/types/EndpointError.d.ts +1 -3
  32. package/dist-types/types/EndpointRuleObject.d.ts +1 -15
  33. package/dist-types/types/ErrorRuleObject.d.ts +1 -7
  34. package/dist-types/types/RuleSetObject.d.ts +1 -19
  35. package/dist-types/types/TreeRuleObject.d.ts +1 -10
  36. package/dist-types/types/shared.d.ts +1 -25
  37. package/package.json +3 -2
  38. package/dist-cjs/debug/debugId.js +0 -4
  39. package/dist-cjs/debug/index.js +0 -5
  40. package/dist-cjs/debug/toDebugString.js +0 -16
  41. package/dist-cjs/lib/booleanEquals.js +0 -5
  42. package/dist-cjs/lib/getAttr.js +0 -15
  43. package/dist-cjs/lib/getAttrPathList.js +0 -29
  44. package/dist-cjs/lib/index.js +0 -14
  45. package/dist-cjs/lib/isSet.js +0 -5
  46. package/dist-cjs/lib/isValidHostLabel.js +0 -17
  47. package/dist-cjs/lib/not.js +0 -5
  48. package/dist-cjs/lib/parseURL.js +0 -55
  49. package/dist-cjs/lib/stringEquals.js +0 -5
  50. package/dist-cjs/lib/substring.js +0 -13
  51. package/dist-cjs/lib/uriEncode.js +0 -5
  52. package/dist-cjs/utils/callFunction.js +0 -11
  53. package/dist-cjs/utils/evaluateCondition.js +0 -19
  54. package/dist-cjs/utils/evaluateConditions.js +0 -27
  55. package/dist-cjs/utils/evaluateEndpointRule.js +0 -32
  56. package/dist-cjs/utils/evaluateErrorRule.js +0 -18
  57. package/dist-cjs/utils/evaluateExpression.js +0 -20
  58. package/dist-cjs/utils/evaluateRules.js +0 -31
  59. package/dist-cjs/utils/evaluateTemplate.js +0 -40
  60. package/dist-cjs/utils/evaluateTreeRule.js +0 -17
  61. package/dist-cjs/utils/getEndpointHeaders.js +0 -16
  62. package/dist-cjs/utils/getEndpointProperties.js +0 -9
  63. package/dist-cjs/utils/getEndpointProperty.js +0 -25
  64. package/dist-cjs/utils/getEndpointUrl.js +0 -19
  65. package/dist-cjs/utils/getReferenceValue.js +0 -11
  66. package/dist-cjs/utils/index.js +0 -4
  67. package/dist-es/debug/debugId.js +0 -1
  68. package/dist-es/debug/index.js +0 -2
  69. package/dist-es/debug/toDebugString.js +0 -12
  70. package/dist-es/lib/booleanEquals.js +0 -1
  71. package/dist-es/lib/getAttr.js +0 -11
  72. package/dist-es/lib/getAttrPathList.js +0 -25
  73. package/dist-es/lib/index.js +0 -10
  74. package/dist-es/lib/isSet.js +0 -1
  75. package/dist-es/lib/isValidHostLabel.js +0 -13
  76. package/dist-es/lib/not.js +0 -1
  77. package/dist-es/lib/parseURL.js +0 -51
  78. package/dist-es/lib/stringEquals.js +0 -1
  79. package/dist-es/lib/substring.js +0 -9
  80. package/dist-es/lib/uriEncode.js +0 -1
  81. package/dist-es/utils/callFunction.js +0 -6
  82. package/dist-es/utils/evaluateCondition.js +0 -14
  83. package/dist-es/utils/evaluateConditions.js +0 -22
  84. package/dist-es/utils/evaluateEndpointRule.js +0 -27
  85. package/dist-es/utils/evaluateErrorRule.js +0 -14
  86. package/dist-es/utils/evaluateExpression.js +0 -16
  87. package/dist-es/utils/evaluateRules.js +0 -27
  88. package/dist-es/utils/evaluateTemplate.js +0 -36
  89. package/dist-es/utils/evaluateTreeRule.js +0 -13
  90. package/dist-es/utils/getEndpointHeaders.js +0 -12
  91. package/dist-es/utils/getEndpointProperties.js +0 -5
  92. package/dist-es/utils/getEndpointProperty.js +0 -21
  93. package/dist-es/utils/getEndpointUrl.js +0 -15
  94. package/dist-es/utils/getReferenceValue.js +0 -7
  95. package/dist-es/utils/index.js +0 -1
  96. package/dist-types/debug/debugId.d.ts +0 -1
  97. package/dist-types/debug/index.d.ts +0 -2
  98. package/dist-types/debug/toDebugString.d.ts +0 -9
  99. package/dist-types/lib/booleanEquals.d.ts +0 -5
  100. package/dist-types/lib/getAttr.d.ts +0 -7
  101. package/dist-types/lib/getAttrPathList.d.ts +0 -4
  102. package/dist-types/lib/index.d.ts +0 -10
  103. package/dist-types/lib/isSet.d.ts +0 -5
  104. package/dist-types/lib/isValidHostLabel.d.ts +0 -7
  105. package/dist-types/lib/not.d.ts +0 -5
  106. package/dist-types/lib/parseURL.d.ts +0 -5
  107. package/dist-types/lib/stringEquals.d.ts +0 -5
  108. package/dist-types/lib/substring.d.ts +0 -7
  109. package/dist-types/lib/uriEncode.d.ts +0 -4
  110. package/dist-types/ts3.4/debug/debugId.d.ts +0 -1
  111. package/dist-types/ts3.4/debug/index.d.ts +0 -2
  112. package/dist-types/ts3.4/debug/toDebugString.d.ts +0 -9
  113. package/dist-types/ts3.4/lib/booleanEquals.d.ts +0 -4
  114. package/dist-types/ts3.4/lib/getAttr.d.ts +0 -11
  115. package/dist-types/ts3.4/lib/getAttrPathList.d.ts +0 -1
  116. package/dist-types/ts3.4/lib/index.d.ts +0 -11
  117. package/dist-types/ts3.4/lib/isSet.d.ts +0 -1
  118. package/dist-types/ts3.4/lib/isValidHostLabel.d.ts +0 -4
  119. package/dist-types/ts3.4/lib/not.d.ts +0 -1
  120. package/dist-types/ts3.4/lib/parseURL.d.ts +0 -4
  121. package/dist-types/ts3.4/lib/stringEquals.d.ts +0 -1
  122. package/dist-types/ts3.4/lib/substring.d.ts +0 -6
  123. package/dist-types/ts3.4/lib/uriEncode.d.ts +0 -1
  124. package/dist-types/ts3.4/utils/callFunction.d.ts +0 -5
  125. package/dist-types/ts3.4/utils/evaluateCondition.d.ts +0 -13
  126. package/dist-types/ts3.4/utils/evaluateConditions.d.ts +0 -13
  127. package/dist-types/ts3.4/utils/evaluateEndpointRule.d.ts +0 -6
  128. package/dist-types/ts3.4/utils/evaluateErrorRule.d.ts +0 -5
  129. package/dist-types/ts3.4/utils/evaluateExpression.d.ts +0 -6
  130. package/dist-types/ts3.4/utils/evaluateRules.d.ts +0 -6
  131. package/dist-types/ts3.4/utils/evaluateTemplate.d.ts +0 -5
  132. package/dist-types/ts3.4/utils/evaluateTreeRule.d.ts +0 -6
  133. package/dist-types/ts3.4/utils/getEndpointHeaders.d.ts +0 -5
  134. package/dist-types/ts3.4/utils/getEndpointProperties.d.ts +0 -5
  135. package/dist-types/ts3.4/utils/getEndpointProperty.d.ts +0 -6
  136. package/dist-types/ts3.4/utils/getEndpointUrl.d.ts +0 -5
  137. package/dist-types/ts3.4/utils/getReferenceValue.d.ts +0 -5
  138. package/dist-types/ts3.4/utils/index.d.ts +0 -1
  139. package/dist-types/utils/callFunction.d.ts +0 -2
  140. package/dist-types/utils/evaluateCondition.d.ts +0 -8
  141. package/dist-types/utils/evaluateConditions.d.ts +0 -8
  142. package/dist-types/utils/evaluateEndpointRule.d.ts +0 -3
  143. package/dist-types/utils/evaluateErrorRule.d.ts +0 -2
  144. package/dist-types/utils/evaluateExpression.d.ts +0 -2
  145. package/dist-types/utils/evaluateRules.d.ts +0 -3
  146. package/dist-types/utils/evaluateTemplate.d.ts +0 -2
  147. package/dist-types/utils/evaluateTreeRule.d.ts +0 -3
  148. package/dist-types/utils/getEndpointHeaders.d.ts +0 -2
  149. package/dist-types/utils/getEndpointProperties.d.ts +0 -2
  150. package/dist-types/utils/getEndpointProperty.d.ts +0 -3
  151. package/dist-types/utils/getEndpointUrl.d.ts +0 -2
  152. package/dist-types/utils/getReferenceValue.d.ts +0 -2
  153. package/dist-types/utils/index.d.ts +0 -1
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const util_endpoints_1 = require("@smithy/util-endpoints");
4
+ const isVirtualHostableS3Bucket_1 = require("./lib/aws/isVirtualHostableS3Bucket");
5
+ const parseArn_1 = require("./lib/aws/parseArn");
6
+ const partition_1 = require("./lib/aws/partition");
7
+ const awsEndpointFunctions = {
8
+ isVirtualHostableS3Bucket: isVirtualHostableS3Bucket_1.isVirtualHostableS3Bucket,
9
+ parseArn: parseArn_1.parseArn,
10
+ partition: partition_1.partition,
11
+ };
12
+ util_endpoints_1.customEndpointFunctions.aws = awsEndpointFunctions;
package/dist-cjs/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./aws"), exports);
4
5
  tslib_1.__exportStar(require("./lib/aws/partition"), exports);
5
6
  tslib_1.__exportStar(require("./lib/isIpAddress"), exports);
6
7
  tslib_1.__exportStar(require("./resolveEndpoint"), exports);
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isVirtualHostableS3Bucket = void 0;
4
+ const util_endpoints_1 = require("@smithy/util-endpoints");
4
5
  const isIpAddress_1 = require("../isIpAddress");
5
- const isValidHostLabel_1 = require("../isValidHostLabel");
6
6
  const isVirtualHostableS3Bucket = (value, allowSubDomains = false) => {
7
7
  if (allowSubDomains) {
8
8
  for (const label of value.split(".")) {
@@ -12,7 +12,7 @@ const isVirtualHostableS3Bucket = (value, allowSubDomains = false) => {
12
12
  }
13
13
  return true;
14
14
  }
15
- if (!(0, isValidHostLabel_1.isValidHostLabel)(value)) {
15
+ if (!(0, util_endpoints_1.isValidHostLabel)(value)) {
16
16
  return false;
17
17
  }
18
18
  if (value.length < 3 || value.length > 63) {
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isIpAddress = void 0;
4
- 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}$`);
5
- const isIpAddress = (value) => IP_V4_REGEX.test(value) || (value.startsWith("[") && value.endsWith("]"));
6
- exports.isIpAddress = isIpAddress;
4
+ var util_endpoints_1 = require("@smithy/util-endpoints");
5
+ Object.defineProperty(exports, "isIpAddress", { enumerable: true, get: function () { return util_endpoints_1.isIpAddress; } });
@@ -1,42 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolveEndpoint = void 0;
4
- const debug_1 = require("./debug");
5
- const types_1 = require("./types");
6
- const utils_1 = require("./utils");
7
- const resolveEndpoint = (ruleSetObject, options) => {
8
- var _a, _b, _c, _d, _e, _f;
9
- const { endpointParams, logger } = options;
10
- const { parameters, rules } = ruleSetObject;
11
- (_b = (_a = options.logger) === null || _a === void 0 ? void 0 : _a.debug) === null || _b === void 0 ? void 0 : _b.call(_a, `${debug_1.debugId} Initial EndpointParams: ${(0, debug_1.toDebugString)(endpointParams)}`);
12
- const paramsWithDefault = Object.entries(parameters)
13
- .filter(([, v]) => v.default != null)
14
- .map(([k, v]) => [k, v.default]);
15
- if (paramsWithDefault.length > 0) {
16
- for (const [paramKey, paramDefaultValue] of paramsWithDefault) {
17
- endpointParams[paramKey] = (_c = endpointParams[paramKey]) !== null && _c !== void 0 ? _c : paramDefaultValue;
18
- }
19
- }
20
- const requiredParams = Object.entries(parameters)
21
- .filter(([, v]) => v.required)
22
- .map(([k]) => k);
23
- for (const requiredParam of requiredParams) {
24
- if (endpointParams[requiredParam] == null) {
25
- throw new types_1.EndpointError(`Missing required parameter: '${requiredParam}'`);
26
- }
27
- }
28
- const endpoint = (0, utils_1.evaluateRules)(rules, { endpointParams, logger, referenceRecord: {} });
29
- if ((_d = options.endpointParams) === null || _d === void 0 ? void 0 : _d.Endpoint) {
30
- try {
31
- const givenEndpoint = new URL(options.endpointParams.Endpoint);
32
- const { protocol, port } = givenEndpoint;
33
- endpoint.url.protocol = protocol;
34
- endpoint.url.port = port;
35
- }
36
- catch (e) {
37
- }
38
- }
39
- (_f = (_e = options.logger) === null || _e === void 0 ? void 0 : _e.debug) === null || _f === void 0 ? void 0 : _f.call(_e, `${debug_1.debugId} Resolved endpoint: ${(0, debug_1.toDebugString)(endpoint)}`);
40
- return endpoint;
41
- };
42
- exports.resolveEndpoint = resolveEndpoint;
4
+ var util_endpoints_1 = require("@smithy/util-endpoints");
5
+ Object.defineProperty(exports, "resolveEndpoint", { enumerable: true, get: function () { return util_endpoints_1.resolveEndpoint; } });
@@ -1,10 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EndpointError = void 0;
4
- class EndpointError extends Error {
5
- constructor(message) {
6
- super(message);
7
- this.name = "EndpointError";
8
- }
9
- }
10
- exports.EndpointError = EndpointError;
4
+ var util_endpoints_1 = require("@smithy/util-endpoints");
5
+ Object.defineProperty(exports, "EndpointError", { enumerable: true, get: function () { return util_endpoints_1.EndpointError; } });
package/dist-es/aws.js ADDED
@@ -0,0 +1,10 @@
1
+ import { customEndpointFunctions } from "@smithy/util-endpoints";
2
+ import { isVirtualHostableS3Bucket } from "./lib/aws/isVirtualHostableS3Bucket";
3
+ import { parseArn } from "./lib/aws/parseArn";
4
+ import { partition } from "./lib/aws/partition";
5
+ const awsEndpointFunctions = {
6
+ isVirtualHostableS3Bucket: isVirtualHostableS3Bucket,
7
+ parseArn: parseArn,
8
+ partition: partition,
9
+ };
10
+ customEndpointFunctions.aws = awsEndpointFunctions;
package/dist-es/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export * from "./aws";
1
2
  export * from "./lib/aws/partition";
2
3
  export * from "./lib/isIpAddress";
3
4
  export * from "./resolveEndpoint";
@@ -1,5 +1,5 @@
1
+ import { isValidHostLabel } from "@smithy/util-endpoints";
1
2
  import { isIpAddress } from "../isIpAddress";
2
- import { isValidHostLabel } from "../isValidHostLabel";
3
3
  export const isVirtualHostableS3Bucket = (value, allowSubDomains = false) => {
4
4
  if (allowSubDomains) {
5
5
  for (const label of value.split(".")) {
@@ -1,2 +1 @@
1
- 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}$`);
2
- export const isIpAddress = (value) => IP_V4_REGEX.test(value) || (value.startsWith("[") && value.endsWith("]"));
1
+ export { isIpAddress } from "@smithy/util-endpoints";
@@ -1,37 +1 @@
1
- import { debugId, toDebugString } from "./debug";
2
- import { EndpointError } from "./types";
3
- import { evaluateRules } from "./utils";
4
- export const resolveEndpoint = (ruleSetObject, options) => {
5
- const { endpointParams, logger } = options;
6
- const { parameters, rules } = ruleSetObject;
7
- options.logger?.debug?.(`${debugId} Initial EndpointParams: ${toDebugString(endpointParams)}`);
8
- const paramsWithDefault = Object.entries(parameters)
9
- .filter(([, v]) => v.default != null)
10
- .map(([k, v]) => [k, v.default]);
11
- if (paramsWithDefault.length > 0) {
12
- for (const [paramKey, paramDefaultValue] of paramsWithDefault) {
13
- endpointParams[paramKey] = endpointParams[paramKey] ?? paramDefaultValue;
14
- }
15
- }
16
- const requiredParams = Object.entries(parameters)
17
- .filter(([, v]) => v.required)
18
- .map(([k]) => k);
19
- for (const requiredParam of requiredParams) {
20
- if (endpointParams[requiredParam] == null) {
21
- throw new EndpointError(`Missing required parameter: '${requiredParam}'`);
22
- }
23
- }
24
- const endpoint = evaluateRules(rules, { endpointParams, logger, referenceRecord: {} });
25
- if (options.endpointParams?.Endpoint) {
26
- try {
27
- const givenEndpoint = new URL(options.endpointParams.Endpoint);
28
- const { protocol, port } = givenEndpoint;
29
- endpoint.url.protocol = protocol;
30
- endpoint.url.port = port;
31
- }
32
- catch (e) {
33
- }
34
- }
35
- options.logger?.debug?.(`${debugId} Resolved endpoint: ${toDebugString(endpoint)}`);
36
- return endpoint;
37
- };
1
+ export { resolveEndpoint } from "@smithy/util-endpoints";
@@ -1,6 +1 @@
1
- export class EndpointError extends Error {
2
- constructor(message) {
3
- super(message);
4
- this.name = "EndpointError";
5
- }
6
- }
1
+ export { EndpointError } from "@smithy/util-endpoints";
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,4 @@
1
+ export * from "./aws";
1
2
  export * from "./lib/aws/partition";
2
3
  export * from "./lib/isIpAddress";
3
4
  export * from "./resolveEndpoint";
@@ -1,4 +1,4 @@
1
- import { EndpointARN } from "@aws-sdk/types";
1
+ import { EndpointARN } from "@smithy/types";
2
2
  /**
3
3
  * Evaluates a single string argument value, and returns an object containing
4
4
  * details about the parsed ARN.
@@ -1,4 +1,4 @@
1
- import { EndpointPartition } from "@aws-sdk/types";
1
+ import { EndpointPartition } from "@smithy/types";
2
2
  export type PartitionsInfo = {
3
3
  partitions: Array<{
4
4
  id: string;
@@ -1,4 +1 @@
1
- /**
2
- * Validates if the provided value is an IP address.
3
- */
4
- export declare const isIpAddress: (value: string) => boolean;
1
+ export { isIpAddress } from "@smithy/util-endpoints";
@@ -1,6 +1 @@
1
- import { EndpointV2 } from "@aws-sdk/types";
2
- import { EndpointResolverOptions, RuleSetObject } from "./types";
3
- /**
4
- * Resolves an endpoint URL by processing the endpoints ruleset and options.
5
- */
6
- export declare const resolveEndpoint: (ruleSetObject: RuleSetObject, options: EndpointResolverOptions) => EndpointV2;
1
+ export { resolveEndpoint } from "@smithy/util-endpoints";
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,4 @@
1
+ export * from "./aws";
1
2
  export * from "./lib/aws/partition";
2
3
  export * from "./lib/isIpAddress";
3
4
  export * from "./resolveEndpoint";
@@ -1,2 +1,2 @@
1
- import { EndpointARN } from "@aws-sdk/types";
1
+ import { EndpointARN } from "@smithy/types";
2
2
  export declare const parseArn: (value: string) => EndpointARN | null;
@@ -1,4 +1,4 @@
1
- import { EndpointPartition } from "@aws-sdk/types";
1
+ import { EndpointPartition } from "@smithy/types";
2
2
  export type PartitionsInfo = {
3
3
  partitions: Array<{
4
4
  id: string;
@@ -1 +1 @@
1
- export declare const isIpAddress: (value: string) => boolean;
1
+ export { isIpAddress } from "@smithy/util-endpoints";
@@ -1,6 +1 @@
1
- import { EndpointV2 } from "@aws-sdk/types";
2
- import { EndpointResolverOptions, RuleSetObject } from "./types";
3
- export declare const resolveEndpoint: (
4
- ruleSetObject: RuleSetObject,
5
- options: EndpointResolverOptions
6
- ) => EndpointV2;
1
+ export { resolveEndpoint } from "@smithy/util-endpoints";
@@ -1,3 +1 @@
1
- export declare class EndpointError extends Error {
2
- constructor(message: string);
3
- }
1
+ export { EndpointError } from "@smithy/util-endpoints";
@@ -1,15 +1,6 @@
1
- import { EndpointObjectProperty } from "@aws-sdk/types";
2
- import { ConditionObject, Expression } from "./shared";
3
- export type EndpointObjectProperties = Record<string, EndpointObjectProperty>;
4
- export type EndpointObjectHeaders = Record<string, Expression[]>;
5
- export type EndpointObject = {
6
- url: Expression;
7
- properties?: EndpointObjectProperties;
8
- headers?: EndpointObjectHeaders;
9
- };
10
- export type EndpointRuleObject = {
11
- type: "endpoint";
12
- conditions?: ConditionObject[];
13
- endpoint: EndpointObject;
14
- documentation?: string;
15
- };
1
+ export {
2
+ EndpointObjectProperties,
3
+ EndpointObjectHeaders,
4
+ EndpointObject,
5
+ EndpointRuleObject,
6
+ } from "@smithy/util-endpoints";
@@ -1,7 +1 @@
1
- import { ConditionObject, Expression } from "./shared";
2
- export type ErrorRuleObject = {
3
- type: "error";
4
- conditions?: ConditionObject[];
5
- error: Expression;
6
- documentation?: string;
7
- };
1
+ export { ErrorRuleObject } from "@smithy/util-endpoints";
@@ -1,19 +1,5 @@
1
- import { RuleSetRules } from "./TreeRuleObject";
2
- export type DeprecatedObject = {
3
- message?: string;
4
- since?: string;
5
- };
6
- export type ParameterObject = {
7
- type: "String" | "string" | "Boolean" | "boolean";
8
- default?: string | boolean;
9
- required?: boolean;
10
- documentation?: string;
11
- builtIn?: string;
12
- deprecated?: DeprecatedObject;
13
- };
14
- export type RuleSetObject = {
15
- version: string;
16
- serviceId?: string;
17
- parameters: Record<string, ParameterObject>;
18
- rules: RuleSetRules;
19
- };
1
+ export {
2
+ DeprecatedObject,
3
+ ParameterObject,
4
+ RuleSetObject,
5
+ } from "@smithy/util-endpoints";
@@ -1,12 +1 @@
1
- import { EndpointRuleObject } from "./EndpointRuleObject";
2
- import { ErrorRuleObject } from "./ErrorRuleObject";
3
- import { ConditionObject } from "./shared";
4
- export type RuleSetRules = Array<
5
- EndpointRuleObject | ErrorRuleObject | TreeRuleObject
6
- >;
7
- export type TreeRuleObject = {
8
- type: "tree";
9
- conditions?: ConditionObject[];
10
- rules: RuleSetRules;
11
- documentation?: string;
12
- };
1
+ export { RuleSetRules, TreeRuleObject } from "@smithy/util-endpoints";
@@ -1,29 +1,12 @@
1
- import { Logger } from "@aws-sdk/types";
2
- export type ReferenceObject = {
3
- ref: string;
4
- };
5
- export type FunctionObject = {
6
- fn: string;
7
- argv: FunctionArgv;
8
- };
9
- export type FunctionArgv = Array<Expression | boolean | number>;
10
- export type FunctionReturn =
11
- | string
12
- | boolean
13
- | number
14
- | {
15
- [key: string]: FunctionReturn;
16
- };
17
- export type ConditionObject = FunctionObject & {
18
- assign?: string;
19
- };
20
- export type Expression = string | ReferenceObject | FunctionObject;
21
- export type EndpointParams = Record<string, string | boolean>;
22
- export type EndpointResolverOptions = {
23
- endpointParams: EndpointParams;
24
- logger?: Logger;
25
- };
26
- export type ReferenceRecord = Record<string, FunctionReturn>;
27
- export type EvaluateOptions = EndpointResolverOptions & {
28
- referenceRecord: ReferenceRecord;
29
- };
1
+ export {
2
+ ReferenceObject,
3
+ FunctionObject,
4
+ FunctionArgv,
5
+ FunctionReturn,
6
+ ConditionObject,
7
+ Expression,
8
+ EndpointParams,
9
+ EndpointResolverOptions,
10
+ ReferenceRecord,
11
+ EvaluateOptions,
12
+ } from "@smithy/util-endpoints";
@@ -1,3 +1 @@
1
- export declare class EndpointError extends Error {
2
- constructor(message: string);
3
- }
1
+ export { EndpointError } from "@smithy/util-endpoints";
@@ -1,15 +1 @@
1
- import { EndpointObjectProperty } from "@aws-sdk/types";
2
- import { ConditionObject, Expression } from "./shared";
3
- export type EndpointObjectProperties = Record<string, EndpointObjectProperty>;
4
- export type EndpointObjectHeaders = Record<string, Expression[]>;
5
- export type EndpointObject = {
6
- url: Expression;
7
- properties?: EndpointObjectProperties;
8
- headers?: EndpointObjectHeaders;
9
- };
10
- export type EndpointRuleObject = {
11
- type: "endpoint";
12
- conditions?: ConditionObject[];
13
- endpoint: EndpointObject;
14
- documentation?: string;
15
- };
1
+ export { EndpointObjectProperties, EndpointObjectHeaders, EndpointObject, EndpointRuleObject, } from "@smithy/util-endpoints";
@@ -1,7 +1 @@
1
- import { ConditionObject, Expression } from "./shared";
2
- export type ErrorRuleObject = {
3
- type: "error";
4
- conditions?: ConditionObject[];
5
- error: Expression;
6
- documentation?: string;
7
- };
1
+ export { ErrorRuleObject } from "@smithy/util-endpoints";
@@ -1,19 +1 @@
1
- import { RuleSetRules } from "./TreeRuleObject";
2
- export type DeprecatedObject = {
3
- message?: string;
4
- since?: string;
5
- };
6
- export type ParameterObject = {
7
- type: "String" | "string" | "Boolean" | "boolean";
8
- default?: string | boolean;
9
- required?: boolean;
10
- documentation?: string;
11
- builtIn?: string;
12
- deprecated?: DeprecatedObject;
13
- };
14
- export type RuleSetObject = {
15
- version: string;
16
- serviceId?: string;
17
- parameters: Record<string, ParameterObject>;
18
- rules: RuleSetRules;
19
- };
1
+ export { DeprecatedObject, ParameterObject, RuleSetObject } from "@smithy/util-endpoints";
@@ -1,10 +1 @@
1
- import { EndpointRuleObject } from "./EndpointRuleObject";
2
- import { ErrorRuleObject } from "./ErrorRuleObject";
3
- import { ConditionObject } from "./shared";
4
- export type RuleSetRules = Array<EndpointRuleObject | ErrorRuleObject | TreeRuleObject>;
5
- export type TreeRuleObject = {
6
- type: "tree";
7
- conditions?: ConditionObject[];
8
- rules: RuleSetRules;
9
- documentation?: string;
10
- };
1
+ export { RuleSetRules, TreeRuleObject } from "@smithy/util-endpoints";
@@ -1,25 +1 @@
1
- import { Logger } from "@aws-sdk/types";
2
- export type ReferenceObject = {
3
- ref: string;
4
- };
5
- export type FunctionObject = {
6
- fn: string;
7
- argv: FunctionArgv;
8
- };
9
- export type FunctionArgv = Array<Expression | boolean | number>;
10
- export type FunctionReturn = string | boolean | number | {
11
- [key: string]: FunctionReturn;
12
- };
13
- export type ConditionObject = FunctionObject & {
14
- assign?: string;
15
- };
16
- export type Expression = string | ReferenceObject | FunctionObject;
17
- export type EndpointParams = Record<string, string | boolean>;
18
- export type EndpointResolverOptions = {
19
- endpointParams: EndpointParams;
20
- logger?: Logger;
21
- };
22
- export type ReferenceRecord = Record<string, FunctionReturn>;
23
- export type EvaluateOptions = EndpointResolverOptions & {
24
- referenceRecord: ReferenceRecord;
25
- };
1
+ export { ReferenceObject, FunctionObject, FunctionArgv, FunctionReturn, ConditionObject, Expression, EndpointParams, EndpointResolverOptions, ReferenceRecord, EvaluateOptions, } from "@smithy/util-endpoints";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/util-endpoints",
3
- "version": "3.433.0",
3
+ "version": "3.449.0",
4
4
  "description": "Utilities to help with endpoint resolution",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "module": "./dist-es/index.js",
@@ -22,7 +22,8 @@
22
22
  },
23
23
  "license": "Apache-2.0",
24
24
  "dependencies": {
25
- "@aws-sdk/types": "3.433.0",
25
+ "@aws-sdk/types": "3.449.0",
26
+ "@smithy/util-endpoints": "^1.0.2",
26
27
  "tslib": "^2.5.0"
27
28
  },
28
29
  "engines": {
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.debugId = void 0;
4
- exports.debugId = "endpoints";
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./debugId"), exports);
5
- tslib_1.__exportStar(require("./toDebugString"), exports);
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toDebugString = void 0;
4
- function toDebugString(input) {
5
- if (typeof input !== "object" || input == null) {
6
- return input;
7
- }
8
- if ("ref" in input) {
9
- return `$${toDebugString(input.ref)}`;
10
- }
11
- if ("fn" in input) {
12
- return `${input.fn}(${(input.argv || []).map(toDebugString).join(", ")})`;
13
- }
14
- return JSON.stringify(input, null, 2);
15
- }
16
- exports.toDebugString = toDebugString;
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.booleanEquals = void 0;
4
- const booleanEquals = (value1, value2) => value1 === value2;
5
- exports.booleanEquals = booleanEquals;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAttr = void 0;
4
- const types_1 = require("../types");
5
- const getAttrPathList_1 = require("./getAttrPathList");
6
- const getAttr = (value, path) => (0, getAttrPathList_1.getAttrPathList)(path).reduce((acc, index) => {
7
- if (typeof acc !== "object") {
8
- throw new types_1.EndpointError(`Index '${index}' in '${path}' not found in '${JSON.stringify(value)}'`);
9
- }
10
- else if (Array.isArray(acc)) {
11
- return acc[parseInt(index)];
12
- }
13
- return acc[index];
14
- }, value);
15
- exports.getAttr = getAttr;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAttrPathList = void 0;
4
- const types_1 = require("../types");
5
- const getAttrPathList = (path) => {
6
- const parts = path.split(".");
7
- const pathList = [];
8
- for (const part of parts) {
9
- const squareBracketIndex = part.indexOf("[");
10
- if (squareBracketIndex !== -1) {
11
- if (part.indexOf("]") !== part.length - 1) {
12
- throw new types_1.EndpointError(`Path: '${path}' does not end with ']'`);
13
- }
14
- const arrayIndex = part.slice(squareBracketIndex + 1, -1);
15
- if (Number.isNaN(parseInt(arrayIndex))) {
16
- throw new types_1.EndpointError(`Invalid array index: '${arrayIndex}' in path: '${path}'`);
17
- }
18
- if (squareBracketIndex !== 0) {
19
- pathList.push(part.slice(0, squareBracketIndex));
20
- }
21
- pathList.push(arrayIndex);
22
- }
23
- else {
24
- pathList.push(part);
25
- }
26
- }
27
- return pathList;
28
- };
29
- exports.getAttrPathList = getAttrPathList;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.aws = void 0;
4
- const tslib_1 = require("tslib");
5
- exports.aws = tslib_1.__importStar(require("./aws"));
6
- tslib_1.__exportStar(require("./booleanEquals"), exports);
7
- tslib_1.__exportStar(require("./getAttr"), exports);
8
- tslib_1.__exportStar(require("./isSet"), exports);
9
- tslib_1.__exportStar(require("./isValidHostLabel"), exports);
10
- tslib_1.__exportStar(require("./not"), exports);
11
- tslib_1.__exportStar(require("./parseURL"), exports);
12
- tslib_1.__exportStar(require("./stringEquals"), exports);
13
- tslib_1.__exportStar(require("./substring"), exports);
14
- tslib_1.__exportStar(require("./uriEncode"), exports);
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isSet = void 0;
4
- const isSet = (value) => value != null;
5
- exports.isSet = isSet;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isValidHostLabel = void 0;
4
- const VALID_HOST_LABEL_REGEX = new RegExp(`^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$`);
5
- const isValidHostLabel = (value, allowSubDomains = false) => {
6
- if (!allowSubDomains) {
7
- return VALID_HOST_LABEL_REGEX.test(value);
8
- }
9
- const labels = value.split(".");
10
- for (const label of labels) {
11
- if (!(0, exports.isValidHostLabel)(label)) {
12
- return false;
13
- }
14
- }
15
- return true;
16
- };
17
- exports.isValidHostLabel = isValidHostLabel;
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.not = void 0;
4
- const not = (value) => !value;
5
- exports.not = not;