Skip to content
Sarj Workspace Sync

identity-sync/github-inactive-identity-attestation

@sarj-ai/workspace-sync/identity-sync/github-inactive-identity-attestation ยท Source

import { z } from "zod";
import { type SarjIdentitySchemaService } from "../org-sync/google-identity-schema.ts";
import { type GitHubIdentityAdminAttestationPlan, type GitHubIdentityResolver, type GoogleIdentityAttestationDirectory } from "./github-identity-admin-attestation.ts";
import type { GoogleIdentityMaintenanceFence } from "./google-identity-maintenance-fence-error.ts";
export declare const InactiveGitHubAttestationRequestSchema: z.ZodObject<{
schemaVersion: z.ZodLiteral<"github-inactive-identity-attestation/v1">;
googleUserId: z.core.$ZodBranded<z.ZodString, "GoogleUserId", "out">;
primaryEmail: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodEmail>, "PrimaryEmail", "out">;
lifecycle: z.ZodObject<{
suspended: z.ZodBoolean;
archived: z.ZodBoolean;
}, z.core.$strict>;
githubIdentity: 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>;
declare const UserSchema: z.ZodObject<{
customSchemas: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
deletionTime: z.ZodOptional<z.ZodISODateTime>;
etag: z.ZodString;
id: z.core.$ZodBranded<z.ZodString, "GoogleUserId", "out">;
primaryEmail: z.ZodEmail;
suspended: z.ZodBoolean;
archived: z.ZodBoolean;
isAdmin: z.ZodBoolean;
isDelegatedAdmin: z.ZodBoolean;
aliases: z.ZodOptional<z.ZodArray<z.ZodEmail>>;
nonEditableAliases: z.ZodOptional<z.ZodArray<z.ZodEmail>>;
}, z.core.$strip>;
export declare const InactiveGitHubAttestationPlanSchema: z.ZodObject<{
request: z.ZodObject<{
schemaVersion: z.ZodLiteral<"github-inactive-identity-attestation/v1">;
googleUserId: z.core.$ZodBranded<z.ZodString, "GoogleUserId", "out">;
primaryEmail: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodEmail>, "PrimaryEmail", "out">;
lifecycle: z.ZodObject<{
suspended: z.ZodBoolean;
archived: z.ZodBoolean;
}, z.core.$strict>;
githubIdentity: 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>;
before: z.ZodObject<{
customSchemas: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
deletionTime: z.ZodOptional<z.ZodISODateTime>;
etag: z.ZodString;
id: z.core.$ZodBranded<z.ZodString, "GoogleUserId", "out">;
primaryEmail: z.ZodEmail;
suspended: z.ZodBoolean;
archived: z.ZodBoolean;
isAdmin: z.ZodBoolean;
isDelegatedAdmin: z.ZodBoolean;
aliases: z.ZodOptional<z.ZodArray<z.ZodEmail>>;
nonEditableAliases: z.ZodOptional<z.ZodArray<z.ZodEmail>>;
}, z.core.$strip>;
attestation: z.ZodReadonly<z.ZodObject<{
entries: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
attestation: z.ZodReadonly<z.ZodObject<{
githubLogin: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "GitHubLogin", "out">;
subject: z.ZodDiscriminatedUnion<[z.ZodObject<{
googleUserId: z.core.$ZodBranded<z.ZodString, "GoogleUserId", "out">;
kind: z.ZodLiteral<"google-user-id">;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"primary-email">;
primaryEmail: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodEmail>, "PrimaryEmail", "out">;
}, z.core.$strict>], "kind">;
attestedAt: z.ZodISODateTime;
attestedBy: z.core.$ZodBranded<z.ZodString, "AdminActorId", "out">;
}, z.core.$strict>>;
googlePlan: z.ZodUnion<readonly [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>]>;
target: 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>>>>;
planHash: z.ZodString;
schemaVersion: z.ZodLiteral<"github-identity-admin-attestation-plan/v1">;
}, z.core.$strict>>;
}, z.core.$strict>;
type Request = z.output<typeof InactiveGitHubAttestationRequestSchema>;
type Plan = z.output<typeof InactiveGitHubAttestationPlanSchema>;
type User = z.output<typeof UserSchema>;
interface Context {
actorId: string;
attestedAt: string;
}
interface Ports {
github: GitHubIdentityResolver;
google: Omit<GoogleIdentityAttestationDirectory, "listIdentityUsers"> & {
listIdentityUsers(deadlineAtMs?: number): Promise<readonly unknown[]>;
};
maintenanceFence: GoogleIdentityMaintenanceFence<GitHubIdentityAdminAttestationPlan>;
now?: () => number;
schema: Pick<SarjIdentitySchemaService, "plan">;
}
export interface IInactiveGitHubIdentityAttestationService {
apply(raw: unknown): Promise<void>;
plan(raw: unknown, context: Context): Promise<Plan>;
read(raw: unknown): Promise<User>;
}
export declare class InactiveGitHubIdentityAttestationService implements IInactiveGitHubIdentityAttestationService {
#private;
constructor(ports: Ports);
plan(raw: unknown, context: Context): Promise<Plan>;
read(raw: unknown): Promise<User>;
apply(raw: unknown): Promise<void>;
}
export declare function afterSchemas(user: Pick<User, "customSchemas">, request: Request): {
SarjIdentity: {
githubLogin: string & z.$brand<"GitHubLogin">;
githubUserId: string & z.$brand<"GitHubUserId">;
};
};
export declare function inactiveIdentitySlice(user: User): {
googleUserId: string & z.$brand<"GoogleUserId">;
primaryEmail: string;
lifecycle: {
suspended: boolean;
archived: boolean;
};
customSchemas: Record<string, Record<string, z.JSONType>>;
};
export {};