@g9tm/lynxcontrols-lynxtron 0.0.0-stage → 1.4.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 (46) hide show
  1. package/README.md +44 -2
  2. package/dist/.tsbuildinfo +1 -0
  3. package/dist/driver.d.ts +21 -0
  4. package/dist/driver.d.ts.map +1 -0
  5. package/dist/driver.js +139 -0
  6. package/dist/driver.js.map +1 -0
  7. package/dist/index.d.ts +4 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +2 -0
  10. package/dist/node/engine.d.ts +31 -0
  11. package/dist/node/engine.d.ts.map +1 -0
  12. package/dist/node/engine.js +295 -0
  13. package/dist/node/engine.js.map +1 -0
  14. package/dist/node/expose.d.ts +13 -0
  15. package/dist/node/expose.d.ts.map +1 -0
  16. package/dist/node/expose.js +33 -0
  17. package/dist/node/expose.js.map +1 -0
  18. package/dist/node/host-bridge.d.ts +16 -0
  19. package/dist/node/host-bridge.d.ts.map +1 -0
  20. package/dist/node/host-bridge.js +18 -0
  21. package/dist/node/host-bridge.js.map +1 -0
  22. package/dist/node/index.d.ts +5 -0
  23. package/dist/node/index.d.ts.map +1 -0
  24. package/dist/node/index.js +4 -0
  25. package/dist/node/preferences.d.ts +34 -0
  26. package/dist/node/preferences.d.ts.map +1 -0
  27. package/dist/node/preferences.js +76 -0
  28. package/dist/node/preferences.js.map +1 -0
  29. package/dist/node/preload.d.ts +2 -0
  30. package/dist/node/preload.d.ts.map +1 -0
  31. package/dist/node/sqlite-worker.d.ts +2 -0
  32. package/dist/node/sqlite-worker.d.ts.map +1 -0
  33. package/dist/node/worker-host.d.ts +20 -0
  34. package/dist/node/worker-host.d.ts.map +1 -0
  35. package/dist/node/worker-host.js +177 -0
  36. package/dist/node/worker-host.js.map +1 -0
  37. package/dist/preload.cjs +286 -0
  38. package/dist/protocol.d.ts +104 -0
  39. package/dist/protocol.d.ts.map +1 -0
  40. package/dist/protocol.js +1 -0
  41. package/dist/services.d.ts +21 -0
  42. package/dist/services.d.ts.map +1 -0
  43. package/dist/services.js +40 -0
  44. package/dist/services.js.map +1 -0
  45. package/dist/sqlite-worker.cjs +301 -0
  46. package/package.json +30 -4
