@malloydata/malloy 0.0.280 → 0.0.281

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.
@@ -297,29 +297,18 @@ class ExprFunc extends expression_def_1.ExpressionDef {
297
297
  else {
298
298
  const literal = str.literal;
299
299
  const parts = parseSQLInterpolation(literal);
300
- const unsupportedInterpolations = parts
301
- .filter(part => part.type === 'interpolation' && part.name.includes('.'))
302
- .map(unsupportedPart => unsupportedPart.type === 'interpolation'
303
- ? `\${${unsupportedPart.name}}`
304
- : `\${${unsupportedPart.value}}`);
305
- if (unsupportedInterpolations.length > 0) {
306
- const unsupportedInterpolationMsg = unsupportedInterpolations.length === 1
307
- ? `'.' paths are not yet supported in sql interpolations, found ${unsupportedInterpolations.at(0)}`
308
- : `'.' paths are not yet supported in sql interpolations, found (${unsupportedInterpolations.join(', ')})`;
309
- return this.loggedErrorExpr('unsupported-sql-function-interpolation', unsupportedInterpolationMsg);
310
- }
311
300
  const expr = [];
312
301
  for (const part of parts) {
313
302
  if (part.type === 'string') {
314
303
  expr.push(part.value);
315
304
  }
316
- else if (part.name === 'TABLE') {
305
+ else if (part.path.length === 1 && part.path[0] === 'TABLE') {
317
306
  expr.push({ node: 'source-reference' });
318
307
  }
319
308
  else {
320
- const name = new field_space_1.FieldName(part.name);
321
- this.has({ name });
322
- const result = fs.lookup([name]);
309
+ const names = part.path.map(p => new field_space_1.FieldName(p));
310
+ this.has({ names });
311
+ const result = fs.lookup(names);
323
312
  if (result.found === undefined) {
324
313
  return this.loggedErrorExpr('sql-function-interpolation-not-found', `Invalid interpolation: ${result.error.message}`);
325
314
  }
@@ -327,12 +316,13 @@ class ExprFunc extends expression_def_1.ExpressionDef {
327
316
  return this.loggedErrorExpr('filter-expression-error', 'Filter expressions cannot be used in sql_ functions');
328
317
  }
329
318
  if (result.found.refType === 'parameter') {
330
- expr.push({ node: 'parameter', path: [part.name] });
319
+ expr.push({ node: 'parameter', path: part.path });
331
320
  }
332
321
  else {
333
322
  expr.push({
334
323
  node: 'field',
335
- path: [part.name],
324
+ // TODO when we have namespaces, this will need to be replaced with the resolved path
325
+ path: part.path,
336
326
  at: this.args[0].location,
337
327
  });
338
328
  }
@@ -483,7 +473,9 @@ function parseSQLInterpolation(template) {
483
473
  }
484
474
  parts.push({
485
475
  type: 'interpolation',
486
- name: remaining.slice(nextInterp + 2, interpEnd + nextInterp),
476
+ path: remaining
477
+ .slice(nextInterp + 2, interpEnd + nextInterp)
478
+ .split('.'),
487
479
  });
488
480
  remaining = remaining.slice(interpEnd + nextInterp + 1);
489
481
  }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const MALLOY_VERSION = "0.0.280";
1
+ export declare const MALLOY_VERSION = "0.0.281";
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.280';
5
+ exports.MALLOY_VERSION = '0.0.281';
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.280",
3
+ "version": "0.0.281",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",
@@ -41,9 +41,9 @@
41
41
  "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"
42
42
  },
43
43
  "dependencies": {
44
- "@malloydata/malloy-filter": "0.0.280",
45
- "@malloydata/malloy-interfaces": "0.0.280",
46
- "@malloydata/malloy-tag": "0.0.280",
44
+ "@malloydata/malloy-filter": "0.0.281",
45
+ "@malloydata/malloy-interfaces": "0.0.281",
46
+ "@malloydata/malloy-tag": "0.0.281",
47
47
  "antlr4ts": "^0.5.0-alpha.4",
48
48
  "assert": "^2.0.0",
49
49
  "jaro-winkler": "^0.2.8",