@livestore/livestore 0.3.0-dev.14 → 0.3.0-dev.16
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/utils/tests/fixture.d.ts +3 -3
- package/package.json +4 -4
- package/dist/SynchronousDatabaseWrapper.d.ts +0 -50
- package/dist/SynchronousDatabaseWrapper.d.ts.map +0 -1
- package/dist/SynchronousDatabaseWrapper.js +0 -208
- package/dist/SynchronousDatabaseWrapper.js.map +0 -1
- package/dist/__tests__/fixture.d.ts +0 -252
- package/dist/__tests__/fixture.d.ts.map +0 -1
- package/dist/__tests__/fixture.js +0 -18
- package/dist/__tests__/fixture.js.map +0 -1
- package/dist/global-state.d.ts +0 -14
- package/dist/global-state.d.ts.map +0 -1
- package/dist/global-state.js +0 -16
- package/dist/global-state.js.map +0 -1
- package/dist/live-queries/db.d.ts +0 -63
- package/dist/live-queries/db.d.ts.map +0 -1
- package/dist/live-queries/db.js +0 -223
- package/dist/live-queries/db.js.map +0 -1
- package/dist/live-queries/db.test.d.ts +0 -2
- package/dist/live-queries/db.test.d.ts.map +0 -1
- package/dist/live-queries/db.test.js +0 -120
- package/dist/live-queries/db.test.js.map +0 -1
- package/dist/store/store.test.d.ts +0 -2
- package/dist/store/store.test.d.ts.map +0 -1
- package/dist/store/store.test.js +0 -27
- package/dist/store/store.test.js.map +0 -1
- package/dist/utils/expo.d.ts +0 -2
- package/dist/utils/expo.d.ts.map +0 -1
- package/dist/utils/expo.js +0 -8
- package/dist/utils/expo.js.map +0 -1
|
@@ -45,7 +45,7 @@ export declare const todos: DbSchema.TableDef<{
|
|
|
45
45
|
disableAutomaticIdColumn: false;
|
|
46
46
|
deriveMutations: {
|
|
47
47
|
enabled: true;
|
|
48
|
-
clientOnly:
|
|
48
|
+
clientOnly: false;
|
|
49
49
|
};
|
|
50
50
|
isSingleColumn: false;
|
|
51
51
|
requiredInsertColumnNames: "id";
|
|
@@ -133,7 +133,7 @@ export declare const tables: {
|
|
|
133
133
|
disableAutomaticIdColumn: false;
|
|
134
134
|
deriveMutations: {
|
|
135
135
|
enabled: true;
|
|
136
|
-
clientOnly:
|
|
136
|
+
clientOnly: false;
|
|
137
137
|
};
|
|
138
138
|
isSingleColumn: false;
|
|
139
139
|
requiredInsertColumnNames: "id";
|
|
@@ -223,7 +223,7 @@ export declare const schema: FromInputSchema.DeriveSchema<{
|
|
|
223
223
|
disableAutomaticIdColumn: false;
|
|
224
224
|
deriveMutations: {
|
|
225
225
|
enabled: true;
|
|
226
|
-
clientOnly:
|
|
226
|
+
clientOnly: false;
|
|
227
227
|
};
|
|
228
228
|
isSingleColumn: false;
|
|
229
229
|
requiredInsertColumnNames: "id";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livestore/livestore",
|
|
3
|
-
"version": "0.3.0-dev.
|
|
3
|
+
"version": "0.3.0-dev.16",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"exports": {
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@graphql-typed-document-node/core": "3.2.0",
|
|
33
33
|
"@opentelemetry/api": "1.9.0",
|
|
34
|
-
"@livestore/common": "0.3.0-dev.
|
|
35
|
-
"@livestore/utils": "0.3.0-dev.
|
|
34
|
+
"@livestore/common": "0.3.0-dev.16",
|
|
35
|
+
"@livestore/utils": "0.3.0-dev.16"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@opentelemetry/sdk-trace-base": "^1.30.1",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"typescript": "^5.7.2",
|
|
41
41
|
"vite": "^6.1.0",
|
|
42
42
|
"vitest": "^2.1.4",
|
|
43
|
-
"@livestore/adapter-web": "0.3.0-dev.
|
|
43
|
+
"@livestore/adapter-web": "0.3.0-dev.16"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"graphql": "~16.0"
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { DebugInfo, MutableDebugInfo, PreparedBindValues, PreparedStatement, SynchronousDatabase, SynchronousDatabaseChangeset, SynchronousDatabaseSession } from '@livestore/common';
|
|
2
|
-
import type * as otel from '@opentelemetry/api';
|
|
3
|
-
export declare const emptyDebugInfo: () => DebugInfo;
|
|
4
|
-
export declare class SynchronousDatabaseWrapper implements SynchronousDatabase {
|
|
5
|
-
_tag: "SynchronousDatabase";
|
|
6
|
-
private cachedStmts;
|
|
7
|
-
private tablesUsedCache;
|
|
8
|
-
private resultCache;
|
|
9
|
-
private db;
|
|
10
|
-
private otelTracer;
|
|
11
|
-
private otelRootSpanContext;
|
|
12
|
-
private tablesUsedStmt;
|
|
13
|
-
debugInfo: MutableDebugInfo;
|
|
14
|
-
constructor({ db, otel, }: {
|
|
15
|
-
db: SynchronousDatabase;
|
|
16
|
-
otel: {
|
|
17
|
-
tracer: otel.Tracer;
|
|
18
|
-
rootSpanContext: otel.Context;
|
|
19
|
-
};
|
|
20
|
-
});
|
|
21
|
-
metadata: any;
|
|
22
|
-
prepare(queryStr: string): PreparedStatement;
|
|
23
|
-
import(data: Uint8Array<ArrayBufferLike> | SynchronousDatabase<any, any>): void;
|
|
24
|
-
close(): void;
|
|
25
|
-
destroy(): void;
|
|
26
|
-
session(): SynchronousDatabaseSession;
|
|
27
|
-
makeChangeset(data: Uint8Array): SynchronousDatabaseChangeset;
|
|
28
|
-
txn<TRes>(callback: () => TRes): TRes;
|
|
29
|
-
withChangeset<TRes>(callback: () => TRes): {
|
|
30
|
-
result: TRes;
|
|
31
|
-
changeset: Uint8Array | undefined;
|
|
32
|
-
};
|
|
33
|
-
rollback(changeset: Uint8Array): void;
|
|
34
|
-
getTablesUsed(query: string): Set<string>;
|
|
35
|
-
execute(queryStr: string, bindValues?: PreparedBindValues | undefined, options?: {
|
|
36
|
-
hasNoEffects?: boolean;
|
|
37
|
-
otelContext?: otel.Context;
|
|
38
|
-
writeTables?: ReadonlySet<string>;
|
|
39
|
-
onRowsChanged?: (rowsChanged: number) => void;
|
|
40
|
-
}): {
|
|
41
|
-
durationMs: number;
|
|
42
|
-
};
|
|
43
|
-
select<T = any>(queryStr: string, bindValues?: PreparedBindValues | undefined, options?: {
|
|
44
|
-
queriedTables?: ReadonlySet<string>;
|
|
45
|
-
skipCache?: boolean;
|
|
46
|
-
otelContext?: otel.Context;
|
|
47
|
-
}): ReadonlyArray<T>;
|
|
48
|
-
export(): Uint8Array<ArrayBufferLike>;
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=SynchronousDatabaseWrapper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SynchronousDatabaseWrapper.d.ts","sourceRoot":"","sources":["../src/SynchronousDatabaseWrapper.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,4BAA4B,EAC5B,0BAA0B,EAC3B,MAAM,mBAAmB,CAAA;AAG1B,OAAO,KAAK,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAK/C,eAAO,MAAM,cAAc,QAAO,SAKhC,CAAA;AAEF,qBAAa,0BAA2B,YAAW,mBAAmB;IACpE,IAAI,EAAG,qBAAqB,CAAS;IAErC,OAAO,CAAC,WAAW,CAA+C;IAClE,OAAO,CAAC,eAAe,CAAyC;IAChE,OAAO,CAAC,WAAW,CAAmB;IACtC,OAAO,CAAC,EAAE,CAAqB;IAC/B,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,mBAAmB,CAAc;IACzC,OAAO,CAAC,cAAc,CAAA;IACf,SAAS,EAAE,gBAAgB,CAAmB;gBAEzC,EACV,EAAE,EACF,IAAI,GACL,EAAE;QACD,EAAE,EAAE,mBAAmB,CAAA;QACvB,IAAI,EAAE;YACJ,MAAM,EAAE,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,SAAS,CAAC,EAAE,OAAO,CAAA;QACnB,WAAW,CAAC,EAAE,IAAI,CAAC,OAAO,CAAA;KAC3B,GACA,aAAa,CAAC,CAAC,CAAC;IA+DnB,MAAM;CAQP"}
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
/* eslint-disable prefer-arrow/prefer-arrow-functions */
|
|
2
|
-
import { BoundArray, BoundMap, sql } from '@livestore/common';
|
|
3
|
-
import { isDevEnv } from '@livestore/utils';
|
|
4
|
-
import QueryCache from './QueryCache.js';
|
|
5
|
-
import { getDurationMsFromSpan, getStartTimeHighResFromSpan } from './utils/otel.js';
|
|
6
|
-
export const emptyDebugInfo = () => ({
|
|
7
|
-
slowQueries: new BoundArray(200),
|
|
8
|
-
queryFrameDuration: 0,
|
|
9
|
-
queryFrameCount: 0,
|
|
10
|
-
events: new BoundArray(1000),
|
|
11
|
-
});
|
|
12
|
-
export class SynchronousDatabaseWrapper {
|
|
13
|
-
_tag = 'SynchronousDatabase';
|
|
14
|
-
// TODO: how many unique active statements are expected?
|
|
15
|
-
cachedStmts = new BoundMap(200);
|
|
16
|
-
tablesUsedCache = new BoundMap(200);
|
|
17
|
-
resultCache = new QueryCache();
|
|
18
|
-
db;
|
|
19
|
-
otelTracer;
|
|
20
|
-
otelRootSpanContext;
|
|
21
|
-
tablesUsedStmt;
|
|
22
|
-
debugInfo = emptyDebugInfo();
|
|
23
|
-
constructor({ db, otel, }) {
|
|
24
|
-
this.db = db;
|
|
25
|
-
this.otelTracer = otel.tracer;
|
|
26
|
-
this.otelRootSpanContext = otel.rootSpanContext;
|
|
27
|
-
this.tablesUsedStmt = db.prepare(`SELECT tbl_name FROM tables_used(?) AS u JOIN sqlite_master ON sqlite_master.name = u.name WHERE u.schema = 'main';`);
|
|
28
|
-
this.cachedStmts.onEvict = (_queryStr, stmt) => stmt.finalize();
|
|
29
|
-
configureSQLite(this);
|
|
30
|
-
}
|
|
31
|
-
metadata;
|
|
32
|
-
prepare(queryStr) {
|
|
33
|
-
return this.db.prepare(queryStr);
|
|
34
|
-
}
|
|
35
|
-
import(data) {
|
|
36
|
-
return this.db.import(data);
|
|
37
|
-
}
|
|
38
|
-
close() {
|
|
39
|
-
return this.db.close();
|
|
40
|
-
}
|
|
41
|
-
destroy() {
|
|
42
|
-
return this.db.destroy();
|
|
43
|
-
}
|
|
44
|
-
session() {
|
|
45
|
-
return this.db.session();
|
|
46
|
-
}
|
|
47
|
-
makeChangeset(data) {
|
|
48
|
-
return this.db.makeChangeset(data);
|
|
49
|
-
}
|
|
50
|
-
txn(callback) {
|
|
51
|
-
this.execute(sql `begin transaction;`);
|
|
52
|
-
let errored = false;
|
|
53
|
-
let result;
|
|
54
|
-
try {
|
|
55
|
-
result = callback();
|
|
56
|
-
}
|
|
57
|
-
catch (e) {
|
|
58
|
-
errored = true;
|
|
59
|
-
this.execute(sql `rollback;`);
|
|
60
|
-
throw e;
|
|
61
|
-
}
|
|
62
|
-
if (!errored) {
|
|
63
|
-
this.execute(sql `commit;`);
|
|
64
|
-
}
|
|
65
|
-
return result;
|
|
66
|
-
}
|
|
67
|
-
withChangeset(callback) {
|
|
68
|
-
const session = this.db.session();
|
|
69
|
-
const result = callback();
|
|
70
|
-
const changeset = session.changeset();
|
|
71
|
-
session.finish();
|
|
72
|
-
return { result, changeset };
|
|
73
|
-
}
|
|
74
|
-
rollback(changeset) {
|
|
75
|
-
const invertedChangeset = this.db.makeChangeset(changeset).invert();
|
|
76
|
-
invertedChangeset.apply();
|
|
77
|
-
}
|
|
78
|
-
getTablesUsed(query) {
|
|
79
|
-
// It seems that SQLite doesn't properly handle `DELETE FROM SOME_TABLE` queries without a WHERE clause
|
|
80
|
-
// So we need to handle these queries separately
|
|
81
|
-
const tableNameFromPlainDeleteQuery = tryGetTableNameFromPlainDeleteQuery(query);
|
|
82
|
-
if (tableNameFromPlainDeleteQuery !== undefined) {
|
|
83
|
-
return new Set([tableNameFromPlainDeleteQuery]);
|
|
84
|
-
}
|
|
85
|
-
const cached = this.tablesUsedCache.get(query);
|
|
86
|
-
if (cached) {
|
|
87
|
-
return cached;
|
|
88
|
-
}
|
|
89
|
-
const stmt = this.tablesUsedStmt;
|
|
90
|
-
const tablesUsed = new Set();
|
|
91
|
-
try {
|
|
92
|
-
const results = stmt.select([query]);
|
|
93
|
-
for (const row of results) {
|
|
94
|
-
tablesUsed.add(row.tbl_name);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
catch (e) {
|
|
98
|
-
console.error('Error getting tables used', e, 'for query', query);
|
|
99
|
-
return new Set();
|
|
100
|
-
}
|
|
101
|
-
this.tablesUsedCache.set(query, tablesUsed);
|
|
102
|
-
return tablesUsed;
|
|
103
|
-
}
|
|
104
|
-
execute(queryStr, bindValues, options) {
|
|
105
|
-
// console.debug('in-memory-db:execute', query, bindValues)
|
|
106
|
-
return this.otelTracer.startActiveSpan('livestore.in-memory-db:execute',
|
|
107
|
-
// TODO truncate query string
|
|
108
|
-
{ attributes: { 'sql.query': queryStr } }, options?.otelContext ?? this.otelRootSpanContext, (span) => {
|
|
109
|
-
let stmt = this.cachedStmts.get(queryStr);
|
|
110
|
-
if (stmt === undefined) {
|
|
111
|
-
stmt = this.db.prepare(queryStr);
|
|
112
|
-
this.cachedStmts.set(queryStr, stmt);
|
|
113
|
-
}
|
|
114
|
-
stmt.execute(bindValues);
|
|
115
|
-
if (options?.hasNoEffects !== true && !this.resultCache.ignoreQuery(queryStr)) {
|
|
116
|
-
// TODO use write tables instead
|
|
117
|
-
// check what queries actually end up here.
|
|
118
|
-
this.resultCache.invalidate(options?.writeTables ?? this.getTablesUsed(queryStr));
|
|
119
|
-
}
|
|
120
|
-
span.end();
|
|
121
|
-
const durationMs = getDurationMsFromSpan(span);
|
|
122
|
-
this.debugInfo.queryFrameDuration += durationMs;
|
|
123
|
-
this.debugInfo.queryFrameCount++;
|
|
124
|
-
if (durationMs > 5 && isDevEnv()) {
|
|
125
|
-
this.debugInfo.slowQueries.push({
|
|
126
|
-
queryStr,
|
|
127
|
-
bindValues,
|
|
128
|
-
durationMs,
|
|
129
|
-
rowsCount: undefined,
|
|
130
|
-
queriedTables: new Set(),
|
|
131
|
-
startTimePerfNow: getStartTimeHighResFromSpan(span),
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
return { durationMs };
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
select(queryStr, bindValues, options) {
|
|
138
|
-
const { queriedTables, skipCache = false, otelContext } = options ?? {};
|
|
139
|
-
// console.debug('in-memory-db:select', query, bindValues)
|
|
140
|
-
return this.otelTracer.startActiveSpan('sql-in-memory-select', {}, otelContext ?? this.otelRootSpanContext, (span) => {
|
|
141
|
-
try {
|
|
142
|
-
span.setAttribute('sql.query', queryStr);
|
|
143
|
-
const key = this.resultCache.getKey(queryStr, bindValues);
|
|
144
|
-
const cachedResult = this.resultCache.get(key);
|
|
145
|
-
if (skipCache === false && cachedResult !== undefined) {
|
|
146
|
-
span.setAttribute('sql.rowsCount', cachedResult.length);
|
|
147
|
-
span.setAttribute('sql.cached', true);
|
|
148
|
-
span.end();
|
|
149
|
-
return cachedResult;
|
|
150
|
-
}
|
|
151
|
-
let stmt = this.cachedStmts.get(queryStr);
|
|
152
|
-
if (stmt === undefined) {
|
|
153
|
-
stmt = this.db.prepare(queryStr);
|
|
154
|
-
this.cachedStmts.set(queryStr, stmt);
|
|
155
|
-
}
|
|
156
|
-
const result = stmt.select(bindValues);
|
|
157
|
-
span.setAttribute('sql.rowsCount', result.length);
|
|
158
|
-
span.setAttribute('sql.cached', false);
|
|
159
|
-
const queriedTables_ = queriedTables ?? this.getTablesUsed(queryStr);
|
|
160
|
-
this.resultCache.set(queriedTables_, key, result);
|
|
161
|
-
span.end();
|
|
162
|
-
const durationMs = getDurationMsFromSpan(span);
|
|
163
|
-
this.debugInfo.queryFrameDuration += durationMs;
|
|
164
|
-
this.debugInfo.queryFrameCount++;
|
|
165
|
-
// TODO also enable in non-dev mode
|
|
166
|
-
if (durationMs > 5 && isDevEnv()) {
|
|
167
|
-
this.debugInfo.slowQueries.push({
|
|
168
|
-
queryStr,
|
|
169
|
-
bindValues,
|
|
170
|
-
durationMs,
|
|
171
|
-
rowsCount: result.length,
|
|
172
|
-
queriedTables: queriedTables_,
|
|
173
|
-
startTimePerfNow: getStartTimeHighResFromSpan(span),
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
return result;
|
|
177
|
-
}
|
|
178
|
-
finally {
|
|
179
|
-
span.end();
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
export() {
|
|
184
|
-
// Clear statement cache because exporting frees statements
|
|
185
|
-
for (const key of this.cachedStmts.keys()) {
|
|
186
|
-
this.cachedStmts.delete(key);
|
|
187
|
-
}
|
|
188
|
-
return this.db.export();
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
/** Set up SQLite performance; hasn't been super carefully optimized yet. */
|
|
192
|
-
const configureSQLite = (db) => {
|
|
193
|
-
db.execute(
|
|
194
|
-
// TODO: revisit these tuning parameters for max performance
|
|
195
|
-
sql `
|
|
196
|
-
PRAGMA page_size=32768;
|
|
197
|
-
PRAGMA cache_size=10000;
|
|
198
|
-
PRAGMA journal_mode='MEMORY'; -- we don't flush to disk before committing a write
|
|
199
|
-
PRAGMA synchronous='OFF';
|
|
200
|
-
PRAGMA temp_store='MEMORY';
|
|
201
|
-
PRAGMA foreign_keys='ON'; -- we want foreign key constraints to be enforced
|
|
202
|
-
`);
|
|
203
|
-
};
|
|
204
|
-
const tryGetTableNameFromPlainDeleteQuery = (query) => {
|
|
205
|
-
const [_, tableName] = query.trim().match(/^delete\s+from\s+(\w+)$/i) ?? [];
|
|
206
|
-
return tableName;
|
|
207
|
-
};
|
|
208
|
-
//# sourceMappingURL=SynchronousDatabaseWrapper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SynchronousDatabaseWrapper.js","sourceRoot":"","sources":["../src/SynchronousDatabaseWrapper.ts"],"names":[],"mapp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,GAAG,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC;YAC1C,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QAC9B,CAAC;QAED,OAAO,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,CAAA;IACzB,CAAC;CACF;AAED,4EAA4E;AAC5E,MAAM,eAAe,GAAG,CAAC,EAA8B,EAAE,EAAE;IACzD,EAAE,CAAC,OAAO;IACR,4DAA4D;IAC5D,GAAG,CAAA;;;;;;;KAOF,CACF,CAAA;AACH,CAAC,CAAA;AAED,MAAM,mCAAmC,GAAG,CAAC,KAAa,EAAE,EAAE;IAC5D,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,0BAA0B,CAAC,IAAI,EAAE,CAAA;IAC3E,OAAO,SAAS,CAAA;AAClB,CAAC,CAAA"}
|
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
import { DbSchema } from '@livestore/common/schema';
|
|
2
|
-
import { Schema } from '@livestore/utils/effect';
|
|
3
|
-
export declare const todos: DbSchema.TableDef<{
|
|
4
|
-
name: "todos";
|
|
5
|
-
columns: {
|
|
6
|
-
id: {
|
|
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
|
-
text: {
|
|
14
|
-
columnType: "text";
|
|
15
|
-
schema: Schema.Schema<string, string, never>;
|
|
16
|
-
default: import("effect/Option").Some<"">;
|
|
17
|
-
nullable: false;
|
|
18
|
-
primaryKey: false;
|
|
19
|
-
};
|
|
20
|
-
completed: {
|
|
21
|
-
columnType: "integer";
|
|
22
|
-
schema: Schema.Schema<boolean, number, never>;
|
|
23
|
-
default: import("effect/Option").Some<false>;
|
|
24
|
-
nullable: false;
|
|
25
|
-
primaryKey: false;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
indexes?: ReadonlyArray<DbSchema.SqliteDsl.Index>;
|
|
29
|
-
ast: import("@livestore/db-schema/dist/ast/sqlite.js").Table;
|
|
30
|
-
}, {
|
|
31
|
-
isSingleton: false;
|
|
32
|
-
disableAutomaticIdColumn: false;
|
|
33
|
-
deriveMutations: {
|
|
34
|
-
enabled: true;
|
|
35
|
-
localOnly: boolean;
|
|
36
|
-
};
|
|
37
|
-
isSingleColumn: false;
|
|
38
|
-
requiredInsertColumnNames: "id";
|
|
39
|
-
}, Schema.Schema<{
|
|
40
|
-
readonly id: string;
|
|
41
|
-
readonly text: string;
|
|
42
|
-
readonly completed: boolean;
|
|
43
|
-
}, {
|
|
44
|
-
readonly id: string;
|
|
45
|
-
readonly text: string;
|
|
46
|
-
readonly completed: number;
|
|
47
|
-
}, never>>;
|
|
48
|
-
export declare const appConfig: DbSchema.TableDef<{
|
|
49
|
-
name: "app_config";
|
|
50
|
-
columns: {
|
|
51
|
-
value: {
|
|
52
|
-
columnType: "text";
|
|
53
|
-
schema: Schema.Schema<{
|
|
54
|
-
readonly fontSize: number;
|
|
55
|
-
readonly theme: "light" | "dark";
|
|
56
|
-
} | null, string | null, never>;
|
|
57
|
-
default: import("effect/Option").None<never>;
|
|
58
|
-
nullable: true;
|
|
59
|
-
primaryKey: false;
|
|
60
|
-
};
|
|
61
|
-
id: DbSchema.SqliteDsl.ColumnDefinition<"singleton", "singleton">;
|
|
62
|
-
};
|
|
63
|
-
indexes?: ReadonlyArray<DbSchema.SqliteDsl.Index>;
|
|
64
|
-
ast: import("@livestore/db-schema/dist/ast/sqlite.js").Table;
|
|
65
|
-
}, {
|
|
66
|
-
isSingleton: true;
|
|
67
|
-
disableAutomaticIdColumn: false;
|
|
68
|
-
deriveMutations: {
|
|
69
|
-
enabled: true;
|
|
70
|
-
localOnly: boolean;
|
|
71
|
-
};
|
|
72
|
-
isSingleColumn: true;
|
|
73
|
-
requiredInsertColumnNames: never;
|
|
74
|
-
}, Schema.Schema<{
|
|
75
|
-
readonly value: {
|
|
76
|
-
readonly fontSize: number;
|
|
77
|
-
readonly theme: "light" | "dark";
|
|
78
|
-
} | null;
|
|
79
|
-
readonly id: "singleton";
|
|
80
|
-
}, {
|
|
81
|
-
readonly value: string | null;
|
|
82
|
-
readonly id: "singleton";
|
|
83
|
-
}, never>>;
|
|
84
|
-
export declare const tables: {
|
|
85
|
-
todos: DbSchema.TableDef<{
|
|
86
|
-
name: "todos";
|
|
87
|
-
columns: {
|
|
88
|
-
id: {
|
|
89
|
-
columnType: "text";
|
|
90
|
-
schema: Schema.Schema<string, string, never>;
|
|
91
|
-
default: import("effect/Option").None<never>;
|
|
92
|
-
nullable: false;
|
|
93
|
-
primaryKey: true;
|
|
94
|
-
};
|
|
95
|
-
text: {
|
|
96
|
-
columnType: "text";
|
|
97
|
-
schema: Schema.Schema<string, string, never>;
|
|
98
|
-
default: import("effect/Option").Some<"">;
|
|
99
|
-
nullable: false;
|
|
100
|
-
primaryKey: false;
|
|
101
|
-
};
|
|
102
|
-
completed: {
|
|
103
|
-
columnType: "integer";
|
|
104
|
-
schema: Schema.Schema<boolean, number, never>;
|
|
105
|
-
default: import("effect/Option").Some<false>;
|
|
106
|
-
nullable: false;
|
|
107
|
-
primaryKey: false;
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
|
-
indexes?: ReadonlyArray<DbSchema.SqliteDsl.Index>;
|
|
111
|
-
ast: import("@livestore/db-schema/dist/ast/sqlite.js").Table;
|
|
112
|
-
}, {
|
|
113
|
-
isSingleton: false;
|
|
114
|
-
disableAutomaticIdColumn: false;
|
|
115
|
-
deriveMutations: {
|
|
116
|
-
enabled: true;
|
|
117
|
-
localOnly: boolean;
|
|
118
|
-
};
|
|
119
|
-
isSingleColumn: false;
|
|
120
|
-
requiredInsertColumnNames: "id";
|
|
121
|
-
}, Schema.Schema<{
|
|
122
|
-
readonly id: string;
|
|
123
|
-
readonly text: string;
|
|
124
|
-
readonly completed: boolean;
|
|
125
|
-
}, {
|
|
126
|
-
readonly id: string;
|
|
127
|
-
readonly text: string;
|
|
128
|
-
readonly completed: number;
|
|
129
|
-
}, never>>;
|
|
130
|
-
appConfig: DbSchema.TableDef<{
|
|
131
|
-
name: "app_config";
|
|
132
|
-
columns: {
|
|
133
|
-
value: {
|
|
134
|
-
columnType: "text";
|
|
135
|
-
schema: Schema.Schema<{
|
|
136
|
-
readonly fontSize: number;
|
|
137
|
-
readonly theme: "light" | "dark";
|
|
138
|
-
} | null, string | null, never>;
|
|
139
|
-
default: import("effect/Option").None<never>;
|
|
140
|
-
nullable: true;
|
|
141
|
-
primaryKey: false;
|
|
142
|
-
};
|
|
143
|
-
id: DbSchema.SqliteDsl.ColumnDefinition<"singleton", "singleton">;
|
|
144
|
-
};
|
|
145
|
-
indexes?: ReadonlyArray<DbSchema.SqliteDsl.Index>;
|
|
146
|
-
ast: import("@livestore/db-schema/dist/ast/sqlite.js").Table;
|
|
147
|
-
}, {
|
|
148
|
-
isSingleton: true;
|
|
149
|
-
disableAutomaticIdColumn: false;
|
|
150
|
-
deriveMutations: {
|
|
151
|
-
enabled: true;
|
|
152
|
-
localOnly: boolean;
|
|
153
|
-
};
|
|
154
|
-
isSingleColumn: true;
|
|
155
|
-
requiredInsertColumnNames: never;
|
|
156
|
-
}, Schema.Schema<{
|
|
157
|
-
readonly value: {
|
|
158
|
-
readonly fontSize: number;
|
|
159
|
-
readonly theme: "light" | "dark";
|
|
160
|
-
} | null;
|
|
161
|
-
readonly id: "singleton";
|
|
162
|
-
}, {
|
|
163
|
-
readonly value: string | null;
|
|
164
|
-
readonly id: "singleton";
|
|
165
|
-
}, never>>;
|
|
166
|
-
};
|
|
167
|
-
export declare const schema: import("@livestore/common/schema").FromInputSchema.DeriveSchema<{
|
|
168
|
-
tables: {
|
|
169
|
-
todos: DbSchema.TableDef<{
|
|
170
|
-
name: "todos";
|
|
171
|
-
columns: {
|
|
172
|
-
id: {
|
|
173
|
-
columnType: "text";
|
|
174
|
-
schema: Schema.Schema<string, string, never>;
|
|
175
|
-
default: import("effect/Option").None<never>;
|
|
176
|
-
nullable: false;
|
|
177
|
-
primaryKey: true;
|
|
178
|
-
};
|
|
179
|
-
text: {
|
|
180
|
-
columnType: "text";
|
|
181
|
-
schema: Schema.Schema<string, string, never>;
|
|
182
|
-
default: import("effect/Option").Some<"">;
|
|
183
|
-
nullable: false;
|
|
184
|
-
primaryKey: false;
|
|
185
|
-
};
|
|
186
|
-
completed: {
|
|
187
|
-
columnType: "integer";
|
|
188
|
-
schema: Schema.Schema<boolean, number, never>;
|
|
189
|
-
default: import("effect/Option").Some<false>;
|
|
190
|
-
nullable: false;
|
|
191
|
-
primaryKey: false;
|
|
192
|
-
};
|
|
193
|
-
};
|
|
194
|
-
indexes?: ReadonlyArray<DbSchema.SqliteDsl.Index>;
|
|
195
|
-
ast: import("@livestore/db-schema/dist/ast/sqlite.js").Table;
|
|
196
|
-
}, {
|
|
197
|
-
isSingleton: false;
|
|
198
|
-
disableAutomaticIdColumn: false;
|
|
199
|
-
deriveMutations: {
|
|
200
|
-
enabled: true;
|
|
201
|
-
localOnly: boolean;
|
|
202
|
-
};
|
|
203
|
-
isSingleColumn: false;
|
|
204
|
-
requiredInsertColumnNames: "id";
|
|
205
|
-
}, Schema.Schema<{
|
|
206
|
-
readonly id: string;
|
|
207
|
-
readonly text: string;
|
|
208
|
-
readonly completed: boolean;
|
|
209
|
-
}, {
|
|
210
|
-
readonly id: string;
|
|
211
|
-
readonly text: string;
|
|
212
|
-
readonly completed: number;
|
|
213
|
-
}, never>>;
|
|
214
|
-
appConfig: DbSchema.TableDef<{
|
|
215
|
-
name: "app_config";
|
|
216
|
-
columns: {
|
|
217
|
-
value: {
|
|
218
|
-
columnType: "text";
|
|
219
|
-
schema: Schema.Schema<{
|
|
220
|
-
readonly fontSize: number;
|
|
221
|
-
readonly theme: "light" | "dark";
|
|
222
|
-
} | null, string | null, never>;
|
|
223
|
-
default: import("effect/Option").None<never>;
|
|
224
|
-
nullable: true;
|
|
225
|
-
primaryKey: false;
|
|
226
|
-
};
|
|
227
|
-
id: DbSchema.SqliteDsl.ColumnDefinition<"singleton", "singleton">;
|
|
228
|
-
};
|
|
229
|
-
indexes?: ReadonlyArray<DbSchema.SqliteDsl.Index>;
|
|
230
|
-
ast: import("@livestore/db-schema/dist/ast/sqlite.js").Table;
|
|
231
|
-
}, {
|
|
232
|
-
isSingleton: true;
|
|
233
|
-
disableAutomaticIdColumn: false;
|
|
234
|
-
deriveMutations: {
|
|
235
|
-
enabled: true;
|
|
236
|
-
localOnly: boolean;
|
|
237
|
-
};
|
|
238
|
-
isSingleColumn: true;
|
|
239
|
-
requiredInsertColumnNames: never;
|
|
240
|
-
}, Schema.Schema<{
|
|
241
|
-
readonly value: {
|
|
242
|
-
readonly fontSize: number;
|
|
243
|
-
readonly theme: "light" | "dark";
|
|
244
|
-
} | null;
|
|
245
|
-
readonly id: "singleton";
|
|
246
|
-
}, {
|
|
247
|
-
readonly value: string | null;
|
|
248
|
-
readonly id: "singleton";
|
|
249
|
-
}, never>>;
|
|
250
|
-
};
|
|
251
|
-
}>;
|
|
252
|
-
//# sourceMappingURL=fixture.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fixture.d.ts","sourceRoot":"","sources":["../../src/__tests__/fixture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAc,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAEhD,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAQjB,CAAA;AAOD,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAGpB,CAAA;AAEF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAuB,CAAA;AAE1C,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAyB,CAAA"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { DbSchema, makeSchema } from '@livestore/common/schema';
|
|
2
|
-
import { Schema } from '@livestore/utils/effect';
|
|
3
|
-
export const todos = DbSchema.table('todos', {
|
|
4
|
-
id: DbSchema.text({ primaryKey: true }),
|
|
5
|
-
text: DbSchema.text({ default: '', nullable: false }),
|
|
6
|
-
completed: DbSchema.boolean({ default: false, nullable: false }),
|
|
7
|
-
}, { deriveMutations: true });
|
|
8
|
-
const Config = Schema.Struct({
|
|
9
|
-
fontSize: Schema.Number,
|
|
10
|
-
theme: Schema.Literal('light', 'dark'),
|
|
11
|
-
});
|
|
12
|
-
export const appConfig = DbSchema.table('app_config', DbSchema.json({ schema: Config, nullable: true }), {
|
|
13
|
-
isSingleton: true,
|
|
14
|
-
deriveMutations: true,
|
|
15
|
-
});
|
|
16
|
-
export const tables = { todos, appConfig };
|
|
17
|
-
export const schema = makeSchema({ tables });
|
|
18
|
-
//# sourceMappingURL=fixture.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fixture.js","sourceRoot":"","sources":["../../src/__tests__/fixture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAEhD,MAAM,CAAC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CACjC,OAAO,EACP;IACE,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IACvC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IACrD,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;CACjE,EACD,EAAE,eAAe,EAAE,IAAI,EAAE,CAC1B,CAAA;AAED,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC,MAAM;IACvB,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC;CACvC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,YAAY,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAE;IACvG,WAAW,EAAE,IAAI;IACjB,eAAe,EAAE,IAAI;CACtB,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA;AAE1C,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC,CAAA"}
|
package/dist/global-state.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* LiveStore currently relies on some global state in order to simplify the end-user API.
|
|
4
|
-
* This however also has the downside that LiveStore can't be used in multiple instances in the same app.
|
|
5
|
-
* It could possibly also lead to some other problems.
|
|
6
|
-
*
|
|
7
|
-
* We should find some better way to do this and ideally remove this global state.
|
|
8
|
-
*
|
|
9
|
-
* Another approach could be to use the global state by default but provide an additional way to let the user
|
|
10
|
-
* explicitly pass instances of state below into the LiveStore constructors.
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
export declare const globalReactivityGraph: import("./live-queries/base-class.js").ReactivityGraph;
|
|
14
|
-
//# sourceMappingURL=global-state.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"global-state.d.ts","sourceRoot":"","sources":["../src/global-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,eAAO,MAAM,qBAAqB,wDAEjC,CAAA"}
|
package/dist/global-state.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* LiveStore currently relies on some global state in order to simplify the end-user API.
|
|
4
|
-
* This however also has the downside that LiveStore can't be used in multiple instances in the same app.
|
|
5
|
-
* It could possibly also lead to some other problems.
|
|
6
|
-
*
|
|
7
|
-
* We should find some better way to do this and ideally remove this global state.
|
|
8
|
-
*
|
|
9
|
-
* Another approach could be to use the global state by default but provide an additional way to let the user
|
|
10
|
-
* explicitly pass instances of state below into the LiveStore constructors.
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
import { GlobalValue } from '@livestore/utils/effect';
|
|
14
|
-
import { makeReactivityGraph } from './live-queries/base-class.js';
|
|
15
|
-
export const globalReactivityGraph = GlobalValue.globalValue('livestore-global-reactivityGraph', () => makeReactivityGraph());
|
|
16
|
-
//# sourceMappingURL=global-state.js.map
|
package/dist/global-state.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"global-state.js","sourceRoot":"","sources":["../src/global-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAErD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AAElE,MAAM,CAAC,MAAM,qBAAqB,GAAG,WAAW,CAAC,WAAW,CAAC,kCAAkC,EAAE,GAAG,EAAE,CACpG,mBAAmB,EAAE,CACtB,CAAA"}
|