@uigraph/sdk 1.1.36 → 1.1.38
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/README.md +6 -2
- package/dist/{__headless.DiJZCsKx.d.mts → __headless.BLqB7VsJ.d.mts} +2 -2
- package/dist/{__headless.AhKww75N.cjs → __headless.DGmyg-me.cjs} +2 -2
- package/dist/{__headless.B7jwmaZK.d.cts → __headless.DfSqiw4X.d.cts} +2 -2
- package/dist/{__headless.CP3up7Jj.mjs → __headless.DpdtlCFx.mjs} +2 -2
- package/dist/{__index.BwoDgQJ5.d.mts → __index.BxD_9h1c.d.mts} +2 -2
- package/dist/{__index.Ci2jxLwq.d.cts → __index.CTSMJl1o.d.cts} +2 -2
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.mts +1 -1
- package/dist/headless.cjs +1 -1
- package/dist/headless.d.cts +1 -1
- package/dist/headless.d.mts +1 -1
- package/dist/headless.mjs +1 -1
- package/dist/index.cjs +89 -78
- package/dist/index.d.cts +10 -13
- package/dist/index.d.mts +10 -13
- package/dist/index.mjs +89 -78
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -98,13 +98,17 @@ The repo needs an `NPM_TOKEN` secret (npm Automation token) configured before th
|
|
|
98
98
|
This project is licensed under the [Business Source License 1.1](LICENSE) (BUSL-1.1).
|
|
99
99
|
|
|
100
100
|
- **Source available today** — you can read, modify, and redistribute the code under the terms of the license.
|
|
101
|
-
- **
|
|
101
|
+
- **Non-production use** — free for development, testing, evaluation, and internal proof-of-concept.
|
|
102
|
+
- **Production use** — requires a commercial license from UiGraph. Production use means any use that supports the ongoing operation of your business or organization.
|
|
102
103
|
- **Future open source** — each version automatically converts to [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0) four years after it is first published under BUSL.
|
|
103
104
|
|
|
104
|
-
BUSL is not an OSI-approved open source license during the initial term. For
|
|
105
|
+
BUSL is not an OSI-approved open source license during the initial term. For commercial licensing questions, open an issue or contact the maintainers.
|
|
105
106
|
|
|
106
107
|
## Related projects
|
|
107
108
|
|
|
108
109
|
- [uigraph-ui](https://github.com/uigraph-oss/uigraph-ui) — web application
|
|
109
110
|
- [uigraph-api](https://github.com/uigraph-oss/uigraph-api) — backend API
|
|
110
111
|
- [uigraph-graphql](https://github.com/uigraph-oss/uigraph-graphql) — GraphQL BFF
|
|
112
|
+
- [uigraph-gateway](https://github.com/uigraph-oss/uigraph-gateway) — CLI sync API
|
|
113
|
+
- [uigraph-mcp](https://github.com/uigraph-oss/uigraph-mcp) — MCP server for AI assistants
|
|
114
|
+
- [uigraph-deploy](https://github.com/uigraph-oss/uigraph-deploy) — self-hosted deployment
|
|
@@ -79,8 +79,8 @@ declare const contextSchema: z$1.ZodObject<{
|
|
|
79
79
|
borderAnimationEnabled: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
80
80
|
}, z$1.core.$strip>>;
|
|
81
81
|
dbConfig: z$1.ZodOptional<z$1.ZodObject<{
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
serviceName: z$1.ZodString;
|
|
83
|
+
databaseName: z$1.ZodString;
|
|
84
84
|
tableName: z$1.ZodString;
|
|
85
85
|
}, z$1.core.$strip>>;
|
|
86
86
|
table: z$1.ZodOptional<z$1.ZodObject<{
|
|
@@ -58,8 +58,8 @@ const contextSchema = zod.default.object({
|
|
|
58
58
|
borderAnimationEnabled: zod.default.boolean().optional()
|
|
59
59
|
}).optional(),
|
|
60
60
|
dbConfig: zod.default.object({
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
serviceName: zod.default.string(),
|
|
62
|
+
databaseName: zod.default.string(),
|
|
63
63
|
tableName: zod.default.string()
|
|
64
64
|
}).optional(),
|
|
65
65
|
table: zod.default.object({
|
|
@@ -79,8 +79,8 @@ declare const contextSchema: z$1.ZodObject<{
|
|
|
79
79
|
borderAnimationEnabled: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
80
80
|
}, z$1.core.$strip>>;
|
|
81
81
|
dbConfig: z$1.ZodOptional<z$1.ZodObject<{
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
serviceName: z$1.ZodString;
|
|
83
|
+
databaseName: z$1.ZodString;
|
|
84
84
|
tableName: z$1.ZodString;
|
|
85
85
|
}, z$1.core.$strip>>;
|
|
86
86
|
table: z$1.ZodOptional<z$1.ZodObject<{
|
|
@@ -57,8 +57,8 @@ const contextSchema = z$1.object({
|
|
|
57
57
|
borderAnimationEnabled: z$1.boolean().optional()
|
|
58
58
|
}).optional(),
|
|
59
59
|
dbConfig: z$1.object({
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
serviceName: z$1.string(),
|
|
61
|
+
databaseName: z$1.string(),
|
|
62
62
|
tableName: z$1.string()
|
|
63
63
|
}).optional(),
|
|
64
64
|
table: z$1.object({
|
package/dist/browser.d.cts
CHANGED
package/dist/browser.d.mts
CHANGED
package/dist/headless.cjs
CHANGED
package/dist/headless.d.cts
CHANGED
package/dist/headless.d.mts
CHANGED
package/dist/headless.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_component_type = require("./__component-type.69UkUMKl.cjs");
|
|
2
|
-
const require_headless = require("./__headless.
|
|
2
|
+
const require_headless = require("./__headless.DGmyg-me.cjs");
|
|
3
3
|
let daily_code = require("daily-code");
|
|
4
4
|
daily_code = require_component_type.__toESM(daily_code);
|
|
5
5
|
let zod = require("zod");
|
|
@@ -778,49 +778,57 @@ function generateUUID() {
|
|
|
778
778
|
});
|
|
779
779
|
}
|
|
780
780
|
var AstToUiConverter = class {
|
|
781
|
-
static updateReactFlow({ nodes, edges, schema,
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
schema,
|
|
786
|
-
sourceId,
|
|
787
|
-
oldDataSources
|
|
788
|
-
});
|
|
789
|
-
const oldSource = oldDataSources.find((s) => s.id === sourceId);
|
|
790
|
-
const sourceNodePrefix = `${sourceId}-table-`;
|
|
781
|
+
static updateReactFlow({ nodes, edges, schema, sourceName, oldDataSources }) {
|
|
782
|
+
var _oldSource$schemaAst$;
|
|
783
|
+
const oldSource = oldDataSources.find((s) => s.name === sourceName);
|
|
784
|
+
const sourceNodePrefix = `${sourceName}-table-`;
|
|
791
785
|
const positions = this.calculateSmartLayout(schema);
|
|
792
|
-
const nodeTableMap = new Map(nodes.map((node) => {
|
|
793
|
-
var _oldSource$schemaAst$;
|
|
794
|
-
return [oldSource === null || oldSource === void 0 || (_oldSource$schemaAst$ = oldSource.schemaAst.tables.find((t) => {
|
|
795
|
-
var _localTable;
|
|
796
|
-
return t.id === ((_localTable = node.data.localTable) === null || _localTable === void 0 ? void 0 : _localTable.tableId);
|
|
797
|
-
})) === null || _oldSource$schemaAst$ === void 0 ? void 0 : _oldSource$schemaAst$.name, node];
|
|
798
|
-
}));
|
|
799
|
-
console.log("Old node table map:", nodeTableMap);
|
|
800
786
|
const tableNames = new Set(schema.tables.map((table) => table.name));
|
|
787
|
+
const sourceNodePool = nodes.filter((node) => node.id.startsWith(sourceNodePrefix));
|
|
788
|
+
const oldNodeByName = /* @__PURE__ */ new Map();
|
|
789
|
+
for (const node of sourceNodePool) {
|
|
790
|
+
var _localTable;
|
|
791
|
+
const tableName = (_localTable = node.data.localTable) === null || _localTable === void 0 ? void 0 : _localTable.tableName;
|
|
792
|
+
if (tableName) oldNodeByName.set(tableName, node);
|
|
793
|
+
}
|
|
794
|
+
const oldTableByName = /* @__PURE__ */ new Map();
|
|
795
|
+
for (const table of (_oldSource$schemaAst$ = oldSource === null || oldSource === void 0 ? void 0 : oldSource.schemaAst.tables) !== null && _oldSource$schemaAst$ !== void 0 ? _oldSource$schemaAst$ : []) oldTableByName.set(table.name, table);
|
|
796
|
+
const consumedNodeIds = /* @__PURE__ */ new Set();
|
|
797
|
+
function mergeWithPrev(baseNode, prevNode) {
|
|
798
|
+
var _prevNode$data, _prevNode$data$style, _prevNode$data2, _baseNode$data;
|
|
799
|
+
const mergedNode = _objectSpread2(_objectSpread2(_objectSpread2({}, prevNode), baseNode), {}, { data: _objectSpread2(_objectSpread2(_objectSpread2({}, (_prevNode$data = prevNode.data) !== null && _prevNode$data !== void 0 ? _prevNode$data : {}), baseNode.data), {}, { style: (_prevNode$data$style = (_prevNode$data2 = prevNode.data) === null || _prevNode$data2 === void 0 ? void 0 : _prevNode$data2.style) !== null && _prevNode$data$style !== void 0 ? _prevNode$data$style : (_baseNode$data = baseNode.data) === null || _baseNode$data === void 0 ? void 0 : _baseNode$data.style }) });
|
|
800
|
+
if (prevNode.style) mergedNode.style = prevNode.style;
|
|
801
|
+
if (prevNode.width !== void 0) mergedNode.width = prevNode.width;
|
|
802
|
+
if (prevNode.height !== void 0) mergedNode.height = prevNode.height;
|
|
803
|
+
return mergedNode;
|
|
804
|
+
}
|
|
801
805
|
const sourceNodes = schema.tables.map((table, index) => {
|
|
802
|
-
var _ref, _ref2, _prevNode$position
|
|
803
|
-
|
|
806
|
+
var _ref, _ref2, _prevNode$position;
|
|
807
|
+
let prevNode = oldNodeByName.get(table.name);
|
|
808
|
+
if (!prevNode || consumedNodeIds.has(prevNode.id)) {
|
|
809
|
+
prevNode = void 0;
|
|
810
|
+
const newSignature = this.tableSignature(table);
|
|
811
|
+
for (const [oldName, oldTable] of oldTableByName) {
|
|
812
|
+
if (tableNames.has(oldName)) continue;
|
|
813
|
+
const candidate = oldNodeByName.get(oldName);
|
|
814
|
+
if (!candidate || consumedNodeIds.has(candidate.id)) continue;
|
|
815
|
+
if (this.tableSignature(oldTable) === newSignature) {
|
|
816
|
+
prevNode = candidate;
|
|
817
|
+
break;
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
}
|
|
804
821
|
const position = (_ref = (_ref2 = (_prevNode$position = prevNode === null || prevNode === void 0 ? void 0 : prevNode.position) !== null && _prevNode$position !== void 0 ? _prevNode$position : table.position) !== null && _ref2 !== void 0 ? _ref2 : positions[table.name]) !== null && _ref !== void 0 ? _ref : {
|
|
805
822
|
x: 100,
|
|
806
823
|
y: 100 + index * 210
|
|
807
824
|
};
|
|
808
|
-
const baseNode = this.tableAstToNode(
|
|
825
|
+
const baseNode = this.tableAstToNode(sourceName, table, position, tableNames);
|
|
809
826
|
if (!prevNode) return baseNode;
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
if (prevNode.width !== void 0) mergedNode.width = prevNode.width;
|
|
813
|
-
if (prevNode.height !== void 0) mergedNode.height = prevNode.height;
|
|
814
|
-
return mergedNode;
|
|
815
|
-
}).filter((node) => {
|
|
816
|
-
var _schema$tables$find;
|
|
817
|
-
return nodeTableMap.has((_schema$tables$find = schema.tables.find((t) => {
|
|
818
|
-
var _localTable2;
|
|
819
|
-
return t.id === ((_localTable2 = node.data.localTable) === null || _localTable2 === void 0 ? void 0 : _localTable2.tableId);
|
|
820
|
-
})) === null || _schema$tables$find === void 0 ? void 0 : _schema$tables$find.name);
|
|
827
|
+
consumedNodeIds.add(prevNode.id);
|
|
828
|
+
return mergeWithPrev(baseNode, prevNode);
|
|
821
829
|
});
|
|
822
830
|
const validNodeIds = new Set(sourceNodes.map((node) => node.id));
|
|
823
|
-
const sourceEdges = schema.tables.flatMap((table) => this.createEdgesFromTable(
|
|
831
|
+
const sourceEdges = schema.tables.flatMap((table) => this.createEdgesFromTable(sourceName, table, schema.tables).filter((edge) => validNodeIds.has(edge.source) && validNodeIds.has(edge.target)));
|
|
824
832
|
const preservedNodes = nodes.filter((node) => !node.id.startsWith(sourceNodePrefix));
|
|
825
833
|
const preservedEdges = edges.filter((edge) => !edge.id.startsWith(sourceNodePrefix));
|
|
826
834
|
return {
|
|
@@ -828,7 +836,7 @@ var AstToUiConverter = class {
|
|
|
828
836
|
edges: [...preservedEdges, ...sourceEdges]
|
|
829
837
|
};
|
|
830
838
|
}
|
|
831
|
-
static toReactFlow(schema,
|
|
839
|
+
static toReactFlow(schema, sourceName) {
|
|
832
840
|
const nodes = [];
|
|
833
841
|
const edges = [];
|
|
834
842
|
const tableNames = new Set(schema.tables.map((table) => table.name));
|
|
@@ -838,9 +846,9 @@ var AstToUiConverter = class {
|
|
|
838
846
|
x: 100,
|
|
839
847
|
y: 100 + index * 210
|
|
840
848
|
};
|
|
841
|
-
const node = this.tableAstToNode(
|
|
849
|
+
const node = this.tableAstToNode(sourceName, table, position, tableNames);
|
|
842
850
|
nodes.push(node);
|
|
843
|
-
const tableEdges = this.createEdgesFromTable(
|
|
851
|
+
const tableEdges = this.createEdgesFromTable(sourceName, table, schema.tables);
|
|
844
852
|
edges.push(...tableEdges);
|
|
845
853
|
});
|
|
846
854
|
return {
|
|
@@ -938,18 +946,40 @@ var AstToUiConverter = class {
|
|
|
938
946
|
startX
|
|
939
947
|
}).positions;
|
|
940
948
|
}
|
|
941
|
-
static tableAstToNode(
|
|
949
|
+
static tableAstToNode(sourceName, table, position, _validTableNames) {
|
|
942
950
|
return {
|
|
943
|
-
id: generateTableNodeId(
|
|
951
|
+
id: generateTableNodeId(sourceName, table.name),
|
|
944
952
|
type: "databaseTableSQL",
|
|
945
953
|
width: DEFAULT_NODE_WIDTH,
|
|
946
954
|
position,
|
|
947
955
|
data: { localTable: {
|
|
948
|
-
|
|
949
|
-
|
|
956
|
+
databaseName: sourceName,
|
|
957
|
+
tableName: table.name
|
|
950
958
|
} }
|
|
951
959
|
};
|
|
952
960
|
}
|
|
961
|
+
static tableSignature(table) {
|
|
962
|
+
const columns = [...table.columns].sort((a, b) => a.name.localeCompare(b.name)).map((col) => {
|
|
963
|
+
var _col$dataType$paramet, _col$dataType$paramet2;
|
|
964
|
+
const params = (_col$dataType$paramet = (_col$dataType$paramet2 = col.dataType.parameters) === null || _col$dataType$paramet2 === void 0 ? void 0 : _col$dataType$paramet2.join(",")) !== null && _col$dataType$paramet !== void 0 ? _col$dataType$paramet : "";
|
|
965
|
+
return [
|
|
966
|
+
col.name,
|
|
967
|
+
col.dataType.name,
|
|
968
|
+
params,
|
|
969
|
+
col.dataType.unsigned ? "u" : "",
|
|
970
|
+
col.dataType.timezone ? "tz" : "",
|
|
971
|
+
col.nullable ? "null" : "notnull",
|
|
972
|
+
col.autoIncrement ? "ai" : ""
|
|
973
|
+
].join(":");
|
|
974
|
+
});
|
|
975
|
+
const constraints = table.constraints.map((c) => JSON.stringify(c)).sort();
|
|
976
|
+
const indexes = [...table.indexes].map((idx) => JSON.stringify(idx)).sort();
|
|
977
|
+
return JSON.stringify({
|
|
978
|
+
columns,
|
|
979
|
+
constraints,
|
|
980
|
+
indexes
|
|
981
|
+
});
|
|
982
|
+
}
|
|
953
983
|
static extractPrimaryKeys(table) {
|
|
954
984
|
const pkConstraint = table.constraints.find((c) => c.type === "primary_key");
|
|
955
985
|
if (pkConstraint) return pkConstraint.columns;
|
|
@@ -966,13 +996,13 @@ var AstToUiConverter = class {
|
|
|
966
996
|
if (dataType.timezone) formatted += " WITH TIME ZONE";
|
|
967
997
|
return formatted;
|
|
968
998
|
}
|
|
969
|
-
static createEdgesFromTable(
|
|
999
|
+
static createEdgesFromTable(sourceName, sourceTable, validTables) {
|
|
970
1000
|
const edges = [];
|
|
971
1001
|
this.extractForeignKeys(sourceTable).forEach((fk, index) => {
|
|
972
1002
|
const targetTable = validTables.find((t) => t.id === fk.referencedTable || t.name === fk.referencedTable);
|
|
973
1003
|
if (!targetTable) return;
|
|
974
|
-
const sourceNodeId = generateTableNodeId(
|
|
975
|
-
const targetNodeId = generateTableNodeId(
|
|
1004
|
+
const sourceNodeId = generateTableNodeId(sourceName, sourceTable.name);
|
|
1005
|
+
const targetNodeId = generateTableNodeId(sourceName, targetTable.name);
|
|
976
1006
|
const edgeId = `${sourceNodeId}-fk-${index}`;
|
|
977
1007
|
const fkCols = fk.columns;
|
|
978
1008
|
const allNotNull = fkCols.every((cn) => {
|
|
@@ -3288,18 +3318,7 @@ function createReactFlowElements(nodes, edges, subgraphs, subgraphLayouts, subgr
|
|
|
3288
3318
|
return {
|
|
3289
3319
|
nodes: reactFlowNodes,
|
|
3290
3320
|
edges: edges.map((edge, index) => {
|
|
3291
|
-
const
|
|
3292
|
-
"#1976D2",
|
|
3293
|
-
"#388E3C",
|
|
3294
|
-
"#F57C00",
|
|
3295
|
-
"#7B1FA2",
|
|
3296
|
-
"#C2185B"
|
|
3297
|
-
];
|
|
3298
|
-
const edgeColor = edgeColors[index % edgeColors.length];
|
|
3299
|
-
const edgeStyle = {
|
|
3300
|
-
stroke: edgeColor,
|
|
3301
|
-
strokeWidth: 2.5
|
|
3302
|
-
};
|
|
3321
|
+
const edgeStyle = { strokeWidth: 2.5 };
|
|
3303
3322
|
const edgeType = "default";
|
|
3304
3323
|
const animated = true;
|
|
3305
3324
|
switch (edge.type) {
|
|
@@ -3329,17 +3348,13 @@ function createReactFlowElements(nodes, edges, subgraphs, subgraphLayouts, subgr
|
|
|
3329
3348
|
labelStyle: {
|
|
3330
3349
|
fontSize: "12px",
|
|
3331
3350
|
fontWeight: "500",
|
|
3332
|
-
color: edgeColor,
|
|
3333
3351
|
backgroundColor: "white",
|
|
3334
|
-
padding: "2px 6px"
|
|
3335
|
-
borderRadius: "4px",
|
|
3336
|
-
border: `1px solid ${edgeColor}`
|
|
3352
|
+
padding: "2px 6px"
|
|
3337
3353
|
},
|
|
3338
3354
|
markerEnd: {
|
|
3339
3355
|
type: __xyflow_react.MarkerType.ArrowClosed,
|
|
3340
3356
|
width: 20,
|
|
3341
|
-
height: 20
|
|
3342
|
-
color: edgeColor
|
|
3357
|
+
height: 20
|
|
3343
3358
|
},
|
|
3344
3359
|
sourceHandle: direction === "LR" || direction === "RL" ? "source-right" : "source-bottom",
|
|
3345
3360
|
targetHandle: direction === "LR" || direction === "RL" ? "target-left" : "target-top",
|
|
@@ -3825,15 +3840,11 @@ function _convertMermaidToReactFlowWithContext() {
|
|
|
3825
3840
|
componentField.data = newComponentField.data;
|
|
3826
3841
|
}
|
|
3827
3842
|
}
|
|
3828
|
-
if (ctx.dbConfig) {
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
serviceDbId: (_resolved$serviceDbId = resolved === null || resolved === void 0 ? void 0 : resolved.serviceDbId) !== null && _resolved$serviceDbId !== void 0 ? _resolved$serviceDbId : ctx.dbConfig.database,
|
|
3834
|
-
tableName: ctx.dbConfig.tableName
|
|
3835
|
-
};
|
|
3836
|
-
}
|
|
3843
|
+
if (ctx.dbConfig) clonedNode.data.serviceTable = {
|
|
3844
|
+
serviceName: ctx.dbConfig.serviceName,
|
|
3845
|
+
databaseName: ctx.dbConfig.databaseName,
|
|
3846
|
+
tableName: ctx.dbConfig.tableName
|
|
3847
|
+
};
|
|
3837
3848
|
if ((_ctx$style = ctx.style) === null || _ctx$style === void 0 ? void 0 : _ctx$style.height) clonedNode.height = ctx.style.height;
|
|
3838
3849
|
if ((_ctx$style2 = ctx.style) === null || _ctx$style2 === void 0 ? void 0 : _ctx$style2.width) clonedNode.width = ctx.style.width;
|
|
3839
3850
|
clonedNode.data = _objectSpread2(_objectSpread2(_objectSpread2({}, clonedNode.data), (0, daily_code.objectPick)((_ctx$style3 = ctx.style) !== null && _ctx$style3 !== void 0 ? _ctx$style3 : {}, [
|
|
@@ -4151,12 +4162,12 @@ function buildContextNodes(graphNodes, nodeIdMap) {
|
|
|
4151
4162
|
rows: tableRows !== null && tableRows !== void 0 ? tableRows : []
|
|
4152
4163
|
};
|
|
4153
4164
|
const serviceTable = toRecord(nodeData.serviceTable);
|
|
4154
|
-
const
|
|
4155
|
-
const
|
|
4165
|
+
const serviceName = pickString(serviceTable === null || serviceTable === void 0 ? void 0 : serviceTable.serviceName);
|
|
4166
|
+
const databaseName = pickString(serviceTable === null || serviceTable === void 0 ? void 0 : serviceTable.databaseName);
|
|
4156
4167
|
const tableName = pickString(serviceTable === null || serviceTable === void 0 ? void 0 : serviceTable.tableName);
|
|
4157
|
-
if (
|
|
4158
|
-
|
|
4159
|
-
|
|
4168
|
+
if (serviceName && databaseName && tableName) nodeContext.dbConfig = {
|
|
4169
|
+
serviceName,
|
|
4170
|
+
databaseName,
|
|
4160
4171
|
tableName
|
|
4161
4172
|
};
|
|
4162
4173
|
const dynamicData = {};
|
|
@@ -4442,9 +4453,9 @@ function resolveMermaidDetailedNodeLabel(node) {
|
|
|
4442
4453
|
const lines = [];
|
|
4443
4454
|
const serviceTable = toRecord(nodeData === null || nodeData === void 0 ? void 0 : nodeData.serviceTable);
|
|
4444
4455
|
const dbConfig = toRecord(nodeData === null || nodeData === void 0 ? void 0 : nodeData.dbConfig);
|
|
4445
|
-
const database = (_pickString = pickString(serviceTable === null || serviceTable === void 0 ? void 0 : serviceTable.
|
|
4456
|
+
const database = (_pickString = pickString(serviceTable === null || serviceTable === void 0 ? void 0 : serviceTable.databaseName)) !== null && _pickString !== void 0 ? _pickString : pickString(dbConfig === null || dbConfig === void 0 ? void 0 : dbConfig.databaseName);
|
|
4446
4457
|
const tableName = (_pickString2 = pickString(serviceTable === null || serviceTable === void 0 ? void 0 : serviceTable.tableName)) !== null && _pickString2 !== void 0 ? _pickString2 : pickString(dbConfig === null || dbConfig === void 0 ? void 0 : dbConfig.tableName);
|
|
4447
|
-
const dbService = (_pickString3 = pickString(serviceTable === null || serviceTable === void 0 ? void 0 : serviceTable.
|
|
4458
|
+
const dbService = (_pickString3 = pickString(serviceTable === null || serviceTable === void 0 ? void 0 : serviceTable.serviceName)) !== null && _pickString3 !== void 0 ? _pickString3 : pickString(dbConfig === null || dbConfig === void 0 ? void 0 : dbConfig.serviceName);
|
|
4448
4459
|
const dataSourceName = name !== null && name !== void 0 ? name : tableName;
|
|
4449
4460
|
lines.push(dataSourceName ? `DataSource: ${dataSourceName}` : "DataSource");
|
|
4450
4461
|
if (database && tableName) lines.push(`db: ${database}.${tableName}`);
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as MermaidNode, c as SequenceParticipant, d as ServerComponentField, f as ServerComponentFieldInput, i as MermaidEdge, l as SubgraphInfo, n as RFComponentField, o as SequenceDiagramData, r as ReactFlowData, s as SequenceMessage, t as CustomData, u as SubgraphLayout } from "./__index.
|
|
1
|
+
import { a as MermaidNode, c as SequenceParticipant, d as ServerComponentField, f as ServerComponentFieldInput, i as MermaidEdge, l as SubgraphInfo, n as RFComponentField, o as SequenceDiagramData, r as ReactFlowData, s as SequenceMessage, t as CustomData, u as SubgraphLayout } from "./__index.CTSMJl1o.cjs";
|
|
2
2
|
import { t as ComponentInputType } from "./__component-type.tW2Xh7Xk.cjs";
|
|
3
|
-
import { t as contextSchema } from "./__headless.
|
|
3
|
+
import { t as contextSchema } from "./__headless.DfSqiw4X.cjs";
|
|
4
4
|
import z$1, { z } from "zod";
|
|
5
5
|
import { Edge, Node } from "@xyflow/react";
|
|
6
6
|
|
|
@@ -131,12 +131,12 @@ interface DatabaseTableSQLNodeData extends Record<string, unknown> {
|
|
|
131
131
|
};
|
|
132
132
|
isForcedOpen?: boolean;
|
|
133
133
|
localTable?: {
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
databaseName: string;
|
|
135
|
+
tableName: string;
|
|
136
136
|
};
|
|
137
137
|
serviceTable?: {
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
serviceName: string;
|
|
139
|
+
databaseName: string;
|
|
140
140
|
tableName: string;
|
|
141
141
|
};
|
|
142
142
|
}
|
|
@@ -305,19 +305,19 @@ declare class AstToUiConverter {
|
|
|
305
305
|
nodes,
|
|
306
306
|
edges,
|
|
307
307
|
schema,
|
|
308
|
-
|
|
308
|
+
sourceName,
|
|
309
309
|
oldDataSources
|
|
310
310
|
}: {
|
|
311
311
|
nodes: Node[];
|
|
312
312
|
edges: Edge[];
|
|
313
|
-
|
|
313
|
+
sourceName: string;
|
|
314
314
|
schema: SchemaAST;
|
|
315
315
|
oldDataSources: DataSource[];
|
|
316
316
|
}): {
|
|
317
317
|
nodes: Node[];
|
|
318
318
|
edges: Edge[];
|
|
319
319
|
};
|
|
320
|
-
static toReactFlow(schema: SchemaAST,
|
|
320
|
+
static toReactFlow(schema: SchemaAST, sourceName: string): {
|
|
321
321
|
nodes: Node<DatabaseTableSQLNodeData>[];
|
|
322
322
|
edges: Edge[];
|
|
323
323
|
};
|
|
@@ -333,6 +333,7 @@ declare class AstToUiConverter {
|
|
|
333
333
|
* Convert table AST to ReactFlow node
|
|
334
334
|
*/
|
|
335
335
|
private static tableAstToNode;
|
|
336
|
+
private static tableSignature;
|
|
336
337
|
/**
|
|
337
338
|
* Extract primary keys from table
|
|
338
339
|
*/
|
|
@@ -745,10 +746,6 @@ declare function buildMetaData(fields: ServerComponentField[], data: Record<stri
|
|
|
745
746
|
type ResolverOptions = {
|
|
746
747
|
repositionNodes?: boolean;
|
|
747
748
|
resolveCloudIcon?: (cloud: string | undefined, service: string) => Promise<string | undefined | null>;
|
|
748
|
-
resolveDbConfig?: (service: string, database: string) => Promise<{
|
|
749
|
-
serviceId?: string;
|
|
750
|
-
serviceDbId?: string;
|
|
751
|
-
} | undefined>;
|
|
752
749
|
};
|
|
753
750
|
declare function convertMermaidToReactFlowWithContext(mermaidCode: string, context: z$1.infer<typeof contextSchema>, options?: ResolverOptions): Promise<ReactFlowData>;
|
|
754
751
|
//#endregion
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as MermaidNode, c as SequenceParticipant, d as ServerComponentField, f as ServerComponentFieldInput, i as MermaidEdge, l as SubgraphInfo, n as RFComponentField, o as SequenceDiagramData, r as ReactFlowData, s as SequenceMessage, t as CustomData, u as SubgraphLayout } from "./__index.
|
|
1
|
+
import { a as MermaidNode, c as SequenceParticipant, d as ServerComponentField, f as ServerComponentFieldInput, i as MermaidEdge, l as SubgraphInfo, n as RFComponentField, o as SequenceDiagramData, r as ReactFlowData, s as SequenceMessage, t as CustomData, u as SubgraphLayout } from "./__index.BxD_9h1c.mjs";
|
|
2
2
|
import { t as ComponentInputType } from "./__component-type.CO8FgnQE.mjs";
|
|
3
|
-
import { t as contextSchema } from "./__headless.
|
|
3
|
+
import { t as contextSchema } from "./__headless.BLqB7VsJ.mjs";
|
|
4
4
|
import z$1, { z } from "zod";
|
|
5
5
|
import { Edge, Node } from "@xyflow/react";
|
|
6
6
|
|
|
@@ -131,12 +131,12 @@ interface DatabaseTableSQLNodeData extends Record<string, unknown> {
|
|
|
131
131
|
};
|
|
132
132
|
isForcedOpen?: boolean;
|
|
133
133
|
localTable?: {
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
databaseName: string;
|
|
135
|
+
tableName: string;
|
|
136
136
|
};
|
|
137
137
|
serviceTable?: {
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
serviceName: string;
|
|
139
|
+
databaseName: string;
|
|
140
140
|
tableName: string;
|
|
141
141
|
};
|
|
142
142
|
}
|
|
@@ -305,19 +305,19 @@ declare class AstToUiConverter {
|
|
|
305
305
|
nodes,
|
|
306
306
|
edges,
|
|
307
307
|
schema,
|
|
308
|
-
|
|
308
|
+
sourceName,
|
|
309
309
|
oldDataSources
|
|
310
310
|
}: {
|
|
311
311
|
nodes: Node[];
|
|
312
312
|
edges: Edge[];
|
|
313
|
-
|
|
313
|
+
sourceName: string;
|
|
314
314
|
schema: SchemaAST;
|
|
315
315
|
oldDataSources: DataSource[];
|
|
316
316
|
}): {
|
|
317
317
|
nodes: Node[];
|
|
318
318
|
edges: Edge[];
|
|
319
319
|
};
|
|
320
|
-
static toReactFlow(schema: SchemaAST,
|
|
320
|
+
static toReactFlow(schema: SchemaAST, sourceName: string): {
|
|
321
321
|
nodes: Node<DatabaseTableSQLNodeData>[];
|
|
322
322
|
edges: Edge[];
|
|
323
323
|
};
|
|
@@ -333,6 +333,7 @@ declare class AstToUiConverter {
|
|
|
333
333
|
* Convert table AST to ReactFlow node
|
|
334
334
|
*/
|
|
335
335
|
private static tableAstToNode;
|
|
336
|
+
private static tableSignature;
|
|
336
337
|
/**
|
|
337
338
|
* Extract primary keys from table
|
|
338
339
|
*/
|
|
@@ -745,10 +746,6 @@ declare function buildMetaData(fields: ServerComponentField[], data: Record<stri
|
|
|
745
746
|
type ResolverOptions = {
|
|
746
747
|
repositionNodes?: boolean;
|
|
747
748
|
resolveCloudIcon?: (cloud: string | undefined, service: string) => Promise<string | undefined | null>;
|
|
748
|
-
resolveDbConfig?: (service: string, database: string) => Promise<{
|
|
749
|
-
serviceId?: string;
|
|
750
|
-
serviceDbId?: string;
|
|
751
|
-
} | undefined>;
|
|
752
749
|
};
|
|
753
750
|
declare function convertMermaidToReactFlowWithContext(mermaidCode: string, context: z$1.infer<typeof contextSchema>, options?: ResolverOptions): Promise<ReactFlowData>;
|
|
754
751
|
//#endregion
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as ComponentInputType } from "./__component-type.CYmD-KIu.mjs";
|
|
2
|
-
import { t as contextSchema } from "./__headless.
|
|
2
|
+
import { t as contextSchema } from "./__headless.DpdtlCFx.mjs";
|
|
3
3
|
import { arrayNonNullable, generateUUID as generateUUID$1, objectPick } from "daily-code";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { MarkerType, Position } from "@xyflow/react";
|
|
@@ -772,49 +772,57 @@ function generateUUID() {
|
|
|
772
772
|
});
|
|
773
773
|
}
|
|
774
774
|
var AstToUiConverter = class {
|
|
775
|
-
static updateReactFlow({ nodes, edges, schema,
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
schema,
|
|
780
|
-
sourceId,
|
|
781
|
-
oldDataSources
|
|
782
|
-
});
|
|
783
|
-
const oldSource = oldDataSources.find((s) => s.id === sourceId);
|
|
784
|
-
const sourceNodePrefix = `${sourceId}-table-`;
|
|
775
|
+
static updateReactFlow({ nodes, edges, schema, sourceName, oldDataSources }) {
|
|
776
|
+
var _oldSource$schemaAst$;
|
|
777
|
+
const oldSource = oldDataSources.find((s) => s.name === sourceName);
|
|
778
|
+
const sourceNodePrefix = `${sourceName}-table-`;
|
|
785
779
|
const positions = this.calculateSmartLayout(schema);
|
|
786
|
-
const nodeTableMap = new Map(nodes.map((node) => {
|
|
787
|
-
var _oldSource$schemaAst$;
|
|
788
|
-
return [oldSource === null || oldSource === void 0 || (_oldSource$schemaAst$ = oldSource.schemaAst.tables.find((t) => {
|
|
789
|
-
var _localTable;
|
|
790
|
-
return t.id === ((_localTable = node.data.localTable) === null || _localTable === void 0 ? void 0 : _localTable.tableId);
|
|
791
|
-
})) === null || _oldSource$schemaAst$ === void 0 ? void 0 : _oldSource$schemaAst$.name, node];
|
|
792
|
-
}));
|
|
793
|
-
console.log("Old node table map:", nodeTableMap);
|
|
794
780
|
const tableNames = new Set(schema.tables.map((table) => table.name));
|
|
781
|
+
const sourceNodePool = nodes.filter((node) => node.id.startsWith(sourceNodePrefix));
|
|
782
|
+
const oldNodeByName = /* @__PURE__ */ new Map();
|
|
783
|
+
for (const node of sourceNodePool) {
|
|
784
|
+
var _localTable;
|
|
785
|
+
const tableName = (_localTable = node.data.localTable) === null || _localTable === void 0 ? void 0 : _localTable.tableName;
|
|
786
|
+
if (tableName) oldNodeByName.set(tableName, node);
|
|
787
|
+
}
|
|
788
|
+
const oldTableByName = /* @__PURE__ */ new Map();
|
|
789
|
+
for (const table of (_oldSource$schemaAst$ = oldSource === null || oldSource === void 0 ? void 0 : oldSource.schemaAst.tables) !== null && _oldSource$schemaAst$ !== void 0 ? _oldSource$schemaAst$ : []) oldTableByName.set(table.name, table);
|
|
790
|
+
const consumedNodeIds = /* @__PURE__ */ new Set();
|
|
791
|
+
function mergeWithPrev(baseNode, prevNode) {
|
|
792
|
+
var _prevNode$data, _prevNode$data$style, _prevNode$data2, _baseNode$data;
|
|
793
|
+
const mergedNode = _objectSpread2(_objectSpread2(_objectSpread2({}, prevNode), baseNode), {}, { data: _objectSpread2(_objectSpread2(_objectSpread2({}, (_prevNode$data = prevNode.data) !== null && _prevNode$data !== void 0 ? _prevNode$data : {}), baseNode.data), {}, { style: (_prevNode$data$style = (_prevNode$data2 = prevNode.data) === null || _prevNode$data2 === void 0 ? void 0 : _prevNode$data2.style) !== null && _prevNode$data$style !== void 0 ? _prevNode$data$style : (_baseNode$data = baseNode.data) === null || _baseNode$data === void 0 ? void 0 : _baseNode$data.style }) });
|
|
794
|
+
if (prevNode.style) mergedNode.style = prevNode.style;
|
|
795
|
+
if (prevNode.width !== void 0) mergedNode.width = prevNode.width;
|
|
796
|
+
if (prevNode.height !== void 0) mergedNode.height = prevNode.height;
|
|
797
|
+
return mergedNode;
|
|
798
|
+
}
|
|
795
799
|
const sourceNodes = schema.tables.map((table, index) => {
|
|
796
|
-
var _ref, _ref2, _prevNode$position
|
|
797
|
-
|
|
800
|
+
var _ref, _ref2, _prevNode$position;
|
|
801
|
+
let prevNode = oldNodeByName.get(table.name);
|
|
802
|
+
if (!prevNode || consumedNodeIds.has(prevNode.id)) {
|
|
803
|
+
prevNode = void 0;
|
|
804
|
+
const newSignature = this.tableSignature(table);
|
|
805
|
+
for (const [oldName, oldTable] of oldTableByName) {
|
|
806
|
+
if (tableNames.has(oldName)) continue;
|
|
807
|
+
const candidate = oldNodeByName.get(oldName);
|
|
808
|
+
if (!candidate || consumedNodeIds.has(candidate.id)) continue;
|
|
809
|
+
if (this.tableSignature(oldTable) === newSignature) {
|
|
810
|
+
prevNode = candidate;
|
|
811
|
+
break;
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
}
|
|
798
815
|
const position = (_ref = (_ref2 = (_prevNode$position = prevNode === null || prevNode === void 0 ? void 0 : prevNode.position) !== null && _prevNode$position !== void 0 ? _prevNode$position : table.position) !== null && _ref2 !== void 0 ? _ref2 : positions[table.name]) !== null && _ref !== void 0 ? _ref : {
|
|
799
816
|
x: 100,
|
|
800
817
|
y: 100 + index * 210
|
|
801
818
|
};
|
|
802
|
-
const baseNode = this.tableAstToNode(
|
|
819
|
+
const baseNode = this.tableAstToNode(sourceName, table, position, tableNames);
|
|
803
820
|
if (!prevNode) return baseNode;
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
if (prevNode.width !== void 0) mergedNode.width = prevNode.width;
|
|
807
|
-
if (prevNode.height !== void 0) mergedNode.height = prevNode.height;
|
|
808
|
-
return mergedNode;
|
|
809
|
-
}).filter((node) => {
|
|
810
|
-
var _schema$tables$find;
|
|
811
|
-
return nodeTableMap.has((_schema$tables$find = schema.tables.find((t) => {
|
|
812
|
-
var _localTable2;
|
|
813
|
-
return t.id === ((_localTable2 = node.data.localTable) === null || _localTable2 === void 0 ? void 0 : _localTable2.tableId);
|
|
814
|
-
})) === null || _schema$tables$find === void 0 ? void 0 : _schema$tables$find.name);
|
|
821
|
+
consumedNodeIds.add(prevNode.id);
|
|
822
|
+
return mergeWithPrev(baseNode, prevNode);
|
|
815
823
|
});
|
|
816
824
|
const validNodeIds = new Set(sourceNodes.map((node) => node.id));
|
|
817
|
-
const sourceEdges = schema.tables.flatMap((table) => this.createEdgesFromTable(
|
|
825
|
+
const sourceEdges = schema.tables.flatMap((table) => this.createEdgesFromTable(sourceName, table, schema.tables).filter((edge) => validNodeIds.has(edge.source) && validNodeIds.has(edge.target)));
|
|
818
826
|
const preservedNodes = nodes.filter((node) => !node.id.startsWith(sourceNodePrefix));
|
|
819
827
|
const preservedEdges = edges.filter((edge) => !edge.id.startsWith(sourceNodePrefix));
|
|
820
828
|
return {
|
|
@@ -822,7 +830,7 @@ var AstToUiConverter = class {
|
|
|
822
830
|
edges: [...preservedEdges, ...sourceEdges]
|
|
823
831
|
};
|
|
824
832
|
}
|
|
825
|
-
static toReactFlow(schema,
|
|
833
|
+
static toReactFlow(schema, sourceName) {
|
|
826
834
|
const nodes = [];
|
|
827
835
|
const edges = [];
|
|
828
836
|
const tableNames = new Set(schema.tables.map((table) => table.name));
|
|
@@ -832,9 +840,9 @@ var AstToUiConverter = class {
|
|
|
832
840
|
x: 100,
|
|
833
841
|
y: 100 + index * 210
|
|
834
842
|
};
|
|
835
|
-
const node = this.tableAstToNode(
|
|
843
|
+
const node = this.tableAstToNode(sourceName, table, position, tableNames);
|
|
836
844
|
nodes.push(node);
|
|
837
|
-
const tableEdges = this.createEdgesFromTable(
|
|
845
|
+
const tableEdges = this.createEdgesFromTable(sourceName, table, schema.tables);
|
|
838
846
|
edges.push(...tableEdges);
|
|
839
847
|
});
|
|
840
848
|
return {
|
|
@@ -932,18 +940,40 @@ var AstToUiConverter = class {
|
|
|
932
940
|
startX
|
|
933
941
|
}).positions;
|
|
934
942
|
}
|
|
935
|
-
static tableAstToNode(
|
|
943
|
+
static tableAstToNode(sourceName, table, position, _validTableNames) {
|
|
936
944
|
return {
|
|
937
|
-
id: generateTableNodeId(
|
|
945
|
+
id: generateTableNodeId(sourceName, table.name),
|
|
938
946
|
type: "databaseTableSQL",
|
|
939
947
|
width: DEFAULT_NODE_WIDTH,
|
|
940
948
|
position,
|
|
941
949
|
data: { localTable: {
|
|
942
|
-
|
|
943
|
-
|
|
950
|
+
databaseName: sourceName,
|
|
951
|
+
tableName: table.name
|
|
944
952
|
} }
|
|
945
953
|
};
|
|
946
954
|
}
|
|
955
|
+
static tableSignature(table) {
|
|
956
|
+
const columns = [...table.columns].sort((a, b) => a.name.localeCompare(b.name)).map((col) => {
|
|
957
|
+
var _col$dataType$paramet, _col$dataType$paramet2;
|
|
958
|
+
const params = (_col$dataType$paramet = (_col$dataType$paramet2 = col.dataType.parameters) === null || _col$dataType$paramet2 === void 0 ? void 0 : _col$dataType$paramet2.join(",")) !== null && _col$dataType$paramet !== void 0 ? _col$dataType$paramet : "";
|
|
959
|
+
return [
|
|
960
|
+
col.name,
|
|
961
|
+
col.dataType.name,
|
|
962
|
+
params,
|
|
963
|
+
col.dataType.unsigned ? "u" : "",
|
|
964
|
+
col.dataType.timezone ? "tz" : "",
|
|
965
|
+
col.nullable ? "null" : "notnull",
|
|
966
|
+
col.autoIncrement ? "ai" : ""
|
|
967
|
+
].join(":");
|
|
968
|
+
});
|
|
969
|
+
const constraints = table.constraints.map((c) => JSON.stringify(c)).sort();
|
|
970
|
+
const indexes = [...table.indexes].map((idx) => JSON.stringify(idx)).sort();
|
|
971
|
+
return JSON.stringify({
|
|
972
|
+
columns,
|
|
973
|
+
constraints,
|
|
974
|
+
indexes
|
|
975
|
+
});
|
|
976
|
+
}
|
|
947
977
|
static extractPrimaryKeys(table) {
|
|
948
978
|
const pkConstraint = table.constraints.find((c) => c.type === "primary_key");
|
|
949
979
|
if (pkConstraint) return pkConstraint.columns;
|
|
@@ -960,13 +990,13 @@ var AstToUiConverter = class {
|
|
|
960
990
|
if (dataType.timezone) formatted += " WITH TIME ZONE";
|
|
961
991
|
return formatted;
|
|
962
992
|
}
|
|
963
|
-
static createEdgesFromTable(
|
|
993
|
+
static createEdgesFromTable(sourceName, sourceTable, validTables) {
|
|
964
994
|
const edges = [];
|
|
965
995
|
this.extractForeignKeys(sourceTable).forEach((fk, index) => {
|
|
966
996
|
const targetTable = validTables.find((t) => t.id === fk.referencedTable || t.name === fk.referencedTable);
|
|
967
997
|
if (!targetTable) return;
|
|
968
|
-
const sourceNodeId = generateTableNodeId(
|
|
969
|
-
const targetNodeId = generateTableNodeId(
|
|
998
|
+
const sourceNodeId = generateTableNodeId(sourceName, sourceTable.name);
|
|
999
|
+
const targetNodeId = generateTableNodeId(sourceName, targetTable.name);
|
|
970
1000
|
const edgeId = `${sourceNodeId}-fk-${index}`;
|
|
971
1001
|
const fkCols = fk.columns;
|
|
972
1002
|
const allNotNull = fkCols.every((cn) => {
|
|
@@ -3281,18 +3311,7 @@ function createReactFlowElements(nodes, edges, subgraphs, subgraphLayouts, subgr
|
|
|
3281
3311
|
return {
|
|
3282
3312
|
nodes: reactFlowNodes,
|
|
3283
3313
|
edges: edges.map((edge, index) => {
|
|
3284
|
-
const
|
|
3285
|
-
"#1976D2",
|
|
3286
|
-
"#388E3C",
|
|
3287
|
-
"#F57C00",
|
|
3288
|
-
"#7B1FA2",
|
|
3289
|
-
"#C2185B"
|
|
3290
|
-
];
|
|
3291
|
-
const edgeColor = edgeColors[index % edgeColors.length];
|
|
3292
|
-
const edgeStyle = {
|
|
3293
|
-
stroke: edgeColor,
|
|
3294
|
-
strokeWidth: 2.5
|
|
3295
|
-
};
|
|
3314
|
+
const edgeStyle = { strokeWidth: 2.5 };
|
|
3296
3315
|
const edgeType = "default";
|
|
3297
3316
|
const animated = true;
|
|
3298
3317
|
switch (edge.type) {
|
|
@@ -3322,17 +3341,13 @@ function createReactFlowElements(nodes, edges, subgraphs, subgraphLayouts, subgr
|
|
|
3322
3341
|
labelStyle: {
|
|
3323
3342
|
fontSize: "12px",
|
|
3324
3343
|
fontWeight: "500",
|
|
3325
|
-
color: edgeColor,
|
|
3326
3344
|
backgroundColor: "white",
|
|
3327
|
-
padding: "2px 6px"
|
|
3328
|
-
borderRadius: "4px",
|
|
3329
|
-
border: `1px solid ${edgeColor}`
|
|
3345
|
+
padding: "2px 6px"
|
|
3330
3346
|
},
|
|
3331
3347
|
markerEnd: {
|
|
3332
3348
|
type: MarkerType.ArrowClosed,
|
|
3333
3349
|
width: 20,
|
|
3334
|
-
height: 20
|
|
3335
|
-
color: edgeColor
|
|
3350
|
+
height: 20
|
|
3336
3351
|
},
|
|
3337
3352
|
sourceHandle: direction === "LR" || direction === "RL" ? "source-right" : "source-bottom",
|
|
3338
3353
|
targetHandle: direction === "LR" || direction === "RL" ? "target-left" : "target-top",
|
|
@@ -3818,15 +3833,11 @@ function _convertMermaidToReactFlowWithContext() {
|
|
|
3818
3833
|
componentField.data = newComponentField.data;
|
|
3819
3834
|
}
|
|
3820
3835
|
}
|
|
3821
|
-
if (ctx.dbConfig) {
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
serviceDbId: (_resolved$serviceDbId = resolved === null || resolved === void 0 ? void 0 : resolved.serviceDbId) !== null && _resolved$serviceDbId !== void 0 ? _resolved$serviceDbId : ctx.dbConfig.database,
|
|
3827
|
-
tableName: ctx.dbConfig.tableName
|
|
3828
|
-
};
|
|
3829
|
-
}
|
|
3836
|
+
if (ctx.dbConfig) clonedNode.data.serviceTable = {
|
|
3837
|
+
serviceName: ctx.dbConfig.serviceName,
|
|
3838
|
+
databaseName: ctx.dbConfig.databaseName,
|
|
3839
|
+
tableName: ctx.dbConfig.tableName
|
|
3840
|
+
};
|
|
3830
3841
|
if ((_ctx$style = ctx.style) === null || _ctx$style === void 0 ? void 0 : _ctx$style.height) clonedNode.height = ctx.style.height;
|
|
3831
3842
|
if ((_ctx$style2 = ctx.style) === null || _ctx$style2 === void 0 ? void 0 : _ctx$style2.width) clonedNode.width = ctx.style.width;
|
|
3832
3843
|
clonedNode.data = _objectSpread2(_objectSpread2(_objectSpread2({}, clonedNode.data), objectPick((_ctx$style3 = ctx.style) !== null && _ctx$style3 !== void 0 ? _ctx$style3 : {}, [
|
|
@@ -4144,12 +4155,12 @@ function buildContextNodes(graphNodes, nodeIdMap) {
|
|
|
4144
4155
|
rows: tableRows !== null && tableRows !== void 0 ? tableRows : []
|
|
4145
4156
|
};
|
|
4146
4157
|
const serviceTable = toRecord(nodeData.serviceTable);
|
|
4147
|
-
const
|
|
4148
|
-
const
|
|
4158
|
+
const serviceName = pickString(serviceTable === null || serviceTable === void 0 ? void 0 : serviceTable.serviceName);
|
|
4159
|
+
const databaseName = pickString(serviceTable === null || serviceTable === void 0 ? void 0 : serviceTable.databaseName);
|
|
4149
4160
|
const tableName = pickString(serviceTable === null || serviceTable === void 0 ? void 0 : serviceTable.tableName);
|
|
4150
|
-
if (
|
|
4151
|
-
|
|
4152
|
-
|
|
4161
|
+
if (serviceName && databaseName && tableName) nodeContext.dbConfig = {
|
|
4162
|
+
serviceName,
|
|
4163
|
+
databaseName,
|
|
4153
4164
|
tableName
|
|
4154
4165
|
};
|
|
4155
4166
|
const dynamicData = {};
|
|
@@ -4435,9 +4446,9 @@ function resolveMermaidDetailedNodeLabel(node) {
|
|
|
4435
4446
|
const lines = [];
|
|
4436
4447
|
const serviceTable = toRecord(nodeData === null || nodeData === void 0 ? void 0 : nodeData.serviceTable);
|
|
4437
4448
|
const dbConfig = toRecord(nodeData === null || nodeData === void 0 ? void 0 : nodeData.dbConfig);
|
|
4438
|
-
const database = (_pickString = pickString(serviceTable === null || serviceTable === void 0 ? void 0 : serviceTable.
|
|
4449
|
+
const database = (_pickString = pickString(serviceTable === null || serviceTable === void 0 ? void 0 : serviceTable.databaseName)) !== null && _pickString !== void 0 ? _pickString : pickString(dbConfig === null || dbConfig === void 0 ? void 0 : dbConfig.databaseName);
|
|
4439
4450
|
const tableName = (_pickString2 = pickString(serviceTable === null || serviceTable === void 0 ? void 0 : serviceTable.tableName)) !== null && _pickString2 !== void 0 ? _pickString2 : pickString(dbConfig === null || dbConfig === void 0 ? void 0 : dbConfig.tableName);
|
|
4440
|
-
const dbService = (_pickString3 = pickString(serviceTable === null || serviceTable === void 0 ? void 0 : serviceTable.
|
|
4451
|
+
const dbService = (_pickString3 = pickString(serviceTable === null || serviceTable === void 0 ? void 0 : serviceTable.serviceName)) !== null && _pickString3 !== void 0 ? _pickString3 : pickString(dbConfig === null || dbConfig === void 0 ? void 0 : dbConfig.serviceName);
|
|
4441
4452
|
const dataSourceName = name !== null && name !== void 0 ? name : tableName;
|
|
4442
4453
|
lines.push(dataSourceName ? `DataSource: ${dataSourceName}` : "DataSource");
|
|
4443
4454
|
if (database && tableName) lines.push(`db: ${database}.${tableName}`);
|