tinybase 4.6.0-beta.1 → 4.6.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.
@@ -45,7 +45,7 @@ export interface AutomergePersister extends Persister {
45
45
  * @category Getter
46
46
  * @since v4.3.14
47
47
  */
48
- getDocHandle: () => DocHandle<any>;
48
+ getDocHandle(): DocHandle<any>;
49
49
  }
50
50
 
51
51
  /**
@@ -46,7 +46,7 @@ export interface SessionPersister extends Persister {
46
46
  * @category Getter
47
47
  * @since v4.3.14
48
48
  */
49
- getStorageName: () => string;
49
+ getStorageName(): string;
50
50
  }
51
51
 
52
52
  /**
@@ -77,7 +77,7 @@ export interface LocalPersister extends Persister {
77
77
  * @category Getter
78
78
  * @since v4.3.14
79
79
  */
80
- getStorageName: () => string;
80
+ getStorageName(): string;
81
81
  }
82
82
 
83
83
  /**
@@ -43,7 +43,7 @@ export interface CrSqliteWasmPersister extends Persister {
43
43
  * @category Getter
44
44
  * @since v4.3.14
45
45
  */
46
- getDb: () => DB;
46
+ getDb(): DB;
47
47
  }
48
48
 
49
49
  /**
@@ -4,7 +4,7 @@
4
4
  * environment).
5
5
  * @see Persisting Data guide
6
6
  * @packageDocumentation
7
- * @module persister-sqlite3
7
+ * @module persister-electric-sql
8
8
  * @since v4.6.0
9
9
  */
10
10
 
@@ -50,7 +50,7 @@ export interface ElectricSqlPersister extends Persister {
50
50
  * @category Getter
51
51
  * @since v4.6.0
52
52
  */
53
- getElectricClient: () => ElectricClient<any>;
53
+ getElectricClient(): ElectricClient<any>;
54
54
  }
55
55
 
56
56
  /**
@@ -54,7 +54,7 @@ export interface ExpoSqliteNextPersister extends Persister {
54
54
  * @category Getter
55
55
  * @since v4.5.0
56
56
  */
57
- getDb: () => Database;
57
+ getDb(): Database;
58
58
  }
59
59
 
60
60
  /**
@@ -53,7 +53,7 @@ export interface ExpoSqlitePersister extends Persister {
53
53
  * @category Getter
54
54
  * @since v4.3.14
55
55
  */
56
- getDb: () => SQLiteDatabase;
56
+ getDb(): SQLiteDatabase;
57
57
  }
58
58
 
59
59
  /**
@@ -37,7 +37,7 @@ export interface FilePersister extends Persister {
37
37
  * @category Getter
38
38
  * @since v4.3.14
39
39
  */
40
- getFilePath: () => string;
40
+ getFilePath(): string;
41
41
  }
42
42
 
43
43
  /**
@@ -38,7 +38,7 @@ export interface IndexedDbPersister extends Persister {
38
38
  * @category Getter
39
39
  * @since v4.3.14
40
40
  */
41
- getDbName: () => string;
41
+ getDbName(): string;
42
42
  }
43
43
 
44
44
  /**
@@ -56,7 +56,7 @@ export interface PartyKitPersister extends Persister {
56
56
  * @category Getter
57
57
  * @since v4.3.14
58
58
  */
59
- getConnection: () => PartySocket;
59
+ getConnection(): PartySocket;
60
60
  }
61
61
 
62
62
  /**
@@ -42,7 +42,7 @@ export interface RemotePersister extends Persister {
42
42
  * @category Getter
43
43
  * @since v4.3.14
44
44
  */
45
- getUrls: () => [string, string];
45
+ getUrls(): [string, string];
46
46
  }
47
47
 
48
48
  /**
@@ -47,7 +47,7 @@ export interface SqliteWasmPersister extends Persister {
47
47
  * @category Getter
48
48
  * @since v4.3.14
49
49
  */
50
- getDb: () => any;
50
+ getDb(): any;
51
51
  }
52
52
 
53
53
  /**
@@ -42,7 +42,7 @@ export interface Sqlite3Persister extends Persister {
42
42
  * @category Getter
43
43
  * @since v4.3.14
44
44
  */
45
- getDb: () => Database;
45
+ getDb(): Database;
46
46
  }
47
47
 
