@dbml/parse 8.2.0 → 8.2.1-alpha.0

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.
@@ -1440,6 +1440,13 @@ function isEqualTupleOperands(r) {
1440
1440
  function isValidIndexName(r) {
1441
1441
  return r instanceof PrimaryExpressionNode && r.expression instanceof VariableNode || r instanceof FunctionExpressionNode;
1442
1442
  }
1443
+ function getRightmostVariable(r) {
1444
+ if (isExpressionAVariableNode(r)) return r;
1445
+ if (isAccessExpression(r)) {
1446
+ let j = r.rightExpression;
1447
+ if (j && isExpressionAVariableNode(j)) return j;
1448
+ }
1449
+ }
1443
1450
  function isTerminalAccessFragment(r) {
1444
1451
  let j = r.parentNode;
1445
1452
  return !isAccessExpression(j) || j.rightExpression !== r ? !1 : !(isAccessExpression(j.parentNode) && j.parentNode.leftExpression === j);
@@ -2898,24 +2905,24 @@ var DiagramViewBinder = class {
2898
2905
  let P = [];
2899
2906
  for (let M of r.body) {
2900
2907
  if (!(M instanceof FunctionApplicationNode)) continue;
2901
- let r = M.callee && this.compiler.nodeReferee(M.callee).getFiltered(UNHANDLED);
2902
- if (r?.declaration instanceof ElementDeclarationNode) {
2903
- let j = destructureComplexVariable(r.declaration.name) ?? [];
2904
- if (j.length > 0) {
2905
- let r = j[j.length - 1], M = j.length > 1 ? j.slice(0, -1).join(".") : DEFAULT_SCHEMA_NAME;
2908
+ let r = M.callee && getRightmostVariable(M.callee), N = r && this.compiler.nodeReferee(r).getFiltered(UNHANDLED);
2909
+ if (N?.declaration instanceof ElementDeclarationNode) {
2910
+ let r = destructureComplexVariable(N.declaration.name) ?? [];
2911
+ if (r.length > 0) {
2912
+ let j = r[r.length - 1], M = r.length > 1 ? r.slice(0, -1).join(".") : DEFAULT_SCHEMA_NAME;
2906
2913
  P.push({
2907
- name: r,
2914
+ name: j,
2908
2915
  schemaName: M
2909
2916
  });
2910
2917
  continue;
2911
2918
  }
2912
2919
  }
2913
- let N = destructureComplexVariable(M.callee) ?? [];
2914
- if (N.length === 0) continue;
2915
- let F = N[N.length - 1], I = N.length > 1 ? N[0] : DEFAULT_SCHEMA_NAME;
2920
+ let F = destructureComplexVariable(M.callee) ?? [];
2921
+ if (F.length === 0) continue;
2922
+ let I = F[F.length - 1], L = F.length > 1 ? F[0] : DEFAULT_SCHEMA_NAME;
2916
2923
  P.push({
2917
- name: F,
2918
- schemaName: I
2924
+ name: I,
2925
+ schemaName: L
2919
2926
  });
2920
2927
  }
2921
2928
  switch (M) {
@@ -14461,13 +14468,6 @@ function symbolAliases(r) {
14461
14468
  let j = r.originalSymbol;
14462
14469
  return allVisibleMembers(this).map((M) => M.filter((M) => M instanceof AliasSymbol && M.originalSymbol === j && M !== r));
14463
14470
  }
14464
- function getRightmostVariable(r) {
14465
- if (isExpressionAVariableNode(r)) return r;
14466
- if (isAccessExpression(r)) {
14467
- let j = r.rightExpression;
14468
- if (j && isExpressionAVariableNode(j)) return j;
14469
- }
14470
- }
14471
14471
  function resolutionIndex() {
14472
14472
  let r = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map(), N = this.parseProject();
14473
14473
  this.bindProject();
@@ -99,5 +99,6 @@ export declare function isEqualTupleOperands(value: InfixExpressionNode): boolea
99
99
  export declare function isValidIndexName(value?: SyntaxNode): value is (PrimaryExpressionNode & {
100
100
  expression: VariableNode;
101
101
  }) | FunctionExpressionNode;
102
+ export declare function getRightmostVariable(node: SyntaxNode): SyntaxNode | undefined;
102
103
  export declare function isTerminalAccessFragment(node: SyntaxNode): boolean;
103
104
  export {};
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.0",
4
+ "version": "8.2.1-alpha.0",
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": "a4f2932e24a3d54b7c11d12710cd51e762a8442f"
49
+ "gitHead": "2132b2eb2c1c5e0d9bb0efd9a617becd44c39032"
50
50
  }