@fireproof/core 0.21.0-dev-preview-7 → 0.22.0-dev-preview
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/index.d.ts +2 -16
- package/index.js +2 -15
- package/index.js.map +1 -1
- package/index.ts +2 -0
- package/package.json +11 -69
- package/tsconfig.json +18 -0
- package/README.md +0 -269
- package/apply-head-queue.d.ts +0 -18
- package/apply-head-queue.d.ts.map +0 -1
- package/apply-head-queue.js +0 -47
- package/apply-head-queue.js.map +0 -1
- package/blockstore/attachable-store.d.ts +0 -19
- package/blockstore/attachable-store.d.ts.map +0 -1
- package/blockstore/attachable-store.js +0 -316
- package/blockstore/attachable-store.js.map +0 -1
- package/blockstore/commit-queue.d.ts +0 -17
- package/blockstore/commit-queue.d.ts.map +0 -1
- package/blockstore/commit-queue.js +0 -60
- package/blockstore/commit-queue.js.map +0 -1
- package/blockstore/commitor.d.ts +0 -21
- package/blockstore/commitor.d.ts.map +0 -1
- package/blockstore/commitor.js +0 -95
- package/blockstore/commitor.js.map +0 -1
- package/blockstore/connect-raw.d.ts +0 -2
- package/blockstore/connect-raw.d.ts.map +0 -1
- package/blockstore/connect-raw.js +0 -2
- package/blockstore/connect-raw.js.map +0 -1
- package/blockstore/connection-base.d.ts +0 -2
- package/blockstore/connection-base.d.ts.map +0 -1
- package/blockstore/connection-base.js +0 -2
- package/blockstore/connection-base.js.map +0 -1
- package/blockstore/encrypt-helpers.d.ts +0 -2
- package/blockstore/encrypt-helpers.d.ts.map +0 -1
- package/blockstore/encrypt-helpers.js +0 -2
- package/blockstore/encrypt-helpers.js.map +0 -1
- package/blockstore/fp-envelope.d.ts +0 -32
- package/blockstore/fp-envelope.d.ts.map +0 -1
- package/blockstore/fp-envelope.js +0 -14
- package/blockstore/fp-envelope.js.map +0 -1
- package/blockstore/gateway.d.ts +0 -20
- package/blockstore/gateway.d.ts.map +0 -1
- package/blockstore/gateway.js +0 -2
- package/blockstore/gateway.js.map +0 -1
- package/blockstore/index.d.ts +0 -17
- package/blockstore/index.d.ts.map +0 -1
- package/blockstore/index.js +0 -17
- package/blockstore/index.js.map +0 -1
- package/blockstore/interceptor-gateway.d.ts +0 -29
- package/blockstore/interceptor-gateway.d.ts.map +0 -1
- package/blockstore/interceptor-gateway.js +0 -137
- package/blockstore/interceptor-gateway.js.map +0 -1
- package/blockstore/loader-helpers.d.ts +0 -10
- package/blockstore/loader-helpers.d.ts.map +0 -1
- package/blockstore/loader-helpers.js +0 -115
- package/blockstore/loader-helpers.js.map +0 -1
- package/blockstore/loader.d.ts +0 -62
- package/blockstore/loader.d.ts.map +0 -1
- package/blockstore/loader.js +0 -523
- package/blockstore/loader.js.map +0 -1
- package/blockstore/register-store-protocol.d.ts +0 -22
- package/blockstore/register-store-protocol.d.ts.map +0 -1
- package/blockstore/register-store-protocol.js +0 -125
- package/blockstore/register-store-protocol.js.map +0 -1
- package/blockstore/serde-gateway.d.ts +0 -78
- package/blockstore/serde-gateway.d.ts.map +0 -1
- package/blockstore/serde-gateway.js +0 -2
- package/blockstore/serde-gateway.js.map +0 -1
- package/blockstore/store-factory.d.ts +0 -11
- package/blockstore/store-factory.d.ts.map +0 -1
- package/blockstore/store-factory.js +0 -104
- package/blockstore/store-factory.js.map +0 -1
- package/blockstore/store-remote.d.ts +0 -2
- package/blockstore/store-remote.d.ts.map +0 -1
- package/blockstore/store-remote.js +0 -2
- package/blockstore/store-remote.js.map +0 -1
- package/blockstore/store.d.ts +0 -86
- package/blockstore/store.d.ts.map +0 -1
- package/blockstore/store.js +0 -437
- package/blockstore/store.js.map +0 -1
- package/blockstore/task-manager.d.ts +0 -19
- package/blockstore/task-manager.d.ts.map +0 -1
- package/blockstore/task-manager.js +0 -50
- package/blockstore/task-manager.js.map +0 -1
- package/blockstore/transaction.d.ts +0 -62
- package/blockstore/transaction.d.ts.map +0 -1
- package/blockstore/transaction.js +0 -256
- package/blockstore/transaction.js.map +0 -1
- package/blockstore/types.d.ts +0 -508
- package/blockstore/types.d.ts.map +0 -1
- package/blockstore/types.js +0 -83
- package/blockstore/types.js.map +0 -1
- package/blockstore/uri-interceptor.d.ts +0 -19
- package/blockstore/uri-interceptor.d.ts.map +0 -1
- package/blockstore/uri-interceptor.js +0 -61
- package/blockstore/uri-interceptor.js.map +0 -1
- package/bundle-not-impl.d.ts +0 -2
- package/bundle-not-impl.d.ts.map +0 -1
- package/bundle-not-impl.js +0 -4
- package/bundle-not-impl.js.map +0 -1
- package/cli/main.js +0 -26645
- package/crdt-clock.d.ts +0 -26
- package/crdt-clock.d.ts.map +0 -1
- package/crdt-clock.js +0 -133
- package/crdt-clock.js.map +0 -1
- package/crdt-helpers.d.ts +0 -19
- package/crdt-helpers.d.ts.map +0 -1
- package/crdt-helpers.js +0 -332
- package/crdt-helpers.js.map +0 -1
- package/crdt.d.ts +0 -41
- package/crdt.d.ts.map +0 -1
- package/crdt.js +0 -164
- package/crdt.js.map +0 -1
- package/database.d.ts +0 -33
- package/database.d.ts.map +0 -1
- package/database.js +0 -132
- package/database.js.map +0 -1
- package/deno.json +0 -20
- package/index.d.ts.map +0 -1
- package/indexer-helpers.d.ts +0 -68
- package/indexer-helpers.d.ts.map +0 -1
- package/indexer-helpers.js +0 -157
- package/indexer-helpers.js.map +0 -1
- package/indexer.d.ts +0 -24
- package/indexer.d.ts.map +0 -1
- package/indexer.js +0 -239
- package/indexer.js.map +0 -1
- package/ledger.d.ts +0 -56
- package/ledger.d.ts.map +0 -1
- package/ledger.js +0 -237
- package/ledger.js.map +0 -1
- package/protocols/cloud/http-connection.d.ts +0 -26
- package/protocols/cloud/http-connection.d.ts.map +0 -1
- package/protocols/cloud/http-connection.js +0 -154
- package/protocols/cloud/http-connection.js.map +0 -1
- package/protocols/cloud/index.d.ts +0 -10
- package/protocols/cloud/index.d.ts.map +0 -1
- package/protocols/cloud/index.js +0 -10
- package/protocols/cloud/index.js.map +0 -1
- package/protocols/cloud/msg-raw-connection-base.d.ts +0 -16
- package/protocols/cloud/msg-raw-connection-base.d.ts.map +0 -1
- package/protocols/cloud/msg-raw-connection-base.js +0 -22
- package/protocols/cloud/msg-raw-connection-base.js.map +0 -1
- package/protocols/cloud/msg-types-data.d.ts +0 -36
- package/protocols/cloud/msg-types-data.d.ts.map +0 -1
- package/protocols/cloud/msg-types-data.js +0 -38
- package/protocols/cloud/msg-types-data.js.map +0 -1
- package/protocols/cloud/msg-types-meta.d.ts +0 -41
- package/protocols/cloud/msg-types-meta.d.ts.map +0 -1
- package/protocols/cloud/msg-types-meta.js +0 -98
- package/protocols/cloud/msg-types-meta.js.map +0 -1
- package/protocols/cloud/msg-types-wal.d.ts +0 -33
- package/protocols/cloud/msg-types-wal.d.ts.map +0 -1
- package/protocols/cloud/msg-types-wal.js +0 -38
- package/protocols/cloud/msg-types-wal.js.map +0 -1
- package/protocols/cloud/msg-types.d.ts +0 -310
- package/protocols/cloud/msg-types.d.ts.map +0 -1
- package/protocols/cloud/msg-types.js +0 -299
- package/protocols/cloud/msg-types.js.map +0 -1
- package/protocols/cloud/msger.d.ts +0 -94
- package/protocols/cloud/msger.d.ts.map +0 -1
- package/protocols/cloud/msger.js +0 -319
- package/protocols/cloud/msger.js.map +0 -1
- package/protocols/cloud/ws-connection.d.ts +0 -40
- package/protocols/cloud/ws-connection.d.ts.map +0 -1
- package/protocols/cloud/ws-connection.js +0 -205
- package/protocols/cloud/ws-connection.js.map +0 -1
- package/protocols/dashboard/index.d.ts +0 -4
- package/protocols/dashboard/index.d.ts.map +0 -1
- package/protocols/dashboard/index.js +0 -4
- package/protocols/dashboard/index.js.map +0 -1
- package/protocols/dashboard/msg-api.d.ts +0 -11
- package/protocols/dashboard/msg-api.d.ts.map +0 -1
- package/protocols/dashboard/msg-api.js +0 -55
- package/protocols/dashboard/msg-api.js.map +0 -1
- package/protocols/dashboard/msg-is.d.ts +0 -45
- package/protocols/dashboard/msg-is.d.ts.map +0 -1
- package/protocols/dashboard/msg-is.js +0 -63
- package/protocols/dashboard/msg-is.js.map +0 -1
- package/protocols/dashboard/msg-types.d.ts +0 -397
- package/protocols/dashboard/msg-types.d.ts.map +0 -1
- package/protocols/dashboard/msg-types.js +0 -4
- package/protocols/dashboard/msg-types.js.map +0 -1
- package/protocols/index.d.ts +0 -3
- package/protocols/index.d.ts.map +0 -1
- package/protocols/index.js +0 -3
- package/protocols/index.js.map +0 -1
- package/react/img-file.d.ts +0 -303
- package/react/img-file.d.ts.map +0 -1
- package/react/img-file.js +0 -92
- package/react/img-file.js.map +0 -1
- package/react/index.d.ts +0 -5
- package/react/index.d.ts.map +0 -1
- package/react/index.js +0 -5
- package/react/index.js.map +0 -1
- package/react/types.d.ts +0 -91
- package/react/types.d.ts.map +0 -1
- package/react/types.js +0 -2
- package/react/types.js.map +0 -1
- package/react/use-all-docs.d.ts +0 -4
- package/react/use-all-docs.d.ts.map +0 -1
- package/react/use-all-docs.js +0 -25
- package/react/use-all-docs.js.map +0 -1
- package/react/use-attach.d.ts +0 -11
- package/react/use-attach.d.ts.map +0 -1
- package/react/use-attach.js +0 -169
- package/react/use-attach.js.map +0 -1
- package/react/use-changes.d.ts +0 -4
- package/react/use-changes.d.ts.map +0 -1
- package/react/use-changes.js +0 -19
- package/react/use-changes.js.map +0 -1
- package/react/use-document.d.ts +0 -4
- package/react/use-document.d.ts.map +0 -1
- package/react/use-document.js +0 -109
- package/react/use-document.js.map +0 -1
- package/react/use-fireproof.d.ts +0 -6
- package/react/use-fireproof.d.ts.map +0 -1
- package/react/use-fireproof.js +0 -20
- package/react/use-fireproof.js.map +0 -1
- package/react/use-live-query.d.ts +0 -4
- package/react/use-live-query.d.ts.map +0 -1
- package/react/use-live-query.js +0 -24
- package/react/use-live-query.js.map +0 -1
- package/runtime/files.d.ts +0 -12
- package/runtime/files.d.ts.map +0 -1
- package/runtime/files.js +0 -29
- package/runtime/files.js.map +0 -1
- package/runtime/gateways/cloud/gateway.d.ts +0 -41
- package/runtime/gateways/cloud/gateway.d.ts.map +0 -1
- package/runtime/gateways/cloud/gateway.js +0 -514
- package/runtime/gateways/cloud/gateway.js.map +0 -1
- package/runtime/gateways/cloud/index.d.ts +0 -3
- package/runtime/gateways/cloud/index.d.ts.map +0 -1
- package/runtime/gateways/cloud/index.js +0 -3
- package/runtime/gateways/cloud/index.js.map +0 -1
- package/runtime/gateways/cloud/to-cloud.d.ts +0 -59
- package/runtime/gateways/cloud/to-cloud.d.ts.map +0 -1
- package/runtime/gateways/cloud/to-cloud.js +0 -175
- package/runtime/gateways/cloud/to-cloud.js.map +0 -1
- package/runtime/gateways/def-serde-gateway.d.ts +0 -18
- package/runtime/gateways/def-serde-gateway.d.ts.map +0 -1
- package/runtime/gateways/def-serde-gateway.js +0 -92
- package/runtime/gateways/def-serde-gateway.js.map +0 -1
- package/runtime/gateways/file/deno/deno-filesystem.d.ts +0 -27
- package/runtime/gateways/file/deno/deno-filesystem.d.ts.map +0 -1
- package/runtime/gateways/file/deno/deno-filesystem.js +0 -52
- package/runtime/gateways/file/deno/deno-filesystem.js.map +0 -1
- package/runtime/gateways/file/deno/get-sys-file-system.d.ts +0 -4
- package/runtime/gateways/file/deno/get-sys-file-system.d.ts.map +0 -1
- package/runtime/gateways/file/deno/get-sys-file-system.js +0 -11
- package/runtime/gateways/file/deno/get-sys-file-system.js.map +0 -1
- package/runtime/gateways/file/deno/index.d.ts +0 -2
- package/runtime/gateways/file/deno/index.d.ts.map +0 -1
- package/runtime/gateways/file/deno/index.js +0 -2
- package/runtime/gateways/file/deno/index.js.map +0 -1
- package/runtime/gateways/file/gateway-impl.d.ts +0 -18
- package/runtime/gateways/file/gateway-impl.d.ts.map +0 -1
- package/runtime/gateways/file/gateway-impl.js +0 -121
- package/runtime/gateways/file/gateway-impl.js.map +0 -1
- package/runtime/gateways/file/index.d.ts +0 -3
- package/runtime/gateways/file/index.d.ts.map +0 -1
- package/runtime/gateways/file/index.js +0 -3
- package/runtime/gateways/file/index.js.map +0 -1
- package/runtime/gateways/file/key-bag-file.d.ts +0 -20
- package/runtime/gateways/file/key-bag-file.d.ts.map +0 -1
- package/runtime/gateways/file/key-bag-file.js +0 -52
- package/runtime/gateways/file/key-bag-file.js.map +0 -1
- package/runtime/gateways/file/node/get-sys-file-system.d.ts +0 -4
- package/runtime/gateways/file/node/get-sys-file-system.d.ts.map +0 -1
- package/runtime/gateways/file/node/get-sys-file-system.js +0 -11
- package/runtime/gateways/file/node/get-sys-file-system.js.map +0 -1
- package/runtime/gateways/file/node/index.d.ts +0 -2
- package/runtime/gateways/file/node/index.d.ts.map +0 -1
- package/runtime/gateways/file/node/index.js +0 -2
- package/runtime/gateways/file/node/index.js.map +0 -1
- package/runtime/gateways/file/node/node-filesystem.d.ts +0 -32
- package/runtime/gateways/file/node/node-filesystem.d.ts.map +0 -1
- package/runtime/gateways/file/node/node-filesystem.js +0 -33
- package/runtime/gateways/file/node/node-filesystem.js.map +0 -1
- package/runtime/gateways/file/node/to-array-buffer.d.ts +0 -2
- package/runtime/gateways/file/node/to-array-buffer.d.ts.map +0 -1
- package/runtime/gateways/file/node/to-array-buffer.js +0 -12
- package/runtime/gateways/file/node/to-array-buffer.js.map +0 -1
- package/runtime/gateways/file/sys-file-system-factory.d.ts +0 -4
- package/runtime/gateways/file/sys-file-system-factory.d.ts.map +0 -1
- package/runtime/gateways/file/sys-file-system-factory.js +0 -13
- package/runtime/gateways/file/sys-file-system-factory.js.map +0 -1
- package/runtime/gateways/file/utils.d.ts +0 -5
- package/runtime/gateways/file/utils.d.ts.map +0 -1
- package/runtime/gateways/file/utils.js +0 -27
- package/runtime/gateways/file/utils.js.map +0 -1
- package/runtime/gateways/file/version.d.ts +0 -2
- package/runtime/gateways/file/version.d.ts.map +0 -1
- package/runtime/gateways/file/version.js +0 -2
- package/runtime/gateways/file/version.js.map +0 -1
- package/runtime/gateways/fp-envelope-serialize.d.ts +0 -50
- package/runtime/gateways/fp-envelope-serialize.d.ts.map +0 -1
- package/runtime/gateways/fp-envelope-serialize.js +0 -141
- package/runtime/gateways/fp-envelope-serialize.js.map +0 -1
- package/runtime/gateways/index.d.ts +0 -6
- package/runtime/gateways/index.d.ts.map +0 -1
- package/runtime/gateways/index.js +0 -6
- package/runtime/gateways/index.js.map +0 -1
- package/runtime/gateways/indexeddb/gateway-impl.d.ts +0 -22
- package/runtime/gateways/indexeddb/gateway-impl.d.ts.map +0 -1
- package/runtime/gateways/indexeddb/gateway-impl.js +0 -147
- package/runtime/gateways/indexeddb/gateway-impl.js.map +0 -1
- package/runtime/gateways/indexeddb/index.d.ts +0 -6
- package/runtime/gateways/indexeddb/index.d.ts.map +0 -1
- package/runtime/gateways/indexeddb/index.js +0 -6
- package/runtime/gateways/indexeddb/index.js.map +0 -1
- package/runtime/gateways/indexeddb/key-bag-indexeddb.d.ts +0 -16
- package/runtime/gateways/indexeddb/key-bag-indexeddb.d.ts.map +0 -1
- package/runtime/gateways/indexeddb/key-bag-indexeddb.js +0 -48
- package/runtime/gateways/indexeddb/key-bag-indexeddb.js.map +0 -1
- package/runtime/gateways/indexeddb-version.d.ts +0 -2
- package/runtime/gateways/indexeddb-version.d.ts.map +0 -1
- package/runtime/gateways/indexeddb-version.js +0 -2
- package/runtime/gateways/indexeddb-version.js.map +0 -1
- package/runtime/gateways/memory/gateway.d.ts +0 -18
- package/runtime/gateways/memory/gateway.d.ts.map +0 -1
- package/runtime/gateways/memory/gateway.js +0 -73
- package/runtime/gateways/memory/gateway.js.map +0 -1
- package/runtime/gateways/memory/version.d.ts +0 -2
- package/runtime/gateways/memory/version.d.ts.map +0 -1
- package/runtime/gateways/memory/version.js +0 -2
- package/runtime/gateways/memory/version.js.map +0 -1
- package/runtime/index.d.ts +0 -13
- package/runtime/index.d.ts.map +0 -1
- package/runtime/index.js +0 -13
- package/runtime/index.js.map +0 -1
- package/runtime/key-bag-memory.d.ts +0 -13
- package/runtime/key-bag-memory.d.ts.map +0 -1
- package/runtime/key-bag-memory.js +0 -30
- package/runtime/key-bag-memory.js.map +0 -1
- package/runtime/key-bag.d.ts +0 -88
- package/runtime/key-bag.d.ts.map +0 -1
- package/runtime/key-bag.js +0 -417
- package/runtime/key-bag.js.map +0 -1
- package/runtime/keyed-crypto.d.ts +0 -19
- package/runtime/keyed-crypto.d.ts.map +0 -1
- package/runtime/keyed-crypto.js +0 -192
- package/runtime/keyed-crypto.js.map +0 -1
- package/runtime/memory-sys-container.d.ts +0 -2
- package/runtime/memory-sys-container.d.ts.map +0 -1
- package/runtime/memory-sys-container.js +0 -2
- package/runtime/memory-sys-container.js.map +0 -1
- package/runtime/meta-key-hack.d.ts +0 -42
- package/runtime/meta-key-hack.d.ts.map +0 -1
- package/runtime/meta-key-hack.js +0 -201
- package/runtime/meta-key-hack.js.map +0 -1
- package/runtime/sts-service/index.d.ts +0 -40
- package/runtime/sts-service/index.d.ts.map +0 -1
- package/runtime/sts-service/index.js +0 -108
- package/runtime/sts-service/index.js.map +0 -1
- package/runtime/sys-container.d.ts +0 -2
- package/runtime/sys-container.d.ts.map +0 -1
- package/runtime/sys-container.js +0 -2
- package/runtime/sys-container.js.map +0 -1
- package/runtime/wait-pr-multiformats/block.d.ts +0 -47
- package/runtime/wait-pr-multiformats/block.d.ts.map +0 -1
- package/runtime/wait-pr-multiformats/block.js +0 -64
- package/runtime/wait-pr-multiformats/block.js.map +0 -1
- package/runtime/wait-pr-multiformats/codec-interface.d.ts +0 -29
- package/runtime/wait-pr-multiformats/codec-interface.d.ts.map +0 -1
- package/runtime/wait-pr-multiformats/codec-interface.js +0 -2
- package/runtime/wait-pr-multiformats/codec-interface.js.map +0 -1
- package/runtime/wait-pr-multiformats/index.d.ts +0 -3
- package/runtime/wait-pr-multiformats/index.d.ts.map +0 -1
- package/runtime/wait-pr-multiformats/index.js +0 -3
- package/runtime/wait-pr-multiformats/index.js.map +0 -1
- package/tests/blockstore/fp-envelope.test.ts-off +0 -65
- package/tests/blockstore/fragment-gateway.test.ts-off +0 -106
- package/tests/blockstore/interceptor-gateway.test.ts +0 -254
- package/tests/blockstore/keyed-crypto-indexeddb-file.test.ts +0 -128
- package/tests/blockstore/keyed-crypto.test.ts +0 -376
- package/tests/blockstore/loader.test.ts +0 -298
- package/tests/blockstore/standalone.test.ts +0 -152
- package/tests/blockstore/store.test.ts +0 -192
- package/tests/blockstore/transaction.test.ts +0 -130
- package/tests/fireproof/all-gateway.test.ts +0 -461
- package/tests/fireproof/attachable.test.ts +0 -686
- package/tests/fireproof/cars/bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i.car +0 -0
- package/tests/fireproof/cars/bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i.ts +0 -324
- package/tests/fireproof/charwise-boolean.test.ts +0 -66
- package/tests/fireproof/crdt.test.ts +0 -570
- package/tests/fireproof/database.test.ts +0 -779
- package/tests/fireproof/deleted-docs-handling.test.ts +0 -111
- package/tests/fireproof/fireproof.test.fixture.ts +0 -133
- package/tests/fireproof/fireproof.test.ts +0 -777
- package/tests/fireproof/hello.test.ts +0 -74
- package/tests/fireproof/indexer.test.ts +0 -458
- package/tests/fireproof/multiple-ledger.test.ts +0 -65
- package/tests/fireproof/query-docs.test.ts +0 -116
- package/tests/fireproof/query-limit-issue.test.ts +0 -147
- package/tests/fireproof/query-property-inconsistency.test.ts +0 -89
- package/tests/fireproof/query-result-properties.test.ts +0 -42
- package/tests/fireproof/stable-cid.test.ts +0 -69
- package/tests/fireproof/utils.test.ts +0 -135
- package/tests/gateway/file/loader-config.test.ts +0 -307
- package/tests/gateway/indexeddb/loader-config.test.ts +0 -79
- package/tests/helpers.ts +0 -172
- package/tests/protocols/cloud/msger.test.ts +0 -548
- package/tests/react/img-file.test.tsx +0 -190
- package/tests/react/use-all-docs.test.tsx +0 -172
- package/tests/react/use-document-with-nonexistent-id.test.tsx +0 -96
- package/tests/react/use-fireproof-db-switch.test.tsx +0 -91
- package/tests/react/use-fireproof-stability.test.tsx +0 -145
- package/tests/react/use-fireproof.test.tsx +0 -645
- package/tests/runtime/fp-envelope-serialize.test.ts +0 -254
- package/tests/runtime/meta-key-hack.test.ts +0 -95
- package/tests/setup.file.ts +0 -1
- package/tests/setup.indexeddb.ts +0 -0
- package/tests/setup.memory.ts +0 -2
- package/tests/vitest.file.config.ts +0 -14
- package/tests/vitest.indexeddb.config.ts +0 -37
- package/tests/vitest.memory.config.ts +0 -25
- package/types.d.ts +0 -461
- package/types.d.ts.map +0 -1
- package/types.js +0 -60
- package/types.js.map +0 -1
- package/use-fireproof/iframe-strategy.d.ts +0 -14
- package/use-fireproof/iframe-strategy.d.ts.map +0 -1
- package/use-fireproof/iframe-strategy.js +0 -79
- package/use-fireproof/iframe-strategy.js.map +0 -1
- package/use-fireproof/index.d.ts +0 -14
- package/use-fireproof/index.d.ts.map +0 -1
- package/use-fireproof/index.js +0 -36
- package/use-fireproof/index.js.map +0 -1
- package/use-fireproof/redirect-strategy.d.ts +0 -15
- package/use-fireproof/redirect-strategy.d.ts.map +0 -1
- package/use-fireproof/redirect-strategy.js +0 -153
- package/use-fireproof/redirect-strategy.js.map +0 -1
- package/utils.d.ts +0 -48
- package/utils.d.ts.map +0 -1
- package/utils.js +0 -406
- package/utils.js.map +0 -1
- package/version.d.ts +0 -2
- package/version.d.ts.map +0 -1
- package/version.js +0 -4
- package/version.js.map +0 -1
- package/write-queue.d.ts +0 -9
- package/write-queue.d.ts.map +0 -1
- package/write-queue.js +0 -70
- package/write-queue.js.map +0 -1
@@ -1,461 +0,0 @@
|
|
1
|
-
import { Database, Ledger, LedgerFactory, PARAM, bs, ensureSuperThis, fireproof } from "@fireproof/core";
|
2
|
-
|
3
|
-
import { fileContent } from "./cars/bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i.js";
|
4
|
-
import { simpleCID } from "../helpers.js";
|
5
|
-
import { BuildURI, Future } from "@adviser/cement";
|
6
|
-
|
7
|
-
describe("noop Gateway", function () {
|
8
|
-
let db: Ledger;
|
9
|
-
let carStore: bs.CarStore;
|
10
|
-
let metaStore: bs.MetaStore;
|
11
|
-
let fileStore: bs.FileStore;
|
12
|
-
let walStore: bs.WALStore;
|
13
|
-
let carGateway: bs.SerdeGateway;
|
14
|
-
let metaGateway: bs.SerdeGateway;
|
15
|
-
let fileGateway: bs.SerdeGateway;
|
16
|
-
let walGateway: bs.SerdeGateway;
|
17
|
-
const sthis = ensureSuperThis();
|
18
|
-
let ctx: { loader: bs.Loadable };
|
19
|
-
|
20
|
-
afterEach(async () => {
|
21
|
-
await db.close();
|
22
|
-
await db.destroy();
|
23
|
-
});
|
24
|
-
beforeEach(async () => {
|
25
|
-
db = LedgerFactory("test-gateway-" + sthis.nextId().str, {
|
26
|
-
logger: sthis.logger,
|
27
|
-
});
|
28
|
-
await db.ready();
|
29
|
-
ctx = { loader: db.crdt.blockstore.loader };
|
30
|
-
|
31
|
-
// Extract stores from the loader
|
32
|
-
carStore = ctx.loader.attachedStores.local().active.car;
|
33
|
-
metaStore = ctx.loader.attachedStores.local().active.meta;
|
34
|
-
fileStore = ctx.loader.attachedStores.local().active.file;
|
35
|
-
walStore = ctx.loader.attachedStores.local().active.wal;
|
36
|
-
|
37
|
-
// Extract and log gateways
|
38
|
-
carGateway = carStore.realGateway;
|
39
|
-
metaGateway = metaStore.realGateway;
|
40
|
-
fileGateway = fileStore.realGateway;
|
41
|
-
walGateway = walStore.realGateway;
|
42
|
-
});
|
43
|
-
|
44
|
-
it("should have valid stores and gateways", async () => {
|
45
|
-
// Add assertions
|
46
|
-
expect(carStore).toBeTruthy();
|
47
|
-
expect(metaStore).toBeTruthy();
|
48
|
-
expect(fileStore).toBeTruthy();
|
49
|
-
expect(walStore).toBeTruthy();
|
50
|
-
|
51
|
-
expect(carGateway).toBeTruthy();
|
52
|
-
expect(metaGateway).toBeTruthy();
|
53
|
-
expect(fileGateway).toBeTruthy();
|
54
|
-
expect(walGateway).toBeTruthy();
|
55
|
-
});
|
56
|
-
|
57
|
-
it("should have correct store names", async () => {
|
58
|
-
// Check that all stores have the correct name
|
59
|
-
expect(carStore.url().getParam(PARAM.NAME)).toContain("test-gateway");
|
60
|
-
expect(metaStore.url().getParam(PARAM.NAME)).toContain("test-gateway");
|
61
|
-
expect(fileStore.url().getParam(PARAM.NAME)).toContain("test-gateway");
|
62
|
-
expect(walStore.url().getParam(PARAM.NAME)).toContain("test-gateway");
|
63
|
-
});
|
64
|
-
|
65
|
-
it("should have correct store types in URLs", async () => {
|
66
|
-
// Check that all stores have the correct store type in their URL
|
67
|
-
expect(carStore.url().toString()).toContain("store=car");
|
68
|
-
expect(carStore.url().toString()).toContain("suffix=.car");
|
69
|
-
expect(metaStore.url().toString()).toContain("store=meta");
|
70
|
-
expect(fileStore.url().toString()).toContain("store=file");
|
71
|
-
expect(walStore.url().toString()).toContain("store=wal");
|
72
|
-
});
|
73
|
-
|
74
|
-
it("should have version specified in URLs", async () => {
|
75
|
-
// Verify that all stores have a version specified
|
76
|
-
expect(carStore.url().toString()).toContain("version=");
|
77
|
-
expect(metaStore.url().toString()).toContain("version=");
|
78
|
-
expect(fileStore.url().toString()).toContain("version=");
|
79
|
-
expect(walStore.url().toString()).toContain("version=");
|
80
|
-
});
|
81
|
-
|
82
|
-
it("should have correct gateway types", async () => {
|
83
|
-
// Check that all gateways are instances of the expected gateway class
|
84
|
-
expect(typeof carGateway).toBe("object");
|
85
|
-
expect(typeof metaGateway).toBe("object");
|
86
|
-
expect(typeof fileGateway).toBe("object");
|
87
|
-
expect(typeof walGateway).toBe("object");
|
88
|
-
});
|
89
|
-
|
90
|
-
it("should build CAR Gateway URL", async () => {
|
91
|
-
const testKey = "bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i";
|
92
|
-
const carUrl = await carGateway.buildUrl(ctx, carStore.url(), testKey);
|
93
|
-
expect(carUrl.Ok().hasParam("key")).toBeTruthy();
|
94
|
-
});
|
95
|
-
|
96
|
-
it("should start CAR Gateway", async () => {
|
97
|
-
const url = await carGateway.start(ctx, carStore.url());
|
98
|
-
expect(url.Ok().asObj()).toEqual(carStore.url().asObj());
|
99
|
-
});
|
100
|
-
|
101
|
-
it("should put data in CAR Gateway", async () => {
|
102
|
-
const carUrl = await carGateway.buildUrl(ctx, carStore.url(), fileContent.cid);
|
103
|
-
await carGateway.start(ctx, carStore.url());
|
104
|
-
const carPutResult = await carGateway.put(ctx, carUrl.Ok(), {
|
105
|
-
type: bs.FPEnvelopeTypes.CAR,
|
106
|
-
payload: fileContent.block,
|
107
|
-
});
|
108
|
-
expect(carPutResult.isOk()).toBeTruthy();
|
109
|
-
});
|
110
|
-
|
111
|
-
it("should get data from CAR Gateway", async () => {
|
112
|
-
const carUrl = await carGateway.buildUrl(ctx, carStore.url(), fileContent.cid);
|
113
|
-
await carGateway.start(ctx, carStore.url());
|
114
|
-
await carGateway.put(ctx, carUrl.Ok(), {
|
115
|
-
type: bs.FPEnvelopeTypes.CAR,
|
116
|
-
payload: fileContent.block,
|
117
|
-
});
|
118
|
-
const carGetResult = await carGateway.get(ctx, carUrl.Ok());
|
119
|
-
expect(carGetResult.Ok().type).toEqual("car");
|
120
|
-
expect(carGetResult.Ok().payload).toEqual(fileContent.block);
|
121
|
-
// customExpect(carGetResult.Ok(), (v) => expect(v).toEqual(testData), "carGetResult should match testData");
|
122
|
-
});
|
123
|
-
|
124
|
-
it("should delete data from CAR Gateway", async () => {
|
125
|
-
const carUrl = await carGateway.buildUrl(ctx, carStore.url(), fileContent.cid);
|
126
|
-
await carGateway.start(ctx, carStore.url());
|
127
|
-
await carGateway.put(ctx, carUrl.Ok(), {
|
128
|
-
type: bs.FPEnvelopeTypes.CAR,
|
129
|
-
payload: fileContent.block,
|
130
|
-
});
|
131
|
-
const carDeleteResult = await carGateway.delete(ctx, carUrl.Ok());
|
132
|
-
expect(carDeleteResult.isOk()).toBeTruthy();
|
133
|
-
});
|
134
|
-
|
135
|
-
it("should close CAR Gateway", async () => {
|
136
|
-
await carGateway.close(ctx, carStore.url());
|
137
|
-
});
|
138
|
-
it("should build Meta Gateway URL", async () => {
|
139
|
-
const metaUrl = await metaGateway.buildUrl(ctx, metaStore.url(), "main");
|
140
|
-
expect(metaUrl.Ok()).toBeTruthy();
|
141
|
-
});
|
142
|
-
|
143
|
-
it("should start Meta Gateway", async () => {
|
144
|
-
await metaGateway.start(ctx, metaStore.url());
|
145
|
-
});
|
146
|
-
|
147
|
-
it("should close Meta Gateway", async () => {
|
148
|
-
await metaGateway.start(ctx, metaStore.url());
|
149
|
-
await metaGateway.close(ctx, metaStore.url());
|
150
|
-
});
|
151
|
-
|
152
|
-
it("should build File Gateway URL", async () => {
|
153
|
-
const fileUrl = await fileGateway.buildUrl(ctx, fileStore.url(), fileContent.cid);
|
154
|
-
expect(fileUrl.Ok()).toBeTruthy();
|
155
|
-
});
|
156
|
-
|
157
|
-
it("should start File Gateway", async () => {
|
158
|
-
await fileGateway.start(ctx, fileStore.url());
|
159
|
-
});
|
160
|
-
|
161
|
-
it("should put data to File Gateway", async () => {
|
162
|
-
const fileUrl = await fileGateway.buildUrl(ctx, fileStore.url(), fileContent.cid);
|
163
|
-
await fileGateway.start(ctx, fileStore.url());
|
164
|
-
const filePutResult = await fileGateway.put(ctx, fileUrl.Ok(), {
|
165
|
-
type: bs.FPEnvelopeTypes.FILE,
|
166
|
-
payload: fileContent.block,
|
167
|
-
});
|
168
|
-
expect(filePutResult.Ok()).toBeFalsy();
|
169
|
-
});
|
170
|
-
|
171
|
-
it("should get data from File Gateway", async () => {
|
172
|
-
const fileUrl = await fileGateway.buildUrl(ctx, fileStore.url(), fileContent.cid);
|
173
|
-
await fileGateway.start(ctx, fileStore.url());
|
174
|
-
await fileGateway.put(ctx, fileUrl.Ok(), {
|
175
|
-
type: bs.FPEnvelopeTypes.FILE,
|
176
|
-
payload: fileContent.block,
|
177
|
-
});
|
178
|
-
const fileGetResult = await fileGateway.get(ctx, fileUrl.Ok());
|
179
|
-
expect(fileGetResult.Ok().type).toEqual("file");
|
180
|
-
expect(fileGetResult.Ok().payload).toEqual(fileContent.block);
|
181
|
-
});
|
182
|
-
|
183
|
-
it("should delete data from File Gateway", async () => {
|
184
|
-
const fileUrl = await fileGateway.buildUrl(ctx, fileStore.url(), fileContent.cid);
|
185
|
-
await fileGateway.start(ctx, fileStore.url());
|
186
|
-
await fileGateway.put(ctx, fileUrl.Ok(), {
|
187
|
-
type: bs.FPEnvelopeTypes.FILE,
|
188
|
-
payload: fileContent.block,
|
189
|
-
});
|
190
|
-
const fileDeleteResult = await fileGateway.delete(ctx, fileUrl.Ok());
|
191
|
-
expect(fileDeleteResult.isOk()).toBeTruthy();
|
192
|
-
});
|
193
|
-
|
194
|
-
it("should close File Gateway", async () => {
|
195
|
-
await fileGateway.close(ctx, fileStore.url());
|
196
|
-
});
|
197
|
-
it("should build WAL Gateway URL", async () => {
|
198
|
-
const testKey = "bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i";
|
199
|
-
const walUrl = await walGateway.buildUrl(ctx, walStore.url(), testKey);
|
200
|
-
expect(walUrl.Ok()).toBeTruthy();
|
201
|
-
});
|
202
|
-
|
203
|
-
it("should start WAL Gateway", async () => {
|
204
|
-
await walGateway.start(ctx, walStore.url());
|
205
|
-
});
|
206
|
-
|
207
|
-
it("should put data to WAL Gateway", async () => {
|
208
|
-
const testKey = "bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i";
|
209
|
-
const walUrl = await walGateway.buildUrl(ctx, walStore.url(), testKey);
|
210
|
-
await walGateway.start(ctx, walStore.url());
|
211
|
-
// const walTestDataString = JSON.stringify();
|
212
|
-
// const walTestData = sthis.txt.encode(walTestDataString);
|
213
|
-
const walPutResult = await walGateway.put(ctx, walUrl.Ok(), {
|
214
|
-
type: bs.FPEnvelopeTypes.WAL,
|
215
|
-
payload: {
|
216
|
-
operations: [],
|
217
|
-
noLoaderOps: [],
|
218
|
-
fileOperations: [],
|
219
|
-
},
|
220
|
-
});
|
221
|
-
expect(walPutResult.Ok()).toBeFalsy();
|
222
|
-
});
|
223
|
-
|
224
|
-
it("should get data from WAL Gateway", async () => {
|
225
|
-
const testKey = "bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i";
|
226
|
-
const walUrl = await walGateway.buildUrl(ctx, walStore.url(), testKey);
|
227
|
-
await walGateway.start(ctx, walStore.url());
|
228
|
-
const ref: bs.WALState = {
|
229
|
-
operations: [
|
230
|
-
{
|
231
|
-
cars: [await simpleCID(sthis)],
|
232
|
-
},
|
233
|
-
],
|
234
|
-
noLoaderOps: [
|
235
|
-
{
|
236
|
-
cars: [await simpleCID(sthis)],
|
237
|
-
},
|
238
|
-
],
|
239
|
-
fileOperations: [
|
240
|
-
{
|
241
|
-
cid: await simpleCID(sthis),
|
242
|
-
public: false,
|
243
|
-
},
|
244
|
-
],
|
245
|
-
};
|
246
|
-
// const walTestDataString = JSON.stringify({
|
247
|
-
// operations: [],
|
248
|
-
// noLoaderOps: [],
|
249
|
-
// fileOperations: [],
|
250
|
-
// });
|
251
|
-
// const walTestData = sthis.txt.encode(walTestDataString);
|
252
|
-
await walGateway.put(ctx, walUrl.Ok(), {
|
253
|
-
type: bs.FPEnvelopeTypes.WAL,
|
254
|
-
payload: ref,
|
255
|
-
});
|
256
|
-
const walGetResult = await walGateway.get(ctx, walUrl.Ok());
|
257
|
-
expect(walGetResult.isOk()).toBeTruthy();
|
258
|
-
// const okResult = walGetResult.Ok();
|
259
|
-
// const decodedResult = sthis.txt.decode(okResult);
|
260
|
-
expect(ref).toEqual(walGetResult.Ok().payload);
|
261
|
-
});
|
262
|
-
|
263
|
-
it("should delete data from WAL Gateway", async () => {
|
264
|
-
const testKey = "bafkreidxwt2nhvbl4fnqfw3ctlt6zbrir4kqwmjo5im6rf4q5si27kgo2i";
|
265
|
-
const walUrl = await walGateway.buildUrl(ctx, walStore.url(), testKey);
|
266
|
-
await walGateway.start(ctx, walStore.url());
|
267
|
-
const ref: bs.WALState = {
|
268
|
-
operations: [
|
269
|
-
{
|
270
|
-
cars: [await simpleCID(sthis)],
|
271
|
-
},
|
272
|
-
],
|
273
|
-
noLoaderOps: [
|
274
|
-
{
|
275
|
-
cars: [await simpleCID(sthis)],
|
276
|
-
},
|
277
|
-
],
|
278
|
-
fileOperations: [
|
279
|
-
{
|
280
|
-
cid: await simpleCID(sthis),
|
281
|
-
public: false,
|
282
|
-
},
|
283
|
-
],
|
284
|
-
};
|
285
|
-
await walGateway.put(ctx, walUrl.Ok(), {
|
286
|
-
type: bs.FPEnvelopeTypes.WAL,
|
287
|
-
payload: ref,
|
288
|
-
});
|
289
|
-
const walDeleteResult = await walGateway.delete(ctx, walUrl.Ok());
|
290
|
-
expect(walDeleteResult.isOk()).toBeTruthy();
|
291
|
-
});
|
292
|
-
|
293
|
-
it("should close WAL Gateway", async () => {
|
294
|
-
await walGateway.start(ctx, walStore.url());
|
295
|
-
await walGateway.close(ctx, walStore.url());
|
296
|
-
});
|
297
|
-
|
298
|
-
// it("should have correct CAR Gateway properties", async () =>{
|
299
|
-
// // CAR Gateway assertions
|
300
|
-
// expect(carGateway.fidLength).toBe(4);
|
301
|
-
// expect(carGateway.headerSize).toBe(36);
|
302
|
-
// carGateway.logger.Error().Msg("CAR Gateway properties");
|
303
|
-
// await sthis.logger.Flush();
|
304
|
-
// const last = sthis.ctx.logCollector.Logs().slice(-1)[0];
|
305
|
-
// expect(last).toHaveProperty("module");
|
306
|
-
// expect(carStore.).toHaveProperty("url");
|
307
|
-
// });
|
308
|
-
|
309
|
-
// it("should have correct Meta Gateway properties", async () =>{
|
310
|
-
// // Meta Gateway assertions
|
311
|
-
// expect(metaGateway.fidLength).toBe(4);
|
312
|
-
// expect(metaGateway.headerSize).toBe(36);
|
313
|
-
// metaGateway.logger.Error().Msg("CAR Gateway properties");
|
314
|
-
// await sthis.logger.Flush();
|
315
|
-
// const last = sthis.ctx.logCollector.Logs().slice(-1)[0];
|
316
|
-
// expect(last).toHaveProperty("module");
|
317
|
-
// expect(last).not.toHaveProperty("url");
|
318
|
-
// });
|
319
|
-
|
320
|
-
// it("should have correct File Gateway properties", async () =>{
|
321
|
-
// // File Gateway assertions
|
322
|
-
// expect(fileGateway.fidLength).toBe(4);
|
323
|
-
// expect(fileGateway.headerSize).toBe(36);
|
324
|
-
// fileGateway.logger.Error().Msg("CAR Gateway properties");
|
325
|
-
// await sthis.logger.Flush();
|
326
|
-
// const last = sthis.ctx.logCollector.Logs().slice(-1)[0];
|
327
|
-
// expect(last).toHaveProperty("module");
|
328
|
-
// expect(last).toHaveProperty("url");
|
329
|
-
// });
|
330
|
-
|
331
|
-
// it("should have correct WAL Gateway properties", async () =>{
|
332
|
-
// // WAL Gateway assertions
|
333
|
-
// expect(walGateway.fidLength).toBe(4);
|
334
|
-
// expect(walGateway.headerSize).toBe(36);
|
335
|
-
// walGateway.logger.Error().Msg("CAR Gateway properties");
|
336
|
-
// await sthis.logger.Flush();
|
337
|
-
// const last = sthis.ctx.logCollector.Logs().slice(-1)[0];
|
338
|
-
// expect(last).toHaveProperty("module");
|
339
|
-
// expect(last).not.toHaveProperty("url");
|
340
|
-
// });
|
341
|
-
});
|
342
|
-
|
343
|
-
describe("noop Gateway subscribe", function () {
|
344
|
-
let db: Database;
|
345
|
-
|
346
|
-
let metaStore: bs.MetaStore;
|
347
|
-
|
348
|
-
let metaGateway: bs.SerdeGateway;
|
349
|
-
const sthis = ensureSuperThis();
|
350
|
-
let ctx: bs.SerdeGatewayCtx;
|
351
|
-
|
352
|
-
afterEach(async () => {
|
353
|
-
await db.close();
|
354
|
-
await db.destroy();
|
355
|
-
});
|
356
|
-
beforeEach(async () => {
|
357
|
-
db = fireproof("test-gateway-" + sthis.nextId().str);
|
358
|
-
await db.close();
|
359
|
-
|
360
|
-
db = fireproof("test-gateway-" + sthis.nextId().str, {
|
361
|
-
storeUrls: {
|
362
|
-
...db.ledger.opts.storeUrls,
|
363
|
-
data: {
|
364
|
-
...db.ledger.opts.storeUrls.data,
|
365
|
-
meta: BuildURI.from(db.ledger.opts.storeUrls.data.meta).setParam(PARAM.SELF_REFLECT, "x").URI(),
|
366
|
-
},
|
367
|
-
},
|
368
|
-
});
|
369
|
-
|
370
|
-
await db.ready();
|
371
|
-
|
372
|
-
ctx = { loader: db.ledger.crdt.blockstore.loader };
|
373
|
-
// Extract stores from the loader
|
374
|
-
metaStore = db.ledger.crdt.blockstore.loader.attachedStores.local().active.meta;
|
375
|
-
|
376
|
-
metaGateway = metaStore.realGateway;
|
377
|
-
});
|
378
|
-
it("should subscribe to meta Gateway", async () => {
|
379
|
-
const metaUrl = await metaGateway.buildUrl(ctx, metaStore.url(), "main");
|
380
|
-
await metaGateway.start(ctx, metaStore.url());
|
381
|
-
|
382
|
-
let didCall = false;
|
383
|
-
const p = new Future<void>();
|
384
|
-
|
385
|
-
const metaSubscribeResult = (await metaGateway.subscribe(
|
386
|
-
ctx,
|
387
|
-
metaUrl.Ok().build().setParam(PARAM.SELF_REFLECT, "x").URI(),
|
388
|
-
async (data: bs.FPEnvelopeMeta) => {
|
389
|
-
// const decodedData = sthis.txt.decode(data);
|
390
|
-
expect(Array.isArray(data.payload)).toBeTruthy();
|
391
|
-
didCall = true;
|
392
|
-
p.resolve();
|
393
|
-
},
|
394
|
-
)) as bs.UnsubscribeResult;
|
395
|
-
expect(metaSubscribeResult.isOk()).toBeTruthy();
|
396
|
-
const ok = await db.put({ _id: "key1", hello: "world1" });
|
397
|
-
expect(ok).toBeTruthy();
|
398
|
-
expect(ok.id).toBe("key1");
|
399
|
-
await p.asPromise();
|
400
|
-
expect(didCall).toBeTruthy();
|
401
|
-
});
|
402
|
-
});
|
403
|
-
|
404
|
-
describe("Gateway", function () {
|
405
|
-
let db: Database;
|
406
|
-
// let carStore: ExtendedStore;
|
407
|
-
let metaStore: bs.MetaStore;
|
408
|
-
// let fileStore: ExtendedStore;
|
409
|
-
// let walStore: ExtendedStore;
|
410
|
-
// let carGateway: ExtendedGateway;
|
411
|
-
let metaGateway: bs.SerdeGateway;
|
412
|
-
// let fileGateway: ExtendedGateway;
|
413
|
-
// let walGateway: ExtendedGateway;
|
414
|
-
const sthis = ensureSuperThis();
|
415
|
-
|
416
|
-
let ctx: bs.SerdeGatewayCtx;
|
417
|
-
|
418
|
-
afterEach(async () => {
|
419
|
-
await db.close();
|
420
|
-
await db.destroy();
|
421
|
-
});
|
422
|
-
beforeEach(async () => {
|
423
|
-
db = fireproof("test-gateway-" + sthis.nextId().str);
|
424
|
-
ctx = { loader: db.ledger.crdt.blockstore.loader };
|
425
|
-
const ok = await db.put({ _id: "test", foo: "bar" });
|
426
|
-
expect(ok).toBeTruthy();
|
427
|
-
expect(ok.id).toBe("test");
|
428
|
-
|
429
|
-
// Extract stores from the loader
|
430
|
-
// carStore = (await db.blockstore.loader.carStore()) as unknown as ExtendedStore;
|
431
|
-
metaStore = db.ledger.crdt.blockstore.loader.attachedStores.local().active.meta;
|
432
|
-
// fileStore = (await db.blockstore.loader.fileStore()) as unknown as ExtendedStore;
|
433
|
-
// walStore = (await db.blockstore.loader.WALStore()) as unknown as ExtendedStore;
|
434
|
-
|
435
|
-
// Extract and log gateways
|
436
|
-
// carGateway = carStore.gateway;
|
437
|
-
metaGateway = metaStore.realGateway;
|
438
|
-
// fileGateway = fileStore.gateway;
|
439
|
-
// walGateway = walStore.gateway;
|
440
|
-
});
|
441
|
-
|
442
|
-
it("should get data from Meta Gateway", async () => {
|
443
|
-
const metaUrl = await metaGateway.buildUrl(ctx, metaStore.url(), "main");
|
444
|
-
await metaGateway.start(ctx, metaStore.url());
|
445
|
-
const metaGetResult = await metaGateway.get(ctx, metaUrl.Ok());
|
446
|
-
expect(metaGetResult.isOk()).toBeTruthy();
|
447
|
-
const meta = metaGetResult.Ok().payload as bs.DbMetaEvent[];
|
448
|
-
// const metaGetResultOk = metaGetResult.Ok();
|
449
|
-
// const decodedMetaGetResultOk = sthis.txt.decode(metaGetResultOk);
|
450
|
-
expect(meta.length).toBe(1);
|
451
|
-
expect(Object.keys(meta[0])).toEqual(["eventCid", "parents", "dbMeta"]);
|
452
|
-
});
|
453
|
-
|
454
|
-
it("should delete data from Meta Gateway", async () => {
|
455
|
-
const metaUrl = await metaGateway.buildUrl(ctx, metaStore.url(), "main");
|
456
|
-
await metaGateway.start(ctx, metaStore.url());
|
457
|
-
// should we be testing .destroy() instead?
|
458
|
-
const metaDeleteResult = await metaGateway.delete(ctx, metaUrl.Ok());
|
459
|
-
expect(metaDeleteResult.isOk()).toBeTruthy();
|
460
|
-
});
|
461
|
-
});
|