Skip to content
Sarj Workspace Sync

workspace-directory/pagerduty-team-client

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

import { z } from "zod";
import { type PagerDutyLicensingSnapshot } from "./pagerduty-readiness-contracts.ts";
import { PagerDutyTeamRoleSchema } from "./pagerduty-team-config.ts";
export declare const PagerDutyTeamSnapshotSchema: z.ZodReadonly<z.ZodObject<{
capturedAt: z.ZodISODateTime;
memberships: z.ZodArray<z.ZodObject<{
role: z.ZodEnum<{
manager: "manager";
observer: "observer";
responder: "responder";
}>;
teamId: z.ZodString;
userId: z.ZodString;
}, z.core.$strict>>;
teams: z.ZodArray<z.ZodObject<{
id: z.ZodString;
name: z.ZodString;
}, z.core.$strip>>;
users: z.ZodArray<z.ZodObject<{
email: z.ZodEmail;
id: z.ZodString;
name: z.ZodString;
role: z.ZodString;
}, z.core.$strip>>;
}, z.core.$strict>>;
export type PagerDutyTeamSnapshot = z.output<typeof PagerDutyTeamSnapshotSchema>;
export interface IPagerDutyTeamReader {
snapshot(teamIds: readonly string[]): Promise<PagerDutyTeamSnapshot>;
}
export interface IPagerDutyLicenseReader {
licensing(): Promise<PagerDutyLicensingSnapshot>;
}
export interface IPagerDutyTeamClient extends IPagerDutyTeamReader {
getTeamMembership(teamId: string, userId: string): Promise<{
role: z.output<typeof PagerDutyTeamRoleSchema>;
} | null>;
putTeamMembership(teamId: string, userId: string, role: z.output<typeof PagerDutyTeamRoleSchema>, assertFinalWriteAuthority?: () => Promise<void>): Promise<void>;
}
interface PagerDutyTeamReaderOptions {
fetchImpl?: typeof fetch;
maxPages?: number;
maxRequests?: number;
requestTimeoutMs?: number;
token: string;
}
export declare class PagerDutyTeamReader implements IPagerDutyTeamClient, IPagerDutyLicenseReader {
#private;
constructor(options: PagerDutyTeamReaderOptions);
licensing(): Promise<PagerDutyLicensingSnapshot>;
snapshot(rawTeamIds: readonly string[]): Promise<PagerDutyTeamSnapshot>;
getTeamMembership(rawTeamId: string, rawUserId: string): Promise<{
role: z.output<typeof PagerDutyTeamRoleSchema>;
} | null>;
putTeamMembership(rawTeamId: string, rawUserId: string, rawRole: z.output<typeof PagerDutyTeamRoleSchema>, assertFinalWriteAuthority?: () => Promise<void>): Promise<void>;
}
export declare class PagerDutyTeamRequestError extends Error {
readonly status: number;
constructor(status: number, options?: ErrorOptions);
}
export declare class PagerDutyTeamUnexpectedMutationStatusError extends Error {
readonly status: number;
constructor(status: number, options?: ErrorOptions);
}
export {};