import { o as QaseApiConfig, s as QaseError } from "./types-DrbHZLQ2.js"; import * as z from "zod"; //#region src/qase/client.d.ts /** * Validate a `QASE_BASE_URL`-style override. Returns true only for HTTPS * URLs whose hostname matches the allowlist exactly; rejects IPs, * localhost, and unknown hosts to keep the API token from being * exfiltrated to a hostile endpoint. */ declare function isValidQaseBaseUrl(baseUrl: string): boolean; /** * Parse a `Retry-After` response header. RFC 9110 allows two forms: * - delta-seconds (decimal integer, e.g. `"30"`) * - HTTP-date (e.g. `"Fri, 31 Dec 1999 23:59:59 GMT"`) * Returns milliseconds to wait. Falls back to 5_000 when the header is * missing, malformed, or expresses a past time. Callers can pass `Date.now` * for time injection in tests. */ declare function parseRetryAfter(header: string | null | undefined, now?: () => number): number; declare class QaseApiClient { private readonly baseUrl; private readonly token; private readonly defaultProject?; constructor(config: QaseApiConfig); private request; get(path: string, schema: z.ZodType, params?: Record): Promise; post(path: string, schema: z.ZodType, body?: unknown): Promise; patch(path: string, schema: z.ZodType, body?: unknown): Promise; delete(path: string, schema: z.ZodType): Promise; getDefaultProject(): string | undefined; /** * Validate and return a project code, using the configured default if * omitted. Throws when neither is set — callers need a project code to * hit any of the Qase endpoints. */ validateProjectCode(projectCode?: string): string; } declare class QaseApiError extends Error { readonly statusCode: number; readonly response?: (QaseError | unknown) | undefined; constructor(message: string, statusCode: number, response?: (QaseError | unknown) | undefined); isNotFound(): boolean; isUnauthorized(): boolean; isForbidden(): boolean; isBadRequest(): boolean; isUnprocessableEntity(): boolean; } declare class RateLimitError extends Error { readonly retryAfterMs: number; constructor(message: string, retryAfterMs: number); } /** * Retry `fn` with exponential backoff. Rate-limit errors wait * `retryAfterMs`; non-rate-limit 4xx errors bail immediately (caller bug * or auth issue — retrying won't help). */ declare function withRetry(fn: () => Promise, maxRetries?: number, baseDelayMs?: number): Promise; //#endregion export { parseRetryAfter as a, isValidQaseBaseUrl as i, QaseApiError as n, withRetry as o, RateLimitError as r, QaseApiClient as t };