/** * SearchApi.io Quota Capability. * * Maps the SearchApi.io `GET /api/v1/me` response into the normalized * Provider-quota interface. SearchApi is credit-based: `account` * carries the current-month usage, the monthly allowance, and the * remaining credits. The single "searches" category (unit `"credits"`) * is built from `used = current_month_usage` and * `limit = monthly_allowance`, with `resetsAt` derived from * `subscription.period_end` when it parses. `remaining_credits` is * required by the wire contract but is not re-published verbatim — * `buildQuotaWindow` derives the honest `remaining` from the counts. * * Structurally cloned from the Linkup quota pattern (non-destructive * GET, IMPLEMENTATION-CONTRACT analog-adapter table): one direct GET * per invoke, shared execution owns retry policy, quota never uses the * response cache. * * Boundary rules (ARCHITECTURE.md §2): * - May import the quota capability contract, Adapter-local * credentials, Adapter-local quota transport, and normalized * errors. * - Must NOT import command presentation or another Provider's * Adapter. */ import type { ProviderQuotaSuccess, QuotaCapability } from "../../capabilities/quota.js"; import { type SearchApiTransportDeps } from "./client.js"; /** * Normalize a raw SearchApi.io `/api/v1/me` payload into the shared * quota interface. * * The `account` object must carry finite `current_month_usage`, * `monthly_allowance`, and `remaining_credits`; a missing/non-object * root or account, or any non-finite count, is a malformed response and * throws `ApiError` 500. On success a single `"searches"` category * (`unit: "credits"`) is built through * `buildQuotaWindow({ used, limit, resetsAtEpochMs })`, where * `resetsAtEpochMs` is `parseZonedInstant(subscription.period_end)` when * that parses (a zone-less form is anchored to UTC) and is omitted * otherwise. */ export declare function normalizeSearchApiQuota(raw: unknown): ProviderQuotaSuccess; /** * Options for the SearchApi.io QuotaCapability. The API key is resolved * from `env`; transport dependencies (`fetch`, timers) are injectable * for deterministic tests through the unified `transport` seam. */ export interface SearchApiQuotaCapabilityOptions { readonly env: NodeJS.ProcessEnv; readonly transport?: SearchApiTransportDeps; } /** * Build the SearchApi.io QuotaCapability. `invoke` resolves the API key, * performs one non-destructive GET against `/api/v1/me` (not a search — * costs no credit), and normalizes the account counts into the shared * interface. Shared execution wraps this in the retry policy; quota * never uses the response cache. */ export declare function createSearchApiQuotaCapability(options: SearchApiQuotaCapabilityOptions): QuotaCapability; //# sourceMappingURL=quota.d.ts.map