@@ -0,0 +1,295 @@
1
+ import { existsSync, mkdirSync } from "fs";
2
+ import { dirname } from "path";
3
+ import { DatabaseSync } from "node:sqlite";
4
+ function _define_property(obj, key, value) {
5
+ if (key in obj) Object.defineProperty(obj, key, {
6
+ value: value,
7
+ enumerable: true,
8
+ configurable: true,
9
+ writable: true
10
+ });
11
+ else obj[key] = value;
12
+ return obj;
13
+ }
14
+ class G9EngineError extends Error {
15
+ constructor(wire){
16
+ super(wire.message), _define_property(this, "wire", void 0);
17
+ this.name = 'G9EngineError';
18
+ this.wire = wire;
19
+ }
20
+ }
21
+ const fail = (code, message, extra = {})=>{
22
+ throw new G9EngineError({
23
+ code,
24
+ message,
25
+ ...extra
26
+ });
27
+ };
28
+ function wireErrorCode(resultCode) {
29
+ switch(0xff & resultCode){
30
+ case 5:
31
+ return 'busy';
32
+ case 6:
33
+ return 'locked';
34
+ case 19:
35
+ return 'constraint';
36
+ case 11:
37
+ case 26:
38
+ return 'corrupt';
39
+ case 8:
40
+ return 'readonly';
41
+ case 13:
42
+ return 'full';
43
+ case 9:
44
+ return 'interrupted';
45
+ case 21:
46
+ return 'misuse';
47
+ case 14:
48
+ return 'not-found';
49
+ default:
50
+ return 'other';
51
+ }
52
+ }
53
+ function toWireError(error, sql, completedStatements) {
54
+ var _ref;
55
+ if (error instanceof G9EngineError) return {
56
+ ...error.wire,
57
+ ...void 0 !== sql && void 0 === error.wire.sql ? {
58
+ sql
59
+ } : {},
60
+ ...void 0 !== completedStatements && void 0 === error.wire.completedStatements ? {
61
+ completedStatements
62
+ } : {}
63
+ };
64
+ const e = error;
65
+ const sqliteCode = 'number' == typeof (null == e ? void 0 : e.errcode) ? e.errcode : void 0;
66
+ return {
67
+ code: void 0 !== sqliteCode ? wireErrorCode(sqliteCode) : 'misuse',
68
+ message: null != (_ref = null == e ? void 0 : e.message) ? _ref : String(error),
69
+ ...void 0 !== sqliteCode ? {
70
+ sqliteCode
71
+ } : {},
72
+ ...void 0 !== sql ? {
73
+ sql
74
+ } : {},
75
+ ...void 0 !== completedStatements ? {
76
+ completedStatements
77
+ } : {}
78
+ };
79
+ }
80
+ function bind(value, sql, index) {
81
+ if (null === value) return value;
82
+ if ('string' == typeof value) {
83
+ if (value.indexOf('\u0000') >= 0) fail('misuse', `Parameter ${index + 1} is text containing NUL; use a BLOB.`, {
84
+ sql
85
+ });
86
+ return value;
87
+ }
88
+ if ('number' == typeof value) {
89
+ if (Number.isNaN(value)) fail('misuse', `Parameter ${index + 1} is NaN.`, {
90
+ sql
91
+ });
92
+ return Number.isSafeInteger(value) ? BigInt(value) : value;
93
+ }
94
+ if (value instanceof ArrayBuffer) return 0 === value.byteLength ? new Uint8Array(0) : new Uint8Array(value);
95
+ if (ArrayBuffer.isView(value)) {
96
+ const view = value;
97
+ return new Uint8Array(view.buffer.slice(view.byteOffset, view.byteOffset + view.byteLength));
98
+ }
99
+ if ('object' == typeof value && 'string' == typeof value.int64) return BigInt(value.int64);
100
+ return fail('misuse', `Parameter ${index + 1} is not a SQL value (${void 0 === value ? 'undefined' : typeof value}).`, {
101
+ sql
102
+ });
103
+ }
104
+ function read(value) {
105
+ if ('bigint' == typeof value) {
106
+ const n = Number(value);
107
+ return Number.isSafeInteger(n) ? n : {
108
+ int64: value.toString()
109
+ };
110
+ }
111
+ if (ArrayBuffer.isView(value)) {
112
+ const copy = new Uint8Array(value.byteLength);
113
+ copy.set(new Uint8Array(value.buffer, value.byteOffset, value.byteLength));
114
+ return copy.buffer;
115
+ }
116
+ return value;
117
+ }
118
+ class G9SqliteEngine {
119
+ handle(request) {
120
+ switch(request.op){
121
+ case 'capabilities':
122
+ return G9SqliteEngine.capabilities();
123
+ case 'open':
124
+ return this.open(request.options);
125
+ case 'run':
126
+ return this.run(request.statements, request.options);
127
+ case 'begin':
128
+ return this.begin(request.mode, request.tx);
129
+ case 'commit':
130
+ return this.commit(request.tx);
131
+ case 'rollback':
132
+ return this.rollback(request.tx);
133
+ case 'close':
134
+ return this.close();
135
+ }
136
+ }
137
+ static capabilities() {
138
+ const db = new DatabaseSync(':memory:');
139
+ try {
140
+ const row = db.prepare('SELECT sqlite_version() AS v').get();
141
+ return {
142
+ sqliteVersion: row.v,
143
+ maxVariables: 32766,
144
+ json1: true,
145
+ returning: true,
146
+ upsert: true,
147
+ interrupt: false
148
+ };
149
+ } finally{
150
+ db.close();
151
+ }
152
+ }
153
+ database() {
154
+ var _this_db;
155
+ return null != (_this_db = this.db) ? _this_db : fail('misuse', 'The database session is closed or unknown.');
156
+ }
157
+ open(options) {
158
+ var _options_pragmas;
159
+ if (this.db) fail('misuse', 'This engine already holds an open database.');
160
+ const memory = ':memory:' === options.path || '' === options.path;
161
+ if (!memory && !options.create && !existsSync(options.path)) fail('not-found', `Database file does not exist: ${options.path}`);
162
+ if (!memory && options.create) mkdirSync(dirname(options.path), {
163
+ recursive: true
164
+ });
165
+ let db;
166
+ try {
167
+ db = new DatabaseSync(options.path || ':memory:', {
168
+ readOnly: true === options.readOnly
169
+ });
170
+ } catch (error) {
171
+ throw new G9EngineError(toWireError(error));
172
+ }
173
+ for (const sql of null != (_options_pragmas = options.pragmas) ? _options_pragmas : [])try {
174
+ db.exec(sql);
175
+ } catch (error) {
176
+ if (!sql.startsWith('PRAGMA journal_mode')) {
177
+ db.close();
178
+ throw new G9EngineError(toWireError(error, sql));
179
+ }
180
+ }
181
+ this.db = db;
182
+ return null;
183
+ }
184
+ prepare(sql) {
185
+ let stmt = this.statements.get(sql);
186
+ if (!stmt) {
187
+ stmt = this.database().prepare(sql);
188
+ stmt.setReadBigInts(true);
189
+ stmt.setReturnArrays(true);
190
+ this.statements.set(sql, stmt);
191
+ }
192
+ return stmt;
193
+ }
194
+ execute(statement, maxRows) {
195
+ if (statement.params.some((p)=>void 0 === p)) fail('misuse', 'undefined is not a SQL value (use null).', {
196
+ sql: statement.sql
197
+ });
198
+ const stmt = this.prepare(statement.sql);
199
+ const args = statement.params.map((p, i)=>bind(p, statement.sql, i));
200
+ const columns = stmt.columns().map((c)=>c.name);
201
+ if (columns.length > 0) {
202
+ const rows = [];
203
+ for (const row of stmt.iterate(...args)){
204
+ if (void 0 !== maxRows && rows.length >= maxRows) fail('too-many-rows', `The statement returned more than ${maxRows} rows.`, {
205
+ sql: statement.sql
206
+ });
207
+ rows.push(row.map(read));
208
+ }
209
+ return {
210
+ columns,
211
+ rows,
212
+ changes: 0,
213
+ lastInsertRowId: this.lastInsertRowId
214
+ };
215
+ }
216
+ const result = stmt.run(...args);
217
+ this.lastInsertRowId = read(result.lastInsertRowid);
218
+ return {
219
+ columns: [],
220
+ rows: [],
221
+ changes: Number(result.changes),
222
+ lastInsertRowId: this.lastInsertRowId
223
+ };
224
+ }
225
+ run(statements, options) {
226
+ const db = this.database();
227
+ if (void 0 !== options.tx && this.tx !== options.tx) fail('misuse', 'The transaction is finished or belongs to another session.');
228
+ if (void 0 === options.tx && null !== this.tx) fail('misuse', 'A transaction is open on this session; pass its token (tx).');
229
+ const atomic = true === options.atomic && void 0 === options.tx && statements.length > 0;
230
+ if (atomic) db.exec('BEGIN');
231
+ const results = [];
232
+ try {
233
+ for (const statement of statements)try {
234
+ results.push(this.execute(statement, options.maxRows));
235
+ } catch (error) {
236
+ throw new G9EngineError(toWireError(error, statement.sql, results.length));
237
+ }
238
+ if (atomic) db.exec('COMMIT');
239
+ } catch (error) {
240
+ if (atomic) try {
241
+ db.exec('ROLLBACK');
242
+ } catch {}
243
+ throw error instanceof G9EngineError ? error : new G9EngineError(toWireError(error));
244
+ }
245
+ return results;
246
+ }
247
+ begin(mode, tx) {
248
+ const db = this.database();
249
+ if (null !== this.tx) fail('misuse', 'A transaction is already open on this session.');
250
+ try {
251
+ db.exec('immediate' === mode ? 'BEGIN IMMEDIATE' : 'BEGIN DEFERRED');
252
+ } catch (error) {
253
+ throw new G9EngineError(toWireError(error));
254
+ }
255
+ this.tx = tx;
256
+ return null;
257
+ }
258
+ commit(tx) {
259
+ const db = this.database();
260
+ if (this.tx !== tx) fail('misuse', 'The transaction is finished or unknown.');
261
+ try {
262
+ db.exec('COMMIT');
263
+ } catch (error) {
264
+ throw new G9EngineError(toWireError(error));
265
+ }
266
+ this.tx = null;
267
+ return null;
268
+ }
269
+ rollback(tx) {
270
+ const db = this.database();
271
+ if (this.tx !== tx) fail('misuse', 'The transaction is finished or unknown.');
272
+ this.tx = null;
273
+ try {
274
+ db.exec('ROLLBACK');
275
+ } catch {}
276
+ return null;
277
+ }
278
+ close() {
279
+ const db = this.database();
280
+ this.db = null;
281
+ this.tx = null;
282
+ this.statements.clear();
283
+ db.close();
284
+ return null;
285
+ }
286
+ constructor(){
287
+ _define_property(this, "db", null);
288
+ _define_property(this, "statements", new Map());
289
+ _define_property(this, "tx", null);
290
+ _define_property(this, "lastInsertRowId", 0);
291
+ }
292
+ }
293
+ export { G9EngineError, G9SqliteEngine, toWireError, wireErrorCode };
294
+
295
+ //# sourceMappingURL=engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node/engine.js","sources":["../../src/node/engine.ts"],"sourcesContent":["// The desktop SQLite engine (plan/specs/06 §3): node:sqlite behind plain-data operations, so it runs the same in a\n// worker thread (production, one per open database) and in process (tests). Values cross as G9 driver values: safe\n// integers as numbers, larger ones as `{ int64 }` tags, BLOBs as ArrayBuffer. Errors cross as plain objects.\nimport { existsSync, mkdirSync } from 'node:fs';\nimport { dirname } from 'node:path';\nimport { DatabaseSync, type StatementSync } from 'node:sqlite';\n\nimport type {\n G9EngineRequest,\n G9WireCapabilities,\n G9WireError,\n G9WireOpenOptions,\n G9WireResult,\n G9WireRunOptions,\n G9WireStatement,\n G9WireValue,\n} from '../protocol.ts';\n\n/** An engine failure carrying its wire error. */\nexport class G9EngineError extends Error {\n readonly wire: G9WireError;\n constructor(wire: G9WireError) {\n super(wire.message);\n this.name = 'G9EngineError';\n this.wire = wire;\n }\n}\n\nconst fail = (code: string, message: string, extra: Partial<G9WireError> = {}): never => {\n throw new G9EngineError({ code, message, ...extra });\n};\n\n/** SQLite primary result code → G9 error code (mirrors `sqliteErrorCodeFor` in @g9tm/lynxcontrols-sqlite). */\nexport function wireErrorCode(resultCode: number): string {\n switch (resultCode & 0xff) {\n case 5:\n return 'busy';\n case 6:\n return 'locked';\n case 19:\n return 'constraint';\n case 11:\n case 26:\n return 'corrupt';\n case 8:\n return 'readonly';\n case 13:\n return 'full';\n case 9:\n return 'interrupted';\n case 21:\n return 'misuse';\n case 14:\n return 'not-found';\n default:\n return 'other';\n }\n}\n\n/** Any thrown value → a wire error (SQLite errors keep their code; context is added). */\nexport function toWireError(error: unknown, sql?: string, completedStatements?: number): G9WireError {\n if (error instanceof G9EngineError) {\n return {\n ...error.wire,\n ...(sql !== undefined && error.wire.sql === undefined ? { sql } : {}),\n ...(completedStatements !== undefined && error.wire.completedStatements === undefined\n ? { completedStatements }\n : {}),\n };\n }\n const e = error as { errcode?: number; message?: string };\n const sqliteCode = typeof e?.errcode === 'number' ? e.errcode : undefined;\n return {\n code: sqliteCode !== undefined ? wireErrorCode(sqliteCode) : 'misuse',\n message: e?.message ?? String(error),\n ...(sqliteCode !== undefined ? { sqliteCode } : {}),\n ...(sql !== undefined ? { sql } : {}),\n ...(completedStatements !== undefined ? { completedStatements } : {}),\n };\n}\n\nfunction bind(value: G9WireValue, sql: string, index: number): null | number | bigint | string | Uint8Array {\n if (value === null) return value;\n if (typeof value === 'string') {\n if (value.indexOf('\\u0000') >= 0)\n fail('misuse', `Parameter ${index + 1} is text containing NUL; use a BLOB.`, { sql });\n return value;\n }\n if (typeof value === 'number') {\n if (Number.isNaN(value)) fail('misuse', `Parameter ${index + 1} is NaN.`, { sql });\n return Number.isSafeInteger(value) ? BigInt(value) : value;\n }\n if (value instanceof ArrayBuffer) return value.byteLength === 0 ? new Uint8Array(0) : new Uint8Array(value);\n if (ArrayBuffer.isView(value)) {\n const view = value as ArrayBufferView;\n return new Uint8Array(view.buffer.slice(view.byteOffset, view.byteOffset + view.byteLength));\n }\n if (typeof value === 'object' && typeof (value as { int64?: unknown }).int64 === 'string') {\n return BigInt((value as { int64: string }).int64);\n }\n return fail(\n 'misuse',\n `Parameter ${index + 1} is not a SQL value (${value === undefined ? 'undefined' : typeof value}).`,\n { sql },\n );\n}\n\nfunction read(value: unknown): G9WireValue {\n if (typeof value === 'bigint') {\n const n = Number(value);\n return Number.isSafeInteger(n) ? n : { int64: value.toString() };\n }\n if (ArrayBuffer.isView(value)) {\n const copy = new Uint8Array(value.byteLength);\n copy.set(new Uint8Array(value.buffer, value.byteOffset, value.byteLength));\n return copy.buffer;\n }\n return value as G9WireValue;\n}\n\n/**\n * One open database (a worker owns exactly one). Synchronous: the worker turns each request into one reply.\n */\nexport class G9SqliteEngine {\n private db: DatabaseSync | null = null;\n private readonly statements = new Map<string, StatementSync>();\n private tx: string | null = null;\n private lastInsertRowId: G9WireValue = 0;\n\n handle(request: G9EngineRequest): unknown {\n switch (request.op) {\n case 'capabilities':\n return G9SqliteEngine.capabilities();\n case 'open':\n return this.open(request.options);\n case 'run':\n return this.run(request.statements, request.options);\n case 'begin':\n return this.begin(request.mode, request.tx);\n case 'commit':\n return this.commit(request.tx);\n case 'rollback':\n return this.rollback(request.tx);\n case 'close':\n return this.close();\n }\n }\n\n static capabilities(): G9WireCapabilities {\n const db = new DatabaseSync(':memory:');\n try {\n const row = db.prepare('SELECT sqlite_version() AS v').get() as { v: string };\n return {\n sqliteVersion: row.v,\n maxVariables: 32766,\n json1: true,\n returning: true,\n upsert: true,\n interrupt: false,\n };\n } finally {\n db.close();\n }\n }\n\n private database(): DatabaseSync {\n return this.db ?? fail('misuse', 'The database session is closed or unknown.');\n }\n\n open(options: G9WireOpenOptions): null {\n if (this.db) fail('misuse', 'This engine already holds an open database.');\n const memory = options.path === ':memory:' || options.path === '';\n if (!memory && !options.create && !existsSync(options.path)) {\n fail('not-found', `Database file does not exist: ${options.path}`);\n }\n if (!memory && options.create) mkdirSync(dirname(options.path), { recursive: true });\n let db: DatabaseSync;\n try {\n db = new DatabaseSync(options.path || ':memory:', { readOnly: options.readOnly === true });\n } catch (error) {\n throw new G9EngineError(toWireError(error));\n }\n for (const sql of options.pragmas ?? []) {\n try {\n db.exec(sql);\n } catch (error) {\n // journal_mode cannot change on a read-only or in-memory database; tuning never fails an open.\n if (!sql.startsWith('PRAGMA journal_mode')) {\n db.close();\n throw new G9EngineError(toWireError(error, sql));\n }\n }\n }\n this.db = db;\n return null;\n }\n\n private prepare(sql: string): StatementSync {\n let stmt = this.statements.get(sql);\n if (!stmt) {\n stmt = this.database().prepare(sql);\n stmt.setReadBigInts(true);\n stmt.setReturnArrays(true);\n this.statements.set(sql, stmt);\n }\n return stmt;\n }\n\n private execute(statement: G9WireStatement, maxRows: number | undefined): G9WireResult {\n if (statement.params.some((p) => p === undefined)) {\n fail('misuse', 'undefined is not a SQL value (use null).', { sql: statement.sql });\n }\n const stmt = this.prepare(statement.sql);\n const args = statement.params.map((p, i) => bind(p, statement.sql, i));\n const columns = stmt.columns().map((c) => c.name);\n if (columns.length > 0) {\n const rows: G9WireValue[][] = [];\n for (const row of stmt.iterate(...args) as Iterable<unknown[]>) {\n if (maxRows !== undefined && rows.length >= maxRows) {\n fail('too-many-rows', `The statement returned more than ${maxRows} rows.`, { sql: statement.sql });\n }\n rows.push(row.map(read));\n }\n return { columns, rows, changes: 0, lastInsertRowId: this.lastInsertRowId };\n }\n const result = stmt.run(...args);\n this.lastInsertRowId = read(result.lastInsertRowid);\n return { columns: [], rows: [], changes: Number(result.changes), lastInsertRowId: this.lastInsertRowId };\n }\n\n run(statements: readonly G9WireStatement[], options: G9WireRunOptions): G9WireResult[] {\n const db = this.database();\n if (options.tx !== undefined && this.tx !== options.tx) {\n fail('misuse', 'The transaction is finished or belongs to another session.');\n }\n if (options.tx === undefined && this.tx !== null) {\n fail('misuse', 'A transaction is open on this session; pass its token (tx).');\n }\n const atomic = options.atomic === true && options.tx === undefined && statements.length > 0;\n if (atomic) db.exec('BEGIN');\n const results: G9WireResult[] = [];\n try {\n for (const statement of statements) {\n try {\n results.push(this.execute(statement, options.maxRows));\n } catch (error) {\n throw new G9EngineError(toWireError(error, statement.sql, results.length));\n }\n }\n if (atomic) db.exec('COMMIT');\n } catch (error) {\n if (atomic) {\n try {\n db.exec('ROLLBACK');\n } catch {\n // SQLite already rolled back (e.g. after SQLITE_FULL).\n }\n }\n throw error instanceof G9EngineError ? error : new G9EngineError(toWireError(error));\n }\n return results;\n }\n\n begin(mode: 'deferred' | 'immediate', tx: string): null {\n const db = this.database();\n if (this.tx !== null) fail('misuse', 'A transaction is already open on this session.');\n try {\n db.exec(mode === 'immediate' ? 'BEGIN IMMEDIATE' : 'BEGIN DEFERRED');\n } catch (error) {\n throw new G9EngineError(toWireError(error));\n }\n this.tx = tx;\n return null;\n }\n\n commit(tx: string): null {\n const db = this.database();\n if (this.tx !== tx) fail('misuse', 'The transaction is finished or unknown.');\n try {\n db.exec('COMMIT');\n } catch (error) {\n // A failed COMMIT (busy) leaves the transaction open: the caller may retry or roll back.\n throw new G9EngineError(toWireError(error));\n }\n this.tx = null;\n return null;\n }\n\n rollback(tx: string): null {\n const db = this.database();\n if (this.tx !== tx) fail('misuse', 'The transaction is finished or unknown.');\n this.tx = null;\n try {\n db.exec('ROLLBACK');\n } catch {\n // SQLite may already have rolled back on an error; the transaction is over either way.\n }\n return null;\n }\n\n close(): null {\n const db = this.database();\n this.db = null;\n this.tx = null;\n this.statements.clear();\n db.close();\n return null;\n }\n}\n"],"names":["G9EngineError","Error","wire","fail","code","message","extra","wireErrorCode","resultCode","toWireError","error","sql","completedStatements","undefined","e","sqliteCode","String","bind","value","index","Number","BigInt","ArrayBuffer","Uint8Array","view","read","n","copy","G9SqliteEngine","request","db","DatabaseSync","row","_this_db","options","_options_pragmas","memory","existsSync","mkdirSync","dirname","stmt","statement","maxRows","p","args","i","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vB,MAAMxB,KAAK,IAAI,CAAC,QAAQ;QACxB,IAAI,IAAI,CAAC,EAAE,KAAKwB,IAAInD,KAAK,UAAU;QACnC,IAAI;YACF2B,GAAG,IAAI,CAAC;QACV,EAAE,OAAOpB,OAAO;YAEd,MAAM,IAAIV,cAAcS,YAAYC;QACtC;QACA,IAAI,CAAC,EAAE,GAAG;QACV,OAAO;IACT;IAEA,SAAS4C,EAAU,EAAQ;QACzB,MAAMxB,KAAK,IAAI,CAAC,QAAQ;QACxB,IAAI,IAAI,CAAC,EAAE,KAAKwB,IAAInD,KAAK,UAAU;QACnC,IAAI,CAAC,EAAE,GAAG;QACV,IAAI;YACF2B,GAAG,IAAI,CAAC;QACV,EAAE,OAAM,CAER;QACA,OAAO;IACT;IAEA,QAAc;QACZ,MAAMA,KAAK,IAAI,CAAC,QAAQ;QACxB,IAAI,CAAC,EAAE,GAAG;QACV,IAAI,CAAC,EAAE,GAAG;QACV,IAAI,CAAC,UAAU,CAAC,KAAK;QACrBA,GAAG,KAAK;QACR,OAAO;IACT;;QAvLA,uBAAQ,MAA0B;QAClC,uBAAiB,cAAa,IAAIyB;QAClC,uBAAQ,MAAoB;QAC5B,uBAAQ,mBAA+B;;AAqLzC"}
@@ -0,0 +1,13 @@
1
+ /** The environment the preload reads. */
2
+ export interface G9PreloadEnv {
3
+ /** The app's userData directory (set by the main process). Default `~/.g9lynx`. */
4
+ readonly G9_USER_DATA?: string | undefined;
5
+ /** Integration tests only: where `g9test.report` writes the test bundle's report. */
6
+ readonly G9_REPORT?: string | undefined;
7
+ }
8
+ /**
9
+ * Exposes `g9sqlite` (one worker thread per open database, running `workerFile`) and `g9host` to the Lynx
10
+ * background thread, plus the `g9test` hooks when `G9_REPORT` is set. Returns the exposed object.
11
+ */
12
+ export declare function exposeG9Apis(env: G9PreloadEnv, workerFile: string): Record<string, unknown>;
13
+ //# sourceMappingURL=expose.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expose.d.ts","sourceRoot":"","sources":["../../src/node/expose.ts"],"names":[],"mappings":"AASA,yCAAyC;AACzC,MAAM,WAAW,YAAY;IAC3B,mFAAmF;IACnF,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3C,qFAAqF;IACrF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAqB3F"}
@@ -0,0 +1,33 @@
1
+ import { mkdtempSync, writeFileSync } from "fs";
2
+ import { homedir, tmpdir } from "os";
3
+ import { join } from "path";
4
+ import { Worker } from "worker_threads";
5
+ import { contextBridge } from "@lynx-js/lynxtron/context-bridge";
6
+ import { createHostBridge } from "./host-bridge.js";
7
+ import { createWorkerSqliteBridge } from "./worker-host.js";
8
+ function exposeG9Apis(env, workerFile) {
9
+ const userDataDir = env.G9_USER_DATA || join(homedir(), '.g9lynx');
10
+ const report = env.G9_REPORT;
11
+ const apis = {
12
+ g9sqlite: createWorkerSqliteBridge(()=>new Worker(workerFile, {
13
+ execArgv: [
14
+ '--disable-warning=ExperimentalWarning'
15
+ ]
16
+ })),
17
+ g9host: createHostBridge({
18
+ userDataDir
19
+ })
20
+ };
21
+ if (report) apis.g9test = {
22
+ tempDir: ()=>mkdtempSync(join(tmpdir(), 'g9-lynxtron-contract-')),
23
+ report: (json)=>{
24
+ writeFileSync(report, json);
25
+ setTimeout(()=>process.exit(0), 50);
26
+ }
27
+ };
28
+ contextBridge.exposeInLynxBTS(apis);
29
+ return apis;
30
+ }
31
+ export { exposeG9Apis };
32
+
33
+ //# sourceMappingURL=expose.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node/expose.js","sources":["../../src/node/expose.ts"],"sourcesContent":["// What the preload exposes (separate from the preload file so both environment shapes are testable).\nimport { mkdtempSync, writeFileSync } from 'node:fs';\nimport { homedir, tmpdir } from 'node:os';\nimport { join } from 'node:path';\nimport { Worker } from 'node:worker_threads';\nimport { contextBridge } from '@lynx-js/lynxtron/context-bridge';\nimport { createHostBridge } from './host-bridge.ts';\nimport { createWorkerSqliteBridge } from './worker-host.ts';\n\n/** The environment the preload reads. */\nexport interface G9PreloadEnv {\n /** The app's userData directory (set by the main process). Default `~/.g9lynx`. */\n readonly G9_USER_DATA?: string | undefined;\n /** Integration tests only: where `g9test.report` writes the test bundle's report. */\n readonly G9_REPORT?: string | undefined;\n}\n\n/**\n * Exposes `g9sqlite` (one worker thread per open database, running `workerFile`) and `g9host` to the Lynx\n * background thread, plus the `g9test` hooks when `G9_REPORT` is set. Returns the exposed object.\n */\nexport function exposeG9Apis(env: G9PreloadEnv, workerFile: string): Record<string, unknown> {\n const userDataDir = env.G9_USER_DATA || join(homedir(), '.g9lynx');\n const report = env.G9_REPORT;\n const apis: Record<string, unknown> = {\n // node:sqlite is still flagged experimental in Node 22; one warning per worker is noise in the host's log.\n g9sqlite: createWorkerSqliteBridge(\n () => new Worker(workerFile, { execArgv: ['--disable-warning=ExperimentalWarning'] }),\n ),\n g9host: createHostBridge({ userDataDir }),\n };\n if (report) {\n apis.g9test = {\n tempDir: () => mkdtempSync(join(tmpdir(), 'g9-lynxtron-contract-')),\n report: (json: string) => {\n writeFileSync(report, json);\n setTimeout(() => process.exit(0), 50);\n },\n };\n }\n contextBridge.exposeInLynxBTS(apis);\n return apis;\n}\n"],"names":["exposeG9Apis","env","workerFile","userDataDir","join","homedir","report","apis","createWorkerSqliteBridge","Worker","createHostBridge","mkdtempSync","tmpdir","json","writeFileSync","setTimeout","process","contextBridge"],"mappings":";;;;;;;AAqBO,SAASA,aAAaC,GAAiB,EAAEC,UAAkB;IAChE,MAAMC,cAAcF,IAAI,YAAY,IAAIG,KAAKC,WAAW;IACxD,MAAMC,SAASL,IAAI,SAAS;IAC5B,MAAMM,OAAgC;QAEpC,UAAUC,yBACR,IAAM,IAAIC,OAAOP,YAAY;gBAAE,UAAU;oBAAC;iBAAwC;YAAC;QAErF,QAAQQ,iBAAiB;YAAEP;QAAY;IACzC;IACA,IAAIG,QACFC,KAAK,MAAM,GAAG;QACZ,SAAS,IAAMI,YAAYP,KAAKQ,UAAU;QAC1C,QAAQ,CAACC;YACPC,cAAcR,QAAQO;YACtBE,WAAW,IAAMC,QAAQ,IAAI,CAAC,IAAI;QACpC;IACF;IAEFC,cAAc,eAAe,CAACV;IAC9B,OAAOA;AACT"}
@@ -0,0 +1,16 @@
1
+ import type { G9HostBridge } from '../protocol.js';
2
+ /** Options of {@link createHostBridge}. */
3
+ export interface G9HostBridgeOptions {
4
+ /** Directory for preference files (the app's userData). */
5
+ readonly userDataDir: string;
6
+ /** Preference namespace (one file per namespace). Default `'g9'`. */
7
+ readonly namespace?: string;
8
+ /** How the app closes (default: `process.exit(0)` of the preload process, which ends the window). */
9
+ readonly exit?: () => void;
10
+ }
11
+ /**
12
+ * The Node side of the desktop host services (preload): typed preferences in an atomic JSON file under
13
+ * `userDataDir`, the app exit, and `userDataDir` as the app data directory. Expose it to the Lynx background thread with the preload.
14
+ */
15
+ export declare function createHostBridge(options: G9HostBridgeOptions): G9HostBridge;
16
+ //# sourceMappingURL=host-bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-bridge.d.ts","sourceRoot":"","sources":["../../src/node/host-bridge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,2CAA2C;AAC3C,MAAM,WAAW,mBAAmB;IAClC,2DAA2D;IAC3D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,qEAAqE;IACrE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,qGAAqG;IACrG,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY,CAY3E"}
@@ -0,0 +1,18 @@
1
+ import { openPreferenceFile, preferenceFilePath } from "./preferences.js";
2
+ function createHostBridge(options) {
3
+ var _options_namespace, _options_exit;
4
+ const file = openPreferenceFile(preferenceFilePath(options.userDataDir, null != (_options_namespace = options.namespace) ? _options_namespace : 'g9'));
5
+ return {
6
+ getInt: (key, defaultValue)=>file.getInt(key, defaultValue),
7
+ setInt: (key, value)=>file.setInt(key, value),
8
+ getString: (key, defaultValue)=>file.getString(key, defaultValue),
9
+ setString: (key, value)=>file.setString(key, value),
10
+ remove: (key)=>file.remove(key),
11
+ entries: (prefix)=>file.entries(prefix),
12
+ exit: null != (_options_exit = options.exit) ? _options_exit : ()=>process.exit(0),
13
+ appDataDirectory: ()=>options.userDataDir
14
+ };
15
+ }
16
+ export { createHostBridge };
17
+
18
+ //# sourceMappingURL=host-bridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node/host-bridge.js","sources":["../../src/node/host-bridge.ts"],"sourcesContent":["// The Node side of `g9host`: preferences in `<userData>/<namespace>.prefs.json` and app exit.\nimport type { G9HostBridge } from '../protocol.ts';\nimport { openPreferenceFile, preferenceFilePath } from './preferences.ts';\n\n/** Options of {@link createHostBridge}. */\nexport interface G9HostBridgeOptions {\n /** Directory for preference files (the app's userData). */\n readonly userDataDir: string;\n /** Preference namespace (one file per namespace). Default `'g9'`. */\n readonly namespace?: string;\n /** How the app closes (default: `process.exit(0)` of the preload process, which ends the window). */\n readonly exit?: () => void;\n}\n\n/**\n * The Node side of the desktop host services (preload): typed preferences in an atomic JSON file under\n * `userDataDir`, the app exit, and `userDataDir` as the app data directory. Expose it to the Lynx background thread with the preload.\n */\nexport function createHostBridge(options: G9HostBridgeOptions): G9HostBridge {\n const file = openPreferenceFile(preferenceFilePath(options.userDataDir, options.namespace ?? 'g9'));\n return {\n getInt: (key, defaultValue) => file.getInt(key, defaultValue),\n setInt: (key, value) => file.setInt(key, value),\n getString: (key, defaultValue) => file.getString(key, defaultValue),\n setString: (key, value) => file.setString(key, value),\n remove: (key) => file.remove(key),\n entries: (prefix) => file.entries(prefix),\n exit: options.exit ?? (() => process.exit(0)),\n appDataDirectory: () => options.userDataDir,\n };\n}\n"],"names":["createHostBridge","options","_options_namespace","_options_exit","file","openPreferenceFile","preferenceFilePath","key","defaultValue","value","prefix","process"],"mappings":";AAkBO,SAASA,iBAAiBC,OAA4B;QACaC,oBAQhEC;IARR,MAAMC,OAAOC,mBAAmBC,mBAAmBL,QAAQ,WAAW,EAAE,QAAAC,CAAAA,qBAAAA,QAAQ,SAAS,AAAD,IAAhBA,qBAAqB;IAC7F,OAAO;QACL,QAAQ,CAACK,KAAKC,eAAiBJ,KAAK,MAAM,CAACG,KAAKC;QAChD,QAAQ,CAACD,KAAKE,QAAUL,KAAK,MAAM,CAACG,KAAKE;QACzC,WAAW,CAACF,KAAKC,eAAiBJ,KAAK,SAAS,CAACG,KAAKC;QACtD,WAAW,CAACD,KAAKE,QAAUL,KAAK,SAAS,CAACG,KAAKE;QAC/C,QAAQ,CAACF,MAAQH,KAAK,MAAM,CAACG;QAC7B,SAAS,CAACG,SAAWN,KAAK,OAAO,CAACM;QAClC,MAAM,QAAAP,CAAAA,gBAAAA,QAAQ,IAAI,AAAD,IAAXA,gBAAiB,IAAMQ,QAAQ,IAAI,CAAC;QAC1C,kBAAkB,IAAMV,QAAQ,WAAW;IAC7C;AACF"}
@@ -0,0 +1,5 @@
1
+ export { G9EngineError, G9SqliteEngine, toWireError, wireErrorCode } from './engine.js';
2
+ export { createHostBridge, type G9HostBridgeOptions } from './host-bridge.js';
3
+ export { type G9PreferenceFile, type G9PreferenceFileValue, type G9PreferenceFs, openPreferenceFile, preferenceFilePath, } from './preferences.js';
4
+ export { createWorkerSqliteBridge, type G9WorkerLike } from './worker-host.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EAAE,gBAAgB,EAAE,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,wBAAwB,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { G9EngineError, G9SqliteEngine, toWireError, wireErrorCode } from "./engine.js";
2
+ export { createHostBridge } from "./host-bridge.js";
3
+ export { openPreferenceFile, preferenceFilePath } from "./preferences.js";
4
+ export { createWorkerSqliteBridge } from "./worker-host.js";
@@ -0,0 +1,34 @@
1
+ /** A stored value. */
2
+ export type G9PreferenceFileValue = number | string;
3
+ /** The file-system calls the store uses (injectable so tests can simulate a crash between write and rename). */
4
+ export interface G9PreferenceFs {
5
+ readFileSync(path: string, encoding: 'utf8'): string;
6
+ writeFileSync(path: string, data: string): void;
7
+ renameSync(from: string, to: string): void;
8
+ mkdirSync(path: string, options: {
9
+ recursive: true;
10
+ }): unknown;
11
+ existsSync(path: string): boolean;
12
+ rmSync(path: string, options: {
13
+ force: true;
14
+ }): void;
15
+ }
16
+ /** A synchronous preference store over one file (the bridge call is synchronous; E07). */
17
+ export interface G9PreferenceFile {
18
+ getInt(key: string, defaultValue: number): number;
19
+ setInt(key: string, value: number): void;
20
+ getString(key: string, defaultValue: string | null): string | null;
21
+ setString(key: string, value: string | null): void;
22
+ remove(key: string): void;
23
+ entries(prefix: string): Array<[string, G9PreferenceFileValue]>;
24
+ /** The file path (for diagnostics). */
25
+ readonly path: string;
26
+ }
27
+ /** The file of a namespace: `<dir>/<namespace>.prefs.json` (unsafe characters replaced). */
28
+ export declare function preferenceFilePath(dir: string, namespace: string): string;
29
+ /**
30
+ * Opens (lazily creates) the preference file of a namespace. A missing or unreadable file reads as empty (a corrupt
31
+ * file is never trusted, and the next write replaces it); a leftover temp file from an interrupted write is ignored.
32
+ */
33
+ export declare function openPreferenceFile(path: string, fs?: G9PreferenceFs): G9PreferenceFile;
34
+ //# sourceMappingURL=preferences.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preferences.d.ts","sourceRoot":"","sources":["../../src/node/preferences.ts"],"names":[],"mappings":"AAKA,sBAAsB;AACtB,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,MAAM,CAAC;AAEpD,gHAAgH;AAChH,MAAM,WAAW,cAAc;IAC7B,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IACrD,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAChD,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,SAAS,EAAE,IAAI,CAAA;KAAE,GAAG,OAAO,CAAC;IAC/D,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAClC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,KAAK,EAAE,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;CACtD;AAED,0FAA0F;AAC1F,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;IAClD,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC;IACnE,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IACnD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC;IAChE,uCAAuC;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,4FAA4F;AAC5F,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEzE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,EAAE,GAAE,cAAoD,GACvD,gBAAgB,CAoElB"}
@@ -0,0 +1,76 @@
1
+ import * as __rspack_external_fs from "fs";
2
+ import { dirname, join } from "path";
3
+ function preferenceFilePath(dir, namespace) {
4
+ return join(dir, `${namespace.replace(/[^A-Za-z0-9._-]/g, '_') || 'default'}.prefs.json`);
5
+ }
6
+ function openPreferenceFile(path, fs = __rspack_external_fs) {
7
+ let data = null;
8
+ const load = ()=>{
9
+ if (data) return data;
10
+ data = {};
11
+ if (!fs.existsSync(path)) return data;
12
+ try {
13
+ const parsed = JSON.parse(fs.readFileSync(path, 'utf8'));
14
+ if (parsed && 'object' == typeof parsed && !Array.isArray(parsed)) {
15
+ for (const [key, value] of Object.entries(parsed))if ('number' == typeof value || 'string' == typeof value) data[key] = value;
16
+ }
17
+ } catch {}
18
+ return data;
19
+ };
20
+ const save = ()=>{
21
+ const current = load();
22
+ const temp = `${path}.tmp`;
23
+ fs.mkdirSync(dirname(path), {
24
+ recursive: true
25
+ });
26
+ fs.writeFileSync(temp, JSON.stringify(current));
27
+ fs.renameSync(temp, path);
28
+ };
29
+ const mutate = (change)=>{
30
+ const current = load();
31
+ const before = {
32
+ ...current
33
+ };
34
+ change(current);
35
+ try {
36
+ save();
37
+ } catch (error) {
38
+ data = before;
39
+ throw error;
40
+ }
41
+ };
42
+ return {
43
+ path,
44
+ getInt (key, defaultValue) {
45
+ const v = load()[key];
46
+ return 'number' == typeof v && Number.isInteger(v) ? v : defaultValue;
47
+ },
48
+ setInt (key, value) {
49
+ mutate((d)=>{
50
+ d[key] = value;
51
+ });
52
+ },
53
+ getString (key, defaultValue) {
54
+ const v = load()[key];
55
+ return 'string' == typeof v ? v : defaultValue;
56
+ },
57
+ setString (key, value) {
58
+ mutate((d)=>{
59
+ if (null === value) delete d[key];
60
+ else d[key] = value;
61
+ });
62
+ },
63
+ remove (key) {
64
+ if (!(key in load())) return;
65
+ mutate((d)=>{
66
+ delete d[key];
67
+ });
68
+ },
69
+ entries (prefix) {
70
+ return Object.entries(load()).filter(([key])=>key.startsWith(prefix));
71
+ }
72
+ };
73
+ }
74
+ export { openPreferenceFile, preferenceFilePath };
75
+
76
+ //# sourceMappingURL=preferences.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node/preferences.js","sources":["../../src/node/preferences.ts"],"sourcesContent":["// Desktop preferences (plan/specs/06 §7): one JSON file per namespace in the app's userData directory, written\n// atomically (a temp file, then a rename), so a crash or kill mid-write leaves the previous file intact.\nimport * as nodeFs from 'node:fs';\nimport { dirname, join } from 'node:path';\n\n/** A stored value. */\nexport type G9PreferenceFileValue = number | string;\n\n/** The file-system calls the store uses (injectable so tests can simulate a crash between write and rename). */\nexport interface G9PreferenceFs {\n readFileSync(path: string, encoding: 'utf8'): string;\n writeFileSync(path: string, data: string): void;\n renameSync(from: string, to: string): void;\n mkdirSync(path: string, options: { recursive: true }): unknown;\n existsSync(path: string): boolean;\n rmSync(path: string, options: { force: true }): void;\n}\n\n/** A synchronous preference store over one file (the bridge call is synchronous; E07). */\nexport interface G9PreferenceFile {\n getInt(key: string, defaultValue: number): number;\n setInt(key: string, value: number): void;\n getString(key: string, defaultValue: string | null): string | null;\n setString(key: string, value: string | null): void;\n remove(key: string): void;\n entries(prefix: string): Array<[string, G9PreferenceFileValue]>;\n /** The file path (for diagnostics). */\n readonly path: string;\n}\n\n/** The file of a namespace: `<dir>/<namespace>.prefs.json` (unsafe characters replaced). */\nexport function preferenceFilePath(dir: string, namespace: string): string {\n return join(dir, `${namespace.replace(/[^A-Za-z0-9._-]/g, '_') || 'default'}.prefs.json`);\n}\n\n/**\n * Opens (lazily creates) the preference file of a namespace. A missing or unreadable file reads as empty (a corrupt\n * file is never trusted, and the next write replaces it); a leftover temp file from an interrupted write is ignored.\n */\nexport function openPreferenceFile(\n path: string,\n fs: G9PreferenceFs = nodeFs as unknown as G9PreferenceFs,\n): G9PreferenceFile {\n let data: Record<string, G9PreferenceFileValue> | null = null;\n const load = (): Record<string, G9PreferenceFileValue> => {\n if (data) return data;\n data = {};\n if (!fs.existsSync(path)) return data;\n try {\n const parsed = JSON.parse(fs.readFileSync(path, 'utf8')) as unknown;\n if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {\n for (const [key, value] of Object.entries(parsed as Record<string, unknown>)) {\n if (typeof value === 'number' || typeof value === 'string') data[key] = value;\n }\n }\n } catch {\n // Corrupt: start empty; the next write replaces it.\n }\n return data;\n };\n const save = () => {\n const current = load();\n const temp = `${path}.tmp`;\n fs.mkdirSync(dirname(path), { recursive: true });\n fs.writeFileSync(temp, JSON.stringify(current));\n fs.renameSync(temp, path);\n };\n const mutate = (change: (d: Record<string, G9PreferenceFileValue>) => void) => {\n const current = load();\n const before = { ...current };\n change(current);\n try {\n save();\n } catch (error) {\n // The write failed: memory goes back to what the file still holds.\n data = before;\n throw error;\n }\n };\n return {\n path,\n getInt(key, defaultValue) {\n const v = load()[key];\n return typeof v === 'number' && Number.isInteger(v) ? v : defaultValue;\n },\n setInt(key, value) {\n mutate((d) => {\n d[key] = value;\n });\n },\n getString(key, defaultValue) {\n const v = load()[key];\n return typeof v === 'string' ? v : defaultValue;\n },\n setString(key, value) {\n mutate((d) => {\n if (value === null) delete d[key];\n else d[key] = value;\n });\n },\n remove(key) {\n if (!(key in load())) return;\n mutate((d) => {\n delete d[key];\n });\n },\n entries(prefix) {\n return Object.entries(load()).filter(([key]) => key.startsWith(prefix));\n },\n };\n}\n"],"names":["preferenceFilePath","dir","namespace","join","openPreferenceFile","path","fs","nodeFs","data","load","parsed","JSON","Array","key","value","Object","save","current","temp","dirname","mutate","change","before","error","defaultValue","v","Number","d","prefix"],"mappings":";;AA+BO,SAASA,mBAAmBC,GAAW,EAAEC,SAAiB;IAC/D,OAAOC,KAAKF,KAAK,GAAGC,UAAU,OAAO,CAAC,oBAAoB,QAAQ,UAAU,WAAW,CAAC;AAC1F;AAMO,SAASE,mBACdC,IAAY,EACZC,KAAqBC,oBAAmC;IAExD,IAAIC,OAAqD;IACzD,MAAMC,OAAO;QACX,IAAID,MAAM,OAAOA;QACjBA,OAAO,CAAC;QACR,IAAI,CAACF,GAAG,UAAU,CAACD,OAAO,OAAOG;QACjC,IAAI;YACF,MAAME,SAASC,KAAK,KAAK,CAACL,GAAG,YAAY,CAACD,MAAM;YAChD,IAAIK,UAAU,AAAkB,YAAlB,OAAOA,UAAuB,CAACE,MAAM,OAAO,CAACF,SACzD;gBAAA,KAAK,MAAM,CAACG,KAAKC,MAAM,IAAIC,OAAO,OAAO,CAACL,QACxC,IAAI,AAAiB,YAAjB,OAAOI,SAAsB,AAAiB,YAAjB,OAAOA,OAAoBN,IAAI,CAACK,IAAI,GAAGC;YAC1E;QAEJ,EAAE,OAAM,CAER;QACA,OAAON;IACT;IACA,MAAMQ,OAAO;QACX,MAAMC,UAAUR;QAChB,MAAMS,OAAO,GAAGb,KAAK,IAAI,CAAC;QAC1BC,GAAG,SAAS,CAACa,QAAQd,OAAO;YAAE,WAAW;QAAK;QAC9CC,GAAG,aAAa,CAACY,MAAMP,KAAK,SAAS,CAACM;QACtCX,GAAG,UAAU,CAACY,MAAMb;IACtB;IACA,MAAMe,SAAS,CAACC;QACd,MAAMJ,UAAUR;QAChB,MAAMa,SAAS;YAAE,GAAGL,OAAO;QAAC;QAC5BI,OAAOJ;QACP,IAAI;YACFD;QACF,EAAE,OAAOO,OAAO;YAEdf,OAAOc;YACP,MAAMC;QACR;IACF;IACA,OAAO;QACLlB;QACA,QAAOQ,GAAG,EAAEW,YAAY;YACtB,MAAMC,IAAIhB,MAAM,CAACI,IAAI;YACrB,OAAO,AAAa,YAAb,OAAOY,KAAkBC,OAAO,SAAS,CAACD,KAAKA,IAAID;QAC5D;QACA,QAAOX,GAAG,EAAEC,KAAK;YACfM,OAAO,CAACO;gBACNA,CAAC,CAACd,IAAI,GAAGC;YACX;QACF;QACA,WAAUD,GAAG,EAAEW,YAAY;YACzB,MAAMC,IAAIhB,MAAM,CAACI,IAAI;YACrB,OAAO,AAAa,YAAb,OAAOY,IAAiBA,IAAID;QACrC;QACA,WAAUX,GAAG,EAAEC,KAAK;YAClBM,OAAO,CAACO;gBACN,IAAIb,AAAU,SAAVA,OAAgB,OAAOa,CAAC,CAACd,IAAI;qBAC5Bc,CAAC,CAACd,IAAI,GAAGC;YAChB;QACF;QACA,QAAOD,GAAG;YACR,IAAI,CAAEA,CAAAA,OAAOJ,MAAK,GAAI;YACtBW,OAAO,CAACO;gBACN,OAAOA,CAAC,CAACd,IAAI;YACf;QACF;QACA,SAAQe,MAAM;YACZ,OAAOb,OAAO,OAAO,CAACN,QAAQ,MAAM,CAAC,CAAC,CAACI,IAAI,GAAKA,IAAI,UAAU,CAACe;QACjE;IACF;AACF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=preload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preload.d.ts","sourceRoot":"","sources":["../../src/node/preload.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sqlite-worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqlite-worker.d.ts","sourceRoot":"","sources":["../../src/node/sqlite-worker.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import type { G9SqliteBridge, G9WireError } from '../protocol.js';
2
+ /** The parts of `node:worker_threads` Worker the host uses (injectable for tests). */
3
+ export interface G9WorkerLike {
4
+ postMessage(message: unknown): void;
5
+ on(event: 'message', listener: (message: {
6
+ id: number;
7
+ ok: boolean;
8
+ value?: unknown;
9
+ error?: G9WireError;
10
+ }) => void): unknown;
11
+ on(event: 'error', listener: (error: unknown) => void): unknown;
12
+ on(event: 'exit', listener: (code: number) => void): unknown;
13
+ terminate(): Promise<number> | unknown;
14
+ }
15
+ /**
16
+ * Creates the bridge object over worker threads. `spawn` starts one worker (production: `new Worker(workerFile)`);
17
+ * `capabilities` is answered by a short-lived worker too, so the preload process never opens a database itself.
18
+ */
19
+ export declare function createWorkerSqliteBridge(spawn: () => G9WorkerLike): G9SqliteBridge;
20
+ //# sourceMappingURL=worker-host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker-host.d.ts","sourceRoot":"","sources":["../../src/node/worker-host.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAGV,cAAc,EAEd,WAAW,EAEZ,MAAM,gBAAgB,CAAC;AAExB,sFAAsF;AACtF,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACpC,EAAE,CACA,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,CAAC,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,GAC7F,OAAO,CAAC;IACX,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC;IAChE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC;IAC7D,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC;CACxC;AAiBD;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,YAAY,GAAG,cAAc,CA0HlF"}