@adobe/data 0.9.80 → 0.9.81

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,195 @@
1
+ // © 2026 Adobe. MIT License. See /LICENSE for details.
2
+ import { Database } from "./database.js";
3
+ /**
4
+ * Compile-time tests for `Database.Read<DB>` and the `db.derive`
5
+ * callback surface. Type-only — nothing here executes. `@ts-expect-error`
6
+ * marks the accesses that MUST NOT compile (the footguns the read projection
7
+ * removes structurally).
8
+ */
9
+ const plugin = Database.Plugin.create({
10
+ components: {
11
+ x: { type: "number" },
12
+ y: { type: "string" },
13
+ },
14
+ resources: {
15
+ frameRate: { type: "number", default: 30 },
16
+ },
17
+ archetypes: {
18
+ Foo: ["x"],
19
+ },
20
+ indexes: {
21
+ byX: { key: "x" },
22
+ byXUnique: { key: "x", unique: true },
23
+ },
24
+ });
25
+ const db = Database.create(plugin);
26
+ // ============================================================================
27
+ // derive — POSITIVE: the read surface a compute body is allowed to touch
28
+ // ============================================================================
29
+ function derivePositive() {
30
+ // value reads
31
+ const gotten = db.derive((d) => d.get(0, "x"));
32
+ const selected = db.derive((d) => d.select(["x"]));
33
+ // presence `select` — `exclude` is allowed (membership-based)
34
+ db.derive((d) => d.select(["x"], { exclude: ["y"] }));
35
+ // …but the value-dependent options are NOT on the derive surface: they can
36
+ // only be tracked coarsely, so a value-keyed / ordered reactive read must go
37
+ // through a declared index.
38
+ db.derive((d) =>
39
+ // @ts-expect-error `where` is not offered on a derive's select — use an index
40
+ d.select(["x"], { where: { x: 1 } }));
41
+ db.derive((d) =>
42
+ // @ts-expect-error `order` is not offered on a derive's select — use an index
43
+ d.select(["x"], { order: { x: true } }));
44
+ // whole-entity read
45
+ db.derive((d) => d.read(0));
46
+ // projection read: exactly the requested fields, optionality preserved,
47
+ // unrequested fields (incl. id) excluded
48
+ db.derive((d) => {
49
+ const p = d.read(0, ["x", "y"]);
50
+ if (p !== null) {
51
+ const _x = p.x;
52
+ const _y = p.y;
53
+ void _x;
54
+ void _y;
55
+ // @ts-expect-error `id` was not requested, so it is not on the projection
56
+ p.id;
57
+ }
58
+ return p;
59
+ });
60
+ // archetype read: narrowed to the archetype's own row (no extra fields)
61
+ db.derive((d) => {
62
+ const foo = d.read(0, db.archetypes.Foo);
63
+ if (foo !== null) {
64
+ const _x = foo.x;
65
+ // @ts-expect-error `y` is not part of the Foo archetype — narrowed read excludes it
66
+ foo.y;
67
+ }
68
+ return foo;
69
+ });
70
+ // resource reads
71
+ const frameRate = db.derive((d) => d.resources.frameRate);
72
+ // archetype identity — and the realistic composition select(archetype.components)
73
+ db.derive((d) => d.archetypes.Foo.components);
74
+ db.derive((d) => d.archetypes.Foo.id);
75
+ db.derive((d) => d.select(d.archetypes.Foo.components));
76
+ // index lookups
77
+ db.derive((d) => d.indexes.byX.find({ x: 1 }));
78
+ db.derive((d) => d.indexes.byX.findRange({ x: 1 }));
79
+ // a unique index also exposes `get`
80
+ const head = db.derive((d) => d.indexes.byXUnique.get({ x: 1 }));
81
+ }
82
+ // ============================================================================
83
+ // derive — NEGATIVE: everything the read projection removes
84
+ // ============================================================================
85
+ function deriveNegative() {
86
+ db.derive((d) => {
87
+ // @ts-expect-error observers are not exposed — a derive subscribes to its own reads
88
+ return d.observe;
89
+ });
90
+ db.derive((d) => {
91
+ // @ts-expect-error transactions / writes are not exposed to a read-only derive
92
+ return d.transactions;
93
+ });
94
+ db.derive((d) => {
95
+ // @ts-expect-error queryArchetypes (raw column access) is not exposed
96
+ return d.queryArchetypes;
97
+ });
98
+ db.derive((d) => {
99
+ // @ts-expect-error locate (row access) is not exposed
100
+ return d.locate;
101
+ });
102
+ db.derive((d) => {
103
+ // @ts-expect-error per-archetype column access is not exposed
104
+ return d.archetypes.Foo.columns;
105
+ });
106
+ db.derive((d) => {
107
+ // @ts-expect-error per-archetype rowCount (table access) is not exposed
108
+ return d.archetypes.Foo.rowCount;
109
+ });
110
+ db.derive((d) => {
111
+ // @ts-expect-error per-archetype insert (write) is not exposed
112
+ return d.archetypes.Foo.insert;
113
+ });
114
+ db.derive((d) => {
115
+ // @ts-expect-error index observe is not exposed — a derive subscribes for you
116
+ return d.indexes.byX.observe;
117
+ });
118
+ }
119
+ function readProjectionPositive() {
120
+ const v = rd.get(0, "x");
121
+ const ids = rd.select(["x"]);
122
+ const excluded = rd.select(["x"], { exclude: ["y"] });
123
+ const fr = rd.resources.frameRate;
124
+ rd.archetypes.Foo.components.has("x");
125
+ const found = rd.indexes.byX.find({ x: 1 });
126
+ void v;
127
+ void ids;
128
+ void excluded;
129
+ void fr;
130
+ void found;
131
+ }
132
+ function readProjectionNegative() {
133
+ // @ts-expect-error observers omitted from the read projection
134
+ rd.observe;
135
+ // @ts-expect-error index observe omitted from the read projection
136
+ rd.indexes.byX.observe;
137
+ // @ts-expect-error table/column access omitted from the read projection
138
+ rd.archetypes.Foo.columns;
139
+ // @ts-expect-error transactions omitted from the read projection
140
+ rd.transactions;
141
+ // @ts-expect-error `where` (value-dependent) omitted from the read projection's select
142
+ rd.select(["x"], { where: { x: 1 } });
143
+ // @ts-expect-error `order` (value-dependent) omitted from the read projection's select
144
+ rd.select(["x"], { order: { x: true } });
145
+ }
146
+ // ============================================================================
147
+ // Read distributes over an INTERSECTION (Option A). The structural definition
148
+ // means `Database.Read<A & B>` merges both members' read surfaces, and because
149
+ // `derive` passes `Database.Read<this>`, a derive on an intersection receiver
150
+ // sees indexes + resources + archetypes from BOTH members — so a consumer of a
151
+ // composed `A & B` database (e.g. an indexed core intersected with a
152
+ // resource-computed layer) never needs to cast.
153
+ // ============================================================================
154
+ const pluginA = Database.Plugin.create({
155
+ components: { a: { type: "number" } },
156
+ resources: { ra: { type: "number", default: 0 } },
157
+ archetypes: { AOnly: ["a"] },
158
+ indexes: { byA: { key: "a" } },
159
+ });
160
+ const pluginB = Database.Plugin.create({
161
+ components: { b: { type: "string" } },
162
+ resources: { rb: { type: "string", default: "" } },
163
+ archetypes: { BOnly: ["b"] },
164
+ indexes: { byB: { key: "b" } },
165
+ });
166
+ const dbA = Database.create(pluginA);
167
+ const dbB = Database.create(pluginB);
168
+ function intersectionRead() {
169
+ // both members' resources
170
+ const _ra = rb2.resources.ra;
171
+ const _rb = rb2.resources.rb;
172
+ // both members' indexes (find-only)
173
+ const _fa = rb2.indexes.byA.find({ a: 1 });
174
+ const _fb = rb2.indexes.byB.find({ b: "x" });
175
+ // both members' archetype identities
176
+ rb2.archetypes.AOnly.components.has("a");
177
+ rb2.archetypes.BOnly.components.has("b");
178
+ void _ra;
179
+ void _rb;
180
+ void _fa;
181
+ void _fb;
182
+ }
183
+ function intersectionDerive() {
184
+ // `Database.Read<this>` on an intersection receiver → merged surface.
185
+ both.derive((d) => {
186
+ const _ra = d.resources.ra;
187
+ const _rb = d.resources.rb;
188
+ d.indexes.byA.find({ a: 1 });
189
+ d.indexes.byB.find({ b: "x" });
190
+ void _ra;
191
+ void _rb;
192
+ return 0;
193
+ });
194
+ }
195
+ //# sourceMappingURL=database-read.type-test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database-read.type-test.js","sourceRoot":"","sources":["../../../src/ecs/database/database-read.type-test.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAIvD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAIzC;;;;;GAKG;AAEH,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IAClC,UAAU,EAAE;QACR,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACrB,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KACxB;IACD,SAAS,EAAE;QACP,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;KAC7C;IACD,UAAU,EAAE;QACR,GAAG,EAAE,CAAC,GAAG,CAAC;KACb;IACD,OAAO,EAAE;QACL,GAAG,EAAE,EAAE,GAAG,EAAE,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EAAE;QACd,MAAM,GAAG,GAAW,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC;QACnC,MAAM,GAAG,GAAW,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC;QACnC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAC7B,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;QAC/B,KAAK,GAAG,CAAC;QACT,KAAK,GAAG,CAAC;QACT,OAAO,CAAC,CAAC;IACb,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -138,6 +138,20 @@ export interface Database<C extends Components = {}, R extends ResourceComponent
138
138
  archetype(id: ArchetypeId): Observe<void>;
