@aws-sdk/util-arn-parser 3.972.2 → 3.972.4
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 +6 -24
- package/dist-es/index.js +1 -21
- package/dist-types/index.d.ts +1 -32
- package/package.json +3 -12
- package/dist-types/ts3.4/index.d.ts +0 -14
package/dist-cjs/index.js
CHANGED
|
@@ -1,27 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
const parse = (arn) => {
|
|
5
|
-
const segments = arn.split(":");
|
|
6
|
-
if (segments.length < 6 || segments[0] !== "arn")
|
|
7
|
-
throw new Error("Malformed ARN");
|
|
8
|
-
const [, partition, service, region, accountId, ...resource] = segments;
|
|
9
|
-
return {
|
|
10
|
-
partition,
|
|
11
|
-
service,
|
|
12
|
-
region,
|
|
13
|
-
accountId,
|
|
14
|
-
resource: resource.join(":"),
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
const build = (arnObject) => {
|
|
18
|
-
const { partition = "aws", service, region, accountId, resource } = arnObject;
|
|
19
|
-
if ([service, region, accountId, resource].some((segment) => typeof segment !== "string")) {
|
|
20
|
-
throw new Error("Input ARN object is invalid");
|
|
21
|
-
}
|
|
22
|
-
return `arn:${partition}:${service}:${region}:${accountId}:${resource}`;
|
|
23
|
-
};
|
|
3
|
+
var util = require('@aws-sdk/core/util');
|
|
24
4
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
exports.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
exports.build = util.build;
|
|
8
|
+
exports.parse = util.parse;
|
|
9
|
+
exports.validate = util.validate;
|
package/dist-es/index.js
CHANGED
|
@@ -1,21 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export const parse = (arn) => {
|
|
3
|
-
const segments = arn.split(":");
|
|
4
|
-
if (segments.length < 6 || segments[0] !== "arn")
|
|
5
|
-
throw new Error("Malformed ARN");
|
|
6
|
-
const [, partition, service, region, accountId, ...resource] = segments;
|
|
7
|
-
return {
|
|
8
|
-
partition,
|
|
9
|
-
service,
|
|
10
|
-
region,
|
|
11
|
-
accountId,
|
|
12
|
-
resource: resource.join(":"),
|
|
13
|
-
};
|
|
14
|
-
};
|
|
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")) {
|
|
18
|
-
throw new Error("Input ARN object is invalid");
|
|
19
|
-
}
|
|
20
|
-
return `arn:${partition}:${service}:${region}:${accountId}:${resource}`;
|
|
21
|
-
};
|
|
1
|
+
export { build, parse, validate } from "@aws-sdk/core/util";
|
package/dist-types/index.d.ts
CHANGED
|
@@ -1,32 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* @internal
|
|
3
|
-
*/
|
|
4
|
-
export interface ARN {
|
|
5
|
-
partition: string;
|
|
6
|
-
service: string;
|
|
7
|
-
region: string;
|
|
8
|
-
accountId: string;
|
|
9
|
-
resource: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Validate whether a string is an ARN.
|
|
13
|
-
* @internal
|
|
14
|
-
*/
|
|
15
|
-
export declare const validate: (str: any) => boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Parse an ARN string into structure with partition, service, region, accountId and resource values
|
|
18
|
-
* @internal
|
|
19
|
-
*/
|
|
20
|
-
export declare const parse: (arn: string) => ARN;
|
|
21
|
-
/**
|
|
22
|
-
* @internal
|
|
23
|
-
*/
|
|
24
|
-
type buildOptions = Omit<ARN, "partition"> & {
|
|
25
|
-
partition?: string;
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Build an ARN with service, partition, region, accountId, and resources strings
|
|
29
|
-
* @internal
|
|
30
|
-
*/
|
|
31
|
-
export declare const build: (arnObject: buildOptions) => string;
|
|
32
|
-
export {};
|
|
1
|
+
export { ARN, build, parse, validate } from "@aws-sdk/core/util";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/util-arn-parser",
|
|
3
|
-
"version": "3.972.
|
|
3
|
+
"version": "3.972.4",
|
|
4
4
|
"description": "A parser to Amazon Resource Names",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
@@ -10,10 +10,7 @@
|
|
|
10
10
|
"build:es": "tsc -p tsconfig.es.json",
|
|
11
11
|
"build:include:deps": "yarn g:turbo run build -F=\"$npm_package_name\"",
|
|
12
12
|
"build:types": "tsc -p tsconfig.types.json",
|
|
13
|
-
"
|
|
14
|
-
"clean": "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo",
|
|
15
|
-
"test": "yarn g:vitest run",
|
|
16
|
-
"test:watch": "yarn g:vitest watch"
|
|
13
|
+
"clean": "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo"
|
|
17
14
|
},
|
|
18
15
|
"sideEffects": false,
|
|
19
16
|
"author": {
|
|
@@ -22,6 +19,7 @@
|
|
|
22
19
|
},
|
|
23
20
|
"license": "Apache-2.0",
|
|
24
21
|
"dependencies": {
|
|
22
|
+
"@aws-sdk/core": "^3.974.9",
|
|
25
23
|
"tslib": "^2.6.2"
|
|
26
24
|
},
|
|
27
25
|
"devDependencies": {
|
|
@@ -36,13 +34,6 @@
|
|
|
36
34
|
"engines": {
|
|
37
35
|
"node": ">=20.0.0"
|
|
38
36
|
},
|
|
39
|
-
"typesVersions": {
|
|
40
|
-
"<4.0": {
|
|
41
|
-
"dist-types/*": [
|
|
42
|
-
"dist-types/ts3.4/*"
|
|
43
|
-
]
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
37
|
"files": [
|
|
47
38
|
"dist-*/**"
|
|
48
39
|
],
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export interface ARN {
|
|
2
|
-
partition: string;
|
|
3
|
-
service: string;
|
|
4
|
-
region: string;
|
|
5
|
-
accountId: string;
|
|
6
|
-
resource: string;
|
|
7
|
-
}
|
|
8
|
-
export declare const validate: (str: any) => boolean;
|
|
9
|
-
export declare const parse: (arn: string) => ARN;
|
|
10
|
-
type buildOptions = Pick<ARN, Exclude<keyof ARN, "partition">> & {
|
|
11
|
-
partition?: string;
|
|
12
|
-
};
|
|
13
|
-
export declare const build: (arnObject: buildOptions) => string;
|
|
14
|
-
export {};
|