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:
2026-01-23 23:28:04 +00:00
parent f64fc069d4
commit a7ee9dff9f
5 changed files with 18 additions and 4 deletions

View File

@@ -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
View File

@@ -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)

View File

@@ -19,9 +19,15 @@ 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
return { buckets: [] };
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

View File

@@ -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';