dbgate-tools 4.7.2 → 4.7.3-alpha.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.
package/lib/tableTransforms.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
/// <reference types="lodash" />
|
|
1
2
|
import { TableInfo } from 'dbgate-types';
|
|
2
3
|
export declare function prepareTableForImport(table: TableInfo): TableInfo;
|
|
4
|
+
interface TransformColumnDefinition {
|
|
5
|
+
src: string;
|
|
6
|
+
dst: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function transformRowUsingColumnMap(row: any, columns: TransformColumnDefinition[]): import("lodash").Dictionary<any>;
|
|
9
|
+
export {};
|
package/lib/tableTransforms.js
CHANGED
|
@@ -3,8 +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.prepareTableForImport = void 0;
|
|
6
|
+
exports.transformRowUsingColumnMap = exports.prepareTableForImport = void 0;
|
|
7
7
|
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
8
|
+
const fromPairs_1 = __importDefault(require("lodash/fromPairs"));
|
|
9
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
8
10
|
function prepareTableForImport(table) {
|
|
9
11
|
const res = (0, cloneDeep_1.default)(table);
|
|
10
12
|
res.foreignKeys = [];
|
|
@@ -16,3 +18,7 @@ function prepareTableForImport(table) {
|
|
|
16
18
|
return res;
|
|
17
19
|
}
|
|
18
20
|
exports.prepareTableForImport = prepareTableForImport;
|
|
21
|
+
function transformRowUsingColumnMap(row, columns) {
|
|
22
|
+
return (0, fromPairs_1.default)(columns.map(col => [col.dst, (0, get_1.default)(row, col.src)]));
|
|
23
|
+
}
|
|
24
|
+
exports.transformRowUsingColumnMap = transformRowUsingColumnMap;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "4.7.
|
|
2
|
+
"version": "4.7.3-alpha.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": "^4.7.
|
|
28
|
+
"dbgate-types": "^4.7.3-alpha.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
34
|
"lodash": "^4.17.21",
|
|
35
|
-
"dbgate-query-splitter": "^4.7.
|
|
35
|
+
"dbgate-query-splitter": "^4.7.3-alpha.5",
|
|
36
36
|
"uuid": "^3.4.0"
|
|
37
37
|
}
|
|
38
38
|
}
|