@malloydata/malloy 0.0.38-dev230606045241 → 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.d.ts +4 -0
- package/dist/malloy.js +8 -1
- package/dist/model/malloy_query.js +9 -5
- package/dist/model/malloy_types.d.ts +1 -0
- package/package.json +1 -1
package/dist/malloy.d.ts
CHANGED
|
@@ -397,6 +397,10 @@ export declare class PreparedResult {
|
|
|
397
397
|
*/
|
|
398
398
|
get resultExplore(): Explore;
|
|
399
399
|
get sourceExplore(): Explore;
|
|
400
|
+
/**
|
|
401
|
+
* @return The query timezone.
|
|
402
|
+
*/
|
|
403
|
+
get queryTimezone(): string | undefined;
|
|
400
404
|
get _sourceExploreName(): string;
|
|
401
405
|
get _sourceFilters(): FilterExpression[];
|
|
402
406
|
}
|
package/dist/malloy.js
CHANGED
|
@@ -224,6 +224,7 @@ class Malloy {
|
|
|
224
224
|
// TODO feature-sql-block There is no source explore...
|
|
225
225
|
sourceExplore: '',
|
|
226
226
|
sourceFilters: [],
|
|
227
|
+
queryTimezone: sqlStruct.queryTimezone,
|
|
227
228
|
}, {
|
|
228
229
|
name: 'empty_model',
|
|
229
230
|
exports: [],
|
|
@@ -338,7 +339,7 @@ class Model {
|
|
|
338
339
|
*/
|
|
339
340
|
getPreparedQueryByName(queryName) {
|
|
340
341
|
const query = this.modelDef.contents[queryName];
|
|
341
|
-
if (query.type === 'query') {
|
|
342
|
+
if ((query === null || query === void 0 ? void 0 : query.type) === 'query') {
|
|
342
343
|
return new PreparedQuery(query, this.modelDef, queryName);
|
|
343
344
|
}
|
|
344
345
|
throw new Error('Given query name does not refer to a named query.');
|
|
@@ -725,6 +726,12 @@ class PreparedResult {
|
|
|
725
726
|
}
|
|
726
727
|
throw new Error(`'${name} is not an explore`);
|
|
727
728
|
}
|
|
729
|
+
/**
|
|
730
|
+
* @return The query timezone.
|
|
731
|
+
*/
|
|
732
|
+
get queryTimezone() {
|
|
733
|
+
return this.inner.queryTimezone;
|
|
734
|
+
}
|
|
728
735
|
get _sourceExploreName() {
|
|
729
736
|
return this.inner.sourceExplore;
|
|
730
737
|
}
|
|
@@ -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;
|
|
@@ -519,6 +519,7 @@ export interface CompiledQuery extends DrillSource {
|
|
|
519
519
|
malloy: string;
|
|
520
520
|
queryName?: string | undefined;
|
|
521
521
|
connectionName: string;
|
|
522
|
+
queryTimezone?: string;
|
|
522
523
|
}
|
|
523
524
|
/** Result type for running a Malloy query. */
|
|
524
525
|
export interface QueryResult extends CompiledQuery {
|