dsh-db-tool 1.8.2 → 1.8.3
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/client/client.js +1 -1
- package/dist/http/index.js +2 -1
- package/dist/manager.js +5 -4
- package/dist/store/transfer-history.js +7 -3
- package/dist/transfer.js +0 -1
- package/package.json +3 -3
package/client/client.js
CHANGED
|
@@ -3201,7 +3201,7 @@ window.__ModuleLoader__.load({
|
|
|
3201
3201
|
target: { conn: "", kind: "", db: "", mode: "" },
|
|
3202
3202
|
});
|
|
3203
3203
|
if (!yes) return;
|
|
3204
|
-
api("transfer-history/clear", { method: "POST", body: {} })
|
|
3204
|
+
api("transfer-history/clear", { method: "POST", body: { projectPath } })
|
|
3205
3205
|
.then((r) => { setMessage(t("ok") + " (" + (r && r.removed != null ? r.removed : 0) + ")"); setHistory([]); })
|
|
3206
3206
|
.catch((e) => setError(String(e && e.message ? e.message : e)));
|
|
3207
3207
|
}
|
package/dist/http/index.js
CHANGED
|
@@ -296,7 +296,8 @@ async function route(req, res, service, path, q, opts) {
|
|
|
296
296
|
return sendOk(res, service.transferHistory(projectOf(q), limit));
|
|
297
297
|
}
|
|
298
298
|
if (path === '/api/transfer-history/clear' && req.method === 'POST') {
|
|
299
|
-
|
|
299
|
+
const b = await readBody(req);
|
|
300
|
+
return sendOk(res, service.transferHistoryClear(projectOfBody(b)));
|
|
300
301
|
}
|
|
301
302
|
const transferMatch = /^\/api\/transfer\/([^/]+)(\/cancel)?$/.exec(path);
|
|
302
303
|
if (transferMatch) {
|
package/dist/manager.js
CHANGED
|
@@ -881,10 +881,11 @@ export class DbToolService {
|
|
|
881
881
|
? this.store.transferLog.tail(n, normalizeProjectKey(projectPath))
|
|
882
882
|
: this.store.transferLog.tail(n);
|
|
883
883
|
}
|
|
884
|
-
/**
|
|
885
|
-
transferHistoryClear() {
|
|
886
|
-
const
|
|
887
|
-
this.
|
|
884
|
+
/** 清除传输历史:projectPath 给定时只清该项目(前端文案语义),缺省全清。留审计。 */
|
|
885
|
+
transferHistoryClear(projectPath) {
|
|
886
|
+
const key = projectPath && projectPath.trim() !== '' ? normalizeProjectKey(projectPath) : undefined;
|
|
887
|
+
const removed = this.store.transferLog.clear(key);
|
|
888
|
+
this.audit(key ?? '', '', 'transfer_history_clear', key !== undefined ? `清除项目传输历史: ${key}` : '清除全部传输历史', 'none', false, true);
|
|
888
889
|
return { removed };
|
|
889
890
|
}
|
|
890
891
|
/** 清理终态任务(start 时调用;快照仅在 running 期间可查) */
|
|
@@ -89,8 +89,8 @@ export class TransferLog {
|
|
|
89
89
|
}
|
|
90
90
|
return out.reverse();
|
|
91
91
|
}
|
|
92
|
-
/**
|
|
93
|
-
clear() {
|
|
92
|
+
/** 清除日志;projectKey 给定时只删该项目条目,缺省全清。返回删除条数 */
|
|
93
|
+
clear(projectKey) {
|
|
94
94
|
if (!fs.existsSync(this.filePath))
|
|
95
95
|
return 0;
|
|
96
96
|
const lines = fs.readFileSync(this.filePath, 'utf8').split('\n');
|
|
@@ -101,7 +101,11 @@ export class TransferLog {
|
|
|
101
101
|
if (!t)
|
|
102
102
|
continue;
|
|
103
103
|
try {
|
|
104
|
-
JSON.parse(t);
|
|
104
|
+
const e = JSON.parse(t);
|
|
105
|
+
if (projectKey !== undefined && e.projectPathKey !== projectKey) {
|
|
106
|
+
kept.push(t); // 他项目条目原样保留
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
105
109
|
removed += 1;
|
|
106
110
|
}
|
|
107
111
|
catch {
|
package/dist/transfer.js
CHANGED
|
@@ -136,7 +136,6 @@ export function startTransferTask(source, target, opts) {
|
|
|
136
136
|
try {
|
|
137
137
|
prog.status = 'running';
|
|
138
138
|
emit({ type: 'table', status: 'running', table: name, rows: 0, totalRows: null });
|
|
139
|
-
emit({ type: 'table', status: 'running', table: name, rows: 0, totalRows: null });
|
|
140
139
|
const r = await createTransferReader(source, srcLoc);
|
|
141
140
|
reader = r; // 立即回填外层引用:writer 创建抛错时 finally 仍能关闭已打开的 reader
|
|
142
141
|
const w = await createTransferWriter(target, opts.writeMode, dstLoc);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-db-tool",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.3",
|
|
4
4
|
"description": "DSH community plugin: chat-operated multi-database admin tool with sidebar management, project-scoped grants, ro/rw modes and dangerous-operation confirmation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -64,13 +64,13 @@
|
|
|
64
64
|
"@codemirror/language": "^6.12.4",
|
|
65
65
|
"@codemirror/state": "^6.7.6",
|
|
66
66
|
"@codemirror/view": "^6.43.13",
|
|
67
|
-
"@deepseek-ai/cordis": "^4.0.
|
|
67
|
+
"@deepseek-ai/cordis": "^4.0.5",
|
|
68
68
|
"@lezer/highlight": "^1.2.4",
|
|
69
69
|
"@stryker-mutator/core": "^10.0.0",
|
|
70
70
|
"@stryker-mutator/vitest-runner": "^10.0.0",
|
|
71
71
|
"@types/better-sqlite3": "latest",
|
|
72
72
|
"@types/node": "latest",
|
|
73
|
-
"dsh-better-sidebar": "^0.
|
|
73
|
+
"dsh-better-sidebar": "^0.28.0",
|
|
74
74
|
"esbuild": "^0.28.0",
|
|
75
75
|
"mongodb": "^7.6.0",
|
|
76
76
|
"mssql": "12.7.4",
|