types(web): unify FederationPeer with shared type
packages/web/src/api/client.ts declared a local FederationPeer that had drifted from @backspace/shared: it loosened `status` to `string` (losing the exhaustive 7-value union) and widened `consecutiveFailures` and `lastSyncedAt` to `number | null`. The latter two are spurious — the server never returns null for either — and `status: string` defeated the compiler's ability to flag a missed case when `rejected`, `awaiting_approval`, or `needs_attention` were added over the course of the auto-peering / approval-queue / outbox-auth-failure-recovery work. Replace the local interface with a re-export of the shared type. All three status switches in FederationPanel.tsx (peerStatusColor, peerStatusDotColor, peerStatusLabel) and the StatusFilter union were already exhaustive over the 7 values, so no behaviour change is needed — the re-export just pins the compile-time contract. web tsc --noEmit is clean after the swap. Follow-up #23 from S2S DM unification backlog.
This commit is contained in:
@@ -52,8 +52,11 @@ import type {
|
|||||||
FederationRegistryEntry,
|
FederationRegistryEntry,
|
||||||
FederationIdentityDeleteRequest,
|
FederationIdentityDeleteRequest,
|
||||||
FederationIdentityDeleteResponse,
|
FederationIdentityDeleteResponse,
|
||||||
|
FederationPeer,
|
||||||
} from '@backspace/shared';
|
} from '@backspace/shared';
|
||||||
|
|
||||||
|
export type { FederationPeer };
|
||||||
|
|
||||||
export class RateLimitError extends Error {
|
export class RateLimitError extends Error {
|
||||||
readonly retryAfter: number;
|
readonly retryAfter: number;
|
||||||
constructor(retryAfter: number) {
|
constructor(retryAfter: number) {
|
||||||
@@ -63,22 +66,6 @@ export class RateLimitError extends Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FederationPeer {
|
|
||||||
id: string;
|
|
||||||
origin: string;
|
|
||||||
instanceName: string | null;
|
|
||||||
status: string;
|
|
||||||
lastSeenAt: number | null;
|
|
||||||
lastFailureAt: number | null;
|
|
||||||
consecutiveFailures: number | null;
|
|
||||||
consecutiveAuthFailures: number;
|
|
||||||
lastSyncedAt: number | null;
|
|
||||||
createdAt: number;
|
|
||||||
secretRotatedAt: number | null;
|
|
||||||
rotationInProgress: boolean;
|
|
||||||
autoRotateIntervalDays: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ApprovalRequest {
|
export interface ApprovalRequest {
|
||||||
id: string;
|
id: string;
|
||||||
origin: string;
|
origin: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user