@malloydata/malloy 0.0.38-dev230606235314 → 0.0.38-dev230609163341
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/malloy.js +1 -1
- package/dist/model/malloy_query.js +9 -5
- package/package.json +1 -1
package/dist/malloy.js
CHANGED
|
@@ -339,7 +339,7 @@ class Model {
|
|
|
339
339
|
*/
|
|
340
340
|
getPreparedQueryByName(queryName) {
|
|
341
341
|
const query = this.modelDef.contents[queryName];
|
|
342
|
-
if (query.type === 'query') {
|
|
342
|
+
if ((query === null || query === void 0 ? void 0 : query.type) === 'query') {
|
|
343
343
|
return new PreparedQuery(query, this.modelDef, queryName);
|
|
344
344
|
}
|
|
345
345
|
throw new Error('Given query name does not refer to a named query.');
|
|
@@ -208,11 +208,15 @@ class QueryField extends QueryNode {
|
|
|
208
208
|
// find the structDef and return the path to the field...
|
|
209
209
|
const field = context.getFieldByName(expr.path);
|
|
210
210
|
if ((0, malloy_types_1.hasExpression)(field.fieldDef)) {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
215
|
-
|
|
211
|
+
const ret = this.generateExpressionFromExpr(resultSet, field.parent, field.fieldDef.e, state);
|
|
212
|
+
// in order to avoid too many parens, there was some code here ..
|
|
213
|
+
// if (!ret.match(/^\(.*\)$/)) {
|
|
214
|
+
// ret = `(${ret})`;
|
|
215
|
+
// }
|
|
216
|
+
// but this failed when the expresion was (bool1)or(bool2)
|
|
217
|
+
// there could maybe be a smarter parse of the expression to avoid
|
|
218
|
+
// an extra paren, but correctness first, beauty AND correctness later
|
|
219
|
+
return `(${ret})`;
|
|
216
220
|
}
|
|
217
221
|
else {
|
|
218
222
|
// return field.parent.getIdentifier() + "." + field.fieldDef.name;
|