tinybase 6.0.0-beta.1 → 6.0.0-beta.3
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/_internal/queries/with-schemas/index.d.cts +6 -6
- package/@types/_internal/queries/with-schemas/index.d.ts +6 -6
- package/@types/_internal/store/with-schemas/index.d.cts +1 -1
- package/@types/_internal/store/with-schemas/index.d.ts +1 -1
- package/@types/_internal/ui-react/with-schemas/index.d.cts +13 -13
- package/@types/_internal/ui-react/with-schemas/index.d.ts +13 -13
- package/@types/checkpoints/index.d.cts +0 -1
- package/@types/checkpoints/index.d.ts +0 -1
- package/@types/checkpoints/with-schemas/index.d.cts +0 -1
- package/@types/checkpoints/with-schemas/index.d.ts +0 -1
- package/@types/indexes/index.d.cts +1 -2
- package/@types/indexes/index.d.ts +1 -2
- package/@types/indexes/with-schemas/index.d.cts +6 -7
- package/@types/indexes/with-schemas/index.d.ts +6 -7
- package/@types/mergeable-store/index.d.cts +1 -2
- package/@types/mergeable-store/index.d.ts +1 -2
- package/@types/mergeable-store/with-schemas/index.d.cts +1 -2
- package/@types/mergeable-store/with-schemas/index.d.ts +1 -2
- package/@types/metrics/index.d.cts +1 -2
- package/@types/metrics/index.d.ts +1 -2
- package/@types/metrics/with-schemas/index.d.cts +1 -2
- package/@types/metrics/with-schemas/index.d.ts +1 -2
- package/@types/persisters/index.d.cts +22 -23
- package/@types/persisters/index.d.ts +22 -23
- package/@types/persisters/persister-automerge/index.d.cts +6 -7
- package/@types/persisters/persister-automerge/index.d.ts +6 -7
- package/@types/persisters/persister-automerge/with-schemas/index.d.cts +5 -6
- package/@types/persisters/persister-automerge/with-schemas/index.d.ts +5 -6
- package/@types/persisters/persister-browser/index.d.cts +5 -6
- package/@types/persisters/persister-browser/index.d.ts +5 -6
- package/@types/persisters/persister-browser/with-schemas/index.d.cts +5 -6
- package/@types/persisters/persister-browser/with-schemas/index.d.ts +5 -6
- package/@types/persisters/persister-cr-sqlite-wasm/index.d.cts +7 -8
- package/@types/persisters/persister-cr-sqlite-wasm/index.d.ts +7 -8
- package/@types/persisters/persister-cr-sqlite-wasm/with-schemas/index.d.cts +10 -11
- package/@types/persisters/persister-cr-sqlite-wasm/with-schemas/index.d.ts +10 -11
- package/@types/persisters/persister-durable-object-storage/index.d.cts +5 -6
- package/@types/persisters/persister-durable-object-storage/index.d.ts +5 -6
- package/@types/persisters/persister-durable-object-storage/with-schemas/index.d.cts +5 -6
- package/@types/persisters/persister-durable-object-storage/with-schemas/index.d.ts +5 -6
- package/@types/persisters/persister-electric-sql/index.d.cts +7 -8
- package/@types/persisters/persister-electric-sql/index.d.ts +7 -8
- package/@types/persisters/persister-electric-sql/with-schemas/index.d.cts +10 -11
- package/@types/persisters/persister-electric-sql/with-schemas/index.d.ts +10 -11
- package/@types/persisters/persister-expo-sqlite/index.d.cts +8 -9
- package/@types/persisters/persister-expo-sqlite/index.d.ts +8 -9
- package/@types/persisters/persister-expo-sqlite/with-schemas/index.d.cts +11 -12
- package/@types/persisters/persister-expo-sqlite/with-schemas/index.d.ts +11 -12
- package/@types/persisters/persister-file/index.d.cts +3 -4
- package/@types/persisters/persister-file/index.d.ts +3 -4
- package/@types/persisters/persister-file/with-schemas/index.d.cts +3 -4
- package/@types/persisters/persister-file/with-schemas/index.d.ts +3 -4
- package/@types/persisters/persister-indexed-db/index.d.cts +3 -4
- package/@types/persisters/persister-indexed-db/index.d.ts +3 -4
- package/@types/persisters/persister-indexed-db/with-schemas/index.d.cts +2 -3
- package/@types/persisters/persister-indexed-db/with-schemas/index.d.ts +2 -3
- package/@types/persisters/persister-libsql/index.d.cts +4 -5
- package/@types/persisters/persister-libsql/index.d.ts +4 -5
- package/@types/persisters/persister-libsql/with-schemas/index.d.cts +7 -8
- package/@types/persisters/persister-libsql/with-schemas/index.d.ts +7 -8
- package/@types/persisters/persister-partykit-client/index.d.cts +4 -5
- package/@types/persisters/persister-partykit-client/index.d.ts +4 -5
- package/@types/persisters/persister-partykit-client/with-schemas/index.d.cts +3 -4
- package/@types/persisters/persister-partykit-client/with-schemas/index.d.ts +3 -4
- package/@types/persisters/persister-partykit-server/index.d.cts +1 -2
- package/@types/persisters/persister-partykit-server/index.d.ts +1 -2
- package/@types/persisters/persister-partykit-server/with-schemas/index.d.cts +1 -2
- package/@types/persisters/persister-partykit-server/with-schemas/index.d.ts +1 -2
- package/@types/persisters/persister-pglite/index.d.cts +5 -6
- package/@types/persisters/persister-pglite/index.d.ts +5 -6
- package/@types/persisters/persister-pglite/with-schemas/index.d.cts +8 -9
- package/@types/persisters/persister-pglite/with-schemas/index.d.ts +8 -9
- package/@types/persisters/persister-postgres/index.d.cts +8 -9
- package/@types/persisters/persister-postgres/index.d.ts +8 -9
- package/@types/persisters/persister-postgres/with-schemas/index.d.cts +11 -12
- package/@types/persisters/persister-postgres/with-schemas/index.d.ts +11 -12
- package/@types/persisters/persister-powersync/index.d.cts +7 -8
- package/@types/persisters/persister-powersync/index.d.ts +7 -8
- package/@types/persisters/persister-powersync/with-schemas/index.d.cts +10 -11
- package/@types/persisters/persister-powersync/with-schemas/index.d.ts +10 -11
- package/@types/persisters/persister-remote/index.d.cts +3 -4
- package/@types/persisters/persister-remote/index.d.ts +3 -4
- package/@types/persisters/persister-remote/with-schemas/index.d.cts +2 -3
- package/@types/persisters/persister-remote/with-schemas/index.d.ts +2 -3
- package/@types/persisters/persister-sqlite-wasm/index.d.cts +7 -8
- package/@types/persisters/persister-sqlite-wasm/index.d.ts +7 -8
- package/@types/persisters/persister-sqlite-wasm/with-schemas/index.d.cts +11 -12
- package/@types/persisters/persister-sqlite-wasm/with-schemas/index.d.ts +11 -12
- package/@types/persisters/persister-sqlite3/index.d.cts +5 -6
- package/@types/persisters/persister-sqlite3/index.d.ts +5 -6
- package/@types/persisters/persister-sqlite3/with-schemas/index.d.cts +8 -9
- package/@types/persisters/persister-sqlite3/with-schemas/index.d.ts +8 -9
- package/@types/persisters/persister-yjs/index.d.cts +4 -5
- package/@types/persisters/persister-yjs/index.d.ts +4 -5
- package/@types/persisters/persister-yjs/with-schemas/index.d.cts +3 -4
- package/@types/persisters/persister-yjs/with-schemas/index.d.ts +3 -4
- package/@types/persisters/with-schemas/index.d.cts +26 -27
- package/@types/persisters/with-schemas/index.d.ts +26 -27
- package/@types/queries/index.d.cts +1 -2
- package/@types/queries/index.d.ts +1 -2
- package/@types/queries/with-schemas/index.d.cts +10 -11
- package/@types/queries/with-schemas/index.d.ts +10 -11
- package/@types/relationships/index.d.cts +25 -2
- package/@types/relationships/index.d.ts +25 -2
- package/@types/relationships/with-schemas/index.d.cts +25 -2
- package/@types/relationships/with-schemas/index.d.ts +25 -2
- package/@types/store/index.d.cts +1 -2
- package/@types/store/index.d.ts +1 -2
- package/@types/store/with-schemas/index.d.cts +0 -1
- package/@types/store/with-schemas/index.d.ts +0 -1
- package/@types/synchronizers/index.d.cts +6 -7
- package/@types/synchronizers/index.d.ts +6 -7
- package/@types/synchronizers/synchronizer-broadcast-channel/index.d.cts +3 -4
- package/@types/synchronizers/synchronizer-broadcast-channel/index.d.ts +3 -4
- package/@types/synchronizers/synchronizer-broadcast-channel/with-schemas/index.d.cts +3 -4
- package/@types/synchronizers/synchronizer-broadcast-channel/with-schemas/index.d.ts +3 -4
- package/@types/synchronizers/synchronizer-local/index.d.cts +2 -3
- package/@types/synchronizers/synchronizer-local/index.d.ts +2 -3
- package/@types/synchronizers/synchronizer-local/with-schemas/index.d.cts +2 -3
- package/@types/synchronizers/synchronizer-local/with-schemas/index.d.ts +2 -3
- package/@types/synchronizers/synchronizer-ws-client/index.d.cts +5 -6
- package/@types/synchronizers/synchronizer-ws-client/index.d.ts +5 -6
- package/@types/synchronizers/synchronizer-ws-client/with-schemas/index.d.cts +5 -6
- package/@types/synchronizers/synchronizer-ws-client/with-schemas/index.d.ts +5 -6
- package/@types/synchronizers/synchronizer-ws-server/index.d.cts +30 -32
- package/@types/synchronizers/synchronizer-ws-server/index.d.ts +30 -32
- package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.cts +34 -36
- package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.ts +34 -36
- package/@types/synchronizers/synchronizer-ws-server-durable-object/index.d.cts +2 -3
- package/@types/synchronizers/synchronizer-ws-server-durable-object/index.d.ts +2 -3
- package/@types/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.d.cts +6 -7
- package/@types/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.d.ts +6 -7
- package/@types/synchronizers/synchronizer-ws-server-simple/index.d.cts +4 -5
- package/@types/synchronizers/synchronizer-ws-server-simple/index.d.ts +4 -5
- package/@types/synchronizers/synchronizer-ws-server-simple/with-schemas/index.d.cts +4 -5
- package/@types/synchronizers/synchronizer-ws-server-simple/with-schemas/index.d.ts +4 -5
- package/@types/synchronizers/with-schemas/index.d.cts +10 -11
- package/@types/synchronizers/with-schemas/index.d.ts +10 -11
- package/@types/ui-react/index.d.cts +489 -490
- package/@types/ui-react/index.d.ts +489 -490
- package/@types/ui-react/with-schemas/index.d.cts +494 -495
- package/@types/ui-react/with-schemas/index.d.ts +494 -495
- package/@types/ui-react-dom/index.d.cts +39 -40
- package/@types/ui-react-dom/index.d.ts +39 -40
- package/@types/ui-react-dom/with-schemas/index.d.cts +39 -40
- package/@types/ui-react-dom/with-schemas/index.d.ts +39 -40
- package/@types/ui-react-inspector/index.d.cts +2 -3
- package/@types/ui-react-inspector/index.d.ts +2 -3
- package/@types/ui-react-inspector/with-schemas/index.d.cts +41 -42
- package/@types/ui-react-inspector/with-schemas/index.d.ts +41 -42
- package/checkpoints/index.js +9 -9
- package/checkpoints/with-schemas/index.js +9 -9
- package/index.js +110 -110
- package/indexes/index.js +3 -3
- package/indexes/with-schemas/index.js +3 -3
- package/mergeable-store/index.js +150 -150
- package/mergeable-store/with-schemas/index.js +150 -150
- package/metrics/index.js +3 -3
- package/metrics/with-schemas/index.js +3 -3
- 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/index.js +1 -1
- package/min/persisters/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-browser/index.js +1 -1
- package/min/persisters/persister-browser/index.js.gz +0 -0
- package/min/persisters/persister-browser/with-schemas/index.js +1 -1
- package/min/persisters/persister-browser/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-cr-sqlite-wasm/index.js +1 -1
- package/min/persisters/persister-cr-sqlite-wasm/index.js.gz +0 -0
- package/min/persisters/persister-cr-sqlite-wasm/with-schemas/index.js +1 -1
- package/min/persisters/persister-cr-sqlite-wasm/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-durable-object-storage/index.js +1 -1
- package/min/persisters/persister-durable-object-storage/index.js.gz +0 -0
- package/min/persisters/persister-durable-object-storage/with-schemas/index.js +1 -1
- package/min/persisters/persister-durable-object-storage/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-electric-sql/index.js +1 -1
- package/min/persisters/persister-electric-sql/index.js.gz +0 -0
- package/min/persisters/persister-electric-sql/with-schemas/index.js +1 -1
- package/min/persisters/persister-electric-sql/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-expo-sqlite/index.js +1 -1
- package/min/persisters/persister-expo-sqlite/index.js.gz +0 -0
- package/min/persisters/persister-expo-sqlite/with-schemas/index.js +1 -1
- package/min/persisters/persister-expo-sqlite/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-file/index.js +1 -1
- package/min/persisters/persister-file/index.js.gz +0 -0
- package/min/persisters/persister-file/with-schemas/index.js +1 -1
- package/min/persisters/persister-file/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-libsql/index.js +1 -1
- package/min/persisters/persister-libsql/index.js.gz +0 -0
- package/min/persisters/persister-libsql/with-schemas/index.js +1 -1
- package/min/persisters/persister-libsql/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-partykit-server/index.js +1 -1
- package/min/persisters/persister-partykit-server/index.js.gz +0 -0
- package/min/persisters/persister-partykit-server/with-schemas/index.js +1 -1
- package/min/persisters/persister-partykit-server/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-pglite/index.js +1 -1
- package/min/persisters/persister-pglite/index.js.gz +0 -0
- package/min/persisters/persister-pglite/with-schemas/index.js +1 -1
- package/min/persisters/persister-pglite/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-postgres/index.js +1 -1
- package/min/persisters/persister-postgres/index.js.gz +0 -0
- package/min/persisters/persister-postgres/with-schemas/index.js +1 -1
- package/min/persisters/persister-postgres/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-powersync/index.js +1 -1
- package/min/persisters/persister-powersync/index.js.gz +0 -0
- package/min/persisters/persister-powersync/with-schemas/index.js +1 -1
- package/min/persisters/persister-powersync/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-remote/index.js +1 -1
- package/min/persisters/persister-remote/index.js.gz +0 -0
- package/min/persisters/persister-remote/with-schemas/index.js +1 -1
- package/min/persisters/persister-remote/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-sqlite-wasm/index.js +1 -1
- package/min/persisters/persister-sqlite-wasm/index.js.gz +0 -0
- package/min/persisters/persister-sqlite-wasm/with-schemas/index.js +1 -1
- package/min/persisters/persister-sqlite-wasm/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-sqlite3/index.js +1 -1
- package/min/persisters/persister-sqlite3/index.js.gz +0 -0
- package/min/persisters/persister-sqlite3/with-schemas/index.js +1 -1
- package/min/persisters/persister-sqlite3/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/persisters/with-schemas/index.js +1 -1
- package/min/persisters/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/index.js +1 -1
- package/min/synchronizers/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-broadcast-channel/index.js +1 -1
- package/min/synchronizers/synchronizer-broadcast-channel/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-local/index.js +1 -1
- package/min/synchronizers/synchronizer-local/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-local/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/synchronizers/synchronizer-ws-server-durable-object/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server-durable-object/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server-simple/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server-simple/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server-simple/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server-simple/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/with-schemas/index.js +1 -1
- package/min/synchronizers/with-schemas/index.js.gz +0 -0
- package/min/ui-react/index.js +1 -1
- package/min/ui-react/index.js.gz +0 -0
- package/min/ui-react/with-schemas/index.js +1 -1
- package/min/ui-react/with-schemas/index.js.gz +0 -0
- package/min/ui-react-dom/index.js +1 -1
- package/min/ui-react-dom/index.js.gz +0 -0
- package/min/ui-react-dom/with-schemas/index.js +1 -1
- package/min/ui-react-dom/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 -44
- package/persisters/index.js +120 -120
- package/persisters/persister-automerge/index.js +8 -8
- package/persisters/persister-automerge/with-schemas/index.js +8 -8
- package/persisters/persister-browser/index.js +8 -8
- package/persisters/persister-browser/with-schemas/index.js +8 -8
- package/persisters/persister-cr-sqlite-wasm/index.js +119 -119
- package/persisters/persister-cr-sqlite-wasm/with-schemas/index.js +119 -119
- package/persisters/persister-durable-object-storage/index.js +12 -12
- package/persisters/persister-durable-object-storage/with-schemas/index.js +12 -12
- package/persisters/persister-electric-sql/index.js +119 -119
- package/persisters/persister-electric-sql/with-schemas/index.js +119 -119
- package/persisters/persister-expo-sqlite/index.js +119 -119
- package/persisters/persister-expo-sqlite/with-schemas/index.js +119 -119
- package/persisters/persister-file/index.js +10 -10
- package/persisters/persister-file/with-schemas/index.js +10 -10
- package/persisters/persister-indexed-db/index.js +8 -8
- package/persisters/persister-indexed-db/with-schemas/index.js +8 -8
- package/persisters/persister-libsql/index.js +119 -119
- package/persisters/persister-libsql/with-schemas/index.js +119 -119
- package/persisters/persister-partykit-client/index.js +23 -23
- package/persisters/persister-partykit-client/with-schemas/index.js +23 -23
- package/persisters/persister-partykit-server/index.js +13 -9
- package/persisters/persister-partykit-server/with-schemas/index.js +13 -9
- package/persisters/persister-pglite/index.js +128 -128
- package/persisters/persister-pglite/with-schemas/index.js +128 -128
- package/persisters/persister-postgres/index.js +128 -128
- package/persisters/persister-postgres/with-schemas/index.js +128 -128
- package/persisters/persister-powersync/index.js +119 -119
- package/persisters/persister-powersync/with-schemas/index.js +119 -119
- package/persisters/persister-remote/index.js +8 -8
- package/persisters/persister-remote/with-schemas/index.js +8 -8
- package/persisters/persister-sqlite-wasm/index.js +119 -119
- package/persisters/persister-sqlite-wasm/with-schemas/index.js +119 -119
- package/persisters/persister-sqlite3/index.js +119 -119
- package/persisters/persister-sqlite3/with-schemas/index.js +119 -119
- package/persisters/persister-yjs/index.js +14 -14
- package/persisters/persister-yjs/with-schemas/index.js +14 -14
- package/persisters/with-schemas/index.js +120 -120
- package/queries/index.js +16 -16
- package/queries/with-schemas/index.js +16 -16
- package/readme.md +3 -22
- package/relationships/index.js +3 -3
- package/relationships/with-schemas/index.js +3 -3
- package/releases.md +6 -6
- package/store/index.js +43 -43
- package/store/with-schemas/index.js +43 -43
- package/synchronizers/index.js +31 -31
- package/synchronizers/synchronizer-broadcast-channel/index.js +31 -31
- package/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +31 -31
- package/synchronizers/synchronizer-local/index.js +31 -31
- package/synchronizers/synchronizer-local/with-schemas/index.js +31 -31
- package/synchronizers/synchronizer-ws-client/index.js +25 -25
- package/synchronizers/synchronizer-ws-client/with-schemas/index.js +25 -25
- package/synchronizers/synchronizer-ws-server/index.js +65 -65
- package/synchronizers/synchronizer-ws-server/with-schemas/index.js +65 -65
- package/synchronizers/synchronizer-ws-server-durable-object/index.js +25 -25
- package/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js +25 -25
- package/synchronizers/synchronizer-ws-server-simple/index.js +3 -3
- package/synchronizers/synchronizer-ws-server-simple/with-schemas/index.js +3 -3
- package/synchronizers/with-schemas/index.js +31 -31
- package/ui-react/index.js +31 -34
- package/ui-react/with-schemas/index.js +31 -34
- package/ui-react-dom/index.js +24 -24
- package/ui-react-dom/with-schemas/index.js +24 -24
- package/ui-react-inspector/index.js +3066 -3067
- package/ui-react-inspector/with-schemas/index.js +3066 -3067
- package/with-schemas/index.js +110 -110
- package/@types/tools/index.d.cts +0 -588
- package/@types/tools/index.d.ts +0 -588
- package/@types/tools/with-schemas/index.d.cts +0 -599
- package/@types/tools/with-schemas/index.d.ts +0 -599
- package/cli/index.js +0 -93
- package/min/tools/index.js +0 -1
- package/min/tools/index.js.gz +0 -0
- package/min/tools/with-schemas/index.js +0 -1
- package/min/tools/with-schemas/index.js.gz +0 -0
- package/tools/index.js +0 -3301
- package/tools/with-schemas/index.js +0 -3301
package/relationships/index.js
CHANGED
|
@@ -20,9 +20,6 @@ const arrayReduce = (array, cb, initial) => array.reduce(cb, initial);
|
|
|
20
20
|
const arrayPush = (array, ...values) => array.push(...values);
|
|
21
21
|
const arrayShift = (array) => array.shift();
|
|
22
22
|
|
|
23
|
-
const object = Object;
|
|
24
|
-
const objFreeze = object.freeze;
|
|
25
|
-
|
|
26
23
|
const collSizeN = (collSizer) => (coll) =>
|
|
27
24
|
arrayReduce(collValues(coll), (total, coll2) => total + collSizer(coll2), 0);
|
|
28
25
|
const collSize = (coll) => coll?.size ?? 0;
|
|
@@ -35,6 +32,9 @@ const collClear = (coll) => coll.clear();
|
|
|
35
32
|
const collForEach = (coll, cb) => coll?.forEach(cb);
|
|
36
33
|
const collDel = (coll, keyOrValue) => coll?.delete(keyOrValue);
|
|
37
34
|
|
|
35
|
+
const object = Object;
|
|
36
|
+
const objFreeze = object.freeze;
|
|
37
|
+
|
|
38
38
|
const mapNew = (entries) => new Map(entries);
|
|
39
39
|
const mapKeys = (map) => [...(map?.keys() ?? [])];
|
|
40
40
|
const mapGet = (map, key) => map?.get(key);
|
|
@@ -20,9 +20,6 @@ const arrayReduce = (array, cb, initial) => array.reduce(cb, initial);
|
|
|
20
20
|
const arrayPush = (array, ...values) => array.push(...values);
|
|
21
21
|
const arrayShift = (array) => array.shift();
|
|
22
22
|
|
|
23
|
-
const object = Object;
|
|
24
|
-
const objFreeze = object.freeze;
|
|
25
|
-
|
|
26
23
|
const collSizeN = (collSizer) => (coll) =>
|
|
27
24
|
arrayReduce(collValues(coll), (total, coll2) => total + collSizer(coll2), 0);
|
|
28
25
|
const collSize = (coll) => coll?.size ?? 0;
|
|
@@ -35,6 +32,9 @@ const collClear = (coll) => coll.clear();
|
|
|
35
32
|
const collForEach = (coll, cb) => coll?.forEach(cb);
|
|
36
33
|
const collDel = (coll, keyOrValue) => coll?.delete(keyOrValue);
|
|
37
34
|
|
|
35
|
+
const object = Object;
|
|
36
|
+
const objFreeze = object.freeze;
|
|
37
|
+
|
|
38
38
|
const mapNew = (entries) => new Map(entries);
|
|
39
39
|
const mapKeys = (map) => [...(map?.keys() ?? [])];
|
|
40
40
|
const mapGet = (map, key) => map?.get(key);
|
package/releases.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<link rel="preload" as="image" href="https://beta.tinybase.org/partykit.gif"><link rel="preload" as="image" href="https://beta.tinybase.org/ui-react-dom.webp"><link rel="preload" as="image" href="https://beta.tinybase.org/store-inspector.webp"><link rel="preload" as="image" href="https://beta.tinybase.org/car-analysis.webp"><link rel="preload" as="image" href="https://beta.tinybase.org/movie-database.webp"><p>This is a reverse chronological list of the major TinyBase releases, with highlighted features.</p><hr><h1 id="v5-4">v5.4</h1><h2 id="durable-objects-synchronization">Durable Objects synchronization</h2><p>This release contains a new WebSocket synchronization server that runs on Cloudflare as a Durable Object.</p><p><embed src="https://beta.tinybase.org/durable.svg" title="Durable Objects"></p><p>It's in the new <a href="https://beta.tinybase.org/api/synchronizer-ws-server-durable-object/"><code>synchronizer-ws-server-durable-object</code></a> module, and you use it by extending the <a href="https://beta.tinybase.org/api/synchronizer-ws-server-durable-object/classes/creation/wsserverdurableobject/"><code>WsServerDurableObject</code></a> class. Use the <a href="https://beta.tinybase.org/api/synchronizer-ws-server-durable-object/functions/creation/getwsserverdurableobjectfetch/"><code>getWsServerDurableObjectFetch</code></a> function for conveniently binding your Cloudflare Worker to your Durable Object:</p>
|
|
1
|
+
<link rel="preload" as="image" href="https://beta.tinybase.org/partykit.gif"><link rel="preload" as="image" href="https://beta.tinybase.org/ui-react-dom.webp"><link rel="preload" as="image" href="https://beta.tinybase.org/store-inspector.webp"><link rel="preload" as="image" href="https://beta.tinybase.org/car-analysis.webp"><link rel="preload" as="image" href="https://beta.tinybase.org/movie-database.webp"><p>This is a reverse chronological list of the major TinyBase releases, with highlighted features.</p><hr><h1 id="v6-0">v6.0</h1><p>This major release is about updating dependencies and infrastructure rather than adding new features.</p><p>The most notable changes for users are:</p><ul><li>The package distribution only includes ESM packages.</li><li>React 19 is now expected as a peer dependency for UI components.</li><li>The tools module and TinyBase CLI have been removed.</li></ul><p>As a result of these, there have been some knock-on effects to the project as a whole. For example, React 19 is used as a developer dependency for the project and so the test suite has been updated to use <code>react-testing-library</code> instead of <code>react-test-renderer</code>. The React <code>jsx-runtime</code> is used for JSX transformations. And the demos (and CodePen examples) have been updated to use an <code>importmap</code> mapping the modules to the <a href="https://esm.sh/">esm.sh</a> CDN.</p><p>Please let us know how these changes find you!</p><h1 id="v5-4">v5.4</h1><h2 id="durable-objects-synchronization">Durable Objects synchronization</h2><p>This release contains a new WebSocket synchronization server that runs on Cloudflare as a Durable Object.</p><p><embed src="https://beta.tinybase.org/durable.svg" title="Durable Objects"></p><p>It's in the new <a href="https://beta.tinybase.org/api/synchronizer-ws-server-durable-object/"><code>synchronizer-ws-server-durable-object</code></a> module, and you use it by extending the <a href="https://beta.tinybase.org/api/synchronizer-ws-server-durable-object/classes/creation/wsserverdurableobject/"><code>WsServerDurableObject</code></a> class. Use the <a href="https://beta.tinybase.org/api/synchronizer-ws-server-durable-object/functions/creation/getwsserverdurableobjectfetch/"><code>getWsServerDurableObjectFetch</code></a> function for conveniently binding your Cloudflare Worker to your Durable Object:</p>
|
|
2
2
|
|
|
3
3
|
```js yolo
|
|
4
4
|
import {
|
|
@@ -240,7 +240,7 @@ await indexedDbPersister.save();
|
|
|
240
240
|
indexedDbPersister.destroy();
|
|
241
241
|
```
|
|
242
242
|
|
|
243
|
-
<p>Note that it is not possible to reactively detect changes to a browser's IndexedDB storage. A polling technique is used to load underlying changes if you choose to 'autoLoad' your data into TinyBase.</p><p>This release also upgrades Prettier to v3.0 which has a peer-dependency impact on the
|
|
243
|
+
<p>Note that it is not possible to reactively detect changes to a browser's IndexedDB storage. A polling technique is used to load underlying changes if you choose to 'autoLoad' your data into TinyBase.</p><p>This release also upgrades Prettier to v3.0 which has a peer-dependency impact on the tools module. Please report any issues!</p><hr><h1 id="v4-1">v4.1</h1><p>This release introduces the new <a href="https://beta.tinybase.org/api/ui-react-dom/"><code>ui-react-dom</code></a> module. This provides pre-built components for tabular display of your data in a web application.</p><p><img src="https://beta.tinybase.org/ui-react-dom.webp" alt="A TinyBase DOM Component" title="A TinyBase DOM Component"></p><h2 id="new-dom-components">New DOM Components</h2><p>The following is the list of all the components released in v4.1:</p><div class="table"><table><thead><tr><th>Component</th><th>Purpose</th><th></th></tr></thead><tbody><tr><td><a href="https://beta.tinybase.org/api/ui-react-dom/functions/store-components/valuesinhtmltable/"><code>ValuesInHtmlTable</code></a></td><td>Renders <a href="https://beta.tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a>.</td><td><a href="https://beta.tinybase.org/demos/ui-components/valuesinhtmltable">demo</a></td></tr><tr><td><a href="https://beta.tinybase.org/api/ui-react-dom/functions/store-components/tableinhtmltable/"><code>TableInHtmlTable</code></a></td><td>Renders a <a href="https://beta.tinybase.org/api/store/type-aliases/store/table/"><code>Table</code></a>.</td><td><a href="https://beta.tinybase.org/demos/ui-components/tableinhtmltable">demo</a></td></tr><tr><td><a href="https://beta.tinybase.org/api/ui-react-dom/functions/store-components/sortedtableinhtmltable/"><code>SortedTableInHtmlTable</code></a></td><td>Renders a sorted <a href="https://beta.tinybase.org/api/store/type-aliases/store/table/"><code>Table</code></a>, with optional interactivity.</td><td><a href="https://beta.tinybase.org/demos/ui-components/sortedtableinhtmltable">demo</a></td></tr><tr><td><a href="https://beta.tinybase.org/api/ui-react-dom/functions/indexes-components/sliceinhtmltable/"><code>SliceInHtmlTable</code></a></td><td>Renders a <a href="https://beta.tinybase.org/api/indexes/type-aliases/concept/slice/"><code>Slice</code></a> from an <a href="https://beta.tinybase.org/api/indexes/type-aliases/concept/index/"><code>Index</code></a>.</td><td><a href="https://beta.tinybase.org/demos/ui-components/sliceinhtmltable">demo</a></td></tr><tr><td><a href="https://beta.tinybase.org/api/ui-react-dom/functions/relationships-components/relationshipinhtmltable/"><code>RelationshipInHtmlTable</code></a></td><td>Renders the local and remote <a href="https://beta.tinybase.org/api/store/type-aliases/store/tables/"><code>Tables</code></a> of a relationship</td><td><a href="https://beta.tinybase.org/demos/ui-components/relationshipinhtmltable">demo</a></td></tr><tr><td><a href="https://beta.tinybase.org/api/ui-react-dom/functions/queries-components/resulttableinhtmltable/"><code>ResultTableInHtmlTable</code></a></td><td>Renders a <a href="https://beta.tinybase.org/api/queries/type-aliases/result/resulttable/"><code>ResultTable</code></a>.</td><td><a href="https://beta.tinybase.org/demos/ui-components/resulttableinhtmltable">demo</a></td></tr><tr><td><a href="https://beta.tinybase.org/api/ui-react-dom/functions/queries-components/resultsortedtableinhtmltable/"><code>ResultSortedTableInHtmlTable</code></a></td><td>Renders a sorted <a href="https://beta.tinybase.org/api/queries/type-aliases/result/resulttable/"><code>ResultTable</code></a>, with optional interactivity.</td><td><a href="https://beta.tinybase.org/demos/ui-components/resultsortedtableinhtmltable">demo</a></td></tr><tr><td><a href="https://beta.tinybase.org/api/ui-react-dom/functions/store-components/editablecellview/"><code>EditableCellView</code></a></td><td>Renders a <a href="https://beta.tinybase.org/api/store/type-aliases/store/cell/"><code>Cell</code></a> and lets you change its type and value.</td><td><a href="https://beta.tinybase.org/demos/ui-components/editablecellview">demo</a></td></tr><tr><td><a href="https://beta.tinybase.org/api/ui-react-dom/functions/store-components/editablevalueview/"><code>EditableValueView</code></a></td><td>Renders a <a href="https://beta.tinybase.org/api/store/type-aliases/store/value/"><code>Value</code></a> and lets you change its type and value.</td><td><a href="https://beta.tinybase.org/demos/ui-components/editablevalueview">demo</a></td></tr></tbody></table></div><p>These pre-built components are showcased in the <a href="https://beta.tinybase.org/demos/ui-components/">UI Components</a> demos. Using them should be very familiar if you have used the more abstract <a href="https://beta.tinybase.org/api/ui-react/"><code>ui-react</code></a> module:</p>
|
|
244
244
|
|
|
245
245
|
```jsx
|
|
246
246
|
import React from 'react';
|
|
@@ -437,7 +437,7 @@ store.setValues({employees: true}); // TypeScript error
|
|
|
437
437
|
store.setValues({employees: 3, website: 'pets.com'}); // TypeScript error
|
|
438
438
|
```
|
|
439
439
|
|
|
440
|
-
<p>The schema-based typing is used comprehensively throughout every module - from the core <a href="https://beta.tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> interface all the way through to the <a href="https://beta.tinybase.org/api/ui-react/"><code>ui-react</code></a> module. See the new <a href="https://beta.tinybase.org/guides/schemas/schema-based-typing/">Schema-Based Typing</a> guide for instructions on how to use it.</p><p>This now means that there are <em>three</em> progressive ways to use TypeScript with TinyBase:</p><ul><li>Basic Type Support (since v1.0)</li><li>Schema-based Typing (since v3.1)</li><li>ORM-like type definitions (since v2.2)</li></ul><p>These are each described in the new <a href="https://beta.tinybase.org/guides/the-basics/tinybase-and-typescript/">TinyBase And TypeScript</a> guide.</p><p>Also in v3.1, the ORM-like type definition generation in the
|
|
440
|
+
<p>The schema-based typing is used comprehensively throughout every module - from the core <a href="https://beta.tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> interface all the way through to the <a href="https://beta.tinybase.org/api/ui-react/"><code>ui-react</code></a> module. See the new <a href="https://beta.tinybase.org/guides/schemas/schema-based-typing/">Schema-Based Typing</a> guide for instructions on how to use it.</p><p>This now means that there are <em>three</em> progressive ways to use TypeScript with TinyBase:</p><ul><li>Basic Type Support (since v1.0)</li><li>Schema-based Typing (since v3.1)</li><li>ORM-like type definitions (since v2.2)</li></ul><p>These are each described in the new <a href="https://beta.tinybase.org/guides/the-basics/tinybase-and-typescript/">TinyBase And TypeScript</a> guide.</p><p>Also in v3.1, the ORM-like type definition generation in the tools module has been extended to emit <a href="https://beta.tinybase.org/api/ui-react/"><code>ui-react</code></a> module definitions.</p><p>Finally, v3.1.1 adds a <code>reuseRowIds</code> parameter to the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/setter/addrow/"><code>addRow</code></a> method and the <a href="https://beta.tinybase.org/api/ui-react/functions/store-hooks/useaddrowcallback/"><code>useAddRowCallback</code></a> hook. It defaults to <code>true</code>, for backwards compatibility, but if set to <code>false</code>, new <a href="https://beta.tinybase.org/api/store/type-aliases/store/row/"><code>Row</code></a> <a href="https://beta.tinybase.org/api/common/type-aliases/identity/ids/"><code>Ids</code></a> will not be reused unless the whole <a href="https://beta.tinybase.org/api/store/type-aliases/store/table/"><code>Table</code></a> is deleted.</p><hr><h1 id="v3-0">v3.0</h1><p>This major new release adds key/value store functionality to TinyBase. Alongside existing tabular data, it allows you to get, set, and listen to, individual <a href="https://beta.tinybase.org/api/store/type-aliases/store/value/"><code>Value</code></a> items, each with a unique <a href="https://beta.tinybase.org/api/common/type-aliases/identity/id/"><code>Id</code></a>.</p>
|
|
441
441
|
|
|
442
442
|
```js
|
|
443
443
|
store.setValues({employees: 3, open: true});
|
|
@@ -457,9 +457,9 @@ store.setValue('employees', 4);
|
|
|
457
457
|
store.delListener(listenerId).delValues();
|
|
458
458
|
```
|
|
459
459
|
|
|
460
|
-
<p><a href="https://beta.tinybase.org/guides/">Guides</a> and documentation have been fully updated, and certain demos - such as the <a href="https://beta.tinybase.org/demos/todo-app/todo-app-v2-indexes/">Todo App v2 (indexes)</a> demo, and the <a href="https://beta.tinybase.org/demos/countries/">Countries</a> demo - have been updated to use this new functionality.</p><p>If you use the optional <a href="https://beta.tinybase.org/api/ui-react/"><code>ui-react</code></a> module with TinyBase, v3.0 now uses and expects React v18.</p><p>In terms of core API changes in v3.0, there are some minor breaking changes (see below), but the majority of the alterations are additions.</p><p>The <a href="https://beta.tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> object gains the following:</p><ul><li>The <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/setter/setvalues/"><code>setValues</code></a> method, <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/setter/setpartialvalues/"><code>setPartialValues</code></a> method, and <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/setter/setvalue/"><code>setValue</code></a> method, to set keyed value data into the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a>.</li><li>The <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/getvalues/"><code>getValues</code></a> method, <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/getvalueids/"><code>getValueIds</code></a> method, and <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/getvalue/"><code>getValue</code></a> method, to get keyed value data out of the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a>.</li><li>The <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/deleter/delvalues/"><code>delValues</code></a> method and <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/deleter/delvalue/"><code>delValue</code></a> method for removing keyed value data.</li><li>The <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/listener/addvalueslistener/"><code>addValuesListener</code></a> method, <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/listener/addvalueidslistener/"><code>addValueIdsListener</code></a> method, addValueListener method, and <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/listener/addinvalidvaluelistener/"><code>addInvalidValueListener</code></a> method, for listening to changes to keyed value data.</li><li>The <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/hasvalues/"><code>hasValues</code></a> method, <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/hasvalue/"><code>hasValue</code></a> method, and <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/iterator/foreachvalue/"><code>forEachValue</code></a> method, for existence and enumeration purposes.</li><li>The <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/gettablesjson/"><code>getTablesJson</code></a> method, <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/getvaluesjson/"><code>getValuesJson</code></a> method, <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/setter/settablesjson/"><code>setTablesJson</code></a> method, and <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/setter/setvaluesjson/"><code>setValuesJson</code></a> method, for reading and writing tabular and keyed value data to and from a JSON string. Also see below.</li><li>The <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/gettablesschemajson/"><code>getTablesSchemaJson</code></a> method, <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/getvaluesschemajson/"><code>getValuesSchemaJson</code></a> method, setTablesSchema method, <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/setter/setvaluesschema/"><code>setValuesSchema</code></a> method, <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/deleter/deltablesschema/"><code>delTablesSchema</code></a> method, and delValuesSchema method, for reading and writing tabular and keyed value schemas for the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a>. Also see below.</li></ul><p>The following types have been added to the <a href="https://beta.tinybase.org/api/store/"><code>store</code></a> module:</p><ul><li><a href="https://beta.tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a>, <a href="https://beta.tinybase.org/api/store/type-aliases/store/value/"><code>Value</code></a>, and <a href="https://beta.tinybase.org/api/store/type-aliases/store/valueorundefined/"><code>ValueOrUndefined</code></a>, representing keyed value data in a <a href="https://beta.tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a>.</li><li><a href="https://beta.tinybase.org/api/store/type-aliases/listener/valuelistener/"><code>ValueListener</code></a> and <a href="https://beta.tinybase.org/api/store/type-aliases/listener/invalidvaluelistener/"><code>InvalidValueListener</code></a>, to describe functions used to listen to (valid or invalid) changes to a <a href="https://beta.tinybase.org/api/store/type-aliases/store/value/"><code>Value</code></a>.</li><li><a href="https://beta.tinybase.org/api/store/type-aliases/schema/valuesschema/"><code>ValuesSchema</code></a> and <a href="https://beta.tinybase.org/api/store/type-aliases/schema/valueschema/"><code>ValueSchema</code></a>, to describe the keyed <a href="https://beta.tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a> that can be set in a <a href="https://beta.tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> and their types.</li><li><a href="https://beta.tinybase.org/api/store/type-aliases/callback/valuecallback/"><code>ValueCallback</code></a>, <a href="https://beta.tinybase.org/api/store/type-aliases/callback/mapvalue/"><code>MapValue</code></a>, <a href="https://beta.tinybase.org/api/store/type-aliases/transaction/changedvalues/"><code>ChangedValues</code></a>, and <a href="https://beta.tinybase.org/api/store/type-aliases/transaction/invalidvalues/"><code>InvalidValues</code></a>, which also correspond to their '<a href="https://beta.tinybase.org/api/store/type-aliases/store/cell/"><code>Cell</code></a>' equivalents.</li></ul><p>Additionally:</p><ul><li>The persisters' <a href="https://beta.tinybase.org/api/persisters/interfaces/persister/persister/methods/load/load/"><code>load</code></a> method and <a href="https://beta.tinybase.org/api/persisters/interfaces/persister/persister/methods/load/startautoload/"><code>startAutoLoad</code></a> method take an optional <code>initialValues</code> parameter for setting <a href="https://beta.tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a> when a persisted <a href="https://beta.tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> is bootstrapped.</li><li>The <a href="https://beta.tinybase.org/api/checkpoints/interfaces/checkpoints/checkpoints/"><code>Checkpoints</code></a> module will undo and redo changes to keyed values in the same way they do for tabular data.</li><li>The <a href="https://beta.tinybase.org/api/tools/"><code>tools</code></a> module provides a <a href="https://beta.tinybase.org/api/tools/interfaces/tools/tools/methods/modelling/getstorevaluesschema/"><code>getStoreValuesSchema</code></a> method for inferring value-based schemas. The <a href="https://beta.tinybase.org/api/tools/interfaces/tools/tools/methods/modelling/getstoreapi/"><code>getStoreApi</code></a> method and <a href="https://beta.tinybase.org/api/tools/interfaces/tools/tools/methods/modelling/getprettystoreapi/"><code>getPrettyStoreApi</code></a> method now also provides an ORM-like code-generated API for schematized key values.</li></ul><p>All attempts have been made to provide backwards compatibility and/or easy upgrade paths.</p><p>In previous versions, <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/getjson/"><code>getJson</code></a> method would get a JSON serialization of the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a>'s tabular data. That functionality is now provided by the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/gettablesjson/"><code>getTablesJson</code></a> method, and the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/getjson/"><code>getJson</code></a> method instead now returns a two-part array containing the tabular data and the keyed value data.</p><p>Similarly, the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/getschemajson/"><code>getSchemaJson</code></a> method used to return the tabular schema, now provided by the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/gettablesschemajson/"><code>getTablesSchemaJson</code></a> method. The <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/getschemajson/"><code>getSchemaJson</code></a> method instead now returns a two-part array of tabular schema and the keyed value schema.</p><p>The <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/setter/setjson/"><code>setJson</code></a> method used to take a serialization of just the tabular data object. That's now provided by the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/setter/settablesjson/"><code>setTablesJson</code></a> method, and the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/setter/setjson/"><code>setJson</code></a> method instead expects a two-part array containing the tabular data and the keyed value data (as emitted by the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/getjson/"><code>getJson</code></a> method). However, for backwards compatibility, if the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/setter/setjson/"><code>setJson</code></a> method is passed an object, it <em>will</em> set the tabular data, as it did prior to v3.0.</p><p>Along similar lines, the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/setter/setschema/"><code>setSchema</code></a> method's previous behavior is now provided by the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/setter/settablesschema/"><code>setTablesSchema</code></a> method. The <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/setter/setschema/"><code>setSchema</code></a> method now takes two arguments, the second of which is optional, also aiding backward compatibility. The <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/deleter/delschema/"><code>delSchema</code></a> method removes both types of schema.</p><hr><h1 id="v2-2">v2.2</h1><p>This release includes a new <a href="https://beta.tinybase.org/api/tools/"><code>tools</code></a> module. These tools are not intended for production use, but are instead to be used as part of your engineering workflow to perform tasks like generating APIs from schemas, or schemas from data. For example:</p>
|
|
460
|
+
<p><a href="https://beta.tinybase.org/guides/">Guides</a> and documentation have been fully updated, and certain demos - such as the <a href="https://beta.tinybase.org/demos/todo-app/todo-app-v2-indexes/">Todo App v2 (indexes)</a> demo, and the <a href="https://beta.tinybase.org/demos/countries/">Countries</a> demo - have been updated to use this new functionality.</p><p>If you use the optional <a href="https://beta.tinybase.org/api/ui-react/"><code>ui-react</code></a> module with TinyBase, v3.0 now uses and expects React v18.</p><p>In terms of core API changes in v3.0, there are some minor breaking changes (see below), but the majority of the alterations are additions.</p><p>The <a href="https://beta.tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> object gains the following:</p><ul><li>The <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/setter/setvalues/"><code>setValues</code></a> method, <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/setter/setpartialvalues/"><code>setPartialValues</code></a> method, and <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/setter/setvalue/"><code>setValue</code></a> method, to set keyed value data into the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a>.</li><li>The <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/getvalues/"><code>getValues</code></a> method, <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/getvalueids/"><code>getValueIds</code></a> method, and <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/getvalue/"><code>getValue</code></a> method, to get keyed value data out of the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a>.</li><li>The <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/deleter/delvalues/"><code>delValues</code></a> method and <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/deleter/delvalue/"><code>delValue</code></a> method for removing keyed value data.</li><li>The <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/listener/addvalueslistener/"><code>addValuesListener</code></a> method, <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/listener/addvalueidslistener/"><code>addValueIdsListener</code></a> method, addValueListener method, and <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/listener/addinvalidvaluelistener/"><code>addInvalidValueListener</code></a> method, for listening to changes to keyed value data.</li><li>The <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/hasvalues/"><code>hasValues</code></a> method, <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/hasvalue/"><code>hasValue</code></a> method, and <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/iterator/foreachvalue/"><code>forEachValue</code></a> method, for existence and enumeration purposes.</li><li>The <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/gettablesjson/"><code>getTablesJson</code></a> method, <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/getvaluesjson/"><code>getValuesJson</code></a> method, <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/setter/settablesjson/"><code>setTablesJson</code></a> method, and <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/setter/setvaluesjson/"><code>setValuesJson</code></a> method, for reading and writing tabular and keyed value data to and from a JSON string. Also see below.</li><li>The <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/gettablesschemajson/"><code>getTablesSchemaJson</code></a> method, <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/getvaluesschemajson/"><code>getValuesSchemaJson</code></a> method, setTablesSchema method, <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/setter/setvaluesschema/"><code>setValuesSchema</code></a> method, <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/deleter/deltablesschema/"><code>delTablesSchema</code></a> method, and delValuesSchema method, for reading and writing tabular and keyed value schemas for the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a>. Also see below.</li></ul><p>The following types have been added to the <a href="https://beta.tinybase.org/api/store/"><code>store</code></a> module:</p><ul><li><a href="https://beta.tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a>, <a href="https://beta.tinybase.org/api/store/type-aliases/store/value/"><code>Value</code></a>, and <a href="https://beta.tinybase.org/api/store/type-aliases/store/valueorundefined/"><code>ValueOrUndefined</code></a>, representing keyed value data in a <a href="https://beta.tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a>.</li><li><a href="https://beta.tinybase.org/api/store/type-aliases/listener/valuelistener/"><code>ValueListener</code></a> and <a href="https://beta.tinybase.org/api/store/type-aliases/listener/invalidvaluelistener/"><code>InvalidValueListener</code></a>, to describe functions used to listen to (valid or invalid) changes to a <a href="https://beta.tinybase.org/api/store/type-aliases/store/value/"><code>Value</code></a>.</li><li><a href="https://beta.tinybase.org/api/store/type-aliases/schema/valuesschema/"><code>ValuesSchema</code></a> and <a href="https://beta.tinybase.org/api/store/type-aliases/schema/valueschema/"><code>ValueSchema</code></a>, to describe the keyed <a href="https://beta.tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a> that can be set in a <a href="https://beta.tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> and their types.</li><li><a href="https://beta.tinybase.org/api/store/type-aliases/callback/valuecallback/"><code>ValueCallback</code></a>, <a href="https://beta.tinybase.org/api/store/type-aliases/callback/mapvalue/"><code>MapValue</code></a>, <a href="https://beta.tinybase.org/api/store/type-aliases/transaction/changedvalues/"><code>ChangedValues</code></a>, and <a href="https://beta.tinybase.org/api/store/type-aliases/transaction/invalidvalues/"><code>InvalidValues</code></a>, which also correspond to their '<a href="https://beta.tinybase.org/api/store/type-aliases/store/cell/"><code>Cell</code></a>' equivalents.</li></ul><p>Additionally:</p><ul><li>The persisters' <a href="https://beta.tinybase.org/api/persisters/interfaces/persister/persister/methods/load/load/"><code>load</code></a> method and <a href="https://beta.tinybase.org/api/persisters/interfaces/persister/persister/methods/load/startautoload/"><code>startAutoLoad</code></a> method take an optional <code>initialValues</code> parameter for setting <a href="https://beta.tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a> when a persisted <a href="https://beta.tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> is bootstrapped.</li><li>The <a href="https://beta.tinybase.org/api/checkpoints/interfaces/checkpoints/checkpoints/"><code>Checkpoints</code></a> module will undo and redo changes to keyed values in the same way they do for tabular data.</li><li>The tools module provides a getStoreValuesSchema method for inferring value-based schemas. The getStoreApi method and getPrettyStoreApi method now also provides an ORM-like code-generated API for schematized key values.</li></ul><p>All attempts have been made to provide backwards compatibility and/or easy upgrade paths.</p><p>In previous versions, <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/getjson/"><code>getJson</code></a> method would get a JSON serialization of the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a>'s tabular data. That functionality is now provided by the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/gettablesjson/"><code>getTablesJson</code></a> method, and the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/getjson/"><code>getJson</code></a> method instead now returns a two-part array containing the tabular data and the keyed value data.</p><p>Similarly, the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/getschemajson/"><code>getSchemaJson</code></a> method used to return the tabular schema, now provided by the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/gettablesschemajson/"><code>getTablesSchemaJson</code></a> method. The <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/getschemajson/"><code>getSchemaJson</code></a> method instead now returns a two-part array of tabular schema and the keyed value schema.</p><p>The <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/setter/setjson/"><code>setJson</code></a> method used to take a serialization of just the tabular data object. That's now provided by the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/setter/settablesjson/"><code>setTablesJson</code></a> method, and the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/setter/setjson/"><code>setJson</code></a> method instead expects a two-part array containing the tabular data and the keyed value data (as emitted by the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/getter/getjson/"><code>getJson</code></a> method). However, for backwards compatibility, if the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/setter/setjson/"><code>setJson</code></a> method is passed an object, it <em>will</em> set the tabular data, as it did prior to v3.0.</p><p>Along similar lines, the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/setter/setschema/"><code>setSchema</code></a> method's previous behavior is now provided by the <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/setter/settablesschema/"><code>setTablesSchema</code></a> method. The <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/setter/setschema/"><code>setSchema</code></a> method now takes two arguments, the second of which is optional, also aiding backward compatibility. The <a href="https://beta.tinybase.org/api/store/interfaces/store/store/methods/deleter/delschema/"><code>delSchema</code></a> method removes both types of schema.</p><hr><h1 id="v2-2">v2.2</h1><p>Note: The tools module has been removed in TinyBase v6.0.</p><p>This release includes a new tools module. These tools are not intended for production use, but are instead to be used as part of your engineering workflow to perform tasks like generating APIs from schemas, or schemas from data. For example:</p>
|
|
461
461
|
|
|
462
|
-
```js
|
|
462
|
+
```js yolo
|
|
463
463
|
import {createTools} from 'tinybase/tools';
|
|
464
464
|
|
|
465
465
|
store.setTable('pets', {
|
|
@@ -497,7 +497,7 @@ npx tinybase getStoreApi schema.json shop api
|
|
|
497
497
|
Implementation: [...]/api/shop.ts
|
|
498
498
|
```
|
|
499
499
|
|
|
500
|
-
<p>Finally, the
|
|
500
|
+
<p>Finally, the tools module also provides ways to track the overall size and structure of a <a href="https://beta.tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> for use while debugging.</p><hr><h1 id="v2-1">v2.1</h1><p>This release allows you to create indexes where a single <a href="https://beta.tinybase.org/api/store/type-aliases/store/row/"><code>Row</code></a> <a href="https://beta.tinybase.org/api/common/type-aliases/identity/id/"><code>Id</code></a> can exist in multiple slices. You can utilize this to build simple keyword searches, for example.</p><p>Simply provide a custom getSliceIdOrIds function in the <a href="https://beta.tinybase.org/api/indexes/interfaces/indexes/indexes/methods/configuration/setindexdefinition/"><code>setIndexDefinition</code></a> method that returns an array of <a href="https://beta.tinybase.org/api/indexes/type-aliases/concept/slice/"><code>Slice</code></a> <a href="https://beta.tinybase.org/api/common/type-aliases/identity/ids/"><code>Ids</code></a>, rather than a single <a href="https://beta.tinybase.org/api/common/type-aliases/identity/id/"><code>Id</code></a>:</p>
|
|
501
501
|
|
|
502
502
|
```js
|
|
503
503
|
import {createIndexes} from 'tinybase';
|
package/store/index.js
CHANGED
|
@@ -47,6 +47,33 @@ const arrayReduce = (array, cb, initial) => array.reduce(cb, initial);
|
|
|
47
47
|
const arrayPush = (array, ...values) => array.push(...values);
|
|
48
48
|
const arrayShift = (array) => array.shift();
|
|
49
49
|
|
|
50
|
+
const getCellOrValueType = (cellOrValue) => {
|
|
51
|
+
const type = getTypeOf(cellOrValue);
|
|
52
|
+
return isTypeStringOrBoolean(type) ||
|
|
53
|
+
(type == NUMBER && isFiniteNumber(cellOrValue))
|
|
54
|
+
? type
|
|
55
|
+
: void 0;
|
|
56
|
+
};
|
|
57
|
+
const setOrDelCell = (store, tableId, rowId, cellId, cell) =>
|
|
58
|
+
isUndefined(cell)
|
|
59
|
+
? store.delCell(tableId, rowId, cellId, true)
|
|
60
|
+
: store.setCell(tableId, rowId, cellId, cell);
|
|
61
|
+
const setOrDelValue = (store, valueId, value) =>
|
|
62
|
+
isUndefined(value) ? store.delValue(valueId) : store.setValue(valueId, value);
|
|
63
|
+
|
|
64
|
+
const collSizeN = (collSizer) => (coll) =>
|
|
65
|
+
arrayReduce(collValues(coll), (total, coll2) => total + collSizer(coll2), 0);
|
|
66
|
+
const collSize = (coll) => coll?.size ?? 0;
|
|
67
|
+
const collSize2 = collSizeN(collSize);
|
|
68
|
+
const collSize3 = collSizeN(collSize2);
|
|
69
|
+
const collSize4 = collSizeN(collSize3);
|
|
70
|
+
const collHas = (coll, keyOrValue) => coll?.has(keyOrValue) ?? false;
|
|
71
|
+
const collIsEmpty = (coll) => isUndefined(coll) || collSize(coll) == 0;
|
|
72
|
+
const collValues = (coll) => [...(coll?.values() ?? [])];
|
|
73
|
+
const collClear = (coll) => coll.clear();
|
|
74
|
+
const collForEach = (coll, cb) => coll?.forEach(cb);
|
|
75
|
+
const collDel = (coll, keyOrValue) => coll?.delete(keyOrValue);
|
|
76
|
+
|
|
50
77
|
const object = Object;
|
|
51
78
|
const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
|
|
52
79
|
const objEntries = object.entries;
|
|
@@ -96,19 +123,6 @@ const objValidate = (obj, validateChild, onInvalidObj, emptyIsValid = 0) => {
|
|
|
96
123
|
return emptyIsValid ? true : !objIsEmpty(obj);
|
|
97
124
|
};
|
|
98
125
|
|
|
99
|
-
const collSizeN = (collSizer) => (coll) =>
|
|
100
|
-
arrayReduce(collValues(coll), (total, coll2) => total + collSizer(coll2), 0);
|
|
101
|
-
const collSize = (coll) => coll?.size ?? 0;
|
|
102
|
-
const collSize2 = collSizeN(collSize);
|
|
103
|
-
const collSize3 = collSizeN(collSize2);
|
|
104
|
-
const collSize4 = collSizeN(collSize3);
|
|
105
|
-
const collHas = (coll, keyOrValue) => coll?.has(keyOrValue) ?? false;
|
|
106
|
-
const collIsEmpty = (coll) => isUndefined(coll) || collSize(coll) == 0;
|
|
107
|
-
const collValues = (coll) => [...(coll?.values() ?? [])];
|
|
108
|
-
const collClear = (coll) => coll.clear();
|
|
109
|
-
const collForEach = (coll, cb) => coll?.forEach(cb);
|
|
110
|
-
const collDel = (coll, keyOrValue) => coll?.delete(keyOrValue);
|
|
111
|
-
|
|
112
126
|
const mapNew = (entries) => new Map(entries);
|
|
113
127
|
const mapKeys = (map) => [...(map?.keys() ?? [])];
|
|
114
128
|
const mapGet = (map, key) => map?.get(key);
|
|
@@ -186,13 +200,15 @@ const visitTree = (node, path, ensureLeaf, pruneLeaf, p = 0) =>
|
|
|
186
200
|
},
|
|
187
201
|
);
|
|
188
202
|
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
203
|
+
const defaultSorter = (sortKey1, sortKey2) =>
|
|
204
|
+
(sortKey1 ?? 0) < (sortKey2 ?? 0) ? -1 : 1;
|
|
205
|
+
|
|
206
|
+
const jsonString = JSON.stringify;
|
|
207
|
+
const jsonParse = JSON.parse;
|
|
208
|
+
const jsonStringWithMap = (obj) =>
|
|
209
|
+
jsonString(obj, (_key, value) =>
|
|
210
|
+
isInstanceOf(value, Map) ? object.fromEntries([...value]) : value,
|
|
194
211
|
);
|
|
195
|
-
const setAdd = (set, value) => set?.add(value);
|
|
196
212
|
|
|
197
213
|
const INTEGER = /^\d+$/;
|
|
198
214
|
const getPoolFunctions = () => {
|
|
@@ -208,6 +224,14 @@ const getPoolFunctions = () => {
|
|
|
208
224
|
];
|
|
209
225
|
};
|
|
210
226
|
|
|
227
|
+
const setNew = (entryOrEntries) =>
|
|
228
|
+
new Set(
|
|
229
|
+
isArray(entryOrEntries) || isUndefined(entryOrEntries)
|
|
230
|
+
? entryOrEntries
|
|
231
|
+
: [entryOrEntries],
|
|
232
|
+
);
|
|
233
|
+
const setAdd = (set, value) => set?.add(value);
|
|
234
|
+
|
|
211
235
|
const getWildcardedLeaves = (deepIdSet, path = [EMPTY_STRING]) => {
|
|
212
236
|
const leaves = [];
|
|
213
237
|
const deep = (node, p) =>
|
|
@@ -286,30 +310,6 @@ const pairNewMap = () => [mapNew(), mapNew()];
|
|
|
286
310
|
const pairClone = (array) => [...array];
|
|
287
311
|
const pairIsEqual = ([entry1, entry2]) => entry1 === entry2;
|
|
288
312
|
|
|
289
|
-
const getCellOrValueType = (cellOrValue) => {
|
|
290
|
-
const type = getTypeOf(cellOrValue);
|
|
291
|
-
return isTypeStringOrBoolean(type) ||
|
|
292
|
-
(type == NUMBER && isFiniteNumber(cellOrValue))
|
|
293
|
-
? type
|
|
294
|
-
: void 0;
|
|
295
|
-
};
|
|
296
|
-
const setOrDelCell = (store, tableId, rowId, cellId, cell) =>
|
|
297
|
-
isUndefined(cell)
|
|
298
|
-
? store.delCell(tableId, rowId, cellId, true)
|
|
299
|
-
: store.setCell(tableId, rowId, cellId, cell);
|
|
300
|
-
const setOrDelValue = (store, valueId, value) =>
|
|
301
|
-
isUndefined(value) ? store.delValue(valueId) : store.setValue(valueId, value);
|
|
302
|
-
|
|
303
|
-
const jsonString = JSON.stringify;
|
|
304
|
-
const jsonParse = JSON.parse;
|
|
305
|
-
const jsonStringWithMap = (obj) =>
|
|
306
|
-
jsonString(obj, (_key, value) =>
|
|
307
|
-
isInstanceOf(value, Map) ? object.fromEntries([...value]) : value,
|
|
308
|
-
);
|
|
309
|
-
|
|
310
|
-
const defaultSorter = (sortKey1, sortKey2) =>
|
|
311
|
-
(sortKey1 ?? 0) < (sortKey2 ?? 0) ? -1 : 1;
|
|
312
|
-
|
|
313
313
|
const idsChanged = (changedIds, id2, addedOrRemoved) =>
|
|
314
314
|
mapSet(
|
|
315
315
|
changedIds,
|
|
@@ -47,6 +47,33 @@ const arrayReduce = (array, cb, initial) => array.reduce(cb, initial);
|
|
|
47
47
|
const arrayPush = (array, ...values) => array.push(...values);
|
|
48
48
|
const arrayShift = (array) => array.shift();
|
|
49
49
|
|
|
50
|
+
const getCellOrValueType = (cellOrValue) => {
|
|
51
|
+
const type = getTypeOf(cellOrValue);
|
|
52
|
+
return isTypeStringOrBoolean(type) ||
|
|
53
|
+
(type == NUMBER && isFiniteNumber(cellOrValue))
|
|
54
|
+
? type
|
|
55
|
+
: void 0;
|
|
56
|
+
};
|
|
57
|
+
const setOrDelCell = (store, tableId, rowId, cellId, cell) =>
|
|
58
|
+
isUndefined(cell)
|
|
59
|
+
? store.delCell(tableId, rowId, cellId, true)
|
|
60
|
+
: store.setCell(tableId, rowId, cellId, cell);
|
|
61
|
+
const setOrDelValue = (store, valueId, value) =>
|
|
62
|
+
isUndefined(value) ? store.delValue(valueId) : store.setValue(valueId, value);
|
|
63
|
+
|
|
64
|
+
const collSizeN = (collSizer) => (coll) =>
|
|
65
|
+
arrayReduce(collValues(coll), (total, coll2) => total + collSizer(coll2), 0);
|
|
66
|
+
const collSize = (coll) => coll?.size ?? 0;
|
|
67
|
+
const collSize2 = collSizeN(collSize);
|
|
68
|
+
const collSize3 = collSizeN(collSize2);
|
|
69
|
+
const collSize4 = collSizeN(collSize3);
|
|
70
|
+
const collHas = (coll, keyOrValue) => coll?.has(keyOrValue) ?? false;
|
|
71
|
+
const collIsEmpty = (coll) => isUndefined(coll) || collSize(coll) == 0;
|
|
72
|
+
const collValues = (coll) => [...(coll?.values() ?? [])];
|
|
73
|
+
const collClear = (coll) => coll.clear();
|
|
74
|
+
const collForEach = (coll, cb) => coll?.forEach(cb);
|
|
75
|
+
const collDel = (coll, keyOrValue) => coll?.delete(keyOrValue);
|
|
76
|
+
|
|
50
77
|
const object = Object;
|
|
51
78
|
const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
|
|
52
79
|
const objEntries = object.entries;
|
|
@@ -96,19 +123,6 @@ const objValidate = (obj, validateChild, onInvalidObj, emptyIsValid = 0) => {
|
|
|
96
123
|
return emptyIsValid ? true : !objIsEmpty(obj);
|
|
97
124
|
};
|
|
98
125
|
|
|
99
|
-
const collSizeN = (collSizer) => (coll) =>
|
|
100
|
-
arrayReduce(collValues(coll), (total, coll2) => total + collSizer(coll2), 0);
|
|
101
|
-
const collSize = (coll) => coll?.size ?? 0;
|
|
102
|
-
const collSize2 = collSizeN(collSize);
|
|
103
|
-
const collSize3 = collSizeN(collSize2);
|
|
104
|
-
const collSize4 = collSizeN(collSize3);
|
|
105
|
-
const collHas = (coll, keyOrValue) => coll?.has(keyOrValue) ?? false;
|
|
106
|
-
const collIsEmpty = (coll) => isUndefined(coll) || collSize(coll) == 0;
|
|
107
|
-
const collValues = (coll) => [...(coll?.values() ?? [])];
|
|
108
|
-
const collClear = (coll) => coll.clear();
|
|
109
|
-
const collForEach = (coll, cb) => coll?.forEach(cb);
|
|
110
|
-
const collDel = (coll, keyOrValue) => coll?.delete(keyOrValue);
|
|
111
|
-
|
|
112
126
|
const mapNew = (entries) => new Map(entries);
|
|
113
127
|
const mapKeys = (map) => [...(map?.keys() ?? [])];
|
|
114
128
|
const mapGet = (map, key) => map?.get(key);
|
|
@@ -186,13 +200,15 @@ const visitTree = (node, path, ensureLeaf, pruneLeaf, p = 0) =>
|
|
|
186
200
|
},
|
|
187
201
|
);
|
|
188
202
|
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
203
|
+
const defaultSorter = (sortKey1, sortKey2) =>
|
|
204
|
+
(sortKey1 ?? 0) < (sortKey2 ?? 0) ? -1 : 1;
|
|
205
|
+
|
|
206
|
+
const jsonString = JSON.stringify;
|
|
207
|
+
const jsonParse = JSON.parse;
|
|
208
|
+
const jsonStringWithMap = (obj) =>
|
|
209
|
+
jsonString(obj, (_key, value) =>
|
|
210
|
+
isInstanceOf(value, Map) ? object.fromEntries([...value]) : value,
|
|
194
211
|
);
|
|
195
|
-
const setAdd = (set, value) => set?.add(value);
|
|
196
212
|
|
|
197
213
|
const INTEGER = /^\d+$/;
|
|
198
214
|
const getPoolFunctions = () => {
|
|
@@ -208,6 +224,14 @@ const getPoolFunctions = () => {
|
|
|
208
224
|
];
|
|
209
225
|
};
|
|
210
226
|
|
|
227
|
+
const setNew = (entryOrEntries) =>
|
|
228
|
+
new Set(
|
|
229
|
+
isArray(entryOrEntries) || isUndefined(entryOrEntries)
|
|
230
|
+
? entryOrEntries
|
|
231
|
+
: [entryOrEntries],
|
|
232
|
+
);
|
|
233
|
+
const setAdd = (set, value) => set?.add(value);
|
|
234
|
+
|
|
211
235
|
const getWildcardedLeaves = (deepIdSet, path = [EMPTY_STRING]) => {
|
|
212
236
|
const leaves = [];
|
|
213
237
|
const deep = (node, p) =>
|
|
@@ -286,30 +310,6 @@ const pairNewMap = () => [mapNew(), mapNew()];
|
|
|
286
310
|
const pairClone = (array) => [...array];
|
|
287
311
|
const pairIsEqual = ([entry1, entry2]) => entry1 === entry2;
|
|
288
312
|
|
|
289
|
-
const getCellOrValueType = (cellOrValue) => {
|
|
290
|
-
const type = getTypeOf(cellOrValue);
|
|
291
|
-
return isTypeStringOrBoolean(type) ||
|
|
292
|
-
(type == NUMBER && isFiniteNumber(cellOrValue))
|
|
293
|
-
? type
|
|
294
|
-
: void 0;
|
|
295
|
-
};
|
|
296
|
-
const setOrDelCell = (store, tableId, rowId, cellId, cell) =>
|
|
297
|
-
isUndefined(cell)
|
|
298
|
-
? store.delCell(tableId, rowId, cellId, true)
|
|
299
|
-
: store.setCell(tableId, rowId, cellId, cell);
|
|
300
|
-
const setOrDelValue = (store, valueId, value) =>
|
|
301
|
-
isUndefined(value) ? store.delValue(valueId) : store.setValue(valueId, value);
|
|
302
|
-
|
|
303
|
-
const jsonString = JSON.stringify;
|
|
304
|
-
const jsonParse = JSON.parse;
|
|
305
|
-
const jsonStringWithMap = (obj) =>
|
|
306
|
-
jsonString(obj, (_key, value) =>
|
|
307
|
-
isInstanceOf(value, Map) ? object.fromEntries([...value]) : value,
|
|
308
|
-
);
|
|
309
|
-
|
|
310
|
-
const defaultSorter = (sortKey1, sortKey2) =>
|
|
311
|
-
(sortKey1 ?? 0) < (sortKey2 ?? 0) ? -1 : 1;
|
|
312
|
-
|
|
313
313
|
const idsChanged = (changedIds, id2, addedOrRemoved) =>
|
|
314
314
|
mapSet(
|
|
315
315
|
changedIds,
|
package/synchronizers/index.js
CHANGED
|
@@ -27,6 +27,12 @@ const arrayClear = (array, to) => array.splice(0, to);
|
|
|
27
27
|
const arrayPush = (array, ...values) => array.push(...values);
|
|
28
28
|
const arrayShift = (array) => array.shift();
|
|
29
29
|
|
|
30
|
+
const collSize = (coll) => coll?.size ?? 0;
|
|
31
|
+
const collHas = (coll, keyOrValue) => coll?.has(keyOrValue) ?? false;
|
|
32
|
+
const collIsEmpty = (coll) => isUndefined(coll) || collSize(coll) == 0;
|
|
33
|
+
const collForEach = (coll, cb) => coll?.forEach(cb);
|
|
34
|
+
const collDel = (coll, keyOrValue) => coll?.delete(keyOrValue);
|
|
35
|
+
|
|
30
36
|
const object = Object;
|
|
31
37
|
const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
|
|
32
38
|
const objEntries = object.entries;
|
|
@@ -56,12 +62,6 @@ const objEnsure = (obj, id, getDefaultValue) => {
|
|
|
56
62
|
return obj[id];
|
|
57
63
|
};
|
|
58
64
|
|
|
59
|
-
const collSize = (coll) => coll?.size ?? 0;
|
|
60
|
-
const collHas = (coll, keyOrValue) => coll?.has(keyOrValue) ?? false;
|
|
61
|
-
const collIsEmpty = (coll) => isUndefined(coll) || collSize(coll) == 0;
|
|
62
|
-
const collForEach = (coll, cb) => coll?.forEach(cb);
|
|
63
|
-
const collDel = (coll, keyOrValue) => coll?.delete(keyOrValue);
|
|
64
|
-
|
|
65
65
|
const mapNew = (entries) => new Map(entries);
|
|
66
66
|
const mapGet = (map, key) => map?.get(key);
|
|
67
67
|
const mapSet = (map, key, value) =>
|
|
@@ -96,20 +96,29 @@ const visitTree = (node, path, ensureLeaf, pruneLeaf, p = 0) =>
|
|
|
96
96
|
},
|
|
97
97
|
);
|
|
98
98
|
|
|
99
|
+
const MASK6 = 63;
|
|
100
|
+
const ENCODE = /* @__PURE__ */ strSplit(
|
|
101
|
+
'-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz',
|
|
102
|
+
);
|
|
103
|
+
const encode = (num) => ENCODE[num & MASK6];
|
|
104
|
+
|
|
105
|
+
const getRandomValues = GLOBAL.crypto
|
|
106
|
+
? (array) => GLOBAL.crypto.getRandomValues(array)
|
|
107
|
+
: /* istanbul ignore next */
|
|
108
|
+
(array) => arrayMap(array, () => mathFloor(math.random() * 256));
|
|
109
|
+
const getUniqueId = (length = 16) =>
|
|
110
|
+
arrayReduce(
|
|
111
|
+
getRandomValues(new Uint8Array(length)),
|
|
112
|
+
(uniqueId, number) => uniqueId + encode(number),
|
|
113
|
+
'',
|
|
114
|
+
);
|
|
115
|
+
|
|
99
116
|
const stampNew = (value, time) => (time ? [value, time] : [value]);
|
|
100
117
|
const getLatestTime = (time1, time2) =>
|
|
101
118
|
/* istanbul ignore next */
|
|
102
119
|
((time1 ?? '') > (time2 ?? '') ? time1 : time2) ?? '';
|
|
103
120
|
const stampNewObj = (time = EMPTY_STRING) => stampNew(objNew(), time);
|
|
104
121
|
|
|
105
|
-
const setNew = (entryOrEntries) =>
|
|
106
|
-
new Set(
|
|
107
|
-
isArray(entryOrEntries) || isUndefined(entryOrEntries)
|
|
108
|
-
? entryOrEntries
|
|
109
|
-
: [entryOrEntries],
|
|
110
|
-
);
|
|
111
|
-
const setAdd = (set, value) => set?.add(value);
|
|
112
|
-
|
|
113
122
|
const INTEGER = /^\d+$/;
|
|
114
123
|
const getPoolFunctions = () => {
|
|
115
124
|
const pool = [];
|
|
@@ -124,6 +133,14 @@ const getPoolFunctions = () => {
|
|
|
124
133
|
];
|
|
125
134
|
};
|
|
126
135
|
|
|
136
|
+
const setNew = (entryOrEntries) =>
|
|
137
|
+
new Set(
|
|
138
|
+
isArray(entryOrEntries) || isUndefined(entryOrEntries)
|
|
139
|
+
? entryOrEntries
|
|
140
|
+
: [entryOrEntries],
|
|
141
|
+
);
|
|
142
|
+
const setAdd = (set, value) => set?.add(value);
|
|
143
|
+
|
|
127
144
|
const getWildcardedLeaves = (deepIdSet, path = [EMPTY_STRING]) => {
|
|
128
145
|
const leaves = [];
|
|
129
146
|
const deep = (node, p) =>
|
|
@@ -417,23 +434,6 @@ const createCustomPersister = (
|
|
|
417
434
|
return objFreeze(persister);
|
|
418
435
|
};
|
|
419
436
|
|
|
420
|
-
const MASK6 = 63;
|
|
421
|
-
const ENCODE = /* @__PURE__ */ strSplit(
|
|
422
|
-
'-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz',
|
|
423
|
-
);
|
|
424
|
-
const encode = (num) => ENCODE[num & MASK6];
|
|
425
|
-
|
|
426
|
-
const getRandomValues = GLOBAL.crypto
|
|
427
|
-
? (array) => GLOBAL.crypto.getRandomValues(array)
|
|
428
|
-
: /* istanbul ignore next */
|
|
429
|
-
(array) => arrayMap(array, () => mathFloor(math.random() * 256));
|
|
430
|
-
const getUniqueId = (length = 16) =>
|
|
431
|
-
arrayReduce(
|
|
432
|
-
getRandomValues(new Uint8Array(length)),
|
|
433
|
-
(uniqueId, number) => uniqueId + encode(number),
|
|
434
|
-
'',
|
|
435
|
-
);
|
|
436
|
-
|
|
437
437
|
const Message = {
|
|
438
438
|
Response: 0 /* Response */,
|
|
439
439
|
GetContentHashes: 1 /* GetContentHashes */,
|