@akohn/dashql 0.0.19-dev.299.g3adbd8a4b → 0.0.19-dev.305.gb0f831a47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/api.d.ts +1 -0
- package/dist/core/api.js +3 -0
- package/dist/wasm/dashql_core.d.ts +516 -505
- package/dist/wasm/dashql_core.js +68 -3
- package/dist/wasm/dashql_core.wasm +0 -0
- package/package.json +1 -1
package/dist/core/api.d.ts
CHANGED
|
@@ -197,6 +197,7 @@ export declare abstract class DashQLScriptSessionReader<O extends NativeScriptSe
|
|
|
197
197
|
removeVisFlow(parseIfOutdated?: boolean): string;
|
|
198
198
|
rewriteParamTag(name: string, literal: string, parseIfOutdated?: boolean): string;
|
|
199
199
|
removeParamTag(name: string, parseIfOutdated?: boolean): string;
|
|
200
|
+
rewriteResultProjection(columns: string[], config: buffers.formatting.FormattingConfigT, parseIfOutdated?: boolean): string;
|
|
200
201
|
rewriteVisRenderer(statementId: number, kind: 'vegalite' | 'markdown' | 'table' | null, body?: string, parseIfOutdated?: boolean): string;
|
|
201
202
|
isFullyFormattable(config: buffers.formatting.FormattingConfigT, parseIfOutdated?: boolean): boolean;
|
|
202
203
|
computeDiff(target: DashQLScript): FlatBufferPtr<buffers.diff.ScriptDiff>;
|
package/dist/core/api.js
CHANGED
|
@@ -474,6 +474,9 @@ var DashQLScriptSessionReader = class {
|
|
|
474
474
|
removeParamTag(name, parseIfOutdated = true) {
|
|
475
475
|
return this.ptr.assertNotNull().removeParamTag(name, parseIfOutdated);
|
|
476
476
|
}
|
|
477
|
+
rewriteResultProjection(columns, config, parseIfOutdated = true) {
|
|
478
|
+
return this.ptr.assertNotNull().rewriteResultProjection(columns, config.dialect, config.mode, config.maxWidth, config.indentationWidth, config.keywordCase, parseIfOutdated);
|
|
479
|
+
}
|
|
477
480
|
rewriteVisRenderer(statementId, kind, body = "", parseIfOutdated = true) {
|
|
478
481
|
return this.ptr.assertNotNull().rewriteVisRenderer(statementId, kind ?? "", body, parseIfOutdated);
|
|
479
482
|
}
|
|
@@ -514,6 +514,126 @@ export interface ImportConflict {
|
|
|
514
514
|
entry: JsonValue;
|
|
515
515
|
}
|
|
516
516
|
|
|
517
|
+
/**
|
|
518
|
+
* The tokens and the user of a login
|
|
519
|
+
*/
|
|
520
|
+
export interface SetupAuthentication {
|
|
521
|
+
tokens: { core: any; dataCloud: any };
|
|
522
|
+
userInfo: any | null;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* How a setup runs
|
|
527
|
+
*/
|
|
528
|
+
export interface SetupOptions {
|
|
529
|
+
/**
|
|
530
|
+
* The params of the setup, the params of the connection by default
|
|
531
|
+
*/
|
|
532
|
+
params?: JsonParams;
|
|
533
|
+
/**
|
|
534
|
+
* The params that the channel connects with when they differ from the ones that the connection keeps, e.g. the
|
|
535
|
+
* credentials of the environment that are never written
|
|
536
|
+
*/
|
|
537
|
+
channelParams?: JsonParams;
|
|
538
|
+
/**
|
|
539
|
+
* Log in again instead of using a session of the browser
|
|
540
|
+
*/
|
|
541
|
+
forceRelogin?: boolean;
|
|
542
|
+
/**
|
|
543
|
+
* The redirect page of the app that an OAuth flow of Salesforce returns to
|
|
544
|
+
*/
|
|
545
|
+
oauthRedirect?: string;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* How a setup or a login ended
|
|
550
|
+
*/
|
|
551
|
+
export interface SetupOutcome {
|
|
552
|
+
status: 'succeeded' | 'failed' | 'cancelled';
|
|
553
|
+
/**
|
|
554
|
+
* The error of a setup that didn't succeed
|
|
555
|
+
*/
|
|
556
|
+
message: string | null;
|
|
557
|
+
/**
|
|
558
|
+
* The details of the error, e.g. the status of a rejected request
|
|
559
|
+
*/
|
|
560
|
+
data: Record<string, string>;
|
|
561
|
+
/**
|
|
562
|
+
* The tokens of a login
|
|
563
|
+
*/
|
|
564
|
+
authentication: SetupAuthentication | null;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* The outcome of a write. A failed write carries what the host failed with, a patch of a workbook file that is not
|
|
569
|
+
* available names the workbook.
|
|
570
|
+
*/
|
|
571
|
+
export type StorageWriteOutcome = { status: "written" } | { status: "superseded" } | { status: "cancelled" } | { status: "deferred" } | { status: "failed"; error: unknown; unavailableWorkbook?: string };
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* The statistics of the writes of a key, with the key within its workbook for display
|
|
575
|
+
*/
|
|
576
|
+
export interface StorageKeyStatistics {
|
|
577
|
+
key: string;
|
|
578
|
+
/**
|
|
579
|
+
* The key without the prefix of its workbook, e.g. `scripts/a.sql:delete`
|
|
580
|
+
*/
|
|
581
|
+
label: string;
|
|
582
|
+
statistics: StorageWriteStatistics;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* A hold of the writer (no workbook) or of a workbook
|
|
587
|
+
*/
|
|
588
|
+
export interface StorageHoldView {
|
|
589
|
+
workbookId: string | null;
|
|
590
|
+
reason: StorageHoldReason;
|
|
591
|
+
count: number;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* The statistics of a key: the scheduled writes of the key and the writes of its file
|
|
596
|
+
*/
|
|
597
|
+
export interface StorageWriteStatistics {
|
|
598
|
+
scheduledWrites: number;
|
|
599
|
+
writes: number;
|
|
600
|
+
writtenBytes: number;
|
|
601
|
+
writeTimeMs: number;
|
|
602
|
+
/**
|
|
603
|
+
* The time of the last write in milliseconds since the epoch
|
|
604
|
+
*/
|
|
605
|
+
lastWriteMs: number | null;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* Why the writes of the writer or of a workbook are held
|
|
610
|
+
*/
|
|
611
|
+
export type StorageHoldReason = "externalChange" | "reload" | "import" | "handover" | "pause";
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* A write that failed. One that failed for a moment runs again after a backoff, one whose target is gone stops
|
|
615
|
+
* (`permanent`) until a newer write of its key or until the app discards it (`storageDiscardWrites`).
|
|
616
|
+
*/
|
|
617
|
+
export interface FailedStorageWriteView {
|
|
618
|
+
key: string;
|
|
619
|
+
/**
|
|
620
|
+
* The workbook of the key, null for the files of the app
|
|
621
|
+
*/
|
|
622
|
+
workbookId: string | null;
|
|
623
|
+
/**
|
|
624
|
+
* The last error
|
|
625
|
+
*/
|
|
626
|
+
error: string;
|
|
627
|
+
/**
|
|
628
|
+
* The failed attempts in a row
|
|
629
|
+
*/
|
|
630
|
+
attempts: number;
|
|
631
|
+
/**
|
|
632
|
+
* The target of the write is gone, e.g. a moved workbook folder: the writer stopped retrying it
|
|
633
|
+
*/
|
|
634
|
+
permanent: boolean;
|
|
635
|
+
}
|
|
636
|
+
|
|
517
637
|
/**
|
|
518
638
|
* Opaque JSON params: the params of a connection with one field named after the connector (`{ trino: {...} }`), or
|
|
519
639
|
* the params of a connector without that field
|
|
@@ -938,440 +1058,75 @@ export interface ExportedResults {
|
|
|
938
1058
|
cachedScripts: number;
|
|
939
1059
|
/**
|
|
940
1060
|
* The scripts
|
|
941
|
-
*/
|
|
942
|
-
totalScripts: number;
|
|
943
|
-
/**
|
|
944
|
-
* The files of the results, one per key
|
|
945
|
-
*/
|
|
946
|
-
files: number;
|
|
947
|
-
/**
|
|
948
|
-
* The bytes of the files. An archive stores them as they are, it grows by about as much.
|
|
949
|
-
*/
|
|
950
|
-
bytes: number;
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
/**
|
|
954
|
-
* A workbook table of the format with its columns
|
|
955
|
-
*/
|
|
956
|
-
export interface WorkbookTableSchema {
|
|
957
|
-
name: string;
|
|
958
|
-
columns: WorkbookTableColumn[];
|
|
959
|
-
}
|
|
960
|
-
|
|
961
|
-
/**
|
|
962
|
-
* The options of an export of a workbook
|
|
963
|
-
*/
|
|
964
|
-
export interface ExportOptions {
|
|
965
|
-
/**
|
|
966
|
-
* What the export writes
|
|
967
|
-
*/
|
|
968
|
-
format?: ExportFormat;
|
|
969
|
-
/**
|
|
970
|
-
* Carry the cached query results of the scripts, a link never does
|
|
971
|
-
*/
|
|
972
|
-
results?: boolean;
|
|
973
|
-
/**
|
|
974
|
-
* Carry the catalogs of the connections, true for files and tables and false for links if absent
|
|
975
|
-
*/
|
|
976
|
-
withCatalog?: boolean;
|
|
977
|
-
/**
|
|
978
|
-
* Carry the login hint of the sharer in the params, true if absent
|
|
979
|
-
*/
|
|
980
|
-
withLoginHint?: boolean;
|
|
981
|
-
/**
|
|
982
|
-
* Keep the workbook and connection ids instead of fresh ones
|
|
983
|
-
*/
|
|
984
|
-
preserveUuids?: boolean;
|
|
985
|
-
/**
|
|
986
|
-
* The URL of the app that opens a link
|
|
987
|
-
*/
|
|
988
|
-
linkBase?: string;
|
|
989
|
-
}
|
|
990
|
-
|
|
991
|
-
/**
|
|
992
|
-
* A column of a workbook table
|
|
993
|
-
*/
|
|
994
|
-
export interface WorkbookTableColumn {
|
|
995
|
-
name: string;
|
|
996
|
-
type: WorkbookTableColumnType;
|
|
997
|
-
nullable: boolean;
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
/**
|
|
1001
|
-
* The type of a column of a workbook table
|
|
1002
|
-
*/
|
|
1003
|
-
export type WorkbookTableColumnType = "text" | "integer" | "boolean";
|
|
1004
|
-
|
|
1005
|
-
/**
|
|
1006
|
-
* What an export writes
|
|
1007
|
-
*/
|
|
1008
|
-
export type ExportFormat = "archive" | "link" | "tables";
|
|
1009
|
-
|
|
1010
|
-
/**
|
|
1011
|
-
* The tokens and the user of a login
|
|
1012
|
-
*/
|
|
1013
|
-
export interface SetupAuthentication {
|
|
1014
|
-
tokens: { core: any; dataCloud: any };
|
|
1015
|
-
userInfo: any | null;
|
|
1016
|
-
}
|
|
1017
|
-
|
|
1018
|
-
/**
|
|
1019
|
-
* How a setup runs
|
|
1020
|
-
*/
|
|
1021
|
-
export interface SetupOptions {
|
|
1022
|
-
/**
|
|
1023
|
-
* The params of the setup, the params of the connection by default
|
|
1024
|
-
*/
|
|
1025
|
-
params?: JsonParams;
|
|
1026
|
-
/**
|
|
1027
|
-
* The params that the channel connects with when they differ from the ones that the connection keeps, e.g. the
|
|
1028
|
-
* credentials of the environment that are never written
|
|
1029
|
-
*/
|
|
1030
|
-
channelParams?: JsonParams;
|
|
1031
|
-
/**
|
|
1032
|
-
* Log in again instead of using a session of the browser
|
|
1033
|
-
*/
|
|
1034
|
-
forceRelogin?: boolean;
|
|
1035
|
-
/**
|
|
1036
|
-
* The redirect page of the app that an OAuth flow of Salesforce returns to
|
|
1037
|
-
*/
|
|
1038
|
-
oauthRedirect?: string;
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
|
-
/**
|
|
1042
|
-
* How a setup or a login ended
|
|
1043
|
-
*/
|
|
1044
|
-
export interface SetupOutcome {
|
|
1045
|
-
status: 'succeeded' | 'failed' | 'cancelled';
|
|
1046
|
-
/**
|
|
1047
|
-
* The error of a setup that didn't succeed
|
|
1048
|
-
*/
|
|
1049
|
-
message: string | null;
|
|
1050
|
-
/**
|
|
1051
|
-
* The details of the error, e.g. the status of a rejected request
|
|
1052
|
-
*/
|
|
1053
|
-
data: Record<string, string>;
|
|
1054
|
-
/**
|
|
1055
|
-
* The tokens of a login
|
|
1056
|
-
*/
|
|
1057
|
-
authentication: SetupAuthentication | null;
|
|
1058
|
-
}
|
|
1059
|
-
|
|
1060
|
-
/**
|
|
1061
|
-
* The outcome of a write. A failed write carries what the host failed with, a patch of a workbook file that is not
|
|
1062
|
-
* available names the workbook.
|
|
1063
|
-
*/
|
|
1064
|
-
export type StorageWriteOutcome = { status: "written" } | { status: "superseded" } | { status: "cancelled" } | { status: "deferred" } | { status: "failed"; error: unknown; unavailableWorkbook?: string };
|
|
1065
|
-
|
|
1066
|
-
/**
|
|
1067
|
-
* The statistics of the writes of a key, with the key within its workbook for display
|
|
1068
|
-
*/
|
|
1069
|
-
export interface StorageKeyStatistics {
|
|
1070
|
-
key: string;
|
|
1071
|
-
/**
|
|
1072
|
-
* The key without the prefix of its workbook, e.g. `scripts/a.sql:delete`
|
|
1073
|
-
*/
|
|
1074
|
-
label: string;
|
|
1075
|
-
statistics: StorageWriteStatistics;
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
/**
|
|
1079
|
-
* A hold of the writer (no workbook) or of a workbook
|
|
1080
|
-
*/
|
|
1081
|
-
export interface StorageHoldView {
|
|
1082
|
-
workbookId: string | null;
|
|
1083
|
-
reason: StorageHoldReason;
|
|
1084
|
-
count: number;
|
|
1085
|
-
}
|
|
1086
|
-
|
|
1087
|
-
/**
|
|
1088
|
-
* The statistics of a key: the scheduled writes of the key and the writes of its file
|
|
1089
|
-
*/
|
|
1090
|
-
export interface StorageWriteStatistics {
|
|
1091
|
-
scheduledWrites: number;
|
|
1092
|
-
writes: number;
|
|
1093
|
-
writtenBytes: number;
|
|
1094
|
-
writeTimeMs: number;
|
|
1095
|
-
/**
|
|
1096
|
-
* The time of the last write in milliseconds since the epoch
|
|
1097
|
-
*/
|
|
1098
|
-
lastWriteMs: number | null;
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1101
|
-
/**
|
|
1102
|
-
* Why the writes of the writer or of a workbook are held
|
|
1103
|
-
*/
|
|
1104
|
-
export type StorageHoldReason = "externalChange" | "reload" | "import" | "handover" | "pause";
|
|
1105
|
-
|
|
1106
|
-
/**
|
|
1107
|
-
* A write that failed. One that failed for a moment runs again after a backoff, one whose target is gone stops
|
|
1108
|
-
* (`permanent`) until a newer write of its key or until the app discards it (`storageDiscardWrites`).
|
|
1109
|
-
*/
|
|
1110
|
-
export interface FailedStorageWriteView {
|
|
1111
|
-
key: string;
|
|
1112
|
-
/**
|
|
1113
|
-
* The workbook of the key, null for the files of the app
|
|
1114
|
-
*/
|
|
1115
|
-
workbookId: string | null;
|
|
1116
|
-
/**
|
|
1117
|
-
* The last error
|
|
1118
|
-
*/
|
|
1119
|
-
error: string;
|
|
1120
|
-
/**
|
|
1121
|
-
* The failed attempts in a row
|
|
1122
|
-
*/
|
|
1123
|
-
attempts: number;
|
|
1124
|
-
/**
|
|
1125
|
-
* The target of the write is gone, e.g. a moved workbook folder: the writer stopped retrying it
|
|
1126
|
-
*/
|
|
1127
|
-
permanent: boolean;
|
|
1128
|
-
}
|
|
1129
|
-
|
|
1130
|
-
/**
|
|
1131
|
-
* The runs of a workbook, the slice `run` of the runtime
|
|
1132
|
-
*/
|
|
1133
|
-
export interface WorkbookRunView {
|
|
1134
|
-
workbookId: string;
|
|
1135
|
-
/**
|
|
1136
|
-
* The run that holds the workbook, null while none does. The workbook starts no other run then.
|
|
1137
|
-
*/
|
|
1138
|
-
held: WorkbookRunKind | null;
|
|
1139
|
-
/**
|
|
1140
|
-
* The state of the last run of the whole workbook, it stays once the run ended
|
|
1141
|
-
*/
|
|
1142
|
-
state: WorkbookRunState | null;
|
|
1143
|
-
/**
|
|
1144
|
-
* The inputs whose change waits for the workbook
|
|
1145
|
-
*/
|
|
1146
|
-
pendingInputs: string[];
|
|
1147
|
-
}
|
|
1148
|
-
|
|
1149
|
-
/**
|
|
1150
|
-
* The run that holds a workbook: a run of the whole workbook or of one of its scripts
|
|
1151
|
-
*/
|
|
1152
|
-
export type WorkbookRunKind = "workbook" | "script";
|
|
1153
|
-
|
|
1154
|
-
/**
|
|
1155
|
-
* The state of a run of a workbook
|
|
1156
|
-
*/
|
|
1157
|
-
export interface WorkbookRunState {
|
|
1158
|
-
phase: WorkbookRunPhase;
|
|
1159
|
-
totalScripts: number;
|
|
1160
|
-
completedScripts: number;
|
|
1161
|
-
/**
|
|
1162
|
-
* The planned statements that run
|
|
1163
|
-
*/
|
|
1164
|
-
totalStatements: number;
|
|
1165
|
-
completedStatements: number;
|
|
1166
|
-
/**
|
|
1167
|
-
* The script of the statement that started last
|
|
1168
|
-
*/
|
|
1169
|
-
activeFileName: string | null;
|
|
1170
|
-
activeStatementIndex: number | null;
|
|
1171
|
-
activeStatementCount: number | null;
|
|
1172
|
-
error: string | null;
|
|
1173
|
-
/**
|
|
1174
|
-
* The scripts that the run left out: their connection can't run or could not be set up, they have no cached
|
|
1175
|
-
* result or follow a script that runs on such a connection
|
|
1176
|
-
*/
|
|
1177
|
-
skippedScripts: number;
|
|
1178
|
-
skippedFiles: string[];
|
|
1179
|
-
}
|
|
1180
|
-
|
|
1181
|
-
/**
|
|
1182
|
-
* How a run ended
|
|
1183
|
-
*/
|
|
1184
|
-
export interface RunOutcome {
|
|
1185
|
-
/**
|
|
1186
|
-
* Why the run didn't start, e.g. another run holds the workbook, null for a run that started
|
|
1187
|
-
*/
|
|
1188
|
-
refused: string | null;
|
|
1189
|
-
/**
|
|
1190
|
-
* The queries of the last outputs of the scripts in feed order
|
|
1191
|
-
*/
|
|
1192
|
-
outputs: (number | null)[];
|
|
1193
|
-
failure: WorkbookRunFailure | null;
|
|
1194
|
-
/**
|
|
1195
|
-
* Did the run hand a statement to the executor?
|
|
1196
|
-
*/
|
|
1197
|
-
launched: boolean;
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1200
|
-
/**
|
|
1201
|
-
* The failure of a run or of a script, what the platform failed with goes next to it
|
|
1202
|
-
*/
|
|
1203
|
-
export interface WorkbookRunFailure {
|
|
1204
|
-
kind: WorkbookRunFailureKind;
|
|
1205
|
-
message: string;
|
|
1206
|
-
/**
|
|
1207
|
-
* The details of the error of a failed statement, e.g. what Trino said
|
|
1208
|
-
*/
|
|
1209
|
-
details: Record<string, string>;
|
|
1210
|
-
/**
|
|
1211
|
-
* The target of the log messages of the error of a failed statement
|
|
1212
|
-
*/
|
|
1213
|
-
target: string | null;
|
|
1214
|
-
/**
|
|
1215
|
-
* The query of the statement that failed, null for a failure of no statement
|
|
1216
|
-
*/
|
|
1217
|
-
queryId: number | null;
|
|
1218
|
-
/**
|
|
1219
|
-
* Did the platform fail with a value? It goes next to the failure.
|
|
1220
|
-
*/
|
|
1221
|
-
hostValue: boolean;
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
/**
|
|
1225
|
-
* Why a run failed
|
|
1226
|
-
*/
|
|
1227
|
-
export type WorkbookRunFailureKind = "plan" | "cancelled" | "error";
|
|
1228
|
-
|
|
1229
|
-
/**
|
|
1230
|
-
* The phase of a run
|
|
1231
|
-
*/
|
|
1232
|
-
export type WorkbookRunPhase = "planning" | "running" | "stopping" | "succeeded" | "failed" | "cancelled";
|
|
1233
|
-
|
|
1234
|
-
/**
|
|
1235
|
-
* An event of a script of a run
|
|
1236
|
-
*/
|
|
1237
|
-
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" };
|
|
1238
|
-
|
|
1239
|
-
/**
|
|
1240
|
-
* The options of a run of a script
|
|
1241
|
-
*/
|
|
1242
|
-
export interface RunScriptOptions {
|
|
1243
|
-
/**
|
|
1244
|
-
* Read no cached results, neither of the script nor of the scripts it references
|
|
1245
|
-
*/
|
|
1246
|
-
refresh?: boolean;
|
|
1247
|
-
}
|
|
1248
|
-
|
|
1249
|
-
/**
|
|
1250
|
-
* The options of a run of the scripts of a workbook
|
|
1251
|
-
*/
|
|
1252
|
-
export interface RunWorkbookOptions {
|
|
1253
|
-
/**
|
|
1254
|
-
* Run the scripts that a change of these inputs affects. A run that holds the workbook stops, the run starts once
|
|
1255
|
-
* the workbook is free, with the inputs of every change since.
|
|
1256
|
-
*/
|
|
1257
|
-
inputs?: string[];
|
|
1258
|
-
/**
|
|
1259
|
-
* Run these scripts with what they need, by their indexes in feed order, every script without
|
|
1260
|
-
*/
|
|
1261
|
-
targets?: number[];
|
|
1262
|
-
/**
|
|
1263
|
-
* Read no cached results: the scripts run, the results with reusable keys become the newest files of their keys
|
|
1264
|
-
*/
|
|
1265
|
-
refresh?: boolean;
|
|
1266
|
-
/**
|
|
1267
|
-
* Analyze the results of the outputs on the compute database, true by default. The command line tool prints them.
|
|
1268
|
-
*/
|
|
1269
|
-
analyze?: boolean;
|
|
1270
|
-
}
|
|
1271
|
-
|
|
1272
|
-
/**
|
|
1273
|
-
* The kind of the failure of a query
|
|
1274
|
-
*/
|
|
1275
|
-
export type QueryRunFailureKind = "error" | "cancelled" | "cacheMiss" | "processing";
|
|
1276
|
-
|
|
1277
|
-
/**
|
|
1278
|
-
* How a query uses the query result cache
|
|
1279
|
-
*/
|
|
1280
|
-
export interface QueryCacheOptions {
|
|
1281
|
-
/**
|
|
1282
|
-
* The semantic signature of the script that the key of the result derives from, with the params of the connection
|
|
1283
|
-
*/
|
|
1284
|
-
signature: string;
|
|
1285
|
-
/**
|
|
1286
|
-
* Run the query instead of serving a cached result, the result becomes the newest file of its key
|
|
1287
|
-
*/
|
|
1288
|
-
refresh?: boolean;
|
|
1289
|
-
/**
|
|
1290
|
-
* Serve the cached result or fail with a cache miss instead of running the query
|
|
1291
|
-
*/
|
|
1292
|
-
only?: boolean;
|
|
1293
|
-
}
|
|
1294
|
-
|
|
1295
|
-
/**
|
|
1296
|
-
* A query that runs: its id and its outcome
|
|
1297
|
-
*/
|
|
1298
|
-
export interface QueryTicket {
|
|
1299
|
-
queryId: number;
|
|
1300
|
-
done: Promise<QueryRunOutcome>;
|
|
1301
|
-
}
|
|
1302
|
-
|
|
1303
|
-
/**
|
|
1304
|
-
* The failure of a query, `hostValue` tells whether `value` of the outcome is what the host failed with
|
|
1305
|
-
*/
|
|
1306
|
-
export interface QueryRunFailure {
|
|
1307
|
-
kind: QueryRunFailureKind;
|
|
1308
|
-
message: string;
|
|
1309
|
-
details: Record<string, string>;
|
|
1310
|
-
target: string;
|
|
1311
|
-
hostValue: boolean;
|
|
1312
|
-
}
|
|
1313
|
-
|
|
1314
|
-
/**
|
|
1315
|
-
* A query that the runtime runs
|
|
1316
|
-
*/
|
|
1317
|
-
export interface QueryArgs {
|
|
1318
|
-
/**
|
|
1319
|
-
* The text of the query as the history shows it
|
|
1320
|
-
*/
|
|
1321
|
-
text: string;
|
|
1322
|
-
metadata: QueryMetadataView;
|
|
1061
|
+
*/
|
|
1062
|
+
totalScripts: number;
|
|
1323
1063
|
/**
|
|
1324
|
-
* The
|
|
1064
|
+
* The files of the results, one per key
|
|
1325
1065
|
*/
|
|
1326
|
-
|
|
1327
|
-
spanId?: number;
|
|
1066
|
+
files: number;
|
|
1328
1067
|
/**
|
|
1329
|
-
*
|
|
1068
|
+
* The bytes of the files. An archive stores them as they are, it grows by about as much.
|
|
1330
1069
|
*/
|
|
1331
|
-
|
|
1070
|
+
bytes: number;
|
|
1332
1071
|
}
|
|
1333
1072
|
|
|
1334
1073
|
/**
|
|
1335
|
-
*
|
|
1336
|
-
*/
|
|
1337
|
-
export type QueryCallerEvent = { type: "timing"; label: string; elapsedMs: number } | { type: "resultsReady" };
|
|
1338
|
-
|
|
1339
|
-
/**
|
|
1340
|
-
* How a query ended for its caller: resolved with the result table, or rejected with the failure and what the host
|
|
1341
|
-
* failed with
|
|
1074
|
+
* A workbook table of the format with its columns
|
|
1342
1075
|
*/
|
|
1343
|
-
export
|
|
1076
|
+
export interface WorkbookTableSchema {
|
|
1077
|
+
name: string;
|
|
1078
|
+
columns: WorkbookTableColumn[];
|
|
1079
|
+
}
|
|
1344
1080
|
|
|
1345
1081
|
/**
|
|
1346
|
-
*
|
|
1082
|
+
* The options of an export of a workbook
|
|
1347
1083
|
*/
|
|
1348
|
-
export interface
|
|
1084
|
+
export interface ExportOptions {
|
|
1349
1085
|
/**
|
|
1350
|
-
*
|
|
1086
|
+
* What the export writes
|
|
1351
1087
|
*/
|
|
1352
|
-
|
|
1088
|
+
format?: ExportFormat;
|
|
1353
1089
|
/**
|
|
1354
|
-
*
|
|
1090
|
+
* Carry the cached query results of the scripts, a link never does
|
|
1355
1091
|
*/
|
|
1356
|
-
|
|
1092
|
+
results?: boolean;
|
|
1357
1093
|
/**
|
|
1358
|
-
*
|
|
1094
|
+
* Carry the catalogs of the connections, true for files and tables and false for links if absent
|
|
1359
1095
|
*/
|
|
1360
|
-
|
|
1096
|
+
withCatalog?: boolean;
|
|
1361
1097
|
/**
|
|
1362
|
-
*
|
|
1098
|
+
* Carry the login hint of the sharer in the params, true if absent
|
|
1363
1099
|
*/
|
|
1364
|
-
|
|
1100
|
+
withLoginHint?: boolean;
|
|
1365
1101
|
/**
|
|
1366
|
-
*
|
|
1102
|
+
* Keep the workbook and connection ids instead of fresh ones
|
|
1367
1103
|
*/
|
|
1368
|
-
|
|
1104
|
+
preserveUuids?: boolean;
|
|
1369
1105
|
/**
|
|
1370
|
-
* The
|
|
1106
|
+
* The URL of the app that opens a link
|
|
1371
1107
|
*/
|
|
1372
|
-
|
|
1108
|
+
linkBase?: string;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
/**
|
|
1112
|
+
* A column of a workbook table
|
|
1113
|
+
*/
|
|
1114
|
+
export interface WorkbookTableColumn {
|
|
1115
|
+
name: string;
|
|
1116
|
+
type: WorkbookTableColumnType;
|
|
1117
|
+
nullable: boolean;
|
|
1373
1118
|
}
|
|
1374
1119
|
|
|
1120
|
+
/**
|
|
1121
|
+
* The type of a column of a workbook table
|
|
1122
|
+
*/
|
|
1123
|
+
export type WorkbookTableColumnType = "text" | "integer" | "boolean";
|
|
1124
|
+
|
|
1125
|
+
/**
|
|
1126
|
+
* What an export writes
|
|
1127
|
+
*/
|
|
1128
|
+
export type ExportFormat = "archive" | "link" | "tables";
|
|
1129
|
+
|
|
1375
1130
|
|
|
1376
1131
|
/** 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. */
|
|
1377
1132
|
export interface RuntimePlatform {
|
|
@@ -2407,161 +2162,354 @@ export interface ComputationView {
|
|
|
2407
2162
|
dataTable: number;
|
|
2408
2163
|
dataTableRows: number;
|
|
2409
2164
|
/**
|
|
2410
|
-
* The fields of the table that the computation was created with, in order
|
|
2165
|
+
* The fields of the table that the computation was created with, in order
|
|
2166
|
+
*/
|
|
2167
|
+
dataTableFields: string[];
|
|
2168
|
+
dataFrame: number | null;
|
|
2169
|
+
/**
|
|
2170
|
+
* The column groups of the grid
|
|
2171
|
+
*/
|
|
2172
|
+
columnGroups: ComputationColumnGroup[];
|
|
2173
|
+
dataTableOrdering: ComputationOrderBy[];
|
|
2174
|
+
/**
|
|
2175
|
+
* The selections in the summaries of the column groups, in the order of the column groups
|
|
2176
|
+
*/
|
|
2177
|
+
crossFilters: ComputationCrossFilter[];
|
|
2178
|
+
filterTable: ComputationFilterTable | null;
|
|
2179
|
+
orderingTable: ComputationOrderingTable | null;
|
|
2180
|
+
columnSearch: ComputationSearch;
|
|
2181
|
+
dataSearch: ComputationSearch;
|
|
2182
|
+
dataSearchTable: ComputationDataSearchTable | null;
|
|
2183
|
+
rowNumberColumnGroup: number | null;
|
|
2184
|
+
rowNumberColumnName: string | null;
|
|
2185
|
+
tableAggregation: ComputationTableAggregation | null;
|
|
2186
|
+
columnAggregates: (ComputationColumnAggregate | null)[];
|
|
2187
|
+
filteredColumnAggregates: (ComputationFilteredAggregate | null)[];
|
|
2188
|
+
filteredColumnAggregatesOutdated: boolean[];
|
|
2189
|
+
}
|
|
2190
|
+
|
|
2191
|
+
/**
|
|
2192
|
+
* The actions of a computation of a result table (`{ computation: tableId }`)
|
|
2193
|
+
*/
|
|
2194
|
+
export type ComputationAction = { 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 } };
|
|
2195
|
+
|
|
2196
|
+
/**
|
|
2197
|
+
* The actions of a workbook and its scripts (`{ workbook: id }`)
|
|
2198
|
+
*/
|
|
2199
|
+
export type WorkbookAction = { 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 } };
|
|
2200
|
+
|
|
2201
|
+
/**
|
|
2202
|
+
* The actions of the runtime itself (`'app'`): the lists of the connections and the workbooks
|
|
2203
|
+
*/
|
|
2204
|
+
export type AppAction = { 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 } };
|
|
2205
|
+
|
|
2206
|
+
/**
|
|
2207
|
+
* The actions of a connection and the queries of its history (`{ connection: id }`)
|
|
2208
|
+
*/
|
|
2209
|
+
export type ConnectionAction = { 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 } };
|
|
2210
|
+
|
|
2211
|
+
/**
|
|
2212
|
+
* A script file of a workbook
|
|
2213
|
+
*/
|
|
2214
|
+
export interface RestoreScriptFile {
|
|
2215
|
+
name: string;
|
|
2216
|
+
sql: string;
|
|
2217
|
+
}
|
|
2218
|
+
|
|
2219
|
+
/**
|
|
2220
|
+
* A counter of the progress of a step of a restore
|
|
2221
|
+
*/
|
|
2222
|
+
export interface RestoreProgressCounter {
|
|
2223
|
+
started: number;
|
|
2224
|
+
succeeded: number;
|
|
2225
|
+
skipped: number;
|
|
2226
|
+
failed: number;
|
|
2227
|
+
/**
|
|
2228
|
+
* Null until the total is known
|
|
2229
|
+
*/
|
|
2230
|
+
total: number | null;
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2233
|
+
/**
|
|
2234
|
+
* What a restore restored: the connections and the workbooks that the runtime took, in order, the workbooks that were
|
|
2235
|
+
* refused a load and the progress
|
|
2236
|
+
*/
|
|
2237
|
+
export interface RestoreOutcome {
|
|
2238
|
+
connectionIds: string[];
|
|
2239
|
+
workbookIds: string[];
|
|
2240
|
+
invalidWorkbooks: RestoredInvalidWorkbook[];
|
|
2241
|
+
progress: RestoreProgress;
|
|
2242
|
+
}
|
|
2243
|
+
|
|
2244
|
+
/**
|
|
2245
|
+
* The progress of a restore
|
|
2246
|
+
*/
|
|
2247
|
+
export interface RestoreProgress {
|
|
2248
|
+
restoreConnections: RestoreProgressCounter;
|
|
2249
|
+
restoreCatalogs: RestoreProgressCounter;
|
|
2250
|
+
restoreWorkbookScripts: RestoreProgressCounter;
|
|
2251
|
+
}
|
|
2252
|
+
|
|
2253
|
+
/**
|
|
2254
|
+
* A workbook that failed its validation or couldn't be restored
|
|
2255
|
+
*/
|
|
2256
|
+
export interface RestoredInvalidWorkbook {
|
|
2257
|
+
workbookId: string;
|
|
2258
|
+
title: string;
|
|
2259
|
+
connectorType: ConnectorType | null;
|
|
2260
|
+
/**
|
|
2261
|
+
* The code of the validation error, e.g. `unsupported_format_version`
|
|
2262
|
+
*/
|
|
2263
|
+
error: string;
|
|
2264
|
+
/**
|
|
2265
|
+
* A short explanation of the error for the user
|
|
2266
|
+
*/
|
|
2267
|
+
description: string;
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2270
|
+
/**
|
|
2271
|
+
* The runs of a workbook, the slice `run` of the runtime
|
|
2272
|
+
*/
|
|
2273
|
+
export interface WorkbookRunView {
|
|
2274
|
+
workbookId: string;
|
|
2275
|
+
/**
|
|
2276
|
+
* The run that holds the workbook, null while none does. The workbook starts no other run then.
|
|
2277
|
+
*/
|
|
2278
|
+
held: WorkbookRunKind | null;
|
|
2279
|
+
/**
|
|
2280
|
+
* The state of the last run of the whole workbook, it stays once the run ended
|
|
2281
|
+
*/
|
|
2282
|
+
state: WorkbookRunState | null;
|
|
2283
|
+
/**
|
|
2284
|
+
* The inputs whose change waits for the workbook
|
|
2285
|
+
*/
|
|
2286
|
+
pendingInputs: string[];
|
|
2287
|
+
}
|
|
2288
|
+
|
|
2289
|
+
/**
|
|
2290
|
+
* The run that holds a workbook: a run of the whole workbook or of one of its scripts
|
|
2291
|
+
*/
|
|
2292
|
+
export type WorkbookRunKind = "workbook" | "script";
|
|
2293
|
+
|
|
2294
|
+
/**
|
|
2295
|
+
* The state of a run of a workbook
|
|
2296
|
+
*/
|
|
2297
|
+
export interface WorkbookRunState {
|
|
2298
|
+
phase: WorkbookRunPhase;
|
|
2299
|
+
totalScripts: number;
|
|
2300
|
+
completedScripts: number;
|
|
2301
|
+
/**
|
|
2302
|
+
* The planned statements that run
|
|
2303
|
+
*/
|
|
2304
|
+
totalStatements: number;
|
|
2305
|
+
completedStatements: number;
|
|
2306
|
+
/**
|
|
2307
|
+
* The script of the statement that started last
|
|
2308
|
+
*/
|
|
2309
|
+
activeFileName: string | null;
|
|
2310
|
+
activeStatementIndex: number | null;
|
|
2311
|
+
activeStatementCount: number | null;
|
|
2312
|
+
error: string | null;
|
|
2313
|
+
/**
|
|
2314
|
+
* The scripts that the run left out: their connection can't run or could not be set up, they have no cached
|
|
2315
|
+
* result or follow a script that runs on such a connection
|
|
2316
|
+
*/
|
|
2317
|
+
skippedScripts: number;
|
|
2318
|
+
skippedFiles: string[];
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
/**
|
|
2322
|
+
* How a run ended
|
|
2323
|
+
*/
|
|
2324
|
+
export interface RunOutcome {
|
|
2325
|
+
/**
|
|
2326
|
+
* Why the run didn't start, e.g. another run holds the workbook, null for a run that started
|
|
2327
|
+
*/
|
|
2328
|
+
refused: string | null;
|
|
2329
|
+
/**
|
|
2330
|
+
* The queries of the last outputs of the scripts in feed order
|
|
2331
|
+
*/
|
|
2332
|
+
outputs: (number | null)[];
|
|
2333
|
+
failure: WorkbookRunFailure | null;
|
|
2334
|
+
/**
|
|
2335
|
+
* Did the run hand a statement to the executor?
|
|
2336
|
+
*/
|
|
2337
|
+
launched: boolean;
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
/**
|
|
2341
|
+
* The failure of a run or of a script, what the platform failed with goes next to it
|
|
2342
|
+
*/
|
|
2343
|
+
export interface WorkbookRunFailure {
|
|
2344
|
+
kind: WorkbookRunFailureKind;
|
|
2345
|
+
message: string;
|
|
2346
|
+
/**
|
|
2347
|
+
* The details of the error of a failed statement, e.g. what Trino said
|
|
2348
|
+
*/
|
|
2349
|
+
details: Record<string, string>;
|
|
2350
|
+
/**
|
|
2351
|
+
* The target of the log messages of the error of a failed statement
|
|
2411
2352
|
*/
|
|
2412
|
-
|
|
2413
|
-
dataFrame: number | null;
|
|
2353
|
+
target: string | null;
|
|
2414
2354
|
/**
|
|
2415
|
-
* The
|
|
2355
|
+
* The query of the statement that failed, null for a failure of no statement
|
|
2416
2356
|
*/
|
|
2417
|
-
|
|
2418
|
-
dataTableOrdering: ComputationOrderBy[];
|
|
2357
|
+
queryId: number | null;
|
|
2419
2358
|
/**
|
|
2420
|
-
*
|
|
2359
|
+
* Did the platform fail with a value? It goes next to the failure.
|
|
2421
2360
|
*/
|
|
2422
|
-
|
|
2423
|
-
filterTable: ComputationFilterTable | null;
|
|
2424
|
-
orderingTable: ComputationOrderingTable | null;
|
|
2425
|
-
columnSearch: ComputationSearch;
|
|
2426
|
-
dataSearch: ComputationSearch;
|
|
2427
|
-
dataSearchTable: ComputationDataSearchTable | null;
|
|
2428
|
-
rowNumberColumnGroup: number | null;
|
|
2429
|
-
rowNumberColumnName: string | null;
|
|
2430
|
-
tableAggregation: ComputationTableAggregation | null;
|
|
2431
|
-
columnAggregates: (ComputationColumnAggregate | null)[];
|
|
2432
|
-
filteredColumnAggregates: (ComputationFilteredAggregate | null)[];
|
|
2433
|
-
filteredColumnAggregatesOutdated: boolean[];
|
|
2361
|
+
hostValue: boolean;
|
|
2434
2362
|
}
|
|
2435
2363
|
|
|
2436
2364
|
/**
|
|
2437
|
-
*
|
|
2438
|
-
*/
|
|
2439
|
-
export type ComputationAction = { 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 } };
|
|
2440
|
-
|
|
2441
|
-
/**
|
|
2442
|
-
* The actions of a workbook and its scripts (`{ workbook: id }`)
|
|
2443
|
-
*/
|
|
2444
|
-
export type WorkbookAction = { 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 } };
|
|
2445
|
-
|
|
2446
|
-
/**
|
|
2447
|
-
* The actions of the runtime itself (`'app'`): the lists of the connections and the workbooks
|
|
2365
|
+
* Why a run failed
|
|
2448
2366
|
*/
|
|
2449
|
-
export type
|
|
2367
|
+
export type WorkbookRunFailureKind = "plan" | "cancelled" | "error";
|
|
2450
2368
|
|
|
2451
2369
|
/**
|
|
2452
|
-
* The
|
|
2370
|
+
* The phase of a run
|
|
2453
2371
|
*/
|
|
2454
|
-
export type
|
|
2372
|
+
export type WorkbookRunPhase = "planning" | "running" | "stopping" | "succeeded" | "failed" | "cancelled";
|
|
2455
2373
|
|
|
2456
2374
|
/**
|
|
2457
|
-
*
|
|
2375
|
+
* An event of a script of a run
|
|
2458
2376
|
*/
|
|
2459
|
-
export
|
|
2460
|
-
name: string;
|
|
2461
|
-
sql: string;
|
|
2462
|
-
}
|
|
2377
|
+
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" };
|
|
2463
2378
|
|
|
2464
2379
|
/**
|
|
2465
|
-
*
|
|
2380
|
+
* The options of a run of a script
|
|
2466
2381
|
*/
|
|
2467
|
-
export interface
|
|
2468
|
-
started: number;
|
|
2469
|
-
succeeded: number;
|
|
2470
|
-
skipped: number;
|
|
2471
|
-
failed: number;
|
|
2382
|
+
export interface RunScriptOptions {
|
|
2472
2383
|
/**
|
|
2473
|
-
*
|
|
2384
|
+
* Read no cached results, neither of the script nor of the scripts it references
|
|
2474
2385
|
*/
|
|
2475
|
-
|
|
2386
|
+
refresh?: boolean;
|
|
2476
2387
|
}
|
|
2477
2388
|
|
|
2478
2389
|
/**
|
|
2479
|
-
*
|
|
2480
|
-
* refused a load and the progress
|
|
2390
|
+
* The options of a run of the scripts of a workbook
|
|
2481
2391
|
*/
|
|
2482
|
-
export interface
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2392
|
+
export interface RunWorkbookOptions {
|
|
2393
|
+
/**
|
|
2394
|
+
* Run the scripts that a change of these inputs affects. A run that holds the workbook stops, the run starts once
|
|
2395
|
+
* the workbook is free, with the inputs of every change since.
|
|
2396
|
+
*/
|
|
2397
|
+
inputs?: string[];
|
|
2398
|
+
/**
|
|
2399
|
+
* Run these scripts with what they need, by their indexes in feed order, every script without
|
|
2400
|
+
*/
|
|
2401
|
+
targets?: number[];
|
|
2402
|
+
/**
|
|
2403
|
+
* Read no cached results: the scripts run, the results with reusable keys become the newest files of their keys
|
|
2404
|
+
*/
|
|
2405
|
+
refresh?: boolean;
|
|
2406
|
+
/**
|
|
2407
|
+
* Analyze the results of the outputs on the compute database, true by default. The command line tool prints them.
|
|
2408
|
+
*/
|
|
2409
|
+
analyze?: boolean;
|
|
2487
2410
|
}
|
|
2488
2411
|
|
|
2489
2412
|
/**
|
|
2490
|
-
* The
|
|
2413
|
+
* The kind of the failure of a query
|
|
2491
2414
|
*/
|
|
2492
|
-
export
|
|
2493
|
-
restoreConnections: RestoreProgressCounter;
|
|
2494
|
-
restoreCatalogs: RestoreProgressCounter;
|
|
2495
|
-
restoreWorkbookScripts: RestoreProgressCounter;
|
|
2496
|
-
}
|
|
2415
|
+
export type QueryRunFailureKind = "error" | "cancelled" | "cacheMiss" | "processing";
|
|
2497
2416
|
|
|
2498
2417
|
/**
|
|
2499
|
-
*
|
|
2418
|
+
* How a query uses the query result cache
|
|
2500
2419
|
*/
|
|
2501
|
-
export interface
|
|
2502
|
-
workbookId: string;
|
|
2503
|
-
title: string;
|
|
2504
|
-
connectorType: ConnectorType | null;
|
|
2420
|
+
export interface QueryCacheOptions {
|
|
2505
2421
|
/**
|
|
2506
|
-
* The
|
|
2422
|
+
* The semantic signature of the script that the key of the result derives from, with the params of the connection
|
|
2507
2423
|
*/
|
|
2508
|
-
|
|
2424
|
+
signature: string;
|
|
2509
2425
|
/**
|
|
2510
|
-
*
|
|
2426
|
+
* Run the query instead of serving a cached result, the result becomes the newest file of its key
|
|
2511
2427
|
*/
|
|
2512
|
-
|
|
2428
|
+
refresh?: boolean;
|
|
2429
|
+
/**
|
|
2430
|
+
* Serve the cached result or fail with a cache miss instead of running the query
|
|
2431
|
+
*/
|
|
2432
|
+
only?: boolean;
|
|
2513
2433
|
}
|
|
2514
2434
|
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
prepareConnection?(connectionId: string): Promise<void>;
|
|
2435
|
+
/**
|
|
2436
|
+
* A query that runs: its id and its outcome
|
|
2437
|
+
*/
|
|
2438
|
+
export interface QueryTicket {
|
|
2439
|
+
queryId: number;
|
|
2440
|
+
done: Promise<QueryRunOutcome>;
|
|
2522
2441
|
}
|
|
2523
2442
|
|
|
2443
|
+
/**
|
|
2444
|
+
* The failure of a query, `hostValue` tells whether `value` of the outcome is what the host failed with
|
|
2445
|
+
*/
|
|
2446
|
+
export interface QueryRunFailure {
|
|
2447
|
+
kind: QueryRunFailureKind;
|
|
2448
|
+
message: string;
|
|
2449
|
+
details: Record<string, string>;
|
|
2450
|
+
target: string;
|
|
2451
|
+
hostValue: boolean;
|
|
2452
|
+
}
|
|
2524
2453
|
|
|
2525
2454
|
/**
|
|
2526
|
-
* A
|
|
2455
|
+
* A query that the runtime runs
|
|
2527
2456
|
*/
|
|
2528
|
-
export interface
|
|
2529
|
-
workbookId: string;
|
|
2457
|
+
export interface QueryArgs {
|
|
2530
2458
|
/**
|
|
2531
|
-
* The
|
|
2459
|
+
* The text of the query as the history shows it
|
|
2532
2460
|
*/
|
|
2533
|
-
|
|
2461
|
+
text: string;
|
|
2462
|
+
metadata: QueryMetadataView;
|
|
2534
2463
|
/**
|
|
2535
|
-
*
|
|
2464
|
+
* The trace and the span of the log messages of the query
|
|
2536
2465
|
*/
|
|
2537
|
-
|
|
2466
|
+
traceId: number;
|
|
2467
|
+
spanId?: number;
|
|
2468
|
+
/**
|
|
2469
|
+
* What the executor does around the query
|
|
2470
|
+
*/
|
|
2471
|
+
options?: QueryOptions;
|
|
2538
2472
|
}
|
|
2539
2473
|
|
|
2540
2474
|
/**
|
|
2541
|
-
*
|
|
2542
|
-
* of the runtime (`storageHold`, `storageRelease`, `storageDiscardWrites`).
|
|
2475
|
+
* What the caller of a query hears while it runs: the timings and the result before its analysis
|
|
2543
2476
|
*/
|
|
2544
|
-
export type
|
|
2477
|
+
export type QueryCallerEvent = { type: "timing"; label: string; elapsedMs: number } | { type: "resultsReady" };
|
|
2545
2478
|
|
|
2546
2479
|
/**
|
|
2547
|
-
*
|
|
2548
|
-
*
|
|
2549
|
-
* reason `externalChange`.
|
|
2480
|
+
* How a query ended for its caller: resolved with the result table, or rejected with the failure and what the host
|
|
2481
|
+
* failed with
|
|
2550
2482
|
*/
|
|
2551
|
-
export
|
|
2483
|
+
export type QueryRunOutcome = { status: "resolved"; hasResult: boolean; table: unknown } | { status: "rejected"; failure: QueryRunFailure; value: unknown };
|
|
2484
|
+
|
|
2485
|
+
/**
|
|
2486
|
+
* What the executor does around a query besides running its text
|
|
2487
|
+
*/
|
|
2488
|
+
export interface QueryOptions {
|
|
2552
2489
|
/**
|
|
2553
|
-
*
|
|
2490
|
+
* Analyze the result on the compute database, false by default
|
|
2554
2491
|
*/
|
|
2555
|
-
|
|
2492
|
+
analyzeResults?: boolean;
|
|
2556
2493
|
/**
|
|
2557
|
-
*
|
|
2494
|
+
* Collect the result, true by default. A statement whose output nothing reads drains it.
|
|
2558
2495
|
*/
|
|
2559
|
-
|
|
2496
|
+
publishResults?: boolean;
|
|
2560
2497
|
/**
|
|
2561
|
-
*
|
|
2562
|
-
* (`answerExternalChange`)
|
|
2498
|
+
* Reject with the error of a failed query instead of resolving
|
|
2563
2499
|
*/
|
|
2564
|
-
|
|
2500
|
+
throwOnError?: boolean;
|
|
2501
|
+
/**
|
|
2502
|
+
* A call of a client function that runs instead of the text, as the core describes it
|
|
2503
|
+
*/
|
|
2504
|
+
clientFunctionCall?: JsonValue;
|
|
2505
|
+
/**
|
|
2506
|
+
* The time to wait for the next batch of a channel of the host, the default of the channel without
|
|
2507
|
+
*/
|
|
2508
|
+
readTimeoutMs?: number;
|
|
2509
|
+
/**
|
|
2510
|
+
* The query result cache, none for a query that never reads or writes it
|
|
2511
|
+
*/
|
|
2512
|
+
cache?: QueryCacheOptions;
|
|
2565
2513
|
}
|
|
2566
2514
|
|
|
2567
2515
|
/**
|
|
@@ -2816,6 +2764,58 @@ export interface AttachFilesOutcome {
|
|
|
2816
2764
|
refused: string[];
|
|
2817
2765
|
}
|
|
2818
2766
|
|
|
2767
|
+
|
|
2768
|
+
/** What hears a run of a workbook */
|
|
2769
|
+
export interface RunListener {
|
|
2770
|
+
/** Something happened to a script of the run, a failure comes with what the platform failed with */
|
|
2771
|
+
script?(file: string, event: WorkbookScriptRunEvent, error: unknown): void;
|
|
2772
|
+
/** 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. */
|
|
2773
|
+
prepareConnection?(connectionId: string): Promise<void>;
|
|
2774
|
+
}
|
|
2775
|
+
|
|
2776
|
+
|
|
2777
|
+
/**
|
|
2778
|
+
* A question about a workbook folder whose scripts changed outside the app
|
|
2779
|
+
*/
|
|
2780
|
+
export interface ExternalChangeView {
|
|
2781
|
+
workbookId: string;
|
|
2782
|
+
/**
|
|
2783
|
+
* The number of the question, the answer names it. A second question about the same change has a new number.
|
|
2784
|
+
*/
|
|
2785
|
+
prompt: number;
|
|
2786
|
+
/**
|
|
2787
|
+
* Does the app hold writes of the scripts that a reload discards?
|
|
2788
|
+
*/
|
|
2789
|
+
pendingWrites: boolean;
|
|
2790
|
+
}
|
|
2791
|
+
|
|
2792
|
+
/**
|
|
2793
|
+
* A command of the storage writer that waits for writes. The commands that change the writer right away are methods
|
|
2794
|
+
* of the runtime (`storageHold`, `storageRelease`, `storageDiscardWrites`).
|
|
2795
|
+
*/
|
|
2796
|
+
export type StorageCommand = { kind: "flush"; closing?: boolean } | { kind: "settle" } | { kind: "flushWorkbook"; workbookId: string } | { kind: "deleteWorkbook"; workbookId: string } | { kind: "handOver" };
|
|
2797
|
+
|
|
2798
|
+
/**
|
|
2799
|
+
* The storage of the runtime: what holds the writes, the writes that failed, and the questions about workbook folders
|
|
2800
|
+
* that changed outside the app. The workbooks whose writes a change outside the app holds are the holds with the
|
|
2801
|
+
* reason `externalChange`.
|
|
2802
|
+
*/
|
|
2803
|
+
export interface StorageView {
|
|
2804
|
+
/**
|
|
2805
|
+
* The holds of the writer (no workbook) and of the workbooks, with their reasons
|
|
2806
|
+
*/
|
|
2807
|
+
holds: StorageHoldView[];
|
|
2808
|
+
/**
|
|
2809
|
+
* The writes that failed, with their last errors
|
|
2810
|
+
*/
|
|
2811
|
+
failedWrites: FailedStorageWriteView[];
|
|
2812
|
+
/**
|
|
2813
|
+
* The workbooks whose scripts changed on disk, the app asks the user whether to reload them
|
|
2814
|
+
* (`answerExternalChange`)
|
|
2815
|
+
*/
|
|
2816
|
+
externalChanges: ExternalChangeView[];
|
|
2817
|
+
}
|
|
2818
|
+
|
|
2819
2819
|
/**
|
|
2820
2820
|
* A catalog (`dashql_catalog_*`)
|
|
2821
2821
|
*/
|
|
@@ -3557,6 +3557,11 @@ export class ScriptSession {
|
|
|
3557
3557
|
* `names`: triples of the offset, the length and the script index (u32::MAX if none), in the offset unit
|
|
3558
3558
|
*/
|
|
3559
3559
|
findScriptReferences(names: string[]): Uint32Array;
|
|
3560
|
+
/**
|
|
3561
|
+
* Select the columns of the result of the terminal query below it, the new statement formatted with the
|
|
3562
|
+
* config. Returns the new text, the error says why the script cannot get the projection.
|
|
3563
|
+
*/
|
|
3564
|
+
rewriteResultProjection(columns: string[], dialect: number, mode: number, max_width: number, indentation_width: number, keyword_case: number, parse_if_outdated: boolean): string;
|
|
3560
3565
|
constructor(catalog: Catalog, offset_unit: number);
|
|
3561
3566
|
text(): string;
|
|
3562
3567
|
/**
|
|
@@ -3881,6 +3886,10 @@ export class WorkbookScriptSession {
|
|
|
3881
3886
|
* See `ScriptSession.findScriptReferences`
|
|
3882
3887
|
*/
|
|
3883
3888
|
findScriptReferences(names: string[]): Uint32Array;
|
|
3889
|
+
/**
|
|
3890
|
+
* Select the columns of the result of the terminal query below it. Returns the new text, the session stays.
|
|
3891
|
+
*/
|
|
3892
|
+
rewriteResultProjection(columns: string[], dialect: number, mode: number, max_width: number, indentation_width: number, keyword_case: number, parse_if_outdated: boolean): string;
|
|
3884
3893
|
text(): string;
|
|
3885
3894
|
/**
|
|
3886
3895
|
* Format the script into a new script of the session catalog
|
|
@@ -4068,6 +4077,7 @@ export interface InitOutput {
|
|
|
4068
4077
|
readonly scriptsession_replaceText: (a: number, b: bigint, c: number, d: number) => [number, number];
|
|
4069
4078
|
readonly scriptsession_rewriteAnnotation: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
4070
4079
|
readonly scriptsession_rewriteParamTag: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
4080
|
+
readonly scriptsession_rewriteResultProjection: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number, number];
|
|
4071
4081
|
readonly scriptsession_rewriteVisBoard: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
|
|
4072
4082
|
readonly scriptsession_rewriteVisFlow: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
4073
4083
|
readonly scriptsession_rewriteVisRenderer: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
|
|
@@ -4151,6 +4161,7 @@ export interface InitOutput {
|
|
|
4151
4161
|
readonly workbookscriptsession_removeVisFlow: (a: number, b: number) => [number, number, number, number];
|
|
4152
4162
|
readonly workbookscriptsession_rewriteAnnotation: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
4153
4163
|
readonly workbookscriptsession_rewriteParamTag: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
4164
|
+
readonly workbookscriptsession_rewriteResultProjection: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number, number];
|
|
4154
4165
|
readonly workbookscriptsession_rewriteVisBoard: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
|
|
4155
4166
|
readonly workbookscriptsession_rewriteVisFlow: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
4156
4167
|
readonly workbookscriptsession_rewriteVisRenderer: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
|
package/dist/wasm/dashql_core.js
CHANGED
|
@@ -2826,6 +2826,39 @@ var ScriptSession = class ScriptSession {
|
|
|
2826
2826
|
return v2;
|
|
2827
2827
|
}
|
|
2828
2828
|
/**
|
|
2829
|
+
* Select the columns of the result of the terminal query below it, the new statement formatted with the
|
|
2830
|
+
* config. Returns the new text, the error says why the script cannot get the projection.
|
|
2831
|
+
* @param {string[]} columns
|
|
2832
|
+
* @param {number} dialect
|
|
2833
|
+
* @param {number} mode
|
|
2834
|
+
* @param {number} max_width
|
|
2835
|
+
* @param {number} indentation_width
|
|
2836
|
+
* @param {number} keyword_case
|
|
2837
|
+
* @param {boolean} parse_if_outdated
|
|
2838
|
+
* @returns {string}
|
|
2839
|
+
*/
|
|
2840
|
+
rewriteResultProjection(columns, dialect, mode, max_width, indentation_width, keyword_case, parse_if_outdated) {
|
|
2841
|
+
let deferred3_0;
|
|
2842
|
+
let deferred3_1;
|
|
2843
|
+
try {
|
|
2844
|
+
const ptr0 = passArrayJsValueToWasm0(columns, wasm.__wbindgen_malloc);
|
|
2845
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2846
|
+
const ret = wasm.scriptsession_rewriteResultProjection(this.__wbg_ptr, ptr0, len0, dialect, mode, max_width, indentation_width, keyword_case, parse_if_outdated);
|
|
2847
|
+
var ptr2 = ret[0];
|
|
2848
|
+
var len2 = ret[1];
|
|
2849
|
+
if (ret[3]) {
|
|
2850
|
+
ptr2 = 0;
|
|
2851
|
+
len2 = 0;
|
|
2852
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
2853
|
+
}
|
|
2854
|
+
deferred3_0 = ptr2;
|
|
2855
|
+
deferred3_1 = len2;
|
|
2856
|
+
return getStringFromWasm0(ptr2, len2);
|
|
2857
|
+
} finally {
|
|
2858
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
/**
|
|
2829
2862
|
* @param {Catalog} catalog
|
|
2830
2863
|
* @param {number} offset_unit
|
|
2831
2864
|
*/
|
|
@@ -4076,6 +4109,38 @@ var WorkbookScriptSession = class WorkbookScriptSession {
|
|
|
4076
4109
|
return v2;
|
|
4077
4110
|
}
|
|
4078
4111
|
/**
|
|
4112
|
+
* Select the columns of the result of the terminal query below it. Returns the new text, the session stays.
|
|
4113
|
+
* @param {string[]} columns
|
|
4114
|
+
* @param {number} dialect
|
|
4115
|
+
* @param {number} mode
|
|
4116
|
+
* @param {number} max_width
|
|
4117
|
+
* @param {number} indentation_width
|
|
4118
|
+
* @param {number} keyword_case
|
|
4119
|
+
* @param {boolean} parse_if_outdated
|
|
4120
|
+
* @returns {string}
|
|
4121
|
+
*/
|
|
4122
|
+
rewriteResultProjection(columns, dialect, mode, max_width, indentation_width, keyword_case, parse_if_outdated) {
|
|
4123
|
+
let deferred3_0;
|
|
4124
|
+
let deferred3_1;
|
|
4125
|
+
try {
|
|
4126
|
+
const ptr0 = passArrayJsValueToWasm0(columns, wasm.__wbindgen_malloc);
|
|
4127
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4128
|
+
const ret = wasm.workbookscriptsession_rewriteResultProjection(this.__wbg_ptr, ptr0, len0, dialect, mode, max_width, indentation_width, keyword_case, parse_if_outdated);
|
|
4129
|
+
var ptr2 = ret[0];
|
|
4130
|
+
var len2 = ret[1];
|
|
4131
|
+
if (ret[3]) {
|
|
4132
|
+
ptr2 = 0;
|
|
4133
|
+
len2 = 0;
|
|
4134
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
4135
|
+
}
|
|
4136
|
+
deferred3_0 = ptr2;
|
|
4137
|
+
deferred3_1 = len2;
|
|
4138
|
+
return getStringFromWasm0(ptr2, len2);
|
|
4139
|
+
} finally {
|
|
4140
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
4141
|
+
}
|
|
4142
|
+
}
|
|
4143
|
+
/**
|
|
4079
4144
|
* @returns {string}
|
|
4080
4145
|
*/
|
|
4081
4146
|
text() {
|
|
@@ -4457,9 +4522,6 @@ function __wbg_get_imports() {
|
|
|
4457
4522
|
imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
|
|
4458
4523
|
return BigInt.asUintN(64, arg0);
|
|
4459
4524
|
};
|
|
4460
|
-
imports.wbg.__wbindgen_cast_89c25d6a26e511e2 = function(arg0, arg1) {
|
|
4461
|
-
return makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h9635fd3ae9a780df, wasm_bindgen__convert__closures_____invoke__h6062519666d8a005);
|
|
4462
|
-
};
|
|
4463
4525
|
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|
|
4464
4526
|
return arg0;
|
|
4465
4527
|
};
|
|
@@ -4469,6 +4531,9 @@ function __wbg_get_imports() {
|
|
|
4469
4531
|
imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
|
|
4470
4532
|
return getArrayU8FromWasm0(arg0, arg1);
|
|
4471
4533
|
};
|
|
4534
|
+
imports.wbg.__wbindgen_cast_cf21df3633c132a5 = function(arg0, arg1) {
|
|
4535
|
+
return makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h9635fd3ae9a780df, wasm_bindgen__convert__closures_____invoke__h6062519666d8a005);
|
|
4536
|
+
};
|
|
4472
4537
|
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
4473
4538
|
return arg0;
|
|
4474
4539
|
};
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akohn/dashql",
|
|
3
|
-
"version": "0.0.19-dev.
|
|
3
|
+
"version": "0.0.19-dev.305.gb0f831a47",
|
|
4
4
|
"description": "DashQL in TypeScript: the WebAssembly bindings of its SQL core, its runtime and the platforms of the runtime",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MPL-2.0",
|