@adobe/data-persistence 0.10.23 → 0.10.25

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/data-persistence",
3
- "version": "0.10.23",
3
+ "version": "0.10.25",
4
4
  "description": "Worker-based incremental persistence layer for @adobe/data ECS over OPFS (browser) and node:fs (server).",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -15,7 +15,7 @@
15
15
  "LICENSE"
16
16
  ],
17
17
  "dependencies": {
18
- "@adobe/data": "0.10.23"
18
+ "@adobe/data": "0.10.25"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@vitest/browser": "^1.6.0",
@@ -1,15 +0,0 @@
1
- declare class EntityLocationCache {
2
- private buffer;
3
- private capacityEntities;
4
- constructor();
5
- /** Returns the archetype id for `entity`, or -1 if absent. */
6
- getArchetypeId(entity: number): number;
7
- /** Returns the row index for `entity`. Caller must guard with has(). */
8
- getRow(entity: number): number;
9
- has(entity: number): boolean;
10
- set(entity: number, archetypeId: number, row: number): void;
11
- delete(entity: number): void;
12
- private grow;
13
- }
14
- export declare const createEntityLocationCache: () => EntityLocationCache;
15
- export type { EntityLocationCache };
@@ -1,75 +0,0 @@
1
- // © 2026 Adobe. MIT License. See /LICENSE for details.
2
- /**
3
- * In-memory mirror of every persisted entity's last-known on-disk
4
- * location, keyed by entity id. Used by the persistence service to
5
- * detect swap-remove side effects (an unrelated entity moving into
6
- * a vacated row) and to decide whether a per-component update path
7
- * can be taken vs. a full row write.
8
- *
9
- * Implementation: two `Uint32Array` slots per entity (archetype id,
10
- * row), packed flat and indexed directly by entity id. This avoids
11
- * a `Map<number, {a, r}>` — both a hash lookup and a per-entry
12
- * object allocation per change.
13
- *
14
- * The sentinel 0xFFFFFFFF means "absent". Archetype ids are u16 in
15
- * the on-disk manifest so the sentinel never collides with a real
16
- * archetype id.
17
- *
18
- * Backing buffer grows geometrically when the entity id outruns the
19
- * current capacity. Shrinking is intentionally not supported; the
20
- * worst case is bounded by the high-water-mark entity id.
21
- */
22
- const SENTINEL = 0xffff_ffff;
23
- const SLOTS_PER_ENTITY = 2;
24
- const INITIAL_CAPACITY_ENTITIES = 256;
25
- // Hidden-class friendly: assign every field once in the constructor,
26
- // in the same order, and don't mutate the shape.
27
- class EntityLocationCache {
28
- constructor() {
29
- this.capacityEntities = INITIAL_CAPACITY_ENTITIES;
30
- this.buffer = new Uint32Array(this.capacityEntities * SLOTS_PER_ENTITY);
31
- this.buffer.fill(SENTINEL);
32
- }
33
- /** Returns the archetype id for `entity`, or -1 if absent. */
34
- getArchetypeId(entity) {
35
- if (entity < 0 || entity >= this.capacityEntities)
36
- return -1;
37
- const v = this.buffer[entity * SLOTS_PER_ENTITY];
38
- return v === SENTINEL ? -1 : v;
39
- }
40
- /** Returns the row index for `entity`. Caller must guard with has(). */
41
- getRow(entity) {
42
- return this.buffer[entity * SLOTS_PER_ENTITY + 1];
43
- }
44
- has(entity) {
45
- if (entity < 0 || entity >= this.capacityEntities)
46
- return false;
47
- return this.buffer[entity * SLOTS_PER_ENTITY] !== SENTINEL;
48
- }
49
- set(entity, archetypeId, row) {
50
- if (entity < 0)
51
- return;
52
- if (entity >= this.capacityEntities)
53
- this.grow(entity + 1);
54
- const i = entity * SLOTS_PER_ENTITY;
55
- this.buffer[i] = archetypeId;
56
- this.buffer[i + 1] = row;
57
- }
58
- delete(entity) {
59
- if (entity < 0 || entity >= this.capacityEntities)
60
- return;
61
- this.buffer[entity * SLOTS_PER_ENTITY] = SENTINEL;
62
- }
63
- grow(neededEntities) {
64
- let nextCap = this.capacityEntities;
65
- while (nextCap < neededEntities)
66
- nextCap *= 2;
67
- const next = new Uint32Array(nextCap * SLOTS_PER_ENTITY);
68
- next.fill(SENTINEL);
69
- next.set(this.buffer);
70
- this.buffer = next;
71
- this.capacityEntities = nextCap;
72
- }
73
- }
74
- export const createEntityLocationCache = () => new EntityLocationCache();
75
- //# sourceMappingURL=entity-location-cache.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"entity-location-cache.js","sourceRoot":"","sources":["../../src/service/entity-location-cache.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,QAAQ,GAAG,WAAW,CAAC;AAC7B,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,MAAM,yBAAyB,GAAG,GAAG,CAAC;AAEtC,qEAAqE;AACrE,iDAAiD;AACjD,MAAM,mBAAmB;IAIrB;QACI,IAAI,CAAC,gBAAgB,GAAG,yBAAyB,CAAC;QAClD,IAAI,CAAC,MAAM,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC,CAAC;QACxE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC/B,CAAC;IAED,8DAA8D;IAC9D,cAAc,CAAC,MAAc;QACzB,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,IAAI,IAAI,CAAC,gBAAgB;YAAE,OAAO,CAAC,CAAC,CAAC;QAC7D,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,gBAAgB,CAAE,CAAC;QAClD,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACnC,CAAC;IAED,wEAAwE;IACxE,MAAM,CAAC,MAAc;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,gBAAgB,GAAG,CAAC,CAAE,CAAC;IACvD,CAAC;IAED,GAAG,CAAC,MAAc;QACd,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,IAAI,IAAI,CAAC,gBAAgB;YAAE,OAAO,KAAK,CAAC;QAChE,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,gBAAgB,CAAE,KAAK,QAAQ,CAAC;IAChE,CAAC;IA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