@malloydata/malloy 0.0.281 → 0.0.283
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/api/core.js +16 -4
- package/dist/api/util.d.ts +3 -1
- package/dist/api/util.js +63 -5
- package/dist/dialect/dialect.d.ts +10 -1
- package/dist/dialect/dialect.js +19 -2
- package/dist/dialect/mysql/mysql.d.ts +2 -2
- package/dist/dialect/mysql/mysql.js +1 -1
- package/dist/dialect/standardsql/dialect_functions.js +22 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -2
- package/dist/lang/ast/expressions/boolean.d.ts +2 -0
- package/dist/lang/ast/expressions/boolean.js +6 -0
- package/dist/lang/ast/expressions/expr-not.js +1 -1
- package/dist/lang/ast/expressions/expr-number.d.ts +2 -0
- package/dist/lang/ast/expressions/expr-number.js +6 -0
- package/dist/lang/ast/expressions/expr-string.d.ts +2 -0
- package/dist/lang/ast/expressions/expr-string.js +6 -22
- package/dist/lang/ast/expressions/time-literal.d.ts +9 -2
- package/dist/lang/ast/expressions/time-literal.js +52 -7
- package/dist/lang/ast/field-space/def-space.d.ts +16 -0
- package/dist/lang/ast/field-space/def-space.js +39 -0
- package/dist/lang/ast/field-space/passthrough-space.d.ts +21 -0
- package/dist/lang/ast/field-space/passthrough-space.js +56 -0
- package/dist/lang/ast/field-space/permissive-space.d.ts +11 -0
- package/dist/lang/ast/field-space/permissive-space.js +23 -0
- package/dist/lang/ast/field-space/query-spaces.d.ts +6 -0
- package/dist/lang/ast/field-space/query-spaces.js +6 -0
- package/dist/lang/ast/index.d.ts +2 -0
- package/dist/lang/ast/index.js +2 -0
- package/dist/lang/ast/query-builders/reduce-builder.js +3 -1
- package/dist/lang/ast/query-items/field-declaration.d.ts +3 -26
- package/dist/lang/ast/query-items/field-declaration.js +21 -65
- package/dist/lang/ast/query-items/field-references.d.ts +4 -0
- package/dist/lang/ast/query-items/field-references.js +12 -1
- package/dist/lang/ast/query-properties/drill.d.ts +25 -0
- package/dist/lang/ast/query-properties/drill.js +326 -0
- package/dist/lang/ast/query-properties/filters.d.ts +11 -0
- package/dist/lang/ast/query-properties/filters.js +57 -0
- package/dist/lang/ast/query-properties/nest.js +3 -1
- package/dist/lang/ast/source-elements/named-source.js +7 -4
- package/dist/lang/ast/types/literal.d.ts +7 -0
- package/dist/lang/ast/types/literal.js +24 -0
- package/dist/lang/ast/view-elements/reference-view.js +2 -0
- package/dist/lang/lib/Malloy/MalloyLexer.d.ts +165 -164
- package/dist/lang/lib/Malloy/MalloyLexer.js +1095 -1085
- package/dist/lang/lib/Malloy/MalloyParser.d.ts +262 -236
- package/dist/lang/lib/Malloy/MalloyParser.js +2271 -2084
- package/dist/lang/lib/Malloy/MalloyParserListener.d.ts +22 -0
- package/dist/lang/lib/Malloy/MalloyParserVisitor.d.ts +14 -0
- package/dist/lang/malloy-to-ast.d.ts +2 -0
- package/dist/lang/malloy-to-ast.js +8 -0
- package/dist/lang/malloy-to-stable-query.d.ts +7 -1
- package/dist/lang/malloy-to-stable-query.js +191 -8
- package/dist/lang/parse-log.d.ts +14 -0
- package/dist/lang/test/expr-to-str.js +2 -0
- package/dist/lang/test/parse-expects.d.ts +1 -0
- package/dist/lang/test/parse-expects.js +8 -0
- package/dist/malloy.d.ts +2 -1
- package/dist/malloy.js +3 -0
- package/dist/model/composite_source_utils.d.ts +1 -0
- package/dist/model/composite_source_utils.js +4 -0
- package/dist/model/malloy_query.d.ts +2 -2
- package/dist/model/malloy_query.js +31 -22
- package/dist/model/malloy_types.d.ts +8 -0
- package/dist/to_stable.d.ts +2 -0
- package/dist/to_stable.js +77 -16
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
|
@@ -1716,7 +1716,7 @@ class QueryQuery extends QueryField {
|
|
|
1716
1716
|
// get a field ref and expand it.
|
|
1717
1717
|
expandField(f) {
|
|
1718
1718
|
const field = f.type === 'fieldref'
|
|
1719
|
-
? this.parent.getQueryFieldReference(f
|
|
1719
|
+
? this.parent.getQueryFieldReference(f)
|
|
1720
1720
|
: this.parent.makeQueryField(f);
|
|
1721
1721
|
const as = field.getIdentifier();
|
|
1722
1722
|
return { as, field };
|
|
@@ -1984,6 +1984,7 @@ class QueryQuery extends QueryField {
|
|
|
1984
1984
|
const lastSegment = fi.turtleDef.pipeline[fi.turtleDef.pipeline.length - 1];
|
|
1985
1985
|
const limit = (0, malloy_types_1.isRawSegment)(lastSegment) ? undefined : lastSegment.limit;
|
|
1986
1986
|
let orderBy = undefined;
|
|
1987
|
+
const drillable = (0, malloy_types_1.isQuerySegment)(lastSegment) && fi.turtleDef.pipeline.length === 1;
|
|
1987
1988
|
if ((0, malloy_types_1.isQuerySegment)(lastSegment)) {
|
|
1988
1989
|
orderBy = lastSegment.orderBy;
|
|
1989
1990
|
}
|
|
@@ -1995,6 +1996,7 @@ class QueryQuery extends QueryField {
|
|
|
1995
1996
|
fieldKind: 'struct',
|
|
1996
1997
|
limit,
|
|
1997
1998
|
orderBy,
|
|
1999
|
+
drillable,
|
|
1998
2000
|
};
|
|
1999
2001
|
}
|
|
2000
2002
|
}
|
|
@@ -2018,6 +2020,7 @@ class QueryQuery extends QueryField {
|
|
|
2018
2020
|
join: 'many',
|
|
2019
2021
|
name,
|
|
2020
2022
|
resultMetadata,
|
|
2023
|
+
drillView: fi.turtleDef.drillView,
|
|
2021
2024
|
};
|
|
2022
2025
|
fields.push(multiLineNest);
|
|
2023
2026
|
}
|
|
@@ -2028,6 +2031,7 @@ class QueryQuery extends QueryField {
|
|
|
2028
2031
|
join: 'one',
|
|
2029
2032
|
name,
|
|
2030
2033
|
resultMetadata,
|
|
2034
|
+
drillView: fi.turtleDef.drillView,
|
|
2031
2035
|
};
|
|
2032
2036
|
fields.push(oneLineNest);
|
|
2033
2037
|
}
|
|
@@ -2056,6 +2060,13 @@ class QueryQuery extends QueryField {
|
|
|
2056
2060
|
}
|
|
2057
2061
|
const location = fOut.location;
|
|
2058
2062
|
const annotation = fOut.annotation;
|
|
2063
|
+
const drillView = (0, malloy_types_1.isAtomic)(fOut) || (0, malloy_types_1.isTurtle)(fOut) ? fOut.drillView : undefined;
|
|
2064
|
+
const common = {
|
|
2065
|
+
resultMetadata,
|
|
2066
|
+
location,
|
|
2067
|
+
annotation,
|
|
2068
|
+
drillView,
|
|
2069
|
+
};
|
|
2059
2070
|
// build out the result fields...
|
|
2060
2071
|
switch (fOut.type) {
|
|
2061
2072
|
case 'boolean':
|
|
@@ -2064,9 +2075,7 @@ class QueryQuery extends QueryField {
|
|
|
2064
2075
|
fields.push({
|
|
2065
2076
|
name,
|
|
2066
2077
|
type: fOut.type,
|
|
2067
|
-
|
|
2068
|
-
location,
|
|
2069
|
-
annotation,
|
|
2078
|
+
...common,
|
|
2070
2079
|
});
|
|
2071
2080
|
break;
|
|
2072
2081
|
case 'date':
|
|
@@ -2079,9 +2088,7 @@ class QueryQuery extends QueryField {
|
|
|
2079
2088
|
fields.push({
|
|
2080
2089
|
name,
|
|
2081
2090
|
...fd,
|
|
2082
|
-
|
|
2083
|
-
location,
|
|
2084
|
-
annotation,
|
|
2091
|
+
...common,
|
|
2085
2092
|
});
|
|
2086
2093
|
break;
|
|
2087
2094
|
}
|
|
@@ -2090,15 +2097,13 @@ class QueryQuery extends QueryField {
|
|
|
2090
2097
|
name,
|
|
2091
2098
|
numberType: fOut.numberType,
|
|
2092
2099
|
type: 'number',
|
|
2093
|
-
|
|
2094
|
-
location,
|
|
2095
|
-
annotation,
|
|
2100
|
+
...common,
|
|
2096
2101
|
});
|
|
2097
2102
|
break;
|
|
2098
2103
|
case 'sql native':
|
|
2099
2104
|
case 'record':
|
|
2100
2105
|
case 'array': {
|
|
2101
|
-
fields.push({ ...fOut,
|
|
2106
|
+
fields.push({ ...fOut, ...common });
|
|
2102
2107
|
break;
|
|
2103
2108
|
}
|
|
2104
2109
|
default:
|
|
@@ -2830,6 +2835,7 @@ class QueryQuery extends QueryField {
|
|
|
2830
2835
|
type: 'turtle',
|
|
2831
2836
|
name: 'starthere',
|
|
2832
2837
|
pipeline,
|
|
2838
|
+
drillView: fi.turtleDef.drillView,
|
|
2833
2839
|
};
|
|
2834
2840
|
const inputStruct = {
|
|
2835
2841
|
type: 'nest_source',
|
|
@@ -3254,11 +3260,10 @@ class QueryStruct {
|
|
|
3254
3260
|
? null
|
|
3255
3261
|
: (0, utils_1.exprMap)(param.value, frag => {
|
|
3256
3262
|
if (frag.node === 'parameter') {
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
const resolved2 = this.parent.resolveParentParameterReferences(resolved1);
|
|
3263
|
+
const resolved1 = (this.parent ? this.parent.arguments() : this.arguments())[frag.path[0]];
|
|
3264
|
+
const resolved2 = this.parent
|
|
3265
|
+
? this.parent.resolveParentParameterReferences(resolved1)
|
|
3266
|
+
: resolved1;
|
|
3262
3267
|
if (resolved2.value === null) {
|
|
3263
3268
|
throw new Error('Invalid parameter value');
|
|
3264
3269
|
}
|
|
@@ -3609,20 +3614,21 @@ class QueryStruct {
|
|
|
3609
3614
|
}
|
|
3610
3615
|
return field;
|
|
3611
3616
|
}
|
|
3612
|
-
getQueryFieldReference(
|
|
3617
|
+
getQueryFieldReference(f) {
|
|
3618
|
+
const { path, annotation, drillView } = f;
|
|
3613
3619
|
const field = this.getFieldByName(path);
|
|
3614
|
-
if (annotation) {
|
|
3620
|
+
if (annotation || drillView) {
|
|
3615
3621
|
if (field.parent === undefined) {
|
|
3616
3622
|
throw new Error('Inconcievable, field reference to orphaned query field');
|
|
3617
3623
|
}
|
|
3618
3624
|
// Made a field object from the source, but the annotations were computed by the compiler
|
|
3619
3625
|
// when it generated the reference, and has both the source and reference annotations included.
|
|
3620
3626
|
if (field instanceof QueryFieldStruct) {
|
|
3621
|
-
const newDef = { ...field.fieldDef, annotation };
|
|
3627
|
+
const newDef = { ...field.fieldDef, annotation, drillView };
|
|
3622
3628
|
return new QueryFieldStruct(newDef, undefined, field.parent, {}, field.referenceId);
|
|
3623
3629
|
}
|
|
3624
3630
|
else {
|
|
3625
|
-
const newDef = { ...field.fieldDef, annotation };
|
|
3631
|
+
const newDef = { ...field.fieldDef, annotation, drillView };
|
|
3626
3632
|
return field.parent.makeQueryField(newDef, field.referenceId);
|
|
3627
3633
|
}
|
|
3628
3634
|
}
|
|
@@ -3677,6 +3683,7 @@ class QueryStruct {
|
|
|
3677
3683
|
pipeline,
|
|
3678
3684
|
annotation,
|
|
3679
3685
|
location: turtleDef.location,
|
|
3686
|
+
drillView: turtleDef.drillView,
|
|
3680
3687
|
};
|
|
3681
3688
|
return flatTurtleDef;
|
|
3682
3689
|
}
|
|
@@ -3795,7 +3802,7 @@ class QueryModel {
|
|
|
3795
3802
|
};
|
|
3796
3803
|
}
|
|
3797
3804
|
compileQuery(query, prepareResultOptions, finalize = true) {
|
|
3798
|
-
var _a, _b;
|
|
3805
|
+
var _a, _b, _c;
|
|
3799
3806
|
let newModel;
|
|
3800
3807
|
const addDefaultRowLimit = this.addDefaultRowLimit(query, prepareResultOptions === null || prepareResultOptions === void 0 ? void 0 : prepareResultOptions.defaultRowLimit);
|
|
3801
3808
|
query = addDefaultRowLimit.query;
|
|
@@ -3806,6 +3813,7 @@ class QueryModel {
|
|
|
3806
3813
|
const sourceExplore = typeof structRef === 'string'
|
|
3807
3814
|
? structRef
|
|
3808
3815
|
: structRef.as || structRef.name;
|
|
3816
|
+
const sourceArguments = (_b = query.sourceArguments) !== null && _b !== void 0 ? _b : (typeof structRef === 'string' ? undefined : structRef.arguments);
|
|
3809
3817
|
// LTNote: I don't understand why this might be here. It should have happened in loadQuery...
|
|
3810
3818
|
if (finalize && this.dialect.hasFinalStage) {
|
|
3811
3819
|
ret.lastStageName = ret.stageWriter.addStage(
|
|
@@ -3818,11 +3826,12 @@ class QueryModel {
|
|
|
3818
3826
|
sql: ret.stageWriter.generateSQLStages(),
|
|
3819
3827
|
dependenciesToMaterialize: ret.stageWriter.dependenciesToMaterialize,
|
|
3820
3828
|
materialization: (0, utils_2.shouldMaterialize)(query.annotation)
|
|
3821
|
-
? (0, utils_2.buildQueryMaterializationSpec)((
|
|
3829
|
+
? (0, utils_2.buildQueryMaterializationSpec)((_c = query.location) === null || _c === void 0 ? void 0 : _c.url, query.name, prepareResultOptions === null || prepareResultOptions === void 0 ? void 0 : prepareResultOptions.materializedTablePrefix)
|
|
3822
3830
|
: undefined,
|
|
3823
3831
|
structs: ret.structs,
|
|
3824
3832
|
sourceExplore,
|
|
3825
3833
|
sourceFilters: query.filterList,
|
|
3834
|
+
sourceArguments,
|
|
3826
3835
|
queryName: query.name,
|
|
3827
3836
|
connectionName: ret.connectionName,
|
|
3828
3837
|
annotation: query.annotation,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Filter } from '@malloydata/malloy-interfaces';
|
|
1
2
|
/**
|
|
2
3
|
* Field computations are compiled into an expression tree of "Expr"
|
|
3
4
|
* type nodes. Each node is one of these three interfaces. The
|
|
@@ -59,6 +60,8 @@ export interface FilterCondition extends ExprE {
|
|
|
59
60
|
code: string;
|
|
60
61
|
expressionType: ExpressionType;
|
|
61
62
|
fieldUsage?: FieldUsage[];
|
|
63
|
+
drillView?: string;
|
|
64
|
+
stableFilter?: Filter;
|
|
62
65
|
}
|
|
63
66
|
export interface FilteredExpr extends ExprWithKids {
|
|
64
67
|
node: 'filteredExpr';
|
|
@@ -339,6 +342,7 @@ export interface ResultMetadataDef {
|
|
|
339
342
|
filterList?: FilterCondition[];
|
|
340
343
|
fieldKind: 'measure' | 'dimension' | 'struct';
|
|
341
344
|
referenceId?: string;
|
|
345
|
+
drillable?: boolean;
|
|
342
346
|
}
|
|
343
347
|
export interface Ordered {
|
|
344
348
|
orderBy?: OrderBy[];
|
|
@@ -384,6 +388,7 @@ export interface FieldBase extends NamedObject, Expression, ResultMetadata {
|
|
|
384
388
|
accessModifier?: NonDefaultAccessModifierLabel | undefined;
|
|
385
389
|
requiresGroupBy?: RequiredGroupBy[];
|
|
386
390
|
ungroupings?: AggregateUngrouping[];
|
|
391
|
+
drillView?: string;
|
|
387
392
|
}
|
|
388
393
|
export declare function fieldIsIntrinsic(f: FieldDef): f is AtomicFieldDef;
|
|
389
394
|
export interface StringTypeDef {
|
|
@@ -604,6 +609,7 @@ export interface TurtleDef extends NamedObject, Pipeline {
|
|
|
604
609
|
accessModifier?: NonDefaultAccessModifierLabel | undefined;
|
|
605
610
|
fieldUsage?: FieldUsage[];
|
|
606
611
|
requiredGroupBys?: string[][];
|
|
612
|
+
drillView?: string;
|
|
607
613
|
}
|
|
608
614
|
interface StructDefBase extends HasLocation, NamedObject {
|
|
609
615
|
type: string;
|
|
@@ -781,6 +787,7 @@ export interface RefToField {
|
|
|
781
787
|
path: string[];
|
|
782
788
|
annotation?: Annotation;
|
|
783
789
|
at?: DocumentLocation;
|
|
790
|
+
drillView?: string;
|
|
784
791
|
}
|
|
785
792
|
export type QueryFieldDef = AtomicFieldDef | TurtleDef | RefToField;
|
|
786
793
|
export type TypedDef = AtomicTypeDef | JoinFieldDef | TurtleDef | RefToField | StructDef;
|
|
@@ -841,6 +848,7 @@ export type MalloyQueryData = {
|
|
|
841
848
|
export interface DrillSource {
|
|
842
849
|
sourceExplore: string;
|
|
843
850
|
sourceFilters?: FilterCondition[];
|
|
851
|
+
sourceArguments?: Record<string, Argument>;
|
|
844
852
|
}
|
|
845
853
|
export type QueryToMaterialize = {
|
|
846
854
|
id: string;
|
package/dist/to_stable.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type * as Malloy from '@malloydata/malloy-interfaces';
|
|
2
2
|
import type { FieldDef, ModelDef, ResultStructMetadataDef, SourceDef } from './model';
|
|
3
|
+
import { Tag } from '@malloydata/malloy-tag';
|
|
3
4
|
export declare function sourceDefToSourceInfo(sourceDef: SourceDef): Malloy.SourceInfo;
|
|
4
5
|
export declare function modelDefToModelInfo(modelDef: ModelDef): Malloy.ModelInfo;
|
|
5
6
|
export declare function convertFieldInfos(source: SourceDef, fields: FieldDef[]): Malloy.FieldInfo[];
|
|
7
|
+
export declare function writeLiteralToTag(tag: Tag, path: (string | number)[], literal: Malloy.LiteralValue): void;
|
|
6
8
|
export declare function getResultStructMetadataAnnotation(field: SourceDef, resultMetadata: ResultStructMetadataDef): Malloy.Annotation | undefined;
|
package/dist/to_stable.js
CHANGED
|
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.sourceDefToSourceInfo = sourceDefToSourceInfo;
|
|
10
10
|
exports.modelDefToModelInfo = modelDefToModelInfo;
|
|
11
11
|
exports.convertFieldInfos = convertFieldInfos;
|
|
12
|
+
exports.writeLiteralToTag = writeLiteralToTag;
|
|
12
13
|
exports.getResultStructMetadataAnnotation = getResultStructMetadataAnnotation;
|
|
13
14
|
const model_1 = require("./model");
|
|
14
15
|
const malloy_query_1 = require("./model/malloy_query");
|
|
@@ -205,6 +206,7 @@ function convertFieldInfos(source, fields) {
|
|
|
205
206
|
return result;
|
|
206
207
|
}
|
|
207
208
|
function getResultMetadataAnnotation(field, resultMetadata) {
|
|
209
|
+
var _a;
|
|
208
210
|
const tag = malloy_tag_1.Tag.withPrefix('#(malloy) ');
|
|
209
211
|
let hasAny = false;
|
|
210
212
|
if (resultMetadata.referenceId !== undefined) {
|
|
@@ -215,11 +217,19 @@ function getResultMetadataAnnotation(field, resultMetadata) {
|
|
|
215
217
|
tag.set(['calculation']);
|
|
216
218
|
hasAny = true;
|
|
217
219
|
}
|
|
218
|
-
if (resultMetadata.
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
220
|
+
if (resultMetadata.drillable) {
|
|
221
|
+
tag.set(['drillable']);
|
|
222
|
+
hasAny = true;
|
|
223
|
+
}
|
|
224
|
+
if ((0, model_1.isAtomic)(field) || (0, model_1.isTurtle)(field)) {
|
|
225
|
+
if (field.drillView !== undefined) {
|
|
226
|
+
tag.set(['drill_view'], field.drillView);
|
|
227
|
+
hasAny = true;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
const drillFilters = (_a = resultMetadata.filterList) === null || _a === void 0 ? void 0 : _a.filter(f => f.expressionType === 'scalar');
|
|
231
|
+
if (drillFilters) {
|
|
232
|
+
addDrillFiltersTag(tag, drillFilters);
|
|
223
233
|
hasAny = true;
|
|
224
234
|
}
|
|
225
235
|
if (resultMetadata.fieldKind === 'dimension') {
|
|
@@ -239,6 +249,57 @@ function getResultMetadataAnnotation(field, resultMetadata) {
|
|
|
239
249
|
}
|
|
240
250
|
: undefined;
|
|
241
251
|
}
|
|
252
|
+
function addDrillFiltersTag(tag, drillFilters) {
|
|
253
|
+
var _a;
|
|
254
|
+
for (let i = 0; i < drillFilters.length; i++) {
|
|
255
|
+
const filter = drillFilters[i];
|
|
256
|
+
tag.set(['drill_filters', i, 'code'], filter.code);
|
|
257
|
+
if (filter.drillView) {
|
|
258
|
+
tag.set(['drill_filters', i, 'drill_view'], filter.drillView);
|
|
259
|
+
}
|
|
260
|
+
if (filter.drillView === undefined && filter.stableFilter !== undefined) {
|
|
261
|
+
tag.set(['drill_filters', i, 'field_reference'], [
|
|
262
|
+
...((_a = filter.stableFilter.field_reference.path) !== null && _a !== void 0 ? _a : []),
|
|
263
|
+
filter.stableFilter.field_reference.name,
|
|
264
|
+
]);
|
|
265
|
+
if (filter.stableFilter.kind === 'filter_string') {
|
|
266
|
+
tag.set(['drill_filters', i, 'kind'], 'filter_expression');
|
|
267
|
+
tag.set(['drill_filters', i, 'filter_expression'], filter.stableFilter.filter);
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
tag.set(['drill_filters', i, 'kind'], 'literal_equality');
|
|
271
|
+
writeLiteralToTag(tag, ['drill_filters', i, 'value'], filter.stableFilter.value);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
function writeLiteralToTag(tag, path, literal) {
|
|
277
|
+
tag.set([...path, 'kind'], literal.kind);
|
|
278
|
+
switch (literal.kind) {
|
|
279
|
+
case 'string_literal':
|
|
280
|
+
tag.set([...path, 'string_value'], literal.string_value);
|
|
281
|
+
break;
|
|
282
|
+
case 'number_literal':
|
|
283
|
+
tag.set([...path, 'number_value'], literal.number_value);
|
|
284
|
+
break;
|
|
285
|
+
case 'boolean_literal':
|
|
286
|
+
tag.set([...path, 'boolean_value'], literal.boolean_value.toString());
|
|
287
|
+
break;
|
|
288
|
+
case 'date_literal':
|
|
289
|
+
tag.set([...path, 'date_value'], literal.date_value);
|
|
290
|
+
tag.set([...path, 'timezone'], literal.timezone);
|
|
291
|
+
tag.set([...path, 'granularity'], literal.granularity);
|
|
292
|
+
break;
|
|
293
|
+
case 'timestamp_literal':
|
|
294
|
+
tag.set([...path, 'timestamp_value'], literal.timestamp_value);
|
|
295
|
+
tag.set([...path, 'timezone'], literal.timezone);
|
|
296
|
+
tag.set([...path, 'granularity'], literal.granularity);
|
|
297
|
+
break;
|
|
298
|
+
case 'filter_expression_literal':
|
|
299
|
+
tag.set([...path, 'filter_expression_value'], literal.filter_expression_value);
|
|
300
|
+
break;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
242
303
|
function escapeIdentifier(str) {
|
|
243
304
|
return str.replace(/\\/g, '\\\\').replace(/`/g, '\\`');
|
|
244
305
|
}
|
|
@@ -248,29 +309,29 @@ function identifierCode(name) {
|
|
|
248
309
|
return `\`${escapeIdentifier(name)}\``;
|
|
249
310
|
}
|
|
250
311
|
function getResultStructMetadataAnnotation(field, resultMetadata) {
|
|
251
|
-
var _a, _b;
|
|
312
|
+
var _a, _b, _c;
|
|
252
313
|
const tag = malloy_tag_1.Tag.withPrefix('#(malloy) ');
|
|
253
314
|
let hasAny = false;
|
|
254
315
|
if (resultMetadata.limit !== undefined) {
|
|
255
316
|
tag.set(['limit'], resultMetadata.limit);
|
|
256
317
|
hasAny = true;
|
|
257
318
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
319
|
+
const drillFilters = (_a = resultMetadata.filterList) === null || _a === void 0 ? void 0 : _a.filter(f => f.expressionType === 'scalar');
|
|
320
|
+
if (drillFilters) {
|
|
321
|
+
addDrillFiltersTag(tag, drillFilters);
|
|
322
|
+
hasAny = true;
|
|
323
|
+
}
|
|
324
|
+
if (resultMetadata.drillable) {
|
|
325
|
+
tag.set(['drillable']);
|
|
326
|
+
hasAny = true;
|
|
266
327
|
}
|
|
267
328
|
if (resultMetadata.orderBy) {
|
|
268
329
|
for (let i = 0; i < resultMetadata.orderBy.length; i++) {
|
|
269
330
|
const orderBy = resultMetadata.orderBy[i];
|
|
270
331
|
const orderByField = typeof orderBy.field === 'number'
|
|
271
|
-
? (
|
|
332
|
+
? (_b = field.fields[orderBy.field - 1].as) !== null && _b !== void 0 ? _b : field.fields[orderBy.field - 1].name
|
|
272
333
|
: orderBy.field;
|
|
273
|
-
const direction = (
|
|
334
|
+
const direction = (_c = orderBy.dir) !== null && _c !== void 0 ? _c : null;
|
|
274
335
|
tag.set(['ordered_by', i, orderByField], direction);
|
|
275
336
|
}
|
|
276
337
|
hasAny = true;
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const MALLOY_VERSION = "0.0.
|
|
1
|
+
export declare const MALLOY_VERSION = "0.0.283";
|
package/dist/version.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MALLOY_VERSION = void 0;
|
|
4
4
|
// generated with 'generate-version-file' script; do not edit manually
|
|
5
|
-
exports.MALLOY_VERSION = '0.0.
|
|
5
|
+
exports.MALLOY_VERSION = '0.0.283';
|
|
6
6
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/malloy",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.283",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.js",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"generate-version-file": "VERSION=$(npm pkg get version --workspaces=false | tr -d \\\")\necho \"// generated with 'generate-version-file' script; do not edit manually\\nexport const MALLOY_VERSION = '$VERSION';\" > src/version.ts"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@malloydata/malloy-filter": "0.0.
|
|
45
|
-
"@malloydata/malloy-interfaces": "0.0.
|
|
46
|
-
"@malloydata/malloy-tag": "0.0.
|
|
44
|
+
"@malloydata/malloy-filter": "0.0.283",
|
|
45
|
+
"@malloydata/malloy-interfaces": "0.0.283",
|
|
46
|
+
"@malloydata/malloy-tag": "0.0.283",
|
|
47
47
|
"antlr4ts": "^0.5.0-alpha.4",
|
|
48
48
|
"assert": "^2.0.0",
|
|
49
49
|
"jaro-winkler": "^0.2.8",
|