@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,318 @@
|
|
|
1
|
+
import type { Result } from '@forgeax/engine-types';
|
|
2
|
+
import type { Component } from '../component';
|
|
3
|
+
import { componentId } from '../component';
|
|
4
|
+
import type { EntityHandle } from '../entity-handle';
|
|
5
|
+
import type { SharedRefMutationRead } from '../shared-ref-store';
|
|
6
|
+
import type { WorldChangeRead } from '../storage/change-detection';
|
|
7
|
+
import type { EcsError, World } from '../world';
|
|
8
|
+
import { worldInternal } from '../world-internal';
|
|
9
|
+
|
|
10
|
+
// Owner packages that need ECS validation/default semantics consume these
|
|
11
|
+
// helpers through the explicit projection surface. They are intentionally not
|
|
12
|
+
// part of the token-first root barrel.
|
|
13
|
+
export { fillComponentDefaults } from '../component-default-fallback';
|
|
14
|
+
export {
|
|
15
|
+
ComponentNotDefinedError,
|
|
16
|
+
InstanceTransformsStrideMismatchError,
|
|
17
|
+
ManagedBufferOutOfBoundsError,
|
|
18
|
+
ResourceInvalidValueError,
|
|
19
|
+
SpawnLightInvalidBoundsError,
|
|
20
|
+
SpriteAnimationInvalidError,
|
|
21
|
+
SpriteInstancesCountMismatchError,
|
|
22
|
+
SpriteInstancesMutuallyExclusiveWithInstancesError,
|
|
23
|
+
SpriteInstancesRequiresSpriteShaderError,
|
|
24
|
+
StaleEntityError,
|
|
25
|
+
} from '../errors';
|
|
26
|
+
|
|
27
|
+
export type ProjectionChangeKind =
|
|
28
|
+
| 'component-added'
|
|
29
|
+
| 'component-changed'
|
|
30
|
+
| 'component-removed'
|
|
31
|
+
| 'derived-component-changed'
|
|
32
|
+
| 'entity-removed';
|
|
33
|
+
|
|
34
|
+
export interface ProjectionChange {
|
|
35
|
+
readonly entity: EntityHandle;
|
|
36
|
+
readonly kind: ProjectionChangeKind;
|
|
37
|
+
/** Token identity is the owner-facing component discriminator. */
|
|
38
|
+
readonly component?: Component;
|
|
39
|
+
/** Numeric id remains journal evidence for ECS-internal consumers. */
|
|
40
|
+
readonly componentId?: number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type ProjectionRead =
|
|
44
|
+
| {
|
|
45
|
+
readonly status: 'delta';
|
|
46
|
+
readonly cursor: number;
|
|
47
|
+
readonly changes: readonly ProjectionChange[];
|
|
48
|
+
}
|
|
49
|
+
| {
|
|
50
|
+
readonly status: 'rebuild';
|
|
51
|
+
readonly cursor: number;
|
|
52
|
+
readonly reason: 'journal-overflow';
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export interface WorldProjection {
|
|
56
|
+
readonly cursor: number;
|
|
57
|
+
poll(): ProjectionRead;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface WorldProjectionOptions {
|
|
61
|
+
readonly components?: readonly Component[];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface RenderProjectionComponentRequest {
|
|
65
|
+
readonly component: Component;
|
|
66
|
+
readonly fields: readonly string[];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface RenderProjectionRequest {
|
|
70
|
+
readonly components: readonly RenderProjectionComponentRequest[];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface RenderProjectionSpan {
|
|
74
|
+
readonly length: number;
|
|
75
|
+
readonly fields: Readonly<Record<string, ArrayLike<number>>>;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface RenderProjectionSpans {
|
|
79
|
+
readonly generation: number;
|
|
80
|
+
readonly sharedRefEpoch: number;
|
|
81
|
+
readonly spans: readonly RenderProjectionSpan[];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface RenderChangeBatchOk {
|
|
85
|
+
readonly status: 'ok';
|
|
86
|
+
readonly cursor: number;
|
|
87
|
+
readonly world: Extract<WorldChangeRead, { readonly status: 'ok' }>;
|
|
88
|
+
readonly sharedRefs: Extract<SharedRefMutationRead, { readonly status: 'ok' }>;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface RenderChangeBatchOverflow {
|
|
92
|
+
readonly status: 'overflow';
|
|
93
|
+
readonly cursor: number;
|
|
94
|
+
readonly resync: true;
|
|
95
|
+
readonly oldestAvailable: number;
|
|
96
|
+
readonly world: WorldChangeRead;
|
|
97
|
+
readonly sharedRefs: SharedRefMutationRead;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export type RenderChangeBatch = RenderChangeBatchOk | RenderChangeBatchOverflow;
|
|
101
|
+
|
|
102
|
+
export interface RenderReadLease {
|
|
103
|
+
readonly worldIdentity: string;
|
|
104
|
+
readonly generation: number;
|
|
105
|
+
readChanges(cursor: number): RenderChangeBatch;
|
|
106
|
+
querySpans(request: RenderProjectionRequest): RenderProjectionSpans;
|
|
107
|
+
inspectCursor(): number;
|
|
108
|
+
dispose(): void;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Read one array field through the render projection boundary without
|
|
113
|
+
* materialising the component object. Render extraction uses this for hot
|
|
114
|
+
* transform/instance columns; the World internals remain owned by ECS.
|
|
115
|
+
*/
|
|
116
|
+
export function readRenderArrayView(
|
|
117
|
+
world: World,
|
|
118
|
+
entity: EntityHandle,
|
|
119
|
+
component: Component,
|
|
120
|
+
fieldName: string,
|
|
121
|
+
): ArrayLike<number> | undefined {
|
|
122
|
+
return world[worldInternal].getArrayView(entity, component, fieldName) as
|
|
123
|
+
| ArrayLike<number>
|
|
124
|
+
| undefined;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
interface ProjectionCursor {
|
|
128
|
+
readonly world: number;
|
|
129
|
+
readonly sharedRefs: number;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function readProjectionSpans(
|
|
133
|
+
world: World,
|
|
134
|
+
generation: number,
|
|
135
|
+
request: RenderProjectionRequest,
|
|
136
|
+
): RenderProjectionSpans {
|
|
137
|
+
const queryResult = world.query({ read: request.components.map((entry) => entry.component) });
|
|
138
|
+
if (!queryResult.ok) throw new Error(queryResult.error.message);
|
|
139
|
+
const spansResult = queryResult.value.spans();
|
|
140
|
+
if (!spansResult.ok) throw new Error(spansResult.error.message);
|
|
141
|
+
const spans: RenderProjectionSpan[] = [];
|
|
142
|
+
for (const span of spansResult.value) {
|
|
143
|
+
const fields: Record<string, ArrayLike<number>> = {};
|
|
144
|
+
for (const entry of request.components) {
|
|
145
|
+
const shape = span.get(entry.component) as unknown as Record<string, ArrayLike<number>>;
|
|
146
|
+
for (const fieldName of entry.fields) {
|
|
147
|
+
const field = shape[fieldName];
|
|
148
|
+
if (field === undefined) {
|
|
149
|
+
throw new Error(
|
|
150
|
+
`Render projection field '${entry.component.name}.${fieldName}' is unavailable.`,
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
fields[`${entry.component.name}.${fieldName}`] = field;
|
|
154
|
+
if (request.components.length === 1) fields[fieldName] = field;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
spans.push({ length: span.length, fields: Object.freeze(fields) });
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
generation,
|
|
161
|
+
sharedRefEpoch: world[worldInternal].getSharedRefs().getMutationEpoch(),
|
|
162
|
+
spans: Object.freeze(spans),
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** Create the render-owned lease from the ECS projection boundary. */
|
|
167
|
+
export function createRenderReadLease(world: World, token: object = {}): RenderReadLease {
|
|
168
|
+
void token;
|
|
169
|
+
const sharedRefs = world[worldInternal].getSharedRefs();
|
|
170
|
+
const generation = Math.max(1, world[worldInternal].getStructureEpoch());
|
|
171
|
+
let disposed = false;
|
|
172
|
+
let nextCursor = 1;
|
|
173
|
+
const cursors = new Map<number, ProjectionCursor>([
|
|
174
|
+
[
|
|
175
|
+
0,
|
|
176
|
+
{ world: world[worldInternal].getChangeCursor(), sharedRefs: sharedRefs.getMutationEpoch() },
|
|
177
|
+
],
|
|
178
|
+
]);
|
|
179
|
+
|
|
180
|
+
const assertLive = (): void => {
|
|
181
|
+
if (disposed) throw new Error('RenderReadLease is disposed.');
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
const captureCursor = (): number => {
|
|
185
|
+
const cursor = nextCursor++;
|
|
186
|
+
cursors.set(cursor, {
|
|
187
|
+
world: world[worldInternal].getChangeCursor(),
|
|
188
|
+
sharedRefs: sharedRefs.getMutationEpoch(),
|
|
189
|
+
});
|
|
190
|
+
if (cursors.size > 8) {
|
|
191
|
+
const oldest = cursors.keys().next().value;
|
|
192
|
+
if (typeof oldest === 'number' && oldest !== cursor) cursors.delete(oldest);
|
|
193
|
+
}
|
|
194
|
+
return cursor;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
return {
|
|
198
|
+
worldIdentity: world.identity,
|
|
199
|
+
generation,
|
|
200
|
+
inspectCursor(): number {
|
|
201
|
+
assertLive();
|
|
202
|
+
return captureCursor();
|
|
203
|
+
},
|
|
204
|
+
readChanges(cursor: number): RenderChangeBatch {
|
|
205
|
+
assertLive();
|
|
206
|
+
const start = cursors.get(cursor);
|
|
207
|
+
if (start === undefined) throw new RangeError(`Unknown RenderReadLease cursor ${cursor}.`);
|
|
208
|
+
const worldRead = world[worldInternal].readChangesSince(start.world) as WorldChangeRead;
|
|
209
|
+
const sharedRead = sharedRefs.readChangesSince(start.sharedRefs);
|
|
210
|
+
const next = captureCursor();
|
|
211
|
+
if (worldRead.status === 'overflow' || sharedRead.status === 'overflow') {
|
|
212
|
+
const oldestAvailable = Math.min(
|
|
213
|
+
worldRead.status === 'overflow' ? worldRead.oldestAvailable : Number.MAX_SAFE_INTEGER,
|
|
214
|
+
sharedRead.status === 'overflow' ? sharedRead.oldestAvailable : Number.MAX_SAFE_INTEGER,
|
|
215
|
+
);
|
|
216
|
+
return {
|
|
217
|
+
status: 'overflow',
|
|
218
|
+
cursor: next,
|
|
219
|
+
resync: true,
|
|
220
|
+
oldestAvailable,
|
|
221
|
+
world: worldRead,
|
|
222
|
+
sharedRefs: sharedRead,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
return { status: 'ok', cursor: next, world: worldRead, sharedRefs: sharedRead };
|
|
226
|
+
},
|
|
227
|
+
querySpans(request: RenderProjectionRequest): RenderProjectionSpans {
|
|
228
|
+
assertLive();
|
|
229
|
+
return readProjectionSpans(world, generation, request);
|
|
230
|
+
},
|
|
231
|
+
dispose(): void {
|
|
232
|
+
disposed = true;
|
|
233
|
+
cursors.clear();
|
|
234
|
+
},
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Publish one owner-derived component value without confusing it with an
|
|
240
|
+
* authored mutation. Owner packages use this narrow seam for fields such as
|
|
241
|
+
* `Transform.world`: the write still passes through ECS validation and managed
|
|
242
|
+
* storage, while the journal records a `derived-component-changed` fact for
|
|
243
|
+
* incremental projections.
|
|
244
|
+
*/
|
|
245
|
+
export function setDerivedComponent(
|
|
246
|
+
world: World,
|
|
247
|
+
entity: EntityHandle,
|
|
248
|
+
component: Component,
|
|
249
|
+
value: Record<string, unknown>,
|
|
250
|
+
): Result<void, EcsError> {
|
|
251
|
+
const result = world[worldInternal].setQueryRow(entity, component, value);
|
|
252
|
+
if (!result.ok) return result;
|
|
253
|
+
world[worldInternal].markDerivedComponentChanges(componentId(component), [entity]);
|
|
254
|
+
return result;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/** Route an owner-domain error through the World without exposing raw internals. */
|
|
258
|
+
export function routeWorldError(
|
|
259
|
+
world: World,
|
|
260
|
+
error: unknown,
|
|
261
|
+
context?: { readonly systemName: string },
|
|
262
|
+
): void {
|
|
263
|
+
world[worldInternal].routeError(error, context);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Create the narrow incremental evidence surface for an owner projection.
|
|
268
|
+
* Rebuilds intentionally return a reason; complete data always comes from
|
|
269
|
+
* the owner's regular Query/QuerySpan path.
|
|
270
|
+
*/
|
|
271
|
+
export function createWorldProjection(
|
|
272
|
+
world: World,
|
|
273
|
+
options: WorldProjectionOptions = {},
|
|
274
|
+
): WorldProjection {
|
|
275
|
+
const componentById =
|
|
276
|
+
options.components === undefined
|
|
277
|
+
? undefined
|
|
278
|
+
: new Map(options.components.map((component) => [componentId(component), component]));
|
|
279
|
+
const componentIds = componentById === undefined ? undefined : new Set(componentById.keys());
|
|
280
|
+
let cursor = world[worldInternal].getChangeCursor();
|
|
281
|
+
|
|
282
|
+
const pollSince = (requestedCursor: number): ProjectionRead => {
|
|
283
|
+
const result = world[worldInternal].readChangesSince(requestedCursor);
|
|
284
|
+
if (result.status === 'overflow') {
|
|
285
|
+
cursor = result.cursor;
|
|
286
|
+
return { status: 'rebuild', cursor, reason: 'journal-overflow' };
|
|
287
|
+
}
|
|
288
|
+
cursor = result.cursor;
|
|
289
|
+
const changes: ProjectionChange[] = [];
|
|
290
|
+
for (const record of result.records) {
|
|
291
|
+
if (
|
|
292
|
+
componentIds !== undefined &&
|
|
293
|
+
record.kind !== 'entity-removed' &&
|
|
294
|
+
(record.componentId === undefined || !componentIds.has(record.componentId))
|
|
295
|
+
) {
|
|
296
|
+
continue;
|
|
297
|
+
}
|
|
298
|
+
const component =
|
|
299
|
+
record.componentId === undefined ? undefined : componentById?.get(record.componentId);
|
|
300
|
+
changes.push({
|
|
301
|
+
entity: record.entity,
|
|
302
|
+
kind: record.kind,
|
|
303
|
+
...(component === undefined ? {} : { component }),
|
|
304
|
+
...(record.componentId === undefined ? {} : { componentId: record.componentId }),
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
return { status: 'delta', cursor, changes };
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
return {
|
|
311
|
+
get cursor(): number {
|
|
312
|
+
return cursor;
|
|
313
|
+
},
|
|
314
|
+
poll(): ProjectionRead {
|
|
315
|
+
return pollSince(cursor);
|
|
316
|
+
},
|
|
317
|
+
};
|
|
318
|
+
}
|