import type { BlueprintResource } from '@sanity/blueprints';
import { type Blueprint } from '@sanity/blueprints-parser';
import type { Logger } from '../../utils/logger.js';
import type { BlueprintParserError, ScopeType } from '../../utils/types.js';
import { type LocatedBlueprintsConfig } from './config.js';
import { type ConfigSource } from './resolve.js';
declare const SUPPORTED_FILE_EXTENSIONS: readonly ['.json', '.js', '.mjs', '.ts'];
type BlueprintFileExtension = (typeof SUPPORTED_FILE_EXTENSIONS)[number];
export declare const JSON_BLUEPRINT_CONTENT: {
    blueprintVersion: string;
    resources: never[];
};
export declare const TS_BLUEPRINT_CONTENT: string;
/** Function type with attached attributes */
export type BlueprintModule = ((args?: unknown) => Record<string, unknown>) & {
    organizationId?: string;
    projectId?: string;
    stackId?: string;
};
type FileInfo = {
    blueprintFilePath: string;
    fileName: string;
    extension: BlueprintFileExtension;
};
/**
 * Finds the blueprint file in the given path or current working directory
 * @returns The path, file name, and extension of the blueprint file
 */
export declare function findBlueprintFile(blueprintPath?: string): FileInfo | null;
/** @see resolve.ts for the canonical definition */
export type { ConfigSource } from './resolve.js';
/** Result of loading a blueprint file from disk. */
export interface LoadedBlueprintFile {
    rawBlueprint: Record<string, unknown>;
    module?: BlueprintModule;
}
/**
 * Normalized result from the parser's {@link BlueprintOutput}
 * to match the shape returned by {@link readLocalBlueprint}
 */
export interface ParsedBlueprintContent {
    /** The validated blueprint, or the raw data as fallback when parsing fails */
    parsedBlueprint: Blueprint | Record<string, unknown>;
    errors: BlueprintParserError[];
    resources: BlueprintResource[];
}
/** Result of the blueprint read operation */
export interface ReadBlueprintResult {
    fileInfo: FileInfo;
    blueprintConfig: LocatedBlueprintsConfig | null;
    /** The raw blueprint data as read from disk */
    rawBlueprint: Record<string, unknown>;
    /** The blueprints-parser blueprint result */
    parsedBlueprint: Blueprint;
    errors: BlueprintParserError[];
    /** Validated resources escaped from parser types */
    resources: BlueprintResource[];
    scopeType?: ScopeType;
    scopeId?: string;
    organizationId?: string;
    projectId?: string;
    stackId?: string;
    sources?: {
        organizationId?: ConfigSource;
        projectId?: ConfigSource;
        stackId?: ConfigSource;
    };
}
/**
 * Load a blueprint file from disk: read JSON or import+execute a JS/TS module.
 * Returns the raw blueprint data and the module reference (if dynamic).
 */
export declare function loadBlueprintFile(fileInfo: FileInfo): Promise<LoadedBlueprintFile>;
/**
 * Run the blueprint parser/validator on raw blueprint data.
 * Optionally validates function resources.
 */
export declare function parseBlueprintContent(rawBlueprint: Record<string, unknown>, options: {
    validateResources: boolean;
}): ParsedBlueprintContent;
/** Result of finding, loading, and parsing a blueprint file. */
export interface LocalBlueprint extends ParsedBlueprintContent {
    fileInfo: FileInfo;
    rawBlueprint: Record<string, unknown>;
    module?: BlueprintModule;
}
/**
 * Find, load, and parse a local blueprint file in one step.
 * Does not read the config file or resolve IDs -- callers that need
 * scope/stack information should use `readConfigFile` + `resolveIds` separately.
 *
 * @param blueprintPath Path to a blueprint file or directory containing one
 * @param options.validateResources Whether to validate function resources
 */
export declare function loadAndParseBlueprint(blueprintPath?: string, options?: {
    validateResources: boolean;
}): Promise<LocalBlueprint>;
/**
 * Reads the blueprint file from disk and parses it.
 * Resolves IDs from environment > blueprint module > config file.
 * Can infer stackId from projectId for legacy ST-<projectId> stacks.
 * @see {@link loadBlueprintFile} {@link readConfigFile} {@link resolveIds} {@link parseBlueprintContent}
 * @todo deprecate in favor of decomposed functions
 * @returns Known information about the Blueprint, config, and Stack
 */
export declare function readLocalBlueprint(logger: Logger, validate: {
    resources: boolean;
}, blueprintPath?: string): Promise<ReadBlueprintResult>;
export declare function writeBlueprintToDisk({ blueprintFilePath, jsonContent, }: {
    blueprintFilePath: string;
    jsonContent?: Blueprint;
}): string;
export declare function addResourceToBlueprint<T extends BlueprintResource>({ blueprintFilePath, resource, }: {
    blueprintFilePath?: string;
    resource: T;
}): T | undefined;
