@malloydata/malloy 0.0.398 → 0.0.400

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 (103) 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 +80 -17
  8. package/dist/api/foundation/core.js +135 -43
  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/index.d.ts +1 -0
  30. package/dist/lang/ast/index.js +1 -0
  31. package/dist/lang/ast/query-elements/anonymous-query.d.ts +2 -2
  32. package/dist/lang/ast/query-elements/anonymous-query.js +3 -3
  33. package/dist/lang/ast/query-elements/query-arrow.js +2 -2
  34. package/dist/lang/ast/query-items/field-declaration.d.ts +2 -2
  35. package/dist/lang/ast/query-items/field-declaration.js +1 -1
  36. package/dist/lang/ast/query-items/field-references.d.ts +3 -3
  37. package/dist/lang/ast/query-properties/nest.js +2 -2
  38. package/dist/lang/ast/source-elements/composite-source.d.ts +2 -2
  39. package/dist/lang/ast/source-elements/refined-source.d.ts +2 -2
  40. package/dist/lang/ast/source-elements/sql-source.js +1 -1
  41. package/dist/lang/ast/source-elements/typed-source.js +7 -4
  42. package/dist/lang/ast/source-properties/join.d.ts +2 -2
  43. package/dist/lang/ast/source-properties/join.js +2 -2
  44. package/dist/lang/ast/source-properties/renames.d.ts +2 -2
  45. package/dist/lang/ast/source-properties/user-type-shape.d.ts +2 -2
  46. package/dist/lang/ast/source-properties/user-type-shape.js +7 -7
  47. package/dist/lang/ast/source-properties/view-field-declaration.d.ts +1 -1
  48. package/dist/lang/ast/source-properties/view-field-declaration.js +2 -2
  49. package/dist/lang/ast/source-query-elements/include-item.d.ts +3 -3
  50. package/dist/lang/ast/statements/define-given.d.ts +2 -2
  51. package/dist/lang/ast/statements/define-given.js +2 -2
  52. package/dist/lang/ast/statements/define-query.d.ts +2 -2
  53. package/dist/lang/ast/statements/define-query.js +2 -2
  54. package/dist/lang/ast/statements/define-source.d.ts +2 -2
  55. package/dist/lang/ast/statements/define-source.js +2 -2
  56. package/dist/lang/ast/statements/define-user-type.d.ts +2 -2
  57. package/dist/lang/ast/statements/define-user-type.js +1 -1
  58. package/dist/lang/ast/statements/export-statement.d.ts +12 -0
  59. package/dist/lang/ast/statements/export-statement.js +53 -0
  60. package/dist/lang/ast/statements/import-statement.js +1 -1
  61. package/dist/lang/ast/types/annotation-elements.js +3 -3
  62. package/dist/lang/ast/types/definition-list.d.ts +3 -3
  63. package/dist/lang/ast/types/literal.d.ts +1 -1
  64. package/dist/lang/ast/types/malloy-element.d.ts +5 -4
  65. package/dist/lang/ast/types/malloy-element.js +20 -17
  66. package/dist/lang/ast/types/noteable.d.ts +5 -5
  67. package/dist/lang/ast/types/pipeline-comp.d.ts +2 -2
  68. package/dist/lang/ast/view-elements/reference-view.js +1 -1
  69. package/dist/lang/ast/view-elements/view-refine.js +1 -1
  70. package/dist/lang/composite-source-utils.d.ts +2 -2
  71. package/dist/lang/composite-source-utils.js +6 -6
  72. package/dist/lang/lib/Malloy/MalloyLexer.d.ts +124 -123
  73. package/dist/lang/lib/Malloy/MalloyLexer.js +1418 -1411
  74. package/dist/lang/lib/Malloy/MalloyParser.d.ts +302 -274
  75. package/dist/lang/lib/Malloy/MalloyParser.js +2748 -2557
  76. package/dist/lang/lib/Malloy/MalloyParserListener.d.ts +22 -0
  77. package/dist/lang/lib/Malloy/MalloyParserVisitor.d.ts +14 -0
  78. package/dist/lang/malloy-to-ast.d.ts +4 -3
  79. package/dist/lang/malloy-to-ast.js +12 -5
  80. package/dist/lang/malloy-to-stable-query.d.ts +2 -2
  81. package/dist/lang/parse-log.d.ts +3 -0
  82. package/dist/lang/parse-malloy.js +6 -6
  83. package/dist/lang/parse-tree-walkers/model-annotation-walker.d.ts +2 -2
  84. package/dist/lang/parse-tree-walkers/model-annotation-walker.js +2 -2
  85. package/dist/lang/prettify/index.js +1 -1
  86. package/dist/lang/prettify/leaf.js +2 -2
  87. package/dist/lang/translate-response.d.ts +2 -2
  88. package/dist/model/filter_compilers.js +1 -1
  89. package/dist/model/malloy_types.d.ts +28 -24
  90. package/dist/model/persist_utils.js +3 -3
  91. package/dist/model/query_model_impl.js +1 -1
  92. package/dist/model/query_node.js +8 -8
  93. package/dist/model/query_query.js +13 -13
  94. package/dist/model/source_def_utils.js +4 -4
  95. package/dist/run_sql_options.d.ts +6 -4
  96. package/dist/to_stable.d.ts +2 -2
  97. package/dist/to_stable.js +7 -7
  98. package/dist/version.d.ts +1 -1
  99. package/dist/version.js +1 -1
  100. package/package.json +4 -4
  101. package/dist/annotation.d.ts +0 -96
  102. /package/dist/{taggable.js → api/foundation/taggable.js} +0 -0
  103. /package/dist/{prefix.d.ts → lang/annotation-prefix.d.ts} +0 -0