48
48
  /**
@@ -44,7 +44,7 @@ export interface YjsPersister extends Persister {
44
44
  * @category Getter
45
45
  * @since v4.3.14
46
46
  */
47
- getYDoc: () => YDoc;
47
+ getYDoc(): YDoc;
48
48
  }
49
49
 
50
50
  /**
@@ -4,7 +4,7 @@
4
4
  * environment).
5
5
  * @see Persisting Data guide
6
6
  * @packageDocumentation
7
- * @module persister-sqlite3
7
+ * @module persister-electric-sql
8
8
  * @since v4.6.0
9
9
  */
10
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinybase",
3
- "version": "4.6.0-beta.1",
3
+ "version": "4.6.0-beta.2",
4
4
  "author": "jamesgpearce",
5
5
  "repository": "github:tinyplex/tinybase",
6
6
  "license": "MIT",
@@ -234,12 +234,12 @@
234
234
  "@types/node": "^20.10.4",
235
235
  "@types/puppeteer": "^5.4.7",
236
236
  "@types/react": "^18.2.45",
237
- "@types/react-dom": "^18.2.17",
237
+ "@types/react-dom": "^18.2.18",
238
238
  "@types/react-test-renderer": "^18.0.7",
239
239
  "@types/tmp": "^0.2.6",
240
240
  "@typescript-eslint/eslint-plugin": "^6.14.0",
241
241
  "@typescript-eslint/parser": "^6.14.0",
242
- "@vlcn.io/crsqlite-wasm": "^0.15.2",
242
+ "@vlcn.io/crsqlite-wasm": "^0.16.0",
243
243
  "asciichart": "^1.5.25",
244
244
  "automerge-repo": "^0.1.0",
245
245
  "babel-eslint": "^10.1.0",
@@ -252,7 +252,7 @@
252
252
  "cspell": "^8.1.3",
253
253
  "electric-sql": "^0.8.2",
254
254
  "esbuild": "^0.19.9",
255
- "eslint": "^8.55.0",
255
+ "eslint": "^8.56.0",
256
256
  "eslint-config-prettier": "^9.1.0",
257
257
  "eslint-plugin-jest": "^27.6.0",
258
258
  "eslint-plugin-jsdoc": "^46.9.1",
@@ -269,7 +269,7 @@
269
269
  "jest-fetch-mock": "^3.0.3",
270
270
  "jest-puppeteer": "^9.0.2",
271
271
  "less": "^4.2.0",
272
- "partykit": "^0.0.45",
272
+ "partykit": "^0.0.47",
273
273
  "partysocket": "^0.0.17",
274
274
  "prettier": "^3.1.1",
275
275
  "puppeteer": "21.6.1",
@@ -283,7 +283,7 @@
283
283
  "rollup-plugin-prettier": "^4.1.1",
284
284
  "sqlite3": "^5.1.6",
285
285
  "tinybase": "file:./",
286
- "tinydocs": "^0.1.33",
286
+ "tinydocs": "^0.1.34",
287
287
  "tmp": "^0.2.1",
288
288
  "ts-unused-exports": "^10.0.1",
289
289
  "typescript": "5.3.3",
@@ -291,10 +291,10 @@
291
291
  },
