@molecule/api-database-duckdb 0.0.0-stage → 0.0.1-stage
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/LICENSE +202 -0
- package/README.md +772 -2
- package/dist/browser-guard.d.ts +2 -0
- package/dist/browser-guard.d.ts.map +1 -0
- package/dist/browser-guard.js +19 -0
- package/dist/browser-guard.js.map +1 -0
- package/dist/capabilities.d.ts +30 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +48 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/index.d.ts +115 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +169 -0
- package/dist/index.js.map +1 -0
- package/dist/instances.d.ts +73 -0
- package/dist/instances.d.ts.map +1 -0
- package/dist/instances.js +117 -0
- package/dist/instances.js.map +1 -0
- package/dist/lifecycle.d.ts +22 -0
- package/dist/lifecycle.d.ts.map +1 -0
- package/dist/lifecycle.js +45 -0
- package/dist/lifecycle.js.map +1 -0
- package/dist/migrator.d.ts +74 -0
- package/dist/migrator.d.ts.map +1 -0
- package/dist/migrator.js +172 -0
- package/dist/migrator.js.map +1 -0
- package/dist/pool.d.ts +40 -0
- package/dist/pool.d.ts.map +1 -0
- package/dist/pool.js +273 -0
- package/dist/pool.js.map +1 -0
- package/dist/queue.d.ts +48 -0
- package/dist/queue.d.ts.map +1 -0
- package/dist/queue.js +98 -0
- package/dist/queue.js.map +1 -0
- package/dist/secrets.d.ts +16 -0
- package/dist/secrets.d.ts.map +1 -0
- package/dist/secrets.js +25 -0
- package/dist/secrets.js.map +1 -0
- package/dist/sql-dialect.d.ts +92 -0
- package/dist/sql-dialect.d.ts.map +1 -0
- package/dist/sql-dialect.js +309 -0
- package/dist/sql-dialect.js.map +1 -0
- package/dist/store.d.ts +18 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +335 -0
- package/dist/store.js.map +1 -0
- package/dist/types.d.ts +57 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/dist/utilities.d.ts +119 -0
- package/dist/utilities.d.ts.map +1 -0
- package/dist/utilities.js +246 -0
- package/dist/utilities.js.map +1 -0
- package/package.json +87 -4
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for DuckDB operations.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { blobValue } from '@duckdb/node-api';
|
|
7
|
+
import { sqlCapabilities } from './capabilities.js';
|
|
8
|
+
import { parseCreateIndexStatement, referentialActionsIn, splitSqlColumns, splitSqlStatements, } from './sql-dialect.js';
|
|
9
|
+
/**
|
|
10
|
+
* The error this bond's translator throws when a migration needs a construct
|
|
11
|
+
* DuckDB cannot honour. Named and typed so a caller can tell a genuine dialect
|
|
12
|
+
* limit apart from malformed SQL, and report it without a migration run.
|
|
13
|
+
*
|
|
14
|
+
* The diagnostic itself is described by the core TYPE contract
|
|
15
|
+
* ({@link SqlCompatibilityIssue}); this class is the bond's own error
|
|
16
|
+
* construction, next to the translation that raises it.
|
|
17
|
+
*/
|
|
18
|
+
export class UnsupportedSqlFeatureError extends Error {
|
|
19
|
+
/** The construct's feature. */
|
|
20
|
+
feature;
|
|
21
|
+
/** The exact construct found in the migration. */
|
|
22
|
+
detail;
|
|
23
|
+
/** Where the statement came from, when known. */
|
|
24
|
+
source;
|
|
25
|
+
/**
|
|
26
|
+
* Build the error from a compatibility diagnostic, copying its message and fields.
|
|
27
|
+
*
|
|
28
|
+
* @param issue - The diagnostic being refused.
|
|
29
|
+
*/
|
|
30
|
+
constructor(issue) {
|
|
31
|
+
super(issue.message);
|
|
32
|
+
this.name = 'UnsupportedSqlFeatureError';
|
|
33
|
+
this.feature = issue.feature;
|
|
34
|
+
this.detail = issue.detail;
|
|
35
|
+
this.source = issue.source;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The first referential action this bond cannot reproduce, as a diagnostic.
|
|
40
|
+
*
|
|
41
|
+
* Absence is never support: the bond refuses unless its own declaration says the
|
|
42
|
+
* construct is `native` or `translated`. The note is the same text the
|
|
43
|
+
* generator's preflight prints, so a boot-time refusal and a scaffold-time one
|
|
44
|
+
* say the same thing.
|
|
45
|
+
*
|
|
46
|
+
* @param sql - The migration SQL.
|
|
47
|
+
* @param source - The file the SQL came from, when known.
|
|
48
|
+
* @returns The diagnostic, or null when no unsupported action is present.
|
|
49
|
+
*/
|
|
50
|
+
const firstRefusedReferentialAction = (sql, source) => {
|
|
51
|
+
const capability = sqlCapabilities['fk-referential-action'];
|
|
52
|
+
if (capability && capability.support !== 'unsupported')
|
|
53
|
+
return null;
|
|
54
|
+
for (const statement of splitSqlStatements(sql)) {
|
|
55
|
+
const detail = referentialActionsIn(statement.text)[0];
|
|
56
|
+
if (!detail)
|
|
57
|
+
continue;
|
|
58
|
+
return {
|
|
59
|
+
kind: 'unsupported',
|
|
60
|
+
feature: 'fk-referential-action',
|
|
61
|
+
detail,
|
|
62
|
+
statement: statement.text.trim(),
|
|
63
|
+
source,
|
|
64
|
+
message: `DuckDB cannot apply ${detail}${source ? ` in ${source}` : ''}` +
|
|
65
|
+
`${capability?.note ? ` — ${capability.note}` : '.'}`,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
return null;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Translate PostgreSQL-dialect DDL to DuckDB-compatible DDL at migration time.
|
|
72
|
+
*
|
|
73
|
+
* Resource/template setup migrations are authored in PostgreSQL dialect. DuckDB
|
|
74
|
+
* 2.0 already speaks most of it natively — `uuid`/`timestamptz`/`bytea`/`text[]`
|
|
75
|
+
* type names, `gen_random_uuid()`, `now()`, `CURRENT_TIMESTAMP`, `::` casts,
|
|
76
|
+
* `ADD COLUMN IF NOT EXISTS`, `DROP COLUMN IF EXISTS`, `ON CONFLICT`, `ILIKE` —
|
|
77
|
+
* all verified against 2.0.0-r.1. The constructs it rejects are rewritten here,
|
|
78
|
+
* and only where the rewrite preserves behaviour:
|
|
79
|
+
*
|
|
80
|
+
* - `jsonb` → `json`, in both the column-type position and the `::jsonb` cast
|
|
81
|
+
* (DuckDB has a `JSON` type, stored as VARCHAR; there is no `jsonb`).
|
|
82
|
+
* - `USING <method>` on a `CREATE INDEX` (`gin`/`btree`/`hash`/`gist`) →
|
|
83
|
+
* removed: DuckDB indexes have no access method.
|
|
84
|
+
* - A partial index gets no `WHERE` support in DuckDB. A non-unique partial
|
|
85
|
+
* index becomes a full index on the same columns — the predicate only narrows
|
|
86
|
+
* which rows the index covers, never a query's result. A UNIQUE partial index
|
|
87
|
+
* becomes a UNIQUE index over `CASE WHEN <predicate> THEN <column> END` per
|
|
88
|
+
* column: rows outside the predicate get NULL keys (distinct in DuckDB), so
|
|
89
|
+
* uniqueness applies to exactly the rows PostgreSQL would constrain.
|
|
90
|
+
*
|
|
91
|
+
* What it does NOT rewrite is an `ON DELETE`/`ON UPDATE` referential action
|
|
92
|
+
* (`CASCADE`, `SET NULL`, `SET DEFAULT`): DuckDB rejects the clause at parse
|
|
93
|
+
* time and has no triggers, so dropping it would turn a cascading delete into a
|
|
94
|
+
* refusing one. Such SQL throws {@link UnsupportedSqlFeatureError}, naming the
|
|
95
|
+
* construct — see {@link sqlCapabilities}. The compatibility preflight in the
|
|
96
|
+
* generator rejects those resource/provider combinations before an app exists;
|
|
97
|
+
* this throw is the last line of defence for SQL that reaches the runner another
|
|
98
|
+
* way.
|
|
99
|
+
*
|
|
100
|
+
* Everything else passes through untouched — unlike the sqlite bond, no
|
|
101
|
+
* placeholder conversion or timestamp-default rewriting happens here.
|
|
102
|
+
*
|
|
103
|
+
* @param sql - Raw migration SQL, possibly in Postgres dialect.
|
|
104
|
+
* @param options - The source file name used in an unsupported-construct error.
|
|
105
|
+
* @returns DuckDB-compatible SQL.
|
|
106
|
+
* @throws {UnsupportedSqlFeatureError} When the SQL needs a construct DuckDB
|
|
107
|
+
* cannot reproduce without changing its behaviour.
|
|
108
|
+
*/
|
|
109
|
+
export const translateDdlToDuckdb = (sql, options = {}) => {
|
|
110
|
+
const refused = firstRefusedReferentialAction(sql, options.source);
|
|
111
|
+
if (refused)
|
|
112
|
+
throw new UnsupportedSqlFeatureError(refused);
|
|
113
|
+
const chunks = [];
|
|
114
|
+
let cursor = 0;
|
|
115
|
+
for (const statement of splitSqlStatements(sql)) {
|
|
116
|
+
chunks.push(sql.slice(cursor, statement.start));
|
|
117
|
+
chunks.push(rewriteIndexStatement(statement.text));
|
|
118
|
+
cursor = statement.end;
|
|
119
|
+
}
|
|
120
|
+
chunks.push(sql.slice(cursor));
|
|
121
|
+
return chunks.join('').replace(/\bjsonb\b/gi, 'json');
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Rewrite one statement's DuckDB-incompatible index constructs.
|
|
125
|
+
*
|
|
126
|
+
* Every statement that is not a `CREATE INDEX` is returned unchanged, so this
|
|
127
|
+
* touches only index text. Index options (`WITH (...)`, `INCLUDE (...)`) are not
|
|
128
|
+
* translated: DuckDB has no equivalent, and guessing would hide a real
|
|
129
|
+
* difference, so the statement throws instead.
|
|
130
|
+
*
|
|
131
|
+
* @param statement - One statement from `splitSqlStatements`.
|
|
132
|
+
* @returns The statement in DuckDB dialect.
|
|
133
|
+
*/
|
|
134
|
+
const rewriteIndexStatement = (statement) => {
|
|
135
|
+
const index = parseCreateIndexStatement(statement);
|
|
136
|
+
if (!index)
|
|
137
|
+
return statement;
|
|
138
|
+
if (index.optionsBeforeWhere) {
|
|
139
|
+
throw new Error(`DuckDB: index options are not supported ("${index.optionsBeforeWhere}") — ` +
|
|
140
|
+
'remove them from the index or use a database that supports them.');
|
|
141
|
+
}
|
|
142
|
+
if (!index.predicate) {
|
|
143
|
+
// The parser already removed `USING <method>`; the rest is DuckDB-valid.
|
|
144
|
+
return `${index.prefix}${index.columns})${index.afterClose}`;
|
|
145
|
+
}
|
|
146
|
+
if (!index.unique) {
|
|
147
|
+
// Non-unique: the predicate only decides which rows the index covers.
|
|
148
|
+
return `${index.prefix}${index.columns})${index.afterPredicate ?? ''}`;
|
|
149
|
+
}
|
|
150
|
+
const predicate = index.predicate;
|
|
151
|
+
const columns = splitSqlColumns(index.columns)
|
|
152
|
+
.map((column) => `(CASE WHEN (${predicate}) THEN (${column}) END)`)
|
|
153
|
+
.join(', ');
|
|
154
|
+
return `${index.prefix}${columns})${index.afterPredicate ?? ''}`;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Coerce a JS value into something `@duckdb/node-api` can bind. The client
|
|
158
|
+
* infers a parameter's type from the VALUE and only understands `null`,
|
|
159
|
+
* booleans, numbers, bigints and strings — anything else fails at bind time
|
|
160
|
+
* with `Cannot create values of type ANY. Specify a specific type.`, which
|
|
161
|
+
* would crash every `create()`/`update()` that passes a `Date`, a boolean-ish
|
|
162
|
+
* object or a jsonb value. Strings cast on the way in: DuckDB implicitly casts
|
|
163
|
+
* a bound VARCHAR to UUID/TIMESTAMPTZ/DECIMAL/JSON/LIST parameters, verified
|
|
164
|
+
* against 2.0.0-r.1.
|
|
165
|
+
*
|
|
166
|
+
* @param value - The value to bind.
|
|
167
|
+
* @returns A `@duckdb/node-api`-bindable value.
|
|
168
|
+
*/
|
|
169
|
+
export const coerceDuckdbParam = (value) => {
|
|
170
|
+
if (value === undefined || value === null)
|
|
171
|
+
return null;
|
|
172
|
+
if (typeof value === 'boolean' ||
|
|
173
|
+
typeof value === 'number' ||
|
|
174
|
+
typeof value === 'bigint' ||
|
|
175
|
+
typeof value === 'string') {
|
|
176
|
+
return value;
|
|
177
|
+
}
|
|
178
|
+
if (value instanceof Date)
|
|
179
|
+
return value.toISOString();
|
|
180
|
+
if (value instanceof Uint8Array)
|
|
181
|
+
return blobValue(value);
|
|
182
|
+
if (typeof value === 'object')
|
|
183
|
+
return JSON.stringify(value);
|
|
184
|
+
throw new Error(`DuckDB: cannot bind a value of type ${typeof value} — pass a string, number, boolean, ` +
|
|
185
|
+
'bigint, Date, Uint8Array, plain object or array.');
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* Normalize DuckDB result rows to the JS shapes the other database bonds hand
|
|
189
|
+
* back. DuckDB's JS conversion returns a `bigint` for every 64+-bit integer —
|
|
190
|
+
* `COUNT(*)`, `BIGINT` and `HUGEINT` columns — and `JSON.stringify` THROWS on a
|
|
191
|
+
* bigint, so a handler that serializes a row with `COUNT(*)` in it would 500.
|
|
192
|
+
* A bigint within `Number.MAX_SAFE_INTEGER` becomes a JS number (matching the
|
|
193
|
+
* sqlite bond); a larger one becomes its decimal string (matching node-postgres
|
|
194
|
+
* `int8AsString`). Mutates rows in place for speed.
|
|
195
|
+
*
|
|
196
|
+
* @param rows - Row objects from `result.getRowObjectsJS()`.
|
|
197
|
+
* @returns The normalized rows.
|
|
198
|
+
*/
|
|
199
|
+
export const normalizeDuckdbRows = (rows) => {
|
|
200
|
+
for (const row of rows) {
|
|
201
|
+
for (const key of Object.keys(row)) {
|
|
202
|
+
const value = row[key];
|
|
203
|
+
if (typeof value === 'bigint') {
|
|
204
|
+
row[key] =
|
|
205
|
+
value >= BigInt(Number.MIN_SAFE_INTEGER) && value <= BigInt(Number.MAX_SAFE_INTEGER)
|
|
206
|
+
? Number(value)
|
|
207
|
+
: value.toString();
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return rows;
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* Parse the JSON-typed columns of a table's rows into values, matching what
|
|
215
|
+
* the postgresql/sqlite bonds hand back from a `json`/`jsonb` column. DuckDB's
|
|
216
|
+
* `JSON` type is an alias over VARCHAR, so a JSON column always READS as its
|
|
217
|
+
* JSON text — the column's type is only visible in
|
|
218
|
+
* `information_schema.columns.data_type`, never in the result metadata, which
|
|
219
|
+
* is why this runs in the DataStore (it knows the table) and not in the pool.
|
|
220
|
+
* A value that is not valid JSON text is left as the raw string.
|
|
221
|
+
*
|
|
222
|
+
* @param rows - Row objects.
|
|
223
|
+
* @param jsonColumns - The table's JSON-typed column names, lower-cased.
|
|
224
|
+
* @returns The rows with JSON columns parsed.
|
|
225
|
+
*/
|
|
226
|
+
export const parseJsonColumns = (rows, jsonColumns) => {
|
|
227
|
+
if (jsonColumns.size === 0)
|
|
228
|
+
return rows;
|
|
229
|
+
for (const row of rows) {
|
|
230
|
+
for (const key of Object.keys(row)) {
|
|
231
|
+
if (!jsonColumns.has(key.toLowerCase()))
|
|
232
|
+
continue;
|
|
233
|
+
if (typeof row[key] === 'string') {
|
|
234
|
+
try {
|
|
235
|
+
row[key] = JSON.parse(row[key]);
|
|
236
|
+
}
|
|
237
|
+
catch (_error) {
|
|
238
|
+
// A non-JSON string in a JSON-typed column: DuckDB allows it (the
|
|
239
|
+
// type is VARCHAR underneath), so leave the caller's value alone.
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return rows;
|
|
245
|
+
};
|
|
246
|
+
//# sourceMappingURL=utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utilities.js","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAoB,MAAM,kBAAkB,CAAA;AAI9D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,eAAe,EACf,kBAAkB,GACnB,MAAM,kBAAkB,CAAA;AAUzB;;;;;;;;GAQG;AACH,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IACnD,+BAA+B;IACtB,OAAO,CAAY;IAC5B,kDAAkD;IACzC,MAAM,CAAQ;IACvB,iDAAiD;IACxC,MAAM,CAAS;IAExB;;;;OAIG;IACH,YAAY,KAA4B;QACtC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACpB,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAA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AAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,89 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/api-database-duckdb",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.0.1-stage",
|
|
4
|
+
"description": "DuckDB database provider for molecule.dev",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsc",
|
|
14
|
+
"test": "vitest run",
|
|
15
|
+
"test:watch": "vitest"
|
|
16
|
+
},
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./lifecycle.js": {
|
|
23
|
+
"types": "./dist/lifecycle.d.ts",
|
|
24
|
+
"import": "./dist/lifecycle.js"
|
|
25
|
+
},
|
|
26
|
+
"./migrator.js": {
|
|
27
|
+
"types": "./dist/migrator.d.ts",
|
|
28
|
+
"import": "./dist/migrator.js"
|
|
29
|
+
},
|
|
30
|
+
"./pool.js": {
|
|
31
|
+
"types": "./dist/pool.d.ts",
|
|
32
|
+
"import": "./dist/pool.js"
|
|
33
|
+
},
|
|
34
|
+
"./queue.js": {
|
|
35
|
+
"types": "./dist/queue.d.ts",
|
|
36
|
+
"import": "./dist/queue.js"
|
|
37
|
+
},
|
|
38
|
+
"./store.js": {
|
|
39
|
+
"types": "./dist/store.d.ts",
|
|
40
|
+
"import": "./dist/store.js"
|
|
41
|
+
},
|
|
42
|
+
"./utilities.js": {
|
|
43
|
+
"types": "./dist/utilities.d.ts",
|
|
44
|
+
"import": "./dist/utilities.js"
|
|
45
|
+
},
|
|
46
|
+
"./capabilities.js": {
|
|
47
|
+
"types": "./dist/capabilities.d.ts",
|
|
48
|
+
"import": "./dist/capabilities.js"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"keywords": [
|
|
52
|
+
"molecule",
|
|
53
|
+
"database",
|
|
54
|
+
"duckdb"
|
|
55
|
+
],
|
|
56
|
+
"author": "Molecule Dev, Inc. (https://molecule.dev)",
|
|
57
|
+
"license": "Apache-2.0",
|
|
58
|
+
"engines": {
|
|
59
|
+
"node": ">=22"
|
|
60
|
+
},
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"@duckdb/node-api": "2.0.0-r.1"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@molecule/api-bond": "1.0.3",
|
|
66
|
+
"@molecule/api-database": "1.2.0",
|
|
67
|
+
"@molecule/api-process-lifecycle": "1.2.1",
|
|
68
|
+
"@molecule/api-process-lifecycle-express": "1.3.1",
|
|
69
|
+
"@molecule/api-secrets": "1.0.2",
|
|
70
|
+
"@types/node": "26.6.5",
|
|
71
|
+
"typescript": "6.0.3",
|
|
72
|
+
"vitest": "4.1.12"
|
|
73
|
+
},
|
|
74
|
+
"peerDependencies": {
|
|
75
|
+
"@molecule/api-bond": "^1.0.1",
|
|
76
|
+
"@molecule/api-database": "^1.2.0",
|
|
77
|
+
"@molecule/api-secrets": "^1.0.1"
|
|
78
|
+
},
|
|
79
|
+
"repository": {
|
|
80
|
+
"type": "git",
|
|
81
|
+
"url": "https://github.com/molecule-dev/molecule.git",
|
|
82
|
+
"directory": "packages/api/bonds/database/duckdb"
|
|
83
|
+
},
|
|
84
|
+
"homepage": "https://www.molecule.dev/packages/api-database-duckdb",
|
|
85
|
+
"bugs": "https://github.com/molecule-dev/molecule/issues",
|
|
86
|
+
"publishConfig": {
|
|
87
|
+
"access": "public"
|
|
88
|
+
}
|
|
89
|
+
}
|