@oimdb/core 3.12.1 → 4.0.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.
Files changed (8) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/README.md +2083 -1581
  3. package/dist/index.cjs +5057 -6335
  4. package/dist/index.d.cts +1421 -3312
  5. package/dist/index.d.ts +1421 -3312
  6. package/dist/index.js +4991 -6242
  7. package/llms.txt +3909 -469
  8. package/package.json +69 -61
package/CHANGELOG.md ADDED
@@ -0,0 +1,83 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@oimdb/core` are recorded here. This file starts at 4.0.0; releases
4
+ before it were not changelogged.
5
+
6
+ ## 4.0.0 — unreleased
7
+
8
+ A ground-up rewrite, not an incremental version: **nothing from the 3.x public API survives
9
+ unchanged.** There is no port table. The exported surface is `src/index.ts`, enumerated in the
10
+ README's export reference, and [the documentation](https://oimdb.org/docs/) describes it as it
11
+ is rather than as a diff. `npm install @oimdb/core` does not give you this engine until 4.0.0 is
12
+ published.
13
+
14
+ ### The two changes everything else follows from
15
+
16
+ - **Key-addressed → identity-addressed.** 3.x looked a key up on every operation. 4.0 resolves a
17
+ key to a slot once (`getSlotByKey`, `holdSlotByKey`) and works through that slot afterwards.
18
+ `updateEntity` takes a slot; `updateEntityByKey` / `deleteEntityByKey` say the lookup in their
19
+ names.
20
+ - **A god-object runtime → an operation lives on its subject.** Writes and reads are methods on
21
+ the collection that owns the slot; delivery is `OIMChannel`'s; `OIMDB` is a root that builds
22
+ collections with its defaults and drives `flush()`.
23
+
24
+ ### What the engine is made of
25
+
26
+ - **Slots and their owners.** Every observable thing is a slot — an entity, a column, a bucket, a
27
+ computed — and only its owner mutates it. `OIMSlotAggregate` is the base every collection
28
+ extends; `OIMSlotReleaseOwner` decides when an unheld slot goes, through an injected
29
+ `IOIMSlotReleasePolicy` (`AtEmpty` by default, plus `AtUnhold`, `AfterUnhold`, `AfterWrite`,
30
+ `AfterIdle`, `Never` and `Earliest`).
31
+ - **Entities.** `OIMEntityCollection` (silent) and `OIMChannelledEntityCollection` (wakes the
32
+ channel), `OIMSingleEntity` for one record. The writer is a fork chosen at construction:
33
+ `createOIMEntityWriterInPlace` or `createOIMEntityWriterReplacing`, each taking
34
+ `copyingWriterStrategy` (default) or `asHandedWriterStrategy`.
35
+ - **Columns.** `OIMColumnOwner` owns column slots on any aggregate, so an effect can wait on one
36
+ column of one entity (`holdColumn`, `channel.effectOnColumn`).
37
+ - **Buckets and indexes.** `OIMBucketCollection` holds slots the caller files;
38
+ `OIMIndex` files an entity collection's slots by `keyOf`. How a bucket holds its slots is a fork:
39
+ `OIMBucketSlotsServiceSetDriven` or `OIMBucketSlotsServiceArrayDriven`. Positional edits record
40
+ a command script through `OIMBucketCommands`.
41
+ - **Computeds.** A computed is a `TOIMComputedSlot` created and read only by its owner —
42
+ `OIMSingleComputed` or `OIMComputedCollection` — over named sources. It is pulled: a read
43
+ refreshes it against the channel clock. `OIMComputedCollectionSorted` is the shipped order over
44
+ an index, re-sorted only when a member's sort column changes.
45
+ - **Delivery.** `OIMChannel` coalesces a frame's writes and runs each `OIMEffect` once per frame
46
+ over its root slots and source computeds; `subscribeAfterEachFrame`, `subscribeAfterEachFlush`
47
+ and `subscribeOnceAfterFrame` run after it. Errors go through an `IOIMErrorPolicy`.
48
+ - **Keys.** A composite key is a chain descended one segment at a time
49
+ (`OIMSlotStoreServiceTreeDriven` with `OIMScalarKeyTreeWalk` or `OIMCompositeKeyTreeWalk`), so
50
+ nothing is encoded.
51
+
52
+ ### Removed from 3.x
53
+
54
+ - Event queues, scheduler classes and event-type enums. The channel's `channelScheduler` option,
55
+ `(flush) => void`, replaces them.
56
+ - A class per delivery timing and per carrier shape. One effect type replaces them.
57
+ - Dozens of concrete index classes, and a store class per collection × index × backing structure.
58
+ - Encoded composite-key tuples and their codecs (`ctk`).
59
+ - APIs returning raw key arrays, and "holes" in by-key results. A missing entity is
60
+ `slot.entity === undefined` on a resolved slot.
61
+ - The entity-updater factory family.
62
+ - The free bucket-lookup functions `bucketOf`, `findBucket`, `findBuckets`, `allBucketsOf`,
63
+ `bucketsByKeyOf`.
64
+
65
+ ### Behaviour worth knowing before porting
66
+
67
+ - **The frame is the unit, not the write.** An effect standing when the frame flushes is woken
68
+ once for everything that moved in that frame.
69
+ - **A write that changes nothing wakes nobody.**
70
+ - **Reads hand back the live container, never a copy**, so a loop over a bucket's slots must not
71
+ write to the collection it is walking.
72
+ - **A slot nobody holds and nothing fills is released** by its owner's release policy; hold what
73
+ you resolve for as long as you read it.
74
+
75
+ ### Companion packages
76
+
77
+ - `@oimdb/react`: `useOIMValue`, `useOIMEntity`, `useOIMField`, `useOIMBucketSlots`,
78
+ `useOIMBucketSlotsByKey`, `useOIMSlotsByKeys`, with `OIMChannelProvider` / `useOIMChannel`.
79
+ - `@oimdb/persist`: `OIMPersistor` and `OIMPersistResource` over `createBucketSourceAdapter`,
80
+ `createCollectionSourceAdapter` and `createSingleEntitySourceAdapter`.
81
+ - `@oimdb/exodra`: `exoBinding`, `exoSource`, `exoCombine`, `exoFollowKey`, `exoRows`,
82
+ `exoDerivedList`, `exoPositionalList`.
83
+ - `@oimdb/async`: deprecated outright, exports nothing.