@malloydata/malloy 0.0.261-dev250410013233 → 0.0.261-dev250410224049

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.
@@ -440,7 +440,7 @@ ${(0, utils_1.indent)(sql)}
440
440
  const typeSpec = [];
441
441
  for (const f of malloyType.fields) {
442
442
  if ((0, malloy_types_1.isAtomic)(f)) {
443
- typeSpec.push(`${f.name} ${this.malloyTypeToSQLType(f)}`);
443
+ typeSpec.push(`${this.sqlMaybeQuoteIdentifier(f.name)} ${this.malloyTypeToSQLType(f)}`);
444
444
  }
445
445
  }
446
446
  return `ROW(${typeSpec.join(',')})`;
@@ -452,7 +452,7 @@ ${(0, utils_1.indent)(sql)}
452
452
  const typeSpec = [];
453
453
  for (const f of malloyType.fields) {
454
454
  if ((0, malloy_types_1.isAtomic)(f)) {
455
- typeSpec.push(`${f.name} ${this.malloyTypeToSQLType(f)}`);
455
+ typeSpec.push(`${this.sqlMaybeQuoteIdentifier(f.name)} ${this.malloyTypeToSQLType(f)}`);
456
456
  }
457
457
  }
458
458
  return `ARRAY<ROW(${typeSpec.join(',')})>`;
@@ -79,12 +79,16 @@ const checkCustomErrorMessage = (parser, offendingSymbol, errorCases) => {
79
79
  let message = errReplace(errorCase.errorMessage);
80
80
  if (errorCase.alternatives) {
81
81
  const badWord = errReplace(errorCase.alternatives.replace);
82
- const distances = {};
83
- for (const w of errorCase.alternatives.with) {
84
- distances[w] = (0, jaro_winkler_1.default)(w, badWord);
82
+ let closest = errorCase.alternatives.with[0];
83
+ let close = (0, jaro_winkler_1.default)(closest, badWord);
84
+ for (const w of errorCase.alternatives.with.slice(1)) {
85
+ const howClose = (0, jaro_winkler_1.default)(w, badWord);
86
+ if (howClose > close) {
87
+ close = howClose;
88
+ closest = w;
89
+ }
85
90
  }
86
- const picks = errorCase.alternatives.with.sort((a, b) => distances[b] - distances[a]);
87
- message += ` Did you mean '${picks[0]}'?`;
91
+ message += ` Did you mean '${closest}'?`;
88
92
  }
89
93
  return message;
90
94
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.261-dev250410013233",
3
+ "version": "0.0.261-dev250410224049",
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.261-dev250410013233",
45
- "@malloydata/malloy-interfaces": "^0.0.261-dev250410013233",
46
- "@malloydata/malloy-tag": "^0.0.261-dev250410013233",
44
+ "@malloydata/malloy-filter": "^0.0.261-dev250410224049",
45
+ "@malloydata/malloy-interfaces": "^0.0.261-dev250410224049",
46
+ "@malloydata/malloy-tag": "^0.0.261-dev250410224049",
47
47
  "antlr4ts": "^0.5.0-alpha.4",
48
48
  "assert": "^2.0.0",
49
49
  "jaro-winkler": "^0.2.8",