dirsql 0.3.44 → 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.
Files changed (48) hide show
  1. package/dist/cli/interpret/index.d.ts +1 -1
  2. package/dist/cli/interpret/index.d.ts.map +1 -1
  3. package/dist/cli/interpret/index.js +13 -5
  4. package/dist/cli/interpret/index.js.map +1 -1
  5. package/dist/cli/main.d.ts.map +1 -1
  6. package/dist/cli/main.js +4 -10
  7. package/dist/cli/main.js.map +1 -1
  8. package/dist/core.d.ts +2 -2
  9. package/dist/core.d.ts.map +1 -1
  10. package/dist/core.js.map +1 -1
  11. package/dist/dirsql.d.ts +27 -34
  12. package/dist/dirsql.d.ts.map +1 -1
  13. package/dist/dirsql.js +3 -13
  14. package/dist/dirsql.js.map +1 -1
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +2 -2
  18. package/dist/index.js.map +1 -1
  19. package/docs/api/index.md +3 -2
  20. package/package.json +11 -14
  21. package/dist/cli/interpret/build-tables.d.ts +0 -3
  22. package/dist/cli/interpret/build-tables.d.ts.map +0 -1
  23. package/dist/cli/interpret/build-tables.js +0 -18
  24. package/dist/cli/interpret/build-tables.js.map +0 -1
  25. package/dist/cli/interpret/dispatch-extract.d.ts +0 -16
  26. package/dist/cli/interpret/dispatch-extract.d.ts.map +0 -1
  27. package/dist/cli/interpret/dispatch-extract.js +0 -25
  28. package/dist/cli/interpret/dispatch-extract.js.map +0 -1
  29. package/dist/cli/interpret/err-message.d.ts +0 -2
  30. package/dist/cli/interpret/err-message.d.ts.map +0 -1
  31. package/dist/cli/interpret/err-message.js +0 -7
  32. package/dist/cli/interpret/err-message.js.map +0 -1
  33. package/dist/cli/interpret/interpret.d.ts +0 -2
  34. package/dist/cli/interpret/interpret.d.ts.map +0 -1
  35. package/dist/cli/interpret/interpret.js +0 -82
  36. package/dist/cli/interpret/interpret.js.map +0 -1
  37. package/dist/cli/interpret/load-app.d.ts +0 -5
  38. package/dist/cli/interpret/load-app.d.ts.map +0 -1
  39. package/dist/cli/interpret/load-app.js +0 -22
  40. package/dist/cli/interpret/load-app.js.map +0 -1
  41. package/dist/cli/interpret/write-message.d.ts +0 -2
  42. package/dist/cli/interpret/write-message.d.ts.map +0 -1
  43. package/dist/cli/interpret/write-message.js +0 -8
  44. package/dist/cli/interpret/write-message.js.map +0 -1
  45. package/dist/resolve-config.d.ts +0 -3
  46. package/dist/resolve-config.d.ts.map +0 -1
  47. package/dist/resolve-config.js +0 -43
  48. package/dist/resolve-config.js.map +0 -1
@@ -1,2 +1,2 @@
1
- export { interpret } from "./interpret.js";
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":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
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
- // Re-export the `interpret` entry point so callers (the launcher's
2
- // `main`) can `import { interpret } from "./interpret/index.js"`.
1
+ // Empty package shell — the native-config `interpret` subcommand was removed.
3
2
  //
