@malloydata/malloy 0.0.22-dev230126015148 → 0.0.22-dev230202171033

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 (307) hide show
  1. package/dist/lang/ast/ast-main.d.ts +18 -815
  2. package/dist/lang/ast/ast-main.js +106 -3241
  3. package/dist/lang/ast/ast-utils.d.ts +10 -0
  4. package/dist/lang/ast/ast-utils.js +42 -0
  5. package/dist/lang/ast/elements/define-explore.d.ts +17 -0
  6. package/dist/lang/ast/elements/define-explore.js +79 -0
  7. package/dist/lang/ast/elements/define-query.d.ts +14 -0
  8. package/dist/lang/ast/elements/define-query.js +56 -0
  9. package/dist/lang/ast/elements/mallobj.d.ts +12 -0
  10. package/dist/lang/ast/elements/mallobj.js +53 -0
  11. package/dist/lang/ast/elements/pipeline-desc.d.ts +28 -0
  12. package/dist/lang/ast/elements/pipeline-desc.js +102 -0
  13. package/dist/lang/ast/elements/refined-explore.d.ts +15 -0
  14. package/dist/lang/ast/elements/refined-explore.js +121 -0
  15. package/dist/lang/ast/error-factory.d.ts +9 -0
  16. package/dist/lang/ast/error-factory.js +61 -0
  17. package/dist/lang/ast/executors/index-executor.d.ts +18 -0
  18. package/dist/lang/ast/executors/index-executor.js +96 -0
  19. package/dist/lang/ast/executors/project-executor.d.ts +10 -0
  20. package/dist/lang/ast/executors/project-executor.js +68 -0
  21. package/dist/lang/ast/executors/reduce-executor.d.ts +20 -0
  22. package/dist/lang/ast/executors/reduce-executor.js +149 -0
  23. package/dist/lang/ast/explore-properties/field-list-edit.d.ts +8 -0
  24. package/dist/lang/ast/explore-properties/field-list-edit.js +36 -0
  25. package/dist/lang/ast/explore-properties/primary-key.d.ts +7 -0
  26. package/dist/lang/ast/{apply-expr.js → explore-properties/primary-key.js} +9 -8
  27. package/dist/lang/ast/explore-properties/renames.d.ts +11 -0
  28. package/dist/lang/ast/explore-properties/renames.js +43 -0
  29. package/dist/lang/ast/explore-properties/turtles.d.ts +5 -0
  30. package/dist/lang/ast/explore-properties/turtles.js +33 -0
  31. package/dist/lang/ast/expressions/apply.d.ts +8 -0
  32. package/dist/lang/ast/expressions/apply.js +37 -0
  33. package/dist/lang/ast/expressions/binary-boolean.d.ts +12 -0
  34. package/dist/lang/ast/expressions/binary-boolean.js +54 -0
  35. package/dist/lang/ast/expressions/binary-numeric.d.ts +11 -0
  36. package/dist/lang/ast/expressions/binary-numeric.js +42 -0
  37. package/dist/lang/ast/expressions/boolean.d.ts +8 -0
  38. package/dist/lang/ast/expressions/boolean.js +39 -0
  39. package/dist/lang/ast/expressions/constant-sub-expression.d.ts +16 -0
  40. package/dist/lang/ast/expressions/constant-sub-expression.js +98 -0
  41. package/dist/lang/ast/expressions/expr-add-sub.d.ts +4 -0
  42. package/dist/lang/ast/expressions/expr-add-sub.js +34 -0
  43. package/dist/lang/ast/expressions/expr-aggregate-function.d.ts +15 -0
  44. package/dist/lang/ast/expressions/expr-aggregate-function.js +99 -0
  45. package/dist/lang/ast/expressions/expr-alternation-tree.d.ts +11 -0
  46. package/dist/lang/ast/expressions/expr-alternation-tree.js +54 -0
  47. package/dist/lang/ast/expressions/expr-asymmetric.d.ts +10 -0
  48. package/dist/lang/ast/expressions/expr-asymmetric.js +27 -0
  49. package/dist/lang/ast/expressions/expr-avg.d.ts +6 -0
  50. package/dist/lang/ast/expressions/expr-avg.js +34 -0
  51. package/dist/lang/ast/expressions/expr-case.d.ts +11 -0
  52. package/dist/lang/ast/expressions/expr-case.js +84 -0
  53. package/dist/lang/ast/expressions/expr-cast.d.ts +13 -0
  54. package/dist/lang/ast/expressions/expr-cast.js +29 -0
  55. package/dist/lang/ast/expressions/expr-compare.d.ts +10 -0
  56. package/dist/lang/ast/expressions/expr-compare.js +48 -0
  57. package/dist/lang/ast/expressions/expr-count-distinct.d.ts +6 -0
  58. package/dist/lang/ast/expressions/expr-count-distinct.js +35 -0
  59. package/dist/lang/ast/expressions/expr-count.d.ts +11 -0
  60. package/dist/lang/ast/expressions/expr-count.js +57 -0
  61. package/dist/lang/ast/expressions/expr-filter.d.ts +12 -0
  62. package/dist/lang/ast/expressions/expr-filter.js +69 -0
  63. package/dist/lang/ast/expressions/expr-func.d.ts +10 -0
  64. package/dist/lang/ast/expressions/expr-func.js +63 -0
  65. package/dist/lang/ast/expressions/expr-granular-time.d.ts +24 -0
  66. package/dist/lang/ast/expressions/expr-granular-time.js +117 -0
  67. package/dist/lang/ast/expressions/expr-id-reference.d.ts +12 -0
  68. package/dist/lang/ast/expressions/expr-id-reference.js +76 -0
  69. package/dist/lang/ast/expressions/expr-logical-op.d.ts +9 -0
  70. package/dist/lang/ast/expressions/expr-logical-op.js +36 -0
  71. package/dist/lang/ast/expressions/expr-max.d.ts +9 -0
  72. package/dist/lang/ast/expressions/expr-max.js +16 -0
  73. package/dist/lang/ast/expressions/expr-min.d.ts +9 -0
  74. package/dist/lang/ast/expressions/expr-min.js +16 -0
  75. package/dist/lang/ast/expressions/expr-minus.d.ts +9 -0
  76. package/dist/lang/ast/expressions/expr-minus.js +48 -0
  77. package/dist/lang/ast/expressions/expr-mul-div.d.ts +4 -0
  78. package/dist/lang/ast/expressions/expr-mul-div.js +34 -0
  79. package/dist/lang/ast/expressions/expr-not.d.ts +10 -0
  80. package/dist/lang/ast/expressions/expr-not.js +49 -0
  81. package/dist/lang/ast/expressions/expr-now.d.ts +7 -0
  82. package/dist/lang/ast/expressions/expr-now.js +46 -0
  83. package/dist/lang/ast/expressions/expr-null.d.ts +6 -0
  84. package/dist/lang/ast/expressions/expr-null.js +41 -0
  85. package/dist/lang/ast/expressions/expr-number.d.ts +10 -0
  86. package/dist/lang/ast/expressions/expr-number.js +42 -0
  87. package/dist/lang/ast/expressions/expr-parens.d.ts +10 -0
  88. package/dist/lang/ast/expressions/expr-parens.js +42 -0
  89. package/dist/lang/ast/expressions/expr-regex.d.ts +8 -0
  90. package/dist/lang/ast/expressions/expr-regex.js +42 -0
  91. package/dist/lang/ast/expressions/expr-string.d.ts +9 -0
  92. package/dist/lang/ast/expressions/expr-string.js +50 -0
  93. package/dist/lang/ast/expressions/expr-sum.d.ts +6 -0
  94. package/dist/lang/ast/expressions/expr-sum.js +12 -0
  95. package/dist/lang/ast/expressions/expr-time-extract.d.ts +13 -0
  96. package/dist/lang/ast/expressions/expr-time-extract.js +117 -0
  97. package/dist/lang/ast/expressions/expr-time.d.ts +11 -0
  98. package/dist/lang/ast/expressions/expr-time.js +62 -0
  99. package/dist/lang/ast/expressions/expr-ungroup.d.ts +14 -0
  100. package/dist/lang/ast/expressions/expr-ungroup.js +83 -0
  101. package/dist/lang/ast/expressions/for-range.d.ts +19 -0
  102. package/dist/lang/ast/expressions/for-range.js +101 -0
  103. package/dist/lang/ast/expressions/granular-literal.d.ts +20 -0
  104. package/dist/lang/ast/expressions/granular-literal.js +148 -0
  105. package/dist/lang/ast/expressions/partial-compare.d.ts +14 -0
  106. package/dist/lang/ast/expressions/partial-compare.js +50 -0
  107. package/dist/lang/ast/expressions/pick-when.d.ts +19 -0
  108. package/dist/lang/ast/expressions/pick-when.js +156 -0
  109. package/dist/lang/ast/expressions/range.d.ts +12 -0
  110. package/dist/lang/ast/expressions/range.js +80 -0
  111. package/dist/lang/ast/expressions/time-frame.d.ts +7 -0
  112. package/dist/lang/ast/expressions/time-frame.js +40 -0
  113. package/dist/lang/ast/expressions/top-by.d.ts +10 -0
  114. package/dist/lang/ast/expressions/top-by.js +51 -0
  115. package/dist/lang/ast/expressions/unary.d.ts +5 -0
  116. package/dist/lang/ast/expressions/unary.js +34 -0
  117. package/dist/lang/ast/expressions/utils.d.ts +15 -0
  118. package/dist/lang/ast/expressions/utils.js +106 -0
  119. package/dist/lang/ast/expressions/when-clause.d.ts +10 -0
  120. package/dist/lang/ast/expressions/when-clause.js +17 -0
  121. package/dist/lang/ast/fragtype-utils.d.ts +39 -0
  122. package/dist/lang/ast/fragtype-utils.js +100 -0
  123. package/dist/lang/ast/import-elements/import-statement.d.ts +9 -0
  124. package/dist/lang/ast/import-elements/import-statement.js +78 -0
  125. package/dist/lang/ast/index.d.ts +94 -3
  126. package/dist/lang/ast/index.js +94 -3
  127. package/dist/lang/ast/json-elements/json-element.d.ts +6 -0
  128. package/dist/lang/ast/json-elements/json-element.js +41 -0
  129. package/dist/lang/ast/json-elements/json-struct-def.d.ts +10 -0
  130. package/dist/lang/ast/json-elements/json-struct-def.js +48 -0
  131. package/dist/lang/ast/nesting/nest-reference.d.ts +7 -0
  132. package/dist/lang/ast/nesting/nest-reference.js +35 -0
  133. package/dist/lang/ast/parameters/constant-parameter.d.ts +8 -0
  134. package/dist/lang/ast/parameters/constant-parameter.js +54 -0
  135. package/dist/lang/ast/parameters/has-parameter.d.ts +19 -0
  136. package/dist/lang/ast/parameters/has-parameter.js +64 -0
  137. package/dist/lang/ast/query-elements/anonymous-query.d.ts +9 -0
  138. package/dist/lang/ast/query-elements/anonymous-query.js +41 -0
  139. package/dist/lang/ast/query-elements/existing-query.d.ts +11 -0
  140. package/dist/lang/ast/query-elements/existing-query.js +79 -0
  141. package/dist/lang/ast/query-elements/full-query.d.ts +10 -0
  142. package/dist/lang/ast/query-elements/full-query.js +85 -0
  143. package/dist/lang/ast/query-elements/query-head-struct.d.ts +9 -0
  144. package/dist/lang/ast/query-elements/query-head-struct.js +48 -0
  145. package/dist/lang/ast/query-items/field-declaration.d.ts +31 -0
  146. package/dist/lang/ast/query-items/field-declaration.js +137 -0
  147. package/dist/lang/ast/query-items/field-references.d.ts +25 -0
  148. package/dist/lang/ast/query-items/field-references.js +80 -0
  149. package/dist/lang/ast/query-properties/aggregate.d.ts +5 -0
  150. package/dist/lang/ast/query-properties/aggregate.js +39 -0
  151. package/dist/lang/ast/query-properties/declare-fields.d.ts +5 -0
  152. package/dist/lang/ast/query-properties/declare-fields.js +33 -0
  153. package/dist/lang/ast/query-properties/dimmensions.d.ts +5 -0
  154. package/dist/lang/ast/query-properties/dimmensions.js +36 -0
  155. package/dist/lang/ast/query-properties/filters.d.ts +18 -0
  156. package/dist/lang/ast/query-properties/filters.js +89 -0
  157. package/dist/lang/ast/query-properties/group-by.d.ts +5 -0
  158. package/dist/lang/ast/query-properties/group-by.js +39 -0
  159. package/dist/lang/ast/query-properties/indexing.d.ts +10 -0
  160. package/dist/lang/ast/query-properties/indexing.js +39 -0
  161. package/dist/lang/ast/query-properties/joins.d.ts +36 -0
  162. package/dist/lang/ast/query-properties/joins.js +143 -0
  163. package/dist/lang/ast/query-properties/limit.d.ts +6 -0
  164. package/dist/lang/ast/query-properties/limit.js +35 -0
  165. package/dist/lang/ast/query-properties/measures.d.ts +5 -0
  166. package/dist/lang/ast/query-properties/measures.js +36 -0
  167. package/dist/lang/ast/query-properties/nests.d.ts +5 -0
  168. package/dist/lang/ast/query-properties/nests.js +33 -0
  169. package/dist/lang/ast/query-properties/ordering.d.ts +15 -0
  170. package/dist/lang/ast/query-properties/ordering.js +66 -0
  171. package/dist/lang/ast/query-properties/project-statement.d.ts +5 -0
  172. package/dist/lang/ast/query-properties/project-statement.js +33 -0
  173. package/dist/lang/ast/query-properties/qop-desc.d.ts +17 -0
  174. package/dist/lang/ast/query-properties/qop-desc.js +123 -0
  175. package/dist/lang/ast/query-properties/sampling.d.ts +8 -0
  176. package/dist/lang/ast/query-properties/sampling.js +38 -0
  177. package/dist/lang/ast/query-properties/top.d.ts +13 -0
  178. package/dist/lang/ast/query-properties/top.js +60 -0
  179. package/dist/lang/ast/result-spaces/index-field-space.d.ts +10 -0
  180. package/dist/lang/ast/result-spaces/index-field-space.js +57 -0
  181. package/dist/lang/ast/result-spaces/project-field-space.d.ts +6 -0
  182. package/dist/lang/ast/result-spaces/project-field-space.js +51 -0
  183. package/dist/lang/ast/result-spaces/reduce-field-space.d.ts +7 -0
  184. package/dist/lang/ast/result-spaces/reduce-field-space.js +37 -0
  185. package/dist/lang/ast/sources/named-source.d.ts +19 -0
  186. package/dist/lang/ast/sources/named-source.js +147 -0
  187. package/dist/lang/ast/sources/query-source.d.ts +9 -0
  188. package/dist/lang/ast/sources/query-source.js +41 -0
  189. package/dist/lang/ast/sources/sql-source.d.ts +7 -0
  190. package/dist/lang/ast/sources/sql-source.js +54 -0
  191. package/dist/lang/ast/sources/table-source.d.ts +8 -0
  192. package/dist/lang/ast/sources/table-source.js +60 -0
  193. package/dist/lang/ast/space-fields/column-space-field.d.ts +9 -0
  194. package/dist/lang/ast/space-fields/column-space-field.js +40 -0
  195. package/dist/lang/ast/space-fields/join-space-field.d.ts +8 -0
  196. package/dist/lang/ast/space-fields/join-space-field.js +35 -0
  197. package/dist/lang/ast/space-fields/query-field-struct.d.ts +10 -0
  198. package/dist/lang/ast/space-fields/query-field-struct.js +46 -0
  199. package/dist/lang/ast/space-fields/query-space-field.d.ts +11 -0
  200. package/dist/lang/ast/space-fields/query-space-field.js +37 -0
  201. package/dist/lang/ast/space-fields/reference-field.d.ts +11 -0
  202. package/dist/lang/ast/space-fields/reference-field.js +45 -0
  203. package/dist/lang/ast/space-fields/rename-space-field.d.ts +11 -0
  204. package/dist/lang/ast/space-fields/rename-space-field.js +50 -0
  205. package/dist/lang/ast/space-fields/wild-space-field.d.ts +10 -0
  206. package/dist/lang/ast/space-fields/wild-space-field.js +40 -0
  207. package/dist/lang/ast/space-parameters/abstract-parameter.d.ts +10 -0
  208. package/dist/lang/ast/space-parameters/abstract-parameter.js +41 -0
  209. package/dist/lang/ast/space-parameters/defined-parameter.d.ts +9 -0
  210. package/dist/lang/ast/space-parameters/defined-parameter.js +40 -0
  211. package/dist/lang/ast/space-seed.d.ts +17 -0
  212. package/dist/lang/ast/space-seed.js +59 -0
  213. package/dist/lang/ast/sql-elements/sql-statement.d.ts +19 -0
  214. package/dist/lang/ast/sql-elements/sql-statement.js +80 -0
  215. package/dist/lang/ast/sql-elements/sql-string.d.ts +12 -0
  216. package/dist/lang/ast/sql-elements/sql-string.js +60 -0
  217. package/dist/lang/ast/static-space.d.ts +33 -0
  218. package/dist/lang/ast/static-space.js +167 -0
  219. package/dist/lang/ast/struct-utils.d.ts +4 -0
  220. package/dist/lang/ast/struct-utils.js +48 -0
  221. package/dist/lang/ast/time-utils.d.ts +5 -2
  222. package/dist/lang/ast/time-utils.js +37 -1
  223. package/dist/lang/ast/types/comparison.d.ts +11 -0
  224. package/dist/lang/ast/types/comparison.js +41 -0
  225. package/dist/lang/ast/types/compart-types.d.ts +10 -0
  226. package/dist/lang/ast/types/compart-types.js +37 -0
  227. package/dist/lang/ast/types/document-compile-result.d.ts +8 -0
  228. package/dist/lang/ast/types/document-compile-result.js +25 -0
  229. package/dist/lang/ast/types/equality.d.ts +7 -0
  230. package/dist/lang/ast/types/equality.js +37 -0
  231. package/dist/lang/ast/types/executor.d.ts +9 -0
  232. package/dist/lang/ast/types/executor.js +25 -0
  233. package/dist/lang/ast/types/explore-desc.d.ts +5 -0
  234. package/dist/lang/ast/types/explore-desc.js +33 -0
  235. package/dist/lang/ast/types/explore-field.d.ts +5 -0
  236. package/dist/lang/ast/types/explore-field.js +32 -0
  237. package/dist/lang/ast/types/explore-property.d.ts +10 -0
  238. package/dist/lang/ast/types/explore-property.js +43 -0
  239. package/dist/lang/ast/types/expr-result.d.ts +5 -0
  240. package/dist/lang/ast/types/expr-result.js +25 -0
  241. package/dist/lang/ast/types/expr-value.d.ts +3 -0
  242. package/dist/lang/ast/types/expr-value.js +25 -0
  243. package/dist/lang/ast/types/expression-def.d.ts +69 -0
  244. package/dist/lang/ast/types/expression-def.js +346 -0
  245. package/dist/lang/ast/types/expression-value-type.d.ts +2 -0
  246. package/dist/lang/ast/types/expression-value-type.js +25 -0
  247. package/dist/lang/ast/types/field-collection-member.d.ts +5 -0
  248. package/dist/lang/ast/types/field-collection-member.js +34 -0
  249. package/dist/lang/ast/types/field-decl.d.ts +7 -0
  250. package/dist/lang/ast/types/field-decl.js +37 -0
  251. package/dist/lang/ast/types/field-map.d.ts +2 -0
  252. package/dist/lang/ast/types/field-map.js +25 -0
  253. package/dist/lang/ast/types/field-space.d.ts +26 -0
  254. package/dist/lang/ast/types/field-space.js +48 -0
  255. package/dist/lang/ast/types/field-type.d.ts +6 -0
  256. package/dist/lang/ast/types/field-type.js +25 -0
  257. package/dist/lang/ast/types/field-value-type.d.ts +3 -0
  258. package/dist/lang/ast/types/field-value-type.js +25 -0
  259. package/dist/lang/ast/types/frag-type.d.ts +6 -0
  260. package/dist/lang/ast/types/frag-type.js +25 -0
  261. package/dist/lang/ast/types/granular-result.d.ts +7 -0
  262. package/dist/lang/ast/types/granular-result.js +11 -0
  263. package/dist/lang/ast/types/lookup-result.d.ts +10 -0
  264. package/dist/lang/ast/types/lookup-result.js +25 -0
  265. package/dist/lang/ast/types/malloy-element.d.ts +105 -0
  266. package/dist/lang/ast/types/malloy-element.js +398 -0
  267. package/dist/lang/ast/types/model-entry.d.ts +6 -0
  268. package/dist/lang/ast/types/model-entry.js +25 -0
  269. package/dist/lang/ast/types/name-space.d.ts +5 -0
  270. package/dist/lang/ast/types/name-space.js +25 -0
  271. package/dist/lang/ast/types/nested-query.d.ts +3 -0
  272. package/dist/lang/ast/types/nested-query.js +25 -0
  273. package/dist/lang/ast/types/op-desc.d.ts +6 -0
  274. package/dist/lang/ast/types/op-desc.js +25 -0
  275. package/dist/lang/ast/types/query-comp.d.ts +5 -0
  276. package/dist/lang/ast/types/query-comp.js +25 -0
  277. package/dist/lang/ast/types/query-element.d.ts +5 -0
  278. package/dist/lang/ast/types/query-element.js +32 -0
  279. package/dist/lang/ast/types/query-item.d.ts +5 -0
  280. package/dist/lang/ast/types/query-item.js +25 -0
  281. package/dist/lang/ast/types/query-property.d.ts +17 -0
  282. package/dist/lang/ast/types/query-property.js +55 -0
  283. package/dist/lang/ast/types/space-entry.d.ts +5 -0
  284. package/dist/lang/ast/types/space-entry.js +29 -0
  285. package/dist/lang/ast/types/space-field.d.ts +10 -0
  286. package/dist/lang/ast/types/space-field.js +48 -0
  287. package/dist/lang/ast/types/space-param.d.ts +6 -0
  288. package/dist/lang/ast/types/space-param.js +34 -0
  289. package/dist/lang/ast/types/stage-field-type.d.ts +1 -0
  290. package/dist/lang/ast/types/stage-field-type.js +25 -0
  291. package/dist/lang/ast/types/time-result.d.ts +6 -0
  292. package/dist/lang/ast/types/time-result.js +25 -0
  293. package/dist/lang/ast/types/turtle-headed-pipe.d.ts +7 -0
  294. package/dist/lang/ast/types/turtle-headed-pipe.js +37 -0
  295. package/dist/lang/space-field.d.ts +4 -1
  296. package/dist/lang/space-field.js +4 -3
  297. package/dist/lang/test/field-symbols.spec.js +25 -21
  298. package/dist/lang/test/parse.spec.js +4 -3
  299. package/dist/lang/test/test-translator.d.ts +3 -1
  300. package/package.json +1 -1
  301. package/dist/lang/ast/apply-expr.d.ts +0 -3
  302. package/dist/lang/ast/ast-expr.d.ts +0 -206
  303. package/dist/lang/ast/ast-expr.js +0 -781
  304. package/dist/lang/ast/ast-time-expr.d.ts +0 -69
  305. package/dist/lang/ast/ast-time-expr.js +0 -389
  306. package/dist/lang/ast/ast-types.d.ts +0 -83
  307. package/dist/lang/ast/ast-types.js +0 -225
