/** * Shared store-interaction core for the two publish front-ends — the curator * sidecar flow (`source manifest publish`) and the first-party library flow * (`library publish`). Both differ only in their git side-effects + how they * resolve the source repo; the store orchestration below (register → sync → * candidates → per-asset preview+publish) is identical. * * The store REST surface is reached through the injectable {@link PublisherClient} * so the orchestration stays unit/integration-testable without a live store. * * @docLink cli/commands/source#manifest-publish */ import type { SkPublishManifest } from "@skaile/workspaces/core"; import type { PublisherClient } from "../store-publisher.ts"; /** * One-line rendering of a namespace-availability probe for a `--dry-run` plan. * The `message` is store-authored (identical to what a real publish would echo) * — we only prepend a status glyph so the reader sees green/amber/red at a * glance without the CLI re-deriving any authorization logic. */ export declare function formatNamespaceAvailability(a: { status: "owned-by-you" | "claimable-by-you" | "reserved" | "available"; message: string; }): string; /** * Preflight the target namespace against the store's availability probe BEFORE a * publish does any irreversible work (a public git push). Returns `{ ok: false }` * with a guided message for `reserved` (not yours) and `claimable-by-you` (must * claim first) — the two states a real publish would reject — so the caller can * abort with actionable guidance instead of a raw 422 after pushing bytes. * * The probe is advisory: any failure (offline, older store) returns `{ ok: true }` * so the store stays the authority and a valid publish is never blocked. */ export declare function preflightNamespace(client: PublisherClient, namespace: string): Promise<{ ok: boolean; message?: string; }>; /** One candidate row shape the matcher operates on (kind + name are the key). */ interface CandidateLike { kind: string; name: string; } /** * Keep only candidates whose `(kind, name)` pair is declared in the manifest. * The backend may merge extra assets from the base repo into the candidate * list; a publish only touches what the manifest curated/declared. */ export declare function matchCandidatesToManifest(candidates: T[], manifest: SkPublishManifest): T[]; /** A canonical ref string `kind:@publisher/name[#version]` for reporting. */ export declare function refFor(kind: string, publisher: string, name: string, version?: string): string; /** The bare asset name from a `kind:@publisher/name#version` ref or a plain name. */ export declare function bareName(ref: string): string; /** * Poll a job until it leaves `running` or the deadline passes. Returns the last * observed state — the caller MUST treat a still-`running` result as a timeout * (not success), since it means the deadline was hit before the job finished. */ export declare function pollJob(client: PublisherClient, jobId: string, intervalMs?: number, timeoutMs?: number): Promise<{ status: string; items?: Array<{ label: string; status: string; error?: string; }>; }>; /** * True when a `sourcesAdd` rejection is a duplicate-URL conflict (the source is * already registered) — the only error the publish flow recovers from by looking * the existing row up. Every other failure (auth, 5xx, network) must propagate. */ export declare function isDupSourceError(err: unknown): boolean; /** * Register + sync the source, then publish its curated/declared candidates — * the store-side steps shared by both publish front-ends. Git side-effects (the * sidecar push, or the library commit+push) happen in the caller *before* this; * this function is purely store interaction. * * The sidecar front-end passes `sidecar` (so `sourcesAdd` carries the sidecar * pin); the library front-end omits it (the source repo IS the manifest host). * `assetName`, when set, narrows publication to the single candidate of that * name. Fatal store states (`sourcesAdd` non-dup failure) surface; sync failures * and empty candidate sets `process.exit(1)` with the same messages as before. */ export declare function publishToStore(opts: { sourceUrl: string; ref: string; sidecar?: { url: string; ref: string; }; manifest: SkPublishManifest; assetName?: string; client: PublisherClient; }): Promise<{ published: string[]; }>; export {}; //# sourceMappingURL=publish-core.d.ts.map