dbgate-datalib 4.4.5-alpha.1 → 4.5.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.
- package/lib/GridConfig.d.ts +1 -1
- package/lib/GridConfig.js +1 -1
- package/lib/GridDisplay.d.ts +3 -2
- package/lib/GridDisplay.js +7 -4
- package/lib/deleteCascade.js +7 -4
- package/package.json +4 -4
package/lib/GridConfig.d.ts
CHANGED
package/lib/GridConfig.js
CHANGED
package/lib/GridDisplay.d.ts
CHANGED
|
@@ -55,11 +55,12 @@ export declare abstract class GridDisplay {
|
|
|
55
55
|
isDynamicStructure: boolean;
|
|
56
56
|
setColumnVisibility(uniquePath: string[], isVisible: boolean): void;
|
|
57
57
|
addDynamicColumn(name: string): void;
|
|
58
|
-
|
|
58
|
+
focusColumns(uniqueNames: string[]): void;
|
|
59
59
|
get hasReferences(): boolean;
|
|
60
|
-
get
|
|
60
|
+
get focusedColumns(): string[];
|
|
61
61
|
get engine(): string;
|
|
62
62
|
get allColumns(): DisplayColumn[];
|
|
63
|
+
findColumn(uniqueName: string): DisplayColumn;
|
|
63
64
|
getFkTarget(column: DisplayColumn): TableInfo;
|
|
64
65
|
reload(): void;
|
|
65
66
|
includeInColumnSet(field: keyof GridConfigColumns, uniqueName: string, isIncluded: boolean): void;
|
package/lib/GridDisplay.js
CHANGED
|
@@ -52,14 +52,14 @@ class GridDisplay {
|
|
|
52
52
|
addDynamicColumn(name) {
|
|
53
53
|
this.includeInColumnSet('addedColumns', name, true);
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
this.setConfig(cfg => (Object.assign(Object.assign({}, cfg), {
|
|
55
|
+
focusColumns(uniqueNames) {
|
|
56
|
+
this.setConfig(cfg => (Object.assign(Object.assign({}, cfg), { focusedColumns: uniqueNames })));
|
|
57
57
|
}
|
|
58
58
|
get hasReferences() {
|
|
59
59
|
return false;
|
|
60
60
|
}
|
|
61
|
-
get
|
|
62
|
-
return this.config.
|
|
61
|
+
get focusedColumns() {
|
|
62
|
+
return this.config.focusedColumns;
|
|
63
63
|
}
|
|
64
64
|
get engine() {
|
|
65
65
|
var _a;
|
|
@@ -68,6 +68,9 @@ class GridDisplay {
|
|
|
68
68
|
get allColumns() {
|
|
69
69
|
return this.getColumns(null).filter(col => col.isChecked || col.uniquePath.length == 1);
|
|
70
70
|
}
|
|
71
|
+
findColumn(uniqueName) {
|
|
72
|
+
return this.getColumns(null).find(x => x.uniqueName == uniqueName);
|
|
73
|
+
}
|
|
71
74
|
getFkTarget(column) {
|
|
72
75
|
return null;
|
|
73
76
|
}
|
package/lib/deleteCascade.js
CHANGED
|
@@ -7,15 +7,18 @@ exports.getDeleteCascades = void 0;
|
|
|
7
7
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
8
|
const ChangeSet_1 = require("./ChangeSet");
|
|
9
9
|
// function getDeleteScript()
|
|
10
|
-
function processDependencies(changeSet, result, allForeignKeys, fkPath, table, baseCmd, dbinfo) {
|
|
10
|
+
function processDependencies(changeSet, result, allForeignKeys, fkPath, table, baseCmd, dbinfo, usedTables) {
|
|
11
11
|
if (result.find(x => x.title == table.pureName))
|
|
12
12
|
return;
|
|
13
13
|
const dependencies = allForeignKeys.filter(x => x.refSchemaName == table.schemaName && x.refTableName == table.pureName);
|
|
14
14
|
for (const fk of dependencies) {
|
|
15
15
|
const depTable = dbinfo.tables.find(x => x.pureName == fk.pureName && x.schemaName == fk.schemaName);
|
|
16
16
|
const subFkPath = [...fkPath, fk];
|
|
17
|
-
if (depTable && depTable.pureName
|
|
18
|
-
processDependencies(changeSet, result, allForeignKeys, subFkPath, depTable, baseCmd, dbinfo
|
|
17
|
+
if (depTable && !usedTables.includes(depTable.pureName)) {
|
|
18
|
+
processDependencies(changeSet, result, allForeignKeys, subFkPath, depTable, baseCmd, dbinfo, [
|
|
19
|
+
...usedTables,
|
|
20
|
+
depTable.pureName,
|
|
21
|
+
]);
|
|
19
22
|
}
|
|
20
23
|
const refCmd = {
|
|
21
24
|
commandType: 'delete',
|
|
@@ -103,7 +106,7 @@ function getDeleteCascades(changeSet, dbinfo) {
|
|
|
103
106
|
const table = dbinfo.tables.find(x => x.pureName == baseCmd.pureName && x.schemaName == baseCmd.schemaName);
|
|
104
107
|
if (!table.primaryKey)
|
|
105
108
|
continue;
|
|
106
|
-
processDependencies(changeSet, result, allForeignKeys, [], table, baseCmd, dbinfo);
|
|
109
|
+
processDependencies(changeSet, result, allForeignKeys, [], table, baseCmd, dbinfo, [table.pureName]);
|
|
107
110
|
// let resItem = result.find(x => x.title == baseCmd.pureName);
|
|
108
111
|
// if (!resItem) {
|
|
109
112
|
// resItem = {
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "4.
|
|
2
|
+
"version": "4.5.0",
|
|
3
3
|
"name": "dbgate-datalib",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"typings": "lib/index.d.ts",
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
"lib"
|
|
12
12
|
],
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"dbgate-sqltree": "^4.
|
|
15
|
-
"dbgate-filterparser": "^4.
|
|
14
|
+
"dbgate-sqltree": "^4.5.0",
|
|
15
|
+
"dbgate-filterparser": "^4.5.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"dbgate-types": "^4.
|
|
18
|
+
"dbgate-types": "^4.5.0",
|
|
19
19
|
"@types/node": "^13.7.0",
|
|
20
20
|
"typescript": "^4.4.3"
|
|
21
21
|
}
|