feat: Add protected setDocClient method to DynamoDbChatStorage#367
feat: Add protected setDocClient method to DynamoDbChatStorage#367yilinglu wants to merge 1 commit into
Conversation
- Allows subclasses to customize the DynamoDB Document Client - Useful for local development, testing, or custom endpoint configurations - Maintains backward compatibility as a non-breaking change - Includes comprehensive unit tests This enhancement enables common use cases like: - Local development with DynamoDB Local - Testing with mocked clients - Using DynamoDB-compatible services (LocalStack, ScyllaDB) - Custom endpoint configurations
|
Hi, |
| * @param client - The DynamoDBDocumentClient to use | ||
| * @protected | ||
| */ | ||
| protected setDocClient(client: DynamoDBDocumentClient): void { |
There was a problem hiding this comment.
just add an endpoint parameter to avoid such method
brnaba-aws
left a comment
There was a problem hiding this comment.
Please, add a new parameter: endpoint
|
Hey @yilinglu, the `setDocClient` method is a clean, additive change and the DynamoDB Local use case is concrete. Two things need fixing before this can merge. The diff includes a change to `typescript/src/common/src/version.ts` — per project rules this file is auto-generated by the prebuild hook and must not be edited by hand, so please remove it from the PR. There is also no update to the `docs/` site page for `DynamoDbChatStorage` — per project rules, new public/protected methods must be documented with a usage example showing the local-dev pattern. |
Issue Link (REQUIRED)
Fixes #368
Summary
Changes
Added a protected
setDocClientmethod to theDynamoDbChatStorageclass, allowing subclasses to customize the DynamoDB Document Client configuration. This enhancement enables common use cases without requiring code duplication.Key benefit: This change enables developers to use DynamoDB Local in Docker containers for local development, eliminating the need for AWS credentials and costs during development.
User experience
Before: Users had to duplicate the entire DynamoDbChatStorage class (~200+ lines) or use type casting hacks to customize the DynamoDB client for local development or testing.
After: Users can cleanly extend DynamoDbChatStorage with minimal code:
Example: Local Development with DynamoDB in Docker
Checklist
Is this a breaking change?
No, this is a non-breaking change. The new protected method is additive and all existing code continues to work unchanged.
RFC issue number: N/A
Checklist:
Testing
Documentation
Added JSDoc documentation for the new method explaining its purpose and usage.
Real-World Benefits
This change significantly improves the developer experience by enabling:
Example docker-compose.yml:
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.