@malloydata/malloy 0.0.22-dev230207182613 → 0.0.22-dev230207183024

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 (155) hide show
  1. package/dist/connection_utils.js +7 -7
  2. package/dist/dialect/dialect.d.ts +1 -1
  3. package/dist/dialect/duckdb.d.ts +1 -1
  4. package/dist/dialect/duckdb.js +9 -9
  5. package/dist/dialect/postgres.d.ts +1 -1
  6. package/dist/dialect/postgres.js +16 -16
  7. package/dist/dialect/standardsql.d.ts +1 -1
  8. package/dist/dialect/standardsql.js +8 -8
  9. package/dist/index.d.ts +6 -6
  10. package/dist/lang/ast/ast-utils.js +3 -3
  11. package/dist/lang/ast/elements/define-query.js +4 -4
  12. package/dist/lang/ast/elements/define-source.d.ts +1 -1
  13. package/dist/lang/ast/elements/define-source.js +8 -8
  14. package/dist/lang/ast/elements/import-statement.js +2 -2
  15. package/dist/lang/ast/elements/pipeline-desc.d.ts +1 -1
  16. package/dist/lang/ast/elements/pipeline-desc.js +7 -7
  17. package/dist/lang/ast/elements/refined-source.d.ts +1 -1
  18. package/dist/lang/ast/elements/refined-source.js +5 -5
  19. package/dist/lang/ast/elements/source.js +1 -1
  20. package/dist/lang/ast/error-factory.js +16 -13
  21. package/dist/lang/ast/expressions/binary-boolean.d.ts +1 -1
  22. package/dist/lang/ast/expressions/binary-boolean.js +4 -4
  23. package/dist/lang/ast/expressions/binary-numeric.d.ts +1 -1
  24. package/dist/lang/ast/expressions/binary-numeric.js +1 -1
  25. package/dist/lang/ast/expressions/boolean.js +1 -1
  26. package/dist/lang/ast/expressions/constant-sub-expression.js +7 -7
  27. package/dist/lang/ast/expressions/expr-aggregate-function.d.ts +3 -3
  28. package/dist/lang/ast/expressions/expr-aggregate-function.js +12 -12
  29. package/dist/lang/ast/expressions/expr-alternation-tree.js +3 -3
  30. package/dist/lang/ast/expressions/expr-asymmetric.d.ts +1 -1
  31. package/dist/lang/ast/expressions/expr-asymmetric.js +1 -1
  32. package/dist/lang/ast/expressions/expr-avg.d.ts +1 -1
  33. package/dist/lang/ast/expressions/expr-avg.js +1 -1
  34. package/dist/lang/ast/expressions/expr-cast.d.ts +1 -1
  35. package/dist/lang/ast/expressions/expr-cast.js +26 -4
  36. package/dist/lang/ast/expressions/expr-compare.d.ts +1 -1
  37. package/dist/lang/ast/expressions/expr-compare.js +3 -3
  38. package/dist/lang/ast/expressions/expr-count.js +6 -6
  39. package/dist/lang/ast/expressions/expr-filter.d.ts +2 -2
  40. package/dist/lang/ast/expressions/expr-filter.js +8 -8
  41. package/dist/lang/ast/expressions/expr-func.d.ts +1 -1
  42. package/dist/lang/ast/expressions/expr-func.js +3 -3
  43. package/dist/lang/ast/expressions/expr-granular-time.js +7 -7
  44. package/dist/lang/ast/expressions/expr-id-reference.js +11 -11
  45. package/dist/lang/ast/expressions/expr-logical-op.js +1 -1
  46. package/dist/lang/ast/expressions/expr-minus.d.ts +1 -1
  47. package/dist/lang/ast/expressions/expr-minus.js +3 -3
  48. package/dist/lang/ast/expressions/expr-not.js +2 -2
  49. package/dist/lang/ast/expressions/expr-now.js +7 -7
  50. package/dist/lang/ast/expressions/expr-null.js +3 -3
  51. package/dist/lang/ast/expressions/expr-number.js +1 -1
  52. package/dist/lang/ast/expressions/expr-parens.js +2 -2
  53. package/dist/lang/ast/expressions/expr-regex.js +3 -3
  54. package/dist/lang/ast/expressions/expr-string.js +6 -6
  55. package/dist/lang/ast/expressions/expr-sum.d.ts +1 -1
  56. package/dist/lang/ast/expressions/expr-sum.js +1 -1
  57. package/dist/lang/ast/expressions/expr-time-extract.d.ts +1 -1
  58. package/dist/lang/ast/expressions/expr-time-extract.js +29 -29
  59. package/dist/lang/ast/expressions/expr-time.js +7 -7
  60. package/dist/lang/ast/expressions/expr-ungroup.d.ts +2 -2
  61. package/dist/lang/ast/expressions/expr-ungroup.js +11 -8
  62. package/dist/lang/ast/expressions/for-range.d.ts +1 -1
  63. package/dist/lang/ast/expressions/for-range.js +1 -1
  64. package/dist/lang/ast/expressions/granular-literal.js +12 -12
  65. package/dist/lang/ast/expressions/partial-compare.d.ts +1 -1
  66. package/dist/lang/ast/expressions/partial-compare.js +1 -1
  67. package/dist/lang/ast/expressions/pick-when.d.ts +1 -1
  68. package/dist/lang/ast/expressions/pick-when.js +11 -11
  69. package/dist/lang/ast/expressions/range.js +4 -4
  70. package/dist/lang/ast/expressions/top-by.d.ts +1 -1
  71. package/dist/lang/ast/expressions/top-by.js +4 -4
  72. package/dist/lang/ast/expressions/unary.js +1 -1
  73. package/dist/lang/ast/field-space/dynamic-space.d.ts +1 -1
  74. package/dist/lang/ast/field-space/dynamic-space.js +1 -1
  75. package/dist/lang/ast/field-space/index-field-space.js +2 -2
  76. package/dist/lang/ast/field-space/query-field-struct.js +1 -1
  77. package/dist/lang/ast/field-space/query-space-field.js +1 -1
  78. package/dist/lang/ast/field-space/query-spaces.js +2 -2
  79. package/dist/lang/ast/field-space/reference-field.js +1 -1
  80. package/dist/lang/ast/field-space/rename-space-field.js +2 -2
  81. package/dist/lang/ast/field-space/static-space.js +8 -8
  82. package/dist/lang/ast/field-space/struct-space-field-base.js +1 -1
  83. package/dist/lang/ast/fragtype-utils.js +2 -2
  84. package/dist/lang/ast/parameters/constant-parameter.js +9 -9
  85. package/dist/lang/ast/parameters/has-parameter.js +5 -5
  86. package/dist/lang/ast/query-elements/anonymous-query.js +1 -1
  87. package/dist/lang/ast/query-elements/existing-query.d.ts +1 -1
  88. package/dist/lang/ast/query-elements/existing-query.js +11 -11
  89. package/dist/lang/ast/query-elements/full-query.js +11 -11
  90. package/dist/lang/ast/query-elements/query-head-struct.js +1 -1
  91. package/dist/lang/ast/query-items/field-declaration.d.ts +1 -1
  92. package/dist/lang/ast/query-items/field-declaration.js +11 -11
  93. package/dist/lang/ast/query-items/field-references.d.ts +1 -1
  94. package/dist/lang/ast/query-items/field-references.js +1 -1
  95. package/dist/lang/ast/query-properties/filters.d.ts +1 -1
  96. package/dist/lang/ast/query-properties/filters.js +7 -7
  97. package/dist/lang/ast/query-properties/indexing.d.ts +1 -1
  98. package/dist/lang/ast/query-properties/indexing.js +2 -2
  99. package/dist/lang/ast/query-properties/joins.d.ts +1 -1
  100. package/dist/lang/ast/query-properties/joins.js +17 -14
  101. package/dist/lang/ast/query-properties/nest.js +4 -4
  102. package/dist/lang/ast/query-properties/ordering.js +2 -2
  103. package/dist/lang/ast/query-properties/qop-desc.js +1 -1
  104. package/dist/lang/ast/query-properties/top.js +3 -3
  105. package/dist/lang/ast/source-properties/field-list-edit.js +1 -1
  106. package/dist/lang/ast/source-properties/primary-key.js +1 -1
  107. package/dist/lang/ast/source-properties/renames.js +1 -1
  108. package/dist/lang/ast/sources/named-source.d.ts +2 -2
  109. package/dist/lang/ast/sources/named-source.js +6 -6
  110. package/dist/lang/ast/sources/query-source.d.ts +1 -1
  111. package/dist/lang/ast/sources/query-source.js +2 -2
  112. package/dist/lang/ast/sources/table-source.js +7 -5
  113. package/dist/lang/ast/space-seed.d.ts +1 -1
  114. package/dist/lang/ast/sql-elements/sql-statement.js +5 -5
  115. package/dist/lang/ast/sql-elements/sql-string.js +1 -1
  116. package/dist/lang/ast/struct-utils.js +2 -2
  117. package/dist/lang/ast/time-utils.js +32 -32
  118. package/dist/lang/ast/types/expression-def.js +34 -34
  119. package/dist/lang/ast/types/malloy-element.d.ts +4 -4
  120. package/dist/lang/ast/types/malloy-element.js +27 -27
  121. package/dist/lang/ast/types/query-comp.d.ts +1 -1
  122. package/dist/lang/ast/types/space-field.js +1 -1
  123. package/dist/lang/ast/types/space-param.js +2 -2
  124. package/dist/lang/ast/types/turtle-headed-pipe.d.ts +1 -1
  125. package/dist/lang/ast/types/turtle-headed-pipe.js +1 -1
  126. package/dist/lang/ast/types/type-desc.d.ts +1 -1
  127. package/dist/lang/field-utils.d.ts +1 -1
  128. package/dist/lang/index.d.ts +1 -1
  129. package/dist/lang/malloy-to-ast.d.ts +1 -1
  130. package/dist/lang/malloy-to-ast.js +11 -11
  131. package/dist/lang/parse-error-handler.js +4 -4
  132. package/dist/lang/parse-malloy.d.ts +4 -4
  133. package/dist/lang/parse-malloy.js +61 -61
  134. package/dist/lang/parse-tree-walkers/document-completion-walker.js +16 -16
  135. package/dist/lang/parse-tree-walkers/document-help-context-walker.js +10 -10
  136. package/dist/lang/parse-tree-walkers/document-highlight-walker.js +85 -82
  137. package/dist/lang/parse-tree-walkers/document-symbol-walker.js +40 -40
  138. package/dist/lang/parse-tree-walkers/find-external-references.d.ts +1 -1
  139. package/dist/lang/parse-tree-walkers/find-external-references.js +2 -2
  140. package/dist/lang/reference-list.d.ts +1 -1
  141. package/dist/lang/test/document-help-context-walker.spec.js +6 -6
  142. package/dist/lang/test/document-symbol-walker.spec.js +3 -3
  143. package/dist/lang/test/field-symbols.spec.js +62 -58
  144. package/dist/lang/test/parse.spec.js +262 -260
  145. package/dist/lang/test/test-translator.d.ts +1 -1
  146. package/dist/lang/test/test-translator.js +139 -139
  147. package/dist/lang/translate-response.d.ts +1 -1
  148. package/dist/lang/zone.js +5 -5
  149. package/dist/malloy.d.ts +5 -5
  150. package/dist/malloy.js +72 -72
  151. package/dist/model/malloy_query.d.ts +2 -2
  152. package/dist/model/malloy_query.js +179 -176
  153. package/dist/model/malloy_types.js +41 -41
  154. package/dist/model/sql_block.js +2 -2
  155. package/package.json +1 -1
