@t1mmen/srtd
Version:
Supabase Repeatable Template Definitions (srtd): 🪄 Live-reloading SQL templates for Supabase DX. Make your database changes reviewable and migrations maintainable! 🚀
37 lines (36 loc) • 1.53 kB
TypeScript
import { Command } from 'commander';
import type { TemplateStatus } from '../types.js';
import { type TemplateResult } from '../ui/index.js';
/** Internal event type for stacking logic */
type WatchEventType = 'changed' | 'applied' | 'error';
/**
* Stack consecutive events for the same template (unless error).
* When changed→applied happens, we only show "applied" (the meaningful action).
*/
export declare function stackResults(results: TemplateResult[]): TemplateResult[];
/** Convert TemplateResult status to WatchEventType */
export declare function statusToEventType(status: TemplateResult['status']): WatchEventType;
/** Reason why a template needs building */
export type NeedsBuildReason = 'never-built' | 'outdated';
/**
* Determine if a template needs building and why.
* Returns null if template is up-to-date with current build.
*/
export declare function getBuildReason(template: TemplateStatus): NeedsBuildReason | null;
export interface RenderScreenOptions {
templates: TemplateStatus[];
recentUpdates: TemplateResult[];
historicActivity: Array<{
template: string;
action: 'built' | 'applied';
timestamp: Date;
target?: string;
}>;
errors: Map<string, string>;
showHistory: boolean;
needsBuild: Map<string, NeedsBuildReason>;
}
/** Renders the full watch mode screen with header, history, errors, and instructions */
export declare function renderScreen(options: RenderScreenOptions): void;
export declare const watchCommand: Command;
export {};