Skip to content
Sarj Workspace Sync

execution/linear-profile-service

@sarj-ai/workspace-sync/execution/linear-profile-service ยท Source

import { type EmployeeEntitlementAuthority } from "../identity-provisioning/employee-entitlement-policy.ts";
import { type ResourceLeaseRepository } from "../identity-sync/resource-lease.ts";
import type { IGoogleDirectoryClient } from "../org-sync/google-directory-client.ts";
import type { GoogleDirectoryUser } from "../org-sync/model.ts";
import { type AuditedLinearProfilePlan, type ILinearProfileClient, type LinearProfileAction } from "../workspace-directory/linear-profile-sync.ts";
import { type ParentNameEligibility } from "../workspace-directory/parent-name-identity-eligibility.ts";
import type { ReviewedAction, ReviewedActionContext, ReviewedActionState } from "./reviewed-action-context.ts";
export interface LinearProfileServiceDependencies {
directory: Pick<IGoogleDirectoryClient, "listAllUsers">;
employeeEntitlementAuthority: () => Promise<EmployeeEntitlementAuthority>;
leaseRepository: ResourceLeaseRepository;
linear: ILinearProfileClient;
}
export interface ParentLinearProfileCapture {
diagnostics: {
googleUserId: string;
reason: Exclude<ParentNameEligibility, "eligible">;
}[];
eligibleActions: LinearProfileAction[];
plan: AuditedLinearProfilePlan;
sourceFingerprint: string;
}
export interface ILinearProfileReader {
capture(): Promise<AuditedLinearProfilePlan>;
captureParent(googleUsers?: readonly GoogleDirectoryUser[]): Promise<ParentLinearProfileCapture>;
readReviewed(reviewed: ReviewedAction<LinearProfileAction>): Promise<ReviewedActionState>;
readSourceFingerprint(): Promise<string>;
}
export interface ILinearProfileWriter {
applyReviewed(reviewed: ReviewedAction<LinearProfileAction>, context: ReviewedActionContext<LinearProfileAction>): Promise<"busy" | "completed">;
}
export declare class LinearProfileService implements ILinearProfileReader, ILinearProfileWriter {
#private;
constructor(dependencies: LinearProfileServiceDependencies, writeEnabled: boolean);
capture(): Promise<{
actions: {
beforeFullName: string;
desiredFullName: string;
email: string;
googleUserId: string;
linearUserId: string;
type: "repair-default-full-name";
}[];
authorityUsers: {
email: string;
googleUserId: string;
name: string;
}[];
planHash: string;
}>;
readReviewed(reviewed: ReviewedAction<LinearProfileAction>): Promise<ReviewedActionState>;
readSourceFingerprint(): Promise<string>;
captureParent(googleUsers?: readonly GoogleDirectoryUser[]): Promise<ParentLinearProfileCapture>;
applyReviewed(reviewed: ReviewedAction<LinearProfileAction>, context: ReviewedActionContext<LinearProfileAction>): Promise<"busy" | "completed">;
}