139
139
  select<Include extends StringKeyof<C>, T extends Include>(include: readonly Include[] | ReadonlySet<string>, options?: EntitySelectOptions<C, Pick<C & RequiredComponents, T>>): Observe<readonly Entity[]>;
140
140
  };
141
+ /**
142
+ * Reactive derivation. `compute` runs against a read-only projection of this
143
+ * database ({@link Database.Read} — value / index / resource reads only; no
144
+ * observers, writes, or table access). The derive records exactly the reads
145
+ * it performs and re-emits when any could have changed: the initial value on
146
+ * subscribe, then at most once per committed transaction (synchronously at
147
+ * the commit boundary), structurally deduplicated so an unchanged result
148
+ * never re-notifies.
149
+ *
150
+ * The callback receives `Database.Read<this>`, so an *intersection* database
151
+ * (e.g. `IndexedCoreDatabase & ResourceComputedDatabase`) resolves to the
152
+ * merged read surface — consumers never need to cast.
153
+ */
154
+ derive<T>(compute: (db: Database.Read<this>) => T): Observe<T>;
141
155
  /**
142
156
  * Wipes all entities and resets all resources to their plugin defaults,
143
157
  * preserving database identity (observers, transaction wrappers, sync
@@ -209,12 +223,47 @@ export declare namespace Database {
209
223
  * expansion that amplifies TS7056 serialization overflow in deep extends chains.
210
224
  */
