UNPKG

@promptbook/remote-server

Version:

Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action

27 lines (26 loc) 1.07 kB
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;