@malloydata/malloy 0.0.403 → 0.0.404

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 (43) hide show
  1. package/dist/api/foundation/core.js +6 -6
  2. package/dist/api/foundation/result.js +1 -2
  3. package/dist/dialect/dialect.d.ts +9 -4
  4. package/dist/dialect/dialect.js +35 -11
  5. package/dist/dialect/pg_impl.d.ts +1 -0
  6. package/dist/dialect/pg_impl.js +8 -0
  7. package/dist/dialect/snowflake/snowflake.js +4 -5
  8. package/dist/dialect/trino/trino.d.ts +1 -0
  9. package/dist/dialect/trino/trino.js +27 -6
  10. package/dist/lang/ast/expressions/expr-func.js +4 -4
  11. package/dist/lang/ast/field-space/dynamic-space.js +2 -2
  12. package/dist/lang/ast/field-space/include-utils.js +4 -4
  13. package/dist/lang/ast/field-space/query-spaces.js +6 -8
  14. package/dist/lang/ast/field-space/refined-space.js +6 -6
  15. package/dist/lang/ast/field-space/rename-space-field.js +6 -9
  16. package/dist/lang/ast/field-space/static-space.js +1 -1
  17. package/dist/lang/ast/field-space/struct-space-field-base.js +1 -1
  18. package/dist/lang/ast/query-properties/drill.js +3 -6
  19. package/dist/lang/ast/source-elements/composite-source.js +1 -2
  20. package/dist/lang/ast/source-elements/sql-source.js +6 -8
  21. package/dist/lang/ast/source-elements/table-source.js +8 -10
  22. package/dist/lang/ast/source-elements/typed-source.js +2 -3
  23. package/dist/lang/ast/source-properties/join.js +3 -5
  24. package/dist/lang/ast/source-query-elements/sq-reference.js +1 -1
  25. package/dist/lang/ast/statements/define-source.js +1 -1
  26. package/dist/lang/ast/types/malloy-element.d.ts +1 -0
  27. package/dist/lang/ast/types/malloy-element.js +9 -7
  28. package/dist/lang/composite-source-utils.js +13 -17
  29. package/dist/lang/field-utils.js +2 -2
  30. package/dist/lang/test/test-translator.js +2 -4
  31. package/dist/model/field_instance.js +1 -1
  32. package/dist/model/malloy_types.d.ts +7 -2
  33. package/dist/model/malloy_types.js +11 -8
  34. package/dist/model/query_model_impl.d.ts +0 -1
  35. package/dist/model/query_model_impl.js +9 -28
  36. package/dist/model/query_node.d.ts +1 -10
  37. package/dist/model/query_node.js +8 -42
  38. package/dist/model/query_query.js +2 -2
  39. package/dist/model/utils.js +3 -3
  40. package/dist/to_stable.js +7 -9
  41. package/dist/version.d.ts +1 -1
  42. package/dist/version.js +1 -1
  43. package/package.json +4 -4
package/dist/to_stable.js CHANGED
@@ -50,7 +50,6 @@ const model_1 = require("./model");
50
50
  const annotation_1 = require("./api/foundation/annotation");
51
51
  const malloy_tag_1 = require("@malloydata/malloy-tag");
