tinybase 6.1.0-beta.1 → 6.1.0-beta.2

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.
Files changed (98) hide show
  1. package/@types/common/index.d.ts +4 -4
  2. package/@types/common/with-schemas/index.d.ts +4 -4
  3. package/index.js +15 -3
  4. package/indexes/index.js +15 -3
  5. package/indexes/with-schemas/index.js +15 -3
  6. package/min/index.js +1 -1
  7. package/min/index.js.gz +0 -0
  8. package/min/indexes/index.js +1 -1
  9. package/min/indexes/index.js.gz +0 -0
  10. package/min/indexes/with-schemas/index.js +1 -1
  11. package/min/indexes/with-schemas/index.js.gz +0 -0
  12. package/min/with-schemas/index.js +1 -1
  13. package/min/with-schemas/index.js.gz +0 -0
  14. package/package.json +7 -7
  15. package/readme.md +1 -1
  16. package/with-schemas/index.js +15 -3
  17. package/@types/_internal/queries/index.d.cts +0 -0
  18. package/@types/_internal/queries/with-schemas/index.d.cts +0 -22
  19. package/@types/_internal/store/index.d.cts +0 -3
  20. package/@types/_internal/store/with-schemas/index.d.cts +0 -106
  21. package/@types/_internal/ui-react/index.d.cts +0 -0
  22. package/@types/_internal/ui-react/with-schemas/index.d.cts +0 -1130
  23. package/@types/checkpoints/index.d.cts +0 -1059
  24. package/@types/checkpoints/with-schemas/index.d.cts +0 -1151
  25. package/@types/common/index.d.cts +0 -158
  26. package/@types/common/with-schemas/index.d.cts +0 -158
  27. package/@types/index.d.cts +0 -17
  28. package/@types/indexes/index.d.cts +0 -1064
  29. package/@types/indexes/with-schemas/index.d.cts +0 -1210
  30. package/@types/mergeable-store/index.d.cts +0 -1139
  31. package/@types/mergeable-store/with-schemas/index.d.cts +0 -1628
  32. package/@types/metrics/index.d.cts +0 -917
  33. package/@types/metrics/with-schemas/index.d.cts +0 -1004
  34. package/@types/persisters/index.d.cts +0 -1877
  35. package/@types/persisters/persister-automerge/index.d.cts +0 -165
  36. package/@types/persisters/persister-automerge/with-schemas/index.d.cts +0 -180
  37. package/@types/persisters/persister-browser/index.d.cts +0 -185
  38. package/@types/persisters/persister-browser/with-schemas/index.d.cts +0 -208
  39. package/@types/persisters/persister-cr-sqlite-wasm/index.d.cts +0 -159
  40. package/@types/persisters/persister-cr-sqlite-wasm/with-schemas/index.d.cts +0 -178
  41. package/@types/persisters/persister-durable-object-storage/index.d.cts +0 -122
  42. package/@types/persisters/persister-durable-object-storage/with-schemas/index.d.cts +0 -136
  43. package/@types/persisters/persister-electric-sql/index.d.cts +0 -185
  44. package/@types/persisters/persister-electric-sql/with-schemas/index.d.cts +0 -204
  45. package/@types/persisters/persister-expo-sqlite/index.d.cts +0 -186
  46. package/@types/persisters/persister-expo-sqlite/with-schemas/index.d.cts +0 -205
  47. package/@types/persisters/persister-file/index.d.cts +0 -94
  48. package/@types/persisters/persister-file/with-schemas/index.d.cts +0 -107
  49. package/@types/persisters/persister-indexed-db/index.d.cts +0 -120
  50. package/@types/persisters/persister-indexed-db/with-schemas/index.d.cts +0 -135
  51. package/@types/persisters/persister-libsql/index.d.cts +0 -158
  52. package/@types/persisters/persister-libsql/with-schemas/index.d.cts +0 -177
  53. package/@types/persisters/persister-partykit-client/index.d.cts +0 -195
  54. package/@types/persisters/persister-partykit-client/with-schemas/index.d.cts +0 -210
  55. package/@types/persisters/persister-partykit-server/index.d.cts +0 -650
  56. package/@types/persisters/persister-partykit-server/with-schemas/index.d.cts +0 -695
  57. package/@types/persisters/persister-pglite/index.d.cts +0 -177
  58. package/@types/persisters/persister-pglite/with-schemas/index.d.cts +0 -196
  59. package/@types/persisters/persister-postgres/index.d.cts +0 -166
  60. package/@types/persisters/persister-postgres/with-schemas/index.d.cts +0 -185
  61. package/@types/persisters/persister-powersync/index.d.cts +0 -174
  62. package/@types/persisters/persister-powersync/with-schemas/index.d.cts +0 -193
  63. package/@types/persisters/persister-remote/index.d.cts +0 -117
  64. package/@types/persisters/persister-remote/with-schemas/index.d.cts +0 -133
  65. package/@types/persisters/persister-sqlite-wasm/index.d.cts +0 -175
  66. package/@types/persisters/persister-sqlite-wasm/with-schemas/index.d.cts +0 -195
  67. package/@types/persisters/persister-sqlite3/index.d.cts +0 -176
  68. package/@types/persisters/persister-sqlite3/with-schemas/index.d.cts +0 -195
  69. package/@types/persisters/persister-yjs/index.d.cts +0 -161
  70. package/@types/persisters/persister-yjs/with-schemas/index.d.cts +0 -176
  71. package/@types/persisters/with-schemas/index.d.cts +0 -2054
  72. package/@types/queries/index.d.cts +0 -3695
  73. package/@types/queries/with-schemas/index.d.cts +0 -4016
  74. package/@types/relationships/index.d.cts +0 -1320
  75. package/@types/relationships/with-schemas/index.d.cts +0 -1474
  76. package/@types/store/index.d.cts +0 -7598
  77. package/@types/store/with-schemas/index.d.cts +0 -9278
  78. package/@types/synchronizers/index.d.cts +0 -485
  79. package/@types/synchronizers/synchronizer-broadcast-channel/index.d.cts +0 -121
  80. package/@types/synchronizers/synchronizer-broadcast-channel/with-schemas/index.d.cts +0 -137
  81. package/@types/synchronizers/synchronizer-local/index.d.cts +0 -95
  82. package/@types/synchronizers/synchronizer-local/with-schemas/index.d.cts +0 -114
  83. package/@types/synchronizers/synchronizer-ws-client/index.d.cts +0 -160
  84. package/@types/synchronizers/synchronizer-ws-client/with-schemas/index.d.cts +0 -179
  85. package/@types/synchronizers/synchronizer-ws-server/index.d.cts +0 -736
  86. package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.cts +0 -765
  87. package/@types/synchronizers/synchronizer-ws-server-durable-object/index.d.cts +0 -311
  88. package/@types/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.d.cts +0 -349
  89. package/@types/synchronizers/synchronizer-ws-server-simple/index.d.cts +0 -144
  90. package/@types/synchronizers/synchronizer-ws-server-simple/with-schemas/index.d.cts +0 -144
  91. package/@types/synchronizers/with-schemas/index.d.cts +0 -503
  92. package/@types/ui-react/index.d.cts +0 -16640
  93. package/@types/ui-react/with-schemas/index.d.cts +0 -17281
  94. package/@types/ui-react-dom/index.d.cts +0 -1862
  95. package/@types/ui-react-dom/with-schemas/index.d.cts +0 -1994
  96. package/@types/ui-react-inspector/index.d.cts +0 -79
  97. package/@types/ui-react-inspector/with-schemas/index.d.cts +0 -1985
  98. package/@types/with-schemas/index.d.cts +0 -17
