@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/malloy.js
CHANGED
|
@@ -41,11 +41,11 @@ class Malloy {
|
|
|
41
41
|
url = new URL("internal://internal.malloy");
|
|
42
42
|
}
|
|
43
43
|
const translator = new lang_1.MalloyTranslator(url.toString(), {
|
|
44
|
-
urls: { [url.toString()]: source }
|
|
44
|
+
"urls": { [url.toString()]: source }
|
|
45
45
|
});
|
|
46
46
|
return new Parse(translator);
|
|
47
47
|
}
|
|
48
|
-
static parse({ url, urlReader, source
|
|
48
|
+
static parse({ url, urlReader, source }) {
|
|
49
49
|
if (source !== undefined) {
|
|
50
50
|
return Malloy._parse(source, url);
|
|
51
51
|
}
|
|
@@ -70,7 +70,7 @@ class Malloy {
|
|
|
70
70
|
* @param model A compiled model to build upon (optional).
|
|
71
71
|
* @returns A (promise of a) compiled `Model`.
|
|
72
72
|
*/
|
|
73
|
-
static async compile({ urlReader, connections, parse, model
|
|
73
|
+
static async compile({ urlReader, connections, parse, model }) {
|
|
74
74
|
const translator = parse._translator;
|
|
75
75
|
// eslint-disable-next-line no-constant-condition
|
|
76
76
|
while (true) {
|
|
@@ -100,7 +100,7 @@ class Malloy {
|
|
|
100
100
|
}
|
|
101
101
|
catch (error) {
|
|
102
102
|
translator.update({
|
|
103
|
-
errors: { urls: { [neededUrl]: error.message } }
|
|
103
|
+
"errors": { "urls": { [neededUrl]: error.message } }
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
106
|
}
|
|
@@ -120,14 +120,14 @@ class Malloy {
|
|
|
120
120
|
tablesByConnection.set(connectionName, connectionToTablesMap);
|
|
121
121
|
}
|
|
122
122
|
// iterate over connections, fetching schema for all missing tables
|
|
123
|
-
for (const [connectionName, connectionTableString
|
|
123
|
+
for (const [connectionName, connectionTableString] of tablesByConnection) {
|
|
124
124
|
try {
|
|
125
125
|
const connection = await connections.lookupConnection(connectionName);
|
|
126
126
|
// TODO detect if the union of `Object.keys(tables)` and `Object.keys(errors)` is not the same
|
|
127
127
|
// as `Object.keys(connectionTableString)`, i.e. that all tables are accounted for. Otherwise
|
|
128
128
|
// the translator runs into an infinite loop fetching tables.
|
|
129
|
-
const { schemas: tables, errors } = await connection.fetchSchemaForTables(connectionTableString);
|
|
130
|
-
translator.update({ tables, errors: { tables: errors } });
|
|
129
|
+
const { "schemas": tables, errors } = await connection.fetchSchemaForTables(connectionTableString);
|
|
130
|
+
translator.update({ tables, "errors": { "tables": errors } });
|
|
131
131
|
}
|
|
132
132
|
catch (error) {
|
|
133
133
|
// There was an exception getting the connection, associate that error
|
|
@@ -137,7 +137,7 @@ class Malloy {
|
|
|
137
137
|
for (const table of connectionTableString) {
|
|
138
138
|
errors[table] = error.toString();
|
|
139
139
|
}
|
|
140
|
-
translator.update({ tables, errors: { tables: errors } });
|
|
140
|
+
translator.update({ tables, "errors": { "tables": errors } });
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
}
|
|
@@ -151,13 +151,13 @@ class Malloy {
|
|
|
151
151
|
const resolved = await conn.fetchSchemaForSQLBlock(expanded);
|
|
152
152
|
if (resolved.error) {
|
|
153
153
|
translator.update({
|
|
154
|
-
errors: { compileSQL: { [expanded.name]: resolved.error } }
|
|
154
|
+
"errors": { "compileSQL": { [expanded.name]: resolved.error } }
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
if (resolved.structDef) {
|
|
158
158
|
if ((0, model_1.isSQLBlock)(resolved.structDef)) {
|
|
159
159
|
translator.update({
|
|
160
|
-
compileSQL: { [expanded.name]: resolved.structDef }
|
|
160
|
+
"compileSQL": { [expanded.name]: resolved.structDef }
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
163
|
}
|
|
@@ -165,7 +165,7 @@ class Malloy {
|
|
|
165
165
|
catch (error) {
|
|
166
166
|
const errors = {};
|
|
167
167
|
errors[toCompile.name] = error.toString();
|
|
168
|
-
translator.update({ errors: { compileSQL: errors } });
|
|
168
|
+
translator.update({ "errors": { "compileSQL": errors } });
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
}
|
|
@@ -190,13 +190,13 @@ class Malloy {
|
|
|
190
190
|
});
|
|
191
191
|
const { name, connection } = toCompile;
|
|
192
192
|
return {
|
|
193
|
-
type: "sqlBlock",
|
|
193
|
+
"type": "sqlBlock",
|
|
194
194
|
name,
|
|
195
195
|
connection,
|
|
196
|
-
selectStr: sqlStrings.join("")
|
|
196
|
+
"selectStr": sqlStrings.join("")
|
|
197
197
|
};
|
|
198
198
|
}
|
|
199
|
-
static async run({ connections, preparedResult, sqlStruct, connection, options
|
|
199
|
+
static async run({ connections, preparedResult, sqlStruct, connection, options }) {
|
|
200
200
|
const sqlBlock = sqlStruct === null || sqlStruct === void 0 ? void 0 : sqlStruct.structSource.sqlBlock;
|
|
201
201
|
if (!connection) {
|
|
202
202
|
if (!connections) {
|
|
@@ -211,36 +211,36 @@ class Malloy {
|
|
|
211
211
|
}
|
|
212
212
|
const data = await connection.runSQL(sqlBlock.selectStr);
|
|
213
213
|
return new Result({
|
|
214
|
-
structs: [sqlStruct],
|
|
215
|
-
sql: sqlBlock.selectStr,
|
|
216
|
-
result: data.rows,
|
|
217
|
-
totalRows: data.totalRows,
|
|
218
|
-
lastStageName: sqlBlock.name,
|
|
214
|
+
"structs": [sqlStruct],
|
|
215
|
+
"sql": sqlBlock.selectStr,
|
|
216
|
+
"result": data.rows,
|
|
217
|
+
"totalRows": data.totalRows,
|
|
218
|
+
"lastStageName": sqlBlock.name,
|
|
219
219
|
// TODO feature-sql-block There is no malloy code...
|
|
220
|
-
malloy: "",
|
|
221
|
-
connectionName: sqlStruct.structRelationship.connectionName,
|
|
220
|
+
"malloy": "",
|
|
221
|
+
"connectionName": sqlStruct.structRelationship.connectionName,
|
|
222
222
|
// TODO feature-sql-block There is no source explore...
|
|
223
|
-
sourceExplore: "",
|
|
224
|
-
sourceFilters: []
|
|
223
|
+
"sourceExplore": "",
|
|
224
|
+
"sourceFilters": []
|
|
225
225
|
}, {
|
|
226
|
-
name: "empty_model",
|
|
227
|
-
exports: [],
|
|
228
|
-
contents: {}
|
|
226
|
+
"name": "empty_model",
|
|
227
|
+
"exports": [],
|
|
228
|
+
"contents": {}
|
|
229
229
|
});
|
|
230
230
|
}
|
|
231
231
|
else if (preparedResult) {
|
|
232
232
|
const result = await connection.runSQL(preparedResult.sql, options);
|
|
233
233
|
return new Result({
|
|
234
234
|
...preparedResult._rawQuery,
|
|
235
|
-
result: result.rows,
|
|
236
|
-
totalRows: result.totalRows
|
|
235
|
+
"result": result.rows,
|
|
236
|
+
"totalRows": result.totalRows
|
|
237
237
|
}, preparedResult._modelDef);
|
|
238
238
|
}
|
|
239
239
|
else {
|
|
240
240
|
throw new Error("Internal error: sqlStruct or preparedResult must be provided.");
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
-
static async *runStream({ connections, preparedResult, sqlStruct, connection, options
|
|
243
|
+
static async *runStream({ connections, preparedResult, sqlStruct, connection, options }) {
|
|
244
244
|
const sqlBlock = sqlStruct === null || sqlStruct === void 0 ? void 0 : sqlStruct.structSource.sqlBlock;
|
|
245
245
|
if (sqlBlock === undefined && preparedResult === undefined) {
|
|
246
246
|
throw new Error("Internal error: sqlBlock or preparedResult must be provided.");
|
|
@@ -430,7 +430,7 @@ class PreparedQuery {
|
|
|
430
430
|
const translatedQuery = queryModel.compileQuery(this._query);
|
|
431
431
|
return new PreparedResult({
|
|
432
432
|
...translatedQuery,
|
|
433
|
-
queryName: this.name || translatedQuery.queryName
|
|
433
|
+
"queryName": this.name || translatedQuery.queryName
|
|
434
434
|
}, this._modelDef);
|
|
435
435
|
}
|
|
436
436
|
get dialect() {
|
|
@@ -453,10 +453,10 @@ class PreparedQuery {
|
|
|
453
453
|
}
|
|
454
454
|
const turtleDef = (0, model_1.flattenQuery)(this._modelDef, {
|
|
455
455
|
...this._query,
|
|
456
|
-
type: "query",
|
|
457
|
-
name: "as" in this._query ? this._query.as || this._query.name : defaultName
|
|
456
|
+
"type": "query",
|
|
457
|
+
"name": "as" in this._query ? this._query.as || this._query.name : defaultName
|
|
458
458
|
});
|
|
459
|
-
return new PreparedQuery({ ...turtleDef, structRef, type: "query" }, this._modelDef, this.name || turtleDef.as || turtleDef.name);
|
|
459
|
+
return new PreparedQuery({ ...turtleDef, structRef, "type": "query" }, this._modelDef, this.name || turtleDef.as || turtleDef.name);
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
462
|
exports.PreparedQuery = PreparedQuery;
|
|
@@ -464,10 +464,10 @@ function parseTableURI(tableURI) {
|
|
|
464
464
|
const parts = tableURI.match(/^([^:]*):(.*)$/);
|
|
465
465
|
if (parts) {
|
|
466
466
|
const [, firstPart, secondPart] = parts;
|
|
467
|
-
return { connectionName: firstPart, tablePath: secondPart };
|
|
467
|
+
return { "connectionName": firstPart, "tablePath": secondPart };
|
|
468
468
|
}
|
|
469
469
|
else {
|
|
470
|
-
return { tablePath: tableURI };
|
|
470
|
+
return { "tablePath": tableURI };
|
|
471
471
|
}
|
|
472
472
|
}
|
|
473
473
|
exports.parseTableURI = parseTableURI;
|
|
@@ -561,8 +561,8 @@ class DocumentRange {
|
|
|
561
561
|
*/
|
|
562
562
|
toJSON() {
|
|
563
563
|
return {
|
|
564
|
-
start: this.start.toJSON(),
|
|
565
|
-
end: this.end.toJSON()
|
|
564
|
+
"start": this.start.toJSON(),
|
|
565
|
+
"end": this.end.toJSON()
|
|
566
566
|
};
|
|
567
567
|
}
|
|
568
568
|
}
|
|
@@ -591,7 +591,7 @@ class DocumentPosition {
|
|
|
591
591
|
* @returns This position in JSON format.
|
|
592
592
|
*/
|
|
593
593
|
toJSON() {
|
|
594
|
-
return { line: this.line, character: this.character };
|
|
594
|
+
return { "line": this.line, "character": this.character };
|
|
595
595
|
}
|
|
596
596
|
}
|
|
597
597
|
exports.DocumentPosition = DocumentPosition;
|
|
@@ -682,7 +682,7 @@ class PreparedResult {
|
|
|
682
682
|
const explore = this.inner.structs[this.inner.structs.length - 1];
|
|
683
683
|
const namedExplore = {
|
|
684
684
|
...explore,
|
|
685
|
-
name: this.inner.queryName || explore.name
|
|
685
|
+
"name": this.inner.queryName || explore.name
|
|
686
686
|
};
|
|
687
687
|
// TODO `sourceExplore` is not fully-implemented yet -- it cannot
|
|
688
688
|
// handle cases where the source of the query is something other than
|
|
@@ -855,22 +855,22 @@ class Explore extends Entity {
|
|
|
855
855
|
}
|
|
856
856
|
getQueryByName(name) {
|
|
857
857
|
const internalQuery = {
|
|
858
|
-
type: "query",
|
|
859
|
-
structRef: this.structDef,
|
|
860
|
-
pipeline: [
|
|
858
|
+
"type": "query",
|
|
859
|
+
"structRef": this.structDef,
|
|
860
|
+
"pipeline": [
|
|
861
861
|
{
|
|
862
|
-
type: "reduce",
|
|
863
|
-
fields: [name]
|
|
864
|
-
}
|
|
865
|
-
]
|
|
862
|
+
"type": "reduce",
|
|
863
|
+
"fields": [name]
|
|
864
|
+
}
|
|
865
|
+
]
|
|
866
866
|
};
|
|
867
867
|
return new PreparedQuery(internalQuery, this.modelDef, name);
|
|
868
868
|
}
|
|
869
869
|
get modelDef() {
|
|
870
870
|
return {
|
|
871
|
-
name: "generated_model",
|
|
872
|
-
exports: [],
|
|
873
|
-
contents: { [this.structDef.name]: this.structDef }
|
|
871
|
+
"name": "generated_model",
|
|
872
|
+
"exports": [],
|
|
873
|
+
"contents": { [this.structDef.name]: this.structDef }
|
|
874
874
|
};
|
|
875
875
|
}
|
|
876
876
|
getSingleExploreModel() {
|
|
@@ -904,7 +904,7 @@ class Explore extends Entity {
|
|
|
904
904
|
["day_of_month", "day_of_week", "day_of_year"].includes(fieldDef.timeframe)) {
|
|
905
905
|
return [
|
|
906
906
|
name,
|
|
907
|
-
new NumberField({ ...fieldDef, type: "number" }, this, sourceField)
|
|
907
|
+
new NumberField({ ...fieldDef, "type": "number" }, this, sourceField)
|
|
908
908
|
];
|
|
909
909
|
}
|
|
910
910
|
return [name, new DateField(fieldDef, this, sourceField)];
|
|
@@ -1282,7 +1282,7 @@ class Runtime {
|
|
|
1282
1282
|
}
|
|
1283
1283
|
else {
|
|
1284
1284
|
connections = {
|
|
1285
|
-
lookupConnection: () => Promise.resolve(arg)
|
|
1285
|
+
"lookupConnection": () => Promise.resolve(arg)
|
|
1286
1286
|
};
|
|
1287
1287
|
}
|
|
1288
1288
|
}
|
|
@@ -1318,16 +1318,16 @@ class Runtime {
|
|
|
1318
1318
|
return new ModelMaterializer(this, async () => {
|
|
1319
1319
|
const parse = source instanceof URL
|
|
1320
1320
|
? await Malloy.parse({
|
|
1321
|
-
url: source,
|
|
1322
|
-
urlReader: this.urlReader
|
|
1321
|
+
"url": source,
|
|
1322
|
+
"urlReader": this.urlReader
|
|
1323
1323
|
})
|
|
1324
1324
|
: Malloy.parse({
|
|
1325
|
-
source
|
|
1325
|
+
source
|
|
1326
1326
|
});
|
|
1327
1327
|
return Malloy.compile({
|
|
1328
|
-
urlReader: this.urlReader,
|
|
1329
|
-
connections: this.connections,
|
|
1330
|
-
parse
|
|
1328
|
+
"urlReader": this.urlReader,
|
|
1329
|
+
"connections": this.connections,
|
|
1330
|
+
parse
|
|
1331
1331
|
});
|
|
1332
1332
|
});
|
|
1333
1333
|
}
|
|
@@ -1575,18 +1575,18 @@ class ModelMaterializer extends FluentState {
|
|
|
1575
1575
|
const connections = this.runtime.connections;
|
|
1576
1576
|
const parse = query instanceof URL
|
|
1577
1577
|
? await Malloy.parse({
|
|
1578
|
-
url: query,
|
|
1579
|
-
urlReader
|
|
1578
|
+
"url": query,
|
|
1579
|
+
urlReader
|
|
1580
1580
|
})
|
|
1581
1581
|
: Malloy.parse({
|
|
1582
|
-
source: query
|
|
1582
|
+
"source": query
|
|
1583
1583
|
});
|
|
1584
1584
|
const model = await this.getModel();
|
|
1585
1585
|
const queryModel = await Malloy.compile({
|
|
1586
1586
|
urlReader,
|
|
1587
1587
|
connections,
|
|
1588
1588
|
parse,
|
|
1589
|
-
model
|
|
1589
|
+
model
|
|
1590
1590
|
});
|
|
1591
1591
|
return queryModel.preparedQuery;
|
|
1592
1592
|
});
|
|
@@ -1628,7 +1628,7 @@ class ModelMaterializer extends FluentState {
|
|
|
1628
1628
|
}
|
|
1629
1629
|
`;
|
|
1630
1630
|
const result = await this.loadQuery(searchMapMalloy).run({
|
|
1631
|
-
rowLimit: 1000
|
|
1631
|
+
"rowLimit": 1000
|
|
1632
1632
|
});
|
|
1633
1633
|
return result._queryResult.result;
|
|
1634
1634
|
}
|
|
@@ -1873,8 +1873,8 @@ class SQLBlockMaterializer extends FluentState {
|
|
|
1873
1873
|
const connections = this.runtime.connections;
|
|
1874
1874
|
return Malloy.run({
|
|
1875
1875
|
connections,
|
|
1876
|
-
sqlStruct: sqlBlock,
|
|
1877
|
-
options
|
|
1876
|
+
"sqlStruct": sqlBlock,
|
|
1877
|
+
options
|
|
1878
1878
|
});
|
|
1879
1879
|
}
|
|
1880
1880
|
async *runStream(options) {
|
|
@@ -1964,7 +1964,7 @@ class Result extends PreparedResult {
|
|
|
1964
1964
|
return this.inner.totalRows;
|
|
1965
1965
|
}
|
|
1966
1966
|
toJSON() {
|
|
1967
|
-
return { queryResult: this.inner, modelDef: this._modelDef };
|
|
1967
|
+
return { "queryResult": this.inner, "modelDef": this._modelDef };
|
|
1968
1968
|
}
|
|
1969
1969
|
static fromJSON({ queryResult, modelDef }) {
|
|
1970
1970
|
return new Result(queryResult, modelDef);
|
|
@@ -2199,12 +2199,12 @@ class DataArray extends Data {
|
|
|
2199
2199
|
return {
|
|
2200
2200
|
next() {
|
|
2201
2201
|
if (currentIndex < queryData.length) {
|
|
2202
|
-
return { value: getRow(currentIndex++), done: false };
|
|
2202
|
+
return { "value": getRow(currentIndex++), "done": false };
|
|
2203
2203
|
}
|
|
2204
2204
|
else {
|
|
2205
|
-
return { value: undefined, done: true };
|
|
2205
|
+
return { "value": undefined, "done": true };
|
|
2206
2206
|
}
|
|
2207
|
-
}
|
|
2207
|
+
}
|
|
2208
2208
|
};
|
|
2209
2209
|
}
|
|
2210
2210
|
async *inMemoryStream() {
|
|
@@ -2294,14 +2294,14 @@ class DataRecord extends Data {
|
|
|
2294
2294
|
if (!returned) {
|
|
2295
2295
|
returned = true;
|
|
2296
2296
|
return {
|
|
2297
|
-
value: getSelf(),
|
|
2298
|
-
done: false
|
|
2297
|
+
"value": getSelf(),
|
|
2298
|
+
"done": false
|
|
2299
2299
|
};
|
|
2300
2300
|
}
|
|
2301
2301
|
else {
|
|
2302
|
-
return { value: undefined, done: true };
|
|
2302
|
+
return { "value": undefined, "done": true };
|
|
2303
2303
|
}
|
|
2304
|
-
}
|
|
2304
|
+
}
|
|
2305
2305
|
};
|
|
2306
2306
|
}
|
|
2307
2307
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Dialect, DialectFieldList } from "../dialect";
|
|
2
|
-
import {
|
|
3
|
-
import { AndChain } from "./utils";
|
|
2
|
+
import { AggregateFragment, AnalyticFragment, CompiledQuery, DialectFragment, Expr, FieldDef, FieldFragment, FieldRef, Filtered, FilterExpression, FilterFragment, JoinRelationship, ModelDef, NamedQuery, OrderBy, Parameter, ParameterFragment, PipeSegment, Query, QueryFieldDef, QuerySegment, ResultMetadataDef, ResultStructMetadataDef, SearchIndexResult, StructDef, StructRef, TurtleDef, UngroupFragment } from "./malloy_types";
|
|
4
3
|
import { Connection } from "../runtime_types";
|
|
4
|
+
import { AndChain } from "./utils";
|
|
5
5
|
interface TurtleDefPlus extends TurtleDef, Filtered {
|
|
6
6
|
}
|
|
7
7
|
interface OutputPipelinedSQL {
|