BREAKING CHANGE(core): Make API strict-by-default: remove *Strict variants, throw on not-found/exists conflicts, add explicit exists() methods, update docs/tests and bump deps

This commit is contained in:
2025-11-20 13:20:19 +00:00
parent 0c631383e1
commit 5889396134
15 changed files with 2644 additions and 1562 deletions

View File

@@ -42,11 +42,12 @@ export class SmartBucket {
return Bucket.getBucketByName(this, bucketNameArg);
}
public async getBucketByNameStrict(...args: Parameters<SmartBucket['getBucketByName']>) {
const bucket = await this.getBucketByName(...args);
if (!bucket) {
throw new Error(`Bucket ${args[0]} does not exist.`);
}
return bucket;
/**
* Check if a bucket exists
*/
public async bucketExists(bucketNameArg: string): Promise<boolean> {
const command = new plugins.s3.ListBucketsCommand({});
const buckets = await this.s3Client.send(command);
return buckets.Buckets?.some(bucket => bucket.Name === bucketNameArg) ?? false;
}
}