@@ -30,7 +30,7 @@ class SQLStatement extends malloy_element_1.MalloyElement {
30
30
  super();
31
31
  this.select = select;
32
32
  this.elementType = "sqlStatement";
33
- this.has({ select });
33
+ this.has({ "select": select });
34
34
  }
35
35
  sqlBlock() {
36
36
  if (!this.requestBlock) {
@@ -62,8 +62,8 @@ class SQLStatement extends malloy_element_1.MalloyElement {
62
62
  const location = this.select.location;
63
63
  const locStruct = {
64
64
  ...lookup.value,
65
- fields: lookup.value.fields.map((f) => ({ ...f, location })),
66
- location: this.location,
65
+ "fields": lookup.value.fields.map((f) => ({ ...f, location })),
66
+ "location": this.location
67
67
  };
68
68
  if (this.is && !doc.defineSQL(locStruct, this.is)) {
69
69
  this.log(`'${this.is}' already defined`);
@@ -71,8 +71,8 @@ class SQLStatement extends malloy_element_1.MalloyElement {
71
71
  return undefined;
72
72
  }
73
73
  return {
74
- compileSQL: sql,
75
- partialModel: this.select.containsQueries ? doc.modelDef() : undefined,
74
+ "compileSQL": sql,
75
+ "partialModel": this.select.containsQueries ? doc.modelDef() : undefined
76
76
  };
77
77
  }
78
78
  }
@@ -50,7 +50,7 @@ class SQLString extends malloy_element_1.MalloyElement {
50
50
  sqlPhrases() {
51
51
  return this.elements.map((el) => {
52
52
  if (typeof el == "string") {
53
- return { sql: el };
53
+ return { "sql": el };
54
54
  }
55
55
  return el.query();
56
56
  });
@@ -35,10 +35,10 @@ function opOutputStruct(logTo, inputStruct, opDesc) {
35
35
  }
36
36
  catch (e) {
37
37
  logTo.log(`INTERNAL ERROR model/Segment.nextStructDef: ${e.message}\n` +
38
- `QUERY: ${(0, util_1.inspect)(opDesc, { breakLength: 72, depth: Infinity })}`);
38
+ `QUERY: ${(0, util_1.inspect)(opDesc, { "breakLength": 72, "depth": Infinity })}`);
39
39
  }
40
40
  }
41
- return { ...error_factory_1.ErrorFactory.structDef, dialect: inputStruct.dialect };
41
+ return { ...error_factory_1.ErrorFactory.structDef, "dialect": inputStruct.dialect };
42
42
  }
43
43
  exports.opOutputStruct = opOutputStruct;
44
44
  function getStructFieldDef(s, fn) {
@@ -27,47 +27,47 @@ const utils_1 = require("./expressions/utils");
27
27
  function timeOffset(timeType, from, op, n, timeframe) {
28
28
  return [
29
29
  {
30
- type: "dialect",
31
- function: "delta",
32
- base: { valueType: timeType, value: from },
30
+ "type": "dialect",
31
+ "function": "delta",
32
+ "base": { "valueType": timeType, "value": from },
33
33
  op,
34
- delta: n,
35
- units: timeframe,
36
- },
34
+ "delta": n,
35
+ "units": timeframe
36
+ }
37
37
  ];
38
38
  }
39
39
  exports.timeOffset = timeOffset;
40
40
  function castTo(castType, from, safe = false) {
41
41
  const cast = {
42
- type: "dialect",
43
- function: "cast",
44
- dstType: castType,
45
- expr: from,
46
- safe,
42
+ "type": "dialect",
43
+ "function": "cast",
44
+ "dstType": castType,
45
+ "expr": from,
46
+ safe
47
47
  };
48
48
  return [cast];
49
49
  }
50
50
  exports.castTo = castTo;
51
51
  function castTimestampToDate(from, safe = false) {
52
52
  const cast = {
53
- type: "dialect",
54
- function: "cast",
55
- dstType: "date",
56
- srcType: "timestamp",
57
- expr: from,
58
- safe,
53
+ "type": "dialect",
54
+ "function": "cast",
55
+ "dstType": "date",
56
+ "srcType": "timestamp",
57
+ "expr": from,
58
+ safe
59
59
  };
60
60
  return [cast];
61
61
  }
62
62
  exports.castTimestampToDate = castTimestampToDate;
63
63
  function castDateToTimestamp(from, safe = false) {
64
64
  const cast = {
65
- type: "dialect",
66
- function: "cast",
67
- dstType: "timestamp",
68
- srcType: "date",
69
- expr: from,
70
- safe,
65
+ "type": "dialect",
66
+ "function": "cast",
67
+ "dstType": "timestamp",
68
+ "srcType": "date",
69
+ "expr": from,
70
+ safe
71
71
  };
72
72
  return [cast];
73
73
  }
@@ -86,18 +86,18 @@ function resolution(timeframe) {
86
86
  exports.resolution = resolution;
87
87
  function timeResult(t, tt) {
88
88
  if (tt) {
89
- return { ...t, timeframe: tt };
89
+ return { ...t, "timeframe": tt };
90
90
  }
91
91
  return t;
92
92
  }
93
93
  exports.timeResult = timeResult;
94
94
  function timeLiteral(literalStr, timeType, tz) {
95
95
  const fragment = {
96
- type: "dialect",
97
- function: "timeLiteral",
98
- literal: literalStr,
99
- literalType: timeType,
100
- timezone: tz,
96
+ "type": "dialect",
97
+ "function": "timeLiteral",
98
+ "literal": literalStr,
99
+ "literalType": timeType,
100
+ "timezone": tz
101
101
  };
102
102
  return [fragment];
103
103
  }
@@ -112,7 +112,7 @@ function timestampOffset(from, op, n, timeframe, fromNotTimestamp = false) {
112
112
  ...from,
113
113
  `),INTERVAL `,
114
114
  ...n,
115
- ` ${units}))`,
115
+ ` ${units}))`
116
116
  ];
117
117
  }
118
118
  const typeFrom = fromNotTimestamp ? ["TIMESTAMP(", ...from, ")"] : from;
@@ -121,7 +121,7 @@ function timestampOffset(from, op, n, timeframe, fromNotTimestamp = false) {
121
121
  ...typeFrom,
122
122
  `,INTERVAL `,
123
123
  ...n,
124
- ` ${units})`,
124
+ ` ${units})`
125
125
  ]);
