@malloydata/malloy 0.0.219 → 0.0.220-dev241204170603

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 (71) hide show
  1. package/dist/connection/base_connection.js +1 -1
  2. package/dist/dialect/dialect.d.ts +6 -3
  3. package/dist/dialect/dialect.js +4 -11
  4. package/dist/dialect/duckdb/dialect_functions.js +1 -1
  5. package/dist/dialect/duckdb/duckdb.d.ts +4 -4
  6. package/dist/dialect/duckdb/duckdb.js +10 -16
  7. package/dist/dialect/duckdb/function_overrides.js +1 -1
  8. package/dist/dialect/functions/malloy_standard_functions.js +1 -1
  9. package/dist/dialect/index.d.ts +3 -1
  10. package/dist/dialect/index.js +3 -1
  11. package/dist/dialect/mysql/dialect_functions.js +1 -1
  12. package/dist/dialect/mysql/function_overrides.js +1 -1
  13. package/dist/dialect/mysql/index.js +1 -1
  14. package/dist/dialect/mysql/mysql.d.ts +9 -6
  15. package/dist/dialect/mysql/mysql.js +36 -25
  16. package/dist/dialect/pg_impl.d.ts +4 -1
  17. package/dist/dialect/pg_impl.js +11 -1
  18. package/dist/dialect/postgres/dialect_functions.js +1 -1
  19. package/dist/dialect/postgres/function_overrides.js +1 -1
  20. package/dist/dialect/postgres/postgres.d.ts +6 -4
  21. package/dist/dialect/postgres/postgres.js +27 -12
  22. package/dist/dialect/snowflake/dialect_functions.js +1 -1
  23. package/dist/dialect/snowflake/function_overrides.js +1 -1
  24. package/dist/dialect/snowflake/snowflake.d.ts +5 -3
  25. package/dist/dialect/snowflake/snowflake.js +76 -20
  26. package/dist/dialect/standardsql/dialect_functions.js +1 -1
  27. package/dist/dialect/standardsql/function_overrides.js +1 -1
  28. package/dist/dialect/standardsql/standardsql.d.ts +5 -3
  29. package/dist/dialect/standardsql/standardsql.js +16 -101
  30. package/dist/dialect/tiny_parser.d.ts +41 -0
  31. package/dist/dialect/tiny_parser.js +126 -0
  32. package/dist/dialect/trino/dialect_functions.js +1 -1
  33. package/dist/dialect/trino/function_overrides.js +1 -1
  34. package/dist/dialect/trino/trino.d.ts +3 -3
  35. package/dist/dialect/trino/trino.js +40 -16
  36. package/dist/index.d.ts +3 -3
  37. package/dist/index.js +3 -2
  38. package/dist/lang/ast/expressions/case.js +1 -1
  39. package/dist/lang/ast/expressions/expr-array-literal.d.ts +9 -0
  40. package/dist/lang/ast/expressions/expr-array-literal.js +93 -0
  41. package/dist/lang/ast/expressions/expr-record-literal.d.ts +1 -1
  42. package/dist/lang/ast/expressions/expr-record-literal.js +56 -28
  43. package/dist/lang/ast/field-space/join-space-field.d.ts +1 -1
  44. package/dist/lang/ast/field-space/join-space-field.js +2 -2
  45. package/dist/lang/ast/field-space/project-field-space.js +1 -1
  46. package/dist/lang/ast/field-space/reference-field.js +1 -1
  47. package/dist/lang/ast/field-space/static-space.d.ts +1 -2
  48. package/dist/lang/ast/field-space/static-space.js +15 -5
  49. package/dist/lang/ast/field-space/view-field.d.ts +2 -2
  50. package/dist/lang/ast/index.d.ts +1 -0
  51. package/dist/lang/ast/index.js +1 -0
  52. package/dist/lang/ast/query-items/field-declaration.js +25 -11
  53. package/dist/lang/ast/query-properties/filters.js +0 -2
  54. package/dist/lang/ast/source-properties/join.js +1 -1
  55. package/dist/lang/ast/types/binary_operators.js +1 -1
  56. package/dist/lang/ast/types/dialect-name-space.js +1 -1
  57. package/dist/lang/lib/Malloy/MalloyParser.d.ts +1 -1
  58. package/dist/lang/lib/Malloy/MalloyParser.js +12 -16
  59. package/dist/lang/malloy-to-ast.d.ts +1 -1
  60. package/dist/lang/malloy-to-ast.js +3 -3
  61. package/dist/lang/parse-log.d.ts +1 -0
  62. package/dist/lang/test/query.spec.js +6 -0
  63. package/dist/lang/test/test-translator.js +11 -2
  64. package/dist/model/malloy_query.d.ts +29 -24
  65. package/dist/model/malloy_query.js +261 -146
  66. package/dist/model/malloy_types.d.ts +12 -15
  67. package/dist/model/malloy_types.js +2 -7
  68. package/dist/model/materialization/utils.js +1 -1
  69. package/dist/version.d.ts +1 -1
  70. package/dist/version.js +1 -1
  71. package/package.json +1 -1
