dbgate-tools 6.7.2 → 6.8.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.
@@ -151,6 +151,11 @@ class DatabaseAnalyser {
151
151
  }
152
152
  const res = {};
153
153
  for (const field of STRUCTURE_FIELDS) {
154
+ const isAll = this.modifications.some(x => x.action == 'all' && x.objectTypeField == field);
155
+ if (isAll) {
156
+ res[field] = newlyAnalysed[field] || [];
157
+ continue;
158
+ }
154
159
  const removedIds = this.modifications
155
160
  .filter(x => x.action == 'remove' && x.objectTypeField == field)
156
161
  .map(x => x.objectId);
@@ -116,6 +116,7 @@ export declare class SqlDumper implements AlterProcessor {
116
116
  selectTableIntoNewTable(sourceName: NamedObjectInfo, targetName: NamedObjectInfo): void;
117
117
  truncateTable(name: NamedObjectInfo): void;
118
118
  dropConstraints(table: TableInfo, dropReferences?: boolean): void;
119
+ sanitizeTableConstraints(table: TableInfo): TableInfo;
119
120
  recreateTable(oldTable: TableInfo, newTable: TableInfo): void;
120
121
  createSqlObject(obj: SqlObjectInfo): void;
121
122
  getSqlObjectSqlName(ojectTypeField: string): "PROCEDURE" | "VIEW" | "FUNCTION" | "TRIGGER" | "MATERIALIZED VIEW" | "EVENT";
package/lib/SqlDumper.js CHANGED
@@ -10,6 +10,7 @@ const isDate_1 = __importDefault(require("lodash/isDate"));
10
10
  const isArray_1 = __importDefault(require("lodash/isArray"));
11
11
  const isPlainObject_1 = __importDefault(require("lodash/isPlainObject"));
12
12
  const keys_1 = __importDefault(require("lodash/keys"));
13
+ const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
13
14
  const v1_1 = __importDefault(require("uuid/v1"));
14
15
  class SqlDumper {
15
16
  static convertKeywordCase(keyword) {
@@ -76,6 +77,8 @@ class SqlDumper {
76
77
  }
77
78
  else if (value === null || value === void 0 ? void 0 : value.$bigint)
78
79
  this.putRaw(value === null || value === void 0 ? void 0 : value.$bigint);
80
+ else if (value === null || value === void 0 ? void 0 : value.$decimal)
81
+ this.putRaw(value === null || value === void 0 ? void 0 : value.$decimal);
79
82
  else if ((0, isPlainObject_1.default)(value) || (0, isArray_1.default)(value))
80
83
  this.putStringValue(JSON.stringify(value));
81
84
  else
@@ -598,6 +601,55 @@ class SqlDumper {
598
601
  this.dropPrimaryKey(table.primaryKey);
599
602
  }
600
603
  }
604
+ sanitizeTableConstraints(table) {
605
+ // Create a deep copy of the table
606
+ const sanitized = (0, cloneDeep_1.default)(table);
607
+ // Get the set of existing column names
608
+ const existingColumns = new Set(sanitized.columns.map(col => col.columnName));
609
+ // Filter primary key columns to only include existing columns
610
+ if (sanitized.primaryKey) {
611
+ const validPkColumns = sanitized.primaryKey.columns.filter(col => existingColumns.has(col.columnName));
612
+ if (validPkColumns.length === 0) {
613
+ // If no valid columns remain, remove the primary key entirely
614
+ sanitized.primaryKey = null;
615
+ }
616
+ else if (validPkColumns.length < sanitized.primaryKey.columns.length) {
617
+ // Update primary key with only valid columns
618
+ sanitized.primaryKey = {
619
+ ...sanitized.primaryKey,
620
+ columns: validPkColumns
621
+ };
622
+ }
623
+ }
624
+ // Filter sorting key columns to only include existing columns
625
+ if (sanitized.sortingKey) {
626
+ const validSkColumns = sanitized.sortingKey.columns.filter(col => existingColumns.has(col.columnName));
627
+ if (validSkColumns.length === 0) {
628
+ sanitized.sortingKey = null;
629
+ }
630
+ else if (validSkColumns.length < sanitized.sortingKey.columns.length) {
631
+ sanitized.sortingKey = {
632
+ ...sanitized.sortingKey,
633
+ columns: validSkColumns
634
+ };
635
+ }
636
+ }
637
+ // Filter foreign keys to only include those with all columns present
638
+ if (sanitized.foreignKeys) {
639
+ sanitized.foreignKeys = sanitized.foreignKeys.filter(fk => fk.columns.every(col => existingColumns.has(col.columnName)));
640
+ }
641
+ // Filter indexes to only include those with all columns present
642
+ if (sanitized.indexes) {
643
+ sanitized.indexes = sanitized.indexes.filter(idx => idx.columns.every(col => existingColumns.has(col.columnName)));
644
+ }
645
+ // Filter unique constraints to only include those with all columns present
646
+ if (sanitized.uniques) {
647
+ sanitized.uniques = sanitized.uniques.filter(uq => uq.columns.every(col => existingColumns.has(col.columnName)));
648
+ }
649
+ // Filter dependencies (references from other tables) - these should remain as-is
650
+ // since they don't affect the CREATE TABLE statement for this table
651
+ return sanitized;
652
+ }
601
653
  recreateTable(oldTable, newTable) {
602
654
  if (!oldTable.pairingId || !newTable.pairingId || oldTable.pairingId != newTable.pairingId) {
603
655
  throw new Error('Recreate is not possible: oldTable.paringId != newTable.paringId');
@@ -609,29 +661,31 @@ class SqlDumper {
609
661
  newcol: newTable.columns.find(x => x.pairingId == oldcol.pairingId),
610
662
  }))
611
663
  .filter(x => x.newcol);
664
+ // Create a sanitized version of newTable with constraints that only reference existing columns
665
+ const sanitizedNewTable = this.sanitizeTableConstraints(newTable);
612
666
  if (this.driver.supportsTransactions) {
613
667
  this.dropConstraints(oldTable, true);
614
668
  this.renameTable(oldTable, tmpTable);
615
- this.createTable(newTable);
616
- const autoinc = newTable.columns.find(x => x.autoIncrement);
669
+ this.createTable(sanitizedNewTable);
670
+ const autoinc = sanitizedNewTable.columns.find(x => x.autoIncrement);
617
671
  if (autoinc) {
618
- this.allowIdentityInsert(newTable, true);
672
+ this.allowIdentityInsert(sanitizedNewTable, true);
619
673
  }
620
- this.putCmd('^insert ^into %f (%,i) select %,i ^from %f', newTable, columnPairs.map(x => x.newcol.columnName), columnPairs.map(x => x.oldcol.columnName), { ...oldTable, pureName: tmpTable });
674
+ this.putCmd('^insert ^into %f (%,i) select %,i ^from %f', sanitizedNewTable, columnPairs.map(x => x.newcol.columnName), columnPairs.map(x => x.oldcol.columnName), { ...oldTable, pureName: tmpTable });
621
675
  if (autoinc) {
622
- this.allowIdentityInsert(newTable, false);
676
+ this.allowIdentityInsert(sanitizedNewTable, false);
623
677
  }
624
678
  if (this.dialect.dropForeignKey) {
625
- newTable.dependencies.forEach(cnt => this.createConstraint(cnt));
679
+ sanitizedNewTable.dependencies.forEach(cnt => this.createConstraint(cnt));
626
680
  }
627
681
  this.dropTable({ ...oldTable, pureName: tmpTable });
628
682
  }
629
683
  else {
630
684
  // we have to preserve old table as long as possible
631
- this.createTable({ ...newTable, pureName: tmpTable });
632
- this.putCmd('^insert ^into %f (%,i) select %,s ^from %f', { ...newTable, pureName: tmpTable }, columnPairs.map(x => x.newcol.columnName), columnPairs.map(x => x.oldcol.columnName), oldTable);
685
+ this.createTable({ ...sanitizedNewTable, pureName: tmpTable });
686
+ this.putCmd('^insert ^into %f (%,i) select %,s ^from %f', { ...sanitizedNewTable, pureName: tmpTable }, columnPairs.map(x => x.newcol.columnName), columnPairs.map(x => x.oldcol.columnName), oldTable);
633
687
  this.dropTable(oldTable);
634
- this.renameTable({ ...newTable, pureName: tmpTable }, newTable.pureName);
688
+ this.renameTable({ ...sanitizedNewTable, pureName: tmpTable }, newTable.pureName);
635
689
  }
636
690
  }
637
691
  createSqlObject(obj) {
@@ -65,8 +65,8 @@ interface AlterOperation_RenameConstraint {
65
65
  }
66
66
  interface AlterOperation_RecreateTable {
67
67
  operationType: 'recreateTable';
68
- table: TableInfo;
69
- operations: AlterOperation[];
68
+ oldTable: TableInfo;
69
+ newTable: TableInfo;
70
70
  }
71
71
  interface AlterOperation_FillPreloadedRows {
72
72
  operationType: 'fillPreloadedRows';
@@ -110,7 +110,7 @@ export declare class AlterPlan {
110
110
  renameSqlObject(table: TableInfo, newName: string): void;
111
111
  renameColumn(column: ColumnInfo, newName: string): void;
112
112
  renameConstraint(constraint: ConstraintInfo, newName: string): void;
113
- recreateTable(table: TableInfo, operations: AlterOperation[]): void;
113
+ recreateTable(oldTable: TableInfo, newTable: TableInfo): void;
114
114
  fillPreloadedRows(table: NamedObjectInfo, oldRows: any[], newRows: any[], key: string[], insertOnly: string[], autoIncrementColumn: string): void;
115
115
  setTableOption(table: TableInfo, optionName: string, optionValue: string): void;
116
116
  run(processor: AlterProcessor): void;
@@ -121,6 +121,7 @@ export declare class AlterPlan {
121
121
  _canCreateConstraint(cnt: ConstraintInfo): boolean;
122
122
  _canDropConstraint(cnt: ConstraintInfo): boolean;
123
123
  _testTableRecreate(op: AlterOperation, operationType: string, isAllowed: boolean | Function, objectField: string): AlterOperation[] | null;
124
+ _removeRecreatedTableAlters(): AlterOperation[];
124
125
  _groupTableRecreations(): AlterOperation[];
125
126
  _moveForeignKeysToLast(): AlterOperation[];
126
127
  _filterAllowedOperations(): AlterOperation[];
package/lib/alterPlan.js CHANGED
@@ -5,9 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.runAlterOperation = exports.AlterPlan = void 0;
7
7
  const lodash_1 = __importDefault(require("lodash"));
8
- const diffTools_1 = require("./diffTools");
9
- const database_info_alter_processor_1 = require("./database-info-alter-processor");
10
- const DatabaseAnalyser_1 = require("./DatabaseAnalyser");
11
8
  class AlterPlan {
12
9
  constructor(wholeOldDb, wholeNewDb, dialect, opts) {
13
10
  this.wholeOldDb = wholeOldDb;
@@ -111,11 +108,11 @@ class AlterPlan {
111
108
  newName,
112
109
  });
113
110
  }
114
- recreateTable(table, operations) {
111
+ recreateTable(oldTable, newTable) {
115
112
  this.operations.push({
116
113
  operationType: 'recreateTable',
117
- table,
118
- operations,
114
+ oldTable,
115
+ newTable,
119
116
  });
120
117
  this.recreates.tables += 1;
121
118
  }
@@ -181,7 +178,11 @@ class AlterPlan {
181
178
  return opRes;
182
179
  }),
183
180
  op,
184
- ];
181
+ ].filter(op => {
182
+ // filter duplicated drops
183
+ const existingDrop = this.operations.find(o => o.operationType == 'dropConstraint' && o.oldObject === op['oldObject']);
184
+ return existingDrop == null;
185
+ });
185
186
  return res;
186
187
  }
187
188
  for (const [testedOperationType, testedDependencies, testedObject] of [
@@ -325,50 +326,110 @@ class AlterPlan {
325
326
  // skip this operation, as it cannot be achieved
326
327
  return [];
327
328
  }
328
- const table = this.wholeNewDb.tables.find(x => x.pureName == op[objectField].pureName && x.schemaName == op[objectField].schemaName);
329
+ const oldTable = this.wholeOldDb.tables.find(x => x.pureName == op[objectField].pureName && x.schemaName == op[objectField].schemaName);
330
+ const newTable = this.wholeNewDb.tables.find(x => x.pureName == op[objectField].pureName && x.schemaName == op[objectField].schemaName);
329
331
  this.recreates.tables += 1;
330
332
  return [
331
333
  {
332
334
  operationType: 'recreateTable',
333
- table,
334
- operations: [op],
335
+ oldTable,
336
+ newTable,
337
+ // operations: [op],
335
338
  },
336
339
  ];
337
340
  }
338
341
  return null;
339
342
  }
340
- _groupTableRecreations() {
343
+ _removeRecreatedTableAlters() {
341
344
  const res = [];
342
- const recreates = {};
345
+ const recreates = new Set();
343
346
  for (const op of this.operations) {
344
- if (op.operationType == 'recreateTable' && op.table) {
345
- const existingRecreate = recreates[`${op.table.schemaName}||${op.table.pureName}`];
346
- if (existingRecreate) {
347
- existingRecreate.operations.push(...op.operations);
348
- }
349
- else {
350
- const recreate = {
351
- ...op,
352
- operations: [...op.operations],
353
- };
354
- res.push(recreate);
355
- recreates[`${op.table.schemaName}||${op.table.pureName}`] = recreate;
356
- }
347
+ if (op.operationType == 'recreateTable' && op.oldTable && op.newTable) {
348
+ const key = `${op.oldTable.schemaName}||${op.oldTable.pureName}`;
349
+ recreates.add(key);
357
350
  }
358
- else {
359
- // @ts-ignore
360
- const oldObject = op.oldObject || op.object;
361
- if (oldObject) {
362
- const recreated = recreates[`${oldObject.schemaName}||${oldObject.pureName}`];
363
- if (recreated) {
364
- recreated.operations.push(op);
365
- continue;
351
+ }
352
+ for (const op of this.operations) {
353
+ switch (op.operationType) {
354
+ case 'createColumn':
355
+ case 'createConstraint':
356
+ {
357
+ const key = `${op.newObject.schemaName}||${op.newObject.pureName}`;
358
+ if (recreates.has(key)) {
359
+ // skip create inside recreated table
360
+ continue;
361
+ }
362
+ }
363
+ break;
364
+ case 'dropColumn':
365
+ case 'dropConstraint':
366
+ case 'changeColumn':
367
+ {
368
+ const key = `${op.oldObject.schemaName}||${op.oldObject.pureName}`;
369
+ if (recreates.has(key)) {
370
+ // skip drop/change inside recreated table
371
+ continue;
372
+ }
366
373
  }
374
+ break;
375
+ case 'renameColumn':
376
+ {
377
+ const key = `${op.object.schemaName}||${op.object.pureName}`;
378
+ if (recreates.has(key)) {
379
+ // skip rename inside recreated table
380
+ continue;
381
+ }
382
+ }
383
+ break;
384
+ }
385
+ res.push(op);
386
+ }
387
+ return res;
388
+ }
389
+ _groupTableRecreations() {
390
+ const res = [];
391
+ const recreates = new Set();
392
+ for (const op of this.operations) {
393
+ if (op.operationType == 'recreateTable' && op.oldTable && op.newTable) {
394
+ const key = `${op.oldTable.schemaName}||${op.oldTable.pureName}`;
395
+ if (recreates.has(key)) {
396
+ // prevent duplicate recreates
397
+ continue;
367
398
  }
368
- res.push(op);
399
+ recreates.add(key);
369
400
  }
401
+ res.push(op);
370
402
  }
371
403
  return res;
404
+ // const res = [];
405
+ // const recreates = {};
406
+ // for (const op of this.operations) {
407
+ // if (op.operationType == 'recreateTable' && op.table) {
408
+ // const existingRecreate = recreates[`${op.table.schemaName}||${op.table.pureName}`];
409
+ // if (existingRecreate) {
410
+ // existingRecreate.operations.push(...op.operations);
411
+ // } else {
412
+ // const recreate = {
413
+ // ...op,
414
+ // operations: [...op.operations],
415
+ // };
416
+ // res.push(recreate);
417
+ // recreates[`${op.table.schemaName}||${op.table.pureName}`] = recreate;
418
+ // }
419
+ // } else {
420
+ // // @ts-ignore
421
+ // const oldObject: TableInfo = op.oldObject || op.object;
422
+ // if (oldObject) {
423
+ // const recreated = recreates[`${oldObject.schemaName}||${oldObject.pureName}`];
424
+ // if (recreated) {
425
+ // recreated.operations.push(op);
426
+ // continue;
427
+ // }
428
+ // }
429
+ // res.push(op);
430
+ // }
431
+ // }
432
+ // return res;
372
433
  }
373
434
  _moveForeignKeysToLast() {
374
435
  if (!this.dialect.createForeignKey) {
@@ -427,6 +488,7 @@ class AlterPlan {
427
488
  // console.log('*****************OPERATIONS2', this.operations);
428
489
  this.operations = this._groupTableRecreations();
429
490
  // console.log('*****************OPERATIONS3', this.operations);
491
+ this.operations = this._removeRecreatedTableAlters();
430
492
  this.operations = this._moveForeignKeysToLast();
431
493
  // console.log('*****************OPERATIONS4', this.operations);
432
494
  this.operations = this._filterAllowedOperations();
@@ -486,16 +548,16 @@ function runAlterOperation(op, processor) {
486
548
  break;
487
549
  case 'recreateTable':
488
550
  {
489
- const oldTable = (0, diffTools_1.generateTablePairingId)(op.table);
490
- const newTable = lodash_1.default.cloneDeep(oldTable);
491
- const newDb = DatabaseAnalyser_1.DatabaseAnalyser.createEmptyStructure();
492
- newDb.tables.push(newTable);
493
- // console.log('////////////////////////////newTable1', newTable);
494
- op.operations.forEach(child => runAlterOperation(child, new database_info_alter_processor_1.DatabaseInfoAlterProcessor(newDb)));
495
- // console.log('////////////////////////////op.operations', op.operations);
496
- // console.log('////////////////////////////op.table', op.table);
497
- // console.log('////////////////////////////newTable2', newTable);
498
- processor.recreateTable(oldTable, newTable);
551
+ // const oldTable = generateTablePairingId(op.table);
552
+ // const newTable = _.cloneDeep(oldTable);
553
+ // const newDb = DatabaseAnalyser.createEmptyStructure();
554
+ // newDb.tables.push(newTable);
555
+ // // console.log('////////////////////////////newTable1', newTable);
556
+ // op.operations.forEach(child => runAlterOperation(child, new DatabaseInfoAlterProcessor(newDb)));
557
+ // // console.log('////////////////////////////op.operations', op.operations);
558
+ // // console.log('////////////////////////////op.table', op.table);
559
+ // // console.log('////////////////////////////newTable2', newTable);
560
+ processor.recreateTable(op.oldTable, op.newTable);
499
561
  }
500
562
  break;
501
563
  }
@@ -7,7 +7,7 @@ export declare function base64ToHex(base64String: any): string;
7
7
  export declare function hexToBase64(hexString: any): string;
8
8
  export declare function parseCellValue(value: any, editorTypes?: DataEditorTypesBehaviour): any;
9
9
  export declare function stringifyCellValue(value: any, intent: 'gridCellIntent' | 'inlineEditorIntent' | 'multilineEditorIntent' | 'stringConversionIntent' | 'exportIntent' | 'clipboardIntent', editorTypes?: DataEditorTypesBehaviour, gridFormattingOptions?: {
10
- useThousandsSeparator?: boolean;
10
+ thousandsSeparator?: string;
11
11
  }, jsonParsedValue?: any): {
12
12
  value: string;
13
13
  gridStyle?: 'textCellStyle' | 'valueCellStyle' | 'nullCellStyle';
@@ -37,9 +37,11 @@ function base64ToHex(base64String) {
37
37
  return '0x' + hexString.toUpperCase();
38
38
  }
39
39
  exports.base64ToHex = base64ToHex;
40
- ;
41
40
  function hexToBase64(hexString) {
42
- const binaryString = hexString.match(/.{1,2}/g).map(byte => String.fromCharCode(parseInt(byte, 16))).join('');
41
+ const binaryString = hexString
42
+ .match(/.{1,2}/g)
43
+ .map(byte => String.fromCharCode(parseInt(byte, 16)))
44
+ .join('');
43
45
  return btoa(binaryString);
44
46
  }
45
47
  exports.hexToBase64 = hexToBase64;
@@ -55,8 +57,8 @@ function parseCellValue(value, editorTypes) {
55
57
  if (mHex) {
56
58
  return {
57
59
  $binary: {
58
- base64: hexToBase64(value.substring(2))
59
- }
60
+ base64: hexToBase64(value.substring(2)),
61
+ },
60
62
  };
61
63
  }
62
64
  }
@@ -182,6 +184,30 @@ function stringifyJsonToGrid(value) {
182
184
  }
183
185
  return { value: '(JSON)', gridStyle: 'nullCellStyle' };
184
186
  }
187
+ function formatNumberCustomSeparator(value, thousandsSeparator) {
188
+ const [intPart, decPart] = value.split('.');
189
+ const intPartWithSeparator = intPart.replace(/\B(?=(\d{3})+(?!\d))/g, thousandsSeparator);
190
+ return decPart ? `${intPartWithSeparator}.${decPart}` : intPartWithSeparator;
191
+ }
192
+ function formatCellNumber(value, gridFormattingOptions) {
193
+ const separator = gridFormattingOptions === null || gridFormattingOptions === void 0 ? void 0 : gridFormattingOptions.thousandsSeparator;
194
+ if ((0, isNumber_1.default)(value)) {
195
+ if (separator === 'none' || (value < 1000 && value > -1000))
196
+ return value.toString();
197
+ if (separator === 'system')
198
+ return value.toLocaleString();
199
+ }
200
+ // fallback for system locale
201
+ if (separator === 'space' || separator === 'system')
202
+ return formatNumberCustomSeparator(value.toString(), ' ');
203
+ if (separator === 'narrowspace')
204
+ return formatNumberCustomSeparator(value.toString(), '\u202F');
205
+ if (separator === 'comma')
206
+ return formatNumberCustomSeparator(value.toString(), ',');
207
+ if (separator === 'dot')
208
+ return formatNumberCustomSeparator(value.toString(), '.');
209
+ return value.toString();
210
+ }
185
211
  function stringifyCellValue(value, intent, editorTypes, gridFormattingOptions, jsonParsedValue) {
186
212
  var _a, _b;
187
213
  if (editorTypes === null || editorTypes === void 0 ? void 0 : editorTypes.parseSqlNull) {
@@ -217,6 +243,12 @@ function stringifyCellValue(value, intent, editorTypes, gridFormattingOptions, j
217
243
  gridStyle: 'valueCellStyle',
218
244
  };
219
245
  }
246
+ if (value === null || value === void 0 ? void 0 : value.$decimal) {
247
+ return {
248
+ value: formatCellNumber(value.$decimal, gridFormattingOptions),
249
+ gridStyle: 'valueCellStyle',
250
+ };
251
+ }
220
252
  if (editorTypes === null || editorTypes === void 0 ? void 0 : editorTypes.parseHexAsBuffer) {
221
253
  // if (value?.type == 'Buffer' && _isArray(value.data)) {
222
254
  // return { value: '0x' + arrayToHexString(value.data), gridStyle: 'valueCellStyle' };
@@ -235,13 +267,13 @@ function stringifyCellValue(value, intent, editorTypes, gridFormattingOptions, j
235
267
  }
236
268
  if (value === null || value === void 0 ? void 0 : value.$bigint) {
237
269
  return {
238
- value: value.$bigint,
270
+ value: formatCellNumber(value.$bigint, gridFormattingOptions),
239
271
  gridStyle: 'valueCellStyle',
240
272
  };
241
273
  }
242
274
  if (typeof value === 'bigint') {
243
275
  return {
244
- value: value.toString(),
276
+ value: formatCellNumber(value.toString(), gridFormattingOptions),
245
277
  gridStyle: 'valueCellStyle',
246
278
  };
247
279
  }
@@ -310,12 +342,8 @@ function stringifyCellValue(value, intent, editorTypes, gridFormattingOptions, j
310
342
  if ((0, isNumber_1.default)(value)) {
311
343
  switch (intent) {
312
344
  case 'gridCellIntent':
313
- return {
314
- value: (gridFormattingOptions === null || gridFormattingOptions === void 0 ? void 0 : gridFormattingOptions.useThousandsSeparator) && (value >= 10000 || value <= -10000)
315
- ? value.toLocaleString()
316
- : value.toString(),
317
- gridStyle: 'valueCellStyle',
318
- };
345
+ const separator = gridFormattingOptions === null || gridFormattingOptions === void 0 ? void 0 : gridFormattingOptions.thousandsSeparator;
346
+ return { value: formatCellNumber(value, gridFormattingOptions), gridStyle: 'valueCellStyle' };
319
347
  default:
320
348
  return { value: value.toString() };
321
349
  }
@@ -406,6 +434,9 @@ function shouldOpenMultilineDialog(value) {
406
434
  if (value === null || value === void 0 ? void 0 : value.$bigint) {
407
435
  return false;
408
436
  }
437
+ if (value === null || value === void 0 ? void 0 : value.$decimal) {
438
+ return false;
439
+ }
409
440
  if ((0, isPlainObject_1.default)(value) || (0, isArray_1.default)(value)) {
410
441
  return true;
411
442
  }
@@ -669,6 +700,9 @@ function deserializeJsTypesFromJsonParse(obj) {
669
700
  if (value === null || value === void 0 ? void 0 : value.$bigint) {
670
701
  return BigInt(value.$bigint);
671
702
  }
703
+ if (value === null || value === void 0 ? void 0 : value.$decimal) {
704
+ return value.$decimal;
705
+ }
672
706
  });
673
707
  }
674
708
  exports.deserializeJsTypesFromJsonParse = deserializeJsTypesFromJsonParse;
@@ -683,6 +717,9 @@ function deserializeJsTypesReviver(key, value) {
683
717
  if (value === null || value === void 0 ? void 0 : value.$bigint) {
684
718
  return BigInt(value.$bigint);
685
719
  }
720
+ if (value === null || value === void 0 ? void 0 : value.$decimal) {
721
+ return value.$decimal;
722
+ }
686
723
  return value;
687
724
  }
688
725
  exports.deserializeJsTypesReviver = deserializeJsTypesReviver;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "6.7.2",
2
+ "version": "6.8.0",
3
3
  "name": "dbgate-tools",
4
4
  "main": "lib/index.js",
5
5
  "typings": "lib/index.d.ts",
@@ -26,7 +26,7 @@
26
26
  ],
27
27
  "devDependencies": {
28
28
  "@types/node": "^13.7.0",
29
- "dbgate-types": "^6.7.2",
29
+ "dbgate-types": "^6.8.0",
30
30
  "jest": "^28.1.3",
31
31
  "ts-jest": "^28.0.7",
32
32
  "typescript": "^4.4.3"
@@ -34,7 +34,7 @@
34
34
  "dependencies": {
35
35
  "blueimp-md5": "^2.19.0",
36
36
  "dbgate-query-splitter": "^4.11.9",
37
- "dbgate-sqltree": "^6.7.2",
37
+ "dbgate-sqltree": "^6.8.0",
38
38
  "debug": "^4.3.4",
39
39
  "json-stable-stringify": "^1.0.1",
40
40
  "lodash": "^4.17.21",