@malloydata/malloy 0.0.79-dev230822044438 → 0.0.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dialect/dialect.d.ts +1 -1
- package/dist/dialect/functions/function_map.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-cast.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-time-extract.js +6 -6
- package/dist/lang/ast/query-items/field-declaration.d.ts +1 -1
- package/dist/lang/ast/query-items/field-references.d.ts +2 -2
- package/dist/lang/ast/query-properties/joins.d.ts +1 -1
- package/dist/lang/ast/query-properties/nest.d.ts +1 -1
- package/dist/lang/ast/query-properties/top.d.ts +1 -1
- package/dist/lang/ast/sources/table-source.d.ts +1 -1
- package/dist/lang/ast/space-seed.d.ts +1 -1
- package/dist/lang/ast/sql-elements/sql-string.d.ts +1 -1
- package/dist/lang/ast/types/comparison.js +1 -1
- package/dist/lang/ast/types/equality.js +1 -1
- package/dist/lang/ast/types/explore-field.d.ts +1 -1
- package/dist/lang/ast/types/expr-result.d.ts +1 -1
- package/dist/lang/ast/types/expr-value.d.ts +1 -1
- package/dist/lang/ast/types/field-collection-member.d.ts +1 -1
- package/dist/lang/ast/types/field-decl.d.ts +1 -1
- package/dist/lang/ast/types/lookup-result.d.ts +1 -1
- package/dist/lang/ast/types/malloy-element.d.ts +2 -2
- package/dist/lang/ast/types/query-element.d.ts +1 -1
- package/dist/lang/ast/types/query-extend-property.d.ts +1 -1
- package/dist/lang/ast/types/query-item.d.ts +1 -1
- package/dist/lang/ast/types/query-property-interface.js +2 -2
- package/dist/lang/ast/types/query-property.d.ts +1 -1
- package/dist/lang/ast/types/source-property.d.ts +1 -1
- package/dist/lang/field-utils.d.ts +1 -1
- package/dist/lang/lib/Malloy/MalloyLexer.js +5 -5
- package/dist/lang/lib/Malloy/MalloyParser.js +23 -23
- package/dist/lang/lib/Malloy/MalloyTagLexer.js +5 -5
- package/dist/lang/lib/Malloy/MalloyTagParser.js +4 -4
- package/dist/lang/malloy-to-ast.d.ts +1 -1
- package/dist/lang/parse-log.d.ts +1 -1
- package/dist/lang/parse-malloy.d.ts +3 -3
- package/dist/lang/parse-tree-walkers/explore-query-walker.d.ts +1 -1
- package/dist/lang/parse-tree-walkers/find-external-references.d.ts +2 -2
- package/dist/lang/parse-utils.d.ts +3 -3
- package/dist/lang/test/parse-expects.d.ts +3 -3
- package/dist/lang/translate-response.d.ts +8 -8
- package/dist/lang/zone.d.ts +3 -3
- package/dist/malloy.d.ts +6 -6
- package/dist/malloy.js +5 -5
- package/dist/model/malloy_query.d.ts +7 -7
- package/dist/model/malloy_types.d.ts +44 -44
- package/dist/model/malloy_types.js +1 -1
- package/dist/runtime_types.d.ts +7 -7
- package/dist/tags.d.ts +2 -2
- package/dist/tags.js +8 -8
- package/package.json +1 -1
|
@@ -19,7 +19,7 @@ export interface QueryInfo {
|
|
|
19
19
|
export declare const dayIndex: number;
|
|
20
20
|
export declare function inDays(units: string): boolean;
|
|
21
21
|
export declare function qtz(qi: QueryInfo): string | undefined;
|
|
22
|
-
export
|
|
22
|
+
export type DialectFieldList = DialectField[];
|
|
23
23
|
export declare abstract class Dialect {
|
|
24
24
|
abstract name: string;
|
|
25
25
|
abstract defaultNumberType: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExprValue } from '../types/expr-value';
|
|
2
2
|
import { ExpressionDef } from '../types/expression-def';
|
|
3
3
|
import { FieldSpace } from '../types/field-space';
|
|
4
|
-
export
|
|
4
|
+
export type CastType = 'string' | 'number' | 'boolean' | 'date' | 'timestamp';
|
|
5
5
|
export declare function isCastType(t: string): t is CastType;
|
|
6
6
|
export declare class ExprCast extends ExpressionDef {
|
|
7
7
|
readonly expr: ExpressionDef;
|
|
@@ -28,12 +28,6 @@ const ast_utils_1 = require("../ast-utils");
|
|
|
28
28
|
const expression_def_1 = require("../types/expression-def");
|
|
29
29
|
const range_1 = require("./range");
|
|
30
30
|
class ExprTimeExtract extends expression_def_1.ExpressionDef {
|
|
31
|
-
constructor(extractText, args) {
|
|
32
|
-
super({ args: args });
|
|
33
|
-
this.extractText = extractText;
|
|
34
|
-
this.args = args;
|
|
35
|
-
this.elementType = 'timeExtract';
|
|
36
|
-
}
|
|
37
31
|
static extractor(funcName) {
|
|
38
32
|
const mappedName = ExprTimeExtract.pluralMap[funcName];
|
|
39
33
|
if (mappedName) {
|
|
@@ -43,6 +37,12 @@ class ExprTimeExtract extends expression_def_1.ExpressionDef {
|
|
|
43
37
|
return funcName;
|
|
44
38
|
}
|
|
45
39
|
}
|
|
40
|
+
constructor(extractText, args) {
|
|
41
|
+
super({ args: args });
|
|
42
|
+
this.extractText = extractText;
|
|
43
|
+
this.args = args;
|
|
44
|
+
this.elementType = 'timeExtract';
|
|
45
|
+
}
|
|
46
46
|
getExpression(fs) {
|
|
47
47
|
const extractTo = ExprTimeExtract.extractor(this.extractText);
|
|
48
48
|
if (extractTo) {
|
|
@@ -9,7 +9,7 @@ import { MakeEntry, SpaceEntry } from '../types/space-entry';
|
|
|
9
9
|
import { extendNoteMethod, Noteable } from '../types/noteable';
|
|
10
10
|
import { DynamicSpace } from '../field-space/dynamic-space';
|
|
11
11
|
import { SpaceField } from '../types/space-field';
|
|
12
|
-
export
|
|
12
|
+
export type FieldDeclarationConstructor = new (expr: ExpressionDef, defineName: string, exprSrc?: string) => FieldDeclaration;
|
|
13
13
|
export declare abstract class FieldDeclaration extends MalloyElement implements Noteable, MakeEntry {
|
|
14
14
|
readonly expr: ExpressionDef;
|
|
15
15
|
readonly defineName: string;
|
|
@@ -6,7 +6,7 @@ import { LookupResult } from '../types/lookup-result';
|
|
|
6
6
|
import { ListOf, MalloyElement } from '../types/malloy-element';
|
|
7
7
|
import { Noteable, extendNoteMethod } from '../types/noteable';
|
|
8
8
|
import { MakeEntry } from '../types/space-entry';
|
|
9
|
-
export
|
|
9
|
+
export type FieldReferenceConstructor = new (names: FieldName[]) => FieldReference;
|
|
10
10
|
export declare abstract class FieldReference extends ListOf<FieldName> implements Noteable, MakeEntry {
|
|
11
11
|
readonly isNoteableObj = true;
|
|
12
12
|
note?: Annotation;
|
|
@@ -71,7 +71,7 @@ export declare class WildcardFieldReference extends MalloyElement implements Not
|
|
|
71
71
|
getFieldDef(): FieldDef;
|
|
72
72
|
get refString(): string;
|
|
73
73
|
}
|
|
74
|
-
export
|
|
74
|
+
export type FieldReferenceElement = FieldReference | WildcardFieldReference;
|
|
75
75
|
export declare class FieldReferences extends DefinitionList<FieldReferenceElement> {
|
|
76
76
|
elementType: string;
|
|
77
77
|
constructor(members: FieldReferenceElement[]);
|
|
@@ -27,7 +27,7 @@ export declare class KeyJoin extends Join {
|
|
|
27
27
|
structDef(): StructDef;
|
|
28
28
|
fixupJoinOn(outer: FieldSpace, inStruct: StructDef): void;
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
type ExpressionJoinType = 'many' | 'one' | 'cross';
|
|
31
31
|
export declare class ExpressionJoin extends Join {
|
|
32
32
|
readonly name: ModelEntryReference;
|
|
33
33
|
readonly source: Source;
|
|
@@ -59,5 +59,5 @@ export declare class NestReference extends FieldReference implements QueryProper
|
|
|
59
59
|
typecheck(type: TypeDesc): void;
|
|
60
60
|
queryExecute(executeFor: QueryBuilder): void;
|
|
61
61
|
}
|
|
62
|
-
export
|
|
62
|
+
export type NestedQuery = NestReference | NestDefinition | NestRefinement;
|
|
63
63
|
export {};
|
|
@@ -3,7 +3,7 @@ import { ExpressionDef } from '../types/expression-def';
|
|
|
3
3
|
import { FieldName, FieldSpace } from '../types/field-space';
|
|
4
4
|
import { MalloyElement } from '../types/malloy-element';
|
|
5
5
|
import { LegalRefinementStage, QueryPropertyInterface } from '../types/query-property-interface';
|
|
6
|
-
|
|
6
|
+
type TopInit = FieldName | ExpressionDef;
|
|
7
7
|
export declare class Top extends MalloyElement implements QueryPropertyInterface {
|
|
8
8
|
readonly limit: number;
|
|
9
9
|
readonly by?: TopInit | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StructDef } from '../../../model/malloy_types';
|
|
2
2
|
import { Source } from '../elements/source';
|
|
3
3
|
import { ModelEntryReference } from '../types/malloy-element';
|
|
4
|
-
|
|
4
|
+
type TableInfo = {
|
|
5
5
|
tablePath: string;
|
|
6
6
|
connectionName?: string | undefined;
|
|
7
7
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StructDef } from '../../model/malloy_types';
|
|
2
2
|
import { FieldSpace } from './types/field-space';
|
|
3
|
-
export
|
|
3
|
+
export type SourceSpec = StructDef | FieldSpace;
|
|
4
4
|
/**
|
|
5
5
|
* Based on how things are constructed, a DynamicSpace can be seeded
|
|
6
6
|
* with a StructDef, or from another field space.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SQLPhrase } from '../../../model/malloy_types';
|
|
2
2
|
import { QueryElement } from '../types/query-element';
|
|
3
3
|
import { MalloyElement } from '../types/malloy-element';
|
|
4
|
-
|
|
4
|
+
type SQLStringSegment = string | QueryElement;
|
|
5
5
|
export declare class SQLString extends MalloyElement {
|
|
6
6
|
elementType: string;
|
|
7
7
|
elements: SQLStringSegment[];
|
|
@@ -33,7 +33,7 @@ var Comparison;
|
|
|
33
33
|
Comparison["GreaterThan"] = ">";
|
|
34
34
|
Comparison["GreaterThanOrEqualTo"] = ">=";
|
|
35
35
|
Comparison["NotEqualTo"] = "!=";
|
|
36
|
-
})(Comparison
|
|
36
|
+
})(Comparison || (exports.Comparison = Comparison = {}));
|
|
37
37
|
function isComparison(s) {
|
|
38
38
|
return Object.values(Comparison).includes(s);
|
|
39
39
|
}
|
|
@@ -29,7 +29,7 @@ var Equality;
|
|
|
29
29
|
Equality["NotLike"] = "!~";
|
|
30
30
|
Equality["Equals"] = "=";
|
|
31
31
|
Equality["NotEquals"] = "!=";
|
|
32
|
-
})(Equality
|
|
32
|
+
})(Equality || (exports.Equality = Equality = {}));
|
|
33
33
|
function isEquality(s) {
|
|
34
34
|
return Object.values(Equality).includes(s);
|
|
35
35
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RenameField } from '../source-properties/renames';
|
|
2
2
|
import { FieldDecl } from './field-decl';
|
|
3
3
|
import { MalloyElement } from './malloy-element';
|
|
4
|
-
export
|
|
4
|
+
export type ExploreField = FieldDecl | RenameField;
|
|
5
5
|
export declare function isExploreField(f: MalloyElement): f is ExploreField;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fragment, TypeDesc } from '../../../model/malloy_types';
|
|
2
|
-
|
|
2
|
+
type MorphicValues = Record<string, Fragment[]>;
|
|
3
3
|
export interface ExprResult extends TypeDesc {
|
|
4
4
|
value: Fragment[];
|
|
5
5
|
morphic?: MorphicValues;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FieldDeclaration } from '../query-items/field-declaration';
|
|
2
2
|
import { FieldReferenceElement } from '../query-items/field-references';
|
|
3
3
|
import { MalloyElement } from './malloy-element';
|
|
4
|
-
export
|
|
4
|
+
export type FieldCollectionMember = FieldReferenceElement | FieldDeclaration;
|
|
5
5
|
export declare function isFieldCollectionMember(el: MalloyElement): el is FieldCollectionMember;
|
|
@@ -3,5 +3,5 @@ import { Turtles } from '../source-properties/turtles';
|
|
|
3
3
|
import { FieldDeclaration } from '../query-items/field-declaration';
|
|
4
4
|
import { Join } from '../query-properties/joins';
|
|
5
5
|
import { MalloyElement } from './malloy-element';
|
|
6
|
-
export
|
|
6
|
+
export type FieldDecl = FieldDeclaration | Join | TurtleDecl | Turtles;
|
|
7
7
|
export declare function isFieldDecl(f: MalloyElement): f is FieldDecl;
|
|
@@ -52,8 +52,8 @@ export declare class Unimplemented extends MalloyElement {
|
|
|
52
52
|
elementType: string;
|
|
53
53
|
reported: boolean;
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
type ChildBody = MalloyElement | MalloyElement[];
|
|
56
|
+
type ElementChildren = Record<string, ChildBody>;
|
|
57
57
|
export declare class ModelEntryReference extends MalloyElement {
|
|
58
58
|
readonly name: string;
|
|
59
59
|
elementType: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MalloyElement } from './malloy-element';
|
|
2
2
|
import { ExistingQuery } from '../query-elements/existing-query';
|
|
3
3
|
import { FullQuery } from '../query-elements/full-query';
|
|
4
|
-
export
|
|
4
|
+
export type QueryElement = FullQuery | ExistingQuery;
|
|
5
5
|
export declare function isQueryElement(e: MalloyElement): e is QueryElement;
|
|
@@ -2,5 +2,5 @@ import { Dimensions } from '../query-properties/dimensions';
|
|
|
2
2
|
import { Joins } from '../query-properties/joins';
|
|
3
3
|
import { Measures } from '../query-properties/measures';
|
|
4
4
|
import { MalloyElement } from './malloy-element';
|
|
5
|
-
export
|
|
5
|
+
export type QueryExtendProperty = Dimensions | Measures | Joins;
|
|
6
6
|
export declare function isQueryExtendProperty(q: MalloyElement): q is QueryExtendProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { FieldDeclaration } from '../query-items/field-declaration';
|
|
2
2
|
import { FieldReference } from '../query-items/field-references';
|
|
3
3
|
import { NestDefinition, NestReference } from '../query-properties/nest';
|
|
4
|
-
export
|
|
4
|
+
export type QueryItem = FieldDeclaration | FieldReference | NestDefinition | NestReference;
|
|
@@ -28,7 +28,7 @@ var QueryClass;
|
|
|
28
28
|
QueryClass["Index"] = "index";
|
|
29
29
|
QueryClass["Project"] = "project";
|
|
30
30
|
QueryClass["Grouping"] = "grouping";
|
|
31
|
-
})(QueryClass
|
|
31
|
+
})(QueryClass || (exports.QueryClass = QueryClass = {}));
|
|
32
32
|
/**
|
|
33
33
|
* A QueryProperty can have these responses to appearing in a refinement
|
|
34
34
|
* Head -- Legal in all queries, apply it to the first segment
|
|
@@ -41,5 +41,5 @@ var LegalRefinementStage;
|
|
|
41
41
|
LegalRefinementStage[LegalRefinementStage["Single"] = 0] = "Single";
|
|
42
42
|
LegalRefinementStage[LegalRefinementStage["Head"] = 1] = "Head";
|
|
43
43
|
LegalRefinementStage[LegalRefinementStage["Tail"] = 2] = "Tail";
|
|
44
|
-
})(LegalRefinementStage
|
|
44
|
+
})(LegalRefinementStage || (exports.LegalRefinementStage = LegalRefinementStage = {}));
|
|
45
45
|
//# sourceMappingURL=query-property-interface.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { MalloyElement } from './malloy-element';
|
|
2
2
|
import { QueryPropertyInterface } from './query-property-interface';
|
|
3
|
-
export
|
|
3
|
+
export type QueryProperty = MalloyElement & QueryPropertyInterface;
|
|
4
4
|
export declare function isQueryProperty(q: MalloyElement): q is QueryProperty;
|
|
@@ -8,5 +8,5 @@ import { Turtles } from '../source-properties/turtles';
|
|
|
8
8
|
import { MalloyElement } from './malloy-element';
|
|
9
9
|
import { TimezoneStatement } from '../source-properties/timezone-statement';
|
|
10
10
|
import { ObjectAnnotation } from './annotation-elements';
|
|
11
|
-
export
|
|
11
|
+
export type SourceProperty = Filter | Joins | DeclareFields | FieldListEdit | Renames | PrimaryKey | ObjectAnnotation | Turtles | TimezoneStatement;
|
|
12
12
|
export declare function isSourceProperty(p: MalloyElement): p is SourceProperty;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FieldDef, QueryFieldDef } from '../model/malloy_types';
|
|
2
|
-
|
|
2
|
+
type Field = QueryFieldDef | FieldDef;
|
|
3
3
|
export declare function nameOf(qfd: Field): string;
|
|
4
4
|
export declare function mergeFields<T extends Field>(older: T[] | undefined, newer: T[]): T[];
|
|
5
5
|
export {};
|
|
@@ -31,16 +31,16 @@ const LexerATNSimulator_1 = require("antlr4ts/atn/LexerATNSimulator");
|
|
|
31
31
|
const VocabularyImpl_1 = require("antlr4ts/VocabularyImpl");
|
|
32
32
|
const Utils = __importStar(require("antlr4ts/misc/Utils"));
|
|
33
33
|
class MalloyLexer extends Lexer_1.Lexer {
|
|
34
|
-
// tslint:enable:no-trailing-whitespace
|
|
35
|
-
constructor(input) {
|
|
36
|
-
super(input);
|
|
37
|
-
this._interp = new LexerATNSimulator_1.LexerATNSimulator(MalloyLexer._ATN, this);
|
|
38
|
-
}
|
|
39
34
|
// @Override
|
|
40
35
|
// @NotNull
|
|
41
36
|
get vocabulary() {
|
|
42
37
|
return MalloyLexer.VOCABULARY;
|
|
43
38
|
}
|
|
39
|
+
// tslint:enable:no-trailing-whitespace
|
|
40
|
+
constructor(input) {
|
|
41
|
+
super(input);
|
|
42
|
+
this._interp = new LexerATNSimulator_1.LexerATNSimulator(MalloyLexer._ATN, this);
|
|
43
|
+
}
|
|
44
44
|
// @Override
|
|
45
45
|
get grammarFileName() { return "MalloyLexer.g4"; }
|
|
46
46
|
// @Override
|
|
@@ -41,10 +41,6 @@ const Token_1 = require("antlr4ts/Token");
|
|
|
41
41
|
const VocabularyImpl_1 = require("antlr4ts/VocabularyImpl");
|
|
42
42
|
const Utils = __importStar(require("antlr4ts/misc/Utils"));
|
|
43
43
|
class MalloyParser extends Parser_1.Parser {
|
|
44
|
-
constructor(input) {
|
|
45
|
-
super(input);
|
|
46
|
-
this._interp = new ParserATNSimulator_1.ParserATNSimulator(MalloyParser._ATN, this);
|
|
47
|
-
}
|
|
48
44
|
// @Override
|
|
49
45
|
// @NotNull
|
|
50
46
|
get vocabulary() {
|
|
@@ -60,6 +56,10 @@ class MalloyParser extends Parser_1.Parser {
|
|
|
60
56
|
createFailedPredicateException(predicate, message) {
|
|
61
57
|
return new FailedPredicateException_1.FailedPredicateException(this, predicate, message);
|
|
62
58
|
}
|
|
59
|
+
constructor(input) {
|
|
60
|
+
super(input);
|
|
61
|
+
this._interp = new ParserATNSimulator_1.ParserATNSimulator(MalloyParser._ATN, this);
|
|
62
|
+
}
|
|
63
63
|
// @RuleVersion(0)
|
|
64
64
|
malloyDocument() {
|
|
65
65
|
let _localctx = new MalloyDocumentContext(this._ctx, this.state);
|
|
@@ -7787,9 +7787,6 @@ class TagsContext extends ParserRuleContext_1.ParserRuleContext {
|
|
|
7787
7787
|
}
|
|
7788
7788
|
exports.TagsContext = TagsContext;
|
|
7789
7789
|
class IsDefineContext extends ParserRuleContext_1.ParserRuleContext {
|
|
7790
|
-
constructor(parent, invokingState) {
|
|
7791
|
-
super(parent, invokingState);
|
|
7792
|
-
}
|
|
7793
7790
|
IS() { return this.getToken(MalloyParser.IS, 0); }
|
|
7794
7791
|
tags(i) {
|
|
7795
7792
|
if (i === undefined) {
|
|
@@ -7799,6 +7796,9 @@ class IsDefineContext extends ParserRuleContext_1.ParserRuleContext {
|
|
|
7799
7796
|
return this.getRuleContext(i, TagsContext);
|
|
7800
7797
|
}
|
|
7801
7798
|
}
|
|
7799
|
+
constructor(parent, invokingState) {
|
|
7800
|
+
super(parent, invokingState);
|
|
7801
|
+
}
|
|
7802
7802
|
// @Override
|
|
7803
7803
|
get ruleIndex() { return MalloyParser.RULE_isDefine; }
|
|
7804
7804
|
// @Override
|
|
@@ -7825,9 +7825,6 @@ class IsDefineContext extends ParserRuleContext_1.ParserRuleContext {
|
|
|
7825
7825
|
}
|
|
7826
7826
|
exports.IsDefineContext = IsDefineContext;
|
|
7827
7827
|
class RunStatementContext extends ParserRuleContext_1.ParserRuleContext {
|
|
7828
|
-
constructor(parent, invokingState) {
|
|
7829
|
-
super(parent, invokingState);
|
|
7830
|
-
}
|
|
7831
7828
|
RUN() { return this.getToken(MalloyParser.RUN, 0); }
|
|
7832
7829
|
topLevelAnonQueryDef() {
|
|
7833
7830
|
return this.getRuleContext(0, TopLevelAnonQueryDefContext);
|
|
@@ -7840,6 +7837,9 @@ class RunStatementContext extends ParserRuleContext_1.ParserRuleContext {
|
|
|
7840
7837
|
return this.getRuleContext(i, TagsContext);
|
|
7841
7838
|
}
|
|
7842
7839
|
}
|
|
7840
|
+
constructor(parent, invokingState) {
|
|
7841
|
+
super(parent, invokingState);
|
|
7842
|
+
}
|
|
7843
7843
|
// @Override
|
|
7844
7844
|
get ruleIndex() { return MalloyParser.RULE_runStatement; }
|
|
7845
7845
|
// @Override
|
|
@@ -10582,9 +10582,6 @@ class JoinListContext extends ParserRuleContext_1.ParserRuleContext {
|
|
|
10582
10582
|
}
|
|
10583
10583
|
exports.JoinListContext = JoinListContext;
|
|
10584
10584
|
class IsExploreContext extends ParserRuleContext_1.ParserRuleContext {
|
|
10585
|
-
constructor(parent, invokingState) {
|
|
10586
|
-
super(parent, invokingState);
|
|
10587
|
-
}
|
|
10588
10585
|
IS() { return this.getToken(MalloyParser.IS, 0); }
|
|
10589
10586
|
explore() {
|
|
10590
10587
|
return this.getRuleContext(0, ExploreContext);
|
|
@@ -10597,6 +10594,9 @@ class IsExploreContext extends ParserRuleContext_1.ParserRuleContext {
|
|
|
10597
10594
|
return this.getRuleContext(i, TagsContext);
|
|
10598
10595
|
}
|
|
10599
10596
|
}
|
|
10597
|
+
constructor(parent, invokingState) {
|
|
10598
|
+
super(parent, invokingState);
|
|
10599
|
+
}
|
|
10600
10600
|
// @Override
|
|
10601
10601
|
get ruleIndex() { return MalloyParser.RULE_isExplore; }
|
|
10602
10602
|
// @Override
|
|
@@ -13268,10 +13268,6 @@ class ExprRangeContext extends FieldExprContext {
|
|
|
13268
13268
|
}
|
|
13269
13269
|
exports.ExprRangeContext = ExprRangeContext;
|
|
13270
13270
|
class ExprForRangeContext extends FieldExprContext {
|
|
13271
|
-
constructor(ctx) {
|
|
13272
|
-
super(ctx.parent, ctx.invokingState);
|
|
13273
|
-
this.copyFrom(ctx);
|
|
13274
|
-
}
|
|
13275
13271
|
FOR() { return this.getToken(MalloyParser.FOR, 0); }
|
|
13276
13272
|
timeframe() {
|
|
13277
13273
|
return this.getRuleContext(0, TimeframeContext);
|
|
@@ -13284,6 +13280,10 @@ class ExprForRangeContext extends FieldExprContext {
|
|
|
13284
13280
|
return this.getRuleContext(i, FieldExprContext);
|
|
13285
13281
|
}
|
|
13286
13282
|
}
|
|
13283
|
+
constructor(ctx) {
|
|
13284
|
+
super(ctx.parent, ctx.invokingState);
|
|
13285
|
+
this.copyFrom(ctx);
|
|
13286
|
+
}
|
|
13287
13287
|
// @Override
|
|
13288
13288
|
enterRule(listener) {
|
|
13289
13289
|
if (listener.enterExprForRange) {
|
|
@@ -13907,9 +13907,6 @@ class PartialAllowedFieldExprContext extends ParserRuleContext_1.ParserRuleConte
|
|
|
13907
13907
|
}
|
|
13908
13908
|
exports.PartialAllowedFieldExprContext = PartialAllowedFieldExprContext;
|
|
13909
13909
|
class PickStatementContext extends ParserRuleContext_1.ParserRuleContext {
|
|
13910
|
-
constructor(parent, invokingState) {
|
|
13911
|
-
super(parent, invokingState);
|
|
13912
|
-
}
|
|
13913
13910
|
pick(i) {
|
|
13914
13911
|
if (i === undefined) {
|
|
13915
13912
|
return this.getRuleContexts(PickContext);
|
|
@@ -13922,6 +13919,9 @@ class PickStatementContext extends ParserRuleContext_1.ParserRuleContext {
|
|
|
13922
13919
|
fieldExpr() {
|
|
13923
13920
|
return this.tryGetRuleContext(0, FieldExprContext);
|
|
13924
13921
|
}
|
|
13922
|
+
constructor(parent, invokingState) {
|
|
13923
|
+
super(parent, invokingState);
|
|
13924
|
+
}
|
|
13925
13925
|
// @Override
|
|
13926
13926
|
get ruleIndex() { return MalloyParser.RULE_pickStatement; }
|
|
13927
13927
|
// @Override
|
|
@@ -13948,9 +13948,6 @@ class PickStatementContext extends ParserRuleContext_1.ParserRuleContext {
|
|
|
13948
13948
|
}
|
|
13949
13949
|
exports.PickStatementContext = PickStatementContext;
|
|
13950
13950
|
class PickContext extends ParserRuleContext_1.ParserRuleContext {
|
|
13951
|
-
constructor(parent, invokingState) {
|
|
13952
|
-
super(parent, invokingState);
|
|
13953
|
-
}
|
|
13954
13951
|
PICK() { return this.getToken(MalloyParser.PICK, 0); }
|
|
13955
13952
|
WHEN() { return this.getToken(MalloyParser.WHEN, 0); }
|
|
13956
13953
|
partialAllowedFieldExpr() {
|
|
@@ -13959,6 +13956,9 @@ class PickContext extends ParserRuleContext_1.ParserRuleContext {
|
|
|
13959
13956
|
fieldExpr() {
|
|
13960
13957
|
return this.tryGetRuleContext(0, FieldExprContext);
|
|
13961
13958
|
}
|
|
13959
|
+
constructor(parent, invokingState) {
|
|
13960
|
+
super(parent, invokingState);
|
|
13961
|
+
}
|
|
13962
13962
|
// @Override
|
|
13963
13963
|
get ruleIndex() { return MalloyParser.RULE_pick; }
|
|
13964
13964
|
// @Override
|
|
@@ -31,16 +31,16 @@ const LexerATNSimulator_1 = require("antlr4ts/atn/LexerATNSimulator");
|
|
|
31
31
|
const VocabularyImpl_1 = require("antlr4ts/VocabularyImpl");
|
|
32
32
|
const Utils = __importStar(require("antlr4ts/misc/Utils"));
|
|
33
33
|
class MalloyTagLexer extends Lexer_1.Lexer {
|
|
34
|
-
// tslint:enable:no-trailing-whitespace
|
|
35
|
-
constructor(input) {
|
|
36
|
-
super(input);
|
|
37
|
-
this._interp = new LexerATNSimulator_1.LexerATNSimulator(MalloyTagLexer._ATN, this);
|
|
38
|
-
}
|
|
39
34
|
// @Override
|
|
40
35
|
// @NotNull
|
|
41
36
|
get vocabulary() {
|
|
42
37
|
return MalloyTagLexer.VOCABULARY;
|
|
43
38
|
}
|
|
39
|
+
// tslint:enable:no-trailing-whitespace
|
|
40
|
+
constructor(input) {
|
|
41
|
+
super(input);
|
|
42
|
+
this._interp = new LexerATNSimulator_1.LexerATNSimulator(MalloyTagLexer._ATN, this);
|
|
43
|
+
}
|
|
44
44
|
// @Override
|
|
45
45
|
get grammarFileName() { return "MalloyTag.g4"; }
|
|
46
46
|
// @Override
|
|
@@ -37,10 +37,6 @@ const Token_1 = require("antlr4ts/Token");
|
|
|
37
37
|
const VocabularyImpl_1 = require("antlr4ts/VocabularyImpl");
|
|
38
38
|
const Utils = __importStar(require("antlr4ts/misc/Utils"));
|
|
39
39
|
class MalloyTagParser extends Parser_1.Parser {
|
|
40
|
-
constructor(input) {
|
|
41
|
-
super(input);
|
|
42
|
-
this._interp = new ParserATNSimulator_1.ParserATNSimulator(MalloyTagParser._ATN, this);
|
|
43
|
-
}
|
|
44
40
|
// @Override
|
|
45
41
|
// @NotNull
|
|
46
42
|
get vocabulary() {
|
|
@@ -56,6 +52,10 @@ class MalloyTagParser extends Parser_1.Parser {
|
|
|
56
52
|
createFailedPredicateException(predicate, message) {
|
|
57
53
|
return new FailedPredicateException_1.FailedPredicateException(this, predicate, message);
|
|
58
54
|
}
|
|
55
|
+
constructor(input) {
|
|
56
|
+
super(input);
|
|
57
|
+
this._interp = new ParserATNSimulator_1.ParserATNSimulator(MalloyTagParser._ATN, this);
|
|
58
|
+
}
|
|
59
59
|
// @RuleVersion(0)
|
|
60
60
|
tagLine() {
|
|
61
61
|
let _localctx = new TagLineContext(this._ctx, this.state);
|
|
@@ -15,7 +15,7 @@ declare class IgnoredElement extends ast.MalloyElement {
|
|
|
15
15
|
malloySrc: string;
|
|
16
16
|
constructor(src: string);
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
type HasAnnotations = ParserRuleContext & {
|
|
19
19
|
ANNOTATION: () => TerminalNode[];
|
|
20
20
|
};
|
|
21
21
|
/**
|
package/dist/lang/parse-log.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { ReferenceList } from './reference-list';
|
|
|
6
6
|
import { ASTResponse, CompletionsResponse, DataRequestResponse, ProblemResponse, FatalResponse, FinalResponse, HelpContextResponse, MetadataResponse, ModelDataRequest, NeedURLData, TranslateResponse } from './translate-response';
|
|
7
7
|
import { Tag } from '../tags';
|
|
8
8
|
import { MalloyParseInfo } from './malloy-parse-info';
|
|
9
|
-
export
|
|
9
|
+
export type StepResponses = DataRequestResponse | ASTResponse | TranslateResponse | ParseResponse | MetadataResponse;
|
|
10
10
|
/**
|
|
11
11
|
* A Translation is a series of translation steps. Each step can depend
|
|
12
12
|
* on other steps, in which case the preceeding steps will be passed
|
|
@@ -25,7 +25,7 @@ interface TranslationStep {
|
|
|
25
25
|
interface ParseData extends ProblemResponse, NeedURLData, FinalResponse {
|
|
26
26
|
parse: MalloyParseInfo;
|
|
27
27
|
}
|
|
28
|
-
export
|
|
28
|
+
export type ParseResponse = Partial<ParseData>;
|
|
29
29
|
/**
|
|
30
30
|
* ParseStep -- Parse the source URL
|
|
31
31
|
*/
|
|
@@ -186,7 +186,7 @@ export interface SQLBlockData {
|
|
|
186
186
|
export interface UpdateData extends URLData, SchemaData, SQLBlockData {
|
|
187
187
|
errors: Partial<ErrorData>;
|
|
188
188
|
}
|
|
189
|
-
export
|
|
189
|
+
export type ParseUpdate = Partial<UpdateData>;
|
|
190
190
|
export declare class MalloyParserErrorHandler implements ANTLRErrorListener<Token> {
|
|
191
191
|
readonly translator: MalloyTranslation;
|
|
192
192
|
readonly messages: MessageLogger;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CommonTokenStream } from 'antlr4ts';
|
|
2
2
|
import { ParseTree } from 'antlr4ts/tree';
|
|
3
3
|
import { MalloyParserListener } from '../lib/Malloy/MalloyParserListener';
|
|
4
|
-
|
|
4
|
+
type SimpleRange = [number | undefined, number | undefined];
|
|
5
5
|
export interface FilterRef {
|
|
6
6
|
text: string;
|
|
7
7
|
range: SimpleRange;
|
|
@@ -2,8 +2,8 @@ import { CommonTokenStream } from 'antlr4ts';
|
|
|
2
2
|
import { ParseTree } from 'antlr4ts/tree';
|
|
3
3
|
import { DocumentRange } from '../../model/malloy_types';
|
|
4
4
|
import { MalloyTranslation } from '../parse-malloy';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
type NeedImports = Record<string, DocumentRange>;
|
|
6
|
+
type NeedTables = Record<string, {
|
|
7
7
|
connectionName: string | undefined;
|
|
8
8
|
tablePath: string;
|
|
9
9
|
firstReference: DocumentRange;
|
|
@@ -9,10 +9,10 @@ import { StringContext, ShortStringContext, SqlStringContext, IdContext } from '
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function getShortString(scx: ShortStringContext): string;
|
|
11
11
|
export declare function getStringIfShort(cx: HasString): string | undefined;
|
|
12
|
-
export
|
|
12
|
+
export type HasString = ParserRuleContext & {
|
|
13
13
|
string: () => StringContext;
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
type StringPart = ParserRuleContext | string;
|
|
16
16
|
export declare function getStringParts(cx: SqlStringContext): Generator<StringPart>;
|
|
17
17
|
/**
|
|
18
18
|
* Parses the interior of a string, doing all \ substitutions. In most cases
|
|
@@ -25,7 +25,7 @@ export declare function getStringParts(cx: SqlStringContext): Generator<StringPa
|
|
|
25
25
|
* @returns a string with the \ processing completed
|
|
26
26
|
*/
|
|
27
27
|
export declare function parseString(str: string, surround?: string): string;
|
|
28
|
-
export
|
|
28
|
+
export type HasID = ParserRuleContext & {
|
|
29
29
|
id: () => IdContext;
|
|
30
30
|
};
|
|
31
31
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { DocumentLocation } from '../../model';
|
|
2
2
|
import { LogSeverity } from '../parse-log';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type SimpleProblemSpec = string | RegExp;
|
|
4
|
+
type ComplexProblemSpec = {
|
|
5
5
|
severity: LogSeverity;
|
|
6
6
|
message: SimpleProblemSpec;
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
type ProblemSpec = SimpleProblemSpec | ComplexProblemSpec;
|
|
9
9
|
declare global {
|
|
10
10
|
namespace jest {
|
|
11
11
|
interface Matchers<R> {
|
|
@@ -15,7 +15,7 @@ export interface FinalResponse {
|
|
|
15
15
|
export interface ProblemResponse {
|
|
16
16
|
problems: LogMessage[];
|
|
17
17
|
}
|
|
18
|
-
export
|
|
18
|
+
export type FatalResponse = FinalResponse & ProblemResponse;
|
|
19
19
|
export interface NeedSchemaData {
|
|
20
20
|
tables: Record<string, {
|
|
21
21
|
connectionName: string | undefined;
|
|
@@ -31,26 +31,26 @@ export interface NeedCompileSQL {
|
|
|
31
31
|
}
|
|
32
32
|
interface NeededData extends NeedURLData, NeedSchemaData, NeedCompileSQL {
|
|
33
33
|
}
|
|
34
|
-
export
|
|
34
|
+
export type DataRequestResponse = Partial<NeededData> | null;
|
|
35
35
|
export declare function isNeedResponse(dr: DataRequestResponse): dr is NeededData;
|
|
36
|
-
export
|
|
36
|
+
export type ModelDataRequest = NeedCompileSQL | undefined;
|
|
37
37
|
interface ASTData extends ProblemResponse, NeededData, FinalResponse {
|
|
38
38
|
ast: MalloyElement;
|
|
39
39
|
}
|
|
40
|
-
export
|
|
40
|
+
export type ASTResponse = Partial<ASTData>;
|
|
41
41
|
interface Metadata extends NeededData, ProblemResponse, FinalResponse {
|
|
42
42
|
symbols: DocumentSymbol[];
|
|
43
43
|
highlights: DocumentHighlight[];
|
|
44
44
|
}
|
|
45
|
-
export
|
|
45
|
+
export type MetadataResponse = Partial<Metadata>;
|
|
46
46
|
interface Completions extends NeededData, ProblemResponse, FinalResponse {
|
|
47
47
|
completions: DocumentCompletion[];
|
|
48
48
|
}
|
|
49
|
-
export
|
|
49
|
+
export type CompletionsResponse = Partial<Completions>;
|
|
50
50
|
interface HelpContext extends NeededData, ProblemResponse, FinalResponse {
|
|
51
51
|
helpContext: DocumentHelpContext | undefined;
|
|
52
52
|
}
|
|
53
|
-
export
|
|
53
|
+
export type HelpContextResponse = Partial<HelpContext>;
|
|
54
54
|
interface TranslatedResponseData extends NeededData, ProblemResponse, FinalResponse {
|
|
55
55
|
translated: {
|
|
56
56
|
modelDef: ModelDef;
|
|
@@ -58,5 +58,5 @@ interface TranslatedResponseData extends NeededData, ProblemResponse, FinalRespo
|
|
|
58
58
|
sqlBlocks: SQLBlockStructDef[];
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
-
export
|
|
61
|
+
export type TranslateResponse = Partial<TranslatedResponseData>;
|
|
62
62
|
export {};
|
package/dist/lang/zone.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DocumentLocation } from '../model/malloy_types';
|
|
2
|
-
export
|
|
3
|
-
|
|
2
|
+
export type ZoneData<TValue> = Record<string, TValue>;
|
|
3
|
+
type EntryStatus = 'present' | 'reference' | 'error';
|
|
4
4
|
interface AllEntries {
|
|
5
5
|
status: EntryStatus;
|
|
6
6
|
firstReference?: DocumentLocation;
|
|
@@ -17,7 +17,7 @@ interface EntryErrored extends AllEntries {
|
|
|
17
17
|
status: 'error';
|
|
18
18
|
message: string;
|
|
19
19
|
}
|
|
20
|
-
export
|
|
20
|
+
export type ZoneEntry<T> = EntryPresent<T> | ReferenceEntry | EntryErrored;
|
|
21
21
|
/**
|
|
22
22
|
* A Zone is a symbol table which may contain references to symbols
|
|
23
23
|
* which are not yet defined. This is used by the parser to track
|
package/dist/malloy.d.ts
CHANGED
|
@@ -506,13 +506,13 @@ declare abstract class Entity {
|
|
|
506
506
|
isQuery(): this is Query;
|
|
507
507
|
abstract isIntrinsic(): boolean;
|
|
508
508
|
}
|
|
509
|
-
export
|
|
510
|
-
export
|
|
509
|
+
export type Field = AtomicField | QueryField | ExploreField;
|
|
510
|
+
export type SerializedExplore = {
|
|
511
511
|
_structDef: StructDef;
|
|
512
512
|
sourceExplore?: SerializedExplore;
|
|
513
513
|
_parentExplore?: SerializedExplore;
|
|
514
514
|
};
|
|
515
|
-
export
|
|
515
|
+
export type SortableField = {
|
|
516
516
|
field: Field;
|
|
517
517
|
dir: 'asc' | 'desc' | undefined;
|
|
518
518
|
};
|
|
@@ -1087,7 +1087,7 @@ export declare class ExploreMaterializer extends FluentState<Explore> {
|
|
|
1087
1087
|
*/
|
|
1088
1088
|
getExplore(): Promise<Explore>;
|
|
1089
1089
|
}
|
|
1090
|
-
export
|
|
1090
|
+
export type ResultJSON = {
|
|
1091
1091
|
queryResult: QueryResult;
|
|
1092
1092
|
modelDef: ModelDef;
|
|
1093
1093
|
};
|
|
@@ -1109,8 +1109,8 @@ export declare class Result extends PreparedResult {
|
|
|
1109
1109
|
toJSON(): ResultJSON;
|
|
1110
1110
|
static fromJSON({ queryResult, modelDef }: ResultJSON): Result;
|
|
1111
1111
|
}
|
|
1112
|
-
export
|
|
1113
|
-
export
|
|
1112
|
+
export type DataColumn = DataArray | DataRecord | DataString | DataBoolean | DataNumber | DataDate | DataTimestamp | DataNull | DataBytes | DataJSON | DataUnsupported;
|
|
1113
|
+
export type DataArrayOrRecord = DataArray | DataRecord;
|
|
1114
1114
|
declare abstract class Data<T> {
|
|
1115
1115
|
protected _field: Field | Explore;
|
|
1116
1116
|
constructor(field: Field | Explore);
|
package/dist/malloy.js
CHANGED
|
@@ -876,7 +876,7 @@ var SourceRelationship;
|
|
|
876
876
|
SourceRelationship["Many"] = "many";
|
|
877
877
|
// TODO document this
|
|
878
878
|
SourceRelationship["Inline"] = "inline";
|
|
879
|
-
})(SourceRelationship
|
|
879
|
+
})(SourceRelationship || (exports.SourceRelationship = SourceRelationship = {}));
|
|
880
880
|
class Entity {
|
|
881
881
|
constructor(name, parent, source) {
|
|
882
882
|
this._name = name;
|
|
@@ -1121,7 +1121,7 @@ var AtomicFieldType;
|
|
|
1121
1121
|
AtomicFieldType["Json"] = "json";
|
|
1122
1122
|
AtomicFieldType["Unsupported"] = "unsupported";
|
|
1123
1123
|
AtomicFieldType["Error"] = "error";
|
|
1124
|
-
})(AtomicFieldType
|
|
1124
|
+
})(AtomicFieldType || (exports.AtomicFieldType = AtomicFieldType = {}));
|
|
1125
1125
|
class AtomicField extends Entity {
|
|
1126
1126
|
constructor(fieldTypeDef, parent, source) {
|
|
1127
1127
|
super(fieldTypeDef.as || fieldTypeDef.name, parent, source);
|
|
@@ -1235,7 +1235,7 @@ var DateTimeframe;
|
|
|
1235
1235
|
DateTimeframe["Month"] = "month";
|
|
1236
1236
|
DateTimeframe["Quarter"] = "quarter";
|
|
1237
1237
|
DateTimeframe["Year"] = "year";
|
|
1238
|
-
})(DateTimeframe
|
|
1238
|
+
})(DateTimeframe || (exports.DateTimeframe = DateTimeframe = {}));
|
|
1239
1239
|
var TimestampTimeframe;
|
|
1240
1240
|
(function (TimestampTimeframe) {
|
|
1241
1241
|
TimestampTimeframe["Day"] = "day";
|
|
@@ -1246,7 +1246,7 @@ var TimestampTimeframe;
|
|
|
1246
1246
|
TimestampTimeframe["Second"] = "second";
|
|
1247
1247
|
TimestampTimeframe["Hour"] = "hour";
|
|
1248
1248
|
TimestampTimeframe["Minute"] = "minute";
|
|
1249
|
-
})(TimestampTimeframe
|
|
1249
|
+
})(TimestampTimeframe || (exports.TimestampTimeframe = TimestampTimeframe = {}));
|
|
1250
1250
|
class DateField extends AtomicField {
|
|
1251
1251
|
constructor(fieldDateDef, parent, source) {
|
|
1252
1252
|
super(fieldDateDef, parent, source);
|
|
@@ -1390,7 +1390,7 @@ var JoinRelationship;
|
|
|
1390
1390
|
JoinRelationship["OneToOne"] = "one_to_one";
|
|
1391
1391
|
JoinRelationship["OneToMany"] = "one_to_many";
|
|
1392
1392
|
JoinRelationship["ManyToOne"] = "many_to_one";
|
|
1393
|
-
})(JoinRelationship
|
|
1393
|
+
})(JoinRelationship || (exports.JoinRelationship = JoinRelationship = {}));
|
|
1394
1394
|
class ExploreField extends Explore {
|
|
1395
1395
|
constructor(structDef, parentExplore, source) {
|
|
1396
1396
|
super(structDef, parentExplore, source);
|
|
@@ -38,7 +38,7 @@ declare class StageWriter {
|
|
|
38
38
|
generateSQLStages(): string;
|
|
39
39
|
generateCoorelatedSubQuery(dialect: Dialect, structDef: StructDef): string;
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
type QuerySomething = QueryField | QueryStruct | QueryTurtle;
|
|
42
42
|
declare class GenerateState {
|
|
43
43
|
whereSQL?: string;
|
|
44
44
|
applyValue?: string;
|
|
@@ -99,7 +99,7 @@ declare class QueryFieldStruct extends QueryAtomicField {
|
|
|
99
99
|
getName(): string;
|
|
100
100
|
getAsJoinedStructDef(foreignKeyName: string): StructDef;
|
|
101
101
|
}
|
|
102
|
-
|
|
102
|
+
type FieldUsage = {
|
|
103
103
|
type: 'result';
|
|
104
104
|
resultIndex: number;
|
|
105
105
|
} | {
|
|
@@ -107,7 +107,7 @@ declare type FieldUsage = {
|
|
|
107
107
|
} | {
|
|
108
108
|
type: 'dependant';
|
|
109
109
|
};
|
|
110
|
-
|
|
110
|
+
type FieldInstanceType = 'field' | 'query';
|
|
111
111
|
interface FieldInstance {
|
|
112
112
|
type: FieldInstanceType;
|
|
113
113
|
root(): FieldInstanceResultRoot;
|
|
@@ -125,8 +125,8 @@ declare class FieldInstanceField implements FieldInstance {
|
|
|
125
125
|
getSQL(): string;
|
|
126
126
|
getAnalyticalSQL(forPartition: boolean): string;
|
|
127
127
|
}
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
type RepeatedResultType = 'nested' | 'inline_all_numbers' | 'inline';
|
|
129
|
+
type UngroupSet = {
|
|
130
130
|
type: 'all' | 'exclude';
|
|
131
131
|
fields: string[];
|
|
132
132
|
groupSet: number;
|
|
@@ -208,11 +208,11 @@ declare class QueryTurtle extends QueryField {
|
|
|
208
208
|
export declare class Segment {
|
|
209
209
|
static nextStructDef(structDef: StructDef, segment: PipeSegment): StructDef;
|
|
210
210
|
}
|
|
211
|
-
|
|
211
|
+
type StageGroupMaping = {
|
|
212
212
|
fromGroup: number;
|
|
213
213
|
toGroup: number;
|
|
214
214
|
};
|
|
215
|
-
|
|
215
|
+
type StageOutputContext = {
|
|
216
216
|
sql: string[];
|
|
217
217
|
lateralJoinSQLExpressions: string[];
|
|
218
218
|
dimensionIndexes: number[];
|
|
@@ -3,8 +3,8 @@ interface ParamBase {
|
|
|
3
3
|
name: string;
|
|
4
4
|
type: AtomicFieldType;
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
type ConstantExpr = Expr;
|
|
7
|
+
type Condition = Expr;
|
|
8
8
|
interface ParamCondition extends ParamBase {
|
|
9
9
|
condition: Condition | null;
|
|
10
10
|
}
|
|
@@ -12,7 +12,7 @@ interface ParamValue extends ParamBase {
|
|
|
12
12
|
value: ConstantExpr | null;
|
|
13
13
|
constant: boolean;
|
|
14
14
|
}
|
|
15
|
-
export
|
|
15
|
+
export type Parameter = ParamCondition | ParamValue;
|
|
16
16
|
export declare function isValueParameter(p: Parameter): p is ParamValue;
|
|
17
17
|
export declare function isConditionParameter(p: Parameter): p is ParamCondition;
|
|
18
18
|
export declare function paramHasValue(p: Parameter): boolean;
|
|
@@ -57,7 +57,7 @@ export interface DocumentFieldReference extends DocumentReferenceBase {
|
|
|
57
57
|
type: 'fieldReference';
|
|
58
58
|
definition: FieldDef;
|
|
59
59
|
}
|
|
60
|
-
export
|
|
60
|
+
export type DocumentReference = DocumentExploreReference | DocumentQueryReference | DocumentSQLBlockReference | DocumentFieldReference | DocumentJoinReference;
|
|
61
61
|
/** put location into the parse tree. */
|
|
62
62
|
export interface HasLocation {
|
|
63
63
|
location?: DocumentLocation;
|
|
@@ -229,9 +229,9 @@ export interface NumberLiteralFragment extends DialectFragmentBase {
|
|
|
229
229
|
function: 'numberLiteral';
|
|
230
230
|
literal: string;
|
|
231
231
|
}
|
|
232
|
-
export
|
|
233
|
-
export
|
|
234
|
-
export
|
|
232
|
+
export type DialectFragment = DivFragment | TimeLiteralFragment | NowFragment | TimeDeltaFragment | TimeDiffFragment | TimeTruncFragment | TypecastFragment | TimeExtractFragment | StringLiteralFragment | RegexpLiteralFragment | NumberLiteralFragment | RegexpMatchFragment;
|
|
233
|
+
export type Fragment = string | ApplyFragment | ApplyValueFragment | FieldFragment | ParameterFragment | FilterFragment | OutputFieldFragment | AggregateFragment | UngroupFragment | DialectFragment | FunctionParameterFragment | FunctionCallFragment | SQLExpressionFragment | SpreadFragment;
|
|
234
|
+
export type Expr = Fragment[];
|
|
235
235
|
export interface TypedValue {
|
|
236
236
|
value: Expr;
|
|
237
237
|
valueType: AtomicFieldType;
|
|
@@ -239,7 +239,7 @@ export interface TypedValue {
|
|
|
239
239
|
export interface TimeValue extends TypedValue {
|
|
240
240
|
valueType: TimeFieldType;
|
|
241
241
|
}
|
|
242
|
-
|
|
242
|
+
type TagElement = Expr | string;
|
|
243
243
|
/**
|
|
244
244
|
* Return an Expr based on the string template, subsittutions can be
|
|
245
245
|
* either strings, or other Exprs.
|
|
@@ -251,7 +251,7 @@ declare type TagElement = Expr | string;
|
|
|
251
251
|
* ```
|
|
252
252
|
*/
|
|
253
253
|
export declare function mkExpr(src: TemplateStringsArray, ...exprs: TagElement[]): Expr;
|
|
254
|
-
export
|
|
254
|
+
export type ExpressionType = 'scalar' | 'aggregate' | 'scalar_analytic' | 'aggregate_analytic' | 'ungrouped_aggregate';
|
|
255
255
|
export interface Expression {
|
|
256
256
|
e?: Expr;
|
|
257
257
|
expressionType?: ExpressionType;
|
|
@@ -269,12 +269,12 @@ export declare function maxOfExpressionTypes(types: ExpressionType[]): Expressio
|
|
|
269
269
|
interface JustExpression {
|
|
270
270
|
e: Expr;
|
|
271
271
|
}
|
|
272
|
-
|
|
272
|
+
type HasExpression = FieldDef & JustExpression;
|
|
273
273
|
/** Grants access to the expression property of a FieldDef */
|
|
274
274
|
export declare function hasExpression(f: FieldDef): f is HasExpression;
|
|
275
|
-
export
|
|
275
|
+
export type TimeFieldType = 'date' | 'timestamp';
|
|
276
276
|
export declare function isTimeFieldType(s: string): s is TimeFieldType;
|
|
277
|
-
export
|
|
277
|
+
export type AtomicFieldType = 'string' | 'number' | TimeFieldType | 'boolean' | 'unsupported' | 'json' | 'error';
|
|
278
278
|
export declare function isAtomicFieldType(s: string): s is AtomicFieldType;
|
|
279
279
|
/**
|
|
280
280
|
* Fields which contain scalar data all inherit from this. The field
|
|
@@ -313,11 +313,11 @@ export interface FieldUnsupportedDef extends FieldAtomicDef {
|
|
|
313
313
|
export interface FieldErrorDef extends FieldAtomicDef {
|
|
314
314
|
type: 'error';
|
|
315
315
|
}
|
|
316
|
-
export
|
|
316
|
+
export type DateUnit = 'day' | 'week' | 'month' | 'quarter' | 'year';
|
|
317
317
|
export declare function isDateUnit(str: string): str is DateUnit;
|
|
318
|
-
export
|
|
318
|
+
export type TimestampUnit = DateUnit | 'hour' | 'minute' | 'second';
|
|
319
319
|
export declare function isTimestampUnit(s: string): s is TimestampUnit;
|
|
320
|
-
export
|
|
320
|
+
export type ExtractUnit = TimestampUnit | 'day_of_week' | 'day_of_year';
|
|
321
321
|
export declare function isExtractUnit(s: string): s is ExtractUnit;
|
|
322
322
|
/** Value types distinguished by their usage in generated SQL, particularly with respect to filters. */
|
|
323
323
|
export declare enum ValueType {
|
|
@@ -326,7 +326,7 @@ export declare enum ValueType {
|
|
|
326
326
|
Number = "number",
|
|
327
327
|
String = "string"
|
|
328
328
|
}
|
|
329
|
-
export
|
|
329
|
+
export type TimeValueType = ValueType.Date | ValueType.Timestamp;
|
|
330
330
|
/** Scalar Date Field. */
|
|
331
331
|
export interface FieldDateDef extends FieldAtomicDef {
|
|
332
332
|
type: 'date';
|
|
@@ -350,11 +350,11 @@ export interface ByExpression {
|
|
|
350
350
|
by: 'expression';
|
|
351
351
|
e: Expr;
|
|
352
352
|
}
|
|
353
|
-
export
|
|
353
|
+
export type By = ByName | ByExpression;
|
|
354
354
|
export declare function isByName(by: By | undefined): by is ByName;
|
|
355
355
|
export declare function isByExpression(by: By | undefined): by is ByExpression;
|
|
356
356
|
/** reference to a data source */
|
|
357
|
-
export
|
|
357
|
+
export type StructRef = string | StructDef;
|
|
358
358
|
export declare function refIsStructDef(ref: StructRef): ref is StructDef;
|
|
359
359
|
/** join pattern structs is a struct. */
|
|
360
360
|
export interface JoinedStruct {
|
|
@@ -381,8 +381,8 @@ export interface Query extends Pipeline, Filtered, HasLocation {
|
|
|
381
381
|
annotation?: Annotation;
|
|
382
382
|
modelAnnotation?: Annotation;
|
|
383
383
|
}
|
|
384
|
-
export
|
|
385
|
-
export
|
|
384
|
+
export type NamedQuery = Query & NamedObject;
|
|
385
|
+
export type PipeSegment = QuerySegment | IndexSegment;
|
|
386
386
|
export interface ReduceSegment extends QuerySegment {
|
|
387
387
|
type: 'reduce';
|
|
388
388
|
}
|
|
@@ -392,7 +392,7 @@ export interface ProjectSegment extends QuerySegment {
|
|
|
392
392
|
}
|
|
393
393
|
export declare function isProjectSegment(pe: PipeSegment): pe is ProjectSegment;
|
|
394
394
|
export declare function isQuerySegment(pe: PipeSegment): pe is QuerySegment;
|
|
395
|
-
export
|
|
395
|
+
export type Sampling = SamplingRows | SamplingEnable | SamplingPercent;
|
|
396
396
|
interface SamplingRows {
|
|
397
397
|
rows: number;
|
|
398
398
|
}
|
|
@@ -426,14 +426,14 @@ export interface TurtleDef extends NamedObject, Pipeline {
|
|
|
426
426
|
type: 'turtle';
|
|
427
427
|
annotation?: Annotation;
|
|
428
428
|
}
|
|
429
|
-
export
|
|
429
|
+
export type JoinRelationship = 'one_to_one' | 'one_to_many' | 'many_to_one' | 'many_to_many';
|
|
430
430
|
export interface JoinOn {
|
|
431
431
|
type: 'one' | 'many' | 'cross';
|
|
432
432
|
onExpression?: Expr;
|
|
433
433
|
}
|
|
434
434
|
export declare function isJoinOn(sr: StructRelationship): sr is JoinOn;
|
|
435
435
|
/** types of joins. */
|
|
436
|
-
export
|
|
436
|
+
export type StructRelationship = {
|
|
437
437
|
type: 'basetable';
|
|
438
438
|
connectionName: string;
|
|
439
439
|
} | JoinOn | {
|
|
@@ -446,7 +446,7 @@ export declare type StructRelationship = {
|
|
|
446
446
|
export interface SQLFragment {
|
|
447
447
|
sql: string;
|
|
448
448
|
}
|
|
449
|
-
export
|
|
449
|
+
export type SQLPhrase = Query | SQLFragment;
|
|
450
450
|
export declare function isSQLFragment(f: SQLPhrase): f is SQLFragment;
|
|
451
451
|
/**
|
|
452
452
|
* A source reference to an SQL block. The compiler uses these to request
|
|
@@ -469,7 +469,7 @@ interface SubquerySource {
|
|
|
469
469
|
sqlBlock: SQLBlock;
|
|
470
470
|
}
|
|
471
471
|
/** where does the struct come from? */
|
|
472
|
-
export
|
|
472
|
+
export type StructSource = {
|
|
473
473
|
type: 'table';
|
|
474
474
|
tablePath: string;
|
|
475
475
|
} | {
|
|
@@ -498,8 +498,8 @@ export interface StructDef extends NamedObject, ResultStructMetadata, Filtered {
|
|
|
498
498
|
annotation?: Annotation;
|
|
499
499
|
modelAnnotation?: ModelAnnotation;
|
|
500
500
|
}
|
|
501
|
-
export
|
|
502
|
-
export
|
|
501
|
+
export type ExpressionValueType = AtomicFieldType | 'null' | 'duration' | 'any' | 'regular expression';
|
|
502
|
+
export type FieldValueType = ExpressionValueType | 'turtle' | 'struct';
|
|
503
503
|
export interface ExpressionTypeDesc {
|
|
504
504
|
dataType: FieldValueType;
|
|
505
505
|
expressionType: ExpressionType;
|
|
@@ -511,7 +511,7 @@ export interface FunctionParamTypeDesc {
|
|
|
511
511
|
expressionType: ExpressionType | undefined;
|
|
512
512
|
evalSpace: EvalSpace;
|
|
513
513
|
}
|
|
514
|
-
export
|
|
514
|
+
export type EvalSpace = 'constant' | 'input' | 'output' | 'literal';
|
|
515
515
|
export declare function mergeEvalSpaces(...evalSpaces: EvalSpace[]): EvalSpace;
|
|
516
516
|
export interface TypeDesc {
|
|
517
517
|
dataType: FieldValueType;
|
|
@@ -549,20 +549,20 @@ export interface SQLBlockStructDef extends StructDef {
|
|
|
549
549
|
}
|
|
550
550
|
export declare function isSQLBlockStruct(sd: StructDef): sd is SQLBlockStructDef;
|
|
551
551
|
/** any of the different field types */
|
|
552
|
-
export
|
|
552
|
+
export type FieldTypeDef = FieldStringDef | FieldDateDef | FieldTimestampDef | FieldNumberDef | FieldBooleanDef | FieldJSONDef | FieldUnsupportedDef | FieldErrorDef;
|
|
553
553
|
export declare function isFieldTypeDef(f: FieldDef): f is FieldTypeDef;
|
|
554
554
|
export declare function isFieldTimeBased(f: FieldDef): f is FieldTimestampDef | FieldDateDef;
|
|
555
555
|
export declare function isFieldStructDef(f: FieldDef): f is StructDef;
|
|
556
556
|
/** field reference in a query */
|
|
557
|
-
export
|
|
557
|
+
export type FieldTypeRef = string | FieldTypeDef | FilteredAliasedName;
|
|
558
558
|
/** field reference with with possibly and order by. */
|
|
559
|
-
export
|
|
559
|
+
export type QueryFieldDef = FieldTypeRef | TurtleDef;
|
|
560
560
|
/** basics statement */
|
|
561
|
-
export
|
|
561
|
+
export type FieldDef = FieldTypeDef | StructDef | TurtleDef;
|
|
562
562
|
/** reference to a field */
|
|
563
|
-
export
|
|
563
|
+
export type FieldRef = string | FieldDef;
|
|
564
564
|
/** which field is the primary key in this struct */
|
|
565
|
-
export
|
|
565
|
+
export type PrimaryKeyRef = string;
|
|
566
566
|
/** filters */
|
|
567
567
|
export interface FilterExpression {
|
|
568
568
|
expression: Expr;
|
|
@@ -571,7 +571,7 @@ export interface FilterExpression {
|
|
|
571
571
|
}
|
|
572
572
|
/** Get the output name for a NamedObject */
|
|
573
573
|
export declare function getIdentifier(n: AliasedName): string;
|
|
574
|
-
export
|
|
574
|
+
export type NamedModelObject = StructDef | NamedQuery | FunctionDef | ConnectionDef;
|
|
575
575
|
/** Result of parsing a model file */
|
|
576
576
|
export interface ModelDef {
|
|
577
577
|
name: string;
|
|
@@ -580,8 +580,8 @@ export interface ModelDef {
|
|
|
580
580
|
annotation?: ModelAnnotation;
|
|
581
581
|
}
|
|
582
582
|
/** Very common record type */
|
|
583
|
-
export
|
|
584
|
-
export
|
|
583
|
+
export type NamedStructDefs = Record<string, StructDef>;
|
|
584
|
+
export type NamedModelObjects = Record<string, NamedModelObject>;
|
|
585
585
|
/** Malloy source annotations attached to objects */
|
|
586
586
|
export interface Annotation {
|
|
587
587
|
inherits?: Annotation;
|
|
@@ -596,21 +596,21 @@ export interface Note {
|
|
|
596
596
|
export interface ModelAnnotation extends Annotation {
|
|
597
597
|
id: string;
|
|
598
598
|
}
|
|
599
|
-
export
|
|
599
|
+
export type QueryScalar = string | boolean | number | Date | Buffer | null;
|
|
600
600
|
/** One value in one column of returned data. */
|
|
601
|
-
export
|
|
601
|
+
export type QueryValue = QueryScalar | QueryData | QueryDataRow;
|
|
602
602
|
/** A row of returned data. */
|
|
603
|
-
export
|
|
603
|
+
export type QueryDataRow = {
|
|
604
604
|
[columnName: string]: QueryValue;
|
|
605
605
|
};
|
|
606
606
|
/** Returned query data. */
|
|
607
|
-
export
|
|
607
|
+
export type QueryData = QueryDataRow[];
|
|
608
608
|
/** Query execution stats. */
|
|
609
|
-
export
|
|
609
|
+
export type QueryRunStats = {
|
|
610
610
|
queryCostBytes?: number;
|
|
611
611
|
};
|
|
612
612
|
/** Returned Malloy query data */
|
|
613
|
-
export
|
|
613
|
+
export type MalloyQueryData = {
|
|
614
614
|
rows: QueryDataRow[];
|
|
615
615
|
totalRows: number;
|
|
616
616
|
runStats?: QueryRunStats;
|
|
@@ -642,7 +642,7 @@ export interface SearchResultRow {
|
|
|
642
642
|
field_value: string;
|
|
643
643
|
weight: number;
|
|
644
644
|
}
|
|
645
|
-
export
|
|
645
|
+
export type SearchResult = SearchResultRow[];
|
|
646
646
|
export declare function isDimensional(field: FieldDef): boolean;
|
|
647
647
|
export declare function isPhysical(field: FieldDef): boolean;
|
|
648
648
|
export declare function getDimensions(structDef: StructDef): FieldAtomicDef[];
|
|
@@ -258,7 +258,7 @@ var ValueType;
|
|
|
258
258
|
ValueType["Timestamp"] = "timestamp";
|
|
259
259
|
ValueType["Number"] = "number";
|
|
260
260
|
ValueType["String"] = "string";
|
|
261
|
-
})(ValueType
|
|
261
|
+
})(ValueType || (exports.ValueType = ValueType = {}));
|
|
262
262
|
function isByName(by) {
|
|
263
263
|
if (by === undefined) {
|
|
264
264
|
return false;
|
package/dist/runtime_types.d.ts
CHANGED
|
@@ -4,19 +4,19 @@ import { Dialect } from './dialect';
|
|
|
4
4
|
/**
|
|
5
5
|
* The contents of a Malloy query document.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type QueryString = string;
|
|
8
8
|
/**
|
|
9
9
|
* The contents of a Malloy model document.
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export type ModelString = string;
|
|
12
12
|
/**
|
|
13
13
|
* A URL whose contents is a Malloy model.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export type ModelURL = URL;
|
|
16
16
|
/**
|
|
17
17
|
* A URL whose contents is a Malloy query.
|
|
18
18
|
*/
|
|
19
|
-
export
|
|
19
|
+
export type QueryURL = URL;
|
|
20
20
|
/**
|
|
21
21
|
* An object capable of reading the contents of a URL in some context.
|
|
22
22
|
*/
|
|
@@ -62,7 +62,7 @@ export interface InfoConnection {
|
|
|
62
62
|
*/
|
|
63
63
|
get name(): string;
|
|
64
64
|
}
|
|
65
|
-
export
|
|
65
|
+
export type ConnectionParameterValue = string | number | boolean;
|
|
66
66
|
export interface ConnectionParameter {
|
|
67
67
|
name: string;
|
|
68
68
|
label: string;
|
|
@@ -71,8 +71,8 @@ export interface ConnectionParameter {
|
|
|
71
71
|
isSecret?: boolean;
|
|
72
72
|
defaultValue?: ConnectionParameterValue;
|
|
73
73
|
}
|
|
74
|
-
export
|
|
75
|
-
export
|
|
74
|
+
export type ConnectionConfigSchema = ConnectionParameter[];
|
|
75
|
+
export type ConnectionConfig = Record<string, ConnectionParameterValue>;
|
|
76
76
|
export interface ConnectionFactory {
|
|
77
77
|
connectionName: string;
|
|
78
78
|
configSchema: ConnectionConfigSchema;
|
package/dist/tags.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LogMessage } from './lang';
|
|
2
2
|
import { Annotation } from './model';
|
|
3
|
-
export
|
|
4
|
-
|
|
3
|
+
export type TagDict = Record<string, TagInterface>;
|
|
4
|
+
type TagValue = string | TagInterface[];
|
|
5
5
|
export interface TagInterface {
|
|
6
6
|
eq?: TagValue;
|
|
7
7
|
properties?: TagDict;
|
package/dist/tags.js
CHANGED
|
@@ -48,14 +48,6 @@ const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
|
48
48
|
* ```
|
|
49
49
|
*/
|
|
50
50
|
class Tag {
|
|
51
|
-
constructor(from = {}) {
|
|
52
|
-
if (from.eq) {
|
|
53
|
-
this.eq = from.eq;
|
|
54
|
-
}
|
|
55
|
-
if (from.properties) {
|
|
56
|
-
this.properties = from.properties;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
51
|
static tagFrom(from = {}) {
|
|
60
52
|
if (from instanceof Tag) {
|
|
61
53
|
return from;
|
|
@@ -152,6 +144,14 @@ class Tag {
|
|
|
152
144
|
}
|
|
153
145
|
return { tag: extending, log: allErrs };
|
|
154
146
|
}
|
|
147
|
+
constructor(from = {}) {
|
|
148
|
+
if (from.eq) {
|
|
149
|
+
this.eq = from.eq;
|
|
150
|
+
}
|
|
151
|
+
if (from.properties) {
|
|
152
|
+
this.properties = from.properties;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
155
|
find(at) {
|
|
156
156
|
let lookAt = Tag.tagFrom(this);
|
|
157
157
|
for (const seg of at) {
|