@@ -1,416 +1,28 @@
1
1
  import * as model from "../../model/malloy_types";
2
- import { Dialect } from "../../dialect/dialect";
3
- import { AtomicFieldType, ExpressionType, FieldTypeDef, Fragment, TimeFieldType, TimestampUnit } from "../../model/malloy_types";
4
- import { MalloyTranslation, ModelDataRequest } from "../parse-malloy";
5
- import { Comparison, ExprValue, FieldValueType } from "./ast-types";
6
- export declare class ErrorFactory {
7
- static get structDef(): model.StructDef;
8
- static isErrorStructDef(s: model.StructDef): boolean;
9
- static get query(): model.Query;
10
- static get reduceSegment(): model.ReduceSegment;
11
- static get projectSegment(): model.ProjectSegment;
12
- static get indexSegment(): model.IndexSegment;
13
- }
14
- declare type ChildBody = MalloyElement | MalloyElement[];
15
- declare type ElementChildren = Record<string, ChildBody>;
16
- export declare abstract class MalloyElement {
17
- abstract elementType: string;
18
- codeLocation?: model.DocumentLocation;
19
- children: ElementChildren;
20
- parent: MalloyElement | null;
21
- private logger?;
22
- /**
23
- * @param kids All children passed to the constructor are not optional
24
- */
25
- constructor(kids?: ElementChildren);
26
- /**
27
- * Record all elements as children of this element, and mark this
28
- * element as their parent.
29
- * @param kids Some of these might be undefined, in which case they are ignored
30
- */
31
- has(kids: Record<string, ChildBody | undefined>): void;
32
- get location(): model.DocumentLocation;
33
- set location(loc: model.DocumentLocation | undefined);
34
- protected namespace(): NameSpace | undefined;
35
- modelEntry(reference: string | ModelEntryReference): ModelEntry | undefined;
36
- private xlate?;
37
- translator(): MalloyTranslation | undefined;
38
- setTranslator(x: MalloyTranslation): void;
39
- addReference(reference: model.DocumentReference): void;
40
- private get sourceURL();
41
- errorsExist(): boolean;
42
- private logged;
43
- log(message: string): void;
44
- /**
45
- * Mostly for debugging / testing. A string-y version of this object which
46
- * is used to ask "are these two AST segments equal". Formatted so that
47
- * errors would be human readable.
48
- * @param indent only used for recursion
49
- */
50
- toString(): string;
51
- private stringify;
52
- walk(callBack: (node: MalloyElement) => void): void;
53
- private varInfo;
54
- protected internalError(msg: string): Error;
55
- }
56
- export declare class ListOf<ET extends MalloyElement> extends MalloyElement {
57
- elementType: string;
58
- protected elements: ET[];
59
- constructor(listDesc: string, elements: ET[]);
60
- private newContents;
61
- get list(): ET[];
62
- empty(): boolean;
63
- notEmpty(): boolean;
64
- push(...el: ET[]): ET[];
65
- }
66
- export declare class Unimplemented extends MalloyElement {
67
- elementType: string;
68
- reported: boolean;
69
- }
70
- declare type FieldDecl = FieldDeclaration | Join | TurtleDecl | Turtles;
71
- export declare type ExploreField = FieldDecl | RenameField;
72
- export declare function isExploreField(f: MalloyElement): f is ExploreField;
73
- /**
74
- * A "Mallobj" is a thing which you can run queries against, it has been called
75
- * an "exploreable", or a "space".
76
- */
77
- export declare abstract class Mallobj extends MalloyElement {
78
- abstract structDef(): model.StructDef;
79
- structRef(): model.StructRef;
80
- withParameters(pList: HasParameter[] | undefined): model.StructDef;
81
- }
82
- export interface DocStatement extends MalloyElement {
83
- execute(doc: Document): ModelDataRequest;
84
- }
85
- export declare class RunList extends ListOf<DocStatement> {
86
- execCursor: number;
87
- executeList(doc: Document): ModelDataRequest;
88
- }
89
- export declare function isDocStatement(e: MalloyElement): e is DocStatement;
90
- export declare class DefineExplore extends MalloyElement implements DocStatement {
91
- readonly name: string;
92
- readonly mallobj: Mallobj;
93
- readonly exported: boolean;
94
- elementType: string;
95
- readonly parameters?: HasParameter[];
96
- constructor(name: string, mallobj: Mallobj, exported: boolean, params?: MalloyElement[]);
97
- execute(doc: Document): ModelDataRequest;
98
- }
99
- export declare class DefineSourceList extends RunList implements DocStatement {
100
- constructor(sourceList: DefineExplore[]);
101
- execute(doc: Document): ModelDataRequest;
102
- }
103
- /**
104
- * A Mallobj made from a source and a set of refinements
105
- */
106
- export declare class RefinedExplore extends Mallobj {
107
- readonly source: Mallobj;
108
- readonly refinement: ExploreDesc;
109
- elementType: string;
110
- constructor(source: Mallobj, refinement: ExploreDesc);
111
- structDef(): model.StructDef;
112
- withParameters(pList: HasParameter[] | undefined): model.StructDef;
113
- }
114
- export declare class TableSource extends Mallobj {
115
- readonly name: string;
116
- elementType: string;
117
- constructor(name: string);
118
- structDef(): model.StructDef;
119
- }
120
- export declare class IsValueBlock extends MalloyElement {
121
- readonly isMap: Record<string, ConstantSubExpression>;
122
- elementType: string;
123
- constructor(isMap: Record<string, ConstantSubExpression>);
124
- }
125
- export declare class ModelEntryReference extends MalloyElement {
126
- readonly name: string;
127
- elementType: string;
128
- constructor(name: string);
129
- get refString(): string;
130
- toString(): string;
131
- }
132
- export declare class NamedSource extends Mallobj {
133
- readonly ref: ModelEntryReference | string;
134
- elementType: string;
135
- protected isBlock?: IsValueBlock;
136
- constructor(ref: ModelEntryReference | string, paramValues?: Record<string, ConstantSubExpression>);
137
- get refName(): string;
138
- structRef(): model.StructRef;
139
- modelStruct(): model.StructDef | undefined;
140
- structDef(): model.StructDef;
141
- }
142
- export declare class SQLSource extends NamedSource {
143
- elementType: string;
144
- structRef(): model.StructRef;
145
- modelStruct(): model.StructDef | undefined;
146
- }
147
- export declare class QuerySource extends Mallobj {
148
- readonly query: QueryElement;
149
- elementType: string;
150
- constructor(query: QueryElement);
151
- structDef(): model.StructDef;
152
- }
153
- export declare abstract class Join extends MalloyElement {
154
- abstract name: ModelEntryReference;
155
- abstract structDef(): model.StructDef;
156
- abstract fixupJoinOn(outer: FieldSpace, inStruct: model.StructDef): void;
157
- }
158
- export declare class KeyJoin extends Join {
159
- readonly name: ModelEntryReference;
160
- readonly source: Mallobj;
161
- readonly keyExpr: ExpressionDef;
162
- elementType: string;
163
- constructor(name: ModelEntryReference, source: Mallobj, keyExpr: ExpressionDef);
164
- structDef(): model.StructDef;
165
- fixupJoinOn(outer: FieldSpace, inStruct: model.StructDef): void;
166
- }
167
- declare type ExpressionJoinType = "many" | "one" | "cross";
168
- export declare class ExpressionJoin extends Join {
169
- readonly name: ModelEntryReference;
170
- readonly source: Mallobj;
171
- elementType: string;
172
- joinType: ExpressionJoinType;
173
- private expr?;
174
- constructor(name: ModelEntryReference, source: Mallobj);
175
- set joinOn(joinExpr: ExpressionDef | undefined);
176
- get joinOn(): ExpressionDef | undefined;
177
- fixupJoinOn(outer: FieldSpace, inStruct: model.StructDef): model.Expr | undefined;
178
- structDef(): model.StructDef;
179
- }
180
- export declare class Joins extends ListOf<Join> {
181
- constructor(joins: Join[]);
182
- }
183
- export declare type QueryProperty = Ordering | Top | Limit | Filter | Index | SampleProperty | Joins | DeclareFields | ProjectStatement | NestReference | NestDefinition | NestReference | Nests | Aggregate | GroupBy;
184
- export declare function isQueryProperty(q: MalloyElement): q is QueryProperty;
185
- export declare type ExploreProperty = Filter | Joins | DeclareFields | FieldListEdit | Renames | PrimaryKey | Turtles;
186
- export declare function isExploreProperty(p: MalloyElement): p is ExploreProperty;
187
- export declare class ExploreDesc extends ListOf<ExploreProperty> {
188
- constructor(props: ExploreProperty[]);
189
- }
190
- export declare class FilterElement extends MalloyElement {
191
- readonly expr: ExpressionDef;
192
- readonly exprSrc: string;
193
- elementType: string;
194
- constructor(expr: ExpressionDef, exprSrc: string);
195
- filterExpression(fs: FieldSpace): model.FilterExpression;
196
- }
197
- export declare class Filter extends ListOf<FilterElement> {
198
- elementType: string;
199
- private havingClause?;
200
- constructor(elements?: FilterElement[]);
201
- set having(isHaving: boolean);
202
- getFilterList(fs: FieldSpace): model.FilterExpression[];
203
- }
204
- export declare class DeclareFields extends ListOf<FieldDeclaration> {
205
- constructor(fields: FieldDeclaration[], fieldType?: string);
206
- }
207
- export declare class Measures extends DeclareFields {
208
- constructor(measures: FieldDeclaration[]);
209
- }
210
- export declare class Dimensions extends DeclareFields {
211
- constructor(dimensions: FieldDeclaration[]);
212
- }
213
- export declare class Renames extends ListOf<RenameField> {
214
- constructor(renames: RenameField[]);
215
- }
216
- export declare class FieldName extends MalloyElement {
217
- readonly name: string;
218
- elementType: string;
219
- constructor(name: string);
220
- get refString(): string;
221
- toString(): string;
222
- getField(fs: FieldSpace): LookupResult;
223
- }
224
- export declare class FieldReference extends ListOf<FieldName> {
225
- elementType: string;
226
- constructor(names: FieldName[]);
227
- get refString(): string;
228
- get outputName(): string;
229
- get sourceString(): string | undefined;
230
- get nameString(): string;
231
- getField(fs: FieldSpace): LookupResult;
232
- }
233
- export declare type FieldReferenceElement = FieldReference | WildcardFieldReference;
234
- export declare class FieldReferences extends ListOf<FieldReferenceElement> {
235
- constructor(members: FieldReferenceElement[]);
236
- }
237
- export declare type FieldCollectionMember = FieldReferenceElement | FieldDeclaration;
238
- export declare function isFieldCollectionMember(el: MalloyElement): el is FieldCollectionMember;
239
- export declare class ProjectStatement extends ListOf<FieldCollectionMember> {
240
- constructor(members: FieldCollectionMember[]);
241
- }
242
- export declare class FieldListEdit extends MalloyElement {
243
- readonly edit: "accept" | "except";
244
- readonly refs: FieldReferences;
245
- elementType: string;
246
- constructor(edit: "accept" | "except", refs: FieldReferences);
247
- }
248
- export declare type QueryItem = FieldDeclaration | FieldReference | NestDefinition | NestReference;
249
- export declare class GroupBy extends ListOf<QueryItem> {
250
- constructor(members: QueryItem[]);
251
- }
252
- export declare class Aggregate extends ListOf<QueryItem> {
253
- constructor(members: QueryItem[]);
254
- }
255
- interface OpDesc {
256
- segment: model.PipeSegment;
257
- outputSpace: () => FieldSpace;
258
- }
259
- declare type QOPType = "grouping" | "aggregate" | "project" | "index";
260
- export declare class QOPDesc extends ListOf<QueryProperty> {
261
- opType: QOPType;
262
- private refineThis?;
263
- constructor(props: QueryProperty[]);
264
- protected computeType(): QOPType;
265
- refineFrom(existing: model.PipeSegment): void;
266
- private getExecutor;
267
- getOp(inputFS: FieldSpace, forPipeline: PipelineDesc | null): OpDesc;
268
- }
269
- export interface ModelEntry {
270
- entry: model.NamedModelObject;
271
- exported?: boolean;
272
- sqlType?: boolean;
273
- }
274
- export interface NameSpace {
275
- getEntry(name: string): ModelEntry | undefined;
276
- setEntry(name: string, value: ModelEntry, exported: boolean): void;
277
- }
278
- interface DocumentCompileResult {
279
- modelDef: model.ModelDef;
280
- queryList: model.Query[];
281
- sqlBlocks: model.SQLBlockStructDef[];
282
- needs: ModelDataRequest;
283
- }
284
- /**
285
- * The Document class is a little weird because we might need to bounce back
286
- * to the requestor, which might be on the other side of a wire, to get
287
- * back some schema information. The intended translation of a Document
288
- * is to call initModelDef(), and then to call modelDataRequest() until it
289
- * returns undefined. At any time you can call modelDef to get the model
290
- * as it exists so far, but the translation is not complete until
291
- * modelDataRequest() returns undefined;
292
- *
293
- * TODO probably modelRequest should be the method and you call it
294
- * until it returns a model with no additional data needed ...
295
- * that can be tomorrow
296
- */
297
- export declare class Document extends MalloyElement implements NameSpace {
298
- elementType: string;
299
- documentModel: Record<string, ModelEntry>;
300
- queryList: model.Query[];
301
- sqlBlocks: model.SQLBlockStructDef[];
302
- statements: RunList;
303
- didInitModel: boolean;
304
- constructor(statements: DocStatement[]);
305
- initModelDef(extendingModelDef: model.ModelDef | undefined): void;
306
- compile(): DocumentCompileResult;
307
- modelDef(): model.ModelDef;
308
- defineSQL(sql: model.SQLBlockStructDef, name?: string): boolean;
309
- getEntry(str: string): ModelEntry;
310
- setEntry(str: string, ent: ModelEntry): void;
311
- }
312
- export declare class PrimaryKey extends MalloyElement {
313
- readonly field: FieldName;
314
- elementType: string;
315
- constructor(field: FieldName);
316
- }
317
- export declare class RenameField extends MalloyElement {
318
- readonly newName: string;
319
- readonly oldName: FieldName;
320
- elementType: string;
321
- constructor(newName: string, oldName: FieldName);
322
- }
323
- export declare class WildcardFieldReference extends MalloyElement {
324
- readonly joinPath: FieldReference | undefined;
325
- readonly star: "*" | "**";
326
- elementType: string;
327
- constructor(joinPath: FieldReference | undefined, star: "*" | "**");
328
- getFieldDef(): model.FieldDef;
329
- get refString(): string;
330
- }
331
- export declare class OrderBy extends MalloyElement {
332
- readonly field: number | FieldName;
333
- readonly dir?: "asc" | "desc" | undefined;
334
- elementType: string;
335
- constructor(field: number | FieldName, dir?: "asc" | "desc" | undefined);
336
- get modelField(): string | number;
337
- getOrderBy(_fs: FieldSpace): model.OrderBy;
338
- }
339
- export declare class Ordering extends ListOf<OrderBy> {
340
- constructor(list: OrderBy[]);
341
- getOrderBy(fs: FieldSpace): model.OrderBy[];
342
- }
343
- export declare class Limit extends MalloyElement {
344
- readonly limit: number;
345
- elementType: string;
346
- constructor(limit: number);
347
- }
348
- export declare class Turtles extends ListOf<TurtleDecl> {
349
- constructor(turtles: TurtleDecl[]);
350
- }
351
- export declare class Index extends MalloyElement {
352
- readonly fields: FieldReferences;
353
- elementType: string;
354
- weightBy?: FieldName;
355
- constructor(fields: FieldReferences);
356
- useWeight(fn: FieldName): void;
357
- }
358
- interface QueryComp {
359
- outputStruct: model.StructDef;
360
- query: model.Query;
361
- }
362
- /**
363
- * Generic abstract for all pipelines, the first segment might be a reference
364
- * to an existing pipeline (query or turtle), and if there is a refinement it
365
- * is refers to the first segment of the composed pipeline.
366
- */
367
- declare abstract class PipelineDesc extends MalloyElement {
368
- elementType: string;
369
- protected headRefinement?: QOPDesc;
370
- protected qops: QOPDesc[];
371
- nestedInQuerySpace?: QuerySpace;
372
- refineHead(refinement: QOPDesc): void;
373
- addSegments(...segDesc: QOPDesc[]): void;
374
- protected appendOps(modelPipe: model.PipeSegment[], existingEndSpace: FieldSpace): {
375
- opList: model.PipeSegment[];
376
- structDef: model.StructDef;
377
- };
378
- protected refinePipeline(fs: FieldSpace, modelPipe: model.Pipeline): model.Pipeline;
379
- protected expandTurtle(turtleName: string, fromStruct: model.StructDef): {
380
- pipeline: model.PipeSegment[];
381
- location: model.DocumentLocation | undefined;
382
- };
383
- protected getOutputStruct(walkStruct: model.StructDef, pipeline: model.PipeSegment[]): model.StructDef;
384
- }
385
- export declare class ExistingQuery extends PipelineDesc {
386
- _head?: ModelEntryReference;
387
- set head(head: ModelEntryReference | undefined);
388
- get head(): ModelEntryReference | undefined;
389
- queryComp(): QueryComp;
390
- query(): model.Query;
391
- }
392
- export declare abstract class TurtleHeadedPipe extends PipelineDesc {
393
- _turtleName?: FieldName;
394
- set turtleName(turtleName: FieldName | undefined);
395
- get turtleName(): FieldName | undefined;
396
- }
397
- export declare class FullQuery extends TurtleHeadedPipe {
398
- readonly explore: Mallobj;
399
- constructor(explore: Mallobj);
400
- queryComp(): QueryComp;
401
- query(): model.Query;
402
- }
2
+ import { SpaceEntry } from "./types/space-entry";
3
+ import { ExploreField } from "./types/explore-field";
4
+ import { NestedQuery } from "./types/nested-query";
5
+ import { QueryItem } from "./types/query-item";
6
+ import { FieldListEdit } from "./explore-properties/field-list-edit";
7
+ import { FieldCollectionMember } from "./types/field-collection-member";
8
+ import { FieldDeclaration } from "./query-items/field-declaration";
9
+ import { FieldReference, WildcardFieldReference } from "./query-items/field-references";
10
+ import { FieldName, FieldSpace, SourceSpec } from "./types/field-space";
11
+ import { HasParameter } from "./parameters/has-parameter";
12
+ import { MalloyElement } from "./types/malloy-element";
13
+ import { Join } from "./query-properties/joins";
14
+ import { SpaceField } from "./types/space-field";
15
+ import { QueryField } from "./space-fields/query-space-field";
16
+ import { SpaceSeed } from "./space-seed";
17
+ import { StaticSpace } from "./static-space";
18
+ import { TurtleHeadedPipe } from "./types/turtle-headed-pipe";
19
+ import { FieldType } from "./types/field-type";
403
20
  export declare class TurtleDecl extends TurtleHeadedPipe {
404
21
  readonly name: string;
405
22
  constructor(name: string);
406
23
  getPipeline(fs: FieldSpace): model.Pipeline;
407
24
  getFieldDef(fs: FieldSpace, nestParent: QuerySpace | undefined): model.TurtleDef;
408
25
  }
