@malloydata/malloy 0.0.399 → 0.0.401

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 (91) hide show
  1. package/dist/api/annotation-utils.d.ts +36 -0
  2. package/dist/api/annotation-utils.js +76 -0
  3. package/dist/api/core.js +3 -3
  4. package/dist/api/foundation/annotation.d.ts +115 -0
  5. package/dist/{annotation.js → api/foundation/annotation.js} +87 -42
  6. package/dist/api/foundation/compile.js +3 -3
  7. package/dist/api/foundation/core.d.ts +122 -29
  8. package/dist/api/foundation/core.js +185 -59
  9. package/dist/api/foundation/index.d.ts +1 -1
  10. package/dist/api/foundation/index.js +3 -2
  11. package/dist/api/foundation/runtime.js +2 -2
  12. package/dist/{taggable.d.ts → api/foundation/taggable.d.ts} +4 -4
  13. package/dist/api/foundation/types.d.ts +1 -1
  14. package/dist/connection/types.d.ts +3 -2
  15. package/dist/index.d.ts +9 -2
  16. package/dist/index.js +17 -4
  17. package/dist/{prefix.js → lang/annotation-prefix.js} +1 -1
  18. package/dist/lang/ast/expressions/expr-given.js +1 -1
  19. package/dist/lang/ast/field-space/dynamic-space.d.ts +1 -1
  20. package/dist/lang/ast/field-space/dynamic-space.js +2 -2
  21. package/dist/lang/ast/field-space/include-utils.d.ts +3 -3
  22. package/dist/lang/ast/field-space/query-spaces.js +2 -2
  23. package/dist/lang/ast/field-space/reference-field.js +5 -5
  24. package/dist/lang/ast/field-space/refined-space.d.ts +2 -2
  25. package/dist/lang/ast/field-space/refined-space.js +3 -3
  26. package/dist/lang/ast/field-space/rename-space-field.d.ts +2 -2
  27. package/dist/lang/ast/field-space/rename-space-field.js +4 -4
  28. package/dist/lang/ast/field-space/static-space.js +1 -1
  29. package/dist/lang/ast/query-elements/anonymous-query.d.ts +2 -2
  30. package/dist/lang/ast/query-elements/anonymous-query.js +3 -3
  31. package/dist/lang/ast/query-elements/query-arrow.js +2 -2
  32. package/dist/lang/ast/query-items/field-declaration.d.ts +2 -2
  33. package/dist/lang/ast/query-items/field-declaration.js +1 -1
  34. package/dist/lang/ast/query-items/field-references.d.ts +3 -3
  35. package/dist/lang/ast/query-properties/nest.js +2 -2
  36. package/dist/lang/ast/source-elements/composite-source.d.ts +2 -2
  37. package/dist/lang/ast/source-elements/refined-source.d.ts +2 -2
  38. package/dist/lang/ast/source-elements/sql-source.js +1 -1
  39. package/dist/lang/ast/source-elements/typed-source.js +7 -4
  40. package/dist/lang/ast/source-properties/join.d.ts +2 -2
  41. package/dist/lang/ast/source-properties/join.js +2 -2
  42. package/dist/lang/ast/source-properties/renames.d.ts +2 -2
  43. package/dist/lang/ast/source-properties/user-type-shape.d.ts +2 -2
  44. package/dist/lang/ast/source-properties/user-type-shape.js +7 -7
  45. package/dist/lang/ast/source-properties/view-field-declaration.d.ts +1 -1
  46. package/dist/lang/ast/source-properties/view-field-declaration.js +2 -2
  47. package/dist/lang/ast/source-query-elements/include-item.d.ts +3 -3
  48. package/dist/lang/ast/statements/define-given.d.ts +2 -2
  49. package/dist/lang/ast/statements/define-given.js +2 -2
  50. package/dist/lang/ast/statements/define-query.d.ts +2 -2
  51. package/dist/lang/ast/statements/define-query.js +2 -2
  52. package/dist/lang/ast/statements/define-source.d.ts +2 -2
  53. package/dist/lang/ast/statements/define-source.js +2 -2
  54. package/dist/lang/ast/statements/define-user-type.d.ts +2 -2
  55. package/dist/lang/ast/statements/define-user-type.js +1 -1
  56. package/dist/lang/ast/statements/import-statement.js +1 -1
  57. package/dist/lang/ast/types/annotation-elements.js +3 -3
  58. package/dist/lang/ast/types/definition-list.d.ts +3 -3
  59. package/dist/lang/ast/types/literal.d.ts +1 -1
  60. package/dist/lang/ast/types/malloy-element.d.ts +4 -4
  61. package/dist/lang/ast/types/malloy-element.js +15 -15
  62. package/dist/lang/ast/types/noteable.d.ts +5 -5
  63. package/dist/lang/ast/types/pipeline-comp.d.ts +2 -2
  64. package/dist/lang/ast/view-elements/reference-view.js +1 -1
  65. package/dist/lang/ast/view-elements/view-refine.js +1 -1
  66. package/dist/lang/composite-source-utils.d.ts +2 -2
  67. package/dist/lang/composite-source-utils.js +6 -6
  68. package/dist/lang/malloy-to-ast.d.ts +3 -3
  69. package/dist/lang/malloy-to-ast.js +5 -5
  70. package/dist/lang/malloy-to-stable-query.d.ts +2 -2
  71. package/dist/lang/parse-malloy.js +6 -6
  72. package/dist/lang/parse-tree-walkers/model-annotation-walker.d.ts +2 -2
  73. package/dist/lang/parse-tree-walkers/model-annotation-walker.js +2 -2
  74. package/dist/lang/prettify/index.js +1 -1
  75. package/dist/lang/prettify/leaf.js +2 -2
  76. package/dist/lang/translate-response.d.ts +2 -2
  77. package/dist/model/malloy_types.d.ts +29 -25
  78. package/dist/model/persist_utils.js +3 -3
  79. package/dist/model/query_model_impl.js +1 -1
  80. package/dist/model/query_node.js +8 -8
  81. package/dist/model/query_query.js +13 -13
  82. package/dist/model/source_def_utils.js +4 -4
  83. package/dist/run_sql_options.d.ts +5 -11
  84. package/dist/to_stable.d.ts +2 -2
  85. package/dist/to_stable.js +7 -7
  86. package/dist/version.d.ts +1 -1
  87. package/dist/version.js +1 -1
  88. package/package.json +4 -4
  89. package/dist/annotation.d.ts +0 -96
  90. /package/dist/{taggable.js → api/foundation/taggable.js} +0 -0
  91. /package/dist/{prefix.d.ts → lang/annotation-prefix.d.ts} +0 -0
