@malloydata/malloy 0.0.422 → 0.0.423

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.
Files changed (67) hide show
  1. package/README.md +3 -3
  2. package/dist/dialect/databricks/databricks.js +9 -2
  3. package/dist/dialect/mysql/mysql.js +9 -2
  4. package/dist/dialect/postgres/postgres.js +26 -0
  5. package/dist/dialect/snowflake/snowflake.js +30 -1
  6. package/dist/dialect/standardsql/standardsql.js +15 -0
  7. package/dist/dialect/trino/trino.js +5 -0
  8. package/dist/lang/ast/expressions/expr-time-extract.js +3 -2
  9. package/dist/lang/ast/field-space/include-utils.js +5 -5
  10. package/dist/lang/ast/field-space/query-spaces.js +1 -0
  11. package/dist/lang/ast/field-space/reference-field.js +1 -1
  12. package/dist/lang/ast/query-builders/project-builder.js +1 -2
  13. package/dist/lang/ast/query-elements/anonymous-query.d.ts +1 -3
  14. package/dist/lang/ast/query-elements/anonymous-query.js +1 -3
  15. package/dist/lang/ast/query-items/field-declaration.d.ts +1 -3
  16. package/dist/lang/ast/query-items/field-declaration.js +2 -4
  17. package/dist/lang/ast/query-items/field-references.d.ts +2 -5
  18. package/dist/lang/ast/query-items/field-references.js +2 -5
  19. package/dist/lang/ast/query-properties/aggregate.d.ts +1 -0
  20. package/dist/lang/ast/query-properties/aggregate.js +1 -0
  21. package/dist/lang/ast/query-properties/group-by.d.ts +1 -0
  22. package/dist/lang/ast/query-properties/group-by.js +1 -0
  23. package/dist/lang/ast/query-properties/indexing.d.ts +1 -0
  24. package/dist/lang/ast/query-properties/indexing.js +1 -0
  25. package/dist/lang/ast/query-properties/nest.d.ts +1 -0
  26. package/dist/lang/ast/query-properties/nest.js +2 -1
  27. package/dist/lang/ast/query-properties/nests.d.ts +1 -0
  28. package/dist/lang/ast/query-properties/nests.js +1 -0
  29. package/dist/lang/ast/query-properties/project-statement.d.ts +1 -0
  30. package/dist/lang/ast/query-properties/project-statement.js +1 -0
  31. package/dist/lang/ast/query-properties/qop-desc.js +12 -1
  32. package/dist/lang/ast/query-properties/sampling.d.ts +1 -0
  33. package/dist/lang/ast/query-properties/sampling.js +1 -0
  34. package/dist/lang/ast/source-properties/join.d.ts +1 -3
  35. package/dist/lang/ast/source-properties/join.js +4 -6
  36. package/dist/lang/ast/source-properties/renames.d.ts +2 -3
  37. package/dist/lang/ast/source-properties/renames.js +1 -3
  38. package/dist/lang/ast/source-properties/user-type-shape.d.ts +1 -3
  39. package/dist/lang/ast/source-properties/user-type-shape.js +5 -7
  40. package/dist/lang/ast/source-properties/view-field-declaration.d.ts +1 -3
  41. package/dist/lang/ast/source-properties/view-field-declaration.js +1 -3
  42. package/dist/lang/ast/source-query-elements/include-item.d.ts +2 -5
  43. package/dist/lang/ast/source-query-elements/include-item.js +0 -3
  44. package/dist/lang/ast/statements/define-given.d.ts +1 -3
  45. package/dist/lang/ast/statements/define-given.js +2 -4
  46. package/dist/lang/ast/statements/define-query.d.ts +1 -3
  47. package/dist/lang/ast/statements/define-query.js +3 -5
  48. package/dist/lang/ast/statements/define-source.d.ts +1 -3
  49. package/dist/lang/ast/statements/define-source.js +4 -6
  50. package/dist/lang/ast/statements/define-user-type.d.ts +1 -3
  51. package/dist/lang/ast/statements/define-user-type.js +2 -4
  52. package/dist/lang/ast/types/definition-list.d.ts +2 -4
  53. package/dist/lang/ast/types/definition-list.js +6 -11
  54. package/dist/lang/ast/types/malloy-element.d.ts +1 -3
  55. package/dist/lang/ast/types/malloy-element.js +2 -3
  56. package/dist/lang/ast/types/noteable.d.ts +3 -4
  57. package/dist/lang/ast/types/noteable.js +5 -7
  58. package/dist/lang/ast/types/query-property-interface.d.ts +1 -0
  59. package/dist/lang/composite-source-utils.js +1 -2
  60. package/dist/lang/malloy-to-ast.js +33 -32
  61. package/dist/model/filter_compilers.js +27 -1
  62. package/dist/model/malloy_types.d.ts +3 -3
  63. package/dist/model/query_query.d.ts +1 -1
  64. package/dist/model/query_query.js +7 -3
  65. package/dist/version.d.ts +1 -1
  66. package/dist/version.js +1 -1
  67. package/package.json +4 -4
