/** * Upstream Diff Query * * The toolbar pill and the drawer it opens both read the same change summary. * Sharing the key and a stale window means one fetch answers both: the pill has * to know the count to decide whether to appear, and opening the drawer reuses * that read rather than making its own. Recording a resolution invalidates the * key, so the window never holds a summary past a change to it. * * They also have to agree on what an outcome means, so the read is classified * here rather than by each reader: a missing edge and an unreachable check both * leave no summary, and they call for opposite things. */ import { type ChangeSummary, type P1Client } from '@pantheon-systems/css-client'; export declare const UPSTREAM_DIFF_KEY = "p1-upstream-diff"; export type UpstreamRelationType = 'localization' | 'template'; export declare function upstreamDiffQueryKey(siteId: string, branchId: string, documentId: string, relationType: UpstreamRelationType): (string | undefined)[]; export declare function upstreamDiffQuery(client: P1Client, siteId: string, branchId: string, documentId: string, relationType: UpstreamRelationType): { queryKey: (string | undefined)[]; queryFn: () => Promise; retry: false; staleTime: number; }; /** What a reader of the summary has to go on. */ export type UpstreamDiff = { state: 'checking'; } /** The page derives from nothing: there is nothing to reconcile, and nothing to say. */ | { state: 'noEdge'; } /** The check could not be made, so how far the page has drifted is unknown. */ | { state: 'unavailable'; message: string; retry: () => void; } /** A summary to work from. `staleReason` is set when the last refresh failed. */ | { state: 'ready'; summary: ChangeSummary; staleReason: string | null; }; export declare function useUpstreamDiff(client: P1Client, siteId: string, branchId: string, documentId: string, relationType: UpstreamRelationType): UpstreamDiff;