409
- export declare class NestReference extends FieldReference {
410
- readonly name: FieldName;
411
- elementType: string;
412
- constructor(name: FieldName);
413
- }
414
26
  export declare class NestRefinement extends TurtleDecl {
415
27
  elementType: string;
416
28
  constructor(turtleName: FieldName);
@@ -419,290 +31,7 @@ export declare class NestDefinition extends TurtleDecl {
419
31
  elementType: string;
420
32
  constructor(name: string);
421
33
  }
422
- export declare type NestedQuery = NestReference | NestDefinition | NestRefinement;
423
34
  export declare function isNestedQuery(me: MalloyElement): me is NestedQuery;
424
- export declare class Nests extends ListOf<NestedQuery> {
425
- constructor(nests: NestedQuery[]);
426
- }
427
- export declare type QueryElement = FullQuery | ExistingQuery;
428
- export declare function isQueryElement(e: MalloyElement): e is QueryElement;
429
- export declare class DefineQueryList extends RunList implements DocStatement {
430
- constructor(queryList: DefineQuery[]);
431
- execute(doc: Document): ModelDataRequest;
432
- }
433
- export declare class DefineQuery extends MalloyElement implements DocStatement {
434
- readonly name: string;
435
- readonly queryDetails: QueryElement;
436
- elementType: string;
437
- constructor(name: string, queryDetails: QueryElement);
438
- execute(doc: Document): ModelDataRequest;
439
- }
440
- export declare class AnonymousQuery extends MalloyElement implements DocStatement {
441
- readonly theQuery: QueryElement;
442
- elementType: string;
443
- constructor(theQuery: QueryElement);
444
- execute(doc: Document): ModelDataRequest;
445
- }
446
- declare type TopInit = FieldName | ExpressionDef;
447
- export declare class Top extends MalloyElement {
448
- readonly limit: number;
449
- readonly by?: TopInit | undefined;
450
- elementType: string;
451
- constructor(limit: number, by?: TopInit | undefined);
452
- getBy(fs: FieldSpace): model.By | undefined;
453
- }
454
- export declare class JSONElement extends MalloyElement {
455
- elementType: string;
456
- readonly value: any;
457
- constructor(jsonSrc: string);
458
- }
459
- export declare class JSONStructDef extends Mallobj {
460
- readonly struct: model.StructDef;
461
- elementType: string;
462
- constructor(struct: model.StructDef);
463
- static fromJSON(jsonObj: JSONElement): JSONStructDef | undefined;
464
- structDef(): model.StructDef;
465
- }
466
- export declare class ImportStatement extends MalloyElement implements DocStatement {
467
- readonly url: string;
468
- elementType: string;
469
- fullURL?: string;
470
- constructor(url: string, baseURL: string);
471
- execute(doc: Document): ModelDataRequest;
472
- }
473
- interface HasInit {
474
- name: string;
475
- isCondition: boolean;
476
- type?: string;
477
- default?: ConstantSubExpression;
478
- }
479
- export declare class HasParameter extends MalloyElement {
480
- elementType: string;
481
- readonly name: string;
482
- readonly isCondition: boolean;
483
- readonly type?: model.AtomicFieldType;
484
- readonly default?: ConstantSubExpression;
485
- constructor(init: HasInit);
486
- parameter(): model.Parameter;
487
- }
488
- export declare class ConstantParameter extends HasParameter {
489
- readonly value: ConstantSubExpression;
490
- constructor(name: string, value: ConstantSubExpression);
491
- parameter(): model.Parameter;
492
- }
493
- declare type SQLStringSegment = string | QueryElement;
494
- export declare class SQLString extends MalloyElement {
495
- elementType: string;
496
- elements: SQLStringSegment[];
497
- containsQueries: boolean;
498
- push(el: string | MalloyElement): void;
499
- sqlPhrases(): model.SQLPhrase[];
500
- }
501
- export declare class SQLStatement extends MalloyElement implements DocStatement {
502
- readonly select: SQLString;
503
- elementType: string;
504
- is?: string;
505
- connection?: string;
506
- requestBlock?: model.SQLBlockSource;
507
- constructor(select: SQLString);
508
- sqlBlock(): model.SQLBlockSource;
509
- /**
510
- * This is the one statement which pauses execution. First time through
511
- * it will generate a schema request, next time through it will either
512
- * record the error or record the schema.
513
- */
514
- execute(doc: Document): ModelDataRequest;
515
- }
516
- export declare class SampleProperty extends MalloyElement {
517
- readonly sample: model.Sampling;
518
- elementType: string;
519
- constructor(sample: model.Sampling);
520
- sampling(): model.Sampling;
521
- }
522
- /**
523
- * Root node for any element in an expression. These essentially
524
- * create a sub-tree in the larger AST. Expression nodes know
525
- * how to write themselves as SQL (or rather, generate the
526
- * template for SQL required by the query writer)
527
- */
528
- export declare abstract class ExpressionDef extends MalloyElement {
529
- abstract elementType: string;
530
- granular(): boolean;
531
- /**
532
- * Returns the "translation" or template for SQL generation. When asking
533
- * for a tranlsation you may pass the types you can accept, allowing
534
- * the translation code a chance to convert to match your expectations
535
- * @param space Namespace for looking up field references
536
- */
537
- abstract getExpression(fs: FieldSpace): ExprValue;
538
- legalChildTypes: import("./ast-types").FragType[];
539
- /**
540
- * Some operators want to give the right hand value a chance to
541
- * rewrite itself. This requests a translation for a rewrite,
542
- * or returns undefined if that request should be denied.
543
- * @param fs FieldSpace
544
- * @returns Translated expression or undefined
545
- */
546
- requestExpression(fs: FieldSpace): ExprValue | undefined;
547
- defaultFieldName(): string | undefined;
548
- /**
549
- * Check an expression for type compatibility
550
- * @param _eNode currently unused, will be used to get error location
551
- * @param eVal ...list of expressions that must match legalChildTypes
552
- */
553
- typeCheck(eNode: ExpressionDef, eVal: ExprValue): boolean;
554
- /**
555
- * This is the operation which makes partial comparison and value trees work
556
- * The default implemention merely constructs LEFT OP RIGHT, but specialized
557
- * nodes like alternation trees or or partial comparison can control how
558
- * the appplication gets generated
559
- * @param fs The symbol table
560
- * @param op The operator being applied
561
- * @param expr The "other" (besdies 'this') value
562
- * @returns The translated expression
563
- */
564
- apply(fs: FieldSpace, op: string, left: ExpressionDef): ExprValue;
565
- }
566
- export declare class ConstantSubExpression extends ExpressionDef {
567
- readonly expr: ExpressionDef;
568
- elementType: string;
569
- private cfs?;
570
- constructor(expr: ExpressionDef);
571
- getExpression(_fs: FieldSpace): ExprValue;
572
- private get constantFs();
573
- constantValue(): ExprValue;
574
- constantCondition(type: AtomicFieldType): ExprValue;
575
- apply(fs: FieldSpace, op: string, expr: ExpressionDef): ExprValue;
576
- requestExpression(fs: FieldSpace): ExprValue | undefined;
577
- }
578
- export declare class FieldDeclaration extends MalloyElement {
579
- readonly expr: ExpressionDef;
580
- readonly defineName: string;
581
- readonly exprSrc?: string | undefined;
582
- elementType: string;
583
- isMeasure?: boolean;
584
- constructor(expr: ExpressionDef, defineName: string, exprSrc?: string | undefined);
585
- fieldDef(fs: FieldSpace, exprName: string): FieldTypeDef;
586
- queryFieldDef(exprFS: FieldSpace, exprName: string): FieldTypeDef;
587
- }
588
- /**
589
- * All of the magic of malloy expressions eventually flows to here,
590
- * where an operator is applied to two values. Depending on the
591
- * operator and value types this may involve transformations of
592
- * the values or even the operator.
593
- * @param fs FieldSpace for the symbols
594
- * @param left Left value
595
- * @param op The operator
596
- * @param right Right Value
597
- * @returns ExprValue of the expression
598
- */
599
- export declare function applyBinary(fs: FieldSpace, left: ExpressionDef, op: string, right: ExpressionDef): ExprValue;
600
- export declare abstract class BinaryBoolean<opType extends string> extends ExpressionDef {
601
- readonly left: ExpressionDef;
602
- readonly op: opType;
603
- readonly right: ExpressionDef;
604
- elementType: string;
605
- legalChildTypes: import("./ast-types").FragType[];
606
- constructor(left: ExpressionDef, op: opType, right: ExpressionDef);
607
- getExpression(fs: FieldSpace): ExprValue;
608
- }
609
- export declare class ExprCompare extends BinaryBoolean<Comparison> {
610
- elementType: string;
611
- constructor(left: ExpressionDef, op: Comparison, right: ExpressionDef);
612
- getExpression(fs: FieldSpace): ExprValue;
613
- }
614
- /**
615
- * GranularTime is a moment in time which ALSO has a "granularity"
616
- * commonly this are created by applying ".datePart" to an expression
617
- * 1) They have a value, which is the moment in time
618
- * 2) When used in a comparison, they act like a range, for the
619
- * duration of 1 unit of granularity
620
- */
621
- export declare class ExprGranularTime extends ExpressionDef {
622
- readonly expr: ExpressionDef;
623
- readonly units: TimestampUnit;
624
- readonly truncate: boolean;
625
- elementType: string;
626
- legalChildTypes: import("./ast-types").FragType[];
627
- constructor(expr: ExpressionDef, units: TimestampUnit, truncate: boolean);
628
- granular(): boolean;
629
- getExpression(fs: FieldSpace): ExprValue;
630
- apply(fs: FieldSpace, op: string, left: ExpressionDef): ExprValue;
631
- protected timestampRange(fs: FieldSpace, op: string, expr: ExpressionDef): ExprValue;
632
- protected dateRange(fs: FieldSpace, op: string, expr: ExpressionDef): ExprValue;
633
- }
634
- export declare class TypeMistmatch extends Error {
635
- }
636
- export declare class ExprDuration extends ExpressionDef {
637
- readonly n: ExpressionDef;
638
- readonly timeframe: TimestampUnit;
639
- elementType: string;
640
- legalChildTypes: import("./ast-types").FragType[];
641
- constructor(n: ExpressionDef, timeframe: TimestampUnit);
642
- apply(fs: FieldSpace, op: string, left: ExpressionDef): ExprValue;
643
- getExpression(_fs: FieldSpace): ExprValue;
644
- }
645
- export declare class ExprTime extends ExpressionDef {
646
- elementType: string;
647
- readonly translationValue: ExprValue;
648
- constructor(timeType: TimeFieldType, value: Fragment[] | string, expressionType?: ExpressionType);
649
- getExpression(_fs: FieldSpace): ExprValue;
650
- static fromValue(timeType: TimeFieldType, expr: ExprValue): ExprTime;
651
- }
652
- export declare class Range extends ExpressionDef {
653
- readonly first: ExpressionDef;
654
- readonly last: ExpressionDef;
655
- elementType: string;
656
- constructor(first: ExpressionDef, last: ExpressionDef);
657
- apply(fs: FieldSpace, op: string, expr: ExpressionDef): ExprValue;
658
- requestExpression(_fs: FieldSpace): ExprValue | undefined;
659
- getExpression(_fs: FieldSpace): ExprValue;
660
- }
661
- /**
662
- * A FieldSpace is a hierarchy of namespaces, where the leaf nodes
663
- * are fields. A FieldSpace can lookup fields, and generate a StructDef
664
- */
665
- export interface FieldSpace {
666
- type: "fieldSpace";
667
- structDef(): model.StructDef;
668
- emptyStructDef(): model.StructDef;
669
- lookup(symbol: FieldName[]): LookupResult;
670
- dialectObj(): Dialect | undefined;
671
- whenComplete: (step: () => void) => void;
672
- }
673
- /**
674
- * Used to detect references to fields in the statement which defines them
675
- */
676
- export declare class DefSpace implements FieldSpace {
677
- readonly realFS: FieldSpace;
678
- readonly circular: FieldDeclaration;
679
- readonly type = "fieldSpace";
680
- foundCircle: boolean;
681
- constructor(realFS: FieldSpace, circular: FieldDeclaration);
682
- structDef(): model.StructDef;
683
- emptyStructDef(): model.StructDef;
684
- lookup(symbol: FieldName[]): LookupResult;
685
- dialectObj(): Dialect | undefined;
686
- whenComplete(step: () => void): void;
687
- }
688
- export declare class StaticSpace implements FieldSpace {
689
- readonly type = "fieldSpace";
690
- private memoMap?;
691
- protected fromStruct: model.StructDef;
692
- constructor(sourceStructDef: model.StructDef);
693
- whenComplete(step: () => void): void;
694
- dialectObj(): Dialect | undefined;
695
- fromFieldDef(from: model.FieldDef): SpaceField;
696
- private get map();
697
- protected dropEntries(): void;
698
- protected dropEntry(name: string): void;
699
- protected entry(name: string): SpaceEntry | undefined;
700
- protected setEntry(name: string, value: SpaceEntry): void;
701
- protected entries(): [string, SpaceEntry][];
702
- structDef(): model.StructDef;
703
- emptyStructDef(): model.StructDef;
704
- lookup(path: FieldName[]): LookupResult;
705
- }
706
35
  /**
707
36
  * A FieldSpace which may undergo modification
708
37
  */
@@ -751,90 +80,6 @@ export declare abstract class ResultSpace extends DynamicSpace {
751
80
  getQuerySegment(rf: model.QuerySegment | undefined): model.QuerySegment;
752
81
  getPipeSegment(refineFrom: model.QuerySegment | undefined): model.PipeSegment;
753
82
  }
754
- /**
755
- * Reduce and project queries use a "QuerySpace"
756
- */
757
- export declare class ReduceFieldSpace extends ResultSpace {
758
- readonly segmentType = "reduce";
759
- }
760
- export declare class ProjectFieldSpace extends ResultSpace {
761
- readonly segmentType = "project";
762
- canContain(qd: model.QueryFieldDef): boolean;
763
- }
764
- export declare abstract class SpaceEntry {
765
- abstract type(): FieldType;
766
- abstract refType: "field" | "parameter";
767
- }
768
- export declare abstract class SpaceField extends SpaceEntry {
769
- readonly refType = "field";
770
- protected fieldTypeFromFieldDef(def: model.FieldDef): FieldType;
771
- getQueryFieldDef(_fs: FieldSpace): model.QueryFieldDef | undefined;
772
- fieldDef(): model.FieldDef | undefined;
773
- }
774
- export interface FieldType {
775
- type: FieldValueType;
776
- expressionType?: model.ExpressionType;
777
- }
778
- export declare class StructSpaceField extends SpaceField {
779
- protected sourceDef: model.StructDef;
780
- protected space?: FieldSpace;
781
- constructor(sourceDef: model.StructDef);
782
- get fieldSpace(): FieldSpace;
783
- fieldDef(): model.FieldDef;
784
- type(): FieldType;
785
- }
786
- export declare abstract class QueryField extends SpaceField {
787
- protected inSpace: FieldSpace;
788
- constructor(inSpace: FieldSpace);
789
- abstract getQueryFieldDef(fs: FieldSpace): model.QueryFieldDef | undefined;
790
- abstract fieldDef(): model.FieldDef;
791
- type(): FieldType;
792
- }
793
- export declare class QueryFieldStruct extends QueryField {
794
- protected turtleDef: model.TurtleDef;
795
- constructor(fs: FieldSpace, turtleDef: model.TurtleDef);
796
- rename(name: string): void;
797
- fieldDef(): model.TurtleDef;
798
- getQueryFieldDef(_fs: FieldSpace): model.QueryFieldDef | undefined;
799
- }
800
- export declare class ColumnSpaceField extends SpaceField {
801
- protected def: model.FieldTypeDef;
802
- constructor(def: model.FieldTypeDef);
803
- fieldDef(): model.FieldDef;
804
- type(): FieldType;
805
- }
806
- export declare abstract class SpaceParam extends SpaceEntry {
807
- abstract parameter(): model.Parameter;
808
- readonly refType = "parameter";
809
- }
810
- export declare class DefinedParameter extends SpaceParam {
811
- readonly paramDef: model.Parameter;
812
- constructor(paramDef: model.Parameter);
813
- parameter(): model.Parameter;
814
- type(): FieldType;
815
- }
816
- /**
817
- * Based on how things are constructed, the starting field space
818
- * can either be another field space or an existing structdef.
819
- * Using a SpaceSeed allows a class to accept either one
820
- * and use either version at some future time.
821
- */
822
- export declare class SpaceSeed {
823
- readonly sourceSpec: SourceSpec;
824
- private spaceSpec;
825
- private asFS?;
826
- private asStruct?;
827
- constructor(sourceSpec: SourceSpec);
828
- get structDef(): model.StructDef;
829
- get fieldSpace(): FieldSpace;
830
- }
831
- export declare type SourceSpec = model.StructDef | FieldSpace;
832
- export declare class AbstractParameter extends SpaceParam {
833
- readonly astParam: HasParameter;
834
- constructor(astParam: HasParameter);
835
- parameter(): model.Parameter;
836
- type(): FieldType;
837
- }
838
83
  export declare class ExpressionFieldFromAst extends SpaceField {
839
84
  readonly space: DynamicSpace;
840
85
  readonly exprDef: FieldDeclaration;
@@ -855,19 +100,6 @@ export declare class QueryFieldAST extends QueryField {
855
100
  getQueryFieldDef(fs: FieldSpace): model.QueryFieldDef;
856
101
  fieldDef(): model.TurtleDef;
857
102
  }
858
- export declare class RenameSpaceField extends SpaceField {
859
- private readonly otherField;
860
- private readonly newName;
861
- private readonly location;
862
- constructor(otherField: SpaceField, newName: string, location: model.DocumentLocation);
863
- fieldDef(): model.FieldDef | undefined;
864
- type(): FieldType;
865
- }
866
- export declare class JoinSpaceField extends StructSpaceField {
867
- readonly intoFS: FieldSpace;
868
- readonly join: Join;
869
- constructor(intoFS: FieldSpace, join: Join);
870
- }
871
103
  /**
872
104
  * Unlike a source, which is a refinement of a namespace, a query
873
105
  * is creating a new unrelated namespace. The query starts with a
@@ -884,32 +116,3 @@ export declare class QuerySpace extends DynamicSpace {
884
116
  constructor(input: SourceSpec, result: ResultSpace);
885
117
  extendSource(extendField: Join | FieldDeclaration): void;
886
118
  }
887
- export declare class ReferenceField extends SpaceField {
888
- readonly fieldRef: FieldReference;
889
- constructor(fieldRef: FieldReference);
890
- getQueryFieldDef(fs: FieldSpace): model.QueryFieldDef | undefined;
891
- type(): FieldType;
892
- }
893
- export declare class WildSpaceField extends SpaceField {
894
- readonly wildText: string;
895
- constructor(wildText: string);
896
- type(): FieldType;
897
- getQueryFieldDef(_fs: FieldSpace): model.QueryFieldDef;
898
- }
899
- interface LookupFound {
900
- found: SpaceEntry;
901
- error: undefined;
902
- }
903
- interface LookupError {
904
- error: string;
905
- found: undefined;
906
- }
907
- export declare type LookupResult = LookupFound | LookupError;
908
- export declare class IndexFieldSpace extends ResultSpace {
909
- readonly segmentType = "index";
910
- fieldList: Set<string>;
911
- addReference(ref: FieldReference): void;
912
- addWild(wild: WildcardFieldReference): void;
913
- getPipeSegment(refineIndex?: model.PipeSegment): model.IndexSegment;
914
- }
915
- export {};