@akohn/dashql 0.0.2-dev.17 → 0.0.19-dev.247

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.
@@ -1,5 +1,10 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ /**
4
+ * Replay a recording of the progress of a query (JSON, see `ProfileRecording`) up to a point in time in milliseconds
5
+ * since its first payload, with a layout of the plan or the default one. None if nothing happened until then.
6
+ */
7
+ export function replayQueryProgress(recording: string, until_ms: number, layout?: ProfileLayoutView | null): QueryProfileProgressView | undefined;
3
8
  /**
4
9
  * The literal of the value of an input control, in the Hyper dialect: `sql_type` is the SQL text of the type of the
5
10
  * input, `SqlType.sql`, absent without a type
@@ -53,11 +58,6 @@ export function quoteColumnName(text: string): string;
53
58
  * character boundaries, its offsets in UTF-16 code units like those of the editors
54
59
  */
55
60
  export function textChange(from: string, to: string): WorkbookTextChange;
56
- /**
57
- * Replay a recording of the progress of a query (JSON, see `ProfileRecording`) up to a point in time in milliseconds
58
- * since its first payload, with a layout of the plan or the default one. None if nothing happened until then.
59
- */
60
- export function replayQueryProgress(recording: string, until_ms: number, layout?: ProfileLayoutView | null): QueryProfileProgressView | undefined;
61
61
  /**
62
62
  * How far a catalog update got
63
63
  */
@@ -160,1471 +160,1162 @@ export enum TaskStatus {
160
160
  TASK_FAILED = 3,
161
161
  TASK_CANCELLED = 4,
162
162
  }
