export type Fetch = typeof fetch /** * Error format * * */ export type MongoDBError = { message: string details: string hint: string code: string } /** * Response format * * */ interface PostgrestResponseBase { status: number statusText: string } export interface PostgrestResponseSuccess extends PostgrestResponseBase { error: null data: T count: number | null } export interface PostgrestResponseFailure extends PostgrestResponseBase { error: MongoDBError data: null count: null } // TODO: in v3: // - remove PostgrestResponse and PostgrestMaybeSingleResponse // - rename PostgrestSingleResponse to PostgrestResponse export type PostgrestSingleResponse = PostgrestResponseSuccess | PostgrestResponseFailure export type PostgrestMaybeSingleResponse = PostgrestSingleResponse export type PostgrestResponse = PostgrestSingleResponse export type GenericTable = { Row: Record Insert: Record Update: Record } export type GenericUpdatableView = { Row: Record Insert: Record Update: Record } export type GenericNonUpdatableView = { Row: Record } export type GenericView = GenericUpdatableView | GenericNonUpdatableView export type GenericFunction = { Args: Record Returns: unknown } export type GenericSchema = { Tables: Record Views: Record Functions: Record } // https://twitter.com/mattpocockuk/status/1622730173446557697 export type Prettify = { [K in keyof T]: T[K] } & {}