UNPKG

@t1mmen/srtd

Version:

Supabase Repeatable Template Definitions (srtd): 🪄 Live-reloading SQL templates for Supabase DX. Make your database changes reviewable and migrations maintainable! 🚀

84 lines (83 loc) • 3.04 kB
import { z } from 'zod'; /** * Format Zod validation errors into a human-readable string * @param error - Zod error object from safeParse * @returns Formatted error string with paths and messages */ export declare function formatZodErrors(error: z.ZodError): string; /** * Unified validation warning interface for all validation issues * Used by StateService (buildLog/localBuildLog) and config validation */ export interface ValidationWarning { source: 'buildLog' | 'localBuildLog' | 'config'; type: 'parse' | 'validation' | 'missing'; message: string; path?: string; } /** * Schema for TemplateBuildState - all fields are optional strings */ export declare const TemplateBuildStateSchema: z.ZodObject<{ lastBuildHash: z.ZodOptional<z.ZodString>; lastBuildDate: z.ZodOptional<z.ZodString>; lastBuildError: z.ZodOptional<z.ZodString>; lastMigrationFile: z.ZodOptional<z.ZodString>; lastAppliedHash: z.ZodOptional<z.ZodString>; lastAppliedDate: z.ZodOptional<z.ZodString>; lastAppliedError: z.ZodOptional<z.ZodString>; }, z.core.$strip>; /** Type derived from TemplateBuildStateSchema */ export type TemplateBuildState = z.infer<typeof TemplateBuildStateSchema>; /** * Schema for BuildLog - contains version, lastTimestamp, and templates record */ export declare const BuildLogSchema: z.ZodObject<{ version: z.ZodString; lastTimestamp: z.ZodString; templates: z.ZodRecord<z.ZodString, z.ZodObject<{ lastBuildHash: z.ZodOptional<z.ZodString>; lastBuildDate: z.ZodOptional<z.ZodString>; lastBuildError: z.ZodOptional<z.ZodString>; lastMigrationFile: z.ZodOptional<z.ZodString>; lastAppliedHash: z.ZodOptional<z.ZodString>; lastAppliedDate: z.ZodOptional<z.ZodString>; lastAppliedError: z.ZodOptional<z.ZodString>; }, z.core.$strip>>; }, z.core.$strip>; /** Type derived from BuildLogSchema */ export type BuildLog = z.infer<typeof BuildLogSchema>; /** * Schema for CLIConfig - matches CLIConfig interface from types.ts */ export declare const CLIConfigSchema: z.ZodObject<{ filter: z.ZodString; wipIndicator: z.ZodString; wrapInTransaction: z.ZodBoolean; banner: z.ZodString; footer: z.ZodString; templateDir: z.ZodString; migrationDir: z.ZodString; migrationPrefix: z.ZodOptional<z.ZodString>; migrationFilename: z.ZodOptional<z.ZodString>; buildLog: z.ZodString; localBuildLog: z.ZodString; pgConnection: z.ZodString; }, z.core.$strip>; /** Type derived from CLIConfigSchema */ export type CLIConfig = z.infer<typeof CLIConfigSchema>; /** * Result type for validation helpers */ export interface ValidationResult<T> { success: boolean; data?: T; error?: string; errorType?: 'parse' | 'validation'; } /** * Validates a JSON string as a BuildLog * @param content - JSON string to validate * @returns ValidationResult with parsed data or error message */ export declare function validateBuildLog(content: string): ValidationResult<BuildLog>;