@exabugs/dynamodb-client 0.3.6 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.md +35 -23
- package/dist/server/handler.cjs +7536 -7401
- package/dist/server/handler.cjs.map +4 -4
- package/dist/server/shadow/config.d.ts +13 -13
- package/dist/server/shadow/config.d.ts.map +1 -1
- package/dist/server/shadow/config.js +10 -10
- package/dist/server/shadow/index.d.ts +2 -1
- package/dist/server/shadow/index.d.ts.map +1 -1
- package/dist/server/shadow/index.js.map +1 -1
- package/dist/server/shadow/types.d.ts +0 -24
- package/dist/server/shadow/types.d.ts.map +1 -1
- package/dist/shadows/differ.d.ts +12 -12
- package/dist/shadows/differ.js +15 -15
- package/dist/shadows/differ.js.map +1 -1
- package/dist/shadows/generator.d.ts +53 -31
- package/dist/shadows/generator.d.ts.map +1 -1
- package/dist/shadows/generator.js +79 -35
- package/dist/shadows/generator.js.map +1 -1
- package/dist/shadows/index.d.ts +8 -10
- package/dist/shadows/index.d.ts.map +1 -1
- package/dist/shadows/index.js +12 -11
- package/dist/shadows/index.js.map +1 -1
- package/dist/shadows/types.d.ts +8 -28
- package/dist/shadows/types.d.ts.map +1 -1
- package/package.json +6 -6
- package/terraform/README.md +8 -7
- package/dist/shadows/config.d.ts +0 -54
- package/dist/shadows/config.d.ts.map +0 -1
- package/dist/shadows/config.js +0 -95
- package/dist/shadows/config.js.map +0 -1
- package/dist/shadows/schema.d.ts +0 -63
- package/dist/shadows/schema.d.ts.map +0 -1
- package/dist/shadows/schema.js +0 -8
- package/dist/shadows/schema.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.3.7] - 2024-12-19
|
|
11
|
+
|
|
12
|
+
### Removed
|
|
13
|
+
|
|
14
|
+
- **BREAKING CHANGE**: Complete removal of legacy shadow configuration support
|
|
15
|
+
- Removed `LegacyShadowConfig` and `ResourceShadowConfig` types from shadows module
|
|
16
|
+
- Removed duplicate shadow configuration types from server module
|
|
17
|
+
- Removed all shadow.config.json file support
|
|
18
|
+
- Only v0.3.x environment variable-based configuration is now supported
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Simplified type exports to only include v0.3.x specification types
|
|
23
|
+
- Updated documentation to reflect complete v0.3.x migration
|
|
24
|
+
- Consolidated shadow configuration to single source (environment variables)
|
|
25
|
+
|
|
26
|
+
### Migration Guide
|
|
27
|
+
|
|
28
|
+
- Replace any usage of `ResourceShadowConfig` or `LegacyShadowConfig` with environment variables
|
|
29
|
+
- Use `SHADOW_CREATED_AT_FIELD`, `SHADOW_UPDATED_AT_FIELD`, `SHADOW_STRING_MAX_BYTES`, `SHADOW_NUMBER_PADDING`
|
|
30
|
+
- Remove any shadow.config.json files from your project
|
|
31
|
+
|
|
10
32
|
## [0.3.6] - 2024-12-02
|
|
11
33
|
|
|
12
34
|
### Changed
|
package/README.md
CHANGED
|
@@ -20,6 +20,24 @@
|
|
|
20
20
|
|
|
21
21
|
---
|
|
22
22
|
|
|
23
|
+
## 📖 Overview
|
|
24
|
+
|
|
25
|
+
**DynamoDB Client SDK** is a TypeScript-first library that brings MongoDB-like simplicity to AWS DynamoDB. Built for modern serverless applications, it provides a familiar API while leveraging DynamoDB's single-table design patterns for optimal performance and cost efficiency.
|
|
26
|
+
|
|
27
|
+
### Why DynamoDB Client SDK?
|
|
28
|
+
|
|
29
|
+
- **🎯 Familiar API**: Use MongoDB-style queries with DynamoDB's power
|
|
30
|
+
- **⚡ Single-Table Design**: Optimized data modeling without the complexity
|
|
31
|
+
- **🔄 Shadow Records**: Efficient sorting without expensive Global Secondary Indexes
|
|
32
|
+
- **🛡️ Type Safety**: Full TypeScript support with compile-time validation
|
|
33
|
+
- **🚀 Serverless Ready**: Built for AWS Lambda with ARM64 optimization
|
|
34
|
+
- **🎨 Admin UI**: Integrated react-admin interface for content management
|
|
35
|
+
- **🏗️ Infrastructure**: Complete Terraform modules for production deployment
|
|
36
|
+
|
|
37
|
+
Perfect for building scalable web applications, content management systems, and serverless APIs that need the performance of DynamoDB with the developer experience of MongoDB.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
23
41
|
## ✨ Features
|
|
24
42
|
|
|
25
43
|
<table>
|
|
@@ -108,9 +126,9 @@ graph TB
|
|
|
108
126
|
C -->|HTTPS| D
|
|
109
127
|
D -->|AWS SDK| E
|
|
110
128
|
|
|
111
|
-
style A fill:#
|
|
112
|
-
style B fill:#
|
|
113
|
-
style C fill:#
|
|
129
|
+
style A fill:#2563eb,stroke:#333,stroke-width:2px,color:#fff
|
|
130
|
+
style B fill:#2563eb,stroke:#333,stroke-width:2px,color:#fff
|
|
131
|
+
style C fill:#2563eb,stroke:#333,stroke-width:2px,color:#fff
|
|
114
132
|
style D fill:#ff9900,stroke:#333,stroke-width:2px
|
|
115
133
|
style E fill:#527fff,stroke:#333,stroke-width:2px
|
|
116
134
|
```
|
|
@@ -141,32 +159,23 @@ This example includes:
|
|
|
141
159
|
### Quick Example
|
|
142
160
|
|
|
143
161
|
```typescript
|
|
144
|
-
// 1. Define
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
},
|
|
153
|
-
resources: {
|
|
154
|
-
articles: {
|
|
155
|
-
resource: 'articles',
|
|
156
|
-
type: {} as Article,
|
|
157
|
-
shadows: { sortableFields: { title: { type: 'string' } } },
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
};
|
|
162
|
+
// 1. Define your data types
|
|
163
|
+
interface Article {
|
|
164
|
+
id: string;
|
|
165
|
+
title: string;
|
|
166
|
+
content: string;
|
|
167
|
+
createdAt: string;
|
|
168
|
+
updatedAt: string;
|
|
169
|
+
}
|
|
161
170
|
|
|
162
171
|
// 2. Deploy with Terraform (see dynamodb-client-example)
|
|
163
172
|
// terraform apply
|
|
164
173
|
|
|
165
174
|
// 3. Use the client
|
|
166
175
|
const client = new DynamoClient(FUNCTION_URL);
|
|
167
|
-
const articles = client.db().collection('articles');
|
|
176
|
+
const articles = client.db().collection<Article>('articles');
|
|
168
177
|
|
|
169
|
-
await articles.insertOne({ title: 'Hello DynamoDB' });
|
|
178
|
+
await articles.insertOne({ title: 'Hello DynamoDB', content: 'Getting started...' });
|
|
170
179
|
const article = await articles.findOne({ title: 'Hello DynamoDB' });
|
|
171
180
|
```
|
|
172
181
|
|
|
@@ -295,16 +304,19 @@ const record = {
|
|
|
295
304
|
};
|
|
296
305
|
|
|
297
306
|
// Automatically generates shadow records:
|
|
298
|
-
// - id#01HQXYZ123#id#01HQXYZ123
|
|
299
307
|
// - title#Article#id#01HQXYZ123
|
|
300
308
|
// - viewCount#1000000000000123#id#01HQXYZ123
|
|
301
309
|
// - published#1#id#01HQXYZ123
|
|
302
310
|
// - tags#["aws","tech"]#id#01HQXYZ123
|
|
303
311
|
// - metadata#{"category":"tech"}#id#01HQXYZ123
|
|
312
|
+
//
|
|
313
|
+
// Note: 'id' field does NOT generate a shadow record
|
|
314
|
+
// Main record (SK = id#01HQXYZ123) is used for id-based sorting
|
|
304
315
|
```
|
|
305
316
|
|
|
306
317
|
### Exclusion Rules
|
|
307
318
|
|
|
319
|
+
- **`id` field is excluded** - Main record (`SK = id#{ULID}`) is used for id-based sorting
|
|
308
320
|
- Fields starting with `__` are excluded (internal metadata)
|
|
309
321
|
- `null` or `undefined` values are excluded
|
|
310
322
|
|