@ai-matrx/records 0.40.0 → 0.42.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.
@@ -689,7 +689,7 @@ declare const STORE_DOORS: readonly [{
689
689
  readonly name: "computed_provenance";
690
690
  readonly args: "p_organization_id uuid, p_record_id uuid";
691
691
  readonly returns: "TABLE(field_key text, field_id uuid, value jsonb, rule_id uuid, rule_version integer, computed_at timestamp with time zone)";
692
- readonly security: "invoker";
692
+ readonly security: "definer";
693
693
  }, {
694
694
  readonly name: "containment_chain";
695
695
  readonly args: "p_organization_id uuid, p_record_id uuid";
@@ -1455,6 +1455,11 @@ declare const STORE_DOORS: readonly [{
1455
1455
  readonly args: "";
1456
1456
  readonly returns: "trigger";
1457
1457
  readonly security: "definer";
1458
+ }, {
1459
+ readonly name: "io_outbox_broadcast_stmt";
1460
+ readonly args: "";
1461
+ readonly returns: "trigger";
1462
+ readonly security: "definer";
1458
1463
  }, {
1459
1464
  readonly name: "io_outbox_drain";
1460
1465
  readonly args: "p_organization_id uuid, p_consumer text, p_limit integer DEFAULT 100, p_event_key text DEFAULT 'records.changed'::text";
@@ -1580,6 +1585,11 @@ declare const STORE_DOORS: readonly [{
1580
1585
  readonly args: "p_mask jsonb, p_key text";
1581
1586
  readonly returns: "boolean";
1582
1587
  readonly security: "invoker";
1588
+ }, {
1589
+ readonly name: "may_invite_outside";
1590
+ readonly args: "p_organization_id uuid, p_table_id uuid";
1591
+ readonly returns: "boolean";
1592
+ readonly security: "definer";
1583
1593
  }, {
1584
1594
  readonly name: "merge_field_kernel_id";
1585
1595
  readonly args: "";
@@ -2065,6 +2075,11 @@ declare const STORE_DOORS: readonly [{
2065
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";
2066
2076
  readonly returns: "TABLE(id uuid, document jsonb, level permission_level)";
2067
2077
  readonly security: "definer";
2078
+ }, {
2079
+ readonly name: "realtime_topic_admits";
2080
+ readonly args: "p_topic text";
2081
+ readonly returns: "boolean";
2082
+ readonly security: "definer";
2068
2083
  }, {
2069
2084
  readonly name: "record_aggregate";
2070
2085
  readonly 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";
@@ -2575,6 +2590,36 @@ declare const STORE_DOORS: readonly [{
2575
2590
  readonly args: "p_organization_id uuid, p_table_id uuid, p_use text, p_record_type text DEFAULT NULL::text";
2576
2591
  readonly returns: "SETOF custom.record";
2577
2592
  readonly security: "invoker";
2593
+ }, {
2594
+ readonly name: "table_share_outside";
2595
+ readonly args: "p_organization_id uuid, p_table_id uuid";
2596
+ readonly returns: "jsonb";
2597
+ readonly security: "definer";
2598
+ }, {
2599
+ readonly name: "table_share_outside_accept";
2600
+ readonly args: "p_token text";
2601
+ readonly returns: "jsonb";
2602
+ readonly security: "definer";
2603
+ }, {
2604
+ readonly name: "table_share_outside_for_me";
2605
+ readonly args: "";
2606
+ readonly returns: "TABLE(invitation_id uuid, organization_id uuid, organization text, table_id uuid, table_name text, level text, level_label text, token text, expires_at timestamp with time zone, say text)";
2607
+ readonly security: "definer";
2608
+ }, {
2609
+ readonly name: "table_share_outside_invite";
2610
+ readonly args: "p_organization_id uuid, p_table_id uuid, p_email text, p_level permission_level DEFAULT 'viewer'::permission_level";
2611
+ readonly returns: "jsonb";
2612
+ readonly security: "definer";
2613
+ }, {
2614
+ readonly name: "table_share_outside_resend";
2615
+ readonly args: "p_organization_id uuid, p_invitation_id uuid";
2616
+ readonly returns: "jsonb";
2617
+ readonly security: "definer";
2618
+ }, {
2619
+ readonly name: "table_share_outside_revoke";
2620
+ readonly args: "p_organization_id uuid, p_invitation_id uuid";
2621
+ readonly returns: "jsonb";
2622
+ readonly security: "definer";
2578
2623
  }, {
2579
2624
  readonly name: "table_stage_field";
2580
2625
  readonly args: "p_organization_id uuid, p_table_id uuid";
@@ -3024,6 +3069,10 @@ declare const STORE_KNOBS: readonly [{
3024
3069
  readonly key: "member_default_visibility";
3025
3070
  readonly value: "\"all_records\"";
3026
3071
  readonly type: "enum";
3072
+ }, {
3073
+ readonly key: "outside_invite_who";
3074
+ readonly value: "\"org_admins_and_table_owners\"";
3075
+ readonly type: "string";
3027
3076
  }, {
3028
3077
  readonly key: "page_size_ceiling";
3029
3078
  readonly value: "1000";
@@ -3089,7 +3138,7 @@ declare const STORE_KNOBS: readonly [{
3089
3138
  */
3090
3139
  declare const STORE_REFUSAL_CODES: readonly [{
3091
3140
  readonly code: "02000";
3092
- 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,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_assign,work_record_states,work_set_state";
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";
3093
3142
  }, {
3094
3143
  readonly code: "0A000";
3095
3144
  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";
@@ -3098,7 +3147,7 @@ declare const STORE_REFUSAL_CODES: readonly [{
3098
3147
  readonly raised_by: "context_resolve";
3099
3148
  }, {
3100
3149
  readonly code: "22004";
3101
- readonly 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,value_restore,view_declare,work_approval_decide,work_approval_request,work_template_declare";
3150
+ readonly 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";
3102
3151
  }, {
3103
3152
  readonly code: "22007";
3104
3153
  readonly raised_by: "dashboard_window_sql";
@@ -3113,7 +3162,7 @@ declare const STORE_REFUSAL_CODES: readonly [{
3113
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";
3114
3163
  }, {
3115
3164
  readonly code: "23505";
3116
- 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,work_approval_decide,work_slot_hold";
3165
+ 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";
3117
3166
  }, {
3118
3167
  readonly code: "23514";
3119
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";
@@ -3122,7 +3171,7 @@ declare const STORE_REFUSAL_CODES: readonly [{
3122
3171
  readonly raised_by: "has_visibility_at";
3123
3172
  }, {
3124
3173
  readonly code: "42501";
3125
- 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,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_person";
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";
3126
3175
  }, {
3127
3176
  readonly code: "42703";
3128
3177
  readonly raised_by: "entity_table,portal_declare";
@@ -3833,6 +3882,22 @@ interface FieldPatch {
3833
3882
  unique?: boolean;
3834
3883
  /** §D / T7: which fields a worked-out column reads. */
3835
3884
  depends_on?: Uuid[];
3885
+ /**
3886
+ * FLD-9. WHEN a worked-out column works its answer out: when somebody reads the record,
3887
+ * or when somebody saves it.
3888
+ *
3889
+ * This door accepted the word, answered success and threw it away until 2026-09-21
3890
+ * (matrx-frontend `migrations/campaign/tails2_a_formula_says_when_it_works_itself_out.sql`)
3891
+ * — its spec builder used a fixed key list that did not carry it, so a person declaring a
3892
+ * write-stamped formula through this door silently got a read-time one. It is applied now,
3893
+ * in both arms, and the records already saved are brought with it.
3894
+ *
3895
+ * TWO THINGS IT REFUSES BY NAME rather than forcing quietly: a column that is not worked
3896
+ * out by the store has no moment to be worked out at, and a ROLL-UP adds up OTHER records,
3897
+ * so an answer stamped when this record was last saved would be wrong the moment one of
3898
+ * them changed — a roll-up is always `read`.
3899
+ */
3900
+ compute_on?: ComputeOn;
3836
3901
  }
3837
3902
 
3838
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 };
@@ -689,7 +689,7 @@ declare const STORE_DOORS: readonly [{
689
689
  readonly name: "computed_provenance";
690
690
  readonly args: "p_organization_id uuid, p_record_id uuid";
691
691
  readonly returns: "TABLE(field_key text, field_id uuid, value jsonb, rule_id uuid, rule_version integer, computed_at timestamp with time zone)";
692
- readonly security: "invoker";
692
+ readonly security: "definer";
693
693
  }, {
694
694
  readonly name: "containment_chain";
695
695
  readonly args: "p_organization_id uuid, p_record_id uuid";
@@ -1455,6 +1455,11 @@ declare const STORE_DOORS: readonly [{
1455
1455
  readonly args: "";
1456
1456
  readonly returns: "trigger";
1457
1457
  readonly security: "definer";
1458
+ }, {
1459
+ readonly name: "io_outbox_broadcast_stmt";
1460
+ readonly args: "";
1461
+ readonly returns: "trigger";
1462
+ readonly security: "definer";
1458
1463
  }, {
1459
1464
  readonly name: "io_outbox_drain";
1460
1465
  readonly args: "p_organization_id uuid, p_consumer text, p_limit integer DEFAULT 100, p_event_key text DEFAULT 'records.changed'::text";
@@ -1580,6 +1585,11 @@ declare const STORE_DOORS: readonly [{
1580
1585
  readonly args: "p_mask jsonb, p_key text";
1581
1586
  readonly returns: "boolean";
1582
1587
  readonly security: "invoker";
1588
+ }, {
1589
+ readonly name: "may_invite_outside";
1590
+ readonly args: "p_organization_id uuid, p_table_id uuid";
1591
+ readonly returns: "boolean";
1592
+ readonly security: "definer";
1583
1593
  }, {
1584
1594
  readonly name: "merge_field_kernel_id";
1585
1595
  readonly args: "";
@@ -2065,6 +2075,11 @@ declare const STORE_DOORS: readonly [{
2065
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";
2066
2076
  readonly returns: "TABLE(id uuid, document jsonb, level permission_level)";
2067
2077
  readonly security: "definer";
2078
+ }, {
2079
+ readonly name: "realtime_topic_admits";
2080
+ readonly args: "p_topic text";
2081
+ readonly returns: "boolean";
2082
+ readonly security: "definer";
2068
2083
  }, {
2069
2084
  readonly name: "record_aggregate";
2070
2085
  readonly 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";
@@ -2575,6 +2590,36 @@ declare const STORE_DOORS: readonly [{
2575
2590
  readonly args: "p_organization_id uuid, p_table_id uuid, p_use text, p_record_type text DEFAULT NULL::text";
2576
2591
  readonly returns: "SETOF custom.record";
2577
2592
  readonly security: "invoker";
2593
+ }, {
2594
+ readonly name: "table_share_outside";
2595
+ readonly args: "p_organization_id uuid, p_table_id uuid";
2596
+ readonly returns: "jsonb";
2597
+ readonly security: "definer";
2598
+ }, {
2599
+ readonly name: "table_share_outside_accept";
2600
+ readonly args: "p_token text";
2601
+ readonly returns: "jsonb";
2602
+ readonly security: "definer";
2603
+ }, {
2604
+ readonly name: "table_share_outside_for_me";
2605
+ readonly args: "";
2606
+ readonly returns: "TABLE(invitation_id uuid, organization_id uuid, organization text, table_id uuid, table_name text, level text, level_label text, token text, expires_at timestamp with time zone, say text)";
2607
+ readonly security: "definer";
2608
+ }, {
2609
+ readonly name: "table_share_outside_invite";
2610
+ readonly args: "p_organization_id uuid, p_table_id uuid, p_email text, p_level permission_level DEFAULT 'viewer'::permission_level";
2611
+ readonly returns: "jsonb";
2612
+ readonly security: "definer";
2613
+ }, {
2614
+ readonly name: "table_share_outside_resend";
2615
+ readonly args: "p_organization_id uuid, p_invitation_id uuid";
2616
+ readonly returns: "jsonb";
2617
+ readonly security: "definer";
2618
+ }, {
2619
+ readonly name: "table_share_outside_revoke";
2620
+ readonly args: "p_organization_id uuid, p_invitation_id uuid";
2621
+ readonly returns: "jsonb";
2622
+ readonly security: "definer";
2578
2623
  }, {
2579
2624
  readonly name: "table_stage_field";
2580
2625
  readonly args: "p_organization_id uuid, p_table_id uuid";
@@ -3024,6 +3069,10 @@ declare const STORE_KNOBS: readonly [{
3024
3069
  readonly key: "member_default_visibility";
3025
3070
  readonly value: "\"all_records\"";
3026
3071
  readonly type: "enum";
3072
+ }, {
3073
+ readonly key: "outside_invite_who";
3074
+ readonly value: "\"org_admins_and_table_owners\"";
3075
+ readonly type: "string";
3027
3076
  }, {
3028
3077
  readonly key: "page_size_ceiling";
3029
3078
  readonly value: "1000";
@@ -3089,7 +3138,7 @@ declare const STORE_KNOBS: readonly [{
3089
3138
  */
3090
3139
  declare const STORE_REFUSAL_CODES: readonly [{
3091
3140
  readonly code: "02000";
3092
- 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,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_assign,work_record_states,work_set_state";
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";
3093
3142
  }, {
3094
3143
  readonly code: "0A000";
3095
3144
  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";
@@ -3098,7 +3147,7 @@ declare const STORE_REFUSAL_CODES: readonly [{
3098
3147
  readonly raised_by: "context_resolve";
3099
3148
  }, {
3100
3149
  readonly code: "22004";
3101
- readonly 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,value_restore,view_declare,work_approval_decide,work_approval_request,work_template_declare";
3150
+ readonly 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";
3102
3151
  }, {
3103
3152
  readonly code: "22007";
3104
3153
  readonly raised_by: "dashboard_window_sql";
@@ -3113,7 +3162,7 @@ declare const STORE_REFUSAL_CODES: readonly [{
3113
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";
3114
3163
  }, {
3115
3164
  readonly code: "23505";
3116
- 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,work_approval_decide,work_slot_hold";
3165
+ 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";
3117
3166
  }, {
3118
3167
  readonly code: "23514";
3119
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";
@@ -3122,7 +3171,7 @@ declare const STORE_REFUSAL_CODES: readonly [{
3122
3171
  readonly raised_by: "has_visibility_at";
3123
3172
  }, {
3124
3173
  readonly code: "42501";
3125
- 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,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_person";
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";
3126
3175
  }, {
3127
3176
  readonly code: "42703";
3128
3177
  readonly raised_by: "entity_table,portal_declare";
@@ -3833,6 +3882,22 @@ interface FieldPatch {
3833
3882
  unique?: boolean;
3834
3883
  /** §D / T7: which fields a worked-out column reads. */
3835
3884
  depends_on?: Uuid[];
3885
+ /**
3886
+ * FLD-9. WHEN a worked-out column works its answer out: when somebody reads the record,
3887
+ * or when somebody saves it.
3888
+ *
3889
+ * This door accepted the word, answered success and threw it away until 2026-09-21
3890
+ * (matrx-frontend `migrations/campaign/tails2_a_formula_says_when_it_works_itself_out.sql`)
3891
+ * — its spec builder used a fixed key list that did not carry it, so a person declaring a
3892
+ * write-stamped formula through this door silently got a read-time one. It is applied now,
3893
+ * in both arms, and the records already saved are brought with it.
3894
+ *
3895
+ * TWO THINGS IT REFUSES BY NAME rather than forcing quietly: a column that is not worked
3896
+ * out by the store has no moment to be worked out at, and a ROLL-UP adds up OTHER records,
3897
+ * so an answer stamped when this record was last saved would be wrong the moment one of
3898
+ * them changed — a roll-up is always `read`.
3899
+ */
3900
+ compute_on?: ComputeOn;
3836
3901
  }
3837
3902
 
3838
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 };
package/dist/index.cjs CHANGED
@@ -688,7 +688,7 @@ var STORE_DOORS = [
688
688
  { name: "comment_thread", args: "p_organization_id uuid, p_record_id uuid, p_include_resolved boolean DEFAULT false", returns: "jsonb", security: "definer" },
689
689
  { name: "comment_write", args: "p_organization_id uuid, p_record_id uuid, p_body text, p_anchor jsonb DEFAULT '{}'::jsonb, p_parent_comment_id uuid DEFAULT NULL::uuid, p_mentions uuid[] DEFAULT NULL::uuid[]", returns: "jsonb", security: "definer" },
690
690
  { name: "computed_block", args: "p_block jsonb", returns: "jsonb", security: "invoker" },
691
- { name: "computed_provenance", args: "p_organization_id uuid, p_record_id uuid", returns: "TABLE(field_key text, field_id uuid, value jsonb, rule_id uuid, rule_version integer, computed_at timestamp with time zone)", security: "invoker" },
691
+ { name: "computed_provenance", args: "p_organization_id uuid, p_record_id uuid", returns: "TABLE(field_key text, field_id uuid, value jsonb, rule_id uuid, rule_version integer, computed_at timestamp with time zone)", security: "definer" },
692
692
  { name: "containment_chain", args: "p_organization_id uuid, p_record_id uuid", returns: "TABLE(ancestor_id uuid, depth integer)", security: "invoker" },
693
693
  { name: "containment_depth_ceiling", args: "p_organization_id uuid DEFAULT NULL::uuid", returns: "integer", security: "invoker" },
694
694
  { name: "containment_edges", args: "p_organization_id uuid", returns: "TABLE(parent_id uuid, child_id uuid, via text)", security: "invoker" },
@@ -842,6 +842,7 @@ var STORE_DOORS = [
842
842
  { name: "io_infer_type", args: "p_samples jsonb", returns: "text", security: "invoker" },
843
843
  { name: "io_money_unit", args: "p_word text", returns: "text", security: "invoker" },
844
844
  { name: "io_outbox_announce", args: "", returns: "trigger", security: "definer" },
845
+ { name: "io_outbox_broadcast_stmt", args: "", returns: "trigger", security: "definer" },
845
846
  { name: "io_outbox_drain", args: "p_organization_id uuid, p_consumer text, p_limit integer DEFAULT 100, p_event_key text DEFAULT 'records.changed'::text", returns: "TABLE(outbox_id uuid, record_id uuid, table_id uuid, operation text, changed_field_ids jsonb, actor jsonb, occurred_at timestamp with time zone)", security: "definer" },
846
847
  { name: "io_outbox_release", args: "p_organization_id uuid, p_consumer text, p_older_than interval DEFAULT '00:15:00'::interval", returns: "integer", security: "definer" },
847
848
  { name: "io_proposal_accept", args: "p_organization_id uuid, p_import_id uuid, p_column text, p_type text DEFAULT NULL::text, p_label text DEFAULT NULL::text", returns: "uuid", security: "definer" },
@@ -867,6 +868,7 @@ var STORE_DOORS = [
867
868
  { name: "mask_document", args: "p_document jsonb, p_visible_keys text[], p_notices jsonb, p_by_id boolean DEFAULT false, p_key_ids jsonb DEFAULT '{}'::jsonb", returns: "jsonb", security: "invoker" },
868
869
  { name: "mask_document", args: "p_document jsonb, p_visible_keys text[], p_notices jsonb, p_by_id boolean DEFAULT false, p_key_ids jsonb DEFAULT '{}'::jsonb, p_declared_keys text[] DEFAULT NULL::text[]", returns: "jsonb", security: "invoker" },
869
870
  { name: "mask_says_withheld", args: "p_mask jsonb, p_key text", returns: "boolean", security: "invoker" },
871
+ { name: "may_invite_outside", args: "p_organization_id uuid, p_table_id uuid", returns: "boolean", security: "definer" },
870
872
  { name: "merge_field_kernel_id", args: "", returns: "uuid", security: "invoker" },
871
873
  { name: "migrate_choice_keys", args: "p_organization_id uuid, p_table_id uuid, p_dry_run boolean DEFAULT false", returns: "jsonb", security: "definer" },
872
874
  { name: "migrate_delete", args: "p_organization_id uuid, p_record_id uuid, p_note text DEFAULT NULL::text", returns: "jsonb", security: "definer" },
@@ -964,6 +966,7 @@ var STORE_DOORS = [
964
966
  { name: "read_paths_outside_the_door", args: "", returns: "TABLE(object_name text, why text)", security: "invoker" },
965
967
  { name: "read_record", args: "p_organization_id uuid, p_record_id uuid, p_by_id boolean DEFAULT false", returns: "jsonb", security: "definer" },
966
968
  { 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" },
969
+ { name: "realtime_topic_admits", args: "p_topic text", returns: "boolean", security: "definer" },
967
970
  { 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" },
968
971
  { 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" },
969
972
  { name: "record_as_of", args: "p_organization_id uuid, p_record_id uuid, p_at timestamp with time zone", returns: "TABLE(state jsonb, replayed boolean)", security: "definer" },
@@ -1066,6 +1069,12 @@ var STORE_DOORS = [
1066
1069
  { name: "table_record_ceiling", args: "", returns: "integer", security: "invoker" },
1067
1070
  { name: "table_record_ceiling", args: "p_organization_id uuid", returns: "integer", security: "invoker" },
1068
1071
  { name: "table_rules", args: "p_organization_id uuid, p_table_id uuid, p_use text, p_record_type text DEFAULT NULL::text", returns: "SETOF custom.record", security: "invoker" },
1072
+ { name: "table_share_outside", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "definer" },
1073
+ { name: "table_share_outside_accept", args: "p_token text", returns: "jsonb", security: "definer" },
1074
+ { name: "table_share_outside_for_me", args: "", returns: "TABLE(invitation_id uuid, organization_id uuid, organization text, table_id uuid, table_name text, level text, level_label text, token text, expires_at timestamp with time zone, say text)", security: "definer" },
1075
+ { name: "table_share_outside_invite", args: "p_organization_id uuid, p_table_id uuid, p_email text, p_level permission_level DEFAULT 'viewer'::permission_level", returns: "jsonb", security: "definer" },
1076
+ { name: "table_share_outside_resend", args: "p_organization_id uuid, p_invitation_id uuid", returns: "jsonb", security: "definer" },
1077
+ { name: "table_share_outside_revoke", args: "p_organization_id uuid, p_invitation_id uuid", returns: "jsonb", security: "definer" },
1069
1078
  { name: "table_stage_field", args: "p_organization_id uuid, p_table_id uuid", returns: "text", security: "definer" },
1070
1079
  { name: "table_storage", args: "p_organization_id uuid, p_table_id uuid", returns: "text", security: "invoker" },
1071
1080
  { name: "table_type_field", args: "p_organization_id uuid, p_table_id uuid", returns: "text", security: "definer" },
@@ -1164,6 +1173,7 @@ var STORE_KNOBS = [
1164
1173
  { key: "inbound_domain", value: '"inbound.matrxserver.com"', type: "string" },
1165
1174
  { key: "member_default_level", value: '"viewer"', type: "enum" },
1166
1175
  { key: "member_default_visibility", value: '"all_records"', type: "enum" },
1176
+ { key: "outside_invite_who", value: '"org_admins_and_table_owners"', type: "string" },
1167
1177
  { key: "page_size_ceiling", value: "1000", type: "integer" },
1168
1178
  { key: "provenance_retention_days", value: "30", type: "number" },
1169
1179
  { key: "records_tool_default", value: "true", type: "boolean" },
@@ -1180,18 +1190,18 @@ var STORE_KNOBS = [
1180
1190
  { key: "world_publish_enabled", value: "false", type: "boolean" }
1181
1191
  ];
1182
1192
  var STORE_REFUSAL_CODES = [
1183
- { 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,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_assign,work_record_states,work_set_state" },
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" },
1184
1194
  { 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" },
1185
1195
  { code: "22003", raised_by: "context_resolve" },
1186
- { 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,value_restore,view_declare,work_approval_decide,work_approval_request,work_template_declare" },
1196
+ { 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" },
1187
1197
  { code: "22007", raised_by: "dashboard_window_sql" },
1188
1198
  { code: "22012", raised_by: "rule_eval" },
1189
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" },
1190
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" },
1191
- { 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,work_approval_decide,work_slot_hold" },
1201
+ { 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" },
1192
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" },
1193
1203
  { code: "40001", raised_by: "has_visibility_at" },
1194
- { 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,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_person" },
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" },
1195
1205
  { code: "42703", raised_by: "entity_table,portal_declare" },
1196
1206
  { code: "53400", raised_by: "anon_rate_take,delete_cascade_closure,enrich_due,enrich_land,promote_field" },
1197
1207
  { code: "54001", raised_by: "record_delete" },