boundlessdb 0.8.0 → 0.10.0

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 (43) hide show
  1. package/CHANGELOG.md +156 -0
  2. package/README.md +97 -135
  3. package/dist/browser.d.ts +3 -3
  4. package/dist/browser.d.ts.map +1 -1
  5. package/dist/browser.js +2 -2
  6. package/dist/browser.js.map +1 -1
  7. package/dist/config/validator.d.ts.map +1 -1
  8. package/dist/config/validator.js +2 -8
  9. package/dist/config/validator.js.map +1 -1
  10. package/dist/event-store.d.ts +3 -1
  11. package/dist/event-store.d.ts.map +1 -1
  12. package/dist/event-store.js +56 -21
  13. package/dist/event-store.js.map +1 -1
  14. package/dist/index.d.ts +2 -2
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +1 -1
  17. package/dist/index.js.map +1 -1
  18. package/dist/query-builder.d.ts +28 -15
  19. package/dist/query-builder.d.ts.map +1 -1
  20. package/dist/query-builder.js +48 -17
  21. package/dist/query-builder.js.map +1 -1
  22. package/dist/storage/memory.d.ts.map +1 -1
  23. package/dist/storage/memory.js +14 -1
  24. package/dist/storage/memory.js.map +1 -1
  25. package/dist/storage/postgres.d.ts +6 -0
  26. package/dist/storage/postgres.d.ts.map +1 -1
  27. package/dist/storage/postgres.js +151 -11
  28. package/dist/storage/postgres.js.map +1 -1
  29. package/dist/storage/sqlite.d.ts.map +1 -1
  30. package/dist/storage/sqlite.js +153 -3
  31. package/dist/storage/sqlite.js.map +1 -1
  32. package/dist/storage/sqljs.d.ts.map +1 -1
  33. package/dist/storage/sqljs.js +87 -3
  34. package/dist/storage/sqljs.js.map +1 -1
  35. package/dist/types.d.ts +86 -3
  36. package/dist/types.d.ts.map +1 -1
  37. package/dist/types.js +65 -5
  38. package/dist/types.js.map +1 -1
  39. package/package.json +1 -1
  40. package/dist/event-store.browser.d.ts +0 -82
  41. package/dist/event-store.browser.d.ts.map +0 -1
  42. package/dist/event-store.browser.js +0 -336
  43. package/dist/event-store.browser.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,162 @@
2
2
 
3
3
  All notable changes to BoundlessDB will be documented in this file.
4
4
 
