@fireproof/core 0.20.0-dev-preview-20 → 0.20.0-dev-preview-22
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/deno.json +7 -2
- package/index.cjs +12 -12
- package/index.cjs.map +1 -1
- package/index.d.cts +2 -2
- package/index.d.ts +2 -2
- package/index.js +12 -12
- package/index.js.map +1 -1
- package/indexeddb/index.cjs +1 -1
- package/indexeddb/index.cjs.map +1 -1
- package/indexeddb/index.js +1 -1
- package/indexeddb/index.js.map +1 -1
- package/indexeddb/metafile-cjs.json +1 -1
- package/indexeddb/metafile-esm.json +1 -1
- package/metafile-cjs.json +1 -1
- package/metafile-esm.json +1 -1
- package/package.json +8 -3
- package/react/index.cjs +1 -1
- package/react/index.cjs.map +1 -1
- package/react/index.js +1 -1
- package/react/index.js.map +1 -1
- package/react/metafile-cjs.json +1 -1
- package/react/metafile-esm.json +1 -1
- package/tests/blockstore/keyed-crypto.test.ts +1 -1
- package/tests/blockstore/loader.test.ts +1 -1
package/metafile-esm.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"inputs":{"src/types.ts":{"bytes":16143,"imports":[],"format":"esm"},"src/utils.ts":{"bytes":12062,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/types.ts","kind":"import-statement","original":"./types.js"},{"path":"multiformats/bases/base58","kind":"import-statement","external":true}],"format":"esm"},"src/write-queue.ts":{"bytes":3208,"imports":[{"path":"src/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"./types.js","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true}],"format":"esm"},"src/runtime/files.ts":{"bytes":2391,"imports":[{"path":"@ipld/unixfs","kind":"import-statement","external":true},{"path":"multiformats/codecs/raw","kind":"import-statement","external":true},{"path":"@ipld/unixfs/file/chunker/fixed","kind":"import-statement","external":true},{"path":"@ipld/unixfs/file/layout/balanced","kind":"import-statement","external":true},{"path":"../types.js","kind":"import-statement","external":true},{"path":"@fireproof/vendor/ipfs-unixfs-exporter","kind":"import-statement","external":true},{"path":"../blockstore/index.js","kind":"import-statement","external":true}],"format":"esm"},"src/runtime/gateways/file/sys-file-system-factory.ts":{"bytes":502,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@fireproof/core/node","kind":"dynamic-import","external":true},{"path":"@fireproof/core/deno","kind":"dynamic-import","external":true}],"format":"esm"},"src/runtime/gateways/file/key-bag-file.ts":{"bytes":1699,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"../../../types.js","kind":"import-statement","external":true},{"path":"../../key-bag.js","kind":"import-statement","external":true},{"path":"src/utils.ts","kind":"import-statement","original":"../../../utils.js"},{"path":"src/runtime/gateways/file/sys-file-system-factory.ts","kind":"import-statement","original":"./sys-file-system-factory.js"}],"format":"esm"},"src/runtime/key-bag-memory.ts":{"bytes":903,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"./key-bag.js","kind":"import-statement","external":true},{"path":"../types.js","kind":"import-statement","external":true}],"format":"esm"},"src/runtime/key-bag.ts":{"bytes":9039,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"../blockstore/types.js","kind":"import-statement","external":true},{"path":"src/utils.ts","kind":"import-statement","original":"../utils.js"},{"path":"multiformats/bases/base58","kind":"import-statement","external":true},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"src/runtime/gateways/file/key-bag-file.ts","kind":"import-statement","original":"./gateways/file/key-bag-file.js"},{"path":"src/runtime/key-bag-memory.ts","kind":"import-statement","original":"./key-bag-memory.js"},{"path":"@fireproof/core/indexeddb","kind":"dynamic-import","external":true}],"format":"esm"},"src/runtime/gateways/file/version.ts":{"bytes":47,"imports":[],"format":"esm"},"src/runtime/gateways/indexeddb-version.ts":{"bytes":52,"imports":[],"format":"esm"},"src/runtime/gateways/file/utils.ts":{"bytes":1328,"imports":[{"path":"@fireproof/core","kind":"import-statement","external":true}],"format":"esm"},"src/runtime/gateways/file/gateway-impl.ts":{"bytes":5435,"imports":[{"path":"src/runtime/gateways/file/version.ts","kind":"import-statement","original":"./version.js"},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/runtime/gateways/file/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"src/types.ts","kind":"import-statement","original":"../../../types.js"},{"path":"src/utils.ts","kind":"import-statement","original":"../../../utils.js"}],"format":"esm"},"src/runtime/gateways/memory/version.ts":{"bytes":46,"imports":[],"format":"esm"},"src/runtime/gateways/memory/gateway.ts":{"bytes":2075,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"../../../blockstore/gateway.js","kind":"import-statement","external":true},{"path":"src/types.ts","kind":"import-statement","original":"../../../types.js"},{"path":"src/runtime/gateways/memory/version.ts","kind":"import-statement","original":"./version.js"},{"path":"src/utils.ts","kind":"import-statement","original":"../../../utils.js"},{"path":"../../../blockstore/serde-gateway.js","kind":"import-statement","external":true}],"format":"esm"},"src/blockstore/fp-envelope.ts":{"bytes":4329,"imports":[{"path":"multiformats","kind":"import-statement","external":true},{"path":"./types.js","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true}],"format":"esm"},"src/runtime/gateways/fp-envelope-serialize.ts":{"bytes":9500,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/blockstore/fp-envelope.ts","kind":"import-statement","original":"../../blockstore/fp-envelope.js"},{"path":"src/types.ts","kind":"import-statement","original":"../../types.js"},{"path":"@fireproof/vendor/@web3-storage/pail/clock","kind":"import-statement","external":true},{"path":"multiformats/bases/base64","kind":"import-statement","external":true},{"path":"multiformats","kind":"import-statement","external":true},{"path":"multiformats/link","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@ipld/dag-json","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/clock/api","kind":"import-statement","external":true},{"path":"src/utils.ts","kind":"import-statement","original":"../../utils.js"}],"format":"esm"},"src/runtime/gateways/def-serde-gateway.ts":{"bytes":3183,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/blockstore/fp-envelope.ts","kind":"import-statement","original":"../../blockstore/fp-envelope.js"},{"path":"src/runtime/gateways/fp-envelope-serialize.ts","kind":"import-statement","original":"./fp-envelope-serialize.js"}],"format":"esm"},"src/blockstore/register-store-protocol.ts":{"bytes":5266,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"src/runtime/gateways/file/version.ts","kind":"import-statement","original":"../runtime/gateways/file/version.js"},{"path":"src/runtime/gateways/indexeddb-version.ts","kind":"import-statement","original":"../runtime/gateways/indexeddb-version.js"},{"path":"src/runtime/gateways/file/gateway-impl.ts","kind":"import-statement","original":"../runtime/gateways/file/gateway-impl.js"},{"path":"src/runtime/gateways/memory/gateway.ts","kind":"import-statement","original":"../runtime/gateways/memory/gateway.js"},{"path":"src/runtime/gateways/file/sys-file-system-factory.ts","kind":"import-statement","original":"../runtime/gateways/file/sys-file-system-factory.js"},{"path":"src/runtime/gateways/def-serde-gateway.ts","kind":"import-statement","original":"../runtime/gateways/def-serde-gateway.js"},{"path":"@fireproof/core/indexeddb","kind":"dynamic-import","external":true}],"format":"esm"},"src/runtime/wait-pr-multiformats/block.ts":{"bytes":3974,"imports":[{"path":"multiformats","kind":"import-statement","external":true},{"path":"multiformats/block","kind":"import-statement","external":true},{"path":"./codec-interface.js","kind":"import-statement","external":true}],"format":"esm"},"src/indexer-helpers.ts":{"bytes":7613,"imports":[{"path":"src/runtime/wait-pr-multiformats/block.ts","kind":"import-statement","original":"./runtime/wait-pr-multiformats/block.js"},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@ipld/dag-cbor","kind":"import-statement","external":true},{"path":"charwise","kind":"import-statement","external":true},{"path":"prolly-trees/db-index","kind":"import-statement","external":true},{"path":"prolly-trees/utils","kind":"import-statement","external":true},{"path":"prolly-trees/cache","kind":"import-statement","external":true},{"path":"prolly-trees/db-index","kind":"import-statement","external":true},{"path":"./types.js","kind":"import-statement","external":true},{"path":"./blockstore/index.js","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true}],"format":"esm"},"src/indexer.ts":{"bytes":11892,"imports":[{"path":"src/types.ts","kind":"import-statement","original":"./types.js"},{"path":"src/indexer-helpers.ts","kind":"import-statement","original":"./indexer-helpers.js"},{"path":"src/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"@adviser/cement","kind":"import-statement","external":true}],"format":"esm"},"src/database.ts":{"bytes":5135,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/indexer.ts","kind":"import-statement","original":"./indexer.js"},{"path":"src/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"src/utils.ts","kind":"import-statement","original":"./utils.js"}],"format":"esm"},"src/blockstore/types.ts":{"bytes":13828,"imports":[{"path":"../types.js","kind":"import-statement","external":true},{"path":"./transaction.js","kind":"import-statement","external":true},{"path":"./commit-queue.js","kind":"import-statement","external":true},{"path":"../runtime/key-bag.js","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/clock","kind":"import-statement","external":true},{"path":"./task-manager.js","kind":"import-statement","external":true},{"path":"./serde-gateway.js","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@ipld/car","kind":"import-statement","external":true},{"path":"../context.js","kind":"import-statement","external":true}],"format":"esm"},"src/blockstore/loader-helpers.ts":{"bytes":2137,"imports":[{"path":"src/runtime/wait-pr-multiformats/block.ts","kind":"import-statement","original":"../runtime/wait-pr-multiformats/block.js"},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@ipld/dag-cbor","kind":"import-statement","external":true},{"path":"./types.js","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@ipld/car/reader","kind":"import-statement","external":true}],"format":"esm"},"src/blockstore/transaction.ts":{"bytes":10479,"imports":[{"path":"@fireproof/vendor/@web3-storage/pail/block","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/api","kind":"import-statement","external":true},{"path":"./types.js","kind":"import-statement","external":true},{"path":"src/blockstore/loader.ts","kind":"import-statement","original":"./loader.js"},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"src/blockstore/store-factory.ts","kind":"import-statement","original":"./store-factory.js"},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/utils.ts","kind":"import-statement","original":"../utils.js"}],"format":"esm"},"src/blockstore/commit-queue.ts":{"bytes":1375,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true}],"format":"esm"},"src/blockstore/commitor.ts":{"bytes":6253,"imports":[{"path":"../types.js","kind":"import-statement","external":true},{"path":"src/blockstore/types.ts","kind":"import-statement","original":"./types.js"},{"path":"@fireproof/vendor/@ipld/car/buffer-writer","kind":"import-statement","external":true},{"path":"multiformats","kind":"import-statement","external":true},{"path":"src/runtime/wait-pr-multiformats/block.ts","kind":"import-statement","original":"../runtime/wait-pr-multiformats/block.js"},{"path":"../runtime/wait-pr-multiformats/codec-interface.js","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@ipld/dag-cbor","kind":"import-statement","external":true},{"path":"src/blockstore/transaction.ts","kind":"import-statement","original":"./transaction.js"}],"format":"esm"},"src/blockstore/task-manager.ts":{"bytes":2098,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/utils.ts","kind":"import-statement","original":"../utils.js"},{"path":"../types.js","kind":"import-statement","external":true}],"format":"esm"},"src/blockstore/loader.ts":{"bytes":17090,"imports":[{"path":"p-limit","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@ipld/car/reader","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"./types.js","kind":"import-statement","external":true},{"path":"src/blockstore/loader-helpers.ts","kind":"import-statement","original":"./loader-helpers.js"},{"path":"src/blockstore/transaction.ts","kind":"import-statement","original":"./transaction.js"},{"path":"src/blockstore/commit-queue.ts","kind":"import-statement","original":"./commit-queue.js"},{"path":"src/runtime/key-bag.ts","kind":"import-statement","original":"../runtime/key-bag.js"},{"path":"src/blockstore/commitor.ts","kind":"import-statement","original":"./commitor.js"},{"path":"src/runtime/wait-pr-multiformats/block.ts","kind":"import-statement","original":"../runtime/wait-pr-multiformats/block.js"},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"src/blockstore/task-manager.ts","kind":"import-statement","original":"./task-manager.js"}],"format":"esm"},"src/runtime/keyed-crypto.ts":{"bytes":7496,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"../blockstore/index.js","kind":"import-statement","external":true},{"path":"src/utils.ts","kind":"import-statement","original":"../utils.js"},{"path":"./key-bag.js","kind":"import-statement","external":true},{"path":"multiformats/bases/base58","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@fireproof/vendor/cborg","kind":"import-statement","external":true},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"}],"format":"esm"},"src/blockstore/interceptor-gateway.ts":{"bytes":5562,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"./fp-envelope.js","kind":"import-statement","external":true}],"format":"esm"},"src/blockstore/store.ts":{"bytes":20825,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"./serde-gateway.js","kind":"import-statement","external":true},{"path":"src/utils.ts","kind":"import-statement","original":"../utils.js"},{"path":"src/blockstore/loader.ts","kind":"import-statement","original":"./loader.js"},{"path":"src/blockstore/commit-queue.ts","kind":"import-statement","original":"./commit-queue.js"},{"path":"src/runtime/keyed-crypto.ts","kind":"import-statement","original":"../runtime/keyed-crypto.js"},{"path":"src/blockstore/fp-envelope.ts","kind":"import-statement","original":"./fp-envelope.js"},{"path":"@fireproof/vendor/@web3-storage/pail/clock/api","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/clock","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@ipld/dag-json","kind":"import-statement","external":true},{"path":"p-retry","kind":"import-statement","external":true},{"path":"p-map","kind":"import-statement","external":true},{"path":"multiformats","kind":"import-statement","external":true},{"path":"src/blockstore/interceptor-gateway.ts","kind":"import-statement","original":"./interceptor-gateway.js"}],"format":"esm"},"src/blockstore/store-factory.ts":{"bytes":6146,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/runtime/files.ts","kind":"import-statement","original":"../runtime/files.js"},{"path":"src/blockstore/store.ts","kind":"import-statement","original":"./store.js"},{"path":"./types.js","kind":"import-statement","external":true},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"src/blockstore/register-store-protocol.ts","kind":"import-statement","original":"./register-store-protocol.js"},{"path":"./serde-gateway.js","kind":"import-statement","external":true}],"format":"esm"},"src/blockstore/serde-gateway.ts":{"bytes":4290,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"../utils.js","kind":"import-statement","external":true},{"path":"./fp-envelope.js","kind":"import-statement","external":true},{"path":"./types.js","kind":"import-statement","external":true},{"path":"../runtime/gateways/fp-envelope-serialize.js","kind":"import-statement","external":true}],"format":"esm"},"src/blockstore/gateway.ts":{"bytes":1431,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true}],"format":"esm"},"src/blockstore/store-remote.ts":{"bytes":1861,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/blockstore/store.ts","kind":"import-statement","original":"./store.js"},{"path":"../types.js","kind":"import-statement","external":true}],"format":"esm"},"src/context.ts":{"bytes":407,"imports":[],"format":"esm"},"src/blockstore/connection-base.ts":{"bytes":6248,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"./task-manager.js","kind":"import-statement","external":true},{"path":"src/blockstore/store-remote.ts","kind":"import-statement","original":"./store-remote.js"},{"path":"src/blockstore/store-factory.ts","kind":"import-statement","original":"./store-factory.js"},{"path":"src/context.ts","kind":"import-statement","original":"../context.js"}],"format":"esm"},"src/blockstore/index.ts":{"bytes":771,"imports":[{"path":"src/blockstore/types.ts","kind":"import-statement","original":"./types.js"},{"path":"src/blockstore/store-factory.ts","kind":"import-statement","original":"./store-factory.js"},{"path":"src/blockstore/serde-gateway.ts","kind":"import-statement","original":"./serde-gateway.js"},{"path":"src/blockstore/gateway.ts","kind":"import-statement","original":"./gateway.js"},{"path":"src/blockstore/fp-envelope.ts","kind":"import-statement","original":"./fp-envelope.js"},{"path":"src/blockstore/store-factory.ts","kind":"import-statement","original":"./store-factory.js"},{"path":"src/blockstore/interceptor-gateway.ts","kind":"import-statement","original":"./interceptor-gateway.js"},{"path":"src/blockstore/store.ts","kind":"import-statement","original":"./store.js"},{"path":"src/blockstore/register-store-protocol.ts","kind":"import-statement","original":"./register-store-protocol.js"},{"path":"src/blockstore/transaction.ts","kind":"import-statement","original":"./transaction.js"},{"path":"src/blockstore/loader.ts","kind":"import-statement","original":"./loader.js"},{"path":"src/blockstore/loader-helpers.ts","kind":"import-statement","original":"./loader-helpers.js"},{"path":"src/blockstore/connection-base.ts","kind":"import-statement","original":"./connection-base.js"}],"format":"esm"},"src/crdt-helpers.ts":{"bytes":12549,"imports":[{"path":"src/runtime/wait-pr-multiformats/block.ts","kind":"import-statement","original":"./runtime/wait-pr-multiformats/block.js"},{"path":"multiformats/link","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@ipld/dag-cbor","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/crdt","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/crdt/api","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/clock","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/crdt/batch","kind":"import-statement","external":true},{"path":"./blockstore/index.js","kind":"import-statement","external":true},{"path":"src/types.ts","kind":"import-statement","original":"./types.js"},{"path":"@fireproof/vendor/@web3-storage/pail/crdt/api","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/blockstore/transaction.ts","kind":"import-statement","original":"./blockstore/transaction.js"}],"format":"esm"},"src/apply-head-queue.ts":{"bytes":2240,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"./types.js","kind":"import-statement","external":true}],"format":"esm"},"src/crdt-clock.ts":{"bytes":5766,"imports":[{"path":"@fireproof/vendor/@web3-storage/pail/clock","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/crdt","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/crdt-helpers.ts","kind":"import-statement","original":"./crdt-helpers.js"},{"path":"src/apply-head-queue.ts","kind":"import-statement","original":"./apply-head-queue.js"},{"path":"src/utils.ts","kind":"import-statement","original":"./utils.js"}],"format":"esm"},"src/crdt.ts":{"bytes":6275,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/blockstore/index.ts","kind":"import-statement","original":"./blockstore/index.js"},{"path":"src/crdt-helpers.ts","kind":"import-statement","original":"./crdt-helpers.js"},{"path":"src/indexer.ts","kind":"import-statement","original":"./indexer.js"},{"path":"src/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"src/crdt-clock.ts","kind":"import-statement","original":"./crdt-clock.js"}],"format":"esm"},"src/ledger.ts":{"bytes":9772,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/write-queue.ts","kind":"import-statement","original":"./write-queue.js"},{"path":"src/types.ts","kind":"import-statement","original":"./types.js"},{"path":"./blockstore/index.js","kind":"import-statement","external":true},{"path":"src/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"src/runtime/files.ts","kind":"import-statement","original":"./runtime/files.js"},{"path":"src/runtime/key-bag.ts","kind":"import-statement","original":"./runtime/key-bag.js"},{"path":"src/blockstore/register-store-protocol.ts","kind":"import-statement","original":"./blockstore/register-store-protocol.js"},{"path":"src/database.ts","kind":"import-statement","original":"./database.js"},{"path":"src/crdt.ts","kind":"import-statement","original":"./crdt.js"},{"path":"src/context.ts","kind":"import-statement","original":"./context.js"}],"format":"esm"},"src/runtime/wait-pr-multiformats/codec-interface.ts":{"bytes":665,"imports":[],"format":"esm"},"src/runtime/wait-pr-multiformats/index.ts":{"bytes":84,"imports":[{"path":"src/runtime/wait-pr-multiformats/block.ts","kind":"import-statement","original":"./block.js"},{"path":"src/runtime/wait-pr-multiformats/codec-interface.ts","kind":"import-statement","original":"./codec-interface.js"}],"format":"esm"},"src/runtime/gateways/file/index.ts":{"bytes":81,"imports":[{"path":"src/runtime/gateways/file/key-bag-file.ts","kind":"import-statement","original":"./key-bag-file.js"},{"path":"src/runtime/gateways/file/sys-file-system-factory.ts","kind":"import-statement","original":"./sys-file-system-factory.js"}],"format":"esm"},"src/runtime/gateways/index.ts":{"bytes":172,"imports":[{"path":"src/runtime/gateways/fp-envelope-serialize.ts","kind":"import-statement","original":"./fp-envelope-serialize.js"},{"path":"src/runtime/gateways/file/index.ts","kind":"import-statement","original":"./file/index.js"},{"path":"src/runtime/gateways/memory/gateway.ts","kind":"import-statement","original":"./memory/gateway.js"},{"path":"src/runtime/gateways/def-serde-gateway.ts","kind":"import-statement","original":"./def-serde-gateway.js"}],"format":"esm"},"src/runtime/index.ts":{"bytes":624,"imports":[{"path":"src/runtime/gateways/file/utils.ts","kind":"import-statement","original":"./gateways/file/utils.js"},{"path":"src/runtime/files.ts","kind":"import-statement","original":"./files.js"},{"path":"src/runtime/key-bag.ts","kind":"import-statement","original":"./key-bag.js"},{"path":"src/runtime/keyed-crypto.ts","kind":"import-statement","original":"./keyed-crypto.js"},{"path":"src/runtime/wait-pr-multiformats/index.ts","kind":"import-statement","original":"./wait-pr-multiformats/index.js"},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/runtime/gateways/index.ts","kind":"import-statement","original":"./gateways/index.js"},{"path":"src/runtime/key-bag.ts","kind":"import-statement","original":"./key-bag.js"},{"path":"src/runtime/gateways/file/version.ts","kind":"import-statement","original":"./gateways/file/version.js"},{"path":"src/runtime/gateways/indexeddb-version.ts","kind":"import-statement","original":"./gateways/indexeddb-version.js"}],"format":"esm"},"src/version.ts":{"bytes":97,"imports":[],"format":"esm"},"src/index.ts":{"bytes":455,"imports":[{"path":"src/ledger.ts","kind":"import-statement","original":"./ledger.js"},{"path":"src/database.ts","kind":"import-statement","original":"./database.js"},{"path":"src/types.ts","kind":"import-statement","original":"./types.js"},{"path":"src/crdt.ts","kind":"import-statement","original":"./crdt.js"},{"path":"src/indexer.ts","kind":"import-statement","original":"./indexer.js"},{"path":"src/write-queue.ts","kind":"import-statement","original":"./write-queue.js"},{"path":"src/blockstore/index.ts","kind":"import-statement","original":"./blockstore/index.js"},{"path":"src/blockstore/index.ts","kind":"import-statement","original":"./blockstore/index.js"},{"path":"src/runtime/index.ts","kind":"import-statement","original":"./runtime/index.js"},{"path":"src/runtime/index.ts","kind":"import-statement","original":"./runtime/index.js"},{"path":"src/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"src/version.ts","kind":"import-statement","original":"./version.js"}],"format":"esm"}},"outputs":{"dist/fireproof-core/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":374654},"dist/fireproof-core/index.js":{"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"multiformats/bases/base58","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@ipld/unixfs","kind":"import-statement","external":true},{"path":"multiformats/codecs/raw","kind":"import-statement","external":true},{"path":"@ipld/unixfs/file/chunker/fixed","kind":"import-statement","external":true},{"path":"@ipld/unixfs/file/layout/balanced","kind":"import-statement","external":true},{"path":"@fireproof/vendor/ipfs-unixfs-exporter","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"multiformats/bases/base58","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@fireproof/core/node","kind":"dynamic-import","external":true},{"path":"@fireproof/core/deno","kind":"dynamic-import","external":true},{"path":"@fireproof/core/indexeddb","kind":"dynamic-import","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@fireproof/core","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/clock","kind":"import-statement","external":true},{"path":"multiformats/bases/base64","kind":"import-statement","external":true},{"path":"multiformats","kind":"import-statement","external":true},{"path":"multiformats/link","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@ipld/dag-json","kind":"import-statement","external":true},{"path":"@fireproof/core/indexeddb","kind":"dynamic-import","external":true},{"path":"multiformats","kind":"import-statement","external":true},{"path":"multiformats/block","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@ipld/dag-cbor","kind":"import-statement","external":true},{"path":"charwise","kind":"import-statement","external":true},{"path":"prolly-trees/db-index","kind":"import-statement","external":true},{"path":"prolly-trees/utils","kind":"import-statement","external":true},{"path":"prolly-trees/cache","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"p-limit","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@ipld/car/reader","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@ipld/dag-cbor","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/block","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@ipld/car/buffer-writer","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@ipld/dag-cbor","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"multiformats/bases/base58","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@fireproof/vendor/cborg","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/clock","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@ipld/dag-json","kind":"import-statement","external":true},{"path":"p-retry","kind":"import-statement","external":true},{"path":"p-map","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"multiformats/link","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@ipld/dag-cbor","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/crdt","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/clock","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/crdt/batch","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/clock","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/crdt","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true}],"exports":["CRDTImpl","DatabaseImpl","Index","LedgerFactory","LedgerShell","NotFoundError","PACKAGE_VERSION","PARAM","UInt8ArrayEqual","blockstore","bs","coerceIntoUint8","coercePromiseIntoUint8","defaultWriteQueueOpts","ensureLogger","ensureSuperLog","ensureSuperThis","exceptionWrapper","falsyToUndef","fireproof","getKey","getName","getStore","index","inplaceFilter","isDatabase","isFalsy","isLedger","isNotFoundError","keyConfigOpts","makeName","onSuperThis","rt","runtime","throwFalsy","toSortedArray","toStoreURIRuntime"],"entryPoint":"src/index.ts","inputs":{"src/ledger.ts":{"bytesInOutput":7279},"src/utils.ts":{"bytesInOutput":8948},"src/types.ts":{"bytesInOutput":925},"src/write-queue.ts":{"bytesInOutput":2074},"src/runtime/files.ts":{"bytesInOutput":2074},"src/runtime/key-bag.ts":{"bytesInOutput":6894},"src/runtime/gateways/file/sys-file-system-factory.ts":{"bytesInOutput":404},"src/runtime/gateways/file/key-bag-file.ts":{"bytesInOutput":1052},"src/runtime/key-bag-memory.ts":{"bytesInOutput":557},"src/blockstore/register-store-protocol.ts":{"bytesInOutput":2925},"src/runtime/gateways/file/version.ts":{"bytesInOutput":38},"src/runtime/gateways/indexeddb-version.ts":{"bytesInOutput":43},"src/runtime/gateways/file/gateway-impl.ts":{"bytesInOutput":4247},"src/runtime/gateways/file/utils.ts":{"bytesInOutput":764},"src/runtime/gateways/memory/gateway.ts":{"bytesInOutput":1530},"src/runtime/gateways/memory/version.ts":{"bytesInOutput":37},"src/runtime/gateways/def-serde-gateway.ts":{"bytesInOutput":1976},"src/blockstore/fp-envelope.ts":{"bytesInOutput":499},"src/runtime/gateways/fp-envelope-serialize.ts":{"bytesInOutput":5281},"src/runtime/wait-pr-multiformats/block.ts":{"bytesInOutput":2131},"src/indexer-helpers.ts":{"bytesInOutput":4031},"src/indexer.ts":{"bytesInOutput":8173},"src/database.ts":{"bytesInOutput":3408},"src/crdt.ts":{"bytesInOutput":4107},"src/blockstore/index.ts":{"bytesInOutput":1065},"src/blockstore/types.ts":{"bytesInOutput":444},"src/blockstore/store-factory.ts":{"bytesInOutput":4134},"src/blockstore/store.ts":{"bytesInOutput":16527},"src/blockstore/loader.ts":{"bytesInOutput":13370},"src/blockstore/loader-helpers.ts":{"bytesInOutput":560},"src/blockstore/transaction.ts":{"bytesInOutput":6899},"src/blockstore/commit-queue.ts":{"bytesInOutput":1239},"src/blockstore/commitor.ts":{"bytesInOutput":3563},"src/blockstore/task-manager.ts":{"bytesInOutput":1622},"src/runtime/keyed-crypto.ts":{"bytesInOutput":5501},"src/blockstore/interceptor-gateway.ts":{"bytesInOutput":3773},"src/blockstore/connection-base.ts":{"bytesInOutput":4414},"src/blockstore/store-remote.ts":{"bytesInOutput":272},"src/context.ts":{"bytesInOutput":236},"src/crdt-helpers.ts":{"bytesInOutput":8595},"src/crdt-clock.ts":{"bytesInOutput":4416},"src/apply-head-queue.ts":{"bytesInOutput":1260},"src/index.ts":{"bytesInOutput":0},"src/runtime/index.ts":{"bytesInOutput":678},"src/runtime/wait-pr-multiformats/index.ts":{"bytesInOutput":153},"src/runtime/wait-pr-multiformats/codec-interface.ts":{"bytesInOutput":34},"src/runtime/gateways/index.ts":{"bytesInOutput":340},"src/runtime/gateways/file/index.ts":{"bytesInOutput":151},"src/version.ts":{"bytesInOutput":77}},"bytes":151633}}}
|
1
|
+
{"inputs":{"src/types.ts":{"bytes":16143,"imports":[],"format":"esm"},"src/utils.ts":{"bytes":12062,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/types.ts","kind":"import-statement","original":"./types.js"},{"path":"multiformats/bases/base58","kind":"import-statement","external":true}],"format":"esm"},"src/write-queue.ts":{"bytes":3208,"imports":[{"path":"src/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"./types.js","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true}],"format":"esm"},"src/runtime/files.ts":{"bytes":2373,"imports":[{"path":"@ipld/unixfs","kind":"import-statement","external":true},{"path":"multiformats/codecs/raw","kind":"import-statement","external":true},{"path":"@ipld/unixfs/file/chunker/fixed","kind":"import-statement","external":true},{"path":"@ipld/unixfs/file/layout/balanced","kind":"import-statement","external":true},{"path":"../types.js","kind":"import-statement","external":true},{"path":"ipfs-unixfs-exporter","kind":"import-statement","external":true},{"path":"../blockstore/index.js","kind":"import-statement","external":true}],"format":"esm"},"src/runtime/gateways/file/sys-file-system-factory.ts":{"bytes":502,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@fireproof/core/node","kind":"dynamic-import","external":true},{"path":"@fireproof/core/deno","kind":"dynamic-import","external":true}],"format":"esm"},"src/runtime/gateways/file/key-bag-file.ts":{"bytes":1699,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"../../../types.js","kind":"import-statement","external":true},{"path":"../../key-bag.js","kind":"import-statement","external":true},{"path":"src/utils.ts","kind":"import-statement","original":"../../../utils.js"},{"path":"src/runtime/gateways/file/sys-file-system-factory.ts","kind":"import-statement","original":"./sys-file-system-factory.js"}],"format":"esm"},"src/runtime/key-bag-memory.ts":{"bytes":903,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"./key-bag.js","kind":"import-statement","external":true},{"path":"../types.js","kind":"import-statement","external":true}],"format":"esm"},"src/runtime/key-bag.ts":{"bytes":9039,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"../blockstore/types.js","kind":"import-statement","external":true},{"path":"src/utils.ts","kind":"import-statement","original":"../utils.js"},{"path":"multiformats/bases/base58","kind":"import-statement","external":true},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"src/runtime/gateways/file/key-bag-file.ts","kind":"import-statement","original":"./gateways/file/key-bag-file.js"},{"path":"src/runtime/key-bag-memory.ts","kind":"import-statement","original":"./key-bag-memory.js"},{"path":"@fireproof/core/indexeddb","kind":"dynamic-import","external":true}],"format":"esm"},"src/runtime/gateways/file/version.ts":{"bytes":47,"imports":[],"format":"esm"},"src/runtime/gateways/indexeddb-version.ts":{"bytes":52,"imports":[],"format":"esm"},"src/runtime/gateways/file/utils.ts":{"bytes":1328,"imports":[{"path":"@fireproof/core","kind":"import-statement","external":true}],"format":"esm"},"src/runtime/gateways/file/gateway-impl.ts":{"bytes":5435,"imports":[{"path":"src/runtime/gateways/file/version.ts","kind":"import-statement","original":"./version.js"},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/runtime/gateways/file/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"src/types.ts","kind":"import-statement","original":"../../../types.js"},{"path":"src/utils.ts","kind":"import-statement","original":"../../../utils.js"}],"format":"esm"},"src/runtime/gateways/memory/version.ts":{"bytes":46,"imports":[],"format":"esm"},"src/runtime/gateways/memory/gateway.ts":{"bytes":2075,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"../../../blockstore/gateway.js","kind":"import-statement","external":true},{"path":"src/types.ts","kind":"import-statement","original":"../../../types.js"},{"path":"src/runtime/gateways/memory/version.ts","kind":"import-statement","original":"./version.js"},{"path":"src/utils.ts","kind":"import-statement","original":"../../../utils.js"},{"path":"../../../blockstore/serde-gateway.js","kind":"import-statement","external":true}],"format":"esm"},"src/blockstore/fp-envelope.ts":{"bytes":4329,"imports":[{"path":"multiformats","kind":"import-statement","external":true},{"path":"./types.js","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true}],"format":"esm"},"src/runtime/gateways/fp-envelope-serialize.ts":{"bytes":9482,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/blockstore/fp-envelope.ts","kind":"import-statement","original":"../../blockstore/fp-envelope.js"},{"path":"src/types.ts","kind":"import-statement","original":"../../types.js"},{"path":"@fireproof/vendor/@web3-storage/pail/clock","kind":"import-statement","external":true},{"path":"multiformats/bases/base64","kind":"import-statement","external":true},{"path":"multiformats","kind":"import-statement","external":true},{"path":"multiformats/link","kind":"import-statement","external":true},{"path":"@ipld/dag-json","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/clock/api","kind":"import-statement","external":true},{"path":"src/utils.ts","kind":"import-statement","original":"../../utils.js"}],"format":"esm"},"src/runtime/gateways/def-serde-gateway.ts":{"bytes":3183,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/blockstore/fp-envelope.ts","kind":"import-statement","original":"../../blockstore/fp-envelope.js"},{"path":"src/runtime/gateways/fp-envelope-serialize.ts","kind":"import-statement","original":"./fp-envelope-serialize.js"}],"format":"esm"},"src/blockstore/register-store-protocol.ts":{"bytes":5266,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"src/runtime/gateways/file/version.ts","kind":"import-statement","original":"../runtime/gateways/file/version.js"},{"path":"src/runtime/gateways/indexeddb-version.ts","kind":"import-statement","original":"../runtime/gateways/indexeddb-version.js"},{"path":"src/runtime/gateways/file/gateway-impl.ts","kind":"import-statement","original":"../runtime/gateways/file/gateway-impl.js"},{"path":"src/runtime/gateways/memory/gateway.ts","kind":"import-statement","original":"../runtime/gateways/memory/gateway.js"},{"path":"src/runtime/gateways/file/sys-file-system-factory.ts","kind":"import-statement","original":"../runtime/gateways/file/sys-file-system-factory.js"},{"path":"src/runtime/gateways/def-serde-gateway.ts","kind":"import-statement","original":"../runtime/gateways/def-serde-gateway.js"},{"path":"@fireproof/core/indexeddb","kind":"dynamic-import","external":true}],"format":"esm"},"src/runtime/wait-pr-multiformats/block.ts":{"bytes":3974,"imports":[{"path":"multiformats","kind":"import-statement","external":true},{"path":"multiformats/block","kind":"import-statement","external":true},{"path":"./codec-interface.js","kind":"import-statement","external":true}],"format":"esm"},"src/indexer-helpers.ts":{"bytes":7595,"imports":[{"path":"src/runtime/wait-pr-multiformats/block.ts","kind":"import-statement","original":"./runtime/wait-pr-multiformats/block.js"},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@ipld/dag-cbor","kind":"import-statement","external":true},{"path":"charwise","kind":"import-statement","external":true},{"path":"prolly-trees/db-index","kind":"import-statement","external":true},{"path":"prolly-trees/utils","kind":"import-statement","external":true},{"path":"prolly-trees/cache","kind":"import-statement","external":true},{"path":"prolly-trees/db-index","kind":"import-statement","external":true},{"path":"./types.js","kind":"import-statement","external":true},{"path":"./blockstore/index.js","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true}],"format":"esm"},"src/indexer.ts":{"bytes":11892,"imports":[{"path":"src/types.ts","kind":"import-statement","original":"./types.js"},{"path":"src/indexer-helpers.ts","kind":"import-statement","original":"./indexer-helpers.js"},{"path":"src/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"@adviser/cement","kind":"import-statement","external":true}],"format":"esm"},"src/database.ts":{"bytes":5135,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/indexer.ts","kind":"import-statement","original":"./indexer.js"},{"path":"src/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"src/utils.ts","kind":"import-statement","original":"./utils.js"}],"format":"esm"},"src/blockstore/types.ts":{"bytes":13810,"imports":[{"path":"../types.js","kind":"import-statement","external":true},{"path":"./transaction.js","kind":"import-statement","external":true},{"path":"./commit-queue.js","kind":"import-statement","external":true},{"path":"../runtime/key-bag.js","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/clock","kind":"import-statement","external":true},{"path":"./task-manager.js","kind":"import-statement","external":true},{"path":"./serde-gateway.js","kind":"import-statement","external":true},{"path":"@ipld/car","kind":"import-statement","external":true},{"path":"../context.js","kind":"import-statement","external":true}],"format":"esm"},"src/blockstore/loader-helpers.ts":{"bytes":2101,"imports":[{"path":"src/runtime/wait-pr-multiformats/block.ts","kind":"import-statement","original":"../runtime/wait-pr-multiformats/block.js"},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@ipld/dag-cbor","kind":"import-statement","external":true},{"path":"./types.js","kind":"import-statement","external":true},{"path":"@ipld/car/reader","kind":"import-statement","external":true}],"format":"esm"},"src/blockstore/transaction.ts":{"bytes":10479,"imports":[{"path":"@fireproof/vendor/@web3-storage/pail/block","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/api","kind":"import-statement","external":true},{"path":"./types.js","kind":"import-statement","external":true},{"path":"src/blockstore/loader.ts","kind":"import-statement","original":"./loader.js"},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"src/blockstore/store-factory.ts","kind":"import-statement","original":"./store-factory.js"},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/utils.ts","kind":"import-statement","original":"../utils.js"}],"format":"esm"},"src/blockstore/commit-queue.ts":{"bytes":1375,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true}],"format":"esm"},"src/blockstore/commitor.ts":{"bytes":6217,"imports":[{"path":"../types.js","kind":"import-statement","external":true},{"path":"src/blockstore/types.ts","kind":"import-statement","original":"./types.js"},{"path":"@ipld/car/buffer-writer","kind":"import-statement","external":true},{"path":"multiformats","kind":"import-statement","external":true},{"path":"src/runtime/wait-pr-multiformats/block.ts","kind":"import-statement","original":"../runtime/wait-pr-multiformats/block.js"},{"path":"../runtime/wait-pr-multiformats/codec-interface.js","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@ipld/dag-cbor","kind":"import-statement","external":true},{"path":"src/blockstore/transaction.ts","kind":"import-statement","original":"./transaction.js"}],"format":"esm"},"src/blockstore/task-manager.ts":{"bytes":2098,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/utils.ts","kind":"import-statement","original":"../utils.js"},{"path":"../types.js","kind":"import-statement","external":true}],"format":"esm"},"src/blockstore/loader.ts":{"bytes":17072,"imports":[{"path":"p-limit","kind":"import-statement","external":true},{"path":"@ipld/car/reader","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"./types.js","kind":"import-statement","external":true},{"path":"src/blockstore/loader-helpers.ts","kind":"import-statement","original":"./loader-helpers.js"},{"path":"src/blockstore/transaction.ts","kind":"import-statement","original":"./transaction.js"},{"path":"src/blockstore/commit-queue.ts","kind":"import-statement","original":"./commit-queue.js"},{"path":"src/runtime/key-bag.ts","kind":"import-statement","original":"../runtime/key-bag.js"},{"path":"src/blockstore/commitor.ts","kind":"import-statement","original":"./commitor.js"},{"path":"src/runtime/wait-pr-multiformats/block.ts","kind":"import-statement","original":"../runtime/wait-pr-multiformats/block.js"},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"src/blockstore/task-manager.ts","kind":"import-statement","original":"./task-manager.js"}],"format":"esm"},"src/runtime/keyed-crypto.ts":{"bytes":7478,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"../blockstore/index.js","kind":"import-statement","external":true},{"path":"src/utils.ts","kind":"import-statement","original":"../utils.js"},{"path":"./key-bag.js","kind":"import-statement","external":true},{"path":"multiformats/bases/base58","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"cborg","kind":"import-statement","external":true},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"}],"format":"esm"},"src/blockstore/interceptor-gateway.ts":{"bytes":5562,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"./fp-envelope.js","kind":"import-statement","external":true}],"format":"esm"},"src/blockstore/store.ts":{"bytes":20807,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"./serde-gateway.js","kind":"import-statement","external":true},{"path":"src/utils.ts","kind":"import-statement","original":"../utils.js"},{"path":"src/blockstore/loader.ts","kind":"import-statement","original":"./loader.js"},{"path":"src/blockstore/commit-queue.ts","kind":"import-statement","original":"./commit-queue.js"},{"path":"src/runtime/keyed-crypto.ts","kind":"import-statement","original":"../runtime/keyed-crypto.js"},{"path":"src/blockstore/fp-envelope.ts","kind":"import-statement","original":"./fp-envelope.js"},{"path":"@fireproof/vendor/@web3-storage/pail/clock/api","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/clock","kind":"import-statement","external":true},{"path":"@ipld/dag-json","kind":"import-statement","external":true},{"path":"p-retry","kind":"import-statement","external":true},{"path":"p-map","kind":"import-statement","external":true},{"path":"multiformats","kind":"import-statement","external":true},{"path":"src/blockstore/interceptor-gateway.ts","kind":"import-statement","original":"./interceptor-gateway.js"}],"format":"esm"},"src/blockstore/store-factory.ts":{"bytes":6146,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/runtime/files.ts","kind":"import-statement","original":"../runtime/files.js"},{"path":"src/blockstore/store.ts","kind":"import-statement","original":"./store.js"},{"path":"./types.js","kind":"import-statement","external":true},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"src/blockstore/register-store-protocol.ts","kind":"import-statement","original":"./register-store-protocol.js"},{"path":"./serde-gateway.js","kind":"import-statement","external":true}],"format":"esm"},"src/blockstore/serde-gateway.ts":{"bytes":4290,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"../utils.js","kind":"import-statement","external":true},{"path":"./fp-envelope.js","kind":"import-statement","external":true},{"path":"./types.js","kind":"import-statement","external":true},{"path":"../runtime/gateways/fp-envelope-serialize.js","kind":"import-statement","external":true}],"format":"esm"},"src/blockstore/gateway.ts":{"bytes":1431,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true}],"format":"esm"},"src/blockstore/store-remote.ts":{"bytes":1861,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/blockstore/store.ts","kind":"import-statement","original":"./store.js"},{"path":"../types.js","kind":"import-statement","external":true}],"format":"esm"},"src/context.ts":{"bytes":407,"imports":[],"format":"esm"},"src/blockstore/connection-base.ts":{"bytes":6248,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/types.ts","kind":"import-statement","original":"../types.js"},{"path":"./task-manager.js","kind":"import-statement","external":true},{"path":"src/blockstore/store-remote.ts","kind":"import-statement","original":"./store-remote.js"},{"path":"src/blockstore/store-factory.ts","kind":"import-statement","original":"./store-factory.js"},{"path":"src/context.ts","kind":"import-statement","original":"../context.js"}],"format":"esm"},"src/blockstore/index.ts":{"bytes":771,"imports":[{"path":"src/blockstore/types.ts","kind":"import-statement","original":"./types.js"},{"path":"src/blockstore/store-factory.ts","kind":"import-statement","original":"./store-factory.js"},{"path":"src/blockstore/serde-gateway.ts","kind":"import-statement","original":"./serde-gateway.js"},{"path":"src/blockstore/gateway.ts","kind":"import-statement","original":"./gateway.js"},{"path":"src/blockstore/fp-envelope.ts","kind":"import-statement","original":"./fp-envelope.js"},{"path":"src/blockstore/store-factory.ts","kind":"import-statement","original":"./store-factory.js"},{"path":"src/blockstore/interceptor-gateway.ts","kind":"import-statement","original":"./interceptor-gateway.js"},{"path":"src/blockstore/store.ts","kind":"import-statement","original":"./store.js"},{"path":"src/blockstore/register-store-protocol.ts","kind":"import-statement","original":"./register-store-protocol.js"},{"path":"src/blockstore/transaction.ts","kind":"import-statement","original":"./transaction.js"},{"path":"src/blockstore/loader.ts","kind":"import-statement","original":"./loader.js"},{"path":"src/blockstore/loader-helpers.ts","kind":"import-statement","original":"./loader-helpers.js"},{"path":"src/blockstore/connection-base.ts","kind":"import-statement","original":"./connection-base.js"}],"format":"esm"},"src/crdt-helpers.ts":{"bytes":12531,"imports":[{"path":"src/runtime/wait-pr-multiformats/block.ts","kind":"import-statement","original":"./runtime/wait-pr-multiformats/block.js"},{"path":"multiformats/link","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@ipld/dag-cbor","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/crdt","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/crdt/api","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/clock","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/crdt/batch","kind":"import-statement","external":true},{"path":"./blockstore/index.js","kind":"import-statement","external":true},{"path":"src/types.ts","kind":"import-statement","original":"./types.js"},{"path":"@fireproof/vendor/@web3-storage/pail/crdt/api","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/blockstore/transaction.ts","kind":"import-statement","original":"./blockstore/transaction.js"}],"format":"esm"},"src/apply-head-queue.ts":{"bytes":2240,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"./types.js","kind":"import-statement","external":true}],"format":"esm"},"src/crdt-clock.ts":{"bytes":5766,"imports":[{"path":"@fireproof/vendor/@web3-storage/pail/clock","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/crdt","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/crdt-helpers.ts","kind":"import-statement","original":"./crdt-helpers.js"},{"path":"src/apply-head-queue.ts","kind":"import-statement","original":"./apply-head-queue.js"},{"path":"src/utils.ts","kind":"import-statement","original":"./utils.js"}],"format":"esm"},"src/crdt.ts":{"bytes":6275,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/blockstore/index.ts","kind":"import-statement","original":"./blockstore/index.js"},{"path":"src/crdt-helpers.ts","kind":"import-statement","original":"./crdt-helpers.js"},{"path":"src/indexer.ts","kind":"import-statement","original":"./indexer.js"},{"path":"src/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"src/crdt-clock.ts","kind":"import-statement","original":"./crdt-clock.js"}],"format":"esm"},"src/ledger.ts":{"bytes":9772,"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/write-queue.ts","kind":"import-statement","original":"./write-queue.js"},{"path":"src/types.ts","kind":"import-statement","original":"./types.js"},{"path":"./blockstore/index.js","kind":"import-statement","external":true},{"path":"src/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"src/runtime/files.ts","kind":"import-statement","original":"./runtime/files.js"},{"path":"src/runtime/key-bag.ts","kind":"import-statement","original":"./runtime/key-bag.js"},{"path":"src/blockstore/register-store-protocol.ts","kind":"import-statement","original":"./blockstore/register-store-protocol.js"},{"path":"src/database.ts","kind":"import-statement","original":"./database.js"},{"path":"src/crdt.ts","kind":"import-statement","original":"./crdt.js"},{"path":"src/context.ts","kind":"import-statement","original":"./context.js"}],"format":"esm"},"src/runtime/wait-pr-multiformats/codec-interface.ts":{"bytes":665,"imports":[],"format":"esm"},"src/runtime/wait-pr-multiformats/index.ts":{"bytes":84,"imports":[{"path":"src/runtime/wait-pr-multiformats/block.ts","kind":"import-statement","original":"./block.js"},{"path":"src/runtime/wait-pr-multiformats/codec-interface.ts","kind":"import-statement","original":"./codec-interface.js"}],"format":"esm"},"src/runtime/gateways/file/index.ts":{"bytes":81,"imports":[{"path":"src/runtime/gateways/file/key-bag-file.ts","kind":"import-statement","original":"./key-bag-file.js"},{"path":"src/runtime/gateways/file/sys-file-system-factory.ts","kind":"import-statement","original":"./sys-file-system-factory.js"}],"format":"esm"},"src/runtime/gateways/index.ts":{"bytes":172,"imports":[{"path":"src/runtime/gateways/fp-envelope-serialize.ts","kind":"import-statement","original":"./fp-envelope-serialize.js"},{"path":"src/runtime/gateways/file/index.ts","kind":"import-statement","original":"./file/index.js"},{"path":"src/runtime/gateways/memory/gateway.ts","kind":"import-statement","original":"./memory/gateway.js"},{"path":"src/runtime/gateways/def-serde-gateway.ts","kind":"import-statement","original":"./def-serde-gateway.js"}],"format":"esm"},"src/runtime/index.ts":{"bytes":624,"imports":[{"path":"src/runtime/gateways/file/utils.ts","kind":"import-statement","original":"./gateways/file/utils.js"},{"path":"src/runtime/files.ts","kind":"import-statement","original":"./files.js"},{"path":"src/runtime/key-bag.ts","kind":"import-statement","original":"./key-bag.js"},{"path":"src/runtime/keyed-crypto.ts","kind":"import-statement","original":"./keyed-crypto.js"},{"path":"src/runtime/wait-pr-multiformats/index.ts","kind":"import-statement","original":"./wait-pr-multiformats/index.js"},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"src/runtime/gateways/index.ts","kind":"import-statement","original":"./gateways/index.js"},{"path":"src/runtime/key-bag.ts","kind":"import-statement","original":"./key-bag.js"},{"path":"src/runtime/gateways/file/version.ts","kind":"import-statement","original":"./gateways/file/version.js"},{"path":"src/runtime/gateways/indexeddb-version.ts","kind":"import-statement","original":"./gateways/indexeddb-version.js"}],"format":"esm"},"src/version.ts":{"bytes":97,"imports":[],"format":"esm"},"src/index.ts":{"bytes":455,"imports":[{"path":"src/ledger.ts","kind":"import-statement","original":"./ledger.js"},{"path":"src/database.ts","kind":"import-statement","original":"./database.js"},{"path":"src/types.ts","kind":"import-statement","original":"./types.js"},{"path":"src/crdt.ts","kind":"import-statement","original":"./crdt.js"},{"path":"src/indexer.ts","kind":"import-statement","original":"./indexer.js"},{"path":"src/write-queue.ts","kind":"import-statement","original":"./write-queue.js"},{"path":"src/blockstore/index.ts","kind":"import-statement","original":"./blockstore/index.js"},{"path":"src/blockstore/index.ts","kind":"import-statement","original":"./blockstore/index.js"},{"path":"src/runtime/index.ts","kind":"import-statement","original":"./runtime/index.js"},{"path":"src/runtime/index.ts","kind":"import-statement","original":"./runtime/index.js"},{"path":"src/utils.ts","kind":"import-statement","original":"./utils.js"},{"path":"src/version.ts","kind":"import-statement","original":"./version.js"}],"format":"esm"}},"outputs":{"dist/fireproof-core/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":374438},"dist/fireproof-core/index.js":{"imports":[{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"multiformats/bases/base58","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@ipld/unixfs","kind":"import-statement","external":true},{"path":"multiformats/codecs/raw","kind":"import-statement","external":true},{"path":"@ipld/unixfs/file/chunker/fixed","kind":"import-statement","external":true},{"path":"@ipld/unixfs/file/layout/balanced","kind":"import-statement","external":true},{"path":"ipfs-unixfs-exporter","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"multiformats/bases/base58","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@fireproof/core/node","kind":"dynamic-import","external":true},{"path":"@fireproof/core/deno","kind":"dynamic-import","external":true},{"path":"@fireproof/core/indexeddb","kind":"dynamic-import","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@fireproof/core","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/clock","kind":"import-statement","external":true},{"path":"multiformats/bases/base64","kind":"import-statement","external":true},{"path":"multiformats","kind":"import-statement","external":true},{"path":"multiformats/link","kind":"import-statement","external":true},{"path":"@ipld/dag-json","kind":"import-statement","external":true},{"path":"@fireproof/core/indexeddb","kind":"dynamic-import","external":true},{"path":"multiformats","kind":"import-statement","external":true},{"path":"multiformats/block","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@ipld/dag-cbor","kind":"import-statement","external":true},{"path":"charwise","kind":"import-statement","external":true},{"path":"prolly-trees/db-index","kind":"import-statement","external":true},{"path":"prolly-trees/utils","kind":"import-statement","external":true},{"path":"prolly-trees/cache","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"p-limit","kind":"import-statement","external":true},{"path":"@ipld/car/reader","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@ipld/dag-cbor","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/block","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@ipld/car/buffer-writer","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@ipld/dag-cbor","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"multiformats/bases/base58","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"cborg","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/clock","kind":"import-statement","external":true},{"path":"@ipld/dag-json","kind":"import-statement","external":true},{"path":"p-retry","kind":"import-statement","external":true},{"path":"p-map","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"multiformats/link","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@ipld/dag-cbor","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/crdt","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/clock","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/crdt/batch","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/clock","kind":"import-statement","external":true},{"path":"@fireproof/vendor/@web3-storage/pail/crdt","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true},{"path":"@adviser/cement","kind":"import-statement","external":true}],"exports":["CRDTImpl","DatabaseImpl","Index","LedgerFactory","LedgerShell","NotFoundError","PACKAGE_VERSION","PARAM","UInt8ArrayEqual","blockstore","bs","coerceIntoUint8","coercePromiseIntoUint8","defaultWriteQueueOpts","ensureLogger","ensureSuperLog","ensureSuperThis","exceptionWrapper","falsyToUndef","fireproof","getKey","getName","getStore","index","inplaceFilter","isDatabase","isFalsy","isLedger","isNotFoundError","keyConfigOpts","makeName","onSuperThis","rt","runtime","throwFalsy","toSortedArray","toStoreURIRuntime"],"entryPoint":"src/index.ts","inputs":{"src/ledger.ts":{"bytesInOutput":7279},"src/utils.ts":{"bytesInOutput":8948},"src/types.ts":{"bytesInOutput":925},"src/write-queue.ts":{"bytesInOutput":2074},"src/runtime/files.ts":{"bytesInOutput":2056},"src/runtime/key-bag.ts":{"bytesInOutput":6894},"src/runtime/gateways/file/sys-file-system-factory.ts":{"bytesInOutput":404},"src/runtime/gateways/file/key-bag-file.ts":{"bytesInOutput":1052},"src/runtime/key-bag-memory.ts":{"bytesInOutput":557},"src/blockstore/register-store-protocol.ts":{"bytesInOutput":2925},"src/runtime/gateways/file/version.ts":{"bytesInOutput":38},"src/runtime/gateways/indexeddb-version.ts":{"bytesInOutput":43},"src/runtime/gateways/file/gateway-impl.ts":{"bytesInOutput":4247},"src/runtime/gateways/file/utils.ts":{"bytesInOutput":764},"src/runtime/gateways/memory/gateway.ts":{"bytesInOutput":1530},"src/runtime/gateways/memory/version.ts":{"bytesInOutput":37},"src/runtime/gateways/def-serde-gateway.ts":{"bytesInOutput":1976},"src/blockstore/fp-envelope.ts":{"bytesInOutput":499},"src/runtime/gateways/fp-envelope-serialize.ts":{"bytesInOutput":5263},"src/runtime/wait-pr-multiformats/block.ts":{"bytesInOutput":2131},"src/indexer-helpers.ts":{"bytesInOutput":4013},"src/indexer.ts":{"bytesInOutput":8173},"src/database.ts":{"bytesInOutput":3408},"src/crdt.ts":{"bytesInOutput":4107},"src/blockstore/index.ts":{"bytesInOutput":1065},"src/blockstore/types.ts":{"bytesInOutput":444},"src/blockstore/store-factory.ts":{"bytesInOutput":4134},"src/blockstore/store.ts":{"bytesInOutput":16509},"src/blockstore/loader.ts":{"bytesInOutput":13352},"src/blockstore/loader-helpers.ts":{"bytesInOutput":542},"src/blockstore/transaction.ts":{"bytesInOutput":6899},"src/blockstore/commit-queue.ts":{"bytesInOutput":1239},"src/blockstore/commitor.ts":{"bytesInOutput":3527},"src/blockstore/task-manager.ts":{"bytesInOutput":1622},"src/runtime/keyed-crypto.ts":{"bytesInOutput":5483},"src/blockstore/interceptor-gateway.ts":{"bytesInOutput":3773},"src/blockstore/connection-base.ts":{"bytesInOutput":4414},"src/blockstore/store-remote.ts":{"bytesInOutput":272},"src/context.ts":{"bytesInOutput":236},"src/crdt-helpers.ts":{"bytesInOutput":8577},"src/crdt-clock.ts":{"bytesInOutput":4416},"src/apply-head-queue.ts":{"bytesInOutput":1260},"src/index.ts":{"bytesInOutput":0},"src/runtime/index.ts":{"bytesInOutput":678},"src/runtime/wait-pr-multiformats/index.ts":{"bytesInOutput":153},"src/runtime/wait-pr-multiformats/codec-interface.ts":{"bytesInOutput":34},"src/runtime/gateways/index.ts":{"bytesInOutput":340},"src/runtime/gateways/file/index.ts":{"bytesInOutput":151},"src/version.ts":{"bytesInOutput":77}},"bytes":151453}}}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fireproof/core",
|
3
|
-
"version": "0.20.0-dev-preview-
|
3
|
+
"version": "0.20.0-dev-preview-22",
|
4
4
|
"description": "Live ledger for the web.",
|
5
5
|
"type": "module",
|
6
6
|
"module": "./index.js",
|
@@ -75,8 +75,13 @@
|
|
75
75
|
"react": "^18.3.1"
|
76
76
|
},
|
77
77
|
"dependencies": {
|
78
|
-
"@
|
79
|
-
"@
|
78
|
+
"@ipld/car": "^5.4.0",
|
79
|
+
"@ipld/dag-cbor": "^9.2.2",
|
80
|
+
"@ipld/dag-json": "^10.2.3",
|
81
|
+
"@fireproof/vendor": "^1.1.0-dev",
|
82
|
+
"cborg": "^4.2.8",
|
83
|
+
"ipfs-unixfs-exporter": "^13.6.1",
|
84
|
+
"@adviser/cement": "^0.3.8",
|
80
85
|
"multiformats": "^13.3.1",
|
81
86
|
"@ipld/unixfs": "^3.0.0",
|
82
87
|
"charwise": "^3.0.1",
|
package/react/index.cjs
CHANGED
@@ -40,7 +40,7 @@ function useFireproof(name = "useFireproof", config = {}) {
|
|
40
40
|
if (typeof initialDocOrFn === "function") {
|
41
41
|
initialDoc = initialDocOrFn();
|
42
42
|
} else {
|
43
|
-
initialDoc = initialDocOrFn;
|
43
|
+
initialDoc = initialDocOrFn ?? {};
|
44
44
|
}
|
45
45
|
const docId = initialDoc._id ?? "";
|
46
46
|
const [doc, setDoc] = (0, import_react.useState)(initialDoc);
|
package/react/index.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/react/index.ts","../../../src/react/useFireproof.ts","../../../src/react/useDocument.ts","../../../src/react/useLiveQuery.ts","../../../src/react/useAllDocs.ts","../../../src/react/useChanges.ts"],"sourcesContent":["export {\n type TLUseDocument,\n /** @deprecated Use return values from useFireproof('dbname') instead. Top level usage will be removed in future versions. */\n useDocument,\n} from \"./useDocument.js\";\nexport { FireproofCtx, type UseFireproof, useFireproof } from \"./useFireproof.js\";\nexport {\n type TLUseLiveQuery,\n /** @deprecated Use return values from useFireproof('dbname') instead. Top level usage will be removed in future versions. */\n useLiveQuery,\n} from \"./useLiveQuery.js\";\nexport {\n type TLUseAllDocs,\n /** @deprecated Use return values from useFireproof('dbname') instead. Top level usage will be removed in future versions. */\n useAllDocs,\n} from \"./useAllDocs.js\";\nexport {\n type TLUseChanges,\n /** @deprecated Use return values from useFireproof('dbname') instead. Top level usage will be removed in future versions. */\n useChanges,\n} from \"./useChanges.js\";\n// why is this there is should be a package system\n// export * from \"@fireproof/core\";\n","import type {\n ConfigOpts,\n DocFragment,\n DocResponse,\n DocSet,\n DocTypes,\n DocWithId,\n IndexKeyType,\n IndexRow,\n MapFn,\n QueryOpts,\n Database,\n} from \"@fireproof/core\";\nimport { fireproof } from \"@fireproof/core\";\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport type { AllDocsQueryOpts, ChangesOptions, ClockHead } from \"@fireproof/core\";\n\nexport interface LiveQueryResult<T extends DocTypes, K extends IndexKeyType, R extends DocFragment = T> {\n readonly docs: DocWithId<T>[];\n readonly rows: IndexRow<K, T, R>[];\n}\n\nexport type UseLiveQuery = <T extends DocTypes, K extends IndexKeyType = string, R extends DocFragment = T>(\n mapFn: string | MapFn<T>,\n query?: QueryOpts<K>,\n initialRows?: IndexRow<K, T, R>[],\n) => LiveQueryResult<T, K, R>;\n\nexport interface AllDocsResult<T extends DocTypes> {\n readonly docs: DocWithId<T>[];\n}\n\nexport interface ChangesResult<T extends DocTypes> {\n readonly docs: DocWithId<T>[];\n}\n\nexport type UseAllDocs = <T extends DocTypes>(query?: AllDocsQueryOpts) => AllDocsResult<T>;\n\nexport type UseChanges = <T extends DocTypes>(since: ClockHead, opts: ChangesOptions) => ChangesResult<T>;\n\ninterface UpdateDocFnOptions {\n readonly replace?: boolean;\n readonly reset?: boolean;\n}\n\ntype UpdateDocFn<T extends DocTypes> = (newDoc?: DocSet<T>, options?: UpdateDocFnOptions) => void;\n\ntype StoreDocFn<T extends DocTypes> = (existingDoc?: DocWithId<T>) => Promise<DocResponse>;\n\ntype DeleteDocFn<T extends DocTypes> = (existingDoc?: DocWithId<T>) => Promise<DocResponse>;\n\nexport type UseDocumentResult<T extends DocTypes> = [DocWithId<T>, UpdateDocFn<T>, StoreDocFn<T>, DeleteDocFn<T>];\n\nexport type UseDocumentInitialDocOrFn<T extends DocTypes> = DocSet<T> | (() => DocSet<T>);\nexport type UseDocument = <T extends DocTypes>(initialDocOrFn: UseDocumentInitialDocOrFn<T>) => UseDocumentResult<T>;\n\nexport interface UseFireproof {\n readonly database: Database;\n /**\n * ## Summary\n *\n * React hook that provides the ability to create/update/save new Fireproof documents into your custom Fireproof database.\n * The creation occurs when you do not pass in an `_id` as part of your initial document -- the database will assign a new\n * one when you call the provided `save` handler. The hook also provides generics support so you can inline your custom type into\n * the invocation to receive type-safety and auto-complete support in your IDE.\n *\n * ## Usage\n *\n * ```tsx\n * const [todo, setTodo, saveTodo] = useDocument<Todo>({\n * text: '',\n * date: Date.now(),\n * completed: false\n * })\n *\n * const [doc, setDoc, saveDoc] = useDocument<Customer>({\n * _id: `${props.customerId}-profile`, // you can imagine `customerId` as a prop passed in\n * name: \"\",\n * company: \"\",\n * startedAt: Date.now()\n * })\n * ```\n *\n * ## Overview\n *\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useLiveQuery` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\n readonly useDocument: UseDocument;\n /**\n * ## Summary\n * React hook that provides access to live query results, enabling real-time updates in your app.\n *\n * ## Usage\n * ```tsx\n * const result = useLiveQuery(\"date\"); // using string key\n * const result = useLiveQuery('date', { limit: 10, descending: true }) // key + options\n * const result = useLiveQuery<CustomType>(\"date\"); // using generics\n * const result = useLiveQuery((doc) => doc.date)); // using map function\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useLiveQuery` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\n readonly useLiveQuery: UseLiveQuery;\n /**\n * ## Summary\n * React hook that provides access to all documents in the database, sorted by `_id`.\n *\n * ## Usage\n * ```tsx\n * const result = useAllDocs({ limit: 10, descending: true }); // with options\n * const result = useAllDocs(); // without options\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useAllDocs` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\n readonly useAllDocs: UseAllDocs;\n /**\n * ## Summary\n * React hook that provides access to all new documents in the database added since the last time the changes was called\n *\n * ## Usage\n * ```tsx\n * const result = useChanges(prevresult.clock,{limit:10}); // with options\n * const result = useChanges(); // without options\n * const database = useChanges.database; // underlying \"useFireproof\" database accessor\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useAllDocs`, `useChanges` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\n readonly useChanges: UseChanges;\n}\n\n/**\n * @deprecated Use the `useFireproof` hook instead\n */\nexport const FireproofCtx = {} as UseFireproof;\n\n/**\n *\n * ## Summary\n *\n * React hook to create a custom-named Fireproof database and provides the utility hooks to query against it.\n *\n * ## Usage\n * ```tsx\n * const { database, useLiveQuery, useDocument } = useFireproof(\"dbname\");\n * const { database, useLiveQuery, useDocument } = useFireproof(\"dbname\", { ...options });\n * ```\n *\n * ## Overview\n *\n * TL;DR: Only use this hook if you need to configure a database name other than the default `useFireproof`.\n *\n * For most applications, using the `useLiveQuery` or `useDocument` hooks exported from `use-fireproof` should\n * suffice for the majority of use-cases. Under the hood, they act against a database named `useFireproof` instantiated with\n * default configurations. However, if you need to do a custom database setup or configure a database name more to your liking\n * than the default `useFireproof`, then use `useFireproof` as it exists for that purpose. It will provide you with the\n * custom database accessor and *lexically scoped* versions of `useLiveQuery` and `useDocument` that act against said\n * custom database.\n *\n */\nexport function useFireproof(name: string | Database = \"useFireproof\", config: ConfigOpts = {}): UseFireproof {\n const database = typeof name === \"string\" ? fireproof(name, config) : name;\n\n function useDocument<T extends DocTypes>(initialDocOrFn: UseDocumentInitialDocOrFn<T>): UseDocumentResult<T> {\n let initialDoc: DocSet<T>;\n if (typeof initialDocOrFn === \"function\") {\n initialDoc = initialDocOrFn();\n } else {\n initialDoc = initialDocOrFn;\n }\n\n // We purposely refetch the docId everytime to check if it has changed\n const docId = initialDoc._id ?? \"\";\n\n // We do not want to force consumers to memoize their initial document so we do it for them.\n // We use the stringified generator function to ensure that the memoization is stable across renders.\n // const initialDoc = useMemo(initialDocFn, [initialDocFn.toString()]);\n const [doc, setDoc] = useState(initialDoc);\n\n const refreshDoc = useCallback(async () => {\n // todo add option for mvcc checks\n const doc = docId ? await database.get<T>(docId).catch(() => initialDoc) : initialDoc;\n setDoc(doc);\n }, [docId]);\n\n const saveDoc: StoreDocFn<T> = useCallback(\n async (existingDoc) => {\n const res = await database.put(existingDoc ?? doc);\n // If the document was created, then we need to update the local state with the new `_id`\n if (!existingDoc && !doc._id) setDoc((d) => ({ ...d, _id: res.id }));\n return res;\n },\n [doc],\n );\n\n const deleteDoc: DeleteDocFn<T> = useCallback(\n async (existingDoc) => {\n const id = existingDoc?._id ?? docId;\n const doc = await database.get<T>(id).catch(() => undefined);\n if (!doc) throw database.logger.Error().Str(\"id\", id).Msg(`Document not found`).AsError();\n const res = await database.del(id);\n setDoc(initialDoc);\n return res;\n },\n [docId, initialDoc],\n );\n\n const updateDoc: UpdateDocFn<T> = useCallback(\n (newDoc, opts = { replace: false, reset: false }) => {\n if (!newDoc) return void (opts.reset ? setDoc(initialDoc) : refreshDoc());\n setDoc((d) => (opts.replace ? (newDoc as DocWithId<T>) : { ...d, ...newDoc }));\n },\n [refreshDoc, initialDoc],\n );\n\n useEffect(() => {\n if (!docId) return;\n return database.subscribe((changes) => {\n if (changes.find((c) => c._id === docId)) {\n void refreshDoc(); // todo use change.value\n }\n });\n }, [docId, refreshDoc]);\n\n useEffect(() => {\n void refreshDoc();\n }, [refreshDoc]);\n\n return [{ _id: docId, ...doc }, updateDoc, saveDoc, deleteDoc];\n }\n\n function useLiveQuery<T extends DocTypes, K extends IndexKeyType = string, R extends DocFragment = T>(\n mapFn: MapFn<T> | string,\n query = {},\n initialRows: IndexRow<K, T, R>[] = [],\n ): LiveQueryResult<T, K, R> {\n const [result, setResult] = useState<LiveQueryResult<T, K, R>>(() => ({\n rows: initialRows,\n docs: initialRows.map((r) => r.doc).filter((r): r is DocWithId<T> => !!r),\n }));\n\n const queryString = useMemo(() => JSON.stringify(query), [query]);\n const mapFnString = useMemo(() => mapFn.toString(), [mapFn]);\n\n const refreshRows = useCallback(async () => {\n const res = await database.query<K, T, R>(mapFn, query);\n setResult({ ...res, docs: res.rows.map((r) => r.doc as DocWithId<T>) });\n }, [mapFnString, queryString]);\n\n useEffect(() => {\n refreshRows(); // Initial data fetch\n return database.subscribe(refreshRows);\n }, [refreshRows]);\n\n return result;\n }\n\n function useAllDocs<T extends DocTypes>(query: AllDocsQueryOpts = {}): AllDocsResult<T> {\n const [result, setResult] = useState<AllDocsResult<T>>({\n docs: [],\n });\n\n const queryString = useMemo(() => JSON.stringify(query), [query]);\n\n const refreshRows = useCallback(async () => {\n const res = await database.allDocs<T>(query);\n setResult({ ...res, docs: res.rows.map((r) => r.value as DocWithId<T>) });\n }, [queryString]);\n\n useEffect(() => {\n refreshRows(); // Initial data fetch\n return database.subscribe(refreshRows);\n }, [refreshRows]);\n\n return result;\n }\n\n function useChanges<T extends DocTypes>(since: ClockHead = [], opts: ChangesOptions = {}): ChangesResult<T> {\n const [result, setResult] = useState<ChangesResult<T>>({\n docs: [],\n });\n\n const queryString = useMemo(() => JSON.stringify(opts), [opts]);\n\n const refreshRows = useCallback(async () => {\n const res = await database.changes<T>(since, opts);\n setResult({ ...res, docs: res.rows.map((r) => r.value as DocWithId<T>) });\n }, [since, queryString]);\n\n useEffect(() => {\n refreshRows(); // Initial data fetch\n return database.subscribe(refreshRows);\n }, [refreshRows]);\n\n return result;\n }\n\n return { database, useLiveQuery, useDocument, useAllDocs, useChanges };\n}\n","import { Database, DocTypes, DocWithId } from \"@fireproof/core\";\n\nimport { UseDocument, UseDocumentResult, useFireproof } from \"./useFireproof.js\";\n\nexport interface TLUseDocument {\n <T extends DocTypes>(initialDoc: DocWithId<T>): UseDocumentResult<T>;\n database: Database;\n}\n\nfunction topLevelUseDocument(...args: Parameters<UseDocument>) {\n const { useDocument, database } = useFireproof();\n (topLevelUseDocument as TLUseDocument).database = database;\n return useDocument(...args);\n}\n\n/**\n * ## Summary\n *\n * React hook that provides the ability to create new Fireproof documents. The creation occurs when\n * you do not pass in an `_id` as part of your initial document -- the database will assign a new one when\n * you call the provided `save` handler This uses the default database named `useFireproof` under the hood which you can also\n * access via the `database` accessor.\n *\n * ## Usage\n *\n * ```tsx\n * const [todo, setTodo, saveTodo] = useDocument(() => ({\n * text: '',\n * date: Date.now(),\n * completed: false\n * }))\n *\n * const [doc, setDoc, saveDoc] = useDocument(() => ({\n * _id: `${props.customerId}-profile`, // you can imagine `customerId` as a prop passed in\n * name: \"\",\n * company: \"\",\n * startedAt: Date.now()\n * }))\n *\n * const database = useDocument.database; // underlying \"useFireproof\" database accessor\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useLiveQuery` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\nexport const useDocument = topLevelUseDocument as TLUseDocument;\n","import { Database, DocFragment, DocTypes, IndexKeyType } from \"@fireproof/core\";\n\nimport { LiveQueryResult, useFireproof, UseLiveQuery } from \"./useFireproof.js\";\n\nexport interface TLUseLiveQuery {\n <T extends DocTypes, K extends IndexKeyType, R extends DocFragment = T>(\n ...args: Parameters<UseLiveQuery>\n ): LiveQueryResult<T, K, R>;\n database: Database;\n}\n\nfunction topLevelUseLiveQuery(...args: Parameters<UseLiveQuery>) {\n const { useLiveQuery, database } = useFireproof();\n (topLevelUseLiveQuery as TLUseLiveQuery).database = database;\n return useLiveQuery(...args);\n}\n\n/**\n * ## Summary\n * React hook that provides access to live query results, enabling real-time updates in your app. This uses\n * the default database named \"useFireproof\" under the hood which you can also access via the `database` accessor.\n *\n * ## Usage\n * ```tsx\n * const results = useLiveQuery(\"date\"); // using string\n * const results = useLiveQuery((doc) => doc.date)); // using map function\n * const database = useLiveQuery.database; // underlying \"useFireproof\" database accessor\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useLiveQuery` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\nexport const useLiveQuery = topLevelUseLiveQuery as TLUseLiveQuery;\n","import { Database, DocTypes } from \"@fireproof/core\";\n\nimport { AllDocsResult, useFireproof, UseAllDocs } from \"./useFireproof.js\";\n\nexport interface TLUseAllDocs {\n <T extends DocTypes>(...args: Parameters<UseAllDocs>): AllDocsResult<T>;\n database: Database;\n}\n\nfunction topLevelUseAllDocs(...args: Parameters<UseAllDocs>) {\n const { useAllDocs, database } = useFireproof();\n (topLevelUseAllDocs as TLUseAllDocs).database = database;\n return useAllDocs(...args);\n}\n\n/**\n * ## Summary\n * React hook that provides access to all documents in the database, sorted by `_id`.\n *\n * ## Usage\n * ```tsx\n * const result = useAllDocs({ limit: 10, descending: true }); // with options\n * const result = useAllDocs(); // without options\n * const database = useAllDocs.database; // underlying \"useFireproof\" database accessor\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useAllDocs` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\nexport const useAllDocs = topLevelUseAllDocs as TLUseAllDocs;\n","import { DocTypes, Database } from \"@fireproof/core\";\n\nimport { ChangesResult, useFireproof, UseChanges } from \"./useFireproof.js\";\n\nexport interface TLUseChanges {\n <T extends DocTypes>(...args: Parameters<UseChanges>): ChangesResult<T>;\n database: Database;\n}\n\nfunction topLevelUseChanges(...args: Parameters<UseChanges>) {\n const { useChanges, database } = useFireproof();\n (topLevelUseChanges as TLUseChanges).database = database;\n return useChanges(...args);\n}\n\n/**\n * ## Summary\n * React hook that provides access to all new documents in the database added since the last time the changes was called\n *\n * ## Usage\n * ```tsx\n * const result = useChanges(prevresult.clock,{limit:10}); // with options\n * const result = useChanges(); // without options\n * const database = useChanges.database; // underlying \"useFireproof\" database accessor\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useAllDocs`, `useChanges` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\nexport const useChanges = topLevelUseChanges as TLUseChanges;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACaA,kBAA0B;AAC1B,mBAA0D;AAoInD,IAAM,eAAe,CAAC;AA0BtB,SAAS,aAAa,OAA0B,gBAAgB,SAAqB,CAAC,GAAiB;AAC5G,QAAM,WAAW,OAAO,SAAS,eAAW,uBAAU,MAAM,MAAM,IAAI;AAEtE,WAASA,aAAgC,gBAAoE;AAC3G,QAAI;AACJ,QAAI,OAAO,mBAAmB,YAAY;AACxC,mBAAa,eAAe;AAAA,IAC9B,OAAO;AACL,mBAAa;AAAA,IACf;AAGA,UAAM,QAAQ,WAAW,OAAO;AAKhC,UAAM,CAAC,KAAK,MAAM,QAAI,uBAAS,UAAU;AAEzC,UAAM,iBAAa,0BAAY,YAAY;AAEzC,YAAMC,OAAM,QAAQ,MAAM,SAAS,IAAO,KAAK,EAAE,MAAM,MAAM,UAAU,IAAI;AAC3E,aAAOA,IAAG;AA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WAAW;AAChD,SAAOA,YAAW,GAAG,IAAI;AAC3B;AAkBO,IAAM,aAAa;;;ACtB1B,SAAS,sBAAsB,MAA8B;AAC3D,QAAM,EAAE,YAAAC,aAAY,SAAS,IAAI,aAAa;AAC9C,EAAC,mBAAoC,WAAW;AAChD,SAAOA,YAAW,GAAG,IAAI;AAC3B;AAkBO,IAAM,aAAa;","names":["useDocument","doc","useLiveQuery","useAllDocs","useChanges","useDocument","useLiveQuery","useAllDocs","useChanges"]}
|
1
|
+
{"version":3,"sources":["../../../src/react/index.ts","../../../src/react/useFireproof.ts","../../../src/react/useDocument.ts","../../../src/react/useLiveQuery.ts","../../../src/react/useAllDocs.ts","../../../src/react/useChanges.ts"],"sourcesContent":["export {\n type TLUseDocument,\n /** @deprecated Use return values from useFireproof('dbname') instead. Top level usage will be removed in future versions. */\n useDocument,\n} from \"./useDocument.js\";\nexport { FireproofCtx, type UseFireproof, useFireproof } from \"./useFireproof.js\";\nexport {\n type TLUseLiveQuery,\n /** @deprecated Use return values from useFireproof('dbname') instead. Top level usage will be removed in future versions. */\n useLiveQuery,\n} from \"./useLiveQuery.js\";\nexport {\n type TLUseAllDocs,\n /** @deprecated Use return values from useFireproof('dbname') instead. Top level usage will be removed in future versions. */\n useAllDocs,\n} from \"./useAllDocs.js\";\nexport {\n type TLUseChanges,\n /** @deprecated Use return values from useFireproof('dbname') instead. Top level usage will be removed in future versions. */\n useChanges,\n} from \"./useChanges.js\";\n// why is this there is should be a package system\n// export * from \"@fireproof/core\";\n","import type {\n ConfigOpts,\n DocFragment,\n DocResponse,\n DocSet,\n DocTypes,\n DocWithId,\n IndexKeyType,\n IndexRow,\n MapFn,\n QueryOpts,\n Database,\n} from \"@fireproof/core\";\nimport { fireproof } from \"@fireproof/core\";\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport type { AllDocsQueryOpts, ChangesOptions, ClockHead } from \"@fireproof/core\";\n\nexport interface LiveQueryResult<T extends DocTypes, K extends IndexKeyType, R extends DocFragment = T> {\n readonly docs: DocWithId<T>[];\n readonly rows: IndexRow<K, T, R>[];\n}\n\nexport type UseLiveQuery = <T extends DocTypes, K extends IndexKeyType = string, R extends DocFragment = T>(\n mapFn: string | MapFn<T>,\n query?: QueryOpts<K>,\n initialRows?: IndexRow<K, T, R>[],\n) => LiveQueryResult<T, K, R>;\n\nexport interface AllDocsResult<T extends DocTypes> {\n readonly docs: DocWithId<T>[];\n}\n\nexport interface ChangesResult<T extends DocTypes> {\n readonly docs: DocWithId<T>[];\n}\n\nexport type UseAllDocs = <T extends DocTypes>(query?: AllDocsQueryOpts) => AllDocsResult<T>;\n\nexport type UseChanges = <T extends DocTypes>(since: ClockHead, opts: ChangesOptions) => ChangesResult<T>;\n\ninterface UpdateDocFnOptions {\n readonly replace?: boolean;\n readonly reset?: boolean;\n}\n\ntype UpdateDocFn<T extends DocTypes> = (newDoc?: DocSet<T>, options?: UpdateDocFnOptions) => void;\n\ntype StoreDocFn<T extends DocTypes> = (existingDoc?: DocWithId<T>) => Promise<DocResponse>;\n\ntype DeleteDocFn<T extends DocTypes> = (existingDoc?: DocWithId<T>) => Promise<DocResponse>;\n\nexport type UseDocumentResult<T extends DocTypes> = [DocWithId<T>, UpdateDocFn<T>, StoreDocFn<T>, DeleteDocFn<T>];\n\nexport type UseDocumentInitialDocOrFn<T extends DocTypes> = DocSet<T> | (() => DocSet<T>);\nexport type UseDocument = <T extends DocTypes>(initialDocOrFn: UseDocumentInitialDocOrFn<T>) => UseDocumentResult<T>;\n\nexport interface UseFireproof {\n readonly database: Database;\n /**\n * ## Summary\n *\n * React hook that provides the ability to create/update/save new Fireproof documents into your custom Fireproof database.\n * The creation occurs when you do not pass in an `_id` as part of your initial document -- the database will assign a new\n * one when you call the provided `save` handler. The hook also provides generics support so you can inline your custom type into\n * the invocation to receive type-safety and auto-complete support in your IDE.\n *\n * ## Usage\n *\n * ```tsx\n * const [todo, setTodo, saveTodo] = useDocument<Todo>({\n * text: '',\n * date: Date.now(),\n * completed: false\n * })\n *\n * const [doc, setDoc, saveDoc] = useDocument<Customer>({\n * _id: `${props.customerId}-profile`, // you can imagine `customerId` as a prop passed in\n * name: \"\",\n * company: \"\",\n * startedAt: Date.now()\n * })\n * ```\n *\n * ## Overview\n *\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useLiveQuery` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\n readonly useDocument: UseDocument;\n /**\n * ## Summary\n * React hook that provides access to live query results, enabling real-time updates in your app.\n *\n * ## Usage\n * ```tsx\n * const result = useLiveQuery(\"date\"); // using string key\n * const result = useLiveQuery('date', { limit: 10, descending: true }) // key + options\n * const result = useLiveQuery<CustomType>(\"date\"); // using generics\n * const result = useLiveQuery((doc) => doc.date)); // using map function\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useLiveQuery` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\n readonly useLiveQuery: UseLiveQuery;\n /**\n * ## Summary\n * React hook that provides access to all documents in the database, sorted by `_id`.\n *\n * ## Usage\n * ```tsx\n * const result = useAllDocs({ limit: 10, descending: true }); // with options\n * const result = useAllDocs(); // without options\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useAllDocs` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\n readonly useAllDocs: UseAllDocs;\n /**\n * ## Summary\n * React hook that provides access to all new documents in the database added since the last time the changes was called\n *\n * ## Usage\n * ```tsx\n * const result = useChanges(prevresult.clock,{limit:10}); // with options\n * const result = useChanges(); // without options\n * const database = useChanges.database; // underlying \"useFireproof\" database accessor\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useAllDocs`, `useChanges` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\n readonly useChanges: UseChanges;\n}\n\n/**\n * @deprecated Use the `useFireproof` hook instead\n */\nexport const FireproofCtx = {} as UseFireproof;\n\n/**\n *\n * ## Summary\n *\n * React hook to create a custom-named Fireproof database and provides the utility hooks to query against it.\n *\n * ## Usage\n * ```tsx\n * const { database, useLiveQuery, useDocument } = useFireproof(\"dbname\");\n * const { database, useLiveQuery, useDocument } = useFireproof(\"dbname\", { ...options });\n * ```\n *\n * ## Overview\n *\n * TL;DR: Only use this hook if you need to configure a database name other than the default `useFireproof`.\n *\n * For most applications, using the `useLiveQuery` or `useDocument` hooks exported from `use-fireproof` should\n * suffice for the majority of use-cases. Under the hood, they act against a database named `useFireproof` instantiated with\n * default configurations. However, if you need to do a custom database setup or configure a database name more to your liking\n * than the default `useFireproof`, then use `useFireproof` as it exists for that purpose. It will provide you with the\n * custom database accessor and *lexically scoped* versions of `useLiveQuery` and `useDocument` that act against said\n * custom database.\n *\n */\nexport function useFireproof(name: string | Database = \"useFireproof\", config: ConfigOpts = {}): UseFireproof {\n const database = typeof name === \"string\" ? fireproof(name, config) : name;\n\n function useDocument<T extends DocTypes>(initialDocOrFn?: UseDocumentInitialDocOrFn<T>): UseDocumentResult<T> {\n let initialDoc: DocSet<T>;\n if (typeof initialDocOrFn === \"function\") {\n initialDoc = initialDocOrFn();\n } else {\n initialDoc = initialDocOrFn ?? ({} as T);\n }\n\n // We purposely refetch the docId everytime to check if it has changed\n const docId = initialDoc._id ?? \"\";\n\n // We do not want to force consumers to memoize their initial document so we do it for them.\n // We use the stringified generator function to ensure that the memoization is stable across renders.\n // const initialDoc = useMemo(initialDocFn, [initialDocFn.toString()]);\n const [doc, setDoc] = useState(initialDoc);\n\n const refreshDoc = useCallback(async () => {\n // todo add option for mvcc checks\n const doc = docId ? await database.get<T>(docId).catch(() => initialDoc) : initialDoc;\n setDoc(doc);\n }, [docId]);\n\n const saveDoc: StoreDocFn<T> = useCallback(\n async (existingDoc) => {\n const res = await database.put(existingDoc ?? doc);\n // If the document was created, then we need to update the local state with the new `_id`\n if (!existingDoc && !doc._id) setDoc((d) => ({ ...d, _id: res.id }));\n return res;\n },\n [doc],\n );\n\n const deleteDoc: DeleteDocFn<T> = useCallback(\n async (existingDoc) => {\n const id = existingDoc?._id ?? docId;\n const doc = await database.get<T>(id).catch(() => undefined);\n if (!doc) throw database.logger.Error().Str(\"id\", id).Msg(`Document not found`).AsError();\n const res = await database.del(id);\n setDoc(initialDoc);\n return res;\n },\n [docId, initialDoc],\n );\n\n const updateDoc: UpdateDocFn<T> = useCallback(\n (newDoc, opts = { replace: false, reset: false }) => {\n if (!newDoc) return void (opts.reset ? setDoc(initialDoc) : refreshDoc());\n setDoc((d) => (opts.replace ? (newDoc as DocWithId<T>) : { ...d, ...newDoc }));\n },\n [refreshDoc, initialDoc],\n );\n\n useEffect(() => {\n if (!docId) return;\n return database.subscribe((changes) => {\n if (changes.find((c) => c._id === docId)) {\n void refreshDoc(); // todo use change.value\n }\n });\n }, [docId, refreshDoc]);\n\n useEffect(() => {\n void refreshDoc();\n }, [refreshDoc]);\n\n return [{ _id: docId, ...doc }, updateDoc, saveDoc, deleteDoc];\n }\n\n function useLiveQuery<T extends DocTypes, K extends IndexKeyType = string, R extends DocFragment = T>(\n mapFn: MapFn<T> | string,\n query = {},\n initialRows: IndexRow<K, T, R>[] = [],\n ): LiveQueryResult<T, K, R> {\n const [result, setResult] = useState<LiveQueryResult<T, K, R>>(() => ({\n rows: initialRows,\n docs: initialRows.map((r) => r.doc).filter((r): r is DocWithId<T> => !!r),\n }));\n\n const queryString = useMemo(() => JSON.stringify(query), [query]);\n const mapFnString = useMemo(() => mapFn.toString(), [mapFn]);\n\n const refreshRows = useCallback(async () => {\n const res = await database.query<K, T, R>(mapFn, query);\n setResult({ ...res, docs: res.rows.map((r) => r.doc as DocWithId<T>) });\n }, [mapFnString, queryString]);\n\n useEffect(() => {\n refreshRows(); // Initial data fetch\n return database.subscribe(refreshRows);\n }, [refreshRows]);\n\n return result;\n }\n\n function useAllDocs<T extends DocTypes>(query: AllDocsQueryOpts = {}): AllDocsResult<T> {\n const [result, setResult] = useState<AllDocsResult<T>>({\n docs: [],\n });\n\n const queryString = useMemo(() => JSON.stringify(query), [query]);\n\n const refreshRows = useCallback(async () => {\n const res = await database.allDocs<T>(query);\n setResult({ ...res, docs: res.rows.map((r) => r.value as DocWithId<T>) });\n }, [queryString]);\n\n useEffect(() => {\n refreshRows(); // Initial data fetch\n return database.subscribe(refreshRows);\n }, [refreshRows]);\n\n return result;\n }\n\n function useChanges<T extends DocTypes>(since: ClockHead = [], opts: ChangesOptions = {}): ChangesResult<T> {\n const [result, setResult] = useState<ChangesResult<T>>({\n docs: [],\n });\n\n const queryString = useMemo(() => JSON.stringify(opts), [opts]);\n\n const refreshRows = useCallback(async () => {\n const res = await database.changes<T>(since, opts);\n setResult({ ...res, docs: res.rows.map((r) => r.value as DocWithId<T>) });\n }, [since, queryString]);\n\n useEffect(() => {\n refreshRows(); // Initial data fetch\n return database.subscribe(refreshRows);\n }, [refreshRows]);\n\n return result;\n }\n\n return { database, useLiveQuery, useDocument, useAllDocs, useChanges };\n}\n","import { Database, DocTypes, DocWithId } from \"@fireproof/core\";\n\nimport { UseDocument, UseDocumentResult, useFireproof } from \"./useFireproof.js\";\n\nexport interface TLUseDocument {\n <T extends DocTypes>(initialDoc: DocWithId<T>): UseDocumentResult<T>;\n database: Database;\n}\n\nfunction topLevelUseDocument(...args: Parameters<UseDocument>) {\n const { useDocument, database } = useFireproof();\n (topLevelUseDocument as TLUseDocument).database = database;\n return useDocument(...args);\n}\n\n/**\n * ## Summary\n *\n * React hook that provides the ability to create new Fireproof documents. The creation occurs when\n * you do not pass in an `_id` as part of your initial document -- the database will assign a new one when\n * you call the provided `save` handler This uses the default database named `useFireproof` under the hood which you can also\n * access via the `database` accessor.\n *\n * ## Usage\n *\n * ```tsx\n * const [todo, setTodo, saveTodo] = useDocument(() => ({\n * text: '',\n * date: Date.now(),\n * completed: false\n * }))\n *\n * const [doc, setDoc, saveDoc] = useDocument(() => ({\n * _id: `${props.customerId}-profile`, // you can imagine `customerId` as a prop passed in\n * name: \"\",\n * company: \"\",\n * startedAt: Date.now()\n * }))\n *\n * const database = useDocument.database; // underlying \"useFireproof\" database accessor\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useLiveQuery` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\nexport const useDocument = topLevelUseDocument as TLUseDocument;\n","import { Database, DocFragment, DocTypes, IndexKeyType } from \"@fireproof/core\";\n\nimport { LiveQueryResult, useFireproof, UseLiveQuery } from \"./useFireproof.js\";\n\nexport interface TLUseLiveQuery {\n <T extends DocTypes, K extends IndexKeyType, R extends DocFragment = T>(\n ...args: Parameters<UseLiveQuery>\n ): LiveQueryResult<T, K, R>;\n database: Database;\n}\n\nfunction topLevelUseLiveQuery(...args: Parameters<UseLiveQuery>) {\n const { useLiveQuery, database } = useFireproof();\n (topLevelUseLiveQuery as TLUseLiveQuery).database = database;\n return useLiveQuery(...args);\n}\n\n/**\n * ## Summary\n * React hook that provides access to live query results, enabling real-time updates in your app. This uses\n * the default database named \"useFireproof\" under the hood which you can also access via the `database` accessor.\n *\n * ## Usage\n * ```tsx\n * const results = useLiveQuery(\"date\"); // using string\n * const results = useLiveQuery((doc) => doc.date)); // using map function\n * const database = useLiveQuery.database; // underlying \"useFireproof\" database accessor\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useLiveQuery` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\nexport const useLiveQuery = topLevelUseLiveQuery as TLUseLiveQuery;\n","import { Database, DocTypes } from \"@fireproof/core\";\n\nimport { AllDocsResult, useFireproof, UseAllDocs } from \"./useFireproof.js\";\n\nexport interface TLUseAllDocs {\n <T extends DocTypes>(...args: Parameters<UseAllDocs>): AllDocsResult<T>;\n database: Database;\n}\n\nfunction topLevelUseAllDocs(...args: Parameters<UseAllDocs>) {\n const { useAllDocs, database } = useFireproof();\n (topLevelUseAllDocs as TLUseAllDocs).database = database;\n return useAllDocs(...args);\n}\n\n/**\n * ## Summary\n * React hook that provides access to all documents in the database, sorted by `_id`.\n *\n * ## Usage\n * ```tsx\n * const result = useAllDocs({ limit: 10, descending: true }); // with options\n * const result = useAllDocs(); // without options\n * const database = useAllDocs.database; // underlying \"useFireproof\" database accessor\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useAllDocs` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\nexport const useAllDocs = topLevelUseAllDocs as TLUseAllDocs;\n","import { DocTypes, Database } from \"@fireproof/core\";\n\nimport { ChangesResult, useFireproof, UseChanges } from \"./useFireproof.js\";\n\nexport interface TLUseChanges {\n <T extends DocTypes>(...args: Parameters<UseChanges>): ChangesResult<T>;\n database: Database;\n}\n\nfunction topLevelUseChanges(...args: Parameters<UseChanges>) {\n const { useChanges, database } = useFireproof();\n (topLevelUseChanges as TLUseChanges).database = database;\n return useChanges(...args);\n}\n\n/**\n * ## Summary\n * React hook that provides access to all new documents in the database added since the last time the changes was called\n *\n * ## Usage\n * ```tsx\n * const result = useChanges(prevresult.clock,{limit:10}); // with options\n * const result = useChanges(); // without options\n * const database = useChanges.database; // underlying \"useFireproof\" database accessor\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useAllDocs`, `useChanges` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\nexport const useChanges = topLevelUseChanges as TLUseChanges;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACaA,kBAA0B;AAC1B,mBAA0D;AAoInD,IAAM,eAAe,CAAC;AA0BtB,SAAS,aAAa,OAA0B,gBAAgB,SAAqB,CAAC,GAAiB;AAC5G,QAAM,WAAW,OAAO,SAAS,eAAW,uB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EAAE,aAAAC,cAAa,SAAS,IAAI,aAAa;AAC/C,EAAC,oBAAsC,WAAW;AAClD,SAAOA,aAAY,GAAG,IAAI;AAC5B;AAkCO,IAAM,cAAc;;;ACpC3B,SAAS,wBAAwB,MAAgC;AAC/D,QAAM,EAAE,cAAAC,eAAc,SAAS,IAAI,aAAa;AAChD,EAAC,qBAAwC,WAAW;AACpD,SAAOA,cAAa,GAAG,IAAI;AAC7B;AAmBO,IAAM,eAAe;;;ACzB5B,SAAS,sBAAsB,MAA8B;AAC3D,QAAM,EAAE,YAAAC,aAAY,SAAS,IAAI,aAAa;AAC9C,EAAC,mBAAoC,WAAW;AAChD,SAAOA,YAAW,GAAG,IAAI;AAC3B;AAkBO,IAAM,aAAa;;;ACtB1B,SAAS,sBAAsB,MAA8B;AAC3D,QAAM,EAAE,YAAAC,aAAY,SAAS,IAAI,aAAa;AAC9C,EAAC,mBAAoC,WAAW;AAChD,SAAOA,YAAW,GAAG,IAAI;AAC3B;AAkBO,IAAM,aAAa;","names":["useDocument","doc","useLiveQuery","useAllDocs","useChanges","useDocument","useLiveQuery","useAllDocs","useChanges"]}
|
package/react/index.js
CHANGED
@@ -9,7 +9,7 @@ function useFireproof(name = "useFireproof", config = {}) {
|
|
9
9
|
if (typeof initialDocOrFn === "function") {
|
10
10
|
initialDoc = initialDocOrFn();
|
11
11
|
} else {
|
12
|
-
initialDoc = initialDocOrFn;
|
12
|
+
initialDoc = initialDocOrFn ?? {};
|
13
13
|
}
|
14
14
|
const docId = initialDoc._id ?? "";
|
15
15
|
const [doc, setDoc] = useState(initialDoc);
|
package/react/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/react/useFireproof.ts","../../../src/react/useDocument.ts","../../../src/react/useLiveQuery.ts","../../../src/react/useAllDocs.ts","../../../src/react/useChanges.ts"],"sourcesContent":["import type {\n ConfigOpts,\n DocFragment,\n DocResponse,\n DocSet,\n DocTypes,\n DocWithId,\n IndexKeyType,\n IndexRow,\n MapFn,\n QueryOpts,\n Database,\n} from \"@fireproof/core\";\nimport { fireproof } from \"@fireproof/core\";\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport type { AllDocsQueryOpts, ChangesOptions, ClockHead } from \"@fireproof/core\";\n\nexport interface LiveQueryResult<T extends DocTypes, K extends IndexKeyType, R extends DocFragment = T> {\n readonly docs: DocWithId<T>[];\n readonly rows: IndexRow<K, T, R>[];\n}\n\nexport type UseLiveQuery = <T extends DocTypes, K extends IndexKeyType = string, R extends DocFragment = T>(\n mapFn: string | MapFn<T>,\n query?: QueryOpts<K>,\n initialRows?: IndexRow<K, T, R>[],\n) => LiveQueryResult<T, K, R>;\n\nexport interface AllDocsResult<T extends DocTypes> {\n readonly docs: DocWithId<T>[];\n}\n\nexport interface ChangesResult<T extends DocTypes> {\n readonly docs: DocWithId<T>[];\n}\n\nexport type UseAllDocs = <T extends DocTypes>(query?: AllDocsQueryOpts) => AllDocsResult<T>;\n\nexport type UseChanges = <T extends DocTypes>(since: ClockHead, opts: ChangesOptions) => ChangesResult<T>;\n\ninterface UpdateDocFnOptions {\n readonly replace?: boolean;\n readonly reset?: boolean;\n}\n\ntype UpdateDocFn<T extends DocTypes> = (newDoc?: DocSet<T>, options?: UpdateDocFnOptions) => void;\n\ntype StoreDocFn<T extends DocTypes> = (existingDoc?: DocWithId<T>) => Promise<DocResponse>;\n\ntype DeleteDocFn<T extends DocTypes> = (existingDoc?: DocWithId<T>) => Promise<DocResponse>;\n\nexport type UseDocumentResult<T extends DocTypes> = [DocWithId<T>, UpdateDocFn<T>, StoreDocFn<T>, DeleteDocFn<T>];\n\nexport type UseDocumentInitialDocOrFn<T extends DocTypes> = DocSet<T> | (() => DocSet<T>);\nexport type UseDocument = <T extends DocTypes>(initialDocOrFn: UseDocumentInitialDocOrFn<T>) => UseDocumentResult<T>;\n\nexport interface UseFireproof {\n readonly database: Database;\n /**\n * ## Summary\n *\n * React hook that provides the ability to create/update/save new Fireproof documents into your custom Fireproof database.\n * The creation occurs when you do not pass in an `_id` as part of your initial document -- the database will assign a new\n * one when you call the provided `save` handler. The hook also provides generics support so you can inline your custom type into\n * the invocation to receive type-safety and auto-complete support in your IDE.\n *\n * ## Usage\n *\n * ```tsx\n * const [todo, setTodo, saveTodo] = useDocument<Todo>({\n * text: '',\n * date: Date.now(),\n * completed: false\n * })\n *\n * const [doc, setDoc, saveDoc] = useDocument<Customer>({\n * _id: `${props.customerId}-profile`, // you can imagine `customerId` as a prop passed in\n * name: \"\",\n * company: \"\",\n * startedAt: Date.now()\n * })\n * ```\n *\n * ## Overview\n *\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useLiveQuery` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\n readonly useDocument: UseDocument;\n /**\n * ## Summary\n * React hook that provides access to live query results, enabling real-time updates in your app.\n *\n * ## Usage\n * ```tsx\n * const result = useLiveQuery(\"date\"); // using string key\n * const result = useLiveQuery('date', { limit: 10, descending: true }) // key + options\n * const result = useLiveQuery<CustomType>(\"date\"); // using generics\n * const result = useLiveQuery((doc) => doc.date)); // using map function\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useLiveQuery` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\n readonly useLiveQuery: UseLiveQuery;\n /**\n * ## Summary\n * React hook that provides access to all documents in the database, sorted by `_id`.\n *\n * ## Usage\n * ```tsx\n * const result = useAllDocs({ limit: 10, descending: true }); // with options\n * const result = useAllDocs(); // without options\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useAllDocs` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\n readonly useAllDocs: UseAllDocs;\n /**\n * ## Summary\n * React hook that provides access to all new documents in the database added since the last time the changes was called\n *\n * ## Usage\n * ```tsx\n * const result = useChanges(prevresult.clock,{limit:10}); // with options\n * const result = useChanges(); // without options\n * const database = useChanges.database; // underlying \"useFireproof\" database accessor\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useAllDocs`, `useChanges` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\n readonly useChanges: UseChanges;\n}\n\n/**\n * @deprecated Use the `useFireproof` hook instead\n */\nexport const FireproofCtx = {} as UseFireproof;\n\n/**\n *\n * ## Summary\n *\n * React hook to create a custom-named Fireproof database and provides the utility hooks to query against it.\n *\n * ## Usage\n * ```tsx\n * const { database, useLiveQuery, useDocument } = useFireproof(\"dbname\");\n * const { database, useLiveQuery, useDocument } = useFireproof(\"dbname\", { ...options });\n * ```\n *\n * ## Overview\n *\n * TL;DR: Only use this hook if you need to configure a database name other than the default `useFireproof`.\n *\n * For most applications, using the `useLiveQuery` or `useDocument` hooks exported from `use-fireproof` should\n * suffice for the majority of use-cases. Under the hood, they act against a database named `useFireproof` instantiated with\n * default configurations. However, if you need to do a custom database setup or configure a database name more to your liking\n * than the default `useFireproof`, then use `useFireproof` as it exists for that purpose. It will provide you with the\n * custom database accessor and *lexically scoped* versions of `useLiveQuery` and `useDocument` that act against said\n * custom database.\n *\n */\nexport function useFireproof(name: string | Database = \"useFireproof\", config: ConfigOpts = {}): UseFireproof {\n const database = typeof name === \"string\" ? fireproof(name, config) : name;\n\n function useDocument<T extends DocTypes>(initialDocOrFn: UseDocumentInitialDocOrFn<T>): UseDocumentResult<T> {\n let initialDoc: DocSet<T>;\n if (typeof initialDocOrFn === \"function\") {\n initialDoc = initialDocOrFn();\n } else {\n initialDoc = initialDocOrFn;\n }\n\n // We purposely refetch the docId everytime to check if it has changed\n const docId = initialDoc._id ?? \"\";\n\n // We do not want to force consumers to memoize their initial document so we do it for them.\n // We use the stringified generator function to ensure that the memoization is stable across renders.\n // const initialDoc = useMemo(initialDocFn, [initialDocFn.toString()]);\n const [doc, setDoc] = useState(initialDoc);\n\n const refreshDoc = useCallback(async () => {\n // todo add option for mvcc checks\n const doc = docId ? await database.get<T>(docId).catch(() => initialDoc) : initialDoc;\n setDoc(doc);\n }, [docId]);\n\n const saveDoc: StoreDocFn<T> = useCallback(\n async (existingDoc) => {\n const res = await database.put(existingDoc ?? doc);\n // If the document was created, then we need to update the local state with the new `_id`\n if (!existingDoc && !doc._id) setDoc((d) => ({ ...d, _id: res.id }));\n return res;\n },\n [doc],\n );\n\n const deleteDoc: DeleteDocFn<T> = useCallback(\n async (existingDoc) => {\n const id = existingDoc?._id ?? docId;\n const doc = await database.get<T>(id).catch(() => undefined);\n if (!doc) throw database.logger.Error().Str(\"id\", id).Msg(`Document not found`).AsError();\n const res = await database.del(id);\n setDoc(initialDoc);\n return res;\n },\n [docId, initialDoc],\n );\n\n const updateDoc: UpdateDocFn<T> = useCallback(\n (newDoc, opts = { replace: false, reset: false }) => {\n if (!newDoc) return void (opts.reset ? setDoc(initialDoc) : refreshDoc());\n setDoc((d) => (opts.replace ? (newDoc as DocWithId<T>) : { ...d, ...newDoc }));\n },\n [refreshDoc, initialDoc],\n );\n\n useEffect(() => {\n if (!docId) return;\n return database.subscribe((changes) => {\n if (changes.find((c) => c._id === docId)) {\n void refreshDoc(); // todo use change.value\n }\n });\n }, [docId, refreshDoc]);\n\n useEffect(() => {\n void refreshDoc();\n }, [refreshDoc]);\n\n return [{ _id: docId, ...doc }, updateDoc, saveDoc, deleteDoc];\n }\n\n function useLiveQuery<T extends DocTypes, K extends IndexKeyType = string, R extends DocFragment = T>(\n mapFn: MapFn<T> | string,\n query = {},\n initialRows: IndexRow<K, T, R>[] = [],\n ): LiveQueryResult<T, K, R> {\n const [result, setResult] = useState<LiveQueryResult<T, K, R>>(() => ({\n rows: initialRows,\n docs: initialRows.map((r) => r.doc).filter((r): r is DocWithId<T> => !!r),\n }));\n\n const queryString = useMemo(() => JSON.stringify(query), [query]);\n const mapFnString = useMemo(() => mapFn.toString(), [mapFn]);\n\n const refreshRows = useCallback(async () => {\n const res = await database.query<K, T, R>(mapFn, query);\n setResult({ ...res, docs: res.rows.map((r) => r.doc as DocWithId<T>) });\n }, [mapFnString, queryString]);\n\n useEffect(() => {\n refreshRows(); // Initial data fetch\n return database.subscribe(refreshRows);\n }, [refreshRows]);\n\n return result;\n }\n\n function useAllDocs<T extends DocTypes>(query: AllDocsQueryOpts = {}): AllDocsResult<T> {\n const [result, setResult] = useState<AllDocsResult<T>>({\n docs: [],\n });\n\n const queryString = useMemo(() => JSON.stringify(query), [query]);\n\n const refreshRows = useCallback(async () => {\n const res = await database.allDocs<T>(query);\n setResult({ ...res, docs: res.rows.map((r) => r.value as DocWithId<T>) });\n }, [queryString]);\n\n useEffect(() => {\n refreshRows(); // Initial data fetch\n return database.subscribe(refreshRows);\n }, [refreshRows]);\n\n return result;\n }\n\n function useChanges<T extends DocTypes>(since: ClockHead = [], opts: ChangesOptions = {}): ChangesResult<T> {\n const [result, setResult] = useState<ChangesResult<T>>({\n docs: [],\n });\n\n const queryString = useMemo(() => JSON.stringify(opts), [opts]);\n\n const refreshRows = useCallback(async () => {\n const res = await database.changes<T>(since, opts);\n setResult({ ...res, docs: res.rows.map((r) => r.value as DocWithId<T>) });\n }, [since, queryString]);\n\n useEffect(() => {\n refreshRows(); // Initial data fetch\n return database.subscribe(refreshRows);\n }, [refreshRows]);\n\n return result;\n }\n\n return { database, useLiveQuery, useDocument, useAllDocs, useChanges };\n}\n","import { Database, DocTypes, DocWithId } from \"@fireproof/core\";\n\nimport { UseDocument, UseDocumentResult, useFireproof } from \"./useFireproof.js\";\n\nexport interface TLUseDocument {\n <T extends DocTypes>(initialDoc: DocWithId<T>): UseDocumentResult<T>;\n database: Database;\n}\n\nfunction topLevelUseDocument(...args: Parameters<UseDocument>) {\n const { useDocument, database } = useFireproof();\n (topLevelUseDocument as TLUseDocument).database = database;\n return useDocument(...args);\n}\n\n/**\n * ## Summary\n *\n * React hook that provides the ability to create new Fireproof documents. The creation occurs when\n * you do not pass in an `_id` as part of your initial document -- the database will assign a new one when\n * you call the provided `save` handler This uses the default database named `useFireproof` under the hood which you can also\n * access via the `database` accessor.\n *\n * ## Usage\n *\n * ```tsx\n * const [todo, setTodo, saveTodo] = useDocument(() => ({\n * text: '',\n * date: Date.now(),\n * completed: false\n * }))\n *\n * const [doc, setDoc, saveDoc] = useDocument(() => ({\n * _id: `${props.customerId}-profile`, // you can imagine `customerId` as a prop passed in\n * name: \"\",\n * company: \"\",\n * startedAt: Date.now()\n * }))\n *\n * const database = useDocument.database; // underlying \"useFireproof\" database accessor\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useLiveQuery` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\nexport const useDocument = topLevelUseDocument as TLUseDocument;\n","import { Database, DocFragment, DocTypes, IndexKeyType } from \"@fireproof/core\";\n\nimport { LiveQueryResult, useFireproof, UseLiveQuery } from \"./useFireproof.js\";\n\nexport interface TLUseLiveQuery {\n <T extends DocTypes, K extends IndexKeyType, R extends DocFragment = T>(\n ...args: Parameters<UseLiveQuery>\n ): LiveQueryResult<T, K, R>;\n database: Database;\n}\n\nfunction topLevelUseLiveQuery(...args: Parameters<UseLiveQuery>) {\n const { useLiveQuery, database } = useFireproof();\n (topLevelUseLiveQuery as TLUseLiveQuery).database = database;\n return useLiveQuery(...args);\n}\n\n/**\n * ## Summary\n * React hook that provides access to live query results, enabling real-time updates in your app. This uses\n * the default database named \"useFireproof\" under the hood which you can also access via the `database` accessor.\n *\n * ## Usage\n * ```tsx\n * const results = useLiveQuery(\"date\"); // using string\n * const results = useLiveQuery((doc) => doc.date)); // using map function\n * const database = useLiveQuery.database; // underlying \"useFireproof\" database accessor\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useLiveQuery` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\nexport const useLiveQuery = topLevelUseLiveQuery as TLUseLiveQuery;\n","import { Database, DocTypes } from \"@fireproof/core\";\n\nimport { AllDocsResult, useFireproof, UseAllDocs } from \"./useFireproof.js\";\n\nexport interface TLUseAllDocs {\n <T extends DocTypes>(...args: Parameters<UseAllDocs>): AllDocsResult<T>;\n database: Database;\n}\n\nfunction topLevelUseAllDocs(...args: Parameters<UseAllDocs>) {\n const { useAllDocs, database } = useFireproof();\n (topLevelUseAllDocs as TLUseAllDocs).database = database;\n return useAllDocs(...args);\n}\n\n/**\n * ## Summary\n * React hook that provides access to all documents in the database, sorted by `_id`.\n *\n * ## Usage\n * ```tsx\n * const result = useAllDocs({ limit: 10, descending: true }); // with options\n * const result = useAllDocs(); // without options\n * const database = useAllDocs.database; // underlying \"useFireproof\" database accessor\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useAllDocs` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\nexport const useAllDocs = topLevelUseAllDocs as TLUseAllDocs;\n","import { DocTypes, Database } from \"@fireproof/core\";\n\nimport { ChangesResult, useFireproof, UseChanges } from \"./useFireproof.js\";\n\nexport interface TLUseChanges {\n <T extends DocTypes>(...args: Parameters<UseChanges>): ChangesResult<T>;\n database: Database;\n}\n\nfunction topLevelUseChanges(...args: Parameters<UseChanges>) {\n const { useChanges, database } = useFireproof();\n (topLevelUseChanges as TLUseChanges).database = database;\n return useChanges(...args);\n}\n\n/**\n * ## Summary\n * React hook that provides access to all new documents in the database added since the last time the changes was called\n *\n * ## Usage\n * ```tsx\n * const result = useChanges(prevresult.clock,{limit:10}); // with options\n * const result = useChanges(); // without options\n * const database = useChanges.database; // underlying \"useFireproof\" database accessor\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useAllDocs`, `useChanges` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\nexport const useChanges = topLevelUseChanges as TLUseChanges;\n"],"mappings":";AAaA,SAAS,iBAAiB;AAC1B,SAAS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AF,eAAc,aAAAF,cAAa,YAAAG,aAAY,YAAAC,YAAW;AACvE;;;AC7SA,SAAS,uBAAuB,MAA+B;AAC7D,QAAM,EAAE,aAAAC,cAAa,SAAS,IAAI,aAAa;AAC/C,EAAC,oBAAsC,WAAW;AAClD,SAAOA,aAAY,GAAG,IAAI;AAC5B;AAkCO,IAAM,cAAc;;;ACpC3B,SAAS,wBAAwB,MAAgC;AAC/D,QAAM,EAAE,cAAAC,eAAc,SAAS,IAAI,aAAa;AAChD,EAAC,qBAAwC,WAAW;AACpD,SAAOA,cAAa,GAAG,IAAI;AAC7B;AAmBO,IAAM,eAAe;;;ACzB5B,SAAS,sBAAsB,MAA8B;AAC3D,QAAM,EAAE,YAAAC,aAAY,SAAS,IAAI,aAAa;AAC9C,EAAC,mBAAoC,WAAW;AAChD,SAAOA,YAAW,GAAG,IAAI;AAC3B;AAkBO,IAAM,aAAa;;;ACtB1B,SAAS,sBAAsB,MAA8B;AAC3D,QAAM,EAAE,YAAAC,aAAY,SAAS,IAAI,aAAa;AAC9C,EAAC,mBAAoC,WAAW;AAChD,SAAOA,YAAW,GAAG,IAAI;AAC3B;AAkBO,IAAM,aAAa;","names":["useDocument","doc","useLiveQuery","useAllDocs","useChanges","useDocument","useLiveQuery","useAllDocs","useChanges"]}
|
1
|
+
{"version":3,"sources":["../../../src/react/useFireproof.ts","../../../src/react/useDocument.ts","../../../src/react/useLiveQuery.ts","../../../src/react/useAllDocs.ts","../../../src/react/useChanges.ts"],"sourcesContent":["import type {\n ConfigOpts,\n DocFragment,\n DocResponse,\n DocSet,\n DocTypes,\n DocWithId,\n IndexKeyType,\n IndexRow,\n MapFn,\n QueryOpts,\n Database,\n} from \"@fireproof/core\";\nimport { fireproof } from \"@fireproof/core\";\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport type { AllDocsQueryOpts, ChangesOptions, ClockHead } from \"@fireproof/core\";\n\nexport interface LiveQueryResult<T extends DocTypes, K extends IndexKeyType, R extends DocFragment = T> {\n readonly docs: DocWithId<T>[];\n readonly rows: IndexRow<K, T, R>[];\n}\n\nexport type UseLiveQuery = <T extends DocTypes, K extends IndexKeyType = string, R extends DocFragment = T>(\n mapFn: string | MapFn<T>,\n query?: QueryOpts<K>,\n initialRows?: IndexRow<K, T, R>[],\n) => LiveQueryResult<T, K, R>;\n\nexport interface AllDocsResult<T extends DocTypes> {\n readonly docs: DocWithId<T>[];\n}\n\nexport interface ChangesResult<T extends DocTypes> {\n readonly docs: DocWithId<T>[];\n}\n\nexport type UseAllDocs = <T extends DocTypes>(query?: AllDocsQueryOpts) => AllDocsResult<T>;\n\nexport type UseChanges = <T extends DocTypes>(since: ClockHead, opts: ChangesOptions) => ChangesResult<T>;\n\ninterface UpdateDocFnOptions {\n readonly replace?: boolean;\n readonly reset?: boolean;\n}\n\ntype UpdateDocFn<T extends DocTypes> = (newDoc?: DocSet<T>, options?: UpdateDocFnOptions) => void;\n\ntype StoreDocFn<T extends DocTypes> = (existingDoc?: DocWithId<T>) => Promise<DocResponse>;\n\ntype DeleteDocFn<T extends DocTypes> = (existingDoc?: DocWithId<T>) => Promise<DocResponse>;\n\nexport type UseDocumentResult<T extends DocTypes> = [DocWithId<T>, UpdateDocFn<T>, StoreDocFn<T>, DeleteDocFn<T>];\n\nexport type UseDocumentInitialDocOrFn<T extends DocTypes> = DocSet<T> | (() => DocSet<T>);\nexport type UseDocument = <T extends DocTypes>(initialDocOrFn: UseDocumentInitialDocOrFn<T>) => UseDocumentResult<T>;\n\nexport interface UseFireproof {\n readonly database: Database;\n /**\n * ## Summary\n *\n * React hook that provides the ability to create/update/save new Fireproof documents into your custom Fireproof database.\n * The creation occurs when you do not pass in an `_id` as part of your initial document -- the database will assign a new\n * one when you call the provided `save` handler. The hook also provides generics support so you can inline your custom type into\n * the invocation to receive type-safety and auto-complete support in your IDE.\n *\n * ## Usage\n *\n * ```tsx\n * const [todo, setTodo, saveTodo] = useDocument<Todo>({\n * text: '',\n * date: Date.now(),\n * completed: false\n * })\n *\n * const [doc, setDoc, saveDoc] = useDocument<Customer>({\n * _id: `${props.customerId}-profile`, // you can imagine `customerId` as a prop passed in\n * name: \"\",\n * company: \"\",\n * startedAt: Date.now()\n * })\n * ```\n *\n * ## Overview\n *\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useLiveQuery` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\n readonly useDocument: UseDocument;\n /**\n * ## Summary\n * React hook that provides access to live query results, enabling real-time updates in your app.\n *\n * ## Usage\n * ```tsx\n * const result = useLiveQuery(\"date\"); // using string key\n * const result = useLiveQuery('date', { limit: 10, descending: true }) // key + options\n * const result = useLiveQuery<CustomType>(\"date\"); // using generics\n * const result = useLiveQuery((doc) => doc.date)); // using map function\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useLiveQuery` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\n readonly useLiveQuery: UseLiveQuery;\n /**\n * ## Summary\n * React hook that provides access to all documents in the database, sorted by `_id`.\n *\n * ## Usage\n * ```tsx\n * const result = useAllDocs({ limit: 10, descending: true }); // with options\n * const result = useAllDocs(); // without options\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useAllDocs` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\n readonly useAllDocs: UseAllDocs;\n /**\n * ## Summary\n * React hook that provides access to all new documents in the database added since the last time the changes was called\n *\n * ## Usage\n * ```tsx\n * const result = useChanges(prevresult.clock,{limit:10}); // with options\n * const result = useChanges(); // without options\n * const database = useChanges.database; // underlying \"useFireproof\" database accessor\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useAllDocs`, `useChanges` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\n readonly useChanges: UseChanges;\n}\n\n/**\n * @deprecated Use the `useFireproof` hook instead\n */\nexport const FireproofCtx = {} as UseFireproof;\n\n/**\n *\n * ## Summary\n *\n * React hook to create a custom-named Fireproof database and provides the utility hooks to query against it.\n *\n * ## Usage\n * ```tsx\n * const { database, useLiveQuery, useDocument } = useFireproof(\"dbname\");\n * const { database, useLiveQuery, useDocument } = useFireproof(\"dbname\", { ...options });\n * ```\n *\n * ## Overview\n *\n * TL;DR: Only use this hook if you need to configure a database name other than the default `useFireproof`.\n *\n * For most applications, using the `useLiveQuery` or `useDocument` hooks exported from `use-fireproof` should\n * suffice for the majority of use-cases. Under the hood, they act against a database named `useFireproof` instantiated with\n * default configurations. However, if you need to do a custom database setup or configure a database name more to your liking\n * than the default `useFireproof`, then use `useFireproof` as it exists for that purpose. It will provide you with the\n * custom database accessor and *lexically scoped* versions of `useLiveQuery` and `useDocument` that act against said\n * custom database.\n *\n */\nexport function useFireproof(name: string | Database = \"useFireproof\", config: ConfigOpts = {}): UseFireproof {\n const database = typeof name === \"string\" ? fireproof(name, config) : name;\n\n function useDocument<T extends DocTypes>(initialDocOrFn?: UseDocumentInitialDocOrFn<T>): UseDocumentResult<T> {\n let initialDoc: DocSet<T>;\n if (typeof initialDocOrFn === \"function\") {\n initialDoc = initialDocOrFn();\n } else {\n initialDoc = initialDocOrFn ?? ({} as T);\n }\n\n // We purposely refetch the docId everytime to check if it has changed\n const docId = initialDoc._id ?? \"\";\n\n // We do not want to force consumers to memoize their initial document so we do it for them.\n // We use the stringified generator function to ensure that the memoization is stable across renders.\n // const initialDoc = useMemo(initialDocFn, [initialDocFn.toString()]);\n const [doc, setDoc] = useState(initialDoc);\n\n const refreshDoc = useCallback(async () => {\n // todo add option for mvcc checks\n const doc = docId ? await database.get<T>(docId).catch(() => initialDoc) : initialDoc;\n setDoc(doc);\n }, [docId]);\n\n const saveDoc: StoreDocFn<T> = useCallback(\n async (existingDoc) => {\n const res = await database.put(existingDoc ?? doc);\n // If the document was created, then we need to update the local state with the new `_id`\n if (!existingDoc && !doc._id) setDoc((d) => ({ ...d, _id: res.id }));\n return res;\n },\n [doc],\n );\n\n const deleteDoc: DeleteDocFn<T> = useCallback(\n async (existingDoc) => {\n const id = existingDoc?._id ?? docId;\n const doc = await database.get<T>(id).catch(() => undefined);\n if (!doc) throw database.logger.Error().Str(\"id\", id).Msg(`Document not found`).AsError();\n const res = await database.del(id);\n setDoc(initialDoc);\n return res;\n },\n [docId, initialDoc],\n );\n\n const updateDoc: UpdateDocFn<T> = useCallback(\n (newDoc, opts = { replace: false, reset: false }) => {\n if (!newDoc) return void (opts.reset ? setDoc(initialDoc) : refreshDoc());\n setDoc((d) => (opts.replace ? (newDoc as DocWithId<T>) : { ...d, ...newDoc }));\n },\n [refreshDoc, initialDoc],\n );\n\n useEffect(() => {\n if (!docId) return;\n return database.subscribe((changes) => {\n if (changes.find((c) => c._id === docId)) {\n void refreshDoc(); // todo use change.value\n }\n });\n }, [docId, refreshDoc]);\n\n useEffect(() => {\n void refreshDoc();\n }, [refreshDoc]);\n\n return [{ _id: docId, ...doc }, updateDoc, saveDoc, deleteDoc];\n }\n\n function useLiveQuery<T extends DocTypes, K extends IndexKeyType = string, R extends DocFragment = T>(\n mapFn: MapFn<T> | string,\n query = {},\n initialRows: IndexRow<K, T, R>[] = [],\n ): LiveQueryResult<T, K, R> {\n const [result, setResult] = useState<LiveQueryResult<T, K, R>>(() => ({\n rows: initialRows,\n docs: initialRows.map((r) => r.doc).filter((r): r is DocWithId<T> => !!r),\n }));\n\n const queryString = useMemo(() => JSON.stringify(query), [query]);\n const mapFnString = useMemo(() => mapFn.toString(), [mapFn]);\n\n const refreshRows = useCallback(async () => {\n const res = await database.query<K, T, R>(mapFn, query);\n setResult({ ...res, docs: res.rows.map((r) => r.doc as DocWithId<T>) });\n }, [mapFnString, queryString]);\n\n useEffect(() => {\n refreshRows(); // Initial data fetch\n return database.subscribe(refreshRows);\n }, [refreshRows]);\n\n return result;\n }\n\n function useAllDocs<T extends DocTypes>(query: AllDocsQueryOpts = {}): AllDocsResult<T> {\n const [result, setResult] = useState<AllDocsResult<T>>({\n docs: [],\n });\n\n const queryString = useMemo(() => JSON.stringify(query), [query]);\n\n const refreshRows = useCallback(async () => {\n const res = await database.allDocs<T>(query);\n setResult({ ...res, docs: res.rows.map((r) => r.value as DocWithId<T>) });\n }, [queryString]);\n\n useEffect(() => {\n refreshRows(); // Initial data fetch\n return database.subscribe(refreshRows);\n }, [refreshRows]);\n\n return result;\n }\n\n function useChanges<T extends DocTypes>(since: ClockHead = [], opts: ChangesOptions = {}): ChangesResult<T> {\n const [result, setResult] = useState<ChangesResult<T>>({\n docs: [],\n });\n\n const queryString = useMemo(() => JSON.stringify(opts), [opts]);\n\n const refreshRows = useCallback(async () => {\n const res = await database.changes<T>(since, opts);\n setResult({ ...res, docs: res.rows.map((r) => r.value as DocWithId<T>) });\n }, [since, queryString]);\n\n useEffect(() => {\n refreshRows(); // Initial data fetch\n return database.subscribe(refreshRows);\n }, [refreshRows]);\n\n return result;\n }\n\n return { database, useLiveQuery, useDocument, useAllDocs, useChanges };\n}\n","import { Database, DocTypes, DocWithId } from \"@fireproof/core\";\n\nimport { UseDocument, UseDocumentResult, useFireproof } from \"./useFireproof.js\";\n\nexport interface TLUseDocument {\n <T extends DocTypes>(initialDoc: DocWithId<T>): UseDocumentResult<T>;\n database: Database;\n}\n\nfunction topLevelUseDocument(...args: Parameters<UseDocument>) {\n const { useDocument, database } = useFireproof();\n (topLevelUseDocument as TLUseDocument).database = database;\n return useDocument(...args);\n}\n\n/**\n * ## Summary\n *\n * React hook that provides the ability to create new Fireproof documents. The creation occurs when\n * you do not pass in an `_id` as part of your initial document -- the database will assign a new one when\n * you call the provided `save` handler This uses the default database named `useFireproof` under the hood which you can also\n * access via the `database` accessor.\n *\n * ## Usage\n *\n * ```tsx\n * const [todo, setTodo, saveTodo] = useDocument(() => ({\n * text: '',\n * date: Date.now(),\n * completed: false\n * }))\n *\n * const [doc, setDoc, saveDoc] = useDocument(() => ({\n * _id: `${props.customerId}-profile`, // you can imagine `customerId` as a prop passed in\n * name: \"\",\n * company: \"\",\n * startedAt: Date.now()\n * }))\n *\n * const database = useDocument.database; // underlying \"useFireproof\" database accessor\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useLiveQuery` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\nexport const useDocument = topLevelUseDocument as TLUseDocument;\n","import { Database, DocFragment, DocTypes, IndexKeyType } from \"@fireproof/core\";\n\nimport { LiveQueryResult, useFireproof, UseLiveQuery } from \"./useFireproof.js\";\n\nexport interface TLUseLiveQuery {\n <T extends DocTypes, K extends IndexKeyType, R extends DocFragment = T>(\n ...args: Parameters<UseLiveQuery>\n ): LiveQueryResult<T, K, R>;\n database: Database;\n}\n\nfunction topLevelUseLiveQuery(...args: Parameters<UseLiveQuery>) {\n const { useLiveQuery, database } = useFireproof();\n (topLevelUseLiveQuery as TLUseLiveQuery).database = database;\n return useLiveQuery(...args);\n}\n\n/**\n * ## Summary\n * React hook that provides access to live query results, enabling real-time updates in your app. This uses\n * the default database named \"useFireproof\" under the hood which you can also access via the `database` accessor.\n *\n * ## Usage\n * ```tsx\n * const results = useLiveQuery(\"date\"); // using string\n * const results = useLiveQuery((doc) => doc.date)); // using map function\n * const database = useLiveQuery.database; // underlying \"useFireproof\" database accessor\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useLiveQuery` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\nexport const useLiveQuery = topLevelUseLiveQuery as TLUseLiveQuery;\n","import { Database, DocTypes } from \"@fireproof/core\";\n\nimport { AllDocsResult, useFireproof, UseAllDocs } from \"./useFireproof.js\";\n\nexport interface TLUseAllDocs {\n <T extends DocTypes>(...args: Parameters<UseAllDocs>): AllDocsResult<T>;\n database: Database;\n}\n\nfunction topLevelUseAllDocs(...args: Parameters<UseAllDocs>) {\n const { useAllDocs, database } = useFireproof();\n (topLevelUseAllDocs as TLUseAllDocs).database = database;\n return useAllDocs(...args);\n}\n\n/**\n * ## Summary\n * React hook that provides access to all documents in the database, sorted by `_id`.\n *\n * ## Usage\n * ```tsx\n * const result = useAllDocs({ limit: 10, descending: true }); // with options\n * const result = useAllDocs(); // without options\n * const database = useAllDocs.database; // underlying \"useFireproof\" database accessor\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useAllDocs` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\nexport const useAllDocs = topLevelUseAllDocs as TLUseAllDocs;\n","import { DocTypes, Database } from \"@fireproof/core\";\n\nimport { ChangesResult, useFireproof, UseChanges } from \"./useFireproof.js\";\n\nexport interface TLUseChanges {\n <T extends DocTypes>(...args: Parameters<UseChanges>): ChangesResult<T>;\n database: Database;\n}\n\nfunction topLevelUseChanges(...args: Parameters<UseChanges>) {\n const { useChanges, database } = useFireproof();\n (topLevelUseChanges as TLUseChanges).database = database;\n return useChanges(...args);\n}\n\n/**\n * ## Summary\n * React hook that provides access to all new documents in the database added since the last time the changes was called\n *\n * ## Usage\n * ```tsx\n * const result = useChanges(prevresult.clock,{limit:10}); // with options\n * const result = useChanges(); // without options\n * const database = useChanges.database; // underlying \"useFireproof\" database accessor\n * ```\n *\n * ## Overview\n * Changes made via remote sync peers, or other members of your cloud replica group will appear automatically\n * when you use the `useAllDocs`, `useChanges` and `useDocument` APIs. By default, Fireproof stores data in the browser's\n * local storage.\n */\nexport const useChanges = topLevelUseChanges as TLUseChanges;\n"],"mappings":";AAaA,SAAS,iBAAiB;AAC1B,SAAS,aAAa,WAAW,SAAS,gBAAgB;AAoInD,IAAM,eAAe,CAAC;AA0BtB,SAAS,aAAa,OAA0B,gBAAgB,SAAqB,CAAC,GAAiB;AAC5G,QAAM,WAAW,OAAO,SAAS,WAAW,UAAU,MAAM,MAAM,IAAI;AAEtE,WAASA,aAAgC,gBAAqE;AAC5G,QAAI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AAC5B;AAkCO,IAAM,cAAc;;;ACpC3B,SAAS,wBAAwB,MAAgC;AAC/D,QAAM,EAAE,cAAAC,eAAc,SAAS,IAAI,aAAa;AAChD,EAAC,qBAAwC,WAAW;AACpD,SAAOA,cAAa,GAAG,IAAI;AAC7B;AAmBO,IAAM,eAAe;;;ACzB5B,SAAS,sBAAsB,MAA8B;AAC3D,QAAM,EAAE,YAAAC,aAAY,SAAS,IAAI,aAAa;AAC9C,EAAC,mBAAoC,WAAW;AAChD,SAAOA,YAAW,GAAG,IAAI;AAC3B;AAkBO,IAAM,aAAa;;;ACtB1B,SAAS,sBAAsB,MAA8B;AAC3D,QAAM,EAAE,YAAAC,aAAY,SAAS,IAAI,aAAa;AAC9C,EAAC,mBAAoC,WAAW;AAChD,SAAOA,YAAW,GAAG,IAAI;AAC3B;AAkBO,IAAM,aAAa;","names":["useDocument","doc","useLiveQuery","useAllDocs","useChanges","useDocument","useLiveQuery","useAllDocs","useChanges"]}
|
package/react/metafile-cjs.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"inputs":{"src/react/useFireproof.ts":{"bytes":
|
1
|
+
{"inputs":{"src/react/useFireproof.ts":{"bytes":11404,"imports":[{"path":"@fireproof/core","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/react/useDocument.ts":{"bytes":1680,"imports":[{"path":"@fireproof/core","kind":"import-statement","external":true},{"path":"src/react/useFireproof.ts","kind":"import-statement","original":"./useFireproof.js"}],"format":"esm"},"src/react/useLiveQuery.ts":{"bytes":1409,"imports":[{"path":"@fireproof/core","kind":"import-statement","external":true},{"path":"src/react/useFireproof.ts","kind":"import-statement","original":"./useFireproof.js"}],"format":"esm"},"src/react/useAllDocs.ts":{"bytes":1146,"imports":[{"path":"@fireproof/core","kind":"import-statement","external":true},{"path":"src/react/useFireproof.ts","kind":"import-statement","original":"./useFireproof.js"}],"format":"esm"},"src/react/useChanges.ts":{"bytes":1191,"imports":[{"path":"@fireproof/core","kind":"import-statement","external":true},{"path":"src/react/useFireproof.ts","kind":"import-statement","original":"./useFireproof.js"}],"format":"esm"},"src/react/index.ts":{"bytes":971,"imports":[{"path":"src/react/useDocument.ts","kind":"import-statement","original":"./useDocument.js"},{"path":"src/react/useFireproof.ts","kind":"import-statement","original":"./useFireproof.js"},{"path":"src/react/useLiveQuery.ts","kind":"import-statement","original":"./useLiveQuery.js"},{"path":"src/react/useAllDocs.ts","kind":"import-statement","original":"./useAllDocs.js"},{"path":"src/react/useChanges.ts","kind":"import-statement","original":"./useChanges.js"}],"format":"esm"}},"outputs":{"dist/fireproof-core/react/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":22652},"dist/fireproof-core/react/index.cjs":{"imports":[{"path":"@fireproof/core","kind":"require-call","external":true},{"path":"react","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/react/index.ts","inputs":{"src/react/index.ts":{"bytesInOutput":305},"src/react/useFireproof.ts":{"bytesInOutput":4243},"src/react/useDocument.ts":{"bytesInOutput":222},"src/react/useLiveQuery.ts":{"bytesInOutput":229},"src/react/useAllDocs.ts":{"bytesInOutput":215},"src/react/useChanges.ts":{"bytesInOutput":215}},"bytes":6396}}}
|