@mailwoman/sqlite 10.0.0 → 10.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/lib/batched.ts +7 -13
  2. package/lib/client.ts +15 -42
  3. package/lib/database-schema.ts +2 -20
  4. package/lib/driver.ts +2 -2
  5. package/lib/index.ts +6 -5
  6. package/lib/introspection.ts +15 -8
  7. package/lib/lookup.ts +77 -0
  8. package/lib/schema-columns.ts +18 -19
  9. package/lib/sealed/build.ts +14 -25
  10. package/lib/sealed/db.ts +73 -52
  11. package/lib/{sealed/index.ts → sealed.ts} +13 -8
  12. package/out/batched.d.ts +7 -13
  13. package/out/batched.d.ts.map +1 -1
  14. package/out/batched.js +3 -5
  15. package/out/batched.js.map +1 -1
  16. package/out/client.d.ts +13 -40
  17. package/out/client.d.ts.map +1 -1
  18. package/out/client.js +10 -18
  19. package/out/client.js.map +1 -1
  20. package/out/database-schema.d.ts +2 -20
  21. package/out/database-schema.d.ts.map +1 -1
  22. package/out/database-schema.js +1 -14
  23. package/out/database-schema.js.map +1 -1
  24. package/out/{dialect/index.d.ts → dialect.d.ts} +1 -1
  25. package/out/dialect.d.ts.map +1 -0
  26. package/out/{dialect/index.js → dialect.js} +1 -1
  27. package/out/dialect.js.map +1 -0
  28. package/out/driver.js +2 -2
  29. package/out/driver.js.map +1 -1
  30. package/out/index.d.ts +6 -5
  31. package/out/index.d.ts.map +1 -1
  32. package/out/index.js +6 -5
  33. package/out/index.js.map +1 -1
  34. package/out/introspection.d.ts +15 -8
  35. package/out/introspection.d.ts.map +1 -1
  36. package/out/introspection.js +15 -8
  37. package/out/introspection.js.map +1 -1
  38. package/out/lookup.d.ts +49 -0
  39. package/out/lookup.d.ts.map +1 -0
  40. package/out/lookup.js +55 -0
  41. package/out/lookup.js.map +1 -0
  42. package/out/schema-columns.d.ts +18 -19
  43. package/out/schema-columns.d.ts.map +1 -1
  44. package/out/schema-columns.js +14 -17
  45. package/out/schema-columns.js.map +1 -1
  46. package/out/sealed/build.d.ts +13 -24
  47. package/out/sealed/build.d.ts.map +1 -1
  48. package/out/sealed/build.js +1 -14
  49. package/out/sealed/build.js.map +1 -1
  50. package/out/sealed/db.d.ts +51 -35
  51. package/out/sealed/db.d.ts.map +1 -1
  52. package/out/sealed/db.js +62 -42
  53. package/out/sealed/db.js.map +1 -1
  54. package/out/{sealed/index.d.ts → sealed.d.ts} +13 -9
  55. package/out/sealed.d.ts.map +1 -0
  56. package/out/{sealed/index.js → sealed.js} +11 -8
  57. package/out/sealed.js.map +1 -0
  58. package/out/tsconfig.test.tsbuildinfo +1 -1
  59. package/package.json +15 -104
  60. package/out/dialect/index.d.ts.map +0 -1
  61. package/out/dialect/index.js.map +0 -1
  62. package/out/sealed/index.d.ts.map +0 -1
  63. package/out/sealed/index.js.map +0 -1
  64. /package/lib/{dialect/index.ts → dialect.ts} +0 -0
