tinybase 5.0.0-beta.1 → 5.0.0-beta.11
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/lib/checkpoints.js +1 -1
- package/lib/checkpoints.js.gz +0 -0
- package/lib/cjs/checkpoints.cjs +1 -1
- package/lib/cjs/checkpoints.cjs.gz +0 -0
- package/lib/cjs/indexes.cjs +1 -1
- package/lib/cjs/indexes.cjs.gz +0 -0
- package/lib/cjs/mergeable-store.cjs +1 -0
- package/lib/cjs/mergeable-store.cjs.gz +0 -0
- package/lib/cjs/metrics.cjs +1 -1
- package/lib/cjs/metrics.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-automerge.cjs +1 -1
- package/lib/cjs/persisters/persister-automerge.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-browser.cjs +1 -1
- package/lib/cjs/persisters/persister-browser.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-cr-sqlite-wasm.cjs +1 -1
- package/lib/cjs/persisters/persister-cr-sqlite-wasm.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-electric-sql.cjs +1 -1
- package/lib/cjs/persisters/persister-electric-sql.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-expo-sqlite-next.cjs +1 -1
- package/lib/cjs/persisters/persister-expo-sqlite-next.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-expo-sqlite.cjs +1 -1
- package/lib/cjs/persisters/persister-expo-sqlite.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-file.cjs +1 -1
- package/lib/cjs/persisters/persister-file.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-indexed-db.cjs +1 -1
- package/lib/cjs/persisters/persister-indexed-db.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-libsql.cjs +1 -0
- package/lib/cjs/persisters/persister-libsql.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-partykit-client.cjs +1 -1
- package/lib/cjs/persisters/persister-partykit-client.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-partykit-server.cjs +1 -1
- package/lib/cjs/persisters/persister-partykit-server.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-powersync.cjs +1 -0
- package/lib/cjs/persisters/persister-powersync.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-remote.cjs +1 -1
- package/lib/cjs/persisters/persister-remote.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-sqlite-wasm.cjs +1 -1
- package/lib/cjs/persisters/persister-sqlite-wasm.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-sqlite3.cjs +1 -1
- package/lib/cjs/persisters/persister-sqlite3.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-yjs.cjs +1 -1
- package/lib/cjs/persisters/persister-yjs.cjs.gz +0 -0
- package/lib/cjs/persisters.cjs +1 -1
- package/lib/cjs/persisters.cjs.gz +0 -0
- package/lib/cjs/queries.cjs +1 -1
- package/lib/cjs/queries.cjs.gz +0 -0
- package/lib/cjs/relationships.cjs +1 -1
- package/lib/cjs/relationships.cjs.gz +0 -0
- package/lib/cjs/store.cjs +1 -1
- package/lib/cjs/store.cjs.gz +0 -0
- package/lib/cjs/synchronizers/synchronizer-local.cjs +1 -0
- package/lib/cjs/synchronizers/synchronizer-local.cjs.gz +0 -0
- package/lib/cjs/synchronizers/synchronizer-ws-client.cjs +1 -0
- package/lib/cjs/synchronizers/synchronizer-ws-client.cjs.gz +0 -0
- package/lib/cjs/synchronizers/synchronizer-ws-server.cjs +1 -0
- package/lib/cjs/synchronizers/synchronizer-ws-server.cjs.gz +0 -0
- package/lib/cjs/synchronizers.cjs +1 -0
- package/lib/cjs/synchronizers.cjs.gz +0 -0
- package/lib/cjs/tinybase.cjs +1 -1
- package/lib/cjs/tinybase.cjs.gz +0 -0
- package/lib/cjs/tools.cjs +1 -1
- package/lib/cjs/tools.cjs.gz +0 -0
- package/lib/cjs/ui-react-dom-debug.cjs +1 -1
- package/lib/cjs/ui-react-dom-debug.cjs.gz +0 -0
- package/lib/cjs/ui-react-dom.cjs +1 -1
- package/lib/cjs/ui-react-dom.cjs.gz +0 -0
- package/lib/cjs/ui-react.cjs +1 -1
- package/lib/cjs/ui-react.cjs.gz +0 -0
- package/lib/cjs-es6/checkpoints.cjs +1 -1
- package/lib/cjs-es6/checkpoints.cjs.gz +0 -0
- package/lib/cjs-es6/indexes.cjs +1 -1
- package/lib/cjs-es6/indexes.cjs.gz +0 -0
- package/lib/cjs-es6/mergeable-store.cjs +1 -0
- package/lib/cjs-es6/mergeable-store.cjs.gz +0 -0
- package/lib/cjs-es6/metrics.cjs +1 -1
- package/lib/cjs-es6/metrics.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-automerge.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-automerge.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-browser.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-browser.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-cr-sqlite-wasm.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-cr-sqlite-wasm.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-electric-sql.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-electric-sql.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-expo-sqlite-next.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-expo-sqlite-next.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-expo-sqlite.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-expo-sqlite.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-file.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-file.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-indexed-db.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-indexed-db.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-libsql.cjs +1 -0
- package/lib/cjs-es6/persisters/persister-libsql.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-partykit-client.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-partykit-client.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-partykit-server.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-partykit-server.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-powersync.cjs +1 -0
- package/lib/cjs-es6/persisters/persister-powersync.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-remote.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-remote.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-sqlite-wasm.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-sqlite-wasm.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-sqlite3.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-sqlite3.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-yjs.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-yjs.cjs.gz +0 -0
- package/lib/cjs-es6/persisters.cjs +1 -1
- package/lib/cjs-es6/persisters.cjs.gz +0 -0
- package/lib/cjs-es6/queries.cjs +1 -1
- package/lib/cjs-es6/queries.cjs.gz +0 -0
- package/lib/cjs-es6/relationships.cjs +1 -1
- package/lib/cjs-es6/relationships.cjs.gz +0 -0
- package/lib/cjs-es6/store.cjs +1 -1
- package/lib/cjs-es6/store.cjs.gz +0 -0
- package/lib/cjs-es6/synchronizers/synchronizer-local.cjs +1 -0
- package/lib/cjs-es6/synchronizers/synchronizer-local.cjs.gz +0 -0
- package/lib/cjs-es6/synchronizers/synchronizer-ws-client.cjs +1 -0
- package/lib/cjs-es6/synchronizers/synchronizer-ws-client.cjs.gz +0 -0
- package/lib/cjs-es6/synchronizers/synchronizer-ws-server.cjs +1 -0
- package/lib/cjs-es6/synchronizers/synchronizer-ws-server.cjs.gz +0 -0
- package/lib/cjs-es6/synchronizers.cjs +1 -0
- package/lib/cjs-es6/synchronizers.cjs.gz +0 -0
- package/lib/cjs-es6/tinybase.cjs +1 -1
- package/lib/cjs-es6/tinybase.cjs.gz +0 -0
- package/lib/cjs-es6/tools.cjs +1 -1
- package/lib/cjs-es6/tools.cjs.gz +0 -0
- package/lib/cjs-es6/ui-react-dom-debug.cjs +1 -1
- package/lib/cjs-es6/ui-react-dom-debug.cjs.gz +0 -0
- package/lib/cjs-es6/ui-react-dom.cjs +1 -1
- package/lib/cjs-es6/ui-react-dom.cjs.gz +0 -0
- package/lib/cjs-es6/ui-react.cjs +1 -1
- package/lib/cjs-es6/ui-react.cjs.gz +0 -0
- package/lib/debug/checkpoints.js +3 -1
- package/lib/debug/indexes.js +3 -1
- package/lib/debug/mergeable-store.js +2230 -0
- package/lib/debug/metrics.js +3 -1
- package/lib/debug/persisters/persister-automerge.js +167 -131
- package/lib/debug/persisters/persister-browser.js +155 -102
- package/lib/debug/persisters/persister-cr-sqlite-wasm.js +225 -152
- package/lib/debug/persisters/persister-electric-sql.js +225 -152
- package/lib/debug/persisters/persister-expo-sqlite-next.js +225 -152
- package/lib/debug/persisters/persister-expo-sqlite.js +225 -152
- package/lib/debug/persisters/persister-file.js +149 -101
- package/lib/debug/persisters/persister-indexed-db.js +146 -100
- package/lib/debug/persisters/persister-libsql.js +924 -0
- package/lib/debug/persisters/persister-partykit-client.js +146 -104
- package/lib/debug/persisters/persister-partykit-server.js +17 -25
- package/lib/debug/persisters/persister-powersync.js +939 -0
- package/lib/debug/persisters/persister-remote.js +141 -97
- package/lib/debug/persisters/persister-sqlite-wasm.js +225 -152
- package/lib/debug/persisters/persister-sqlite3.js +225 -152
- package/lib/debug/persisters/persister-yjs.js +164 -127
- package/lib/debug/persisters.js +137 -94
- package/lib/debug/queries.js +9 -6
- package/lib/debug/relationships.js +3 -1
- package/lib/debug/store.js +147 -126
- package/lib/debug/synchronizers/synchronizer-local.js +571 -0
- package/lib/debug/synchronizers/synchronizer-ws-client.js +598 -0
- package/lib/debug/synchronizers/synchronizer-ws-server.js +241 -0
- package/lib/debug/synchronizers.js +531 -0
- package/lib/debug/tinybase.js +1080 -215
- package/lib/debug/tools.js +22 -21
- package/lib/debug/ui-react-dom.js +336 -258
- package/lib/debug/ui-react.js +55 -6
- package/lib/es6/checkpoints.js +1 -1
- package/lib/es6/checkpoints.js.gz +0 -0
- package/lib/es6/indexes.js +1 -1
- package/lib/es6/indexes.js.gz +0 -0
- package/lib/es6/mergeable-store.js +1 -0
- package/lib/es6/mergeable-store.js.gz +0 -0
- package/lib/es6/metrics.js +1 -1
- package/lib/es6/metrics.js.gz +0 -0
- package/lib/es6/persisters/persister-automerge.js +1 -1
- package/lib/es6/persisters/persister-automerge.js.gz +0 -0
- package/lib/es6/persisters/persister-browser.js +1 -1
- package/lib/es6/persisters/persister-browser.js.gz +0 -0
- package/lib/es6/persisters/persister-cr-sqlite-wasm.js +1 -1
- package/lib/es6/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
- package/lib/es6/persisters/persister-electric-sql.js +1 -1
- package/lib/es6/persisters/persister-electric-sql.js.gz +0 -0
- package/lib/es6/persisters/persister-expo-sqlite-next.js +1 -1
- package/lib/es6/persisters/persister-expo-sqlite-next.js.gz +0 -0
- package/lib/es6/persisters/persister-expo-sqlite.js +1 -1
- package/lib/es6/persisters/persister-expo-sqlite.js.gz +0 -0
- package/lib/es6/persisters/persister-file.js +1 -1
- package/lib/es6/persisters/persister-file.js.gz +0 -0
- package/lib/es6/persisters/persister-indexed-db.js +1 -1
- package/lib/es6/persisters/persister-indexed-db.js.gz +0 -0
- package/lib/es6/persisters/persister-libsql.js +1 -0
- package/lib/es6/persisters/persister-libsql.js.gz +0 -0
- package/lib/es6/persisters/persister-partykit-client.js +1 -1
- package/lib/es6/persisters/persister-partykit-client.js.gz +0 -0
- package/lib/es6/persisters/persister-partykit-server.js +1 -1
- package/lib/es6/persisters/persister-partykit-server.js.gz +0 -0
- package/lib/es6/persisters/persister-powersync.js +1 -0
- package/lib/es6/persisters/persister-powersync.js.gz +0 -0
- package/lib/es6/persisters/persister-remote.js +1 -1
- package/lib/es6/persisters/persister-remote.js.gz +0 -0
- package/lib/es6/persisters/persister-sqlite-wasm.js +1 -1
- package/lib/es6/persisters/persister-sqlite-wasm.js.gz +0 -0
- package/lib/es6/persisters/persister-sqlite3.js +1 -1
- package/lib/es6/persisters/persister-sqlite3.js.gz +0 -0
- package/lib/es6/persisters/persister-yjs.js +1 -1
- package/lib/es6/persisters/persister-yjs.js.gz +0 -0
- package/lib/es6/persisters.js +1 -1
- package/lib/es6/persisters.js.gz +0 -0
- package/lib/es6/queries.js +1 -1
- package/lib/es6/queries.js.gz +0 -0
- package/lib/es6/relationships.js +1 -1
- package/lib/es6/relationships.js.gz +0 -0
- package/lib/es6/store.js +1 -1
- package/lib/es6/store.js.gz +0 -0
- package/lib/es6/synchronizers/synchronizer-local.js +1 -0
- package/lib/es6/synchronizers/synchronizer-local.js.gz +0 -0
- package/lib/es6/synchronizers/synchronizer-ws-client.js +1 -0
- package/lib/es6/synchronizers/synchronizer-ws-client.js.gz +0 -0
- package/lib/es6/synchronizers/synchronizer-ws-server.js +1 -0
- package/lib/es6/synchronizers/synchronizer-ws-server.js.gz +0 -0
- package/lib/es6/synchronizers.js +1 -0
- package/lib/es6/synchronizers.js.gz +0 -0
- package/lib/es6/tinybase.js +1 -1
- package/lib/es6/tinybase.js.gz +0 -0
- package/lib/es6/tools.js +1 -1
- package/lib/es6/tools.js.gz +0 -0
- package/lib/es6/ui-react-dom-debug.js +1 -1
- package/lib/es6/ui-react-dom-debug.js.gz +0 -0
- package/lib/es6/ui-react-dom.js +1 -1
- package/lib/es6/ui-react-dom.js.gz +0 -0
- package/lib/es6/ui-react.js +1 -1
- package/lib/es6/ui-react.js.gz +0 -0
- package/lib/indexes.js +1 -1
- package/lib/indexes.js.gz +0 -0
- package/lib/mergeable-store.js +1 -0
- package/lib/mergeable-store.js.gz +0 -0
- package/lib/metrics.js +1 -1
- package/lib/metrics.js.gz +0 -0
- package/lib/persisters/persister-automerge.js +1 -1
- package/lib/persisters/persister-automerge.js.gz +0 -0
- package/lib/persisters/persister-browser.js +1 -1
- package/lib/persisters/persister-browser.js.gz +0 -0
- package/lib/persisters/persister-cr-sqlite-wasm.js +1 -1
- package/lib/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
- package/lib/persisters/persister-electric-sql.js +1 -1
- package/lib/persisters/persister-electric-sql.js.gz +0 -0
- package/lib/persisters/persister-expo-sqlite-next.js +1 -1
- package/lib/persisters/persister-expo-sqlite-next.js.gz +0 -0
- package/lib/persisters/persister-expo-sqlite.js +1 -1
- package/lib/persisters/persister-expo-sqlite.js.gz +0 -0
- package/lib/persisters/persister-file.js +1 -1
- package/lib/persisters/persister-file.js.gz +0 -0
- package/lib/persisters/persister-indexed-db.js +1 -1
- package/lib/persisters/persister-indexed-db.js.gz +0 -0
- package/lib/persisters/persister-libsql.js +1 -0
- package/lib/persisters/persister-libsql.js.gz +0 -0
- package/lib/persisters/persister-partykit-client.js +1 -1
- package/lib/persisters/persister-partykit-client.js.gz +0 -0
- package/lib/persisters/persister-partykit-server.js +1 -1
- package/lib/persisters/persister-partykit-server.js.gz +0 -0
- package/lib/persisters/persister-powersync.js +1 -0
- package/lib/persisters/persister-powersync.js.gz +0 -0
- package/lib/persisters/persister-remote.js +1 -1
- package/lib/persisters/persister-remote.js.gz +0 -0
- package/lib/persisters/persister-sqlite-wasm.js +1 -1
- package/lib/persisters/persister-sqlite-wasm.js.gz +0 -0
- package/lib/persisters/persister-sqlite3.js +1 -1
- package/lib/persisters/persister-sqlite3.js.gz +0 -0
- package/lib/persisters/persister-yjs.js +1 -1
- package/lib/persisters/persister-yjs.js.gz +0 -0
- package/lib/persisters.js +1 -1
- package/lib/persisters.js.gz +0 -0
- package/lib/queries.js +1 -1
- package/lib/queries.js.gz +0 -0
- package/lib/relationships.js +1 -1
- package/lib/relationships.js.gz +0 -0
- package/lib/store.js +1 -1
- package/lib/store.js.gz +0 -0
- package/lib/synchronizers/synchronizer-local.js +1 -0
- package/lib/synchronizers/synchronizer-local.js.gz +0 -0
- package/lib/synchronizers/synchronizer-ws-client.js +1 -0
- package/lib/synchronizers/synchronizer-ws-client.js.gz +0 -0
- package/lib/synchronizers/synchronizer-ws-server.js +1 -0
- package/lib/synchronizers/synchronizer-ws-server.js.gz +0 -0
- package/lib/synchronizers.js +1 -0
- package/lib/synchronizers.js.gz +0 -0
- package/lib/tinybase.js +1 -1
- package/lib/tinybase.js.gz +0 -0
- package/lib/tools.js +1 -1
- package/lib/tools.js.gz +0 -0
- package/lib/types/checkpoints.d.ts +2 -2
- package/lib/types/indexes.d.ts +2 -2
- package/lib/types/mergeable-store.d.ts +214 -0
- package/lib/types/metrics.d.ts +2 -2
- package/lib/types/persisters/persister-automerge.d.ts +11 -7
- package/lib/types/persisters/persister-browser.d.ts +13 -4
- package/lib/types/persisters/persister-cr-sqlite-wasm.d.ts +4 -0
- package/lib/types/persisters/persister-electric-sql.d.ts +4 -0
- package/lib/types/persisters/persister-expo-sqlite-next.d.ts +4 -0
- package/lib/types/persisters/persister-expo-sqlite.d.ts +4 -0
- package/lib/types/persisters/persister-file.d.ts +7 -2
- package/lib/types/persisters/persister-indexed-db.d.ts +4 -0
- package/lib/types/persisters/persister-libsql.d.ts +142 -0
- package/lib/types/persisters/persister-partykit-client.d.ts +4 -0
- package/lib/types/persisters/persister-partykit-server.d.ts +12 -8
- package/lib/types/persisters/persister-powersync.d.ts +157 -0
- package/lib/types/persisters/persister-remote.d.ts +4 -0
- package/lib/types/persisters/persister-sqlite-wasm.d.ts +4 -0
- package/lib/types/persisters/persister-sqlite3.d.ts +4 -0
- package/lib/types/persisters/persister-yjs.d.ts +6 -2
- package/lib/types/persisters.d.ts +162 -59
- package/lib/types/queries.d.ts +2 -2
- package/lib/types/relationships.d.ts +2 -2
- package/lib/types/store.d.ts +275 -187
- package/lib/types/synchronizers/synchronizer-local.d.ts +27 -0
- package/lib/types/synchronizers/synchronizer-ws-client.d.ts +35 -0
- package/lib/types/synchronizers/synchronizer-ws-server.d.ts +57 -0
- package/lib/types/synchronizers.d.ts +132 -0
- package/lib/types/tinybase.d.ts +10 -8
- package/lib/types/tools.d.ts +4 -4
- package/lib/types/ui-react.d.ts +160 -9
- package/lib/types/with-schemas/checkpoints.d.ts +2 -2
- package/lib/types/with-schemas/indexes.d.ts +2 -2
- package/lib/types/with-schemas/internal/store.d.ts +4 -0
- package/lib/types/with-schemas/mergeable-store.d.ts +492 -0
- package/lib/types/with-schemas/metrics.d.ts +2 -2
- package/lib/types/with-schemas/persisters/persister-automerge.d.ts +12 -8
- package/lib/types/with-schemas/persisters/persister-browser.d.ts +17 -8
- package/lib/types/with-schemas/persisters/persister-cr-sqlite-wasm.d.ts +5 -1
- package/lib/types/with-schemas/persisters/persister-electric-sql.d.ts +5 -1
- package/lib/types/with-schemas/persisters/persister-expo-sqlite-next.d.ts +5 -1
- package/lib/types/with-schemas/persisters/persister-expo-sqlite.d.ts +5 -1
- package/lib/types/with-schemas/persisters/persister-file.d.ts +9 -4
- package/lib/types/with-schemas/persisters/persister-indexed-db.d.ts +5 -1
- package/lib/types/with-schemas/persisters/persister-libsql.d.ts +155 -0
- package/lib/types/with-schemas/persisters/persister-partykit-client.d.ts +5 -1
- package/lib/types/with-schemas/persisters/persister-partykit-server.d.ts +15 -11
- package/lib/types/with-schemas/persisters/persister-powersync.d.ts +170 -0
- package/lib/types/with-schemas/persisters/persister-remote.d.ts +5 -1
- package/lib/types/with-schemas/persisters/persister-sqlite-wasm.d.ts +5 -1
- package/lib/types/with-schemas/persisters/persister-sqlite3.d.ts +5 -1
- package/lib/types/with-schemas/persisters/persister-yjs.d.ts +7 -3
- package/lib/types/with-schemas/persisters.d.ts +193 -121
- package/lib/types/with-schemas/queries.d.ts +3 -3
- package/lib/types/with-schemas/relationships.d.ts +2 -2
- package/lib/types/with-schemas/store.d.ts +483 -345
- package/lib/types/with-schemas/synchronizers/synchronizer-local.d.ts +29 -0
- package/lib/types/with-schemas/synchronizers/synchronizer-ws-client.d.ts +41 -0
- package/lib/types/with-schemas/synchronizers/synchronizer-ws-server.d.ts +57 -0
- package/lib/types/with-schemas/synchronizers.d.ts +146 -0
- package/lib/types/with-schemas/tinybase.d.ts +9 -8
- package/lib/types/with-schemas/tools.d.ts +4 -4
- package/lib/types/with-schemas/ui-react.d.ts +177 -9
- package/lib/ui-react-dom.js +1 -1
- package/lib/ui-react-dom.js.gz +0 -0
- package/lib/ui-react.js +1 -1
- package/lib/ui-react.js.gz +0 -0
- package/lib/umd/checkpoints.js +1 -1
- package/lib/umd/checkpoints.js.gz +0 -0
- package/lib/umd/indexes.js +1 -1
- package/lib/umd/indexes.js.gz +0 -0
- package/lib/umd/mergeable-store.js +1 -0
- package/lib/umd/mergeable-store.js.gz +0 -0
- package/lib/umd/metrics.js +1 -1
- package/lib/umd/metrics.js.gz +0 -0
- package/lib/umd/persisters/persister-automerge.js +1 -1
- package/lib/umd/persisters/persister-automerge.js.gz +0 -0
- package/lib/umd/persisters/persister-browser.js +1 -1
- package/lib/umd/persisters/persister-browser.js.gz +0 -0
- package/lib/umd/persisters/persister-cr-sqlite-wasm.js +1 -1
- package/lib/umd/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
- package/lib/umd/persisters/persister-electric-sql.js +1 -1
- package/lib/umd/persisters/persister-electric-sql.js.gz +0 -0
- package/lib/umd/persisters/persister-expo-sqlite-next.js +1 -1
- package/lib/umd/persisters/persister-expo-sqlite-next.js.gz +0 -0
- package/lib/umd/persisters/persister-expo-sqlite.js +1 -1
- package/lib/umd/persisters/persister-expo-sqlite.js.gz +0 -0
- package/lib/umd/persisters/persister-file.js +1 -1
- package/lib/umd/persisters/persister-file.js.gz +0 -0
- package/lib/umd/persisters/persister-indexed-db.js +1 -1
- package/lib/umd/persisters/persister-indexed-db.js.gz +0 -0
- package/lib/umd/persisters/persister-libsql.js +1 -0
- package/lib/umd/persisters/persister-libsql.js.gz +0 -0
- package/lib/umd/persisters/persister-partykit-client.js +1 -1
- package/lib/umd/persisters/persister-partykit-client.js.gz +0 -0
- package/lib/umd/persisters/persister-partykit-server.js +1 -1
- package/lib/umd/persisters/persister-partykit-server.js.gz +0 -0
- package/lib/umd/persisters/persister-powersync.js +1 -0
- package/lib/umd/persisters/persister-powersync.js.gz +0 -0
- package/lib/umd/persisters/persister-remote.js +1 -1
- package/lib/umd/persisters/persister-remote.js.gz +0 -0
- package/lib/umd/persisters/persister-sqlite-wasm.js +1 -1
- package/lib/umd/persisters/persister-sqlite-wasm.js.gz +0 -0
- package/lib/umd/persisters/persister-sqlite3.js +1 -1
- package/lib/umd/persisters/persister-sqlite3.js.gz +0 -0
- package/lib/umd/persisters/persister-yjs.js +1 -1
- package/lib/umd/persisters/persister-yjs.js.gz +0 -0
- package/lib/umd/persisters.js +1 -1
- package/lib/umd/persisters.js.gz +0 -0
- package/lib/umd/queries.js +1 -1
- package/lib/umd/queries.js.gz +0 -0
- package/lib/umd/relationships.js +1 -1
- package/lib/umd/relationships.js.gz +0 -0
- package/lib/umd/store.js +1 -1
- package/lib/umd/store.js.gz +0 -0
- package/lib/umd/synchronizers/synchronizer-local.js +1 -0
- package/lib/umd/synchronizers/synchronizer-local.js.gz +0 -0
- package/lib/umd/synchronizers/synchronizer-ws-client.js +1 -0
- package/lib/umd/synchronizers/synchronizer-ws-client.js.gz +0 -0
- package/lib/umd/synchronizers/synchronizer-ws-server.js +1 -0
- package/lib/umd/synchronizers/synchronizer-ws-server.js.gz +0 -0
- package/lib/umd/synchronizers.js +1 -0
- package/lib/umd/synchronizers.js.gz +0 -0
- package/lib/umd/tinybase.js +1 -1
- package/lib/umd/tinybase.js.gz +0 -0
- package/lib/umd/tools.js +1 -1
- package/lib/umd/tools.js.gz +0 -0
- package/lib/umd/ui-react-dom-debug.js +1 -1
- package/lib/umd/ui-react-dom-debug.js.gz +0 -0
- package/lib/umd/ui-react-dom.js +1 -1
- package/lib/umd/ui-react-dom.js.gz +0 -0
- package/lib/umd/ui-react.js +1 -1
- package/lib/umd/ui-react.js.gz +0 -0
- package/lib/umd-es6/checkpoints.js +1 -1
- package/lib/umd-es6/checkpoints.js.gz +0 -0
- package/lib/umd-es6/indexes.js +1 -1
- package/lib/umd-es6/indexes.js.gz +0 -0
- package/lib/umd-es6/mergeable-store.js +1 -0
- package/lib/umd-es6/mergeable-store.js.gz +0 -0
- package/lib/umd-es6/metrics.js +1 -1
- package/lib/umd-es6/metrics.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-automerge.js +1 -1
- package/lib/umd-es6/persisters/persister-automerge.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-browser.js +1 -1
- package/lib/umd-es6/persisters/persister-browser.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-cr-sqlite-wasm.js +1 -1
- package/lib/umd-es6/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-electric-sql.js +1 -1
- package/lib/umd-es6/persisters/persister-electric-sql.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-expo-sqlite-next.js +1 -1
- package/lib/umd-es6/persisters/persister-expo-sqlite-next.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-expo-sqlite.js +1 -1
- package/lib/umd-es6/persisters/persister-expo-sqlite.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-file.js +1 -1
- package/lib/umd-es6/persisters/persister-file.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-indexed-db.js +1 -1
- package/lib/umd-es6/persisters/persister-indexed-db.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-libsql.js +1 -0
- package/lib/umd-es6/persisters/persister-libsql.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-partykit-client.js +1 -1
- package/lib/umd-es6/persisters/persister-partykit-client.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-partykit-server.js +1 -1
- package/lib/umd-es6/persisters/persister-partykit-server.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-powersync.js +1 -0
- package/lib/umd-es6/persisters/persister-powersync.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-remote.js +1 -1
- package/lib/umd-es6/persisters/persister-remote.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-sqlite-wasm.js +1 -1
- package/lib/umd-es6/persisters/persister-sqlite-wasm.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-sqlite3.js +1 -1
- package/lib/umd-es6/persisters/persister-sqlite3.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-yjs.js +1 -1
- package/lib/umd-es6/persisters/persister-yjs.js.gz +0 -0
- package/lib/umd-es6/persisters.js +1 -1
- package/lib/umd-es6/persisters.js.gz +0 -0
- package/lib/umd-es6/queries.js +1 -1
- package/lib/umd-es6/queries.js.gz +0 -0
- package/lib/umd-es6/relationships.js +1 -1
- package/lib/umd-es6/relationships.js.gz +0 -0
- package/lib/umd-es6/store.js +1 -1
- package/lib/umd-es6/store.js.gz +0 -0
- package/lib/umd-es6/synchronizers/synchronizer-local.js +1 -0
- package/lib/umd-es6/synchronizers/synchronizer-local.js.gz +0 -0
- package/lib/umd-es6/synchronizers/synchronizer-ws-client.js +1 -0
- package/lib/umd-es6/synchronizers/synchronizer-ws-client.js.gz +0 -0
- package/lib/umd-es6/synchronizers/synchronizer-ws-server.js +1 -0
- package/lib/umd-es6/synchronizers/synchronizer-ws-server.js.gz +0 -0
- package/lib/umd-es6/synchronizers.js +1 -0
- package/lib/umd-es6/synchronizers.js.gz +0 -0
- package/lib/umd-es6/tinybase.js +1 -1
- package/lib/umd-es6/tinybase.js.gz +0 -0
- package/lib/umd-es6/tools.js +1 -1
- package/lib/umd-es6/tools.js.gz +0 -0
- package/lib/umd-es6/ui-react-dom-debug.js +1 -1
- package/lib/umd-es6/ui-react-dom-debug.js.gz +0 -0
- package/lib/umd-es6/ui-react-dom.js +1 -1
- package/lib/umd-es6/ui-react-dom.js.gz +0 -0
- package/lib/umd-es6/ui-react.js +1 -1
- package/lib/umd-es6/ui-react.js.gz +0 -0
- package/package.json +65 -45
- package/readme.md +2 -2
|
@@ -17,11 +17,12 @@ import {
|
|
|
17
17
|
DefaultValueIdFromSchema,
|
|
18
18
|
DefaultedCellFromSchema,
|
|
19
19
|
DefaultedValueFromSchema,
|
|
20
|
+
StoreAlias,
|
|
20
21
|
TableIdFromSchema,
|
|
21
22
|
Truncate,
|
|
22
23
|
ValueIdFromSchema,
|
|
23
24
|
} from './internal/store';
|
|
24
|
-
import {Id, IdOrNull, Ids, Json} from './common.d';
|
|
25
|
+
import {Id, IdOrNull, Ids, Json} from './common.d.ts';
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* The TablesSchema type describes the tabular structure of a Store in terms of
|
|
@@ -166,6 +167,46 @@ export type OptionalSchemas = [OptionalTablesSchema, OptionalValuesSchema];
|
|
|
166
167
|
*/
|
|
167
168
|
export type NoSchemas = [NoTablesSchema, NoValuesSchema];
|
|
168
169
|
|
|
170
|
+
/**
|
|
171
|
+
* The Content type describes both the Tables and Values in a Store.
|
|
172
|
+
*
|
|
173
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
174
|
+
*
|
|
175
|
+
* ```ts override
|
|
176
|
+
* [Tables, Values];
|
|
177
|
+
* ```
|
|
178
|
+
*
|
|
179
|
+
* It is an array of two objects, representing tabular and keyed value content.
|
|
180
|
+
* @example
|
|
181
|
+
* The following is a valid Content array:
|
|
182
|
+
* ```json
|
|
183
|
+
* [
|
|
184
|
+
* {
|
|
185
|
+
* "pets": {
|
|
186
|
+
* "fido": {
|
|
187
|
+
* "sold": false,
|
|
188
|
+
* "price": 4,
|
|
189
|
+
* },
|
|
190
|
+
* "felix": {
|
|
191
|
+
* "sold": true,
|
|
192
|
+
* "price": 5,
|
|
193
|
+
* },
|
|
194
|
+
* },
|
|
195
|
+
* },
|
|
196
|
+
* {
|
|
197
|
+
* open: true,
|
|
198
|
+
* employees: 3,
|
|
199
|
+
* },
|
|
200
|
+
* ]
|
|
201
|
+
* ```
|
|
202
|
+
* @category Store
|
|
203
|
+
* @since v5.0.0
|
|
204
|
+
*/
|
|
205
|
+
export type Content<
|
|
206
|
+
Schemas extends OptionalSchemas,
|
|
207
|
+
WhenSet extends boolean = false,
|
|
208
|
+
> = [Tables<Schemas[0], WhenSet>, Values<Schemas[1], WhenSet>];
|
|
209
|
+
|
|
169
210
|
/**
|
|
170
211
|
* The Tables type is the data structure representing all of the data in a
|
|
171
212
|
* Store.
|
|
@@ -787,28 +828,20 @@ export type ChangedValueIds<Schema extends OptionalValuesSchema> = {
|
|
|
787
828
|
* This has schema-based typing. The following is a simplified representation:
|
|
788
829
|
*
|
|
789
830
|
* ```ts override
|
|
790
|
-
* (
|
|
791
|
-
* getTransactionChanges: GetTransactionChanges,
|
|
792
|
-
* getTransactionLog: GetTransactionLog,
|
|
793
|
-
* ) => boolean;
|
|
831
|
+
* (store: Store) => boolean;
|
|
794
832
|
* ```
|
|
795
833
|
*
|
|
796
834
|
* A DoRollback can be provided when calling the transaction method or the
|
|
797
835
|
* finishTransaction method. See those methods for specific examples.
|
|
798
836
|
*
|
|
799
|
-
* Since
|
|
800
|
-
*
|
|
801
|
-
*
|
|
802
|
-
*
|
|
803
|
-
* @param getTransactionChanges A function to be called to get the changes made
|
|
804
|
-
* to the Store during the transaction, since v4.0.
|
|
805
|
-
* @param getTransactionChanges A function to be called to get a more detailed
|
|
806
|
-
* log of the changes made or attempted during the transaction, since v4.0.
|
|
837
|
+
* Since v5.0, this function is called with the Store as a single argument. You
|
|
838
|
+
* can use the getTransactionChanges method and getTransactionLog method of the
|
|
839
|
+
* Store directly to decide whether to do the rollback.
|
|
840
|
+
* @param store A reference to the Store that is completing a transaction.
|
|
807
841
|
* @category Callback
|
|
808
842
|
*/
|
|
809
843
|
export type DoRollback<Schemas extends OptionalSchemas> = (
|
|
810
|
-
|
|
811
|
-
getTransactionLog: GetTransactionLog<Schemas>,
|
|
844
|
+
store: Store<Schemas>,
|
|
812
845
|
) => boolean;
|
|
813
846
|
|
|
814
847
|
/**
|
|
@@ -818,10 +851,8 @@ export type DoRollback<Schemas extends OptionalSchemas> = (
|
|
|
818
851
|
* This has schema-based typing. The following is a simplified representation:
|
|
819
852
|
*
|
|
820
853
|
* ```ts override
|
|
821
|
-
* (
|
|
854
|
+
* export type TransactionListener<Store extends StoreAlias = StoreAlias> = (
|
|
822
855
|
* store: Store,
|
|
823
|
-
* getTransactionChanges: GetTransactionChanges,
|
|
824
|
-
* getTransactionLog: GetTransactionLog,
|
|
825
856
|
* ) => void;
|
|
826
857
|
* ```
|
|
827
858
|
*
|
|
@@ -829,22 +860,17 @@ export type DoRollback<Schemas extends OptionalSchemas> = (
|
|
|
829
860
|
* addWillFinishTransactionListener and addDidFinishTransactionListener methods.
|
|
830
861
|
* See those methods for specific examples.
|
|
831
862
|
*
|
|
832
|
-
*
|
|
833
|
-
*
|
|
834
|
-
*
|
|
835
|
-
*
|
|
863
|
+
* Since v5.0, this listener is called with no arguments other than the Store.
|
|
864
|
+
* You can use the getTransactionChanges method and getTransactionLog method of
|
|
865
|
+
* the Store directly to get information about the changes made within the
|
|
866
|
+
* transaction.
|
|
836
867
|
* @param store A reference to the Store that is completing a transaction.
|
|
837
|
-
* @param getTransactionChanges A function to be called to get the changes made
|
|
838
|
-
* to the Store during the transaction, since v4.0.
|
|
839
|
-
* @param getTransactionChanges A function to be called to get a more detailed
|
|
840
|
-
* log of the changes made or attempted during the transaction, since v4.0.
|
|
841
868
|
* @category Listener
|
|
842
869
|
*/
|
|
843
|
-
export type TransactionListener<
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
) => void;
|
|
870
|
+
export type TransactionListener<
|
|
871
|
+
Schemas extends OptionalSchemas,
|
|
872
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
873
|
+
> = (store: Store) => void;
|
|
848
874
|
|
|
849
875
|
/**
|
|
850
876
|
* The HasTablesListener type describes a function that is used to listen to
|
|
@@ -853,7 +879,10 @@ export type TransactionListener<Schemas extends OptionalSchemas> = (
|
|
|
853
879
|
* This has schema-based typing. The following is a simplified representation:
|
|
854
880
|
*
|
|
855
881
|
* ```ts override
|
|
856
|
-
*
|
|
882
|
+
* export type HasTablesListener<Store extends StoreAlias = StoreAlias> = (
|
|
883
|
+
* store: Store,
|
|
884
|
+
* hasTables: boolean,
|
|
885
|
+
* ) => void;
|
|
857
886
|
* ```
|
|
858
887
|
*
|
|
859
888
|
* A HasTablesListener is provided when using the addHasTablesListener method.
|
|
@@ -867,10 +896,10 @@ export type TransactionListener<Schemas extends OptionalSchemas> = (
|
|
|
867
896
|
* @category Listener
|
|
868
897
|
* @since v4.4.0
|
|
869
898
|
*/
|
|
870
|
-
export type HasTablesListener<
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
) => void;
|
|
899
|
+
export type HasTablesListener<
|
|
900
|
+
Schemas extends OptionalSchemas,
|
|
901
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
902
|
+
> = (store: Store, hasTables: boolean) => void;
|
|
874
903
|
|
|
875
904
|
/**
|
|
876
905
|
* The TablesListener type describes a function that is used to listen to
|
|
@@ -879,7 +908,7 @@ export type HasTablesListener<Schemas extends OptionalSchemas> = (
|
|
|
879
908
|
* This has schema-based typing. The following is a simplified representation:
|
|
880
909
|
*
|
|
881
910
|
* ```ts override
|
|
882
|
-
* (
|
|
911
|
+
* export type TablesListener<Store extends StoreAlias = StoreAlias> = (
|
|
883
912
|
* store: Store,
|
|
884
913
|
* getCellChange: GetCellChange | undefined,
|
|
885
914
|
* ) => void;
|
|
@@ -900,8 +929,11 @@ export type HasTablesListener<Schemas extends OptionalSchemas> = (
|
|
|
900
929
|
* changes.
|
|
901
930
|
* @category Listener
|
|
902
931
|
*/
|
|
903
|
-
export type TablesListener<
|
|
904
|
-
|
|
932
|
+
export type TablesListener<
|
|
933
|
+
Schemas extends OptionalSchemas,
|
|
934
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
935
|
+
> = (
|
|
936
|
+
store: Store,
|
|
905
937
|
getCellChange: GetCellChange<Schemas[0]> | undefined,
|
|
906
938
|
) => void;
|
|
907
939
|
|
|
@@ -912,7 +944,7 @@ export type TablesListener<Schemas extends OptionalSchemas> = (
|
|
|
912
944
|
* This has schema-based typing. The following is a simplified representation:
|
|
913
945
|
*
|
|
914
946
|
* ```ts override
|
|
915
|
-
* (
|
|
947
|
+
* export type TableIdsListener<Store extends StoreAlias = StoreAlias> = (
|
|
916
948
|
* store: Store,
|
|
917
949
|
* getIdChanges: GetIdChanges | undefined,
|
|
918
950
|
* ) => void;
|
|
@@ -930,8 +962,11 @@ export type TablesListener<Schemas extends OptionalSchemas> = (
|
|
|
930
962
|
* since v3.3.
|
|
931
963
|
* @category Listener
|
|
932
964
|
*/
|
|
933
|
-
export type TableIdsListener<
|
|
934
|
-
|
|
965
|
+
export type TableIdsListener<
|
|
966
|
+
Schemas extends OptionalSchemas,
|
|
967
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
968
|
+
> = (
|
|
969
|
+
store: Store,
|
|
935
970
|
getIdChanges: GetIdChanges<TableIdFromSchema<Schemas[0]>> | undefined,
|
|
936
971
|
) => void;
|
|
937
972
|
|
|
@@ -942,7 +977,7 @@ export type TableIdsListener<Schemas extends OptionalSchemas> = (
|
|
|
942
977
|
* This has schema-based typing. The following is a simplified representation:
|
|
943
978
|
*
|
|
944
979
|
* ```ts override
|
|
945
|
-
* (
|
|
980
|
+
* export type HasTableListener<Store extends StoreAlias = StoreAlias> = (
|
|
946
981
|
* store: Store,
|
|
947
982
|
* tableId: Id,
|
|
948
983
|
* hasTable: boolean,
|
|
@@ -965,8 +1000,9 @@ export type TableIdsListener<Schemas extends OptionalSchemas> = (
|
|
|
965
1000
|
export type HasTableListener<
|
|
966
1001
|
Schemas extends OptionalSchemas,
|
|
967
1002
|
TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null,
|
|
1003
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
968
1004
|
> = (
|
|
969
|
-
store: Store
|
|
1005
|
+
store: Store,
|
|
970
1006
|
tableId: TableIdOrNull extends null
|
|
971
1007
|
? TableIdFromSchema<Schemas[0]>
|
|
972
1008
|
: TableIdOrNull,
|
|
@@ -980,7 +1016,7 @@ export type HasTableListener<
|
|
|
980
1016
|
* This has schema-based typing. The following is a simplified representation:
|
|
981
1017
|
*
|
|
982
1018
|
* ```ts override
|
|
983
|
-
* (
|
|
1019
|
+
* export type TableListener<Store extends StoreAlias = StoreAlias> = (
|
|
984
1020
|
* store: Store,
|
|
985
1021
|
* tableId: Id,
|
|
986
1022
|
* getCellChange: GetCellChange | undefined,
|
|
@@ -1006,8 +1042,9 @@ export type HasTableListener<
|
|
|
1006
1042
|
export type TableListener<
|
|
1007
1043
|
Schemas extends OptionalSchemas,
|
|
1008
1044
|
TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null,
|
|
1045
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1009
1046
|
> = (
|
|
1010
|
-
store: Store
|
|
1047
|
+
store: Store,
|
|
1011
1048
|
tableId: TableIdOrNull extends null
|
|
1012
1049
|
? TableIdFromSchema<Schemas[0]>
|
|
1013
1050
|
: TableIdOrNull,
|
|
@@ -1021,7 +1058,7 @@ export type TableListener<
|
|
|
1021
1058
|
* This has schema-based typing. The following is a simplified representation:
|
|
1022
1059
|
*
|
|
1023
1060
|
* ```ts override
|
|
1024
|
-
* (
|
|
1061
|
+
* export type TableCellIdsListener<Store extends StoreAlias = StoreAlias> = (
|
|
1025
1062
|
* store: Store,
|
|
1026
1063
|
* tableId: Id,
|
|
1027
1064
|
* getIdChanges: GetIdChanges | undefined,
|
|
@@ -1043,12 +1080,13 @@ export type TableListener<
|
|
|
1043
1080
|
export type TableCellIdsListener<
|
|
1044
1081
|
Schemas extends OptionalSchemas,
|
|
1045
1082
|
TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null,
|
|
1083
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1046
1084
|
Params extends any[] = (
|
|
1047
1085
|
TableIdOrNull extends null ? TableIdFromSchema<Schemas[0]> : TableIdOrNull
|
|
1048
1086
|
) extends infer TableId
|
|
1049
1087
|
? TableId extends TableIdFromSchema<Schemas[0]>
|
|
1050
1088
|
? [
|
|
1051
|
-
store: Store
|
|
1089
|
+
store: Store,
|
|
1052
1090
|
tableId: TableId,
|
|
1053
1091
|
getIdChanges: GetIdChanges<CellIdFromSchema<Schemas[0], TableId>>,
|
|
1054
1092
|
]
|
|
@@ -1071,7 +1109,7 @@ export type TableCellIdsListener<
|
|
|
1071
1109
|
* This has schema-based typing. The following is a simplified representation:
|
|
1072
1110
|
*
|
|
1073
1111
|
* ```ts override
|
|
1074
|
-
* (
|
|
1112
|
+
* export type HasTableCellListener<Store extends StoreAlias = StoreAlias> = (
|
|
1075
1113
|
* store: Store,
|
|
1076
1114
|
* tableId: Id,
|
|
1077
1115
|
* cellId: Id,
|
|
@@ -1101,6 +1139,7 @@ export type HasTableCellListener<
|
|
|
1101
1139
|
? CellIdFromSchema<Schemas[0], TableIdOrNull>
|
|
1102
1140
|
: AllCellIdFromSchema<Schemas[0]>)
|
|
1103
1141
|
| null,
|
|
1142
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1104
1143
|
Params extends any[] = (
|
|
1105
1144
|
TableIdOrNull extends null ? TableIdFromSchema<Schemas[0]> : TableIdOrNull
|
|
1106
1145
|
) extends infer TableId
|
|
@@ -1112,7 +1151,7 @@ export type HasTableCellListener<
|
|
|
1112
1151
|
) extends infer CellId
|
|
1113
1152
|
? CellId extends CellIdFromSchema<Schemas[0], TableId>
|
|
1114
1153
|
? [
|
|
1115
|
-
store: Store
|
|
1154
|
+
store: Store,
|
|
1116
1155
|
tableId: TableId,
|
|
1117
1156
|
cellId: CellId,
|
|
1118
1157
|
hasTableCell: boolean,
|
|
@@ -1140,7 +1179,7 @@ export type HasTableCellListener<
|
|
|
1140
1179
|
* This has schema-based typing. The following is a simplified representation:
|
|
1141
1180
|
*
|
|
1142
1181
|
* ```ts override
|
|
1143
|
-
* (
|
|
1182
|
+
* export type RowCountListener<Store extends StoreAlias = StoreAlias> = (
|
|
1144
1183
|
* store: Store,
|
|
1145
1184
|
* tableId: Id,
|
|
1146
1185
|
* count: number,
|
|
@@ -1161,8 +1200,9 @@ export type HasTableCellListener<
|
|
|
1161
1200
|
export type RowCountListener<
|
|
1162
1201
|
Schemas extends OptionalSchemas,
|
|
1163
1202
|
TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null,
|
|
1203
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1164
1204
|
> = (
|
|
1165
|
-
store: Store
|
|
1205
|
+
store: Store,
|
|
1166
1206
|
tableId: TableIdOrNull extends null
|
|
1167
1207
|
? TableIdFromSchema<Schemas[0]>
|
|
1168
1208
|
: TableIdOrNull,
|
|
@@ -1176,7 +1216,7 @@ export type RowCountListener<
|
|
|
1176
1216
|
* This has schema-based typing. The following is a simplified representation:
|
|
1177
1217
|
*
|
|
1178
1218
|
* ```ts override
|
|
1179
|
-
* (
|
|
1219
|
+
* export type RowIdsListener<Store extends StoreAlias = StoreAlias> = (
|
|
1180
1220
|
* store: Store,
|
|
1181
1221
|
* tableId: Id,
|
|
1182
1222
|
* getIdChanges: GetIdChanges | undefined,
|
|
@@ -1200,8 +1240,9 @@ export type RowCountListener<
|
|
|
1200
1240
|
export type RowIdsListener<
|
|
1201
1241
|
Schemas extends OptionalSchemas,
|
|
1202
1242
|
TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null,
|
|
1243
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1203
1244
|
> = (
|
|
1204
|
-
store: Store
|
|
1245
|
+
store: Store,
|
|
1205
1246
|
tableId: TableIdOrNull extends null
|
|
1206
1247
|
? TableIdFromSchema<Schemas[0]>
|
|
1207
1248
|
: TableIdOrNull,
|
|
@@ -1215,7 +1256,7 @@ export type RowIdsListener<
|
|
|
1215
1256
|
* This has schema-based typing. The following is a simplified representation:
|
|
1216
1257
|
*
|
|
1217
1258
|
* ```ts override
|
|
1218
|
-
* (
|
|
1259
|
+
* export type SortedRowIdsListener<Store extends StoreAlias = StoreAlias> = (
|
|
1219
1260
|
* store: Store,
|
|
1220
1261
|
* tableId: Id,
|
|
1221
1262
|
* cellId: Id | undefined,
|
|
@@ -1252,8 +1293,9 @@ export type SortedRowIdsListener<
|
|
|
1252
1293
|
Descending extends boolean,
|
|
1253
1294
|
Offset extends number,
|
|
1254
1295
|
Limit extends number | undefined,
|
|
1296
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1255
1297
|
> = (
|
|
1256
|
-
store: Store
|
|
1298
|
+
store: Store,
|
|
1257
1299
|
tableId: TableId,
|
|
1258
1300
|
cellId: CellId,
|
|
1259
1301
|
descending: Descending,
|
|
@@ -1269,7 +1311,7 @@ export type SortedRowIdsListener<
|
|
|
1269
1311
|
* This has schema-based typing. The following is a simplified representation:
|
|
1270
1312
|
*
|
|
1271
1313
|
* ```ts override
|
|
1272
|
-
* (
|
|
1314
|
+
* export type HasRowListener<Store extends StoreAlias = StoreAlias> = (
|
|
1273
1315
|
* store: Store,
|
|
1274
1316
|
* tableId: Id,
|
|
1275
1317
|
* rowId: Id,
|
|
@@ -1295,8 +1337,9 @@ export type HasRowListener<
|
|
|
1295
1337
|
Schemas extends OptionalSchemas,
|
|
1296
1338
|
TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null,
|
|
1297
1339
|
RowIdOrNull extends IdOrNull,
|
|
1340
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1298
1341
|
> = (
|
|
1299
|
-
store: Store
|
|
1342
|
+
store: Store,
|
|
1300
1343
|
tableId: TableIdOrNull extends null
|
|
1301
1344
|
? TableIdFromSchema<Schemas[0]>
|
|
1302
1345
|
: TableIdOrNull,
|
|
@@ -1311,7 +1354,7 @@ export type HasRowListener<
|
|
|
1311
1354
|
* This has schema-based typing. The following is a simplified representation:
|
|
1312
1355
|
*
|
|
1313
1356
|
* ```ts override
|
|
1314
|
-
* (
|
|
1357
|
+
* export type RowListener<Store extends StoreAlias = StoreAlias> = (
|
|
1315
1358
|
* store: Store,
|
|
1316
1359
|
* tableId: Id,
|
|
1317
1360
|
* rowId: Id,
|
|
@@ -1341,8 +1384,9 @@ export type RowListener<
|
|
|
1341
1384
|
Schemas extends OptionalSchemas,
|
|
1342
1385
|
TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null,
|
|
1343
1386
|
RowIdOrNull extends IdOrNull,
|
|
1387
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1344
1388
|
> = (
|
|
1345
|
-
store: Store
|
|
1389
|
+
store: Store,
|
|
1346
1390
|
tableId: TableIdOrNull extends null
|
|
1347
1391
|
? TableIdFromSchema<Schemas[0]>
|
|
1348
1392
|
: TableIdOrNull,
|
|
@@ -1357,7 +1401,7 @@ export type RowListener<
|
|
|
1357
1401
|
* This has schema-based typing. The following is a simplified representation:
|
|
1358
1402
|
*
|
|
1359
1403
|
* ```ts override
|
|
1360
|
-
* (
|
|
1404
|
+
* export type CellIdsListener<Store extends StoreAlias = StoreAlias> = (
|
|
1361
1405
|
* store: Store,
|
|
1362
1406
|
* tableId: Id,
|
|
1363
1407
|
* rowId: Id,
|
|
@@ -1384,12 +1428,13 @@ export type CellIdsListener<
|
|
|
1384
1428
|
Schemas extends OptionalSchemas,
|
|
1385
1429
|
TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null,
|
|
1386
1430
|
RowIdOrNull extends IdOrNull,
|
|
1431
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1387
1432
|
Params extends any[] = (
|
|
1388
1433
|
TableIdOrNull extends null ? TableIdFromSchema<Schemas[0]> : TableIdOrNull
|
|
1389
1434
|
) extends infer TableId
|
|
1390
1435
|
? TableId extends TableIdFromSchema<Schemas[0]>
|
|
1391
1436
|
? [
|
|
1392
|
-
store: Store
|
|
1437
|
+
store: Store,
|
|
1393
1438
|
tableId: TableId,
|
|
1394
1439
|
rowId: RowIdOrNull extends null ? Id : RowIdOrNull,
|
|
1395
1440
|
getIdChanges: GetIdChanges<CellIdFromSchema<Schemas[0], TableId>>,
|
|
@@ -1415,7 +1460,7 @@ export type CellIdsListener<
|
|
|
1415
1460
|
* This has schema-based typing. The following is a simplified representation:
|
|
1416
1461
|
*
|
|
1417
1462
|
* ```ts override
|
|
1418
|
-
* (
|
|
1463
|
+
* export type HasCellListener<Store extends StoreAlias = StoreAlias> = (
|
|
1419
1464
|
* store: Store,
|
|
1420
1465
|
* tableId: Id,
|
|
1421
1466
|
* rowId: Id,
|
|
@@ -1448,6 +1493,7 @@ export type HasCellListener<
|
|
|
1448
1493
|
? CellIdFromSchema<Schemas[0], TableIdOrNull>
|
|
1449
1494
|
: AllCellIdFromSchema<Schemas[0]>)
|
|
1450
1495
|
| null,
|
|
1496
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1451
1497
|
Params extends any[] = (
|
|
1452
1498
|
TableIdOrNull extends null ? TableIdFromSchema<Schemas[0]> : TableIdOrNull
|
|
1453
1499
|
) extends infer TableId
|
|
@@ -1459,7 +1505,7 @@ export type HasCellListener<
|
|
|
1459
1505
|
) extends infer CellId
|
|
1460
1506
|
? CellId extends CellIdFromSchema<Schemas[0], TableId>
|
|
1461
1507
|
? [
|
|
1462
|
-
store: Store
|
|
1508
|
+
store: Store,
|
|
1463
1509
|
tableId: TableId,
|
|
1464
1510
|
rowId: RowIdOrNull extends null ? Id : RowIdOrNull,
|
|
1465
1511
|
cellId: CellId,
|
|
@@ -1498,7 +1544,7 @@ export type HasCellListener<
|
|
|
1498
1544
|
* This has schema-based typing. The following is a simplified representation:
|
|
1499
1545
|
*
|
|
1500
1546
|
* ```ts override
|
|
1501
|
-
* (
|
|
1547
|
+
* export type CellListener<Store extends StoreAlias = StoreAlias> = (
|
|
1502
1548
|
* store: Store,
|
|
1503
1549
|
* tableId: Id,
|
|
1504
1550
|
* rowId: Id,
|
|
@@ -1541,6 +1587,7 @@ export type CellListener<
|
|
|
1541
1587
|
? CellIdFromSchema<Schemas[0], TableIdOrNull>
|
|
1542
1588
|
: AllCellIdFromSchema<Schemas[0]>)
|
|
1543
1589
|
| null,
|
|
1590
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1544
1591
|
Params extends any[] = (
|
|
1545
1592
|
TableIdOrNull extends null ? TableIdFromSchema<Schemas[0]> : TableIdOrNull
|
|
1546
1593
|
) extends infer TableId
|
|
@@ -1552,7 +1599,7 @@ export type CellListener<
|
|
|
1552
1599
|
) extends infer CellId
|
|
1553
1600
|
? CellId extends CellIdFromSchema<Schemas[0], TableId>
|
|
1554
1601
|
? [
|
|
1555
|
-
store: Store
|
|
1602
|
+
store: Store,
|
|
1556
1603
|
tableId: TableId,
|
|
1557
1604
|
rowId: RowIdOrNull extends null ? Id : RowIdOrNull,
|
|
1558
1605
|
cellId: CellId,
|
|
@@ -1601,7 +1648,10 @@ export type CellListener<
|
|
|
1601
1648
|
* This has schema-based typing. The following is a simplified representation:
|
|
1602
1649
|
*
|
|
1603
1650
|
* ```ts override
|
|
1604
|
-
*
|
|
1651
|
+
* export type HasValuesListener<Store extends StoreAlias = StoreAlias> = (
|
|
1652
|
+
* store: Store,
|
|
1653
|
+
* hasValues: boolean,
|
|
1654
|
+
* ) => void;
|
|
1605
1655
|
* ```
|
|
1606
1656
|
*
|
|
1607
1657
|
* A HasValuesListener is provided when using the addHasValuesListener method.
|
|
@@ -1615,10 +1665,10 @@ export type CellListener<
|
|
|
1615
1665
|
* @category Listener
|
|
1616
1666
|
* @since v4.4.0
|
|
1617
1667
|
*/
|
|
1618
|
-
export type HasValuesListener<
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
) => void;
|
|
1668
|
+
export type HasValuesListener<
|
|
1669
|
+
Schemas extends OptionalSchemas,
|
|
1670
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1671
|
+
> = (store: Store, hasValues: boolean) => void;
|
|
1622
1672
|
|
|
1623
1673
|
/**
|
|
1624
1674
|
* The ValuesListener type describes a function that is used to listen to
|
|
@@ -1627,7 +1677,7 @@ export type HasValuesListener<Schemas extends OptionalSchemas> = (
|
|
|
1627
1677
|
* This has schema-based typing. The following is a simplified representation:
|
|
1628
1678
|
*
|
|
1629
1679
|
* ```ts override
|
|
1630
|
-
* (
|
|
1680
|
+
* export type ValuesListener<Store extends StoreAlias = StoreAlias> = (
|
|
1631
1681
|
* store: Store,
|
|
1632
1682
|
* getValueChange: GetValueChange | undefined,
|
|
1633
1683
|
* ) => void;
|
|
@@ -1648,8 +1698,11 @@ export type HasValuesListener<Schemas extends OptionalSchemas> = (
|
|
|
1648
1698
|
* changes.
|
|
1649
1699
|
* @category Listener
|
|
1650
1700
|
*/
|
|
1651
|
-
export type ValuesListener<
|
|
1652
|
-
|
|
1701
|
+
export type ValuesListener<
|
|
1702
|
+
Schemas extends OptionalSchemas,
|
|
1703
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1704
|
+
> = (
|
|
1705
|
+
store: Store,
|
|
1653
1706
|
getValueChange: GetValueChange<Schemas[1]> | undefined,
|
|
1654
1707
|
) => void;
|
|
1655
1708
|
|
|
@@ -1660,7 +1713,7 @@ export type ValuesListener<Schemas extends OptionalSchemas> = (
|
|
|
1660
1713
|
* This has schema-based typing. The following is a simplified representation:
|
|
1661
1714
|
*
|
|
1662
1715
|
* ```ts override
|
|
1663
|
-
* (
|
|
1716
|
+
* export type ValueIdsListener<Store extends StoreAlias = StoreAlias> = (
|
|
1664
1717
|
* store: Store,
|
|
1665
1718
|
* getIdChanges: GetIdChanges | undefined,
|
|
1666
1719
|
* ) => void;
|
|
@@ -1678,8 +1731,11 @@ export type ValuesListener<Schemas extends OptionalSchemas> = (
|
|
|
1678
1731
|
* since v3.3.
|
|
1679
1732
|
* @category Listener
|
|
1680
1733
|
*/
|
|
1681
|
-
export type ValueIdsListener<
|
|
1682
|
-
|
|
1734
|
+
export type ValueIdsListener<
|
|
1735
|
+
Schemas extends OptionalSchemas,
|
|
1736
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1737
|
+
> = (
|
|
1738
|
+
store: Store,
|
|
1683
1739
|
getIdChanges: GetIdChanges<ValueIdFromSchema<Schemas[1]>> | undefined,
|
|
1684
1740
|
) => void;
|
|
1685
1741
|
|
|
@@ -1690,7 +1746,7 @@ export type ValueIdsListener<Schemas extends OptionalSchemas> = (
|
|
|
1690
1746
|
* This has schema-based typing. The following is a simplified representation:
|
|
1691
1747
|
*
|
|
1692
1748
|
* ```ts override
|
|
1693
|
-
* (
|
|
1749
|
+
* export type HasValueListener<Store extends StoreAlias = StoreAlias> = (
|
|
1694
1750
|
* store: Store,
|
|
1695
1751
|
* valueId: Id,
|
|
1696
1752
|
* hasValue: boolean,
|
|
@@ -1713,8 +1769,9 @@ export type ValueIdsListener<Schemas extends OptionalSchemas> = (
|
|
|
1713
1769
|
export type HasValueListener<
|
|
1714
1770
|
Schemas extends OptionalSchemas,
|
|
1715
1771
|
ValueIdOrNull extends ValueIdFromSchema<Schemas[1]> | null,
|
|
1772
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1716
1773
|
> = (
|
|
1717
|
-
store: Store
|
|
1774
|
+
store: Store,
|
|
1718
1775
|
valueId: ValueIdOrNull extends null
|
|
1719
1776
|
? ValueIdFromSchema<Schemas[1]>
|
|
1720
1777
|
: ValueIdOrNull,
|
|
@@ -1728,7 +1785,7 @@ export type HasValueListener<
|
|
|
1728
1785
|
* This has schema-based typing. The following is a simplified representation:
|
|
1729
1786
|
*
|
|
1730
1787
|
* ```ts override
|
|
1731
|
-
* (
|
|
1788
|
+
* export type ValueListener<Store extends StoreAlias = StoreAlias> = (
|
|
1732
1789
|
* store: Store,
|
|
1733
1790
|
* valueId: Id,
|
|
1734
1791
|
* newValue: Value,
|
|
@@ -1761,12 +1818,13 @@ export type HasValueListener<
|
|
|
1761
1818
|
export type ValueListener<
|
|
1762
1819
|
Schemas extends OptionalSchemas,
|
|
1763
1820
|
ValueIdOrNull extends ValueIdFromSchema<Schemas[1]> | null,
|
|
1821
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1764
1822
|
Params extends any[] = (
|
|
1765
1823
|
ValueIdOrNull extends null ? ValueIdFromSchema<Schemas[1]> : ValueIdOrNull
|
|
1766
1824
|
) extends infer ValueId
|
|
1767
1825
|
? ValueId extends ValueIdFromSchema<Schemas[1]>
|
|
1768
1826
|
? [
|
|
1769
|
-
store: Store
|
|
1827
|
+
store: Store,
|
|
1770
1828
|
valueId: ValueId,
|
|
1771
1829
|
newValue: Value<Schemas[1], ValueId>,
|
|
1772
1830
|
oldValue: Value<Schemas[1], ValueId>,
|
|
@@ -1803,7 +1861,7 @@ export type ValueListener<
|
|
|
1803
1861
|
* This has schema-based typing. The following is a simplified representation:
|
|
1804
1862
|
*
|
|
1805
1863
|
* ```ts override
|
|
1806
|
-
* (
|
|
1864
|
+
* export type InvalidCellListener<Store extends StoreAlias = StoreAlias> = (
|
|
1807
1865
|
* store: Store,
|
|
1808
1866
|
* tableId: Id,
|
|
1809
1867
|
* rowId: Id,
|
|
@@ -1829,8 +1887,11 @@ export type ValueListener<
|
|
|
1829
1887
|
* @category Listener
|
|
1830
1888
|
* @since v1.1.0
|
|
1831
1889
|
*/
|
|
1832
|
-
export type InvalidCellListener<
|
|
1833
|
-
|
|
1890
|
+
export type InvalidCellListener<
|
|
1891
|
+
Schemas extends OptionalSchemas,
|
|
1892
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1893
|
+
> = (
|
|
1894
|
+
store: Store,
|
|
1834
1895
|
tableId: Id,
|
|
1835
1896
|
rowId: Id,
|
|
1836
1897
|
cellId: Id,
|
|
@@ -1844,7 +1905,7 @@ export type InvalidCellListener<Schemas extends OptionalSchemas> = (
|
|
|
1844
1905
|
* This has schema-based typing. The following is a simplified representation:
|
|
1845
1906
|
*
|
|
1846
1907
|
* ```ts override
|
|
1847
|
-
* (
|
|
1908
|
+
* export type InvalidValueListener<Store extends StoreAlias = StoreAlias> = (
|
|
1848
1909
|
* store: Store,
|
|
1849
1910
|
* valueId: Id,
|
|
1850
1911
|
* invalidValues: any[],
|
|
@@ -1866,11 +1927,10 @@ export type InvalidCellListener<Schemas extends OptionalSchemas> = (
|
|
|
1866
1927
|
* @category Listener
|
|
1867
1928
|
* @since v3.0.0
|
|
1868
1929
|
*/
|
|
1869
|
-
export type InvalidValueListener<
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
) => void;
|
|
1930
|
+
export type InvalidValueListener<
|
|
1931
|
+
Schemas extends OptionalSchemas,
|
|
1932
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1933
|
+
> = (store: Store, valueId: Id, invalidValues: any[]) => void;
|
|
1874
1934
|
|
|
1875
1935
|
/**
|
|
1876
1936
|
* The GetIdChanges type describes a function that returns information about the
|
|
@@ -2047,7 +2107,7 @@ export type ChangedCells<Schema extends OptionalTablesSchema> = {
|
|
|
2047
2107
|
* This has schema-based typing. The following is a simplified representation:
|
|
2048
2108
|
*
|
|
2049
2109
|
* ```ts override
|
|
2050
|
-
* [CellOrUndefined, CellOrUndefined];
|
|
2110
|
+
* [oldCell: CellOrUndefined, newCell: CellOrUndefined];
|
|
2051
2111
|
* ```
|
|
2052
2112
|
*
|
|
2053
2113
|
* It provides both the old and new Cell values in a two-part array. These are
|
|
@@ -2136,7 +2196,10 @@ export type ChangedValues<Schema extends OptionalValuesSchema> = {
|
|
|
2136
2196
|
* This has schema-based typing. The following is a simplified representation:
|
|
2137
2197
|
*
|
|
2138
2198
|
* ```ts override
|
|
2139
|
-
* [
|
|
2199
|
+
* [
|
|
2200
|
+
* oldValue: ValueOrUndefined,
|
|
2201
|
+
* newValue: ValueOrUndefined,
|
|
2202
|
+
* ];
|
|
2140
2203
|
* ```
|
|
2141
2204
|
*
|
|
2142
2205
|
* It provides both the the old and new Values in a two-part array. These
|
|
@@ -2178,47 +2241,89 @@ export type ChangedValue<
|
|
|
2178
2241
|
*/
|
|
2179
2242
|
export type InvalidValues = {[valueId: Id]: any[]};
|
|
2180
2243
|
|
|
2181
|
-
// TransactionChanges
|
|
2182
|
-
export type TransactionChanges<Schemas extends OptionalSchemas> = [
|
|
2183
|
-
{
|
|
2184
|
-
[TableId in TableIdFromSchema<Schemas[0]>]?: {
|
|
2185
|
-
[rowId: Id]:
|
|
2186
|
-
| {
|
|
2187
|
-
[CellId in CellIdFromSchema<Schemas[0], TableId>]?: Cell<
|
|
2188
|
-
Schemas[0],
|
|
2189
|
-
TableId,
|
|
2190
|
-
CellId
|
|
2191
|
-
> | null;
|
|
2192
|
-
}
|
|
2193
|
-
| null;
|
|
2194
|
-
} | null;
|
|
2195
|
-
},
|
|
2196
|
-
{
|
|
2197
|
-
[ValueId in ValueIdFromSchema<Schemas[1]>]?: Value<
|
|
2198
|
-
Schemas[1],
|
|
2199
|
-
ValueId
|
|
2200
|
-
> | null;
|
|
2201
|
-
},
|
|
2202
|
-
];
|
|
2203
|
-
|
|
2204
2244
|
/**
|
|
2205
|
-
* The
|
|
2206
|
-
*
|
|
2245
|
+
* The Changes type describes the net meaningful changes that were made to a
|
|
2246
|
+
* Store during a transaction.
|
|
2207
2247
|
*
|
|
2208
2248
|
* This has schema-based typing. The following is a simplified representation:
|
|
2209
2249
|
*
|
|
2210
2250
|
* ```ts override
|
|
2211
|
-
*
|
|
2251
|
+
* [
|
|
2252
|
+
* changedTables: {
|
|
2253
|
+
* [tableId: Id]:
|
|
2254
|
+
* | {[rowId: Id]: {[cellId: Id]: CellOrUndefined} | undefined}
|
|
2255
|
+
* | undefined;
|
|
2256
|
+
* },
|
|
2257
|
+
* changedValues: {[valueId: Id]: ValueOrUndefined},
|
|
2258
|
+
* isChanges: 1,
|
|
2259
|
+
* ];
|
|
2212
2260
|
* ```
|
|
2213
2261
|
*
|
|
2214
|
-
*
|
|
2215
|
-
*
|
|
2216
|
-
*
|
|
2262
|
+
* This contains mostly equivalent information to a TransactionLog, but in a
|
|
2263
|
+
* form that can be more efficiently parsed and serialized (for example in the
|
|
2264
|
+
* case of synchronization between systems).
|
|
2265
|
+
*
|
|
2266
|
+
* It is an array of two objects, representing tabular and keyed value changes.
|
|
2267
|
+
* If the first item is an empty object, it means no tabular changes were made.
|
|
2268
|
+
* If the second item is an empty object, it means no keyed value changes were
|
|
2269
|
+
* made.
|
|
2270
|
+
*
|
|
2271
|
+
* If not empty, the first object has an entry for each Table in a Store that
|
|
2272
|
+
* has had a change within it. If the entry is null, it means that whole Table
|
|
2273
|
+
* was deleted. Otherwise, the entry will be an object with an entry for each
|
|
2274
|
+
* Row in that Table that had a change within it. In turn, if that entry is
|
|
2275
|
+
* null, it means the Row was deleted. Otherwise, the entry will be an object
|
|
2276
|
+
* with an entry for each Cell in that Row that had a change within it. If the
|
|
2277
|
+
* entry is null, the Cell was deleted, otherwise it will contain the new value
|
|
2278
|
+
* the Cell was changed to during the transaction.
|
|
2279
|
+
*
|
|
2280
|
+
* If not empty, the second object has an entry for each Value in a Store that
|
|
2281
|
+
* has had a change. If the entry is null, the Value was deleted, otherwise it
|
|
2282
|
+
* will contain the new Value it was changed to during the transaction.
|
|
2283
|
+
*
|
|
2284
|
+
* A third, required, item in the array is the digit `1`, so that instances of
|
|
2285
|
+
* Content and Changes types can be disambiguated.
|
|
2286
|
+
* @example
|
|
2287
|
+
* The following is a valid Changes array that conveys the following:
|
|
2288
|
+
* ```json
|
|
2289
|
+
* [
|
|
2290
|
+
* { // changes to tabular data in the Store
|
|
2291
|
+
* "pets": { // this Table was changed
|
|
2292
|
+
* "fido": null, // this Row was deleted
|
|
2293
|
+
* "felix": { // this Row was changed
|
|
2294
|
+
* "sold": true, // this Cell was changed
|
|
2295
|
+
* "price": null, // this Cell was deleted
|
|
2296
|
+
* },
|
|
2297
|
+
* },
|
|
2298
|
+
* "pendingSales": null, // this Table was deleted
|
|
2299
|
+
* },
|
|
2300
|
+
* {}, // no changes to keyed value data in the Store
|
|
2301
|
+
* 1, // indicates that this is a Changes array
|
|
2302
|
+
* ]
|
|
2303
|
+
* ```
|
|
2217
2304
|
* @category Transaction
|
|
2218
2305
|
* @since v4.0.0
|
|
2219
2306
|
*/
|
|
2220
|
-
export type
|
|
2221
|
-
|
|
2307
|
+
export type Changes<Schemas extends OptionalSchemas> = [
|
|
2308
|
+
{
|
|
2309
|
+
[TableId in TableIdFromSchema<Schemas[0]>]?:
|
|
2310
|
+
| {
|
|
2311
|
+
[rowId: Id]:
|
|
2312
|
+
| {
|
|
2313
|
+
[CellId in CellIdFromSchema<
|
|
2314
|
+
Schemas[0],
|
|
2315
|
+
TableId
|
|
2316
|
+
>]?: CellOrUndefined<Schemas[0], TableId, CellId>;
|
|
2317
|
+
}
|
|
2318
|
+
| undefined;
|
|
2319
|
+
}
|
|
2320
|
+
| undefined;
|
|
2321
|
+
},
|
|
2322
|
+
{
|
|
2323
|
+
[ValueId in ValueIdFromSchema<Schemas[1]>]?: Value<Schemas[1], ValueId>;
|
|
2324
|
+
},
|
|
2325
|
+
isChanges: 1,
|
|
2326
|
+
];
|
|
2222
2327
|
|
|
2223
2328
|
/**
|
|
2224
2329
|
* The TransactionLog type describes the changes that were made to a Store
|
|
@@ -2227,21 +2332,21 @@ export type GetTransactionChanges<Schemas extends OptionalSchemas> =
|
|
|
2227
2332
|
* This has schema-based typing. The following is a simplified representation:
|
|
2228
2333
|
*
|
|
2229
2334
|
* ```ts override
|
|
2230
|
-
*
|
|
2231
|
-
* cellsTouched: boolean
|
|
2232
|
-
* valuesTouched: boolean
|
|
2233
|
-
* changedCells: ChangedCells
|
|
2234
|
-
* invalidCells: InvalidCells
|
|
2235
|
-
* changedValues: ChangedValues
|
|
2236
|
-
* invalidValues: InvalidValues
|
|
2237
|
-
* changedTableIds: ChangedTableIds
|
|
2238
|
-
* changedRowIds: ChangedRowIds
|
|
2239
|
-
* changedCellIds: ChangedCellIds
|
|
2240
|
-
* changedValueIds: ChangedValueIds
|
|
2241
|
-
*
|
|
2335
|
+
* [
|
|
2336
|
+
* cellsTouched: boolean,
|
|
2337
|
+
* valuesTouched: boolean,
|
|
2338
|
+
* changedCells: ChangedCells,
|
|
2339
|
+
* invalidCells: InvalidCells,
|
|
2340
|
+
* changedValues: ChangedValues,
|
|
2341
|
+
* invalidValues: InvalidValues,
|
|
2342
|
+
* changedTableIds: ChangedTableIds,
|
|
2343
|
+
* changedRowIds: ChangedRowIds,
|
|
2344
|
+
* changedCellIds: ChangedCellIds,
|
|
2345
|
+
* changedValueIds: ChangedValueIds,
|
|
2346
|
+
* ];
|
|
2242
2347
|
* ```
|
|
2243
2348
|
*
|
|
2244
|
-
* This contains equivalent information to a
|
|
2349
|
+
* This contains equivalent information to a Changes object, but also
|
|
2245
2350
|
* information about what the previous state of the Store was. The changedCells
|
|
2246
2351
|
* and changedValues entries contain information about all changes to those
|
|
2247
2352
|
* parts of the Store, with their before and after values, for example.
|
|
@@ -2257,6 +2362,9 @@ export type GetTransactionChanges<Schemas extends OptionalSchemas> =
|
|
|
2257
2362
|
* of `cellsTouched` and `valuesTouched` in the listener will be `false` because
|
|
2258
2363
|
* all changes have been reverted.
|
|
2259
2364
|
*
|
|
2365
|
+
* In v5.0, this type changed from an object to an array, but still contains the
|
|
2366
|
+
* same values.
|
|
2367
|
+
*
|
|
2260
2368
|
* See the documentation for the types of the inner objects for other details.
|
|
2261
2369
|
* @category Transaction
|
|
2262
2370
|
* @since v4.0.0
|
|
@@ -2274,25 +2382,6 @@ export type TransactionLog<Schemas extends OptionalSchemas> = {
|
|
|
2274
2382
|
changedValueIds: ChangedValueIds<Schemas[1]>;
|
|
2275
2383
|
};
|
|
2276
2384
|
|
|
2277
|
-
/**
|
|
2278
|
-
* The GetTransactionLog type describes a function that returns the changes that
|
|
2279
|
-
* were made to a Store during a transaction in detail.
|
|
2280
|
-
*
|
|
2281
|
-
* This has schema-based typing. The following is a simplified representation:
|
|
2282
|
-
*
|
|
2283
|
-
* ```ts override
|
|
2284
|
-
* () => TransactionLog;
|
|
2285
|
-
* ```
|
|
2286
|
-
*
|
|
2287
|
-
* It is provided to the DoRollback callback and to a TransactionListener
|
|
2288
|
-
* listener when a transaction completes. See the TransactionLog type for more
|
|
2289
|
-
* information.
|
|
2290
|
-
* @category Transaction
|
|
2291
|
-
* @since v4.0.0
|
|
2292
|
-
*/
|
|
2293
|
-
export type GetTransactionLog<Schemas extends OptionalSchemas> =
|
|
2294
|
-
() => TransactionLog<Schemas>;
|
|
2295
|
-
|
|
2296
2385
|
/**
|
|
2297
2386
|
* The StoreListenerStats type describes the number of listeners registered with
|
|
2298
2387
|
* the Store, and can be used for debugging purposes.
|
|
@@ -2602,7 +2691,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2602
2691
|
* This has schema-based typing. The following is a simplified representation:
|
|
2603
2692
|
*
|
|
2604
2693
|
* ```ts override
|
|
2605
|
-
* getContent():
|
|
2694
|
+
* getContent(): Content;
|
|
2606
2695
|
* ```
|
|
2607
2696
|
*
|
|
2608
2697
|
* Note that this returns a copy of, rather than a reference to the underlying
|
|
@@ -2631,7 +2720,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2631
2720
|
* @category Getter
|
|
2632
2721
|
* @since v4.0.0
|
|
2633
2722
|
*/
|
|
2634
|
-
getContent():
|
|
2723
|
+
getContent(): Content<Schemas>;
|
|
2635
2724
|
|
|
2636
2725
|
/**
|
|
2637
2726
|
* The getTables method returns a Tables object containing the entire tabular
|
|
@@ -3643,7 +3732,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3643
3732
|
* This has schema-based typing. The following is a simplified representation:
|
|
3644
3733
|
*
|
|
3645
3734
|
* ```ts override
|
|
3646
|
-
* setContent(
|
|
3735
|
+
* setContent(content: Content): this;
|
|
3647
3736
|
* ```
|
|
3648
3737
|
*
|
|
3649
3738
|
* This method will cause listeners to be called for any Table, Row, Cell,
|
|
@@ -3698,10 +3787,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3698
3787
|
* @category Setter
|
|
3699
3788
|
* @since v4.0.0
|
|
3700
3789
|
*/
|
|
3701
|
-
setContent(
|
|
3702
|
-
Tables<Schemas[0], true>,
|
|
3703
|
-
Values<Schemas[1], true>,
|
|
3704
|
-
]): Store<Schemas>;
|
|
3790
|
+
setContent(content: Content<Schemas, true>): this;
|
|
3705
3791
|
|
|
3706
3792
|
/**
|
|
3707
3793
|
* The setTables method takes an object and sets the entire tabular data of
|
|
@@ -3710,7 +3796,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3710
3796
|
* This has schema-based typing. The following is a simplified representation:
|
|
3711
3797
|
*
|
|
3712
3798
|
* ```ts override
|
|
3713
|
-
* setTables(tables: Tables):
|
|
3799
|
+
* setTables(tables: Tables): this;
|
|
3714
3800
|
* ```
|
|
3715
3801
|
*
|
|
3716
3802
|
* This method will cause listeners to be called for any Table, Row, Cell, or
|
|
@@ -3755,7 +3841,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3755
3841
|
* ```
|
|
3756
3842
|
* @category Setter
|
|
3757
3843
|
*/
|
|
3758
|
-
setTables(tables: Tables<Schemas[0], true>):
|
|
3844
|
+
setTables(tables: Tables<Schemas[0], true>): this;
|
|
3759
3845
|
|
|
3760
3846
|
/**
|
|
3761
3847
|
* The setTable method takes an object and sets the entire data of a single
|
|
@@ -3764,7 +3850,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3764
3850
|
* This has schema-based typing. The following is a simplified representation:
|
|
3765
3851
|
*
|
|
3766
3852
|
* ```ts override
|
|
3767
|
-
* setTable(tableId: Id, table: Table):
|
|
3853
|
+
* setTable(tableId: Id, table: Table): this;
|
|
3768
3854
|
* ```
|
|
3769
3855
|
*
|
|
3770
3856
|
* This method will cause listeners to be called for any Table, Row, Cell, or
|
|
@@ -3814,7 +3900,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3814
3900
|
setTable<TableId extends TableIdFromSchema<Schemas[0]>>(
|
|
3815
3901
|
tableId: TableId,
|
|
3816
3902
|
table: Table<Schemas[0], TableId, true>,
|
|
3817
|
-
):
|
|
3903
|
+
): this;
|
|
3818
3904
|
|
|
3819
3905
|
/**
|
|
3820
3906
|
* The setRow method takes an object and sets the entire data of a single Row
|
|
@@ -3823,7 +3909,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3823
3909
|
* This has schema-based typing. The following is a simplified representation:
|
|
3824
3910
|
*
|
|
3825
3911
|
* ```ts override
|
|
3826
|
-
* setRow(tableId: Id, rowId: Id, row: Row):
|
|
3912
|
+
* setRow(tableId: Id, rowId: Id, row: Row): this;
|
|
3827
3913
|
* ```
|
|
3828
3914
|
*
|
|
3829
3915
|
* This method will cause listeners to be called for any Table, Row, Cell, or
|
|
@@ -3873,7 +3959,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3873
3959
|
tableId: TableId,
|
|
3874
3960
|
rowId: Id,
|
|
3875
3961
|
row: Row<Schemas[0], TableId, true>,
|
|
3876
|
-
):
|
|
3962
|
+
): this;
|
|
3877
3963
|
|
|
3878
3964
|
/**
|
|
3879
3965
|
* The addRow method takes an object and creates a new Row in the Store,
|
|
@@ -3953,7 +4039,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3953
4039
|
* This has schema-based typing. The following is a simplified representation:
|
|
3954
4040
|
*
|
|
3955
4041
|
* ```ts override
|
|
3956
|
-
* setPartialRow(tableId: Id, rowId: Id, partialRow: Row):
|
|
4042
|
+
* setPartialRow(tableId: Id, rowId: Id, partialRow: Row): this;
|
|
3957
4043
|
* ```
|
|
3958
4044
|
*
|
|
3959
4045
|
* This method will cause listeners to be called for any Table, Row, Cell, or
|
|
@@ -4005,7 +4091,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4005
4091
|
tableId: TableId,
|
|
4006
4092
|
rowId: Id,
|
|
4007
4093
|
partialRow: Row<Schemas[0], TableId, true>,
|
|
4008
|
-
):
|
|
4094
|
+
): this;
|
|
4009
4095
|
|
|
4010
4096
|
/**
|
|
4011
4097
|
* The setCell method sets the value of a single Cell in the Store.
|
|
@@ -4013,7 +4099,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4013
4099
|
* This has schema-based typing. The following is a simplified representation:
|
|
4014
4100
|
*
|
|
4015
4101
|
* ```ts override
|
|
4016
|
-
* setCell(tableId: Id, rowId: Id, cellId: Id, cell: Cell | MapCell):
|
|
4102
|
+
* setCell(tableId: Id, rowId: Id, cellId: Id, cell: Cell | MapCell): this;
|
|
4017
4103
|
* ```
|
|
4018
4104
|
*
|
|
4019
4105
|
* This method will cause listeners to be called for any Table, Row, Cell, or
|
|
@@ -4078,7 +4164,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4078
4164
|
cell:
|
|
4079
4165
|
| Cell<Schemas[0], TableId, CellId>
|
|
4080
4166
|
| MapCell<Schemas[0], TableId, CellId>,
|
|
4081
|
-
):
|
|
4167
|
+
): this;
|
|
4082
4168
|
|
|
4083
4169
|
/**
|
|
4084
4170
|
* The setValues method takes an object and sets all the Values in the Store.
|
|
@@ -4086,7 +4172,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4086
4172
|
* This has schema-based typing. The following is a simplified representation:
|
|
4087
4173
|
*
|
|
4088
4174
|
* ```ts override
|
|
4089
|
-
* setValues(values: Values):
|
|
4175
|
+
* setValues(values: Values): this;
|
|
4090
4176
|
* ```
|
|
4091
4177
|
*
|
|
4092
4178
|
* This method will cause listeners to be called for any Value or Id changes
|
|
@@ -4131,7 +4217,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4131
4217
|
* @category Setter
|
|
4132
4218
|
* @since v3.0.0
|
|
4133
4219
|
*/
|
|
4134
|
-
setValues(values: Values<Schemas[1], true>):
|
|
4220
|
+
setValues(values: Values<Schemas[1], true>): this;
|
|
4135
4221
|
|
|
4136
4222
|
/**
|
|
4137
4223
|
* The setPartialValues method takes an object and sets its Values in the
|
|
@@ -4140,7 +4226,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4140
4226
|
* This has schema-based typing. The following is a simplified representation:
|
|
4141
4227
|
*
|
|
4142
4228
|
* ```ts override
|
|
4143
|
-
* setPartialValues(partialValues: Values):
|
|
4229
|
+
* setPartialValues(partialValues: Values): this;
|
|
4144
4230
|
* ```
|
|
4145
4231
|
*
|
|
4146
4232
|
* This method will cause listeners to be called for any Values or Id changes
|
|
@@ -4186,7 +4272,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4186
4272
|
* @category Setter
|
|
4187
4273
|
* @since v3.0.0
|
|
4188
4274
|
*/
|
|
4189
|
-
setPartialValues(partialValues: Values<Schemas[1], true>):
|
|
4275
|
+
setPartialValues(partialValues: Values<Schemas[1], true>): this;
|
|
4190
4276
|
|
|
4191
4277
|
/**
|
|
4192
4278
|
* The setValue method sets a single keyed Value in the Store.
|
|
@@ -4194,7 +4280,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4194
4280
|
* This has schema-based typing. The following is a simplified representation:
|
|
4195
4281
|
*
|
|
4196
4282
|
* ```ts override
|
|
4197
|
-
* setValue(valueId: Id, value: Value | MapValue):
|
|
4283
|
+
* setValue(valueId: Id, value: Value | MapValue): this;
|
|
4198
4284
|
* ```
|
|
4199
4285
|
*
|
|
4200
4286
|
* This method will cause listeners to be called for any Value, or Id changes
|
|
@@ -4248,34 +4334,35 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4248
4334
|
setValue<ValueId extends ValueIdFromSchema<Schemas[1]>>(
|
|
4249
4335
|
valueId: ValueId,
|
|
4250
4336
|
value: Value<Schemas[1], ValueId> | MapValue<Schemas[1], ValueId>,
|
|
4251
|
-
):
|
|
4337
|
+
): this;
|
|
4252
4338
|
|
|
4253
4339
|
/**
|
|
4254
|
-
* The
|
|
4255
|
-
* Store.
|
|
4340
|
+
* The applyChanges method applies a set of Changes to the Store.
|
|
4256
4341
|
*
|
|
4257
4342
|
* This has schema-based typing. The following is a simplified representation:
|
|
4258
4343
|
*
|
|
4259
4344
|
* ```ts override
|
|
4260
|
-
*
|
|
4345
|
+
* applyChanges(changes: Changes): this;
|
|
4261
4346
|
* ```
|
|
4262
4347
|
*
|
|
4263
|
-
* This method will take a
|
|
4264
|
-
*
|
|
4265
|
-
*
|
|
4266
|
-
*
|
|
4267
|
-
*
|
|
4348
|
+
* This method will take a Changes object (which is available at the end of a
|
|
4349
|
+
* transaction) and apply it to a Store. The most likely need to do this is to
|
|
4350
|
+
* take the changes made during the transaction of one Store, and apply it to
|
|
4351
|
+
* the content of _another_ Store - such as when persisting and synchronizing
|
|
4352
|
+
* data.
|
|
4268
4353
|
*
|
|
4269
|
-
* Any part of the provided
|
|
4270
|
-
*
|
|
4271
|
-
*
|
|
4354
|
+
* Any part of the provided Changes object are invalid (either because of its
|
|
4355
|
+
* type, or because it does not match the schemas associated with the Store)
|
|
4356
|
+
* will be ignored silently.
|
|
4272
4357
|
*
|
|
4273
4358
|
* The method returns a reference to the Store so that subsequent operations
|
|
4274
4359
|
* can be chained in a fluent style.
|
|
4275
|
-
*
|
|
4360
|
+
*
|
|
4361
|
+
* Prior to v5.0, this method was named `setTransactionChanges`.
|
|
4362
|
+
* @param changes The Changes to apply to the Store.
|
|
4276
4363
|
* @returns A reference to the Store.
|
|
4277
4364
|
* @example
|
|
4278
|
-
* This example applies a
|
|
4365
|
+
* This example applies a Changes object that sets a Cell and
|
|
4279
4366
|
* removes a Value.
|
|
4280
4367
|
*
|
|
4281
4368
|
* ```js
|
|
@@ -4283,32 +4370,21 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4283
4370
|
* .setTables({pets: {fido: {species: 'dog', color: 'brown'}}})
|
|
4284
4371
|
* .setValues({open: true});
|
|
4285
4372
|
*
|
|
4286
|
-
* store.
|
|
4287
|
-
* {pets: {fido: {color: 'black'}}},
|
|
4288
|
-
* {open: null},
|
|
4289
|
-
* ]);
|
|
4373
|
+
* store.applyChanges([{pets: {fido: {color: 'black'}}}, {open: null}]);
|
|
4290
4374
|
* console.log(store.getTables());
|
|
4291
4375
|
* // -> {pets: {fido: {species: 'dog', color: 'black'}}}
|
|
4292
4376
|
* console.log(store.getValues());
|
|
4293
4377
|
* // -> {}
|
|
4294
4378
|
* ```
|
|
4295
4379
|
* @category Setter
|
|
4296
|
-
* @since
|
|
4380
|
+
* @since v5.0.0
|
|
4297
4381
|
*/
|
|
4298
|
-
|
|
4299
|
-
transactionChanges: TransactionChanges<Schemas>,
|
|
4300
|
-
): Store<Schemas>;
|
|
4382
|
+
applyChanges(changes: Changes<Schemas>): this;
|
|
4301
4383
|
|
|
4302
4384
|
/**
|
|
4303
4385
|
* The setTablesJson method takes a string serialization of all of the Tables
|
|
4304
4386
|
* in the Store and attempts to update them to that.
|
|
4305
4387
|
*
|
|
4306
|
-
* This has schema-based typing. The following is a simplified representation:
|
|
4307
|
-
*
|
|
4308
|
-
* ```ts override
|
|
4309
|
-
* setTablesJson(tablesJson: Json): Store;
|
|
4310
|
-
* ```
|
|
4311
|
-
*
|
|
4312
4388
|
* If the JSON cannot be parsed, this will fail silently. If it can be parsed,
|
|
4313
4389
|
* it will then be subject to the same validation rules as the setTables
|
|
4314
4390
|
* method (according to the Tables type, and matching any TablesSchema
|
|
@@ -4337,18 +4413,12 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4337
4413
|
* @category Setter
|
|
4338
4414
|
* @since v3.0.0
|
|
4339
4415
|
*/
|
|
4340
|
-
setTablesJson(tablesJson: Json):
|
|
4416
|
+
setTablesJson(tablesJson: Json): this;
|
|
4341
4417
|
|
|
4342
4418
|
/**
|
|
4343
4419
|
* The setValuesJson method takes a string serialization of all of the Values
|
|
4344
4420
|
* in the Store and attempts to update them to those values.
|
|
4345
4421
|
*
|
|
4346
|
-
* This has schema-based typing. The following is a simplified representation:
|
|
4347
|
-
*
|
|
4348
|
-
* ```ts override
|
|
4349
|
-
* setValuesJson(valuesJson: Json): Store;
|
|
4350
|
-
* ```
|
|
4351
|
-
*
|
|
4352
4422
|
* If the JSON cannot be parsed, this will fail silently. If it can be parsed,
|
|
4353
4423
|
* it will then be subject to the same validation rules as the setValues
|
|
4354
4424
|
* method (according to the Values type, and matching any ValuesSchema
|
|
@@ -4377,18 +4447,12 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4377
4447
|
* @category Setter
|
|
4378
4448
|
* @since v3.0.0
|
|
4379
4449
|
*/
|
|
4380
|
-
setValuesJson(valuesJson: Json):
|
|
4450
|
+
setValuesJson(valuesJson: Json): this;
|
|
4381
4451
|
|
|
4382
4452
|
/**
|
|
4383
4453
|
* The setJson method takes a string serialization of all of the Tables and
|
|
4384
4454
|
* Values in the Store and attempts to update them to those values.
|
|
4385
4455
|
*
|
|
4386
|
-
* This has schema-based typing. The following is a simplified representation:
|
|
4387
|
-
*
|
|
4388
|
-
* ```ts override
|
|
4389
|
-
* setJson(tablesAndValuesJson: Json): Store;
|
|
4390
|
-
* ```
|
|
4391
|
-
*
|
|
4392
4456
|
* From v3.0 onwards, the serialization should be of an array with two
|
|
4393
4457
|
* entries. The first is the Tables object, the second the Values. In previous
|
|
4394
4458
|
* versions (before the existence of the Values data structure), it was a sole
|
|
@@ -4441,7 +4505,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4441
4505
|
* ```
|
|
4442
4506
|
* @category Setter
|
|
4443
4507
|
*/
|
|
4444
|
-
setJson(tablesAndValuesJson: Json):
|
|
4508
|
+
setJson(tablesAndValuesJson: Json): this;
|
|
4445
4509
|
|
|
4446
4510
|
/**
|
|
4447
4511
|
* The setTablesSchema method lets you specify the TablesSchema of the tabular
|
|
@@ -4450,7 +4514,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4450
4514
|
* This has schema-based typing. The following is a simplified representation:
|
|
4451
4515
|
*
|
|
4452
4516
|
* ```ts override
|
|
4453
|
-
* setTablesSchema(tablesSchema: TablesSchema):
|
|
4517
|
+
* setTablesSchema(tablesSchema: TablesSchema): this;
|
|
4454
4518
|
* ```
|
|
4455
4519
|
*
|
|
4456
4520
|
* Note that this may result in a change to data in the Store, as defaults are
|
|
@@ -4490,7 +4554,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4490
4554
|
* This has schema-based typing. The following is a simplified representation:
|
|
4491
4555
|
*
|
|
4492
4556
|
* ```ts override
|
|
4493
|
-
* setValuesSchema(valuesSchema: ValuesSchema):
|
|
4557
|
+
* setValuesSchema(valuesSchema: ValuesSchema): this;
|
|
4494
4558
|
* ```
|
|
4495
4559
|
*
|
|
4496
4560
|
* Note that this may result in a change to data in the Store, as defaults are
|
|
@@ -4527,7 +4591,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4527
4591
|
* This has schema-based typing. The following is a simplified representation:
|
|
4528
4592
|
*
|
|
4529
4593
|
* ```ts override
|
|
4530
|
-
* setSchema(tablesSchema: TablesSchema, valuesSchema?: ValuesSchema):
|
|
4594
|
+
* setSchema(tablesSchema: TablesSchema, valuesSchema?: ValuesSchema): this;
|
|
4531
4595
|
* ```
|
|
4532
4596
|
*
|
|
4533
4597
|
* Note that this may result in a change to data in the Store, as defaults are
|
|
@@ -4600,12 +4664,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4600
4664
|
* @example
|
|
4601
4665
|
* This example removes the data of a Store.
|
|
4602
4666
|
*
|
|
4603
|
-
* This has schema-based typing. The following is a simplified representation:
|
|
4604
|
-
*
|
|
4605
|
-
* ```ts override
|
|
4606
|
-
* delTables(): Store;
|
|
4607
|
-
* ```
|
|
4608
|
-
*
|
|
4609
4667
|
* ```js
|
|
4610
4668
|
* const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
|
|
4611
4669
|
*
|
|
@@ -4615,7 +4673,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4615
4673
|
* ```
|
|
4616
4674
|
* @category Deleter
|
|
4617
4675
|
*/
|
|
4618
|
-
delTables():
|
|
4676
|
+
delTables(): this;
|
|
4619
4677
|
|
|
4620
4678
|
/**
|
|
4621
4679
|
* The delTable method lets you remove a single Table from the Store.
|
|
@@ -4627,7 +4685,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4627
4685
|
* This has schema-based typing. The following is a simplified representation:
|
|
4628
4686
|
*
|
|
4629
4687
|
* ```ts override
|
|
4630
|
-
* delTable(tableId: Id):
|
|
4688
|
+
* delTable(tableId: Id): this;
|
|
4631
4689
|
* ```
|
|
4632
4690
|
*
|
|
4633
4691
|
* ```js
|
|
@@ -4642,7 +4700,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4642
4700
|
* ```
|
|
4643
4701
|
* @category Deleter
|
|
4644
4702
|
*/
|
|
4645
|
-
delTable(tableId: TableIdFromSchema<Schemas[0]>):
|
|
4703
|
+
delTable(tableId: TableIdFromSchema<Schemas[0]>): this;
|
|
4646
4704
|
|
|
4647
4705
|
/**
|
|
4648
4706
|
* The delRow method lets you remove a single Row from a Table.
|
|
@@ -4650,7 +4708,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4650
4708
|
* This has schema-based typing. The following is a simplified representation:
|
|
4651
4709
|
*
|
|
4652
4710
|
* ```ts override
|
|
4653
|
-
* delRow(tableId: Id, rowId: Id):
|
|
4711
|
+
* delRow(tableId: Id, rowId: Id): this;
|
|
4654
4712
|
* ```
|
|
4655
4713
|
*
|
|
4656
4714
|
* If this is the last Row in its Table, then that Table will be removed.
|
|
@@ -4671,7 +4729,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4671
4729
|
* ```
|
|
4672
4730
|
* @category Deleter
|
|
4673
4731
|
*/
|
|
4674
|
-
delRow(tableId: TableIdFromSchema<Schemas[0]>, rowId: Id):
|
|
4732
|
+
delRow(tableId: TableIdFromSchema<Schemas[0]>, rowId: Id): this;
|
|
4675
4733
|
|
|
4676
4734
|
/**
|
|
4677
4735
|
* The delCell method lets you remove a single Cell from a Row.
|
|
@@ -4679,7 +4737,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4679
4737
|
* This has schema-based typing. The following is a simplified representation:
|
|
4680
4738
|
*
|
|
4681
4739
|
* ```ts override
|
|
4682
|
-
* delCell(tableId: Id, rowId: Id, cellId: Id, forceDel?: boolean):
|
|
4740
|
+
* delCell(tableId: Id, rowId: Id, cellId: Id, forceDel?: boolean): this;
|
|
4683
4741
|
* ```
|
|
4684
4742
|
*
|
|
4685
4743
|
* When there is no TablesSchema applied to the Store, then if this is the
|
|
@@ -4765,17 +4823,11 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4765
4823
|
rowId: Id,
|
|
4766
4824
|
cellId: CellIdFromSchema<Schemas[0], TableId>,
|
|
4767
4825
|
forceDel?: boolean,
|
|
4768
|
-
):
|
|
4826
|
+
): this;
|
|
4769
4827
|
|
|
4770
4828
|
/**
|
|
4771
4829
|
* The delValues method lets you remove all the Values from a Store.
|
|
4772
4830
|
*
|
|
4773
|
-
* This has schema-based typing. The following is a simplified representation:
|
|
4774
|
-
*
|
|
4775
|
-
* ```ts override
|
|
4776
|
-
* delValues(): Store;
|
|
4777
|
-
* ```
|
|
4778
|
-
*
|
|
4779
4831
|
* If there is a ValuesSchema applied to the Store and it specifies a default
|
|
4780
4832
|
* value for any Value Id, then deletion will result in it being set back to
|
|
4781
4833
|
* its default value.
|
|
@@ -4809,7 +4861,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4809
4861
|
* @category Deleter
|
|
4810
4862
|
* @since v3.0.0
|
|
4811
4863
|
*/
|
|
4812
|
-
delValues():
|
|
4864
|
+
delValues(): this;
|
|
4813
4865
|
|
|
4814
4866
|
/**
|
|
4815
4867
|
* The delValue method lets you remove a single Value from a Store.
|
|
@@ -4817,7 +4869,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4817
4869
|
* This has schema-based typing. The following is a simplified representation:
|
|
4818
4870
|
*
|
|
4819
4871
|
* ```ts override
|
|
4820
|
-
* delValue(valueId: Id):
|
|
4872
|
+
* delValue(valueId: Id): this;
|
|
4821
4873
|
* ```
|
|
4822
4874
|
*
|
|
4823
4875
|
* If there is a ValuesSchema applied to the Store and it specifies a default
|
|
@@ -4854,7 +4906,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4854
4906
|
* @category Deleter
|
|
4855
4907
|
* @since v3.0.0
|
|
4856
4908
|
*/
|
|
4857
|
-
delValue(valueId: ValueIdFromSchema<Schemas[1]>):
|
|
4909
|
+
delValue(valueId: ValueIdFromSchema<Schemas[1]>): this;
|
|
4858
4910
|
|
|
4859
4911
|
/**
|
|
4860
4912
|
* The delTablesSchema method lets you remove the TablesSchema of the Store.
|
|
@@ -4865,7 +4917,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4865
4917
|
* This has schema-based typing. The following is a simplified representation:
|
|
4866
4918
|
*
|
|
4867
4919
|
* ```ts override
|
|
4868
|
-
* delTablesSchema():
|
|
4920
|
+
* delTablesSchema(): this;
|
|
4869
4921
|
* ```
|
|
4870
4922
|
*
|
|
4871
4923
|
* ```js
|
|
@@ -4891,7 +4943,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4891
4943
|
* This has schema-based typing. The following is a simplified representation:
|
|
4892
4944
|
*
|
|
4893
4945
|
* ```ts override
|
|
4894
|
-
* delValuesSchema():
|
|
4946
|
+
* delValuesSchema(): this;
|
|
4895
4947
|
* ```
|
|
4896
4948
|
*
|
|
4897
4949
|
* ```js
|
|
@@ -4916,7 +4968,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4916
4968
|
* This has schema-based typing. The following is a simplified representation:
|
|
4917
4969
|
*
|
|
4918
4970
|
* ```ts override
|
|
4919
|
-
* delSchema():
|
|
4971
|
+
* delSchema(): this;
|
|
4920
4972
|
* ```
|
|
4921
4973
|
*
|
|
4922
4974
|
* Prior to v3.0, this method removed the TablesSchema only.
|
|
@@ -4971,10 +5023,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4971
5023
|
*
|
|
4972
5024
|
* The second, optional parameter, `doRollback` is a DoRollback callback that
|
|
4973
5025
|
* you can use to rollback the transaction if it did not complete to your
|
|
4974
|
-
* satisfaction.
|
|
4975
|
-
* `getTransactionLog` parameters, which inform you of the net changes that
|
|
4976
|
-
* have been made during the transaction, at different levels of detail. See
|
|
4977
|
-
* the DoRollback documentation for more details.
|
|
5026
|
+
* satisfaction. See the DoRollback documentation for more details.
|
|
4978
5027
|
* @param actions The function to be executed as a transaction.
|
|
4979
5028
|
* @param doRollback An optional callback that should return `true` if you
|
|
4980
5029
|
* want to rollback the transaction at the end. Since v1.2.
|
|
@@ -5050,9 +5099,9 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5050
5099
|
* .setCell('pets', 'fido', 'info', {sold: null})
|
|
5051
5100
|
* .setValue('open', false)
|
|
5052
5101
|
* .setValue('employees', ['alice', 'bob']),
|
|
5053
|
-
* (
|
|
5054
|
-
* const
|
|
5055
|
-
* getTransactionLog();
|
|
5102
|
+
* () => {
|
|
5103
|
+
* const [, , changedCells, invalidCells, changedValues, invalidValues] =
|
|
5104
|
+
* store.getTransactionLog();
|
|
5056
5105
|
* console.log(store.getTables());
|
|
5057
5106
|
* console.log(changedCells);
|
|
5058
5107
|
* console.log(invalidCells);
|
|
@@ -5085,12 +5134,6 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5085
5134
|
* relevant listeners until it completes when you call the finishTransaction
|
|
5086
5135
|
* method.
|
|
5087
5136
|
*
|
|
5088
|
-
* This has schema-based typing. The following is a simplified representation:
|
|
5089
|
-
*
|
|
5090
|
-
* ```ts override
|
|
5091
|
-
* startTransaction(): Store;
|
|
5092
|
-
* ```
|
|
5093
|
-
*
|
|
5094
5137
|
* Transactions are useful for making bulk changes to the data in a Store, and
|
|
5095
5138
|
* when you don't want listeners to be called as you make each change. Changes
|
|
5096
5139
|
* are made silently during the transaction, and listeners relevant to the
|
|
@@ -5133,7 +5176,94 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5133
5176
|
* @category Transaction
|
|
5134
5177
|
* @since v1.3.0
|
|
5135
5178
|
*/
|
|
5136
|
-
startTransaction():
|
|
5179
|
+
startTransaction(): this;
|
|
5180
|
+
|
|
5181
|
+
/**
|
|
5182
|
+
* The getTransactionChanges method returns the net meaningful changes that
|
|
5183
|
+
* have been made to a Store during a transaction.
|
|
5184
|
+
*
|
|
5185
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
5186
|
+
*
|
|
5187
|
+
* ```ts override
|
|
5188
|
+
* getTransactionChanges(): Changes;
|
|
5189
|
+
* ```
|
|
5190
|
+
*
|
|
5191
|
+
* This is useful for deciding whether to rollback a transaction, for example.
|
|
5192
|
+
* The returned object is only meaningful if the method is called when the
|
|
5193
|
+
* Store is in a transaction - such as in a TransactionListener.
|
|
5194
|
+
* @example
|
|
5195
|
+
* This example makes changes to the Store. At the end of the transaction,
|
|
5196
|
+
* detail about what changed is enumerated.
|
|
5197
|
+
*
|
|
5198
|
+
* ```js
|
|
5199
|
+
* const store = createStore()
|
|
5200
|
+
* .setTables({pets: {fido: {species: 'dog', color: 'brown'}}})
|
|
5201
|
+
* .setValues({open: true});
|
|
5202
|
+
*
|
|
5203
|
+
* store
|
|
5204
|
+
* .startTransaction()
|
|
5205
|
+
* .setCell('pets', 'fido', 'color', 'black')
|
|
5206
|
+
* .setValue('open', false)
|
|
5207
|
+
* .finishTransaction(() => {
|
|
5208
|
+
* const [changedCells, changedValues] = store.getTransactionChanges();
|
|
5209
|
+
* console.log(changedCells);
|
|
5210
|
+
* console.log(changedValues);
|
|
5211
|
+
* });
|
|
5212
|
+
* // -> {pets: {fido: {color: 'black'}}}
|
|
5213
|
+
* // -> {open: false}
|
|
5214
|
+
* ```
|
|
5215
|
+
* @category Transaction
|
|
5216
|
+
* @since v5.0.0
|
|
5217
|
+
*/
|
|
5218
|
+
getTransactionChanges(): Changes<Schemas>;
|
|
5219
|
+
|
|
5220
|
+
/**
|
|
5221
|
+
* The getTransactionLog method returns the changes that were made to a Store
|
|
5222
|
+
* during a transaction in more detail, including invalid changes, and what
|
|
5223
|
+
* previous values were.
|
|
5224
|
+
*
|
|
5225
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
5226
|
+
*
|
|
5227
|
+
* ```ts override
|
|
5228
|
+
* getTransactionLog(): TransactionLog;
|
|
5229
|
+
* ```
|
|
5230
|
+
*
|
|
5231
|
+
* This is useful for deciding whether to rollback a transaction, for example.
|
|
5232
|
+
* The returned object is only meaningful if the method is called when the
|
|
5233
|
+
* Store is in a transaction - such as in a TransactionListener.
|
|
5234
|
+
* @example
|
|
5235
|
+
* This example makes changes to the Store. At the end of the transaction,
|
|
5236
|
+
* detail about what changed is enumerated.
|
|
5237
|
+
*
|
|
5238
|
+
* ```js
|
|
5239
|
+
* const store = createStore()
|
|
5240
|
+
* .setTables({pets: {fido: {species: 'dog', color: 'brown'}}})
|
|
5241
|
+
* .setValues({open: true});
|
|
5242
|
+
*
|
|
5243
|
+
* store
|
|
5244
|
+
* .startTransaction()
|
|
5245
|
+
* .setCell('pets', 'fido', 'color', 'black')
|
|
5246
|
+
* .setCell('pets', 'fido', 'eyes', ['left', 'right'])
|
|
5247
|
+
* .setCell('pets', 'fido', 'info', {sold: null})
|
|
5248
|
+
* .setValue('open', false)
|
|
5249
|
+
* .setValue('employees', ['alice', 'bob'])
|
|
5250
|
+
* .finishTransaction(() => {
|
|
5251
|
+
* const [, , changedCells, invalidCells, changedValues, invalidValues] =
|
|
5252
|
+
* store.getTransactionLog();
|
|
5253
|
+
* console.log(changedCells);
|
|
5254
|
+
* console.log(invalidCells);
|
|
5255
|
+
* console.log(changedValues);
|
|
5256
|
+
* console.log(invalidValues);
|
|
5257
|
+
* });
|
|
5258
|
+
* // -> {pets: {fido: {color: ['brown', 'black']}}}
|
|
5259
|
+
* // -> {pets: {fido: {eyes: [['left', 'right']], info: [{sold: null}]}}}
|
|
5260
|
+
* // -> {open: [true, false]}
|
|
5261
|
+
* // -> {employees: [['alice', 'bob']]}
|
|
5262
|
+
* ```
|
|
5263
|
+
* @category Transaction
|
|
5264
|
+
* @since v5.0.0
|
|
5265
|
+
*/
|
|
5266
|
+
getTransactionLog(): TransactionLog<Schemas>;
|
|
5137
5267
|
|
|
5138
5268
|
/**
|
|
5139
5269
|
* The finishTransaction method allows you to explicitly finish a transaction
|
|
@@ -5143,7 +5273,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5143
5273
|
* This has schema-based typing. The following is a simplified representation:
|
|
5144
5274
|
*
|
|
5145
5275
|
* ```ts override
|
|
5146
|
-
* finishTransaction(doRollback?: DoRollback):
|
|
5276
|
+
* finishTransaction(doRollback?: DoRollback): this;
|
|
5147
5277
|
* ```
|
|
5148
5278
|
*
|
|
5149
5279
|
* Transactions are useful for making bulk changes to the data in a Store, and
|
|
@@ -5212,9 +5342,9 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5212
5342
|
* .setCell('pets', 'fido', 'info', {sold: null})
|
|
5213
5343
|
* .setValue('open', false)
|
|
5214
5344
|
* .setValue('employees', ['alice', 'bob'])
|
|
5215
|
-
* .finishTransaction((
|
|
5216
|
-
* const
|
|
5217
|
-
* getTransactionLog();
|
|
5345
|
+
* .finishTransaction(() => {
|
|
5346
|
+
* const [, , changedCells, invalidCells, changedValues, invalidValues] =
|
|
5347
|
+
* store.getTransactionLog();
|
|
5218
5348
|
* console.log(store.getTables());
|
|
5219
5349
|
* console.log(changedCells);
|
|
5220
5350
|
* console.log(invalidCells);
|
|
@@ -5236,7 +5366,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5236
5366
|
* @category Transaction
|
|
5237
5367
|
* @since v1.3.0
|
|
5238
5368
|
*/
|
|
5239
|
-
finishTransaction(doRollback?: DoRollback<Schemas>):
|
|
5369
|
+
finishTransaction(doRollback?: DoRollback<Schemas>): this;
|
|
5240
5370
|
|
|
5241
5371
|
/**
|
|
5242
5372
|
* The forEachTable method takes a function that it will then call for each
|
|
@@ -5432,7 +5562,10 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5432
5562
|
* This has schema-based typing. The following is a simplified representation:
|
|
5433
5563
|
*
|
|
5434
5564
|
* ```ts override
|
|
5435
|
-
* addHasTablesListener(
|
|
5565
|
+
* addHasTablesListener(
|
|
5566
|
+
* listener: HasTablesListener<this>,
|
|
5567
|
+
* mutator?: boolean,
|
|
5568
|
+
* ): Id;
|
|
5436
5569
|
* ```
|
|
5437
5570
|
*
|
|
5438
5571
|
* The provided listener is a HasTablesListener function, and will be called
|
|
@@ -5494,7 +5627,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5494
5627
|
* @since v4.4.0
|
|
5495
5628
|
*/
|
|
5496
5629
|
addHasTablesListener(
|
|
5497
|
-
listener: HasTablesListener<Schemas>,
|
|
5630
|
+
listener: HasTablesListener<Schemas, this>,
|
|
5498
5631
|
mutator?: boolean,
|
|
5499
5632
|
): Id;
|
|
5500
5633
|
|
|
@@ -5505,7 +5638,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5505
5638
|
* This has schema-based typing. The following is a simplified representation:
|
|
5506
5639
|
*
|
|
5507
5640
|
* ```ts override
|
|
5508
|
-
* addTablesListener(listener: TablesListener
|
|
5641
|
+
* addTablesListener(listener: TablesListener<this>, mutator?: boolean): Id;
|
|
5509
5642
|
* ```
|
|
5510
5643
|
*
|
|
5511
5644
|
* The provided listener is a TablesListener function, and will be called with
|
|
@@ -5565,7 +5698,10 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5565
5698
|
* ```
|
|
5566
5699
|
* @category Listener
|
|
5567
5700
|
*/
|
|
5568
|
-
addTablesListener(
|
|
5701
|
+
addTablesListener(
|
|
5702
|
+
listener: TablesListener<Schemas, this>,
|
|
5703
|
+
mutator?: boolean,
|
|
5704
|
+
): Id;
|
|
5569
5705
|
|
|
5570
5706
|
/**
|
|
5571
5707
|
* The addTableIdsListener method registers a listener function with the Store
|
|
@@ -5574,7 +5710,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5574
5710
|
* This has schema-based typing. The following is a simplified representation:
|
|
5575
5711
|
*
|
|
5576
5712
|
* ```ts override
|
|
5577
|
-
* addTableIdsListener(listener: TableIdsListener
|
|
5713
|
+
* addTableIdsListener(listener: TableIdsListener<this>, mutator?: boolean): Id;
|
|
5578
5714
|
* ```
|
|
5579
5715
|
*
|
|
5580
5716
|
* The provided listener is a TableIdsListener function, and will be called
|
|
@@ -5634,7 +5770,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5634
5770
|
* @category Listener
|
|
5635
5771
|
*/
|
|
5636
5772
|
addTableIdsListener(
|
|
5637
|
-
listener: TableIdsListener<Schemas>,
|
|
5773
|
+
listener: TableIdsListener<Schemas, this>,
|
|
5638
5774
|
mutator?: boolean,
|
|
5639
5775
|
): Id;
|
|
5640
5776
|
|
|
@@ -5647,7 +5783,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5647
5783
|
* ```ts override
|
|
5648
5784
|
* addHasTableListener(
|
|
5649
5785
|
* tableId: IdOrNull,
|
|
5650
|
-
* listener: HasTableListener
|
|
5786
|
+
* listener: HasTableListener<this>,
|
|
5651
5787
|
* mutator?: boolean,
|
|
5652
5788
|
* ): Id;
|
|
5653
5789
|
* ```
|
|
@@ -5747,7 +5883,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5747
5883
|
TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null,
|
|
5748
5884
|
>(
|
|
5749
5885
|
tableId: TableIdOrNull,
|
|
5750
|
-
listener: HasTableListener<Schemas, TableIdOrNull>,
|
|
5886
|
+
listener: HasTableListener<Schemas, TableIdOrNull, this>,
|
|
5751
5887
|
mutator?: boolean,
|
|
5752
5888
|
): Id;
|
|
5753
5889
|
|
|
@@ -5760,7 +5896,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5760
5896
|
* ```ts override
|
|
5761
5897
|
* addTableListener(
|
|
5762
5898
|
* tableId: IdOrNull,
|
|
5763
|
-
* listener: TableListener
|
|
5899
|
+
* listener: TableListener<this>,
|
|
5764
5900
|
* mutator?: boolean,
|
|
5765
5901
|
* ): Id;
|
|
5766
5902
|
* ```
|
|
@@ -5853,7 +5989,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5853
5989
|
*/
|
|
5854
5990
|
addTableListener<TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null>(
|
|
5855
5991
|
tableId: TableIdOrNull,
|
|
5856
|
-
listener: TableListener<Schemas, TableIdOrNull>,
|
|
5992
|
+
listener: TableListener<Schemas, TableIdOrNull, this>,
|
|
5857
5993
|
mutator?: boolean,
|
|
5858
5994
|
): Id;
|
|
5859
5995
|
|
|
@@ -5867,7 +6003,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5867
6003
|
* ```ts override
|
|
5868
6004
|
* addTableCellIdsListener(
|
|
5869
6005
|
* tableId: IdOrNull,
|
|
5870
|
-
* listener: TableCellIdsListener
|
|
6006
|
+
* listener: TableCellIdsListener<this>,
|
|
5871
6007
|
* mutator?: boolean,
|
|
5872
6008
|
* ): Id;
|
|
5873
6009
|
* ```
|
|
@@ -5969,7 +6105,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5969
6105
|
TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null,
|
|
5970
6106
|
>(
|
|
5971
6107
|
tableId: TableIdOrNull,
|
|
5972
|
-
listener: TableCellIdsListener<Schemas, TableIdOrNull>,
|
|
6108
|
+
listener: TableCellIdsListener<Schemas, TableIdOrNull, this>,
|
|
5973
6109
|
mutator?: boolean,
|
|
5974
6110
|
): Id;
|
|
5975
6111
|
|
|
@@ -5984,7 +6120,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5984
6120
|
* addHasTableCellListener(
|
|
5985
6121
|
* tableId: IdOrNull,
|
|
5986
6122
|
* cellId: IdOrNull,
|
|
5987
|
-
* listener: HasTableCellListener
|
|
6123
|
+
* listener: HasTableCellListener<this>,
|
|
5988
6124
|
* mutator?: boolean,
|
|
5989
6125
|
* ): Id;
|
|
5990
6126
|
* ```
|
|
@@ -6106,7 +6242,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6106
6242
|
>(
|
|
6107
6243
|
tableId: TableIdOrNull,
|
|
6108
6244
|
cellId: CellIdOrNull,
|
|
6109
|
-
listener: HasTableCellListener<Schemas, TableIdOrNull, CellIdOrNull>,
|
|
6245
|
+
listener: HasTableCellListener<Schemas, TableIdOrNull, CellIdOrNull, this>,
|
|
6110
6246
|
mutator?: boolean,
|
|
6111
6247
|
): Id;
|
|
6112
6248
|
|
|
@@ -6119,7 +6255,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6119
6255
|
* ```ts override
|
|
6120
6256
|
* addRowCountListener(
|
|
6121
6257
|
* tableId: IdOrNull,
|
|
6122
|
-
* listener: RowCountListener
|
|
6258
|
+
* listener: RowCountListener<this>,
|
|
6123
6259
|
* mutator?: boolean,
|
|
6124
6260
|
* ): Id;
|
|
6125
6261
|
* ```
|
|
@@ -6211,7 +6347,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6211
6347
|
TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null,
|
|
6212
6348
|
>(
|
|
6213
6349
|
tableId: TableIdOrNull,
|
|
6214
|
-
listener: RowCountListener<Schemas, TableIdOrNull>,
|
|
6350
|
+
listener: RowCountListener<Schemas, TableIdOrNull, this>,
|
|
6215
6351
|
mutator?: boolean,
|
|
6216
6352
|
): Id;
|
|
6217
6353
|
|
|
@@ -6224,7 +6360,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6224
6360
|
* ```ts override
|
|
6225
6361
|
* addRowIdsListener(
|
|
6226
6362
|
* tableId: IdOrNull,
|
|
6227
|
-
* listener: RowIdsListener
|
|
6363
|
+
* listener: RowIdsListener<this>,
|
|
6228
6364
|
* mutator?: boolean,
|
|
6229
6365
|
* ): Id;
|
|
6230
6366
|
* ```
|
|
@@ -6312,7 +6448,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6312
6448
|
*/
|
|
6313
6449
|
addRowIdsListener<TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null>(
|
|
6314
6450
|
tableId: TableIdOrNull,
|
|
6315
|
-
listener: RowIdsListener<Schemas, TableIdOrNull>,
|
|
6451
|
+
listener: RowIdsListener<Schemas, TableIdOrNull, this>,
|
|
6316
6452
|
mutator?: boolean,
|
|
6317
6453
|
): Id;
|
|
6318
6454
|
|
|
@@ -6330,7 +6466,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6330
6466
|
* descending: boolean,
|
|
6331
6467
|
* offset: number,
|
|
6332
6468
|
* limit: number | undefined,
|
|
6333
|
-
* listener: SortedRowIdsListener
|
|
6469
|
+
* listener: SortedRowIdsListener<this>,
|
|
6334
6470
|
* mutator?: boolean,
|
|
6335
6471
|
* ): Id;
|
|
6336
6472
|
* ```
|
|
@@ -6563,7 +6699,8 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6563
6699
|
CellIdOrUndefined,
|
|
6564
6700
|
Descending,
|
|
6565
6701
|
Offset,
|
|
6566
|
-
Limit
|
|
6702
|
+
Limit,
|
|
6703
|
+
this
|
|
6567
6704
|
>,
|
|
6568
6705
|
mutator?: boolean,
|
|
6569
6706
|
): Id;
|
|
@@ -6578,7 +6715,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6578
6715
|
* addHasRowListener(
|
|
6579
6716
|
* tableId: IdOrNull,
|
|
6580
6717
|
* rowId: IdOrNull,
|
|
6581
|
-
* listener: HasRowListener
|
|
6718
|
+
* listener: HasRowListener<this>,
|
|
6582
6719
|
* mutator?: boolean,
|
|
6583
6720
|
* ): Id;
|
|
6584
6721
|
* ```
|
|
@@ -6695,7 +6832,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6695
6832
|
>(
|
|
6696
6833
|
tableId: TableIdOrNull,
|
|
6697
6834
|
rowId: RowIdOrNull,
|
|
6698
|
-
listener: HasRowListener<Schemas, TableIdOrNull, RowIdOrNull>,
|
|
6835
|
+
listener: HasRowListener<Schemas, TableIdOrNull, RowIdOrNull, this>,
|
|
6699
6836
|
mutator?: boolean,
|
|
6700
6837
|
): Id;
|
|
6701
6838
|
|
|
@@ -6709,7 +6846,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6709
6846
|
* addRowListener(
|
|
6710
6847
|
* tableId: IdOrNull,
|
|
6711
6848
|
* rowId: IdOrNull,
|
|
6712
|
-
* listener: RowListener
|
|
6849
|
+
* listener: RowListener<this>,
|
|
6713
6850
|
* mutator?: boolean,
|
|
6714
6851
|
* ): Id;
|
|
6715
6852
|
* ```
|
|
@@ -6818,7 +6955,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6818
6955
|
>(
|
|
6819
6956
|
tableId: TableIdOrNull,
|
|
6820
6957
|
rowId: RowIdOrNull,
|
|
6821
|
-
listener: RowListener<Schemas, TableIdOrNull, RowIdOrNull>,
|
|
6958
|
+
listener: RowListener<Schemas, TableIdOrNull, RowIdOrNull, this>,
|
|
6822
6959
|
mutator?: boolean,
|
|
6823
6960
|
): Id;
|
|
6824
6961
|
|
|
@@ -6832,7 +6969,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6832
6969
|
* addCellIdsListener(
|
|
6833
6970
|
* tableId: IdOrNull,
|
|
6834
6971
|
* rowId: IdOrNull,
|
|
6835
|
-
* listener: CellIdsListener
|
|
6972
|
+
* listener: CellIdsListener<this>,
|
|
6836
6973
|
* mutator?: boolean,
|
|
6837
6974
|
* ): Id;
|
|
6838
6975
|
* ```
|
|
@@ -6937,7 +7074,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6937
7074
|
>(
|
|
6938
7075
|
tableId: TableIdOrNull,
|
|
6939
7076
|
rowId: RowIdOrNull,
|
|
6940
|
-
listener: CellIdsListener<Schemas, TableIdOrNull, RowIdOrNull>,
|
|
7077
|
+
listener: CellIdsListener<Schemas, TableIdOrNull, RowIdOrNull, this>,
|
|
6941
7078
|
mutator?: boolean,
|
|
6942
7079
|
): Id;
|
|
6943
7080
|
|
|
@@ -6952,7 +7089,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6952
7089
|
* tableId: IdOrNull,
|
|
6953
7090
|
* rowId: IdOrNull,
|
|
6954
7091
|
* cellId: IdOrNull,
|
|
6955
|
-
* listener: HasCellListener
|
|
7092
|
+
* listener: HasCellListener<this>,
|
|
6956
7093
|
* mutator?: boolean,
|
|
6957
7094
|
* ): Id;
|
|
6958
7095
|
* ```
|
|
@@ -7085,7 +7222,8 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7085
7222
|
Schemas,
|
|
7086
7223
|
TableIdOrNull,
|
|
7087
7224
|
RowIdOrNull,
|
|
7088
|
-
CellIdOrNull
|
|
7225
|
+
CellIdOrNull,
|
|
7226
|
+
this
|
|
7089
7227
|
>,
|
|
7090
7228
|
mutator?: boolean,
|
|
7091
7229
|
): Id;
|
|
@@ -7101,7 +7239,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7101
7239
|
* tableId: IdOrNull,
|
|
7102
7240
|
* rowId: IdOrNull,
|
|
7103
7241
|
* cellId: IdOrNull,
|
|
7104
|
-
* listener: CellListener
|
|
7242
|
+
* listener: CellListener<this>,
|
|
7105
7243
|
* mutator?: boolean,
|
|
7106
7244
|
* ): Id;
|
|
7107
7245
|
* ```
|
|
@@ -7225,7 +7363,13 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7225
7363
|
tableId: TableIdOrNull,
|
|
7226
7364
|
rowId: RowIdOrNull,
|
|
7227
7365
|
cellId: CellIdOrNull,
|
|
7228
|
-
listener: CellListener<
|
|
7366
|
+
listener: CellListener<
|
|
7367
|
+
Schemas,
|
|
7368
|
+
TableIdOrNull,
|
|
7369
|
+
RowIdOrNull,
|
|
7370
|
+
CellIdOrNull,
|
|
7371
|
+
this
|
|
7372
|
+
>,
|
|
7229
7373
|
mutator?: boolean,
|
|
7230
7374
|
): Id;
|
|
7231
7375
|
|
|
@@ -7237,7 +7381,10 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7237
7381
|
* This has schema-based typing. The following is a simplified representation:
|
|
7238
7382
|
*
|
|
7239
7383
|
* ```ts override
|
|
7240
|
-
* addHasValuesListener(
|
|
7384
|
+
* addHasValuesListener(
|
|
7385
|
+
* listener: HasValuesListener<this>,
|
|
7386
|
+
* mutator?: boolean,
|
|
7387
|
+
* ): Id;
|
|
7241
7388
|
* ```
|
|
7242
7389
|
*
|
|
7243
7390
|
* The provided listener is a HasValuesListener function, and will be called
|
|
@@ -7297,7 +7444,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7297
7444
|
* @since v4.4.0
|
|
7298
7445
|
*/
|
|
7299
7446
|
addHasValuesListener(
|
|
7300
|
-
listener: HasValuesListener<Schemas>,
|
|
7447
|
+
listener: HasValuesListener<Schemas, this>,
|
|
7301
7448
|
mutator?: boolean,
|
|
7302
7449
|
): Id;
|
|
7303
7450
|
|
|
@@ -7308,7 +7455,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7308
7455
|
* This has schema-based typing. The following is a simplified representation:
|
|
7309
7456
|
*
|
|
7310
7457
|
* ```ts override
|
|
7311
|
-
* addValuesListener(listener: ValuesListener
|
|
7458
|
+
* addValuesListener(listener: ValuesListener<this>, mutator?: boolean): Id;
|
|
7312
7459
|
* ```
|
|
7313
7460
|
*
|
|
7314
7461
|
* The provided listener is a ValuesListener function, and will be called with
|
|
@@ -7365,7 +7512,10 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7365
7512
|
* @category Listener
|
|
7366
7513
|
* @since v3.0.0
|
|
7367
7514
|
*/
|
|
7368
|
-
addValuesListener(
|
|
7515
|
+
addValuesListener(
|
|
7516
|
+
listener: ValuesListener<Schemas, this>,
|
|
7517
|
+
mutator?: boolean,
|
|
7518
|
+
): Id;
|
|
7369
7519
|
|
|
7370
7520
|
/**
|
|
7371
7521
|
* The addValueIdsListener method registers a listener function with the Store
|
|
@@ -7374,7 +7524,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7374
7524
|
* This has schema-based typing. The following is a simplified representation:
|
|
7375
7525
|
*
|
|
7376
7526
|
* ```ts override
|
|
7377
|
-
* addValueIdsListener(listener: ValueIdsListener
|
|
7527
|
+
* addValueIdsListener(listener: ValueIdsListener<this>, mutator?: boolean): Id;
|
|
7378
7528
|
* ```
|
|
7379
7529
|
*
|
|
7380
7530
|
* The provided listener is a ValueIdsListener function, and will be called
|
|
@@ -7435,7 +7585,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7435
7585
|
* @since v3.0.0
|
|
7436
7586
|
*/
|
|
7437
7587
|
addValueIdsListener(
|
|
7438
|
-
listener: ValueIdsListener<Schemas>,
|
|
7588
|
+
listener: ValueIdsListener<Schemas, this>,
|
|
7439
7589
|
mutator?: boolean,
|
|
7440
7590
|
): Id;
|
|
7441
7591
|
|
|
@@ -7448,7 +7598,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7448
7598
|
* ```ts override
|
|
7449
7599
|
* addHasValueListener(
|
|
7450
7600
|
* valueId: IdOrNull,
|
|
7451
|
-
* listener: HasValueListener
|
|
7601
|
+
* listener: HasValueListener<this>,
|
|
7452
7602
|
* mutator?: boolean,
|
|
7453
7603
|
* ): Id;
|
|
7454
7604
|
* ```
|
|
@@ -7542,7 +7692,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7542
7692
|
ValueIdOrNull extends ValueIdFromSchema<Schemas[1]> | null,
|
|
7543
7693
|
>(
|
|
7544
7694
|
valueId: ValueIdOrNull,
|
|
7545
|
-
listener: HasValueListener<Schemas, ValueIdOrNull>,
|
|
7695
|
+
listener: HasValueListener<Schemas, ValueIdOrNull, this>,
|
|
7546
7696
|
mutator?: boolean,
|
|
7547
7697
|
): Id;
|
|
7548
7698
|
|
|
@@ -7555,7 +7705,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7555
7705
|
* ```ts override
|
|
7556
7706
|
* addValueListener(
|
|
7557
7707
|
* valueId: IdOrNull,
|
|
7558
|
-
* listener: ValueListener
|
|
7708
|
+
* listener: ValueListener<this>,
|
|
7559
7709
|
* mutator?: boolean,
|
|
7560
7710
|
* ): Id;
|
|
7561
7711
|
* ```
|
|
@@ -7644,7 +7794,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7644
7794
|
*/
|
|
7645
7795
|
addValueListener<ValueIdOrNull extends ValueIdFromSchema<Schemas[1]> | null>(
|
|
7646
7796
|
valueId: ValueIdOrNull,
|
|
7647
|
-
listener: ValueListener<Schemas, ValueIdOrNull>,
|
|
7797
|
+
listener: ValueListener<Schemas, ValueIdOrNull, this>,
|
|
7648
7798
|
mutator?: boolean,
|
|
7649
7799
|
): Id;
|
|
7650
7800
|
|
|
@@ -7660,7 +7810,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7660
7810
|
* tableId: IdOrNull,
|
|
7661
7811
|
* rowId: IdOrNull,
|
|
7662
7812
|
* cellId: IdOrNull,
|
|
7663
|
-
* listener: InvalidCellListener
|
|
7813
|
+
* listener: InvalidCellListener<this>,
|
|
7664
7814
|
* mutator?: boolean,
|
|
7665
7815
|
* ): Id;
|
|
7666
7816
|
* ```
|
|
@@ -7886,7 +8036,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7886
8036
|
tableId: IdOrNull,
|
|
7887
8037
|
rowId: IdOrNull,
|
|
7888
8038
|
cellId: IdOrNull,
|
|
7889
|
-
listener: InvalidCellListener<Schemas>,
|
|
8039
|
+
listener: InvalidCellListener<Schemas, this>,
|
|
7890
8040
|
mutator?: boolean,
|
|
7891
8041
|
): Id;
|
|
7892
8042
|
|
|
@@ -7900,7 +8050,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7900
8050
|
* ```ts override
|
|
7901
8051
|
* addInvalidValueListener(
|
|
7902
8052
|
* valueId: IdOrNull,
|
|
7903
|
-
* listener: InvalidValueListener
|
|
8053
|
+
* listener: InvalidValueListener<this>,
|
|
7904
8054
|
* mutator?: boolean,
|
|
7905
8055
|
* ): Id;
|
|
7906
8056
|
* ```
|
|
@@ -8071,7 +8221,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8071
8221
|
*/
|
|
8072
8222
|
addInvalidValueListener(
|
|
8073
8223
|
valueId: IdOrNull,
|
|
8074
|
-
listener: InvalidValueListener<Schemas>,
|
|
8224
|
+
listener: InvalidValueListener<Schemas, this>,
|
|
8075
8225
|
mutator?: boolean,
|
|
8076
8226
|
): Id;
|
|
8077
8227
|
|
|
@@ -8082,7 +8232,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8082
8232
|
* This has schema-based typing. The following is a simplified representation:
|
|
8083
8233
|
*
|
|
8084
8234
|
* ```ts override
|
|
8085
|
-
* addStartTransactionListener(listener: TransactionListener): Id;
|
|
8235
|
+
* addStartTransactionListener(listener: TransactionListener<this>): Id;
|
|
8086
8236
|
* ```
|
|
8087
8237
|
*
|
|
8088
8238
|
* The provided TransactionListener will receive a reference to the Store and
|
|
@@ -8125,7 +8275,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8125
8275
|
* @category Listener
|
|
8126
8276
|
* @since v3.2.0
|
|
8127
8277
|
*/
|
|
8128
|
-
addStartTransactionListener(listener: TransactionListener<Schemas>): Id;
|
|
8278
|
+
addStartTransactionListener(listener: TransactionListener<Schemas, this>): Id;
|
|
8129
8279
|
|
|
8130
8280
|
/**
|
|
8131
8281
|
* The addWillFinishTransactionListener method registers a listener function
|
|
@@ -8135,7 +8285,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8135
8285
|
* This has schema-based typing. The following is a simplified representation:
|
|
8136
8286
|
*
|
|
8137
8287
|
* ```ts override
|
|
8138
|
-
* addWillFinishTransactionListener(listener: TransactionListener): Id;
|
|
8288
|
+
* addWillFinishTransactionListener(listener: TransactionListener<this>): Id;
|
|
8139
8289
|
* ```
|
|
8140
8290
|
*
|
|
8141
8291
|
* This is useful if you need to know that a set of listeners are about to be
|
|
@@ -8172,12 +8322,10 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8172
8322
|
* pets: {fido: {species: 'dog', color: 'brown'}},
|
|
8173
8323
|
* })
|
|
8174
8324
|
* .setValues({open: true, employees: 3});
|
|
8175
|
-
* const listenerId = store.addWillFinishTransactionListener(
|
|
8176
|
-
*
|
|
8177
|
-
*
|
|
8178
|
-
*
|
|
8179
|
-
* },
|
|
8180
|
-
* );
|
|
8325
|
+
* const listenerId = store.addWillFinishTransactionListener((store) => {
|
|
8326
|
+
* const [cellsTouched, valuesTouched] = store.getTransactionLog() ?? {};
|
|
8327
|
+
* console.log(`Cells/Values touched: ${cellsTouched}/${valuesTouched}`);
|
|
8328
|
+
* });
|
|
8181
8329
|
* const listenerId2 = store.addTablesListener(() =>
|
|
8182
8330
|
* console.log('Tables changed'),
|
|
8183
8331
|
* );
|
|
@@ -8219,7 +8367,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8219
8367
|
* // Transaction was rolled back.
|
|
8220
8368
|
*
|
|
8221
8369
|
* store.callListener(listenerId);
|
|
8222
|
-
* // -> 'Cells/Values touched:
|
|
8370
|
+
* // -> 'Cells/Values touched: false/false'
|
|
8223
8371
|
* // It is meaningless to call this listener directly.
|
|
8224
8372
|
*
|
|
8225
8373
|
* store
|
|
@@ -8230,7 +8378,9 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8230
8378
|
* @category Listener
|
|
8231
8379
|
* @since v1.3.0
|
|
8232
8380
|
*/
|
|
8233
|
-
addWillFinishTransactionListener(
|
|
8381
|
+
addWillFinishTransactionListener(
|
|
8382
|
+
listener: TransactionListener<Schemas, this>,
|
|
8383
|
+
): Id;
|
|
8234
8384
|
|
|
8235
8385
|
/**
|
|
8236
8386
|
* The addDidFinishTransactionListener method registers a listener function
|
|
@@ -8240,7 +8390,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8240
8390
|
* This has schema-based typing. The following is a simplified representation:
|
|
8241
8391
|
*
|
|
8242
8392
|
* ```ts override
|
|
8243
|
-
* addDidFinishTransactionListener(listener: TransactionListener): Id;
|
|
8393
|
+
* addDidFinishTransactionListener(listener: TransactionListener<this>): Id;
|
|
8244
8394
|
* ```
|
|
8245
8395
|
*
|
|
8246
8396
|
* This is useful if you need to know that a set of listeners have just been
|
|
@@ -8276,12 +8426,10 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8276
8426
|
* pets: {fido: {species: 'dog', color: 'brown'}},
|
|
8277
8427
|
* })
|
|
8278
8428
|
* .setValues({open: true, employees: 3});
|
|
8279
|
-
* const listenerId = store.addDidFinishTransactionListener(
|
|
8280
|
-
*
|
|
8281
|
-
*
|
|
8282
|
-
*
|
|
8283
|
-
* },
|
|
8284
|
-
* );
|
|
8429
|
+
* const listenerId = store.addDidFinishTransactionListener((store) => {
|
|
8430
|
+
* const [cellsTouched, valuesTouched] = store.getTransactionLog() ?? {};
|
|
8431
|
+
* console.log(`Cells/Values touched: ${cellsTouched}/${valuesTouched}`);
|
|
8432
|
+
* });
|
|
8285
8433
|
* const listenerId2 = store.addTablesListener(() =>
|
|
8286
8434
|
* console.log('Tables changed'),
|
|
8287
8435
|
* );
|
|
@@ -8323,7 +8471,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8323
8471
|
* // Transaction was rolled back.
|
|
8324
8472
|
*
|
|
8325
8473
|
* store.callListener(listenerId);
|
|
8326
|
-
* // -> 'Cells/Values touched:
|
|
8474
|
+
* // -> 'Cells/Values touched: false/false'
|
|
8327
8475
|
* // It is meaningless to call this listener directly.
|
|
8328
8476
|
*
|
|
8329
8477
|
* store
|
|
@@ -8334,18 +8482,14 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8334
8482
|
* @category Listener
|
|
8335
8483
|
* @since v1.3.0
|
|
8336
8484
|
*/
|
|
8337
|
-
addDidFinishTransactionListener(
|
|
8485
|
+
addDidFinishTransactionListener(
|
|
8486
|
+
listener: TransactionListener<Schemas, this>,
|
|
8487
|
+
): Id;
|
|
8338
8488
|
|
|
8339
8489
|
/**
|
|
8340
8490
|
* The callListener method provides a way for you to manually provoke a
|
|
8341
8491
|
* listener to be called, even if the underlying data hasn't changed.
|
|
8342
8492
|
*
|
|
8343
|
-
* This has schema-based typing. The following is a simplified representation:
|
|
8344
|
-
*
|
|
8345
|
-
* ```ts override
|
|
8346
|
-
* callListener(listenerId: Id): Store;
|
|
8347
|
-
* ```
|
|
8348
|
-
*
|
|
8349
8493
|
* This is useful when you are using mutator listeners to guarantee that data
|
|
8350
8494
|
* conforms to programmatic conditions, and those conditions change such that
|
|
8351
8495
|
* you need to update the Store in bulk.
|
|
@@ -8456,18 +8600,12 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8456
8600
|
* ```
|
|
8457
8601
|
* @category Listener
|
|
8458
8602
|
*/
|
|
8459
|
-
callListener(listenerId: Id):
|
|
8603
|
+
callListener(listenerId: Id): this;
|
|
8460
8604
|
|
|
8461
8605
|
/**
|
|
8462
8606
|
* The delListener method removes a listener that was previously added to the
|
|
8463
8607
|
* Store.
|
|
8464
8608
|
*
|
|
8465
|
-
* This has schema-based typing. The following is a simplified representation:
|
|
8466
|
-
*
|
|
8467
|
-
* ```ts override
|
|
8468
|
-
* delListener(listenerId: Id): Store;
|
|
8469
|
-
* ```
|
|
8470
|
-
*
|
|
8471
8609
|
* Use the Id returned by whichever method was used to add the listener. Note
|
|
8472
8610
|
* that the Store may re-use this Id for future listeners added to it.
|
|
8473
8611
|
* @param listenerId The Id of the listener to remove.
|
|
@@ -8494,7 +8632,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8494
8632
|
* ```
|
|
8495
8633
|
* @category Listener
|
|
8496
8634
|
*/
|
|
8497
|
-
delListener(listenerId: Id):
|
|
8635
|
+
delListener(listenerId: Id): this;
|
|
8498
8636
|
|
|
8499
8637
|
/**
|
|
8500
8638
|
* The getListenerStats method provides a set of statistics about the
|