tinybase 2.1.0-beta.0 → 2.1.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.
@@ -192,6 +192,7 @@ export type IndexesListenerStats = {
192
192
  * @see Rolling Dice demos
193
193
  * @see Country demo
194
194
  * @see Todo App demos
195
+ * @see Word Frequencies demo
195
196
  * @category Indexes
196
197
  */
197
198
  export interface Indexes {
@@ -192,6 +192,7 @@ export type IndexesListenerStats = {
192
192
  * @see Rolling Dice demos
193
193
  * @see Country demo
194
194
  * @see Todo App demos
195
+ * @see Word Frequencies demo
195
196
  * @category Indexes
196
197
  */
197
198
  export interface Indexes {
package/lib/indexes.d.ts CHANGED
@@ -192,6 +192,7 @@ export type IndexesListenerStats = {
192
192
  * @see Rolling Dice demos
193
193
  * @see Country demo
194
194
  * @see Todo App demos
195
+ * @see Word Frequencies demo
195
196
  * @category Indexes
196
197
  */
197
198
  export interface Indexes {
@@ -192,6 +192,7 @@ export type IndexesListenerStats = {
192
192
  * @see Rolling Dice demos
193
193
  * @see Country demo
194
194
  * @see Todo App demos
195
+ * @see Word Frequencies demo
195
196
  * @category Indexes
196
197
  */
197
198
  export interface Indexes {
@@ -192,6 +192,7 @@ export type IndexesListenerStats = {
192
192
  * @see Rolling Dice demos
193
193
  * @see Country demo
194
194
  * @see Todo App demos
195
+ * @see Word Frequencies demo
195
196
  * @category Indexes
196
197
  */
197
198
  export interface Indexes {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinybase",
3
- "version": "2.1.0-beta.0",
3
+ "version": "2.1.0",
4
4
  "author": "jamesgpearce",
5
5
  "repository": "github:tinyplex/tinybase",
6
6
  "license": "MIT",
@@ -58,35 +58,35 @@
58
58
  "publishPackage": "gulp publishPackage"
59
59
  },
60
60
  "devDependencies": {
61
- "@babel/cli": "^7.18.10",
62
- "@babel/core": "^7.19.1",
63
- "@babel/preset-env": "^7.19.1",
61
+ "@babel/cli": "^7.19.3",
62
+ "@babel/core": "^7.19.3",
63
+ "@babel/preset-env": "^7.19.3",
64
64
  "@babel/preset-react": "^7.18.6",
65
65
  "@babel/preset-typescript": "^7.18.6",
66
66
  "@rollup/plugin-replace": "^4.0.0",
67
67
  "@types/asciichart": "^1.5.6",
68
68
  "@types/expect-puppeteer": "^5.0.1",
69
69
  "@types/http-server": "^0.12.1",
70
- "@types/jest": "^29.0.3",
70
+ "@types/jest": "^29.1.1",
71
71
  "@types/jest-environment-puppeteer": "^5.0.2",
72
72
  "@types/less": "^3.0.3",
73
- "@types/node": "^18.7.18",
73
+ "@types/node": "^18.7.23",
74
74
  "@types/puppeteer": "^5.4.6",
75
75
  "@types/react": "^17.0.41",
76
76
  "@types/react-dom": "^17.0.14",
77
77
  "@types/react-test-renderer": "^17.0.1",
78
78
  "@types/tmp": "^0.2.3",
79
- "@typescript-eslint/eslint-plugin": "^5.37.0",
80
- "@typescript-eslint/parser": "^5.37.0",
79
+ "@typescript-eslint/eslint-plugin": "^5.38.1",
80
+ "@typescript-eslint/parser": "^5.38.1",
81
81
  "asciichart": "^1.5.25",
82
82
  "babel-eslint": "^10.1.0",
83
- "babel-jest": "^29.0.3",
83
+ "babel-jest": "^29.1.2",
84
84
  "babel-preset-minify": "^0.5.2",
85
85
  "buffer-replace": "^1.0.0",
86
86
  "country-flag-emoji-json": "^2.0.0",
87
- "cspell": "^6.9.0",
88
- "esbuild": "^0.15.7",
89
- "eslint": "^8.23.1",
87
+ "cspell": "^6.12.0",
88
+ "esbuild": "^0.15.10",
89
+ "eslint": "^8.24.0",
90
90
  "eslint-config-prettier": "^8.5.0",
91
91
  "eslint-plugin-jest": "^27.0.4",
92
92
  "eslint-plugin-jsdoc": "^39.3.6",
@@ -95,8 +95,8 @@
95
95
  "gulp": "^4.0.2",
96
96
  "gulp-gzip": "^1.4.2",
97
97
  "http-server": "^14.1.1",
98
- "jest": "^29.0.3",
99
- "jest-environment-jsdom": "^29.0.3",
98
+ "jest": "^29.1.2",
99
+ "jest-environment-jsdom": "^29.1.2",
100
100
  "jest-fetch-mock": "^3.0.3",
101
101
  "jest-puppeteer": "^6.1.1",
102
102
  "less": "^4.1.3",
@@ -105,7 +105,7 @@
105
105
  "react": "^17.0.2",
106
106
  "react-dom": "^17.0.2",
107
107
  "react-test-renderer": "^17.0.2",
108
- "rollup": "^2.79.0",
108
+ "rollup": "^2.79.1",
109
109
  "rollup-plugin-esbuild": "^4.10.1",
110
110
  "rollup-plugin-gzip": "^3.0.1",
111
111
  "rollup-plugin-prettier": "^2.2.2",
@@ -113,7 +113,7 @@
113
113
  "tinydocs": "^0.1.15",
114
114
  "tmp": "^0.2.1",
115
115
  "ts-unused-exports": "^8.0.0",
116
- "typescript": "4.8.3"
116
+ "typescript": "4.8.4"
117
117
  },
118
118
  "peerDependencies": {
119
119
  "react": "^17.0.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 local‑first apps.</h2><p>Modern apps deserve better. Why trade reactive user experiences to be able to use relational data? Why sacrifice store features for bundle size? And why should the cloud do all the work <a href="https://www.inkandswitch.com/local-first/" target="_blank">anyway</a>?</p><p><em>TinyBase is a smart new way to structure your local app data:</em></p><ul><li>Familiar concepts of <a href="#set-and-get-tables-rows-and-cells">tables, rows, and cells</a>, and <a href="#apply-schemas-to-tables">schematization</a> to model your data domain.</li><li><a href="#register-listeners-at-any-granularity">Flexibly reactive</a> to reconciled updates, so your UI only spends cycles on the data that changes.</li><li><em>NEW!</em> <a href="#build-complex-queries-with-tinyql">Powerful query engine</a> to select, join, filter, group, sort and paginate data - reactively.</li><li><a href="#create-indexes-for-fast-lookups">Indexing</a>, <a href="#define-metrics-and-aggregations">metrics</a>, <a href="#configure-relationships-between-tables">relationships</a> - and even an <a href="#use-checkpoints-for-an-easy-undo-stack">undo stack</a> for your app state! - out of the box.</li><li>Easily <a href="#persist-data-to-browser-file-or-server">sync your data</a> to local or remote storage, and use <a href="#call-hooks-to-bind-to-data">idiomatic bindings</a> to your UI.</li></ul><p><em>Tiny by name, tiny by nature</em>, TinyBase only costs <a href="#did-we-say-tiny">3.5kB - 7.8kB</a> when compressed, and has zero dependencies. And of course it&#x27;s <a href="#well-tested-and-documented">well tested</a>, <a href="https://beta.tinybase.org/guides/the-basics/getting-started">fully documented</a>, and <a href="https://github.com/tinyplex/tinybase">open source</a>. Other <a href="https://beta.tinybase.org/guides/faq/">FAQs</a>?</p></section><p><a id="new" href="https://beta.tinybase.org/guides/releases/#v2-0"><em>NEW!</em> v2.0 release</a></p><hr><p><a id="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><section><h2 id="set-and-get-tables-rows-and-cells">Set and get tables, rows, and cells.</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/table"><code>Table</code></a>, <a href="https://beta.tinybase.org/api/store/type-aliases/store/row"><code>Row</code></a>, or <a href="https://beta.tinybase.org/api/store/type-aliases/store/cell"><code>Cell</code></a> values by their <a href="https://beta.tinybase.org/api/common/type-aliases/identity/id"><code>Id</code></a>. And of course you can easily get the values back out again.</p><p>Read more about setting and changing 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 local‑first apps.</h2><p>Modern apps deserve better. Why trade reactive user experiences to be able to use relational data? Why sacrifice store features for bundle size? And why should the cloud do all the work <a href="https://www.inkandswitch.com/local-first/" target="_blank">anyway</a>?</p><p><em>TinyBase is a smart new way to structure your local app data:</em></p><ul><li>Familiar concepts of <a href="#set-and-get-tables-rows-and-cells">tables, rows, and cells</a>, and <a href="#apply-schemas-to-tables">schematization</a> to model your data domain.</li><li><a href="#register-listeners-at-any-granularity">Flexibly reactive</a> to reconciled updates, so your UI only spends cycles on the data that changes.</li><li><em>NEW!</em> <a href="#build-complex-queries-with-tinyql">Powerful query engine</a> to select, join, filter, group, sort and paginate data - reactively.</li><li><a href="#create-indexes-for-fast-lookups">Indexing</a>, <a href="#define-metrics-and-aggregations">metrics</a>, <a href="#configure-relationships-between-tables">relationships</a> - and even an <a href="#use-checkpoints-for-an-easy-undo-stack">undo stack</a> for your app state! - out of the box.</li><li>Easily <a href="#persist-data-to-browser-file-or-server">sync your data</a> to local or remote storage, and use <a href="#call-hooks-to-bind-to-data">idiomatic bindings</a> to your UI.</li></ul><p><em>Tiny by name, tiny by nature</em>, TinyBase only costs <a href="#did-we-say-tiny">3.5kB - 7.8kB</a> when compressed, and has zero dependencies. And of course it&#x27;s <a href="#well-tested-and-documented">well tested</a>, <a href="https://tinybase.org/guides/the-basics/getting-started">fully documented</a>, and <a href="https://github.com/tinyplex/tinybase">open source</a>. Other <a href="https://tinybase.org/guides/faq/">FAQs</a>?</p></section><p><a id="new" href="https://tinybase.org/guides/releases/#v2-1"><em>NEW!</em> v2.1 release</a></p><hr><p><a id="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><section><h2 id="set-and-get-tables-rows-and-cells">Set and get tables, rows, and cells.</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/table"><code>Table</code></a>, <a href="https://tinybase.org/api/store/type-aliases/store/row"><code>Row</code></a>, or <a href="https://tinybase.org/api/store/type-aliases/store/cell"><code>Cell</code></a> values by their <a href="https://tinybase.org/api/common/type-aliases/identity/id"><code>Id</code></a>. And of course you can easily get the values back out again.</p><p>Read more about setting and changing 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()
@@ -9,7 +9,7 @@ console.log(store.getRow('pets', 'fido'));
9
9
  // -> {species: 'dog', color: 'brown'}
10
10
  ```
11
11
 
12
- <section><h2 id="register-listeners-at-any-granularity">Register listeners at any granularity.</h2><p>The magic starts to happen when you register listeners on a <a href="https://beta.tinybase.org/api/store/interfaces/store/store"><code>Store</code></a>, <a href="https://beta.tinybase.org/api/store/type-aliases/store/table"><code>Table</code></a>, <a href="https://beta.tinybase.org/api/store/type-aliases/store/row"><code>Row</code></a>, or <a href="https://beta.tinybase.org/api/store/type-aliases/store/cell"><code>Cell</code></a>. They get called when any part of that object changes. You can also use wildcards - useful when you don&#x27;t know the <a href="https://beta.tinybase.org/api/common/type-aliases/identity/id"><code>Id</code></a> of the objects that might change.</p><p>Read more about listeners in the <a href="https://beta.tinybase.org/guides/the-basics/listening-to-stores">Listening To Stores</a> guide.</p></section>
12
+ <section><h2 id="register-listeners-at-any-granularity">Register listeners at any granularity.</h2><p>The magic starts to happen when you register listeners on a <a href="https://tinybase.org/api/store/interfaces/store/store"><code>Store</code></a>, <a href="https://tinybase.org/api/store/type-aliases/store/table"><code>Table</code></a>, <a href="https://tinybase.org/api/store/type-aliases/store/row"><code>Row</code></a>, or <a href="https://tinybase.org/api/store/type-aliases/store/cell"><code>Cell</code></a>. They get called when any part of that object changes. You can also use wildcards - useful when you don&#x27;t know the <a href="https://tinybase.org/api/common/type-aliases/identity/id"><code>Id</code></a> of the objects that might change.</p><p>Read more about listeners in the <a href="https://tinybase.org/guides/the-basics/listening-to-stores">Listening To Stores</a> guide.</p></section>
13
13
 
14
14
  ```js
15
15
  const listenerId = store.addTableListener('pets', () =>
@@ -22,7 +22,7 @@ store.setCell('pets', 'fido', 'sold', false);
22
22
  store.delListener(listenerId);
23
23
  ```
24
24
 
25
- <section><h2 id="call-hooks-to-bind-to-data">Call hooks to bind to data.</h2><p>If you&#x27;re using React in your application, the optional <a href="https://beta.tinybase.org/api/ui-react"><code>ui-react</code></a> module provides hooks to bind to the data in a <a href="https://beta.tinybase.org/api/store/interfaces/store/store"><code>Store</code></a>.</p><p>More magic! The <a href="https://beta.tinybase.org/api/ui-react/functions/store-hooks/usecell"><code>useCell</code></a> hook in this example fetches the dog&#x27;s color. But it also registers a listener on that cell that will fire and re-render the component whenever the value changes.</p><p>Basically you simply describe what data you want in your user interface and TinyBase will take care of the whole lifecycle of updating it for you.</p><p>Read more about the using hooks in the <a href="https://beta.tinybase.org/guides/building-uis/using-react-hooks">Using React Hooks</a> guide.</p></section>
25
+ <section><h2 id="call-hooks-to-bind-to-data">Call hooks to bind to data.</h2><p>If you&#x27;re using React in your application, the optional <a href="https://tinybase.org/api/ui-react"><code>ui-react</code></a> module provides hooks to bind to the data in a <a href="https://tinybase.org/api/store/interfaces/store/store"><code>Store</code></a>.</p><p>More magic! The <a href="https://tinybase.org/api/ui-react/functions/store-hooks/usecell"><code>useCell</code></a> hook in this example fetches the dog&#x27;s color. But it also registers a listener on that cell that will fire and re-render the component whenever the value changes.</p><p>Basically you simply describe what data you want in your user interface and TinyBase will take care of the whole lifecycle of updating it for you.</p><p>Read more about the using hooks in the <a href="https://tinybase.org/guides/building-uis/using-react-hooks">Using React Hooks</a> guide.</p></section>
26
26
 
27
27
  ```jsx
28
28
  const App1 = () => {
@@ -40,7 +40,7 @@ console.log(app.innerHTML);
40
40
  // -> 'Color: walnut'
41
41
  ```
42
42
 
43
- <section><h2 id="use-components-to-make-reactive-apps">Use components to make reactive apps.</h2><p>The react module provides simple React components with bindings that make it easy to create a fully reactive user interface based on a <a href="https://beta.tinybase.org/api/store/interfaces/store/store"><code>Store</code></a>.</p><p>In this example, the library&#x27;s <a href="https://beta.tinybase.org/api/ui-react/functions/store-components/rowview"><code>RowView</code></a> component just needs a reference to the <a href="https://beta.tinybase.org/api/store/interfaces/store/store"><code>Store</code></a>, the <code>tableId</code>, and the <code>rowId</code> in order to render the contents of that row. An optional <code>cellComponent</code> prop lets you override how you want each <a href="https://beta.tinybase.org/api/store/type-aliases/store/cell"><code>Cell</code></a> rendered. Again, all the listeners and updates are taken care of for you.</p><p>The module also includes a context Provider that sets up default for an entire app to use, reducing the need to drill all your props down into your app&#x27;s hierarchy.</p><p>Most of the demos showcase the use of these React hooks and components. Take a look at <a href="https://beta.tinybase.org/demos/todo-app/todo-app-v1-the-basics">Todo App v1 (the basics)</a> to see these user interface binding patterns in action.</p><p>Read more about the <a href="https://beta.tinybase.org/api/ui-react"><code>ui-react</code></a> module in the <a href="https://beta.tinybase.org/guides/building-uis">Building UIs</a> guides.</p></section>
43
+ <section><h2 id="use-components-to-make-reactive-apps">Use components to make reactive apps.</h2><p>The react module provides simple React components with bindings that make it easy to create a fully reactive user interface based on a <a href="https://tinybase.org/api/store/interfaces/store/store"><code>Store</code></a>.</p><p>In this example, the library&#x27;s <a href="https://tinybase.org/api/ui-react/functions/store-components/rowview"><code>RowView</code></a> component just needs a reference to the <a href="https://tinybase.org/api/store/interfaces/store/store"><code>Store</code></a>, the <code>tableId</code>, and the <code>rowId</code> in order to render the contents of that row. An optional <code>cellComponent</code> prop lets you override how you want each <a href="https://tinybase.org/api/store/type-aliases/store/cell"><code>Cell</code></a> rendered. Again, all the listeners and updates are taken care of for you.</p><p>The module also includes a context Provider that sets up default for an entire app to use, reducing the need to drill all your props down into your app&#x27;s hierarchy.</p><p>Most of the demos showcase the use of these React hooks and components. Take a look at <a href="https://tinybase.org/demos/todo-app/todo-app-v1-the-basics">Todo App v1 (the basics)</a> to see these user interface binding patterns in action.</p><p>Read more about the <a href="https://tinybase.org/api/ui-react"><code>ui-react</code></a> module in the <a href="https://tinybase.org/guides/building-uis">Building UIs</a> guides.</p></section>
44
44
 
45
45
  ```jsx
46
46
  const MyCellView = (props) => (
@@ -70,7 +70,7 @@ console.log(app.innerHTML);
70
70
  ReactDOM.unmountComponentAtNode(app);
71
71
  ```
72
72
 
73
- <section><h2 id="apply-schemas-to-tables">Apply schemas to tables.</h2><p>By default, a <a href="https://beta.tinybase.org/api/store/type-aliases/store/row"><code>Row</code></a> can contain any arbitrary <a href="https://beta.tinybase.org/api/store/type-aliases/store/cell"><code>Cell</code></a>. But you can add a schema to a <a href="https://beta.tinybase.org/api/store/interfaces/store/store"><code>Store</code></a> to ensure that the values are always what you expect. For example, you can limit their types, and provide defaults. You can also create mutating listeners that can programmatically enforce a schema.</p><p>In this example, we set a second <a href="https://beta.tinybase.org/api/store/type-aliases/store/row"><code>Row</code></a> without the <code>sold</code> <a href="https://beta.tinybase.org/api/store/type-aliases/store/cell"><code>Cell</code></a> in it. The schema ensures it&#x27;s present with default of <code>false</code>.</p><p>Read more about schemas in the <a href="https://beta.tinybase.org/guides/schemas-and-persistence/using-schemas">Using Schemas</a> guide.</p></section>
73
+ <section><h2 id="apply-schemas-to-tables">Apply schemas to tables.</h2><p>By default, a <a href="https://tinybase.org/api/store/type-aliases/store/row"><code>Row</code></a> can contain any arbitrary <a href="https://tinybase.org/api/store/type-aliases/store/cell"><code>Cell</code></a>. But you can add a schema to a <a href="https://tinybase.org/api/store/interfaces/store/store"><code>Store</code></a> to ensure that the values are always what you expect. For example, you can limit their types, and provide defaults. You can also create mutating listeners that can programmatically enforce a schema.</p><p>In this example, we set a second <a href="https://tinybase.org/api/store/type-aliases/store/row"><code>Row</code></a> without the <code>sold</code> <a href="https://tinybase.org/api/store/type-aliases/store/cell"><code>Cell</code></a> in it. The schema ensures it&#x27;s present with default of <code>false</code>.</p><p>Read more about schemas in the <a href="https://tinybase.org/guides/schemas-and-persistence/using-schemas">Using Schemas</a> guide.</p></section>
74
74
 
75
75
  ```js
76
76
  store.setSchema({
@@ -88,7 +88,7 @@ console.log(store.getRow('pets', 'felix'));
88
88
  store.delSchema();
89
89
  ```
90
90
 
91
- <section><h2 id="persist-data-to-browser-file-or-server">Persist data to browser, file, or server.</h2><p>You can easily persist a <a href="https://beta.tinybase.org/api/store/interfaces/store/store"><code>Store</code></a> between browser page reloads or sessions. You can also synchronize it with a web endpoint, or (if you&#x27;re using TinyBase in an appropriate environment), load and save it to a file.</p><p>Read more about persisters in the <a href="https://beta.tinybase.org/guides/schemas-and-persistence/persisting-data">Persisting Data</a> guide.</p></section>
91
+ <section><h2 id="persist-data-to-browser-file-or-server">Persist data to browser, file, or server.</h2><p>You can easily persist a <a href="https://tinybase.org/api/store/interfaces/store/store"><code>Store</code></a> between browser page reloads or sessions. You can also synchronize it with a web endpoint, or (if you&#x27;re using TinyBase in an appropriate environment), load and save it to a file.</p><p>Read more about persisters in the <a href="https://tinybase.org/guides/schemas-and-persistence/persisting-data">Persisting Data</a> guide.</p></section>
92
92
 
93
93
  ```js
94
94
  const persister = createSessionPersister(store, 'demo');
@@ -101,7 +101,7 @@ persister.destroy();
101
101
  sessionStorage.clear();
102
102
  ```
103
103
 
104
- <section><h2 id="build-complex-queries-with-tinyql">Build complex queries with <a href="https://beta.tinybase.org/guides/making-queries/tinyql">TinyQL</a>.</h2><p>The <a href="https://beta.tinybase.org/api/queries/interfaces/queries/queries"><code>Queries</code></a> object lets you query data across tables, with filtering and aggregation - using a SQL-adjacent syntax called <a href="https://beta.tinybase.org/guides/making-queries/tinyql">TinyQL</a>.</p><p>Accessors and listeners let you sort and paginate the results efficiently, making building rich tabular interfaces easier than ever.</p><p>In this example, we have two tables: of pets and their owners. They are joined together by the pet&#x27;s ownerId <a href="https://beta.tinybase.org/api/store/type-aliases/store/cell"><code>Cell</code></a>. We select the pet&#x27;s species, and the owner&#x27;s state, and then aggregate the prices for the combinations.</p><p>We access the results by descending price, essentially answering the question: &quot;which is the highest-priced species, and in which state?&quot;</p><p>Needless to say, the results are reactive too! You can add listeners to queries just as easily as you do to raw tables.</p><p>Read more about <a href="https://beta.tinybase.org/api/queries/interfaces/queries/queries"><code>Queries</code></a> in the <a href="https://beta.tinybase.org/guides/releases/#v2-0">v2.0 Release Notes</a>, the <a href="https://beta.tinybase.org/guides/making-queries">Making Queries</a> guide, and the <a href="https://beta.tinybase.org/demos/car-analysis">Car Analysis</a> demo and <a href="https://beta.tinybase.org/demos/movie-database">Movie Database</a> demo.</p></section>
104
+ <section><h2 id="build-complex-queries-with-tinyql">Build complex queries with <a href="https://tinybase.org/guides/making-queries/tinyql">TinyQL</a>.</h2><p>The <a href="https://tinybase.org/api/queries/interfaces/queries/queries"><code>Queries</code></a> object lets you query data across tables, with filtering and aggregation - using a SQL-adjacent syntax called <a href="https://tinybase.org/guides/making-queries/tinyql">TinyQL</a>.</p><p>Accessors and listeners let you sort and paginate the results efficiently, making building rich tabular interfaces easier than ever.</p><p>In this example, we have two tables: of pets and their owners. They are joined together by the pet&#x27;s ownerId <a href="https://tinybase.org/api/store/type-aliases/store/cell"><code>Cell</code></a>. We select the pet&#x27;s species, and the owner&#x27;s state, and then aggregate the prices for the combinations.</p><p>We access the results by descending price, essentially answering the question: &quot;which is the highest-priced species, and in which state?&quot;</p><p>Needless to say, the results are reactive too! You can add listeners to queries just as easily as you do to raw tables.</p><p>Read more about <a href="https://tinybase.org/api/queries/interfaces/queries/queries"><code>Queries</code></a> in the <a href="https://tinybase.org/guides/releases/#v2-0">v2.0 Release Notes</a>, the <a href="https://tinybase.org/guides/making-queries">Making Queries</a> guide, and the <a href="https://tinybase.org/demos/car-analysis">Car Analysis</a> demo and <a href="https://tinybase.org/demos/movie-database">Movie Database</a> demo.</p></section>
105
105
 
106
106
  ```js
107
107
  store
@@ -142,7 +142,7 @@ queries
142
142
  queries.destroy();
143
143
  ```
144
144
 
145
- <section><h2 id="define-metrics-and-aggregations">Define metrics and aggregations.</h2><p>A <a href="https://beta.tinybase.org/api/metrics/interfaces/metrics/metrics"><code>Metrics</code></a> object makes it easy to keep a running aggregation of <a href="https://beta.tinybase.org/api/store/type-aliases/store/cell"><code>Cell</code></a> values in each <a href="https://beta.tinybase.org/api/store/type-aliases/store/row"><code>Row</code></a> of a <a href="https://beta.tinybase.org/api/store/type-aliases/store/table"><code>Table</code></a>. This is useful for counting rows, but also supports averages, ranges of values, or arbitrary aggregations.</p><p>In this example, we create a new table of the pet species, and keep a track of which is most expensive. When we add horses to our pet store, the listener detects that the highest price has changed.</p><p>Read more about <a href="https://beta.tinybase.org/api/metrics/interfaces/metrics/metrics"><code>Metrics</code></a> in the <a href="https://beta.tinybase.org/guides/metrics-and-indexes/using-metrics">Using Metrics</a> guide.</p></section>
145
+ <section><h2 id="define-metrics-and-aggregations">Define metrics and aggregations.</h2><p>A <a href="https://tinybase.org/api/metrics/interfaces/metrics/metrics"><code>Metrics</code></a> object makes it easy to keep a running aggregation of <a href="https://tinybase.org/api/store/type-aliases/store/cell"><code>Cell</code></a> values in each <a href="https://tinybase.org/api/store/type-aliases/store/row"><code>Row</code></a> of a <a href="https://tinybase.org/api/store/type-aliases/store/table"><code>Table</code></a>. This is useful for counting rows, but also supports averages, ranges of values, or arbitrary aggregations.</p><p>In this example, we create a new table of the pet species, and keep a track of which is most expensive. When we add horses to our pet store, the listener detects that the highest price has changed.</p><p>Read more about <a href="https://tinybase.org/api/metrics/interfaces/metrics/metrics"><code>Metrics</code></a> in the <a href="https://tinybase.org/guides/metrics-and-indexes/using-metrics">Using Metrics</a> guide.</p></section>
146
146
 
147
147
  ```js
148
148
  store.setTable('species', {
@@ -171,7 +171,7 @@ store.setCell('species', 'horse', 'price', 20);
171
171
  metrics.destroy();
172
172
  ```
173
173
 
174
- <section><h2 id="create-indexes-for-fast-lookups">Create indexes for fast lookups.</h2><p>An <a href="https://beta.tinybase.org/api/indexes/interfaces/indexes/indexes"><code>Indexes</code></a> object makes it easy to look up all the <a href="https://beta.tinybase.org/api/store/type-aliases/store/row"><code>Row</code></a> objects that have a certain value in a <a href="https://beta.tinybase.org/api/store/type-aliases/store/cell"><code>Cell</code></a>.</p><p>In this example, we create an index on the <code>species</code> <a href="https://beta.tinybase.org/api/store/type-aliases/store/cell"><code>Cell</code></a> values. We can then get the the list of distinct <a href="https://beta.tinybase.org/api/store/type-aliases/store/cell"><code>Cell</code></a> value present for that index (known as &#x27;slices&#x27;), and the set of <a href="https://beta.tinybase.org/api/store/type-aliases/store/row"><code>Row</code></a> objects that match each value.</p><p><a href="https://beta.tinybase.org/api/indexes/interfaces/indexes/indexes"><code>Indexes</code></a> objects are reactive too. So you can set listeners on them just as you do for the data in the underlying <a href="https://beta.tinybase.org/api/store/interfaces/store/store"><code>Store</code></a>.</p><p>Read more about <a href="https://beta.tinybase.org/api/indexes/interfaces/indexes/indexes"><code>Indexes</code></a> in the <a href="https://beta.tinybase.org/guides/metrics-and-indexes/using-indexes">Using Indexes</a> guide.</p></section>
174
+ <section><h2 id="create-indexes-for-fast-lookups">Create indexes for fast lookups.</h2><p>An <a href="https://tinybase.org/api/indexes/interfaces/indexes/indexes"><code>Indexes</code></a> object makes it easy to look up all the <a href="https://tinybase.org/api/store/type-aliases/store/row"><code>Row</code></a> objects that have a certain value in a <a href="https://tinybase.org/api/store/type-aliases/store/cell"><code>Cell</code></a>.</p><p>In this example, we create an index on the <code>species</code> <a href="https://tinybase.org/api/store/type-aliases/store/cell"><code>Cell</code></a> values. We can then get the the list of distinct <a href="https://tinybase.org/api/store/type-aliases/store/cell"><code>Cell</code></a> value present for that index (known as &#x27;slices&#x27;), and the set of <a href="https://tinybase.org/api/store/type-aliases/store/row"><code>Row</code></a> objects that match each value.</p><p><a href="https://tinybase.org/api/indexes/interfaces/indexes/indexes"><code>Indexes</code></a> objects are reactive too. So you can set listeners on them just as you do for the data in the underlying <a href="https://tinybase.org/api/store/interfaces/store/store"><code>Store</code></a>.</p><p>Read more about <a href="https://tinybase.org/api/indexes/interfaces/indexes/indexes"><code>Indexes</code></a> in the <a href="https://tinybase.org/guides/metrics-and-indexes/using-indexes">Using Indexes</a> guide.</p></section>
175
175
 
176
176
  ```js
177
177
  const indexes = createIndexes(store);
@@ -195,7 +195,7 @@ store.setRow('pets', 'lowly', {species: 'worm'});
195
195
  indexes.destroy();
196
196
  ```
197
197
 
198
- <section><h2 id="model-relationships-between-tables">Model relationships between tables.</h2><p>A <a href="https://beta.tinybase.org/api/relationships/interfaces/relationships/relationships"><code>Relationships</code></a> object lets you associate a <a href="https://beta.tinybase.org/api/store/type-aliases/store/row"><code>Row</code></a> in a local <a href="https://beta.tinybase.org/api/store/type-aliases/store/table"><code>Table</code></a> with the <a href="https://beta.tinybase.org/api/common/type-aliases/identity/id"><code>Id</code></a> of a <a href="https://beta.tinybase.org/api/store/type-aliases/store/row"><code>Row</code></a> in a remote <a href="https://beta.tinybase.org/api/store/type-aliases/store/table"><code>Table</code></a>. You can also reference a table to itself to create linked lists.</p><p>In this example, the <code>species</code> <a href="https://beta.tinybase.org/api/store/type-aliases/store/cell"><code>Cell</code></a> of the <code>pets</code> <a href="https://beta.tinybase.org/api/store/type-aliases/store/table"><code>Table</code></a> is used to create a relationship to the <code>species</code> <a href="https://beta.tinybase.org/api/store/type-aliases/store/table"><code>Table</code></a>, so that we can access the price of a given pet.</p><p>Like everything else, you can set listeners on <a href="https://beta.tinybase.org/api/relationships/interfaces/relationships/relationships"><code>Relationships</code></a> too.</p><p>Read more about <a href="https://beta.tinybase.org/api/relationships/interfaces/relationships/relationships"><code>Relationships</code></a> in the <a href="https://beta.tinybase.org/guides/relationships-and-checkpoints/using-relationships">Using Relationships</a> guide.</p></section>
198
+ <section><h2 id="model-relationships-between-tables">Model relationships between tables.</h2><p>A <a href="https://tinybase.org/api/relationships/interfaces/relationships/relationships"><code>Relationships</code></a> object lets you associate a <a href="https://tinybase.org/api/store/type-aliases/store/row"><code>Row</code></a> in a local <a href="https://tinybase.org/api/store/type-aliases/store/table"><code>Table</code></a> with the <a href="https://tinybase.org/api/common/type-aliases/identity/id"><code>Id</code></a> of a <a href="https://tinybase.org/api/store/type-aliases/store/row"><code>Row</code></a> in a remote <a href="https://tinybase.org/api/store/type-aliases/store/table"><code>Table</code></a>. You can also reference a table to itself to create linked lists.</p><p>In this example, the <code>species</code> <a href="https://tinybase.org/api/store/type-aliases/store/cell"><code>Cell</code></a> of the <code>pets</code> <a href="https://tinybase.org/api/store/type-aliases/store/table"><code>Table</code></a> is used to create a relationship to the <code>species</code> <a href="https://tinybase.org/api/store/type-aliases/store/table"><code>Table</code></a>, so that we can access the price of a given pet.</p><p>Like everything else, you can set listeners on <a href="https://tinybase.org/api/relationships/interfaces/relationships/relationships"><code>Relationships</code></a> too.</p><p>Read more about <a href="https://tinybase.org/api/relationships/interfaces/relationships/relationships"><code>Relationships</code></a> in the <a href="https://tinybase.org/guides/relationships-and-checkpoints/using-relationships">Using Relationships</a> guide.</p></section>
199
199
 
200
200
  ```js
201
201
  const relationships = createRelationships(store);
@@ -218,7 +218,7 @@ console.log(
218
218
  relationships.destroy();
219
219
  ```
220
220
 
221
- <section><h2 id="set-checkpoints-for-an-undo-stack">Set checkpoints for an undo stack.</h2><p>A <a href="https://beta.tinybase.org/api/checkpoints/interfaces/checkpoints/checkpoints"><code>Checkpoints</code></a> object lets you set checkpoints on a <a href="https://beta.tinybase.org/api/store/interfaces/store/store"><code>Store</code></a>. Move forward and backward through them to create undo and redo functions.</p><p>In this example, we set a checkpoint, then sell one of the pets. Later, the pet is brought back to the shop, and we go back to that checkpoint to revert the store to its previous state.</p><p>Read more about <a href="https://beta.tinybase.org/api/checkpoints/interfaces/checkpoints/checkpoints"><code>Checkpoints</code></a> in the <a href="https://beta.tinybase.org/guides/relationships-and-checkpoints/using-checkpoints">Using Checkpoints</a> guide.</p></section>
221
+ <section><h2 id="set-checkpoints-for-an-undo-stack">Set checkpoints for an undo stack.</h2><p>A <a href="https://tinybase.org/api/checkpoints/interfaces/checkpoints/checkpoints"><code>Checkpoints</code></a> object lets you set checkpoints on a <a href="https://tinybase.org/api/store/interfaces/store/store"><code>Store</code></a>. Move forward and backward through them to create undo and redo functions.</p><p>In this example, we set a checkpoint, then sell one of the pets. Later, the pet is brought back to the shop, and we go back to that checkpoint to revert the store to its previous state.</p><p>Read more about <a href="https://tinybase.org/api/checkpoints/interfaces/checkpoints/checkpoints"><code>Checkpoints</code></a> in the <a href="https://tinybase.org/guides/relationships-and-checkpoints/using-checkpoints">Using Checkpoints</a> guide.</p></section>
222
222
 
223
223
  ```js
224
224
  const checkpoints = createCheckpoints(store);
@@ -235,4 +235,4 @@ console.log(store.getCell('pets', 'felix', 'sold'));
235
235
  // -> false
236
236
  ```
237
237
 
238
- <section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://beta.tinybase.org/api/store"><code>store</code></a> module alone, you&#x27;ll only add a gzipped <em>3.5kB</em> to your app. You can incrementally add the other modules as you need more functionality, or get it all for <em>7.8kB</em>.</p><p>The <code>ui-react</code> adaptor is just another <em>3.2kB</em>, and everything is fast. Life&#x27;s easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured in the <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/architecture">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>.js.gz</th><th>.js</th><th>debug.js</th><th>.d.ts</th></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/store">store</a></th><td>3.5kB</td><td>7.7kB</td><td>33.1kB</td><td>127.2kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/indexes">indexes</a></th><td>1.9kB</td><td>3.7kB</td><td>16.4kB</td><td>33.9kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/metrics">metrics</a></th><td>1.8kB</td><td>3.6kB</td><td>14.6kB</td><td>29.2kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/relationships">relationships</a></th><td>1.8kB</td><td>3.6kB</td><td>16.6kB</td><td>42.2kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/checkpoints">checkpoints</a></th><td>1.4kB</td><td>2.8kB</td><td>11.2kB</td><td>33.0kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/persisters">persisters</a></th><td>0.8kB</td><td>1.6kB</td><td>5.0kB</td><td>26.8kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/common">common</a></th><td>0.1kB</td><td>0.1kB</td><td>0.1kB</td><td>3.5kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/tinybase">tinybase</a></th><td>7.8kB</td><td>18.4kB</td><td>80.8kB</td><td>0.3kB</td></tr></tbody></table></div><section><h2 id="well-tested-and-documented">Well tested and documented.</h2><p>TinyBase has <em>100.0%</em> test coverage, including the code throughout the documentation - even on this page! The guides, demos, and API examples are designed to make it as easy as possible to get up and running.</p><p>Read more about how TinyBase is tested in the Unit <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/testing">Testing</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>Total</th><th>Tested</th><th>Coverage</th></tr><tr><th class="right">Lines</th><td>1,246</td><td>1,246</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>1,347</td><td>1,347</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>507</td><td>507</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>469</td><td>469</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">2,134</td></tr><tr><th class="right">Assertions</th><td colspan="3">11,006</td></tr></tbody></table></div><hr><p><a id="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><section><h2 id="follow">Follow</h2><ul><li>News and updates on <a href="https://twitter.com/tinybasejs">Twitter</a> and <a href="https://facebook.com/tinybasejs">Facebook</a>.</li><li><a href="https://beta.tinybase.org/guides/releases/">Release notes</a> for each version.</li><li>Packages on <a href="https://www.npmjs.com/package/tinybase/v/2.1.0-beta.0">NPM</a>.</li><li><a href="https://github.com/tinyplex/tinybase/issues">Issues</a> on <a href="https://github.com/tinyplex/tinybase">GitHub</a>.</li></ul></section><section><h2 id="about">About</h2><p>Building TinyBase was an interesting exercise in API design, minification, and documentation. It could not have been built without these great <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/credits/#giants">projects</a> and <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/credits/#and-friends">friends</a>, and we hope you enjoy using it!</p></section>
238
+ <section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://tinybase.org/api/store"><code>store</code></a> module alone, you&#x27;ll only add a gzipped <em>3.5kB</em> to your app. You can incrementally add the other modules as you need more functionality, or get it all for <em>7.8kB</em>.</p><p>The <code>ui-react</code> adaptor is just another <em>3.2kB</em>, and everything is fast. Life&#x27;s easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured in the <a href="https://tinybase.org/guides/how-tinybase-is-built/architecture">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>.js.gz</th><th>.js</th><th>debug.js</th><th>.d.ts</th></tr><tr><th class="right"><a href="https://tinybase.org/api/store">store</a></th><td>3.5kB</td><td>7.7kB</td><td>33.1kB</td><td>127.2kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/metrics">metrics</a></th><td>1.8kB</td><td>3.6kB</td><td>14.6kB</td><td>29.2kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/indexes">indexes</a></th><td>1.9kB</td><td>3.7kB</td><td>16.4kB</td><td>33.9kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/relationships">relationships</a></th><td>1.8kB</td><td>3.6kB</td><td>16.6kB</td><td>42.2kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/queries">queries</a></th><td>2.6kB</td><td>5.5kB</td><td>24.9kB</td><td>106.8kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/checkpoints">checkpoints</a></th><td>1.4kB</td><td>2.8kB</td><td>11.2kB</td><td>33.0kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/persisters">persisters</a></th><td>0.8kB</td><td>1.6kB</td><td>5.0kB</td><td>26.8kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/common">common</a></th><td>0.1kB</td><td>0.1kB</td><td>0.1kB</td><td>3.5kB</td></tr><tr><th class="right">tinybase (all)</th><td>7.8kB</td><td>18.4kB</td><td>80.8kB</td><td>0.3kB</td></tr></tbody></table></div><section><h2 id="well-tested-and-documented">Well tested and documented.</h2><p>TinyBase has <em>100.0%</em> test coverage, including the code throughout the documentation - even on this page! The guides, demos, and API examples are designed to make it as easy as possible to get up and running.</p><p>Read more about how TinyBase is tested in the Unit <a href="https://tinybase.org/guides/how-tinybase-is-built/testing">Testing</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>Total</th><th>Tested</th><th>Coverage</th></tr><tr><th class="right">Lines</th><td>1,246</td><td>1,246</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>1,347</td><td>1,347</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>507</td><td>507</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>469</td><td>469</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">2,134</td></tr><tr><th class="right">Assertions</th><td colspan="3">11,009</td></tr></tbody></table></div><hr><p><a id="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><section><h2 id="follow">Follow</h2><ul><li>News and updates on <a href="https://twitter.com/tinybasejs">Twitter</a> and <a href="https://facebook.com/tinybasejs">Facebook</a>.</li><li><a href="https://tinybase.org/guides/releases/">Release notes</a> for each version.</li><li>Packages on <a href="https://www.npmjs.com/package/tinybase/v/2.1.0">NPM</a>.</li><li><a href="https://github.com/tinyplex/tinybase/issues">Issues</a> on <a href="https://github.com/tinyplex/tinybase">GitHub</a>.</li></ul></section><section><h2 id="about">About</h2><p>Building TinyBase was an interesting exercise in API design, minification, and documentation. It could not have been built without these great <a href="https://tinybase.org/guides/how-tinybase-is-built/credits/#giants">projects</a> and <a href="https://tinybase.org/guides/how-tinybase-is-built/credits/#and-friends">friends</a>, and we hope you enjoy using it!</p></section>