tinybase 4.8.5 → 4.8.6

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.
@@ -64,7 +64,7 @@ export interface LibSqlPersister extends Persister {
64
64
  * See the documentation for the DpcJson and DpcTabular types for more
65
65
  * information on how both of those modes can be configured.
66
66
  * @param store The Store to persist.
67
- * @param db The database client that was returned from `createClient(...)`.
67
+ * @param client The database client that was returned from `createClient(...)`.
68
68
  * @param configOrStoreTableName A DatabasePersisterConfig to configure the
69
69
  * persistence mode (or a string to set the `storeTableName` property of the
70
70
  * JSON serialization).
@@ -147,7 +147,7 @@ export interface PowerSyncPersister extends Persister {
147
147
  */
148
148
  export function createPowerSyncPersister(
149
149
  store: Store,
150
- db: AbstractPowerSyncDatabase,
150
+ powerSync: AbstractPowerSyncDatabase,
151
151
  configOrStoreTableName?: DatabasePersisterConfig | string,
152
152
  onSqlCommand?: (sql: string, args?: any[]) => void,
153
153
  onIgnoredError?: (error: any) => void,
@@ -491,7 +491,7 @@ export interface Relationships {
491
491
  * ```
492
492
  * @category Getter
493
493
  */
494
- hasRelationship(indexId: Id): boolean;
494
+ hasRelationship(relationshipId: Id): boolean;
495
495
 
496
496
  /**
497
497
  * The getLocalTableId method returns the Id of the underlying local Table
@@ -7351,7 +7351,7 @@ export function useQueries(id?: Id): Queries | undefined;
7351
7351
  *
7352
7352
  * This is unlikely to be used often. For most situations, you will want to use
7353
7353
  * the useQueries hook.
7354
- * @param queriesOrOrQueriesId Either an Id for accessing a Queries object that
7354
+ * @param queriesOrQueriesId Either an Id for accessing a Queries object that
7355
7355
  * was named with an Id in the Provider, or the Queries object itself.
7356
7356
  * @returns A reference to the Queries object (or `undefined` if not within a
7357
7357
  * Provider context, or if the requested Queries object does not exist).
@@ -7415,9 +7415,9 @@ export function useQueriesOrQueriesById(
7415
7415
  * Query Ids in the Queries object will cause a re-render. When the component
7416
7416
  * containing this hook is unmounted, the listener will be automatically
7417
7417
  * removed.
7418
- * @param relationshipsOrRelationshipsId The Queries object to be accessed: omit
7419
- * for the default context Queries object, provide an Id for a named context
7420
- * Queries object, or provide an explicit reference.
7418
+ * @param queriesOrQueriesId The Queries object to be accessed: omit for the
7419
+ * default context Queries object, provide an Id for a named context Queries
7420
+ * object, or provide an explicit reference.
7421
7421
  * @returns The Query Ids in the Queries object, or an empty array.
7422
7422
  * @example
7423
7423
  * This example creates an Queries object outside the application, which is used
@@ -77,7 +77,7 @@ export interface LibSqlPersister<Schemas extends OptionalSchemas>
77
77
  * See the documentation for the DpcJson and DpcTabular types for more
78
78
  * information on how both of those modes can be configured.
79
79
  * @param store The Store to persist.
80
- * @param db The database client that was returned from `createClient(...)`.
80
+ * @param client The database client that was returned from `createClient(...)`.
81
81
  * @param configOrStoreTableName A DatabasePersisterConfig to configure the
82
82
  * persistence mode (or a string to set the `storeTableName` property of the
83
83
  * JSON serialization).
@@ -56,7 +56,7 @@ export interface PowerSyncPersister<Schemas extends OptionalSchemas>
56
56
  * ```ts override
57
57
  * createPowerSyncPersister(
58
58
  * store: Store,
59
- * db: AbstractPowerSyncDatabase,
59
+ * powerSync: AbstractPowerSyncDatabase,
60
60
  * configOrStoreTableName?: DatabasePersisterConfig | string,
61
61
  * onSqlCommand?: (sql: string, args?: any[]) => void,
62
62
  * onIgnoredError?: (error: any) => void,
@@ -160,7 +160,7 @@ export interface PowerSyncPersister<Schemas extends OptionalSchemas>
160
160
  */
161
161
  export function createPowerSyncPersister<Schemas extends OptionalSchemas>(
162
162
  store: Store<Schemas>,
163
- db: AbstractPowerSyncDatabase,
163
+ powerSync: AbstractPowerSyncDatabase,
164
164
  configOrStoreTableName?: DatabasePersisterConfig<Schemas> | string,
165
165
  onSqlCommand?: (sql: string, args?: any[]) => void,
166
166
  onIgnoredError?: (error: any) => void,
@@ -577,7 +577,7 @@ export interface Relationships<in out Schemas extends OptionalSchemas> {
577
577
  * ```
578
578
  * @category Getter
579
579
  */
580
- hasRelationship(indexId: Id): boolean;
580
+ hasRelationship(relationshipId: Id): boolean;
581
581
 
582
582
  /**
583
583
  * The getLocalTableId method returns the Id of the underlying local Table
@@ -8463,7 +8463,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
8463
8463
  *
8464
8464
  * This is unlikely to be used often. For most situations, you will want to use
8465
8465
  * the useQueries hook.
8466
- * @param queriesOrOrQueriesId Either an Id for accessing a Queries object that
8466
+ * @param queriesOrQueriesId Either an Id for accessing a Queries object that
8467
8467
  * was named with an Id in the Provider, or the Queries object itself.
8468
8468
  * @returns A reference to the Queries object (or `undefined` if not within a
8469
8469
  * Provider context, or if the requested Queries object does not exist).
@@ -8533,9 +8533,9 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
8533
8533
  * Query Ids in the Queries object will cause a re-render. When the component
8534
8534
  * containing this hook is unmounted, the listener will be automatically
8535
8535
  * removed.
8536
- * @param relationshipsOrRelationshipsId The Queries object to be accessed: omit
8537
- * for the default context Queries object, provide an Id for a named context
8538
- * Queries object, or provide an explicit reference.
8536
+ * @param queriesOrQueriesId The Queries object to be accessed: omit for the
8537
+ * default context Queries object, provide an Id for a named context Queries
8538
+ * object, or provide an explicit reference.
8539
8539
  * @returns The Query Ids in the Queries object, or an empty array.
8540
8540
  * @example
8541
8541
  * This example creates an Queries object outside the application, which is used
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinybase",
3
- "version": "4.8.5",
3
+ "version": "4.8.6",
4
4
  "author": "jamesgpearce",
5
5
  "repository": "github:tinyplex/tinybase",
6
6
  "license": "MIT",
@@ -214,7 +214,7 @@
214
214
  "publishPackage": "gulp publishPackage"
215
215
  },
216
216
  "devDependencies": {
217
- "@automerge/automerge": "^2.2.0",
217
+ "@automerge/automerge": "^2.2.1",
218
218
  "@automerge/automerge-repo": "^1.1.9",
219
219
  "@babel/cli": "^7.24.1",
220
220
  "@babel/core": "^7.24.4",
@@ -285,7 +285,7 @@
285
285
  "rollup-plugin-prettier": "^4.1.1",
286
286
  "sqlite3": "^5.1.7",
287
287
  "tinybase": "file:./",
288
- "tinydocs": "^0.1.36",
288
+ "tinydocs": "^0.1.37",
289
289
  "tmp": "^0.2.3",
290
290
  "ts-unused-exports": "^10.0.1",
291
291
  "typescript": "5.4.5",
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://tinybase.org/guides/releases/#v4-8"><em>NEW!</em> v4.8 release</a> <span id="one-with">&quot;The One With PowerSync&quot;</span></p><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://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://tinybase.org/api/persister-browser">storage</a>, <a href="https://tinybase.org/api/persister-indexed-db/">IndexedDB</a>, <a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence/">SQLite</a>, <a href="https://tinybase.org/guides/schemas-and-persistence/synchronizing-data/">CRDTs</a>; and (<em>new!</em>) <a href="https://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://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://tinybase.org/guides/building-uis/getting-started-with-ui-react"><img width="48" src="https://tinybase.org/react.svg"> React</a></div><div><a href="https://tinybase.org/api/persister-partykit-client"><img width="48" src="https://tinybase.org/partykit.svg"> PartyKit</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/expo.svg">Expo SQLite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/electric.svg">ElectricSQL</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/sqlite.svg"> SQLite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/turso.svg">Turso</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/powersync.svg">PowerSync</a></div><div><a href="https://tinybase.org/api/persister-indexed-db/functions/creation/createindexeddbpersister"><img width="48" src="https://tinybase.org/indexeddb.svg"> IndexedDB</a></div><div><a href="https://tinybase.org/api/persister-yjs/functions/creation/createyjspersister"><img width="48" src="https://tinybase.org/yjs.svg"> YJS</a></div><div><a href="https://tinybase.org/api/persister-cr-sqlite-wasm"><img width="48" src="https://tinybase.org/crsqlite.png"> CR-SQLite</a></div><div><a href="https://tinybase.org/api/persister-automerge"><img width="48" src="https://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.8.5" 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://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> requires just a simple call to the <a href="https://tinybase.org/api/store/functions/creation/createstore/"><code>createStore</code></a> function. Once you have one, you can easily set <a href="https://tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a> in it by unique <a href="https://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://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://tinybase.org/guides/releases/#v4-8"><em>NEW!</em> v4.8 release</a> <span id="one-with">&quot;The One With PowerSync&quot;</span></p><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://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://tinybase.org/api/persister-browser">storage</a>, <a href="https://tinybase.org/api/persister-indexed-db/">IndexedDB</a>, <a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence/">SQLite</a>, <a href="https://tinybase.org/guides/schemas-and-persistence/synchronizing-data/">CRDTs</a>; and (<em>new!</em>) <a href="https://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://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://tinybase.org/guides/building-uis/getting-started-with-ui-react"><img width="48" src="https://tinybase.org/react.svg"> React</a></div><div><a href="https://tinybase.org/api/persister-partykit-client"><img width="48" src="https://tinybase.org/partykit.svg"> PartyKit</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/expo.svg">Expo SQLite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/electric.svg">ElectricSQL</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/sqlite.svg"> SQLite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/turso.svg">Turso</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/powersync.svg">PowerSync</a></div><div><a href="https://tinybase.org/api/persister-indexed-db/functions/creation/createindexeddbpersister"><img width="48" src="https://tinybase.org/indexeddb.svg"> IndexedDB</a></div><div><a href="https://tinybase.org/api/persister-yjs/functions/creation/createyjspersister"><img width="48" src="https://tinybase.org/yjs.svg"> YJS</a></div><div><a href="https://tinybase.org/api/persister-cr-sqlite-wasm"><img width="48" src="https://tinybase.org/crsqlite.png"> CR-SQLite</a></div><div><a href="https://tinybase.org/api/persister-automerge"><img width="48" src="https://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.8.6" 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://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> requires just a simple call to the <a href="https://tinybase.org/api/store/functions/creation/createstore/"><code>createStore</code></a> function. Once you have one, you can easily set <a href="https://tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a> in it by unique <a href="https://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://tinybase.org/guides/the-basics/">The Basics</a> guide.</p></section>
2
2
 
3
3
  ```js
4
4
  const store = createStore()