@malloydata/malloy 0.0.199-dev241012152627 → 0.0.199-dev241012163309

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.
@@ -1,4 +1,4 @@
1
- import { Expr, Sampling, AtomicTypeDef, MeasureTimeExpr, TimeTruncExpr, TimeExtractExpr, TimeDeltaExpr, TypecastExpr, RegexMatchExpr, TimeLiteralNode, RecordLiteralNode, ArrayLiteralNode, LeafAtomicDef } from '../model/malloy_types';
1
+ import { Expr, Sampling, AtomicTypeDef, MeasureTimeExpr, TimeTruncExpr, TimeExtractExpr, TimeDeltaExpr, TypecastExpr, RegexMatchExpr, TimeLiteralNode, RecordLiteralNode, ArrayLiteralNode, LeafAtomicTypeDef } from '../model/malloy_types';
2
2
  import { DialectFunctionOverloadDef } from './functions';
3
3
  type DialectFieldTypes = string | 'struct';
4
4
  interface DialectField {
@@ -120,7 +120,7 @@ export declare abstract class Dialect {
120
120
  sqlTzStr(qi: QueryInfo): string;
121
121
  sqlMakeUnnestKey(key: string, rowKey: string): string;
122
122
  sqlStringAggDistinct(distinctKey: string, valueSQL: string, separatorSQL: string): string;
123
- abstract sqlTypeToMalloyType(sqlType: string): LeafAtomicDef;
123
+ abstract sqlTypeToMalloyType(sqlType: string): LeafAtomicTypeDef;
124
124
  abstract malloyTypeToSQLType(malloyType: AtomicTypeDef): string;
125
125
  abstract validateTypeName(sqlType: string): boolean;
126
126
  }
@@ -1,4 +1,4 @@
1
- import { Sampling, AtomicTypeDef, TimeDeltaExpr, RegexMatchExpr, MeasureTimeExpr, LeafAtomicDef } from '../../model/malloy_types';
1
+ import { Sampling, AtomicTypeDef, TimeDeltaExpr, RegexMatchExpr, MeasureTimeExpr, LeafAtomicTypeDef } from '../../model/malloy_types';
2
2
  import { DialectFunctionOverloadDef } from '../functions';
3
3
  import { DialectFieldList } from '../dialect';
4
4
  import { PostgresBase } from '../pg_impl';
@@ -56,7 +56,7 @@ export declare class DuckDBDialect extends PostgresBase {
56
56
  [name: string]: DialectFunctionOverloadDef[];
57
57
  };
58
58
  malloyTypeToSQLType(malloyType: AtomicTypeDef): string;
59
- sqlTypeToMalloyType(sqlType: string): LeafAtomicDef;
59
+ sqlTypeToMalloyType(sqlType: string): LeafAtomicTypeDef;
60
60
  castToString(expression: string): string;
61
61
  concat(...values: string[]): string;
62
62
  validateTypeName(sqlType: string): boolean;
@@ -1,4 +1,4 @@
1
- import { Sampling, MeasureTimeExpr, TimeLiteralNode, RegexMatchExpr, TimeDeltaExpr, TimeTruncExpr, TimeExtractExpr, TypecastExpr, LeafAtomicDef, AtomicTypeDef } from '../../model/malloy_types';
1
+ import { Sampling, MeasureTimeExpr, TimeLiteralNode, RegexMatchExpr, TimeDeltaExpr, TimeTruncExpr, TimeExtractExpr, TypecastExpr, LeafAtomicTypeDef, AtomicTypeDef } from '../../model/malloy_types';
2
2
  import { Dialect, DialectFieldList, QueryInfo } from '../dialect';
3
3
  import { DialectFunctionOverloadDef } from '../functions';
4
4
  export declare class MySQLDialect extends Dialect {
@@ -29,7 +29,7 @@ export declare class MySQLDialect extends Dialect {
29
29
  supportsComplexFilteredSources: boolean;
30
30
  supportsArraysInData: boolean;
31
31
  malloyTypeToSQLType(malloyType: AtomicTypeDef): string;
32
- sqlTypeToMalloyType(sqlType: string): LeafAtomicDef;
32
+ sqlTypeToMalloyType(sqlType: string): LeafAtomicTypeDef;
33
33
  quoteTablePath(tablePath: string): string;
34
34
  sqlGroupSetTable(groupSetCount: number): string;
35
35
  sqlAnyValue(_groupSet: number, fieldName: string): string;
@@ -1,4 +1,4 @@
1
- import { Sampling, AtomicTypeDef, TimeDeltaExpr, TypecastExpr, MeasureTimeExpr, LeafAtomicDef } from '../../model/malloy_types';
1
+ import { Sampling, AtomicTypeDef, TimeDeltaExpr, TypecastExpr, MeasureTimeExpr, LeafAtomicTypeDef } from '../../model/malloy_types';
2
2
  import { DialectFunctionOverloadDef } from '../functions';
3
3
  import { DialectFieldList, QueryInfo } from '../dialect';
4
4
  import { PostgresBase } from '../pg_impl';
@@ -59,7 +59,7 @@ export declare class PostgresDialect extends PostgresBase {
59
59
  [name: string]: DialectFunctionOverloadDef[];
60
60
  };
61
61
  malloyTypeToSQLType(malloyType: AtomicTypeDef): string;
62
- sqlTypeToMalloyType(sqlType: string): LeafAtomicDef;
62
+ sqlTypeToMalloyType(sqlType: string): LeafAtomicTypeDef;
63
63
  castToString(expression: string): string;
64
64
  concat(...values: string[]): string;
65
65
  validateTypeName(sqlType: string): boolean;
@@ -1,4 +1,4 @@
1
- import { Sampling, AtomicTypeDef, TimeTruncExpr, TimeExtractExpr, TimeDeltaExpr, TypecastExpr, TimeLiteralNode, MeasureTimeExpr, RegexMatchExpr, LeafAtomicDef } from '../../model/malloy_types';
1
+ import { Sampling, AtomicTypeDef, TimeTruncExpr, TimeExtractExpr, TimeDeltaExpr, TypecastExpr, TimeLiteralNode, MeasureTimeExpr, RegexMatchExpr, LeafAtomicTypeDef } from '../../model/malloy_types';
2
2
  import { DialectFunctionOverloadDef } from '../functions';
3
3
  import { Dialect, DialectFieldList, QueryInfo } from '../dialect';
4
4
  export declare class SnowflakeDialect extends Dialect {
@@ -63,7 +63,7 @@ export declare class SnowflakeDialect extends Dialect {
63
63
  [name: string]: DialectFunctionOverloadDef[];
64
64
  };
65
65
  malloyTypeToSQLType(malloyType: AtomicTypeDef): string;
66
- sqlTypeToMalloyType(sqlType: string): LeafAtomicDef;
66
+ sqlTypeToMalloyType(sqlType: string): LeafAtomicTypeDef;
67
67
  castToString(expression: string): string;
68
68
  concat(...values: string[]): string;
69
69
  validateTypeName(sqlType: string): boolean;
@@ -1,4 +1,4 @@
1
- import { Sampling, AtomicTypeDef, TimeTruncExpr, TimeExtractExpr, TimeDeltaExpr, TypecastExpr, RegexMatchExpr, TimeLiteralNode, MeasureTimeExpr, LeafAtomicDef } from '../../model/malloy_types';
1
+ import { Sampling, AtomicTypeDef, TimeTruncExpr, TimeExtractExpr, TimeDeltaExpr, TypecastExpr, RegexMatchExpr, TimeLiteralNode, MeasureTimeExpr, LeafAtomicTypeDef } from '../../model/malloy_types';
2
2
  import { DialectFunctionOverloadDef } from '../functions';
3
3
  import { Dialect, DialectFieldList, QueryInfo } from '../dialect';
4
4
  export declare class StandardSQLDialect extends Dialect {
@@ -60,7 +60,7 @@ export declare class StandardSQLDialect extends Dialect {
60
60
  [name: string]: DialectFunctionOverloadDef[];
61
61
  };
62
62
  malloyTypeToSQLType(malloyType: AtomicTypeDef): string;
63
- sqlTypeToMalloyType(sqlType: string): LeafAtomicDef;
63
+ sqlTypeToMalloyType(sqlType: string): LeafAtomicTypeDef;
64
64
  castToString(expression: string): string;
65
65
  concat(...values: string[]): string;
66
66
  validateTypeName(sqlType: string): boolean;
@@ -1,4 +1,4 @@
1
- import { Expr, Sampling, AtomicTypeDef, TimeDeltaExpr, TypecastExpr, RegexMatchExpr, MeasureTimeExpr, TimeLiteralNode, TimeExtractExpr, LeafAtomicDef } from '../../model/malloy_types';
1
+ import { Expr, Sampling, AtomicTypeDef, TimeDeltaExpr, TypecastExpr, RegexMatchExpr, MeasureTimeExpr, TimeLiteralNode, TimeExtractExpr, LeafAtomicTypeDef } from '../../model/malloy_types';
2
2
  import { DialectFunctionOverloadDef } from '../functions';
3
3
  import { DialectFieldList, OrderByClauseType, QueryInfo } from '../dialect';
4
4
  import { PostgresBase } from '../pg_impl';
@@ -65,7 +65,7 @@ export declare class TrinoDialect extends PostgresBase {
65
65
  [name: string]: DialectFunctionOverloadDef[];
66
66
  };
67
67
  malloyTypeToSQLType(malloyType: AtomicTypeDef): string;
68
- sqlTypeToMalloyType(sqlType: string): LeafAtomicDef;
68
+ sqlTypeToMalloyType(sqlType: string): LeafAtomicTypeDef;
69
69
  castToString(expression: string): string;
70
70
  concat(...values: string[]): string;
71
71
  sqlMakeUnnestKey(key: string, rowKey: string): string;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { DuckDBDialect, StandardSQLDialect, TrinoDialect, PostgresDialect, SnowflakeDialect, MySQLDialect, registerDialect, arg, qtz, overload, minScalar, anyExprType, minAggregate, maxScalar, sql, makeParam, param, variadicParam, literal, spread, Dialect, } from './dialect';
2
2
  export type { DialectFieldList, DialectFunctionOverloadDef, QueryInfo, MalloyStandardFunctionImplementations, DefinitionBlueprint, DefinitionBlueprintMap, OverloadedDefinitionBlueprint, } from './dialect';
3
- export type { QueryDataRow, StructDef, TableSourceDef, SQLSourceDef, SourceDef, JoinFieldDef, NamedSourceDefs as NamedStructDefs, MalloyQueryData, DateUnit, ExtractUnit, TimestampUnit, TemporalFieldType as TimeFieldType, QueryData, QueryValue, Expr, FilterCondition, SQLSentence, FieldDef, PipeSegment, QueryFieldDef, IndexFieldDef, TurtleDef, SearchValueMapResult, SearchIndexResult, ModelDef, Query, QueryResult, QueryRunStats, NamedQuery, NamedModelObject, ExpressionType, FunctionDef, FunctionOverloadDef, FunctionParameterDef, ExpressionValueType, TypeDesc, FieldValueType, ExpressionTypeDesc, FunctionParamTypeDesc, DocumentLocation, DocumentRange, DocumentPosition, Sampling, Annotation, LeafAtomicDef, AtomicTypeDef, AtomicFieldDef, JoinedArrayDef, JoinedArrayTypeDef, RecordTypeDef, RepeatedRecordTypeDef, } from './model';
4
- export { arrayEachFields, isRepeatedRecord, isSourceDef, Segment, isSamplingEnable, isSamplingPercent, isSamplingRows, expressionIsCalculation, indent, composeSQLExpr, } from './model';
3
+ export type { QueryDataRow, StructDef, TableSourceDef, SQLSourceDef, SourceDef, JoinFieldDef, NamedSourceDefs, MalloyQueryData, DateUnit, ExtractUnit, TimestampUnit, TemporalFieldType, QueryData, QueryValue, Expr, FilterCondition, SQLSentence, FieldDef, PipeSegment, QueryFieldDef, IndexFieldDef, TurtleDef, SearchValueMapResult, SearchIndexResult, ModelDef, Query, QueryResult, QueryRunStats, NamedQuery, NamedModelObject, ExpressionType, FunctionDef, FunctionOverloadDef, FunctionParameterDef, ExpressionValueType, TypeDesc, FieldValueType, ExpressionTypeDesc, FunctionParamTypeDesc, DocumentLocation, DocumentRange, DocumentPosition, Sampling, Annotation, LeafAtomicTypeDef, LeafAtomicDef, AtomicTypeDef, AtomicFieldDef, JoinedArrayDef, JoinedArrayTypeDef, RecordTypeDef, RepeatedRecordTypeDef, } from './model';
4
+ export { arrayEachFields, isRepeatedRecord, isSourceDef, Segment, isLeafAtomic, isJoined, isJoinedSource, isSamplingEnable, isSamplingPercent, isSamplingRows, expressionIsCalculation, indent, composeSQLExpr, } from './model';
5
5
  export { MalloyTranslator, } from './lang';
6
6
  export type { LogMessage, TranslateResponse } from './lang';
7
7
  export { Model, Malloy, Runtime, AtomicFieldType, ConnectionRuntime, SingleConnectionRuntime, EmptyURLReader, InMemoryURLReader, FixedConnectionMap, MalloyError, JoinRelationship, SourceRelationship, DateTimeframe, TimestampTimeframe, PreparedResult, Result, QueryMaterializer, CSVWriter, JSONWriter, Parse, DataWriter, Explore, } from './malloy';
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CSVWriter = exports.QueryMaterializer = exports.Result = exports.PreparedResult = exports.TimestampTimeframe = exports.DateTimeframe = exports.SourceRelationship = exports.JoinRelationship = exports.MalloyError = exports.FixedConnectionMap = exports.InMemoryURLReader = exports.EmptyURLReader = exports.SingleConnectionRuntime = exports.ConnectionRuntime = exports.AtomicFieldType = exports.Runtime = exports.Malloy = exports.Model = exports.MalloyTranslator = exports.composeSQLExpr = exports.indent = exports.expressionIsCalculation = exports.isSamplingRows = exports.isSamplingPercent = exports.isSamplingEnable = exports.Segment = exports.isSourceDef = exports.isRepeatedRecord = exports.arrayEachFields = exports.Dialect = exports.spread = exports.literal = exports.variadicParam = exports.param = exports.makeParam = exports.sql = exports.maxScalar = exports.minAggregate = exports.anyExprType = exports.minScalar = exports.overload = exports.qtz = exports.arg = exports.registerDialect = exports.MySQLDialect = exports.SnowflakeDialect = exports.PostgresDialect = exports.TrinoDialect = exports.StandardSQLDialect = exports.DuckDBDialect = void 0;
4
- exports.Tag = exports.toAsyncGenerator = exports.Explore = exports.DataWriter = exports.Parse = exports.JSONWriter = void 0;
3
+ exports.PreparedResult = exports.TimestampTimeframe = exports.DateTimeframe = exports.SourceRelationship = exports.JoinRelationship = exports.MalloyError = exports.FixedConnectionMap = exports.InMemoryURLReader = exports.EmptyURLReader = exports.SingleConnectionRuntime = exports.ConnectionRuntime = exports.AtomicFieldType = exports.Runtime = exports.Malloy = exports.Model = exports.MalloyTranslator = exports.composeSQLExpr = exports.indent = exports.expressionIsCalculation = exports.isSamplingRows = exports.isSamplingPercent = exports.isSamplingEnable = exports.isJoinedSource = exports.isJoined = exports.isLeafAtomic = exports.Segment = exports.isSourceDef = exports.isRepeatedRecord = exports.arrayEachFields = exports.Dialect = exports.spread = exports.literal = exports.variadicParam = exports.param = exports.makeParam = exports.sql = exports.maxScalar = exports.minAggregate = exports.anyExprType = exports.minScalar = exports.overload = exports.qtz = exports.arg = exports.registerDialect = exports.MySQLDialect = exports.SnowflakeDialect = exports.PostgresDialect = exports.TrinoDialect = exports.StandardSQLDialect = exports.DuckDBDialect = void 0;
4
+ exports.Tag = exports.toAsyncGenerator = exports.Explore = exports.DataWriter = exports.Parse = exports.JSONWriter = exports.CSVWriter = exports.QueryMaterializer = exports.Result = void 0;
5
5
  /*
6
6
  * Copyright 2023 Google LLC
7
7
  *
@@ -52,6 +52,9 @@ Object.defineProperty(exports, "isRepeatedRecord", { enumerable: true, get: func
52
52
  Object.defineProperty(exports, "isSourceDef", { enumerable: true, get: function () { return model_1.isSourceDef; } });
53
53
  // Used in Composer Demo
54
54
  Object.defineProperty(exports, "Segment", { enumerable: true, get: function () { return model_1.Segment; } });
55
+ Object.defineProperty(exports, "isLeafAtomic", { enumerable: true, get: function () { return model_1.isLeafAtomic; } });
56
+ Object.defineProperty(exports, "isJoined", { enumerable: true, get: function () { return model_1.isJoined; } });
57
+ Object.defineProperty(exports, "isJoinedSource", { enumerable: true, get: function () { return model_1.isJoinedSource; } });
55
58
  Object.defineProperty(exports, "isSamplingEnable", { enumerable: true, get: function () { return model_1.isSamplingEnable; } });
56
59
  Object.defineProperty(exports, "isSamplingPercent", { enumerable: true, get: function () { return model_1.isSamplingPercent; } });
57
60
  Object.defineProperty(exports, "isSamplingRows", { enumerable: true, get: function () { return model_1.isSamplingRows; } });
@@ -658,9 +658,11 @@ export interface ConnectionDef extends NamedObject {
658
658
  type: 'connection';
659
659
  }
660
660
  export type TemporalTypeDef = DateTypeDef | TimestampTypeDef;
661
- export type LeafAtomicDef = StringTypeDef | TemporalTypeDef | NumberTypeDef | BooleanTypeDef | JSONTypeDef | NativeUnsupportedTypeDef | ErrorTypeDef;
662
- export type AtomicTypeDef = LeafAtomicDef | ArrayTypeDef | RecordTypeDef;
661
+ export type LeafAtomicTypeDef = StringTypeDef | TemporalTypeDef | NumberTypeDef | BooleanTypeDef | JSONTypeDef | NativeUnsupportedTypeDef | ErrorTypeDef;
662
+ export type AtomicTypeDef = LeafAtomicTypeDef | ArrayTypeDef | RecordTypeDef;
663
+ export type LeafAtomicDef = LeafAtomicTypeDef & FieldAtomicBase;
663
664
  export type AtomicFieldDef = AtomicTypeDef & FieldAtomicBase;
665
+ export declare function isLeafAtomic(fd: FieldDef | QueryFieldDef): fd is LeafAtomicDef;
664
666
  export type FieldDef = AtomicFieldDef | JoinFieldDef | TurtleDef;
665
667
  export interface RefToField {
666
668
  type: 'fieldref';
@@ -23,7 +23,7 @@
23
23
  */
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
25
  exports.mergeEvalSpaces = exports.isLiteral = exports.isScalarArray = exports.isBaseTable = exports.isSourceDef = exports.sourceBase = exports.isSegmentSQL = exports.isIndexSegment = exports.isRawSegment = exports.isSamplingEnable = exports.isSamplingPercent = exports.isSamplingRows = exports.isQuerySegment = exports.isProjectSegment = exports.isPartialSegment = exports.isReduceSegment = exports.structHasErrors = exports.segmentHasErrors = exports.refIsStructDef = exports.isByExpression = exports.isByName = exports.ValueType = exports.isExtractUnit = exports.isTimestampUnit = exports.isDateUnit = exports.isJoinedSource = exports.isJoined = exports.isJoinable = exports.isMatrixOperation = exports.isRepeatedRecord = exports.arrayEachFields = exports.fieldIsIntrinsic = exports.isCastType = exports.isAtomicFieldType = exports.isTemporalField = exports.hasExpression = exports.maxOfExpressionTypes = exports.maxExpressionType = exports.isExpressionTypeLEQ = exports.expressionIsAnalytic = exports.expressionIsCalculation = exports.expressionInvolvesAggregate = exports.expressionIsUngroupedAggregate = exports.expressionIsAggregate = exports.expressionIsScalar = exports.paramHasValue = exports.isAsymmetricExpr = exports.exprIsLeaf = exports.exprHasE = exports.exprHasKids = void 0;
26
- exports.isValueDate = exports.isValueTimestamp = exports.isValueBoolean = exports.isValueNumber = exports.isValueString = exports.getAtomicFields = exports.isAtomic = exports.isTurtleDef = exports.modelObjIsSource = exports.getIdentifier = void 0;
26
+ exports.isValueDate = exports.isValueTimestamp = exports.isValueBoolean = exports.isValueNumber = exports.isValueString = exports.getAtomicFields = exports.isAtomic = exports.isTurtleDef = exports.modelObjIsSource = exports.getIdentifier = exports.isLeafAtomic = void 0;
27
27
  function exprHasKids(e) {
28
28
  return 'kids' in e;
29
29
  }
@@ -319,6 +319,16 @@ function mergeEvalSpaces(...evalSpaces) {
319
319
  return 'input';
320
320
  }
321
321
  exports.mergeEvalSpaces = mergeEvalSpaces;
322
+ function isLeafAtomic(fd) {
323
+ return (fd.type === 'string' ||
324
+ isTemporalField(fd.type) ||
325
+ fd.type === 'number' ||
326
+ fd.type === 'boolean' ||
327
+ fd.type === 'json' ||
328
+ fd.type === 'sql native' ||
329
+ fd.type === 'error');
330
+ }
331
+ exports.isLeafAtomic = isLeafAtomic;
322
332
  /** Get the output name for a NamedObject */
323
333
  function getIdentifier(n) {
324
334
  if (n.as !== undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.199-dev241012152627",
3
+ "version": "0.0.199-dev241012163309",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",