292
292
  "peerDependencies": {
293
293
  "@sqlite.org/sqlite-wasm": "^3.44.2-build1",
294
- "@vlcn.io/crsqlite-wasm": "^0.15.2",
294
+ "@vlcn.io/crsqlite-wasm": "^0.16.0",
295
295
  "automerge-repo": "^0.1.0",
296
296
  "electric-sql": "^0.8.2",
297
- "partykit": "^0.0.45",
297
+ "partykit": "^0.0.47",
298
298
  "partysocket": "^0.0.17",
299
299
  "prettier": "^3.1.1",
300
300
  "react": "^18.2.0",
package/readme.md CHANGED
@@ -1,4 +1,4 @@
1
- <section id="hero"><h2 id="the-reactive-data-store-for-local-first-apps">The <em>reactive</em> data store for <span>local-first apps</span>.</h2><p id="copy">Build blisteringly fast web apps that work both online and offline. Manage your state locally, synchronize it to the cloud when you need to, or even make it collaborative. But, most importantly... have fun building stuff again!</p></section><p><a href="https://beta.tinybase.org/guides/releases/#v4-6"><em>NEW!</em> v4.6 release</a> <span id="one-with">&quot;The One With Electric SQL&quot;</span></p><p><a class="start" href="https://beta.tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://beta.tinybase.org/demos/">Try the demos</a></p><p><a href="https://beta.tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><ul><li>Manage <a href="#start-with-a-simple-key-value-store">key-value data</a>, <a href="#level-up-to-use-tabular-data">tabular data</a> - or both - with optional <a href="#apply-schemas-to-tables-values">schematization</a> to model your app&#x27;s data structures.</li><li><a href="#register-granular-listeners">Flexibly reactive</a> to reconciled updates, so you only spend rendering cycles on things that change.</li><li><a href="#build-complex-queries-with-tinyql">Powerful query engine</a> to select, join, filter, group, sort and paginate data - reactively - and without SQL.</li><li>Built-in <a href="#create-indexes-for-fast-lookups">indexing</a>, <a href="#define-metrics-and-aggregations">metric aggregation</a>, <a href="#model-table-relationships">tabular relationships</a> - and even an <a href="#set-checkpoints-for-an-undo-stack">undo stack</a> for your app state.</li><li>Create <a href="#type-definitions-orm-like-apis">type definitions &amp; ORM-like APIs</a>, from schema or inference. <a href="#an-inspector-for-your-data">Inspect your data</a> (<em>new!</em>) directly in the browser.</li><li>Easily <a href="#persist-to-storage-sqlite-crdts">sync your data</a> to browser <a href="https://beta.tinybase.org/api/persister-browser">storage</a>, <a href="https://beta.tinybase.org/api/persister-indexed-db/">IndexedDB</a>, <a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence/">SQLite</a>, <a href="https://beta.tinybase.org/guides/schemas-and-persistence/synchronizing-data/">CRDTs</a>, and (<em>new!</em>) <a href="https://beta.tinybase.org/api/persister-partykit-client/">PartyKit</a>.</li><li>Optional <a href="#call-hooks-to-bind-to-data">bindings to React</a> and (<em>new!</em>) <a href="#pre-built-reactive-components">pre-built components</a> that let you easily build fully reactive user interfaces.</li><li>Tiny by name, tiny by nature: <a href="#did-we-say-tiny">5.0kB - 9.4kB</a>, no dependencies. <a href="#well-tested-and-documented">100% tested</a>, <a href="https://beta.tinybase.org/guides/the-basics/getting-started/">fully documented</a>, and of course, <a href="https://github.com/tinyplex/tinybase">open source</a>!</li></ul><hr><section id="friends"><h2 id="tinybase-works-great-on-its-own-but-also-plays-well-with-friends">Tinybase works great on its own, but also plays well with friends!</h2><div><a href="https://beta.tinybase.org/guides/building-uis/getting-started-with-ui-react"><img width="48" src="https://beta.tinybase.org/react.svg"> React</a></div><div><a href="https://beta.tinybase.org/api/persister-partykit-client"><img width="48" src="https://beta.tinybase.org/partykit.svg"> PartyKit</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://beta.tinybase.org/expo.svg">Expo SQLite</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://beta.tinybase.org/electric.svg">ElectricSQL</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://beta.tinybase.org/sqlite.svg"> SQLite</a></div><div><a href="https://beta.tinybase.org/api/persister-indexed-db/functions/creation/createindexeddbpersister"><img width="48" src="https://beta.tinybase.org/indexeddb.svg"> IndexedDB</a></div><div><a href="https://beta.tinybase.org/api/persister-yjs/functions/creation/createyjspersister"><img width="48" src="https://beta.tinybase.org/yjs.svg"> YJS</a></div><div><a href="https://beta.tinybase.org/api/persister-cr-sqlite-wasm"><img width="48" src="https://beta.tinybase.org/crsqlite.png"> CR-SQLite</a></div><div><a href="https://beta.tinybase.org/api/persister-automerge"><img width="48" src="https://beta.tinybase.org/automerge.svg"> Automerge</a></div></section><hr><section id="follow"><a href="https://github.com/tinyplex/tinybase" target="_blank"><img src="https://img.shields.io/github/stars/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=GitHub&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://discord.com/invite/mGz3mevwP8" target="_blank"><img src="https://img.shields.io/discord/1027918215323590676?style=for-the-badge&amp;logo=discord&amp;logoColor=%23fff&amp;label=Discord&amp;labelColor=%233131e8&amp;color=%23333"> </a><a href="https://twitter.com/tinybasejs" target="_blank"><img src="https://img.shields.io/twitter/follow/tinybasejs?style=for-the-badge&amp;logo=x&amp;logoColor=%23fff&amp;label=Twitter&amp;labelColor=%23333&amp;color=%23333"></a><br><a href="https://github.com/tinyplex/tinybase/discussions" target="_blank"><img src="https://img.shields.io/github/discussions/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Ideas&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://github.com/tinyplex/tinybase/issues" target="_blank"><img src="https://img.shields.io/github/issues/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Issues&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="#well-tested-and-documented"><img src="https://img.shields.io/badge/Tests-100%25-green?style=for-the-badge&amp;logo=jest&amp;logoColor=%23fff&amp;color=%23333&amp;labelColor=%2387c305"> </a><a href="https://www.npmjs.com/package/tinybase/v/4.6.0-beta.1" target="_blank"><img src="https://img.shields.io/npm/v/tinybase?style=for-the-badge&amp;logo=npm&amp;logoColor=%23fff&amp;labelColor=%23bd0005&amp;color=%23333"></a></section><hr><section><h2 id="start-with-a-simple-key-value-store">Start with a simple key-value store.</h2><p>Creating a <a href="https://beta.tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> requires just a simple call to the <a href="https://beta.tinybase.org/api/store/functions/creation/createstore/"><code>createStore</code></a> function. Once you have one, you can easily set <a href="https://beta.tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a> in it by unique <a href="https://beta.tinybase.org/api/common/type-aliases/identity/id/"><code>Id</code></a>. And of course you can easily get them back out again.</p><p>Read more about using keyed value data in <a href="https://beta.tinybase.org/guides/the-basics/">The Basics</a> guide.</p></section>
1
+ <section id="hero"><h2 id="the-reactive-data-store-for-local-first-apps">The <em>reactive</em> data store for <span>local-first apps</span>.</h2><p id="copy">Build blisteringly fast web apps that work both online and offline. Manage your state locally, synchronize it to the cloud when you need to, or even make it collaborative. But, most importantly... have fun building stuff again!</p></section><p><a href="https://beta.tinybase.org/guides/releases/#v4-6"><em>NEW!</em> v4.6 release</a> <span id="one-with">&quot;The One With ElectricSQL&quot;</span></p><p><a class="start" href="https://beta.tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://beta.tinybase.org/demos/">Try the demos</a></p><p><a href="https://beta.tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><ul><li>Manage <a href="#start-with-a-simple-key-value-store">key-value data</a>, <a href="#level-up-to-use-tabular-data">tabular data</a> - or both - with optional <a href="#apply-schemas-to-tables-values">schematization</a> to model your app&#x27;s data structures.</li><li><a href="#register-granular-listeners">Flexibly reactive</a> to reconciled updates, so you only spend rendering cycles on things that change.</li><li><a href="#build-complex-queries-with-tinyql">Powerful query engine</a> to select, join, filter, group, sort and paginate data - reactively - and without SQL.</li><li>Built-in <a href="#create-indexes-for-fast-lookups">indexing</a>, <a href="#define-metrics-and-aggregations">metric aggregation</a>, <a href="#model-table-relationships">tabular relationships</a> - and even an <a href="#set-checkpoints-for-an-undo-stack">undo stack</a> for your app state.</li><li>Create <a href="#type-definitions-orm-like-apis">type definitions &amp; ORM-like APIs</a>, from schema or inference. <a href="#an-inspector-for-your-data">Inspect your data</a> (<em>new!</em>) directly in the browser.</li><li>Easily <a href="#persist-to-storage-sqlite-crdts">sync your data</a> to browser <a href="https://beta.tinybase.org/api/persister-browser">storage</a>, <a href="https://beta.tinybase.org/api/persister-indexed-db/">IndexedDB</a>, <a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence/">SQLite</a>, <a href="https://beta.tinybase.org/guides/schemas-and-persistence/synchronizing-data/">CRDTs</a>; and (<em>new!</em>) <a href="https://beta.tinybase.org/api/persister-partykit-client/">PartyKit</a> and <a href="https://electric-sql.com/">ElectricSQL</a>.</li><li>Optional <a href="#call-hooks-to-bind-to-data">bindings to React</a> and (<em>new!</em>) <a href="#pre-built-reactive-components">pre-built components</a> that let you easily build fully reactive user interfaces.</li><li>Tiny by name, tiny by nature: <a href="#did-we-say-tiny">5.0kB - 9.4kB</a>, no dependencies. <a href="#well-tested-and-documented">100% tested</a>, <a href="https://beta.tinybase.org/guides/the-basics/getting-started/">fully documented</a>, and of course, <a href="https://github.com/tinyplex/tinybase">open source</a>!</li></ul><hr><section id="friends"><h2 id="tinybase-works-great-on-its-own-but-also-plays-well-with-friends">Tinybase works great on its own, but also plays well with friends!</h2><div><a href="https://beta.tinybase.org/guides/building-uis/getting-started-with-ui-react"><img width="48" src="https://beta.tinybase.org/react.svg"> React</a></div><div><a href="https://beta.tinybase.org/api/persister-partykit-client"><img width="48" src="https://beta.tinybase.org/partykit.svg"> PartyKit</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://beta.tinybase.org/expo.svg">Expo SQLite</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://beta.tinybase.org/electric.svg">ElectricSQL</a></div><div><a href="https://beta.tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://beta.tinybase.org/sqlite.svg"> SQLite</a></div><div><a href="https://beta.tinybase.org/api/persister-indexed-db/functions/creation/createindexeddbpersister"><img width="48" src="https://beta.tinybase.org/indexeddb.svg"> IndexedDB</a></div><div><a href="https://beta.tinybase.org/api/persister-yjs/functions/creation/createyjspersister"><img width="48" src="https://beta.tinybase.org/yjs.svg"> YJS</a></div><div><a href="https://beta.tinybase.org/api/persister-cr-sqlite-wasm"><img width="48" src="https://beta.tinybase.org/crsqlite.png"> CR-SQLite</a></div><div><a href="https://beta.tinybase.org/api/persister-automerge"><img width="48" src="https://beta.tinybase.org/automerge.svg"> Automerge</a></div></section><hr><section id="follow"><a href="https://github.com/tinyplex/tinybase" target="_blank"><img src="https://img.shields.io/github/stars/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=GitHub&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://discord.com/invite/mGz3mevwP8" target="_blank"><img src="https://img.shields.io/discord/1027918215323590676?style=for-the-badge&amp;logo=discord&amp;logoColor=%23fff&amp;label=Discord&amp;labelColor=%233131e8&amp;color=%23333"> </a><a href="https://twitter.com/tinybasejs" target="_blank"><img src="https://img.shields.io/twitter/follow/tinybasejs?style=for-the-badge&amp;logo=x&amp;logoColor=%23fff&amp;label=Twitter&amp;labelColor=%23333&amp;color=%23333"></a><br><a href="https://github.com/tinyplex/tinybase/discussions" target="_blank"><img src="https://img.shields.io/github/discussions/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Ideas&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://github.com/tinyplex/tinybase/issues" target="_blank"><img src="https://img.shields.io/github/issues/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Issues&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="#well-tested-and-documented"><img src="https://img.shields.io/badge/Tests-100%25-green?style=for-the-badge&amp;logo=jest&amp;logoColor=%23fff&amp;color=%23333&amp;labelColor=%2387c305"> </a><a href="https://www.npmjs.com/package/tinybase/v/4.6.0-beta.2" target="_blank"><img src="https://img.shields.io/npm/v/tinybase?style=for-the-badge&amp;logo=npm&amp;logoColor=%23fff&amp;labelColor=%23bd0005&amp;color=%23333"></a></section><hr><section><h2 id="start-with-a-simple-key-value-store">Start with a simple key-value store.</h2><p>Creating a <a href="https://beta.tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> requires just a simple call to the <a href="https://beta.tinybase.org/api/store/functions/creation/createstore/"><code>createStore</code></a> function. Once you have one, you can easily set <a href="https://beta.tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a> in it by unique <a href="https://beta.tinybase.org/api/common/type-aliases/identity/id/"><code>Id</code></a>. And of course you can easily get them back out again.</p><p>Read more about using keyed value data in <a href="https://beta.tinybase.org/guides/the-basics/">The Basics</a> guide.</p></section>
2
2
 
3
3
  ```js
4
4
  const store = createStore()