@dbml/parse 8.2.3 → 8.2.4

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.
@@ -1249,8 +1249,8 @@ var isAbsolute = function(r) {
1249
1249
  return r.path.startsWith(j);
1250
1250
  }
1251
1251
  toUri(r = {}) {
1252
- let j = r.protocol ?? this.protocol;
1253
- if (j === void 0) return this.path;
1252
+ let j = r.protocol || this.protocol;
1253
+ if (!j) return this.path;
1254
1254
  let M = WIN_DRIVE_RE.test(this.path) ? `${j}:///` : `${j}://`;
1255
1255
  return new URL(M + this.path).href;
1256
1256
  }
@@ -3169,7 +3169,10 @@ var IndexesBinder = class {
3169
3169
  this.compiler = r, this.declarationNode = j;
3170
3170
  }
3171
3171
  bind() {
3172
- return !(this.declarationNode.parent instanceof ElementDeclarationNode) || !this.declarationNode.parent.isKind(ElementKind.Table) || !(this.declarationNode.body instanceof BlockExpressionNode) ? [] : this.bindBody(this.declarationNode.body);
3172
+ return !(this.declarationNode.parent instanceof ElementDeclarationNode) || !this.declarationNode.parent.isKind(ElementKind.Table) && !this.declarationNode.parent.isKind(ElementKind.TablePartial) || !(this.declarationNode.body instanceof BlockExpressionNode) ? [] : this.bindBody(this.declarationNode.body);
3173
+ }
3174
+ get ownerContainerKind() {
3175
+ return this.declarationNode.parent.isKind(ElementKind.TablePartial) ? "TablePartial" : "Table";
3173
3176
  }
3174
3177
  bindBody(r) {
3175
3178
  if (!r) return [];
@@ -3181,11 +3184,11 @@ var IndexesBinder = class {
3181
3184
  return r.flatMap((r) => {
3182
3185
  if (!r.callee) return [];
3183
3186
  let M = destructureComplexVariable(this.declarationNode.parent.name)?.join(".") ?? "<unnamed>";
3184
- return [r.callee, ...r.args].flatMap(scanNonListNodeForBinding).flatMap((r) => r.variables.length + r.tupleElements.length > 1 ? [] : r.variables.length ? r.variables[0] : r.tupleElements).flatMap((r) => {
3187
+ return [r.callee, ...r.args].flatMap(scanNonListNodeForBinding).flatMap((r) => r.variables.length > 1 ? [] : r.variables.length ? r.variables[0] : r.tupleElements).flatMap((r) => {
3185
3188
  let N = extractVarNameFromPrimaryVariable(r);
3186
3189
  if (N === void 0) return [];
3187
3190
  let P = this.compiler.nodeReferee(r);
3188
- return !P.getValue() || P.hasValue(UNHANDLED) ? new CompileError(CompileErrorCode.BINDING_ERROR, `No column named '${N}' inside Table '${M}'`, r) : [];
3191
+ return !P.getValue() || P.hasValue(UNHANDLED) ? new CompileError(CompileErrorCode.BINDING_ERROR, `No column named '${N}' inside ${this.ownerContainerKind} '${M}'`, r) : [];
3189
3192
  });
3190
3193
  });
3191
3194
  }
@@ -11964,7 +11967,7 @@ var DBMLDefinitionProvider = class {
11964
11967
  let P;
11965
11968
  if (M.declaration && [SyntaxNodeKind.PRIMARY_EXPRESSION, SyntaxNodeKind.VARIABLE].includes(r.kind) && ({declaration: P} = M), P) {
11966
11969
  let { startPos: r, endPos: j } = P, M = N;
11967
- return N && P.filepath && (M = URI.parse(P.filepath.toUri())), [{
11970
+ return N && P.filepath && (M = URI.parse(P.filepath.toUri({ protocol: N.scheme }))), [{
11968
11971
  range: {
11969
11972
  startColumn: r.column + 1,
11970
11973
  startLineNumber: r.line + 1,
@@ -12035,7 +12038,7 @@ var DBMLDefinitionProvider = class {
12035
12038
  let M = this.compiler.nodeSymbol(r).getFiltered(UNHANDLED) ?? this.compiler.nodeReferee(r).getFiltered(UNHANDLED), P = M ? this.compiler.symbolReferences(M) : void 0;
12036
12039
  if (P && P.length > 0) return P.map((r) => {
12037
12040
  let j = N;
12038
- return N && r.filepath && (j = URI.parse(r.filepath.toUri())), {
12041
+ return N && r.filepath && (j = URI.parse(r.filepath.toUri({ protocol: N.scheme }))), {
12039
12042
  range: {
12040
12043
  startColumn: r.startPos.column + 1,
12041
12044
  startLineNumber: r.startPos.line + 1,
@@ -6,6 +6,7 @@ export default class IndexesBinder {
6
6
  private declarationNode;
7
7
  constructor(compiler: Compiler, declarationNode: ElementDeclarationNode);
8
8
  bind(): CompileError[];
9
+ private get ownerContainerKind();
9
10
  private bindBody;
10
11
  private bindFields;
11
12
  private bindSubElements;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@dbml/parse",
4
- "version": "8.2.3",
4
+ "version": "8.2.4",
5
5
  "description": "DBML parser v2",
6
6
  "author": "Holistics <dev@holistics.io>",
7
7
  "license": "Apache-2.0",
@@ -46,5 +46,5 @@
46
46
  "engines": {
47
47
  "node": ">=18"
48
48
  },
49
- "gitHead": "8f21d6ac8a8f9a3715e825afca97d8c79e55d2de"
49
+ "gitHead": "a8358e7ca39ab47272ee59a1915709d8f0f82f06"
50
50
  }