@procedures/sqlite 0.60.0 → 0.61.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.md +84 -183
  3. package/dist/engines.d.ts +31 -31
  4. package/dist/engines.d.ts.map +1 -1
  5. package/dist/engines.js +35 -78
  6. package/dist/engines.js.map +1 -1
  7. package/dist/index.d.ts +3 -5
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +3 -7
  10. package/dist/index.js.map +1 -1
  11. package/dist/load.d.ts +9 -0
  12. package/dist/load.d.ts.map +1 -0
  13. package/dist/load.js +11 -0
  14. package/dist/load.js.map +1 -0
  15. package/dist/module.d.ts.map +1 -1
  16. package/dist/module.js +104 -62
  17. package/dist/module.js.map +1 -1
  18. package/dist/procedures/db/backup.d.ts +5 -7
  19. package/dist/procedures/db/backup.d.ts.map +1 -1
  20. package/dist/procedures/db/backup.js +22 -27
  21. package/dist/procedures/db/backup.js.map +1 -1
  22. package/dist/procedures/db/migrate.d.ts +1 -1
  23. package/dist/procedures/db/migrate.d.ts.map +1 -1
  24. package/dist/procedures/db/migrate.js +32 -38
  25. package/dist/procedures/db/migrate.js.map +1 -1
  26. package/dist/procedures/db/schema.d.ts.map +1 -1
  27. package/dist/procedures/db/schema.js +8 -10
  28. package/dist/procedures/db/schema.js.map +1 -1
  29. package/dist/procedures/db/shared.d.ts +75 -10
  30. package/dist/procedures/db/shared.d.ts.map +1 -1
  31. package/dist/procedures/db/shared.js +148 -53
  32. package/dist/procedures/db/shared.js.map +1 -1
  33. package/dist/procedures/db/tables.d.ts.map +1 -1
  34. package/dist/procedures/db/tables.js +5 -7
  35. package/dist/procedures/db/tables.js.map +1 -1
  36. package/dist/procedures/db/transaction.d.ts +3 -4
  37. package/dist/procedures/db/transaction.d.ts.map +1 -1
  38. package/dist/procedures/db/transaction.js +18 -26
  39. package/dist/procedures/db/transaction.js.map +1 -1
  40. package/dist/storage.d.ts +18 -29
  41. package/dist/storage.d.ts.map +1 -1
  42. package/dist/storage.js +32 -118
  43. package/dist/storage.js.map +1 -1
  44. package/dist/types.d.ts +1 -1
  45. package/dist/types.d.ts.map +1 -1
  46. package/dist/types.js +1 -1
  47. package/dist/types.js.map +1 -1
  48. package/package.json +8 -10
  49. package/src/engines.ts +50 -132
  50. package/src/index.ts +3 -31
  51. package/src/load.ts +15 -0
  52. package/src/module.ts +128 -84
  53. package/src/procedures/db/backup.ts +21 -27
  54. package/src/procedures/db/migrate.ts +35 -40
  55. package/src/procedures/db/schema.ts +10 -12
  56. package/src/procedures/db/shared.ts +178 -50
  57. package/src/procedures/db/tables.ts +5 -7
  58. package/src/procedures/db/transaction.ts +17 -24
  59. package/src/storage.ts +39 -136
  60. package/src/types.ts +2 -2
@@ -1,23 +1,126 @@
1
1
  /**
2
- * The helpers of the sqlite.* procedures of roadmap R44.
2
+ * The helpers of the sqlite.* and logs.* procedures. Each procedure opens the file through the engine of
3
+ * `@mark1russell7/sqlite`: `openDatabase` on `node:sqlite`, one connection for each call.
4
+ *
5
+ * - A connection that runs the SQL of a caller gets `confineToFile`: the SQL works only on its file. The guard needs
6
+ * Node.js 24.10 or later. Before it, the call throws `ConfineUnavailableError` (`code: "CONFINE_UNAVAILABLE"`) before
7
+ * it opens the file.
8
+ * - The open does not change the journal mode of a file: a file in WAL mode stays in WAL mode, and another file stays in
9
+ * its mode.
10
+ * - A write waits for the lock of another connection for `BUSY_TIMEOUT_MS`.
3
11
  */
