dynamo-bao 0.7.3 → 0.8.1

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 ADDED
@@ -0,0 +1,514 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+ Each version heading links to the tag that was published to npm. Entries before
8
+ 0.4.0 were reconstructed from commit history after the fact and are brief.
9
+
10
+ ## [Unreleased]
11
+
12
+ ## [0.8.1] - 2026-10-27
13
+
14
+ ### Fixed
15
+
16
+ - `update()` on a model with a GSI that uses `modelPrefix` as one half of its
17
+ key threw "Update includes GSI partition key modelPrefix but is missing sort
18
+ key" unless the update also carried the other half. 0.8.0 stopped
19
+ pre-reading the row on plain updates, and the partial-key guard
20
+ then treated the constant half as a newly provided key. The index is now
21
+ skipped when the field half is not in the update, since its key cannot
22
+ change. Plain field and counter updates on such models stay at one
23
+ `UpdateItem`. Models with a `modelPrefix` primary key behave the same in
24
+ `legacy` and `tenant-scoped` modes; `migrating` mode still reads first
25
+ because it writes in place.
26
+
27
+ ## [0.8.0] - 2026-10-27
28
+
29
+ Cuts DynamoDB round trips and per-item CPU in the core read and write paths.
30
+ No key formats, index keys or constraint rows change.
31
+
32
+ ### Changed
33
+
34
+ - `find()` in a batch context now flushes on the next tick (`setImmediate`)
35
+ instead of waiting for a 5 ms timer. Finds issued in the same tick still
36
+ share one `BatchGetItem`. Pass `batchDelay: <ms>` to keep a timer window, or
37
+ `batchDelay: 0` to send a single `GetItem` immediately.
38
+ - `update()` no longer reads the item before writing unless the update needs
39
+ the current row: a touched GSI key, string set, unique constraint, searchable
40
+ field, `forceReindex`, or a model in `migrating` key mode. Otherwise it sends
41
+ one conditional `UpdateItem` guarded by `attribute_exists`, and a missing row
42
+ raises `ItemNotFoundError` as before.
43
+ - `delete()` on a model without unique constraints is a single conditional
44
+ `DeleteItem`. Models with unique constraints still read first so the
45
+ constraint rows can be removed in the same transaction.
46
+ - Updates of unique-constraint fields that use plain `SET` no longer read the
47
+ item back after the transaction. Only atomic `ADD`/`DELETE` updates do.
48
+ - `batchFind()` sends its 100-key chunks concurrently (up to 5 in flight) and
49
+ returns the cached instance for ids already in the request cache.
50
+ - `iterateAll()` prefetches the next page while the current page is being
51
+ hydrated, and accepts `concurrency` to walk several iteration buckets in
52
+ parallel.
53
+ - Items loaded from DynamoDB skip constructor work they do not need: no system
54
+ field copy, no initial values. Field getters and setters are defined once on
55
+ the model prototype instead of on every instance.
56
+ - Debug logging no longer builds its arguments unless debug output is enabled.
57
+ Several misdirected `logger.log` calls in the query and field code were fixed
58
+ or removed. "Models initialized" is logged at debug level instead of info.
59
+ - Expected condition failures (`ConditionalCheckFailedException`, cancelled
60
+ transactions) are logged at debug level. Only unexpected save errors are
61
+ logged at error level, once.
62
+
63
+ ### Fixed
64
+
65
+ - `find()` with an object primary id in a batch context could resolve to
66
+ `ObjectNotFound`. Object and string forms of the same id now share one batch
67
+ entry.
68
+ - `create()` with a `$and` condition produced a "redundant parentheses"
69
+ `ValidationException`.
70
+
71
+ ### Removed
72
+
73
+ - The `DEFAULT_BATCH_DELAY_MS` export. The default is no longer a delay.
74
+
75
+ ### Internal
76
+
77
+ - A batch's `timer` property is now a cancel function rather than a timeout
78
+ handle. Tests that cleared it with `clearTimeout` should call it instead.
79
+ - `Logger` gained `isLevelEnabled(level)` and `isDebugEnabled()`.
80
+
81
+ ## [0.7.3] - 2026-10-27
82
+
83
+ ### Changed
84
+
85
+ - Raised the `js-yaml` minimum to `^4.3.2`, which fixes four quadratic-CPU
86
+ advisories (GHSA-h67p-54hq-rp68, GHSA-52cp-r559-cp3m, GHSA-5p4m-2wfm-xmqj,
87
+ GHSA-2883-xcg3-v3hh). It is the only runtime dependency that was flagged and
88
+ is used only by `bao-codegen`. (#16)
89
+ - Applied `npm audit fix` to dev-only transitive dependencies. (#16)
90
+ - Switched the generated docs from `clean-jsdoc-theme` to `docdash` with a
91
+ custom stylesheet, dark mode and no build-date footer. Source pages on
92
+ GitHub Pages lost their `src_` prefix and test helpers no longer appear
93
+ under "Global". (#17)
94
+
95
+ ## [0.7.2] - 2026-10-27
96
+
97
+ ### Fixed
98
+
99
+ - `update()` with an object primary id on an iterable model failed with
100
+ "Type mismatch for Index Key" on `_iter_sk`. The id is now converted to its
101
+ string form first, which also stops an object id from being stored as the
102
+ owner on a unique-constraint row. (#15)
103
+ - Relative counter values such as `"+3"` on a counter used in an index key
104
+ were written into the key as the literal string. Creates now write the
105
+ number. Updates write loaded value plus delta, guarded by a condition on the
106
+ loaded value; a concurrent change raises `ConditionalError`. Counters in no
107
+ index keep the atomic `ADD`. (#15)
108
+ - `npm publish` warned about every `bin` entry. The leading `./` was removed
109
+ and the repository URL normalised. (#15)
110
+
111
+ ## [0.7.1] - 2026-10-27
112
+
113
+ ### Changed
114
+
115
+ - `create()` on a model with unique constraints takes one DynamoDB call
116
+ instead of three. The uniqueness read before the transaction is gone (the
117
+ constraint `Put` already carries `attribute_not_exists`) and the new item is
118
+ built in memory instead of read back. A duplicate create now costs the
119
+ cancelled transaction plus one read to name the field. (#14)
120
+ - `find(id, { bypassCache: true })` always issues its own `GetItem` and never
121
+ joins a batch. (#14)
122
+ - Capacity reported on update results no longer includes earlier operations'
123
+ capacity, so `getBatchContextCapacity()` equals what DynamoDB returned. (#14)
124
+ - Explicit `keyMigration.modelPrefixPkMode` is required to enable key
125
+ migration.
126
+
127
+ ### Fixed
128
+
129
+ - Request-scoped loader cache: creates and updates store the written row and
130
+ deletes remove it, so a `find` later in the same request no longer returns
131
+ stale data. An update that changed a unique field used to return the
132
+ pre-update row. (#14)
133
+ - Cache keys now include the model and tenant. `ModelB.find(id)` could return
134
+ a `ModelA` row with the same id, and after a tenant switch inside one request
135
+ the second tenant could get the first tenant's cached row. (#14)
136
+ - Batches are grouped per tenant. Parallel finds from two tenants in one batch
137
+ window were resolved with the first caller's tenant keys. (#14)
138
+ - A `{ pk, sk }` object id and its string form share one cache entry. (#14)
139
+ - Models with a field named `pk` can be created. (#14)
140
+ - `save({ condition })` on a new instance combines the caller's condition with
141
+ the does-not-exist guard instead of replacing it. (#14)
142
+ - `DateTimeField` accepts `null` to clear the field. (#14)
143
+
144
+ ## [0.7.0] - 2026-06-04
145
+
146
+ ### Added
147
+
148
+ - Opt-in tenant scoping for models whose primary key partition is the model
149
+ prefix, with a safe expand, migrate, contract rollout controlled by
150
+ `keyMigration.modelPrefixPkMode` (`legacy`, `migrating`, `tenant-scoped`).
151
+ The default `legacy` mode is byte-identical to earlier behaviour. In
152
+ `migrating` mode reads fall back to both historical key shapes, updates
153
+ write in place guarded by `attribute_exists`, and legacy-fallback reads
154
+ report their consumed capacity. (#13)
155
+ - `PutCommand` on the DynamoDB client, used by backfill relocation. (#13)
156
+
157
+ ### Changed
158
+
159
+ - The batch resolver sums every `ConsumedCapacity` entry, fixing an undercount
160
+ for multi-page batch reads over 100 items. (#13)
161
+ - Search iteration index capacity is accounted for.
162
+
163
+ ## [0.6.1] - 2026-05-27
164
+
165
+ ### Fixed
166
+
167
+ - Tenant key formatting for models with a model-prefix partition key. This
168
+ change was effectively reverted by the migration path in 0.7.0: it scoped
169
+ the key atomically with no migration, which stranded existing rows for
170
+ by-id reads. Upgrade to 0.7.0 or later rather than to this version.
171
+
172
+ ### Changed
173
+
174
+ - Tightened the `formidable` dev dependency range.
175
+
176
+ ## [0.6.0] - 2026-05-08
177
+
178
+ ### Added
179
+
180
+ - `_searchText` is a first-class filter target. Use `$contains`,
181
+ `$beginsWith`, `$eq`, `$ne` or `$exists` on it in `query`, `queryByIndex`,
182
+ `iterateAll({ filter })` and condition expressions; the value is normalised
183
+ with the model's `searchConfig`. (#11)
184
+ - `SECURITY.md` documenting an audit finding in the docs theme's `showdown`
185
+ dependency (not exploitable in this project's threat model). (#11)
186
+
187
+ ### Fixed
188
+
189
+ - `minTermLength` applied only at write time. Short query terms were sent to
190
+ DynamoDB verbatim and silently matched nothing. They are now dropped from
191
+ the predicate, and an error is raised if every term is dropped. (#11)
192
+
193
+ ## [0.5.0] - 2026-05-06
194
+
195
+ ### Added
196
+
197
+ - Searchable iterable models. A declarative `searchable: { fields: [...] }`
198
+ block in the model YAML populates a normalised `_searchText` attribute on
199
+ every save, with `caseSensitive`, `minTermLength` and `dedupe` options.
200
+ (#10)
201
+ - `Model.searchAll(terms, options)` and
202
+ `Model.searchBucket(bucketNum, terms, options)` async generators, with
203
+ `$and` (default) or `$or` term matching, and
204
+ `Model.tokenizeSearchQuery(query)` that respects quoted phrases. (#10)
205
+ - A new `iter_search_index` GSI replaces the legacy `iter_index` for
206
+ iteration and search. `bao-update-table` adds it to existing tables; the
207
+ legacy index is left in place for manual removal. The
208
+ `db.iterationIndexName` config override keeps iteration on the legacy index
209
+ during a transition. (#10)
210
+ - `bao-rebuild-search-text <ModelName>` CLI for backfilling `_searchText`.
211
+ (#10)
212
+ - Codegen validates `searchable.fields` against existing string fields. (#10)
213
+
214
+ ## [0.4.2] - 2026-03-31
215
+
216
+ ### Fixed
217
+
218
+ - Generated code imports `dynamo-bao` by bare package specifier instead of a
219
+ relative path.
220
+
221
+ ### Changed
222
+
223
+ - `bao-create-table` is documented.
224
+
225
+ ## [0.4.1] - 2026-03-31
226
+
227
+ ### Added
228
+
229
+ - `bao-create-table` command. The bin scripts were cleaned up alongside it.
230
+
231
+ ### Fixed
232
+
233
+ - Flaky pagination tests caused by GSI eventual consistency.
234
+ - A `form-data` vulnerability in a dev dependency.
235
+
236
+ ## [0.4.0] - 2026-02-16
237
+
238
+ ### Added
239
+
240
+ - Support for five GSIs (`gsi4` and `gsi5`), previously three. The table
241
+ creation script provisions them. (#8)
242
+ - `bao-update-table` command to add missing GSIs and enable TTL on an existing
243
+ table. (#8)
244
+
245
+ ### Changed
246
+
247
+ - Partial updates to one half of a GSI key pair backfill the other half from
248
+ the stored item so the index does not go stale. If the counterpart was never
249
+ stored, the update throws with guidance to include both fields or use
250
+ `forceReindex`. (#8)
251
+ - `forceReindex` recomputes every GSI key from the current item and preserves
252
+ the new values. (#8)
253
+ - Table creation enables TTL via `UpdateTimeToLive` after the table is active
254
+ instead of inline. (#8)
255
+
256
+ ## [0.3.9] - 2026-01-25
257
+
258
+ ### Added
259
+
260
+ - `getBatchContextCapacity()` returns the total read and write capacity
261
+ consumed by every operation inside the current `runWithBatchContext` scope,
262
+ for per-request usage metering. (#7)
263
+
264
+ ## [0.3.8] - 2025-12-17
265
+
266
+ ### Fixed
267
+
268
+ - A `const` declaration error introduced in 0.3.7.
269
+
270
+ ## [0.3.7] - 2025-12-17
271
+
272
+ ### Fixed
273
+
274
+ - Unique constraints on a field whose value is `null`.
275
+
276
+ ## [0.3.6] - 2025-12-17
277
+
278
+ ### Changed
279
+
280
+ - More robust retries after a transactional write.
281
+
282
+ ### Removed
283
+
284
+ - The `serverless` dependency.
285
+
286
+ ## [0.3.5] - 2025-10-22
287
+
288
+ ### Added
289
+
290
+ - `forceReindex` option on updates.
291
+
292
+ ## [0.3.4] - 2025-07-26
293
+
294
+ ### Changed
295
+
296
+ - The log level is read from `DYNAMO_BAO_LOG_LEVEL` rather than `LOG_LEVEL`.
297
+
298
+ ## [0.3.3] - 2025-07-24
299
+
300
+ ### Fixed
301
+
302
+ - A logging issue.
303
+
304
+ ## [0.3.2] - 2025-07-16
305
+
306
+ ### Changed
307
+
308
+ - Better syntax for string sets.
309
+
310
+ ## [0.3.1] - 2025-07-15
311
+
312
+ ### Added
313
+
314
+ - `StringSetField`.
315
+
316
+ ### Fixed
317
+
318
+ - A pagination test.
319
+
320
+ ## [0.3.0] - 2025-06-26
321
+
322
+ ### Added
323
+
324
+ - `runWithBatchContext()` and request-scoped batching and caching of finds.
325
+
326
+ ## [0.2.12] - 2025-06-25
327
+
328
+ ### Added
329
+
330
+ - Isolated-context batch loading.
331
+
332
+ ## [0.2.11] - 2025-06-23
333
+
334
+ ### Fixed
335
+
336
+ - An import issue in the create-table script.
337
+
338
+ ## [0.2.10] - 2025-06-17
339
+
340
+ ### Added
341
+
342
+ - Composite keys on `delete`.
343
+
344
+ ## [0.2.9] - 2025-06-17
345
+
346
+ ### Added
347
+
348
+ - Basic ESM support.
349
+
350
+ ## [0.2.8] - 2025-06-16
351
+
352
+ ### Added
353
+
354
+ - Cloudflare Workers support.
355
+
356
+ ## [0.2.7] - 2025-06-16
357
+
358
+ ### Added
359
+
360
+ - CommonJS config files.
361
+
362
+ ## [0.2.6] - 2025-06-16
363
+
364
+ ### Fixed
365
+
366
+ - Codegen fixes.
367
+
368
+ ## [0.2.5] - 2025-06-16
369
+
370
+ ### Changed
371
+
372
+ - Model discovery no longer uses `fs.readdirSync`.
373
+
374
+ ## [0.2.4] - 2025-06-16
375
+
376
+ ### Fixed
377
+
378
+ - An error when the custom field directory does not exist.
379
+ - Added a multi-tenant test for indexes.
380
+
381
+ ## [0.2.3] - 2025-06-12
382
+
383
+ ### Changed
384
+
385
+ - Documentation for iteration.
386
+
387
+ ## [0.2.2] - 2025-06-12
388
+
389
+ ### Added
390
+
391
+ - Multi-tenancy.
392
+ - Basic iteration over all items of a model.
393
+
394
+ ## [0.2.1] - 2025-06-10
395
+
396
+ ### Fixed
397
+
398
+ - `chokidar` restored as a dependency for the watcher.
399
+
400
+ ## [0.2.0] - 2025-06-10
401
+
402
+ ### Changed
403
+
404
+ - The DynamoDB client is a custom implementation on `aws4fetch` instead of
405
+ the AWS SDK. Dependencies were cleaned up accordingly.
406
+
407
+ ## [0.1.8] - 2025-06-03
408
+
409
+ ### Changed
410
+
411
+ - Version bump only.
412
+
413
+ ## [0.1.7] - 2025-06-03
414
+
415
+ ### Fixed
416
+
417
+ - `exists()`.
418
+
419
+ ### Changed
420
+
421
+ - Library updates and more error types.
422
+
423
+ ## [0.1.6] - 2025-01-30
424
+
425
+ ### Added
426
+
427
+ - Conditional saves and deletes, including exists / does-not-exist
428
+ conditions.
429
+
430
+ ### Changed
431
+
432
+ - Optimised delete. Old save constraint options removed.
433
+
434
+ ## [0.1.5] - 2025-01-29
435
+
436
+ ### Fixed
437
+
438
+ - Primary key naming.
439
+
440
+ ## [0.1.4] - 2025-01-29
441
+
442
+ ### Changed
443
+
444
+ - Config standardisation and codegen updates.
445
+
446
+ ## [0.1.3] - 2025-01-10
447
+
448
+ ### Added
449
+
450
+ - Basic tutorials and the LICENSE file.
451
+
452
+ ## [0.1.2] - 2025-01-08
453
+
454
+ ### Changed
455
+
456
+ - Simplified config setup.
457
+
458
+ ## [0.1.1] - 2024-12-20
459
+
460
+ ### Changed
461
+
462
+ - Documentation updates.
463
+
464
+ ## [0.1.0] - 2024-12-20
465
+
466
+ Initial release: single-table models with fields, GSIs, unique constraints,
467
+ related fields, counters, TTL, filters, pagination, batch loading, hooks,
468
+ YAML codegen and a table creation tool.
469
+
470
+ [Unreleased]: https://github.com/aag1024/dynamo-bao/compare/v0.8.1...HEAD
471
+ [0.8.1]: https://github.com/aag1024/dynamo-bao/compare/v0.8.0...v0.8.1
472
+ [0.8.0]: https://github.com/aag1024/dynamo-bao/compare/v0.7.3...v0.8.0
473
+ [0.7.3]: https://github.com/aag1024/dynamo-bao/compare/v0.7.2...v0.7.3
474
+ [0.7.2]: https://github.com/aag1024/dynamo-bao/compare/v0.7.1...v0.7.2
475
+ [0.7.1]: https://github.com/aag1024/dynamo-bao/compare/v0.7.0...v0.7.1
476
+ [0.7.0]: https://github.com/aag1024/dynamo-bao/compare/v0.6.1...v0.7.0
477
+ [0.6.1]: https://github.com/aag1024/dynamo-bao/compare/v0.6.0...v0.6.1
478
+ [0.6.0]: https://github.com/aag1024/dynamo-bao/compare/v0.5.0...v0.6.0
479
+ [0.5.0]: https://github.com/aag1024/dynamo-bao/compare/v0.4.2...v0.5.0
480
+ [0.4.2]: https://github.com/aag1024/dynamo-bao/compare/v0.4.1...v0.4.2
481
+ [0.4.1]: https://github.com/aag1024/dynamo-bao/compare/v0.4.0...v0.4.1
482
+ [0.4.0]: https://github.com/aag1024/dynamo-bao/compare/v0.3.9...v0.4.0
483
+ [0.3.9]: https://github.com/aag1024/dynamo-bao/compare/v0.3.8...v0.3.9
484
+ [0.3.8]: https://github.com/aag1024/dynamo-bao/compare/v0.3.7...v0.3.8
485
+ [0.3.7]: https://github.com/aag1024/dynamo-bao/compare/v0.3.6...v0.3.7
486
+ [0.3.6]: https://github.com/aag1024/dynamo-bao/compare/v0.3.5...v0.3.6
487
+ [0.3.5]: https://github.com/aag1024/dynamo-bao/compare/v0.3.4...v0.3.5
488
+ [0.3.4]: https://github.com/aag1024/dynamo-bao/compare/v0.3.3...v0.3.4
489
+ [0.3.3]: https://github.com/aag1024/dynamo-bao/compare/v0.3.2...v0.3.3
490
+ [0.3.2]: https://github.com/aag1024/dynamo-bao/compare/v0.3.1...v0.3.2
491
+ [0.3.1]: https://github.com/aag1024/dynamo-bao/compare/v0.3.0...v0.3.1
492
+ [0.3.0]: https://github.com/aag1024/dynamo-bao/compare/v0.2.12...v0.3.0
493
+ [0.2.12]: https://github.com/aag1024/dynamo-bao/compare/v0.2.11...v0.2.12
494
+ [0.2.11]: https://github.com/aag1024/dynamo-bao/compare/v0.2.10...v0.2.11
495
+ [0.2.10]: https://github.com/aag1024/dynamo-bao/compare/v0.2.9...v0.2.10
496
+ [0.2.9]: https://github.com/aag1024/dynamo-bao/compare/v0.2.8...v0.2.9
497
+ [0.2.8]: https://github.com/aag1024/dynamo-bao/compare/v0.2.7...v0.2.8
498
+ [0.2.7]: https://github.com/aag1024/dynamo-bao/compare/v0.2.6...v0.2.7
499
+ [0.2.6]: https://github.com/aag1024/dynamo-bao/compare/v0.2.5...v0.2.6
500
+ [0.2.5]: https://github.com/aag1024/dynamo-bao/compare/v0.2.4...v0.2.5
501
+ [0.2.4]: https://github.com/aag1024/dynamo-bao/compare/v0.2.3...v0.2.4
502
+ [0.2.3]: https://github.com/aag1024/dynamo-bao/compare/v0.2.2...v0.2.3
503
+ [0.2.2]: https://github.com/aag1024/dynamo-bao/compare/v0.2.1...v0.2.2
504
+ [0.2.1]: https://github.com/aag1024/dynamo-bao/compare/v0.2.0...v0.2.1
505
+ [0.2.0]: https://github.com/aag1024/dynamo-bao/compare/v0.1.8...v0.2.0
506
+ [0.1.8]: https://github.com/aag1024/dynamo-bao/compare/v0.1.7...v0.1.8
507
+ [0.1.7]: https://github.com/aag1024/dynamo-bao/compare/v0.1.6...v0.1.7
508
+ [0.1.6]: https://github.com/aag1024/dynamo-bao/compare/v0.1.5...v0.1.6
509
+ [0.1.5]: https://github.com/aag1024/dynamo-bao/compare/v0.1.4...v0.1.5
510
+ [0.1.4]: https://github.com/aag1024/dynamo-bao/compare/v0.1.3...v0.1.4
511
+ [0.1.3]: https://github.com/aag1024/dynamo-bao/compare/v0.1.2...v0.1.3
512
+ [0.1.2]: https://github.com/aag1024/dynamo-bao/compare/v0.1.1...v0.1.2
513
+ [0.1.1]: https://github.com/aag1024/dynamo-bao/compare/v0.1.0...v0.1.1
514
+ [0.1.0]: https://github.com/aag1024/dynamo-bao/releases/tag/v0.1.0
package/README.md CHANGED
@@ -8,6 +8,8 @@ DynamoBao is a simple lightweight library for building DynamoDB models in JavaSc
8
8
  DynamoDB for years and generally love it, but find getting started difficult and repetitive.
9
9
  DynamoBao is the tool I wish I had when I started.
10
10
 
11
+ Release notes are in [CHANGELOG.md](https://github.com/aag1024/dynamo-bao/blob/main/CHANGELOG.md).
12
+
11
13
  ## Principles
12
14
 
13
15
  - Expose just enough of Dynamo's features to make it easy to model many common types of data.
@@ -409,7 +411,13 @@ try {
409
411
 
410
412
  This convenience comes at a cost: every `create`, `update`, or `delete` operation on an iterable model requires a second write to the database to maintain the iteration index. This doubles the write cost for every item.
411
413
 
412
- To prevent "hot partitions" on large models, the iteration index is automatically split into 10 "buckets" or partitions. The `iterateAll()` method handles fetching from all buckets seamlessly.
414
+ To prevent "hot partitions" on large models, the iteration index is automatically split into 10 "buckets" or partitions. The `iterateAll()` method handles fetching from all buckets seamlessly. Within a bucket it fetches the next page of keys while the current page is being loaded. Buckets are read one at a time by default; pass `concurrency` to read several at once for bulk jobs (batches from different buckets are then interleaved):
415
+
416
+ ```javascript
417
+ for await (const batch of User.iterateAll({ batchSize: 100, concurrency: 4 })) {
418
+ // ...
419
+ }
420
+ ```
413
421
 
414
422
  **Default**
415
423
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dynamo-bao",
3
- "version": "0.7.3",
3
+ "version": "0.8.1",
4
4
  "description": "Simple powerful data modeling primitives for DynamoDB in JavaScript.",
5
5
  "main": "src/index.js",
6
6
  "exports": {
@@ -18,7 +18,8 @@
18
18
  "files": [
19
19
  "bin/",
20
20
  "src/",
21
- "README.md"
21
+ "README.md",
22
+ "CHANGELOG.md"
22
23
  ],
23
24
  "keywords": [
24
25
  "dynamodb",
@@ -3,6 +3,22 @@ const fs = require('fs');
3
3
  const path = require('path');
4
4
  const os = require('os');
5
5
 
6
+ const OPERATION_NAMES = {
7
+ 'GetCommand': 'GetItem',
8
+ 'QueryCommand': 'Query',
9
+ 'PutCommand': 'PutItem',
10
+ 'UpdateCommand': 'UpdateItem',
11
+ 'DeleteCommand': 'DeleteItem',
12
+ 'BatchGetCommand': 'BatchGetItem',
13
+ 'TransactWriteCommand': 'TransactWriteItems',
14
+ 'CreateTableCommand': 'CreateTable',
15
+ 'ListTablesCommand': 'ListTables',
16
+ 'DescribeTableCommand': 'DescribeTable',
17
+ 'UpdateTimeToLiveCommand': 'UpdateTimeToLive',
18
+ 'DescribeTimeToLiveCommand': 'DescribeTimeToLive',
19
+ 'UpdateTableCommand': 'UpdateTable'
20
+ };
21
+
6
22
  class DynamoDBClient {
7
23
  constructor(config = {}) {
8
24
  this.region = config.region || this._resolveRegion();
@@ -187,23 +203,7 @@ class DynamoDBClient {
187
203
  }
188
204
 
189
205
  _getOperationName(commandName) {
190
- const operationMap = {
191
- 'GetCommand': 'GetItem',
192
- 'QueryCommand': 'Query',
193
- 'PutCommand': 'PutItem',
194
- 'UpdateCommand': 'UpdateItem',
195
- 'DeleteCommand': 'DeleteItem',
196
- 'BatchGetCommand': 'BatchGetItem',
197
- 'TransactWriteCommand': 'TransactWriteItems',
198
- 'CreateTableCommand': 'CreateTable',
199
- 'ListTablesCommand': 'ListTables',
200
- 'DescribeTableCommand': 'DescribeTable',
201
- 'UpdateTimeToLiveCommand': 'UpdateTimeToLive',
202
- 'DescribeTimeToLiveCommand': 'DescribeTimeToLive',
203
- 'UpdateTableCommand': 'UpdateTable'
204
- };
205
-
206
- return operationMap[commandName] || commandName.replace('Command', '');
206
+ return OPERATION_NAMES[commandName] || commandName.replace('Command', '');
207
207
  }
208
208
 
209
209
  async send(command) {
package/src/fields.js CHANGED
@@ -4,7 +4,6 @@
4
4
  * This module contains the built-in fields for Bao.
5
5
  */
6
6
  const { ulid, decodeTime } = require("ulid");
7
- const { defaultLogger: logger } = require("./utils/logger");
8
7
  const { ValidationError } = require("./exceptions");
9
8
 
10
9
  /**
@@ -236,7 +235,6 @@ class DateTimeField extends BaoBaseField {
236
235
  const timestamp = this.toDy(value);
237
236
  if (!timestamp) return "0";
238
237
  const result = timestamp.toString().padStart(20, "0");
239
- // logger.log('Converting to GSI:', { value, timestamp, result });
240
238
  return result;
241
239
  } catch (error) {
242
240
  console.warn("Error converting date for GSI:", error);
@@ -544,8 +542,6 @@ class CounterField extends BaoBaseField {
544
542
  fieldValue: value,
545
543
  };
546
544
 
547
- logger.log("CounterField - getUpdateExpression", fieldName, value);
548
-
549
545
  if (value === null) {
550
546
  expObj = {
551
547
  ...expObj,
@@ -746,7 +742,6 @@ class TtlField extends DateTimeField {
746
742
  }
747
743
 
748
744
  toDy(value) {
749
- logger.log("TTL toDy", value);
750
745
  if (value === undefined) return undefined; // Skip field
751
746
  if (value === null) return null; // Remove field
752
747
 
@@ -770,7 +765,6 @@ class TtlField extends DateTimeField {
770
765
  }
771
766
 
772
767
  fromDy(value) {
773
- logger.log("TTL fromDy", value);
774
768
  if (value === undefined || value === null) {
775
769
  return null; // Convert both undefined and null to null
776
770
  }
package/src/index.js CHANGED
@@ -200,7 +200,7 @@ function initModels(userConfig = {}) {
200
200
  // Initialize the manager & 2nd model registration pass
201
201
  manager.init(finalConfig);
202
202
 
203
- logger.log("Models initialized:", {
203
+ logger.debug("Models initialized:", {
204
204
  testId: finalConfig.testId,
205
205
  tenantId: manager.getTenantId(),
206
206
  managerTestId: manager.getTestId(),