tinybase 6.1.0-beta.1 → 6.1.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.
Files changed (108) hide show
  1. package/@types/common/index.d.ts +4 -4
  2. package/@types/common/with-schemas/index.d.ts +4 -4
  3. package/@types/mergeable-store/index.d.ts +45 -20
  4. package/@types/mergeable-store/with-schemas/index.d.ts +49 -21
  5. package/@types/persisters/index.d.ts +1 -1
  6. package/@types/persisters/with-schemas/index.d.ts +1 -1
  7. package/index.js +19 -11
  8. package/indexes/index.js +15 -3
  9. package/indexes/with-schemas/index.js +15 -3
  10. package/mergeable-store/index.js +4 -8
  11. package/mergeable-store/with-schemas/index.js +4 -8
  12. package/min/index.js +1 -1
  13. package/min/index.js.gz +0 -0
  14. package/min/indexes/index.js +1 -1
  15. package/min/indexes/index.js.gz +0 -0
  16. package/min/indexes/with-schemas/index.js +1 -1
  17. package/min/indexes/with-schemas/index.js.gz +0 -0
  18. package/min/mergeable-store/index.js +1 -1
  19. package/min/mergeable-store/index.js.gz +0 -0
  20. package/min/mergeable-store/with-schemas/index.js +1 -1
  21. package/min/mergeable-store/with-schemas/index.js.gz +0 -0
  22. package/min/with-schemas/index.js +1 -1
  23. package/min/with-schemas/index.js.gz +0 -0
  24. package/package.json +9 -9
  25. package/readme.md +2 -2
  26. package/with-schemas/index.js +19 -11
  27. package/@types/_internal/queries/index.d.cts +0 -0
  28. package/@types/_internal/queries/with-schemas/index.d.cts +0 -22
  29. package/@types/_internal/store/index.d.cts +0 -3
  30. package/@types/_internal/store/with-schemas/index.d.cts +0 -106
  31. package/@types/_internal/ui-react/index.d.cts +0 -0
  32. package/@types/_internal/ui-react/with-schemas/index.d.cts +0 -1130
  33. package/@types/checkpoints/index.d.cts +0 -1059
  34. package/@types/checkpoints/with-schemas/index.d.cts +0 -1151
  35. package/@types/common/index.d.cts +0 -158
  36. package/@types/common/with-schemas/index.d.cts +0 -158
  37. package/@types/index.d.cts +0 -17
  38. package/@types/indexes/index.d.cts +0 -1064
  39. package/@types/indexes/with-schemas/index.d.cts +0 -1210
  40. package/@types/mergeable-store/index.d.cts +0 -1139
  41. package/@types/mergeable-store/with-schemas/index.d.cts +0 -1628
  42. package/@types/metrics/index.d.cts +0 -917
  43. package/@types/metrics/with-schemas/index.d.cts +0 -1004
  44. package/@types/persisters/index.d.cts +0 -1877
  45. package/@types/persisters/persister-automerge/index.d.cts +0 -165
  46. package/@types/persisters/persister-automerge/with-schemas/index.d.cts +0 -180
  47. package/@types/persisters/persister-browser/index.d.cts +0 -185
  48. package/@types/persisters/persister-browser/with-schemas/index.d.cts +0 -208
  49. package/@types/persisters/persister-cr-sqlite-wasm/index.d.cts +0 -159
  50. package/@types/persisters/persister-cr-sqlite-wasm/with-schemas/index.d.cts +0 -178
  51. package/@types/persisters/persister-durable-object-storage/index.d.cts +0 -122
  52. package/@types/persisters/persister-durable-object-storage/with-schemas/index.d.cts +0 -136
  53. package/@types/persisters/persister-electric-sql/index.d.cts +0 -185
  54. package/@types/persisters/persister-electric-sql/with-schemas/index.d.cts +0 -204
  55. package/@types/persisters/persister-expo-sqlite/index.d.cts +0 -186
  56. package/@types/persisters/persister-expo-sqlite/with-schemas/index.d.cts +0 -205
  57. package/@types/persisters/persister-file/index.d.cts +0 -94
  58. package/@types/persisters/persister-file/with-schemas/index.d.cts +0 -107
  59. package/@types/persisters/persister-indexed-db/index.d.cts +0 -120
  60. package/@types/persisters/persister-indexed-db/with-schemas/index.d.cts +0 -135
  61. package/@types/persisters/persister-libsql/index.d.cts +0 -158
  62. package/@types/persisters/persister-libsql/with-schemas/index.d.cts +0 -177
  63. package/@types/persisters/persister-partykit-client/index.d.cts +0 -195
  64. package/@types/persisters/persister-partykit-client/with-schemas/index.d.cts +0 -210
  65. package/@types/persisters/persister-partykit-server/index.d.cts +0 -650
  66. package/@types/persisters/persister-partykit-server/with-schemas/index.d.cts +0 -695
  67. package/@types/persisters/persister-pglite/index.d.cts +0 -177
  68. package/@types/persisters/persister-pglite/with-schemas/index.d.cts +0 -196
  69. package/@types/persisters/persister-postgres/index.d.cts +0 -166
  70. package/@types/persisters/persister-postgres/with-schemas/index.d.cts +0 -185
  71. package/@types/persisters/persister-powersync/index.d.cts +0 -174
  72. package/@types/persisters/persister-powersync/with-schemas/index.d.cts +0 -193
  73. package/@types/persisters/persister-remote/index.d.cts +0 -117
  74. package/@types/persisters/persister-remote/with-schemas/index.d.cts +0 -133
  75. package/@types/persisters/persister-sqlite-wasm/index.d.cts +0 -175
  76. package/@types/persisters/persister-sqlite-wasm/with-schemas/index.d.cts +0 -195
  77. package/@types/persisters/persister-sqlite3/index.d.cts +0 -176
  78. package/@types/persisters/persister-sqlite3/with-schemas/index.d.cts +0 -195
  79. package/@types/persisters/persister-yjs/index.d.cts +0 -161
  80. package/@types/persisters/persister-yjs/with-schemas/index.d.cts +0 -176
  81. package/@types/persisters/with-schemas/index.d.cts +0 -2054
  82. package/@types/queries/index.d.cts +0 -3695
  83. package/@types/queries/with-schemas/index.d.cts +0 -4016
  84. package/@types/relationships/index.d.cts +0 -1320
  85. package/@types/relationships/with-schemas/index.d.cts +0 -1474
  86. package/@types/store/index.d.cts +0 -7598
  87. package/@types/store/with-schemas/index.d.cts +0 -9278
  88. package/@types/synchronizers/index.d.cts +0 -485
  89. package/@types/synchronizers/synchronizer-broadcast-channel/index.d.cts +0 -121
  90. package/@types/synchronizers/synchronizer-broadcast-channel/with-schemas/index.d.cts +0 -137
  91. package/@types/synchronizers/synchronizer-local/index.d.cts +0 -95
  92. package/@types/synchronizers/synchronizer-local/with-schemas/index.d.cts +0 -114
  93. package/@types/synchronizers/synchronizer-ws-client/index.d.cts +0 -160
  94. package/@types/synchronizers/synchronizer-ws-client/with-schemas/index.d.cts +0 -179
  95. package/@types/synchronizers/synchronizer-ws-server/index.d.cts +0 -736
  96. package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.cts +0 -765
  97. package/@types/synchronizers/synchronizer-ws-server-durable-object/index.d.cts +0 -311
  98. package/@types/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.d.cts +0 -349
  99. package/@types/synchronizers/synchronizer-ws-server-simple/index.d.cts +0 -144
  100. package/@types/synchronizers/synchronizer-ws-server-simple/with-schemas/index.d.cts +0 -144
  101. package/@types/synchronizers/with-schemas/index.d.cts +0 -503
  102. package/@types/ui-react/index.d.cts +0 -16640
  103. package/@types/ui-react/with-schemas/index.d.cts +0 -17281
  104. package/@types/ui-react-dom/index.d.cts +0 -1862
  105. package/@types/ui-react-dom/with-schemas/index.d.cts +0 -1994
  106. package/@types/ui-react-inspector/index.d.cts +0 -79
  107. package/@types/ui-react-inspector/with-schemas/index.d.cts +0 -1985
  108. 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;