@ai-matrx/records 0.43.0 → 0.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2263,6 +2263,16 @@ declare const STORE_DOORS: readonly [{
2263
2263
  readonly args: "p_organization_id uuid, p_container_id uuid, p_item_id uuid";
2264
2264
  readonly returns: "integer";
2265
2265
  readonly security: "definer";
2266
+ }, {
2267
+ readonly name: "relation_words";
2268
+ readonly args: "p_organization_id uuid, p_field_id uuid, p_value text";
2269
+ readonly returns: "text";
2270
+ readonly security: "definer";
2271
+ }, {
2272
+ readonly name: "relation_words_many";
2273
+ readonly args: "p_organization_id uuid, p_field_id uuid, p_record_ids uuid[]";
2274
+ readonly returns: "TABLE(record_id uuid, words text)";
2275
+ readonly security: "definer";
2266
2276
  }, {
2267
2277
  readonly name: "reopen_declared_doors";
2268
2278
  readonly args: "";
@@ -3172,13 +3182,13 @@ declare const STORE_REFUSAL_CODES: readonly [{
3172
3182
  readonly raised_by: "_booking_availability,_entity_custom_fields_guard,_take_op_id,_value_envelope,_work_shape_guard,actor_word,agg_assert_key,agg_sql,anon_token_issue,booking_declare,containment_parent,dashboard_block_normalize,dashboard_window_sql,doc_render_body,doc_render_write,doc_signature_write,enrich_declare,enrich_land,enrich_normalize,enrich_pin,entity_value_write,external_history_event,external_source_declare,external_stub_upsert,external_write_through,field_history,io_export,io_import_begin,io_import_finish,io_import_plan,io_import_report,io_proposal_accept,migrate_merge,migrate_reclass,my_levels,organization_clear,page_size,pin_agent_cells,pipeline_move,portal_declare,provenance_write,query_by_coordinates,query_rollup,record_update,record_write_many,relation_carry,rule_eval,rule_members,share_grant,share_lane_set,sign_request_create,sign_request_sign,subscription_declare,table_rules,visibility_as_of,work_approval_request,work_list,work_slot_hold";
3173
3183
  }, {
3174
3184
  readonly code: "23503";
3175
- readonly raised_by: "_booking_availability,_checklist_instantiate,_containment_guard,_field_document_for,_pipeline_stage_key,_record_rule_uses,agg_digest_assemble,anon_publish,anon_rate_take,anon_token_issue,anon_write,assert_organization_wall,booking_cancel,booking_confirm,booking_declare,booking_hold,booking_reschedule,capture_publish,checklist_declare,checklist_steps_table,comment_write,dashboard_declare,delete_rule,doc_sign,doc_template_save,enrich_declare,enrich_due,enrich_land,form_declare,form_submit,home_add,inbound_declare,inbound_mail_land,inbound_set,io_comment_write,io_import_begin,io_import_finish,io_import_report,io_import_rows,io_proposal_accept,migrate_demote,migrate_promote,pipeline_board,pipeline_declare,pipeline_move,pipeline_read,pipeline_transition_refusal,promote_field,promote_table,record_applicability,record_reparent,relation_carry,relation_own,resolve_first_match,rule_applies,rule_declare,rule_eval,rule_members,rule_run,sign_request_create,subscription_mute,subscription_preview,view_declare,work_set_state,work_take_assignment,work_template_instantiate";
3185
+ readonly raised_by: "_booking_availability,_checklist_instantiate,_containment_guard,_display_spec_for,_field_document_for,_pipeline_stage_key,_record_rule_uses,agg_digest_assemble,anon_publish,anon_rate_take,anon_token_issue,anon_write,assert_organization_wall,booking_cancel,booking_confirm,booking_declare,booking_hold,booking_reschedule,capture_publish,checklist_declare,checklist_steps_table,comment_write,dashboard_declare,delete_rule,doc_sign,doc_template_save,enrich_declare,enrich_due,enrich_land,form_declare,form_submit,home_add,inbound_declare,inbound_mail_land,inbound_set,io_comment_write,io_import_begin,io_import_finish,io_import_report,io_import_rows,io_proposal_accept,migrate_demote,migrate_promote,pipeline_board,pipeline_declare,pipeline_move,pipeline_read,pipeline_transition_refusal,promote_field,promote_table,record_applicability,record_reparent,relation_carry,relation_own,resolve_first_match,rule_applies,rule_declare,rule_eval,rule_members,rule_run,sign_request_create,subscription_mute,subscription_preview,view_declare,work_set_state,work_take_assignment,work_template_instantiate";
3176
3186
  }, {
3177
3187
  readonly code: "23505";
3178
3188
  readonly raised_by: "_unique_rule_holds,doc_sign,doc_signature_write,entity_field_declare,field_declare,home_add,inbound_declare,io_proposal_accept,relation_carry,relation_own,share_grant,sign_request_cancel,sign_request_create,table_share_outside_invite,table_share_outside_resend,work_approval_decide,work_slot_hold";
3179
3189
  }, {
3180
3190
  readonly code: "23514";
3181
- readonly raised_by: "_checklist_instantiate,_checklist_step_guard,_containment_guard,_dated_values_guard,_derived_fields,_entity_custom_fields_guard,_field_class_guard,_field_document_for,_field_shape_guard,_field_type_parity_guard,_merge_field_shape_guard,_merge_field_temporal_guard,_promoted_field_cap_guard,_record_rule_uses,_resolve_choice_words,_rule_shape_guard,_rule_topology_guard,_store_relation_edge_names_its_field,_table_columns_word_guard,_table_shape_guard,_undeclared_key_guard,_value_envelope,_work_shape_guard,_workdoors_approval_guard,assert_columns_are_defined,assert_entity_is_organization_scoped,booking_declare,capture_publish,capture_sheet_declare,checklist_declare,checklist_step_complete,doc_sign,doc_signature_write,doc_template_save,entity_field_declare,entity_field_retire,entity_field_update,entity_records_find,entity_table,field_declare,field_retire,field_update,home_add,io_import_rows,migrate_merge,relation_carry,relation_own,sign_request_create,sign_request_sign,table_declare,validate_value_envelope,validate_values,work_set_state,work_slots_declare,work_take_assignment,work_template_instantiate";
3191
+ readonly raised_by: "_checklist_instantiate,_checklist_step_guard,_containment_guard,_dated_values_guard,_derived_fields,_display_spec_for,_entity_custom_fields_guard,_field_class_guard,_field_document_for,_field_shape_guard,_field_type_parity_guard,_merge_field_shape_guard,_merge_field_temporal_guard,_promoted_field_cap_guard,_record_rule_uses,_resolve_choice_words,_rule_shape_guard,_rule_topology_guard,_store_relation_edge_names_its_field,_table_columns_word_guard,_table_shape_guard,_undeclared_key_guard,_value_envelope,_with_display,_work_shape_guard,_workdoors_approval_guard,assert_columns_are_defined,assert_entity_is_organization_scoped,booking_declare,capture_publish,capture_sheet_declare,checklist_declare,checklist_step_complete,doc_sign,doc_signature_write,doc_template_save,entity_field_declare,entity_field_retire,entity_field_update,entity_records_find,entity_table,field_declare,field_retire,field_update,home_add,io_import_rows,migrate_merge,relation_carry,relation_own,sign_request_create,sign_request_sign,table_declare,validate_value_envelope,validate_values,work_set_state,work_slots_declare,work_take_assignment,work_template_instantiate";
3182
3192
  }, {
3183
3193
  readonly code: "40001";
3184
3194
  readonly raised_by: "has_visibility_at";
@@ -3767,6 +3777,31 @@ interface FieldRule {
3767
3777
  * `custom.field` — the ONE definitions table (FLD-8), organization-scoped, so
3768
3778
  * two organizations add different fields to the same standard table.
3769
3779
  */
3780
+ /**
3781
+ * WHICH OF THE OTHER RECORD'S COLUMNS A RELATION SHOWS (REL-DISP, 2026-09-21).
3782
+ *
3783
+ * A Table has ONE stored default reference column — its `title_field` — and until
3784
+ * this existed every relation pointing at that Table could display that column and
3785
+ * nothing else. A Jobs board could read "Maria Chen" but never "Maria Chen —
3786
+ * Rincon", and two columns could not be joined into one string at all.
3787
+ *
3788
+ * ABSENT MEANS THE TABLE'S OWN COLUMN. A field with no `display` resolves exactly
3789
+ * as it did before, so nothing changes for a column nobody has given a spec to.
3790
+ *
3791
+ * The store judges it once, in `custom._display_spec_for`: every column named must
3792
+ * exist on the target Table, and the refusal names the one that does not. It is
3793
+ * resolved by ONE body, `custom._words_for`, which `custom.record_words`,
3794
+ * `custom._card_words`, `custom.relation_words` and `custom.relation_words_many`
3795
+ * are all one-liners onto — so the thirteen store-side readers inherit it too.
3796
+ *
3797
+ * A display column that is itself a relation resolves ONE hop and never a second.
3798
+ */
3799
+ interface RelationDisplay {
3800
+ /** The target's columns, in the order they are shown. */
3801
+ columns: string[];
3802
+ /** What goes between them. Defaults to a single space. */
3803
+ separator: string;
3804
+ }
3770
3805
  interface Field {
3771
3806
  id: Uuid;
3772
3807
  organization_id: Uuid;
@@ -3795,6 +3830,8 @@ interface Field {
3795
3830
  on_target_delete: OnDelete | null;
3796
3831
  /** REL-9. The reverse is visible from both ends and is NOT a second Field. */
3797
3832
  inverse_key: string | null;
3833
+ /** REL-DISP. Which of the target's columns this one shows. Null = the Table's own. */
3834
+ display: RelationDisplay | null;
3798
3835
  source: FieldSource;
3799
3836
  source_config: Record<string, unknown>;
3800
3837
  /** FLD-9. A Formula declares whether it computes on read or on write. */
@@ -3922,6 +3959,12 @@ interface NewFieldDeclaration {
3922
3959
  relation_target?: Uuid;
3923
3960
  /** REL-2. What happens to this record when the thing it points at goes. */
3924
3961
  on_target_delete?: OnDelete;
3962
+ /**
3963
+ * REL-DISP. Which of the target's columns this one shows, and what joins them.
3964
+ * A bare column name and a plain list are both accepted by the door and
3965
+ * normalised; leaving it out keeps the target Table's own reference column.
3966
+ */
3967
+ display?: RelationDisplay | string[] | string;
3925
3968
  /**
3926
3969
  * Presentation and behaviour settings the store carries verbatim — a long
3927
3970
  * text's `multiline`, a list's existing options table. The door has always
@@ -3991,6 +4034,12 @@ interface FieldPatch {
3991
4034
  /** REL / FLD-11: re-point the column. The old edges are withdrawn by the door. */
3992
4035
  relation_target?: Uuid;
3993
4036
  on_target_delete?: OnDelete;
4037
+ /**
4038
+ * REL-DISP. Which of the target's columns this one shows. `null` REMOVES the
4039
+ * spec and the column goes back to whatever the table it points at is titled by;
4040
+ * the door refuses it by name on a column that points at nothing.
4041
+ */
4042
+ display?: RelationDisplay | string[] | string | null;
3994
4043
  /** SEAT-SUITES: whether the store builds an index for this column, and a unique one. */
3995
4044
  promoted?: boolean;
3996
4045
  unique?: boolean;
@@ -4065,6 +4114,129 @@ declare function holdsARetiredChoice(document: RecordDocument | undefined, field
4065
4114
  /** True when a token looks like a uuid — which a choice value is no longer allowed to be. */
4066
4115
  declare function looksLikeAnId(value: unknown): boolean;
4067
4116
 
4117
+ /**
4118
+ * EVERYTHING THIS FILE NEEDS TO KNOW ABOUT A FIELD, AND NOTHING ELSE.
4119
+ *
4120
+ * A full `Field` satisfies it, and so does every narrower shape the store
4121
+ * hands to a screen — `CaptureField` on a phone with no network, the Field
4122
+ * documents `custom.form_public` and `custom.booking_public` publish to a
4123
+ * stranger. Asking for the whole `Field` would have meant the capture sheet
4124
+ * keeping its own `Number(raw)`, which is exactly the duplication this file
4125
+ * exists to end.
4126
+ */
4127
+ interface CoercibleField {
4128
+ /** Named so the doc above is checkable: a full {@link Field} satisfies this. */
4129
+ key: string;
4130
+ label?: string | null;
4131
+ name?: string | null;
4132
+ /** FLD-1. One of five behaviours; an unknown word is treated as text. */
4133
+ type?: string | null;
4134
+ multi?: boolean | null;
4135
+ unit?: string | null;
4136
+ format?: string | null;
4137
+ config?: Record<string, unknown> | null | undefined;
4138
+ relation_target?: string | null;
4139
+ }
4140
+ /**
4141
+ * The kind of value one Field holds, resolved from its DECLARATION only — the
4142
+ * behaviour, the modifiers, the format, the relation target and the config,
4143
+ * because those are what the store stores. A screen that guessed from a value
4144
+ * would answer differently for an empty record.
4145
+ *
4146
+ * `plain_text`, `long_text`, `number` and `boolean` are behaviours that carry
4147
+ * no parity type of their own; every other word here is a parity type.
4148
+ */
4149
+ declare const FIELD_KINDS: readonly ["attachment", "checkbox", "currency", "datetime", "email", "formula", "json", "long_text", "lookup", "member", "multi_select", "number", "percent", "phone", "relation", "rollup", "select", "text", "url"];
4150
+ /**
4151
+ * 🚨 THE UNION IS DERIVED FROM THE LIST ABOVE, and the list is what the
4152
+ * coverage test walks. Add a kind here and the test drives it; give it no arm
4153
+ * in `coerceTypedAnswer` and the test says so, instead of the new kind falling
4154
+ * quietly through `default:` and a value of the wrong shape reaching the store
4155
+ * — which is the whole defect this file closes.
4156
+ */
4157
+ type FieldKind = (typeof FIELD_KINDS)[number];
4158
+ /** The kernel Table ids REC-31 pins the two special relations to. */
4159
+ interface KernelTargets {
4160
+ /** The kernel `File` Table — a relation pointing here is an attachment. */
4161
+ file?: string | undefined;
4162
+ /** The kernel `Person` Table — a relation pointing here names a person. */
4163
+ person?: string | undefined;
4164
+ }
4165
+ /**
4166
+ * Which kind of value this Field holds.
4167
+ *
4168
+ * This is the ONE classifier. `@ai-matrx/records-ui`'s `editorKindFor` — which
4169
+ * decides which editor to DRAW — delegates to it, so the editor a person types
4170
+ * into and the coercion applied to what they typed can never disagree about
4171
+ * the same column. They did disagree before this moved here; that is the whole
4172
+ * class of grid defect September was spent closing.
4173
+ */
4174
+ declare function fieldKindFor(field: CoercibleField, kernel?: KernelTargets): FieldKind;
4175
+ /** One Field's options, indexed the way a typed word has to be looked up. */
4176
+ interface ChoiceOptions {
4177
+ /**
4178
+ * Lower-cased label, option key and option id, each pointing at the OPTION
4179
+ * RECORD'S ID — which is what a list Field stores (FLD-5/FLD-6).
4180
+ */
4181
+ byWord: Map<string, string>;
4182
+ /** The labels, in order, so a refusal can say what is on offer. */
4183
+ labels: string[];
4184
+ }
4185
+ /** What one answer became, or the sentence saying why it did not. */
4186
+ type Coerced = {
4187
+ value: unknown;
4188
+ } | {
4189
+ refusal: string;
4190
+ unmatched?: string[];
4191
+ };
4192
+ interface CoerceOptions {
4193
+ /** This Field's choices, when the caller has loaded them. */
4194
+ options?: ChoiceOptions | undefined;
4195
+ /** The kernel File/Person Table ids, for classifying relations. */
4196
+ kernel?: KernelTargets | undefined;
4197
+ /**
4198
+ * The Field's name as this caller writes it. Defaults to the Field's own
4199
+ * label. A screen passes the same words it printed above the box.
4200
+ */
4201
+ label?: string | undefined;
4202
+ }
4203
+ /** The Field's name in plain words — never its key on a screen. */
4204
+ declare function coercionLabel(field: CoercibleField): string;
4205
+ /**
4206
+ * Turn ONE typed-in string into the value this Field holds — or say, in a
4207
+ * sentence a person can act on, why it is not one.
4208
+ *
4209
+ * An empty answer is `null` for every kind: a blank means "no answer here",
4210
+ * and clearing a value is a thing a person means to do. Whether the Field may
4211
+ * be blank is the store's question, asked with the Field's `required` and its
4212
+ * Rules, not this one's.
4213
+ */
4214
+ declare function coerceTypedAnswer(field: CoercibleField, raw: string, opts?: CoerceOptions): Coerced;
4215
+ /** What a whole set of typed-in answers became. */
4216
+ interface CoercedAnswers {
4217
+ /** Ready to send to the store. Only the keys that coerced cleanly. */
4218
+ values: Record<string, unknown>;
4219
+ /** Field key → the sentence saying why that answer was not written. */
4220
+ refusals: Record<string, string>;
4221
+ /** The field keys the caller sent that this table has no Field for. */
4222
+ unknownKeys: string[];
4223
+ }
4224
+ /**
4225
+ * Every typed-in answer on one screen, coerced together — the shape the two
4226
+ * public doors and the import wizard actually need.
4227
+ *
4228
+ * Keys the table has no Field for are reported rather than dropped: the store
4229
+ * refuses an unknown key by name and a caller that quietly deleted it would
4230
+ * hide a real mismatch between a page and its table.
4231
+ */
4232
+ declare function coerceTypedAnswers(fields: readonly CoercibleField[], answers: Readonly<Record<string, unknown>>, opts?: {
4233
+ kernel?: KernelTargets | undefined;
4234
+ /** Choices per Field key, for the list columns. */
4235
+ options?: ReadonlyMap<string, ChoiceOptions> | undefined;
4236
+ /** Field key → the words that screen printed above the box. */
4237
+ labels?: Readonly<Record<string, string>> | undefined;
4238
+ }): CoercedAnswers;
4239
+
4068
4240
  /** The seven table types. Only these two carry custom fields (REC-34, DD-011). */
4069
4241
  type CustomFieldTableType = "entity" | "detail";
4070
4242
  /** What `custom.entity_table` answers about a registry token. */
@@ -6915,6 +7087,28 @@ interface RecordsClient {
6915
7087
  field_id: Uuid;
6916
7088
  patch: FieldPatch;
6917
7089
  }): Promise<RecordsResult<Uuid>>;
7090
+ /**
7091
+ * REL-DISP. THE WORDS ONE RELATION CELL SHOWS, resolved by the store through
7092
+ * that column's own display spec — one column or several, joined by its
7093
+ * separator. Never resolve a relation label any other way: the store's
7094
+ * `custom._words_for` is the one body that decides what a record is called, it
7095
+ * asks the visibility ladder BEFORE it reads the name, and a record this reader
7096
+ * may not open comes back as the withheld sentence rather than its name or id.
7097
+ * A value that is not an id is handed straight back — it is already words.
7098
+ */
7099
+ relationWords(args: {
7100
+ field_id: Uuid;
7101
+ value: string;
7102
+ }): Promise<RecordsResult<string | null>>;
7103
+ /**
7104
+ * The same answer for a WHOLE PAGE of cells in one round trip. Prefer this
7105
+ * wherever a grid, board, list or picker resolves more than one chip: the
7106
+ * per-id lane is what made a page of relation cells a page of requests.
7107
+ */
7108
+ relationWordsMany(args: {
7109
+ field_id: Uuid;
7110
+ record_ids: Uuid[];
7111
+ }): Promise<RecordsResult<Record<string, string>>>;
6918
7112
  /** Take a field off a table. Refuses the title field, the last field, and one another field reads through. */
6919
7113
  fieldRetire(args: {
6920
7114
  field_id: Uuid;
@@ -8290,4 +8484,4 @@ declare function useFieldMutation(): UseFieldMutation;
8290
8484
  */
8291
8485
  declare function useMergeField(key: string | null, state?: Record<string, unknown>): MergeFieldResolution | null;
8292
8486
 
8293
- export { ABSENCE_REASONS, ACTOR_VOCABULARY, type AbsenceReason, type Actor, type AggregateBucket, type AggregateFilter, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AggregateWindow, type AnonTokenBinding, type BookingAvailability, type BookingDeclared, type BookingSummary, type BookingWindow, COMPUTE_ON, CONTEXT_POLICIES, type CaptureField, type CaptureFileRef, type CaptureOutcome, type CaptureQuestion, type CaptureQueue, type CaptureQueueCounts, type CaptureQueueOptions, type CaptureQueuePorts, type CaptureQueueStore, type CaptureSheetFace, type CaptureSheetSummary, type CaptureSyncReport, type ChecklistDeclared, type ChecklistRequirement, type ChecklistRequirementKind, type ChecklistRoleSpec, type ChecklistRunStarted, type ChecklistRunStep, type ChecklistRunSummary, type ChecklistSpec, type ChecklistStepCompleted, type ChecklistStepSpec, type ChecklistTemplateShape, type ChecklistTemplateSummary, type ChecklistTrigger, type ChecklistTriggerKind, type ChoiceOption, type CommentThreadRead, type CommentWritten, type ComputeOn, type ContextPolicy, type ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DELIVERIES, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, type Delivery, type DigestPreview, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, ENTITY_TOKENS, type EnrichAlternate, type EnrichCell, type EnrichDeclared, type EnrichDueRow, type EnrichRun, type EnrichSource, type Enrichment, type EnrichmentSummary, type EntityFieldRights, type EntityFieldValue, type EntityRecordMatch, type EntityRecordRead, type EntityRecordsFound, type EntityTableFacts, type EntityToken, type ExternalPrincipalCard, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, type Field, type FieldBehavior, type FieldHistoryEntry, type FieldPatch, type FieldProposal, type FieldRule, type FieldSensitivity, type FieldSource, type FieldTypeWord, type ForbiddenEnvelopeWord, type FormSummary, type Freshness, type HiddenFieldNotice, type HistoryActor, type HistoryActorKind, type HistoryChange, type Home, type ImportBatchResult, type ImportColumnPlan, type ImportFinished, type ImportOpened, type ImportOutcome, type ImportPlan, type ImportPolicy, type ImportProposal, type ImportReport, type ImportRun, type InboundAddress, type InboundDeclared, KERNEL_TABLES, type KernelTableName, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, type MergeField, type MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, type MergeFieldSemanticType, type MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type MySubscription, type NewEntityFieldDeclaration, type NewFieldDeclaration, ON_DELETE, OVERRIDE_POLICIES, type OnDelete, type OverridePolicy, PARITY_FIELD_TYPES, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, PIPELINE_RULE_KINDS, type ParityFieldType, type ParityFieldTypeDescriptor, type PerValueAccessWord, type PermissionLevel, type PgError, type Pipeline, type PipelineColumn, type PipelineDeclared, type PipelineGate, type PipelineGatePreview, type PipelineMissingField, type PipelineMoveResult, type PipelineRule, type PipelineRuleKind, type PipelineSpec, type PipelineStage, type PipelineVerdict, type PortalCard, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalSummary, type PortalTableExposure, type PredictedRefusal, type ProvenancePointer, type PublishBinding, type QueuedCapture, type QueuedCaptureFile, type QueuedCaptureState, type QuietHours, REFUSALS_WORTH_REPEATING, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, type ReadRow, type ReadValue, type RecordComment, type RecordDocument, type RecordHistoryEntry, type RecordRead, type RecordRevision, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsChangeSink, type RecordsConfig, type RecordsDataSource, type RecordsError, type RecordsErrorCode, type RecordsErrorSink, type RecordsFilter, RecordsProvider, type RecordsProviderProps, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsResult, type RecordsTableQuery, type RegisteredTable, type Relation, type RelationBinding, type RelationCardinality, type RelationCarries, type RelationCoordinate, type RelationFlavor, type RelationProperties, type RelationTarget, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type RetiredActorWord, type Rule, type RuleAnswer, type RuleExpression, type RuleNodeKind, type RuleUse, STAGE_RULE_ENFORCEMENT, STAGE_RULE_ON_FAIL, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, type SavedViewRow, type SavedViewSpecIn, type StagePending, type StagePendingOnBoard, type StageRuleEnforcement, type StageRuleOnFail, type StageRuleWarning, type StaleWriteDetail, type StorageMode, type StoreDoorName, type StoreRefusalCode, type StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, type SubscriptionSpec, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, type Table, type TableCapacity, type TableDisplay, type TableOrigin, type TableProposal, type TableType, type Timestamp, type UseEntityFieldMutation, type UseFieldMutation, type UseRecordMutation, type UseRecordsOptions, type UseRecordsState, type Uuid, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, type ValueAlternate, type ValueAlternateKey, type ValueEnvelope, type ValueEnvelopeKey, type ValueSource, type WorkApprovalDecision, type WorkApprovalFiled, type WorkApprover, type WorkAssignment, type WorkAssignmentField, type WorkChange, type WorkDueState, type WorkGraph, type WorkInboxItem, type WorkInboxKind, type WorkInstantiation, type WorkListFlavour, type WorkListItem, type WorkOrigin, type WorkRecordState, type WorkSlotHold, type WorkState, type WorkTemplateNode, type WorkTemplateRelation, type WorkTurn, type WriteConflict, asPermissionLevel, atLeast, bookingPath, choiceSlug, choiceValuesOf, choicesOf, err, forgetAllOps, highestLevel, holdsARetiredChoice, indexedDbStore, isDecided, isOwnOp, isRecordsErr, isTheChosen, looksLikeAnId, mayDrag, measureKey, memoryStore, mintClientKey, mintOpId, ok, openCaptureQueue, optionKey, optionLabel, portalPath, publicFormPath, rememberedOpCount, scopeChip, tableShapeChanged, useEntityFieldMutation, useEntityFieldRights, useEntityFields, useEntityRecord, useEntityTable, useFieldMutation, useFields, useMergeField, useMyLevel, useMyLevels, useOptionalRecordsClient, useRecord, useRecordMutation, useRecords, useRecordsActor, useRecordsClient, useTable, useTables };
8487
+ export { ABSENCE_REASONS, ACTOR_VOCABULARY, type AbsenceReason, type Actor, type AggregateBucket, type AggregateFilter, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AggregateWindow, type AnonTokenBinding, type BookingAvailability, type BookingDeclared, type BookingSummary, type BookingWindow, COMPUTE_ON, CONTEXT_POLICIES, type CaptureField, type CaptureFileRef, type CaptureOutcome, type CaptureQuestion, type CaptureQueue, type CaptureQueueCounts, type CaptureQueueOptions, type CaptureQueuePorts, type CaptureQueueStore, type CaptureSheetFace, type CaptureSheetSummary, type CaptureSyncReport, type ChecklistDeclared, type ChecklistRequirement, type ChecklistRequirementKind, type ChecklistRoleSpec, type ChecklistRunStarted, type ChecklistRunStep, type ChecklistRunSummary, type ChecklistSpec, type ChecklistStepCompleted, type ChecklistStepSpec, type ChecklistTemplateShape, type ChecklistTemplateSummary, type ChecklistTrigger, type ChecklistTriggerKind, type ChoiceOption, type ChoiceOptions, type CoerceOptions, type Coerced, type CoercedAnswers, type CoercibleField, type CommentThreadRead, type CommentWritten, type ComputeOn, type ContextPolicy, type ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DELIVERIES, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, type Delivery, type DigestPreview, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, ENTITY_TOKENS, type EnrichAlternate, type EnrichCell, type EnrichDeclared, type EnrichDueRow, type EnrichRun, type EnrichSource, type Enrichment, type EnrichmentSummary, type EntityFieldRights, type EntityFieldValue, type EntityRecordMatch, type EntityRecordRead, type EntityRecordsFound, type EntityTableFacts, type EntityToken, type ExternalPrincipalCard, FIELD_KINDS, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, type Field, type FieldBehavior, type FieldHistoryEntry, type FieldKind, type FieldPatch, type FieldProposal, type FieldRule, type FieldSensitivity, type FieldSource, type FieldTypeWord, type ForbiddenEnvelopeWord, type FormSummary, type Freshness, type HiddenFieldNotice, type HistoryActor, type HistoryActorKind, type HistoryChange, type Home, type ImportBatchResult, type ImportColumnPlan, type ImportFinished, type ImportOpened, type ImportOutcome, type ImportPlan, type ImportPolicy, type ImportProposal, type ImportReport, type ImportRun, type InboundAddress, type InboundDeclared, KERNEL_TABLES, type KernelTableName, type KernelTargets, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, type MergeField, type MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, type MergeFieldSemanticType, type MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type MySubscription, type NewEntityFieldDeclaration, type NewFieldDeclaration, ON_DELETE, OVERRIDE_POLICIES, type OnDelete, type OverridePolicy, PARITY_FIELD_TYPES, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, PIPELINE_RULE_KINDS, type ParityFieldType, type ParityFieldTypeDescriptor, type PerValueAccessWord, type PermissionLevel, type PgError, type Pipeline, type PipelineColumn, type PipelineDeclared, type PipelineGate, type PipelineGatePreview, type PipelineMissingField, type PipelineMoveResult, type PipelineRule, type PipelineRuleKind, type PipelineSpec, type PipelineStage, type PipelineVerdict, type PortalCard, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalSummary, type PortalTableExposure, type PredictedRefusal, type ProvenancePointer, type PublishBinding, type QueuedCapture, type QueuedCaptureFile, type QueuedCaptureState, type QuietHours, REFUSALS_WORTH_REPEATING, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, type ReadRow, type ReadValue, type RecordComment, type RecordDocument, type RecordHistoryEntry, type RecordRead, type RecordRevision, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsChangeSink, type RecordsConfig, type RecordsDataSource, type RecordsError, type RecordsErrorCode, type RecordsErrorSink, type RecordsFilter, RecordsProvider, type RecordsProviderProps, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsResult, type RecordsTableQuery, type RegisteredTable, type Relation, type RelationBinding, type RelationCardinality, type RelationCarries, type RelationCoordinate, type RelationDisplay, type RelationFlavor, type RelationProperties, type RelationTarget, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type RetiredActorWord, type Rule, type RuleAnswer, type RuleExpression, type RuleNodeKind, type RuleUse, STAGE_RULE_ENFORCEMENT, STAGE_RULE_ON_FAIL, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, type SavedViewRow, type SavedViewSpecIn, type StagePending, type StagePendingOnBoard, type StageRuleEnforcement, type StageRuleOnFail, type StageRuleWarning, type StaleWriteDetail, type StorageMode, type StoreDoorName, type StoreRefusalCode, type StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, type SubscriptionSpec, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, type Table, type TableCapacity, type TableDisplay, type TableOrigin, type TableProposal, type TableType, type Timestamp, type UseEntityFieldMutation, type UseFieldMutation, type UseRecordMutation, type UseRecordsOptions, type UseRecordsState, type Uuid, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, type ValueAlternate, type ValueAlternateKey, type ValueEnvelope, type ValueEnvelopeKey, type ValueSource, type WorkApprovalDecision, type WorkApprovalFiled, type WorkApprover, type WorkAssignment, type WorkAssignmentField, type WorkChange, type WorkDueState, type WorkGraph, type WorkInboxItem, type WorkInboxKind, type WorkInstantiation, type WorkListFlavour, type WorkListItem, type WorkOrigin, type WorkRecordState, type WorkSlotHold, type WorkState, type WorkTemplateNode, type WorkTemplateRelation, type WorkTurn, type WriteConflict, asPermissionLevel, atLeast, bookingPath, choiceSlug, choiceValuesOf, choicesOf, coerceTypedAnswer, coerceTypedAnswers, coercionLabel, err, fieldKindFor, forgetAllOps, highestLevel, holdsARetiredChoice, indexedDbStore, isDecided, isOwnOp, isRecordsErr, isTheChosen, looksLikeAnId, mayDrag, measureKey, memoryStore, mintClientKey, mintOpId, ok, openCaptureQueue, optionKey, optionLabel, portalPath, publicFormPath, rememberedOpCount, scopeChip, tableShapeChanged, useEntityFieldMutation, useEntityFieldRights, useEntityFields, useEntityRecord, useEntityTable, useFieldMutation, useFields, useMergeField, useMyLevel, useMyLevels, useOptionalRecordsClient, useRecord, useRecordMutation, useRecords, useRecordsActor, useRecordsClient, useTable, useTables };
@@ -2263,6 +2263,16 @@ declare const STORE_DOORS: readonly [{
2263
2263
  readonly args: "p_organization_id uuid, p_container_id uuid, p_item_id uuid";
2264
2264
  readonly returns: "integer";
2265
2265
  readonly security: "definer";
2266
+ }, {
2267
+ readonly name: "relation_words";
2268
+ readonly args: "p_organization_id uuid, p_field_id uuid, p_value text";
2269
+ readonly returns: "text";
2270
+ readonly security: "definer";
2271
+ }, {
2272
+ readonly name: "relation_words_many";
2273
+ readonly args: "p_organization_id uuid, p_field_id uuid, p_record_ids uuid[]";
2274
+ readonly returns: "TABLE(record_id uuid, words text)";
2275
+ readonly security: "definer";
2266
2276
  }, {
2267
2277
  readonly name: "reopen_declared_doors";
2268
2278
  readonly args: "";
@@ -3172,13 +3182,13 @@ declare const STORE_REFUSAL_CODES: readonly [{
3172
3182
  readonly raised_by: "_booking_availability,_entity_custom_fields_guard,_take_op_id,_value_envelope,_work_shape_guard,actor_word,agg_assert_key,agg_sql,anon_token_issue,booking_declare,containment_parent,dashboard_block_normalize,dashboard_window_sql,doc_render_body,doc_render_write,doc_signature_write,enrich_declare,enrich_land,enrich_normalize,enrich_pin,entity_value_write,external_history_event,external_source_declare,external_stub_upsert,external_write_through,field_history,io_export,io_import_begin,io_import_finish,io_import_plan,io_import_report,io_proposal_accept,migrate_merge,migrate_reclass,my_levels,organization_clear,page_size,pin_agent_cells,pipeline_move,portal_declare,provenance_write,query_by_coordinates,query_rollup,record_update,record_write_many,relation_carry,rule_eval,rule_members,share_grant,share_lane_set,sign_request_create,sign_request_sign,subscription_declare,table_rules,visibility_as_of,work_approval_request,work_list,work_slot_hold";
3173
3183
  }, {
3174
3184
  readonly code: "23503";
3175
- readonly raised_by: "_booking_availability,_checklist_instantiate,_containment_guard,_field_document_for,_pipeline_stage_key,_record_rule_uses,agg_digest_assemble,anon_publish,anon_rate_take,anon_token_issue,anon_write,assert_organization_wall,booking_cancel,booking_confirm,booking_declare,booking_hold,booking_reschedule,capture_publish,checklist_declare,checklist_steps_table,comment_write,dashboard_declare,delete_rule,doc_sign,doc_template_save,enrich_declare,enrich_due,enrich_land,form_declare,form_submit,home_add,inbound_declare,inbound_mail_land,inbound_set,io_comment_write,io_import_begin,io_import_finish,io_import_report,io_import_rows,io_proposal_accept,migrate_demote,migrate_promote,pipeline_board,pipeline_declare,pipeline_move,pipeline_read,pipeline_transition_refusal,promote_field,promote_table,record_applicability,record_reparent,relation_carry,relation_own,resolve_first_match,rule_applies,rule_declare,rule_eval,rule_members,rule_run,sign_request_create,subscription_mute,subscription_preview,view_declare,work_set_state,work_take_assignment,work_template_instantiate";
3185
+ readonly raised_by: "_booking_availability,_checklist_instantiate,_containment_guard,_display_spec_for,_field_document_for,_pipeline_stage_key,_record_rule_uses,agg_digest_assemble,anon_publish,anon_rate_take,anon_token_issue,anon_write,assert_organization_wall,booking_cancel,booking_confirm,booking_declare,booking_hold,booking_reschedule,capture_publish,checklist_declare,checklist_steps_table,comment_write,dashboard_declare,delete_rule,doc_sign,doc_template_save,enrich_declare,enrich_due,enrich_land,form_declare,form_submit,home_add,inbound_declare,inbound_mail_land,inbound_set,io_comment_write,io_import_begin,io_import_finish,io_import_report,io_import_rows,io_proposal_accept,migrate_demote,migrate_promote,pipeline_board,pipeline_declare,pipeline_move,pipeline_read,pipeline_transition_refusal,promote_field,promote_table,record_applicability,record_reparent,relation_carry,relation_own,resolve_first_match,rule_applies,rule_declare,rule_eval,rule_members,rule_run,sign_request_create,subscription_mute,subscription_preview,view_declare,work_set_state,work_take_assignment,work_template_instantiate";
3176
3186
  }, {
3177
3187
  readonly code: "23505";
3178
3188
  readonly raised_by: "_unique_rule_holds,doc_sign,doc_signature_write,entity_field_declare,field_declare,home_add,inbound_declare,io_proposal_accept,relation_carry,relation_own,share_grant,sign_request_cancel,sign_request_create,table_share_outside_invite,table_share_outside_resend,work_approval_decide,work_slot_hold";
3179
3189
  }, {
3180
3190
  readonly code: "23514";
3181
- readonly raised_by: "_checklist_instantiate,_checklist_step_guard,_containment_guard,_dated_values_guard,_derived_fields,_entity_custom_fields_guard,_field_class_guard,_field_document_for,_field_shape_guard,_field_type_parity_guard,_merge_field_shape_guard,_merge_field_temporal_guard,_promoted_field_cap_guard,_record_rule_uses,_resolve_choice_words,_rule_shape_guard,_rule_topology_guard,_store_relation_edge_names_its_field,_table_columns_word_guard,_table_shape_guard,_undeclared_key_guard,_value_envelope,_work_shape_guard,_workdoors_approval_guard,assert_columns_are_defined,assert_entity_is_organization_scoped,booking_declare,capture_publish,capture_sheet_declare,checklist_declare,checklist_step_complete,doc_sign,doc_signature_write,doc_template_save,entity_field_declare,entity_field_retire,entity_field_update,entity_records_find,entity_table,field_declare,field_retire,field_update,home_add,io_import_rows,migrate_merge,relation_carry,relation_own,sign_request_create,sign_request_sign,table_declare,validate_value_envelope,validate_values,work_set_state,work_slots_declare,work_take_assignment,work_template_instantiate";
3191
+ readonly raised_by: "_checklist_instantiate,_checklist_step_guard,_containment_guard,_dated_values_guard,_derived_fields,_display_spec_for,_entity_custom_fields_guard,_field_class_guard,_field_document_for,_field_shape_guard,_field_type_parity_guard,_merge_field_shape_guard,_merge_field_temporal_guard,_promoted_field_cap_guard,_record_rule_uses,_resolve_choice_words,_rule_shape_guard,_rule_topology_guard,_store_relation_edge_names_its_field,_table_columns_word_guard,_table_shape_guard,_undeclared_key_guard,_value_envelope,_with_display,_work_shape_guard,_workdoors_approval_guard,assert_columns_are_defined,assert_entity_is_organization_scoped,booking_declare,capture_publish,capture_sheet_declare,checklist_declare,checklist_step_complete,doc_sign,doc_signature_write,doc_template_save,entity_field_declare,entity_field_retire,entity_field_update,entity_records_find,entity_table,field_declare,field_retire,field_update,home_add,io_import_rows,migrate_merge,relation_carry,relation_own,sign_request_create,sign_request_sign,table_declare,validate_value_envelope,validate_values,work_set_state,work_slots_declare,work_take_assignment,work_template_instantiate";
3182
3192
  }, {
3183
3193
  readonly code: "40001";
3184
3194
  readonly raised_by: "has_visibility_at";
@@ -3767,6 +3777,31 @@ interface FieldRule {
3767
3777
  * `custom.field` — the ONE definitions table (FLD-8), organization-scoped, so
3768
3778
  * two organizations add different fields to the same standard table.
3769
3779
  */
3780
+ /**
3781
+ * WHICH OF THE OTHER RECORD'S COLUMNS A RELATION SHOWS (REL-DISP, 2026-09-21).
3782
+ *
3783
+ * A Table has ONE stored default reference column — its `title_field` — and until
3784
+ * this existed every relation pointing at that Table could display that column and
3785
+ * nothing else. A Jobs board could read "Maria Chen" but never "Maria Chen —
3786
+ * Rincon", and two columns could not be joined into one string at all.
3787
+ *
3788
+ * ABSENT MEANS THE TABLE'S OWN COLUMN. A field with no `display` resolves exactly
3789
+ * as it did before, so nothing changes for a column nobody has given a spec to.
3790
+ *
3791
+ * The store judges it once, in `custom._display_spec_for`: every column named must
3792
+ * exist on the target Table, and the refusal names the one that does not. It is
3793
+ * resolved by ONE body, `custom._words_for`, which `custom.record_words`,
3794
+ * `custom._card_words`, `custom.relation_words` and `custom.relation_words_many`
3795
+ * are all one-liners onto — so the thirteen store-side readers inherit it too.
3796
+ *
3797
+ * A display column that is itself a relation resolves ONE hop and never a second.
3798
+ */
3799
+ interface RelationDisplay {
3800
+ /** The target's columns, in the order they are shown. */
3801
+ columns: string[];
3802
+ /** What goes between them. Defaults to a single space. */
3803
+ separator: string;
3804
+ }
3770
3805
  interface Field {
3771
3806
  id: Uuid;
3772
3807
  organization_id: Uuid;
@@ -3795,6 +3830,8 @@ interface Field {
3795
3830
  on_target_delete: OnDelete | null;
3796
3831
  /** REL-9. The reverse is visible from both ends and is NOT a second Field. */
3797
3832
  inverse_key: string | null;
3833
+ /** REL-DISP. Which of the target's columns this one shows. Null = the Table's own. */
3834
+ display: RelationDisplay | null;
3798
3835
  source: FieldSource;
3799
3836
  source_config: Record<string, unknown>;
3800
3837
  /** FLD-9. A Formula declares whether it computes on read or on write. */
@@ -3922,6 +3959,12 @@ interface NewFieldDeclaration {
3922
3959
  relation_target?: Uuid;
3923
3960
  /** REL-2. What happens to this record when the thing it points at goes. */
3924
3961
  on_target_delete?: OnDelete;
3962
+ /**
3963
+ * REL-DISP. Which of the target's columns this one shows, and what joins them.
3964
+ * A bare column name and a plain list are both accepted by the door and
3965
+ * normalised; leaving it out keeps the target Table's own reference column.
3966
+ */
3967
+ display?: RelationDisplay | string[] | string;
3925
3968
  /**
3926
3969
  * Presentation and behaviour settings the store carries verbatim — a long
3927
3970
  * text's `multiline`, a list's existing options table. The door has always
@@ -3991,6 +4034,12 @@ interface FieldPatch {
3991
4034
  /** REL / FLD-11: re-point the column. The old edges are withdrawn by the door. */
3992
4035
  relation_target?: Uuid;
3993
4036
  on_target_delete?: OnDelete;
4037
+ /**
4038
+ * REL-DISP. Which of the target's columns this one shows. `null` REMOVES the
4039
+ * spec and the column goes back to whatever the table it points at is titled by;
4040
+ * the door refuses it by name on a column that points at nothing.
4041
+ */
4042
+ display?: RelationDisplay | string[] | string | null;
3994
4043
  /** SEAT-SUITES: whether the store builds an index for this column, and a unique one. */
3995
4044
  promoted?: boolean;
3996
4045
  unique?: boolean;
@@ -4065,6 +4114,129 @@ declare function holdsARetiredChoice(document: RecordDocument | undefined, field
4065
4114
  /** True when a token looks like a uuid — which a choice value is no longer allowed to be. */
4066
4115
  declare function looksLikeAnId(value: unknown): boolean;
4067
4116
 
4117
+ /**
4118
+ * EVERYTHING THIS FILE NEEDS TO KNOW ABOUT A FIELD, AND NOTHING ELSE.
4119
+ *
4120
+ * A full `Field` satisfies it, and so does every narrower shape the store
4121
+ * hands to a screen — `CaptureField` on a phone with no network, the Field
4122
+ * documents `custom.form_public` and `custom.booking_public` publish to a
4123
+ * stranger. Asking for the whole `Field` would have meant the capture sheet
4124
+ * keeping its own `Number(raw)`, which is exactly the duplication this file
4125
+ * exists to end.
4126
+ */
4127
+ interface CoercibleField {
4128
+ /** Named so the doc above is checkable: a full {@link Field} satisfies this. */
4129
+ key: string;
4130
+ label?: string | null;
4131
+ name?: string | null;
4132
+ /** FLD-1. One of five behaviours; an unknown word is treated as text. */
4133
+ type?: string | null;
4134
+ multi?: boolean | null;
4135
+ unit?: string | null;
4136
+ format?: string | null;
4137
+ config?: Record<string, unknown> | null | undefined;
4138
+ relation_target?: string | null;
4139
+ }
4140
+ /**
4141
+ * The kind of value one Field holds, resolved from its DECLARATION only — the
4142
+ * behaviour, the modifiers, the format, the relation target and the config,
4143
+ * because those are what the store stores. A screen that guessed from a value
4144
+ * would answer differently for an empty record.
4145
+ *
4146
+ * `plain_text`, `long_text`, `number` and `boolean` are behaviours that carry
4147
+ * no parity type of their own; every other word here is a parity type.
4148
+ */
4149
+ declare const FIELD_KINDS: readonly ["attachment", "checkbox", "currency", "datetime", "email", "formula", "json", "long_text", "lookup", "member", "multi_select", "number", "percent", "phone", "relation", "rollup", "select", "text", "url"];
4150
+ /**
4151
+ * 🚨 THE UNION IS DERIVED FROM THE LIST ABOVE, and the list is what the
4152
+ * coverage test walks. Add a kind here and the test drives it; give it no arm
4153
+ * in `coerceTypedAnswer` and the test says so, instead of the new kind falling
4154
+ * quietly through `default:` and a value of the wrong shape reaching the store
4155
+ * — which is the whole defect this file closes.
4156
+ */
4157
+ type FieldKind = (typeof FIELD_KINDS)[number];
4158
+ /** The kernel Table ids REC-31 pins the two special relations to. */
4159
+ interface KernelTargets {
4160
+ /** The kernel `File` Table — a relation pointing here is an attachment. */
4161
+ file?: string | undefined;
4162
+ /** The kernel `Person` Table — a relation pointing here names a person. */
4163
+ person?: string | undefined;
4164
+ }
4165
+ /**
4166
+ * Which kind of value this Field holds.
4167
+ *
4168
+ * This is the ONE classifier. `@ai-matrx/records-ui`'s `editorKindFor` — which
4169
+ * decides which editor to DRAW — delegates to it, so the editor a person types
4170
+ * into and the coercion applied to what they typed can never disagree about
4171
+ * the same column. They did disagree before this moved here; that is the whole
4172
+ * class of grid defect September was spent closing.
4173
+ */
4174
+ declare function fieldKindFor(field: CoercibleField, kernel?: KernelTargets): FieldKind;
4175
+ /** One Field's options, indexed the way a typed word has to be looked up. */
4176
+ interface ChoiceOptions {
4177
+ /**
4178
+ * Lower-cased label, option key and option id, each pointing at the OPTION
4179
+ * RECORD'S ID — which is what a list Field stores (FLD-5/FLD-6).
4180
+ */
4181
+ byWord: Map<string, string>;
4182
+ /** The labels, in order, so a refusal can say what is on offer. */
4183
+ labels: string[];
4184
+ }
4185
+ /** What one answer became, or the sentence saying why it did not. */
4186
+ type Coerced = {
4187
+ value: unknown;
4188
+ } | {
4189
+ refusal: string;
4190
+ unmatched?: string[];
4191
+ };
4192
+ interface CoerceOptions {
4193
+ /** This Field's choices, when the caller has loaded them. */
4194
+ options?: ChoiceOptions | undefined;
4195
+ /** The kernel File/Person Table ids, for classifying relations. */
4196
+ kernel?: KernelTargets | undefined;
4197
+ /**
4198
+ * The Field's name as this caller writes it. Defaults to the Field's own
4199
+ * label. A screen passes the same words it printed above the box.
4200
+ */
4201
+ label?: string | undefined;
4202
+ }
4203
+ /** The Field's name in plain words — never its key on a screen. */
4204
+ declare function coercionLabel(field: CoercibleField): string;
4205
+ /**
4206
+ * Turn ONE typed-in string into the value this Field holds — or say, in a
4207
+ * sentence a person can act on, why it is not one.
4208
+ *
4209
+ * An empty answer is `null` for every kind: a blank means "no answer here",
4210
+ * and clearing a value is a thing a person means to do. Whether the Field may
4211
+ * be blank is the store's question, asked with the Field's `required` and its
4212
+ * Rules, not this one's.
4213
+ */
4214
+ declare function coerceTypedAnswer(field: CoercibleField, raw: string, opts?: CoerceOptions): Coerced;
4215
+ /** What a whole set of typed-in answers became. */
4216
+ interface CoercedAnswers {
4217
+ /** Ready to send to the store. Only the keys that coerced cleanly. */
4218
+ values: Record<string, unknown>;
4219
+ /** Field key → the sentence saying why that answer was not written. */
4220
+ refusals: Record<string, string>;
4221
+ /** The field keys the caller sent that this table has no Field for. */
4222
+ unknownKeys: string[];
4223
+ }
4224
+ /**
4225
+ * Every typed-in answer on one screen, coerced together — the shape the two
4226
+ * public doors and the import wizard actually need.
4227
+ *
4228
+ * Keys the table has no Field for are reported rather than dropped: the store
4229
+ * refuses an unknown key by name and a caller that quietly deleted it would
4230
+ * hide a real mismatch between a page and its table.
4231
+ */
4232
+ declare function coerceTypedAnswers(fields: readonly CoercibleField[], answers: Readonly<Record<string, unknown>>, opts?: {
4233
+ kernel?: KernelTargets | undefined;
4234
+ /** Choices per Field key, for the list columns. */
4235
+ options?: ReadonlyMap<string, ChoiceOptions> | undefined;
4236
+ /** Field key → the words that screen printed above the box. */
4237
+ labels?: Readonly<Record<string, string>> | undefined;
4238
+ }): CoercedAnswers;
4239
+
4068
4240
  /** The seven table types. Only these two carry custom fields (REC-34, DD-011). */
4069
4241
  type CustomFieldTableType = "entity" | "detail";
4070
4242
  /** What `custom.entity_table` answers about a registry token. */
@@ -6915,6 +7087,28 @@ interface RecordsClient {
6915
7087
  field_id: Uuid;
6916
7088
  patch: FieldPatch;
6917
7089
  }): Promise<RecordsResult<Uuid>>;
7090
+ /**
7091
+ * REL-DISP. THE WORDS ONE RELATION CELL SHOWS, resolved by the store through
7092
+ * that column's own display spec — one column or several, joined by its
7093
+ * separator. Never resolve a relation label any other way: the store's
7094
+ * `custom._words_for` is the one body that decides what a record is called, it
7095
+ * asks the visibility ladder BEFORE it reads the name, and a record this reader
7096
+ * may not open comes back as the withheld sentence rather than its name or id.
7097
+ * A value that is not an id is handed straight back — it is already words.
7098
+ */
7099
+ relationWords(args: {
7100
+ field_id: Uuid;
7101
+ value: string;
7102
+ }): Promise<RecordsResult<string | null>>;
7103
+ /**
7104
+ * The same answer for a WHOLE PAGE of cells in one round trip. Prefer this
7105
+ * wherever a grid, board, list or picker resolves more than one chip: the
7106
+ * per-id lane is what made a page of relation cells a page of requests.
7107
+ */
7108
+ relationWordsMany(args: {
7109
+ field_id: Uuid;
7110
+ record_ids: Uuid[];
7111
+ }): Promise<RecordsResult<Record<string, string>>>;
6918
7112
  /** Take a field off a table. Refuses the title field, the last field, and one another field reads through. */
6919
7113
  fieldRetire(args: {
6920
7114
  field_id: Uuid;
@@ -8290,4 +8484,4 @@ declare function useFieldMutation(): UseFieldMutation;
8290
8484
  */
8291
8485
  declare function useMergeField(key: string | null, state?: Record<string, unknown>): MergeFieldResolution | null;
8292
8486
 
8293
- export { ABSENCE_REASONS, ACTOR_VOCABULARY, type AbsenceReason, type Actor, type AggregateBucket, type AggregateFilter, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AggregateWindow, type AnonTokenBinding, type BookingAvailability, type BookingDeclared, type BookingSummary, type BookingWindow, COMPUTE_ON, CONTEXT_POLICIES, type CaptureField, type CaptureFileRef, type CaptureOutcome, type CaptureQuestion, type CaptureQueue, type CaptureQueueCounts, type CaptureQueueOptions, type CaptureQueuePorts, type CaptureQueueStore, type CaptureSheetFace, type CaptureSheetSummary, type CaptureSyncReport, type ChecklistDeclared, type ChecklistRequirement, type ChecklistRequirementKind, type ChecklistRoleSpec, type ChecklistRunStarted, type ChecklistRunStep, type ChecklistRunSummary, type ChecklistSpec, type ChecklistStepCompleted, type ChecklistStepSpec, type ChecklistTemplateShape, type ChecklistTemplateSummary, type ChecklistTrigger, type ChecklistTriggerKind, type ChoiceOption, type CommentThreadRead, type CommentWritten, type ComputeOn, type ContextPolicy, type ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DELIVERIES, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, type Delivery, type DigestPreview, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, ENTITY_TOKENS, type EnrichAlternate, type EnrichCell, type EnrichDeclared, type EnrichDueRow, type EnrichRun, type EnrichSource, type Enrichment, type EnrichmentSummary, type EntityFieldRights, type EntityFieldValue, type EntityRecordMatch, type EntityRecordRead, type EntityRecordsFound, type EntityTableFacts, type EntityToken, type ExternalPrincipalCard, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, type Field, type FieldBehavior, type FieldHistoryEntry, type FieldPatch, type FieldProposal, type FieldRule, type FieldSensitivity, type FieldSource, type FieldTypeWord, type ForbiddenEnvelopeWord, type FormSummary, type Freshness, type HiddenFieldNotice, type HistoryActor, type HistoryActorKind, type HistoryChange, type Home, type ImportBatchResult, type ImportColumnPlan, type ImportFinished, type ImportOpened, type ImportOutcome, type ImportPlan, type ImportPolicy, type ImportProposal, type ImportReport, type ImportRun, type InboundAddress, type InboundDeclared, KERNEL_TABLES, type KernelTableName, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, type MergeField, type MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, type MergeFieldSemanticType, type MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type MySubscription, type NewEntityFieldDeclaration, type NewFieldDeclaration, ON_DELETE, OVERRIDE_POLICIES, type OnDelete, type OverridePolicy, PARITY_FIELD_TYPES, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, PIPELINE_RULE_KINDS, type ParityFieldType, type ParityFieldTypeDescriptor, type PerValueAccessWord, type PermissionLevel, type PgError, type Pipeline, type PipelineColumn, type PipelineDeclared, type PipelineGate, type PipelineGatePreview, type PipelineMissingField, type PipelineMoveResult, type PipelineRule, type PipelineRuleKind, type PipelineSpec, type PipelineStage, type PipelineVerdict, type PortalCard, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalSummary, type PortalTableExposure, type PredictedRefusal, type ProvenancePointer, type PublishBinding, type QueuedCapture, type QueuedCaptureFile, type QueuedCaptureState, type QuietHours, REFUSALS_WORTH_REPEATING, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, type ReadRow, type ReadValue, type RecordComment, type RecordDocument, type RecordHistoryEntry, type RecordRead, type RecordRevision, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsChangeSink, type RecordsConfig, type RecordsDataSource, type RecordsError, type RecordsErrorCode, type RecordsErrorSink, type RecordsFilter, RecordsProvider, type RecordsProviderProps, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsResult, type RecordsTableQuery, type RegisteredTable, type Relation, type RelationBinding, type RelationCardinality, type RelationCarries, type RelationCoordinate, type RelationFlavor, type RelationProperties, type RelationTarget, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type RetiredActorWord, type Rule, type RuleAnswer, type RuleExpression, type RuleNodeKind, type RuleUse, STAGE_RULE_ENFORCEMENT, STAGE_RULE_ON_FAIL, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, type SavedViewRow, type SavedViewSpecIn, type StagePending, type StagePendingOnBoard, type StageRuleEnforcement, type StageRuleOnFail, type StageRuleWarning, type StaleWriteDetail, type StorageMode, type StoreDoorName, type StoreRefusalCode, type StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, type SubscriptionSpec, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, type Table, type TableCapacity, type TableDisplay, type TableOrigin, type TableProposal, type TableType, type Timestamp, type UseEntityFieldMutation, type UseFieldMutation, type UseRecordMutation, type UseRecordsOptions, type UseRecordsState, type Uuid, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, type ValueAlternate, type ValueAlternateKey, type ValueEnvelope, type ValueEnvelopeKey, type ValueSource, type WorkApprovalDecision, type WorkApprovalFiled, type WorkApprover, type WorkAssignment, type WorkAssignmentField, type WorkChange, type WorkDueState, type WorkGraph, type WorkInboxItem, type WorkInboxKind, type WorkInstantiation, type WorkListFlavour, type WorkListItem, type WorkOrigin, type WorkRecordState, type WorkSlotHold, type WorkState, type WorkTemplateNode, type WorkTemplateRelation, type WorkTurn, type WriteConflict, asPermissionLevel, atLeast, bookingPath, choiceSlug, choiceValuesOf, choicesOf, err, forgetAllOps, highestLevel, holdsARetiredChoice, indexedDbStore, isDecided, isOwnOp, isRecordsErr, isTheChosen, looksLikeAnId, mayDrag, measureKey, memoryStore, mintClientKey, mintOpId, ok, openCaptureQueue, optionKey, optionLabel, portalPath, publicFormPath, rememberedOpCount, scopeChip, tableShapeChanged, useEntityFieldMutation, useEntityFieldRights, useEntityFields, useEntityRecord, useEntityTable, useFieldMutation, useFields, useMergeField, useMyLevel, useMyLevels, useOptionalRecordsClient, useRecord, useRecordMutation, useRecords, useRecordsActor, useRecordsClient, useTable, useTables };
8487
+ export { ABSENCE_REASONS, ACTOR_VOCABULARY, type AbsenceReason, type Actor, type AggregateBucket, type AggregateFilter, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AggregateWindow, type AnonTokenBinding, type BookingAvailability, type BookingDeclared, type BookingSummary, type BookingWindow, COMPUTE_ON, CONTEXT_POLICIES, type CaptureField, type CaptureFileRef, type CaptureOutcome, type CaptureQuestion, type CaptureQueue, type CaptureQueueCounts, type CaptureQueueOptions, type CaptureQueuePorts, type CaptureQueueStore, type CaptureSheetFace, type CaptureSheetSummary, type CaptureSyncReport, type ChecklistDeclared, type ChecklistRequirement, type ChecklistRequirementKind, type ChecklistRoleSpec, type ChecklistRunStarted, type ChecklistRunStep, type ChecklistRunSummary, type ChecklistSpec, type ChecklistStepCompleted, type ChecklistStepSpec, type ChecklistTemplateShape, type ChecklistTemplateSummary, type ChecklistTrigger, type ChecklistTriggerKind, type ChoiceOption, type ChoiceOptions, type CoerceOptions, type Coerced, type CoercedAnswers, type CoercibleField, type CommentThreadRead, type CommentWritten, type ComputeOn, type ContextPolicy, type ConversationScope, type ConversationScopeContext, type CustomFieldTableType, DELIVERIES, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, type Delivery, type DigestPreview, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, ENTITY_TOKENS, type EnrichAlternate, type EnrichCell, type EnrichDeclared, type EnrichDueRow, type EnrichRun, type EnrichSource, type Enrichment, type EnrichmentSummary, type EntityFieldRights, type EntityFieldValue, type EntityRecordMatch, type EntityRecordRead, type EntityRecordsFound, type EntityTableFacts, type EntityToken, type ExternalPrincipalCard, FIELD_KINDS, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, type Field, type FieldBehavior, type FieldHistoryEntry, type FieldKind, type FieldPatch, type FieldProposal, type FieldRule, type FieldSensitivity, type FieldSource, type FieldTypeWord, type ForbiddenEnvelopeWord, type FormSummary, type Freshness, type HiddenFieldNotice, type HistoryActor, type HistoryActorKind, type HistoryChange, type Home, type ImportBatchResult, type ImportColumnPlan, type ImportFinished, type ImportOpened, type ImportOutcome, type ImportPlan, type ImportPolicy, type ImportProposal, type ImportReport, type ImportRun, type InboundAddress, type InboundDeclared, KERNEL_TABLES, type KernelTableName, type KernelTargets, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, type MergeField, type MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, type MergeFieldSemanticType, type MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type MySubscription, type NewEntityFieldDeclaration, type NewFieldDeclaration, ON_DELETE, OVERRIDE_POLICIES, type OnDelete, type OverridePolicy, PARITY_FIELD_TYPES, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, PIPELINE_RULE_KINDS, type ParityFieldType, type ParityFieldTypeDescriptor, type PerValueAccessWord, type PermissionLevel, type PgError, type Pipeline, type PipelineColumn, type PipelineDeclared, type PipelineGate, type PipelineGatePreview, type PipelineMissingField, type PipelineMoveResult, type PipelineRule, type PipelineRuleKind, type PipelineSpec, type PipelineStage, type PipelineVerdict, type PortalCard, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalSummary, type PortalTableExposure, type PredictedRefusal, type ProvenancePointer, type PublishBinding, type QueuedCapture, type QueuedCaptureFile, type QueuedCaptureState, type QuietHours, REFUSALS_WORTH_REPEATING, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, type ReadRow, type ReadValue, type RecordComment, type RecordDocument, type RecordHistoryEntry, type RecordRead, type RecordRevision, type RecordScopeComment, type RecordScopeContext, type RecordScopeField, type RecordScopeHistoryEntry, type RecordScopeRelation, type RecordScopeWithheld, type RecordsActor, type RecordsChangeSink, type RecordsConfig, type RecordsDataSource, type RecordsError, type RecordsErrorCode, type RecordsErrorSink, type RecordsFilter, RecordsProvider, type RecordsProviderProps, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsResult, type RecordsTableQuery, type RegisteredTable, type Relation, type RelationBinding, type RelationCardinality, type RelationCarries, type RelationCoordinate, type RelationDisplay, type RelationFlavor, type RelationProperties, type RelationTarget, type ResolutionTriple, type ResolvedPublishBinding, type RestorePreview, type RestoreResult, type RetiredActorWord, type Rule, type RuleAnswer, type RuleExpression, type RuleNodeKind, type RuleUse, STAGE_RULE_ENFORCEMENT, STAGE_RULE_ON_FAIL, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, type SavedViewRow, type SavedViewSpecIn, type StagePending, type StagePendingOnBoard, type StageRuleEnforcement, type StageRuleOnFail, type StageRuleWarning, type StaleWriteDetail, type StorageMode, type StoreDoorName, type StoreRefusalCode, type StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, type SubscriptionSpec, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, type Table, type TableCapacity, type TableDisplay, type TableOrigin, type TableProposal, type TableType, type Timestamp, type UseEntityFieldMutation, type UseFieldMutation, type UseRecordMutation, type UseRecordsOptions, type UseRecordsState, type Uuid, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, type ValueAlternate, type ValueAlternateKey, type ValueEnvelope, type ValueEnvelopeKey, type ValueSource, type WorkApprovalDecision, type WorkApprovalFiled, type WorkApprover, type WorkAssignment, type WorkAssignmentField, type WorkChange, type WorkDueState, type WorkGraph, type WorkInboxItem, type WorkInboxKind, type WorkInstantiation, type WorkListFlavour, type WorkListItem, type WorkOrigin, type WorkRecordState, type WorkSlotHold, type WorkState, type WorkTemplateNode, type WorkTemplateRelation, type WorkTurn, type WriteConflict, asPermissionLevel, atLeast, bookingPath, choiceSlug, choiceValuesOf, choicesOf, coerceTypedAnswer, coerceTypedAnswers, coercionLabel, err, fieldKindFor, forgetAllOps, highestLevel, holdsARetiredChoice, indexedDbStore, isDecided, isOwnOp, isRecordsErr, isTheChosen, looksLikeAnId, mayDrag, measureKey, memoryStore, mintClientKey, mintOpId, ok, openCaptureQueue, optionKey, optionLabel, portalPath, publicFormPath, rememberedOpCount, scopeChip, tableShapeChanged, useEntityFieldMutation, useEntityFieldRights, useEntityFields, useEntityRecord, useEntityTable, useFieldMutation, useFields, useMergeField, useMyLevel, useMyLevels, useOptionalRecordsClient, useRecord, useRecordMutation, useRecords, useRecordsActor, useRecordsClient, useTable, useTables };