@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 @@
|
|
|
1
|
+
{"version":3,"file":"handle.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/handle.test-d.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hierarchy.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/hierarchy.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed-array-vocab.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/managed-array-vocab.test-d.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"minimal-example.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/minimal-example.test-d.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"name-read-types.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/name-read-types.test-d.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-service.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/plugin-service.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-combinations.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/query-combinations.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-light-extract-flat-column-ratio.perf.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/query-light-extract-flat-column-ratio.perf.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-storage-trends.perf.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/query-storage-trends.perf.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-trs-flat-column-ratio.perf.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/query-trs-flat-column-ratio.perf.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/query.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relationship-index.perf.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/relationship-index.perf.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relationship-index.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/relationship-index.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scalar-field-type-owner.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/scalar-field-type-owner.test-d.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-determinism.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/schedule-determinism.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-inspection.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/schedule-inspection.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-scope-error.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/schedule-scope-error.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-token.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/schedule-token.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-vocab.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/schema-vocab.test-d.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialization.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/serialization.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-kernel-eligibility.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/shared-kernel-eligibility.test-d.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-kernel-eligibility.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/shared-kernel-eligibility.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-ref-store.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/shared-ref-store.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sparse-tag.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/sparse-tag.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn-field-error.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/spawn-field-error.test-d.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stale-error.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/stale-error.test-d.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string-view-symmetry.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/string-view-symmetry.test-d.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string-vocab.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/string-vocab.test-d.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structure-epoch-boundaries.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/structure-epoch-boundaries.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structure-epoch.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/structure-epoch.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-archetype-mapping.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/table-archetype-mapping.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/time.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/types.test-d.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unique-ref-store.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/unique-ref-store.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unwrap a phantom-branded numeric id (`Handle<T, M>`, `Entity`,
|
|
3
|
+
* `SceneInstanceId`, ...) to its underlying `number` representation. Used
|
|
4
|
+
* by test fixtures that need to compare brand-erased numeric values via
|
|
5
|
+
* `Object.is` / `===`.
|
|
6
|
+
*
|
|
7
|
+
* The constraint `H extends number` keeps the helper aligned with the
|
|
8
|
+
* brand idiom (`number & {brand}`) used throughout the codebase without
|
|
9
|
+
* coupling to any specific brand class.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare const handleNumeric: <H extends number>(h: H) => number;
|
|
14
|
+
//# sourceMappingURL=handle-numeric.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle-numeric.d.ts","sourceRoot":"","sources":["../../../src/__tests__/utils/handle-numeric.ts"],"names":[],"mappings":"AAiBA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,MAAM,EAAE,GAAG,CAAC,KAAG,MAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-root-surface.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/validation-root-surface.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visibility-atomic-write.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/visibility-atomic-write.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"world-change-journal.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/world-change-journal.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"world-characterization.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/world-characterization.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"world-consumer-inference.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/world-consumer-inference.test-d.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"world-health.contract.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/world-health.contract.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"world-inspection.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/world-inspection.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"world-internal-identity.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/world-internal-identity.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"world-managed-roundtrip.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/world-managed-roundtrip.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"world-scheduling.m4.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/world-scheduling.m4.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"world-unique-roundtrip.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/world-unique-roundtrip.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"world.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/world.test-d.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { type Result } from '@forgeax/engine-types';
|
|
2
|
+
import { ManagedBufferOutOfBoundsError, ManagedBufferShrinkNotSupportedError } from './errors';
|
|
3
|
+
/**
|
|
4
|
+
* Size-class bucket boundaries in bytes (D-5, radix 4). Frozen tuple - the
|
|
5
|
+
* order is load-bearing: bucket index = ascending position in the array.
|
|
6
|
+
*
|
|
7
|
+
* `alloc(byteLength)` rounds up to `SIZE_CLASSES[i]` for the smallest `i`
|
|
8
|
+
* with `byteLength <= SIZE_CLASSES[i]`. byteLength === 0 is the special path
|
|
9
|
+
* (no bucket); byteLength > SIZE_CLASSES[7] (262_144) returns
|
|
10
|
+
* `managed-buffer-out-of-bounds`.
|
|
11
|
+
*/
|
|
12
|
+
export declare const SIZE_CLASSES: readonly number[];
|
|
13
|
+
/** Result envelope for a fresh alloc - id + initial view. */
|
|
14
|
+
export interface BufferAllocResult {
|
|
15
|
+
/** Stable slot id; archetype columns store this u32 in their `buffer:<N>` field. */
|
|
16
|
+
readonly id: number;
|
|
17
|
+
/** Live Uint8Array view of length `byteLength` (D-5 rounding visible only via `view.buffer.byteLength`). */
|
|
18
|
+
readonly view: Uint8Array;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Per-(slot id) managed Uint8Array store backing the `buffer:<bytes>` schema
|
|
22
|
+
* vocab keyword. Eight size-class free-lists (radix 4); cross-bucket growth
|
|
23
|
+
* uses `ArrayBuffer.transfer` when available with a copy fallback for older
|
|
24
|
+
* runtimes.
|
|
25
|
+
*
|
|
26
|
+
* AI users do not interact with `BufferPool` directly - it sits behind
|
|
27
|
+
* `world.get(e, C).<bufferField>` and the M4 carry-over migrate path. The
|
|
28
|
+
* pool is exposed as a class so World can hold one instance per
|
|
29
|
+
* `new World()` (D-2 per-World lifecycle).
|
|
30
|
+
*/
|
|
31
|
+
export declare class BufferPool {
|
|
32
|
+
private readonly slots;
|
|
33
|
+
/**
|
|
34
|
+
* Per-bucket free-lists: `freeBuckets[i]` is a LIFO stack of slot ids
|
|
35
|
+
* whose backing buffer is parked on bucket `i`. Released slots stay on
|
|
36
|
+
* their original bucket's free-list - v1 never moves a slot between
|
|
37
|
+
* buckets on release (D-7 no trim).
|
|
38
|
+
*/
|
|
39
|
+
private readonly freeBuckets;
|
|
40
|
+
private nextId;
|
|
41
|
+
/**
|
|
42
|
+
* Allocate a managed buffer slot of at least `byteLength` bytes.
|
|
43
|
+
*
|
|
44
|
+
* Routes:
|
|
45
|
+
* - byteLength < 0 -> not in current contract (caller responsibility).
|
|
46
|
+
* - byteLength == 0 -> ok({ id, view: zero-length Uint8Array }) (no bucket).
|
|
47
|
+
* - byteLength <= 262144 -> ok({ id, view }), bucket = smallest >= byteLength.
|
|
48
|
+
* - byteLength > 262144 -> err(managed-buffer-out-of-bounds).
|
|
49
|
+
*
|
|
50
|
+
* D-5: size classes are radix-4 (16 / 64 / 256 / 1K / 4K / 16K / 64K / 256K).
|
|
51
|
+
* Free-list pop reuses the most recently released slot id at the same bucket;
|
|
52
|
+
* miss falls through to a fresh allocation.
|
|
53
|
+
*/
|
|
54
|
+
alloc(byteLength: number): Result<BufferAllocResult, ManagedBufferOutOfBoundsError>;
|
|
55
|
+
/**
|
|
56
|
+
* Grow slot `id` to `newBytes`. Returns the post-grow Uint8Array view.
|
|
57
|
+
*
|
|
58
|
+
* Routes (D-6 / D-7):
|
|
59
|
+
* - newBytes < current -> err(managed-buffer-shrink-not-supported).
|
|
60
|
+
* - newBytes == current -> ok(current view) (no-op, identity preserved).
|
|
61
|
+
* - newBytes > current && same bucket -> ok(re-sliced view) (no transfer).
|
|
62
|
+
* - newBytes > current && cross bucket -> ok(new view) backed by a fresh
|
|
63
|
+
* bucket buffer; the prior ArrayBuffer is detached via transfer (ES2024)
|
|
64
|
+
* or replaced via allocate-and-copy fallback. Old `view`s captured by
|
|
65
|
+
* the caller become detached / orphaned - callers must use `pool.view(id)`
|
|
66
|
+
* after grow to read the refreshed view (the `release` loop refreshes
|
|
67
|
+
* automatically).
|
|
68
|
+
* - newBytes > 262144 -> err(managed-buffer-out-of-bounds).
|
|
69
|
+
*/
|
|
70
|
+
grow(id: number, newBytes: number): Result<Uint8Array, ManagedBufferShrinkNotSupportedError | ManagedBufferOutOfBoundsError>;
|
|
71
|
+
/**
|
|
72
|
+
* Release slot `id` back to its bucket's free-list. Releasing an unknown id
|
|
73
|
+
* is a no-op - World's release loop drives this and idempotency keeps the
|
|
74
|
+
* despawn chain free of bookkeeping noise. Bucket free-lists are NEVER
|
|
75
|
+
* trimmed in v1 (D-7 no trim).
|
|
76
|
+
*/
|
|
77
|
+
release(id: number): Result<void, never>;
|
|
78
|
+
/**
|
|
79
|
+
* Return the live view for slot `id`. Used by World after `grow` to
|
|
80
|
+
* refresh the column's stored view reference. Returns a zero-length view
|
|
81
|
+
* for unknown / released ids so callers never crash on use-after-release.
|
|
82
|
+
*/
|
|
83
|
+
view(id: number): Uint8Array;
|
|
84
|
+
/**
|
|
85
|
+
* Return the bucket-rounded byte capacity for slot `id` --- i.e.
|
|
86
|
+
* `SIZE_CLASSES[slot.sizeClassIdx]`. Used by managed-buffer view callers
|
|
87
|
+
* (D-4 no-cache: re-queried per accessor). Returns `0` for the zero-length
|
|
88
|
+
* (`alloc(0)`) slot; returns `0` for unknown / released ids (mirrors
|
|
89
|
+
* `view(id)` use-after-release semantics).
|
|
90
|
+
*/
|
|
91
|
+
byteCapacity(id: number): number;
|
|
92
|
+
/**
|
|
93
|
+
* Reset the logical byteLength of slot `id` to `newByteLength` while
|
|
94
|
+
* keeping the same bucket allocation (no transfer, no release). Only
|
|
95
|
+
* legal when `newByteLength <= bucketBytes`; the slot's bucket index
|
|
96
|
+
* does not move (D-7 v1 forbids cross-bucket shrink). Used by managed-
|
|
97
|
+
* buffer clear paths so the slot retains its `byteCapacity` while the
|
|
98
|
+
* live view becomes zero-length. Bytes past the new logical length are
|
|
99
|
+
* zero-filled defensively.
|
|
100
|
+
*
|
|
101
|
+
* Returns `err(ManagedBufferShrinkNotSupportedError)` when called on a
|
|
102
|
+
* `sizeClassIdx === -1` slot (alloc(0)) with `newByteLength > 0`, or
|
|
103
|
+
* when `newByteLength` exceeds the bucket capacity.
|
|
104
|
+
*/
|
|
105
|
+
setLogicalLength(id: number, newByteLength: number): Result<Uint8Array, ManagedBufferShrinkNotSupportedError | ManagedBufferOutOfBoundsError>;
|
|
106
|
+
/** @internal Diagnostic count of live slots. Exposed for tests + inspector. */
|
|
107
|
+
_liveCount(): number;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=buffer-pool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buffer-pool.d.ts","sourceRoot":"","sources":["../src/buffer-pool.ts"],"names":[],"mappings":"AA2CA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,6BAA6B,EAAE,oCAAoC,EAAE,MAAM,UAAU,CAAC;AAE/F;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,EAAE,SAAS,MAAM,EAExC,CAAC;AAEH,6DAA6D;AAC7D,MAAM,WAAW,iBAAiB;IAChC,oFAAoF;IACpF,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,4GAA4G;IAC5G,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAyCD;;;;;;;;;;GAUG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgC;IACtD;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAsD;IAClF,OAAO,CAAC,MAAM,CAAK;IAEnB;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC,iBAAiB,EAAE,6BAA6B,CAAC;IAoDnF;;;;;;;;;;;;;;OAcG;IACH,IAAI,CACF,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,MAAM,GACf,MAAM,CAAC,UAAU,EAAE,oCAAoC,GAAG,6BAA6B,CAAC;IAgD3F;;;;;OAKG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC;IAgBxC;;;;OAIG;IACH,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU;IAM5B;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM;IAOhC;;;;;;;;;;;;OAYG;IACH,gBAAgB,CACd,EAAE,EAAE,MAAM,EACV,aAAa,EAAE,MAAM,GACpB,MAAM,CAAC,UAAU,EAAE,oCAAoC,GAAG,6BAA6B,CAAC;IA4B3F,+EAA+E;IAC/E,UAAU,IAAI,MAAM;CAKrB"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { Result } from '@forgeax/engine-types';
|
|
2
|
+
import type { Component, ComponentSchema } from './component';
|
|
3
|
+
import { type EntityHandle } from './entity-handle';
|
|
4
|
+
import { type CommandKind } from './errors';
|
|
5
|
+
import type { ComponentData, EcsError } from './world';
|
|
6
|
+
import { type WorldInternal, worldInternal } from './world-internal';
|
|
7
|
+
export type Command = {
|
|
8
|
+
type: 'spawn';
|
|
9
|
+
componentDatas: ComponentData[];
|
|
10
|
+
entity: EntityHandle;
|
|
11
|
+
} | {
|
|
12
|
+
type: 'despawn';
|
|
13
|
+
entity: EntityHandle;
|
|
14
|
+
} | {
|
|
15
|
+
type: 'addComponent';
|
|
16
|
+
entity: EntityHandle;
|
|
17
|
+
componentData: ComponentData;
|
|
18
|
+
} | {
|
|
19
|
+
type: 'removeComponent';
|
|
20
|
+
entity: EntityHandle;
|
|
21
|
+
component: Component;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* CommandBuffer queues structural changes (spawn/despawn/addComponent/removeComponent)
|
|
25
|
+
* during system execution. Flushed at end of world.update().
|
|
26
|
+
*/
|
|
27
|
+
export interface CommandBuffer {
|
|
28
|
+
readonly status: 'open' | 'committed' | 'aborted';
|
|
29
|
+
/** Deferred spawn: returns pending Entity handle. */
|
|
30
|
+
spawn(...componentDatas: ComponentData[]): EntityHandle;
|
|
31
|
+
/** Deferred despawn. */
|
|
32
|
+
despawn(entity: EntityHandle): unknown;
|
|
33
|
+
/** Deferred addComponent. */
|
|
34
|
+
addComponent<S extends ComponentSchema>(entity: EntityHandle, componentData: ComponentData<S>): unknown;
|
|
35
|
+
/** Deferred removeComponent. */
|
|
36
|
+
removeComponent<S extends ComponentSchema>(entity: EntityHandle, component: Component<string, S>): unknown;
|
|
37
|
+
/** Check if an entity is pending (deferred spawn, not yet flushed). */
|
|
38
|
+
isDeferred(entity: EntityHandle): boolean;
|
|
39
|
+
commit(): void;
|
|
40
|
+
abort(error?: unknown): void;
|
|
41
|
+
}
|
|
42
|
+
/** Minimal world interface needed by CommandBuffer for entity allocation. */
|
|
43
|
+
export interface WorldForCommands {
|
|
44
|
+
readonly [worldInternal]: WorldInternal;
|
|
45
|
+
/**
|
|
46
|
+
* Allocate a pending entity index, returning [entity handle, index slot].
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
/**
|
|
50
|
+
* Mark a pending entity as materialized (flush phase).
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
/** Execute despawn directly (flush phase). */
|
|
54
|
+
despawn(entity: EntityHandle): Result<void, EcsError>;
|
|
55
|
+
/** Execute addComponent directly (flush phase). */
|
|
56
|
+
addComponent<S extends ComponentSchema>(entity: EntityHandle, componentData: ComponentData<S>): Result<void, EcsError>;
|
|
57
|
+
/** Execute removeComponent directly (flush phase). */
|
|
58
|
+
removeComponent<S extends ComponentSchema>(entity: EntityHandle, component: Component<string, S>): Result<void, EcsError>;
|
|
59
|
+
/** Fast membership probe used by command preflight. */
|
|
60
|
+
hasComponent(entity: EntityHandle, component: Component): boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface CommandBufferImpl extends CommandBuffer {
|
|
63
|
+
/** @internal */
|
|
64
|
+
_queue: Command[];
|
|
65
|
+
/** @internal */
|
|
66
|
+
_pendingEntities: Set<number>;
|
|
67
|
+
/** @internal First validation failure captured while the system was staging commands. */
|
|
68
|
+
_queueError: {
|
|
69
|
+
readonly index: number;
|
|
70
|
+
readonly kind: CommandKind;
|
|
71
|
+
readonly cause: unknown;
|
|
72
|
+
} | null;
|
|
73
|
+
/** @internal */
|
|
74
|
+
readonly _systemName: string;
|
|
75
|
+
/** @internal */
|
|
76
|
+
readonly _scheduleName: string;
|
|
77
|
+
/** @internal */
|
|
78
|
+
_setStatus(status: 'committed' | 'aborted'): void;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Create a CommandBuffer bound to a World.
|
|
82
|
+
* @param world - the World (for pending entity allocation)
|
|
83
|
+
*/
|
|
84
|
+
export declare function createCommandBuffer(world: WorldForCommands, context?: {
|
|
85
|
+
readonly systemName?: string;
|
|
86
|
+
readonly scheduleName?: string;
|
|
87
|
+
}): CommandBufferImpl;
|
|
88
|
+
/**
|
|
89
|
+
* Flush all queued commands against the World.
|
|
90
|
+
* Uses while(queue.length > 0) to support cascade (commands spawned during flush).
|
|
91
|
+
*/
|
|
92
|
+
export declare function flushCommands(buffer: CommandBufferImpl, world: WorldForCommands): void;
|
|
93
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"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"}
|