@@ -3,14 +3,13 @@ import type { DynamicSpace } from '../field-space/dynamic-space';
3
3
  import { DefinitionList } from '../types/definition-list';
4
4
  import type { FieldName } from '../types/field-space';
5
5
  import { MalloyElement } from '../types/malloy-element';
6
- import { extendNoteMethod, type Noteable } from '../types/noteable';
6
+ import { type Noteable } from '../types/noteable';
7
7
  import type { MakeEntry } from '../types/space-entry';
8
8
  export declare class RenameField extends MalloyElement implements Noteable, MakeEntry {
9
9
  readonly newName: string;
10
10
  readonly oldName: FieldName;
11
11
  elementType: string;
12
- note?: AnnotationsDef;
13
- extendNote: typeof extendNoteMethod;
12
+ ownAnnotation?: AnnotationsDef;
14
13
  readonly isNoteableObj = true;
15
14
  constructor(newName: string, oldName: FieldName);
16
15
  makeEntry(fs: DynamicSpace): void;
@@ -8,7 +8,6 @@ exports.Renames = exports.RenameField = void 0;
8
8
  const rename_space_field_1 = require("../field-space/rename-space-field");
9
9
  const definition_list_1 = require("../types/definition-list");
10
10
  const malloy_element_1 = require("../types/malloy-element");
11
- const noteable_1 = require("../types/noteable");
12
11
  const space_field_1 = require("../types/space-field");
13
12
  class RenameField extends malloy_element_1.MalloyElement {
14
13
  constructor(newName, oldName) {
@@ -16,7 +15,6 @@ class RenameField extends malloy_element_1.MalloyElement {
16
15
  this.newName = newName;
17
16
  this.oldName = oldName;
18
17
  this.elementType = 'renameField';
19
- this.extendNote = noteable_1.extendNoteMethod;
20
18
  this.isNoteableObj = true;
21
19
  this.has({ oldName: oldName });
22
20
  }
@@ -43,7 +41,7 @@ class RenameField extends malloy_element_1.MalloyElement {
43
41
  */
44
42
  if (oldValue.found) {
45
43
  if (oldValue.found instanceof space_field_1.SpaceField) {
46
- fs.renameEntry(this.oldName.refString, this.newName, new rename_space_field_1.RenameSpaceField(oldValue.found, this.newName, this.location, this.note ? { ...this.note } : undefined));
44
+ fs.renameEntry(this.oldName.refString, this.newName, new rename_space_field_1.RenameSpaceField(oldValue.found, this.newName, this.location, this.ownAnnotation ? { ...this.ownAnnotation } : undefined));
47
45
  }
48
46
  else {
49
47
  this.logError('failed-rename', `'${this.oldName}' cannot be renamed`);
@@ -1,12 +1,10 @@
1
1
  import type { AnnotationsDef, AtomicTypeDef, UserTypeFieldDef } from '../../../model/malloy_types';
2
2
  import { ListOf, MalloyElement } from '../types/malloy-element';
3
3
  import type { Noteable } from '../types/noteable';
4
- import { extendNoteMethod } from '../types/noteable';
5
4
  export declare abstract class UserTypeMember extends MalloyElement implements Noteable {
6
5
  readonly name: string;
7
6
  readonly isNoteableObj = true;
8
- extendNote: typeof extendNoteMethod;
9
- note?: AnnotationsDef;
7
+ ownAnnotation?: AnnotationsDef;
10
8
  constructor(name: string);
11
9
  abstract userTypeFieldDef(): UserTypeFieldDef;
12
10
  }
@@ -7,13 +7,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.UserTypeShape = exports.UserTypeMemberIndirect = exports.UserTypeMemberDef = exports.UserTypeMember = void 0;
8
8
  const malloy_types_1 = require("../../../model/malloy_types");
9
9
  const malloy_element_1 = require("../types/malloy-element");
10
- const noteable_1 = require("../types/noteable");
11
10
  class UserTypeMember extends malloy_element_1.MalloyElement {
12
11
  constructor(name) {
13
12
  super();
14
13
  this.name = name;
15
14
  this.isNoteableObj = true;
16
- this.extendNote = noteable_1.extendNoteMethod;
17
15
  }
18
16
  }
19
17
  exports.UserTypeMember = UserTypeMember;
@@ -28,8 +26,8 @@ class UserTypeMemberDef extends UserTypeMember {
28
26
  name: this.name,
29
27
  typeDef: this.typeDef,
30
28
  };
31
- if (this.note) {
32
- field.annotations = { ...this.note };
29
+ if (this.ownAnnotation) {
30
+ field.annotations = { ...this.ownAnnotation };
33
31
  }
34
32
  return field;
35
33
  }
@@ -75,13 +73,13 @@ class UserTypeMemberIndirect extends UserTypeMember {
75
73
  typeDef = (0, malloy_types_1.mkArrayTypeDef)(typeDef);
76
74
  }
77
75
  const field = { name: this.name, typeDef };
78
- if (this.note) {
76
+ if (this.ownAnnotation) {
79
77
  field.annotations = modelEntry.entry.annotations
80
78
  ? {
81
- ...this.note,
79
+ ...this.ownAnnotation,
82
80
  inherits: modelEntry.entry.annotations,
83
81
  }
84
- : { ...this.note };
82
+ : { ...this.ownAnnotation };
85
83
  }
86
84
  else if (modelEntry.entry.annotations) {
87
85
  field.annotations = {
@@ -4,15 +4,13 @@ import { MalloyElement } from '../types/malloy-element';
4
4
  import type { DynamicSpace } from '../field-space/dynamic-space';
5
5
  import type { View } from '../view-elements/view';
6
6
  import type { Noteable } from '../types/noteable';
7
- import { extendNoteMethod } from '../types/noteable';
8
7
  import type { MakeEntry } from '../types/space-entry';
9
8
  export declare class ViewFieldDeclaration extends MalloyElement implements Noteable, MakeEntry {
10
9
  readonly name: string;
11
10
  readonly view: View;
12
11
  elementType: string;
13
12
  readonly isNoteableObj = true;
14
- extendNote: typeof extendNoteMethod;
15
- note?: model.AnnotationsDef;
13
+ ownAnnotation?: model.AnnotationsDef;
16
14
  constructor(name: string, view: View);
17
15
  makeEntry(fs: DynamicSpace): void;
18
16
  getName(): string;
@@ -6,7 +6,6 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.ViewFieldDeclaration = void 0;
8
8
  const malloy_element_1 = require("../types/malloy-element");
9
- const noteable_1 = require("../types/noteable");
10
9
  const query_utils_1 = require("../query-utils");
11
10
  const ast_view_field_1 = require("../field-space/ast-view-field");
12
11
  class ViewFieldDeclaration extends malloy_element_1.MalloyElement {
@@ -16,7 +15,6 @@ class ViewFieldDeclaration extends malloy_element_1.MalloyElement {
16
15
  this.view = view;
17
16
  this.elementType = 'view-field-declaration';
18
17
  this.isNoteableObj = true;
19
- this.extendNote = noteable_1.extendNoteMethod;
20
18
  }
21
19
  makeEntry(fs) {
22
20
  const qf = new ast_view_field_1.ASTViewField(fs, this, this.name);
@@ -33,7 +31,7 @@ class ViewFieldDeclaration extends malloy_element_1.MalloyElement {
33
31
  name: this.name,
34
32
  pipeline: checkedPipeline,
35
33
  annotations: {
36
- ...this.note,
34
+ ...this.ownAnnotation,
37
35
  inherits: annotations,
38
36
  },
39
37
  location: this.location,
@@ -2,7 +2,6 @@ import { MalloyElement } from '../types/malloy-element';
2
2
  import type { AccessModifierFieldReference, FieldReference, WildcardFieldReference } from '../query-items/field-references';
3
3
  import type { AnnotationsDef } from '../../../model';
4
4
  import type { Noteable } from '../types/noteable';
5
- import { extendNoteMethod } from '../types/noteable';
6
5
  export declare abstract class IncludeItem extends MalloyElement {
7
6
  abstract kind: 'private' | 'public' | 'internal' | 'except' | undefined;
8
7
  }
@@ -11,8 +10,7 @@ export declare class IncludeAccessItem extends IncludeItem implements Noteable {
11
10
  readonly fields: IncludeListItem[];
12
11
  elementType: string;
13
12
  readonly isNoteableObj = true;
14
- extendNote: typeof extendNoteMethod;
15
- note?: AnnotationsDef;
13
+ ownAnnotation?: AnnotationsDef;
16
14
  constructor(kind: 'private' | 'public' | 'internal' | undefined, fields: IncludeListItem[]);
17
15
  }
18
16
  export declare class IncludeExceptItem extends IncludeItem {
@@ -26,7 +24,6 @@ export declare class IncludeListItem extends MalloyElement implements Noteable {
26
24
  readonly as: string | undefined;
27
25
  elementType: string;
28
26
  readonly isNoteableObj = true;
29
- extendNote: typeof extendNoteMethod;
30
- note?: AnnotationsDef;
27
+ ownAnnotation?: AnnotationsDef;
31
28
  constructor(name: AccessModifierFieldReference | WildcardFieldReference, as: string | undefined);
32
29
  }
@@ -6,7 +6,6 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.IncludeListItem = exports.IncludeExceptItem = exports.IncludeAccessItem = exports.IncludeItem = void 0;
8
8
  const malloy_element_1 = require("../types/malloy-element");
9
- const noteable_1 = require("../types/noteable");
10
9
  // type RenameSpec = {
11
10
  // as: string;
12
11
  // name: FieldReference;
@@ -22,7 +21,6 @@ class IncludeAccessItem extends IncludeItem {
22
21
  this.fields = fields;
23
22
  this.elementType = 'include-access-item';
24
23
  this.isNoteableObj = true;
25
- this.extendNote = noteable_1.extendNoteMethod;
26
24
  this.has({ fields });
27
25
  }
28
26
  }
@@ -44,7 +42,6 @@ class IncludeListItem extends malloy_element_1.MalloyElement {
44
42
  this.as = as;
45
43
  this.elementType = 'include-list-item';
46
44
  this.isNoteableObj = true;
47
- this.extendNote = noteable_1.extendNoteMethod;
48
45
  }
49
46
  }
50
47
  exports.IncludeListItem = IncludeListItem;
@@ -3,15 +3,13 @@ import type { ConstantExpression } from '../expressions/constant-expression';
3
3
  import type { DocStatement, Document } from '../types/malloy-element';
4
4
  import { DocStatementList, MalloyElement } from '../types/malloy-element';
5
5
  import type { Noteable } from '../types/noteable';
6
- import { extendNoteMethod } from '../types/noteable';
7
6
  export declare class GivenDeclaration extends MalloyElement implements DocStatement, Noteable {
8
7
  readonly name: string;
9
8
  readonly typeDef: GivenTypeDef;
10
9
  readonly inline: boolean;
11
10
  elementType: string;
12
11
  readonly isNoteableObj = true;
13
- extendNote: typeof extendNoteMethod;
14
- note?: AnnotationsDef;
12
+ ownAnnotation?: AnnotationsDef;
15
13
  readonly default?: ConstantExpression;
16
14
  constructor(name: string, typeDef: GivenTypeDef, defaultExpr?: ConstantExpression, inline?: boolean);
17
15
  protected varInfo(): string;
@@ -11,7 +11,6 @@ const source_def_utils_1 = require("../../../model/source_def_utils");
11
11
  const utils_1 = require("../../../model/utils");
12
12
  const expression_def_1 = require("../types/expression-def");
13
13
  const malloy_element_1 = require("../types/malloy-element");
14
- const noteable_1 = require("../types/noteable");
15
14
  // `filter<T>` defaults can't be type-checked via TD.eq — the filter
16
15
  // expression value shape doesn't match an atomic typeDef. Catch only
17
16
  // the gross kind mismatch here; inner-content validation (filter
@@ -60,7 +59,6 @@ class GivenDeclaration extends malloy_element_1.MalloyElement {
60
59
  this.inline = inline;
61
60
  this.elementType = 'given';
62
61
  this.isNoteableObj = true;
63
- this.extendNote = noteable_1.extendNoteMethod;
64
62
  if (defaultExpr) {
65
63
  this.default = defaultExpr;
66
64
  this.has({ default: defaultExpr });
@@ -193,7 +191,7 @@ class GivenDeclaration extends malloy_element_1.MalloyElement {
193
191
  defaultText,
194
192
  givenUsage,
195
193
  location: this.location,
196
- annotations: this.note ? { ...this.note } : undefined,
194
+ annotations: this.ownAnnotation ? { ...this.ownAnnotation } : undefined,
197
195
  ...(this.inline ? { inline: true } : {}),
198
196
  };
199
197
  doc.documentGivens.set(id, givenIR);
@@ -215,7 +213,7 @@ class GivenDeclaration extends malloy_element_1.MalloyElement {
215
213
  },
216
214
  definition: {
217
215
  type: (0, utils_1.typeDefToString)(this.typeDef),
218
- annotations: this.note ? { ...this.note } : undefined,
216
+ annotations: this.ownAnnotation ? { ...this.ownAnnotation } : undefined,
219
217
  location: this.location,
220
218
  defaultText,
221
219
  },
@@ -2,7 +2,6 @@ import type { AnnotationsDef } from '../../../model/malloy_types';
2
2
  import type { DocStatement, Document } from '../types/malloy-element';
3
3
  import { MalloyElement, DocStatementList } from '../types/malloy-element';
4
4
  import type { Noteable } from '../types/noteable';
5
- import { extendNoteMethod } from '../types/noteable';
6
5
  import type { SourceQueryElement } from '../source-query-elements/source-query-element';
7
6
  export declare class DefineQuery extends MalloyElement implements DocStatement, Noteable {
8
7
  readonly name: string;
@@ -10,8 +9,7 @@ export declare class DefineQuery extends MalloyElement implements DocStatement,
10
9
  elementType: string;
11
10
  constructor(name: string, queryExpr: SourceQueryElement);
12
11
  readonly isNoteableObj = true;
13
- extendNote: typeof extendNoteMethod;
14
- note?: AnnotationsDef;
12
+ ownAnnotation?: AnnotationsDef;
15
13
  execute(doc: Document): void;
16
14
  }
17
15
  export declare class DefineQueryList extends DocStatementList {
@@ -6,7 +6,6 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.DefineQueryList = exports.DefineQuery = void 0;
8
8
  const malloy_element_1 = require("../types/malloy-element");
9
- const noteable_1 = require("../types/noteable");
10
9
  class DefineQuery extends malloy_element_1.MalloyElement {
11
10
  constructor(name, queryExpr) {
12
11
  super({ queryExpr });
@@ -14,7 +13,6 @@ class DefineQuery extends malloy_element_1.MalloyElement {
14
13
  this.queryExpr = queryExpr;
15
14
  this.elementType = 'defineQuery';
16
15
  this.isNoteableObj = true;
17
- this.extendNote = noteable_1.extendNoteMethod;
18
16
  }
19
17
  execute(doc) {
20
18
  const existing = doc.getEntry(this.name);
@@ -33,10 +31,10 @@ class DefineQuery extends malloy_element_1.MalloyElement {
33
31
  name: this.name,
34
32
  location: this.location,
35
33
  };
36
- if (this.note) {
34
+ if (this.ownAnnotation) {
37
35
  entry.annotations = entry.annotations
38
- ? { ...this.note, inherits: entry.annotations }
39
- : { ...this.note };
36
+ ? { ...this.ownAnnotation, inherits: entry.annotations }
37
+ : { ...this.ownAnnotation };
40
38
  }
41
39
  doc.setEntry(this.name, { entry, exported: true });
42
40
  }
@@ -3,7 +3,6 @@ import type { HasParameter } from '../parameters/has-parameter';
3
3
  import type { DocStatement, Document } from '../types/malloy-element';
4
4
  import { MalloyElement, DocStatementList } from '../types/malloy-element';
5
5
  import type { Noteable } from '../types/noteable';
6
- import { extendNoteMethod } from '../types/noteable';
7
6
  import type { SourceQueryElement } from '../source-query-elements/source-query-element';
8
7
  export declare class DefineSource extends MalloyElement implements DocStatement, Noteable {
9
8
  readonly name: string;
@@ -13,8 +12,7 @@ export declare class DefineSource extends MalloyElement implements DocStatement,
13
12
  elementType: string;
14
13
  constructor(name: string, sourceExpr: SourceQueryElement | undefined, exported: boolean, parameters?: HasParameter[] | undefined);
15
14
  readonly isNoteableObj = true;
16
- extendNote: typeof extendNoteMethod;
17
- note?: AnnotationsDef;
15
+ ownAnnotation?: AnnotationsDef;
18
16
  execute(doc: Document): void;
19
17
  private deduplicatedParameters;
20
18
  private validateParameterShadowing;
@@ -10,7 +10,6 @@ const source_def_utils_1 = require("../../../model/source_def_utils");
10
10
  const persist_utils_1 = require("../../../model/persist_utils");
11
11
  const error_factory_1 = require("../error-factory");
12
12
  const malloy_element_1 = require("../types/malloy-element");
13
- const noteable_1 = require("../types/noteable");
14
13
  const composite_source_utils_1 = require("../../composite-source-utils");
15
14
  class DefineSource extends malloy_element_1.MalloyElement {
16
15
  constructor(name, sourceExpr, exported, parameters) {
@@ -21,7 +20,6 @@ class DefineSource extends malloy_element_1.MalloyElement {
21
20
  this.parameters = parameters;
22
21
  this.elementType = 'defineSource';
23
22
  this.isNoteableObj = true;
24
- this.extendNote = noteable_1.extendNoteMethod;
25
23
  if (sourceExpr) {
26
24
  this.has({ sourceExpr });
27
25
  }
@@ -50,13 +48,13 @@ class DefineSource extends malloy_element_1.MalloyElement {
50
48
  as: this.name,
51
49
  location: this.location,
52
50
  };
53
- if (this.note) {
51
+ if (this.ownAnnotation) {
54
52
  entry.annotations = structDef.annotations
55
53
  ? {
56
- ...this.note,
54
+ ...this.ownAnnotation,
57
55
  inherits: structDef.annotations,
58
56
  }
59
- : { ...this.note };
57
+ : { ...this.ownAnnotation };
60
58
  }
61
59
  if ((0, malloy_types_1.isSourceDef)(entry)) {
62
60
  // Every source gets a stable identity for its own definition. referenceID
@@ -70,7 +68,7 @@ class DefineSource extends malloy_element_1.MalloyElement {
70
68
  }
71
69
  }
72
70
  entry.partitionComposite =
73
- (_d = (0, composite_source_utils_1.getPartitionCompositeDesc)(this.note, structDef, (_c = this.sourceExpr) !== null && _c !== void 0 ? _c : this)) !== null && _d !== void 0 ? _d : structDef.partitionComposite;
71
+ (_d = (0, composite_source_utils_1.getPartitionCompositeDesc)(this.ownAnnotation, structDef, (_c = this.sourceExpr) !== null && _c !== void 0 ? _c : this)) !== null && _d !== void 0 ? _d : structDef.partitionComposite;
74
72
  doc.setEntry(this.name, { entry, exported: this.exported });
75
73
  }
76
74
  deduplicatedParameters() {
@@ -1,7 +1,6 @@
1
1
  import type { DocStatement, Document } from '../types/malloy-element';
2
2
  import { MalloyElement, DocStatementList } from '../types/malloy-element';
3
3
  import type { Noteable } from '../types/noteable';
4
- import { extendNoteMethod } from '../types/noteable';
5
4
  import type { AnnotationsDef, UserTypeFieldDef } from '../../../model/malloy_types';
6
5
  import type { UserTypeMember } from '../source-properties/user-type-shape';
7
6
  import { UserTypeShape } from '../source-properties/user-type-shape';
@@ -18,8 +17,7 @@ export declare class DefineUserType extends MalloyElement implements DocStatemen
18
17
  elementType: string;
19
18
  constructor(name: string, shapeDef: UserTypeShape, exported: boolean);
20
19
  readonly isNoteableObj = true;
21
- extendNote: typeof extendNoteMethod;
22
- note?: AnnotationsDef;
20
+ ownAnnotation?: AnnotationsDef;
23
21
  execute(doc: Document): void;
24
22
  }
25
23
  export declare class DefineUserTypeList extends DocStatementList {
@@ -6,7 +6,6 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.DefineUserTypeList = exports.DefineUserType = exports.ExtendedUserTypeShape = void 0;
8
8
  const malloy_element_1 = require("../types/malloy-element");
9
- const noteable_1 = require("../types/noteable");
10
9
  const malloy_types_1 = require("../../../model/malloy_types");
11
10
  const user_type_shape_1 = require("../source-properties/user-type-shape");
12
11
  class ExtendedUserTypeShape extends user_type_shape_1.UserTypeShape {
@@ -47,7 +46,6 @@ class DefineUserType extends malloy_element_1.MalloyElement {
47
46
  this.exported = exported;
48
47
  this.elementType = 'defineUserType';
49
48
  this.isNoteableObj = true;
50
- this.extendNote = noteable_1.extendNoteMethod;
51
49
  this.has({ shapeDef });
52
50
  }
53
51
  execute(doc) {
@@ -65,8 +63,8 @@ class DefineUserType extends malloy_element_1.MalloyElement {
65
63
  fields,
66
64
  location: this.location,
67
65
  };
68
- if (this.note) {
69
- entry.annotations = { ...this.note };
66
+ if (this.ownAnnotation) {
67
+ entry.annotations = { ...this.ownAnnotation };
70
68
  }
71
69
  doc.setEntry(this.name, { entry, exported: this.exported });
72
70
  }
@@ -4,8 +4,6 @@ import { ListOf } from './malloy-element';
4
4
  import type { Noteable } from '../types/noteable';
5
5
  export declare abstract class DefinitionList<DT extends MalloyElement> extends ListOf<DT> implements Noteable {
6
6
  readonly isNoteableObj = true;
7
- note?: AnnotationsDef;
8
- extendNote(ext: Partial<AnnotationsDef>): void;
9
- distributeAnnotation(): void;
10
- protected newContents(): void;
7
+ ownAnnotation?: AnnotationsDef;
8
+ afterExtendAnnotation(): void;
11
9
  }
@@ -12,23 +12,18 @@ class DefinitionList extends malloy_element_1.ListOf {
12
12
  super(...arguments);
13
13
  this.isNoteableObj = true;
14
14
  }
15
- extendNote(ext) {
16
- (0, noteable_1.extendNoteHelper)(this, ext);
17
- this.distributeAnnotation();
18
- }
19
- distributeAnnotation() {
20
- if (this.note) {
15
+ // Noteable hook: push this list's own (block) annotation down onto its
16
+ // members. The block annotation is attached after construction, so it has
17
+ // to distribute here, at attach time, rather than from the constructor.
18
+ afterExtendAnnotation() {
19
+ if (this.ownAnnotation) {
21
20
  for (const el of this.elements) {
22
21
  if ((0, noteable_1.isNoteable)(el)) {
23
- el.extendNote(this.note);
22
+ (0, noteable_1.extendOwnAnnotation)(el, this.ownAnnotation);
24
23
  }
25
24
  }
26
25
  }
27
26
  }
28
- newContents() {
29
- super.newContents();
30
- this.distributeAnnotation();
31
- }
32
27
  }
33
28
  exports.DefinitionList = DefinitionList;
34
29
  //# sourceMappingURL=definition-list.js.map
@@ -8,7 +8,6 @@ import type { ExprValue } from './expr-value';
8
8
  import type { ModelEntry } from './model-entry';
9
9
  import type { NameSpace } from './name-space';
10
10
  import type { Noteable } from './noteable';
11
- import { extendNoteMethod } from './noteable';
12
11
  export declare abstract class MalloyElement {
13
12
  abstract elementType: string;
14
13
  codeLocation?: DocumentLocation;
@@ -107,8 +106,7 @@ export declare class DocStatementList extends ListOf<DocStatement | DocStatement
107
106
  elementType: string;
108
107
  execCursor: number;
109
108
  readonly isNoteableObj = true;
110
- extendNote: typeof extendNoteMethod;
111
- note?: AnnotationsDef;
109
+ ownAnnotation?: AnnotationsDef;
112
110
  noteCursor: number;
113
111
  executeList(doc: Document): ModelDataRequest;
114
112
  }
@@ -364,7 +364,6 @@ class DocStatementList extends ListOf {
364
364
  this.elementType = 'topLevelStatements';
365
365
  this.execCursor = 0;
366
366
  this.isNoteableObj = true;
367
- this.extendNote = noteable_1.extendNoteMethod;
368
367
  this.noteCursor = 0;
369
368
  }
370
369
  executeList(doc) {
@@ -373,8 +372,8 @@ class DocStatementList extends ListOf {
373
372
  if (this.noteCursor === this.execCursor) {
374
373
  // We only want to set the note on each element once,
375
374
  // but we might execute a element multiple times
376
- if (this.note && (0, noteable_1.isNoteable)(el)) {
377
- el.extendNote(this.note);
375
+ if (this.ownAnnotation && (0, noteable_1.isNoteable)(el)) {
376
+ (0, noteable_1.extendOwnAnnotation)(el, this.ownAnnotation);
378
377
  }
379
378
  this.noteCursor += 1;
380
379
  }
@@ -4,9 +4,8 @@ import type { AnnotationsDef } from '../../../model/malloy_types';
4
4
  */
5
5
  export interface Noteable {
6
6
  isNoteableObj: true;
7
- note?: AnnotationsDef;
8
- extendNote(ext: Partial<AnnotationsDef>): void;
7
+ ownAnnotation?: AnnotationsDef;
8
+ afterExtendAnnotation?(): void;
9
9
  }
10
10
  export declare function isNoteable(el: unknown): el is Noteable;
11
- export declare function extendNoteMethod(this: Noteable, ext: Partial<AnnotationsDef>): void;
12
- export declare function extendNoteHelper(to: Noteable, ext: Partial<AnnotationsDef>): void;
11
+ export declare function extendOwnAnnotation(to: Noteable, ext: Partial<AnnotationsDef>): void;
@@ -5,19 +5,17 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.isNoteable = isNoteable;
8
- exports.extendNoteMethod = extendNoteMethod;
9
- exports.extendNoteHelper = extendNoteHelper;
8
+ exports.extendOwnAnnotation = extendOwnAnnotation;
10
9
  function isNoteable(el) {
11
10
  return el.isNoteableObj;
12
11
  }
13
- function extendNoteMethod(ext) {
14
- extendNoteHelper(this, ext);
15
- }
16
- function extendNoteHelper(to, ext) {
12
+ function extendOwnAnnotation(to, ext) {
13
+ var _a;
17
14
  if ((ext.notes && ext.notes.length > 0) ||
18
15
  (ext.blockNotes && ext.blockNotes.length > 0) ||
19
16
  ext.inherits !== undefined) {
20
- to.note = { ...to.note, ...ext };
17
+ to.ownAnnotation = { ...to.ownAnnotation, ...ext };
18
+ (_a = to.afterExtendAnnotation) === null || _a === void 0 ? void 0 : _a.call(to);
21
19
  }
22
20
  }
23
21
  //# sourceMappingURL=noteable.js.map
@@ -19,6 +19,7 @@ export declare enum LegalRefinementStage {
19
19
  export interface QueryPropertyInterface {
20
20
  queryRefinementStage: LegalRefinementStage | undefined;
21
21
  forceQueryClass: QueryClass | undefined;
22
+ statement?: string;
22
23
  needsExplicitQueryClass?: boolean;
23
24
  queryExecute?: (executeFor: QueryBuilder) => void;
24
25
  }
@@ -1217,8 +1217,7 @@ function computeQueryGivenUsage(pipeline) {
1217
1217
  // because composite resolution runs first and `expandRefUsage` is seeded
1218
1218
  // with the resolved branch. If an unresolved `CompositeSourceDef` ever
1219
1219
  // reaches here (e.g. composites in join positions if/when those work),
1220
- // the conservative union over all branches is the safe fallback. See
1221
- // ~/ctx/mp/implementation.md "Composite sources — partial coverage".
1220
+ // the conservative union over all branches is the safe fallback.
1222
1221
  function givenUsageOfSource(sd) {
1223
1222
  var _a, _b, _c;
1224
1223
  const fromFilters = ((_a = sd.filterList) !== null && _a !== void 0 ? _a : []).flatMap(f => (0, malloy_types_1.givenUsageFrom)(f.refSummary));