import type { GetProjectMembersOptions, ProjectMember, ProjectMemberInvitation, Role } from '@owox/idp-protocol'; import type { IdentityOwoxClient } from '../../client/index.js'; import type { DatabaseStore } from '../../store/database-store.js'; import type { ProjectMembersServiceOptions } from '../../types/project-members.js'; /** * Service for managing project members with persistent storage. * Implements TTL-based refresh and graceful degradation when OWOX Client is unavailable. */ export declare class ProjectMembersService { private readonly store; private readonly identityClient; private readonly logger; private readonly ttlSeconds; private readonly owoxClientTimeoutMs; constructor(store: DatabaseStore, identityClient: IdentityOwoxClient, options?: ProjectMembersServiceOptions); /** * Get project members with TTL-based refresh support. * Returns ALL members including those marked as outbound. * * Algorithm: * 1. If forceFresh=true → always fetch from OWOX Client * 2. If forceFresh=false/undefined: * - Check project sync info (expires_at from project table) * - If data is fresh → return stored members * - If data is stale → try to refresh from OWOX Client: * - If OWOX Client responds → update storage, return fresh data * - If OWOX Client times out → return stale data (graceful degradation) * - If no data → fetch from OWOX Client * * @param projectId - The project ID to get members for * @param options - Optional settings for controlling freshness * @returns Array of ALL project members (including outbound members) */ getMembers(projectId: string, options?: GetProjectMembersOptions): Promise; /** * Check if stored data is expired based on project table's expires_at timestamp. */ private isDataExpired; /** * Refresh data from OWOX Client with fallback to stale data on timeout/error. */ private refreshWithFallback; /** * Fetch members from OWOX Client with timeout support. */ private fetchFromOwoxClientWithTimeout; /** * Refresh data from OWOX Client. * Implements soft-delete: members not in OWOX Client get status=outbound. * Returns ALL members (including outbound). */ private refreshFromOwoxClient; /** * Invite a new member to the project by delegating to the Identity OWOX API. * The Java upstream owns email delivery, so the response surfaces * `kind: 'email-sent'` unconditionally. We compose `email` / `message` on * this side because the Java contract only returns `userUid` — everything * else is already known from the request. Returning `userId` lets the * caller controller attach scope + contexts immediately. */ inviteMember(projectId: string, email: string, role: Role, actorUserId: string): Promise; /** * Remove a member from the project. The next `getMembers` call will re-sync * from the remote source because `forceFresh` defaults to true in consumers. */ removeMember(projectId: string, userId: string, actorUserId: string): Promise; /** * Change a member's role via the Identity OWOX API. */ changeMemberRole(projectId: string, userId: string, newRole: Role, actorUserId: string): Promise; } //# sourceMappingURL=project-members-service.d.ts.map