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
32 lines
1.2 KiB
TypeScript
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,
|
|
}));
|
|
}
|