@@ -25,10 +25,6 @@ export declare function exprHasKids(e: AnyExpr): e is ExprWithKids;
25
25
  export declare function exprHasE(e: AnyExpr): e is ExprE;
26
26
  export declare function exprIsLeaf(e: AnyExpr): boolean;
27
27
  export type Expr = BinaryExpr | UnaryExpr | FunctionCallNode | OutputFieldNode | FilterCondition | FilteredExpr | AggregateExpr | EmptyExpr | UngroupNode | FunctionParameterNode | SpreadExpr | AggregateOrderByNode | AggregateLimitNode | FieldnameNode | SourceReferenceNode | ParameterNode | NowNode | MeasureTimeExpr | TimeExtractExpr | TimeDeltaExpr | TimeTruncExpr | TimeLiteralNode | TypecastExpr | RegexMatchExpr | RegexLiteralNode | StringLiteralNode | NumberLiteralNode | BooleanLiteralNode | RecordLiteralNode | ArrayLiteralNode | FunctionOrderBy | GenericSQLExpr | NullNode | CaseExpr | InCompareExpr | CompositeFieldExpr | ErrorNode;
28
- interface HasTypeDef {
29
- typeDef: AtomicTypeDef;
30
- }
31
- export type TypedExpr = Expr & HasTypeDef;
32
28
  export type BinaryOperator = '+' | '-' | '*' | '%' | '/' | 'and' | 'or' | '=' | '!=' | '>' | '<' | '>=' | '<=' | 'coalesce' | 'like' | '!like';
