dbgate-tools 4.8.4 → 4.8.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.
@@ -11,6 +11,8 @@ export declare class ScriptWriter {
11
11
  assignValue(variableName: any, jsonValue: any): void;
12
12
  requirePackage(packageName: any): void;
13
13
  copyStream(sourceVar: any, targetVar: any, colmapVar?: any): void;
14
+ dumpDatabase(options: any): void;
15
+ importDatabase(options: any): void;
14
16
  comment(s: any): void;
15
17
  getScript(schedule?: any): string;
16
18
  }
@@ -26,6 +28,8 @@ export declare class ScriptWriterJson {
26
28
  assignValue(variableName: any, jsonValue: any): void;
27
29
  copyStream(sourceVar: any, targetVar: any, colmapVar?: any): void;
28
30
  comment(text: any): void;
31
+ dumpDatabase(options: any): void;
32
+ importDatabase(options: any): void;
29
33
  getScript(schedule?: any): {
30
34
  type: string;
31
35
  schedule: any;
@@ -45,6 +45,12 @@ class ScriptWriter {
45
45
  this._put(`await dbgateApi.copyStream(${sourceVar}, ${targetVar});`);
46
46
  }
47
47
  }
48
+ dumpDatabase(options) {
49
+ this._put(`await dbgateApi.dumpDatabase(${JSON.stringify(options)});`);
50
+ }
51
+ importDatabase(options) {
52
+ this._put(`await dbgateApi.importDatabase(${JSON.stringify(options)});`);
53
+ }
48
54
  comment(s) {
49
55
  this._put(`// ${s}`);
50
56
  }
@@ -108,6 +114,18 @@ class ScriptWriterJson {
108
114
  text,
109
115
  });
110
116
  }
117
+ dumpDatabase(options) {
118
+ this.commands.push({
119
+ type: 'dumpDatabase',
120
+ options,
121
+ });
122
+ }
123
+ importDatabase(options) {
124
+ this.commands.push({
125
+ type: 'importDatabase',
126
+ options,
127
+ });
128
+ }
111
129
  getScript(schedule = null) {
112
130
  return {
113
131
  type: 'json',
@@ -144,6 +162,12 @@ function jsonScriptToJavascript(json) {
144
162
  case 'comment':
145
163
  script.comment(cmd.text);
146
164
  break;
165
+ case 'dumpDatabase':
166
+ script.dumpDatabase(cmd.options);
167
+ break;
168
+ case 'importDatabase':
169
+ script.importDatabase(cmd.options);
170
+ break;
147
171
  }
148
172
  }
149
173
  return script.getScript(schedule);
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.8.4",
2
+ "version": "4.8.7",
3
3
  "name": "dbgate-tools",
4
4
  "main": "lib/index.js",
5
5
  "typings": "lib/index.d.ts",
@@ -25,15 +25,15 @@
25
25
  ],
26
26
  "devDependencies": {
27
27
  "@types/node": "^13.7.0",
28
- "dbgate-types": "^4.8.4",
28
+ "dbgate-types": "^4.8.7",
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.8.3",
36
- "dbgate-sqltree": "^4.8.4",
35
+ "dbgate-query-splitter": "^4.9.0",
36
+ "dbgate-sqltree": "^4.8.7",
37
37
  "uuid": "^3.4.0"
38
38
  }
39
39
  }