execution/google-group-cleanup-service
@sarj-ai/workspace-sync/execution/google-group-cleanup-service ยท Source
import { type ResourceLeaseRepository } from "../identity-sync/resource-lease.ts";import type { IGoogleDirectoryClient } from "../org-sync/google-directory-client.ts";import type { IGoogleGroupMembershipWriter, IGoogleGroupsClient } from "../org-sync/google-groups-client.ts";import { type Sleep } from "../org-sync/http.ts";import { type GoogleGroupCleanupAction, type GoogleGroupCleanupPlan } from "../workspace-directory/google-group-cleanup-sync.ts";import type { WorkspaceProviderExecution } from "./provider-execution.ts";import type { ReviewedAction, ReviewedActionContext, ReviewedActionState } from "./reviewed-action-context.ts";export interface ManagedGoogleGroupPin { readonly email: string; readonly id: string;}export interface GoogleGroupCleanupServiceDependencies { directory: Required<Pick<IGoogleDirectoryClient, "getUserById" | "listAllUsers" | "listDeletedUsers">>; excludedGoogleGroupIds?: readonly string[]; excludedGoogleUserIds?: readonly string[]; groups: Pick<IGoogleGroupsClient, "listAllGroups" | "listGroups">; leaseRepository: ResourceLeaseRepository; managedGoogleGroupPins: readonly ManagedGoogleGroupPin[]; writer: IGoogleGroupMembershipWriter;}export type GoogleGroupCleanupScheduledResult = "applied" | "busy" | "converged";export type GoogleGroupCleanupParentExecution = Extract<ReviewedActionContext<GoogleGroupCleanupAction>, { mode: "parent";}> & { readonly deadlineAtMs?: number; assertFinalSourceAuthority(): Promise<void>;};export interface GoogleGroupCleanupServiceContract { applyReviewed(reviewed: ReviewedAction<GoogleGroupCleanupAction>, context: GoogleGroupCleanupParentExecution): Promise<GoogleGroupCleanupScheduledResult>; auditPlan(runId?: string, deadlineAt?: number): Promise<GoogleGroupCleanupPlan>; readReviewed(reviewed: ReviewedAction<GoogleGroupCleanupAction>, deadlineAt?: number): Promise<ReviewedActionState>;}export interface GoogleGroupCleanupReadbackOptions { now?: () => number; sleep?: Sleep;}export declare function googleGroupCleanupAuditErrorCode(error: unknown): string;export declare class GoogleGroupCleanupService implements GoogleGroupCleanupServiceContract { #private; constructor(mode: WorkspaceProviderExecution, dependencies: GoogleGroupCleanupServiceDependencies, readback?: GoogleGroupCleanupReadbackOptions); auditPlan(runId?: string, deadlineAt?: number): Promise<GoogleGroupCleanupPlan>; readReviewed(reviewed: ReviewedAction<GoogleGroupCleanupAction>, deadlineAt?: number): Promise<ReviewedActionState>; applyReviewed(reviewed: ReviewedAction<GoogleGroupCleanupAction>, context: GoogleGroupCleanupParentExecution): Promise<GoogleGroupCleanupScheduledResult>;}