tinybase 3.1.0-beta.4 → 3.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.
- package/lib/debug/ui-react.js +2 -2
- package/lib/{checkpoints.d.ts → types/checkpoints.d.ts} +13 -13
- package/lib/{debug → types}/indexes.d.ts +10 -16
- package/lib/{debug → types}/metrics.d.ts +49 -50
- package/lib/{debug → types}/persisters.d.ts +26 -30
- package/lib/{cjs-es6 → types}/queries.d.ts +474 -309
- package/lib/{debug → types}/relationships.d.ts +11 -17
- package/lib/{debug → types}/store.d.ts +180 -1038
- package/lib/types/tinybase.d.ts +14 -0
- package/lib/{debug → types}/tools.d.ts +12 -12
- package/lib/{debug → types}/ui-react.d.ts +11 -5
- package/lib/{cjs-es6 → types/with-schemas}/checkpoints.d.ts +93 -7
- package/lib/{cjs → types/with-schemas}/indexes.d.ts +136 -18
- package/lib/types/with-schemas/internal/queries.d.ts +15 -0
- package/lib/types/with-schemas/internal/store.d.ts +101 -0
- package/lib/types/with-schemas/internal/ui-react.d.ts +776 -0
- package/lib/{cjs → types/with-schemas}/metrics.d.ts +115 -50
- package/lib/{cjs → types/with-schemas}/persisters.d.ts +102 -4
- package/lib/{debug → types/with-schemas}/queries.d.ts +865 -346
- package/lib/{cjs → types/with-schemas}/relationships.d.ts +151 -20
- package/lib/{cjs-es6 → types/with-schemas}/store.d.ts +1082 -801
- package/lib/types/with-schemas/tinybase.d.ts +14 -0
- package/lib/{cjs-es6 → types/with-schemas}/tools.d.ts +21 -10
- package/lib/{cjs-es6 → types/with-schemas}/ui-react.d.ts +1871 -1314
- package/package.json +145 -29
- package/readme.md +14 -14
- package/lib/cjs/checkpoints.d.ts +0 -961
- package/lib/cjs/queries.d.ts +0 -3028
- package/lib/cjs/store.d.ts +0 -6143
- package/lib/cjs/tinybase.d.ts +0 -14
- package/lib/cjs/tools.d.ts +0 -536
- package/lib/cjs/ui-react.d.ts +0 -10921
- package/lib/cjs-es6/indexes.d.ts +0 -974
- package/lib/cjs-es6/metrics.d.ts +0 -829
- package/lib/cjs-es6/persisters.d.ts +0 -733
- package/lib/cjs-es6/relationships.d.ts +0 -1209
- package/lib/cjs-es6/tinybase.d.ts +0 -14
- package/lib/common.d.ts +0 -115
- package/lib/debug/checkpoints.d.ts +0 -961
- package/lib/debug/common.d.ts +0 -115
- package/lib/debug/tinybase.d.ts +0 -14
- package/lib/es6/checkpoints.d.ts +0 -961
- package/lib/es6/common.d.ts +0 -115
- package/lib/es6/indexes.d.ts +0 -974
- package/lib/es6/metrics.d.ts +0 -829
- package/lib/es6/persisters.d.ts +0 -733
- package/lib/es6/queries.d.ts +0 -3028
- package/lib/es6/relationships.d.ts +0 -1209
- package/lib/es6/store.d.ts +0 -6143
- package/lib/es6/tinybase.d.ts +0 -14
- package/lib/es6/tools.d.ts +0 -536
- package/lib/es6/ui-react.d.ts +0 -10921
- package/lib/indexes.d.ts +0 -974
- package/lib/metrics.d.ts +0 -829
- package/lib/persisters.d.ts +0 -733
- package/lib/queries.d.ts +0 -3028
- package/lib/relationships.d.ts +0 -1209
- package/lib/store.d.ts +0 -6143
- package/lib/tinybase.d.ts +0 -14
- package/lib/tools.d.ts +0 -536
- package/lib/ui-react.d.ts +0 -10921
- package/lib/umd/checkpoints.d.ts +0 -961
- package/lib/umd/common.d.ts +0 -115
- package/lib/umd/indexes.d.ts +0 -974
- package/lib/umd/metrics.d.ts +0 -829
- package/lib/umd/persisters.d.ts +0 -733
- package/lib/umd/queries.d.ts +0 -3028
- package/lib/umd/relationships.d.ts +0 -1209
- package/lib/umd/store.d.ts +0 -6143
- package/lib/umd/tinybase.d.ts +0 -14
- package/lib/umd/tools.d.ts +0 -536
- package/lib/umd/ui-react.d.ts +0 -10921
- package/lib/umd-es6/checkpoints.d.ts +0 -961
- package/lib/umd-es6/common.d.ts +0 -115
- package/lib/umd-es6/indexes.d.ts +0 -974
- package/lib/umd-es6/metrics.d.ts +0 -829
- package/lib/umd-es6/persisters.d.ts +0 -733
- package/lib/umd-es6/queries.d.ts +0 -3028
- package/lib/umd-es6/relationships.d.ts +0 -1209
- package/lib/umd-es6/store.d.ts +0 -6143
- package/lib/umd-es6/tinybase.d.ts +0 -14
- package/lib/umd-es6/tools.d.ts +0 -536
- package/lib/umd-es6/ui-react.d.ts +0 -10921
- /package/lib/{cjs-es6 → types}/common.d.ts +0 -0
- /package/lib/{cjs → types/with-schemas}/common.d.ts +0 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Cell,
|
|
3
|
+
OptionalTablesSchema,
|
|
4
|
+
OptionalValuesSchema,
|
|
5
|
+
Value,
|
|
6
|
+
} from '../store';
|
|
7
|
+
import {Id} from '../common';
|
|
8
|
+
|
|
9
|
+
export type TableIdFromSchema<Schema extends OptionalTablesSchema> = AsId<
|
|
10
|
+
keyof Schema
|
|
11
|
+
>;
|
|
12
|
+
|
|
13
|
+
export type CellIdFromSchema<
|
|
14
|
+
Schema extends OptionalTablesSchema,
|
|
15
|
+
TableId extends TableIdFromSchema<Schema>,
|
|
16
|
+
> = AsId<keyof Schema[TableId]>;
|
|
17
|
+
|
|
18
|
+
export type DefaultCellIdFromSchema<
|
|
19
|
+
Schema extends OptionalTablesSchema,
|
|
20
|
+
TableId extends TableIdFromSchema<Schema>,
|
|
21
|
+
IsDefaulted extends boolean = true,
|
|
22
|
+
> = AsId<
|
|
23
|
+
{
|
|
24
|
+
[CellId in CellIdFromSchema<Schema, TableId>]: CellIsDefaultedFromSchema<
|
|
25
|
+
Schema,
|
|
26
|
+
TableId,
|
|
27
|
+
CellId,
|
|
28
|
+
IsDefaulted extends true ? CellId : never,
|
|
29
|
+
IsDefaulted extends true ? never : CellId
|
|
30
|
+
>;
|
|
31
|
+
}[CellIdFromSchema<Schema, TableId>]
|
|
32
|
+
>;
|
|
33
|
+
|
|
34
|
+
export type AllCellIdFromSchema<
|
|
35
|
+
Schema extends OptionalTablesSchema,
|
|
36
|
+
TableId extends TableIdFromSchema<Schema> = TableIdFromSchema<Schema>,
|
|
37
|
+
> = TableId extends TableIdFromSchema<Schema>
|
|
38
|
+
? CellIdFromSchema<Schema, TableId>
|
|
39
|
+
: never;
|
|
40
|
+
|
|
41
|
+
export type CellIsDefaultedFromSchema<
|
|
42
|
+
Schema extends OptionalTablesSchema,
|
|
43
|
+
TableId extends TableIdFromSchema<Schema>,
|
|
44
|
+
CellId extends CellIdFromSchema<Schema, TableId>,
|
|
45
|
+
Then,
|
|
46
|
+
Else,
|
|
47
|
+
> = Schema[TableId][CellId] extends {
|
|
48
|
+
default: string | number | boolean;
|
|
49
|
+
}
|
|
50
|
+
? Then
|
|
51
|
+
: Else;
|
|
52
|
+
|
|
53
|
+
export type DefaultedCellFromSchema<
|
|
54
|
+
Schema extends OptionalTablesSchema,
|
|
55
|
+
TableId extends TableIdFromSchema<Schema>,
|
|
56
|
+
CellId extends CellIdFromSchema<Schema, TableId>,
|
|
57
|
+
> =
|
|
58
|
+
| Cell<Schema, TableId, CellId>
|
|
59
|
+
| CellIsDefaultedFromSchema<Schema, TableId, CellId, never, undefined>;
|
|
60
|
+
|
|
61
|
+
export type ValueIdFromSchema<Schema extends OptionalValuesSchema> = AsId<
|
|
62
|
+
keyof Schema
|
|
63
|
+
>;
|
|
64
|
+
|
|
65
|
+
export type DefaultValueIdFromSchema<
|
|
66
|
+
Schema extends OptionalValuesSchema,
|
|
67
|
+
IsDefaulted extends boolean = true,
|
|
68
|
+
> = {
|
|
69
|
+
[ValueId in ValueIdFromSchema<Schema>]: ValueIsDefaultedFromSchema<
|
|
70
|
+
Schema,
|
|
71
|
+
ValueId,
|
|
72
|
+
IsDefaulted extends true ? ValueId : never,
|
|
73
|
+
IsDefaulted extends true ? never : ValueId
|
|
74
|
+
>;
|
|
75
|
+
}[ValueIdFromSchema<Schema>];
|
|
76
|
+
|
|
77
|
+
export type ValueIsDefaultedFromSchema<
|
|
78
|
+
Schema extends OptionalValuesSchema,
|
|
79
|
+
ValueId extends ValueIdFromSchema<Schema>,
|
|
80
|
+
Then,
|
|
81
|
+
Else,
|
|
82
|
+
> = Schema[ValueId] extends {
|
|
83
|
+
default: string | number | boolean;
|
|
84
|
+
}
|
|
85
|
+
? Then
|
|
86
|
+
: Else;
|
|
87
|
+
|
|
88
|
+
export type DefaultedValueFromSchema<
|
|
89
|
+
Schema extends OptionalValuesSchema,
|
|
90
|
+
ValueId extends ValueIdFromSchema<Schema>,
|
|
91
|
+
> =
|
|
92
|
+
| Value<Schema, ValueId>
|
|
93
|
+
| ValueIsDefaultedFromSchema<Schema, ValueId, never, undefined>;
|
|
94
|
+
|
|
95
|
+
export type AsId<Key> = Exclude<Key & Id, number>;
|
|
96
|
+
|
|
97
|
+
export type Truncate<Params> = Params extends [...infer ShorterParams, any]
|
|
98
|
+
? [...ShorterParams]
|
|
99
|
+
: never;
|
|
100
|
+
|
|
101
|
+
export type NoInfer<Type> = [Type][Type extends any ? 0 : never];
|