fix: implement S3 listBuckets to actually list buckets
- Add @aws-sdk/client-s3 dependency for direct S3 operations - Fix listBuckets handler which was hardcoded to return empty array - Now properly queries S3 and returns actual bucket names
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
"@api.global/typedrequest": "^3.2.5",
|
||||
"@api.global/typedrequest-interfaces": "^3.0.19",
|
||||
"@api.global/typedserver": "^8.3.0",
|
||||
"@aws-sdk/client-s3": "^3.975.0",
|
||||
"@design.estate/dees-catalog": "^3.37.0",
|
||||
"@design.estate/dees-element": "^2.1.5",
|
||||
"@push.rocks/early": "^4.0.4",
|
||||
|
||||
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@@ -17,6 +17,9 @@ importers:
|
||||
'@api.global/typedserver':
|
||||
specifier: ^8.3.0
|
||||
version: 8.3.0(@tiptap/pm@2.27.2)
|
||||
'@aws-sdk/client-s3':
|
||||
specifier: ^3.975.0
|
||||
version: 3.975.0
|
||||
'@design.estate/dees-catalog':
|
||||
specifier: ^3.37.0
|
||||
version: 3.37.0(@tiptap/pm@2.27.2)
|
||||
|
||||
@@ -19,10 +19,16 @@ export async function registerS3Handlers(
|
||||
return { buckets: [] };
|
||||
}
|
||||
|
||||
// SmartBucket doesn't have a direct listBuckets method
|
||||
// For now return empty - in a full implementation you'd use the underlying S3 client
|
||||
try {
|
||||
const command = new plugins.s3.ListBucketsCommand({});
|
||||
const response = await smartbucket.s3Client.send(command) as plugins.s3.ListBucketsCommandOutput;
|
||||
const buckets = response.Buckets?.map(b => b.Name).filter((name): name is string => !!name) || [];
|
||||
return { buckets };
|
||||
} catch (err) {
|
||||
console.error('Error listing buckets:', err);
|
||||
return { buckets: [] };
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -33,6 +33,10 @@ export {
|
||||
smartpromise,
|
||||
};
|
||||
|
||||
// AWS S3 SDK for direct S3 operations
|
||||
import * as s3 from '@aws-sdk/client-s3';
|
||||
export { s3 };
|
||||
|
||||
// @api.global scope
|
||||
import * as typedrequest from '@api.global/typedrequest';
|
||||
import * as typedrequestInterfaces from '@api.global/typedrequest-interfaces';
|
||||
|
||||
Reference in New Issue
Block a user