tinybase 5.0.0-beta.1 → 5.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/mergeable-store.cjs +1 -0
- package/lib/cjs/mergeable-store.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-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-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/store.cjs +1 -1
- package/lib/cjs/store.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-es6/mergeable-store.cjs +1 -0
- package/lib/cjs-es6/mergeable-store.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-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-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/store.cjs +1 -1
- package/lib/cjs-es6/store.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/debug/mergeable-store.js +1863 -0
- package/lib/debug/persisters/persister-automerge.js +54 -53
- package/lib/debug/persisters/persister-browser.js +28 -18
- package/lib/debug/persisters/persister-cr-sqlite-wasm.js +80 -57
- package/lib/debug/persisters/persister-electric-sql.js +80 -57
- package/lib/debug/persisters/persister-expo-sqlite-next.js +80 -57
- package/lib/debug/persisters/persister-expo-sqlite.js +80 -57
- package/lib/debug/persisters/persister-file.js +27 -18
- package/lib/debug/persisters/persister-indexed-db.js +34 -23
- package/lib/debug/persisters/persister-partykit-client.js +26 -23
- package/lib/debug/persisters/persister-partykit-server.js +11 -21
- package/lib/debug/persisters/persister-remote.js +28 -18
- package/lib/debug/persisters/persister-sqlite-wasm.js +80 -57
- package/lib/debug/persisters/persister-sqlite3.js +80 -57
- package/lib/debug/persisters/persister-yjs.js +50 -48
- package/lib/debug/persisters.js +27 -18
- package/lib/debug/queries.js +2 -2
- package/lib/debug/store.js +63 -71
- package/lib/debug/tinybase.js +354 -90
- package/lib/debug/tools.js +13 -15
- package/lib/debug/ui-react-dom.js +115 -119
- package/lib/es6/mergeable-store.js +1 -0
- package/lib/es6/mergeable-store.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-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-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/store.js +1 -1
- package/lib/es6/store.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/mergeable-store.js +1 -0
- package/lib/mergeable-store.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-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-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/store.js +1 -1
- package/lib/store.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/mergeable-store.d.ts +79 -0
- package/lib/types/persisters/persister-automerge.d.ts +8 -7
- package/lib/types/persisters/persister-browser.d.ts +2 -0
- package/lib/types/persisters/persister-cr-sqlite-wasm.d.ts +1 -0
- package/lib/types/persisters/persister-electric-sql.d.ts +1 -0
- package/lib/types/persisters/persister-expo-sqlite-next.d.ts +1 -0
- package/lib/types/persisters/persister-expo-sqlite.d.ts +1 -0
- package/lib/types/persisters/persister-file.d.ts +1 -0
- package/lib/types/persisters/persister-indexed-db.d.ts +1 -0
- package/lib/types/persisters/persister-partykit-client.d.ts +1 -0
- package/lib/types/persisters/persister-partykit-server.d.ts +12 -8
- package/lib/types/persisters/persister-remote.d.ts +1 -0
- package/lib/types/persisters/persister-sqlite-wasm.d.ts +1 -0
- package/lib/types/persisters/persister-sqlite3.d.ts +1 -0
- package/lib/types/persisters/persister-yjs.d.ts +1 -0
- package/lib/types/persisters.d.ts +50 -30
- package/lib/types/store.d.ts +241 -186
- package/lib/types/tinybase.d.ts +1 -0
- package/lib/types/tools.d.ts +2 -2
- package/lib/types/ui-react.d.ts +1 -0
- package/lib/types/with-schemas/internal/store.d.ts +4 -0
- package/lib/types/with-schemas/mergeable-store.d.ts +112 -0
- package/lib/types/with-schemas/persisters/persister-automerge.d.ts +8 -7
- package/lib/types/with-schemas/persisters/persister-browser.d.ts +2 -0
- package/lib/types/with-schemas/persisters/persister-cr-sqlite-wasm.d.ts +1 -0
- package/lib/types/with-schemas/persisters/persister-electric-sql.d.ts +1 -0
- package/lib/types/with-schemas/persisters/persister-expo-sqlite-next.d.ts +1 -0
- package/lib/types/with-schemas/persisters/persister-expo-sqlite.d.ts +1 -0
- package/lib/types/with-schemas/persisters/persister-file.d.ts +1 -0
- package/lib/types/with-schemas/persisters/persister-indexed-db.d.ts +1 -0
- package/lib/types/with-schemas/persisters/persister-partykit-client.d.ts +1 -0
- package/lib/types/with-schemas/persisters/persister-partykit-server.d.ts +15 -11
- package/lib/types/with-schemas/persisters/persister-remote.d.ts +1 -0
- package/lib/types/with-schemas/persisters/persister-sqlite-wasm.d.ts +1 -0
- package/lib/types/with-schemas/persisters/persister-sqlite3.d.ts +1 -0
- package/lib/types/with-schemas/persisters/persister-yjs.d.ts +1 -0
- package/lib/types/with-schemas/persisters.d.ts +81 -45
- package/lib/types/with-schemas/store.d.ts +364 -273
- package/lib/types/with-schemas/tinybase.d.ts +1 -0
- package/lib/types/with-schemas/tools.d.ts +2 -2
- package/lib/ui-react-dom.js +1 -1
- package/lib/ui-react-dom.js.gz +0 -0
- package/lib/umd/mergeable-store.js +1 -0
- package/lib/umd/mergeable-store.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-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-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/store.js +1 -1
- package/lib/umd/store.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-es6/mergeable-store.js +1 -0
- package/lib/umd-es6/mergeable-store.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-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-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/store.js +1 -1
- package/lib/umd-es6/store.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/package.json +39 -35
- package/readme.md +2 -2
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
DefaultValueIdFromSchema,
|
|
18
18
|
DefaultedCellFromSchema,
|
|
19
19
|
DefaultedValueFromSchema,
|
|
20
|
+
StoreAlias,
|
|
20
21
|
TableIdFromSchema,
|
|
21
22
|
Truncate,
|
|
22
23
|
ValueIdFromSchema,
|
|
@@ -166,6 +167,12 @@ export type OptionalSchemas = [OptionalTablesSchema, OptionalValuesSchema];
|
|
|
166
167
|
*/
|
|
167
168
|
export type NoSchemas = [NoTablesSchema, NoValuesSchema];
|
|
168
169
|
|
|
170
|
+
// Content
|
|
171
|
+
export type Content<
|
|
172
|
+
Schemas extends OptionalSchemas,
|
|
173
|
+
WhenSet extends boolean = false,
|
|
174
|
+
> = [Tables<Schemas[0], WhenSet>, Values<Schemas[1], WhenSet>];
|
|
175
|
+
|
|
169
176
|
/**
|
|
170
177
|
* The Tables type is the data structure representing all of the data in a
|
|
171
178
|
* Store.
|
|
@@ -787,28 +794,20 @@ export type ChangedValueIds<Schema extends OptionalValuesSchema> = {
|
|
|
787
794
|
* This has schema-based typing. The following is a simplified representation:
|
|
788
795
|
*
|
|
789
796
|
* ```ts override
|
|
790
|
-
* (
|
|
791
|
-
* getTransactionChanges: GetTransactionChanges,
|
|
792
|
-
* getTransactionLog: GetTransactionLog,
|
|
793
|
-
* ) => boolean;
|
|
797
|
+
* (store: Store) => boolean;
|
|
794
798
|
* ```
|
|
795
799
|
*
|
|
796
800
|
* A DoRollback can be provided when calling the transaction method or the
|
|
797
801
|
* finishTransaction method. See those methods for specific examples.
|
|
798
802
|
*
|
|
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.
|
|
803
|
+
* Since v5.0, this function is called with the Store as a single argument. You
|
|
804
|
+
* can use the getTransactionChanges method and getTransactionLog method of the
|
|
805
|
+
* Store directly to decide whether to do the rollback.
|
|
806
|
+
* @param store A reference to the Store that is completing a transaction.
|
|
807
807
|
* @category Callback
|
|
808
808
|
*/
|
|
809
809
|
export type DoRollback<Schemas extends OptionalSchemas> = (
|
|
810
|
-
|
|
811
|
-
getTransactionLog: GetTransactionLog<Schemas>,
|
|
810
|
+
store: Store<Schemas>,
|
|
812
811
|
) => boolean;
|
|
813
812
|
|
|
814
813
|
/**
|
|
@@ -818,10 +817,8 @@ export type DoRollback<Schemas extends OptionalSchemas> = (
|
|
|
818
817
|
* This has schema-based typing. The following is a simplified representation:
|
|
819
818
|
*
|
|
820
819
|
* ```ts override
|
|
821
|
-
* (
|
|
820
|
+
* export type TransactionListener<Store extends StoreAlias = StoreAlias> = (
|
|
822
821
|
* store: Store,
|
|
823
|
-
* getTransactionChanges: GetTransactionChanges,
|
|
824
|
-
* getTransactionLog: GetTransactionLog,
|
|
825
822
|
* ) => void;
|
|
826
823
|
* ```
|
|
827
824
|
*
|
|
@@ -829,22 +826,17 @@ export type DoRollback<Schemas extends OptionalSchemas> = (
|
|
|
829
826
|
* addWillFinishTransactionListener and addDidFinishTransactionListener methods.
|
|
830
827
|
* See those methods for specific examples.
|
|
831
828
|
*
|
|
832
|
-
*
|
|
833
|
-
*
|
|
834
|
-
*
|
|
835
|
-
*
|
|
829
|
+
* Since v5.0, this listener is called with no arguments other than the Store.
|
|
830
|
+
* You can use the getTransactionChanges method and getTransactionLog method of
|
|
831
|
+
* the Store directly to get information about the changes made within the
|
|
832
|
+
* transaction.
|
|
836
833
|
* @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
834
|
* @category Listener
|
|
842
835
|
*/
|
|
843
|
-
export type TransactionListener<
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
) => void;
|
|
836
|
+
export type TransactionListener<
|
|
837
|
+
Schemas extends OptionalSchemas,
|
|
838
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
839
|
+
> = (store: Store) => void;
|
|
848
840
|
|
|
849
841
|
/**
|
|
850
842
|
* The HasTablesListener type describes a function that is used to listen to
|
|
@@ -853,7 +845,10 @@ export type TransactionListener<Schemas extends OptionalSchemas> = (
|
|
|
853
845
|
* This has schema-based typing. The following is a simplified representation:
|
|
854
846
|
*
|
|
855
847
|
* ```ts override
|
|
856
|
-
*
|
|
848
|
+
* export type HasTablesListener<Store extends StoreAlias = StoreAlias> = (
|
|
849
|
+
* store: Store,
|
|
850
|
+
* hasTables: boolean,
|
|
851
|
+
* ) => void;
|
|
857
852
|
* ```
|
|
858
853
|
*
|
|
859
854
|
* A HasTablesListener is provided when using the addHasTablesListener method.
|
|
@@ -867,10 +862,10 @@ export type TransactionListener<Schemas extends OptionalSchemas> = (
|
|
|
867
862
|
* @category Listener
|
|
868
863
|
* @since v4.4.0
|
|
869
864
|
*/
|
|
870
|
-
export type HasTablesListener<
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
) => void;
|
|
865
|
+
export type HasTablesListener<
|
|
866
|
+
Schemas extends OptionalSchemas,
|
|
867
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
868
|
+
> = (store: Store, hasTables: boolean) => void;
|
|
874
869
|
|
|
875
870
|
/**
|
|
876
871
|
* The TablesListener type describes a function that is used to listen to
|
|
@@ -879,7 +874,7 @@ export type HasTablesListener<Schemas extends OptionalSchemas> = (
|
|
|
879
874
|
* This has schema-based typing. The following is a simplified representation:
|
|
880
875
|
*
|
|
881
876
|
* ```ts override
|
|
882
|
-
* (
|
|
877
|
+
* export type TablesListener<Store extends StoreAlias = StoreAlias> = (
|
|
883
878
|
* store: Store,
|
|
884
879
|
* getCellChange: GetCellChange | undefined,
|
|
885
880
|
* ) => void;
|
|
@@ -900,8 +895,11 @@ export type HasTablesListener<Schemas extends OptionalSchemas> = (
|
|
|
900
895
|
* changes.
|
|
901
896
|
* @category Listener
|
|
902
897
|
*/
|
|
903
|
-
export type TablesListener<
|
|
904
|
-
|
|
898
|
+
export type TablesListener<
|
|
899
|
+
Schemas extends OptionalSchemas,
|
|
900
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
901
|
+
> = (
|
|
902
|
+
store: Store,
|
|
905
903
|
getCellChange: GetCellChange<Schemas[0]> | undefined,
|
|
906
904
|
) => void;
|
|
907
905
|
|
|
@@ -912,7 +910,7 @@ export type TablesListener<Schemas extends OptionalSchemas> = (
|
|
|
912
910
|
* This has schema-based typing. The following is a simplified representation:
|
|
913
911
|
*
|
|
914
912
|
* ```ts override
|
|
915
|
-
* (
|
|
913
|
+
* export type TableIdsListener<Store extends StoreAlias = StoreAlias> = (
|
|
916
914
|
* store: Store,
|
|
917
915
|
* getIdChanges: GetIdChanges | undefined,
|
|
918
916
|
* ) => void;
|
|
@@ -930,8 +928,11 @@ export type TablesListener<Schemas extends OptionalSchemas> = (
|
|
|
930
928
|
* since v3.3.
|
|
931
929
|
* @category Listener
|
|
932
930
|
*/
|
|
933
|
-
export type TableIdsListener<
|
|
934
|
-
|
|
931
|
+
export type TableIdsListener<
|
|
932
|
+
Schemas extends OptionalSchemas,
|
|
933
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
934
|
+
> = (
|
|
935
|
+
store: Store,
|
|
935
936
|
getIdChanges: GetIdChanges<TableIdFromSchema<Schemas[0]>> | undefined,
|
|
936
937
|
) => void;
|
|
937
938
|
|
|
@@ -942,7 +943,7 @@ export type TableIdsListener<Schemas extends OptionalSchemas> = (
|
|
|
942
943
|
* This has schema-based typing. The following is a simplified representation:
|
|
943
944
|
*
|
|
944
945
|
* ```ts override
|
|
945
|
-
* (
|
|
946
|
+
* export type HasTableListener<Store extends StoreAlias = StoreAlias> = (
|
|
946
947
|
* store: Store,
|
|
947
948
|
* tableId: Id,
|
|
948
949
|
* hasTable: boolean,
|
|
@@ -965,8 +966,9 @@ export type TableIdsListener<Schemas extends OptionalSchemas> = (
|
|
|
965
966
|
export type HasTableListener<
|
|
966
967
|
Schemas extends OptionalSchemas,
|
|
967
968
|
TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null,
|
|
969
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
968
970
|
> = (
|
|
969
|
-
store: Store
|
|
971
|
+
store: Store,
|
|
970
972
|
tableId: TableIdOrNull extends null
|
|
971
973
|
? TableIdFromSchema<Schemas[0]>
|
|
972
974
|
: TableIdOrNull,
|
|
@@ -980,7 +982,7 @@ export type HasTableListener<
|
|
|
980
982
|
* This has schema-based typing. The following is a simplified representation:
|
|
981
983
|
*
|
|
982
984
|
* ```ts override
|
|
983
|
-
* (
|
|
985
|
+
* export type TableListener<Store extends StoreAlias = StoreAlias> = (
|
|
984
986
|
* store: Store,
|
|
985
987
|
* tableId: Id,
|
|
986
988
|
* getCellChange: GetCellChange | undefined,
|
|
@@ -1006,8 +1008,9 @@ export type HasTableListener<
|
|
|
1006
1008
|
export type TableListener<
|
|
1007
1009
|
Schemas extends OptionalSchemas,
|
|
1008
1010
|
TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null,
|
|
1011
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1009
1012
|
> = (
|
|
1010
|
-
store: Store
|
|
1013
|
+
store: Store,
|
|
1011
1014
|
tableId: TableIdOrNull extends null
|
|
1012
1015
|
? TableIdFromSchema<Schemas[0]>
|
|
1013
1016
|
: TableIdOrNull,
|
|
@@ -1021,7 +1024,7 @@ export type TableListener<
|
|
|
1021
1024
|
* This has schema-based typing. The following is a simplified representation:
|
|
1022
1025
|
*
|
|
1023
1026
|
* ```ts override
|
|
1024
|
-
* (
|
|
1027
|
+
* export type TableCellIdsListener<Store extends StoreAlias = StoreAlias> = (
|
|
1025
1028
|
* store: Store,
|
|
1026
1029
|
* tableId: Id,
|
|
1027
1030
|
* getIdChanges: GetIdChanges | undefined,
|
|
@@ -1043,12 +1046,13 @@ export type TableListener<
|
|
|
1043
1046
|
export type TableCellIdsListener<
|
|
1044
1047
|
Schemas extends OptionalSchemas,
|
|
1045
1048
|
TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null,
|
|
1049
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1046
1050
|
Params extends any[] = (
|
|
1047
1051
|
TableIdOrNull extends null ? TableIdFromSchema<Schemas[0]> : TableIdOrNull
|
|
1048
1052
|
) extends infer TableId
|
|
1049
1053
|
? TableId extends TableIdFromSchema<Schemas[0]>
|
|
1050
1054
|
? [
|
|
1051
|
-
store: Store
|
|
1055
|
+
store: Store,
|
|
1052
1056
|
tableId: TableId,
|
|
1053
1057
|
getIdChanges: GetIdChanges<CellIdFromSchema<Schemas[0], TableId>>,
|
|
1054
1058
|
]
|
|
@@ -1071,7 +1075,7 @@ export type TableCellIdsListener<
|
|
|
1071
1075
|
* This has schema-based typing. The following is a simplified representation:
|
|
1072
1076
|
*
|
|
1073
1077
|
* ```ts override
|
|
1074
|
-
* (
|
|
1078
|
+
* export type HasTableCellListener<Store extends StoreAlias = StoreAlias> = (
|
|
1075
1079
|
* store: Store,
|
|
1076
1080
|
* tableId: Id,
|
|
1077
1081
|
* cellId: Id,
|
|
@@ -1101,6 +1105,7 @@ export type HasTableCellListener<
|
|
|
1101
1105
|
? CellIdFromSchema<Schemas[0], TableIdOrNull>
|
|
1102
1106
|
: AllCellIdFromSchema<Schemas[0]>)
|
|
1103
1107
|
| null,
|
|
1108
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1104
1109
|
Params extends any[] = (
|
|
1105
1110
|
TableIdOrNull extends null ? TableIdFromSchema<Schemas[0]> : TableIdOrNull
|
|
1106
1111
|
) extends infer TableId
|
|
@@ -1112,7 +1117,7 @@ export type HasTableCellListener<
|
|
|
1112
1117
|
) extends infer CellId
|
|
1113
1118
|
? CellId extends CellIdFromSchema<Schemas[0], TableId>
|
|
1114
1119
|
? [
|
|
1115
|
-
store: Store
|
|
1120
|
+
store: Store,
|
|
1116
1121
|
tableId: TableId,
|
|
1117
1122
|
cellId: CellId,
|
|
1118
1123
|
hasTableCell: boolean,
|
|
@@ -1140,7 +1145,7 @@ export type HasTableCellListener<
|
|
|
1140
1145
|
* This has schema-based typing. The following is a simplified representation:
|
|
1141
1146
|
*
|
|
1142
1147
|
* ```ts override
|
|
1143
|
-
* (
|
|
1148
|
+
* export type RowCountListener<Store extends StoreAlias = StoreAlias> = (
|
|
1144
1149
|
* store: Store,
|
|
1145
1150
|
* tableId: Id,
|
|
1146
1151
|
* count: number,
|
|
@@ -1161,8 +1166,9 @@ export type HasTableCellListener<
|
|
|
1161
1166
|
export type RowCountListener<
|
|
1162
1167
|
Schemas extends OptionalSchemas,
|
|
1163
1168
|
TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null,
|
|
1169
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1164
1170
|
> = (
|
|
1165
|
-
store: Store
|
|
1171
|
+
store: Store,
|
|
1166
1172
|
tableId: TableIdOrNull extends null
|
|
1167
1173
|
? TableIdFromSchema<Schemas[0]>
|
|
1168
1174
|
: TableIdOrNull,
|
|
@@ -1176,7 +1182,7 @@ export type RowCountListener<
|
|
|
1176
1182
|
* This has schema-based typing. The following is a simplified representation:
|
|
1177
1183
|
*
|
|
1178
1184
|
* ```ts override
|
|
1179
|
-
* (
|
|
1185
|
+
* export type RowIdsListener<Store extends StoreAlias = StoreAlias> = (
|
|
1180
1186
|
* store: Store,
|
|
1181
1187
|
* tableId: Id,
|
|
1182
1188
|
* getIdChanges: GetIdChanges | undefined,
|
|
@@ -1200,8 +1206,9 @@ export type RowCountListener<
|
|
|
1200
1206
|
export type RowIdsListener<
|
|
1201
1207
|
Schemas extends OptionalSchemas,
|
|
1202
1208
|
TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null,
|
|
1209
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1203
1210
|
> = (
|
|
1204
|
-
store: Store
|
|
1211
|
+
store: Store,
|
|
1205
1212
|
tableId: TableIdOrNull extends null
|
|
1206
1213
|
? TableIdFromSchema<Schemas[0]>
|
|
1207
1214
|
: TableIdOrNull,
|
|
@@ -1215,7 +1222,7 @@ export type RowIdsListener<
|
|
|
1215
1222
|
* This has schema-based typing. The following is a simplified representation:
|
|
1216
1223
|
*
|
|
1217
1224
|
* ```ts override
|
|
1218
|
-
* (
|
|
1225
|
+
* export type SortedRowIdsListener<Store extends StoreAlias = StoreAlias> = (
|
|
1219
1226
|
* store: Store,
|
|
1220
1227
|
* tableId: Id,
|
|
1221
1228
|
* cellId: Id | undefined,
|
|
@@ -1252,8 +1259,9 @@ export type SortedRowIdsListener<
|
|
|
1252
1259
|
Descending extends boolean,
|
|
1253
1260
|
Offset extends number,
|
|
1254
1261
|
Limit extends number | undefined,
|
|
1262
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1255
1263
|
> = (
|
|
1256
|
-
store: Store
|
|
1264
|
+
store: Store,
|
|
1257
1265
|
tableId: TableId,
|
|
1258
1266
|
cellId: CellId,
|
|
1259
1267
|
descending: Descending,
|
|
@@ -1269,7 +1277,7 @@ export type SortedRowIdsListener<
|
|
|
1269
1277
|
* This has schema-based typing. The following is a simplified representation:
|
|
1270
1278
|
*
|
|
1271
1279
|
* ```ts override
|
|
1272
|
-
* (
|
|
1280
|
+
* export type HasRowListener<Store extends StoreAlias = StoreAlias> = (
|
|
1273
1281
|
* store: Store,
|
|
1274
1282
|
* tableId: Id,
|
|
1275
1283
|
* rowId: Id,
|
|
@@ -1295,8 +1303,9 @@ export type HasRowListener<
|
|
|
1295
1303
|
Schemas extends OptionalSchemas,
|
|
1296
1304
|
TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null,
|
|
1297
1305
|
RowIdOrNull extends IdOrNull,
|
|
1306
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1298
1307
|
> = (
|
|
1299
|
-
store: Store
|
|
1308
|
+
store: Store,
|
|
1300
1309
|
tableId: TableIdOrNull extends null
|
|
1301
1310
|
? TableIdFromSchema<Schemas[0]>
|
|
1302
1311
|
: TableIdOrNull,
|
|
@@ -1311,7 +1320,7 @@ export type HasRowListener<
|
|
|
1311
1320
|
* This has schema-based typing. The following is a simplified representation:
|
|
1312
1321
|
*
|
|
1313
1322
|
* ```ts override
|
|
1314
|
-
* (
|
|
1323
|
+
* export type RowListener<Store extends StoreAlias = StoreAlias> = (
|
|
1315
1324
|
* store: Store,
|
|
1316
1325
|
* tableId: Id,
|
|
1317
1326
|
* rowId: Id,
|
|
@@ -1341,8 +1350,9 @@ export type RowListener<
|
|
|
1341
1350
|
Schemas extends OptionalSchemas,
|
|
1342
1351
|
TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null,
|
|
1343
1352
|
RowIdOrNull extends IdOrNull,
|
|
1353
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1344
1354
|
> = (
|
|
1345
|
-
store: Store
|
|
1355
|
+
store: Store,
|
|
1346
1356
|
tableId: TableIdOrNull extends null
|
|
1347
1357
|
? TableIdFromSchema<Schemas[0]>
|
|
1348
1358
|
: TableIdOrNull,
|
|
@@ -1357,7 +1367,7 @@ export type RowListener<
|
|
|
1357
1367
|
* This has schema-based typing. The following is a simplified representation:
|
|
1358
1368
|
*
|
|
1359
1369
|
* ```ts override
|
|
1360
|
-
* (
|
|
1370
|
+
* export type CellIdsListener<Store extends StoreAlias = StoreAlias> = (
|
|
1361
1371
|
* store: Store,
|
|
1362
1372
|
* tableId: Id,
|
|
1363
1373
|
* rowId: Id,
|
|
@@ -1384,12 +1394,13 @@ export type CellIdsListener<
|
|
|
1384
1394
|
Schemas extends OptionalSchemas,
|
|
1385
1395
|
TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null,
|
|
1386
1396
|
RowIdOrNull extends IdOrNull,
|
|
1397
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1387
1398
|
Params extends any[] = (
|
|
1388
1399
|
TableIdOrNull extends null ? TableIdFromSchema<Schemas[0]> : TableIdOrNull
|
|
1389
1400
|
) extends infer TableId
|
|
1390
1401
|
? TableId extends TableIdFromSchema<Schemas[0]>
|
|
1391
1402
|
? [
|
|
1392
|
-
store: Store
|
|
1403
|
+
store: Store,
|
|
1393
1404
|
tableId: TableId,
|
|
1394
1405
|
rowId: RowIdOrNull extends null ? Id : RowIdOrNull,
|
|
1395
1406
|
getIdChanges: GetIdChanges<CellIdFromSchema<Schemas[0], TableId>>,
|
|
@@ -1415,7 +1426,7 @@ export type CellIdsListener<
|
|
|
1415
1426
|
* This has schema-based typing. The following is a simplified representation:
|
|
1416
1427
|
*
|
|
1417
1428
|
* ```ts override
|
|
1418
|
-
* (
|
|
1429
|
+
* export type HasCellListener<Store extends StoreAlias = StoreAlias> = (
|
|
1419
1430
|
* store: Store,
|
|
1420
1431
|
* tableId: Id,
|
|
1421
1432
|
* rowId: Id,
|
|
@@ -1448,6 +1459,7 @@ export type HasCellListener<
|
|
|
1448
1459
|
? CellIdFromSchema<Schemas[0], TableIdOrNull>
|
|
1449
1460
|
: AllCellIdFromSchema<Schemas[0]>)
|
|
1450
1461
|
| null,
|
|
1462
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1451
1463
|
Params extends any[] = (
|
|
1452
1464
|
TableIdOrNull extends null ? TableIdFromSchema<Schemas[0]> : TableIdOrNull
|
|
1453
1465
|
) extends infer TableId
|
|
@@ -1459,7 +1471,7 @@ export type HasCellListener<
|
|
|
1459
1471
|
) extends infer CellId
|
|
1460
1472
|
? CellId extends CellIdFromSchema<Schemas[0], TableId>
|
|
1461
1473
|
? [
|
|
1462
|
-
store: Store
|
|
1474
|
+
store: Store,
|
|
1463
1475
|
tableId: TableId,
|
|
1464
1476
|
rowId: RowIdOrNull extends null ? Id : RowIdOrNull,
|
|
1465
1477
|
cellId: CellId,
|
|
@@ -1498,7 +1510,7 @@ export type HasCellListener<
|
|
|
1498
1510
|
* This has schema-based typing. The following is a simplified representation:
|
|
1499
1511
|
*
|
|
1500
1512
|
* ```ts override
|
|
1501
|
-
* (
|
|
1513
|
+
* export type CellListener<Store extends StoreAlias = StoreAlias> = (
|
|
1502
1514
|
* store: Store,
|
|
1503
1515
|
* tableId: Id,
|
|
1504
1516
|
* rowId: Id,
|
|
@@ -1541,6 +1553,7 @@ export type CellListener<
|
|
|
1541
1553
|
? CellIdFromSchema<Schemas[0], TableIdOrNull>
|
|
1542
1554
|
: AllCellIdFromSchema<Schemas[0]>)
|
|
1543
1555
|
| null,
|
|
1556
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1544
1557
|
Params extends any[] = (
|
|
1545
1558
|
TableIdOrNull extends null ? TableIdFromSchema<Schemas[0]> : TableIdOrNull
|
|
1546
1559
|
) extends infer TableId
|
|
@@ -1552,7 +1565,7 @@ export type CellListener<
|
|
|
1552
1565
|
) extends infer CellId
|
|
1553
1566
|
? CellId extends CellIdFromSchema<Schemas[0], TableId>
|
|
1554
1567
|
? [
|
|
1555
|
-
store: Store
|
|
1568
|
+
store: Store,
|
|
1556
1569
|
tableId: TableId,
|
|
1557
1570
|
rowId: RowIdOrNull extends null ? Id : RowIdOrNull,
|
|
1558
1571
|
cellId: CellId,
|
|
@@ -1601,7 +1614,10 @@ export type CellListener<
|
|
|
1601
1614
|
* This has schema-based typing. The following is a simplified representation:
|
|
1602
1615
|
*
|
|
1603
1616
|
* ```ts override
|
|
1604
|
-
*
|
|
1617
|
+
* export type HasValuesListener<Store extends StoreAlias = StoreAlias> = (
|
|
1618
|
+
* store: Store,
|
|
1619
|
+
* hasValues: boolean,
|
|
1620
|
+
* ) => void;
|
|
1605
1621
|
* ```
|
|
1606
1622
|
*
|
|
1607
1623
|
* A HasValuesListener is provided when using the addHasValuesListener method.
|
|
@@ -1615,10 +1631,10 @@ export type CellListener<
|
|
|
1615
1631
|
* @category Listener
|
|
1616
1632
|
* @since v4.4.0
|
|
1617
1633
|
*/
|
|
1618
|
-
export type HasValuesListener<
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
) => void;
|
|
1634
|
+
export type HasValuesListener<
|
|
1635
|
+
Schemas extends OptionalSchemas,
|
|
1636
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1637
|
+
> = (store: Store, hasValues: boolean) => void;
|
|
1622
1638
|
|
|
1623
1639
|
/**
|
|
1624
1640
|
* The ValuesListener type describes a function that is used to listen to
|
|
@@ -1627,7 +1643,7 @@ export type HasValuesListener<Schemas extends OptionalSchemas> = (
|
|
|
1627
1643
|
* This has schema-based typing. The following is a simplified representation:
|
|
1628
1644
|
*
|
|
1629
1645
|
* ```ts override
|
|
1630
|
-
* (
|
|
1646
|
+
* export type ValuesListener<Store extends StoreAlias = StoreAlias> = (
|
|
1631
1647
|
* store: Store,
|
|
1632
1648
|
* getValueChange: GetValueChange | undefined,
|
|
1633
1649
|
* ) => void;
|
|
@@ -1648,8 +1664,11 @@ export type HasValuesListener<Schemas extends OptionalSchemas> = (
|
|
|
1648
1664
|
* changes.
|
|
1649
1665
|
* @category Listener
|
|
1650
1666
|
*/
|
|
1651
|
-
export type ValuesListener<
|
|
1652
|
-
|
|
1667
|
+
export type ValuesListener<
|
|
1668
|
+
Schemas extends OptionalSchemas,
|
|
1669
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1670
|
+
> = (
|
|
1671
|
+
store: Store,
|
|
1653
1672
|
getValueChange: GetValueChange<Schemas[1]> | undefined,
|
|
1654
1673
|
) => void;
|
|
1655
1674
|
|
|
@@ -1660,7 +1679,7 @@ export type ValuesListener<Schemas extends OptionalSchemas> = (
|
|
|
1660
1679
|
* This has schema-based typing. The following is a simplified representation:
|
|
1661
1680
|
*
|
|
1662
1681
|
* ```ts override
|
|
1663
|
-
* (
|
|
1682
|
+
* export type ValueIdsListener<Store extends StoreAlias = StoreAlias> = (
|
|
1664
1683
|
* store: Store,
|
|
1665
1684
|
* getIdChanges: GetIdChanges | undefined,
|
|
1666
1685
|
* ) => void;
|
|
@@ -1678,8 +1697,11 @@ export type ValuesListener<Schemas extends OptionalSchemas> = (
|
|
|
1678
1697
|
* since v3.3.
|
|
1679
1698
|
* @category Listener
|
|
1680
1699
|
*/
|
|
1681
|
-
export type ValueIdsListener<
|
|
1682
|
-
|
|
1700
|
+
export type ValueIdsListener<
|
|
1701
|
+
Schemas extends OptionalSchemas,
|
|
1702
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1703
|
+
> = (
|
|
1704
|
+
store: Store,
|
|
1683
1705
|
getIdChanges: GetIdChanges<ValueIdFromSchema<Schemas[1]>> | undefined,
|
|
1684
1706
|
) => void;
|
|
1685
1707
|
|
|
@@ -1690,7 +1712,7 @@ export type ValueIdsListener<Schemas extends OptionalSchemas> = (
|
|
|
1690
1712
|
* This has schema-based typing. The following is a simplified representation:
|
|
1691
1713
|
*
|
|
1692
1714
|
* ```ts override
|
|
1693
|
-
* (
|
|
1715
|
+
* export type HasValueListener<Store extends StoreAlias = StoreAlias> = (
|
|
1694
1716
|
* store: Store,
|
|
1695
1717
|
* valueId: Id,
|
|
1696
1718
|
* hasValue: boolean,
|
|
@@ -1713,8 +1735,9 @@ export type ValueIdsListener<Schemas extends OptionalSchemas> = (
|
|
|
1713
1735
|
export type HasValueListener<
|
|
1714
1736
|
Schemas extends OptionalSchemas,
|
|
1715
1737
|
ValueIdOrNull extends ValueIdFromSchema<Schemas[1]> | null,
|
|
1738
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1716
1739
|
> = (
|
|
1717
|
-
store: Store
|
|
1740
|
+
store: Store,
|
|
1718
1741
|
valueId: ValueIdOrNull extends null
|
|
1719
1742
|
? ValueIdFromSchema<Schemas[1]>
|
|
1720
1743
|
: ValueIdOrNull,
|
|
@@ -1728,7 +1751,7 @@ export type HasValueListener<
|
|
|
1728
1751
|
* This has schema-based typing. The following is a simplified representation:
|
|
1729
1752
|
*
|
|
1730
1753
|
* ```ts override
|
|
1731
|
-
* (
|
|
1754
|
+
* export type ValueListener<Store extends StoreAlias = StoreAlias> = (
|
|
1732
1755
|
* store: Store,
|
|
1733
1756
|
* valueId: Id,
|
|
1734
1757
|
* newValue: Value,
|
|
@@ -1761,12 +1784,13 @@ export type HasValueListener<
|
|
|
1761
1784
|
export type ValueListener<
|
|
1762
1785
|
Schemas extends OptionalSchemas,
|
|
1763
1786
|
ValueIdOrNull extends ValueIdFromSchema<Schemas[1]> | null,
|
|
1787
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1764
1788
|
Params extends any[] = (
|
|
1765
1789
|
ValueIdOrNull extends null ? ValueIdFromSchema<Schemas[1]> : ValueIdOrNull
|
|
1766
1790
|
) extends infer ValueId
|
|
1767
1791
|
? ValueId extends ValueIdFromSchema<Schemas[1]>
|
|
1768
1792
|
? [
|
|
1769
|
-
store: Store
|
|
1793
|
+
store: Store,
|
|
1770
1794
|
valueId: ValueId,
|
|
1771
1795
|
newValue: Value<Schemas[1], ValueId>,
|
|
1772
1796
|
oldValue: Value<Schemas[1], ValueId>,
|
|
@@ -1803,7 +1827,7 @@ export type ValueListener<
|
|
|
1803
1827
|
* This has schema-based typing. The following is a simplified representation:
|
|
1804
1828
|
*
|
|
1805
1829
|
* ```ts override
|
|
1806
|
-
* (
|
|
1830
|
+
* export type InvalidCellListener<Store extends StoreAlias = StoreAlias> = (
|
|
1807
1831
|
* store: Store,
|
|
1808
1832
|
* tableId: Id,
|
|
1809
1833
|
* rowId: Id,
|
|
@@ -1829,8 +1853,11 @@ export type ValueListener<
|
|
|
1829
1853
|
* @category Listener
|
|
1830
1854
|
* @since v1.1.0
|
|
1831
1855
|
*/
|
|
1832
|
-
export type InvalidCellListener<
|
|
1833
|
-
|
|
1856
|
+
export type InvalidCellListener<
|
|
1857
|
+
Schemas extends OptionalSchemas,
|
|
1858
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1859
|
+
> = (
|
|
1860
|
+
store: Store,
|
|
1834
1861
|
tableId: Id,
|
|
1835
1862
|
rowId: Id,
|
|
1836
1863
|
cellId: Id,
|
|
@@ -1844,7 +1871,7 @@ export type InvalidCellListener<Schemas extends OptionalSchemas> = (
|
|
|
1844
1871
|
* This has schema-based typing. The following is a simplified representation:
|
|
1845
1872
|
*
|
|
1846
1873
|
* ```ts override
|
|
1847
|
-
* (
|
|
1874
|
+
* export type InvalidValueListener<Store extends StoreAlias = StoreAlias> = (
|
|
1848
1875
|
* store: Store,
|
|
1849
1876
|
* valueId: Id,
|
|
1850
1877
|
* invalidValues: any[],
|
|
@@ -1866,11 +1893,10 @@ export type InvalidCellListener<Schemas extends OptionalSchemas> = (
|
|
|
1866
1893
|
* @category Listener
|
|
1867
1894
|
* @since v3.0.0
|
|
1868
1895
|
*/
|
|
1869
|
-
export type InvalidValueListener<
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
) => void;
|
|
1896
|
+
export type InvalidValueListener<
|
|
1897
|
+
Schemas extends OptionalSchemas,
|
|
1898
|
+
Store extends StoreAlias<Schemas> = StoreAlias<Schemas>,
|
|
1899
|
+
> = (store: Store, valueId: Id, invalidValues: any[]) => void;
|
|
1874
1900
|
|
|
1875
1901
|
/**
|
|
1876
1902
|
* The GetIdChanges type describes a function that returns information about the
|
|
@@ -2047,7 +2073,7 @@ export type ChangedCells<Schema extends OptionalTablesSchema> = {
|
|
|
2047
2073
|
* This has schema-based typing. The following is a simplified representation:
|
|
2048
2074
|
*
|
|
2049
2075
|
* ```ts override
|
|
2050
|
-
* [CellOrUndefined, CellOrUndefined];
|
|
2076
|
+
* [oldCell: CellOrUndefined, newCell: CellOrUndefined];
|
|
2051
2077
|
* ```
|
|
2052
2078
|
*
|
|
2053
2079
|
* It provides both the old and new Cell values in a two-part array. These are
|
|
@@ -2136,7 +2162,10 @@ export type ChangedValues<Schema extends OptionalValuesSchema> = {
|
|
|
2136
2162
|
* This has schema-based typing. The following is a simplified representation:
|
|
2137
2163
|
*
|
|
2138
2164
|
* ```ts override
|
|
2139
|
-
* [
|
|
2165
|
+
* [
|
|
2166
|
+
* oldValue: ValueOrUndefined,
|
|
2167
|
+
* newValue: ValueOrUndefined,
|
|
2168
|
+
* ];
|
|
2140
2169
|
* ```
|
|
2141
2170
|
*
|
|
2142
2171
|
* It provides both the the old and new Values in a two-part array. These
|
|
@@ -2178,8 +2207,8 @@ export type ChangedValue<
|
|
|
2178
2207
|
*/
|
|
2179
2208
|
export type InvalidValues = {[valueId: Id]: any[]};
|
|
2180
2209
|
|
|
2181
|
-
//
|
|
2182
|
-
export type
|
|
2210
|
+
// Changes
|
|
2211
|
+
export type Changes<Schemas extends OptionalSchemas> = [
|
|
2183
2212
|
{
|
|
2184
2213
|
[TableId in TableIdFromSchema<Schemas[0]>]?: {
|
|
2185
2214
|
[rowId: Id]:
|
|
@@ -2201,25 +2230,6 @@ export type TransactionChanges<Schemas extends OptionalSchemas> = [
|
|
|
2201
2230
|
},
|
|
2202
2231
|
];
|
|
2203
2232
|
|
|
2204
|
-
/**
|
|
2205
|
-
* The GetTransactionChanges type describes a function that returns the net
|
|
2206
|
-
* meaningful changes that were made to a Store during a transaction.
|
|
2207
|
-
*
|
|
2208
|
-
* This has schema-based typing. The following is a simplified representation:
|
|
2209
|
-
*
|
|
2210
|
-
* ```ts override
|
|
2211
|
-
* () => TransactionChanges;
|
|
2212
|
-
* ```
|
|
2213
|
-
*
|
|
2214
|
-
* It is provided to the DoRollback callback and to a TransactionListener
|
|
2215
|
-
* listener when a transaction completes. See the TransactionChanges type for
|
|
2216
|
-
* more information and an example of the returned data structure.
|
|
2217
|
-
* @category Transaction
|
|
2218
|
-
* @since v4.0.0
|
|
2219
|
-
*/
|
|
2220
|
-
export type GetTransactionChanges<Schemas extends OptionalSchemas> =
|
|
2221
|
-
() => TransactionChanges<Schemas>;
|
|
2222
|
-
|
|
2223
2233
|
/**
|
|
2224
2234
|
* The TransactionLog type describes the changes that were made to a Store
|
|
2225
2235
|
* during a transaction in detail.
|
|
@@ -2227,21 +2237,21 @@ export type GetTransactionChanges<Schemas extends OptionalSchemas> =
|
|
|
2227
2237
|
* This has schema-based typing. The following is a simplified representation:
|
|
2228
2238
|
*
|
|
2229
2239
|
* ```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
|
-
*
|
|
2240
|
+
* [
|
|
2241
|
+
* cellsTouched: boolean,
|
|
2242
|
+
* valuesTouched: boolean,
|
|
2243
|
+
* changedCells: ChangedCells,
|
|
2244
|
+
* invalidCells: InvalidCells,
|
|
2245
|
+
* changedValues: ChangedValues,
|
|
2246
|
+
* invalidValues: InvalidValues,
|
|
2247
|
+
* changedTableIds: ChangedTableIds,
|
|
2248
|
+
* changedRowIds: ChangedRowIds,
|
|
2249
|
+
* changedCellIds: ChangedCellIds,
|
|
2250
|
+
* changedValueIds: ChangedValueIds,
|
|
2251
|
+
* ];
|
|
2242
2252
|
* ```
|
|
2243
2253
|
*
|
|
2244
|
-
* This contains equivalent information to a
|
|
2254
|
+
* This contains equivalent information to a Changes object, but also
|
|
2245
2255
|
* information about what the previous state of the Store was. The changedCells
|
|
2246
2256
|
* and changedValues entries contain information about all changes to those
|
|
2247
2257
|
* parts of the Store, with their before and after values, for example.
|
|
@@ -2257,6 +2267,9 @@ export type GetTransactionChanges<Schemas extends OptionalSchemas> =
|
|
|
2257
2267
|
* of `cellsTouched` and `valuesTouched` in the listener will be `false` because
|
|
2258
2268
|
* all changes have been reverted.
|
|
2259
2269
|
*
|
|
2270
|
+
* In v5.0, this type changed from an object to an array, but still contains the
|
|
2271
|
+
* same values.
|
|
2272
|
+
*
|
|
2260
2273
|
* See the documentation for the types of the inner objects for other details.
|
|
2261
2274
|
* @category Transaction
|
|
2262
2275
|
* @since v4.0.0
|
|
@@ -2274,25 +2287,6 @@ export type TransactionLog<Schemas extends OptionalSchemas> = {
|
|
|
2274
2287
|
changedValueIds: ChangedValueIds<Schemas[1]>;
|
|
2275
2288
|
};
|
|
2276
2289
|
|
|
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
2290
|
/**
|
|
2297
2291
|
* The StoreListenerStats type describes the number of listeners registered with
|
|
2298
2292
|
* the Store, and can be used for debugging purposes.
|
|
@@ -2602,7 +2596,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2602
2596
|
* This has schema-based typing. The following is a simplified representation:
|
|
2603
2597
|
*
|
|
2604
2598
|
* ```ts override
|
|
2605
|
-
* getContent():
|
|
2599
|
+
* getContent(): Content;
|
|
2606
2600
|
* ```
|
|
2607
2601
|
*
|
|
2608
2602
|
* Note that this returns a copy of, rather than a reference to the underlying
|
|
@@ -2631,7 +2625,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
2631
2625
|
* @category Getter
|
|
2632
2626
|
* @since v4.0.0
|
|
2633
2627
|
*/
|
|
2634
|
-
getContent():
|
|
2628
|
+
getContent(): Content<Schemas>;
|
|
2635
2629
|
|
|
2636
2630
|
/**
|
|
2637
2631
|
* The getTables method returns a Tables object containing the entire tabular
|
|
@@ -3643,7 +3637,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3643
3637
|
* This has schema-based typing. The following is a simplified representation:
|
|
3644
3638
|
*
|
|
3645
3639
|
* ```ts override
|
|
3646
|
-
* setContent(
|
|
3640
|
+
* setContent(content: Content): this;
|
|
3647
3641
|
* ```
|
|
3648
3642
|
*
|
|
3649
3643
|
* This method will cause listeners to be called for any Table, Row, Cell,
|
|
@@ -3698,10 +3692,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3698
3692
|
* @category Setter
|
|
3699
3693
|
* @since v4.0.0
|
|
3700
3694
|
*/
|
|
3701
|
-
setContent(
|
|
3702
|
-
Tables<Schemas[0], true>,
|
|
3703
|
-
Values<Schemas[1], true>,
|
|
3704
|
-
]): Store<Schemas>;
|
|
3695
|
+
setContent(content: Content<Schemas, true>): Store<Schemas>;
|
|
3705
3696
|
|
|
3706
3697
|
/**
|
|
3707
3698
|
* The setTables method takes an object and sets the entire tabular data of
|
|
@@ -3710,7 +3701,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3710
3701
|
* This has schema-based typing. The following is a simplified representation:
|
|
3711
3702
|
*
|
|
3712
3703
|
* ```ts override
|
|
3713
|
-
* setTables(tables: Tables):
|
|
3704
|
+
* setTables(tables: Tables): this;
|
|
3714
3705
|
* ```
|
|
3715
3706
|
*
|
|
3716
3707
|
* This method will cause listeners to be called for any Table, Row, Cell, or
|
|
@@ -3764,7 +3755,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3764
3755
|
* This has schema-based typing. The following is a simplified representation:
|
|
3765
3756
|
*
|
|
3766
3757
|
* ```ts override
|
|
3767
|
-
* setTable(tableId: Id, table: Table):
|
|
3758
|
+
* setTable(tableId: Id, table: Table): this;
|
|
3768
3759
|
* ```
|
|
3769
3760
|
*
|
|
3770
3761
|
* This method will cause listeners to be called for any Table, Row, Cell, or
|
|
@@ -3823,7 +3814,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3823
3814
|
* This has schema-based typing. The following is a simplified representation:
|
|
3824
3815
|
*
|
|
3825
3816
|
* ```ts override
|
|
3826
|
-
* setRow(tableId: Id, rowId: Id, row: Row):
|
|
3817
|
+
* setRow(tableId: Id, rowId: Id, row: Row): this;
|
|
3827
3818
|
* ```
|
|
3828
3819
|
*
|
|
3829
3820
|
* This method will cause listeners to be called for any Table, Row, Cell, or
|
|
@@ -3953,7 +3944,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
3953
3944
|
* This has schema-based typing. The following is a simplified representation:
|
|
3954
3945
|
*
|
|
3955
3946
|
* ```ts override
|
|
3956
|
-
* setPartialRow(tableId: Id, rowId: Id, partialRow: Row):
|
|
3947
|
+
* setPartialRow(tableId: Id, rowId: Id, partialRow: Row): this;
|
|
3957
3948
|
* ```
|
|
3958
3949
|
*
|
|
3959
3950
|
* This method will cause listeners to be called for any Table, Row, Cell, or
|
|
@@ -4013,7 +4004,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4013
4004
|
* This has schema-based typing. The following is a simplified representation:
|
|
4014
4005
|
*
|
|
4015
4006
|
* ```ts override
|
|
4016
|
-
* setCell(tableId: Id, rowId: Id, cellId: Id, cell: Cell | MapCell):
|
|
4007
|
+
* setCell(tableId: Id, rowId: Id, cellId: Id, cell: Cell | MapCell): this;
|
|
4017
4008
|
* ```
|
|
4018
4009
|
*
|
|
4019
4010
|
* This method will cause listeners to be called for any Table, Row, Cell, or
|
|
@@ -4086,7 +4077,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4086
4077
|
* This has schema-based typing. The following is a simplified representation:
|
|
4087
4078
|
*
|
|
4088
4079
|
* ```ts override
|
|
4089
|
-
* setValues(values: Values):
|
|
4080
|
+
* setValues(values: Values): this;
|
|
4090
4081
|
* ```
|
|
4091
4082
|
*
|
|
4092
4083
|
* This method will cause listeners to be called for any Value or Id changes
|
|
@@ -4140,7 +4131,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4140
4131
|
* This has schema-based typing. The following is a simplified representation:
|
|
4141
4132
|
*
|
|
4142
4133
|
* ```ts override
|
|
4143
|
-
* setPartialValues(partialValues: Values):
|
|
4134
|
+
* setPartialValues(partialValues: Values): this;
|
|
4144
4135
|
* ```
|
|
4145
4136
|
*
|
|
4146
4137
|
* This method will cause listeners to be called for any Values or Id changes
|
|
@@ -4194,7 +4185,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4194
4185
|
* This has schema-based typing. The following is a simplified representation:
|
|
4195
4186
|
*
|
|
4196
4187
|
* ```ts override
|
|
4197
|
-
* setValue(valueId: Id, value: Value | MapValue):
|
|
4188
|
+
* setValue(valueId: Id, value: Value | MapValue): this;
|
|
4198
4189
|
* ```
|
|
4199
4190
|
*
|
|
4200
4191
|
* This method will cause listeners to be called for any Value, or Id changes
|
|
@@ -4251,31 +4242,32 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4251
4242
|
): Store<Schemas>;
|
|
4252
4243
|
|
|
4253
4244
|
/**
|
|
4254
|
-
* The
|
|
4255
|
-
* Store.
|
|
4245
|
+
* The applyChanges method applies a set of Changes to the Store.
|
|
4256
4246
|
*
|
|
4257
4247
|
* This has schema-based typing. The following is a simplified representation:
|
|
4258
4248
|
*
|
|
4259
4249
|
* ```ts override
|
|
4260
|
-
*
|
|
4250
|
+
* applyChanges(changes: Changes): this;
|
|
4261
4251
|
* ```
|
|
4262
4252
|
*
|
|
4263
|
-
* This method will take a
|
|
4264
|
-
*
|
|
4265
|
-
*
|
|
4266
|
-
*
|
|
4267
|
-
*
|
|
4253
|
+
* This method will take a Changes object (which is available at the end of a
|
|
4254
|
+
* transaction) and apply it to a Store. The most likely need to do this is to
|
|
4255
|
+
* take the changes made during the transaction of one Store, and apply it to
|
|
4256
|
+
* the content of _another_ Store - such as when persisting and synchronizing
|
|
4257
|
+
* data.
|
|
4268
4258
|
*
|
|
4269
|
-
* Any part of the provided
|
|
4270
|
-
*
|
|
4271
|
-
*
|
|
4259
|
+
* Any part of the provided Changes object are invalid (either because of its
|
|
4260
|
+
* type, or because it does not match the schemas associated with the Store)
|
|
4261
|
+
* will be ignored silently.
|
|
4272
4262
|
*
|
|
4273
4263
|
* The method returns a reference to the Store so that subsequent operations
|
|
4274
4264
|
* can be chained in a fluent style.
|
|
4275
|
-
*
|
|
4265
|
+
*
|
|
4266
|
+
* Prior to v5.0, this method was named `setTransactionChanges`.
|
|
4267
|
+
* @param changes The Changes to apply to the Store.
|
|
4276
4268
|
* @returns A reference to the Store.
|
|
4277
4269
|
* @example
|
|
4278
|
-
* This example applies a
|
|
4270
|
+
* This example applies a Changes object that sets a Cell and
|
|
4279
4271
|
* removes a Value.
|
|
4280
4272
|
*
|
|
4281
4273
|
* ```js
|
|
@@ -4283,21 +4275,16 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4283
4275
|
* .setTables({pets: {fido: {species: 'dog', color: 'brown'}}})
|
|
4284
4276
|
* .setValues({open: true});
|
|
4285
4277
|
*
|
|
4286
|
-
* store.
|
|
4287
|
-
* {pets: {fido: {color: 'black'}}},
|
|
4288
|
-
* {open: null},
|
|
4289
|
-
* ]);
|
|
4278
|
+
* store.applyChanges([{pets: {fido: {color: 'black'}}}, {open: null}]);
|
|
4290
4279
|
* console.log(store.getTables());
|
|
4291
4280
|
* // -> {pets: {fido: {species: 'dog', color: 'black'}}}
|
|
4292
4281
|
* console.log(store.getValues());
|
|
4293
4282
|
* // -> {}
|
|
4294
4283
|
* ```
|
|
4295
4284
|
* @category Setter
|
|
4296
|
-
* @since
|
|
4285
|
+
* @since v5.0.0
|
|
4297
4286
|
*/
|
|
4298
|
-
|
|
4299
|
-
transactionChanges: TransactionChanges<Schemas>,
|
|
4300
|
-
): Store<Schemas>;
|
|
4287
|
+
applyChanges(changes: Changes<Schemas>): Store<Schemas>;
|
|
4301
4288
|
|
|
4302
4289
|
/**
|
|
4303
4290
|
* The setTablesJson method takes a string serialization of all of the Tables
|
|
@@ -4306,7 +4293,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4306
4293
|
* This has schema-based typing. The following is a simplified representation:
|
|
4307
4294
|
*
|
|
4308
4295
|
* ```ts override
|
|
4309
|
-
* setTablesJson(tablesJson: Json):
|
|
4296
|
+
* setTablesJson(tablesJson: Json): this;
|
|
4310
4297
|
* ```
|
|
4311
4298
|
*
|
|
4312
4299
|
* If the JSON cannot be parsed, this will fail silently. If it can be parsed,
|
|
@@ -4346,7 +4333,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4346
4333
|
* This has schema-based typing. The following is a simplified representation:
|
|
4347
4334
|
*
|
|
4348
4335
|
* ```ts override
|
|
4349
|
-
* setValuesJson(valuesJson: Json):
|
|
4336
|
+
* setValuesJson(valuesJson: Json): this;
|
|
4350
4337
|
* ```
|
|
4351
4338
|
*
|
|
4352
4339
|
* If the JSON cannot be parsed, this will fail silently. If it can be parsed,
|
|
@@ -4386,7 +4373,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4386
4373
|
* This has schema-based typing. The following is a simplified representation:
|
|
4387
4374
|
*
|
|
4388
4375
|
* ```ts override
|
|
4389
|
-
* setJson(tablesAndValuesJson: Json):
|
|
4376
|
+
* setJson(tablesAndValuesJson: Json): this;
|
|
4390
4377
|
* ```
|
|
4391
4378
|
*
|
|
4392
4379
|
* From v3.0 onwards, the serialization should be of an array with two
|
|
@@ -4450,7 +4437,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4450
4437
|
* This has schema-based typing. The following is a simplified representation:
|
|
4451
4438
|
*
|
|
4452
4439
|
* ```ts override
|
|
4453
|
-
* setTablesSchema(tablesSchema: TablesSchema):
|
|
4440
|
+
* setTablesSchema(tablesSchema: TablesSchema): this;
|
|
4454
4441
|
* ```
|
|
4455
4442
|
*
|
|
4456
4443
|
* Note that this may result in a change to data in the Store, as defaults are
|
|
@@ -4490,7 +4477,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4490
4477
|
* This has schema-based typing. The following is a simplified representation:
|
|
4491
4478
|
*
|
|
4492
4479
|
* ```ts override
|
|
4493
|
-
* setValuesSchema(valuesSchema: ValuesSchema):
|
|
4480
|
+
* setValuesSchema(valuesSchema: ValuesSchema): this;
|
|
4494
4481
|
* ```
|
|
4495
4482
|
*
|
|
4496
4483
|
* Note that this may result in a change to data in the Store, as defaults are
|
|
@@ -4527,7 +4514,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4527
4514
|
* This has schema-based typing. The following is a simplified representation:
|
|
4528
4515
|
*
|
|
4529
4516
|
* ```ts override
|
|
4530
|
-
* setSchema(tablesSchema: TablesSchema, valuesSchema?: ValuesSchema):
|
|
4517
|
+
* setSchema(tablesSchema: TablesSchema, valuesSchema?: ValuesSchema): this;
|
|
4531
4518
|
* ```
|
|
4532
4519
|
*
|
|
4533
4520
|
* Note that this may result in a change to data in the Store, as defaults are
|
|
@@ -4603,7 +4590,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4603
4590
|
* This has schema-based typing. The following is a simplified representation:
|
|
4604
4591
|
*
|
|
4605
4592
|
* ```ts override
|
|
4606
|
-
* delTables():
|
|
4593
|
+
* delTables(): this;
|
|
4607
4594
|
* ```
|
|
4608
4595
|
*
|
|
4609
4596
|
* ```js
|
|
@@ -4627,7 +4614,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4627
4614
|
* This has schema-based typing. The following is a simplified representation:
|
|
4628
4615
|
*
|
|
4629
4616
|
* ```ts override
|
|
4630
|
-
* delTable(tableId: Id):
|
|
4617
|
+
* delTable(tableId: Id): this;
|
|
4631
4618
|
* ```
|
|
4632
4619
|
*
|
|
4633
4620
|
* ```js
|
|
@@ -4650,7 +4637,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4650
4637
|
* This has schema-based typing. The following is a simplified representation:
|
|
4651
4638
|
*
|
|
4652
4639
|
* ```ts override
|
|
4653
|
-
* delRow(tableId: Id, rowId: Id):
|
|
4640
|
+
* delRow(tableId: Id, rowId: Id): this;
|
|
4654
4641
|
* ```
|
|
4655
4642
|
*
|
|
4656
4643
|
* If this is the last Row in its Table, then that Table will be removed.
|
|
@@ -4679,7 +4666,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4679
4666
|
* This has schema-based typing. The following is a simplified representation:
|
|
4680
4667
|
*
|
|
4681
4668
|
* ```ts override
|
|
4682
|
-
* delCell(tableId: Id, rowId: Id, cellId: Id, forceDel?: boolean):
|
|
4669
|
+
* delCell(tableId: Id, rowId: Id, cellId: Id, forceDel?: boolean): this;
|
|
4683
4670
|
* ```
|
|
4684
4671
|
*
|
|
4685
4672
|
* When there is no TablesSchema applied to the Store, then if this is the
|
|
@@ -4773,7 +4760,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4773
4760
|
* This has schema-based typing. The following is a simplified representation:
|
|
4774
4761
|
*
|
|
4775
4762
|
* ```ts override
|
|
4776
|
-
* delValues():
|
|
4763
|
+
* delValues(): this;
|
|
4777
4764
|
* ```
|
|
4778
4765
|
*
|
|
4779
4766
|
* If there is a ValuesSchema applied to the Store and it specifies a default
|
|
@@ -4817,7 +4804,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4817
4804
|
* This has schema-based typing. The following is a simplified representation:
|
|
4818
4805
|
*
|
|
4819
4806
|
* ```ts override
|
|
4820
|
-
* delValue(valueId: Id):
|
|
4807
|
+
* delValue(valueId: Id): this;
|
|
4821
4808
|
* ```
|
|
4822
4809
|
*
|
|
4823
4810
|
* If there is a ValuesSchema applied to the Store and it specifies a default
|
|
@@ -4865,7 +4852,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4865
4852
|
* This has schema-based typing. The following is a simplified representation:
|
|
4866
4853
|
*
|
|
4867
4854
|
* ```ts override
|
|
4868
|
-
* delTablesSchema():
|
|
4855
|
+
* delTablesSchema(): this;
|
|
4869
4856
|
* ```
|
|
4870
4857
|
*
|
|
4871
4858
|
* ```js
|
|
@@ -4891,7 +4878,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4891
4878
|
* This has schema-based typing. The following is a simplified representation:
|
|
4892
4879
|
*
|
|
4893
4880
|
* ```ts override
|
|
4894
|
-
* delValuesSchema():
|
|
4881
|
+
* delValuesSchema(): this;
|
|
4895
4882
|
* ```
|
|
4896
4883
|
*
|
|
4897
4884
|
* ```js
|
|
@@ -4916,7 +4903,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4916
4903
|
* This has schema-based typing. The following is a simplified representation:
|
|
4917
4904
|
*
|
|
4918
4905
|
* ```ts override
|
|
4919
|
-
* delSchema():
|
|
4906
|
+
* delSchema(): this;
|
|
4920
4907
|
* ```
|
|
4921
4908
|
*
|
|
4922
4909
|
* Prior to v3.0, this method removed the TablesSchema only.
|
|
@@ -4971,10 +4958,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
4971
4958
|
*
|
|
4972
4959
|
* The second, optional parameter, `doRollback` is a DoRollback callback that
|
|
4973
4960
|
* 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.
|
|
4961
|
+
* satisfaction. See the DoRollback documentation for more details.
|
|
4978
4962
|
* @param actions The function to be executed as a transaction.
|
|
4979
4963
|
* @param doRollback An optional callback that should return `true` if you
|
|
4980
4964
|
* want to rollback the transaction at the end. Since v1.2.
|
|
@@ -5050,9 +5034,9 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5050
5034
|
* .setCell('pets', 'fido', 'info', {sold: null})
|
|
5051
5035
|
* .setValue('open', false)
|
|
5052
5036
|
* .setValue('employees', ['alice', 'bob']),
|
|
5053
|
-
* (
|
|
5054
|
-
* const
|
|
5055
|
-
* getTransactionLog();
|
|
5037
|
+
* () => {
|
|
5038
|
+
* const [, , changedCells, invalidCells, changedValues, invalidValues] =
|
|
5039
|
+
* store.getTransactionLog();
|
|
5056
5040
|
* console.log(store.getTables());
|
|
5057
5041
|
* console.log(changedCells);
|
|
5058
5042
|
* console.log(invalidCells);
|
|
@@ -5088,7 +5072,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5088
5072
|
* This has schema-based typing. The following is a simplified representation:
|
|
5089
5073
|
*
|
|
5090
5074
|
* ```ts override
|
|
5091
|
-
* startTransaction():
|
|
5075
|
+
* startTransaction(): this;
|
|
5092
5076
|
* ```
|
|
5093
5077
|
*
|
|
5094
5078
|
* Transactions are useful for making bulk changes to the data in a Store, and
|
|
@@ -5135,6 +5119,93 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5135
5119
|
*/
|
|
5136
5120
|
startTransaction(): Store<Schemas>;
|
|
5137
5121
|
|
|
5122
|
+
/**
|
|
5123
|
+
* The getTransactionChanges method returns the net meaningful changes that
|
|
5124
|
+
* have been made to a Store during a transaction.
|
|
5125
|
+
*
|
|
5126
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
5127
|
+
*
|
|
5128
|
+
* ```ts override
|
|
5129
|
+
* getTransactionChanges(): Changes;
|
|
5130
|
+
* ```
|
|
5131
|
+
*
|
|
5132
|
+
* This is useful for deciding whether to rollback a transaction, for example.
|
|
5133
|
+
* The returned object is only meaningful if the method is called when the
|
|
5134
|
+
* Store is in a transaction - such as in a TransactionListener.
|
|
5135
|
+
* @example
|
|
5136
|
+
* This example makes changes to the Store. At the end of the transaction,
|
|
5137
|
+
* detail about what changed is enumerated.
|
|
5138
|
+
*
|
|
5139
|
+
* ```js
|
|
5140
|
+
* const store = createStore()
|
|
5141
|
+
* .setTables({pets: {fido: {species: 'dog', color: 'brown'}}})
|
|
5142
|
+
* .setValues({open: true});
|
|
5143
|
+
*
|
|
5144
|
+
* store
|
|
5145
|
+
* .startTransaction()
|
|
5146
|
+
* .setCell('pets', 'fido', 'color', 'black')
|
|
5147
|
+
* .setValue('open', false)
|
|
5148
|
+
* .finishTransaction(() => {
|
|
5149
|
+
* const [changedCells, changedValues] = store.getTransactionChanges();
|
|
5150
|
+
* console.log(changedCells);
|
|
5151
|
+
* console.log(changedValues);
|
|
5152
|
+
* });
|
|
5153
|
+
* // -> {pets: {fido: {color: 'black'}}}
|
|
5154
|
+
* // -> {open: false}
|
|
5155
|
+
* ```
|
|
5156
|
+
* @category Transaction
|
|
5157
|
+
* @since v5.0.0
|
|
5158
|
+
*/
|
|
5159
|
+
getTransactionChanges(): Changes<Schemas>;
|
|
5160
|
+
|
|
5161
|
+
/**
|
|
5162
|
+
* The getTransactionLog method returns the changes that were made to a Store
|
|
5163
|
+
* during a transaction in more detail, including invalid changes, and what
|
|
5164
|
+
* previous values were.
|
|
5165
|
+
*
|
|
5166
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
5167
|
+
*
|
|
5168
|
+
* ```ts override
|
|
5169
|
+
* getTransactionLog(): TransactionLog;
|
|
5170
|
+
* ```
|
|
5171
|
+
*
|
|
5172
|
+
* This is useful for deciding whether to rollback a transaction, for example.
|
|
5173
|
+
* The returned object is only meaningful if the method is called when the
|
|
5174
|
+
* Store is in a transaction - such as in a TransactionListener.
|
|
5175
|
+
* @example
|
|
5176
|
+
* This example makes changes to the Store. At the end of the transaction,
|
|
5177
|
+
* detail about what changed is enumerated.
|
|
5178
|
+
*
|
|
5179
|
+
* ```js
|
|
5180
|
+
* const store = createStore()
|
|
5181
|
+
* .setTables({pets: {fido: {species: 'dog', color: 'brown'}}})
|
|
5182
|
+
* .setValues({open: true});
|
|
5183
|
+
*
|
|
5184
|
+
* store
|
|
5185
|
+
* .startTransaction()
|
|
5186
|
+
* .setCell('pets', 'fido', 'color', 'black')
|
|
5187
|
+
* .setCell('pets', 'fido', 'eyes', ['left', 'right'])
|
|
5188
|
+
* .setCell('pets', 'fido', 'info', {sold: null})
|
|
5189
|
+
* .setValue('open', false)
|
|
5190
|
+
* .setValue('employees', ['alice', 'bob'])
|
|
5191
|
+
* .finishTransaction(() => {
|
|
5192
|
+
* const [, , changedCells, invalidCells, changedValues, invalidValues] =
|
|
5193
|
+
* store.getTransactionLog();
|
|
5194
|
+
* console.log(changedCells);
|
|
5195
|
+
* console.log(invalidCells);
|
|
5196
|
+
* console.log(changedValues);
|
|
5197
|
+
* console.log(invalidValues);
|
|
5198
|
+
* });
|
|
5199
|
+
* // -> {pets: {fido: {color: ['brown', 'black']}}}
|
|
5200
|
+
* // -> {pets: {fido: {eyes: [['left', 'right']], info: [{sold: null}]}}}
|
|
5201
|
+
* // -> {open: [true, false]}
|
|
5202
|
+
* // -> {employees: [['alice', 'bob']]}
|
|
5203
|
+
* ```
|
|
5204
|
+
* @category Transaction
|
|
5205
|
+
* @since v5.0.0
|
|
5206
|
+
*/
|
|
5207
|
+
getTransactionLog(): TransactionLog<Schemas>;
|
|
5208
|
+
|
|
5138
5209
|
/**
|
|
5139
5210
|
* The finishTransaction method allows you to explicitly finish a transaction
|
|
5140
5211
|
* that has made multiple mutations to the Store, triggering all calls to the
|
|
@@ -5143,7 +5214,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5143
5214
|
* This has schema-based typing. The following is a simplified representation:
|
|
5144
5215
|
*
|
|
5145
5216
|
* ```ts override
|
|
5146
|
-
* finishTransaction(doRollback?: DoRollback):
|
|
5217
|
+
* finishTransaction(doRollback?: DoRollback): this;
|
|
5147
5218
|
* ```
|
|
5148
5219
|
*
|
|
5149
5220
|
* Transactions are useful for making bulk changes to the data in a Store, and
|
|
@@ -5212,9 +5283,9 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5212
5283
|
* .setCell('pets', 'fido', 'info', {sold: null})
|
|
5213
5284
|
* .setValue('open', false)
|
|
5214
5285
|
* .setValue('employees', ['alice', 'bob'])
|
|
5215
|
-
* .finishTransaction((
|
|
5216
|
-
* const
|
|
5217
|
-
* getTransactionLog();
|
|
5286
|
+
* .finishTransaction(() => {
|
|
5287
|
+
* const [, , changedCells, invalidCells, changedValues, invalidValues] =
|
|
5288
|
+
* store.getTransactionLog();
|
|
5218
5289
|
* console.log(store.getTables());
|
|
5219
5290
|
* console.log(changedCells);
|
|
5220
5291
|
* console.log(invalidCells);
|
|
@@ -5432,7 +5503,10 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5432
5503
|
* This has schema-based typing. The following is a simplified representation:
|
|
5433
5504
|
*
|
|
5434
5505
|
* ```ts override
|
|
5435
|
-
* addHasTablesListener(
|
|
5506
|
+
* addHasTablesListener(
|
|
5507
|
+
* listener: HasTablesListener<this>,
|
|
5508
|
+
* mutator?: boolean,
|
|
5509
|
+
* ): Id;
|
|
5436
5510
|
* ```
|
|
5437
5511
|
*
|
|
5438
5512
|
* The provided listener is a HasTablesListener function, and will be called
|
|
@@ -5494,7 +5568,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5494
5568
|
* @since v4.4.0
|
|
5495
5569
|
*/
|
|
5496
5570
|
addHasTablesListener(
|
|
5497
|
-
listener: HasTablesListener<Schemas>,
|
|
5571
|
+
listener: HasTablesListener<Schemas, this>,
|
|
5498
5572
|
mutator?: boolean,
|
|
5499
5573
|
): Id;
|
|
5500
5574
|
|
|
@@ -5505,7 +5579,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5505
5579
|
* This has schema-based typing. The following is a simplified representation:
|
|
5506
5580
|
*
|
|
5507
5581
|
* ```ts override
|
|
5508
|
-
* addTablesListener(listener: TablesListener
|
|
5582
|
+
* addTablesListener(listener: TablesListener<this>, mutator?: boolean): Id;
|
|
5509
5583
|
* ```
|
|
5510
5584
|
*
|
|
5511
5585
|
* The provided listener is a TablesListener function, and will be called with
|
|
@@ -5565,7 +5639,10 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5565
5639
|
* ```
|
|
5566
5640
|
* @category Listener
|
|
5567
5641
|
*/
|
|
5568
|
-
addTablesListener(
|
|
5642
|
+
addTablesListener(
|
|
5643
|
+
listener: TablesListener<Schemas, this>,
|
|
5644
|
+
mutator?: boolean,
|
|
5645
|
+
): Id;
|
|
5569
5646
|
|
|
5570
5647
|
/**
|
|
5571
5648
|
* The addTableIdsListener method registers a listener function with the Store
|
|
@@ -5574,7 +5651,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5574
5651
|
* This has schema-based typing. The following is a simplified representation:
|
|
5575
5652
|
*
|
|
5576
5653
|
* ```ts override
|
|
5577
|
-
* addTableIdsListener(listener: TableIdsListener
|
|
5654
|
+
* addTableIdsListener(listener: TableIdsListener<this>, mutator?: boolean): Id;
|
|
5578
5655
|
* ```
|
|
5579
5656
|
*
|
|
5580
5657
|
* The provided listener is a TableIdsListener function, and will be called
|
|
@@ -5634,7 +5711,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5634
5711
|
* @category Listener
|
|
5635
5712
|
*/
|
|
5636
5713
|
addTableIdsListener(
|
|
5637
|
-
listener: TableIdsListener<Schemas>,
|
|
5714
|
+
listener: TableIdsListener<Schemas, this>,
|
|
5638
5715
|
mutator?: boolean,
|
|
5639
5716
|
): Id;
|
|
5640
5717
|
|
|
@@ -5647,7 +5724,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5647
5724
|
* ```ts override
|
|
5648
5725
|
* addHasTableListener(
|
|
5649
5726
|
* tableId: IdOrNull,
|
|
5650
|
-
* listener: HasTableListener
|
|
5727
|
+
* listener: HasTableListener<this>,
|
|
5651
5728
|
* mutator?: boolean,
|
|
5652
5729
|
* ): Id;
|
|
5653
5730
|
* ```
|
|
@@ -5747,7 +5824,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5747
5824
|
TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null,
|
|
5748
5825
|
>(
|
|
5749
5826
|
tableId: TableIdOrNull,
|
|
5750
|
-
listener: HasTableListener<Schemas, TableIdOrNull>,
|
|
5827
|
+
listener: HasTableListener<Schemas, TableIdOrNull, this>,
|
|
5751
5828
|
mutator?: boolean,
|
|
5752
5829
|
): Id;
|
|
5753
5830
|
|
|
@@ -5760,7 +5837,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5760
5837
|
* ```ts override
|
|
5761
5838
|
* addTableListener(
|
|
5762
5839
|
* tableId: IdOrNull,
|
|
5763
|
-
* listener: TableListener
|
|
5840
|
+
* listener: TableListener<this>,
|
|
5764
5841
|
* mutator?: boolean,
|
|
5765
5842
|
* ): Id;
|
|
5766
5843
|
* ```
|
|
@@ -5853,7 +5930,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5853
5930
|
*/
|
|
5854
5931
|
addTableListener<TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null>(
|
|
5855
5932
|
tableId: TableIdOrNull,
|
|
5856
|
-
listener: TableListener<Schemas, TableIdOrNull>,
|
|
5933
|
+
listener: TableListener<Schemas, TableIdOrNull, this>,
|
|
5857
5934
|
mutator?: boolean,
|
|
5858
5935
|
): Id;
|
|
5859
5936
|
|
|
@@ -5867,7 +5944,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5867
5944
|
* ```ts override
|
|
5868
5945
|
* addTableCellIdsListener(
|
|
5869
5946
|
* tableId: IdOrNull,
|
|
5870
|
-
* listener: TableCellIdsListener
|
|
5947
|
+
* listener: TableCellIdsListener<this>,
|
|
5871
5948
|
* mutator?: boolean,
|
|
5872
5949
|
* ): Id;
|
|
5873
5950
|
* ```
|
|
@@ -5969,7 +6046,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5969
6046
|
TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null,
|
|
5970
6047
|
>(
|
|
5971
6048
|
tableId: TableIdOrNull,
|
|
5972
|
-
listener: TableCellIdsListener<Schemas, TableIdOrNull>,
|
|
6049
|
+
listener: TableCellIdsListener<Schemas, TableIdOrNull, this>,
|
|
5973
6050
|
mutator?: boolean,
|
|
5974
6051
|
): Id;
|
|
5975
6052
|
|
|
@@ -5984,7 +6061,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
5984
6061
|
* addHasTableCellListener(
|
|
5985
6062
|
* tableId: IdOrNull,
|
|
5986
6063
|
* cellId: IdOrNull,
|
|
5987
|
-
* listener: HasTableCellListener
|
|
6064
|
+
* listener: HasTableCellListener<this>,
|
|
5988
6065
|
* mutator?: boolean,
|
|
5989
6066
|
* ): Id;
|
|
5990
6067
|
* ```
|
|
@@ -6106,7 +6183,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6106
6183
|
>(
|
|
6107
6184
|
tableId: TableIdOrNull,
|
|
6108
6185
|
cellId: CellIdOrNull,
|
|
6109
|
-
listener: HasTableCellListener<Schemas, TableIdOrNull, CellIdOrNull>,
|
|
6186
|
+
listener: HasTableCellListener<Schemas, TableIdOrNull, CellIdOrNull, this>,
|
|
6110
6187
|
mutator?: boolean,
|
|
6111
6188
|
): Id;
|
|
6112
6189
|
|
|
@@ -6119,7 +6196,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6119
6196
|
* ```ts override
|
|
6120
6197
|
* addRowCountListener(
|
|
6121
6198
|
* tableId: IdOrNull,
|
|
6122
|
-
* listener: RowCountListener
|
|
6199
|
+
* listener: RowCountListener<this>,
|
|
6123
6200
|
* mutator?: boolean,
|
|
6124
6201
|
* ): Id;
|
|
6125
6202
|
* ```
|
|
@@ -6211,7 +6288,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6211
6288
|
TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null,
|
|
6212
6289
|
>(
|
|
6213
6290
|
tableId: TableIdOrNull,
|
|
6214
|
-
listener: RowCountListener<Schemas, TableIdOrNull>,
|
|
6291
|
+
listener: RowCountListener<Schemas, TableIdOrNull, this>,
|
|
6215
6292
|
mutator?: boolean,
|
|
6216
6293
|
): Id;
|
|
6217
6294
|
|
|
@@ -6224,7 +6301,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6224
6301
|
* ```ts override
|
|
6225
6302
|
* addRowIdsListener(
|
|
6226
6303
|
* tableId: IdOrNull,
|
|
6227
|
-
* listener: RowIdsListener
|
|
6304
|
+
* listener: RowIdsListener<this>,
|
|
6228
6305
|
* mutator?: boolean,
|
|
6229
6306
|
* ): Id;
|
|
6230
6307
|
* ```
|
|
@@ -6312,7 +6389,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6312
6389
|
*/
|
|
6313
6390
|
addRowIdsListener<TableIdOrNull extends TableIdFromSchema<Schemas[0]> | null>(
|
|
6314
6391
|
tableId: TableIdOrNull,
|
|
6315
|
-
listener: RowIdsListener<Schemas, TableIdOrNull>,
|
|
6392
|
+
listener: RowIdsListener<Schemas, TableIdOrNull, this>,
|
|
6316
6393
|
mutator?: boolean,
|
|
6317
6394
|
): Id;
|
|
6318
6395
|
|
|
@@ -6330,7 +6407,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6330
6407
|
* descending: boolean,
|
|
6331
6408
|
* offset: number,
|
|
6332
6409
|
* limit: number | undefined,
|
|
6333
|
-
* listener: SortedRowIdsListener
|
|
6410
|
+
* listener: SortedRowIdsListener<this>,
|
|
6334
6411
|
* mutator?: boolean,
|
|
6335
6412
|
* ): Id;
|
|
6336
6413
|
* ```
|
|
@@ -6563,7 +6640,8 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6563
6640
|
CellIdOrUndefined,
|
|
6564
6641
|
Descending,
|
|
6565
6642
|
Offset,
|
|
6566
|
-
Limit
|
|
6643
|
+
Limit,
|
|
6644
|
+
this
|
|
6567
6645
|
>,
|
|
6568
6646
|
mutator?: boolean,
|
|
6569
6647
|
): Id;
|
|
@@ -6578,7 +6656,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6578
6656
|
* addHasRowListener(
|
|
6579
6657
|
* tableId: IdOrNull,
|
|
6580
6658
|
* rowId: IdOrNull,
|
|
6581
|
-
* listener: HasRowListener
|
|
6659
|
+
* listener: HasRowListener<this>,
|
|
6582
6660
|
* mutator?: boolean,
|
|
6583
6661
|
* ): Id;
|
|
6584
6662
|
* ```
|
|
@@ -6695,7 +6773,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6695
6773
|
>(
|
|
6696
6774
|
tableId: TableIdOrNull,
|
|
6697
6775
|
rowId: RowIdOrNull,
|
|
6698
|
-
listener: HasRowListener<Schemas, TableIdOrNull, RowIdOrNull>,
|
|
6776
|
+
listener: HasRowListener<Schemas, TableIdOrNull, RowIdOrNull, this>,
|
|
6699
6777
|
mutator?: boolean,
|
|
6700
6778
|
): Id;
|
|
6701
6779
|
|
|
@@ -6709,7 +6787,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6709
6787
|
* addRowListener(
|
|
6710
6788
|
* tableId: IdOrNull,
|
|
6711
6789
|
* rowId: IdOrNull,
|
|
6712
|
-
* listener: RowListener
|
|
6790
|
+
* listener: RowListener<this>,
|
|
6713
6791
|
* mutator?: boolean,
|
|
6714
6792
|
* ): Id;
|
|
6715
6793
|
* ```
|
|
@@ -6818,7 +6896,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6818
6896
|
>(
|
|
6819
6897
|
tableId: TableIdOrNull,
|
|
6820
6898
|
rowId: RowIdOrNull,
|
|
6821
|
-
listener: RowListener<Schemas, TableIdOrNull, RowIdOrNull>,
|
|
6899
|
+
listener: RowListener<Schemas, TableIdOrNull, RowIdOrNull, this>,
|
|
6822
6900
|
mutator?: boolean,
|
|
6823
6901
|
): Id;
|
|
6824
6902
|
|
|
@@ -6832,7 +6910,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6832
6910
|
* addCellIdsListener(
|
|
6833
6911
|
* tableId: IdOrNull,
|
|
6834
6912
|
* rowId: IdOrNull,
|
|
6835
|
-
* listener: CellIdsListener
|
|
6913
|
+
* listener: CellIdsListener<this>,
|
|
6836
6914
|
* mutator?: boolean,
|
|
6837
6915
|
* ): Id;
|
|
6838
6916
|
* ```
|
|
@@ -6937,7 +7015,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6937
7015
|
>(
|
|
6938
7016
|
tableId: TableIdOrNull,
|
|
6939
7017
|
rowId: RowIdOrNull,
|
|
6940
|
-
listener: CellIdsListener<Schemas, TableIdOrNull, RowIdOrNull>,
|
|
7018
|
+
listener: CellIdsListener<Schemas, TableIdOrNull, RowIdOrNull, this>,
|
|
6941
7019
|
mutator?: boolean,
|
|
6942
7020
|
): Id;
|
|
6943
7021
|
|
|
@@ -6952,7 +7030,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
6952
7030
|
* tableId: IdOrNull,
|
|
6953
7031
|
* rowId: IdOrNull,
|
|
6954
7032
|
* cellId: IdOrNull,
|
|
6955
|
-
* listener: HasCellListener
|
|
7033
|
+
* listener: HasCellListener<this>,
|
|
6956
7034
|
* mutator?: boolean,
|
|
6957
7035
|
* ): Id;
|
|
6958
7036
|
* ```
|
|
@@ -7085,7 +7163,8 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7085
7163
|
Schemas,
|
|
7086
7164
|
TableIdOrNull,
|
|
7087
7165
|
RowIdOrNull,
|
|
7088
|
-
CellIdOrNull
|
|
7166
|
+
CellIdOrNull,
|
|
7167
|
+
this
|
|
7089
7168
|
>,
|
|
7090
7169
|
mutator?: boolean,
|
|
7091
7170
|
): Id;
|
|
@@ -7101,7 +7180,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7101
7180
|
* tableId: IdOrNull,
|
|
7102
7181
|
* rowId: IdOrNull,
|
|
7103
7182
|
* cellId: IdOrNull,
|
|
7104
|
-
* listener: CellListener
|
|
7183
|
+
* listener: CellListener<this>,
|
|
7105
7184
|
* mutator?: boolean,
|
|
7106
7185
|
* ): Id;
|
|
7107
7186
|
* ```
|
|
@@ -7225,7 +7304,13 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7225
7304
|
tableId: TableIdOrNull,
|
|
7226
7305
|
rowId: RowIdOrNull,
|
|
7227
7306
|
cellId: CellIdOrNull,
|
|
7228
|
-
listener: CellListener<
|
|
7307
|
+
listener: CellListener<
|
|
7308
|
+
Schemas,
|
|
7309
|
+
TableIdOrNull,
|
|
7310
|
+
RowIdOrNull,
|
|
7311
|
+
CellIdOrNull,
|
|
7312
|
+
this
|
|
7313
|
+
>,
|
|
7229
7314
|
mutator?: boolean,
|
|
7230
7315
|
): Id;
|
|
7231
7316
|
|
|
@@ -7237,7 +7322,10 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7237
7322
|
* This has schema-based typing. The following is a simplified representation:
|
|
7238
7323
|
*
|
|
7239
7324
|
* ```ts override
|
|
7240
|
-
* addHasValuesListener(
|
|
7325
|
+
* addHasValuesListener(
|
|
7326
|
+
* listener: HasValuesListener<this>,
|
|
7327
|
+
* mutator?: boolean,
|
|
7328
|
+
* ): Id;
|
|
7241
7329
|
* ```
|
|
7242
7330
|
*
|
|
7243
7331
|
* The provided listener is a HasValuesListener function, and will be called
|
|
@@ -7297,7 +7385,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7297
7385
|
* @since v4.4.0
|
|
7298
7386
|
*/
|
|
7299
7387
|
addHasValuesListener(
|
|
7300
|
-
listener: HasValuesListener<Schemas>,
|
|
7388
|
+
listener: HasValuesListener<Schemas, this>,
|
|
7301
7389
|
mutator?: boolean,
|
|
7302
7390
|
): Id;
|
|
7303
7391
|
|
|
@@ -7308,7 +7396,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7308
7396
|
* This has schema-based typing. The following is a simplified representation:
|
|
7309
7397
|
*
|
|
7310
7398
|
* ```ts override
|
|
7311
|
-
* addValuesListener(listener: ValuesListener
|
|
7399
|
+
* addValuesListener(listener: ValuesListener<this>, mutator?: boolean): Id;
|
|
7312
7400
|
* ```
|
|
7313
7401
|
*
|
|
7314
7402
|
* The provided listener is a ValuesListener function, and will be called with
|
|
@@ -7365,7 +7453,10 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7365
7453
|
* @category Listener
|
|
7366
7454
|
* @since v3.0.0
|
|
7367
7455
|
*/
|
|
7368
|
-
addValuesListener(
|
|
7456
|
+
addValuesListener(
|
|
7457
|
+
listener: ValuesListener<Schemas, this>,
|
|
7458
|
+
mutator?: boolean,
|
|
7459
|
+
): Id;
|
|
7369
7460
|
|
|
7370
7461
|
/**
|
|
7371
7462
|
* The addValueIdsListener method registers a listener function with the Store
|
|
@@ -7374,7 +7465,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7374
7465
|
* This has schema-based typing. The following is a simplified representation:
|
|
7375
7466
|
*
|
|
7376
7467
|
* ```ts override
|
|
7377
|
-
* addValueIdsListener(listener: ValueIdsListener
|
|
7468
|
+
* addValueIdsListener(listener: ValueIdsListener<this>, mutator?: boolean): Id;
|
|
7378
7469
|
* ```
|
|
7379
7470
|
*
|
|
7380
7471
|
* The provided listener is a ValueIdsListener function, and will be called
|
|
@@ -7435,7 +7526,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7435
7526
|
* @since v3.0.0
|
|
7436
7527
|
*/
|
|
7437
7528
|
addValueIdsListener(
|
|
7438
|
-
listener: ValueIdsListener<Schemas>,
|
|
7529
|
+
listener: ValueIdsListener<Schemas, this>,
|
|
7439
7530
|
mutator?: boolean,
|
|
7440
7531
|
): Id;
|
|
7441
7532
|
|
|
@@ -7448,7 +7539,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7448
7539
|
* ```ts override
|
|
7449
7540
|
* addHasValueListener(
|
|
7450
7541
|
* valueId: IdOrNull,
|
|
7451
|
-
* listener: HasValueListener
|
|
7542
|
+
* listener: HasValueListener<this>,
|
|
7452
7543
|
* mutator?: boolean,
|
|
7453
7544
|
* ): Id;
|
|
7454
7545
|
* ```
|
|
@@ -7542,7 +7633,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7542
7633
|
ValueIdOrNull extends ValueIdFromSchema<Schemas[1]> | null,
|
|
7543
7634
|
>(
|
|
7544
7635
|
valueId: ValueIdOrNull,
|
|
7545
|
-
listener: HasValueListener<Schemas, ValueIdOrNull>,
|
|
7636
|
+
listener: HasValueListener<Schemas, ValueIdOrNull, this>,
|
|
7546
7637
|
mutator?: boolean,
|
|
7547
7638
|
): Id;
|
|
7548
7639
|
|
|
@@ -7555,7 +7646,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7555
7646
|
* ```ts override
|
|
7556
7647
|
* addValueListener(
|
|
7557
7648
|
* valueId: IdOrNull,
|
|
7558
|
-
* listener: ValueListener
|
|
7649
|
+
* listener: ValueListener<this>,
|
|
7559
7650
|
* mutator?: boolean,
|
|
7560
7651
|
* ): Id;
|
|
7561
7652
|
* ```
|
|
@@ -7644,7 +7735,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7644
7735
|
*/
|
|
7645
7736
|
addValueListener<ValueIdOrNull extends ValueIdFromSchema<Schemas[1]> | null>(
|
|
7646
7737
|
valueId: ValueIdOrNull,
|
|
7647
|
-
listener: ValueListener<Schemas, ValueIdOrNull>,
|
|
7738
|
+
listener: ValueListener<Schemas, ValueIdOrNull, this>,
|
|
7648
7739
|
mutator?: boolean,
|
|
7649
7740
|
): Id;
|
|
7650
7741
|
|
|
@@ -7660,7 +7751,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7660
7751
|
* tableId: IdOrNull,
|
|
7661
7752
|
* rowId: IdOrNull,
|
|
7662
7753
|
* cellId: IdOrNull,
|
|
7663
|
-
* listener: InvalidCellListener
|
|
7754
|
+
* listener: InvalidCellListener<this>,
|
|
7664
7755
|
* mutator?: boolean,
|
|
7665
7756
|
* ): Id;
|
|
7666
7757
|
* ```
|
|
@@ -7886,7 +7977,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7886
7977
|
tableId: IdOrNull,
|
|
7887
7978
|
rowId: IdOrNull,
|
|
7888
7979
|
cellId: IdOrNull,
|
|
7889
|
-
listener: InvalidCellListener<Schemas>,
|
|
7980
|
+
listener: InvalidCellListener<Schemas, this>,
|
|
7890
7981
|
mutator?: boolean,
|
|
7891
7982
|
): Id;
|
|
7892
7983
|
|
|
@@ -7900,7 +7991,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
7900
7991
|
* ```ts override
|
|
7901
7992
|
* addInvalidValueListener(
|
|
7902
7993
|
* valueId: IdOrNull,
|
|
7903
|
-
* listener: InvalidValueListener
|
|
7994
|
+
* listener: InvalidValueListener<this>,
|
|
7904
7995
|
* mutator?: boolean,
|
|
7905
7996
|
* ): Id;
|
|
7906
7997
|
* ```
|
|
@@ -8071,7 +8162,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8071
8162
|
*/
|
|
8072
8163
|
addInvalidValueListener(
|
|
8073
8164
|
valueId: IdOrNull,
|
|
8074
|
-
listener: InvalidValueListener<Schemas>,
|
|
8165
|
+
listener: InvalidValueListener<Schemas, this>,
|
|
8075
8166
|
mutator?: boolean,
|
|
8076
8167
|
): Id;
|
|
8077
8168
|
|
|
@@ -8082,7 +8173,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8082
8173
|
* This has schema-based typing. The following is a simplified representation:
|
|
8083
8174
|
*
|
|
8084
8175
|
* ```ts override
|
|
8085
|
-
* addStartTransactionListener(listener: TransactionListener): Id;
|
|
8176
|
+
* addStartTransactionListener(listener: TransactionListener<this>): Id;
|
|
8086
8177
|
* ```
|
|
8087
8178
|
*
|
|
8088
8179
|
* The provided TransactionListener will receive a reference to the Store and
|
|
@@ -8125,7 +8216,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8125
8216
|
* @category Listener
|
|
8126
8217
|
* @since v3.2.0
|
|
8127
8218
|
*/
|
|
8128
|
-
addStartTransactionListener(listener: TransactionListener<Schemas>): Id;
|
|
8219
|
+
addStartTransactionListener(listener: TransactionListener<Schemas, this>): Id;
|
|
8129
8220
|
|
|
8130
8221
|
/**
|
|
8131
8222
|
* The addWillFinishTransactionListener method registers a listener function
|
|
@@ -8135,7 +8226,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8135
8226
|
* This has schema-based typing. The following is a simplified representation:
|
|
8136
8227
|
*
|
|
8137
8228
|
* ```ts override
|
|
8138
|
-
* addWillFinishTransactionListener(listener: TransactionListener): Id;
|
|
8229
|
+
* addWillFinishTransactionListener(listener: TransactionListener<this>): Id;
|
|
8139
8230
|
* ```
|
|
8140
8231
|
*
|
|
8141
8232
|
* This is useful if you need to know that a set of listeners are about to be
|
|
@@ -8172,12 +8263,10 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8172
8263
|
* pets: {fido: {species: 'dog', color: 'brown'}},
|
|
8173
8264
|
* })
|
|
8174
8265
|
* .setValues({open: true, employees: 3});
|
|
8175
|
-
* const listenerId = store.addWillFinishTransactionListener(
|
|
8176
|
-
*
|
|
8177
|
-
*
|
|
8178
|
-
*
|
|
8179
|
-
* },
|
|
8180
|
-
* );
|
|
8266
|
+
* const listenerId = store.addWillFinishTransactionListener((store) => {
|
|
8267
|
+
* const [cellsTouched, valuesTouched] = store.getTransactionLog() ?? {};
|
|
8268
|
+
* console.log(`Cells/Values touched: ${cellsTouched}/${valuesTouched}`);
|
|
8269
|
+
* });
|
|
8181
8270
|
* const listenerId2 = store.addTablesListener(() =>
|
|
8182
8271
|
* console.log('Tables changed'),
|
|
8183
8272
|
* );
|
|
@@ -8219,7 +8308,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8219
8308
|
* // Transaction was rolled back.
|
|
8220
8309
|
*
|
|
8221
8310
|
* store.callListener(listenerId);
|
|
8222
|
-
* // -> 'Cells/Values touched:
|
|
8311
|
+
* // -> 'Cells/Values touched: false/false'
|
|
8223
8312
|
* // It is meaningless to call this listener directly.
|
|
8224
8313
|
*
|
|
8225
8314
|
* store
|
|
@@ -8230,7 +8319,9 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8230
8319
|
* @category Listener
|
|
8231
8320
|
* @since v1.3.0
|
|
8232
8321
|
*/
|
|
8233
|
-
addWillFinishTransactionListener(
|
|
8322
|
+
addWillFinishTransactionListener(
|
|
8323
|
+
listener: TransactionListener<Schemas, this>,
|
|
8324
|
+
): Id;
|
|
8234
8325
|
|
|
8235
8326
|
/**
|
|
8236
8327
|
* The addDidFinishTransactionListener method registers a listener function
|
|
@@ -8240,7 +8331,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8240
8331
|
* This has schema-based typing. The following is a simplified representation:
|
|
8241
8332
|
*
|
|
8242
8333
|
* ```ts override
|
|
8243
|
-
* addDidFinishTransactionListener(listener: TransactionListener): Id;
|
|
8334
|
+
* addDidFinishTransactionListener(listener: TransactionListener<this>): Id;
|
|
8244
8335
|
* ```
|
|
8245
8336
|
*
|
|
8246
8337
|
* This is useful if you need to know that a set of listeners have just been
|
|
@@ -8276,12 +8367,10 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8276
8367
|
* pets: {fido: {species: 'dog', color: 'brown'}},
|
|
8277
8368
|
* })
|
|
8278
8369
|
* .setValues({open: true, employees: 3});
|
|
8279
|
-
* const listenerId = store.addDidFinishTransactionListener(
|
|
8280
|
-
*
|
|
8281
|
-
*
|
|
8282
|
-
*
|
|
8283
|
-
* },
|
|
8284
|
-
* );
|
|
8370
|
+
* const listenerId = store.addDidFinishTransactionListener((store) => {
|
|
8371
|
+
* const [cellsTouched, valuesTouched] = store.getTransactionLog() ?? {};
|
|
8372
|
+
* console.log(`Cells/Values touched: ${cellsTouched}/${valuesTouched}`);
|
|
8373
|
+
* });
|
|
8285
8374
|
* const listenerId2 = store.addTablesListener(() =>
|
|
8286
8375
|
* console.log('Tables changed'),
|
|
8287
8376
|
* );
|
|
@@ -8323,7 +8412,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8323
8412
|
* // Transaction was rolled back.
|
|
8324
8413
|
*
|
|
8325
8414
|
* store.callListener(listenerId);
|
|
8326
|
-
* // -> 'Cells/Values touched:
|
|
8415
|
+
* // -> 'Cells/Values touched: false/false'
|
|
8327
8416
|
* // It is meaningless to call this listener directly.
|
|
8328
8417
|
*
|
|
8329
8418
|
* store
|
|
@@ -8334,7 +8423,9 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8334
8423
|
* @category Listener
|
|
8335
8424
|
* @since v1.3.0
|
|
8336
8425
|
*/
|
|
8337
|
-
addDidFinishTransactionListener(
|
|
8426
|
+
addDidFinishTransactionListener(
|
|
8427
|
+
listener: TransactionListener<Schemas, this>,
|
|
8428
|
+
): Id;
|
|
8338
8429
|
|
|
8339
8430
|
/**
|
|
8340
8431
|
* The callListener method provides a way for you to manually provoke a
|
|
@@ -8343,7 +8434,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8343
8434
|
* This has schema-based typing. The following is a simplified representation:
|
|
8344
8435
|
*
|
|
8345
8436
|
* ```ts override
|
|
8346
|
-
* callListener(listenerId: Id):
|
|
8437
|
+
* callListener(listenerId: Id): this;
|
|
8347
8438
|
* ```
|
|
8348
8439
|
*
|
|
8349
8440
|
* This is useful when you are using mutator listeners to guarantee that data
|
|
@@ -8465,7 +8556,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
|
|
|
8465
8556
|
* This has schema-based typing. The following is a simplified representation:
|
|
8466
8557
|
*
|
|
8467
8558
|
* ```ts override
|
|
8468
|
-
* delListener(listenerId: Id):
|
|
8559
|
+
* delListener(listenerId: Id): this;
|
|
8469
8560
|
* ```
|
|
8470
8561
|
*
|
|
8471
8562
|
* Use the Id returned by whichever method was used to add the listener. Note
|