Skip to content
Sarj Workspace Sync

workspace-directory/sentry-workspace-client

@sarj-ai/workspace-sync/workspace-directory/sentry-workspace-client ยท Source

import { z } from "zod";
import { type Sleep } from "../org-sync/http.ts";
declare const SentryAuthorityFieldPathSchema: z.ZodEnum<{
"actor-detail.email": "actor-detail.email";
"actor-detail.expired": "actor-detail.expired";
"actor-detail.id": "actor-detail.id";
"actor-detail.orgRole": "actor-detail.orgRole";
"actor-detail.pending": "actor-detail.pending";
"actor-detail.role": "actor-detail.role";
"actor-detail.teamRoles": "actor-detail.teamRoles";
"actor-detail.teams": "actor-detail.teams";
"actor-detail.user": "actor-detail.user";
"actor-summary.email": "actor-summary.email";
"actor-summary.expired": "actor-summary.expired";
"actor-summary.id": "actor-summary.id";
"actor-summary.orgRole": "actor-summary.orgRole";
"actor-summary.pending": "actor-summary.pending";
"actor-summary.user": "actor-summary.user";
"auth.auth": "auth.auth";
"auth.user": "auth.user";
"organization.id": "organization.id";
"organization.slug": "organization.slug";
"organization.status": "organization.status";
"output.actor": "output.actor";
"output.organization": "output.organization";
"output.project": "output.project";
"output.team": "output.team";
"project.id": "project.id";
"project.organization": "project.organization";
"project.slug": "project.slug";
"project.status": "project.status";
"project.teams": "project.teams";
"team.hasAccess": "team.hasAccess";
"team.id": "team.id";
"team.organization": "team.organization";
"team.slug": "team.slug";
"team.teamRole": "team.teamRole";
}>;
declare const SentryAuthorityMismatchStageSchema: z.ZodEnum<{
"actor-detail-identity": "actor-detail-identity";
"actor-role": "actor-role";
"actor-state": "actor-state";
"actor-summary-identity": "actor-summary-identity";
"actor-team-role": "actor-team-role";
"organization-status": "organization-status";
"project-status": "project-status";
"project-team-binding": "project-team-binding";
"team-access": "team-access";
"tenant-identity": "tenant-identity";
}>;
type SentryAuthorityMismatchStage = z.output<typeof SentryAuthorityMismatchStageSchema>;
declare const ConfigSchema: z.ZodObject<{
fetchImpl: z.ZodOptional<z.ZodCustom<typeof fetch, typeof fetch>>;
maxPages: z.ZodDefault<z.ZodNumber>;
maxRequests: z.ZodDefault<z.ZodNumber>;
organizationSlug: z.ZodString;
projectSlug: z.ZodString;
readDeadlineMs: z.ZodDefault<z.ZodNumber>;
readMaxAttempts: z.ZodDefault<z.ZodNumber>;
retrySleep: z.ZodOptional<z.ZodCustom<Sleep, Sleep>>;
requestTimeoutMs: z.ZodDefault<z.ZodNumber>;
teamSlug: z.ZodString;
token: z.ZodString;
}, z.core.$strict>;
export declare const SentryOrganizationMemberSchema: z.ZodObject<{
email: z.ZodOptional<z.ZodNullable<z.ZodEmail>>;
expired: z.ZodBoolean;
id: z.ZodString;
orgRole: z.ZodEnum<{
admin: "admin";
billing: "billing";
manager: "manager";
member: "member";
owner: "owner";
}>;
pending: z.ZodBoolean;
user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
email: z.ZodOptional<z.ZodEmail>;
id: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>>;
role: z.ZodEnum<{
admin: "admin";
billing: "billing";
manager: "manager";
member: "member";
owner: "owner";
}>;
teamRoles: z.ZodArray<z.ZodObject<{
role: z.ZodNullable<z.ZodEnum<{
admin: "admin";
contributor: "contributor";
}>>;
teamSlug: z.ZodString;
}, z.core.$strip>>;
teams: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
}, z.core.$strip>;
export declare const SentryTeamMemberSchema: z.ZodObject<{
email: z.ZodOptional<z.ZodNullable<z.ZodEmail>>;
id: z.ZodString;
pending: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
email: z.ZodOptional<z.ZodEmail>;
id: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>>;
}, z.core.$strip>;
export declare const SentryProjectTeamSchema: z.ZodObject<{
id: z.ZodString;
slug: z.ZodString;
}, z.core.$strip>;
export declare const SentryWorkspaceAuthorityBootstrapSchema: z.ZodObject<{
actor: z.ZodObject<{
id: z.ZodString;
orgRole: z.ZodEnum<{
admin: "admin";
billing: "billing";
manager: "manager";
member: "member";
owner: "owner";
}>;
role: z.ZodEnum<{
admin: "admin";
billing: "billing";
manager: "manager";
member: "member";
owner: "owner";
}>;
scopes: z.ZodArray<z.ZodString>;
teamRole: z.ZodNullable<z.ZodEnum<{
admin: "admin";
contributor: "contributor";
}>>;
}, z.core.$strict>;
organization: z.ZodObject<{
id: z.ZodString;
slug: z.ZodString;
}, z.core.$strict>;
project: z.ZodObject<{
id: z.ZodString;
slug: z.ZodString;
}, z.core.$strict>;
mode: z.ZodLiteral<"audit">;
team: z.ZodObject<{
id: z.ZodString;
slug: z.ZodString;
}, z.core.$strict>;
writes: z.ZodLiteral<0>;
}, z.core.$strict>;
export declare const SentryWorkspaceAuthorityBootstrapFailureSchema: z.ZodObject<{
error: z.ZodLiteral<"Sentry authority bootstrap failed">;
fieldPaths: z.ZodArray<z.ZodEnum<{
"actor-detail.email": "actor-detail.email";
"actor-detail.expired": "actor-detail.expired";
"actor-detail.id": "actor-detail.id";
"actor-detail.orgRole": "actor-detail.orgRole";
"actor-detail.pending": "actor-detail.pending";
"actor-detail.role": "actor-detail.role";
"actor-detail.teamRoles": "actor-detail.teamRoles";
"actor-detail.teams": "actor-detail.teams";
"actor-detail.user": "actor-detail.user";
"actor-summary.email": "actor-summary.email";
"actor-summary.expired": "actor-summary.expired";
"actor-summary.id": "actor-summary.id";
"actor-summary.orgRole": "actor-summary.orgRole";
"actor-summary.pending": "actor-summary.pending";
"actor-summary.user": "actor-summary.user";
"auth.auth": "auth.auth";
"auth.user": "auth.user";
"organization.id": "organization.id";
"organization.slug": "organization.slug";
"organization.status": "organization.status";
"output.actor": "output.actor";
"output.organization": "output.organization";
"output.project": "output.project";
"output.team": "output.team";
"project.id": "project.id";
"project.organization": "project.organization";
"project.slug": "project.slug";
"project.status": "project.status";
"project.teams": "project.teams";
"team.hasAccess": "team.hasAccess";
"team.id": "team.id";
"team.organization": "team.organization";
"team.slug": "team.slug";
"team.teamRole": "team.teamRole";
}>>;
mode: z.ZodLiteral<"audit">;
readiness: z.ZodLiteral<"blocked">;
reason: z.ZodEnum<{
"authority-mismatch": "authority-mismatch";
"credential-unconfigured": "credential-unconfigured";
"provider-contract": "provider-contract";
"provider-unavailable": "provider-unavailable";
"unsupported-credential": "unsupported-credential";
}>;
stage: z.ZodOptional<z.ZodEnum<{
"actor-detail-identity": "actor-detail-identity";
"actor-role": "actor-role";
"actor-state": "actor-state";
"actor-summary-identity": "actor-summary-identity";
"actor-team-role": "actor-team-role";
"organization-status": "organization-status";
"project-status": "project-status";
"project-team-binding": "project-team-binding";
"team-access": "team-access";
"tenant-identity": "tenant-identity";
}>>;
writes: z.ZodLiteral<0>;
}, z.core.$strict>;
export type SentryOrganizationMember = z.output<typeof SentryOrganizationMemberSchema>;
export type SentryWorkspaceAuthorityBootstrap = z.output<typeof SentryWorkspaceAuthorityBootstrapSchema>;
export type SentryTeamMember = z.output<typeof SentryTeamMemberSchema>;
export type SentryProjectTeam = z.output<typeof SentryProjectTeamSchema>;
export type SentryWorkspaceClientConfig = z.input<typeof ConfigSchema>;
export interface SentryWorkspaceSnapshot {
readonly organizationMembers: readonly SentryOrganizationMember[];
readonly projectTeams: readonly SentryProjectTeam[];
readonly teamMembers: readonly SentryTeamMember[];
}
export interface ISentryWorkspaceClient {
addTeamMember(memberId: string, assertWriteAuthority?: () => Promise<void>): Promise<void>;
assertCanRegenerateInvite(): Promise<void>;
authorityBootstrap(): Promise<SentryWorkspaceAuthorityBootstrap>;
invite(email: string, assertWriteAuthority?: () => Promise<void>): Promise<void>;
listOrganizationMembers(): Promise<z.output<typeof OrganizationMembersSchema>>;
reinvite(memberId: string, assertWriteAuthority?: () => Promise<void>): Promise<void>;
removeOrganizationMember(memberId: string, assertWriteAuthority: () => Promise<void>): Promise<void>;
snapshot(memberDetailEmails?: readonly string[]): Promise<SentryWorkspaceSnapshot>;
}
declare const OrganizationMembersSchema: z.ZodArray<z.ZodObject<{
email: z.ZodOptional<z.ZodNullable<z.ZodEmail>>;
expired: z.ZodBoolean;
id: z.ZodString;
orgRole: z.ZodEnum<{
admin: "admin";
billing: "billing";
manager: "manager";
member: "member";
owner: "owner";
}>;
pending: z.ZodBoolean;
user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
email: z.ZodOptional<z.ZodEmail>;
id: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>>;
}, z.core.$strip>>;
interface SentryOrganizationInventoryClient {
listOrganizationMembers(): Promise<z.output<typeof OrganizationMembersSchema>>;
}
/** A bounded Sentry adapter. Construction alone never enables provider writes. */
export declare class SentryWorkspaceClient implements ISentryWorkspaceClient, SentryOrganizationInventoryClient {
#private;
constructor(rawConfig: SentryWorkspaceClientConfig);
snapshot(rawMemberDetailEmails?: readonly string[]): Promise<SentryWorkspaceSnapshot>;
listOrganizationMembers(): Promise<{
email?: string | null | undefined;
expired: boolean;
id: string;
orgRole: "admin" | "billing" | "manager" | "member" | "owner";
pending: boolean;
user?: {
email?: string | undefined;
id?: string | undefined;
} | null | undefined;
}[]>;
addTeamMember(memberId: string, assertWriteAuthority?: () => Promise<void>): Promise<void>;
removeOrganizationMember(memberId: string, assertWriteAuthority: () => Promise<void>): Promise<void>;
assertCanRegenerateInvite(): Promise<void>;
authorityBootstrap(): Promise<SentryWorkspaceAuthorityBootstrap>;
invite(email: string, assertWriteAuthority?: () => Promise<void>): Promise<void>;
reinvite(memberId: string, assertWriteAuthority?: () => Promise<void>): Promise<void>;
}
export declare function sentryMemberEmail(member: {
readonly email?: null | string | undefined;
readonly user?: {
readonly email?: string | undefined;
} | null | undefined;
}): null | string;
export declare class SentryWorkspaceBoundExceededError extends Error {
constructor(bound: "member-detail" | "page" | "request", options?: ErrorOptions);
}
export declare class SentryWorkspaceRequestError extends Error {
readonly status: number;
constructor(status: number, options?: ErrorOptions);
}
export declare class SentryWorkspaceUnexpectedMutationStatusError extends Error {
readonly status: number;
constructor(status: number, options?: ErrorOptions);
}
export declare class SentryWorkspaceCapabilityError extends Error {
constructor(capability: "member:admin", options?: ErrorOptions);
}
export declare class SentryWorkspaceAuthorityBootstrapError extends Error {
readonly stage: SentryAuthorityMismatchStage;
constructor(stage: SentryAuthorityMismatchStage, options?: ErrorOptions);
}
export declare class SentryWorkspaceProviderContractError extends Error {
readonly fieldPaths: readonly z.output<typeof SentryAuthorityFieldPathSchema>[];
constructor(fieldPaths: readonly z.output<typeof SentryAuthorityFieldPathSchema>[], options?: ErrorOptions);
}
export declare class SentryWorkspaceUnsupportedCredentialError extends Error {
constructor();
}
export {};