@aws-sdk/util-endpoints 3.614.0 → 3.631.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 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, ...resourceId] = segments;
95
- if (arn !== "arn" || partition2 === "" || service === "" || resourceId[0] === "")
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[0].includes(RESOURCE_DELIMITER) ? resourcePath[0].split(RESOURCE_DELIMITER) : resourcePath;
97
100
  return {
98
101
  partition: partition2,
99
102
  service,
100
103
  region,
101
104
  accountId,
102
- resourceId: resourceId[0].includes("/") ? resourceId[0].split("/") : resourceId
105
+ resourceId
103
106
  };
104
107
  }, "parseArn");
105
108
 
@@ -1,15 +1,20 @@
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, ...resourceId] = segments;
6
- if (arn !== "arn" || partition === "" || service === "" || resourceId[0] === "")
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[0].includes(RESOURCE_DELIMITER)
11
+ ? resourcePath[0].split(RESOURCE_DELIMITER)
12
+ : resourcePath;
8
13
  return {
9
14
  partition,
10
15
  service,
11
16
  region,
12
17
  accountId,
13
- resourceId: resourceId[0].includes("/") ? resourceId[0].split("/") : resourceId,
18
+ resourceId,
14
19
  };
15
20
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/util-endpoints",
3
- "version": "3.614.0",
3
+ "version": "3.631.0",
4
4
  "description": "Utilities to help with endpoint resolution",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "module": "./dist-es/index.js",