@@ -1,144 +0,0 @@
1
- /**
2
- * The synchronizer-ws-server-simple module of the TinyBase project lets you
3
- * create a server that facilitates synchronization between clients, without the
4
- * complications of listeners, persistence, or statistics.
5
- *
6
- * This makes it more suitable to be used as a reference implementation for
7
- * other server environments.
8
- * @see Synchronization guide
9
- * @see Todo App v6 (collaboration) demo
10
- * @packageDocumentation
11
- * @module synchronizer-ws-server-simple
12
- * @since v5.4.0
13
- */
14
- import type {WebSocketServer} from 'ws';
15
-
16
- /**
17
- * The WsServerSimple interface represents an object that facilitates
18
- * synchronization between clients that are using WsSynchronizer instances.
19
- *
20
- * The core functionality is equivalent to the WsServer interface, but without
21
- * the complications of listeners, persistence, or statistics.
22
- *
23
- * You should use the createWsServerSimple function to create a WsServerSimple
24
- * object.
25
- * @category Server
26
- * @since v5.4.0
27
- */
28
- export interface WsServerSimple {
29
- /**
30
- * The getWebSocketServer method returns a reference to the WebSocketServer
31
- * being used for this WsServerSimple.
32
- * @returns The WebSocketServer reference.
33
- * @example
34
- * This example creates a WsServerSimple and then gets the WebSocketServer
35
- * reference back out again.
36
- *
37
- * ```js
38
- * import {createWsServerSimple} from 'tinybase/synchronizers/synchronizer-ws-server-simple';
39
- * import {WebSocketServer} from 'ws';
40
- *
41
- * const webSocketServer = new WebSocketServer({port: 8053});
42
- * const server = createWsServerSimple(webSocketServer);
43
- *
44
- * console.log(server.getWebSocketServer() == webSocketServer);
45
- * // -> true
46
- *
47
- * server.destroy();
48
- * ```
49
- * @category Getter
50
- * @since v5.4.0
51
- */
52
- getWebSocketServer(): WebSocketServer;
53
- /**
54
- * The destroy method provides a way to clean up the server at the end of its
55
- * use.
56
- *
57
- * This closes the underlying WebSocketServer that was provided when the
58
- * WsServerSimple was created.
59
- * @example
60
- * This example creates a WsServerSimple and then destroys it again, closing
61
- * the underlying WebSocketServer.
62
- *
63
- * ```js
64
- * import {createWsServerSimple} from 'tinybase/synchronizers/synchronizer-ws-server-simple';
65
- * import {WebSocketServer} from 'ws';
66
- *
67
- * const webSocketServer = new WebSocketServer({port: 8053});
68
- * webSocketServer.on('close', () => {
69
- * console.log('WebSocketServer closed');
70
- * });
71
- * const server = createWsServerSimple(webSocketServer);
72
- *
73
- * server.destroy();
74
- * // ...
75
- * // -> 'WebSocketServer closed'
76
- * ```
77
- * @category Getter
78
- * @since v5.4.0
79
- */
80
- destroy(): void;
81
- }
82
-
83
- /**
84
- * The createWsServerSimple function creates a WsServerSimple that facilitates
85
- * synchronization between clients that are using WsSynchronizer instances.
86
- *
87
- * This should be run in a server environment, and you must pass in a configured
88
- * WebSocketServer object in order to create it.
89
- *
90
- * The core functionality is equivalent to the WsServer interface, but without
91
- * the complications of listeners, persistence, or statistics. This makes it
92
- * more suitable to be used as a reference implementation for other server
93
- * environments.
94
- * @param webSocketServer A WebSocketServer object from your server environment.
95
- * @returns A reference to the new WsServerSimple object.
96
- * @example
97
- * This example creates a WsServerSimple that synchronizes two clients on a
98
- * shared path.
99
- *
100
- * ```js
101
- * import {createMergeableStore} from 'tinybase';
102
- * import {createWsSynchronizer} from 'tinybase/synchronizers/synchronizer-ws-client';
103
- * import {createWsServerSimple} from 'tinybase/synchronizers/synchronizer-ws-server-simple';
104
- * import {WebSocketServer} from 'ws';
105
- *
106
- * // Server
107
- * const server = createWsServerSimple(new WebSocketServer({port: 8053}));
108
- *
109
- * // Client 1
110
- * const clientStore1 = createMergeableStore();
111
- * clientStore1.setCell('pets', 'fido', 'species', 'dog');
112
- * const synchronizer1 = await createWsSynchronizer(
113
- * clientStore1,
114
- * new WebSocket('ws://localhost:8053/petShop'),
115
- * );
116
- * await synchronizer1.startSync();
117
- * // ...
118
- *
119
- * // Client 2
120
- * const clientStore2 = createMergeableStore();
121
- * clientStore2.setCell('pets', 'felix', 'species', 'cat');
122
- * const synchronizer2 = await createWsSynchronizer(
123
- * clientStore2,
124
- * new WebSocket('ws://localhost:8053/petShop'),
125
- * );
126
- * await synchronizer2.startSync();
127
- * // ...
128
- *
129
- * console.log(clientStore1.getTables());
130
- * // -> {pets: {fido: {species: 'dog'}, felix: {species: 'cat'}}}
131
- *
132
- * console.log(clientStore2.getTables());
133
- * // -> {pets: {fido: {species: 'dog'}, felix: {species: 'cat'}}}
134
- *
135
- * synchronizer1.destroy();
136
- * synchronizer2.destroy();
137
- * server.destroy();
138
- * ```
139
- * @category Creation
140
- * @since v5.4.0
141
- */
142
- export function createWsServerSimple(
143
- webSocketServer: WebSocketServer,
144
- ): WsServerSimple;
@@ -1,144 +0,0 @@
1
- /**
2
- * The synchronizer-ws-server-simple module of the TinyBase project lets you
3
- * create a server that facilitates synchronization between clients, without the
4
- * complications of listeners, persistence, or statistics.
5
- *
6
- * This makes it more suitable to be used as a reference implementation for
7
- * other server environments.
8
- * @see Synchronization guide
9
- * @see Todo App v6 (collaboration) demo
10
- * @packageDocumentation
11
- * @module synchronizer-ws-server-simple
12
- * @since v5.4.0
13
- */
14
- import type {WebSocketServer} from 'ws';
15
-
16
- /**
17
- * The WsServerSimple interface represents an object that facilitates
18
- * synchronization between clients that are using WsSynchronizer instances.
19
- *
20
- * The core functionality is equivalent to the WsServer interface, but without
21
- * the complications of listeners, persistence, or statistics.
22
- *
23
- * You should use the createWsServerSimple function to create a WsServerSimple
24
- * object.
25
- * @category Server
26
- * @since v5.4.0
27
- */
28
- export interface WsServerSimple {
29
- /**
30
- * The getWebSocketServer method returns a reference to the WebSocketServer
31
- * being used for this WsServerSimple.
32
- * @returns The WebSocketServer reference.
33
- * @example
34
- * This example creates a WsServerSimple and then gets the WebSocketServer
35
- * reference back out again.
36
- *
37
- * ```js
38
- * import {createWsServerSimple} from 'tinybase/synchronizers/synchronizer-ws-server-simple';
39
- * import {WebSocketServer} from 'ws';
40
- *
41
- * const webSocketServer = new WebSocketServer({port: 8053});
42
- * const server = createWsServerSimple(webSocketServer);
43
- *
44
- * console.log(server.getWebSocketServer() == webSocketServer);
45
- * // -> true
46
- *
47
- * server.destroy();
48
- * ```
49
- * @category Getter
50
- * @since v5.4.0
51
- */
52
- getWebSocketServer(): WebSocketServer;
53
- /**
54
- * The destroy method provides a way to clean up the server at the end of its
55
- * use.
56
- *
57
- * This closes the underlying WebSocketServer that was provided when the
58
- * WsServerSimple was created.
59
- * @example
60
- * This example creates a WsServerSimple and then destroys it again, closing
61
- * the underlying WebSocketServer.
62
- *
63
- * ```js
64
- * import {createWsServerSimple} from 'tinybase/synchronizers/synchronizer-ws-server-simple';
65
- * import {WebSocketServer} from 'ws';
66
- *
67
- * const webSocketServer = new WebSocketServer({port: 8053});
68
- * webSocketServer.on('close', () => {
69
- * console.log('WebSocketServer closed');
70
- * });
71
- * const server = createWsServerSimple(webSocketServer);
72
- *
73
- * server.destroy();
74
- * // ...
75
- * // -> 'WebSocketServer closed'
76
- * ```
77
- * @category Getter
78
- * @since v5.4.0
79
- */
80
- destroy(): void;
81
- }
82
-
83
- /**
84
- * The createWsServerSimple function creates a WsServerSimple that facilitates
85
- * synchronization between clients that are using WsSynchronizer instances.
86
- *
87
- * This should be run in a server environment, and you must pass in a configured
88
- * WebSocketServer object in order to create it.
89
- *
90
- * The core functionality is equivalent to the WsServer interface, but without
91
- * the complications of listeners, persistence, or statistics. This makes it
92
- * more suitable to be used as a reference implementation for other server
93
- * environments.
94
- * @param webSocketServer A WebSocketServer object from your server environment.
95
- * @returns A reference to the new WsServerSimple object.
96
- * @example
97
- * This example creates a WsServerSimple that synchronizes two clients on a
98
- * shared path.
99
- *
100
- * ```js
101
- * import {createMergeableStore} from 'tinybase';
102
- * import {createWsSynchronizer} from 'tinybase/synchronizers/synchronizer-ws-client';
103
- * import {createWsServerSimple} from 'tinybase/synchronizers/synchronizer-ws-server-simple';
104
- * import {WebSocketServer} from 'ws';
105
- *
106
- * // Server
107
- * const server = createWsServerSimple(new WebSocketServer({port: 8053}));
108
- *
109
- * // Client 1
110
- * const clientStore1 = createMergeableStore();
111
- * clientStore1.setCell('pets', 'fido', 'species', 'dog');
112
- * const synchronizer1 = await createWsSynchronizer(
113
- * clientStore1,
114
- * new WebSocket('ws://localhost:8053/petShop'),
115
- * );
116
- * await synchronizer1.startSync();
117
- * // ...
118
- *
119
- * // Client 2
120
- * const clientStore2 = createMergeableStore();
121
- * clientStore2.setCell('pets', 'felix', 'species', 'cat');
122
- * const synchronizer2 = await createWsSynchronizer(
123
- * clientStore2,
124
- * new WebSocket('ws://localhost:8053/petShop'),
125
- * );
126
- * await synchronizer2.startSync();
127
- * // ...
128
- *
129
- * console.log(clientStore1.getTables());
130
- * // -> {pets: {fido: {species: 'dog'}, felix: {species: 'cat'}}}
131
- *
132
- * console.log(clientStore2.getTables());
133
- * // -> {pets: {fido: {species: 'dog'}, felix: {species: 'cat'}}}
134
- *
135
- * synchronizer1.destroy();
136
- * synchronizer2.destroy();
137
- * server.destroy();
138
- * ```
139
- * @category Creation
140
- * @since v5.4.0
141
- */
142
- export function createWsServerSimple(
143
- webSocketServer: WebSocketServer,
144
- ): WsServerSimple;