33
29
  export interface BinaryExpr extends ExprWithKids {
34
30
  node: BinaryOperator;
@@ -196,7 +192,8 @@ export interface BooleanLiteralNode extends ExprLeaf {
196
192
  }
197
193
  export interface RecordLiteralNode extends ExprWithKids {
198
194
  node: 'recordLiteral';
199
- kids: Record<string, TypedExpr>;
195
+ kids: Record<string, Expr>;
196
+ typeDef: RecordTypeDef;
200
197
  }
201
198
  export interface ArrayLiteralNode extends ExprWithKids {
202
199
  node: 'arrayLiteral';
@@ -340,9 +337,10 @@ export declare function isExpressionTypeLEQ(e1: ExpressionType, e2: ExpressionTy
340
337
  export declare function maxExpressionType(e1: ExpressionType, e2: ExpressionType): ExpressionType;
341
338
  export declare function maxOfExpressionTypes(types: ExpressionType[]): ExpressionType;
342
339
  /** Grants access to the expression properties of a FieldDef */
343
- export declare function hasExpression<T extends FieldDef>(f: T): f is T & Expression & {
340
+ export interface HasExpression {
344
341
  e: Expr;
345
- };
342
+ }
343
+ export declare function hasExpression<T extends FieldDef>(f: T): f is T & Expression & HasExpression;
346
344
  export type TemporalFieldType = 'date' | 'timestamp';
347
345
  export declare function isTemporalField(s: string): s is TemporalFieldType;
348
346
  export type CastType = 'string' | 'number' | TemporalFieldType | 'boolean' | 'json';
@@ -402,9 +400,9 @@ export interface RepeatedRecordTypeDef extends ArrayDef {
402
400
  elementTypeDef: RecordElementTypeDef;
403
401
  join: 'many';
404
402
  }
405
- export type RecordFieldDef = RecordTypeDef & AtomicFieldDef;
406
- export type RepeatedRecordFieldDef = RepeatedRecordTypeDef & AtomicFieldDef;
407
- export declare function isRepeatedRecord(fd: FieldDef): fd is RepeatedRecordFieldDef;
403
+ export type RecordDef = RecordTypeDef & AtomicFieldDef;
404
+ export type RepeatedRecordDef = RepeatedRecordTypeDef & AtomicFieldDef;
405
+ export declare function isRepeatedRecord(fd: FieldDef): fd is RepeatedRecordDef;
408
406
  export interface ErrorTypeDef {
409
407
  type: 'error';
410
408
  }
@@ -413,7 +411,7 @@ export type JoinType = 'one' | 'many' | 'cross';
413
411
  export type JoinRelationship = 'one_to_one' | 'one_to_many' | 'many_to_one' | 'many_to_many';
414
412
  export type MatrixOperation = 'left' | 'right' | 'full' | 'inner';
415
413
  export declare function isMatrixOperation(x: string): x is MatrixOperation;
416
- export type JoinElementType = 'table' | 'sql_select' | 'query_source' | 'array' | 'record';
414
+ export type JoinElementType = 'composite' | 'table' | 'sql_select' | 'query_source' | 'array' | 'record';
417
415
  export interface JoinBase {
418
416
  type: JoinElementType;
419
417
  join: JoinType;
@@ -421,9 +419,8 @@ export interface JoinBase {
421
419
  onExpression?: Expr;
422
420
  onCompositeFieldUsage?: CompositeFieldUsage;
423
421
  }
424
- export type Joinable = TableSourceDef | SQLSourceDef | QuerySourceDef | RecordFieldDef | ArrayDef;
422
+ export type Joinable = CompositeSourceDef | TableSourceDef | SQLSourceDef | QuerySourceDef | RecordDef | ArrayDef;
425
423
  export type JoinFieldDef = JoinBase & Joinable;
426
- export type JoinFieldTypes = 'table' | 'sql_select' | 'query_source' | 'array' | 'record';
427
424
  export declare function isJoinable(sd: StructDef): sd is Joinable;
428
425
  export declare function isJoined<T extends FieldDef | StructDef>(fd: T): fd is T & Joinable & JoinBase;
429
426
  export declare function isJoinedSource(sd: StructDef): sd is SourceDef & JoinBase;
@@ -626,7 +623,7 @@ export type SourceDef = TableSourceDef | SQLSourceDef | QuerySourceDef | QueryRe
626
623
  /** Is this the "FROM" table of a query tree */
627
624
  export declare function isBaseTable(def: StructDef): def is SourceDef;
628
625
  export declare function isScalarArray(def: FieldDef | StructDef): boolean;
629
- export type StructDef = SourceDef | RecordFieldDef | ArrayDef;
626
+ export type StructDef = SourceDef | RecordDef | ArrayDef;
630
627
  export type NonAtomicType = Exclude<JoinElementType, 'array' | 'record'> | 'turtle' | 'null' | 'duration' | 'any' | 'regular expression';
631
628
  export interface NonAtomicTypeDef {
632
629
  type: NonAtomicType;
@@ -772,7 +769,7 @@ export interface QueryResult extends CompiledQuery {
772
769
  profilingUrl?: string;
773
770
  }
774
771
  export declare function isTurtleDef(def: FieldDef): def is TurtleDef;
775
- export declare function isAtomic(def: FieldDef): def is AtomicFieldDef;
772
+ export declare function isAtomic(def: FieldDef | StructDef): def is AtomicFieldDef;
776
773
  export interface SearchResultRow {
777
774
  field_name: string;
778
775
  field_value: string;
@@ -143,7 +143,6 @@ function maxOfExpressionTypes(types) {
143
143
  return types.reduce(maxExpressionType, 'scalar');
144
144
  }
145
145
  exports.maxOfExpressionTypes = maxOfExpressionTypes;
146
- /** Grants access to the expression properties of a FieldDef */
147
146
  function hasExpression(f) {
148
147
  return 'e' in f;
149
148
  }
@@ -182,12 +181,8 @@ function fieldIsIntrinsic(f) {
182
181
  exports.fieldIsIntrinsic = fieldIsIntrinsic;
183
182
  function arrayEachFields(arrayOf) {
184
183
  return [
185
- {
186
- name: 'each',
187
- ...arrayOf,
188
- e: { node: 'field', path: ['value'] },
189
- },
190
- { name: 'value', ...arrayOf },
184
+ { ...arrayOf, e: { node: 'field', path: ['value'] }, name: 'each' },
185
+ { ...arrayOf, name: 'value' },
191
186
  ];
192
187
  }
193
188
  exports.arrayEachFields = arrayEachFields;
@@ -3,7 +3,7 @@
3
3
  * Copyright (c) Meta Platforms, Inc. and affiliates.
4
4
  *
5
5
  * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
6
+ * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.buildQueryMaterializationSpec = exports.shouldMaterialize = void 0;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const MALLOY_VERSION = "0.0.219";
1
+ export declare const MALLOY_VERSION = "0.0.220";
package/dist/version.js CHANGED
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MALLOY_VERSION = void 0;
4
4
  // generated with 'generate-version-file' script; do not edit manually
5
- exports.MALLOY_VERSION = '0.0.219';
5
+ exports.MALLOY_VERSION = '0.0.220';
6
6
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.219",
3
+ "version": "0.0.220-dev241204170603",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",