@exabugs/dynamodb-client 0.3.5 → 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.
Files changed (39) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +35 -23
  3. package/dist/server/handler.cjs +7539 -7401
  4. package/dist/server/handler.cjs.map +4 -4
  5. package/dist/server/shadow/config.d.ts +13 -13
  6. package/dist/server/shadow/config.d.ts.map +1 -1
  7. package/dist/server/shadow/config.js +10 -10
  8. package/dist/server/shadow/generator.d.ts +1 -1
  9. package/dist/server/shadow/generator.d.ts.map +1 -1
  10. package/dist/server/shadow/generator.js +5 -1
  11. package/dist/server/shadow/generator.js.map +1 -1
  12. package/dist/server/shadow/index.d.ts +2 -1
  13. package/dist/server/shadow/index.d.ts.map +1 -1
  14. package/dist/server/shadow/index.js.map +1 -1
  15. package/dist/server/shadow/types.d.ts +0 -24
  16. package/dist/server/shadow/types.d.ts.map +1 -1
  17. package/dist/shadows/differ.d.ts +12 -12
  18. package/dist/shadows/differ.js +15 -15
  19. package/dist/shadows/differ.js.map +1 -1
  20. package/dist/shadows/generator.d.ts +53 -31
  21. package/dist/shadows/generator.d.ts.map +1 -1
  22. package/dist/shadows/generator.js +79 -35
  23. package/dist/shadows/generator.js.map +1 -1
  24. package/dist/shadows/index.d.ts +8 -10
  25. package/dist/shadows/index.d.ts.map +1 -1
  26. package/dist/shadows/index.js +12 -11
  27. package/dist/shadows/index.js.map +1 -1
  28. package/dist/shadows/types.d.ts +8 -28
  29. package/dist/shadows/types.d.ts.map +1 -1
  30. package/package.json +6 -6
  31. package/terraform/README.md +8 -7
  32. package/dist/shadows/config.d.ts +0 -54
  33. package/dist/shadows/config.d.ts.map +0 -1
  34. package/dist/shadows/config.js +0 -95
  35. package/dist/shadows/config.js.map +0 -1
  36. package/dist/shadows/schema.d.ts +0 -63
  37. package/dist/shadows/schema.d.ts.map +0 -1
  38. package/dist/shadows/schema.js +0 -8
  39. package/dist/shadows/schema.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,38 @@ 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
+
32
+ ## [0.3.6] - 2024-12-02
33
+
34
+ ### Changed
35
+
36
+ - **Shadow Records**: Exclude `id` field from shadow record generation
37
+ - `id` field no longer generates a shadow record
38
+ - Main record (`SK = id#{ULID}`) is used for id-based sorting
39
+ - Reduces redundant shadow records and improves performance
40
+ - `find()` operation already optimized to use main records for id sorting
41
+
10
42
  ## [0.3.5] - 2024-12-02
11
43
 
12
44
  ### 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:#61dafb,stroke:#333,stroke-width:2px
112
- style B fill:#61dafb,stroke:#333,stroke-width:2px
113
- style C fill:#61dafb,stroke:#333,stroke-width:2px
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 schema
145
- export const MySchema: SchemaRegistryConfig = {
146
- database: {
147
- name: 'myapp',
148
- timestamps: {
149
- createdAt: 'createdAt',
150
- updatedAt: 'updatedAt',
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