@eltjs/elt-sqlite 0.3.1 → 0.3.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/computed-dataset.js +1 -2
- package/dist/sqlite-as-of-definitions.js +2 -1
- package/dist/sqlite-as-of.d.ts +0 -1
- package/dist/sqlite-as-of.js +1 -2
- package/dist/sqlite-column.js +2 -1
- package/dist/sqlite-file-store.js +1 -2
- package/dist/sqlite-history.js +1 -2
- package/dist/sqlite-identifiers.d.ts +1 -0
- package/dist/sqlite-identifiers.js +2 -0
- package/dist/sqlite-loads.js +2 -1
- package/dist/sqlite-table.js +2 -2
- package/dist/sqlite-views.js +1 -1
- package/dist/sqlite-writer.js +1 -2
- package/package.json +3 -3
package/dist/computed-dataset.js
CHANGED
|
@@ -6,11 +6,10 @@ import { DerivedDataset, } from '@eltjs/elt';
|
|
|
6
6
|
import { busyTimeout } from './open-destination.js';
|
|
7
7
|
import { SQLiteDestination } from './sqlite-destination.js';
|
|
8
8
|
import { SQLiteHistory, rowHash } from './sqlite-history.js';
|
|
9
|
-
import { identifiers } from './sqlite-identifiers.js';
|
|
9
|
+
import { identifiers, quote } from './sqlite-identifiers.js';
|
|
10
10
|
import { SQLiteLoad } from './sqlite-loads.js';
|
|
11
11
|
import { publishSQLiteViews } from './sqlite-views.js';
|
|
12
12
|
import { View } from './view.js';
|
|
13
|
-
const quote = (name) => `"${name.replaceAll('"', '""')}"`;
|
|
14
13
|
// The columns the dataset keeps on every output row beside the rule's own.
|
|
15
14
|
const engineColumns = {
|
|
16
15
|
input_hash: 'SHA-256 of the input the row was made from; the row is made again when its input changes.',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { open } from '@zukhruf/sqlite-open';
|
|
2
|
-
import { columnsOf, literal,
|
|
2
|
+
import { columnsOf, literal, readable, selectAsOf, storedViews, syncHistoryTables, syncHistoryViews, versioned, } from './sqlite-as-of.js';
|
|
3
|
+
import { quote } from './sqlite-identifiers.js';
|
|
3
4
|
/**
|
|
4
5
|
* The `CREATE TEMP VIEW` statements that show the file attached as `schema`
|
|
5
6
|
* as of a position, each relation as `${prefix}_${name}`, for a host that
|
package/dist/sqlite-as-of.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ type Versioned = {
|
|
|
4
4
|
readonly target: string;
|
|
5
5
|
readonly history: string;
|
|
6
6
|
};
|
|
7
|
-
export declare const quote: (name: string) => string;
|
|
8
7
|
/**
|
|
9
8
|
* The SQL functions that views of a position call to fail, by name: a host
|
|
10
9
|
* registers each one on the connection that reads the views, as
|
package/dist/sqlite-as-of.js
CHANGED
|
@@ -2,11 +2,10 @@ import { constants } from 'node:sqlite';
|
|
|
2
2
|
import { UnavailableError, open } from '@zukhruf/sqlite-open';
|
|
3
3
|
import { busyTimeout } from './open-destination.js';
|
|
4
4
|
import { histories } from './sqlite-history.js';
|
|
5
|
-
import { identifiers } from './sqlite-identifiers.js';
|
|
5
|
+
import { identifiers, quote } from './sqlite-identifiers.js';
|
|
6
6
|
import { committedAt, expiry, parsePosition, readNumbering, } from './sqlite-loads.js';
|
|
7
7
|
import { attempts, checks, coverage } from './sqlite-sync-history-schema.js';
|
|
8
8
|
import { version as rowHash } from './sqlite-writer.js';
|
|
9
|
-
export const quote = (name) => `"${name.replaceAll('"', '""')}"`;
|
|
10
9
|
/**
|
|
11
10
|
* The SQL functions that views of a position call to fail, by name: a host
|
|
12
11
|
* registers each one on the connection that reads the views, as
|
package/dist/sqlite-column.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FileRead, isCalendarDate, isTimestamp } from '@eltjs/elt';
|
|
2
|
+
import { quote } from './sqlite-identifiers.js';
|
|
2
3
|
// STRICT tables accept only these types, so dates and times are their
|
|
3
4
|
// canonical ISO text, which sorts in time order, and exact decimals are text.
|
|
4
5
|
const storageTypes = {
|
|
@@ -156,7 +157,7 @@ export class SQLiteColumn {
|
|
|
156
157
|
});
|
|
157
158
|
}
|
|
158
159
|
get quotedName() {
|
|
159
|
-
return
|
|
160
|
+
return quote(this.name);
|
|
160
161
|
}
|
|
161
162
|
// Original file bytes live in a chunk table; the column keeps the file's id.
|
|
162
163
|
get storesFile() {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createHash, hash } from 'node:crypto';
|
|
2
2
|
import { Declaration } from '@zukhruf/sqlite-drift';
|
|
3
|
-
import { identifiers } from './sqlite-identifiers.js';
|
|
4
|
-
const quote = (name) => `"${name.replaceAll('"', '""')}"`;
|
|
3
|
+
import { identifiers, quote } from './sqlite-identifiers.js';
|
|
5
4
|
const tablePrefix = '_elt_files_';
|
|
6
5
|
const chunks = '("file" INTEGER NOT NULL, "n" INTEGER NOT NULL, "bytes" BLOB NOT NULL, PRIMARY KEY ("file", "n")) STRICT';
|
|
7
6
|
// The highest id that each store gave a file it published. Ids only go up: a
|
package/dist/sqlite-history.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { createHash, hash } from 'node:crypto';
|
|
2
2
|
import { Declaration } from '@zukhruf/sqlite-drift';
|
|
3
3
|
import { SQLiteFileStore } from './sqlite-file-store.js';
|
|
4
|
-
import { identifiers } from './sqlite-identifiers.js';
|
|
5
|
-
const quote = (name) => `"${name.replaceAll('"', '""')}"`;
|
|
4
|
+
import { identifiers, quote } from './sqlite-identifiers.js';
|
|
6
5
|
export const histories = '_elt_histories';
|
|
7
6
|
// Which table keeps the replaced rows of which target, by the target's
|
|
8
7
|
// location, so a reader finds the history of each target.
|
|
@@ -17,3 +17,5 @@ class SQLiteIdentifiers extends Identifiers {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
export const identifiers = Object.freeze(new SQLiteIdentifiers());
|
|
20
|
+
// SQLite quotes an identifier in double quotes and doubles each one inside it.
|
|
21
|
+
export const quote = (name) => `"${name.replaceAll('"', '""')}"`;
|
package/dist/sqlite-loads.js
CHANGED
|
@@ -3,6 +3,7 @@ import { Declaration } from '@zukhruf/sqlite-drift';
|
|
|
3
3
|
import { transaction } from '@zukhruf/sqlite-transaction';
|
|
4
4
|
import { openDestination } from './open-destination.js';
|
|
5
5
|
import { expireHistory } from './sqlite-history.js';
|
|
6
|
+
import { quote } from './sqlite-identifiers.js';
|
|
6
7
|
const epochs = '"_elt_epoch"';
|
|
7
8
|
const loads = '"_elt_loads"';
|
|
8
9
|
const commits = '"_elt_commits"';
|
|
@@ -196,7 +197,7 @@ export function expiry(numbered, { epoch, number }) {
|
|
|
196
197
|
export function readNumbering(database, schema = 'main') {
|
|
197
198
|
if (schema === 'main' && numbering.drift(database) !== 'fits')
|
|
198
199
|
return null;
|
|
199
|
-
const file =
|
|
200
|
+
const file = quote(schema);
|
|
200
201
|
let row;
|
|
201
202
|
try {
|
|
202
203
|
row = database
|
package/dist/sqlite-table.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Target } from '@eltjs/elt';
|
|
2
2
|
import { SQLiteColumn, canonical } from './sqlite-column.js';
|
|
3
3
|
import { SQLiteColumns } from './sqlite-columns.js';
|
|
4
|
-
import { identifiers } from './sqlite-identifiers.js';
|
|
4
|
+
import { identifiers, quote } from './sqlite-identifiers.js';
|
|
5
5
|
// A reusable target definition. Empty columns mean infer from the Copy's
|
|
6
6
|
// stream. Its own name, its view's and its columns' follow the destination's
|
|
7
7
|
// naming rule, so a field SQLite would take for another still loads.
|
|
@@ -69,7 +69,7 @@ export class SQLiteTable extends Target {
|
|
|
69
69
|
return identifiers.key(this.name);
|
|
70
70
|
}
|
|
71
71
|
get quotedName() {
|
|
72
|
-
return
|
|
72
|
+
return quote(this.name);
|
|
73
73
|
}
|
|
74
74
|
get createTableSQL() {
|
|
75
75
|
return `CREATE TABLE IF NOT EXISTS ${this.definition(this.quotedName)}`;
|
package/dist/sqlite-views.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Declaration } from '@zukhruf/sqlite-drift';
|
|
|
2
2
|
import { transaction } from '@zukhruf/sqlite-transaction';
|
|
3
3
|
import { isReserved } from './reserved.js';
|
|
4
4
|
import { describe } from './sqlite-descriptions.js';
|
|
5
|
-
|
|
5
|
+
import { quote } from './sqlite-identifiers.js';
|
|
6
6
|
export function viewDefinition(view) {
|
|
7
7
|
return `CREATE VIEW ${quote(view.name)} AS ${view.query}`;
|
|
8
8
|
}
|
package/dist/sqlite-writer.js
CHANGED
|
@@ -6,9 +6,8 @@ import { openDestination } from './open-destination.js';
|
|
|
6
6
|
import { describe } from './sqlite-descriptions.js';
|
|
7
7
|
import { SQLiteFileStore } from './sqlite-file-store.js';
|
|
8
8
|
import { SQLiteHistory, rowHash } from './sqlite-history.js';
|
|
9
|
-
import { identifiers } from './sqlite-identifiers.js';
|
|
9
|
+
import { identifiers, quote } from './sqlite-identifiers.js';
|
|
10
10
|
import { SQLiteLoad } from './sqlite-loads.js';
|
|
11
|
-
const quote = (name) => `"${name.replaceAll('"', '""')}"`;
|
|
12
11
|
const writersTable = new Declaration([
|
|
13
12
|
'CREATE TABLE "_elt_writers" ("target" TEXT PRIMARY KEY, "writer" TEXT NOT NULL) STRICT',
|
|
14
13
|
], { rows: 'replace' });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eltjs/elt-sqlite",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "The SQLite destination of elt: each stream is a raw table in one SQLite file, with a reader view over it and a catalog of each table, view and column.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
|
-
"node": ">=
|
|
39
|
+
"node": ">=26"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@eltjs/elt": "^0.3.
|
|
42
|
+
"@eltjs/elt": "^0.3.2",
|
|
43
43
|
"@zukhruf/mutex": "^0.8.10",
|
|
44
44
|
"@zukhruf/sqlite-drift": "^0.8.10",
|
|
45
45
|
"@zukhruf/sqlite-open": "^0.8.10",
|