import { P as PgError, k as RecordsErrorCode, R as RecordsResult, j as RecordsError, U as Uuid } from './record-C3thPhpR.cjs'; import { c as RecordsDataSource, b as RecordsErrorSink } from './ports-BSd-1p1l.cjs'; /** One choice as the detail / selection documents hand it back. */ interface PickListItem { id: string; label: string; /** Never present on the selection read: that read is the one a non-owner may see. */ description?: string | null; help_text?: string | null; group_name?: string | null; icon_name?: string | null; } /** A pick list as `pick_list_get` / `pick_list_for_selection` / `pick_list_update` answer it. */ interface PickListDocument { id?: string; list_id?: string; list_name?: string; description?: string | null; organization_id?: string | null; /** The choices in order (the update door answers this flat shape). */ items?: PickListItem[]; /** The choices by group (the read doors answer this shape). */ items_grouped?: Record; [key: string]: unknown; } /** One choice to write when a list's choices are replaced. Either casing of each key is read by the door. */ interface PickListItemInput { label: string; description?: string; help_text?: string; group_name?: string; icon?: string; } /** One row of the pick-list index (`custom.pick_list_index`): what a picker needs to name a list. */ interface PickListIndexEntry { id: string; list_name?: string | null; description?: string | null; item_count?: number | null; organization_id?: string | null; } /** What `custom.pick_list_index` answers: the lists a person may open, and the archived ids. */ interface PickListIndexDocument { lists?: PickListIndexEntry[]; archived_ids?: string[]; [key: string]: unknown; } interface RetryOptions { /** False: ask once and hand back whatever came. */ safe: boolean; /** Tests pass a fake. */ sleep?: (ms: number) => Promise; /** Tests pass a fixed source. */ random?: () => number; delays?: readonly number[]; /** Told before each wait (attempt counts from 1), so a screen can say it is still trying. */ onRetry?: (info: { attempt: number; waitMs: number; error: PgError; }) => void; } /** The schema every door of the record store lives in, unless the host's config says otherwise. */ declare const DEFAULT_DOOR_SCHEMA = "custom"; /** An argument object as one stable string: keys sorted at every depth (PAGE-BUNDLE's match key). */ declare function canonicalArgs(value: unknown): string; /** * 🚨 A REFUSAL IS NOT AN APP ERROR (lane RECORDS-UI-FIX, guide re-walk 2026-09-23). * * A person typing `-3` into a column that takes "at least 0" is the store WORKING: the * rule said no, the screen said so in the one notice, and the person fixed it. The default * sink printed every one of those through `console.error`, and the app's error capture * (matrx-frontend `lib/diagnostics/globalErrorCapture.ts`) counts every `console.error` — * so one refused value lit a red "2 errors" pill in the corner, telling an admin the * product had failed when a person had simply been told no. * * These are the codes a PERSON causes by what they typed or when they typed it; each one * is already drawn on the screen that asked. They are still said (`console.info`), never * silenced. Everything else — a door, the store switched off, a timeout, a class this * package did not recognize — is a failure of the system and stays `console.error`. */ declare const A_PERSONS_REFUSAL: ReadonlySet; declare function isAPersonsRefusal(code: RecordsErrorCode | string): boolean; /** The host's error sink, or the default one: the store's own words, naming where it happened. */ declare function recordsErrorSink(onError: RecordsErrorSink | undefined): RecordsErrorSink; /** The refusal a missing door gets. It always says who owes it (`owedBy`, when a lane claims it). */ declare function doorAbsentRefusal(name: string, owedBy?: string): RecordsError; /** * What the server render already asked as this person, for this exact door and arguments — or null. * A write (or a look write) empties what is primed instead, and is never answered from it. */ declare function primedDoorAnswer(door: string, args: Record): { data: unknown; } | null; /** One door call: the door's name, its arguments, and where the caller is (for the refusal). */ type DoorCall = (door: string, args: Record, where: string, /** * `quiet`: this refusal is an ANSWER the caller already draws (a door that says "not yours" to a * person who only has table-level access), not a failure of the system. It is returned to the * caller and said once with `console.info` - never through the error sink, which lights the * error badge. Everything else about the call is unchanged. */ opts?: { quiet?: boolean; }) => Promise>; interface DoorCallOptions { /** The store's data seam (`asRecordsDataSource(supabase)`). */ dataSource: RecordsDataSource; /** Defaults to `custom`. */ schema?: string; /** The host's error sink (defaults to `recordsErrorSink(undefined)`). */ onError?: RecordsErrorSink; /** * MAY THIS DOOR BE ASKED AT ALL (the full client's generated catalog). False refuses with * `absent(door)` and asks nobody. Absent ⇒ every door is asked, and a store that answers "no such * function" (PostgREST's PGRST202 or Postgres's 42883) is refused `door_absent` all the same. */ doorReady?: (door: string) => boolean; /** The refusal a missing door gets (defaults to `doorAbsentRefusal(door)`). */ absent?: (door: string) => RecordsError; /** An answer this page already holds for the exact call (the full client's page bundle), else null. */ held?: (door: string, args: Record) => Promise<{ data: unknown; } | null | undefined>; /** A write landed: drop what this page still holds of it (the full client's page bundle). */ wrote?: (door: string, args: Record) => void; /** * TRANSIENT STORE ERRORS ARE ASKED AGAIN, HERE, FOR EVERY DOOR (TEMPLATE-INSTALL-3). PGRST001/PGRST002, a 502/503/504, a * reset connection, a cancelled statement, a lock wait, a serialization failure and a deadlock are the store's weather, not an * answer: a read (or a write that is safe to repeat: an idempotent door, or a call carrying `p_install_id`) waits 0.5, 1, 2 * and 4 s with jitter and asks again. Any other write is asked once and refused in one plain sentence. Tests inject the waits; * `false` turns it off. */ retry?: false | Pick; } /** Build the one door call over a data source. Every records client, light or full, asks through this. */ declare function createDoorCall(options: DoorCallOptions): DoorCall; interface PickListDoors { /** * PICK-LISTS: every pick list a person may open in ONE organization (`custom.pick_list_index`): id, name and * choice count, nothing else. Read only when a picker opens (the load law), never with the screen. */ pickListIndex(args: { organization_id: Uuid; }): Promise>; /** * PICK-LISTS: a pick list with its choices, grouped (`custom.pick_list_get`; viewer access on the list). * The list is read by its own id; its organization is the list's own, never the client's. */ pickListGet(args: { list_id: Uuid; }): Promise>; /** PICK-LISTS: a pick list for a selection control (`custom.pick_list_for_selection`): labels, help, groups, icons, NEVER the secret description. */ pickListForSelection(args: { list_id: Uuid; }): Promise>; /** * PICK-LISTS: rename / describe a pick list and, with `items`, REPLACE its choices * (`custom.pick_list_update`; editor access). The replaced choices are archived, soft and restorable. */ pickListUpdate(args: { list_id: Uuid; list_name?: string | null; description?: string | null; items?: readonly PickListItemInput[] | null; }): Promise>; } /** The door names (guard: each is in the generated catalog — `door-call-entry.test.ts`). */ declare const PICK_LIST_DOORS: { readonly pickListIndex: "pick_list_index"; readonly pickListGet: "pick_list_get"; readonly pickListForSelection: "pick_list_for_selection"; readonly pickListUpdate: "pick_list_update"; }; declare function createPickListDoors(callDoor: DoorCall): PickListDoors; export { A_PERSONS_REFUSAL as A, DEFAULT_DOOR_SCHEMA as b, PICK_LIST_DOORS as c, canonicalArgs as d, createDoorCall as e, createPickListDoors as f, doorAbsentRefusal as g, isAPersonsRefusal as i, primedDoorAnswer as p, recordsErrorSink as r }; export type { DoorCallOptions as D, PickListDoors as P, DoorCall as a, PickListDocument as h, PickListIndexDocument as j, PickListIndexEntry as k, PickListItem as l, PickListItemInput as m };