@aws-sdk/util-endpoints 3.614.0 → 3.632.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 +7 -4
- package/dist-es/lib/aws/parseArn.js +7 -4
- package/package.json +1 -1
package/dist-cjs/index.js
CHANGED
|
@@ -87,19 +87,22 @@ var isVirtualHostableS3Bucket = /* @__PURE__ */ __name((value, allowSubDomains =
|
|
|
87
87
|
}, "isVirtualHostableS3Bucket");
|
|
88
88
|
|
|
89
89
|
// src/lib/aws/parseArn.ts
|
|
90
|
+
var ARN_DELIMITER = ":";
|
|
91
|
+
var RESOURCE_DELIMITER = "/";
|
|
90
92
|
var parseArn = /* @__PURE__ */ __name((value) => {
|
|
91
|
-
const segments = value.split(
|
|
93
|
+
const segments = value.split(ARN_DELIMITER);
|
|
92
94
|
if (segments.length < 6)
|
|
93
95
|
return null;
|
|
94
|
-
const [arn, partition2, service, region, accountId, ...
|
|
95
|
-
if (arn !== "arn" || partition2 === "" || service === "" ||
|
|
96
|
+
const [arn, partition2, service, region, accountId, ...resourcePath] = segments;
|
|
97
|
+
if (arn !== "arn" || partition2 === "" || service === "" || resourcePath.join(ARN_DELIMITER) === "")
|
|
96
98
|
return null;
|
|
99
|
+
const resourceId = resourcePath.map((resource) => resource.split(RESOURCE_DELIMITER)).flat();
|
|
97
100
|
return {
|
|
98
101
|
partition: partition2,
|
|
99
102
|
service,
|
|
100
103
|
region,
|
|
101
104
|
accountId,
|
|
102
|
-
resourceId
|
|
105
|
+
resourceId
|
|
103
106
|
};
|
|
104
107
|
}, "parseArn");
|
|
105
108
|
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
+
const ARN_DELIMITER = ":";
|
|
2
|
+
const RESOURCE_DELIMITER = "/";
|
|
1
3
|
export const parseArn = (value) => {
|
|
2
|
-
const segments = value.split(
|
|
4
|
+
const segments = value.split(ARN_DELIMITER);
|
|
3
5
|
if (segments.length < 6)
|
|
4
6
|
return null;
|
|
5
|
-
const [arn, partition, service, region, accountId, ...
|
|
6
|
-
if (arn !== "arn" || partition === "" || service === "" ||
|
|
7
|
+
const [arn, partition, service, region, accountId, ...resourcePath] = segments;
|
|
8
|
+
if (arn !== "arn" || partition === "" || service === "" || resourcePath.join(ARN_DELIMITER) === "")
|
|
7
9
|
return null;
|
|
10
|
+
const resourceId = resourcePath.map((resource) => resource.split(RESOURCE_DELIMITER)).flat();
|
|
8
11
|
return {
|
|
9
12
|
partition,
|
|
10
13
|
service,
|
|
11
14
|
region,
|
|
12
15
|
accountId,
|
|
13
|
-
resourceId
|
|
16
|
+
resourceId,
|
|
14
17
|
};
|
|
15
18
|
};
|