Skip to content
Sarj Workspace Sync

execution/github-access-managed

@sarj-ai/workspace-sync/execution/github-access-managed ยท Source

import { z } from "zod";
import type { GitHubAccessSnapshot } from "../github-access-audit/git-hub-access-audit-client.ts";
import type { GoogleAuthoritySnapshot } from "../github-access-audit/google-contracts.ts";
import type { ReviewedGitHubDirectGrantRetention } from "../github-access-audit/reviewed-direct-grants.ts";
import { type ReviewedGitHubTeamMembership } from "../github-access-audit/reviewed-team-memberships.ts";
import type { EmployeeEntitlementAuthority } from "../identity-provisioning/employee-entitlement-policy.ts";
import { type GitHubDesiredAuthorityRefresh, type GitHubDesiredOrganizationAccess, type GitHubObservedOrganizationAccount, type GitHubOrganizationPort, type GitHubOrganizationWriteContext } from "../identity-provisioning/github-organization-connector.ts";
import type { IdentityWriteBudget } from "../identity-provisioning/identity-budget-contracts.ts";
import { type JsonValue } from "../operations/schemas.ts";
import type { GoogleDirectoryUser } from "../org-sync/model.ts";
import type { WorkspaceDirectoryPlan } from "./contracts.ts";
declare const ConfigSchema: z.ZodObject<{
maxChanges: z.ZodLiteral<1>;
organizationId: z.ZodString;
organizationLogin: z.ZodString;
rootGroupEmail: z.ZodEmail;
token: z.ZodString;
}, z.core.$strict>;
type GitHubBranch = WorkspaceDirectoryPlan["branches"][3];
type ManagedGitHubBranch = Extract<GitHubBranch, {
execution: "managed";
}>;
export type ManagedGitHubAccessConfig = z.input<typeof ConfigSchema>;
export interface ManagedGitHubAccessPolicy {
readonly employeeEntitlementAuthority: EmployeeEntitlementAuthority;
readonly excludedGroupEmails: readonly string[];
readonly reviewedDirectGrantRetentions?: readonly ReviewedGitHubDirectGrantRetention[];
readonly reviewedTeamMemberships?: readonly ReviewedGitHubTeamMembership[];
readonly teamMappings: Readonly<Record<string, string>>;
readonly teamPins?: Readonly<Record<string, number>>;
readonly unmanagedGithubTeams: readonly string[];
}
interface ManagedGitHubAccessDependencies {
readonly port?: GitHubOrganizationPort;
}
export interface CapturedManagedGitHubAccess {
readonly branch: ManagedGitHubBranch;
readonly desiredByUserId: ReadonlyMap<string, GitHubDesiredOrganizationAccess>;
readonly observedByUserId: ReadonlyMap<string, GitHubObservedOrganizationAccount>;
readonly selectedDesired: GitHubDesiredOrganizationAccess | null;
}
export declare function captureManagedGitHubAccess(users: readonly GoogleDirectoryUser[], google: GoogleAuthoritySnapshot, github: GitHubAccessSnapshot, rawConfig: ManagedGitHubAccessConfig, policy: ManagedGitHubAccessPolicy, dependencies?: ManagedGitHubAccessDependencies): Promise<ManagedGitHubBranch>;
export declare function captureManagedGitHubAuthorityFingerprint(users: readonly GoogleDirectoryUser[], google: GoogleAuthoritySnapshot, rawConfig: ManagedGitHubAccessConfig, policy: ManagedGitHubAccessPolicy): Promise<string>;
export declare function captureManagedGitHubAccessState(users: readonly GoogleDirectoryUser[], google: GoogleAuthoritySnapshot, github: GitHubAccessSnapshot, rawConfig: ManagedGitHubAccessConfig, policy: ManagedGitHubAccessPolicy, dependencies?: ManagedGitHubAccessDependencies): Promise<CapturedManagedGitHubAccess>;
export declare function fingerprintManagedGitHubTeamAccess(github: GitHubAccessSnapshot, managedTeamSlugs: readonly string[]): Promise<string>;
export interface ManagedGitHubSourceAuthority {
readonly google: GoogleAuthoritySnapshot;
readonly policy: ManagedGitHubAccessPolicy;
readonly rootGroupEmail: string;
}
export declare function sameManagedGitHubSelection(current: ManagedGitHubBranch["selectedOperation"], expected: ManagedGitHubBranch["selectedOperation"]): boolean;
export declare function refreshManagedGitHubDesiredAuthority(branch: ManagedGitHubBranch, googleUserId: string, assertGoogleAuthority: () => Promise<readonly GoogleDirectoryUser[]>, captureState: (users: readonly GoogleDirectoryUser[]) => Promise<CapturedManagedGitHubAccess>, captureSource: () => Promise<ManagedGitHubSourceAuthority>): Promise<GitHubDesiredOrganizationAccess>;
export declare function applyManagedGitHubAccess(branch: ManagedGitHubBranch, port: GitHubOrganizationPort, currentDesired: GitHubDesiredOrganizationAccess | null, refreshDesired: GitHubDesiredAuthorityRefresh, identityBudget?: IdentityWriteBudget, writeContext?: GitHubOrganizationWriteContext): Promise<string>;
export declare function readManagedGitHubTargetSlice(branch: ManagedGitHubBranch, port: GitHubOrganizationPort, desiredByUserId: CapturedManagedGitHubAccess["desiredByUserId"]): Promise<JsonValue>;
export declare function githubAccessBeforeSlice(branch: ManagedGitHubBranch): JsonValue;
export declare function githubAccessAfterSlice(branch: ManagedGitHubBranch): JsonValue;
export {};