@aws-sdk/util-arn-parser 3.186.0 → 3.201.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 +19 -0
- package/dist-es/index.js +12 -15
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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.201.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.200.0...v3.201.0) (2022-11-01)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* end support for Node.js 12.x ([#4123](https://github.com/aws/aws-sdk-js-v3/issues/4123)) ([83f913e](https://github.com/aws/aws-sdk-js-v3/commit/83f913ec2ac3878d8726c6964f585550dc5caf3e))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [3.188.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.187.0...v3.188.0) (2022-10-13)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @aws-sdk/util-arn-parser
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
# [3.186.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.185.0...v3.186.0) (2022-10-06)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @aws-sdk/util-arn-parser
|
package/dist-es/index.js
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
export var parse = function (arn) {
|
|
6
|
-
var segments = arn.split(":");
|
|
1
|
+
export const validate = (str) => typeof str === "string" && str.indexOf("arn:") === 0 && str.split(":").length >= 6;
|
|
2
|
+
export const parse = (arn) => {
|
|
3
|
+
const segments = arn.split(":");
|
|
7
4
|
if (segments.length < 6 || segments[0] !== "arn")
|
|
8
5
|
throw new Error("Malformed ARN");
|
|
9
|
-
|
|
6
|
+
const [, partition, service, region, accountId, ...resource] = segments;
|
|
10
7
|
return {
|
|
11
|
-
partition
|
|
12
|
-
service
|
|
13
|
-
region
|
|
14
|
-
accountId
|
|
8
|
+
partition,
|
|
9
|
+
service,
|
|
10
|
+
region,
|
|
11
|
+
accountId,
|
|
15
12
|
resource: resource.join(":"),
|
|
16
13
|
};
|
|
17
14
|
};
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
if ([service, region, accountId, resource].some(
|
|
15
|
+
export const build = (arnObject) => {
|
|
16
|
+
const { partition = "aws", service, region, accountId, resource } = arnObject;
|
|
17
|
+
if ([service, region, accountId, resource].some((segment) => typeof segment !== "string")) {
|
|
21
18
|
throw new Error("Input ARN object is invalid");
|
|
22
19
|
}
|
|
23
|
-
return
|
|
20
|
+
return `arn:${partition}:${service}:${region}:${accountId}:${resource}`;
|
|
24
21
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/util-arn-parser",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.201.0",
|
|
4
4
|
"description": "A parser to Amazon Resource Names",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"types": "./dist-types/index.d.ts",
|
|
35
35
|
"engines": {
|
|
36
|
-
"node": ">=
|
|
36
|
+
"node": ">=14.0.0"
|
|
37
37
|
},
|
|
38
38
|
"typesVersions": {
|
|
39
39
|
"<4.0": {
|