tinybase 8.6.0-beta.0 → 9.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@types/_internal/queries/with-schemas/index.d.ts +1 -2
- package/@types/_internal/ui/with-schemas/index.d.ts +8 -16
- package/@types/persisters/index.d.ts +32 -12
- package/@types/persisters/persister-durable-object-sql-storage/index.d.ts +9 -8
- package/@types/persisters/persister-durable-object-sql-storage/with-schemas/index.d.ts +10 -10
- package/@types/persisters/with-schemas/index.d.ts +56 -20
- package/@types/queries/index.d.ts +1 -7
- package/@types/queries/with-schemas/index.d.ts +5 -15
- package/@types/store/index.d.ts +1 -2
- package/@types/store/with-schemas/index.d.ts +19 -29
- package/@types/synchronizers/synchronizer-ws-client/index.d.ts +9 -3
- package/@types/synchronizers/synchronizer-ws-client/with-schemas/index.d.ts +10 -3
- package/@types/synchronizers/synchronizer-ws-server/index.d.ts +15 -2
- package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.ts +17 -2
- package/@types/synchronizers/synchronizer-ws-server-durable-object/index.d.ts +51 -0
- package/@types/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.d.ts +51 -0
- package/@types/ui-react/with-schemas/index.d.ts +3 -6
- package/@types/ui-react-dom/with-schemas/index.d.ts +6 -12
- package/@types/ui-react-dom-charts/with-schemas/index.d.ts +3 -4
- package/@types/ui-solid/with-schemas/index.d.ts +4 -8
- package/@types/ui-solid-dom/with-schemas/index.d.ts +6 -12
- package/@types/ui-svelte-dom/with-schemas/index.d.ts +6 -12
- package/index.js +21 -19
- package/indexes/index.js +6 -8
- package/indexes/with-schemas/index.js +6 -8
- package/metrics/index.js +6 -8
- package/metrics/with-schemas/index.js +6 -8
- package/min/index.js +1 -1
- package/min/index.js.gz +0 -0
- package/min/omni/index.js +1 -1
- package/min/omni/index.js.gz +0 -0
- package/min/omni/with-schemas/index.js +1 -1
- package/min/omni/with-schemas/index.js.gz +0 -0
- package/min/persisters/index.js +1 -1
- package/min/persisters/index.js.gz +0 -0
- package/min/persisters/persister-cr-sqlite-wasm/index.js +1 -1
- package/min/persisters/persister-cr-sqlite-wasm/index.js.gz +0 -0
- package/min/persisters/persister-cr-sqlite-wasm/with-schemas/index.js +1 -1
- package/min/persisters/persister-cr-sqlite-wasm/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-durable-object-sql-storage/index.js +1 -1
- package/min/persisters/persister-durable-object-sql-storage/index.js.gz +0 -0
- package/min/persisters/persister-durable-object-sql-storage/with-schemas/index.js +1 -1
- package/min/persisters/persister-durable-object-sql-storage/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-electric-sql/index.js +1 -1
- package/min/persisters/persister-electric-sql/index.js.gz +0 -0
- package/min/persisters/persister-electric-sql/with-schemas/index.js +1 -1
- package/min/persisters/persister-electric-sql/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-expo-sqlite/index.js +1 -1
- package/min/persisters/persister-expo-sqlite/index.js.gz +0 -0
- package/min/persisters/persister-expo-sqlite/with-schemas/index.js +1 -1
- package/min/persisters/persister-expo-sqlite/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-libsql/index.js +1 -1
- package/min/persisters/persister-libsql/index.js.gz +0 -0
- package/min/persisters/persister-libsql/with-schemas/index.js +1 -1
- package/min/persisters/persister-libsql/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-pglite/index.js +1 -1
- package/min/persisters/persister-pglite/index.js.gz +0 -0
- package/min/persisters/persister-pglite/with-schemas/index.js +1 -1
- package/min/persisters/persister-pglite/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-postgres/index.js +1 -1
- package/min/persisters/persister-postgres/index.js.gz +0 -0
- package/min/persisters/persister-postgres/with-schemas/index.js +1 -1
- package/min/persisters/persister-postgres/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-powersync/index.js +1 -1
- package/min/persisters/persister-powersync/index.js.gz +0 -0
- package/min/persisters/persister-powersync/with-schemas/index.js +1 -1
- package/min/persisters/persister-powersync/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-react-native-sqlite/index.js +1 -1
- package/min/persisters/persister-react-native-sqlite/index.js.gz +0 -0
- package/min/persisters/persister-react-native-sqlite/with-schemas/index.js +1 -1
- package/min/persisters/persister-react-native-sqlite/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-sqlite-bun/index.js +1 -1
- package/min/persisters/persister-sqlite-bun/index.js.gz +0 -0
- package/min/persisters/persister-sqlite-bun/with-schemas/index.js +1 -1
- package/min/persisters/persister-sqlite-bun/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-sqlite-wasm/index.js +1 -1
- package/min/persisters/persister-sqlite-wasm/index.js.gz +0 -0
- package/min/persisters/persister-sqlite-wasm/with-schemas/index.js +1 -1
- package/min/persisters/persister-sqlite-wasm/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-sqlite3/index.js +1 -1
- package/min/persisters/persister-sqlite3/index.js.gz +0 -0
- package/min/persisters/persister-sqlite3/with-schemas/index.js +1 -1
- package/min/persisters/persister-sqlite3/with-schemas/index.js.gz +0 -0
- package/min/persisters/with-schemas/index.js +1 -1
- package/min/persisters/with-schemas/index.js.gz +0 -0
- package/min/queries/index.js +1 -1
- package/min/queries/index.js.gz +0 -0
- package/min/queries/with-schemas/index.js +1 -1
- package/min/queries/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-client/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server-durable-object/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server-durable-object/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js.gz +0 -0
- package/min/with-schemas/index.js +1 -1
- package/min/with-schemas/index.js.gz +0 -0
- package/omni/index.js +311 -141
- package/omni/with-schemas/index.js +311 -141
- package/package.json +7 -7
- package/persisters/index.js +129 -37
- package/persisters/persister-cr-sqlite-wasm/index.js +129 -37
- package/persisters/persister-cr-sqlite-wasm/with-schemas/index.js +129 -37
- package/persisters/persister-durable-object-sql-storage/index.js +271 -110
- package/persisters/persister-durable-object-sql-storage/with-schemas/index.js +271 -110
- package/persisters/persister-electric-sql/index.js +129 -37
- package/persisters/persister-electric-sql/with-schemas/index.js +129 -37
- package/persisters/persister-expo-sqlite/index.js +129 -37
- package/persisters/persister-expo-sqlite/with-schemas/index.js +129 -37
- package/persisters/persister-libsql/index.js +129 -37
- package/persisters/persister-libsql/with-schemas/index.js +129 -37
- package/persisters/persister-pglite/index.js +130 -37
- package/persisters/persister-pglite/with-schemas/index.js +130 -37
- package/persisters/persister-postgres/index.js +130 -37
- package/persisters/persister-postgres/with-schemas/index.js +130 -37
- package/persisters/persister-powersync/index.js +182 -117
- package/persisters/persister-powersync/with-schemas/index.js +182 -117
- package/persisters/persister-react-native-sqlite/index.js +129 -37
- package/persisters/persister-react-native-sqlite/with-schemas/index.js +129 -37
- package/persisters/persister-sqlite-bun/index.js +129 -37
- package/persisters/persister-sqlite-bun/with-schemas/index.js +129 -37
- package/persisters/persister-sqlite-wasm/index.js +129 -37
- package/persisters/persister-sqlite-wasm/with-schemas/index.js +129 -37
- package/persisters/persister-sqlite3/index.js +129 -37
- package/persisters/persister-sqlite3/with-schemas/index.js +129 -37
- package/persisters/with-schemas/index.js +129 -37
- package/queries/index.js +21 -19
- package/queries/with-schemas/index.js +21 -19
- package/readme.md +14 -14
- package/relationships/index.js +6 -8
- package/relationships/with-schemas/index.js +6 -8
- package/releases.md +57 -57
- package/synchronizers/synchronizer-ws-client/index.js +116 -42
- package/synchronizers/synchronizer-ws-client/with-schemas/index.js +116 -42
- package/synchronizers/synchronizer-ws-server/index.js +109 -28
- package/synchronizers/synchronizer-ws-server/with-schemas/index.js +109 -28
- package/synchronizers/synchronizer-ws-server-durable-object/index.js +122 -38
- package/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js +122 -38
- package/ui-svelte/index.js +1 -1
- package/ui-svelte/with-schemas/index.js +1 -1
- package/ui-svelte-dom/index.js +2 -2
- package/ui-svelte-dom/with-schemas/index.js +2 -2
- package/ui-svelte-inspector/index.js +2 -2
- package/ui-svelte-inspector/with-schemas/index.js +2 -2
- package/with-schemas/index.js +21 -19
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The synchronizer-ws-server module of the TinyBase project lets you create
|
|
3
|
-
*
|
|
2
|
+
* The synchronizer-ws-server module of the TinyBase project lets you create a
|
|
3
|
+
* server that facilitates synchronization between clients.
|
|
4
4
|
* @see Synchronization guide
|
|
5
5
|
* @see Todo App v6 (collaboration) demo
|
|
6
6
|
* @packageDocumentation
|
|
@@ -506,6 +506,10 @@ export interface WsServer {
|
|
|
506
506
|
* only exist when there are active clients on that particular path. The
|
|
507
507
|
* creation callback can be asynchronous.
|
|
508
508
|
*
|
|
509
|
+
* A path is taken from the path in the client WebSocket URL. For example,
|
|
510
|
+
* clients connecting to `ws://localhost:8047/petShop` will share the `petShop`
|
|
511
|
+
* path. The Id of a client's MergeableStore does not select this path.
|
|
512
|
+
*
|
|
509
513
|
* You are responsible for creating a MergeableStore to pass to this Persister,
|
|
510
514
|
* but starting and stopping its automatic saving and loading is taken care of
|
|
511
515
|
* by the WsServer. As a result, the server MergeableStore will be kept in sync
|
|
@@ -528,6 +532,13 @@ export interface WsServer {
|
|
|
528
532
|
* @param onIgnoredError An optional handler for the errors that the server
|
|
529
533
|
* would otherwise ignore when trying to sync data. This is suitable for
|
|
530
534
|
* debugging issues in a development environment.
|
|
535
|
+
* @param requestTimeoutSeconds An optional time in seconds that the server will
|
|
536
|
+
* wait for responses to synchronization requests and incomplete fragments,
|
|
537
|
+
* defaulting to `1`.
|
|
538
|
+
* @param fragmentSize An optional maximum size for each WebSocket message
|
|
539
|
+
* fragment. When set, larger synchronization payloads sent by the server are
|
|
540
|
+
* split into fragments and reassembled by the receiving WsSynchronizer, since
|
|
541
|
+
* v9.0.
|
|
531
542
|
* @returns A reference to the new WsServer object.
|
|
532
543
|
* @example
|
|
533
544
|
* This example creates a WsServer that synchronizes two clients on a shared
|
|
@@ -733,4 +744,6 @@ export function createWsServer<
|
|
|
733
744
|
| Promise<[PathPersister, (store: MergeableStore) => void]>
|
|
734
745
|
| undefined,
|
|
735
746
|
onIgnoredError?: (error: any) => void,
|
|
747
|
+
requestTimeoutSeconds?: number,
|
|
748
|
+
fragmentSize?: number,
|
|
736
749
|
): WsServer;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The synchronizer-ws-server module of the TinyBase project lets you create
|
|
3
|
-
*
|
|
2
|
+
* The synchronizer-ws-server module of the TinyBase project lets you create a
|
|
3
|
+
* server that facilitates synchronization between clients.
|
|
4
4
|
* @see Synchronization guide
|
|
5
5
|
* @see Todo App v6 (collaboration) demo
|
|
6
6
|
* @packageDocumentation
|
|
@@ -521,6 +521,8 @@ export interface WsServer {
|
|
|
521
521
|
* | Promise<[PathPersister, (store: MergeableStore) => void]>
|
|
522
522
|
* | undefined,
|
|
523
523
|
* onIgnoredError?: (error: any) => void,
|
|
524
|
+
* requestTimeoutSeconds?: number,
|
|
525
|
+
* fragmentSize?: number,
|
|
524
526
|
* ): WsServer;
|
|
525
527
|
* ```
|
|
526
528
|
*
|
|
@@ -533,6 +535,10 @@ export interface WsServer {
|
|
|
533
535
|
* only exist when there are active clients on that particular path. The
|
|
534
536
|
* creation callback can be asynchronous.
|
|
535
537
|
*
|
|
538
|
+
* A path is taken from the path in the client WebSocket URL. For example,
|
|
539
|
+
* clients connecting to `ws://localhost:8047/petShop` will share the `petShop`
|
|
540
|
+
* path. The Id of a client's MergeableStore does not select this path.
|
|
541
|
+
*
|
|
536
542
|
* You are responsible for creating a MergeableStore to pass to this Persister,
|
|
537
543
|
* but starting and stopping its automatic saving and loading is taken care of
|
|
538
544
|
* by the WsServer. As a result, the server MergeableStore will be kept in sync
|
|
@@ -555,6 +561,13 @@ export interface WsServer {
|
|
|
555
561
|
* @param onIgnoredError An optional handler for the errors that the server
|
|
556
562
|
* would otherwise ignore when trying to sync data. This is suitable for
|
|
557
563
|
* debugging issues in a development environment.
|
|
564
|
+
* @param requestTimeoutSeconds An optional time in seconds that the server will
|
|
565
|
+
* wait for responses to synchronization requests and incomplete fragments,
|
|
566
|
+
* defaulting to `1`.
|
|
567
|
+
* @param fragmentSize An optional maximum size for each WebSocket message
|
|
568
|
+
* fragment. When set, larger synchronization payloads sent by the server are
|
|
569
|
+
* split into fragments and reassembled by the receiving WsSynchronizer, since
|
|
570
|
+
* v9.0.
|
|
558
571
|
* @returns A reference to the new WsServer object.
|
|
559
572
|
* @example
|
|
560
573
|
* This example creates a WsServer that synchronizes two clients on a shared
|
|
@@ -762,4 +775,6 @@ export function createWsServer<
|
|
|
762
775
|
| Promise<[PathPersister, (store: MergeableStore<Schemas>) => void]>
|
|
763
776
|
| undefined,
|
|
764
777
|
onIgnoredError?: (error: any) => void,
|
|
778
|
+
requestTimeoutSeconds?: number,
|
|
779
|
+
fragmentSize?: number,
|
|
765
780
|
): WsServer;
|
|
@@ -142,6 +142,57 @@ export class WsServerDurableObject<Env = unknown> extends DurableObject<Env> {
|
|
|
142
142
|
*/
|
|
143
143
|
getClientIds(): Ids;
|
|
144
144
|
|
|
145
|
+
/**
|
|
146
|
+
* The getFragmentSize method is used to specify a maximum size for each
|
|
147
|
+
* WebSocket message fragment sent by the Durable Object.
|
|
148
|
+
*
|
|
149
|
+
* Return a number to split larger synchronization payloads into fragments
|
|
150
|
+
* that are reassembled by the receiving WsSynchronizer. Return `undefined`
|
|
151
|
+
* to send each payload as a single WebSocket message.
|
|
152
|
+
* @returns The maximum fragment size, or `undefined` to disable
|
|
153
|
+
* fragmentation.
|
|
154
|
+
* @example
|
|
155
|
+
* This example limits outbound Durable Object synchronization message
|
|
156
|
+
* fragments to 32KB.
|
|
157
|
+
*
|
|
158
|
+
* ```js ignore
|
|
159
|
+
* import {WsServerDurableObject} from 'tinybase/synchronizers/synchronizer-ws-server-durable-object';
|
|
160
|
+
*
|
|
161
|
+
* export class MyDurableObject extends WsServerDurableObject {
|
|
162
|
+
* getFragmentSize() {
|
|
163
|
+
* return 32 * 1024;
|
|
164
|
+
* }
|
|
165
|
+
* }
|
|
166
|
+
* ```
|
|
167
|
+
* @category Getter
|
|
168
|
+
* @since v9.0.0
|
|
169
|
+
*/
|
|
170
|
+
getFragmentSize(): number | undefined;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* The getRequestTimeoutSeconds method is used to specify how long the Durable
|
|
174
|
+
* Object will wait for synchronization responses and incomplete fragments.
|
|
175
|
+
*
|
|
176
|
+
* Return a number of seconds to use as the timeout. The default is `1`.
|
|
177
|
+
* @returns The number of seconds to wait before timing out.
|
|
178
|
+
* @example
|
|
179
|
+
* This example waits up to 10 seconds for synchronization responses and
|
|
180
|
+
* incomplete fragments.
|
|
181
|
+
*
|
|
182
|
+
* ```js ignore
|
|
183
|
+
* import {WsServerDurableObject} from 'tinybase/synchronizers/synchronizer-ws-server-durable-object';
|
|
184
|
+
*
|
|
185
|
+
* export class MyDurableObject extends WsServerDurableObject {
|
|
186
|
+
* getRequestTimeoutSeconds() {
|
|
187
|
+
* return 10;
|
|
188
|
+
* }
|
|
189
|
+
* }
|
|
190
|
+
* ```
|
|
191
|
+
* @category Getter
|
|
192
|
+
* @since v9.0.0
|
|
193
|
+
*/
|
|
194
|
+
getRequestTimeoutSeconds(): number;
|
|
195
|
+
|
|
145
196
|
/**
|
|
146
197
|
* The onPathId method is called when the first client connects to, or the
|
|
147
198
|
* last client disconnects from, the server with a given path Id.
|
|
@@ -162,6 +162,57 @@ export class WsServerDurableObject<
|
|
|
162
162
|
*/
|
|
163
163
|
getClientIds(): Ids;
|
|
164
164
|
|
|
165
|
+
/**
|
|
166
|
+
* The getFragmentSize method is used to specify a maximum size for each
|
|
167
|
+
* WebSocket message fragment sent by the Durable Object.
|
|
168
|
+
*
|
|
169
|
+
* Return a number to split larger synchronization payloads into fragments
|
|
170
|
+
* that are reassembled by the receiving WsSynchronizer. Return `undefined`
|
|
171
|
+
* to send each payload as a single WebSocket message.
|
|
172
|
+
* @returns The maximum fragment size, or `undefined` to disable
|
|
173
|
+
* fragmentation.
|
|
174
|
+
* @example
|
|
175
|
+
* This example limits outbound Durable Object synchronization message
|
|
176
|
+
* fragments to 32KB.
|
|
177
|
+
*
|
|
178
|
+
* ```js ignore
|
|
179
|
+
* import {WsServerDurableObject} from 'tinybase/synchronizers/synchronizer-ws-server-durable-object';
|
|
180
|
+
*
|
|
181
|
+
* export class MyDurableObject extends WsServerDurableObject {
|
|
182
|
+
* getFragmentSize() {
|
|
183
|
+
* return 32 * 1024;
|
|
184
|
+
* }
|
|
185
|
+
* }
|
|
186
|
+
* ```
|
|
187
|
+
* @category Getter
|
|
188
|
+
* @since v9.0.0
|
|
189
|
+
*/
|
|
190
|
+
getFragmentSize(): number | undefined;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* The getRequestTimeoutSeconds method is used to specify how long the Durable
|
|
194
|
+
* Object will wait for synchronization responses and incomplete fragments.
|
|
195
|
+
*
|
|
196
|
+
* Return a number of seconds to use as the timeout. The default is `1`.
|
|
197
|
+
* @returns The number of seconds to wait before timing out.
|
|
198
|
+
* @example
|
|
199
|
+
* This example waits up to 10 seconds for synchronization responses and
|
|
200
|
+
* incomplete fragments.
|
|
201
|
+
*
|
|
202
|
+
* ```js ignore
|
|
203
|
+
* import {WsServerDurableObject} from 'tinybase/synchronizers/synchronizer-ws-server-durable-object';
|
|
204
|
+
*
|
|
205
|
+
* export class MyDurableObject extends WsServerDurableObject {
|
|
206
|
+
* getRequestTimeoutSeconds() {
|
|
207
|
+
* return 10;
|
|
208
|
+
* }
|
|
209
|
+
* }
|
|
210
|
+
* ```
|
|
211
|
+
* @category Getter
|
|
212
|
+
* @since v9.0.0
|
|
213
|
+
*/
|
|
214
|
+
getRequestTimeoutSeconds(): number;
|
|
215
|
+
|
|
165
216
|
/**
|
|
166
217
|
* The onPathId method is called when the first client connects to, or the
|
|
167
218
|
* last client disconnects from, the server with a given path Id.
|
|
@@ -4208,8 +4208,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
4208
4208
|
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
4209
4209
|
CellId extends CellIdFromSchema<Schemas[0], TableId>,
|
|
4210
4210
|
SetOrMapCell =
|
|
4211
|
-
|
|
|
4212
|
-
| MapCell<Schemas[0], TableId, CellId>,
|
|
4211
|
+
Cell<Schemas[0], TableId, CellId> | MapCell<Schemas[0], TableId, CellId>,
|
|
4213
4212
|
>(
|
|
4214
4213
|
tableId: TableId | GetId<Schemas, Parameter, TableId>,
|
|
4215
4214
|
rowId: Id | GetId<Schemas, Parameter, Id>,
|
|
@@ -5941,8 +5940,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
5941
5940
|
<
|
|
5942
5941
|
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
5943
5942
|
CellIdOrUndefined extends
|
|
5944
|
-
|
|
5945
|
-
| undefined,
|
|
5943
|
+
CellIdFromSchema<Schemas[0], TableId> | undefined,
|
|
5946
5944
|
>(
|
|
5947
5945
|
tableId: TableId,
|
|
5948
5946
|
cellId: CellIdOrUndefined,
|
|
@@ -6030,8 +6028,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
6030
6028
|
<
|
|
6031
6029
|
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
6032
6030
|
CellIdOrUndefined extends
|
|
6033
|
-
|
|
6034
|
-
| undefined,
|
|
6031
|
+
CellIdFromSchema<Schemas[0], TableId> | undefined,
|
|
6035
6032
|
>(
|
|
6036
6033
|
args: SortedRowIdsArgs<Schemas[0], TableId>,
|
|
6037
6034
|
listener: SortedRowIdsListener<Schemas, TableId, CellIdOrUndefined>,
|
|
@@ -229,8 +229,7 @@ export type TableInHtmlTableProps<
|
|
|
229
229
|
| CellIdFromSchema<Schemas[0], TableId>[]
|
|
230
230
|
| {
|
|
231
231
|
[CellId in CellIdFromSchema<Schemas[0], TableId>]?:
|
|
232
|
-
|
|
|
233
|
-
| CustomCell<Schemas, TableId, CellId>;
|
|
232
|
+
string | CustomCell<Schemas, TableId, CellId>;
|
|
234
233
|
};
|
|
235
234
|
}
|
|
236
235
|
: never
|
|
@@ -309,8 +308,7 @@ export type SortedTableInHtmlTableProps<
|
|
|
309
308
|
| CellIdFromSchema<Schemas[0], TableId>[]
|
|
310
309
|
| {
|
|
311
310
|
[CellId in CellIdFromSchema<Schemas[0], TableId>]?:
|
|
312
|
-
|
|
|
313
|
-
| CustomCell<Schemas, TableId, CellId>;
|
|
311
|
+
string | CustomCell<Schemas, TableId, CellId>;
|
|
314
312
|
};
|
|
315
313
|
/**
|
|
316
314
|
* Whether the table should be interactive such that clicking a header changes
|
|
@@ -427,8 +425,7 @@ export type SliceInHtmlTableProps<Schemas extends OptionalSchemas> = {
|
|
|
427
425
|
* @since v4.1.0
|
|
428
426
|
*/
|
|
429
427
|
readonly customCells?:
|
|
430
|
-
|
|
|
431
|
-
| {[cellId: Id]: string | CustomCell<NoSchemas, Id, Id>};
|
|
428
|
+
Ids | {[cellId: Id]: string | CustomCell<NoSchemas, Id, Id>};
|
|
432
429
|
};
|
|
433
430
|
|
|
434
431
|
/**
|
|
@@ -478,8 +475,7 @@ export type RelationshipInHtmlTableProps<Schemas extends OptionalSchemas> = {
|
|
|
478
475
|
* @since v4.1.0
|
|
479
476
|
*/
|
|
480
477
|
readonly customCells?:
|
|
481
|
-
|
|
|
482
|
-
| {[cellId: Id]: string | CustomCell<NoSchemas, Id, Id>};
|
|
478
|
+
Ids | {[cellId: Id]: string | CustomCell<NoSchemas, Id, Id>};
|
|
483
479
|
};
|
|
484
480
|
|
|
485
481
|
/**
|
|
@@ -514,8 +510,7 @@ export type ResultTableInHtmlTableProps<Schemas extends OptionalSchemas> = {
|
|
|
514
510
|
* @since v4.1.0
|
|
515
511
|
*/
|
|
516
512
|
readonly customCells?:
|
|
517
|
-
|
|
|
518
|
-
| {[cellId: Id]: string | CustomResultCell<Schemas>};
|
|
513
|
+
Ids | {[cellId: Id]: string | CustomResultCell<Schemas>};
|
|
519
514
|
};
|
|
520
515
|
|
|
521
516
|
/**
|
|
@@ -577,8 +572,7 @@ export type ResultSortedTableInHtmlTableProps<Schemas extends OptionalSchemas> =
|
|
|
577
572
|
* @since v4.1.0
|
|
578
573
|
*/
|
|
579
574
|
readonly customCells?:
|
|
580
|
-
|
|
|
581
|
-
| {[cellId: Id]: string | CustomResultCell<Schemas>};
|
|
575
|
+
Ids | {[cellId: Id]: string | CustomResultCell<Schemas>};
|
|
582
576
|
/**
|
|
583
577
|
* Whether the table should be interactive such that clicking a header changes
|
|
584
578
|
* the sorting and/or direction.
|
|
@@ -498,10 +498,9 @@ type NumericCellIdFromSchema<
|
|
|
498
498
|
Schemas extends OptionalSchemas,
|
|
499
499
|
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
500
500
|
> = {
|
|
501
|
-
[
|
|
502
|
-
Schemas[0],
|
|
503
|
-
|
|
504
|
-
>]: Schemas[0][TableId][CellId] extends {type: 'any' | 'number'}
|
|
501
|
+
[
|
|
502
|
+
CellId in CellIdFromSchema<Schemas[0], TableId>
|
|
503
|
+
]: Schemas[0][TableId][CellId] extends {type: 'any' | 'number'}
|
|
505
504
|
? CellId
|
|
506
505
|
: never;
|
|
507
506
|
}[CellIdFromSchema<Schemas[0], TableId>];
|
|
@@ -1690,8 +1690,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
1690
1690
|
<
|
|
1691
1691
|
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
1692
1692
|
CellIdOrUndefined extends
|
|
1693
|
-
|
|
1694
|
-
| undefined,
|
|
1693
|
+
CellIdFromSchema<Schemas[0], TableId> | undefined,
|
|
1695
1694
|
>(
|
|
1696
1695
|
tableId: MaybeAccessor<TableId>,
|
|
1697
1696
|
cellId?: MaybeAccessor<CellIdOrUndefined>,
|
|
@@ -3237,8 +3236,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
3237
3236
|
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
3238
3237
|
CellId extends CellIdFromSchema<Schemas[0], TableId>,
|
|
3239
3238
|
SetOrMapCell =
|
|
3240
|
-
|
|
|
3241
|
-
| MapCell<Schemas[0], TableId, CellId>,
|
|
3239
|
+
Cell<Schemas[0], TableId, CellId> | MapCell<Schemas[0], TableId, CellId>,
|
|
3242
3240
|
>(
|
|
3243
3241
|
tableId: MaybeAccessor<TableId> | GetId<Schemas, Parameter, TableId>,
|
|
3244
3242
|
rowId: MaybeAccessor<Id> | GetId<Schemas, Parameter, Id>,
|
|
@@ -5260,8 +5258,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
5260
5258
|
<
|
|
5261
5259
|
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
5262
5260
|
CellIdOrUndefined extends
|
|
5263
|
-
|
|
5264
|
-
| undefined,
|
|
5261
|
+
CellIdFromSchema<Schemas[0], TableId> | undefined,
|
|
5265
5262
|
>(
|
|
5266
5263
|
tableId: MaybeAccessor<TableId>,
|
|
5267
5264
|
cellId: MaybeAccessor<CellIdOrUndefined>,
|
|
@@ -5367,8 +5364,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
5367
5364
|
<
|
|
5368
5365
|
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
5369
5366
|
CellIdOrUndefined extends
|
|
5370
|
-
|
|
5371
|
-
| undefined,
|
|
5367
|
+
CellIdFromSchema<Schemas[0], TableId> | undefined,
|
|
5372
5368
|
>(
|
|
5373
5369
|
args: SortedRowIdsArgs<Schemas[0], TableId>,
|
|
5374
5370
|
listener: SortedRowIdsListener<Schemas, TableId, CellIdOrUndefined>,
|
|
@@ -227,8 +227,7 @@ export type TableInHtmlTableProps<
|
|
|
227
227
|
| CellIdFromSchema<Schemas[0], TableId>[]
|
|
228
228
|
| {
|
|
229
229
|
[CellId in CellIdFromSchema<Schemas[0], TableId>]?:
|
|
230
|
-
|
|
|
231
|
-
| CustomCell<Schemas, TableId, CellId>;
|
|
230
|
+
string | CustomCell<Schemas, TableId, CellId>;
|
|
232
231
|
};
|
|
233
232
|
}
|
|
234
233
|
: never
|
|
@@ -307,8 +306,7 @@ export type SortedTableInHtmlTableProps<
|
|
|
307
306
|
| CellIdFromSchema<Schemas[0], TableId>[]
|
|
308
307
|
| {
|
|
309
308
|
[CellId in CellIdFromSchema<Schemas[0], TableId>]?:
|
|
310
|
-
|
|
|
311
|
-
| CustomCell<Schemas, TableId, CellId>;
|
|
309
|
+
string | CustomCell<Schemas, TableId, CellId>;
|
|
312
310
|
};
|
|
313
311
|
/**
|
|
314
312
|
* Whether the table should be interactive such that clicking a header changes
|
|
@@ -425,8 +423,7 @@ export type SliceInHtmlTableProps<Schemas extends OptionalSchemas> = {
|
|
|
425
423
|
* @since v8.4.0
|
|
426
424
|
*/
|
|
427
425
|
readonly customCells?:
|
|
428
|
-
|
|
|
429
|
-
| {[cellId: Id]: string | CustomCell<NoSchemas, Id, Id>};
|
|
426
|
+
Ids | {[cellId: Id]: string | CustomCell<NoSchemas, Id, Id>};
|
|
430
427
|
};
|
|
431
428
|
|
|
432
429
|
/**
|
|
@@ -476,8 +473,7 @@ export type RelationshipInHtmlTableProps<Schemas extends OptionalSchemas> = {
|
|
|
476
473
|
* @since v8.4.0
|
|
477
474
|
*/
|
|
478
475
|
readonly customCells?:
|
|
479
|
-
|
|
|
480
|
-
| {[cellId: Id]: string | CustomCell<NoSchemas, Id, Id>};
|
|
476
|
+
Ids | {[cellId: Id]: string | CustomCell<NoSchemas, Id, Id>};
|
|
481
477
|
};
|
|
482
478
|
|
|
483
479
|
/**
|
|
@@ -512,8 +508,7 @@ export type ResultTableInHtmlTableProps<Schemas extends OptionalSchemas> = {
|
|
|
512
508
|
* @since v8.4.0
|
|
513
509
|
*/
|
|
514
510
|
readonly customCells?:
|
|
515
|
-
|
|
|
516
|
-
| {[cellId: Id]: string | CustomResultCell<Schemas>};
|
|
511
|
+
Ids | {[cellId: Id]: string | CustomResultCell<Schemas>};
|
|
517
512
|
};
|
|
518
513
|
|
|
519
514
|
/**
|
|
@@ -575,8 +570,7 @@ export type ResultSortedTableInHtmlTableProps<Schemas extends OptionalSchemas> =
|
|
|
575
570
|
* @since v8.4.0
|
|
576
571
|
*/
|
|
577
572
|
readonly customCells?:
|
|
578
|
-
|
|
|
579
|
-
| {[cellId: Id]: string | CustomResultCell<Schemas>};
|
|
573
|
+
Ids | {[cellId: Id]: string | CustomResultCell<Schemas>};
|
|
580
574
|
/**
|
|
581
575
|
* Whether the table should be interactive such that clicking a header changes
|
|
582
576
|
* the sorting and/or direction.
|
|
@@ -225,8 +225,7 @@ export type TableInHtmlTableProps<
|
|
|
225
225
|
| CellIdFromSchema<Schemas[0], TableId>[]
|
|
226
226
|
| {
|
|
227
227
|
[CellId in CellIdFromSchema<Schemas[0], TableId>]?:
|
|
228
|
-
|
|
|
229
|
-
| CustomCell<Schemas, TableId, CellId>;
|
|
228
|
+
string | CustomCell<Schemas, TableId, CellId>;
|
|
230
229
|
};
|
|
231
230
|
}
|
|
232
231
|
: never
|
|
@@ -305,8 +304,7 @@ export type SortedTableInHtmlTableProps<
|
|
|
305
304
|
| CellIdFromSchema<Schemas[0], TableId>[]
|
|
306
305
|
| {
|
|
307
306
|
[CellId in CellIdFromSchema<Schemas[0], TableId>]?:
|
|
308
|
-
|
|
|
309
|
-
| CustomCell<Schemas, TableId, CellId>;
|
|
307
|
+
string | CustomCell<Schemas, TableId, CellId>;
|
|
310
308
|
};
|
|
311
309
|
/**
|
|
312
310
|
* Whether the table should be interactive such that clicking a header changes
|
|
@@ -423,8 +421,7 @@ export type SliceInHtmlTableProps<Schemas extends OptionalSchemas> = {
|
|
|
423
421
|
* @since v4.1.0
|
|
424
422
|
*/
|
|
425
423
|
readonly customCells?:
|
|
426
|
-
|
|
|
427
|
-
| {[cellId: Id]: string | CustomCell<NoSchemas, Id, Id>};
|
|
424
|
+
Ids | {[cellId: Id]: string | CustomCell<NoSchemas, Id, Id>};
|
|
428
425
|
};
|
|
429
426
|
|
|
430
427
|
/**
|
|
@@ -474,8 +471,7 @@ export type RelationshipInHtmlTableProps<Schemas extends OptionalSchemas> = {
|
|
|
474
471
|
* @since v4.1.0
|
|
475
472
|
*/
|
|
476
473
|
readonly customCells?:
|
|
477
|
-
|
|
|
478
|
-
| {[cellId: Id]: string | CustomCell<NoSchemas, Id, Id>};
|
|
474
|
+
Ids | {[cellId: Id]: string | CustomCell<NoSchemas, Id, Id>};
|
|
479
475
|
};
|
|
480
476
|
|
|
481
477
|
/**
|
|
@@ -510,8 +506,7 @@ export type ResultTableInHtmlTableProps<Schemas extends OptionalSchemas> = {
|
|
|
510
506
|
* @since v4.1.0
|
|
511
507
|
*/
|
|
512
508
|
readonly customCells?:
|
|
513
|
-
|
|
|
514
|
-
| {[cellId: Id]: string | CustomResultCell<Schemas>};
|
|
509
|
+
Ids | {[cellId: Id]: string | CustomResultCell<Schemas>};
|
|
515
510
|
};
|
|
516
511
|
|
|
517
512
|
/**
|
|
@@ -573,8 +568,7 @@ export type ResultSortedTableInHtmlTableProps<Schemas extends OptionalSchemas> =
|
|
|
573
568
|
* @since v4.1.0
|
|
574
569
|
*/
|
|
575
570
|
readonly customCells?:
|
|
576
|
-
|
|
|
577
|
-
| {[cellId: Id]: string | CustomResultCell<Schemas>};
|
|
571
|
+
Ids | {[cellId: Id]: string | CustomResultCell<Schemas>};
|
|
578
572
|
/**
|
|
579
573
|
* Whether the table should be interactive such that clicking a header changes
|
|
580
574
|
* the sorting and/or direction.
|
package/index.js
CHANGED
|
@@ -339,14 +339,12 @@ const getDefinableFunctions = (
|
|
|
339
339
|
const newRowValue = hasRow(tableId, rowId)
|
|
340
340
|
? validateRowValue(getRowValue(getCell, rowId))
|
|
341
341
|
: void 0;
|
|
342
|
-
if (
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
)
|
|
349
|
-
) {
|
|
342
|
+
if (!(
|
|
343
|
+
oldRowValue === newRowValue ||
|
|
344
|
+
(isArray(oldRowValue) &&
|
|
345
|
+
isArray(newRowValue) &&
|
|
346
|
+
arrayIsEqual(oldRowValue, newRowValue))
|
|
347
|
+
)) {
|
|
350
348
|
mapSet(changedRowValues, rowId, [oldRowValue, newRowValue]);
|
|
351
349
|
}
|
|
352
350
|
if (!isUndefined(getSortKey)) {
|
|
@@ -3753,9 +3751,9 @@ const PARAMS_TABLE = '_';
|
|
|
3753
3751
|
const PARAM_LISTENER_PREFIX = 'p';
|
|
3754
3752
|
const createQueries = getCreateFunction((store) => {
|
|
3755
3753
|
const createStore = store._[0];
|
|
3756
|
-
const preStore = createStore();
|
|
3757
3754
|
const paramStore = createStore();
|
|
3758
3755
|
const resultStore = createStore();
|
|
3756
|
+
const preStores = mapNew();
|
|
3759
3757
|
const resultStores = mapNew();
|
|
3760
3758
|
const redefiningQueryIds = setNew();
|
|
3761
3759
|
const routedResultListeners = mapNew();
|
|
@@ -3798,12 +3796,13 @@ const createQueries = getCreateFunction((store) => {
|
|
|
3798
3796
|
);
|
|
3799
3797
|
const getResultStore = (queryId) =>
|
|
3800
3798
|
mapEnsure(resultStores, queryId, createStore);
|
|
3801
|
-
const
|
|
3799
|
+
const getPreStore = (queryId) => mapEnsure(preStores, queryId, createStore);
|
|
3800
|
+
const addPreStoreListener = (preStore, queryId, ...listenerIds) =>
|
|
3802
3801
|
arrayForEach(listenerIds, (listenerId) =>
|
|
3803
3802
|
setAdd(
|
|
3804
3803
|
mapEnsure(
|
|
3805
3804
|
mapEnsure(preStoreListenerIds, queryId, mapNew),
|
|
3806
|
-
|
|
3805
|
+
preStore,
|
|
3807
3806
|
setNew,
|
|
3808
3807
|
),
|
|
3809
3808
|
listenerId,
|
|
@@ -3813,16 +3812,17 @@ const createQueries = getCreateFunction((store) => {
|
|
|
3813
3812
|
ifNotUndefined(
|
|
3814
3813
|
mapGet(preStoreListenerIds, queryId),
|
|
3815
3814
|
(queryPreStoreListenerIds) => {
|
|
3816
|
-
mapForEach(queryPreStoreListenerIds, (
|
|
3815
|
+
mapForEach(queryPreStoreListenerIds, (preStore, listenerIds) =>
|
|
3817
3816
|
collForEach(listenerIds, (listenerId) =>
|
|
3818
|
-
|
|
3817
|
+
preStore.delListener(listenerId),
|
|
3819
3818
|
),
|
|
3820
3819
|
);
|
|
3821
3820
|
collClear(queryPreStoreListenerIds);
|
|
3822
3821
|
},
|
|
3823
3822
|
);
|
|
3824
|
-
arrayForEach(
|
|
3825
|
-
|
|
3823
|
+
arrayForEach(
|
|
3824
|
+
[getResultStore(queryId), mapGet(preStores, queryId)],
|
|
3825
|
+
(store2) => store2?.delTable(queryId),
|
|
3826
3826
|
);
|
|
3827
3827
|
};
|
|
3828
3828
|
const addSourceStoreListeners = (
|
|
@@ -4050,10 +4050,12 @@ const createQueries = getCreateFunction((store) => {
|
|
|
4050
4050
|
),
|
|
4051
4051
|
);
|
|
4052
4052
|
const groups = mapNew(groupEntries);
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4053
|
+
const hasGroupsOrHavings =
|
|
4054
|
+
!collIsEmpty(groups) || !arrayIsEmpty(havings);
|
|
4055
|
+
const selectJoinWhereStore = hasGroupsOrHavings
|
|
4056
|
+
? getPreStore(queryId)
|
|
4057
|
+
: resultStore2;
|
|
4058
|
+
if (hasGroupsOrHavings) {
|
|
4057
4059
|
synchronizeTransactions(queryId, selectJoinWhereStore, resultStore2);
|
|
4058
4060
|
const groupedSelectedCellIds = mapNew();
|
|
4059
4061
|
mapForEach(groups, (groupedCellId, [selectedCellId, aggregators]) =>
|
package/indexes/index.js
CHANGED
|
@@ -153,14 +153,12 @@ const getDefinableFunctions = (
|
|
|
153
153
|
const newRowValue = hasRow(tableId, rowId)
|
|
154
154
|
? validateRowValue(getRowValue(getCell, rowId))
|
|
155
155
|
: void 0;
|
|
156
|
-
if (
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
)
|
|
163
|
-
) {
|
|
156
|
+
if (!(
|
|
157
|
+
oldRowValue === newRowValue ||
|
|
158
|
+
(isArray(oldRowValue) &&
|
|
159
|
+
isArray(newRowValue) &&
|
|
160
|
+
arrayIsEqual(oldRowValue, newRowValue))
|
|
161
|
+
)) {
|
|
164
162
|
mapSet(changedRowValues, rowId, [oldRowValue, newRowValue]);
|
|
165
163
|
}
|
|
166
164
|
if (!isUndefined(getSortKey)) {
|
|
@@ -153,14 +153,12 @@ const getDefinableFunctions = (
|
|
|
153
153
|
const newRowValue = hasRow(tableId, rowId)
|
|
154
154
|
? validateRowValue(getRowValue(getCell, rowId))
|
|
155
155
|
: void 0;
|
|
156
|
-
if (
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
)
|
|
163
|
-
) {
|
|
156
|
+
if (!(
|
|
157
|
+
oldRowValue === newRowValue ||
|
|
158
|
+
(isArray(oldRowValue) &&
|
|
159
|
+
isArray(newRowValue) &&
|
|
160
|
+
arrayIsEqual(oldRowValue, newRowValue))
|
|
161
|
+
)) {
|
|
164
162
|
mapSet(changedRowValues, rowId, [oldRowValue, newRowValue]);
|
|
165
163
|
}
|
|
166
164
|
if (!isUndefined(getSortKey)) {
|
package/metrics/index.js
CHANGED
|
@@ -227,14 +227,12 @@ const getDefinableFunctions = (
|
|
|
227
227
|
const newRowValue = hasRow(tableId, rowId)
|
|
228
228
|
? validateRowValue(getRowValue(getCell, rowId))
|
|
229
229
|
: void 0;
|
|
230
|
-
if (
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
)
|
|
237
|
-
) {
|
|
230
|
+
if (!(
|
|
231
|
+
oldRowValue === newRowValue ||
|
|
232
|
+
(isArray(oldRowValue) &&
|
|
233
|
+
isArray(newRowValue) &&
|
|
234
|
+
arrayIsEqual(oldRowValue, newRowValue))
|
|
235
|
+
)) {
|
|
238
236
|
mapSet(changedRowValues, rowId, [oldRowValue, newRowValue]);
|
|
239
237
|
}
|
|
240
238
|
if (!isUndefined(getSortKey)) {
|
|
@@ -227,14 +227,12 @@ const getDefinableFunctions = (
|
|
|
227
227
|
const newRowValue = hasRow(tableId, rowId)
|
|
228
228
|
? validateRowValue(getRowValue(getCell, rowId))
|
|
229
229
|
: void 0;
|
|
230
|
-
if (
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
)
|
|
237
|
-
) {
|
|
230
|
+
if (!(
|
|
231
|
+
oldRowValue === newRowValue ||
|
|
232
|
+
(isArray(oldRowValue) &&
|
|
233
|
+
isArray(newRowValue) &&
|
|
234
|
+
arrayIsEqual(oldRowValue, newRowValue))
|
|
235
|
+
)) {
|
|
238
236
|
mapSet(changedRowValues, rowId, [oldRowValue, newRowValue]);
|
|
239
237
|
}
|
|
240
238
|
if (!isUndefined(getSortKey)) {
|