dbgate-tools 5.5.4-alpha.7 → 5.5.4
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 +1 -0
- package/lib/stringTools.js +16 -4
- 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
package/lib/stringTools.js
CHANGED
|
@@ -3,9 +3,10 @@ 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.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;
|
|
6
|
+
exports.safeFormatDate = 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
|
+
const isDate_1 = __importDefault(require("lodash/isDate"));
|
|
9
10
|
const isNumber_1 = __importDefault(require("lodash/isNumber"));
|
|
10
11
|
const isPlainObject_1 = __importDefault(require("lodash/isPlainObject"));
|
|
11
12
|
const pad_1 = __importDefault(require("lodash/pad"));
|
|
@@ -179,17 +180,18 @@ function stringifyCellValue(value, intent, editorTypes, gridFormattingOptions, j
|
|
|
179
180
|
}
|
|
180
181
|
if (editorTypes === null || editorTypes === void 0 ? void 0 : editorTypes.parseDateAsDollar) {
|
|
181
182
|
if (value === null || value === void 0 ? void 0 : value.$date) {
|
|
183
|
+
const dateString = (0, isDate_1.default)(value.$date) ? value.$date.toISOString() : value.$date.toString();
|
|
182
184
|
switch (intent) {
|
|
183
185
|
case 'exportIntent':
|
|
184
186
|
case 'stringConversionIntent':
|
|
185
|
-
return { value:
|
|
187
|
+
return { value: dateString };
|
|
186
188
|
default:
|
|
187
|
-
const m =
|
|
189
|
+
const m = dateString.match(dateTimeStorageRegex);
|
|
188
190
|
if (m) {
|
|
189
191
|
return { value: `${m[1]}-${m[2]}-${m[3]} ${m[4]}:${m[5]}:${m[6]}`, gridStyle: 'valueCellStyle' };
|
|
190
192
|
}
|
|
191
193
|
else {
|
|
192
|
-
return { value:
|
|
194
|
+
return { value: dateString.replace('T', ' '), gridStyle: 'valueCellStyle' };
|
|
193
195
|
}
|
|
194
196
|
}
|
|
195
197
|
}
|
|
@@ -477,3 +479,13 @@ function extractErrorLogData(err, additionalFields = {}) {
|
|
|
477
479
|
return Object.assign({ errorMessage: extractErrorMessage(err), errorObject: err, errorStack: extractErrorStackTrace(err) }, additionalFields);
|
|
478
480
|
}
|
|
479
481
|
exports.extractErrorLogData = extractErrorLogData;
|
|
482
|
+
function safeFormatDate(date) {
|
|
483
|
+
try {
|
|
484
|
+
const v = new Date(date);
|
|
485
|
+
return v.toISOString().substring(0, 10);
|
|
486
|
+
}
|
|
487
|
+
catch (e) {
|
|
488
|
+
return date === null || date === void 0 ? void 0 : date.toString();
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
exports.safeFormatDate = safeFormatDate;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "5.5.4
|
|
2
|
+
"version": "5.5.4",
|
|
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
|
|
28
|
+
"dbgate-types": "^5.5.4",
|
|
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
|
|
35
|
+
"dbgate-sqltree": "^5.5.4",
|
|
36
36
|
"debug": "^4.3.4",
|
|
37
37
|
"json-stable-stringify": "^1.0.1",
|
|
38
38
|
"lodash": "^4.17.21",
|