@tensorix/metahub 0.1.10 → 0.2.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 (95) hide show
  1. package/README.md +19 -6
  2. package/README.zh-CN.md +7 -2
  3. package/dist/cli.js +22843 -18308
  4. package/dist/cli.js.map +87 -66
  5. package/dist/core/blobs-core.d.ts +106 -0
  6. package/dist/core/blobs-core.d.ts.map +1 -0
  7. package/dist/core/blobs.d.ts +100 -0
  8. package/dist/core/blobs.d.ts.map +1 -0
  9. package/dist/core/cache.d.ts +18 -1
  10. package/dist/core/cache.d.ts.map +1 -1
  11. package/dist/core/compact.d.ts +43 -0
  12. package/dist/core/compact.d.ts.map +1 -0
  13. package/dist/core/config.d.ts +6 -3
  14. package/dist/core/config.d.ts.map +1 -1
  15. package/dist/core/context.d.ts +4 -4
  16. package/dist/core/context.d.ts.map +1 -1
  17. package/dist/core/crdt.d.ts +54 -8
  18. package/dist/core/crdt.d.ts.map +1 -1
  19. package/dist/core/databases.d.ts +22 -8
  20. package/dist/core/databases.d.ts.map +1 -1
  21. package/dist/core/db.d.ts +1 -27
  22. package/dist/core/db.d.ts.map +1 -1
  23. package/dist/core/documents.d.ts +28 -15
  24. package/dist/core/documents.d.ts.map +1 -1
  25. package/dist/core/driver.d.ts +25 -0
  26. package/dist/core/driver.d.ts.map +1 -0
  27. package/dist/core/history.d.ts +99 -11
  28. package/dist/core/history.d.ts.map +1 -1
  29. package/dist/core/hlc.d.ts +3 -3
  30. package/dist/core/hlc.d.ts.map +1 -1
  31. package/dist/core/index.d.ts +1 -0
  32. package/dist/core/index.d.ts.map +1 -1
  33. package/dist/core/indexing.d.ts +4 -4
  34. package/dist/core/indexing.d.ts.map +1 -1
  35. package/dist/core/integrity.d.ts +1 -1
  36. package/dist/core/integrity.d.ts.map +1 -1
  37. package/dist/core/node.d.ts +2 -2
  38. package/dist/core/node.d.ts.map +1 -1
  39. package/dist/core/properties.d.ts +10 -9
  40. package/dist/core/properties.d.ts.map +1 -1
  41. package/dist/core/records.d.ts +13 -8
  42. package/dist/core/records.d.ts.map +1 -1
  43. package/dist/core/resolve.d.ts +4 -4
  44. package/dist/core/resolve.d.ts.map +1 -1
  45. package/dist/core/schema-init.d.ts +68 -0
  46. package/dist/core/schema-init.d.ts.map +1 -0
  47. package/dist/core/schema.d.ts +1 -1
  48. package/dist/core/schema.d.ts.map +1 -1
  49. package/dist/core/search.d.ts +3 -3
  50. package/dist/core/search.d.ts.map +1 -1
  51. package/dist/core/sites-core.d.ts +95 -0
  52. package/dist/core/sites-core.d.ts.map +1 -0
  53. package/dist/core/sites.d.ts +8 -58
  54. package/dist/core/sites.d.ts.map +1 -1
  55. package/dist/core/sqlcols.d.ts +4 -0
  56. package/dist/core/sqlcols.d.ts.map +1 -0
  57. package/dist/core/sync/auth.d.ts +5 -3
  58. package/dist/core/sync/auth.d.ts.map +1 -1
  59. package/dist/core/sync/blob-routes.d.ts +12 -0
  60. package/dist/core/sync/blob-routes.d.ts.map +1 -0
  61. package/dist/core/sync/client.d.ts +13 -3
  62. package/dist/core/sync/client.d.ts.map +1 -1
  63. package/dist/core/sync/e2ee.d.ts +24 -0
  64. package/dist/core/sync/e2ee.d.ts.map +1 -0
  65. package/dist/core/sync/enroll.d.ts +21 -0
  66. package/dist/core/sync/enroll.d.ts.map +1 -0
  67. package/dist/core/sync/peers-routes.d.ts.map +1 -1
  68. package/dist/core/sync/peers.d.ts +84 -11
  69. package/dist/core/sync/peers.d.ts.map +1 -1
  70. package/dist/core/sync/protocol.d.ts +5 -0
  71. package/dist/core/sync/protocol.d.ts.map +1 -1
  72. package/dist/core/sync/publisher-lease.d.ts +8 -0
  73. package/dist/core/sync/publisher-lease.d.ts.map +1 -0
  74. package/dist/core/sync/routes.d.ts.map +1 -1
  75. package/dist/core/sync/server.d.ts +11 -0
  76. package/dist/core/sync/server.d.ts.map +1 -1
  77. package/dist/core/sync/sites-serve.d.ts.map +1 -1
  78. package/dist/core/sync/storage-s3-bun.d.ts +26 -0
  79. package/dist/core/sync/storage-s3-bun.d.ts.map +1 -0
  80. package/dist/core/sync/storage.d.ts +170 -0
  81. package/dist/core/sync/storage.d.ts.map +1 -0
  82. package/dist/db-worker.js +384 -0
  83. package/dist/index.js +17250 -13920
  84. package/dist/index.js.map +47 -32
  85. package/dist/metahub-sdk.js +1 -0
  86. package/dist/mh-runtime.js +1 -0
  87. package/dist/sqlite3.wasm +0 -0
  88. package/dist/sw.js +1 -0
  89. package/dist/webui/server/assets.d.ts +8 -1
  90. package/dist/webui/server/assets.d.ts.map +1 -1
  91. package/dist/webui/server/icons.d.ts +4 -0
  92. package/dist/webui/server/icons.d.ts.map +1 -0
  93. package/dist/webui/server/routes.d.ts.map +1 -1
  94. package/dist/webui.js +68 -62
  95. package/package.json +6 -1