@@ -29,7 +29,7 @@ class UserTypeMemberDef extends UserTypeMember {
29
29
  typeDef: this.typeDef,
30
30
  };
31
31
  if (this.note) {
32
- field.annotation = this.note;
32
+ field.annotations = this.note;
33
33
  }
34
34
  return field;
35
35
  }
@@ -62,8 +62,8 @@ class UserTypeMemberIndirect extends UserTypeMember {
62
62
  }
63
63
  const fieldsFromReferencedType = modelEntry.entry.fields.map(f => {
64
64
  const field = (0, malloy_types_1.mkFieldDef)(f.typeDef, f.name);
65
- if (f.annotation) {
66
- field.annotation = f.annotation;
65
+ if (f.annotations) {
66
+ field.annotations = f.annotations;
67
67
  }
68
68
  return field;
69
69
  });
@@ -76,12 +76,12 @@ class UserTypeMemberIndirect extends UserTypeMember {
76
76
  }
77
77
  const field = { name: this.name, typeDef };
78
78
  if (this.note) {
79
- field.annotation = modelEntry.entry.annotation
80
- ? { ...this.note, inherits: modelEntry.entry.annotation }
79
+ field.annotations = modelEntry.entry.annotations
80
+ ? { ...this.note, inherits: modelEntry.entry.annotations }
81
81
  : this.note;
82
82
  }
83
- else if (modelEntry.entry.annotation) {
84
- field.annotation = { inherits: modelEntry.entry.annotation };
83
+ else if (modelEntry.entry.annotations) {
84
+ field.annotations = { inherits: modelEntry.entry.annotations };
85
85
  }
86
86
  return field;
87
87
  }
@@ -12,7 +12,7 @@ export declare class ViewFieldDeclaration extends MalloyElement implements Notea
12
12
  elementType: string;
13
13
  readonly isNoteableObj = true;
14
14
  extendNote: typeof extendNoteMethod;
15
- note?: model.Annotation;
15
+ note?: model.AnnotationsDef;
16
16
  constructor(name: string, view: View);
17
17
  makeEntry(fs: DynamicSpace): void;
18
18
  getName(): string;
@@ -44,13 +44,13 @@ class ViewFieldDeclaration extends malloy_element_1.MalloyElement {
44
44
  return this.name;
45
45
  }
46
46
  getFieldDef(fs) {
47
- const { pipeline, annotation } = this.view.pipelineComp(fs);
47
+ const { pipeline, annotations } = this.view.pipelineComp(fs);
48
48
  const checkedPipeline = (0, query_utils_1.detectAndRemovePartialStages)(pipeline, this);
49
49
  const def = {
50
50
  type: 'turtle',
51
51
  name: this.name,
52
52
  pipeline: checkedPipeline,
53
- annotation: { ...this.note, inherits: annotation },
53
+ annotations: { ...this.note, inherits: annotations },
54
54
  location: this.location,
55
55
  };
56
56
  return def;
@@ -1,6 +1,6 @@
1
1
  import { MalloyElement } from '../types/malloy-element';
2
2
  import type { AccessModifierFieldReference, FieldReference, WildcardFieldReference } from '../query-items/field-references';
3
- import type { Annotation } from '../../../model';
3
+ import type { AnnotationsDef } from '../../../model';
4
4
  import type { Noteable } from '../types/noteable';
5
5
  import { extendNoteMethod } from '../types/noteable';
6
6
  export declare abstract class IncludeItem extends MalloyElement {
@@ -12,7 +12,7 @@ export declare class IncludeAccessItem extends IncludeItem implements Noteable {
12
12
  elementType: string;
13
13
  readonly isNoteableObj = true;
14
14
  extendNote: typeof extendNoteMethod;
15
- note?: Annotation;
15
+ note?: AnnotationsDef;
16
16
  constructor(kind: 'private' | 'public' | 'internal' | undefined, fields: IncludeListItem[]);
17
17
  }
18
18
  export declare class IncludeExceptItem extends IncludeItem {
@@ -27,6 +27,6 @@ export declare class IncludeListItem extends MalloyElement implements Noteable {
27
27
  elementType: string;
28
28
  readonly isNoteableObj = true;
29
29
  extendNote: typeof extendNoteMethod;
30
- note?: Annotation;
30
+ note?: AnnotationsDef;
31
31
  constructor(name: AccessModifierFieldReference | WildcardFieldReference, as: string | undefined);
32
32
  }
@@ -1,4 +1,4 @@
1
- import type { Annotation, GivenTypeDef } from '../../../model/malloy_types';
1
+ import type { AnnotationsDef, GivenTypeDef } from '../../../model/malloy_types';
2
2
  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';
@@ -11,7 +11,7 @@ export declare class GivenDeclaration extends MalloyElement implements DocStatem
11
11
  elementType: string;
12
12
  readonly isNoteableObj = true;
13
13
  extendNote: typeof extendNoteMethod;
14
- note?: Annotation;
14
+ note?: AnnotationsDef;
15
15
  readonly default?: ConstantExpression;
16
16
  constructor(name: string, typeDef: GivenTypeDef, defaultExpr?: ConstantExpression, inline?: boolean);
17
17
  protected varInfo(): string;
@@ -173,7 +173,7 @@ class GivenDeclaration extends malloy_element_1.MalloyElement {
173
173
  defaultText,
174
174
  givenUsage,
175
175
  location: this.location,
176
- annotation: this.note,
176
+ annotations: this.note,
177
177
  ...(this.inline ? { inline: true } : {}),
178
178
  };
179
179
  doc.documentGivens.set(id, givenIR);
@@ -195,7 +195,7 @@ class GivenDeclaration extends malloy_element_1.MalloyElement {
195
195
  },
196
196
  definition: {
197
197
  type: (0, utils_1.typeDefToString)(this.typeDef),
198
- annotation: this.note,
198
+ annotations: this.note,
199
199
  location: this.location,
200
200
  defaultText,
201
201
  },
@@ -1,4 +1,4 @@
1
- import type { Annotation } from '../../../model/malloy_types';
1
+ 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';
@@ -11,7 +11,7 @@ export declare class DefineQuery extends MalloyElement implements DocStatement,
11
11
  constructor(name: string, queryExpr: SourceQueryElement);
12
12
  readonly isNoteableObj = true;
13
13
  extendNote: typeof extendNoteMethod;
14
- note?: Annotation;
14
+ note?: AnnotationsDef;
15
15
  execute(doc: Document): void;
16
16
  }
17
17
  export declare class DefineQueryList extends DocStatementList {
@@ -52,8 +52,8 @@ class DefineQuery extends malloy_element_1.MalloyElement {
52
52
  location: this.location,
53
53
  };
54
54
  if (this.note) {
55
- entry.annotation = entry.annotation
56
- ? { ...this.note, inherits: entry.annotation }
55
+ entry.annotations = entry.annotations
56
+ ? { ...this.note, inherits: entry.annotations }
57
57
  : this.note;
58
58
  }
59
59
  doc.setEntry(this.name, { entry, exported: true });
@@ -1,4 +1,4 @@
1
- import type { Annotation } from '../../../model/malloy_types';
1
+ import type { AnnotationsDef } from '../../../model/malloy_types';
2
2
  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';
@@ -14,7 +14,7 @@ export declare class DefineSource extends MalloyElement implements DocStatement,
14
14
  constructor(name: string, sourceExpr: SourceQueryElement | undefined, exported: boolean, parameters?: HasParameter[] | undefined);
15
15
  readonly isNoteableObj = true;
16
16
  extendNote: typeof extendNoteMethod;
17
- note?: Annotation;
17
+ note?: AnnotationsDef;
18
18
  execute(doc: Document): void;
19
19
  private deduplicatedParameters;
20
20
  private validateParameterShadowing;
@@ -69,8 +69,8 @@ class DefineSource extends malloy_element_1.MalloyElement {
69
69
  location: this.location,
70
70
  };
71
71
  if (this.note) {
72
- entry.annotation = structDef.annotation
73
- ? { ...this.note, inherits: structDef.annotation }
72
+ entry.annotations = structDef.annotations
73
+ ? { ...this.note, inherits: structDef.annotations }
74
74
  : this.note;
75
75
  }
76
76
  if ((0, malloy_types_1.isPersistableSourceDef)(entry)) {
@@ -2,7 +2,7 @@ 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
4
  import { extendNoteMethod } from '../types/noteable';
5
- import type { Annotation, UserTypeFieldDef } from '../../../model/malloy_types';
5
+ import type { AnnotationsDef, UserTypeFieldDef } from '../../../model/malloy_types';
6
6
  import type { UserTypeMember } from '../source-properties/user-type-shape';
7
7
  import { UserTypeShape } from '../source-properties/user-type-shape';
8
8
  export declare class ExtendedUserTypeShape extends UserTypeShape {
@@ -19,7 +19,7 @@ export declare class DefineUserType extends MalloyElement implements DocStatemen
19
19
  constructor(name: string, shapeDef: UserTypeShape, exported: boolean);
20
20
  readonly isNoteableObj = true;
21
21
  extendNote: typeof extendNoteMethod;
22
- note?: Annotation;
22
+ note?: AnnotationsDef;
23
23
  execute(doc: Document): void;
24
24
  }
25
25
  export declare class DefineUserTypeList extends DocStatementList {
@@ -66,7 +66,7 @@ class DefineUserType extends malloy_element_1.MalloyElement {
66
66
  location: this.location,
67
67
  };
68
68
  if (this.note) {
69
- entry.annotation = this.note;
69
+ entry.annotations = this.note;
70
70
  }
71
71
  doc.setEntry(this.name, { entry, exported: this.exported });
72
72
  }
@@ -166,7 +166,7 @@ class ImportStatement extends malloy_element_1.ListOf {
166
166
  location: importOne.location,
167
167
  definition: {
168
168
  type: (0, utils_1.typeDefToString)(givenIR.type),
169
- annotation: givenIR.annotation,
169
+ annotations: givenIR.annotations,
170
170
  location: givenIR.location,
171
171
  defaultText: givenIR.defaultText,
172
172
  },
@@ -54,10 +54,10 @@ class ModelAnnotation extends ObjectAnnotation {
54
54
  this.logError('restricted-construct-forbidden', `\`${line}\` cannot be used in a restricted query — compiler-flag annotations are not permitted.`, { at: note.at });
55
55
  }
56
56
  }
57
- if (doc.annotation.notes === undefined) {
58
- doc.annotation.notes = [];
57
+ if (doc.annotations.notes === undefined) {
58
+ doc.annotations.notes = [];
59
59
  }
60
- doc.annotation.notes.push(...this.notes);
60
+ doc.annotations.notes.push(...this.notes);
61
61
  }
62
62
  }
63
63
  exports.ModelAnnotation = ModelAnnotation;
@@ -1,11 +1,11 @@
1
- import type { Annotation } from '../../../model';
1
+ import type { AnnotationsDef } from '../../../model';
2
2
  import type { MalloyElement } from './malloy-element';
3
3
  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?: Annotation;
8
- extendNote(ext: Partial<Annotation>): void;
7
+ note?: AnnotationsDef;
8
+ extendNote(ext: Partial<AnnotationsDef>): void;
9
9
  distributeAnnotation(): void;
10
10
  protected newContents(): void;
11
11
  }
@@ -4,4 +4,4 @@ import { LiteralDay, LiteralHour, LiteralMonth, LiteralTimestamp, LiteralYear }
4
4
  import { ExprNumber } from '../expressions/expr-number';
5
5
  import type { ExpressionDef } from './expression-def';
6
6
  export type Literal = LiteralTimestamp | LiteralHour | LiteralMonth | LiteralDay | LiteralYear | ExprNumber | ExprString | Boolean;
7
- export declare function isLiteral(value: ExpressionDef): value is ExprString | ExprNumber | Boolean | LiteralTimestamp | LiteralHour | LiteralDay | LiteralMonth | LiteralYear;
7
+ export declare function isLiteral(value: ExpressionDef): value is ExprString | Boolean | LiteralTimestamp | LiteralHour | LiteralDay | LiteralMonth | LiteralYear | ExprNumber;
@@ -1,4 +1,4 @@
1
- import type { Annotation, DocumentLocation, DocumentReference, Given, ModelDef, ModelAnnotation, NamedModelObject, Query, SourceID, SourceRegistryValue, StructDef } from '../../../model/malloy_types';
1
+ import type { AnnotationsDef, DocumentLocation, DocumentReference, Given, ModelDef, ModelAnnotationsDef, NamedModelObject, Query, SourceID, SourceRegistryValue, StructDef } from '../../../model/malloy_types';
2
2
  import { Tag } from '@malloydata/malloy-tag';
3
3
  import type { LogMessageOptions, MessageLogger, MessageParameterType, MessageCode } from '../../parse-log';
4
4
  import type { MalloyTranslation } from '../../parse-malloy';
@@ -101,7 +101,7 @@ export declare class DocStatementList extends ListOf<DocStatement | DocStatement
101
101
  execCursor: number;
102
102
  readonly isNoteableObj = true;
103
103
  extendNote: typeof extendNoteMethod;
104
- note?: Annotation;
104
+ note?: AnnotationsDef;
105
105
  noteCursor: number;
106
106
  executeList(doc: Document): ModelDataRequest;
107
107
  }
@@ -116,7 +116,7 @@ export declare class Document extends MalloyElement implements NameSpace {
116
116
  statements: DocStatementList;
117
117
  didInitModel: boolean;
118
118
  modelWasModified: boolean;
119
- annotation: Annotation;
119
+ annotations: AnnotationsDef;
120
120
  experiments: Tag;
121
121
  constructor(statements: (DocStatement | DocStatementList)[]);
122
122
  initModelDef(extendingModelDef: ModelDef | undefined): void;
@@ -126,7 +126,7 @@ export declare class Document extends MalloyElement implements NameSpace {
126
126
  private checkGivenAliasCollisions;
127
127
  private checkQueryGivenSatisfiability;
128
128
  hasAnnotation(): boolean;
129
- currentModelAnnotation(): ModelAnnotation | undefined;
129
+ currentModelAnnotation(): ModelAnnotationsDef | undefined;
130
130
  modelDef(): ModelDef;
131
131
  getEntry(str: string): ModelEntry | undefined;
132
132
  setEntry(str: string, ent: ModelEntry): void;
@@ -121,7 +121,7 @@ class MalloyElement {
121
121
  text: key,
122
122
  definition: {
123
123
  type: result.entry.type,
124
- annotation: result.entry.annotation,
124
+ annotations: result.entry.annotations,
125
125
  location: result.entry.location,
126
126
  },
127
127
  location: reference.location,
@@ -133,7 +133,7 @@ class MalloyElement {
133
133
  text: key,
134
134
  definition: {
135
135
  type: result.entry.type,
136
- annotation: result.entry.annotation,
136
+ annotations: result.entry.annotations,
137
137
  location: result.entry.location,
138
138
  },
139
139
  location: reference.location,
@@ -463,7 +463,7 @@ class Document extends MalloyElement {
463
463
  this.queryList = [];
464
464
  this.didInitModel = false;
465
465
  this.modelWasModified = false;
466
- this.annotation = {};
466
+ this.annotations = {};
467
467
  this.experiments = new malloy_tag_1.Tag({});
468
468
  this.modelAnnotationTodoList = [];
469
469
  this.dialectNameSpaces = new Map();
@@ -480,8 +480,8 @@ class Document extends MalloyElement {
480
480
  this.explicitExports = undefined;
481
481
  this.queryList = [];
482
482
  if (extendingModelDef) {
483
- if (extendingModelDef.annotation) {
484
- this.annotation.inherits = extendingModelDef.annotation;
483
+ if (extendingModelDef.annotations) {
484
+ this.annotations.inherits = extendingModelDef.annotations;
485
485
  }
486
486
  for (const [nm, orig] of Object.entries(extendingModelDef.contents)) {
487
487
  const entry = { ...orig };
@@ -509,14 +509,14 @@ class Document extends MalloyElement {
509
509
  this.checkGivenAliasCollisions();
510
510
  this.checkQueryGivenSatisfiability();
511
511
  for (const q of this.queryList) {
512
- if (q.modelAnnotation === undefined && modelDef.annotation) {
513
- q.modelAnnotation = modelDef.annotation;
512
+ if (q.modelAnnotations === undefined && modelDef.annotations) {
513
+ q.modelAnnotations = modelDef.annotations;
514
514
  }
515
515
  }
516
516
  }
517
- if (modelDef.annotation) {
517
+ if (modelDef.annotations) {
518
518
  for (const sd of this.modelAnnotationTodoList) {
519
- sd.modelAnnotation || (sd.modelAnnotation = modelDef.annotation);
519
+ sd.modelAnnotations || (sd.modelAnnotations = modelDef.annotations);
520
520
  }
521
521
  }
522
522
  const ret = {
@@ -609,12 +609,12 @@ class Document extends MalloyElement {
609
609
  }
610
610
  }
611
611
  hasAnnotation() {
612
- return ((this.annotation.notes && this.annotation.notes.length > 0) ||
613
- this.annotation.inherits !== undefined);
612
+ return ((this.annotations.notes && this.annotations.notes.length > 0) ||
613
+ this.annotations.inherits !== undefined);
614
614
  }
615
615
  currentModelAnnotation() {
616
616
  if (this.hasAnnotation()) {
617
- const ret = { ...this.annotation, id: '' };
617
+ const ret = { ...this.annotations, id: '' };
618
618
  ret.id = annotationID(ret);
619
619
  return ret;
620
620
  }
@@ -622,7 +622,7 @@ class Document extends MalloyElement {
622
622
  modelDef() {
623
623
  const def = (0, utils_1.mkModelDef)('');
624
624
  if (this.hasAnnotation()) {
625
- def.annotation = this.currentModelAnnotation();
625
+ def.annotations = this.currentModelAnnotation();
626
626
  }
627
627
  const explicit = this.explicitExports;
628
628
  const isExported = (name, modelEntry) => explicit ? explicit.has(name) : modelEntry.exported === true;
@@ -639,8 +639,8 @@ class Document extends MalloyElement {
639
639
  }
640
640
  else {
641
641
  const newEntry = { ...entryDef };
642
- if (newEntry.modelAnnotation === undefined && def.annotation) {
643
- newEntry.modelAnnotation = def.annotation;
642
+ if (newEntry.modelAnnotations === undefined && def.annotations) {
643
+ newEntry.modelAnnotations = def.annotations;
644
644
  }
645
645
  def.contents[name] = newEntry;
646
646
  }
@@ -1,12 +1,12 @@
1
- import type { Annotation } from '../../../model/malloy_types';
1
+ import type { AnnotationsDef } from '../../../model/malloy_types';
2
2
  /**
3
3
  * An object which can receive annotations is "Noteable"
4
4
  */
5
5
  export interface Noteable {
6
6
  isNoteableObj: true;
7
- note?: Annotation;
8
- extendNote(ext: Partial<Annotation>): void;
7
+ note?: AnnotationsDef;
8
+ extendNote(ext: Partial<AnnotationsDef>): void;
9
9
  }
10
10
  export declare function isNoteable(el: unknown): el is Noteable;
11
- export declare function extendNoteMethod(this: Noteable, ext: Partial<Annotation>): void;
12
- export declare function extendNoteHelper(to: Noteable, ext: Partial<Annotation>): void;
11
+ export declare function extendNoteMethod(this: Noteable, ext: Partial<AnnotationsDef>): void;
12
+ export declare function extendNoteHelper(to: Noteable, ext: Partial<AnnotationsDef>): void;
@@ -1,7 +1,7 @@
1
- import type { Annotation, PipeSegment, SourceDef } from '../../../model/malloy_types';
1
+ import type { AnnotationsDef, PipeSegment, SourceDef } from '../../../model/malloy_types';
2
2
  export interface PipelineComp {
3
3
  outputStruct: SourceDef;
4
4
  pipeline: PipeSegment[];
5
- annotation?: Annotation;
5
+ annotations?: AnnotationsDef;
6
6
  name?: string;
7
7
  }
@@ -123,7 +123,7 @@ class ReferenceView extends view_1.View {
123
123
  return {
124
124
  pipeline,
125
125
  name: fieldDef.name,
126
- annotation: fieldDef.annotation,
126
+ annotations: fieldDef.annotations,
127
127
  outputStruct: pipeline[pipeline.length - 1].outputStruct,
128
128
  };
129
129
  }
@@ -44,7 +44,7 @@ class ViewRefine extends view_1.View {
44
44
  const resultPipe = this.refinement.refine(fs, query.pipeline, isNestIn);
45
45
  return {
46
46
  pipeline: resultPipe,
47
- annotation: query.annotation,
47
+ annotations: query.annotations,
48
48
  outputStruct: resultPipe.length > 0
49
49
  ? resultPipe[resultPipe.length - 1].outputStruct
50
50
  : error_factory_1.ErrorFactory.structDef,
@@ -1,5 +1,5 @@
1
1
  import type { MalloyElement } from './ast';
2
- import type { FieldUsage, FieldUsageEntry, GivenUsage, PipeSegment, RefSummary, SourceDef, RequiredGroupBy, Annotation, PartitionCompositeDesc, StructDef } from '../model/malloy_types';
2
+ import type { FieldUsage, FieldUsageEntry, GivenUsage, PipeSegment, RefSummary, SourceDef, RequiredGroupBy, AnnotationsDef, PartitionCompositeDesc, StructDef } from '../model/malloy_types';
3
3
  type CompositeCouldNotFindFieldError = {
4
4
  code: 'could_not_find_field';
5
5
  data: {
@@ -51,7 +51,7 @@ interface CompositeFailure {
51
51
  issues: CompositeIssue[];
52
52
  }
53
53
  export declare function getExpandedSegment(segment: PipeSegment, inputSource: SourceDef): PipeSegment;
54
- export declare function getPartitionCompositeDesc(annotation: Annotation | undefined, structDef: StructDef, logTo: MalloyElement): PartitionCompositeDesc | undefined;
54
+ export declare function getPartitionCompositeDesc(annotations: AnnotationsDef | undefined, structDef: StructDef, logTo: MalloyElement): PartitionCompositeDesc | undefined;
55
55
  type SingleNarrowedCompositeFieldResolution = {
56
56
  source: SourceDef;
57
57
  nested?: SingleNarrowedCompositeFieldResolution | undefined;
@@ -33,7 +33,7 @@ const malloy_filter_1 = require("@malloydata/malloy-filter");
33
33
  const malloy_types_1 = require("../model/malloy_types");
34
34
  const utils_1 = require("./utils");
35
35
  const utils_2 = require("../model/utils");
36
- const annotation_1 = require("../annotation");
36
+ const annotation_1 = require("../api/foundation/annotation");
37
37
  function _resolveCompositeSources(path, source, rootFields, nests, fieldUsage,
38
38
  // for resolving nested composites; the list of sources to try
39
39
  sources) {
@@ -115,13 +115,13 @@ sources) {
115
115
  }
116
116
  base = {
117
117
  ...resolveInner.success,
118
- annotation: composeAnnotations(base.annotation, resolveInner.success.annotation),
118
+ annotations: composeAnnotations(base.annotations, resolveInner.success.annotations),
119
119
  };
120
120
  }
121
121
  else {
122
122
  base = {
123
123
  ...inputSource,
124
- annotation: composeAnnotations(base.annotation, inputSource.annotation),
124
+ annotations: composeAnnotations(base.annotations, inputSource.annotations),
125
125
  };
126
126
  }
127
127
  const fields = [...nonCompositeFields, ...base.fields];
@@ -544,10 +544,10 @@ function getPartitionCompositeFilter(partitionComposite, fieldUsage) {
544
544
  };
545
545
  return { partitionFilter, issues: undefined };
546
546
  }
547
- function getPartitionCompositeDesc(annotation, structDef, logTo) {
548
- if (annotation === undefined)
547
+ function getPartitionCompositeDesc(annotations, structDef, logTo) {
548
+ if (annotations === undefined)
549
549
  return undefined;
550
- const compilerFlags = new annotation_1.Annotations(annotation).parseAsTag('!').tag;
550
+ const compilerFlags = new annotation_1.Annotations(annotations).parseAsTag('!').tag;
551
551
  const partitionCompositeTag = compilerFlags.tag('experimental', 'partition_composite');
552
552
  if (partitionCompositeTag === undefined)
553
553
  return undefined;
@@ -25,7 +25,7 @@ interface IndirectUserType {
25
25
  arrayDepth: number;
26
26
  }
27
27
  type UserTypeFieldTypeResult = AtomicTypeDef | IndirectUserType;
28
- type HasAnnotations = ParserRuleContext & {
28
+ type AnnotatedCtx = ParserRuleContext & {
29
29
  annotation: () => parse.AnnotationContext[];
30
30
  };
31
31
  /**
@@ -99,7 +99,7 @@ export declare class MalloyToAST extends AbstractParseTreeVisitor<ast.MalloyElem
99
99
  * malformation marker through the IR and are not re-warned by importers.
100
100
  */
101
101
  private warnIfMalformedPrefix;
102
- protected getNotes(cx: HasAnnotations): Note[];
102
+ protected getNotes(cx: AnnotatedCtx): Note[];
103
103
  protected getIsNotes(cx: parse.IsDefineContext): Note[];
104
104
  visitMalloyDocument(pcx: parse.MalloyDocumentContext): ast.Document;
105
105
  visitDefineSourceStatement(pcx: parse.DefineSourceStatementContext): ast.DefineSourceList;
@@ -280,7 +280,7 @@ export declare class MalloyToAST extends AbstractParseTreeVisitor<ast.MalloyElem
280
280
  visitSegRefine(pcx: parse.SegRefineContext): ast.ViewRefine;
281
281
  visitVArrow(pcx: parse.VArrowContext): ast.ViewArrow;
282
282
  visitSQRefinedQuery(pcx: parse.SQRefinedQueryContext): ast.SQRefine;
283
- visitSQTable(pcx: parse.SQTableContext): ErrorNode | ast.SQSource;
283
+ visitSQTable(pcx: parse.SQTableContext): ast.SQSource | ErrorNode;
284
284
  visitSQVirtual(pcx: parse.SQVirtualContext): ast.SQSource;
285
285
  visitSQSQL(pcx: parse.SQSQLContext): ast.SQSource;
286
286
  visitExperimentalStatementForTesting(pcx: parse.ExperimentalStatementForTestingContext): ast.ExperimentalExperiment;
@@ -62,7 +62,7 @@ const AbstractParseTreeVisitor_1 = require("antlr4ts/tree/AbstractParseTreeVisit
62
62
  const ast = __importStar(require("./ast"));
63
63
  const parse_log_1 = require("./parse-log");
64
64
  const Interval_1 = require("antlr4ts/misc/Interval");
65
- const prefix_1 = require("../prefix");
65
+ const annotation_prefix_1 = require("./annotation-prefix");
66
66
  const ast_1 = require("./ast");
67
67
  const parse_utils_1 = require("./parse-utils");
68
68
  const malloy_types_1 = require("../model/malloy_types");
@@ -283,7 +283,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
283
283
  * malformation marker through the IR and are not re-warned by importers.
284
284
  */
285
285
  warnIfMalformedPrefix(text, cx) {
286
- const parsed = (0, prefix_1.parsePrefix)(text);
286
+ const parsed = (0, annotation_prefix_1.parsePrefix)(text);
287
287
  if (parsed.malformation === undefined)
288
288
  return;
289
289
  // The slice up to contentIndex is "prefix + separator"; trim trailing
@@ -1552,7 +1552,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
1552
1552
  for (const a of pcx.docAnnotation()) {
1553
1553
  const block = a.docBlockAnnotation();
1554
1554
  if (block && !block.BLOCK_ANNOTATION_END()) {
1555
- this.contextError(pcx, 'unclosed-block-annotation', 'Block annotation is not closed, add correctly indented "|##"');
1555
+ this.contextError(pcx, 'unclosed-block-annotation', 'Multi-line annotation is not closed, add correctly indented "|##"');
1556
1556
  }
1557
1557
  }
1558
1558
  const allNotes = pcx.docAnnotation().map(a => {
@@ -1570,7 +1570,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
1570
1570
  return block && !block.BLOCK_ANNOTATION_END();
1571
1571
  });
1572
1572
  if (hasUnclosedBlock) {
1573
- this.contextError(pcx, 'unclosed-block-annotation', 'Block annotation is not closed, add correctly indented "|#"');
1573
+ this.contextError(pcx, 'unclosed-block-annotation', 'Multi-line annotation is not closed, add correctly indented "|#"');
1574
1574
  }
1575
1575
  else {
1576
1576
  this.contextError(pcx, 'orphaned-object-annotation', 'Object annotation not connected to any object');
@@ -1583,7 +1583,7 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
1583
1583
  return block && !block.BLOCK_ANNOTATION_END();
1584
1584
  });
1585
1585
  if (hasUnclosedBlock) {
1586
- this.contextError(pcx, 'unclosed-block-annotation', 'Block annotation is not closed, add correctly indented "|##"');
1586
+ this.contextError(pcx, 'unclosed-block-annotation', 'Multi-line annotation is not closed, add correctly indented "|##"');
1587
1587
  }
1588
1588
  else {
1589
1589
  this.contextError(pcx, 'misplaced-model-annotation', 'Model annotations not allowed at this scope');
@@ -8,7 +8,7 @@ import type { LogMessageOptions, MessageCode, MessageLogger, MessageParameterTyp
8
8
  import type { DocumentLocation } from '../model/malloy_types';
9
9
  import type { ParseInfo } from './utils';
10
10
  import type { TimeLiteral } from './ast';
11
- type HasAnnotations = ParserRuleContext & {
11
+ type AnnotatedCtx = ParserRuleContext & {
12
12
  annotation: () => parse.AnnotationContext[];
13
13
  };
14
14
  type Node = Malloy.Query | Malloy.QueryDefinitionWithArrow | Malloy.QueryDefinitionWithQueryReference | Malloy.QueryDefinitionWithRefinement | null;
@@ -41,7 +41,7 @@ export declare class MalloyToQuery extends AbstractParseTreeVisitor<Node> implem
41
41
  * @param cx Any parse context which has an annotation* rule
42
42
  * @returns Array of texts for the annotations
43
43
  */
44
- protected getAnnotations(cx: HasAnnotations): Malloy.Annotation[] | undefined;
44
+ protected getAnnotations(cx: AnnotatedCtx): Malloy.Annotation[] | undefined;
45
45
  protected getIsAnnotations(cx?: parse.IsDefineContext): Malloy.Annotation[] | undefined;
46
46
  protected notAllowed(pcx: ParserRuleContext, what: string): void;
47
47
  protected illegal(pcx: ParserRuleContext, what: string): void;
@@ -72,7 +72,7 @@ const utils_2 = require("./utils");
72
72
  const malloy_tag_1 = require("@malloydata/malloy-tag");
73
73
  const model_annotation_walker_1 = require("./parse-tree-walkers/model-annotation-walker");
74
74
  const find_table_path_walker_1 = require("./parse-tree-walkers/find-table-path-walker");
75
- const annotation_1 = require("../annotation");
75
+ const annotation_1 = require("../api/foundation/annotation");
76
76
  const run_malloy_parser_1 = require("./run-malloy-parser");
77
77
  const timing_1 = require("../timing");
78
78
  class ParseStep {
@@ -420,11 +420,11 @@ class ModelAnnotationStep {
420
420
  return tryParse;
421
421
  }
422
422
  else {
423
- const modelAnnotation = (0, model_annotation_walker_1.walkForModelAnnotation)(that, tryParse.parse.tokenStream, tryParse.parse);
423
+ const modelAnnotations = (0, model_annotation_walker_1.walkForModelAnnotation)(that, tryParse.parse.tokenStream, tryParse.parse);
424
424
  this.response = {
425
- modelAnnotation: {
426
- ...modelAnnotation,
427
- inherits: extendingModel === null || extendingModel === void 0 ? void 0 : extendingModel.annotation,
425
+ modelAnnotations: {
426
+ ...modelAnnotations,
427
+ inherits: extendingModel === null || extendingModel === void 0 ? void 0 : extendingModel.annotations,
428
428
  },
429
429
  };
430
430
  }
@@ -478,7 +478,7 @@ class TranslateStep {
478
478
  // seeding (e.g. TestTranslator's compilerFlags option) survive.
479
479
  if (extendingModel && !this.importedAnnotations) {
480
480
  const parseCompilerFlagsTimer = new timing_1.Timer('parse_compiler_flags');
481
- that.compilerFlagSrc.push(...new annotation_1.Annotations(extendingModel.annotation).texts('!'));
481
+ that.compilerFlagSrc.push(...new annotation_1.Annotations(extendingModel.annotations).texts('!'));
482
482
  stepTimer.contribute([parseCompilerFlagsTimer.stop()]);
483
483
  this.importedAnnotations = true;
484
484
  }
@@ -1,5 +1,5 @@
1
1
  import type { CommonTokenStream } from 'antlr4ts';
2
2
  import type { MalloyTranslation } from '../parse-malloy';
3
- import type { Annotation } from '../../model/malloy_types';
3
+ import type { AnnotationsDef } from '../../model/malloy_types';
4
4
  import type { MalloyParseInfo } from '../malloy-parse-info';
5
- export declare function walkForModelAnnotation(forParse: MalloyTranslation, tokens: CommonTokenStream, parseInfo: MalloyParseInfo): Annotation;
5
+ export declare function walkForModelAnnotation(forParse: MalloyTranslation, tokens: CommonTokenStream, parseInfo: MalloyParseInfo): AnnotationsDef;