@dbml/parse 8.2.0 → 8.2.1
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.
- package/dist/dbml-parse.js +15 -15
- package/dist/dbml-parse.mjs +18 -18
- package/dist/src/core/utils/validate.d.ts +1 -0
- package/package.json +2 -2
package/dist/dbml-parse.mjs
CHANGED
|
@@ -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(
|
|
2902
|
-
if (
|
|
2903
|
-
let
|
|
2904
|
-
if (
|
|
2905
|
-
let
|
|
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:
|
|
2914
|
+
name: j,
|
|
2908
2915
|
schemaName: M
|
|
2909
2916
|
});
|
|
2910
2917
|
continue;
|
|
2911
2918
|
}
|
|
2912
2919
|
}
|
|
2913
|
-
let
|
|
2914
|
-
if (
|
|
2915
|
-
let
|
|
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:
|
|
2918
|
-
schemaName:
|
|
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.
|
|
4
|
+
"version": "8.2.1",
|
|
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": "
|
|
49
|
+
"gitHead": "e60008b58f86f40d60dcf97b3839897b07598445"
|
|
50
50
|
}
|