@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,152 +0,0 @@
|
|
1
|
-
import { BuildURI, runtimeFn, URI } from "@adviser/cement";
|
2
|
-
import { ensureSuperThis, PARAM, CRDTImpl, CRDT, LedgerOpts, fireproof, bs, sleep } from "@fireproof/core";
|
3
|
-
import { Link } from "multiformats";
|
4
|
-
import { stripper } from "@adviser/cement/utils";
|
5
|
-
import pLimit from "@fireproof/vendor/p-limit";
|
6
|
-
|
7
|
-
describe("standalone", () => {
|
8
|
-
const sthis = ensureSuperThis();
|
9
|
-
|
10
|
-
describe("howto-loader", () => {
|
11
|
-
// beforeAll(async () => {
|
12
|
-
// const db = fireproof("howto-loader", {
|
13
|
-
// storeUrls: {
|
14
|
-
// base: "file://dist/how-to-loader?store-key=insecure",
|
15
|
-
// },
|
16
|
-
// });
|
17
|
-
// for (let cid = 0; cid < 1; cid++) {
|
18
|
-
// const blk = new Array(3)
|
19
|
-
// .fill(0)
|
20
|
-
// .map((_, peer) => ({ _id: `test-${cid}:peer-${peer}`, value: { cid: `test-${cid}`, peer: `peer-${peer}` } }));
|
21
|
-
// await db.bulk(blk);
|
22
|
-
// }
|
23
|
-
// // await db.compact()
|
24
|
-
// await db.close();
|
25
|
-
// });
|
26
|
-
|
27
|
-
it("understand the writer", async () => {
|
28
|
-
const db = fireproof("howto-writer", {
|
29
|
-
storeUrls: {
|
30
|
-
base: "memory://how-to-writer",
|
31
|
-
},
|
32
|
-
});
|
33
|
-
await db.put({ _id: "test-1", value: { cid: "test-1", peer: "peer-1" } });
|
34
|
-
await db.close();
|
35
|
-
});
|
36
|
-
|
37
|
-
it.skip("understand loader", async () => {
|
38
|
-
const db = fireproof("howto-loader", {
|
39
|
-
storeUrls: {
|
40
|
-
base: "file://dist/how-to-loader?store-key=insecure",
|
41
|
-
},
|
42
|
-
});
|
43
|
-
const fn = vi.fn();
|
44
|
-
const loader = db.ledger.crdt.blockstore.loader as bs.Loader;
|
45
|
-
loader.cidCache.onSet(fn);
|
46
|
-
expect(fn).toHaveBeenCalledTimes(0);
|
47
|
-
await db.ready();
|
48
|
-
expect(
|
49
|
-
loader.cidCache.values().map((i) => {
|
50
|
-
const v = i.value.Ok();
|
51
|
-
return {
|
52
|
-
type: v.item.type,
|
53
|
-
cid: v.cid,
|
54
|
-
value: stripper(/(type|cid)/, v.item),
|
55
|
-
};
|
56
|
-
}),
|
57
|
-
).toEqual([]);
|
58
|
-
// let last = 0
|
59
|
-
// for (let i = 0; i < 100; i++) {
|
60
|
-
// if (last !== fn.mock.calls.length) {
|
61
|
-
// console.log("fn", i, fn.mock.calls.length);
|
62
|
-
// last = fn.mock.calls.length
|
63
|
-
// }
|
64
|
-
// await sleep(10);
|
65
|
-
// }
|
66
|
-
const ret = await db.allDocs();
|
67
|
-
expect(ret.rows.length).toBe(100);
|
68
|
-
expect(fn).toHaveBeenCalledTimes(109393);
|
69
|
-
await db.close();
|
70
|
-
});
|
71
|
-
});
|
72
|
-
|
73
|
-
describe("test-plimit", () => {
|
74
|
-
it("should work with plimit", async () => {
|
75
|
-
const limiter = pLimit(2);
|
76
|
-
let concurrent = 0;
|
77
|
-
const ret = await Promise.all(
|
78
|
-
Array(10)
|
79
|
-
.fill(0)
|
80
|
-
.map((_, i) => {
|
81
|
-
return limiter(async () => {
|
82
|
-
concurrent++;
|
83
|
-
expect(concurrent).toBeLessThanOrEqual(2);
|
84
|
-
await sleep(100);
|
85
|
-
concurrent--;
|
86
|
-
return i;
|
87
|
-
});
|
88
|
-
}),
|
89
|
-
);
|
90
|
-
expect(ret).toEqual(Array.from(Array(10).keys()));
|
91
|
-
});
|
92
|
-
});
|
93
|
-
|
94
|
-
describe.skip("crdt-stack", () => {
|
95
|
-
let crdt: CRDT;
|
96
|
-
beforeEach(async () => {
|
97
|
-
let uri: URI;
|
98
|
-
switch (true) {
|
99
|
-
case runtimeFn().isBrowser:
|
100
|
-
uri = BuildURI.from("indexeddb://standalone-peer-log").setParam(PARAM.NAME, "peer-log").URI();
|
101
|
-
break;
|
102
|
-
default:
|
103
|
-
uri = BuildURI.from("file://dist/standalone")
|
104
|
-
.setParam(PARAM.NAME, "peer-log")
|
105
|
-
.setParam(PARAM.STORE_KEY, "insecure")
|
106
|
-
.URI();
|
107
|
-
break;
|
108
|
-
}
|
109
|
-
// console.log("uri", uri.toString());
|
110
|
-
crdt = new CRDTImpl(sthis, {
|
111
|
-
name: "peer-log",
|
112
|
-
writeQueue: { chunkSize: 32 },
|
113
|
-
storeUrls: {
|
114
|
-
data: {
|
115
|
-
meta: uri.build().setParam(PARAM.STORE, "meta").setParam(PARAM.STORE_KEY, "insecure").URI(),
|
116
|
-
car: uri.build().setParam(PARAM.STORE, "car").setParam(PARAM.STORE_KEY, "insecure").URI(),
|
117
|
-
file: uri.build().setParam(PARAM.STORE, "file").setParam(PARAM.STORE_KEY, "insecure").URI(),
|
118
|
-
wal: uri.build().setParam(PARAM.STORE, "wal").setParam(PARAM.STORE_KEY, "insecure").URI(),
|
119
|
-
},
|
120
|
-
},
|
121
|
-
} as LedgerOpts);
|
122
|
-
await crdt.ready();
|
123
|
-
});
|
124
|
-
afterEach(async () => {
|
125
|
-
await crdt.close();
|
126
|
-
});
|
127
|
-
|
128
|
-
it.each(new Array(10).fill(0).map((_, i) => ({ cid: i })))("write:$cid", async ({ cid }) => {
|
129
|
-
const peers = new Array(10).fill(0).map((_, peer) => {
|
130
|
-
return { id: `test-${cid}:peer-${peer}`, value: { cid: `test-${cid}`, peer: `peer-${peer}` } };
|
131
|
-
});
|
132
|
-
await crdt.bulk(peers);
|
133
|
-
});
|
134
|
-
it("read", async () => {
|
135
|
-
for (let cid = 0; cid < 10; cid++) {
|
136
|
-
for (let peer = 0; peer < 10; peer++) {
|
137
|
-
const id = `test-${cid}:peer-${peer}`;
|
138
|
-
const res = (await crdt.get(id)) as unknown as { cid: Link; doc: { cid: string; peer: string } };
|
139
|
-
expect(res.doc).toEqual({ cid: `test-${cid}`, peer: `peer-${peer}` });
|
140
|
-
}
|
141
|
-
}
|
142
|
-
});
|
143
|
-
// for (let cid = 0; cid < 10; cid++) {
|
144
|
-
// const gte = `test-${cid}`;
|
145
|
-
// const ret = [];
|
146
|
-
// for await (const [key, link] of entries(blk, root, { gte })) {
|
147
|
-
// ret.push([key, link]);
|
148
|
-
// }
|
149
|
-
// expect(ret.length).toEqual(10);
|
150
|
-
// }
|
151
|
-
});
|
152
|
-
});
|
@@ -1,192 +0,0 @@
|
|
1
|
-
import { CID } from "multiformats";
|
2
|
-
import { rt, bs, NotFoundError, PARAM, ensureSuperThis } from "@fireproof/core";
|
3
|
-
import { Result } from "@adviser/cement";
|
4
|
-
import { mockLoader, noopUrl } from "../helpers.js";
|
5
|
-
|
6
|
-
// function runtime(sthis: SuperThis) {
|
7
|
-
// return bs.toStoreRuntime(sthis);
|
8
|
-
// }
|
9
|
-
|
10
|
-
// async function mockLoader(sthis: SuperThis, name?: string): Promise<bs.StoreFactoryItem> {
|
11
|
-
// const url = noopUrl(name);
|
12
|
-
// return {
|
13
|
-
// // sthis,
|
14
|
-
// url: url,
|
15
|
-
// loader:
|
16
|
-
// };
|
17
|
-
// }
|
18
|
-
|
19
|
-
describe("CarStore", function () {
|
20
|
-
let store: bs.CarStore;
|
21
|
-
const sthis = ensureSuperThis();
|
22
|
-
|
23
|
-
let loader: bs.Loadable;
|
24
|
-
|
25
|
-
afterEach(async () => {
|
26
|
-
await store.close();
|
27
|
-
await store.destroy();
|
28
|
-
});
|
29
|
-
|
30
|
-
beforeEach(async () => {
|
31
|
-
loader = mockLoader(sthis);
|
32
|
-
await sthis.start();
|
33
|
-
const at = await bs.createAttachedStores(noopUrl("test"), loader);
|
34
|
-
store = at.stores.car;
|
35
|
-
await store.start(at.stores);
|
36
|
-
});
|
37
|
-
|
38
|
-
it("should have a name", function () {
|
39
|
-
expect(store.url().getParam(PARAM.NAME)).toEqual("test");
|
40
|
-
});
|
41
|
-
|
42
|
-
it("should save a car", async () => {
|
43
|
-
const car: bs.AnyBlock = {
|
44
|
-
cid: "cidKey" as unknown as CID,
|
45
|
-
bytes: new Uint8Array([55, 56, 57]),
|
46
|
-
};
|
47
|
-
await store.save(car);
|
48
|
-
const data = (await store.realGateway.getPlain({ loader }, store.url(), car.cid.toString())).Ok();
|
49
|
-
expect(sthis.txt.decode(data)).toEqual(sthis.txt.decode(car.bytes));
|
50
|
-
});
|
51
|
-
});
|
52
|
-
|
53
|
-
describe("CarStore with a saved car", function () {
|
54
|
-
let store: bs.CarStore;
|
55
|
-
let car: bs.AnyBlock;
|
56
|
-
let loader: bs.Loadable;
|
57
|
-
|
58
|
-
const sthis = ensureSuperThis();
|
59
|
-
|
60
|
-
afterEach(async () => {
|
61
|
-
await store.close();
|
62
|
-
await store.destroy();
|
63
|
-
});
|
64
|
-
|
65
|
-
beforeEach(async () => {
|
66
|
-
loader = mockLoader(sthis);
|
67
|
-
await sthis.start();
|
68
|
-
|
69
|
-
const at = await bs.createAttachedStores(noopUrl("test2"), loader);
|
70
|
-
store = at.stores.car;
|
71
|
-
await store.start(at.stores);
|
72
|
-
car = {
|
73
|
-
cid: "cid" as unknown as CID,
|
74
|
-
bytes: new Uint8Array([55, 56, 57, 80]),
|
75
|
-
};
|
76
|
-
await store.save(car);
|
77
|
-
});
|
78
|
-
|
79
|
-
it("should have a car", async () => {
|
80
|
-
const data = (await store.realGateway.getPlain({ loader }, store.url(), car.cid.toString())).Ok();
|
81
|
-
expect(sthis.txt.decode(data)).toEqual(sthis.txt.decode(car.bytes));
|
82
|
-
});
|
83
|
-
|
84
|
-
it("should load a car", async () => {
|
85
|
-
const loaded = await store.load(car.cid);
|
86
|
-
expect(loaded.cid).toEqual(car.cid);
|
87
|
-
expect(loaded.bytes.constructor.name).toEqual("Uint8Array");
|
88
|
-
expect(loaded.bytes.toString()).toEqual(car.bytes.toString());
|
89
|
-
});
|
90
|
-
|
91
|
-
it("should remove a car", async () => {
|
92
|
-
await store.remove(car.cid);
|
93
|
-
const { e: error } = (await store.load(car.cid).catch((e: Error) => ({ e }))) as { e: NotFoundError };
|
94
|
-
expect(error).toBeTruthy();
|
95
|
-
});
|
96
|
-
});
|
97
|
-
|
98
|
-
describe("MetaStore", function () {
|
99
|
-
let store: bs.MetaStore;
|
100
|
-
const sthis = ensureSuperThis();
|
101
|
-
let loader: bs.Loadable;
|
102
|
-
|
103
|
-
afterEach(async () => {
|
104
|
-
await store.close();
|
105
|
-
await store.destroy();
|
106
|
-
});
|
107
|
-
|
108
|
-
beforeEach(async () => {
|
109
|
-
loader = mockLoader(sthis);
|
110
|
-
await sthis.start();
|
111
|
-
const at = await bs.createAttachedStores(noopUrl("test"), loader);
|
112
|
-
store = at.stores.meta;
|
113
|
-
await store.start(at.stores);
|
114
|
-
});
|
115
|
-
|
116
|
-
it("should have a name", function () {
|
117
|
-
expect(store.url().getParam(PARAM.NAME)).toEqual("test");
|
118
|
-
});
|
119
|
-
|
120
|
-
it("should save a header", async () => {
|
121
|
-
const cid = CID.parse("bafybeia4luuns6dgymy5kau5rm7r4qzrrzg6cglpzpogussprpy42cmcn4");
|
122
|
-
const h: bs.DbMeta = {
|
123
|
-
cars: [cid],
|
124
|
-
// key: undefined,
|
125
|
-
};
|
126
|
-
await store.save(h);
|
127
|
-
const file = await store.realGateway.getPlain({ loader }, store.url(), "main");
|
128
|
-
const blockMeta = (await rt.gw.fpDeserialize(sthis, store.url(), file)) as Result<bs.FPEnvelopeMeta>;
|
129
|
-
expect(blockMeta.Ok()).toBeTruthy();
|
130
|
-
expect(blockMeta.Ok().payload.length).toEqual(1);
|
131
|
-
const decodedHeader = blockMeta.Ok().payload[0].dbMeta;
|
132
|
-
expect(decodedHeader).toBeTruthy();
|
133
|
-
expect(decodedHeader.cars).toBeTruthy();
|
134
|
-
expect(decodedHeader.cars[0].toString()).toEqual(cid.toString());
|
135
|
-
});
|
136
|
-
});
|
137
|
-
|
138
|
-
describe("MetaStore with a saved header", function () {
|
139
|
-
let store: bs.MetaStore;
|
140
|
-
let cid: CID;
|
141
|
-
const sthis = ensureSuperThis();
|
142
|
-
let loader: bs.Loadable;
|
143
|
-
|
144
|
-
afterEach(async () => {
|
145
|
-
await store.close();
|
146
|
-
await store.destroy();
|
147
|
-
});
|
148
|
-
|
149
|
-
beforeEach(async () => {
|
150
|
-
loader = mockLoader(sthis);
|
151
|
-
await sthis.start();
|
152
|
-
const at = await bs.createAttachedStores(noopUrl("test3-meta"), loader);
|
153
|
-
store = at.stores.meta;
|
154
|
-
await store.start(at.stores);
|
155
|
-
cid = CID.parse("bafybeia4luuns6dgymy5kau5rm7r4qzrrzg6cglpzpogussprpy42cmcn4");
|
156
|
-
await store.save({ cars: [cid] /*, key: undefined */ });
|
157
|
-
});
|
158
|
-
|
159
|
-
// it("should load", async () =>{
|
160
|
-
// expect(onload).toBeTruthy();
|
161
|
-
// expect(onload?.length).toEqual(1);
|
162
|
-
// expect(onload?.[0].cars.toString()).toEqual(cid.toString());
|
163
|
-
// });
|
164
|
-
|
165
|
-
it("should have a header", async () => {
|
166
|
-
const bytes = await store.realGateway.getPlain({ loader }, store.url(), "main");
|
167
|
-
const data = sthis.txt.decode(bytes.Ok());
|
168
|
-
expect(data).toMatch(/parents/);
|
169
|
-
const header = JSON.parse(data)[0];
|
170
|
-
expect(header).toBeDefined();
|
171
|
-
expect(header.parents).toBeDefined();
|
172
|
-
// const [blockMeta] = await store.handleByteHeads(bytes);
|
173
|
-
|
174
|
-
const blockMeta = (await rt.gw.fpDeserialize(sthis, store.url(), bytes)) as Result<bs.FPEnvelopeMeta>;
|
175
|
-
expect(blockMeta.Ok()).toBeTruthy();
|
176
|
-
expect(blockMeta.Ok().payload.length).toEqual(1);
|
177
|
-
const decodedHeader = blockMeta.Ok().payload[0].dbMeta;
|
178
|
-
expect(decodedHeader).toBeDefined();
|
179
|
-
expect(decodedHeader.cars).toBeDefined();
|
180
|
-
expect(decodedHeader.cars[0].toString()).toEqual(cid.toString());
|
181
|
-
});
|
182
|
-
|
183
|
-
it("should load a header", async () => {
|
184
|
-
const metaStream = store.stream();
|
185
|
-
for await (const cars of metaStream) {
|
186
|
-
// expect(loaded).toBeTruthy();
|
187
|
-
expect(cars).toBeTruthy();
|
188
|
-
expect(cars.map((i) => i.cars.map((i) => i.toString())).flat(2)).toEqual([cid.toString()]);
|
189
|
-
break;
|
190
|
-
}
|
191
|
-
});
|
192
|
-
});
|
@@ -1,130 +0,0 @@
|
|
1
|
-
import { CID } from "multiformats";
|
2
|
-
import { BaseBlockstore, bs, CarTransaction, ensureSuperThis } from "@fireproof/core";
|
3
|
-
import { simpleBlockOpts } from "../helpers.js";
|
4
|
-
import { to_uint8 } from "@adviser/cement";
|
5
|
-
|
6
|
-
const { anyBlock2FPBlock } = bs;
|
7
|
-
|
8
|
-
describe("Fresh TransactionBlockstore", function () {
|
9
|
-
let blocks: BaseBlockstore;
|
10
|
-
const sthis = ensureSuperThis();
|
11
|
-
beforeEach(async () => {
|
12
|
-
blocks = new bs.BaseBlockstoreImpl(simpleBlockOpts(sthis));
|
13
|
-
await blocks.ready();
|
14
|
-
});
|
15
|
-
// it("should not have a name", function () {
|
16
|
-
// expect(blocks.name).toBeFalsy();
|
17
|
-
// });
|
18
|
-
// it("should not have a loader", function () {
|
19
|
-
// expect(blocks.loader).toBeFalsy();
|
20
|
-
// });
|
21
|
-
it("should not put", async () => {
|
22
|
-
const value = sthis.txt.encode("value");
|
23
|
-
const e = await blocks.put(await anyBlock2FPBlock({ cid: "key" as unknown as bs.AnyLink, bytes: value })).catch((e) => e);
|
24
|
-
expect(e.message).toMatch(/transaction/g);
|
25
|
-
});
|
26
|
-
it("should yield a transaction", async () => {
|
27
|
-
const txR = await blocks.transaction(async (tblocks) => {
|
28
|
-
expect(tblocks).toBeTruthy();
|
29
|
-
expect(tblocks instanceof bs.CarTransactionImpl).toBeTruthy();
|
30
|
-
return { head: [] };
|
31
|
-
});
|
32
|
-
expect(txR).toBeTruthy();
|
33
|
-
expect(txR.t).toBeTruthy();
|
34
|
-
expect(txR.meta).toEqual({ head: [] });
|
35
|
-
});
|
36
|
-
});
|
37
|
-
|
38
|
-
describe("TransactionBlockstore with name", function () {
|
39
|
-
let blocks: bs.EncryptedBlockstore;
|
40
|
-
const sthis = ensureSuperThis();
|
41
|
-
beforeEach(async () => {
|
42
|
-
blocks = new bs.EncryptedBlockstore(sthis, simpleBlockOpts(sthis));
|
43
|
-
await blocks.ready();
|
44
|
-
});
|
45
|
-
// it("should have a name", function () {
|
46
|
-
// expect(blocks.name).toEqual("test");
|
47
|
-
// });
|
48
|
-
it("should have a loader", function () {
|
49
|
-
expect(blocks.loader).toBeTruthy();
|
50
|
-
});
|
51
|
-
it("should get from loader", async () => {
|
52
|
-
const bytes = sthis.txt.encode("bytes");
|
53
|
-
expect(blocks.loader).toBeTruthy();
|
54
|
-
blocks.loader.getBlock = async (cid) => {
|
55
|
-
return anyBlock2FPBlock({ cid, bytes });
|
56
|
-
};
|
57
|
-
const value = await blocks.get("key" as unknown as bs.AnyAnyLink);
|
58
|
-
expect(value).toEqual({ cid: "key" as unknown as bs.AnyAnyLink, bytes });
|
59
|
-
});
|
60
|
-
});
|
61
|
-
|
62
|
-
describe("A transaction", function () {
|
63
|
-
let tblocks: CarTransaction;
|
64
|
-
let blocks: bs.EncryptedBlockstore;
|
65
|
-
const sthis = ensureSuperThis();
|
66
|
-
beforeEach(async () => {
|
67
|
-
blocks = new bs.EncryptedBlockstore(sthis, simpleBlockOpts(sthis, "test"));
|
68
|
-
tblocks = new bs.CarTransactionImpl(blocks);
|
69
|
-
blocks.transactions.add(tblocks);
|
70
|
-
});
|
71
|
-
it("should put and get", async () => {
|
72
|
-
const cid = CID.parse("bafybeia4luuns6dgymy5kau5rm7r4qzrrzg6cglpzpogussprpy42cmcn4");
|
73
|
-
const bytes = sthis.txt.encode("bytes");
|
74
|
-
await tblocks.put(await anyBlock2FPBlock({ cid, bytes }));
|
75
|
-
expect(blocks.transactions.has(tblocks)).toBeTruthy();
|
76
|
-
const got = await tblocks.get(cid);
|
77
|
-
assert(got, "missing block");
|
78
|
-
expect(got.cid).toEqual(cid);
|
79
|
-
expect(got.bytes).toEqual(bytes);
|
80
|
-
});
|
81
|
-
});
|
82
|
-
|
83
|
-
// function asUInt8Array(str: string, sthis: SuperThis) {
|
84
|
-
// return sthis.txt.encode(str);
|
85
|
-
// }
|
86
|
-
|
87
|
-
describe("TransactionBlockstore with a completed transaction", function () {
|
88
|
-
let blocks: BaseBlockstore;
|
89
|
-
let cid: CID;
|
90
|
-
let cid2: CID;
|
91
|
-
const sthis = ensureSuperThis();
|
92
|
-
|
93
|
-
beforeEach(async () => {
|
94
|
-
cid = CID.parse("bafybeia4luuns6dgymy5kau5rm7r4qzrrzg6cglpzpogussprpy42cmcn4");
|
95
|
-
cid2 = CID.parse("bafybeibgouhn5ktecpjuovt52zamzvm4dlve5ak7x6d5smms3itkhplnhm");
|
96
|
-
|
97
|
-
blocks = new bs.BaseBlockstoreImpl(simpleBlockOpts(sthis));
|
98
|
-
await blocks.transaction(async (tblocks) => {
|
99
|
-
await tblocks.put(await anyBlock2FPBlock({ cid, bytes: to_uint8("value") }));
|
100
|
-
await tblocks.put(await anyBlock2FPBlock({ cid, bytes: to_uint8("value") }));
|
101
|
-
return { head: [] };
|
102
|
-
});
|
103
|
-
await blocks.transaction(async (tblocks) => {
|
104
|
-
await tblocks.put(await anyBlock2FPBlock({ cid, bytes: to_uint8("value") }));
|
105
|
-
await tblocks.put(await anyBlock2FPBlock({ cid: cid2, bytes: to_uint8("value2") }));
|
106
|
-
return { head: [] };
|
107
|
-
});
|
108
|
-
});
|
109
|
-
it("should have transactions", async () => {
|
110
|
-
const ts = blocks.transactions;
|
111
|
-
expect(ts.size).toEqual(2);
|
112
|
-
});
|
113
|
-
it("should get", async () => {
|
114
|
-
const value = (await blocks.get(cid)) as bs.AnyBlock;
|
115
|
-
expect(value.cid).toEqual(cid);
|
116
|
-
expect(value.bytes.toString()).toEqual(to_uint8("value").toString());
|
117
|
-
|
118
|
-
const value2 = (await blocks.get(cid2)) as bs.AnyBlock;
|
119
|
-
expect(value2.bytes.toString()).toEqual(to_uint8("value2").toString());
|
120
|
-
});
|
121
|
-
it("should yield entries", async () => {
|
122
|
-
const blz = [];
|
123
|
-
for await (const blk of blocks.entries()) {
|
124
|
-
blz.push(blk);
|
125
|
-
}
|
126
|
-
expect(blz.length).toEqual(2);
|
127
|
-
});
|
128
|
-
});
|
129
|
-
|
130
|
-
// test compact
|