211
225
  type FromPlugin<P extends Database.Plugin> = Database<FromSchemas<RemoveIndex<P['components']>>, FromSchemas<RemoveIndex<P['resources']>>, RemoveIndex<P['archetypes']>, ToTransactionFunctions<RemoveIndex<P['transactions']>>, StringKeyof<P['systems']>, ToActionFunctions<RemoveIndex<P['actions']>>, FromServiceFactories<RemoveIndex<P['services']>>, FromComputedFactories<RemoveIndex<P['computed']>>, RemoveIndex<P['indexes']>>;
226
+ /**
227
+ * The read-only projection of a Database that a `db.derive` callback
228
+ * receives. It exposes only the auto-trackable read surface —
229
+ * - value reads: `get`, `read`, `select`
230
+ * - resource reads: `resources`
231
+ * - index lookups: `indexes.<name>.find` / `findRange` / `get`
232
+ * - archetype identity: `archetypes.<name>.components` / `id`
233
+ * — and structurally OMITS everything a derived computation must not touch:
234
+ * - `observe` (a derive subscribes to what it reads for you)
235
+ * - transactions / actions / any write
236
+ * - direct table access: `queryArchetypes`, `locate`, and per-archetype
237
+ * `columns` / `rowCount` / `insert` / row reads
238
+ * - `services` / `computed` / lifecycle (`extend`, `reset`, `toData`, …)
239
+ *
240
+ * Because the surface is narrowed structurally, misuse is a compile error
241
+ * rather than a value that must be guarded / thrown on at runtime.
242
+ */
243
+ type Read<DB extends Database<any, any, any, any, any, any, any, any, any>> = Pick<DB, "get" | "read" | "resources"> & {
244
+ select(include: readonly string[] | ReadonlySet<string>, options?: {
245
+ readonly exclude?: readonly string[];
246
+ }): readonly Entity[];
247
+ readonly indexes: {
248
+ readonly [K in keyof DB["indexes"]]: Omit<DB["indexes"][K], "observe">;
249
+ };
250
+ readonly archetypes: {
251
+ readonly [K in keyof DB["archetypes"]]: Pick<DB["archetypes"][K], "components" | "id">;
252
+ };
253
+ };
212
254
  const create: typeof createDatabase;
