import type { ShortlinksHttpTransport, ShortlinksTransportOverrides } from "./client-types.js"; import type { Env, Store } from "./store-interface.js"; import type { AddDomainInput, Click, ClickInput, CreateLinkInput, Domain, DomainReconciliationResult, ProvisionDomainInput, Link, LinkStats } from "./types.js"; /** * True when the error is the resolver's "nothing configured a credential at * all" refusal — the only hosted-resolution outcome that may fall through to * the local opt-in. Every other refusal (URL set but no key, blank or * disagreeing variables, an unreadable credential file, a failing Keychain * item) is a misconfiguration that MUST surface. * * The check is shape-based (error `name` + message), not `instanceof`: the * published @hasna/contracts package builds `./client` and `./client/storage` * as separate bundles, each carrying its own copy of the error class, so an * `instanceof` test against the `./client` copy is false for an error thrown * through `resolveStorageClient` (the `./client/storage` copy). Match what the * documented error declares instead, as the storage client itself does for * 404s (see isNotFoundHttpError in @hasna/contracts/client/storage). */ export declare function isNoCredentialConfigurationError(error: unknown): boolean; /** * Cloud-backed shortlinks store. All methods hit `/v1` over HTTPS with the * bearer key. Mirrors the async `PgShortlinksStore` method signatures so it is a * drop-in `RuntimeStore` for the CLI. */ export declare class CloudShortlinksStore implements Store { private readonly client; readonly kind: "http"; readonly transport: ShortlinksHttpTransport; private constructor(); /** Base `/v1` URL this store targets (for status/diagnostics). */ get baseUrl(): string; /** * Resolve a hosted-API store via the @hasna/contracts client resolver * (`resolveStorageClient`) — the ONLY chain, consulted fresh per request. * Returns a store when a shortlinks credential resolves anywhere in the * chain (Keychain, disk credential file, `HASNA_SHORTLINKS_API_KEY` / legacy * alias); the authority follows the resolved URL or the fleet gateway * default, so a credential alone is enough — URLs never need configuring. * * `null` means NO credential resolved anywhere — the caller must then fail * closed unless the local backend was explicitly opted into (never a silent * switch to the on-box store). Anything else — a URL without a credential, a * declared-but-blank variable, disagreeing authorities, an unreadable * credential file — THROWS: a partially configured hosted client must fail * loudly, never silently drift to the local dataset. */ static fromEnv(env?: Env, overrides?: ShortlinksTransportOverrides): CloudShortlinksStore | null; close(): Promise; addDomain(input: AddDomainInput): Promise; provisionDomain(input: ProvisionDomainInput): Promise; reconcileDomain(hostname: string): Promise; listDomains(): Promise; getDomain(hostnameOrId: string): Promise; getDefaultDomain(): Promise; deleteDomain(hostnameOrId: string): Promise; createLink(input: CreateLinkInput): Promise; listLinks(options?: { domain?: string; activeOnly?: boolean; limit?: number; }): Promise; getLink(domainOrSlug: string, maybeSlug?: string): Promise; resolve(hostname: string, slug: string): Promise; setLinkActive(domainOrSlug: string, maybeSlugOrActive: string | boolean, maybeActive?: boolean): Promise; deleteLink(domainOrSlug: string, maybeSlug?: string): Promise; recordClick(_link: Link, _input?: ClickInput): Promise; getStats(domainOrSlug: string, maybeSlug?: string): Promise; totalStats(): Promise<{ domains: number; links: number; clicks: number; }>; }