163
- /**
164
- * The error of a failed or cancelled query
165
- */
166
- export interface QueryErrorView {
167
- message: string;
168
- details: string | null;
163
+
164
+ /** The I/O of the runtime, one object of the host (docs/design/dashql_runtime.md). The members return promises where the runtime awaits them. */
165
+ export interface RuntimePlatform {
166
+ /** The clock in milliseconds since epoch, and timers */
167
+ clock: { now(): number; sleep(ms: number): Promise<void> };
168
+ /** Log a message with its details as key value pairs, on a target of the log */
169
+ log(level: 'debug' | 'info' | 'warn' | 'error', message: string, details: [string, string][], target?: string): void;
170
+ /** The handle table of the host objects that the runtime names by a number */
171
+ handles: RuntimeHandles;
172
+ /** The Arrow tables of the host by handle, result data never enters the module */
173
+ tables: RuntimeTables;
174
+ /** The compute database of the computations, null until the host set it up */
175
+ readonly compute: ComputePlatform | null;
176
+ /** Send requests with the HTTP client of the platform */
177
+ http: RuntimeHttp;
178
+ /** The channels of the host: the ones that the setups connect, and the ones that run queries themselves (the embedded Hyper, gRPC through the native proxy, the channels of tests) */
179
+ channels: RuntimeChannels;
180
+ /** The query result cache, null without one */
181
+ readonly resultCache: RuntimeResultCache | null;
182
+ /** The files of the runs of workbooks in the compute database: the materialized results, the cached results that they scan and the attachments. Null without a compute database that reads Parquet files. */
183
+ readonly mounts: RuntimeMounts | null;
184
+ /** Random ids and the SHA-256 digests of the keys of the query result cache */
185
+ crypto: { randomUuid(): string; sha256(bytes: Uint8Array): Promise<Uint8Array> };
186
+ /** The OAuth flows of the setups */
187
+ oauth: RuntimeOAuth;
188
+ /** The specs of the client functions of the extensions, the JSON text */
189
+ extensions: { loadSpec(extension: string): Promise<string> };
190
+ /** The storage of the workbooks and the connections, the storage writer and the restore read and write through it */
191
+ readonly storage: RuntimeStorage | null;
192
+ /** The `.dashql` archives of imports and exports: the ZIP container and the Parquet files of the workbook tables. Null without. */
193
+ readonly archives: RuntimeArchives | null;
194
+ /** The state of the runtime changed, the host takes the changes. Urgent changes are taken at the end of the task, the others before the next frame. */
195
+ changed(urgent: boolean): void;
169
196
  }
170
197
 
171
- /**
172
- * A query, the slice `query` of the runtime: its text, what it is, its status and its latest progress. The field names
173
- * are the ones the app reads. The result table is a table of the handle table of the platform.
174
- */
175
- export interface QueryView {
176
- queryId: number;
177
- /**
178
- * The connection of the query
179
- */
180
- connectionId: string;
181
- /**
182
- * The trace of the log messages of the query
183
- */
184
- traceId: number;
185
- queryText: string;
186
- queryMetadata: QueryMetadataView;
187
- status: QueryExecutionStatus;
188
- metrics: QueryMetricsView;
189
- error: QueryErrorView | null;
190
- resultTable: QueryResultTableView | null;
191
- cacheKey: string | null;
192
- servedFromCache: boolean;
193
- cacheDeleted: boolean;
194
- cachedAt: number | null;
195
- latestProgressUpdate: QueryLatestProgressView | null;
196
- revision: number;
198
+ /** The storage of the platform: the workbook files, scripts and attachments of the workbooks, the app manifest and the files of the connections. Workbook files and connection entries cross as plain JSON values. */
199
+ export interface RuntimeStorage {
200
+ /** The workbook file, rejects if there is none */
201
+ loadWorkbook(workbookId: string): Promise<unknown>;
197
202
  /**
198
- * The handle of the record of the query at the host
203
+ * The writes of the workbook file and of the scripts take what they expect on disk: `undefined` for any file, `null` for none, else the stamp that the
204
+ * runtime recorded. A storage with stamps rejects a write whose file differs with an `ExternalScriptChangeError` (by its name, with `workbookId` and
205
+ * `fileName`) and resolves with the stamp of what it wrote; a storage without stamps ignores the expectation and resolves with nothing. A write into a
206
+ * workbook folder that is gone rejects with a `WorkbookFolderMissingError` (by its name), the runtime stops retrying it.
199
207
  */
200
- handle: number | null;
208
+ saveWorkbook(workbookId: string, workbook: unknown, expected?: RuntimeFileStamp | null): Promise<RuntimeFileStamp | null | void>;
209
+ saveScript(workbookId: string, fileName: string, text: string, expected?: RuntimeFileStamp | null): Promise<RuntimeFileStamp | null | void>;
210
+ /** A missing file is deleted already */
211
+ deleteScript(workbookId: string, fileName: string, expected?: RuntimeFileStamp | null): Promise<void>;
212
+ /** The file keeps its stamp, a missing source is renamed already */
213
+ renameScript(workbookId: string, from: string, to: string, expectedFrom?: RuntimeFileStamp | null, expectedTo?: RuntimeFileStamp | null): Promise<void>;
214
+ /** The names of the attachments, the runtime normalizes them to NFC and orders them naturally */
215
+ listAttachments(workbookId: string): Promise<string[]>;
216
+ /** Update the connection entries of the app manifest exclusively. The update gets the entries, null before the connections were migrated, and returns the new ones, null if nothing changed. */
217
+ updateConnections(update: (connections: unknown[] | null) => unknown[] | null): Promise<void>;
218
+ saveConnectionFile(connectionId: string, fileName: string, text: string): Promise<void>;
219
+ deleteConnectionFiles(connectionId: string): Promise<void>;
220
+ deleteWorkbook(workbookId: string): Promise<void>;
221
+ /** Does the storage own the connections? A storage of a single workbook folder doesn't. */
222
+ ownsConnections(): boolean;
223
+ /** The entries of the workbook tree in the order of the sidebar: the id of a workbook as `path`, where it is stored and its native folder */
224
+ listWorkbooks(): Promise<{ path: string; storageType?: string; nativePath?: string | null }[]>;
225
+ /** The connection entries of the app manifest, null if the manifest has none */
226
+ loadManifestConnections(): Promise<unknown[] | null>;
227
+ /** The script files of a workbook */
228
+ loadScripts(workbookId: string): Promise<RestoreScriptFile[]>;
229
+ /** The data files of a workbook */
230
+ listDataFiles(workbookId: string): Promise<WorkbookDataFile[]>;
231
+ /** A file of a connection, null if it doesn't exist */
232
+ loadConnectionFile(connectionId: string, fileName: string): Promise<string | null>;
233
+ /** An attachment of a workbook, a Blob or its bytes */
234
+ loadDataFile(workbookId: string, name: string): Promise<Blob | Uint8Array>;
235
+ /** Write an attachment of a workbook */
236
+ saveDataFile(workbookId: string, name: string, file: Blob | Uint8Array): Promise<void>;
237
+ /** Rename an attachment of a workbook, keeping its contents */
238
+ renameDataFile(workbookId: string, from: string, to: string): Promise<void>;
239
+ /** Add or replace an entry of the workbook tree, e.g. to route a workbook to the origin private file system */
240
+ upsertWorkbookEntry(entry: unknown): Promise<void>;
241
+ /** Delete the files of a workbook, its entry stays */
242
+ deleteWorkbookFiles(workbookId: string): Promise<void>;
243
+ /** Register a native workbook folder in place under an id: the platform adds it to the workbook tree, the runtime migrates it */
244
+ registerNativeWorkbook(dir: string, workbookId: string): Promise<void>;
245
+ /** The folder of a workbook that the platform keeps in a folder of its own, e.g. a native workbook folder; null for the workbooks of the storage root, which `migrateStorage` migrates. The runtime migrates the folder when it reads a workbook file of an older format and checks it for changes outside the app. */
246
+ workbookFolder?(workbookId: string): RuntimeWorkbookFolder | null;
247
+ /** The attachments of a workbook folder changed outside the app, e.g. its mount looks them up again */
248
+ attachmentsChanged?(workbookId: string): void;
201
249
  }
202
250
 
203
- /**
204
- * A progress update of a channel of the host: the plain fields and the raw progress payload of the engine, e.g.
205
- * `{ kind: 'hyper_query_status', status, receivedAt }`. The progress model of the query in the executor turns the
206
- * payload into the structured progress.
207
- */
208
- export interface QueryProgressView {
209
- isQueued: boolean | null;
210
- progressPercent: number | null;
211
- resultRows: number | null;
212
- rowsProcessed: number | null;
213
- executionTimeMs: number | null;
214
- /**
215
- * The metrics of the response stream, none counts nothing
216
- */
217
- metrics?: QueryStreamMetrics | null;
218
- phase?: string | null;
219
- /**
220
- * The raw progress payload of the engine, a payload of an unknown kind is dropped
221
- */
222
- engineProgress?: unknown;
251
+ /** The top-level files of a workbook folder, as the migrations read and write them */
252
+ export interface RuntimeFolder {
253
+ /** A file, null if the folder doesn't hold it */
254
+ readText(name: string): Promise<string | null>;
255
+ /** Write a file, resolves with its stamp if the folder keeps stamps */
256
+ writeText(name: string, text: string): Promise<RuntimeFileStamp | null | void>;
257
+ /** Remove a file, a missing file is ignored */
258
+ remove(name: string): Promise<void>;
223
259
  }
224
260
 
225
- /**
226
- * What a query is and who issued it. A planned statement of a run of a workbook is opaque JSON
227
- * (`PlannedStatement` of the app).
228
- */
229
- export interface QueryMetadataView {
230
- queryType: QueryType;
231
- title: string | null;
232
- description: string | null;
233
- issuer: string | null;
234
- userProvided: boolean;
235
- workbookId?: string;
236
- resultOwner?: string;
237
- planned?: unknown;
261
+ /** The stamp of a file: size and modification time */
262
+ export interface RuntimeFileStamp {
263
+ size: number;
264
+ mtimeMs: number;
238
265
  }
239
266
 
240
- /**
241
- * The metrics of the finished queries of a history, internal queries don't count
242
- */
243
- export interface QueryHistoryMetrics {
244
- successfulQueries: QueryOutcomeMetrics;
245
- canceledQueries: QueryOutcomeMetrics;
246
- failedQueries: QueryOutcomeMetrics;
267
+ /** The stamps of the files of a workbook folder */
268
+ export interface RuntimeFolderStamps {
269
+ scripts: ({ name: string } & RuntimeFileStamp)[];
270
+ attachments: ({ name: string } & RuntimeFileStamp)[];
271
+ /** The workbook file, null if there is none */
272
+ workbook: RuntimeFileStamp | null;
247
273
  }
248
274
 
249
- /**
250
- * The metrics of the finished queries of one outcome
251
- */
252
- export interface QueryOutcomeMetrics {
253
- totalQueries: number;
254
- totalBatchesReceived: number;
255
- totalRowsReceived: number;
256
- accumulatedTimeUntilFirstBatch: number;
257
- accumulatedQueryDuration: number;
275
+ /** A workbook folder that may change outside the app, e.g. a native workbook folder. The runtime keeps the stamps of what it wrote and acknowledged. */
276
+ export interface RuntimeWorkbookFolder extends RuntimeFolder {
277
+ /** The stamps of the scripts, the attachments and the workbook file of the folder */
278
+ stampFolder(): Promise<RuntimeFolderStamps>;
258
279
  }
259
280
 
260
- /**
261
- * The keys of the structured progress of a query that the host holds, their payloads don't cross again
262
- */
263
- export interface QueryProfileKeys {
264
- /**
265
- * The revision of the progress, the execution state crosses when it differs
266
- */
267
- revision: number | null;
268
- /**
269
- * The version of the structure, the structure crosses when it differs
270
- */
271
- structureVersion: number | null;
281
+ /** The storage root of the app for its migrations: files and directories by their paths below the root, `/` separated */
282
+ export interface RuntimeStorageRoot {
283
+ /** A file, null if it doesn't exist */
284
+ readText(path: string): Promise<string | null>;
285
+ /** Write a file, its directories are created */
286
+ writeText(path: string, text: string): Promise<void>;
287
+ /** Create a directory and its parents */
288
+ createDirectory(path: string): Promise<void>;
289
+ /** Remove a file, or a directory with its content; a missing one is ignored */
290
+ remove(path: string): Promise<void>;
291
+ /** The entries of a directory, null if it doesn't exist */
292
+ list(path: string): Promise<{ name: string; directory: boolean }[] | null>;
293
+ /** Copy the files and folders of a directory into another one, which is created. Existing files are replaced, or kept with `keepExisting`. */
294
+ copyDirectory(from: string, to: string, keepExisting: boolean): Promise<void>;
295
+ /** The folder of a native workbook, claimed for the app; null without native folders or if it doesn't exist */
296
+ nativeFolder(nativePath: string): Promise<RuntimeFolder | null>;
272
297
  }
273
298
 
274
- /**
275
- * The structured progress of a query: the plan with its stages and their execution state. A payload is null when the
276
- * host holds it already, its key names it.
277
- */
278
- export interface QueryProfileProgressView {
279
- /**
280
- * The revision of the progress, it changes with the structure or the execution state
281
- */
282
- revision: number;
283
- /**
284
- * The version of the structure
285
- */
286
- structureVersion: number;
287
- /**
288
- * The packed `QueryProfile`, null while the host holds its version
289
- */
290
- structure: FlatBuffer<buffers_profile.QueryProfile> | null;
291
- /**
292
- * The execution state as packed `QueryProfileEvents`, one event per entity with state, null while the host holds
293
- * the revision
294
- */
295
- execution: FlatBuffer<buffers_profile.QueryProfileEvents> | null;
299
+ /** An entry of a `.dashql` archive that the platform writes: a workbook table from the Arrow IPC of its rows, written as Parquet, or a file of the handle table as it is */
300
+ export interface RuntimeArchiveEntry {
301
+ fileName: string;
302
+ /** Stored without compression, else deflated */
303
+ stored: boolean;
304
+ table: Uint8Array | null;
305
+ file: number | null;
296
306
  }
297
307
 
298
- /**
299
- * The result table of a query, the host keeps it under its handle
300
- */
301
- export interface QueryResultTableView {
302
- id: number;
303
- rows: number;
304
- }
305
-
306
- /**
307
- * The metrics of the response stream of a query, as the connector counts them
308
- */
309
- export interface QueryStreamMetrics {
310
- totalDataBytesReceived: number;
311
- totalBatchesReceived: number;
312
- totalRowsReceived: number;
313
- totalQueryRequestsStarted: number;
314
- totalQueryRequestsSucceeded: number;
315
- totalQueryRequestsFailed: number;
316
- totalQueryRequestDurationMs: number;
317
- durationUntilFirstBatchMs: number | null;
318
- }
319
-
320
- /**
321
- * The latest progress update of a query: the plain fields and the structured progress
322
- */
323
- export interface QueryLatestProgressView {
324
- isQueued: boolean | null;
325
- progressPercent: number | null;
326
- resultRows: number | null;
327
- rowsProcessed: number | null;
328
- executionTimeMs: number | null;
329
- metrics: QueryStreamMetrics;
330
- phase: string | null;
331
- profile: QueryProfileProgressView | null;
332
- }
333
-
334
- /**
335
- * The layout of the plans of query profiles, the fields of `ProfileLayoutConfigT` of the generated FlatBuffer code
336
- */
337
- export interface ProfileLayoutView {
338
- levelHeight: number;
339
- nodeHeight: number;
340
- nodeMarginHorizontal: number;
341
- nodePaddingLeft: number;
342
- nodePaddingRight: number;
343
- iconWidth: number;
344
- iconMarginRight: number;
345
- maxLabelChars: number;
346
- widthPerLabelChar: number;
347
- nodeMinWidth: number;
348
- nodeMarginVertical: number;
349
- /**
350
- * A `ProfileLayoutOrientation`
351
- */
352
- orientation: number;
353
- symbolWidth: number;
354
- }
355
-
356
- /**
357
- * The points in time of a query in milliseconds since epoch and its counters
358
- */
359
- export interface QueryMetricsView {
360
- queryRequestedAt: number | null;
361
- querySendingStartedAt: number | null;
362
- queryQueuedStartedAt: number | null;
363
- queryRunningStartedAt: number | null;
364
- receivedFirstBatchAt: number | null;
365
- receivedLastBatchAt: number | null;
366
- receivedAllBatchesAt: number | null;
367
- processingResultsStartedAt: number | null;
368
- processedResultsAt: number | null;
369
- querySucceededAt: number | null;
370
- queryFailedAt: number | null;
371
- queryCancelledAt: number | null;
372
- lastUpdatedAt: number | null;
373
- progressUpdatesReceived: number;
374
- queryDurationMs: number | null;
375
- textLength: number | null;
376
- streamMetrics: QueryStreamMetrics;
377
- }
378
-
379
- /**
380
- * The versions of the storage format of the module: of the storage root and of workbook files
381
- */
382
- export interface StorageVersions {
383
- /**
384
- * The storage version of the app, `storageVersion` of the manifest
385
- */
386
- storageVersion: number;
387
- /**
388
- * The workbook format version of the app, `formatVersion` of a workbook file
389
- */
390
- formatVersion: number;
391
- }
392
-
393
- /**
394
- * What a migration of the storage changed, with the versions it migrated to
395
- */
396
- export interface StorageMigrationOutcome {
397
- /**
398
- * The storage steps that ran
399
- */
400
- steps: number;
401
- /**
402
- * The workbook folders that were brought to the current workbook format
403
- */
404
- workbooks: number;
405
- /**
406
- * The storage version of the app
407
- */
408
- storageVersion: number;
409
- /**
410
- * The workbook format version of the app
411
- */
412
- formatVersion: number;
413
- }
414
-
415
- /**
416
- * An event of a script of a run
417
- */
418
- export type WorkbookScriptRunEvent = { type: "planned"; follows: string[] } | { type: "cached"; key: string; queryId: number } | { type: "skipped"; reason: string } | { type: "started" } | { type: "done"; key: string | null; queryId: number | null } | { type: "failed"; failure: WorkbookRunFailure } | { type: "cancelled" };
419
-
420
- /**
421
- * How a run ended
422
- */
423
- export interface RunOutcome {
424
- /**
425
- * Why the run didn't start, e.g. another run holds the workbook, null for a run that started
426
- */
427
- refused: string | null;
428
- /**
429
- * The queries of the last outputs of the scripts in feed order
430
- */
431
- outputs: (number | null)[];
432
- failure: WorkbookRunFailure | null;
433
- /**
434
- * Did the run hand a statement to the executor?
435
- */
436
- launched: boolean;
437
- }
438
-
439
- /**
440
- * The options of a run of a script
441
- */
442
- export interface RunScriptOptions {
443
- /**
444
- * Read no cached results, neither of the script nor of the scripts it references
445
- */
446
- refresh?: boolean;
447
- }
448
-
449
- /**
450
- * The state of a run of a workbook
451
- */
452
- export interface WorkbookRunState {
453
- phase: WorkbookRunPhase;
454
- totalScripts: number;
455
- completedScripts: number;
456
- /**
457
- * The planned statements that run
458
- */
459
- totalStatements: number;
460
- completedStatements: number;
461
- /**
462
- * The script of the statement that started last
463
- */
464
- activeFileName: string | null;
465
- activeStatementIndex: number | null;
466
- activeStatementCount: number | null;
467
- error: string | null;
468
- /**
469
- * The scripts that the run left out: their connection can't run or could not be set up, they have no cached
470
- * result or follow a script that runs on such a connection
471
- */
472
- skippedScripts: number;
473
- skippedFiles: string[];
474
- }
475
-
476
- /**
477
- * The runs of a workbook, the slice `run` of the runtime
478
- */
479
- export interface WorkbookRunView {
480
- workbookId: string;
481
- /**
482
- * The run that holds the workbook, null while none does. The workbook starts no other run then.
483
- */
484
- held: WorkbookRunKind | null;
485
- /**
486
- * The state of the last run of the whole workbook, it stays once the run ended
487
- */
488
- state: WorkbookRunState | null;
489
- /**
490
- * The inputs whose change waits for the workbook
491
- */
492
- pendingInputs: string[];
493
- }
494
-
495
- /**
496
- * The phase of a run
497
- */
498
- export type WorkbookRunPhase = "planning" | "running" | "stopping" | "succeeded" | "failed" | "cancelled";
499
-
500
- /**
501
- * The failure of a run or of a script, what the platform failed with goes next to it
502
- */
503
- export interface WorkbookRunFailure {
504
- kind: WorkbookRunFailureKind;
505
- message: string;
506
- /**
507
- * The details of the error of a failed statement, e.g. what Trino said
508
- */
509
- details: Record<string, string>;
510
- /**
511
- * The target of the log messages of the error of a failed statement
512
- */
513
- target: string | null;
514
- /**
515
- * The query of the statement that failed, null for a failure of no statement
516
- */
517
- queryId: number | null;
518
- /**
519
- * Did the platform fail with a value? It goes next to the failure.
520
- */
521
- hostValue: boolean;
522
- }
523
-
524
- /**
525
- * The options of a run of the scripts of a workbook
526
- */
527
- export interface RunWorkbookOptions {
528
- /**
529
- * Run the scripts that a change of these inputs affects. A run that holds the workbook stops, the run starts once
530
- * the workbook is free, with the inputs of every change since.
531
- */
532
- inputs?: string[];
533
- /**
534
- * Run these scripts with what they need, by their indexes in feed order, every script without
535
- */
536
- targets?: number[];
537
- /**
538
- * Read no cached results: the scripts run, the results with reusable keys become the newest files of their keys
539
- */
540
- refresh?: boolean;
541
- /**
542
- * Analyze the results of the outputs on the compute database, true by default. The command line tool prints them.
543
- */
544
- analyze?: boolean;
308
+ /** The `.dashql` archives of the platform. An archive that is read is a Blob of the handle table, the platform keeps its reader until `close`. */
309
+ export interface RuntimeArchives {
310
+ /** Write an archive of the entries in order, resolves with its Blob */
311
+ write(entries: RuntimeArchiveEntry[]): Promise<Blob>;
312
+ /** The bytes of an archive of the handle table, e.g. for a link */
313
+ bytes(archive: number): Promise<Uint8Array>;
314
+ /** The entries of an archive, the runtime normalizes their names to NFC */
315
+ entries(archive: number): Promise<{ filename: string; directory: boolean }[]>;
316
+ /** The text of an entry */
317
+ readText(archive: number, index: number): Promise<string>;
318
+ /** A workbook table of a Parquet entry as Arrow IPC */
319
+ readTable(archive: number, index: number): Promise<Uint8Array>;
320
+ /** A file entry: a slice of the archive with the CRC-32 of the entry if it is stored and `slice` is set, else its bytes checked against the CRC-32 */
321
+ readFile(archive: number, index: number, slice: boolean): Promise<{ file: Blob; crc32: number | null }>;
322
+ /** Close the reader of an archive */
323
+ close(archive: number): Promise<void>;
545
324
  }
546
325
 
547
- /**
548
- * The run that holds a workbook: a run of the whole workbook or of one of its scripts
549
- */
550
- export type WorkbookRunKind = "workbook" | "script";
551
-
552
- /**
553
- * Why a run failed
554
- */
555
- export type WorkbookRunFailureKind = "plan" | "cancelled" | "error";
556
-
557
-
558
- /** A file to attach to a workbook, with the name it was dropped with */
559
- export interface AttachedFile {
560
- name: string;
561
- file: Blob | Uint8Array;
326
+ /** A workbook folder that an import reads: a native folder, a folder of the browser, a hosted workbook */
327
+ export interface RuntimeImportFolder {
328
+ /** A top-level file or a catalog file of a connection (`connections/<id>/<file>`), null if missing */
329
+ readText(path: string): Promise<string | null>;
330
+ /** The script files, given the scripts that the workbook file lists */
331
+ scripts(listed: string[]): Promise<{ name: string; sql: string }[]>;
332
+ /** The attachments, given the attachments that the workbook file lists */
333
+ attachments(listed: string[]): Promise<{ name: string; file: Blob | Uint8Array }[]>;
334
+ /** The prefix of the errors, e.g. "Invalid remote workbook" */
335
+ readonly errorPrefix?: string;
336
+ /** Metadata of the source that the workbook file takes, e.g. the URL of a hosted workbook */
337
+ readonly metadata?: unknown;
338
+ /** The folder of a native workbook that is registered in place */
339
+ readonly nativePath?: string | null;
562
340
  }
563
341
 
342
+ /** The source of an import: a `.dashql` archive (a Blob of the handle table), a workbook folder, or the workbook tables with the rows of each table as Arrow IPC and the Parquet files of the data tables */
343
+ export type ImportSource =
344
+ | { archive: number }
345
+ | { folder: RuntimeImportFolder }
346
+ | { tables: { rows: Record<string, Uint8Array>; data: { tableName: string; file: Blob | Uint8Array; crc32?: number | null }[]; errorPrefix?: string } };
564
347
 
565
- /**
566
- * What an attach did
567
- */
568
- export interface AttachFilesOutcome {
569
- /**
570
- * The attachments that were written or wait for a hold of the workbook, in the order of the files
571
- */
572
- attached: AttachedFileName[];
573
- /**
574
- * The files that are no attachments (Parquet files only), by their names
575
- */
576
- refused: string[];
577
- }
348
+ /** A step of the commit of an import */
349
+ export type ImportStep = 'results' | 'workbook' | 'scripts' | 'attachments' | 'open';
578
350
 
579
- /**
580
- * A file that was attached, with the name it got
581
- */
582
- export interface AttachedFileName {
583
- /**
584
- * The name the file was dropped with
585
- */
586
- name: string;
587
- /**
588
- * The file name of the attachment, its table parameter takes no name of a script or another attachment
589
- */
590
- fileName: string;
351
+ /** The workbook tables of an export */
352
+ export interface ExportedTables {
353
+ /** The rows of the workbook tables by table name */
354
+ rows: Record<string, Record<string, string | number | boolean | null>[]>;
355
+ /** The Parquet files of the attachment and result tables by handle */
356
+ data: { tableName: string; file: number; size: number; crc32: number | null }[];
591
357
  }
592
358
 
593
- /**
594
- * The rows that a data search matched with their matching columns, the table by its handle
595
- */
596
- export interface ComputationDataSearchTable {
597
- dataTable: number;
598
- rows: number;
599
- dataFrame: number;
600
- inputRowNumberColumnName: string;
601
- version: ComputationVersionValue;
602
- requestId: number;
603
- }
359
+ /** A channel of the host that a setup asks the host to connect: the embedded Hyper, or Hyper over gRPC through the native proxy. The runtime speaks Trino, Hyper over HTTP and the Hyper of Salesforce itself. */
360
+ export type RuntimeChannelRequest = { type: 'hyper'; kind: 'embedded' | 'grpc'; params: any };
604
361
 
605
- /**
606
- * A key of an ordering, ascending and nulls last without
607
- */
608
- export interface ComputationOrderBy {
609
- field: string;
610
- ascending?: boolean;
611
- nullsFirst?: boolean;
362
+ /** How the platform takes the user through the redirect page */
363
+ export interface RuntimeOAuthFlowInfo {
364
+ redirectVariant: 'WEB_OPENER_FLOW' | 'NATIVE_LINK_FLOW';
365
+ redirectCallbackUrl: string | null;
366
+ debugMode: boolean;
367
+ flavor: string | null;
612
368
  }
613
-
614
- /**
615
- * The version of a computation: the data changes with a new data frame, the filter with every scheduled filtering
616
- */
617
- export interface ComputationVersionValue {
618
- data: number;
619
- filter: number;
369
+ /** The OAuth flows of the platform. A flow belongs to a setup by the id of the setup, `abort` with the id of the flow stops it: the runtime aborts a flow that it stops waiting for, e.g. a cancelled setup, which closes the loopback server or the window of the flow. */
370
+ export interface RuntimeOAuth {
371
+ /** A PKCE challenge: a random verifier and the base64url of its SHA-256 digest */
372
+ pkce(): Promise<{ value: string; verifier: string }>;
373
+ flowInfo(setupId: string): RuntimeOAuthFlowInfo;
374
+ /** Open the authorization URL and wait for the loopback redirect. The events are 'WINDOW_OPENED', 'WINDOW_CLOSED' and 'EXTERNAL_BROWSER_OPENED'. */
375
+ authorizeWithLoopback(setupId: string, flow: number, url: string, callbackUrl: string, onEvent: (event: string) => void): Promise<{ code?: string; state?: string; error?: string; errorDescription?: string }>;
376
+ /** Open the authorization URL and wait for the callback of the redirect page whose state has the flow id */
377
+ authorizeWithRedirectPage(setupId: string, flow: number, url: string, flowId: string, onEvent: (event: string) => void): Promise<unknown>;
378
+ abort(flow: number): void;
620
379
  }
621
380
 
622
- /**
623
- * The context of a call of the compute platform: the computation, the title of its task in the query history, the
624
- * connection and the client context of the computation, and the run that `cancel` aborts
625
- */
626
- export interface ComputeCallContext {
627
- tableId: number;
628
- title: string;
629
- connectionId: string | null;
630
- /**
631
- * The client context of the queries of a computation without a connection, opaque JSON
632
- */
633
- clientContext: string | null;
634
- run: number;
381
+ /** The handle table of the host */
382
+ export interface RuntimeHandles {
383
+ /** Keep an object under a new handle */
384
+ register(object: unknown): number;
385
+ /** Forget the object of a handle */
386
+ release(handle: number): void;
387
+ /** The object of a handle */
388
+ get(handle: number): unknown;
389
+ /** Keep the object of a handle under a new handle as well, e.g. a result table that a computation takes too */
390
+ duplicate(handle: number): number;
391
+ /** Close the object of a handle, the handle stays until its release. The runtime closes at once with it and releases the handle with the changes, without it the store closes and releases. */
392
+ close?(handle: number): void;
393
+ /** Abort the object of a handle with a reason, the runtime aborts at once with it and leaves the abort to the store without it */
394
+ abort?(handle: number, reason: string): void;
635
395
  }
636
396
 
637
- /**
638
- * The selection in the summary of a column group
639
- */
640
- export type ComputationCrossFilter = { kind: "histogram"; column: number; selection: [number, number] } | { kind: "mostFrequent"; column: number; valueId: number };
397
+ /** The Arrow tables of the host by handle */
398
+ export interface RuntimeTables {
399
+ /** Begin a table with an Arrow IPC stream, its schema and maybe batches, returns its handle */
400
+ begin(ipc: Uint8Array): number;
401
+ /** Append the batches of an Arrow IPC stream to a table that began */
402
+ append(table: number, ipc: Uint8Array): void;
403
+ /** Open a table that streams in parts of one Arrow IPC stream, a message may span parts. A channel of the host pushes its batches into it. */
404
+ open(): number;
405
+ /** Push the next part of the Arrow IPC stream of a table that was opened */
406
+ push(table: number, part: Uint8Array): void;
407
+ /** Finish a table, it is a table of the handle table from then on */
408
+ finish(table: number): { rows: number; bytes: number; columns: number; batches: number };
409
+ /** A table of the handle table as an Arrow IPC stream, for the small tables that the runtime parses, e.g. the results of the metadata queries of the catalog loader */
410
+ read(table: number): Uint8Array;
411
+ /** The rows of a table of the handle table and its schema as an Arrow IPC stream without batches, the rows stay with the host */
412
+ describe(table: number): { rows: number; schema: Uint8Array };
413
+ }
641
414
 
642
- /**
643
- * A column of the grid of a result
644
- */
645
- export type ComputationColumnGroup = { type: "ROWNUMBER"; value: { rowNumberFieldName: string } } | { type: "SKIPPED"; value: { inputFieldName: string; inputFieldType: string; inputFieldNullable: boolean } } | { type: "ORDINAL"; value: ComputationValueColumn } | { type: "STRING"; value: ComputationValueColumn } | { type: "LIST"; value: ComputationValueColumn };
415
+ /** A request of the runtime for the HTTP client of the host */
416
+ export interface RuntimeHttpRequest {
417
+ method: string;
418
+ url: string;
419
+ headers: [string, string][];
420
+ body: string | null;
421
+ /** The request or its response carries credentials, e.g. a token request: the host keeps no record of their bodies and headers */
422
+ sensitive: boolean;
423
+ }
424
+ /** A response of the HTTP client of the host */
425
+ export interface RuntimeHttpResponse {
426
+ status: number;
427
+ statusText: string;
428
+ headers: [string, string][];
429
+ body: Uint8Array;
430
+ }
431
+ /** Fetch of the platform: `abort` with the id of a request stops it */
432
+ export interface RuntimeHttp {
433
+ fetch(id: number, request: RuntimeHttpRequest): Promise<RuntimeHttpResponse>;
434
+ abort(id: number): void;
435
+ }
646
436
 
647
- /**
648
- * The fields of the table aggregation with the statistics of a column
649
- */
650
- export interface ComputationStatsFields {
651
- countFieldName: string;
652
- distinctCountFieldName: string | null;
653
- minAggregateFieldName: string | null;
654
- maxAggregateFieldName: string | null;
437
+ /** What a channel of the host reports while it streams a result, the batches go into the table of the query */
438
+ export type RuntimeChannelMessage =
439
+ | { type: 'progress'; progress: QueryProgressView }
440
+ | { type: 'batch'; metrics: QueryStreamMetrics }
441
+ | { type: 'end'; metrics: QueryStreamMetrics };
442
+ /** A query on a channel of the host, what the host needs to run it there */
443
+ export interface RuntimeChannelQuery {
444
+ text: string;
445
+ /** The time to wait for the next batch, null for the default of the channel */
446
+ readTimeoutMs: number | null;
447
+ /** Collect the result, a statement whose output nothing reads drains it */
448
+ publishResults: boolean;
449
+ /** The name of the connector, e.g. for the error of a channel that is not set up */
450
+ connector: string;
451
+ /** Is the query a call of a client function? The runtime sends its requests itself, the host names only the tokens of a Salesforce channel. */
452
+ clientFunction: boolean;
453
+ }
454
+ /** The channels of the host. The setups connect them, the queries of the host run on them by query: the host knows the channel of a query from the query it described. */
455
+ export interface RuntimeChannels {
456
+ /** Connect a channel of a setup, returns its handle. A channel that the runtime stops waiting for is closed once it is connected. */
457
+ connect(setupId: string, request: RuntimeChannelRequest): Promise<number>;
458
+ /** The token of the link to a Hyper that the page holds, null without */
459
+ hyperLinkToken(connectionId: string): string | null;
460
+ /** Describe a query on a channel of the host (null before its setup) as `{ type: 'host' }`. The connections own the channels that the runtime speaks itself (Trino, Hyper over HTTP, the Hyper of Salesforce), the host never describes them. The host keeps the channel and the query until `forget`. */
461
+ describe(queryId: number, channel: number | null, query: RuntimeChannelQuery): Promise<RuntimeChannelTarget>;
462
+ /** The query ended */
463
+ forget(queryId: number): void;
464
+ /** Run a query on its channel, its batches go into the table that was opened for it. False if the channel returned no result. */
465
+ open(queryId: number, table: number): Promise<boolean>;
466
+ /** The next message of the stream of a query */
467
+ next(queryId: number): Promise<RuntimeChannelMessage>;
468
+ /** Cancel the query of a channel: one that `open` still opens, the open then fails or returns a stream that the next cancel stops, or its stream at the backend */
469
+ cancel(queryId: number): Promise<void>;
470
+ /** Is the profile of the query shown? A channel fetches the plan and its statistics only then. */
471
+ profileDetail(queryId: number, shown: boolean): void;
655
472
  }
656
473
 
657
- /**
658
- * The table and the data frame of a summary
659
- */
660
- export interface ComputationColumnSummary {
661
- table: number;
662
- dataFrame: number;
663
- analysis: ComputationSummaryAnalysis | null;
474
+ /** The query result cache of the platform, Parquet files that the compute database reads and writes */
475
+ export interface RuntimeResultCache {
476
+ /** The newest file of a key, null on a miss */
477
+ lookup(key: string): Promise<{ name: string; cachedAt: number; size: number } | null>;
478
+ /** Read a file into a table of the handle table */
479
+ read(name: string): Promise<RuntimeCachedTable>;
480
+ /** Record a read of a file */
481
+ touch(name: string): Promise<void>;
482
+ /** Write a table of the handle table as the newest file of a key, resolves with the name of the file */
483
+ write(key: string, table: number): Promise<string>;
484
+ /** Keep the newest file of a key until `release`, null on a miss */
485
+ retain(key: string): Promise<{ id: number; name: string } | null>;
486
+ /** Release a file that `retain` or `pin` of the mounts kept */
487
+ release(id: number): Promise<void>;
488
+ /** The Blob of a file, e.g. one that `retain` kept for an export */
489
+ file(name: string): Promise<Blob>;
490
+ /** Add a result of a key from a file of the handle table, checked against the CRC-32. Resolves false if the key was cached already, the files of the app win. */
491
+ import(key: string, file: number, crc32: number | null): Promise<boolean>;
492
+ /** The limits of the files, the runtime evicts the least recently read files beyond them after every write of a file of a key */
493
+ capacity(): { maxBytes: number; maxFiles: number };
494
+ /** The Parquet files with their sizes, their write times and the times they were read last (the write time if never), for the eviction */
495
+ files(): Promise<{ name: string; size: number; mtimeMs: number; lastAccessMs: number }[]>;
496
+ /** Remove a file and its marker if nobody reads it, resolves false if the file is read and stays */
497
+ remove(name: string): Promise<boolean>;
664
498
  }
665
499
 
666
- /**
667
- * The rows that pass the filters, the table by its handle
668
- */
669
- export interface ComputationFilterTable {
670
- dataTable: number;
671
- rows: number;
672
- dataFrame: number;
673
- inputRowNumberColumnName: string;
674
- version: ComputationVersionValue;
500
+ /** The files of the runs of workbooks in the compute database, the files of the query result cache. The runtime keeps the pins of a run, releases them with `release` of the cache once the run settled and then removes its transient files with `remove`. */
501
+ export interface RuntimeMounts {
502
+ /** The directory of the files of the runs, the files of the query result cache; null without the cache */
503
+ prefix(): string | null;
504
+ /** The name of a new file of the result of a script: a file of its key if the key is reusable, a transient file otherwise */
505
+ fileName(key: string | null): string;
506
+ /** Mount the files in the compute database and pin a file at a path below the prefix, also one that is about to be written. Resolves with the id that `release` of the cache releases it with. */
507
+ pin(path: string): Promise<number>;
508
+ /** Write a table of the handle table as Parquet file at a path below the prefix that is pinned, resolves with its rows */
509
+ write(path: string, table: number): Promise<number>;
510
+ /** Mount the attachments of a workbook */
511
+ attachments(workbookId: string): Promise<void>;
512
+ /** The columns of a Parquet attachment of a workbook */
513
+ attachmentColumns(workbookId: string, fileName: string): Promise<string[]>;
514
+ /** Unmount the attachments of a workbook that was deleted */
515
+ dropAttachments(workbookId: string): Promise<void>;
675
516
  }
676
517
 
677
- /**
678
- * The tasks that a computation tracks
679
- */
680
- export interface ComputationTasks {
681
- tableAggregationTask: ComputationTrackedTask | null;
682
- systemColumnTask: ComputationTrackedTask | null;
683
- filteringTask: ComputationTrackedTask | null;
684
- orderingTask: ComputationTrackedTask | null;
685
- dataSearchTask: ComputationTrackedTask | null;
686
- columnAggregationTasks: (ComputationTrackedTask | null)[];
687
- filteredColumnAggregationTasks: (ComputationTrackedTask | null)[];
518
+ /** The compute database of the computations, the embedded Hyper of the platform. The context of a call names the computation, the title of its task, the connection and the client context of the computation, and the run that `cancel` aborts. Result data never enters the module: a result is imported as the Arrow table of its handle, the tables that the tasks read stay Arrow tables, the runtime reads only the small ones that it parses as Arrow IPC streams. */
519
+ export interface ComputePlatform {
520
+ /** Create the table of a data frame from an Arrow table of the handle table, with its rows numbered from 1 in an appended column of 64-bit integers that can't be null */
521
+ importTable(dataFrame: number, tableName: string, table: unknown, rowNumberField: string, context: ComputeCallContext): Promise<void>;
522
+ /** Create the table of a data frame from a SELECT, the host tracks the SELECT as a query of the task */
523
+ createTable(dataFrame: number, tableName: string, sql: string, context: ComputeCallContext): Promise<void>;
524
+ /** Run a query whose small result the runtime parses, resolves to its result as an Arrow IPC stream */
525
+ query(sql: string, context: ComputeCallContext): Promise<Uint8Array>;
526
+ /** Run a query, resolves to its result as an Arrow table that the runtime keeps in the handle table */
527
+ queryTable(sql: string, context: ComputeCallContext): Promise<unknown>;
528
+ /** Drop the table of a data frame */
529
+ dropTable(dataFrame: number, tableName: string): Promise<void>;
530
+ /** Abort the calls of a run */
531
+ cancel(run: number): void;
688
532
  }
689
533
 
690
- /**
691
- * What is searched, the columns by their names or the data
692
- */
693
- export type ComputationSearchKind = "columns" | "data";
694
534
 
695
535
  /**
696
- * The summary of a column over the rows that the filters and the data search select
536
+ * A cached result that the query result cache read into a table of the handle table
697
537
  */
698
- export interface ComputationFilteredAggregate {
699
- aggregate: ComputationColumnAggregate;
700
- filterVersion: ComputationVersionValue;
701
- dataSearchRequestId: number | null;
538
+ export interface RuntimeCachedTable {
539
+ table: number;
540
+ rows: number;
541
+ columns: number;
702
542
  }
703
543
 
704
544
  /**
705
- * The summary of a column: the table of the binned or the frequent values by its handle, with its analysis
545
+ * Where a query of a channel of the host runs, as the platform describes it: the channel of the host. The connections
546
+ * own the channels that the module speaks itself (Trino, Hyper over HTTP, the Hyper of Salesforce), the platform never
547
+ * describes them.
706
548
  */
707
- export type ComputationColumnAggregate = ({ kind: "ordinal" } & ComputationColumnSummary) | ({ kind: "string" } & ComputationColumnSummary) | ({ kind: "list" } & ComputationColumnSummary) | { kind: "skipped" };
549
+ export type RuntimeChannelTarget = { type: "host" };
708
550
 
709
551
  /**
710
- * What the lower bounds of the bins of a histogram are
552
+ * An effect of the runtime on a handle of the host, applied by the store when it takes the changes
711
553
  */
712
- export type ComputationBinBounds = "numbers" | "epochMillis";
554
+ export type HandleEffect = { type: "release"; handle: number } | { type: "close"; handle: number } | { type: "abort"; handle: number; reason: string };
713
555
 
714
556
  /**
715
- * The value column of a column group, ordinal, string or list
557
+ * A hold of the writer (no workbook) or of a workbook
716
558
  */
717
- export interface ComputationValueColumn {
718
- inputFieldName: string;
719
- /**
720
- * The type of the field as the runtime names it, the app reads the Arrow type from the schema of the table
721
- */
722
- inputFieldType: string;
723
- inputFieldNullable: boolean;
724
- statsFields: ComputationStatsFields | null;
725
- /**
726
- * The bins of an ordinal column, null without
727
- */
728
- binFieldName: string | null;
729
- /**
730
- * The number of bins of an ordinal column, 0 without
731
- */
732
- binCount: number;
733
- /**
734
- * The value ids of a string or a list column, null without
735
- */
736
- valueIdFieldName: string | null;
559
+ export interface StorageHoldView {
560
+ workbookId: string | null;
561
+ reason: StorageHoldReason;
562
+ count: number;
737
563
  }
738
564
 
739
565
  /**
740
- * The numbers of the analysis of a summary that the runtime computed. The app formats the values of the tables: the
741
- * minimum and the maximum of the statistics, the lower bounds of the bins and the frequent values.
742
- */
743
- export type ComputationSummaryAnalysis = { kind: "ordinal"; totalCount: number; countNotNull: number; countNull: number; binCount: number; binValueCounts: number[]; binPercentages: number[]; binLowerBounds: (number | null)[]; binBounds: ComputationBinBounds } | { kind: "string"; totalCount: number; countNotNull: number; countNull: number; countDistinct: number; isUnique: boolean; frequentValueIds: number[]; frequentValueCounts: number[]; frequentValuePercentages: number[] };
744
-
745
- /**
746
- * The view of the computation of a result table. The tables are handles of the platform, the data frames ids of
747
- * the compute database.
566
+ * A write that failed. One that failed for a moment runs again after a backoff, one whose target is gone stops
567
+ * (`permanent`) until a newer write of its key or until the app discards it (`storageDiscardWrites`).
748
568
  */
749
- export interface ComputationView {
750
- tableId: number;
751
- revision: number;
752
- connectionId: string | null;
569
+ export interface FailedStorageWriteView {
570
+ key: string;
753
571
  /**
754
- * The client context of the queries of a computation without a connection, opaque JSON
572
+ * The workbook of the key, null for the files of the app
755
573
  */
756
- clientContext: string | null;
757
- tasks: ComputationTasks;
758
- version: ComputationVersionValue;
574
+ workbookId: string | null;
759
575
  /**
760
- * The table, with the system columns once they are computed
576
+ * The last error
761
577
  */
762
- dataTable: number;
763
- dataTableRows: number;
578
+ error: string;
764
579
  /**
765
- * The fields of the table that the computation was created with, in order
580
+ * The failed attempts in a row
766
581
  */
767
- dataTableFields: string[];
768
- dataFrame: number | null;
582
+ attempts: number;
769
583
  /**
770
- * The column groups of the grid
584
+ * The target of the write is gone, e.g. a moved workbook folder: the writer stopped retrying it
771
585
  */
772
- columnGroups: ComputationColumnGroup[];
773
- dataTableOrdering: ComputationOrderBy[];
586
+ permanent: boolean;
587
+ }
588
+
589
+ /**
590
+ * The statistics of a key: the scheduled writes of the key and the writes of its file
591
+ */
592
+ export interface StorageWriteStatistics {
593
+ scheduledWrites: number;
594
+ writes: number;
595
+ writtenBytes: number;
596
+ writeTimeMs: number;
774
597
  /**
775
- * The selections in the summaries of the column groups, in the order of the column groups
598
+ * The time of the last write in milliseconds since the epoch
776
599
  */
777
- crossFilters: ComputationCrossFilter[];
778
- filterTable: ComputationFilterTable | null;
779
- orderingTable: ComputationOrderingTable | null;
780
- columnSearch: ComputationSearch;
781
- dataSearch: ComputationSearch;
782
- dataSearchTable: ComputationDataSearchTable | null;
783
- rowNumberColumnGroup: number | null;
784
- rowNumberColumnName: string | null;
785
- tableAggregation: ComputationTableAggregation | null;
786
- columnAggregates: (ComputationColumnAggregate | null)[];
787
- filteredColumnAggregates: (ComputationFilteredAggregate | null)[];
788
- filteredColumnAggregatesOutdated: boolean[];
600
+ lastWriteMs: number | null;
789
601
  }
790
602
 
791
603
  /**
792
- * The comparison of a scalar filter
604
+ * The outcome of a write. A failed write carries what the host failed with, a patch of a workbook file that is not
605
+ * available names the workbook.
793
606
  */
794
- export type ComputationFilterOp = "=" | "<" | "<=" | ">" | ">=";
607
+ export type StorageWriteOutcome = { status: "written" } | { status: "superseded" } | { status: "cancelled" } | { status: "deferred" } | { status: "failed"; error: unknown; unavailableWorkbook?: string };
795
608
 
796
609
  /**
797
- * A task that a computation tracks, the latest of its kind
610
+ * The statistics of the writes of a key, with the key within its workbook for display
798
611
  */
799
- export interface ComputationTrackedTask {
800
- /**
801
- * The task of the scheduler
802
- */
803
- taskId: number;
804
- /**
805
- * The version that the task computes for
806
- */
807
- tableVersion: ComputationVersionValue;
808
- /**
809
- * The filters of a filtering
810
- */
811
- filters?: ComputationScalarFilter[];
612
+ export interface StorageKeyStatistics {
613
+ key: string;
812
614
  /**
813
- * The ordering of an ordering, cleared with the ordering of the table
615
+ * The key without the prefix of its workbook, e.g. `scripts/a.sql:delete`
814
616
  */
815
- orderingConstraints?: ComputationOrderBy[];
816
- progress: ComputationTaskProgress;
617
+ label: string;
618
+ statistics: StorageWriteStatistics;
817
619
  }
818
620
 
819
621
  /**
820
- * A filter that compares a field with a number
622
+ * Why the writes of the writer or of a workbook are held
821
623
  */
822
- export interface ComputationScalarFilter {
823
- fieldName: string;
824
- op: ComputationFilterOp;
825
- value: number;
624
+ export type StorageHoldReason = "externalChange" | "reload" | "import" | "handover" | "pause";
625
+
626
+ /**
627
+ * A workbook of the list of the workbooks
628
+ */
629
+ export interface WorkbookListEntry {
630
+ workbookId: string;
631
+ name: string | null;
632
+ ephemeral: boolean;
633
+ /**
634
+ * Is the workbook a read-only look at a version of a published workbook?
635
+ */
636
+ cloudPreview: boolean;
826
637
  }
827
638
 
828
639
  /**
829
- * The statistics of all columns of a table, the table by its handle
640
+ * A change of the text of a script in the offset unit of the editors
830
641
  */
831
- export interface ComputationTableAggregation {
832
- table: number;
833
- dataFrame: number;
834
- countStarFieldName: string;
642
+ export interface WorkbookTextChange {
643
+ from: number;
644
+ to: number;
645
+ insert: string;
835
646
  }
836
647
 
837
648
  /**
838
- * The options of the analysis of a result
649
+ * What the runtime derives from the scripts of a workbook with the planner: the checked script references, the
650
+ * dataflow and the inputs. The text spans are in the offset unit of the editors.
839
651
  */
840
- export interface AnalyzeTableOptions {
652
+ export interface WorkbookDerivedView {
653
+ workbookId: string;
841
654
  /**
842
- * The connection that ran the query of the result, its query history lists the queries of the computation
655
+ * The keys of the scripts in the order of the derived buffers, the feed order
843
656
  */
844
- connectionId?: string;
657
+ scriptKeys: number[];
845
658
  /**
846
- * The client context of the queries of a computation without a connection, opaque JSON
659
+ * The file names of the scripts in the order of the derived buffers, the references name scripts by index
847
660
  */
848
- clientContext?: string;
661
+ scriptFiles: string[];
849
662
  /**
850
- * Compute the summaries of the columns, true without
663
+ * The file names of the attachments in the order that the references name them by index
851
664
  */
852
- columnAggregates?: boolean;
665
+ attachments: string[];
666
+ references: FlatBuffer<buffers_execution.ScriptReferenceCheck>;
667
+ dataflow: FlatBuffer<buffers_execution.SessionDataflow>;
668
+ inputs: FlatBuffer<buffers_execution.SessionInputs>;
853
669
  /**
854
- * Order the rows before the analysis settles, e.g. like a result that the result replaces. An ordering of fields
855
- * that the result doesn't have is skipped.
670
+ * The hashes of the references, the dataflow and the inputs: a buffer with the hash of the previous view has its
671
+ * bytes
856
672
  */
857
- ordering?: ComputationOrderBy[];
673
+ hashes: [string, string, string];
858
674
  }
859
675
 
860
676
  /**
861
- * The progress of a task, times in milliseconds since epoch
677
+ * A script as the workbook file lists it: its name and the connection it names
862
678
  */
863
- export interface ComputationTaskProgress {
864
- status: TaskStatus;
865
- startedAt: number;
866
- completedAt: number | null;
867
- failedAt: number | null;
868
- failedWithError: string | null;
679
+ export interface WorkbookScriptListEntry {
680
+ name: string;
681
+ connectionId: string;
869
682
  }
870
683
 
871
684
  /**
872
- * The search of a result, of its columns or of its data
685
+ * The visualization of a script, the compiled visualization is null when the host holds the one of the key
873
686
  */
874
- export interface ComputationSearch {
875
- requestedPattern: string;
876
- appliedPattern: string;
877
- requestId: number;
878
- appliedRequestId: number;
879
- matchingColumnGroups: number[] | null;
687
+ export interface WorkbookScriptVisualization {
688
+ key: number;
880
689
  /**
881
- * Does the search hold matching rows? They are the rows of the table of the data search.
690
+ * The SQL of the query
882
691
  */
883
- hasMatchingRows: boolean;
884
- pending: boolean;
885
- error: string | null;
692
+ sql: string;
693
+ /**
694
+ * The statement with the tags
695
+ */
696
+ statementId: number;
697
+ visualization: FlatBuffer<buffers_execution.CompiledVisualization> | null;
886
698
  }
887
699
 
888
700
  /**
889
- * The row numbers in the order of the grid, the table by its handle
701
+ * The dashboard placement of a script, the `@board` tag of its last statement
890
702
  */
891
- export interface ComputationOrderingTable {
892
- dataTable: number;
893
- rows: number;
894
- dataFrame: number;
895
- inputRowNumberColumnName: string;
896
- orderingConstraints: ComputationOrderBy[];
897
- version: ComputationVersionValue;
898
- dataSearchRequestId: number | null;
899
- }
900
-
901
-
902
- /** The slices of the runtime by kind: the id of a slice, its view, and the keys of the payloads of its view that the host holds */
903
- export interface RuntimeViews {
904
- computation: { id: number; view: ComputationView; known: undefined };
905
- connectionList: { id: 'root'; view: ConnectionListView; known: undefined };
906
- connection: { id: string; view: ConnectionView; known: undefined };
907
- query: { id: number; view: QueryView; known: (QueryProfileKeys | null)[] };
908
- workbookList: { id: 'root'; view: WorkbookListView; known: undefined };
909
- workbook: { id: string; view: WorkbookView; known: undefined };
910
- script: { id: number; view: WorkbookScriptView; known: (WorkbookScriptKeys | null)[] };
911
- workbookDerived: { id: string; view: WorkbookDerivedView; known: undefined };
912
- storage: { id: 'root'; view: StorageView; known: undefined };
913
- run: { id: string; view: WorkbookRunView; known: undefined };
914
- }
915
- /** A kind of slices of the runtime */
916
- export type ViewKind = keyof RuntimeViews;
917
- /** The id of a slice of a kind */
918
- export type ViewId<K extends ViewKind> = RuntimeViews[K]['id'];
919
- /** The view of a slice of a kind */
920
- export type ViewOf<K extends ViewKind> = RuntimeViews[K]['view'];
921
- /** The keys of the payloads that the host holds, they don't cross again */
922
- export type KnownKeys<K extends ViewKind> = RuntimeViews[K]['known'];
923
- /** The read of a slice that a task of the runtime holds: it moves with the next changes, the host keeps its view */
924
- export type BusyView = 'busy';
925
- export interface Runtime {
926
- /** The views of the slices of a kind, null for a slice that is gone, `'busy'` for one that a task holds. One crossing per kind and flush. */
927
- views<K extends ViewKind>(kind: K, ids: ViewId<K>[], known?: KnownKeys<K>): (ViewOf<K> | BusyView | null)[];
703
+ export interface WorkbookBoardPosition {
704
+ statementId: number;
705
+ row: number | null;
706
+ column: number | null;
707
+ width: number;
708
+ height: number;
928
709
  }
929
710
 
930
-
931
- /**
932
- * The slice that an action changes
933
- */
934
- export type Target = { computation: number } | { connection: string } | { workbook: string } | "app";
935
-
936
711
  /**
937
- * The actions of the runtime. An action changes the state in the call and returns its outcome; a failed action leaves
938
- * the state as it was.
712
+ * The keys of the payloads of a script that the host holds, the view leaves their bytes out
939
713
  */
940
- export type RuntimeAction = { kind: "deleteComputation" } | { kind: "orderBy"; value: { constraints: ComputationOrderBy[] } } | { kind: "histogramFilter"; value: { columnGroup: number; selection: [number, number] | null } } | { kind: "mostFrequentValueFilter"; value: { columnGroup: number; valueId: number | null } } | { kind: "clearCrossFilters" } | { kind: "setResultSearchPattern"; value: { search: ComputationSearchKind; pattern: string } } | { kind: "requestFilteredColumnAggregation"; value: { columnGroup: number } } | { kind: "createConnection"; value: { connectionId?: string; connectorType: ConnectorType; setupParams?: JsonParams; active?: boolean; params?: JsonParams; paramsDraft?: JsonParams; name?: string; cacheQueryResults?: boolean } } | { kind: "createWorkbook"; value: { workbookId?: string; connectionId: string; name?: string; ephemeral?: boolean; originalFileName?: string } } | { kind: "deleteWorkbook"; value: { workbookId: string } } | { kind: "createScript"; value: { index?: number; text?: string; base: string; connectionId?: string } } | { kind: "deleteScript"; value: { fileName: string } } | { kind: "renameScript"; value: { fileName: string; newName: string } } | { kind: "reorderScripts"; value: { order: string[] } } | { kind: "setScriptText"; value: { scriptKey: number; text: string; withDiff?: boolean } } | { kind: "acceptPendingDiff"; value: { scriptKey: number } } | { kind: "rejectPendingDiff"; value: { scriptKey: number } } | { kind: "setScriptVisSpec"; value: { scriptKey: number; spec: string } } | { kind: "setWorkbookInput"; value: { name: string; literal: string; scriptKeys: number[] } } | { kind: "analyzeOutdatedScript"; value: { scriptKey: number } } | { kind: "showScript"; value: { scriptKey: number; selected: boolean } } | { kind: "hideScript"; value: { scriptKey: number; selected: boolean } } | { kind: "renameWorkbook"; value: { name?: string } } | { kind: "setScriptConnection"; value: { fileName: string; connectionId: string } } | { kind: "setPendingConnection"; value: { connectionId: string } } | { kind: "replaceConnection"; value: { from: string; into: string } } | { kind: "detachConnection"; value: { from: string; into: string } } | { kind: "setWorkbookAttachments"; value: { files: WorkbookDataFile[] } } | { kind: "setCloudLink"; value: { link?: JsonValue } } | { kind: "setDraft"; value: { params: JsonParams } } | { kind: "discardDraft" } | { kind: "rename"; value: { name: string } } | { kind: "setQueryResultCaching"; value: { caching: boolean } } | { kind: "deleteConnection" } | { kind: "resetConnection" } | { kind: "relationsTouched"; value: { names: ConnectionTableName[] } } | { kind: "queryCacheDeleted"; value: { queryId: number } };
714
+ export interface WorkbookScriptKeys {
715
+ editorUpdate: string | null;
716
+ pendingDiff: number | null;
717
+ visualization: number | null;
718
+ /**
719
+ * The newest processing statistics, the host holds the older ones as well
720
+ */
721
+ statistics: number | null;
722
+ }
941
723
 
942
724
  /**
943
- * The id of a slice or of what an action created: a number or a string
725
+ * The workbooks in the order they were registered and the workbooks that were refused a load
944
726
  */
945
- export type SliceId = number | string;
727
+ export interface WorkbookListView {
728
+ workbooks: WorkbookListEntry[];
729
+ invalidWorkbooks: RestoredInvalidWorkbook[];
730
+ /**
731
+ * The name of a new workbook: the first of "Untitled", "Untitled 2", ... that no other workbook has
732
+ */
733
+ nextWorkbookName: string;
734
+ }
946
735
 
947
736
  /**
948
- * A slice that changed since the host took the changes, its revision is null if it went
737
+ * The cached result of a script: the reusable key of its result and when the newest file of the key was written
949
738
  */
950
- export interface SliceChange {
951
- kind: ViewKind;
952
- id: SliceId;
953
- revision: number | null;
739
+ export interface WorkbookScriptCachedResult {
740
+ key: string;
741
+ /**
742
+ * Milliseconds since the epoch
743
+ */
744
+ cachedAt: number;
954
745
  }
955
746
 
956
747
  /**
957
- * The changes since the host took them last: the changed slices and the effects on handles, in order
748
+ * A copy of a connection that the workbook file holds, its params are JSON
958
749
  */
959
- export interface ChangeSet {
960
- changes: SliceChange[];
961
- effects: HandleEffect[];
750
+ export interface WorkbookConnectionCopy {
751
+ connectionId: string;
752
+ params: string;
962
753
  }
963
754
 
964
755
  /**
965
- * What a dispatch did
756
+ * A workbook: its plain fields and its scripts in feed order. It lists the keys of its scripts, not their revisions:
757
+ * a change of a script changes the slice of the script and leaves the workbook alone.
966
758
  */
967
- export interface DispatchOutcome {
759
+ export interface WorkbookView {
760
+ workbookId: string;
761
+ name: string | null;
762
+ /**
763
+ * The metadata of the workbook file: the origin, whether it is ephemeral, the whole link to a cloud
764
+ */
765
+ workbookMetadata: JsonValue;
766
+ ephemeral: boolean;
767
+ /**
768
+ * The connection of the next appended script when no script determines it
769
+ */
770
+ pendingConnectionId: string | null;
771
+ cloud: WorkbookCloudLink | null;
772
+ /**
773
+ * Null until storage listed the files of the workbook
774
+ */
775
+ attachments: WorkbookAttachmentView[] | null;
968
776
  /**
969
- * Was the action applied? A failed action leaves the state as it was.
777
+ * The script list of the workbook file
970
778
  */
971
- ok: boolean;
779
+ scriptList: WorkbookScriptList;
972
780
  /**
973
- * Did the action change the state?
781
+ * The keys of the scripts in feed order
974
782
  */
975
- changed: boolean;
783
+ scriptKeys: number[];
976
784
  /**
977
- * The error of a failed action
785
+ * The file names of the scripts in feed order
978
786
  */
979
- error: string | null;
787
+ scriptOrder: string[];
980
788
  /**
981
- * What the action created: the id of a connection or of a query
789
+ * The connections of the scripts in feed order
982
790
  */
983
- id: SliceId | null;
791
+ scriptConnections: string[];
792
+ /**
793
+ * The connections that the workbook uses: of its scripts in the order they first use them, then the pending one
794
+ */
795
+ connectionIds: string[];
796
+ /**
797
+ * The connection that an appended script runs on, the one that `createScript` without a connection takes
798
+ */
799
+ nextScriptConnectionId: string | null;
984
800
  }
985
801
 
986
802
  /**
987
- * The type of a column of a workbook table
803
+ * The published workbook of a cloud that a workbook came from or was published to
988
804
  */
989
- export type WorkbookTableColumnType = "text" | "integer" | "boolean";
805
+ export interface WorkbookCloudLink {
806
+ workbookId: string;
807
+ versionId: string;
808
+ preview: boolean;
809
+ }
990
810
 
991
811
  /**
992
- * What an export writes
812
+ * The processing statistics of an analysis, null when the host holds the ones of the key
993
813
  */
994
- export type ExportFormat = "archive" | "link" | "tables";
814
+ export interface WorkbookScriptStatistics {
815
+ key: number;
816
+ statistics: FlatBuffer<buffers_editor.EditorProcessingStatistics> | null;
817
+ }
995
818
 
996
819
  /**
997
- * A column of a workbook table
820
+ * The script list of the workbook file
998
821
  */
999
- export interface WorkbookTableColumn {
1000
- name: string;
1001
- type: WorkbookTableColumnType;
1002
- nullable: boolean;
822
+ export interface WorkbookScriptList {
823
+ scripts: WorkbookScriptListEntry[];
824
+ connections: WorkbookConnectionCopy[];
1003
825
  }
1004
826
 
1005
827
  /**
1006
- * A workbook table of the format with its columns
828
+ * A staged rewrite of a script, the diff is null when the host holds the diff of the key
1007
829
  */
1008
- export interface WorkbookTableSchema {
1009
- name: string;
1010
- columns: WorkbookTableColumn[];
830
+ export interface WorkbookPendingDiff {
831
+ key: number;
832
+ /**
833
+ * The text before the rewrite
834
+ */
835
+ priorText: string;
836
+ diff: FlatBuffer<buffers_diff.ScriptDiff> | null;
1011
837
  }
1012
838
 
1013
839
  /**
1014
- * The cached results of the scripts of a workbook
840
+ * A script with its payloads
1015
841
  */
1016
- export interface ExportedResults {
1017
- /**
1018
- * The scripts with a cached result
1019
- */
1020
- cachedScripts: number;
842
+ export interface WorkbookScriptView {
843
+ key: number;
1021
844
  /**
1022
- * The scripts
845
+ * The workbook of the script
1023
846
  */
1024
- totalScripts: number;
847
+ workbookId: string;
848
+ revision: number;
1025
849
  /**
1026
- * The files of the results, one per key
850
+ * Names the session of the script, a script that moved to another connection has a new one. An editor event names
851
+ * it (`Runtime.applyEditorEvent`).
1027
852
  */
1028
- files: number;
853
+ sessionGeneration: number;
854
+ fileName: string;
855
+ connectionId: string;
856
+ unresolvedConnectionId: string | null;
857
+ analysisOutdated: boolean;
858
+ latestQueryId: number | null;
859
+ latestResultQueryId: number | null;
1029
860
  /**
1030
- * The bytes of the files. An archive stores them as they are, it grows by about as much.
861
+ * The cached result of a run of the script in the query result cache, null without one
1031
862
  */
1032
- bytes: number;
1033
- }
1034
-
1035
- /**
1036
- * What an export wrote
1037
- */
1038
- export interface ExportOutcome {
863
+ cachedResult: WorkbookScriptCachedResult | null;
864
+ externalChanges: WorkbookExternalChanges | null;
1039
865
  /**
1040
- * The archive, a Blob of the handle table that the caller releases
866
+ * What the views read of the analysis
1041
867
  */
1042
- archive: number | null;
868
+ annotations: WorkbookScriptAnnotations;
1043
869
  /**
1044
- * The link
870
+ * Names the editor update: the generation of the session and a serial that is unique across the scripts of the
871
+ * runtime. An update with the same key is the same update. `Runtime.applyEditorEvent` returns the key of its update,
872
+ * an event names the key of the update that the editor holds.
1045
873
  */
1046
- link: string | null;
874
+ editorUpdateKey: string | null;
875
+ editorUpdate: FlatBuffer<buffers_editor.EditorUpdate> | null;
876
+ pendingDiff: WorkbookPendingDiff | null;
877
+ visualization: WorkbookScriptVisualization | null;
1047
878
  /**
1048
- * The cached results that the export carries
879
+ * The processing statistics of the latest analyses, the oldest first
1049
880
  */
1050
- results: ExportedResults;
881
+ statistics: WorkbookScriptStatistics[];
1051
882
  }
1052
883
 
1053
884
  /**
1054
- * The options of the link of a connection
885
+ * An attachment of a workbook
1055
886
  */
1056
- export interface ConnectionLinkOptions {
1057
- /**
1058
- * Carry the login hint of the sharer in the params, true if absent
1059
- */
1060
- withLoginHint?: boolean;
1061
- /**
1062
- * The URL of the app that opens the link
1063
- */
1064
- linkBase: string;
887
+ export interface WorkbookAttachmentView {
888
+ fileName: string;
889
+ name: string;
890
+ sizeBytes: number;
891
+ mtimeMs: number;
892
+ columns: string[] | null;
1065
893
  }
1066
894
 
1067
895
  /**
1068
- * The options of an export of a workbook
896
+ * A script as storage holds it, on a connection of the runtime
1069
897
  */
1070
- export interface ExportOptions {
1071
- /**
1072
- * What the export writes
1073
- */
1074
- format?: ExportFormat;
1075
- /**
1076
- * Carry the cached query results of the scripts, a link never does
1077
- */
1078
- results?: boolean;
1079
- /**
1080
- * Carry the catalogs of the connections, true for files and tables and false for links if absent
1081
- */
1082
- withCatalog?: boolean;
1083
- /**
1084
- * Carry the login hint of the sharer in the params, true if absent
1085
- */
1086
- withLoginHint?: boolean;
898
+ export interface StoredScriptView {
899
+ name: string;
900
+ sql: string;
901
+ connectionId: string;
1087
902
  /**
1088
- * Keep the workbook and connection ids instead of fresh ones
903
+ * The connection that the workbook file names for the script while the app doesn't know it
1089
904
  */
1090
- preserveUuids?: boolean;
905
+ unresolvedConnectionId?: string;
906
+ }
907
+
908
+ /**
909
+ * What the views read of the analysis of a script: its tables, its positions on the canvas and the board, whether its
910
+ * last statement is a query and whether it runs only on request. Empty without an analysis.
911
+ */
912
+ export interface WorkbookScriptAnnotations {
1091
913
  /**
1092
- * The URL of the app that opens a link
914
+ * The names of the tables that the script defines, sorted
1093
915
  */
1094
- linkBase?: string;
916
+ tableDefs: string[];
917
+ flowPosition: WorkbookFlowPosition | null;
918
+ boardPosition: WorkbookBoardPosition | null;
919
+ lastStatementIsQuery: boolean;
920
+ manual: boolean;
1095
921
  }
1096
922
 
1097
923
  /**
1098
- * What a restore restored: the connections and the workbooks that the runtime took, in order, the workbooks that were
1099
- * refused a load and the progress
924
+ * The last change of the text of a script that the workbook made
1100
925
  */
1101
- export interface RestoreOutcome {
1102
- connectionIds: string[];
1103
- workbookIds: string[];
1104
- invalidWorkbooks: RestoredInvalidWorkbook[];
1105
- progress: RestoreProgress;
926
+ export interface WorkbookExternalChanges {
927
+ fromText: string;
928
+ changes: WorkbookTextChange[];
1106
929
  }
1107
930
 
1108
931
  /**
1109
- * A counter of the progress of a step of a restore
932
+ * The placement of a script on the dataflow canvas, its `@flow` tag
1110
933
  */
1111
- export interface RestoreProgressCounter {
1112
- started: number;
1113
- succeeded: number;
1114
- skipped: number;
1115
- failed: number;
1116
- /**
1117
- * Null until the total is known
1118
- */
1119
- total: number | null;
934
+ export interface WorkbookFlowPosition {
935
+ statementId: number;
936
+ x: number | null;
937
+ y: number | null;
938
+ width: number | null;
939
+ height: number | null;
1120
940
  }
1121
941
 
1122
942
  /**
1123
- * A script file of a workbook
943
+ * A data file of a workbook as storage lists it
1124
944
  */
1125
- export interface RestoreScriptFile {
945
+ export interface WorkbookDataFile {
1126
946
  name: string;
1127
- sql: string;
947
+ sizeBytes: number;
948
+ /**
949
+ * The time of the last modification, 0 without one
950
+ */
951
+ mtimeMs?: number;
1128
952
  }
1129
953
 
1130
954
  /**
1131
- * The progress of a restore
955
+ * The update of an editor event for the editor, with its key (`WorkbookScriptView.editorUpdateKey`)
1132
956
  */
1133
- export interface RestoreProgress {
1134
- restoreConnections: RestoreProgressCounter;
1135
- restoreCatalogs: RestoreProgressCounter;
1136
- restoreWorkbookScripts: RestoreProgressCounter;
957
+ export interface EditorEventOutcome {
958
+ update: FlatBuffer<buffers_editor.EditorUpdate>;
959
+ /**
960
+ * Names the update, the next event of the editor names it as the update that the editor holds
961
+ */
962
+ key: string;
1137
963
  }
1138
964
 
1139
965
  /**
1140
- * A workbook that failed its validation or couldn't be restored
966
+ * An event of a script of a run
1141
967
  */
1142
- export interface RestoredInvalidWorkbook {
1143
- workbookId: string;
1144
- title: string;
1145
- connectorType: ConnectorType | null;
968
+ export type WorkbookScriptRunEvent = { type: "planned"; follows: string[] } | { type: "cached"; key: string; queryId: number } | { type: "skipped"; reason: string } | { type: "started" } | { type: "done"; key: string | null; queryId: number | null } | { type: "failed"; failure: WorkbookRunFailure } | { type: "cancelled" };
969
+
970
+ /**
971
+ * How a run ended
972
+ */
973
+ export interface RunOutcome {
1146
974
  /**
1147
- * The code of the validation error, e.g. `unsupported_format_version`
975
+ * Why the run didn't start, e.g. another run holds the workbook, null for a run that started
1148
976
  */
1149
- error: string;
977
+ refused: string | null;
1150
978
  /**
1151
- * A short explanation of the error for the user
979
+ * The queries of the last outputs of the scripts in feed order
1152
980
  */
1153
- description: string;
1154
- }
1155
-
1156
- /**
1157
- * A hold of the writer (no workbook) or of a workbook
1158
- */
1159
- export interface StorageHoldView {
1160
- workbookId: string | null;
1161
- reason: StorageHoldReason;
1162
- count: number;
981
+ outputs: (number | null)[];
982
+ failure: WorkbookRunFailure | null;
983
+ /**
984
+ * Did the run hand a statement to the executor?
985
+ */
986
+ launched: boolean;
1163
987
  }
1164
988
 
1165
989
  /**
1166
- * A write that failed. One that failed for a moment runs again after a backoff, one whose target is gone stops
1167
- * (`permanent`) until a newer write of its key or until the app discards it (`storageDiscardWrites`).
990
+ * The options of a run of a script
1168
991
  */
1169
- export interface FailedStorageWriteView {
1170
- key: string;
992
+ export interface RunScriptOptions {
1171
993
  /**
1172
- * The workbook of the key, null for the files of the app
994
+ * Read no cached results, neither of the script nor of the scripts it references
1173
995
  */
1174
- workbookId: string | null;
996
+ refresh?: boolean;
997
+ }
998
+
999
+ /**
1000
+ * The state of a run of a workbook
1001
+ */
1002
+ export interface WorkbookRunState {
1003
+ phase: WorkbookRunPhase;
1004
+ totalScripts: number;
1005
+ completedScripts: number;
1175
1006
  /**
1176
- * The last error
1007
+ * The planned statements that run
1177
1008
  */
1178
- error: string;
1009
+ totalStatements: number;
1010
+ completedStatements: number;
1179
1011
  /**
1180
- * The failed attempts in a row
1012
+ * The script of the statement that started last
1181
1013
  */
1182
- attempts: number;
1014
+ activeFileName: string | null;
1015
+ activeStatementIndex: number | null;
1016
+ activeStatementCount: number | null;
1017
+ error: string | null;
1183
1018
  /**
1184
- * The target of the write is gone, e.g. a moved workbook folder: the writer stopped retrying it
1019
+ * The scripts that the run left out: their connection can't run or could not be set up, they have no cached
1020
+ * result or follow a script that runs on such a connection
1185
1021
  */
1186
- permanent: boolean;
1022
+ skippedScripts: number;
1023
+ skippedFiles: string[];
1187
1024
  }
1188
1025
 
1189
1026
  /**
1190
- * The statistics of a key: the scheduled writes of the key and the writes of its file
1027
+ * The runs of a workbook, the slice `run` of the runtime
1191
1028
  */
1192
- export interface StorageWriteStatistics {
1193
- scheduledWrites: number;
1194
- writes: number;
1195
- writtenBytes: number;
1196
- writeTimeMs: number;
1029
+ export interface WorkbookRunView {
1030
+ workbookId: string;
1197
1031
  /**
1198
- * The time of the last write in milliseconds since the epoch
1032
+ * The run that holds the workbook, null while none does. The workbook starts no other run then.
1199
1033
  */
1200
- lastWriteMs: number | null;
1034
+ held: WorkbookRunKind | null;
1035
+ /**
1036
+ * The state of the last run of the whole workbook, it stays once the run ended
1037
+ */
1038
+ state: WorkbookRunState | null;
1039
+ /**
1040
+ * The inputs whose change waits for the workbook
1041
+ */
1042
+ pendingInputs: string[];
1201
1043
  }
1202
1044
 
1203
1045
  /**
1204
- * The outcome of a write. A failed write carries what the host failed with, a patch of a workbook file that is not
1205
- * available names the workbook.
1046
+ * The phase of a run
1206
1047
  */
1207
- export type StorageWriteOutcome = { status: "written" } | { status: "superseded" } | { status: "cancelled" } | { status: "deferred" } | { status: "failed"; error: unknown; unavailableWorkbook?: string };
1048
+ export type WorkbookRunPhase = "planning" | "running" | "stopping" | "succeeded" | "failed" | "cancelled";
1208
1049
 
1209
1050
  /**
1210
- * The statistics of the writes of a key, with the key within its workbook for display
1051
+ * The failure of a run or of a script, what the platform failed with goes next to it
1211
1052
  */
1212
- export interface StorageKeyStatistics {
1213
- key: string;
1053
+ export interface WorkbookRunFailure {
1054
+ kind: WorkbookRunFailureKind;
1055
+ message: string;
1214
1056
  /**
1215
- * The key without the prefix of its workbook, e.g. `scripts/a.sql:delete`
1057
+ * The details of the error of a failed statement, e.g. what Trino said
1216
1058
  */
1217
- label: string;
1218
- statistics: StorageWriteStatistics;
1059
+ details: Record<string, string>;
1060
+ /**
1061
+ * The target of the log messages of the error of a failed statement
1062
+ */
1063
+ target: string | null;
1064
+ /**
1065
+ * The query of the statement that failed, null for a failure of no statement
1066
+ */
1067
+ queryId: number | null;
1068
+ /**
1069
+ * Did the platform fail with a value? It goes next to the failure.
1070
+ */
1071
+ hostValue: boolean;
1219
1072
  }
1220
1073
 
1221
1074
  /**
1222
- * Why the writes of the writer or of a workbook are held
1075
+ * The options of a run of the scripts of a workbook
1223
1076
  */
1224
- export type StorageHoldReason = "externalChange" | "reload" | "import" | "handover" | "pause";
1225
-
1226
-
1227
- /** The I/O of the runtime, one object of the host (docs/design/dashql_runtime.md). The members return promises where the runtime awaits them. */
1228
- export interface RuntimePlatform {
1229
- /** The clock in milliseconds since epoch, and timers */
1230
- clock: { now(): number; sleep(ms: number): Promise<void> };
1231
- /** Log a message with its details as key value pairs, on a target of the log */
1232
- log(level: 'debug' | 'info' | 'warn' | 'error', message: string, details: [string, string][], target?: string): void;
1233
- /** The handle table of the host objects that the runtime names by a number */
1234
- handles: RuntimeHandles;
1235
- /** The Arrow tables of the host by handle, result data never enters the module */
1236
- tables: RuntimeTables;
1237
- /** The compute database of the computations, null until the host set it up */
1238
- readonly compute: ComputePlatform | null;
1239
- /** Send requests with the HTTP client of the platform */
1240
- http: RuntimeHttp;
1241
- /** The channels of the host: the ones that the setups connect, and the ones that run queries themselves (the embedded Hyper, gRPC through the native proxy, the channels of tests) */
1242
- channels: RuntimeChannels;
1243
- /** The query result cache, null without one */
1244
- readonly resultCache: RuntimeResultCache | null;
1245
- /** The files of the runs of workbooks in the compute database: the materialized results, the cached results that they scan and the attachments. Null without a compute database that reads Parquet files. */
1246
- readonly mounts: RuntimeMounts | null;
1247
- /** Random ids and the SHA-256 digests of the keys of the query result cache */
1248
- crypto: { randomUuid(): string; sha256(bytes: Uint8Array): Promise<Uint8Array> };
1249
- /** The OAuth flows of the setups */
1250
- oauth: RuntimeOAuth;
1251
- /** The specs of the client functions of the extensions, the JSON text */
1252
- extensions: { loadSpec(extension: string): Promise<string> };
1253
- /** The storage of the workbooks and the connections, the storage writer and the restore read and write through it */
1254
- readonly storage: RuntimeStorage | null;
1255
- /** The `.dashql` archives of imports and exports: the ZIP container and the Parquet files of the workbook tables. Null without. */
1256
- readonly archives: RuntimeArchives | null;
1257
- /** The state of the runtime changed, the host takes the changes. Urgent changes are taken at the end of the task, the others before the next frame. */
1258
- changed(urgent: boolean): void;
1259
- }
1260
-
1261
- /** The storage of the platform: the workbook files, scripts and attachments of the workbooks, the app manifest and the files of the connections. Workbook files and connection entries cross as plain JSON values. */
1262
- export interface RuntimeStorage {
1263
- /** The workbook file, rejects if there is none */
1264
- loadWorkbook(workbookId: string): Promise<unknown>;
1077
+ export interface RunWorkbookOptions {
1265
1078
  /**
1266
- * The writes of the workbook file and of the scripts take what they expect on disk: `undefined` for any file, `null` for none, else the stamp that the
1267
- * runtime recorded. A storage with stamps rejects a write whose file differs with an `ExternalScriptChangeError` (by its name, with `workbookId` and
1268
- * `fileName`) and resolves with the stamp of what it wrote; a storage without stamps ignores the expectation and resolves with nothing. A write into a
1269
- * workbook folder that is gone rejects with a `WorkbookFolderMissingError` (by its name), the runtime stops retrying it.
1079
+ * Run the scripts that a change of these inputs affects. A run that holds the workbook stops, the run starts once
1080
+ * the workbook is free, with the inputs of every change since.
1270
1081
  */
1271
- saveWorkbook(workbookId: string, workbook: unknown, expected?: RuntimeFileStamp | null): Promise<RuntimeFileStamp | null | void>;
1272
- saveScript(workbookId: string, fileName: string, text: string, expected?: RuntimeFileStamp | null): Promise<RuntimeFileStamp | null | void>;
1273
- /** A missing file is deleted already */
1274
- deleteScript(workbookId: string, fileName: string, expected?: RuntimeFileStamp | null): Promise<void>;
1275
- /** The file keeps its stamp, a missing source is renamed already */
1276
- renameScript(workbookId: string, from: string, to: string, expectedFrom?: RuntimeFileStamp | null, expectedTo?: RuntimeFileStamp | null): Promise<void>;
1277
- /** The names of the attachments, the runtime normalizes them to NFC and orders them naturally */
1278
- listAttachments(workbookId: string): Promise<string[]>;
1279
- /** Update the connection entries of the app manifest exclusively. The update gets the entries, null before the connections were migrated, and returns the new ones, null if nothing changed. */
1280
- updateConnections(update: (connections: unknown[] | null) => unknown[] | null): Promise<void>;
1281
- saveConnectionFile(connectionId: string, fileName: string, text: string): Promise<void>;
1282
- deleteConnectionFiles(connectionId: string): Promise<void>;
1283
- deleteWorkbook(workbookId: string): Promise<void>;
1284
- /** Does the storage own the connections? A storage of a single workbook folder doesn't. */
1285
- ownsConnections(): boolean;
1286
- /** The entries of the workbook tree in the order of the sidebar: the id of a workbook as `path`, where it is stored and its native folder */
1287
- listWorkbooks(): Promise<{ path: string; storageType?: string; nativePath?: string | null }[]>;
1288
- /** The connection entries of the app manifest, null if the manifest has none */
1289
- loadManifestConnections(): Promise<unknown[] | null>;
1290
- /** The script files of a workbook */
1291
- loadScripts(workbookId: string): Promise<RestoreScriptFile[]>;
1292
- /** The data files of a workbook */
1293
- listDataFiles(workbookId: string): Promise<WorkbookDataFile[]>;
1294
- /** A file of a connection, null if it doesn't exist */
1295
- loadConnectionFile(connectionId: string, fileName: string): Promise<string | null>;
1296
- /** An attachment of a workbook, a Blob or its bytes */
1297
- loadDataFile(workbookId: string, name: string): Promise<Blob | Uint8Array>;
1298
- /** Write an attachment of a workbook */
1299
- saveDataFile(workbookId: string, name: string, file: Blob | Uint8Array): Promise<void>;
1300
- /** Rename an attachment of a workbook, keeping its contents */
1301
- renameDataFile(workbookId: string, from: string, to: string): Promise<void>;
1302
- /** Add or replace an entry of the workbook tree, e.g. to route a workbook to the origin private file system */
1303
- upsertWorkbookEntry(entry: unknown): Promise<void>;
1304
- /** Delete the files of a workbook, its entry stays */
1305
- deleteWorkbookFiles(workbookId: string): Promise<void>;
1306
- /** Register a native workbook folder in place under an id: the platform adds it to the workbook tree, the runtime migrates it */
1307
- registerNativeWorkbook(dir: string, workbookId: string): Promise<void>;
1308
- /** The folder of a workbook that the platform keeps in a folder of its own, e.g. a native workbook folder; null for the workbooks of the storage root, which `migrateStorage` migrates. The runtime migrates the folder when it reads a workbook file of an older format and checks it for changes outside the app. */
1309
- workbookFolder?(workbookId: string): RuntimeWorkbookFolder | null;
1310
- /** The attachments of a workbook folder changed outside the app, e.g. its mount looks them up again */
1311
- attachmentsChanged?(workbookId: string): void;
1312
- }
1313
-
1314
- /** The top-level files of a workbook folder, as the migrations read and write them */
1315
- export interface RuntimeFolder {
1316
- /** A file, null if the folder doesn't hold it */
1317
- readText(name: string): Promise<string | null>;
1318
- /** Write a file, resolves with its stamp if the folder keeps stamps */
1319
- writeText(name: string, text: string): Promise<RuntimeFileStamp | null | void>;
1320
- /** Remove a file, a missing file is ignored */
1321
- remove(name: string): Promise<void>;
1322
- }
1323
-
1324
- /** The stamp of a file: size and modification time */
1325
- export interface RuntimeFileStamp {
1326
- size: number;
1327
- mtimeMs: number;
1328
- }
1329
-
1330
- /** The stamps of the files of a workbook folder */
1331
- export interface RuntimeFolderStamps {
1332
- scripts: ({ name: string } & RuntimeFileStamp)[];
1333
- attachments: ({ name: string } & RuntimeFileStamp)[];
1334
- /** The workbook file, null if there is none */
1335
- workbook: RuntimeFileStamp | null;
1336
- }
1337
-
1338
- /** A workbook folder that may change outside the app, e.g. a native workbook folder. The runtime keeps the stamps of what it wrote and acknowledged. */
1339
- export interface RuntimeWorkbookFolder extends RuntimeFolder {
1340
- /** The stamps of the scripts, the attachments and the workbook file of the folder */
1341
- stampFolder(): Promise<RuntimeFolderStamps>;
1342
- }
1343
-
1344
- /** The storage root of the app for its migrations: files and directories by their paths below the root, `/` separated */
1345
- export interface RuntimeStorageRoot {
1346
- /** A file, null if it doesn't exist */
1347
- readText(path: string): Promise<string | null>;
1348
- /** Write a file, its directories are created */
1349
- writeText(path: string, text: string): Promise<void>;
1350
- /** Create a directory and its parents */
1351
- createDirectory(path: string): Promise<void>;
1352
- /** Remove a file, or a directory with its content; a missing one is ignored */
1353
- remove(path: string): Promise<void>;
1354
- /** The entries of a directory, null if it doesn't exist */
1355
- list(path: string): Promise<{ name: string; directory: boolean }[] | null>;
1356
- /** Copy the files and folders of a directory into another one, which is created. Existing files are replaced, or kept with `keepExisting`. */
1357
- copyDirectory(from: string, to: string, keepExisting: boolean): Promise<void>;
1358
- /** The folder of a native workbook, claimed for the app; null without native folders or if it doesn't exist */
1359
- nativeFolder(nativePath: string): Promise<RuntimeFolder | null>;
1360
- }
1361
-
1362
- /** An entry of a `.dashql` archive that the platform writes: a workbook table from the Arrow IPC of its rows, written as Parquet, or a file of the handle table as it is */
1363
- export interface RuntimeArchiveEntry {
1364
- fileName: string;
1365
- /** Stored without compression, else deflated */
1366
- stored: boolean;
1367
- table: Uint8Array | null;
1368
- file: number | null;
1369
- }
1370
-
1371
- /** The `.dashql` archives of the platform. An archive that is read is a Blob of the handle table, the platform keeps its reader until `close`. */
1372
- export interface RuntimeArchives {
1373
- /** Write an archive of the entries in order, resolves with its Blob */
1374
- write(entries: RuntimeArchiveEntry[]): Promise<Blob>;
1375
- /** The bytes of an archive of the handle table, e.g. for a link */
1376
- bytes(archive: number): Promise<Uint8Array>;
1377
- /** The entries of an archive, the runtime normalizes their names to NFC */
1378
- entries(archive: number): Promise<{ filename: string; directory: boolean }[]>;
1379
- /** The text of an entry */
1380
- readText(archive: number, index: number): Promise<string>;
1381
- /** A workbook table of a Parquet entry as Arrow IPC */
1382
- readTable(archive: number, index: number): Promise<Uint8Array>;
1383
- /** A file entry: a slice of the archive with the CRC-32 of the entry if it is stored and `slice` is set, else its bytes checked against the CRC-32 */
1384
- readFile(archive: number, index: number, slice: boolean): Promise<{ file: Blob; crc32: number | null }>;
1385
- /** Close the reader of an archive */
1386
- close(archive: number): Promise<void>;
1082
+ inputs?: string[];
1083
+ /**
1084
+ * Run these scripts with what they need, by their indexes in feed order, every script without
1085
+ */
1086
+ targets?: number[];
1087
+ /**
1088
+ * Read no cached results: the scripts run, the results with reusable keys become the newest files of their keys
1089
+ */
1090
+ refresh?: boolean;
1091
+ /**
1092
+ * Analyze the results of the outputs on the compute database, true by default. The command line tool prints them.
1093
+ */
1094
+ analyze?: boolean;
1387
1095
  }
1388
1096
 
1389
- /** A workbook folder that an import reads: a native folder, a folder of the browser, a hosted workbook */
1390
- export interface RuntimeImportFolder {
1391
- /** A top-level file or a catalog file of a connection (`connections/<id>/<file>`), null if missing */
1392
- readText(path: string): Promise<string | null>;
1393
- /** The script files, given the scripts that the workbook file lists */
1394
- scripts(listed: string[]): Promise<{ name: string; sql: string }[]>;
1395
- /** The attachments, given the attachments that the workbook file lists */
1396
- attachments(listed: string[]): Promise<{ name: string; file: Blob | Uint8Array }[]>;
1397
- /** The prefix of the errors, e.g. "Invalid remote workbook" */
1398
- readonly errorPrefix?: string;
1399
- /** Metadata of the source that the workbook file takes, e.g. the URL of a hosted workbook */
1400
- readonly metadata?: unknown;
1401
- /** The folder of a native workbook that is registered in place */
1402
- readonly nativePath?: string | null;
1403
- }
1097
+ /**
1098
+ * The run that holds a workbook: a run of the whole workbook or of one of its scripts
1099
+ */
1100
+ export type WorkbookRunKind = "workbook" | "script";
1404
1101
 
1405
- /** The source of an import: a `.dashql` archive (a Blob of the handle table), a workbook folder, or the workbook tables with the rows of each table as Arrow IPC and the Parquet files of the data tables */
1406
- export type ImportSource =
1407
- | { archive: number }
1408
- | { folder: RuntimeImportFolder }
1409
- | { tables: { rows: Record<string, Uint8Array>; data: { tableName: string; file: Blob | Uint8Array; crc32?: number | null }[]; errorPrefix?: string } };
1102
+ /**
1103
+ * Why a run failed
1104
+ */
1105
+ export type WorkbookRunFailureKind = "plan" | "cancelled" | "error";
1410
1106
 
1411
- /** A step of the commit of an import */
1412
- export type ImportStep = 'results' | 'workbook' | 'scripts' | 'attachments' | 'open';
1107
+ /**
1108
+ * The versions of the storage format of the module: of the storage root and of workbook files
1109
+ */
1110
+ export interface StorageVersions {
1111
+ /**
1112
+ * The storage version of the app, `storageVersion` of the manifest
1113
+ */
1114
+ storageVersion: number;
1115
+ /**
1116
+ * The workbook format version of the app, `formatVersion` of a workbook file
1117
+ */
1118
+ formatVersion: number;
1119
+ }
1413
1120
 
1414
- /** The workbook tables of an export */
1415
- export interface ExportedTables {
1416
- /** The rows of the workbook tables by table name */
1417
- rows: Record<string, Record<string, string | number | boolean | null>[]>;
1418
- /** The Parquet files of the attachment and result tables by handle */
1419
- data: { tableName: string; file: number; size: number; crc32: number | null }[];
1121
+ /**
1122
+ * What a migration of the storage changed, with the versions it migrated to
1123
+ */
1124
+ export interface StorageMigrationOutcome {
1125
+ /**
1126
+ * The storage steps that ran
1127
+ */
1128
+ steps: number;
1129
+ /**
1130
+ * The workbook folders that were brought to the current workbook format
1131
+ */
1132
+ workbooks: number;
1133
+ /**
1134
+ * The storage version of the app
1135
+ */
1136
+ storageVersion: number;
1137
+ /**
1138
+ * The workbook format version of the app
1139
+ */
1140
+ formatVersion: number;
1420
1141
  }
1421
1142
 
1422
- /** A channel of the host that a setup asks the host to connect: the embedded Hyper, or Hyper over gRPC through the native proxy. The runtime speaks Trino, Hyper over HTTP and the Hyper of Salesforce itself. */
1423
- export type RuntimeChannelRequest = { type: 'hyper'; kind: 'embedded' | 'grpc'; params: any };
1424
1143
 
1425
- /** How the platform takes the user through the redirect page */
1426
- export interface RuntimeOAuthFlowInfo {
1427
- redirectVariant: 'WEB_OPENER_FLOW' | 'NATIVE_LINK_FLOW';
1428
- redirectCallbackUrl: string | null;
1429
- debugMode: boolean;
1430
- flavor: string | null;
1431
- }
1432
- /** The OAuth flows of the platform. A flow belongs to a setup by the id of the setup, `abort` with the id of the flow stops it: the runtime aborts a flow that it stops waiting for, e.g. a cancelled setup, which closes the loopback server or the window of the flow. */
1433
- export interface RuntimeOAuth {
1434
- /** A PKCE challenge: a random verifier and the base64url of its SHA-256 digest */
1435
- pkce(): Promise<{ value: string; verifier: string }>;
1436
- flowInfo(setupId: string): RuntimeOAuthFlowInfo;
1437
- /** Open the authorization URL and wait for the loopback redirect. The events are 'WINDOW_OPENED', 'WINDOW_CLOSED' and 'EXTERNAL_BROWSER_OPENED'. */
1438
- authorizeWithLoopback(setupId: string, flow: number, url: string, callbackUrl: string, onEvent: (event: string) => void): Promise<{ code?: string; state?: string; error?: string; errorDescription?: string }>;
1439
- /** Open the authorization URL and wait for the callback of the redirect page whose state has the flow id */
1440
- authorizeWithRedirectPage(setupId: string, flow: number, url: string, flowId: string, onEvent: (event: string) => void): Promise<unknown>;
1441
- abort(flow: number): void;
1144
+ /** A file to attach to a workbook, with the name it was dropped with */
1145
+ export interface AttachedFile {
1146
+ name: string;
1147
+ file: Blob | Uint8Array;
1442
1148
  }
1443
1149
 
1444
- /** The handle table of the host */
1445
- export interface RuntimeHandles {
1446
- /** Keep an object under a new handle */
1447
- register(object: unknown): number;
1448
- /** Forget the object of a handle */
1449
- release(handle: number): void;
1450
- /** The object of a handle */
1451
- get(handle: number): unknown;
1452
- /** Keep the object of a handle under a new handle as well, e.g. a result table that a computation takes too */
1453
- duplicate(handle: number): number;
1454
- /** Close the object of a handle, the handle stays until its release. The runtime closes at once with it and releases the handle with the changes, without it the store closes and releases. */
1455
- close?(handle: number): void;
1456
- /** Abort the object of a handle with a reason, the runtime aborts at once with it and leaves the abort to the store without it */
1457
- abort?(handle: number, reason: string): void;
1458
- }
1459
1150
 
1460
- /** The Arrow tables of the host by handle */
1461
- export interface RuntimeTables {
1462
- /** Begin a table with an Arrow IPC stream, its schema and maybe batches, returns its handle */
1463
- begin(ipc: Uint8Array): number;
1464
- /** Append the batches of an Arrow IPC stream to a table that began */
1465
- append(table: number, ipc: Uint8Array): void;
1466
- /** Open a table that streams in parts of one Arrow IPC stream, a message may span parts. A channel of the host pushes its batches into it. */
1467
- open(): number;
1468
- /** Push the next part of the Arrow IPC stream of a table that was opened */
1469
- push(table: number, part: Uint8Array): void;
1470
- /** Finish a table, it is a table of the handle table from then on */
1471
- finish(table: number): { rows: number; bytes: number; columns: number; batches: number };
1472
- /** A table of the handle table as an Arrow IPC stream, for the small tables that the runtime parses, e.g. the results of the metadata queries of the catalog loader */
1473
- read(table: number): Uint8Array;
1474
- /** The rows of a table of the handle table and its schema as an Arrow IPC stream without batches, the rows stay with the host */
1475
- describe(table: number): { rows: number; schema: Uint8Array };
1151
+ /**
1152
+ * What an attach did
1153
+ */
1154
+ export interface AttachFilesOutcome {
1155
+ /**
1156
+ * The attachments that were written or wait for a hold of the workbook, in the order of the files
1157
+ */
1158
+ attached: AttachedFileName[];
1159
+ /**
1160
+ * The files that are no attachments (Parquet files only), by their names
1161
+ */
1162
+ refused: string[];
1476
1163
  }
1477
1164
 
1478
- /** A request of the runtime for the HTTP client of the host */
1479
- export interface RuntimeHttpRequest {
1480
- method: string;
1481
- url: string;
1482
- headers: [string, string][];
1483
- body: string | null;
1484
- /** The request or its response carries credentials, e.g. a token request: the host keeps no record of their bodies and headers */
1485
- sensitive: boolean;
1486
- }
1487
- /** A response of the HTTP client of the host */
1488
- export interface RuntimeHttpResponse {
1489
- status: number;
1490
- statusText: string;
1491
- headers: [string, string][];
1492
- body: Uint8Array;
1493
- }
1494
- /** Fetch of the platform: `abort` with the id of a request stops it */
1495
- export interface RuntimeHttp {
1496
- fetch(id: number, request: RuntimeHttpRequest): Promise<RuntimeHttpResponse>;
1497
- abort(id: number): void;
1165
+ /**
1166
+ * A file that was attached, with the name it got
1167
+ */
1168
+ export interface AttachedFileName {
1169
+ /**
1170
+ * The name the file was dropped with
1171
+ */
1172
+ name: string;
1173
+ /**
1174
+ * The file name of the attachment, its table parameter takes no name of a script or another attachment
1175
+ */
1176
+ fileName: string;
1498
1177
  }
1499
1178
 
1500
- /** What a channel of the host reports while it streams a result, the batches go into the table of the query */
1501
- export type RuntimeChannelMessage =
1502
- | { type: 'progress'; progress: QueryProgressView }
1503
- | { type: 'batch'; metrics: QueryStreamMetrics }
1504
- | { type: 'end'; metrics: QueryStreamMetrics };
1505
- /** A query on a channel of the host, what the host needs to run it there */
1506
- export interface RuntimeChannelQuery {
1507
- text: string;
1508
- /** The time to wait for the next batch, null for the default of the channel */
1509
- readTimeoutMs: number | null;
1510
- /** Collect the result, a statement whose output nothing reads drains it */
1511
- publishResults: boolean;
1512
- /** The name of the connector, e.g. for the error of a channel that is not set up */
1513
- connector: string;
1514
- /** Is the query a call of a client function? The runtime sends its requests itself, the host names only the tokens of a Salesforce channel. */
1515
- clientFunction: boolean;
1516
- }
1517
- /** The channels of the host. The setups connect them, the queries of the host run on them by query: the host knows the channel of a query from the query it described. */
1518
- export interface RuntimeChannels {
1519
- /** Connect a channel of a setup, returns its handle. A channel that the runtime stops waiting for is closed once it is connected. */
1520
- connect(setupId: string, request: RuntimeChannelRequest): Promise<number>;
1521
- /** The token of the link to a Hyper that the page holds, null without */
1522
- hyperLinkToken(connectionId: string): string | null;
1523
- /** Describe a query on a channel of the host (null before its setup) as `{ type: 'host' }`. The connections own the channels that the runtime speaks itself (Trino, Hyper over HTTP, the Hyper of Salesforce), the host never describes them. The host keeps the channel and the query until `forget`. */
1524
- describe(queryId: number, channel: number | null, query: RuntimeChannelQuery): Promise<RuntimeChannelTarget>;
1525
- /** The query ended */
1526
- forget(queryId: number): void;
1527
- /** Run a query on its channel, its batches go into the table that was opened for it. False if the channel returned no result. */
1528
- open(queryId: number, table: number): Promise<boolean>;
1529
- /** The next message of the stream of a query */
1530
- next(queryId: number): Promise<RuntimeChannelMessage>;
1531
- /** Cancel the query of a channel: one that `open` still opens, the open then fails or returns a stream that the next cancel stops, or its stream at the backend */
1532
- cancel(queryId: number): Promise<void>;
1533
- /** Is the profile of the query shown? A channel fetches the plan and its statistics only then. */
1534
- profileDetail(queryId: number, shown: boolean): void;
1535
- }
1536
1179
 
1537
- /** The query result cache of the platform, Parquet files that the compute database reads and writes */
1538
- export interface RuntimeResultCache {
1539
- /** The newest file of a key, null on a miss */
1540
- lookup(key: string): Promise<{ name: string; cachedAt: number; size: number } | null>;
1541
- /** Read a file into a table of the handle table */
1542
- read(name: string): Promise<RuntimeCachedTable>;
1543
- /** Record a read of a file */
1544
- touch(name: string): Promise<void>;
1545
- /** Write a table of the handle table as the newest file of a key, resolves with the name of the file */
1546
- write(key: string, table: number): Promise<string>;
1547
- /** Keep the newest file of a key until `release`, null on a miss */
1548
- retain(key: string): Promise<{ id: number; name: string } | null>;
1549
- /** Release a file that `retain` or `pin` of the mounts kept */
1550
- release(id: number): Promise<void>;
1551
- /** The Blob of a file, e.g. one that `retain` kept for an export */
1552
- file(name: string): Promise<Blob>;
1553
- /** Add a result of a key from a file of the handle table, checked against the CRC-32. Resolves false if the key was cached already, the files of the app win. */
1554
- import(key: string, file: number, crc32: number | null): Promise<boolean>;
1555
- /** The limits of the files, the runtime evicts the least recently read files beyond them after every write of a file of a key */
1556
- capacity(): { maxBytes: number; maxFiles: number };
1557
- /** The Parquet files with their sizes, their write times and the times they were read last (the write time if never), for the eviction */
1558
- files(): Promise<{ name: string; size: number; mtimeMs: number; lastAccessMs: number }[]>;
1559
- /** Remove a file and its marker if nobody reads it, resolves false if the file is read and stays */
1560
- remove(name: string): Promise<boolean>;
1180
+ /** The slices of the runtime by kind: the id of a slice, its view, and the keys of the payloads of its view that the host holds */
1181
+ export interface RuntimeViews {
1182
+ computation: { id: number; view: ComputationView; known: undefined };
1183
+ connectionList: { id: 'root'; view: ConnectionListView; known: undefined };
1184
+ connection: { id: string; view: ConnectionView; known: undefined };
1185
+ query: { id: number; view: QueryView; known: (QueryProfileKeys | null)[] };
1186
+ workbookList: { id: 'root'; view: WorkbookListView; known: undefined };
1187
+ workbook: { id: string; view: WorkbookView; known: undefined };
1188
+ script: { id: number; view: WorkbookScriptView; known: (WorkbookScriptKeys | null)[] };
1189
+ workbookDerived: { id: string; view: WorkbookDerivedView; known: undefined };
1190
+ storage: { id: 'root'; view: StorageView; known: undefined };
1191
+ run: { id: string; view: WorkbookRunView; known: undefined };
1192
+ }
1193
+ /** A kind of slices of the runtime */
1194
+ export type ViewKind = keyof RuntimeViews;
1195
+ /** The id of a slice of a kind */
1196
+ export type ViewId<K extends ViewKind> = RuntimeViews[K]['id'];
1197
+ /** The view of a slice of a kind */
1198
+ export type ViewOf<K extends ViewKind> = RuntimeViews[K]['view'];
1199
+ /** The keys of the payloads that the host holds, they don't cross again */
1200
+ export type KnownKeys<K extends ViewKind> = RuntimeViews[K]['known'];
1201
+ /** The read of a slice that a task of the runtime holds: it moves with the next changes, the host keeps its view */
1202
+ export type BusyView = 'busy';
1203
+ export interface Runtime {
1204
+ /** The views of the slices of a kind, null for a slice that is gone, `'busy'` for one that a task holds. One crossing per kind and flush. */
1205
+ views<K extends ViewKind>(kind: K, ids: ViewId<K>[], known?: KnownKeys<K>): (ViewOf<K> | BusyView | null)[];
1561
1206
  }
1562
1207
 
1563
- /** The files of the runs of workbooks in the compute database, the files of the query result cache. The runtime keeps the pins of a run, releases them with `release` of the cache once the run settled and then removes its transient files with `remove`. */
1564
- export interface RuntimeMounts {
1565
- /** The directory of the files of the runs, the files of the query result cache; null without the cache */
1566
- prefix(): string | null;
1567
- /** The name of a new file of the result of a script: a file of its key if the key is reusable, a transient file otherwise */
1568
- fileName(key: string | null): string;
1569
- /** Mount the files in the compute database and pin a file at a path below the prefix, also one that is about to be written. Resolves with the id that `release` of the cache releases it with. */
1570
- pin(path: string): Promise<number>;
1571
- /** Write a table of the handle table as Parquet file at a path below the prefix that is pinned, resolves with its rows */
1572
- write(path: string, table: number): Promise<number>;
1573
- /** Mount the attachments of a workbook */
1574
- attachments(workbookId: string): Promise<void>;
1575
- /** The columns of a Parquet attachment of a workbook */
1576
- attachmentColumns(workbookId: string, fileName: string): Promise<string[]>;
1577
- /** Unmount the attachments of a workbook that was deleted */
1578
- dropAttachments(workbookId: string): Promise<void>;
1579
- }
1580
1208
 
1581
- /** The compute database of the computations, the embedded Hyper of the platform. The context of a call names the computation, the title of its task, the connection and the client context of the computation, and the run that `cancel` aborts. Result data never enters the module: a result is imported as the Arrow table of its handle, the tables that the tasks read stay Arrow tables, the runtime reads only the small ones that it parses as Arrow IPC streams. */
1582
- export interface ComputePlatform {
1583
- /** Create the table of a data frame from an Arrow table of the handle table, with its rows numbered from 1 in an appended column of 64-bit integers that can't be null */
1584
- importTable(dataFrame: number, tableName: string, table: unknown, rowNumberField: string, context: ComputeCallContext): Promise<void>;
1585
- /** Create the table of a data frame from a SELECT, the host tracks the SELECT as a query of the task */
1586
- createTable(dataFrame: number, tableName: string, sql: string, context: ComputeCallContext): Promise<void>;
1587
- /** Run a query whose small result the runtime parses, resolves to its result as an Arrow IPC stream */
1588
- query(sql: string, context: ComputeCallContext): Promise<Uint8Array>;
1589
- /** Run a query, resolves to its result as an Arrow table that the runtime keeps in the handle table */
1590
- queryTable(sql: string, context: ComputeCallContext): Promise<unknown>;
1591
- /** Drop the table of a data frame */
1592
- dropTable(dataFrame: number, tableName: string): Promise<void>;
1593
- /** Abort the calls of a run */
1594
- cancel(run: number): void;
1209
+ /**
1210
+ * The slice that an action changes
1211
+ */
1212
+ export type Target = { computation: number } | { connection: string } | { workbook: string } | "app";
1213
+
1214
+ /**
1215
+ * The actions of the runtime. An action changes the state in the call and returns its outcome; a failed action leaves
1216
+ * the state as it was.
1217
+ */
1218
+ export type RuntimeAction = { kind: "deleteComputation" } | { kind: "orderBy"; value: { constraints: ComputationOrderBy[] } } | { kind: "histogramFilter"; value: { columnGroup: number; selection: [number, number] | null } } | { kind: "mostFrequentValueFilter"; value: { columnGroup: number; valueId: number | null } } | { kind: "clearCrossFilters" } | { kind: "setResultSearchPattern"; value: { search: ComputationSearchKind; pattern: string } } | { kind: "requestFilteredColumnAggregation"; value: { columnGroup: number } } | { kind: "createConnection"; value: { connectionId?: string; connectorType: ConnectorType; setupParams?: JsonParams; active?: boolean; params?: JsonParams; paramsDraft?: JsonParams; name?: string; cacheQueryResults?: boolean } } | { kind: "createWorkbook"; value: { workbookId?: string; connectionId: string; name?: string; ephemeral?: boolean; originalFileName?: string } } | { kind: "deleteWorkbook"; value: { workbookId: string } } | { kind: "createScript"; value: { index?: number; text?: string; base: string; connectionId?: string } } | { kind: "deleteScript"; value: { fileName: string } } | { kind: "renameScript"; value: { fileName: string; newName: string } } | { kind: "reorderScripts"; value: { order: string[] } } | { kind: "setScriptText"; value: { scriptKey: number; text: string; withDiff?: boolean } } | { kind: "acceptPendingDiff"; value: { scriptKey: number } } | { kind: "rejectPendingDiff"; value: { scriptKey: number } } | { kind: "setScriptVisSpec"; value: { scriptKey: number; spec: string } } | { kind: "setWorkbookInput"; value: { name: string; literal: string; scriptKeys: number[] } } | { kind: "analyzeOutdatedScript"; value: { scriptKey: number } } | { kind: "showScript"; value: { scriptKey: number; selected: boolean } } | { kind: "hideScript"; value: { scriptKey: number; selected: boolean } } | { kind: "renameWorkbook"; value: { name?: string } } | { kind: "setScriptConnection"; value: { fileName: string; connectionId: string } } | { kind: "setPendingConnection"; value: { connectionId: string } } | { kind: "replaceConnection"; value: { from: string; into: string } } | { kind: "detachConnection"; value: { from: string; into: string } } | { kind: "setWorkbookAttachments"; value: { files: WorkbookDataFile[] } } | { kind: "setCloudLink"; value: { link?: JsonValue } } | { kind: "setDraft"; value: { params: JsonParams } } | { kind: "discardDraft" } | { kind: "rename"; value: { name: string } } | { kind: "setQueryResultCaching"; value: { caching: boolean } } | { kind: "deleteConnection" } | { kind: "resetConnection" } | { kind: "relationsTouched"; value: { names: ConnectionTableName[] } } | { kind: "queryCacheDeleted"; value: { queryId: number } };
1219
+
1220
+ /**
1221
+ * The id of a slice or of what an action created: a number or a string
1222
+ */
1223
+ export type SliceId = number | string;
1224
+
1225
+ /**
1226
+ * A slice that changed since the host took the changes, its revision is null if it went
1227
+ */
1228
+ export interface SliceChange {
1229
+ kind: ViewKind;
1230
+ id: SliceId;
1231
+ revision: number | null;
1595
1232
  }
1596
1233
 
1234
+ /**
1235
+ * The changes since the host took them last: the changed slices and the effects on handles, in order
1236
+ */
1237
+ export interface ChangeSet {
1238
+ changes: SliceChange[];
1239
+ effects: HandleEffect[];
1240
+ }
1597
1241
 
1598
1242
  /**
1599
- * A cached result that the query result cache read into a table of the handle table
1243
+ * What a dispatch did
1600
1244
  */
1601
- export interface RuntimeCachedTable {
1602
- table: number;
1603
- rows: number;
1604
- columns: number;
1245
+ export interface DispatchOutcome {
1246
+ /**
1247
+ * Was the action applied? A failed action leaves the state as it was.
1248
+ */
1249
+ ok: boolean;
1250
+ /**
1251
+ * Did the action change the state?
1252
+ */
1253
+ changed: boolean;
1254
+ /**
1255
+ * The error of a failed action
1256
+ */
1257
+ error: string | null;
1258
+ /**
1259
+ * What the action created: the id of a connection or of a query
1260
+ */
1261
+ id: SliceId | null;
1605
1262
  }
1606
1263
 
1607
1264
  /**
1608
- * Where a query of a channel of the host runs, as the platform describes it: the channel of the host. The connections
1609
- * own the channels that the module speaks itself (Trino, Hyper over HTTP, the Hyper of Salesforce), the platform never
1610
- * describes them.
1265
+ * The storage of the runtime: what holds the writes, the writes that failed, and the questions about workbook folders
1266
+ * that changed outside the app. The workbooks whose writes a change outside the app holds are the holds with the
1267
+ * reason `externalChange`.
1611
1268
  */
1612
- export type RuntimeChannelTarget = { type: "host" };
1269
+ export interface StorageView {
1270
+ /**
1271
+ * The holds of the writer (no workbook) and of the workbooks, with their reasons
1272
+ */
1273
+ holds: StorageHoldView[];
1274
+ /**
1275
+ * The writes that failed, with their last errors
1276
+ */
1277
+ failedWrites: FailedStorageWriteView[];
1278
+ /**
1279
+ * The workbooks whose scripts changed on disk, the app asks the user whether to reload them
1280
+ * (`answerExternalChange`)
1281
+ */
1282
+ externalChanges: ExternalChangeView[];
1283
+ }
1613
1284
 
1614
1285
  /**
1615
- * An effect of the runtime on a handle of the host, applied by the store when it takes the changes
1286
+ * A question about a workbook folder whose scripts changed outside the app
1616
1287
  */
1617
- export type HandleEffect = { type: "release"; handle: number } | { type: "close"; handle: number } | { type: "abort"; handle: number; reason: string };
1288
+ export interface ExternalChangeView {
1289
+ workbookId: string;
1290
+ /**
1291
+ * The number of the question, the answer names it. A second question about the same change has a new number.
1292
+ */
1293
+ prompt: number;
1294
+ /**
1295
+ * Does the app hold writes of the scripts that a reload discards?
1296
+ */
1297
+ pendingWrites: boolean;
1298
+ }
1618
1299
 
1300
+ /**
1301
+ * A command of the storage writer that waits for writes. The commands that change the writer right away are methods
1302
+ * of the runtime (`storageHold`, `storageRelease`, `storageDiscardWrites`).
1303
+ */
1304
+ export type StorageCommand = { kind: "flush"; closing?: boolean } | { kind: "settle" } | { kind: "flushWorkbook"; workbookId: string } | { kind: "deleteWorkbook"; workbookId: string } | { kind: "handOver" };
1619
1305
 
1620
- /** What hears a run of a workbook */
1621
- export interface RunListener {
1622
- /** Something happened to a script of the run, a failure comes with what the platform failed with */
1623
- script?(file: string, event: WorkbookScriptRunEvent, error: unknown): void;
1624
- /** Set up a connection that statements run on before the first statement, e.g. with the credentials of the command line tool. The scripts of a connection whose setup rejects are skipped. A run with it takes every connection of the workbook. */
1625
- prepareConnection?(connectionId: string): Promise<void>;
1306
+ /**
1307
+ * The database and schema of the relations that unqualified statements of a connection create or drop
1308
+ */
1309
+ export interface ConnectionNameDefaults {
1310
+ databaseName: string;
1311
+ schemaName: string;
1626
1312
  }
1627
1313
 
1314
+ /**
1315
+ * Opaque JSON params: the params of a connection with one field named after the connector (`{ trino: {...} }`), or
1316
+ * the params of a connector without that field
1317
+ */
1318
+ export type JsonParams = Record<string, unknown>;
1628
1319
 
1629
1320
  /**
1630
1321
  * The catalog updates of a connection
@@ -1664,12 +1355,6 @@ export interface ConnectionCatalogUpdates {
1664
1355
  refreshRunning: boolean;
1665
1356
  }
1666
1357
 
1667
- /**
1668
- * Opaque JSON params: the params of a connection with one field named after the connector (`{ trino: {...} }`), or
1669
- * the params of a connector without that field
1670
- */
1671
- export type JsonParams = Record<string, unknown>;
1672
-
1673
1358
  /**
1674
1359
  * A catalog update
1675
1360
  */
@@ -1688,28 +1373,6 @@ export interface ConnectionCatalogUpdateTask {
1688
1373
  handle: number | null;
1689
1374
  }
1690
1375
 
1691
- /**
1692
- * The details of the setup of a connection
1693
- */
1694
- export interface ConnectionDetailsView {
1695
- /**
1696
- * When the steps of the setup happened, by the name of the step, e.g. `channelReadyAt`
1697
- */
1698
- setupTimings: Record<string, number>;
1699
- /**
1700
- * The params of the connector that the setup uses, without the field of the connector
1701
- */
1702
- setupParams: Record<string, unknown> | null;
1703
- channelError: ConnectionError | null;
1704
- healthCheckError: ConnectionError | null;
1705
- /**
1706
- * The handle of a channel of the host, once it is ready: the embedded Hyper or Hyper over gRPC. The channels that
1707
- * the runtime speaks itself have none.
1708
- */
1709
- channel: number | null;
1710
- connector: ConnectionConnectorDetails;
1711
- }
1712
-
1713
1376
  /**
1714
1377
  * The OAuth flow of a Trino connection, the steps that didn't happen yet are null. The PKCE verifier, the code and
1715
1378
  * the token stay in the runtime.
@@ -1726,106 +1389,33 @@ export interface ConnectionTrinoOAuthState {
1726
1389
  accessToken: ConnectionTokenSummary | null;
1727
1390
  }
1728
1391
 
1729
- /**
1730
- * The auth of a connection as it goes with its requests, with fresh tokens. Only `Runtime.connectionAuthorization`
1731
- * hands it out, to the relay of `dashql connect` (docs/wip/agent_session.md, "Logins go through the page").
1732
- */
1733
- export interface ConnectionAuthorization {
1734
- /**
1735
- * The auth headers of the requests by the origin of their endpoint, e.g. `Authorization` with the access token
1736
- */
1737
- endpoints: Record<string, Record<string, string>>;
1738
- /**
1739
- * The account that keys the cached results: the account of the token, the user of basic auth
1740
- */
1741
- principal: string | null;
1742
- /**
1743
- * The responses of the token requests of a login by the URL of the request, with a stand-in token that authorizes
1744
- * nothing: a run of the relay sets the connection up with them
1745
- */
1746
- standIns: Record<string, unknown>;
1747
- }
1748
-
1749
- /**
1750
- * The database and schema of the relations that unqualified statements of a connection create or drop
1751
- */
1752
- export interface ConnectionNameDefaults {
1753
- databaseName: string;
1754
- schemaName: string;
1755
- }
1756
-
1757
- /**
1758
- * The parameters of the OAuth flow of a Salesforce connection
1759
- */
1760
- export interface ConnectionSalesforceOAuthParams {
1761
- instanceUrl: string;
1762
- appConsumerKey: string;
1763
- requestedAt: number;
1764
- expiresAt: number;
1765
- }
1766
-
1767
- /**
1768
- * The state of saving a connection: whether it saves and the outcome of the last save
1769
- */
1770
- export interface ConnectionSaveView {
1771
- /**
1772
- * Is the connection being saved?
1773
- */
1774
- saving: boolean;
1775
- /**
1776
- * The outcome of the last save, null before one
1777
- */
1778
- outcome: ConnectionSaveOutcome | null;
1779
- }
1780
-
1781
- /**
1782
- * A connection of the list of connections
1783
- */
1784
- export interface ConnectionListEntry {
1785
- connectionId: string;
1786
- connectorType: ConnectorType;
1787
- active: boolean;
1788
- /**
1789
- * Is the connection listed next to the workbooks? Connections that workbooks use are, as are active ones.
1790
- */
1791
- listed: boolean;
1792
- /**
1793
- * The number of the connection among the listed connections of its connector from 1, null if it is the only one
1794
- */
1795
- ordinal: number | null;
1796
- }
1797
-
1798
1392
  /**
1799
1393
  * The details that only one connector keeps, Database.com has the ones of Salesforce
1800
1394
  */
1801
1395
  export type ConnectionConnectorDetails = { kind: "hyper" } | { kind: "trino"; schemaResolutionError: ConnectionError | null; oauthState: ConnectionTrinoOAuthState | null } | { kind: "salesforce"; setupError: ConnectionError | null; oauthState: ConnectionSalesforceOAuthState | null };
1802
1396
 
1803
1397
  /**
1804
- * A table name of the analyzer, null for a name that a statement left out
1805
- */
1806
- export interface ConnectionTableName {
1807
- databaseName: string | null;
1808
- schemaName: string | null;
1809
- tableName: string | null;
1810
- }
1811
-
1812
- /**
1813
- * The tokens of a connection as their JSON, null for a token that the connection doesn't hold. Only
1814
- * `Runtime.revealConnectionSecrets` hands them out, the views summarize them.
1398
+ * The state of saving a connection: whether it saves and the outcome of the last save
1815
1399
  */
1816
- export interface ConnectionSecrets {
1817
- /**
1818
- * The OAuth token of a Trino connection
1819
- */
1820
- accessToken: string | null;
1400
+ export interface ConnectionSaveView {
1821
1401
  /**
1822
- * The core token of a Salesforce connection
1402
+ * Is the connection being saved?
1823
1403
  */
1824
- coreAccessToken: string | null;
1404
+ saving: boolean;
1825
1405
  /**
1826
- * The Data Cloud token of a Salesforce connection
1406
+ * The outcome of the last save, null before one
1827
1407
  */
1828
- dataCloudAccessToken: string | null;
1408
+ outcome: ConnectionSaveOutcome | null;
1409
+ }
1410
+
1411
+ /**
1412
+ * The parameters of the OAuth flow of a Salesforce connection
1413
+ */
1414
+ export interface ConnectionSalesforceOAuthParams {
1415
+ instanceUrl: string;
1416
+ appConsumerKey: string;
1417
+ requestedAt: number;
1418
+ expiresAt: number;
1829
1419
  }
1830
1420
 
1831
1421
  /**
@@ -1944,6 +1534,87 @@ export interface ConnectionView {
1944
1534
  catalogId: number;
1945
1535
  }
1946
1536
 
1537
+ /**
1538
+ * The connections of the runtime, the slice `connectionList`
1539
+ */
1540
+ export interface ConnectionListView {
1541
+ /**
1542
+ * The connections in the order they were registered
1543
+ */
1544
+ connections: ConnectionListEntry[];
1545
+ /**
1546
+ * The ids of the connections by connector, in the order they were registered
1547
+ */
1548
+ connectionsByType: string[][];
1549
+ }
1550
+
1551
+ /**
1552
+ * The details of the setup of a connection
1553
+ */
1554
+ export interface ConnectionDetailsView {
1555
+ /**
1556
+ * When the steps of the setup happened, by the name of the step, e.g. `channelReadyAt`
1557
+ */
1558
+ setupTimings: Record<string, number>;
1559
+ /**
1560
+ * The params of the connector that the setup uses, without the field of the connector
1561
+ */
1562
+ setupParams: Record<string, unknown> | null;
1563
+ channelError: ConnectionError | null;
1564
+ healthCheckError: ConnectionError | null;
1565
+ /**
1566
+ * The handle of a channel of the host, once it is ready: the embedded Hyper or Hyper over gRPC. The channels that
1567
+ * the runtime speaks itself have none.
1568
+ */
1569
+ channel: number | null;
1570
+ connector: ConnectionConnectorDetails;
1571
+ }
1572
+
1573
+ /**
1574
+ * A table name of the analyzer, null for a name that a statement left out
1575
+ */
1576
+ export interface ConnectionTableName {
1577
+ databaseName: string | null;
1578
+ schemaName: string | null;
1579
+ tableName: string | null;
1580
+ }
1581
+
1582
+ /**
1583
+ * The tokens of a connection as their JSON, null for a token that the connection doesn't hold. Only
1584
+ * `Runtime.revealConnectionSecrets` hands them out, the views summarize them.
1585
+ */
1586
+ export interface ConnectionSecrets {
1587
+ /**
1588
+ * The OAuth token of a Trino connection
1589
+ */
1590
+ accessToken: string | null;
1591
+ /**
1592
+ * The core token of a Salesforce connection
1593
+ */
1594
+ coreAccessToken: string | null;
1595
+ /**
1596
+ * The Data Cloud token of a Salesforce connection
1597
+ */
1598
+ dataCloudAccessToken: string | null;
1599
+ }
1600
+
1601
+ /**
1602
+ * A connection of the list of connections
1603
+ */
1604
+ export interface ConnectionListEntry {
1605
+ connectionId: string;
1606
+ connectorType: ConnectorType;
1607
+ active: boolean;
1608
+ /**
1609
+ * Is the connection listed next to the workbooks? Connections that workbooks use are, as are active ones.
1610
+ */
1611
+ listed: boolean;
1612
+ /**
1613
+ * The number of the connection among the listed connections of its connector from 1, null if it is the only one
1614
+ */
1615
+ ordinal: number | null;
1616
+ }
1617
+
1947
1618
  /**
1948
1619
  * A token of a connection without its secret: the facts around it that the views show, e.g. the instance or the
1949
1620
  * expiry. The token itself stays in the runtime, `Runtime.revealConnectionSecrets` hands it out on request.
@@ -1972,20 +1643,6 @@ export interface ConnectionRelationName {
1972
1643
  tableName: string;
1973
1644
  }
1974
1645
 
1975
- /**
1976
- * The connections of the runtime, the slice `connectionList`
1977
- */
1978
- export interface ConnectionListView {
1979
- /**
1980
- * The connections in the order they were registered
1981
- */
1982
- connections: ConnectionListEntry[];
1983
- /**
1984
- * The ids of the connections by connector, in the order they were registered
1985
- */
1986
- connectionsByType: string[][];
1987
- }
1988
-
1989
1646
  /**
1990
1647
  * The OAuth flow of a Salesforce connection, the steps that didn't happen yet are null. The PKCE verifier, the code
1991
1648
  * and the tokens stay in the runtime.
@@ -2209,393 +1866,562 @@ export interface ImportPreview {
2209
1866
  /**
2210
1867
  * False when unusable entries were removed from the file lists of the workbook file
2211
1868
  */
2212
- filesValid: boolean;
1869
+ filesValid: boolean;
1870
+ /**
1871
+ * The folder of a native workbook that is registered in place, null for a copy
1872
+ */
1873
+ nativePath: string | null;
1874
+ }
1875
+
1876
+
1877
+ /** What hears a run of a workbook */
1878
+ export interface RunListener {
1879
+ /** Something happened to a script of the run, a failure comes with what the platform failed with */
1880
+ script?(file: string, event: WorkbookScriptRunEvent, error: unknown): void;
1881
+ /** Set up a connection that statements run on before the first statement, e.g. with the credentials of the command line tool. The scripts of a connection whose setup rejects are skipped. A run with it takes every connection of the workbook. */
1882
+ prepareConnection?(connectionId: string): Promise<void>;
1883
+ }
1884
+
1885
+
1886
+ /**
1887
+ * The error of a failed or cancelled query
1888
+ */
1889
+ export interface QueryErrorView {
1890
+ message: string;
1891
+ details: string | null;
1892
+ }
1893
+
1894
+ /**
1895
+ * A query, the slice `query` of the runtime: its text, what it is, its status and its latest progress. The field names
1896
+ * are the ones the app reads. The result table is a table of the handle table of the platform.
1897
+ */
1898
+ export interface QueryView {
1899
+ queryId: number;
1900
+ /**
1901
+ * The connection of the query
1902
+ */
1903
+ connectionId: string;
1904
+ /**
1905
+ * The trace of the log messages of the query
1906
+ */
1907
+ traceId: number;
1908
+ queryText: string;
1909
+ queryMetadata: QueryMetadataView;
1910
+ status: QueryExecutionStatus;
1911
+ metrics: QueryMetricsView;
1912
+ error: QueryErrorView | null;
1913
+ resultTable: QueryResultTableView | null;
1914
+ cacheKey: string | null;
1915
+ servedFromCache: boolean;
1916
+ cacheDeleted: boolean;
1917
+ cachedAt: number | null;
1918
+ latestProgressUpdate: QueryLatestProgressView | null;
1919
+ revision: number;
1920
+ /**
1921
+ * The handle of the record of the query at the host
1922
+ */
1923
+ handle: number | null;
1924
+ }
1925
+
1926
+ /**
1927
+ * A progress update of a channel of the host: the plain fields and the raw progress payload of the engine, e.g.
1928
+ * `{ kind: 'hyper_query_status', status, receivedAt }`. The progress model of the query in the executor turns the
1929
+ * payload into the structured progress.
1930
+ */
1931
+ export interface QueryProgressView {
1932
+ isQueued: boolean | null;
1933
+ progressPercent: number | null;
1934
+ resultRows: number | null;
1935
+ rowsProcessed: number | null;
1936
+ executionTimeMs: number | null;
1937
+ /**
1938
+ * The metrics of the response stream, none counts nothing
1939
+ */
1940
+ metrics?: QueryStreamMetrics | null;
1941
+ phase?: string | null;
1942
+ /**
1943
+ * The raw progress payload of the engine, a payload of an unknown kind is dropped
1944
+ */
1945
+ engineProgress?: unknown;
1946
+ }
1947
+
1948
+ /**
1949
+ * What a query is and who issued it. A planned statement of a run of a workbook is opaque JSON
1950
+ * (`PlannedStatement` of the app).
1951
+ */
1952
+ export interface QueryMetadataView {
1953
+ queryType: QueryType;
1954
+ title: string | null;
1955
+ description: string | null;
1956
+ issuer: string | null;
1957
+ userProvided: boolean;
1958
+ workbookId?: string;
1959
+ resultOwner?: string;
1960
+ planned?: unknown;
1961
+ }
1962
+
1963
+ /**
1964
+ * The metrics of the finished queries of a history, internal queries don't count
1965
+ */
1966
+ export interface QueryHistoryMetrics {
1967
+ successfulQueries: QueryOutcomeMetrics;
1968
+ canceledQueries: QueryOutcomeMetrics;
1969
+ failedQueries: QueryOutcomeMetrics;
1970
+ }
1971
+
1972
+ /**
1973
+ * The metrics of the finished queries of one outcome
1974
+ */
1975
+ export interface QueryOutcomeMetrics {
1976
+ totalQueries: number;
1977
+ totalBatchesReceived: number;
1978
+ totalRowsReceived: number;
1979
+ accumulatedTimeUntilFirstBatch: number;
1980
+ accumulatedQueryDuration: number;
1981
+ }
1982
+
1983
+ /**
1984
+ * The keys of the structured progress of a query that the host holds, their payloads don't cross again
1985
+ */
1986
+ export interface QueryProfileKeys {
1987
+ /**
1988
+ * The revision of the progress, the execution state crosses when it differs
1989
+ */
1990
+ revision: number | null;
1991
+ /**
1992
+ * The version of the structure, the structure crosses when it differs
1993
+ */
1994
+ structureVersion: number | null;
1995
+ }
1996
+
1997
+ /**
1998
+ * The structured progress of a query: the plan with its stages and their execution state. A payload is null when the
1999
+ * host holds it already, its key names it.
2000
+ */
2001
+ export interface QueryProfileProgressView {
2002
+ /**
2003
+ * The revision of the progress, it changes with the structure or the execution state
2004
+ */
2005
+ revision: number;
2006
+ /**
2007
+ * The version of the structure
2008
+ */
2009
+ structureVersion: number;
2010
+ /**
2011
+ * The packed `QueryProfile`, null while the host holds its version
2012
+ */
2013
+ structure: FlatBuffer<buffers_profile.QueryProfile> | null;
2213
2014
  /**
2214
- * The folder of a native workbook that is registered in place, null for a copy
2015
+ * The execution state as packed `QueryProfileEvents`, one event per entity with state, null while the host holds
2016
+ * the revision
2215
2017
  */
2216
- nativePath: string | null;
2018
+ execution: FlatBuffer<buffers_profile.QueryProfileEvents> | null;
2217
2019
  }
2218
2020
 
2219
2021
  /**
2220
- * A workbook of the list of the workbooks
2022
+ * The result table of a query, the host keeps it under its handle
2221
2023
  */
2222
- export interface WorkbookListEntry {
2223
- workbookId: string;
2224
- name: string | null;
2225
- ephemeral: boolean;
2226
- /**
2227
- * Is the workbook a read-only look at a version of a published workbook?
2228
- */
2229
- cloudPreview: boolean;
2024
+ export interface QueryResultTableView {
2025
+ id: number;
2026
+ rows: number;
2230
2027
  }
2231
2028
 
2232
2029
  /**
2233
- * A change of the text of a script in the offset unit of the editors
2030
+ * The metrics of the response stream of a query, as the connector counts them
2234
2031
  */
2235
- export interface WorkbookTextChange {
2236
- from: number;
2237
- to: number;
2238
- insert: string;
2032
+ export interface QueryStreamMetrics {
2033
+ totalDataBytesReceived: number;
2034
+ totalBatchesReceived: number;
2035
+ totalRowsReceived: number;
2036
+ totalQueryRequestsStarted: number;
2037
+ totalQueryRequestsSucceeded: number;
2038
+ totalQueryRequestsFailed: number;
2039
+ totalQueryRequestDurationMs: number;
2040
+ durationUntilFirstBatchMs: number | null;
2239
2041
  }
2240
2042
 
2241
2043
  /**
2242
- * What the runtime derives from the scripts of a workbook with the planner: the checked script references, the
2243
- * dataflow and the inputs. The text spans are in the offset unit of the editors.
2044
+ * The latest progress update of a query: the plain fields and the structured progress
2244
2045
  */
2245
- export interface WorkbookDerivedView {
2246
- workbookId: string;
2247
- /**
2248
- * The keys of the scripts in the order of the derived buffers, the feed order
2249
- */
2250
- scriptKeys: number[];
2251
- /**
2252
- * The file names of the scripts in the order of the derived buffers, the references name scripts by index
2253
- */
2254
- scriptFiles: string[];
2255
- /**
2256
- * The file names of the attachments in the order that the references name them by index
2257
- */
2258
- attachments: string[];
2259
- references: FlatBuffer<buffers_execution.ScriptReferenceCheck>;
2260
- dataflow: FlatBuffer<buffers_execution.SessionDataflow>;
2261
- inputs: FlatBuffer<buffers_execution.SessionInputs>;
2046
+ export interface QueryLatestProgressView {
2047
+ isQueued: boolean | null;
2048
+ progressPercent: number | null;
2049
+ resultRows: number | null;
2050
+ rowsProcessed: number | null;
2051
+ executionTimeMs: number | null;
2052
+ metrics: QueryStreamMetrics;
2053
+ phase: string | null;
2054
+ profile: QueryProfileProgressView | null;
2055
+ }
2056
+
2057
+ /**
2058
+ * The layout of the plans of query profiles, the fields of `ProfileLayoutConfigT` of the generated FlatBuffer code
2059
+ */
2060
+ export interface ProfileLayoutView {
2061
+ levelHeight: number;
2062
+ nodeHeight: number;
2063
+ nodeMarginHorizontal: number;
2064
+ nodePaddingLeft: number;
2065
+ nodePaddingRight: number;
2066
+ iconWidth: number;
2067
+ iconMarginRight: number;
2068
+ maxLabelChars: number;
2069
+ widthPerLabelChar: number;
2070
+ nodeMinWidth: number;
2071
+ nodeMarginVertical: number;
2262
2072
  /**
2263
- * The hashes of the references, the dataflow and the inputs: a buffer with the hash of the previous view has its
2264
- * bytes
2073
+ * A `ProfileLayoutOrientation`
2265
2074
  */
2266
- hashes: [string, string, string];
2075
+ orientation: number;
2076
+ symbolWidth: number;
2267
2077
  }
2268
2078
 
2269
2079
  /**
2270
- * A script as the workbook file lists it: its name and the connection it names
2080
+ * The points in time of a query in milliseconds since epoch and its counters
2271
2081
  */
2272
- export interface WorkbookScriptListEntry {
2273
- name: string;
2274
- connectionId: string;
2082
+ export interface QueryMetricsView {
2083
+ queryRequestedAt: number | null;
2084
+ querySendingStartedAt: number | null;
2085
+ queryQueuedStartedAt: number | null;
2086
+ queryRunningStartedAt: number | null;
2087
+ receivedFirstBatchAt: number | null;
2088
+ receivedLastBatchAt: number | null;
2089
+ receivedAllBatchesAt: number | null;
2090
+ processingResultsStartedAt: number | null;
2091
+ processedResultsAt: number | null;
2092
+ querySucceededAt: number | null;
2093
+ queryFailedAt: number | null;
2094
+ queryCancelledAt: number | null;
2095
+ lastUpdatedAt: number | null;
2096
+ progressUpdatesReceived: number;
2097
+ queryDurationMs: number | null;
2098
+ textLength: number | null;
2099
+ streamMetrics: QueryStreamMetrics;
2275
2100
  }
2276
2101
 
2102
+
2103
+ import type * as buffers_editor from '../gen/flatbuffers/dashql/buffers/editor.js';
2104
+ import type * as buffers_diff from '../gen/flatbuffers/dashql/buffers/diff.js';
2105
+ import type * as buffers_execution from '../gen/flatbuffers/dashql/buffers/execution.js';
2106
+ import type * as buffers_profile from '../gen/flatbuffers/dashql/buffers/profile.js';
2107
+ /** The bytes of a packed FlatBuffer whose root table is `T`, read with the generated accessors */
2108
+ export type FlatBuffer<T> = Uint8Array & { readonly __flatbufferRoot?: T };
2109
+
2110
+
2277
2111
  /**
2278
- * The visualization of a script, the compiled visualization is null when the host holds the one of the key
2112
+ * Opaque JSON in a view: a workbook file, a connection entry, the params of a connection. It crosses as a plain JS
2113
+ * value and is read the way `JSON.stringify` reads it: members that are undefined or functions are left out, `toJSON`
2114
+ * is called, numbers that are not finite are null.
2279
2115
  */
2280
- export interface WorkbookScriptVisualization {
2281
- key: number;
2282
- /**
2283
- * The SQL of the query
2284
- */
2285
- sql: string;
2286
- /**
2287
- * The statement with the tags
2288
- */
2289
- statementId: number;
2290
- visualization: FlatBuffer<buffers_execution.CompiledVisualization> | null;
2291
- }
2116
+ export type JsonValue = unknown;
2292
2117
 
2293
2118
  /**
2294
- * The dashboard placement of a script, the `@board` tag of its last statement
2119
+ * The rows that a data search matched with their matching columns, the table by its handle
2295
2120
  */
2296
- export interface WorkbookBoardPosition {
2297
- statementId: number;
2298
- row: number | null;
2299
- column: number | null;
2300
- width: number;
2301
- height: number;
2121
+ export interface ComputationDataSearchTable {
2122
+ dataTable: number;
2123
+ rows: number;
2124
+ dataFrame: number;
2125
+ inputRowNumberColumnName: string;
2126
+ version: ComputationVersionValue;
2127
+ requestId: number;
2302
2128
  }
2303
2129
 
2304
2130
  /**
2305
- * The keys of the payloads of a script that the host holds, the view leaves their bytes out
2131
+ * A key of an ordering, ascending and nulls last without
2306
2132
  */
2307
- export interface WorkbookScriptKeys {
2308
- editorUpdate: string | null;
2309
- pendingDiff: number | null;
2310
- visualization: number | null;
2311
- /**
2312
- * The newest processing statistics, the host holds the older ones as well
2313
- */
2314
- statistics: number | null;
2133
+ export interface ComputationOrderBy {
2134
+ field: string;
2135
+ ascending?: boolean;
2136
+ nullsFirst?: boolean;
2315
2137
  }
2316
2138
 
2317
2139
  /**
2318
- * The workbooks in the order they were registered and the workbooks that were refused a load
2140
+ * The version of a computation: the data changes with a new data frame, the filter with every scheduled filtering
2319
2141
  */
2320
- export interface WorkbookListView {
2321
- workbooks: WorkbookListEntry[];
2322
- invalidWorkbooks: RestoredInvalidWorkbook[];
2323
- /**
2324
- * The name of a new workbook: the first of "Untitled", "Untitled 2", ... that no other workbook has
2325
- */
2326
- nextWorkbookName: string;
2142
+ export interface ComputationVersionValue {
2143
+ data: number;
2144
+ filter: number;
2327
2145
  }
2328
2146
 
2329
2147
  /**
2330
- * The cached result of a script: the reusable key of its result and when the newest file of the key was written
2148
+ * The context of a call of the compute platform: the computation, the title of its task in the query history, the
2149
+ * connection and the client context of the computation, and the run that `cancel` aborts
2331
2150
  */
2332
- export interface WorkbookScriptCachedResult {
2333
- key: string;
2151
+ export interface ComputeCallContext {
2152
+ tableId: number;
2153
+ title: string;
2154
+ connectionId: string | null;
2334
2155
  /**
2335
- * Milliseconds since the epoch
2156
+ * The client context of the queries of a computation without a connection, opaque JSON
2336
2157
  */
2337
- cachedAt: number;
2158
+ clientContext: string | null;
2159
+ run: number;
2338
2160
  }
2339
2161
 
2340
2162
  /**
2341
- * A copy of a connection that the workbook file holds, its params are JSON
2163
+ * The selection in the summary of a column group
2342
2164
  */
2343
- export interface WorkbookConnectionCopy {
2344
- connectionId: string;
2345
- params: string;
2346
- }
2165
+ export type ComputationCrossFilter = { kind: "histogram"; column: number; selection: [number, number] } | { kind: "mostFrequent"; column: number; valueId: number };
2347
2166
 
2348
2167
  /**
2349
- * A workbook: its plain fields and its scripts in feed order. It lists the keys of its scripts, not their revisions:
2350
- * a change of a script changes the slice of the script and leaves the workbook alone.
2168
+ * A column of the grid of a result
2351
2169
  */
2352
- export interface WorkbookView {
2353
- workbookId: string;
2354
- name: string | null;
2355
- /**
2356
- * The metadata of the workbook file: the origin, whether it is ephemeral, the whole link to a cloud
2357
- */
2358
- workbookMetadata: JsonValue;
2359
- ephemeral: boolean;
2360
- /**
2361
- * The connection of the next appended script when no script determines it
2362
- */
2363
- pendingConnectionId: string | null;
2364
- cloud: WorkbookCloudLink | null;
2365
- /**
2366
- * Null until storage listed the files of the workbook
2367
- */
2368
- attachments: WorkbookAttachmentView[] | null;
2369
- /**
2370
- * The script list of the workbook file
2371
- */
2372
- scriptList: WorkbookScriptList;
2373
- /**
2374
- * The keys of the scripts in feed order
2375
- */
2376
- scriptKeys: number[];
2377
- /**
2378
- * The file names of the scripts in feed order
2379
- */
2380
- scriptOrder: string[];
2381
- /**
2382
- * The connections of the scripts in feed order
2383
- */
2384
- scriptConnections: string[];
2385
- /**
2386
- * The connections that the workbook uses: of its scripts in the order they first use them, then the pending one
2387
- */
2388
- connectionIds: string[];
2389
- /**
2390
- * The connection that an appended script runs on, the one that `createScript` without a connection takes
2391
- */
2392
- nextScriptConnectionId: string | null;
2170
+ export type ComputationColumnGroup = { type: "ROWNUMBER"; value: { rowNumberFieldName: string } } | { type: "SKIPPED"; value: { inputFieldName: string; inputFieldType: string; inputFieldNullable: boolean } } | { type: "ORDINAL"; value: ComputationValueColumn } | { type: "STRING"; value: ComputationValueColumn } | { type: "LIST"; value: ComputationValueColumn };
2171
+
2172
+ /**
2173
+ * The fields of the table aggregation with the statistics of a column
2174
+ */
2175
+ export interface ComputationStatsFields {
2176
+ countFieldName: string;
2177
+ distinctCountFieldName: string | null;
2178
+ minAggregateFieldName: string | null;
2179
+ maxAggregateFieldName: string | null;
2180
+ }
2181
+
2182
+ /**
2183
+ * The table and the data frame of a summary
2184
+ */
2185
+ export interface ComputationColumnSummary {
2186
+ table: number;
2187
+ dataFrame: number;
2188
+ analysis: ComputationSummaryAnalysis | null;
2393
2189
  }
2394
2190
 
2395
2191
  /**
2396
- * The published workbook of a cloud that a workbook came from or was published to
2192
+ * The rows that pass the filters, the table by its handle
2397
2193
  */
2398
- export interface WorkbookCloudLink {
2399
- workbookId: string;
2400
- versionId: string;
2401
- preview: boolean;
2194
+ export interface ComputationFilterTable {
2195
+ dataTable: number;
2196
+ rows: number;
2197
+ dataFrame: number;
2198
+ inputRowNumberColumnName: string;
2199
+ version: ComputationVersionValue;
2402
2200
  }
2403
2201
 
2404
2202
  /**
2405
- * The processing statistics of an analysis, null when the host holds the ones of the key
2203
+ * The tasks that a computation tracks
2406
2204
  */
2407
- export interface WorkbookScriptStatistics {
2408
- key: number;
2409
- statistics: FlatBuffer<buffers_editor.EditorProcessingStatistics> | null;
2205
+ export interface ComputationTasks {
2206
+ tableAggregationTask: ComputationTrackedTask | null;
2207
+ systemColumnTask: ComputationTrackedTask | null;
2208
+ filteringTask: ComputationTrackedTask | null;
2209
+ orderingTask: ComputationTrackedTask | null;
2210
+ dataSearchTask: ComputationTrackedTask | null;
2211
+ columnAggregationTasks: (ComputationTrackedTask | null)[];
2212
+ filteredColumnAggregationTasks: (ComputationTrackedTask | null)[];
2410
2213
  }
2411
2214
 
2412
2215
  /**
2413
- * The script list of the workbook file
2216
+ * What is searched, the columns by their names or the data
2414
2217
  */
2415
- export interface WorkbookScriptList {
2416
- scripts: WorkbookScriptListEntry[];
2417
- connections: WorkbookConnectionCopy[];
2218
+ export type ComputationSearchKind = "columns" | "data";
2219
+
2220
+ /**
2221
+ * The summary of a column over the rows that the filters and the data search select
2222
+ */
2223
+ export interface ComputationFilteredAggregate {
2224
+ aggregate: ComputationColumnAggregate;
2225
+ filterVersion: ComputationVersionValue;
2226
+ dataSearchRequestId: number | null;
2418
2227
  }
2419
2228
 
2420
2229
  /**
2421
- * A staged rewrite of a script, the diff is null when the host holds the diff of the key
2230
+ * The summary of a column: the table of the binned or the frequent values by its handle, with its analysis
2422
2231
  */
2423
- export interface WorkbookPendingDiff {
2424
- key: number;
2232
+ export type ComputationColumnAggregate = ({ kind: "ordinal" } & ComputationColumnSummary) | ({ kind: "string" } & ComputationColumnSummary) | ({ kind: "list" } & ComputationColumnSummary) | { kind: "skipped" };
2233
+
2234
+ /**
2235
+ * What the lower bounds of the bins of a histogram are
2236
+ */
2237
+ export type ComputationBinBounds = "numbers" | "epochMillis";
2238
+
2239
+ /**
2240
+ * The value column of a column group, ordinal, string or list
2241
+ */
2242
+ export interface ComputationValueColumn {
2243
+ inputFieldName: string;
2425
2244
  /**
2426
- * The text before the rewrite
2245
+ * The type of the field as the runtime names it, the app reads the Arrow type from the schema of the table
2427
2246
  */
2428
- priorText: string;
2429
- diff: FlatBuffer<buffers_diff.ScriptDiff> | null;
2247
+ inputFieldType: string;
2248
+ inputFieldNullable: boolean;
2249
+ statsFields: ComputationStatsFields | null;
2250
+ /**
2251
+ * The bins of an ordinal column, null without
2252
+ */
2253
+ binFieldName: string | null;
2254
+ /**
2255
+ * The number of bins of an ordinal column, 0 without
2256
+ */
2257
+ binCount: number;
2258
+ /**
2259
+ * The value ids of a string or a list column, null without
2260
+ */
2261
+ valueIdFieldName: string | null;
2430
2262
  }
2431
2263
 
2432
2264
  /**
2433
- * A script with its payloads
2265
+ * The numbers of the analysis of a summary that the runtime computed. The app formats the values of the tables: the
2266
+ * minimum and the maximum of the statistics, the lower bounds of the bins and the frequent values.
2434
2267
  */
2435
- export interface WorkbookScriptView {
2436
- key: number;
2437
- /**
2438
- * The workbook of the script
2439
- */
2440
- workbookId: string;
2268
+ export type ComputationSummaryAnalysis = { kind: "ordinal"; totalCount: number; countNotNull: number; countNull: number; binCount: number; binValueCounts: number[]; binPercentages: number[]; binLowerBounds: (number | null)[]; binBounds: ComputationBinBounds } | { kind: "string"; totalCount: number; countNotNull: number; countNull: number; countDistinct: number; isUnique: boolean; frequentValueIds: number[]; frequentValueCounts: number[]; frequentValuePercentages: number[] };
2269
+
2270
+ /**
2271
+ * The view of the computation of a result table. The tables are handles of the platform, the data frames ids of
2272
+ * the compute database.
2273
+ */
2274
+ export interface ComputationView {
2275
+ tableId: number;
2441
2276
  revision: number;
2277
+ connectionId: string | null;
2442
2278
  /**
2443
- * Names the session of the script, a script that moved to another connection has a new one. An editor event names
2444
- * it (`Runtime.applyEditorEvent`).
2279
+ * The client context of the queries of a computation without a connection, opaque JSON
2445
2280
  */
2446
- sessionGeneration: number;
2447
- fileName: string;
2448
- connectionId: string;
2449
- unresolvedConnectionId: string | null;
2450
- analysisOutdated: boolean;
2451
- latestQueryId: number | null;
2452
- latestResultQueryId: number | null;
2281
+ clientContext: string | null;
2282
+ tasks: ComputationTasks;
2283
+ version: ComputationVersionValue;
2453
2284
  /**
2454
- * The cached result of a run of the script in the query result cache, null without one
2285
+ * The table, with the system columns once they are computed
2455
2286
  */
2456
- cachedResult: WorkbookScriptCachedResult | null;
2457
- externalChanges: WorkbookExternalChanges | null;
2287
+ dataTable: number;
2288
+ dataTableRows: number;
2458
2289
  /**
2459
- * What the views read of the analysis
2290
+ * The fields of the table that the computation was created with, in order
2460
2291
  */
2461
- annotations: WorkbookScriptAnnotations;
2292
+ dataTableFields: string[];
2293
+ dataFrame: number | null;
2462
2294
  /**
2463
- * Names the editor update: the generation of the session and a serial that is unique across the scripts of the
2464
- * runtime. An update with the same key is the same update. `Runtime.applyEditorEvent` returns the key of its update,
2465
- * an event names the key of the update that the editor holds.
2295
+ * The column groups of the grid
2466
2296
  */
2467
- editorUpdateKey: string | null;
2468
- editorUpdate: FlatBuffer<buffers_editor.EditorUpdate> | null;
2469
- pendingDiff: WorkbookPendingDiff | null;
2470
- visualization: WorkbookScriptVisualization | null;
2297
+ columnGroups: ComputationColumnGroup[];
2298
+ dataTableOrdering: ComputationOrderBy[];
2471
2299
  /**
2472
- * The processing statistics of the latest analyses, the oldest first
2300
+ * The selections in the summaries of the column groups, in the order of the column groups
2473
2301
  */
2474
- statistics: WorkbookScriptStatistics[];
2302
+ crossFilters: ComputationCrossFilter[];
2303
+ filterTable: ComputationFilterTable | null;
2304
+ orderingTable: ComputationOrderingTable | null;
2305
+ columnSearch: ComputationSearch;
2306
+ dataSearch: ComputationSearch;
2307
+ dataSearchTable: ComputationDataSearchTable | null;
2308
+ rowNumberColumnGroup: number | null;
2309
+ rowNumberColumnName: string | null;
2310
+ tableAggregation: ComputationTableAggregation | null;
2311
+ columnAggregates: (ComputationColumnAggregate | null)[];
2312
+ filteredColumnAggregates: (ComputationFilteredAggregate | null)[];
2313
+ filteredColumnAggregatesOutdated: boolean[];
2475
2314
  }
2476
2315
 
2477
2316
  /**
2478
- * An attachment of a workbook
2317
+ * The comparison of a scalar filter
2479
2318
  */
2480
- export interface WorkbookAttachmentView {
2481
- fileName: string;
2482
- name: string;
2483
- sizeBytes: number;
2484
- mtimeMs: number;
2485
- columns: string[] | null;
2486
- }
2319
+ export type ComputationFilterOp = "=" | "<" | "<=" | ">" | ">=";
2487
2320
 
2488
2321
  /**
2489
- * A script as storage holds it, on a connection of the runtime
2322
+ * A task that a computation tracks, the latest of its kind
2490
2323
  */
2491
- export interface StoredScriptView {
2492
- name: string;
2493
- sql: string;
2494
- connectionId: string;
2324
+ export interface ComputationTrackedTask {
2495
2325
  /**
2496
- * The connection that the workbook file names for the script while the app doesn't know it
2326
+ * The task of the scheduler
2497
2327
  */
2498
- unresolvedConnectionId?: string;
2499
- }
2500
-
2501
- /**
2502
- * What the views read of the analysis of a script: its tables, its positions on the canvas and the board, whether its
2503
- * last statement is a query and whether it runs only on request. Empty without an analysis.
2504
- */
2505
- export interface WorkbookScriptAnnotations {
2328
+ taskId: number;
2506
2329
  /**
2507
- * The names of the tables that the script defines, sorted
2330
+ * The version that the task computes for
2508
2331
  */
2509
- tableDefs: string[];
2510
- flowPosition: WorkbookFlowPosition | null;
2511
- boardPosition: WorkbookBoardPosition | null;
2512
- lastStatementIsQuery: boolean;
2513
- manual: boolean;
2514
- }
2515
-
2516
- /**
2517
- * The last change of the text of a script that the workbook made
2518
- */
2519
- export interface WorkbookExternalChanges {
2520
- fromText: string;
2521
- changes: WorkbookTextChange[];
2332
+ tableVersion: ComputationVersionValue;
2333
+ /**
2334
+ * The filters of a filtering
2335
+ */
2336
+ filters?: ComputationScalarFilter[];
2337
+ /**
2338
+ * The ordering of an ordering, cleared with the ordering of the table
2339
+ */
2340
+ orderingConstraints?: ComputationOrderBy[];
2341
+ progress: ComputationTaskProgress;
2522
2342
  }
2523
2343
 
2524
2344
  /**
2525
- * The placement of a script on the dataflow canvas, its `@flow` tag
2345
+ * A filter that compares a field with a number
2526
2346
  */
2527
- export interface WorkbookFlowPosition {
2528
- statementId: number;
2529
- x: number | null;
2530
- y: number | null;
2531
- width: number | null;
2532
- height: number | null;
2347
+ export interface ComputationScalarFilter {
2348
+ fieldName: string;
2349
+ op: ComputationFilterOp;
2350
+ value: number;
2533
2351
  }
2534
2352
 
2535
2353
  /**
2536
- * A data file of a workbook as storage lists it
2354
+ * The statistics of all columns of a table, the table by its handle
2537
2355
  */
2538
- export interface WorkbookDataFile {
2539
- name: string;
2540
- sizeBytes: number;
2541
- /**
2542
- * The time of the last modification, 0 without one
2543
- */
2544
- mtimeMs?: number;
2356
+ export interface ComputationTableAggregation {
2357
+ table: number;
2358
+ dataFrame: number;
2359
+ countStarFieldName: string;
2545
2360
  }
2546
2361
 
2547
2362
  /**
2548
- * The update of an editor event for the editor, with its key (`WorkbookScriptView.editorUpdateKey`)
2363
+ * The options of the analysis of a result
2549
2364
  */
2550
- export interface EditorEventOutcome {
2551
- update: FlatBuffer<buffers_editor.EditorUpdate>;
2365
+ export interface AnalyzeTableOptions {
2552
2366
  /**
2553
- * Names the update, the next event of the editor names it as the update that the editor holds
2367
+ * The connection that ran the query of the result, its query history lists the queries of the computation
2554
2368
  */
2555
- key: string;
2556
- }
2557
-
2558
- /**
2559
- * The outcome of saving a connection
2560
- */
2561
- export interface ConnectionSaveOutcome {
2369
+ connectionId?: string;
2562
2370
  /**
2563
- * The saved params
2371
+ * The client context of the queries of a computation without a connection, opaque JSON
2564
2372
  */
2565
- params: JsonParams;
2373
+ clientContext?: string;
2566
2374
  /**
2567
- * The outcome of writing the app manifest
2375
+ * Compute the summaries of the columns, true without
2568
2376
  */
2569
- manifest: StorageWriteOutcome;
2377
+ columnAggregates?: boolean;
2570
2378
  /**
2571
- * The outcomes of writing the copies of the workbooks, none if the manifest wasn't written
2379
+ * Order the rows before the analysis settles, e.g. like a result that the result replaces. An ordering of fields
2380
+ * that the result doesn't have is skipped.
2572
2381
  */
2573
- workbooks: ConnectionCopyOutcome[];
2382
+ ordering?: ComputationOrderBy[];
2383
+ }
2384
+
2385
+ /**
2386
+ * The progress of a task, times in milliseconds since epoch
2387
+ */
2388
+ export interface ComputationTaskProgress {
2389
+ status: TaskStatus;
2390
+ startedAt: number;
2391
+ completedAt: number | null;
2392
+ failedAt: number | null;
2393
+ failedWithError: string | null;
2574
2394
  }
2575
2395
 
2576
2396
  /**
2577
- * The outcome of writing the copy of a connection into a workbook
2397
+ * The search of a result, of its columns or of its data
2578
2398
  */
2579
- export interface ConnectionCopyOutcome {
2580
- workbookId: string;
2581
- result: StorageWriteOutcome;
2399
+ export interface ComputationSearch {
2400
+ requestedPattern: string;
2401
+ appliedPattern: string;
2402
+ requestId: number;
2403
+ appliedRequestId: number;
2404
+ matchingColumnGroups: number[] | null;
2405
+ /**
2406
+ * Does the search hold matching rows? They are the rows of the table of the data search.
2407
+ */
2408
+ hasMatchingRows: boolean;
2409
+ pending: boolean;
2410
+ error: string | null;
2582
2411
  }
2583
2412
 
2584
-
2585
- import type * as buffers_editor from '../gen/flatbuffers/dashql/buffers/editor.js';
2586
- import type * as buffers_diff from '../gen/flatbuffers/dashql/buffers/diff.js';
2587
- import type * as buffers_execution from '../gen/flatbuffers/dashql/buffers/execution.js';
2588
- import type * as buffers_profile from '../gen/flatbuffers/dashql/buffers/profile.js';
2589
- /** The bytes of a packed FlatBuffer whose root table is `T`, read with the generated accessors */
2590
- export type FlatBuffer<T> = Uint8Array & { readonly __flatbufferRoot?: T };
2591
-
2592
-
2593
2413
  /**
2594
- * Opaque JSON in a view: a workbook file, a connection entry, the params of a connection. It crosses as a plain JS
2595
- * value and is read the way `JSON.stringify` reads it: members that are undefined or functions are left out, `toJSON`
2596
- * is called, numbers that are not finite are null.
2414
+ * The row numbers in the order of the grid, the table by its handle
2597
2415
  */
2598
- export type JsonValue = unknown;
2416
+ export interface ComputationOrderingTable {
2417
+ dataTable: number;
2418
+ rows: number;
2419
+ dataFrame: number;
2420
+ inputRowNumberColumnName: string;
2421
+ orderingConstraints: ComputationOrderBy[];
2422
+ version: ComputationVersionValue;
2423
+ dataSearchRequestId: number | null;
2424
+ }
2599
2425
 
2600
2426
  /**
2601
2427
  * How a setup runs
@@ -2751,46 +2577,200 @@ export type QueryCallerEvent = { type: "timing"; label: string; elapsedMs: numbe
2751
2577
  export type QueryRunOutcome = { status: "resolved"; hasResult: boolean; table: unknown } | { status: "rejected"; failure: QueryRunFailure; value: unknown };
2752
2578
 
2753
2579
  /**
2754
- * The storage of the runtime: what holds the writes, the writes that failed, and the questions about workbook folders
2755
- * that changed outside the app. The workbooks whose writes a change outside the app holds are the holds with the
2756
- * reason `externalChange`.
2580
+ * The type of a column of a workbook table
2757
2581
  */
2758
- export interface StorageView {
2582
+ export type WorkbookTableColumnType = "text" | "integer" | "boolean";
2583
+
2584
+ /**
2585
+ * What an export writes
2586
+ */
2587
+ export type ExportFormat = "archive" | "link" | "tables";
2588
+
2589
+ /**
2590
+ * A column of a workbook table
2591
+ */
2592
+ export interface WorkbookTableColumn {
2593
+ name: string;
2594
+ type: WorkbookTableColumnType;
2595
+ nullable: boolean;
2596
+ }
2597
+
2598
+ /**
2599
+ * A workbook table of the format with its columns
2600
+ */
2601
+ export interface WorkbookTableSchema {
2602
+ name: string;
2603
+ columns: WorkbookTableColumn[];
2604
+ }
2605
+
2606
+ /**
2607
+ * The cached results of the scripts of a workbook
2608
+ */
2609
+ export interface ExportedResults {
2759
2610
  /**
2760
- * The holds of the writer (no workbook) and of the workbooks, with their reasons
2611
+ * The scripts with a cached result
2761
2612
  */
2762
- holds: StorageHoldView[];
2613
+ cachedScripts: number;
2763
2614
  /**
2764
- * The writes that failed, with their last errors
2615
+ * The scripts
2765
2616
  */
2766
- failedWrites: FailedStorageWriteView[];
2617
+ totalScripts: number;
2767
2618
  /**
2768
- * The workbooks whose scripts changed on disk, the app asks the user whether to reload them
2769
- * (`answerExternalChange`)
2619
+ * The files of the results, one per key
2770
2620
  */
2771
- externalChanges: ExternalChangeView[];
2621
+ files: number;
2622
+ /**
2623
+ * The bytes of the files. An archive stores them as they are, it grows by about as much.
2624
+ */
2625
+ bytes: number;
2772
2626
  }
2773
2627
 
2774
2628
  /**
2775
- * A question about a workbook folder whose scripts changed outside the app
2629
+ * What an export wrote
2776
2630
  */
2777
- export interface ExternalChangeView {
2631
+ export interface ExportOutcome {
2632
+ /**
2633
+ * The archive, a Blob of the handle table that the caller releases
2634
+ */
2635
+ archive: number | null;
2636
+ /**
2637
+ * The link
2638
+ */
2639
+ link: string | null;
2640
+ /**
2641
+ * The cached results that the export carries
2642
+ */
2643
+ results: ExportedResults;
2644
+ }
2645
+
2646
+ /**
2647
+ * The options of the link of a connection
2648
+ */
2649
+ export interface ConnectionLinkOptions {
2650
+ /**
2651
+ * Carry the login hint of the sharer in the params, true if absent
2652
+ */
2653
+ withLoginHint?: boolean;
2654
+ /**
2655
+ * The URL of the app that opens the link
2656
+ */
2657
+ linkBase: string;
2658
+ }
2659
+
2660
+ /**
2661
+ * The options of an export of a workbook
2662
+ */
2663
+ export interface ExportOptions {
2664
+ /**
2665
+ * What the export writes
2666
+ */
2667
+ format?: ExportFormat;
2668
+ /**
2669
+ * Carry the cached query results of the scripts, a link never does
2670
+ */
2671
+ results?: boolean;
2672
+ /**
2673
+ * Carry the catalogs of the connections, true for files and tables and false for links if absent
2674
+ */
2675
+ withCatalog?: boolean;
2676
+ /**
2677
+ * Carry the login hint of the sharer in the params, true if absent
2678
+ */
2679
+ withLoginHint?: boolean;
2680
+ /**
2681
+ * Keep the workbook and connection ids instead of fresh ones
2682
+ */
2683
+ preserveUuids?: boolean;
2684
+ /**
2685
+ * The URL of the app that opens a link
2686
+ */
2687
+ linkBase?: string;
2688
+ }
2689
+
2690
+ /**
2691
+ * What a restore restored: the connections and the workbooks that the runtime took, in order, the workbooks that were
2692
+ * refused a load and the progress
2693
+ */
2694
+ export interface RestoreOutcome {
2695
+ connectionIds: string[];
2696
+ workbookIds: string[];
2697
+ invalidWorkbooks: RestoredInvalidWorkbook[];
2698
+ progress: RestoreProgress;
2699
+ }
2700
+
2701
+ /**
2702
+ * A counter of the progress of a step of a restore
2703
+ */
2704
+ export interface RestoreProgressCounter {
2705
+ started: number;
2706
+ succeeded: number;
2707
+ skipped: number;
2708
+ failed: number;
2709
+ /**
2710
+ * Null until the total is known
2711
+ */
2712
+ total: number | null;
2713
+ }
2714
+
2715
+ /**
2716
+ * A script file of a workbook
2717
+ */
2718
+ export interface RestoreScriptFile {
2719
+ name: string;
2720
+ sql: string;
2721
+ }
2722
+
2723
+ /**
2724
+ * The progress of a restore
2725
+ */
2726
+ export interface RestoreProgress {
2727
+ restoreConnections: RestoreProgressCounter;
2728
+ restoreCatalogs: RestoreProgressCounter;
2729
+ restoreWorkbookScripts: RestoreProgressCounter;
2730
+ }
2731
+
2732
+ /**
2733
+ * A workbook that failed its validation or couldn't be restored
2734
+ */
2735
+ export interface RestoredInvalidWorkbook {
2778
2736
  workbookId: string;
2737
+ title: string;
2738
+ connectorType: ConnectorType | null;
2779
2739
  /**
2780
- * The number of the question, the answer names it. A second question about the same change has a new number.
2740
+ * The code of the validation error, e.g. `unsupported_format_version`
2781
2741
  */
2782
- prompt: number;
2742
+ error: string;
2783
2743
  /**
2784
- * Does the app hold writes of the scripts that a reload discards?
2744
+ * A short explanation of the error for the user
2785
2745
  */
2786
- pendingWrites: boolean;
2746
+ description: string;
2787
2747
  }
2788
2748
 
2789
2749
  /**
2790
- * A command of the storage writer that waits for writes. The commands that change the writer right away are methods
2791
- * of the runtime (`storageHold`, `storageRelease`, `storageDiscardWrites`).
2750
+ * The outcome of saving a connection
2792
2751
  */
2793
- export type StorageCommand = { kind: "flush"; closing?: boolean } | { kind: "settle" } | { kind: "flushWorkbook"; workbookId: string } | { kind: "deleteWorkbook"; workbookId: string } | { kind: "handOver" };
2752
+ export interface ConnectionSaveOutcome {
2753
+ /**
2754
+ * The saved params
2755
+ */
2756
+ params: JsonParams;
2757
+ /**
2758
+ * The outcome of writing the app manifest
2759
+ */
2760
+ manifest: StorageWriteOutcome;
2761
+ /**
2762
+ * The outcomes of writing the copies of the workbooks, none if the manifest wasn't written
2763
+ */
2764
+ workbooks: ConnectionCopyOutcome[];
2765
+ }
2766
+
2767
+ /**
2768
+ * The outcome of writing the copy of a connection into a workbook
2769
+ */
2770
+ export interface ConnectionCopyOutcome {
2771
+ workbookId: string;
2772
+ result: StorageWriteOutcome;
2773
+ }
2794
2774
 
2795
2775
  /**
2796
2776
  * A catalog (`dashql_catalog_*`)
@@ -3170,13 +3150,6 @@ export class Runtime {
3170
3150
  * The text of the script with the functions of a connection, none once it is deleted
3171
3151
  */
3172
3152
  functionScriptText(connection_id: string): string | undefined;
3173
- /**
3174
- * Add a result of a key to the query result cache, e.g. one that a run of the command line tool wrote, from a file of
3175
- * the handle table that the caller keeps and releases. A key that is cached already keeps its files. An added file
3176
- * is followed by the eviction of a written one, and the workbooks look up the cached results of their scripts
3177
- * again. Resolves whether the file was added.
3178
- */
3179
- importCachedResult(key: string, file: number): Promise<boolean>;
3180
3153
  /**
3181
3154
  * Is the analysis of a script outdated, also by a change that the workbook missed?
3182
3155
  */
@@ -3236,14 +3209,6 @@ export class Runtime {
3236
3209
  * storage root. The restore migrates the folder of a workbook itself.
3237
3210
  */
3238
3211
  migrateWorkbookFolder(workbook_id: string): Promise<'current' | 'migrated' | 'missing' | 'unsupported' | 'newer' | null>;
3239
- /**
3240
- * The auth of a connection as it goes with its requests, for a process that sends the requests of the connection
3241
- * for another one, e.g. the relay of `dashql connect`: the auth headers by the origin of the endpoints, with
3242
- * tokens that are refreshed first if they are about to expire, the account and the stand-in responses of the
3243
- * token requests of the login. Null for a connection without a channel of Trino or Salesforce or with a Trino
3244
- * channel that has no token yet, rejects when the refresh fails.
3245
- */
3246
- connectionAuthorization(connection_id: string): Promise<ConnectionAuthorization | null>;
3247
3212
  /**
3248
3213
  * The recording of the progress of a query as JSON, none without structured progress
3249
3214
  */
@@ -3885,7 +3850,6 @@ export interface InitOutput {
3885
3850
  readonly runtime_checkWorkbookFolders: (a: number, b: number, c: number) => void;
3886
3851
  readonly runtime_closeSession: (a: number, b: number, c: number, d: number) => void;
3887
3852
  readonly runtime_commitImport: (a: number, b: number, c: any, d: any) => [number, number, number];
3888
- readonly runtime_connectionAuthorization: (a: number, b: number, c: number) => [number, number, number];
3889
3853
  readonly runtime_connectionParamsLoginHint: (a: any) => [number, number, number, number];
3890
3854
  readonly runtime_connectionParamsShareEqual: (a: any, b: any) => number;
3891
3855
  readonly runtime_connectionParamsWithoutDraftRows: (a: any) => [number, number, number];
@@ -3902,7 +3866,6 @@ export interface InitOutput {
3902
3866
  readonly runtime_followQueryProgress: (a: number, b: number, c: number, d: number) => [number, number, number];
3903
3867
  readonly runtime_functionScriptText: (a: number, b: number, c: number) => [number, number, number, number];
3904
3868
  readonly runtime_hyperCloudDefaultDatabaseName: () => [number, number];
3905
- readonly runtime_importCachedResult: (a: number, b: number, c: number, d: number) => [number, number, number];
3906
3869
  readonly runtime_isAnalysisOutdated: (a: number, b: number) => number;
3907
3870
  readonly runtime_isWorkbookHeld: (a: number, b: number, c: number) => number;
3908
3871
  readonly runtime_matchesStoredScripts: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
@@ -3946,6 +3909,9 @@ export interface InitOutput {
3946
3909
  readonly runtime_views: (a: number, b: number, c: number, d: any, e: any) => [number, number, number];
3947
3910
  readonly runtime_watchProfile: (a: number, b: number, c: number) => [number, number];
3948
3911
  readonly runtime_workbookTables: () => [number, number, number];
3912
+ readonly __wbg_queryprogressfollower_free: (a: number, b: number) => void;
3913
+ readonly queryprogressfollower_new: (a: number) => [number, number, number];
3914
+ readonly replayQueryProgress: (a: number, b: number, c: number, d: number) => [number, number, number];
3949
3915
  readonly __wbg_catalog_free: (a: number, b: number) => void;
3950
3916
  readonly __wbg_queryprofile_free: (a: number, b: number) => void;
3951
3917
  readonly __wbg_script_free: (a: number, b: number) => void;
@@ -4140,13 +4106,10 @@ export interface InitOutput {
4140
4106
  readonly workbookscriptsession_textVersion: (a: number) => [bigint, number, number];
4141
4107
  readonly shellpromptresult_cursorByteOffset: (a: number) => number;
4142
4108
  readonly shellpromptresult_revision: (a: number) => bigint;
4143
- readonly __wbg_queryprogressfollower_free: (a: number, b: number) => void;
4144
- readonly queryprogressfollower_new: (a: number) => [number, number, number];
4145
- readonly replayQueryProgress: (a: number, b: number, c: number, d: number) => [number, number, number];
4146
- readonly wasm_bindgen__convert__closures_____invoke__hc9cbe033348e018d: (a: number, b: number, c: any) => void;
4147
- readonly wasm_bindgen__closure__destroy__he52a6c160ad8bcc6: (a: number, b: number) => void;
4148
4109
  readonly wasm_bindgen__convert__closures_____invoke__ha7a2b373f2a9ce09: (a: number, b: number, c: any) => any;
4149
4110
  readonly wasm_bindgen__closure__destroy__h74bdb7d22b702b82: (a: number, b: number) => void;
4111
+ readonly wasm_bindgen__convert__closures_____invoke__hc9cbe033348e018d: (a: number, b: number, c: any) => void;
4112
+ readonly wasm_bindgen__closure__destroy__he52a6c160ad8bcc6: (a: number, b: number) => void;
4150
4113
  readonly wasm_bindgen__convert__closures_____invoke__h3cb6850919769fd7: (a: number, b: number, c: any, d: any) => void;
4151
4114
  readonly __wbindgen_malloc: (a: number, b: number) => number;
4152
4115
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;