Skip to content

refactor: remove dynamodb toolbox#5322

Draft
brunozoric wants to merge 40 commits into
nextfrom
bruno/refactor/db-dynamodb-toolbox
Draft

refactor: remove dynamodb toolbox#5322
brunozoric wants to merge 40 commits into
nextfrom
bruno/refactor/db-dynamodb-toolbox

Conversation

@brunozoric

Copy link
Copy Markdown
Contributor

Changes

Remove DynamoDB toolbox dependency!

How Has This Been Tested?

Manual and vitest.

brunozoric and others added 29 commits June 24, 2026 16:34
7-task bottom-up plan to replace dynamodb-toolbox with direct
AWS SDK v3 DynamoDBDocumentClient calls in packages/db-dynamodb.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…3 calls

Replace the dynamodb-toolbox library with two new primitives:
- DynamoDocClient: low-level AWS SDK v3 DynamoDBDocument wrapper
- EntitySchema: attribute marshalling/unmarshalling (replaces Entity metadata)

Rewire all internal utils (put/get/delete/query/scan/batch), Entity,
Table, and batch classes to use DynamoDocClient + EntitySchema directly.
Update external consumers in api-core-ddb, api-elasticsearch-tasks,
api-file-manager. Add DocQueryCommand to @webiny/aws-sdk for document
client queries.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Addressed 29 total findings across three review passes:
- Fixed createFeature vs createImplementation for internal features
- Removed spurious createAbstraction for DynamoDbDocumentClient
- Added full batch factory param type definitions
- Documented IEntity.client type change, ITable removal, IEntity interface addition
- Added complete consumer migration list with 10 packages
- Added type relocation plan (IScanParams, IQueryParams, etc.)
- Added standardEntityAttributes/globalEntityAttributes to exports
- Documented registration order dependency
- Added direct Entity class construction breaking change note
- Added test files and internal store/entity.ts to migration

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Clarify indexes param is a no-op (DynamoDocClient resolves dynamically)
- Fix export path: abstractions.ts re-exports from attributes.ts
- Add createFeature<T> note for DynamoDBClientFeature
- Add full DynamoDbEntityFactoryImpl implementation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
12-task plan: 4 parallel feature creation tasks, 1 internal rewiring task,
6 parallel consumer migration tasks, 1 verification task.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
11 tasks across 12 files — each task is its own file so agents
only read what they need. Tasks 1-4 parallel, 6-10 parallel.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Move feature/ to features/, update all internal type references
from DynamoDocClient to DynamoDbDocumentClient.Interface, wire
batch factory delegation into Entity, add feature registrations
in registerDynamoDBCore(), update exports/api/db.ts, and delete
replaced util files. All 203 tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Update webiny/src/api/db.ts: fix feature/ → features/ import paths
- Migrate api-core-ddb from createTable/createStandardEntity to
  DynamoDbTableFactory/DynamoDbEntityFactory pattern
- Update all entity definition files to accept client + entityFactory
- Update index files to use tableFactory.create() and entityFactory.createStandard/createGlobal()
- Update types to use DynamoDbTableFactory.Interface + DynamoDbEntityFactory.Interface
- Update adminUsers/types.ts: getTable() returns DynamoDbDocumentClient.Interface
- Update createApiCoreDdb.ts: construct factory impls from documentClient
- Fix IStandardEntityAttributes import paths to exports/api/db.js

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace createTable/createStandardEntity with DynamoDbTableFactory/DynamoDbEntityFactory.
Fix entity.entity → entity.schema and FilterUtil import path as pre-existing issues.
Remove unused @webiny/aws-sdk dependency.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace createTable/createStandardEntity with DynamoDbTableFactory/DynamoDbEntityFactory.
Update definitions/types.ts IEntity import path. Fix definitions/types.ts IStandardEntityAttributes
import path. Update types.ts getTable/getEsTable return types to DynamoDbDocumentClient.Interface.
ES table creation kept with createOpenSearchTable pending Task 9 migration (cast applied).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ory abstractions

- Replace createTable/createStandardEntity with DynamoDbTableFactory.create()/DynamoDbEntityFactory.create()
- Change return type of createOpenSearchTable from ITable to DynamoDbDocumentClient.Interface
- Update createOpenSearchEntity to accept client + entityFactory instead of ITable
- Update Manager.ts to use DynamoDbTableFactory + DynamoDbEntityFactory DI deps
- Update abstractions/Manager.ts: table type is now DynamoDbDocumentClient.Interface
- Fix scan.ts: replace TableDef with DynamoDbDocumentClient.Interface
- Fix ReindexingTaskRunner.ts: use manager.table directly (no .table accessor)
- Fix ElasticsearchSynchronize.ts: remove Entity class import, use IEntity
- Update api-headless-cms-ddb-es/feature.ts: remove TODO workarounds, use new factory API
- Remove @webiny/aws-sdk from both package.json files (no longer directly used)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
FlpStorageOperations namespace now carries all dependent types.
Implementation uses createImplementation with declared dependencies.
Consumer just calls container.register().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
EntityQueryOptions → utils/entity/types.ts
EntityConstructor, Readonly → utils/entity/Entity.ts (inlined)
DynamoDBTypes → imported directly from EntitySchema.ts
TableDef, ScanOptions → deleted (unused aliases)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@brunozoric brunozoric self-assigned this Jun 25, 2026
brunozoric and others added 11 commits June 25, 2026 12:19
… complete

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Delete unused count.ts, remove dead ScanInput/ScanOutput re-exports,
replace WriteRequest import with local IWriteRequest interface.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
DynamoDbDriver now creates its own DynamoDbDocumentClient, batch factory,
and entity factory internally from the documentClient param. Fixes broken
constructor that required DI-resolved dependencies callers don't have.

Also removes TYPE from FLP createKeys (only PK/SK are valid get/delete
keys) and adds it to put calls instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…o DI features

Replace factory functions with class implementations using
createImplementation + createFeature pattern. Fix TYPE/GSI_TENANT
in security key helpers (only PK/SK valid for get/delete).

Wire all 4 features in createApiCoreDdb: tenancy, adminUsers,
security, keyValueStore.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant