@aws-sdk/util-endpoints
Advanced tools
Comparing version 3.614.0 to 3.631.0
@@ -90,9 +90,12 @@ "use strict"; | ||
// src/lib/aws/parseArn.ts | ||
var ARN_DELIMITER = ":"; | ||
var RESOURCE_DELIMITER = "/"; | ||
var parseArn = /* @__PURE__ */ __name((value) => { | ||
const segments = value.split(":"); | ||
const segments = value.split(ARN_DELIMITER); | ||
if (segments.length < 6) | ||
return null; | ||
const [arn, partition2, service, region, accountId, ...resourceId] = segments; | ||
if (arn !== "arn" || partition2 === "" || service === "" || resourceId[0] === "") | ||
const [arn, partition2, service, region, accountId, ...resourcePath] = segments; | ||
if (arn !== "arn" || partition2 === "" || service === "" || resourcePath.join(ARN_DELIMITER) === "") | ||
return null; | ||
const resourceId = resourcePath[0].includes(RESOURCE_DELIMITER) ? resourcePath[0].split(RESOURCE_DELIMITER) : resourcePath; | ||
return { | ||
@@ -103,3 +106,3 @@ partition: partition2, | ||
accountId, | ||
resourceId: resourceId[0].includes("/") ? resourceId[0].split("/") : resourceId | ||
resourceId | ||
}; | ||
@@ -106,0 +109,0 @@ }, "parseArn"); |
@@ -0,8 +1,13 @@ | ||
const ARN_DELIMITER = ":"; | ||
const RESOURCE_DELIMITER = "/"; | ||
export const parseArn = (value) => { | ||
const segments = value.split(":"); | ||
const segments = value.split(ARN_DELIMITER); | ||
if (segments.length < 6) | ||
return null; | ||
const [arn, partition, service, region, accountId, ...resourceId] = segments; | ||
if (arn !== "arn" || partition === "" || service === "" || resourceId[0] === "") | ||
const [arn, partition, service, region, accountId, ...resourcePath] = segments; | ||
if (arn !== "arn" || partition === "" || service === "" || resourcePath.join(ARN_DELIMITER) === "") | ||
return null; | ||
const resourceId = resourcePath[0].includes(RESOURCE_DELIMITER) | ||
? resourcePath[0].split(RESOURCE_DELIMITER) | ||
: resourcePath; | ||
return { | ||
@@ -13,4 +18,4 @@ partition, | ||
accountId, | ||
resourceId: resourceId[0].includes("/") ? resourceId[0].split("/") : resourceId, | ||
resourceId, | ||
}; | ||
}; |
{ | ||
"name": "@aws-sdk/util-endpoints", | ||
"version": "3.614.0", | ||
"version": "3.631.0", | ||
"description": "Utilities to help with endpoint resolution", | ||
@@ -5,0 +5,0 @@ "main": "./dist-cjs/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49964
1097