Files
faunosteo/packages/supabase/src/index.ts
T
bchanot e22357630f feat(supabase): animals and relations access layer
animals.ts: POST search with species filter and a probe row, read by id with
explicit columns, create with the optional first client in one call, update,
archive. relations.ts: an animal's relations in one select (voided left out),
create, end, dates, void. Kinds duplicate_relation and already_ended added.
2026-10-26 17:11:23 +01:00

165 lines
4.1 KiB
TypeScript

export {
createBrowserClient,
type FaunosteoClient,
type SupabaseConnection,
} from './client'
/** Auth types the app needs without depending on supabase-js directly. */
export type { AuthChangeEvent, Session, User } from '@supabase/supabase-js'
export type {
Database,
Enums,
Json,
Tables,
TablesInsert,
TablesUpdate,
} from './database.types'
export { Constants } from './database.types'
import type { Enums, Tables } from './database.types'
/** Row of public.profile_roles. */
export type ProfileRole = Tables<'profile_roles'>
export {
AuthFailure,
classifyAuthError,
sendPasswordReset,
signInWithOAuth,
signInWithPassword,
signOut,
signUpWithPassword,
updatePassword,
type AuthFailureKind,
type EmailPasswordCredentials,
type OAuthProvider,
type SignUpInput,
type SignUpResult,
} from './auth'
export {
fetchOwnProfile,
ProfileError,
updateOwnProfile,
type OwnProfilePatch,
type Profile,
} from './profiles'
/** owner | admin | moderator | support. Not a professional status. */
export { fetchOwnPlatformRoles, type PlatformRole } from './platform-roles'
export {
publishSheetVersion,
SheetPublishError,
type SheetCheckOutcome,
type SheetIssue,
type SheetPublishErrorKind,
type SheetValidator,
} from './anatomical-sheets'
export {
ASSET_FAILURE_KINDS,
ASSET_OWNER_COLUMNS,
AVATAR_REJECTION_CODES,
AssetFailure,
beginAvatarUpload,
classifyAssetError,
confirmAssetUpload,
downloadAvatar,
fetchOwnAvatarState,
isAvatarRejectionCode,
reduceAvatarRows,
removeAvatar,
uploadToQuarantine,
type AssetFailureKind,
type AssetRow,
type AssetStatus,
type AvatarRejectionCode,
type AvatarState,
type AvatarUploadTicket,
type BeginAvatarUploadInput,
type QuarantineUploadInput,
} from './assets'
/** Row of public.species. */
export type Species = Tables<'species'>
/** Row of public.anatomical_sheets. */
export type AnatomicalSheet = Tables<'anatomical_sheets'>
/** Row of public.anatomical_sheet_versions (content = canonical document). */
export type AnatomicalSheetVersion = Tables<'anatomical_sheet_versions'>
/** Row of public.anatomical_sheet_assets. */
export type AnatomicalSheetAsset = Tables<'anatomical_sheet_assets'>
/** private | public. */
export type SheetVisibility = Enums<'sheet_visibility'>
/** active | archived | deleted. */
export type SheetStatus = Enums<'sheet_status'>
/** draft | published | deprecated. */
export type SheetVersionStatus = Enums<'sheet_version_status'>
export {
RECORD_FAILURE_KINDS,
RecordFailure,
classifyRecordError,
parseRecordAnswer,
UUID_PATTERN,
type RecordFailureKind,
type RecordPage,
} from './records'
export { fetchPersonalWorkspaceId } from './workspaces'
export { fetchSpeciesLabels, type SpeciesLabel } from './species'
export {
CLIENT_COLUMNS,
createClientRecord,
fetchClientArchivePreview,
fetchClientRecord,
listClientAnimals,
searchClients,
setClientArchived,
updateClientRecord,
type AnimalRelationRole,
type AnimalSex,
type ClientAnimalItem,
type ClientArchivePreview,
type ClientFields,
type ClientKind,
type ClientListItem,
type ClientRecord,
type ClientSearch,
type CreateClientInput,
type NameCursor,
type RelationCursor,
type UpdateClientInput,
} from './clients'
export {
ANIMAL_COLUMNS,
createAnimalRecord,
fetchAnimalRecord,
searchAnimals,
setAnimalArchived,
updateAnimalRecord,
type AnimalFields,
type AnimalListItem,
type AnimalRecord,
type AnimalSearch,
type CreateAnimalInput,
type InitialRelation,
type UpdateAnimalInput,
} from './animals'
export {
ANIMAL_RELATION_COLUMNS,
createAnimalClientRelation,
endAnimalClientRelation,
fetchAnimalRelations,
updateAnimalClientRelation,
voidAnimalClientRelation,
type AnimalRelationItem,
type CreateRelationInput,
type EndRelationInput,
type UpdateRelationDatesInput,
} from './relations'
export {
ANIMAL_FIELD_LIMITS,
BIRTH_YEAR_MIN,
CLIENT_FIELD_LIMITS,
CONTROL_CHARACTERS,
COUNTRY_CODE_PATTERN,
EMAIL_PATTERN,
PHONE_E164_PATTERN,
RECORD_DATE_MIN,
codePointLength,
isCleanText,
} from './field-limits'