dbgate-tools 5.0.2 → 5.0.4-alpha.7
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/DatabaseAnalyser.d.ts +3 -0
- package/lib/DatabaseAnalyser.js +11 -0
- package/lib/stringTools.d.ts +1 -0
- package/lib/stringTools.js +8 -1
- package/lib/yamlModelConv.d.ts +1 -0
- package/lib/yamlModelConv.js +2 -0
- package/package.json +3 -3
|
@@ -17,9 +17,12 @@ export declare class DatabaseAnalyser {
|
|
|
17
17
|
incrementalAnalysis(structure: any): Promise<DatabaseInfo>;
|
|
18
18
|
mergeAnalyseResult(newlyAnalysed: any): any;
|
|
19
19
|
getRequestedObjectPureNames(objectTypeField: any, allPureNames: any): any;
|
|
20
|
+
containsObjectIdCondition(typeFields: any): boolean;
|
|
20
21
|
createQuery(template: any, typeFields: any): any;
|
|
22
|
+
createQueryCore(template: any, typeFields: any): any;
|
|
21
23
|
getDeletedObjectsForField(snapshot: any, objectTypeField: any): any;
|
|
22
24
|
getDeletedObjects(snapshot: any): any[];
|
|
25
|
+
feedback(obj: any): void;
|
|
23
26
|
getModifications(): Promise<any[]>;
|
|
24
27
|
safeQuery(sql: any): Promise<import("dbgate-types").QueryResult>;
|
|
25
28
|
static createEmptyStructure(): DatabaseInfo;
|
package/lib/DatabaseAnalyser.js
CHANGED
|
@@ -165,7 +165,13 @@ class DatabaseAnalyser {
|
|
|
165
165
|
// findObjectById(id) {
|
|
166
166
|
// return this.structure.tables.find((x) => x.objectId == id);
|
|
167
167
|
// }
|
|
168
|
+
containsObjectIdCondition(typeFields) {
|
|
169
|
+
return this.createQueryCore('=OBJECT_ID_CONDITION', typeFields) != ' is not null';
|
|
170
|
+
}
|
|
168
171
|
createQuery(template, typeFields) {
|
|
172
|
+
return this.createQueryCore(template, typeFields);
|
|
173
|
+
}
|
|
174
|
+
createQueryCore(template, typeFields) {
|
|
169
175
|
// let res = template;
|
|
170
176
|
if (this.singleObjectFilter) {
|
|
171
177
|
const { typeField } = this.singleObjectFilter;
|
|
@@ -216,6 +222,11 @@ class DatabaseAnalyser {
|
|
|
216
222
|
...this.getDeletedObjectsForField(snapshot, 'triggers'),
|
|
217
223
|
];
|
|
218
224
|
}
|
|
225
|
+
feedback(obj) {
|
|
226
|
+
if (this.pool.feedback) {
|
|
227
|
+
this.pool.feedback(obj);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
219
230
|
getModifications() {
|
|
220
231
|
return __awaiter(this, void 0, void 0, function* () {
|
|
221
232
|
const snapshot = yield this._getFastSnapshot();
|
package/lib/stringTools.d.ts
CHANGED
|
@@ -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;
|
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.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;
|
package/lib/yamlModelConv.d.ts
CHANGED
package/lib/yamlModelConv.js
CHANGED
|
@@ -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.
|
|
2
|
+
"version": "5.0.4-alpha.7",
|
|
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.
|
|
28
|
+
"dbgate-types": "^5.0.4-alpha.7",
|
|
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.
|
|
36
|
+
"dbgate-sqltree": "^5.0.4-alpha.7",
|
|
37
37
|
"uuid": "^3.4.0"
|
|
38
38
|
}
|
|
39
39
|
}
|