package/out/driver.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"driver.js","sourceRoot":"","sources":["../lib/driver.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EACN,aAAa,EACb,aAAa,EAGb,cAAc,EAGd,OAAO,EACP,eAAe,GACf,MAAM,QAAQ,CAAA;AAIf,MAAM,eAAe;IACpB,QAAQ,CAAgB;IACxB,QAAQ,CAAa;IAErB,KAAK,CAAC,IAAI;QACT,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;YACtB,MAAM,IAAI,CAAC,QAAQ,CAAA;QACpB,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YACvC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;QACxB,CAAC,CAAC,CAAA;IACH,CAAC;IAED,MAAM;QACL,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAA;QAE7B,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAA;QACzB,IAAI,CAAC,QAAQ,GA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openBuiltClient` opens a built artifact with the seal check. A caller says which
9
- * file and which schema and never constructs the connection, so one database carries one schema, one owner, and a
8
+ * `DatabaseClient` opens the file; `openBuiltClient` opens a built artifact with the seal check. A caller specifies which
9
+ * file and schema. It never constructs the connection, so one database has one schema, one owner and a
10
10
  * lifetime `using` can end. `new DatabaseSync` appears once in this package and nowhere else in the repository.
11
11
  *
12
- * It lives outside `@mailwoman/core` because it needs none of core's 11 MB of parser reference data — its whole
12
+ * It lives outside `@mailwoman/core` because it needs none of core's 11 MB of parser reference data. Its whole
13
13
  * dependency set is `kysely`. That is what lets the leaf lookups use it.
14
14
  */
15
15
  export * from "#batched";
16
16
  export * from "#client";
17
17
  export * from "#database-schema";
18
- export * from "#dialect/index";
18
+ export * from "#dialect";
19
19
  export * from "#dialect/config";
20
20
  export * from "#introspection";
21
+ export * from "#lookup";
21
22
  export * from "#schema-columns";
22
- export * from "#sealed/index";
23
+ export * from "#sealed";
23
24
  export * from "#sealed/build";
24
25
  export * from "#sealed/db";
25
26
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,kBAAkB,CAAA;AAChC,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA;AACvB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,SAAS,CAAA;AACvB,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA"}
package/out/index.js CHANGED
@@ -5,21 +5,22 @@
5
5
  *
6
6
  * The one way a Mailwoman SQLite connection comes into being.
7
7
  *
8
- * `DatabaseClient` opens the file; `openBuiltClient` opens a built artifact with the seal check. A caller says which
9
- * file and which schema and never constructs the connection, so one database carries one schema, one owner, and a
8
+ * `DatabaseClient` opens the file; `openBuiltClient` opens a built artifact with the seal check. A caller specifies which
9
+ * file and schema. It never constructs the connection, so one database has one schema, one owner and a
10
10
  * lifetime `using` can end. `new DatabaseSync` appears once in this package and nowhere else in the repository.
11
11
  *
12
- * It lives outside `@mailwoman/core` because it needs none of core's 11 MB of parser reference data — its whole
12
+ * It lives outside `@mailwoman/core` because it needs none of core's 11 MB of parser reference data. Its whole
13
13
  * dependency set is `kysely`. That is what lets the leaf lookups use it.
14
14
  */
15
15
  export * from "#batched";
16
16
  export * from "#client";
17
17
  export * from "#database-schema";
18
- export * from "#dialect/index";
18
+ export * from "#dialect";
19
19
  export * from "#dialect/config";
20
20
  export * from "#introspection";
21
+ export * from "#lookup";
21
22
  export * from "#schema-columns";
22
- export * from "#sealed/index";
23
+ export * from "#sealed";
23
24
  export * from "#sealed/build";
24
25
  export * from "#sealed/db";
25
26
  //# sourceMappingURL=index.js.map
package/out/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,kBAAkB,CAAA;AAChC,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA;AACvB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,SAAS,CAAA;AACvB,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA"}
@@ -4,31 +4,38 @@
4
4
  * @author Teffen Ellis, et al.
5
5
  * @file Questions asked of `sqlite_master`.
6
6
  *
7
- * ITS OWN SUBPATH ON PURPOSE — do not fold this into the package barrel. `@mailwoman/sqlite`'s root export
8
- * reaches `node:sqlite`, and the docs demo bundles this package for the browser; importing the barrel to
7
+ * its own subpath on purpose — do not fold this into the package barrel. `@mailwoman/sqlite`'s root export
8
+ * reaches `node:sqlite`, and the docs demo bundles this package for the browser. importing the barrel to
9
9
  * ask whether a table exists dragged the builtin into that graph. The split is what keeps these three
10
10
  * pure-SQL questions reachable from a bundled consumer.
11
11
  */
12
12
  import type { DatabaseClient } from "#client";
13
13
  /**
14
- * Whether a TABLE named `name` exists. An index, view or trigger of that name answers `false`.
14
+ * Whether a table exists with the value in `name`.
15
+ *
16
+ * An index, view or trigger of that name answers `false`.
15
17
  */
16
18
  export declare function tableExists<DB>(db: DatabaseClient<DB>, name: string): boolean;
17
19
  /**
18
- * `COUNT(*)` over `table`. The name is interpolated, so it must come from the schema, never from input.
20
+ * `count(*)` over `table`.
21
+ *
22
+ * The name is interpolated, so it must come from the schema, never from input.
19
23
  */
20
24
  export declare function countRows<DB>(db: DatabaseClient<DB>, table: string): number;
21
25
  /**
22
- * Whether an INDEX named `name` exists.
26
+ * Whether an index exists with the value in `name`.
23
27
  */
24
28
  export declare function indexExists<DB>(db: DatabaseClient<DB>, name: string): boolean;
25
29
  /**
26
- * Every table name, sorted. Virtual tables are tables here, the way `sqlite_master` records them.
30
+ * Every table name, sorted.
31
+ *
32
+ * Virtual tables are tables here, the way `sqlite_master` records them.
27
33
  */
28
34
  export declare function listTables<DB>(db: DatabaseClient<DB>): string[];
29
35
  /**
30
- * Whether `table` has a column named `column`. The table name is spliced into a PRAGMA, so it must come from the
31
- * schema, never from input.
36
+ * Whether `table` has a column with the value in `column`.
37
+ *
38
+ * The table name is spliced into a pragma, so it must come from the schema, never from input.
32
39
  */
33
40
  export declare function hasColumn<DB>(db: DatabaseClient<DB>, table: string, column: string): boolean;
34
41
  //# sourceMappingURL=introspection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"introspection.d.ts","sourceRoot":"","sources":["../lib/introspection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C;;GAEG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,EAAE,EAAE,cAAc,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAE7E;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,cAAc,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAI3E;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,EAAE,EAAE,cAAc,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAE7E;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,cAAc,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAM/D;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,cAAc,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAI5F"}
1
+ {"version":3,"file":"introspection.d.ts","sourceRoot":"","sources":["../lib/introspection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,EAAE,EAAE,cAAc,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAE7E;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,cAAc,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAI3E;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,EAAE,EAAE,cAAc,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAE7E;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,cAAc,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAM/D;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,cAAc,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAI5F"}
@@ -4,40 +4,47 @@
4
4
  * @author Teffen Ellis, et al.
5
5
  * @file Questions asked of `sqlite_master`.
6
6
  *
7
- * ITS OWN SUBPATH ON PURPOSE — do not fold this into the package barrel. `@mailwoman/sqlite`'s root export
8
- * reaches `node:sqlite`, and the docs demo bundles this package for the browser; importing the barrel to
7
+ * its own subpath on purpose — do not fold this into the package barrel. `@mailwoman/sqlite`'s root export
8
+ * reaches `node:sqlite`, and the docs demo bundles this package for the browser. importing the barrel to
9
9
  * ask whether a table exists dragged the builtin into that graph. The split is what keeps these three
10
10
  * pure-SQL questions reachable from a bundled consumer.
11
11
  */
12
12
  /**
13
- * Whether a TABLE named `name` exists. An index, view or trigger of that name answers `false`.
13
+ * Whether a table exists with the value in `name`.
14
+ *
15
+ * An index, view or trigger of that name answers `false`.
14
16
  */
15
17
  export function tableExists(db, name) {
16
18
  return Boolean(db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(name));
17
19
  }
18
20
  /**
19
- * `COUNT(*)` over `table`. The name is interpolated, so it must come from the schema, never from input.
21
+ * `count(*)` over `table`.
22
+ *
23
+ * The name is interpolated, so it must come from the schema, never from input.
20
24
  */
21
25
  export function countRows(db, table) {
22
26
  const row = db.prepare(`SELECT COUNT(*) AS n FROM ${table}`).get();
23
27
  return Number(row?.n ?? 0);
24
28
  }
25
29
  /**
26
- * Whether an INDEX named `name` exists.
30
+ * Whether an index exists with the value in `name`.
27
31
  */
28
32
  export function indexExists(db, name) {
29
33
  return Boolean(db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'index' AND name = ?").get(name));
30
34
  }
31
35
  /**
32
- * Every table name, sorted. Virtual tables are tables here, the way `sqlite_master` records them.
36
+ * Every table name, sorted.
37
+ *
38
+ * Virtual tables are tables here, the way `sqlite_master` records them.
33
39
  */
34
40
  export function listTables(db) {
35
41
  const rows = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' ORDER BY name").all();
36
42
  return rows.map((row) => row.name);
37
43
  }
38
44
  /**
39
- * Whether `table` has a column named `column`. The table name is spliced into a PRAGMA, so it must come from the
40
- * schema, never from input.
45
+ * Whether `table` has a column with the value in `column`.
46
+ *
47
+ * The table name is spliced into a pragma, so it must come from the schema, never from input.
41
48
  */
42
49
  export function hasColumn(db, table, column) {
43
50
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
@@ -1 +1 @@
1
- {"version":3,"file":"introspection.js","sourceRoot":"","sources":["../lib/introspection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH;;GAEG;AAC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ared shape of a reader over one SQLite artifact.
7
+ * A lookup either opens the file it is given or adopts a connection already held by the caller.
8
+ * and it closes on disposal only what it opened.
9
+ */
10
+ import type { PathBuilderLike } from "path-ts";
11
+ import { DatabaseClient, type DatabaseSyncOptions } from "#client";
12
+ /**
13
+ * Where a lookup's connection comes from.
14
+ * Exactly one of the two fields is set.
15
+ */
16
+ export interface SQLiteLookupOptions<DB> {
17
+ /**
18
+ * The database file to open.
19
+ * The lookup owns the connection and closes it on disposal.
20
+ */
21
+ databasePath?: PathBuilderLike;
22
+ /**
23
+ * A connection the caller opened.
24
+ * The lookup reads through it and leaves it open on disposal.
25
+ */
26
+ database?: DatabaseClient<DB>;
27
+ }
28
+ /**
29
+ * A reader over one SQLite database that owns only the connection it opened.
30
+ *
31
+ * A subclass passes its options to `super` and reads through `this.database`.
32
+ * It inherits the disposal that closes an opened file and leaves an adopted one unchanged.
33
+ *
34
+ * The connection is opened read-only unless the subclass passes its own open options.
35
+ */
36
+ export declare abstract class SQLiteLookup<DB> implements Disposable {
37
+ #private;
38
+ protected constructor(source: SQLiteLookupOptions<DB>, openOptions?: DatabaseSyncOptions);
39
+ /**
40
+ * The connection this lookup reads through.
41
+ */
42
+ protected get database(): DatabaseClient<DB>;
43
+ /**
44
+ * Close the connection this lookup opened.
45
+ * An adopted connection stays open for its owner.
46
+ */
47
+ [Symbol.dispose](): void;
48
+ }
49
+ //# sourceMappingURL=lookup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lookup.d.ts","sourceRoot":"","sources":["../lib/lookup.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAElE;;;GAGG;AACH,MAAM,WAAW,mBAAmB,CAAC,EAAE;IACtC;;;OAGG;IACH,YAAY,CAAC,EAAE,eAAe,CAAA;IAC9B;;;OAGG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC,EAAE,CAAC,CAAA;CAC7B;AAED;;;;;;;GAOG;AACH,8BAAsB,YAAY,CAAC,EAAE,CAAE,YAAW,UAAU;;IAS3D,SAAS,aAAa,MAAM,EAAE,mBAAmB,CAAC,EAAE,CAAC,EAAE,WAAW,GAAE,mBAAwC,EAY3G;IAED;;OAEG;IACH,SAAS,KAAK,QAAQ,IAAI,cAAc,CAAC,EAAE,CAAC,CAE3C;IAED;;;OAGG;IACH,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,CAEvB;CACD"}
package/out/lookup.js ADDED
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * The shared shape of a reader over one SQLite artifact.
7
+ * A lookup either opens the file it is given or adopts a connection already held by the caller.
8
+ * and it closes on disposal only what it opened.
9
+ */
10
+ import { DatabaseClient } from "#client";
11
+ /**
12
+ * A reader over one SQLite database that owns only the connection it opened.
13
+ *
14
+ * A subclass passes its options to `super` and reads through `this.database`.
15
+ * It inherits the disposal that closes an opened file and leaves an adopted one unchanged.
16
+ *
17
+ * The connection is opened read-only unless the subclass passes its own open options.
18
+ */
19
+ export class SQLiteLookup {
20
+ #database;
21
+ /**
22
+ * The connections this instance opened.
23
+ *
24
+ * An adopted connection is never a member, so disposal cannot reach it.
25
+ */
26
+ #owned = new DisposableStack();
27
+ constructor(source, openOptions = { readOnly: true }) {
28
+ if (source.database && source.databasePath) {
29
+ throw new Error(`${new.target.name}: pass either \`database\` or \`databasePath\`, not both`);
30
+ }
31
+ if (source.database) {
32
+ this.#database = source.database;
33
+ }
34
+ else if (source.databasePath) {
35
+ this.#database = this.#owned.use(new DatabaseClient(source.databasePath, openOptions));
36
+ }
37
+ else {
38
+ throw new Error(`${new.target.name}: one of \`database\` or \`databasePath\` is required`);
39
+ }
40
+ }
41
+ /**
42
+ * The connection this lookup reads through.
43
+ */
44
+ get database() {
45
+ return this.#database;
46
+ }
47
+ /**
48
+ * Close the connection this lookup opened.
49
+ * An adopted connection stays open for its owner.
50
+ */
51
+ [Symbol.dispose]() {
52
+ this.#owned[Symbol.dispose]();
53
+ }
54
+ }
55
+ //# sourceMappingURL=lookup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lookup.js","sourceRoot":"","sources":["../lib/lookup.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,cAAc,EAA4B,MAAM,SAAS,CAAA;AAmBlE;;;;;;;GAOG;AACH,MAAM,OAAgB,YAAY;IACxB,SAAS,CAAoB;IACtC;;;;OAIG;IACM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAA;IAEvC,YAAsB,MAA+B,EAAE,WAAW,GAAwB,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC3G,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;YAC5C,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,MAAM,CAAC,IAAI,0DAA0D,CAAC,CAAA;QAC9F,CAAC;QAED,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YACrB,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAA;QACjC,CAAC;aAAM,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;YAChC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,cAAc,CAAK,MAAM,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAA;QAC3F,CAAC;aAAM,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,MAAM,CAAC,IAAI,uDAAuD,CAAC,CAAA;QAC3F,CAAC;IACF,CAAC;IAED;;OAEG;IACH,IAAc,QAAQ;QACrB,OAAO,IAAI,CAAC,SAAS,CAAA;IACtB,CAAC;IAED;;;OAGG;IACH,CAAC,MAAM,CAAC,OAAO,CAAC;QACf,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAA;IAC9B,CAAC;CACD"}
@@ -2,42 +2,41 @@
2
2
  * @copyright Sister Software
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
- *
6
- * The column groups every polygon layer's schema repeats, as schema-builder helpers — so the
7
- * `WITHOUT ROWID`-versus-blob discipline is stated once, beside the columns it governs.
8
5
  */
9
6
  import type { CreateTableBuilder, Kysely } from "kysely";
10
7
  /**
11
- * The slice of a Kysely handle a schema module's DDL touches. Kysely is invariant in its schema parameter, so naming
12
- * only the member the builders call lets a caller pass its own wider handle.
8
+ * The subset of a Kysely handle a schema module's DDL touches.
9
+ *
10
+ * Kysely is invariant in its schema parameter, so naming only this member lets
11
+ * a caller pass its own wider handle.
13
12
  */
14
13
  export type SchemaHandle<DB> = Pick<Kysely<DB>, "schema">;
15
14
  /**
16
- * The precomputed bounding box every polygon table carries — truth tables and extent tables alike — in the order the
17
- * sealed artifacts store it.
15
+ * The precomputed bounding box every polygon table includes — truth tables
16
+ * and extent tables alike — in the order the sealed artifacts store it.
18
17
  */
19
18
  export declare function addBoundingBoxColumns<TB extends string, C extends string>(builder: CreateTableBuilder<TB, C>): CreateTableBuilder<TB, C | "min_lat" | "min_lon" | "max_lat" | "max_lon">;
20
19
  /**
21
- * The unsimplified ring blob a polygon truth table carries, kept apart from {@link addBoundingBoxColumns} because one
22
- * layer stores its own ring-derived columns between the box and the blob, and the stored column order of a sealed
23
- * artifact is part of what its readers see.
20
+ * The unsimplified ring blob a polygon truth table stores, separate from
21
+ * {@link addBoundingBoxColumns} because one layer's stored column order between the box
22
+ * and the blob is part of what sealed-artifact readers see.
24
23
  *
25
- * A table taking this stays a PLAIN rowid table, never `WITHOUT ROWID`: the `rings` blob is exactly the payload
26
- * clustering into the B-tree penalizes — every index page becomes a geometry page.
24
+ * A table taking this stays a plain rowid table, never `without rowid`: the `rings`
25
+ * blob is exactly the payload clustering into the B-tree penalizes.
27
26
  */
28
27
  export declare function addRingsColumn<TB extends string, C extends string>(builder: CreateTableBuilder<TB, C>): CreateTableBuilder<TB, C | "rings">;
29
28
  /**
30
- * The precomputed bounding box plus the unsimplified ring blob every polygon truth table carries:
31
- * {@link addBoundingBoxColumns} then {@link addRingsColumn}, with nothing between them.
29
+ * The precomputed bounding box plus the unsimplified ring blob every polygon truth table includes:
30
+ * {@link addBoundingBoxColumns} then {@link addRingsColumn}, with no columns between them.
32
31
  */
33
32
  export declare function addRingGeometryColumns<TB extends string, C extends string>(builder: CreateTableBuilder<TB, C>): CreateTableBuilder<TB, C | "min_lat" | "min_lon" | "max_lat" | "max_lon" | "rings">;
34
33
  /**
35
- * The cell-index columns every polygon summary tier carries: the 48-bit short cell, the resolution it was captured at
36
- * (a short cell does not name its own, and a mixed-resolution table cannot be probed without it), the key columns the
37
- * row names — one, or several in the order given, for a layer whose rows are keyed per scenario — and its containment.
34
+ * The cell-index columns every polygon summary tier includes: the 48-bit short cell,
35
+ * the resolution it was captured at, the key columns the row names and its containment.
38
36
  *
39
- * Small fixed-width rows probed by their exact primary key are the `WITHOUT ROWID` shape — the caller adds its own
40
- * primary-key constraint and the raw `without rowid` modifier, because the key differs per layer.
37
+ * Small fixed-width rows probed by their exact primary key are the `without rowid`
38
+ * shape. the caller adds its own primary-key constraint and the raw `without rowid`
39
+ * modifier because the key differs per layer.
41
40
  */
42
41
  export declare function addCellIndexColumns<TB extends string, C extends string, K extends string>(builder: CreateTableBuilder<TB, C>, keyColumns: K | readonly K[]): CreateTableBuilder<TB, C | K | "h3_cell" | "resolution" | "containment">;
43
42
  //# sourceMappingURL=schema-columns.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema-columns.d.ts","sourceRoot":"","sources":["../lib/schema-columns.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAExD;;;GAGG;A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GPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
- *
6
- * The column groups every polygon layer's schema repeats, as schema-builder helpers — so the
7
- * `WITHOUT ROWID`-versus-blob discipline is stated once, beside the columns it governs.
8
5
  */
9
6
  /**
10
- * The precomputed bounding box every polygon table carries — truth tables and extent tables alike — in the order the
11
- * sealed artifacts store it.
7
+ * The precomputed bounding box every polygon table includes — truth tables
8
+ * and extent tables alike — in the order the sealed artifacts store it.
12
9
  */
13
10
  export function addBoundingBoxColumns(builder) {
14
11
  return builder
@@ -18,30 +15,30 @@ export function addBoundingBoxColumns(builder) {
18
15
  .addColumn("max_lon", "real", (column) => column.notNull());
19
16
  }
20
17
  /**
21
- * The unsimplified ring blob a polygon truth table carries, kept apart from {@link addBoundingBoxColumns} because one
22
- * layer stores its own ring-derived columns between the box and the blob, and the stored column order of a sealed
23
- * artifact is part of what its readers see.
18
+ * The unsimplified ring blob a polygon truth table stores, separate from
19
+ * {@link addBoundingBoxColumns} because one layer's stored column order between the box
20
+ * and the blob is part of what sealed-artifact readers see.
24
21
  *
25
- * A table taking this stays a PLAIN rowid table, never `WITHOUT ROWID`: the `rings` blob is exactly the payload
26
- * clustering into the B-tree penalizes — every index page becomes a geometry page.
22
+ * A table taking this stays a plain rowid table, never `without rowid`: the `rings`
23
+ * blob is exactly the payload clustering into the B-tree penalizes.
27
24
  */
28
25
  export function addRingsColumn(builder) {
29
26
  return builder.addColumn("rings", "blob", (column) => column.notNull());
30
27
  }
31
28
  /**
32
- * The precomputed bounding box plus the unsimplified ring blob every polygon truth table carries:
33
- * {@link addBoundingBoxColumns} then {@link addRingsColumn}, with nothing between them.
29
+ * The precomputed bounding box plus the unsimplified ring blob every polygon truth table includes:
30
+ * {@link addBoundingBoxColumns} then {@link addRingsColumn}, with no columns between them.
34
31
  */
35
32
  export function addRingGeometryColumns(builder) {
36
33
  return addRingsColumn(addBoundingBoxColumns(builder));
37
34
  }
38
35
  /**
39
- * The cell-index columns every polygon summary tier carries: the 48-bit short cell, the resolution it was captured at
40
- * (a short cell does not name its own, and a mixed-resolution table cannot be probed without it), the key columns the
41
- * row names — one, or several in the order given, for a layer whose rows are keyed per scenario — and its containment.
36
+ * The cell-index columns every polygon summary tier includes: the 48-bit short cell,
37
+ * the resolution it was captured at, the key columns the row names and its containment.
42
38
  *
43
- * Small fixed-width rows probed by their exact primary key are the `WITHOUT ROWID` shape — the caller adds its own
44
- * primary-key constraint and the raw `without rowid` modifier, because the key differs per layer.
39
+ * Small fixed-width rows probed by their exact primary key are the `without rowid`
40
+ * shape. the caller adds its own primary-key constraint and the raw `without rowid`
41
+ * modifier because the key differs per layer.
45
42
  */
46
43
  export function addCellIndexColumns(builder, keyColumns) {
47
44
  let keyed = builder
@@ -1 +1 @@
1
- {"version":3,"file":"schema-columns.js","sourceRoot":"","sources":["../lib/schema-columns.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CACpC,OAAkC;IAElC,OAAO,OAAO;SACZ,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;SAC1D,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;SAC1D,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;SAC1D,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAA;AAC7D,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC7B,OAAkC;IAElC,OAAO,OAAO,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,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,CAAC,OAAO,EAAE,CAAC,CAAA;AAC5E,CAAC"}
@@ -2,50 +2,39 @@
2
2
  * @copyright Sister Software
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
- *
6
- * The sealed polygon-artifact build sequence: one temp file beside the destination, two handles, every
7
- * cleanup path, then `VACUUM` → seal → atomic swap.
8
- *
9
- * THE INGEST AND THE FINISH PHASES USE SEPARATE HANDLES, ALWAYS — including the in-process path, which does
10
- * not need them separated. The batched path DOES: its children open the same file, so the parent's handle
11
- * has to be closed across them, and a single shared handle silently becomes a closed one by the time the
12
- * finish phase runs. Doing it one way in both paths is what puts the fixture suites on the same sequence a
13
- * national build takes.
14
5
  */
6
+ import type { PathBuilderLike } from "path-ts";
15
7
  import { DatabaseClient } from "#client";
16
8
  export interface BuildSealedArtifactOptions<DB, Streamed, Result> {
17
9
  /**
18
- * Where the sealed artifact lands. The build writes beside it and swaps.
10
+ * Where the sealed artifact lands.
19
11
  */
20
- out: string;
12
+ out: PathBuilderLike;
21
13
  /**
22
- * Create every table the build writes — the layer's own, the contract's, and any build-only scratch table (which the
23
- * finish phase drops before the artifact is sealed).
14
+ * Create every table the build writes, including any build-only scratch table the finish phase drops.
24
15
  */
25
16
  createTables: (database: DatabaseClient<DB>) => Promise<void>;
26
17
  /**
27
- * The in-process ingest, run under the FIRST handle. Return `undefined` to defer to {@link batched}; any writes made
28
- * before deferring (attribute preloads) are kept.
18
+ * The in-process ingest, run under the first handle.
19
+ *
20
+ * Return `undefined` to defer to {@link batched}, keeping any writes made before deferring.
29
21
  */
30
22
  ingest: (database: DatabaseClient<DB>) => Promise<Streamed | undefined>;
31
23
  /**
32
- * The bounded child-process ingest, run while the parent holds NO handle. Each child opens the temp file and appends;
33
- * chunks run one at a time, so there is exactly one writer at every instant.
24
+ * The bounded child-process ingest, run while the parent holds no handle: each child opens the
25
+ * temp file and appends one chunk at a time, so there is exactly one writer at every instant.
34
26
  */
35
27
  batched?: (tmpPath: string) => Promise<Streamed>;
36
28
  /**
37
- * Post-ingest work under the SECOND handle: assertions over what was streamed, index/coverage/manifest writes,
38
- * dropping any scratch table. `VACUUM`, the seal and the swap follow; the artifact's on-disk size is measurable only
39
- * after this returns and the swap lands.
29
+ * Post-ingest work under the second handle: assertions over what was streamed,
30
+ * index/coverage/manifest writes, dropping any scratch table.
31
+ *
32
+ * The artifact's on-disk size is measurable only after this returns and the swap lands.
40
33
  */
41
34
  finish: (database: DatabaseClient<DB>, streamed: Streamed) => Promise<Result>;
42
35
  }
43
36
  /**
44
37
  * Run one sealed-artifact build.
45
- *
46
- * Every failure path removes the temp file: a failed build otherwise leaves a partial multi-gigabyte file whose name
47
- * carries this process's pid, so nothing would ever pick it up again — the difference between a retry loop that fails
48
- * and one that fills a disk.
49
38
  */
50
39
  export declare function buildSealedArtifact<DB, Streamed, Result>(options: BuildSealedArtifactOptions<DB, Streamed, Result>): Promise<Result>;
51
40
  //# sourceMappingURL=build.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../lib/sealed/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAGxC,MAAM,WAAW,0BAA0B,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM;IAC/D;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;;OAGG;IACH,YAAY,EAAE,CAAC,QAAQ,EAAE,cAAc,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC7D;;;OAGG;IACH,MAAM,EAAE,CAAC,QAAQ,EAAE,cAAc,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAAA;IACvE;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;IAChD;;;;OAIG;IACH,MAAM,EAAE,CA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,CAAC,MAAM,CAAC,CA2DjB"}
@@ -2,31 +2,18 @@
2
2
  * @copyright Sister Software
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
- *
6
- * The sealed polygon-artifact build sequence: one temp file beside the destination, two handles, every
7
- * cleanup path, then `VACUUM` → seal → atomic swap.
8
- *
9
- * THE INGEST AND THE FINISH PHASES USE SEPARATE HANDLES, ALWAYS — including the in-process path, which does
10
- * not need them separated. The batched path DOES: its children open the same file, so the parent's handle
11
- * has to be closed across them, and a single shared handle silently becomes a closed one by the time the
12
- * finish phase runs. Doing it one way in both paths is what puts the fixture suites on the same sequence a
13
- * national build takes.
14
5
  */
15
6
  import { removePathIfPresent } from "@mailwoman/core/fs/writers";
16
7
  import { DatabaseClient } from "#client";
17
8
  import { sealDatabase, swapDatabaseIntoPlace } from "#sealed/db";
18
9
  /**
19
10
  * Run one sealed-artifact build.
20
- *
21
- * Every failure path removes the temp file: a failed build otherwise leaves a partial multi-gigabyte file whose name
22
- * carries this process's pid, so nothing would ever pick it up again — the difference between a retry loop that fails
23
- * and one that fills a disk.
24
11
  */
25
12
  export async function buildSealedArtifact(options) {
26
13
  const tmpPath = `${options.out}.tmp-${process.pid}`;
27
14
  let streamed;
28
15
  {
29
- await using kdb = new DatabaseClient(tmpPath);
16
+ using kdb = new DatabaseClient(tmpPath);
30
17
  try {
31
18
  kdb.exec("PRAGMA journal_mode = OFF");
32
19
  kdb.exec("PRAGMA synchronous = OFF");
@@ -1 +1 @@
1
- {"version":3,"file":"build.js","sourceRoot":"","sources":["../../lib/sealed/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAEhE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AA8BhE;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UA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