@aws-sdk/util-endpoints 3.188.0 → 3.192.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 +22 -0
- package/dist-cjs/index.js +1 -0
- package/dist-cjs/lib/aws/partition.js +2 -5
- package/dist-cjs/lib/aws/partitions.json +11 -2
- package/dist-cjs/lib/parseURL.js +16 -1
- package/dist-es/index.js +1 -0
- package/dist-es/lib/aws/partition.js +2 -5
- package/dist-es/lib/aws/partitions.json +11 -2
- package/dist-es/lib/parseURL.js +16 -1
- package/dist-types/index.d.ts +1 -0
- package/dist-types/lib/parseURL.d.ts +3 -3
- package/dist-types/ts3.4/index.d.ts +1 -0
- package/dist-types/ts3.4/lib/parseURL.d.ts +4 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
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.192.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.191.0...v3.192.0) (2022-10-19)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **endpoint:** dedupe clientContext/builtIn params, fix s3 unit test ([#4051](https://github.com/aws/aws-sdk-js-v3/issues/4051)) ([947c8bc](https://github.com/aws/aws-sdk-js-v3/commit/947c8bce2798ae5ddc022d34f62aeeb60b4e6fde))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [3.190.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.189.0...v3.190.0) (2022-10-17)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **endpoint:** endpoints 2.0 all-service TS compilation fixes ([#4043](https://github.com/aws/aws-sdk-js-v3/issues/4043)) ([f2da618](https://github.com/aws/aws-sdk-js-v3/commit/f2da6182298d4d6b02e84fb723492c07c27469a8))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
# [3.188.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.187.0...v3.188.0) (2022-10-13)
|
|
7
29
|
|
|
8
30
|
|
package/dist-cjs/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./lib/aws/partition"), exports);
|
|
4
5
|
tslib_1.__exportStar(require("./resolveEndpoint"), exports);
|
|
5
6
|
tslib_1.__exportStar(require("./types"), exports);
|
|
@@ -5,11 +5,10 @@ const partitions_json_1 = require("./partitions.json");
|
|
|
5
5
|
const DEFAULT_PARTITION = partitions_json_1.partitions.find((partition) => partition.id === "aws");
|
|
6
6
|
const partition = (value) => {
|
|
7
7
|
for (const partition of partitions_json_1.partitions) {
|
|
8
|
-
const {
|
|
8
|
+
const { regions, outputs } = partition;
|
|
9
9
|
for (const [region, regionData] of Object.entries(regions)) {
|
|
10
10
|
if (region === value) {
|
|
11
11
|
return {
|
|
12
|
-
name: id,
|
|
13
12
|
...outputs,
|
|
14
13
|
...regionData,
|
|
15
14
|
};
|
|
@@ -17,10 +16,9 @@ const partition = (value) => {
|
|
|
17
16
|
}
|
|
18
17
|
}
|
|
19
18
|
for (const partition of partitions_json_1.partitions) {
|
|
20
|
-
const {
|
|
19
|
+
const { regionRegex, outputs } = partition;
|
|
21
20
|
if (new RegExp(regionRegex).test(value)) {
|
|
22
21
|
return {
|
|
23
|
-
name: id,
|
|
24
22
|
...outputs,
|
|
25
23
|
};
|
|
26
24
|
}
|
|
@@ -30,7 +28,6 @@ const partition = (value) => {
|
|
|
30
28
|
" and default partition with id 'aws' doesn't exist.");
|
|
31
29
|
}
|
|
32
30
|
return {
|
|
33
|
-
name: DEFAULT_PARTITION.id,
|
|
34
31
|
...DEFAULT_PARTITION.outputs,
|
|
35
32
|
};
|
|
36
33
|
};
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"aws-global": {}
|
|
31
31
|
},
|
|
32
32
|
"outputs": {
|
|
33
|
+
"name": "aws",
|
|
33
34
|
"dnsSuffix": "amazonaws.com",
|
|
34
35
|
"dualStackDnsSuffix": "api.aws",
|
|
35
36
|
"supportsFIPS": true,
|
|
@@ -45,6 +46,7 @@
|
|
|
45
46
|
"aws-us-gov-global": {}
|
|
46
47
|
},
|
|
47
48
|
"outputs": {
|
|
49
|
+
"name": "aws-us-gov",
|
|
48
50
|
"dnsSuffix": "amazonaws.com",
|
|
49
51
|
"dualStackDnsSuffix": "api.aws",
|
|
50
52
|
"supportsFIPS": true,
|
|
@@ -60,6 +62,7 @@
|
|
|
60
62
|
"aws-cn-global": {}
|
|
61
63
|
},
|
|
62
64
|
"outputs": {
|
|
65
|
+
"name": "aws-cn",
|
|
63
66
|
"dnsSuffix": "amazonaws.com.cn",
|
|
64
67
|
"dualStackDnsSuffix": "api.amazonwebservices.com.cn",
|
|
65
68
|
"supportsFIPS": true,
|
|
@@ -70,23 +73,29 @@
|
|
|
70
73
|
"id": "aws-iso",
|
|
71
74
|
"regionRegex": "^us\\-iso\\-\\w+\\-\\d+$",
|
|
72
75
|
"outputs": {
|
|
76
|
+
"name": "aws-iso",
|
|
73
77
|
"dnsSuffix": "c2s.ic.gov",
|
|
74
78
|
"supportsFIPS": true,
|
|
75
79
|
"supportsDualStack": false,
|
|
76
80
|
"dualStackDnsSuffix": "c2s.ic.gov"
|
|
77
81
|
},
|
|
78
|
-
"regions": {
|
|
82
|
+
"regions": {
|
|
83
|
+
"aws-iso-global": {}
|
|
84
|
+
}
|
|
79
85
|
},
|
|
80
86
|
{
|
|
81
87
|
"id": "aws-iso-b",
|
|
82
88
|
"regionRegex": "^us\\-isob\\-\\w+\\-\\d+$",
|
|
83
89
|
"outputs": {
|
|
90
|
+
"name": "aws-iso-b",
|
|
84
91
|
"dnsSuffix": "sc2s.sgov.gov",
|
|
85
92
|
"supportsFIPS": true,
|
|
86
93
|
"supportsDualStack": false,
|
|
87
94
|
"dualStackDnsSuffix": "sc2s.sgov.gov"
|
|
88
95
|
},
|
|
89
|
-
"regions": {
|
|
96
|
+
"regions": {
|
|
97
|
+
"aws-iso-b-global": {}
|
|
98
|
+
}
|
|
90
99
|
}
|
|
91
100
|
]
|
|
92
101
|
}
|
package/dist-cjs/lib/parseURL.js
CHANGED
|
@@ -10,6 +10,17 @@ const DEFAULT_PORTS = {
|
|
|
10
10
|
const parseURL = (value) => {
|
|
11
11
|
const whatwgURL = (() => {
|
|
12
12
|
try {
|
|
13
|
+
if (value instanceof URL) {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
if (typeof value === "object" && "hostname" in value) {
|
|
17
|
+
const { hostname, port, protocol = "", path = "", query = {} } = value;
|
|
18
|
+
const url = new URL(`${protocol}//${hostname}${port ? `:${port}` : ""}${path}`);
|
|
19
|
+
url.search = Object.entries(query)
|
|
20
|
+
.map(([k, v]) => `${k}=${v}`)
|
|
21
|
+
.join("&");
|
|
22
|
+
return url;
|
|
23
|
+
}
|
|
13
24
|
return new URL(value);
|
|
14
25
|
}
|
|
15
26
|
catch (error) {
|
|
@@ -17,8 +28,10 @@ const parseURL = (value) => {
|
|
|
17
28
|
}
|
|
18
29
|
})();
|
|
19
30
|
if (!whatwgURL) {
|
|
31
|
+
console.error(`Unable to parse ${JSON.stringify(value)} as a whatwg URL.`);
|
|
20
32
|
return null;
|
|
21
33
|
}
|
|
34
|
+
const urlString = whatwgURL.href;
|
|
22
35
|
const { host, hostname, pathname, protocol, search } = whatwgURL;
|
|
23
36
|
if (search) {
|
|
24
37
|
return null;
|
|
@@ -28,7 +41,9 @@ const parseURL = (value) => {
|
|
|
28
41
|
return null;
|
|
29
42
|
}
|
|
30
43
|
const isIp = (0, isIpAddress_1.isIpAddress)(hostname);
|
|
31
|
-
const
|
|
44
|
+
const inputContainsDefaultPort = urlString.includes(`${host}:${DEFAULT_PORTS[scheme]}`) ||
|
|
45
|
+
(typeof value === "string" && value.includes(`${host}:${DEFAULT_PORTS[scheme]}`));
|
|
46
|
+
const authority = `${host}${inputContainsDefaultPort ? `:${DEFAULT_PORTS[scheme]}` : ``}`;
|
|
32
47
|
return {
|
|
33
48
|
scheme,
|
|
34
49
|
authority,
|
package/dist-es/index.js
CHANGED
|
@@ -2,11 +2,10 @@ import { partitions } from "./partitions.json";
|
|
|
2
2
|
const DEFAULT_PARTITION = partitions.find((partition) => partition.id === "aws");
|
|
3
3
|
export const partition = (value) => {
|
|
4
4
|
for (const partition of partitions) {
|
|
5
|
-
const {
|
|
5
|
+
const { regions, outputs } = partition;
|
|
6
6
|
for (const [region, regionData] of Object.entries(regions)) {
|
|
7
7
|
if (region === value) {
|
|
8
8
|
return {
|
|
9
|
-
name: id,
|
|
10
9
|
...outputs,
|
|
11
10
|
...regionData,
|
|
12
11
|
};
|
|
@@ -14,10 +13,9 @@ export const partition = (value) => {
|
|
|
14
13
|
}
|
|
15
14
|
}
|
|
16
15
|
for (const partition of partitions) {
|
|
17
|
-
const {
|
|
16
|
+
const { regionRegex, outputs } = partition;
|
|
18
17
|
if (new RegExp(regionRegex).test(value)) {
|
|
19
18
|
return {
|
|
20
|
-
name: id,
|
|
21
19
|
...outputs,
|
|
22
20
|
};
|
|
23
21
|
}
|
|
@@ -27,7 +25,6 @@ export const partition = (value) => {
|
|
|
27
25
|
" and default partition with id 'aws' doesn't exist.");
|
|
28
26
|
}
|
|
29
27
|
return {
|
|
30
|
-
name: DEFAULT_PARTITION.id,
|
|
31
28
|
...DEFAULT_PARTITION.outputs,
|
|
32
29
|
};
|
|
33
30
|
};
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"aws-global": {}
|
|
31
31
|
},
|
|
32
32
|
"outputs": {
|
|
33
|
+
"name": "aws",
|
|
33
34
|
"dnsSuffix": "amazonaws.com",
|
|
34
35
|
"dualStackDnsSuffix": "api.aws",
|
|
35
36
|
"supportsFIPS": true,
|
|
@@ -45,6 +46,7 @@
|
|
|
45
46
|
"aws-us-gov-global": {}
|
|
46
47
|
},
|
|
47
48
|
"outputs": {
|
|
49
|
+
"name": "aws-us-gov",
|
|
48
50
|
"dnsSuffix": "amazonaws.com",
|
|
49
51
|
"dualStackDnsSuffix": "api.aws",
|
|
50
52
|
"supportsFIPS": true,
|
|
@@ -60,6 +62,7 @@
|
|
|
60
62
|
"aws-cn-global": {}
|
|
61
63
|
},
|
|
62
64
|
"outputs": {
|
|
65
|
+
"name": "aws-cn",
|
|
63
66
|
"dnsSuffix": "amazonaws.com.cn",
|
|
64
67
|
"dualStackDnsSuffix": "api.amazonwebservices.com.cn",
|
|
65
68
|
"supportsFIPS": true,
|
|
@@ -70,23 +73,29 @@
|
|
|
70
73
|
"id": "aws-iso",
|
|
71
74
|
"regionRegex": "^us\\-iso\\-\\w+\\-\\d+$",
|
|
72
75
|
"outputs": {
|
|
76
|
+
"name": "aws-iso",
|
|
73
77
|
"dnsSuffix": "c2s.ic.gov",
|
|
74
78
|
"supportsFIPS": true,
|
|
75
79
|
"supportsDualStack": false,
|
|
76
80
|
"dualStackDnsSuffix": "c2s.ic.gov"
|
|
77
81
|
},
|
|
78
|
-
"regions": {
|
|
82
|
+
"regions": {
|
|
83
|
+
"aws-iso-global": {}
|
|
84
|
+
}
|
|
79
85
|
},
|
|
80
86
|
{
|
|
81
87
|
"id": "aws-iso-b",
|
|
82
88
|
"regionRegex": "^us\\-isob\\-\\w+\\-\\d+$",
|
|
83
89
|
"outputs": {
|
|
90
|
+
"name": "aws-iso-b",
|
|
84
91
|
"dnsSuffix": "sc2s.sgov.gov",
|
|
85
92
|
"supportsFIPS": true,
|
|
86
93
|
"supportsDualStack": false,
|
|
87
94
|
"dualStackDnsSuffix": "sc2s.sgov.gov"
|
|
88
95
|
},
|
|
89
|
-
"regions": {
|
|
96
|
+
"regions": {
|
|
97
|
+
"aws-iso-b-global": {}
|
|
98
|
+
}
|
|
90
99
|
}
|
|
91
100
|
]
|
|
92
101
|
}
|
package/dist-es/lib/parseURL.js
CHANGED
|
@@ -7,6 +7,17 @@ const DEFAULT_PORTS = {
|
|
|
7
7
|
export const parseURL = (value) => {
|
|
8
8
|
const whatwgURL = (() => {
|
|
9
9
|
try {
|
|
10
|
+
if (value instanceof URL) {
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
if (typeof value === "object" && "hostname" in value) {
|
|
14
|
+
const { hostname, port, protocol = "", path = "", query = {} } = value;
|
|
15
|
+
const url = new URL(`${protocol}//${hostname}${port ? `:${port}` : ""}${path}`);
|
|
16
|
+
url.search = Object.entries(query)
|
|
17
|
+
.map(([k, v]) => `${k}=${v}`)
|
|
18
|
+
.join("&");
|
|
19
|
+
return url;
|
|
20
|
+
}
|
|
10
21
|
return new URL(value);
|
|
11
22
|
}
|
|
12
23
|
catch (error) {
|
|
@@ -14,8 +25,10 @@ export const parseURL = (value) => {
|
|
|
14
25
|
}
|
|
15
26
|
})();
|
|
16
27
|
if (!whatwgURL) {
|
|
28
|
+
console.error(`Unable to parse ${JSON.stringify(value)} as a whatwg URL.`);
|
|
17
29
|
return null;
|
|
18
30
|
}
|
|
31
|
+
const urlString = whatwgURL.href;
|
|
19
32
|
const { host, hostname, pathname, protocol, search } = whatwgURL;
|
|
20
33
|
if (search) {
|
|
21
34
|
return null;
|
|
@@ -25,7 +38,9 @@ export const parseURL = (value) => {
|
|
|
25
38
|
return null;
|
|
26
39
|
}
|
|
27
40
|
const isIp = isIpAddress(hostname);
|
|
28
|
-
const
|
|
41
|
+
const inputContainsDefaultPort = urlString.includes(`${host}:${DEFAULT_PORTS[scheme]}`) ||
|
|
42
|
+
(typeof value === "string" && value.includes(`${host}:${DEFAULT_PORTS[scheme]}`));
|
|
43
|
+
const authority = `${host}${inputContainsDefaultPort ? `:${DEFAULT_PORTS[scheme]}` : ``}`;
|
|
29
44
|
return {
|
|
30
45
|
scheme,
|
|
31
46
|
authority,
|
package/dist-types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EndpointURL } from "@aws-sdk/types";
|
|
1
|
+
import { Endpoint, EndpointURL } from "@aws-sdk/types";
|
|
2
2
|
/**
|
|
3
|
-
* Parses a string into it’s Endpoint URL components.
|
|
3
|
+
* Parses a string, URL, or Endpoint into it’s Endpoint URL components.
|
|
4
4
|
*/
|
|
5
|
-
export declare const parseURL: (value: string) => EndpointURL | null;
|
|
5
|
+
export declare const parseURL: (value: string | URL | Endpoint) => EndpointURL | null;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import { EndpointURL } from "@aws-sdk/types";
|
|
2
|
-
export declare const parseURL: (
|
|
1
|
+
import { Endpoint, EndpointURL } from "@aws-sdk/types";
|
|
2
|
+
export declare const parseURL: (
|
|
3
|
+
value: string | URL | Endpoint
|
|
4
|
+
) => EndpointURL | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/util-endpoints",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.192.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.190.0",
|
|
25
25
|
"tslib": "^2.3.1"
|
|
26
26
|
},
|
|
27
27
|
"engines": {
|