Skip to content
Sarj Workspace Sync

identity-sync/google-github-identity-seed-service

@sarj-ai/workspace-sync/identity-sync/google-github-identity-seed-service ยท Source

import { z } from "zod";
import type { GitHubIdentitySeedSnapshot } from "../github-access-audit/git-hub-access-audit-client.ts";
import type { IdentityWriteBudget } from "../identity-provisioning/identity-budget-contracts.ts";
import { JsonValueSchema } from "../operations/schemas.ts";
import { GoogleGitHubIdentityPlanSchema, type GoogleGithubIdentityPlan, type GoogleWorkspaceIdentityUserGateway } from "../org-sync/google-identity-schema.ts";
import type { GoogleDirectoryUser } from "../org-sync/model.ts";
import type { GoogleIdentityParentContext } from "./google-identity-parent-boundary-schema.ts";
export declare const GoogleGitHubIdentitySeedPlanSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
kind: z.ZodLiteral<"disabled">;
reason: z.ZodString;
}, z.core.$strict>, z.ZodObject<{
issues: z.ZodArray<z.ZodString>;
kind: z.ZodLiteral<"blocked">;
}, z.core.$strict>, z.ZodObject<{
artifact: z.ZodReadonly<z.ZodObject<{
entries: z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
evidence: z.ZodReadonly<z.ZodObject<{
githubLogin: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "GitHubLogin", "out">;
githubUserId: z.core.$ZodBranded<z.ZodString, "GitHubUserId", "out">;
source: z.ZodEnum<{
"github-enterprise-saml": "github-enterprise-saml";
"identity-admin": "identity-admin";
}>;
verifiedAt: z.ZodISODateTime;
}, z.core.$strict>>;
kind: z.ZodLiteral<"exact-match">;
subject: z.ZodReadonly<z.ZodObject<{
displayName: z.ZodString;
googleUserId: z.core.$ZodBranded<z.ZodString, "GoogleUserId", "out">;
primaryEmail: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodEmail>, "PrimaryEmail", "out">;
}, z.core.$strict>>;
target: z.ZodReadonly<z.ZodObject<{
githubLogin: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "GitHubLogin", "out">;
githubUserId: z.core.$ZodBranded<z.ZodString, "GitHubUserId", "out">;
}, z.core.$strict>>;
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
candidates: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
githubLogin: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "GitHubLogin", "out">;
githubUserId: z.core.$ZodBranded<z.ZodString, "GitHubUserId", "out">;
}, z.core.$strict>>>>;
kind: z.ZodLiteral<"unresolved">;
reason: z.ZodEnum<{
"github-member-not-found": "github-member-not-found";
"missing-verified-evidence": "missing-verified-evidence";
"unverified-heuristic": "unverified-heuristic";
}>;
subject: z.ZodReadonly<z.ZodObject<{
displayName: z.ZodString;
googleUserId: z.core.$ZodBranded<z.ZodString, "GoogleUserId", "out">;
primaryEmail: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodEmail>, "PrimaryEmail", "out">;
}, z.core.$strict>>;
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
candidates: z.ZodReadonly<z.ZodTuple<[z.ZodReadonly<z.ZodObject<{
githubLogin: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "GitHubLogin", "out">;
githubUserId: z.core.$ZodBranded<z.ZodString, "GitHubUserId", "out">;
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
githubLogin: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "GitHubLogin", "out">;
githubUserId: z.core.$ZodBranded<z.ZodString, "GitHubUserId", "out">;
}, z.core.$strict>>], z.ZodReadonly<z.ZodObject<{
githubLogin: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "GitHubLogin", "out">;
githubUserId: z.core.$ZodBranded<z.ZodString, "GitHubUserId", "out">;
}, z.core.$strict>>>>;
kind: z.ZodLiteral<"conflict">;
reason: z.ZodEnum<{
"ambiguous-heuristic": "ambiguous-heuristic";
"evidence-id-login-mismatch": "evidence-id-login-mismatch";
}>;
subject: z.ZodReadonly<z.ZodObject<{
displayName: z.ZodString;
googleUserId: z.core.$ZodBranded<z.ZodString, "GoogleUserId", "out">;
primaryEmail: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodEmail>, "PrimaryEmail", "out">;
}, z.core.$strict>>;
}, z.core.$strict>>], "kind">>>;
schemaVersion: z.ZodLiteral<"github-identity-seed-plan/v1">;
sourceRevision: z.ZodString;
summary: z.ZodReadonly<z.ZodObject<{
conflicts: z.ZodNumber;
exactMatches: z.ZodNumber;
unresolved: z.ZodNumber;
}, z.core.$strict>>;
contentHash: z.core.$ZodBranded<z.ZodString, "GitHubIdentitySeedContentHash", "out">;
}, z.core.$strict>>;
githubSourceFingerprint: z.ZodString;
kind: z.ZodLiteral<"managed">;
maxChanges: z.ZodNumber;
maxProviderReads: z.ZodNumber;
userPlans: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
kind: z.ZodLiteral<"blocked">;
reason: z.ZodEnum<{
deleted: "deleted";
inactive: "inactive";
"not-found": "not-found";
}>;
userId: z.core.$ZodBranded<z.ZodString, "GoogleUserId", "out">;
}, z.core.$strict>, z.ZodObject<{
current: z.ZodNullable<z.ZodObject<{
githubLogin: z.ZodOptional<z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "GitHubLogin", "out">>;
githubUserId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "GitHubUserId", "out">>;
}, z.core.$strict>>;
desired: z.ZodObject<{
githubLogin: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "GitHubLogin", "out">;
githubUserId: z.core.$ZodBranded<z.ZodString, "GitHubUserId", "out">;
}, z.core.$strict>;
kind: z.ZodLiteral<"update">;
user: z.ZodObject<{
etag: z.ZodString;
id: z.core.$ZodBranded<z.ZodString, "GoogleUserId", "out">;
primaryEmail: z.ZodEmail;
}, z.core.$strict>;
}, z.core.$strict>, z.ZodObject<{
identity: z.ZodObject<{
githubLogin: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "GitHubLogin", "out">;
githubUserId: z.core.$ZodBranded<z.ZodString, "GitHubUserId", "out">;
}, z.core.$strict>;
kind: z.ZodLiteral<"unchanged">;
user: z.ZodObject<{
etag: z.ZodString;
id: z.core.$ZodBranded<z.ZodString, "GoogleUserId", "out">;
primaryEmail: z.ZodEmail;
}, z.core.$strict>;
}, z.core.$strict>], "kind">>;
}, z.core.$strict>], "kind">;
export type GoogleGithubIdentitySeedPlan = z.output<typeof GoogleGitHubIdentitySeedPlanSchema>;
export interface GoogleGithubIdentitySeedSource {
captureIdentitySeed(): Promise<GitHubIdentitySeedSnapshot>;
}
export interface IGoogleGithubIdentitySeedService {
applyPlan(plan: GoogleGithubIdentitySeedPlan, identityBudget?: IdentityWriteBudget, parentContext?: GoogleIdentityParentContext<GoogleGithubIdentityPlan>): Promise<number>;
capture(users: readonly GoogleDirectoryUser[], googleAuthorityFingerprint: string): Promise<GoogleGithubIdentitySeedPlan>;
readManagedSlice(plan: GoogleGithubIdentitySeedPlan): Promise<ReturnType<typeof JsonValueSchema.parse>>;
}
export interface IGoogleGithubIdentitySeedSourceReader {
captureSource(): Promise<GitHubIdentitySeedSnapshot>;
}
export declare class GoogleGithubIdentitySeedService implements IGoogleGithubIdentitySeedService, IGoogleGithubIdentitySeedSourceReader {
#private;
constructor(input: {
github: GoogleGithubIdentitySeedSource;
google: GoogleWorkspaceIdentityUserGateway;
maxChanges: number;
maxProviderReads?: number;
});
applyPlan(planInput: GoogleGithubIdentitySeedPlan, identityBudget?: IdentityWriteBudget, parentContext?: GoogleIdentityParentContext<GoogleGithubIdentityPlan>): Promise<number>;
capture(users: readonly GoogleDirectoryUser[], googleAuthorityFingerprint: string): Promise<GoogleGithubIdentitySeedPlan>;
captureSource(): Promise<GitHubIdentitySeedSnapshot>;
readManagedSlice(planInput: GoogleGithubIdentitySeedPlan): Promise<z.JSONType>;
}
export declare function fingerprintGithubIdentitySource(snapshot: GitHubIdentitySeedSnapshot): Promise<string>;
export declare function managedSlice(plans: readonly z.output<typeof GoogleGitHubIdentityPlanSchema>[]): z.JSONType;
export declare function desiredManagedSlice(plans: readonly z.output<typeof GoogleGitHubIdentityPlanSchema>[]): z.JSONType;