4
- // Each helper lives in its own module so unit tests can exercise it in
5
- // isolation without spawning a subprocess.
6
- export { interpret } from "./interpret.js";
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,mEAAmE;AACnE,kEAAkE;AAClE,EAAE;AACF,uEAAuE;AACvE,2CAA2C;AAE3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
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"}
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":"AAWA,wBAAsB,IAAI,CACxB,IAAI,GAAE,MAAM,EAA0B,GACrC,OAAO,CAAC,IAAI,CAAC,CAef"}
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: spawn the resolved `dirsql` binary and forward argv,
2
- // exit code, and signals. When `argv[0] === "interpret"` the
3
- // in-process TS helper handles the subcommand directly so a Rust
4
- // orchestrator can spawn this script for native-language configs
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) {
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,6DAA6D;AAC7D,iEAAiE;AACjE,iEAAiE;AACjE,uDAAuD;AAEvD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,CAAC,KAAK,UAAU,IAAI,CACxB,OAAiB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAEtC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,WAAW,EAAE,CAAC;QAC5B,MAAM,IAAI,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAC5C,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC;IAED,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"}
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/core.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { RowEvent } from "./dirsql.js";
1
+ import type { ExtensionSpec, RowEvent } from "./dirsql.js";
2
2
  import type { TableDef } from "./table.js";
3
3
  export interface NativeDirSQL {
4
4
  query(sql: string): Promise<Record<string, unknown>[]>;
@@ -6,7 +6,7 @@ export interface NativeDirSQL {
6
6
  pollEvents(timeoutMs: number): Promise<RowEvent[]>;
7
7
  }
8
8
  export interface NativeDirSQLConstructor {
9
- openAsync(root: string | null, tables: TableDef[] | null, ignore: string[] | null, config: string | null, persist: boolean | null, persistPath: string | null): Promise<NativeDirSQL>;
9
+ openAsync(root: string | null, tables: TableDef[] | null, ignore: string[] | null, config: string | null, persist: boolean | null, persistPath: string | null, extensions: ExtensionSpec[] | null): Promise<NativeDirSQL>;
10
10
  }
11
11
  export interface CoreModule {
12
12
  DirSQL: NativeDirSQLConstructor;
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG3C,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;IACvD,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;CACpD;AAED,MAAM,WAAW,uBAAuB;IACtC,SAAS,CACP,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,EACzB,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EACvB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,OAAO,EAAE,OAAO,GAAG,IAAI,EACvB,WAAW,EAAE,MAAM,GAAG,IAAI,GACzB,OAAO,CAAC,YAAY,CAAC,CAAC;CAC1B;AAID,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,uBAAuB,CAAC;IAChC,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CAC5C;AAQD,wBAAgB,OAAO,IAAI,UAAU,CAKpC"}
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG3C,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;IACvD,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;CACpD;AAED,MAAM,WAAW,uBAAuB;IACtC,SAAS,CACP,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,EACzB,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EACvB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,OAAO,EAAE,OAAO,GAAG,IAAI,EACvB,WAAW,EAAE,MAAM,GAAG,IAAI,EAC1B,UAAU,EAAE,aAAa,EAAE,GAAG,IAAI,GACjC,OAAO,CAAC,YAAY,CAAC,CAAC;CAC1B;AAID,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,uBAAuB,CAAC;IAChC,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CAC5C;AAQD,wBAAgB,OAAO,IAAI,UAAU,CAKpC"}
package/dist/core.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,iEAAiE;AACjE,EAAE;AACF,wEAAwE;AACxE,4CAA4C;AAG5C,OAAO,EAAE,cAAc,IAAI,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AA4BhF,yEAAyE;AACzE,qEAAqE;AACrE,2EAA2E;AAC3E,+BAA+B;AAC/B,IAAI,IAAI,GAAsB,IAAI,CAAC;AAEnC,MAAM,UAAU,OAAO;IACrB,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClB,IAAI,GAAG,qBAAqB,EAAgB,CAAC;IAC/C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
1
+ {"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,iEAAiE;AACjE,EAAE;AACF,wEAAwE;AACxE,4CAA4C;AAG5C,OAAO,EAAE,cAAc,IAAI,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AA6BhF,yEAAyE;AACzE,qEAAqE;AACrE,2EAA2E;AAC3E,+BAA+B;AAC/B,IAAI,IAAI,GAAsB,IAAI,CAAC;AAEnC,MAAM,UAAU,OAAO;IACrB,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClB,IAAI,GAAG,qBAAqB,EAAgB,CAAC;IAC/C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
package/dist/dirsql.d.ts CHANGED
@@ -1,4 +1,24 @@
1
1
  import type { TableDef } from "./table.js";
2
+ /**
3
+ * A SQLite extension to load at startup, as accepted by the {@link DirSQL}
4
+ * constructor's `extensions` option. Mirrors the Rust `Extension { path,
5
+ * entrypoint }` and the Python `{"path", "entrypoint"?}` dict.
6
+ */
7
+ export interface ExtensionSpec {
8
+ /**
9
+ * Path to the extension's shared library (`.so` / `.dylib` / `.dll`).
10
+ * Taken verbatim — relative paths resolve against the process working
11
+ * directory at load time (config-file paths, by contrast, resolve against
12
+ * the config file's parent directory).
13
+ */
14
+ path: string;
15
+ /**
16
+ * Optional init-symbol override. When omitted, SQLite derives the entry
17
+ * point from the filename, which often does not match — set this when the
18
+ * extension's init function isn't `sqlite3_<filename>_init`.
19
+ */
20
+ entrypoint?: string;
21
+ }
2
22
  /**
3
23
  * Options accepted by the {@link DirSQL} constructor.
4
24
  *
@@ -32,6 +52,13 @@ export interface DirSQLOptions {
32
52
  * `persist` is not `true`.
33
53
  */
34
54
  persistPath?: string;
55
+ /**
56
+ * SQLite extensions to load onto the connection at startup, before any
57
+ * table DDL (enable → load → disable, so the SQL `load_extension()`
58
+ * function is never left exposed). Programmatic entries load first, then
59
+ * any `[[dirsql.extension]]` declared in `config`.
60
+ */
61
+ extensions?: ExtensionSpec[];
35
62
  }
36
63
  /** A row-level event emitted by the file watcher. */
37
64
  export interface RowEvent {
@@ -47,35 +74,6 @@ export interface RowEvent {
47
74
  error?: string | null;
48
75
  filePath?: string | null;
49
76
  }
50
- /**
51
- * Serializable per-table portion of {@link DirSQLConfig}. Excludes the
52
- * `extract` callback (closures aren't serializable) and the table's SQL
53
- * `name` (derivable from `ddl`).
54
- */
55
- export interface TableConfig {
56
- ddl: string;
57
- glob: string;
58
- strict: boolean;
59
- }
60
- /**
61
- * Serializable snapshot of a {@link DirSQL} instance's resolved runtime
62
- * state, as produced by {@link DirSQL.toJSON} / `JSON.stringify(db)`.
63
- *
64
- * The shape is identical across the Python, Rust, and TypeScript SDKs
65
- * (modulo `persist_path` ↔ `persistPath` case): the same payload can flow
66
- * through the `interpret` handshake regardless of which SDK produced it.
67
- *
68
- * Construction artifacts that are no longer meaningful after the instance
69
- * exists are intentionally excluded — `config` (already merged into `root`
70
- * / `tables` / `ignore`), per-table `extract`, and per-table `name`.
71
- */
72
- export interface DirSQLConfig {
73
- root: string;
74
- tables: TableConfig[];
75
- ignore: string[];
76
- persist: boolean;
77
- persistPath: string | null;
78
- }
79
77
  /**
80
78
  * Ephemeral SQL index over a local directory.
81
79
  *
@@ -146,11 +144,6 @@ export declare class DirSQL {
146
144
  * duration of the poll timeout.
147
145
  */
148
146
  pollEvents(timeoutMs: number): Promise<RowEvent[]>;
149
- /**
150
- * Resolved construction state. Recomputed on each call; reads the
151
- * `.dirsql.toml` if `config` was supplied. Works before `ready`.
152
- */
153
- toJSON(): DirSQLConfig;
154
147
  /**
155
148
  * Watch for file change events as an async iterable.
156
149
  *
@@ -1 +1 @@
1
- {"version":3,"file":"dirsql.d.ts","sourceRoot":"","sources":["../src/dirsql.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;;;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;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qDAAqD;AACrD,MAAM,WAAW,QAAQ;IACvB;;;;OAIG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACjD,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE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,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAK5D;;;;;;;OAOG;IACG,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAKnC;;;;;;;OAOG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAKxD;;;;;;;;;;OAUG;IACI,KAAK,IAAI,cAAc,CAAC,QAAQ,EAAE,IAAI,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,16 +44,14 @@ 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 so `toJSON()` can resolve the
49
- // serialized state synchronously without waiting for `ready`, and so
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;
55
52
  this._options = options;
56
53
  const Ctor = getCore().DirSQL;
57
- const openPromise = Ctor.openAsync(options.root ?? null, options.tables ?? null, options.ignore ?? null, options.config ?? null, options.persist ?? null, options.persistPath ?? null);
54
+ const openPromise = Ctor.openAsync(options.root ?? null, options.tables ?? null, options.ignore ?? null, options.config ?? null, options.persist ?? null, options.persistPath ?? null, options.extensions ?? null);
58
55
  this.ready = openPromise.then((inner) => {
59
56
  this._inner = inner;
60
57
  });
@@ -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
  *
@@ -1 +1 @@
1
- {"version":3,"file":"dirsql.js","sourceRoot":"","sources":["../src/dirsql.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,EAAE;AACF,wEAAwE;AACxE,0EAA0E;AAC1E,yDAAyD;AAGzD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAoFpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,OAAO,MAAM;IACjB;;;;;;OAMG;IACM,KAAK,CAAgB;IAE9B,gEAAgE;IACxD,MAAM,CAAgB;IAC9B,uEAAuE;IACvE,qEAAqE;IACrE,kEAAkE;IAClE,qEAAqE;IAC5D,QAAQ,CAAgB;IAMjC,YAAY,GAA2B;QACrC,MAAM,OAAO,GACX,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;QAClD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC,MAAM,CAAC;QAC9B,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAChC,OAAO,CAAC,IAAI,IAAI,IAAI,EACpB,OAAO,CAAC,MAAM,IAAI,IAAI,EACtB,OAAO,CAAC,MAAM,IAAI,IAAI,EACtB,OAAO,CAAC,MAAM,IAAI,IAAI,EACtB,OAAO,CAAC,OAAO,IAAI,IAAI,EACvB,OAAO,CAAC,WAAW,IAAI,IAAI,CAC5B,CAAC;QACF,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;YACtC,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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 { DirSQLConfig, DirSQLOptions, RowEvent, TableConfig, } from "./dirsql.js";
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";
@@ -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,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,WAAW,GACZ,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"}
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 itself is
16
- // covered by `index.test.ts` (#239).
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,sEAAsE;AACtE,qCAAqC;AAErC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAOrC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"}
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/docs/api/index.md CHANGED
@@ -59,6 +59,7 @@ new DirSQL({
59
59
  tables?: TableDef[],
60
60
  ignore?: string[],
61
61
  config?: string,
62
+ extensions?: ExtensionSpec[], // [{ path: string, entrypoint?: string }]
62
63
  })
63
64
  ```
64
65
 
@@ -76,7 +77,7 @@ In Python, the constructor starts scanning in a background thread and returns im
76
77
  - `tables` -- List of `Table` definitions. Each defines a SQLite table, a glob pattern, and an extract function.
77
78
  - `ignore` -- Optional list of glob patterns. Files matching any ignore pattern are skipped regardless of table globs.
78
79
  - `config` -- Optional path to a `.dirsql.toml` config file. Its `[[table]]` entries are appended to any programmatic `tables`; its `[dirsql].ignore` patterns are appended to any explicit `ignore`; its optional `[dirsql].root` supplies the root directory when `root` is not passed explicitly; its `[[dirsql.extension]]` entries are appended to any programmatic `extensions`.
79
- - `extensions` -- Optional SQLite extensions to load onto the connection at startup, before any table DDL (enable → load → disable, so the SQL `load_extension()` function is never left exposed). Each entry pairs a shared-library `path` with an optional `entrypoint` init-symbol override (Python: `{ "path", "entrypoint"? }` dicts; Rust: `Extension { path, entrypoint }`). Programmatic entries load first, then any `[[dirsql.extension]]` from `config`. Available in the Python and Rust SDKs; the TypeScript constructor parameter is tracked in [#230](https://github.com/thekevinscott/dirsql/issues/230). See [Loading extensions](../cli/config.md#loading-extensions).
80
+ - `extensions` -- Optional SQLite extensions to load onto the connection at startup, before any table DDL (enable → load → disable, so the SQL `load_extension()` function is never left exposed). Each entry pairs a shared-library `path` with an optional `entrypoint` init-symbol override (Python: `{ "path", "entrypoint"? }` dicts; Rust: `Extension { path, entrypoint }`; TypeScript: `{ path, entrypoint? }` objects). Programmatic entries load first, then any `[[dirsql.extension]]` from `config`. Available in the Python, Rust, and TypeScript SDKs. See [Loading extensions](../cli/config.md#loading-extensions).
80
81
 
81
82
  ### Methods
82
83
 
@@ -162,7 +163,7 @@ JSON.stringify(db) // via db.toJSON()
162
163
 
163
164
  :::
164
165
 
165
- Returns the resolved construction state as a JSON-compatible value with fields `root`, `tables`, `ignore`, `persist`, `persist_path` (camelCase `persistPath` in TypeScript). Each table is `{ ddl, glob, strict }`. The Python and Rust snapshots also include `extensions` -- an array of `{ path, entrypoint }` (empty when none are configured); the TypeScript `toJSON` snapshot will gain it with [#230](https://github.com/thekevinscott/dirsql/issues/230). Excludes the original `config` path (already merged into `root` / `tables` / `ignore`), per-table `extract`, and per-table `name`. Available immediately after construction in Python and TypeScript; Rust's sync `build()` returns a ready instance.
166
+ Returns the resolved construction state as a JSON-compatible value with fields `root`, `tables`, `ignore`, `persist`, `persist_path` (camelCase `persistPath` in TypeScript). Each table is `{ ddl, glob, strict }`. All three SDK snapshots also include `extensions` -- an array of `{ path, entrypoint }` (empty when none are configured; `entrypoint` is `null` when no override was supplied). Excludes the original `config` path (already merged into `root` / `tables` / `ignore`), per-table `extract`, and per-table `name`. Available immediately after construction in Python and TypeScript; Rust's sync `build()` returns a ready instance.
166
167
 
167
168
  ---
168
169
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dirsql",
3
- "version": "0.3.44",
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.44",
223
- "@dirsql/lib-linux-arm64-gnu": "0.3.44",
224
- "@dirsql/lib-darwin-x64": "0.3.44",
225
- "@dirsql/lib-darwin-arm64": "0.3.44",
226
- "@dirsql/lib-win32-x64-msvc": "0.3.44",
227
- "@dirsql/cli-linux-x64-gnu": "0.3.44",
228
- "@dirsql/cli-linux-arm64-gnu": "0.3.44",
229
- "@dirsql/cli-darwin-x64": "0.3.44",
230
- "@dirsql/cli-darwin-arm64": "0.3.44",
231
- "@dirsql/cli-win32-x64-msvc": "0.3.44"
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,3 +0,0 @@
1
- import { type DirSQL, type TableDef } from "../../index.js";
2
- export declare function buildTables(app: DirSQL): Map<string, TableDef>;
3
- //# sourceMappingURL=build-tables.d.ts.map
@@ -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,2 +0,0 @@
1
- export declare function errMessage(e: unknown): string;
2
- //# sourceMappingURL=err-message.d.ts.map
@@ -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,2 +0,0 @@
1
- export declare function interpret(configPath: string): Promise<number>;
2
- //# sourceMappingURL=interpret.d.ts.map
@@ -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","source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: string, importer?: (url: string) => Promise<{
3
- default?: unknown;
4
- }>): Promise<DirSQL>;
5
- //# sourceMappingURL=load-app.d.ts.map
@@ -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,2 +0,0 @@
1
- export declare function writeMessage(msg: unknown): void;
2
- //# sourceMappingURL=write-message.d.ts.map
@@ -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"}
@@ -1,3 +0,0 @@
1
- import type { DirSQLConfig, DirSQLOptions } from "./index.js";
2
- export declare function resolveConfig(options: DirSQLOptions): DirSQLConfig;
3
- //# sourceMappingURL=resolve-config.d.ts.map
@@ -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,CAoClE"}
@@ -1,43 +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 cfgDir = "";
16
- if (options.config !== undefined) {
17
- const doc = parseToml(readFileSync(options.config, "utf8"));
18
- cfg = (doc.dirsql ?? {});
19
- cfgTables = (Array.isArray(doc.table) ? doc.table : []);
20
- cfgDir = dirname(resolvePath(options.config));
21
- }
22
- const abs = (p) => (isAbsolute(p) ? p : resolvePath(cfgDir, p));
23
- return {
24
- root: options.root ?? (typeof cfg.root === "string" ? abs(cfg.root) : cfgDir),
25
- tables: [
26
- ...(options.tables ?? []).map((t) => ({
27
- ddl: t.ddl,
28
- glob: t.glob,
29
- strict: t.strict === true,
30
- })),
31
- ...cfgTables.map((e) => ({
32
- ddl: e.ddl,
33
- glob: e.glob,
34
- strict: e.strict === true,
35
- })),
36
- ],
37
- ignore: [...(options.ignore ?? []), ...(cfg.ignore ?? [])],
38
- persist: (options.persist ?? false) || cfg.persist === true,
39
- persistPath: options.persistPath ??
40
- (typeof cfg.persist_path === "string" ? abs(cfg.persist_path) : null),
41
- };
42
- }
43
- //# 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,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACjC,MAAM,GAAG,GAAG,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAQ,CAAC;QACnE,GAAG,GAAG,CAAC,GAAG,CAAC,MAAM,IAAI,EAAE,CAAQ,CAAC;QAChC,SAAS,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAU,CAAC;QACjE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IA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