@voltro/sql-sqlite 0.80.0 → 0.82.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/CHANGELOG.md +1610 -6
- package/dist/index.d.ts +11 -1
- package/dist/index.js +47 -37
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -71,13 +71,14 @@ export declare class SqliteStore implements DataStore {
|
|
|
71
71
|
private readonly isRetryable;
|
|
72
72
|
private readonly systemName;
|
|
73
73
|
private readonly wrapTransaction;
|
|
74
|
+
private readonly fullText;
|
|
74
75
|
private readonly emitter;
|
|
75
76
|
private inflightTxns;
|
|
76
77
|
/** PERF-23 — counts EVERY eager JSON-agg → walker degradation and logs a
|
|
77
78
|
* rate-limited line. Instance-scoped so a second store in one process cannot
|
|
78
79
|
* silence this one's first warning. */
|
|
79
80
|
private readonly reportEagerFallback;
|
|
80
|
-
constructor(sql: SqlClient.SqlClient, runtime: ManagedRuntime.ManagedRuntime<SqlClient.SqlClient, never>, namespace?: QueryNamespace, sharedEmitter?: EventEmitter, isRetryable?: (e: unknown) => boolean, systemName?: string, wrapTransaction?: <A, E, R>(e: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R
|
|
81
|
+
constructor(sql: SqlClient.SqlClient, runtime: ManagedRuntime.ManagedRuntime<SqlClient.SqlClient, never>, namespace?: QueryNamespace, sharedEmitter?: EventEmitter, isRetryable?: (e: unknown) => boolean, systemName?: string, wrapTransaction?: <A, E, R>(e: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>, fullText?: 'fts5' | 'like');
|
|
81
82
|
/**
|
|
82
83
|
* Bind a per-request tenant namespace, returning a view that qualifies
|
|
83
84
|
* every table reference to `<namespace>.<table>`. The view SHARES this
|
|
@@ -86,6 +87,8 @@ export declare class SqliteStore implements DataStore {
|
|
|
86
87
|
* `attachNamespace` / the migrator's namespace fan-out.
|
|
87
88
|
*/
|
|
88
89
|
withNamespace(namespace: string | null): DataStore;
|
|
90
|
+
/** No FTS5 table on this engine (`fullText: 'like'`): the match runs as LIKE over the index's columns. */
|
|
91
|
+
private withFullTextMode;
|
|
89
92
|
/** Qualify a table to this view's namespace (no-op when unset). */
|
|
90
93
|
private nsT;
|
|
91
94
|
/**
|
|
@@ -271,6 +274,13 @@ export declare interface SqliteStoreOptions {
|
|
|
271
274
|
* store's DML (DDL paths keep plain BEGIN). Default: identity (sqlite).
|
|
272
275
|
*/
|
|
273
276
|
readonly wrapTransaction?: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
|
277
|
+
/**
|
|
278
|
+
* How `.matching()` runs. `'fts5'` (default): the migrator's FTS5 shadow
|
|
279
|
+
* table. `'like'`: a case-insensitive LIKE over the covered columns — for an
|
|
280
|
+
* engine without virtual tables (Turso's MVCC mode), where the migrator
|
|
281
|
+
* creates no FTS5 table.
|
|
282
|
+
*/
|
|
283
|
+
readonly fullText?: 'fts5' | 'like';
|
|
274
284
|
}
|
|
275
285
|
|
|
276
286
|
declare type TxnContext = Context.Tag.Service<typeof TransactionConnection>;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SqliteClient as e } from "@effect/sql-sqlite-node";
|
|
2
2
|
import { Config as t, Context as n, Effect as r, Layer as i, ManagedRuntime as a, Option as o } from "effect";
|
|
3
|
-
import { EagerCardinalityError as s, SQLITE_TRANSIENT_CODES as c, attachEagerLoads as l, attributionFields as u, bulkInsertLimitsFor as d, causeBranches as f, chunkRowsForInsert as p, coercePredicateForSqlite as m, compileEagerJson as h, compileJsonPatch as g, compilePredicate as _, compileRawFragment as v,
|
|
3
|
+
import { EagerCardinalityError as s, SQLITE_TRANSIENT_CODES as c, attachEagerLoads as l, attributionFields as u, bulkInsertLimitsFor as d, causeBranches as f, chunkRowsForInsert as p, coercePredicateForSqlite as m, compileEagerJson as h, compileJsonPatch as g, compilePredicate as _, compileRawFragment as v, compileRowProjection as y, compileSelect as b, decodeRowsFromSchema as x, encodeRowForSchema as S, externalChangeEvent as C, hasEagerLoads as w, isTableReactive as T, jsonPatchAssignments as ee, makeEagerFallbackReporter as te, makeTransactionAbortTracker as E, observeDbOp as D, qualifyTable as O, quoteIdent as k, raiseChangeListenerCeiling as A, recordsTable as j, requireTable as M, rowKeyColumns as N, runSavepoint as ne, runStoreTransaction as re, runWriteRecorders as ie, stampGeneratedId as P, stampGeneratedIds as F, upsertUpdatePatch as I, upsertUpdateValues as L, withCapturedAttribution as R } from "@voltro/database";
|
|
4
4
|
import { EventEmitter as z } from "node:events";
|
|
5
5
|
import { createLogger as B } from "@voltro/logger";
|
|
6
6
|
import { SqlClient as V, TransactionConnection as H } from "@effect/sql/SqlClient";
|
|
@@ -29,29 +29,39 @@ var U = (r) => e.layerConfig({
|
|
|
29
29
|
return t !== void 0 && K.has(t);
|
|
30
30
|
}), Y = (e) => J(e) ? "retry" : "noRetry", X = B({ scope: "voltro:sqlite" }), Z = async (e) => {
|
|
31
31
|
let t = e.tracerLayer ? i.mergeAll(e.sqlLayer, e.tracerLayer) : e.sqlLayer, n = a.make(t);
|
|
32
|
-
return new
|
|
33
|
-
},
|
|
32
|
+
return new se(await n.runPromise(V), n, null, void 0, e.isRetryable ?? J, e.systemName ?? "sqlite", e.wrapTransaction, e.fullText ?? "fts5");
|
|
33
|
+
}, ae = (e) => e, Q = (e) => m(e), oe = (e) => e.predicate === void 0 || e.predicate === null ? e : {
|
|
34
34
|
...e,
|
|
35
35
|
predicate: Q(e.predicate)
|
|
36
36
|
}, $ = (e, t) => {
|
|
37
|
-
let n =
|
|
37
|
+
let n = S(e, t), r = {};
|
|
38
38
|
for (let [e, t] of Object.entries(n)) r[e] = t instanceof Date ? t.toISOString() : typeof t == "boolean" ? +!!t : t;
|
|
39
39
|
return r;
|
|
40
|
-
},
|
|
40
|
+
}, se = class e {
|
|
41
41
|
sql;
|
|
42
42
|
runtime;
|
|
43
43
|
namespace;
|
|
44
44
|
isRetryable;
|
|
45
45
|
systemName;
|
|
46
46
|
wrapTransaction;
|
|
47
|
+
fullText;
|
|
47
48
|
emitter;
|
|
48
49
|
inflightTxns = 0;
|
|
49
50
|
reportEagerFallback;
|
|
50
|
-
constructor(e, t, n = null, r, i = J, a = "sqlite", o =
|
|
51
|
-
this.sql = e, this.runtime = t, this.namespace = n, this.isRetryable = i, this.systemName = a, this.wrapTransaction = o, this.emitter = r ?? new z(), A(this.emitter), this.reportEagerFallback =
|
|
51
|
+
constructor(e, t, n = null, r, i = J, a = "sqlite", o = ae, s = "fts5") {
|
|
52
|
+
this.sql = e, this.runtime = t, this.namespace = n, this.isRetryable = i, this.systemName = a, this.wrapTransaction = o, this.fullText = s, this.emitter = r ?? new z(), A(this.emitter), this.reportEagerFallback = te(X);
|
|
52
53
|
}
|
|
53
54
|
withNamespace(t) {
|
|
54
|
-
return t === this.namespace ? this : new e(this.sql, this.runtime, t, this.emitter, this.isRetryable, this.systemName, this.wrapTransaction);
|
|
55
|
+
return t === this.namespace ? this : new e(this.sql, this.runtime, t, this.emitter, this.isRetryable, this.systemName, this.wrapTransaction, this.fullText);
|
|
56
|
+
}
|
|
57
|
+
withFullTextMode(e) {
|
|
58
|
+
return this.fullText === "like" && e.fullTextSearch !== void 0 ? {
|
|
59
|
+
...e,
|
|
60
|
+
fullTextSearch: {
|
|
61
|
+
...e.fullTextSearch,
|
|
62
|
+
fallback: "like"
|
|
63
|
+
}
|
|
64
|
+
} : e;
|
|
55
65
|
}
|
|
56
66
|
nsT(e) {
|
|
57
67
|
return O(this.namespace, e);
|
|
@@ -61,12 +71,12 @@ var U = (r) => e.layerConfig({
|
|
|
61
71
|
await this.runtime.runPromise(n`ATTACH DATABASE ${r} AS ${n(e)}`);
|
|
62
72
|
}
|
|
63
73
|
async executeQuery(e, t, n) {
|
|
64
|
-
let i =
|
|
65
|
-
return
|
|
74
|
+
let i = b(oe(this.withFullTextMode(e)), this.sql, this.namespace), a = t ? r.provideService(i, H, t) : i, o = await D(this.systemName, "select", () => this.runtime.runPromise(a));
|
|
75
|
+
return x(o, e.table, "sqlite");
|
|
66
76
|
}
|
|
67
77
|
async executeInsert(e, t, n, i, a) {
|
|
68
78
|
t = P(e, t);
|
|
69
|
-
let o = this.sql, s = o`INSERT INTO ${o(this.nsT(e))} ${o.insert($(t, e))} RETURNING
|
|
79
|
+
let o = this.sql, s = o`INSERT INTO ${o(this.nsT(e))} ${o.insert($(t, e))} RETURNING ${y(e, o)}`, c = n ? r.provideService(s, H, n) : s, l = await this.runtime.runPromise(c), u = x(l, e, "sqlite")[0];
|
|
70
80
|
if (!u) throw Error(`SqliteStore.insert: no row returned for table '${e}'`);
|
|
71
81
|
return await this.routeEvent({
|
|
72
82
|
table: e,
|
|
@@ -76,7 +86,7 @@ var U = (r) => e.layerConfig({
|
|
|
76
86
|
}, i, n, a), u;
|
|
77
87
|
}
|
|
78
88
|
async executeUpdate(e, t, n, i, a, o) {
|
|
79
|
-
let s = this.sql, c = s`UPDATE ${s(this.nsT(e))} SET ${s.update($(n, e))} WHERE ${s.and(N(t).map(([e, t]) => s`${s(e)} = ${t}`))} RETURNING
|
|
89
|
+
let s = this.sql, c = s`UPDATE ${s(this.nsT(e))} SET ${s.update($(n, e))} WHERE ${s.and(N(t).map(([e, t]) => s`${s(e)} = ${t}`))} RETURNING ${y(e, s)}`, l = i ? r.provideService(c, H, i) : c, u = await this.runtime.runPromise(l), d = x(u, e, "sqlite")[0];
|
|
80
90
|
return d ? (await this.routeEvent({
|
|
81
91
|
table: e,
|
|
82
92
|
op: "update",
|
|
@@ -86,7 +96,7 @@ var U = (r) => e.layerConfig({
|
|
|
86
96
|
}
|
|
87
97
|
async executeInsertMany(e, t, n, i, a) {
|
|
88
98
|
if (t = F(e, t), t.length === 0) return [];
|
|
89
|
-
let o = this.sql, s = t.map((t) => $(t, e)), c = p(s, d("sqlite")), l = (t) => o`INSERT INTO ${o(this.nsT(e))} ${o.insert(t)} RETURNING
|
|
99
|
+
let o = this.sql, s = t.map((t) => $(t, e)), c = p(s, d("sqlite")), l = (t) => o`INSERT INTO ${o(this.nsT(e))} ${o.insert(t)} RETURNING ${y(e, o)}`, u;
|
|
90
100
|
if (c.length === 1) {
|
|
91
101
|
let e = l(c[0]), t = n ? r.provideService(e, H, n) : e;
|
|
92
102
|
u = await this.runtime.runPromise(t);
|
|
@@ -95,7 +105,7 @@ var U = (r) => e.layerConfig({
|
|
|
95
105
|
for (let t of c) e.push(...await this.runtime.runPromise(r.provideService(l(t), H, n)));
|
|
96
106
|
u = e;
|
|
97
107
|
} else u = await this.runtime.runPromise(o.withTransaction(r.map(r.forEach(c, l, { concurrency: 1 }), (e) => e.flat())));
|
|
98
|
-
let f =
|
|
108
|
+
let f = x(u, e, "sqlite");
|
|
99
109
|
for (let t of f) await this.routeEvent({
|
|
100
110
|
table: e,
|
|
101
111
|
op: "insert",
|
|
@@ -105,7 +115,7 @@ var U = (r) => e.layerConfig({
|
|
|
105
115
|
return f;
|
|
106
116
|
}
|
|
107
117
|
async executePatchJson(e, t, n, i, a, o, s, c) {
|
|
108
|
-
let l = this.sql, u = $(
|
|
118
|
+
let l = this.sql, u = $(ee(t, n, c), e), d = l.csv([g(l, "sqlite", n, i, l`${l(this.nsT(e))}.${l(n.split(".")[0])}`), ...Object.entries(u).map(([e, t]) => l`${l(e)} = ${t}`)]), f = l`UPDATE ${l(this.nsT(e))} SET ${d} WHERE ${l.and(N(t).map(([e, t]) => l`${l(e)} = ${t}`))} RETURNING ${y(e, l)}`, p = a ? r.provideService(f, H, a) : f, m = await this.runtime.runPromise(p), h = x(m, e, "sqlite")[0];
|
|
109
119
|
return h ? (await this.routeEvent({
|
|
110
120
|
table: e,
|
|
111
121
|
op: "update",
|
|
@@ -114,7 +124,7 @@ var U = (r) => e.layerConfig({
|
|
|
114
124
|
}, o, a, s), h) : null;
|
|
115
125
|
}
|
|
116
126
|
async executeDelete(e, t, n, i, a) {
|
|
117
|
-
let o = this.sql, s = o`DELETE FROM ${o(this.nsT(e))} WHERE ${o.and(N(t).map(([e, t]) => o`${o(e)} = ${t}`))} RETURNING
|
|
127
|
+
let o = this.sql, s = o`DELETE FROM ${o(this.nsT(e))} WHERE ${o.and(N(t).map(([e, t]) => o`${o(e)} = ${t}`))} RETURNING ${y(e, o)}`, c = n ? r.provideService(s, H, n) : s, l = await this.runtime.runPromise(c), u = x(l, e, "sqlite")[0];
|
|
118
128
|
return u ? (await this.routeEvent({
|
|
119
129
|
table: e,
|
|
120
130
|
op: "delete",
|
|
@@ -134,7 +144,7 @@ var U = (r) => e.layerConfig({
|
|
|
134
144
|
e = {
|
|
135
145
|
...u(r),
|
|
136
146
|
...e
|
|
137
|
-
}, j(e.table) && await
|
|
147
|
+
}, j(e.table) && await ie({
|
|
138
148
|
append: (e, t) => this.appendInTxn(e, t, n),
|
|
139
149
|
maxOf: (e, t, r) => this.maxInTxn(e, t, r, n)
|
|
140
150
|
}, {
|
|
@@ -144,7 +154,7 @@ var U = (r) => e.layerConfig({
|
|
|
144
154
|
prev: e.old,
|
|
145
155
|
traceId: e.traceId,
|
|
146
156
|
subjectId: e.subjectId
|
|
147
|
-
}),
|
|
157
|
+
}), T(e.table) && (t === null ? this.emitter.emit("change", e) : t.push(e));
|
|
148
158
|
}
|
|
149
159
|
async executeUpsert(e, t, n, i, a, o) {
|
|
150
160
|
let s = L(n);
|
|
@@ -152,19 +162,19 @@ var U = (r) => e.layerConfig({
|
|
|
152
162
|
let r = await this.findByConflict(e, t, n.conflictColumns, i);
|
|
153
163
|
return r ? await this.executeUpdate(e, r.id, I(t, r, n), i, a, o) ?? r : this.executeInsert(e, t, i, a, o);
|
|
154
164
|
}
|
|
155
|
-
let c = this.sql, l = n.conflictColumns.map((e) => c`${c(e)}`), u = Object.keys(t).filter((e) => t[e] !== void 0), d = n.update === void 0 ? u.filter((e) => e !== "id" && !n.conflictColumns.includes(e)) : n.update, f = $(s, e), p = [...d.filter((e) => !Object.hasOwn(s, e)).map((e) => c`${c(e)} = excluded.${c(e)}`), ...Object.entries(f).map(([e, t]) => c`${c(e)} = ${t}`)], m = p.length > 0 ? c.csv(p) : c`${c(n.conflictColumns[0])} = excluded.${c(n.conflictColumns[0])}`, h = c`INSERT INTO ${c(this.nsT(e))} ${c.insert($(t, e))} ON CONFLICT (${c.csv(l)}) DO UPDATE SET ${m} RETURNING
|
|
165
|
+
let c = this.sql, l = n.conflictColumns.map((e) => c`${c(e)}`), u = Object.keys(t).filter((e) => t[e] !== void 0), d = n.update === void 0 ? u.filter((e) => e !== "id" && !n.conflictColumns.includes(e)) : n.update, f = $(s, e), p = [...d.filter((e) => !Object.hasOwn(s, e)).map((e) => c`${c(e)} = excluded.${c(e)}`), ...Object.entries(f).map(([e, t]) => c`${c(e)} = ${t}`)], m = p.length > 0 ? c.csv(p) : c`${c(n.conflictColumns[0])} = excluded.${c(n.conflictColumns[0])}`, h = c`INSERT INTO ${c(this.nsT(e))} ${c.insert($(t, e))} ON CONFLICT (${c.csv(l)}) DO UPDATE SET ${m} RETURNING ${y(e, c)}`, g = i ? r.provideService(h, H, i) : h, _ = await this.runtime.runPromise(g), v = x(_, e, "sqlite")[0];
|
|
156
166
|
if (!v) throw Error(`SqliteStore.upsert: no row returned for table '${e}'`);
|
|
157
|
-
let
|
|
167
|
+
let b = t.id !== void 0 && t.id === v.id ? "insert" : "update";
|
|
158
168
|
return await this.routeEvent({
|
|
159
169
|
table: e,
|
|
160
|
-
op:
|
|
170
|
+
op: b,
|
|
161
171
|
old: null,
|
|
162
172
|
new: v
|
|
163
173
|
}, a, i, o), v;
|
|
164
174
|
}
|
|
165
175
|
async executeInsertIgnore(e, t, n, i, a, o) {
|
|
166
176
|
t = P(e, t);
|
|
167
|
-
let s = this.sql, c = n.conflictColumns.map((e) => s`${s(e)}`), l = s`INSERT INTO ${s(this.nsT(e))} ${s.insert($(t, e))} ON CONFLICT (${s.csv(c)}) DO NOTHING RETURNING
|
|
177
|
+
let s = this.sql, c = n.conflictColumns.map((e) => s`${s(e)}`), l = s`INSERT INTO ${s(this.nsT(e))} ${s.insert($(t, e))} ON CONFLICT (${s.csv(c)}) DO NOTHING RETURNING ${y(e, s)}`, u = i ? r.provideService(l, H, i) : l, d = await this.runtime.runPromise(u), f = x(d, e, "sqlite")[0];
|
|
168
178
|
if (f) return await this.routeEvent({
|
|
169
179
|
table: e,
|
|
170
180
|
op: "insert",
|
|
@@ -183,8 +193,8 @@ var U = (r) => e.layerConfig({
|
|
|
183
193
|
}
|
|
184
194
|
async findByConflict(e, t, n, i) {
|
|
185
195
|
if (n.length === 0) return;
|
|
186
|
-
let a = this.sql, o = n.map((e) => a`${a(e)} = ${t[e]}`), s = a`SELECT
|
|
187
|
-
return
|
|
196
|
+
let a = this.sql, o = n.map((e) => a`${a(e)} = ${t[e]}`), s = a`SELECT ${y(e, a)} FROM ${a(this.nsT(e))} WHERE ${a.and(o)} LIMIT 1`, c = i ? r.provideService(s, H, i) : s, l = await this.runtime.runPromise(c);
|
|
197
|
+
return x(l, e, "sqlite")[0];
|
|
188
198
|
}
|
|
189
199
|
query(e) {
|
|
190
200
|
return this.runWithEager(e, null);
|
|
@@ -197,7 +207,7 @@ var U = (r) => e.layerConfig({
|
|
|
197
207
|
return D(this.systemName, "raw", () => this.runtime.runPromise(i));
|
|
198
208
|
}
|
|
199
209
|
async runWithEager(e, t) {
|
|
200
|
-
if (!
|
|
210
|
+
if (!w(e)) return this.executeQuery(e, t);
|
|
201
211
|
let n = this.namespace === null ? h(e, this.sql, "sqlite") : null;
|
|
202
212
|
if (n !== null) try {
|
|
203
213
|
let e = t ? r.provideService(n.fragment, H, t) : n.fragment, i = await D(this.systemName, "select", () => this.runtime.runPromise(e));
|
|
@@ -256,8 +266,8 @@ var U = (r) => e.layerConfig({
|
|
|
256
266
|
return this.executeDeleteMany(e, t, null, null);
|
|
257
267
|
}
|
|
258
268
|
async executeUpdateMany(e, t, n, i, a, o) {
|
|
259
|
-
let s = this.sql, c = _(Q(n.where), s, this.namespace), l = s`UPDATE ${s(this.nsT(e))} SET ${s.update($(t, e))} WHERE ${c} RETURNING
|
|
260
|
-
for (let t of
|
|
269
|
+
let s = this.sql, c = _(Q(n.where), s, this.namespace), l = s`UPDATE ${s(this.nsT(e))} SET ${s.update($(t, e))} WHERE ${c} RETURNING ${y(e, s)}`, u = i ? r.provideService(l, H, i) : l, d = await D(this.systemName, "update", () => this.runtime.runPromise(u));
|
|
270
|
+
for (let t of x(d, e, "sqlite")) await this.routeEvent({
|
|
261
271
|
table: e,
|
|
262
272
|
op: "update",
|
|
263
273
|
old: null,
|
|
@@ -266,8 +276,8 @@ var U = (r) => e.layerConfig({
|
|
|
266
276
|
return d.length;
|
|
267
277
|
}
|
|
268
278
|
async executeDeleteMany(e, t, n, i, a) {
|
|
269
|
-
let o = this.sql, s = _(Q(t.where), o, this.namespace), c = o`DELETE FROM ${o(this.nsT(e))} WHERE ${s} RETURNING
|
|
270
|
-
for (let t of
|
|
279
|
+
let o = this.sql, s = _(Q(t.where), o, this.namespace), c = o`DELETE FROM ${o(this.nsT(e))} WHERE ${s} RETURNING ${y(e, o)}`, l = n ? r.provideService(c, H, n) : c, u = await D(this.systemName, "delete", () => this.runtime.runPromise(l));
|
|
280
|
+
for (let t of x(u, e, "sqlite")) await this.routeEvent({
|
|
271
281
|
table: e,
|
|
272
282
|
op: "delete",
|
|
273
283
|
old: t,
|
|
@@ -345,10 +355,10 @@ var U = (r) => e.layerConfig({
|
|
|
345
355
|
async transactional(e) {
|
|
346
356
|
this.inflightTxns++;
|
|
347
357
|
try {
|
|
348
|
-
return await
|
|
358
|
+
return await re({
|
|
349
359
|
...this.txnSpec("SqliteStore.transactional"),
|
|
350
360
|
work: e,
|
|
351
|
-
makeView: (e, t) => new
|
|
361
|
+
makeView: (e, t) => new ce(this, e, t)
|
|
352
362
|
});
|
|
353
363
|
} finally {
|
|
354
364
|
this.inflightTxns--;
|
|
@@ -377,7 +387,7 @@ var U = (r) => e.layerConfig({
|
|
|
377
387
|
};
|
|
378
388
|
}
|
|
379
389
|
injectExternalChange(e) {
|
|
380
|
-
|
|
390
|
+
T(e.table) && this.emitter.emit("change", C(e));
|
|
381
391
|
}
|
|
382
392
|
run(e) {
|
|
383
393
|
return this.runtime.runPromise(e);
|
|
@@ -396,18 +406,18 @@ var U = (r) => e.layerConfig({
|
|
|
396
406
|
async ping() {
|
|
397
407
|
await this.runtime.runPromise(this.sql`SELECT 1`);
|
|
398
408
|
}
|
|
399
|
-
},
|
|
409
|
+
}, ce = class {
|
|
400
410
|
parent;
|
|
401
411
|
txn;
|
|
402
412
|
attr;
|
|
403
413
|
events = [];
|
|
404
|
-
aborts =
|
|
414
|
+
aborts = E((e) => this.parent.transactionEndingFailure(e));
|
|
405
415
|
committed = !1;
|
|
406
416
|
constructor(e, t, n = void 0) {
|
|
407
417
|
this.parent = e, this.txn = t, this.attr = n;
|
|
408
418
|
}
|
|
409
419
|
savepoint(e) {
|
|
410
|
-
return
|
|
420
|
+
return ne({
|
|
411
421
|
tracker: this.aborts,
|
|
412
422
|
name: `voltro_sp_${++this.savepointCounter}`,
|
|
413
423
|
spelling: "standard",
|
|
@@ -476,7 +486,7 @@ var U = (r) => e.layerConfig({
|
|
|
476
486
|
this.events.length = 0;
|
|
477
487
|
}
|
|
478
488
|
}
|
|
479
|
-
},
|
|
489
|
+
}, le = {
|
|
480
490
|
id: "sqlite",
|
|
481
491
|
makeSqlLayer: (e) => G(e),
|
|
482
492
|
makeStore: (e) => Z(e),
|
|
@@ -484,4 +494,4 @@ var U = (r) => e.layerConfig({
|
|
|
484
494
|
retryFilter: Y
|
|
485
495
|
};
|
|
486
496
|
//#endregion
|
|
487
|
-
export { e as SqliteClient, W as connectionFromConfig, U as makeSqliteSqlLayer, G as makeSqliteSqlLayerFromConfig, Z as makeSqliteStore,
|
|
497
|
+
export { e as SqliteClient, W as connectionFromConfig, U as makeSqliteSqlLayer, G as makeSqliteSqlLayerFromConfig, Z as makeSqliteStore, le as sqliteDialect, Y as sqliteRetryFilter };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltro/sql-sqlite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.82.0",
|
|
4
4
|
"description": "SQLite dialect adapter for Voltro's cross-dialect DataStore (single-process; in-process change events).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"voltro",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@effect/sql": "^0.52.1",
|
|
37
37
|
"@effect/sql-sqlite-node": "^0.53.0",
|
|
38
|
-
"@voltro/database": "0.
|
|
39
|
-
"@voltro/logger": "0.
|
|
38
|
+
"@voltro/database": "0.82.0",
|
|
39
|
+
"@voltro/logger": "0.82.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"effect": "^3.22.2"
|