dbgate-tools 5.5.4-alpha.8 → 5.5.5

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.
@@ -31,3 +31,4 @@ export declare function extractErrorLogData(err: any, additionalFields?: {}): {
31
31
  errorObject: any;
32
32
  errorStack: string;
33
33
  };
34
+ export declare function safeFormatDate(date: any): any;
@@ -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: value.$date };
187
+ return { value: dateString };
186
188
  default:
187
- const m = value.$date.match(dateTimeStorageRegex);
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: value.$date.replaCE('T', ' '), gridStyle: 'valueCellStyle' };
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-alpha.8",
2
+ "version": "5.5.5",
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.8",
28
+ "dbgate-types": "^5.5.5",
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
- "dbgate-query-splitter": "^4.10.5",
35
- "dbgate-sqltree": "^5.5.4-alpha.8",
34
+ "dbgate-query-splitter": "^4.11.2",
35
+ "dbgate-sqltree": "^5.5.5",
36
36
  "debug": "^4.3.4",
37
37
  "json-stable-stringify": "^1.0.1",
38
38
  "lodash": "^4.17.21",