@malloydata/malloy 0.0.195-dev241003204905 → 0.0.195-dev241007154000

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 (144) hide show
  1. package/dist/connection/base_connection.d.ts +21 -7
  2. package/dist/connection/base_connection.js +62 -0
  3. package/dist/connection/types.d.ts +5 -5
  4. package/dist/dialect/dialect.d.ts +5 -3
  5. package/dist/dialect/dialect.js +15 -0
  6. package/dist/dialect/duckdb/duckdb.d.ts +3 -3
  7. package/dist/dialect/duckdb/duckdb.js +8 -3
  8. package/dist/dialect/postgres/postgres.d.ts +3 -3
  9. package/dist/dialect/postgres/postgres.js +5 -2
  10. package/dist/dialect/snowflake/snowflake.d.ts +3 -3
  11. package/dist/dialect/snowflake/snowflake.js +4 -1
  12. package/dist/dialect/standardsql/standardsql.d.ts +3 -3
  13. package/dist/dialect/standardsql/standardsql.js +5 -2
  14. package/dist/dialect/trino/trino.d.ts +3 -3
  15. package/dist/dialect/trino/trino.js +35 -3
  16. package/dist/index.d.ts +4 -4
  17. package/dist/index.js +6 -2
  18. package/dist/lang/ast/error-factory.d.ts +4 -3
  19. package/dist/lang/ast/error-factory.js +27 -17
  20. package/dist/lang/ast/expressions/constant-expression.d.ts +1 -0
  21. package/dist/lang/ast/expressions/constant-expression.js +3 -0
  22. package/dist/lang/ast/expressions/expr-aggregate-function.d.ts +3 -7
  23. package/dist/lang/ast/expressions/expr-aggregate-function.js +50 -54
  24. package/dist/lang/ast/expressions/expr-cast.js +2 -4
  25. package/dist/lang/ast/expressions/expr-func.js +1 -1
  26. package/dist/lang/ast/expressions/expr-granular-time.js +1 -1
  27. package/dist/lang/ast/expressions/expr-record-literal.d.ts +16 -0
  28. package/dist/lang/ast/expressions/expr-record-literal.js +57 -0
  29. package/dist/lang/ast/expressions/expr-time-extract.js +3 -3
  30. package/dist/lang/ast/expressions/expr-time.d.ts +3 -3
  31. package/dist/lang/ast/expressions/expr-time.js +1 -1
  32. package/dist/lang/ast/expressions/time-literal.d.ts +6 -6
  33. package/dist/lang/ast/expressions/time-literal.js +1 -1
  34. package/dist/lang/ast/field-space/column-space-field.d.ts +6 -5
  35. package/dist/lang/ast/field-space/column-space-field.js +7 -4
  36. package/dist/lang/ast/field-space/dynamic-space.d.ts +8 -6
  37. package/dist/lang/ast/field-space/dynamic-space.js +35 -11
  38. package/dist/lang/ast/field-space/index-field-space.js +6 -3
  39. package/dist/lang/ast/field-space/ir-view-field.d.ts +1 -0
  40. package/dist/lang/ast/field-space/ir-view-field.js +3 -1
  41. package/dist/lang/ast/field-space/join-space-field.d.ts +2 -2
  42. package/dist/lang/ast/field-space/join-space-field.js +2 -2
  43. package/dist/lang/ast/field-space/parameter-space.d.ts +1 -0
  44. package/dist/lang/ast/field-space/parameter-space.js +4 -1
  45. package/dist/lang/ast/field-space/query-input-space.d.ts +4 -4
  46. package/dist/lang/ast/field-space/query-input-space.js +3 -5
  47. package/dist/lang/ast/field-space/query-spaces.d.ts +4 -4
  48. package/dist/lang/ast/field-space/query-spaces.js +1 -1
  49. package/dist/lang/ast/field-space/reference-field.js +10 -8
  50. package/dist/lang/ast/field-space/refined-space.d.ts +2 -2
  51. package/dist/lang/ast/field-space/static-space.d.ts +14 -5
  52. package/dist/lang/ast/field-space/static-space.js +45 -20
  53. package/dist/lang/ast/field-space/struct-space-field-base.d.ts +6 -5
  54. package/dist/lang/ast/field-space/struct-space-field-base.js +12 -4
  55. package/dist/lang/ast/index.d.ts +2 -1
  56. package/dist/lang/ast/index.js +2 -1
  57. package/dist/lang/ast/query-builders/index-builder.d.ts +2 -2
  58. package/dist/lang/ast/query-builders/project-builder.d.ts +2 -2
  59. package/dist/lang/ast/query-builders/reduce-builder.d.ts +2 -2
  60. package/dist/lang/ast/query-elements/query-arrow.js +2 -2
  61. package/dist/lang/ast/query-elements/query-head-struct.d.ts +2 -2
  62. package/dist/lang/ast/query-elements/query-head-struct.js +2 -2
  63. package/dist/lang/ast/query-elements/query-raw.js +2 -2
  64. package/dist/lang/ast/query-elements/query-reference.js +1 -1
  65. package/dist/lang/ast/query-items/field-declaration.d.ts +8 -6
  66. package/dist/lang/ast/query-items/field-declaration.js +66 -24
  67. package/dist/lang/ast/query-properties/qop-desc.d.ts +2 -2
  68. package/dist/lang/ast/query-properties/qop-desc.js +1 -1
  69. package/dist/lang/ast/source-elements/named-source.d.ts +4 -4
  70. package/dist/lang/ast/source-elements/named-source.js +16 -8
  71. package/dist/lang/ast/source-elements/query-source.d.ts +3 -3
  72. package/dist/lang/ast/source-elements/query-source.js +5 -2
  73. package/dist/lang/ast/source-elements/refined-source.d.ts +3 -3
  74. package/dist/lang/ast/source-elements/refined-source.js +4 -4
  75. package/dist/lang/ast/source-elements/source.d.ts +2 -2
  76. package/dist/lang/ast/source-elements/source.js +2 -2
  77. package/dist/lang/ast/source-elements/sql-source.d.ts +4 -4
  78. package/dist/lang/ast/source-elements/sql-source.js +6 -6
  79. package/dist/lang/ast/source-elements/table-source.d.ts +2 -2
  80. package/dist/lang/ast/source-elements/table-source.js +1 -1
  81. package/dist/lang/ast/source-properties/{joins.d.ts → join.d.ts} +11 -14
  82. package/dist/lang/ast/source-properties/{joins.js → join.js} +35 -52
  83. package/dist/lang/ast/source-query-elements/sq-reference.js +6 -5
  84. package/dist/lang/ast/sql-elements/sql-string.d.ts +2 -2
  85. package/dist/lang/ast/statements/define-source.js +1 -1
  86. package/dist/lang/ast/struct-utils.d.ts +3 -3
  87. package/dist/lang/ast/struct-utils.js +12 -3
  88. package/dist/lang/ast/time-utils.d.ts +3 -3
  89. package/dist/lang/ast/types/document-compile-result.d.ts +2 -2
  90. package/dist/lang/ast/types/expression-def.js +4 -4
  91. package/dist/lang/ast/types/field-space.d.ts +8 -3
  92. package/dist/lang/ast/types/lookup-result.d.ts +8 -5
  93. package/dist/lang/ast/types/malloy-element.d.ts +3 -3
  94. package/dist/lang/ast/types/malloy-element.js +10 -21
  95. package/dist/lang/ast/types/op-desc.d.ts +2 -2
  96. package/dist/lang/ast/types/pipeline-comp.d.ts +2 -2
  97. package/dist/lang/ast/types/query-comp.d.ts +3 -3
  98. package/dist/lang/ast/types/query-extend-property.d.ts +1 -2
  99. package/dist/lang/ast/types/query-extend-property.js +4 -2
  100. package/dist/lang/ast/types/source-property.d.ts +2 -2
  101. package/dist/lang/ast/types/source-property.js +2 -2
  102. package/dist/lang/ast/types/space-field.d.ts +10 -3
  103. package/dist/lang/ast/types/space-field.js +11 -2
  104. package/dist/lang/ast/types/time-result.d.ts +2 -2
  105. package/dist/lang/ast/view-elements/qop-desc-view.d.ts +3 -3
  106. package/dist/lang/ast/view-elements/qop-desc-view.js +1 -1
  107. package/dist/lang/ast/view-elements/reference-view.d.ts +4 -4
  108. package/dist/lang/ast/view-elements/reference-view.js +2 -6
  109. package/dist/lang/ast/view-elements/view-refine.d.ts +2 -2
  110. package/dist/lang/index.d.ts +1 -1
  111. package/dist/lang/lib/Malloy/MalloyParser.d.ts +54 -21
  112. package/dist/lang/lib/Malloy/MalloyParser.js +1647 -1457
  113. package/dist/lang/lib/Malloy/MalloyParserListener.d.ts +57 -9
  114. package/dist/lang/lib/Malloy/MalloyParserVisitor.d.ts +35 -5
  115. package/dist/lang/malloy-to-ast.d.ts +4 -4
  116. package/dist/lang/malloy-to-ast.js +32 -4
  117. package/dist/lang/parse-log.d.ts +5 -9
  118. package/dist/lang/parse-malloy.d.ts +10 -10
  119. package/dist/lang/parse-malloy.js +2 -1
  120. package/dist/lang/test/annotation.spec.js +7 -1
  121. package/dist/lang/test/field-symbols.spec.js +21 -25
  122. package/dist/lang/test/imports.spec.js +12 -10
  123. package/dist/lang/test/lenses.spec.js +2 -2
  124. package/dist/lang/test/model_serialization.spec.d.ts +4 -4
  125. package/dist/lang/test/model_serialization.spec.js +19 -31
  126. package/dist/lang/test/parse.spec.js +3 -4
  127. package/dist/lang/test/query.spec.js +3 -2
  128. package/dist/lang/test/source.spec.js +7 -0
  129. package/dist/lang/test/sql-block.spec.js +8 -19
  130. package/dist/lang/test/test-translator.d.ts +4 -4
  131. package/dist/lang/test/test-translator.js +53 -61
  132. package/dist/lang/translate-response.d.ts +3 -3
  133. package/dist/malloy.d.ts +31 -149
  134. package/dist/malloy.js +109 -267
  135. package/dist/model/malloy_query.d.ts +25 -23
  136. package/dist/model/malloy_query.js +262 -323
  137. package/dist/model/malloy_types.d.ts +145 -155
  138. package/dist/model/malloy_types.js +81 -84
  139. package/dist/model/sql_block.d.ts +4 -4
  140. package/dist/model/sql_block.js +9 -12
  141. package/dist/tags.js +2 -2
  142. package/package.json +1 -1
  143. package/dist/lang/ast/space-seed.d.ts +0 -16
  144. package/dist/lang/ast/space-seed.js +0 -59
