@aws-sdk/util-arn-parser 3.465.0 → 3.535.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/dist-cjs/index.js +62 -25
- package/package.json +3 -3
package/dist-cjs/index.js
CHANGED
|
@@ -1,27 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
throw new Error("Malformed ARN");
|
|
10
|
-
const [, partition, service, region, accountId, ...resource] = segments;
|
|
11
|
-
return {
|
|
12
|
-
partition,
|
|
13
|
-
service,
|
|
14
|
-
region,
|
|
15
|
-
accountId,
|
|
16
|
-
resource: resource.join(":"),
|
|
17
|
-
};
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
18
9
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
26
17
|
};
|
|
27
|
-
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
build: () => build,
|
|
24
|
+
parse: () => parse,
|
|
25
|
+
validate: () => validate
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(src_exports);
|
|
28
|
+
var validate = /* @__PURE__ */ __name((str) => typeof str === "string" && str.indexOf("arn:") === 0 && str.split(":").length >= 6, "validate");
|
|
29
|
+
var parse = /* @__PURE__ */ __name((arn) => {
|
|
30
|
+
const segments = arn.split(":");
|
|
31
|
+
if (segments.length < 6 || segments[0] !== "arn")
|
|
32
|
+
throw new Error("Malformed ARN");
|
|
33
|
+
const [
|
|
34
|
+
,
|
|
35
|
+
//Skip "arn" literal
|
|
36
|
+
partition,
|
|
37
|
+
service,
|
|
38
|
+
region,
|
|
39
|
+
accountId,
|
|
40
|
+
...resource
|
|
41
|
+
] = segments;
|
|
42
|
+
return {
|
|
43
|
+
partition,
|
|
44
|
+
service,
|
|
45
|
+
region,
|
|
46
|
+
accountId,
|
|
47
|
+
resource: resource.join(":")
|
|
48
|
+
};
|
|
49
|
+
}, "parse");
|
|
50
|
+
var build = /* @__PURE__ */ __name((arnObject) => {
|
|
51
|
+
const { partition = "aws", service, region, accountId, resource } = arnObject;
|
|
52
|
+
if ([service, region, accountId, resource].some((segment) => typeof segment !== "string")) {
|
|
53
|
+
throw new Error("Input ARN object is invalid");
|
|
54
|
+
}
|
|
55
|
+
return `arn:${partition}:${service}:${region}:${accountId}:${resource}`;
|
|
56
|
+
}, "build");
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
|
|
59
|
+
0 && (module.exports = {
|
|
60
|
+
validate,
|
|
61
|
+
parse,
|
|
62
|
+
build
|
|
63
|
+
});
|
|
64
|
+
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/util-arn-parser",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.535.0",
|
|
4
4
|
"description": "A parser to Amazon Resource Names",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
9
|
-
"build:cjs": "
|
|
9
|
+
"build:cjs": "node ../../scripts/compilation/inline util-arn-parser",
|
|
10
10
|
"build:es": "tsc -p tsconfig.es.json",
|
|
11
11
|
"build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build",
|
|
12
12
|
"build:types": "tsc -p tsconfig.types.json",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"tslib": "^2.
|
|
23
|
+
"tslib": "^2.6.2"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@tsconfig/recommended": "1.0.1",
|