@livestore/common 0.0.48-dev.0 → 0.0.48-dev.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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/__tests__/fixture.d.ts +8 -2
- package/dist/__tests__/fixture.d.ts.map +1 -1
- package/dist/derived-mutations.d.ts +22 -26
- package/dist/derived-mutations.d.ts.map +1 -1
- package/dist/derived-mutations.js +5 -4
- package/dist/derived-mutations.js.map +1 -1
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +2 -1
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/mutations.d.ts +12 -1
- package/dist/schema/mutations.d.ts.map +1 -1
- package/dist/schema/mutations.js +2 -1
- package/dist/schema/mutations.js.map +1 -1
- package/dist/schema/system-tables.d.ts +207 -232
- package/dist/schema/system-tables.d.ts.map +1 -1
- package/dist/schema/system-tables.js +1 -1
- package/dist/schema/system-tables.js.map +1 -1
- package/dist/schema/table-def.d.ts +41 -7
- package/dist/schema/table-def.d.ts.map +1 -1
- package/dist/schema/table-def.js +8 -2
- package/dist/schema/table-def.js.map +1 -1
- package/dist/schema-management/common.d.ts +8 -0
- package/dist/schema-management/common.d.ts.map +1 -1
- package/dist/schema-management/migrations.d.ts +3 -0
- package/dist/schema-management/migrations.d.ts.map +1 -1
- package/dist/schema-management/migrations.js +24 -3
- package/dist/schema-management/migrations.js.map +1 -1
- package/dist/schema-management/validate-mutation-defs.d.ts +1 -11
- package/dist/schema-management/validate-mutation-defs.d.ts.map +1 -1
- package/dist/schema-management/validate-mutation-defs.js +0 -26
- package/dist/schema-management/validate-mutation-defs.js.map +1 -1
- package/dist/sync/sync.d.ts +4 -0
- package/dist/sync/sync.d.ts.map +1 -1
- package/dist/sync/sync.js +6 -2
- package/dist/sync/sync.js.map +1 -1
- package/package.json +3 -3
- package/src/derived-mutations.ts +55 -15
- package/src/schema/index.ts +2 -2
- package/src/schema/mutations.ts +13 -0
- package/src/schema/system-tables.ts +1 -1
- package/src/schema/table-def.ts +44 -8
- package/src/schema-management/common.ts +11 -0
- package/src/schema-management/migrations.ts +42 -4
- package/src/schema-management/validate-mutation-defs.ts +1 -49
- package/src/sync/sync.ts +6 -2
|
@@ -2,247 +2,222 @@ import { Schema } from '@livestore/utils/effect';
|
|
|
2
2
|
import { SqliteDsl } from 'effect-db-schema';
|
|
3
3
|
import type { FromTable } from './table-def.js';
|
|
4
4
|
export declare const SCHEMA_META_TABLE = "__livestore_schema";
|
|
5
|
-
export declare const schemaMetaTable: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
5
|
+
export declare const schemaMetaTable: import("./table-def.js").TableDef<SqliteDsl.TableDefinition<"__livestore_schema", {
|
|
6
|
+
tableName: {
|
|
7
|
+
columnType: "text";
|
|
8
|
+
schema: Schema.Schema<string, string, never>;
|
|
9
|
+
default: import("effect/Option").None<never>;
|
|
10
|
+
nullable: false;
|
|
11
|
+
primaryKey: true;
|
|
12
|
+
};
|
|
13
|
+
schemaHash: {
|
|
14
|
+
columnType: "integer";
|
|
15
|
+
schema: Schema.Schema<number, number, never>;
|
|
16
|
+
default: import("effect/Option").None<never>;
|
|
17
|
+
nullable: false;
|
|
18
|
+
primaryKey: false;
|
|
19
|
+
};
|
|
20
|
+
updatedAt: {
|
|
21
|
+
columnType: "text";
|
|
22
|
+
schema: Schema.Schema<string, string, never>;
|
|
23
|
+
default: import("effect/Option").None<never>;
|
|
24
|
+
nullable: false;
|
|
25
|
+
primaryKey: false;
|
|
26
|
+
};
|
|
27
|
+
}>, false, {
|
|
28
|
+
isSingleton: false;
|
|
29
|
+
dynamicRegistration: false;
|
|
30
|
+
disableAutomaticIdColumn: true;
|
|
31
|
+
deriveMutations: never;
|
|
29
32
|
isSingleColumn: false;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
readonly schemaHash: number;
|
|
40
|
-
readonly updatedAt: string;
|
|
41
|
-
}, {
|
|
42
|
-
readonly tableName: string;
|
|
43
|
-
readonly schemaHash: number;
|
|
44
|
-
readonly updatedAt: string;
|
|
45
|
-
}, never>;
|
|
46
|
-
};
|
|
33
|
+
}, Schema.Schema<{
|
|
34
|
+
readonly tableName: string;
|
|
35
|
+
readonly schemaHash: number;
|
|
36
|
+
readonly updatedAt: string;
|
|
37
|
+
}, {
|
|
38
|
+
readonly tableName: string;
|
|
39
|
+
readonly schemaHash: number;
|
|
40
|
+
readonly updatedAt: string;
|
|
41
|
+
}, never>>;
|
|
47
42
|
export type SchemaMetaRow = FromTable.RowDecoded<typeof schemaMetaTable>;
|
|
48
43
|
export declare const SCHEMA_MUTATIONS_META_TABLE = "__livestore_schema_mutations";
|
|
49
|
-
export declare const schemaMutationsMetaTable: {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
44
|
+
export declare const schemaMutationsMetaTable: import("./table-def.js").TableDef<SqliteDsl.TableDefinition<"__livestore_schema_mutations", {
|
|
45
|
+
mutationName: {
|
|
46
|
+
columnType: "text";
|
|
47
|
+
schema: Schema.Schema<string, string, never>;
|
|
48
|
+
default: import("effect/Option").None<never>;
|
|
49
|
+
nullable: false;
|
|
50
|
+
primaryKey: true;
|
|
51
|
+
};
|
|
52
|
+
schemaHash: {
|
|
53
|
+
columnType: "integer";
|
|
54
|
+
schema: Schema.Schema<number, number, never>;
|
|
55
|
+
default: import("effect/Option").None<never>;
|
|
56
|
+
nullable: false;
|
|
57
|
+
primaryKey: false;
|
|
58
|
+
};
|
|
59
|
+
updatedAt: {
|
|
60
|
+
columnType: "text";
|
|
61
|
+
schema: Schema.Schema<string, string, never>;
|
|
62
|
+
default: import("effect/Option").None<never>;
|
|
63
|
+
nullable: false;
|
|
64
|
+
primaryKey: false;
|
|
65
|
+
};
|
|
66
|
+
}>, false, {
|
|
67
|
+
isSingleton: false;
|
|
68
|
+
dynamicRegistration: false;
|
|
69
|
+
disableAutomaticIdColumn: true;
|
|
70
|
+
deriveMutations: never;
|
|
73
71
|
isSingleColumn: false;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
readonly schemaHash: number;
|
|
84
|
-
readonly updatedAt: string;
|
|
85
|
-
}, {
|
|
86
|
-
readonly mutationName: string;
|
|
87
|
-
readonly schemaHash: number;
|
|
88
|
-
readonly updatedAt: string;
|
|
89
|
-
}, never>;
|
|
90
|
-
};
|
|
72
|
+
}, Schema.Schema<{
|
|
73
|
+
readonly mutationName: string;
|
|
74
|
+
readonly schemaHash: number;
|
|
75
|
+
readonly updatedAt: string;
|
|
76
|
+
}, {
|
|
77
|
+
readonly mutationName: string;
|
|
78
|
+
readonly schemaHash: number;
|
|
79
|
+
readonly updatedAt: string;
|
|
80
|
+
}, never>>;
|
|
91
81
|
export type SchemaMutationsMetaRow = FromTable.RowDecoded<typeof schemaMutationsMetaTable>;
|
|
92
|
-
export declare const systemTables: ({
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
82
|
+
export declare const systemTables: (import("./table-def.js").TableDef<SqliteDsl.TableDefinition<"__livestore_schema", {
|
|
83
|
+
tableName: {
|
|
84
|
+
columnType: "text";
|
|
85
|
+
schema: Schema.Schema<string, string, never>;
|
|
86
|
+
default: import("effect/Option").None<never>;
|
|
87
|
+
nullable: false;
|
|
88
|
+
primaryKey: true;
|
|
89
|
+
};
|
|
90
|
+
schemaHash: {
|
|
91
|
+
columnType: "integer";
|
|
92
|
+
schema: Schema.Schema<number, number, never>;
|
|
93
|
+
default: import("effect/Option").None<never>;
|
|
94
|
+
nullable: false;
|
|
95
|
+
primaryKey: false;
|
|
96
|
+
};
|
|
97
|
+
updatedAt: {
|
|
98
|
+
columnType: "text";
|
|
99
|
+
schema: Schema.Schema<string, string, never>;
|
|
100
|
+
default: import("effect/Option").None<never>;
|
|
101
|
+
nullable: false;
|
|
102
|
+
primaryKey: false;
|
|
103
|
+
};
|
|
104
|
+
}>, false, {
|
|
105
|
+
isSingleton: false;
|
|
106
|
+
dynamicRegistration: false;
|
|
107
|
+
disableAutomaticIdColumn: true;
|
|
108
|
+
deriveMutations: never;
|
|
116
109
|
isSingleColumn: false;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
default: import("effect/Option").None<never>;
|
|
153
|
-
nullable: false;
|
|
154
|
-
primaryKey: false;
|
|
155
|
-
};
|
|
156
|
-
}>;
|
|
110
|
+
}, Schema.Schema<{
|
|
111
|
+
readonly tableName: string;
|
|
112
|
+
readonly schemaHash: number;
|
|
113
|
+
readonly updatedAt: string;
|
|
114
|
+
}, {
|
|
115
|
+
readonly tableName: string;
|
|
116
|
+
readonly schemaHash: number;
|
|
117
|
+
readonly updatedAt: string;
|
|
118
|
+
}, never>> | import("./table-def.js").TableDef<SqliteDsl.TableDefinition<"__livestore_schema_mutations", {
|
|
119
|
+
mutationName: {
|
|
120
|
+
columnType: "text";
|
|
121
|
+
schema: Schema.Schema<string, string, never>;
|
|
122
|
+
default: import("effect/Option").None<never>;
|
|
123
|
+
nullable: false;
|
|
124
|
+
primaryKey: true;
|
|
125
|
+
};
|
|
126
|
+
schemaHash: {
|
|
127
|
+
columnType: "integer";
|
|
128
|
+
schema: Schema.Schema<number, number, never>;
|
|
129
|
+
default: import("effect/Option").None<never>;
|
|
130
|
+
nullable: false;
|
|
131
|
+
primaryKey: false;
|
|
132
|
+
};
|
|
133
|
+
updatedAt: {
|
|
134
|
+
columnType: "text";
|
|
135
|
+
schema: Schema.Schema<string, string, never>;
|
|
136
|
+
default: import("effect/Option").None<never>;
|
|
137
|
+
nullable: false;
|
|
138
|
+
primaryKey: false;
|
|
139
|
+
};
|
|
140
|
+
}>, false, {
|
|
141
|
+
isSingleton: false;
|
|
142
|
+
dynamicRegistration: false;
|
|
143
|
+
disableAutomaticIdColumn: true;
|
|
144
|
+
deriveMutations: never;
|
|
157
145
|
isSingleColumn: false;
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
readonly updatedAt: string;
|
|
169
|
-
}, {
|
|
170
|
-
readonly mutationName: string;
|
|
171
|
-
readonly schemaHash: number;
|
|
172
|
-
readonly updatedAt: string;
|
|
173
|
-
}, never>;
|
|
174
|
-
})[];
|
|
175
|
-
export declare const SyncStatus: Schema.Literal<["synced", "pending", "error"]>;
|
|
146
|
+
}, Schema.Schema<{
|
|
147
|
+
readonly mutationName: string;
|
|
148
|
+
readonly schemaHash: number;
|
|
149
|
+
readonly updatedAt: string;
|
|
150
|
+
}, {
|
|
151
|
+
readonly mutationName: string;
|
|
152
|
+
readonly schemaHash: number;
|
|
153
|
+
readonly updatedAt: string;
|
|
154
|
+
}, never>>)[];
|
|
155
|
+
export declare const SyncStatus: Schema.Literal<["synced", "pending", "error", "localOnly"]>;
|
|
176
156
|
export type SyncStatus = typeof SyncStatus.Type;
|
|
177
157
|
export declare const MUTATION_LOG_META_TABLE = "mutation_log";
|
|
178
|
-
export declare const mutationLogMetaTable: {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
158
|
+
export declare const mutationLogMetaTable: import("./table-def.js").TableDef<SqliteDsl.TableDefinition<"mutation_log", {
|
|
159
|
+
id: {
|
|
160
|
+
columnType: "text";
|
|
161
|
+
schema: Schema.Schema<string, string, never>;
|
|
162
|
+
default: import("effect/Option").None<never>;
|
|
163
|
+
nullable: false;
|
|
164
|
+
primaryKey: true;
|
|
165
|
+
};
|
|
166
|
+
mutation: {
|
|
167
|
+
columnType: "text";
|
|
168
|
+
schema: Schema.Schema<string, string, never>;
|
|
169
|
+
default: import("effect/Option").None<never>;
|
|
170
|
+
nullable: false;
|
|
171
|
+
primaryKey: false;
|
|
172
|
+
};
|
|
173
|
+
argsJson: {
|
|
174
|
+
columnType: "text";
|
|
175
|
+
schema: Schema.Schema<any, string, never>;
|
|
176
|
+
default: import("effect/Option").None<never>;
|
|
177
|
+
nullable: false;
|
|
178
|
+
primaryKey: false;
|
|
179
|
+
};
|
|
180
|
+
schemaHash: {
|
|
181
|
+
columnType: "integer";
|
|
182
|
+
schema: Schema.Schema<number, number, never>;
|
|
183
|
+
default: import("effect/Option").None<never>;
|
|
184
|
+
nullable: false;
|
|
185
|
+
primaryKey: false;
|
|
186
|
+
};
|
|
187
|
+
createdAt: {
|
|
188
|
+
columnType: "text";
|
|
189
|
+
schema: Schema.Schema<string, string, never>;
|
|
190
|
+
default: import("effect/Option").None<never>;
|
|
191
|
+
nullable: false;
|
|
192
|
+
primaryKey: false;
|
|
193
|
+
};
|
|
194
|
+
syncStatus: {
|
|
195
|
+
columnType: "text";
|
|
196
|
+
schema: Schema.Schema<"localOnly" | "synced" | "pending" | "error", "localOnly" | "synced" | "pending" | "error", never>;
|
|
197
|
+
default: import("effect/Option").None<never>;
|
|
198
|
+
nullable: false;
|
|
199
|
+
primaryKey: false;
|
|
200
|
+
};
|
|
201
|
+
}>, false, {
|
|
202
|
+
isSingleton: false;
|
|
203
|
+
dynamicRegistration: false;
|
|
204
|
+
disableAutomaticIdColumn: true;
|
|
205
|
+
deriveMutations: never;
|
|
223
206
|
isSingleColumn: false;
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
readonly id: string;
|
|
240
|
-
readonly mutation: string;
|
|
241
|
-
readonly argsJson: string;
|
|
242
|
-
readonly schemaHash: number;
|
|
243
|
-
readonly createdAt: string;
|
|
244
|
-
readonly syncStatus: "synced" | "pending" | "error";
|
|
245
|
-
}, never>;
|
|
246
|
-
};
|
|
207
|
+
}, Schema.Schema<{
|
|
208
|
+
readonly id: string;
|
|
209
|
+
readonly mutation: string;
|
|
210
|
+
readonly argsJson: any;
|
|
211
|
+
readonly schemaHash: number;
|
|
212
|
+
readonly createdAt: string;
|
|
213
|
+
readonly syncStatus: "localOnly" | "synced" | "pending" | "error";
|
|
214
|
+
}, {
|
|
215
|
+
readonly id: string;
|
|
216
|
+
readonly mutation: string;
|
|
217
|
+
readonly argsJson: string;
|
|
218
|
+
readonly schemaHash: number;
|
|
219
|
+
readonly createdAt: string;
|
|
220
|
+
readonly syncStatus: "localOnly" | "synced" | "pending" | "error";
|
|
221
|
+
}, never>>;
|
|
247
222
|
export type MutationLogMetaRow = FromTable.RowDecoded<typeof mutationLogMetaTable>;
|
|
248
223
|
//# sourceMappingURL=system-tables.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-tables.d.ts","sourceRoot":"","sources":["../../src/schema/system-tables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAChD,OAAO,EAAiC,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAE3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAK/C,eAAO,MAAM,iBAAiB,uBAAuB,CAAA;AAErD,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"system-tables.d.ts","sourceRoot":"","sources":["../../src/schema/system-tables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAChD,OAAO,EAAiC,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAE3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAK/C,eAAO,MAAM,iBAAiB,uBAAuB,CAAA;AAErD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAS3B,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,SAAS,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,CAAA;AAExE,eAAO,MAAM,2BAA2B,iCAAiC,CAAA;AAEzE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UASpC,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,SAAS,CAAC,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAE1F,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAA8C,CAAA;AAIvE,eAAO,MAAM,UAAU,6DAA4D,CAAA;AACnF,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,IAAI,CAAA;AAE/C,eAAO,MAAM,uBAAuB,iBAAiB,CAAA;AAErD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAahC,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG,SAAS,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAA"}
|
|
@@ -18,7 +18,7 @@ export const schemaMutationsMetaTable = table(SCHEMA_MUTATIONS_META_TABLE, {
|
|
|
18
18
|
}, { disableAutomaticIdColumn: true });
|
|
19
19
|
export const systemTables = [schemaMetaTable, schemaMutationsMetaTable];
|
|
20
20
|
/// Mutation log DB
|
|
21
|
-
export const SyncStatus = Schema.Literal('synced', 'pending', 'error');
|
|
21
|
+
export const SyncStatus = Schema.Literal('synced', 'pending', 'error', 'localOnly');
|
|
22
22
|
export const MUTATION_LOG_META_TABLE = 'mutation_log';
|
|
23
23
|
export const mutationLogMetaTable = table(MUTATION_LOG_META_TABLE, {
|
|
24
24
|
// TODO add parent ids (see https://vlcn.io/blog/crdt-substrate)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-tables.js","sourceRoot":"","sources":["../../src/schema/system-tables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAChD,OAAO,EAAiC,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAG3E,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAEtC,UAAU;AAEV,MAAM,CAAC,MAAM,iBAAiB,GAAG,oBAAoB,CAAA;AAErD,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAClC,iBAAiB,EACjB;IACE,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IAC/C,UAAU,EAAE,SAAS,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAClD,sBAAsB;IACtB,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;CAC/C,EACD,EAAE,wBAAwB,EAAE,IAAI,EAAE,CACnC,CAAA;AAID,MAAM,CAAC,MAAM,2BAA2B,GAAG,8BAA8B,CAAA;AAEzE,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,CAC3C,2BAA2B,EAC3B;IACE,YAAY,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IAClD,UAAU,EAAE,SAAS,CAAC,OAA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@ export type TableDef<TSqliteDef extends DefaultSqliteTableDef = DefaultSqliteTab
|
|
|
16
16
|
isSingleColumn: TIsSingleColumn;
|
|
17
17
|
options: TOptions;
|
|
18
18
|
schema: TSchema;
|
|
19
|
-
} & (TOptions['deriveMutations'] extends true ? DerivedMutationHelperFns<TSqliteDef['columns'], TOptions> : {});
|
|
20
|
-
export type TableOptionsInput = Partial<Omit<TableOptions, 'isSingleColumn'> & {
|
|
19
|
+
} & (TOptions['deriveMutations']['enabled'] extends true ? DerivedMutationHelperFns<TSqliteDef['columns'], TOptions> : {});
|
|
20
|
+
export type TableOptionsInput = Partial<Omit<TableOptions, 'isSingleColumn' | 'deriveMutations'> & {
|
|
21
21
|
indexes: SqliteDsl.Index[];
|
|
22
|
+
deriveMutations: boolean | {
|
|
23
|
+
enabled: true;
|
|
24
|
+
localOnly?: boolean;
|
|
25
|
+
};
|
|
22
26
|
}>;
|
|
23
27
|
export type TableOptions = {
|
|
24
28
|
/**
|
|
@@ -44,14 +48,30 @@ export type TableOptions = {
|
|
|
44
48
|
*
|
|
45
49
|
* Important: When using this option, make sure you're following the "Rules of mutations" for the table schema.
|
|
46
50
|
*/
|
|
47
|
-
deriveMutations:
|
|
51
|
+
deriveMutations: {
|
|
52
|
+
enabled: false;
|
|
53
|
+
} | {
|
|
54
|
+
enabled: true;
|
|
55
|
+
/**
|
|
56
|
+
* When set to true, the mutations won't be synced over the network
|
|
57
|
+
*/
|
|
58
|
+
localOnly: boolean;
|
|
59
|
+
};
|
|
48
60
|
/** Derived based on whether the table definition has one or more columns (besides the `id` column) */
|
|
49
61
|
isSingleColumn: boolean;
|
|
50
62
|
};
|
|
51
|
-
export declare const table: <TName extends string, TColumns extends SqliteDsl.ColumnDefinition<any, any> | SqliteDsl.Columns, const TOptionsInput extends Partial<Omit<TableOptions, "isSingleColumn"> & {
|
|
63
|
+
export declare const table: <TName extends string, TColumns extends SqliteDsl.ColumnDefinition<any, any> | SqliteDsl.Columns, const TOptionsInput extends Partial<Omit<TableOptions, "deriveMutations" | "isSingleColumn"> & {
|
|
52
64
|
indexes: SqliteDsl.Index[];
|
|
53
|
-
|
|
65
|
+
deriveMutations: boolean | {
|
|
66
|
+
enabled: true;
|
|
67
|
+
localOnly?: boolean;
|
|
68
|
+
};
|
|
69
|
+
}> = Partial<Omit<TableOptions, "deriveMutations" | "isSingleColumn"> & {
|
|
54
70
|
indexes: SqliteDsl.Index[];
|
|
71
|
+
deriveMutations: boolean | {
|
|
72
|
+
enabled: true;
|
|
73
|
+
localOnly?: boolean;
|
|
74
|
+
};
|
|
55
75
|
}>>(name: TName, columnOrColumns: TColumns, options?: TOptionsInput) => TableDef<SqliteDsl.TableDefinition<TName, PrettifyFlat<WithId<TColumns extends SqliteDsl.Columns ? TColumns : {
|
|
56
76
|
value: TColumns;
|
|
57
77
|
}, WithDefaults<TOptionsInput, SqliteDsl.IsSingleColumn<TColumns>>>>>, SqliteDsl.IsSingleColumn<TColumns>, WithDefaults<TOptionsInput, SqliteDsl.IsSingleColumn<TColumns>>>;
|
|
@@ -62,7 +82,10 @@ export declare const tableHasDerivedMutations: <TTableDef extends {
|
|
|
62
82
|
schema: Schema.Schema<any, any, never>;
|
|
63
83
|
}>(tableDef: TTableDef) => tableDef is TTableDef & {
|
|
64
84
|
options: {
|
|
65
|
-
deriveMutations:
|
|
85
|
+
deriveMutations: {
|
|
86
|
+
enabled: true;
|
|
87
|
+
localOnly: boolean;
|
|
88
|
+
};
|
|
66
89
|
};
|
|
67
90
|
} & DerivedMutationHelperFns<TTableDef["sqliteDef"]["columns"], TTableDef["options"]>;
|
|
68
91
|
export declare const tableIsSingleton: <TTableDef extends {
|
|
@@ -96,7 +119,18 @@ type WithDefaults<TOptionsInput extends TableOptionsInput, TIsSingleColumn exten
|
|
|
96
119
|
isSingleton: TOptionsInput['isSingleton'] extends true ? true : false;
|
|
97
120
|
dynamicRegistration: TOptionsInput['dynamicRegistration'] extends true ? true : false;
|
|
98
121
|
disableAutomaticIdColumn: TOptionsInput['disableAutomaticIdColumn'] extends true ? true : false;
|
|
99
|
-
deriveMutations: TOptionsInput['deriveMutations'] extends true ?
|
|
122
|
+
deriveMutations: TOptionsInput['deriveMutations'] extends true ? {
|
|
123
|
+
enabled: true;
|
|
124
|
+
localOnly: boolean;
|
|
125
|
+
} : TOptionsInput['deriveMutations'] extends false ? {
|
|
126
|
+
enabled: false;
|
|
127
|
+
} : TOptionsInput['deriveMutations'] extends {
|
|
128
|
+
enabled: true;
|
|
129
|
+
localOnly?: boolean;
|
|
130
|
+
} ? {
|
|
131
|
+
enabled: true;
|
|
132
|
+
localOnly: TOptionsInput['deriveMutations']['localOnly'] extends true ? true : false;
|
|
133
|
+
} : never;
|
|
100
134
|
isSingleColumn: TIsSingleColumn;
|
|
101
135
|
};
|
|
102
136
|
export declare namespace FromTable {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-def.d.ts","sourceRoot":"","sources":["../../src/schema/table-def.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,MAAM,EAAE,MAAM,yBAAyB,CAAA;AACtE,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAE5C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAA;AAGvE,eAAO,MAAQ,IAAI,8BAAE,OAAO,4DAAE,MAAM,+GAAE,QAAQ,sDAAE,OAAO,iCAAE,kBAAkB,qEAAE,IAAI,wDAAE,IAAI,8BAAE,IAAI,4BAAc,CAAA;AAE3G,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAEjD,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,SAAS,CAAA;AAE/C,MAAM,MAAM,qBAAqB,GAAG,SAAS,CAAC,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,CAAA;AACxF,MAAM,MAAM,gCAAgC,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AO,IAAI;SAC7D,CAAC,IAAI,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;KACjE,CAAA;IAED,KAAY,UAAU,CAAC,QAAQ,SAAS,SAAS,CAAC,OAAO,IAAI,YAAY,CACvE,QAAQ,CAAC,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC,GAC3E,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CACtE,CAAA;IAED,KAAY,oBAAoB,CAAC,QAAQ,SAAS,SAAS,CAAC,OAAO,IAAI;SACpE,CAAC,IAAI,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;KACpE,CAAA;IAED,KAAY,mBAAmB,CAAC,QAAQ,SAAS,SAAS,CAAC,OAAO,IAAI,MAAM;SACzE,CAAC,IAAI,MAAM,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,IAAI,GAAG,CAAC,GAAG,KAAK,GAAG,EAAE;KAC7E,CAAA;IAED,KAAY,yBAAyB,CAAC,QAAQ,SAAS,SAAS,CAAC,OAAO,IACtE,SAAS,CAAC,WAAW,CAAC,yBAAyB,CAAC,QAAQ,CAAC,CAAA;IAE3D,KAAY,gBAAgB,CAAC,QAAQ,SAAS,SAAS,CAAC,OAAO,IAAI,SAAS,CAAC,WAAW,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAA;CACpH"}
|
package/dist/schema/table-def.js
CHANGED
|
@@ -9,7 +9,13 @@ export const table = (name, columnOrColumns, options) => {
|
|
|
9
9
|
isSingleton: options?.isSingleton ?? false,
|
|
10
10
|
dynamicRegistration: options?.dynamicRegistration ?? false,
|
|
11
11
|
disableAutomaticIdColumn: options?.disableAutomaticIdColumn ?? false,
|
|
12
|
-
deriveMutations: options?.deriveMutations
|
|
12
|
+
deriveMutations: options?.deriveMutations === true
|
|
13
|
+
? { enabled: true, localOnly: false }
|
|
14
|
+
: options?.deriveMutations === false
|
|
15
|
+
? { enabled: false }
|
|
16
|
+
: options?.deriveMutations === undefined
|
|
17
|
+
? { enabled: false }
|
|
18
|
+
: { enabled: true, localOnly: options.deriveMutations.localOnly ?? false },
|
|
13
19
|
isSingleColumn: SqliteDsl.isColumnDefinition(columnOrColumns) === true,
|
|
14
20
|
};
|
|
15
21
|
const columns = (SqliteDsl.isColumnDefinition(columnOrColumns) ? { value: columnOrColumns } : columnOrColumns);
|
|
@@ -60,7 +66,7 @@ export const table = (name, columnOrColumns, options) => {
|
|
|
60
66
|
}
|
|
61
67
|
return tableDef;
|
|
62
68
|
};
|
|
63
|
-
export const tableHasDerivedMutations = (tableDef) => tableDef.options.deriveMutations === true;
|
|
69
|
+
export const tableHasDerivedMutations = (tableDef) => tableDef.options.deriveMutations.enabled === true;
|
|
64
70
|
export const tableIsSingleton = (tableDef) => tableDef.options.isSingleton === true;
|
|
65
71
|
export const getDefaultValuesEncoded = (tableDef, fallbackValues) => pipe(tableDef.sqliteDef.columns, ReadonlyRecord.filter((col, key) => {
|
|
66
72
|
if (fallbackValues?.[key] !== undefined)
|