5
+ ## [0.10.0] - 2026-03-01
6
+
7
+ ### Added
8
+
9
+ #### `mergeConditions()` and `appendCondition.mergeWith()`
10
+
11
+ Combine multiple `AppendCondition`s for multi-boundary operations:
12
+
13
+ ```typescript
14
+ const cartResult = await store.query().matchKey('cart', cartId).read();
15
+ const inventoryResult = await store.query().matchKey('product', productId).read();
16
+
17
+ // Fluent
18
+ const merged = cartResult.appendCondition
19
+ .mergeWith(inventoryResult.appendCondition);
20
+
21
+ // Or standalone
22
+ const merged = mergeConditions(
23
+ cartResult.appendCondition,
24
+ inventoryResult.appendCondition,
25
+ );
26
+
27
+ await store.append(allEvents, merged);
28
+ ```
29
+
30
+ #### Duplicate key names per event type
31
+
32
+ The same key name can now appear multiple times with different paths. This enables the DCB spec pattern where one event carries multiple values for the same tag:
33
+
34
+ ```typescript
35
+ UsernameChanged: {
36
+ keys: [
37
+ { name: 'username', path: 'data.oldUsername' },
38
+ { name: 'username', path: 'data.newUsername' },
39
+ ]
40
+ }
41
+ ```
42
+
43
+ #### DCB spec examples as tests
44
+
45
+ All 6 examples from [dcb.events/examples](https://dcb.events/examples/) implemented as integration tests: Course Subscriptions, Unique Username, Invoice Number, Opt-In Token, Dynamic Product Price, Prevent Record Duplication.
46
+
47
+ ## [0.9.0] - 2026-03-01
48
+
49
+ ### Breaking Changes
50
+
51
+ #### Renamed: `withKey()` → `andKey()`
52
+
53
+ The chaining method for AND key constraints has been renamed to make the semantics immediately clear:
54
+
55
+ ```typescript
56
+ // Before (v0.8.0)
57
+ store.query()
58
+ .matchType('StudentSubscribed')
59
+ .withKey('course', 'cs101')
60
+ .withKey('student', 'alice')
61
+ .read();
62
+
63
+ // After (v0.9.0)
64
+ store.query()
65
+ .matchType('StudentSubscribed')
66
+ .andKey('course', 'cs101')
67
+ .andKey('student', 'alice')
68
+ .read();
69
+ ```
70
+
71
+ **Migration:** Find and replace `.withKey(` → `.andKey(` in your codebase.
72
+
73
+ ### Added
74
+
75
+ #### Key-Only Queries: `matchKey(key, value)`
76
+
77
+ Query events by key without specifying event types. This is the DCB-native way to query — by tags, not by event type.
78
+
79
+ ```typescript
80
+ // "Everything about course cs101" — no need to list event types!
81
+ const result = await store.query()
82
+ .matchKey('course', 'cs101')
83
+ .read();
84
+
85
+ // AND: "Alice's enrollment in cs101"
86
+ const result = await store.query()
87
+ .matchKey('course', 'cs101')
88
+ .andKey('student', 'alice')
89
+ .read();
90
+ ```
91
+
92
+ **Why this matters:** Previously, querying by key required listing every event type manually:
93
+
94
+ ```typescript
95
+ // Before: 8 event types just to query a cart 😱
96
+ const cartEventTypes = [
97
+ 'CartCreated', 'ItemAdded', 'ItemRemoved', 'ItemArchived',
98
+ 'CartSubmitted', 'CartCleared', 'CartPublished', 'CartPublicationFailed',
99
+ ];
100
+ const result = await store.read({
101
+ conditions: cartEventTypes.map(type => ({ type, key: 'cart', value: cartId })),
102
+ });
103
+
104
+ // After: one line ✨
105
+ const result = await store.query()
106
+ .matchKey('cart', cartId)
107
+ .read();
108
+ ```
109
+
110
+ Key-only queries work with `andKey()` for AND logic, `fromPosition()`, `limit()`, and `appendCondition`.
111
+
112
+ #### Multi-Type Queries: `matchType(...types)`
113
+
114
+ `matchType()` now accepts multiple types (variadic). Types within one call are OR:
115
+
116
+ ```typescript
117
+ // "All course lifecycle events for cs101"
118
+ const result = await store.query()
119
+ .matchType('CourseCreated', 'CourseCancelled')
120
+ .andKey('course', 'cs101')
121
+ .read();
122
+ ```
123
+
124
+ This maps directly to the DCB spec's QueryItem, where a single item can have multiple types.
125
+
126
+ ### Query API Summary
127
+
128
+ | Method | Role |
129
+ |---|---|
130
+ | `matchKey(key, value)` | Start condition by key (any event type). |
131
+ | `matchType(...types)` | Start condition by type(s). |
132
+ | `andKey(key, value)` | Add AND key constraint to last condition. |
133
+ | `matchTypeAndKey(type, key, value)` | Shorthand for `matchType(type).andKey(key, value)`. |
134
+
135
+ **Rules:**
136
+ - `matchType()` / `matchKey()` → starts a new condition (OR between conditions)
137
+ - `andKey()` → extends the last condition (AND within condition)
138
+
139
+ ### DCB Spec Mapping
140
+
141
+ | DCB Spec | BoundlessDB |
142
+ |---|---|
143
+ | QueryItem.types (OR within) | `matchType('A', 'B')` |
144
+ | QueryItem.tags (AND within) | `.andKey('key', 'value')` chain |
145
+ | Tag-only QueryItem | `matchKey('key', 'value')` |
146
+ | Multiple QueryItems (OR) | Multiple `matchType()` / `matchKey()` calls |
147
+
148
+ ### Tests
149
+
150
+ - **214 tests** (up from 174): +40 new tests covering key-only queries, multi-type queries, AND/OR combinations, appendCondition propagation, and error cases.
151
+
152
+ ### Documentation
153
+
154
+ - README updated with new API examples throughout
155
+ - `docs/sqlite-queries.md`: New sections for key-only, key-only AND, multi-type queries. Decision logic expanded to all 8 condition variants.
156
+ - Landing page: Updated highlight section and code examples
157
+ - Issue #83: Full API documentation with all query patterns
158
+
159
+ ---
160
+
5
161
  ## [0.8.0] - 2026-02-28
6
162
 
7
163
  ### Added
package/README.md CHANGED
@@ -84,26 +84,21 @@ event_keys: [pos:1, course, cs101], [pos:1, student, alice]
84
84
  ```
85
85
 
86
86
  ### 4️⃣ Query by Keys
87
- Find all events matching any combination of key conditions:
87
+ Find all events matching key conditions no need to list event types:
88
88
  ```typescript
89
- const result = await store.read({
90
- conditions: [
91
- { type: 'StudentSubscribed', key: 'course', value: 'cs101' }
92
- ]
93
- });
89
+ const result = await store.query()
90
+ .matchKey('course', 'cs101')
91
+ .read();
94
92
  // result.appendCondition captures: "I read all matching events up to position X"
95
93
  ```
96
94
 
97
95
  ## The DCB Pattern: Read → Decide → Write
98
96
 
99
97
  ```typescript
100
- // 1️⃣ READ — Query events and get an appendCondition
101
- const { events, appendCondition } = await store.read({
102
- conditions: [
103
- { type: 'CourseCreated', key: 'course', value: 'cs101' },
104
- { type: 'StudentSubscribed', key: 'course', value: 'cs101' },
105
- ]
106
- });
98
+ // 1️⃣ READ — Query by key and get an appendCondition
99
+ const { events, appendCondition } = await store.query<CourseEvent>()
100
+ .matchKey('course', 'cs101')
101
+ .read();
107
102
 
108
103
  // 2️⃣ DECIDE — Build state, run business logic
109
104
  const state = events.reduce(evolve, initialState);
@@ -154,12 +149,29 @@ if (result.conflict) {
154
149
  Build queries with a chainable API:
155
150
 
156
151
  ```typescript
152
+ // Key-only: everything about course cs101 (any event type!)
157
153
  const { events, appendCondition } = await store.query<CourseEvent>()
158
- .matchType('CourseCreated') // all events of type
159
- .matchTypeAndKey('StudentSubscribed', 'course', 'cs101') // type + key = value
160
- .withKey('student', 'alice') // AND: also match student key
161
- .fromPosition(100n) // start from position
162
- .limit(50) // limit results
154
+ .matchKey('course', 'cs101')
155
+ .read();
156
+
157
+ // Multi-key AND: Alice's enrollment in cs101
158
+ const enrollment = await store.query<CourseEvent>()
159
+ .matchKey('course', 'cs101')
160
+ .andKey('student', 'alice')
161
+ .read();
162
+
163
+ // Multi-type: course lifecycle events for cs101
164
+ const lifecycle = await store.query<CourseEvent>()
165
+ .matchType('CourseCreated', 'CourseCancelled')
166
+ .andKey('course', 'cs101')
167
+ .read();
168
+
169
+ // Type + key
170
+ const enrollments = await store.query<CourseEvent>()
171
+ .matchType('StudentSubscribed')
172
+ .andKey('course', 'cs101')
173
+ .fromPosition(100n)
174
+ .limit(50)
163
175
  .read();
164
176
  ```
165
177
 
@@ -167,14 +179,17 @@ const { events, appendCondition } = await store.query<CourseEvent>()
167
179
 
168
180
  | Method | Description |
169
181
  |--------|-------------|
170
- | `matchType(type)` | Match all events of type (unconstrained) |
171
- | `matchTypeAndKey(type, key, value)` | Match events of type where key=value |
172
- | `withKey(key, value)` | Add AND key to last condition (multi-key) |
182
+ | `matchKey(key, value)` | Match events by key, regardless of type. Starts new condition (OR). |
183
+ | `matchType(...types)` | Match events of one or more types. Starts new condition (OR). |
184
+ | `matchTypeAndKey(type, key, value)` | Shorthand for `matchType(type).andKey(key, value)` |
185
+ | `andKey(key, value)` | Add AND key constraint to last condition |
173
186
  | `fromPosition(bigint)` | Start reading from position |
174
187
  | `limit(number)` | Limit number of results |
175
188
  | `read()` | Execute query, returns `QueryResult` |
176
189
 
177
- The fluent API is equivalent to calling `store.read()` with conditions — use whichever style you prefer.
190
+ **Rules:**
191
+ - `matchType()` / `matchKey()` start a **new** condition (OR between conditions)
192
+ - `andKey()` **extends** the last condition (AND within condition)
178
193
 
179
194
  ## AppendCondition
180
195
 
@@ -191,7 +206,7 @@ interface AppendCondition {
191
206
 
192
207
  ```typescript
193
208
  const result = await store.query()
194
- .matchTypeAndKey('StudentSubscribed', 'course', 'cs101')
209
+ .matchKey('course', 'cs101')
195
210
  .read();
196
211
 
197
212
  // appendCondition = { failIfEventsMatch: [...], after: <last_position> }
@@ -251,51 +266,47 @@ await store.append(newEvents, null);
251
266
  Traditional streams give you ONE boundary. DCB lets you query ANY combination:
252
267
 
253
268
  ```typescript
254
- // "Has Alice already enrolled in CS101?"
255
- // Multi-key AND: must match BOTH keys on the SAME event
256
- const result = await store.query()
257
- .matchType('StudentSubscribed')
258
- .withKey('course', 'cs101')
259
- .withKey('student', 'alice')
260
- .read();
269
+ // Key-only: "Everything about course cs101"
270
+ store.query().matchKey('course', 'cs101').read()
271
+
272
+ // Multi-key AND: "Alice's enrollment in cs101"
273
+ store.query()
274
+ .matchKey('course', 'cs101')
275
+ .andKey('student', 'alice')
276
+ .read()
277
+
278
+ // Multi-type + key: "Course lifecycle events for cs101"
279
+ store.query()
280
+ .matchType('CourseCreated', 'CourseCancelled')
281
+ .andKey('course', 'cs101')
282
+ .read()
283
+
284
+ // OR: "All cancellations OR everything about Alice"
285
+ store.query()
286
+ .matchType('CourseCancelled') // condition 1
287
+ .matchKey('student', 'alice') // condition 2 (OR)
288
+ .read()
261
289
  ```
262
290
 
263
291
  ### AND vs OR
264
292
 
265
- - **`.withKey().withKey()`** = **AND** — the same event must have ALL specified keys
266
- - **Two separate conditions** = **OR** — events matching EITHER condition
293
+ - **`.andKey()`** = **AND** — extends the last condition (same event must match all keys)
294
+ - **`.matchType()` / `.matchKey()`** = **OR** — starts a new condition (events matching either)
267
295
 
268
296
  ```typescript
269
297
  // AND: Events where course='cs101' AND student='alice' (same event)
270
298
  store.query()
271
- .matchType('StudentSubscribed')
272
- .withKey('course', 'cs101')
273
- .withKey('student', 'alice')
299
+ .matchKey('course', 'cs101')
300
+ .andKey('student', 'alice')
274
301
  .read();
275
302
 
276
303
  // OR: Events where course='cs101' OR student='alice' (different events)
277
304
  store.query()
278
- .matchTypeAndKey('StudentSubscribed', 'course', 'cs101')
279
- .matchTypeAndKey('StudentSubscribed', 'student', 'alice')
305
+ .matchKey('course', 'cs101')
306
+ .matchKey('student', 'alice')
280
307
  .read();
281
308
  ```
282
309
 
283
- Multi-key conditions also work in the object syntax:
284
-
285
- ```typescript
286
- const result = await store.read({
287
- conditions: [
288
- {
289
- type: 'StudentSubscribed',
290
- keys: [
291
- { name: 'course', value: 'cs101' },
292
- { name: 'student', value: 'alice' }
293
- ]
294
- }
295
- ]
296
- });
297
- ```
298
-
299
310
  ## Config-based Key Extraction
300
311
 
301
312
  Keys are extracted from event payloads via configuration — events stay pure:
@@ -354,9 +365,10 @@ const consistency = {
354
365
  // Extracted keys: order="ORD-123", month="2026-02"
355
366
 
356
367
  // Query all orders from February 2026:
357
- const { events } = await store.read({
358
- conditions: [{ type: 'OrderPlaced', key: 'month', value: '2026-02' }]
359
- });
368
+ const { events } = await store.query()
369
+ .matchType('OrderPlaced')
370
+ .andKey('month', '2026-02')
371
+ .read();
360
372
  ```
361
373
 
362
374
  This is great for **Close the Books** patterns — query all events in a time period efficiently!
@@ -542,9 +554,9 @@ type ProductItemRemoved = Event<'ProductItemRemoved', {
542
554
  type CartEvents = ProductItemAdded | ProductItemRemoved;
543
555
 
544
556
  // Read with type safety
545
- const result = await store.read<CartEvents>({
546
- conditions: [{ type: 'ProductItemAdded', key: 'cart', value: 'cart-123' }]
547
- });
557
+ const result = await store.query<CartEvents>()
558
+ .matchKey('cart', 'cart-123')
559
+ .read();
548
560
 
549
561
  // TypeScript knows the event types!
550
562
  for (const event of result.events) {
@@ -556,90 +568,36 @@ for (const event of result.events) {
556
568
 
557
569
  ## Query Conditions
558
570
 
559
- Query conditions support both **constrained** (with key/value) and **unconstrained** (type-only) queries.
560
-
561
- ### Constrained Query
562
- Match events of a type where a specific key has a specific value:
563
-
564
- ```typescript
565
- // Get ProductItemAdded events where cart='cart-123'
566
- const result = await store.read({
567
- conditions: [
568
- { type: 'ProductItemAdded', key: 'cart', value: 'cart-123' }
569
- ]
570
- });
571
- ```
572
-
573
- ### Unconstrained Query
574
- Omit `key` and `value` to match **all events of a type**:
575
-
576
- ```typescript
577
- // Get ALL ProductItemAdded events (regardless of cart)
578
- const result = await store.read({
579
- conditions: [
580
- { type: 'ProductItemAdded' } // no key/value = match all
581
- ]
582
- });
583
- ```
584
-
585
- ### Mixed Conditions
586
- Combine constrained and unconstrained in one query (OR logic):
587
-
588
- ```typescript
589
- // "Give me the course definition + all enrollments for cs101"
590
- const result = await store.read({
591
- conditions: [
592
- { type: 'CourseCreated', key: 'course', value: 'cs101' },
593
- { type: 'StudentSubscribed', key: 'course', value: 'cs101' },
594
- { type: 'StudentUnsubscribed', key: 'course', value: 'cs101' },
595
- ]
596
- });
597
-
598
- // "All courses + only Alice's enrollments"
599
- const result = await store.read({
600
- conditions: [
601
- { type: 'CourseCreated' }, // unconstrained: ALL courses
602
- { type: 'StudentSubscribed', key: 'student', value: 'alice' } // constrained: only Alice
603
- ]
604
- });
605
- ```
606
-
607
- ### Same Type, Multiple Values
608
- Query multiple values of the same key:
571
+ The fluent query builder is the recommended API. For advanced use, conditions can also be passed directly to `store.read()`:
609
572
 
610
573
  ```typescript
611
- // Get ProductItemAdded for cart-1 OR cart-2
612
- const result = await store.read({
613
- conditions: [
614
- { type: 'ProductItemAdded', key: 'cart', value: 'cart-1' },
615
- { type: 'ProductItemAdded', key: 'cart', value: 'cart-2' }
616
- ]
617
- });
618
- ```
574
+ // Key-only: events with key, regardless of type
575
+ { keys: [{ name: 'course', value: 'cs101' }] }
619
576
 
620
- ### Type Safety
621
- With TypeScript, conditions are type-safe three forms:
577
+ // Type-only: all events of type
578
+ { type: 'CourseCreated' }
622
579
 
623
- ```typescript
624
- // ✅ Unconstrained (type only)
625
- { type: 'ProductItemAdded' }
626
-
627
- // ✅ Single key
580
+ // Type + single key
628
581
  { type: 'ProductItemAdded', key: 'cart', value: 'cart-123' }
629
582
 
630
- // Multi-key AND
583
+ // Type + multi-key AND
631
584
  { type: 'StudentSubscribed', keys: [
632
585
  { name: 'course', value: 'cs101' },
633
586
  { name: 'student', value: 'alice' }
634
587
  ]}
588
+
589
+ // Multi-type
590
+ { types: ['CourseCreated', 'CourseCancelled'] }
591
+
592
+ // Multi-type + keys
593
+ { types: ['CourseCreated', 'CourseCancelled'], keys: [{ name: 'course', value: 'cs101' }] }
635
594
  ```
636
595
 
637
- ### Empty Conditions
638
- Empty conditions returns **all events** in the store:
596
+ ### All Events
639
597
 
640
598
  ```typescript
641
599
  // Get ALL events (useful for admin/debug/export)
642
- const result = await store.read({ conditions: [] });
600
+ const result = await store.all().read();
643
601
  ```
644
602
 
645
603
  ## API Reference
@@ -659,9 +617,12 @@ Fluent query builder:
659
617
 
660
618
  ```typescript
661
619
  const result = await store.query<CourseEvent>()
662
- .matchType('CourseCreated') // unconstrained (type only)
663
- .matchTypeAndKey('StudentSubscribed', 'course', 'cs101') // type + single key
664
- .withKey('student', 'alice') // AND: add key to last condition
620
+ .matchKey('course', 'cs101') // key-only (any event type)
621
+ .read();
622
+
623
+ const result = await store.query<CourseEvent>()
624
+ .matchType('CourseCreated', 'CourseCancelled') // multi-type
625
+ .andKey('course', 'cs101') // + key constraint
665
626
  .fromPosition(100n) // start from position
666
627
  .limit(50) // limit results
667
628
  .read(); // execute, returns QueryResult
@@ -669,9 +630,10 @@ const result = await store.query<CourseEvent>()
669
630
 
670
631
  | Method | Description |
671
632
  |--------|-------------|
672
- | `matchType(type)` | Match all events of type (unconstrained) |
673
- | `matchTypeAndKey(type, key, value)` | Match events of type where key=value |
674
- | `withKey(key, value)` | Add AND key to last condition (multi-key) |
633
+ | `matchKey(key, value)` | Match events by key, any type. Starts new condition (OR). |
634
+ | `matchType(...types)` | Match events of type(s). Starts new condition (OR). |
635
+ | `matchTypeAndKey(type, key, value)` | Shorthand for `matchType(type).andKey(key, value)` |
636
+ | `andKey(key, value)` | Add AND key constraint to last condition |
675
637
  | `fromPosition(bigint)` | Start reading from position |
676
638
  | `limit(number)` | Limit number of results |
677
639
  | `read()` | Execute query, returns `QueryResult` |
@@ -796,4 +758,4 @@ For detailed SQL query plans and optimization notes, see [docs/sqlite-queries.md
796
758
 
797
759
  ---
798
760
 
799
- Built with ❤️ for [Event Sourcing](https://www.eventstore.com/event-sourcing)
761
+ Built with ❤️ for Event Sourcing
package/dist/browser.d.ts CHANGED
@@ -3,9 +3,9 @@
3
3
  *
4
4
  * This file exports everything needed for browser usage with sql.js storage.
5
5
  */
6
- export type { Event, EventWithMetadata, StoredEvent, Query, QueryCondition, UnconstrainedCondition, ConstrainedCondition, MultiKeyConstrainedCondition, ConsistencyConfig, ConsistencyKeyDef, EventTypeConfig, ExtractedKey, AppendResult, ConflictResult, AppendCondition, EventStoreOptions, } from './types.js';
7
- export { QueryResult, isConflict, isConstrainedCondition, isMultiKeyCondition, normalizeCondition, hasKeys } from './types.js';
8
- export { EventStore, createEventStore, type EventStoreConfig } from './event-store.browser.js';
6
+ export type { Event, EventWithMetadata, StoredEvent, Query, QueryCondition, UnconstrainedCondition, ConstrainedCondition, MultiKeyConstrainedCondition, MultiTypeCondition, MultiTypeConstrainedCondition, KeyOnlyCondition, ConsistencyConfig, ConsistencyKeyDef, EventTypeConfig, ExtractedKey, AppendResult, ConflictResult, AppendCondition, EventStoreOptions, } from './types.js';
7
+ export { QueryResult, isConflict, mergeConditions, isConstrainedCondition, isMultiKeyCondition, isMultiTypeCondition, isMultiTypeConstrainedCondition, isKeyOnlyCondition, normalizeCondition, hasKeys } from './types.js';
8
+ export { EventStore, createEventStore, type EventStoreConfig } from './event-store.js';
9
9
  export type { EventStorage, EventToStore } from './storage/interface.js';
10
10
  export { InMemoryStorage } from './storage/memory.js';
11
11
  export { SqlJsStorage, type SqlJsStorageOptions } from './storage/sqljs.js';
@@ -1 +1 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,YAAY,EAEV,KAAK,EACL,iBAAiB,EACjB,WAAW,EAEX,KAAK,EACL,cAAc,EACd,sBAAsB,EACtB,oBAAoB,EACpB,4BAA4B,EAE5B,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,YAAY,EAEZ,YAAY,EACZ,cAAc,EACd,eAAe,EACf,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAG/H,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG/F,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAG5E,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,YAAY,EAEV,KAAK,EACL,iBAAiB,EACjB,WAAW,EAEX,KAAK,EACL,cAAc,EACd,sBAAsB,EACtB,oBAAoB,EACpB,4BAA4B,EAC5B,kBAAkB,EAClB,6BAA6B,EAC7B,gBAAgB,EAEhB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,YAAY,EAEZ,YAAY,EACZ,cAAc,EACd,eAAe,EACf,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,+BAA+B,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAG3N,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGvF,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAG5E,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC"}
package/dist/browser.js CHANGED
@@ -3,9 +3,9 @@
3
3
  *
4
4
  * This file exports everything needed for browser usage with sql.js storage.
5
5
  */
6
- export { QueryResult, isConflict, isConstrainedCondition, isMultiKeyCondition, normalizeCondition, hasKeys } from './types.js';
6
+ export { QueryResult, isConflict, mergeConditions, isConstrainedCondition, isMultiKeyCondition, isMultiTypeCondition, isMultiTypeConstrainedCondition, isKeyOnlyCondition, normalizeCondition, hasKeys } from './types.js';
7
7
  // Event Store (browser version)
8
- export { EventStore, createEventStore } from './event-store.browser.js';
8
+ export { EventStore, createEventStore } from './event-store.js';
9
9
  export { InMemoryStorage } from './storage/memory.js';
10
10
  export { SqlJsStorage } from './storage/sqljs.js';
11
11
  // Config
@@ -1 +1 @@
1
- {"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA0BH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE/H,gCAAgC;AAChC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAyB,MAAM,0BAA0B,CAAC;AAI/F,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,YAAY,EAA4B,MAAM,oBAAoB,CAAC;AAE5E,SAAS;AACT,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA6BH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,+BAA+B,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE3N,gCAAgC;AAChC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAyB,MAAM,kBAAkB,CAAC;AAIvF,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,YAAY,EAA4B,MAAM,oBAAoB,CAAC;AAE5E,SAAS;AACT,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/config/validator.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAqB,MAAM,aAAa,CAAC;AAExE,qBAAa,qBAAsB,SAAQ,KAAK;aAE5B,MAAM,EAAE,MAAM,EAAE;gBAAhB,MAAM,EAAE,MAAM,EAAE;CAKnC;AAgED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CA6C9D"}
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/config/validator.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAqB,MAAM,aAAa,CAAC;AAExE,qBAAa,qBAAsB,SAAQ,KAAK;aAE5B,MAAM,EAAE,MAAM,EAAE;gBAAhB,MAAM,EAAE,MAAM,EAAE;CAKnC;AAgED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAmC9D"}
@@ -74,17 +74,11 @@ export function validateConfig(config) {
74
74
  errors.push(`eventTypes.${eventType}.keys must be an array`);
75
75
  continue;
76
76
  }
77
- // Check for duplicate key names within the same event type
78
- const keyNames = new Set();
77
+ // Validate each key definition (duplicate key names are allowed
78
+ // e.g. UsernameChanged needs two 'username' keys for old + new value)
79
79
  for (let i = 0; i < eventConfig.keys.length; i++) {
80
80
  const keyDef = eventConfig.keys[i];
81
- // Validate the key definition
82
81
  errors.push(...validateKeyDef(eventType, keyDef, i));
83
- // Check for duplicates
84
- if (keyDef.name && keyNames.has(keyDef.name)) {
85
- errors.push(`eventTypes.${eventType}.keys has duplicate key name "${keyDef.name}"`);
86
- }
87
- keyNames.add(keyDef.name);
88
82
  }
89
83
  }
90
84
  if (errors.length > 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/config/validator.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAE5B;IADlB,YACkB,MAAgB;QAE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export declare class EventStore {
19
19
  private readonly config;
20
20
  constructor(options: EventStoreConfig);
21
21
  /**
22
- * Check if config has changed since last run, reindex if needed
22
+ * Check if config has changed since last run, reindex if needed.
23
+ * Works with any storage that implements getConfigHash/setConfigHash.
24
+ * Handles both sync (SqliteStorage) and async (SqlJsStorage) methods.
23
25
  */
24
26
  private checkAndReindexIfNeeded;
25
27
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"event-store.d.ts","sourceRoot":"","sources":["../src/event-store.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EACL,WAAW,EAKX,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,cAAc,EAInB,KAAK,KAAK,EACV,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,KAAK,EAGX,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,YAAY,EAAsB,MAAM,oBAAoB,CAAC;AA2BtE,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB;IACzD,OAAO,EAAE,YAAY,CAAC;CACvB;AAED;;;;;GAKG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IACvC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoB;gBAE/B,OAAO,EAAE,gBAAgB;IAYrC;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAqB/B;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,CAAC,SAAS,KAAK,GAAG,KAAK,KAAK,YAAY,CAAC,CAAC,CAAC;IAIjD;;;;;;;;;;;;;;;;;;OAkBG;IACH,GAAG,CAAC,CAAC,SAAS,KAAK,GAAG,KAAK,KAAK,YAAY,CAAC,CAAC,CAAC;IAI/C;;;;;;;;;;;;;;;;;;OAkBG;IACG,IAAI,CAAC,CAAC,SAAS,KAAK,GAAG,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