Skip to content
Sarj Workspace Sync

access-guard/model

@sarj-ai/workspace-sync/access-guard/model ยท Source

import { z } from "zod";
export declare const GoogleAccessUserSchema: z.ZodObject<{
aliases: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodEmail>>>;
archived: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
customSchemas: z.ZodOptional<z.ZodObject<{
SarjIdentity: z.ZodOptional<z.ZodObject<{
githubLogin: z.ZodOptional<z.ZodString>;
githubUserId: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>;
}, z.core.$strip>>;
deletionTime: z.ZodOptional<z.ZodISODateTime>;
id: z.ZodString;
isAdmin: z.ZodOptional<z.ZodBoolean>;
isDelegatedAdmin: z.ZodOptional<z.ZodBoolean>;
name: z.ZodOptional<z.ZodObject<{
fullName: z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>;
}, z.core.$strip>>;
nonEditableAliases: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodEmail>>>;
organizations: z.ZodDefault<z.ZodArray<z.ZodObject<{
department: z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>;
primary: z.ZodOptional<z.ZodBoolean>;
title: z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>;
}, z.core.$strip>>>;
primaryEmail: z.ZodPipe<z.ZodString, z.ZodEmail>;
relations: z.ZodDefault<z.ZodArray<z.ZodObject<{
type: z.ZodString;
value: z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>;
}, z.core.$strip>>>;
suspended: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
}, z.core.$strip>;
export type GoogleAccessUser = z.output<typeof GoogleAccessUserSchema>;
export declare const DownstreamAccountSchema: z.ZodObject<{
active: z.ZodBoolean;
admin: z.ZodOptional<z.ZodBoolean>;
app: z.ZodOptional<z.ZodBoolean>;
displayName: z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>;
email: z.ZodPipe<z.ZodString, z.ZodEmail>;
id: z.ZodString;
owner: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>;
export type DownstreamAccount = z.output<typeof DownstreamAccountSchema>;
export declare const GitHubAccessAccountSchema: z.ZodObject<{
access: z.ZodEnum<{
member: "member";
outside_collaborator: "outside_collaborator";
}>;
active: z.ZodLiteral<true>;
id: z.core.$ZodBranded<z.ZodString, "GitHubUserId", "out">;
login: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "GitHubLogin", "out">;
type: z.ZodEnum<{
Bot: "Bot";
User: "User";
}>;
}, z.core.$strict>;
export type GitHubAccessAccount = z.output<typeof GitHubAccessAccountSchema>;
export declare const GitHubAccessInvitationSchema: z.ZodObject<{
email: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodEmail>>>;
id: z.ZodNumber;
login: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "GitHubLogin", "out">>>;
invitee: z.ZodOptional<z.ZodNullable<z.ZodObject<{
id: z.core.$ZodBranded<z.ZodString, "GitHubUserId", "out">;
login: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "GitHubLogin", "out">;
type: z.ZodEnum<{
Bot: "Bot";
User: "User";
}>;
}, z.core.$strict>>>;
role: z.ZodEnum<{
admin: "admin";
billing_manager: "billing_manager";
direct_member: "direct_member";
}>;
}, z.core.$strict>;
export type GitHubAccessInvitation = z.output<typeof GitHubAccessInvitationSchema>;
export declare const GitHubAccessReadSchema: z.ZodObject<{
accounts: z.ZodArray<z.ZodObject<{
access: z.ZodEnum<{
member: "member";
outside_collaborator: "outside_collaborator";
}>;
active: z.ZodLiteral<true>;
id: z.core.$ZodBranded<z.ZodString, "GitHubUserId", "out">;
login: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "GitHubLogin", "out">;
type: z.ZodEnum<{
Bot: "Bot";
User: "User";
}>;
}, z.core.$strict>>;
invitations: z.ZodArray<z.ZodObject<{
email: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodEmail>>>;
id: z.ZodNumber;
login: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "GitHubLogin", "out">>>;
invitee: z.ZodOptional<z.ZodNullable<z.ZodObject<{
id: z.core.$ZodBranded<z.ZodString, "GitHubUserId", "out">;
login: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "GitHubLogin", "out">;
type: z.ZodEnum<{
Bot: "Bot";
User: "User";
}>;
}, z.core.$strict>>>;
role: z.ZodEnum<{
admin: "admin";
billing_manager: "billing_manager";
direct_member: "direct_member";
}>;
}, z.core.$strict>>;
}, z.core.$strict>;
export type GitHubAccessRead = z.output<typeof GitHubAccessReadSchema>;
export declare const ProviderNameSchema: z.ZodEnum<{
ashby: "ashby";
attio: "attio";
github: "github";
linear: "linear";
pagerduty: "pagerduty";
slack: "slack";
}>;
export type ProviderName = z.output<typeof ProviderNameSchema>;
export declare const EmailProviderNameSchema: z.ZodEnum<{
ashby: "ashby";
attio: "attio";
linear: "linear";
pagerduty: "pagerduty";
slack: "slack";
}>;
export type EmailProviderName = z.output<typeof EmailProviderNameSchema>;
export declare const ProviderSnapshotSchema: z.ZodUnion<readonly [z.ZodObject<{
accounts: z.ZodArray<z.ZodObject<{
active: z.ZodBoolean;
admin: z.ZodOptional<z.ZodBoolean>;
app: z.ZodOptional<z.ZodBoolean>;
displayName: z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>;
email: z.ZodPipe<z.ZodString, z.ZodEmail>;
id: z.ZodString;
owner: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>>;
ok: z.ZodLiteral<true>;
provider: z.ZodEnum<{
ashby: "ashby";
attio: "attio";
linear: "linear";
pagerduty: "pagerduty";
slack: "slack";
}>;
}, z.core.$strip>, z.ZodObject<{
accounts: z.ZodArray<z.ZodObject<{
access: z.ZodEnum<{
member: "member";
outside_collaborator: "outside_collaborator";
}>;
active: z.ZodLiteral<true>;
id: z.core.$ZodBranded<z.ZodString, "GitHubUserId", "out">;
login: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "GitHubLogin", "out">;
type: z.ZodEnum<{
Bot: "Bot";
User: "User";
}>;
}, z.core.$strict>>;
invitations: z.ZodArray<z.ZodObject<{
email: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodEmail>>>;
id: z.ZodNumber;
login: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "GitHubLogin", "out">>>;
invitee: z.ZodOptional<z.ZodNullable<z.ZodObject<{
id: z.core.$ZodBranded<z.ZodString, "GitHubUserId", "out">;
login: z.core.$ZodBranded<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, "GitHubLogin", "out">;
type: z.ZodEnum<{
Bot: "Bot";
User: "User";
}>;
}, z.core.$strict>>>;
role: z.ZodEnum<{
admin: "admin";
billing_manager: "billing_manager";
direct_member: "direct_member";
}>;
}, z.core.$strict>>;
ok: z.ZodLiteral<true>;
provider: z.ZodLiteral<"github">;
}, z.core.$strip>, z.ZodObject<{
ok: z.ZodLiteral<false>;
provider: z.ZodLiteral<"linear">;
readiness: z.ZodObject<{
error_code: z.ZodEnum<{
linear_organization_id_mismatch: "linear_organization_id_mismatch";
linear_organization_id_unpinned: "linear_organization_id_unpinned";
linear_organization_url_key_mismatch: "linear_organization_url_key_mismatch";
}>;
kind: z.ZodLiteral<"linear_tenant">;
observed_organization_id: z.ZodUUID;
observed_url_key: z.ZodString;
}, z.core.$strict>;
}, z.core.$strict>, z.ZodObject<{
errorCode: z.ZodString;
ok: z.ZodLiteral<false>;
provider: z.ZodEnum<{
ashby: "ashby";
attio: "attio";
github: "github";
linear: "linear";
pagerduty: "pagerduty";
slack: "slack";
}>;
}, z.core.$strict>]>;
export type ProviderSnapshot = z.output<typeof ProviderSnapshotSchema>;
export declare const AccessGuardConfigSchema: z.ZodObject<{
allowedEmptyDepartmentGoogleUserIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
allowedEmptyManagerGoogleUserIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
excludedGoogleUserIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
protectedDepartedGoogleUserIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
maxReviewedLinearSuspensions: z.ZodDefault<z.ZodNumber>;
minimumGoogleUsers: z.ZodDefault<z.ZodNumber>;
minimumProviderAccounts: z.ZodDefault<z.ZodRecord<z.ZodEnum<{
ashby: "ashby";
attio: "attio";
github: "github";
linear: "linear";
pagerduty: "pagerduty";
slack: "slack";
}> & z.core.$partial, z.ZodNumber>>;
requiredProviders: z.ZodArray<z.ZodEnum<{
ashby: "ashby";
attio: "attio";
github: "github";
linear: "linear";
pagerduty: "pagerduty";
slack: "slack";
}>>;
rootGoogleUserIds: z.ZodArray<z.ZodString>;
}, z.core.$strip>;
export type AccessGuardConfig = z.output<typeof AccessGuardConfigSchema>;
export declare const AccessIssueSchema: z.ZodObject<{
details: z.ZodRecord<z.ZodString, z.ZodString>;
googleUserId: z.ZodOptional<z.ZodString>;
id: z.ZodString;
kind: z.ZodEnum<{
active_downstream_for_inactive_google: "active_downstream_for_inactive_google";
active_downstream_without_google: "active_downstream_without_google";
coverage_failure: "coverage_failure";
missing_google_org_metadata: "missing_google_org_metadata";
}>;
provider: z.ZodOptional<z.ZodEnum<{
ashby: "ashby";
attio: "attio";
github: "github";
linear: "linear";
pagerduty: "pagerduty";
slack: "slack";
}>>;
summary: z.ZodString;
}, z.core.$strip>;
export type AccessIssue = z.output<typeof AccessIssueSchema>;
export declare const AccessDiagnosticSchema: z.ZodUnion<readonly [z.ZodObject<{
code: z.ZodLiteral<"provider_readiness">;
context: z.ZodObject<{
error_code: z.ZodEnum<{
linear_organization_id_mismatch: "linear_organization_id_mismatch";
linear_organization_id_unpinned: "linear_organization_id_unpinned";
linear_organization_url_key_mismatch: "linear_organization_url_key_mismatch";
}>;
kind: z.ZodLiteral<"linear_tenant">;
observed_organization_id: z.ZodUUID;
observed_url_key: z.ZodString;
}, z.core.$strict>;
level: z.ZodLiteral<"error">;
message: z.ZodString;
provider: z.ZodLiteral<"linear">;
}, z.core.$strict>, z.ZodObject<{
code: z.ZodEnum<{
ambiguous_github_identity: "ambiguous_github_identity";
ambiguous_google_email: "ambiguous_google_email";
ambiguous_provider_email: "ambiguous_provider_email";
conflicting_github_identity: "conflicting_github_identity";
invalid_google_github_identity: "invalid_google_github_identity";
invalid_google_org_shape: "invalid_google_org_shape";
pending_provider_invitation: "pending_provider_invitation";
protected_linear_account: "protected_linear_account";
provider_error: "provider_error";
unmatched_provider_account: "unmatched_provider_account";
}>;
context: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
level: z.ZodEnum<{
error: "error";
warning: "warning";
}>;
message: z.ZodString;
provider: z.ZodOptional<z.ZodEnum<{
ashby: "ashby";
attio: "attio";
github: "github";
linear: "linear";
pagerduty: "pagerduty";
slack: "slack";
}>>;
}, z.core.$strip>]>;
export type AccessDiagnostic = z.output<typeof AccessDiagnosticSchema>;
export declare const AccessGuardPlanSchema: z.ZodObject<{
actions: z.ZodArray<z.ZodObject<{
accountId: z.ZodString;
email: z.ZodPipe<z.ZodString, z.ZodEmail>;
googleUserId: z.ZodString;
provider: z.ZodLiteral<"linear">;
type: z.ZodLiteral<"suspend">;
}, z.core.$strip>>;
diagnostics: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
code: z.ZodLiteral<"provider_readiness">;
context: z.ZodObject<{
error_code: z.ZodEnum<{
linear_organization_id_mismatch: "linear_organization_id_mismatch";
linear_organization_id_unpinned: "linear_organization_id_unpinned";
linear_organization_url_key_mismatch: "linear_organization_url_key_mismatch";
}>;
kind: z.ZodLiteral<"linear_tenant">;
observed_organization_id: z.ZodUUID;
observed_url_key: z.ZodString;
}, z.core.$strict>;
level: z.ZodLiteral<"error">;
message: z.ZodString;
provider: z.ZodLiteral<"linear">;
}, z.core.$strict>, z.ZodObject<{
code: z.ZodEnum<{
ambiguous_github_identity: "ambiguous_github_identity";
ambiguous_google_email: "ambiguous_google_email";
ambiguous_provider_email: "ambiguous_provider_email";
conflicting_github_identity: "conflicting_github_identity";
invalid_google_github_identity: "invalid_google_github_identity";
invalid_google_org_shape: "invalid_google_org_shape";
pending_provider_invitation: "pending_provider_invitation";
protected_linear_account: "protected_linear_account";
provider_error: "provider_error";
unmatched_provider_account: "unmatched_provider_account";
}>;
context: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
level: z.ZodEnum<{
error: "error";
warning: "warning";
}>;
message: z.ZodString;
provider: z.ZodOptional<z.ZodEnum<{
ashby: "ashby";
attio: "attio";
github: "github";
linear: "linear";
pagerduty: "pagerduty";
slack: "slack";
}>>;
}, z.core.$strip>]>>;
issues: z.ZodArray<z.ZodObject<{
details: z.ZodRecord<z.ZodString, z.ZodString>;
googleUserId: z.ZodOptional<z.ZodString>;
id: z.ZodString;
kind: z.ZodEnum<{
active_downstream_for_inactive_google: "active_downstream_for_inactive_google";
active_downstream_without_google: "active_downstream_without_google";
coverage_failure: "coverage_failure";
missing_google_org_metadata: "missing_google_org_metadata";
}>;
provider: z.ZodOptional<z.ZodEnum<{
ashby: "ashby";
attio: "attio";
github: "github";
linear: "linear";
pagerduty: "pagerduty";
slack: "slack";
}>>;
summary: z.ZodString;
}, z.core.$strip>>;
stats: z.ZodObject<{
activeGooglePeople: z.ZodNumber;
googleUsers: z.ZodNumber;
providerAccounts: z.ZodRecord<z.ZodEnum<{
ashby: "ashby";
attio: "attio";
github: "github";
linear: "linear";
pagerduty: "pagerduty";
slack: "slack";
}> & z.core.$partial, z.ZodNumber>;
inactiveGoogleUsers: z.ZodNumber;
}, z.core.$strip>;
}, z.core.$strip>;
export type AccessGuardPlan = z.output<typeof AccessGuardPlanSchema>;
export interface AccessGuardAuditOptions {
linearSuspensionTarget?: Pick<AccessGuardPlan["actions"][number], "accountId" | "email" | "googleUserId">;
scheduledLinearSuspension?: true;
}
export declare const LinearAccessManagedSliceSchema: z.ZodArray<z.ZodObject<{
accountId: z.ZodString;
active: z.ZodBoolean;
email: z.ZodPipe<z.ZodString, z.ZodEmail>;
}, z.core.$strict>>;
export type LinearAccessManagedSlice = z.output<typeof LinearAccessManagedSliceSchema>;
export { normalizeIdentityEmail as normalizeEmail } from "../identity-sync/normalize-identity-email.ts";