@elaraai/e3-ui-components 1.0.83 → 1.0.85
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/README.md +113 -6
- package/dist/components/DataTaskPreview.d.ts +35 -1
- package/dist/components/DataTaskPreview.d.ts.map +1 -1
- package/dist/components/DatasetPreview.d.ts +16 -0
- package/dist/components/DatasetPreview.d.ts.map +1 -1
- package/dist/components/InputPreview.d.ts +12 -0
- package/dist/components/InputPreview.d.ts.map +1 -1
- package/dist/components/PagedDatasetPreview.d.ts +15 -0
- package/dist/components/PagedDatasetPreview.d.ts.map +1 -1
- package/dist/components/TaskLogs.d.ts +19 -0
- package/dist/components/TaskLogs.d.ts.map +1 -1
- package/dist/components/TaskPreview.d.ts +24 -0
- package/dist/components/TaskPreview.d.ts.map +1 -1
- package/dist/components/UITaskPreview.d.ts +4 -1
- package/dist/components/UITaskPreview.d.ts.map +1 -1
- package/dist/components/VirtualizedLogViewer.d.ts +29 -1
- package/dist/components/VirtualizedLogViewer.d.ts.map +1 -1
- package/dist/components/controlled-search.d.ts +22 -0
- package/dist/components/controlled-search.d.ts.map +1 -0
- package/dist/components/preview-controls.d.ts +73 -0
- package/dist/components/preview-controls.d.ts.map +1 -0
- package/dist/diff/index.d.ts.map +1 -1
- package/dist/experiment/index.d.ts.map +1 -1
- package/dist/hooks/executions.d.ts +17 -0
- package/dist/hooks/executions.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/useDatasetValue.d.ts +19 -1
- package/dist/hooks/useDatasetValue.d.ts.map +1 -1
- package/dist/hooks/useTaskLogsHook.d.ts +67 -3
- package/dist/hooks/useTaskLogsHook.d.ts.map +1 -1
- package/dist/in-memory-call-7_3frW52.js +615 -0
- package/dist/in-memory-call-7_3frW52.js.map +1 -0
- package/dist/in-memory-call-_r5DJotS.cjs +614 -0
- package/dist/in-memory-call-_r5DJotS.cjs.map +1 -0
- package/dist/index.cjs +25860 -5731
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +14 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28383 -8253
- package/dist/index.js.map +1 -1
- package/dist/platform/bind-runtime.d.ts +18 -3
- package/dist/platform/bind-runtime.d.ts.map +1 -1
- package/dist/platform/dataset-hooks.d.ts +15 -3
- package/dist/platform/dataset-hooks.d.ts.map +1 -1
- package/dist/platform/dataset-store.d.ts +35 -7
- package/dist/platform/dataset-store.d.ts.map +1 -1
- package/dist/platform/e3-config.d.ts +26 -2
- package/dist/platform/e3-config.d.ts.map +1 -1
- package/dist/platform/func-runtime.d.ts +11 -5
- package/dist/platform/func-runtime.d.ts.map +1 -1
- package/dist/platform/index.d.ts +2 -2
- package/dist/platform/index.d.ts.map +1 -1
- package/dist/platform/paged-runtime.d.ts +46 -9
- package/dist/platform/paged-runtime.d.ts.map +1 -1
- package/dist/platform/record-runtime.d.ts +45 -7
- package/dist/platform/record-runtime.d.ts.map +1 -1
- package/dist/platform/recovery.d.ts +44 -0
- package/dist/platform/recovery.d.ts.map +1 -0
- package/dist/platform/staged-store.d.ts +16 -0
- package/dist/platform/staged-store.d.ts.map +1 -1
- package/dist/platform/tracked-channel.d.ts +12 -0
- package/dist/platform/tracked-channel.d.ts.map +1 -1
- package/dist/query/about.d.ts +50 -0
- package/dist/query/about.d.ts.map +1 -0
- package/dist/query/autocomplete.d.ts +112 -0
- package/dist/query/autocomplete.d.ts.map +1 -0
- package/dist/query/builder.d.ts +29 -0
- package/dist/query/builder.d.ts.map +1 -0
- package/dist/query/calls.d.ts +46 -0
- package/dist/query/calls.d.ts.map +1 -0
- package/dist/query/datasets-tab.d.ts +52 -0
- package/dist/query/datasets-tab.d.ts.map +1 -0
- package/dist/query/downloads.d.ts +29 -0
- package/dist/query/downloads.d.ts.map +1 -0
- package/dist/query/drops.d.ts +28 -0
- package/dist/query/drops.d.ts.map +1 -0
- package/dist/query/foot.d.ts +22 -0
- package/dist/query/foot.d.ts.map +1 -0
- package/dist/query/hooks.d.ts +265 -0
- package/dist/query/hooks.d.ts.map +1 -0
- package/dist/query/in-memory-call.d.ts +150 -0
- package/dist/query/in-memory-call.d.ts.map +1 -0
- package/dist/query/jq-editor.d.ts +34 -0
- package/dist/query/jq-editor.d.ts.map +1 -0
- package/dist/query/library-tab.d.ts +33 -0
- package/dist/query/library-tab.d.ts.map +1 -0
- package/dist/query/library.d.ts +20 -0
- package/dist/query/library.d.ts.map +1 -0
- package/dist/query/model/cards.d.ts +179 -0
- package/dist/query/model/cards.d.ts.map +1 -0
- package/dist/query/model/index.d.ts +19 -0
- package/dist/query/model/index.d.ts.map +1 -0
- package/dist/query/model/messages.d.ts +1253 -0
- package/dist/query/model/messages.d.ts.map +1 -0
- package/dist/query/model/refs.d.ts +92 -0
- package/dist/query/model/refs.d.ts.map +1 -0
- package/dist/query/model/slots.d.ts +213 -0
- package/dist/query/model/slots.d.ts.map +1 -0
- package/dist/query/model/summaries.d.ts +104 -0
- package/dist/query/model/summaries.d.ts.map +1 -0
- package/dist/query/model/words.d.ts +331 -0
- package/dist/query/model/words.d.ts.map +1 -0
- package/dist/query/one-shot.d.ts +266 -0
- package/dist/query/one-shot.d.ts.map +1 -0
- package/dist/query/open-query.d.ts +214 -0
- package/dist/query/open-query.d.ts.map +1 -0
- package/dist/query/parts.d.ts +115 -0
- package/dist/query/parts.d.ts.map +1 -0
- package/dist/query/plan-popover.d.ts +22 -0
- package/dist/query/plan-popover.d.ts.map +1 -0
- package/dist/query/plan.d.ts +353 -0
- package/dist/query/plan.d.ts.map +1 -0
- package/dist/query/query-east.d.ts +21 -0
- package/dist/query/query-east.d.ts.map +1 -0
- package/dist/query/query-tab.d.ts +21 -0
- package/dist/query/query-tab.d.ts.map +1 -0
- package/dist/query/results-table.d.ts +153 -0
- package/dist/query/results-table.d.ts.map +1 -0
- package/dist/query/results.d.ts +137 -0
- package/dist/query/results.d.ts.map +1 -0
- package/dist/query/run.d.ts +199 -0
- package/dist/query/run.d.ts.map +1 -0
- package/dist/query/save-popover.d.ts +29 -0
- package/dist/query/save-popover.d.ts.map +1 -0
- package/dist/query/session.d.ts +409 -0
- package/dist/query/session.d.ts.map +1 -0
- package/dist/query/shape-line.d.ts +21 -0
- package/dist/query/shape-line.d.ts.map +1 -0
- package/dist/query/source.d.ts +21 -0
- package/dist/query/source.d.ts.map +1 -0
- package/dist/query/status-line.d.ts +48 -0
- package/dist/query/status-line.d.ts.map +1 -0
- package/dist/query/step-card.d.ts +30 -0
- package/dist/query/step-card.d.ts.map +1 -0
- package/dist/query/steps/check.d.ts +162 -0
- package/dist/query/steps/check.d.ts.map +1 -0
- package/dist/query/steps/count.d.ts +49 -0
- package/dist/query/steps/count.d.ts.map +1 -0
- package/dist/query/steps/edit.d.ts +108 -0
- package/dist/query/steps/edit.d.ts.map +1 -0
- package/dist/query/steps/fields.d.ts +101 -0
- package/dist/query/steps/fields.d.ts.map +1 -0
- package/dist/query/steps/index.d.ts +22 -0
- package/dist/query/steps/index.d.ts.map +1 -0
- package/dist/query/steps/jq.d.ts +188 -0
- package/dist/query/steps/jq.d.ts.map +1 -0
- package/dist/query/steps/parse.d.ts +38 -0
- package/dist/query/steps/parse.d.ts.map +1 -0
- package/dist/query/steps/print.d.ts +195 -0
- package/dist/query/steps/print.d.ts.map +1 -0
- package/dist/query/steps/shape.d.ts +90 -0
- package/dist/query/steps/shape.d.ts.map +1 -0
- package/dist/query/steps/values.d.ts +85 -0
- package/dist/query/steps/values.d.ts.map +1 -0
- package/dist/query/toolbar.d.ts +56 -0
- package/dist/query/toolbar.d.ts.map +1 -0
- package/dist/query/use-query-editor.d.ts +153 -0
- package/dist/query/use-query-editor.d.ts.map +1 -0
- package/dist/query/use-query-session.d.ts +55 -0
- package/dist/query/use-query-session.d.ts.map +1 -0
- package/dist/query/words.d.ts +60 -0
- package/dist/query/words.d.ts.map +1 -0
- package/dist/query.cjs +16 -0
- package/dist/query.cjs.map +1 -0
- package/dist/query.js +16 -0
- package/dist/query.js.map +1 -0
- package/dist/shared/name-popover.d.ts +38 -0
- package/dist/shared/name-popover.d.ts.map +1 -0
- package/dist/studio/builder.d.ts +20 -0
- package/dist/studio/builder.d.ts.map +1 -0
- package/dist/studio/inspector.d.ts +18 -0
- package/dist/studio/inspector.d.ts.map +1 -0
- package/dist/studio/library.d.ts +20 -0
- package/dist/studio/library.d.ts.map +1 -0
- package/dist/studio/messages.d.ts +318 -0
- package/dist/studio/messages.d.ts.map +1 -0
- package/dist/studio/open-page.d.ts +13 -0
- package/dist/studio/open-page.d.ts.map +1 -0
- package/dist/studio/page.d.ts +61 -0
- package/dist/studio/page.d.ts.map +1 -0
- package/dist/studio/palette.d.ts +41 -0
- package/dist/studio/palette.d.ts.map +1 -0
- package/dist/studio/publish.d.ts +21 -0
- package/dist/studio/publish.d.ts.map +1 -0
- package/dist/studio/save-template.d.ts +18 -0
- package/dist/studio/save-template.d.ts.map +1 -0
- package/dist/studio/studio-east.d.ts +45 -0
- package/dist/studio/studio-east.d.ts.map +1 -0
- package/package.json +19 -14
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import { EastType, SummaryLeafType, ValueTypeOf } from '@elaraai/east';
|
|
2
|
+
import { SplitCallProgress } from '@elaraai/e3-types';
|
|
3
|
+
import { Formatters } from '@elaraai/east-ui-components';
|
|
4
|
+
import { PlanExplanation, QueryPlan } from '../plan.js';
|
|
5
|
+
import { CheckedSteps, StepDiagnostic, StepFix } from '../steps/check.js';
|
|
6
|
+
import { StepField } from '../steps/fields.js';
|
|
7
|
+
import { Shape } from '../steps/shape.js';
|
|
8
|
+
import { StepParseError } from '../steps/parse.js';
|
|
9
|
+
import { Condition, Step, StepKind, StepQuery, StepValue } from '../steps/values.js';
|
|
10
|
+
import { QueryMessages } from './messages.js';
|
|
11
|
+
/** A summary leaf: what a summary says about one path of the rows. */
|
|
12
|
+
export type SummaryLeaf = ValueTypeOf<typeof SummaryLeafType>;
|
|
13
|
+
/** The words the model says, and how it prints numbers and dates. */
|
|
14
|
+
export interface QueryWords {
|
|
15
|
+
/** The message table. */
|
|
16
|
+
readonly messages: QueryMessages;
|
|
17
|
+
/** The locale's formatters. */
|
|
18
|
+
readonly formatters: Formatters;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The words of a locale.
|
|
22
|
+
*
|
|
23
|
+
* @param formatters - the locale's formatters (`useFormatters()` in a renderer)
|
|
24
|
+
* @param messages - the message table; English by default
|
|
25
|
+
* @returns the words
|
|
26
|
+
*/
|
|
27
|
+
export declare function queryWords(formatters: Formatters, messages?: QueryMessages): QueryWords;
|
|
28
|
+
/** Each step's icon (Font Awesome's names, `Query Editor Spec.md` §4.4). */
|
|
29
|
+
export declare const STEP_ICON: Readonly<Record<StepKind, string>>;
|
|
30
|
+
/**
|
|
31
|
+
* A field's name as a person reads it: underscores as spaces, and `id` and
|
|
32
|
+
* `sku` in capitals — `customer_id` is `customer ID`.
|
|
33
|
+
*
|
|
34
|
+
* @param name - the name
|
|
35
|
+
* @returns the label
|
|
36
|
+
*/
|
|
37
|
+
export declare function human(name: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* The plural of a noun, as English mostly forms it: `order` → `orders`,
|
|
40
|
+
* `category` → `categories`, `status` → `statuses`; a noun already plural is
|
|
41
|
+
* itself.
|
|
42
|
+
*
|
|
43
|
+
* @param word - the noun
|
|
44
|
+
* @returns its plural
|
|
45
|
+
*/
|
|
46
|
+
export declare function plural(word: string): string;
|
|
47
|
+
/**
|
|
48
|
+
* A field's label: its name as a person reads it, and a payload's field
|
|
49
|
+
* with its case — `shipped date`.
|
|
50
|
+
*
|
|
51
|
+
* @param field - the field
|
|
52
|
+
* @returns the label
|
|
53
|
+
*/
|
|
54
|
+
export declare function fieldLabel(field: StepField): string;
|
|
55
|
+
/**
|
|
56
|
+
* The label of the field a step names: its field's in the shape, or the
|
|
57
|
+
* last part of the name when the shape has none.
|
|
58
|
+
*
|
|
59
|
+
* @param shape - the rows it is read in
|
|
60
|
+
* @param ref - how the step names it
|
|
61
|
+
* @returns the label
|
|
62
|
+
*/
|
|
63
|
+
export declare function refLabel(shape: Shape, ref: string): string;
|
|
64
|
+
/**
|
|
65
|
+
* Whether a field holds IDs, which print as written: `id`, a name ending
|
|
66
|
+
* `_id`, or `order`.
|
|
67
|
+
*
|
|
68
|
+
* @param name - the field's name
|
|
69
|
+
* @returns whether it is an ID
|
|
70
|
+
*/
|
|
71
|
+
export declare function isIdName(name: string): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* A kind of value in plain words (`Query Editor Spec.md` §4.4): `text`,
|
|
74
|
+
* `whole number`, `number, sometimes missing`, `one of gold, standard`, `list
|
|
75
|
+
* of lines`, `lookup table`, `calculation`, `record`, `tree of boms`.
|
|
76
|
+
*
|
|
77
|
+
* @param type - the type
|
|
78
|
+
* @param words - the words
|
|
79
|
+
* @param items - what a list's or a tree's items are called, already plural: a field's or a data source's name
|
|
80
|
+
* @returns the kind
|
|
81
|
+
*/
|
|
82
|
+
export declare function plainKind(type: EastType, words: QueryWords, items?: string): string;
|
|
83
|
+
/**
|
|
84
|
+
* A field's kind in plain words, its items named after it.
|
|
85
|
+
*
|
|
86
|
+
* @param field - the field
|
|
87
|
+
* @param words - the words
|
|
88
|
+
* @returns the kind
|
|
89
|
+
*/
|
|
90
|
+
export declare function fieldKind(field: StepField, words: QueryWords): string;
|
|
91
|
+
/**
|
|
92
|
+
* The case a shape's rows are narrowed to, as an adjective: `shipped`.
|
|
93
|
+
*
|
|
94
|
+
* @param shape - the shape
|
|
95
|
+
* @returns the first narrowed case, or `""`
|
|
96
|
+
*/
|
|
97
|
+
export declare function adjectiveOf(shape: Shape): string;
|
|
98
|
+
/**
|
|
99
|
+
* A shape's rows in words, in the number a count gives: `shipped orders`,
|
|
100
|
+
* `shipped order`.
|
|
101
|
+
*
|
|
102
|
+
* @param shape - the shape
|
|
103
|
+
* @param words - the words
|
|
104
|
+
* @param n - how many, for the noun's number; plural when omitted
|
|
105
|
+
* @param adjective - an adjective in place of the shape's own
|
|
106
|
+
* @returns the rows
|
|
107
|
+
*/
|
|
108
|
+
export declare function rowsWords(shape: Shape, words: QueryWords, n?: number, adjective?: string): string;
|
|
109
|
+
/**
|
|
110
|
+
* A shape in plain words (`Query Editor Spec.md` §4.3): `Many shipped
|
|
111
|
+
* orders`, `Up to 10 orders`, `One whole number`, `One bom tree`.
|
|
112
|
+
*
|
|
113
|
+
* @param shape - the shape
|
|
114
|
+
* @param words - the words
|
|
115
|
+
* @returns the words
|
|
116
|
+
*/
|
|
117
|
+
export declare function shapeWords(shape: Shape, words: QueryWords): string;
|
|
118
|
+
/**
|
|
119
|
+
* A shape counted: `16 shipped orders`; one value is its shape.
|
|
120
|
+
*
|
|
121
|
+
* @param shape - the shape
|
|
122
|
+
* @param n - how many rows a run counted
|
|
123
|
+
* @param words - the words
|
|
124
|
+
* @returns the words
|
|
125
|
+
*/
|
|
126
|
+
export declare function countWords(shape: Shape, n: number, words: QueryWords): string;
|
|
127
|
+
/**
|
|
128
|
+
* The fields of a shape's rows as a person reads them, payloads aside.
|
|
129
|
+
*
|
|
130
|
+
* @param shape - the shape
|
|
131
|
+
* @returns the labels
|
|
132
|
+
*/
|
|
133
|
+
export declare function fieldLabels(shape: Shape): string[];
|
|
134
|
+
/**
|
|
135
|
+
* A number from the data as a summary prints it: an ID as written, a whole
|
|
136
|
+
* number grouped, any other with two decimals.
|
|
137
|
+
*
|
|
138
|
+
* @param n - the number
|
|
139
|
+
* @param field - the field it belongs to
|
|
140
|
+
* @param words - the words
|
|
141
|
+
* @returns the text
|
|
142
|
+
*/
|
|
143
|
+
export declare function dataNumber(n: number, field: StepField, words: QueryWords): string;
|
|
144
|
+
/**
|
|
145
|
+
* A value a step holds, as its slot shows it: text as written, a number as
|
|
146
|
+
* data — every digit, never grouped.
|
|
147
|
+
*
|
|
148
|
+
* @param value - the value
|
|
149
|
+
* @param words - the words
|
|
150
|
+
* @returns the text
|
|
151
|
+
*/
|
|
152
|
+
export declare function valueWords(value: StepValue, words: QueryWords): string;
|
|
153
|
+
/**
|
|
154
|
+
* The jq path from a row a summary keys a field's leaf by: `.total`,
|
|
155
|
+
* `.status.type`, `.status.value.date`; an item's field under its list —
|
|
156
|
+
* `.lines[].sku`.
|
|
157
|
+
*
|
|
158
|
+
* @param field - the field
|
|
159
|
+
* @param list - the list field the field is an item's field of, if any
|
|
160
|
+
* @returns the path
|
|
161
|
+
*/
|
|
162
|
+
export declare function leafPath(field: StepField, list?: StepField): string;
|
|
163
|
+
/**
|
|
164
|
+
* What a summary says of a field, as a slot's offer shows it
|
|
165
|
+
* (`Query Editor Spec.md` §4.5): `8 values`, `0.85 – 3,646.84`, `3 cases`,
|
|
166
|
+
* `1–4 each`, `· 12 missing`.
|
|
167
|
+
*
|
|
168
|
+
* @param field - the field
|
|
169
|
+
* @param leaf - its leaf of the summary
|
|
170
|
+
* @param words - the words
|
|
171
|
+
* @returns the words, or `""` when the summary says nothing worth showing
|
|
172
|
+
*/
|
|
173
|
+
export declare function fieldSummaryWords(field: StepField, leaf: SummaryLeaf | undefined, words: QueryWords): string;
|
|
174
|
+
/** A problem in plain words, and its fixes' labels. */
|
|
175
|
+
export interface ProblemWords {
|
|
176
|
+
/** The sentence. */
|
|
177
|
+
readonly text: string;
|
|
178
|
+
/** Each fix, with its label in plain words. */
|
|
179
|
+
readonly fixes: readonly {
|
|
180
|
+
readonly fix: StepFix;
|
|
181
|
+
readonly label: string;
|
|
182
|
+
}[];
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* A problem of the steps in plain words (`Query Editor Spec.md` §4.6), with
|
|
186
|
+
* its fixes' labels; a problem the words have no sentence for keeps the
|
|
187
|
+
* checker's.
|
|
188
|
+
*
|
|
189
|
+
* @param d - the diagnostic, as `checkSteps` placed it
|
|
190
|
+
* @param query - the query
|
|
191
|
+
* @param root - the root's type: a struct of the data sources
|
|
192
|
+
* @param checked - the query's check
|
|
193
|
+
* @param words - the words
|
|
194
|
+
* @returns the sentence and the fixes
|
|
195
|
+
*/
|
|
196
|
+
export declare function problemWords(d: StepDiagnostic, query: StepQuery, root: EastType, checked: CheckedSteps, words: QueryWords): ProblemWords;
|
|
197
|
+
/**
|
|
198
|
+
* A problem that keeps a program from being steps, in plain words
|
|
199
|
+
* (`Query Editor Spec.md` §4.6, "the program"); one the words have no
|
|
200
|
+
* sentence for keeps the parser's or the checker's.
|
|
201
|
+
*
|
|
202
|
+
* @param error - the problem `parseSteps` gave
|
|
203
|
+
* @param words - the words
|
|
204
|
+
* @returns the sentence
|
|
205
|
+
*/
|
|
206
|
+
export declare function parseErrorWords(error: StepParseError, words: QueryWords): string;
|
|
207
|
+
/** The most a generated description holds (`Query Editor Spec.md` §4.13). */
|
|
208
|
+
export declare const DESCRIPTION_MAX = 140;
|
|
209
|
+
/**
|
|
210
|
+
* A condition in a sentence: `status is shipped`, `lines has any where SKU
|
|
211
|
+
* is BRK-100`; a group in brackets.
|
|
212
|
+
*
|
|
213
|
+
* @param condition - the condition
|
|
214
|
+
* @param shape - the rows it tests
|
|
215
|
+
* @param words - the words
|
|
216
|
+
* @returns the words, or `""` for a condition not finished
|
|
217
|
+
*/
|
|
218
|
+
export declare function conditionWords(condition: Condition, shape: Shape, words: QueryWords): string;
|
|
219
|
+
/**
|
|
220
|
+
* How a field's order is said: dates newest or oldest first, text A to Z,
|
|
221
|
+
* anything else highest or lowest first.
|
|
222
|
+
*
|
|
223
|
+
* @param field - the field sorted by, if known
|
|
224
|
+
* @returns the kind of order
|
|
225
|
+
*/
|
|
226
|
+
export declare function orderKind(field: StepField | undefined): "date" | "text" | "number";
|
|
227
|
+
/**
|
|
228
|
+
* A step in words, from its own values: what an outline line says
|
|
229
|
+
* (`Query Editor Spec.md` §5) — `status is shipped and total is at least
|
|
230
|
+
* 100`, `name and region from customers by customer ID`, `revenue and orders
|
|
231
|
+
* per region`, `by total, highest first`.
|
|
232
|
+
*
|
|
233
|
+
* @param step - the step
|
|
234
|
+
* @param before - the rows it takes
|
|
235
|
+
* @param words - the words
|
|
236
|
+
* @returns the words; a jq step's text as written
|
|
237
|
+
*/
|
|
238
|
+
export declare function stepWords(step: Step, before: Shape, words: QueryWords): string;
|
|
239
|
+
/**
|
|
240
|
+
* The sentence a saved query shows when its author wrote none
|
|
241
|
+
* (`Query Editor Spec.md` §4.13): one sentence from the finished steps, at
|
|
242
|
+
* most {@link DESCRIPTION_MAX} characters, cut at a word.
|
|
243
|
+
*
|
|
244
|
+
* @param query - the query
|
|
245
|
+
* @param checked - its check, for each step's rows
|
|
246
|
+
* @param words - the words
|
|
247
|
+
* @returns the sentence, or `""` when no step is finished
|
|
248
|
+
*/
|
|
249
|
+
export declare function describeQuery(query: StepQuery, checked: CheckedSteps, words: QueryWords): string;
|
|
250
|
+
/**
|
|
251
|
+
* A size in bytes, in words — `1.4 MB`, `16 MB`, `512 B`: in the largest unit
|
|
252
|
+
* it holds one of, to GB.
|
|
253
|
+
*
|
|
254
|
+
* @param bytes - the size
|
|
255
|
+
* @param words - the words
|
|
256
|
+
* @returns the size
|
|
257
|
+
*/
|
|
258
|
+
export declare function byteWords(bytes: number | bigint, words: QueryWords): string;
|
|
259
|
+
/** A line of a plan's explanation: a sentence, and the jq it is about. */
|
|
260
|
+
export interface PlanLine {
|
|
261
|
+
/**
|
|
262
|
+
* What it says: the path and why; a re-key and its stage (#942); what each
|
|
263
|
+
* piece runs, what it reads cut at the same keys (#942), how the pieces
|
|
264
|
+
* combine, a total, what runs once; what every piece reads whole; the
|
|
265
|
+
* pieces; a read that prunes.
|
|
266
|
+
*/
|
|
267
|
+
readonly kind: "path" | "rekey" | "piece" | "copartitioned" | "combine" | "total" | "then" | "broadcast" | "pieces" | "pruning";
|
|
268
|
+
/** Its sentence: one that ends with a colon has its jq after it. */
|
|
269
|
+
readonly text: string;
|
|
270
|
+
/** The jq it is about, as the query writes it; `undefined` when it is about none. */
|
|
271
|
+
readonly code: string | undefined;
|
|
272
|
+
}
|
|
273
|
+
/** What a run knows of its plan as it goes: a split call's progress, and how many pieces it cut. */
|
|
274
|
+
export interface PlanRun {
|
|
275
|
+
/** A split call's progress, while it goes. */
|
|
276
|
+
readonly progress?: SplitCallProgress | undefined;
|
|
277
|
+
/** How many pieces it cut, once e3 says. */
|
|
278
|
+
readonly pieces?: number | undefined;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* How far a split run has got, in words — `3 of 12 pieces done`, `1 of 1
|
|
282
|
+
* merges done`.
|
|
283
|
+
*
|
|
284
|
+
* @param progress - its progress, as e3 reports it
|
|
285
|
+
* @param words - the words
|
|
286
|
+
* @returns the words
|
|
287
|
+
*/
|
|
288
|
+
export declare function planProgressWords(progress: SplitCallProgress, words: QueryWords): string;
|
|
289
|
+
/**
|
|
290
|
+
* A plan's explanation in words: one line per sentence, each with the jq it
|
|
291
|
+
* is about.
|
|
292
|
+
*
|
|
293
|
+
* @param explanation - the plan's explanation (`plan.ts`)
|
|
294
|
+
* @param words - the words
|
|
295
|
+
* @param run - what the run knows of its plan: a split call's progress while
|
|
296
|
+
* it goes, and how many pieces it cut once e3 says
|
|
297
|
+
* @returns the lines, in order
|
|
298
|
+
*
|
|
299
|
+
* @remarks
|
|
300
|
+
* - **The path**, first: a split call over a dataset and what it weighs, more
|
|
301
|
+
* than one piece — or what the heaviest dataset cut with it weighs; or one
|
|
302
|
+
* call — within one piece, a weight not known, a split call that could not
|
|
303
|
+
* be made, or the reason the query runs as one unit, with the jq the reason
|
|
304
|
+
* is about. A re-keyed join says so next, and its re-key stage with the join
|
|
305
|
+
* key and what the re-keyed rows are estimated to weigh (#942).
|
|
306
|
+
* - **A split's stages**: what each piece runs; the data sources cut at the
|
|
307
|
+
* same keys with it (#942); how their outputs combine — rows joined;
|
|
308
|
+
* totals, each by its rule; grouped by a key, each group's totals combined
|
|
309
|
+
* or its rows collected; the distinct rows; the first row of each key; a
|
|
310
|
+
* reduce's updates by key, added or the last kept; the first rows of a sort
|
|
311
|
+
* (#942); what runs once after them; the data sources every piece reads
|
|
312
|
+
* whole; and the pieces — how far the run has got while it goes, then how
|
|
313
|
+
* many and about what each weighs.
|
|
314
|
+
* - **The reads that prune**, last: a count from a dataset's index, a key
|
|
315
|
+
* seek, a stream that stops.
|
|
316
|
+
*/
|
|
317
|
+
export declare function planWords(explanation: PlanExplanation, words: QueryWords, run?: PlanRun): PlanLine[];
|
|
318
|
+
/**
|
|
319
|
+
* A plan's read-out, beside a run's: `One call`; `Split call`, with how far it
|
|
320
|
+
* has got while it goes — `Split call · 3 of 12 pieces done` — and how many
|
|
321
|
+
* pieces it cut once e3 says — `Split call · 12 pieces`; and a re-keyed join's
|
|
322
|
+
* two calls the same way — `Re-keyed join · 12 pieces`, the join call's
|
|
323
|
+
* pieces (#942).
|
|
324
|
+
*
|
|
325
|
+
* @param planned - the run's plan
|
|
326
|
+
* @param words - the words
|
|
327
|
+
* @param run - what the run knows of its plan
|
|
328
|
+
* @returns the read-out
|
|
329
|
+
*/
|
|
330
|
+
export declare function planBadge(planned: QueryPlan, words: QueryWords, run?: PlanRun): string;
|
|
331
|
+
//# sourceMappingURL=words.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"words.d.ts","sourceRoot":"","sources":["../../../src/query/model/words.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;GASG;AAEH,OAAO,EAEH,KAAK,QAAQ,EAA8B,KAAK,eAAe,EAAE,KAAK,WAAW,EACpF,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAiB,MAAM,6BAA6B,CAAC;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAA4B,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,KAAK,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEnH,OAAO,EAAsC,KAAK,SAAS,EA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E,KAAK,EAAE,UAAU,GAAG,MAAM,CAQ3E;AAID,0EAA0E;AAC1E,MAAM,WAAW,QAAQ;IACrB;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,eAAe,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAC;IAChI,oEAAoE;IACpE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qFAAqF;IACrF,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAED,oGAAoG;AACpG,MAAM,WAAW,OAAO;IACpB,8CAA8C;IAC9C,QAAQ,CAAC,QAAQ,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAClD,4CAA4C;IAC5C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACxC;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,CAIxF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,SAAS,CAAC,WAAW,EAAE,eAAe,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,GAAE,OAAY,GAAG,QAAQ,EAAE,CAgFxG;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,GAAE,OAAY,GAAG,MAAM,CAO1F"}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { CheckJqResult, EastType, EastTypeValue, JqMultiplicity, JqNode, ValueTypeOf } from '@elaraai/east';
|
|
2
|
+
import { ExecuteResult, OneShotRequest, RunnerValue } from '@elaraai/e3-types';
|
|
3
|
+
import { QueryResultType, QueryRootEntryType } from '@elaraai/e3-ui/internal';
|
|
4
|
+
/**
|
|
5
|
+
* A data source of a query's root, as the builder binds it: the root field a
|
|
6
|
+
* query reads it by, its dataset's path, and the dataset's type.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* `name` and `path` are a {@link QueryRootEntryType} value, what a saved query
|
|
10
|
+
* keeps of its root; `type` is the dataset's East type, as e3 lists it.
|
|
11
|
+
*/
|
|
12
|
+
export type QueryRootEntry = ValueTypeOf<typeof QueryRootEntryType> & {
|
|
13
|
+
/** The dataset's East type, as e3 lists it. */
|
|
14
|
+
type: EastTypeValue;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* A query's root: the type every query of the builder is checked against, and
|
|
18
|
+
* the data sources it is made of.
|
|
19
|
+
*
|
|
20
|
+
* @property type - The root's type: a Struct of the data sources' types, in entry order
|
|
21
|
+
* @property entries - The data sources, in root order
|
|
22
|
+
*/
|
|
23
|
+
export interface QueryRoot {
|
|
24
|
+
/** The root's type: a Struct of the data sources' types, in entry order. */
|
|
25
|
+
readonly type: EastType;
|
|
26
|
+
/** The data sources, in root order. */
|
|
27
|
+
readonly entries: QueryRootEntry[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The root a query's data sources make: the builder's `useQueryRoot` gives it
|
|
31
|
+
* from the data sources a page binds.
|
|
32
|
+
*
|
|
33
|
+
* @param entries - the data sources, in root order
|
|
34
|
+
* @returns the root: a Struct of the data sources' types, in entry order, and
|
|
35
|
+
* the data sources
|
|
36
|
+
* @throws {Error} When a name is not a jq identifier, or is given twice,
|
|
37
|
+
* naming it.
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* The root is only a type. Its entries become the translation's parameters,
|
|
41
|
+
* one dataset each, because a lazy dataset put into a struct is read whole
|
|
42
|
+
* (`devdocs/QUERY.md` §15.6). A name is a jq identifier — a letter or `_`,
|
|
43
|
+
* then letters, digits and `_` — so `.name` reads it. A root of no data
|
|
44
|
+
* sources is the empty Struct, and a query that reads a data source of it is
|
|
45
|
+
* refused when it is checked.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* const root = queryRoot([
|
|
50
|
+
* { name: "customers", path: [variant("field", "inputs"), variant("field", "customers")], type: toEastTypeValue(Customers) },
|
|
51
|
+
* { name: "orders", path: [variant("field", "inputs"), variant("field", "orders")], type: toEastTypeValue(Orders) },
|
|
52
|
+
* ]);
|
|
53
|
+
* // root.type is StructType({ customers: Customers, orders: Orders })
|
|
54
|
+
*
|
|
55
|
+
* queryRoot([{ name: "order lines", path, type }]);
|
|
56
|
+
* // throws: queryRoot: "order lines" is not a jq identifier: …
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare function queryRoot(entries: readonly QueryRootEntry[]): QueryRoot;
|
|
60
|
+
/**
|
|
61
|
+
* Options for {@link prepareQuery}: the call's limits, and its runner.
|
|
62
|
+
*
|
|
63
|
+
* @property maxOutputs - The most outputs a `many` query returns: 1 000 by default, at most 100 000
|
|
64
|
+
* @property maxBytes - The largest answer the call returns, in bytes: 1 MiB by default
|
|
65
|
+
* @property timeoutMs - The call's time limit, in milliseconds: the server's when omitted
|
|
66
|
+
* @property runner - The runner: east-c given no platform package, by default
|
|
67
|
+
*/
|
|
68
|
+
export interface QueryOptions {
|
|
69
|
+
/** The most outputs a `many` query returns: 1 000 by default, at most 100 000. */
|
|
70
|
+
readonly maxOutputs?: number;
|
|
71
|
+
/** The largest answer the call returns, in bytes: 1 MiB by default. */
|
|
72
|
+
readonly maxBytes?: number;
|
|
73
|
+
/**
|
|
74
|
+
* The call's time limit, in milliseconds. Omitted, the call names none and
|
|
75
|
+
* the server's applies: its default for a call that names none, under the
|
|
76
|
+
* longest a request to it may take (#1131).
|
|
77
|
+
*/
|
|
78
|
+
readonly timeoutMs?: number;
|
|
79
|
+
/** The runner: east-c given no platform package by default, which any caller who may read the workspace may run. */
|
|
80
|
+
readonly runner?: RunnerValue;
|
|
81
|
+
}
|
|
82
|
+
/** What a run of a query answered: a {@link QueryResultType} value. */
|
|
83
|
+
export type QueryResult = ValueTypeOf<typeof QueryResultType>;
|
|
84
|
+
/**
|
|
85
|
+
* What the checker made of a program that checks: the program as written, the
|
|
86
|
+
* type of each output and how many there are, each present.
|
|
87
|
+
*/
|
|
88
|
+
export type CheckedProgram = CheckJqResult & {
|
|
89
|
+
/** The program as written. */
|
|
90
|
+
readonly program: JqNode;
|
|
91
|
+
/** The type of each output. */
|
|
92
|
+
readonly elementType: EastType;
|
|
93
|
+
/** How many outputs the program gives. */
|
|
94
|
+
readonly multiplicity: JqMultiplicity;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Whether a program checks: its program, the type of each output and how many
|
|
98
|
+
* there are are present exactly when no diagnostic is an error.
|
|
99
|
+
*
|
|
100
|
+
* @param checked - what `checkJq` made of the program
|
|
101
|
+
* @returns whether it checks
|
|
102
|
+
*/
|
|
103
|
+
export declare function programChecks(checked: CheckJqResult): checked is CheckedProgram;
|
|
104
|
+
/**
|
|
105
|
+
* A query's one-shot call, ready to send, and what reading its answer needs.
|
|
106
|
+
*
|
|
107
|
+
* @property checked - What the checker made of the program: the program as written, the type of each output and how many there are, and the spans a runtime error is placed by
|
|
108
|
+
* @property entries - The data sources the query reads, one per argument of the call, in its order
|
|
109
|
+
* @property request - The call, which e3-api-client's `oneShotExecute` sends
|
|
110
|
+
* @property maxOutputs - The most outputs a `many` query returns
|
|
111
|
+
*/
|
|
112
|
+
export interface PreparedQuery {
|
|
113
|
+
/** What the checker made of the program: the program as written, the type of each output and how many there are, and the spans a runtime error is placed by. */
|
|
114
|
+
readonly checked: CheckedProgram;
|
|
115
|
+
/** The data sources the query reads, one per argument of the call, in its order: the order the query first reads them. */
|
|
116
|
+
readonly entries: QueryRootEntry[];
|
|
117
|
+
/** The call, which e3-api-client's `oneShotExecute` sends. */
|
|
118
|
+
readonly request: OneShotRequest;
|
|
119
|
+
/** The most outputs a `many` query returns; the call gives one more, which says the answer was cut short. */
|
|
120
|
+
readonly maxOutputs: number;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* What reading a call's answer needs ({@link queryResultOf}): the checker's
|
|
124
|
+
* record of the query that ran — the type of each output, and how many there
|
|
125
|
+
* are — the data sources in the call's argument order, and its most outputs. A
|
|
126
|
+
* one-shot call's {@link PreparedQuery} is one; so is a split call's, which
|
|
127
|
+
* the planner gives (`plan.ts`).
|
|
128
|
+
*/
|
|
129
|
+
export type QueryReading = Pick<PreparedQuery, "checked" | "entries" | "maxOutputs">;
|
|
130
|
+
/** A call's limits and runner, as its options set them: what a one-shot call and a split call both send. */
|
|
131
|
+
export interface QueryLimits {
|
|
132
|
+
/** The most outputs a `many` query returns. */
|
|
133
|
+
readonly maxOutputs: number;
|
|
134
|
+
/** The call's limits: its largest answer as `maxResultBytes`, and its time limit when the options name one. */
|
|
135
|
+
readonly limits: OneShotRequest["limits"];
|
|
136
|
+
/** The runner: east-c given no platform package, unless the options name another. */
|
|
137
|
+
readonly runner: RunnerValue;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* A call's limits and runner, from its options: its most outputs and its
|
|
141
|
+
* largest answer their defaults when the options give none, and no time limit
|
|
142
|
+
* unless the options name one, so the server's applies (#1131).
|
|
143
|
+
*
|
|
144
|
+
* @param options - the call's limits and its runner
|
|
145
|
+
* @returns the most outputs, the limits and the runner
|
|
146
|
+
* @throws {RangeError} When a limit is not a whole number of at least 1.
|
|
147
|
+
*/
|
|
148
|
+
export declare function queryLimits(options?: QueryOptions): QueryLimits;
|
|
149
|
+
/**
|
|
150
|
+
* Prepares a query's one-shot call: checks the program once against the whole
|
|
151
|
+
* root, translates it, and builds the request.
|
|
152
|
+
*
|
|
153
|
+
* @param program - the query's jq text
|
|
154
|
+
* @param root - the root its data sources make ({@link queryRoot})
|
|
155
|
+
* @param options - the call's limits and its runner
|
|
156
|
+
* @returns the prepared call; or, for a program that does not check, the
|
|
157
|
+
* `error` result a run of it gives
|
|
158
|
+
* @throws {RangeError} When a limit is not a whole number of at least 1.
|
|
159
|
+
* @throws {TranslationError} When the checked program holds something the
|
|
160
|
+
* translator cannot express: a gap in the translation, never a mistake in
|
|
161
|
+
* the query.
|
|
162
|
+
*
|
|
163
|
+
* @remarks
|
|
164
|
+
* - **One check.** The program is checked with
|
|
165
|
+
* `checkJq(program, root.type, { root: true })`, once, against the whole
|
|
166
|
+
* root, which is never narrowed to what the query reads (#1041): `keys` on
|
|
167
|
+
* the root answers every name. A problem of error severity is an `error`
|
|
168
|
+
* result holding the checker's diagnostics, lints included, and no input,
|
|
169
|
+
* since nothing ran; reading the whole root is one.
|
|
170
|
+
* - **The translation.** `translateJq` translates it, a `many` query asked
|
|
171
|
+
* for at most `maxOutputs + 1` outputs (#923). Its parameters are the
|
|
172
|
+
* datasets it reads, in the order it first reads them.
|
|
173
|
+
* - **The request.** `bodyIr` is the translation as an East function, its IR
|
|
174
|
+
* encoded with its source map, so a runtime error names its place in the
|
|
175
|
+
* jq; `args` is one `dataset` argument per dataset read, in the
|
|
176
|
+
* translation's order; `runner` is east-c given no platform package, unless
|
|
177
|
+
* the options name another; `limits` holds `maxBytes` as `maxResultBytes`,
|
|
178
|
+
* and `timeoutMs` when the options give one. A call that names no time limit
|
|
179
|
+
* runs under the server's: its default for a call that names none, under
|
|
180
|
+
* the longest a request to it may take (#1131).
|
|
181
|
+
* - **Platform-free.** A translation calls East's builtins only, so the body
|
|
182
|
+
* holds no `Platform` node, and with the default runner any caller who may
|
|
183
|
+
* read the workspace may run the call (#1031).
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```ts
|
|
187
|
+
* const prepared = prepareQuery(".orders | map(.total) | add", root, { timeoutMs: 10_000 });
|
|
188
|
+
* if ("result" in prepared) return prepared.result; // the checker's problems
|
|
189
|
+
* const result = await oneShotExecute(url, repo, workspace, prepared.prepared.request, { token });
|
|
190
|
+
* return queryResultOf(prepared.prepared, result);
|
|
191
|
+
* ```
|
|
192
|
+
*/
|
|
193
|
+
export declare function prepareQuery(program: string, root: QueryRoot, options?: QueryOptions): {
|
|
194
|
+
prepared: PreparedQuery;
|
|
195
|
+
} | {
|
|
196
|
+
result: QueryResult;
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* Prepares a query's one-shot call from what the checker made of it: what
|
|
200
|
+
* {@link prepareQuery} does once it has checked the program, for a caller that
|
|
201
|
+
* has checked it already — the planner, which checks a query once to split it
|
|
202
|
+
* and to call it.
|
|
203
|
+
*
|
|
204
|
+
* @param checked - what `checkJq` made of the program, against `root.type`, as an e3 root
|
|
205
|
+
* @param root - the root
|
|
206
|
+
* @param options - the call's limits and its runner
|
|
207
|
+
* @returns the prepared call; or, for a program that does not check, the `error` result a run of it gives
|
|
208
|
+
* @throws {RangeError} When a limit is not a whole number of at least 1.
|
|
209
|
+
* @throws {TranslationError} When the checked program holds something the translator cannot express.
|
|
210
|
+
*/
|
|
211
|
+
export declare function prepareCheckedQuery(checked: CheckJqResult, root: QueryRoot, options?: QueryOptions): {
|
|
212
|
+
prepared: PreparedQuery;
|
|
213
|
+
} | {
|
|
214
|
+
result: QueryResult;
|
|
215
|
+
};
|
|
216
|
+
/**
|
|
217
|
+
* The data source of a root a query reads by a name.
|
|
218
|
+
*
|
|
219
|
+
* @param root - the root
|
|
220
|
+
* @param name - the root field the translation, or the split, reads
|
|
221
|
+
* @param caller - what asks, for the error: `prepareQuery` by default
|
|
222
|
+
* @returns the data source
|
|
223
|
+
* @throws {Error} When the root has none of that name: its type was not made from its entries.
|
|
224
|
+
*/
|
|
225
|
+
export declare function entryNamed(root: QueryRoot, name: string | null, caller?: string): QueryRootEntry;
|
|
226
|
+
/**
|
|
227
|
+
* What a query's call answered: a one-shot call's, or a split call's.
|
|
228
|
+
*
|
|
229
|
+
* @param prepared - the call, as {@link prepareQuery} prepared it; or a split
|
|
230
|
+
* call's reading, as the planner gives it — both a {@link QueryReading}
|
|
231
|
+
* @param result - what e3-api-client's `oneShotExecute` returned for it, or a
|
|
232
|
+
* split call's result (`splitCall`'s `result`)
|
|
233
|
+
* @returns the answer: how the run ended, and the datasets it read
|
|
234
|
+
* @throws {Error} When the call read a dataset other than the one the query
|
|
235
|
+
* reads there: the result is not this call's.
|
|
236
|
+
*
|
|
237
|
+
* @remarks
|
|
238
|
+
* - `success` is `ok`, the value decoded with the translation's result type.
|
|
239
|
+
* A `many` answer of more than `maxOutputs` outputs — the translation gives
|
|
240
|
+
* one more — is `truncated`, its last output dropped. `result` is
|
|
241
|
+
* self-describing beast2 of the answer kept, at the result type, and
|
|
242
|
+
* `outputs` counts its outputs: one for a `one` query, none or one for
|
|
243
|
+
* `maybe`.
|
|
244
|
+
* - `failed` for a platform function the runner could not find is
|
|
245
|
+
* `needs_platform`, naming each: a function value in the data may call one
|
|
246
|
+
* (`devdocs/QUERY.md` §9).
|
|
247
|
+
* - `failed` otherwise is an `error` of one `runtime` diagnostic: the
|
|
248
|
+
* runner's message, at the jq node that raised it, placed by east's
|
|
249
|
+
* `runtimeErrorAt` as `evaluateJq` places one (`devdocs/QUERY.md` §15.3).
|
|
250
|
+
* A failure with no message says what the runner last said, or its exit
|
|
251
|
+
* code.
|
|
252
|
+
* - `invalid` is an `error`: `no_value` for a dataset e3 found unassigned
|
|
253
|
+
* ("orders has no value yet"), and `invalid` for anything else it refused.
|
|
254
|
+
* - `timed_out` and `too_large` are as e3 reported them.
|
|
255
|
+
*
|
|
256
|
+
* `inputs` names each dataset the run read, with the hash e3 pinned it at, in
|
|
257
|
+
* the call's argument order: empty when nothing ran.
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* ```ts
|
|
261
|
+
* const result = queryResultOf(prepared, await oneShotExecute(url, repo, workspace, prepared.request, { token }));
|
|
262
|
+
* if (result.outcome.type === "ok") show(decodeBeast2(result.outcome.value.result), result.outcome.value.truncated);
|
|
263
|
+
* ```
|
|
264
|
+
*/
|
|
265
|
+
export declare function queryResultOf(prepared: QueryReading, result: ExecuteResult): QueryResult;
|
|
266
|
+
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