import "./defineApp-DOJE2kjo.js";
import { n as resolveWorkbenchConfig, t as ResolvedMediaLibraryConfig } from "./resolveWorkbenchConfig-KhXnVKZ6.js";
import { a as DeployableWorkbenchApp, i as summarizeInterfaces, n as DeployedView, o as getWorkbench, r as DeployedWebWorker, t as DeployedInterface } from "./summarizeInterfaces-noqbAtVC.js";
import { AppVisibility, CliConfig, Output } from "@sanity/cli-core";
import "node:zlib";
/**
 * Throws unless `sourceDir` is a directory holding a federation build.
 * A workbench build always emits a module-federation remote, and may
 * additionally emit a standalone `index.html` SPA (workbench remotes). Either
 * way `mf-manifest.json` is the reliable marker that `sanity build` produced a
 * federation build, so that — not `index.html` — is what we check for.
 */
declare function checkBuiltOutput(sourceDir: string): Promise<void>;
/**
 * The org's active installation for an app type, or `undefined` when none is
 * installed. Read-only, so `--dry-run` can report deployability.
 * @internal
 */
declare function resolveInstallationId(options: {
  appType: string;
  organizationId: string;
}): Promise<string | undefined>;
/**
 * A report heading and item list for a config; a media library's `fields` are
 * one of potentially many shapes.
 * @internal
 */
declare function summarizeConfig(config: {
  appType: string;
  fields: {
    name: string;
    src: string;
    title: string;
  }[];
}): string;
/**
 * Upload the built module-federation remote to the installation as its config
 * snapshot. `installationId` is resolved by the caller so `--dry-run` never
 * reaches this mutating step.
 * @internal
 */
declare function deployConfig(options: {
  appType: string;
  installationId: string;
  organizationId: string;
  output: Output;
  sourceDir: string;
  version: string;
}): Promise<void>;
/** What a workbench app contributes to a deploy payload. */
interface WorkbenchDeployPayload {
  slug: string;
  title: string;
  /** Media-library config summary. */
  config?: string;
  services?: DeployedWebWorker[];
  views?: DeployedView[];
  visibility?: string;
}
/**
 * Gated once so a plain app can't pick up a stray key: without a workbench
 * there is nothing to contribute. `views` and `services` travel together.
 */
declare function toWorkbenchPayload(workbench: DeployableWorkbenchApp | null, { config, interfaces, title }: {
  config?: string;
  interfaces: {
    services: DeployedWebWorker[];
    views: DeployedView[];
  } | null;
  title: string;
}): Partial<WorkbenchDeployPayload>;
type ApplicationType = 'coreApp' | 'studio';
interface Application {
  id: string;
  organizationId: string;
  slug: string | null;
  title: string;
  type: ApplicationType;
}
/**
 * A resource a deployment may interact with, as Brett stores it. Per-deployment
 * and forbidden for singletons (the server 400s).
 */
interface BrettAccess {
  resourceId: string;
  resourceType: 'canvas' | 'dashboard' | 'dataset' | 'media-library';
}
/** A studio workspace as Brett stores it. */
interface BrettWorkspace {
  dataset: string;
  projectId: string;
  /** Lexicon schema descriptor id; Brett requires one per workspace. */
  schemaDescriptorId: string;
  basePath?: string;
  icon?: string;
  name?: string;
  subtitle?: string;
  title?: string;
}
declare function getWorkbenchUrl(organizationId: string): string;
/** Where a deployed application is served on its organization's workbench. */
declare function getApplicationUrl(application: Pick<Application, 'id' | 'organizationId' | 'type'>): string;
declare function getApplication(applicationId: string): Promise<Application | null>;
/** Every application in an organization, in one page (`limit=none`). */
declare function listApplications(organizationId: string): Promise<Application[]>;
/**
 * `rollback` undoes the creation, so a later failure leaves no record stranded at the slug.
 * @internal
 */
interface CreatedApplication {
  application: Application;
  rollback: () => Promise<void>;
}
/**
 * Create a coreApp record (no deployment), so the CLI can build with its id
 * before shipping the first deployment. First deploy only.
 * @internal
 */
declare function createCoreApp(options: {
  isSingleton?: boolean;
  name?: string;
  organizationId: string;
  slug: string;
  title: string;
  visibility?: AppVisibility;
}): Promise<CreatedApplication>;
/**
 * Create a studio record (no deployment).
 * @internal
 */
declare function createStudio(options: {
  name?: string;
  organizationId: string;
  projectId: string | undefined;
  slug: string;
  title: string;
  visibility?: AppVisibility;
}): Promise<CreatedApplication>;
/**
 * Ship a deployment to an already-created (or `deployment.appId`) application,
 * then sync its mutable metadata (`title`, and `icon`/`slug`/`visibility` when
 * set) from config. The deploy endpoint ignores these, so a redeploy patches
 * them here alongside the new deployment.
 *
 * `onDeployed` fires the instant the deployment is live, before the metadata
 * sync — so a caller can disarm a create-time rollback that must not delete an
 * application once it has an active deployment.
 * @internal
 */
declare function deployWorkbenchApp(options: {
  access?: readonly BrettAccess[];
  app: CliConfig['app'];
  applicationId: string;
  icon?: string;
  isApp: boolean;
  isAutoUpdating: boolean;
  label?: string;
  onDeployed?: () => void;
  /**
   * The address from config. Only `createApplication` used to send it, so an
   * app with a `deployment.appId` kept whatever slug it was created at.
   */
  slug?: string;
  sourceDir: string;
  title: string;
  version: string;
  visibility?: AppVisibility;
  workspaces?: readonly BrettWorkspace[];
}): Promise<void>;
export { type Application, type BrettAccess, type BrettWorkspace, type CreatedApplication, type DeployedInterface, type DeployedView, type DeployedWebWorker, type ResolvedMediaLibraryConfig, type WorkbenchDeployPayload, checkBuiltOutput, createCoreApp, createStudio, deployConfig, deployWorkbenchApp, getApplication, getApplicationUrl, getWorkbench, getWorkbenchUrl, listApplications, resolveInstallationId, resolveWorkbenchConfig, summarizeConfig, summarizeInterfaces, toWorkbenchPayload };
//# sourceMappingURL=deploy.d.ts.map