52
52
  function sourceDefToSourceInfo(sourceDef) {
53
- var _a;
54
53
  const parameters = sourceDef.parameters && Object.entries(sourceDef.parameters).length > 0
55
54
  ? Object.entries(sourceDef.parameters).map(([name, parameter]) => {
56
55
  if ((0, model_1.isAtomic)(parameter)) {
@@ -73,7 +72,7 @@ function sourceDefToSourceInfo(sourceDef) {
73
72
  })
74
73
  : undefined;
75
74
  const sourceInfo = {
76
- name: (_a = sourceDef.as) !== null && _a !== void 0 ? _a : sourceDef.name,
75
+ name: (0, model_1.activeName)(sourceDef),
77
76
  schema: {
78
77
  fields: convertFieldInfos(sourceDef, sourceDef.fields),
79
78
  },
@@ -183,7 +182,6 @@ function toStableAnnotations(annot) {
183
182
  return new annotation_1.Annotations(annot).texts().map(value => ({ value }));
184
183
  }
185
184
  function convertFieldInfos(source, fields) {
186
- var _a, _b, _c;
187
185
  const result = [];
188
186
  for (const field of fields) {
189
187
  const isPublic = field.accessModifier === undefined;
@@ -202,7 +200,7 @@ function convertFieldInfos(source, fields) {
202
200
  ];
203
201
  const fieldInfo = {
204
202
  kind: 'view',
205
- name: (_a = field.as) !== null && _a !== void 0 ? _a : field.name,
203
+ name: (0, model_1.activeName)(field),
206
204
  annotations: fieldAnnotations.length > 0 ? fieldAnnotations : undefined,
207
205
  schema: { fields: convertFieldInfos(outputStruct, outputStruct.fields) },
208
206
  };
@@ -232,7 +230,7 @@ function convertFieldInfos(source, fields) {
232
230
  ];
233
231
  const fieldInfo = {
234
232
  kind: aggregate ? 'measure' : 'dimension',
235
- name: (_b = field.as) !== null && _b !== void 0 ? _b : field.name,
233
+ name: (0, model_1.activeName)(field),
236
234
  type: typeDefToType(field),
237
235
  annotations: fieldAnnotations.length > 0 ? fieldAnnotations : undefined,
238
236
  };
@@ -241,7 +239,7 @@ function convertFieldInfos(source, fields) {
241
239
  else if ((0, model_1.isJoinedSource)(field)) {
242
240
  const fieldInfo = {
243
241
  kind: 'join',
244
- name: (_c = field.as) !== null && _c !== void 0 ? _c : field.name,
242
+ name: (0, model_1.activeName)(field),
245
243
  annotations,
246
244
  schema: {
247
245
  fields: convertFieldInfos(field, field.fields),
@@ -330,7 +328,7 @@ function identifierCode(name) {
330
328
  return `\`${escapeIdentifier(name)}\``;
331
329
  }
332
330
  function getResultStructMetadataAnnotation(field, resultMetadata) {
333
- var _a, _b;
331
+ var _a;
334
332
  const tag = malloy_tag_1.Tag.withPrefix('#(malloy) ');
335
333
  let hasAny = false;
336
334
  if (resultMetadata.limit !== undefined) {
@@ -349,9 +347,9 @@ function getResultStructMetadataAnnotation(field, resultMetadata) {
349
347
  for (let i = 0; i < resultMetadata.orderBy.length; i++) {
350
348
  const orderBy = resultMetadata.orderBy[i];
351
349
  const orderByField = typeof orderBy.field === 'number'
352
- ? ((_a = field.fields[orderBy.field - 1].as) !== null && _a !== void 0 ? _a : field.fields[orderBy.field - 1].name)
350
+ ? (0, model_1.activeName)(field.fields[orderBy.field - 1])
353
351
  : orderBy.field;
354
- const direction = (_b = orderBy.dir) !== null && _b !== void 0 ? _b : null;
352
+ const direction = (_a = orderBy.dir) !== null && _a !== void 0 ? _a : null;
355
353
  tag.set(['ordered_by', i, orderByField], direction);
356
354
  }
357
355
  hasAny = true;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const MALLOY_VERSION = "0.0.403";
1
+ export declare const MALLOY_VERSION = "0.0.404";
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.403';
5
+ exports.MALLOY_VERSION = '0.0.404';
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.403",
3
+ "version": "0.0.404",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",
@@ -51,9 +51,9 @@
51
51
  "generate-version-file": "VERSION=$(npm pkg get version --workspaces=false | tr -d \\\")\necho \"// generated with 'generate-version-file' script; do not edit manually\\nexport const MALLOY_VERSION = '$VERSION';\" > src/version.ts"
52
52
  },
53
53
  "dependencies": {
54
- "@malloydata/malloy-filter": "0.0.403",
55
- "@malloydata/malloy-interfaces": "0.0.403",
56
- "@malloydata/malloy-tag": "0.0.403",
54
+ "@malloydata/malloy-filter": "0.0.404",
55
+ "@malloydata/malloy-interfaces": "0.0.404",
56
+ "@malloydata/malloy-tag": "0.0.404",
57
57
  "@noble/hashes": "^1.8.0",
58
58
  "antlr4ts": "^0.5.0-alpha.4",
59
59
  "assert": "^2.0.0",