@malloydata/malloy 0.0.261-dev250411164723 → 0.0.261-dev250411181206

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.
@@ -68,8 +68,9 @@ export declare class MalloyToQuery extends AbstractParseTreeVisitor<Node> implem
68
68
  getFieldExpression(cx: parse.FieldExprContext): Malloy.Expression | null;
69
69
  stripQuote(s: string, q: string): string;
70
70
  getFilterString(cx: parse.FilterStringContext): string | null;
71
- getWhereExpr(cx: parse.FieldExprContext): Malloy.Where | null;
72
- getWhere(whereCx: parse.WhereStatementContext): Malloy.Where[] | null;
71
+ getFilterExpr(cx: parse.FieldExprContext): Malloy.FilterOperation | null;
72
+ getWhere(whereCx: parse.WhereStatementContext): Malloy.FilterOperation[] | null;
73
+ getHaving(havingCx: parse.HavingStatementContext): Malloy.FilterOperation[] | null;
73
74
  protected combineAnnotations(...a: (Malloy.Annotation[] | undefined)[]): Malloy.Annotation[] | undefined;
74
75
  }
75
76
  export declare function malloyToQuery(code: string): {
@@ -466,7 +466,14 @@ class MalloyToQuery extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor
466
466
  }));
467
467
  }
468
468
  else if (cx.havingStatement()) {
469
- this.notAllowed(cx, 'Having statements');
469
+ const hvcx = cx.havingStatement();
470
+ const having = this.getHaving(hvcx);
471
+ if (having === null)
472
+ return null;
473
+ return having.map(h => ({
474
+ kind: 'having',
475
+ ...h,
476
+ }));
470
477
  }
471
478
  else if (cx.nestStatement()) {
472
479
  const obcx = cx.nestStatement();
@@ -662,7 +669,7 @@ class MalloyToQuery extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor
662
669
  }
663
670
  return null;
664
671
  }
665
- getWhereExpr(cx) {
672
+ getFilterExpr(cx) {
666
673
  if (cx instanceof parse.ExprCompareContext) {
667
674
  if (cx.compareOp().MATCH()) {
668
675
  const lhs = cx.fieldExpr()[0];
@@ -694,12 +701,20 @@ class MalloyToQuery extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor
694
701
  }
695
702
  getWhere(whereCx) {
696
703
  const exprs = whereCx.filterClauseList().fieldExpr();
697
- const where = exprs.map(exprCx => this.getWhereExpr(exprCx));
704
+ const where = exprs.map(exprCx => this.getFilterExpr(exprCx));
698
705
  if (where.some(w => w === null)) {
699
706
  return null;
700
707
  }
701
708
  return where;
702
709
  }
710
+ getHaving(havingCx) {
711
+ const exprs = havingCx.filterClauseList().fieldExpr();
712
+ const having = exprs.map(exprCx => this.getFilterExpr(exprCx));
713
+ if (having.some(h => h === null)) {
714
+ return null;
715
+ }
716
+ return having;
717
+ }
703
718
  combineAnnotations(...a) {
704
719
  const annotations = a.flatMap(a => a !== null && a !== void 0 ? a : []);
705
720
  return annotations.length > 0 ? annotations : undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.261-dev250411164723",
3
+ "version": "0.0.261-dev250411181206",
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.261-dev250411164723",
45
- "@malloydata/malloy-interfaces": "^0.0.261-dev250411164723",
46
- "@malloydata/malloy-tag": "^0.0.261-dev250411164723",
44
+ "@malloydata/malloy-filter": "^0.0.261-dev250411181206",
45
+ "@malloydata/malloy-interfaces": "^0.0.261-dev250411181206",
46
+ "@malloydata/malloy-tag": "^0.0.261-dev250411181206",
47
47
  "antlr4ts": "^0.5.0-alpha.4",
48
48
  "assert": "^2.0.0",
49
49
  "jaro-winkler": "^0.2.8",