dirsql 0.3.45 → 0.3.46
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/cli/interpret/index.d.ts +1 -1
- package/dist/cli/interpret/index.d.ts.map +1 -1
- package/dist/cli/interpret/index.js +13 -5
- package/dist/cli/interpret/index.js.map +1 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +4 -10
- package/dist/cli/main.js.map +1 -1
- package/dist/dirsql.d.ts +0 -49
- package/dist/dirsql.d.ts.map +1 -1
- package/dist/dirsql.js +2 -12
- package/dist/dirsql.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +11 -14
- package/dist/cli/interpret/build-tables.d.ts +0 -3
- package/dist/cli/interpret/build-tables.d.ts.map +0 -1
- package/dist/cli/interpret/build-tables.js +0 -18
- package/dist/cli/interpret/build-tables.js.map +0 -1
- package/dist/cli/interpret/dispatch-extract.d.ts +0 -16
- package/dist/cli/interpret/dispatch-extract.d.ts.map +0 -1
- package/dist/cli/interpret/dispatch-extract.js +0 -25
- package/dist/cli/interpret/dispatch-extract.js.map +0 -1
- package/dist/cli/interpret/err-message.d.ts +0 -2
- package/dist/cli/interpret/err-message.d.ts.map +0 -1
- package/dist/cli/interpret/err-message.js +0 -7
- package/dist/cli/interpret/err-message.js.map +0 -1
- package/dist/cli/interpret/interpret.d.ts +0 -2
- package/dist/cli/interpret/interpret.d.ts.map +0 -1
- package/dist/cli/interpret/interpret.js +0 -82
- package/dist/cli/interpret/interpret.js.map +0 -1
- package/dist/cli/interpret/load-app.d.ts +0 -5
- package/dist/cli/interpret/load-app.d.ts.map +0 -1
- package/dist/cli/interpret/load-app.js +0 -22
- package/dist/cli/interpret/load-app.js.map +0 -1
- package/dist/cli/interpret/write-message.d.ts +0 -2
- package/dist/cli/interpret/write-message.d.ts.map +0 -1
- package/dist/cli/interpret/write-message.js +0 -8
- package/dist/cli/interpret/write-message.js.map +0 -1
- package/dist/resolve-config.d.ts +0 -3
- package/dist/resolve-config.d.ts.map +0 -1
- package/dist/resolve-config.js +0 -58
- package/dist/resolve-config.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/interpret/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/interpret/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC"}
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
//
|
|
2
|
-
// `main`) can `import { interpret } from "./interpret/index.js"`.
|
|
1
|
+
// Empty package shell — the native-config `interpret` subcommand was removed.
|
|
3
2
|
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
|
|
3
|
+
// The `interpret` NDJSON helper (`interpret`, `load-app`, `dispatch-extract`,
|
|
4
|
+
// `build-tables`, `err-message`, `write-message`) was removed in #321 (#324).
|
|
5
|
+
// The CLI now accepts only `.dirsql.toml`; to run user-defined `extract`
|
|
6
|
+
// callbacks, use the programmatic SDK (`new DirSQL(...)` with in-process
|
|
7
|
+
// closures).
|
|
8
|
+
//
|
|
9
|
+
// This file carries no logic and no re-exports. It remains only because the
|
|
10
|
+
// colocated-test tooling cannot yet express *deleting* an exempt barrel (the
|
|
11
|
+
// co-change check flags a deleted source that has no co-deleted colocated
|
|
12
|
+
// test, and a retained exempt for a deleted path is rejected as stale). The
|
|
13
|
+
// directory is removed once that is resolved.
|
|
14
|
+
export {};
|
|
7
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/interpret/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/interpret/index.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAC9E,yEAAyE;AACzE,yEAAyE;AACzE,aAAa;AACb,EAAE;AACF,4EAA4E;AAC5E,6EAA6E;AAC7E,0EAA0E;AAC1E,4EAA4E;AAC5E,8CAA8C;AAC9C,OAAO,EAAE,CAAC"}
|
package/dist/cli/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":"AASA,wBAAsB,IAAI,CACxB,IAAI,GAAE,MAAM,EAA0B,GACrC,OAAO,CAAC,IAAI,CAAC,CAUf"}
|
package/dist/cli/main.js
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
// Launcher entry:
|
|
2
|
-
// exit code, and signals.
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
// (#196) without depending on the bundled Rust binary.
|
|
1
|
+
// Launcher entry: resolve the bundled `dirsql` binary and forward argv,
|
|
2
|
+
// exit code, and signals to it. The launcher is a transparent forwarder —
|
|
3
|
+
// every argv (including any subcommand) goes straight to the Rust binary,
|
|
4
|
+
// which owns subcommand dispatch and clap-rejects unknown ones.
|
|
6
5
|
import { spawnSync } from "node:child_process";
|
|
7
6
|
import { die } from "./die.js";
|
|
8
|
-
import { interpret } from "./interpret/index.js";
|
|
9
7
|
import { resolveBinary } from "./resolve-binary.js";
|
|
10
8
|
export async function main(argv = process.argv.slice(2)) {
|
|
11
|
-
if (argv[0] === "interpret") {
|
|
12
|
-
const code = await interpret(argv[1] ?? "");
|
|
13
|
-
process.exit(code);
|
|
14
|
-
}
|
|
15
9
|
const binary = resolveBinary();
|
|
16
10
|
const result = spawnSync(binary, argv, { stdio: "inherit" });
|
|
17
11
|
if (result.error) {
|
package/dist/cli/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,0EAA0E;AAC1E,0EAA0E;AAC1E,gEAAgE;AAEhE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,CAAC,KAAK,UAAU,IAAI,CACxB,OAAiB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAEtC,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAC/B,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IAC7D,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAC/B,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;AACnC,CAAC"}
|
package/dist/dirsql.d.ts
CHANGED
|
@@ -19,14 +19,6 @@ export interface ExtensionSpec {
|
|
|
19
19
|
*/
|
|
20
20
|
entrypoint?: string;
|
|
21
21
|
}
|
|
22
|
-
/**
|
|
23
|
-
* A resolved SQLite extension as it appears in the {@link DirSQLConfig}
|
|
24
|
-
* snapshot: `entrypoint` is normalized to `null` when no override was given.
|
|
25
|
-
*/
|
|
26
|
-
export interface ResolvedExtension {
|
|
27
|
-
path: string;
|
|
28
|
-
entrypoint: string | null;
|
|
29
|
-
}
|
|
30
22
|
/**
|
|
31
23
|
* Options accepted by the {@link DirSQL} constructor.
|
|
32
24
|
*
|
|
@@ -82,42 +74,6 @@ export interface RowEvent {
|
|
|
82
74
|
error?: string | null;
|
|
83
75
|
filePath?: string | null;
|
|
84
76
|
}
|
|
85
|
-
/**
|
|
86
|
-
* Serializable per-table portion of {@link DirSQLConfig}. Excludes the
|
|
87
|
-
* `extract` callback (closures aren't serializable) and the table's SQL
|
|
88
|
-
* `name` (derivable from `ddl`).
|
|
89
|
-
*/
|
|
90
|
-
export interface TableConfig {
|
|
91
|
-
ddl: string;
|
|
92
|
-
glob: string;
|
|
93
|
-
strict: boolean;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Serializable snapshot of a {@link DirSQL} instance's resolved runtime
|
|
97
|
-
* state, as produced by {@link DirSQL.toJSON} / `JSON.stringify(db)`.
|
|
98
|
-
*
|
|
99
|
-
* The shape is identical across the Python, Rust, and TypeScript SDKs
|
|
100
|
-
* (modulo `persist_path` ↔ `persistPath` case): the same payload can flow
|
|
101
|
-
* through the `interpret` handshake regardless of which SDK produced it.
|
|
102
|
-
*
|
|
103
|
-
* Construction artifacts that are no longer meaningful after the instance
|
|
104
|
-
* exists are intentionally excluded — `config` (already merged into `root`
|
|
105
|
-
* / `tables` / `ignore`), per-table `extract`, and per-table `name`.
|
|
106
|
-
*/
|
|
107
|
-
export interface DirSQLConfig {
|
|
108
|
-
root: string;
|
|
109
|
-
tables: TableConfig[];
|
|
110
|
-
ignore: string[];
|
|
111
|
-
persist: boolean;
|
|
112
|
-
persistPath: string | null;
|
|
113
|
-
/**
|
|
114
|
-
* SQLite extensions to load at startup, in load order. Programmatic
|
|
115
|
-
* entries (verbatim paths) first, then config-file `[[dirsql.extension]]`
|
|
116
|
-
* entries with relative paths resolved against the config's parent
|
|
117
|
-
* directory. Empty when none are configured.
|
|
118
|
-
*/
|
|
119
|
-
extensions: ResolvedExtension[];
|
|
120
|
-
}
|
|
121
77
|
/**
|
|
122
78
|
* Ephemeral SQL index over a local directory.
|
|
123
79
|
*
|
|
@@ -188,11 +144,6 @@ export declare class DirSQL {
|
|
|
188
144
|
* duration of the poll timeout.
|
|
189
145
|
*/
|
|
190
146
|
pollEvents(timeoutMs: number): Promise<RowEvent[]>;
|
|
191
|
-
/**
|
|
192
|
-
* Resolved construction state. Recomputed on each call; reads the
|
|
193
|
-
* `.dirsql.toml` if `config` was supplied. Works before `ready`.
|
|
194
|
-
*/
|
|
195
|
-
toJSON(): DirSQLConfig;
|
|
196
147
|
/**
|
|
197
148
|
* Watch for file change events as an async iterable.
|
|
198
149
|
*
|
package/dist/dirsql.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dirsql.d.ts","sourceRoot":"","sources":["../src/dirsql.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dirsql.d.ts","sourceRoot":"","sources":["../src/dirsql.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,8BAA8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC;IACpB,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB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AAI,EAAE,OAAO,CAAC;CAaxD"}
|
package/dist/dirsql.js
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
// unit test instead of an exemption (#239). The native binding is reached
|
|
5
5
|
// through `getCore()` (see `core.ts`), which tests fake.
|
|
6
6
|
import { getCore } from "./core.js";
|
|
7
|
-
import { resolveConfig } from "./resolve-config.js";
|
|
8
7
|
/**
|
|
9
8
|
* Ephemeral SQL index over a local directory.
|
|
10
9
|
*
|
|
@@ -45,10 +44,8 @@ export class DirSQL {
|
|
|
45
44
|
ready;
|
|
46
45
|
// Initialized by `ready`. Do NOT touch before awaiting `ready`.
|
|
47
46
|
_inner;
|
|
48
|
-
// Constructor options preserved verbatim
|
|
49
|
-
//
|
|
50
|
-
// `dirsql interpret` (#196) can reach the user-supplied `extract`
|
|
51
|
-
// callbacks (which `toJSON()` deliberately drops). Public-by-design.
|
|
47
|
+
// Constructor options preserved verbatim for inspection without waiting on
|
|
48
|
+
// `ready`. Public-by-design.
|
|
52
49
|
_options;
|
|
53
50
|
constructor(arg) {
|
|
54
51
|
const options = typeof arg === "string" ? { config: arg } : arg;
|
|
@@ -94,13 +91,6 @@ export class DirSQL {
|
|
|
94
91
|
await this.ready;
|
|
95
92
|
return this._inner.pollEvents(timeoutMs);
|
|
96
93
|
}
|
|
97
|
-
/**
|
|
98
|
-
* Resolved construction state. Recomputed on each call; reads the
|
|
99
|
-
* `.dirsql.toml` if `config` was supplied. Works before `ready`.
|
|
100
|
-
*/
|
|
101
|
-
toJSON() {
|
|
102
|
-
return resolveConfig(this._options);
|
|
103
|
-
}
|
|
104
94
|
/**
|
|
105
95
|
* Watch for file change events as an async iterable.
|
|
106
96
|
*
|
package/dist/dirsql.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dirsql.js","sourceRoot":"","sources":["../src/dirsql.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,EAAE;AACF,wEAAwE;AACxE,0EAA0E;AAC1E,yDA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K,CAAC;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,YAAY;QAChB,MAAM,IAAI,CAAC,KAAK,CAAC;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;IACpC,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,UAAU,CAAC,SAAiB;QAChC,MAAM,IAAI,CAAC,KAAK,CAAC;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IAC3C,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,CAAC,KAAK;QACV,MAAM,IAAI,CAAC,KAAK,CAAC;QACjB,MAAM,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;QACjC,OAAO,IAAI,EAAE,CAAC;YACZ,qEAAqE;YACrE,gEAAgE;YAChE,sEAAsE;YACtE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;YACjD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;gBAC3B,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { DirSQL } from "./dirsql.js";
|
|
2
|
-
export type {
|
|
2
|
+
export type { DirSQLOptions, ExtensionSpec, RowEvent, } from "./dirsql.js";
|
|
3
3
|
export { parseTableName } from "./parse-table-name.js";
|
|
4
4
|
export { Table } from "./table.js";
|
|
5
5
|
export type { TableDef } from "./table.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,YAAY,EACV,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,YAAY,EACV,aAAa,EACb,aAAa,EACb,QAAQ,GACT,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
//
|
|
13
13
|
// This file is a thin re-export barrel: the implementation lives in
|
|
14
14
|
// colocated-tested modules (`table.ts`, `core.ts`, `parse-table-name.ts`,
|
|
15
|
-
// `dirsql.ts`), each carrying its own unit test. The barrel
|
|
16
|
-
// covered by `index.test.ts
|
|
15
|
+
// `dirsql.ts`), each carrying its own unit test. The barrel's re-export
|
|
16
|
+
// statements are covered by `index.test.ts`.
|
|
17
17
|
export { DirSQL } from "./dirsql.js";
|
|
18
18
|
export { parseTableName } from "./parse-table-name.js";
|
|
19
19
|
export { Table } from "./table.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AACxE,kEAAkE;AAClE,uEAAuE;AACvE,qCAAqC;AACrC,EAAE;AACF,qEAAqE;AACrE,uEAAuE;AACvE,uEAAuE;AACvE,mEAAmE;AACnE,EAAE;AACF,oEAAoE;AACpE,0EAA0E;AAC1E,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AACxE,kEAAkE;AAClE,uEAAuE;AACvE,qCAAqC;AACrC,EAAE;AACF,qEAAqE;AACrE,uEAAuE;AACvE,uEAAuE;AACvE,mEAAmE;AACnE,EAAE;AACF,oEAAoE;AACpE,0EAA0E;AAC1E,wEAAwE;AACxE,6CAA6C;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAMrC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dirsql",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.46",
|
|
4
4
|
"description": "Ephemeral SQL index over a local directory",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/thekevinscott/dirsql",
|
|
@@ -215,19 +215,16 @@
|
|
|
215
215
|
"esbuild"
|
|
216
216
|
]
|
|
217
217
|
},
|
|
218
|
-
"dependencies": {
|
|
219
|
-
"smol-toml": "^1.6.1"
|
|
220
|
-
},
|
|
221
218
|
"optionalDependencies": {
|
|
222
|
-
"@dirsql/lib-linux-x64-gnu": "0.3.
|
|
223
|
-
"@dirsql/lib-linux-arm64-gnu": "0.3.
|
|
224
|
-
"@dirsql/lib-darwin-x64": "0.3.
|
|
225
|
-
"@dirsql/lib-darwin-arm64": "0.3.
|
|
226
|
-
"@dirsql/lib-win32-x64-msvc": "0.3.
|
|
227
|
-
"@dirsql/cli-linux-x64-gnu": "0.3.
|
|
228
|
-
"@dirsql/cli-linux-arm64-gnu": "0.3.
|
|
229
|
-
"@dirsql/cli-darwin-x64": "0.3.
|
|
230
|
-
"@dirsql/cli-darwin-arm64": "0.3.
|
|
231
|
-
"@dirsql/cli-win32-x64-msvc": "0.3.
|
|
219
|
+
"@dirsql/lib-linux-x64-gnu": "0.3.46",
|
|
220
|
+
"@dirsql/lib-linux-arm64-gnu": "0.3.46",
|
|
221
|
+
"@dirsql/lib-darwin-x64": "0.3.46",
|
|
222
|
+
"@dirsql/lib-darwin-arm64": "0.3.46",
|
|
223
|
+
"@dirsql/lib-win32-x64-msvc": "0.3.46",
|
|
224
|
+
"@dirsql/cli-linux-x64-gnu": "0.3.46",
|
|
225
|
+
"@dirsql/cli-linux-arm64-gnu": "0.3.46",
|
|
226
|
+
"@dirsql/cli-darwin-x64": "0.3.46",
|
|
227
|
+
"@dirsql/cli-darwin-arm64": "0.3.46",
|
|
228
|
+
"@dirsql/cli-win32-x64-msvc": "0.3.46"
|
|
232
229
|
}
|
|
233
230
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-tables.d.ts","sourceRoot":"","sources":["../../../src/cli/interpret/build-tables.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,QAAQ,EAAkB,MAAM,gBAAgB,CAAC;AAE5E,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAU9D"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// Build a `name -> TableDef` lookup the dispatcher can index by the
|
|
2
|
-
// `table` field on each extract request. Table name comes from the
|
|
3
|
-
// core's canonical `parseTableName` (Rust-side
|
|
4
|
-
// `dirsql::db::parse_table_name`) so the JS side and the orchestrator
|
|
5
|
-
// agree without a duplicate regex.
|
|
6
|
-
import { parseTableName } from "../../index.js";
|
|
7
|
-
export function buildTables(app) {
|
|
8
|
-
const out = new Map();
|
|
9
|
-
for (const t of app._options.tables ?? []) {
|
|
10
|
-
const name = parseTableName(t.ddl);
|
|
11
|
-
if (name === null) {
|
|
12
|
-
throw new Error(`could not parse table name from DDL: ${t.ddl}`);
|
|
13
|
-
}
|
|
14
|
-
out.set(name, t);
|
|
15
|
-
}
|
|
16
|
-
return out;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=build-tables.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-tables.js","sourceRoot":"","sources":["../../../src/cli/interpret/build-tables.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,mEAAmE;AACnE,+CAA+C;AAC/C,sEAAsE;AACtE,mCAAmC;AAEnC,OAAO,EAA8B,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAE5E,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,MAAM,GAAG,GAAG,IAAI,GAAG,EAAoB,CAAC;IACxC,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;QAC1C,MAAM,IAAI,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACnC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;QACnE,CAAC;QACD,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACnB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { TableDef } from "../../index.js";
|
|
2
|
-
export interface ExtractRequest {
|
|
3
|
-
type?: string;
|
|
4
|
-
id?: unknown;
|
|
5
|
-
table?: string;
|
|
6
|
-
path?: string;
|
|
7
|
-
}
|
|
8
|
-
export interface ResultMessage {
|
|
9
|
-
type: "result";
|
|
10
|
-
id: unknown;
|
|
11
|
-
ok: boolean;
|
|
12
|
-
rows?: unknown[];
|
|
13
|
-
error?: string;
|
|
14
|
-
}
|
|
15
|
-
export declare function dispatchExtract(req: ExtractRequest, tables: Map<string, TableDef>): Promise<ResultMessage>;
|
|
16
|
-
//# sourceMappingURL=dispatch-extract.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch-extract.d.ts","sourceRoot":"","sources":["../../../src/cli/interpret/dispatch-extract.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,QAAQ,CAAC;IACf,EAAE,EAAE,OAAO,CAAC;IACZ,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,eAAe,CACnC,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,GAC5B,OAAO,CAAC,aAAa,CAAC,CAiBxB"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// Single-request handler. Given a parsed extract request and the
|
|
2
|
-
// `name -> TableDef` map, call the user's extract callback (which may
|
|
3
|
-
// be sync or async) and build the NDJSON response payload the loop
|
|
4
|
-
// will write back.
|
|
5
|
-
import { errMessage } from "./err-message.js";
|
|
6
|
-
export async function dispatchExtract(req, tables) {
|
|
7
|
-
const { id, table: name, path } = req;
|
|
8
|
-
const table = name === undefined ? undefined : tables.get(name);
|
|
9
|
-
if (!table) {
|
|
10
|
-
return {
|
|
11
|
-
type: "result",
|
|
12
|
-
id,
|
|
13
|
-
ok: false,
|
|
14
|
-
error: `unknown table: ${JSON.stringify(name)}`,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
try {
|
|
18
|
-
const rows = await table.extract(path);
|
|
19
|
-
return { type: "result", id, ok: true, rows };
|
|
20
|
-
}
|
|
21
|
-
catch (e) {
|
|
22
|
-
return { type: "result", id, ok: false, error: errMessage(e) };
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=dispatch-extract.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch-extract.js","sourceRoot":"","sources":["../../../src/cli/interpret/dispatch-extract.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,sEAAsE;AACtE,mEAAmE;AACnE,mBAAmB;AAGnB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAiB9C,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,GAAmB,EACnB,MAA6B;IAE7B,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC;IACtC,MAAM,KAAK,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChE,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,EAAE;YACF,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,kBAAkB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE;SAChD,CAAC;IACJ,CAAC;IACD,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,IAAc,CAAC,CAAC;QACjD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAChD,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;IACjE,CAAC;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"err-message.d.ts","sourceRoot":"","sources":["../../../src/cli/interpret/err-message.ts"],"names":[],"mappings":"AAIA,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAE7C"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// Coerce an unknown thrown value into a human-readable string for
|
|
2
|
-
// stderr / NDJSON `error` fields. `Error.message` when available,
|
|
3
|
-
// `String(e)` otherwise.
|
|
4
|
-
export function errMessage(e) {
|
|
5
|
-
return e instanceof Error ? e.message : String(e);
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=err-message.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"err-message.js","sourceRoot":"","sources":["../../../src/cli/interpret/err-message.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAClE,yBAAyB;AAEzB,MAAM,UAAU,UAAU,CAAC,CAAU;IACnC,OAAO,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interpret.d.ts","sourceRoot":"","sources":["../../../src/cli/interpret/interpret.ts"],"names":[],"mappings":"AA2BA,wBAAsB,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA+DnE"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
// Subcommand entry point for `dirsql interpret <config>`.
|
|
2
|
-
//
|
|
3
|
-
// Glues the per-purpose helpers (`loadApp`, `buildTables`,
|
|
4
|
-
// `dispatchExtract`, `writeMessage`) into the long-running NDJSON
|
|
5
|
-
// loop:
|
|
6
|
-
//
|
|
7
|
-
// handshake (helper -> caller, once on startup):
|
|
8
|
-
// {"type": "config", "state": <app.toJSON()>}
|
|
9
|
-
//
|
|
10
|
-
// extract request (caller -> helper):
|
|
11
|
-
// {"type": "extract", "id": <int>, "table": "<name>", "path": "<abs>"}
|
|
12
|
-
//
|
|
13
|
-
// extract response (helper -> caller):
|
|
14
|
-
// {"type": "result", "id": <int>, "ok": true, "rows": [...]}
|
|
15
|
-
// {"type": "result", "id": <int>, "ok": false, "error": "<msg>"}
|
|
16
|
-
//
|
|
17
|
-
// Exits 0 when stdin closes; non-zero with a single `dirsql interpret:`
|
|
18
|
-
// line on stderr if the config can't be loaded.
|
|
19
|
-
import { createInterface } from "node:readline";
|
|
20
|
-
import { buildTables } from "./build-tables.js";
|
|
21
|
-
import { dispatchExtract } from "./dispatch-extract.js";
|
|
22
|
-
import { errMessage } from "./err-message.js";
|
|
23
|
-
import { loadApp } from "./load-app.js";
|
|
24
|
-
import { writeMessage } from "./write-message.js";
|
|
25
|
-
export async function interpret(configPath) {
|
|
26
|
-
if (!configPath) {
|
|
27
|
-
process.stderr.write("dirsql interpret: expected one config path, got 0\n");
|
|
28
|
-
return 1;
|
|
29
|
-
}
|
|
30
|
-
let app;
|
|
31
|
-
try {
|
|
32
|
-
app = await loadApp(configPath);
|
|
33
|
-
}
|
|
34
|
-
catch (e) {
|
|
35
|
-
process.stderr.write(`dirsql interpret: ${errMessage(e)}\n`);
|
|
36
|
-
return 1;
|
|
37
|
-
}
|
|
38
|
-
// The SDK constructor kicks off a background scan that calls each
|
|
39
|
-
// table's `extract` for every matched file. If a user `extract`
|
|
40
|
-
// throws, the scan rejects -- and since interpret never awaits the
|
|
41
|
-
// scan (it dispatches to `extract` itself per request), the rejection
|
|
42
|
-
// would surface as an unhandled promise rejection and crash Node.
|
|
43
|
-
// Swallow it here, before any early return, so a rejected scan never
|
|
44
|
-
// escapes; per-request errors are still reported in the extract-response.
|
|
45
|
-
app.ready.catch(() => { });
|
|
46
|
-
// A config file describes a single DirSQL; it must not itself delegate to
|
|
47
|
-
// another `config=` path. The interpret handshake has no field for a nested
|
|
48
|
-
// config and would recurse, so reject it up front.
|
|
49
|
-
if (app._options.config !== undefined) {
|
|
50
|
-
process.stderr.write("dirsql interpret: a config file cannot itself set config= " +
|
|
51
|
-
"(nested config is not supported)\n");
|
|
52
|
-
return 1;
|
|
53
|
-
}
|
|
54
|
-
const tables = buildTables(app);
|
|
55
|
-
// When the config supplies neither `root` nor `config=`, the resolved root
|
|
56
|
-
// is "". Default it to the process cwd -- the directory the `dirsql` command
|
|
57
|
-
// was launched from, which interpret inherits from the parent binary -- so a
|
|
58
|
-
// root-less config indexes "here".
|
|
59
|
-
const state = app.toJSON();
|
|
60
|
-
if (!state.root) {
|
|
61
|
-
state.root = process.cwd();
|
|
62
|
-
}
|
|
63
|
-
writeMessage({ type: "config", state });
|
|
64
|
-
for await (const line of createInterface({ input: process.stdin })) {
|
|
65
|
-
if (!line.trim()) {
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
let req;
|
|
69
|
-
try {
|
|
70
|
-
req = JSON.parse(line);
|
|
71
|
-
}
|
|
72
|
-
catch {
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
if (!req || typeof req !== "object" || req.type !== "extract") {
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
writeMessage(await dispatchExtract(req, tables));
|
|
79
|
-
}
|
|
80
|
-
return 0;
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=interpret.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interpret.js","sourceRoot":"","sources":["../../../src/cli/interpret/interpret.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,EAAE;AACF,2DAA2D;AAC3D,kEAAkE;AAClE,QAAQ;AACR,EAAE;AACF,mDAAmD;AACnD,kDAAkD;AAClD,EAAE;AACF,wCAAwC;AACxC,2EAA2E;AAC3E,EAAE;AACF,yCAAyC;AACzC,kEAAkE;AAClE,qEAAqE;AACrE,EAAE;AACF,wEAAwE;AACxE,gDAAgD;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,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C,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC7B,CAAC;IACD,YAAY,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;IAExC,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,eAAe,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC;QACnE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;YACjB,SAAS;QACX,CAAC;QACD,IAAI,GAAmE,CAAC;QACxE,IAAI,CAAC;YACH,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;QACD,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC9D,SAAS;QACX,CAAC;QACD,YAAY,CAAC,MAAM,eAAe,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"load-app.d.ts","sourceRoot":"","sources":["../../../src/cli/interpret/load-app.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAM7C,wBAAsB,OAAO,CAC3B,UAAU,EAAE,MAAM,EAClB,QAAQ,GAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAC3C,GACZ,OAAO,CAAC,MAAM,CAAC,CAQjB"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// Dynamically import a user's `dirsql` config file (`.js` / `.mjs` /
|
|
2
|
-
// `.cjs`) and return its default export. The default export should be
|
|
3
|
-
// a constructed `DirSQL` instance; the caller relies on the runtime
|
|
4
|
-
// shape (no `instanceof` check), so any object that quacks like one
|
|
5
|
-
// will pass through.
|
|
6
|
-
//
|
|
7
|
-
// Throws if the dynamic `import()` fails or if the loaded module has
|
|
8
|
-
// no `default` export. The launcher in `cli/main.ts` catches both as
|
|
9
|
-
// startup failures.
|
|
10
|
-
import { pathToFileURL } from "node:url";
|
|
11
|
-
// The dynamic `import()` is the effectful collaborator. It can't be
|
|
12
|
-
// `vi.mock()`-ed (the specifier is a computed file URL), so it's exposed as
|
|
13
|
-
// an injected `importer` callback. The default preserves production behavior
|
|
14
|
-
// exactly; tests pass a fake `importer` to isolate the unit.
|
|
15
|
-
export async function loadApp(configPath, importer = (url) => import(url)) {
|
|
16
|
-
const mod = await importer(pathToFileURL(configPath).href);
|
|
17
|
-
if (!mod.default) {
|
|
18
|
-
throw new Error(`${configPath}: module must default-export a DirSQL instance`);
|
|
19
|
-
}
|
|
20
|
-
return mod.default;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=load-app.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"load-app.js","sourceRoot":"","sources":["../../../src/cli/interpret/load-app.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sEAAsE;AACtE,oEAAoE;AACpE,oEAAoE;AACpE,qBAAqB;AACrB,EAAE;AACF,qEAAqE;AACrE,qEAAqE;AACrE,oBAAoB;AAEpB,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,oEAAoE;AACpE,4EAA4E;AAC5E,6EAA6E;AAC7E,6DAA6D;AAC7D,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,UAAkB,EAClB,WAA4D,CAAC,GAAG,EAAE,EAAE,CAClE,MAAM,CAAC,GAAG,CAAC;IAEb,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC;IAC3D,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CACb,GAAG,UAAU,gDAAgD,CAC9D,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC,OAAiB,CAAC;AAC/B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"write-message.d.ts","sourceRoot":"","sources":["../../../src/cli/interpret/write-message.ts"],"names":[],"mappings":"AAKA,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAE/C"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Single-line NDJSON writer. Each protocol message is one JSON object
|
|
2
|
-
// followed by `\n`; `process.stdout.write` flushes to the underlying
|
|
3
|
-
// pipe synchronously on most platforms when the stream is a pipe (as
|
|
4
|
-
// it is when the orchestrator spawns this process).
|
|
5
|
-
export function writeMessage(msg) {
|
|
6
|
-
process.stdout.write(`${JSON.stringify(msg)}\n`);
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=write-message.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"write-message.js","sourceRoot":"","sources":["../../../src/cli/interpret/write-message.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,qEAAqE;AACrE,qEAAqE;AACrE,oDAAoD;AAEpD,MAAM,UAAU,YAAY,CAAC,GAAY;IACvC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACnD,CAAC"}
|
package/dist/resolve-config.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-config.d.ts","sourceRoot":"","sources":["../src/resolve-config.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAK9D,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,YAAY,CAqDlE"}
|
package/dist/resolve-config.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
// Synchronous config resolver for `DirSQL.toJSON()`.
|
|
2
|
-
//
|
|
3
|
-
// Mirrors `DirSQLBuilder::resolve` in the Rust core: explicit options win
|
|
4
|
-
// for scalars; tables and ignore lists are concatenated; persist is OR-ed;
|
|
5
|
-
// path-valued config fields resolve relative to the config file's parent.
|
|
6
|
-
import { readFileSync } from "node:fs";
|
|
7
|
-
import { dirname, isAbsolute, resolve as resolvePath } from "node:path";
|
|
8
|
-
import { parse as parseToml } from "smol-toml";
|
|
9
|
-
export function resolveConfig(options) {
|
|
10
|
-
// When no config file is supplied, `cfg` is empty so `cfgDir` is never
|
|
11
|
-
// read (the path-resolution helper is only reached via `cfg.root` /
|
|
12
|
-
// `cfg.persist_path` lookups, both of which short-circuit on an empty cfg).
|
|
13
|
-
let cfg = {};
|
|
14
|
-
let cfgTables = [];
|
|
15
|
-
let cfgExtensions = [];
|
|
16
|
-
let cfgDir = "";
|
|
17
|
-
if (options.config !== undefined) {
|
|
18
|
-
const doc = parseToml(readFileSync(options.config, "utf8"));
|
|
19
|
-
cfg = (doc.dirsql ?? {});
|
|
20
|
-
cfgTables = (Array.isArray(doc.table) ? doc.table : []);
|
|
21
|
-
cfgExtensions = (Array.isArray(cfg.extension) ? cfg.extension : []);
|
|
22
|
-
cfgDir = dirname(resolvePath(options.config));
|
|
23
|
-
}
|
|
24
|
-
const abs = (p) => (isAbsolute(p) ? p : resolvePath(cfgDir, p));
|
|
25
|
-
return {
|
|
26
|
-
root: options.root ?? (typeof cfg.root === "string" ? abs(cfg.root) : cfgDir),
|
|
27
|
-
tables: [
|
|
28
|
-
...(options.tables ?? []).map((t) => ({
|
|
29
|
-
ddl: t.ddl,
|
|
30
|
-
glob: t.glob,
|
|
31
|
-
strict: t.strict === true,
|
|
32
|
-
})),
|
|
33
|
-
...cfgTables.map((e) => ({
|
|
34
|
-
ddl: e.ddl,
|
|
35
|
-
glob: e.glob,
|
|
36
|
-
strict: e.strict === true,
|
|
37
|
-
})),
|
|
38
|
-
],
|
|
39
|
-
ignore: [...(options.ignore ?? []), ...(cfg.ignore ?? [])],
|
|
40
|
-
persist: (options.persist ?? false) || cfg.persist === true,
|
|
41
|
-
persistPath: options.persistPath ??
|
|
42
|
-
(typeof cfg.persist_path === "string" ? abs(cfg.persist_path) : null),
|
|
43
|
-
// Programmatic extensions first (verbatim paths, mirroring the Rust
|
|
44
|
-
// builder), then config-file `[[dirsql.extension]]` entries with
|
|
45
|
-
// relative paths resolved against the config's parent directory.
|
|
46
|
-
extensions: [
|
|
47
|
-
...(options.extensions ?? []).map((e) => ({
|
|
48
|
-
path: e.path,
|
|
49
|
-
entrypoint: e.entrypoint ?? null,
|
|
50
|
-
})),
|
|
51
|
-
...cfgExtensions.map((e) => ({
|
|
52
|
-
path: abs(e.path),
|
|
53
|
-
entrypoint: e.entrypoint ?? null,
|
|
54
|
-
})),
|
|
55
|
-
],
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=resolve-config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-config.js","sourceRoot":"","sources":["../src/resolve-config.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,EAAE;AACF,0EAA0E;AAC1E,2EAA2E;AAC3E,0EAA0E;AAE1E,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAM/C,MAAM,UAAU,aAAa,CAAC,OAAsB;IAClD,uEAAuE;IACvE,oEAAoE;IACpE,4EAA4E;IAC5E,IAAI,GAAG,GAAQ,EAAE,CAAC;IAClB,IAAI,SAAS,GAAU,EAAE,CAAC;IAC1B,IAAI,aAAa,GAAU,EAAE,CAAC;IAC9B,IAAI,MAAM,GAAG,EAAE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