@adobe/data 0.7.3 → 0.7.4
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/blob/download-handle.d.ts +4 -0
- package/dist/blob/download-handle.js +2 -0
- package/dist/blob/download-handle.js.map +1 -0
- package/dist/blob/upload-handle.d.ts +4 -0
- package/dist/blob/upload-handle.js +2 -0
- package/dist/blob/upload-handle.js.map +1 -0
- package/dist/ecs/database/create-database.test.js +130 -0
- package/dist/ecs/database/create-database.test.js.map +1 -1
- package/dist/ecs/database/database.d.ts +2 -1
- package/dist/ecs/database/index.d.ts +0 -1
- package/dist/ecs/database/index.js +0 -1
- package/dist/ecs/database/index.js.map +1 -1
- package/dist/ecs/database/observe-select-entities.d.ts +2 -2
- package/dist/ecs/database/observe-select-entities.js.map +1 -1
- package/dist/ecs/database/observed/create-observed-database.js +8 -0
- package/dist/ecs/database/observed/create-observed-database.js.map +1 -1
- package/dist/ecs/database/reconciling/create-reconciling-database.d.ts +8 -1
- package/dist/ecs/database/reconciling/create-reconciling-database.js +50 -19
- package/dist/ecs/database/reconciling/create-reconciling-database.js.map +1 -1
- package/dist/ecs/database/reconciling/create-reconciling-database.test.js +297 -0
- package/dist/ecs/database/reconciling/create-reconciling-database.test.js.map +1 -1
- package/dist/ecs/database/transactional-store/coalesce-transactions.d.ts +5 -1
- package/dist/ecs/database/transactional-store/coalesce-transactions.js +17 -28
- package/dist/ecs/database/transactional-store/coalesce-transactions.js.map +1 -1
- package/dist/ecs/database/transactional-store/coalesce-transactions.test.js +84 -7
- package/dist/ecs/database/transactional-store/coalesce-transactions.test.js.map +1 -1
- package/dist/ecs/database/transactional-store/create-transactional-store.js +7 -2
- package/dist/ecs/database/transactional-store/create-transactional-store.js.map +1 -1
- package/dist/ecs/database/transactional-store/create-transactional-store.test.js +5 -3
- package/dist/ecs/database/transactional-store/create-transactional-store.test.js.map +1 -1
- package/dist/ecs/database/transactional-store/entity-id-preservation.test.d.ts +1 -0
- package/dist/ecs/database/transactional-store/entity-id-preservation.test.js +106 -0
- package/dist/ecs/database/transactional-store/entity-id-preservation.test.js.map +1 -0
- package/dist/ecs/entity/entity.d.ts +8 -0
- package/dist/ecs/entity/entity.js +3 -0
- package/dist/ecs/entity/entity.js.map +1 -0
- package/dist/ecs/entity/u32.d.ts +8 -0
- package/dist/ecs/entity/u32.js +24 -0
- package/dist/ecs/entity/u32.js.map +1 -0
- package/dist/ecs/entity-location-table/create-entity-location-table.js +13 -1
- package/dist/ecs/entity-location-table/create-entity-location-table.js.map +1 -1
- package/dist/ecs/entity-location-table/create-entity-location-table.test.js +1 -2
- package/dist/ecs/entity-location-table/create-entity-location-table.test.js.map +1 -1
- package/dist/ecs/index.d.ts +2 -2
- package/dist/ecs/index.js +3 -2
- package/dist/ecs/index.js.map +1 -1
- package/dist/ecs/store/core/core.d.ts +13 -12
- package/dist/ecs/store/core/create-core.js +17 -11
- package/dist/ecs/store/core/create-core.js.map +1 -1
- package/dist/ecs/store/core/create-core.test.js +48 -0
- package/dist/ecs/store/core/create-core.test.js.map +1 -1
- package/dist/ecs/store/core/select-entities.d.ts +2 -1
- package/dist/ecs/store/core/select-entities.js.map +1 -1
- package/dist/ecs/store/create-store.d.ts +1 -1
- package/dist/ecs/store/create-store.js.map +1 -1
- package/dist/ecs/store/create-store.test.js.map +1 -1
- package/dist/ecs/store/store-schema/create-store-schema-test.d.ts +1 -0
- package/dist/ecs/store/store-schema/create-store-schema-test.js +33 -0
- package/dist/ecs/store/store-schema/create-store-schema-test.js.map +1 -0
- package/dist/ecs/store/store-schema/create-store-schema.d.ts +1 -0
- package/dist/ecs/store/store-schema/create-store-schema.js +45 -0
- package/dist/ecs/store/store-schema/create-store-schema.js.map +1 -0
- package/dist/ecs/store/store-schema/index.d.ts +1 -0
- package/dist/ecs/store/store-schema/index.js +21 -0
- package/dist/ecs/store/store-schema/index.js.map +1 -0
- package/dist/ecs/store/store-schema/store-schema.d.ts +1 -0
- package/dist/ecs/store/store-schema/store-schema.js +57 -0
- package/dist/ecs/store/store-schema/store-schema.js.map +1 -0
- package/dist/ecs/store/store.d.ts +9 -8
- package/dist/ecs/store/store.js.map +1 -1
- package/dist/ecs/undo-redo-service/create-undo-redo-service.test.js +23 -23
- package/dist/ecs/undo-redo-service/create-undo-redo-service.test.js.map +1 -1
- package/dist/ecs/world/create-world.d.ts +7 -0
- package/dist/ecs/world/create-world.js +113 -0
- package/dist/ecs/world/create-world.js.map +1 -0
- package/dist/ecs/world/create-world.test.d.ts +1 -0
- package/dist/ecs/world/create-world.test.js +499 -0
- package/dist/ecs/world/create-world.test.js.map +1 -0
- package/dist/ecs/world/index.d.ts +5 -0
- package/dist/ecs/world/index.js +27 -0
- package/dist/ecs/world/index.js.map +1 -0
- package/dist/ecs/world/system-phase.d.ts +5 -0
- package/dist/ecs/world/system-phase.js +14 -0
- package/dist/ecs/world/system-phase.js.map +1 -0
- package/dist/ecs/world/system.d.ts +25 -0
- package/dist/ecs/world/system.js +2 -0
- package/dist/ecs/world/system.js.map +1 -0
- package/dist/ecs/world/world-schema/create-world-schema-test.d.ts +1 -0
- package/dist/ecs/world/world-schema/create-world-schema-test.js +55 -0
- package/dist/ecs/world/world-schema/create-world-schema-test.js.map +1 -0
- package/dist/ecs/world/world-schema/create-world-schema.d.ts +19 -0
- package/dist/ecs/world/world-schema/create-world-schema.js +33 -0
- package/dist/ecs/world/world-schema/create-world-schema.js.map +1 -0
- package/dist/ecs/world/world-schema/index.d.ts +2 -0
- package/dist/ecs/world/world-schema/index.js +24 -0
- package/dist/ecs/world/world-schema/index.js.map +1 -0
- package/dist/ecs/world/world-schema/world-schema.d.ts +18 -0
- package/dist/ecs/world/world-schema/world-schema.js +23 -0
- package/dist/ecs/world/world-schema/world-schema.js.map +1 -0
- package/dist/ecs/world/world.d.ts +11 -0
- package/dist/ecs/world/world.js +2 -0
- package/dist/ecs/world/world.js.map +1 -0
- package/dist/graphics/camera/camera.d.ts +62 -0
- package/dist/graphics/camera/camera.js +17 -0
- package/dist/graphics/camera/camera.js.map +1 -0
- package/dist/graphics/camera/index.d.ts +4 -0
- package/dist/graphics/camera/index.js +5 -0
- package/dist/graphics/camera/index.js.map +1 -0
- package/dist/graphics/camera/screen-to-world-ray.d.ts +12 -0
- package/dist/graphics/camera/screen-to-world-ray.js +49 -0
- package/dist/graphics/camera/screen-to-world-ray.js.map +1 -0
- package/dist/graphics/camera/screen-to-world-ray.test.d.ts +1 -0
- package/dist/graphics/camera/screen-to-world-ray.test.js +171 -0
- package/dist/graphics/camera/screen-to-world-ray.test.js.map +1 -0
- package/dist/graphics/camera/to-view-projection.d.ts +3 -0
- package/dist/graphics/camera/to-view-projection.js +8 -0
- package/dist/graphics/camera/to-view-projection.js.map +1 -0
- package/dist/graphics/camera/world-to-screen.d.ts +12 -0
- package/dist/graphics/camera/world-to-screen.js +38 -0
- package/dist/graphics/camera/world-to-screen.js.map +1 -0
- package/dist/graphics/camera/world-to-screen.test.d.ts +1 -0
- package/dist/graphics/camera/world-to-screen.test.js +124 -0
- package/dist/graphics/camera/world-to-screen.test.js.map +1 -0
- package/dist/graphics/create-struct-gpu-buffer.d.ts +7 -0
- package/dist/graphics/create-struct-gpu-buffer.js +17 -0
- package/dist/graphics/create-struct-gpu-buffer.js.map +1 -0
- package/dist/graphics/extract-wgsl-bindings.d.ts +5 -0
- package/dist/graphics/extract-wgsl-bindings.js +10 -0
- package/dist/graphics/extract-wgsl-bindings.js.map +1 -0
- package/dist/graphics/frame.d.ts +1 -0
- package/dist/graphics/frame.js +15 -0
- package/dist/graphics/frame.js.map +1 -0
- package/dist/graphics/get-web-gpu-device-and-context.d.ts +1 -0
- package/dist/graphics/get-web-gpu-device-and-context.js +24 -0
- package/dist/graphics/get-web-gpu-device-and-context.js.map +1 -0
- package/dist/graphics/graphics-context.d.ts +1 -0
- package/dist/graphics/graphics-context.js +7 -0
- package/dist/graphics/graphics-context.js.map +1 -0
- package/dist/graphics/index.d.ts +5 -0
- package/dist/graphics/index.js +5 -0
- package/dist/graphics/index.js.map +1 -0
- package/dist/graphics/to-gpu-buffer.d.ts +2 -0
- package/dist/graphics/to-gpu-buffer.js +14 -0
- package/dist/graphics/to-gpu-buffer.js.map +1 -0
- package/dist/internal/array-buffer-like/grow.d.ts +1 -0
- package/dist/internal/array-buffer-like/grow.js +9 -0
- package/dist/internal/array-buffer-like/grow.js.map +1 -0
- package/dist/lit/hooks/use-observable-values.d.ts +1 -2
- package/dist/lit/hooks/use-observable-values.js.map +1 -1
- package/dist/math/aabb-face/face.d.ts +51 -0
- package/dist/math/aabb-face/face.js +110 -0
- package/dist/math/aabb-face/face.js.map +1 -0
- package/dist/math/aabb-face/face.test.d.ts +1 -0
- package/dist/math/aabb-face/face.test.js +94 -0
- package/dist/math/aabb-face/face.test.js.map +1 -0
- package/dist/math/box/box.d.ts +50 -0
- package/dist/math/box/box.js +23 -0
- package/dist/math/box/box.js.map +1 -0
- package/dist/math/face/face.d.ts +51 -0
- package/dist/math/face/face.js +110 -0
- package/dist/math/face/face.js.map +1 -0
- package/dist/math/face/face.test.d.ts +1 -0
- package/dist/math/face/face.test.js +94 -0
- package/dist/math/face/face.test.js.map +1 -0
- package/dist/math/picking/face.d.ts +1 -0
- package/dist/math/picking/face.js +2 -0
- package/dist/math/picking/face.js.map +1 -0
- package/dist/math/picking/get-closest-entity-to-line.d.ts +4 -0
- package/dist/math/picking/get-closest-entity-to-line.js +30 -0
- package/dist/math/picking/get-closest-entity-to-line.js.map +1 -0
- package/dist/math/picking/get-closest-entity-to-point.d.ts +4 -0
- package/dist/math/picking/get-closest-entity-to-point.js +27 -0
- package/dist/math/picking/get-closest-entity-to-point.js.map +1 -0
- package/dist/math/picking/get-intersecting-entities.d.ts +12 -0
- package/dist/math/picking/get-intersecting-entities.js +15 -0
- package/dist/math/picking/get-intersecting-entities.js.map +1 -0
- package/dist/math/picking/getClosestEntityToLine.d.ts +4 -0
- package/dist/math/picking/getClosestEntityToLine.js +29 -0
- package/dist/math/picking/getClosestEntityToLine.js.map +1 -0
- package/dist/math/picking/getClosestEntityToPoint.d.ts +4 -0
- package/dist/math/picking/getClosestEntityToPoint.js +27 -0
- package/dist/math/picking/getClosestEntityToPoint.js.map +1 -0
- package/dist/math/picking/getIntersectingEntities.d.ts +12 -0
- package/dist/math/picking/getIntersectingEntities.js +15 -0
- package/dist/math/picking/getIntersectingEntities.js.map +1 -0
- package/dist/math/picking/index.d.ts +5 -0
- package/dist/math/picking/index.js +27 -0
- package/dist/math/picking/index.js.map +1 -0
- package/dist/math/picking/pick-from-tables.d.ts +19 -0
- package/dist/math/picking/pick-from-tables.js +63 -0
- package/dist/math/picking/pick-from-tables.js.map +1 -0
- package/dist/math/picking/pick-result.d.ts +12 -0
- package/dist/math/picking/pick-result.js +23 -0
- package/dist/math/picking/pick-result.js.map +1 -0
- package/dist/math/transform/debug-inverse.d.ts +1 -0
- package/dist/math/transform/debug-inverse.js +28 -0
- package/dist/math/transform/debug-inverse.js.map +1 -0
- package/dist/math/transform/debug-quat.d.ts +1 -0
- package/dist/math/transform/debug-quat.js +23 -0
- package/dist/math/transform/debug-quat.js.map +1 -0
- package/dist/math/transform/debug-test.d.ts +1 -0
- package/dist/math/transform/debug-test.js +34 -0
- package/dist/math/transform/debug-test.js.map +1 -0
- package/dist/math/transform/transform.d.ts +58 -0
- package/dist/math/transform/transform.js +101 -0
- package/dist/math/transform/transform.js.map +1 -0
- package/dist/math/transform/transform.test.d.ts +1 -0
- package/dist/math/transform/transform.test.js +309 -0
- package/dist/math/transform/transform.test.js.map +1 -0
- package/dist/old-ecs/privacy/helper-functions.d.ts +43 -0
- package/dist/old-ecs/privacy/helper-functions.js +76 -0
- package/dist/old-ecs/privacy/helper-functions.js.map +1 -0
- package/dist/old-ecs/privacy/helper-functions.test.d.ts +1 -0
- package/dist/old-ecs/privacy/helper-functions.test.js +173 -0
- package/dist/old-ecs/privacy/helper-functions.test.js.map +1 -0
- package/dist/samples/todo/services/state-service/create-todo-database.d.ts +1 -1
- package/dist/samples/todo/services/state-service/create-todo-store.d.ts +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
/*MIT License
|
|
2
|
+
|
|
3
|
+
© Copyright 2025 Adobe. All rights reserved.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.*/
|
|
22
|
+
import { describe, it, expect } from "vitest";
|
|
23
|
+
import { createWorld } from "./create-world.js";
|
|
24
|
+
import { createStore } from "../store/create-store.js";
|
|
25
|
+
import { createDatabase } from "../database/create-database.js";
|
|
26
|
+
function createTestStore() {
|
|
27
|
+
return createStore({}, {
|
|
28
|
+
result: { type: "string", default: "" },
|
|
29
|
+
counter: { default: 0 }
|
|
30
|
+
}, {});
|
|
31
|
+
}
|
|
32
|
+
function createTestDatabase() {
|
|
33
|
+
const store = createTestStore();
|
|
34
|
+
const database = createDatabase(store, {
|
|
35
|
+
appendToResult(t, char) {
|
|
36
|
+
t.resources.result += char;
|
|
37
|
+
},
|
|
38
|
+
incrementCounter(t) {
|
|
39
|
+
t.resources.counter += 1;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return database;
|
|
43
|
+
}
|
|
44
|
+
function createTestWorld() {
|
|
45
|
+
const store = createTestStore();
|
|
46
|
+
const database = createDatabase(store, {
|
|
47
|
+
appendToResult(t, char) {
|
|
48
|
+
t.resources.result += char;
|
|
49
|
+
},
|
|
50
|
+
incrementCounter(t) {
|
|
51
|
+
t.resources.counter += 1;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return { store, database };
|
|
55
|
+
}
|
|
56
|
+
describe("createWorld", () => {
|
|
57
|
+
describe("system execution order", () => {
|
|
58
|
+
it("should execute systems with dependency constraints in correct order", async () => {
|
|
59
|
+
const { store, database } = createTestWorld();
|
|
60
|
+
// Deliberately define systems in WRONG order to test dependency resolution
|
|
61
|
+
const world = createWorld(store, database, {
|
|
62
|
+
third: {
|
|
63
|
+
type: "store",
|
|
64
|
+
run: (s) => { s.resources.result += "C"; }
|
|
65
|
+
},
|
|
66
|
+
first: {
|
|
67
|
+
type: "store",
|
|
68
|
+
run: (s) => { s.resources.result += "A"; },
|
|
69
|
+
schedule: { before: ["second"] }
|
|
70
|
+
},
|
|
71
|
+
second: {
|
|
72
|
+
type: "store",
|
|
73
|
+
run: (s) => { s.resources.result += "B"; },
|
|
74
|
+
schedule: { after: ["first"], before: ["third"] }
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
// Pass systems in wrong order - dependency resolution should fix it
|
|
78
|
+
await world.runSystems(["third", "second", "first"]);
|
|
79
|
+
expect(store.resources.result).toBe("ABC");
|
|
80
|
+
});
|
|
81
|
+
it("should execute systems with after constraints in correct order", async () => {
|
|
82
|
+
const { store, database } = createTestWorld();
|
|
83
|
+
// Define systems in reverse dependency order to test resolution
|
|
84
|
+
const world = createWorld(store, database, {
|
|
85
|
+
render: {
|
|
86
|
+
type: "store",
|
|
87
|
+
run: (s) => { s.resources.result += "R"; },
|
|
88
|
+
schedule: { after: ["physics"] }
|
|
89
|
+
},
|
|
90
|
+
physics: {
|
|
91
|
+
type: "store",
|
|
92
|
+
run: (s) => { s.resources.result += "P"; },
|
|
93
|
+
schedule: { after: ["input"] }
|
|
94
|
+
},
|
|
95
|
+
input: {
|
|
96
|
+
type: "store",
|
|
97
|
+
run: (s) => { s.resources.result += "I"; }
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
// Pass systems in completely wrong order - should still execute I→P→R
|
|
101
|
+
await world.runSystems(["render", "physics", "input"]);
|
|
102
|
+
expect(store.resources.result).toBe("IPR");
|
|
103
|
+
});
|
|
104
|
+
it("should handle complex dependency graph", async () => {
|
|
105
|
+
const { store, database } = createTestWorld();
|
|
106
|
+
// Define systems in completely reverse order from dependencies
|
|
107
|
+
const world = createWorld(store, database, {
|
|
108
|
+
d: {
|
|
109
|
+
type: "store",
|
|
110
|
+
run: (s) => { s.resources.result += "D"; }
|
|
111
|
+
},
|
|
112
|
+
b: {
|
|
113
|
+
type: "store",
|
|
114
|
+
run: (s) => { s.resources.result += "B"; },
|
|
115
|
+
schedule: { before: ["d"] }
|
|
116
|
+
},
|
|
117
|
+
c: {
|
|
118
|
+
type: "store",
|
|
119
|
+
run: (s) => { s.resources.result += "C"; },
|
|
120
|
+
schedule: { before: ["d"] }
|
|
121
|
+
},
|
|
122
|
+
a: {
|
|
123
|
+
type: "store",
|
|
124
|
+
run: (s) => { s.resources.result += "A"; },
|
|
125
|
+
schedule: { before: ["b", "c"] }
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
// Pass in reverse dependency order - topological sort must fix it
|
|
129
|
+
await world.runSystems(["d", "c", "b", "a"]);
|
|
130
|
+
// A must come first, then B and C in any order, then D
|
|
131
|
+
expect(store.resources.result).toMatch(/^A[BC][BC]D$/);
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
describe("system types", () => {
|
|
135
|
+
it("should execute store systems directly on store", async () => {
|
|
136
|
+
const { store, database } = createTestWorld();
|
|
137
|
+
const world = createWorld(store, database, {
|
|
138
|
+
storeSystem: {
|
|
139
|
+
type: "store",
|
|
140
|
+
run: (s) => { s.resources.result += "STORE"; }
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
await world.runSystems(["storeSystem"]);
|
|
144
|
+
expect(store.resources.result).toBe("STORE");
|
|
145
|
+
});
|
|
146
|
+
it("should execute database systems with transactions", async () => {
|
|
147
|
+
const { store, database } = createTestWorld();
|
|
148
|
+
const world = createWorld(store, database, {
|
|
149
|
+
dbSystem: {
|
|
150
|
+
type: "database",
|
|
151
|
+
run: (db) => { db.transactions.appendToResult("DB"); }
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
await world.runSystems(["dbSystem"]);
|
|
155
|
+
expect(store.resources.result).toBe("DB");
|
|
156
|
+
});
|
|
157
|
+
it("should handle mixed store and database systems", async () => {
|
|
158
|
+
const { store, database } = createTestWorld();
|
|
159
|
+
// Define database system first, but it should run after store system
|
|
160
|
+
const world = createWorld(store, database, {
|
|
161
|
+
dbSecond: {
|
|
162
|
+
type: "database",
|
|
163
|
+
run: (db) => { db.transactions.appendToResult("D"); }
|
|
164
|
+
},
|
|
165
|
+
storeFirst: {
|
|
166
|
+
type: "store",
|
|
167
|
+
run: (s) => { s.resources.result += "S"; },
|
|
168
|
+
schedule: { before: ["dbSecond"] }
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
// Pass systems in wrong order - dependency should fix it
|
|
172
|
+
await world.runSystems(["dbSecond", "storeFirst"]);
|
|
173
|
+
expect(store.resources.result).toBe("SD");
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
describe("synchronous vs asynchronous execution", () => {
|
|
177
|
+
it("should handle all synchronous systems", async () => {
|
|
178
|
+
const { store, database } = createTestWorld();
|
|
179
|
+
// Define second system first to test dependency resolution
|
|
180
|
+
const world = createWorld(store, database, {
|
|
181
|
+
sync2: {
|
|
182
|
+
type: "store",
|
|
183
|
+
run: (s) => {
|
|
184
|
+
s.resources.result += "2";
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
sync1: {
|
|
188
|
+
type: "store",
|
|
189
|
+
run: (s) => {
|
|
190
|
+
s.resources.result += "1";
|
|
191
|
+
},
|
|
192
|
+
schedule: { before: ["sync2"] }
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
// Pass in reverse order - dependency resolution should fix it
|
|
196
|
+
await world.runSystems(["sync2", "sync1"]);
|
|
197
|
+
// Result "12" proves sync1 ran before sync2
|
|
198
|
+
expect(store.resources.result).toBe("12");
|
|
199
|
+
});
|
|
200
|
+
it("should complete synchronously when all systems are sync", () => {
|
|
201
|
+
const { store, database } = createTestWorld();
|
|
202
|
+
const world = createWorld(store, database, {
|
|
203
|
+
syncA: {
|
|
204
|
+
type: "store",
|
|
205
|
+
run: (s) => {
|
|
206
|
+
s.resources.result += "A";
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
syncB: {
|
|
210
|
+
type: "store",
|
|
211
|
+
run: (s) => {
|
|
212
|
+
s.resources.result += "B";
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
// Time the execution to ensure it's immediate for sync systems
|
|
217
|
+
const startTime = performance.now();
|
|
218
|
+
world.runSystems(["syncA", "syncB"]);
|
|
219
|
+
const endTime = performance.now();
|
|
220
|
+
expect(store.resources.result).toBe("AB");
|
|
221
|
+
// Sync systems should complete in < 1ms (no waiting for timers/promises)
|
|
222
|
+
expect(endTime - startTime).toBeLessThan(1);
|
|
223
|
+
});
|
|
224
|
+
it("should properly await asynchronous systems", async () => {
|
|
225
|
+
const { store, database } = createTestWorld();
|
|
226
|
+
// Define second async system first to test dependency resolution
|
|
227
|
+
const world = createWorld(store, database, {
|
|
228
|
+
async2: {
|
|
229
|
+
type: "store",
|
|
230
|
+
run: async (s) => {
|
|
231
|
+
await new Promise(resolve => setTimeout(resolve, 5));
|
|
232
|
+
s.resources.result += "B";
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
async1: {
|
|
236
|
+
type: "store",
|
|
237
|
+
run: async (s) => {
|
|
238
|
+
await new Promise(resolve => setTimeout(resolve, 10));
|
|
239
|
+
s.resources.result += "A";
|
|
240
|
+
},
|
|
241
|
+
schedule: { before: ["async2"] }
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
// Pass in wrong order - should still execute A then B due to dependencies
|
|
245
|
+
await world.runSystems(["async2", "async1"]);
|
|
246
|
+
// Result "AB" proves async1 awaited before async2 started
|
|
247
|
+
expect(store.resources.result).toBe("AB");
|
|
248
|
+
});
|
|
249
|
+
it("should fully await async systems completion", async () => {
|
|
250
|
+
const { store, database } = createTestWorld();
|
|
251
|
+
const timestamps = [];
|
|
252
|
+
const world = createWorld(store, database, {
|
|
253
|
+
delayedSystem: {
|
|
254
|
+
type: "store",
|
|
255
|
+
run: async (s) => {
|
|
256
|
+
timestamps.push(performance.now());
|
|
257
|
+
await new Promise(resolve => setTimeout(resolve, 20));
|
|
258
|
+
timestamps.push(performance.now());
|
|
259
|
+
s.resources.result += "DONE";
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
const startTime = performance.now();
|
|
264
|
+
await world.runSystems(["delayedSystem"]);
|
|
265
|
+
const endTime = performance.now();
|
|
266
|
+
// Verify the system actually completed its async work
|
|
267
|
+
expect(store.resources.result).toBe("DONE");
|
|
268
|
+
expect(timestamps).toHaveLength(2);
|
|
269
|
+
// Verify we waited for the full async operation (at least 20ms)
|
|
270
|
+
expect(endTime - startTime).toBeGreaterThanOrEqual(19);
|
|
271
|
+
// Verify the async operation completed before runSystems returned
|
|
272
|
+
expect(timestamps[1]).toBeLessThanOrEqual(endTime);
|
|
273
|
+
});
|
|
274
|
+
it("should demonstrate sync systems complete immediately without Promise overhead", () => {
|
|
275
|
+
const { store, database } = createTestWorld();
|
|
276
|
+
let syncExecuted = false;
|
|
277
|
+
const world = createWorld(store, database, {
|
|
278
|
+
syncSystem: {
|
|
279
|
+
type: "store",
|
|
280
|
+
run: (s) => {
|
|
281
|
+
syncExecuted = true;
|
|
282
|
+
s.resources.result += "SYNC";
|
|
283
|
+
// Return a non-Promise value to test sync behavior
|
|
284
|
+
return undefined;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
// Call runSystems but don't await it initially
|
|
289
|
+
const promise = world.runSystems(["syncSystem"]);
|
|
290
|
+
// For truly sync systems, the execution should have completed synchronously
|
|
291
|
+
expect(syncExecuted).toBe(true);
|
|
292
|
+
expect(store.resources.result).toBe("SYNC");
|
|
293
|
+
// The promise should still be returned for consistent API
|
|
294
|
+
expect(promise).toBeInstanceOf(Promise);
|
|
295
|
+
});
|
|
296
|
+
it("should demonstrate that async systems don't complete until awaited", async () => {
|
|
297
|
+
const { store, database } = createTestWorld();
|
|
298
|
+
let asyncStarted = false;
|
|
299
|
+
let asyncCompleted = false;
|
|
300
|
+
const world = createWorld(store, database, {
|
|
301
|
+
asyncSystem: {
|
|
302
|
+
type: "store",
|
|
303
|
+
run: async (s) => {
|
|
304
|
+
asyncStarted = true;
|
|
305
|
+
await new Promise(resolve => setTimeout(resolve, 10));
|
|
306
|
+
asyncCompleted = true;
|
|
307
|
+
s.resources.result += "ASYNC";
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
// Start the async operation but don't await it
|
|
312
|
+
const promise = world.runSystems(["asyncSystem"]);
|
|
313
|
+
// The async system might have started but shouldn't be completed
|
|
314
|
+
expect(asyncStarted).toBe(true);
|
|
315
|
+
expect(asyncCompleted).toBe(false);
|
|
316
|
+
expect(store.resources.result).toBe(""); // Should be empty until completion
|
|
317
|
+
// Now await the promise
|
|
318
|
+
await promise;
|
|
319
|
+
// Now it should be completed
|
|
320
|
+
expect(asyncCompleted).toBe(true);
|
|
321
|
+
expect(store.resources.result).toBe("ASYNC");
|
|
322
|
+
});
|
|
323
|
+
it("should prove sync systems complete before Promise resolves but async systems don't", async () => {
|
|
324
|
+
const { store, database } = createTestWorld();
|
|
325
|
+
const executionLog = [];
|
|
326
|
+
const world = createWorld(store, database, {
|
|
327
|
+
syncFirst: {
|
|
328
|
+
type: "store",
|
|
329
|
+
run: (s) => {
|
|
330
|
+
executionLog.push("sync-start");
|
|
331
|
+
s.resources.result += "S";
|
|
332
|
+
executionLog.push("sync-end");
|
|
333
|
+
// Intentionally not returning a Promise
|
|
334
|
+
},
|
|
335
|
+
schedule: { before: ["asyncSecond"] }
|
|
336
|
+
},
|
|
337
|
+
asyncSecond: {
|
|
338
|
+
type: "store",
|
|
339
|
+
run: async (s) => {
|
|
340
|
+
executionLog.push("async-start");
|
|
341
|
+
await new Promise(resolve => {
|
|
342
|
+
setTimeout(() => {
|
|
343
|
+
executionLog.push("timeout-fired");
|
|
344
|
+
resolve(undefined);
|
|
345
|
+
}, 15);
|
|
346
|
+
});
|
|
347
|
+
executionLog.push("async-end");
|
|
348
|
+
s.resources.result += "A";
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
const startTime = performance.now();
|
|
353
|
+
// This should wait for BOTH systems to complete
|
|
354
|
+
await world.runSystems(["syncFirst", "asyncSecond"]);
|
|
355
|
+
const endTime = performance.now();
|
|
356
|
+
// Verify both systems completed
|
|
357
|
+
expect(store.resources.result).toBe("SA");
|
|
358
|
+
// Verify execution order in log
|
|
359
|
+
expect(executionLog).toEqual([
|
|
360
|
+
"sync-start",
|
|
361
|
+
"sync-end",
|
|
362
|
+
"async-start",
|
|
363
|
+
"timeout-fired",
|
|
364
|
+
"async-end"
|
|
365
|
+
]);
|
|
366
|
+
// Verify we waited for the async operation (at least 15ms)
|
|
367
|
+
expect(endTime - startTime).toBeGreaterThanOrEqual(14);
|
|
368
|
+
});
|
|
369
|
+
it("should handle mixed sync and async systems", async () => {
|
|
370
|
+
const { store, database } = createTestWorld();
|
|
371
|
+
// Define systems in completely reverse dependency order
|
|
372
|
+
const world = createWorld(store, database, {
|
|
373
|
+
syncAfter: {
|
|
374
|
+
type: "store",
|
|
375
|
+
run: (s) => {
|
|
376
|
+
s.resources.result += "E";
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
async: {
|
|
380
|
+
type: "database",
|
|
381
|
+
run: async (db) => {
|
|
382
|
+
await new Promise(resolve => setTimeout(resolve, 10));
|
|
383
|
+
db.transactions.appendToResult("A");
|
|
384
|
+
},
|
|
385
|
+
schedule: { before: ["syncAfter"] }
|
|
386
|
+
},
|
|
387
|
+
sync: {
|
|
388
|
+
type: "store",
|
|
389
|
+
run: (s) => {
|
|
390
|
+
s.resources.result += "S";
|
|
391
|
+
},
|
|
392
|
+
schedule: { before: ["async"] }
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
// Pass in completely wrong order - dependency resolution must fix it
|
|
396
|
+
await world.runSystems(["syncAfter", "async", "sync"]);
|
|
397
|
+
// Result "SAE" proves execution order: sync → async → syncAfter
|
|
398
|
+
expect(store.resources.result).toBe("SAE");
|
|
399
|
+
});
|
|
400
|
+
});
|
|
401
|
+
describe("caching behavior", () => {
|
|
402
|
+
it("should cache topological sort results for repeated calls", async () => {
|
|
403
|
+
const { store, database } = createTestWorld();
|
|
404
|
+
// We can't directly mock the internal topological sort, so we'll test through behavior
|
|
405
|
+
const world = createWorld(store, database, {
|
|
406
|
+
a: {
|
|
407
|
+
type: "store",
|
|
408
|
+
run: (s) => { s.resources.counter += 1; }
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
const systemArray = ["a"];
|
|
412
|
+
// First call - should compute and cache
|
|
413
|
+
await world.runSystems(systemArray);
|
|
414
|
+
expect(store.resources.counter).toBe(1);
|
|
415
|
+
// Second call with same array reference - should use cache
|
|
416
|
+
await world.runSystems(systemArray);
|
|
417
|
+
expect(store.resources.counter).toBe(2);
|
|
418
|
+
// Different array with same contents - should compute again
|
|
419
|
+
await world.runSystems(["a"]);
|
|
420
|
+
expect(store.resources.counter).toBe(3);
|
|
421
|
+
});
|
|
422
|
+
it("should cache empty array (all systems) separately", async () => {
|
|
423
|
+
const { store, database } = createTestWorld();
|
|
424
|
+
const world = createWorld(store, database, {
|
|
425
|
+
system1: {
|
|
426
|
+
type: "store",
|
|
427
|
+
run: (s) => { s.resources.result += "1"; }
|
|
428
|
+
},
|
|
429
|
+
system2: {
|
|
430
|
+
type: "store",
|
|
431
|
+
run: (s) => { s.resources.result += "2"; }
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
const emptyArray = [];
|
|
435
|
+
// First call with empty array - should run all systems
|
|
436
|
+
await world.runSystems(emptyArray);
|
|
437
|
+
const firstResult = store.resources.result;
|
|
438
|
+
expect(firstResult.length).toBe(2);
|
|
439
|
+
expect(firstResult).toMatch(/[12][12]/);
|
|
440
|
+
// Reset result
|
|
441
|
+
store.resources.result = "";
|
|
442
|
+
// Second call with same empty array reference - should use cache
|
|
443
|
+
await world.runSystems(emptyArray);
|
|
444
|
+
expect(store.resources.result).toBe(firstResult);
|
|
445
|
+
});
|
|
446
|
+
});
|
|
447
|
+
describe("error handling", () => {
|
|
448
|
+
it("should throw error and stop execution when system fails", async () => {
|
|
449
|
+
const { store, database } = createTestWorld();
|
|
450
|
+
const world = createWorld(store, database, {
|
|
451
|
+
before: {
|
|
452
|
+
type: "store",
|
|
453
|
+
run: (s) => { s.resources.result += "B"; },
|
|
454
|
+
schedule: { before: ["failing"] }
|
|
455
|
+
},
|
|
456
|
+
failing: {
|
|
457
|
+
type: "store",
|
|
458
|
+
run: () => { throw new Error("System failed"); },
|
|
459
|
+
schedule: { before: ["after"] }
|
|
460
|
+
},
|
|
461
|
+
after: {
|
|
462
|
+
type: "store",
|
|
463
|
+
run: (s) => { s.resources.result += "A"; }
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
await expect(world.runSystems(["before", "failing", "after"]))
|
|
467
|
+
.rejects.toThrow("System failed");
|
|
468
|
+
// Only the "before" system should have executed
|
|
469
|
+
expect(store.resources.result).toBe("B");
|
|
470
|
+
});
|
|
471
|
+
});
|
|
472
|
+
describe("dependency validation", () => {
|
|
473
|
+
it("should detect circular dependencies", async () => {
|
|
474
|
+
const { store, database } = createTestWorld();
|
|
475
|
+
// Define systems in random order to ensure circular detection works regardless
|
|
476
|
+
const world = createWorld(store, database, {
|
|
477
|
+
c: {
|
|
478
|
+
type: "store",
|
|
479
|
+
run: (s) => { s.resources.result += "C"; },
|
|
480
|
+
schedule: { before: ["a"] } // Creates circular dependency: c→a, a→b, b→c
|
|
481
|
+
},
|
|
482
|
+
a: {
|
|
483
|
+
type: "store",
|
|
484
|
+
run: (s) => { s.resources.result += "A"; },
|
|
485
|
+
schedule: { before: ["b"] }
|
|
486
|
+
},
|
|
487
|
+
b: {
|
|
488
|
+
type: "store",
|
|
489
|
+
run: (s) => { s.resources.result += "B"; },
|
|
490
|
+
schedule: { before: ["c"] }
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
// Order shouldn't matter - circular dependency should always be detected
|
|
494
|
+
await expect(world.runSystems(["c", "a", "b"]))
|
|
495
|
+
.rejects.toThrow("Circular dependency detected involving node:");
|
|
496
|
+
});
|
|
497
|
+
});
|
|
498
|
+
});
|
|
499
|
+
//# sourceMappingURL=create-world.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-world.test.js","sourceRoot":"","sources":["../../../src/ecs/world/create-world.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AAEX,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MA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C,OAAO,CAAC,OAAO,CAAC,8CAA8C,CAAC,CAAC;QACzE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*MIT License
|
|
2
|
+
|
|
3
|
+
© Copyright 2025 Adobe. All rights reserved.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.*/
|
|
22
|
+
export * from "./world.js";
|
|
23
|
+
export * from "./system.js";
|
|
24
|
+
export * from "./create-world.js";
|
|
25
|
+
export * from "./world-schema/index.js";
|
|
26
|
+
export * from "./system-phase.js";
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ecs/world/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AACX,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FromSchema } from "../../schema/schema.js";
|
|
2
|
+
export declare const SystemPhaseSchema: {
|
|
3
|
+
readonly enum: readonly ["input", "preUpdate", "update", "physics", "postUpdate", "preRender", "render", "postRender", "cleanup"];
|
|
4
|
+
};
|
|
5
|
+
export type SystemPhase = FromSchema<typeof SystemPhaseSchema>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-phase.js","sourceRoot":"","sources":["../../../src/ecs/world/system-phase.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC7B,IAAI,EAAE;QACF,OAAO;QAEP,WAAW;QACX,QAAQ;QACR,SAAS;QACT,YAAY;QAEZ,WAAW;QACX,QAAQ;QACR,YAAY;QAEZ,SAAS;KACZ;CACsB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { StringKeyof } from "../../types/types.js";
|
|
2
|
+
import { Database, Store, TransactionFunctions } from "../index.js";
|
|
3
|
+
import { ArchetypeComponents } from "../store/archetype-components.js";
|
|
4
|
+
import { Components } from "../store/components.js";
|
|
5
|
+
import { ResourceComponents } from "../store/resource-components.js";
|
|
6
|
+
import { SystemPhase } from "./system-phase.js";
|
|
7
|
+
import { SystemNames } from "./world.js";
|
|
8
|
+
export type StoreSystem<C extends Components, R extends ResourceComponents, A extends ArchetypeComponents<StringKeyof<C>>> = {
|
|
9
|
+
type: "store";
|
|
10
|
+
run: ((store: Store<C, R, A>) => void) | ((store: Store<C, R, A>) => Promise<void>);
|
|
11
|
+
};
|
|
12
|
+
export type DatabaseSystem<C extends Components, R extends ResourceComponents, A extends ArchetypeComponents<StringKeyof<C>>, T extends TransactionFunctions> = {
|
|
13
|
+
type: "database";
|
|
14
|
+
run: ((database: Database<C, R, A, T>) => void) | ((database: Database<C, R, A, T>) => Promise<void>);
|
|
15
|
+
};
|
|
16
|
+
export type System<C extends Components, R extends ResourceComponents, A extends ArchetypeComponents<StringKeyof<C>>, T extends TransactionFunctions, S extends SystemNames> = (StoreSystem<C, R, A> | DatabaseSystem<C, R, A, T>) & {
|
|
17
|
+
/**
|
|
18
|
+
* If not specified then the system will never run unless explicitly called.
|
|
19
|
+
*/
|
|
20
|
+
phase?: SystemPhase;
|
|
21
|
+
schedule?: {
|
|
22
|
+
before?: readonly S[];
|
|
23
|
+
after?: readonly S[];
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.js","sourceRoot":"","sources":["../../../src/ecs/world/system.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|