213
255
  const is: (value: unknown) => value is Database;
214
256
  const observeSelectDeep: <C extends Components, Include extends StringKeyof<C>>(db: Database<C, any, any, any, any, any, any, any>, include: readonly Include[] | ReadonlySet<Include | "id">, options?: EntitySelectOptions<C, Pick<C & RequiredComponents, Include>>) => Observe<readonly (RequiredComponents & { readonly [K in Include]: C[K]; })[]>;
215
257
  type Index<C extends Components = any> = StoreIndex<C, any, any, any>;
216
258
  namespace Index {
217
259
  type Handle<C extends Components, I extends StoreIndex<C, any, any, any>> = StoreIndex.Handle<C, I>;
260
+ /**
261
+ * The index handle as exposed to a `db.derive` callback: the
262
+ * synchronous lookups (`find` / `findRange` / `get`) only. `observe` is
263
+ * removed — a derive subscribes to the reads it performs automatically, so
264
+ * calling `observe` from inside one is a category error.
265
+ */
266
+ type ReadHandle<C extends Components, I extends StoreIndex<C, any, any, any>> = Omit<Handle<C, I>, "observe">;
218
267
  }
219
268
  namespace Archetype {
220
269
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"database.js","sourceRoot":"","sources":["../../../src/ecs/database/database.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAkBvD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAE,iBAAiB,IAAI,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAc1F,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAsMtD,MAAM,KAAW,QAAQ,CAyGxB;AAzGD,WAAiB,QAAQ;IAmBV,eAAM,GAAG,cAAc,CAAC;IAExB,WAAE,GAAG,CAAC,KAAc,EAAqB,EAAE;QACtD,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,cAAc,IAAI,KAAK,IAAI,SAAS,IAAI,KAAK,IAAI,OAAO,IAAI,KAAK,IAAI,SAAS,IAAI,KAAK,IAAI,QAAQ,IAAI,KAAK,IAAI,QAAQ,IAAI,KAAK,CAAC;IAC1L,CAAC,CAAA;IAEY,0BAAiB,GAAG,kBAAkB,CAAC;IAyDpD,IAAiB,MAAM,CAqBtB;IArBD,WAAiB,MAAM;QACR,aAAM,GAAG,YAAY,CAAC;QACtB,cAAO,GAAG,cAAc,CAAC;IAmBxC,CAAC,EArBgB,MAAM,GAAN,eAAM,KAAN,eAAM,QAqBtB;AAEH,CAAC,EAzGgB,QAAQ,KAAR,QAAQ,QAyGxB"}
1
+ {"version":3,"file":"database.js","sourceRoot":"","sources":["../../../src/ecs/database/database.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAkBvD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAE,iBAAiB,IAAI,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAc1F,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAoNtD,MAAM,KAAW,QAAQ,CAkKxB;AAlKD,WAAiB,QAAQ;IAoEV,eAAM,GAAG,cAAc,CAAC;IAExB,WAAE,GAAG,CAAC,KAAc,EAAqB,EAAE;QACtD,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,cAAc,IAAI,KAAK,IAAI,SAAS,IAAI,KAAK,IAAI,OAAO,IAAI,KAAK,IAAI,SAAS,IAAI,KAAK,IAAI,QAAQ,IAAI,KAAK,IAAI,QAAQ,IAAI,KAAK,CAAC;IAC1L,CAAC,CAAA;IAEY,0BAAiB,GAAG,kBAAkB,CAAC;IAiEpD,IAAiB,MAAM,CAqBtB;IArBD,WAAiB,MAAM;QACR,aAAM,GAAG,YAAY,CAAC;QACtB,cAAO,GAAG,cAAc,CAAC;IAmBxC,CAAC,EArBgB,MAAM,GAAN,eAAM,KAAN,eAAM,QAqBtB;AAEH,CAAC,EAlKgB,QAAQ,KAAR,QAAQ,QAkKxB"}
@@ -0,0 +1,11 @@
1
+ import { Observe } from "../../observe/index.js";
2
+ import { ReadonlyStore } from "../store/index.js";
3
+ import { TransactionResult } from "./transactional-store/transactional-store.js";
4
+ /**
5
+ * Builds `db.derive`. A single read-recording wrapper is constructed
6
+ * once and shared across every derive on this database: because a `compute`
7
+ * body is synchronous and performs no writes or nested derives, no two runs can
8
+ * overlap, so the wrapper's "currently-recording" target is reset per run and
9
+ * safely reused.
10
+ */
11
+ export declare const createDerive: <C extends object>(store: ReadonlyStore<C, any, any, any>, observeTransactions: Observe<TransactionResult<C>>) => <T>(compute: (db: any) => T) => Observe<T>;
@@ -0,0 +1,226 @@
1
+ // © 2026 Adobe. MIT License. See /LICENSE for details.
2
+ import { equals } from "../../equals.js";
3
+ const emptyDeps = () => ({
4
+ entityWhole: new Set(),
5
+ entityComponents: new Map(),
6
+ columns: new Set(),
7
+ setReads: [],
8
+ });
9
+ const watchComponent = (deps, entity, component) => {
10
+ let set = deps.entityComponents.get(entity);
11
+ if (set === undefined) {
12
+ deps.entityComponents.set(entity, (set = new Set()));
13
+ }
14
+ set.add(component);
15
+ };
16
+ const affected = (deps, result) => {
17
+ const { changedEntities, changedComponents, changedArchetypes } = result;
18
+ const { entityWhole, entityComponents, columns, setReads } = deps;
19
+ // Entity deps: iterate the (usually small) *changed* set and probe the
20
+ // watched sets — O(|changedEntities|), not O(|watched|). A commit touches a
21
+ // handful of entities regardless of how many a derive reads.
22
+ if (entityWhole.size > 0 || entityComponents.size > 0) {
23
+ for (const [entity, values] of changedEntities) {
24
+ if (entityWhole.has(entity)) {
25
+ return true;
26
+ }
27
+ const watched = entityComponents.get(entity);
28
+ if (watched === undefined) {
29
+ continue;
30
+ }
31
+ if (values === null) {
32
+ // entity deleted — any scoped read of it is now stale
33
+ return true;
34
+ }
35
+ for (const component of Object.keys(values)) {
36
+ if (watched.has(component)) {
37
+ return true;
38
+ }
39
+ }
40
+ }
41
+ }
42
+ // Resource column deps.
43
+ if (columns.size > 0 && !changedComponents.isDisjointFrom(columns)) {
44
+ return true;
45
+ }
46
+ // Set-valued reads: cheap gate, then recompute-and-compare this one read.
47
+ for (const dep of setReads) {
48
+ if (dep.kind === "index") {
49
+ if (changedComponents.isDisjointFrom(dep.readColumns)) {
50
+ continue;
51
+ }
52
+ }
53
+ else if (changedArchetypes.size === 0) {
54
+ continue;
55
+ }
56
+ if (!equals(dep.last, dep.recompute())) {
57
+ return true;
58
+ }
59
+ }
60
+ return false;
61
+ };
62
+ /**
63
+ * Builds `db.derive`. A single read-recording wrapper is constructed
64
+ * once and shared across every derive on this database: because a `compute`
65
+ * body is synchronous and performs no writes or nested derives, no two runs can
66
+ * overlap, so the wrapper's "currently-recording" target is reset per run and
67
+ * safely reused.
68
+ */
69
+ export const createDerive = (store, observeTransactions) => {
70
+ // The active recording target, non-null only for the duration of one
71
+ // synchronous `compute` run.
72
+ let recording = null;
73
+ // `resources` and `indexes` are built lazily and cached: the store's
74
+ // resource and index maps are populated during database construction, which
75
+ // finishes AFTER this factory is created, but before any derive can run.
76
+ let resourcesRecorder = null;
77
+ const buildResources = () => {
78
+ const out = {};
79
+ for (const name of Object.keys(store.resources)) {
80
+ Object.defineProperty(out, name, {
81
+ enumerable: true,
82
+ get() {
83
+ if (recording) {
84
+ recording.columns.add(name);
85
+ }
86
+ return store.resources[name];
87
+ },
88
+ });
89
+ }
90
+ return out;
91
+ };
92
+ let indexesRecorder = null;
93
+ const buildIndexes = () => {
94
+ const out = {};
95
+ const storeIndexes = (store.indexes ?? {});
96
+ for (const name of Object.keys(storeIndexes)) {
97
+ const handle = storeIndexes[name];
98
+ const readColumns = new Set(handle.readColumns ?? []);
99
+ // Record a per-bucket dependency: the exact result this lookup
100
+ // returned, plus a thunk to recompute it. `affected` gates on the
101
+ // read columns then recompute-compares, so an unrelated bucket's
102
+ // change recomputes this (cheap Map-get + slice) to an identical
103
+ // sequence and is suppressed — the derive body never re-runs.
104
+ const recordLookup = (result, recompute) => {
105
+ if (recording) {
106
+ recording.setReads.push({ kind: "index", readColumns, recompute, last: result });
107
+ }
108
+ };
109
+ const readHandle = {
110
+ find: (arg) => {
111
+ const result = handle.find(arg);
112
+ recordLookup(result, () => handle.find(arg));
113
+ return result;
114
+ },
115
+ findRange: (arg) => {
116
+ const result = handle.findRange(arg);
117
+ recordLookup(result, () => handle.findRange(arg));
118
+ return result;
119
+ },
120
+ };
121
+ if (typeof handle.get === "function") {
122
+ readHandle.get = (arg) => {
123
+ const result = handle.get(arg);
124
+ recordLookup(result, () => handle.get(arg));
125
+ return result;
126
+ };
127
+ }
128
+ out[name] = readHandle;
129
+ }
130
+ return out;
131
+ };
132
+ // The read-recording projection handed to `compute`. Delegates every read to
133
+ // the real store and records the dependency it implies. Typed loosely here;
134
+ // the precise `Database.Read<…>` surface is enforced at the public
135
+ // `db.derive` boundary.
136
+ const recorder = {
137
+ get: (entity, component) => {
138
+ if (recording) {
139
+ watchComponent(recording, entity, component);
140
+ }
141
+ return store.get(entity, component);
142
+ },
143
+ read: (entity, archetypeOrComponents) => {
144
+ if (recording) {
145
+ if (archetypeOrComponents === undefined) {
146
+ recording.entityWhole.add(entity);
147
+ }
148
+ else if (Array.isArray(archetypeOrComponents)) {
149
+ for (const component of archetypeOrComponents) {
150
+ watchComponent(recording, entity, component);
151
+ }
152
+ }
153
+ else {
154
+ for (const component of archetypeOrComponents.components) {
155
+ watchComponent(recording, entity, component);
156
+ }
157
+ }
158
+ }
159
+ return store.read(entity, archetypeOrComponents);
160
+ },
161
+ // Presence select only — `include` + `exclude`, no `where` / `order`
162
+ // (value-dependent options are omitted from the derive surface; use a
163
+ // declared index for value-keyed or ordered reactive reads). Recorded as
164
+ // a set-valued read gated on `changedArchetypes`: the result is
165
+ // membership-shaped, so a pure value write can never move it, and an
166
+ // unrelated migration recompute-compares to the same sequence.
167
+ select: (include, options) => {
168
+ const exclude = options?.exclude;
169
+ const args = [include, exclude === undefined ? undefined : { exclude }];
170
+ const run = () => store.select(...args);
171
+ const result = run();
172
+ if (recording) {
173
+ recording.setReads.push({ kind: "select", recompute: run, last: result });
174
+ }
175
+ return result;
176
+ },
177
+ get resources() {
178
+ return (resourcesRecorder ??= buildResources());
179
+ },
180
+ get indexes() {
181
+ return (indexesRecorder ??= buildIndexes());
182
+ },
183
+ // Archetype identity (components / id) is static, so reading it records
184
+ // no dependency; delegate to the real archetypes.
185
+ archetypes: store.archetypes,
186
+ };
187
+ return (compute) => (notify) => {
188
+ let last;
189
+ let hasLast = false;
190
+ let deps = emptyDeps();
191
+ const run = () => {
192
+ recording = emptyDeps();
193
+ try {
194
+ return compute(recorder);
195
+ }
196
+ finally {
197
+ deps = recording;
198
+ recording = null;
199
+ }
200
+ };
201
+ const emit = (value) => {
202
+ if (!hasLast || !equals(last, value)) {
203
+ last = value;
204
+ hasLast = true;
205
+ notify(value);
206
+ }
207
+ };
208
+ emit(run());
209
+ // `observeTransactions` fires once per committed transaction, so a
210
+ // recompute happens at most once per commit. Emit synchronously at the
211
+ // commit boundary — the same cadence as `observe.entity` / the raw
212
+ // component observers a hand-written computed would use — rather than
213
+ // deferring to a microtask, which would coalesce several commits in one
214
+ // turn (e.g. a burst of ephemeral drag commits) into a single emission
215
+ // and starve consumers that route per commit.
216
+ const unobserve = observeTransactions((result) => {
217
+ if (affected(deps, result)) {
218
+ emit(run());
219
+ }
220
+ });
221
+ return () => {
222
+ unobserve();
223
+ };
224
+ };
225
+ };
226
+ //# sourceMappingURL=observe-derive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observe-derive.js","sourceRoot":"","sources":["../../../src/ecs/database/observe-derive.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAGvD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAqDzC,MAAM,SAAS,GAAG,GAAW,EAAE,CAAC,CAAC;IAC7B,WAAW,EAAE,IAAI,GAAG,EAAE;IACtB,gBAAgB,EAAE,IAAI,GAAG,EAAE;IAC3B,OAAO,EAAE,IAAI,GAAG,EAAE;IAClB,QAAQ,EAAE,EAAE;CACf,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,MAAc,EAAE,SAAiB,EAAE,EAAE;IACvE,IAAI,GAAG,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5C,IAAI,GAAG,KAA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