@smithy/middleware-endpoint
Advanced tools
Comparing version 2.5.0 to 2.5.1
@@ -57,9 +57,9 @@ var __defProp = Object.defineProperty; | ||
var isArnBucketName = /* @__PURE__ */ __name((bucketName) => { | ||
const [arn, partition, service, region, account, typeOrId] = bucketName.split(":"); | ||
const [arn, partition, service, , , bucket] = bucketName.split(":"); | ||
const isArn = arn === "arn" && bucketName.split(":").length >= 6; | ||
const isValidArn = [arn, partition, service, account, typeOrId].filter(Boolean).length === 5; | ||
const isValidArn = Boolean(isArn && partition && service && bucket); | ||
if (isArn && !isValidArn) { | ||
throw new Error(`Invalid ARN: ${bucketName} was an invalid ARN.`); | ||
} | ||
return arn === "arn" && !!partition && !!service && !!account && !!typeOrId; | ||
return isValidArn; | ||
}, "isArnBucketName"); | ||
@@ -66,0 +66,0 @@ |
@@ -30,9 +30,9 @@ export const resolveParamsForS3 = async (endpointParams) => { | ||
export const isArnBucketName = (bucketName) => { | ||
const [arn, partition, service, region, account, typeOrId] = bucketName.split(":"); | ||
const [arn, partition, service, , , bucket] = bucketName.split(":"); | ||
const isArn = arn === "arn" && bucketName.split(":").length >= 6; | ||
const isValidArn = [arn, partition, service, account, typeOrId].filter(Boolean).length === 5; | ||
const isValidArn = Boolean(isArn && partition && service && bucket); | ||
if (isArn && !isValidArn) { | ||
throw new Error(`Invalid ARN: ${bucketName} was an invalid ARN.`); | ||
} | ||
return arn === "arn" && !!partition && !!service && !!account && !!typeOrId; | ||
return isValidArn; | ||
}; |
{ | ||
"name": "@smithy/middleware-endpoint", | ||
"version": "2.5.0", | ||
"version": "2.5.1", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'", |
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
56256