@tensorix/metahub 0.5.7 → 0.6.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 (124) hide show
  1. package/README.md +35 -14
  2. package/README.zh-CN.md +41 -13
  3. package/dist/cli.js +4436 -1328
  4. package/dist/cli.js.map +71 -48
  5. package/dist/core/blobs.d.ts.map +1 -1
  6. package/dist/core/blocks.d.ts +6 -2
  7. package/dist/core/blocks.d.ts.map +1 -1
  8. package/dist/core/compact.d.ts.map +1 -1
  9. package/dist/core/crdt.d.ts +5 -6
  10. package/dist/core/crdt.d.ts.map +1 -1
  11. package/dist/core/db.d.ts.map +1 -1
  12. package/dist/core/documents.d.ts +39 -0
  13. package/dist/core/documents.d.ts.map +1 -1
  14. package/dist/core/errors.d.ts +6 -1
  15. package/dist/core/errors.d.ts.map +1 -1
  16. package/dist/core/history-archive.d.ts +41 -0
  17. package/dist/core/history-archive.d.ts.map +1 -0
  18. package/dist/core/history.d.ts.map +1 -1
  19. package/dist/core/hlc.d.ts +4 -0
  20. package/dist/core/hlc.d.ts.map +1 -1
  21. package/dist/core/node.d.ts.map +1 -1
  22. package/dist/core/properties.d.ts +6 -0
  23. package/dist/core/properties.d.ts.map +1 -1
  24. package/dist/core/replica/drafts.d.ts +26 -0
  25. package/dist/core/replica/drafts.d.ts.map +1 -0
  26. package/dist/core/replica/rpc.d.ts +8 -0
  27. package/dist/core/replica/rpc.d.ts.map +1 -0
  28. package/dist/core/replica/service.d.ts +970 -0
  29. package/dist/core/replica/service.d.ts.map +1 -0
  30. package/dist/core/replica/sync.d.ts +55 -0
  31. package/dist/core/replica/sync.d.ts.map +1 -0
  32. package/dist/core/schema-init.d.ts +1 -1
  33. package/dist/core/schema-init.d.ts.map +1 -1
  34. package/dist/core/search.d.ts +34 -0
  35. package/dist/core/search.d.ts.map +1 -1
  36. package/dist/core/snapshot.d.ts.map +1 -1
  37. package/dist/core/sync/bucket-v2.d.ts +110 -0
  38. package/dist/core/sync/bucket-v2.d.ts.map +1 -0
  39. package/dist/core/sync/client.d.ts +14 -1
  40. package/dist/core/sync/client.d.ts.map +1 -1
  41. package/dist/core/sync/commit-log.d.ts +41 -0
  42. package/dist/core/sync/commit-log.d.ts.map +1 -0
  43. package/dist/core/sync/current-checkpoint.d.ts +47 -0
  44. package/dist/core/sync/current-checkpoint.d.ts.map +1 -0
  45. package/dist/core/sync/data-map-db.d.ts.map +1 -1
  46. package/dist/core/sync/data-version.d.ts +29 -0
  47. package/dist/core/sync/data-version.d.ts.map +1 -0
  48. package/dist/core/sync/drop-keys.d.ts.map +1 -1
  49. package/dist/core/sync/drop-pull.d.ts.map +1 -1
  50. package/dist/core/sync/e2ee.d.ts +5 -0
  51. package/dist/core/sync/e2ee.d.ts.map +1 -1
  52. package/dist/core/sync/enroll.d.ts +2 -0
  53. package/dist/core/sync/enroll.d.ts.map +1 -1
  54. package/dist/core/sync/history-observation.d.ts +5 -0
  55. package/dist/core/sync/history-observation.d.ts.map +1 -0
  56. package/dist/core/sync/http-status.d.ts.map +1 -1
  57. package/dist/core/sync/page-messages.d.ts +12 -0
  58. package/dist/core/sync/page-messages.d.ts.map +1 -1
  59. package/dist/core/sync/peer-v2.d.ts +9 -0
  60. package/dist/core/sync/peer-v2.d.ts.map +1 -0
  61. package/dist/core/sync/peers.d.ts +1 -0
  62. package/dist/core/sync/peers.d.ts.map +1 -1
  63. package/dist/core/sync/portable-json.d.ts +5 -0
  64. package/dist/core/sync/portable-json.d.ts.map +1 -0
  65. package/dist/core/sync/protocol.d.ts +32 -0
  66. package/dist/core/sync/protocol.d.ts.map +1 -1
  67. package/dist/core/sync/recovery-desktop.d.ts +6 -0
  68. package/dist/core/sync/recovery-desktop.d.ts.map +1 -0
  69. package/dist/core/sync/recovery-intent.d.ts +7 -0
  70. package/dist/core/sync/recovery-intent.d.ts.map +1 -0
  71. package/dist/core/sync/recovery-local.d.ts +21 -0
  72. package/dist/core/sync/recovery-local.d.ts.map +1 -0
  73. package/dist/core/sync/recovery-v2.d.ts +40 -0
  74. package/dist/core/sync/recovery-v2.d.ts.map +1 -0
  75. package/dist/core/sync/retention-executor.d.ts +77 -0
  76. package/dist/core/sync/retention-executor.d.ts.map +1 -0
  77. package/dist/core/sync/retention-protocol.d.ts +74 -0
  78. package/dist/core/sync/retention-protocol.d.ts.map +1 -0
  79. package/dist/core/sync/retention-state.d.ts +87 -0
  80. package/dist/core/sync/retention-state.d.ts.map +1 -0
  81. package/dist/core/sync/routes.d.ts +1 -1
  82. package/dist/core/sync/routes.d.ts.map +1 -1
  83. package/dist/core/sync/server.d.ts +1 -1
  84. package/dist/core/sync/server.d.ts.map +1 -1
  85. package/dist/core/sync/share-export.d.ts.map +1 -1
  86. package/dist/core/sync/share-serve.d.ts.map +1 -1
  87. package/dist/core/sync/share-table-client.d.ts +7 -0
  88. package/dist/core/sync/share-table-client.d.ts.map +1 -0
  89. package/dist/core/sync/share-table.d.ts +11 -0
  90. package/dist/core/sync/share-table.d.ts.map +1 -0
  91. package/dist/core/sync/share-tools.d.ts +10 -0
  92. package/dist/core/sync/share-tools.d.ts.map +1 -0
  93. package/dist/core/sync/storage-s3-bun.d.ts +3 -1
  94. package/dist/core/sync/storage-s3-bun.d.ts.map +1 -1
  95. package/dist/core/sync/storage-s3-fetch.d.ts +8 -0
  96. package/dist/core/sync/storage-s3-fetch.d.ts.map +1 -0
  97. package/dist/core/sync/storage-s3-sign.d.ts +3 -0
  98. package/dist/core/sync/storage-s3-sign.d.ts.map +1 -1
  99. package/dist/core/sync/storage-v2.d.ts +18 -0
  100. package/dist/core/sync/storage-v2.d.ts.map +1 -0
  101. package/dist/core/sync/storage.d.ts +47 -6
  102. package/dist/core/sync/storage.d.ts.map +1 -1
  103. package/dist/core/sync/transport.d.ts +4 -0
  104. package/dist/core/sync/transport.d.ts.map +1 -0
  105. package/dist/core/sync/v2-ingest.d.ts +10 -0
  106. package/dist/core/sync/v2-ingest.d.ts.map +1 -0
  107. package/dist/core/sync/v2-maintenance.d.ts +10 -0
  108. package/dist/core/sync/v2-maintenance.d.ts.map +1 -0
  109. package/dist/db-worker.js +212 -160
  110. package/dist/edge-worker.js +4956 -186
  111. package/dist/index.js +9461 -6468
  112. package/dist/index.js.map +69 -47
  113. package/dist/metahub-sdk.js +5 -5
  114. package/dist/mh-runtime.js +2 -2
  115. package/dist/shared/views/date.d.ts +21 -0
  116. package/dist/shared/views/date.d.ts.map +1 -0
  117. package/dist/shared/views/model.d.ts +65 -0
  118. package/dist/shared/views/model.d.ts.map +1 -0
  119. package/dist/shared/views/query.d.ts +47 -0
  120. package/dist/shared/views/query.d.ts.map +1 -0
  121. package/dist/sw.js +9 -9
  122. package/dist/webui/server/routes.d.ts.map +1 -1
  123. package/dist/webui.js +131 -130
  124. package/package.json +1 -1
