@adobe/data 0.4.4 → 0.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ecs/database/database-schema/create-database-from-schema.d.ts +12 -0
- package/dist/ecs/database/database-schema/create-database-from-schema.js +8 -0
- package/dist/ecs/database/database-schema/create-database-from-schema.js.map +1 -0
- package/dist/ecs/database/database-schema/create-database-schema-test.js +2 -2
- package/dist/ecs/database/database-schema/create-database-schema-test.js.map +1 -1
- package/dist/ecs/database/database-schema/create-database-schema.d.ts +3 -6
- package/dist/ecs/database/database-schema/create-database-schema.js +2 -2
- package/dist/ecs/database/database-schema/create-database-schema.js.map +1 -1
- package/dist/{core/schema/validation/is-valid.test.js → ecs/database/database-schema/create-store-schema-test.js} +14 -18
- package/dist/ecs/database/database-schema/create-store-schema-test.js.map +1 -0
- package/dist/ecs/database/database-schema/create-store-schema.d.ts +9 -0
- package/dist/{core/functions/is-async-generator.js → ecs/database/database-schema/create-store-schema.js} +4 -3
- package/dist/ecs/database/database-schema/create-store-schema.js.map +1 -0
- package/dist/ecs/database/database-schema/database-schema.d.ts +2 -5
- package/dist/ecs/database/database-schema/index.d.ts +2 -2
- package/dist/ecs/database/database-schema/index.js +2 -2
- package/dist/ecs/database/database-schema/index.js.map +1 -1
- package/dist/ecs/database/database-schema/store-schema.d.ts +12 -0
- package/dist/ecs/{ecs/ecs-types.js → database/database-schema/store-schema.js} +1 -1
- package/dist/ecs/database/database-schema/store-schema.js.map +1 -0
- package/dist/ecs/database/database.d.ts +4 -4
- package/dist/ecs/database/index.d.ts +0 -1
- package/dist/ecs/database/index.js +0 -1
- package/dist/ecs/database/index.js.map +1 -1
- package/dist/{cache/functions/omit.js → ecs/database/store-schema/create-store-schema-test.js} +15 -8
- package/dist/ecs/database/store-schema/create-store-schema-test.js.map +1 -0
- package/dist/ecs/database/store-schema/create-store-schema.d.ts +9 -0
- package/dist/{core/index.js → ecs/database/store-schema/create-store-schema.js} +5 -4
- package/dist/ecs/database/store-schema/create-store-schema.js.map +1 -0
- package/dist/ecs/database/store-schema/index.d.ts +2 -0
- package/dist/ecs/{action-ecs → database/store-schema}/index.js +2 -1
- package/dist/ecs/database/store-schema/index.js.map +1 -0
- package/dist/ecs/database/store-schema/store-schema.d.ts +12 -0
- package/dist/ecs/database/{transactional-store/undoable.js → store-schema/store-schema.js} +1 -1
- package/dist/ecs/database/store-schema/store-schema.js.map +1 -0
- package/dist/ecs/database/transactional-store/apply-operations.d.ts +2 -2
- package/dist/ecs/database/transactional-store/apply-operations.js.map +1 -1
- package/dist/ecs/database/transactional-store/create-test-transaction.d.ts +0 -1
- package/dist/ecs/database/transactional-store/create-test-transaction.js.map +1 -1
- package/dist/ecs/database/transactional-store/create-transactional-store.js +5 -6
- package/dist/ecs/database/transactional-store/create-transactional-store.js.map +1 -1
- package/dist/ecs/database/transactional-store/index.d.ts +0 -1
- package/dist/ecs/database/transactional-store/index.js +0 -1
- package/dist/ecs/database/transactional-store/index.js.map +1 -1
- package/dist/ecs/database/transactional-store/transactional-store.d.ts +1 -6
- package/dist/ecs/store/create-store.js.map +1 -1
- package/dist/ecs/store/index.d.ts +1 -0
- package/dist/ecs/store/index.js +1 -0
- package/dist/ecs/store/index.js.map +1 -1
- package/dist/{cache/functions/bind-functions.js → ecs/store/store-schema/create-store-schema-test.js} +15 -12
- package/dist/ecs/store/store-schema/create-store-schema-test.js.map +1 -0
- package/dist/ecs/store/store-schema/create-store-schema.d.ts +9 -0
- package/dist/{core/functions/index.js → ecs/store/store-schema/create-store-schema.js} +5 -4
- package/dist/ecs/store/store-schema/create-store-schema.js.map +1 -0
- package/dist/ecs/store/store-schema/index.d.ts +2 -0
- package/dist/ecs/{transaction-ecs → store/store-schema}/index.js +2 -2
- package/dist/ecs/store/store-schema/index.js.map +1 -0
- package/dist/ecs/store/store-schema/store-schema.d.ts +12 -0
- package/dist/{cache/functions/types.js → ecs/store/store-schema/store-schema.js} +1 -1
- package/dist/ecs/store/store-schema/store-schema.js.map +1 -0
- package/dist/ecs/store/store.d.ts +6 -0
- package/dist/ecs/undo-redo/create-undo-redo-actions.js +0 -21
- package/dist/ecs/undo-redo/create-undo-redo-actions.js.map +1 -1
- package/dist/ecs/undo-redo/create-undo-redo-actions.test.js.map +1 -1
- package/dist/functions/serialization/deserialize.d.ts +4 -1
- package/dist/functions/serialization/deserialize.js +14 -1
- package/dist/functions/serialization/deserialize.js.map +1 -1
- package/dist/functions/serialization/serialization.d.ts +23 -0
- package/dist/functions/serialization/serialization.js +58 -0
- package/dist/functions/serialization/serialization.js.map +1 -0
- package/dist/functions/serialization.d.ts +23 -0
- package/dist/functions/serialization.js +58 -0
- package/dist/functions/serialization.js.map +1 -0
- package/dist/{core/functions/with-validation.js → functions/serialization.test.js} +22 -16
- package/dist/functions/serialization.test.js.map +1 -0
- package/dist/functions/serialize.d.ts +17 -0
- package/dist/functions/serialize.js +66 -0
- package/dist/functions/serialize.js.map +1 -0
- package/dist/observe/to-async-generator.js +14 -11
- package/dist/observe/to-async-generator.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/typed-buffer/structs/get-struct-layout.js +7 -10
- package/dist/typed-buffer/structs/get-struct-layout.js.map +1 -1
- package/dist/typed-buffer/structs/get-struct-layout.test.js +148 -11
- package/dist/typed-buffer/structs/get-struct-layout.test.js.map +1 -1
- package/package.json +1 -1
- package/dist/README.md +0 -310
- package/dist/cache/functions/bind-functions.d.ts +0 -6
- package/dist/cache/functions/bind-functions.js.map +0 -1
- package/dist/cache/functions/hashing/arrayBufferToHex.d.ts +0 -1
- package/dist/cache/functions/hashing/arrayBufferToHex.js +0 -27
- package/dist/cache/functions/hashing/arrayBufferToHex.js.map +0 -1
- package/dist/cache/functions/omit.d.ts +0 -1
- package/dist/cache/functions/omit.js.map +0 -1
- package/dist/cache/functions/types.d.ts +0 -1
- package/dist/cache/functions/types.js.map +0 -1
- package/dist/core/data.d.ts +0 -22
- package/dist/core/data.js +0 -52
- package/dist/core/data.js.map +0 -1
- package/dist/core/data.test.js +0 -48
- package/dist/core/data.test.js.map +0 -1
- package/dist/core/functions/array-equals.d.ts +0 -1
- package/dist/core/functions/array-equals.js +0 -34
- package/dist/core/functions/array-equals.js.map +0 -1
- package/dist/core/functions/deep-merge.d.ts +0 -32
- package/dist/core/functions/deep-merge.js +0 -54
- package/dist/core/functions/deep-merge.js.map +0 -1
- package/dist/core/functions/deep-merge.test.js +0 -94
- package/dist/core/functions/deep-merge.test.js.map +0 -1
- package/dist/core/functions/index.d.ts +0 -3
- package/dist/core/functions/index.js.map +0 -1
- package/dist/core/functions/is-async-generator.d.ts +0 -1
- package/dist/core/functions/is-async-generator.js.map +0 -1
- package/dist/core/functions/is-promise.d.ts +0 -1
- package/dist/core/functions/is-promise.js +0 -26
- package/dist/core/functions/is-promise.js.map +0 -1
- package/dist/core/functions/with-validation.d.ts +0 -5
- package/dist/core/functions/with-validation.js.map +0 -1
- package/dist/core/functions/with-validation.test.js +0 -96
- package/dist/core/functions/with-validation.test.js.map +0 -1
- package/dist/core/index.d.ts +0 -3
- package/dist/core/index.js.map +0 -1
- package/dist/core/schema/dynamic/dynamic-schema.d.ts +0 -27
- package/dist/core/schema/dynamic/dynamic-schema.js +0 -2
- package/dist/core/schema/dynamic/dynamic-schema.js.map +0 -1
- package/dist/core/schema/dynamic/enumerate-patches.d.ts +0 -9
- package/dist/core/schema/dynamic/enumerate-patches.js +0 -50
- package/dist/core/schema/dynamic/enumerate-patches.js.map +0 -1
- package/dist/core/schema/dynamic/enumerate-patches.test.d.ts +0 -134
- package/dist/core/schema/dynamic/enumerate-patches.test.js +0 -209
- package/dist/core/schema/dynamic/enumerate-patches.test.js.map +0 -1
- package/dist/core/schema/dynamic/get-dynamic-schema.d.ts +0 -5
- package/dist/core/schema/dynamic/get-dynamic-schema.js +0 -26
- package/dist/core/schema/dynamic/get-dynamic-schema.js.map +0 -1
- package/dist/core/schema/dynamic/get-dynamic-schema.test.d.ts +0 -1
- package/dist/core/schema/dynamic/get-dynamic-schema.test.js +0 -94
- package/dist/core/schema/dynamic/get-dynamic-schema.test.js.map +0 -1
- package/dist/core/schema/dynamic/index.d.ts +0 -1
- package/dist/core/schema/dynamic/index.js +0 -2
- package/dist/core/schema/dynamic/index.js.map +0 -1
- package/dist/core/schema/dynamic/schema-path-value-path.d.ts +0 -5
- package/dist/core/schema/dynamic/schema-path-value-path.js +0 -12
- package/dist/core/schema/dynamic/schema-path-value-path.js.map +0 -1
- package/dist/core/schema/dynamic-schema.d.ts +0 -27
- package/dist/core/schema/dynamic-schema.js +0 -2
- package/dist/core/schema/dynamic-schema.js.map +0 -1
- package/dist/core/schema/index.d.ts +0 -4
- package/dist/core/schema/index.js +0 -26
- package/dist/core/schema/index.js.map +0 -1
- package/dist/core/schema/schema.d.ts +0 -122
- package/dist/core/schema/schema.js +0 -34
- package/dist/core/schema/schema.js.map +0 -1
- package/dist/core/schema/schemas.d.ts +0 -45
- package/dist/core/schema/schemas.js +0 -39
- package/dist/core/schema/schemas.js.map +0 -1
- package/dist/core/schema/ui-schema.d.ts +0 -25
- package/dist/core/schema/ui-schema.js +0 -2
- package/dist/core/schema/ui-schema.js.map +0 -1
- package/dist/core/schema/validation/is-valid.d.ts +0 -2
- package/dist/core/schema/validation/is-valid.js +0 -14
- package/dist/core/schema/validation/is-valid.js.map +0 -1
- package/dist/core/schema/validation/is-valid.test.d.ts +0 -1
- package/dist/core/schema/validation/is-valid.test.js.map +0 -1
- package/dist/core/schema/validation/validate.d.ts +0 -2
- package/dist/core/schema/validation/validate.js +0 -38
- package/dist/core/schema/validation/validate.js.map +0 -1
- package/dist/core/schema/validation/validate.test.d.ts +0 -1
- package/dist/core/schema/validation/validate.test.js +0 -106
- package/dist/core/schema/validation/validate.test.js.map +0 -1
- package/dist/core/schema/validation/with-validation.d.ts +0 -5
- package/dist/core/schema/validation/with-validation.js +0 -16
- package/dist/core/schema/validation/with-validation.js.map +0 -1
- package/dist/core/schema/validation/with-validation.test.d.ts +0 -1
- package/dist/core/schema/validation/with-validation.test.js +0 -96
- package/dist/core/schema/validation/with-validation.test.js.map +0 -1
- package/dist/core/schema.d.ts +0 -86
- package/dist/core/schema.js +0 -33
- package/dist/core/schema.js.map +0 -1
- package/dist/core/schema.test.js +0 -16
- package/dist/core/schema.test.js.map +0 -1
- package/dist/core/schemas.d.ts +0 -45
- package/dist/core/schemas.js +0 -39
- package/dist/core/schemas.js.map +0 -1
- package/dist/ecs/action-ecs/action-ecs.d.ts +0 -19
- package/dist/ecs/action-ecs/action-ecs.js +0 -203
- package/dist/ecs/action-ecs/action-ecs.js.map +0 -1
- package/dist/ecs/action-ecs/action-ecs.test.d.ts +0 -1
- package/dist/ecs/action-ecs/action-ecs.test.js +0 -362
- package/dist/ecs/action-ecs/action-ecs.test.js.map +0 -1
- package/dist/ecs/action-ecs/action-types.d.ts +0 -106
- package/dist/ecs/action-ecs/action-types.js +0 -19
- package/dist/ecs/action-ecs/action-types.js.map +0 -1
- package/dist/ecs/action-ecs/index.d.ts +0 -2
- package/dist/ecs/action-ecs/index.js.map +0 -1
- package/dist/ecs/core-ecs/core-ecs-serialization.test.d.ts +0 -1
- package/dist/ecs/core-ecs/core-ecs-serialization.test.js +0 -230
- package/dist/ecs/core-ecs/core-ecs-serialization.test.js.map +0 -1
- package/dist/ecs/core-ecs/core-ecs-types.d.ts +0 -141
- package/dist/ecs/core-ecs/core-ecs-types.js +0 -23
- package/dist/ecs/core-ecs/core-ecs-types.js.map +0 -1
- package/dist/ecs/core-ecs/core-ecs.d.ts +0 -7
- package/dist/ecs/core-ecs/core-ecs.js +0 -492
- package/dist/ecs/core-ecs/core-ecs.js.map +0 -1
- package/dist/ecs/core-ecs/core-ecs.test.d.ts +0 -1
- package/dist/ecs/core-ecs/core-ecs.test.js +0 -425
- package/dist/ecs/core-ecs/core-ecs.test.js.map +0 -1
- package/dist/ecs/core-ecs/index.d.ts +0 -1
- package/dist/ecs/core-ecs/index.js +0 -2
- package/dist/ecs/core-ecs/index.js.map +0 -1
- package/dist/ecs/database/register-database-codec.d.ts +0 -1
- package/dist/ecs/database/register-database-codec.js +0 -35
- package/dist/ecs/database/register-database-codec.js.map +0 -1
- package/dist/ecs/database/register-database-codecs.d.ts +0 -1
- package/dist/ecs/database/register-database-codecs.js +0 -35
- package/dist/ecs/database/register-database-codecs.js.map +0 -1
- package/dist/ecs/database/register-store-codec.d.ts +0 -1
- package/dist/ecs/database/register-store-codec.js +0 -35
- package/dist/ecs/database/register-store-codec.js.map +0 -1
- package/dist/ecs/database/register-typed-buffer-codecs.d.ts +0 -1
- package/dist/ecs/database/register-typed-buffer-codecs.js +0 -80
- package/dist/ecs/database/register-typed-buffer-codecs.js.map +0 -1
- package/dist/ecs/database/transactional-store/apply-write-operations.d.ts +0 -7
- package/dist/ecs/database/transactional-store/apply-write-operations.js +0 -20
- package/dist/ecs/database/transactional-store/apply-write-operations.js.map +0 -1
- package/dist/ecs/database/transactional-store/applyWriteOperations.d.ts +0 -7
- package/dist/ecs/database/transactional-store/applyWriteOperations.js +0 -20
- package/dist/ecs/database/transactional-store/applyWriteOperations.js.map +0 -1
- package/dist/ecs/database/transactional-store/patch.d.ts +0 -3
- package/dist/ecs/database/transactional-store/patch.js +0 -7
- package/dist/ecs/database/transactional-store/patch.js.map +0 -1
- package/dist/ecs/database/transactional-store/undoable.d.ts +0 -13
- package/dist/ecs/database/transactional-store/undoable.js.map +0 -1
- package/dist/ecs/database/transactional-store/with-undoable.d.ts +0 -10
- package/dist/ecs/database/transactional-store/with-undoable.js +0 -13
- package/dist/ecs/database/transactional-store/with-undoable.js.map +0 -1
- package/dist/ecs/database/with-undoable.d.ts +0 -10
- package/dist/ecs/database/with-undoable.js +0 -13
- package/dist/ecs/database/with-undoable.js.map +0 -1
- package/dist/ecs/ecs/ecs-types.d.ts +0 -132
- package/dist/ecs/ecs/ecs-types.js.map +0 -1
- package/dist/ecs/ecs/ecs-where-functions.d.ts +0 -6
- package/dist/ecs/ecs/ecs-where-functions.js +0 -91
- package/dist/ecs/ecs/ecs-where-functions.js.map +0 -1
- package/dist/ecs/ecs/ecs.d.ts +0 -13
- package/dist/ecs/ecs/ecs.js +0 -177
- package/dist/ecs/ecs/ecs.js.map +0 -1
- package/dist/ecs/ecs/ecs.test.d.ts +0 -1
- package/dist/ecs/ecs/ecs.test.js +0 -399
- package/dist/ecs/ecs/ecs.test.js.map +0 -1
- package/dist/ecs/ecs/index.d.ts +0 -3
- package/dist/ecs/ecs/index.js +0 -3
- package/dist/ecs/ecs/index.js.map +0 -1
- package/dist/ecs/entity-location-table/register-database-codec.d.ts +0 -1
- package/dist/ecs/entity-location-table/register-database-codec.js +0 -35
- package/dist/ecs/entity-location-table/register-database-codec.js.map +0 -1
- package/dist/ecs/entity-location-table/register-entity-location-table-codec.d.ts +0 -1
- package/dist/ecs/entity-location-table/register-entity-location-table-codec.js +0 -42
- package/dist/ecs/entity-location-table/register-entity-location-table-codec.js.map +0 -1
- package/dist/ecs/entity-location-table/register-entity-location-table-codec.test.d.ts +0 -1
- package/dist/ecs/entity-location-table/register-entity-location-table-codec.test.js +0 -70
- package/dist/ecs/entity-location-table/register-entity-location-table-codec.test.js.map +0 -1
- package/dist/ecs/persistence-service/create-persistence-service.d.ts +0 -6
- package/dist/ecs/persistence-service/create-persistence-service.js +0 -24
- package/dist/ecs/persistence-service/create-persistence-service.js.map +0 -1
- package/dist/ecs/persistence-service/create-session-persistence-service.d.ts +0 -8
- package/dist/ecs/persistence-service/create-session-persistence-service.js +0 -49
- package/dist/ecs/persistence-service/create-session-persistence-service.js.map +0 -1
- package/dist/ecs/persistence-service/persistence-service copy.d.ts +0 -5
- package/dist/ecs/persistence-service/persistence-service copy.js +0 -2
- package/dist/ecs/persistence-service/persistence-service copy.js.map +0 -1
- package/dist/ecs/persistence-service/to-blob-refs.d.ts +0 -2
- package/dist/ecs/persistence-service/to-blob-refs.js +0 -3
- package/dist/ecs/persistence-service/to-blob-refs.js.map +0 -1
- package/dist/ecs/persistence-service/undo-redo-service.d.ts +0 -11
- package/dist/ecs/persistence-service/undo-redo-service.js +0 -23
- package/dist/ecs/persistence-service/undo-redo-service.js.map +0 -1
- package/dist/ecs/store/core/register-core-codec.d.ts +0 -1
- package/dist/ecs/store/core/register-core-codec.js +0 -45
- package/dist/ecs/store/core/register-core-codec.js.map +0 -1
- package/dist/ecs/store/core/register-core-codec.test.d.ts +0 -1
- package/dist/ecs/store/core/register-core-codec.test.js +0 -136
- package/dist/ecs/store/core/register-core-codec.test.js.map +0 -1
- package/dist/ecs/store/query.d.ts +0 -47
- package/dist/ecs/store/query.js +0 -2
- package/dist/ecs/store/query.js.map +0 -1
- package/dist/ecs/store/register-core-codec.d.ts +0 -1
- package/dist/ecs/store/register-core-codec.js +0 -38
- package/dist/ecs/store/register-core-codec.js.map +0 -1
- package/dist/ecs/store/register-store-codec.d.ts +0 -1
- package/dist/ecs/store/register-store-codec.js +0 -38
- package/dist/ecs/store/register-store-codec.js.map +0 -1
- package/dist/ecs/store/restore-store.d.ts +0 -12
- package/dist/ecs/store/restore-store.js +0 -91
- package/dist/ecs/store/restore-store.js.map +0 -1
- package/dist/ecs/store/select-options.d.ts +0 -1
- package/dist/ecs/store/select-options.js +0 -16
- package/dist/ecs/store/select-options.js.map +0 -1
- package/dist/ecs/store/select.d.ts +0 -44
- package/dist/ecs/store/select.js +0 -2
- package/dist/ecs/store/select.js.map +0 -1
- package/dist/ecs/transaction-ecs/index.d.ts +0 -2
- package/dist/ecs/transaction-ecs/index.js.map +0 -1
- package/dist/ecs/transaction-ecs/transaction-ecs.d.ts +0 -11
- package/dist/ecs/transaction-ecs/transaction-ecs.js +0 -184
- package/dist/ecs/transaction-ecs/transaction-ecs.js.map +0 -1
- package/dist/ecs/transaction-ecs/transaction-ecs.test.d.ts +0 -1
- package/dist/ecs/transaction-ecs/transaction-ecs.test.js +0 -599
- package/dist/ecs/transaction-ecs/transaction-ecs.test.js.map +0 -1
- package/dist/ecs/transaction-ecs/transaction-types.d.ts +0 -135
- package/dist/ecs/transaction-ecs/transaction-types.js +0 -2
- package/dist/ecs/transaction-ecs/transaction-types.js.map +0 -1
- package/dist/ecs/transaction-ecs/transactions.d.ts +0 -5
- package/dist/ecs/transaction-ecs/transactions.js +0 -158
- package/dist/ecs/transaction-ecs/transactions.js.map +0 -1
- package/dist/ecs/undo-redo/do.d.ts +0 -3
- package/dist/ecs/undo-redo/do.js +0 -3
- package/dist/ecs/undo-redo/do.js.map +0 -1
- package/dist/ecs/undo-redo/index.d.ts +0 -1
- package/dist/ecs/undo-redo/index.js +0 -23
- package/dist/ecs/undo-redo/index.js.map +0 -1
- package/dist/functions/serialization/register-typed-array-codecs copy.d.ts +0 -1
- package/dist/functions/serialization/register-typed-array-codecs copy.js +0 -13
- package/dist/functions/serialization/register-typed-array-codecs copy.js.map +0 -1
- package/dist/functions/serialization/serialize-to-blobs copy.d.ts +0 -8
- package/dist/functions/serialization/serialize-to-blobs copy.js +0 -21
- package/dist/functions/serialization/serialize-to-blobs copy.js.map +0 -1
- package/dist/observe/with-map copy.d.ts +0 -5
- package/dist/observe/with-map copy.js +0 -14
- package/dist/observe/with-map copy.js.map +0 -1
- package/dist/package.json +0 -129
- package/dist/schema/f32 copy.d.ts +0 -6
- package/dist/schema/f32 copy.js +0 -6
- package/dist/schema/f32 copy.js.map +0 -1
- package/dist/schemas/index.d.ts +0 -1
- package/dist/schemas/index.js +0 -23
- package/dist/schemas/index.js.map +0 -1
- package/dist/schemas/schemas.d.ts +0 -45
- package/dist/schemas/schemas.js +0 -39
- package/dist/schemas/schemas.js.map +0 -1
- package/dist/service/sequential-action.d.ts +0 -18
- package/dist/service/sequential-action.js +0 -45
- package/dist/service/sequential-action.js.map +0 -1
- package/dist/table/ensure-capacity copy.d.ts +0 -2
- package/dist/table/ensure-capacity copy.js +0 -15
- package/dist/table/ensure-capacity copy.js.map +0 -1
- package/dist/table/filter-rows.d.ts +0 -2
- package/dist/table/filter-rows.js +0 -15
- package/dist/table/filter-rows.js.map +0 -1
- /package/dist/{core/data.test.d.ts → ecs/database/database-schema/create-store-schema-test.d.ts} +0 -0
- /package/dist/{core/functions/deep-merge.test.d.ts → ecs/database/store-schema/create-store-schema-test.d.ts} +0 -0
- /package/dist/{core/functions/with-validation.test.d.ts → ecs/store/store-schema/create-store-schema-test.d.ts} +0 -0
- /package/dist/{core/schema.test.d.ts → functions/serialization.test.d.ts} +0 -0
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/*MIT License
|
|
2
|
-
|
|
3
|
-
© Copyright 2025 Adobe. All rights reserved.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.*/
|
|
22
|
-
import { registerCodec } from "../../functions/serialization/codec.js";
|
|
23
|
-
function isStore(value) {
|
|
24
|
-
return value !== null && typeof value === "object" && "select" in value && "resources" in value && "archetypes" in value;
|
|
25
|
-
}
|
|
26
|
-
export function registerStoreCodec() {
|
|
27
|
-
registerCodec({
|
|
28
|
-
name: "store",
|
|
29
|
-
predicate: isStore,
|
|
30
|
-
serialize: (data) => {
|
|
31
|
-
throw new Error("not yet implemented");
|
|
32
|
-
},
|
|
33
|
-
deserialize: ({ json, binary }) => {
|
|
34
|
-
throw new Error("not implemented yet");
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=register-store-codec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"register-store-codec.js","sourceRoot":"","sources":["../../../src/ecs/store/register-store-codec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AAEX,OAAO,EAAkB,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAGvF,SAAS,OAAO,CAAC,KAAc;IAC3B,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,QAAQ,IAAI,KAAK,IAAI,WAAW,IAAI,KAAK,IAAI,YAAY,IAAI,KAAK,CAAC;AAC7H,CAAC;AAED,MAAM,UAAU,kBAAkB;IAC9B,aAAa,CAAQ;QACjB,IAAI,EAAE,OAAO;QACb,SAAS,EAAE,OAAO;QAClB,SAAS,EAAE,CAAC,IAAW,EAAE,EAAE;YACvB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QAC3C,CAAC;QACD,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAkB,EAAE,EAAE;YAC9C,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QAC3C,CAAC;KACJ,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ComponentSchemas } from "../component-schemas.js";
|
|
2
|
-
import { StringKeyof } from "../../types/types.js";
|
|
3
|
-
import { Store } from "./store.js";
|
|
4
|
-
import { FromSchema } from "../../schema/schema.js";
|
|
5
|
-
import { ResourceSchemas } from "../resource-schemas.js";
|
|
6
|
-
import { ArchetypeComponents } from "./archetype-components.js";
|
|
7
|
-
import { SerializedData } from "../../functions/serialization/codec.js";
|
|
8
|
-
export declare function restoreStore<NC extends ComponentSchemas, NR extends ResourceSchemas, A extends ArchetypeComponents<StringKeyof<NC>> = {}>(data: SerializedData): Store<{
|
|
9
|
-
[K in StringKeyof<NC>]: FromSchema<NC[K]>;
|
|
10
|
-
}, {
|
|
11
|
-
-readonly [K in StringKeyof<NR>]: FromSchema<NR[K]>;
|
|
12
|
-
}, A>;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/*MIT License
|
|
2
|
-
|
|
3
|
-
© Copyright 2025 Adobe. All rights reserved.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.*/
|
|
22
|
-
import { createCore } from "./core/create-core.js";
|
|
23
|
-
import { selectEntities } from "./core/select-entities.js";
|
|
24
|
-
import { restoreEntityLocationTable } from "../entity-location-table/create-entity-location-table.js";
|
|
25
|
-
export function restoreStore(data) {
|
|
26
|
-
const { json, binary } = data;
|
|
27
|
-
const { componentSchemas: newComponentSchemas, resourceSchemas, archetypeComponentNames, archetypes: serializedArchetypes, entityLocationTable: entityLocationTableData, } = json;
|
|
28
|
-
const resources = {};
|
|
29
|
-
const componentAndResourceSchemas = { ...newComponentSchemas };
|
|
30
|
-
// Resources are stored in the core as components, so we need to add them to the componentSchemas
|
|
31
|
-
for (const name of Object.keys(resourceSchemas)) {
|
|
32
|
-
const resourceId = name;
|
|
33
|
-
componentAndResourceSchemas[resourceId] = resourceSchemas[name];
|
|
34
|
-
}
|
|
35
|
-
const core = createCore(componentAndResourceSchemas);
|
|
36
|
-
// Restore entity location table
|
|
37
|
-
const entityLocationTable = restoreEntityLocationTable({
|
|
38
|
-
json: entityLocationTableData,
|
|
39
|
-
binary: binary?.slice(0, 1) ?? [],
|
|
40
|
-
});
|
|
41
|
-
// Restore archetypes
|
|
42
|
-
let binaryIndex = 1;
|
|
43
|
-
for (const serializedArchetype of serializedArchetypes) {
|
|
44
|
-
const { id, components, rowCount, columns } = serializedArchetype;
|
|
45
|
-
// Ensure the archetype exists
|
|
46
|
-
const archetype = core.ensureArchetype(components);
|
|
47
|
-
// Restore the table data
|
|
48
|
-
if (binary && binary[binaryIndex]) {
|
|
49
|
-
// For now, we'll need to access the internal table structure
|
|
50
|
-
// This is a simplified approach - in a real implementation you'd need
|
|
51
|
-
// to properly restore the typed buffers for each column
|
|
52
|
-
const tableData = binary[binaryIndex];
|
|
53
|
-
// TODO: Implement proper table restoration
|
|
54
|
-
binaryIndex++;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
// Each resource will be stored as the only entity in an archetype of [id, <resourceName>]
|
|
58
|
-
// The resource component we added above will contain the resource value
|
|
59
|
-
for (const [name, resourceSchema] of Object.entries(resourceSchemas)) {
|
|
60
|
-
const resourceId = name;
|
|
61
|
-
const archetype = core.ensureArchetype(["id", resourceId]);
|
|
62
|
-
archetype.insert({ [resourceId]: resourceSchema.default });
|
|
63
|
-
const row = 0;
|
|
64
|
-
Object.defineProperty(resources, name, {
|
|
65
|
-
get: () => archetype.columns[resourceId].get(row),
|
|
66
|
-
set: (value) => {
|
|
67
|
-
archetype.columns[resourceId].set(row, value);
|
|
68
|
-
},
|
|
69
|
-
enumerable: true,
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
const select = (include, options) => {
|
|
73
|
-
return selectEntities(core, include, options);
|
|
74
|
-
};
|
|
75
|
-
const archetypes = Object.fromEntries(Object.entries(archetypeComponentNames).map(([name, componentNames]) => {
|
|
76
|
-
const archetype = core.ensureArchetype(["id", ...componentNames]);
|
|
77
|
-
return [name, archetype];
|
|
78
|
-
}));
|
|
79
|
-
const store = {
|
|
80
|
-
...core,
|
|
81
|
-
resources,
|
|
82
|
-
select,
|
|
83
|
-
archetypes,
|
|
84
|
-
serialize: () => {
|
|
85
|
-
// This will be implemented in the createStore function
|
|
86
|
-
throw new Error("Serialization not implemented for restored store");
|
|
87
|
-
},
|
|
88
|
-
};
|
|
89
|
-
return store;
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=restore-store.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"restore-store.js","sourceRoot":"","sources":["../../../src/ecs/store/restore-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AAOX,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAMnD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,0DAA0D,CAAC;AAoBtG,MAAM,UAAU,Y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AS,CAAU,CAAC;IACtC,CAAC,CAAC,CACE,CAAC;IAET,MAAM,KAAK,GAAgB;QACvB,GAAG,IAAI;QACP,SAAS;QACT,MAAM;QACN,UAAU;QACV,SAAS,EAAE,GAAmB,EAAE;YAC5B,uDAAuD;YACvD,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACxE,CAAC;KACJ,CAAC;IAEF,OAAO,KAAY,CAAC;AACxB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export {};
|
|
2
|
-
// export type SelectOptions<C extends object, T extends object> = {
|
|
3
|
-
// /**
|
|
4
|
-
// * Components that the entities must not have.
|
|
5
|
-
// */
|
|
6
|
-
// without?: keyof C[];
|
|
7
|
-
// /**
|
|
8
|
-
// * Filter the results by the given condition using a declarative where clause.
|
|
9
|
-
// */
|
|
10
|
-
// where?: Filter<T>;
|
|
11
|
-
// /**
|
|
12
|
-
// * Order results by the given components ascending or descending.
|
|
13
|
-
// */
|
|
14
|
-
// order?: OrderClause<T>;
|
|
15
|
-
// }
|
|
16
|
-
//# sourceMappingURL=select-options.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"select-options.js","sourceRoot":"","sources":["../../../src/ecs/store/select-options.ts"],"names":[],"mappings":";AAIA,oEAAoE;AACpE,UAAU;AACV,qDAAqD;AACrD,UAAU;AACV,2BAA2B;AAC3B,UAAU;AACV,qFAAqF;AACrF,UAAU;AACV,yBAAyB;AACzB,UAAU;AACV,wEAAwE;AACxE,UAAU;AACV,8BAA8B;AAC9B,IAAI"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { StringKeyof } from "../../types/types.js";
|
|
2
|
-
import { CoreComponents } from "../core-components.js";
|
|
3
|
-
/**
|
|
4
|
-
* Comparison operators for declarative where clauses
|
|
5
|
-
*/
|
|
6
|
-
type ComparisonOperator = "==" | "!=" | "<" | ">" | ">=" | "<=";
|
|
7
|
-
/**
|
|
8
|
-
* Represents a comparison operation in a declarative where clause
|
|
9
|
-
*/
|
|
10
|
-
type ComparisonOperation<T> = {
|
|
11
|
-
[P in ComparisonOperator]?: T;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Represents a condition that can be either a direct value, comparison operation, or nested conditions
|
|
15
|
-
*/
|
|
16
|
-
type WhereCondition<T> = T extends object ? {
|
|
17
|
-
[K in keyof T]?: WhereCondition<T[K]>;
|
|
18
|
-
} | ComparisonOperation<T> : T | ComparisonOperation<T>;
|
|
19
|
-
/**
|
|
20
|
-
* Declarative where clause structure that allows for JSON-based filtering
|
|
21
|
-
* Each key in the object represents a component field to filter on
|
|
22
|
-
* The value can either be a direct value (equality check), a comparison operation, or nested conditions
|
|
23
|
-
*/
|
|
24
|
-
export type WhereClause<T extends CoreComponents> = {
|
|
25
|
-
[K in keyof T]?: WhereCondition<T[K]>;
|
|
26
|
-
};
|
|
27
|
-
type OrderClause<T extends CoreComponents> = {
|
|
28
|
-
[K in keyof T]?: boolean;
|
|
29
|
-
};
|
|
30
|
-
export type SelectOptions<C extends CoreComponents, T extends CoreComponents> = {
|
|
31
|
-
/**
|
|
32
|
-
* Components that the entities must not have.
|
|
33
|
-
*/
|
|
34
|
-
without?: StringKeyof<C>[];
|
|
35
|
-
/**
|
|
36
|
-
* Filter the results by the given condition using a declarative where clause.
|
|
37
|
-
*/
|
|
38
|
-
where?: WhereClause<T>;
|
|
39
|
-
/**
|
|
40
|
-
* Order results by the given components ascending or descending.
|
|
41
|
-
*/
|
|
42
|
-
order?: OrderClause<T>;
|
|
43
|
-
};
|
|
44
|
-
export {};
|
package/dist/ecs/store/select.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../../src/ecs/store/select.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ecs/transaction-ecs/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AACX,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ECS, ECSArchetypes, ECSComponents, ECSResources } from "../ecs/ecs-types.js";
|
|
2
|
-
import { TransactionECS } from "./transaction-types.js";
|
|
3
|
-
/**
|
|
4
|
-
* Creates a new TransactionECS.
|
|
5
|
-
* Transactional ECS instances do not allow direct write access.
|
|
6
|
-
* Instead you use transactions to make changes to the ECS.
|
|
7
|
-
* They also provide observability for changes to the ECS.
|
|
8
|
-
*/
|
|
9
|
-
export declare function createTransactionECS<C extends ECSComponents, // name => Component Value Type
|
|
10
|
-
A extends ECSArchetypes, // name => Entity Values Type
|
|
11
|
-
R extends ECSResources>(ecs?: ECS<C, A, R>): TransactionECS<C, A, R>;
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import { createECS } from "../ecs/ecs.js";
|
|
2
|
-
import { createECSTransaction } from "./transactions.js";
|
|
3
|
-
import { arrayEquals } from "../../core/functions/array-equals.js";
|
|
4
|
-
// we want to cache this a well on each array.
|
|
5
|
-
function isASubsetOfB(a, b) {
|
|
6
|
-
if (a !== b) {
|
|
7
|
-
const bSet = new Set(b);
|
|
8
|
-
for (const value of a) {
|
|
9
|
-
if (!bSet.has(value)) {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Creates a new TransactionECS.
|
|
18
|
-
* Transactional ECS instances do not allow direct write access.
|
|
19
|
-
* Instead you use transactions to make changes to the ECS.
|
|
20
|
-
* They also provide observability for changes to the ECS.
|
|
21
|
-
*/
|
|
22
|
-
export function createTransactionECS(ecs = createECS()) {
|
|
23
|
-
const { components, archetypes, resources, ...rest } = ecs;
|
|
24
|
-
const withComponents = (newComponents) => {
|
|
25
|
-
ecs.withComponents(newComponents);
|
|
26
|
-
return tecs;
|
|
27
|
-
};
|
|
28
|
-
const withArchetypes = (newArchetypes) => {
|
|
29
|
-
ecs.withArchetypes(newArchetypes);
|
|
30
|
-
return tecs;
|
|
31
|
-
};
|
|
32
|
-
const withResources = (newResources) => {
|
|
33
|
-
ecs.withResources(newResources);
|
|
34
|
-
return tecs;
|
|
35
|
-
};
|
|
36
|
-
const transactionObservers = new Set();
|
|
37
|
-
const notifyTransactions = (transaction, changed) => {
|
|
38
|
-
// notify all transaction observers.
|
|
39
|
-
for (const observer of transactionObservers) {
|
|
40
|
-
observer(transaction);
|
|
41
|
-
}
|
|
42
|
-
// notify all observers of the entities and components that changed.
|
|
43
|
-
const observers = new Set();
|
|
44
|
-
const addObservers = (map, key) => {
|
|
45
|
-
const set = map.get(key);
|
|
46
|
-
if (set) {
|
|
47
|
-
for (const observer of set) {
|
|
48
|
-
observers.add(observer);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
for (const entity of changed.entities) {
|
|
53
|
-
addObservers(entityObservers, entity);
|
|
54
|
-
}
|
|
55
|
-
for (const name of changed.components) {
|
|
56
|
-
addObservers(componentObservers, name);
|
|
57
|
-
}
|
|
58
|
-
for (const archetype of changed.archetypes) {
|
|
59
|
-
for (const observedArchetype of archetypeObservers.keys()) {
|
|
60
|
-
const isSubset = isASubsetOfB(observedArchetype.components, archetype.components);
|
|
61
|
-
if (isSubset) {
|
|
62
|
-
addObservers(archetypeObservers, observedArchetype);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
for (const observer of observers) {
|
|
67
|
-
observer();
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
const transactions = (callback) => {
|
|
71
|
-
transactionObservers.add(callback);
|
|
72
|
-
return () => transactionObservers.delete(callback);
|
|
73
|
-
};
|
|
74
|
-
const createTransaction = (options) => {
|
|
75
|
-
return createECSTransaction(tecs, ecs, { undoable: true, createdTime: Date.now(), createdBy: "", ...options }, notifyTransactions);
|
|
76
|
-
};
|
|
77
|
-
const addToMapSet = (key, map, value) => {
|
|
78
|
-
let set = map.get(key);
|
|
79
|
-
if (set) {
|
|
80
|
-
set.add(value);
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
map.set(key, (set = new Set([value])));
|
|
84
|
-
}
|
|
85
|
-
return () => {
|
|
86
|
-
set.delete(value);
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
const entityObservers = new Map();
|
|
90
|
-
const observeEntityChanges = (entity) => (callback) => {
|
|
91
|
-
return addToMapSet(entity, entityObservers, callback);
|
|
92
|
-
};
|
|
93
|
-
function observeEntityValues(id, archetype) {
|
|
94
|
-
return (callback) => {
|
|
95
|
-
const notify = () => {
|
|
96
|
-
callback(ecs.getEntityValues(id, archetype));
|
|
97
|
-
};
|
|
98
|
-
// callback immediately to get the current value.
|
|
99
|
-
notify();
|
|
100
|
-
// callback again whenever the entity changes.
|
|
101
|
-
const entityChanges = observeEntityChanges(id);
|
|
102
|
-
return entityChanges(notify);
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
const componentObservers = new Map();
|
|
106
|
-
const resourceObservables = new Map();
|
|
107
|
-
const observeResource = (key) => {
|
|
108
|
-
// Return cached observable if it exists
|
|
109
|
-
const cached = resourceObservables.get(key);
|
|
110
|
-
if (cached) {
|
|
111
|
-
return cached;
|
|
112
|
-
}
|
|
113
|
-
// Create new observable
|
|
114
|
-
const observable = (callback) => {
|
|
115
|
-
const notify = () => {
|
|
116
|
-
callback(resources[key]);
|
|
117
|
-
};
|
|
118
|
-
// callback immediately to get the current value.
|
|
119
|
-
notify();
|
|
120
|
-
// callback again whenever the resource changes.
|
|
121
|
-
const resourceChanges = observeComponent(key);
|
|
122
|
-
return resourceChanges(notify);
|
|
123
|
-
};
|
|
124
|
-
// Cache the observable
|
|
125
|
-
resourceObservables.set(key, observable);
|
|
126
|
-
return observable;
|
|
127
|
-
};
|
|
128
|
-
const observeComponent = (component) => (callback) => {
|
|
129
|
-
return addToMapSet(component, componentObservers, callback);
|
|
130
|
-
};
|
|
131
|
-
const archetypeObservers = new Map();
|
|
132
|
-
const observeArchetypeChanges = (archetype) => (callback) => {
|
|
133
|
-
return addToMapSet(archetype, archetypeObservers, callback);
|
|
134
|
-
};
|
|
135
|
-
const observeArchetypeEntities = (archetype, options) => {
|
|
136
|
-
return (callback) => {
|
|
137
|
-
let lastValue;
|
|
138
|
-
const notify = () => {
|
|
139
|
-
const newValue = ecs.selectEntities(archetype, options);
|
|
140
|
-
if (!lastValue || !arrayEquals(lastValue, newValue)) {
|
|
141
|
-
lastValue = newValue;
|
|
142
|
-
callback(newValue);
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
notify();
|
|
146
|
-
return observeArchetypeChanges(archetype)(notify);
|
|
147
|
-
};
|
|
148
|
-
};
|
|
149
|
-
const createResourceObserver = () => {
|
|
150
|
-
const handler = {
|
|
151
|
-
get(target, prop) {
|
|
152
|
-
if (typeof prop === 'string' && prop in resources) {
|
|
153
|
-
return observeResource(prop);
|
|
154
|
-
}
|
|
155
|
-
return target[prop];
|
|
156
|
-
},
|
|
157
|
-
apply(target, thisArg, args) {
|
|
158
|
-
return target.apply(thisArg, args);
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
return new Proxy(observeResource, handler);
|
|
162
|
-
};
|
|
163
|
-
const tecs = {
|
|
164
|
-
...rest,
|
|
165
|
-
withComponents,
|
|
166
|
-
withArchetypes,
|
|
167
|
-
withResources,
|
|
168
|
-
createTransaction,
|
|
169
|
-
observe: {
|
|
170
|
-
transactions,
|
|
171
|
-
resource: createResourceObserver(),
|
|
172
|
-
entityValues: observeEntityValues,
|
|
173
|
-
entityChanges: observeEntityChanges,
|
|
174
|
-
componentChanges: observeComponent,
|
|
175
|
-
archetypeChanges: observeArchetypeChanges,
|
|
176
|
-
archetypeEntities: observeArchetypeEntities,
|
|
177
|
-
},
|
|
178
|
-
components,
|
|
179
|
-
archetypes,
|
|
180
|
-
resources,
|
|
181
|
-
};
|
|
182
|
-
return tecs;
|
|
183
|
-
}
|
|
184
|
-
//# sourceMappingURL=transaction-ecs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-ecs.js","sourceRoot":"","sources":["../../../src/ecs/transaction-ecs/transaction-ecs.ts"],"names":[],"mappings":"AA8BA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAa1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAEnE,+CAA+C;AAC/C,SAAS,YAAY,CAAC,CAAiB,EAAE,CAAiB;IACxD,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACZ,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;QACxB,KAAK,MAAM,KAAK,IAAI,CAAC,EAAE,CAAC;YACtB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBACrB,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAIlC,MAAoB,SAAS,EAAE;IAC/B,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,GAAG,CAAC;IAC3D,MAAM,cAAc,GAAG,CAIrB,aAAgB,EACX,EAAE;QACP,GAAG,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;QAClC,OAAO,IAAW,CAAC;IACrB,CAAC,CAAC;IACF,MAAM,cAAc,GAAG,CACrB,aAAgB,EACX,EAAE;QACP,GAAG,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;QAClC,OAAO,IAAW,CAAC;IACrB,CAAC,CAAC;IACF,MAA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