@malloydata/malloy 0.0.117-dev240110181238 → 0.0.117-dev240110202509

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.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { DuckDBDialect, StandardSQLDialect, PostgresDialect, registerDialect, arg, qtz, overload, minScalar, anyExprType, minAggregate, maxScalar, sql, makeParam, sqlFragment, param, spread, Dialect, FUNCTIONS, } from './dialect';
2
2
  export type { DialectFieldList, DialectFunctionOverloadDef, QueryInfo, } from './dialect';
3
- export type { QueryDataRow, Fragment, StructDef, StructRelationship, NamedStructDefs, MalloyQueryData, AtomicFieldType as AtomicFieldTypeInner, DateUnit, ExtractUnit, TimestampUnit, TimeFieldType, QueryData, QueryValue, FieldTypeDef, Expr, DialectFragment, TimeValue, FilterExpression, SQLBlock, FieldAtomicDef, FieldDef, FilteredAliasedName, PipeSegment, QueryFieldDef, TurtleDef, SearchValueMapResult, SearchIndexResult, ModelDef, Query, QueryRunStats, NamedQuery, NamedModelObject, ExpressionType, FunctionDef, FunctionOverloadDef, FunctionParameterDef, ExpressionValueType, TypeDesc, FieldValueType, ExpressionTypeDesc, FunctionParamTypeDesc, DocumentLocation, DocumentRange, DocumentPosition, Sampling, TypecastFragment, Annotation, FieldAtomicTypeDef, SQLBlockStructDef, } from './model';
3
+ export type { QueryDataRow, Fragment, StructDef, StructRelationship, NamedStructDefs, MalloyQueryData, AtomicFieldType as AtomicFieldTypeInner, DateUnit, ExtractUnit, TimestampUnit, TimeFieldType, QueryData, QueryValue, FieldTypeDef, Expr, DialectFragment, TimeValue, FilterExpression, SQLBlock, FieldAtomicDef, FieldDef, FilteredAliasedName, PipeSegment, QueryFieldDef, TurtleDef, SearchValueMapResult, SearchIndexResult, ModelDef, Query, QueryResult, QueryRunStats, NamedQuery, NamedModelObject, ExpressionType, FunctionDef, FunctionOverloadDef, FunctionParameterDef, ExpressionValueType, TypeDesc, FieldValueType, ExpressionTypeDesc, FunctionParamTypeDesc, DocumentLocation, DocumentRange, DocumentPosition, Sampling, TypecastFragment, Annotation, FieldAtomicTypeDef, SQLBlockStructDef, } from './model';
4
4
  export { Segment, isFilteredAliasedName, isSamplingEnable, isSamplingPercent, isSamplingRows, mkExpr, expressionIsCalculation, indent, } from './model';
5
5
  export { HighlightType, MalloyTranslator, } from './lang';
6
6
  export type { LogMessage, TranslateResponse } from './lang';
package/dist/tags.d.ts CHANGED
@@ -42,7 +42,7 @@ export declare class Tag implements TagInterface {
42
42
  static ids: Map<Tag, number>;
43
43
  static nextTagId: number;
44
44
  static id(t: Tag): number;
45
- peek(): string;
45
+ peek(indent?: number): string;
46
46
  /**
47
47
  * Parse a line of Malloy tag language into a Tag which can be queried
48
48
  * @param source -- The source line to be parsed. If the string starts with #, then it skips
package/dist/tags.js CHANGED
@@ -60,22 +60,32 @@ class Tag {
60
60
  }
61
61
  return thisTagId;
62
62
  }
63
- peek() {
63
+ peek(indent = 0) {
64
+ const spaces = ' '.repeat(indent);
64
65
  let str = `#${Tag.id(this)}`;
66
+ if (this.properties === undefined &&
67
+ this.eq &&
68
+ typeof this.eq === 'string') {
69
+ return str + `=${this.eq}`;
70
+ }
71
+ str += ' {';
65
72
  if (this.eq) {
66
73
  if (typeof this.eq === 'string') {
67
- str += `=${this.eq}`;
74
+ str += `\n${spaces} =: ${this.eq}`;
68
75
  }
69
76
  else {
70
- str += '=[]';
77
+ str += `\n${spaces} =: [\n${spaces} ${this.eq
78
+ .map(el => new Tag(el).peek(indent + 4))
79
+ .join(`\n${spaces} `)}\n${spaces} ]`;
71
80
  }
72
81
  }
73
82
  if (this.properties) {
74
- const propStr = Object.keys(this.properties)
75
- .map(k => `${k}:`)
76
- .join(', ');
77
- str += `{${propStr}}`;
83
+ for (const k in this.properties) {
84
+ const val = new Tag(this.properties[k]);
85
+ str += `\n${spaces} ${k}: ${val.peek(indent + 2)}`;
86
+ }
78
87
  }
88
+ str += `\n${spaces}}`;
79
89
  return str;
80
90
  }
81
91
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.117-dev240110181238",
3
+ "version": "0.0.117-dev240110202509",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",