import { type BuildTargetResponse, type JobStepBody, type PressResponse, type PublishRequestStatus, type PublishTabJob } from "../internal/index.js"; import { z } from "zod"; /** * Publishing as a queued job, as a Studio tab speaks it. * * valbuild/home's docs/app-mode.md, "Publishing is a queued job", is the * design: a press is a REQUEST that returns at once; the tab that pressed runs * the job it is given -- prepare, build, upload -- and content runs verify and * the seal. Everything goes through this deployment: the job routes through * the publish proxy, and the prepare through this server's own route, which is * the one place a job's sources can be computed. */ export type StudioJobClient = { /** A press of Publish. Idempotent on `requestId`. */ press(requestId: string, tab: string): Promise; /** * Publish in a proposal: press the merge of `proposal`. Idempotent on * `requestId`, as `press` is; the merge checks run first and may refuse it. * From the press on it is a request like any other. */ pressMerge(proposal: string, requestId: string, tab: string, /** * The checks the person chose to publish over, having been told what * failed: `types`, an upgrade's new type errors (Publish anyway on home's * upgrade page). Content refuses it over anything else. */ anyway?: "types"[], /** * The message of the commit Publish makes first, in a project connected * to git (the proposal's branch, before it merges): from the project's * `studio.commitMessage` setting. Absent: content's default. */ commitMessage?: string): Promise; /** Try again: resume a paused queue and press anew. */ tryAgain(requestId: string, tab: string): Promise; /** Where a press is. */ requestStatus(requestId: string): Promise; /** A free tab asking for queued work. */ next(tab: string): Promise; /** The job's prepare, by this server: its sources, and content's archive of them. */ prepare(job: PublishTabJob, tab: string): Promise; /** The tab reports a step it ran. */ step(jobId: string, body: JobStepBody): Promise; /** The tab is still building. `false`: it no longer holds the job. */ renew(jobId: string, tab: string): Promise; cancel(jobId: string): Promise; /** Discard a failed job's changes; answers what another job still holds. */ discard(jobId: string): Promise; /** * Connected: the newest CI run the branch's workflow reported -- where * "View run" goes for a build that failed. `null` when none was reported. */ newestCiRun(): Promise<{ status: "failed" | "succeeded"; url: string | null; } | null>; }; /** What the tab builds a job from: `/api/val/publish-job-prepare`'s answer. */ export type PreparedJob = { job: PublishTabJob | null; sourceFiles: Record; binaryFiles: Record; binaryFilesUnread: string[]; branch: string | null; /** Can this tab build the job from these sources? See the route's `buildable`. */ buildable: boolean; /** * What to build against, when it is not the site's: a merge of a proposal * that changed its dependencies builds on the proposal's own framework and * layer (valbuild/home `docs/adept.md`, step 6). Absent, the deploy asks * the site's, as it always did. */ target?: BuildTargetResponse; }; export declare function createStudioJobClient(options: ({ api: string; } | { /** Content's publish API itself: see `PublishApiAt`. */ publishApi: string; /** The project's proposals on content, `/v1///proposals`. */ proposalsApi: string; }) & { fetchImpl?: typeof fetch; }): StudioJobClient; /** A job's change that merges a proposal: `merge:` (content's `mergeChange`). */ export declare function isMergeChange(change: string): boolean; /** `/publish-jobs/:id/merge-prepare`'s answer: the merge's files, from content. */ export declare const MergePrepareAnswer: z.ZodObject<{ job: z.ZodNullable>; base: z.ZodNullable; patches: z.ZodArray; contentOnly: z.ZodOptional>; }, z.core.$strip>>; sourceFiles: z.ZodRecord>; target: z.ZodOptional; }, z.core.$strip>;