/** * Has the site moved onto other dependencies since this page loaded? * * A managed project's Studio is served by the site's own live build, so the * Studio on screen -- its builder, its Val -- is the version that build was * made with. When the site is updated (Settings → Updates, in this tab or * another), every Studio opened before that is the OLD version, and a publish * from one would build the site with the old builder, or, if it read its build * target before the update went live, put the old dependencies back. * * So the page remembers which dependency layer the live build had when it * loaded, and a publish compares that with the live build's now. They differ * only when somebody moved the site's dependencies in between; the answer is * to reload, which loses nothing -- unpublished changes are the server's. * * Read from `/__api/head`, which the platform answers on every site without a * credential and which names the layer (`projectVendorRev`). Anything that * cannot answer -- not on the platform, the loader unreachable, an older * loader -- reads as "cannot tell", and "cannot tell" never blocks a publish. */ /** * The layer, or `undefined` for "cannot tell". `null` is never READ -- a head * that names no layer is "cannot tell" too, see `readLiveLayer` -- but is what * a build target says for a project with none, which is why it is comparable. */ export type LayerReading = string | null | undefined; export declare function readLiveLayer(fetchImpl?: typeof fetch): Promise; /** * Stale only on a positive answer from both readings. A page that could not * tell what it loaded on, or cannot tell now, publishes as before. */ export declare function layerMoved(loaded: LayerReading, now: LayerReading): boolean; /** * Take the reading this page is compared against. Once per page: the first * call wins, because a later one would record the layer an update just moved * to and make a stale page look current. */ export declare function rememberLoadedLayer(fetchImpl?: typeof fetch): void; /** What {@link rememberLoadedLayer} read, or `undefined` if it never ran. */ export declare function loadedLayer(): Promise; /** Has the live build's layer moved since this page loaded? */ export declare function siteMovedSinceLoad(fetchImpl?: typeof fetch): Promise; /** The code a deploy refuses with when this page is out of date. */ export declare const STUDIO_OUT_OF_DATE = "STUDIO_OUT_OF_DATE"; export declare const STUDIO_OUT_OF_DATE_MESSAGE: string; export declare function markStudioOutOfDate(): void; export declare function studioOutOfDateRefusals(): number; export declare function subscribeStudioOutOfDate(listener: () => void): () => void; /** For tests: forget everything this module has learnt. */ export declare function resetLoadedLayerForTests(): void;