fdb2 1.0.39 → 1.0.41
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/README.md +6 -5
- package/dist/public/.vite/manifest.json +109 -1
- package/dist/public/database-monitor.css +445 -0
- package/dist/public/database-monitor.js +605 -0
- package/dist/public/database.css +740 -0
- package/dist/public/database.js +555 -0
- package/dist/public/database2.js +344 -0
- package/dist/public/echarts.js +79307 -0
- package/dist/public/explorer.css +1109 -436
- package/dist/public/explorer.js +4049 -34891
- package/dist/public/export.js +54831 -0
- package/dist/public/helpers.js +27 -0
- package/dist/public/index.js +545 -51
- package/dist/public/layout.css +98 -65
- package/dist/public/layout.js +59 -22
- package/dist/public/query-history.css +651 -0
- package/dist/public/query-history.js +526 -0
- package/dist/public/sql-query-editor.css +503 -0
- package/dist/public/sql-query-editor.js +638 -0
- package/dist/public/theme.js +82 -0
- package/dist/scripts/verify-db-support.cjs +239 -0
- package/dist/server/__tests__/import-normalize.test.ts +79 -0
- package/dist/server/__tests__/remote-proxy.test.ts +62 -0
- package/dist/server/core/dialect.d.ts +9 -0
- package/dist/server/core/dialect.d.ts.map +1 -1
- package/dist/server/core/dialect.js +24 -9
- package/dist/server/core/dialect.js.map +1 -1
- package/dist/server/core/dialect.ts +29 -9
- package/dist/server/core/schema/__tests__/ddl-emitter.test.ts +159 -3
- package/dist/server/core/schema/canonical.d.ts.map +1 -1
- package/dist/server/core/schema/canonical.js +4 -1
- package/dist/server/core/schema/canonical.js.map +1 -1
- package/dist/server/core/schema/canonical.ts +4 -1
- package/dist/server/core/schema/ddl-emitter.d.ts +3 -0
- package/dist/server/core/schema/ddl-emitter.d.ts.map +1 -1
- package/dist/server/core/schema/ddl-emitter.js +158 -24
- package/dist/server/core/schema/ddl-emitter.js.map +1 -1
- package/dist/server/core/schema/ddl-emitter.ts +171 -22
- package/dist/server/index.d.ts +20 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +375 -25
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.ts +392 -27
- package/dist/server/model/ddl-spec.d.ts +9 -0
- package/dist/server/model/ddl-spec.d.ts.map +1 -1
- package/dist/server/model/ddl-spec.ts +9 -0
- package/dist/server/service/connection.service.d.ts +8 -0
- package/dist/server/service/connection.service.d.ts.map +1 -1
- package/dist/server/service/connection.service.js +75 -17
- package/dist/server/service/connection.service.js.map +1 -1
- package/dist/server/service/connection.service.ts +74 -17
- package/dist/server/service/database/base.service.d.ts +45 -0
- package/dist/server/service/database/base.service.d.ts.map +1 -1
- package/dist/server/service/database/base.service.js +120 -7
- package/dist/server/service/database/base.service.js.map +1 -1
- package/dist/server/service/database/base.service.ts +143 -8
- package/dist/server/service/database/cockroachdb.service.d.ts +9 -0
- package/dist/server/service/database/cockroachdb.service.d.ts.map +1 -1
- package/dist/server/service/database/cockroachdb.service.js +68 -57
- package/dist/server/service/database/cockroachdb.service.js.map +1 -1
- package/dist/server/service/database/cockroachdb.service.ts +67 -58
- package/dist/server/service/database/database.service.d.ts +25 -227
- package/dist/server/service/database/database.service.d.ts.map +1 -1
- package/dist/server/service/database/database.service.js +323 -78
- package/dist/server/service/database/database.service.js.map +1 -1
- package/dist/server/service/database/database.service.ts +334 -87
- package/dist/server/service/database/mongodb.service.d.ts +58 -3
- package/dist/server/service/database/mongodb.service.d.ts.map +1 -1
- package/dist/server/service/database/mongodb.service.js +264 -54
- package/dist/server/service/database/mongodb.service.js.map +1 -1
- package/dist/server/service/database/mongodb.service.ts +288 -60
- package/dist/server/service/database/mssql.service.d.ts +8 -0
- package/dist/server/service/database/mssql.service.d.ts.map +1 -1
- package/dist/server/service/database/mssql.service.js +45 -40
- package/dist/server/service/database/mssql.service.js.map +1 -1
- package/dist/server/service/database/mssql.service.ts +49 -44
- package/dist/server/service/database/oracle.service.d.ts +29 -1
- package/dist/server/service/database/oracle.service.d.ts.map +1 -1
- package/dist/server/service/database/oracle.service.js +166 -137
- package/dist/server/service/database/oracle.service.js.map +1 -1
- package/dist/server/service/database/oracle.service.ts +166 -146
- package/dist/server/service/database/sap.service.d.ts +8 -0
- package/dist/server/service/database/sap.service.d.ts.map +1 -1
- package/dist/server/service/database/sap.service.js +28 -0
- package/dist/server/service/database/sap.service.js.map +1 -1
- package/dist/server/service/database/sap.service.ts +29 -0
- package/dist/server/service/database/sqlite.service.d.ts.map +1 -1
- package/dist/server/service/database/sqlite.service.js +6 -3
- package/dist/server/service/database/sqlite.service.js.map +1 -1
- package/dist/server/service/database/sqlite.service.ts +6 -3
- package/package.json +8 -8
- package/public/fdb2.png +0 -0
- package/scripts/verify-db-support.cjs +239 -0
package/dist/server/index.ts
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import * as http from "node:http";
|
|
2
2
|
import * as https from "node:https";
|
|
3
|
+
import * as fs from "node:fs";
|
|
3
4
|
import { ConnectionService } from './service/connection.service';
|
|
4
5
|
import { DatabaseService } from './service/database/database.service';
|
|
6
|
+
import { dataModelOf } from './core/dialect';
|
|
7
|
+
import { getDataPath, ensureDataDir } from './utils/data-dir';
|
|
5
8
|
|
|
6
9
|
// 远程代理相关常量
|
|
7
10
|
const REMOTE_ID_SEP = '::';
|
|
8
11
|
const REMOTE_TOKEN_HEADER = 'x-db-tool-token';
|
|
9
|
-
//
|
|
12
|
+
// 代理请求标记:旧版单行兼容——收到该标记的 getConnections 只返回本服务本地连接。
|
|
13
|
+
// 新版多级链路改用 x-db-tool-proxy-chain 记录经过的 URL,既能递归合并又能防环。
|
|
10
14
|
const REMOTE_PROXY_HEADER = 'x-db-tool-proxy';
|
|
15
|
+
const REMOTE_CHAIN_HEADER = 'x-db-tool-proxy-chain';
|
|
16
|
+
const MAX_PROXY_HOPS = 5;
|
|
11
17
|
|
|
12
18
|
// 永不转发的路由:只作用于本地连接配置(无远程对应物或需要本地语义)
|
|
13
19
|
const LOCAL_ONLY_ROUTES = new Set<string>([
|
|
@@ -31,12 +37,33 @@ function isRemoteConnection(conn: any): boolean {
|
|
|
31
37
|
return !!conn && conn.type === 'remote';
|
|
32
38
|
}
|
|
33
39
|
|
|
40
|
+
/** 深拷贝连接 options,并移除不应下发的远程访问令牌(混合版本兼容) */
|
|
41
|
+
function cloneOptionsWithoutRemoteToken(options: any): any {
|
|
42
|
+
if (!options || typeof options !== 'object') return options;
|
|
43
|
+
let cloned: any;
|
|
44
|
+
try {
|
|
45
|
+
cloned = JSON.parse(JSON.stringify(options));
|
|
46
|
+
} catch {
|
|
47
|
+
cloned = Array.isArray(options) ? [...options] : { ...options };
|
|
48
|
+
}
|
|
49
|
+
if (cloned && typeof cloned === 'object' && !Array.isArray(cloned)) {
|
|
50
|
+
delete cloned.remoteToken;
|
|
51
|
+
}
|
|
52
|
+
return cloned;
|
|
53
|
+
}
|
|
54
|
+
|
|
34
55
|
/** 从请求中取出被操作连接的 id(body 或路径段) */
|
|
35
|
-
function extractConnId(pathname: string, body: any): string | undefined {
|
|
56
|
+
export function extractConnId(pathname: string, body: any): string | undefined {
|
|
36
57
|
if (pathname.startsWith('/api/database/truncateTable/') || pathname.startsWith('/api/database/dropTable/')) {
|
|
37
58
|
const parts = pathname.split('/').filter(Boolean);
|
|
38
59
|
return parts[3];
|
|
39
60
|
}
|
|
61
|
+
// health 路径允许 body 为空:复合 id 必须在路径段中可读;有 body.id 时仍保持旧优先级。
|
|
62
|
+
if (pathname.startsWith('/api/database/health/') && body && typeof body.id === 'string') return body.id;
|
|
63
|
+
if (pathname.startsWith('/api/database/health/')) {
|
|
64
|
+
const parts = pathname.split('/').filter(Boolean);
|
|
65
|
+
return parts[3];
|
|
66
|
+
}
|
|
40
67
|
if (body && typeof body.id === 'string') return body.id;
|
|
41
68
|
return undefined;
|
|
42
69
|
}
|
|
@@ -45,7 +72,7 @@ function extractConnId(pathname: string, body: any): string | undefined {
|
|
|
45
72
|
* 拆分复合 id:proxyId::remoteConnId。
|
|
46
73
|
* remoteConnId 自身可能仍是复合 id(多级代理),必须保留剩余部分,不能用 split 截断。
|
|
47
74
|
*/
|
|
48
|
-
function splitProxyId(connId: string): { proxyId: string; remoteConnId: string } | null {
|
|
75
|
+
export function splitProxyId(connId: string): { proxyId: string; remoteConnId: string } | null {
|
|
49
76
|
const idx = connId.indexOf(REMOTE_ID_SEP);
|
|
50
77
|
if (idx <= 0) return null;
|
|
51
78
|
return {
|
|
@@ -169,18 +196,51 @@ async function postRemote(
|
|
|
169
196
|
return await postRemoteByNodeHttp(url, body, headers, timeoutMs);
|
|
170
197
|
}
|
|
171
198
|
|
|
172
|
-
/**
|
|
173
|
-
function buildRemoteHeaders(
|
|
174
|
-
|
|
199
|
+
/** 构造带令牌与链路信息的请求头。proxyMarker=false 时允许对端递归合并自己的代理。 */
|
|
200
|
+
export function buildRemoteHeaders(
|
|
201
|
+
proxyConn: any,
|
|
202
|
+
opts: { proxyMarker?: boolean; chain?: string[] } = {}
|
|
203
|
+
): Record<string, string> {
|
|
204
|
+
const headers: Record<string, string> = {};
|
|
205
|
+
if (opts.proxyMarker !== false) headers[REMOTE_PROXY_HEADER] = '1';
|
|
206
|
+
const chain = opts.chain || [];
|
|
207
|
+
if (chain.length > 0) headers[REMOTE_CHAIN_HEADER] = chain.join(',');
|
|
175
208
|
const token = proxyConn?.options?.remoteToken;
|
|
176
209
|
if (token) headers[REMOTE_TOKEN_HEADER] = String(token);
|
|
177
210
|
return headers;
|
|
178
211
|
}
|
|
179
212
|
|
|
213
|
+
/** 纯判断:base 是否已出现在链路中(用于阻止代理互指导致的递归) */
|
|
214
|
+
export function hasProxyLoop(base: string, chain: string[]): boolean {
|
|
215
|
+
return !!base && chain.includes(base);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/** 纯判断:链路深度是否已达到 5 跳上限(当前 URL 尚未加入 chain) */
|
|
219
|
+
export function isProxyHopLimitReached(chain: string[]): boolean {
|
|
220
|
+
return chain.length >= MAX_PROXY_HOPS;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function remoteBaseOf(proxyConn: any): string {
|
|
224
|
+
return String(proxyConn?.options?.remoteUrl || '').replace(/\/+$/, '');
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export function chainFromHeaders(headers?: any): string[] {
|
|
228
|
+
return String(headers?.[REMOTE_CHAIN_HEADER] || '').split(',').map((s) => s.trim()).filter(Boolean);
|
|
229
|
+
}
|
|
230
|
+
|
|
180
231
|
/** 把请求原样转发到远程 db_tool 服务端(自动解包远程响应,避免二次包装) */
|
|
181
|
-
async function proxyToRemote(
|
|
182
|
-
|
|
232
|
+
async function proxyToRemote(
|
|
233
|
+
proxyConn: any,
|
|
234
|
+
remoteConnId: string,
|
|
235
|
+
pathname: string,
|
|
236
|
+
body: any,
|
|
237
|
+
chain: string[] = []
|
|
238
|
+
): Promise<any> {
|
|
239
|
+
const base = remoteBaseOf(proxyConn);
|
|
183
240
|
if (!base) throw new Error('远程代理连接缺少 remoteUrl');
|
|
241
|
+
if (hasProxyLoop(base, chain)) throw new Error(`检测到代理环路:${base}`);
|
|
242
|
+
if (isProxyHopLimitReached(chain)) throw new Error(`代理链路超过 ${MAX_PROXY_HOPS} 跳,已中止以防环`);
|
|
243
|
+
const nextChain = [...chain, base];
|
|
184
244
|
let targetPath = pathname;
|
|
185
245
|
if (pathname.startsWith('/api/database/truncateTable/') || pathname.startsWith('/api/database/dropTable/')) {
|
|
186
246
|
const parts = pathname.split('/').filter(Boolean);
|
|
@@ -190,19 +250,37 @@ async function proxyToRemote(proxyConn: any, remoteConnId: string, pathname: str
|
|
|
190
250
|
targetPath = '/' + parts.join('/');
|
|
191
251
|
}
|
|
192
252
|
const targetBody = { ...body, id: remoteConnId };
|
|
193
|
-
const env = await postRemote(
|
|
253
|
+
const env = await postRemote(
|
|
254
|
+
`${base}${targetPath}`,
|
|
255
|
+
targetBody,
|
|
256
|
+
buildRemoteHeaders(proxyConn, { proxyMarker: false, chain: nextChain }),
|
|
257
|
+
60000
|
|
258
|
+
);
|
|
194
259
|
if (env && typeof env === 'object' && env.ret && env.ret !== 0) {
|
|
195
260
|
throw new Error(env.msg || '远程服务执行失败');
|
|
196
261
|
}
|
|
197
262
|
return env?.data;
|
|
198
263
|
}
|
|
199
264
|
|
|
200
|
-
/**
|
|
201
|
-
|
|
202
|
-
|
|
265
|
+
/**
|
|
266
|
+
* 拉取远程服务上的连接列表。不发送旧版 proxy 标记,因此远程端会递归合并它自己的代理;
|
|
267
|
+
* 通过 chain 记录已访问的 URL,detect 到环路或超过跳数上限时停止,避免无限递归。
|
|
268
|
+
*/
|
|
269
|
+
async function fetchRemoteConnections(
|
|
270
|
+
proxyConn: any,
|
|
271
|
+
chain: string[] = []
|
|
272
|
+
): Promise<{ list: any[]; error?: string }> {
|
|
273
|
+
const base = remoteBaseOf(proxyConn);
|
|
203
274
|
if (!base) return { list: [], error: '缺少 remoteUrl' };
|
|
275
|
+
if (hasProxyLoop(base, chain)) return { list: [], error: `检测到代理环路:${base}` };
|
|
276
|
+
if (isProxyHopLimitReached(chain)) return { list: [], error: `代理链路超过 ${MAX_PROXY_HOPS} 跳` };
|
|
204
277
|
try {
|
|
205
|
-
const env = await postRemote(
|
|
278
|
+
const env = await postRemote(
|
|
279
|
+
`${base}/api/database/getConnections`,
|
|
280
|
+
{},
|
|
281
|
+
buildRemoteHeaders(proxyConn, { proxyMarker: false, chain: [...chain, base] }),
|
|
282
|
+
10000
|
|
283
|
+
);
|
|
206
284
|
if (env && env.ret && env.ret !== 0) {
|
|
207
285
|
console.warn('[remote] 获取远程连接列表失败:', env.msg);
|
|
208
286
|
return { list: [], error: env.msg || '远程服务返回错误' };
|
|
@@ -214,12 +292,13 @@ async function fetchRemoteConnections(proxyConn: any): Promise<{ list: any[]; er
|
|
|
214
292
|
}
|
|
215
293
|
}
|
|
216
294
|
|
|
217
|
-
/** 网关模式:本地连接列表 = 本地连接 +
|
|
218
|
-
async function handleGetConnectionsWithProxy(): Promise<any[]> {
|
|
295
|
+
/** 网关模式:本地连接列表 = 本地连接 + 各级远程代理暴露的连接(支持 A→B→C 多级链路) */
|
|
296
|
+
async function handleGetConnectionsWithProxy(headers?: any): Promise<any[]> {
|
|
219
297
|
const locals = await connectionService.getAllConnections();
|
|
298
|
+
const chain = chainFromHeaders(headers);
|
|
220
299
|
// 并行拉取各远程服务,避免多个远程时串行等待
|
|
221
300
|
const remoteResults = await Promise.all(
|
|
222
|
-
locals.map(conn => (isRemoteConnection(conn) ? fetchRemoteConnections(conn) : Promise.resolve(null)))
|
|
301
|
+
locals.map(conn => (isRemoteConnection(conn) ? fetchRemoteConnections(conn, chain) : Promise.resolve(null)))
|
|
223
302
|
);
|
|
224
303
|
const result: any[] = [];
|
|
225
304
|
locals.forEach((conn, index) => {
|
|
@@ -231,15 +310,21 @@ async function handleGetConnectionsWithProxy(): Promise<any[]> {
|
|
|
231
310
|
// 代理配置本身保留(用于编辑/删除),标记 _isProxy
|
|
232
311
|
result.push({ ...conn, _isProxy: true, _remoteError: remote?.error });
|
|
233
312
|
for (const rc of remote?.list || []) {
|
|
234
|
-
|
|
313
|
+
// 代理配置本身(含 remoteUrl/token)不能作为可操作的数据库连接暴露;
|
|
314
|
+
// 旧版本可能只靠 type='remote' 标记,混合版本下两种标记都要过滤。
|
|
315
|
+
if (rc.type === 'remote' || rc._isProxy) continue;
|
|
235
316
|
const safe = { ...rc };
|
|
236
317
|
delete safe.password; // 不把远程库的密码下发到客户端
|
|
318
|
+
if (safe.options !== undefined) safe.options = cloneOptionsWithoutRemoteToken(safe.options);
|
|
319
|
+
// 保留远程端已拼好的代理链:A::B::C,而不是把中间跳数丢掉
|
|
320
|
+
const proxyChain = rc._proxyId ? `${conn.id}${REMOTE_ID_SEP}${rc._proxyId}` : conn.id;
|
|
237
321
|
result.push({
|
|
238
322
|
...safe,
|
|
239
323
|
id: `${conn.id}${REMOTE_ID_SEP}${rc.id}`,
|
|
240
|
-
_proxyId:
|
|
324
|
+
_proxyId: proxyChain,
|
|
241
325
|
_remote: true,
|
|
242
|
-
_remoteName: conn.name
|
|
326
|
+
_remoteName: rc._remoteName ? `${conn.name} → ${rc._remoteName}` : conn.name,
|
|
327
|
+
_hops: (Number(rc._hops) || 0) + 1
|
|
243
328
|
});
|
|
244
329
|
}
|
|
245
330
|
});
|
|
@@ -259,6 +344,109 @@ async function testRemoteConnection(conn: any): Promise<boolean> {
|
|
|
259
344
|
const connectionService = new ConnectionService();
|
|
260
345
|
const databaseService = new DatabaseService();
|
|
261
346
|
|
|
347
|
+
// ---------------- 定时备份(进程内调度) ----------------
|
|
348
|
+
|
|
349
|
+
interface BackupSchedule {
|
|
350
|
+
id: string;
|
|
351
|
+
connectionId: string;
|
|
352
|
+
databaseName: string;
|
|
353
|
+
intervalMinutes: number;
|
|
354
|
+
enabled: boolean;
|
|
355
|
+
createdAt: number;
|
|
356
|
+
lastRunAt?: number;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
const BACKUP_SCHEDULE_FILE = 'backup-schedules.json';
|
|
360
|
+
|
|
361
|
+
function loadBackupSchedules(): BackupSchedule[] {
|
|
362
|
+
try {
|
|
363
|
+
const raw = fs.readFileSync(getDataPath(BACKUP_SCHEDULE_FILE), 'utf8');
|
|
364
|
+
const parsed = JSON.parse(raw);
|
|
365
|
+
return Array.isArray(parsed) ? parsed.filter((s) => s && s.id && s.connectionId) : [];
|
|
366
|
+
} catch {
|
|
367
|
+
return [];
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// 所有备份计划的 load-modify-save(增删改/手动执行/定时扫描)共用一条串行队列,避免并发覆盖。
|
|
372
|
+
let scheduleTaskQueue: Promise<void> = Promise.resolve();
|
|
373
|
+
function enqueueScheduleTask<T>(task: () => Promise<T>): Promise<T> {
|
|
374
|
+
const result = scheduleTaskQueue.then(task);
|
|
375
|
+
scheduleTaskQueue = result.then(() => undefined, () => undefined);
|
|
376
|
+
return result;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
function saveBackupSchedules(schedules: BackupSchedule[]): void {
|
|
380
|
+
ensureDataDir();
|
|
381
|
+
const target = getDataPath(BACKUP_SCHEDULE_FILE);
|
|
382
|
+
const temp = `${target}.${process.pid}.${Date.now()}.${Math.random().toString(36).slice(2)}.tmp`;
|
|
383
|
+
try {
|
|
384
|
+
fs.writeFileSync(temp, JSON.stringify(schedules, null, 2), 'utf8');
|
|
385
|
+
fs.renameSync(temp, target);
|
|
386
|
+
} catch (e) {
|
|
387
|
+
try {
|
|
388
|
+
fs.unlinkSync(temp);
|
|
389
|
+
} catch {
|
|
390
|
+
// 临时文件可能尚未创建或已被清理,忽略二次错误
|
|
391
|
+
}
|
|
392
|
+
throw e;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
const inFlightScheduleIds = new Set<string>();
|
|
397
|
+
|
|
398
|
+
/** 执行单个计划:成功才更新 lastRunAt,失败时保留原值供下一分钟重试。 */
|
|
399
|
+
async function executeBackupSchedule(schedule: BackupSchedule): Promise<string> {
|
|
400
|
+
if (inFlightScheduleIds.has(schedule.id)) throw new Error(`备份计划正在执行: ${schedule.id}`);
|
|
401
|
+
inFlightScheduleIds.add(schedule.id);
|
|
402
|
+
try {
|
|
403
|
+
const result = await databaseService.backupDatabase(schedule.connectionId, schedule.databaseName, {
|
|
404
|
+
scheduleId: schedule.id
|
|
405
|
+
});
|
|
406
|
+
schedule.lastRunAt = Date.now();
|
|
407
|
+
return result;
|
|
408
|
+
} finally {
|
|
409
|
+
inFlightScheduleIds.delete(schedule.id);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
let backupSweepRunning = false;
|
|
414
|
+
|
|
415
|
+
/** 每分钟检查一次到期的计划;仅在本服务进程存活期间运行。 */
|
|
416
|
+
async function runDueBackups(): Promise<void> {
|
|
417
|
+
if (backupSweepRunning) return; // 全局重入保护:上一轮未结束(含备份 I/O)时直接跳过本次 tick
|
|
418
|
+
backupSweepRunning = true;
|
|
419
|
+
try {
|
|
420
|
+
await enqueueScheduleTask(async () => {
|
|
421
|
+
const schedules = loadBackupSchedules();
|
|
422
|
+
const now = Date.now();
|
|
423
|
+
let changed = false;
|
|
424
|
+
for (const s of schedules) {
|
|
425
|
+
if (!s.enabled || inFlightScheduleIds.has(s.id)) continue;
|
|
426
|
+
const intervalMs = Math.max(1, Number(s.intervalMinutes) || 60) * 60 * 1000;
|
|
427
|
+
if (now - (s.lastRunAt || 0) < intervalMs) continue;
|
|
428
|
+
try {
|
|
429
|
+
await executeBackupSchedule(s);
|
|
430
|
+
changed = true;
|
|
431
|
+
} catch (e: any) {
|
|
432
|
+
console.warn(`[backup-schedule] ${s.connectionId}/${s.databaseName} 备份失败:`, e?.message || e);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
if (changed) saveBackupSchedules(schedules);
|
|
436
|
+
});
|
|
437
|
+
} finally {
|
|
438
|
+
backupSweepRunning = false;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
const backupScheduler = setInterval(() => {
|
|
443
|
+
runDueBackups().catch((e: any) => {
|
|
444
|
+
console.warn('[backup-schedule] 定时检查失败:', e?.message || e);
|
|
445
|
+
});
|
|
446
|
+
}, 60 * 1000);
|
|
447
|
+
// 不阻止进程退出(VSCode 扩展宿主 / CLI 也会导入本模块)
|
|
448
|
+
(backupScheduler as any).unref?.();
|
|
449
|
+
|
|
262
450
|
|
|
263
451
|
// 数据库相关路由处理
|
|
264
452
|
export async function handleDatabaseRoutes(pathname: string, body: any, headers?: any) {
|
|
@@ -278,7 +466,7 @@ export async function handleDatabaseRoutes(pathname: string, body: any, headers?
|
|
|
278
466
|
if (headers && headers[REMOTE_PROXY_HEADER]) {
|
|
279
467
|
return await connectionService.getAllConnections();
|
|
280
468
|
}
|
|
281
|
-
return await handleGetConnectionsWithProxy();
|
|
469
|
+
return await handleGetConnectionsWithProxy(headers);
|
|
282
470
|
}
|
|
283
471
|
|
|
284
472
|
// 远程代理连接本身的测试:直接探活远程服务
|
|
@@ -290,7 +478,7 @@ export async function handleDatabaseRoutes(pathname: string, body: any, headers?
|
|
|
290
478
|
// 覆盖数据操作(查询/建表/改结构等)与连接配置的增删改
|
|
291
479
|
const proxy = await resolveRemoteProxy(pathname, body);
|
|
292
480
|
if (proxy) {
|
|
293
|
-
return await proxyToRemote(proxy.proxyConn, proxy.remoteConnId, pathname, body);
|
|
481
|
+
return await proxyToRemote(proxy.proxyConn, proxy.remoteConnId, pathname, body, chainFromHeaders(headers));
|
|
294
482
|
}
|
|
295
483
|
|
|
296
484
|
// 对「远程代理配置」本身做数据操作时给出明确提示(配置本身的增删改是允许的)
|
|
@@ -340,6 +528,24 @@ export async function handleDatabaseRoutes(pathname: string, body: any, headers?
|
|
|
340
528
|
return result;
|
|
341
529
|
}
|
|
342
530
|
|
|
531
|
+
// /api/database/health/:id/:database(或 ?id=...)——连通性探活。
|
|
532
|
+
// 客户端 checkDatabaseHealth 早在 UI 前就声明了此路由,但此前服务端没有实现。
|
|
533
|
+
if (pathname === '/api/database/health' || pathname.startsWith('/api/database/health/')) {
|
|
534
|
+
const parts = pathname.split('/').filter(Boolean);
|
|
535
|
+
const id = extractConnId(pathname, body);
|
|
536
|
+
if (!id) throw Error('Missing parameter: id');
|
|
537
|
+
const database = body?.database || parts[4];
|
|
538
|
+
if (database) {
|
|
539
|
+
// 指定库时真正连接并读取库信息,失败由 getDatabaseInfo 抛出异常返回。
|
|
540
|
+
const info = await databaseService.getDatabaseInfo(id, database);
|
|
541
|
+
if (!info) throw Error(`数据库不存在: ${database}`);
|
|
542
|
+
return { healthy: true, database };
|
|
543
|
+
}
|
|
544
|
+
// 未指定库时保留列库检查,适用于关系型与文档型;不执行方言专有 SQL。
|
|
545
|
+
const databases = await databaseService.getDatabases(id);
|
|
546
|
+
return { healthy: true, databaseCount: Array.isArray(databases) ? databases.length : 0 };
|
|
547
|
+
}
|
|
548
|
+
|
|
343
549
|
// /api/database/getDatabases
|
|
344
550
|
if (pathname === '/api/database/getDatabases') {
|
|
345
551
|
const { id } = body;
|
|
@@ -372,6 +578,46 @@ export async function handleDatabaseRoutes(pathname: string, body: any, headers?
|
|
|
372
578
|
return result;
|
|
373
579
|
}
|
|
374
580
|
|
|
581
|
+
// ---- 文档型(MongoDB)索引与聚合:统一走方言 service,未实现的方言会明确报错 ----
|
|
582
|
+
|
|
583
|
+
// /api/database/getIndexes
|
|
584
|
+
if (pathname === '/api/database/getIndexes') {
|
|
585
|
+
const { id, database, table } = body;
|
|
586
|
+
if (!id || !database || !table) throw Error('Missing parameters: id, database, table');
|
|
587
|
+
const dataSource = await databaseService['connectionService'].getActiveConnection(id, database);
|
|
588
|
+
const dbService = databaseService['getDatabaseService'](dataSource.options.type as string);
|
|
589
|
+
return await dbService.getIndexes(dataSource, database, table);
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
// /api/database/createIndex
|
|
593
|
+
if (pathname === '/api/database/createIndex') {
|
|
594
|
+
const { id, database, table, keys, options } = body;
|
|
595
|
+
if (!id || !database || !table || !keys) throw Error('Missing parameters: id, database, table, keys');
|
|
596
|
+
const dataSource = await databaseService['connectionService'].getActiveConnection(id, database);
|
|
597
|
+
const dbService = databaseService['getDatabaseService'](dataSource.options.type as string);
|
|
598
|
+
const name = await dbService.createIndex(dataSource, database, table, keys, options);
|
|
599
|
+
return { success: true, name };
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
// /api/database/dropIndex
|
|
603
|
+
if (pathname === '/api/database/dropIndex') {
|
|
604
|
+
const { id, database, table, indexName } = body;
|
|
605
|
+
if (!id || !database || !table || !indexName) throw Error('Missing parameters: id, database, table, indexName');
|
|
606
|
+
const dataSource = await databaseService['connectionService'].getActiveConnection(id, database);
|
|
607
|
+
const dbService = databaseService['getDatabaseService'](dataSource.options.type as string);
|
|
608
|
+
await dbService.dropIndex(dataSource, database, table, indexName);
|
|
609
|
+
return { success: true };
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
// /api/database/aggregate
|
|
613
|
+
if (pathname === '/api/database/aggregate') {
|
|
614
|
+
const { id, database, table, pipeline } = body;
|
|
615
|
+
if (!id || !database || !table || !pipeline) throw Error('Missing parameters: id, database, table, pipeline');
|
|
616
|
+
const dataSource = await databaseService['connectionService'].getActiveConnection(id, database);
|
|
617
|
+
const dbService = databaseService['getDatabaseService'](dataSource.options.type as string);
|
|
618
|
+
return await dbService.aggregate(dataSource, database, table, pipeline);
|
|
619
|
+
}
|
|
620
|
+
|
|
375
621
|
// /api/database/getTableData
|
|
376
622
|
if (pathname === '/api/database/getTableData') {
|
|
377
623
|
const { id, database, table, page = 1, pageSize = 100, where, orderBy } = body;
|
|
@@ -444,6 +690,70 @@ export async function handleDatabaseRoutes(pathname: string, body: any, headers?
|
|
|
444
690
|
return { success: true, result };
|
|
445
691
|
}
|
|
446
692
|
|
|
693
|
+
// 定时备份计划:配置持久化在数据目录,调度由本进程每分钟检查一次
|
|
694
|
+
if (pathname === '/api/database/getBackupSchedules') {
|
|
695
|
+
return { schedules: loadBackupSchedules() };
|
|
696
|
+
}
|
|
697
|
+
if (pathname === '/api/database/addBackupSchedule') {
|
|
698
|
+
const { connectionId, databaseName, intervalMinutes = 60, enabled = true } = body || {};
|
|
699
|
+
if (!connectionId || !databaseName) throw Error('Missing parameters: connectionId, databaseName');
|
|
700
|
+
return await enqueueScheduleTask(async () => {
|
|
701
|
+
const schedules = loadBackupSchedules();
|
|
702
|
+
const item: BackupSchedule = {
|
|
703
|
+
id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
704
|
+
connectionId,
|
|
705
|
+
databaseName,
|
|
706
|
+
intervalMinutes: Math.max(1, Math.floor(Number(intervalMinutes) || 60)),
|
|
707
|
+
enabled: !!enabled,
|
|
708
|
+
createdAt: Date.now()
|
|
709
|
+
};
|
|
710
|
+
schedules.push(item);
|
|
711
|
+
saveBackupSchedules(schedules);
|
|
712
|
+
return { schedule: item };
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
if (pathname === '/api/database/updateBackupSchedule') {
|
|
716
|
+
const { id, ...updates } = body || {};
|
|
717
|
+
if (!id) throw Error('Missing parameter: id');
|
|
718
|
+
return await enqueueScheduleTask(async () => {
|
|
719
|
+
const schedules = loadBackupSchedules();
|
|
720
|
+
const item = schedules.find((s) => s.id === id);
|
|
721
|
+
if (!item) throw Error(`备份计划不存在: ${id}`);
|
|
722
|
+
// 只接受可编辑字段,禁止外部改写 lastRunAt / createdAt / id 等运行时字段。
|
|
723
|
+
if (updates.connectionId !== undefined) item.connectionId = String(updates.connectionId);
|
|
724
|
+
if (updates.databaseName !== undefined) item.databaseName = String(updates.databaseName);
|
|
725
|
+
if (updates.intervalMinutes !== undefined) {
|
|
726
|
+
item.intervalMinutes = Math.max(1, Math.floor(Number(updates.intervalMinutes) || 60));
|
|
727
|
+
}
|
|
728
|
+
if (updates.enabled !== undefined) item.enabled = !!updates.enabled;
|
|
729
|
+
saveBackupSchedules(schedules);
|
|
730
|
+
return { schedule: item };
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
if (pathname === '/api/database/deleteBackupSchedule') {
|
|
734
|
+
const { id } = body || {};
|
|
735
|
+
if (!id) throw Error('Missing parameter: id');
|
|
736
|
+
return await enqueueScheduleTask(async () => {
|
|
737
|
+
const schedules = loadBackupSchedules();
|
|
738
|
+
const kept = schedules.filter((s) => s.id !== id);
|
|
739
|
+
if (kept.length === schedules.length) throw Error(`备份计划不存在: ${id}`);
|
|
740
|
+
saveBackupSchedules(kept);
|
|
741
|
+
return { success: true };
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
if (pathname === '/api/database/runBackupSchedule') {
|
|
745
|
+
const { id } = body || {};
|
|
746
|
+
if (!id) throw Error('Missing parameter: id');
|
|
747
|
+
return await enqueueScheduleTask(async () => {
|
|
748
|
+
const schedules = loadBackupSchedules();
|
|
749
|
+
const schedule = schedules.find((s) => s.id === id);
|
|
750
|
+
if (!schedule) throw Error(`备份计划不存在: ${id}`);
|
|
751
|
+
const result = await executeBackupSchedule(schedule);
|
|
752
|
+
saveBackupSchedules(schedules);
|
|
753
|
+
return { success: true, result };
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
|
|
447
757
|
// /api/database/restore
|
|
448
758
|
if (pathname === '/api/database/restore') {
|
|
449
759
|
const { id, databaseName, filePath, options } = body;
|
|
@@ -588,6 +898,13 @@ export async function handleDatabaseRoutes(pathname: string, body: any, headers?
|
|
|
588
898
|
return result;
|
|
589
899
|
}
|
|
590
900
|
|
|
901
|
+
// /api/database/importData:浏览器解析文件后按批提交行数组,服务端按方言 bulkInsert
|
|
902
|
+
if (pathname === '/api/database/importData') {
|
|
903
|
+
const { id, database, table, rows } = body;
|
|
904
|
+
if (!id || !database || !table || !Array.isArray(rows)) throw Error('Missing parameters: id, database, table, rows');
|
|
905
|
+
return await databaseService.importData(id, database, table, rows);
|
|
906
|
+
}
|
|
907
|
+
|
|
591
908
|
// /api/database/insertData
|
|
592
909
|
if (pathname === '/api/database/insertData') {
|
|
593
910
|
const { id, database, table, data } = body;
|
|
@@ -597,6 +914,14 @@ export async function handleDatabaseRoutes(pathname: string, body: any, headers?
|
|
|
597
914
|
const dataSource = await databaseService['connectionService'].getActiveConnection(id, database);
|
|
598
915
|
const dbService = databaseService['getDatabaseService'](dataSource.options.type as string);
|
|
599
916
|
|
|
917
|
+
// 文档型(MongoDB):直接插入文档,不拼 INSERT SQL
|
|
918
|
+
if (dataModelOf(dataSource.options.type as string) === 'document') {
|
|
919
|
+
const result = Array.isArray(data)
|
|
920
|
+
? await dbService.bulkInsert(dataSource, database, table, data)
|
|
921
|
+
: await dbService.insertDocument(dataSource, database, table, data);
|
|
922
|
+
return { success: true, result };
|
|
923
|
+
}
|
|
924
|
+
|
|
600
925
|
// 获取表的列信息,用于过滤自增字段
|
|
601
926
|
const columns = await dbService.getColumns(dataSource, database, table);
|
|
602
927
|
|
|
@@ -607,13 +932,21 @@ export async function handleDatabaseRoutes(pathname: string, body: any, headers?
|
|
|
607
932
|
|
|
608
933
|
// /api/database/updateData
|
|
609
934
|
if (pathname === '/api/database/updateData') {
|
|
610
|
-
const { id, database, table, data, where } = body;
|
|
611
|
-
if (!id || !database || !table || !data
|
|
935
|
+
const { id, database, table, data, where, docId } = body;
|
|
936
|
+
if (!id || !database || !table || !data) throw Error('Missing parameters');
|
|
612
937
|
|
|
613
938
|
// 获取数据库服务实例以使用正确的语法
|
|
614
939
|
const dataSource = await databaseService['connectionService'].getActiveConnection(id, database);
|
|
615
940
|
const dbService = databaseService['getDatabaseService'](dataSource.options.type as string);
|
|
616
941
|
|
|
942
|
+
// 文档型(MongoDB):按 _id 更新,不拼 UPDATE SQL
|
|
943
|
+
if (dataModelOf(dataSource.options.type as string) === 'document') {
|
|
944
|
+
if (!docId) throw Error('Missing parameters: docId');
|
|
945
|
+
await dbService.updateDocument(dataSource, database, table, docId, data);
|
|
946
|
+
return { success: true };
|
|
947
|
+
}
|
|
948
|
+
if (!where) throw Error('Missing parameters');
|
|
949
|
+
|
|
617
950
|
const sql = generateUpdateSQL(dataSource.options.type as string, table, data, where, dbService);
|
|
618
951
|
const result = await databaseService.executeQuery(id, sql, database);
|
|
619
952
|
return { sql, result };
|
|
@@ -621,13 +954,21 @@ export async function handleDatabaseRoutes(pathname: string, body: any, headers?
|
|
|
621
954
|
|
|
622
955
|
// /api/database/deleteData
|
|
623
956
|
if (pathname === '/api/database/deleteData') {
|
|
624
|
-
const { id, database, table, where } = body;
|
|
625
|
-
if (!id || !database || !table
|
|
957
|
+
const { id, database, table, where, docId } = body;
|
|
958
|
+
if (!id || !database || !table) throw Error('Missing parameters');
|
|
626
959
|
|
|
627
960
|
// 获取数据库服务实例以使用正确的语法
|
|
628
961
|
const dataSource = await databaseService['connectionService'].getActiveConnection(id, database);
|
|
629
962
|
const dbService = databaseService['getDatabaseService'](dataSource.options.type as string);
|
|
630
963
|
|
|
964
|
+
// 文档型(MongoDB):按 _id 删除,不拼 DELETE SQL
|
|
965
|
+
if (dataModelOf(dataSource.options.type as string) === 'document') {
|
|
966
|
+
if (!docId) throw Error('Missing parameters: docId');
|
|
967
|
+
await dbService.deleteDocument(dataSource, database, table, docId);
|
|
968
|
+
return { success: true };
|
|
969
|
+
}
|
|
970
|
+
if (!where) throw Error('Missing parameters');
|
|
971
|
+
|
|
631
972
|
const sql = generateDeleteSQL(dataSource.options.type as string, table, where, dbService);
|
|
632
973
|
const result = await databaseService.executeQuery(id, sql, database);
|
|
633
974
|
return { success: true, sql, result };
|
|
@@ -642,9 +983,17 @@ export async function handleDatabaseRoutes(pathname: string, body: any, headers?
|
|
|
642
983
|
const table = parts[5];
|
|
643
984
|
if (!id || !database || !table) throw Error('Missing parameters');
|
|
644
985
|
|
|
645
|
-
//
|
|
986
|
+
// 获取数据库服务实例以使用正确的语法
|
|
646
987
|
const dataSource = await databaseService['connectionService'].getActiveConnection(id, database);
|
|
647
988
|
const dbService = databaseService['getDatabaseService'](dataSource.options.type as string);
|
|
989
|
+
|
|
990
|
+
// 文档型(MongoDB):deleteMany({}),无 TRUNCATE 语法
|
|
991
|
+
if (dataModelOf(dataSource.options.type as string) === 'document') {
|
|
992
|
+
const deleted = await dbService.truncateCollection(dataSource, database, table);
|
|
993
|
+
return { success: true, deleted };
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
// 使用数据库服务生成正确的TRUNCATE语法
|
|
648
997
|
const sql = `TRUNCATE TABLE ${dbService['quoteIdentifier'](table)}`;
|
|
649
998
|
const result = await databaseService.executeQuery(id, sql, database);
|
|
650
999
|
return { success: true, sql, result };
|
|
@@ -659,9 +1008,17 @@ export async function handleDatabaseRoutes(pathname: string, body: any, headers?
|
|
|
659
1008
|
const table = parts[5];
|
|
660
1009
|
if (!id || !database || !table) throw Error('Missing parameters');
|
|
661
1010
|
|
|
662
|
-
//
|
|
1011
|
+
// 获取数据库服务实例以使用正确的语法
|
|
663
1012
|
const dataSource = await databaseService['connectionService'].getActiveConnection(id, database);
|
|
664
1013
|
const dbService = databaseService['getDatabaseService'](dataSource.options.type as string);
|
|
1014
|
+
|
|
1015
|
+
// 文档型(MongoDB):collection.drop(),无 DROP TABLE 语法
|
|
1016
|
+
if (dataModelOf(dataSource.options.type as string) === 'document') {
|
|
1017
|
+
await dbService.dropTable(dataSource, database, table);
|
|
1018
|
+
return { success: true };
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
// 使用数据库服务生成正确的DROP语法
|
|
665
1022
|
const sql = `DROP TABLE ${dbService['quoteIdentifier'](table)}`;
|
|
666
1023
|
const result = await databaseService.executeQuery(id, sql, database);
|
|
667
1024
|
return { success: true, sql, result };
|
|
@@ -802,6 +1159,11 @@ function generateUpdateSQL(dbType: string, tableName: string, data: any, where:
|
|
|
802
1159
|
})
|
|
803
1160
|
.join(' AND ');
|
|
804
1161
|
|
|
1162
|
+
// ClickHouse 的 MergeTree 不支持标准 UPDATE;必须用 ALTER TABLE ... UPDATE(DELETE 同理)。
|
|
1163
|
+
// mutation 默认是异步的,加 mutations_sync=1 等待完成,避免 UI 立即刷新仍读到旧值。
|
|
1164
|
+
if (dbType === 'clickhouse') {
|
|
1165
|
+
return `ALTER TABLE ${dbService.quoteIdentifier(tableName)} UPDATE ${setClause} WHERE ${whereClause} SETTINGS mutations_sync = 1;`;
|
|
1166
|
+
}
|
|
805
1167
|
return `UPDATE ${dbService.quoteIdentifier(tableName)} SET ${setClause} WHERE ${whereClause};`;
|
|
806
1168
|
}
|
|
807
1169
|
|
|
@@ -815,6 +1177,9 @@ function generateDeleteSQL(dbType: string, tableName: string, where: any, dbServ
|
|
|
815
1177
|
})
|
|
816
1178
|
.join(' AND ');
|
|
817
1179
|
|
|
1180
|
+
if (dbType === 'clickhouse') {
|
|
1181
|
+
return `ALTER TABLE ${dbService.quoteIdentifier(tableName)} DELETE WHERE ${whereClause} SETTINGS mutations_sync = 1;`;
|
|
1182
|
+
}
|
|
818
1183
|
return `DELETE FROM ${dbService.quoteIdentifier(tableName)} WHERE ${whereClause};`;
|
|
819
1184
|
}
|
|
820
1185
|
|
|
@@ -144,6 +144,11 @@ export interface DdlCapability {
|
|
|
144
144
|
columnComment: boolean;
|
|
145
145
|
/** native=原生 ALTER;rebuild=需重建表(SQLite);unsupported=不支持(MongoDB) */
|
|
146
146
|
alterStrategy: 'native' | 'rebuild' | 'unsupported';
|
|
147
|
+
/**
|
|
148
|
+
* 建表路径:sql=生成并执行 CREATE TABLE DDL(默认);
|
|
149
|
+
* driver=方言无模式、无 CREATE TABLE 语法,走驱动原生调用建集合(MongoDB),忽略列定义。
|
|
150
|
+
*/
|
|
151
|
+
createStrategy?: 'sql' | 'driver';
|
|
147
152
|
quoteStyle: 'backtick' | 'double' | 'bracket';
|
|
148
153
|
}
|
|
149
154
|
/** 预览结果:纯计算,不触碰数据库(建表场景无 diff,changeSet 为 null) */
|
|
@@ -151,6 +156,8 @@ export interface DdlPreview {
|
|
|
151
156
|
statements: string[];
|
|
152
157
|
preview: string;
|
|
153
158
|
changeSet: TableChangeSet | null;
|
|
159
|
+
/** 非致命的计划级错误(如方言不支持建表/改表、表已存在)。带回前端用于禁用 UI 与提示,而非抛错 */
|
|
160
|
+
error?: string | null;
|
|
154
161
|
}
|
|
155
162
|
/** 执行结果 */
|
|
156
163
|
export interface DdlExecuteResult {
|
|
@@ -159,5 +166,7 @@ export interface DdlExecuteResult {
|
|
|
159
166
|
conflict?: {
|
|
160
167
|
reason: string;
|
|
161
168
|
};
|
|
169
|
+
/** 驱动原生路径执行(无模式方言建集合):无 SQL 语句但已实际创建,statements 恒为空,前端不得按"无修改"处理 */
|
|
170
|
+
native?: boolean;
|
|
162
171
|
}
|
|
163
172
|
//# sourceMappingURL=ddl-spec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ddl-spec.d.ts","sourceRoot":"","sources":["../../../server/model/ddl-spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,6BAA6B;AAC7B,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,YAAY,CAAC;AAErE;;;;GA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