import { i as CreateWorkspaceManifest } from "./types-Dj4qu4gT.js";
import { ProjectRootResult } from "@sanity/cli-core/types";
import { SchemaValidationProblemGroup } from "@sanity/types";
import { StudioManifest, Workspace } from "sanity";
import { z } from "zod/mini";
import { extractSchema } from "@sanity/schema/_internal";
declare const buildStudioSchemasAndManifestsWorkerData: z.ZodMiniObject<{
  configPath: z.ZodMiniString<string>;
  isExternal: z.ZodMiniBoolean<boolean>;
  outPath: z.ZodMiniString<string>;
  projectId: z.ZodMiniString<string>;
  verbose: z.ZodMiniBoolean<boolean>;
  workDir: z.ZodMiniString<string>;
}, z.core.$strip>;
type BuildStudioSchemasAndManifestsWorkerData = z.infer<typeof buildStudioSchemasAndManifestsWorkerData>;
type BuildStudioSchemasAndManifestsWorkerSuccess = {
  studioManifest: StudioManifest | null;
  type: 'success';
  workspaceManifests: CreateWorkspaceManifest[];
};
/**
 * 1. Extracts the create manifest in dist/static (tar/gzipped with studio)
 * 2. Uploads the schema to lexicon
 * 3. Creates a studio manifest (which can be sent to populus)
 */
declare function buildStudioSchemasAndManifests(applicationId: string, options: BuildStudioSchemasAndManifestsWorkerData): Promise<BuildStudioSchemasAndManifestsWorkerSuccess>;
declare function getAggregatedSeverity(groupOrGroups: SchemaValidationProblemGroup | SchemaValidationProblemGroup[]): 'error' | 'warning';
declare function formatSchemaValidation(validation: SchemaValidationProblemGroup[]): string;
interface ExtractOptions {
  configPath: string;
  enforceRequiredFields: boolean;
  format: string;
  outputPath: string;
  watchPatterns: string[];
  workspace: string | undefined;
}
interface GetExtractOptions {
  enforceRequiredFields: boolean | undefined;
  format: string | undefined;
  path: string | undefined;
  projectRoot: ProjectRootResult;
  watchPatterns: string[] | undefined;
  workspace: string | undefined;
}
declare function getExtractOptions(options: GetExtractOptions): ExtractOptions;
/**
 * Creates a pattern matcher function for schema watch patterns.
 * Normalizes file paths to forward slashes and makes them relative before matching.
 *
 * @param patterns - Array of glob patterns to match against
 * @returns Function that takes a file path and workDir, returns true if file matches any pattern
 * @internal
 */
declare function createSchemaPatternMatcher(patterns: string[]): {
  isMatch: (filePath: string, workDir: string) => boolean;
};
/**
 * Core schema extraction logic.
 * Performs the extraction via worker and writes to file.
 * Throws SchemaExtractionError on failure.
 */
declare function runSchemaExtraction(extractOptions: Omit<ExtractOptions, 'watchPatterns'>): Promise<ReturnType<typeof extractSchema>>;
interface UploadSchemaToLexiconOptions {
  projectId: string;
  workDir: string;
  workspaces: Workspace[];
  verbose?: boolean;
}
/**
 * Uploads the schemas to Lexicon and returns the studio manifest
 * @param options - The options for the uploadSchemaToLexicon function
 * @returns The studio manifest
 */
declare function uploadSchemaToLexicon(options: UploadSchemaToLexiconOptions): Promise<StudioManifest | null>;
/**
 * Extracts validation problem groups from a SchemaError.
 */
declare function extractValidationFromSchemaError(error: unknown, workDir: string): Promise<SchemaValidationProblemGroup[] | undefined>;
declare class SchemaExtractionError extends Error {
  validation?: SchemaValidationProblemGroup[];
  constructor(message: string, validation?: SchemaValidationProblemGroup[]);
}
/**
 * This function must only be called from another worker process.
 * @param options - The worker options
 */
declare function workerBuildStudioSchemasAndManifests(options: BuildStudioSchemasAndManifestsWorkerData & {
  workspaceManifestsHandler?: (workspaceManifests: CreateWorkspaceManifest[]) => Promise<void>;
}): Promise<BuildStudioSchemasAndManifestsWorkerSuccess>;
interface SchemaExtractedTraceAttributes {
  enforceRequiredFields: boolean;
  schemaAllTypesCount: number;
  schemaDocumentTypesCount: number;
  schemaFormat: string;
  schemaTypesCount: number;
}
type SchemaExtractionWatchModeAttributes = {
  averageExtractionDuration: number;
  extractionFailedCount: number;
  extractionSuccessfulCount: number;
  step: 'stopped';
  watcherDuration: number;
} | {
  enforceRequiredFields: boolean;
  schemaFormat: string;
  step: 'started';
};
interface SchemaDeployTraceData {
  manifestDir: string;
  schemaRequired: boolean;
  extractManifest?: boolean;
}
declare const SchemaExtractedTrace: import("@sanity/telemetry").DefinedTelemetryTrace<SchemaExtractedTraceAttributes, void>;
declare const SchemaExtractionWatchModeTrace: import("@sanity/telemetry").DefinedTelemetryTrace<SchemaExtractionWatchModeAttributes, void>;
declare const SchemaDeploy: import("@sanity/telemetry").DefinedTelemetryTrace<SchemaDeployTraceData, void>;
export { type ExtractOptions, SchemaDeploy, SchemaExtractedTrace, SchemaExtractionError, SchemaExtractionWatchModeTrace, buildStudioSchemasAndManifests, createSchemaPatternMatcher, extractValidationFromSchemaError, formatSchemaValidation, getAggregatedSeverity, getExtractOptions, runSchemaExtraction, uploadSchemaToLexicon, workerBuildStudioSchemasAndManifests };
//# sourceMappingURL=extract.d.ts.map