@@ -1 +1 @@
1
- {"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../src/core/documents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAO3C,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;AA6FxD,qFAAqF;AACrF,wBAAgB,eAAe,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAShE;AAID,wBAAgB,cAAc,CAC5B,EAAE,EAAE,QAAQ,EACZ,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MA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EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAIxE;AAMD,wBAAgB,aAAa,CAC3B,EAAE,EAAE,QAAQ,EACZ,IAAI,GAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GACtD,eAAe,EAAE,CAWnB;AAgFD,kFAAkF;AAClF,eAAO,MAAM,yBAAyB,wBAOpC,CAAC;AAgDH;;;;GAIG;AACH,eAAO,MAAM,YAAY,iGAevB,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB;YAGZ,MAAM;eAAa,MAAM,GAAG,IAAI;6BAuBhD,CAAC;AAEH,eAAO,MAAM,cAAc;YAGP,MAAM;WAAS,MAAM;kBAAgB,MAAM;gBAAc,MAAM,GAAG,IAAI;;cACtE,MAAM;6BAsBxB,CAAC;AAEH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,eAAO,MAAM,YAAY;SAGV,MAAM;SAAO,MAAM;iBAAe,OAAO;cAAY,MAAM;mBAqCxE,CAAC;AAEH,eAAO,MAAM,cAAc,2DAczB,CAAC;AAEH,eAAO,MAAM,eAAe,2DAc1B,CAAC;AAEH,eAAO,MAAM,cAAc,uCAUzB,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Minimal synchronous SQLite driver surface that every runtime hosting a
3
+ * metahub database must provide. The portable core modules type against this
4
+ * instead of bun:sqlite so the same code can run on Bun (bun:sqlite's
5
+ * `Database` satisfies it structurally — no adapter needed) and in a browser
6
+ * worker (sqlite-wasm behind a small adapter).
7
+ *
8
+ * Keep this surface to what bun:sqlite and sqlite-wasm can both serve
9
+ * synchronously: positional `?` binds, `get`/`all`/`run` on prepared
10
+ * statements, `exec` for scripts, and re-entrant `transaction` wrappers.
11
+ */
12
+ export type SqlBindable = string | number | bigint | boolean | null | Uint8Array;
13
+ export interface Stmt {
14
+ get(...params: SqlBindable[]): unknown;
15
+ all(...params: SqlBindable[]): unknown[];
16
+ run(...params: SqlBindable[]): {
17
+ changes: number;
18
+ };
19
+ }
20
+ export interface DbDriver {
21
+ query(sql: string): Stmt;
22
+ exec(sql: string): void;
23
+ transaction<A extends unknown[], R>(fn: (...args: A) => R): (...args: A) => R;
24
+ }
25
+ //# sourceMappingURL=driver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../src/core/driver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,UAAU,CAAC;AAEjF,MAAM,WAAW,IAAI;IACnB,GAAG,CAAC,GAAG,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IACvC,GAAG,CAAC,GAAG,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,EAAE,CAAC;IACzC,GAAG,CAAC,GAAG,MAAM,EAAE,WAAW,EAAE,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CACpD;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,WAAW,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC;CAC/E"}
@@ -1,10 +1,14 @@
1
- import type { Database } from "bun:sqlite";
1
+ import type { DbDriver } from "./driver.ts";
2
+ /** Where a revision came from, derived from its change-group label. */
3
+ export type RevisionKind = "user" | "repair" | "revert";
2
4
  export interface DocRevision {
3
5
  /** Version token (max HLC of the revision) — pass to documentAtVersion/revertDocument. */
4
6
  version: string;
5
7
  /** Wall-clock time derived from the version HLC (ISO 8601). */
6
8
  at: string;
7
9
  node_id: string;
10
+ /** Source of the revision: a user edit, a repairHub fix, or a revert. */
11
+ kind: RevisionKind;
8
12
  changes: number;
9
13
  created: boolean;
10
14
  deleted: boolean;
@@ -13,7 +17,7 @@ export interface DocRevision {
13
17
  blocks_deleted: number;
14
18
  }
15
19
  /** A document's edit history, newest first, clustered into save-sized revisions. */
16
- export declare function listDocumentRevisions(db: Database, id: string): DocRevision[];
20
+ export declare function listDocumentRevisions(db: DbDriver, id: string): DocRevision[];
17
21
  export interface DocumentVersionState {
18
22
  id: string;
19
23
  title: string;
@@ -23,7 +27,7 @@ export interface DocumentVersionState {
23
27
  version: string;
24
28
  }
25
29
  /** Reconstruct a document as of version cutoff `at` (state at hlc <= at). */
26
- export declare function documentAtVersion(db: Database, id: string, at: string): DocumentVersionState;
30
+ export declare function documentAtVersion(db: DbDriver, id: string, at: string): DocumentVersionState;
27
31
  export interface RevertDocResult {
28
32
  id: string;
29
33
  changed: boolean;
@@ -31,16 +35,23 @@ export interface RevertDocResult {
31
35
  restored: string;
32
36
  /** The document's version after the revert (a new head — revert is a forward write). */
33
37
  version: string;
38
+ /** True when the revert resurrected a tombstoned document. */
39
+ undeleted: boolean;
34
40
  }
35
- /** Restore a document's title/body to a past version, as a new forward edit
36
- * (reuses updateDocument's block reconcile, so unchanged blocks keep identity). */
37
- export declare function revertDocument(db: Database, id: string, to: string, opts?: {
41
+ /**
42
+ * Restore a document's title/body to a past version, as a new forward edit
43
+ * (reuses updateDocument's block reconcile, so unchanged blocks keep identity).
44
+ * Reverting a tombstoned document resurrects it; children unparented by the
45
+ * delete stay where they are. One change group, so history shows ONE revision.
46
+ */
47
+ export declare const revertDocument: (db: DbDriver, id: string, to: string, opts?: {
38
48
  ifMatch?: string;
39
- }): RevertDocResult;
49
+ } | undefined) => RevertDocResult;
40
50
  export interface RecordRevision {
41
51
  version: string;
42
52
  at: string;
43
53
  node_id: string;
54
+ kind: RevisionKind;
44
55
  changes: number;
45
56
  created: boolean;
46
57
  deleted: boolean;
@@ -49,7 +60,33 @@ export interface RecordRevision {
49
60
  moved: boolean;
50
61
  }
51
62
  /** A record's edit history, newest first, clustered into save-sized revisions. */
52
- export declare function listRecordRevisions(db: Database, id: string): RecordRevision[];
63
+ export declare function listRecordRevisions(db: DbDriver, id: string): RecordRevision[];
64
+ /** One cell's value change inside a revision. A missing `before`/`after` key
65
+ * means the cell did not exist on that side (distinct from an explicit null). */
66
+ export interface FieldChange {
67
+ prop: string;
68
+ before?: unknown;
69
+ after?: unknown;
70
+ }
71
+ export interface DatabaseActivityEntry extends RecordRevision {
72
+ record_id: string;
73
+ /** Title-property value as of this revision — deleted records keep their last title. */
74
+ record_title: string | null;
75
+ /** Value-level changes of the touched cells. */
76
+ diffs: FieldChange[];
77
+ }
78
+ /**
79
+ * "What happened in this table lately": every record's revisions, merged and
80
+ * sorted newest first. Includes tombstoned records (so deletions show up) — a
81
+ * read-only aggregation, same clustering as listRecordRevisions per record.
82
+ * Walking each record's change stream oldest-first lets us carry a running
83
+ * cell-state map, so every entry ships its old→new values and a title snapshot
84
+ * for free (no extra queries). After compaction, `before` at the window edge
85
+ * may be missing (the superseded write was pruned) — it reads as "was empty".
86
+ */
87
+ export declare function listDatabaseActivity(db: DbDriver, databaseId: string, opts?: {
88
+ limit?: number;
89
+ }): DatabaseActivityEntry[];
53
90
  export interface RecordVersionState {
54
91
  id: string;
55
92
  database_id: string | null;
@@ -59,7 +96,7 @@ export interface RecordVersionState {
59
96
  version: string;
60
97
  }
61
98
  /** Reconstruct a record as of version cutoff `at` (state at hlc <= at). */
62
- export declare function recordAtVersion(db: Database, id: string, at: string): RecordVersionState;
99
+ export declare function recordAtVersion(db: DbDriver, id: string, at: string): RecordVersionState;
63
100
  export interface RevertRecordResult {
64
101
  id: string;
65
102
  changed: boolean;
@@ -72,7 +109,58 @@ export interface RevertRecordResult {
72
109
  /** Restore a record's cells to a past version as a new forward edit. Only cells
73
110
  * of currently-live properties are touched, so no orphan cells are recreated
74
111
  * (the repairHub invariant). Reverting a tombstoned record resurrects it. */
75
- export declare function revertRecord(db: Database, id: string, to: string): RevertRecordResult;
112
+ export declare const revertRecord: (db: DbDriver, id: string, to: string) => RevertRecordResult;
113
+ export interface PropertyRevision {
114
+ version: string;
115
+ at: string;
116
+ node_id: string;
117
+ kind: RevisionKind;
118
+ changes: number;
119
+ created: boolean;
120
+ deleted: boolean;
121
+ /** Definition columns touched in this revision (name/type/config/position). */
122
+ fields: string[];
123
+ /** Record cells the same change group cleared (a type change / removal cascade). */
124
+ cells_cleared: number;
125
+ }
126
+ /** A property's definition history, newest first. Cascaded cell clears are
127
+ * counted via the shared txn so a type change reads as one revision. */
128
+ export declare function listPropertyRevisions(db: DbDriver, id: string): PropertyRevision[];
129
+ export interface PropertyVersionState {
130
+ id: string;
131
+ database_id: string | null;
132
+ name: string;
133
+ type: string;
134
+ config: unknown;
135
+ position: number | null;
136
+ deleted: boolean;
137
+ version: string;
138
+ }
139
+ /** Reconstruct a property definition as of version cutoff `at`. */
140
+ export declare function propertyAtVersion(db: DbDriver, id: string, at: string): PropertyVersionState;
141
+ export interface RevertPropertyResult {
142
+ id: string;
143
+ changed: boolean;
144
+ /** Definition columns the revert wrote. */
145
+ fields: string[];
146
+ /** Record cells restored to their value at the target version. */
147
+ restored_cells: number;
148
+ /** Cells left alone because a user wrote them after the target version. */
149
+ skipped_cells: number;
150
+ undeleted: boolean;
151
+ restored: string;
152
+ }
153
+ /**
154
+ * Schema-level rollback: restore a property's definition AND the record cells
155
+ * its later type-change/removal cascades cleared. Definition registers are
156
+ * emitted directly (never via updateProperty — its type-change cascade would
157
+ * re-clear the cells being restored). A cell is only touched when its current
158
+ * winner IS the cascade (or a repair); it is restored to the last value before
159
+ * that cascade, so user data — written before or after the target version —
160
+ * always survives. Cells whose winner is a user write are kept (skipped_cells).
161
+ * Pre-txn legacy writes can't be attributed, so they count as user writes.
162
+ */
163
+ export declare const revertProperty: (db: DbDriver, id: string, to: string) => RevertPropertyResult;
76
164
  export interface FieldHistoryEntry {
77
165
  version: string;
78
166
  at: string;
@@ -82,5 +170,5 @@ export interface FieldHistoryEntry {
82
170
  cleared: boolean;
83
171
  }
84
172
  /** The full write trail of one record cell (property id), newest first. */
85
- export declare function recordFieldHistory(db: Database, id: string, propId: string): FieldHistoryEntry[];
173
+ export declare function recordFieldHistory(db: DbDriver, id: string, propId: string): FieldHistoryEntry[];
86
174
  //# sourceMappingURL=history.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/core/history.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAkH3C,MAAM,WAAW,WAAW;IAC1B,0FAA0F;IAC1F,OAAO,EAAE,MAAM,CAAC;IAChB,+DAA+D;IAC/D,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,oFAAoF;AACpF,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,GAAG,WAAW,EAAE,CAmC7E;AAED,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,iFAAiF;IACjF,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,6EAA6E;AAC7E,wBAAgB,iBAAiB,CAA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CAAC;IAChB,oEAAoE;IACpE,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,2EAA2E;AAC3E,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,iBAAiB,EAAE,CAahG"}
@@ -1,4 +1,4 @@
1
- import type { Database } from "bun:sqlite";
1
+ import type { DbDriver } from "./driver.ts";
2
2
  export interface Hlc {
3
3
  millis: number;
4
4
  counter: number;
@@ -7,7 +7,7 @@ export interface Hlc {
7
7
  export declare function formatHlc(h: Hlc): string;
8
8
  export declare function parseHlc(s: string): Hlc;
9
9
  /** Issue a new timestamp for a local event, advancing the persisted clock. */
10
- export declare function nextHlc(db: Database, node: string, now?: number): string;
10
+ export declare function nextHlc(db: DbDriver, node: string, now?: number): string;
11
11
  /** Advance the local clock to account for an observed remote timestamp. */
12
- export declare function observeHlc(db: Database, node: string, remote: string, now?: number): void;
12
+ export declare function observeHlc(db: DbDriver, node: string, remote: string, now?: number): void;
13
13
  //# sourceMappingURL=hlc.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hlc.d.ts","sourceRoot":"","sources":["../../src/core/hlc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAK3C,MAAM,WAAW,GAAG;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAIxC;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAQvC;AAeD,8EAA8E;AAC9E,wBAAgB,OAAO,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,SAAa,GAAG,MAAM,CAO5E;AAED,2EAA2E;AAC3E,wBAAgB,UAAU,CACxB,EAAE,EAAE,QAAQ,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,GAAG,SAAa,GACf,IAAI,CAWN"}
1
+ {"version":3,"file":"hlc.d.ts","sourceRoot":"","sources":["../../src/core/hlc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAK5C,MAAM,WAAW,GAAG;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM,CAIxC;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAQvC;AAeD,8EAA8E;AAC9E,wBAAgB,OAAO,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,SAAa,GAAG,MAAM,CAO5E;AAED,2EAA2E;AAC3E,wBAAgB,UAAU,CACxB,EAAE,EAAE,QAAQ,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,GAAG,SAAa,GACf,IAAI,CAWN"}
@@ -1,5 +1,6 @@
1
1
  export * from "./errors.ts";
2
2
  export * from "./paths.ts";
3
+ export * from "./driver.ts";
3
4
  export * from "./db.ts";
4
5
  export * from "./ids.ts";
5
6
  export * from "./resolve.ts";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
@@ -1,16 +1,16 @@
1
- import type { Database } from "bun:sqlite";
1
+ import type { DbDriver } from "./driver.ts";
2
2
  import type { PropertyRow } from "./properties.ts";
3
- export declare function hasIndex(db: Database, databaseId: string, propId: string): boolean;
3
+ export declare function hasIndex(db: DbDriver, databaseId: string, propId: string): boolean;
4
4
  /**
5
5
  * Create an expression index on `data ->> '<propId>'` (with created_hlc as the
6
6
  * sort tail), partial on this database. Idempotent. The expression matches
7
7
  * exactly what listRecords emits, so the optimizer uses it.
8
8
  */
9
- export declare function ensurePropIndex(db: Database, databaseId: string, propId: string): void;
9
+ export declare function ensurePropIndex(db: DbDriver, databaseId: string, propId: string): void;
10
10
  /**
11
11
  * Ensure an index for a field that a query filters/sorts on — but only when it
12
12
  * will pay off. relation fields are almost always query keys (cheap, index
13
13
  * eagerly); other fields wait until the collection crosses the row threshold.
14
14
  */
15
- export declare function maybeAutoIndex(db: Database, databaseId: string, prop: PropertyRow): void;
15
+ export declare function maybeAutoIndex(db: DbDriver, databaseId: string, prop: PropertyRow): void;
16
16
  //# sourceMappingURL=indexing.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"indexing.d.ts","sourceRoot":"","sources":["../../src/core/indexing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAsBnD,wBAAgB,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAKlF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAMtF;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,CAWxF"}
1
+ {"version":3,"file":"indexing.d.ts","sourceRoot":"","sources":["../../src/core/indexing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAsBnD,wBAAgB,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAKlF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAMtF;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,CAWxF"}
@@ -28,5 +28,5 @@ export declare function validateHub(db: Database): IntegrityReport;
28
28
  * node) is a no-op. Report-only categories (dup_name, bad_config) are returned in
29
29
  * `remaining` for human resolution, never auto-changed.
30
30
  */
31
- export declare function repairHub(db: Database): RepairResult;
31
+ export declare const repairHub: (db: Database) => RepairResult;
32
32
  //# sourceMappingURL=integrity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"integrity.d.ts","sourceRoot":"","sources":["../../src/core/integrity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAqB3C,MAAM,MAAM,aAAa,GACrB,YAAY,GACZ,aAAa,GACb,UAAU,GACV,UAAU,GACV,cAAc,GACd,YAAY,CAAC;AAEjB,MAAM,WAAW,KAAK;IACpB,QAAQ,EAAE,aAAa,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,MAAM,EAAE,KAAK,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,4EAA4E;IAC5E,SAAS,EAAE,eAAe,CAAC;CAC5B;AAuSD,+DAA+D;AAC/D,wBAAgB,WAAW,CAAC,EAAE,EAAE,QAAQ,GAAG,eAAe,CAYzD;AAeD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,QAAQ,GAAG,YAAY,CAYpD"}
1
+ {"version":3,"file":"integrity.d.ts","sourceRoot":"","sources":["../../src/core/integrity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAqB3C,MAAM,MAAM,aAAa,GACrB,YAAY,GACZ,aAAa,GACb,UAAU,GACV,UAAU,GACV,cAAc,GACd,YAAY,CAAC;AAEjB,MAAM,WAAW,KAAK;IACpB,QAAQ,EAAE,aAAa,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,MAAM,EAAE,KAAK,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,4EAA4E;IAC5E,SAAS,EAAE,eAAe,CAAC;CAC5B;AAuSD,+DAA+D;AAC/D,wBAAgB,WAAW,CAAC,EAAE,EAAE,QAAQ,GAAG,eAAe,CAYzD;AAeD;;;;;GAKG;AACH,eAAO,MAAM,SAAS,gCAYV,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { Database } from "bun:sqlite";
1
+ import type { DbDriver } from "./driver.ts";
2
2
  /** Stable per-machine node id, persisted in the meta table. */
3
- export declare function getNodeId(db: Database): string;
3
+ export declare function getNodeId(db: DbDriver): string;
4
4
  //# sourceMappingURL=node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/core/node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG3C,+DAA+D;AAC/D,wBAAgB,SAAS,CAAC,EAAE,EAAE,QAAQ,GAAG,MAAM,CAQ9C"}
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/core/node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C,+DAA+D;AAC/D,wBAAgB,SAAS,CAAC,EAAE,EAAE,QAAQ,GAAG,MAAM,CAQ9C"}
@@ -1,4 +1,4 @@
1
- import type { Database } from "bun:sqlite";
1
+ import type { DbDriver } from "./driver.ts";
2
2
  export type PropType = "text" | "number" | "checkbox" | "select" | "multi_select" | "date" | "relation" | "url";
3
3
  export declare const PROP_TYPES: ReadonlySet<string>;
4
4
  export interface PropertyConfig {
@@ -15,21 +15,22 @@ export interface PropertyRow {
15
15
  config: PropertyConfig | null;
16
16
  position: number;
17
17
  }
18
- export declare function addProperty(db: Database, databaseId: string, opts: {
18
+ export declare const PROPERTY_COLS: readonly ["id", "database_id", "name", "type", "config", "position"];
19
+ export declare const addProperty: (db: DbDriver, databaseId: string, opts: {
19
20
  name: string;
20
21
  type: PropType;
21
22
  config?: PropertyConfig;
22
23
  position?: number;
23
24
  indexed?: boolean;
24
- }): PropertyRow;
25
- export declare function getProperty(db: Database, id: string): PropertyRow | null;
26
- export declare function listProperties(db: Database, databaseId: string): PropertyRow[];
27
- export declare function updateProperty(db: Database, id: string, fields: {
25
+ }) => PropertyRow;
26
+ export declare function getProperty(db: DbDriver, id: string): PropertyRow | null;
27
+ export declare function listProperties(db: DbDriver, databaseId: string): PropertyRow[];
28
+ export declare const updateProperty: (db: DbDriver, id: string, fields: {
28
29
  name?: string;
29
30
  type?: PropType;
30
31
  config?: PropertyConfig;
31
32
  position?: number;
32
- }): PropertyRow;
33
- export declare function setPropertyWidth(db: Database, id: string, width: number): PropertyRow;
34
- export declare function removeProperty(db: Database, id: string): boolean;
33
+ }) => PropertyRow;
34
+ export declare function setPropertyWidth(db: DbDriver, id: string, width: number): PropertyRow;
35
+ export declare const removeProperty: (db: DbDriver, id: string) => boolean;
35
36
  //# sourceMappingURL=properties.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../src/core/properties.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAO3C,MAAM,MAAM,QAAQ,GAChB,MAAM,GACN,QAAQ,GACR,UAAU,GACV,QAAQ,GACR,cAAc,GACd,MAAM,GACN,UAAU,GACV,KAAK,CAAC;AAEV,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC,MAAM,CASzC,CAAC;AAEH,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAuBD,wBAAgB,WAAW,CACzB,EAAE,EAAE,QAAQ,EACZ,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE;IACJ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAA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O,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAGD,eAAO,MAAM,aAAa,sEAAuE,CAAC;AAyBlG,eAAO,MAAM,WAAW;UAId,MAAM;UACN,QAAQ;aACL,cAAc;eACZ,MAAM;cAIP,OAAO;iBAwBnB,CAAC;AAEH,wBAAgB,WAAW,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAMxE;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,GAAG,WAAW,EAAE,CAU9E;AAED,eAAO,MAAM,cAAc;WAGR,MAAM;WAAS,QAAQ;aAAW,cAAc;eAAa,MAAM;iBA+BpF,CAAC;AAKH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,CAMrF;AAED,eAAO,MAAM,cAAc,uCAczB,CAAC"}
@@ -1,18 +1,23 @@
1
- import type { Database } from "bun:sqlite";
1
+ import type { DbDriver } from "./driver.ts";
2
2
  export interface RecordRow {
3
3
  id: string;
4
4
  database_id: string;
5
+ /** Cells keyed by property NAME — friendly for CLI / external agents, but
6
+ * lossy when two properties share a name (one entry wins). */
5
7
  values: Record<string, unknown>;
8
+ /** Cells keyed by property ID — lossless under duplicate names; the WebUI
9
+ * reads/writes through this. */
10
+ cells: Record<string, unknown>;
6
11
  }
7
- export declare function backfillRecordOrderKeys(db: Database, databaseId?: string): void;
8
- export declare function createRecord(db: Database, databaseId: string, data: Record<string, unknown>): RecordRow;
9
- export declare function getRecord(db: Database, id: string): RecordRow | null;
10
- export declare function listRecords(db: Database, databaseId: string, opts?: {
12
+ export declare const backfillRecordOrderKeys: (db: DbDriver, databaseId?: string | undefined) => void;
13
+ export declare const createRecord: (db: DbDriver, databaseId: string, data: Record<string, unknown>) => RecordRow;
14
+ export declare function getRecord(db: DbDriver, id: string): RecordRow | null;
15
+ export declare function listRecords(db: DbDriver, databaseId: string, opts?: {
11
16
  filter?: Record<string, unknown>;
12
17
  sort?: string;
13
18
  limit?: number;
14
19
  }): RecordRow[];
15
- export declare function moveRecord(db: Database, id: string, targetId: string, where: "before" | "after"): RecordRow;
16
- export declare function updateRecord(db: Database, id: string, data: Record<string, unknown>): RecordRow;
17
- export declare function deleteRecord(db: Database, id: string): boolean;
20
+ export declare const moveRecord: (db: DbDriver, id: string, targetId: string, where: "before" | "after") => RecordRow;
21
+ export declare const updateRecord: (db: DbDriver, id: string, data: Record<string, unknown>) => RecordRow;
22
+ export declare const deleteRecord: (db: DbDriver, id: string) => boolean;
18
23
  //# sourceMappingURL=records.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../src/core/records.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAsB3C,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAiKD,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAyB/E;AAED,wBAAgB,YAAY,CAC1B,EAAE,EAAE,QAAQ,EACZ,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,SAAS,CAcX;AAED,wBAAgB,S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AAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAMpE;AAOD,wBAAgB,WAAW,CACzB,EAAE,EAAE,QAAQ,EACZ,UAAU,EAAE,MAAM,EAClB,IAAI,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GAC7E,SAAS,EAAE,CAiFb;AAED,eAAO,MAAM,UAAU,sFA0CrB,CAAC;AAEH,eAAO,MAAM,YAAY,wEAavB,CAAC;AAEH,eAAO,MAAM,YAAY,uCAOvB,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { Database } from "bun:sqlite";
1
+ import type { DbDriver } from "./driver.ts";
2
2
  /** Kinds reachable through the public reference resolver. `blk` is internal. */
3
3
  export type PublicKind = "db" | "prop" | "rec" | "doc";
4
4
  export interface Candidate {
@@ -12,7 +12,7 @@ export interface Candidate {
12
12
  * all public kinds are searched (the generic `mh get`). `databaseId` narrows
13
13
  * rec/doc/prop to one collection.
14
14
  */
15
- export declare function resolveCandidates(db: Database, ref: string, opts?: {
15
+ export declare function resolveCandidates(db: DbDriver, ref: string, opts?: {
16
16
  kind?: PublicKind;
17
17
  databaseId?: string;
18
18
  }): Candidate[];
@@ -21,12 +21,12 @@ export declare function resolveCandidates(db: Database, ref: string, opts?: {
21
21
  * keeps working). Otherwise a single candidate is returned; zero throws
22
22
  * "no such …"; multiple throws a git-style ambiguity list.
23
23
  */
24
- export declare function resolveEntity(db: Database, ref: string, opts?: {
24
+ export declare function resolveEntity(db: DbDriver, ref: string, opts?: {
25
25
  kind?: PublicKind;
26
26
  databaseId?: string;
27
27
  }): Candidate;
28
28
  /** Resolve `ref` to one concrete row id. See {@link resolveEntity}. */
29
- export declare function resolveRef(db: Database, ref: string, opts?: {
29
+ export declare function resolveRef(db: DbDriver, ref: string, opts?: {
30
30
  kind?: PublicKind;
31
31
  databaseId?: string;
32
32
  }): string;
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/core/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAI3C,gFAAgF;AAChF,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;AAEvD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,UAAU,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf;AAiFD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,QAAQ,EACZ,GAAG,EAAE,MAAM,EACX,IAAI,GAAE;IAAE,IAAI,CAAC,EAAE,UAAU,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAO,GACpD,SAAS,EAAE,CAiBb;AAQD;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,EAAE,EAAE,QAAQ,EACZ,GAAG,EAAE,MAAM,EACX,IAAI,GAAE;IAAE,IAAI,CAAC,EAAE,UAAU,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAO,GACpD,SAAS,CAeX;AAED,uEAAuE;AACvE,wBAAgB,UAAU,CACxB,EAAE,EAAE,QAAQ,EACZ,GAAG,EAAE,MAAM,EACX,IAAI,GAAE;IAAE,IAAI,CAAC,EAAE,UAAU,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAO,GACpD,MAAM,CAER"}
1
+ {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/core/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI5C,gFAAgF;AAChF,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;AAEvD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,UAAU,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf;AAiFD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,QAAQ,EACZ,GAAG,EAAE,MAAM,EACX,IAAI,GAAE;IAAE,IAAI,CAAC,EAAE,UAAU,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAO,GACpD,SAAS,EAAE,CAiBb;AAQD;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,EAAE,EAAE,QAAQ,EACZ,GAAG,EAAE,MAAM,EACX,IAAI,GAAE;IAAE,IAAI,CAAC,EAAE,UAAU,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAO,GACpD,SAAS,CAeX;AAED,uEAAuE;AACvE,wBAAgB,UAAU,CACxB,EAAE,EAAE,QAAQ,EACZ,GAAG,EAAE,MAAM,EACX,IAAI,GAAE;IAAE,IAAI,CAAC,EAAE,UAAU,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAO,GACpD,MAAM,CAER"}
@@ -0,0 +1,68 @@
1
+ import type { DbDriver } from "./driver.ts";
2
+ export declare function runSchema(db: DbDriver): void;
3
+ export declare function ftsAvailable(db: DbDriver): boolean;
4
+ /**
5
+ * Migrate legacy EAV records (record_values: one row per cell) to the JSON
6
+ * layout (records.data: one row per record). Idempotent — keyed off schema
7
+ * shape, no version flag. A no-op for fresh databases.
8
+ */
9
+ export declare function migrateRecords(db: DbDriver): void;
10
+ /**
11
+ * Add the peer-pairing columns to a legacy `peers` table (token/label/node_id/
12
+ * enabled/last_sync_at/last_success_at/last_status/last_error). Idempotent —
13
+ * guarded per column, never drops the table so existing replication cursors survive.
14
+ */
15
+ export declare function migratePeers(db: DbDriver): void;
16
+ /**
17
+ * Add the `blank_after` column to a legacy `doc_blocks` table. Idempotent —
18
+ * guarded by hasColumn; existing blocks default to 0 (canonical single-blank-line
19
+ * separators), so the migration never changes an existing document's body.
20
+ */
21
+ export declare function migrateDocBlocks(db: DbDriver): void;
22
+ /**
23
+ * Bring a legacy `blob_cache` to the current shape and retire the old synced
24
+ * `blob_presence` table. Idempotent (guarded by hasColumn / IF EXISTS).
25
+ * - `pinned`: node-local, never auto-evicted/cleared.
26
+ * - `pending`: bytes produced here, not yet flushed to a durable anchor. Existing
27
+ * rows can't be classified produced-vs-acquired, so default to 1 (protected);
28
+ * the next online flush sets already-in-bucket blobs back to 0, so it self-heals
29
+ * and is loss-free. See blobs.ts.
30
+ * - `blob_presence` (was synced) is dropped: clearing is now decided locally from
31
+ * `pending`. Leftover presence oplog changes are ignored (forward-compat).
32
+ */
33
+ export declare function migrateBlobCache(db: DbDriver): void;
34
+ /**
35
+ * Add the `order_key` column to a legacy `documents` table and backfill it.
36
+ * Idempotent — guarded by hasColumn; backfill only touches rows with a NULL key,
37
+ * assigning per-parent fractional indices in current created_hlc order, so the
38
+ * displayed document order is unchanged until the user first drags something.
39
+ */
40
+ export declare function migrateDocuments(db: DbDriver): void;
41
+ /**
42
+ * Add the `txn` change-group column to a legacy `crdt_changes` table.
43
+ * Idempotent — guarded by hasColumn; existing rows stay NULL (history falls
44
+ * back to time-gap clustering for them).
45
+ */
46
+ export declare function migrateOplog(db: DbDriver): void;
47
+ /**
48
+ * Rebuild a legacy `crdt_changes` (composite PRIMARY KEY, implicit rowid) into
49
+ * the current shape with an explicit `seq INTEGER PRIMARY KEY AUTOINCREMENT`.
50
+ *
51
+ * Why: replication push/pull cursors are crdt_changes rowids. The legacy table
52
+ * has no declared INTEGER PRIMARY KEY, so a `VACUUM` (run by `mh` compaction)
53
+ * renumbers its rowids 1..N; a peer's stored cursor then sits above the new
54
+ * MAX(rowid) and `changesAfterSeq`'s "never regress" floor pins it there,
55
+ * silently never pushing/pulling the writes below it. The declared `seq` is
56
+ * stable across VACUUM and never reused, closing the hole.
57
+ *
58
+ * Idempotent — guarded by the `seq` column. Old rowids are copied verbatim into
59
+ * seq so any *uncorrupted* cursor stays meaningful; then push/pull cursors are
60
+ * reset to 0 because we cannot tell which were already stranded by a past
61
+ * VACUUM, and a from-scratch re-sync is safe (INSERT OR IGNORE / ingest dedup)
62
+ * — a one-time catch-up on first sync after upgrade. storage_cursors are
63
+ * object-key based, never rowids, so they are left intact.
64
+ */
65
+ export declare function migrateCrdtChangesSeq(db: DbDriver): void;
66
+ /** Bring a freshly opened (or legacy) database to the current schema. */
67
+ export declare function initSchema(db: DbDriver): void;
68
+ //# sourceMappingURL=schema-init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-init.d.ts","sourceRoot":"","sources":["../../src/core/schema-init.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAK5C,wBAAgB,SAAS,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAO5C;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAKlD;AAeD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAuBjD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAsB/C;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAGnD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAQnD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAInD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAG/C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CA4BxD;AAED,yEAAyE;AACzE,wBAAgB,UAAU,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAS7C"}
@@ -1,3 +1,3 @@
1
- export declare const CORE_SCHEMA = "\nCREATE TABLE IF NOT EXISTS meta (\n key TEXT PRIMARY KEY,\n value TEXT\n);\n\n-- CRDT oplog: one row per field assignment. Source of truth for sync.\nCREATE TABLE IF NOT EXISTS crdt_changes (\n hlc TEXT NOT NULL,\n node_id TEXT NOT NULL,\n dataset TEXT NOT NULL,\n row_id TEXT NOT NULL,\n col TEXT NOT NULL,\n value TEXT,\n PRIMARY KEY (dataset, row_id, col, hlc)\n);\nCREATE INDEX IF NOT EXISTS idx_changes_hlc ON crdt_changes(hlc);\n\n-- Per-peer replication cursors (SQLite rowids: monotonic in insertion order,\n-- so no change is ever skipped regardless of HLC/clock skew). Outbound side of\n-- a pairing: \"token\" is the credential the *remote* issued to us (sent as a\n-- Bearer header when we sync to them). See migratePeers in db.ts for the columns\n-- added to legacy databases.\nCREATE TABLE IF NOT EXISTS peers (\n url TEXT PRIMARY KEY,\n pull_cursor INTEGER NOT NULL DEFAULT 0,\n push_cursor INTEGER NOT NULL DEFAULT 0,\n token TEXT,\n label TEXT,\n node_id TEXT,\n enabled INTEGER NOT NULL DEFAULT 1,\n last_sync_at INTEGER,\n last_status TEXT,\n last_error TEXT\n);\n\n-- Inbound side of a pairing: credentials *we* issued to remote devices. A peer\n-- presents one of these on /sync; acceptsSyncToken() checks it alongside the\n-- managed master token. Revoke by deleting the row.\nCREATE TABLE IF NOT EXISTS peer_grants (\n token TEXT PRIMARY KEY,\n peer_url TEXT,\n node_id TEXT,\n created_at INTEGER\n);\n\n-- One-time pairing codes minted by \"mh config peer code\" / POST /api/pair/new.\n-- Short-lived and single-use: redeemed during the pairing handshake, then the\n-- two devices exchange durable peer_grants. used/exp gate redemption.\nCREATE TABLE IF NOT EXISTS pairing_codes (\n code TEXT PRIMARY KEY,\n exp INTEGER NOT NULL,\n used INTEGER NOT NULL DEFAULT 0,\n created_at INTEGER\n);\n\nCREATE TABLE IF NOT EXISTS databases (\n id TEXT PRIMARY KEY,\n name TEXT,\n icon TEXT,\n created_hlc TEXT,\n __deleted INTEGER NOT NULL DEFAULT 0\n);\n\nCREATE TABLE IF NOT EXISTS properties (\n id TEXT PRIMARY KEY,\n database_id TEXT,\n name TEXT,\n type TEXT,\n config TEXT,\n position REAL,\n __deleted INTEGER NOT NULL DEFAULT 0\n);\nCREATE INDEX IF NOT EXISTS idx_properties_db ON properties(database_id);\n\n-- One row per record. Field cells live in the data JSON object, keyed by\n-- property id (rename-safe). Each (record,property) is still an independent\n-- CRDT register in the oplog; materialize() folds the winner into data via\n-- json_set/json_remove. Hot fields get expression indexes on data->>'propid'\n-- (see indexing.ts) so filter/sort/limit push down to SQL.\nCREATE TABLE IF NOT EXISTS records (\n id TEXT PRIMARY KEY,\n database_id TEXT,\n created_hlc TEXT,\n order_key TEXT,\n data TEXT NOT NULL DEFAULT '{}',\n __deleted INTEGER NOT NULL DEFAULT 0\n);\nCREATE INDEX IF NOT EXISTS idx_records_db_hlc ON records(database_id, created_hlc);\n\nCREATE TABLE IF NOT EXISTS documents (\n id TEXT PRIMARY KEY,\n title TEXT,\n body TEXT, -- materialized cache: serialized from doc_blocks\n database_id TEXT,\n parent_id TEXT,\n created_hlc TEXT,\n order_key TEXT, -- fractional index among siblings (same parent_id); ties broken by created_hlc,id\n __deleted INTEGER NOT NULL DEFAULT 0\n);\n\n-- Document body as an ordered list of blocks; each (block,field) is an\n-- independent CRDT register so concurrent edits to different blocks merge.\n-- order_key is a fractional index (ties broken by id) giving display order.\nCREATE TABLE IF NOT EXISTS doc_blocks (\n id TEXT PRIMARY KEY,\n doc_id TEXT,\n text TEXT,\n order_key TEXT,\n blank_after INTEGER NOT NULL DEFAULT 0, -- extra blank lines kept after this block (user spacing)\n __deleted INTEGER NOT NULL DEFAULT 0\n);\nCREATE INDEX IF NOT EXISTS idx_doc_blocks_doc ON doc_blocks(doc_id);\n\n-- A named static site (Supabase-Storage-style bucket). Served at /sites/<name>/.\nCREATE TABLE IF NOT EXISTS sites (\n id TEXT PRIMARY KEY,\n name TEXT, -- URL slug; resolved by getSiteByName\n title TEXT,\n created_hlc TEXT,\n __deleted INTEGER NOT NULL DEFAULT 0\n);\n\n-- One row per file in a site. content holds inline utf8/base64 text, or a blob\n-- hash (see cache.ts) when encoding = 'blob'. (site_id, path) maps to a stable\n-- id so re-uploads merge as a CRDT register instead of duplicating.\nCREATE TABLE IF NOT EXISTS site_files (\n id TEXT PRIMARY KEY,\n site_id TEXT,\n path TEXT,\n content_type TEXT,\n encoding TEXT, -- 'utf8' | 'base64' | 'blob'\n content TEXT,\n created_hlc TEXT,\n __deleted INTEGER NOT NULL DEFAULT 0\n);\nCREATE INDEX IF NOT EXISTS idx_site_files_site ON site_files(site_id);\n";
1
+ export declare const CORE_SCHEMA = "\nCREATE TABLE IF NOT EXISTS meta (\n key TEXT PRIMARY KEY,\n value TEXT\n);\n\n-- CRDT oplog: one row per field assignment. Source of truth for sync.\n-- txn groups the changes of one logical mutation for history rendering\n-- (nullable: legacy rows and changes from pre-txn peers have none).\n--\n-- seq is an explicit AUTOINCREMENT id used as the replication cursor. It must\n-- be a declared INTEGER PRIMARY KEY (not the implicit rowid): VACUUM renumbers\n-- the rowids of tables that lack one, which would shift them below a peer's\n-- stored push/pull cursor and silently strand every write in the gap.\n-- AUTOINCREMENT additionally guarantees ids are never reused. The\n-- (dataset,row_id,col,hlc) tuple stays UNIQUE so applyChange's INSERT OR IGNORE\n-- dedup is unchanged. Legacy databases are rebuilt into this shape by\n-- migrateCrdtChangesSeq (schema-init.ts).\nCREATE TABLE IF NOT EXISTS crdt_changes (\n seq INTEGER PRIMARY KEY AUTOINCREMENT,\n hlc TEXT NOT NULL,\n node_id TEXT NOT NULL,\n dataset TEXT NOT NULL,\n row_id TEXT NOT NULL,\n col TEXT NOT NULL,\n value TEXT,\n txn TEXT,\n UNIQUE (dataset, row_id, col, hlc)\n);\nCREATE INDEX IF NOT EXISTS idx_changes_hlc ON crdt_changes(hlc);\n-- Serves history's \"every block ever attached to this doc\" lookup. Partial so\n-- it never indexes the large values other datasets carry (e.g. site file bodies).\nCREATE INDEX IF NOT EXISTS idx_changes_docref ON crdt_changes(value)\n WHERE dataset = 'doc_blocks' AND col = 'doc_id';\n\n-- Per-peer replication cursors (crdt_changes.seq: AUTOINCREMENT, monotonic in\n-- insertion order and stable across VACUUM, so no change is ever skipped\n-- regardless of HLC/clock skew). Outbound side of\n-- a pairing: \"token\" is the credential the *remote* issued to us (sent as a\n-- Bearer header when we sync to them). See migratePeers in db.ts for the columns\n-- added to legacy databases.\n--\n-- kind selects the transport: 'http' (POST /sync to a peer server, the classic\n-- path) or 's3' (an S3-compatible bucket used as dumb store-and-forward \u2014 see\n-- sync/storage.ts). For 's3' peers url is a synthetic key (s3://<bucket>/<prefix>)\n-- and config holds the bucket settings + credentials + master key as JSON.\n-- Like the rest of peers, config is local-only and never enters the CRDT oplog.\nCREATE TABLE IF NOT EXISTS peers (\n url TEXT PRIMARY KEY,\n pull_cursor INTEGER NOT NULL DEFAULT 0,\n push_cursor INTEGER NOT NULL DEFAULT 0,\n token TEXT,\n label TEXT,\n node_id TEXT,\n enabled INTEGER NOT NULL DEFAULT 1,\n last_sync_at INTEGER,\n last_success_at INTEGER,\n last_status TEXT,\n last_error TEXT,\n kind TEXT NOT NULL DEFAULT 'http',\n config TEXT\n);\n\n-- Per-(storage-peer, remote-node) pull progress: the key of the last oplog\n-- segment we consumed from that node's bucket prefix. HTTP peers use the single\n-- pull_cursor above; storage peers need one cursor per remote node because each\n-- node publishes its own segment stream under its own prefix. last_key is a\n-- bucket object key (lexicographically ordered = chronological), so LIST\n-- start-after resumes exactly where we left off.\nCREATE TABLE IF NOT EXISTS storage_cursors (\n peer_url TEXT NOT NULL,\n node_id TEXT NOT NULL,\n last_key TEXT,\n PRIMARY KEY (peer_url, node_id)\n);\n\n-- Inbound side of a pairing: credentials *we* issued to remote devices. A peer\n-- presents one of these on /sync; acceptsSyncToken() checks it alongside the\n-- managed master token. Revoke by deleting the row.\nCREATE TABLE IF NOT EXISTS peer_grants (\n token TEXT PRIMARY KEY,\n peer_url TEXT,\n node_id TEXT,\n created_at INTEGER\n);\n\n-- One-time pairing codes minted by \"mh config peer code\" / POST /api/pair/new.\n-- Short-lived and single-use: redeemed during the pairing handshake, then the\n-- two devices exchange durable peer_grants. used/exp gate redemption.\nCREATE TABLE IF NOT EXISTS pairing_codes (\n code TEXT PRIMARY KEY,\n exp INTEGER NOT NULL,\n used INTEGER NOT NULL DEFAULT 0,\n created_at INTEGER\n);\n\nCREATE TABLE IF NOT EXISTS databases (\n id TEXT PRIMARY KEY,\n name TEXT,\n icon TEXT,\n created_hlc TEXT,\n __deleted INTEGER NOT NULL DEFAULT 0\n);\n\nCREATE TABLE IF NOT EXISTS properties (\n id TEXT PRIMARY KEY,\n database_id TEXT,\n name TEXT,\n type TEXT,\n config TEXT,\n position REAL,\n __deleted INTEGER NOT NULL DEFAULT 0\n);\nCREATE INDEX IF NOT EXISTS idx_properties_db ON properties(database_id);\n\n-- One row per record. Field cells live in the data JSON object, keyed by\n-- property id (rename-safe). Each (record,property) is still an independent\n-- CRDT register in the oplog; materialize() folds the winner into data via\n-- json_set/json_remove. Hot fields get expression indexes on data->>'propid'\n-- (see indexing.ts) so filter/sort/limit push down to SQL.\nCREATE TABLE IF NOT EXISTS records (\n id TEXT PRIMARY KEY,\n database_id TEXT,\n created_hlc TEXT,\n order_key TEXT,\n data TEXT NOT NULL DEFAULT '{}',\n __deleted INTEGER NOT NULL DEFAULT 0\n);\nCREATE INDEX IF NOT EXISTS idx_records_db_hlc ON records(database_id, created_hlc);\n\nCREATE TABLE IF NOT EXISTS documents (\n id TEXT PRIMARY KEY,\n title TEXT,\n body TEXT, -- materialized cache: serialized from doc_blocks\n database_id TEXT,\n parent_id TEXT,\n created_hlc TEXT,\n order_key TEXT, -- fractional index among siblings (same parent_id); ties broken by created_hlc,id\n __deleted INTEGER NOT NULL DEFAULT 0\n);\n\n-- Document body as an ordered list of blocks; each (block,field) is an\n-- independent CRDT register so concurrent edits to different blocks merge.\n-- order_key is a fractional index (ties broken by id) giving display order.\nCREATE TABLE IF NOT EXISTS doc_blocks (\n id TEXT PRIMARY KEY,\n doc_id TEXT,\n text TEXT,\n order_key TEXT,\n blank_after INTEGER NOT NULL DEFAULT 0, -- extra blank lines kept after this block (user spacing)\n __deleted INTEGER NOT NULL DEFAULT 0\n);\nCREATE INDEX IF NOT EXISTS idx_doc_blocks_doc ON doc_blocks(doc_id);\n\n-- A named static site (Supabase-Storage-style bucket). Served at /sites/<name>/.\nCREATE TABLE IF NOT EXISTS sites (\n id TEXT PRIMARY KEY,\n name TEXT, -- URL slug; resolved by getSiteByName\n title TEXT,\n created_hlc TEXT,\n __deleted INTEGER NOT NULL DEFAULT 0\n);\n\n-- One row per file in a site. content holds inline utf8/base64 text, or a blob\n-- hash (see cache.ts) when encoding = 'blob'. (site_id, path) maps to a stable\n-- id so re-uploads merge as a CRDT register instead of duplicating.\nCREATE TABLE IF NOT EXISTS site_files (\n id TEXT PRIMARY KEY,\n site_id TEXT,\n path TEXT,\n content_type TEXT,\n encoding TEXT, -- 'utf8' | 'base64' | 'blob'\n content TEXT,\n created_hlc TEXT,\n __deleted INTEGER NOT NULL DEFAULT 0\n);\nCREATE INDEX IF NOT EXISTS idx_site_files_site ON site_files(site_id);\n\n-- Node-local blob cache ledger (NOT synced, like peers/storage_cursors): one row\n-- per blob byte-file held in cache.ts's content-addressed store (~/.metahub/cache).\n-- Gives the bare hash-named files the metadata clearing/stats need. hash is the\n-- canonical content key (sha256 truncated to 32 hex; legacy 64-hex coexist).\n-- pending = bytes produced HERE not yet confirmed flushed to a durable anchor\n-- (bucket) \u2014 the only blobs a device must protect; never auto-evicted/cleared.\n-- pending=0 means a flushed production OR an acquired cache, both safely\n-- clearable (re-fetchable). This local fact replaces the old SYNCED blob_presence\n-- table \u2014 clearing is now purely local/offline. See blobs.ts / 22-blob-sync.\nCREATE TABLE IF NOT EXISTS blob_cache (\n hash TEXT PRIMARY KEY,\n size INTEGER NOT NULL,\n content_type TEXT,\n last_access INTEGER,\n pinned INTEGER NOT NULL DEFAULT 0, -- node-local: never auto-evicted / cleared\n pending INTEGER NOT NULL DEFAULT 1, -- produced here, not yet flushed to anchor\n anchored INTEGER NOT NULL DEFAULT 0 -- node-local: last verify confirmed a designated anchor holds it (per redundancy). Drives isClearable; reset on policy change\n);\n\n-- Synced workspace policy (single row \"default\"): which nodes are designated\n-- full-blob libraries \u2014 the durable anchor in no-bucket topologies (they pull\n-- everything and never clear). full_nodes is a JSON array of node_id; redundancy\n-- is retained but unused since clearing moved to the local pending model.\nCREATE TABLE IF NOT EXISTS blob_policy (\n id TEXT PRIMARY KEY, -- always \"default\"\n full_nodes TEXT, -- JSON array of node_id\n redundancy TEXT, -- 'all' | 'any'\n __deleted INTEGER NOT NULL DEFAULT 0\n);\n";
2
2
  export declare const FTS_SCHEMA = "\nCREATE VIRTUAL TABLE IF NOT EXISTS search_fts USING fts5(\n kind UNINDEXED,\n id UNINDEXED,\n database_id UNINDEXED,\n title,\n body\n);\n";
3
3
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/core/schema.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,k3JAyIvB,CAAC;AAGF,eAAO,MAAM,UAAU,sJAQtB,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/core/schema.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,80RA+MvB,CAAC;AAGF,eAAO,MAAM,UAAU,sJAQtB,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { Database } from "bun:sqlite";
1
+ import type { DbDriver } from "./driver.ts";
2
2
  export interface SearchHit {
3
3
  type: "document" | "record";
4
4
  id: string;
@@ -7,8 +7,8 @@ export interface SearchHit {
7
7
  snippet: string;
8
8
  }
9
9
  /** Force a full rebuild of the search index (maintenance / repair). */
10
- export declare function rebuildSearchIndex(db: Database): boolean;
11
- export declare function search(db: Database, query: string, opts?: {
10
+ export declare function rebuildSearchIndex(db: DbDriver): boolean;
11
+ export declare function search(db: DbDriver, query: string, opts?: {
12
12
  limit?: number;
13
13
  }): SearchHit[];
14
14
  //# sourceMappingURL=search.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/core/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAI3C,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,UAAU,GAAG,QAAQ,CAAC;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAwKD,uEAAuE;AACvE,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAIxD;AAoFD,wBAAgB,MAAM,CACpB,EAAE,EAAE,QAAQ,EACZ,KAAK,EAAE,MAAM,EACb,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GAC5B,SAAS,EAAE,CAWb"}
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/core/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI5C,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,UAAU,GAAG,QAAQ,CAAC;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAwKD,uEAAuE;AACvE,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAIxD;AAoFD,wBAAgB,MAAM,CACpB,EAAE,EAAE,QAAQ,EACZ,KAAK,EAAE,MAAM,EACb,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GAC5B,SAAS,EAAE,CAWb"}