@malloydata/malloy-interfaces 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.
package/dist/to_malloy.js CHANGED
@@ -273,6 +273,8 @@ function groupedOperationsToFragments(operations) {
273
273
  return limitToFragments(operations);
274
274
  case 'where':
275
275
  return whereToFragments(operations);
276
+ case 'having':
277
+ return havingToFragments(operations);
276
278
  }
277
279
  }
278
280
  function formatBlock(label, items, separator = '') {
@@ -407,7 +409,10 @@ function limitToFragments(limits) {
407
409
  return fragments;
408
410
  }
409
411
  function whereToFragments(where) {
410
- return formatBlock('where', where.map(whereItemToFragments), ',');
412
+ return formatBlock('where', where.map(filterOperationItemToFragments), ',');
413
+ }
414
+ function havingToFragments(having) {
415
+ return formatBlock('having', having.map(filterOperationItemToFragments), ',');
411
416
  }
412
417
  const FILTER_QUOTES = ['`', "'", '"']; // technically , '"""', "'''" are valid too, but they're ugly
413
418
  function quoteFilter(filter) {
@@ -441,7 +446,7 @@ function escapeFilter(filter, quote) {
441
446
  }
442
447
  return result;
443
448
  }
444
- function whereItemToFragments(whereItem) {
449
+ function filterOperationItemToFragments(whereItem) {
445
450
  switch (whereItem.filter.kind) {
446
451
  case 'filter_string':
447
452
  return [
package/dist/types.d.ts CHANGED
@@ -220,6 +220,9 @@ export type Filter = FilterWithFilterString;
220
220
  export type FilterWithFilterString = {
221
221
  kind: 'filter_string';
222
222
  } & FilterStringApplication;
223
+ export type FilterOperation = {
224
+ filter: Filter;
225
+ };
223
226
  export type FilterStringApplication = {
224
227
  field_reference: Reference;
225
228
  filter: string;
@@ -490,8 +493,8 @@ export type ViewInfo = {
490
493
  annotations?: Array<Annotation>;
491
494
  definition?: View;
492
495
  };
493
- export type ViewOperationType = 'group_by' | 'aggregate' | 'order_by' | 'limit' | 'where' | 'nest';
494
- export type ViewOperation = ViewOperationWithGroupBy | ViewOperationWithAggregate | ViewOperationWithOrderBy | ViewOperationWithLimit | ViewOperationWithWhere | ViewOperationWithNest;
496
+ export type ViewOperationType = 'group_by' | 'aggregate' | 'order_by' | 'limit' | 'where' | 'nest' | 'having';
497
+ export type ViewOperation = ViewOperationWithGroupBy | ViewOperationWithAggregate | ViewOperationWithOrderBy | ViewOperationWithLimit | ViewOperationWithWhere | ViewOperationWithNest | ViewOperationWithHaving;
495
498
  export type ViewOperationWithGroupBy = {
496
499
  kind: 'group_by';
497
500
  } & GroupBy;
@@ -506,10 +509,13 @@ export type ViewOperationWithLimit = {
506
509
  } & Limit;
507
510
  export type ViewOperationWithWhere = {
508
511
  kind: 'where';
509
- } & Where;
512
+ } & FilterOperation;
510
513
  export type ViewOperationWithNest = {
511
514
  kind: 'nest';
512
515
  } & Nest;
516
+ export type ViewOperationWithHaving = {
517
+ kind: 'having';
518
+ } & FilterOperation;
513
519
  export type ViewRefinement = {
514
520
  base: ViewDefinition;
515
521
  refinement: ViewDefinition;
package/dist/types.js CHANGED
@@ -511,6 +511,17 @@ exports.MALLOY_INTERFACE_TYPES = {
511
511
  'filter_string': 'FilterStringApplication',
512
512
  },
513
513
  },
514
+ 'FilterOperation': {
515
+ 'type': 'struct',
516
+ 'name': 'FilterOperation',
517
+ 'fields': {
518
+ 'filter': {
519
+ 'type': 'Filter',
520
+ 'optional': false,
521
+ 'array': false,
522
+ },
523
+ },
524
+ },
514
525
  'FilterStringApplication': {
515
526
  'type': 'struct',
516
527
  'name': 'FilterStringApplication',
@@ -1447,8 +1458,9 @@ exports.MALLOY_INTERFACE_TYPES = {
1447
1458
  'aggregate': 'Aggregate',
1448
1459
  'order_by': 'OrderBy',
1449
1460
  'limit': 'Limit',
1450
- 'where': 'Where',
1461
+ 'where': 'FilterOperation',
1451
1462
  'nest': 'Nest',
1463
+ 'having': 'FilterOperation',
1452
1464
  },
1453
1465
  },
1454
1466
  'ViewRefinement': {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy-interfaces",
3
- "version": "0.0.261-dev250411164723",
3
+ "version": "0.0.261-dev250411181206",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -236,8 +236,9 @@ union ViewOperation {
236
236
  2: required Aggregate aggregate,
237
237
  3: OrderBy order_by,
238
238
  4: required Limit limit,
239
- 5: required Where where,
239
+ 5: required FilterOperation where,
240
240
  6: required Nest nest,
241
+ 7: required FilterOperation having,
241
242
  }
242
243
 
243
244
  struct GroupBy {
@@ -279,6 +280,10 @@ struct Where {
279
280
  1: required Filter filter,
280
281
  }
281
282
 
283
+ struct FilterOperation {
284
+ 1: required Filter filter,
285
+ }
286
+
282
287
  union Filter {
283
288
  1: required FilterStringApplication filter_string,
284
289
  }