tinybase 5.1.0 → 5.1.2
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/@types/persisters/persister-powersync/index.d.cts +4 -4
- package/@types/persisters/persister-powersync/index.d.ts +4 -4
- package/@types/persisters/persister-powersync/with-schemas/index.d.cts +4 -4
- package/@types/persisters/persister-powersync/with-schemas/index.d.ts +4 -4
- package/@types/synchronizers/synchronizer-ws-client/index.d.cts +6 -0
- package/@types/synchronizers/synchronizer-ws-client/index.d.ts +6 -0
- package/@types/synchronizers/synchronizer-ws-client/with-schemas/index.d.cts +6 -0
- package/@types/synchronizers/synchronizer-ws-client/with-schemas/index.d.ts +6 -0
- package/@types/synchronizers/synchronizer-ws-server/index.d.cts +66 -4
- package/@types/synchronizers/synchronizer-ws-server/index.d.ts +66 -4
- package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.cts +72 -5
- package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.ts +72 -5
- package/cjs/es6/min/checkpoints/index.cjs +1 -1
- package/cjs/es6/min/checkpoints/index.cjs.gz +0 -0
- package/cjs/es6/min/checkpoints/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/checkpoints/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/index.cjs +1 -1
- package/cjs/es6/min/index.cjs.gz +0 -0
- package/cjs/es6/min/indexes/index.cjs +1 -1
- package/cjs/es6/min/indexes/index.cjs.gz +0 -0
- package/cjs/es6/min/indexes/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/indexes/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/mergeable-store/index.cjs +1 -1
- package/cjs/es6/min/mergeable-store/index.cjs.gz +0 -0
- package/cjs/es6/min/mergeable-store/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/mergeable-store/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/metrics/index.cjs +1 -1
- package/cjs/es6/min/metrics/index.cjs.gz +0 -0
- package/cjs/es6/min/metrics/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/metrics/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/persisters/persister-automerge/index.cjs +1 -1
- package/cjs/es6/min/persisters/persister-automerge/index.cjs.gz +0 -0
- package/cjs/es6/min/persisters/persister-automerge/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/persisters/persister-automerge/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/persisters/persister-indexed-db/index.cjs +1 -1
- package/cjs/es6/min/persisters/persister-indexed-db/index.cjs.gz +0 -0
- package/cjs/es6/min/persisters/persister-indexed-db/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/persisters/persister-indexed-db/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/persisters/persister-partykit-client/index.cjs +1 -1
- package/cjs/es6/min/persisters/persister-partykit-client/index.cjs.gz +0 -0
- package/cjs/es6/min/persisters/persister-partykit-client/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/persisters/persister-partykit-client/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/persisters/persister-yjs/index.cjs +1 -1
- package/cjs/es6/min/persisters/persister-yjs/index.cjs.gz +0 -0
- package/cjs/es6/min/persisters/persister-yjs/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/persisters/persister-yjs/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/queries/index.cjs +1 -1
- package/cjs/es6/min/queries/index.cjs.gz +0 -0
- package/cjs/es6/min/queries/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/queries/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/relationships/index.cjs +1 -1
- package/cjs/es6/min/relationships/index.cjs.gz +0 -0
- package/cjs/es6/min/relationships/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/relationships/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/store/index.cjs +1 -1
- package/cjs/es6/min/store/index.cjs.gz +0 -0
- package/cjs/es6/min/store/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/store/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/synchronizers/synchronizer-ws-client/index.cjs +1 -1
- package/cjs/es6/min/synchronizers/synchronizer-ws-client/index.cjs.gz +0 -0
- package/cjs/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/synchronizers/synchronizer-ws-server/index.cjs +1 -1
- package/cjs/es6/min/synchronizers/synchronizer-ws-server/index.cjs.gz +0 -0
- package/cjs/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/ui-react-inspector/index.cjs +1 -1
- package/cjs/es6/min/ui-react-inspector/index.cjs.gz +0 -0
- package/cjs/es6/min/ui-react-inspector/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/ui-react-inspector/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/synchronizers/synchronizer-ws-server/index.cjs +11 -4
- package/cjs/es6/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +11 -4
- package/cjs/min/checkpoints/index.cjs +1 -1
- package/cjs/min/checkpoints/index.cjs.gz +0 -0
- package/cjs/min/checkpoints/with-schemas/index.cjs +1 -1
- package/cjs/min/checkpoints/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/index.cjs +1 -1
- package/cjs/min/index.cjs.gz +0 -0
- package/cjs/min/indexes/index.cjs +1 -1
- package/cjs/min/indexes/index.cjs.gz +0 -0
- package/cjs/min/indexes/with-schemas/index.cjs +1 -1
- package/cjs/min/indexes/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/mergeable-store/index.cjs +1 -1
- package/cjs/min/mergeable-store/index.cjs.gz +0 -0
- package/cjs/min/mergeable-store/with-schemas/index.cjs +1 -1
- package/cjs/min/mergeable-store/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/metrics/index.cjs +1 -1
- package/cjs/min/metrics/index.cjs.gz +0 -0
- package/cjs/min/metrics/with-schemas/index.cjs +1 -1
- package/cjs/min/metrics/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/persisters/persister-automerge/index.cjs +1 -1
- package/cjs/min/persisters/persister-automerge/index.cjs.gz +0 -0
- package/cjs/min/persisters/persister-automerge/with-schemas/index.cjs +1 -1
- package/cjs/min/persisters/persister-automerge/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/persisters/persister-indexed-db/index.cjs +1 -1
- package/cjs/min/persisters/persister-indexed-db/index.cjs.gz +0 -0
- package/cjs/min/persisters/persister-indexed-db/with-schemas/index.cjs +1 -1
- package/cjs/min/persisters/persister-indexed-db/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/persisters/persister-partykit-client/index.cjs +1 -1
- package/cjs/min/persisters/persister-partykit-client/index.cjs.gz +0 -0
- package/cjs/min/persisters/persister-partykit-client/with-schemas/index.cjs +1 -1
- package/cjs/min/persisters/persister-partykit-client/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/persisters/persister-yjs/index.cjs +1 -1
- package/cjs/min/persisters/persister-yjs/index.cjs.gz +0 -0
- package/cjs/min/persisters/persister-yjs/with-schemas/index.cjs +1 -1
- package/cjs/min/persisters/persister-yjs/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/queries/index.cjs +1 -1
- package/cjs/min/queries/index.cjs.gz +0 -0
- package/cjs/min/queries/with-schemas/index.cjs +1 -1
- package/cjs/min/queries/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/relationships/index.cjs +1 -1
- package/cjs/min/relationships/index.cjs.gz +0 -0
- package/cjs/min/relationships/with-schemas/index.cjs +1 -1
- package/cjs/min/relationships/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/store/index.cjs +1 -1
- package/cjs/min/store/index.cjs.gz +0 -0
- package/cjs/min/store/with-schemas/index.cjs +1 -1
- package/cjs/min/store/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/synchronizers/synchronizer-ws-client/index.cjs +1 -1
- package/cjs/min/synchronizers/synchronizer-ws-client/index.cjs.gz +0 -0
- package/cjs/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs +1 -1
- package/cjs/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/synchronizers/synchronizer-ws-server/index.cjs +1 -1
- package/cjs/min/synchronizers/synchronizer-ws-server/index.cjs.gz +0 -0
- package/cjs/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +1 -1
- package/cjs/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/ui-react-inspector/index.cjs +1 -1
- package/cjs/min/ui-react-inspector/index.cjs.gz +0 -0
- package/cjs/min/ui-react-inspector/with-schemas/index.cjs +1 -1
- package/cjs/min/ui-react-inspector/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/with-schemas/index.cjs +1 -1
- package/cjs/min/with-schemas/index.cjs.gz +0 -0
- package/cjs/synchronizers/synchronizer-ws-server/index.cjs +11 -4
- package/cjs/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +11 -4
- package/es6/min/checkpoints/index.js +1 -1
- package/es6/min/checkpoints/index.js.gz +0 -0
- package/es6/min/checkpoints/with-schemas/index.js +1 -1
- package/es6/min/checkpoints/with-schemas/index.js.gz +0 -0
- package/es6/min/index.js +1 -1
- package/es6/min/index.js.gz +0 -0
- package/es6/min/indexes/index.js +1 -1
- package/es6/min/indexes/index.js.gz +0 -0
- package/es6/min/indexes/with-schemas/index.js +1 -1
- package/es6/min/indexes/with-schemas/index.js.gz +0 -0
- package/es6/min/mergeable-store/index.js +1 -1
- package/es6/min/mergeable-store/index.js.gz +0 -0
- package/es6/min/mergeable-store/with-schemas/index.js +1 -1
- package/es6/min/mergeable-store/with-schemas/index.js.gz +0 -0
- package/es6/min/metrics/index.js +1 -1
- package/es6/min/metrics/index.js.gz +0 -0
- package/es6/min/metrics/with-schemas/index.js +1 -1
- package/es6/min/metrics/with-schemas/index.js.gz +0 -0
- package/es6/min/persisters/persister-automerge/index.js +1 -1
- package/es6/min/persisters/persister-automerge/index.js.gz +0 -0
- package/es6/min/persisters/persister-automerge/with-schemas/index.js +1 -1
- package/es6/min/persisters/persister-automerge/with-schemas/index.js.gz +0 -0
- package/es6/min/persisters/persister-indexed-db/index.js +1 -1
- package/es6/min/persisters/persister-indexed-db/index.js.gz +0 -0
- package/es6/min/persisters/persister-indexed-db/with-schemas/index.js +1 -1
- package/es6/min/persisters/persister-indexed-db/with-schemas/index.js.gz +0 -0
- package/es6/min/persisters/persister-partykit-client/index.js +1 -1
- package/es6/min/persisters/persister-partykit-client/index.js.gz +0 -0
- package/es6/min/persisters/persister-partykit-client/with-schemas/index.js +1 -1
- package/es6/min/persisters/persister-partykit-client/with-schemas/index.js.gz +0 -0
- package/es6/min/persisters/persister-yjs/index.js +1 -1
- package/es6/min/persisters/persister-yjs/index.js.gz +0 -0
- package/es6/min/persisters/persister-yjs/with-schemas/index.js +1 -1
- package/es6/min/persisters/persister-yjs/with-schemas/index.js.gz +0 -0
- package/es6/min/queries/index.js +1 -1
- package/es6/min/queries/index.js.gz +0 -0
- package/es6/min/queries/with-schemas/index.js +1 -1
- package/es6/min/queries/with-schemas/index.js.gz +0 -0
- package/es6/min/relationships/index.js +1 -1
- package/es6/min/relationships/index.js.gz +0 -0
- package/es6/min/relationships/with-schemas/index.js +1 -1
- package/es6/min/relationships/with-schemas/index.js.gz +0 -0
- package/es6/min/store/index.js +1 -1
- package/es6/min/store/index.js.gz +0 -0
- package/es6/min/store/with-schemas/index.js +1 -1
- package/es6/min/store/with-schemas/index.js.gz +0 -0
- package/es6/min/synchronizers/synchronizer-ws-client/index.js +1 -1
- package/es6/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
- package/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
- package/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
- package/es6/min/synchronizers/synchronizer-ws-server/index.js +1 -1
- package/es6/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
- package/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
- package/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
- package/es6/min/ui-react-inspector/index.js +1 -1
- package/es6/min/ui-react-inspector/index.js.gz +0 -0
- package/es6/min/ui-react-inspector/with-schemas/index.js +1 -1
- package/es6/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
- package/es6/min/with-schemas/index.js +1 -1
- package/es6/min/with-schemas/index.js.gz +0 -0
- package/es6/synchronizers/synchronizer-ws-server/index.js +11 -4
- package/es6/synchronizers/synchronizer-ws-server/with-schemas/index.js +11 -4
- package/min/checkpoints/index.js +1 -1
- package/min/checkpoints/index.js.gz +0 -0
- package/min/checkpoints/with-schemas/index.js +1 -1
- package/min/checkpoints/with-schemas/index.js.gz +0 -0
- package/min/index.js +1 -1
- package/min/index.js.gz +0 -0
- package/min/indexes/index.js +1 -1
- package/min/indexes/index.js.gz +0 -0
- package/min/indexes/with-schemas/index.js +1 -1
- package/min/indexes/with-schemas/index.js.gz +0 -0
- package/min/mergeable-store/index.js +1 -1
- package/min/mergeable-store/index.js.gz +0 -0
- package/min/mergeable-store/with-schemas/index.js +1 -1
- package/min/mergeable-store/with-schemas/index.js.gz +0 -0
- package/min/metrics/index.js +1 -1
- package/min/metrics/index.js.gz +0 -0
- package/min/metrics/with-schemas/index.js +1 -1
- package/min/metrics/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-automerge/index.js +1 -1
- package/min/persisters/persister-automerge/index.js.gz +0 -0
- package/min/persisters/persister-automerge/with-schemas/index.js +1 -1
- package/min/persisters/persister-automerge/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-indexed-db/index.js +1 -1
- package/min/persisters/persister-indexed-db/index.js.gz +0 -0
- package/min/persisters/persister-indexed-db/with-schemas/index.js +1 -1
- package/min/persisters/persister-indexed-db/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-partykit-client/index.js +1 -1
- package/min/persisters/persister-partykit-client/index.js.gz +0 -0
- package/min/persisters/persister-partykit-client/with-schemas/index.js +1 -1
- package/min/persisters/persister-partykit-client/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-yjs/index.js +1 -1
- package/min/persisters/persister-yjs/index.js.gz +0 -0
- package/min/persisters/persister-yjs/with-schemas/index.js +1 -1
- package/min/persisters/persister-yjs/with-schemas/index.js.gz +0 -0
- package/min/queries/index.js +1 -1
- package/min/queries/index.js.gz +0 -0
- package/min/queries/with-schemas/index.js +1 -1
- package/min/queries/with-schemas/index.js.gz +0 -0
- package/min/relationships/index.js +1 -1
- package/min/relationships/index.js.gz +0 -0
- package/min/relationships/with-schemas/index.js +1 -1
- package/min/relationships/with-schemas/index.js.gz +0 -0
- package/min/store/index.js +1 -1
- package/min/store/index.js.gz +0 -0
- package/min/store/with-schemas/index.js +1 -1
- package/min/store/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-client/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
- package/min/ui-react-inspector/index.js +1 -1
- package/min/ui-react-inspector/index.js.gz +0 -0
- package/min/ui-react-inspector/with-schemas/index.js +1 -1
- package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
- package/min/with-schemas/index.js +1 -1
- package/min/with-schemas/index.js.gz +0 -0
- package/package.json +7 -7
- package/readme.md +2 -2
- package/releases.md +7 -1
- package/synchronizers/synchronizer-ws-server/index.js +11 -4
- package/synchronizers/synchronizer-ws-server/with-schemas/index.js +11 -4
- package/umd/es6/min/checkpoints/index.js +1 -1
- package/umd/es6/min/checkpoints/index.js.gz +0 -0
- package/umd/es6/min/checkpoints/with-schemas/index.js +1 -1
- package/umd/es6/min/checkpoints/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/index.js +1 -1
- package/umd/es6/min/index.js.gz +0 -0
- package/umd/es6/min/indexes/index.js +1 -1
- package/umd/es6/min/indexes/index.js.gz +0 -0
- package/umd/es6/min/indexes/with-schemas/index.js +1 -1
- package/umd/es6/min/indexes/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/mergeable-store/index.js +1 -1
- package/umd/es6/min/mergeable-store/index.js.gz +0 -0
- package/umd/es6/min/mergeable-store/with-schemas/index.js +1 -1
- package/umd/es6/min/mergeable-store/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/metrics/index.js +1 -1
- package/umd/es6/min/metrics/index.js.gz +0 -0
- package/umd/es6/min/metrics/with-schemas/index.js +1 -1
- package/umd/es6/min/metrics/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/persisters/persister-automerge/index.js +1 -1
- package/umd/es6/min/persisters/persister-automerge/index.js.gz +0 -0
- package/umd/es6/min/persisters/persister-automerge/with-schemas/index.js +1 -1
- package/umd/es6/min/persisters/persister-automerge/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/persisters/persister-indexed-db/index.js +1 -1
- package/umd/es6/min/persisters/persister-indexed-db/index.js.gz +0 -0
- package/umd/es6/min/persisters/persister-indexed-db/with-schemas/index.js +1 -1
- package/umd/es6/min/persisters/persister-indexed-db/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/persisters/persister-partykit-client/index.js +1 -1
- package/umd/es6/min/persisters/persister-partykit-client/index.js.gz +0 -0
- package/umd/es6/min/persisters/persister-partykit-client/with-schemas/index.js +1 -1
- package/umd/es6/min/persisters/persister-partykit-client/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/persisters/persister-yjs/index.js +1 -1
- package/umd/es6/min/persisters/persister-yjs/index.js.gz +0 -0
- package/umd/es6/min/persisters/persister-yjs/with-schemas/index.js +1 -1
- package/umd/es6/min/persisters/persister-yjs/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/queries/index.js +1 -1
- package/umd/es6/min/queries/index.js.gz +0 -0
- package/umd/es6/min/queries/with-schemas/index.js +1 -1
- package/umd/es6/min/queries/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/relationships/index.js +1 -1
- package/umd/es6/min/relationships/index.js.gz +0 -0
- package/umd/es6/min/relationships/with-schemas/index.js +1 -1
- package/umd/es6/min/relationships/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/store/index.js +1 -1
- package/umd/es6/min/store/index.js.gz +0 -0
- package/umd/es6/min/store/with-schemas/index.js +1 -1
- package/umd/es6/min/store/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/synchronizers/synchronizer-ws-client/index.js +1 -1
- package/umd/es6/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
- package/umd/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
- package/umd/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/synchronizers/synchronizer-ws-server/index.js +1 -1
- package/umd/es6/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
- package/umd/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
- package/umd/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/ui-react-inspector/index.js +1 -1
- package/umd/es6/min/ui-react-inspector/index.js.gz +0 -0
- package/umd/es6/min/ui-react-inspector/with-schemas/index.js +1 -1
- package/umd/es6/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/with-schemas/index.js +1 -1
- package/umd/es6/min/with-schemas/index.js.gz +0 -0
- package/umd/es6/synchronizers/synchronizer-ws-server/index.js +11 -4
- package/umd/es6/synchronizers/synchronizer-ws-server/with-schemas/index.js +11 -4
- package/umd/min/checkpoints/index.js +1 -1
- package/umd/min/checkpoints/index.js.gz +0 -0
- package/umd/min/checkpoints/with-schemas/index.js +1 -1
- package/umd/min/checkpoints/with-schemas/index.js.gz +0 -0
- package/umd/min/index.js +1 -1
- package/umd/min/index.js.gz +0 -0
- package/umd/min/indexes/index.js +1 -1
- package/umd/min/indexes/index.js.gz +0 -0
- package/umd/min/indexes/with-schemas/index.js +1 -1
- package/umd/min/indexes/with-schemas/index.js.gz +0 -0
- package/umd/min/mergeable-store/index.js +1 -1
- package/umd/min/mergeable-store/index.js.gz +0 -0
- package/umd/min/mergeable-store/with-schemas/index.js +1 -1
- package/umd/min/mergeable-store/with-schemas/index.js.gz +0 -0
- package/umd/min/metrics/index.js +1 -1
- package/umd/min/metrics/index.js.gz +0 -0
- package/umd/min/metrics/with-schemas/index.js +1 -1
- package/umd/min/metrics/with-schemas/index.js.gz +0 -0
- package/umd/min/persisters/persister-automerge/index.js +1 -1
- package/umd/min/persisters/persister-automerge/index.js.gz +0 -0
- package/umd/min/persisters/persister-automerge/with-schemas/index.js +1 -1
- package/umd/min/persisters/persister-automerge/with-schemas/index.js.gz +0 -0
- package/umd/min/persisters/persister-indexed-db/index.js +1 -1
- package/umd/min/persisters/persister-indexed-db/index.js.gz +0 -0
- package/umd/min/persisters/persister-indexed-db/with-schemas/index.js +1 -1
- package/umd/min/persisters/persister-indexed-db/with-schemas/index.js.gz +0 -0
- package/umd/min/persisters/persister-partykit-client/index.js +1 -1
- package/umd/min/persisters/persister-partykit-client/index.js.gz +0 -0
- package/umd/min/persisters/persister-partykit-client/with-schemas/index.js +1 -1
- package/umd/min/persisters/persister-partykit-client/with-schemas/index.js.gz +0 -0
- package/umd/min/persisters/persister-yjs/index.js +1 -1
- package/umd/min/persisters/persister-yjs/index.js.gz +0 -0
- package/umd/min/persisters/persister-yjs/with-schemas/index.js +1 -1
- package/umd/min/persisters/persister-yjs/with-schemas/index.js.gz +0 -0
- package/umd/min/queries/index.js +1 -1
- package/umd/min/queries/index.js.gz +0 -0
- package/umd/min/queries/with-schemas/index.js +1 -1
- package/umd/min/queries/with-schemas/index.js.gz +0 -0
- package/umd/min/relationships/index.js +1 -1
- package/umd/min/relationships/index.js.gz +0 -0
- package/umd/min/relationships/with-schemas/index.js +1 -1
- package/umd/min/relationships/with-schemas/index.js.gz +0 -0
- package/umd/min/store/index.js +1 -1
- package/umd/min/store/index.js.gz +0 -0
- package/umd/min/store/with-schemas/index.js +1 -1
- package/umd/min/store/with-schemas/index.js.gz +0 -0
- package/umd/min/synchronizers/synchronizer-ws-client/index.js +1 -1
- package/umd/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
- package/umd/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
- package/umd/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
- package/umd/min/synchronizers/synchronizer-ws-server/index.js +1 -1
- package/umd/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
- package/umd/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
- package/umd/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
- package/umd/min/ui-react-inspector/index.js +1 -1
- package/umd/min/ui-react-inspector/index.js.gz +0 -0
- package/umd/min/ui-react-inspector/with-schemas/index.js +1 -1
- package/umd/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
- package/umd/min/with-schemas/index.js +1 -1
- package/umd/min/with-schemas/index.js.gz +0 -0
- package/umd/synchronizers/synchronizer-ws-server/index.js +11 -4
- package/umd/synchronizers/synchronizer-ws-server/with-schemas/index.js +11 -4
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type {DatabasePersisterConfig, Persister} from '../index.d.cts';
|
|
12
|
-
import type {AbstractPowerSyncDatabase} from '@
|
|
12
|
+
import type {AbstractPowerSyncDatabase} from '@powersync/common';
|
|
13
13
|
import type {Store} from '../../store/index.d.cts';
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -38,7 +38,7 @@ export interface PowerSyncPersister extends Persister {
|
|
|
38
38
|
* ```js yolo
|
|
39
39
|
* import {createPowerSyncPersister} from 'tinybase/persisters/persister-powersync';
|
|
40
40
|
* import {createStore} from 'tinybase';
|
|
41
|
-
* import {usePowerSync} from '@
|
|
41
|
+
* import {usePowerSync} from '@powersync/react';
|
|
42
42
|
*
|
|
43
43
|
* const ps = usePowerSync();
|
|
44
44
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
@@ -98,7 +98,7 @@ export interface PowerSyncPersister extends Persister {
|
|
|
98
98
|
* ```js yolo
|
|
99
99
|
* import {createPowerSyncPersister} from 'tinybase/persisters/persister-powersync';
|
|
100
100
|
* import {createStore} from 'tinybase';
|
|
101
|
-
* import {usePowerSync} from '@
|
|
101
|
+
* import {usePowerSync} from '@powersync/react';
|
|
102
102
|
*
|
|
103
103
|
* const ps = usePowerSync();
|
|
104
104
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
@@ -134,7 +134,7 @@ export interface PowerSyncPersister extends Persister {
|
|
|
134
134
|
* ```js yolo
|
|
135
135
|
* import {createPowerSyncPersister} from 'tinybase/persisters/persister-powersync';
|
|
136
136
|
* import {createStore} from 'tinybase';
|
|
137
|
-
* import {usePowerSync} from '@
|
|
137
|
+
* import {usePowerSync} from '@powersync/react';
|
|
138
138
|
*
|
|
139
139
|
* const ps = usePowerSync();
|
|
140
140
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type {DatabasePersisterConfig, Persister} from '../index.d.ts';
|
|
12
|
-
import type {AbstractPowerSyncDatabase} from '@
|
|
12
|
+
import type {AbstractPowerSyncDatabase} from '@powersync/common';
|
|
13
13
|
import type {Store} from '../../store/index.d.ts';
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -38,7 +38,7 @@ export interface PowerSyncPersister extends Persister {
|
|
|
38
38
|
* ```js yolo
|
|
39
39
|
* import {createPowerSyncPersister} from 'tinybase/persisters/persister-powersync';
|
|
40
40
|
* import {createStore} from 'tinybase';
|
|
41
|
-
* import {usePowerSync} from '@
|
|
41
|
+
* import {usePowerSync} from '@powersync/react';
|
|
42
42
|
*
|
|
43
43
|
* const ps = usePowerSync();
|
|
44
44
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
@@ -98,7 +98,7 @@ export interface PowerSyncPersister extends Persister {
|
|
|
98
98
|
* ```js yolo
|
|
99
99
|
* import {createPowerSyncPersister} from 'tinybase/persisters/persister-powersync';
|
|
100
100
|
* import {createStore} from 'tinybase';
|
|
101
|
-
* import {usePowerSync} from '@
|
|
101
|
+
* import {usePowerSync} from '@powersync/react';
|
|
102
102
|
*
|
|
103
103
|
* const ps = usePowerSync();
|
|
104
104
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
@@ -134,7 +134,7 @@ export interface PowerSyncPersister extends Persister {
|
|
|
134
134
|
* ```js yolo
|
|
135
135
|
* import {createPowerSyncPersister} from 'tinybase/persisters/persister-powersync';
|
|
136
136
|
* import {createStore} from 'tinybase';
|
|
137
|
-
* import {usePowerSync} from '@
|
|
137
|
+
* import {usePowerSync} from '@powersync/react';
|
|
138
138
|
*
|
|
139
139
|
* const ps = usePowerSync();
|
|
140
140
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
@@ -16,7 +16,7 @@ import type {
|
|
|
16
16
|
OptionalSchemas,
|
|
17
17
|
Store,
|
|
18
18
|
} from '../../../store/with-schemas/index.d.cts';
|
|
19
|
-
import type {AbstractPowerSyncDatabase} from '@
|
|
19
|
+
import type {AbstractPowerSyncDatabase} from '@powersync/common';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* The PowerSyncPersister interface represents a Persister that lets you save
|
|
@@ -45,7 +45,7 @@ export interface PowerSyncPersister<Schemas extends OptionalSchemas>
|
|
|
45
45
|
* ```js yolo
|
|
46
46
|
* import {createPowerSyncPersister} from 'tinybase/persisters/persister-powersync';
|
|
47
47
|
* import {createStore} from 'tinybase';
|
|
48
|
-
* import {usePowerSync} from '@
|
|
48
|
+
* import {usePowerSync} from '@powersync/react';
|
|
49
49
|
*
|
|
50
50
|
* const ps = usePowerSync();
|
|
51
51
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
@@ -117,7 +117,7 @@ export interface PowerSyncPersister<Schemas extends OptionalSchemas>
|
|
|
117
117
|
* ```js yolo
|
|
118
118
|
* import {createPowerSyncPersister} from 'tinybase/persisters/persister-powersync';
|
|
119
119
|
* import {createStore} from 'tinybase';
|
|
120
|
-
* import {usePowerSync} from '@
|
|
120
|
+
* import {usePowerSync} from '@powersync/react';
|
|
121
121
|
*
|
|
122
122
|
* const ps = usePowerSync();
|
|
123
123
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
@@ -153,7 +153,7 @@ export interface PowerSyncPersister<Schemas extends OptionalSchemas>
|
|
|
153
153
|
* ```js yolo
|
|
154
154
|
* import {createPowerSyncPersister} from 'tinybase/persisters/persister-powersync';
|
|
155
155
|
* import {createStore} from 'tinybase';
|
|
156
|
-
* import {usePowerSync} from '@
|
|
156
|
+
* import {usePowerSync} from '@powersync/react';
|
|
157
157
|
*
|
|
158
158
|
* const ps = usePowerSync();
|
|
159
159
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
@@ -16,7 +16,7 @@ import type {
|
|
|
16
16
|
OptionalSchemas,
|
|
17
17
|
Store,
|
|
18
18
|
} from '../../../store/with-schemas/index.d.ts';
|
|
19
|
-
import type {AbstractPowerSyncDatabase} from '@
|
|
19
|
+
import type {AbstractPowerSyncDatabase} from '@powersync/common';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* The PowerSyncPersister interface represents a Persister that lets you save
|
|
@@ -45,7 +45,7 @@ export interface PowerSyncPersister<Schemas extends OptionalSchemas>
|
|
|
45
45
|
* ```js yolo
|
|
46
46
|
* import {createPowerSyncPersister} from 'tinybase/persisters/persister-powersync';
|
|
47
47
|
* import {createStore} from 'tinybase';
|
|
48
|
-
* import {usePowerSync} from '@
|
|
48
|
+
* import {usePowerSync} from '@powersync/react';
|
|
49
49
|
*
|
|
50
50
|
* const ps = usePowerSync();
|
|
51
51
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
@@ -117,7 +117,7 @@ export interface PowerSyncPersister<Schemas extends OptionalSchemas>
|
|
|
117
117
|
* ```js yolo
|
|
118
118
|
* import {createPowerSyncPersister} from 'tinybase/persisters/persister-powersync';
|
|
119
119
|
* import {createStore} from 'tinybase';
|
|
120
|
-
* import {usePowerSync} from '@
|
|
120
|
+
* import {usePowerSync} from '@powersync/react';
|
|
121
121
|
*
|
|
122
122
|
* const ps = usePowerSync();
|
|
123
123
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
@@ -153,7 +153,7 @@ export interface PowerSyncPersister<Schemas extends OptionalSchemas>
|
|
|
153
153
|
* ```js yolo
|
|
154
154
|
* import {createPowerSyncPersister} from 'tinybase/persisters/persister-powersync';
|
|
155
155
|
* import {createStore} from 'tinybase';
|
|
156
|
-
* import {usePowerSync} from '@
|
|
156
|
+
* import {usePowerSync} from '@powersync/react';
|
|
157
157
|
*
|
|
158
158
|
* const ps = usePowerSync();
|
|
159
159
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
@@ -81,6 +81,12 @@ export interface WsSynchronizer<WebSocketType extends WebSocketTypes>
|
|
|
81
81
|
* As well as providing a reference to the MergeableStore to persist, you must
|
|
82
82
|
* provide a configured WebSocket to send synchronization messages over.
|
|
83
83
|
*
|
|
84
|
+
* Instead of the raw browser implementation of WebSocket You may prefer to use
|
|
85
|
+
* the [Reconnecting
|
|
86
|
+
* WebSocket](https://github.com/pladaria/reconnecting-websocket) wrapper so
|
|
87
|
+
* that if a client goes offline, it can easily re-establish a connection when
|
|
88
|
+
* it comes back online. Its API is compatible with this Synchronizer.
|
|
89
|
+
*
|
|
84
90
|
* You can indicate how long the Synchronizer will wait for responses to message
|
|
85
91
|
* requests before timing out. A final set of optional handlers can be provided
|
|
86
92
|
* to help debug sends, receives, and errors respectively.
|
|
@@ -81,6 +81,12 @@ export interface WsSynchronizer<WebSocketType extends WebSocketTypes>
|
|
|
81
81
|
* As well as providing a reference to the MergeableStore to persist, you must
|
|
82
82
|
* provide a configured WebSocket to send synchronization messages over.
|
|
83
83
|
*
|
|
84
|
+
* Instead of the raw browser implementation of WebSocket You may prefer to use
|
|
85
|
+
* the [Reconnecting
|
|
86
|
+
* WebSocket](https://github.com/pladaria/reconnecting-websocket) wrapper so
|
|
87
|
+
* that if a client goes offline, it can easily re-establish a connection when
|
|
88
|
+
* it comes back online. Its API is compatible with this Synchronizer.
|
|
89
|
+
*
|
|
84
90
|
* You can indicate how long the Synchronizer will wait for responses to message
|
|
85
91
|
* requests before timing out. A final set of optional handlers can be provided
|
|
86
92
|
* to help debug sends, receives, and errors respectively.
|
|
@@ -97,6 +97,12 @@ export interface WsSynchronizer<
|
|
|
97
97
|
* As well as providing a reference to the MergeableStore to persist, you must
|
|
98
98
|
* provide a configured WebSocket to send synchronization messages over.
|
|
99
99
|
*
|
|
100
|
+
* Instead of the raw browser implementation of WebSocket You may prefer to use
|
|
101
|
+
* the [Reconnecting
|
|
102
|
+
* WebSocket](https://github.com/pladaria/reconnecting-websocket) wrapper so
|
|
103
|
+
* that if a client goes offline, it can easily re-establish a connection when
|
|
104
|
+
* it comes back online. Its API is compatible with this Synchronizer.
|
|
105
|
+
*
|
|
100
106
|
* You can indicate how long the Synchronizer will wait for responses to message
|
|
101
107
|
* requests before timing out. A final set of optional handlers can be provided
|
|
102
108
|
* to help debug sends, receives, and errors respectively.
|
|
@@ -97,6 +97,12 @@ export interface WsSynchronizer<
|
|
|
97
97
|
* As well as providing a reference to the MergeableStore to persist, you must
|
|
98
98
|
* provide a configured WebSocket to send synchronization messages over.
|
|
99
99
|
*
|
|
100
|
+
* Instead of the raw browser implementation of WebSocket You may prefer to use
|
|
101
|
+
* the [Reconnecting
|
|
102
|
+
* WebSocket](https://github.com/pladaria/reconnecting-websocket) wrapper so
|
|
103
|
+
* that if a client goes offline, it can easily re-establish a connection when
|
|
104
|
+
* it comes back online. Its API is compatible with this Synchronizer.
|
|
105
|
+
*
|
|
100
106
|
* You can indicate how long the Synchronizer will wait for responses to message
|
|
101
107
|
* requests before timing out. A final set of optional handlers can be provided
|
|
102
108
|
* to help debug sends, receives, and errors respectively.
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import type {Id, IdOrNull, Ids} from '../../common/index.d.cts';
|
|
12
12
|
import type {Persister, Persists} from '../../persisters/index.d.cts';
|
|
13
13
|
import type {IdAddedOrRemoved} from '../../store/index.d.cts';
|
|
14
|
+
import type {MergeableStore} from '../../mergeable-store/index.d.cts';
|
|
14
15
|
import type {WebSocketServer} from 'ws';
|
|
15
16
|
|
|
16
17
|
/**
|
|
@@ -509,10 +510,20 @@ export interface WsServer {
|
|
|
509
510
|
* by the WsServer. As a result, the server MergeableStore will be kept in sync
|
|
510
511
|
* with the clients on that path, and in turn with whatever persistence layer
|
|
511
512
|
* you have configured. See the example below.
|
|
513
|
+
*
|
|
514
|
+
* It is not safe to add or manipulate data in the MergeableStore during the
|
|
515
|
+
* `createPersisterForPath` function, since changes will probably be overwritten
|
|
516
|
+
* when the Persister starts. If you wish to modify data - or upgrade a schema,
|
|
517
|
+
* for example - you can have that function instead return an array containing
|
|
518
|
+
* the Persister _and_ a callback that takes the MergeableStore. That callback
|
|
519
|
+
* will get called after the Persister has started, and is an appropriate place
|
|
520
|
+
* to manipulate data in a way that will be transmitted to clients. Again, see
|
|
521
|
+
* the example below.
|
|
512
522
|
* @param webSocketServer A WebSocketServer object from your server environment.
|
|
513
523
|
* @param createPersisterForPath An optional function that will create a
|
|
514
|
-
* Persister
|
|
515
|
-
*
|
|
524
|
+
* Persister to synchronize with the clients on a given path (or a two-item
|
|
525
|
+
* array of Persister and callback that lets you handle data after persistence
|
|
526
|
+
* has started).
|
|
516
527
|
* @returns A reference to the new WsServer object.
|
|
517
528
|
* @example
|
|
518
529
|
* This example creates a WsServer that synchronizes two clients on a shared
|
|
@@ -574,7 +585,10 @@ export interface WsServer {
|
|
|
574
585
|
* const server = createWsServer(
|
|
575
586
|
* new WebSocketServer({port: 8047}),
|
|
576
587
|
* (pathId) =>
|
|
577
|
-
* createFilePersister(
|
|
588
|
+
* createFilePersister(
|
|
589
|
+
* createMergeableStore(),
|
|
590
|
+
* pathId.replace(/[^a-zA-Z0-9]/g, '-') + '.json',
|
|
591
|
+
* ),
|
|
578
592
|
* );
|
|
579
593
|
*
|
|
580
594
|
* // Client 1
|
|
@@ -626,6 +640,49 @@ export interface WsServer {
|
|
|
626
640
|
* rmSync('petShop.json');
|
|
627
641
|
* ```
|
|
628
642
|
* @example
|
|
643
|
+
* This example creates a WsServer that persists a MergeableStore to file that
|
|
644
|
+
* is synchronized with two clients on a shared path, but also which updates its
|
|
645
|
+
* data once synchronization has started.
|
|
646
|
+
*
|
|
647
|
+
* ```js
|
|
648
|
+
* import {WebSocketServer} from 'ws';
|
|
649
|
+
* import {createFilePersister} from 'tinybase/persisters/persister-file';
|
|
650
|
+
* import {createMergeableStore} from 'tinybase';
|
|
651
|
+
* import {createWsServer} from 'tinybase/synchronizers/synchronizer-ws-server';
|
|
652
|
+
* import {createWsSynchronizer} from 'tinybase/synchronizers/synchronizer-ws-client';
|
|
653
|
+
* import {rmSync} from 'fs';
|
|
654
|
+
*
|
|
655
|
+
* // Server
|
|
656
|
+
* const server = createWsServer(
|
|
657
|
+
* new WebSocketServer({port: 8047}),
|
|
658
|
+
* (pathId) => [
|
|
659
|
+
* createFilePersister(
|
|
660
|
+
* createMergeableStore(),
|
|
661
|
+
* pathId.replace(/[^a-zA-Z0-9]/g, '-') + '.json',
|
|
662
|
+
* ),
|
|
663
|
+
* (store) => store.setValue('pathId', pathId),
|
|
664
|
+
* ],
|
|
665
|
+
* );
|
|
666
|
+
*
|
|
667
|
+
* const clientStore = createMergeableStore();
|
|
668
|
+
* clientStore.setCell('pets', 'fido', 'species', 'dog');
|
|
669
|
+
* const synchronizer = await createWsSynchronizer(
|
|
670
|
+
* clientStore,
|
|
671
|
+
* new WebSocket('ws://localhost:8047/petShop'),
|
|
672
|
+
* );
|
|
673
|
+
* await synchronizer.startSync();
|
|
674
|
+
* // ...
|
|
675
|
+
*
|
|
676
|
+
* console.log(clientStore.getContent());
|
|
677
|
+
* // -> [{pets: {fido: {species: 'dog'}}}, {"pathId": "petShop"}]
|
|
678
|
+
*
|
|
679
|
+
* synchronizer.destroy();
|
|
680
|
+
* server.destroy();
|
|
681
|
+
*
|
|
682
|
+
* // Remove file for the purposes of this demo.
|
|
683
|
+
* rmSync('petShop.json');
|
|
684
|
+
* ```
|
|
685
|
+
* @example
|
|
629
686
|
* This example creates a WsServer with a custom listener that displays
|
|
630
687
|
* information about the address of the client that connects to it.
|
|
631
688
|
*
|
|
@@ -661,5 +718,10 @@ export function createWsServer<
|
|
|
661
718
|
>,
|
|
662
719
|
>(
|
|
663
720
|
webSocketServer: WebSocketServer,
|
|
664
|
-
createPersisterForPath?: (
|
|
721
|
+
createPersisterForPath?: (
|
|
722
|
+
pathId: Id,
|
|
723
|
+
) =>
|
|
724
|
+
| PathPersister
|
|
725
|
+
| [PathPersister, (store: MergeableStore) => void]
|
|
726
|
+
| undefined,
|
|
665
727
|
): WsServer;
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import type {Id, IdOrNull, Ids} from '../../common/index.d.ts';
|
|
12
12
|
import type {Persister, Persists} from '../../persisters/index.d.ts';
|
|
13
13
|
import type {IdAddedOrRemoved} from '../../store/index.d.ts';
|
|
14
|
+
import type {MergeableStore} from '../../mergeable-store/index.d.ts';
|
|
14
15
|
import type {WebSocketServer} from 'ws';
|
|
15
16
|
|
|
16
17
|
/**
|
|
@@ -509,10 +510,20 @@ export interface WsServer {
|
|
|
509
510
|
* by the WsServer. As a result, the server MergeableStore will be kept in sync
|
|
510
511
|
* with the clients on that path, and in turn with whatever persistence layer
|
|
511
512
|
* you have configured. See the example below.
|
|
513
|
+
*
|
|
514
|
+
* It is not safe to add or manipulate data in the MergeableStore during the
|
|
515
|
+
* `createPersisterForPath` function, since changes will probably be overwritten
|
|
516
|
+
* when the Persister starts. If you wish to modify data - or upgrade a schema,
|
|
517
|
+
* for example - you can have that function instead return an array containing
|
|
518
|
+
* the Persister _and_ a callback that takes the MergeableStore. That callback
|
|
519
|
+
* will get called after the Persister has started, and is an appropriate place
|
|
520
|
+
* to manipulate data in a way that will be transmitted to clients. Again, see
|
|
521
|
+
* the example below.
|
|
512
522
|
* @param webSocketServer A WebSocketServer object from your server environment.
|
|
513
523
|
* @param createPersisterForPath An optional function that will create a
|
|
514
|
-
* Persister
|
|
515
|
-
*
|
|
524
|
+
* Persister to synchronize with the clients on a given path (or a two-item
|
|
525
|
+
* array of Persister and callback that lets you handle data after persistence
|
|
526
|
+
* has started).
|
|
516
527
|
* @returns A reference to the new WsServer object.
|
|
517
528
|
* @example
|
|
518
529
|
* This example creates a WsServer that synchronizes two clients on a shared
|
|
@@ -574,7 +585,10 @@ export interface WsServer {
|
|
|
574
585
|
* const server = createWsServer(
|
|
575
586
|
* new WebSocketServer({port: 8047}),
|
|
576
587
|
* (pathId) =>
|
|
577
|
-
* createFilePersister(
|
|
588
|
+
* createFilePersister(
|
|
589
|
+
* createMergeableStore(),
|
|
590
|
+
* pathId.replace(/[^a-zA-Z0-9]/g, '-') + '.json',
|
|
591
|
+
* ),
|
|
578
592
|
* );
|
|
579
593
|
*
|
|
580
594
|
* // Client 1
|
|
@@ -626,6 +640,49 @@ export interface WsServer {
|
|
|
626
640
|
* rmSync('petShop.json');
|
|
627
641
|
* ```
|
|
628
642
|
* @example
|
|
643
|
+
* This example creates a WsServer that persists a MergeableStore to file that
|
|
644
|
+
* is synchronized with two clients on a shared path, but also which updates its
|
|
645
|
+
* data once synchronization has started.
|
|
646
|
+
*
|
|
647
|
+
* ```js
|
|
648
|
+
* import {WebSocketServer} from 'ws';
|
|
649
|
+
* import {createFilePersister} from 'tinybase/persisters/persister-file';
|
|
650
|
+
* import {createMergeableStore} from 'tinybase';
|
|
651
|
+
* import {createWsServer} from 'tinybase/synchronizers/synchronizer-ws-server';
|
|
652
|
+
* import {createWsSynchronizer} from 'tinybase/synchronizers/synchronizer-ws-client';
|
|
653
|
+
* import {rmSync} from 'fs';
|
|
654
|
+
*
|
|
655
|
+
* // Server
|
|
656
|
+
* const server = createWsServer(
|
|
657
|
+
* new WebSocketServer({port: 8047}),
|
|
658
|
+
* (pathId) => [
|
|
659
|
+
* createFilePersister(
|
|
660
|
+
* createMergeableStore(),
|
|
661
|
+
* pathId.replace(/[^a-zA-Z0-9]/g, '-') + '.json',
|
|
662
|
+
* ),
|
|
663
|
+
* (store) => store.setValue('pathId', pathId),
|
|
664
|
+
* ],
|
|
665
|
+
* );
|
|
666
|
+
*
|
|
667
|
+
* const clientStore = createMergeableStore();
|
|
668
|
+
* clientStore.setCell('pets', 'fido', 'species', 'dog');
|
|
669
|
+
* const synchronizer = await createWsSynchronizer(
|
|
670
|
+
* clientStore,
|
|
671
|
+
* new WebSocket('ws://localhost:8047/petShop'),
|
|
672
|
+
* );
|
|
673
|
+
* await synchronizer.startSync();
|
|
674
|
+
* // ...
|
|
675
|
+
*
|
|
676
|
+
* console.log(clientStore.getContent());
|
|
677
|
+
* // -> [{pets: {fido: {species: 'dog'}}}, {"pathId": "petShop"}]
|
|
678
|
+
*
|
|
679
|
+
* synchronizer.destroy();
|
|
680
|
+
* server.destroy();
|
|
681
|
+
*
|
|
682
|
+
* // Remove file for the purposes of this demo.
|
|
683
|
+
* rmSync('petShop.json');
|
|
684
|
+
* ```
|
|
685
|
+
* @example
|
|
629
686
|
* This example creates a WsServer with a custom listener that displays
|
|
630
687
|
* information about the address of the client that connects to it.
|
|
631
688
|
*
|
|
@@ -661,5 +718,10 @@ export function createWsServer<
|
|
|
661
718
|
>,
|
|
662
719
|
>(
|
|
663
720
|
webSocketServer: WebSocketServer,
|
|
664
|
-
createPersisterForPath?: (
|
|
721
|
+
createPersisterForPath?: (
|
|
722
|
+
pathId: Id,
|
|
723
|
+
) =>
|
|
724
|
+
| PathPersister
|
|
725
|
+
| [PathPersister, (store: MergeableStore) => void]
|
|
726
|
+
| undefined,
|
|
665
727
|
): WsServer;
|
|
@@ -17,6 +17,7 @@ import type {
|
|
|
17
17
|
Persister,
|
|
18
18
|
Persists,
|
|
19
19
|
} from '../../../persisters/with-schemas/index.d.cts';
|
|
20
|
+
import type {MergeableStore} from '../../../mergeable-store/with-schemas/index.d.cts';
|
|
20
21
|
import type {WebSocketServer} from 'ws';
|
|
21
22
|
|
|
22
23
|
/**
|
|
@@ -511,7 +512,12 @@ export interface WsServer {
|
|
|
511
512
|
* >,
|
|
512
513
|
* >(
|
|
513
514
|
* webSocketServer: WebSocketServer,
|
|
514
|
-
* createPersisterForPath?: (
|
|
515
|
+
* createPersisterForPath?: (
|
|
516
|
+
* pathId: Id,
|
|
517
|
+
* ) =>
|
|
518
|
+
* | PathPersister
|
|
519
|
+
* | [PathPersister, (store: MergeableStore) => void]
|
|
520
|
+
* | undefined,
|
|
515
521
|
* ): WsServer;
|
|
516
522
|
* ```
|
|
517
523
|
*
|
|
@@ -528,10 +534,20 @@ export interface WsServer {
|
|
|
528
534
|
* by the WsServer. As a result, the server MergeableStore will be kept in sync
|
|
529
535
|
* with the clients on that path, and in turn with whatever persistence layer
|
|
530
536
|
* you have configured. See the example below.
|
|
537
|
+
*
|
|
538
|
+
* It is not safe to add or manipulate data in the MergeableStore during the
|
|
539
|
+
* `createPersisterForPath` function, since changes will probably be overwritten
|
|
540
|
+
* when the Persister starts. If you wish to modify data - or upgrade a schema,
|
|
541
|
+
* for example - you can have that function instead return an array containing
|
|
542
|
+
* the Persister _and_ a callback that takes the MergeableStore. That callback
|
|
543
|
+
* will get called after the Persister has started, and is an appropriate place
|
|
544
|
+
* to manipulate data in a way that will be transmitted to clients. Again, see
|
|
545
|
+
* the example below.
|
|
531
546
|
* @param webSocketServer A WebSocketServer object from your server environment.
|
|
532
547
|
* @param createPersisterForPath An optional function that will create a
|
|
533
|
-
* Persister
|
|
534
|
-
*
|
|
548
|
+
* Persister to synchronize with the clients on a given path (or a two-item
|
|
549
|
+
* array of Persister and callback that lets you handle data after persistence
|
|
550
|
+
* has started).
|
|
535
551
|
* @returns A reference to the new WsServer object.
|
|
536
552
|
* @example
|
|
537
553
|
* This example creates a WsServer that synchronizes two clients on a shared
|
|
@@ -593,7 +609,10 @@ export interface WsServer {
|
|
|
593
609
|
* const server = createWsServer(
|
|
594
610
|
* new WebSocketServer({port: 8047}),
|
|
595
611
|
* (pathId) =>
|
|
596
|
-
* createFilePersister(
|
|
612
|
+
* createFilePersister(
|
|
613
|
+
* createMergeableStore(),
|
|
614
|
+
* pathId.replace(/[^a-zA-Z0-9]/g, '-') + '.json',
|
|
615
|
+
* ),
|
|
597
616
|
* );
|
|
598
617
|
*
|
|
599
618
|
* // Client 1
|
|
@@ -645,6 +664,49 @@ export interface WsServer {
|
|
|
645
664
|
* rmSync('petShop.json');
|
|
646
665
|
* ```
|
|
647
666
|
* @example
|
|
667
|
+
* This example creates a WsServer that persists a MergeableStore to file that
|
|
668
|
+
* is synchronized with two clients on a shared path, but also which updates its
|
|
669
|
+
* data once synchronization has started.
|
|
670
|
+
*
|
|
671
|
+
* ```js
|
|
672
|
+
* import {WebSocketServer} from 'ws';
|
|
673
|
+
* import {createFilePersister} from 'tinybase/persisters/persister-file';
|
|
674
|
+
* import {createMergeableStore} from 'tinybase';
|
|
675
|
+
* import {createWsServer} from 'tinybase/synchronizers/synchronizer-ws-server';
|
|
676
|
+
* import {createWsSynchronizer} from 'tinybase/synchronizers/synchronizer-ws-client';
|
|
677
|
+
* import {rmSync} from 'fs';
|
|
678
|
+
*
|
|
679
|
+
* // Server
|
|
680
|
+
* const server = createWsServer(
|
|
681
|
+
* new WebSocketServer({port: 8047}),
|
|
682
|
+
* (pathId) => [
|
|
683
|
+
* createFilePersister(
|
|
684
|
+
* createMergeableStore(),
|
|
685
|
+
* pathId.replace(/[^a-zA-Z0-9]/g, '-') + '.json',
|
|
686
|
+
* ),
|
|
687
|
+
* (store) => store.setValue('pathId', pathId),
|
|
688
|
+
* ],
|
|
689
|
+
* );
|
|
690
|
+
*
|
|
691
|
+
* const clientStore = createMergeableStore();
|
|
692
|
+
* clientStore.setCell('pets', 'fido', 'species', 'dog');
|
|
693
|
+
* const synchronizer = await createWsSynchronizer(
|
|
694
|
+
* clientStore,
|
|
695
|
+
* new WebSocket('ws://localhost:8047/petShop'),
|
|
696
|
+
* );
|
|
697
|
+
* await synchronizer.startSync();
|
|
698
|
+
* // ...
|
|
699
|
+
*
|
|
700
|
+
* console.log(clientStore.getContent());
|
|
701
|
+
* // -> [{pets: {fido: {species: 'dog'}}}, {"pathId": "petShop"}]
|
|
702
|
+
*
|
|
703
|
+
* synchronizer.destroy();
|
|
704
|
+
* server.destroy();
|
|
705
|
+
*
|
|
706
|
+
* // Remove file for the purposes of this demo.
|
|
707
|
+
* rmSync('petShop.json');
|
|
708
|
+
* ```
|
|
709
|
+
* @example
|
|
648
710
|
* This example creates a WsServer with a custom listener that displays
|
|
649
711
|
* information about the address of the client that connects to it.
|
|
650
712
|
*
|
|
@@ -682,5 +744,10 @@ export function createWsServer<
|
|
|
682
744
|
>,
|
|
683
745
|
>(
|
|
684
746
|
webSocketServer: WebSocketServer,
|
|
685
|
-
createPersisterForPath?: (
|
|
747
|
+
createPersisterForPath?: (
|
|
748
|
+
pathId: Id,
|
|
749
|
+
) =>
|
|
750
|
+
| PathPersister
|
|
751
|
+
| [PathPersister, (store: MergeableStore<Schemas>) => void]
|
|
752
|
+
| undefined,
|
|
686
753
|
): WsServer;
|
|
@@ -17,6 +17,7 @@ import type {
|
|
|
17
17
|
Persister,
|
|
18
18
|
Persists,
|
|
19
19
|
} from '../../../persisters/with-schemas/index.d.ts';
|
|
20
|
+
import type {MergeableStore} from '../../../mergeable-store/with-schemas/index.d.ts';
|
|
20
21
|
import type {WebSocketServer} from 'ws';
|
|
21
22
|
|
|
22
23
|
/**
|
|
@@ -511,7 +512,12 @@ export interface WsServer {
|
|
|
511
512
|
* >,
|
|
512
513
|
* >(
|
|
513
514
|
* webSocketServer: WebSocketServer,
|
|
514
|
-
* createPersisterForPath?: (
|
|
515
|
+
* createPersisterForPath?: (
|
|
516
|
+
* pathId: Id,
|
|
517
|
+
* ) =>
|
|
518
|
+
* | PathPersister
|
|
519
|
+
* | [PathPersister, (store: MergeableStore) => void]
|
|
520
|
+
* | undefined,
|
|
515
521
|
* ): WsServer;
|
|
516
522
|
* ```
|
|
517
523
|
*
|
|
@@ -528,10 +534,20 @@ export interface WsServer {
|
|
|
528
534
|
* by the WsServer. As a result, the server MergeableStore will be kept in sync
|
|
529
535
|
* with the clients on that path, and in turn with whatever persistence layer
|
|
530
536
|
* you have configured. See the example below.
|
|
537
|
+
*
|
|
538
|
+
* It is not safe to add or manipulate data in the MergeableStore during the
|
|
539
|
+
* `createPersisterForPath` function, since changes will probably be overwritten
|
|
540
|
+
* when the Persister starts. If you wish to modify data - or upgrade a schema,
|
|
541
|
+
* for example - you can have that function instead return an array containing
|
|
542
|
+
* the Persister _and_ a callback that takes the MergeableStore. That callback
|
|
543
|
+
* will get called after the Persister has started, and is an appropriate place
|
|
544
|
+
* to manipulate data in a way that will be transmitted to clients. Again, see
|
|
545
|
+
* the example below.
|
|
531
546
|
* @param webSocketServer A WebSocketServer object from your server environment.
|
|
532
547
|
* @param createPersisterForPath An optional function that will create a
|
|
533
|
-
* Persister
|
|
534
|
-
*
|
|
548
|
+
* Persister to synchronize with the clients on a given path (or a two-item
|
|
549
|
+
* array of Persister and callback that lets you handle data after persistence
|
|
550
|
+
* has started).
|
|
535
551
|
* @returns A reference to the new WsServer object.
|
|
536
552
|
* @example
|
|
537
553
|
* This example creates a WsServer that synchronizes two clients on a shared
|
|
@@ -593,7 +609,10 @@ export interface WsServer {
|
|
|
593
609
|
* const server = createWsServer(
|
|
594
610
|
* new WebSocketServer({port: 8047}),
|
|
595
611
|
* (pathId) =>
|
|
596
|
-
* createFilePersister(
|
|
612
|
+
* createFilePersister(
|
|
613
|
+
* createMergeableStore(),
|
|
614
|
+
* pathId.replace(/[^a-zA-Z0-9]/g, '-') + '.json',
|
|
615
|
+
* ),
|
|
597
616
|
* );
|
|
598
617
|
*
|
|
599
618
|
* // Client 1
|
|
@@ -645,6 +664,49 @@ export interface WsServer {
|
|
|
645
664
|
* rmSync('petShop.json');
|
|
646
665
|
* ```
|
|
647
666
|
* @example
|
|
667
|
+
* This example creates a WsServer that persists a MergeableStore to file that
|
|
668
|
+
* is synchronized with two clients on a shared path, but also which updates its
|
|
669
|
+
* data once synchronization has started.
|
|
670
|
+
*
|
|
671
|
+
* ```js
|
|
672
|
+
* import {WebSocketServer} from 'ws';
|
|
673
|
+
* import {createFilePersister} from 'tinybase/persisters/persister-file';
|
|
674
|
+
* import {createMergeableStore} from 'tinybase';
|
|
675
|
+
* import {createWsServer} from 'tinybase/synchronizers/synchronizer-ws-server';
|
|
676
|
+
* import {createWsSynchronizer} from 'tinybase/synchronizers/synchronizer-ws-client';
|
|
677
|
+
* import {rmSync} from 'fs';
|
|
678
|
+
*
|
|
679
|
+
* // Server
|
|
680
|
+
* const server = createWsServer(
|
|
681
|
+
* new WebSocketServer({port: 8047}),
|
|
682
|
+
* (pathId) => [
|
|
683
|
+
* createFilePersister(
|
|
684
|
+
* createMergeableStore(),
|
|
685
|
+
* pathId.replace(/[^a-zA-Z0-9]/g, '-') + '.json',
|
|
686
|
+
* ),
|
|
687
|
+
* (store) => store.setValue('pathId', pathId),
|
|
688
|
+
* ],
|
|
689
|
+
* );
|
|
690
|
+
*
|
|
691
|
+
* const clientStore = createMergeableStore();
|
|
692
|
+
* clientStore.setCell('pets', 'fido', 'species', 'dog');
|
|
693
|
+
* const synchronizer = await createWsSynchronizer(
|
|
694
|
+
* clientStore,
|
|
695
|
+
* new WebSocket('ws://localhost:8047/petShop'),
|
|
696
|
+
* );
|
|
697
|
+
* await synchronizer.startSync();
|
|
698
|
+
* // ...
|
|
699
|
+
*
|
|
700
|
+
* console.log(clientStore.getContent());
|
|
701
|
+
* // -> [{pets: {fido: {species: 'dog'}}}, {"pathId": "petShop"}]
|
|
702
|
+
*
|
|
703
|
+
* synchronizer.destroy();
|
|
704
|
+
* server.destroy();
|
|
705
|
+
*
|
|
706
|
+
* // Remove file for the purposes of this demo.
|
|
707
|
+
* rmSync('petShop.json');
|
|
708
|
+
* ```
|
|
709
|
+
* @example
|
|
648
710
|
* This example creates a WsServer with a custom listener that displays
|
|
649
711
|
* information about the address of the client that connects to it.
|
|
650
712
|
*
|
|
@@ -682,5 +744,10 @@ export function createWsServer<
|
|
|
682
744
|
>,
|
|
683
745
|
>(
|
|
684
746
|
webSocketServer: WebSocketServer,
|
|
685
|
-
createPersisterForPath?: (
|
|
747
|
+
createPersisterForPath?: (
|
|
748
|
+
pathId: Id,
|
|
749
|
+
) =>
|
|
750
|
+
| PathPersister
|
|
751
|
+
| [PathPersister, (store: MergeableStore<Schemas>) => void]
|
|
752
|
+
| undefined,
|
|
686
753
|
): WsServer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=e=>null==e,n=(n,t,l)=>e(n)?void 0:t(n),t=e=>e.length,l=(e,n)=>e.includes(n),r=(e,n)=>e.forEach(n),s=e=>0==t(e),o=(e,...n)=>e.push(...n),u=e=>e.pop(),i=e=>e.shift(),c=Object.freeze,d=e=>{var n;return null!=(n=null==e?void 0:e.size)?n:0},a=(v=d,e=>{return n=(e,n)=>e+v(n),k(e).reduce(n,0);var n});var v;const h=(e,n)=>{var t;return null!=(t=null==e?void 0:e.has(n))&&t},p=n=>e(n)||0==d(n),k=e=>{var n;return[...null!=(n=null==e?void 0:e.values())?n:[]]},g=(e,n)=>null==e?void 0:e.forEach(n),C=(e,n)=>null==e?void 0:e.delete(n),f=e=>new Map(e),L=(e,n)=>null==e?void 0:e.get(n),w=(n,t,l)=>e(l)?(C(n,t),n):null==n?void 0:n.set(t,l),S=(e,n,t,l)=>(h(e,n)?null==l||l(L(e,n)):w(e,n,t()),L(e,n)),y=(e,l,r,s,o=0)=>n((r?S:L)(e,l[o],o>t(l)-2?r:f),(n=>{if(o>t(l)-2)return(null==s?void 0:s(n))&&w(e,l[o]),n;const u=y(n,l,r,s,o+1);return p(n)&&w(e,l[o]),u})),z=n=>new Set(Array.isArray(n)||e(n)?n:[n]),E=/^\d+$/,I=((d,v)=>{const k=new WeakMap;return d=>{k.has(d)||k.set(d,(d=>{let v,k,I,V=100,A=f(),F=f(),M=1;const _=f(),b=f(),[j,x,B]=(
|
|
1
|
+
"use strict";const e=e=>null==e,n=(n,t,l)=>e(n)?void 0:t(n),t=e=>e.length,l=(e,n)=>e.includes(n),r=(e,n)=>e.forEach(n),s=e=>0==t(e),o=(e,...n)=>e.push(...n),u=e=>e.pop(),i=e=>e.shift(),c=Object.freeze,d=e=>{var n;return null!=(n=null==e?void 0:e.size)?n:0},a=(v=d,e=>{return n=(e,n)=>e+v(n),k(e).reduce(n,0);var n});var v;const h=(e,n)=>{var t;return null!=(t=null==e?void 0:e.has(n))&&t},p=n=>e(n)||0==d(n),k=e=>{var n;return[...null!=(n=null==e?void 0:e.values())?n:[]]},g=(e,n)=>null==e?void 0:e.forEach(n),C=(e,n)=>null==e?void 0:e.delete(n),f=e=>new Map(e),L=(e,n)=>null==e?void 0:e.get(n),w=(n,t,l)=>e(l)?(C(n,t),n):null==n?void 0:n.set(t,l),S=(e,n,t,l)=>(h(e,n)?null==l||l(L(e,n)):w(e,n,t()),L(e,n)),y=(e,l,r,s,o=0)=>n((r?S:L)(e,l[o],o>t(l)-2?r:f),(n=>{if(o>t(l)-2)return(null==s?void 0:s(n))&&w(e,l[o]),n;const u=y(n,l,r,s,o+1);return p(n)&&w(e,l[o]),u})),z=n=>new Set(Array.isArray(n)||e(n)?n:[n]),E=/^\d+$/,I=((d,v)=>{const k=new WeakMap;return d=>{k.has(d)||k.set(d,(d=>{let v,k,I,V=100,A=f(),F=f(),M=1;const _=f(),b=f(),[j,x,B]=(()=>{let l;const[s,u]=(()=>{const e=[];let n=0;return[t=>{var l;return null!=(l=t?i(e):null)?l:""+n++},n=>{E.test(n)&&t(e)<1e3&&o(e,n)}]})(),c=f();return[(e,n,t,r=[],o=()=>[])=>{null!=l||(l=ee);const u=s(1);var i,d;return w(c,u,[e,n,t,r,o]),d=u,null==(i=y(n,null!=t?t:[""],z))||i.add(d),u},(e,n,...s)=>r(((e,n=[""])=>{const l=[],s=(e,u)=>u==t(n)?o(l,e):null===n[u]?g(e,(e=>s(e,u+1))):r([n[u],null],(n=>s(L(e,n),u+1)));return s(e,0),l})(e,n),(e=>g(e,(e=>L(c,e)[0](l,...null!=n?n:[],...s))))),e=>n(L(c,e),(([,n,t])=>(y(n,null!=t?t:[""],void 0,(n=>(C(n,e),p(n)?1:0))),w(c,e),u(e),t))),s=>n(L(c,s),(([n,,s=[],o,u])=>{const i=(...c)=>{var d,a;const v=t(c);v==t(s)?n(l,...c,...u(c)):e(s[v])?r(null!=(a=null==(d=o[v])?void 0:d.call(o,...c))?a:[],(e=>i(...c,e))):i(...c,s[v])};i()}))]})(),O=f(),T=f(),W=[],$=[],m=(n,t)=>{M=0,d.transaction((()=>{const[l,r]=L(O,t);g(l,((t,l)=>g(t,((t,r)=>g(t,((t,s)=>((n,t,l,r,s)=>e(s)?n.delCell(t,l,r,!0):n.setCell(t,l,r,s))(d,l,r,s,t[n]))))))),g(r,((t,l)=>((n,t,l)=>e(l)?n.delValue(t):n.setValue(t,l))(d,l,t[n])))})),M=1},q=e=>{w(O,e),w(T,e),x(b,[e])},D=(e,n)=>r(((e,n)=>e.splice(0,n))(e,null!=n?n:t(e)),q),G=()=>D(W,t(W)-V),H=()=>n(v,(()=>{o(W,v),G(),D($),v=void 0,I=1})),J=()=>{v=u(W),I=1};let K,N;const P=(n="")=>(e(v)&&(v=""+k++,w(O,v,[A,F]),Y(v,n),A=f(),F=f(),I=1),v),Q=()=>{s(W)||(((e,...n)=>{e.unshift(...n)})($,P()),m(0,v),v=u(W),I=1)},R=()=>{s($)||(o(W,v),v=i($),m(1,v),I=1)},U=()=>{I&&(x(_),I=0)},X=e=>{const n=P(e);return U(),n},Y=(e,n)=>(Z(e)&&L(T,e)!==n&&(w(T,e,n),x(b,[e])),ee),Z=e=>h(O,e),ee={setSize:e=>(V=e,G(),ee),addCheckpoint:X,setCheckpoint:Y,getStore:()=>d,getCheckpointIds:()=>[[...W],v,[...$]],forEachCheckpoint:e=>{return n=e,g(T,((e,t)=>n(t,e)));var n},hasCheckpoint:Z,getCheckpoint:e=>L(T,e),goBackward:()=>(Q(),U(),ee),goForward:()=>(R(),U(),ee),goTo:n=>{const t=l(W,n)?Q:l($,n)?R:null;for(;!e(t)&&n!=v;)t();return U(),ee},addCheckpointIdsListener:e=>j(e,_),addCheckpointListener:(e,n)=>j(n,b,[e]),delListener:e=>(B(e),ee),clear:()=>(D(W),D($),e(v)||q(v),v=void 0,k=0,X(),ee),clearForward:()=>(s($)||(D($),x(_)),ee),destroy:()=>{d.delListener(K),d.delListener(N)},getListenerStats:()=>({checkpointIds:a(_),checkpoint:a(b)}),_registerListeners:()=>{K=d.addCellListener(null,null,null,((e,n,t,l,r,s)=>{if(M){H();const e=S(A,n,f),o=S(e,t,f),u=S(o,l,(()=>[s,void 0]));u[1]=r,u[0]===r&&p(w(o,l))&&p(w(e,t))&&p(w(A,n))&&J(),U()}})),N=d.addValueListener(null,((e,n,t,l)=>{if(M){H();const e=S(F,n,(()=>[l,void 0]));e[1]=t,e[0]===t&&p(w(F,n))&&J(),U()}}))}};return c(ee.clear())})(d));const I=k.get(d);return null==v||v(I),I}})(0,(e=>e._registerListeners()));exports.createCheckpoints=I;
|
|
Binary file
|