dbgate-tools 5.0.3 → 5.0.4-alpha.2

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.
@@ -5,3 +5,4 @@ export declare function stringifyCellValue(value: any): any;
5
5
  export declare function safeJsonParse(json: any, defaultValue?: any, logError?: boolean): any;
6
6
  export declare function isJsonLikeLongString(value: any): RegExpMatchArray;
7
7
  export declare function getIconForRedisType(type: any): "img folder" | "img type-string" | "img type-hash" | "img type-set" | "img type-list" | "img type-zset" | "img type-stream" | "img type-binary" | "img type-rejson";
8
+ export declare function isWktGeometry(s: any): boolean;
@@ -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.getIconForRedisType = exports.isJsonLikeLongString = exports.safeJsonParse = exports.stringifyCellValue = exports.parseCellValue = exports.hexStringToArray = exports.arrayToHexString = void 0;
6
+ exports.isWktGeometry = exports.getIconForRedisType = exports.isJsonLikeLongString = 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 isPlainObject_1 = __importDefault(require("lodash/isPlainObject"));
@@ -94,3 +94,10 @@ function getIconForRedisType(type) {
94
94
  }
95
95
  }
96
96
  exports.getIconForRedisType = getIconForRedisType;
97
+ function isWktGeometry(s) {
98
+ if (!(0, isString_1.default)(s))
99
+ return false;
100
+ // return !!s.match(/^POINT\s*\(|/)
101
+ return !!s.match(/^POINT\s*\(|^LINESTRING\s*\(|^POLYGON\s*\(|^MULTIPOINT\s*\(|^MULTILINESTRING\s*\(|^MULTIPOLYGON\s*\(|^GEOMCOLLECTION\s*\(|^GEOMETRYCOLLECTION\s*\(/);
102
+ }
103
+ exports.isWktGeometry = isWktGeometry;
@@ -7,6 +7,7 @@ export interface ColumnInfoYaml {
7
7
  autoIncrement?: boolean;
8
8
  references?: string;
9
9
  primaryKey?: boolean;
10
+ default?: string;
10
11
  }
11
12
  export interface DatabaseModelFile {
12
13
  name: string;
@@ -12,6 +12,7 @@ function columnInfoToYaml(column, table) {
12
12
  const res = {
13
13
  name: column.columnName,
14
14
  type: column.dataType,
15
+ default: column.defaultValue,
15
16
  };
16
17
  if (column.autoIncrement)
17
18
  res.autoIncrement = true;
@@ -39,6 +40,7 @@ function columnInfoFromYaml(column, table) {
39
40
  dataType: column.length ? `${column.type}(${column.length})` : column.type,
40
41
  autoIncrement: column.autoIncrement,
41
42
  notNull: column.notNull || (table.primaryKey && table.primaryKey.includes(column.name)),
43
+ defaultValue: column.default,
42
44
  };
43
45
  return res;
44
46
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.0.3",
2
+ "version": "5.0.4-alpha.2",
3
3
  "name": "dbgate-tools",
4
4
  "main": "lib/index.js",
5
5
  "typings": "lib/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  ],
26
26
  "devDependencies": {
27
27
  "@types/node": "^13.7.0",
28
- "dbgate-types": "^5.0.3",
28
+ "dbgate-types": "^5.0.4-alpha.2",
29
29
  "jest": "^24.9.0",
30
30
  "ts-jest": "^25.2.1",
31
31
  "typescript": "^4.4.3"
@@ -33,7 +33,7 @@
33
33
  "dependencies": {
34
34
  "lodash": "^4.17.21",
35
35
  "dbgate-query-splitter": "^4.9.0",
36
- "dbgate-sqltree": "^5.0.3",
36
+ "dbgate-sqltree": "^5.0.4-alpha.2",
37
37
  "uuid": "^3.4.0"
38
38
  }
39
39
  }