@mailwoman/sqlite 9.2.0 → 9.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/schema-columns.ts
CHANGED
|
@@ -16,37 +16,62 @@ import type { CreateTableBuilder, Kysely } from "kysely"
|
|
|
16
16
|
export type SchemaHandle<DB> = Pick<Kysely<DB>, "schema">
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* The precomputed bounding box
|
|
20
|
-
*
|
|
21
|
-
* A table taking these stays a PLAIN rowid table, never `WITHOUT ROWID`: the `rings` blob is exactly the payload
|
|
22
|
-
* clustering into the B-tree penalizes — every index page becomes a geometry page.
|
|
19
|
+
* The precomputed bounding box every polygon table carries — truth tables and extent tables alike — in the order the
|
|
20
|
+
* sealed artifacts store it.
|
|
23
21
|
*/
|
|
24
|
-
export function
|
|
22
|
+
export function addBoundingBoxColumns<TB extends string, C extends string>(
|
|
25
23
|
builder: CreateTableBuilder<TB, C>
|
|
26
|
-
): CreateTableBuilder<TB, C | "min_lat" | "min_lon" | "max_lat" | "max_lon"
|
|
24
|
+
): CreateTableBuilder<TB, C | "min_lat" | "min_lon" | "max_lat" | "max_lon"> {
|
|
27
25
|
return builder
|
|
28
26
|
.addColumn("min_lat", "real", (column) => column.notNull())
|
|
29
27
|
.addColumn("min_lon", "real", (column) => column.notNull())
|
|
30
28
|
.addColumn("max_lat", "real", (column) => column.notNull())
|
|
31
29
|
.addColumn("max_lon", "real", (column) => column.notNull())
|
|
32
|
-
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The unsimplified ring blob a polygon truth table carries, kept apart from {@link addBoundingBoxColumns} because one
|
|
34
|
+
* layer stores its own ring-derived columns between the box and the blob, and the stored column order of a sealed
|
|
35
|
+
* artifact is part of what its readers see.
|
|
36
|
+
*
|
|
37
|
+
* A table taking this stays a PLAIN rowid table, never `WITHOUT ROWID`: the `rings` blob is exactly the payload
|
|
38
|
+
* clustering into the B-tree penalizes — every index page becomes a geometry page.
|
|
39
|
+
*/
|
|
40
|
+
export function addRingsColumn<TB extends string, C extends string>(
|
|
41
|
+
builder: CreateTableBuilder<TB, C>
|
|
42
|
+
): CreateTableBuilder<TB, C | "rings"> {
|
|
43
|
+
return builder.addColumn("rings", "blob", (column) => column.notNull())
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The precomputed bounding box plus the unsimplified ring blob every polygon truth table carries:
|
|
48
|
+
* {@link addBoundingBoxColumns} then {@link addRingsColumn}, with nothing between them.
|
|
49
|
+
*/
|
|
50
|
+
export function addRingGeometryColumns<TB extends string, C extends string>(
|
|
51
|
+
builder: CreateTableBuilder<TB, C>
|
|
52
|
+
): CreateTableBuilder<TB, C | "min_lat" | "min_lon" | "max_lat" | "max_lon" | "rings"> {
|
|
53
|
+
return addRingsColumn(addBoundingBoxColumns(builder))
|
|
33
54
|
}
|
|
34
55
|
|
|
35
56
|
/**
|
|
36
57
|
* The cell-index columns every polygon summary tier carries: the 48-bit short cell, the resolution it was captured at
|
|
37
|
-
* (a short cell does not name its own, and a mixed-resolution table cannot be probed without it), the key the
|
|
38
|
-
* names, and its containment.
|
|
58
|
+
* (a short cell does not name its own, and a mixed-resolution table cannot be probed without it), the key columns the
|
|
59
|
+
* row names — one, or several in the order given, for a layer whose rows are keyed per scenario — and its containment.
|
|
39
60
|
*
|
|
40
61
|
* Small fixed-width rows probed by their exact primary key are the `WITHOUT ROWID` shape — the caller adds its own
|
|
41
62
|
* primary-key constraint and the raw `without rowid` modifier, because the key differs per layer.
|
|
42
63
|
*/
|
|
43
64
|
export function addCellIndexColumns<TB extends string, C extends string, K extends string>(
|
|
44
65
|
builder: CreateTableBuilder<TB, C>,
|
|
45
|
-
|
|
66
|
+
keyColumns: K | readonly K[]
|
|
46
67
|
): CreateTableBuilder<TB, C | K | "h3_cell" | "resolution" | "containment"> {
|
|
47
|
-
|
|
68
|
+
let keyed: CreateTableBuilder<TB, C | K | "h3_cell" | "resolution"> = builder
|
|
48
69
|
.addColumn("h3_cell", "integer", (column) => column.notNull())
|
|
49
70
|
.addColumn("resolution", "integer", (column) => column.notNull())
|
|
50
|
-
|
|
51
|
-
|
|
71
|
+
|
|
72
|
+
for (const keyColumn of typeof keyColumns === "string" ? [keyColumns] : keyColumns) {
|
|
73
|
+
keyed = keyed.addColumn(keyColumn, "text", (column) => column.notNull())
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return keyed.addColumn("containment", "text", (column) => column.notNull())
|
|
52
77
|
}
|
package/out/schema-columns.d.ts
CHANGED
|
@@ -13,19 +13,31 @@ import type { CreateTableBuilder, Kysely } from "kysely";
|
|
|
13
13
|
*/
|
|
14
14
|
export type SchemaHandle<DB> = Pick<Kysely<DB>, "schema">;
|
|
15
15
|
/**
|
|
16
|
-
* The precomputed bounding box
|
|
16
|
+
* The precomputed bounding box every polygon table carries — truth tables and extent tables alike — in the order the
|
|
17
|
+
* sealed artifacts store it.
|
|
18
|
+
*/
|
|
19
|
+
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
|
+
/**
|
|
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.
|
|
17
24
|
*
|
|
18
|
-
* A table taking
|
|
25
|
+
* A table taking this stays a PLAIN rowid table, never `WITHOUT ROWID`: the `rings` blob is exactly the payload
|
|
19
26
|
* clustering into the B-tree penalizes — every index page becomes a geometry page.
|
|
20
27
|
*/
|
|
28
|
+
export declare function addRingsColumn<TB extends string, C extends string>(builder: CreateTableBuilder<TB, C>): CreateTableBuilder<TB, C | "rings">;
|
|
29
|
+
/**
|
|
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.
|
|
32
|
+
*/
|
|
21
33
|
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">;
|
|
22
34
|
/**
|
|
23
35
|
* The cell-index columns every polygon summary tier carries: the 48-bit short cell, the resolution it was captured at
|
|
24
|
-
* (a short cell does not name its own, and a mixed-resolution table cannot be probed without it), the key the
|
|
25
|
-
* names, and its containment.
|
|
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.
|
|
26
38
|
*
|
|
27
39
|
* Small fixed-width rows probed by their exact primary key are the `WITHOUT ROWID` shape — the caller adds its own
|
|
28
40
|
* primary-key constraint and the raw `without rowid` modifier, because the key differs per layer.
|
|
29
41
|
*/
|
|
30
|
-
export declare function addCellIndexColumns<TB extends string, C extends string, K extends string>(builder: CreateTableBuilder<TB, C>,
|
|
42
|
+
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">;
|
|
31
43
|
//# 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;AACH,MAAM,MAAM,YAAY,CAAC,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAA;AAEzD
|
|
1
|
+
{"version":3,"file":"schema-columns.d.ts","sourceRoot":"","sources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,aAAa,CAAC,CAU1E"}
|
package/out/schema-columns.js
CHANGED
|
@@ -7,32 +7,49 @@
|
|
|
7
7
|
* `WITHOUT ROWID`-versus-blob discipline is stated once, beside the columns it governs.
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
10
|
-
* The precomputed bounding box
|
|
11
|
-
*
|
|
12
|
-
* A table taking these stays a PLAIN rowid table, never `WITHOUT ROWID`: the `rings` blob is exactly the payload
|
|
13
|
-
* clustering into the B-tree penalizes — every index page becomes a geometry page.
|
|
10
|
+
* The precomputed bounding box every polygon table carries — truth tables and extent tables alike — in the order the
|
|
11
|
+
* sealed artifacts store it.
|
|
14
12
|
*/
|
|
15
|
-
export function
|
|
13
|
+
export function addBoundingBoxColumns(builder) {
|
|
16
14
|
return builder
|
|
17
15
|
.addColumn("min_lat", "real", (column) => column.notNull())
|
|
18
16
|
.addColumn("min_lon", "real", (column) => column.notNull())
|
|
19
17
|
.addColumn("max_lat", "real", (column) => column.notNull())
|
|
20
|
-
.addColumn("max_lon", "real", (column) => column.notNull())
|
|
21
|
-
|
|
18
|
+
.addColumn("max_lon", "real", (column) => column.notNull());
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
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.
|
|
24
|
+
*
|
|
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.
|
|
27
|
+
*/
|
|
28
|
+
export function addRingsColumn(builder) {
|
|
29
|
+
return builder.addColumn("rings", "blob", (column) => column.notNull());
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
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.
|
|
34
|
+
*/
|
|
35
|
+
export function addRingGeometryColumns(builder) {
|
|
36
|
+
return addRingsColumn(addBoundingBoxColumns(builder));
|
|
22
37
|
}
|
|
23
38
|
/**
|
|
24
39
|
* The cell-index columns every polygon summary tier carries: the 48-bit short cell, the resolution it was captured at
|
|
25
|
-
* (a short cell does not name its own, and a mixed-resolution table cannot be probed without it), the key the
|
|
26
|
-
* names, and its containment.
|
|
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.
|
|
27
42
|
*
|
|
28
43
|
* Small fixed-width rows probed by their exact primary key are the `WITHOUT ROWID` shape — the caller adds its own
|
|
29
44
|
* primary-key constraint and the raw `without rowid` modifier, because the key differs per layer.
|
|
30
45
|
*/
|
|
31
|
-
export function addCellIndexColumns(builder,
|
|
32
|
-
|
|
46
|
+
export function addCellIndexColumns(builder, keyColumns) {
|
|
47
|
+
let keyed = builder
|
|
33
48
|
.addColumn("h3_cell", "integer", (column) => column.notNull())
|
|
34
|
-
.addColumn("resolution", "integer", (column) => column.notNull())
|
|
35
|
-
|
|
36
|
-
.addColumn(
|
|
49
|
+
.addColumn("resolution", "integer", (column) => column.notNull());
|
|
50
|
+
for (const keyColumn of typeof keyColumns === "string" ? [keyColumns] : keyColumns) {
|
|
51
|
+
keyed = keyed.addColumn(keyColumn, "text", (column) => column.notNull());
|
|
52
|
+
}
|
|
53
|
+
return keyed.addColumn("containment", "text", (column) => column.notNull());
|
|
37
54
|
}
|
|
38
55
|
//# sourceMappingURL=schema-columns.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-columns.js","sourceRoot":"","sources":["../lib/schema-columns.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH
|
|
1
|
+
{"version":3,"file":"schema-columns.js","sourceRoot":"","sources":["../lib/schema-columns.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;A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C,CAAC,CAAC,UAAU,EAAE,CAAC;QACpF,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAA;IACzE,CAAC;IAED,OAAO,KAAK,CAAC,SAAS,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAA;AAC5E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../test/unit/client.test.ts","../test/unit/introspection.test.ts","../test/unit/sealed-db.test.ts"],"version":"6.0.3"}
|
|
1
|
+
{"root":["../test/unit/client.test.ts","../test/unit/introspection.test.ts","../test/unit/schema-columns.test.ts","../test/unit/sealed-db.test.ts"],"version":"6.0.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailwoman/sqlite",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.4.0",
|
|
4
4
|
"description": "The one way a Mailwoman SQLite connection is opened: a typed Kysely client over node:sqlite, plus the sealed-artifact lifecycle.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kysely",
|
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
"path-ts": "^2.3.0"
|
|
165
165
|
},
|
|
166
166
|
"devDependencies": {
|
|
167
|
-
"@mailwoman/core": "9.
|
|
167
|
+
"@mailwoman/core": "9.4.0"
|
|
168
168
|
},
|
|
169
169
|
"engines": {
|
|
170
170
|
"node": ">=24.18.0"
|