Skip to content
Sarj Workspace Sync

workspace-directory/linear-profile-sync

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

import { z } from "zod";
import { type LinearProfileAccount } from "../access-guard/linear-provider.ts";
import { type IdentityWriteBudget } from "../identity-provisioning/identity-budget-contracts.ts";
import type { GoogleDirectoryUser } from "../org-sync/model.ts";
export declare const LinearProfileActionSchema: z.ZodObject<{
beforeFullName: z.ZodString;
desiredFullName: z.ZodString;
email: z.ZodEmail;
googleUserId: z.ZodString;
linearUserId: z.ZodString;
type: z.ZodLiteral<"repair-default-full-name">;
}, z.core.$strict>;
export type LinearProfileAction = z.output<typeof LinearProfileActionSchema>;
export declare const AuditedLinearProfilePlanSchema: z.ZodObject<{
actions: z.ZodArray<z.ZodObject<{
beforeFullName: z.ZodString;
desiredFullName: z.ZodString;
email: z.ZodEmail;
googleUserId: z.ZodString;
linearUserId: z.ZodString;
type: z.ZodLiteral<"repair-default-full-name">;
}, z.core.$strict>>;
authorityUsers: z.ZodArray<z.ZodObject<{
email: z.ZodEmail;
googleUserId: z.ZodString;
name: z.ZodString;
}, z.core.$strict>>;
planHash: z.ZodString;
}, z.core.$strict>;
export type AuditedLinearProfilePlan = z.output<typeof AuditedLinearProfilePlanSchema>;
export interface ILinearProfileClient {
getAccount(accountId: string, correlationId: string): Promise<unknown>;
listProfileAccounts(runId: string): Promise<readonly LinearProfileAccount[]>;
updateFullName(accountId: string, fullName: string, correlationId: string, assertFinalWriteAuthority?: () => Promise<void>): Promise<LinearProfileAccount>;
}
export declare function planLinearProfileSync(googleUsers: readonly GoogleDirectoryUser[], linearAccounts: readonly LinearProfileAccount[]): Omit<AuditedLinearProfilePlan, "planHash">;
export declare function auditLinearProfileSync(googleUsers: readonly GoogleDirectoryUser[], client: ILinearProfileClient): Promise<AuditedLinearProfilePlan>;
export declare function applyLinearProfilePlanAction(googleUsers: readonly GoogleDirectoryUser[], client: ILinearProfileClient, rawAction: LinearProfileAction, expectedPlanHash: string, identityBudget?: IdentityWriteBudget, assertWriteAuthority?: () => Promise<void>, assertFinalWriteAuthority?: () => Promise<void>): Promise<void>;
export declare function isLinearProfileActionConverged(client: Pick<ILinearProfileClient, "getAccount">, rawAction: LinearProfileAction): Promise<boolean>;
export declare class LinearProfileBoundError extends Error {
constructor(bound: "action" | "authority", options?: ErrorOptions);
}
export declare class LinearProfileIdentityError extends Error {
constructor(source: "authority" | "google" | "linear", options?: ErrorOptions);
}
export declare class LinearProfileDriftError extends Error {
constructor();
}
export declare class LinearProfileReadbackError extends Error {
constructor();
}