/** * Build and deploy resources to Tinybird API * Uses the /v1/build endpoint to deploy all resources at once */ import type { GeneratedResources } from "../generator/index.js"; /** * Configuration for building/deploying to Tinybird */ export interface BuildConfig { /** Tinybird API base URL */ baseUrl: string; /** API token for authentication */ token: string; } /** * Resource info in the build response */ export interface ResourceInfo { name: string; type: string; } /** * Error details from the build endpoint */ export interface BuildError { filename?: string; type?: string; error: string; } /** * Build response from the /v1/build endpoint */ export interface BuildResponse { /** Result status */ result: "success" | "failed" | "no_changes"; /** Error message if failed (simple error) */ error?: string; /** Array of errors if multiple (validation errors) */ errors?: BuildError[]; /** Build details */ build?: { id: string; datasources?: ResourceInfo[]; pipes?: ResourceInfo[]; /** Names of pipes that were changed in this build */ changed_pipe_names?: string[]; /** Names of newly created pipes in this build */ new_pipe_names?: string[]; /** Names of pipes that were deleted in this build */ deleted_pipe_names?: string[]; /** Names of datasources that were changed in this build */ changed_datasource_names?: string[]; /** Names of newly created datasources in this build */ new_datasource_names?: string[]; /** Names of datasources that were deleted in this build */ deleted_datasource_names?: string[]; }; } /** * Resource changes in a build */ export interface ResourceChanges { /** Names of resources that were changed */ changed: string[]; /** Names of newly created resources */ created: string[]; /** Names of resources that were deleted */ deleted: string[]; } /** * Build result with additional metadata */ export interface BuildApiResult { /** Whether the build was successful */ success: boolean; /** Result status from API */ result: "success" | "failed" | "no_changes"; /** Error message if failed (formatted for display) */ error?: string; /** Detailed errors array from the API */ errors?: BuildError[]; /** Number of datasources deployed */ datasourceCount: number; /** Number of pipes deployed */ pipeCount: number; /** Number of connections deployed */ connectionCount: number; /** Build ID if successful */ buildId?: string; /** Pipe changes in this build */ pipes?: ResourceChanges; /** Datasource changes in this build */ datasources?: ResourceChanges; /** @deprecated Use pipes.changed instead */ changedPipeNames?: string[]; /** @deprecated Use pipes.created instead */ newPipeNames?: string[]; } /** * Build and deploy generated resources to Tinybird API * * Uses the /v1/build endpoint which accepts all resources in a single * multipart form request. * * @param config - Build configuration with API URL and token * @param resources - Generated resources to deploy * @returns Build result * * @example * ```ts * const result = await buildToTinybird( * { * baseUrl: 'https://api.tinybird.co', * token: 'p.xxx', * }, * { * datasources: [{ name: 'events', content: '...' }], * pipes: [{ name: 'top_events', content: '...' }], * } * ); * * if (result.success) { * console.log('Build deployed successfully!'); * } * ``` */ export declare function buildToTinybird(config: BuildConfig, resources: GeneratedResources, options?: { debug?: boolean; }): Promise; /** * Validate that the configuration is complete */ export declare function validateBuildConfig(config: Partial): asserts config is BuildConfig; //# sourceMappingURL=build.d.ts.map