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