4
12
  import { existsSync } from "node:fs";
13
+ import { MEMORY_PATH } from "../../engines.js";
14
+ import { loadSqlite } from "../../load.js";
5
15
  import { DEFAULT_DB_PATH } from "../../types.js";
16
+ /** The time that a call waits for the lock of another connection, in milliseconds. */
17
+ export const BUSY_TIMEOUT_MS = 5000;
6
18
  /** The database file of an input: `dbPath`, or the CLI log database. */
7
19
  export function databasePath(dbPath) {
8
20
  return dbPath ?? DEFAULT_DB_PATH;
9
21
  }
10
- /**
11
- * This function throws ENOENT for a database file that does not exist. A procedure that only
12
- * reads uses it: sql.js opens a missing file as an empty database, so a wrong path gave no tables.
13
- */
22
+ /** This function throws ENOENT for a database file that does not exist. */
14
23
  export function requireDatabaseFile(procedure, path) {
15
- if (path === ":memory:" || existsSync(path))
24
+ if (path === MEMORY_PATH || existsSync(path))
16
25
  return;
17
26
  const error = new Error(`${procedure}: the database file does not exist: ${path}`);
18
27
  error.code = "ENOENT";
19
28
  throw error;
20
29
  }
30
+ /** True when this Node.js has the guard, false when it does not, undefined before the first check. */
31
+ let confineAvailable;
32
+ /**
33
+ * This function tells if this Node.js has the guard `confineToFile`. It tries the guard one time on a database in
34
+ * memory. The procedures and their tests use this one check.
35
+ */
36
+ export function isConfineAvailable(sqlite) {
37
+ if (confineAvailable === undefined) {
38
+ const probe = sqlite.openDatabase(MEMORY_PATH, { wal: false });
39
+ try {
40
+ sqlite.confineToFile(probe);
41
+ confineAvailable = true;
42
+ }
43
+ catch (error) {
44
+ if (!(error instanceof sqlite.ConfineUnavailableError))
45
+ throw error;
46
+ confineAvailable = false;
47
+ }
48
+ finally {
49
+ probe.close();
50
+ }
51
+ }
52
+ return confineAvailable;
53
+ }
54
+ /** This function throws `ConfineUnavailableError` when this Node.js has no guard, before the call opens its file. */
55
+ function checkConfine(sqlite) {
56
+ if (!isConfineAvailable(sqlite))
57
+ throw new sqlite.ConfineUnavailableError();
58
+ }
59
+ /**
60
+ * This function opens the database of a call, gives it to the work, and closes it. The work is synchronous, so no
61
+ * other call of this process uses the connection.
62
+ */
63
+ export async function withDatabase(path, mode, work) {
64
+ const sqlite = await loadSqlite();
65
+ if (mode.callerSql)
66
+ checkConfine(sqlite);
67
+ let memory = path === MEMORY_PATH;
68
+ if (!memory && !existsSync(path)) {
69
+ if (mode.missing === "error")
70
+ requireDatabaseFile(mode.procedure, path);
71
+ else if (mode.missing === "empty")
72
+ memory = true;
73
+ }
74
+ const db = sqlite.openDatabase(memory ? MEMORY_PATH : path, {
75
+ wal: false,
76
+ busyTimeoutMs: BUSY_TIMEOUT_MS,
77
+ makeFolder: !memory && mode.missing === "make",
78
+ });
79
+ try {
80
+ if (mode.queryOnly)
81
+ db.exec("PRAGMA query_only = 1");
82
+ if (mode.callerSql)
83
+ sqlite.confineToFile(db);
84
+ return work(db, sqlite);
85
+ }
86
+ finally {
87
+ db.close();
88
+ }
89
+ }
90
+ /**
91
+ * This function gives the values of the `?` placeholders. A boolean becomes 1 or 0, and an undefined value becomes
92
+ * null. Another value is an error: an object would bind as named parameters.
93
+ */
94
+ export function toSqlParams(params, label) {
95
+ return (params ?? []).map((value, index) => {
96
+ if (value === null || value === undefined)
97
+ return null;
98
+ if (typeof value === "boolean")
99
+ return value ? 1 : 0;
100
+ if (typeof value === "number" || typeof value === "string" || typeof value === "bigint" || value instanceof Uint8Array)
101
+ return value;
102
+ throw new TypeError(`${label}: params[${index}] is ${Array.isArray(value) ? "an array" : `a value of the type ${typeof value}`}. Give a number, a string, a boolean or null.`);
103
+ });
104
+ }
105
+ /** The rows of one statement, as objects. */
106
+ export function rowsOf(db, sql, params = []) {
107
+ return db.prepare(sql).all(...params);
108
+ }
109
+ /** The number of rows that the connection changed since it opened. */
110
+ export function totalChanges(db) {
111
+ return Number(rowsOf(db, "SELECT total_changes() AS n")[0]?.n ?? 0);
112
+ }
113
+ /** This function runs one statement to its end, and gives its rows when it has columns. */
114
+ export function runStatement(statement, params) {
115
+ if (statement.columns().length > 0)
116
+ return statement.all(...params);
117
+ statement.run(...params);
118
+ return undefined;
119
+ }
120
+ /** The text of an error. */
121
+ export function errorText(error) {
122
+ return error instanceof Error ? error.message : String(error);
123
+ }
21
124
  /** The statements that control a transaction, which the procedures run themselves. */
