@malloydata/malloy 0.0.22-dev230207182613 → 0.0.22-dev230207183024
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/connection_utils.js +7 -7
- package/dist/dialect/dialect.d.ts +1 -1
- package/dist/dialect/duckdb.d.ts +1 -1
- package/dist/dialect/duckdb.js +9 -9
- package/dist/dialect/postgres.d.ts +1 -1
- package/dist/dialect/postgres.js +16 -16
- package/dist/dialect/standardsql.d.ts +1 -1
- package/dist/dialect/standardsql.js +8 -8
- package/dist/index.d.ts +6 -6
- package/dist/lang/ast/ast-utils.js +3 -3
- package/dist/lang/ast/elements/define-query.js +4 -4
- package/dist/lang/ast/elements/define-source.d.ts +1 -1
- package/dist/lang/ast/elements/define-source.js +8 -8
- package/dist/lang/ast/elements/import-statement.js +2 -2
- package/dist/lang/ast/elements/pipeline-desc.d.ts +1 -1
- package/dist/lang/ast/elements/pipeline-desc.js +7 -7
- package/dist/lang/ast/elements/refined-source.d.ts +1 -1
- package/dist/lang/ast/elements/refined-source.js +5 -5
- package/dist/lang/ast/elements/source.js +1 -1
- package/dist/lang/ast/error-factory.js +16 -13
- package/dist/lang/ast/expressions/binary-boolean.d.ts +1 -1
- package/dist/lang/ast/expressions/binary-boolean.js +4 -4
- package/dist/lang/ast/expressions/binary-numeric.d.ts +1 -1
- package/dist/lang/ast/expressions/binary-numeric.js +1 -1
- package/dist/lang/ast/expressions/boolean.js +1 -1
- package/dist/lang/ast/expressions/constant-sub-expression.js +7 -7
- package/dist/lang/ast/expressions/expr-aggregate-function.d.ts +3 -3
- package/dist/lang/ast/expressions/expr-aggregate-function.js +12 -12
- package/dist/lang/ast/expressions/expr-alternation-tree.js +3 -3
- package/dist/lang/ast/expressions/expr-asymmetric.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-asymmetric.js +1 -1
- package/dist/lang/ast/expressions/expr-avg.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-avg.js +1 -1
- package/dist/lang/ast/expressions/expr-cast.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-cast.js +26 -4
- package/dist/lang/ast/expressions/expr-compare.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-compare.js +3 -3
- package/dist/lang/ast/expressions/expr-count.js +6 -6
- package/dist/lang/ast/expressions/expr-filter.d.ts +2 -2
- package/dist/lang/ast/expressions/expr-filter.js +8 -8
- package/dist/lang/ast/expressions/expr-func.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-func.js +3 -3
- package/dist/lang/ast/expressions/expr-granular-time.js +7 -7
- package/dist/lang/ast/expressions/expr-id-reference.js +11 -11
- package/dist/lang/ast/expressions/expr-logical-op.js +1 -1
- package/dist/lang/ast/expressions/expr-minus.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-minus.js +3 -3
- package/dist/lang/ast/expressions/expr-not.js +2 -2
- package/dist/lang/ast/expressions/expr-now.js +7 -7
- package/dist/lang/ast/expressions/expr-null.js +3 -3
- package/dist/lang/ast/expressions/expr-number.js +1 -1
- package/dist/lang/ast/expressions/expr-parens.js +2 -2
- package/dist/lang/ast/expressions/expr-regex.js +3 -3
- package/dist/lang/ast/expressions/expr-string.js +6 -6
- package/dist/lang/ast/expressions/expr-sum.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-sum.js +1 -1
- package/dist/lang/ast/expressions/expr-time-extract.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-time-extract.js +29 -29
- package/dist/lang/ast/expressions/expr-time.js +7 -7
- package/dist/lang/ast/expressions/expr-ungroup.d.ts +2 -2
- package/dist/lang/ast/expressions/expr-ungroup.js +11 -8
- package/dist/lang/ast/expressions/for-range.d.ts +1 -1
- package/dist/lang/ast/expressions/for-range.js +1 -1
- package/dist/lang/ast/expressions/granular-literal.js +12 -12
- package/dist/lang/ast/expressions/partial-compare.d.ts +1 -1
- package/dist/lang/ast/expressions/partial-compare.js +1 -1
- package/dist/lang/ast/expressions/pick-when.d.ts +1 -1
- package/dist/lang/ast/expressions/pick-when.js +11 -11
- package/dist/lang/ast/expressions/range.js +4 -4
- package/dist/lang/ast/expressions/top-by.d.ts +1 -1
- package/dist/lang/ast/expressions/top-by.js +4 -4
- package/dist/lang/ast/expressions/unary.js +1 -1
- package/dist/lang/ast/field-space/dynamic-space.d.ts +1 -1
- package/dist/lang/ast/field-space/dynamic-space.js +1 -1
- package/dist/lang/ast/field-space/index-field-space.js +2 -2
- package/dist/lang/ast/field-space/query-field-struct.js +1 -1
- package/dist/lang/ast/field-space/query-space-field.js +1 -1
- package/dist/lang/ast/field-space/query-spaces.js +2 -2
- package/dist/lang/ast/field-space/reference-field.js +1 -1
- package/dist/lang/ast/field-space/rename-space-field.js +2 -2
- package/dist/lang/ast/field-space/static-space.js +8 -8
- package/dist/lang/ast/field-space/struct-space-field-base.js +1 -1
- package/dist/lang/ast/fragtype-utils.js +2 -2
- package/dist/lang/ast/parameters/constant-parameter.js +9 -9
- package/dist/lang/ast/parameters/has-parameter.js +5 -5
- package/dist/lang/ast/query-elements/anonymous-query.js +1 -1
- package/dist/lang/ast/query-elements/existing-query.d.ts +1 -1
- package/dist/lang/ast/query-elements/existing-query.js +11 -11
- package/dist/lang/ast/query-elements/full-query.js +11 -11
- package/dist/lang/ast/query-elements/query-head-struct.js +1 -1
- package/dist/lang/ast/query-items/field-declaration.d.ts +1 -1
- package/dist/lang/ast/query-items/field-declaration.js +11 -11
- package/dist/lang/ast/query-items/field-references.d.ts +1 -1
- package/dist/lang/ast/query-items/field-references.js +1 -1
- package/dist/lang/ast/query-properties/filters.d.ts +1 -1
- package/dist/lang/ast/query-properties/filters.js +7 -7
- package/dist/lang/ast/query-properties/indexing.d.ts +1 -1
- package/dist/lang/ast/query-properties/indexing.js +2 -2
- package/dist/lang/ast/query-properties/joins.d.ts +1 -1
- package/dist/lang/ast/query-properties/joins.js +17 -14
- package/dist/lang/ast/query-properties/nest.js +4 -4
- package/dist/lang/ast/query-properties/ordering.js +2 -2
- package/dist/lang/ast/query-properties/qop-desc.js +1 -1
- package/dist/lang/ast/query-properties/top.js +3 -3
- package/dist/lang/ast/source-properties/field-list-edit.js +1 -1
- package/dist/lang/ast/source-properties/primary-key.js +1 -1
- package/dist/lang/ast/source-properties/renames.js +1 -1
- package/dist/lang/ast/sources/named-source.d.ts +2 -2
- package/dist/lang/ast/sources/named-source.js +6 -6
- package/dist/lang/ast/sources/query-source.d.ts +1 -1
- package/dist/lang/ast/sources/query-source.js +2 -2
- package/dist/lang/ast/sources/table-source.js +7 -5
- package/dist/lang/ast/space-seed.d.ts +1 -1
- package/dist/lang/ast/sql-elements/sql-statement.js +5 -5
- package/dist/lang/ast/sql-elements/sql-string.js +1 -1
- package/dist/lang/ast/struct-utils.js +2 -2
- package/dist/lang/ast/time-utils.js +32 -32
- package/dist/lang/ast/types/expression-def.js +34 -34
- package/dist/lang/ast/types/malloy-element.d.ts +4 -4
- package/dist/lang/ast/types/malloy-element.js +27 -27
- package/dist/lang/ast/types/query-comp.d.ts +1 -1
- package/dist/lang/ast/types/space-field.js +1 -1
- package/dist/lang/ast/types/space-param.js +2 -2
- package/dist/lang/ast/types/turtle-headed-pipe.d.ts +1 -1
- package/dist/lang/ast/types/turtle-headed-pipe.js +1 -1
- package/dist/lang/ast/types/type-desc.d.ts +1 -1
- package/dist/lang/field-utils.d.ts +1 -1
- package/dist/lang/index.d.ts +1 -1
- package/dist/lang/malloy-to-ast.d.ts +1 -1
- package/dist/lang/malloy-to-ast.js +11 -11
- package/dist/lang/parse-error-handler.js +4 -4
- package/dist/lang/parse-malloy.d.ts +4 -4
- package/dist/lang/parse-malloy.js +61 -61
- package/dist/lang/parse-tree-walkers/document-completion-walker.js +16 -16
- package/dist/lang/parse-tree-walkers/document-help-context-walker.js +10 -10
- package/dist/lang/parse-tree-walkers/document-highlight-walker.js +85 -82
- package/dist/lang/parse-tree-walkers/document-symbol-walker.js +40 -40
- package/dist/lang/parse-tree-walkers/find-external-references.d.ts +1 -1
- package/dist/lang/parse-tree-walkers/find-external-references.js +2 -2
- package/dist/lang/reference-list.d.ts +1 -1
- package/dist/lang/test/document-help-context-walker.spec.js +6 -6
- package/dist/lang/test/document-symbol-walker.spec.js +3 -3
- package/dist/lang/test/field-symbols.spec.js +62 -58
- package/dist/lang/test/parse.spec.js +262 -260
- package/dist/lang/test/test-translator.d.ts +1 -1
- package/dist/lang/test/test-translator.js +139 -139
- package/dist/lang/translate-response.d.ts +1 -1
- package/dist/lang/zone.js +5 -5
- package/dist/malloy.d.ts +5 -5
- package/dist/malloy.js +72 -72
- package/dist/model/malloy_query.d.ts +2 -2
- package/dist/model/malloy_query.js +179 -176
- package/dist/model/malloy_types.js +41 -41
- package/dist/model/sql_block.js +2 -2
- package/package.json +1 -1
package/dist/connection_utils.js
CHANGED
|
@@ -31,18 +31,18 @@ async function* toAsyncGenerator(startStreaming) {
|
|
|
31
31
|
resolve = res;
|
|
32
32
|
});
|
|
33
33
|
startStreaming((error) => {
|
|
34
|
-
resolve({ done: true, isError: true, error });
|
|
34
|
+
resolve({ "done": true, "isError": true, error });
|
|
35
35
|
}, (data) => {
|
|
36
36
|
resolve({
|
|
37
|
-
done: false,
|
|
38
|
-
value: data,
|
|
39
|
-
isError: false,
|
|
40
|
-
next: new Promise((res) => {
|
|
37
|
+
"done": false,
|
|
38
|
+
"value": data,
|
|
39
|
+
"isError": false,
|
|
40
|
+
"next": new Promise((res) => {
|
|
41
41
|
resolve = res;
|
|
42
|
-
})
|
|
42
|
+
})
|
|
43
43
|
});
|
|
44
44
|
}, () => {
|
|
45
|
-
resolve({ done: true, isError: false });
|
|
45
|
+
resolve({ "done": true, "isError": false });
|
|
46
46
|
});
|
|
47
47
|
return promise;
|
|
48
48
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AtomicFieldType as AtomicFieldTypeInner,
|
|
1
|
+
import { AtomicFieldType as AtomicFieldTypeInner, DialectFragment, Expr, ExtractUnit, Sampling, StructDef, TimeFieldType, TimeValue, TimestampUnit, TypecastFragment } from "../model/malloy_types";
|
|
2
2
|
interface DialectField {
|
|
3
3
|
type: string;
|
|
4
4
|
sqlExpression: string;
|
package/dist/dialect/duckdb.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DateUnit, Expr, ExtractUnit, Sampling, StructDef, TimeFieldType,
|
|
1
|
+
import { DateUnit, Expr, ExtractUnit, Sampling, StructDef, TimeFieldType, TimeValue, TimestampUnit, TypecastFragment } from "../model/malloy_types";
|
|
2
2
|
import { Dialect, DialectFieldList, FunctionInfo } from "./dialect";
|
|
3
3
|
export declare class DuckDBDialect extends Dialect {
|
|
4
4
|
name: string;
|
package/dist/dialect/duckdb.js
CHANGED
|
@@ -108,17 +108,17 @@ WINDOW
|
|
|
108
108
|
WITH
|
|
109
109
|
`.split(/\s/);
|
|
110
110
|
const castMap = {
|
|
111
|
-
number: "double precision",
|
|
112
|
-
string: "varchar"
|
|
111
|
+
"number": "double precision",
|
|
112
|
+
"string": "varchar"
|
|
113
113
|
};
|
|
114
114
|
const pgExtractionMap = {
|
|
115
|
-
day_of_week: "dow",
|
|
116
|
-
day_of_year: "doy"
|
|
115
|
+
"day_of_week": "dow",
|
|
116
|
+
"day_of_year": "doy"
|
|
117
117
|
};
|
|
118
118
|
const inSeconds = {
|
|
119
|
-
second: 1,
|
|
120
|
-
minute: 60,
|
|
121
|
-
hour: 3600
|
|
119
|
+
"second": 1,
|
|
120
|
+
"minute": 60,
|
|
121
|
+
"hour": 3600
|
|
122
122
|
};
|
|
123
123
|
class DuckDBDialect extends dialect_1.Dialect {
|
|
124
124
|
constructor() {
|
|
@@ -130,13 +130,13 @@ class DuckDBDialect extends dialect_1.Dialect {
|
|
|
130
130
|
this.divisionIsInteger = true;
|
|
131
131
|
this.supportsSumDistinctFunction = true;
|
|
132
132
|
this.unnestWithNumbers = true;
|
|
133
|
-
this.defaultSampling = { rows: 50000 };
|
|
133
|
+
this.defaultSampling = { "rows": 50000 };
|
|
134
134
|
this.supportUnnestArrayAgg = true;
|
|
135
135
|
this.supportsCTEinCoorelatedSubQueries = true;
|
|
136
136
|
this.dontUnionIndex = false;
|
|
137
137
|
this.supportsQualify = true;
|
|
138
138
|
this.functionInfo = {
|
|
139
|
-
concat: { returnType: "string" }
|
|
139
|
+
"concat": { "returnType": "string" }
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
142
|
// hack until they support temporary macros.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DateUnit,
|
|
1
|
+
import { DateUnit, Expr, ExtractUnit, Sampling, TimeFieldType, TimeValue, TimestampUnit, TypecastFragment } from "../model/malloy_types";
|
|
2
2
|
import { Dialect, DialectFieldList, FunctionInfo } from "./dialect";
|
|
3
3
|
export declare class PostgresDialect extends Dialect {
|
|
4
4
|
name: string;
|
package/dist/dialect/postgres.js
CHANGED
|
@@ -27,26 +27,26 @@ const utils_1 = require("../model/utils");
|
|
|
27
27
|
const malloy_types_1 = require("../model/malloy_types");
|
|
28
28
|
const dialect_1 = require("./dialect");
|
|
29
29
|
const castMap = {
|
|
30
|
-
number: "double precision",
|
|
31
|
-
string: "varchar"
|
|
30
|
+
"number": "double precision",
|
|
31
|
+
"string": "varchar"
|
|
32
32
|
};
|
|
33
33
|
const pgExtractionMap = {
|
|
34
|
-
day_of_week: "dow",
|
|
35
|
-
day_of_year: "doy"
|
|
34
|
+
"day_of_week": "dow",
|
|
35
|
+
"day_of_year": "doy"
|
|
36
36
|
};
|
|
37
37
|
const pgMakeIntervalMap = {
|
|
38
|
-
year: "years",
|
|
39
|
-
month: "months",
|
|
40
|
-
week: "weeks",
|
|
41
|
-
day: "days",
|
|
42
|
-
hour: "hours",
|
|
43
|
-
minute: "mins",
|
|
44
|
-
second: "secs"
|
|
38
|
+
"year": "years",
|
|
39
|
+
"month": "months",
|
|
40
|
+
"week": "weeks",
|
|
41
|
+
"day": "days",
|
|
42
|
+
"hour": "hours",
|
|
43
|
+
"minute": "mins",
|
|
44
|
+
"second": "secs"
|
|
45
45
|
};
|
|
46
46
|
const inSeconds = {
|
|
47
|
-
second: 1,
|
|
48
|
-
minute: 60,
|
|
49
|
-
hour: 3600
|
|
47
|
+
"second": 1,
|
|
48
|
+
"minute": 60,
|
|
49
|
+
"hour": 3600
|
|
50
50
|
};
|
|
51
51
|
class PostgresDialect extends dialect_1.Dialect {
|
|
52
52
|
constructor() {
|
|
@@ -59,13 +59,13 @@ class PostgresDialect extends dialect_1.Dialect {
|
|
|
59
59
|
this.divisionIsInteger = true;
|
|
60
60
|
this.supportsSumDistinctFunction = false;
|
|
61
61
|
this.unnestWithNumbers = false;
|
|
62
|
-
this.defaultSampling = { rows: 50000 };
|
|
62
|
+
this.defaultSampling = { "rows": 50000 };
|
|
63
63
|
this.supportUnnestArrayAgg = true;
|
|
64
64
|
this.supportsCTEinCoorelatedSubQueries = true;
|
|
65
65
|
this.dontUnionIndex = false;
|
|
66
66
|
this.supportsQualify = false;
|
|
67
67
|
this.functionInfo = {
|
|
68
|
-
concat: { returnType: "string" }
|
|
68
|
+
"concat": { "returnType": "string" }
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
quoteTablePath(tablePath) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Expr, ExtractUnit, Sampling, TimeValue, TimestampUnit, TypecastFragment } from "../model/malloy_types";
|
|
2
2
|
import { Dialect, DialectFieldList, FunctionInfo } from "./dialect";
|
|
3
3
|
export declare class StandardSQLDialect extends Dialect {
|
|
4
4
|
name: string;
|
|
@@ -27,7 +27,7 @@ const utils_1 = require("../model/utils");
|
|
|
27
27
|
const malloy_types_1 = require("../model/malloy_types");
|
|
28
28
|
const dialect_1 = require("./dialect");
|
|
29
29
|
const castMap = {
|
|
30
|
-
number: "float64"
|
|
30
|
+
"number": "float64"
|
|
31
31
|
};
|
|
32
32
|
// These are the units that "TIMESTAMP_ADD" accepts
|
|
33
33
|
const timestampAddUnits = [
|
|
@@ -36,11 +36,11 @@ const timestampAddUnits = [
|
|
|
36
36
|
"second",
|
|
37
37
|
"minute",
|
|
38
38
|
"hour",
|
|
39
|
-
"day"
|
|
39
|
+
"day"
|
|
40
40
|
];
|
|
41
41
|
const extractMap = {
|
|
42
|
-
day_of_week: "dayofweek",
|
|
43
|
-
day_of_year: "dayofyear"
|
|
42
|
+
"day_of_week": "dayofweek",
|
|
43
|
+
"day_of_year": "dayofyear"
|
|
44
44
|
};
|
|
45
45
|
class StandardSQLDialect extends dialect_1.Dialect {
|
|
46
46
|
constructor() {
|
|
@@ -53,17 +53,17 @@ class StandardSQLDialect extends dialect_1.Dialect {
|
|
|
53
53
|
this.divisionIsInteger = false;
|
|
54
54
|
this.supportsSumDistinctFunction = false;
|
|
55
55
|
this.unnestWithNumbers = false;
|
|
56
|
-
this.defaultSampling = { enable: false };
|
|
56
|
+
this.defaultSampling = { "enable": false };
|
|
57
57
|
this.supportUnnestArrayAgg = false;
|
|
58
58
|
this.supportsCTEinCoorelatedSubQueries = false;
|
|
59
59
|
this.dontUnionIndex = true; // bigquery can't use a sample table more than once in a query.
|
|
60
60
|
this.supportsQualify = true;
|
|
61
61
|
// I think we want an optional list of parameters types that we force a cast to.
|
|
62
62
|
this.functionInfo = {
|
|
63
|
-
timestamp_seconds: {
|
|
64
|
-
returnType: "timestamp"
|
|
63
|
+
"timestamp_seconds": {
|
|
64
|
+
"returnType": "timestamp"
|
|
65
65
|
},
|
|
66
|
-
concat: { returnType: "string" }
|
|
66
|
+
"concat": { "returnType": "string" }
|
|
67
67
|
};
|
|
68
68
|
this.keywords = `
|
|
69
69
|
ALL
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export type { QueryDataRow, Fragment, StructDef, StructRelationship, NamedStructDefs, MalloyQueryData, AtomicFieldType as AtomicFieldTypeInner, DateUnit, ExtractUnit, TimestampUnit, TimeFieldType, QueryData, FieldTypeDef, Expr, DialectFragment, TimeValue, FilterExpression, SQLBlock, FieldDef, FilteredAliasedName, PipeSegment, QueryFieldDef, TurtleDef, SearchValueMapResult, SearchIndexResult, ModelDef, Query, NamedQuery, NamedModelObject, ExpressionType
|
|
2
|
-
export { Segment, isFilteredAliasedName, flattenQuery, expressionIsCalculation
|
|
3
|
-
export { HighlightType, MalloyTranslator
|
|
1
|
+
export type { QueryDataRow, Fragment, StructDef, StructRelationship, NamedStructDefs, MalloyQueryData, AtomicFieldType as AtomicFieldTypeInner, DateUnit, ExtractUnit, TimestampUnit, TimeFieldType, QueryData, FieldTypeDef, Expr, DialectFragment, TimeValue, FilterExpression, SQLBlock, FieldDef, FilteredAliasedName, PipeSegment, QueryFieldDef, TurtleDef, SearchValueMapResult, SearchIndexResult, ModelDef, Query, NamedQuery, NamedModelObject, ExpressionType } from "./model";
|
|
2
|
+
export { Segment, isFilteredAliasedName, flattenQuery, expressionIsCalculation } from "./model";
|
|
3
|
+
export { HighlightType, MalloyTranslator } from "./lang";
|
|
4
4
|
export type { LogMessage, TranslateResponse } from "./lang";
|
|
5
|
-
export { Malloy, Runtime, AtomicFieldType, ConnectionRuntime, SingleConnectionRuntime, EmptyURLReader, InMemoryURLReader, FixedConnectionMap, MalloyError, JoinRelationship, SourceRelationship, DateTimeframe, TimestampTimeframe, Result, parseTableURI, QueryMaterializer, CSVWriter, JSONWriter, DataWriter
|
|
6
|
-
export type { Explore, Model, PreparedQuery, PreparedResult, Field, AtomicField, ExploreField, QueryField, DataArray, DataRecord, DataColumn, DataArrayOrRecord, ModelMaterializer, DocumentSymbol, DocumentHighlight, ResultJSON, PreparedResultMaterializer, SQLBlockMaterializer, ExploreMaterializer, WriteStream
|
|
5
|
+
export { Malloy, Runtime, AtomicFieldType, ConnectionRuntime, SingleConnectionRuntime, EmptyURLReader, InMemoryURLReader, FixedConnectionMap, MalloyError, JoinRelationship, SourceRelationship, DateTimeframe, TimestampTimeframe, Result, parseTableURI, QueryMaterializer, CSVWriter, JSONWriter, DataWriter } from "./malloy";
|
|
6
|
+
export type { Explore, Model, PreparedQuery, PreparedResult, Field, AtomicField, ExploreField, QueryField, DataArray, DataRecord, DataColumn, DataArrayOrRecord, ModelMaterializer, DocumentSymbol, DocumentHighlight, ResultJSON, PreparedResultMaterializer, SQLBlockMaterializer, ExploreMaterializer, WriteStream } from "./malloy";
|
|
7
7
|
export type { RunSQLOptions } from "./run_sql_options";
|
|
8
|
-
export type { URLReader, InfoConnection, LookupConnection, Connection, QueryString, ModelString, QueryURL, ModelURL, PooledConnection, TestableConnection, PersistSQLResults, StreamingConnection
|
|
8
|
+
export type { URLReader, InfoConnection, LookupConnection, Connection, QueryString, ModelString, QueryURL, ModelURL, PooledConnection, TestableConnection, PersistSQLResults, StreamingConnection } from "./runtime_types";
|
|
9
9
|
export type { Loggable } from "./malloy";
|
|
10
10
|
export { toAsyncGenerator } from "./connection_utils";
|
|
@@ -33,9 +33,9 @@ exports.errorFor = void 0;
|
|
|
33
33
|
*/
|
|
34
34
|
function errorFor(reason) {
|
|
35
35
|
return {
|
|
36
|
-
dataType: "unknown",
|
|
37
|
-
expressionType: "scalar",
|
|
38
|
-
value: [`_ERROR_${reason.replace(/ /g, "_")}`]
|
|
36
|
+
"dataType": "unknown",
|
|
37
|
+
"expressionType": "scalar",
|
|
38
|
+
"value": [`_ERROR_${reason.replace(/ /g, "_")}`]
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
exports.errorFor = errorFor;
|
|
@@ -26,7 +26,7 @@ exports.DefineQueryList = exports.DefineQuery = void 0;
|
|
|
26
26
|
const malloy_element_1 = require("../types/malloy-element");
|
|
27
27
|
class DefineQuery extends malloy_element_1.MalloyElement {
|
|
28
28
|
constructor(name, queryDetails) {
|
|
29
|
-
super({ queryDetails });
|
|
29
|
+
super({ "queryDetails": queryDetails });
|
|
30
30
|
this.name = name;
|
|
31
31
|
this.queryDetails = queryDetails;
|
|
32
32
|
this.elementType = "defineQuery";
|
|
@@ -34,9 +34,9 @@ class DefineQuery extends malloy_element_1.MalloyElement {
|
|
|
34
34
|
execute(doc) {
|
|
35
35
|
const entry = {
|
|
36
36
|
...this.queryDetails.query(),
|
|
37
|
-
type: "query",
|
|
38
|
-
name: this.name,
|
|
39
|
-
location: this.location
|
|
37
|
+
"type": "query",
|
|
38
|
+
"name": this.name,
|
|
39
|
+
"location": this.location
|
|
40
40
|
};
|
|
41
41
|
const exported = false;
|
|
42
42
|
doc.setEntry(this.name, { entry, exported });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ModelDataRequest } from "../../translate-response";
|
|
2
|
-
import { DocStatement, Document, MalloyElement, RunList } from "../types/malloy-element";
|
|
3
2
|
import { HasParameter } from "../parameters/has-parameter";
|
|
3
|
+
import { DocStatement, Document, MalloyElement, RunList } from "../types/malloy-element";
|
|
4
4
|
import { Source } from "./source";
|
|
5
5
|
export declare class DefineSource extends MalloyElement implements DocStatement {
|
|
6
6
|
readonly name: string;
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
*/
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.DefineSourceList = exports.DefineSource = void 0;
|
|
26
|
-
const malloy_element_1 = require("../types/malloy-element");
|
|
27
|
-
const has_parameter_1 = require("../parameters/has-parameter");
|
|
28
26
|
const error_factory_1 = require("../error-factory");
|
|
27
|
+
const has_parameter_1 = require("../parameters/has-parameter");
|
|
28
|
+
const malloy_element_1 = require("../types/malloy-element");
|
|
29
29
|
class DefineSource extends malloy_element_1.MalloyElement {
|
|
30
30
|
constructor(name, theSource, exported, params) {
|
|
31
|
-
super({ explore: theSource });
|
|
31
|
+
super({ "explore": theSource });
|
|
32
32
|
this.name = name;
|
|
33
33
|
this.theSource = theSource;
|
|
34
34
|
this.exported = exported;
|
|
@@ -43,7 +43,7 @@ class DefineSource extends malloy_element_1.MalloyElement {
|
|
|
43
43
|
this.log(`Unexpected element type in define statement: ${el.elementType}`);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
this.has({ parameters: this.parameters });
|
|
46
|
+
this.has({ "parameters": this.parameters });
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
execute(doc) {
|
|
@@ -56,12 +56,12 @@ class DefineSource extends malloy_element_1.MalloyElement {
|
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
doc.setEntry(this.name, {
|
|
59
|
-
entry: {
|
|
59
|
+
"entry": {
|
|
60
60
|
...structDef,
|
|
61
|
-
as: this.name,
|
|
62
|
-
location: this.location
|
|
61
|
+
"as": this.name,
|
|
62
|
+
"location": this.location
|
|
63
63
|
},
|
|
64
|
-
exported: this.exported
|
|
64
|
+
"exported": this.exported
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -59,8 +59,8 @@ class ImportStatement extends malloy_element_1.MalloyElement {
|
|
|
59
59
|
const importStructs = trans.getChildExports(this.fullURL);
|
|
60
60
|
for (const importing in importStructs) {
|
|
61
61
|
doc.setEntry(importing, {
|
|
62
|
-
entry: importStructs[importing],
|
|
63
|
-
exported: false
|
|
62
|
+
"entry": importStructs[importing],
|
|
63
|
+
"exported": false
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DocumentLocation,
|
|
1
|
+
import { DocumentLocation, PipeSegment, Pipeline, StructDef } from "../../../model/malloy_types";
|
|
2
2
|
import { FieldSpace } from "../types/field-space";
|
|
3
3
|
import { MalloyElement } from "../types/malloy-element";
|
|
4
4
|
import { QOPDesc } from "../query-properties/qop-desc";
|
|
@@ -38,11 +38,11 @@ class PipelineDesc extends malloy_element_1.MalloyElement {
|
|
|
38
38
|
}
|
|
39
39
|
refineHead(refinement) {
|
|
40
40
|
this.headRefinement = refinement;
|
|
41
|
-
this.has({ headRefinement: refinement });
|
|
41
|
+
this.has({ "headRefinement": refinement });
|
|
42
42
|
}
|
|
43
43
|
addSegments(...segDesc) {
|
|
44
44
|
this.qops.push(...segDesc);
|
|
45
|
-
this.has({ segments: this.qops });
|
|
45
|
+
this.has({ "segments": this.qops });
|
|
46
46
|
}
|
|
47
47
|
appendOps(modelPipe, existingEndSpace) {
|
|
48
48
|
let nextFS = existingEndSpace;
|
|
@@ -57,8 +57,8 @@ class PipelineDesc extends malloy_element_1.MalloyElement {
|
|
|
57
57
|
nextFS = next.outputSpace();
|
|
58
58
|
}
|
|
59
59
|
return {
|
|
60
|
-
opList: returnPipe || modelPipe,
|
|
61
|
-
structDef: nextFS.structDef()
|
|
60
|
+
"opList": returnPipe || modelPipe,
|
|
61
|
+
"structDef": nextFS.structDef()
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
refinePipeline(fs, modelPipe) {
|
|
@@ -67,7 +67,7 @@ class PipelineDesc extends malloy_element_1.MalloyElement {
|
|
|
67
67
|
}
|
|
68
68
|
const pipeline = [];
|
|
69
69
|
if (modelPipe.pipeHead) {
|
|
70
|
-
const { pipeline: turtlePipe } = this.expandTurtle(modelPipe.pipeHead.name, fs.structDef());
|
|
70
|
+
const { "pipeline": turtlePipe } = this.expandTurtle(modelPipe.pipeHead.name, fs.structDef());
|
|
71
71
|
pipeline.push(...turtlePipe);
|
|
72
72
|
}
|
|
73
73
|
pipeline.push(...modelPipe.pipeline);
|
|
@@ -87,9 +87,9 @@ class PipelineDesc extends malloy_element_1.MalloyElement {
|
|
|
87
87
|
this.log(`'${turtleName}' is not a query`);
|
|
88
88
|
}
|
|
89
89
|
else {
|
|
90
|
-
return { pipeline: turtle.pipeline, location: turtle.location };
|
|
90
|
+
return { "pipeline": turtle.pipeline, "location": turtle.location };
|
|
91
91
|
}
|
|
92
|
-
return { pipeline: [], location: undefined };
|
|
92
|
+
return { "pipeline": [], "location": undefined };
|
|
93
93
|
}
|
|
94
94
|
getOutputStruct(walkStruct, pipeline) {
|
|
95
95
|
for (const modelQop of pipeline) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StructDef } from "../../../model/malloy_types";
|
|
2
|
-
import { ExploreDesc } from "../types/explore-desc";
|
|
3
2
|
import { HasParameter } from "../parameters/has-parameter";
|
|
3
|
+
import { ExploreDesc } from "../types/explore-desc";
|
|
4
4
|
import { Source } from "./source";
|
|
5
5
|
/**
|
|
6
6
|
* A Source made from a source reference and a set of refinements
|
|
@@ -25,21 +25,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
25
25
|
exports.RefinedSource = void 0;
|
|
26
26
|
const lodash_1 = require("lodash");
|
|
27
27
|
const malloy_types_1 = require("../../../model/malloy_types");
|
|
28
|
+
const refined_space_1 = require("../field-space/refined-space");
|
|
29
|
+
const declare_fields_1 = require("../query-properties/declare-fields");
|
|
30
|
+
const filters_1 = require("../query-properties/filters");
|
|
31
|
+
const joins_1 = require("../query-properties/joins");
|
|
28
32
|
const field_list_edit_1 = require("../source-properties/field-list-edit");
|
|
29
33
|
const primary_key_1 = require("../source-properties/primary-key");
|
|
30
34
|
const renames_1 = require("../source-properties/renames");
|
|
31
35
|
const turtles_1 = require("../source-properties/turtles");
|
|
32
36
|
const source_1 = require("./source");
|
|
33
|
-
const declare_fields_1 = require("../query-properties/declare-fields");
|
|
34
|
-
const filters_1 = require("../query-properties/filters");
|
|
35
|
-
const joins_1 = require("../query-properties/joins");
|
|
36
|
-
const refined_space_1 = require("../field-space/refined-space");
|
|
37
37
|
/**
|
|
38
38
|
* A Source made from a source reference and a set of refinements
|
|
39
39
|
*/
|
|
40
40
|
class RefinedSource extends source_1.Source {
|
|
41
41
|
constructor(source, refinement) {
|
|
42
|
-
super({ source, refinement });
|
|
42
|
+
super({ "source": source, "refinement": refinement });
|
|
43
43
|
this.source = source;
|
|
44
44
|
this.refinement = refinement;
|
|
45
45
|
this.elementType = "refinedSource";
|
|
@@ -24,15 +24,18 @@
|
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.ErrorFactory = void 0;
|
|
26
26
|
const theErrorStruct = {
|
|
27
|
-
type: "struct",
|
|
28
|
-
name: "~malformed~",
|
|
29
|
-
dialect: "~malformed~",
|
|
30
|
-
structSource: {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
connectionName: "//undefined_error_connection",
|
|
27
|
+
"type": "struct",
|
|
28
|
+
"name": "~malformed~",
|
|
29
|
+
"dialect": "~malformed~",
|
|
30
|
+
"structSource": {
|
|
31
|
+
"type": "table",
|
|
32
|
+
"tablePath": "//undefined_error_table_path"
|
|
34
33
|
},
|
|
35
|
-
|
|
34
|
+
"structRelationship": {
|
|
35
|
+
"type": "basetable",
|
|
36
|
+
"connectionName": "//undefined_error_connection"
|
|
37
|
+
},
|
|
38
|
+
"fields": []
|
|
36
39
|
};
|
|
37
40
|
class ErrorFactory {
|
|
38
41
|
static get structDef() {
|
|
@@ -43,18 +46,18 @@ class ErrorFactory {
|
|
|
43
46
|
}
|
|
44
47
|
static get query() {
|
|
45
48
|
return {
|
|
46
|
-
structRef: ErrorFactory.structDef,
|
|
47
|
-
pipeline: []
|
|
49
|
+
"structRef": ErrorFactory.structDef,
|
|
50
|
+
"pipeline": []
|
|
48
51
|
};
|
|
49
52
|
}
|
|
50
53
|
static get reduceSegment() {
|
|
51
|
-
return { type: "reduce", fields: [] };
|
|
54
|
+
return { "type": "reduce", "fields": [] };
|
|
52
55
|
}
|
|
53
56
|
static get projectSegment() {
|
|
54
|
-
return { type: "project", fields: [] };
|
|
57
|
+
return { "type": "project", "fields": [] };
|
|
55
58
|
}
|
|
56
59
|
static get indexSegment() {
|
|
57
|
-
return { type: "index", fields: [] };
|
|
60
|
+
return { "type": "index", "fields": [] };
|
|
58
61
|
}
|
|
59
62
|
}
|
|
60
63
|
exports.ErrorFactory = ErrorFactory;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FieldSpace } from "../types/field-space";
|
|
2
1
|
import { ExprValue } from "../types/expr-value";
|
|
3
2
|
import { ExpressionDef } from "../types/expression-def";
|
|
3
|
+
import { FieldSpace } from "../types/field-space";
|
|
4
4
|
export declare abstract class BinaryBoolean<opType extends string> extends ExpressionDef {
|
|
5
5
|
readonly left: ExpressionDef;
|
|
6
6
|
readonly op: opType;
|
|
@@ -30,7 +30,7 @@ const expression_def_1 = require("../types/expression-def");
|
|
|
30
30
|
const utils_1 = require("./utils");
|
|
31
31
|
class BinaryBoolean extends expression_def_1.ExpressionDef {
|
|
32
32
|
constructor(left, op, right) {
|
|
33
|
-
super({ left, right });
|
|
33
|
+
super({ "left": left, "right": right });
|
|
34
34
|
this.left = left;
|
|
35
35
|
this.op = op;
|
|
36
36
|
this.right = right;
|
|
@@ -42,9 +42,9 @@ class BinaryBoolean extends expression_def_1.ExpressionDef {
|
|
|
42
42
|
const right = this.right.getExpression(fs);
|
|
43
43
|
if (this.typeCheck(this.left, left) && this.typeCheck(this.right, right)) {
|
|
44
44
|
return {
|
|
45
|
-
dataType: "boolean",
|
|
46
|
-
expressionType: (0, malloy_types_1.maxExpressionType)(left.expressionType, right.expressionType),
|
|
47
|
-
value: (0, utils_1.compose)(left.value, this.op, right.value)
|
|
45
|
+
"dataType": "boolean",
|
|
46
|
+
"expressionType": (0, malloy_types_1.maxExpressionType)(left.expressionType, right.expressionType),
|
|
47
|
+
"value": (0, utils_1.compose)(left.value, this.op, right.value)
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
return (0, ast_utils_1.errorFor)("logial required boolean");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExprValue } from "../types/expr-value";
|
|
2
|
-
import { FieldSpace } from "../types/field-space";
|
|
3
2
|
import { ExpressionDef } from "../types/expression-def";
|
|
3
|
+
import { FieldSpace } from "../types/field-space";
|
|
4
4
|
export declare abstract class BinaryNumeric<opType extends string> extends ExpressionDef {
|
|
5
5
|
readonly left: ExpressionDef;
|
|
6
6
|
readonly op: opType;
|
|
@@ -27,7 +27,7 @@ const fragtype_utils_1 = require("../fragtype-utils");
|
|
|
27
27
|
const expression_def_1 = require("../types/expression-def");
|
|
28
28
|
class BinaryNumeric extends expression_def_1.ExpressionDef {
|
|
29
29
|
constructor(left, op, right) {
|
|
30
|
-
super({ left, right });
|
|
30
|
+
super({ "left": left, "right": right });
|
|
31
31
|
this.left = left;
|
|
32
32
|
this.op = op;
|
|
33
33
|
this.right = right;
|
|
@@ -32,7 +32,7 @@ class Boolean extends expression_def_1.ExpressionDef {
|
|
|
32
32
|
this.elementType = "boolean literal";
|
|
33
33
|
}
|
|
34
34
|
getExpression() {
|
|
35
|
-
return { ...fragtype_utils_1.FT.boolT, value: [this.value] };
|
|
35
|
+
return { ...fragtype_utils_1.FT.boolT, "value": [this.value] };
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
exports.Boolean = Boolean;
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.ConstantSubExpression = void 0;
|
|
26
26
|
const comparison_1 = require("../types/comparison");
|
|
27
|
-
const expr_compare_1 = require("./expr-compare");
|
|
28
27
|
const expression_def_1 = require("../types/expression-def");
|
|
28
|
+
const expr_compare_1 = require("./expr-compare");
|
|
29
29
|
const utils_1 = require("./utils");
|
|
30
30
|
class ConstantFieldSpace {
|
|
31
31
|
constructor() {
|
|
@@ -39,8 +39,8 @@ class ConstantFieldSpace {
|
|
|
39
39
|
}
|
|
40
40
|
lookup(_name) {
|
|
41
41
|
return {
|
|
42
|
-
error: "Only constants allowed in parameter expressions",
|
|
43
|
-
found: undefined
|
|
42
|
+
"error": "Only constants allowed in parameter expressions",
|
|
43
|
+
"found": undefined
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
dialectObj() {
|
|
@@ -58,9 +58,9 @@ class DollarReference extends expression_def_1.ExpressionDef {
|
|
|
58
58
|
}
|
|
59
59
|
getExpression(_fs) {
|
|
60
60
|
return {
|
|
61
|
-
dataType: this.refType,
|
|
62
|
-
value: [{ type: "applyVal" }],
|
|
63
|
-
expressionType: "scalar"
|
|
61
|
+
"dataType": this.refType,
|
|
62
|
+
"value": [{ "type": "applyVal" }],
|
|
63
|
+
"expressionType": "scalar"
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -85,7 +85,7 @@ class ConstantSubExpression extends expression_def_1.ExpressionDef {
|
|
|
85
85
|
constantCondition(type) {
|
|
86
86
|
const compareAndContrast = new expr_compare_1.ExprCompare(new DollarReference(type), comparison_1.Comparison.EqualTo, this.expr);
|
|
87
87
|
const application = compareAndContrast.getExpression(this.constantFs);
|
|
88
|
-
return { ...application, value: (0, utils_1.compressExpr)(application.value) };
|
|
88
|
+
return { ...application, "value": (0, utils_1.compressExpr)(application.value) };
|
|
89
89
|
}
|
|
90
90
|
apply(fs, op, expr) {
|
|
91
91
|
return this.expr.apply(fs, op, expr);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ExprValue } from "../types/expr-value";
|
|
2
|
-
import { FieldValueType } from "../types/type-desc";
|
|
3
1
|
import { FieldReference } from "../query-items/field-references";
|
|
4
|
-
import {
|
|
2
|
+
import { ExprValue } from "../types/expr-value";
|
|
5
3
|
import { ExpressionDef } from "../types/expression-def";
|
|
4
|
+
import { FieldSpace } from "../types/field-space";
|
|
5
|
+
import { FieldValueType } from "../types/type-desc";
|
|
6
6
|
export declare abstract class ExprAggregateFunction extends ExpressionDef {
|
|
7
7
|
readonly func: string;
|
|
8
8
|
elementType: string;
|