Skip to content

Commit 37f7971

Browse files
chore: fix lint errors
1 parent 35c54c9 commit 37f7971

11 files changed

Lines changed: 42 additions & 1098 deletions

CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Change Log
2+
23
[Compare changes](https://github.com/stacksjs/dynamodb-tooling/compare/v0.3.2...HEAD)
34

4-
### 🧹 Chores
5+
## 🧹 Chores
56

67
- wip ([731729e](https://github.com/stacksjs/dynamodb-tooling/commit/731729e)) _(by glennmichael123 <gtorregosa@gmail.com>)_
78
- wip ([e0255c5](https://github.com/stacksjs/dynamodb-tooling/commit/e0255c5)) _(by glennmichael123 <gtorregosa@gmail.com>)_
@@ -127,11 +128,11 @@
127128

128129
- Chris <chrisbreuer93@gmail.com>
129130

130-
131131
# Change Log
132+
132133
[Compare changes](https://github.com/stacksjs/dynamodb-tooling/compare/v0.3.2...v0.3.3)
133134

134-
### 🧹 Chores
135+
## 🧹 Chores
135136

136137
- release v0.3.3 ([2a64dc4](https://github.com/stacksjs/dynamodb-tooling/commit/2a64dc4)) _(by glennmichael123 <gtorregosa@gmail.com>)_
137138
- wip ([731729e](https://github.com/stacksjs/dynamodb-tooling/commit/731729e)) _(by glennmichael123 <gtorregosa@gmail.com>)_

DYNAMODB_TODO.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@
4040
## DynamoDB ORM Driver
4141

4242
### Stacks Models to Single Table Design
43+
4344
**Status:** Complete
4445
**Description:** Special DynamoDB "ORM driver"/tool where Stacks models are transformed to single table designs.
4546

4647
**Tasks:**
48+
4749
- [x] Finish DynamoDB ORM driver (`src/models/DynamoDBModel.ts`)
4850
- [x] Transform Stacks models to single table design (`src/model-parser/StacksModelParser.ts`, `src/single-table/EntityTransformer.ts`)
4951
- [x] Define access patterns for common queries (`src/single-table/AccessPatternGenerator.ts`)
@@ -56,6 +58,7 @@
5658
## Relationship with bun-query-builder
5759

5860
### How bun-query-builder Extends dynamodb-tooling
61+
5962
**Status:** Complete
6063

6164
**Architecture Decision:** SQL and DynamoDB are fundamentally different paradigms:
@@ -101,6 +104,7 @@ import {
101104
```
102105

103106
**bun-query-builder/dynamodb provides:**
107+
104108
- Fluent query builder API (`dynamo.entity().pk().sk().get()`)
105109
- Connection management
106110
- Higher-level abstractions for common patterns
@@ -110,6 +114,7 @@ import {
110114
## Exports for bun-query-builder Integration
111115

112116
### Core Exports
117+
113118
```typescript
114119
// dynamodb-tooling/index.ts exports for bun-query-builder:
115120

@@ -150,6 +155,7 @@ export { RelationshipResolver } from './single-table/RelationshipResolver'
150155
## Implemented Features Summary
151156

152157
### Core Features
158+
153159
- **DynamoDB Model ORM** - Laravel-style query builder with `where()`, `with()`, `orderBy()`
154160
- **Single-Table Design** - Automatic pk/sk pattern generation from model definitions
155161
- **Model Parser** - Parses Stacks model files and extracts metadata
@@ -161,13 +167,15 @@ export { RelationshipResolver } from './single-table/RelationshipResolver'
161167
- **Relationship Resolver** - Handles hasOne, hasMany, belongsTo, belongsToMany
162168

163169
### Infrastructure
170+
164171
- **Migrations** - Schema generation, diffing, and migrations
165172
- **Factories** - Generate fake data for testing
166173
- **Seeders** - Populate database with test data
167174
- **CLI Tools** - Full CLI for table management, migrations, seeding
168175
- **DynamoDB Local** - Built-in support with Docker option
169176

170177
### Advanced Features
178+
171179
- **Multi-Tenancy** - Tenant isolation strategies (table, prefix, attribute)
172180
- **Validation** - Sync and async validation with ts-validation integration
173181
- **Streams** - DynamoDB Streams processing

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ dbtooling migrate:rollback
298298
```
299299

300300
The migration system handles:
301+
301302
- Table creation with pk/sk
302303
- GSI creation/deletion
303304
- LSI configuration

docs/batch-operations.md

Lines changed: 0 additions & 183 deletions
Original file line numberDiff line numberDiff line change
@@ -2,189 +2,6 @@
22
title: Batch Operations
33
description: Perform efficient bulk read and write operations with DynamoDB Tooling.
44
---
5-
6-
# Batch Operations
7-
8-
DynamoDB Tooling provides efficient batch operations for bulk reads and writes, handling DynamoDB's limits and throttling automatically.
9-
10-
## Batch Get
11-
12-
Retrieve multiple items efficiently:
13-
14-
```ts
15-
import { User } from './models/User'
16-
17-
// Get multiple items by ID
18-
const users = await User.batchGet([
19-
'user-1',
20-
'user-2',
21-
'user-3',
22-
])
23-
24-
// With consistent read
25-
const users = await User.batchGet(['user-1', 'user-2'], {
26-
consistentRead: true,
27-
})
28-
29-
// With projection
30-
const users = await User.batchGet(['user-1', 'user-2'], {
31-
projection: ['id', 'name', 'email'],
32-
})
33-
```
34-
35-
### Cross-Model Batch Get
36-
37-
Retrieve items from multiple models:
38-
39-
```ts
40-
import { batchGet } from 'dynamodb-tooling'
41-
42-
const results = await batchGet([
43-
{ model: User, keys: ['user-1', 'user-2'] },
44-
{ model: Post, keys: ['post-1', 'post-2'] },
45-
{ model: Comment, keys: ['comment-1'] },
46-
])
47-
48-
console.log(results.users) // User[]
49-
console.log(results.posts) // Post[]
50-
console.log(results.comments) // Comment[]
51-
```
52-
53-
### Handling Large Batches
54-
55-
DynamoDB limits batch get to 100 items. The library handles this automatically:
56-
57-
```ts
58-
// Automatically splits into multiple requests
59-
const users = await User.batchGet(arrayOf500UserIds)
60-
61-
// With custom concurrency
62-
const users = await User.batchGet(arrayOf500UserIds, {
63-
concurrency: 5, // Number of parallel requests
64-
})
65-
```
66-
67-
## Batch Write
68-
69-
Write multiple items efficiently:
70-
71-
```ts
72-
// Batch create
73-
await User.batchCreate([
74-
{ email: 'user1@example.com', name: 'User 1' },
75-
{ email: 'user2@example.com', name: 'User 2' },
76-
{ email: 'user3@example.com', name: 'User 3' },
77-
])
78-
79-
// Batch update
80-
await User.batchUpdate([
81-
{ id: 'user-1', status: 'active' },
82-
{ id: 'user-2', status: 'active' },
83-
{ id: 'user-3', status: 'inactive' },
84-
])
85-
86-
// Batch delete
87-
await User.batchDelete(['user-1', 'user-2', 'user-3'])
88-
```
89-
90-
### Mixed Batch Operations
91-
92-
Combine different operations in one batch:
93-
94-
```ts
95-
import { batchWrite } from 'dynamodb-tooling'
96-
97-
await batchWrite([
98-
{ type: 'put', model: User, item: { id: 'user-new', name: 'New User' } },
99-
{ type: 'put', model: Post, item: { id: 'post-new', title: 'New Post' } },
100-
{ type: 'delete', model: User, key: 'user-old' },
101-
{ type: 'delete', model: Comment, key: 'comment-old' },
102-
])
103-
```
104-
105-
### Handling Large Writes
106-
107-
DynamoDB limits batch write to 25 items:
108-
109-
```ts
110-
// Automatically splits into multiple requests
111-
await User.batchCreate(arrayOf1000Users)
112-
113-
// With retry handling for unprocessed items
114-
await User.batchCreate(arrayOf1000Users, {
115-
retryUnprocessed: true,
116-
retryDelay: 100, // ms
117-
maxRetries: 5,
118-
})
119-
```
120-
121-
## Transactions
122-
123-
For atomic operations across multiple items:
124-
125-
### Transaction Write
126-
127-
```ts
128-
import { transactWrite } from 'dynamodb-tooling'
129-
130-
await transactWrite([
131-
{
132-
type: 'put',
133-
model: User,
134-
item: { id: 'user-1', name: 'John', balance: 100 },
135-
},
136-
{
137-
type: 'update',
138-
model: Account,
139-
key: 'account-1',
140-
update: { balance: { $add: -50 } },
141-
},
142-
{
143-
type: 'conditionCheck',
144-
model: Order,
145-
key: 'order-1',
146-
condition: { status: 'pending' },
147-
},
148-
{
149-
type: 'delete',
150-
model: TempRecord,
151-
key: 'temp-1',
152-
},
153-
])
154-
```
155-
156-
### Transaction Get
157-
158-
```ts
159-
import { transactGet } from 'dynamodb-tooling'
160-
161-
const [user, account, order] = await transactGet([
162-
{ model: User, key: 'user-1' },
163-
{ model: Account, key: 'account-1' },
164-
{ model: Order, key: 'order-1' },
165-
])
166-
```
167-
168-
### Idempotent Transactions
169-
170-
Use client tokens for idempotency:
171-
172-
```ts
173-
await transactWrite([
174-
// ... operations
175-
], {
176-
clientRequestToken: 'unique-request-id-123',
177-
})
178-
```
179-
180-
## Bulk Import
181-
182-
For large-scale data imports:
183-
184-
```ts
185-
import { createDataImporter } from 'dynamodb-tooling'
186-
187-
const importer = createDataImporter({
1885
tableName: 'MyApp',
1896
batchSize: 25,
1907
concurrency: 5,

docs/guide/local.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,12 @@ services:
222222
image: amazon/dynamodb-local:latest
223223
container_name: dynamodb-local
224224
ports:
225+
225226
- "8000:8000"
227+
226228
command: ["-jar", "DynamoDBLocal.jar", "-sharedDb", "-dbPath", "/data"]
227229
volumes:
230+
228231
- dynamodb-data:/data
229232

230233
volumes:

docs/index.md

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,4 @@
11
---
22
title: DynamoDB Tooling - A Complete DynamoDB Toolkit for TypeScript
33
description: Comprehensive DynamoDB toolkit with Laravel-style ORM, single-table design, migrations, and CLI tools.
4-
---
5-
6-
# DynamoDB Tooling
7-
8-
A comprehensive DynamoDB toolkit for TypeScript with automatic single-table design, Laravel-style ORM, migrations, and CLI tools.
9-
10-
<div class="tip custom-block" style="padding-top: 8px">
11-
Define your models once and get automatic key pattern generation, GSI derivation, and a type-safe query experience powered by DynamoDB best practices.
12-
</div>
13-
14-
## Features
15-
16-
- **Laravel-Style ORM** - Familiar query builder with fluent chainable methods
17-
- **Single-Table Design** - Zero-config key patterns with automatic GSI derivation
18-
- **Migrations** - Generate and execute migrations from models with full diff support
19-
- **Factories & Seeders** - Generate fake data for testing
20-
- **DynamoDB Local** - Built-in support for local development
21-
- **Full Type Safety** - Complete TypeScript support with IntelliSense
22-
23-
## Quick Start
24-
25-
```bash
26-
bun add dynamodb-tooling
27-
```
28-
29-
```ts
30-
import { User } from './app/models/User'
31-
32-
// Find by ID
33-
const user = await User.find('123')
34-
35-
// Query with conditions
36-
const users = await User.query()
37-
.where('status', 'active')
38-
.where('age', '>=', 18)
39-
.orderByDesc('createdAt')
40-
.limit(10)
41-
.get()
42-
```
43-
44-
## Documentation
45-
46-
- [Introduction](/intro) - Overview and key concepts
47-
- [Installation](/install) - Getting started guide
48-
- [Table Operations](/table-operations) - Creating and managing tables
49-
- [Query Helpers](/query-helpers) - Fluent query building
50-
- [Batch Operations](/batch-operations) - Efficient bulk operations
51-
- [Local Development](/local-development) - DynamoDB Local setup
52-
53-
## Why DynamoDB Tooling?
54-
55-
DynamoDB Tooling eliminates the complexity of working with DynamoDB by providing a familiar, Laravel-inspired interface while automatically handling single-table design patterns, key generation, and index management.
4+
---

0 commit comments

Comments
 (0)