Adopt focused P2P service views

This commit is contained in:
vorotamoroz
2026-08-28 03:04:53 +00:00
parent cc000f2cdf
commit ad83ae858d
20 changed files with 276 additions and 112 deletions
@@ -1,12 +1,20 @@
import type { RequiredServices } from "@vrtmrz/livesync-commonlib/compat/interfaces/ServiceModule";
import type { P2PServiceViews } from "@vrtmrz/livesync-commonlib/p2p";
import type { PeerStatus } from "@vrtmrz/livesync-commonlib/compat/replication/trystero/P2PReplicatorPaneCommon";
import type { UseP2PReplicatorResult } from "@vrtmrz/livesync-commonlib/compat/replication/trystero/UseP2PReplicatorResult";
export type P2PReplicatorHandle = Pick<UseP2PReplicatorResult, "replicator">;
/**
* The shared pane only needs the contracts which represent its visible
* actions. In particular, it must not receive the compatibility Replicator
* facade, whose lifecycle methods can bypass the stable P2P service owner.
*/
export type P2PReplicatorPaneP2P = Pick<
P2PServiceViews,
"transportLifecycle" | "peerDirectory" | "peerAdmission" | "targetedTransfer" | "changeRelay" | "diagnostics"
>;
/** Host capabilities consumed by the shared P2P pane. */
export interface P2PReplicatorPaneHost {
readonly services: RequiredServices<"API" | "config" | "setting" | "vault">;
readonly p2p: P2PReplicatorHandle;
readonly p2p: P2PReplicatorPaneP2P;
readonly showPeerMenu?: (peer: PeerStatus, event: MouseEvent) => void;
}