@adobe/data 0.9.5 → 0.9.6
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/ecs/database/create-plugin-cryos-pattern.test.d.ts +3 -0
- package/ecs/database/create-plugin-cryos-pattern.test.js +83 -0
- package/ecs/database/create-plugin-cryos-pattern.test.js.map +1 -0
- package/ecs/database/create-plugin-graphics.test.d.ts +93 -0
- package/ecs/database/create-plugin-graphics.test.js +135 -0
- package/ecs/database/create-plugin-graphics.test.js.map +1 -0
- package/ecs/database/create-plugin-type.type-test.js +563 -0
- package/ecs/database/create-plugin-type.type-test.js.map +1 -0
- package/ecs/database/create-plugin-type.type.test.js +563 -0
- package/ecs/database/create-plugin-type.type.test.js.map +1 -0
- package/ecs/database/database.d.ts +6 -1
- package/ecs/database/database.js.map +1 -1
- package/ecs/database/experimental-action-types.js +275 -0
- package/ecs/database/experimental-action-types.js.map +1 -0
- package/ecs/database/from-plugin.type-test.js +180 -0
- package/ecs/database/from-plugin.type-test.js.map +1 -0
- package/ecs/database/plugin-types.js +5 -0
- package/ecs/database/plugin-types.js.map +1 -0
- package/ecs/database/type-investigation.test.js +54 -0
- package/ecs/database/type-investigation.test.js.map +1 -0
- package/ecs/store/core/create-core.test.js +21 -0
- package/ecs/store/core/create-core.test.js.map +1 -1
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/typed-buffer/create-array-buffer.js +10 -0
- package/typed-buffer/create-array-buffer.js.map +1 -1
- package/typed-buffer/create-array-buffer.test.js +50 -0
- package/typed-buffer/create-array-buffer.test.js.map +1 -1
- package/typed-buffer/create-const-buffer.js +3 -0
- package/typed-buffer/create-const-buffer.js.map +1 -1
- package/typed-buffer/create-const-buffer.test.js +24 -0
- package/typed-buffer/create-const-buffer.test.js.map +1 -1
- package/typed-buffer/create-number-buffer.js +4 -0
- package/typed-buffer/create-number-buffer.js.map +1 -1
- package/typed-buffer/create-number-buffer.test.js +38 -0
- package/typed-buffer/create-number-buffer.test.js.map +1 -1
- package/typed-buffer/create-struct-buffer.js +11 -0
- package/typed-buffer/create-struct-buffer.js.map +1 -1
- package/typed-buffer/create-struct-buffer.test.js +60 -0
- package/typed-buffer/create-struct-buffer.test.js.map +1 -1
- package/typed-buffer/typed-buffer.d.ts +2 -0
- package/typed-buffer/typed-buffer.js.map +1 -1
- package/assembly/package.json +0 -1
- package/blob/package.json +0 -1
- package/cache/package.json +0 -1
- package/debug-type-test.js +0 -12
- package/debug-type-test.js.map +0 -1
- package/ecs/database/archetype-type-safety-test.d.ts +0 -21
- package/ecs/database/archetype-type-safety-test.js +0 -36
- package/ecs/database/archetype-type-safety-test.js.map +0 -1
- package/ecs/database/create-database-schema-test.js +0 -150
- package/ecs/database/create-database-schema-test.js.map +0 -1
- package/ecs/database/create-plugin-v2.d.ts +0 -79
- package/ecs/database/create-plugin-v2.js +0 -68
- package/ecs/database/create-plugin-v2.js.map +0 -1
- package/ecs/database/create-plugin-v2.test.js +0 -362
- package/ecs/database/create-plugin-v2.test.js.map +0 -1
- package/ecs/database/create-plugin.OLD.d.ts +0 -138
- package/ecs/database/create-plugin.OLD.js +0 -59
- package/ecs/database/create-plugin.OLD.js.map +0 -1
- package/ecs/database/database-with-systems.test.js +0 -292
- package/ecs/database/database-with-systems.test.js.map +0 -1
- package/ecs/database/database.plugin.create.test.OLD.js +0 -601
- package/ecs/database/database.plugin.create.test.OLD.js.map +0 -1
- package/ecs/database/database.plugin.create.test.js +0 -321
- package/ecs/database/database.plugin.create.test.js.map +0 -1
- package/ecs/database/database.plugin.test.d.ts +0 -1
- package/ecs/database/database.plugin.test.js +0 -90
- package/ecs/database/database.plugin.test.js.map +0 -1
- package/ecs/database/database.test copy.d.ts +0 -1
- package/ecs/database/database.test copy.js +0 -199
- package/ecs/database/database.test copy.js.map +0 -1
- package/ecs/database/multi-param-inference-poc.test.d.ts +0 -1
- package/ecs/database/multi-param-inference-poc.test.js +0 -96
- package/ecs/database/multi-param-inference-poc.test.js.map +0 -1
- package/ecs/database/old-plugin-create-with-dependencies-array.d.ts +0 -61
- package/ecs/database/old-plugin-create-with-dependencies-array.js +0 -76
- package/ecs/database/old-plugin-create-with-dependencies-array.js.map +0 -1
- package/ecs/database/overload-inference-poc.test.d.ts +0 -1
- package/ecs/database/overload-inference-poc.test.js +0 -109
- package/ecs/database/overload-inference-poc.test.js.map +0 -1
- package/ecs/database/schedule-type-check-demo.d.ts +0 -10
- package/ecs/database/schedule-type-check-demo.js +0 -71
- package/ecs/database/schedule-type-check-demo.js.map +0 -1
- package/ecs/database/test-archetype-validation.d.ts +0 -9
- package/ecs/database/test-archetype-validation.js +0 -14
- package/ecs/database/test-archetype-validation.js.map +0 -1
- package/ecs/database/test-exactkeys.d.ts +0 -1
- package/ecs/database/test-exactkeys.js +0 -17
- package/ecs/database/test-exactkeys.js.map +0 -1
- package/ecs/database/transactional-store/coalesce-transactions.test.js +0 -433
- package/ecs/database/transactional-store/coalesce-transactions.test.js.map +0 -1
- package/ecs/database/type-inference-demo.d.ts +0 -75
- package/ecs/database/type-inference-demo.js +0 -73
- package/ecs/database/type-inference-demo.js.map +0 -1
- package/ecs/database/type-inference-poc.test.d.ts +0 -1
- package/ecs/database/type-inference-poc.test.js +0 -73
- package/ecs/database/type-inference-poc.test.js.map +0 -1
- package/ecs/package.json +0 -1
- package/ecs/plugins/scheduler/create-scheduler-plugin.d.ts +0 -8
- package/ecs/plugins/scheduler/create-scheduler-plugin.js +0 -54
- package/ecs/plugins/scheduler/create-scheduler-plugin.js.map +0 -1
- package/ecs/plugins/scheduler/create-scheduler-plugin.test.d.ts +0 -1
- package/ecs/plugins/scheduler/create-scheduler-plugin.test.js +0 -198
- package/ecs/plugins/scheduler/create-scheduler-plugin.test.js.map +0 -1
- package/ecs/plugins/scheduler/type-inference-test.d.ts +0 -1
- package/ecs/plugins/scheduler/type-inference-test.js +0 -2
- package/ecs/plugins/scheduler/type-inference-test.js.map +0 -1
- package/ecs/store/entity-functions.d.ts +0 -7
- package/ecs/store/entity-functions.js +0 -2
- package/ecs/store/entity-functions.js.map +0 -1
- package/ecs/store/functions.d.ts +0 -2
- package/ecs/store/functions.js +0 -2
- package/ecs/store/functions.js.map +0 -1
- package/ecs/system/system-declaration.d.ts +0 -7
- package/ecs/system/system-declaration.js +0 -23
- package/ecs/system/system-declaration.js.map +0 -1
- package/ecs/system/system-declarations.d.ts +0 -4
- package/ecs/system/system-declarations.js +0 -23
- package/ecs/system/system-declarations.js.map +0 -1
- package/ecs/system/system-factory/public/create copy.d.ts +0 -12
- package/ecs/system/system-factory/public/create copy.js +0 -8
- package/ecs/system/system-factory/public/create copy.js.map +0 -1
- package/ecs/system/system-factory/public/create.d.ts +0 -12
- package/ecs/system/system-factory/public/create.js +0 -8
- package/ecs/system/system-factory/public/create.js.map +0 -1
- package/ecs/system/system-factory/public/create.test.d.ts +0 -1
- package/ecs/system/system-factory/public/create.test.js +0 -42
- package/ecs/system/system-factory/public/create.test.js.map +0 -1
- package/ecs/system/system-factory/public/index.d.ts +0 -1
- package/ecs/system/system-factory/public/index.js +0 -2
- package/ecs/system/system-factory/public/index.js.map +0 -1
- package/ecs/system/system-factory/system-factory.d.ts +0 -17
- package/ecs/system/system-factory/system-factory.js +0 -23
- package/ecs/system/system-factory/system-factory.js.map +0 -1
- package/ecs/system/system-factory.d.ts +0 -9
- package/ecs/system/system-factory.js +0 -23
- package/ecs/system/system-factory.js.map +0 -1
- package/ecs/system/system-interface.d.ts +0 -5
- package/ecs/system/system-interface.js +0 -2
- package/ecs/system/system-interface.js.map +0 -1
- package/ecs/system/system.d.ts +0 -4
- package/ecs/system/system.js +0 -23
- package/ecs/system/system.js.map +0 -1
- package/ecs/system/systems-type.d.ts +0 -2
- package/ecs/system/systems-type.js +0 -2
- package/ecs/system/systems-type.js.map +0 -1
- package/ecs/system/systems.d.ts +0 -2
- package/ecs/system/systems.js +0 -23
- package/ecs/system/systems.js.map +0 -1
- package/ecs/system/world-schema/public/create.d.ts +0 -12
- package/ecs/system/world-schema/public/create.js +0 -8
- package/ecs/system/world-schema/public/create.js.map +0 -1
- package/ecs/system/world-schema/public/create.test.d.ts +0 -1
- package/ecs/system/world-schema/public/create.test.js +0 -42
- package/ecs/system/world-schema/public/create.test.js.map +0 -1
- package/ecs/system/world-schema/public/index.d.ts +0 -1
- package/ecs/system/world-schema/public/index.js +0 -2
- package/ecs/system/world-schema/public/index.js.map +0 -1
- package/ecs/system/world-schema/system-factory.d.ts +0 -17
- package/ecs/system/world-schema/system-factory.js +0 -23
- package/ecs/system/world-schema/system-factory.js.map +0 -1
- package/ecs/world/calculate-system-order.d.ts +0 -18
- package/ecs/world/calculate-system-order.js +0 -113
- package/ecs/world/calculate-system-order.js.map +0 -1
- package/ecs/world/calculate-system-order.test.d.ts +0 -1
- package/ecs/world/calculate-system-order.test.js +0 -168
- package/ecs/world/calculate-system-order.test.js.map +0 -1
- package/ecs/world/create-world-schema-test.d.ts +0 -1
- package/ecs/world/create-world-schema-test.js +0 -294
- package/ecs/world/create-world-schema-test.js.map +0 -1
- package/ecs/world/create-world-type-test.d.ts +0 -1
- package/ecs/world/create-world-type-test.js +0 -129
- package/ecs/world/create-world-type-test.js.map +0 -1
- package/ecs/world/create-world.d.ts +0 -19
- package/ecs/world/create-world.js +0 -80
- package/ecs/world/create-world.js.map +0 -1
- package/ecs/world/create-world.test.d.ts +0 -1
- package/ecs/world/create-world.test.js +0 -292
- package/ecs/world/create-world.test.js.map +0 -1
- package/ecs/world/public/world-schema/public/create.d.ts +0 -12
- package/ecs/world/public/world-schema/public/create.js +0 -8
- package/ecs/world/public/world-schema/public/create.js.map +0 -1
- package/ecs/world/public/world-schema/public/create.test.d.ts +0 -1
- package/ecs/world/public/world-schema/public/create.test.js +0 -42
- package/ecs/world/public/world-schema/public/create.test.js.map +0 -1
- package/ecs/world/public/world-schema/public/index.d.ts +0 -1
- package/ecs/world/public/world-schema/public/index.js +0 -2
- package/ecs/world/public/world-schema/public/index.js.map +0 -1
- package/ecs/world/public/world-schema/world-schema.d.ts +0 -17
- package/ecs/world/public/world-schema/world-schema.js +0 -23
- package/ecs/world/public/world-schema/world-schema.js.map +0 -1
- package/ecs/world/system-declaration.d.ts +0 -1
- package/ecs/world/system-declaration.js +0 -23
- package/ecs/world/system-declaration.js.map +0 -1
- package/ecs/world/system-schedule-typing-test.d.ts +0 -1
- package/ecs/world/system-schedule-typing-test.js +0 -83
- package/ecs/world/system-schedule-typing-test.js.map +0 -1
- package/ecs/world/world-schema/public/create.d.ts +0 -12
- package/ecs/world/world-schema/public/create.js +0 -10
- package/ecs/world/world-schema/public/create.js.map +0 -1
- package/ecs/world/world-schema/public/create.test.d.ts +0 -1
- package/ecs/world/world-schema/public/create.test.js +0 -41
- package/ecs/world/world-schema/public/create.test.js.map +0 -1
- package/ecs/world/world-schema/public/index.d.ts +0 -1
- package/ecs/world/world-schema/public/index.js +0 -2
- package/ecs/world/world-schema/public/index.js.map +0 -1
- package/ecs/world/world-schema/system-factory.d.ts +0 -17
- package/ecs/world/world-schema/system-factory.js +0 -23
- package/ecs/world/world-schema/system-factory.js.map +0 -1
- package/ecs/world/world-schema/world-schema.d.ts +0 -19
- package/ecs/world/world-schema/world-schema.js +0 -23
- package/ecs/world/world-schema/world-schema.js.map +0 -1
- package/ecs/world/world.d.ts +0 -86
- package/ecs/world/world.js +0 -81
- package/ecs/world/world.js.map +0 -1
- package/ecs/world/world.test.d.ts +0 -1
- package/ecs/world/world.test.js +0 -176
- package/ecs/world/world.test.js.map +0 -1
- package/functions/package.json +0 -1
- package/lit/elements/application-element copy.d.ts +0 -9
- package/lit/elements/application-element copy.js +0 -62
- package/lit/elements/application-element copy.js.map +0 -1
- package/lit/package.json +0 -1
- package/math/package.json +0 -1
- package/observe/package.json +0 -1
- package/old-ecs/package.json +0 -1
- package/perftest/package.json +0 -1
- package/samples/package.json +0 -1
- package/schema/package.json +0 -1
- package/service/package.json +0 -1
- package/table/package.json +0 -1
- package/typed-buffer/package.json +0 -1
- package/types/package.json +0 -1
- /package/{debug-type-test.d.ts → ecs/database/create-plugin-type.type-test.d.ts} +0 -0
- /package/ecs/database/{create-database-schema-test.d.ts → create-plugin-type.type.test.d.ts} +0 -0
- /package/ecs/database/{create-plugin-v2.test.d.ts → experimental-action-types.d.ts} +0 -0
- /package/ecs/database/{database-with-systems.test.d.ts → from-plugin.type-test.d.ts} +0 -0
- /package/ecs/database/{database.plugin.create.test.OLD.d.ts → plugin-types.d.ts} +0 -0
- /package/ecs/database/{database.plugin.create.test.d.ts → type-investigation.test.d.ts} +0 -0
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { describe, test } from "vitest";
|
|
2
|
-
/**
|
|
3
|
-
* Proof of Concept: Can TypeScript infer types progressively across N parameters?
|
|
4
|
-
*
|
|
5
|
-
* Goal: Each parameter's type should be inferred based on accumulated types from previous parameters
|
|
6
|
-
*/
|
|
7
|
-
describe("Multi-Parameter Progressive Type Inference POC", () => {
|
|
8
|
-
test("POC 1: Two parameters with progressive inference", () => {
|
|
9
|
-
function createWithTwo(first, second) {
|
|
10
|
-
const accumulated = { data: first };
|
|
11
|
-
const secondResult = second(accumulated);
|
|
12
|
-
return { data: { ...first, ...secondResult } };
|
|
13
|
-
}
|
|
14
|
-
const result = createWithTwo({ x: 10, y: 20 }, (acc) => {
|
|
15
|
-
// Can we infer acc.data.x and acc.data.y?
|
|
16
|
-
const sum = acc.data.x + acc.data.y; // Should work!
|
|
17
|
-
return { sum };
|
|
18
|
-
});
|
|
19
|
-
console.log("Result:", result.data); // { x: 10, y: 20, sum: 30 }
|
|
20
|
-
});
|
|
21
|
-
test("POC 2: Three parameters with progressive inference", () => {
|
|
22
|
-
function createWithThree(first, second, third) {
|
|
23
|
-
const step1 = { data: first };
|
|
24
|
-
const step2Result = second(step1);
|
|
25
|
-
const step2 = { data: { ...first, ...step2Result } };
|
|
26
|
-
const step3Result = third(step2);
|
|
27
|
-
return { data: { ...first, ...step2Result, ...step3Result } };
|
|
28
|
-
}
|
|
29
|
-
const result = createWithThree({ x: 10 }, (acc) => {
|
|
30
|
-
const doubled = acc.data.x * 2;
|
|
31
|
-
return { doubled };
|
|
32
|
-
}, (acc) => {
|
|
33
|
-
const sum = acc.data.x + acc.data.doubled; // Should infer both!
|
|
34
|
-
return { sum };
|
|
35
|
-
});
|
|
36
|
-
console.log("Result:", result.data); // { x: 10, doubled: 20, sum: 30 }
|
|
37
|
-
});
|
|
38
|
-
test("POC 3: Variadic parameters with rest syntax", () => {
|
|
39
|
-
// Can we use rest parameters for N steps?
|
|
40
|
-
function createWithSteps(initial, ...steps) {
|
|
41
|
-
let accumulated = { data: initial };
|
|
42
|
-
for (const step of steps) {
|
|
43
|
-
const result = step(accumulated);
|
|
44
|
-
accumulated = { data: { ...accumulated.data, ...result } };
|
|
45
|
-
}
|
|
46
|
-
return accumulated;
|
|
47
|
-
}
|
|
48
|
-
// Test it - but note: inference might be weak here
|
|
49
|
-
const result = createWithSteps({ x: 10 }, (acc) => ({ doubled: acc.data.x * 2 }), (acc) => ({ sum: acc.data.x + acc.data.doubled }));
|
|
50
|
-
console.log("Result:", result.data);
|
|
51
|
-
});
|
|
52
|
-
test("POC 4: Database-like pattern with components -> systems inference", () => {
|
|
53
|
-
function createPlugin(components, systems) {
|
|
54
|
-
const db = {
|
|
55
|
-
components,
|
|
56
|
-
get(key) { return components[key]; }
|
|
57
|
-
};
|
|
58
|
-
const systemResults = systems(db);
|
|
59
|
-
return {
|
|
60
|
-
components,
|
|
61
|
-
systems: systemResults
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
const plugin = createPlugin({
|
|
65
|
-
position: { x: 0, y: 0 },
|
|
66
|
-
velocity: { x: 1, y: 1 }
|
|
67
|
-
}, (db) => ({
|
|
68
|
-
// db should be inferred with position and velocity!
|
|
69
|
-
physicsSystem: () => {
|
|
70
|
-
const pos = db.get("position"); // Should work!
|
|
71
|
-
const vel = db.get("velocity"); // Should work!
|
|
72
|
-
console.log(pos, vel);
|
|
73
|
-
}
|
|
74
|
-
}));
|
|
75
|
-
console.log("Plugin:", plugin);
|
|
76
|
-
});
|
|
77
|
-
test("POC 5: Builder pattern with method chaining (for comparison)", () => {
|
|
78
|
-
class Builder {
|
|
79
|
-
constructor(data) {
|
|
80
|
-
this.data = data;
|
|
81
|
-
}
|
|
82
|
-
add(key, value) {
|
|
83
|
-
return new Builder({ ...this.data, [key]: value });
|
|
84
|
-
}
|
|
85
|
-
build() {
|
|
86
|
-
return this.data;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
const result = new Builder({ x: 10 })
|
|
90
|
-
.add("doubled", 20)
|
|
91
|
-
.add("sum", 30)
|
|
92
|
-
.build();
|
|
93
|
-
console.log("Builder result:", result);
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
//# sourceMappingURL=multi-param-inference-poc.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"multi-param-inference-poc.test.js","sourceRoot":"","sources":["../../../src/ecs/database/multi-param-inference-poc.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAExC;;;;GAIG;AAEH,QAAQ,CAAC,gDAAgD,EAAE,GAAG,EAAE;IAE9D,IAAI,CAAC,kDAAkD,EAAE,GAAG,EAAE;QAM5D,SAAS,aAAa,CAIpB,KAAQ,EACR,MAAkC;YAElC,MAAM,WAAW,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;YACpC,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;YACzC,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,YAAY,EAAE,EAAE,CAAC;QACjD,CAAC;QAED,MAAM,MAAM,GAAG,aAAa,CAC1B,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAChB,CAAC,GAAG,EAAE,EAAE;YACN,0CAA0C;YAC1C,MAAM,GAAG,GAAG,GAAG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AAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type { ComponentSchemas } from "../component-schemas.js";
|
|
2
|
-
import type { ResourceSchemas } from "../resource-schemas.js";
|
|
3
|
-
import type { ArchetypeComponents } from "../store/archetype-components.js";
|
|
4
|
-
import type { ActionDeclarations } from "../store/action-functions.js";
|
|
5
|
-
import type { FromSchemas } from "../../schema/index.js";
|
|
6
|
-
import type { IntersectTuple, StringKeyof } from "../../types/types.js";
|
|
7
|
-
export declare namespace OldDatabaseSchema {
|
|
8
|
-
type Schema<CS extends ComponentSchemas = any, RS extends ResourceSchemas = any, A extends ArchetypeComponents<StringKeyof<CS>> = any, TD extends ActionDeclarations<FromSchemas<CS>, FromSchemas<RS>, A> = any> = {
|
|
9
|
-
readonly components: CS;
|
|
10
|
-
readonly resources: RS;
|
|
11
|
-
readonly archetypes: A;
|
|
12
|
-
readonly transactions: TD;
|
|
13
|
-
};
|
|
14
|
-
namespace Schema {
|
|
15
|
-
/**
|
|
16
|
-
* Intersect multiple schemas into a single merged schema type
|
|
17
|
-
*/
|
|
18
|
-
type Intersect<T extends readonly Schema<any, any, any, any>[]> = Schema<{} & IntersectTuple<{
|
|
19
|
-
[K in keyof T]: T[K] extends Schema<infer C, infer R, infer A, infer TD> ? C : never;
|
|
20
|
-
}>, {} & IntersectTuple<{
|
|
21
|
-
[K in keyof T]: T[K] extends Schema<any, infer R, any, any> ? R : never;
|
|
22
|
-
}>, {} & IntersectTuple<{
|
|
23
|
-
[K in keyof T]: T[K] extends Schema<any, any, infer A, any> ? A : never;
|
|
24
|
-
}>, {} & IntersectTuple<{
|
|
25
|
-
[K in keyof T]: T[K] extends Schema<any, any, any, infer TD> ? TD : never;
|
|
26
|
-
}>>;
|
|
27
|
-
/**
|
|
28
|
-
* OLD SIGNATURE: Create a schema with optional dependencies array
|
|
29
|
-
*
|
|
30
|
-
* @param schema - The schema descriptor containing components, resources, archetypes, and transactions
|
|
31
|
-
* @param dependencies - Optional array of dependency schemas to merge with the primary schema
|
|
32
|
-
* @returns Merged schema containing all properties from the input schema and dependencies
|
|
33
|
-
*
|
|
34
|
-
* Example usage:
|
|
35
|
-
* ```typescript
|
|
36
|
-
* const baseSchema = Database.Schema.create({
|
|
37
|
-
* components: { position: { type: "number" } },
|
|
38
|
-
* resources: { time: { default: 0 } },
|
|
39
|
-
* archetypes: {},
|
|
40
|
-
* transactions: {}
|
|
41
|
-
* });
|
|
42
|
-
*
|
|
43
|
-
* const extendedSchema = Database.Schema.create(
|
|
44
|
-
* {
|
|
45
|
-
* components: { velocity: { type: "number" } },
|
|
46
|
-
* resources: { delta: { default: 0 } },
|
|
47
|
-
* archetypes: { Moving: ["position", "velocity"] },
|
|
48
|
-
* transactions: {}
|
|
49
|
-
* },
|
|
50
|
-
* [baseSchema] // Dependencies array
|
|
51
|
-
* );
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
function create<const CS extends ComponentSchemas, const RS extends ResourceSchemas, const A extends ArchetypeComponents<StringKeyof<CS & Intersect<D>["components"]>>, const TD extends ActionDeclarations<FromSchemas<CS & Intersect<D>["components"]>, FromSchemas<RS & Intersect<D>["resources"]>, A>, const D extends readonly Schema<any, any, any, any>[]>(schema: {
|
|
55
|
-
components: CS;
|
|
56
|
-
resources: RS;
|
|
57
|
-
archetypes: A;
|
|
58
|
-
transactions: TD;
|
|
59
|
-
}, dependencies?: D): Intersect<[Schema<CS, RS, A, TD>, ...D]>;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* REFERENCE FILE - OLD IMPLEMENTATION
|
|
3
|
-
*
|
|
4
|
-
* This file contains the old Database.Schema.create implementation from commit 05dfb00
|
|
5
|
-
* where the function accepted:
|
|
6
|
-
* 1. A single schema descriptor as first argument
|
|
7
|
-
* 2. An optional array of dependency schemas as second argument
|
|
8
|
-
*
|
|
9
|
-
* This was later refactored to use rest parameters instead.
|
|
10
|
-
*/
|
|
11
|
-
export var OldDatabaseSchema;
|
|
12
|
-
(function (OldDatabaseSchema) {
|
|
13
|
-
let Schema;
|
|
14
|
-
(function (Schema) {
|
|
15
|
-
/**
|
|
16
|
-
* OLD SIGNATURE: Create a schema with optional dependencies array
|
|
17
|
-
*
|
|
18
|
-
* @param schema - The schema descriptor containing components, resources, archetypes, and transactions
|
|
19
|
-
* @param dependencies - Optional array of dependency schemas to merge with the primary schema
|
|
20
|
-
* @returns Merged schema containing all properties from the input schema and dependencies
|
|
21
|
-
*
|
|
22
|
-
* Example usage:
|
|
23
|
-
* ```typescript
|
|
24
|
-
* const baseSchema = Database.Schema.create({
|
|
25
|
-
* components: { position: { type: "number" } },
|
|
26
|
-
* resources: { time: { default: 0 } },
|
|
27
|
-
* archetypes: {},
|
|
28
|
-
* transactions: {}
|
|
29
|
-
* });
|
|
30
|
-
*
|
|
31
|
-
* const extendedSchema = Database.Schema.create(
|
|
32
|
-
* {
|
|
33
|
-
* components: { velocity: { type: "number" } },
|
|
34
|
-
* resources: { delta: { default: 0 } },
|
|
35
|
-
* archetypes: { Moving: ["position", "velocity"] },
|
|
36
|
-
* transactions: {}
|
|
37
|
-
* },
|
|
38
|
-
* [baseSchema] // Dependencies array
|
|
39
|
-
* );
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
function create(schema, dependencies) {
|
|
43
|
-
return (dependencies ?? []).reduce((acc, curr) => {
|
|
44
|
-
return {
|
|
45
|
-
components: { ...acc.components, ...curr.components },
|
|
46
|
-
resources: { ...acc.resources, ...curr.resources },
|
|
47
|
-
archetypes: { ...acc.archetypes, ...curr.archetypes },
|
|
48
|
-
transactions: { ...acc.transactions, ...curr.transactions },
|
|
49
|
-
};
|
|
50
|
-
}, schema);
|
|
51
|
-
}
|
|
52
|
-
Schema.create = create;
|
|
53
|
-
})(Schema = OldDatabaseSchema.Schema || (OldDatabaseSchema.Schema = {}));
|
|
54
|
-
})(OldDatabaseSchema || (OldDatabaseSchema = {}));
|
|
55
|
-
/*
|
|
56
|
-
* KEY DIFFERENCES FROM CURRENT IMPLEMENTATION:
|
|
57
|
-
*
|
|
58
|
-
* OLD (this file):
|
|
59
|
-
* - Second parameter is an ARRAY of dependencies: `dependencies?: D`
|
|
60
|
-
* - Signature: create(schema, [dep1, dep2, dep3])
|
|
61
|
-
* - Uses reduce to merge dependencies with schema
|
|
62
|
-
*
|
|
63
|
-
* CURRENT (create-plugin.ts):
|
|
64
|
-
* - Uses REST PARAMETERS: ...args
|
|
65
|
-
* - Signature: create(schema1, schema2, schema3, ...)
|
|
66
|
-
* - Multiple overloads for 1-4 arguments
|
|
67
|
-
* - More flexible but more complex type definitions
|
|
68
|
-
*
|
|
69
|
-
* MIGRATION PATH:
|
|
70
|
-
* If you want to convert old code to new:
|
|
71
|
-
* OLD: Database.Schema.create(schema, [dep1, dep2])
|
|
72
|
-
* NEW: Database.Plugin.create(dep1, dep2, schema)
|
|
73
|
-
*
|
|
74
|
-
* Note: The order is reversed - dependencies come first, then the main schema
|
|
75
|
-
*/
|
|
76
|
-
//# sourceMappingURL=old-plugin-create-with-dependencies-array.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"old-plugin-create-with-dependencies-array.js","sourceRoot":"","sources":["../../../src/ecs/database/old-plugin-create-with-dependencies-array.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AASH,MAAM,KAAW,iBAAiB,CA+EjC;AA/ED,WAAiB,iBAAiB;IAahC,IAAiB,MAAM,CAiEtB;IAjED,WAAiB,MAAM;QAYrB;;;;;;;;;;;;;;;;;;;;;;;;;;WA0BG;QACH,SAAgB,MAAM,CAOpB,MAKC,EACD,YAAgB;YAEhB,OAAO,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;gBAC/C,OAAO;oBACL,UAAU,EAAE,EAAE,GAAG,GAAG,CAAC,UAAU,EAAE,GAAG,IAAI,CAAC,UAAU,EAAE;oBACrD,SAAS,EAAE,EAAE,GAAG,GAAG,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,SAAS,EAAE;oBAClD,UAAU,EAAE,EAAE,GAAG,GAAG,CAAC,UAAU,EAAE,GAAG,IAAI,CAAC,UAAU,EAAE;oBACrD,YAAY,EAAE,EAAE,GAAG,GAAG,CAAC,YAAY,EAAE,GAAG,IAAI,CAAC,YAAY,EAAE;iBAC5D,CAAA;YACH,CAAC,EACC,MAAM,CACA,CAAC;QACX,CAAC;QAzBe,aAAM,SAyBrB,CAAA;IACH,CAAC,EAjEgB,MAAM,GAAN,wBAAM,KAAN,wBAAM,QAiEtB;AACH,CAAC,EA/EgB,iBAAiB,KAAjB,iBAAiB,QA+EjC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { describe, test } from "vitest";
|
|
2
|
-
/**
|
|
3
|
-
* POC: Can we use overloads with explicit types + rest implementation for progressive inference?
|
|
4
|
-
*
|
|
5
|
-
* Strategy:
|
|
6
|
-
* - Define N overload signatures with explicit type threading
|
|
7
|
-
* - Implementation uses ...rest parameters
|
|
8
|
-
* - TypeScript should use overload signatures for inference!
|
|
9
|
-
*/
|
|
10
|
-
describe("Overload + Rest Implementation POC", () => {
|
|
11
|
-
test("POC 1: Simple overload with 1-3 parameters", () => {
|
|
12
|
-
// Implementation uses rest parameters
|
|
13
|
-
function create(...args) {
|
|
14
|
-
let accumulated = { data: args[0] };
|
|
15
|
-
for (let i = 1; i < args.length; i++) {
|
|
16
|
-
if (typeof args[i] === 'function') {
|
|
17
|
-
const result = args[i](accumulated);
|
|
18
|
-
accumulated = { data: { ...accumulated.data, ...result } };
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return accumulated;
|
|
22
|
-
}
|
|
23
|
-
// Test 1 parameter
|
|
24
|
-
const r1 = create({ x: 10 });
|
|
25
|
-
console.log("1 param:", r1.data); // { x: 10 }
|
|
26
|
-
// Test 2 parameters with inference
|
|
27
|
-
const r2 = create({ x: 10 }, (acc) => {
|
|
28
|
-
// acc.data.x should be inferred!
|
|
29
|
-
const doubled = acc.data.x * 2;
|
|
30
|
-
return { doubled };
|
|
31
|
-
});
|
|
32
|
-
console.log("2 params:", r2.data); // { x: 10, doubled: 20 }
|
|
33
|
-
// Test 3 parameters with inference
|
|
34
|
-
const r3 = create({ x: 10 }, (acc) => {
|
|
35
|
-
const doubled = acc.data.x * 2;
|
|
36
|
-
return { doubled };
|
|
37
|
-
}, (acc) => {
|
|
38
|
-
// acc.data.x AND acc.data.doubled should be inferred!
|
|
39
|
-
const sum = acc.data.x + acc.data.doubled;
|
|
40
|
-
return { sum };
|
|
41
|
-
});
|
|
42
|
-
console.log("3 params:", r3.data); // { x: 10, doubled: 20, sum: 30 }
|
|
43
|
-
});
|
|
44
|
-
test("POC 2: Database.Plugin-like pattern", () => {
|
|
45
|
-
// Implementation with rest
|
|
46
|
-
function createPlugin(...args) {
|
|
47
|
-
const data = args[0];
|
|
48
|
-
const systemsFn = args[1];
|
|
49
|
-
const db = {
|
|
50
|
-
components: data.components,
|
|
51
|
-
resources: data.resources,
|
|
52
|
-
get(key) { return this.components[key]; },
|
|
53
|
-
getResource(key) { return this.resources[key]; }
|
|
54
|
-
};
|
|
55
|
-
const systems = systemsFn ? systemsFn(db) : {};
|
|
56
|
-
return {
|
|
57
|
-
components: data.components,
|
|
58
|
-
resources: data.resources,
|
|
59
|
-
systems
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
// Test without systems
|
|
63
|
-
const p1 = createPlugin({
|
|
64
|
-
components: { position: { x: 0, y: 0 } },
|
|
65
|
-
resources: { time: 0 }
|
|
66
|
-
});
|
|
67
|
-
console.log("Plugin 1:", p1);
|
|
68
|
-
// Test with systems - db should be fully inferred!
|
|
69
|
-
const p2 = createPlugin({
|
|
70
|
-
components: { position: { x: 0, y: 0 } },
|
|
71
|
-
resources: { time: 0 }
|
|
72
|
-
}, (db) => ({
|
|
73
|
-
// db.get and db.getResource should work without explicit typing!
|
|
74
|
-
physicsSystem: () => {
|
|
75
|
-
const pos = db.get("position");
|
|
76
|
-
const time = db.getResource("time");
|
|
77
|
-
console.log(pos, time);
|
|
78
|
-
}
|
|
79
|
-
}));
|
|
80
|
-
console.log("Plugin 2:", p2);
|
|
81
|
-
});
|
|
82
|
-
test("POC 3: Full Database.Plugin pattern with 4 overloads", () => {
|
|
83
|
-
// Implementation with rest
|
|
84
|
-
function create(...args) {
|
|
85
|
-
const [components = {}, resources = {}, archetypes = {}, transactions = {}, systemsFn] = args;
|
|
86
|
-
const db = { components, resources, archetypes, transactions };
|
|
87
|
-
const systems = systemsFn ? systemsFn(db) : {};
|
|
88
|
-
return { components, resources, archetypes, transactions, systems };
|
|
89
|
-
}
|
|
90
|
-
// Test 1 param
|
|
91
|
-
const p1 = create({ position: { x: 0 } });
|
|
92
|
-
console.log("1 param plugin:", p1);
|
|
93
|
-
// Test 2 params
|
|
94
|
-
const p2 = create({ position: { x: 0 } }, { time: 0 });
|
|
95
|
-
console.log("2 param plugin:", p2);
|
|
96
|
-
// Test 5 params with inference
|
|
97
|
-
const p3 = create({ position: { x: 0, y: 0 } }, { time: 0 }, { player: ["position"] }, { move: (store) => { } }, (db) => ({
|
|
98
|
-
// db.components, db.resources, etc should all be inferred!
|
|
99
|
-
physicsSystem: () => {
|
|
100
|
-
const pos = db.components.position;
|
|
101
|
-
const time = db.resources.time;
|
|
102
|
-
const arch = db.archetypes.player;
|
|
103
|
-
console.log(pos, time, arch);
|
|
104
|
-
}
|
|
105
|
-
}));
|
|
106
|
-
console.log("5 param plugin:", p3);
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
//# sourceMappingURL=overload-inference-poc.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"overload-inference-poc.test.js","sourceRoot":"","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CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;YAC/B,CAAC;SACF,CAAC,CACH,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Demo file showing compile-time type checking for schedule.before/after
|
|
3
|
-
*
|
|
4
|
-
* This demonstrates that TypeScript will autocomplete and type-check
|
|
5
|
-
* system names from dependencies in the schedule properties.
|
|
6
|
-
*/
|
|
7
|
-
import { Database } from "./database.js";
|
|
8
|
-
declare const validPlugin: Required<Database.Plugin<any, any, any, any, any>>;
|
|
9
|
-
declare const invalidPlugin: Required<Database.Plugin<any, any, any, any, any>>;
|
|
10
|
-
export { validPlugin, invalidPlugin };
|
|
@@ -1,71 +0,0 @@
|
|
|
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
|
-
/**
|
|
23
|
-
* Demo file showing compile-time type checking for schedule.before/after
|
|
24
|
-
*
|
|
25
|
-
* This demonstrates that TypeScript will autocomplete and type-check
|
|
26
|
-
* system names from dependencies in the schedule properties.
|
|
27
|
-
*/
|
|
28
|
-
import { Database } from "./database.js";
|
|
29
|
-
// Create a base plugin with some systems
|
|
30
|
-
const basePlugin = Database.Plugin.create({
|
|
31
|
-
systems: {
|
|
32
|
-
inputSystem: {
|
|
33
|
-
create: (_db) => () => { }
|
|
34
|
-
},
|
|
35
|
-
physicsSystem: {
|
|
36
|
-
create: (_db) => () => { }
|
|
37
|
-
},
|
|
38
|
-
audioSystem: {
|
|
39
|
-
create: (_db) => () => { }
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
// When extending with dependencies, schedule.before/after will be typed
|
|
44
|
-
// to only accept system names from the dependencies!
|
|
45
|
-
// ✅ VALID: References systems that exist in basePlugin
|
|
46
|
-
const validPlugin = Database.Plugin.create({
|
|
47
|
-
systems: {
|
|
48
|
-
renderSystem: {
|
|
49
|
-
create: (_db) => () => { },
|
|
50
|
-
schedule: {
|
|
51
|
-
// TypeScript autocompletes: "inputSystem" | "physicsSystem" | "audioSystem"
|
|
52
|
-
after: ["inputSystem", "physicsSystem"]
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}, [basePlugin]);
|
|
57
|
-
// ❌ INVALID: This will show a type error in your IDE
|
|
58
|
-
const invalidPlugin = Database.Plugin.create({
|
|
59
|
-
systems: {
|
|
60
|
-
renderSystem: {
|
|
61
|
-
create: (_db) => () => { },
|
|
62
|
-
schedule: {
|
|
63
|
-
// @ts-expect-error - Type error: "nonExistentSystem" is not a valid system name
|
|
64
|
-
after: ["nonExistentSystem"]
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}, [basePlugin]);
|
|
69
|
-
// Export to avoid unused variable warnings
|
|
70
|
-
export { validPlugin, invalidPlugin };
|
|
71
|
-
//# sourceMappingURL=schedule-type-check-demo.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schedule-type-check-demo.js","sourceRoot":"","sources":["../../../src/ecs/database/schedule-type-check-demo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AAEX;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,yCAAyC;AACzC,MAAM,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACtC,OAAO,EAAE;QACL,WAAW,EAAE;YACT,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;SAC7B;QACD,aAAa,EAAE;YACX,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;SAC7B;QACD,WAAW,EAAE;YACT,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;SAC7B;KACJ;CACJ,CAAC,CAAC;AAEH,wEAAwE;AACxE,qDAAqD;AAErD,uDAAuD;AACvD,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,CACtC;IACI,OAAO,EAAE;QACL,YAAY,EAAE;YACV,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;YAC1B,QAAQ,EAAE;gBACN,4EAA4E;gBAC5E,KAAK,EAAE,CAAC,aAAa,EAAE,eAAe,CAAU;aACnD;SACJ;KACJ;CACJ,EACD,CAAC,UAAsD,CAAC,CAC3D,CAAC;AAEF,qDAAqD;AACrD,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,CACxC;IACI,OAAO,EAAE;QACL,YAAY,EAAE;YACV,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;YAC1B,QAAQ,EAAE;gBACN,gFAAgF;gBAChF,KAAK,EAAE,CAAC,mBAAmB,CAAU;aACxC;SACJ;KACJ;CACJ,EACD,CAAC,UAAsD,CAAC,CAC3D,CAAC;AAEF,2CAA2C;AAC3C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare const plugin: Required<import("./database.js").Database.Plugin<{
|
|
2
|
-
readonly velocity: {
|
|
3
|
-
readonly type: "number";
|
|
4
|
-
};
|
|
5
|
-
readonly particle: {
|
|
6
|
-
readonly type: "boolean";
|
|
7
|
-
};
|
|
8
|
-
}, import("../resource-schemas.js").ResourceSchemas, any, import("../store/action-functions.js").ActionDeclarations<any, any, any>, string>>;
|
|
9
|
-
export { plugin };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { createPlugin } from "./create-plugin.js";
|
|
2
|
-
// This should have a type error
|
|
3
|
-
const plugin = createPlugin({
|
|
4
|
-
components: {
|
|
5
|
-
velocity: { type: "number" },
|
|
6
|
-
particle: { type: "boolean" },
|
|
7
|
-
},
|
|
8
|
-
archetypes: {
|
|
9
|
-
// @ts-expect-error - particle234 does not exist
|
|
10
|
-
DoesNotExist: ["particle234"],
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
export { plugin };
|
|
14
|
-
//# sourceMappingURL=test-archetype-validation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-archetype-validation.js","sourceRoot":"","sources":["../../../src/ecs/database/test-archetype-validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,gCAAgC;AAChC,MAAM,MAAM,GAAG,YAAY,CAAC;IACxB,UAAU,EAAE;QACR,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC5B,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KAChC;IACD,UAAU,EAAE;QACR,gDAAgD;QAChD,YAAY,EAAE,CAAC,aAAa,CAAC;KAChC;CACJ,CAAC,CAAC;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Database } from "../index.js";
|
|
2
|
-
const plugin = Database.Plugin.create({
|
|
3
|
-
resources: {
|
|
4
|
-
time: { default: 0 },
|
|
5
|
-
},
|
|
6
|
-
}, {
|
|
7
|
-
systems: {
|
|
8
|
-
testSystem: {
|
|
9
|
-
create: (db) => () => {
|
|
10
|
-
const time = db.resources.time;
|
|
11
|
-
// @ts-expect-error - this should be an error
|
|
12
|
-
const dt = db.resources.deltaTime2;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
//# sourceMappingURL=test-exactkeys.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-exactkeys.js","sourceRoot":"","sources":["../../../src/ecs/database/test-exactkeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACpC,SAAS,EAAE;QACT,IAAI,EAAE,EAAE,OAAO,EAAE,CAAW,EAAE;KAC/B;CACF,EAAE;IACD,OAAO,EAAE;QACP,UAAU,EAAE;YACV,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE;gBACnB,MAAM,IAAI,GAAW,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC;gBACvC,6CAA6C;gBAC7C,MAAM,EAAE,GAAW,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC;YAC7C,CAAC;SACF;KACF;CACF,CAAC,CAAC"}
|