dbgate-tools 5.5.4-alpha.4 → 5.5.4-alpha.8
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/SqlDumper.js +4 -4
- package/lib/stringTools.d.ts +2 -0
- package/lib/stringTools.js +11 -2
- package/package.json +3 -3
package/lib/SqlDumper.js
CHANGED
|
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.SqlDumper = void 0;
|
|
7
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
8
7
|
const isString_1 = __importDefault(require("lodash/isString"));
|
|
9
8
|
const isNumber_1 = __importDefault(require("lodash/isNumber"));
|
|
10
9
|
const isDate_1 = __importDefault(require("lodash/isDate"));
|
|
11
10
|
const isArray_1 = __importDefault(require("lodash/isArray"));
|
|
12
11
|
const isPlainObject_1 = __importDefault(require("lodash/isPlainObject"));
|
|
12
|
+
const keys_1 = __importDefault(require("lodash/keys"));
|
|
13
13
|
const v1_1 = __importDefault(require("uuid/v1"));
|
|
14
14
|
class SqlDumper {
|
|
15
15
|
static convertKeywordCase(keyword) {
|
|
@@ -221,7 +221,7 @@ class SqlDumper {
|
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
columnDefinition(column, { includeDefault = true, includeNullable = true, includeCollate = true } = {}) {
|
|
224
|
-
var _a, _b;
|
|
224
|
+
var _a, _b, _c;
|
|
225
225
|
if (column.computedExpression) {
|
|
226
226
|
this.put('^as %s', column.computedExpression);
|
|
227
227
|
if (column.isPersisted)
|
|
@@ -237,7 +237,7 @@ class SqlDumper {
|
|
|
237
237
|
if (includeNullable && !((_a = this.dialect) === null || _a === void 0 ? void 0 : _a.specificNullabilityImplementation)) {
|
|
238
238
|
this.put(column.notNull ? '^not ^null' : '^null');
|
|
239
239
|
}
|
|
240
|
-
if (includeDefault && ((_b = column.defaultValue) === null || _b === void 0 ? void 0 : _b.trim())) {
|
|
240
|
+
if (includeDefault && ((_c = (_b = column.defaultValue) === null || _b === void 0 ? void 0 : _b.toString()) === null || _c === void 0 ? void 0 : _c.trim())) {
|
|
241
241
|
this.columnDefault(column);
|
|
242
242
|
}
|
|
243
243
|
}
|
|
@@ -634,7 +634,7 @@ class SqlDumper {
|
|
|
634
634
|
let was = false;
|
|
635
635
|
for (const row of newRows) {
|
|
636
636
|
const old = oldRows === null || oldRows === void 0 ? void 0 : oldRows.find(r => key.every(col => r[col] == row[col]));
|
|
637
|
-
const rowKeys =
|
|
637
|
+
const rowKeys = (0, keys_1.default)(row);
|
|
638
638
|
if (old) {
|
|
639
639
|
const updated = [];
|
|
640
640
|
for (const col of rowKeys) {
|
package/lib/stringTools.d.ts
CHANGED
|
@@ -25,7 +25,9 @@ export declare function getConvertValueMenu(value: any, onSetValue: any, editorT
|
|
|
25
25
|
onClick: () => any;
|
|
26
26
|
}[];
|
|
27
27
|
export declare function extractErrorMessage(err: any, defaultMessage?: string): any;
|
|
28
|
+
export declare function extractErrorStackTrace(err: any): string;
|
|
28
29
|
export declare function extractErrorLogData(err: any, additionalFields?: {}): {
|
|
29
30
|
errorMessage: any;
|
|
30
31
|
errorObject: any;
|
|
32
|
+
errorStack: string;
|
|
31
33
|
};
|
package/lib/stringTools.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.extractErrorLogData = exports.extractErrorMessage = exports.getConvertValueMenu = exports.detectTypeIcon = exports.detectCellDataType = exports.parseSqlDefaultValue = exports.getAsImageSrc = exports.arrayBufferToBase64 = exports.isWktGeometry = exports.getIconForRedisType = exports.isJsonLikeLongString = exports.shouldOpenMultilineDialog = exports.safeJsonParse = exports.stringifyCellValue = exports.parseCellValue = exports.hexStringToArray = exports.arrayToHexString = void 0;
|
|
6
|
+
exports.extractErrorLogData = exports.extractErrorStackTrace = exports.extractErrorMessage = exports.getConvertValueMenu = exports.detectTypeIcon = exports.detectCellDataType = exports.parseSqlDefaultValue = exports.getAsImageSrc = exports.arrayBufferToBase64 = exports.isWktGeometry = exports.getIconForRedisType = exports.isJsonLikeLongString = exports.shouldOpenMultilineDialog = exports.safeJsonParse = exports.stringifyCellValue = exports.parseCellValue = exports.hexStringToArray = exports.arrayToHexString = void 0;
|
|
7
7
|
const isString_1 = __importDefault(require("lodash/isString"));
|
|
8
8
|
const isArray_1 = __importDefault(require("lodash/isArray"));
|
|
9
9
|
const isNumber_1 = __importDefault(require("lodash/isNumber"));
|
|
@@ -462,9 +462,18 @@ function extractErrorMessage(err, defaultMessage = 'Unknown error') {
|
|
|
462
462
|
return defaultMessage;
|
|
463
463
|
}
|
|
464
464
|
exports.extractErrorMessage = extractErrorMessage;
|
|
465
|
+
function extractErrorStackTrace(err) {
|
|
466
|
+
const { stack } = err;
|
|
467
|
+
if (!(0, isString_1.default)(stack))
|
|
468
|
+
return undefined;
|
|
469
|
+
if (stack.length > 1000)
|
|
470
|
+
return stack.substring(0, 1000) + '... (truncated)';
|
|
471
|
+
return stack;
|
|
472
|
+
}
|
|
473
|
+
exports.extractErrorStackTrace = extractErrorStackTrace;
|
|
465
474
|
function extractErrorLogData(err, additionalFields = {}) {
|
|
466
475
|
if (!err)
|
|
467
476
|
return null;
|
|
468
|
-
return Object.assign({ errorMessage: extractErrorMessage(err), errorObject: err }, additionalFields);
|
|
477
|
+
return Object.assign({ errorMessage: extractErrorMessage(err), errorObject: err, errorStack: extractErrorStackTrace(err) }, additionalFields);
|
|
469
478
|
}
|
|
470
479
|
exports.extractErrorLogData = extractErrorLogData;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "5.5.4-alpha.
|
|
2
|
+
"version": "5.5.4-alpha.8",
|
|
3
3
|
"name": "dbgate-tools",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"typings": "lib/index.d.ts",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
],
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node": "^13.7.0",
|
|
28
|
-
"dbgate-types": "^5.5.4-alpha.
|
|
28
|
+
"dbgate-types": "^5.5.4-alpha.8",
|
|
29
29
|
"jest": "^24.9.0",
|
|
30
30
|
"ts-jest": "^25.2.1",
|
|
31
31
|
"typescript": "^4.4.3"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"dbgate-query-splitter": "^4.10.5",
|
|
35
|
-
"dbgate-sqltree": "^5.5.4-alpha.
|
|
35
|
+
"dbgate-sqltree": "^5.5.4-alpha.8",
|
|
36
36
|
"debug": "^4.3.4",
|
|
37
37
|
"json-stable-stringify": "^1.0.1",
|
|
38
38
|
"lodash": "^4.17.21",
|