@@ -0,0 +1,970 @@
1
+ import { queryDocuments, type RecordQuery } from "../../shared/views/query.ts";
2
+ import type { DbDriver } from "../driver.ts";
3
+ import * as databases from "../databases.ts";
4
+ import * as properties from "../properties.ts";
5
+ import * as records from "../records.ts";
6
+ import * as documents from "../documents.ts";
7
+ import * as history from "../history.ts";
8
+ import { type SearchQuery } from "../search.ts";
9
+ export interface ReplicaChange {
10
+ datasets: string[];
11
+ rowIds: string[];
12
+ truncated: boolean;
13
+ }
14
+ export declare function replicaSequence(db: DbDriver): number;
15
+ export declare function replicaChangesSince(db: DbDriver, sequence: number): ReplicaChange | null;
16
+ export interface ReferenceSummaryQuery {
17
+ kind: "document" | "record";
18
+ databaseId?: string;
19
+ ids: string[];
20
+ }
21
+ export interface ReferenceSummary {
22
+ id: string;
23
+ title: string | null;
24
+ missing: boolean;
25
+ }
26
+ /** Resolve only requested labels, without loading document bodies or complete
27
+ * record data. Chunks stay below SQLite's portable parameter bound. */
28
+ export declare function referenceSummaries(db: DbDriver, query: ReferenceSummaryQuery): ReferenceSummary[];
29
+ /** The same synchronous command owner serves native screens and the editor bridge.
30
+ * Promise facades enter the command before yielding; no CRDT context spans await. */
31
+ export declare function createReplicaService(db: DbDriver, options?: {
32
+ onChange?: (change: ReplicaChange) => void;
33
+ searchBatchSize?: number;
34
+ }): {
35
+ db: DbDriver;
36
+ commands: {
37
+ listDatabases: () => databases.DatabaseRow[];
38
+ queryDocuments: (query?: Parameters<typeof queryDocuments>[1]) => {
39
+ documents: documents.DocumentSummary[];
40
+ total: number;
41
+ hasMore: boolean;
42
+ offset: number;
43
+ limit: number;
44
+ };
45
+ createDatabase: (opts: {
46
+ name: string;
47
+ icon?: string;
48
+ }) => databases.DatabaseRow;
49
+ updateDatabase: (id: string, fields: {
50
+ name?: string;
51
+ icon?: string | null;
52
+ meta?: Record<string, unknown> | null;
53
+ }) => databases.DatabaseRow;
54
+ duplicateDatabase: (id: string, options?: Parameters<typeof databases.duplicateDatabase>[2]) => databases.DatabaseRow;
55
+ deleteDatabase: (id: string) => {
56
+ ok: boolean;
57
+ };
58
+ listProperties: (databaseId: string) => properties.PropertyRow[];
59
+ addProperty: (databaseId: string, opts: {
60
+ name: string;
61
+ type: properties.PropType;
62
+ config?: properties.PropertyConfig;
63
+ position?: number;
64
+ indexed?: boolean;
65
+ }) => properties.PropertyRow;
66
+ updateProperty: (id: string, fields: {
67
+ name?: string;
68
+ type?: properties.PropType;
69
+ config?: properties.PropertyConfig;
70
+ position?: number;
71
+ }) => properties.PropertyRow;
72
+ moveProperty: (id: string, anchorId: string, where: "before" | "after") => properties.PropertyRow;
73
+ moveSelectOption: (id: string, option: string, anchor: string, where: "before" | "after") => properties.PropertyRow;
74
+ setPropertyWidth: (id: string, width: number) => properties.PropertyRow;
75
+ removeProperty: (id: string) => {
76
+ ok: boolean;
77
+ };
78
+ renameSelectOption: (id: string, from: string, to: string) => {
79
+ property: properties.PropertyRow;
80
+ renamed: number;
81
+ };
82
+ removeSelectOption: (id: string, name: string) => {
83
+ property: properties.PropertyRow;
84
+ cleared: number;
85
+ };
86
+ listRecords: (databaseId: string, opts?: {
87
+ filter?: Record<string, unknown>;
88
+ sort?: string;
89
+ limit?: number;
90
+ } | undefined) => records.RecordRow[];
91
+ queryRecords: (id: string, query?: RecordQuery) => {
92
+ records: {
93
+ id: string;
94
+ database_id: string;
95
+ cells: Record<string, unknown>;
96
+ values: Record<string, unknown>;
97
+ }[];
98
+ total: number;
99
+ hasMore: boolean;
100
+ offset: number;
101
+ limit: number;
102
+ };
103
+ getRecord: (id: string) => records.RecordRow;
104
+ createRecord: (databaseId: string, data: Record<string, unknown>) => records.RecordRow;
105
+ updateRecord: (id: string, data: Record<string, unknown>) => records.RecordRow;
106
+ moveRecord: (id: string, targetId: string, where: "before" | "after") => records.RecordRow;
107
+ deleteRecord: (id: string) => {
108
+ ok: boolean;
109
+ };
110
+ listRecordRevisions: (id: string) => history.RecordRevision[];
111
+ recordAtVersion: (id: string, at: string) => history.RecordVersionState;
112
+ recordFieldHistory: (id: string, propId: string) => history.FieldHistoryEntry[];
113
+ revertRecord: (id: string, to: string) => history.RevertRecordResult;
114
+ listPropertyRevisions: (id: string) => history.PropertyRevision[];
115
+ propertyAtVersion: (id: string, at: string) => history.PropertyVersionState;
116
+ revertProperty: (id: string, to: string) => history.RevertPropertyResult;
117
+ listDatabaseActivity: (id: string, limit?: number) => history.DatabaseActivityEntry[];
118
+ listDocuments: (opts?: {
119
+ database_id?: string;
120
+ parent_id?: string;
121
+ } | undefined) => documents.DocumentSummary[];
122
+ getDocument: (id: string) => {
123
+ version: string;
124
+ id: string;
125
+ title: string;
126
+ body: string | null;
127
+ database_id: string | null;
128
+ parent_id: string | null;
129
+ created_hlc: string;
130
+ order_key: string | null;
131
+ };
132
+ createDocument: (input: Parameters<typeof documents.createDocument>[1]) => {
133
+ version: string;
134
+ id: string;
135
+ title: string;
136
+ body: string | null;
137
+ database_id: string | null;
138
+ parent_id: string | null;
139
+ created_hlc: string;
140
+ order_key: string | null;
141
+ };
142
+ updateDocument: (id: string, fields: Parameters<typeof documents.updateDocument>[2], ifMatch?: string) => {
143
+ version: string;
144
+ id: string;
145
+ title: string;
146
+ body: string | null;
147
+ database_id: string | null;
148
+ parent_id: string | null;
149
+ created_hlc: string;
150
+ order_key: string | null;
151
+ };
152
+ editDocumentBlocks: (docId: string, edits: readonly documents.BlockEdit[], opts: {
153
+ ifMatch: string;
154
+ }) => {
155
+ document: documents.DocumentRow;
156
+ version: string;
157
+ inserted: string[];
158
+ };
159
+ moveDocument: (id: string, targetId: string, where: "before" | "after" | "into") => documents.DocumentRow;
160
+ duplicateDocument: (id: string, options?: {
161
+ title?: string;
162
+ parent_id?: string | null;
163
+ }) => {
164
+ version: string;
165
+ id: string;
166
+ title: string;
167
+ body: string | null;
168
+ database_id: string | null;
169
+ parent_id: string | null;
170
+ created_hlc: string;
171
+ order_key: string | null;
172
+ };
173
+ deleteDocument: (id: string) => {
174
+ ok: boolean;
175
+ };
176
+ listDocumentRevisions: (id: string) => history.DocRevision[];
177
+ documentAtVersion: (id: string, at: string) => history.DocumentVersionState;
178
+ revertDocument: (id: string, to: string, ifMatch?: string) => history.RevertDocResult;
179
+ nodes: () => import("../node.ts").NodeInfo[];
180
+ setNodeLabel: (label: string | null, nodeId?: string) => import("../node.ts").NodeInfo;
181
+ search: (text: string, limit?: number) => import("../search.ts").SearchHit[];
182
+ querySearch: (text: string, query?: SearchQuery) => import("../search.ts").SearchPage;
183
+ referenceSummaries: (query: ReferenceSummaryQuery) => ReferenceSummary[];
184
+ resolve: (text: string, limit?: number) => import("../resolve.ts").LookupHit[];
185
+ };
186
+ dispatch: <K extends "nodes" | "search" | "createRecord" | "updateRecord" | "listDatabases" | "queryDocuments" | "createDatabase" | "updateDatabase" | "duplicateDatabase" | "deleteDatabase" | "listProperties" | "addProperty" | "updateProperty" | "moveProperty" | "moveSelectOption" | "setPropertyWidth" | "removeProperty" | "renameSelectOption" | "removeSelectOption" | "listRecords" | "queryRecords" | "getRecord" | "moveRecord" | "deleteRecord" | "listRecordRevisions" | "recordAtVersion" | "recordFieldHistory" | "revertRecord" | "listPropertyRevisions" | "propertyAtVersion" | "revertProperty" | "listDatabaseActivity" | "listDocuments" | "getDocument" | "createDocument" | "updateDocument" | "editDocumentBlocks" | "moveDocument" | "duplicateDocument" | "deleteDocument" | "listDocumentRevisions" | "documentAtVersion" | "revertDocument" | "setNodeLabel" | "querySearch" | "referenceSummaries" | "resolve">(op: K, args: Parameters<{
187
+ listDatabases: () => databases.DatabaseRow[];
188
+ queryDocuments: (query?: Parameters<typeof queryDocuments>[1]) => {
189
+ documents: documents.DocumentSummary[];
190
+ total: number;
191
+ hasMore: boolean;
192
+ offset: number;
193
+ limit: number;
194
+ };
195
+ createDatabase: (opts: {
196
+ name: string;
197
+ icon?: string;
198
+ }) => databases.DatabaseRow;
199
+ updateDatabase: (id: string, fields: {
200
+ name?: string;
201
+ icon?: string | null;
202
+ meta?: Record<string, unknown> | null;
203
+ }) => databases.DatabaseRow;
204
+ duplicateDatabase: (id: string, options?: Parameters<typeof databases.duplicateDatabase>[2]) => databases.DatabaseRow;
205
+ deleteDatabase: (id: string) => {
206
+ ok: boolean;
207
+ };
208
+ listProperties: (databaseId: string) => properties.PropertyRow[];
209
+ addProperty: (databaseId: string, opts: {
210
+ name: string;
211
+ type: properties.PropType;
212
+ config?: properties.PropertyConfig;
213
+ position?: number;
214
+ indexed?: boolean;
215
+ }) => properties.PropertyRow;
216
+ updateProperty: (id: string, fields: {
217
+ name?: string;
218
+ type?: properties.PropType;
219
+ config?: properties.PropertyConfig;
220
+ position?: number;
221
+ }) => properties.PropertyRow;
222
+ moveProperty: (id: string, anchorId: string, where: "before" | "after") => properties.PropertyRow;
223
+ moveSelectOption: (id: string, option: string, anchor: string, where: "before" | "after") => properties.PropertyRow;
224
+ setPropertyWidth: (id: string, width: number) => properties.PropertyRow;
225
+ removeProperty: (id: string) => {
226
+ ok: boolean;
227
+ };
228
+ renameSelectOption: (id: string, from: string, to: string) => {
229
+ property: properties.PropertyRow;
230
+ renamed: number;
231
+ };
232
+ removeSelectOption: (id: string, name: string) => {
233
+ property: properties.PropertyRow;
234
+ cleared: number;
235
+ };
236
+ listRecords: (databaseId: string, opts?: {
237
+ filter?: Record<string, unknown>;
238
+ sort?: string;
239
+ limit?: number;
240
+ } | undefined) => records.RecordRow[];
241
+ queryRecords: (id: string, query?: RecordQuery) => {
242
+ records: {
243
+ id: string;
244
+ database_id: string;
245
+ cells: Record<string, unknown>;
246
+ values: Record<string, unknown>;
247
+ }[];
248
+ total: number;
249
+ hasMore: boolean;
250
+ offset: number;
251
+ limit: number;
252
+ };
253
+ getRecord: (id: string) => records.RecordRow;
254
+ createRecord: (databaseId: string, data: Record<string, unknown>) => records.RecordRow;
255
+ updateRecord: (id: string, data: Record<string, unknown>) => records.RecordRow;
256
+ moveRecord: (id: string, targetId: string, where: "before" | "after") => records.RecordRow;
257
+ deleteRecord: (id: string) => {
258
+ ok: boolean;
259
+ };
260
+ listRecordRevisions: (id: string) => history.RecordRevision[];
261
+ recordAtVersion: (id: string, at: string) => history.RecordVersionState;
262
+ recordFieldHistory: (id: string, propId: string) => history.FieldHistoryEntry[];
263
+ revertRecord: (id: string, to: string) => history.RevertRecordResult;
264
+ listPropertyRevisions: (id: string) => history.PropertyRevision[];
265
+ propertyAtVersion: (id: string, at: string) => history.PropertyVersionState;
266
+ revertProperty: (id: string, to: string) => history.RevertPropertyResult;
267
+ listDatabaseActivity: (id: string, limit?: number) => history.DatabaseActivityEntry[];
268
+ listDocuments: (opts?: {
269
+ database_id?: string;
270
+ parent_id?: string;
271
+ } | undefined) => documents.DocumentSummary[];
272
+ getDocument: (id: string) => {
273
+ version: string;
274
+ id: string;
275
+ title: string;
276
+ body: string | null;
277
+ database_id: string | null;
278
+ parent_id: string | null;
279
+ created_hlc: string;
280
+ order_key: string | null;
281
+ };
282
+ createDocument: (input: Parameters<typeof documents.createDocument>[1]) => {
283
+ version: string;
284
+ id: string;
285
+ title: string;
286
+ body: string | null;
287
+ database_id: string | null;
288
+ parent_id: string | null;
289
+ created_hlc: string;
290
+ order_key: string | null;
291
+ };
292
+ updateDocument: (id: string, fields: Parameters<typeof documents.updateDocument>[2], ifMatch?: string) => {
293
+ version: string;
294
+ id: string;
295
+ title: string;
296
+ body: string | null;
297
+ database_id: string | null;
298
+ parent_id: string | null;
299
+ created_hlc: string;
300
+ order_key: string | null;
301
+ };
302
+ editDocumentBlocks: (docId: string, edits: readonly documents.BlockEdit[], opts: {
303
+ ifMatch: string;
304
+ }) => {
305
+ document: documents.DocumentRow;
306
+ version: string;
307
+ inserted: string[];
308
+ };
309
+ moveDocument: (id: string, targetId: string, where: "before" | "after" | "into") => documents.DocumentRow;
310
+ duplicateDocument: (id: string, options?: {
311
+ title?: string;
312
+ parent_id?: string | null;
313
+ }) => {
314
+ version: string;
315
+ id: string;
316
+ title: string;
317
+ body: string | null;
318
+ database_id: string | null;
319
+ parent_id: string | null;
320
+ created_hlc: string;
321
+ order_key: string | null;
322
+ };
323
+ deleteDocument: (id: string) => {
324
+ ok: boolean;
325
+ };
326
+ listDocumentRevisions: (id: string) => history.DocRevision[];
327
+ documentAtVersion: (id: string, at: string) => history.DocumentVersionState;
328
+ revertDocument: (id: string, to: string, ifMatch?: string) => history.RevertDocResult;
329
+ nodes: () => import("../node.ts").NodeInfo[];
330
+ setNodeLabel: (label: string | null, nodeId?: string) => import("../node.ts").NodeInfo;
331
+ search: (text: string, limit?: number) => import("../search.ts").SearchHit[];
332
+ querySearch: (text: string, query?: SearchQuery) => import("../search.ts").SearchPage;
333
+ referenceSummaries: (query: ReferenceSummaryQuery) => ReferenceSummary[];
334
+ resolve: (text: string, limit?: number) => import("../resolve.ts").LookupHit[];
335
+ }[K]>) => ReturnType<{
336
+ listDatabases: () => databases.DatabaseRow[];
337
+ queryDocuments: (query?: Parameters<typeof queryDocuments>[1]) => {
338
+ documents: documents.DocumentSummary[];
339
+ total: number;
340
+ hasMore: boolean;
341
+ offset: number;
342
+ limit: number;
343
+ };
344
+ createDatabase: (opts: {
345
+ name: string;
346
+ icon?: string;
347
+ }) => databases.DatabaseRow;
348
+ updateDatabase: (id: string, fields: {
349
+ name?: string;
350
+ icon?: string | null;
351
+ meta?: Record<string, unknown> | null;
352
+ }) => databases.DatabaseRow;
353
+ duplicateDatabase: (id: string, options?: Parameters<typeof databases.duplicateDatabase>[2]) => databases.DatabaseRow;
354
+ deleteDatabase: (id: string) => {
355
+ ok: boolean;
356
+ };
357
+ listProperties: (databaseId: string) => properties.PropertyRow[];
358
+ addProperty: (databaseId: string, opts: {
359
+ name: string;
360
+ type: properties.PropType;
361
+ config?: properties.PropertyConfig;
362
+ position?: number;
363
+ indexed?: boolean;
364
+ }) => properties.PropertyRow;
365
+ updateProperty: (id: string, fields: {
366
+ name?: string;
367
+ type?: properties.PropType;
368
+ config?: properties.PropertyConfig;
369
+ position?: number;
370
+ }) => properties.PropertyRow;
371
+ moveProperty: (id: string, anchorId: string, where: "before" | "after") => properties.PropertyRow;
372
+ moveSelectOption: (id: string, option: string, anchor: string, where: "before" | "after") => properties.PropertyRow;
373
+ setPropertyWidth: (id: string, width: number) => properties.PropertyRow;
374
+ removeProperty: (id: string) => {
375
+ ok: boolean;
376
+ };
377
+ renameSelectOption: (id: string, from: string, to: string) => {
378
+ property: properties.PropertyRow;
379
+ renamed: number;
380
+ };
381
+ removeSelectOption: (id: string, name: string) => {
382
+ property: properties.PropertyRow;
383
+ cleared: number;
384
+ };
385
+ listRecords: (databaseId: string, opts?: {
386
+ filter?: Record<string, unknown>;
387
+ sort?: string;
388
+ limit?: number;
389
+ } | undefined) => records.RecordRow[];
390
+ queryRecords: (id: string, query?: RecordQuery) => {
391
+ records: {
392
+ id: string;
393
+ database_id: string;
394
+ cells: Record<string, unknown>;
395
+ values: Record<string, unknown>;
396
+ }[];
397
+ total: number;
398
+ hasMore: boolean;
399
+ offset: number;
400
+ limit: number;
401
+ };
402
+ getRecord: (id: string) => records.RecordRow;
403
+ createRecord: (databaseId: string, data: Record<string, unknown>) => records.RecordRow;
404
+ updateRecord: (id: string, data: Record<string, unknown>) => records.RecordRow;
405
+ moveRecord: (id: string, targetId: string, where: "before" | "after") => records.RecordRow;
406
+ deleteRecord: (id: string) => {
407
+ ok: boolean;
408
+ };
409
+ listRecordRevisions: (id: string) => history.RecordRevision[];
410
+ recordAtVersion: (id: string, at: string) => history.RecordVersionState;
411
+ recordFieldHistory: (id: string, propId: string) => history.FieldHistoryEntry[];
412
+ revertRecord: (id: string, to: string) => history.RevertRecordResult;
413
+ listPropertyRevisions: (id: string) => history.PropertyRevision[];
414
+ propertyAtVersion: (id: string, at: string) => history.PropertyVersionState;
415
+ revertProperty: (id: string, to: string) => history.RevertPropertyResult;
416
+ listDatabaseActivity: (id: string, limit?: number) => history.DatabaseActivityEntry[];
417
+ listDocuments: (opts?: {
418
+ database_id?: string;
419
+ parent_id?: string;
420
+ } | undefined) => documents.DocumentSummary[];
421
+ getDocument: (id: string) => {
422
+ version: string;
423
+ id: string;
424
+ title: string;
425
+ body: string | null;
426
+ database_id: string | null;
427
+ parent_id: string | null;
428
+ created_hlc: string;
429
+ order_key: string | null;
430
+ };
431
+ createDocument: (input: Parameters<typeof documents.createDocument>[1]) => {
432
+ version: string;
433
+ id: string;
434
+ title: string;
435
+ body: string | null;
436
+ database_id: string | null;
437
+ parent_id: string | null;
438
+ created_hlc: string;
439
+ order_key: string | null;
440
+ };
441
+ updateDocument: (id: string, fields: Parameters<typeof documents.updateDocument>[2], ifMatch?: string) => {
442
+ version: string;
443
+ id: string;
444
+ title: string;
445
+ body: string | null;
446
+ database_id: string | null;
447
+ parent_id: string | null;
448
+ created_hlc: string;
449
+ order_key: string | null;
450
+ };
451
+ editDocumentBlocks: (docId: string, edits: readonly documents.BlockEdit[], opts: {
452
+ ifMatch: string;
453
+ }) => {
454
+ document: documents.DocumentRow;
455
+ version: string;
456
+ inserted: string[];
457
+ };
458
+ moveDocument: (id: string, targetId: string, where: "before" | "after" | "into") => documents.DocumentRow;
459
+ duplicateDocument: (id: string, options?: {
460
+ title?: string;
461
+ parent_id?: string | null;
462
+ }) => {
463
+ version: string;
464
+ id: string;
465
+ title: string;
466
+ body: string | null;
467
+ database_id: string | null;
468
+ parent_id: string | null;
469
+ created_hlc: string;
470
+ order_key: string | null;
471
+ };
472
+ deleteDocument: (id: string) => {
473
+ ok: boolean;
474
+ };
475
+ listDocumentRevisions: (id: string) => history.DocRevision[];
476
+ documentAtVersion: (id: string, at: string) => history.DocumentVersionState;
477
+ revertDocument: (id: string, to: string, ifMatch?: string) => history.RevertDocResult;
478
+ nodes: () => import("../node.ts").NodeInfo[];
479
+ setNodeLabel: (label: string | null, nodeId?: string) => import("../node.ts").NodeInfo;
480
+ search: (text: string, limit?: number) => import("../search.ts").SearchHit[];
481
+ querySearch: (text: string, query?: SearchQuery) => import("../search.ts").SearchPage;
482
+ referenceSummaries: (query: ReferenceSummaryQuery) => ReferenceSummary[];
483
+ resolve: (text: string, limit?: number) => import("../resolve.ts").LookupHit[];
484
+ }[K]>;
485
+ dispatchRpc: (op: string, args: unknown[]) => unknown;
486
+ call: <K extends "nodes" | "search" | "createRecord" | "updateRecord" | "listDatabases" | "queryDocuments" | "createDatabase" | "updateDatabase" | "duplicateDatabase" | "deleteDatabase" | "listProperties" | "addProperty" | "updateProperty" | "moveProperty" | "moveSelectOption" | "setPropertyWidth" | "removeProperty" | "renameSelectOption" | "removeSelectOption" | "listRecords" | "queryRecords" | "getRecord" | "moveRecord" | "deleteRecord" | "listRecordRevisions" | "recordAtVersion" | "recordFieldHistory" | "revertRecord" | "listPropertyRevisions" | "propertyAtVersion" | "revertProperty" | "listDatabaseActivity" | "listDocuments" | "getDocument" | "createDocument" | "updateDocument" | "editDocumentBlocks" | "moveDocument" | "duplicateDocument" | "deleteDocument" | "listDocumentRevisions" | "documentAtVersion" | "revertDocument" | "setNodeLabel" | "querySearch" | "referenceSummaries" | "resolve">(op: K, ...args: Parameters<{
487
+ listDatabases: () => databases.DatabaseRow[];
488
+ queryDocuments: (query?: Parameters<typeof queryDocuments>[1]) => {
489
+ documents: documents.DocumentSummary[];
490
+ total: number;
491
+ hasMore: boolean;
492
+ offset: number;
493
+ limit: number;
494
+ };
495
+ createDatabase: (opts: {
496
+ name: string;
497
+ icon?: string;
498
+ }) => databases.DatabaseRow;
499
+ updateDatabase: (id: string, fields: {
500
+ name?: string;
501
+ icon?: string | null;
502
+ meta?: Record<string, unknown> | null;
503
+ }) => databases.DatabaseRow;
504
+ duplicateDatabase: (id: string, options?: Parameters<typeof databases.duplicateDatabase>[2]) => databases.DatabaseRow;
505
+ deleteDatabase: (id: string) => {
506
+ ok: boolean;
507
+ };
508
+ listProperties: (databaseId: string) => properties.PropertyRow[];
509
+ addProperty: (databaseId: string, opts: {
510
+ name: string;
511
+ type: properties.PropType;
512
+ config?: properties.PropertyConfig;
513
+ position?: number;
514
+ indexed?: boolean;
515
+ }) => properties.PropertyRow;
516
+ updateProperty: (id: string, fields: {
517
+ name?: string;
518
+ type?: properties.PropType;
519
+ config?: properties.PropertyConfig;
520
+ position?: number;
521
+ }) => properties.PropertyRow;
522
+ moveProperty: (id: string, anchorId: string, where: "before" | "after") => properties.PropertyRow;
523
+ moveSelectOption: (id: string, option: string, anchor: string, where: "before" | "after") => properties.PropertyRow;
524
+ setPropertyWidth: (id: string, width: number) => properties.PropertyRow;
525
+ removeProperty: (id: string) => {
526
+ ok: boolean;
527
+ };
528
+ renameSelectOption: (id: string, from: string, to: string) => {
529
+ property: properties.PropertyRow;
530
+ renamed: number;
531
+ };
532
+ removeSelectOption: (id: string, name: string) => {
533
+ property: properties.PropertyRow;
534
+ cleared: number;
535
+ };
536
+ listRecords: (databaseId: string, opts?: {
537
+ filter?: Record<string, unknown>;
538
+ sort?: string;
539
+ limit?: number;
540
+ } | undefined) => records.RecordRow[];
541
+ queryRecords: (id: string, query?: RecordQuery) => {
542
+ records: {
543
+ id: string;
544
+ database_id: string;
545
+ cells: Record<string, unknown>;
546
+ values: Record<string, unknown>;
547
+ }[];
548
+ total: number;
549
+ hasMore: boolean;
550
+ offset: number;
551
+ limit: number;
552
+ };
553
+ getRecord: (id: string) => records.RecordRow;
554
+ createRecord: (databaseId: string, data: Record<string, unknown>) => records.RecordRow;
555
+ updateRecord: (id: string, data: Record<string, unknown>) => records.RecordRow;
556
+ moveRecord: (id: string, targetId: string, where: "before" | "after") => records.RecordRow;
557
+ deleteRecord: (id: string) => {
558
+ ok: boolean;
559
+ };
560
+ listRecordRevisions: (id: string) => history.RecordRevision[];
561
+ recordAtVersion: (id: string, at: string) => history.RecordVersionState;
562
+ recordFieldHistory: (id: string, propId: string) => history.FieldHistoryEntry[];
563
+ revertRecord: (id: string, to: string) => history.RevertRecordResult;
564
+ listPropertyRevisions: (id: string) => history.PropertyRevision[];
565
+ propertyAtVersion: (id: string, at: string) => history.PropertyVersionState;
566
+ revertProperty: (id: string, to: string) => history.RevertPropertyResult;
567
+ listDatabaseActivity: (id: string, limit?: number) => history.DatabaseActivityEntry[];
568
+ listDocuments: (opts?: {
569
+ database_id?: string;
570
+ parent_id?: string;
571
+ } | undefined) => documents.DocumentSummary[];
572
+ getDocument: (id: string) => {
573
+ version: string;
574
+ id: string;
575
+ title: string;
576
+ body: string | null;
577
+ database_id: string | null;
578
+ parent_id: string | null;
579
+ created_hlc: string;
580
+ order_key: string | null;
581
+ };
582
+ createDocument: (input: Parameters<typeof documents.createDocument>[1]) => {
583
+ version: string;
584
+ id: string;
585
+ title: string;
586
+ body: string | null;
587
+ database_id: string | null;
588
+ parent_id: string | null;
589
+ created_hlc: string;
590
+ order_key: string | null;
591
+ };
592
+ updateDocument: (id: string, fields: Parameters<typeof documents.updateDocument>[2], ifMatch?: string) => {
593
+ version: string;
594
+ id: string;
595
+ title: string;
596
+ body: string | null;
597
+ database_id: string | null;
598
+ parent_id: string | null;
599
+ created_hlc: string;
600
+ order_key: string | null;
601
+ };
602
+ editDocumentBlocks: (docId: string, edits: readonly documents.BlockEdit[], opts: {
603
+ ifMatch: string;
604
+ }) => {
605
+ document: documents.DocumentRow;
606
+ version: string;
607
+ inserted: string[];
608
+ };
609
+ moveDocument: (id: string, targetId: string, where: "before" | "after" | "into") => documents.DocumentRow;
610
+ duplicateDocument: (id: string, options?: {
611
+ title?: string;
612
+ parent_id?: string | null;
613
+ }) => {
614
+ version: string;
615
+ id: string;
616
+ title: string;
617
+ body: string | null;
618
+ database_id: string | null;
619
+ parent_id: string | null;
620
+ created_hlc: string;
621
+ order_key: string | null;
622
+ };
623
+ deleteDocument: (id: string) => {
624
+ ok: boolean;
625
+ };
626
+ listDocumentRevisions: (id: string) => history.DocRevision[];
627
+ documentAtVersion: (id: string, at: string) => history.DocumentVersionState;
628
+ revertDocument: (id: string, to: string, ifMatch?: string) => history.RevertDocResult;
629
+ nodes: () => import("../node.ts").NodeInfo[];
630
+ setNodeLabel: (label: string | null, nodeId?: string) => import("../node.ts").NodeInfo;
631
+ search: (text: string, limit?: number) => import("../search.ts").SearchHit[];
632
+ querySearch: (text: string, query?: SearchQuery) => import("../search.ts").SearchPage;
633
+ referenceSummaries: (query: ReferenceSummaryQuery) => ReferenceSummary[];
634
+ resolve: (text: string, limit?: number) => import("../resolve.ts").LookupHit[];
635
+ }[K]>) => Promise<ReturnType<{
636
+ listDatabases: () => databases.DatabaseRow[];
637
+ queryDocuments: (query?: Parameters<typeof queryDocuments>[1]) => {
638
+ documents: documents.DocumentSummary[];
639
+ total: number;
640
+ hasMore: boolean;
641
+ offset: number;
642
+ limit: number;
643
+ };
644
+ createDatabase: (opts: {
645
+ name: string;
646
+ icon?: string;
647
+ }) => databases.DatabaseRow;
648
+ updateDatabase: (id: string, fields: {
649
+ name?: string;
650
+ icon?: string | null;
651
+ meta?: Record<string, unknown> | null;
652
+ }) => databases.DatabaseRow;
653
+ duplicateDatabase: (id: string, options?: Parameters<typeof databases.duplicateDatabase>[2]) => databases.DatabaseRow;
654
+ deleteDatabase: (id: string) => {
655
+ ok: boolean;
656
+ };
657
+ listProperties: (databaseId: string) => properties.PropertyRow[];
658
+ addProperty: (databaseId: string, opts: {
659
+ name: string;
660
+ type: properties.PropType;
661
+ config?: properties.PropertyConfig;
662
+ position?: number;
663
+ indexed?: boolean;
664
+ }) => properties.PropertyRow;
665
+ updateProperty: (id: string, fields: {
666
+ name?: string;
667
+ type?: properties.PropType;
668
+ config?: properties.PropertyConfig;
669
+ position?: number;
670
+ }) => properties.PropertyRow;
671
+ moveProperty: (id: string, anchorId: string, where: "before" | "after") => properties.PropertyRow;
672
+ moveSelectOption: (id: string, option: string, anchor: string, where: "before" | "after") => properties.PropertyRow;
673
+ setPropertyWidth: (id: string, width: number) => properties.PropertyRow;
674
+ removeProperty: (id: string) => {
675
+ ok: boolean;
676
+ };
677
+ renameSelectOption: (id: string, from: string, to: string) => {
678
+ property: properties.PropertyRow;
679
+ renamed: number;
680
+ };
681
+ removeSelectOption: (id: string, name: string) => {
682
+ property: properties.PropertyRow;
683
+ cleared: number;
684
+ };
685
+ listRecords: (databaseId: string, opts?: {
686
+ filter?: Record<string, unknown>;
687
+ sort?: string;
688
+ limit?: number;
689
+ } | undefined) => records.RecordRow[];
690
+ queryRecords: (id: string, query?: RecordQuery) => {
691
+ records: {
692
+ id: string;
693
+ database_id: string;
694
+ cells: Record<string, unknown>;
695
+ values: Record<string, unknown>;
696
+ }[];
697
+ total: number;
698
+ hasMore: boolean;
699
+ offset: number;
700
+ limit: number;
701
+ };
702
+ getRecord: (id: string) => records.RecordRow;
703
+ createRecord: (databaseId: string, data: Record<string, unknown>) => records.RecordRow;
704
+ updateRecord: (id: string, data: Record<string, unknown>) => records.RecordRow;
705
+ moveRecord: (id: string, targetId: string, where: "before" | "after") => records.RecordRow;
706
+ deleteRecord: (id: string) => {
707
+ ok: boolean;
708
+ };
709
+ listRecordRevisions: (id: string) => history.RecordRevision[];
710
+ recordAtVersion: (id: string, at: string) => history.RecordVersionState;
711
+ recordFieldHistory: (id: string, propId: string) => history.FieldHistoryEntry[];
712
+ revertRecord: (id: string, to: string) => history.RevertRecordResult;
713
+ listPropertyRevisions: (id: string) => history.PropertyRevision[];
714
+ propertyAtVersion: (id: string, at: string) => history.PropertyVersionState;
715
+ revertProperty: (id: string, to: string) => history.RevertPropertyResult;
716
+ listDatabaseActivity: (id: string, limit?: number) => history.DatabaseActivityEntry[];
717
+ listDocuments: (opts?: {
718
+ database_id?: string;
719
+ parent_id?: string;
720
+ } | undefined) => documents.DocumentSummary[];
721
+ getDocument: (id: string) => {
722
+ version: string;
723
+ id: string;
724
+ title: string;
725
+ body: string | null;
726
+ database_id: string | null;
727
+ parent_id: string | null;
728
+ created_hlc: string;
729
+ order_key: string | null;
730
+ };
731
+ createDocument: (input: Parameters<typeof documents.createDocument>[1]) => {
732
+ version: string;
733
+ id: string;
734
+ title: string;
735
+ body: string | null;
736
+ database_id: string | null;
737
+ parent_id: string | null;
738
+ created_hlc: string;
739
+ order_key: string | null;
740
+ };
741
+ updateDocument: (id: string, fields: Parameters<typeof documents.updateDocument>[2], ifMatch?: string) => {
742
+ version: string;
743
+ id: string;
744
+ title: string;
745
+ body: string | null;
746
+ database_id: string | null;
747
+ parent_id: string | null;
748
+ created_hlc: string;
749
+ order_key: string | null;
750
+ };
751
+ editDocumentBlocks: (docId: string, edits: readonly documents.BlockEdit[], opts: {
752
+ ifMatch: string;
753
+ }) => {
754
+ document: documents.DocumentRow;
755
+ version: string;
756
+ inserted: string[];
757
+ };
758
+ moveDocument: (id: string, targetId: string, where: "before" | "after" | "into") => documents.DocumentRow;
759
+ duplicateDocument: (id: string, options?: {
760
+ title?: string;
761
+ parent_id?: string | null;
762
+ }) => {
763
+ version: string;
764
+ id: string;
765
+ title: string;
766
+ body: string | null;
767
+ database_id: string | null;
768
+ parent_id: string | null;
769
+ created_hlc: string;
770
+ order_key: string | null;
771
+ };
772
+ deleteDocument: (id: string) => {
773
+ ok: boolean;
774
+ };
775
+ listDocumentRevisions: (id: string) => history.DocRevision[];
776
+ documentAtVersion: (id: string, at: string) => history.DocumentVersionState;
777
+ revertDocument: (id: string, to: string, ifMatch?: string) => history.RevertDocResult;
778
+ nodes: () => import("../node.ts").NodeInfo[];
779
+ setNodeLabel: (label: string | null, nodeId?: string) => import("../node.ts").NodeInfo;
780
+ search: (text: string, limit?: number) => import("../search.ts").SearchHit[];
781
+ querySearch: (text: string, query?: SearchQuery) => import("../search.ts").SearchPage;
782
+ referenceSummaries: (query: ReferenceSummaryQuery) => ReferenceSummary[];
783
+ resolve: (text: string, limit?: number) => import("../resolve.ts").LookupHit[];
784
+ }[K]>>;
785
+ client: {
786
+ listDatabases: () => Promise<databases.DatabaseRow[]>;
787
+ queryDocuments: (query?: Parameters<typeof queryDocuments>[1]) => Promise<{
788
+ documents: documents.DocumentSummary[];
789
+ total: number;
790
+ hasMore: boolean;
791
+ offset: number;
792
+ limit: number;
793
+ }>;
794
+ createDatabase: (opts: {
795
+ name: string;
796
+ icon?: string;
797
+ }) => Promise<databases.DatabaseRow>;
798
+ updateDatabase: (id: string, fields: {
799
+ name?: string;
800
+ icon?: string | null;
801
+ meta?: Record<string, unknown> | null;
802
+ }) => Promise<databases.DatabaseRow>;
803
+ duplicateDatabase: (id: string, options?: {
804
+ name?: string;
805
+ icon?: string;
806
+ } | undefined) => Promise<databases.DatabaseRow>;
807
+ deleteDatabase: (id: string) => Promise<{
808
+ ok: boolean;
809
+ }>;
810
+ listProperties: (id: string) => Promise<properties.PropertyRow[]>;
811
+ createProperty: (input: Parameters<(databaseId: string, opts: {
812
+ name: string;
813
+ type: properties.PropType;
814
+ config?: properties.PropertyConfig;
815
+ position?: number;
816
+ indexed?: boolean;
817
+ }) => properties.PropertyRow>[1] & {
818
+ db: string;
819
+ }) => Promise<properties.PropertyRow>;
820
+ addProperty: (databaseId: string, opts: {
821
+ name: string;
822
+ type: properties.PropType;
823
+ config?: properties.PropertyConfig;
824
+ position?: number;
825
+ indexed?: boolean;
826
+ }) => Promise<properties.PropertyRow>;
827
+ updateProperty: (id: string, fields: {
828
+ name?: string;
829
+ type?: properties.PropType;
830
+ config?: properties.PropertyConfig;
831
+ position?: number;
832
+ }) => Promise<properties.PropertyRow>;
833
+ moveProperty: (id: string, anchorId: string, where: "before" | "after") => Promise<properties.PropertyRow>;
834
+ moveSelectOption: (id: string, option: string, anchor: string, where: "before" | "after") => Promise<properties.PropertyRow>;
835
+ deleteProperty: (id: string) => Promise<{
836
+ ok: boolean;
837
+ }>;
838
+ listRecords: (databaseId: string, opts?: {
839
+ filter?: Record<string, unknown>;
840
+ sort?: string;
841
+ limit?: number;
842
+ } | undefined) => Promise<records.RecordRow[]>;
843
+ queryRecords: (id: string, query?: RecordQuery) => Promise<{
844
+ records: {
845
+ id: string;
846
+ database_id: string;
847
+ cells: Record<string, unknown>;
848
+ values: Record<string, unknown>;
849
+ }[];
850
+ total: number;
851
+ hasMore: boolean;
852
+ offset: number;
853
+ limit: number;
854
+ }>;
855
+ renameSelectOption: (id: string, from: string, to: string) => Promise<{
856
+ property: properties.PropertyRow;
857
+ renamed: number;
858
+ }>;
859
+ getRecord: (id: string) => Promise<records.RecordRow>;
860
+ createRecord: (databaseId: string, data: Record<string, unknown>) => Promise<records.RecordRow>;
861
+ updateRecord: (id: string, data: Record<string, unknown>) => Promise<records.RecordRow>;
862
+ deleteRecord: (id: string) => Promise<{
863
+ ok: boolean;
864
+ }>;
865
+ moveRecord: (id: string, targetId: string, where: "before" | "after") => Promise<records.RecordRow>;
866
+ recordHistory: (id: string) => Promise<history.RecordRevision[]>;
867
+ recordAt: (id: string, version: string) => Promise<history.RecordVersionState>;
868
+ revertRecord: (id: string, version: string) => Promise<history.RevertRecordResult>;
869
+ listDocuments: (databaseId?: string) => Promise<documents.DocumentSummary[]>;
870
+ listDocumentsByParent: (parentId: string) => Promise<documents.DocumentSummary[]>;
871
+ getDocument: (id: string) => Promise<{
872
+ version: string;
873
+ id: string;
874
+ title: string;
875
+ body: string | null;
876
+ database_id: string | null;
877
+ parent_id: string | null;
878
+ created_hlc: string;
879
+ order_key: string | null;
880
+ }>;
881
+ createDocument: (input: {
882
+ title: string;
883
+ body?: string;
884
+ database_id?: string;
885
+ parent_id?: string;
886
+ }) => Promise<{
887
+ version: string;
888
+ id: string;
889
+ title: string;
890
+ body: string | null;
891
+ database_id: string | null;
892
+ parent_id: string | null;
893
+ created_hlc: string;
894
+ order_key: string | null;
895
+ }>;
896
+ updateDocument: (id: string, input: Parameters<(id: string, fields: Parameters<typeof documents.updateDocument>[2], ifMatch?: string) => {
897
+ version: string;
898
+ id: string;
899
+ title: string;
900
+ body: string | null;
901
+ database_id: string | null;
902
+ parent_id: string | null;
903
+ created_hlc: string;
904
+ order_key: string | null;
905
+ }>[1] & {
906
+ if_match?: string;
907
+ }) => Promise<{
908
+ version: string;
909
+ id: string;
910
+ title: string;
911
+ body: string | null;
912
+ database_id: string | null;
913
+ parent_id: string | null;
914
+ created_hlc: string;
915
+ order_key: string | null;
916
+ }>;
917
+ editDocumentBlocks: (docId: string, edits: readonly documents.BlockEdit[], opts: {
918
+ ifMatch: string;
919
+ }) => Promise<{
920
+ document: documents.DocumentRow;
921
+ version: string;
922
+ inserted: string[];
923
+ }>;
924
+ deleteDocument: (id: string) => Promise<{
925
+ ok: boolean;
926
+ }>;
927
+ duplicateDocument: (id: string, options?: {
928
+ title?: string;
929
+ parent_id?: string | null;
930
+ } | undefined) => Promise<{
931
+ version: string;
932
+ id: string;
933
+ title: string;
934
+ body: string | null;
935
+ database_id: string | null;
936
+ parent_id: string | null;
937
+ created_hlc: string;
938
+ order_key: string | null;
939
+ }>;
940
+ moveDocument: (id: string, targetId: string, where: "before" | "after" | "into") => Promise<documents.DocumentRow>;
941
+ documentHistory: (id: string) => Promise<history.DocRevision[]>;
942
+ documentAt: (id: string, version: string) => Promise<history.DocumentVersionState>;
943
+ revertDocument: (id: string, to: string, ifMatch?: string) => Promise<history.RevertDocResult>;
944
+ search: (text: string, limit?: number) => Promise<import("../search.ts").SearchHit[]>;
945
+ querySearch: (text: string, query?: SearchQuery) => Promise<import("../search.ts").SearchPage>;
946
+ referenceSummaries: (query: ReferenceSummaryQuery) => Promise<ReferenceSummary[]>;
947
+ resolve: (text: string, limit?: number) => Promise<import("../resolve.ts").LookupHit[]>;
948
+ onUpdate: (listener: (info: {
949
+ seq?: number;
950
+ gone?: true;
951
+ }) => void) => () => void;
952
+ };
953
+ drafts: {
954
+ readDocument(docId: string): import("./drafts.ts").DocumentDraft | null;
955
+ checkpointDocument(docId: string, draft: import("./drafts.ts").DocumentDraft): void;
956
+ acknowledgeDocument(docId: string, revision: number, _version?: string): void;
957
+ discardDocument(docId: string): void;
958
+ readFields(recordId: string): Record<string, import("./drafts.ts").FieldDraft>;
959
+ checkpointField(recordId: string, propId: string, draft: import("./drafts.ts").FieldDraft): void;
960
+ acknowledgeField(recordId: string, propId: string, expectedValue: unknown): void;
961
+ discardRecord(recordId: string): void;
962
+ };
963
+ pauseMutations(value: boolean): void;
964
+ notifyChanges: (change: ReplicaChange) => void;
965
+ onChange(listener: (change: ReplicaChange) => void): () => void;
966
+ dispose(): void;
967
+ };
968
+ export type ReplicaService = ReturnType<typeof createReplicaService>;
969
+ export type ReplicaClient = ReplicaService["client"];
970
+ //# sourceMappingURL=service.d.ts.map