@ai-matrx/records 0.42.0 → 0.44.1

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.
@@ -2075,6 +2075,11 @@ declare const STORE_DOORS: readonly [{
2075
2075
  readonly args: "p_organization_id uuid, p_table_id uuid, p_by_id boolean DEFAULT false, p_limit integer DEFAULT 200, p_offset integer DEFAULT 0";
2076
2076
  readonly returns: "TABLE(id uuid, document jsonb, level permission_level)";
2077
2077
  readonly security: "definer";
2078
+ }, {
2079
+ readonly name: "read_records_by_ids";
2080
+ readonly args: "p_organization_id uuid, p_table_id uuid, p_record_ids uuid[], p_by_id boolean DEFAULT false";
2081
+ readonly returns: "TABLE(id uuid, document jsonb, level permission_level)";
2082
+ readonly security: "definer";
2078
2083
  }, {
2079
2084
  readonly name: "realtime_topic_admits";
2080
2085
  readonly args: "p_topic text";
@@ -2195,6 +2200,11 @@ declare const STORE_DOORS: readonly [{
2195
2200
  readonly args: "p_organization_id uuid, p_record_id uuid";
2196
2201
  readonly returns: "TABLE(field_key text, field_id uuid, value jsonb, value_version integer, source jsonb, absent_reason text, actor text, on_behalf_of text, written_at timestamp with time zone, alternates jsonb)";
2197
2202
  readonly security: "definer";
2203
+ }, {
2204
+ readonly name: "record_words";
2205
+ readonly args: "p_organization_id uuid, p_record_id uuid, p_noun text DEFAULT NULL::text";
2206
+ readonly returns: "text";
2207
+ readonly security: "definer";
2198
2208
  }, {
2199
2209
  readonly name: "record_write";
2200
2210
  readonly args: "p_organization_id uuid, p_table_id uuid, p_data jsonb";
@@ -2250,6 +2260,16 @@ declare const STORE_DOORS: readonly [{
2250
2260
  readonly args: "p_organization_id uuid, p_container_id uuid, p_item_id uuid";
2251
2261
  readonly returns: "integer";
2252
2262
  readonly security: "definer";
2263
+ }, {
2264
+ readonly name: "relation_words";
2265
+ readonly args: "p_organization_id uuid, p_field_id uuid, p_value text";
2266
+ readonly returns: "text";
2267
+ readonly security: "definer";
2268
+ }, {
2269
+ readonly name: "relation_words_many";
2270
+ readonly args: "p_organization_id uuid, p_field_id uuid, p_record_ids uuid[]";
2271
+ readonly returns: "TABLE(record_id uuid, words text)";
2272
+ readonly security: "definer";
2253
2273
  }, {
2254
2274
  readonly name: "reopen_declared_doors";
2255
2275
  readonly args: "";
@@ -3138,7 +3158,7 @@ declare const STORE_KNOBS: readonly [{
3138
3158
  */
3139
3159
  declare const STORE_REFUSAL_CODES: readonly [{
3140
3160
  readonly code: "02000";
3141
- readonly raised_by: "_checklist_instantiate,checklist_declare,checklist_run,checklist_step_complete,checklist_step_refusal,checklist_template_shape,conversation_scope_bind,dashboard_delete,dashboard_run,doc_letterhead,doc_render_body,doc_render_document,doc_render_read,doc_sign,doc_signature_intact,doc_signature_read,doc_template_delete,doc_template_read,doc_template_save,enrich_pin,entity_field_retire,entity_field_update,entity_record_read,entity_value_write,external_history_event,external_rows,external_stub_upsert,external_writes_set,io_restore,migrate_delete,migrate_extract_parent,migrate_merge,migrate_reclass,migrate_rename,migrate_reparent,migrate_retype,migrate_split,migrate_undo,organization_clear,portal_card,portal_declare,portal_invite,portal_preview,portal_principal_bind,portal_revoke,read_record,record_delete,record_restore,record_restore_preview,record_table,record_update,relation_uncarry,share_access,share_grant,share_lane_set,share_people,share_revoke,sign_request_cancel,sign_request_create,sign_request_remind,sign_request_unchanged,table_share_outside_accept,table_share_outside_invite,table_share_outside_resend,table_share_outside_revoke,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_assign,work_record_states,work_set_state";
3161
+ readonly raised_by: "_checklist_instantiate,_table_share_invite_payload,checklist_declare,checklist_run,checklist_step_complete,checklist_step_refusal,checklist_template_shape,conversation_scope_bind,dashboard_delete,dashboard_run,doc_letterhead,doc_render_body,doc_render_document,doc_render_read,doc_sign,doc_signature_intact,doc_signature_read,doc_template_delete,doc_template_read,doc_template_save,enrich_pin,entity_field_retire,entity_field_update,entity_record_read,entity_value_write,external_history_event,external_rows,external_stub_upsert,external_writes_set,io_restore,migrate_delete,migrate_extract_parent,migrate_merge,migrate_reclass,migrate_rename,migrate_reparent,migrate_retype,migrate_split,migrate_undo,organization_clear,portal_card,portal_declare,portal_invite,portal_preview,portal_principal_bind,portal_revoke,read_record,record_delete,record_restore,record_restore_preview,record_table,record_update,relation_uncarry,share_access,share_grant,share_lane_set,share_people,share_revoke,sign_request_cancel,sign_request_create,sign_request_remind,sign_request_unchanged,table_share_outside_accept,table_share_outside_invite,table_share_outside_resend,table_share_outside_revoke,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_assign,work_record_states,work_set_state";
3142
3162
  }, {
3143
3163
  readonly code: "0A000";
3144
3164
  readonly raised_by: "checklist_step_complete,external_rows,external_source_declare,external_write_through,promote_field,promoted_index_expr,promoted_query_sql,promoted_read,rule_eval,work_assign";
@@ -3156,22 +3176,22 @@ declare const STORE_REFUSAL_CODES: readonly [{
3156
3176
  readonly raised_by: "rule_eval";
3157
3177
  }, {
3158
3178
  readonly code: "22023";
3159
- readonly raised_by: "_booking_availability,_entity_custom_fields_guard,_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";
3179
+ 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";
3160
3180
  }, {
3161
3181
  readonly code: "23503";
3162
- 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";
3182
+ 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";
3163
3183
  }, {
3164
3184
  readonly code: "23505";
3165
3185
  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";
3166
3186
  }, {
3167
3187
  readonly code: "23514";
3168
- 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,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";
3188
+ 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";
3169
3189
  }, {
3170
3190
  readonly code: "40001";
3171
3191
  readonly raised_by: "has_visibility_at";
3172
3192
  }, {
3173
3193
  readonly code: "42501";
3174
- readonly raised_by: "_doc_render_immutable,_doc_signature_immutable,_field_definition_write,_field_write_door,_rule_definition_write,_store_door,anon_capture,anon_inbound_land,anon_publish,anon_token_issue,anon_token_verify,anon_write,assert_client_may_change,assert_client_may_open,assert_client_may_reach,assert_may_know_table,assert_organization_admin,assert_store_door,booking_confirm,booking_declare,booking_hold,capture_submit,checklist_run,comment_write,conversation_scope_bind,conversation_scope_unbind,enrich_declare,enrich_due,enrich_land,enrich_normalize,entity_field_declare,entity_field_retire,entity_field_update,entity_value_write,external_write_through,form_declare,form_submit,inbound_mail_land,io_comment_resolve,io_comment_write,io_import_begin,io_import_finish,io_restore,migrate_purge,migrate_reclass,my_levels,organization_clear,portal_declare,portal_invitation,portal_invite,portal_principal_bind,promote_table,query_visibility_parity,read_record,read_records,record_table,share_grant,subscription_mute,subscription_preview,table_share_outside_accept,table_share_outside_invite,table_share_outside_resend,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_person";
3194
+ readonly raised_by: "_doc_render_immutable,_doc_signature_immutable,_field_definition_write,_field_write_door,_rule_definition_write,_store_door,anon_capture,anon_inbound_land,anon_publish,anon_token_issue,anon_token_verify,anon_write,assert_client_may_change,assert_client_may_open,assert_client_may_reach,assert_may_know_table,assert_organization_admin,assert_store_door,booking_confirm,booking_declare,booking_hold,capture_submit,checklist_run,comment_write,conversation_scope_bind,conversation_scope_unbind,enrich_declare,enrich_due,enrich_land,enrich_normalize,entity_field_declare,entity_field_retire,entity_field_update,entity_value_write,external_write_through,form_declare,form_submit,inbound_mail_land,io_comment_resolve,io_comment_write,io_import_begin,io_import_finish,io_restore,migrate_purge,migrate_reclass,my_levels,organization_clear,portal_declare,portal_invitation,portal_invite,portal_principal_bind,promote_table,query_visibility_parity,read_record,read_records,read_records_by_ids,record_table,share_grant,subscription_mute,subscription_preview,table_share_outside_accept,table_share_outside_invite,table_share_outside_resend,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_person";
3175
3195
  }, {
3176
3196
  readonly code: "42703";
3177
3197
  readonly raised_by: "entity_table,portal_declare";
@@ -3653,6 +3673,31 @@ interface FieldRule {
3653
3673
  * `custom.field` — the ONE definitions table (FLD-8), organization-scoped, so
3654
3674
  * two organizations add different fields to the same standard table.
3655
3675
  */
3676
+ /**
3677
+ * WHICH OF THE OTHER RECORD'S COLUMNS A RELATION SHOWS (REL-DISP, 2026-09-21).
3678
+ *
3679
+ * A Table has ONE stored default reference column — its `title_field` — and until
3680
+ * this existed every relation pointing at that Table could display that column and
3681
+ * nothing else. A Jobs board could read "Maria Chen" but never "Maria Chen —
3682
+ * Rincon", and two columns could not be joined into one string at all.
3683
+ *
3684
+ * ABSENT MEANS THE TABLE'S OWN COLUMN. A field with no `display` resolves exactly
3685
+ * as it did before, so nothing changes for a column nobody has given a spec to.
3686
+ *
3687
+ * The store judges it once, in `custom._display_spec_for`: every column named must
3688
+ * exist on the target Table, and the refusal names the one that does not. It is
3689
+ * resolved by ONE body, `custom._words_for`, which `custom.record_words`,
3690
+ * `custom._card_words`, `custom.relation_words` and `custom.relation_words_many`
3691
+ * are all one-liners onto — so the thirteen store-side readers inherit it too.
3692
+ *
3693
+ * A display column that is itself a relation resolves ONE hop and never a second.
3694
+ */
3695
+ interface RelationDisplay {
3696
+ /** The target's columns, in the order they are shown. */
3697
+ columns: string[];
3698
+ /** What goes between them. Defaults to a single space. */
3699
+ separator: string;
3700
+ }
3656
3701
  interface Field {
3657
3702
  id: Uuid;
3658
3703
  organization_id: Uuid;
@@ -3681,6 +3726,8 @@ interface Field {
3681
3726
  on_target_delete: OnDelete | null;
3682
3727
  /** REL-9. The reverse is visible from both ends and is NOT a second Field. */
3683
3728
  inverse_key: string | null;
3729
+ /** REL-DISP. Which of the target's columns this one shows. Null = the Table's own. */
3730
+ display: RelationDisplay | null;
3684
3731
  source: FieldSource;
3685
3732
  source_config: Record<string, unknown>;
3686
3733
  /** FLD-9. A Formula declares whether it computes on read or on write. */
@@ -3808,6 +3855,12 @@ interface NewFieldDeclaration {
3808
3855
  relation_target?: Uuid;
3809
3856
  /** REL-2. What happens to this record when the thing it points at goes. */
3810
3857
  on_target_delete?: OnDelete;
3858
+ /**
3859
+ * REL-DISP. Which of the target's columns this one shows, and what joins them.
3860
+ * A bare column name and a plain list are both accepted by the door and
3861
+ * normalised; leaving it out keeps the target Table's own reference column.
3862
+ */
3863
+ display?: RelationDisplay | string[] | string;
3811
3864
  /**
3812
3865
  * Presentation and behaviour settings the store carries verbatim — a long
3813
3866
  * text's `multiline`, a list's existing options table. The door has always
@@ -3877,6 +3930,12 @@ interface FieldPatch {
3877
3930
  /** REL / FLD-11: re-point the column. The old edges are withdrawn by the door. */
3878
3931
  relation_target?: Uuid;
3879
3932
  on_target_delete?: OnDelete;
3933
+ /**
3934
+ * REL-DISP. Which of the target's columns this one shows. `null` REMOVES the
3935
+ * spec and the column goes back to whatever the table it points at is titled by;
3936
+ * the door refuses it by name on a column that points at nothing.
3937
+ */
3938
+ display?: RelationDisplay | string[] | string | null;
3880
3939
  /** SEAT-SUITES: whether the store builds an index for this column, and a unique one. */
3881
3940
  promoted?: boolean;
3882
3941
  unique?: boolean;
@@ -3900,4 +3959,4 @@ interface FieldPatch {
3900
3959
  compute_on?: ComputeOn;
3901
3960
  }
3902
3961
 
3903
- export { type MergeFieldModifier as $, ABSENCE_REASONS as A, type Delivery as B, type ComputeOn as C, DELIVERIES as D, ENTITY_TOKENS as E, type FieldTypeWord as F, type EntityToken as G, FIELD_SENSITIVITIES as H, FIELD_SOURCES as I, FRESHNESS as J, type FieldBehavior as K, type ForbiddenEnvelopeWord as L, type Freshness as M, type NewFieldDeclaration as N, type OnDelete as O, type PgError as P, type HiddenFieldNotice as Q, type RelationFlavor as R, type StorageMode as S, type TableType as T, type Uuid as U, KERNEL_TABLES as V, type WriteConflict as W, type KernelTableName as X, MERGE_FIELD_MODIFIERS as Y, MERGE_FIELD_SEMANTIC_TYPES as Z, MERGE_FIELD_SOURCES as _, type TableDisplay as a, type MergeFieldSemanticType as a0, type MergeFieldSource as a1, ON_DELETE as a2, OVERRIDE_POLICIES as a3, type OverridePolicy as a4, PARITY_FIELD_TYPES as a5, PER_VALUE_ACCESS_WORDS as a6, type ParityFieldType as a7, type ParityFieldTypeDescriptor as a8, type PerValueAccessWord as a9, type ValueEnvelope as aA, type ValueEnvelopeKey as aB, type ValueSource as aC, err as aD, isRecordsErr as aE, ok as aF, type ProvenancePointer as aa, RELATION_BINDINGS as ab, RELATION_CARDINALITIES as ac, RELATION_FLAVORS as ad, RETIRED_ACTOR_WORDS as ae, RULE_NODE_KINDS as af, RULE_USES as ag, type RecordsErrorCode as ah, type RelationBinding as ai, type RetiredActorWord as aj, type RuleNodeKind as ak, type RuleUse as al, STORAGE_MODES as am, STORE_DOORS as an, STORE_KNOBS as ao, STORE_REFUSAL_CODES as ap, type StoreDoorName as aq, type StoreRefusalCode as ar, TABLE_DISPLAYS as as, TABLE_ORIGINS as at, TABLE_TYPES as au, type TableOrigin as av, VALUE_ALTERNATE_KEYS as aw, VALUE_ENVELOPE_KEYS as ax, type ValueAlternate as ay, type ValueAlternateKey as az, type FieldSource as b, type FieldRule as c, type FieldSensitivity as d, type ContextPolicy as e, type RelationCardinality as f, type Timestamp as g, type RecordDocument as h, type RecordsResult as i, type RecordRead as j, type ReadRow as k, type Field as l, type StoredRecord as m, type FieldPatch as n, type RecordRevision as o, type ReadValue as p, type FieldProposal as q, type TableProposal as r, type RecordsError as s, type StaleWriteDetail as t, type PredictedRefusal as u, ACTOR_VOCABULARY as v, type AbsenceReason as w, type Actor as x, COMPUTE_ON as y, CONTEXT_POLICIES as z };
3962
+ export { type MergeFieldModifier as $, ABSENCE_REASONS as A, type Delivery as B, type ComputeOn as C, DELIVERIES as D, ENTITY_TOKENS as E, type FieldTypeWord as F, type EntityToken as G, FIELD_SENSITIVITIES as H, FIELD_SOURCES as I, FRESHNESS as J, type FieldBehavior as K, type ForbiddenEnvelopeWord as L, type Freshness as M, type NewFieldDeclaration as N, type OnDelete as O, type PgError as P, type HiddenFieldNotice as Q, type RelationFlavor as R, type StorageMode as S, type TableType as T, type Uuid as U, KERNEL_TABLES as V, type WriteConflict as W, type KernelTableName as X, MERGE_FIELD_MODIFIERS as Y, MERGE_FIELD_SEMANTIC_TYPES as Z, MERGE_FIELD_SOURCES as _, type TableDisplay as a, type MergeFieldSemanticType as a0, type MergeFieldSource as a1, ON_DELETE as a2, OVERRIDE_POLICIES as a3, type OverridePolicy as a4, PARITY_FIELD_TYPES as a5, PER_VALUE_ACCESS_WORDS as a6, type ParityFieldType as a7, type ParityFieldTypeDescriptor as a8, type PerValueAccessWord as a9, type ValueAlternateKey as aA, type ValueEnvelope as aB, type ValueEnvelopeKey as aC, type ValueSource as aD, err as aE, isRecordsErr as aF, ok as aG, type ProvenancePointer as aa, RELATION_BINDINGS as ab, RELATION_CARDINALITIES as ac, RELATION_FLAVORS as ad, RETIRED_ACTOR_WORDS as ae, RULE_NODE_KINDS as af, RULE_USES as ag, type RecordsErrorCode as ah, type RelationBinding as ai, type RelationDisplay as aj, type RetiredActorWord as ak, type RuleNodeKind as al, type RuleUse as am, STORAGE_MODES as an, STORE_DOORS as ao, STORE_KNOBS as ap, STORE_REFUSAL_CODES as aq, type StoreDoorName as ar, type StoreRefusalCode as as, TABLE_DISPLAYS as at, TABLE_ORIGINS as au, TABLE_TYPES as av, type TableOrigin as aw, VALUE_ALTERNATE_KEYS as ax, VALUE_ENVELOPE_KEYS as ay, type ValueAlternate as az, type FieldSource as b, type FieldRule as c, type FieldSensitivity as d, type ContextPolicy as e, type RelationCardinality as f, type Timestamp as g, type RecordDocument as h, type RecordsResult as i, type RecordRead as j, type ReadRow as k, type Field as l, type StoredRecord as m, type FieldPatch as n, type RecordRevision as o, type ReadValue as p, type FieldProposal as q, type TableProposal as r, type RecordsError as s, type StaleWriteDetail as t, type PredictedRefusal as u, ACTOR_VOCABULARY as v, type AbsenceReason as w, type Actor as x, COMPUTE_ON as y, CONTEXT_POLICIES as z };
@@ -2075,6 +2075,11 @@ declare const STORE_DOORS: readonly [{
2075
2075
  readonly args: "p_organization_id uuid, p_table_id uuid, p_by_id boolean DEFAULT false, p_limit integer DEFAULT 200, p_offset integer DEFAULT 0";
2076
2076
  readonly returns: "TABLE(id uuid, document jsonb, level permission_level)";
2077
2077
  readonly security: "definer";
2078
+ }, {
2079
+ readonly name: "read_records_by_ids";
2080
+ readonly args: "p_organization_id uuid, p_table_id uuid, p_record_ids uuid[], p_by_id boolean DEFAULT false";
2081
+ readonly returns: "TABLE(id uuid, document jsonb, level permission_level)";
2082
+ readonly security: "definer";
2078
2083
  }, {
2079
2084
  readonly name: "realtime_topic_admits";
2080
2085
  readonly args: "p_topic text";
@@ -2195,6 +2200,11 @@ declare const STORE_DOORS: readonly [{
2195
2200
  readonly args: "p_organization_id uuid, p_record_id uuid";
2196
2201
  readonly returns: "TABLE(field_key text, field_id uuid, value jsonb, value_version integer, source jsonb, absent_reason text, actor text, on_behalf_of text, written_at timestamp with time zone, alternates jsonb)";
2197
2202
  readonly security: "definer";
2203
+ }, {
2204
+ readonly name: "record_words";
2205
+ readonly args: "p_organization_id uuid, p_record_id uuid, p_noun text DEFAULT NULL::text";
2206
+ readonly returns: "text";
2207
+ readonly security: "definer";
2198
2208
  }, {
2199
2209
  readonly name: "record_write";
2200
2210
  readonly args: "p_organization_id uuid, p_table_id uuid, p_data jsonb";
@@ -2250,6 +2260,16 @@ declare const STORE_DOORS: readonly [{
2250
2260
  readonly args: "p_organization_id uuid, p_container_id uuid, p_item_id uuid";
2251
2261
  readonly returns: "integer";
2252
2262
  readonly security: "definer";
2263
+ }, {
2264
+ readonly name: "relation_words";
2265
+ readonly args: "p_organization_id uuid, p_field_id uuid, p_value text";
2266
+ readonly returns: "text";
2267
+ readonly security: "definer";
2268
+ }, {
2269
+ readonly name: "relation_words_many";
2270
+ readonly args: "p_organization_id uuid, p_field_id uuid, p_record_ids uuid[]";
2271
+ readonly returns: "TABLE(record_id uuid, words text)";
2272
+ readonly security: "definer";
2253
2273
  }, {
2254
2274
  readonly name: "reopen_declared_doors";
2255
2275
  readonly args: "";
@@ -3138,7 +3158,7 @@ declare const STORE_KNOBS: readonly [{
3138
3158
  */
3139
3159
  declare const STORE_REFUSAL_CODES: readonly [{
3140
3160
  readonly code: "02000";
3141
- readonly raised_by: "_checklist_instantiate,checklist_declare,checklist_run,checklist_step_complete,checklist_step_refusal,checklist_template_shape,conversation_scope_bind,dashboard_delete,dashboard_run,doc_letterhead,doc_render_body,doc_render_document,doc_render_read,doc_sign,doc_signature_intact,doc_signature_read,doc_template_delete,doc_template_read,doc_template_save,enrich_pin,entity_field_retire,entity_field_update,entity_record_read,entity_value_write,external_history_event,external_rows,external_stub_upsert,external_writes_set,io_restore,migrate_delete,migrate_extract_parent,migrate_merge,migrate_reclass,migrate_rename,migrate_reparent,migrate_retype,migrate_split,migrate_undo,organization_clear,portal_card,portal_declare,portal_invite,portal_preview,portal_principal_bind,portal_revoke,read_record,record_delete,record_restore,record_restore_preview,record_table,record_update,relation_uncarry,share_access,share_grant,share_lane_set,share_people,share_revoke,sign_request_cancel,sign_request_create,sign_request_remind,sign_request_unchanged,table_share_outside_accept,table_share_outside_invite,table_share_outside_resend,table_share_outside_revoke,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_assign,work_record_states,work_set_state";
3161
+ readonly raised_by: "_checklist_instantiate,_table_share_invite_payload,checklist_declare,checklist_run,checklist_step_complete,checklist_step_refusal,checklist_template_shape,conversation_scope_bind,dashboard_delete,dashboard_run,doc_letterhead,doc_render_body,doc_render_document,doc_render_read,doc_sign,doc_signature_intact,doc_signature_read,doc_template_delete,doc_template_read,doc_template_save,enrich_pin,entity_field_retire,entity_field_update,entity_record_read,entity_value_write,external_history_event,external_rows,external_stub_upsert,external_writes_set,io_restore,migrate_delete,migrate_extract_parent,migrate_merge,migrate_reclass,migrate_rename,migrate_reparent,migrate_retype,migrate_split,migrate_undo,organization_clear,portal_card,portal_declare,portal_invite,portal_preview,portal_principal_bind,portal_revoke,read_record,record_delete,record_restore,record_restore_preview,record_table,record_update,relation_uncarry,share_access,share_grant,share_lane_set,share_people,share_revoke,sign_request_cancel,sign_request_create,sign_request_remind,sign_request_unchanged,table_share_outside_accept,table_share_outside_invite,table_share_outside_resend,table_share_outside_revoke,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_assign,work_record_states,work_set_state";
3142
3162
  }, {
3143
3163
  readonly code: "0A000";
3144
3164
  readonly raised_by: "checklist_step_complete,external_rows,external_source_declare,external_write_through,promote_field,promoted_index_expr,promoted_query_sql,promoted_read,rule_eval,work_assign";
@@ -3156,22 +3176,22 @@ declare const STORE_REFUSAL_CODES: readonly [{
3156
3176
  readonly raised_by: "rule_eval";
3157
3177
  }, {
3158
3178
  readonly code: "22023";
3159
- readonly raised_by: "_booking_availability,_entity_custom_fields_guard,_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";
3179
+ 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";
3160
3180
  }, {
3161
3181
  readonly code: "23503";
3162
- 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";
3182
+ 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";
3163
3183
  }, {
3164
3184
  readonly code: "23505";
3165
3185
  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";
3166
3186
  }, {
3167
3187
  readonly code: "23514";
3168
- 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,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";
3188
+ 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";
3169
3189
  }, {
3170
3190
  readonly code: "40001";
3171
3191
  readonly raised_by: "has_visibility_at";
3172
3192
  }, {
3173
3193
  readonly code: "42501";
3174
- readonly raised_by: "_doc_render_immutable,_doc_signature_immutable,_field_definition_write,_field_write_door,_rule_definition_write,_store_door,anon_capture,anon_inbound_land,anon_publish,anon_token_issue,anon_token_verify,anon_write,assert_client_may_change,assert_client_may_open,assert_client_may_reach,assert_may_know_table,assert_organization_admin,assert_store_door,booking_confirm,booking_declare,booking_hold,capture_submit,checklist_run,comment_write,conversation_scope_bind,conversation_scope_unbind,enrich_declare,enrich_due,enrich_land,enrich_normalize,entity_field_declare,entity_field_retire,entity_field_update,entity_value_write,external_write_through,form_declare,form_submit,inbound_mail_land,io_comment_resolve,io_comment_write,io_import_begin,io_import_finish,io_restore,migrate_purge,migrate_reclass,my_levels,organization_clear,portal_declare,portal_invitation,portal_invite,portal_principal_bind,promote_table,query_visibility_parity,read_record,read_records,record_table,share_grant,subscription_mute,subscription_preview,table_share_outside_accept,table_share_outside_invite,table_share_outside_resend,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_person";
3194
+ readonly raised_by: "_doc_render_immutable,_doc_signature_immutable,_field_definition_write,_field_write_door,_rule_definition_write,_store_door,anon_capture,anon_inbound_land,anon_publish,anon_token_issue,anon_token_verify,anon_write,assert_client_may_change,assert_client_may_open,assert_client_may_reach,assert_may_know_table,assert_organization_admin,assert_store_door,booking_confirm,booking_declare,booking_hold,capture_submit,checklist_run,comment_write,conversation_scope_bind,conversation_scope_unbind,enrich_declare,enrich_due,enrich_land,enrich_normalize,entity_field_declare,entity_field_retire,entity_field_update,entity_value_write,external_write_through,form_declare,form_submit,inbound_mail_land,io_comment_resolve,io_comment_write,io_import_begin,io_import_finish,io_restore,migrate_purge,migrate_reclass,my_levels,organization_clear,portal_declare,portal_invitation,portal_invite,portal_principal_bind,promote_table,query_visibility_parity,read_record,read_records,read_records_by_ids,record_table,share_grant,subscription_mute,subscription_preview,table_share_outside_accept,table_share_outside_invite,table_share_outside_resend,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_person";
3175
3195
  }, {
3176
3196
  readonly code: "42703";
3177
3197
  readonly raised_by: "entity_table,portal_declare";
@@ -3653,6 +3673,31 @@ interface FieldRule {
3653
3673
  * `custom.field` — the ONE definitions table (FLD-8), organization-scoped, so
3654
3674
  * two organizations add different fields to the same standard table.
3655
3675
  */
3676
+ /**
3677
+ * WHICH OF THE OTHER RECORD'S COLUMNS A RELATION SHOWS (REL-DISP, 2026-09-21).
3678
+ *
3679
+ * A Table has ONE stored default reference column — its `title_field` — and until
3680
+ * this existed every relation pointing at that Table could display that column and
3681
+ * nothing else. A Jobs board could read "Maria Chen" but never "Maria Chen —
3682
+ * Rincon", and two columns could not be joined into one string at all.
3683
+ *
3684
+ * ABSENT MEANS THE TABLE'S OWN COLUMN. A field with no `display` resolves exactly
3685
+ * as it did before, so nothing changes for a column nobody has given a spec to.
3686
+ *
3687
+ * The store judges it once, in `custom._display_spec_for`: every column named must
3688
+ * exist on the target Table, and the refusal names the one that does not. It is
3689
+ * resolved by ONE body, `custom._words_for`, which `custom.record_words`,
3690
+ * `custom._card_words`, `custom.relation_words` and `custom.relation_words_many`
3691
+ * are all one-liners onto — so the thirteen store-side readers inherit it too.
3692
+ *
3693
+ * A display column that is itself a relation resolves ONE hop and never a second.
3694
+ */
3695
+ interface RelationDisplay {
3696
+ /** The target's columns, in the order they are shown. */
3697
+ columns: string[];
3698
+ /** What goes between them. Defaults to a single space. */
3699
+ separator: string;
3700
+ }
3656
3701
  interface Field {
3657
3702
  id: Uuid;
3658
3703
  organization_id: Uuid;
@@ -3681,6 +3726,8 @@ interface Field {
3681
3726
  on_target_delete: OnDelete | null;
3682
3727
  /** REL-9. The reverse is visible from both ends and is NOT a second Field. */
3683
3728
  inverse_key: string | null;
3729
+ /** REL-DISP. Which of the target's columns this one shows. Null = the Table's own. */
3730
+ display: RelationDisplay | null;
3684
3731
  source: FieldSource;
3685
3732
  source_config: Record<string, unknown>;
3686
3733
  /** FLD-9. A Formula declares whether it computes on read or on write. */
@@ -3808,6 +3855,12 @@ interface NewFieldDeclaration {
3808
3855
  relation_target?: Uuid;
3809
3856
  /** REL-2. What happens to this record when the thing it points at goes. */
3810
3857
  on_target_delete?: OnDelete;
3858
+ /**
3859
+ * REL-DISP. Which of the target's columns this one shows, and what joins them.
3860
+ * A bare column name and a plain list are both accepted by the door and
3861
+ * normalised; leaving it out keeps the target Table's own reference column.
3862
+ */
3863
+ display?: RelationDisplay | string[] | string;
3811
3864
  /**
3812
3865
  * Presentation and behaviour settings the store carries verbatim — a long
3813
3866
  * text's `multiline`, a list's existing options table. The door has always
@@ -3877,6 +3930,12 @@ interface FieldPatch {
3877
3930
  /** REL / FLD-11: re-point the column. The old edges are withdrawn by the door. */
3878
3931
  relation_target?: Uuid;
3879
3932
  on_target_delete?: OnDelete;
3933
+ /**
3934
+ * REL-DISP. Which of the target's columns this one shows. `null` REMOVES the
3935
+ * spec and the column goes back to whatever the table it points at is titled by;
3936
+ * the door refuses it by name on a column that points at nothing.
3937
+ */
3938
+ display?: RelationDisplay | string[] | string | null;
3880
3939
  /** SEAT-SUITES: whether the store builds an index for this column, and a unique one. */
3881
3940
  promoted?: boolean;
3882
3941
  unique?: boolean;
@@ -3900,4 +3959,4 @@ interface FieldPatch {
3900
3959
  compute_on?: ComputeOn;
3901
3960
  }
3902
3961
 
3903
- export { type MergeFieldModifier as $, ABSENCE_REASONS as A, type Delivery as B, type ComputeOn as C, DELIVERIES as D, ENTITY_TOKENS as E, type FieldTypeWord as F, type EntityToken as G, FIELD_SENSITIVITIES as H, FIELD_SOURCES as I, FRESHNESS as J, type FieldBehavior as K, type ForbiddenEnvelopeWord as L, type Freshness as M, type NewFieldDeclaration as N, type OnDelete as O, type PgError as P, type HiddenFieldNotice as Q, type RelationFlavor as R, type StorageMode as S, type TableType as T, type Uuid as U, KERNEL_TABLES as V, type WriteConflict as W, type KernelTableName as X, MERGE_FIELD_MODIFIERS as Y, MERGE_FIELD_SEMANTIC_TYPES as Z, MERGE_FIELD_SOURCES as _, type TableDisplay as a, type MergeFieldSemanticType as a0, type MergeFieldSource as a1, ON_DELETE as a2, OVERRIDE_POLICIES as a3, type OverridePolicy as a4, PARITY_FIELD_TYPES as a5, PER_VALUE_ACCESS_WORDS as a6, type ParityFieldType as a7, type ParityFieldTypeDescriptor as a8, type PerValueAccessWord as a9, type ValueEnvelope as aA, type ValueEnvelopeKey as aB, type ValueSource as aC, err as aD, isRecordsErr as aE, ok as aF, type ProvenancePointer as aa, RELATION_BINDINGS as ab, RELATION_CARDINALITIES as ac, RELATION_FLAVORS as ad, RETIRED_ACTOR_WORDS as ae, RULE_NODE_KINDS as af, RULE_USES as ag, type RecordsErrorCode as ah, type RelationBinding as ai, type RetiredActorWord as aj, type RuleNodeKind as ak, type RuleUse as al, STORAGE_MODES as am, STORE_DOORS as an, STORE_KNOBS as ao, STORE_REFUSAL_CODES as ap, type StoreDoorName as aq, type StoreRefusalCode as ar, TABLE_DISPLAYS as as, TABLE_ORIGINS as at, TABLE_TYPES as au, type TableOrigin as av, VALUE_ALTERNATE_KEYS as aw, VALUE_ENVELOPE_KEYS as ax, type ValueAlternate as ay, type ValueAlternateKey as az, type FieldSource as b, type FieldRule as c, type FieldSensitivity as d, type ContextPolicy as e, type RelationCardinality as f, type Timestamp as g, type RecordDocument as h, type RecordsResult as i, type RecordRead as j, type ReadRow as k, type Field as l, type StoredRecord as m, type FieldPatch as n, type RecordRevision as o, type ReadValue as p, type FieldProposal as q, type TableProposal as r, type RecordsError as s, type StaleWriteDetail as t, type PredictedRefusal as u, ACTOR_VOCABULARY as v, type AbsenceReason as w, type Actor as x, COMPUTE_ON as y, CONTEXT_POLICIES as z };
3962
+ export { type MergeFieldModifier as $, ABSENCE_REASONS as A, type Delivery as B, type ComputeOn as C, DELIVERIES as D, ENTITY_TOKENS as E, type FieldTypeWord as F, type EntityToken as G, FIELD_SENSITIVITIES as H, FIELD_SOURCES as I, FRESHNESS as J, type FieldBehavior as K, type ForbiddenEnvelopeWord as L, type Freshness as M, type NewFieldDeclaration as N, type OnDelete as O, type PgError as P, type HiddenFieldNotice as Q, type RelationFlavor as R, type StorageMode as S, type TableType as T, type Uuid as U, KERNEL_TABLES as V, type WriteConflict as W, type KernelTableName as X, MERGE_FIELD_MODIFIERS as Y, MERGE_FIELD_SEMANTIC_TYPES as Z, MERGE_FIELD_SOURCES as _, type TableDisplay as a, type MergeFieldSemanticType as a0, type MergeFieldSource as a1, ON_DELETE as a2, OVERRIDE_POLICIES as a3, type OverridePolicy as a4, PARITY_FIELD_TYPES as a5, PER_VALUE_ACCESS_WORDS as a6, type ParityFieldType as a7, type ParityFieldTypeDescriptor as a8, type PerValueAccessWord as a9, type ValueAlternateKey as aA, type ValueEnvelope as aB, type ValueEnvelopeKey as aC, type ValueSource as aD, err as aE, isRecordsErr as aF, ok as aG, type ProvenancePointer as aa, RELATION_BINDINGS as ab, RELATION_CARDINALITIES as ac, RELATION_FLAVORS as ad, RETIRED_ACTOR_WORDS as ae, RULE_NODE_KINDS as af, RULE_USES as ag, type RecordsErrorCode as ah, type RelationBinding as ai, type RelationDisplay as aj, type RetiredActorWord as ak, type RuleNodeKind as al, type RuleUse as am, STORAGE_MODES as an, STORE_DOORS as ao, STORE_KNOBS as ap, STORE_REFUSAL_CODES as aq, type StoreDoorName as ar, type StoreRefusalCode as as, TABLE_DISPLAYS as at, TABLE_ORIGINS as au, TABLE_TYPES as av, type TableOrigin as aw, VALUE_ALTERNATE_KEYS as ax, VALUE_ENVELOPE_KEYS as ay, type ValueAlternate as az, type FieldSource as b, type FieldRule as c, type FieldSensitivity as d, type ContextPolicy as e, type RelationCardinality as f, type Timestamp as g, type RecordDocument as h, type RecordsResult as i, type RecordRead as j, type ReadRow as k, type Field as l, type StoredRecord as m, type FieldPatch as n, type RecordRevision as o, type ReadValue as p, type FieldProposal as q, type TableProposal as r, type RecordsError as s, type StaleWriteDetail as t, type PredictedRefusal as u, ACTOR_VOCABULARY as v, type AbsenceReason as w, type Actor as x, COMPUTE_ON as y, CONTEXT_POLICIES as z };
package/dist/index.cjs CHANGED
@@ -64,10 +64,12 @@ __export(src_exports, {
64
64
  choiceValuesOf: () => choiceValuesOf,
65
65
  choicesOf: () => choicesOf,
66
66
  err: () => err,
67
+ forgetAllOps: () => forgetAllOps,
67
68
  highestLevel: () => highestLevel,
68
69
  holdsARetiredChoice: () => holdsARetiredChoice,
69
70
  indexedDbStore: () => indexedDbStore,
70
71
  isDecided: () => isDecided,
72
+ isOwnOp: () => isOwnOp,
71
73
  isRecordsErr: () => isRecordsErr,
72
74
  isTheChosen: () => isTheChosen,
73
75
  looksLikeAnId: () => looksLikeAnId,
@@ -75,12 +77,14 @@ __export(src_exports, {
75
77
  measureKey: () => measureKey,
76
78
  memoryStore: () => memoryStore,
77
79
  mintClientKey: () => mintClientKey,
80
+ mintOpId: () => mintOpId,
78
81
  ok: () => ok,
79
82
  openCaptureQueue: () => openCaptureQueue,
80
83
  optionKey: () => optionKey,
81
84
  optionLabel: () => optionLabel,
82
85
  portalPath: () => portalPath,
83
86
  publicFormPath: () => publicFormPath,
87
+ rememberedOpCount: () => rememberedOpCount,
84
88
  scopeChip: () => scopeChip
85
89
  });
86
90
  module.exports = __toCommonJS(src_exports);
@@ -523,6 +527,45 @@ function isRecordsErr(result) {
523
527
  var ok = (data) => ({ ok: true, data });
524
528
  var err = (error) => ({ ok: false, error });
525
529
 
530
+ // src/ops.ts
531
+ var REMEMBER_MS = 3e4;
532
+ var REMEMBER_MAX = 500;
533
+ var ours = /* @__PURE__ */ new Map();
534
+ function trim(now) {
535
+ for (const [id, at] of ours) {
536
+ if (now - at <= REMEMBER_MS) break;
537
+ ours.delete(id);
538
+ }
539
+ while (ours.size > REMEMBER_MAX) {
540
+ const oldest = ours.keys().next();
541
+ if (oldest.done === true) break;
542
+ ours.delete(oldest.value);
543
+ }
544
+ }
545
+ function mintOpId() {
546
+ const id = crypto.randomUUID();
547
+ const now = Date.now();
548
+ ours.set(id, now);
549
+ trim(now);
550
+ return id;
551
+ }
552
+ function isOwnOp(opId) {
553
+ if (!opId) return false;
554
+ const at = ours.get(opId);
555
+ if (at === void 0) return false;
556
+ if (Date.now() - at > REMEMBER_MS) {
557
+ ours.delete(opId);
558
+ return false;
559
+ }
560
+ return true;
561
+ }
562
+ function forgetAllOps() {
563
+ ours.clear();
564
+ }
565
+ function rememberedOpCount() {
566
+ return ours.size;
567
+ }
568
+
526
569
  // src/store.generated.ts
527
570
  var ACTOR_VOCABULARY = ["user", "agent", "system"];
528
571
  var RETIRED_ACTOR_WORDS = { "ai": "agent", "code": "system", "human": "user" };
@@ -966,6 +1009,7 @@ var STORE_DOORS = [
966
1009
  { name: "read_paths_outside_the_door", args: "", returns: "TABLE(object_name text, why text)", security: "invoker" },
967
1010
  { name: "read_record", args: "p_organization_id uuid, p_record_id uuid, p_by_id boolean DEFAULT false", returns: "jsonb", security: "definer" },
968
1011
  { name: "read_records", args: "p_organization_id uuid, p_table_id uuid, p_by_id boolean DEFAULT false, p_limit integer DEFAULT 200, p_offset integer DEFAULT 0", returns: "TABLE(id uuid, document jsonb, level permission_level)", security: "definer" },
1012
+ { name: "read_records_by_ids", args: "p_organization_id uuid, p_table_id uuid, p_record_ids uuid[], p_by_id boolean DEFAULT false", returns: "TABLE(id uuid, document jsonb, level permission_level)", security: "definer" },
969
1013
  { name: "realtime_topic_admits", args: "p_topic text", returns: "boolean", security: "definer" },
970
1014
  { name: "record_aggregate", args: "p_organization_id uuid, p_table_id uuid, p_group_by jsonb DEFAULT '[]'::jsonb, p_measures jsonb DEFAULT '[]'::jsonb, p_bucket jsonb DEFAULT NULL::jsonb, p_filter jsonb DEFAULT '{}'::jsonb, p_limit integer DEFAULT 200, p_required text DEFAULT 'viewer'::text", returns: "TABLE(groups jsonb, measures jsonb, row_count bigint)", security: "definer" },
971
1015
  { name: "record_applicability", args: "p_organization_id uuid, p_record_id uuid", returns: "TABLE(rule_id uuid, rule_name text, rule_version integer, applies boolean, answer jsonb)", security: "invoker" },
@@ -990,6 +1034,7 @@ var STORE_DOORS = [
990
1034
  { name: "record_values", args: "p_organization_id uuid, p_record_id uuid", returns: "jsonb", security: "invoker" },
991
1035
  { name: "record_values_of", args: "p_row custom.record", returns: "jsonb", security: "invoker" },
992
1036
  { name: "record_values_versioned", args: "p_organization_id uuid, p_record_id uuid", returns: "TABLE(field_key text, field_id uuid, value jsonb, value_version integer, source jsonb, absent_reason text, actor text, on_behalf_of text, written_at timestamp with time zone, alternates jsonb)", security: "definer" },
1037
+ { name: "record_words", args: "p_organization_id uuid, p_record_id uuid, p_noun text DEFAULT NULL::text", returns: "text", security: "definer" },
993
1038
  { name: "record_write", args: "p_organization_id uuid, p_table_id uuid, p_data jsonb", returns: "uuid", security: "definer" },
994
1039
  { name: "record_write_many", args: "p_organization_id uuid, p_table_id uuid, p_rows jsonb[], p_ids uuid[] DEFAULT NULL::uuid[]", returns: "uuid[]", security: "definer" },
995
1040
  { name: "refusals_claiming_a_level_never_asked", args: "", returns: "TABLE(function_name text, identity_args text, why text)", security: "invoker" },
@@ -1001,6 +1046,8 @@ var STORE_DOORS = [
1001
1046
  { name: "relation_target_ours", args: "p_entity_token text, p_row_id uuid", returns: "jsonb", security: "definer" },
1002
1047
  { name: "relation_targets", args: "p_organization_id uuid, p_record_id uuid, p_via_key text", returns: "SETOF uuid", security: "definer" },
1003
1048
  { name: "relation_uncarry", args: "p_organization_id uuid, p_container_id uuid, p_item_id uuid", returns: "integer", security: "definer" },
1049
+ { name: "relation_words", args: "p_organization_id uuid, p_field_id uuid, p_value text", returns: "text", security: "definer" },
1050
+ { name: "relation_words_many", args: "p_organization_id uuid, p_field_id uuid, p_record_ids uuid[]", returns: "TABLE(record_id uuid, words text)", security: "definer" },
1004
1051
  { name: "reopen_declared_doors", args: "", returns: "TABLE(reopened text)", security: "definer" },
1005
1052
  { name: "required_epoch", args: "p_container_type text, p_container_id uuid, p_item_type text, p_item_id uuid", returns: "bigint", security: "definer" },
1006
1053
  { name: "resolve_first_match", args: "p_organization_id uuid, p_record_id uuid", returns: "jsonb", security: "invoker" },
@@ -1190,18 +1237,18 @@ var STORE_KNOBS = [
1190
1237
  { key: "world_publish_enabled", value: "false", type: "boolean" }
1191
1238
  ];
1192
1239
  var STORE_REFUSAL_CODES = [
1193
- { code: "02000", raised_by: "_checklist_instantiate,checklist_declare,checklist_run,checklist_step_complete,checklist_step_refusal,checklist_template_shape,conversation_scope_bind,dashboard_delete,dashboard_run,doc_letterhead,doc_render_body,doc_render_document,doc_render_read,doc_sign,doc_signature_intact,doc_signature_read,doc_template_delete,doc_template_read,doc_template_save,enrich_pin,entity_field_retire,entity_field_update,entity_record_read,entity_value_write,external_history_event,external_rows,external_stub_upsert,external_writes_set,io_restore,migrate_delete,migrate_extract_parent,migrate_merge,migrate_reclass,migrate_rename,migrate_reparent,migrate_retype,migrate_split,migrate_undo,organization_clear,portal_card,portal_declare,portal_invite,portal_preview,portal_principal_bind,portal_revoke,read_record,record_delete,record_restore,record_restore_preview,record_table,record_update,relation_uncarry,share_access,share_grant,share_lane_set,share_people,share_revoke,sign_request_cancel,sign_request_create,sign_request_remind,sign_request_unchanged,table_share_outside_accept,table_share_outside_invite,table_share_outside_resend,table_share_outside_revoke,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_assign,work_record_states,work_set_state" },
1240
+ { code: "02000", raised_by: "_checklist_instantiate,_table_share_invite_payload,checklist_declare,checklist_run,checklist_step_complete,checklist_step_refusal,checklist_template_shape,conversation_scope_bind,dashboard_delete,dashboard_run,doc_letterhead,doc_render_body,doc_render_document,doc_render_read,doc_sign,doc_signature_intact,doc_signature_read,doc_template_delete,doc_template_read,doc_template_save,enrich_pin,entity_field_retire,entity_field_update,entity_record_read,entity_value_write,external_history_event,external_rows,external_stub_upsert,external_writes_set,io_restore,migrate_delete,migrate_extract_parent,migrate_merge,migrate_reclass,migrate_rename,migrate_reparent,migrate_retype,migrate_split,migrate_undo,organization_clear,portal_card,portal_declare,portal_invite,portal_preview,portal_principal_bind,portal_revoke,read_record,record_delete,record_restore,record_restore_preview,record_table,record_update,relation_uncarry,share_access,share_grant,share_lane_set,share_people,share_revoke,sign_request_cancel,sign_request_create,sign_request_remind,sign_request_unchanged,table_share_outside_accept,table_share_outside_invite,table_share_outside_resend,table_share_outside_revoke,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_assign,work_record_states,work_set_state" },
1194
1241
  { code: "0A000", raised_by: "checklist_step_complete,external_rows,external_source_declare,external_write_through,promote_field,promoted_index_expr,promoted_query_sql,promoted_read,rule_eval,work_assign" },
1195
1242
  { code: "22003", raised_by: "context_resolve" },
1196
1243
  { code: "22004", raised_by: "_entity_custom_fields_guard,_value_envelope,actor_word,agg_assert_key,agg_sql,anon_capture,anon_token_issue,anon_write,assert_client_may_reach,booking_declare,capture_submit,checklist_declare,context_resolve,dashboard_block_normalize,dashboard_declare,dashboard_window_sql,doc_render_write,doc_sign,doc_signature_write,doc_template_save,enrich_land,enrich_normalize,external_history_event,external_rows,external_source_declare,external_stub_upsert,external_write_through,external_writes_set,field_history,form_declare,form_submit,home_add,io_comment_write,io_import_begin,io_infer_column,io_outbox_drain,io_restore,migrate_choice_keys,migrate_purge,migrate_reclass,migrate_split,migrate_undo,organization_clear,organization_contents,pipeline_declare,pipeline_gate_preview,portal_declare,portal_invite,portal_principal_bind,provenance_retention_days,provenance_write,query_across_homes,query_by_coordinates,query_rollup,record_delete,record_reparent,record_resolve,record_restore,record_update,record_write,record_write_many,relation_carry,relation_own,rule_declare,share_grant,sign_request_create,sign_request_sign,subscription_declare,table_declare,table_share_outside_invite,value_restore,view_declare,work_approval_decide,work_approval_request,work_template_declare" },
1197
1244
  { code: "22007", raised_by: "dashboard_window_sql" },
1198
1245
  { code: "22012", raised_by: "rule_eval" },
1199
- { code: "22023", raised_by: "_booking_availability,_entity_custom_fields_guard,_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" },
1200
- { code: "23503", 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" },
1246
+ { code: "22023", 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" },
1247
+ { code: "23503", 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" },
1201
1248
  { code: "23505", 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" },
1202
- { code: "23514", 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,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" },
1249
+ { code: "23514", 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" },
1203
1250
  { code: "40001", raised_by: "has_visibility_at" },
1204
- { code: "42501", raised_by: "_doc_render_immutable,_doc_signature_immutable,_field_definition_write,_field_write_door,_rule_definition_write,_store_door,anon_capture,anon_inbound_land,anon_publish,anon_token_issue,anon_token_verify,anon_write,assert_client_may_change,assert_client_may_open,assert_client_may_reach,assert_may_know_table,assert_organization_admin,assert_store_door,booking_confirm,booking_declare,booking_hold,capture_submit,checklist_run,comment_write,conversation_scope_bind,conversation_scope_unbind,enrich_declare,enrich_due,enrich_land,enrich_normalize,entity_field_declare,entity_field_retire,entity_field_update,entity_value_write,external_write_through,form_declare,form_submit,inbound_mail_land,io_comment_resolve,io_comment_write,io_import_begin,io_import_finish,io_restore,migrate_purge,migrate_reclass,my_levels,organization_clear,portal_declare,portal_invitation,portal_invite,portal_principal_bind,promote_table,query_visibility_parity,read_record,read_records,record_table,share_grant,subscription_mute,subscription_preview,table_share_outside_accept,table_share_outside_invite,table_share_outside_resend,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_person" },
1251
+ { code: "42501", raised_by: "_doc_render_immutable,_doc_signature_immutable,_field_definition_write,_field_write_door,_rule_definition_write,_store_door,anon_capture,anon_inbound_land,anon_publish,anon_token_issue,anon_token_verify,anon_write,assert_client_may_change,assert_client_may_open,assert_client_may_reach,assert_may_know_table,assert_organization_admin,assert_store_door,booking_confirm,booking_declare,booking_hold,capture_submit,checklist_run,comment_write,conversation_scope_bind,conversation_scope_unbind,enrich_declare,enrich_due,enrich_land,enrich_normalize,entity_field_declare,entity_field_retire,entity_field_update,entity_value_write,external_write_through,form_declare,form_submit,inbound_mail_land,io_comment_resolve,io_comment_write,io_import_begin,io_import_finish,io_restore,migrate_purge,migrate_reclass,my_levels,organization_clear,portal_declare,portal_invitation,portal_invite,portal_principal_bind,promote_table,query_visibility_parity,read_record,read_records,read_records_by_ids,record_table,share_grant,subscription_mute,subscription_preview,table_share_outside_accept,table_share_outside_invite,table_share_outside_resend,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_person" },
1205
1252
  { code: "42703", raised_by: "entity_table,portal_declare" },
1206
1253
  { code: "53400", raised_by: "anon_rate_take,delete_cascade_closure,enrich_due,enrich_land,promote_field" },
1207
1254
  { code: "54001", raised_by: "record_delete" },