@@ -1,7 +1,7 @@
1
1
  import { PipeSegment } from '../../../model/malloy_types';
2
2
  import { QueryOperationSpace } from '../field-space/query-spaces';
3
3
  import { QOpDesc } from '../query-properties/qop-desc';
4
- import { FieldSpace } from '../types/field-space';
4
+ import { SourceFieldSpace } from '../types/field-space';
5
5
  import { PipelineComp } from '../types/pipeline-comp';
6
6
  import { View } from './view';
7
7
  /**
@@ -13,8 +13,8 @@ export declare class QOpDescView extends View {
13
13
  readonly operation: QOpDesc;
14
14
  elementType: string;
15
15
  constructor(operation: QOpDesc);
16
- pipelineComp(fs: FieldSpace, isNestIn?: QueryOperationSpace): PipelineComp;
16
+ pipelineComp(fs: SourceFieldSpace, isNestIn?: QueryOperationSpace): PipelineComp;
17
17
  private getOp;
18
- refine(inputFS: FieldSpace, _pipeline: PipeSegment[], isNestIn: QueryOperationSpace | undefined): PipeSegment[];
18
+ refine(inputFS: SourceFieldSpace, _pipeline: PipeSegment[], isNestIn: QueryOperationSpace | undefined): PipeSegment[];
19
19
  getImplicitName(): string | undefined;
20
20
  }
@@ -89,7 +89,7 @@ class QOpDescView extends view_1.View {
89
89
  const last = pipeline.length - 1;
90
90
  this.has({ tailRefinements });
91
91
  const finalIn = (0, struct_utils_1.getFinalStruct)(this, inputFS.structDef(), pipeline.slice(-1));
92
- pipeline[last] = this.getOp(new static_space_1.StaticSpace(finalIn), undefined, tailRefinements, pipeline[last]);
92
+ pipeline[last] = this.getOp(new static_space_1.StaticSourceSpace(finalIn), undefined, tailRefinements, pipeline[last]);
93
93
  }
94
94
  return pipeline;
95
95
  }
@@ -1,7 +1,7 @@
1
1
  import { PipeSegment } from '../../../model/malloy_types';
2
2
  import { QueryOperationSpace } from '../field-space/query-spaces';
3
3
  import { ViewOrScalarFieldReference } from '../query-items/field-references';
4
- import { FieldSpace } from '../types/field-space';
4
+ import { SourceFieldSpace } from '../types/field-space';
5
5
  import { PipelineComp } from '../types/pipeline-comp';
6
6
  import { View } from './view';
7
7
  /**
@@ -16,13 +16,13 @@ export declare class ReferenceView extends View {
16
16
  readonly reference: ViewOrScalarFieldReference;
17
17
  elementType: string;
18
18
  constructor(reference: ViewOrScalarFieldReference);
19
- pipelineComp(fs: FieldSpace, _isNestIn: QueryOperationSpace): PipelineComp;
20
- _pipelineComp(fs: FieldSpace, { forRefinement }?: {
19
+ pipelineComp(fs: SourceFieldSpace, _isNestIn: QueryOperationSpace): PipelineComp;
20
+ _pipelineComp(fs: SourceFieldSpace, { forRefinement }?: {
21
21
  forRefinement: boolean;
22
22
  }): PipelineComp & {
23
23
  error?: boolean;
24
24
  };
25
25
  private getRefinementSegment;
26
- refine(inputFS: FieldSpace, pipeline: PipeSegment[], _isNestIn: QueryOperationSpace | undefined): PipeSegment[];
26
+ refine(inputFS: SourceFieldSpace, pipeline: PipeSegment[], _isNestIn: QueryOperationSpace | undefined): PipeSegment[];
27
27
  getImplicitName(): string | undefined;
28
28
  }
@@ -75,16 +75,12 @@ class ReferenceView extends view_1.View {
75
75
  type: 'reduce',
76
76
  queryFields: [this.reference.refToField],
77
77
  };
78
- const { dialect, queryTimezone, structRelationship } = fs.structDef();
79
78
  const name = this.reference.nameString;
80
79
  const outputStruct = {
81
- type: 'struct',
82
- dialect,
83
- queryTimezone,
80
+ ...(0, malloy_types_1.sourceBase)(fs.structDef()),
81
+ type: 'query_result',
84
82
  name,
85
83
  fields: [fieldDef],
86
- structRelationship,
87
- structSource: { type: 'query_result' },
88
84
  };
89
85
  return {
90
86
  pipeline: [newSegment],
@@ -1,6 +1,6 @@
1
1
  import { PipeSegment } from '../../../model';
2
2
  import { QueryOperationSpace } from '../field-space/query-spaces';
3
- import { FieldSpace } from '../types/field-space';
3
+ import { FieldSpace, SourceFieldSpace } from '../types/field-space';
4
4
  import { PipelineComp } from '../types/pipeline-comp';
5
5
  import { View } from './view';
6
6
  /**
@@ -14,7 +14,7 @@ export declare class ViewRefine extends View {
14
14
  readonly refinement: View;
15
15
  elementType: string;
16
16
  constructor(base: View, refinement: View);
17
- pipelineComp(fs: FieldSpace, isNestIn?: QueryOperationSpace): PipelineComp;
17
+ pipelineComp(fs: SourceFieldSpace, isNestIn?: QueryOperationSpace): PipelineComp;
18
18
  refine(inputFS: FieldSpace, pipeline: PipeSegment[], isNestIn: QueryOperationSpace | undefined): PipeSegment[];
19
19
  getImplicitName(): string | undefined;
20
20
  }
@@ -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, SQLSources as 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';
@@ -281,22 +281,24 @@ export declare class MalloyParser extends Parser {
281
281
  static readonly RULE_partialAllowedFieldExpr = 115;
282
282
  static readonly RULE_pickStatement = 116;
283
283
  static readonly RULE_pick = 117;
284
- static readonly RULE_argumentList = 118;
285
- static readonly RULE_fieldNameList = 119;
286
- static readonly RULE_fieldCollection = 120;
287
- static readonly RULE_collectionWildCard = 121;
288
- static readonly RULE_starQualified = 122;
289
- static readonly RULE_taggedRef = 123;
290
- static readonly RULE_refExpr = 124;
291
- static readonly RULE_collectionMember = 125;
292
- static readonly RULE_fieldPath = 126;
293
- static readonly RULE_joinName = 127;
294
- static readonly RULE_fieldName = 128;
295
- static readonly RULE_justExpr = 129;
296
- static readonly RULE_sqlExploreNameRef = 130;
297
- static readonly RULE_nameSQLBlock = 131;
298
- static readonly RULE_connectionName = 132;
299
- static readonly RULE_experimentalStatementForTesting = 133;
284
+ static readonly RULE_recordKey = 118;
285
+ static readonly RULE_recordElement = 119;
286
+ static readonly RULE_argumentList = 120;
287
+ static readonly RULE_fieldNameList = 121;
288
+ static readonly RULE_fieldCollection = 122;
289
+ static readonly RULE_collectionWildCard = 123;
290
+ static readonly RULE_starQualified = 124;
291
+ static readonly RULE_taggedRef = 125;
292
+ static readonly RULE_refExpr = 126;
293
+ static readonly RULE_collectionMember = 127;
294
+ static readonly RULE_fieldPath = 128;
295
+ static readonly RULE_joinName = 129;
296
+ static readonly RULE_fieldName = 130;
297
+ static readonly RULE_justExpr = 131;
298
+ static readonly RULE_sqlExploreNameRef = 132;
299
+ static readonly RULE_nameSQLBlock = 133;
300
+ static readonly RULE_connectionName = 134;
301
+ static readonly RULE_experimentalStatementForTesting = 135;
300
302
  static readonly ruleNames: string[];
301
303
  private static readonly _LITERAL_NAMES;
302
304
  private static readonly _SYMBOLIC_NAMES;
@@ -428,6 +430,8 @@ export declare class MalloyParser extends Parser {
428
430
  partialAllowedFieldExpr(): PartialAllowedFieldExprContext;
429
431
  pickStatement(): PickStatementContext;
430
432
  pick(): PickContext;
433
+ recordKey(): RecordKeyContext;
434
+ recordElement(): RecordElementContext;
431
435
  argumentList(): ArgumentListContext;
432
436
  fieldNameList(): FieldNameListContext;
433
437
  fieldCollection(): FieldCollectionContext;
@@ -1996,16 +2000,16 @@ export declare class ExprFieldPathContext extends FieldExprContext {
1996
2000
  exitRule(listener: MalloyParserListener): void;
1997
2001
  accept<Result>(visitor: MalloyParserVisitor<Result>): Result;
1998
2002
  }
1999
- export declare class ExprFieldPropsContext extends FieldExprContext {
2000
- fieldExpr(): FieldExprContext;
2001
- fieldProperties(): FieldPropertiesContext;
2003
+ export declare class ExprLiteralContext extends FieldExprContext {
2004
+ literal(): LiteralContext;
2002
2005
  constructor(ctx: FieldExprContext);
2003
2006
  enterRule(listener: MalloyParserListener): void;
2004
2007
  exitRule(listener: MalloyParserListener): void;
2005
2008
  accept<Result>(visitor: MalloyParserVisitor<Result>): Result;
2006
2009
  }
2007
- export declare class ExprLiteralContext extends FieldExprContext {
2008
- literal(): LiteralContext;
2010
+ export declare class ExprFieldPropsContext extends FieldExprContext {
2011
+ fieldExpr(): FieldExprContext;
2012
+ fieldProperties(): FieldPropertiesContext;
2009
2013
  constructor(ctx: FieldExprContext);
2010
2014
  enterRule(listener: MalloyParserListener): void;
2011
2015
  exitRule(listener: MalloyParserListener): void;
@@ -2307,6 +2311,35 @@ export declare class PickContext extends ParserRuleContext {
2307
2311
  exitRule(listener: MalloyParserListener): void;
2308
2312
  accept<Result>(visitor: MalloyParserVisitor<Result>): Result;
2309
2313
  }
2314
+ export declare class RecordKeyContext extends ParserRuleContext {
2315
+ id(): IdContext;
2316
+ constructor(parent: ParserRuleContext | undefined, invokingState: number);
2317
+ get ruleIndex(): number;
2318
+ enterRule(listener: MalloyParserListener): void;
2319
+ exitRule(listener: MalloyParserListener): void;
2320
+ accept<Result>(visitor: MalloyParserVisitor<Result>): Result;
2321
+ }
2322
+ export declare class RecordElementContext extends ParserRuleContext {
2323
+ constructor(parent: ParserRuleContext | undefined, invokingState: number);
2324
+ get ruleIndex(): number;
2325
+ copyFrom(ctx: RecordElementContext): void;
2326
+ }
2327
+ export declare class RecordRefContext extends RecordElementContext {
2328
+ fieldPath(): FieldPathContext;
2329
+ constructor(ctx: RecordElementContext);
2330
+ enterRule(listener: MalloyParserListener): void;
2331
+ exitRule(listener: MalloyParserListener): void;
2332
+ accept<Result>(visitor: MalloyParserVisitor<Result>): Result;
2333
+ }
2334
+ export declare class RecordExprContext extends RecordElementContext {
2335
+ recordKey(): RecordKeyContext;
2336
+ IS(): TerminalNode;
2337
+ fieldExpr(): FieldExprContext;
2338
+ constructor(ctx: RecordElementContext);
2339
+ enterRule(listener: MalloyParserListener): void;
2340
+ exitRule(listener: MalloyParserListener): void;
2341
+ accept<Result>(visitor: MalloyParserVisitor<Result>): Result;
2342
+ }
2310
2343
  export declare class ArgumentListContext extends ParserRuleContext {
2311
2344
  fieldExpr(): FieldExprContext[];
2312
2345
  fieldExpr(i: number): FieldExprContext;