@@ -1,11 +1,11 @@
1
- import type { Annotation, DocumentLocation, FieldDef } from '../../../model/malloy_types';
1
+ import type { AnnotationsDef, DocumentLocation, FieldDef } from '../../../model/malloy_types';
2
2
  import { SpaceField } from '../types/space-field';
3
3
  export declare class RenameSpaceField extends SpaceField {
4
4
  private readonly otherField;
5
5
  private readonly newName;
6
6
  private readonly location;
7
7
  private note;
8
- constructor(otherField: SpaceField, newName: string, location: DocumentLocation, note: Annotation | undefined);
8
+ constructor(otherField: SpaceField, newName: string, location: DocumentLocation, note: AnnotationsDef | undefined);
9
9
  fieldDef(): FieldDef | undefined;
10
10
  typeDesc(): import("../../..").TypeDesc;
11
11
  }
@@ -39,14 +39,14 @@ class RenameSpaceField extends space_field_1.SpaceField {
39
39
  return undefined;
40
40
  }
41
41
  if (this.note) {
42
- if (returnFieldDef.annotation) {
43
- returnFieldDef.annotation = {
42
+ if (returnFieldDef.annotations) {
43
+ returnFieldDef.annotations = {
44
44
  ...this.note,
45
- inherits: returnFieldDef.annotation,
45
+ inherits: returnFieldDef.annotations,
46
46
  };
47
47
  }
48
48
  else {
49
- returnFieldDef.annotation = this.note;
49
+ returnFieldDef.annotations = this.note;
50
50
  }
51
51
  }
52
52
  return {
@@ -143,7 +143,7 @@ class StaticSpace {
143
143
  : 'fieldReference',
144
144
  definition: {
145
145
  type: definition.type,
146
- annotation: definition.annotation,
146
+ annotations: definition.annotations,
147
147
  location: definition.location,
148
148
  },
149
149
  location: head.location,
@@ -67,6 +67,7 @@ export * from './expressions/range';
67
67
  export * from './expressions/time-frame';
68
68
  export * from './expressions/unary';
69
69
  export * from './statements/import-statement';
70
+ export * from './statements/export-statement';
70
71
  export * from './query-properties/extend';
71
72
  export * from './parameters/argument';
72
73
  export * from './parameters/has-parameter';
@@ -105,6 +105,7 @@ __exportStar(require("./expressions/range"), exports);
105
105
  __exportStar(require("./expressions/time-frame"), exports);
106
106
  __exportStar(require("./expressions/unary"), exports);
107
107
  __exportStar(require("./statements/import-statement"), exports);
108
+ __exportStar(require("./statements/export-statement"), exports);
108
109
  __exportStar(require("./query-properties/extend"), exports);
109
110
  __exportStar(require("./parameters/argument"), exports);
110
111
  __exportStar(require("./parameters/has-parameter"), exports);
@@ -1,4 +1,4 @@
1
- import type { Annotation } from '../../../model';
1
+ import type { AnnotationsDef } from '../../../model';
2
2
  import type { DocStatement, Document } from '../types/malloy-element';
3
3
  import { MalloyElement } from '../types/malloy-element';
4
4
  import type { Noteable } from '../types/noteable';
@@ -10,6 +10,6 @@ export declare class AnonymousQuery extends MalloyElement implements DocStatemen
10
10
  constructor(queryExpr: SourceQueryElement);
11
11
  readonly isNoteableObj = true;
12
12
  extendNote: typeof extendNoteMethod;
13
- note?: Annotation;
13
+ note?: AnnotationsDef;
14
14
  execute(doc: Document): void;
15
15
  }
@@ -42,11 +42,11 @@ class AnonymousQuery extends malloy_element_1.MalloyElement {
42
42
  }
43
43
  const modelQuery = { ...queryObj.query() };
44
44
  const annotation = this.note || {};
45
- if (modelQuery.annotation) {
46
- annotation.inherits = modelQuery.annotation;
45
+ if (modelQuery.annotations) {
46
+ annotation.inherits = modelQuery.annotations;
47
47
  }
48
48
  if (annotation.notes || annotation.blockNotes || annotation.inherits) {
49
- modelQuery.annotation = annotation;
49
+ modelQuery.annotations = annotation;
50
50
  }
51
51
  doc.queryList.push(modelQuery);
52
52
  }
@@ -69,11 +69,11 @@ class QueryArrow extends query_base_1.QueryBase {
69
69
  inputStruct = lhsQuery.outputStruct;
70
70
  fieldSpace = new static_space_1.StaticSourceSpace(lhsQuery.outputStruct, 'public');
71
71
  }
72
- const { pipeline: rhsPipeline, annotation, outputStruct, name, } = this.view.pipelineComp(fieldSpace);
72
+ const { pipeline: rhsPipeline, annotations, outputStruct, name, } = this.view.pipelineComp(fieldSpace);
73
73
  const query = {
74
74
  ...queryBase,
75
75
  name,
76
- annotation,
76
+ annotations,
77
77
  pipeline: [...queryBase.pipeline, ...rhsPipeline],
78
78
  };
79
79
  const compositeResolvedSourceDef = (_a = query.compositeResolvedSourceDef) !== null && _a !== void 0 ? _a : this.resolveCompositeSource(inputStruct, rhsPipeline);
@@ -1,4 +1,4 @@
1
- import type { Annotation, TypeDesc, FieldDef, AtomicFieldDef } from '../../../model/malloy_types';
1
+ import type { AnnotationsDef, TypeDesc, FieldDef, AtomicFieldDef } from '../../../model/malloy_types';
2
2
  import type { ExprValue } from '../types/expr-value';
3
3
  import type { ExpressionDef } from '../types/expression-def';
4
4
  import type { FieldSpace } from '../types/field-space';
@@ -15,7 +15,7 @@ export declare abstract class AtomicFieldDeclaration extends MalloyElement imple
15
15
  readonly exprSrc?: string | undefined;
16
16
  readonly isNoteableObj = true;
17
17
  extendNote: typeof extendNoteMethod;
18
- note?: Annotation;
18
+ note?: AnnotationsDef;
19
19
  constructor(expr: ExpressionDef, defineName: string, exprSrc?: string | undefined);
20
20
  getName(): string;
21
21
  fieldDef(fs: FieldSpace, exprName: string): FieldDef;
@@ -157,7 +157,7 @@ class AtomicFieldDeclaration extends malloy_element_1.MalloyElement {
157
157
  ret.code = this.exprSrc;
158
158
  }
159
159
  if (this.note) {
160
- ret.annotation = this.note;
160
+ ret.annotations = this.note;
161
161
  }
162
162
  return ret;
163
163
  }
@@ -1,4 +1,4 @@
1
- import type { Annotation, FieldDef, RefToField, TypeDesc } from '../../../model/malloy_types';
1
+ import type { AnnotationsDef, FieldDef, RefToField, TypeDesc } from '../../../model/malloy_types';
2
2
  import type { DynamicSpace } from '../field-space/dynamic-space';
3
3
  import { DefinitionList } from '../types/definition-list';
4
4
  import type { FieldName, FieldSpace } from '../types/field-space';
@@ -10,7 +10,7 @@ import type { MakeEntry } from '../types/space-entry';
10
10
  export type FieldReferenceConstructor = new (names: FieldName[]) => FieldReference;
11
11
  export declare abstract class FieldReference extends ListOf<FieldName> implements Noteable, MakeEntry {
12
12
  readonly isNoteableObj = true;
13
- note?: Annotation;
13
+ note?: AnnotationsDef;
14
14
  extendNote: typeof extendNoteMethod;
15
15
  constructor(names: FieldName[]);
16
16
  makeEntry(fs: DynamicSpace): void;
@@ -97,7 +97,7 @@ export declare class ViewOrScalarFieldReference extends FieldReference {
97
97
  export declare class WildcardFieldReference extends MalloyElement implements Noteable {
98
98
  readonly joinPath: FieldReference | undefined;
99
99
  elementType: string;
100
- note?: Annotation;
100
+ note?: AnnotationsDef;
101
101
  readonly isNoteableObj = true;
102
102
  extendNote: typeof extendNoteMethod;
103
103
  except: Set<string>;
@@ -76,7 +76,7 @@ class NestFieldDeclaration extends view_field_declaration_1.ViewFieldDeclaration
76
76
  if (this.turtleDef)
77
77
  return this.turtleDef;
78
78
  if (fs.isQueryFieldSpace()) {
79
- const { pipeline, annotation } = this.view.pipelineComp(fs, fs.outputSpace());
79
+ const { pipeline, annotations } = this.view.pipelineComp(fs, fs.outputSpace());
80
80
  const refSummary = pipeline[0] && model.isQuerySegment(pipeline[0])
81
81
  ? pipeline[0].refSummary
82
82
  : undefined;
@@ -86,7 +86,7 @@ class NestFieldDeclaration extends view_field_declaration_1.ViewFieldDeclaration
86
86
  type: 'turtle',
87
87
  name: this.name,
88
88
  pipeline: pipelineWithDrillPaths,
89
- annotation: { ...this.note, inherits: annotation },
89
+ annotations: { ...this.note, inherits: annotations },
90
90
  location: this.location,
91
91
  refSummary,
92
92
  };
@@ -1,4 +1,4 @@
1
- import type { Annotation, SourceDef } from '../../../model/malloy_types';
1
+ import type { AnnotationsDef, SourceDef } from '../../../model/malloy_types';
2
2
  import type { HasParameter } from '../parameters/has-parameter';
3
3
  import { Source } from './source';
4
4
  import type { ParameterSpace } from '../field-space/parameter-space';
@@ -9,7 +9,7 @@ import type { ParameterSpace } from '../field-space/parameter-space';
9
9
  export declare class CompositeSource extends Source {
10
10
  readonly sources: Source[];
11
11
  elementType: string;
12
- currentAnnotation?: Annotation;
12
+ currentAnnotation?: AnnotationsDef;
13
13
  constructor(sources: Source[]);
14
14
  getSourceDef(parameterSpace: ParameterSpace | undefined): SourceDef;
15
15
  withParameters(parameterSpace: ParameterSpace | undefined, pList: HasParameter[] | undefined): SourceDef;
@@ -1,4 +1,4 @@
1
- import type { Annotation, SourceDef } from '../../../model/malloy_types';
1
+ import type { AnnotationsDef, SourceDef } from '../../../model/malloy_types';
2
2
  import type { HasParameter } from '../parameters/has-parameter';
3
3
  import type { SourceDesc } from '../types/source-desc';
4
4
  import { Source } from './source';
@@ -12,7 +12,7 @@ export declare class RefinedSource extends Source {
12
12
  readonly refinement: SourceDesc;
13
13
  readonly includeList: IncludeItem[] | undefined;
14
14
  elementType: string;
15
- currentAnnotation?: Annotation;
15
+ currentAnnotation?: AnnotationsDef;
16
16
  constructor(source: Source, refinement: SourceDesc, includeList: IncludeItem[] | undefined);
17
17
  getSourceDef(parameterSpace: ParameterSpace | undefined): SourceDef;
18
18
  withParameters(parameterSpace: ParameterSpace | undefined, pList: HasParameter[] | undefined): SourceDef;
@@ -149,7 +149,7 @@ class SQLSource extends source_1.Source {
149
149
  const fromDoc = this.document();
150
150
  const modelAnnotation = fromDoc === null || fromDoc === void 0 ? void 0 : fromDoc.currentModelAnnotation();
151
151
  if (modelAnnotation) {
152
- locStruct.modelAnnotation = modelAnnotation;
152
+ locStruct.modelAnnotations = modelAnnotation;
153
153
  }
154
154
  return locStruct;
155
155
  }
@@ -80,11 +80,14 @@ class TypedSource extends source_1.Source {
80
80
  ? { ...f, accessModifier: exports.USER_TYPE_HIDDEN_ACCESS }
81
81
  : f;
82
82
  }
83
- const shapeAnnotation = shapeEntry.field.annotation;
83
+ const shapeAnnotation = shapeEntry.field.annotations;
84
84
  if (!shapeAnnotation) {
85
85
  return f;
86
86
  }
87
- return { ...f, annotation: mergeAnnotation(f.annotation, shapeAnnotation) };
87
+ return {
88
+ ...f,
89
+ annotations: mergeAnnotation(f.annotations, shapeAnnotation),
90
+ };
88
91
  });
89
92
  return {
90
93
  ...sourceDef,
@@ -105,8 +108,8 @@ class TypedSource extends source_1.Source {
105
108
  }
106
109
  for (const sf of entry.entry.fields) {
107
110
  const field = (0, malloy_types_1.mkFieldDef)(sf.typeDef, sf.name);
108
- if (sf.annotation) {
109
- field.annotation = sf.annotation;
111
+ if (sf.annotations) {
112
+ field.annotations = sf.annotations;
110
113
  }
111
114
  next.set(sf.name, { field, fromShape: ref });
112
115
  }
@@ -1,4 +1,4 @@
1
- import type { Annotation, JoinFieldDef, JoinType, MatrixOperation, SourceDef, AccessModifierLabel } from '../../../model/malloy_types';
1
+ import type { AnnotationsDef, JoinFieldDef, JoinType, MatrixOperation, SourceDef, AccessModifierLabel } from '../../../model/malloy_types';
2
2
  import type { DynamicSpace } from '../field-space/dynamic-space';
3
3
  import { DefinitionList } from '../types/definition-list';
4
4
  import type { QueryBuilder } from '../types/query-builder';
@@ -20,7 +20,7 @@ export declare abstract class Join extends MalloyElement implements Noteable, Ma
20
20
  readonly isNoteableObj = true;
21
21
  extendNote: typeof extendNoteMethod;
22
22
  abstract sourceExpr: SourceQueryElement;
23
- note?: Annotation;
23
+ note?: AnnotationsDef;
24
24
  makeEntry(fs: DynamicSpace): void;
25
25
  getName(): string;
26
26
  protected getStructDefFromExpr(parameterSpace: ParameterSpace): SourceDef;
@@ -77,7 +77,7 @@ class KeyJoin extends Join {
77
77
  };
78
78
  delete joinStruct.as;
79
79
  if (this.note) {
80
- joinStruct.annotation = this.note;
80
+ joinStruct.annotations = this.note;
81
81
  }
82
82
  (_a = this.document()) === null || _a === void 0 ? void 0 : _a.rememberToAddModelAnnotations(joinStruct);
83
83
  return joinStruct;
@@ -172,7 +172,7 @@ class ExpressionJoin extends Join {
172
172
  };
173
173
  delete joinStruct.as;
174
174
  if (this.note) {
175
- joinStruct.annotation = this.note;
175
+ joinStruct.annotations = this.note;
176
176
  }
177
177
  (_a = this.document()) === null || _a === void 0 ? void 0 : _a.rememberToAddModelAnnotations(joinStruct);
178
178
  return joinStruct;
@@ -1,4 +1,4 @@
1
- import type { AccessModifierLabel, Annotation } from '../../../model';
1
+ import type { AccessModifierLabel, AnnotationsDef } from '../../../model';
2
2
  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';
@@ -9,7 +9,7 @@ export declare class RenameField extends MalloyElement implements Noteable, Make
9
9
  readonly newName: string;
10
10
  readonly oldName: FieldName;
11
11
  elementType: string;
12
- note?: Annotation;
12
+ note?: AnnotationsDef;
13
13
  extendNote: typeof extendNoteMethod;
14
14
  readonly isNoteableObj = true;
15
15
  constructor(newName: string, oldName: FieldName);
@@ -1,4 +1,4 @@
1
- import type { Annotation, AtomicTypeDef, UserTypeFieldDef } from '../../../model/malloy_types';
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
4
  import { extendNoteMethod } from '../types/noteable';
@@ -6,7 +6,7 @@ export declare abstract class UserTypeMember extends MalloyElement implements No
6
6
  readonly name: string;
7
7
  readonly isNoteableObj = true;
8
8
  extendNote: typeof extendNoteMethod;
9
- note?: Annotation;
9
+ note?: AnnotationsDef;
10
10
  constructor(name: string);
11
11
  abstract userTypeFieldDef(): UserTypeFieldDef;
12
12
  }
@@ -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
  }
@@ -0,0 +1,12 @@
1
+ import type { DocStatement, Document } from '../types/malloy-element';
2
+ import { ListOf, MalloyElement } from '../types/malloy-element';
3
+ export declare class ExportItem extends MalloyElement {
4
+ readonly name: string;
5
+ elementType: string;
6
+ constructor(name: string);
7
+ }
8
+ export declare class ExportStatement extends ListOf<ExportItem> implements DocStatement {
9
+ elementType: string;
10
+ constructor(items: ExportItem[]);
11
+ execute(doc: Document): void;
12
+ }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright Contributors to the Malloy project
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.ExportStatement = exports.ExportItem = void 0;
8
+ const malloy_types_1 = require("../../../model/malloy_types");
9
+ const malloy_element_1 = require("../types/malloy-element");
10
+ class ExportItem extends malloy_element_1.MalloyElement {
11
+ constructor(name) {
12
+ super();
13
+ this.name = name;
14
+ this.elementType = 'exportItem';
15
+ }
16
+ }
17
+ exports.ExportItem = ExportItem;
18
+ class ExportStatement extends malloy_element_1.ListOf {
19
+ constructor(items) {
20
+ super(items);
21
+ this.elementType = 'export statement';
22
+ }
23
+ execute(doc) {
24
+ if (doc.explicitExports === undefined) {
25
+ doc.explicitExports = new Set();
26
+ }
27
+ const explicit = doc.explicitExports;
28
+ for (const item of this.list) {
29
+ const name = item.name;
30
+ if (explicit.has(name)) {
31
+ item.logError('duplicate-export-name', `'${name}' already appears in an export statement`);
32
+ continue;
33
+ }
34
+ const entry = doc.documentModel.get(name);
35
+ if (entry === undefined) {
36
+ item.logError('export-name-not-defined', `Cannot export '${name}': no such definition above this statement`);
37
+ continue;
38
+ }
39
+ const def = entry.entry;
40
+ const exportable = (0, malloy_types_1.isSourceDef)(def) ||
41
+ def.type === 'query' ||
42
+ def.type === 'userType' ||
43
+ def.type === 'given';
44
+ if (!exportable) {
45
+ item.logError('export-name-not-exportable', `Cannot export '${name}': only sources, queries, given declarations, and user types may be exported`);
46
+ continue;
47
+ }
48
+ explicit.add(name);
49
+ }
50
+ }
51
+ }
52
+ exports.ExportStatement = ExportStatement;
53
+ //# sourceMappingURL=export-statement.js.map
@@ -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
  }