Skip to content
Sarj Workspace Sync

workspace-directory/slack-name-sync

@sarj-ai/workspace-sync/workspace-directory/slack-name-sync ยท Source

import { z } from "zod";
import { type IdentityWriteBudget } from "../identity-provisioning/identity-budget-contracts.ts";
import type { GoogleDirectoryUser } from "../org-sync/model.ts";
import type { IOrgSlackClient, SlackSnapshot } from "../org-sync/org-slack-client.ts";
export declare const SlackNameActionSchema: z.ZodObject<{
beforeRealName: z.ZodString;
desiredName: z.ZodString;
email: z.ZodEmail;
googleUserId: z.ZodString;
slackUserId: z.ZodString;
type: z.ZodLiteral<"repair-default-name">;
}, z.core.$strict>;
export type SlackNameAction = z.output<typeof SlackNameActionSchema>;
export declare const AuditedSlackNamePlanSchema: z.ZodObject<{
actions: z.ZodArray<z.ZodObject<{
beforeRealName: z.ZodString;
desiredName: z.ZodString;
email: z.ZodEmail;
googleUserId: z.ZodString;
slackUserId: z.ZodString;
type: z.ZodLiteral<"repair-default-name">;
}, z.core.$strict>>;
actorUserId: z.ZodString;
authorityUsers: z.ZodArray<z.ZodObject<{
email: z.ZodEmail;
googleUserId: z.ZodString;
name: z.ZodString;
}, z.core.$strict>>;
planHash: z.ZodString;
teamId: z.ZodString;
}, z.core.$strict>;
export type AuditedSlackNamePlan = z.output<typeof AuditedSlackNamePlanSchema>;
export type ISlackNameClient = Pick<IOrgSlackClient, "getProfile" | "listSnapshot" | "setProfile">;
export declare function auditSlackNameSync(googleUsers: readonly GoogleDirectoryUser[], slack: ISlackNameClient, expectedTeamId: string): Promise<AuditedSlackNamePlan>;
export declare function planSlackNameSync(googleUsers: readonly GoogleDirectoryUser[], snapshot: SlackSnapshot): Omit<AuditedSlackNamePlan, "planHash">;
export declare function applySlackNamePlanAction(googleUsers: readonly GoogleDirectoryUser[], slack: ISlackNameClient, expectedTeamId: string, rawAction: SlackNameAction, expectedPlanHash: string, identityBudget?: IdentityWriteBudget, assertWriteAuthority?: () => Promise<void>): Promise<void>;
export declare function isSlackNameActionConverged(slack: Pick<ISlackNameClient, "getProfile">, action: SlackNameAction): Promise<boolean>;
export declare class SlackNameBoundError extends Error {
constructor(bound: "action" | "authority", options?: ErrorOptions);
}
export declare class SlackNameIdentityError extends Error {
constructor(source: "actor" | "authority" | "google" | "scope" | "slack" | "workspace", options?: ErrorOptions);
}
export declare class SlackNameRoleError extends Error {
constructor();
}
export declare class SlackNameDriftError extends Error {
constructor();
}
export declare class SlackNameReadbackError extends Error {
constructor();
}