@malloydata/malloy 0.0.399 → 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.
- package/dist/api/annotation-utils.d.ts +36 -0
- package/dist/api/annotation-utils.js +76 -0
- package/dist/api/core.js +3 -3
- package/dist/api/foundation/annotation.d.ts +115 -0
- package/dist/{annotation.js → api/foundation/annotation.js} +87 -42
- package/dist/api/foundation/compile.js +3 -3
- package/dist/api/foundation/core.d.ts +80 -17
- package/dist/api/foundation/core.js +135 -43
- package/dist/api/foundation/index.d.ts +1 -1
- package/dist/api/foundation/index.js +3 -2
- package/dist/api/foundation/runtime.js +2 -2
- package/dist/{taggable.d.ts → api/foundation/taggable.d.ts} +4 -4
- package/dist/api/foundation/types.d.ts +1 -1
- package/dist/connection/types.d.ts +3 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +17 -4
- package/dist/{prefix.js → lang/annotation-prefix.js} +1 -1
- package/dist/lang/ast/expressions/expr-given.js +1 -1
- package/dist/lang/ast/field-space/dynamic-space.d.ts +1 -1
- package/dist/lang/ast/field-space/dynamic-space.js +2 -2
- package/dist/lang/ast/field-space/include-utils.d.ts +3 -3
- package/dist/lang/ast/field-space/query-spaces.js +2 -2
- package/dist/lang/ast/field-space/reference-field.js +5 -5
- package/dist/lang/ast/field-space/refined-space.d.ts +2 -2
- package/dist/lang/ast/field-space/refined-space.js +3 -3
- package/dist/lang/ast/field-space/rename-space-field.d.ts +2 -2
- package/dist/lang/ast/field-space/rename-space-field.js +4 -4
- package/dist/lang/ast/field-space/static-space.js +1 -1
- package/dist/lang/ast/query-elements/anonymous-query.d.ts +2 -2
- package/dist/lang/ast/query-elements/anonymous-query.js +3 -3
- package/dist/lang/ast/query-elements/query-arrow.js +2 -2
- package/dist/lang/ast/query-items/field-declaration.d.ts +2 -2
- package/dist/lang/ast/query-items/field-declaration.js +1 -1
- package/dist/lang/ast/query-items/field-references.d.ts +3 -3
- package/dist/lang/ast/query-properties/nest.js +2 -2
- package/dist/lang/ast/source-elements/composite-source.d.ts +2 -2
- package/dist/lang/ast/source-elements/refined-source.d.ts +2 -2
- package/dist/lang/ast/source-elements/sql-source.js +1 -1
- package/dist/lang/ast/source-elements/typed-source.js +7 -4
- package/dist/lang/ast/source-properties/join.d.ts +2 -2
- package/dist/lang/ast/source-properties/join.js +2 -2
- package/dist/lang/ast/source-properties/renames.d.ts +2 -2
- package/dist/lang/ast/source-properties/user-type-shape.d.ts +2 -2
- package/dist/lang/ast/source-properties/user-type-shape.js +7 -7
- package/dist/lang/ast/source-properties/view-field-declaration.d.ts +1 -1
- package/dist/lang/ast/source-properties/view-field-declaration.js +2 -2
- package/dist/lang/ast/source-query-elements/include-item.d.ts +3 -3
- package/dist/lang/ast/statements/define-given.d.ts +2 -2
- package/dist/lang/ast/statements/define-given.js +2 -2
- package/dist/lang/ast/statements/define-query.d.ts +2 -2
- package/dist/lang/ast/statements/define-query.js +2 -2
- package/dist/lang/ast/statements/define-source.d.ts +2 -2
- package/dist/lang/ast/statements/define-source.js +2 -2
- package/dist/lang/ast/statements/define-user-type.d.ts +2 -2
- package/dist/lang/ast/statements/define-user-type.js +1 -1
- package/dist/lang/ast/statements/import-statement.js +1 -1
- package/dist/lang/ast/types/annotation-elements.js +3 -3
- package/dist/lang/ast/types/definition-list.d.ts +3 -3
- package/dist/lang/ast/types/literal.d.ts +1 -1
- package/dist/lang/ast/types/malloy-element.d.ts +4 -4
- package/dist/lang/ast/types/malloy-element.js +15 -15
- package/dist/lang/ast/types/noteable.d.ts +5 -5
- package/dist/lang/ast/types/pipeline-comp.d.ts +2 -2
- package/dist/lang/ast/view-elements/reference-view.js +1 -1
- package/dist/lang/ast/view-elements/view-refine.js +1 -1
- package/dist/lang/composite-source-utils.d.ts +2 -2
- package/dist/lang/composite-source-utils.js +6 -6
- package/dist/lang/malloy-to-ast.d.ts +3 -3
- package/dist/lang/malloy-to-ast.js +5 -5
- package/dist/lang/malloy-to-stable-query.d.ts +2 -2
- package/dist/lang/parse-malloy.js +6 -6
- package/dist/lang/parse-tree-walkers/model-annotation-walker.d.ts +2 -2
- package/dist/lang/parse-tree-walkers/model-annotation-walker.js +2 -2
- package/dist/lang/prettify/index.js +1 -1
- package/dist/lang/prettify/leaf.js +2 -2
- package/dist/lang/translate-response.d.ts +2 -2
- package/dist/model/malloy_types.d.ts +28 -24
- package/dist/model/persist_utils.js +3 -3
- package/dist/model/query_model_impl.js +1 -1
- package/dist/model/query_node.js +8 -8
- package/dist/model/query_query.js +13 -13
- package/dist/model/source_def_utils.js +4 -4
- package/dist/run_sql_options.d.ts +6 -4
- package/dist/to_stable.d.ts +2 -2
- package/dist/to_stable.js +7 -7
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
- package/dist/annotation.d.ts +0 -96
- /package/dist/{taggable.js → api/foundation/taggable.js} +0 -0
- /package/dist/{prefix.d.ts → lang/annotation-prefix.d.ts} +0 -0
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.PreparedResult = exports.PreparedQuery = exports.Given = exports.PersistSource = exports.Model = exports.ExploreField = exports.QueryField = exports.Query = exports.StringField = exports.UnsupportedField = exports.JSONField = exports.BooleanField = exports.NumberField = exports.TimestampField = exports.DateField = exports.AtomicField = exports.Explore = exports.JoinRelationship = exports.TimestampTimeframe = exports.DateTimeframe = exports.AtomicFieldType = exports.SourceRelationship = void 0;
|
|
7
|
+
exports.PreparedResult = exports.PreparedQuery = exports.Given = exports.PersistSource = exports.Model = exports.Reference = exports.ExploreField = exports.QueryField = exports.Query = exports.StringField = exports.UnsupportedField = exports.JSONField = exports.BooleanField = exports.NumberField = exports.TimestampField = exports.DateField = exports.AtomicField = exports.Explore = exports.JoinRelationship = exports.TimestampTimeframe = exports.DateTimeframe = exports.AtomicFieldType = exports.SourceRelationship = void 0;
|
|
8
8
|
const model_1 = require("../../model");
|
|
9
9
|
const utils_1 = require("../../model/utils");
|
|
10
10
|
const dialect_1 = require("../../dialect");
|
|
@@ -12,7 +12,7 @@ const persist_utils_1 = require("../../model/persist_utils");
|
|
|
12
12
|
const source_def_utils_1 = require("../../model/source_def_utils");
|
|
13
13
|
const given_binding_1 = require("../../model/given_binding");
|
|
14
14
|
const malloy_tag_1 = require("@malloydata/malloy-tag");
|
|
15
|
-
const annotation_1 = require("
|
|
15
|
+
const annotation_1 = require("./annotation");
|
|
16
16
|
const to_stable_1 = require("../../to_stable");
|
|
17
17
|
const util_1 = require("../util");
|
|
18
18
|
const utils_2 = require("../../lang/utils");
|
|
@@ -148,17 +148,19 @@ class Explore extends Entity {
|
|
|
148
148
|
isExploreField() {
|
|
149
149
|
return false;
|
|
150
150
|
}
|
|
151
|
+
/** @deprecated Use `.annotations.parseAsTag(route)`. */
|
|
151
152
|
tagParse(spec) {
|
|
152
|
-
return (0, annotation_1.annotationToTag)(this._structDef.
|
|
153
|
+
return (0, annotation_1.annotationToTag)(this._structDef.annotations, spec);
|
|
153
154
|
}
|
|
155
|
+
/** @deprecated Use `.annotations.texts(route)`. */
|
|
154
156
|
getTaglines(prefix) {
|
|
155
|
-
return (0, annotation_1.annotationToTaglines)(this._structDef.
|
|
157
|
+
return (0, annotation_1.annotationToTaglines)(this._structDef.annotations, prefix);
|
|
156
158
|
}
|
|
157
159
|
get annotations() {
|
|
158
|
-
return new annotation_1.Annotations(this._structDef.
|
|
160
|
+
return new annotation_1.Annotations(this._structDef.annotations);
|
|
159
161
|
}
|
|
160
162
|
get modelTag() {
|
|
161
|
-
this.parsedModelTag || (this.parsedModelTag = new annotation_1.Annotations(this._structDef.
|
|
163
|
+
this.parsedModelTag || (this.parsedModelTag = new annotation_1.Annotations(this._structDef.modelAnnotations).parseAsTag().tag);
|
|
162
164
|
return this.parsedModelTag;
|
|
163
165
|
}
|
|
164
166
|
/**
|
|
@@ -462,14 +464,16 @@ class AtomicField extends Entity {
|
|
|
462
464
|
}
|
|
463
465
|
}
|
|
464
466
|
}
|
|
467
|
+
/** @deprecated Use `.annotations.parseAsTag(route)`. */
|
|
465
468
|
tagParse(spec) {
|
|
466
|
-
return (0, annotation_1.annotationToTag)(this.fieldTypeDef.
|
|
469
|
+
return (0, annotation_1.annotationToTag)(this.fieldTypeDef.annotations, spec);
|
|
467
470
|
}
|
|
471
|
+
/** @deprecated Use `.annotations.texts(route)`. */
|
|
468
472
|
getTaglines(prefix) {
|
|
469
|
-
return (0, annotation_1.annotationToTaglines)(this.fieldTypeDef.
|
|
473
|
+
return (0, annotation_1.annotationToTaglines)(this.fieldTypeDef.annotations, prefix);
|
|
470
474
|
}
|
|
471
475
|
get annotations() {
|
|
472
|
-
return new annotation_1.Annotations(this.fieldTypeDef.
|
|
476
|
+
return new annotation_1.Annotations(this.fieldTypeDef.annotations);
|
|
473
477
|
}
|
|
474
478
|
isIntrinsic() {
|
|
475
479
|
return (0, model_1.fieldIsIntrinsic)(this.fieldTypeDef);
|
|
@@ -666,14 +670,16 @@ class QueryField extends Query {
|
|
|
666
670
|
super(turtleDef, parent, source);
|
|
667
671
|
this.parent = parent;
|
|
668
672
|
}
|
|
673
|
+
/** @deprecated Use `.annotations.parseAsTag(route)`. */
|
|
669
674
|
tagParse(spec) {
|
|
670
|
-
return (0, annotation_1.annotationToTag)(this.turtleDef.
|
|
675
|
+
return (0, annotation_1.annotationToTag)(this.turtleDef.annotations, spec);
|
|
671
676
|
}
|
|
677
|
+
/** @deprecated Use `.annotations.texts(route)`. */
|
|
672
678
|
getTaglines(prefix) {
|
|
673
|
-
return (0, annotation_1.annotationToTaglines)(this.turtleDef.
|
|
679
|
+
return (0, annotation_1.annotationToTaglines)(this.turtleDef.annotations, prefix);
|
|
674
680
|
}
|
|
675
681
|
get annotations() {
|
|
676
|
-
return new annotation_1.Annotations(this.turtleDef.
|
|
682
|
+
return new annotation_1.Annotations(this.turtleDef.annotations);
|
|
677
683
|
}
|
|
678
684
|
isQueryField() {
|
|
679
685
|
return true;
|
|
@@ -726,10 +732,10 @@ class ExploreField extends Explore {
|
|
|
726
732
|
return this.joinRelationship !== JoinRelationship.OneToOne;
|
|
727
733
|
}
|
|
728
734
|
tagParse(spec) {
|
|
729
|
-
return (0, annotation_1.annotationToTag)(this._structDef.
|
|
735
|
+
return (0, annotation_1.annotationToTag)(this._structDef.annotations, spec);
|
|
730
736
|
}
|
|
731
737
|
get annotations() {
|
|
732
|
-
return new annotation_1.Annotations(this._structDef.
|
|
738
|
+
return new annotation_1.Annotations(this._structDef.annotations);
|
|
733
739
|
}
|
|
734
740
|
isQueryField() {
|
|
735
741
|
return false;
|
|
@@ -755,6 +761,66 @@ class ExploreField extends Explore {
|
|
|
755
761
|
}
|
|
756
762
|
}
|
|
757
763
|
exports.ExploreField = ExploreField;
|
|
764
|
+
const REFERENCE_KIND_BY_IR_TYPE = {
|
|
765
|
+
fieldReference: 'field',
|
|
766
|
+
joinReference: 'join',
|
|
767
|
+
exploreReference: 'explore',
|
|
768
|
+
queryReference: 'query',
|
|
769
|
+
sqlBlockReference: 'sqlBlock',
|
|
770
|
+
givenReference: 'given',
|
|
771
|
+
};
|
|
772
|
+
/**
|
|
773
|
+
* A reference to a definition found at a position in a Malloy document —
|
|
774
|
+
* the Foundation view returned by {@link Model.referenceAt}. Carries the
|
|
775
|
+
* use-site location (where the reference appears), the definition's
|
|
776
|
+
* location (where to go for "go to definition"), the kind of entity
|
|
777
|
+
* referenced, and an `annotations` view over the definition's annotations.
|
|
778
|
+
*
|
|
779
|
+
* Construct via {@link Model.referenceAt}; direct construction is internal.
|
|
780
|
+
*/
|
|
781
|
+
class Reference {
|
|
782
|
+
/** @internal */
|
|
783
|
+
constructor(_ref) {
|
|
784
|
+
this._ref = _ref;
|
|
785
|
+
}
|
|
786
|
+
/** The name as written at the use site (e.g. `"orders"`). */
|
|
787
|
+
get text() {
|
|
788
|
+
return this._ref.text;
|
|
789
|
+
}
|
|
790
|
+
/** What kind of entity this reference points at. */
|
|
791
|
+
get kind() {
|
|
792
|
+
return REFERENCE_KIND_BY_IR_TYPE[this._ref.type];
|
|
793
|
+
}
|
|
794
|
+
/** Where this reference appears in source. */
|
|
795
|
+
get location() {
|
|
796
|
+
return this._ref.location;
|
|
797
|
+
}
|
|
798
|
+
/** Where the definition is. Omitted for synthetic references that have
|
|
799
|
+
* no source-level definition site. */
|
|
800
|
+
get definitionLocation() {
|
|
801
|
+
return this._ref.definition.location;
|
|
802
|
+
}
|
|
803
|
+
/** The referent's type as a string (e.g. `"string"` for a string field,
|
|
804
|
+
* `"source"` for a source). Free-form text from the IR; used by IDE
|
|
805
|
+
* display to render type hints. */
|
|
806
|
+
get definitionType() {
|
|
807
|
+
return this._ref.definition.type;
|
|
808
|
+
}
|
|
809
|
+
/** For given references only: the textual form of the given's default
|
|
810
|
+
* expression, if one was declared. Undefined for non-given references
|
|
811
|
+
* and for givens without a default. */
|
|
812
|
+
get defaultText() {
|
|
813
|
+
if (this._ref.type === 'givenReference') {
|
|
814
|
+
return this._ref.definition.defaultText;
|
|
815
|
+
}
|
|
816
|
+
return undefined;
|
|
817
|
+
}
|
|
818
|
+
/** The definition's annotations, as a view. */
|
|
819
|
+
get annotations() {
|
|
820
|
+
return new annotation_1.Annotations(this._ref.definition.annotations);
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
exports.Reference = Reference;
|
|
758
824
|
class Model {
|
|
759
825
|
constructor(modelDef, problems, fromSources, existingQueryModel,
|
|
760
826
|
/**
|
|
@@ -813,21 +879,32 @@ class Model {
|
|
|
813
879
|
}
|
|
814
880
|
return out;
|
|
815
881
|
}
|
|
882
|
+
/** @deprecated Use `.annotations.parseAsTag(route)`. */
|
|
816
883
|
tagParse(spec) {
|
|
817
|
-
return (0, annotation_1.annotationToTag)(this.modelDef.
|
|
884
|
+
return (0, annotation_1.annotationToTag)(this.modelDef.annotations, spec);
|
|
818
885
|
}
|
|
886
|
+
/** @deprecated Use `.annotations.texts(route)`. */
|
|
819
887
|
getTaglines(prefix) {
|
|
820
|
-
return (0, annotation_1.annotationToTaglines)(this.modelDef.
|
|
888
|
+
return (0, annotation_1.annotationToTaglines)(this.modelDef.annotations, prefix);
|
|
821
889
|
}
|
|
822
890
|
get annotations() {
|
|
823
|
-
return new annotation_1.Annotations(this.modelDef.
|
|
891
|
+
return new annotation_1.Annotations(this.modelDef.annotations);
|
|
824
892
|
}
|
|
825
893
|
/**
|
|
826
|
-
* Retrieve a
|
|
827
|
-
*
|
|
894
|
+
* Retrieve a reference for the token at the given position within the
|
|
895
|
+
* document that produced this model.
|
|
828
896
|
*
|
|
829
897
|
* @param position A position within the document.
|
|
830
|
-
* @return A
|
|
898
|
+
* @return A {@link Reference} at that position if one exists.
|
|
899
|
+
*/
|
|
900
|
+
referenceAt(position) {
|
|
901
|
+
const ref = this.references.find(position);
|
|
902
|
+
return ref ? new Reference(ref) : undefined;
|
|
903
|
+
}
|
|
904
|
+
/**
|
|
905
|
+
* @deprecated Use {@link referenceAt} — returns a Foundation
|
|
906
|
+
* {@link Reference} view instead of the raw IR. This method returns
|
|
907
|
+
* the IR shape directly and will be removed in a future release.
|
|
831
908
|
*/
|
|
832
909
|
getReference(position) {
|
|
833
910
|
return this.references.find(position);
|
|
@@ -1055,20 +1132,18 @@ class PersistSource {
|
|
|
1055
1132
|
return this.explore;
|
|
1056
1133
|
}
|
|
1057
1134
|
/**
|
|
1058
|
-
*
|
|
1135
|
+
* @deprecated Hands out raw IR (`AnnotationsDef`). Use `.annotations`
|
|
1136
|
+
* (returns the {@link Annotations} view). Slated for removal once
|
|
1137
|
+
* external consumers migrate.
|
|
1059
1138
|
*/
|
|
1060
1139
|
get annotation() {
|
|
1061
|
-
return this.persistableDef.
|
|
1140
|
+
return this.persistableDef.annotations;
|
|
1062
1141
|
}
|
|
1063
|
-
/**
|
|
1064
|
-
* Parse the source's tags.
|
|
1065
|
-
*/
|
|
1142
|
+
/** @deprecated Use `.annotations.parseAsTag(route)`. */
|
|
1066
1143
|
tagParse(spec) {
|
|
1067
1144
|
return this.explore.tagParse(spec);
|
|
1068
1145
|
}
|
|
1069
|
-
/**
|
|
1070
|
-
* Get annotation taglines matching an optional prefix.
|
|
1071
|
-
*/
|
|
1146
|
+
/** @deprecated Use `.annotations.texts(route)`. */
|
|
1072
1147
|
getTaglines(prefix) {
|
|
1073
1148
|
return this.explore.getTaglines(prefix);
|
|
1074
1149
|
}
|
|
@@ -1171,14 +1246,16 @@ class Given {
|
|
|
1171
1246
|
get location() {
|
|
1172
1247
|
return this._internal.location;
|
|
1173
1248
|
}
|
|
1249
|
+
/** @deprecated Use `.annotations.parseAsTag(route)`. */
|
|
1174
1250
|
tagParse(spec) {
|
|
1175
|
-
return (0, annotation_1.annotationToTag)(this._internal.
|
|
1251
|
+
return (0, annotation_1.annotationToTag)(this._internal.annotations, spec);
|
|
1176
1252
|
}
|
|
1253
|
+
/** @deprecated Use `.annotations.texts(route)`. */
|
|
1177
1254
|
getTaglines(prefix) {
|
|
1178
|
-
return (0, annotation_1.annotationToTaglines)(this._internal.
|
|
1255
|
+
return (0, annotation_1.annotationToTaglines)(this._internal.annotations, prefix);
|
|
1179
1256
|
}
|
|
1180
1257
|
get annotations() {
|
|
1181
|
-
return new annotation_1.Annotations(this._internal.
|
|
1258
|
+
return new annotation_1.Annotations(this._internal.annotations);
|
|
1182
1259
|
}
|
|
1183
1260
|
}
|
|
1184
1261
|
exports.Given = Given;
|
|
@@ -1192,14 +1269,16 @@ class PreparedQuery {
|
|
|
1192
1269
|
get _modelDef() {
|
|
1193
1270
|
return this._model._modelDef;
|
|
1194
1271
|
}
|
|
1272
|
+
/** @deprecated Use `.annotations.parseAsTag(route)`. */
|
|
1195
1273
|
tagParse(spec) {
|
|
1196
|
-
return (0, annotation_1.annotationToTag)(this._query.
|
|
1274
|
+
return (0, annotation_1.annotationToTag)(this._query.annotations, spec);
|
|
1197
1275
|
}
|
|
1276
|
+
/** @deprecated Use `.annotations.texts(route)`. */
|
|
1198
1277
|
getTaglines(prefix) {
|
|
1199
|
-
return (0, annotation_1.annotationToTaglines)(this._query.
|
|
1278
|
+
return (0, annotation_1.annotationToTaglines)(this._query.annotations, prefix);
|
|
1200
1279
|
}
|
|
1201
1280
|
get annotations() {
|
|
1202
|
-
return new annotation_1.Annotations(this._query.
|
|
1281
|
+
return new annotation_1.Annotations(this._query.annotations);
|
|
1203
1282
|
}
|
|
1204
1283
|
/**
|
|
1205
1284
|
* Generate the SQL for this query.
|
|
@@ -1299,23 +1378,36 @@ class PreparedResult {
|
|
|
1299
1378
|
}
|
|
1300
1379
|
return new PreparedResult(query, modelDef);
|
|
1301
1380
|
}
|
|
1381
|
+
/** @deprecated Use `.annotations.parseAsTag(route)`. */
|
|
1302
1382
|
tagParse(spec) {
|
|
1303
|
-
return (0, annotation_1.annotationToTag)(this.inner.
|
|
1383
|
+
return (0, annotation_1.annotationToTag)(this.inner.annotations, spec);
|
|
1304
1384
|
}
|
|
1385
|
+
/** @deprecated Use `.annotations.texts(route)`. */
|
|
1305
1386
|
getTaglines(prefix) {
|
|
1306
|
-
return (0, annotation_1.annotationToTaglines)(this.inner.
|
|
1387
|
+
return (0, annotation_1.annotationToTaglines)(this.inner.annotations, prefix);
|
|
1307
1388
|
}
|
|
1308
1389
|
get annotations() {
|
|
1309
|
-
return new annotation_1.Annotations(this.inner.
|
|
1390
|
+
return new annotation_1.Annotations(this.inner.annotations);
|
|
1310
1391
|
}
|
|
1392
|
+
/**
|
|
1393
|
+
* @deprecated Hands out raw IR (`AnnotationsDef`). Use `.annotations`
|
|
1394
|
+
* (returns the {@link Annotations} view) for read access. Internal
|
|
1395
|
+
* code that needs the IR shape should read `._rawQuery.annotations`
|
|
1396
|
+
* directly. Slated for removal once external consumers migrate.
|
|
1397
|
+
*/
|
|
1311
1398
|
get annotation() {
|
|
1312
|
-
return this.inner.
|
|
1399
|
+
return this.inner.annotations;
|
|
1313
1400
|
}
|
|
1401
|
+
/**
|
|
1402
|
+
* @deprecated Hands out raw IR (`AnnotationsDef`). Internal code that
|
|
1403
|
+
* needs the model-level IR shape should read `._modelDef.annotations`
|
|
1404
|
+
* directly. Slated for removal once external consumers migrate.
|
|
1405
|
+
*/
|
|
1314
1406
|
get modelAnnotation() {
|
|
1315
|
-
return this.modelDef.
|
|
1407
|
+
return this.modelDef.annotations;
|
|
1316
1408
|
}
|
|
1317
1409
|
get modelTag() {
|
|
1318
|
-
return new annotation_1.Annotations(this.modelDef.
|
|
1410
|
+
return new annotation_1.Annotations(this.modelDef.annotations).parseAsTag().tag;
|
|
1319
1411
|
}
|
|
1320
1412
|
/**
|
|
1321
1413
|
* @return The name of the connection this query should be run against.
|
|
@@ -1346,7 +1438,7 @@ class PreparedResult {
|
|
|
1346
1438
|
const explore = this.inner.structs[this.inner.structs.length - 1];
|
|
1347
1439
|
const namedExplore = {
|
|
1348
1440
|
...explore,
|
|
1349
|
-
|
|
1441
|
+
annotations: this.inner.annotations,
|
|
1350
1442
|
name: this.inner.queryName || explore.name,
|
|
1351
1443
|
};
|
|
1352
1444
|
try {
|
|
@@ -1388,7 +1480,7 @@ class PreparedResult {
|
|
|
1388
1480
|
const structs = this.inner.structs;
|
|
1389
1481
|
const struct = structs[structs.length - 1];
|
|
1390
1482
|
const schema = { fields: (0, to_stable_1.convertFieldInfos)(struct, struct.fields) };
|
|
1391
|
-
const annotations = (0, to_stable_1.toStableAnnotations)(this.inner.
|
|
1483
|
+
const annotations = (0, to_stable_1.toStableAnnotations)(this.inner.annotations);
|
|
1392
1484
|
const metadataAnnot = struct.resultMetadata
|
|
1393
1485
|
? (0, to_stable_1.getResultStructMetadataAnnotation)(struct, struct.resultMetadata)
|
|
1394
1486
|
: undefined;
|
|
@@ -1417,7 +1509,7 @@ class PreparedResult {
|
|
|
1417
1509
|
.set(['query_name'], this.inner.queryName || struct.name)
|
|
1418
1510
|
.toString(),
|
|
1419
1511
|
});
|
|
1420
|
-
const modelAnnotations = (0, to_stable_1.toStableAnnotations)(this.modelDef.
|
|
1512
|
+
const modelAnnotations = (0, to_stable_1.toStableAnnotations)(this.modelDef.annotations);
|
|
1421
1513
|
return {
|
|
1422
1514
|
schema,
|
|
1423
1515
|
data,
|
|
@@ -4,7 +4,7 @@ export { EmptyURLReader, InMemoryURLReader, FixedConnectionMap, hashForInvalidat
|
|
|
4
4
|
export type { ModelCache, CachedModel } from './cache';
|
|
5
5
|
export { CacheManager, InMemoryModelCache } from './cache';
|
|
6
6
|
export { Parse, DocumentTablePath, DocumentRange, DocumentPosition, DocumentSymbol, DocumentCompletion, } from './document';
|
|
7
|
-
export { SourceRelationship, AtomicFieldType, DateTimeframe, TimestampTimeframe, JoinRelationship, type Field, type SerializedExplore, type SortableField, type PreparedResultJSON, type BuildPlan, Explore, ExploreField, AtomicField, DateField, TimestampField, NumberField, BooleanField, JSONField, UnsupportedField, StringField, Query, QueryField, Model, PersistSource, PreparedQuery, PreparedResult, } from './core';
|
|
7
|
+
export { SourceRelationship, AtomicFieldType, DateTimeframe, TimestampTimeframe, JoinRelationship, type Field, type SerializedExplore, type SortableField, type PreparedResultJSON, type BuildPlan, Explore, ExploreField, AtomicField, DateField, TimestampField, NumberField, BooleanField, JSONField, UnsupportedField, StringField, Query, QueryField, Model, PersistSource, PreparedQuery, PreparedResult, Reference, type ReferenceKind, } from './core';
|
|
8
8
|
export { type ResultJSON, type DataColumn, type DataArrayOrRecord, Result, DataArray, DataRecord, } from './result';
|
|
9
9
|
export { type WriteStream, DataWriter, JSONWriter, CSVWriter } from './writers';
|
|
10
10
|
export { Runtime, ConnectionRuntime, SingleConnectionRuntime, ModelMaterializer, QueryMaterializer, PreparedResultMaterializer, ExploreMaterializer, } from './runtime';
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
8
|
-
exports.MalloyError = exports.Malloy = exports.discoverConfig = exports.defaultConfigOverlays = exports.contextOverlay = exports.envOverlay = exports.MalloyConfig = exports.Manifest = void 0;
|
|
7
|
+
exports.PreparedResultMaterializer = exports.QueryMaterializer = exports.ModelMaterializer = exports.SingleConnectionRuntime = exports.ConnectionRuntime = exports.Runtime = exports.CSVWriter = exports.JSONWriter = exports.DataWriter = exports.DataRecord = exports.DataArray = exports.Result = exports.Reference = exports.PreparedResult = exports.PreparedQuery = exports.PersistSource = exports.Model = exports.QueryField = exports.Query = exports.StringField = exports.UnsupportedField = exports.JSONField = exports.BooleanField = exports.NumberField = exports.TimestampField = exports.DateField = exports.AtomicField = exports.ExploreField = exports.Explore = exports.JoinRelationship = exports.TimestampTimeframe = exports.DateTimeframe = exports.AtomicFieldType = exports.SourceRelationship = exports.DocumentCompletion = exports.DocumentSymbol = exports.DocumentPosition = exports.DocumentRange = exports.DocumentTablePath = exports.Parse = exports.InMemoryModelCache = exports.CacheManager = exports.getInvalidationKey = exports.readURL = exports.isInternalURL = exports.hashForInvalidationKey = exports.FixedConnectionMap = exports.InMemoryURLReader = exports.EmptyURLReader = exports.EMPTY_BUILD_MANIFEST = void 0;
|
|
8
|
+
exports.MalloyError = exports.Malloy = exports.discoverConfig = exports.defaultConfigOverlays = exports.contextOverlay = exports.envOverlay = exports.MalloyConfig = exports.Manifest = exports.ExploreMaterializer = void 0;
|
|
9
9
|
var types_1 = require("./types");
|
|
10
10
|
Object.defineProperty(exports, "EMPTY_BUILD_MANIFEST", { enumerable: true, get: function () { return types_1.EMPTY_BUILD_MANIFEST; } });
|
|
11
11
|
// URL readers and connection helpers
|
|
@@ -53,6 +53,7 @@ Object.defineProperty(exports, "Model", { enumerable: true, get: function () { r
|
|
|
53
53
|
Object.defineProperty(exports, "PersistSource", { enumerable: true, get: function () { return core_1.PersistSource; } });
|
|
54
54
|
Object.defineProperty(exports, "PreparedQuery", { enumerable: true, get: function () { return core_1.PreparedQuery; } });
|
|
55
55
|
Object.defineProperty(exports, "PreparedResult", { enumerable: true, get: function () { return core_1.PreparedResult; } });
|
|
56
|
+
Object.defineProperty(exports, "Reference", { enumerable: true, get: function () { return core_1.Reference; } });
|
|
56
57
|
// Result and Data classes
|
|
57
58
|
var result_1 = require("./result");
|
|
58
59
|
Object.defineProperty(exports, "Result", { enumerable: true, get: function () { return result_1.Result; } });
|
|
@@ -873,8 +873,8 @@ exports.ModelMaterializer = ModelMaterializer;
|
|
|
873
873
|
// =============================================================================
|
|
874
874
|
function runSQLOptionsWithAnnotations(preparedResult, givenOptions) {
|
|
875
875
|
return {
|
|
876
|
-
|
|
877
|
-
|
|
876
|
+
queryAnnotations: preparedResult._rawQuery.annotations,
|
|
877
|
+
modelAnnotations: preparedResult._modelDef.annotations,
|
|
878
878
|
...givenOptions,
|
|
879
879
|
};
|
|
880
880
|
}
|
|
@@ -8,17 +8,17 @@ export interface Taggable {
|
|
|
8
8
|
/**
|
|
9
9
|
* Route-aware annotation access — read annotations by *route*. See
|
|
10
10
|
* `Annotations` for what a route is and which ones are claimed. Unlike
|
|
11
|
-
* `tagParse`/`getTaglines`, this sees
|
|
11
|
+
* `tagParse`/`getTaglines`, this sees multi-line annotations (`#|`…`|#`).
|
|
12
12
|
*/
|
|
13
13
|
readonly annotations: Annotations;
|
|
14
14
|
/**
|
|
15
|
-
* @deprecated The RegExp form cannot see
|
|
16
|
-
* cannot report content offsets for error mapping. Use
|
|
15
|
+
* @deprecated The RegExp form cannot see multi-line annotations
|
|
16
|
+
* (`#|`…`|#`) and cannot report content offsets for error mapping. Use
|
|
17
17
|
* `annotations.parseAsTag(route)` instead.
|
|
18
18
|
*/
|
|
19
19
|
tagParse: (spec?: TagParseSpec) => MalloyTagParse;
|
|
20
20
|
/**
|
|
21
|
-
* @deprecated The RegExp form cannot see
|
|
21
|
+
* @deprecated The RegExp form cannot see multi-line annotations. Use
|
|
22
22
|
* `annotations.texts(route)` (raw strings) or `annotations.forRoute(route)`
|
|
23
23
|
* (objects with offsets) instead.
|
|
24
24
|
*/
|
|
@@ -9,7 +9,7 @@ import type { BuildManifest, GivenValue, VirtualMap } from '../../model';
|
|
|
9
9
|
* Frozen to prevent accidental mutation of the shared sentinel.
|
|
10
10
|
*/
|
|
11
11
|
export declare const EMPTY_BUILD_MANIFEST: BuildManifest;
|
|
12
|
-
export type { Taggable } from '
|
|
12
|
+
export type { Taggable } from './taggable';
|
|
13
13
|
export interface Loggable {
|
|
14
14
|
debug: (message?: any, ...optionalParams: any[]) => void;
|
|
15
15
|
info: (message?: any, ...optionalParams: any[]) => void;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { RunSQLOptions } from '../run_sql_options';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AnnotationsDef, MalloyQueryData, QueryRecord, QueryRunStats, SQLSourceDef, TableSourceDef } from '../model/malloy_types';
|
|
3
3
|
import type { SQLSourceRequest } from '../lang/translate-response';
|
|
4
4
|
/**
|
|
5
5
|
* Options passed to fetchSchema methods.
|
|
6
6
|
*/
|
|
7
7
|
export interface FetchSchemaOptions {
|
|
8
8
|
refreshTimestamp?: number;
|
|
9
|
-
|
|
9
|
+
/** Model annotations forwarded to the adapter (e.g. `##!` dialect flags). */
|
|
10
|
+
modelAnnotations?: AnnotationsDef;
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
13
|
* An object capable of reading schemas for given table names.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { DuckDBDialect, StandardSQLDialect, TrinoDialect, PostgresDialect, SnowflakeDialect, MySQLDialect, DatabricksDialect, registerDialect, arg, qtz, overload, minScalar, anyExprType, minAggregate, maxScalar, sql, makeParam, param, variadicParam, literal, spread, Dialect, decodeDottedTablePath, validateDottedTablePath, } from './dialect';
|
|
2
2
|
export type { DialectFieldList, DialectFunctionOverloadDef, QueryInfo, MalloyStandardFunctionImplementations, DefinitionBlueprint, DefinitionBlueprintMap, OverloadedDefinitionBlueprint, DecodeDottedTablePathResult, DottedTablePathOptions, TablePathEscapeStyle, TablePathSegment, ValidateTablePathResult, } from './dialect';
|
|
3
|
-
export type { QueryRecord, StructDef, TableSourceDef, SQLSourceDef, SourceDef, JoinFieldDef, NamedSourceDefs, MalloyQueryData, DateUnit, ExtractUnit, TimestampUnit, TemporalFieldType, QueryData, QueryValue, Expr, FilterCondition, Argument, Parameter, FieldDef, PipeSegment, QueryFieldDef, IndexFieldDef, TurtleDef, SearchValueMapResult, SearchIndexResult, ModelDef, Query, QueryResult, QueryResultDef, QueryRunStats, QueryScalar, NamedQueryDef, NamedModelObject, ExpressionType, FunctionDef, FunctionOverloadDef, FunctionParameterDef, ExpressionValueType, TypeDesc, FunctionParamTypeDesc, DocumentLocation, DocumentRange, DocumentPosition, Sampling,
|
|
3
|
+
export type { QueryRecord, StructDef, TableSourceDef, SQLSourceDef, SourceDef, JoinFieldDef, NamedSourceDefs, MalloyQueryData, DateUnit, ExtractUnit, TimestampUnit, TemporalFieldType, QueryData, QueryValue, Expr, FilterCondition, Argument, Parameter, FieldDef, PipeSegment, QueryFieldDef, IndexFieldDef, TurtleDef, SearchValueMapResult, SearchIndexResult, ModelDef, Query, QueryResult, QueryResultDef, QueryRunStats, QueryScalar, NamedQueryDef, NamedModelObject, ExpressionType, FunctionDef, FunctionOverloadDef, FunctionParameterDef, ExpressionValueType, TypeDesc, FunctionParamTypeDesc, DocumentLocation, DocumentRange, DocumentPosition, Sampling, BasicAtomicTypeDef, BasicAtomicDef, AtomicTypeDef, AtomicFieldDef, ArrayDef, ArrayTypeDef, RecordTypeDef, RepeatedRecordTypeDef, RecordDef, RepeatedRecordDef, RecordLiteralNode, StringLiteralNode, ArrayLiteralNode, SourceComponentInfo, DateLiteralNode, TimestampLiteralNode, TimestamptzLiteralNode, TimeLiteralExpr, TypecastExpr, BuildID, BuildManifest, BuildManifestEntry, GivenValue, VirtualMap, } from './model';
|
|
4
4
|
export { isSourceDef, isAtomic, isBasicAtomic, isCompoundArrayData, isJoined, isJoinedSource, isSamplingEnable, isSamplingPercent, isSamplingRows, isRepeatedRecord, isBasicArray, mkArrayDef, mkFieldDef, expressionIsAggregate, expressionIsAnalytic, expressionIsCalculation, expressionIsScalar, expressionIsUngroupedAggregate, indent, composeSQLExpr, isTimestampUnit, isDateUnit, constantExprToSQL, } from './model';
|
|
5
5
|
export { malloyToQuery, MalloyTranslator, } from './lang';
|
|
6
6
|
export type { LogMessage, TranslateResponse } from './lang';
|
|
@@ -19,7 +19,14 @@ export { modelDefToModelInfo, sourceDefToSourceInfo } from './to_stable';
|
|
|
19
19
|
export * as API from './api';
|
|
20
20
|
export type { SQLSourceRequest } from './lang/translate-response';
|
|
21
21
|
export { sqlKey } from './model/sql_block';
|
|
22
|
-
export {
|
|
22
|
+
export { Annotations, RoutedNote } from './api/foundation/annotation';
|
|
23
|
+
export { routeOf, payloadOf, annotationsForRoute, tagFromAnnotations, } from './api/annotation-utils';
|
|
24
|
+
/** @deprecated — use the `.annotations` view on a Foundation entity
|
|
25
|
+
* (`entity.annotations.parseAsTag(route)` / `.texts(route)`). */
|
|
26
|
+
export { annotationToTag, annotationToTaglines, } from './api/foundation/annotation';
|
|
23
27
|
export type { BuildGraph, BuildNode, BuildPlan } from './api/foundation';
|
|
24
28
|
export { PersistSource, EMPTY_BUILD_MANIFEST } from './api/foundation';
|
|
29
|
+
export { Reference } from './api/foundation';
|
|
30
|
+
export type { ReferenceKind } from './api/foundation';
|
|
31
|
+
export type { ImportLocation } from './model';
|
|
25
32
|
export { makeDigest } from './model';
|
package/dist/index.js
CHANGED
|
@@ -34,7 +34,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.Model = exports.MalloyTranslator = exports.malloyToQuery = exports.constantExprToSQL = exports.isDateUnit = exports.isTimestampUnit = exports.composeSQLExpr = exports.indent = exports.expressionIsUngroupedAggregate = exports.expressionIsScalar = exports.expressionIsCalculation = exports.expressionIsAnalytic = exports.expressionIsAggregate = exports.mkFieldDef = exports.mkArrayDef = exports.isBasicArray = exports.isRepeatedRecord = exports.isSamplingRows = exports.isSamplingPercent = exports.isSamplingEnable = exports.isJoinedSource = exports.isJoined = exports.isCompoundArrayData = exports.isBasicAtomic = exports.isAtomic = exports.isSourceDef = exports.validateDottedTablePath = exports.decodeDottedTablePath = exports.Dialect = exports.spread = exports.literal = exports.variadicParam = exports.param = exports.makeParam = exports.sql = exports.maxScalar = exports.minAggregate = exports.anyExprType = exports.minScalar = exports.overload = exports.qtz = exports.arg = exports.registerDialect = exports.DatabricksDialect = exports.MySQLDialect = exports.SnowflakeDialect = exports.PostgresDialect = exports.TrinoDialect = exports.StandardSQLDialect = exports.DuckDBDialect = void 0;
|
|
37
|
-
exports.
|
|
37
|
+
exports.Reference = exports.EMPTY_BUILD_MANIFEST = exports.PersistSource = exports.annotationToTaglines = exports.annotationToTag = exports.tagFromAnnotations = exports.annotationsForRoute = exports.payloadOf = exports.routeOf = exports.RoutedNote = exports.Annotations = exports.sqlKey = exports.API = exports.sourceDefToSourceInfo = exports.modelDefToModelInfo = exports.toAsyncGenerator = exports.createConnectionsFromConfig = exports.getRegisteredConnectionTypes = exports.getConnectionTypeDisplayName = exports.getConnectionProperties = exports.registerConnectionType = exports.discoverConfig = exports.defaultConfigOverlays = exports.contextOverlay = exports.envOverlay = exports.MalloyConfig = exports.Manifest = exports.CacheManager = exports.InMemoryModelCache = exports.Explore = exports.DataWriter = exports.Parse = exports.JSONWriter = exports.CSVWriter = exports.QueryMaterializer = exports.Result = exports.PreparedResult = exports.TimestampTimeframe = exports.DateTimeframe = exports.SourceRelationship = exports.JoinRelationship = exports.MalloyError = exports.FixedConnectionMap = exports.InMemoryURLReader = exports.EmptyURLReader = exports.SingleConnectionRuntime = exports.ConnectionRuntime = exports.AtomicFieldType = exports.Runtime = exports.Malloy = void 0;
|
|
38
|
+
exports.makeDigest = void 0;
|
|
38
39
|
/*
|
|
39
40
|
* Copyright 2023 Google LLC
|
|
40
41
|
*
|
|
@@ -157,12 +158,24 @@ Object.defineProperty(exports, "sourceDefToSourceInfo", { enumerable: true, get:
|
|
|
157
158
|
exports.API = __importStar(require("./api"));
|
|
158
159
|
var sql_block_1 = require("./model/sql_block");
|
|
159
160
|
Object.defineProperty(exports, "sqlKey", { enumerable: true, get: function () { return sql_block_1.sqlKey; } });
|
|
160
|
-
var annotation_1 = require("./annotation");
|
|
161
|
-
Object.defineProperty(exports, "
|
|
162
|
-
Object.defineProperty(exports, "
|
|
161
|
+
var annotation_1 = require("./api/foundation/annotation");
|
|
162
|
+
Object.defineProperty(exports, "Annotations", { enumerable: true, get: function () { return annotation_1.Annotations; } });
|
|
163
|
+
Object.defineProperty(exports, "RoutedNote", { enumerable: true, get: function () { return annotation_1.RoutedNote; } });
|
|
164
|
+
var annotation_utils_1 = require("./api/annotation-utils");
|
|
165
|
+
Object.defineProperty(exports, "routeOf", { enumerable: true, get: function () { return annotation_utils_1.routeOf; } });
|
|
166
|
+
Object.defineProperty(exports, "payloadOf", { enumerable: true, get: function () { return annotation_utils_1.payloadOf; } });
|
|
167
|
+
Object.defineProperty(exports, "annotationsForRoute", { enumerable: true, get: function () { return annotation_utils_1.annotationsForRoute; } });
|
|
168
|
+
Object.defineProperty(exports, "tagFromAnnotations", { enumerable: true, get: function () { return annotation_utils_1.tagFromAnnotations; } });
|
|
169
|
+
/** @deprecated — use the `.annotations` view on a Foundation entity
|
|
170
|
+
* (`entity.annotations.parseAsTag(route)` / `.texts(route)`). */
|
|
171
|
+
var annotation_2 = require("./api/foundation/annotation");
|
|
172
|
+
Object.defineProperty(exports, "annotationToTag", { enumerable: true, get: function () { return annotation_2.annotationToTag; } });
|
|
173
|
+
Object.defineProperty(exports, "annotationToTaglines", { enumerable: true, get: function () { return annotation_2.annotationToTaglines; } });
|
|
163
174
|
var foundation_2 = require("./api/foundation");
|
|
164
175
|
Object.defineProperty(exports, "PersistSource", { enumerable: true, get: function () { return foundation_2.PersistSource; } });
|
|
165
176
|
Object.defineProperty(exports, "EMPTY_BUILD_MANIFEST", { enumerable: true, get: function () { return foundation_2.EMPTY_BUILD_MANIFEST; } });
|
|
177
|
+
var foundation_3 = require("./api/foundation");
|
|
178
|
+
Object.defineProperty(exports, "Reference", { enumerable: true, get: function () { return foundation_3.Reference; } });
|
|
166
179
|
var model_2 = require("./model");
|
|
167
180
|
Object.defineProperty(exports, "makeDigest", { enumerable: true, get: function () { return model_2.makeDigest; } });
|
|
168
181
|
//# sourceMappingURL=index.js.map
|
|
@@ -46,7 +46,7 @@ class GivenReference extends expression_def_1.ExpressionDef {
|
|
|
46
46
|
location: this.location,
|
|
47
47
|
definition: {
|
|
48
48
|
type: (0, utils_1.typeDefToString)(given.type),
|
|
49
|
-
|
|
49
|
+
annotations: given.annotations,
|
|
50
50
|
location: given.location,
|
|
51
51
|
defaultText: given.defaultText,
|
|
52
52
|
},
|
|
@@ -13,7 +13,7 @@ export declare abstract class DynamicSpace extends StaticSpace implements Source
|
|
|
13
13
|
private parameters;
|
|
14
14
|
protected newTimezone?: string;
|
|
15
15
|
protected newAccessModifiers: Map<string, model.AccessModifierLabel>;
|
|
16
|
-
protected newNotes: Map<string, model.
|
|
16
|
+
protected newNotes: Map<string, model.AnnotationsDef>;
|
|
17
17
|
constructor(extending: SourceDef);
|
|
18
18
|
protected setEntry(name: string, value: SpaceEntry): void;
|
|
19
19
|
addParameters(parameters: HasParameter[]): DynamicSpace;
|
|
@@ -191,9 +191,9 @@ class DynamicSpace extends static_space_1.StaticSpace {
|
|
|
191
191
|
const field = this.sourceDef.fields[index];
|
|
192
192
|
this.sourceDef.fields[index] = {
|
|
193
193
|
...field,
|
|
194
|
-
|
|
194
|
+
annotations: {
|
|
195
195
|
...note,
|
|
196
|
-
inherits: field.
|
|
196
|
+
inherits: field.annotations,
|
|
197
197
|
},
|
|
198
198
|
};
|
|
199
199
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { AccessModifierLabel,
|
|
1
|
+
import type { AccessModifierLabel, AnnotationsDef, DocumentLocation, SourceDef } from '../../../model/malloy_types';
|
|
2
2
|
import type { IncludeItem } from '../source-query-elements/include-item';
|
|
3
3
|
import type { FieldReference } from '../query-items/field-references';
|
|
4
4
|
export interface JoinIncludeProcessingState {
|
|
5
5
|
star: AccessModifierLabel | 'inherit' | 'except' | undefined;
|
|
6
|
-
starNote:
|
|
6
|
+
starNote: AnnotationsDef | undefined;
|
|
7
7
|
fieldsIncluded: Set<string>;
|
|
8
8
|
joinNames: Set<string>;
|
|
9
9
|
fieldsExcepted: Set<string>;
|
|
@@ -16,7 +16,7 @@ export interface JoinIncludeProcessingState {
|
|
|
16
16
|
location: DocumentLocation;
|
|
17
17
|
}[];
|
|
18
18
|
fieldsToInclude: Set<string> | undefined;
|
|
19
|
-
notes: Map<string,
|
|
19
|
+
notes: Map<string, AnnotationsDef>;
|
|
20
20
|
}
|
|
21
21
|
export interface IncludeProcessingState {
|
|
22
22
|
joins: {
|
|
@@ -309,8 +309,8 @@ class QuerySpace extends QueryOperationSpace {
|
|
|
309
309
|
throw new Error('Invalid type for fieldref');
|
|
310
310
|
}
|
|
311
311
|
ret.location = (_c = ret.location) !== null && _c !== void 0 ? _c : this.astEl.location;
|
|
312
|
-
if (queryFieldDef.
|
|
313
|
-
ret.
|
|
312
|
+
if (queryFieldDef.annotations) {
|
|
313
|
+
ret.annotations = queryFieldDef.annotations;
|
|
314
314
|
}
|
|
315
315
|
return ret;
|
|
316
316
|
}
|
|
@@ -113,12 +113,12 @@ class ReferenceField extends space_field_1.SpaceField {
|
|
|
113
113
|
const origFd = refTo.constructorFieldDef();
|
|
114
114
|
if (origFd) {
|
|
115
115
|
const notes = this.fieldRef.note;
|
|
116
|
-
if (origFd.
|
|
117
|
-
const
|
|
118
|
-
if (origFd.
|
|
119
|
-
|
|
116
|
+
if (origFd.annotations || notes) {
|
|
117
|
+
const annotations = notes || {};
|
|
118
|
+
if (origFd.annotations) {
|
|
119
|
+
annotations.inherits = origFd.annotations;
|
|
120
120
|
}
|
|
121
|
-
this.queryFieldDef.
|
|
121
|
+
this.queryFieldDef.annotations = annotations;
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AccessModifierLabel, type
|
|
1
|
+
import { type AccessModifierLabel, type AnnotationsDef, type SourceDef } from '../../../model/malloy_types';
|
|
2
2
|
import type { FieldListEdit } from '../source-properties/field-list-edit';
|
|
3
3
|
import { DynamicSpace } from './dynamic-space';
|
|
4
4
|
import type { MalloyElement } from '../types/malloy-element';
|
|
@@ -14,6 +14,6 @@ export declare class RefinedSpace extends DynamicSpace {
|
|
|
14
14
|
pushFields(...defs: MalloyElement[]): void;
|
|
15
15
|
addField(def: MalloyElement): void;
|
|
16
16
|
addAccessModifiers(ams: Map<string, AccessModifierLabel>): void;
|
|
17
|
-
addNotes(notes: Map<string,
|
|
17
|
+
addNotes(notes: Map<string, AnnotationsDef>): void;
|
|
18
18
|
accessProtectionLevel(): AccessModifierLabel;
|
|
19
19
|
}
|
|
@@ -160,13 +160,13 @@ function editJoinsFromIncludeState(path, from, includeState) {
|
|
|
160
160
|
...field,
|
|
161
161
|
as: rename ? rename.name.nameString : field.as,
|
|
162
162
|
accessModifier: accessModifier === 'public' ? undefined : accessModifier,
|
|
163
|
-
|
|
163
|
+
annotations: notes
|
|
164
164
|
? {
|
|
165
|
-
inherits: field.
|
|
165
|
+
inherits: field.annotations,
|
|
166
166
|
blockNotes: notes.blockNotes,
|
|
167
167
|
notes: notes.notes,
|
|
168
168
|
}
|
|
169
|
-
: field.
|
|
169
|
+
: field.annotations,
|
|
170
170
|
}
|
|
171
171
|
: { ...field };
|
|
172
172
|
if ((0, malloy_types_1.isJoined)(editedField)) {
|