tinybase 5.1.0 → 5.1.1
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/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 +59 -3
- package/@types/synchronizers/synchronizer-ws-server/index.d.ts +59 -3
- package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.cts +65 -4
- package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.ts +65 -4
- 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 +4 -4
- package/readme.md +1 -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
|
@@ -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
|
|
@@ -626,6 +637,46 @@ export interface WsServer {
|
|
|
626
637
|
* rmSync('petShop.json');
|
|
627
638
|
* ```
|
|
628
639
|
* @example
|
|
640
|
+
* This example creates a WsServer that persists a MergeableStore to file that
|
|
641
|
+
* is synchronized with two clients on a shared path, but also which updates its
|
|
642
|
+
* data once synchronization has started.
|
|
643
|
+
*
|
|
644
|
+
* ```js
|
|
645
|
+
* import {WebSocketServer} from 'ws';
|
|
646
|
+
* import {createFilePersister} from 'tinybase/persisters/persister-file';
|
|
647
|
+
* import {createMergeableStore} from 'tinybase';
|
|
648
|
+
* import {createWsServer} from 'tinybase/synchronizers/synchronizer-ws-server';
|
|
649
|
+
* import {createWsSynchronizer} from 'tinybase/synchronizers/synchronizer-ws-client';
|
|
650
|
+
* import {rmSync} from 'fs';
|
|
651
|
+
*
|
|
652
|
+
* // Server
|
|
653
|
+
* const server = createWsServer(
|
|
654
|
+
* new WebSocketServer({port: 8047}),
|
|
655
|
+
* (pathId) => [
|
|
656
|
+
* createFilePersister(createMergeableStore(), pathId + '.json'),
|
|
657
|
+
* (store) => store.setValue('pathId', pathId),
|
|
658
|
+
* ],
|
|
659
|
+
* );
|
|
660
|
+
*
|
|
661
|
+
* const clientStore = createMergeableStore();
|
|
662
|
+
* clientStore.setCell('pets', 'fido', 'species', 'dog');
|
|
663
|
+
* const synchronizer = await createWsSynchronizer(
|
|
664
|
+
* clientStore,
|
|
665
|
+
* new WebSocket('ws://localhost:8047/petShop'),
|
|
666
|
+
* );
|
|
667
|
+
* await synchronizer.startSync();
|
|
668
|
+
* // ...
|
|
669
|
+
*
|
|
670
|
+
* console.log(clientStore.getContent());
|
|
671
|
+
* // -> [{pets: {fido: {species: 'dog'}}}, {"pathId": "petShop"}]
|
|
672
|
+
*
|
|
673
|
+
* synchronizer.destroy();
|
|
674
|
+
* server.destroy();
|
|
675
|
+
*
|
|
676
|
+
* // Remove file for the purposes of this demo.
|
|
677
|
+
* rmSync('petShop.json');
|
|
678
|
+
* ```
|
|
679
|
+
* @example
|
|
629
680
|
* This example creates a WsServer with a custom listener that displays
|
|
630
681
|
* information about the address of the client that connects to it.
|
|
631
682
|
*
|
|
@@ -661,5 +712,10 @@ export function createWsServer<
|
|
|
661
712
|
>,
|
|
662
713
|
>(
|
|
663
714
|
webSocketServer: WebSocketServer,
|
|
664
|
-
createPersisterForPath?: (
|
|
715
|
+
createPersisterForPath?: (
|
|
716
|
+
pathId: Id,
|
|
717
|
+
) =>
|
|
718
|
+
| PathPersister
|
|
719
|
+
| [PathPersister, (store: MergeableStore) => void]
|
|
720
|
+
| undefined,
|
|
665
721
|
): 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
|
|
@@ -626,6 +637,46 @@ export interface WsServer {
|
|
|
626
637
|
* rmSync('petShop.json');
|
|
627
638
|
* ```
|
|
628
639
|
* @example
|
|
640
|
+
* This example creates a WsServer that persists a MergeableStore to file that
|
|
641
|
+
* is synchronized with two clients on a shared path, but also which updates its
|
|
642
|
+
* data once synchronization has started.
|
|
643
|
+
*
|
|
644
|
+
* ```js
|
|
645
|
+
* import {WebSocketServer} from 'ws';
|
|
646
|
+
* import {createFilePersister} from 'tinybase/persisters/persister-file';
|
|
647
|
+
* import {createMergeableStore} from 'tinybase';
|
|
648
|
+
* import {createWsServer} from 'tinybase/synchronizers/synchronizer-ws-server';
|
|
649
|
+
* import {createWsSynchronizer} from 'tinybase/synchronizers/synchronizer-ws-client';
|
|
650
|
+
* import {rmSync} from 'fs';
|
|
651
|
+
*
|
|
652
|
+
* // Server
|
|
653
|
+
* const server = createWsServer(
|
|
654
|
+
* new WebSocketServer({port: 8047}),
|
|
655
|
+
* (pathId) => [
|
|
656
|
+
* createFilePersister(createMergeableStore(), pathId + '.json'),
|
|
657
|
+
* (store) => store.setValue('pathId', pathId),
|
|
658
|
+
* ],
|
|
659
|
+
* );
|
|
660
|
+
*
|
|
661
|
+
* const clientStore = createMergeableStore();
|
|
662
|
+
* clientStore.setCell('pets', 'fido', 'species', 'dog');
|
|
663
|
+
* const synchronizer = await createWsSynchronizer(
|
|
664
|
+
* clientStore,
|
|
665
|
+
* new WebSocket('ws://localhost:8047/petShop'),
|
|
666
|
+
* );
|
|
667
|
+
* await synchronizer.startSync();
|
|
668
|
+
* // ...
|
|
669
|
+
*
|
|
670
|
+
* console.log(clientStore.getContent());
|
|
671
|
+
* // -> [{pets: {fido: {species: 'dog'}}}, {"pathId": "petShop"}]
|
|
672
|
+
*
|
|
673
|
+
* synchronizer.destroy();
|
|
674
|
+
* server.destroy();
|
|
675
|
+
*
|
|
676
|
+
* // Remove file for the purposes of this demo.
|
|
677
|
+
* rmSync('petShop.json');
|
|
678
|
+
* ```
|
|
679
|
+
* @example
|
|
629
680
|
* This example creates a WsServer with a custom listener that displays
|
|
630
681
|
* information about the address of the client that connects to it.
|
|
631
682
|
*
|
|
@@ -661,5 +712,10 @@ export function createWsServer<
|
|
|
661
712
|
>,
|
|
662
713
|
>(
|
|
663
714
|
webSocketServer: WebSocketServer,
|
|
664
|
-
createPersisterForPath?: (
|
|
715
|
+
createPersisterForPath?: (
|
|
716
|
+
pathId: Id,
|
|
717
|
+
) =>
|
|
718
|
+
| PathPersister
|
|
719
|
+
| [PathPersister, (store: MergeableStore) => void]
|
|
720
|
+
| undefined,
|
|
665
721
|
): 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
|
|
@@ -645,6 +661,46 @@ export interface WsServer {
|
|
|
645
661
|
* rmSync('petShop.json');
|
|
646
662
|
* ```
|
|
647
663
|
* @example
|
|
664
|
+
* This example creates a WsServer that persists a MergeableStore to file that
|
|
665
|
+
* is synchronized with two clients on a shared path, but also which updates its
|
|
666
|
+
* data once synchronization has started.
|
|
667
|
+
*
|
|
668
|
+
* ```js
|
|
669
|
+
* import {WebSocketServer} from 'ws';
|
|
670
|
+
* import {createFilePersister} from 'tinybase/persisters/persister-file';
|
|
671
|
+
* import {createMergeableStore} from 'tinybase';
|
|
672
|
+
* import {createWsServer} from 'tinybase/synchronizers/synchronizer-ws-server';
|
|
673
|
+
* import {createWsSynchronizer} from 'tinybase/synchronizers/synchronizer-ws-client';
|
|
674
|
+
* import {rmSync} from 'fs';
|
|
675
|
+
*
|
|
676
|
+
* // Server
|
|
677
|
+
* const server = createWsServer(
|
|
678
|
+
* new WebSocketServer({port: 8047}),
|
|
679
|
+
* (pathId) => [
|
|
680
|
+
* createFilePersister(createMergeableStore(), pathId + '.json'),
|
|
681
|
+
* (store) => store.setValue('pathId', pathId),
|
|
682
|
+
* ],
|
|
683
|
+
* );
|
|
684
|
+
*
|
|
685
|
+
* const clientStore = createMergeableStore();
|
|
686
|
+
* clientStore.setCell('pets', 'fido', 'species', 'dog');
|
|
687
|
+
* const synchronizer = await createWsSynchronizer(
|
|
688
|
+
* clientStore,
|
|
689
|
+
* new WebSocket('ws://localhost:8047/petShop'),
|
|
690
|
+
* );
|
|
691
|
+
* await synchronizer.startSync();
|
|
692
|
+
* // ...
|
|
693
|
+
*
|
|
694
|
+
* console.log(clientStore.getContent());
|
|
695
|
+
* // -> [{pets: {fido: {species: 'dog'}}}, {"pathId": "petShop"}]
|
|
696
|
+
*
|
|
697
|
+
* synchronizer.destroy();
|
|
698
|
+
* server.destroy();
|
|
699
|
+
*
|
|
700
|
+
* // Remove file for the purposes of this demo.
|
|
701
|
+
* rmSync('petShop.json');
|
|
702
|
+
* ```
|
|
703
|
+
* @example
|
|
648
704
|
* This example creates a WsServer with a custom listener that displays
|
|
649
705
|
* information about the address of the client that connects to it.
|
|
650
706
|
*
|
|
@@ -682,5 +738,10 @@ export function createWsServer<
|
|
|
682
738
|
>,
|
|
683
739
|
>(
|
|
684
740
|
webSocketServer: WebSocketServer,
|
|
685
|
-
createPersisterForPath?: (
|
|
741
|
+
createPersisterForPath?: (
|
|
742
|
+
pathId: Id,
|
|
743
|
+
) =>
|
|
744
|
+
| PathPersister
|
|
745
|
+
| [PathPersister, (store: MergeableStore<Schemas>) => void]
|
|
746
|
+
| undefined,
|
|
686
747
|
): 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
|
|
@@ -645,6 +661,46 @@ export interface WsServer {
|
|
|
645
661
|
* rmSync('petShop.json');
|
|
646
662
|
* ```
|
|
647
663
|
* @example
|
|
664
|
+
* This example creates a WsServer that persists a MergeableStore to file that
|
|
665
|
+
* is synchronized with two clients on a shared path, but also which updates its
|
|
666
|
+
* data once synchronization has started.
|
|
667
|
+
*
|
|
668
|
+
* ```js
|
|
669
|
+
* import {WebSocketServer} from 'ws';
|
|
670
|
+
* import {createFilePersister} from 'tinybase/persisters/persister-file';
|
|
671
|
+
* import {createMergeableStore} from 'tinybase';
|
|
672
|
+
* import {createWsServer} from 'tinybase/synchronizers/synchronizer-ws-server';
|
|
673
|
+
* import {createWsSynchronizer} from 'tinybase/synchronizers/synchronizer-ws-client';
|
|
674
|
+
* import {rmSync} from 'fs';
|
|
675
|
+
*
|
|
676
|
+
* // Server
|
|
677
|
+
* const server = createWsServer(
|
|
678
|
+
* new WebSocketServer({port: 8047}),
|
|
679
|
+
* (pathId) => [
|
|
680
|
+
* createFilePersister(createMergeableStore(), pathId + '.json'),
|
|
681
|
+
* (store) => store.setValue('pathId', pathId),
|
|
682
|
+
* ],
|
|
683
|
+
* );
|
|
684
|
+
*
|
|
685
|
+
* const clientStore = createMergeableStore();
|
|
686
|
+
* clientStore.setCell('pets', 'fido', 'species', 'dog');
|
|
687
|
+
* const synchronizer = await createWsSynchronizer(
|
|
688
|
+
* clientStore,
|
|
689
|
+
* new WebSocket('ws://localhost:8047/petShop'),
|
|
690
|
+
* );
|
|
691
|
+
* await synchronizer.startSync();
|
|
692
|
+
* // ...
|
|
693
|
+
*
|
|
694
|
+
* console.log(clientStore.getContent());
|
|
695
|
+
* // -> [{pets: {fido: {species: 'dog'}}}, {"pathId": "petShop"}]
|
|
696
|
+
*
|
|
697
|
+
* synchronizer.destroy();
|
|
698
|
+
* server.destroy();
|
|
699
|
+
*
|
|
700
|
+
* // Remove file for the purposes of this demo.
|
|
701
|
+
* rmSync('petShop.json');
|
|
702
|
+
* ```
|
|
703
|
+
* @example
|
|
648
704
|
* This example creates a WsServer with a custom listener that displays
|
|
649
705
|
* information about the address of the client that connects to it.
|
|
650
706
|
*
|
|
@@ -682,5 +738,10 @@ export function createWsServer<
|
|
|
682
738
|
>,
|
|
683
739
|
>(
|
|
684
740
|
webSocketServer: WebSocketServer,
|
|
685
|
-
createPersisterForPath?: (
|
|
741
|
+
createPersisterForPath?: (
|
|
742
|
+
pathId: Id,
|
|
743
|
+
) =>
|
|
744
|
+
| PathPersister
|
|
745
|
+
| [PathPersister, (store: MergeableStore<Schemas>) => void]
|
|
746
|
+
| undefined,
|
|
686
747
|
): 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
|
|
@@ -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
|