126
126
  }
127
127
  exports.timestampOffset = timestampOffset;
@@ -133,7 +133,7 @@ function dateOffset(from, op, n, timeframe) {
133
133
  ...from,
134
134
  `,INTERVAL `,
135
135
  ...n,
136
- ` ${units})`,
136
+ ` ${units})`
137
137
  ]);
138
138
  }
139
139
  exports.dateOffset = dateOffset;
@@ -90,7 +90,7 @@ class ExpressionDef extends malloy_element_1.MalloyElement {
90
90
  exports.ExpressionDef = ExpressionDef;
91
91
  class ExprDuration extends ExpressionDef {
92
92
  constructor(n, timeframe) {
93
- super({ n });
93
+ super({ "n": n });
94
94
  this.n = n;
95
95
  this.timeframe = timeframe;
96
96
  this.elementType = "duration";
@@ -115,24 +115,24 @@ class ExprDuration extends ExpressionDef {
115
115
  if (lhs.dataType === "timestamp") {
116
116
  const result = (0, time_utils_1.timeOffset)("timestamp", lhs.value, op, num.value, this.timeframe);
117
117
  return (0, time_utils_1.timeResult)({
118
- dataType: "timestamp",
119
- expressionType: (0, malloy_types_1.maxExpressionType)(lhs.expressionType, num.expressionType),
120
- value: result,
118
+ "dataType": "timestamp",
119
+ "expressionType": (0, malloy_types_1.maxExpressionType)(lhs.expressionType, num.expressionType),
120
+ "value": result
121
121
  }, resultGranularity);
122
122
  }
123
123
  return (0, time_utils_1.timeResult)({
124
- dataType: "date",
125
- expressionType: (0, malloy_types_1.maxExpressionType)(lhs.expressionType, num.expressionType),
126
- value: (0, time_utils_1.timeOffset)("date", lhs.value, op, num.value, this.timeframe),
124
+ "dataType": "date",
125
+ "expressionType": (0, malloy_types_1.maxExpressionType)(lhs.expressionType, num.expressionType),
126
+ "value": (0, time_utils_1.timeOffset)("date", lhs.value, op, num.value, this.timeframe)
127
127
  }, resultGranularity);
128
128
  }
129
129
  return super.apply(fs, op, left);
130
130
  }
131
131
  getExpression(_fs) {
132
132
  return {
133
- dataType: "duration",
134
- expressionType: "scalar",
135
- value: ["__ERROR_DURATION_IS_NOT_A_VALUE__"],
133
+ "dataType": "duration",
134
+ "expressionType": "scalar",
135
+ "value": ["__ERROR_DURATION_IS_NOT_A_VALUE__"]
136
136
  };
137
137
  }
138
138
  }
@@ -158,11 +158,11 @@ function regexEqual(left, right) {
158
158
  if (right.dataType === "regular expression") {
159
159
  return [
160
160
  {
161
- type: "dialect",
162
- function: "regexpMatch",
163
- expr: left.value,
164
- regexp: right.value[0].replace(/^r'/, "'"),
165
- },
161
+ "type": "dialect",
162
+ "function": "regexpMatch",
163
+ "expr": left.value,
164
+ "regexp": right.value[0].replace(/^r'/, "'")
165
+ }
166
166
  ];
167
167
  }
168
168
  }
@@ -170,11 +170,11 @@ function regexEqual(left, right) {
170
170
  if (left.dataType === "regular expression") {
171
171
  return [
172
172
  {
173
- type: "dialect",
174
- function: "regexpMatch",
175
- expr: right.value,
176
- regexp: left.value[0].replace(/^r'/, "'"),
177
- },
173
+ "type": "dialect",
174
+ "function": "regexpMatch",
175
+ "expr": right.value,
176
+ "regexp": left.value[0].replace(/^r'/, "'")
177
+ }
178
178
  ];
179
179
  }
180
180
  }
@@ -229,9 +229,9 @@ function equality(fs, left, op, right) {
229
229
  }
230
230
  }
231
231
  return {
232
- dataType: "boolean",
233
- expressionType: (0, malloy_types_1.maxExpressionType)(lhs.expressionType, rhs.expressionType),
234
- value,
232
+ "dataType": "boolean",
233
+ "expressionType": (0, malloy_types_1.maxExpressionType)(lhs.expressionType, rhs.expressionType),
234
+ value
235
235
  };
236
236
  }
237
237
  function compare(fs, left, op, right) {
@@ -240,9 +240,9 @@ function compare(fs, left, op, right) {
240
240
  const expressionType = (0, malloy_types_1.maxExpressionType)(lhs.expressionType, rhs.expressionType);
241
241
  const value = timeCompare(lhs, op, rhs) || (0, utils_1.compose)(lhs.value, op, rhs.value);
242
242
  return {
243
- dataType: "boolean",
243
+ "dataType": "boolean",
244
244
  expressionType,
245
- value: value,
245
+ "value": value
246
246
  };
247
247
  }
248
248
  function oneOf(op, ...operators) {
@@ -262,9 +262,9 @@ function numeric(fs, left, op, right) {
262
262
  const expressionType = (0, malloy_types_1.maxExpressionType)(lhs.expressionType, rhs.expressionType);
263
263
  if (allAre("number", lhs, rhs)) {
264
264
  return {
265
- dataType: "number",
265
+ "dataType": "number",
266
266
  expressionType,
267
- value: (0, utils_1.compose)(lhs.value, op, rhs.value),
267
+ "value": (0, utils_1.compose)(lhs.value, op, rhs.value)
268
268
  };
269
269
  }
270
270
  left.log(`Non numeric('${lhs.dataType},${rhs.dataType}') value with '${op}'`);
@@ -326,15 +326,15 @@ function applyBinary(fs, left, op, right) {
326
326
  }
327
327
  else {
328
328
  const div = {
329
- type: "dialect",
330
- function: "div",
331
- numerator: num.value,
332
- denominator: denom.value,
329
+ "type": "dialect",
330
+ "function": "div",
331
+ "numerator": num.value,
332
+ "denominator": denom.value
333
333
  };
334
334
  return {
335
- dataType: "number",
336
- expressionType: (0, malloy_types_1.maxExpressionType)(num.expressionType, denom.expressionType),
337
- value: [div],
335
+ "dataType": "number",
336
+ "expressionType": (0, malloy_types_1.maxExpressionType)(num.expressionType, denom.expressionType),
337
+ "value": [div]
338
338
  };
339
339
  }
340
340
  return (0, ast_utils_1.errorFor)("divide type mismatch");
@@ -1,15 +1,15 @@
1
+ import { DocumentLocation, DocumentReference, ModelDef, Query, SQLBlockStructDef } from "../../../model/malloy_types";
1
2
  import { MalloyTranslation } from "../../parse-malloy";
2
3
  import { ModelDataRequest } from "../../translate-response";
3
4
  import { DocumentCompileResult } from "./document-compile-result";
4
- import { NameSpace } from "./name-space";
5
5
  import { ModelEntry } from "./model-entry";
6
- import { DocumentLocation, DocumentReference, ModelDef, Query, SQLBlockStructDef } from "../../../model/malloy_types";
6
+ import { NameSpace } from "./name-space";
7
7
  export declare abstract class MalloyElement {
8
8
  abstract elementType: string;
9
9
  codeLocation?: DocumentLocation;
10
10
  children: ElementChildren;
11
11
  parent: MalloyElement | null;
12
- private logger?;
12
+ private readonly logger?;
13
13
  /**
14
14
  * @param kids All children passed to the constructor are not optional
15
15
  */
@@ -30,7 +30,7 @@ export declare abstract class MalloyElement {
30
30
  addReference(reference: DocumentReference): void;
31
31
  private get sourceURL();
32
32
  errorsExist(): boolean;
33
- private logged;
33
+ private readonly logged;
34
34
  log(message: string): void;
35
35
  /**
36
36
  * Mostly for debugging / testing. A string-y version of this object which
@@ -66,11 +66,11 @@ class MalloyElement {
66
66
  return this.parent.location;
67
67
  }
68
68
  return {
69
- url: this.sourceURL,
70
- range: {
71
- start: { line: 0, character: 0 },
72
- end: { line: 0, character: 0 },
73
- },
69
+ "url": this.sourceURL,
70
+ "range": {
71
+ "start": { "line": 0, "character": 0 },
72
+ "end": { "line": 0, "character": 0 }
73
+ }
74
74
  };
75
75
  }
76
76
  set location(loc) {
@@ -92,27 +92,27 @@ class MalloyElement {
92
92
  if (reference instanceof ModelEntryReference) {
93
93
  if ((result === null || result === void 0 ? void 0 : result.entry.type) === "query") {
94
94
  this.addReference({
95
- type: "queryReference",
96
- text: key,
97
- definition: result.entry,
98
- location: reference.location,
95
+ "type": "queryReference",
96
+ "text": key,
97
+ "definition": result.entry,
98
+ "location": reference.location
99
99
  });
100
100
  }
101
101
  else if ((result === null || result === void 0 ? void 0 : result.entry.type) === "struct") {
102
102
  if ((0, malloy_types_1.isSQLBlock)(result.entry)) {
103
103
  this.addReference({
104
- type: "sqlBlockReference",
105
- text: key,
106
- definition: result.entry,
107
- location: reference.location,
104
+ "type": "sqlBlockReference",
105
+ "text": key,
106
+ "definition": result.entry,
107
+ "location": reference.location
108
108
  });
109
109
  }
110
110
  else {
111
111
  this.addReference({
112
- type: "exploreReference",
113
- text: key,
114
- definition: result.entry,
115
- location: reference.location,
112
+ "type": "exploreReference",
113
+ "text": key,
114
+ "definition": result.entry,
115
+ "location": reference.location
116
116
  });
117
117
  }
118
118
  }
@@ -159,7 +159,7 @@ class MalloyElement {
159
159
  this.logged.add(message);
160
160
  }
161
161
  const trans = this.translator();
162
- const msg = { at: this.location, message };
162
+ const msg = { "at": this.location, message };
163
163
  const logTo = trans === null || trans === void 0 ? void 0 : trans.root.logger;
164
164
  if (logTo) {
165
165
  logTo.log(msg);
@@ -332,7 +332,7 @@ class Document extends MalloyElement {
332
332
  this.sqlBlocks = [];
333
333
  this.didInitModel = false;
334
334
  this.statements = new RunList("topLevelStatements", statements);
335
- this.has({ statements });
335
+ this.has({ "statements": statements });
336
336
  }
337
337
  initModelDef(extendingModelDef) {
338
338
  if (this.didInitModel) {
@@ -346,7 +346,7 @@ class Document extends MalloyElement {
346
346
  const struct = extendingModelDef.contents[inName];
347
347
  if (struct.type == "struct") {
348
348
  const exported = extendingModelDef.exports.includes(inName);
349
- this.setEntry(inName, { entry: struct, exported });
349
+ this.setEntry(inName, { "entry": struct, exported });
350
350
  }
351
351
  }
352
352
  }
@@ -355,15 +355,15 @@ class Document extends MalloyElement {
355
355
  compile() {
356
356
  const needs = this.statements.executeList(this);
357
357
  const ret = {
358
- modelDef: this.modelDef(),
359
- queryList: this.queryList,
360
- sqlBlocks: this.sqlBlocks,
361
- needs,
358
+ "modelDef": this.modelDef(),
359
+ "queryList": this.queryList,
360
+ "sqlBlocks": this.sqlBlocks,
361
+ needs
362
362
  };
363
363
  return ret;
364
364
  }
365
365
  modelDef() {
366
- const def = { name: "", exports: [], contents: {} };
366
+ const def = { "name": "", "exports": [], "contents": {} };
367
367
  for (const entry in this.documentModel) {
368
368
  const entryDef = this.documentModel[entry].entry;
369
369
  if (entryDef.type === "struct" || entryDef.type === "query") {
@@ -376,13 +376,13 @@ class Document extends MalloyElement {
376
376
  return def;
377
377
  }
378
378
  defineSQL(sql, name) {
379
- const ret = { ...sql, as: `$${this.sqlBlocks.length}` };
379
+ const ret = { ...sql, "as": `$${this.sqlBlocks.length}` };
380
380
  if (name) {
381
381
  if (this.getEntry(name)) {
382
382
  return false;
383
383
  }
384
384
  ret.as = name;
385
- this.setEntry(name, { entry: ret, sqlType: true });
385
+ this.setEntry(name, { "entry": ret, "sqlType": true });
386
386
  }
387
387
  this.sqlBlocks.push(ret);
388
388
  return true;
@@ -1,4 +1,4 @@
1
- import { StructDef, Query } from "../../../model/malloy_types";
1
+ import { Query, StructDef } from "../../../model/malloy_types";
2
2
  export interface QueryComp {
3
3
  outputStruct: StructDef;
4
4
  query: Query;
@@ -31,7 +31,7 @@ class SpaceField extends space_entry_1.SpaceEntry {
31
31
  this.refType = "field";
32
32
  }
33
33
  fieldTypeFromFieldDef(def) {
34
- const ref = { dataType: def.type, expressionType: "scalar" };
34
+ const ref = { "dataType": def.type, "expressionType": "scalar" };
35
35
  if ((0, malloy_types_1.isFieldTypeDef)(def) && def.expressionType) {
36
36
  ref.expressionType = def.expressionType;
37
37
  }
@@ -41,7 +41,7 @@ class AbstractParameter extends SpaceParam {
41
41
  }
42
42
  typeDesc() {
43
43
  const type = this.astParam.type || "unknown";
44
- return { dataType: type, expressionType: "scalar" };
44
+ return { "dataType": type, "expressionType": "scalar" };
45
45
  }
46
46
  }
47
47
  exports.AbstractParameter = AbstractParameter;
@@ -54,7 +54,7 @@ class DefinedParameter extends SpaceParam {
54
54
  return this.paramDef;
55
55
  }
56
56
  typeDesc() {
57
- return { dataType: this.paramDef.type, expressionType: "scalar" };
57
+ return { "dataType": this.paramDef.type, "expressionType": "scalar" };
58
58
  }
59
59
  }
60
60
  exports.DefinedParameter = DefinedParameter;
@@ -1,5 +1,5 @@
1
- import { FieldName } from "./field-space";
2
1
  import { PipelineDesc } from "../elements/pipeline-desc";
2
+ import { FieldName } from "./field-space";
3
3
  export declare abstract class TurtleHeadedPipe extends PipelineDesc {
4
4
  _turtleName?: FieldName;
5
5
  set turtleName(turtleName: FieldName | undefined);
@@ -27,7 +27,7 @@ const pipeline_desc_1 = require("../elements/pipeline-desc");
27
27
  class TurtleHeadedPipe extends pipeline_desc_1.PipelineDesc {
28
28
  set turtleName(turtleName) {
29
29
  this._turtleName = turtleName;
30
- this.has({ turtleName });
30
+ this.has({ "turtleName": turtleName });
31
31
  }
32
32
  get turtleName() {
33
33
  return this._turtleName;
@@ -1,4 +1,4 @@
1
- import { ExpressionType, AtomicFieldType } from "../../../model/malloy_types";
1
+ import { AtomicFieldType, ExpressionType } from "../../../model/malloy_types";
2
2
  export declare type ExpressionValueType = AtomicFieldType | "null" | "unknown" | "duration" | "regular expression";
3
3
  export declare type FieldValueType = ExpressionValueType | "turtle" | "struct";
4
4
  export interface TypeDesc {
@@ -1,4 +1,4 @@
1
- import { QueryFieldDef, FieldDef } from "../model/malloy_types";
1
+ import { FieldDef, QueryFieldDef } from "../model/malloy_types";
2
2
  declare type Field = QueryFieldDef | FieldDef;
3
3
  export declare function nameOf(qfd: Field): string;
4
4
  export declare function mergeFields<T extends Field>(older: T[] | undefined, newer: T[]): T[];
@@ -1,5 +1,5 @@
1
1
  export { MalloyTranslator } from "./parse-malloy";
2
- export type { UpdateData, SchemaData, URLData, SQLBlockData, } from "./parse-malloy";
2
+ export type { UpdateData, SchemaData, URLData, SQLBlockData } from "./parse-malloy";
3
3
  export type { TranslateResponse } from "./translate-response";
4
4
  export { exploreQueryWalkerBuilder } from "./parse-tree-walkers/explore-query-walker";
5
5
  export type { ExploreClauseRef } from "./parse-tree-walkers/explore-query-walker";
@@ -1,5 +1,5 @@
1
1
  import { ParserRuleContext } from "antlr4ts";
2
- import type { ParseTree } from "antlr4ts/tree";
2
+ import { ParseTree } from "antlr4ts/tree";
3
3
  import { AbstractParseTreeVisitor } from "antlr4ts/tree/AbstractParseTreeVisitor";
4
4
  import { MalloyParserVisitor } from "./lib/Malloy/MalloyParserVisitor";
5
5
  import * as parse from "./lib/Malloy/MalloyParser";
@@ -76,19 +76,19 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
76
76
  * Log an error message relative to an AST node
77
77
  */
78
78
  astError(el, str, sev = "error") {
79
- this.msgLog.log({ message: str, at: el.location, severity: sev });
79
+ this.msgLog.log({ "message": str, "at": el.location, "severity": sev });
80
80
  }
81
81
  /**
82
82
  * Log an error message relative to a parse node
83
83
  */
84
84
  contextError(cx, msg, sev = "error") {
85
85
  this.msgLog.log({
86
- message: msg,
87
- at: {
88
- url: this.parse.subTranslator.sourceURL,
89
- range: this.parse.subTranslator.rangeFromContext(cx),
86
+ "message": msg,
87
+ "at": {
88
+ "url": this.parse.subTranslator.sourceURL,
89
+ "range": this.parse.subTranslator.rangeFromContext(cx)
90
90
  },
91
- severity: sev,
91
+ "severity": sev
92
92
  });
93
93
  }
94
94
  onlyExploreProperties(els) {
@@ -192,8 +192,8 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
192
192
  }
193
193
  astAt(el, cx) {
194
194
  el.location = {
195
- url: this.parse.subTranslator.sourceURL,
196
- range: this.parse.subTranslator.rangeFromContext(cx),
195
+ "url": this.parse.subTranslator.sourceURL,
196
+ "range": this.parse.subTranslator.rangeFromContext(cx)
197
197
  };
198
198
  return el;
199
199
  }
@@ -976,14 +976,14 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
976
976
  visitSampleStatement(pcx) {
977
977
  const rowCx = pcx.sampleSpec().INTEGER_LITERAL();
978
978
  if (rowCx) {
979
- return new ast.SampleProperty({ rows: this.getNumber(rowCx) });
979
+ return new ast.SampleProperty({ "rows": this.getNumber(rowCx) });
980
980
  }
981
981
  const limitCx = pcx.sampleSpec().PERCENT_LITERAL();
982
982
  if (limitCx) {
983
- return new ast.SampleProperty({ percent: this.getNumber(limitCx) });
983
+ return new ast.SampleProperty({ "percent": this.getNumber(limitCx) });
984
984
  }
985
985
  const enabled = pcx.sampleSpec().TRUE() != undefined;
986
- return new ast.SampleProperty({ enable: enabled });
986
+ return new ast.SampleProperty({ "enable": enabled });
987
987
  }
988
988
  }
989
989
  exports.MalloyToAST = MalloyToAST;
@@ -29,13 +29,13 @@ class MalloyParserErrorHandler {
29
29
  this.messages = messages;
30
30
  }
31
31
  syntaxError(recognizer, offendingSymbol, line, charPositionInLine, msg, _e) {
32
- const errAt = { line: line - 1, character: charPositionInLine };
32
+ const errAt = { "line": line - 1, "character": charPositionInLine };
33
33
  const range = offendingSymbol
34
34
  ? this.translator.rangeFromToken(offendingSymbol)
35
- : { start: errAt, end: errAt };
35
+ : { "start": errAt, "end": errAt };
36
36
  const error = {
37
- message: msg,
38
- at: { url: this.translator.sourceURL, range },
37
+ "message": msg,
38
+ "at": { "url": this.translator.sourceURL, range }
39
39
  };
40
40
  this.messages.log(error);
41
41
  }
@@ -1,10 +1,10 @@
1
- import { Token, CommonTokenStream, ParserRuleContext, CodePointCharStream } from "antlr4ts";
2
- import type { ParseTree } from "antlr4ts/tree";
3
- import { Query, NamedStructDefs, StructDef, ModelDef, DocumentReference, DocumentPosition, DocumentLocation, DocumentRange, SQLBlockStructDef } from "../model/malloy_types";
1
+ import { CodePointCharStream, CommonTokenStream, ParserRuleContext, Token } from "antlr4ts";
2
+ import { ParseTree } from "antlr4ts/tree";
3
+ import { DocumentLocation, DocumentPosition, DocumentRange, DocumentReference, ModelDef, NamedStructDefs, Query, SQLBlockStructDef, StructDef } from "../model/malloy_types";
4
4
  import { MessageLog } from "./parse-log";
5
5
  import { Zone, ZoneData } from "./zone";
6
6
  import { ReferenceList } from "./reference-list";
7
- import { ErrorResponse, NeedURLData, FinalResponse, DataRequestResponse, ASTResponse, MetadataResponse, CompletionsResponse, HelpContextResponse, TranslateResponse, FatalResponse, ModelDataRequest } from "./translate-response";
7
+ import { ASTResponse, CompletionsResponse, DataRequestResponse, ErrorResponse, FatalResponse, FinalResponse, HelpContextResponse, MetadataResponse, ModelDataRequest, NeedURLData, TranslateResponse } from "./translate-response";
8
8
  export declare type StepResponses = DataRequestResponse | ASTResponse | TranslateResponse | ParseResponse | MetadataResponse;
9
9
  /**
10
10
  * A Translation is a series of translation steps. Each step can depend