22
125
  const TRANSACTION_CONTROL = /^(BEGIN|COMMIT|END|ROLLBACK|SAVEPOINT|RELEASE)\b/i;
23
126
  /** The SQL of a statement without its leading spaces and comments. */
@@ -42,64 +145,56 @@ function withoutLeadingComments(sql) {
42
145
  export function controlsTransaction(sql) {
43
146
  return TRANSACTION_CONTROL.test(withoutLeadingComments(sql));
44
147
  }
45
- function totalChanges(db) {
46
- return Number(db.exec("SELECT total_changes()")[0]?.values[0]?.[0] ?? 0);
47
- }
48
148
  /**
49
- * This function runs the statements of one SQL text in order, and gives one result for the text.
50
- * The params bind to the first statement, so a text with params must hold one statement. A
51
- * statement that controls a transaction is refused: the caller owns the transaction.
149
+ * This function runs the statements of one SQL text in order, and gives one result for the text. The params bind to the
150
+ * first statement, so a text with params must hold one statement.
151
+ *
152
+ * - With `control: "refuse"` (the default), the text runs in the transaction of the caller, and a statement that
153
+ * controls a transaction is an error.
154
+ * - With `control: "allow"`, the text controls its own transactions.
52
155
  */
53
- export function runStatements(db, sql, params, label) {
156
+ export function runStatements(sqlite, db, sql, params, label, control = "refuse") {
54
157
  const before = totalChanges(db);
55
158
  const result = { changes: 0 };
56
159
  let count = 0;
57
- const iterator = db.iterateStatements(sql);
58
- try {
59
- for (let step = iterator.next(); !step.done; step = iterator.next()) {
60
- const statement = step.value;
61
- try {
62
- count++;
63
- if (count > 1 && params.length > 0) {
64
- throw new Error(`${label}: the params bind to one statement, and the SQL has several`);
65
- }
66
- if (controlsTransaction(statement.getSQL())) {
67
- throw new Error(`${label}: the procedure runs the transaction: BEGIN, COMMIT, ROLLBACK, SAVEPOINT and RELEASE are refused`);
68
- }
69
- if (count === 1 && params.length > 0)
70
- statement.bind(params);
71
- if (statement.getColumnNames().length > 0) {
72
- const rows = [];
73
- while (statement.step())
74
- rows.push(statement.getAsObject());
75
- result.rows = rows;
76
- }
77
- else {
78
- while (statement.step()) {
79
- // A statement without columns gives no rows: one step runs it
80
- }
81
- }
82
- }
83
- finally {
84
- statement.free();
85
- }
160
+ for (const statement of sqlite.eachStatement(db, sql)) {
161
+ count++;
162
+ if (count > 1 && params.length > 0) {
163
+ throw new Error(`${label}: the params bind to one statement, and the SQL has several. Send one statement for each call.`);
86
164
  }
87
- }
88
- catch (error) {
89
- // Read the iterator to its end: that frees its copy of the SQL (it only prepares the rest)
90
- try {
91
- while (!iterator.next().done) {
92
- // Prepare only
93
- }
94
- }
95
- catch {
96
- // A later statement did not prepare: the iterator ended
165
+ if (control === "refuse" && controlsTransaction(statement.sourceSQL)) {
166
+ throw new Error(`${label}: the procedure runs the transaction: BEGIN, COMMIT, ROLLBACK, SAVEPOINT and RELEASE are refused`);
97
167
  }
98
- throw error;
168
+ const rows = runStatement(statement, count === 1 ? params : []);
169
+ if (rows)
170
+ result.rows = rows;
99
171
  }
100
172
  if (count === 0)
101
173
  throw new Error(`${label}: the SQL has no statement`);
102
174
  result.changes = totalChanges(db) - before;
103
175
  return result;
104
176
  }
177
+ /**
178
+ * This function counts the statements of a SQL text up to two, and runs none. It compiles the first statement and asks
179
+ * `eachStatement` for the second. A second statement that does not compile before the first one runs, for example an
180
+ * `INSERT` into a table that the first one makes, also counts.
181
+ */
182
+ export function countStatements(sqlite, db, sql) {
183
+ const statements = sqlite.eachStatement(db, sql);
184
+ try {
185
+ const first = statements.next();
186
+ if (first.done)
187
+ return { count: 0, firstControls: false };
188
+ const firstControls = controlsTransaction(first.value.sourceSQL);
189
+ try {
190
+ return { count: statements.next().done ? 1 : 2, firstControls };
191
+ }
192
+ catch {
193
+ return { count: 2, firstControls };
194
+ }
195
+ }
196
+ finally {
197
+ statements.return(undefined);
198
+ }
199
+ }
105
200
  //# sourceMappingURL=shared.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/procedures/db/shared.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,wEAAwE;AACxE,MAAM,UAAU,YAAY,CAAC,MAA0B;IACrD,OAAO,MAAM,IAAI,eAAe,CAAC;AACnC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAAiB,EAAE,IAAY;IACj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AE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;QAC1D,MAAM,aAAa,GAAG,mBAAmB,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACjE,IAAI,CAAC;YACH,OAAO,EAAE,KAAK,EAAE,UAAU,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC;QAClE,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC;QACrC,CAAC;IACH,CAAC;YAAS,CAAC;QACT,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../../src/procedures/db/tables.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAe,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGjF;;GAEG;AACH,wBAAsB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAY5E"}
1
+ {"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../../src/procedures/db/tables.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAe,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGjF;;GAEG;AACH,wBAAsB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAW5E"}
@@ -4,19 +4,17 @@
4
4
  * The tables and the views of a database, without the internal `sqlite_` tables. The connection
5
5
  * is read only (PRAGMA query_only), and a missing file is an error: it does not make one.
6
6
  */
7
- import { query, withConnection } from "@mark1russell7/docker-sqlite";
8
- import { databasePath, requireDatabaseFile } from "./shared.js";
7
+ import { databasePath, rowsOf, withDatabase } from "./shared.js";
9
8
  /**
10
9
  * The tables and views of a database
11
10
  */
12
11
  export async function dbTables(input) {
13
12
  const path = databasePath(input.dbPath);
14
- requireDatabaseFile("sqlite.tables", path);
15
13
  const types = input.views === false ? "('table')" : "('table', 'view')";
16
- return withConnection({ dbPath: path }, (db) => {
17
- db.run("PRAGMA query_only = 1");
18
- const result = query(db, `SELECT name, type, sql FROM sqlite_master WHERE type IN ${types} AND name NOT LIKE 'sqlite\\_%' ESCAPE '\\' ORDER BY name`);
19
- return { tables: result.rows.map((row) => ({ name: row.name, type: row.type, sql: row.sql ?? null })) };
14
+ const mode = { procedure: "sqlite.tables", missing: "error", queryOnly: true, callerSql: false };
15
+ return withDatabase(path, mode, (db) => {
16
+ const rows = rowsOf(db, `SELECT name, type, sql FROM sqlite_master WHERE type IN ${types} AND name NOT LIKE 'sqlite\\_%' ESCAPE '\\' ORDER BY name`);
17
+ return { tables: rows.map((row) => ({ name: row.name, type: row.type, sql: row.sql ?? null })) };
20
18
  });
21
19
  }
22
20
  //# sourceMappingURL=tables.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tables.js","sourceRoot":"","sources":["../../../src/procedures/db/tables.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAErE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEhE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,KAAoB;IACjD,MAAM,IAAI,GAAG,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACxC,mBAAmB,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;IAC3C,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,mBAAmB,CAAC;IACxE,OAAO,cAAc,CAAC,EAAE,MAAM,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AE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;IACnG,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,10 +1,9 @@
1
1
  /**
2
2
  * sqlite.transaction procedure (roadmap R44)
3
3
  *
4
- * The statements of the input run in order in one transaction. When one fails, the procedure
5
- * rolls back the transaction and does not save the file: the database stays as it was. A
6
- * statement that gives rows (SELECT, or RETURNING) gives them in its result, so a later
7
- * statement can follow an earlier one in the same transaction.
4
+ * The statements of the input run in order in one `BEGIN IMMEDIATE` transaction. When one fails, the procedure rolls back
5
+ * the transaction: the database stays as it was. A statement that gives rows (SELECT, or RETURNING) gives them in its
6
+ * result, so a later statement can follow an earlier one in the same transaction.
8
7
  */
9
8
  import type { DbTransactionInput, DbTransactionOutput } from "../../types.js";
10
9
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../src/procedures/db/transaction.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAqB,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAGjG;;GAEG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CA0B3F"}
1
+ {"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../src/procedures/db/transaction.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAqB,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAGjG;;GAEG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAqB3F"}
@@ -1,42 +1,34 @@
1
1
  /**
2
2
  * sqlite.transaction procedure (roadmap R44)
3
3
  *
4
- * The statements of the input run in order in one transaction. When one fails, the procedure
5
- * rolls back the transaction and does not save the file: the database stays as it was. A
6
- * statement that gives rows (SELECT, or RETURNING) gives them in its result, so a later
7
- * statement can follow an earlier one in the same transaction.
4
+ * The statements of the input run in order in one `BEGIN IMMEDIATE` transaction. When one fails, the procedure rolls back
5
+ * the transaction: the database stays as it was. A statement that gives rows (SELECT, or RETURNING) gives them in its
6
+ * result, so a later statement can follow an earlier one in the same transaction.
8
7
  */
9
- import { withConnection } from "@mark1russell7/docker-sqlite";
10
- import { databasePath, runStatements } from "./shared.js";
8
+ import { databasePath, errorText, runStatements, toSqlParams, withDatabase } from "./shared.js";
11
9
  /**
12
10
  * Run statements in one transaction
13
11
  */
14
12
  export async function dbTransaction(input) {
15
- return withConnection({ dbPath: databasePath(input.dbPath) }, (db) => {
16
- db.run("BEGIN");
13
+ const mode = { procedure: "sqlite.transaction", missing: "make", queryOnly: false, callerSql: true };
14
+ return withDatabase(databasePath(input.dbPath), mode, (db, sqlite) => {
17
15
  const results = [];
18
16
  try {
19
- input.statements.forEach((statement, index) => {
20
- const label = `sqlite.transaction: statements[${index}]`;
21
- try {
22
- results.push(runStatements(db, statement.sql, statement.params ?? [], label));
23
- }
24
- catch (error) {
25
- const message = error instanceof Error ? error.message : String(error);
26
- throw new Error(message.startsWith(label) ? message : `${label}: ${message}`);
27
- }
17
+ sqlite.transaction(db, () => {
18
+ input.statements.forEach((statement, index) => {
19
+ const label = `sqlite.transaction: statements[${index}]`;
20
+ try {
21
+ results.push(runStatements(sqlite, db, statement.sql, toSqlParams(statement.params, label), label));
22
+ }
23
+ catch (error) {
24
+ const message = errorText(error);
25
+ throw new Error(message.startsWith(label) ? message : `${label}: ${message}`);
26
+ }
27
+ });
28
28
  });
29
- db.run("COMMIT");
30
29
  }
31
30
  catch (error) {
32
- try {
33
- db.run("ROLLBACK");
34
- }
35
- catch {
36
- // SQLite ended the transaction already (an ON CONFLICT ROLLBACK)
37
- }
38
- const message = error instanceof Error ? error.message : String(error);
39
- throw new Error(`${message}. The transaction was rolled back.`);
31
+ throw new Error(`${errorText(error)}. The transaction was rolled back.`);
40
32
  }
41
33
  return { results, changes: results.reduce((sum, result) => sum + result.changes, 0) };
42
34
  });
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../src/procedures/db/transaction.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE1D;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,KAAyB;IAC3D,OAAO,cAAc,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE;QACnE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAChB,MAAM,OAAO,GAAwB,EAAE,CAAC;QACxC,IAAI,CAAC;YACH,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE;gBAC5C,MAAM,KAAK,GAAG,kCAAkC,KAAK,GAAG,CAAC;gBACzD,IAAI,CAAC;oBACH,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,MAAM,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;gBAChF,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;oBACvE,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAA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EAAE,CAAC;QACxC,IAAI,CAAC;YACH,MAAM,CAAC,WAAW,CAAC,EAAE,EAAE,GAAG,EAAE;gBAC1B,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE;oBAC5C,MAAM,KAAK,GAAG,kCAAkC,KAAK,GAAG,CAAC;oBACzD,IAAI,CAAC;wBACH,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE,EAAE,SAAS,CAAC,GAAG,EAAE,WAAW,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;oBACtG,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;wBACf,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;wBACjC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,OAAO,EAAE,CAAC,CAAC;oBAChF,CAAC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;QAC3E,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,GAAG,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC;IACxF,CAAC,CAAC,CAAC;AACL,CAAC"}
package/dist/storage.d.ts CHANGED
@@ -5,11 +5,9 @@
5
5
  * or `:memory:`. It implements `CollectionStorage` of `@procedures/client`, so a
6
6
  * `ProcedureServer`, an `ApiStorage` server and a `HybridStorage` can use it.
7
7
  *
8
- * - The storage has two engines (the option `engine`). The engine `node` is `node:sqlite` of
9
- * Node.js: it writes only the changed pages of the file. The engine `sqljs` is sql.js (SQLite in
10
- * WebAssembly) through `@mark1russell7/docker-sqlite`: it keeps the database in memory and
11
- * writes the whole file after a write. The default `auto` uses `node` when Node.js has it.
12
- * - The two engines use the same file format: a file of one engine opens with the other.
8
+ * - The engine is `node:sqlite` of Node.js, through `@mark1russell7/sqlite`. It writes only the
9
+ * changed pages of the file. Version 0.61.0 removed the engine `sqljs`, and a file that it wrote
10
+ * opens with its items and its versions.
13
11
  * - The table of a collection has the columns `id` (the key) and `value` (the JSON text of the
14
12
  * item). A value goes through `JSON.stringify` and `JSON.parse`.
15
13
  * - A change log gives `getChangesSince()`. The table `_storage_log` has the last change of each
@@ -47,22 +45,14 @@ export interface SqliteStorageOptions<T = unknown> {
47
45
  */
48
46
  maxTombstones?: number;
49
47
  /**
50
- * The SQLite engine.
51
- *
52
- * - `node`: the module `node:sqlite` of Node.js 22.13 or later. It writes only the changes, and
53
- * the file is in WAL mode. Two processes can use one file.
54
- * - `sqljs`: sql.js, SQLite in WebAssembly. It keeps the database in memory, and it writes the
55
- * whole file after a write.
56
- * - `auto`: `node` when Node.js has `node:sqlite`, and else `sqljs`.
57
- *
58
- * The storages of one file in one process share one database, and thus one engine. The first
59
- * storage of the file sets it. A storage with another engine than `auto` refuses a database
60
- * of the other engine.
48
+ * The SQLite engine. `auto` and `node` both use the module `node:sqlite` of Node.js 22.13 or
49
+ * later. It writes only the changes, and the file is in WAL mode. Two processes can use one file.
50
+ * Version 0.61.0 removed the engine `sqljs`: the constructor refuses it with a `TypeError`.
61
51
  * @default "auto"
62
52
  */
63
53
  engine?: SqliteEngine;
64
54
  /**
65
- * The time that a write of the engine `node` waits for the lock of another process, for example
55
+ * The time that a write waits for the lock of another process, for example
66
56
  * `seconds(5)`. After it, the write fails with the error `database is locked`. The first
67
57
  * storage of a file sets it.
68
58
  * @default 5 seconds
@@ -96,7 +86,7 @@ export declare function checkTableName(name: unknown): string;
96
86
  * await users.set("123", { id: "123", name: "John" });
97
87
  * const user = await users.get("123"); // { id: "123", name: "John" }
98
88
  * const changes = await users.getChangesSince(); // { version, full: true, changed, deleted: [] }
99
- * await users.getEngine(); // "node" on Node.js 22.13 or later, else "sqljs"
89
+ * await users.getEngine(); // "node"
100
90
  * await users.close();
101
91
  * ```
102
92
  */
@@ -156,16 +146,16 @@ export declare class SqliteStorage<T> implements CollectionStorage<T> {
156
146
  /** This method deletes several items in one transaction. */
157
147
  deleteBatch(ids: string[]): Promise<number>;
158
148
  getBatch(ids: string[]): Promise<Map<string, T>>;
159
- /** The engine that the storage uses: `node` or `sqljs`. With the option `auto`, the open decides it. */
149
+ /** The engine that the storage uses: `node`. */
160
150
  getEngine(): Promise<SqliteEngineName>;
161
151
  /**
162
- * This method writes the database file. Each write ends after its file write already, so a
163
- * caller needs it only after a failed file write of the engine `sqljs`. The engine `node`
164
- * writes each change at its commit.
152
+ * This method does no work: each write is in the file at the commit of its transaction. It
153
+ * rejects after `close()`. It is the optional method `flush` of `CollectionStorage`, which the
154
+ * drain of a procedure server calls.
165
155
  */
166
156
  flush(): Promise<void>;
167
157
  /**
168
- * This method writes the file and releases the database. The items stay in the file. A new
158
+ * This method releases the database. The items stay in the file. A new
169
159
  * storage of the same file and table reads them, and the versions of this storage stay valid.
170
160
  * After `close()`, each operation rejects, and a second `close()` does nothing.
171
161
  */
@@ -190,13 +180,12 @@ export declare class SqliteStorage<T> implements CollectionStorage<T> {
190
180
  private entries;
191
181
  private counter;
192
182
  /**
193
- * One write: the change in a transaction with the change log, then the file write of the engine
194
- * `sqljs`. `next` gives the next number of the change log. A write that changes nothing writes
195
- * no file.
183
+ * One write: the change in a transaction with the change log. `next` gives the next number of
184
+ * the change log.
196
185
  *
197
- * Before the first write, the engine `node` keeps the database of a missing file in memory, with
198
- * no item. A write first tests its change there. When it changes an item, the storage makes the
199
- * file and runs the write in it.
186
+ * Before the first write, the storage keeps the database of a missing file in memory, with no
187
+ * item. A write first tests its change there. When it changes an item, the storage makes the
188
+ * file and runs the write in it. Thus a write that changes nothing makes no file.
200
189
  */
201
190
  private write;
202
191
  private runWrite;
@@ -1 +1 @@
1
- {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACrB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAOL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EAEtB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,KAAK,YAAY,EAAE,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAE5G,wCAAwC;AACxC,MAAM,WAAW,oBAAoB,CAAC,CAAC,GAAG,OAAO;IAC/C;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,QAAQ,CAAC;IACvB;;;;OAIG;IACH,WAAW,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAC7C;;;;;OAKG;IACH,SAAS,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;CAC3D;AAKD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAOpD;AAkRD;;;;;;;;;;;;GAYG;AACH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