tinybase 3.1.0-beta.2 → 3.1.0-beta.4
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.
- package/bin/cli.js +1 -1
- package/lib/checkpoints.d.ts +13 -11
- package/lib/cjs/checkpoints.d.ts +13 -11
- package/lib/cjs/indexes.d.ts +15 -7
- package/lib/cjs/metrics.d.ts +9 -7
- package/lib/cjs/persisters.d.ts +30 -24
- package/lib/cjs/queries.d.ts +10 -6
- package/lib/cjs/relationships.d.ts +15 -7
- package/lib/cjs/store.d.ts +1190 -291
- package/lib/cjs/tools.cjs +1 -1
- package/lib/cjs/tools.cjs.gz +0 -0
- package/lib/cjs/tools.d.ts +31 -31
- package/lib/cjs-es6/checkpoints.d.ts +13 -11
- package/lib/cjs-es6/indexes.d.ts +15 -7
- package/lib/cjs-es6/metrics.d.ts +9 -7
- package/lib/cjs-es6/persisters.d.ts +30 -24
- package/lib/cjs-es6/queries.d.ts +10 -6
- package/lib/cjs-es6/relationships.d.ts +15 -7
- package/lib/cjs-es6/store.d.ts +1190 -291
- package/lib/cjs-es6/tools.cjs +1 -1
- package/lib/cjs-es6/tools.cjs.gz +0 -0
- package/lib/cjs-es6/tools.d.ts +31 -31
- package/lib/debug/checkpoints.d.ts +13 -11
- package/lib/debug/indexes.d.ts +15 -7
- package/lib/debug/metrics.d.ts +9 -7
- package/lib/debug/persisters.d.ts +30 -24
- package/lib/debug/queries.d.ts +10 -6
- package/lib/debug/relationships.d.ts +15 -7
- package/lib/debug/store.d.ts +1190 -291
- package/lib/debug/tools.d.ts +31 -31
- package/lib/debug/tools.js +692 -484
- package/lib/es6/checkpoints.d.ts +13 -11
- package/lib/es6/indexes.d.ts +15 -7
- package/lib/es6/metrics.d.ts +9 -7
- package/lib/es6/persisters.d.ts +30 -24
- package/lib/es6/queries.d.ts +10 -6
- package/lib/es6/relationships.d.ts +15 -7
- package/lib/es6/store.d.ts +1190 -291
- package/lib/es6/tools.d.ts +31 -31
- package/lib/es6/tools.js +1 -1
- package/lib/es6/tools.js.gz +0 -0
- package/lib/indexes.d.ts +15 -7
- package/lib/metrics.d.ts +9 -7
- package/lib/persisters.d.ts +30 -24
- package/lib/queries.d.ts +10 -6
- package/lib/relationships.d.ts +15 -7
- package/lib/store.d.ts +1190 -291
- package/lib/tools.d.ts +31 -31
- package/lib/tools.js +1 -1
- package/lib/tools.js.gz +0 -0
- package/lib/umd/checkpoints.d.ts +13 -11
- package/lib/umd/indexes.d.ts +15 -7
- package/lib/umd/metrics.d.ts +9 -7
- package/lib/umd/persisters.d.ts +30 -24
- package/lib/umd/queries.d.ts +10 -6
- package/lib/umd/relationships.d.ts +15 -7
- package/lib/umd/store.d.ts +1190 -291
- package/lib/umd/tools.d.ts +31 -31
- package/lib/umd/tools.js +1 -1
- package/lib/umd/tools.js.gz +0 -0
- package/lib/umd-es6/checkpoints.d.ts +13 -11
- package/lib/umd-es6/indexes.d.ts +15 -7
- package/lib/umd-es6/metrics.d.ts +9 -7
- package/lib/umd-es6/persisters.d.ts +30 -24
- package/lib/umd-es6/queries.d.ts +10 -6
- package/lib/umd-es6/relationships.d.ts +15 -7
- package/lib/umd-es6/store.d.ts +1190 -291
- package/lib/umd-es6/tools.d.ts +31 -31
- package/lib/umd-es6/tools.js +1 -1
- package/lib/umd-es6/tools.js.gz +0 -0
- package/package.json +23 -23
- package/readme.md +1 -1
package/lib/debug/tools.d.ts
CHANGED
|
@@ -10,7 +10,13 @@
|
|
|
10
10
|
* @since v2.2.0
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
NoSchemas,
|
|
15
|
+
OptionalSchemas,
|
|
16
|
+
Store,
|
|
17
|
+
TablesSchema,
|
|
18
|
+
ValuesSchema,
|
|
19
|
+
} from './store.d';
|
|
14
20
|
import {Id} from './common.d';
|
|
15
21
|
|
|
16
22
|
/**
|
|
@@ -109,7 +115,7 @@ export type StoreStatsRowDetail = {
|
|
|
109
115
|
* @category Tools
|
|
110
116
|
* @since v2.2.0
|
|
111
117
|
*/
|
|
112
|
-
export interface Tools {
|
|
118
|
+
export interface Tools<Schemas extends OptionalSchemas = NoSchemas> {
|
|
113
119
|
/* eslint-disable max-len */
|
|
114
120
|
/**
|
|
115
121
|
* The getStoreStats method provides a set of statistics about the Store, and
|
|
@@ -272,9 +278,9 @@ export interface Tools {
|
|
|
272
278
|
getStoreValuesSchema(): ValuesSchema;
|
|
273
279
|
|
|
274
280
|
/**
|
|
275
|
-
* The getStoreApi method returns code-generated
|
|
276
|
-
* describe the schema of a Store and React bindings (since v3.1.0) in an
|
|
277
|
-
* style.
|
|
281
|
+
* The getStoreApi method returns code-generated `.d.ts` and `.ts(x)` files
|
|
282
|
+
* that describe the schema of a Store and React bindings (since v3.1.0) in an
|
|
283
|
+
* ORM style.
|
|
278
284
|
*
|
|
279
285
|
* If the Store does not already have an explicit TablesSchema or ValuesSchema
|
|
280
286
|
* associated with it, the data in the Store will be scanned to attempt to
|
|
@@ -290,12 +296,12 @@ export interface Tools {
|
|
|
290
296
|
* - `[storeName]-ui-react.d.ts`
|
|
291
297
|
* - `[storeName]-ui-react.tsx`
|
|
292
298
|
*
|
|
293
|
-
* Also you should save these alongside each other so that the
|
|
294
|
-
* can import types from the
|
|
299
|
+
* Also you should save these alongside each other so that the `.ts(x)` files
|
|
300
|
+
* can import types from the `.d.ts` files.
|
|
295
301
|
*
|
|
296
|
-
* The
|
|
297
|
-
* main TinyBase Store and React binding files, but provide named types
|
|
298
|
-
* methods that describe the domain of the schema in the
|
|
302
|
+
* The `.d.ts` and `.ts(x)` files that are generated are designed to resemble
|
|
303
|
+
* the main TinyBase Store and React binding files, but provide named types
|
|
304
|
+
* and methods that describe the domain of the schema in the Store.
|
|
299
305
|
*
|
|
300
306
|
* For example, from a Store that has a `pets` Table, you will get methods
|
|
301
307
|
* like `getPetsTable`, types like `PetsRow`, and hooks and components that
|
|
@@ -347,9 +353,7 @@ export interface Tools {
|
|
|
347
353
|
*
|
|
348
354
|
* const dTsLines = dTs.split('\n');
|
|
349
355
|
* console.log(dTsLines[3]);
|
|
350
|
-
* // ->
|
|
351
|
-
* console.log(dTsLines[6]);
|
|
352
|
-
* // -> 'export type PetsRow = {\'price\'?: number;};'
|
|
356
|
+
* // -> `export type Tables = {'pets'?: {[rowId: Id]: {'price'?: number}}};`
|
|
353
357
|
*
|
|
354
358
|
* const tsLines = ts.split('\n');
|
|
355
359
|
* console.log(tsLines[39]);
|
|
@@ -368,9 +372,7 @@ export interface Tools {
|
|
|
368
372
|
*
|
|
369
373
|
* const dTsLines = dTs.split('\n');
|
|
370
374
|
* console.log(dTsLines[3]);
|
|
371
|
-
* // ->
|
|
372
|
-
* console.log(dTsLines[6]);
|
|
373
|
-
* // -> 'export type PetsRow = {\'price\': number;};'
|
|
375
|
+
* // -> `export type Tables = {'pets'?: {[rowId: Id]: {'price': number}}};`
|
|
374
376
|
*
|
|
375
377
|
* const tsLines = ts.split('\n');
|
|
376
378
|
* console.log(tsLines[41]);
|
|
@@ -382,9 +384,9 @@ export interface Tools {
|
|
|
382
384
|
getStoreApi(storeName: string): [string, string, string, string];
|
|
383
385
|
|
|
384
386
|
/**
|
|
385
|
-
* The getPrettyStoreApi method attempts to
|
|
386
|
-
*
|
|
387
|
-
*
|
|
387
|
+
* The getPrettyStoreApi method attempts to return prettified code-generated
|
|
388
|
+
* `.d.ts` and `.ts(x)` files that describe the schema of a Store and React
|
|
389
|
+
* bindings (since v3.1.0) in an ORM style.
|
|
388
390
|
*
|
|
389
391
|
* This is simply a wrapper around the getStoreApi method that attempts to
|
|
390
392
|
* invoke the `prettier` module (which it hopes you have installed) to format
|
|
@@ -403,8 +405,8 @@ export interface Tools {
|
|
|
403
405
|
* - `[storeName]-ui-react.d.ts`
|
|
404
406
|
* - `[storeName]-ui-react.tsx`
|
|
405
407
|
*
|
|
406
|
-
* Also you should save these alongside each other so that the
|
|
407
|
-
* can import types from the
|
|
408
|
+
* Also you should save these alongside each other so that the `.ts(x)` files
|
|
409
|
+
* can import types from the `.d.ts` files.
|
|
408
410
|
*
|
|
409
411
|
* See the documentation for the getStoreApi method for details of the content
|
|
410
412
|
* of the generated files.
|
|
@@ -429,12 +431,10 @@ export interface Tools {
|
|
|
429
431
|
*
|
|
430
432
|
* const dTsLines = dTs.split('\n');
|
|
431
433
|
* console.log(dTsLines[5]);
|
|
432
|
-
* // ->
|
|
433
|
-
* console.log(dTsLines[10]);
|
|
434
|
-
* // -> 'export type PetsRow = {price?: number};'
|
|
434
|
+
* // -> `export type Tables = {pets?: {[rowId: Id]: {price?: number}}};`
|
|
435
435
|
*
|
|
436
436
|
* const tsLines = ts.split('\n');
|
|
437
|
-
* console.log(tsLines[
|
|
437
|
+
* console.log(tsLines[79]);
|
|
438
438
|
* // -> ' hasPetsTable: (): boolean => store.hasTable(PETS),'
|
|
439
439
|
* ```
|
|
440
440
|
* @example
|
|
@@ -452,12 +452,10 @@ export interface Tools {
|
|
|
452
452
|
*
|
|
453
453
|
* const dTsLines = dTs.split('\n');
|
|
454
454
|
* console.log(dTsLines[5]);
|
|
455
|
-
* // -> 'export type
|
|
456
|
-
* console.log(dTsLines[10]);
|
|
457
|
-
* // -> 'export type PetsRow = {price: number};'
|
|
455
|
+
* // -> 'export type Tables = {pets?: {[rowId: Id]: {price: number}}};'
|
|
458
456
|
*
|
|
459
457
|
* const tsLines = ts.split('\n');
|
|
460
|
-
* console.log(tsLines[
|
|
458
|
+
* console.log(tsLines[81]);
|
|
461
459
|
* // -> ' hasPetsTable: (): boolean => store.hasTable(PETS),'
|
|
462
460
|
* ```
|
|
463
461
|
* @category Modelling
|
|
@@ -485,7 +483,7 @@ export interface Tools {
|
|
|
485
483
|
* @category Getter
|
|
486
484
|
* @since v3.0.0
|
|
487
485
|
*/
|
|
488
|
-
getStore(): Store
|
|
486
|
+
getStore(): Store<Schemas>;
|
|
489
487
|
}
|
|
490
488
|
|
|
491
489
|
/* eslint-disable max-len */
|
|
@@ -532,5 +530,7 @@ export interface Tools {
|
|
|
532
530
|
* @category Creation
|
|
533
531
|
* @since v2.2.0
|
|
534
532
|
*/
|
|
535
|
-
export function createTools
|
|
533
|
+
export function createTools<Schemas extends OptionalSchemas>(
|
|
534
|
+
store: Store<Schemas>,
|
|
535
|
+
): Tools<Schemas>;
|
|
536
536
|
/* eslint-enable max-len */
|