@adobe/data 0.5.1 → 0.5.3
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/blob/blob-handle.d.ts +29 -0
- package/dist/blob/blob-handle.js +11 -0
- package/dist/blob/blob-handle.js.map +1 -0
- package/dist/blob/blob-meta.d.ts +23 -0
- package/dist/blob/blob-meta.js +12 -0
- package/dist/blob/blob-meta.js.map +1 -0
- package/dist/blob/download-handle.d.ts +4 -0
- package/dist/blob/download-handle.js +2 -0
- package/dist/blob/download-handle.js.map +1 -0
- package/dist/blob/index.d.ts +4 -0
- package/dist/blob/index.js +5 -0
- package/dist/blob/index.js.map +1 -0
- package/dist/blob/upload-handle.d.ts +4 -0
- package/dist/blob/upload-handle.js +2 -0
- package/dist/blob/upload-handle.js.map +1 -0
- package/dist/ecs/store/create-store.test.js +13 -0
- package/dist/ecs/store/create-store.test.js.map +1 -1
- package/dist/schema/schema.d.ts +8 -12
- package/dist/schema/schema.js.map +1 -1
- package/dist/service/is-service.js +1 -2
- package/dist/service/is-service.js.map +1 -1
- package/dist/service/progressive-result.d.ts +5 -6
- package/dist/service/progressive-result.js.map +1 -1
- package/dist/services/add-observable-actions.d.ts +29 -0
- package/dist/services/add-observable-actions.js +108 -0
- package/dist/services/add-observable-actions.js.map +1 -0
- package/dist/services/index.d.ts +4 -0
- package/dist/{core → services}/index.js +3 -3
- package/dist/services/index.js.map +1 -0
- package/dist/services/is-service.d.ts +2 -0
- package/dist/{cache/functions/omit.js → services/is-service.js} +3 -7
- package/dist/services/is-service.js.map +1 -0
- package/dist/services/progressive-result.d.ts +96 -0
- package/dist/services/progressive-result.js +99 -0
- package/dist/services/progressive-result.js.map +1 -0
- package/dist/services/service.d.ts +4 -0
- package/dist/{cache/functions/types.js → services/service.js} +1 -1
- package/dist/services/service.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/typed-buffer/structs/get-struct-layout.js +3 -3
- package/dist/typed-buffer/structs/get-struct-layout.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/replace.d.ts +7 -0
- package/dist/types/replace.js +5 -0
- package/dist/types/replace.js.map +1 -0
- package/package.json +8 -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.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.d.ts +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.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 +0 -40
- 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 +0 -23
- 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/database-schema/create-database-schema-test.d.ts +0 -1
- package/dist/ecs/database/database-schema/create-database-schema-test.js +0 -42
- package/dist/ecs/database/database-schema/create-database-schema-test.js.map +0 -1
- package/dist/ecs/database/database-schema/create-database-schema.d.ts +0 -12
- package/dist/ecs/database/database-schema/create-database-schema.js +0 -26
- package/dist/ecs/database/database-schema/create-database-schema.js.map +0 -1
- package/dist/ecs/database/database-schema/database-schema.d.ts +0 -15
- package/dist/ecs/database/database-schema/database-schema.js +0 -23
- package/dist/ecs/database/database-schema/database-schema.js.map +0 -1
- package/dist/ecs/database/database-schema/index.d.ts +0 -2
- package/dist/ecs/database/database-schema/index.js +0 -24
- package/dist/ecs/database/database-schema/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/create-test-transaction.d.ts +0 -7
- package/dist/ecs/database/transactional-store/create-test-transaction.js +0 -7
- package/dist/ecs/database/transactional-store/create-test-transaction.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/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 +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/create-undo-redo-actions.d.ts +0 -10
- package/dist/ecs/undo-redo/create-undo-redo-actions.js +0 -69
- package/dist/ecs/undo-redo/create-undo-redo-actions.js.map +0 -1
- package/dist/ecs/undo-redo/create-undo-redo-actions.test.d.ts +0 -1
- package/dist/ecs/undo-redo/create-undo-redo-actions.test.js +0 -295
- package/dist/ecs/undo-redo/create-undo-redo-actions.test.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/deserialize.d.ts +0 -1
- package/dist/functions/serialization/deserialize.js +0 -2
- package/dist/functions/serialization/deserialize.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/internal/typed-array/typed-array-constructer.d.ts +0 -7
- package/dist/internal/typed-array/typed-array-constructer.js +0 -2
- package/dist/internal/typed-array/typed-array-constructer.js.map +0 -1
- package/dist/internal/typed-array/typed-array.d.ts +0 -1
- package/dist/internal/typed-array/typed-array.js +0 -23
- package/dist/internal/typed-array/typed-array.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
|
@@ -103,13 +103,13 @@ const getStructLayoutInternal = memoizeFactory((schema) => {
|
|
|
103
103
|
// Handle root array/tuple case
|
|
104
104
|
if (schema.type === "array") {
|
|
105
105
|
if (!schema.items || Array.isArray(schema.items)) {
|
|
106
|
-
|
|
106
|
+
return null;
|
|
107
107
|
}
|
|
108
108
|
if (schema.minItems !== schema.maxItems || !schema.minItems) {
|
|
109
|
-
|
|
109
|
+
return null;
|
|
110
110
|
}
|
|
111
111
|
if (schema.minItems < 1) {
|
|
112
|
-
|
|
112
|
+
return null;
|
|
113
113
|
}
|
|
114
114
|
// Special case for vec3
|
|
115
115
|
const primitiveType = getPrimitiveType(schema.items);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-struct-layout.js","sourceRoot":"","sources":["../../../src/typed-buffer/structs/get-struct-layout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AACX,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGhD,8BAA8B;AAC9B,MAAM,SAAS,GAAG,EAAE,CAAC,CAAE,gBAAgB;AAEvC;;;GAGG;AACH,MAAM,uBAAuB,GAAG,CAAC,IAA6C,EAAU,EAAE;IACtF,qCAAqC;IACrC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC3B,OAAO,CAAC,CAAC;IACb,CAAC;IACD,oDAAoD;IACpD,OAAO,SAAS,CAAC;AACrB,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,YAAY,GAAG,CAAC,IAA6C,EAAU,EAAE;IAC3E,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC3B,OAAO,CAAC,CAAC,CAAE,6BAA6B;IAC5C,CAAC;IACD,gDAAgD;IAChD,OAAO,IAAI,CAAC,IAAI,CAAC;AACrB,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,qBAAqB,GAAG,CAAC,IAA6C,EAAU,EAAE;IACpF,wCAAwC;IACxC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC3B,OAAO,CAAC,CAAC;IACb,CAAC;IACD,2CAA2C;IAC3C,OAAO,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,wBAAwB,GAAG,CAAC,IAA6C,EAAU,EAAE;IACvF,IAAI,OAAO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D,MAAM,SAAS,GAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC;QAErD,wCAAwC;QACxC,aAAa,GAAG,kBAAkB,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;QAC7D,MAAM,CAAC,IAAI,CAAC,GAAG;YACX,MAAM,EAAE,aAAa;YACrB,IAAI,EAAE,SAAS;SAClB,CAAC;QACF,aAAa,IAAI,YAAY,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC;IAED,mDAAmD;IACnD,MAAM,IAAI,GAAG,kBAAkB,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;IAC1D,OAAO;QACH,IAAI,EAAE,QAAQ;QACd,IAAI;QACJ,MAAM;KACT,CAAC;AACN,CAAC,CAAC,CAAC;AAKH,MAAM,UAAU,eAAe,CAAC,MAAc,EAAE,UAAU,GAAG,IAAI;IAC7D,MAAM,MAAM,GAAG,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAC/C,IAAI,MAAM,KAAK,IAAI,IAAI,UAAU,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AAEX,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AAEX,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Traverses T and for every item or property value of type Find, replaces it with type Replace.
|
|
3
|
+
* Example: Replace<{ a: { b: { c: string } } }, string, number> = { a: { b: { c: number } } }
|
|
4
|
+
*/
|
|
5
|
+
export type Replace<T, Find, Replacement> = T extends Find ? Replacement : T extends readonly (infer U)[] ? Replace<U, Find, Replacement>[] : T extends object ? {
|
|
6
|
+
[K in keyof T]: Replace<T[K], Find, Replacement>;
|
|
7
|
+
} : T;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replace.js","sourceRoot":"","sources":["../../src/types/replace.ts"],"names":[],"mappings":"AAkBA,mCAAmC;AACnC,CAAC;AAiED,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/data",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "Adobe data oriented programming library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": true,
|
|
@@ -30,6 +30,9 @@
|
|
|
30
30
|
"types": [
|
|
31
31
|
"./dist/types/index.d.ts"
|
|
32
32
|
],
|
|
33
|
+
"blob": [
|
|
34
|
+
"./dist/blob/index.d.ts"
|
|
35
|
+
],
|
|
33
36
|
"ecs": [
|
|
34
37
|
"./dist/ecs/index.d.ts"
|
|
35
38
|
],
|
|
@@ -59,6 +62,10 @@
|
|
|
59
62
|
"import": "./dist/functions/index.js",
|
|
60
63
|
"types": "./dist/functions/index.d.ts"
|
|
61
64
|
},
|
|
65
|
+
"./blob": {
|
|
66
|
+
"import": "./dist/blob/index.js",
|
|
67
|
+
"types": "./dist/blob/index.d.ts"
|
|
68
|
+
},
|
|
62
69
|
"./cache": {
|
|
63
70
|
"import": "./dist/cache/index.js",
|
|
64
71
|
"types": "./dist/cache/index.d.ts"
|
package/dist/README.md
DELETED
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
# @adobe/data
|
|
2
|
-
Adobe Data Oriented Programming Library
|
|
3
|
-
|
|
4
|
-
## Documentation
|
|
5
|
-
|
|
6
|
-
[Main Page](https://git.corp.adobe.com/pages/neuralfiltersplatform/firefly-data/docs/api/)
|
|
7
|
-
|
|
8
|
-
[ECS Performance Test](https://git.corp.adobe.com/pages/neuralfiltersplatform/firefly-data/docs/perftest.html)
|
|
9
|
-
|
|
10
|
-
## Breaking API Changes
|
|
11
|
-
|
|
12
|
-
Until we reach 1.0.0, minor version changes may be API breaking.
|
|
13
|
-
|
|
14
|
-
## Data
|
|
15
|
-
|
|
16
|
-
This library uses data oriented design paradigm and prefers pure functional interfaces whenever practical.
|
|
17
|
-
|
|
18
|
-
For our purposes, `Data` is immutable `JSON` (de)serializable objects and primitives.
|
|
19
|
-
|
|
20
|
-
### Why immutable Data?
|
|
21
|
-
|
|
22
|
-
We prefer Data because it is easy to:
|
|
23
|
-
- serialize
|
|
24
|
-
- deserialize
|
|
25
|
-
- inspect
|
|
26
|
-
- compare
|
|
27
|
-
- hash
|
|
28
|
-
- validate
|
|
29
|
-
|
|
30
|
-
We prefer immutable Data because it is easy to:
|
|
31
|
-
- reason about
|
|
32
|
-
- avoid side effects
|
|
33
|
-
- avoid defensive copying
|
|
34
|
-
- use for pure function arguments and return values
|
|
35
|
-
- use with concurrency
|
|
36
|
-
- memoize results
|
|
37
|
-
- use as cache key (stringified)
|
|
38
|
-
- use as cache value
|
|
39
|
-
|
|
40
|
-
### What is Data Oriented Design?
|
|
41
|
-
|
|
42
|
-
Sanders Mertens covers this thoroughly in his ECS FAQ:
|
|
43
|
-
|
|
44
|
-
[https://github.com/SanderMertens/ecs-faq?tab=readme-ov-file#what-is-data-oriented-design](https://github.com/SanderMertens/ecs-faq?tab=readme-ov-file#what-is-data-oriented-design)
|
|
45
|
-
|
|
46
|
-
### Data Schemas
|
|
47
|
-
|
|
48
|
-
When runtime type information is required we use `JSON Schema`. In order to avoid redundancy, we can use `FromSchema` to derive a typescript type at compile time.
|
|
49
|
-
|
|
50
|
-
Example:
|
|
51
|
-
|
|
52
|
-
```typescript
|
|
53
|
-
const Float32Schema = { type: "number", precision: 1 } as const satisfies Schema;
|
|
54
|
-
const Float32 = FromSchema<typeof Float32Schema>; // number
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
It is important that we use `as const` for the schema definition. Without that, the typeof Float32Schema would be `{ type: string, precision: number }` instead of `{ type: "number", precision: 1 }` and we would not be able to derive a correct type using `FromSchema`.
|
|
58
|
-
|
|
59
|
-
### Normalized Data
|
|
60
|
-
|
|
61
|
-
Data is considered "Normalized" when all object keys contained anywhere within it are alphabetically sorted. We include a `normalize` function which performs this conversion. This is particularly useful when you want to use data as a cache key.
|
|
62
|
-
|
|
63
|
-
```typescript
|
|
64
|
-
const notNormalized = { b: 2, a: 1 };
|
|
65
|
-
const normalized = normalize(notNormalized); // { a: 1, b: 2 }
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## Observables
|
|
69
|
-
|
|
70
|
-
An `Observable<T>` is a subscription function that you can pass a callback function to. Your callback function can accept a single argument of type `T`. The subscription function returns a dispose function that accepts no parameters and can be called at any point in the future to cancel your subscription.
|
|
71
|
-
|
|
72
|
-
Your callback function *may* be called back synchronously (before the initial call returns) zero or one times and asynchronously later any number of times.
|
|
73
|
-
|
|
74
|
-
For more information see the [Observable API documentation](./docs/api/modules/observe.html)
|
|
75
|
-
|
|
76
|
-
### Observable Types
|
|
77
|
-
|
|
78
|
-
```typescript
|
|
79
|
-
/**
|
|
80
|
-
* Called to add a new observer to an Observable.
|
|
81
|
-
* Returns an Unobserve function that can be called to stop observing the Observable.
|
|
82
|
-
*/
|
|
83
|
-
export type Observable<T> = (observer: Callback<T>) => Unobserve;
|
|
84
|
-
/**
|
|
85
|
-
* Callback function called zero or more times with a sequence of values.
|
|
86
|
-
* *may* be called back synchronously, immediately when selector function is called.
|
|
87
|
-
* *may* also be called back asynchronously later any number of times.
|
|
88
|
-
* *may* be called multiple sequential times with the same value.
|
|
89
|
-
*/
|
|
90
|
-
export type Callback<T> = (value: T) => void;
|
|
91
|
-
/**
|
|
92
|
-
* Function called to stop observing an Observable.
|
|
93
|
-
*/
|
|
94
|
-
export type Unobserve = () => void;
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
An Observable can be thought of sort of like a Promise but with a few important differences.
|
|
98
|
-
- A Promise only yields a single value, an Observable yields a sequence of values.
|
|
99
|
-
- A Promise can reject with an error, an Observable can not. (It could yield type `MyResult | MyError` though.)
|
|
100
|
-
- A Promise can only resolve asynchronously, an Observable *may* yield an initial result synchronously.
|
|
101
|
-
- An Observable is allowed to call the Callback callback function immediately upon observation if it has a value.
|
|
102
|
-
- A Promise begins executing immediately, an Observable may lazily wait for a first observer before taking any action.
|
|
103
|
-
- An Observable can be unobserved.
|
|
104
|
-
|
|
105
|
-
### Observable Creation
|
|
106
|
-
|
|
107
|
-
This simple definition of an Observable makes it very easy to create them from various sources.
|
|
108
|
-
|
|
109
|
-
- `fromConstant<T>(value: T) => Observable<T>`
|
|
110
|
-
- `fromPromise<T>(promise: Promise<T>): Observable<T>`
|
|
111
|
-
- `fromPromiseWithError<T, E extends Error>(promise: Promise<T>): Observable<T | E>`
|
|
112
|
-
- `fromObservableProperties` converts an object with named Observable values into a single Observable of an object with corresponding types.
|
|
113
|
-
|
|
114
|
-
For instance:
|
|
115
|
-
|
|
116
|
-
```typescript
|
|
117
|
-
fromObservables({ a: fromConstant(1), b: fromConstant("s")})
|
|
118
|
-
// yields type Observable<{ a: number, b: string }>
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
`fromObservableProperties` will only yield a result once every contained observable has provided a result. If some properties are optional then use the `withOptional` higher order function described below.
|
|
122
|
-
|
|
123
|
-
### Observable Modification
|
|
124
|
-
|
|
125
|
-
They are also very easy to modify in order to build higher order Observables.
|
|
126
|
-
|
|
127
|
-
For the purposes of discussion let us use an array to indicate the sequential values yielded by an Observable with the first element being any synchronous callback and `void` meaning no synchronous callback.
|
|
128
|
-
|
|
129
|
-
So our `fromConstant(12)` would yield `[12]` and `fromPromise(Promise.resolve(12))` would yield `[void, 12]`
|
|
130
|
-
|
|
131
|
-
These examples will use the form of: Sequence Before => Higher Order Function => Sequence After.
|
|
132
|
-
|
|
133
|
-
withDeduplicate removes any sequentially equivalent values:
|
|
134
|
-
|
|
135
|
-
`[1, 1, 2, 2, 2, 3]` => `withDeduplicate` => `[1, 2, 3]`
|
|
136
|
-
|
|
137
|
-
withDefault replaces any undefined values, including initial synchronous value with a default value:
|
|
138
|
-
|
|
139
|
-
`[void, 1, 2, undefined, 4]` => `withDefault(-1)` => `[-1, 1, 2, -1, 4]`
|
|
140
|
-
|
|
141
|
-
withMap applies a mapping function to each value at notification time:
|
|
142
|
-
|
|
143
|
-
`[void, 1, 2, 3]` => `withMap(x => x * 2)` => `[void, 2, 4, 6]`
|
|
144
|
-
|
|
145
|
-
withOptional converts an `Observable<T>` to `Observable<T | undefined>` and will always respond synchronously.
|
|
146
|
-
|
|
147
|
-
`[void, 1, 2, 3, 4]` => `withOptional` => `[undefined, 1, 2, 3, 4]`
|
|
148
|
-
|
|
149
|
-
## Cache
|
|
150
|
-
|
|
151
|
-
The cache module contains functions and interfaces related to caching, hashing, memoization and storage and retrieval of `Blob`s.
|
|
152
|
-
|
|
153
|
-
The `memoize` function and `BlobStore` are the most important public interfaces in the cache submodule. They are described below. See the API reference for hashing and other lower level functions.
|
|
154
|
-
|
|
155
|
-
The `memoize` function can be used to cache expensive, deterministic, asynchronous functions that take data arguments and return data results. In addition to caching the results, it also blocks multiple simultaneous calls with the same arguments and makes them wait for the first result.
|
|
156
|
-
|
|
157
|
-
### BlobStore
|
|
158
|
-
|
|
159
|
-
It is important to handle `Blob`s correctly within an application. Retaining references to a large number of them can cause memory problems depending upon their size.
|
|
160
|
-
|
|
161
|
-
The `BlobStore` interface and corresponding `blobStore` exported instance provide a convenient way to convert `Blob`s into small JSON handles to them called `BlobRef`s. Those `BlobRef`s can later be converted back into a `Blob`.
|
|
162
|
-
|
|
163
|
-
`Blob`s within the `blobStore` are generally persisted across sessions using the browsers buid in `Cache` storage.
|
|
164
|
-
|
|
165
|
-
`BlobRef`s have a number of advantages over directly using blobs.
|
|
166
|
-
`BlobRef`s are:
|
|
167
|
-
- small json objects
|
|
168
|
-
- use negligible memory since the `Blob` is stored on disc till needed.
|
|
169
|
-
- deterministic for each `Blob` based on mime type and content.
|
|
170
|
-
- suitable for persistence to locations with limited size.
|
|
171
|
-
- suitable for use as a cache key
|
|
172
|
-
- suitable for use as a cache value
|
|
173
|
-
|
|
174
|
-
## Schemas
|
|
175
|
-
|
|
176
|
-
Contains some standard data type schemas in JSON Schema format for convenience. These types are most frequently used when describing components within the Entity Component System. Knowing the precise size and signedness of primitive numeric types allows the ECS to store these values within tightly packed typed arrays internally. This makes memory usage and processing time more efficient.
|
|
177
|
-
|
|
178
|
-
## Entity Component System (ECS)
|
|
179
|
-
|
|
180
|
-
This ECS database is a high performance, strongly typed typescript implementation inspired by the Sanders Mertens C++ based [Flecs](https://www.flecs.dev/flecs/md_docs_2Docs.html).
|
|
181
|
-
|
|
182
|
-
This library provides three different high performance ECS interfaces. They each share the same basic read API but differ in their interface for writing and observability of changes.
|
|
183
|
-
|
|
184
|
-
- [ECS](./docs/api/interfaces/ecs.ECS.html)
|
|
185
|
-
- allows direct write access to the data.
|
|
186
|
-
- no changes are observability.
|
|
187
|
-
- [Transaction ECS](./docs/api/interfaces/ecs.TransactionECS.html)
|
|
188
|
-
- requires transactions for writing changes.
|
|
189
|
-
- all changes are observable.
|
|
190
|
-
- [Action ECS](./docs/api/interfaces/ecs.ActionECS.html)
|
|
191
|
-
- requires pre-defined actions for writing changes.
|
|
192
|
-
- actions are implemented using transactions.
|
|
193
|
-
- action functions must be synchronous and may never throw.
|
|
194
|
-
- all changes are observable.
|
|
195
|
-
- provides Operational Transform to resolve concurrent multi player edits.
|
|
196
|
-
|
|
197
|
-
### What is an ECS?
|
|
198
|
-
|
|
199
|
-
Sanders Mertens also covers this thoroughly in his ECS FAQ:
|
|
200
|
-
|
|
201
|
-
[https://github.com/SanderMertens/ecs-faq?tab=readme-ov-file#what-is-ecs](https://github.com/SanderMertens/ecs-faq?tab=readme-ov-file#what-is-ecs)
|
|
202
|
-
|
|
203
|
-
In addition to the Entity, Component and System definitions which are standard, we also use the term Resource. A Resource is just a value which is defined globally on the ECS itself and not attached to any specific Entity.
|
|
204
|
-
|
|
205
|
-
### Action ECS Usage
|
|
206
|
-
|
|
207
|
-
```typescript
|
|
208
|
-
// create an action ecs
|
|
209
|
-
const ecs = createActionECS()
|
|
210
|
-
// define components with schemas
|
|
211
|
-
.withComponents({
|
|
212
|
-
position: Vector3Schema,
|
|
213
|
-
velocity: Vector3Schema,
|
|
214
|
-
color: Vector4Schema,
|
|
215
|
-
size: { type: "number" },
|
|
216
|
-
health: { type: "number" },
|
|
217
|
-
player: { const: true },
|
|
218
|
-
} as const)
|
|
219
|
-
// define archetypes with component names
|
|
220
|
-
.withArchetypes({
|
|
221
|
-
particle: ["position", "velocity", "color", "size"],
|
|
222
|
-
player: ["position", "health", "player"],
|
|
223
|
-
})
|
|
224
|
-
// define resources with initial values
|
|
225
|
-
.withResources({
|
|
226
|
-
gravity: 9.8,
|
|
227
|
-
})
|
|
228
|
-
// define actions with transactional functions
|
|
229
|
-
.withActions({
|
|
230
|
-
createParticle(t, props: { position: Vector3, velocity: Vector3, color: Vector4, size: number }) {
|
|
231
|
-
t.createEntity(t.ecs.archetypes.particle, props);
|
|
232
|
-
},
|
|
233
|
-
deleteParticle(t, entity: number) {
|
|
234
|
-
t.deleteEntity(entity);
|
|
235
|
-
},
|
|
236
|
-
createPlayer(t, position: Vector3) {
|
|
237
|
-
t.createEntity(t.ecs.archetypes.player, { position, health: 100, player: true });
|
|
238
|
-
},
|
|
239
|
-
movePlayer(t, entity: number, position: Vector3) {
|
|
240
|
-
t.setComponentValue(entity, "position", position);
|
|
241
|
-
},
|
|
242
|
-
setGravity(t, gravity: number) {
|
|
243
|
-
t.resources.gravity = gravity;
|
|
244
|
-
},
|
|
245
|
-
})
|
|
246
|
-
|
|
247
|
-
// call some actions to modify the ECS
|
|
248
|
-
ecs.actions.createParticle({ position: [0, 0, 0], velocity: [1, 0, 0], color: [1, 1, 1, 1], size: 1 });
|
|
249
|
-
ecs.actions.createParticle({ position: [1, 1, 1], velocity: [1, 1, 1], color: [1, 1, 1, 1], size: 2 });
|
|
250
|
-
ecs.actions.createPlayer([10, 20, 0]);
|
|
251
|
-
ecs.actions.movePlayer(1, [10, 20, 0]);
|
|
252
|
-
|
|
253
|
-
// read some values from the ECS
|
|
254
|
-
const players = ecs.selectEntities(ecs.archetypes.player);
|
|
255
|
-
const particles = ecs.selectEntities(ecs.archetypes.particle);
|
|
256
|
-
|
|
257
|
-
// observe changes to the ECS
|
|
258
|
-
ecs.observe.archetypeEntities(ecs.archetypes.player)((playerEntities) => {
|
|
259
|
-
for (const playerEntity of playerEntities) {
|
|
260
|
-
const player = ecs.getEntityValues(playerEntity);
|
|
261
|
-
console.log("Player entity changed", player);
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
### ECS Persistence
|
|
268
|
-
|
|
269
|
-
The ECS can be converted to JSON and from JSON.
|
|
270
|
-
|
|
271
|
-
The persistence format is logically consistent with the internal ECS data format so studying it may help you understand how an ECS is structured:
|
|
272
|
-
|
|
273
|
-
```typescript
|
|
274
|
-
{
|
|
275
|
-
ecs: true,
|
|
276
|
-
version: 2,
|
|
277
|
-
components: {
|
|
278
|
-
id: { type: 'integer', minimum: +0, maximum: 4294967295 },
|
|
279
|
-
position: { type: 'array', items: { type: 'number', precision: 1 }, minItems: 3, maxItems: 3 },
|
|
280
|
-
velocity: { type: 'array', items: { type: 'number', precision: 1 }, minItems: 3, maxItems: 3 },
|
|
281
|
-
color: { type: 'array', items: { type: 'number', precision: 1 }, minItems: 3, maxItems: 3 },
|
|
282
|
-
size: { type: 'number' }, health: { type: 'number' }, player: { const: true },
|
|
283
|
-
gravity: {}
|
|
284
|
-
},
|
|
285
|
-
// The main entities table has two entries for each entity.
|
|
286
|
-
// The first value is the index of the tables array and represents the entities archetype.
|
|
287
|
-
// The second value is the row of the entity within the archetype table.
|
|
288
|
-
entities: [ 3, +0, 1, +0, 1, +1, 2, +0 ],
|
|
289
|
-
tables: [
|
|
290
|
-
{ rows: +0, columns: { id: [] } }, // the empty archetype contains only an id component
|
|
291
|
-
{
|
|
292
|
-
rows: 2,
|
|
293
|
-
columns: {
|
|
294
|
-
// component data is stored as Structure of Arrays (SoA)
|
|
295
|
-
id: [ 1, 2 ],
|
|
296
|
-
color: [ [1, 0, 0, 0], [1, 1, 1, 1] ],
|
|
297
|
-
position: [ [0, 0, 0, 0], [1, 1, 1, 1] ],
|
|
298
|
-
size: [ 1, 2 ],
|
|
299
|
-
velocity: [ [0, 0, 0], [1, 1, 1] ]
|
|
300
|
-
}
|
|
301
|
-
},
|
|
302
|
-
{ rows: 1, columns: { id: [ 3 ], health: [ 100 ], player: true, position: [ [ 10, 20, +0 ] ] } },
|
|
303
|
-
{ rows: 1, columns: { gravity: [ 9.8 ], id: [ +0 ] } } // resources are stored internally as components
|
|
304
|
-
]
|
|
305
|
-
}
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
## Performance Test
|
|
309
|
-
|
|
310
|
-
[Performance Test](https://git.corp.adobe.com/pages/neuralfiltersplatform/firefly-data/docs/perftest.html)
|
|
@@ -1,33 +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
|
-
/**
|
|
23
|
-
* Binds all functions to the object containing them.
|
|
24
|
-
* @param obj
|
|
25
|
-
* @returns
|
|
26
|
-
*/
|
|
27
|
-
export function bindFunctions(obj) {
|
|
28
|
-
for (const key in obj) {
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- need to bind functions
|
|
30
|
-
obj[key] = obj[key].bind(obj);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=bind-functions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bind-functions.js","sourceRoot":"","sources":["../../../src/cache/functions/bind-functions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AACX;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAmB,GAAM;IAEpD,KAAK,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;QACtB,wFAAwF;QACxF,GAAG,CAAC,GAAG,CAAC,GAAI,GAAG,CAAC,GAAG,CAAiB,CAAC,IAAI,CAAC,GAAG,CAAQ,CAAC;IACxD,CAAC;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function arrayBufferToHex(buffer: ArrayBuffer): string;
|
|
@@ -1,27 +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 function arrayBufferToHex(buffer) {
|
|
23
|
-
return [...new Uint8Array(buffer)]
|
|
24
|
-
.map((x) => x.toString(16).padStart(2, "0"))
|
|
25
|
-
.join("");
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=arrayBufferToHex.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"arrayBufferToHex.js","sourceRoot":"","sources":["../../../../src/cache/functions/hashing/arrayBufferToHex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AACX,MAAM,UAAU,gBAAgB,CAAC,MAAmB;IAChD,OAAO,CAAC,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;SAC7B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;SAC3C,IAAI,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function omit<T extends object, K extends keyof T>(obj: T, ...keys: K[]): Omit<T, K>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"omit.js","sourceRoot":"","sources":["../../../src/cache/functions/omit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AAEX,MAAM,UAAU,IAAI,CAClB,GAAM,EACN,GAAG,IAAS;IAEZ,MAAM,MAAM,GAAG,EAAE,GAAG,GAAG,EAAE,CAAC;IAC1B,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type AsyncDataFunction<InputArgs extends Array<unknown>, Output> = (...args: InputArgs) => Promise<Output>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/cache/functions/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW"}
|
package/dist/core/data.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Data is readonly JSON.
|
|
3
|
-
* This type forms the foundation for all of our internal state models and interfaces to external APIs.
|
|
4
|
-
* It is easy to serialize/deserialize/compare/hash/cache and validate (with JSON-Schema).
|
|
5
|
-
* These traits make it an ideal foundation for building a robust state engine which cannot enter into invalid states.
|
|
6
|
-
* It also allows us to strongly define contracts between our application and external services.
|
|
7
|
-
* Validation of input arguments and output results allows strict enforcement of agreed upon contracts.
|
|
8
|
-
*/
|
|
9
|
-
export type Data = string | number | boolean | null | undefined | ReadonlyArray<Data> | {
|
|
10
|
-
readonly [K in string]?: Data;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Compares two Data objects for deep equality.
|
|
14
|
-
* Ordering of keys matters.
|
|
15
|
-
* If order is not important then use normalize first.
|
|
16
|
-
*/
|
|
17
|
-
export declare function equals(a?: unknown, b?: unknown): boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Returns a new normalized object of the same type by
|
|
20
|
-
* recursively sorting any contained objects keys alphabetically.
|
|
21
|
-
*/
|
|
22
|
-
export declare function normalize<D>(d: D): D;
|
package/dist/core/data.js
DELETED
|
@@ -1,52 +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
|
-
/**
|
|
23
|
-
* Compares two Data objects for deep equality.
|
|
24
|
-
* Ordering of keys matters.
|
|
25
|
-
* If order is not important then use normalize first.
|
|
26
|
-
*/
|
|
27
|
-
export function equals(a, b) {
|
|
28
|
-
if (a === b) {
|
|
29
|
-
return true;
|
|
30
|
-
}
|
|
31
|
-
if (!a || !b) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
return JSON.stringify(a) === JSON.stringify(b);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Returns a new normalized object of the same type by
|
|
38
|
-
* recursively sorting any contained objects keys alphabetically.
|
|
39
|
-
*/
|
|
40
|
-
export function normalize(d) {
|
|
41
|
-
// we could structured clone but let's explicitly shed any keys with undefined values.
|
|
42
|
-
return JSON.parse(JSON.stringify(d), (_key, value) => {
|
|
43
|
-
if (value && !Array.isArray(value) && typeof value === "object") {
|
|
44
|
-
return Object.fromEntries(Object.entries(value).sort(([a], [b]) =>
|
|
45
|
-
// not using String.localeCompare
|
|
46
|
-
// we want this consistent no matter locale
|
|
47
|
-
a < b ? -1 : a > b ? 1 : 0));
|
|
48
|
-
}
|
|
49
|
-
return value;
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=data.js.map
|
package/dist/core/data.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/core/data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AAmBX;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAC,CAAW,EAAE,CAAW;IAC7C,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QACb,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AACjD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAI,CAAI;IAC/B,uFAAuF;IACvF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,IAAY,EAAE,KAAc,EAAE,EAAE;QACpE,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAChE,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;YACtC,kCAAkC;YAClC,4CAA4C;YAC5C,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAC3B,CACF,CAAC;QACJ,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/core/data.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/core/data.test.js
DELETED
|
@@ -1,48 +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 { normalize } from "./data.js";
|
|
23
|
-
import { describe, expect, it } from "vitest";
|
|
24
|
-
describe("Data.normalize", () => {
|
|
25
|
-
it("should sort object keys alphabetically", () => {
|
|
26
|
-
expect(normalize({ b: 1, a: 2, c: null })).toEqual({
|
|
27
|
-
a: 2,
|
|
28
|
-
b: 1,
|
|
29
|
-
c: null,
|
|
30
|
-
});
|
|
31
|
-
expect(normalize([{ A: [], b: 1, a: 2 }])).toEqual([{ a: 2, A: [], b: 1 }]);
|
|
32
|
-
expect(normalize([[{ b: 1, a: 2 }]])).toEqual([[{ a: 2, b: 1 }]]);
|
|
33
|
-
expect(normalize({ z: [[{ b: 1, a: 2 }]], q: 10 })).toEqual({
|
|
34
|
-
q: 10,
|
|
35
|
-
z: [[{ a: 2, b: 1 }]],
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
it("should remove undefined values", () => {
|
|
39
|
-
expect(normalize({ b: 1, a: 2, value: undefined })).toEqual({
|
|
40
|
-
a: 2,
|
|
41
|
-
b: 1,
|
|
42
|
-
});
|
|
43
|
-
expect(normalize([{ b: 1, a: 2, value: undefined }])).toEqual([
|
|
44
|
-
{ a: 2, b: 1 },
|
|
45
|
-
]);
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
//# sourceMappingURL=data.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data.test.js","sourceRoot":"","sources":["../../src/core/data.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AACX,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;QAChD,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;YACjD,CAAC,EAAE,CAAC;YACJ,CAAC,EAAE,CAAC;YACJ,CAAC,EAAE,IAAI;SACR,CAAC,CAAC;QACH,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CA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