@aws-sdk/util-endpoints 3.167.0 → 3.168.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 CHANGED
@@ -3,6 +3,14 @@
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.168.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.167.0...v3.168.0) (2022-09-09)
7
+
8
+ **Note:** Version bump only for package @aws-sdk/util-endpoints
9
+
10
+
11
+
12
+
13
+
6
14
  # [3.167.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.166.0...v3.167.0) (2022-09-08)
7
15
 
8
16
  **Note:** Version bump only for package @aws-sdk/util-endpoints
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./partition"), exports);
@@ -0,0 +1,17 @@
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 || segments[0] !== "arn")
7
+ return null;
8
+ const [, partition, service, region, accountId, ...resourceId] = segments;
9
+ return {
10
+ partition,
11
+ service,
12
+ region,
13
+ accountId,
14
+ resourceId: resourceId[0].includes("/") ? resourceId[0].split("/") : resourceId,
15
+ };
16
+ };
17
+ 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);
@@ -0,0 +1 @@
1
+ export * from "./partition";
@@ -0,0 +1,14 @@
1
+ import { __read } from "tslib";
2
+ export var parseArn = function (value) {
3
+ var segments = value.split(":");
4
+ if (segments.length < 6 || segments[0] !== "arn")
5
+ return null;
6
+ var _a = __read(segments), partition = _a[1], service = _a[2], region = _a[3], accountId = _a[4], resourceId = _a.slice(5);
7
+ return {
8
+ partition: partition,
9
+ service: service,
10
+ region: region,
11
+ accountId: accountId,
12
+ resourceId: resourceId[0].includes("/") ? resourceId[0].split("/") : resourceId,
13
+ };
14
+ };
@@ -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";
@@ -0,0 +1 @@
1
+ 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";
@@ -0,0 +1 @@
1
+ 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,3 +1,5 @@
1
+ import * as aws_1 from "./aws";
2
+ export { aws_1 as aws };
1
3
  export * from "./booleanEquals";
2
4
  export * from "./getAttr";
3
5
  export * from "./isSet";
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.168.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.168.0",
24
25
  "tslib": "^2.3.1"
25
26
  },
26
27
  "engines": {