@malloydata/malloy-query-builder 0.0.237-dev250225144145

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.
@@ -0,0 +1,1100 @@
1
+ import * as Malloy from "@malloydata/malloy-interfaces";
2
+ import { Tag, TagSetValue } from "@malloydata/malloy-tag";
3
+ import * as Filter from "@malloydata/malloy-filter";
4
+ export type ParsedFilter =
5
+ | { kind"string", clausesFilter.StringClause[], ... }
6
+ | { kind"number", clausesFilter.NumberClause[], ... }
7
+ | { kind"boolean", clausesFilter.BooleanClause[], ... }
8
+ | { kind"date", clausesFilter.DateClause[], ... };
9
+ export type PathSegment = number | string;
10
+ export type Path = PathSegment[];
11
+ type ASTAny = ASTNode<mixed>;
12
+ type ASTChildren<T> = { [Key in keyof T]: LiteralOrNode<T[Key]> };
13
+ type NonOptionalASTNode<T> = T extends void ? empty : ASTNode<T>;
14
+ type LiteralOrNode<T> = T extends string
15
+ ? T
16
+ : T extends number
17
+ ? T
18
+ : T extends string[]
19
+ ? T
20
+ : T extends boolean
21
+ ? T
22
+ : void extends T
23
+ ? NonOptionalASTNode<T> | void
24
+ : ASTNode<T>;
25
+ declare class ASTNode<T> {
26
+ editedboolean;
27
+ _parentASTAny | void;
28
+ build(): T;
29
+ edit(): this;
30
+ find(path: Path): ASTAny;
31
+ asQuery(): ASTQuery;
32
+ findQuery(path: Path): ASTQuery;
33
+ asReference(): ASTReference;
34
+ findReference(path: Path): ASTReference;
35
+ asSourceReference(): ASTSourceReference;
36
+ findSourceReference(path: Path): ASTSourceReference;
37
+ asParameterValueList(): ASTParameterValueList;
38
+ findParameterValueList(path: Path): ASTParameterValueList;
39
+ asWhere(): ASTWhere;
40
+ findWhere(path: Path): ASTWhere;
41
+ asWhereList(): ASTWhereList;
42
+ findWhereList(path: Path): ASTWhereList;
43
+ asParameterValue(): ASTParameterValue;
44
+ findParameterValue(path: Path): ASTParameterValue;
45
+ asStringLiteralValue(): ASTStringLiteralValue;
46
+ findStringLiteralValue(path: Path): ASTStringLiteralValue;
47
+ asNumberLiteralValue(): ASTNumberLiteralValue;
48
+ findNumberLiteralValue(path: Path): ASTNumberLiteralValue;
49
+ asViewOperationList(): ASTViewOperationList;
50
+ findViewOperationList(path: Path): ASTViewOperationList;
51
+ asGroupByViewOperation(): ASTGroupByViewOperation;
52
+ findGroupByViewOperation(path: Path): ASTGroupByViewOperation;
53
+ asAggregateViewOperation(): ASTAggregateViewOperation;
54
+ findAggregateViewOperation(path: Path): ASTAggregateViewOperation;
55
+ asOrderByViewOperation(): ASTOrderByViewOperation;
56
+ findOrderByViewOperation(path: Path): ASTOrderByViewOperation;
57
+ asField(): ASTField;
58
+ findField(path: Path): ASTField;
59
+ asReferenceExpression(): ASTReferenceExpression;
60
+ findReferenceExpression(path: Path): ASTReferenceExpression;
61
+ asReferenceViewDefinition(): ASTReferenceViewDefinition;
62
+ findReferenceViewDefinition(path: Path): ASTReferenceViewDefinition;
63
+ asArrowQueryDefinition(): ASTArrowQueryDefinition;
64
+ findArrowQueryDefinition(path: Path): ASTArrowQueryDefinition;
65
+ asArrowViewDefinition(): ASTArrowViewDefinition;
66
+ findArrowViewDefinition(path: Path): ASTArrowViewDefinition;
67
+ asRefinementViewDefinition(): ASTRefinementViewDefinition;
68
+ findRefinementViewDefinition(path: Path): ASTRefinementViewDefinition;
69
+ asTimeTruncationExpression(): ASTTimeTruncationExpression;
70
+ findTimeTruncationExpression(path: Path): ASTTimeTruncationExpression;
71
+ asFilteredFieldExpression(): ASTFilteredFieldExpression;
72
+ findFilteredFieldExpression(path: Path): ASTFilteredFieldExpression;
73
+ asNestViewOperation(): ASTNestViewOperation;
74
+ findNestViewOperation(path: Path): ASTNestViewOperation;
75
+ asView(): ASTView;
76
+ findView(path: Path): ASTView;
77
+ asSegmentViewDefinition(): ASTSegmentViewDefinition;
78
+ findSegmentViewDefinition(path: Path): ASTSegmentViewDefinition;
79
+ asLimitViewOperation(): ASTLimitViewOperation;
80
+ findLimitViewOperation(path: Path): ASTLimitViewOperation;
81
+ asAnnotationList(): ASTAnnotationList;
82
+ findAnnotationList(path: Path): ASTAnnotationList;
83
+ asAnnotation(): ASTAnnotation;
84
+ findAnnotation(path: Path): ASTAnnotation;
85
+ get parent(): ASTAny;
86
+ set parent(parent: ASTAny): void;
87
+ schemaTryGet(
88
+ schema: Malloy.Schema,
89
+ name: string,
90
+ path: string[] | void,
91
+ ): Malloy.FieldInfo | void;
92
+ schemaGet(
93
+ schema: Malloy.Schema,
94
+ name: string,
95
+ path: string[] | void,
96
+ ): Malloy.FieldInfo;
97
+ schemaMerge(a: Malloy.Schema, b: Malloy.Schema): Malloy.Schema;
98
+ }
99
+ declare class ASTListNode<T, N: ASTNode<T> = ASTNode<T>> extends ASTNode<T[]> {
100
+ nodeT[];
101
+ childrenN[];
102
+ originalChildrenN[];
103
+ constructor(node: T[], children: N[]): void;
104
+ iter(): Generator<N, void, mixed>;
105
+ get length(): number;
106
+ get last(): N;
107
+ index(i: number): N;
108
+ insert(n: N, index: number): void;
109
+ add(n: N): void;
110
+ remove(n: N): this | void;
111
+ build(): T[];
112
+ find(path: Path): ASTAny;
113
+ findIndex(predicate: (n: N) => boolean): number;
114
+ indexOf(n: N): number;
115
+ }
116
+ declare class ASTObjectNode<T, Children: ASTChildren<T>> extends ASTNode<T> {
117
+ nodeT;
118
+ childrenChildren;
119
+ constructor(node: T, children: Children): void;
120
+ build(): T;
121
+ find(path: Path): ASTAny;
122
+ }
123
+ declare export class ASTQuery
124
+ extends
125
+ ASTObjectNode<
126
+ Malloy.Query,
127
+ { definitionASTQueryDefinition, annotations?ASTAnnotationList, ... },
128
+ >
129
+ implements IASTAnnotatable
130
+ {
131
+ modelMalloy.ModelInfo;
132
+ constructor(options: {
133
+ query?Malloy.Query,
134
+ source
135
+ | Malloy.ModelEntryValueWithSource
136
+ | Malloy.ModelEntryValueWithQuery
137
+ | Malloy.SourceInfo
138
+ | Malloy.QueryInfo,
139
+ ...
140
+ }): void;
141
+ constructor(options: {
142
+ query?Malloy.Query,
143
+ modelMalloy.ModelInfo,
144
+ ...
145
+ }): void;
146
+ get definition(): ASTQueryDefinition;
147
+ set definition(definition: ASTQueryDefinition): void;
148
+ get annotations(): ASTAnnotationList | void;
149
+ reorderFields(names: string[]): void;
150
+ getOrAddAnnotations(): ASTAnnotationList;
151
+ getInheritedTag(prefix?: RegExp | string): Tag;
152
+ getIntrinsicTag(prefix?: RegExp | string): Tag;
153
+ getTag(prefix?: RegExp | string): Tag;
154
+ setTagProperty(path: Path, value?: TagSetValue, prefix?: string): void;
155
+ removeTagProperty(path: Path, prefix?: string): void;
156
+ setViewToEmptySegment(): ASTSegmentViewDefinition;
157
+ isRunnable(): boolean;
158
+ getOrAddDefaultSegment(): ASTSegmentViewDefinition;
159
+ setSource(name: string): void;
160
+ setQueryHead(name: string): void;
161
+ getQueryInfo(name: string): Malloy.QueryInfo;
162
+ toMalloy(): string;
163
+ build(): Malloy.Query;
164
+ setView(name: string): ASTReferenceViewDefinition;
165
+ getInheritedAnnotations(): Malloy.Annotation[];
166
+ }
167
+ export type RawLiteralValue =
168
+ | number
169
+ | string
170
+ | { dateDate, granularityMalloy.TimestampTimeframe, ... }
171
+ | boolean
172
+ | null;
173
+ declare export interface IASTReference extends ASTAny {
174
+ getOrAddParameters(): ASTParameterValueList;
175
+ setParameter(name: string, value: RawLiteralValue): void;
176
+ tryGetParameter(name: string): ASTParameterValue | void;
177
+ parametersASTParameterValueList | void;
178
+ namestring;
179
+ pathstring[] | void;
180
+ }
181
+ declare export class ASTReference
182
+ extends
183
+ ASTObjectNode<
184
+ Malloy.Reference,
185
+ { namestring, path?string[], parameters?ASTParameterValueList, ... },
186
+ >
187
+ implements IASTReference
188
+ {
189
+ referenceMalloy.Reference;
190
+ constructor(reference: Malloy.Reference): void;
191
+ get name(): string;
192
+ set name(value: string): void;
193
+ get parameters(): ASTParameterValueList | void;
194
+ set parameters(parameters: ASTParameterValueList | void): void;
195
+ get path(): string[] | void;
196
+ getOrAddParameters(reference: IASTReference): ASTParameterValueList;
197
+ setParameter(
198
+ reference: IASTReference,
199
+ name: string,
200
+ value: RawLiteralValue,
201
+ ): void;
202
+ tryGetParameter(
203
+ reference: IASTReference,
204
+ name: string,
205
+ ): ASTParameterValue | void;
206
+ getOrAddParameters(): any;
207
+ setParameter(name: string, value: RawLiteralValue): void;
208
+ tryGetParameter(name: string): ASTParameterValue | void;
209
+ }
210
+ declare export class ASTFieldReference extends ASTReference {
211
+ get segment(): ASTSegmentViewDefinition;
212
+ getFieldInfo(): Malloy.FieldInfo;
213
+ }
214
+ declare export class ASTSourceReference extends ASTReference {
215
+ get query(): ASTQuery;
216
+ getSourceInfo(): Malloy.SourceInfo;
217
+ getSourceParameters(): Malloy.ParameterInfo[];
218
+ areRequiredParametersSet(): boolean;
219
+ }
220
+ declare export class ASTParameterValueList
221
+ extends ASTListNode<Malloy.ParameterValue, ASTParameterValue>
222
+ {
223
+ constructor(parameters: Malloy.ParameterValue[]): void;
224
+ get parameters(): ASTParameterValue[];
225
+ addParameter(name: string, value: RawLiteralValue): void;
226
+ }
227
+ declare export class ASTParameterValue
228
+ extends
229
+ ASTObjectNode<
230
+ Malloy.ParameterValue,
231
+ { namestring, valueASTLiteralValue, ... },
232
+ >
233
+ {
234
+ parameterMalloy.ParameterValue;
235
+ constructor(parameter: Malloy.ParameterValue): void;
236
+ get name(): string;
237
+ }
238
+ export type ASTLiteralValue =
239
+ | ASTStringLiteralValue
240
+ | ASTNumberLiteralValue
241
+ | ASTBooleanLiteralValue
242
+ | ASTDateLiteralValue
243
+ | ASTTimestampLiteralValue
244
+ | ASTNullLiteralValue;
245
+ declare export const LiteralValueAST: {
246
+ from(
247
+ value: Malloy.LiteralValue,
248
+ ):
249
+ | ASTStringLiteralValue
250
+ | ASTNumberLiteralValue
251
+ | ASTBooleanLiteralValue
252
+ | ASTDateLiteralValue
253
+ | ASTTimestampLiteralValue
254
+ | ASTNullLiteralValue,
255
+ makeLiteral(value: RawLiteralValue): Malloy.LiteralValue,
256
+ ...
257
+ };
258
+ declare export class ASTStringLiteralValue
259
+ extends
260
+ ASTObjectNode<
261
+ Malloy.LiteralValueWithStringLiteral,
262
+ { kind"string_literal", string_valuestring, ... },
263
+ >
264
+ {
265
+ nodeMalloy.LiteralValueWithStringLiteral;
266
+ +kindMalloy.LiteralValueType;
267
+ constructor(node: Malloy.LiteralValueWithStringLiteral): void;
268
+ }
269
+ declare export class ASTNullLiteralValue
270
+ extends
271
+ ASTObjectNode<
272
+ Malloy.LiteralValueWithNullLiteral,
273
+ { kind"null_literal", ... },
274
+ >
275
+ {
276
+ nodeMalloy.LiteralValueWithNullLiteral;
277
+ +kindMalloy.LiteralValueType;
278
+ constructor(node: Malloy.LiteralValueWithNullLiteral): void;
279
+ }
280
+ declare export class ASTNumberLiteralValue
281
+ extends
282
+ ASTObjectNode<
283
+ Malloy.LiteralValueWithNumberLiteral,
284
+ { kind"number_literal", number_valuenumber, ... },
285
+ >
286
+ {
287
+ nodeMalloy.LiteralValueWithNumberLiteral;
288
+ +kindMalloy.LiteralValueType;
289
+ constructor(node: Malloy.LiteralValueWithNumberLiteral): void;
290
+ }
291
+ declare export class ASTBooleanLiteralValue
292
+ extends
293
+ ASTObjectNode<
294
+ Malloy.LiteralValueWithBooleanLiteral,
295
+ { kind"boolean_literal", boolean_valueboolean, ... },
296
+ >
297
+ {
298
+ nodeMalloy.LiteralValueWithBooleanLiteral;
299
+ +kindMalloy.LiteralValueType;
300
+ constructor(node: Malloy.LiteralValueWithBooleanLiteral): void;
301
+ }
302
+ declare export class ASTDateLiteralValue
303
+ extends
304
+ ASTObjectNode<
305
+ Malloy.LiteralValueWithDateLiteral,
306
+ {
307
+ kind"date_literal",
308
+ date_valuestring,
309
+ granularity?Malloy.DateTimeframe,
310
+ ...
311
+ },
312
+ >
313
+ {
314
+ nodeMalloy.LiteralValueWithDateLiteral;
315
+ +kindMalloy.LiteralValueType;
316
+ constructor(node: Malloy.LiteralValueWithDateLiteral): void;
317
+ }
318
+ declare export class ASTTimestampLiteralValue
319
+ extends
320
+ ASTObjectNode<
321
+ Malloy.LiteralValueWithTimestampLiteral,
322
+ {
323
+ kind"timestamp_literal",
324
+ timestamp_valuestring,
325
+ granularity?Malloy.TimestampTimeframe,
326
+ ...
327
+ },
328
+ >
329
+ {
330
+ nodeMalloy.LiteralValueWithTimestampLiteral;
331
+ +kindMalloy.LiteralValueType;
332
+ constructor(node: Malloy.LiteralValueWithTimestampLiteral): void;
333
+ }
334
+ declare export class ASTUnimplemented<T> extends ASTNode<T> {
335
+ +nodeany;
336
+ constructor(node: T): void;
337
+ get treeEdited(): boolean;
338
+ build(): T;
339
+ find(): empty;
340
+ }
341
+ declare export interface IASTQueryOrViewDefinition {
342
+ propagateUp(f: PropagationFunction): void;
343
+ propagateDown(f: PropagationFunction): void;
344
+ }
345
+ type PropagationFunction = (propagatable: IASTQueryOrViewDefinition) => void;
346
+ declare export interface IASTQueryDefinition extends IASTQueryOrViewDefinition {
347
+ getOrAddDefaultSegment(): ASTSegmentViewDefinition;
348
+ reorderFields(names: string[]): void;
349
+ isRunnable(): boolean;
350
+ }
351
+ export type ASTQueryDefinition =
352
+ | ASTReferenceQueryDefinition
353
+ | ASTArrowQueryDefinition
354
+ | ASTRefinementQueryDefinition;
355
+ declare export const ASTQueryDefinition: {
356
+ from(
357
+ definition: Malloy.QueryDefinition,
358
+ ):
359
+ | ASTArrowQueryDefinition
360
+ | ASTReferenceQueryDefinition
361
+ | ASTRefinementQueryDefinition,
362
+ ...
363
+ };
364
+ declare export class ASTArrowQueryDefinition
365
+ extends
366
+ ASTObjectNode<
367
+ Malloy.QueryDefinitionWithArrow,
368
+ {
369
+ kind"arrow",
370
+ source_referenceASTSourceReference,
371
+ viewASTViewDefinition,
372
+ ...
373
+ },
374
+ >
375
+ implements IASTQueryDefinition
376
+ {
377
+ nodeMalloy.QueryDefinitionWithArrow;
378
+ constructor(node: Malloy.QueryDefinitionWithArrow): void;
379
+ get view(): ASTViewDefinition;
380
+ set view(view: ASTViewDefinition): void;
381
+ get sourceReference(): ASTSourceReference;
382
+ getOrAddDefaultSegment(): ASTSegmentViewDefinition;
383
+ getSourceInfo(): Malloy.SourceInfo;
384
+ getOutputSchema(): Malloy.Schema;
385
+ isRunnable(): boolean;
386
+ get query(): ASTQuery;
387
+ propagateUp(f: PropagationFunction): void;
388
+ propagateDown(f: PropagationFunction): void;
389
+ reorderFields(names: string[]): void;
390
+ }
391
+ declare export class ASTRefinementQueryDefinition
392
+ extends
393
+ ASTObjectNode<
394
+ Malloy.QueryDefinitionWithRefinement,
395
+ {
396
+ kind"refinement",
397
+ query_referenceASTReference,
398
+ refinementASTViewDefinition,
399
+ ...
400
+ },
401
+ >
402
+ implements IASTQueryDefinition
403
+ {
404
+ nodeMalloy.QueryDefinitionWithRefinement;
405
+ constructor(node: Malloy.QueryDefinitionWithRefinement): void;
406
+ get queryReference(): ASTReference;
407
+ get refinement(): ASTViewDefinition;
408
+ set refinement(refinement: ASTViewDefinition): void;
409
+ isRunnable(): boolean;
410
+ get query(): ASTQuery;
411
+ getOrAddDefaultSegment(): ASTSegmentViewDefinition;
412
+ getOutputSchema(): Malloy.Schema;
413
+ propagateUp(f: PropagationFunction): void;
414
+ propagateDown(f: PropagationFunction): void;
415
+ reorderFields(names: string[]): void;
416
+ }
417
+ declare export class ASTReferenceQueryDefinition
418
+ extends
419
+ ASTObjectNode<
420
+ Malloy.QueryDefinitionWithQueryReference,
421
+ {
422
+ kind"query_reference",
423
+ namestring,
424
+ path?string[],
425
+ parameters?ASTParameterValueList,
426
+ ...
427
+ },
428
+ >
429
+ implements IASTQueryDefinition, IASTReference
430
+ {
431
+ nodeMalloy.QueryDefinitionWithQueryReference;
432
+ constructor(node: Malloy.QueryDefinitionWithQueryReference): void;
433
+ isRunnable(): boolean;
434
+ get name(): string;
435
+ get query(): ASTQuery;
436
+ get parameters(): ASTParameterValueList | void;
437
+ set parameters(parameters: ASTParameterValueList | void): void;
438
+ get path(): string[] | void;
439
+ getOrAddDefaultSegment(): ASTSegmentViewDefinition;
440
+ propagateUp(_f: PropagationFunction): void;
441
+ propagateDown(_f: PropagationFunction): void;
442
+ reorderFields(names: string[]): void;
443
+ getOrAddParameters(): any;
444
+ setParameter(name: string, value: RawLiteralValue): void;
445
+ tryGetParameter(name: string): ASTParameterValue | void;
446
+ }
447
+ declare export interface IASTViewDefinition extends IASTQueryOrViewDefinition {
448
+ isRunnable(): boolean;
449
+ getOrAddDefaultSegment(): ASTSegmentViewDefinition;
450
+ getInputSchema(): Malloy.Schema;
451
+ getOutputSchema(): Malloy.Schema;
452
+ getImplicitName(): string | void;
453
+ getRefinementSchema(): Malloy.Schema;
454
+ addEmptyRefinement(): ASTSegmentViewDefinition;
455
+ addViewRefinement(name: string, path?: string[]): ASTReferenceViewDefinition;
456
+ isValidViewRefinement(
457
+ name: string,
458
+ path?: string[],
459
+ ): { isValidViewRefinementboolean, error?string, ... };
460
+ getInheritedAnnotations(): Malloy.Annotation[];
461
+ }
462
+ export type ASTViewDefinition =
463
+ | ASTArrowViewDefinition
464
+ | ASTRefinementViewDefinition
465
+ | ASTSegmentViewDefinition
466
+ | ASTReferenceViewDefinition;
467
+ declare export class ASTReferenceViewDefinition
468
+ extends
469
+ ASTObjectNode<
470
+ Malloy.ViewDefinitionWithViewReference,
471
+ {
472
+ kind"view_reference",
473
+ namestring,
474
+ path?string[],
475
+ parameters?ASTParameterValueList,
476
+ ...
477
+ },
478
+ >
479
+ implements IASTViewDefinition, IASTReference
480
+ {
481
+ nodeMalloy.ViewDefinitionWithViewReference;
482
+ constructor(node: Malloy.ViewDefinitionWithViewReference): void;
483
+ isRunnable(): boolean;
484
+ get name(): string;
485
+ get path(): string[] | void;
486
+ get parameters(): ASTParameterValueList | void;
487
+ set parameters(parameters: ASTParameterValueList | void): void;
488
+ getOrAddDefaultSegment(): ASTSegmentViewDefinition;
489
+ addEmptyRefinement(): ASTSegmentViewDefinition;
490
+ addViewRefinement(name: string, path?: string[]): ASTReferenceViewDefinition;
491
+ isValidViewRefinement(
492
+ name: string,
493
+ path?: string[],
494
+ ): { isValidViewRefinementboolean, error?string, ... };
495
+ getInputSchema(): Malloy.Schema;
496
+ getOutputSchema(): Malloy.Schema;
497
+ getImplicitName(): string | void;
498
+ getViewInfo(): Malloy.FieldInfoWithView;
499
+ getRefinementSchema(): Malloy.Schema;
500
+ propagateUp(f: PropagationFunction): void;
501
+ propagateDown(_f: PropagationFunction): void;
502
+ getInheritedAnnotations(): Malloy.Annotation[];
503
+ getOrAddParameters(): any;
504
+ setParameter(name: string, value: RawLiteralValue): void;
505
+ tryGetParameter(name: string): ASTParameterValue | void;
506
+ }
507
+ declare export class ASTArrowViewDefinition
508
+ extends
509
+ ASTObjectNode<
510
+ Malloy.ViewDefinitionWithArrow,
511
+ { kind"arrow", sourceASTViewDefinition, viewASTViewDefinition, ... },
512
+ >
513
+ implements IASTViewDefinition
514
+ {
515
+ nodeMalloy.ViewDefinitionWithArrow;
516
+ constructor(node: Malloy.ViewDefinitionWithArrow): void;
517
+ isRunnable(): boolean;
518
+ get source(): ASTViewDefinition;
519
+ set source(source: ASTViewDefinition): void;
520
+ get view(): ASTViewDefinition;
521
+ set view(view: ASTViewDefinition): void;
522
+ getOrAddDefaultSegment(): ASTSegmentViewDefinition;
523
+ addEmptyRefinement(): ASTSegmentViewDefinition;
524
+ addViewRefinement(name: string, path?: string[]): ASTReferenceViewDefinition;
525
+ getInputSchema(): Malloy.Schema;
526
+ getOutputSchema(): Malloy.Schema;
527
+ getImplicitName(): string | void;
528
+ getRefinementSchema(): Malloy.Schema;
529
+ isValidViewRefinement(
530
+ name: string,
531
+ path?: string[],
532
+ ): { isValidViewRefinementboolean, error?string, ... };
533
+ propagateUp(f: PropagationFunction): void;
534
+ propagateDown(f: PropagationFunction): void;
535
+ getInheritedAnnotations(): Malloy.Annotation[];
536
+ }
537
+ declare export class ASTRefinementViewDefinition
538
+ extends
539
+ ASTObjectNode<
540
+ Malloy.ViewDefinitionWithRefinement,
541
+ {
542
+ kind"refinement",
543
+ baseASTViewDefinition,
544
+ refinementASTViewDefinition,
545
+ ...
546
+ },
547
+ >
548
+ implements IASTViewDefinition
549
+ {
550
+ nodeMalloy.ViewDefinitionWithRefinement;
551
+ constructor(node: Malloy.ViewDefinitionWithRefinement): void;
552
+ isRunnable(): boolean;
553
+ get refinement(): ASTViewDefinition;
554
+ set refinement(refinement: ASTViewDefinition): void;
555
+ get base(): ASTViewDefinition;
556
+ set base(base: ASTViewDefinition): void;
557
+ getOrAddDefaultSegment(): ASTSegmentViewDefinition;
558
+ addEmptyRefinement(): ASTSegmentViewDefinition;
559
+ addViewRefinement(name: string, path?: string[]): ASTReferenceViewDefinition;
560
+ getInputSchema(): Malloy.Schema;
561
+ getOutputSchema(): Malloy.Schema;
562
+ getRefinementSchema(): Malloy.Schema;
563
+ getImplicitName(): string | void;
564
+ isValidViewRefinement(
565
+ name: string,
566
+ path?: string[],
567
+ ): { isValidViewRefinementboolean, error?string, ... };
568
+ propagateUp(f: PropagationFunction): void;
569
+ propagateDown(f: PropagationFunction): void;
570
+ getInheritedAnnotations(): Malloy.Annotation[];
571
+ viewRefinementOf(
572
+ view: Malloy.ViewDefinition,
573
+ name: string,
574
+ path?: string[],
575
+ ): ASTRefinementViewDefinition;
576
+ segmentRefinementOf(view: Malloy.ViewDefinition): ASTRefinementViewDefinition;
577
+ }
578
+ declare export class ASTSegmentViewDefinition
579
+ extends
580
+ ASTObjectNode<
581
+ Malloy.ViewDefinitionWithSegment,
582
+ { kind"segment", operationsASTViewOperationList, ... },
583
+ >
584
+ implements IASTViewDefinition
585
+ {
586
+ nodeMalloy.ViewDefinitionWithSegment;
587
+ constructor(node: Malloy.ViewDefinitionWithSegment): void;
588
+ isRunnable(): boolean;
589
+ get operations(): ASTViewOperationList;
590
+ renameOrderBys(oldName: string, newName: string): void;
591
+ propagateUp(f: PropagationFunction): void;
592
+ propagateDown(_f: PropagationFunction): void;
593
+ removeOrderBys(name: string): void;
594
+ reorderFields(names: string[]): void;
595
+ renameField(
596
+ field:
597
+ | ASTAggregateViewOperation
598
+ | ASTGroupByViewOperation
599
+ | ASTNestViewOperation,
600
+ name: string,
601
+ ): void;
602
+ addOrderBy(name: string, direction?: Malloy.OrderByDirection): void;
603
+ addEmptyNest(name: string): ASTNestViewOperation;
604
+ firstIndexOfOperationTypeany;
605
+ DEFAULT_INSERTION_ORDERany;
606
+ findInsertionPointany;
607
+ getFieldNamed(
608
+ name: string,
609
+ ):
610
+ | ASTGroupByViewOperation
611
+ | ASTAggregateViewOperation
612
+ | ASTNestViewOperation
613
+ | void;
614
+ hasFieldNamed(name: string): boolean;
615
+ hasField(name: string, path?: string[]): boolean;
616
+ getField(
617
+ name: string,
618
+ path?: string[],
619
+ ): ASTGroupByViewOperation | ASTAggregateViewOperation | ASTNestViewOperation;
620
+ tryGetField(
621
+ name: string,
622
+ path?: string[],
623
+ ):
624
+ | ASTGroupByViewOperation
625
+ | ASTAggregateViewOperation
626
+ | ASTNestViewOperation
627
+ | void;
628
+ tryGetFieldNamed(
629
+ name: string,
630
+ ):
631
+ | ASTGroupByViewOperation
632
+ | ASTAggregateViewOperation
633
+ | ASTNestViewOperation
634
+ | void;
635
+ getGroupBy(name: string): ASTGroupByViewOperation | void;
636
+ removeGroupBy(name: string): this;
637
+ addGroupBy(
638
+ name: string,
639
+ path?: string[],
640
+ rename?: string,
641
+ ): ASTGroupByViewOperation;
642
+ addWhere(name: string, filter: ParsedFilter): ASTWhereViewOperation;
643
+ addWhere(name: string, filterString: string): ASTWhereViewOperation;
644
+ addWhere(
645
+ name: string,
646
+ path: string[],
647
+ filter: ParsedFilter,
648
+ ): ASTWhereViewOperation;
649
+ addWhere(
650
+ name: string,
651
+ path: string[],
652
+ filterString: string,
653
+ ): ASTWhereViewOperation;
654
+ addTimeGroupByany;
655
+ addDateGroupBy(
656
+ name: string,
657
+ path: string[],
658
+ timeframe: Malloy.DateTimeframe,
659
+ ): ASTGroupByViewOperation;
660
+ addDateGroupBy(
661
+ name: string,
662
+ timeframe: Malloy.DateTimeframe,
663
+ ): ASTGroupByViewOperation;
664
+ addTimestampGroupBy(
665
+ name: string,
666
+ path: string[],
667
+ timeframe: Malloy.TimestampTimeframe,
668
+ ): ASTGroupByViewOperation;
669
+ addTimestampGroupBy(
670
+ name: string,
671
+ timeframe: Malloy.TimestampTimeframe,
672
+ ): ASTGroupByViewOperation;
673
+ addAggregate(
674
+ name: string,
675
+ path?: string[],
676
+ rename?: string,
677
+ ): ASTAggregateViewOperation;
678
+ addNest(name: string, rename?: string): ASTNestViewOperation;
679
+ makeFieldany;
680
+ addOperationany;
681
+ getRefinementSchema(): Malloy.Schema;
682
+ setLimit(limit: number): void;
683
+ getOrAddDefaultSegment(): ASTSegmentViewDefinition;
684
+ addEmptyRefinement(): ASTSegmentViewDefinition;
685
+ addViewRefinement(name: string, path?: string[]): ASTReferenceViewDefinition;
686
+ getInputSchema(): Malloy.Schema;
687
+ getOutputSchema(): Malloy.Schema;
688
+ getImplicitName(): string | void;
689
+ isValidViewRefinement(
690
+ name: string,
691
+ path?: string[],
692
+ ): { isValidViewRefinementboolean, error?string, ... };
693
+ getInheritedAnnotations(): Malloy.Annotation[];
694
+ }
695
+ declare export class ASTViewOperationList
696
+ extends ASTListNode<Malloy.ViewOperation, ASTViewOperation>
697
+ {
698
+ constructor(operations: Malloy.ViewOperation[]): void;
699
+ get items(): ASTViewOperation[];
700
+ set items(operations: ASTViewOperation[]): void;
701
+ get segment(): ASTSegmentViewDefinition;
702
+ }
703
+ export type ASTViewOperation =
704
+ | ASTGroupByViewOperation
705
+ | ASTAggregateViewOperation
706
+ | ASTOrderByViewOperation
707
+ | ASTNestViewOperation
708
+ | ASTLimitViewOperation
709
+ | ASTWhereViewOperation;
710
+ declare export const ASTViewOperation: {
711
+ from(value: Malloy.ViewOperation): ASTViewOperation,
712
+ isLimit(x: ASTViewOperation): x is ASTLimitViewOperation,
713
+ ...
714
+ };
715
+ declare export interface IASTAnnotatable {
716
+ getOrAddAnnotations(): ASTAnnotationList;
717
+ getInheritedTag(prefix: RegExp | string): Tag;
718
+ getIntrinsicTag(prefix: RegExp | string): Tag;
719
+ getTag(prefix: RegExp | string): Tag;
720
+ setTagProperty(path: Path, value: TagSetValue, prefix: string): void;
721
+ removeTagProperty(path: Path, prefix: string): void;
722
+ }
723
+ declare export class ASTOrderByViewOperation
724
+ extends
725
+ ASTObjectNode<
726
+ Malloy.ViewOperationWithOrderBy,
727
+ {
728
+ kind"order_by",
729
+ field_referenceASTFieldReference,
730
+ direction?Malloy.OrderByDirection,
731
+ ...
732
+ },
733
+ >
734
+ {
735
+ nodeMalloy.ViewOperationWithOrderBy;
736
+ +kindMalloy.ViewOperationType;
737
+ constructor(node: Malloy.ViewOperationWithOrderBy): void;
738
+ get fieldReference(): ASTFieldReference;
739
+ get name(): string;
740
+ get direction(): Malloy.OrderByDirection | void;
741
+ set direction(direction: Malloy.OrderByDirection | void): void;
742
+ get list(): ASTViewOperationList;
743
+ delete(): void;
744
+ setField(name: string): void;
745
+ setDirection(direction: Malloy.OrderByDirection | void): void;
746
+ }
747
+ declare export class ASTGroupByViewOperation
748
+ extends
749
+ ASTObjectNode<
750
+ Malloy.ViewOperationWithGroupBy,
751
+ { kind"group_by", name?string, fieldASTField, ... },
752
+ >
753
+ implements IASTAnnotatable
754
+ {
755
+ nodeMalloy.ViewOperationWithGroupBy;
756
+ +kindMalloy.ViewOperationType;
757
+ constructor(node: Malloy.ViewOperationWithGroupBy): void;
758
+ get field(): ASTField;
759
+ get name(): string;
760
+ set name(name: string): void;
761
+ get list(): ASTViewOperationList;
762
+ rename(name: string): void;
763
+ delete(): void;
764
+ getFieldInfo(): Malloy.FieldInfo;
765
+ get annotations(): void;
766
+ set annotations(value: any): void;
767
+ getOrAddAnnotations(): ASTAnnotationList;
768
+ getInheritedTag(prefix?: RegExp | string): Tag;
769
+ getIntrinsicTag(prefix?: RegExp | string): Tag;
770
+ getTag(prefix?: RegExp | string): Tag;
771
+ setTagProperty(path: Path, value?: TagSetValue, prefix?: string): void;
772
+ removeTagProperty(path: Path, prefix?: string): void;
773
+ fromReference(
774
+ name: string,
775
+ path: string[] | void,
776
+ rename: string | void,
777
+ ): ASTGroupByViewOperation;
778
+ }
779
+ declare export class ASTAggregateViewOperation
780
+ extends
781
+ ASTObjectNode<
782
+ Malloy.ViewOperationWithAggregate,
783
+ { kind"aggregate", name?string, fieldASTField, ... },
784
+ >
785
+ implements IASTAnnotatable
786
+ {
787
+ nodeMalloy.ViewOperationWithAggregate;
788
+ +kindMalloy.ViewOperationType;
789
+ constructor(node: Malloy.ViewOperationWithAggregate): void;
790
+ get field(): ASTField;
791
+ get name(): string;
792
+ set name(name: string): void;
793
+ get annotations(): ASTAnnotationList | void;
794
+ rename(name: string): void;
795
+ get list(): ASTViewOperationList;
796
+ delete(): void;
797
+ getFieldInfo(): Malloy.FieldInfo;
798
+ getOrAddAnnotations(): ASTAnnotationList;
799
+ getInheritedTag(prefix?: RegExp | string): Tag;
800
+ getIntrinsicTag(prefix?: RegExp | string): Tag;
801
+ getTag(prefix?: RegExp | string): Tag;
802
+ setTagProperty(path: Path, value?: TagSetValue, prefix?: string): void;
803
+ removeTagProperty(path: Path, prefix?: string): void;
804
+ addWhere(
805
+ name: string,
806
+ path: string[],
807
+ filterString: string,
808
+ ): ASTFilteredFieldExpression;
809
+ addWhere(
810
+ name: string,
811
+ path: string[],
812
+ filter: ParsedFilter,
813
+ ): ASTFilteredFieldExpression;
814
+ addWhere(name: string, filterString: string): ASTFilteredFieldExpression;
815
+ addWhere(name: string, filter: ParsedFilter): ASTFilteredFieldExpression;
816
+ fromReference(
817
+ name: string,
818
+ path: string[] | void,
819
+ rename: string | void,
820
+ ): ASTAggregateViewOperation;
821
+ }
822
+ declare export class ASTField
823
+ extends
824
+ ASTObjectNode<
825
+ Malloy.Field,
826
+ { expressionASTExpression, annotations?ASTAnnotationList, ... },
827
+ >
828
+ implements IASTAnnotatable
829
+ {
830
+ nodeMalloy.Field;
831
+ constructor(node: Malloy.Field): void;
832
+ get expression(): ASTExpression;
833
+ set expression(expression: ASTExpression): void;
834
+ get name(): string;
835
+ get type():
836
+ | Malloy.AtomicType
837
+ | { timeframeMalloy.DateTimeframe, kind"date_type", ... }
838
+ | { timeframeMalloy.TimestampTimeframe, kind"timestamp_type", ... };
839
+ get annotations(): ASTAnnotationList | void;
840
+ set annotations(annotations: ASTAnnotationList | void): void;
841
+ getReference(): Malloy.Reference;
842
+ getOrAddAnnotations(): ASTAnnotationList;
843
+ getInheritedTag(prefix?: RegExp | string): Tag;
844
+ getIntrinsicTag(prefix?: RegExp | string): Tag;
845
+ getTag(prefix?: RegExp | string): Tag;
846
+ setTagProperty(path: Path, value?: TagSetValue, prefix?: string): void;
847
+ removeTagProperty(path: Path, prefix?: string): void;
848
+ get segment(): ASTSegmentViewDefinition;
849
+ getInheritedAnnotations(): Malloy.Annotation[];
850
+ }
851
+ export type ASTExpression =
852
+ | ASTReferenceExpression
853
+ | ASTFilteredFieldExpression
854
+ | ASTTimeTruncationExpression;
855
+ declare export const ASTExpression: {
856
+ from(value: Malloy.Expression): ASTExpression,
857
+ ...
858
+ };
859
+ declare export class ASTReferenceExpression
860
+ extends
861
+ ASTObjectNode<
862
+ Malloy.ExpressionWithFieldReference,
863
+ {
864
+ kind"field_reference",
865
+ namestring,
866
+ path?string[],
867
+ parameters?ASTParameterValueList,
868
+ ...
869
+ },
870
+ >
871
+ implements IASTReference
872
+ {
873
+ nodeMalloy.ExpressionWithFieldReference;
874
+ +kindMalloy.ExpressionType;
875
+ constructor(node: Malloy.ExpressionWithFieldReference): void;
876
+ get name(): string;
877
+ get parameters(): ASTParameterValueList | void;
878
+ set parameters(parameters: ASTParameterValueList | void): void;
879
+ get field(): ASTField;
880
+ get path(): string[] | void;
881
+ getReference(): Malloy.ExpressionWithFieldReference;
882
+ getFieldInfo(): Malloy.FieldInfoWithDimension | Malloy.FieldInfoWithMeasure;
883
+ get fieldType(): Malloy.AtomicType;
884
+ getInheritedAnnotations(): Malloy.Annotation[];
885
+ getOrAddParameters(): any;
886
+ setParameter(name: string, value: RawLiteralValue): void;
887
+ tryGetParameter(name: string): ASTParameterValue | void;
888
+ }
889
+ declare export class ASTTimeTruncationExpression
890
+ extends
891
+ ASTObjectNode<
892
+ Malloy.ExpressionWithTimeTruncation,
893
+ {
894
+ kind"time_truncation",
895
+ field_referenceASTFieldReference,
896
+ truncationMalloy.TimestampTimeframe,
897
+ ...
898
+ },
899
+ >
900
+ {
901
+ nodeMalloy.ExpressionWithTimeTruncation;
902
+ +kindMalloy.ExpressionType;
903
+ constructor(node: Malloy.ExpressionWithTimeTruncation): void;
904
+ getReference(): Malloy.Reference;
905
+ get fieldReference(): ASTFieldReference;
906
+ get truncation(): Malloy.TimestampTimeframe;
907
+ get name(): string;
908
+ get field(): ASTField;
909
+ getFieldInfo(): Malloy.FieldInfoWithDimension | Malloy.FieldInfoWithMeasure;
910
+ get fieldType():
911
+ | { timeframeMalloy.DateTimeframe, kind"date_type", ... }
912
+ | { timeframeMalloy.TimestampTimeframe, kind"timestamp_type", ... };
913
+ getInheritedAnnotations(): Malloy.Annotation[];
914
+ }
915
+ declare export class ASTWhere
916
+ extends ASTObjectNode<Malloy.Where, { filterASTFilter, ... }>
917
+ {
918
+ constructor(node: Malloy.Where): void;
919
+ get filter(): ASTFilterWithFilterString;
920
+ get list(): ASTWhereList;
921
+ delete(): void;
922
+ }
923
+ declare export class ASTWhereList extends ASTListNode<Malloy.Where, ASTWhere> {
924
+ constructor(wheres: Malloy.Where[]): void;
925
+ get expression(): ASTFilteredFieldExpression;
926
+ }
927
+ declare export class ASTFilteredFieldExpression
928
+ extends
929
+ ASTObjectNode<
930
+ Malloy.ExpressionWithFilteredField,
931
+ {
932
+ kind"filtered_field",
933
+ field_referenceASTFieldReference,
934
+ whereASTWhereList,
935
+ ...
936
+ },
937
+ >
938
+ {
939
+ nodeMalloy.ExpressionWithFilteredField;
940
+ +kindMalloy.ExpressionType;
941
+ constructor(node: Malloy.ExpressionWithFilteredField): void;
942
+ getReference(): Malloy.Reference;
943
+ get fieldReference(): ASTFieldReference;
944
+ get name(): string;
945
+ get where(): ASTWhereList;
946
+ get field(): ASTField;
947
+ getFieldInfo(): Malloy.FieldInfoWithMeasure;
948
+ get fieldType(): Malloy.AtomicType;
949
+ getInheritedAnnotations(): Malloy.Annotation[];
950
+ }
951
+ declare export class ASTNestViewOperation
952
+ extends
953
+ ASTObjectNode<
954
+ Malloy.ViewOperationWithNest,
955
+ { kind"nest", name?string, viewASTView, ... },
956
+ >
957
+ implements IASTAnnotatable
958
+ {
959
+ nodeMalloy.ViewOperationWithNest;
960
+ +kindMalloy.ViewOperationType;
961
+ constructor(node: Malloy.ViewOperationWithNest): void;
962
+ get view(): ASTView;
963
+ get annotations(): ASTAnnotationList | void;
964
+ get name(): string;
965
+ set name(name: string): void;
966
+ get list(): ASTViewOperationList;
967
+ getOrAddAnnotations(): ASTAnnotationList;
968
+ getInheritedTag(prefix?: RegExp | string): Tag;
969
+ getIntrinsicTag(prefix?: RegExp | string): Tag;
970
+ getTag(prefix?: RegExp | string): Tag;
971
+ setTagProperty(path: Path, value?: TagSetValue, prefix?: string): void;
972
+ removeTagProperty(path: Path, prefix?: string): void;
973
+ delete(): void;
974
+ rename(name: string): void;
975
+ getFieldInfo(): Malloy.FieldInfo;
976
+ fromReference(
977
+ name: string,
978
+ path: string[] | void,
979
+ rename: string | void,
980
+ ): ASTNestViewOperation;
981
+ }
982
+ declare export class ASTWhereViewOperation
983
+ extends
984
+ ASTObjectNode<
985
+ Malloy.ViewOperationWithWhere,
986
+ { kind"where", filterASTFilter, ... },
987
+ >
988
+ {
989
+ nodeMalloy.ViewOperationWithWhere;
990
+ +kindMalloy.ViewOperationType;
991
+ constructor(node: Malloy.ViewOperationWithWhere): void;
992
+ get filter(): ASTFilterWithFilterString;
993
+ get list(): ASTViewOperationList;
994
+ delete(): void;
995
+ }
996
+ export type ASTFilter = ASTFilterWithFilterString;
997
+ declare export const ASTFilter: {
998
+ from(filter: Malloy.Filter): ASTFilterWithFilterString,
999
+ ...
1000
+ };
1001
+ declare export class ASTFilterWithFilterString
1002
+ extends
1003
+ ASTObjectNode<
1004
+ Malloy.FilterWithFilterString,
1005
+ {
1006
+ kind"filter_string",
1007
+ field_referenceASTFieldReference,
1008
+ filterstring,
1009
+ ...
1010
+ },
1011
+ >
1012
+ {
1013
+ nodeMalloy.FilterWithFilterString;
1014
+ +kindMalloy.FilterType;
1015
+ constructor(node: Malloy.FilterWithFilterString): void;
1016
+ get fieldReference(): ASTFieldReference;
1017
+ get filterString(): string;
1018
+ set filterString(filter: string): void;
1019
+ setFilterString(filterString: string): void;
1020
+ getFieldInfo(): Malloy.FieldInfoWithDimension | Malloy.FieldInfoWithMeasure;
1021
+ getFilterType(): "string" | "boolean" | "number" | "date" | "other";
1022
+ setFilter(filter: ParsedFilter): void;
1023
+ getFilter(): ParsedFilter;
1024
+ }
1025
+ declare export class ASTView
1026
+ extends
1027
+ ASTObjectNode<
1028
+ Malloy.View,
1029
+ { definitionASTViewDefinition, annotations?ASTAnnotationList, ... },
1030
+ >
1031
+ implements IASTAnnotatable
1032
+ {
1033
+ nodeMalloy.View;
1034
+ constructor(node: Malloy.View): void;
1035
+ get definition(): ASTViewDefinition;
1036
+ set definition(definition: ASTViewDefinition): void;
1037
+ get name(): string | void;
1038
+ getOrAddDefaultSegment(): ASTSegmentViewDefinition;
1039
+ get nest(): ASTNestViewOperation;
1040
+ getInputSchema(): Malloy.Schema;
1041
+ getOutputSchema(): Malloy.Schema;
1042
+ propagateUp(f: PropagationFunction): void;
1043
+ propagateDown(f: PropagationFunction): void;
1044
+ reorderFields(names: string[]): void;
1045
+ get annotations(): ASTAnnotationList | void;
1046
+ getOrAddAnnotations(): ASTAnnotationList;
1047
+ getInheritedAnnotations(): Malloy.Annotation[];
1048
+ getInheritedTag(prefix?: RegExp | string): Tag;
1049
+ getIntrinsicTag(prefix?: RegExp | string): Tag;
1050
+ getTag(prefix?: RegExp | string): Tag;
1051
+ setTagProperty(path: Path, value?: TagSetValue, prefix?: string): void;
1052
+ removeTagProperty(path: Path, prefix?: string): void;
1053
+ }
1054
+ declare export class ASTLimitViewOperation
1055
+ extends
1056
+ ASTObjectNode<
1057
+ Malloy.ViewOperationWithLimit,
1058
+ { kind"limit", limitnumber, ... },
1059
+ >
1060
+ {
1061
+ nodeMalloy.ViewOperationWithLimit;
1062
+ +kindMalloy.ViewOperationType;
1063
+ get limit(): number;
1064
+ set limit(limit: number): void;
1065
+ constructor(node: Malloy.ViewOperationWithLimit): void;
1066
+ get list(): ASTViewOperationList;
1067
+ delete(): void;
1068
+ validateLimit(limit: number): void;
1069
+ }
1070
+ declare export class ASTAnnotationList
1071
+ extends ASTListNode<Malloy.Annotation, ASTAnnotation>
1072
+ {
1073
+ constructor(annotations: Malloy.Annotation[]): void;
1074
+ get items(): ASTAnnotation[];
1075
+ getInheritedAnnotations(): Malloy.Annotation[];
1076
+ getIntrinsicTag(prefix?: RegExp | string): Tag;
1077
+ getTag(prefix?: RegExp | string): Tag;
1078
+ get annotations(): Malloy.Annotation[];
1079
+ setTagProperty(path: Path, value?: TagSetValue, prefix?: string): void;
1080
+ removeTagProperty(path: Path, prefix?: string): void;
1081
+ }
1082
+ declare export class ASTAnnotation
1083
+ extends ASTObjectNode<Malloy.Annotation, { valuestring, ... }>
1084
+ {
1085
+ nodeMalloy.Annotation;
1086
+ +kindMalloy.ViewOperationType;
1087
+ get value(): string;
1088
+ set value(value: string): void;
1089
+ constructor(node: Malloy.Annotation): void;
1090
+ get list(): ASTAnnotationList;
1091
+ get index(): number;
1092
+ delete(): void;
1093
+ getIntrinsicTag(): Tag;
1094
+ getTag(): Tag;
1095
+ hasPrefix(prefix: string): boolean;
1096
+ hasIntrinsicTagProperty(path: Path): boolean;
1097
+ setTagProperty(path: Path, value: TagSetValue): void;
1098
+ removeTagProperty(path: Path): void;
1099
+ }
1100
+ declare export {};