@eidos.space/eidos-file 0.1.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DEVELOPER_PLATFORM.md +55 -53
- package/FIELD-CONVERSION.md +75 -0
- package/README.md +89 -106
- package/dist/adapter-contract-BRKKEulb.d.mts +1110 -0
- package/dist/adapter-contract-BRKKEulb.d.mts.map +1 -0
- package/dist/better-sqlite3.d.mts +64 -3
- package/dist/better-sqlite3.d.mts.map +1 -1
- package/dist/better-sqlite3.mjs +395 -14
- package/dist/better-sqlite3.mjs.map +1 -1
- package/dist/browser.d.mts +4 -3
- package/dist/browser.d.mts.map +1 -1
- package/dist/browser.mjs +30 -11
- package/dist/browser.mjs.map +1 -1
- package/dist/csv-BQPkzC5Y.mjs +386 -0
- package/dist/csv-BQPkzC5Y.mjs.map +1 -0
- package/dist/csv.d.mts +4 -2
- package/dist/csv.d.mts.map +1 -1
- package/dist/csv.mjs +1 -248
- package/dist/index.d.mts +327 -18
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3555 -4
- package/dist/index.mjs.map +1 -0
- package/dist/node-sqlite.d.mts +98 -0
- package/dist/node-sqlite.d.mts.map +1 -0
- package/dist/node-sqlite.mjs +684 -0
- package/dist/node-sqlite.mjs.map +1 -0
- package/dist/runtime-9_adwQ0y.mjs +5637 -0
- package/dist/runtime-9_adwQ0y.mjs.map +1 -0
- package/dist/runtime-C9IcEeTi.d.mts +728 -0
- package/dist/runtime-C9IcEeTi.d.mts.map +1 -0
- package/dist/select-options-CfNwfc_a.mjs +561 -0
- package/dist/select-options-CfNwfc_a.mjs.map +1 -0
- package/dist/sqlite-wasm-BM6hsxH8.mjs +2007 -0
- package/dist/sqlite-wasm-BM6hsxH8.mjs.map +1 -0
- package/dist/temporal-fyRCzJjy.d.mts +517 -0
- package/dist/temporal-fyRCzJjy.d.mts.map +1 -0
- package/package.json +11 -4
- package/dist/csv.mjs.map +0 -1
- package/dist/host-CqP1MeMK.d.mts +0 -213
- package/dist/host-CqP1MeMK.d.mts.map +0 -1
- package/dist/host-D5kZAhga.mjs +0 -478
- package/dist/host-D5kZAhga.mjs.map +0 -1
- package/dist/relation-values-B0JhHBjZ.mjs +0 -232
- package/dist/relation-values-B0JhHBjZ.mjs.map +0 -1
- package/dist/runtime-C3bstvB8.d.mts +0 -465
- package/dist/runtime-C3bstvB8.d.mts.map +0 -1
- package/dist/runtime-CWC5y95G.mjs +0 -2907
- package/dist/runtime-CWC5y95G.mjs.map +0 -1
|
@@ -0,0 +1,1110 @@
|
|
|
1
|
+
import { At as JsonObject, Et as CancellationPort, Ft as RequestContext, Nt as OwnedBytes, Ot as ClockPort, Tt as ByteSource, jt as JsonValue, kt as EntropyPort } from "./runtime-C9IcEeTi.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/runtime-contract.d.ts
|
|
4
|
+
interface FileEntry extends JsonObject {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
mediaType: string;
|
|
8
|
+
size: string;
|
|
9
|
+
uri: string;
|
|
10
|
+
}
|
|
11
|
+
type Revision = string;
|
|
12
|
+
type ScalarType = "text" | "number" | "integer" | "checkbox" | "date" | "datetime" | "url" | "json" | "select" | "multi-select" | "file" | "relation";
|
|
13
|
+
type AtomicType = "text" | "number" | "integer" | "checkbox" | "date" | "datetime" | "url" | "select" | "row-id" | "file-entry";
|
|
14
|
+
type TypeRef = ScalarType | "row-id" | "file-entry" | {
|
|
15
|
+
kind: "list";
|
|
16
|
+
element: AtomicType;
|
|
17
|
+
};
|
|
18
|
+
type LogicalValue = null | boolean | number | string | FileEntry | LogicalValue[];
|
|
19
|
+
interface RuntimeEnvironment {
|
|
20
|
+
clock: ClockPort;
|
|
21
|
+
entropy: EntropyPort;
|
|
22
|
+
transportCommitBarrier?: TransportCommitBarrier;
|
|
23
|
+
}
|
|
24
|
+
interface RuntimeFactoryContext {
|
|
25
|
+
cancellation: CancellationPort;
|
|
26
|
+
deadlineMilliseconds?: number;
|
|
27
|
+
}
|
|
28
|
+
interface RuntimeCreateInput {
|
|
29
|
+
title: string;
|
|
30
|
+
fileId?: string;
|
|
31
|
+
createdAt?: string;
|
|
32
|
+
}
|
|
33
|
+
interface RuntimeBinding {
|
|
34
|
+
service: RuntimeService;
|
|
35
|
+
hostBridge: RuntimeHostBridge;
|
|
36
|
+
}
|
|
37
|
+
interface RuntimeHostBridge {
|
|
38
|
+
allocateFileEntry(request: {
|
|
39
|
+
name: string;
|
|
40
|
+
mediaType: string;
|
|
41
|
+
size: string;
|
|
42
|
+
uri: string;
|
|
43
|
+
extensions?: Record<string, JsonValue>;
|
|
44
|
+
}, context: RequestContext): Promise<FileEntry>;
|
|
45
|
+
createPublicationSnapshot(request: {
|
|
46
|
+
maxBytes: string;
|
|
47
|
+
}, context: RequestContext): Promise<RuntimePublicationSnapshot>;
|
|
48
|
+
}
|
|
49
|
+
interface RuntimePublicationSnapshot {
|
|
50
|
+
fileId: string;
|
|
51
|
+
revision: string;
|
|
52
|
+
bytes: ByteSource;
|
|
53
|
+
release(): Promise<void>;
|
|
54
|
+
}
|
|
55
|
+
interface RuntimeCapabilities {
|
|
56
|
+
readRows: boolean;
|
|
57
|
+
schemaPaging: boolean;
|
|
58
|
+
cursorPaging: boolean;
|
|
59
|
+
aggregate: boolean;
|
|
60
|
+
groupRows: boolean;
|
|
61
|
+
formulaPreview: boolean;
|
|
62
|
+
mutateRows: boolean;
|
|
63
|
+
mutationUndo: boolean;
|
|
64
|
+
mutateView: boolean;
|
|
65
|
+
schemaPreflight: boolean;
|
|
66
|
+
mutateSchema: boolean;
|
|
67
|
+
validate: boolean;
|
|
68
|
+
events: boolean;
|
|
69
|
+
csvExport: boolean;
|
|
70
|
+
csvImport: boolean;
|
|
71
|
+
}
|
|
72
|
+
interface RuntimeLimits {
|
|
73
|
+
requestBytesMax: number;
|
|
74
|
+
responseBytesMax: number;
|
|
75
|
+
schemaPageSizeMax: number;
|
|
76
|
+
pageSizeMax: number;
|
|
77
|
+
projectionFieldsMax: number;
|
|
78
|
+
rowsByIdMax: number;
|
|
79
|
+
mutationRowsMax: number;
|
|
80
|
+
mutationCellsMax: number;
|
|
81
|
+
mutationBytesMax: number;
|
|
82
|
+
aggregateItemsMax: number;
|
|
83
|
+
groupPageSizeMax: number;
|
|
84
|
+
formulaPreviewRowsMax: number;
|
|
85
|
+
filterDepthMax: number;
|
|
86
|
+
filterNodesMax: number;
|
|
87
|
+
sortFieldsMax: number;
|
|
88
|
+
groupFieldsMax: number;
|
|
89
|
+
searchBytesMax: number;
|
|
90
|
+
listElementsMax: number;
|
|
91
|
+
logicalValueBytesMax: number;
|
|
92
|
+
formulaBytesMax: number;
|
|
93
|
+
formulaNodesMax: number;
|
|
94
|
+
formulaDepthMax: number;
|
|
95
|
+
diagnosticsMax: number;
|
|
96
|
+
foregroundTimeMsMax: number;
|
|
97
|
+
csvBytesMax: number;
|
|
98
|
+
schemaPlanEntriesMax: number;
|
|
99
|
+
schemaPlanBytesMax: number;
|
|
100
|
+
undoEntriesMax: number;
|
|
101
|
+
undoBytesMax: number;
|
|
102
|
+
}
|
|
103
|
+
type RuntimeErrorCode = "invalid-request" | "unsupported" | "not-found" | "already-exists" | "invalid-value" | "invalid-query" | "invalid-formula" | "cycle" | "constraint" | "stale-revision" | "conflict" | "forbidden" | "lossy-confirmation-required" | "invalid-plan" | "plan-expired" | "resource-limit" | "cancelled" | "deadline-exceeded" | "busy" | "corrupt-file" | "adapter-error" | "unknown-commit" | "closed" | "fatal";
|
|
104
|
+
interface RuntimeError {
|
|
105
|
+
code: RuntimeErrorCode;
|
|
106
|
+
message: string;
|
|
107
|
+
retryable: boolean;
|
|
108
|
+
path?: string;
|
|
109
|
+
fileId?: string;
|
|
110
|
+
tableId?: string;
|
|
111
|
+
fieldId?: string;
|
|
112
|
+
rowId?: string;
|
|
113
|
+
currentRevision?: string;
|
|
114
|
+
details?: JsonObject;
|
|
115
|
+
}
|
|
116
|
+
interface RuntimeSnapshot {
|
|
117
|
+
fileId: string;
|
|
118
|
+
format: {
|
|
119
|
+
major: 1;
|
|
120
|
+
minor: 0;
|
|
121
|
+
};
|
|
122
|
+
revision: string;
|
|
123
|
+
title: string;
|
|
124
|
+
defaultTableId: string | null;
|
|
125
|
+
schemaCounts: {
|
|
126
|
+
tables: string;
|
|
127
|
+
fields: string;
|
|
128
|
+
views: string;
|
|
129
|
+
features: string;
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
interface TableDescriptor {
|
|
133
|
+
object: "table";
|
|
134
|
+
id: string;
|
|
135
|
+
name: string;
|
|
136
|
+
labelFieldId: string;
|
|
137
|
+
position: string;
|
|
138
|
+
settings: JsonObject;
|
|
139
|
+
}
|
|
140
|
+
interface FieldDescriptor {
|
|
141
|
+
object: "field";
|
|
142
|
+
id: string;
|
|
143
|
+
tableId: string;
|
|
144
|
+
name: string;
|
|
145
|
+
kind: ScalarType | "formula" | "lookup";
|
|
146
|
+
valueType: TypeRef;
|
|
147
|
+
systemRole: "row-id" | "created-time" | "updated-time" | null;
|
|
148
|
+
nullable: boolean;
|
|
149
|
+
position: string;
|
|
150
|
+
settings: JsonObject;
|
|
151
|
+
writable: boolean;
|
|
152
|
+
definition?: RelationDefinition | FormulaDefinition | LookupDefinition;
|
|
153
|
+
}
|
|
154
|
+
interface ViewDescriptor {
|
|
155
|
+
object: "view";
|
|
156
|
+
id: string;
|
|
157
|
+
tableId: string;
|
|
158
|
+
name: string;
|
|
159
|
+
type: string;
|
|
160
|
+
query: SavedViewQuery;
|
|
161
|
+
layout: JsonObject;
|
|
162
|
+
position: string;
|
|
163
|
+
}
|
|
164
|
+
interface FeatureDescriptor {
|
|
165
|
+
object: "feature";
|
|
166
|
+
name: string;
|
|
167
|
+
version: string;
|
|
168
|
+
required: boolean;
|
|
169
|
+
config: JsonObject;
|
|
170
|
+
}
|
|
171
|
+
type SchemaDescriptor = TableDescriptor | FieldDescriptor | ViewDescriptor | FeatureDescriptor;
|
|
172
|
+
interface GetSchemaPageRequest {
|
|
173
|
+
revision: string;
|
|
174
|
+
limit: number;
|
|
175
|
+
cursor?: string;
|
|
176
|
+
}
|
|
177
|
+
interface SchemaPage {
|
|
178
|
+
fileId: string;
|
|
179
|
+
revision: string;
|
|
180
|
+
objects: SchemaDescriptor[];
|
|
181
|
+
nextCursor: string | null;
|
|
182
|
+
}
|
|
183
|
+
interface ProjectionSpec {
|
|
184
|
+
fields: string[];
|
|
185
|
+
resolveRelations: string[];
|
|
186
|
+
}
|
|
187
|
+
interface ColumnDescriptor {
|
|
188
|
+
fieldId: string;
|
|
189
|
+
name: string;
|
|
190
|
+
valueType: TypeRef;
|
|
191
|
+
source: "stored" | "formula" | "lookup" | "inverse-relation";
|
|
192
|
+
writable: boolean;
|
|
193
|
+
}
|
|
194
|
+
interface ProjectedRow {
|
|
195
|
+
id: string;
|
|
196
|
+
values: LogicalValue[];
|
|
197
|
+
resolvedRelations?: Array<{
|
|
198
|
+
column: number;
|
|
199
|
+
items: ResolvedRelationItem[];
|
|
200
|
+
}>;
|
|
201
|
+
}
|
|
202
|
+
type ResolvedRelationItem = {
|
|
203
|
+
id: string;
|
|
204
|
+
state: "unresolved";
|
|
205
|
+
} | {
|
|
206
|
+
id: string;
|
|
207
|
+
state: "resolved";
|
|
208
|
+
labelFieldId: string;
|
|
209
|
+
labelType: TypeRef;
|
|
210
|
+
label: LogicalValue;
|
|
211
|
+
};
|
|
212
|
+
interface RowPage {
|
|
213
|
+
fileId: string;
|
|
214
|
+
tableId: string;
|
|
215
|
+
revision: string;
|
|
216
|
+
projectionHash: string;
|
|
217
|
+
columns: ColumnDescriptor[];
|
|
218
|
+
rows: ProjectedRow[];
|
|
219
|
+
nextCursor: string | null;
|
|
220
|
+
previousCursor: string | null;
|
|
221
|
+
}
|
|
222
|
+
interface RowBatch {
|
|
223
|
+
fileId: string;
|
|
224
|
+
tableId: string;
|
|
225
|
+
revision: string;
|
|
226
|
+
projectionHash: string;
|
|
227
|
+
columns: ColumnDescriptor[];
|
|
228
|
+
rows: ProjectedRow[];
|
|
229
|
+
missingRowIds: string[];
|
|
230
|
+
}
|
|
231
|
+
interface RowQuery {
|
|
232
|
+
filter?: FilterNode;
|
|
233
|
+
search?: {
|
|
234
|
+
text: string;
|
|
235
|
+
fields: string[];
|
|
236
|
+
};
|
|
237
|
+
sort?: Array<{
|
|
238
|
+
fieldId: string;
|
|
239
|
+
direction: "asc" | "desc";
|
|
240
|
+
nulls?: "first" | "last";
|
|
241
|
+
}>;
|
|
242
|
+
}
|
|
243
|
+
type FilterOperand = Exclude<LogicalValue, null>;
|
|
244
|
+
type FilterNode = {
|
|
245
|
+
op: "and" | "or";
|
|
246
|
+
args: FilterNode[];
|
|
247
|
+
} | {
|
|
248
|
+
op: "not";
|
|
249
|
+
arg: FilterNode;
|
|
250
|
+
} | {
|
|
251
|
+
op: "is-null" | "is-not-null";
|
|
252
|
+
fieldId: string;
|
|
253
|
+
} | {
|
|
254
|
+
op: "eq" | "ne" | "lt" | "lte" | "gt" | "gte";
|
|
255
|
+
fieldId: string;
|
|
256
|
+
value: FilterOperand;
|
|
257
|
+
} | {
|
|
258
|
+
op: "between";
|
|
259
|
+
fieldId: string;
|
|
260
|
+
lower: FilterOperand;
|
|
261
|
+
upper: FilterOperand;
|
|
262
|
+
} | {
|
|
263
|
+
op: "in";
|
|
264
|
+
fieldId: string;
|
|
265
|
+
values: FilterOperand[];
|
|
266
|
+
} | {
|
|
267
|
+
op: "contains" | "starts-with" | "ends-with";
|
|
268
|
+
fieldId: string;
|
|
269
|
+
value: string;
|
|
270
|
+
} | {
|
|
271
|
+
op: "has-any" | "has-all";
|
|
272
|
+
fieldId: string;
|
|
273
|
+
values: FilterOperand[];
|
|
274
|
+
} | {
|
|
275
|
+
op: "relation-has";
|
|
276
|
+
fieldId: string;
|
|
277
|
+
rowId: string;
|
|
278
|
+
};
|
|
279
|
+
interface QueryRowsRequest {
|
|
280
|
+
tableId: string;
|
|
281
|
+
query: RowQuery;
|
|
282
|
+
projection: ProjectionSpec;
|
|
283
|
+
limit: number;
|
|
284
|
+
offset?: number;
|
|
285
|
+
cursor?: string;
|
|
286
|
+
direction?: "forward" | "backward";
|
|
287
|
+
}
|
|
288
|
+
interface AggregateRequest {
|
|
289
|
+
tableId: string;
|
|
290
|
+
query?: RowQuery;
|
|
291
|
+
items: AggregateItem[];
|
|
292
|
+
}
|
|
293
|
+
type AggregateItem = {
|
|
294
|
+
key: string;
|
|
295
|
+
op: "count-all";
|
|
296
|
+
} | {
|
|
297
|
+
key: string;
|
|
298
|
+
op: "distinct-values";
|
|
299
|
+
fieldId: string;
|
|
300
|
+
limit: number;
|
|
301
|
+
} | {
|
|
302
|
+
key: string;
|
|
303
|
+
op: "count" | "distinct-count" | "sum" | "average" | "min" | "max";
|
|
304
|
+
fieldId: string;
|
|
305
|
+
} | {
|
|
306
|
+
key: string;
|
|
307
|
+
op: "statistics";
|
|
308
|
+
fieldId: string;
|
|
309
|
+
};
|
|
310
|
+
type AggregateResult = {
|
|
311
|
+
key: string;
|
|
312
|
+
value: LogicalValue;
|
|
313
|
+
} | {
|
|
314
|
+
key: string;
|
|
315
|
+
values: LogicalValue[];
|
|
316
|
+
truncated: boolean;
|
|
317
|
+
} | {
|
|
318
|
+
key: string;
|
|
319
|
+
statistics: ColumnStatistics;
|
|
320
|
+
};
|
|
321
|
+
interface AggregateResponse {
|
|
322
|
+
fileId: string;
|
|
323
|
+
tableId: string;
|
|
324
|
+
revision: string;
|
|
325
|
+
results: AggregateResult[];
|
|
326
|
+
}
|
|
327
|
+
interface ColumnStatistics {
|
|
328
|
+
rows: string;
|
|
329
|
+
nulls: string;
|
|
330
|
+
distinct: string;
|
|
331
|
+
min?: LogicalValue;
|
|
332
|
+
max?: LogicalValue;
|
|
333
|
+
sum?: LogicalValue;
|
|
334
|
+
average?: number | null;
|
|
335
|
+
}
|
|
336
|
+
interface GroupRequest {
|
|
337
|
+
tableId: string;
|
|
338
|
+
query: RowQuery;
|
|
339
|
+
groupBy: string[];
|
|
340
|
+
aggregates: AggregateItem[];
|
|
341
|
+
projection: ProjectionSpec;
|
|
342
|
+
groupLimit: number;
|
|
343
|
+
rowsPerGroup: number;
|
|
344
|
+
cursor?: string;
|
|
345
|
+
direction?: "forward" | "backward";
|
|
346
|
+
}
|
|
347
|
+
interface GroupPage {
|
|
348
|
+
fileId: string;
|
|
349
|
+
tableId: string;
|
|
350
|
+
revision: string;
|
|
351
|
+
projectionHash: string;
|
|
352
|
+
columns: ColumnDescriptor[];
|
|
353
|
+
groups: Array<{
|
|
354
|
+
key: LogicalValue[];
|
|
355
|
+
count: string;
|
|
356
|
+
aggregates: AggregateResult[];
|
|
357
|
+
rows: ProjectedRow[];
|
|
358
|
+
nextRowCursor: string | null;
|
|
359
|
+
}>;
|
|
360
|
+
nextCursor: string | null;
|
|
361
|
+
previousCursor: string | null;
|
|
362
|
+
}
|
|
363
|
+
interface GroupRowsRequest {
|
|
364
|
+
cursor: string;
|
|
365
|
+
limit: number;
|
|
366
|
+
direction?: "forward" | "backward";
|
|
367
|
+
}
|
|
368
|
+
interface GroupRowPage {
|
|
369
|
+
fileId: string;
|
|
370
|
+
tableId: string;
|
|
371
|
+
revision: string;
|
|
372
|
+
projectionHash: string;
|
|
373
|
+
columns: ColumnDescriptor[];
|
|
374
|
+
groupKey: LogicalValue[];
|
|
375
|
+
rows: ProjectedRow[];
|
|
376
|
+
nextCursor: string | null;
|
|
377
|
+
previousCursor: string | null;
|
|
378
|
+
}
|
|
379
|
+
interface ForwardRelationDefinition {
|
|
380
|
+
direction: "forward";
|
|
381
|
+
targetTableId: string;
|
|
382
|
+
cardinality: "one" | "many";
|
|
383
|
+
onDelete: "restrict" | "detach" | "preserve";
|
|
384
|
+
}
|
|
385
|
+
interface InverseRelationDefinition {
|
|
386
|
+
direction: "inverse";
|
|
387
|
+
targetTableId: string;
|
|
388
|
+
cardinality: "many";
|
|
389
|
+
inverseOfFieldId: string;
|
|
390
|
+
}
|
|
391
|
+
type RelationDefinition = ForwardRelationDefinition | InverseRelationDefinition;
|
|
392
|
+
type FormulaResultType = "text" | "number" | "integer" | "checkbox" | "date" | "datetime" | "url";
|
|
393
|
+
interface FormulaDefinition {
|
|
394
|
+
sourceText: string;
|
|
395
|
+
resultType: FormulaResultType;
|
|
396
|
+
}
|
|
397
|
+
interface FormulaPreviewRequest {
|
|
398
|
+
tableId: string;
|
|
399
|
+
fieldId?: string;
|
|
400
|
+
candidateName?: string;
|
|
401
|
+
sourceText: string;
|
|
402
|
+
declaredResultType: FormulaResultType;
|
|
403
|
+
rowIds?: string[];
|
|
404
|
+
}
|
|
405
|
+
interface FormulaPreviewResult {
|
|
406
|
+
fileId: string;
|
|
407
|
+
revision: string;
|
|
408
|
+
valid: boolean;
|
|
409
|
+
inferredType?: FormulaResultType;
|
|
410
|
+
dependencies?: string[];
|
|
411
|
+
rows?: Array<{
|
|
412
|
+
rowId: string;
|
|
413
|
+
value?: LogicalValue;
|
|
414
|
+
error?: RuntimeError;
|
|
415
|
+
}>;
|
|
416
|
+
diagnostics: RuntimeDiagnostic[];
|
|
417
|
+
diagnosticsTruncated: boolean;
|
|
418
|
+
}
|
|
419
|
+
interface LookupDefinition {
|
|
420
|
+
relationFieldId: string;
|
|
421
|
+
targetFieldId: string;
|
|
422
|
+
aggregate: "values" | "first" | "count" | "sum" | "average" | "min" | "max";
|
|
423
|
+
distinctValues: boolean;
|
|
424
|
+
}
|
|
425
|
+
interface RowMutation {
|
|
426
|
+
tableId: string;
|
|
427
|
+
expectedRevision: string;
|
|
428
|
+
returning?: ProjectionSpec;
|
|
429
|
+
changes: RowChange[];
|
|
430
|
+
}
|
|
431
|
+
type RowChange = {
|
|
432
|
+
kind: "create";
|
|
433
|
+
clientKey: string;
|
|
434
|
+
values: Record<string, LogicalValue>;
|
|
435
|
+
} | {
|
|
436
|
+
kind: "update";
|
|
437
|
+
rowId: string;
|
|
438
|
+
values: Record<string, LogicalValue>;
|
|
439
|
+
} | {
|
|
440
|
+
kind: "delete";
|
|
441
|
+
rowId: string;
|
|
442
|
+
};
|
|
443
|
+
interface MutationResult {
|
|
444
|
+
fileId: string;
|
|
445
|
+
revision: string;
|
|
446
|
+
changed: boolean;
|
|
447
|
+
created: Array<{
|
|
448
|
+
clientKey: string;
|
|
449
|
+
rowId: string;
|
|
450
|
+
}>;
|
|
451
|
+
affectedRows: Array<{
|
|
452
|
+
tableId: string;
|
|
453
|
+
rowId: string;
|
|
454
|
+
}>;
|
|
455
|
+
returnedRows?: RowBatch;
|
|
456
|
+
undoToken?: string;
|
|
457
|
+
evictedUndoTokens?: string[];
|
|
458
|
+
}
|
|
459
|
+
type CreatedSchemaObject = {
|
|
460
|
+
id: string;
|
|
461
|
+
object: "table";
|
|
462
|
+
clientKey: string;
|
|
463
|
+
} | {
|
|
464
|
+
id: string;
|
|
465
|
+
object: "field";
|
|
466
|
+
clientKey: string;
|
|
467
|
+
} | {
|
|
468
|
+
id: string;
|
|
469
|
+
object: "field";
|
|
470
|
+
systemRole: "row-id" | "created-time" | "updated-time";
|
|
471
|
+
};
|
|
472
|
+
type CommitReconciliation = {
|
|
473
|
+
operation: "mutateRows" | "revertMutation";
|
|
474
|
+
result: {
|
|
475
|
+
fileId: string;
|
|
476
|
+
revision: string;
|
|
477
|
+
changed: true;
|
|
478
|
+
created: Array<{
|
|
479
|
+
clientKey: string;
|
|
480
|
+
rowId: string;
|
|
481
|
+
}>;
|
|
482
|
+
affectedRows: Array<{
|
|
483
|
+
tableId: string;
|
|
484
|
+
rowId: string;
|
|
485
|
+
}>;
|
|
486
|
+
};
|
|
487
|
+
} | {
|
|
488
|
+
operation: "mutateView";
|
|
489
|
+
result: {
|
|
490
|
+
fileId: string;
|
|
491
|
+
revision: string;
|
|
492
|
+
changed: true;
|
|
493
|
+
createdViews: Array<{
|
|
494
|
+
clientKey: string;
|
|
495
|
+
viewId: string;
|
|
496
|
+
}>;
|
|
497
|
+
affectedViewIds: string[];
|
|
498
|
+
};
|
|
499
|
+
} | {
|
|
500
|
+
operation: "mutateSchema";
|
|
501
|
+
result: {
|
|
502
|
+
fileId: string;
|
|
503
|
+
revision: string;
|
|
504
|
+
changed: true;
|
|
505
|
+
createdObjects: CreatedSchemaObject[];
|
|
506
|
+
affectedTableIds: string[];
|
|
507
|
+
affectedFieldIds: string[];
|
|
508
|
+
};
|
|
509
|
+
} | {
|
|
510
|
+
operation: "importCsv";
|
|
511
|
+
result: {
|
|
512
|
+
fileId: string;
|
|
513
|
+
tableId: string;
|
|
514
|
+
revision: string;
|
|
515
|
+
changed: true;
|
|
516
|
+
createdRows: Array<{
|
|
517
|
+
recordIndex: number;
|
|
518
|
+
rowId: string;
|
|
519
|
+
}>;
|
|
520
|
+
};
|
|
521
|
+
};
|
|
522
|
+
interface TransportCommitBarrier {
|
|
523
|
+
prepare(preparation: {
|
|
524
|
+
fileID: string;
|
|
525
|
+
baseRevision: string;
|
|
526
|
+
commitRevision: string;
|
|
527
|
+
reconciliation: CommitReconciliation;
|
|
528
|
+
}, context: RequestContext): Promise<void>;
|
|
529
|
+
}
|
|
530
|
+
type ViewChange = {
|
|
531
|
+
kind: "create-view";
|
|
532
|
+
clientKey: string;
|
|
533
|
+
tableId: string;
|
|
534
|
+
name: string;
|
|
535
|
+
type: string;
|
|
536
|
+
query: SavedViewQuery;
|
|
537
|
+
layout: JsonObject;
|
|
538
|
+
position: string;
|
|
539
|
+
} | {
|
|
540
|
+
kind: "update-view";
|
|
541
|
+
viewId: string;
|
|
542
|
+
patch: {
|
|
543
|
+
name?: string;
|
|
544
|
+
type?: string;
|
|
545
|
+
query?: SavedViewQuery;
|
|
546
|
+
layout?: JsonObject;
|
|
547
|
+
position?: string;
|
|
548
|
+
};
|
|
549
|
+
} | {
|
|
550
|
+
kind: "delete-view";
|
|
551
|
+
viewId: string;
|
|
552
|
+
};
|
|
553
|
+
interface ViewMutationRequest {
|
|
554
|
+
expectedRevision: string;
|
|
555
|
+
changes: ViewChange[];
|
|
556
|
+
}
|
|
557
|
+
interface ViewMutationResult {
|
|
558
|
+
fileId: string;
|
|
559
|
+
revision: string;
|
|
560
|
+
changed: boolean;
|
|
561
|
+
createdViews: Array<{
|
|
562
|
+
clientKey: string;
|
|
563
|
+
viewId: string;
|
|
564
|
+
}>;
|
|
565
|
+
affectedViewIds: string[];
|
|
566
|
+
}
|
|
567
|
+
type SchemaChange = SchemaLeafChange | {
|
|
568
|
+
kind: "batch";
|
|
569
|
+
changes: SchemaLeafChange[];
|
|
570
|
+
};
|
|
571
|
+
type SchemaLeafChange = {
|
|
572
|
+
kind: "create-table";
|
|
573
|
+
clientKey: string;
|
|
574
|
+
name: string;
|
|
575
|
+
position: string;
|
|
576
|
+
settings?: JsonObject;
|
|
577
|
+
fields: NewField[];
|
|
578
|
+
labelFieldClientKey?: string;
|
|
579
|
+
} | {
|
|
580
|
+
kind: "set-file-title";
|
|
581
|
+
title: string;
|
|
582
|
+
} | {
|
|
583
|
+
kind: "set-default-table";
|
|
584
|
+
tableId: string | null;
|
|
585
|
+
} | {
|
|
586
|
+
kind: "delete-table";
|
|
587
|
+
tableId: string;
|
|
588
|
+
} | {
|
|
589
|
+
kind: "rename-table";
|
|
590
|
+
tableId: string;
|
|
591
|
+
name: string;
|
|
592
|
+
} | {
|
|
593
|
+
kind: "set-table-settings";
|
|
594
|
+
tableId: string;
|
|
595
|
+
settings: JsonObject;
|
|
596
|
+
} | {
|
|
597
|
+
kind: "set-table-position";
|
|
598
|
+
tableId: string;
|
|
599
|
+
position: string;
|
|
600
|
+
} | {
|
|
601
|
+
kind: "create-field";
|
|
602
|
+
tableId: string;
|
|
603
|
+
field: NewField;
|
|
604
|
+
} | {
|
|
605
|
+
kind: "delete-field";
|
|
606
|
+
fieldId: string;
|
|
607
|
+
replacementLabelFieldId?: string;
|
|
608
|
+
} | {
|
|
609
|
+
kind: "rename-field";
|
|
610
|
+
fieldId: string;
|
|
611
|
+
name: string;
|
|
612
|
+
} | {
|
|
613
|
+
kind: "set-field-nullable";
|
|
614
|
+
fieldId: string;
|
|
615
|
+
nullable: boolean;
|
|
616
|
+
} | {
|
|
617
|
+
kind: "set-field-settings";
|
|
618
|
+
fieldId: string;
|
|
619
|
+
settings: JsonObject;
|
|
620
|
+
} | {
|
|
621
|
+
kind: "set-field-position";
|
|
622
|
+
fieldId: string;
|
|
623
|
+
position: string;
|
|
624
|
+
} | {
|
|
625
|
+
kind: "set-record-label";
|
|
626
|
+
tableId: string;
|
|
627
|
+
fieldId: string;
|
|
628
|
+
} | {
|
|
629
|
+
kind: "set-formula";
|
|
630
|
+
fieldId: string;
|
|
631
|
+
definition: FormulaDefinition;
|
|
632
|
+
} | {
|
|
633
|
+
kind: "set-lookup";
|
|
634
|
+
fieldId: string;
|
|
635
|
+
definition: LookupDefinition;
|
|
636
|
+
} | {
|
|
637
|
+
kind: "set-relation";
|
|
638
|
+
fieldId: string;
|
|
639
|
+
definition: RelationDefinition;
|
|
640
|
+
} | ConvertFieldChange | {
|
|
641
|
+
kind: "rename-option";
|
|
642
|
+
fieldId: string;
|
|
643
|
+
from: string;
|
|
644
|
+
to: string;
|
|
645
|
+
collision: "reject" | "merge";
|
|
646
|
+
};
|
|
647
|
+
type StoredFieldType = "text" | "number" | "integer" | "checkbox" | "date" | "datetime" | "url" | "select" | "multi-select" | "file" | "relation";
|
|
648
|
+
interface NewField {
|
|
649
|
+
clientKey: string;
|
|
650
|
+
name: string;
|
|
651
|
+
kind: StoredFieldType | "formula" | "lookup";
|
|
652
|
+
position: string;
|
|
653
|
+
nullable?: boolean;
|
|
654
|
+
settings?: JsonObject;
|
|
655
|
+
definition?: RelationDefinition | FormulaDefinition | LookupDefinition;
|
|
656
|
+
}
|
|
657
|
+
type ConversionPolicy = "round-binary64" | "truncate-toward-zero" | "round-ties-even" | "zero-false-nonzero-true" | "utc-date" | "first" | "null-to-empty-list";
|
|
658
|
+
type ScalarStoredFieldType = "text" | "number" | "integer" | "checkbox" | "date" | "datetime" | "url" | "select";
|
|
659
|
+
type ConvertFieldChange = {
|
|
660
|
+
kind: "convert-field";
|
|
661
|
+
fieldId: string;
|
|
662
|
+
to: ScalarStoredFieldType;
|
|
663
|
+
toNullable: boolean;
|
|
664
|
+
policies?: ConversionPolicy[];
|
|
665
|
+
} | {
|
|
666
|
+
kind: "convert-field";
|
|
667
|
+
fieldId: string;
|
|
668
|
+
to: "multi-select" | "file";
|
|
669
|
+
policies?: ConversionPolicy[];
|
|
670
|
+
} | {
|
|
671
|
+
kind: "convert-field";
|
|
672
|
+
fieldId: string;
|
|
673
|
+
to: "relation";
|
|
674
|
+
definition: ForwardRelationDefinition;
|
|
675
|
+
policies?: ConversionPolicy[];
|
|
676
|
+
};
|
|
677
|
+
interface SchemaPreflightRequest {
|
|
678
|
+
change: SchemaChange;
|
|
679
|
+
expectedRevision: string;
|
|
680
|
+
}
|
|
681
|
+
interface SchemaPreflightResult {
|
|
682
|
+
fileId: string;
|
|
683
|
+
planToken: string;
|
|
684
|
+
baseRevision: string;
|
|
685
|
+
actionsHash: string;
|
|
686
|
+
classification: "metadata-only" | "lossless-rewrite" | "explicit-lossy" | "forbidden";
|
|
687
|
+
affectedRows: string;
|
|
688
|
+
dependencyCount: string;
|
|
689
|
+
dependencies: SchemaDependency[];
|
|
690
|
+
dependencyCursor?: string;
|
|
691
|
+
warnings: RuntimeDiagnostic[];
|
|
692
|
+
warningsTruncated: boolean;
|
|
693
|
+
valueChanges: SchemaValueChange[];
|
|
694
|
+
valueChangesTruncated: boolean;
|
|
695
|
+
expiresInMilliseconds: number;
|
|
696
|
+
expiresAt: string;
|
|
697
|
+
}
|
|
698
|
+
interface SchemaValueChange {
|
|
699
|
+
code: SchemaValueChangeCode;
|
|
700
|
+
rows: string;
|
|
701
|
+
tableId: string;
|
|
702
|
+
fieldId: string;
|
|
703
|
+
}
|
|
704
|
+
type SchemaValueChangeCode = "value-reencoded" | "binary64-rounded" | "fraction-truncated" | "integer-rounded" | "numeric-to-checkbox" | "datetime-to-date" | "null-to-empty-list" | "list-empty-to-null" | "list-tail-dropped" | "relation-detached" | "option-value-renamed" | "option-duplicate-collapsed";
|
|
705
|
+
interface SchemaDependency {
|
|
706
|
+
object: "table" | "field" | "view";
|
|
707
|
+
id: string;
|
|
708
|
+
}
|
|
709
|
+
interface SchemaDependencyPage {
|
|
710
|
+
fileId: string;
|
|
711
|
+
revision: string;
|
|
712
|
+
dependencyCount: string;
|
|
713
|
+
dependencies: SchemaDependency[];
|
|
714
|
+
nextCursor: string | null;
|
|
715
|
+
}
|
|
716
|
+
interface SchemaMutationRequest {
|
|
717
|
+
planToken: string;
|
|
718
|
+
expectedRevision: string;
|
|
719
|
+
actionsHash: string;
|
|
720
|
+
confirmLossy?: true;
|
|
721
|
+
}
|
|
722
|
+
interface SchemaMutationResult {
|
|
723
|
+
fileId: string;
|
|
724
|
+
revision: string;
|
|
725
|
+
changed: boolean;
|
|
726
|
+
createdObjects: CreatedSchemaObject[];
|
|
727
|
+
affectedTableIds: string[];
|
|
728
|
+
affectedFieldIds: string[];
|
|
729
|
+
}
|
|
730
|
+
interface SavedViewQuery {
|
|
731
|
+
filter?: FilterNode;
|
|
732
|
+
sort?: Array<{
|
|
733
|
+
fieldId: string;
|
|
734
|
+
direction: "asc" | "desc";
|
|
735
|
+
nulls?: "first" | "last";
|
|
736
|
+
}>;
|
|
737
|
+
}
|
|
738
|
+
interface CsvExportRequest {
|
|
739
|
+
tableId: string;
|
|
740
|
+
query: RowQuery;
|
|
741
|
+
fields: string[];
|
|
742
|
+
includeHeader: boolean;
|
|
743
|
+
}
|
|
744
|
+
interface CsvExportResult {
|
|
745
|
+
fileId: string;
|
|
746
|
+
tableId: string;
|
|
747
|
+
revision: string;
|
|
748
|
+
csv: OwnedBytes;
|
|
749
|
+
}
|
|
750
|
+
interface CsvImportRequest {
|
|
751
|
+
tableId: string;
|
|
752
|
+
expectedRevision: string;
|
|
753
|
+
hasHeader: boolean;
|
|
754
|
+
columns: Array<{
|
|
755
|
+
csvIndex: number;
|
|
756
|
+
fieldId: string;
|
|
757
|
+
}>;
|
|
758
|
+
csv: OwnedBytes;
|
|
759
|
+
}
|
|
760
|
+
interface CsvImportResult {
|
|
761
|
+
fileId: string;
|
|
762
|
+
tableId: string;
|
|
763
|
+
revision: string;
|
|
764
|
+
changed: boolean;
|
|
765
|
+
createdRows: Array<{
|
|
766
|
+
recordIndex: number;
|
|
767
|
+
rowId: string;
|
|
768
|
+
}>;
|
|
769
|
+
undoToken?: string;
|
|
770
|
+
evictedUndoTokens?: string[];
|
|
771
|
+
}
|
|
772
|
+
interface RuntimeEvent {
|
|
773
|
+
kind: "revision-changed" | "schema-changed" | "fatal";
|
|
774
|
+
fileId: string;
|
|
775
|
+
revision: string;
|
|
776
|
+
tableIds?: string[];
|
|
777
|
+
fieldIds?: string[];
|
|
778
|
+
}
|
|
779
|
+
interface ValidationRequest {
|
|
780
|
+
level: "identity" | "structural" | "content" | "semantic" | "full";
|
|
781
|
+
diagnosticsLimit: number;
|
|
782
|
+
}
|
|
783
|
+
interface RuntimeDiagnostic {
|
|
784
|
+
code: RuntimeDiagnosticCode;
|
|
785
|
+
severity: "fatal" | "error" | "warning" | "info";
|
|
786
|
+
message?: string;
|
|
787
|
+
fileId?: string;
|
|
788
|
+
tableId?: string;
|
|
789
|
+
fieldId?: string;
|
|
790
|
+
rowId?: string;
|
|
791
|
+
viewId?: string;
|
|
792
|
+
path?: string;
|
|
793
|
+
sourceByteOffset?: number;
|
|
794
|
+
relatedFieldIds?: string[];
|
|
795
|
+
}
|
|
796
|
+
type RuntimeDiagnosticCode = "file-not-sqlite" | "file-identity-invalid" | "file-format-unsupported" | "file-feature-unsupported" | "file-core-object-invalid" | "file-metadata-invalid" | "file-foreign-key-invalid" | "file-physical-schema-invalid" | "file-definition-invalid" | "file-trigger-invalid" | "file-index-invalid" | "file-extension-invalid" | "file-cell-invalid" | "file-json-invalid" | "file-reference-invalid" | "file-unresolved-relation" | "file-integrity-invalid" | "semantic-field-invalid" | "formula-parse-invalid" | "formula-name-invalid" | "formula-type-invalid" | "semantic-cycle" | "lookup-invalid" | "relation-invalid" | "record-label-invalid" | "view-query-invalid" | "option-catalog-invalid" | "validation-prerequisite-failed" | "fraction-loss" | "precision-loss" | "truthiness-loss" | "time-loss" | "null-distinction-loss" | "list-tail-loss" | "option-merge-loss" | "object-delete-loss" | "dependent-source-rewritten" | "dependency-blocked" | "conversion-domain-invalid" | "non-nullability-blocked" | "relation-definition-invalid" | "cardinality-blocked" | "record-label-blocked" | `x.${string}.${string}`;
|
|
797
|
+
interface ValidationReport {
|
|
798
|
+
fileId?: string;
|
|
799
|
+
revision?: string;
|
|
800
|
+
level: ValidationRequest["level"];
|
|
801
|
+
valid: boolean;
|
|
802
|
+
diagnostics: RuntimeDiagnostic[];
|
|
803
|
+
truncated: boolean;
|
|
804
|
+
}
|
|
805
|
+
interface RuntimeClient {
|
|
806
|
+
negotiate(request: {
|
|
807
|
+
protocol: "eidos-runtime";
|
|
808
|
+
versions: ["1.0"];
|
|
809
|
+
}, context: RequestContext): Promise<{
|
|
810
|
+
version: "1.0";
|
|
811
|
+
capabilities: RuntimeCapabilities;
|
|
812
|
+
limits: RuntimeLimits;
|
|
813
|
+
}>;
|
|
814
|
+
getSnapshot(request: {
|
|
815
|
+
minimumRevision?: string;
|
|
816
|
+
}, context: RequestContext): Promise<RuntimeSnapshot>;
|
|
817
|
+
getSchemaPage(request: GetSchemaPageRequest, context: RequestContext): Promise<SchemaPage>;
|
|
818
|
+
queryRows(request: QueryRowsRequest, context: RequestContext): Promise<RowPage>;
|
|
819
|
+
getRowsById(request: {
|
|
820
|
+
tableId: string;
|
|
821
|
+
rowIds: string[];
|
|
822
|
+
projection: ProjectionSpec;
|
|
823
|
+
}, context: RequestContext): Promise<RowBatch>;
|
|
824
|
+
aggregate(request: AggregateRequest, context: RequestContext): Promise<AggregateResponse>;
|
|
825
|
+
groupRows(request: GroupRequest, context: RequestContext): Promise<GroupPage>;
|
|
826
|
+
queryGroupRows(request: GroupRowsRequest, context: RequestContext): Promise<GroupRowPage>;
|
|
827
|
+
previewFormula(request: FormulaPreviewRequest, context: RequestContext): Promise<FormulaPreviewResult>;
|
|
828
|
+
mutateRows(request: RowMutation, context: RequestContext): Promise<MutationResult>;
|
|
829
|
+
revertMutation?(request: {
|
|
830
|
+
undoToken: string;
|
|
831
|
+
expectedRevision: string;
|
|
832
|
+
}, context: RequestContext): Promise<MutationResult>;
|
|
833
|
+
mutateView(request: ViewMutationRequest, context: RequestContext): Promise<ViewMutationResult>;
|
|
834
|
+
preflightSchema(request: SchemaPreflightRequest, context: RequestContext): Promise<SchemaPreflightResult>;
|
|
835
|
+
getSchemaPlanDependencies(request: {
|
|
836
|
+
planToken: string;
|
|
837
|
+
cursor?: string;
|
|
838
|
+
limit: number;
|
|
839
|
+
}, context: RequestContext): Promise<SchemaDependencyPage>;
|
|
840
|
+
mutateSchema(request: SchemaMutationRequest, context: RequestContext): Promise<SchemaMutationResult>;
|
|
841
|
+
validate(request: ValidationRequest, context: RequestContext): Promise<ValidationReport>;
|
|
842
|
+
exportCsv?(request: CsvExportRequest, context: RequestContext): Promise<CsvExportResult>;
|
|
843
|
+
importCsv?(request: CsvImportRequest, context: RequestContext): Promise<CsvImportResult>;
|
|
844
|
+
cancel(request: {
|
|
845
|
+
requestId: string;
|
|
846
|
+
}): Promise<void>;
|
|
847
|
+
subscribe?(listener: (event: RuntimeEvent) => void): () => void;
|
|
848
|
+
close(context: RequestContext): Promise<void>;
|
|
849
|
+
}
|
|
850
|
+
type RuntimeService = RuntimeClient;
|
|
851
|
+
//#endregion
|
|
852
|
+
//#region src/adapter-contract.d.ts
|
|
853
|
+
type SqlValue = {
|
|
854
|
+
tag: "null";
|
|
855
|
+
} | {
|
|
856
|
+
tag: "integer";
|
|
857
|
+
value: string;
|
|
858
|
+
} | {
|
|
859
|
+
tag: "real";
|
|
860
|
+
value: number;
|
|
861
|
+
} | {
|
|
862
|
+
tag: "text";
|
|
863
|
+
value: string;
|
|
864
|
+
} | {
|
|
865
|
+
tag: "blob";
|
|
866
|
+
value: OwnedBytes;
|
|
867
|
+
};
|
|
868
|
+
interface Column {
|
|
869
|
+
name: string;
|
|
870
|
+
}
|
|
871
|
+
interface QueryResult {
|
|
872
|
+
columns: Column[];
|
|
873
|
+
rows: SqlValue[][];
|
|
874
|
+
}
|
|
875
|
+
interface RunResult {
|
|
876
|
+
changes: string;
|
|
877
|
+
lastInsertRowid: string;
|
|
878
|
+
}
|
|
879
|
+
interface ConnectionCapabilities {
|
|
880
|
+
adapterVersion: "1.0";
|
|
881
|
+
sqliteVersion: string;
|
|
882
|
+
json1: boolean;
|
|
883
|
+
returning: boolean;
|
|
884
|
+
strict: boolean;
|
|
885
|
+
int64: boolean;
|
|
886
|
+
scalarFunctions: boolean;
|
|
887
|
+
directOnlyFunctions: boolean;
|
|
888
|
+
interrupt: boolean;
|
|
889
|
+
snapshot: true;
|
|
890
|
+
defensiveMode: boolean;
|
|
891
|
+
busyTimeoutMs: number;
|
|
892
|
+
maxVariables: number;
|
|
893
|
+
maxSqlBytes: number;
|
|
894
|
+
maxValueBytes: number;
|
|
895
|
+
maxResultRows: number;
|
|
896
|
+
maxResultBytes: number;
|
|
897
|
+
}
|
|
898
|
+
interface ScalarDefinition {
|
|
899
|
+
name: string;
|
|
900
|
+
arity: number;
|
|
901
|
+
deterministic: true;
|
|
902
|
+
directOnly: true;
|
|
903
|
+
}
|
|
904
|
+
interface SnapshotContext {
|
|
905
|
+
cancellation: CancellationPort;
|
|
906
|
+
deadlineMilliseconds?: number;
|
|
907
|
+
maxBytes: string;
|
|
908
|
+
}
|
|
909
|
+
interface ConnectionSnapshot {
|
|
910
|
+
bytes: ByteSource;
|
|
911
|
+
release(): Promise<void>;
|
|
912
|
+
}
|
|
913
|
+
interface ConnectionPort {
|
|
914
|
+
capabilities(): ConnectionCapabilities;
|
|
915
|
+
execSchema(sql: string): void;
|
|
916
|
+
query(sql: string, bindings?: readonly SqlValue[]): QueryResult;
|
|
917
|
+
get(sql: string, bindings?: readonly SqlValue[]): {
|
|
918
|
+
columns: Column[];
|
|
919
|
+
row: SqlValue[] | null;
|
|
920
|
+
};
|
|
921
|
+
run(sql: string, bindings?: readonly SqlValue[]): RunResult;
|
|
922
|
+
runMany(sql: string, bindingSets: readonly (readonly SqlValue[])[]): RunResult[];
|
|
923
|
+
registerScalar(definition: ScalarDefinition, operation: (...values: SqlValue[]) => SqlValue): void;
|
|
924
|
+
transaction<T>(mode: "read" | "write", operation: () => T): T;
|
|
925
|
+
transaction<T>(mode: "read" | "write", operation: () => Promise<T>): Promise<T>;
|
|
926
|
+
dataVersion(): string;
|
|
927
|
+
interrupt(): void;
|
|
928
|
+
snapshot(context: SnapshotContext): Promise<ConnectionSnapshot>;
|
|
929
|
+
close(): void;
|
|
930
|
+
}
|
|
931
|
+
type AdapterErrorCode = "adapter-closed" | "invalid-argument" | "invalid-sql-value" | "unsupported-capability" | "sql-error" | "sql-function-error" | "constraint" | "busy" | "locked" | "cancelled" | "deadline-exceeded" | "resource-limit" | "out-of-memory" | "io-error" | "corrupt" | "not-a-database" | "read-only" | "permission-denied" | "source-changed" | "writer-unavailable" | "publication-failed" | "recovery-required" | "asset-unavailable" | "protocol-error" | "backpressure" | "commit-outcome-unknown" | "transport-closed" | "transport-fatal";
|
|
932
|
+
interface AdapterError {
|
|
933
|
+
code: AdapterErrorCode;
|
|
934
|
+
message: string;
|
|
935
|
+
retryable: boolean;
|
|
936
|
+
fatal: boolean;
|
|
937
|
+
sqlitePrimaryCode?: number;
|
|
938
|
+
sqliteExtendedCode?: number;
|
|
939
|
+
details?: JsonObject;
|
|
940
|
+
}
|
|
941
|
+
interface HostServices {
|
|
942
|
+
negotiate(request: {
|
|
943
|
+
protocol: "eidos-host";
|
|
944
|
+
versions: ["1.0"];
|
|
945
|
+
}, context: RequestContext): Promise<{
|
|
946
|
+
version: "1.0";
|
|
947
|
+
serviceCapabilities: HostServiceCapabilities;
|
|
948
|
+
limits: HostLimits;
|
|
949
|
+
}>;
|
|
950
|
+
openSource(request: {
|
|
951
|
+
sourceToken: string;
|
|
952
|
+
access: "read" | "readwrite";
|
|
953
|
+
}, context: RequestContext): Promise<{
|
|
954
|
+
sessionId: string;
|
|
955
|
+
runtime: RuntimeClient;
|
|
956
|
+
state: HostSessionState;
|
|
957
|
+
}>;
|
|
958
|
+
createSource(request: {
|
|
959
|
+
destinationToken: string;
|
|
960
|
+
title: string;
|
|
961
|
+
}, context: RequestContext): Promise<{
|
|
962
|
+
sessionId: string;
|
|
963
|
+
runtime: RuntimeClient;
|
|
964
|
+
state: HostSessionState;
|
|
965
|
+
}>;
|
|
966
|
+
requestWritePermission(request: {
|
|
967
|
+
sessionId: string;
|
|
968
|
+
}, context: RequestContext): Promise<HostSessionState>;
|
|
969
|
+
save(request: {
|
|
970
|
+
sessionId: string;
|
|
971
|
+
}, context: RequestContext): Promise<HostSaveResult>;
|
|
972
|
+
saveCopy(request: {
|
|
973
|
+
sessionId: string;
|
|
974
|
+
destinationToken: string;
|
|
975
|
+
adopt: "keep-current" | "adopt-copy";
|
|
976
|
+
}, context: RequestContext): Promise<HostSaveCopyResult>;
|
|
977
|
+
reconcileCommit(request: {
|
|
978
|
+
sessionId: string;
|
|
979
|
+
}, context: RequestContext): Promise<HostCommitReconciliationResult>;
|
|
980
|
+
resolveConflict(request: {
|
|
981
|
+
sessionId: string;
|
|
982
|
+
strategy: "reload" | "save-copy" | "merge";
|
|
983
|
+
conflictToken: string;
|
|
984
|
+
destinationToken?: string;
|
|
985
|
+
adopt?: "keep-current" | "adopt-copy";
|
|
986
|
+
}, context: RequestContext): Promise<HostConflictResult>;
|
|
987
|
+
listRecovery(request: {
|
|
988
|
+
sessionId: string;
|
|
989
|
+
}, context: RequestContext): Promise<HostRecoveryReport>;
|
|
990
|
+
restoreRecovery(request: {
|
|
991
|
+
sessionId: string;
|
|
992
|
+
recoveryToken: string;
|
|
993
|
+
}, context: RequestContext): Promise<HostRecoveryResult>;
|
|
994
|
+
discardRecovery(request: {
|
|
995
|
+
sessionId: string;
|
|
996
|
+
recoveryToken: string;
|
|
997
|
+
}, context: RequestContext): Promise<HostRecoveryResult>;
|
|
998
|
+
acquireAsset(request: {
|
|
999
|
+
sessionId: string;
|
|
1000
|
+
sourceToken: string;
|
|
1001
|
+
}, context: RequestContext): Promise<{
|
|
1002
|
+
entry: FileEntry;
|
|
1003
|
+
}>;
|
|
1004
|
+
resolveAsset(request: {
|
|
1005
|
+
sessionId: string;
|
|
1006
|
+
entryId: string;
|
|
1007
|
+
purpose: "thumbnail" | "preview" | "download";
|
|
1008
|
+
}, context: RequestContext): Promise<AssetLease>;
|
|
1009
|
+
releaseAsset(request: {
|
|
1010
|
+
sessionId: string;
|
|
1011
|
+
leaseId: string;
|
|
1012
|
+
}, context: RequestContext): Promise<void>;
|
|
1013
|
+
close(request: {
|
|
1014
|
+
sessionId: string;
|
|
1015
|
+
}, context: RequestContext): Promise<void>;
|
|
1016
|
+
subscribe(sessionId: string, listener: (state: HostSessionState) => void): () => void;
|
|
1017
|
+
}
|
|
1018
|
+
interface HostServiceCapabilities {
|
|
1019
|
+
canOpenSource: true;
|
|
1020
|
+
canCreateSource: boolean;
|
|
1021
|
+
canRequestPermission: boolean;
|
|
1022
|
+
canSaveCopy: boolean;
|
|
1023
|
+
canReconcileCommit: boolean;
|
|
1024
|
+
canResolveConflict: boolean;
|
|
1025
|
+
canRecover: boolean;
|
|
1026
|
+
canUseAssets: boolean;
|
|
1027
|
+
}
|
|
1028
|
+
interface HostCapabilities {
|
|
1029
|
+
canWriteCurrent: boolean;
|
|
1030
|
+
canSaveCopy: boolean;
|
|
1031
|
+
canRequestPermission: boolean;
|
|
1032
|
+
hasRecovery: boolean;
|
|
1033
|
+
assetReadSchemes: string[];
|
|
1034
|
+
assetWriteSchemes: string[];
|
|
1035
|
+
casGuarantee: "strong" | "cooperative" | "none";
|
|
1036
|
+
atomicReplace: boolean;
|
|
1037
|
+
durability: "durable" | "best-effort";
|
|
1038
|
+
}
|
|
1039
|
+
interface HostLimits {
|
|
1040
|
+
sourceBytesMax: string;
|
|
1041
|
+
candidateBytesMax: string;
|
|
1042
|
+
recoveryBytesMax: string;
|
|
1043
|
+
recoveryEntriesMax: number;
|
|
1044
|
+
recoveryRetentionSecondsMax: number;
|
|
1045
|
+
assetBytesMax: string;
|
|
1046
|
+
assetPreviewBytesMax: string;
|
|
1047
|
+
concurrentAssetLeasesMax: number;
|
|
1048
|
+
concurrentSessionsMax: number;
|
|
1049
|
+
}
|
|
1050
|
+
type HostPhase = "opening" | "ready-readonly" | "ready-clean" | "ready-dirty" | "publishing" | "commit-unknown" | "conflict" | "recovery-required" | "fatal" | "closed";
|
|
1051
|
+
interface HostError {
|
|
1052
|
+
code: "invalid-request" | "unsupported" | "invalid-source" | "conflict" | "permission-denied" | "source-changed" | "writer-unavailable" | "publication-failed" | "recovery-required" | "asset-unavailable" | "cancelled" | "deadline-exceeded" | "resource-limit" | "io-error" | "unknown-commit" | "closed" | "fatal";
|
|
1053
|
+
message: string;
|
|
1054
|
+
retryable: boolean;
|
|
1055
|
+
details?: JsonObject;
|
|
1056
|
+
}
|
|
1057
|
+
interface HostSessionState {
|
|
1058
|
+
sessionId: string;
|
|
1059
|
+
phase: HostPhase;
|
|
1060
|
+
capabilities: HostCapabilities;
|
|
1061
|
+
limits: HostLimits;
|
|
1062
|
+
fileId?: string;
|
|
1063
|
+
revision?: string;
|
|
1064
|
+
conflictToken?: string;
|
|
1065
|
+
error?: HostError;
|
|
1066
|
+
}
|
|
1067
|
+
interface HostSaveResult {
|
|
1068
|
+
state: HostSessionState;
|
|
1069
|
+
}
|
|
1070
|
+
interface HostSaveCopyResult {
|
|
1071
|
+
state: HostSessionState;
|
|
1072
|
+
adopted: boolean;
|
|
1073
|
+
runtime?: RuntimeClient;
|
|
1074
|
+
}
|
|
1075
|
+
interface HostCommitReconciliationResult {
|
|
1076
|
+
state: HostSessionState;
|
|
1077
|
+
outcome: "committed" | "rolled-back" | "conflict";
|
|
1078
|
+
runtime?: RuntimeClient;
|
|
1079
|
+
reconciliation?: CommitReconciliation;
|
|
1080
|
+
}
|
|
1081
|
+
interface HostConflictResult {
|
|
1082
|
+
state: HostSessionState;
|
|
1083
|
+
runtime?: RuntimeClient;
|
|
1084
|
+
}
|
|
1085
|
+
interface HostRecoveryResult {
|
|
1086
|
+
state: HostSessionState;
|
|
1087
|
+
runtime?: RuntimeClient;
|
|
1088
|
+
}
|
|
1089
|
+
interface HostRecoveryReport {
|
|
1090
|
+
items: Array<{
|
|
1091
|
+
recoveryToken: string;
|
|
1092
|
+
fileId: string;
|
|
1093
|
+
revision: string;
|
|
1094
|
+
createdAt: string;
|
|
1095
|
+
size: string;
|
|
1096
|
+
}>;
|
|
1097
|
+
}
|
|
1098
|
+
interface AssetLease {
|
|
1099
|
+
leaseId: string;
|
|
1100
|
+
entryId: string;
|
|
1101
|
+
purpose: "thumbnail" | "preview" | "download";
|
|
1102
|
+
mediaType: string;
|
|
1103
|
+
name: string;
|
|
1104
|
+
size: string;
|
|
1105
|
+
expiresAt: string;
|
|
1106
|
+
resourceToken: string;
|
|
1107
|
+
}
|
|
1108
|
+
//#endregion
|
|
1109
|
+
export { GroupRequest as $, ValidationReport as $t, AtomicType as A, RuntimeLimits as At, CsvImportResult as B, SchemaDescriptor as Bt, ScalarDefinition as C, RuntimeDiagnosticCode as Ct, AggregateRequest as D, RuntimeEvent as Dt, AggregateItem as E, RuntimeErrorCode as Et, ConvertFieldChange as F, ScalarStoredFieldType as Ft, FilterOperand as G, SchemaPreflightRequest as Gt, FieldDescriptor as H, SchemaMutationRequest as Ht, CreatedSchemaObject as I, ScalarType as It, FormulaPreviewResult as J, SchemaValueChangeCode as Jt, FormulaDefinition as K, SchemaPreflightResult as Kt, CsvExportRequest as L, SchemaChange as Lt, ColumnStatistics as M, RuntimeService as Mt, CommitReconciliation as N, RuntimeSnapshot as Nt, AggregateResponse as O, RuntimeFactoryContext as Ot, ConversionPolicy as P, SavedViewQuery as Pt, GroupPage as Q, TypeRef as Qt, CsvExportResult as R, SchemaDependency as Rt, RunResult as S, RuntimeDiagnostic as St, SqlValue as T, RuntimeError as Tt, FileEntry as U, SchemaMutationResult as Ut, FeatureDescriptor as V, SchemaLeafChange as Vt, FilterNode as W, SchemaPage as Wt, ForwardRelationDefinition as X, TableDescriptor as Xt, FormulaResultType as Y, StoredFieldType as Yt, GetSchemaPageRequest as Z, TransportCommitBarrier as Zt, HostSaveResult as _, RowQuery as _t, ConnectionCapabilities as a, MutationResult as at, HostSessionState as b, RuntimeClient as bt, HostCapabilities as c, ProjectionSpec as ct, HostError as d, ResolvedRelationItem as dt, ValidationRequest as en, GroupRowPage as et, HostLimits as f, Revision as ft, HostSaveCopyResult as g, RowPage as gt, HostRecoveryResult as h, RowMutation as ht, Column as i, ViewMutationResult as in, LookupDefinition as it, ColumnDescriptor as j, RuntimePublicationSnapshot as jt, AggregateResult as k, RuntimeHostBridge as kt, HostCommitReconciliationResult as l, QueryRowsRequest as lt, HostRecoveryReport as m, RowChange as mt, AdapterErrorCode as n, ViewDescriptor as nn, InverseRelationDefinition as nt, ConnectionPort as o, NewField as ot, HostPhase as p, RowBatch as pt, FormulaPreviewRequest as q, SchemaValueChange as qt, AssetLease as r, ViewMutationRequest as rn, LogicalValue as rt, ConnectionSnapshot as s, ProjectedRow as st, AdapterError as t, ViewChange as tn, GroupRowsRequest as tt, HostConflictResult as u, RelationDefinition as ut, HostServiceCapabilities as v, RuntimeBinding as vt, SnapshotContext as w, RuntimeEnvironment as wt, QueryResult as x, RuntimeCreateInput as xt, HostServices as y, RuntimeCapabilities as yt, CsvImportRequest as z, SchemaDependencyPage as zt };
|
|
1110
|
+
//# sourceMappingURL=adapter-contract-BRKKEulb.d.mts.map
|