@forgeax/engine-ecs 0.0.0-dev.8d955ade1c79
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/LICENSE +202 -0
- package/README.md +278 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/__fixtures__/field-shape-fixture.d.ts +16 -0
- package/dist/__fixtures__/field-shape-fixture.d.ts.map +1 -0
- package/dist/__tests__/__fixtures__/inspect-scripts.snapshot.d.ts +3 -0
- package/dist/__tests__/__fixtures__/inspect-scripts.snapshot.d.ts.map +1 -0
- package/dist/__tests__/archetype.unit.test.d.ts +2 -0
- package/dist/__tests__/archetype.unit.test.d.ts.map +1 -0
- package/dist/__tests__/array-handle-element.test-d.d.ts +2 -0
- package/dist/__tests__/array-handle-element.test-d.d.ts.map +1 -0
- package/dist/__tests__/buffer-array-vocab.test-d.d.ts +2 -0
- package/dist/__tests__/buffer-array-vocab.test-d.d.ts.map +1 -0
- package/dist/__tests__/buffer-field-input-widen.unit.test.d.ts +2 -0
- package/dist/__tests__/buffer-field-input-widen.unit.test.d.ts.map +1 -0
- package/dist/__tests__/buffer-pool.test-d.d.ts +2 -0
- package/dist/__tests__/buffer-pool.test-d.d.ts.map +1 -0
- package/dist/__tests__/change-detection.unit.test.d.ts +2 -0
- package/dist/__tests__/change-detection.unit.test.d.ts.map +1 -0
- package/dist/__tests__/command-buffer.test.d.ts +2 -0
- package/dist/__tests__/command-buffer.test.d.ts.map +1 -0
- package/dist/__tests__/commands-deferred.unit.test.d.ts +2 -0
- package/dist/__tests__/commands-deferred.unit.test.d.ts.map +1 -0
- package/dist/__tests__/component-catalog.test.d.ts +2 -0
- package/dist/__tests__/component-catalog.test.d.ts.map +1 -0
- package/dist/__tests__/component-definition-identity.unit.test.d.ts +2 -0
- package/dist/__tests__/component-definition-identity.unit.test.d.ts.map +1 -0
- package/dist/__tests__/component-nan-preflight.unit.test.d.ts +2 -0
- package/dist/__tests__/component-nan-preflight.unit.test.d.ts.map +1 -0
- package/dist/__tests__/component-schema.test-d.d.ts +2 -0
- package/dist/__tests__/component-schema.test-d.d.ts.map +1 -0
- package/dist/__tests__/component-schema.test.d.ts +2 -0
- package/dist/__tests__/component-schema.test.d.ts.map +1 -0
- package/dist/__tests__/define-component-options.test-d.d.ts +2 -0
- package/dist/__tests__/define-component-options.test-d.d.ts.map +1 -0
- package/dist/__tests__/deprecated-vocab-rejection.unit.test.d.ts +2 -0
- package/dist/__tests__/deprecated-vocab-rejection.unit.test.d.ts.map +1 -0
- package/dist/__tests__/despawn-all.unit.test.d.ts +2 -0
- package/dist/__tests__/despawn-all.unit.test.d.ts.map +1 -0
- package/dist/__tests__/ecs-core-reduction.characterization.test.d.ts +2 -0
- package/dist/__tests__/ecs-core-reduction.characterization.test.d.ts.map +1 -0
- package/dist/__tests__/ecs-core-reduction.perf.test.d.ts +2 -0
- package/dist/__tests__/ecs-core-reduction.perf.test.d.ts.map +1 -0
- package/dist/__tests__/ecs-error-code-31.test-d.d.ts +2 -0
- package/dist/__tests__/ecs-error-code-31.test-d.d.ts.map +1 -0
- package/dist/__tests__/entity-disabling.unit.test.d.ts +2 -0
- package/dist/__tests__/entity-disabling.unit.test.d.ts.map +1 -0
- package/dist/__tests__/entity-handle-codec-parity.unit.test.d.ts +2 -0
- package/dist/__tests__/entity-handle-codec-parity.unit.test.d.ts.map +1 -0
- package/dist/__tests__/errors.unit.test.d.ts +2 -0
- package/dist/__tests__/errors.unit.test.d.ts.map +1 -0
- package/dist/__tests__/execution-conflict-boundary.unit.test.d.ts +2 -0
- package/dist/__tests__/execution-conflict-boundary.unit.test.d.ts.map +1 -0
- package/dist/__tests__/execution-shared-storage.unit.test.d.ts +2 -0
- package/dist/__tests__/execution-shared-storage.unit.test.d.ts.map +1 -0
- package/dist/__tests__/externalization-portable-value.unit.test.d.ts +2 -0
- package/dist/__tests__/externalization-portable-value.unit.test.d.ts.map +1 -0
- package/dist/__tests__/externalization-projection.unit.test.d.ts +2 -0
- package/dist/__tests__/externalization-projection.unit.test.d.ts.map +1 -0
- package/dist/__tests__/externalization-render-read-lease.test-d.d.ts +2 -0
- package/dist/__tests__/externalization-render-read-lease.test-d.d.ts.map +1 -0
- package/dist/__tests__/externalization-render-read-lease.unit.test.d.ts +2 -0
- package/dist/__tests__/externalization-render-read-lease.unit.test.d.ts.map +1 -0
- package/dist/__tests__/externalization-root-surface.unit.test.d.ts +2 -0
- package/dist/__tests__/externalization-root-surface.unit.test.d.ts.map +1 -0
- package/dist/__tests__/field-enum-labels-reflection.test.d.ts +2 -0
- package/dist/__tests__/field-enum-labels-reflection.test.d.ts.map +1 -0
- package/dist/__tests__/field-shape-fixture.test.d.ts +2 -0
- package/dist/__tests__/field-shape-fixture.test.d.ts.map +1 -0
- package/dist/__tests__/field-transient-reflection.test.d.ts +2 -0
- package/dist/__tests__/field-transient-reflection.test.d.ts.map +1 -0
- package/dist/__tests__/field-value-type.test-d.d.ts +2 -0
- package/dist/__tests__/field-value-type.test-d.d.ts.map +1 -0
- package/dist/__tests__/fixed-update.unit.test.d.ts +2 -0
- package/dist/__tests__/fixed-update.unit.test.d.ts.map +1 -0
- package/dist/__tests__/handle.test-d.d.ts +2 -0
- package/dist/__tests__/handle.test-d.d.ts.map +1 -0
- package/dist/__tests__/hierarchy.unit.test.d.ts +2 -0
- package/dist/__tests__/hierarchy.unit.test.d.ts.map +1 -0
- package/dist/__tests__/managed-array-vocab.test-d.d.ts +2 -0
- package/dist/__tests__/managed-array-vocab.test-d.d.ts.map +1 -0
- package/dist/__tests__/minimal-example.test-d.d.ts +2 -0
- package/dist/__tests__/minimal-example.test-d.d.ts.map +1 -0
- package/dist/__tests__/name-read-types.test-d.d.ts +2 -0
- package/dist/__tests__/name-read-types.test-d.d.ts.map +1 -0
- package/dist/__tests__/plugin-service.test.d.ts +2 -0
- package/dist/__tests__/plugin-service.test.d.ts.map +1 -0
- package/dist/__tests__/query-combinations.unit.test.d.ts +2 -0
- package/dist/__tests__/query-combinations.unit.test.d.ts.map +1 -0
- package/dist/__tests__/query-light-extract-flat-column-ratio.perf.test.d.ts +2 -0
- package/dist/__tests__/query-light-extract-flat-column-ratio.perf.test.d.ts.map +1 -0
- package/dist/__tests__/query-storage-trends.perf.test.d.ts +2 -0
- package/dist/__tests__/query-storage-trends.perf.test.d.ts.map +1 -0
- package/dist/__tests__/query-trs-flat-column-ratio.perf.test.d.ts +2 -0
- package/dist/__tests__/query-trs-flat-column-ratio.perf.test.d.ts.map +1 -0
- package/dist/__tests__/query.unit.test.d.ts +2 -0
- package/dist/__tests__/query.unit.test.d.ts.map +1 -0
- package/dist/__tests__/relationship-index.perf.test.d.ts +2 -0
- package/dist/__tests__/relationship-index.perf.test.d.ts.map +1 -0
- package/dist/__tests__/relationship-index.test.d.ts +2 -0
- package/dist/__tests__/relationship-index.test.d.ts.map +1 -0
- package/dist/__tests__/scalar-field-type-owner.test-d.d.ts +2 -0
- package/dist/__tests__/scalar-field-type-owner.test-d.d.ts.map +1 -0
- package/dist/__tests__/schedule-determinism.unit.test.d.ts +2 -0
- package/dist/__tests__/schedule-determinism.unit.test.d.ts.map +1 -0
- package/dist/__tests__/schedule-inspection.unit.test.d.ts +2 -0
- package/dist/__tests__/schedule-inspection.unit.test.d.ts.map +1 -0
- package/dist/__tests__/schedule-scope-error.unit.test.d.ts +2 -0
- package/dist/__tests__/schedule-scope-error.unit.test.d.ts.map +1 -0
- package/dist/__tests__/schedule-token.unit.test.d.ts +2 -0
- package/dist/__tests__/schedule-token.unit.test.d.ts.map +1 -0
- package/dist/__tests__/schema-vocab.test-d.d.ts +2 -0
- package/dist/__tests__/schema-vocab.test-d.d.ts.map +1 -0
- package/dist/__tests__/serialization.unit.test.d.ts +2 -0
- package/dist/__tests__/serialization.unit.test.d.ts.map +1 -0
- package/dist/__tests__/shared-kernel-eligibility.test-d.d.ts +2 -0
- package/dist/__tests__/shared-kernel-eligibility.test-d.d.ts.map +1 -0
- package/dist/__tests__/shared-kernel-eligibility.unit.test.d.ts +2 -0
- package/dist/__tests__/shared-kernel-eligibility.unit.test.d.ts.map +1 -0
- package/dist/__tests__/shared-ref-store.unit.test.d.ts +2 -0
- package/dist/__tests__/shared-ref-store.unit.test.d.ts.map +1 -0
- package/dist/__tests__/sparse-tag.unit.test.d.ts +2 -0
- package/dist/__tests__/sparse-tag.unit.test.d.ts.map +1 -0
- package/dist/__tests__/spawn-field-error.test-d.d.ts +2 -0
- package/dist/__tests__/spawn-field-error.test-d.d.ts.map +1 -0
- package/dist/__tests__/stale-error.test-d.d.ts +2 -0
- package/dist/__tests__/stale-error.test-d.d.ts.map +1 -0
- package/dist/__tests__/string-view-symmetry.test-d.d.ts +2 -0
- package/dist/__tests__/string-view-symmetry.test-d.d.ts.map +1 -0
- package/dist/__tests__/string-vocab.test-d.d.ts +2 -0
- package/dist/__tests__/string-vocab.test-d.d.ts.map +1 -0
- package/dist/__tests__/structure-epoch-boundaries.unit.test.d.ts +2 -0
- package/dist/__tests__/structure-epoch-boundaries.unit.test.d.ts.map +1 -0
- package/dist/__tests__/structure-epoch.unit.test.d.ts +2 -0
- package/dist/__tests__/structure-epoch.unit.test.d.ts.map +1 -0
- package/dist/__tests__/table-archetype-mapping.unit.test.d.ts +2 -0
- package/dist/__tests__/table-archetype-mapping.unit.test.d.ts.map +1 -0
- package/dist/__tests__/time.unit.test.d.ts +2 -0
- package/dist/__tests__/time.unit.test.d.ts.map +1 -0
- package/dist/__tests__/types.test-d.d.ts +2 -0
- package/dist/__tests__/types.test-d.d.ts.map +1 -0
- package/dist/__tests__/unique-ref-store.unit.test.d.ts +2 -0
- package/dist/__tests__/unique-ref-store.unit.test.d.ts.map +1 -0
- package/dist/__tests__/utils/handle-numeric.d.ts +14 -0
- package/dist/__tests__/utils/handle-numeric.d.ts.map +1 -0
- package/dist/__tests__/validation-root-surface.unit.test.d.ts +2 -0
- package/dist/__tests__/validation-root-surface.unit.test.d.ts.map +1 -0
- package/dist/__tests__/visibility-atomic-write.unit.test.d.ts +2 -0
- package/dist/__tests__/visibility-atomic-write.unit.test.d.ts.map +1 -0
- package/dist/__tests__/world-change-journal.unit.test.d.ts +2 -0
- package/dist/__tests__/world-change-journal.unit.test.d.ts.map +1 -0
- package/dist/__tests__/world-characterization.unit.test.d.ts +2 -0
- package/dist/__tests__/world-characterization.unit.test.d.ts.map +1 -0
- package/dist/__tests__/world-consumer-inference.test-d.d.ts +2 -0
- package/dist/__tests__/world-consumer-inference.test-d.d.ts.map +1 -0
- package/dist/__tests__/world-health.contract.test.d.ts +2 -0
- package/dist/__tests__/world-health.contract.test.d.ts.map +1 -0
- package/dist/__tests__/world-inspection.test.d.ts +2 -0
- package/dist/__tests__/world-inspection.test.d.ts.map +1 -0
- package/dist/__tests__/world-internal-identity.unit.test.d.ts +2 -0
- package/dist/__tests__/world-internal-identity.unit.test.d.ts.map +1 -0
- package/dist/__tests__/world-managed-roundtrip.unit.test.d.ts +2 -0
- package/dist/__tests__/world-managed-roundtrip.unit.test.d.ts.map +1 -0
- package/dist/__tests__/world-scheduling.m4.test.d.ts +2 -0
- package/dist/__tests__/world-scheduling.m4.test.d.ts.map +1 -0
- package/dist/__tests__/world-unique-roundtrip.unit.test.d.ts +2 -0
- package/dist/__tests__/world-unique-roundtrip.unit.test.d.ts.map +1 -0
- package/dist/__tests__/world.test-d.d.ts +2 -0
- package/dist/__tests__/world.test-d.d.ts.map +1 -0
- package/dist/buffer-pool.d.ts +109 -0
- package/dist/buffer-pool.d.ts.map +1 -0
- package/dist/commands.d.ts +93 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/component-default-fallback.d.ts +88 -0
- package/dist/component-default-fallback.d.ts.map +1 -0
- package/dist/component-schema.d.ts +34 -0
- package/dist/component-schema.d.ts.map +1 -0
- package/dist/component-value-validate.d.ts +29 -0
- package/dist/component-value-validate.d.ts.map +1 -0
- package/dist/component.d.ts +581 -0
- package/dist/component.d.ts.map +1 -0
- package/dist/entity-handle.d.ts +68 -0
- package/dist/entity-handle.d.ts.map +1 -0
- package/dist/entity.d.ts +86 -0
- package/dist/entity.d.ts.map +1 -0
- package/dist/errors/query-and-component-errors.d.ts +132 -0
- package/dist/errors/query-and-component-errors.d.ts.map +1 -0
- package/dist/errors/relationship-errors.d.ts +112 -0
- package/dist/errors/relationship-errors.d.ts.map +1 -0
- package/dist/errors/sprite-and-shared-errors.d.ts +107 -0
- package/dist/errors/sprite-and-shared-errors.d.ts.map +1 -0
- package/dist/errors/validation-errors.d.ts +229 -0
- package/dist/errors/validation-errors.d.ts.map +1 -0
- package/dist/errors.d.ts +763 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/execution/shared-kernel.d.ts +106 -0
- package/dist/execution/shared-kernel.d.ts.map +1 -0
- package/dist/externalization/index.d.ts +31 -0
- package/dist/externalization/index.d.ts.map +1 -0
- package/dist/externalization/index.mjs +298 -0
- package/dist/externalization/index.mjs.map +1 -0
- package/dist/index.d.ts +261 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +7422 -0
- package/dist/index.mjs.map +1 -0
- package/dist/internal.mjs +479 -0
- package/dist/internal.mjs.map +1 -0
- package/dist/plugin-service.d.ts +11 -0
- package/dist/plugin-service.d.ts.map +1 -0
- package/dist/projection/index.d.ts +103 -0
- package/dist/projection/index.d.ts.map +1 -0
- package/dist/projection/index.mjs +615 -0
- package/dist/projection/index.mjs.map +1 -0
- package/dist/query/query.d.ts +58 -0
- package/dist/query/query.d.ts.map +1 -0
- package/dist/relationship-index.d.ts +81 -0
- package/dist/relationship-index.d.ts.map +1 -0
- package/dist/resource.d.ts +70 -0
- package/dist/resource.d.ts.map +1 -0
- package/dist/schedule-token.d.ts +16 -0
- package/dist/schedule-token.d.ts.map +1 -0
- package/dist/schedule.d.ts +271 -0
- package/dist/schedule.d.ts.map +1 -0
- package/dist/shared-ref-store.d.ts +144 -0
- package/dist/shared-ref-store.d.ts.map +1 -0
- package/dist/shared.d.ts +3 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.mjs +364 -0
- package/dist/shared.mjs.map +1 -0
- package/dist/storage/archetype-graph.d.ts +54 -0
- package/dist/storage/archetype-graph.d.ts.map +1 -0
- package/dist/storage/archetype.d.ts +23 -0
- package/dist/storage/archetype.d.ts.map +1 -0
- package/dist/storage/change-detection.d.ts +40 -0
- package/dist/storage/change-detection.d.ts.map +1 -0
- package/dist/storage/column.d.ts +111 -0
- package/dist/storage/column.d.ts.map +1 -0
- package/dist/storage/table.d.ts +29 -0
- package/dist/storage/table.d.ts.map +1 -0
- package/dist/time.d.ts +57 -0
- package/dist/time.d.ts.map +1 -0
- package/dist/unique-ref-store.d.ts +105 -0
- package/dist/unique-ref-store.d.ts.map +1 -0
- package/dist/world-change-journal.d.ts +34 -0
- package/dist/world-change-journal.d.ts.map +1 -0
- package/dist/world-component-access.d.ts +265 -0
- package/dist/world-component-access.d.ts.map +1 -0
- package/dist/world-component-storage.d.ts +282 -0
- package/dist/world-component-storage.d.ts.map +1 -0
- package/dist/world-core.d.ts +39 -0
- package/dist/world-core.d.ts.map +1 -0
- package/dist/world-entity-lifecycle.d.ts +30 -0
- package/dist/world-entity-lifecycle.d.ts.map +1 -0
- package/dist/world-internal.d.ts +14 -0
- package/dist/world-internal.d.ts.map +1 -0
- package/dist/world-scheduling.d.ts +30 -0
- package/dist/world-scheduling.d.ts.map +1 -0
- package/dist/world.d.ts +620 -0
- package/dist/world.d.ts.map +1 -0
- package/package.json +77 -0
- package/src/__fixtures__/field-shape-fixture.ts +30 -0
- package/src/__tests__/__fixtures__/inspect-scripts.snapshot.ts +2 -0
- package/src/__tests__/archetype.unit.test.ts +1837 -0
- package/src/__tests__/array-handle-element.test-d.ts +34 -0
- package/src/__tests__/buffer-array-vocab.test-d.ts +53 -0
- package/src/__tests__/buffer-field-input-widen.unit.test.ts +99 -0
- package/src/__tests__/buffer-pool.test-d.ts +32 -0
- package/src/__tests__/change-detection.unit.test.ts +86 -0
- package/src/__tests__/command-buffer.test.ts +179 -0
- package/src/__tests__/commands-deferred.unit.test.ts +68 -0
- package/src/__tests__/component-catalog.test.ts +59 -0
- package/src/__tests__/component-definition-identity.unit.test.ts +24 -0
- package/src/__tests__/component-nan-preflight.unit.test.ts +186 -0
- package/src/__tests__/component-schema.test-d.ts +119 -0
- package/src/__tests__/component-schema.test.ts +55 -0
- package/src/__tests__/define-component-options.test-d.ts +35 -0
- package/src/__tests__/deprecated-vocab-rejection.unit.test.ts +59 -0
- package/src/__tests__/despawn-all.unit.test.ts +17 -0
- package/src/__tests__/ecs-core-reduction.characterization.test.ts +130 -0
- package/src/__tests__/ecs-core-reduction.perf.test.ts +260 -0
- package/src/__tests__/ecs-error-code-31.test-d.ts +42 -0
- package/src/__tests__/entity-disabling.unit.test.ts +37 -0
- package/src/__tests__/entity-handle-codec-parity.unit.test.ts +126 -0
- package/src/__tests__/errors.unit.test.ts +1456 -0
- package/src/__tests__/execution-conflict-boundary.unit.test.ts +123 -0
- package/src/__tests__/execution-shared-storage.unit.test.ts +40 -0
- package/src/__tests__/externalization-portable-value.unit.test.ts +275 -0
- package/src/__tests__/externalization-projection.unit.test.ts +325 -0
- package/src/__tests__/externalization-render-read-lease.test-d.ts +30 -0
- package/src/__tests__/externalization-render-read-lease.unit.test.ts +79 -0
- package/src/__tests__/externalization-root-surface.unit.test.ts +33 -0
- package/src/__tests__/field-enum-labels-reflection.test.ts +66 -0
- package/src/__tests__/field-shape-fixture.test.ts +61 -0
- package/src/__tests__/field-transient-reflection.test.ts +59 -0
- package/src/__tests__/field-value-type.test-d.ts +57 -0
- package/src/__tests__/fixed-update.unit.test.ts +78 -0
- package/src/__tests__/handle.test-d.ts +86 -0
- package/src/__tests__/hierarchy.unit.test.ts +2534 -0
- package/src/__tests__/managed-array-vocab.test-d.ts +137 -0
- package/src/__tests__/minimal-example.test-d.ts +42 -0
- package/src/__tests__/name-read-types.test-d.ts +72 -0
- package/src/__tests__/plugin-service.test.ts +13 -0
- package/src/__tests__/query-combinations.unit.test.ts +42 -0
- package/src/__tests__/query-light-extract-flat-column-ratio.perf.test.ts +252 -0
- package/src/__tests__/query-storage-trends.perf.test.ts +104 -0
- package/src/__tests__/query-trs-flat-column-ratio.perf.test.ts +194 -0
- package/src/__tests__/query.unit.test.ts +196 -0
- package/src/__tests__/relationship-index.perf.test.ts +126 -0
- package/src/__tests__/relationship-index.test.ts +70 -0
- package/src/__tests__/scalar-field-type-owner.test-d.ts +71 -0
- package/src/__tests__/schedule-determinism.unit.test.ts +36 -0
- package/src/__tests__/schedule-inspection.unit.test.ts +81 -0
- package/src/__tests__/schedule-scope-error.unit.test.ts +63 -0
- package/src/__tests__/schedule-token.unit.test.ts +54 -0
- package/src/__tests__/schema-vocab.test-d.ts +103 -0
- package/src/__tests__/serialization.unit.test.ts +2740 -0
- package/src/__tests__/shared-kernel-eligibility.test-d.ts +18 -0
- package/src/__tests__/shared-kernel-eligibility.unit.test.ts +78 -0
- package/src/__tests__/shared-ref-store.unit.test.ts +646 -0
- package/src/__tests__/sparse-tag.unit.test.ts +201 -0
- package/src/__tests__/spawn-field-error.test-d.ts +41 -0
- package/src/__tests__/stale-error.test-d.ts +208 -0
- package/src/__tests__/string-view-symmetry.test-d.ts +26 -0
- package/src/__tests__/string-vocab.test-d.ts +49 -0
- package/src/__tests__/structure-epoch-boundaries.unit.test.ts +39 -0
- package/src/__tests__/structure-epoch.unit.test.ts +48 -0
- package/src/__tests__/table-archetype-mapping.unit.test.ts +78 -0
- package/src/__tests__/time.unit.test.ts +79 -0
- package/src/__tests__/types.test-d.ts +38 -0
- package/src/__tests__/unique-ref-store.unit.test.ts +348 -0
- package/src/__tests__/utils/handle-numeric.ts +30 -0
- package/src/__tests__/validation-root-surface.unit.test.ts +15 -0
- package/src/__tests__/visibility-atomic-write.unit.test.ts +82 -0
- package/src/__tests__/world-change-journal.unit.test.ts +97 -0
- package/src/__tests__/world-characterization.unit.test.ts +408 -0
- package/src/__tests__/world-consumer-inference.test-d.ts +16 -0
- package/src/__tests__/world-health.contract.test.ts +87 -0
- package/src/__tests__/world-inspection.test.ts +37 -0
- package/src/__tests__/world-internal-identity.unit.test.ts +17 -0
- package/src/__tests__/world-managed-roundtrip.unit.test.ts +98 -0
- package/src/__tests__/world-scheduling.m4.test.ts +52 -0
- package/src/__tests__/world-unique-roundtrip.unit.test.ts +357 -0
- package/src/__tests__/world.test-d.ts +156 -0
- package/src/buffer-pool.ts +357 -0
- package/src/commands.ts +644 -0
- package/src/component-default-fallback.ts +236 -0
- package/src/component-schema.ts +92 -0
- package/src/component-value-validate.ts +135 -0
- package/src/component.ts +1268 -0
- package/src/entity-handle.ts +104 -0
- package/src/entity.ts +140 -0
- package/src/errors/query-and-component-errors.ts +200 -0
- package/src/errors/relationship-errors.ts +198 -0
- package/src/errors/sprite-and-shared-errors.ts +231 -0
- package/src/errors/validation-errors.ts +506 -0
- package/src/errors.ts +1464 -0
- package/src/execution/shared-kernel.ts +392 -0
- package/src/externalization/index.ts +170 -0
- package/src/index.ts +414 -0
- package/src/plugin-service.ts +35 -0
- package/src/projection/index.ts +318 -0
- package/src/query/query.ts +606 -0
- package/src/relationship-index.ts +175 -0
- package/src/resource.ts +106 -0
- package/src/schedule-token.ts +40 -0
- package/src/schedule.ts +846 -0
- package/src/shared-ref-store.ts +418 -0
- package/src/shared.ts +23 -0
- package/src/storage/archetype-graph.ts +166 -0
- package/src/storage/archetype.ts +78 -0
- package/src/storage/change-detection.ts +231 -0
- package/src/storage/column.ts +247 -0
- package/src/storage/table.ts +153 -0
- package/src/time.ts +122 -0
- package/src/unique-ref-store.ts +278 -0
- package/src/world-change-journal.ts +84 -0
- package/src/world-component-access.ts +1421 -0
- package/src/world-component-storage.ts +1178 -0
- package/src/world-core.ts +74 -0
- package/src/world-entity-lifecycle.ts +539 -0
- package/src/world-internal.ts +75 -0
- package/src/world-scheduling.ts +499 -0
- package/src/world.ts +1399 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type Component,
|
|
3
|
+
type ComponentSchema,
|
|
4
|
+
defineComponent,
|
|
5
|
+
type FieldsInput,
|
|
6
|
+
} from './component';
|
|
7
|
+
import type { EntityHandle } from './entity-handle';
|
|
8
|
+
|
|
9
|
+
declare const relationshipTargetBrand: unique symbol;
|
|
10
|
+
|
|
11
|
+
/** A relationship target is a read projection, never a structural-write token. */
|
|
12
|
+
export type RelationshipTargetComponent<C extends Component = Component> = C & {
|
|
13
|
+
readonly [relationshipTargetBrand]: true;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/** The two immutable roles produced by one relationship declaration. */
|
|
17
|
+
export interface RelationshipDefinition {
|
|
18
|
+
readonly source: Component<string, ComponentSchema>;
|
|
19
|
+
readonly target: RelationshipTargetComponent<Component<string, ComponentSchema>>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface RelationshipOptions {
|
|
23
|
+
readonly sourceName: string;
|
|
24
|
+
readonly sourceField: string;
|
|
25
|
+
readonly targetName: string;
|
|
26
|
+
readonly targetField: string;
|
|
27
|
+
readonly exclusive?: boolean;
|
|
28
|
+
readonly linkedSpawn?: boolean;
|
|
29
|
+
/** Allow a source to point at its own holder (e.g. self-animated entities). */
|
|
30
|
+
readonly allowSelf?: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type RelationshipRole =
|
|
34
|
+
| {
|
|
35
|
+
readonly kind: 'source';
|
|
36
|
+
readonly target: Component<string, ComponentSchema>;
|
|
37
|
+
readonly sourceField: string;
|
|
38
|
+
readonly targetField: string;
|
|
39
|
+
readonly exclusive: boolean;
|
|
40
|
+
readonly linkedSpawn: boolean;
|
|
41
|
+
readonly allowSelf: boolean;
|
|
42
|
+
}
|
|
43
|
+
| {
|
|
44
|
+
readonly kind: 'target';
|
|
45
|
+
readonly source: Component<string, ComponentSchema>;
|
|
46
|
+
readonly sourceField: string;
|
|
47
|
+
readonly targetField: string;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const roles = new WeakMap<Component, RelationshipRole>();
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Declare both sides of a relationship in one closed operation. The source is
|
|
54
|
+
* the only writable relationship component; its target is a materialized,
|
|
55
|
+
* engine-maintained reverse list.
|
|
56
|
+
*/
|
|
57
|
+
export function defineRelationship<
|
|
58
|
+
const S extends string,
|
|
59
|
+
const SF extends string,
|
|
60
|
+
const T extends string,
|
|
61
|
+
const TF extends string,
|
|
62
|
+
>(
|
|
63
|
+
options: RelationshipOptions & {
|
|
64
|
+
readonly sourceName: S;
|
|
65
|
+
readonly sourceField: SF;
|
|
66
|
+
readonly targetName: T;
|
|
67
|
+
readonly targetField: TF;
|
|
68
|
+
},
|
|
69
|
+
): {
|
|
70
|
+
readonly source: Component<S, { [K in SF]: 'entity' }>;
|
|
71
|
+
readonly target: RelationshipTargetComponent<Component<T, { [K in TF]: 'array<entity>' }>>;
|
|
72
|
+
} {
|
|
73
|
+
const targetFields: FieldsInput = {
|
|
74
|
+
[options.targetField]: { type: 'array<entity>', transient: true },
|
|
75
|
+
};
|
|
76
|
+
const target = defineComponent(options.targetName, targetFields);
|
|
77
|
+
const sourceFields: FieldsInput = { [options.sourceField]: { type: 'entity' } };
|
|
78
|
+
const source = defineComponent(options.sourceName, sourceFields);
|
|
79
|
+
|
|
80
|
+
roles.set(source, {
|
|
81
|
+
kind: 'source',
|
|
82
|
+
target,
|
|
83
|
+
sourceField: options.sourceField,
|
|
84
|
+
targetField: options.targetField,
|
|
85
|
+
exclusive: options.exclusive ?? true,
|
|
86
|
+
linkedSpawn: options.linkedSpawn ?? false,
|
|
87
|
+
allowSelf: options.allowSelf ?? false,
|
|
88
|
+
});
|
|
89
|
+
roles.set(target, {
|
|
90
|
+
kind: 'target',
|
|
91
|
+
source,
|
|
92
|
+
sourceField: options.sourceField,
|
|
93
|
+
targetField: options.targetField,
|
|
94
|
+
});
|
|
95
|
+
return { source: source as never, target: target as never };
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function relationshipRole(component: Component): RelationshipRole | undefined {
|
|
99
|
+
return roles.get(component);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** Return the materialized target token owned by a source relationship. */
|
|
103
|
+
export function relationshipMirror(component: Component): Component | undefined {
|
|
104
|
+
const role = roles.get(component);
|
|
105
|
+
return role?.kind === 'source' ? role.target : undefined;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** Return the source token owned by a materialized relationship target. */
|
|
109
|
+
export function relationshipSource(component: Component): Component | undefined {
|
|
110
|
+
const role = roles.get(component);
|
|
111
|
+
return role?.kind === 'target' ? role.source : undefined;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function isRelationshipTarget(component: Component): boolean {
|
|
115
|
+
return roles.get(component)?.kind === 'target';
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Backpointer index for the materialized reverse lists stored by World.
|
|
120
|
+
* The target component array is the one authoritative read list; this index
|
|
121
|
+
* stores only source-to-target locations for O(1) swap-remove bookkeeping.
|
|
122
|
+
*/
|
|
123
|
+
export class RelationshipIndex {
|
|
124
|
+
private readonly slots = new Map<number, { target: number; slot: number }>();
|
|
125
|
+
private epochValue = 0;
|
|
126
|
+
|
|
127
|
+
get epoch(): number {
|
|
128
|
+
return this.epochValue;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
attach(source: EntityHandle, target: EntityHandle, slot: number): number {
|
|
132
|
+
this.slots.set(source as number, { target: target as number, slot });
|
|
133
|
+
this.epochValue++;
|
|
134
|
+
return slot;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
detach(source: EntityHandle): boolean {
|
|
138
|
+
if (!this.slots.delete(source as number)) return false;
|
|
139
|
+
this.epochValue++;
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
reparent(source: EntityHandle, target: EntityHandle, slot: number): number {
|
|
144
|
+
return this.attach(source, target, slot);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
slotOf(source: EntityHandle): number | undefined {
|
|
148
|
+
return this.slots.get(source as number)?.slot;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
targetOf(source: EntityHandle): EntityHandle | undefined {
|
|
152
|
+
return this.slots.get(source as number)?.target as EntityHandle | undefined;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** Bind the source that swap-remove moved into `slot`. */
|
|
156
|
+
updateSlot(source: EntityHandle, target: EntityHandle, slot: number): void {
|
|
157
|
+
const location = this.slots.get(source as number);
|
|
158
|
+
if (location === undefined) return;
|
|
159
|
+
location.target = target as number;
|
|
160
|
+
location.slot = slot;
|
|
161
|
+
this.epochValue++;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/** Cold recovery path only: rebuild from R source records. */
|
|
165
|
+
recover(records: Iterable<readonly [EntityHandle, EntityHandle]>): void {
|
|
166
|
+
this.slots.clear();
|
|
167
|
+
const nextSlots = new Map<number, number>();
|
|
168
|
+
for (const [source, target] of records) {
|
|
169
|
+
const slot = nextSlots.get(target as number) ?? 0;
|
|
170
|
+
nextSlots.set(target as number, slot + 1);
|
|
171
|
+
this.attach(source, target, slot);
|
|
172
|
+
}
|
|
173
|
+
this.epochValue++;
|
|
174
|
+
}
|
|
175
|
+
}
|
package/src/resource.ts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// @forgeax/engine-ecs — Resource store: typed key-value global singletons.
|
|
2
|
+
//
|
|
3
|
+
// Map<string, unknown> backend. insertResource is idempotent (overwrites).
|
|
4
|
+
// getResource throws ResourceNotFoundError if key absent.
|
|
5
|
+
|
|
6
|
+
import { ResourceNotFoundError } from './errors';
|
|
7
|
+
|
|
8
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
9
|
+
// ResourceStore
|
|
10
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
11
|
+
|
|
12
|
+
/** Internal resource storage. */
|
|
13
|
+
export interface ResourceEntry {
|
|
14
|
+
value: unknown;
|
|
15
|
+
added: number;
|
|
16
|
+
changed: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ResourceStore {
|
|
20
|
+
readonly entries: Map<string, ResourceEntry>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Create a fresh resource store. */
|
|
24
|
+
export function createResourceStore(): ResourceStore {
|
|
25
|
+
return { entries: new Map() };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Insert or overwrite a resource (idempotent, E-13).
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* import { createResourceStore, insertResource, type ResourceStore } from './resource';
|
|
34
|
+
*
|
|
35
|
+
* const store: ResourceStore = createResourceStore();
|
|
36
|
+
* insertResource(store, 'health', 100);
|
|
37
|
+
* // overwriting is idempotent (no error / no duplicate slot):
|
|
38
|
+
* insertResource(store, 'health', 95);
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export function insertResource<T>(store: ResourceStore, key: string, value: T, epoch = 0): void {
|
|
42
|
+
const current = store.entries.get(key);
|
|
43
|
+
if (current === undefined) {
|
|
44
|
+
store.entries.set(key, { value, added: epoch, changed: epoch });
|
|
45
|
+
} else {
|
|
46
|
+
current.value = value;
|
|
47
|
+
current.changed = epoch;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Get a resource by key.
|
|
53
|
+
* @throws ResourceNotFoundError if key does not exist (E-14).
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* import { getResource, insertResource, type ResourceStore } from './resource';
|
|
58
|
+
*
|
|
59
|
+
* declare const store: ResourceStore;
|
|
60
|
+
* insertResource(store, 'health', 100);
|
|
61
|
+
* const hp = getResource<number>(store, 'health');
|
|
62
|
+
* // hp === 100; throws ResourceNotFoundError on missing key (charter proposition 4)
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export function getResource<T>(store: ResourceStore, key: string): T {
|
|
66
|
+
const entry = store.entries.get(key);
|
|
67
|
+
if (entry === undefined) {
|
|
68
|
+
throw new ResourceNotFoundError(key);
|
|
69
|
+
}
|
|
70
|
+
return entry.value as T;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Check if a resource exists.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
78
|
+
* import { hasResource, insertResource, type ResourceStore } from './resource';
|
|
79
|
+
*
|
|
80
|
+
* declare const store: ResourceStore;
|
|
81
|
+
* insertResource(store, 'health', 100);
|
|
82
|
+
* if (hasResource(store, 'health')) {
|
|
83
|
+
* // guarded access avoids ResourceNotFoundError from getResource
|
|
84
|
+
* }
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export function hasResource(store: ResourceStore, key: string): boolean {
|
|
88
|
+
return store.entries.has(key);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Remove a resource by key.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* import { hasResource, insertResource, removeResource, type ResourceStore } from './resource';
|
|
97
|
+
*
|
|
98
|
+
* declare const store: ResourceStore;
|
|
99
|
+
* insertResource(store, 'health', 100);
|
|
100
|
+
* removeResource(store, 'health');
|
|
101
|
+
* // hasResource(store, 'health') === false; idempotent on missing keys
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export function removeResource(store: ResourceStore, key: string): boolean {
|
|
105
|
+
return store.entries.delete(key);
|
|
106
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nominal label for one of the World-owned schedules.
|
|
3
|
+
*
|
|
4
|
+
* Worlds expose the built-in tokens below. A token is both a registration
|
|
5
|
+
* scope and, for FixedUpdate, the intrinsic Update ordering anchor.
|
|
6
|
+
*/
|
|
7
|
+
export interface ScheduleToken {
|
|
8
|
+
readonly name: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type ScheduleName = 'Update' | 'FixedUpdate';
|
|
12
|
+
|
|
13
|
+
function createScheduleToken(name: ScheduleName): ScheduleToken {
|
|
14
|
+
// The Engine Worker loads its runtime and an execution bootstrap as separate
|
|
15
|
+
// Vite bundles. Keep the two built-in tokens physically shared across those
|
|
16
|
+
// bundles so a plugin's `Update` reference still addresses the owning World
|
|
17
|
+
// schedule instead of becoming an accidental cross-scope edge.
|
|
18
|
+
const registry = globalThis as typeof globalThis & {
|
|
19
|
+
readonly [key: symbol]: ScheduleToken | undefined;
|
|
20
|
+
};
|
|
21
|
+
const key = Symbol.for(`forgeax.ecs.schedule-token.${name}`);
|
|
22
|
+
const existing = registry[key];
|
|
23
|
+
if (existing !== undefined) return existing;
|
|
24
|
+
const token = Object.freeze({ name });
|
|
25
|
+
Object.defineProperty(registry, key, {
|
|
26
|
+
configurable: false,
|
|
27
|
+
enumerable: false,
|
|
28
|
+
value: token,
|
|
29
|
+
writable: false,
|
|
30
|
+
});
|
|
31
|
+
return token;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Variable-rate World schedule. */
|
|
35
|
+
export const Update = createScheduleToken('Update');
|
|
36
|
+
/** Fixed-rate World schedule and the intrinsic Update ordering anchor. */
|
|
37
|
+
export const FixedUpdate = createScheduleToken('FixedUpdate');
|
|
38
|
+
export function isScheduleToken(value: unknown): value is ScheduleToken {
|
|
39
|
+
return value === Update || value === FixedUpdate;
|
|
40
|
+
}
|