import { z } from "zod"; import { ContentPublishApi, PublishProblem, PublishRequestStatus, PublishState, PublishTabJob } from "./contentApi.js"; /** * Reading what content answers. * * Every type here comes from `contentApi.ts`, which is a copy of the * service's own `Api.ts` - so the shapes are not re-derived from what this end * wishes it received, and a copy brought up to date fails to compile wherever * this CLI has not caught up. * * The schemas are the runtime half, and they are needed as well as the types: * what arrives is JSON over HTTP from a service that versions separately, so a * type alone asserts a shape rather than checking one. Each schema is * annotated with the copied type it must produce (`z.ZodType` * and so on), which is what ties the two halves together - a schema that drifts * from the copy does not compile, and an answer that drifts from the schema * does not parse. `ValOpsHttp` in `@valbuild/server` reads every other content * route the same way. * * Nothing here is laxer than the copy. An optional field is optional because * the service says so; making a required one optional here would hide exactly * the drift this file exists to catch. */ export type { PublishProblem, PublishState }; export type DeclareBody = ContentPublishApi["/publish"]["POST"]["body"]; export type DeclareResponse = ContentPublishApi["/publish"]["POST"]["res"]; export type ArtifactsResponse = ContentPublishApi["/publish/:publishId/artifacts"]["POST"]["res"]; export type VerifyResponse = ContentPublishApi["/publish/:publishId/verify"]["POST"]["res"]; export type PromoteResponse = ContentPublishApi["/publish/:publishId/promote"]["POST"]["res"]; export type StatusResponse = ContentPublishApi["/publish/:publishId"]["GET"]["res"]; export type PublishTokenResponse = ContentPublishApi["/publish-token"]["POST"]["res"]; /** An artifact, as it is declared: by key, by hash, by size. */ export type DeclaredArtifact = DeclareBody["artifacts"][number]; /** Permission to write one artifact's bytes to object storage. */ export type UploadSlot = DeclareResponse["uploads"][number]; /** * Content answered, and the answer was not one this CLI can act on. * * Separate from a refusal, which is content saying no in a sentence meant for * a person. This is two programs disagreeing - the copy in `contentApi.ts` and * the service that has moved on from it - and the two want opposite things * said about them. */ export declare class PublishProtocolError extends Error { constructor(message: string); } export declare const parseDeclare: (body: unknown) => DeclareResponse; export declare const parseArtifacts: (body: unknown) => ArtifactsResponse; export declare const parseVerify: (body: unknown) => VerifyResponse; export declare const parsePromote: (body: unknown) => PromoteResponse; export declare const parseStatus: (body: unknown) => StatusResponse; export declare const parsePublishToken: (body: unknown, call: string) => PublishTokenResponse; /** * What a build targets, and the project's files, as the Studio asks for them. * * Both are read through `/publish-api` rather than fetched from the loader, * because a browser has neither the loader's address nor a credential it would * accept. `fetchBuildTarget` in `@valbuild/tanstack-build` is the other half -- * same shape, a different caller, and it CASTS where this parses. * * Parsed rather than cast here because of what sits in between: a proxy, a * gateway and a service boundary. An HTML error page cast to `BuildTarget` * fails several layers down inside rolldown with a message about a module * specifier, and the publish that follows would label a build against a layer * that was never there. * * The TYPE is inferred from this schema instead of imported. `BuildTarget` is * declared in `@valbuild/tanstack-build`, which has no zod and deliberately * almost no dependencies -- it goes into a browser bundle -- and this package * is imported by everything. The declarations are kept honest at the one place * the value is used: it is passed straight into `buildUserApp({ target })`, so * a drift between them is a compile error at that call rather than a runtime * surprise. */ declare const buildTargetResponse: z.ZodObject<{ base: z.ZodObject<{ rev: z.ZodString; shellRev: z.ZodString; rscShellRev: z.ZodString; modules: z.ZodRecord; rscModules: z.ZodRecord; paths: z.ZodObject<{ baseFromProject: z.ZodString; projectVendorDir: z.ZodString; rscVendorBase: z.ZodString; rscRuntimeSpecifier: z.ZodString; rscRuntimePath: z.ZodString; flightServer: z.ZodString; serverFnBase: z.ZodString; }, z.core.$strip>; pins: z.ZodOptional>; exports: z.ZodOptional>; browser: z.ZodRecord>; }, z.core.$strip>>; buildAssets: z.ZodOptional; }, z.core.$strip>; project: z.ZodObject<{ rev: z.ZodNullable; rsc: z.ZodBoolean; modules: z.ZodRecord; css: z.ZodRecord; workerOnly: z.ZodArray; }, z.core.$strip>; branch: z.ZodOptional; }, z.core.$strip>; export type BuildTargetResponse = z.infer; /** * `null` files is a real answer: a project that has never published. * * Distinguished from an empty record, which would be a project that published * nothing -- and which a build would take as "no entry point" rather than as * "there is nothing here yet". */ declare const projectSourceResponse: z.ZodObject<{ files: z.ZodNullable>; publicFiles: z.ZodOptional>>>; publicPaths: z.ZodOptional>>; }, z.core.$strip>; export type ProjectSourceResponse = z.infer; /** * Whether a managed project can be updated onto its template's current seed, * and -- when it is asked with `POST`, the press -- what to build against. * * An update rebuilds the site as it is on newer dependencies. The loader * decides whether there is one; content adds whether the project is managed at * all, and the branch head the rebuild is wired at, because an update * publishes no content of its own. * * `target` is a `/build-target` answer whose project half is the SEED's * dependency layer, already copied into the project so a publish can name it. * Only a `POST` carries it. */ declare const dependencyChange: z.ZodObject<{ name: z.ZodString; section: z.ZodEnum<{ dependencies: "dependencies"; devDependencies: "devDependencies"; }>; from: z.ZodNullable; to: z.ZodNullable; }, z.core.$strip>; declare const updateTargetResponse: z.ZodDiscriminatedUnion<[z.ZodObject<{ status: z.ZodLiteral<"current">; template: z.ZodString; layerRev: z.ZodString; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<"available">; template: z.ZodString; changes: z.ZodArray; from: z.ZodNullable; to: z.ZodNullable; }, z.core.$strip>>; layerRev: z.ZodObject<{ from: z.ZodNullable; to: z.ZodString; }, z.core.$strip>; packageJson: z.ZodString; commit: z.ZodNullable; branch: z.ZodString; target: z.ZodOptional; rscModules: z.ZodRecord; paths: z.ZodObject<{ baseFromProject: z.ZodString; projectVendorDir: z.ZodString; rscVendorBase: z.ZodString; rscRuntimeSpecifier: z.ZodString; rscRuntimePath: z.ZodString; flightServer: z.ZodString; serverFnBase: z.ZodString; }, z.core.$strip>; pins: z.ZodOptional>; exports: z.ZodOptional>; browser: z.ZodRecord>; }, z.core.$strip>>; buildAssets: z.ZodOptional; }, z.core.$strip>; project: z.ZodObject<{ rev: z.ZodNullable; rsc: z.ZodBoolean; modules: z.ZodRecord; css: z.ZodRecord; workerOnly: z.ZodArray; }, z.core.$strip>; branch: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<"unavailable">; reason: z.ZodString; message: z.ZodString; }, z.core.$strip>], "status">; export type UpdateTargetResponse = z.infer; export type DependencyChange = z.infer; export declare const parseUpdateTarget: (body: unknown) => UpdateTargetResponse; export declare const parseBuildTarget: (body: unknown) => BuildTargetResponse; export declare const parseProjectSource: (body: unknown) => ProjectSourceResponse; export type { PublishRequestStatus, PublishTabJob }; export type PressResponse = ContentPublishApi["/publish-requests"]["POST"]["res"]; export type RequestStatusResponse = ContentPublishApi["/publish-requests/:requestId"]["GET"]["res"]; export type NextJobResponse = ContentPublishApi["/publish-jobs/next"]["POST"]["res"]; export type JobPrepareBody = ContentPublishApi["/publish-jobs/:jobId/prepare"]["POST"]["body"]; export type JobStepBody = ContentPublishApi["/publish-jobs/:jobId/steps"]["POST"]["body"]; export type JobStepResponse = ContentPublishApi["/publish-jobs/:jobId/steps"]["POST"]["res"]; export type JobRenewResponse = ContentPublishApi["/publish-jobs/:jobId/renew"]["POST"]["res"]; export type JobCancelResponse = ContentPublishApi["/publish-jobs/:jobId/cancel"]["POST"]["res"]; export type JobDiscardResponse = ContentPublishApi["/publish-jobs/:jobId/discard"]["POST"]["res"]; export declare const parsePress: (body: unknown, call: string) => PressResponse; export declare const parseRequestStatus: (body: unknown) => RequestStatusResponse; export declare const parseJob: (body: unknown, call: string) => JobStepResponse; export declare const parseRenew: (body: unknown) => JobRenewResponse; export declare const parseCancel: (body: unknown) => JobCancelResponse; export declare const parseDiscard: (body: unknown) => JobDiscardResponse; export type CiRunReportBody = ContentPublishApi["/ci-runs"]["POST"]["body"]; export type NewestCiRunResponse = ContentPublishApi["/ci-runs/newest"]["GET"]["res"]; export declare const parseNewestCiRun: (body: unknown) => NewestCiRunResponse; /** * The `details` of a refusal, when it carries a list of problems. * * Every non-2xx is `{ statusCode, message, details? }`, and the publish routes * put `PublishProblem[]` in `details` - a declaration is answered with EVERY * problem rather than the first, because finding them one round trip at a time * is how a publish takes six attempts. Anything else in there is somebody * else's `details` and is left to the caller's own message. */ export declare function parseProblems(details: unknown): PublishProblem[];