@malloydata/malloy-query-builder 0.0.240-dev250305162504 → 0.0.240-dev250305163014
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 +2 -2
- package/dist/query-ast.d.ts +66 -232
- package/dist/query-ast.js +287 -423
- package/dist/query-ast.js.map +1 -1
- package/dist/query-ast.spec.js +243 -76
- package/dist/query-ast.spec.js.map +1 -1
- package/flow/query-ast.d.ts +71 -59
- package/package.json +4 -4
- package/src/query-ast.spec.ts +246 -78
- package/src/query-ast.ts +273 -454
package/README.md
CHANGED
|
@@ -328,7 +328,7 @@ run: flights -> { aggregate: flight_count { where: carrier ~ f`WN, AA`} }
|
|
|
328
328
|
{@link ASTSourceReference.setParameter}
|
|
329
329
|
|
|
330
330
|
```ts
|
|
331
|
-
query.
|
|
331
|
+
query.definition.asArrowQueryDefinition().sourceReference.parameters.setParameter("param", 1)
|
|
332
332
|
```
|
|
333
333
|
```
|
|
334
334
|
run: flights(param is 1) ->
|
|
@@ -339,7 +339,7 @@ run: flights(param is 1) ->
|
|
|
339
339
|
{@link ASTSourceReference.getSourceParameters}
|
|
340
340
|
|
|
341
341
|
```ts
|
|
342
|
-
query.definition.asArrowQueryDefinition().
|
|
342
|
+
query.definition.asArrowQueryDefinition().sourceReference.getSourceParameters();
|
|
343
343
|
```
|
|
344
344
|
|
|
345
345
|
## To a particular field in the query (including nests), add/edit/delete annotation
|
package/dist/query-ast.d.ts
CHANGED
|
@@ -39,234 +39,65 @@ declare abstract class ASTNode<T> {
|
|
|
39
39
|
/**
|
|
40
40
|
* @internal
|
|
41
41
|
*/
|
|
42
|
-
abstract
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
findWhereList(path: Path): ASTWhereList;
|
|
102
|
-
/**
|
|
103
|
-
* @hidden
|
|
104
|
-
*/
|
|
105
|
-
asParameterValue(): ASTParameterValue;
|
|
106
|
-
/**
|
|
107
|
-
* @hidden
|
|
108
|
-
*/
|
|
109
|
-
findParameterValue(path: Path): ASTParameterValue;
|
|
110
|
-
/**
|
|
111
|
-
* @hidden
|
|
112
|
-
*/
|
|
113
|
-
asStringLiteralValue(): ASTStringLiteralValue;
|
|
114
|
-
/**
|
|
115
|
-
* @hidden
|
|
116
|
-
*/
|
|
117
|
-
findStringLiteralValue(path: Path): ASTStringLiteralValue;
|
|
118
|
-
/**
|
|
119
|
-
* @hidden
|
|
120
|
-
*/
|
|
121
|
-
asNumberLiteralValue(): ASTNumberLiteralValue;
|
|
122
|
-
/**
|
|
123
|
-
* @hidden
|
|
124
|
-
*/
|
|
125
|
-
findNumberLiteralValue(path: Path): ASTNumberLiteralValue;
|
|
126
|
-
/**
|
|
127
|
-
* @hidden
|
|
128
|
-
*/
|
|
129
|
-
asViewOperationList(): ASTViewOperationList;
|
|
130
|
-
/**
|
|
131
|
-
* @hidden
|
|
132
|
-
*/
|
|
133
|
-
findViewOperationList(path: Path): ASTViewOperationList;
|
|
134
|
-
/**
|
|
135
|
-
* @hidden
|
|
136
|
-
*/
|
|
137
|
-
asGroupByViewOperation(): ASTGroupByViewOperation;
|
|
138
|
-
/**
|
|
139
|
-
* @hidden
|
|
140
|
-
*/
|
|
141
|
-
findGroupByViewOperation(path: Path): ASTGroupByViewOperation;
|
|
142
|
-
/**
|
|
143
|
-
* @hidden
|
|
144
|
-
*/
|
|
145
|
-
asAggregateViewOperation(): ASTAggregateViewOperation;
|
|
146
|
-
/**
|
|
147
|
-
* @hidden
|
|
148
|
-
*/
|
|
149
|
-
findAggregateViewOperation(path: Path): ASTAggregateViewOperation;
|
|
150
|
-
/**
|
|
151
|
-
* @hidden
|
|
152
|
-
*/
|
|
153
|
-
asOrderByViewOperation(): ASTOrderByViewOperation;
|
|
154
|
-
/**
|
|
155
|
-
* @hidden
|
|
156
|
-
*/
|
|
157
|
-
findOrderByViewOperation(path: Path): ASTOrderByViewOperation;
|
|
158
|
-
/**
|
|
159
|
-
* @hidden
|
|
160
|
-
*/
|
|
161
|
-
asField(): ASTField;
|
|
162
|
-
/**
|
|
163
|
-
* @hidden
|
|
164
|
-
*/
|
|
165
|
-
findField(path: Path): ASTField;
|
|
166
|
-
/**
|
|
167
|
-
* @hidden
|
|
168
|
-
*/
|
|
169
|
-
asReferenceExpression(): ASTReferenceExpression;
|
|
170
|
-
/**
|
|
171
|
-
* @hidden
|
|
172
|
-
*/
|
|
173
|
-
findReferenceExpression(path: Path): ASTReferenceExpression;
|
|
174
|
-
/**
|
|
175
|
-
* @hidden
|
|
176
|
-
*/
|
|
177
|
-
asReferenceViewDefinition(): ASTReferenceViewDefinition;
|
|
178
|
-
/**
|
|
179
|
-
* @hidden
|
|
180
|
-
*/
|
|
181
|
-
findReferenceViewDefinition(path: Path): ASTReferenceViewDefinition;
|
|
182
|
-
/**
|
|
183
|
-
* @hidden
|
|
184
|
-
*/
|
|
185
|
-
asArrowQueryDefinition(): ASTArrowQueryDefinition;
|
|
186
|
-
/**
|
|
187
|
-
* @hidden
|
|
188
|
-
*/
|
|
189
|
-
findArrowQueryDefinition(path: Path): ASTArrowQueryDefinition;
|
|
190
|
-
/**
|
|
191
|
-
* @hidden
|
|
192
|
-
*/
|
|
193
|
-
asArrowViewDefinition(): ASTArrowViewDefinition;
|
|
194
|
-
/**
|
|
195
|
-
* @hidden
|
|
196
|
-
*/
|
|
197
|
-
findArrowViewDefinition(path: Path): ASTArrowViewDefinition;
|
|
198
|
-
/**
|
|
199
|
-
* @hidden
|
|
200
|
-
*/
|
|
201
|
-
asRefinementViewDefinition(): ASTRefinementViewDefinition;
|
|
202
|
-
/**
|
|
203
|
-
* @hidden
|
|
204
|
-
*/
|
|
205
|
-
findRefinementViewDefinition(path: Path): ASTRefinementViewDefinition;
|
|
206
|
-
/**
|
|
207
|
-
* @hidden
|
|
208
|
-
*/
|
|
209
|
-
asTimeTruncationExpression(): ASTTimeTruncationExpression;
|
|
210
|
-
/**
|
|
211
|
-
* @hidden
|
|
212
|
-
*/
|
|
213
|
-
findTimeTruncationExpression(path: Path): ASTTimeTruncationExpression;
|
|
214
|
-
/**
|
|
215
|
-
* @hidden
|
|
216
|
-
*/
|
|
217
|
-
asFilteredFieldExpression(): ASTFilteredFieldExpression;
|
|
218
|
-
/**
|
|
219
|
-
* @hidden
|
|
220
|
-
*/
|
|
221
|
-
findFilteredFieldExpression(path: Path): ASTFilteredFieldExpression;
|
|
222
|
-
/**
|
|
223
|
-
* @hidden
|
|
224
|
-
*/
|
|
225
|
-
asNestViewOperation(): ASTNestViewOperation;
|
|
226
|
-
/**
|
|
227
|
-
* @hidden
|
|
228
|
-
*/
|
|
229
|
-
findNestViewOperation(path: Path): ASTNestViewOperation;
|
|
230
|
-
/**
|
|
231
|
-
* @hidden
|
|
232
|
-
*/
|
|
233
|
-
asView(): ASTView;
|
|
234
|
-
/**
|
|
235
|
-
* @hidden
|
|
236
|
-
*/
|
|
237
|
-
findView(path: Path): ASTView;
|
|
238
|
-
/**
|
|
239
|
-
* @hidden
|
|
240
|
-
*/
|
|
241
|
-
asSegmentViewDefinition(): ASTSegmentViewDefinition;
|
|
242
|
-
/**
|
|
243
|
-
* @hidden
|
|
244
|
-
*/
|
|
245
|
-
findSegmentViewDefinition(path: Path): ASTSegmentViewDefinition;
|
|
246
|
-
/**
|
|
247
|
-
* @hidden
|
|
248
|
-
*/
|
|
249
|
-
asLimitViewOperation(): ASTLimitViewOperation;
|
|
250
|
-
/**
|
|
251
|
-
* @hidden
|
|
252
|
-
*/
|
|
253
|
-
findLimitViewOperation(path: Path): ASTLimitViewOperation;
|
|
254
|
-
/**
|
|
255
|
-
* @hidden
|
|
256
|
-
*/
|
|
257
|
-
asAnnotationList(): ASTAnnotationList;
|
|
258
|
-
/**
|
|
259
|
-
* @hidden
|
|
260
|
-
*/
|
|
261
|
-
findAnnotationList(path: Path): ASTAnnotationList;
|
|
262
|
-
/**
|
|
263
|
-
* @hidden
|
|
264
|
-
*/
|
|
265
|
-
asAnnotation(): ASTAnnotation;
|
|
266
|
-
/**
|
|
267
|
-
* @hidden
|
|
268
|
-
*/
|
|
269
|
-
findAnnotation(path: Path): ASTAnnotation;
|
|
42
|
+
abstract findAny(path: Path): ASTAny;
|
|
43
|
+
get as(): {
|
|
44
|
+
Query(): ASTQuery;
|
|
45
|
+
Reference(): ASTReference;
|
|
46
|
+
SourceReference(): ASTSourceReference;
|
|
47
|
+
ParameterValueList(): ASTParameterValueList;
|
|
48
|
+
Where(): ASTWhere;
|
|
49
|
+
WhereList(): ASTWhereList;
|
|
50
|
+
ParameterValue(): ASTParameterValue;
|
|
51
|
+
StringLiteralValue(): ASTStringLiteralValue;
|
|
52
|
+
NumberLiteralValue(): ASTNumberLiteralValue;
|
|
53
|
+
ViewOperationList(): ASTViewOperationList;
|
|
54
|
+
GroupByViewOperation(): ASTGroupByViewOperation;
|
|
55
|
+
AggregateViewOperation(): ASTAggregateViewOperation;
|
|
56
|
+
OrderByViewOperation(): ASTOrderByViewOperation;
|
|
57
|
+
Field(): ASTField;
|
|
58
|
+
ReferenceExpression(): ASTReferenceExpression;
|
|
59
|
+
ReferenceViewDefinition(): ASTReferenceViewDefinition;
|
|
60
|
+
ArrowQueryDefinition(): ASTArrowQueryDefinition;
|
|
61
|
+
ArrowViewDefinition(): ASTArrowViewDefinition;
|
|
62
|
+
RefinementViewDefinition(): ASTRefinementViewDefinition;
|
|
63
|
+
TimeTruncationExpression(): ASTTimeTruncationExpression;
|
|
64
|
+
FilteredFieldExpression(): ASTFilteredFieldExpression;
|
|
65
|
+
NestViewOperation(): ASTNestViewOperation;
|
|
66
|
+
View(): ASTView;
|
|
67
|
+
SegmentViewDefinition(): ASTSegmentViewDefinition;
|
|
68
|
+
LimitViewOperation(): ASTLimitViewOperation;
|
|
69
|
+
AnnotationList(): ASTAnnotationList;
|
|
70
|
+
Annotation(): ASTAnnotation;
|
|
71
|
+
};
|
|
72
|
+
get find(): {
|
|
73
|
+
Query(path: Path): ASTQuery;
|
|
74
|
+
Reference(path: Path): ASTReference;
|
|
75
|
+
SourceReference(path: Path): ASTSourceReference;
|
|
76
|
+
ParameterValueList(path: Path): ASTParameterValueList;
|
|
77
|
+
Where(path: Path): ASTWhere;
|
|
78
|
+
WhereList(path: Path): ASTWhereList;
|
|
79
|
+
ParameterValue(path: Path): ASTParameterValue;
|
|
80
|
+
StringLiteralValue(path: Path): ASTStringLiteralValue;
|
|
81
|
+
NumberLiteralValue(path: Path): ASTNumberLiteralValue;
|
|
82
|
+
ViewOperationList(path: Path): ASTViewOperationList;
|
|
83
|
+
GroupByViewOperation(path: Path): ASTGroupByViewOperation;
|
|
84
|
+
AggregateViewOperation(path: Path): ASTAggregateViewOperation;
|
|
85
|
+
OrderByViewOperation(path: Path): ASTOrderByViewOperation;
|
|
86
|
+
Field(path: Path): ASTField;
|
|
87
|
+
ReferenceExpression(path: Path): ASTReferenceExpression;
|
|
88
|
+
ReferenceViewDefinition(path: Path): ASTReferenceViewDefinition;
|
|
89
|
+
ArrowQueryDefinition(path: Path): ASTArrowQueryDefinition;
|
|
90
|
+
ArrowViewDefinition(path: Path): ASTArrowViewDefinition;
|
|
91
|
+
RefinementViewDefinition(path: Path): ASTRefinementViewDefinition;
|
|
92
|
+
TimeTruncationExpression(path: Path): ASTTimeTruncationExpression;
|
|
93
|
+
FilteredFieldExpression(path: Path): ASTFilteredFieldExpression;
|
|
94
|
+
NestViewOperation(path: Path): ASTNestViewOperation;
|
|
95
|
+
View(path: Path): ASTView;
|
|
96
|
+
SegmentViewDefinition(path: Path): ASTSegmentViewDefinition;
|
|
97
|
+
LimitViewOperation(path: Path): ASTLimitViewOperation;
|
|
98
|
+
AnnotationList(path: Path): ASTAnnotationList;
|
|
99
|
+
Annotation(path: Path): ASTAnnotation;
|
|
100
|
+
};
|
|
270
101
|
/**
|
|
271
102
|
* @internal
|
|
272
103
|
*/
|
|
@@ -287,6 +118,8 @@ declare abstract class ASTNode<T> {
|
|
|
287
118
|
* @internal
|
|
288
119
|
*/
|
|
289
120
|
static schemaMerge(a: Malloy.Schema, b: Malloy.Schema): Malloy.Schema;
|
|
121
|
+
static tagFor(a: Malloy.FieldInfo, prefix?: string): Tag;
|
|
122
|
+
static fieldWasCalculation(a: Malloy.FieldInfo): boolean;
|
|
290
123
|
}
|
|
291
124
|
declare abstract class ASTListNode<T, N extends ASTNode<T> = ASTNode<T>> extends ASTNode<T[]> {
|
|
292
125
|
protected node: T[];
|
|
@@ -322,7 +155,7 @@ declare abstract class ASTListNode<T, N extends ASTNode<T> = ASTNode<T>> extends
|
|
|
322
155
|
/**
|
|
323
156
|
* @internal
|
|
324
157
|
*/
|
|
325
|
-
|
|
158
|
+
findAny(path: Path): ASTAny;
|
|
326
159
|
/**
|
|
327
160
|
* @internal
|
|
328
161
|
*/
|
|
@@ -343,7 +176,7 @@ declare abstract class ASTObjectNode<T, Children extends ASTChildren<T>> extends
|
|
|
343
176
|
/**
|
|
344
177
|
* @internal
|
|
345
178
|
*/
|
|
346
|
-
|
|
179
|
+
findAny(path: Path): ASTAny;
|
|
347
180
|
}
|
|
348
181
|
/**
|
|
349
182
|
* AST Object to represent the whole query AST.
|
|
@@ -555,6 +388,7 @@ export declare class ASTFieldReference extends ASTReference {
|
|
|
555
388
|
* @internal
|
|
556
389
|
*/
|
|
557
390
|
get segment(): ASTSegmentViewDefinition;
|
|
391
|
+
private getReferenceSchema;
|
|
558
392
|
getFieldInfo(): Malloy.FieldInfo;
|
|
559
393
|
}
|
|
560
394
|
export declare class ASTSourceReference extends ASTReference {
|
|
@@ -643,7 +477,7 @@ export declare class ASTUnimplemented<T> extends ASTNode<T> {
|
|
|
643
477
|
constructor(node: T);
|
|
644
478
|
get treeEdited(): boolean;
|
|
645
479
|
build(): T;
|
|
646
|
-
|
|
480
|
+
findAny(): never;
|
|
647
481
|
}
|
|
648
482
|
export interface IASTQueryOrViewDefinition {
|
|
649
483
|
/**
|
|
@@ -927,7 +761,7 @@ export declare class ASTSegmentViewDefinition extends ASTObjectNode<Malloy.ViewD
|
|
|
927
761
|
* @param name The name of the field to order by.
|
|
928
762
|
* @param direction The order by direction (ascending or descending).
|
|
929
763
|
*/
|
|
930
|
-
addOrderBy(name: string, direction?: Malloy.OrderByDirection):
|
|
764
|
+
addOrderBy(name: string, direction?: Malloy.OrderByDirection): ASTOrderByViewOperation;
|
|
931
765
|
/**
|
|
932
766
|
* Adds an empty nest to this segment, with the given name.
|
|
933
767
|
* @param name The name of the new nest.
|