@adobe/data 0.9.60 → 0.9.62
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/dist/ecs/archetype/archetype.d.ts +9 -2
- package/dist/ecs/archetype/archetype.js.map +1 -1
- package/dist/ecs/archetype/create-archetype.js +5 -2
- package/dist/ecs/archetype/create-archetype.js.map +1 -1
- package/dist/ecs/database/combine-plugins.d.ts +5 -1
- package/dist/ecs/database/combine-plugins.js +3 -3
- package/dist/ecs/database/combine-plugins.js.map +1 -1
- package/dist/ecs/database/concurrency/concurrency-strategy.d.ts +86 -0
- package/dist/ecs/database/concurrency/concurrency-strategy.js +3 -0
- package/dist/ecs/database/concurrency/concurrency-strategy.js.map +1 -0
- package/dist/ecs/database/concurrency/immediate-concurrency.d.ts +22 -0
- package/dist/ecs/database/concurrency/immediate-concurrency.js +74 -0
- package/dist/ecs/database/concurrency/immediate-concurrency.js.map +1 -0
- package/dist/ecs/database/concurrency/index.d.ts +4 -0
- package/dist/ecs/database/concurrency/index.js +5 -0
- package/dist/ecs/database/concurrency/index.js.map +1 -0
- package/dist/ecs/database/concurrency/rebase-replay-concurrency.d.ts +20 -0
- package/dist/ecs/database/concurrency/rebase-replay-concurrency.js +34 -0
- package/dist/ecs/database/concurrency/rebase-replay-concurrency.js.map +1 -0
- package/dist/ecs/database/concurrency/roll-forward-concurrency.d.ts +33 -0
- package/dist/ecs/database/concurrency/roll-forward-concurrency.js +115 -0
- package/dist/ecs/database/concurrency/roll-forward-concurrency.js.map +1 -0
- package/dist/ecs/database/concurrency/roll-forward-concurrency.test.d.ts +1 -0
- package/dist/ecs/database/concurrency/roll-forward-concurrency.test.js +136 -0
- package/dist/ecs/database/concurrency/roll-forward-concurrency.test.js.map +1 -0
- package/dist/ecs/database/create-plugin.d.ts +17 -14
- package/dist/ecs/database/create-plugin.js +2 -1
- package/dist/ecs/database/create-plugin.js.map +1 -1
- package/dist/ecs/database/database.d.ts +61 -11
- package/dist/ecs/database/database.index.performance.test.d.ts +1 -0
- package/dist/ecs/database/database.index.performance.test.js +417 -0
- package/dist/ecs/database/database.index.performance.test.js.map +1 -0
- package/dist/ecs/database/database.index.test.d.ts +1 -0
- package/dist/ecs/database/database.index.test.js +1142 -0
- package/dist/ecs/database/database.index.test.js.map +1 -0
- package/dist/ecs/database/database.index.type-test.d.ts +1 -0
- package/dist/ecs/database/database.index.type-test.js +275 -0
- package/dist/ecs/database/database.index.type-test.js.map +1 -0
- package/dist/ecs/database/database.js.map +1 -1
- package/dist/ecs/database/database.reset.test.js +2 -1
- package/dist/ecs/database/database.reset.test.js.map +1 -1
- package/dist/ecs/database/deep-extends-chain.type-test.d.ts +256 -256
- package/dist/ecs/database/index-api-proof.type-test.d.ts +1 -0
- package/dist/ecs/database/index-api-proof.type-test.js +88 -0
- package/dist/ecs/database/index-api-proof.type-test.js.map +1 -0
- package/dist/ecs/database/index-registry/create-index-registry.d.ts +53 -0
- package/dist/ecs/database/index-registry/create-index-registry.js +174 -0
- package/dist/ecs/database/index-registry/create-index-registry.js.map +1 -0
- package/dist/ecs/database/index-registry/create-index.d.ts +60 -0
- package/dist/ecs/database/index-registry/create-index.js +539 -0
- package/dist/ecs/database/index-registry/create-index.js.map +1 -0
- package/dist/ecs/database/index-registry/index.d.ts +4 -0
- package/dist/ecs/database/index-registry/index.js +4 -0
- package/dist/ecs/database/index-registry/index.js.map +1 -0
- package/dist/ecs/database/index.d.ts +1 -0
- package/dist/ecs/database/index.js +1 -0
- package/dist/ecs/database/index.js.map +1 -1
- package/dist/ecs/database/observe-index-entities.d.ts +26 -0
- package/dist/ecs/database/observe-index-entities.js +66 -0
- package/dist/ecs/database/observe-index-entities.js.map +1 -0
- package/dist/ecs/database/observed/create-observed-database.js +1 -1
- package/dist/ecs/database/observed/create-observed-database.js.map +1 -1
- package/dist/ecs/database/observed/observed-database.d.ts +1 -1
- package/dist/ecs/database/public/create-database.d.ts +12 -27
- package/dist/ecs/database/public/create-database.js +252 -10
- package/dist/ecs/database/public/create-database.js.map +1 -1
- package/dist/ecs/database/public/create-database.test.js +8 -7
- package/dist/ecs/database/public/create-database.test.js.map +1 -1
- package/dist/ecs/database/public/create-transaction-dispatcher.d.ts +4 -2
- package/dist/ecs/database/public/create-transaction-dispatcher.js +2 -8
- package/dist/ecs/database/public/create-transaction-dispatcher.js.map +1 -1
- package/dist/ecs/database/reconciling/create-rebase-replay-applier.d.ts +26 -0
- package/dist/ecs/database/reconciling/create-rebase-replay-applier.js +121 -0
- package/dist/ecs/database/reconciling/create-rebase-replay-applier.js.map +1 -0
- package/dist/ecs/database/reconciling/create-reconciling-database.d.ts +11 -0
- package/dist/ecs/database/reconciling/create-reconciling-database.js +28 -137
- package/dist/ecs/database/reconciling/create-reconciling-database.js.map +1 -1
- package/dist/ecs/database/transactional-store/create-transactional-store.js.map +1 -1
- package/dist/ecs/database/transactional-store/transactional-store.d.ts +4 -3
- package/dist/ecs/entity-location-table/create-entity-location-table.js +2 -2
- package/dist/ecs/entity-location-table/create-entity-location-table.js.map +1 -1
- package/dist/ecs/entity-location-table/entity-location-table.d.ts +7 -1
- package/dist/ecs/plugins/scheduler/scheduler.d.ts +1 -0
- package/dist/ecs/store/core/core.d.ts +7 -1
- package/dist/ecs/store/core/create-core.js +3 -3
- package/dist/ecs/store/core/create-core.js.map +1 -1
- package/dist/ecs/store/index-types.d.ts +142 -0
- package/dist/ecs/store/index-types.js +3 -0
- package/dist/ecs/store/index-types.js.map +1 -0
- package/dist/ecs/store/public/create-store.js +206 -4
- package/dist/ecs/store/public/create-store.js.map +1 -1
- package/dist/ecs/store/public/create-store.test.js +25 -0
- package/dist/ecs/store/public/create-store.test.js.map +1 -1
- package/dist/ecs/store/store.d.ts +38 -14
- package/dist/ecs/store/store.js +5 -4
- package/dist/ecs/store/store.js.map +1 -1
- package/dist/ecs/store/transaction-functions.d.ts +4 -3
- package/dist/schema/fractional-index/between-n.d.ts +2 -0
- package/dist/schema/fractional-index/between-n.js +34 -0
- package/dist/schema/fractional-index/between-n.js.map +1 -0
- package/dist/schema/fractional-index/between-n.test.d.ts +1 -0
- package/dist/schema/fractional-index/between-n.test.js +36 -0
- package/dist/schema/fractional-index/between-n.test.js.map +1 -0
- package/dist/schema/fractional-index/between.d.ts +2 -0
- package/dist/schema/fractional-index/between.js +3 -0
- package/dist/schema/fractional-index/between.js.map +1 -0
- package/dist/schema/fractional-index/between.test.d.ts +1 -0
- package/dist/schema/fractional-index/between.test.js +68 -0
- package/dist/schema/fractional-index/between.test.js.map +1 -0
- package/dist/schema/fractional-index/decrement-integer.d.ts +1 -0
- package/dist/schema/fractional-index/decrement-integer.js +32 -0
- package/dist/schema/fractional-index/decrement-integer.js.map +1 -0
- package/dist/schema/fractional-index/decrement-integer.test.d.ts +1 -0
- package/dist/schema/fractional-index/decrement-integer.test.js +31 -0
- package/dist/schema/fractional-index/decrement-integer.test.js.map +1 -0
- package/dist/schema/fractional-index/digits.d.ts +1 -0
- package/dist/schema/fractional-index/digits.js +3 -0
- package/dist/schema/fractional-index/digits.js.map +1 -0
- package/dist/schema/fractional-index/fractional-index.d.ts +4 -0
- package/dist/schema/fractional-index/fractional-index.js +2 -0
- package/dist/schema/fractional-index/fractional-index.js.map +1 -0
- package/dist/schema/fractional-index/increment-integer.d.ts +1 -0
- package/dist/schema/fractional-index/increment-integer.js +32 -0
- package/dist/schema/fractional-index/increment-integer.js.map +1 -0
- package/dist/schema/fractional-index/increment-integer.test.d.ts +1 -0
- package/dist/schema/fractional-index/increment-integer.test.js +34 -0
- package/dist/schema/fractional-index/increment-integer.test.js.map +1 -0
- package/dist/schema/fractional-index/initial.d.ts +2 -0
- package/dist/schema/fractional-index/initial.js +2 -0
- package/dist/schema/fractional-index/initial.js.map +1 -0
- package/dist/schema/fractional-index/integer-length.d.ts +1 -0
- package/dist/schema/fractional-index/integer-length.js +9 -0
- package/dist/schema/fractional-index/integer-length.js.map +1 -0
- package/dist/schema/fractional-index/integer-part.d.ts +1 -0
- package/dist/schema/fractional-index/integer-part.js +9 -0
- package/dist/schema/fractional-index/integer-part.js.map +1 -0
- package/dist/schema/fractional-index/key-between.d.ts +2 -0
- package/dist/schema/fractional-index/key-between.js +39 -0
- package/dist/schema/fractional-index/key-between.js.map +1 -0
- package/dist/schema/fractional-index/midpoint.d.ts +1 -0
- package/dist/schema/fractional-index/midpoint.js +23 -0
- package/dist/schema/fractional-index/midpoint.js.map +1 -0
- package/dist/schema/fractional-index/midpoint.test.d.ts +1 -0
- package/dist/schema/fractional-index/midpoint.test.js +83 -0
- package/dist/schema/fractional-index/midpoint.test.js.map +1 -0
- package/dist/schema/fractional-index/public.d.ts +4 -0
- package/dist/schema/fractional-index/public.js +6 -0
- package/dist/schema/fractional-index/public.js.map +1 -0
- package/dist/schema/fractional-index/schema.d.ts +4 -0
- package/dist/schema/fractional-index/schema.js +5 -0
- package/dist/schema/fractional-index/schema.js.map +1 -0
- package/dist/schema/fractional-index/smallest-integer.d.ts +1 -0
- package/dist/schema/fractional-index/smallest-integer.js +3 -0
- package/dist/schema/fractional-index/smallest-integer.js.map +1 -0
- package/dist/schema/fractional-index/validate-integer.d.ts +1 -0
- package/dist/schema/fractional-index/validate-integer.js +7 -0
- package/dist/schema/fractional-index/validate-integer.js.map +1 -0
- package/dist/schema/fractional-index/validate-order-key.d.ts +1 -0
- package/dist/schema/fractional-index/validate-order-key.js +11 -0
- package/dist/schema/fractional-index/validate-order-key.js.map +1 -0
- package/dist/schema/guid/create.d.ts +2 -0
- package/dist/schema/guid/create.js +10 -0
- package/dist/schema/guid/create.js.map +1 -0
- package/dist/schema/guid/create.test.d.ts +1 -0
- package/dist/schema/guid/create.test.js +39 -0
- package/dist/schema/guid/create.test.js.map +1 -0
- package/dist/schema/guid/equals.d.ts +2 -0
- package/dist/schema/guid/equals.js +3 -0
- package/dist/schema/guid/equals.js.map +1 -0
- package/dist/schema/guid/equals.test.d.ts +1 -0
- package/dist/schema/guid/equals.test.js +30 -0
- package/dist/schema/guid/equals.test.js.map +1 -0
- package/dist/schema/guid/from-uuid.d.ts +2 -0
- package/dist/schema/guid/from-uuid.js +15 -0
- package/dist/schema/guid/from-uuid.js.map +1 -0
- package/dist/schema/guid/from-uuid.test.d.ts +1 -0
- package/dist/schema/guid/from-uuid.test.js +39 -0
- package/dist/schema/guid/from-uuid.test.js.map +1 -0
- package/dist/schema/guid/guid.performance.test.d.ts +1 -0
- package/dist/schema/guid/guid.performance.test.js +297 -0
- package/dist/schema/guid/guid.performance.test.js.map +1 -0
- package/dist/schema/guid/index.d.ts +4 -0
- package/dist/schema/guid/index.js +3 -0
- package/dist/schema/guid/index.js.map +1 -0
- package/dist/schema/guid/layout.d.ts +1 -0
- package/dist/schema/guid/layout.js +5 -0
- package/dist/schema/guid/layout.js.map +1 -0
- package/dist/schema/guid/nil.d.ts +2 -0
- package/dist/schema/guid/nil.js +3 -0
- package/dist/schema/guid/nil.js.map +1 -0
- package/dist/schema/guid/public.d.ts +8 -0
- package/dist/schema/guid/public.js +10 -0
- package/dist/schema/guid/public.js.map +1 -0
- package/dist/schema/guid/schema.d.ts +12 -0
- package/dist/schema/guid/schema.js +10 -0
- package/dist/schema/guid/schema.js.map +1 -0
- package/dist/schema/guid/schema.test.d.ts +1 -0
- package/dist/schema/guid/schema.test.js +35 -0
- package/dist/schema/guid/schema.test.js.map +1 -0
- package/dist/schema/guid/to-unserializable-key.d.ts +2 -0
- package/dist/schema/guid/to-unserializable-key.js +10 -0
- package/dist/schema/guid/to-unserializable-key.js.map +1 -0
- package/dist/schema/guid/to-uuid.d.ts +2 -0
- package/dist/schema/guid/to-uuid.js +15 -0
- package/dist/schema/guid/to-uuid.js.map +1 -0
- package/dist/schema/guid/to-uuid.test.d.ts +1 -0
- package/dist/schema/guid/to-uuid.test.js +31 -0
- package/dist/schema/guid/to-uuid.test.js.map +1 -0
- package/dist/schema/index.d.ts +2 -0
- package/dist/schema/index.js +2 -0
- package/dist/schema/index.js.map +1 -1
- package/dist/table/select-rows.d.ts +7 -4
- package/dist/table/select-rows.js.map +1 -1
- package/dist/test-setup.js +2 -2
- package/dist/test-setup.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -1
- package/references/data-lit/package.json +1 -1
- package/references/data-lit-tictactoe/package.json +1 -1
- package/references/data-react/package.json +1 -1
- package/references/data-react-hello/package.json +1 -1
- package/references/data-react-pixie/package.json +1 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
+
/**
|
|
3
|
+
* Reactive counterpart to an index handle's `find`. Mirrors
|
|
4
|
+
* {@link observeSelectEntities}: the initial value is emitted synchronously on
|
|
5
|
+
* subscribe, and subsequent values are emitted on a microtask after any
|
|
6
|
+
* transaction whose changed components intersect the index's read columns —
|
|
7
|
+
* the same commit boundary every other observer in the database fires on.
|
|
8
|
+
*
|
|
9
|
+
* Why route through transactions rather than notifying inside the index's own
|
|
10
|
+
* `add` / `remove` / `update`: those run *during* a transaction body, once per
|
|
11
|
+
* mutated entity, before the transaction commits. Emitting there would fire
|
|
12
|
+
* observers mid-transaction against half-applied state and at a different
|
|
13
|
+
* cadence than `db.observe.select`. Recomputing `find(arg)` at the commit
|
|
14
|
+
* boundary instead coalesces a whole transaction into one emission and keeps
|
|
15
|
+
* index reactivity consistent with the rest of the system.
|
|
16
|
+
*
|
|
17
|
+
* Bucket precision ("don't emit when an unrelated bucket changed") falls out
|
|
18
|
+
* of comparing the freshly-recomputed entity sequence against the last emitted
|
|
19
|
+
* one: an unrelated change recomputes to an identical sequence and is
|
|
20
|
+
* suppressed, while a reorder *within* the observed bucket — the regression
|
|
21
|
+
* case the index `find` already handles but a `where`-only `observe.select`
|
|
22
|
+
* silently swallows — produces a different sequence and is emitted.
|
|
23
|
+
*/
|
|
24
|
+
export const observeIndexEntities = (observeTransactions) => (find, readColumns) => {
|
|
25
|
+
const readSet = new Set(readColumns);
|
|
26
|
+
return (arg) => (observer) => {
|
|
27
|
+
let last = find(arg);
|
|
28
|
+
let isMicrotaskQueued = false;
|
|
29
|
+
const notifyObserver = () => {
|
|
30
|
+
isMicrotaskQueued = false;
|
|
31
|
+
const next = find(arg);
|
|
32
|
+
if (sameSequence(last, next)) {
|
|
33
|
+
// The relevant transaction touched a different bucket — our
|
|
34
|
+
// result is unchanged, so suppress the emission.
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
last = next;
|
|
38
|
+
observer(next);
|
|
39
|
+
};
|
|
40
|
+
const unobserveTransactions = observeTransactions((t) => {
|
|
41
|
+
if (t.changedComponents.isDisjointFrom(readSet)) {
|
|
42
|
+
// No component this index reads (key or sort) changed, so the
|
|
43
|
+
// bucket contents and their order cannot have changed.
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (!isMicrotaskQueued) {
|
|
47
|
+
isMicrotaskQueued = true;
|
|
48
|
+
queueMicrotask(notifyObserver);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
observer(last);
|
|
52
|
+
return () => {
|
|
53
|
+
unobserveTransactions();
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
const sameSequence = (a, b) => {
|
|
58
|
+
if (a.length !== b.length)
|
|
59
|
+
return false;
|
|
60
|
+
for (let i = 0; i < a.length; i++) {
|
|
61
|
+
if (a[i] !== b[i])
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
return true;
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=observe-index-entities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observe-index-entities.js","sourceRoot":"","sources":["../../../src/ecs/database/observe-index-entities.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAMvD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAChC,mBAAoD,EACtD,EAAE,CAAC,CACD,IAAyC,EACzC,WAA8B,EAChC,EAAE;IACA,MAAM,OAAO,GAAG,IAAI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,EAAE,CAAC;QAChC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;IACpC,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -146,7 +146,7 @@ export function createObservedDatabase(store) {
|
|
|
146
146
|
store.reset();
|
|
147
147
|
notifyAllObserversStoreReloaded();
|
|
148
148
|
},
|
|
149
|
-
toData: () => store.toData(),
|
|
149
|
+
toData: (copy = false) => store.toData(copy),
|
|
150
150
|
fromData: (data) => {
|
|
151
151
|
store.fromData(data);
|
|
152
152
|
notifyAllObserversStoreReloaded();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-observed-database.js","sourceRoot":"","sources":["../../../../src/ecs/database/observed/create-observed-database.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAQpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,sDAAsD,CAAC;AAMhG,MAAM,WAAW,GAAG,CAAO,GAAM,EAAE,GAAmB,EAAE,EAAE,CAAC,CAAC,KAAQ,EAAE,EAAE;IACpE,IAAI,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACvB,IAAI,GAAG,EAAE,CAAC;QACN,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;SAAM,CAAC;QACJ,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,GAAG,EAAE;QACR,GAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC,CAA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,UAAmC,CAAC;gBACvD,CAAC;gBACD,OAAO;oBACH,MAAM;oBACN,YAAY;iBACf,CAAC;YACN,CAAC,CAAC,CAAC;YACH,SAAS,EAAE,KAAK;YAChB,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,EAAE;YACR,IAAI,EAAE,EAAE;YACR,QAAQ,EAAE,IAAI;SACjB,CAAC;QACF,eAAe,CAAC,YAAY,CAAC,CAAC;IAClC,CAAC,CAAC;IAEF,MAAM,gBAAgB,GAA8B;QAChD,GAAG,IAAI;QACP,SAAS;QACT,OAAO;QACP,OAAO;QACP,KAAK,EAAE,GAAG,EAAE;YACR,KAAK,CAAC,KAAK,EAAE,CAAC;YACd,+BAA+B,EAAE,CAAC;QACtC,CAAC;QACD,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"create-observed-database.js","sourceRoot":"","sources":["../../../../src/ecs/database/observed/create-observed-database.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAQpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,sDAAsD,CAAC;AAMhG,MAAM,WAAW,GAAG,CAAO,GAAM,EAAE,GAAmB,EAAE,EAAE,CAAC,CAAC,KAAQ,EAAE,EAAE;IACpE,IAAI,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACvB,IAAI,GAAG,EAAE,CAAC;QACN,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;SAAM,CAAC;QACJ,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAA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C,EAAE,EAAE;gBAC/C,MAAM,SAAS,GAAG,KAAK,CAAC,eAAe,CAAC,2BAA2B,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAC/E,MAAM,UAAU,GAAG,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;gBAC/C,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,CAAE,MAAc,EAAE,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC;YACnH,CAAC,CAAC,CACL,CAAC;YACF,+BAA+B,EAAE,CAAC;YAClC,OAAO,gBAAuB,CAAC;QACnC,CAAC;KACJ,CAAC;IAEF,OAAO,gBAAgB,CAAC;AAC5B,CAAC"}
|
|
@@ -33,7 +33,7 @@ export interface ObservedDatabase<C extends Components, R extends ResourceCompon
|
|
|
33
33
|
userId?: number | string;
|
|
34
34
|
}) => TransactionResult<C>;
|
|
35
35
|
readonly reset: () => void;
|
|
36
|
-
readonly toData: () => unknown;
|
|
36
|
+
readonly toData: (copy?: boolean) => unknown;
|
|
37
37
|
readonly fromData: (data: unknown) => void;
|
|
38
38
|
readonly extend: <P extends Database.Plugin<any, any, any, any, any>>(plugin: P) => ObservedDatabase<C & (P extends Database.Plugin<infer XC, infer XR, infer XA, infer XTD, any> ? FromSchemas<XC> : never), R & (P extends Database.Plugin<infer XC, infer XR, infer XA, infer XTD, any> ? FromSchemas<XR> : never), A & (P extends Database.Plugin<infer XC, infer XR, infer XA, infer XTD, any> ? XA : never)>;
|
|
39
39
|
}
|
|
@@ -1,29 +1,5 @@
|
|
|
1
1
|
import { Database, FromServiceFactories } from "../database.js";
|
|
2
|
-
|
|
3
|
-
* Sync-related options. Presence of `sync` means "this database is going to
|
|
4
|
-
* be attached to a sync service", which has two consequences:
|
|
5
|
-
*
|
|
6
|
-
* 1. Every locally-generated `TransactionEnvelope` is stamped with
|
|
7
|
-
* `userId`, and the reconciler keys its transient queue by the
|
|
8
|
-
* compound `(userId, id)` so two peers' independent local id counters
|
|
9
|
-
* cannot collide.
|
|
10
|
-
* 2. The transaction wrapper enters deferred-commit mode: calls to
|
|
11
|
-
* `db.transactions.X(args)` apply locally as transients (negative
|
|
12
|
-
* time) and wait for the server's echoed `committed` envelope to
|
|
13
|
-
* promote them via the reconciler's rebase-replay. This is required
|
|
14
|
-
* for cross-peer entity-id determinism under concurrent edits.
|
|
15
|
-
*
|
|
16
|
-
* If `sync` is omitted the database operates in local-only mode: commits
|
|
17
|
-
* apply immediately with positive time, no envelope stamping, no deferred
|
|
18
|
-
* promotion.
|
|
19
|
-
*/
|
|
20
|
-
export interface DatabaseSyncOptions {
|
|
21
|
-
/**
|
|
22
|
-
* Stable peer/session identifier. Must be unique across all peers
|
|
23
|
-
* sharing the same sync server.
|
|
24
|
-
*/
|
|
25
|
-
readonly userId: number | string;
|
|
26
|
-
}
|
|
2
|
+
import type { ConcurrencyStrategyFactory } from "../concurrency/concurrency-strategy.js";
|
|
27
3
|
interface CreateDatabaseOptions<P extends Database.Plugin<any, any, any, any, any, any, any, any>> {
|
|
28
4
|
/**
|
|
29
5
|
* Optional services overrides to use.
|
|
@@ -32,8 +8,17 @@ interface CreateDatabaseOptions<P extends Database.Plugin<any, any, any, any, an
|
|
|
32
8
|
services?: {
|
|
33
9
|
[K in keyof FromServiceFactories<P['services']>]?: FromServiceFactories<P['services']>[K];
|
|
34
10
|
};
|
|
35
|
-
/**
|
|
36
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Concurrency strategy that controls how locally-initiated transactions
|
|
13
|
+
* are applied and how inbound envelopes are reconciled.
|
|
14
|
+
*
|
|
15
|
+
* Built-in strategies:
|
|
16
|
+
* - `createImmediateConcurrency()` — commits apply immediately, no
|
|
17
|
+
* rollback queue. Default when omitted.
|
|
18
|
+
* - `createRebaseReplayConcurrency(userId)` — deferred-commit mode with
|
|
19
|
+
* full rollback-and-replay for multi-peer synchronisation.
|
|
20
|
+
*/
|
|
21
|
+
concurrency?: ConcurrencyStrategyFactory;
|
|
37
22
|
}
|
|
38
23
|
export declare function createDatabase(): Database<{}, {}, {}, {}, never, {}, {}, {}>;
|
|
39
24
|
export declare function createDatabase<P extends Database.Plugin<{}, {}, {}, {}, never, {}, any, any>>(plugin: P, options?: CreateDatabaseOptions<P>): Database.FromPlugin<P>;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
2
|
import { Store } from "../../store/index.js";
|
|
3
|
-
import { createReconcilingDatabase } from "../reconciling/create-reconciling-database.js";
|
|
4
3
|
import { calculateSystemOrder } from "../calculate-system-order.js";
|
|
5
4
|
import { createTransactionDispatcher } from "./create-transaction-dispatcher.js";
|
|
5
|
+
import { observeSelectEntities } from "../observe-select-entities.js";
|
|
6
|
+
import { observeIndexEntities } from "../observe-index-entities.js";
|
|
7
|
+
import { createObservedDatabase } from "../observed/create-observed-database.js";
|
|
8
|
+
import { createImmediateConcurrency } from "../concurrency/immediate-concurrency.js";
|
|
6
9
|
/**
|
|
7
10
|
* For each system in newDeclarations that is not yet in systemFunctions: call create(db),
|
|
8
11
|
* store the returned value in systemFunctions, and assign by name. Uses natural declaration order.
|
|
@@ -17,7 +20,7 @@ function createAndAssignSystems(db, systemFunctions, newDeclarations) {
|
|
|
17
20
|
}
|
|
18
21
|
}
|
|
19
22
|
export function createDatabase(plugin, options) {
|
|
20
|
-
const db = createEmptyDatabase(options?.
|
|
23
|
+
const db = createEmptyDatabase(options?.concurrency);
|
|
21
24
|
if (plugin === undefined) {
|
|
22
25
|
return db;
|
|
23
26
|
}
|
|
@@ -30,20 +33,29 @@ export function createDatabase(plugin, options) {
|
|
|
30
33
|
* Creates a database with empty store, no transactions, actions, services, computed, or systems.
|
|
31
34
|
* All content is added via .extend(plugin). Single code path for extension.
|
|
32
35
|
*/
|
|
33
|
-
function createEmptyDatabase(
|
|
36
|
+
function createEmptyDatabase(concurrency) {
|
|
34
37
|
const store = Store.create({
|
|
35
38
|
components: {},
|
|
36
39
|
resources: {},
|
|
37
40
|
archetypes: {},
|
|
38
41
|
});
|
|
39
|
-
const
|
|
42
|
+
const observedDatabase = createObservedDatabase(store);
|
|
43
|
+
// The transaction declarations dict is shared with the strategy via the
|
|
44
|
+
// getTransaction closure: extend() updates it, the strategy reads from it.
|
|
45
|
+
const transactionDeclarationsRef = {};
|
|
46
|
+
const getTransaction = (name) => transactionDeclarationsRef[name];
|
|
47
|
+
const strategyFactory = concurrency ?? createImmediateConcurrency();
|
|
48
|
+
const strategy = strategyFactory(observedDatabase.execute, getTransaction);
|
|
40
49
|
// The dispatcher owns everything envelope-related: id allocation,
|
|
41
50
|
// commit/transient/cancel intent decisions, the deferred-commit
|
|
42
|
-
// behaviour implied by
|
|
51
|
+
// behaviour implied by the strategy, and resolving plain/promise/async-
|
|
43
52
|
// generator argument shapes. We just plug its outputs into the
|
|
44
53
|
// database surface.
|
|
45
|
-
const dispatcher = createTransactionDispatcher(
|
|
46
|
-
|
|
54
|
+
const dispatcher = createTransactionDispatcher(strategy.apply, {
|
|
55
|
+
deferredCommit: strategy.deferredCommit,
|
|
56
|
+
userId: strategy.userId,
|
|
57
|
+
});
|
|
58
|
+
observedDatabase.observe.envelopes = dispatcher.envelopes;
|
|
47
59
|
const transactions = { serviceName: "ecs-database-transactions-service" };
|
|
48
60
|
const addTransactionWrappers = (transactionDecls) => {
|
|
49
61
|
for (const name of Object.keys(transactionDecls)) {
|
|
@@ -63,22 +75,108 @@ function createEmptyDatabase(sync) {
|
|
|
63
75
|
const services = {};
|
|
64
76
|
const computed = {};
|
|
65
77
|
const extendedPlugins = new Set();
|
|
78
|
+
// The Store layer owns the IndexRegistry: it instantiates the registry,
|
|
79
|
+
// maintains it eagerly on every insert/update/delete, and exposes the
|
|
80
|
+
// typed handle map as `store.indexes`. The Database layer just surfaces
|
|
81
|
+
// the same reference (via spread / explicit field below) so users see
|
|
82
|
+
// `db.indexes.<name>` and `t.indexes.<name>` pointing at one source of
|
|
83
|
+
// truth.
|
|
84
|
+
const toData = () => {
|
|
85
|
+
// Fast path: a strategy with no replay hook leaves the store untouched
|
|
86
|
+
// after serialization, so a live-reference snapshot is safe.
|
|
87
|
+
if (!strategy.onAfterToData) {
|
|
88
|
+
return observedDatabase.toData();
|
|
89
|
+
}
|
|
90
|
+
// A replay strategy mutates the live buffers in `onAfterToData`, which
|
|
91
|
+
// would corrupt a live-reference snapshot. Capture a detached copy of
|
|
92
|
+
// the committed (rolled-back) state before replaying.
|
|
93
|
+
strategy.onBeforeToData?.();
|
|
94
|
+
const data = observedDatabase.toData(true);
|
|
95
|
+
strategy.onAfterToData();
|
|
96
|
+
return data;
|
|
97
|
+
};
|
|
98
|
+
const fromData = (data) => {
|
|
99
|
+
observedDatabase.fromData(data);
|
|
100
|
+
strategy.onAfterFromData?.();
|
|
101
|
+
};
|
|
66
102
|
const partialDatabase = {
|
|
67
103
|
serviceName: "ecs-database-service",
|
|
68
|
-
...
|
|
69
|
-
|
|
104
|
+
...observedDatabase,
|
|
105
|
+
concurrency: strategy,
|
|
106
|
+
apply: strategy.apply,
|
|
107
|
+
cancel: strategy.cancel,
|
|
108
|
+
reset: () => {
|
|
109
|
+
strategy.onReset();
|
|
110
|
+
observedDatabase.reset();
|
|
111
|
+
},
|
|
112
|
+
toData,
|
|
113
|
+
fromData,
|
|
70
114
|
transactions,
|
|
71
115
|
actions,
|
|
72
116
|
services,
|
|
73
117
|
computed,
|
|
118
|
+
indexes: store.indexes,
|
|
74
119
|
store,
|
|
75
120
|
system: { functions: systemFunctions, order: systemOrder },
|
|
76
121
|
extend: undefined,
|
|
77
122
|
};
|
|
123
|
+
// Auto-route `db.select(include, { where })` and `db.observe.select(...)`
|
|
124
|
+
// through a declared index when the where clause is exactly an equality
|
|
125
|
+
// match on the index's full key tuple and there is no order clause. Other
|
|
126
|
+
// shapes fall back to the archetype scan in the underlying store.
|
|
127
|
+
//
|
|
128
|
+
// The router dispatches through the user-visible handles in `store.indexes`
|
|
129
|
+
// so any override applied to the public handle — tests, instrumentation —
|
|
130
|
+
// takes effect for the routed path too.
|
|
131
|
+
const baseSelect = partialDatabase.select.bind(partialDatabase);
|
|
132
|
+
const indexAwareSelect = (include, options) => {
|
|
133
|
+
const routed = trySelectViaIndex(store, include, options);
|
|
134
|
+
if (routed !== null)
|
|
135
|
+
return routed;
|
|
136
|
+
return baseSelect(include, options);
|
|
137
|
+
};
|
|
138
|
+
partialDatabase.select = indexAwareSelect;
|
|
139
|
+
// `observeSelectEntities` reads from its `store` parameter via only
|
|
140
|
+
// `store.select` and `store.locate`. A minimal façade backed by the
|
|
141
|
+
// index-aware select + the real `store.locate` satisfies that contract,
|
|
142
|
+
// and replacing `observe.select` here mutates the shared `observe` object
|
|
143
|
+
// (same reference as `observedDatabase.observe`) before any user code
|
|
144
|
+
// can subscribe — so the default instance created inside
|
|
145
|
+
// `createObservedDatabase` is cleanly dropped, with no stale closures.
|
|
146
|
+
const indexAwareStoreFacade = {
|
|
147
|
+
select: indexAwareSelect,
|
|
148
|
+
locate: store.locate.bind(store),
|
|
149
|
+
};
|
|
150
|
+
partialDatabase.observe.select = observeSelectEntities(indexAwareStoreFacade, partialDatabase.observe.transactions);
|
|
151
|
+
// Reactive index handles. Each index's `observe(arg)` is built from its
|
|
152
|
+
// handle's `find` + `readColumns` and fires on the same transaction-commit
|
|
153
|
+
// boundary as `observe.select` (see `observeIndexEntities`). Attached at
|
|
154
|
+
// the Database layer because the Store layer that creates the handles has
|
|
155
|
+
// no transaction observable. `db.indexes` and `t.indexes` share the same
|
|
156
|
+
// handle objects, so attaching here covers both.
|
|
157
|
+
const observeIndex = observeIndexEntities(partialDatabase.observe.transactions);
|
|
158
|
+
const attachIndexObservers = () => {
|
|
159
|
+
// Structural view of the handle map: the Store augments each handle
|
|
160
|
+
// with `find` + `readColumns` (the same internal contract the query
|
|
161
|
+
// planner relies on for `find` + `routableColumns`).
|
|
162
|
+
const handles = store.indexes;
|
|
163
|
+
for (const name in handles) {
|
|
164
|
+
const handle = handles[name];
|
|
165
|
+
if (handle.observe)
|
|
166
|
+
continue;
|
|
167
|
+
handle.observe = observeIndex(handle.find, handle.readColumns);
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
attachIndexObservers();
|
|
78
171
|
const extend = (plugin) => {
|
|
79
172
|
if (!extendedPlugins.has(plugin)) {
|
|
80
173
|
extendedPlugins.add(plugin);
|
|
81
|
-
|
|
174
|
+
observedDatabase.extend(plugin);
|
|
175
|
+
// Update the shared transaction declarations ref so the strategy's
|
|
176
|
+
// getTransaction closure sees the new names during replay.
|
|
177
|
+
if (plugin.transactions) {
|
|
178
|
+
Object.assign(transactionDeclarationsRef, plugin.transactions);
|
|
179
|
+
}
|
|
82
180
|
const pluginTransactions = plugin.transactions ?? {};
|
|
83
181
|
const pluginActions = plugin.actions ?? {};
|
|
84
182
|
const pluginServices = plugin.services ?? {};
|
|
@@ -93,6 +191,13 @@ function createEmptyDatabase(sync) {
|
|
|
93
191
|
if (!(name in computed))
|
|
94
192
|
computed[name] = pluginComputed[name](partialDatabase);
|
|
95
193
|
}
|
|
194
|
+
// `observedDatabase.extend(plugin)` above propagates down to
|
|
195
|
+
// `store.extend({ components, resources, archetypes, indexes })`,
|
|
196
|
+
// so the Store has already absorbed `plugin.indexes`. We refresh
|
|
197
|
+
// our local indexes reference in case the underlying map got a
|
|
198
|
+
// new identity (it doesn't today, but stay defensive).
|
|
199
|
+
partialDatabase.indexes = store.indexes;
|
|
200
|
+
attachIndexObservers();
|
|
96
201
|
if (plugin.systems && Object.keys(plugin.systems).length > 0) {
|
|
97
202
|
Object.assign(allSystemDeclarations, plugin.systems);
|
|
98
203
|
systemOrder = calculateSystemOrder(allSystemDeclarations);
|
|
@@ -106,4 +211,141 @@ function createEmptyDatabase(sync) {
|
|
|
106
211
|
partialDatabase.extend = extend;
|
|
107
212
|
return partialDatabase;
|
|
108
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* Returns the equality value implied by `where[key]` if and only if the
|
|
216
|
+
* condition is a pure equality — either a direct primitive value or a
|
|
217
|
+
* comparison object with exactly `{ "==": v }`. Returns the sentinel
|
|
218
|
+
* `NOT_EQUALITY` when the condition uses any other operator.
|
|
219
|
+
*/
|
|
220
|
+
const NOT_EQUALITY = Symbol("not-equality");
|
|
221
|
+
const equalityValue = (cond) => {
|
|
222
|
+
if (cond === null || typeof cond !== "object")
|
|
223
|
+
return cond;
|
|
224
|
+
const keys = Object.keys(cond);
|
|
225
|
+
if (keys.length === 1 && keys[0] === "==")
|
|
226
|
+
return cond["=="];
|
|
227
|
+
return NOT_EQUALITY;
|
|
228
|
+
};
|
|
229
|
+
/**
|
|
230
|
+
* Attempts to serve `select(include, options)` from a declared index.
|
|
231
|
+
*
|
|
232
|
+
* Returns `null` when no index applies; the caller must fall back to the
|
|
233
|
+
* archetype scan. Returns an `Entity[]` when an index can answer the query.
|
|
234
|
+
*
|
|
235
|
+
* Match conditions (intentionally conservative):
|
|
236
|
+
* - `options.where` is non-empty.
|
|
237
|
+
* - Every `where` key is a pure equality (`v` or `{ "==": v }`).
|
|
238
|
+
* - The `where` keys, as a set, equal some index's key columns.
|
|
239
|
+
* - When `options.order` is present, that same index must be sorted with
|
|
240
|
+
* the default comparator on exactly the requested order columns (in
|
|
241
|
+
* sequence), and every requested direction must be ascending. A
|
|
242
|
+
* descending clause, a mismatched / partial column sequence, or a custom
|
|
243
|
+
* comparator falls back to the scan. (A sorted index's `find` already
|
|
244
|
+
* returns its bucket pre-sorted, so a matched ordered query is served
|
|
245
|
+
* without a second sort.)
|
|
246
|
+
*
|
|
247
|
+
* The query planner accesses `store.indexes` (the user-visible handle map),
|
|
248
|
+
* so test spies and any future user-installed instrumentation see the call.
|
|
249
|
+
* The column / sort metadata for each index lives on the registry-internal
|
|
250
|
+
* `RuntimeIndex`; `createStore` copies the routable subset onto each handle
|
|
251
|
+
* as `routableColumns` / `routableOrder`, which is the structural shape the
|
|
252
|
+
* planner reads below.
|
|
253
|
+
*
|
|
254
|
+
* After the index lookup returns candidate entities, each candidate is
|
|
255
|
+
* checked for archetype membership of every `include` component so the
|
|
256
|
+
* returned set respects the same archetype filter as the scan path. Index
|
|
257
|
+
* order is preserved through that filter, so a matched ordered query stays
|
|
258
|
+
* sorted.
|
|
259
|
+
*/
|
|
260
|
+
function trySelectViaIndex(store, include, options) {
|
|
261
|
+
const where = options?.where;
|
|
262
|
+
if (!where)
|
|
263
|
+
return null;
|
|
264
|
+
const whereKeys = Object.keys(where);
|
|
265
|
+
if (whereKeys.length === 0)
|
|
266
|
+
return null;
|
|
267
|
+
// Collapse where to an { component -> equality-value } record, bailing if
|
|
268
|
+
// any condition is not a pure equality.
|
|
269
|
+
const values = {};
|
|
270
|
+
for (const k of whereKeys) {
|
|
271
|
+
const eq = equalityValue(where[k]);
|
|
272
|
+
if (eq === NOT_EQUALITY)
|
|
273
|
+
return null;
|
|
274
|
+
values[k] = eq;
|
|
275
|
+
}
|
|
276
|
+
// Resolve the order constraint, if any. An empty order object is treated
|
|
277
|
+
// as no order. Any descending (falsy) direction opts the whole query out
|
|
278
|
+
// of routing — a sorted index only materializes its single ascending
|
|
279
|
+
// order, so it cannot serve a descending request without re-sorting.
|
|
280
|
+
let orderCols = null;
|
|
281
|
+
if (options?.order) {
|
|
282
|
+
const cols = Object.keys(options.order);
|
|
283
|
+
if (cols.length > 0) {
|
|
284
|
+
for (const c of cols) {
|
|
285
|
+
if (!options.order[c])
|
|
286
|
+
return null;
|
|
287
|
+
}
|
|
288
|
+
orderCols = cols;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
// Iterate the public handle map (store.indexes). Each handle carries the
|
|
292
|
+
// non-public `routableColumns` / `routableOrder` fields placed by
|
|
293
|
+
// `createStore`. `routableColumns: null` opts an index out of raw-where
|
|
294
|
+
// auto-routing (function and slot-map keys live in a value space the
|
|
295
|
+
// planner cannot infer from a where clause); `routableOrder: null` opts it
|
|
296
|
+
// out of serving an `order` clause (unsorted, or custom comparator).
|
|
297
|
+
//
|
|
298
|
+
// For a matched index the planner builds the appropriate `find`
|
|
299
|
+
// argument: a scalar for a single-column key, the full values object
|
|
300
|
+
// for a multi-column key. The call goes through `handle.find` so any
|
|
301
|
+
// user-installed spy or instrumentation on the handle sees the
|
|
302
|
+
// dispatch.
|
|
303
|
+
const handles = store.indexes;
|
|
304
|
+
let matchedHandle;
|
|
305
|
+
let matchedCols;
|
|
306
|
+
for (const name of Object.keys(handles)) {
|
|
307
|
+
const handle = handles[name];
|
|
308
|
+
const cols = handle.routableColumns;
|
|
309
|
+
if (cols === null)
|
|
310
|
+
continue;
|
|
311
|
+
if (cols.length !== whereKeys.length)
|
|
312
|
+
continue;
|
|
313
|
+
if (!cols.every(c => c in values))
|
|
314
|
+
continue;
|
|
315
|
+
// Key matches. If an order was requested, the same index must be
|
|
316
|
+
// sorted on exactly those columns in the same sequence.
|
|
317
|
+
if (orderCols !== null) {
|
|
318
|
+
const sortCols = handle.routableOrder;
|
|
319
|
+
if (sortCols === null)
|
|
320
|
+
continue;
|
|
321
|
+
if (sortCols.length !== orderCols.length)
|
|
322
|
+
continue;
|
|
323
|
+
if (!sortCols.every((c, i) => c === orderCols[i]))
|
|
324
|
+
continue;
|
|
325
|
+
}
|
|
326
|
+
matchedHandle = handle;
|
|
327
|
+
matchedCols = cols;
|
|
328
|
+
break;
|
|
329
|
+
}
|
|
330
|
+
if (!matchedHandle || !matchedCols)
|
|
331
|
+
return null;
|
|
332
|
+
const findArg = matchedCols.length === 1 ? values[matchedCols[0]] : values;
|
|
333
|
+
const candidates = matchedHandle.find(findArg);
|
|
334
|
+
if (candidates.length === 0)
|
|
335
|
+
return [];
|
|
336
|
+
const includeArr = Array.from(include);
|
|
337
|
+
if (includeArr.length === 0)
|
|
338
|
+
return candidates.slice();
|
|
339
|
+
const result = [];
|
|
340
|
+
for (const entity of candidates) {
|
|
341
|
+
const location = store.locate(entity);
|
|
342
|
+
if (!location)
|
|
343
|
+
continue;
|
|
344
|
+
const cols = location.archetype.columns;
|
|
345
|
+
if (includeArr.every(c => cols[c] !== undefined)) {
|
|
346
|
+
result.push(entity);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return result;
|
|
350
|
+
}
|
|
109
351
|
//# sourceMappingURL=create-database.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-database.js","sourceRoot":"","sources":["../../../../src/ecs/database/public/create-database.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,OAAO,
|
|
1
|
+
{"version":3,"file":"create-database.js","sourceRoot":"","sources":["../../../../src/ecs/database/public/create-database.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,OAAO,EAAiB,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAKrF;;;;;GAKG;AACH,SAAS,sBAAsB,CAC3B,EAAO,EACP,eAAwC,EACxC,eAAiE;IAEjE,KAAK,MAAM,IAAI,IAAI,eAAe,EAAE,CAAC;QACjC,IAAI,IAAI,IAAI,eAAe;YAAE,SAAS;QACtC,eAAe,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC;IACrE,CAAC;AACL,CAAC;AA6BD,MAAM,UAAU,cAAc,CAC1B,MAAgE,EAChE,OAAoC;IAEpC,MAAM,EAAE,GAAG,mBAAmB,CAAC,OAAO,EAAE,WAAW,C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,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACtC,IAAI,CAAC,QAAQ;YAAE,SAAS;QACxB,MAAM,IAAI,GAAI,QAAQ,CAAC,SAAkD,CAAC,OAAO,CAAC;QAClF,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,EAAE,CAAC;YAC/C,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACxB,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { describe, it, expect, vi } from "vitest";
|
|
3
3
|
import { Database } from "../database.js";
|
|
4
4
|
import { createReconcilingDatabase } from "../reconciling/create-reconciling-database.js";
|
|
5
|
+
import { createRebaseReplayConcurrency } from "../concurrency/index.js";
|
|
5
6
|
import { Store } from "../../store/index.js";
|
|
6
7
|
import { F32 } from "../../../math/f32/index.js";
|
|
7
8
|
import { Observe } from "../../../observe/index.js";
|
|
@@ -1050,13 +1051,13 @@ describe("createDatabase", () => {
|
|
|
1050
1051
|
},
|
|
1051
1052
|
});
|
|
1052
1053
|
// Wrong value type: token should be string, not number
|
|
1053
|
-
// @ts-expect-error
|
|
1054
|
+
// @ts-expect-error token must be a string
|
|
1054
1055
|
Database.create(plugin, { services: { auth: { token: 123, isAuthenticated: false } } });
|
|
1055
1056
|
// Unknown service key
|
|
1056
|
-
// @ts-expect-error
|
|
1057
|
+
// @ts-expect-error nonexistent is not a declared service
|
|
1057
1058
|
Database.create(plugin, { services: { nonexistent: { foo: 'bar' } } });
|
|
1058
1059
|
// Missing required property (isAuthenticated)
|
|
1059
|
-
// @ts-expect-error
|
|
1060
|
+
// @ts-expect-error auth override is missing isAuthenticated
|
|
1060
1061
|
Database.create(plugin, { services: { auth: { token: 'x' } } });
|
|
1061
1062
|
});
|
|
1062
1063
|
});
|
|
@@ -1371,13 +1372,13 @@ describe("userId in transaction context", () => {
|
|
|
1371
1372
|
expect(db.resources.seen).toBeUndefined();
|
|
1372
1373
|
});
|
|
1373
1374
|
it("t.userId matches sync.userId for locally-initiated transactions", () => {
|
|
1374
|
-
const db = Database.create(makePlugin(), {
|
|
1375
|
+
const db = Database.create(makePlugin(), { concurrency: createRebaseReplayConcurrency("alice") });
|
|
1375
1376
|
db.transactions.capture();
|
|
1376
1377
|
expect(db.resources.seen).toBe("alice");
|
|
1377
1378
|
});
|
|
1378
1379
|
it("t.userId matches the envelope userId for inbound db.apply(envelope) calls", () => {
|
|
1379
1380
|
const plugin = makePlugin();
|
|
1380
|
-
const db = Database.create(plugin, {
|
|
1381
|
+
const db = Database.create(plugin, { concurrency: createRebaseReplayConcurrency("alice") });
|
|
1381
1382
|
// Build a committed envelope that looks like it came from "bob"
|
|
1382
1383
|
const envelope = { id: 1, userId: "bob", name: "capture", args: undefined, time: 1 };
|
|
1383
1384
|
db.apply(envelope);
|
|
@@ -1403,7 +1404,7 @@ describe("no-op envelope suppression", () => {
|
|
|
1403
1404
|
},
|
|
1404
1405
|
});
|
|
1405
1406
|
it("a no-op commit (wrong userId) does not fire observe.envelopes", () => {
|
|
1406
|
-
const db = Database.create(makeGatedPlugin(), {
|
|
1407
|
+
const db = Database.create(makeGatedPlugin(), { concurrency: createRebaseReplayConcurrency("O") });
|
|
1407
1408
|
const listener = vi.fn();
|
|
1408
1409
|
db.observe.envelopes(listener);
|
|
1409
1410
|
db.transactions.setIfX({ v: 99 });
|
|
@@ -1411,7 +1412,7 @@ describe("no-op envelope suppression", () => {
|
|
|
1411
1412
|
expect(db.resources.value).toBe(0);
|
|
1412
1413
|
});
|
|
1413
1414
|
it("an effective commit (correct userId) does fire observe.envelopes", () => {
|
|
1414
|
-
const db = Database.create(makeGatedPlugin(), {
|
|
1415
|
+
const db = Database.create(makeGatedPlugin(), { concurrency: createRebaseReplayConcurrency("X") });
|
|
1415
1416
|
const listener = vi.fn();
|
|
1416
1417
|
db.observe.envelopes(listener);
|
|
1417
1418
|
db.transactions.setIfX({ v: 99 });
|