dbgate-api 4.7.4 → 4.8.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.
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dbgate-api",
|
|
3
3
|
"main": "src/index.js",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.8.2",
|
|
5
5
|
"homepage": "https://dbgate.org/",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"compare-versions": "^3.6.0",
|
|
26
26
|
"cors": "^2.8.5",
|
|
27
27
|
"cross-env": "^6.0.3",
|
|
28
|
-
"dbgate-query-splitter": "^4.
|
|
29
|
-
"dbgate-sqltree": "^4.
|
|
30
|
-
"dbgate-tools": "^4.
|
|
28
|
+
"dbgate-query-splitter": "^4.8.2",
|
|
29
|
+
"dbgate-sqltree": "^4.8.2",
|
|
30
|
+
"dbgate-tools": "^4.8.2",
|
|
31
31
|
"diff": "^5.0.0",
|
|
32
32
|
"diff2html": "^3.4.13",
|
|
33
33
|
"eslint": "^6.8.0",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@types/fs-extra": "^9.0.11",
|
|
65
65
|
"@types/lodash": "^4.14.149",
|
|
66
|
-
"dbgate-types": "^4.
|
|
66
|
+
"dbgate-types": "^4.8.2",
|
|
67
67
|
"env-cmd": "^10.1.0",
|
|
68
68
|
"node-loader": "^1.0.2",
|
|
69
69
|
"nodemon": "^2.0.2",
|
|
@@ -176,8 +176,13 @@ module.exports = {
|
|
|
176
176
|
},
|
|
177
177
|
|
|
178
178
|
loadKeys_meta: true,
|
|
179
|
-
async loadKeys({ conid, database, root }) {
|
|
180
|
-
return this.loadDataCore('loadKeys', { conid, database, root });
|
|
179
|
+
async loadKeys({ conid, database, root, filter }) {
|
|
180
|
+
return this.loadDataCore('loadKeys', { conid, database, root, filter });
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
exportKeys_meta: true,
|
|
184
|
+
async exportKeys({ conid, database, options }) {
|
|
185
|
+
return this.loadDataCore('exportKeys', { conid, database, options });
|
|
181
186
|
},
|
|
182
187
|
|
|
183
188
|
loadKeyInfo_meta: true,
|
|
@@ -142,6 +142,7 @@ module.exports = {
|
|
|
142
142
|
createDatabase_meta: true,
|
|
143
143
|
async createDatabase({ conid, name }) {
|
|
144
144
|
const opened = await this.ensureOpened(conid);
|
|
145
|
+
if (opened.connection.isReadOnly) return false;
|
|
145
146
|
opened.subprocess.send({ msgtype: 'createDatabase', name });
|
|
146
147
|
return { status: 'ok' };
|
|
147
148
|
},
|
package/src/currentVersion.js
CHANGED
|
@@ -197,8 +197,12 @@ async function handleCollectionData({ msgid, options }) {
|
|
|
197
197
|
return handleDriverDataCore(msgid, driver => driver.readCollection(systemConnection, options));
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
async function handleLoadKeys({ msgid, root }) {
|
|
201
|
-
return handleDriverDataCore(msgid, driver => driver.loadKeys(systemConnection, root));
|
|
200
|
+
async function handleLoadKeys({ msgid, root, filter }) {
|
|
201
|
+
return handleDriverDataCore(msgid, driver => driver.loadKeys(systemConnection, root, filter));
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
async function handleExportKeys({ msgid, options }) {
|
|
205
|
+
return handleDriverDataCore(msgid, driver => driver.exportKeys(systemConnection, options));
|
|
202
206
|
}
|
|
203
207
|
|
|
204
208
|
async function handleLoadKeyInfo({ msgid, key }) {
|
|
@@ -207,6 +211,10 @@ async function handleLoadKeyInfo({ msgid, key }) {
|
|
|
207
211
|
|
|
208
212
|
async function handleCallMethod({ msgid, method, args }) {
|
|
209
213
|
return handleDriverDataCore(msgid, driver => {
|
|
214
|
+
if (storedConnection.isReadOnly) {
|
|
215
|
+
throw new Error('Connection is read only, cannot call custom methods');
|
|
216
|
+
}
|
|
217
|
+
|
|
210
218
|
ensureExecuteCustomScript(driver);
|
|
211
219
|
return driver.callMethod(systemConnection, method, args);
|
|
212
220
|
});
|
|
@@ -307,6 +315,7 @@ const messageHandlers = {
|
|
|
307
315
|
generateDeploySql: handleGenerateDeploySql,
|
|
308
316
|
loadFieldValues: handleLoadFieldValues,
|
|
309
317
|
sqlSelect: handleSqlSelect,
|
|
318
|
+
exportKeys: handleExportKeys,
|
|
310
319
|
// runCommand: handleRunCommand,
|
|
311
320
|
};
|
|
312
321
|
|
|
@@ -6,6 +6,10 @@ function getJslFileName(jslid) {
|
|
|
6
6
|
if (archiveMatch) {
|
|
7
7
|
return path.join(resolveArchiveFolder(archiveMatch[1]), `${archiveMatch[2]}.jsonl`);
|
|
8
8
|
}
|
|
9
|
+
const fileMatch = jslid.match(/^file:\/\/(.*)$/);
|
|
10
|
+
if (fileMatch) {
|
|
11
|
+
return fileMatch[1];
|
|
12
|
+
}
|
|
9
13
|
return path.join(jsldir(), `${jslid}.jsonl`);
|
|
10
14
|
}
|
|
11
15
|
|