dbgate-datalib 6.6.9 → 6.6.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/TableGridDisplay.js +19 -14
- package/package.json +5 -5
package/lib/TableGridDisplay.js
CHANGED
|
@@ -60,16 +60,17 @@ class TableGridDisplay extends GridDisplay_1.GridDisplay {
|
|
|
60
60
|
getDisplayColumns(table, parentPath) {
|
|
61
61
|
var _a, _b;
|
|
62
62
|
return (((_b = (_a = table === null || table === void 0 ? void 0 : table.columns) === null || _a === void 0 ? void 0 : _a.map(col => this.getDisplayColumn(table, col, parentPath))) === null || _b === void 0 ? void 0 : _b.map(col => {
|
|
63
|
-
var _a, _b, _c;
|
|
64
|
-
return (Object.assign(Object.assign({}, col), { isChecked: this.isColumnChecked(col), hintColumnNames: ((_b = (_a = this.getFkDictionaryDescription(col.isForeignKeyUnique ? col.foreignKey : null)) === null || _a === void 0 ? void 0 : _a.columns) === null || _b === void 0 ? void 0 : _b.map(columnName => (0, dbgate_tools_1.shortenIdentifier)(`hint_${col.uniqueName}_${columnName}`, this.driver.dialect.maxIdentifierLength))) || null, hintColumnDelimiter: (_c = this.getFkDictionaryDescription(col.isForeignKeyUnique ? col.foreignKey : null)) === null || _c === void 0 ? void 0 : _c.delimiter, uniqueNameShorten: (0, dbgate_tools_1.shortenIdentifier)(col.uniqueName, this.driver.dialect.maxIdentifierLength), isExpandable: !!col.foreignKey }));
|
|
63
|
+
var _a, _b, _c, _d, _e;
|
|
64
|
+
return (Object.assign(Object.assign({}, col), { isChecked: this.isColumnChecked(col), hintColumnNames: ((_b = (_a = this.getFkDictionaryDescription(col.isForeignKeyUnique ? col.foreignKey : null)) === null || _a === void 0 ? void 0 : _a.columns) === null || _b === void 0 ? void 0 : _b.map(columnName => { var _a, _b; return (0, dbgate_tools_1.shortenIdentifier)(`hint_${col.uniqueName}_${columnName}`, (_b = (_a = this.driver) === null || _a === void 0 ? void 0 : _a.dialect) === null || _b === void 0 ? void 0 : _b.maxIdentifierLength); })) || null, hintColumnDelimiter: (_c = this.getFkDictionaryDescription(col.isForeignKeyUnique ? col.foreignKey : null)) === null || _c === void 0 ? void 0 : _c.delimiter, uniqueNameShorten: (0, dbgate_tools_1.shortenIdentifier)(col.uniqueName, (_e = (_d = this.driver) === null || _d === void 0 ? void 0 : _d.dialect) === null || _e === void 0 ? void 0 : _e.maxIdentifierLength), isExpandable: !!col.foreignKey }));
|
|
65
65
|
})) || []);
|
|
66
66
|
}
|
|
67
67
|
addJoinsFromExpandedColumns(select, columns, parentAlias, columnSources) {
|
|
68
|
+
var _a, _b;
|
|
68
69
|
for (const column of columns) {
|
|
69
70
|
if (this.isExpandedColumn(column.uniqueName)) {
|
|
70
71
|
const table = this.getFkTarget(column);
|
|
71
72
|
if (table) {
|
|
72
|
-
const childAlias = (0, dbgate_tools_1.shortenIdentifier)(`${column.uniqueName}_ref`, this.driver.dialect.maxIdentifierLength);
|
|
73
|
+
const childAlias = (0, dbgate_tools_1.shortenIdentifier)(`${column.uniqueName}_ref`, (_b = (_a = this.driver) === null || _a === void 0 ? void 0 : _a.dialect) === null || _b === void 0 ? void 0 : _b.maxIdentifierLength);
|
|
73
74
|
const subcolumns = this.getDisplayColumns(table, column.uniquePath);
|
|
74
75
|
this.addReferenceToSelect(select, parentAlias, column);
|
|
75
76
|
this.addJoinsFromExpandedColumns(select, subcolumns, childAlias, columnSources);
|
|
@@ -79,8 +80,8 @@ class TableGridDisplay extends GridDisplay_1.GridDisplay {
|
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
82
|
addReferenceToSelect(select, parentAlias, column) {
|
|
82
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
83
|
-
const childAlias = (0, dbgate_tools_1.shortenIdentifier)(`${column.uniqueName}_ref`, this.driver.dialect.maxIdentifierLength);
|
|
83
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
84
|
+
const childAlias = (0, dbgate_tools_1.shortenIdentifier)(`${column.uniqueName}_ref`, (_b = (_a = this.driver) === null || _a === void 0 ? void 0 : _a.dialect) === null || _b === void 0 ? void 0 : _b.maxIdentifierLength);
|
|
84
85
|
if ((select.from.relations || []).find(x => x.alias == childAlias))
|
|
85
86
|
return;
|
|
86
87
|
const table = this.getFkTarget(column);
|
|
@@ -102,7 +103,7 @@ class TableGridDisplay extends GridDisplay_1.GridDisplay {
|
|
|
102
103
|
},
|
|
103
104
|
right: {
|
|
104
105
|
exprType: 'column',
|
|
105
|
-
columnName: (
|
|
106
|
+
columnName: (_f = (_e = (_d = (_c = column.foreignKey) === null || _c === void 0 ? void 0 : _c.columns) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.refColumnName) !== null && _f !== void 0 ? _f : (_j = (_h = (_g = table.primaryKey) === null || _g === void 0 ? void 0 : _g.columns) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.columnName,
|
|
106
107
|
source: { name: table, alias: childAlias },
|
|
107
108
|
},
|
|
108
109
|
},
|
|
@@ -124,6 +125,7 @@ class TableGridDisplay extends GridDisplay_1.GridDisplay {
|
|
|
124
125
|
return null;
|
|
125
126
|
}
|
|
126
127
|
addHintsToSelect(select) {
|
|
128
|
+
var _a, _b, _c, _d;
|
|
127
129
|
if (this.isRawMode) {
|
|
128
130
|
return false;
|
|
129
131
|
}
|
|
@@ -141,15 +143,18 @@ class TableGridDisplay extends GridDisplay_1.GridDisplay {
|
|
|
141
143
|
if (hintDescription) {
|
|
142
144
|
const parentUniqueName = column.uniquePath.slice(0, -1).join('.');
|
|
143
145
|
this.addReferenceToSelect(select, parentUniqueName
|
|
144
|
-
? (0, dbgate_tools_1.shortenIdentifier)(`${parentUniqueName}_ref`, this.driver.dialect.maxIdentifierLength)
|
|
146
|
+
? (0, dbgate_tools_1.shortenIdentifier)(`${parentUniqueName}_ref`, (_b = (_a = this.driver) === null || _a === void 0 ? void 0 : _a.dialect) === null || _b === void 0 ? void 0 : _b.maxIdentifierLength)
|
|
145
147
|
: 'basetbl', column);
|
|
146
|
-
const childAlias = (0, dbgate_tools_1.shortenIdentifier)(`${column.uniqueName}_ref`, this.driver.dialect.maxIdentifierLength);
|
|
147
|
-
select.columns.push(...hintDescription.columns.map(columnName =>
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
148
|
+
const childAlias = (0, dbgate_tools_1.shortenIdentifier)(`${column.uniqueName}_ref`, (_d = (_c = this.driver) === null || _c === void 0 ? void 0 : _c.dialect) === null || _d === void 0 ? void 0 : _d.maxIdentifierLength);
|
|
149
|
+
select.columns.push(...hintDescription.columns.map(columnName => {
|
|
150
|
+
var _a, _b;
|
|
151
|
+
return ({
|
|
152
|
+
exprType: 'column',
|
|
153
|
+
columnName,
|
|
154
|
+
alias: (0, dbgate_tools_1.shortenIdentifier)(`hint_${column.uniqueName}_${columnName}`, (_b = (_a = this.driver) === null || _a === void 0 ? void 0 : _a.dialect) === null || _b === void 0 ? void 0 : _b.maxIdentifierLength),
|
|
155
|
+
source: { alias: childAlias },
|
|
156
|
+
});
|
|
157
|
+
}));
|
|
153
158
|
res = true;
|
|
154
159
|
}
|
|
155
160
|
}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "6.6.
|
|
2
|
+
"version": "6.6.11",
|
|
3
3
|
"name": "dbgate-datalib",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"typings": "lib/index.d.ts",
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"date-fns": "^4.1.0",
|
|
22
|
-
"dbgate-filterparser": "^6.6.
|
|
23
|
-
"dbgate-sqltree": "^6.6.
|
|
24
|
-
"dbgate-tools": "^6.6.
|
|
22
|
+
"dbgate-filterparser": "^6.6.11",
|
|
23
|
+
"dbgate-sqltree": "^6.6.11",
|
|
24
|
+
"dbgate-tools": "^6.6.11",
|
|
25
25
|
"uuid": "^3.4.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^13.7.0",
|
|
29
|
-
"dbgate-types": "^6.6.
|
|
29
|
+
"dbgate-types": "^6.6.11",
|
|
30
30
|
"jest": "^28.1.3",
|
|
31
31
|
"ts-jest": "^28.0.7",
|
|
32
32
|
"typescript": "^4.4.3"
|