import type { AddDomainInput, Click, ClickInput, CreateLinkInput, Domain, DomainReconciliationResult, ProvisionDomainInput, Link, LinkStats } from "./types.js"; /** Plain env shape consumed by the store resolver (own-property reads only). */ export type Env = Record; export interface ListLinksOptions { domain?: string; activeOnly?: boolean; limit?: number; } export interface TotalStats { domains: number; links: number; clicks: number; } /** * The single storage surface shared by LocalStore and ApiStore. All methods are * async so one call site works against either transport. */ export interface Store { /** Which transport backs this store (for banners/diagnostics only). */ readonly kind: "local" | "http"; addDomain(input: AddDomainInput): Promise; listDomains(): Promise; getDomain(hostnameOrId: string): Promise; getDefaultDomain(): Promise; /** * Delete a domain (by hostname or id) and, via ON DELETE CASCADE, all of its * links and clicks. Returns the deleted domain. Throws when not found. */ deleteDomain(hostnameOrId: string): Promise; /** Submit purchase intent to Shortlinks, which delegates exclusively to Domains. */ provisionDomain(input: ProvisionDomainInput): Promise; /** Refresh a custom-domain projection from the hosted Domains API. */ reconcileDomain(hostname: string): Promise; createLink(input: CreateLinkInput): Promise; listLinks(options?: ListLinksOptions): Promise; getLink(domainOrSlug: string, maybeSlug?: string): Promise; resolve(hostname: string, slug: string): Promise; setLinkActive(domainOrSlug: string, slugOrActive: string | boolean, active?: boolean): Promise; deleteLink(domainOrSlug: string, maybeSlug?: string): Promise; /** * Record a click. Only the on-box redirect server does this against a LocalStore; * the cloud API records clicks server-side, so ApiStore rejects this call. */ recordClick(link: Link, input?: ClickInput): Promise; getStats(domainOrSlug: string, maybeSlug?: string): Promise; totalStats(): Promise; close(): Promise; }