@promptbook/google
Version:
Promptbook: Turn your company's scattered knowledge into AI ready books
29 lines (28 loc) • 1.15 kB
TypeScript
import type { PostgrestError } from '@supabase/postgrest-js';
/**
* Holds the data necessary to translate a Postgres constraint name into a user-facing error.
*
* @private Internal helper for Supabase-backed collections
*/
export type UniqueConstraintTranslation = {
/**
* The suffix of the constraint name that should trigger this translation.
*/
readonly suffix: string;
/**
* Builds the domain-specific error to throw when the constraint matches.
*/
readonly buildError: () => Error;
};
/**
* Converts a Supabase unique constraint violation into a domain-specific error.
*
* @param error - Resulting Postgrest error from Supabase.
* @param translations - Array of translations keyed by constraint suffix.
* @returns A translated error when the constraint suffix matches, otherwise `null`.
* @private Internal helper for Supabase-backed collections
*/
export declare function translateSupabaseUniqueConstraintError(error: PostgrestError | null, translations: ReadonlyArray<UniqueConstraintTranslation>): Error | null;
/**
* Note: [💞] Ignore a discrepancy between file name and entity name
*/