/** * SeoDataSource seam (spec-20260715-ultimate-seo-suite, Sprint 6). * * The unified interface every data provider (offline `LocalExportSource`, * this sprint; live `gsc`/`dataforseo` adapters, sprints 8-9) implements. * Capability/query/row shapes are quoted from the architecture Component * Breakdown / Data Model (.bober/architecture/ * arch-20260715-ultimate-seo-agents-skills-architecture.md:143-212). * * `DataOutcome`/`DataProvenance` are the canonical outcome union defined in * `./types.js` (Sprint 1) — RE-EXPORTED here, never redefined. */ import type { DataOutcome } from "./types.js"; export type { DataOutcome, DataProvenance } from "./types.js"; /** * The seven data capabilities a `SeoDataSource` may serve. Widened from five * to seven (spec-20260717-seo-improver-builder, Sprint 1) with * `"ai-visibility"` and `"link-graph"` — a closed union, so every * implementer + any exhaustive `Record` map is forced by * the compiler to account for the two new members. */ export type SeoCapability = "search-analytics" | "url-inspection" | "serp" | "keywords" | "backlinks" | "ai-visibility" | "link-graph"; export type SearchAnalyticsQuery = { siteUrl: string; startDate: string; endDate: string; dimensions: Array<"query" | "page" | "country" | "device">; rowLimit?: number; }; export type UrlInspectionQuery = { siteUrl: string; inspectionUrl: string; }; export type SerpQuery = { keyword: string; location: string; priority?: "standard" | "priority" | "live"; }; export type KeywordQuery = { keywords: string[]; location: string; }; export type BacklinkQuery = { target: string; limit?: number; }; /** * AI-visibility/GEO probe query — one batch of prompts against a target * (architecture Data Model, arch-20260716-...-architecture.md:64; F5). */ export type AiVisibilityQuery = { target: string; prompts: string[]; locale?: string; }; /** Site-crawl internal-link-graph query (architecture:65; F7). */ export type LinkGraphQuery = { rootUrl: string; limit?: number; }; /** GSC Search-Analytics export, flattened. */ export type SearchAnalyticsRow = { query?: string; page?: string; country?: string; device?: string; clicks: number; impressions: number; ctr: number; position: number; }; /** GSC URL-Inspection export or local crawl output. */ export type UrlInspectionRow = { url: string; coverageState?: string; indexingState?: string; lastCrawlTime?: string; robotsTxtState?: string; pageFetchState?: string; }; export type SerpRow = { keyword: string; position: number; url: string; title?: string; location?: string; }; export type KeywordRow = { keyword: string; searchVolume?: number; cpc?: number; competition?: number; location?: string; }; export type BacklinkRow = { sourceUrl: string; targetUrl: string; anchor?: string; dofollow?: boolean; }; /** * One AI-answer probe result — one row per (prompt, provider) pair * (architecture:64; F5). `citationPresent`/`sourceUrls` capture whether the * AI answer cited the target at all, distinct from `mentioned` (brand * mentioned in the answer text without a citation). */ export type AiVisibilityRow = { prompt: string; provider: string; mentioned: boolean; rank?: number; citationPresent: boolean; sourceUrls: string[]; }; /** * One internal/external link edge from a site crawl — flat rows, not a * nested graph (architecture:65, ADR-6; F7). */ export type LinkGraphRow = { fromUrl: string; toUrl: string; anchor?: string; internal: boolean; }; /** * One crawled page's sanitized content (architecture:66, ADR-11; F6/F7). * `content` has already been passed through `ContentSanitizer` by the time * it reaches this row — no further sanitization is required downstream. No * `Query` pair this sprint (the crawl query lives on `CrawlEngine`, a later * sprint). */ export type CrawlPageRow = { url: string; title?: string; content: string; }; /** * Implemented by every SEO data provider (offline or live). Each method * returns a `DataOutcome` and — per the discipline mirrored from * `RetrievalOutcome` (`src/medical/retrieval/medline-source.ts:25-28`) — * NEVER throws to the caller: absent/unsupported capability maps to * `{ kind: "disabled" }`, a parseable-but-empty result maps to * `{ kind: "abstain", reason }`. */ export interface SeoDataSource { /** The capabilities this source can currently serve (advertises only what it can). */ capabilities(): SeoCapability[]; searchAnalytics(q: SearchAnalyticsQuery): Promise>; urlInspection(q: UrlInspectionQuery): Promise>; serp(q: SerpQuery): Promise>; keywords(q: KeywordQuery): Promise>; backlinks(q: BacklinkQuery): Promise>; aiVisibility(q: AiVisibilityQuery): Promise>; linkGraph(q: LinkGraphQuery): Promise>; } //# sourceMappingURL=data-source.d.ts.map