dirsql 0.3.75 → 0.3.77
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/die.d.ts.map +1 -1
- package/dist/cli/die.js +1 -2
- package/dist/cli/die.js.map +1 -1
- package/dist/cli/dirsql.js +6 -9
- package/dist/cli/dirsql.js.map +1 -1
- package/dist/cli/main.js +1 -1
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/resolve-binary.d.ts.map +1 -1
- package/dist/cli/resolve-binary.js +1 -2
- package/dist/cli/resolve-binary.js.map +1 -1
- package/dist/cli/resolve-config-extensions.d.ts.map +1 -1
- package/dist/cli/resolve-config-extensions.js +6 -9
- package/dist/cli/resolve-config-extensions.js.map +1 -1
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +3 -9
- package/dist/core.js.map +1 -1
- package/dist/dirsql.d.ts +2 -3
- package/dist/dirsql.d.ts.map +1 -1
- package/dist/dirsql.js +10 -20
- package/dist/dirsql.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -15
- package/dist/index.js.map +1 -1
- package/dist/resolve-config-extensions.d.ts.map +1 -1
- package/dist/resolve-config-extensions.js +5 -12
- package/dist/resolve-config-extensions.js.map +1 -1
- package/dist/resolve-extension.d.ts +1 -2
- package/dist/resolve-extension.d.ts.map +1 -1
- package/dist/resolve-extension.js +7 -14
- package/dist/resolve-extension.js.map +1 -1
- package/docs/howto/columns-from-paths.md +2 -8
- package/docs/howto/define-tables.md +2 -16
- package/docs/howto/extract-from-contents.md +2 -8
- package/docs/howto/load-extension.md +2 -5
- package/docs/howto/search-by-meaning.md +9 -17
- package/docs/howto/skip-files.md +1 -5
- package/package.json +11 -11
package/dist/cli/die.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"die.d.ts","sourceRoot":"","sources":["../../src/cli/die.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"die.d.ts","sourceRoot":"","sources":["../../src/cli/die.ts"],"names":[],"mappings":"AAEA,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,SAAI,GAAG,KAAK,CAGhD"}
|
package/dist/cli/die.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
// Exit with a `dirsql: ` prefixed error message.
|
|
2
|
-
// signals to callers that control doesn't return.
|
|
1
|
+
// Exit with a `dirsql: ` prefixed error message.
|
|
3
2
|
export function die(msg, code = 1) {
|
|
4
3
|
process.stderr.write(`dirsql: ${msg}\n`);
|
|
5
4
|
process.exit(code);
|
package/dist/cli/die.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"die.js","sourceRoot":"","sources":["../../src/cli/die.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"die.js","sourceRoot":"","sources":["../../src/cli/die.ts"],"names":[],"mappings":"AAAA,iDAAiD;AAEjD,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,IAAI,GAAG,CAAC;IACvC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACzC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrB,CAAC"}
|
package/dist/cli/dirsql.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// npm `bin` entry for `dirsql
|
|
3
|
-
//
|
|
4
|
-
// to it. All it does is invoke `runCli()` (see `run-cli.ts`); the launcher
|
|
5
|
-
// logic and its error handling live there so they can be unit-tested.
|
|
2
|
+
// npm `bin` entry for `dirsql`; launcher logic and error handling live in
|
|
3
|
+
// `run-cli.ts` so they can be unit-tested.
|
|
6
4
|
//
|
|
7
|
-
//
|
|
8
|
-
// guard
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
// output (caught by the pack-install build-CI smoke test).
|
|
5
|
+
// Do not add a `process.argv[1] === import.meta.filename` self-detection
|
|
6
|
+
// guard: under the npm-bin symlink argv[1] is the (unresolved) symlink path
|
|
7
|
+
// while import.meta.filename is the realpath, so the guard silently skips
|
|
8
|
+
// main().
|
|
12
9
|
import { runCli } from "./run-cli.js";
|
|
13
10
|
runCli();
|
|
14
11
|
//# sourceMappingURL=dirsql.js.map
|
package/dist/cli/dirsql.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dirsql.js","sourceRoot":"","sources":["../../src/cli/dirsql.ts"],"names":[],"mappings":";AACA,
|
|
1
|
+
{"version":3,"file":"dirsql.js","sourceRoot":"","sources":["../../src/cli/dirsql.ts"],"names":[],"mappings":";AACA,0EAA0E;AAC1E,2CAA2C;AAC3C,EAAE;AACF,yEAAyE;AACzE,4EAA4E;AAC5E,0EAA0E;AAC1E,UAAU;AAEV,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,MAAM,EAAE,CAAC"}
|
package/dist/cli/main.js
CHANGED
|
@@ -9,7 +9,7 @@ import { withResolvedExtensions } from "./resolve-config-extensions.js";
|
|
|
9
9
|
export async function main(argv = process.argv.slice(2)) {
|
|
10
10
|
const binary = resolveBinary();
|
|
11
11
|
// Resolve any package-name extensions in a TOML config here (the binary
|
|
12
|
-
// can't) and pass them as `--extension` flags; a no-op otherwise
|
|
12
|
+
// can't) and pass them as `--extension` flags; a no-op otherwise.
|
|
13
13
|
const result = spawnSync(binary, withResolvedExtensions(argv), {
|
|
14
14
|
stdio: "inherit",
|
|
15
15
|
});
|
package/dist/cli/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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;A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AAC;AACnC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-binary.d.ts","sourceRoot":"","sources":["../../src/cli/resolve-binary.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolve-binary.d.ts","sourceRoot":"","sources":["../../src/cli/resolve-binary.ts"],"names":[],"mappings":"AASA,yEAAyE;AACzE,MAAM,MAAM,QAAQ,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;AAErD,iFAAiF;AACjF,wBAAgB,eAAe,IAAI,QAAQ,CAE1C;AAED,wBAAgB,aAAa,CAC3B,GAAG,SAAgB,EACnB,QAAQ,GAAE,QAA4B,GACrC,MAAM,CAgBR"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Resolve the absolute path of the prebuilt `dirsql` binary shipped by
|
|
2
2
|
// whichever `@dirsql/cli-<triple>` optional-dependency package matched
|
|
3
|
-
// the host at `npm install` time.
|
|
4
|
-
// takes over.
|
|
3
|
+
// the host at `npm install` time.
|
|
5
4
|
import { createRequire } from "node:module";
|
|
6
5
|
import { nodeTriples } from "../platforms.js";
|
|
7
6
|
import { die } from "./die.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-binary.js","sourceRoot":"","sources":["../../src/cli/resolve-binary.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,uEAAuE;AACvE,
|
|
1
|
+
{"version":3,"file":"resolve-binary.js","sourceRoot":"","sources":["../../src/cli/resolve-binary.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,uEAAuE;AACvE,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKhD,iFAAiF;AACjF,MAAM,UAAU,eAAe;IAC7B,OAAO,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,GAAG,GAAG,WAAW,EAAE,EACnB,WAAqB,eAAe,EAAE;IAEtC,MAAM,OAAO,GAAG,WAAW,EAAE,CAAC;IAC9B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IACzB,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,GAAG,CACD,0BAA0B,GAAG,mEAAmE,CACjG,CAAC;IACJ,CAAC;IACD,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC;IACnE,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC,CAAC;IACnC,CAAC;IAAC,MAAM,CAAC;QACP,GAAG,CACD,GAAG,GAAG,qHAAqH,CAC5H,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-config-extensions.d.ts","sourceRoot":"","sources":["../../src/cli/resolve-config-extensions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolve-config-extensions.d.ts","sourceRoot":"","sources":["../../src/cli/resolve-config-extensions.ts"],"names":[],"mappings":"AAiCA;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAiB/D"}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
// Launcher-side resolution of a TOML config's `[[dirsql.extension]]` entries.
|
|
2
2
|
//
|
|
3
|
-
// The compiled `dirsql` binary
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
// via repeatable `--extension` flags; the binary then loads those and ignores
|
|
10
|
-
// the config's own extension entries (see the Rust `--extension` flag /
|
|
11
|
-
// `suppress_config_extensions`).
|
|
3
|
+
// The compiled `dirsql` binary loads config extensions literally — it has no
|
|
4
|
+
// `require.resolve`, so it cannot resolve a bare **package name**. When a
|
|
5
|
+
// TOML config names an extension by package name, the shared SDK resolver
|
|
6
|
+
// resolves every entry and this launcher passes the resolved literal paths
|
|
7
|
+
// to the binary via repeatable `--extension` flags; the binary then loads
|
|
8
|
+
// those and ignores the config's own extension entries.
|
|
12
9
|
//
|
|
13
10
|
// Native-language configs (`.py`/`.js`/`.mjs`/`.cjs`) are untouched: the binary
|
|
14
11
|
// dispatches those to `dirsql interpret`, whose handshake already carries
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-config-extensions.js","sourceRoot":"","sources":["../../src/cli/resolve-config-extensions.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,EAAE;AACF,
|
|
1
|
+
{"version":3,"file":"resolve-config-extensions.js","sourceRoot":"","sources":["../../src/cli/resolve-config-extensions.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,EAAE;AACF,6EAA6E;AAC7E,0EAA0E;AAC1E,0EAA0E;AAC1E,2EAA2E;AAC3E,0EAA0E;AAC1E,wDAAwD;AACxD,EAAE;AACF,gFAAgF;AAChF,0EAA0E;AAC1E,kBAAkB;AAElB,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAE9E,uEAAuE;AACvE,4DAA4D;AAC5D,MAAM,sBAAsB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE9D,qFAAqF;AACrF,SAAS,kBAAkB,CAAC,IAAc;IACxC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,IAA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":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAEA,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,EAGlC,wBAAwB,EAAE,OAAO,GAAG,IAAI,GACvC,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;AAMD,wBAAgB,OAAO,IAAI,UAAU,CAKpC"}
|
package/dist/core.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
// Lazy access to the napi-rs core module
|
|
2
|
-
// swap in a fake binding without loading the real native binary.
|
|
3
|
-
//
|
|
4
|
-
// Split out of the public barrel (`index.ts`) so it carries a colocated
|
|
5
|
-
// unit test instead of an exemption (#239).
|
|
1
|
+
// Lazy access to the napi-rs core module.
|
|
6
2
|
import { loadNativeCore as defaultLoadNativeCore } from "./load-native-core.js";
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
// `vi.mock("./core.js")` to fake `getCore` directly, so production carries
|
|
10
|
-
// no test-only injection seam.
|
|
3
|
+
// Unit tests `vi.mock("./core.js")` to fake `getCore` directly, so
|
|
4
|
+
// production carries no test-only injection seam.
|
|
11
5
|
let core = null;
|
|
12
6
|
export function getCore() {
|
|
13
7
|
if (core === null) {
|
package/dist/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAG1C,OAAO,EAAE,cAAc,IAAI,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAgChF,mEAAmE;AACnE,kDAAkD;AAClD,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,8 +1,7 @@
|
|
|
1
1
|
import type { TableDef } from "./table.js";
|
|
2
2
|
/**
|
|
3
3
|
* A SQLite extension to load at startup, as accepted by the {@link DirSQL}
|
|
4
|
-
* constructor's `extensions` option.
|
|
5
|
-
* entrypoint }` and the Python `{"path", "entrypoint"?}` dict.
|
|
4
|
+
* constructor's `extensions` option.
|
|
6
5
|
*/
|
|
7
6
|
export interface ExtensionSpec {
|
|
8
7
|
/**
|
|
@@ -58,7 +57,7 @@ export interface DirSQLOptions {
|
|
|
58
57
|
* function is never left exposed). Programmatic entries load first, then
|
|
59
58
|
* any `[[dirsql.extension]]` declared in `config`. A `path` (programmatic
|
|
60
59
|
* or config-file) may be a bare **package name**, resolved from the
|
|
61
|
-
* installed package under `node_modules
|
|
60
|
+
* installed package under `node_modules`.
|
|
62
61
|
*/
|
|
63
62
|
extensions?: ExtensionSpec[];
|
|
64
63
|
}
|
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":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;;GAGG;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;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,aAAa,EAAE,CAAC;CAC9B;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,MAAM;IACjB;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAG9B,OAAO,CAAC,MAAM,CAAgB;IAE9B,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IAEjC,wDAAwD;gBAC5C,UAAU,EAAE,MAAM;IAC9B,yCAAyC;gBAC7B,OAAO,EAAE,aAAa;IA4ClC;;;;;;OAMG;IACG,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,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;CAYxD"}
|
package/dist/dirsql.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
// The `DirSQL` facade — the SDK's primary entry point.
|
|
2
|
-
//
|
|
3
|
-
// Split out of the public barrel (`index.ts`) so it carries a colocated
|
|
4
|
-
// unit test instead of an exemption (#239). The native binding is reached
|
|
5
|
-
// through `getCore()` (see `core.ts`), which tests fake.
|
|
6
1
|
import { getCore } from "./core.js";
|
|
7
2
|
import { resolveConfigExtensionSpecs } from "./resolve-config-extensions.js";
|
|
8
3
|
import { resolveExtensionPath } from "./resolve-extension.js";
|
|
@@ -46,29 +41,25 @@ export class DirSQL {
|
|
|
46
41
|
ready;
|
|
47
42
|
// Initialized by `ready`. Do NOT touch before awaiting `ready`.
|
|
48
43
|
_inner;
|
|
49
|
-
// Constructor options preserved verbatim
|
|
50
|
-
// `ready`. Public-by-design.
|
|
44
|
+
// Constructor options preserved verbatim; public-by-design.
|
|
51
45
|
_options;
|
|
52
46
|
constructor(arg) {
|
|
53
47
|
const options = typeof arg === "string" ? { config: arg } : arg;
|
|
54
48
|
this._options = options;
|
|
55
49
|
const Ctor = getCore().DirSQL;
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
// rejects `ready` rather than throwing from the constructor.
|
|
50
|
+
// Extension paths (possibly bare package names) are resolved inside the
|
|
51
|
+
// promise chain so a resolution error rejects `ready` rather than
|
|
52
|
+
// throwing from the constructor; the core accepts file paths only.
|
|
60
53
|
this.ready = Promise.resolve()
|
|
61
54
|
.then(() => {
|
|
62
55
|
const extensions = options.extensions?.map((e) => ({
|
|
63
56
|
path: resolveExtensionPath(e.path, process.cwd(), false),
|
|
64
57
|
entrypoint: e.entrypoint,
|
|
65
58
|
})) ?? null;
|
|
66
|
-
//
|
|
67
|
-
//
|
|
68
|
-
//
|
|
69
|
-
//
|
|
70
|
-
// loading so the entries are not loaded a second time (and the core
|
|
71
|
-
// never sees the unresolvable bare name).
|
|
59
|
+
// The SDK resolves the config's [[dirsql.extension]] entries itself
|
|
60
|
+
// (bare package names need require.resolve, which the core lacks) and
|
|
61
|
+
// suppresses the core's own config-extension loading so they are not
|
|
62
|
+
// loaded twice.
|
|
72
63
|
const configExtensions = options.config != null
|
|
73
64
|
? resolveConfigExtensionSpecs(options.config)
|
|
74
65
|
: null;
|
|
@@ -131,9 +122,8 @@ export class DirSQL {
|
|
|
131
122
|
await this.ready;
|
|
132
123
|
await this._inner.startWatcher();
|
|
133
124
|
while (true) {
|
|
134
|
-
// Native
|
|
135
|
-
//
|
|
136
|
-
// timeout keeps the poll cadence low without starving the event loop.
|
|
125
|
+
// Native poll runs on the libuv threadpool; ~200ms bounds each await
|
|
126
|
+
// without starving the event loop.
|
|
137
127
|
const events = await this._inner.pollEvents(200);
|
|
138
128
|
for (const event of events) {
|
|
139
129
|
yield event;
|
package/dist/dirsql.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dirsql.js","sourceRoot":"","sources":["../src/dirsql.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dirsql.js","sourceRoot":"","sources":["../src/dirsql.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAkF9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,OAAO,MAAM;IACjB;;;;;;OAMG;IACM,KAAK,CAAgB;IAE9B,gEAAgE;IACxD,MAAM,CAAgB;IAC9B,4DAA4D;IACnD,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,wEAAwE;QACxE,kEAAkE;QAClE,mEAAmE;QACnE,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,OAAO,EAAE;aAC3B,IAAI,CAAC,GAAG,EAAE;YACT,MAAM,UAAU,GACd,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC9B,IAAI,EAAE,oBAAoB,CAAC,CAAC,CAAC,IAAI,EAAE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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,mCAAmC;YACnC,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.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,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
|
@@ -1,19 +1,4 @@
|
|
|
1
1
|
// dirsql TypeScript SDK — public API barrel.
|
|
2
|
-
//
|
|
3
|
-
// The public surface is implemented in Rust via napi-rs. In development
|
|
4
|
-
// `pnpm build` runs `napi build` which drops `dirsql.node` at the
|
|
5
|
-
// package root; the loader in `load-native-core.ts` falls back to that
|
|
6
|
-
// file so running from source works.
|
|
7
|
-
//
|
|
8
|
-
// In a published install the napi binary ships inside a per-platform
|
|
9
|
-
// `@dirsql/lib-<slug>` sub-package (wired via `optionalDependencies`),
|
|
10
|
-
// and the loader resolves the one matching the host's OS/arch. No Rust
|
|
11
|
-
// toolchain is required at install time on any supported platform.
|
|
12
|
-
//
|
|
13
|
-
// This file is a thin re-export barrel: the implementation lives in
|
|
14
|
-
// colocated-tested modules (`table.ts`, `core.ts`, `parse-table-name.ts`,
|
|
15
|
-
// `dirsql.ts`), each carrying its own unit test. The barrel's re-export
|
|
16
|
-
// statements are covered by `index.test.ts`.
|
|
17
2
|
export { DirSQL } from "./dirsql.js";
|
|
18
3
|
export { parseTableName } from "./parse-table-name.js";
|
|
19
4
|
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;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-config-extensions.d.ts","sourceRoot":"","sources":["../src/resolve-config-extensions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolve-config-extensions.d.ts","sourceRoot":"","sources":["../src/resolve-config-extensions.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAMjD;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,MAAM,GACjB,aAAa,EAAE,GAAG,IAAI,CA4BxB"}
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
// SDK-side resolution of a TOML config's `[[dirsql.extension]]` entries.
|
|
2
2
|
//
|
|
3
|
-
// The Rust core
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
// extension by package name, the SDK resolves every one of its extensions
|
|
3
|
+
// The Rust core loads config extensions literally — it has no
|
|
4
|
+
// `require.resolve`, so it cannot resolve a bare **package name**. When a
|
|
5
|
+
// config names an extension by package name, the SDK resolves every entry
|
|
7
6
|
// here, hands the core the resolved literal paths, and suppresses the core's
|
|
8
|
-
// own config-extension loading
|
|
9
|
-
// toggle) so the config's entries are not loaded a second time.
|
|
7
|
+
// own config-extension loading so the entries are not loaded twice.
|
|
10
8
|
//
|
|
11
|
-
// Shared by the `DirSQL` constructor (`config` option) and the CLI launcher
|
|
12
|
-
// (`cli/resolve-config-extensions.ts`, which converts the resolved specs into
|
|
13
|
-
// `--extension` flags for the binary).
|
|
9
|
+
// Shared by the `DirSQL` constructor (`config` option) and the CLI launcher.
|
|
14
10
|
import { existsSync, readFileSync } from "node:fs";
|
|
15
11
|
import { dirname, resolve as resolvePath } from "node:path";
|
|
16
12
|
import { parse as parseToml } from "smol-toml";
|
|
@@ -43,9 +39,6 @@ export function resolveConfigExtensionSpecs(configPath) {
|
|
|
43
39
|
return null;
|
|
44
40
|
}
|
|
45
41
|
const entries = dirsql.extension;
|
|
46
|
-
// Only intervene when at least one path is a bare package name; a config
|
|
47
|
-
// with only literal paths (or no entries at all) keeps the core's existing
|
|
48
|
-
// behavior untouched.
|
|
49
42
|
const hasPackageName = entries.some((e) => typeof e.path === "string" && isBareName(e.path));
|
|
50
43
|
if (!hasPackageName) {
|
|
51
44
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-config-extensions.js","sourceRoot":"","sources":["../src/resolve-config-extensions.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,
|
|
1
|
+
{"version":3,"file":"resolve-config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QACpB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC;IAC9C,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACzB,IAAI,EAAE,oBAAoB,CAAC,CAAC,CAAC,IAAc,EAAE,IAAI,EAAE,IAAI,CAAC;QACxD,UAAU,EAAE,OAAO,CAAC,CAAC,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS;KACxE,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `require.resolve`-shaped seam. Injectable so unit tests can fake module
|
|
3
|
-
* resolution without a real `node_modules` layout
|
|
4
|
-
* `Requirer`).
|
|
3
|
+
* resolution without a real `node_modules` layout.
|
|
5
4
|
*/
|
|
6
5
|
export interface PackageResolver {
|
|
7
6
|
/** Resolve a specifier to an on-disk path (`require.resolve`). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-extension.d.ts","sourceRoot":"","sources":["../src/resolve-extension.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolve-extension.d.ts","sourceRoot":"","sources":["../src/resolve-extension.ts"],"names":[],"mappings":"AAsBA;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,kEAAkE;IAClE,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IACnC,+EAA+E;IAC/E,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;CAC3C;AAqBD,uEAAuE;AACvE,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAKhD;AA+CD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,OAAO,EACxB,QAAQ,GAAE,eAAmC,GAC5C,MAAM,CAYR"}
|
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
// Resolve an extension entry's `path` to a concrete loadable file.
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
// **package name**: when `path` carries no path separator and no loadable-file
|
|
5
|
-
// suffix, it names a package installed under `node_modules`, and dirsql
|
|
6
|
-
// discovers the loadable file *inside* that package.
|
|
7
|
-
//
|
|
8
|
-
// Resolution is an ordered probe (file-first, then package), so every literal
|
|
9
|
-
// path keeps its old behavior and only a bare name reaches the package
|
|
10
|
-
// machinery:
|
|
3
|
+
// Resolution is an ordered probe (file-first, then package):
|
|
11
4
|
//
|
|
12
5
|
// 1. Path-looking (contains a separator, or ends in `.so` / `.dylib` /
|
|
13
6
|
// `.dll` / `.node`) -> returned as a file path: made absolute against
|
|
14
7
|
// `base` when `resolveRelative` is set (config-file entries), else
|
|
15
|
-
// verbatim (programmatic entries
|
|
16
|
-
// 2. Bare name -> a same-named local file under `base`
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
8
|
+
// verbatim (programmatic entries).
|
|
9
|
+
// 2. Bare package name -> a same-named local file under `base` shadows the
|
|
10
|
+
// package; otherwise the package dir is located via `require.resolve`
|
|
11
|
+
// and the current platform's loadable is globbed from inside it. Zero
|
|
12
|
+
// matches and multiple matches are both hard errors -- disambiguate
|
|
13
|
+
// with a literal path.
|
|
21
14
|
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
22
15
|
import { createRequire } from "node:module";
|
|
23
16
|
import { isAbsolute, join, resolve as resolvePath } from "node:path";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-extension.js","sourceRoot":"","sources":["../src/resolve-extension.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,EAAE;AACF,
|
|
1
|
+
{"version":3,"file":"resolve-extension.js","sourceRoot":"","sources":["../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AAE,CAAC;QAClD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -29,12 +29,8 @@ within one path segment) are in
|
|
|
29
29
|
|
|
30
30
|
## 2. Query the captured columns
|
|
31
31
|
|
|
32
|
-
Start the server (`npx dirsql` / `uvx dirsql`) and query:
|
|
33
|
-
|
|
34
32
|
```bash
|
|
35
|
-
|
|
36
|
-
-H 'content-type: application/json' \
|
|
37
|
-
-d '{"sql":"SELECT year, month, _basename FROM photos ORDER BY year, month"}'
|
|
33
|
+
dirsql query "SELECT year, month, _basename FROM photos ORDER BY year, month"
|
|
38
34
|
```
|
|
39
35
|
|
|
40
36
|
```json
|
|
@@ -44,9 +40,7 @@ curl -s http://localhost:7117/query \
|
|
|
44
40
|
Captures are real SQL columns, so aggregation works:
|
|
45
41
|
|
|
46
42
|
```bash
|
|
47
|
-
|
|
48
|
-
-H 'content-type: application/json' \
|
|
49
|
-
-d '{"sql":"SELECT year, COUNT(*) AS photos FROM photos GROUP BY year"}'
|
|
43
|
+
dirsql query "SELECT year, COUNT(*) AS photos FROM photos GROUP BY year"
|
|
50
44
|
```
|
|
51
45
|
|
|
52
46
|
```json
|
|
@@ -24,26 +24,12 @@ glob = "posts/**/*.md"
|
|
|
24
24
|
filesystem facts `dirsql` computes for every file. Facts are opt-in by
|
|
25
25
|
DDL: only the ones you declare become columns.
|
|
26
26
|
|
|
27
|
-
## 2.
|
|
28
|
-
|
|
29
|
-
::: code-group
|
|
30
|
-
|
|
31
|
-
```bash [npm]
|
|
32
|
-
npx dirsql
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
```bash [PyPI]
|
|
36
|
-
uvx dirsql
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
:::
|
|
27
|
+
## 2. Query the table
|
|
40
28
|
|
|
41
29
|
Each matched file is one row:
|
|
42
30
|
|
|
43
31
|
```bash
|
|
44
|
-
|
|
45
|
-
-H 'content-type: application/json' \
|
|
46
|
-
-d '{"sql":"SELECT _path, _size FROM posts ORDER BY _path"}'
|
|
32
|
+
dirsql query "SELECT _path, _size FROM posts ORDER BY _path"
|
|
47
33
|
```
|
|
48
34
|
|
|
49
35
|
```json
|
|
@@ -31,12 +31,8 @@ by every hook.
|
|
|
31
31
|
|
|
32
32
|
## 2. Query the extracted columns
|
|
33
33
|
|
|
34
|
-
Start the server (`npx dirsql` / `uvx dirsql`) and query:
|
|
35
|
-
|
|
36
34
|
```bash
|
|
37
|
-
|
|
38
|
-
-H 'content-type: application/json' \
|
|
39
|
-
-d '{"sql":"SELECT title, author, year, _path FROM books ORDER BY year"}'
|
|
35
|
+
dirsql query "SELECT title, author, year, _path FROM books ORDER BY year"
|
|
40
36
|
```
|
|
41
37
|
|
|
42
38
|
```json
|
|
@@ -61,9 +57,7 @@ on-file = "jq -c -s '.' {path}"
|
|
|
61
57
|
```
|
|
62
58
|
|
|
63
59
|
```bash
|
|
64
|
-
|
|
65
|
-
-H 'content-type: application/json' \
|
|
66
|
-
-d '{"sql":"SELECT event, user FROM events"}'
|
|
60
|
+
dirsql query "SELECT event, user FROM events"
|
|
67
61
|
```
|
|
68
62
|
|
|
69
63
|
```json
|
|
@@ -23,13 +23,10 @@ overrides the init symbol when it doesn't match the filename-derived
|
|
|
23
23
|
default — `sqlite-vec` is exactly such a case
|
|
24
24
|
([reference](../reference/config.md#dirsql-extension)).
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
functions are callable:
|
|
26
|
+
The extension's functions are callable:
|
|
28
27
|
|
|
29
28
|
```bash
|
|
30
|
-
|
|
31
|
-
-H 'content-type: application/json' \
|
|
32
|
-
-d '{"sql":"SELECT vec_version() AS vec_version"}'
|
|
29
|
+
dirsql query "SELECT vec_version() AS vec_version"
|
|
33
30
|
```
|
|
34
31
|
|
|
35
32
|
```json
|
|
@@ -99,20 +99,14 @@ installed `sqlite_vec` module to its bundled loadable. Naming rules per
|
|
|
99
99
|
runtime — and the literal-path alternative that works everywhere — are in
|
|
100
100
|
[Load a SQLite extension](./load-extension.md).
|
|
101
101
|
|
|
102
|
-
## 3.
|
|
102
|
+
## 3. Ask questions
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
Run with `sqlite-vec` available to the launcher's environment. The initial
|
|
105
|
+
scan runs `embed.py` once per note, then the query argument goes straight to
|
|
106
|
+
`pre-query`, exactly as a `POST /query` body would:
|
|
105
107
|
|
|
106
108
|
```bash
|
|
107
|
-
uvx --with sqlite-vec dirsql
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
The initial scan runs `embed.py` once per note. Then ask:
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
curl -s http://localhost:7117/query \
|
|
114
|
-
-H 'content-type: application/json' \
|
|
115
|
-
-d '{"q": "how do I cook pasta?"}'
|
|
109
|
+
uvx --with sqlite-vec dirsql query '{"q": "how do I cook pasta?"}'
|
|
116
110
|
```
|
|
117
111
|
|
|
118
112
|
```json
|
|
@@ -120,9 +114,7 @@ curl -s http://localhost:7117/query \
|
|
|
120
114
|
```
|
|
121
115
|
|
|
122
116
|
```bash
|
|
123
|
-
|
|
124
|
-
-H 'content-type: application/json' \
|
|
125
|
-
-d '{"q": "reviewing code on github"}'
|
|
117
|
+
uvx --with sqlite-vec dirsql query '{"q": "reviewing code on github"}'
|
|
126
118
|
```
|
|
127
119
|
|
|
128
120
|
```json
|
|
@@ -133,9 +125,9 @@ Neither question shares a keyword with its top note — "cook" appears
|
|
|
133
125
|
nowhere in `pasta.md`, "github" nowhere in `branches.md`. The distance
|
|
134
126
|
ranking is doing the work.
|
|
135
127
|
|
|
136
|
-
Because `pre-query` is set, the
|
|
137
|
-
`{"sql": …}` —
|
|
138
|
-
|
|
128
|
+
Because `pre-query` is set, the query argument is *not* the usual
|
|
129
|
+
`{"sql": …}` — it goes to your script as-is, which decides what SQL runs
|
|
130
|
+
([hook interactions](../reference/http-api.md#hook-interactions)).
|
|
139
131
|
|
|
140
132
|
## Recomputing vs. caching
|
|
141
133
|
|
package/docs/howto/skip-files.md
CHANGED
|
@@ -31,12 +31,8 @@ ignored file never reaches any table — even one whose glob would match it.
|
|
|
31
31
|
|
|
32
32
|
## 2. Confirm what made it in
|
|
33
33
|
|
|
34
|
-
Start the server (`npx dirsql` / `uvx dirsql`) and check:
|
|
35
|
-
|
|
36
34
|
```bash
|
|
37
|
-
|
|
38
|
-
-H 'content-type: application/json' \
|
|
39
|
-
-d '{"sql":"SELECT _path FROM notes ORDER BY _path"}'
|
|
35
|
+
dirsql query "SELECT _path FROM notes ORDER BY _path"
|
|
40
36
|
```
|
|
41
37
|
|
|
42
38
|
```json
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dirsql",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.77",
|
|
4
4
|
"description": "Ephemeral SQL index over a local directory",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/thekevinscott/dirsql",
|
|
@@ -230,15 +230,15 @@
|
|
|
230
230
|
]
|
|
231
231
|
},
|
|
232
232
|
"optionalDependencies": {
|
|
233
|
-
"@dirsql/lib-linux-x64-gnu": "0.3.
|
|
234
|
-
"@dirsql/lib-linux-arm64-gnu": "0.3.
|
|
235
|
-
"@dirsql/lib-darwin-x64": "0.3.
|
|
236
|
-
"@dirsql/lib-darwin-arm64": "0.3.
|
|
237
|
-
"@dirsql/lib-win32-x64-msvc": "0.3.
|
|
238
|
-
"@dirsql/cli-linux-x64-gnu": "0.3.
|
|
239
|
-
"@dirsql/cli-linux-arm64-gnu": "0.3.
|
|
240
|
-
"@dirsql/cli-darwin-x64": "0.3.
|
|
241
|
-
"@dirsql/cli-darwin-arm64": "0.3.
|
|
242
|
-
"@dirsql/cli-win32-x64-msvc": "0.3.
|
|
233
|
+
"@dirsql/lib-linux-x64-gnu": "0.3.77",
|
|
234
|
+
"@dirsql/lib-linux-arm64-gnu": "0.3.77",
|
|
235
|
+
"@dirsql/lib-darwin-x64": "0.3.77",
|
|
236
|
+
"@dirsql/lib-darwin-arm64": "0.3.77",
|
|
237
|
+
"@dirsql/lib-win32-x64-msvc": "0.3.77",
|
|
238
|
+
"@dirsql/cli-linux-x64-gnu": "0.3.77",
|
|
239
|
+
"@dirsql/cli-linux-arm64-gnu": "0.3.77",
|
|
240
|
+
"@dirsql/cli-darwin-x64": "0.3.77",
|
|
241
|
+
"@dirsql/cli-darwin-arm64": "0.3.77",
|
|
242
|
+
"@dirsql/cli-win32-x64-msvc": "0.3.77"
|
|
243
243
|
}
|
|
244
244
|
}
|