Files
orca/src/preload/api/orca-profile-api.ts
T
Jinwoo Hong 77334e7c8b fix(orca-profiles): tell the renderer when a cloud session is revoked (#18694)
A revoked refresh-token family makes the main process clear the stored
cloud session, but the renderer cached orcaProfileAuthStatus at startup
and only re-fetched when it was empty. The account card kept showing
"Connected" and Mobile pairing kept showing a generic Relay failure until
the user restarted the app.

- Push: clearing a session on an auth failure now emits an invalidation
  event that broadcasts orcaProfiles:authStatusChanged to every window;
  the renderer re-reads auth status from it. Explicit sign-out is unchanged.
- Pull: every pane that renders auth state re-reads it on mount through
  useOrcaProfileAuthStatusRefresh instead of only when the store is empty.
- Copy: a Relay mint failure re-reads auth status, and the failure notice
  says the session expired and to sign in again instead of offering a
  retry that cannot succeed. The LAN path is untouched.
2026-09-04 16:51:45 -04:00

62 lines
2.4 KiB
TypeScript

import type {
ConnectCurrentOrcaProfileResult,
CreateCloudLinkedOrcaProfileArgs,
CreateCloudLinkedOrcaProfileResult,
CreateLocalOrcaProfileArgs,
CreateLocalOrcaProfileResult,
FindOrcaProfileProjectsByPathArgs,
FindOrcaProfileProjectsByPathResult,
OrcaProfileAuthStatus,
OrcaProfileListResult,
OrcaProfileOrgInviteRevokeArgs,
OrcaProfileOrgMemberChangeRoleArgs,
OrcaProfileOrgMemberInviteArgs,
OrcaProfileOrgMemberMutationResult,
OrcaProfileOrgMemberRemoveArgs,
OrcaProfileOrgMembersListArgs,
OrcaProfileOrgMembersListResult,
RefreshCurrentOrcaProfileAuthResult,
SelectOrcaProfileOrgArgs,
SelectOrcaProfileOrgResult,
SignOutCurrentOrcaProfileResult,
SwitchOrcaProfileArgs,
SwitchOrcaProfileResult,
TransferOrcaProfileProjectArgs,
TransferOrcaProfileProjectResult
} from '../../shared/orca-profiles'
export type OrcaProfileApi = {
list: () => Promise<OrcaProfileListResult>
authStatus: () => Promise<OrcaProfileAuthStatus>
/** Fires when main changed the stored auth status on its own (e.g. a revoked session). */
onAuthStatusChanged: (callback: () => void) => () => void
createLocal: (args?: CreateLocalOrcaProfileArgs) => Promise<CreateLocalOrcaProfileResult>
createCloudLinked: (
args?: CreateCloudLinkedOrcaProfileArgs
) => Promise<CreateCloudLinkedOrcaProfileResult>
switchProfile: (args: SwitchOrcaProfileArgs) => Promise<SwitchOrcaProfileResult>
transferProject: (
args: TransferOrcaProfileProjectArgs
) => Promise<TransferOrcaProfileProjectResult>
findProjectProfiles: (
args: FindOrcaProfileProjectsByPathArgs
) => Promise<FindOrcaProfileProjectsByPathResult>
connectCurrent: () => Promise<ConnectCurrentOrcaProfileResult>
refreshAuth: () => Promise<RefreshCurrentOrcaProfileAuthResult>
signOutCurrent: () => Promise<SignOutCurrentOrcaProfileResult>
selectOrg: (args: SelectOrcaProfileOrgArgs) => Promise<SelectOrcaProfileOrgResult>
orgMembersList: (args: OrcaProfileOrgMembersListArgs) => Promise<OrcaProfileOrgMembersListResult>
orgMemberInvite: (
args: OrcaProfileOrgMemberInviteArgs
) => Promise<OrcaProfileOrgMemberMutationResult>
orgInviteRevoke: (
args: OrcaProfileOrgInviteRevokeArgs
) => Promise<OrcaProfileOrgMemberMutationResult>
orgMemberChangeRole: (
args: OrcaProfileOrgMemberChangeRoleArgs
) => Promise<OrcaProfileOrgMemberMutationResult>
orgMemberRemove: (
args: OrcaProfileOrgMemberRemoveArgs
) => Promise<OrcaProfileOrgMemberMutationResult>
}