@dbml/core 8.0.0-alpha.10 → 8.0.0-alpha.11
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/lib/index.cjs +36 -36
- package/lib/index.mjs +35 -15
- package/package.json +3 -3
package/lib/index.mjs
CHANGED
|
@@ -8562,14 +8562,17 @@ var ProgramInterpreter = class {
|
|
|
8562
8562
|
let HY = P.getValue();
|
|
8563
8563
|
HY && this.pushElement(VY, HY);
|
|
8564
8564
|
}
|
|
8565
|
-
let _ = /* @__PURE__ */ new Set(), VY = this.compiler.symbolMembers(this.programSymbol).getFiltered(UNHANDLED) ?? [];
|
|
8566
|
-
for (
|
|
8567
|
-
|
|
8568
|
-
let
|
|
8569
|
-
|
|
8565
|
+
let _ = /* @__PURE__ */ new Set(), VY = (this.compiler.symbolMembers(this.programSymbol).getFiltered(UNHANDLED) ?? []).filter((_) => _ instanceof SchemaSymbol);
|
|
8566
|
+
for (; VY.length > 0;) {
|
|
8567
|
+
let P = VY.shift(), HY = this.compiler.symbolMembers(P).getFiltered(UNHANDLED) ?? [];
|
|
8568
|
+
for (let P of HY) {
|
|
8569
|
+
if (P instanceof SchemaSymbol) {
|
|
8570
|
+
VY.push(P);
|
|
8571
|
+
continue;
|
|
8572
|
+
}
|
|
8570
8573
|
if (!(P instanceof UseSymbol)) continue;
|
|
8571
|
-
let
|
|
8572
|
-
_.has(
|
|
8574
|
+
let HY = P.originalSymbol.intern();
|
|
8575
|
+
_.has(HY) || (_.add(HY), this.interpretUseSymbol(P));
|
|
8573
8576
|
}
|
|
8574
8577
|
}
|
|
8575
8578
|
}
|
|
@@ -9523,7 +9526,7 @@ function usableMembers(_) {
|
|
|
9523
9526
|
function schemaMembership(_, VY, P) {
|
|
9524
9527
|
let HY = VY.qualifiedName, UY;
|
|
9525
9528
|
if (UY = P instanceof UseSpecifierNode ? useUtils.visibleName(_, P) : _.nodeFullname(P).getFiltered(UNHANDLED), !UY) return { kind: "none" };
|
|
9526
|
-
let WY = UY.length <= 1 ? [DEFAULT_SCHEMA_NAME$1] : UY.slice(0, -1);
|
|
9529
|
+
let WY = P instanceof UseSpecifierNode && P.getSymbolKind() === SymbolKind.Schema ? UY : UY.length <= 1 ? [DEFAULT_SCHEMA_NAME$1] : UY.slice(0, -1);
|
|
9527
9530
|
return WY.length < HY.length || !HY.every((_, VY) => _ === WY[VY]) ? { kind: "none" } : WY.length === HY.length ? { kind: "direct" } : {
|
|
9528
9531
|
kind: "child",
|
|
9529
9532
|
schemaName: WY[HY.length]
|
|
@@ -10694,11 +10697,15 @@ function handleMemberSelectiveUses(_, VY, P, HY) {
|
|
|
10694
10697
|
function mergeImportedSchema(_, VY, P, HY = /* @__PURE__ */ new Set()) {
|
|
10695
10698
|
if (P.getSymbolKind() !== SymbolKind.Schema || !P.name) return [];
|
|
10696
10699
|
let UY = _.nodeReferee(P.name).getFiltered(UNHANDLED);
|
|
10697
|
-
if (!UY || !UY.isKind(SymbolKind.Schema)
|
|
10698
|
-
let WY =
|
|
10699
|
-
|
|
10700
|
-
|
|
10701
|
-
|
|
10700
|
+
if (!UY || !UY.isKind(SymbolKind.Schema)) return [];
|
|
10701
|
+
let WY = useUtils.visibleName(_, P), GY = VY.qualifiedName;
|
|
10702
|
+
return !WY || WY.length !== GY.length || !WY.every((_, VY) => _ === GY[VY]) ? [] : mergeSchemaMembers(_, VY, P, UY, HY);
|
|
10703
|
+
}
|
|
10704
|
+
function mergeSchemaMembers(_, VY, P, HY, UY) {
|
|
10705
|
+
let WY = HY.intern();
|
|
10706
|
+
if (UY.has(WY)) return [];
|
|
10707
|
+
UY.add(WY);
|
|
10708
|
+
let GY = _.usableMembers(HY).getFiltered(UNHANDLED);
|
|
10702
10709
|
if (!GY) return [];
|
|
10703
10710
|
let KY = GY.nonSchemaMembers.filter((_) => _.canBeImported).map((HY) => _.symbolFactory.create(UseSymbol, {
|
|
10704
10711
|
kind: HY.kind,
|
|
@@ -10708,7 +10715,20 @@ function mergeImportedSchema(_, VY, P, HY = /* @__PURE__ */ new Set()) {
|
|
|
10708
10715
|
name: HY.name
|
|
10709
10716
|
}, VY.filepath));
|
|
10710
10717
|
for (let P of [...KY]) P.isKind(SymbolKind.TableGroup) && KY.push(...expandTableGroup(_, VY, P));
|
|
10711
|
-
for (let
|
|
10718
|
+
for (let HY of GY.reuses.selective) if (KY.push(...mergeImportedSchema(_, VY, HY, UY)), schemaMembership(_, VY, HY).kind === "direct") {
|
|
10719
|
+
let UY = _.nodeSymbol(HY).getFiltered(UNHANDLED);
|
|
10720
|
+
UY && UY.canBeImported && KY.push(_.symbolFactory.create(UseSymbol, {
|
|
10721
|
+
kind: UY.kind,
|
|
10722
|
+
declaration: UY.originalSymbol.declaration,
|
|
10723
|
+
usedSymbol: UY.originalSymbol,
|
|
10724
|
+
useSpecifierDeclaration: P,
|
|
10725
|
+
name: UY.name
|
|
10726
|
+
}, VY.filepath));
|
|
10727
|
+
}
|
|
10728
|
+
for (let { importPath: HY } of GY.reuses.wildcard) {
|
|
10729
|
+
let WY = findSchemaSymbolInFilepath(_, HY, VY.qualifiedName);
|
|
10730
|
+
WY && KY.push(...mergeSchemaMembers(_, VY, P, WY, UY));
|
|
10731
|
+
}
|
|
10712
10732
|
return KY;
|
|
10713
10733
|
}
|
|
10714
10734
|
function handleMemberWildcardUses(_, VY, P, HY, UY, WY = /* @__PURE__ */ new Set()) {
|
|
@@ -1825791,5 +1825811,5 @@ function findDiagramViewBlocks(_) {
|
|
|
1825791
1825811
|
let P = new Compiler();
|
|
1825792
1825812
|
return P.layout = VY, P.findDiagramViewBlocks(DEFAULT_ENTRY);
|
|
1825793
1825813
|
}
|
|
1825794
|
-
const VERSION = "8.0.0-alpha.
|
|
1825814
|
+
const VERSION = "8.0.0-alpha.11";
|
|
1825795
1825815
|
export { CompilerError, ModelExporter_default as ModelExporter, Parser_default as Parser, VERSION, addDoubleQuoteIfNeeded, dbmlMonarchTokensProvider, export_default as exporter, findDiagramViewBlocks, formatRecordValue, import_default as importer, isBinaryType, isBooleanType, isDateTimeType, isFloatType, isIntegerType, isNumericType, isSerialType, isStringType, renameTable, syncDiagramView, tryExtractBoolean, tryExtractDateTime, tryExtractEnum, tryExtractInteger, tryExtractNumeric, tryExtractString };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@dbml/core",
|
|
4
|
-
"version": "8.0.0-alpha.
|
|
4
|
+
"version": "8.0.0-alpha.11",
|
|
5
5
|
"description": "> TODO: description",
|
|
6
6
|
"author": "Holistics <dev@holistics.io>",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"lint:fix": "eslint --fix ."
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@dbml/parse": "^8.0.0-alpha.
|
|
49
|
+
"@dbml/parse": "^8.0.0-alpha.11",
|
|
50
50
|
"antlr4": "^4.13.1",
|
|
51
51
|
"lodash": "^4.18.1",
|
|
52
52
|
"lodash-es": "^4.18.1",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"bluebird": "^3.5.5"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "976e0f27c85468fa8a0fbb2ded04862e86b05b89",
|
|
61
61
|
"engines": {
|
|
62
62
|
"node": ">=16"
|
|
63
63
|
}
|