import { R as ResolvedConfig, Z as ZpiClientOptions } from './config-DRP0L5Vm.js'; export { Z as ZpiAbortError, a as ZpiAuthError, b as ZpiBulkCapError, c as ZpiBulkNotEnabledError, d as ZpiDisabledError, e as ZpiError, f as ZpiExecError, g as ZpiIdempotencyError, h as ZpiInvalidParamsError, i as ZpiMethodNotAllowedError, j as ZpiNetworkError, k as ZpiNotFoundError, l as ZpiPlanGateError, m as ZpiRateLimitError, n as ZpiServerError, o as ZpiTimeoutError } from './errors-DdzqYqxK.js'; interface RunOpts { method?: "GET" | "POST"; signal?: AbortSignal; timeoutMs?: number; idempotencyKey?: string; headers?: Record; pathRest?: string; /** * Max age in seconds you will accept for a cached result. Only ever asks for * something FRESHER than the endpoint's own cache lifetime, never staler. * A paid capability: the server clamps it to your plan's floor and the * endpoint's lifetime, and rejects it with ZpiPlanGateError on plans without * one. `0` means always fetch fresh. */ ttl?: number; } interface ScraperMap { } type UntypedResult = any; type ScraperResult = K extends keyof ScraperMap ? E extends keyof ScraperMap[K] ? ScraperMap[K][E] extends { result: infer R; } ? R : UntypedResult : UntypedResult : UntypedResult; type ScraperParams = K extends keyof ScraperMap ? E extends keyof ScraperMap[K] ? ScraperMap[K][E] extends { params: infer P; } ? P : Record : Record : Record; interface SseEvent { event?: string; data: string; id?: string; } interface StreamOpts { method?: "GET" | "POST"; signal?: AbortSignal; timeoutMs?: number; headers?: Record; pathRest?: string; } type StreamEvent = SseEvent | string; interface SchemaField { name: string; type: string; required: boolean; description?: string; default?: unknown; example?: unknown; enumValues?: unknown[]; in?: string; } interface EndpointSchema { fields: SchemaField[]; } interface CatalogListItem { id: string; slug: string; category: string; displayName: string; description: string | null; tags: string[]; iconUrl: string | null; endpointCount: number; totalRequests: number; maxCacheTtl: number; minPlan: string | null; hasBulk: boolean; hasGatedEndpoint: boolean; } interface CatalogList { items: CatalogListItem[]; nextCursor: string | null; total: number; } interface ScraperEndpoint { id: string; slug: string; displayName: string | null; description: string | null; method: string; paramsSchema: unknown; cacheTtl: number | null; pathTemplate: string | null; exampleResponse: unknown; requestCount: number | null; lastRequestAt: string | null; enabled: boolean; minPlan: string | null; bulkEnabled: boolean; } interface ScraperDetail { id: string; slug: string; category: string; displayName: string; description: string | null; tags: string[]; iconUrl: string | null; iconUrlPng: string | null; enabled: boolean; minPlan: string | null; createdAt?: string; updatedAt?: string; endpoints: ScraperEndpoint[]; } interface Category { slug: string; displayName: string; iconUrl: string | null; color: string | null; description: string | null; } interface CatalogListOpts { q?: string; cat?: string; cursor?: string; limit?: number; } interface Catalog { list(opts?: CatalogListOpts): Promise; get(slug: string): Promise; categories(): Promise; schema(slug: string, endpoint: string): Promise; stats(slug: string): Promise<{ requests: number; successRate: number; }>; } type BulkJobStatus = "QUEUED" | "RUNNING" | "COMPLETED" | "FAILED" | "CANCELLED"; type BulkItemStatus = "QUEUED" | "RUNNING" | "SUCCEEDED" | "FAILED"; interface BulkItem { url?: string; params?: Record; [key: string]: unknown; } interface BulkItemResult { url?: string; params?: Record; status: BulkItemStatus; data?: unknown; error?: unknown; latencyMs?: number; } interface BulkJobData { jobId: string; status: BulkJobStatus; total: number; succeeded?: number; failed?: number; scraperSlug?: string; endpointSlug?: string; createdAt?: string; startedAt?: string; completedAt?: string; pollUrl?: string; items?: BulkItemResult[]; } interface BulkSubmitOpts { idempotencyKey?: string; signal?: AbortSignal; timeoutMs?: number; headers?: Record; } interface BulkWaitOpts { signal?: AbortSignal; timeoutMs?: number; pollIntervalMs?: number; onProgress?: (job: BulkJobData) => void; } declare class BulkJob { readonly jobId: string; readonly pollUrl?: string; readonly status?: BulkJobStatus; readonly total?: number; private readonly config; constructor(config: ResolvedConfig, body: Record); wait(opts?: BulkWaitOpts): Promise; } interface Bulk { submit(projectKey: string, endpoint: string, items: BulkItem[], opts?: BulkSubmitOpts): Promise; status(jobId: string, opts?: { signal?: AbortSignal; timeoutMs?: number; }): Promise; } declare class ZpiClient { #private; readonly catalog: Catalog; readonly bulk: Bulk; constructor(options: ZpiClientOptions); useMethods(methods: Record>): this; run>(projectKey: K, endpoint: E, params?: ScraperParams, opts?: RunOpts): Promise; stream(projectKey: K, endpoint: E, params?: ScraperParams, opts?: StreamOpts): AsyncIterable; toJSON(): Record; } declare const VERSION: "0.6.0"; export { type Bulk, type BulkItem, type BulkItemResult, type BulkItemStatus, BulkJob, type BulkJobData, type BulkJobStatus, type BulkSubmitOpts, type BulkWaitOpts, type Catalog, type CatalogList, type CatalogListItem, type CatalogListOpts, type Category, type EndpointSchema, type RunOpts, type SchemaField, type ScraperDetail, type ScraperEndpoint, type ScraperMap, type ScraperParams, type ScraperResult, type SseEvent, type StreamEvent, type StreamOpts, VERSION, ZpiClient, ZpiClientOptions };