@adobe/data 0.4.3 → 0.4.5
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.d.ts +4 -4
- package/dist/ecs/database/database-schema/create-database-schema.js.map +1 -1
- package/dist/ecs/database/database-schema/database-schema.d.ts +1 -1
- package/dist/ecs/database/database.d.ts +1 -1
- package/dist/ecs/index.d.ts +1 -0
- package/dist/ecs/index.js +1 -0
- package/dist/ecs/index.js.map +1 -1
- package/dist/ecs/persistence-service/create-storage-persistence-service.d.ts +9 -0
- package/dist/{core/data.js → ecs/persistence-service/create-storage-persistence-service.js} +26 -29
- package/dist/ecs/persistence-service/create-storage-persistence-service.js.map +1 -0
- package/dist/ecs/persistence-service/index.d.ts +2 -0
- package/dist/ecs/{action-ecs → persistence-service}/index.js +2 -1
- package/dist/ecs/persistence-service/index.js.map +1 -0
- package/dist/ecs/persistence-service/persistence-service.d.ts +2 -6
- package/dist/ecs/persistence-service/persistence-service.js +0 -21
- package/dist/ecs/persistence-service/persistence-service.js.map +1 -1
- 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/schema/validation/is-valid.test.js → functions/serialization.test.js} +20 -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/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 +0 -33
- 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 +0 -29
- package/dist/cache/functions/omit.js.map +0 -1
- package/dist/cache/functions/types.d.ts +0 -1
- package/dist/cache/functions/types.js +0 -23
- package/dist/cache/functions/types.js.map +0 -1
- package/dist/core/data.d.ts +0 -22
- 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.d.ts +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 +0 -25
- 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 +0 -25
- 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 +0 -38
- package/dist/core/functions/with-validation.js.map +0 -1
- package/dist/core/functions/with-validation.test.d.ts +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 +0 -25
- 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.d.ts +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 +0 -23
- 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 +0 -23
- 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/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 +0 -24
- 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 → functions/serialization.test.d.ts} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"register-database-codec.js","sourceRoot":"","sources":["../../../src/ecs/entity-location-table/register-database-codec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AAEX,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAGvE,MAAM,UAAU,wBAAwB;IACpC,aAAa,CAAW;QACpB,IAAI,EAAE,cAAc;QACpB,SAAS,EAAE,CAAC,KAAc,EAAqB,EAAE,CAAC,KAAK;QACvD,SAAS,EAAE,CAAC,IAAc,EAAE,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QAC3C,CAAC;QACD,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAwC,EAAE,EAAE;YACpE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QAC3C,CAAC;KACJ,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function registerEntityLocationTableCodec(): void;
|
|
@@ -1,42 +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
|
-
import { restoreEntityLocationTable } from "./create-entity-location-table.js";
|
|
24
|
-
function isEntityLocationTable(value) {
|
|
25
|
-
return value !== null && typeof value === "object" && "create" in value && "update" in value && "delete" in value && "locate" in value && "serialize" in value;
|
|
26
|
-
}
|
|
27
|
-
export function registerEntityLocationTableCodec() {
|
|
28
|
-
registerCodec({
|
|
29
|
-
name: "entity-location-table",
|
|
30
|
-
predicate: isEntityLocationTable,
|
|
31
|
-
serialize: (data) => {
|
|
32
|
-
return data.serialize();
|
|
33
|
-
},
|
|
34
|
-
deserialize: ({ json, binary }) => {
|
|
35
|
-
return restoreEntityLocationTable({
|
|
36
|
-
json: json ?? {},
|
|
37
|
-
binary: binary ?? []
|
|
38
|
-
});
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=register-entity-location-table-codec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"register-entity-location-table-codec.js","sourceRoot":"","sources":["../../../src/ecs/entity-location-table/register-entity-location-table-codec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AAEX,OAAO,EAAkB,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAG/E,SAAS,qBAAqB,CAAC,KAAc;IACzC,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,QAAQ,IAAI,KAAK,IAAI,QAAQ,IAAI,KAAK,IAAI,QAAQ,IAAI,KAAK,IAAI,QAAQ,IAAI,KAAK,IAAI,WAAW,IAAI,KAAK,CAAC;AACnK,CAAC;AAED,MAAM,UAAU,gCAAgC;IAC5C,aAAa,CAAsB;QAC/B,IAAI,EAAE,uBAAuB;QAC7B,SAAS,EAAE,qBAAqB;QAChC,SAAS,EAAE,CAAC,IAAyB,EAAE,EAAE;YACrC,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC;QAC5B,CAAC;QACD,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAkB,EAAE,EAAE;YAC9C,OAAO,0BAA0B,CAAC;gBAC9B,IAAI,EAAE,IAAI,IAAI,EAAE;gBAChB,MAAM,EAAE,MAAM,IAAI,EAAE;aACvB,CAAC,CAAC;QACP,CAAC;KACJ,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { createEntityLocationTable } from "./create-entity-location-table.js";
|
|
3
|
-
import { getCodec } from "../../functions/serialization/codec.js";
|
|
4
|
-
describe("EntityLocationTable Codec", () => {
|
|
5
|
-
it("should serialize and deserialize EntityLocationTable correctly", () => {
|
|
6
|
-
// Create a table and add some entities
|
|
7
|
-
const table = createEntityLocationTable(4);
|
|
8
|
-
const entity1 = table.create({ archetype: 1, row: 10 });
|
|
9
|
-
const entity2 = table.create({ archetype: 2, row: 20 });
|
|
10
|
-
const entity3 = table.create({ archetype: 3, row: 30 });
|
|
11
|
-
// Update an entity
|
|
12
|
-
table.update(entity2, { archetype: 5, row: 25 });
|
|
13
|
-
// Delete an entity
|
|
14
|
-
table.delete(entity1);
|
|
15
|
-
// Get the codec
|
|
16
|
-
const codec = getCodec("entity-location-table");
|
|
17
|
-
expect(codec).not.toBeNull();
|
|
18
|
-
// Verify predicate works
|
|
19
|
-
expect(codec.predicate(table)).toBe(true);
|
|
20
|
-
expect(codec.predicate({})).toBe(false);
|
|
21
|
-
expect(codec.predicate(null)).toBe(false);
|
|
22
|
-
// Serialize
|
|
23
|
-
const serialized = codec.serialize(table);
|
|
24
|
-
expect(serialized.json).toBeDefined();
|
|
25
|
-
expect(serialized.binary).toBeDefined();
|
|
26
|
-
expect(serialized.binary.length).toBeGreaterThan(0);
|
|
27
|
-
// Deserialize
|
|
28
|
-
const restored = codec.deserialize(serialized);
|
|
29
|
-
expect(restored).toBeDefined();
|
|
30
|
-
// Verify the restored table has the same behavior
|
|
31
|
-
expect(restored.locate(entity1)).toBeNull(); // Deleted entity
|
|
32
|
-
expect(restored.locate(entity2)).toEqual({ archetype: 5, row: 25 }); // Updated entity
|
|
33
|
-
expect(restored.locate(entity3)).toEqual({ archetype: 3, row: 30 }); // Unchanged entity
|
|
34
|
-
// Verify we can still create new entities
|
|
35
|
-
const newEntity = restored.create({ archetype: 4, row: 40 });
|
|
36
|
-
expect(restored.locate(newEntity)).toEqual({ archetype: 4, row: 40 });
|
|
37
|
-
});
|
|
38
|
-
it("should handle empty table", () => {
|
|
39
|
-
const table = createEntityLocationTable();
|
|
40
|
-
const codec = getCodec("entity-location-table");
|
|
41
|
-
const serialized = codec.serialize(table);
|
|
42
|
-
const restored = codec.deserialize(serialized);
|
|
43
|
-
// Verify we can create entities in the restored table
|
|
44
|
-
const entity = restored.create({ archetype: 1, row: 10 });
|
|
45
|
-
expect(restored.locate(entity)).toEqual({ archetype: 1, row: 10 });
|
|
46
|
-
});
|
|
47
|
-
it("should preserve free list after delete operations", () => {
|
|
48
|
-
const table = createEntityLocationTable(4);
|
|
49
|
-
// Create and delete entities to build up free list
|
|
50
|
-
const entity1 = table.create({ archetype: 1, row: 10 });
|
|
51
|
-
const entity2 = table.create({ archetype: 2, row: 20 });
|
|
52
|
-
const entity3 = table.create({ archetype: 3, row: 30 });
|
|
53
|
-
table.delete(entity2);
|
|
54
|
-
table.delete(entity1);
|
|
55
|
-
const codec = getCodec("entity-location-table");
|
|
56
|
-
const serialized = codec.serialize(table);
|
|
57
|
-
const restored = codec.deserialize(serialized);
|
|
58
|
-
// Verify free list is preserved by checking that deleted entities are still null
|
|
59
|
-
expect(restored.locate(entity1)).toBeNull();
|
|
60
|
-
expect(restored.locate(entity2)).toBeNull();
|
|
61
|
-
expect(restored.locate(entity3)).toEqual({ archetype: 3, row: 30 });
|
|
62
|
-
// Verify we can reuse freed slots
|
|
63
|
-
const newEntity1 = restored.create({ archetype: 4, row: 40 });
|
|
64
|
-
const newEntity2 = restored.create({ archetype: 5, row: 50 });
|
|
65
|
-
// The new entities should reuse the freed slots
|
|
66
|
-
expect(newEntity1).toBe(entity1);
|
|
67
|
-
expect(newEntity2).toBe(entity2);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
//# sourceMappingURL=register-entity-location-table-codec.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"register-entity-location-table-codec.test.js","sourceRoot":"","sources":["../../../src/ecs/entity-location-table/register-entity-location-table-codec.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAElE,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACvC,EAAE,CAAC,gEAAgE,EAAE,GAAG,EAAE;QACtE,uCAAuC;QACvC,MAAM,KAAK,GAAG,yBAAyB,CAAC,CAAC,CAAC,CAAC;QAC3C,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;QACxD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;QACxD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;QAExD,mBAAmB;QACnB,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;QAEjD,mBAAmB;QACnB,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAEtB,gBAAgB;QAChB,MAAM,KAAK,GAAG,QAAQ,CAAC,uBAAuB,CAAC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@@
|
|
|
1
|
-
import { Database } from "../database/database.js";
|
|
2
|
-
import { PersistenceFileId, PersistenceService } from "./persistence-service.js";
|
|
3
|
-
export declare const createPersistenceService: (options: {
|
|
4
|
-
database: Database;
|
|
5
|
-
autoSave?: PersistenceFileId;
|
|
6
|
-
}) => PersistenceService;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { createObservableState } from "../../observe/create-observable-state.js";
|
|
2
|
-
export const createPersistenceService = (options) => {
|
|
3
|
-
const { database, autoSave } = options;
|
|
4
|
-
const [status, setStatus] = createObservableState(null);
|
|
5
|
-
const service = {
|
|
6
|
-
serviceName: "persistence-service",
|
|
7
|
-
status,
|
|
8
|
-
save: async (id) => {
|
|
9
|
-
setStatus("saving");
|
|
10
|
-
},
|
|
11
|
-
load: async (id) => {
|
|
12
|
-
setStatus("loading");
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
if (autoSave) {
|
|
16
|
-
database.observe.transactions(t => {
|
|
17
|
-
if (!t.transient) {
|
|
18
|
-
service.save(autoSave);
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
return service;
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=create-persistence-service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-persistence-service.js","sourceRoot":"","sources":["../../../src/ecs/persistence-service/create-persistence-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAIjF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACpC,OAGC,EACiB,EAAE;IACpB,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAEvC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,qBAAqB,CAAoB,IAAI,CAAC,CAAC;IAE3E,MAAM,OAAO,GAAG;QACZ,WAAW,EAAE,qBAAqB;QAClC,MAAM;QACN,IAAI,EAAE,KAAK,EAAE,EAAqB,EAAE,EAAE;YAClC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACxB,CAAC;QACD,IAAI,EAAE,KAAK,EAAE,EAAqB,EAAE,EAAE;YAClC,SAAS,CAAC,SAAS,CAAC,CAAC;QACzB,CAAC;KACJ,CAAA;IAED,IAAI,QAAQ,EAAE,CAAC;QACX,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE;YAC9B,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;gBACf,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC3B,CAAC;QACL,CAAC,CAAC,CAAA;IACN,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"to-blob-refs.js","sourceRoot":"","sources":["../../../src/ecs/persistence-service/to-blob-refs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,QAAkB,EAAE,EAAE;AAEjD,CAAC,CAAA"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Observe } from "../../observe/types.js";
|
|
2
|
-
import { TransactionResult } from "../database/transactional-store/transactional-store.js";
|
|
3
|
-
import { Service } from "../../service/service.js";
|
|
4
|
-
export interface UndoRedoService<C = unknown> extends Service {
|
|
5
|
-
undoStack: Observe<TransactionResult<C>[]>;
|
|
6
|
-
undoStackIndex: Observe<number>;
|
|
7
|
-
undo: () => void;
|
|
8
|
-
redo: () => void;
|
|
9
|
-
undoEnabled: Observe<boolean>;
|
|
10
|
-
redoEnabled: Observe<boolean>;
|
|
11
|
-
}
|
|
@@ -1,23 +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
|
-
export {};
|
|
23
|
-
//# sourceMappingURL=undo-redo-service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"undo-redo-service.js","sourceRoot":"","sources":["../../../src/ecs/persistence-service/undo-redo-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function registerCoreCodec(): void;
|
|
@@ -1,45 +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
|
-
import { deserialize } from "../../../functions/serialization/deserialize.js";
|
|
24
|
-
import { restoreCore } from "./create-core.js";
|
|
25
|
-
function isCore(value) {
|
|
26
|
-
return value !== null && typeof value === "object" && "__brand" in value && value.__brand === "core";
|
|
27
|
-
}
|
|
28
|
-
export function registerCoreCodec() {
|
|
29
|
-
registerCodec({
|
|
30
|
-
name: "core",
|
|
31
|
-
predicate: isCore,
|
|
32
|
-
serialize: (data) => {
|
|
33
|
-
return data.serialize();
|
|
34
|
-
},
|
|
35
|
-
deserialize: ({ json, binary }) => {
|
|
36
|
-
// Deserialize the Core's data to resolve nested encoded objects
|
|
37
|
-
const deserializedData = deserialize({
|
|
38
|
-
json: json ?? "{}",
|
|
39
|
-
binary: binary ?? []
|
|
40
|
-
});
|
|
41
|
-
return restoreCore(deserializedData);
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=register-core-codec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"register-core-codec.js","sourceRoot":"","sources":["../../../../src/ecs/store/core/register-core-codec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AAEX,OAAO,EAAkB,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAC;AAE9E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,SAAS,MAAM,CAAC,KAAc;IAC1B,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,SAAS,IAAI,KAAK,IAAI,KAAK,CAAC,OAAO,KAAK,MAAM,CAAC;AACzG,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC7B,aAAa,CAAY;QACrB,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,MAAM;QACjB,SAAS,EAAE,CAAC,IAAe,EAAE,EAAE;YAC3B,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC;QAC5B,CAAC;QACD,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAkB,EAAE,EAAE;YAC9C,gEAAgE;YAChE,MAAM,gBAAgB,GAAG,WAAW,CAAC;gBACjC,IAAI,EAAE,IAAI,IAAI,IAAI;gBAClB,MAAM,EAAE,MAAM,IAAI,EAAE;aACvB,CAAC,CAAC;YACH,OAAO,WAAW,CAAC,gBAAuB,CAAC,CAAC;QAChD,CAAC;KACJ,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { createCore } from "./create-core.js";
|
|
3
|
-
import { getCodec } from "../../../functions/serialization/codec.js";
|
|
4
|
-
import { F32Schema } from "../../../schema/f32.js";
|
|
5
|
-
// Test schemas
|
|
6
|
-
const positionSchema = {
|
|
7
|
-
type: "object",
|
|
8
|
-
properties: {
|
|
9
|
-
x: F32Schema,
|
|
10
|
-
y: F32Schema,
|
|
11
|
-
z: F32Schema,
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
const healthSchema = {
|
|
15
|
-
type: "object",
|
|
16
|
-
properties: {
|
|
17
|
-
current: F32Schema,
|
|
18
|
-
max: F32Schema,
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
describe("Core Codec", () => {
|
|
22
|
-
it("should serialize and deserialize Core correctly", () => {
|
|
23
|
-
// Create a core with components
|
|
24
|
-
const core = createCore({
|
|
25
|
-
position: positionSchema,
|
|
26
|
-
health: healthSchema,
|
|
27
|
-
});
|
|
28
|
-
// Create some entities and archetypes
|
|
29
|
-
const positionArchetype = core.ensureArchetype(["id", "position"]);
|
|
30
|
-
const entity1 = positionArchetype.insert({ position: { x: 1, y: 2, z: 3 } });
|
|
31
|
-
const healthArchetype = core.ensureArchetype(["id", "health"]);
|
|
32
|
-
const entity2 = healthArchetype.insert({ health: { current: 100, max: 100 } });
|
|
33
|
-
const fullArchetype = core.ensureArchetype(["id", "position", "health"]);
|
|
34
|
-
const entity3 = fullArchetype.insert({
|
|
35
|
-
position: { x: 0, y: 0, z: 0 },
|
|
36
|
-
health: { current: 50, max: 100 }
|
|
37
|
-
});
|
|
38
|
-
// Update an entity
|
|
39
|
-
core.update(entity1, { position: { x: 10, y: 20, z: 30 } });
|
|
40
|
-
// Delete an entity
|
|
41
|
-
core.delete(entity2);
|
|
42
|
-
// Get the codec
|
|
43
|
-
const codec = getCodec("core");
|
|
44
|
-
expect(codec).not.toBeNull();
|
|
45
|
-
// Verify predicate works
|
|
46
|
-
expect(codec.predicate(core)).toBe(true);
|
|
47
|
-
expect(codec.predicate({})).toBe(false);
|
|
48
|
-
expect(codec.predicate(null)).toBe(false);
|
|
49
|
-
// Serialize
|
|
50
|
-
const serialized = codec.serialize(core);
|
|
51
|
-
expect(serialized.json).toBeDefined();
|
|
52
|
-
expect(serialized.binary).toBeDefined();
|
|
53
|
-
expect(serialized.binary.length).toBeGreaterThan(0);
|
|
54
|
-
// Deserialize
|
|
55
|
-
const restored = codec.deserialize(serialized);
|
|
56
|
-
expect(restored).toBeDefined();
|
|
57
|
-
// Verify the restored core has the same behavior
|
|
58
|
-
expect(restored.locate(entity1)).not.toBeNull(); // Updated entity
|
|
59
|
-
expect(restored.locate(entity2)).toBeNull(); // Deleted entity
|
|
60
|
-
expect(restored.locate(entity3)).not.toBeNull(); // Unchanged entity
|
|
61
|
-
// Verify entity data is preserved
|
|
62
|
-
const entity1Data = restored.read(entity1);
|
|
63
|
-
expect(entity1Data?.position).toEqual({ x: 10, y: 20, z: 30 });
|
|
64
|
-
const entity3Data = restored.read(entity3);
|
|
65
|
-
expect(entity3Data?.position).toEqual({ x: 0, y: 0, z: 0 });
|
|
66
|
-
expect(entity3Data?.health).toEqual({ current: 50, max: 100 });
|
|
67
|
-
// Verify we can still create new entities
|
|
68
|
-
const newArchetype = restored.ensureArchetype(["id", "position"]);
|
|
69
|
-
const newEntity = newArchetype.insert({ position: { x: 100, y: 200, z: 300 } });
|
|
70
|
-
expect(restored.locate(newEntity)).not.toBeNull();
|
|
71
|
-
expect(restored.read(newEntity)?.position).toEqual({ x: 100, y: 200, z: 300 });
|
|
72
|
-
});
|
|
73
|
-
it("should handle empty core", () => {
|
|
74
|
-
const core = createCore({});
|
|
75
|
-
const codec = getCodec("core");
|
|
76
|
-
const serialized = codec.serialize(core);
|
|
77
|
-
const restored = codec.deserialize(serialized);
|
|
78
|
-
// Verify we can create entities in the restored core
|
|
79
|
-
const archetype = restored.ensureArchetype(["id"]);
|
|
80
|
-
const entity = archetype.insert({});
|
|
81
|
-
expect(restored.locate(entity)).not.toBeNull();
|
|
82
|
-
expect(restored.read(entity)?.id).toBe(entity);
|
|
83
|
-
});
|
|
84
|
-
it("should preserve archetype functionality", () => {
|
|
85
|
-
const core = createCore({
|
|
86
|
-
position: positionSchema,
|
|
87
|
-
health: healthSchema,
|
|
88
|
-
});
|
|
89
|
-
// Create multiple archetypes
|
|
90
|
-
const positionArchetype = core.ensureArchetype(["id", "position"]);
|
|
91
|
-
const healthArchetype = core.ensureArchetype(["id", "health"]);
|
|
92
|
-
const fullArchetype = core.ensureArchetype(["id", "position", "health"]);
|
|
93
|
-
// Create entities in each archetype
|
|
94
|
-
const positionEntity = positionArchetype.insert({ position: { x: 1, y: 2, z: 3 } });
|
|
95
|
-
const healthEntity = healthArchetype.insert({ health: { current: 100, max: 100 } });
|
|
96
|
-
const fullEntity = fullArchetype.insert({
|
|
97
|
-
position: { x: 0, y: 0, z: 0 },
|
|
98
|
-
health: { current: 50, max: 100 }
|
|
99
|
-
});
|
|
100
|
-
const codec = getCodec("core");
|
|
101
|
-
const serialized = codec.serialize(core);
|
|
102
|
-
const restored = codec.deserialize(serialized);
|
|
103
|
-
// Verify archetypes work correctly after restoration
|
|
104
|
-
const restoredPositionArchetype = restored.ensureArchetype(["id", "position"]);
|
|
105
|
-
const restoredHealthArchetype = restored.ensureArchetype(["id", "health"]);
|
|
106
|
-
const restoredFullArchetype = restored.ensureArchetype(["id", "position", "health"]);
|
|
107
|
-
// Verify entities are still accessible
|
|
108
|
-
expect(restored.locate(positionEntity)).not.toBeNull();
|
|
109
|
-
expect(restored.locate(healthEntity)).not.toBeNull();
|
|
110
|
-
expect(restored.locate(fullEntity)).not.toBeNull();
|
|
111
|
-
// Verify we can create new entities in each archetype
|
|
112
|
-
const newPositionEntity = restoredPositionArchetype.insert({ position: { x: 10, y: 20, z: 30 } });
|
|
113
|
-
const newHealthEntity = restoredHealthArchetype.insert({ health: { current: 75, max: 100 } });
|
|
114
|
-
const newFullEntity = restoredFullArchetype.insert({
|
|
115
|
-
position: { x: 5, y: 5, z: 5 },
|
|
116
|
-
health: { current: 25, max: 100 }
|
|
117
|
-
});
|
|
118
|
-
expect(restored.locate(newPositionEntity)).not.toBeNull();
|
|
119
|
-
expect(restored.locate(newHealthEntity)).not.toBeNull();
|
|
120
|
-
expect(restored.locate(newFullEntity)).not.toBeNull();
|
|
121
|
-
});
|
|
122
|
-
it("should handle component schema preservation", () => {
|
|
123
|
-
const core = createCore({
|
|
124
|
-
position: positionSchema,
|
|
125
|
-
health: healthSchema,
|
|
126
|
-
});
|
|
127
|
-
const codec = getCodec("core");
|
|
128
|
-
const serialized = codec.serialize(core);
|
|
129
|
-
const restored = codec.deserialize(serialized);
|
|
130
|
-
// Verify component schemas are preserved
|
|
131
|
-
expect(restored.componentSchemas.position).toEqual(positionSchema);
|
|
132
|
-
expect(restored.componentSchemas.health).toEqual(healthSchema);
|
|
133
|
-
expect(restored.componentSchemas.id).toBeDefined();
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
//# sourceMappingURL=register-core-codec.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"register-core-codec.test.js","sourceRoot":"","sources":["../../../../src/ecs/store/core/register-core-codec.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGnD,eAAe;AACf,MAAM,cAAc,GAAG;IACnB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACR,CAAC,EAAE,SAAS;QACZ,CAAC,EAAE,SAAS;QACZ,CAAC,EAAE,SAAS;KACf;CACsB,CAAC;AAE5B,MAAM,YAAY,GAAG;IACjB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACR,OAAO,EAAE,SAAS;QAClB,GAAG,EAAE,SAAS;KACjB;CACsB,CAAC;AAE5B,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE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MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QACnE,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC/D,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IACvD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { CoreComponents } from "../core-components.js";
|
|
2
|
-
/**
|
|
3
|
-
* Comparison operators for declarative where clauses
|
|
4
|
-
*/
|
|
5
|
-
type ComparisonOperator = "==" | "!=" | "<" | ">" | ">=" | "<=";
|
|
6
|
-
/**
|
|
7
|
-
* Represents a comparison operation in a declarative where clause
|
|
8
|
-
*/
|
|
9
|
-
type ComparisonOperation<T> = {
|
|
10
|
-
[P in ComparisonOperator]?: T;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Represents a condition that can be either a direct value, comparison operation, or nested conditions
|
|
14
|
-
*/
|
|
15
|
-
type WhereCondition<T> = T extends object ? {
|
|
16
|
-
[K in keyof T]?: WhereCondition<T[K]>;
|
|
17
|
-
} | ComparisonOperation<T> : T | ComparisonOperation<T>;
|
|
18
|
-
/**
|
|
19
|
-
* Declarative where clause structure that allows for JSON-based filtering
|
|
20
|
-
* Each key in the object represents a component field to filter on
|
|
21
|
-
* The value can either be a direct value (equality check), a comparison operation, or nested conditions
|
|
22
|
-
*/
|
|
23
|
-
export type WhereClause<T extends CoreComponents> = {
|
|
24
|
-
[K in keyof T]?: WhereCondition<T[K]>;
|
|
25
|
-
};
|
|
26
|
-
type OrderClause<T extends CoreComponents> = {
|
|
27
|
-
[K in keyof T]?: boolean;
|
|
28
|
-
};
|
|
29
|
-
export type Select<C extends CoreComponents, T extends CoreComponents> = {
|
|
30
|
-
/**
|
|
31
|
-
* Components that the entities must have.
|
|
32
|
-
*/
|
|
33
|
-
components: (keyof T)[];
|
|
34
|
-
/**
|
|
35
|
-
* Components that the entities must not have.
|
|
36
|
-
*/
|
|
37
|
-
without?: (keyof C)[];
|
|
38
|
-
/**
|
|
39
|
-
* Filter the results by the given condition using a declarative where clause.
|
|
40
|
-
*/
|
|
41
|
-
where?: WhereClause<T>;
|
|
42
|
-
/**
|
|
43
|
-
* Order results by the given components ascending or descending.
|
|
44
|
-
*/
|
|
45
|
-
order?: OrderClause<T>;
|
|
46
|
-
};
|
|
47
|
-
export {};
|
package/dist/ecs/store/query.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../src/ecs/store/query.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function registerCoreCodec(): void;
|
|
@@ -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 registerCoreCodec() {
|
|
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-core-codec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"register-core-codec.js","sourceRoot":"","sources":["../../../src/ecs/store/register-core-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,iBAAiB;IAC7B,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 +0,0 @@
|
|
|
1
|
-
export declare function registerStoreCodec(): void;
|
|
@@ -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>;
|