Files
SnowLuma/packages/core/src/webui/connection-snapshot.ts
T
TanTan fa9c73363d
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
Publish MCP to npm / Build, test, and publish MCP (push) Waiting to run
Publish SDK to npm / Build, test, and publish SDK (push) Waiting to run
Sync action catalog to docs / sync (push) Waiting to run
Publish UI to npm / Build and publish UI (push) Waiting to run
Build and Release / preflight (push) Waiting to run
SnowLuma v2.4.2 source snapshot
2026-11-13 09:02:00 +08:00

32 lines
1.2 KiB
TypeScript

import type { AccountConnections } from '@snowluma/onebot/manager';
export function comparableConnectionSnapshot(snapshot: unknown): unknown {
if (!Array.isArray(snapshot)) {
return snapshot;
}
return (snapshot as AccountConnections[]).map((account) => ({
uin: account.uin,
nickname: account.nickname,
adapters: Array.isArray(account.adapters)
? account.adapters.map((adapter) => ({
name: adapter.name,
kind: adapter.kind,
status: adapter.status,
lastErrorAt: adapter.lastErrorAt,
}))
: [],
databaseMigration: account.databaseMigration
? {
phase: account.databaseMigration.phase,
usable: account.databaseMigration.usable,
processed: account.databaseMigration.processed,
total: account.databaseMigration.total,
progress: account.databaseMigration.progress,
estimatedRemainingSeconds: account.databaseMigration.estimatedRemainingSeconds,
error: account.databaseMigration.error,
}
: undefined,
}));
}