@ai-matrx/records 0.51.0 → 0.53.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.
@@ -31,6 +31,7 @@ __export(react_exports, {
31
31
  CONTEXT_POLICIES: () => CONTEXT_POLICIES,
32
32
  DECLARABLE_FIELD_KINDS: () => DECLARABLE_FIELD_KINDS,
33
33
  DEFAULT_ARCHIVE_LANE: () => DEFAULT_ARCHIVE_LANE,
34
+ DEFAULT_PORTAL_ARCHIVE_FILTER: () => DEFAULT_PORTAL_ARCHIVE_FILTER,
34
35
  DELIVERIES: () => DELIVERIES,
35
36
  ENTITY_TOKENS: () => ENTITY_TOKENS,
36
37
  FIELD_KINDS: () => FIELD_KINDS,
@@ -47,6 +48,7 @@ __export(react_exports, {
47
48
  PERMISSION_LEVELS: () => PERMISSION_LEVELS,
48
49
  PER_VALUE_ACCESS_WORDS: () => PER_VALUE_ACCESS_WORDS,
49
50
  PIPELINE_RULE_KINDS: () => PIPELINE_RULE_KINDS,
51
+ PORTAL_ARCHIVE_FILTERS: () => PORTAL_ARCHIVE_FILTERS,
50
52
  REFUSALS_WORTH_REPEATING: () => REFUSALS_WORTH_REPEATING,
51
53
  RELATION_BINDINGS: () => RELATION_BINDINGS,
52
54
  RELATION_CARDINALITIES: () => RELATION_CARDINALITIES,
@@ -78,6 +80,7 @@ __export(react_exports, {
78
80
  coerceTypedAnswers: () => coerceTypedAnswers,
79
81
  coercionLabel: () => coercionLabel,
80
82
  emptyArchiveLine: () => emptyArchiveLine,
83
+ emptyPortalArchiveLine: () => emptyPortalArchiveLine,
81
84
  err: () => err,
82
85
  fieldKindFor: () => fieldKindFor,
83
86
  forgetAllOps: () => forgetAllOps,
@@ -87,6 +90,7 @@ __export(react_exports, {
87
90
  isArchiveLane: () => isArchiveLane,
88
91
  isDecided: () => isDecided,
89
92
  isOwnOp: () => isOwnOp,
93
+ isPortalArchiveFilter: () => isPortalArchiveFilter,
90
94
  isRecordsErr: () => isRecordsErr,
91
95
  isTheChosen: () => isTheChosen,
92
96
  looksLikeAnId: () => looksLikeAnId,
@@ -99,7 +103,10 @@ __export(react_exports, {
99
103
  openCaptureQueue: () => openCaptureQueue,
100
104
  optionKey: () => optionKey,
101
105
  optionLabel: () => optionLabel,
106
+ portalArchiveConsequence: () => portalArchiveConsequence,
107
+ portalConfirmLine: () => portalConfirmLine,
102
108
  portalPath: () => portalPath,
109
+ portalTitleTypedBack: () => portalTitleTypedBack,
103
110
  publicFormPath: () => publicFormPath,
104
111
  rememberedOpCount: () => rememberedOpCount,
105
112
  sameDocument: () => sameDocument,
@@ -123,6 +130,7 @@ __export(react_exports, {
123
130
  useRecordsActor: () => useRecordsActor,
124
131
  useRecordsClient: () => useRecordsClient,
125
132
  useTable: () => useTable,
133
+ useTableArchive: () => useTableArchive,
126
134
  useTables: () => useTables
127
135
  });
128
136
  module.exports = __toCommonJS(react_exports);
@@ -573,6 +581,7 @@ var STORE_DOORS = [
573
581
  { name: "io_export", args: "p_organization_id uuid, p_table_id uuid, p_columns text[] DEFAULT NULL::text[], p_limit integer DEFAULT 10000, p_required text DEFAULT 'viewer'::text", returns: "jsonb", security: "definer" },
574
582
  { name: "io_export_csv", args: "p_organization_id uuid, p_table_id uuid, p_columns text[] DEFAULT NULL::text[], p_limit integer DEFAULT 10000, p_delimiter text DEFAULT chr(44), p_required text DEFAULT 'viewer'::text", returns: "text", security: "definer" },
575
583
  { name: "io_import_begin", args: "p_organization_id uuid, p_table_id uuid, p_format text DEFAULT 'csv'::text, p_source_name text DEFAULT NULL::text, p_source_columns jsonb DEFAULT '[]'::jsonb, p_file_hash text DEFAULT NULL::text, p_policy jsonb DEFAULT '{}'::jsonb, p_dedupe_key text DEFAULT NULL::text, p_file_bytes bigint DEFAULT NULL::bigint, p_force boolean DEFAULT false", returns: "jsonb", security: "definer" },
584
+ { name: "io_import_declare_columns", args: "p_organization_id uuid, p_table_id uuid, p_rows jsonb, p_mapping jsonb DEFAULT '{}'::jsonb", returns: "jsonb", security: "definer" },
576
585
  { name: "io_import_finish", args: "p_organization_id uuid, p_import_id uuid, p_unmapped text DEFAULT NULL::text", returns: "jsonb", security: "definer" },
577
586
  { name: "io_import_forget", args: "p_organization_id uuid, p_import_id uuid", returns: "boolean", security: "definer" },
578
587
  { name: "io_import_open", args: "p_organization_id uuid, p_table_id uuid, p_format text DEFAULT 'csv'::text, p_source_name text DEFAULT NULL::text, p_source_columns jsonb DEFAULT '[]'::jsonb", returns: "uuid", security: "definer" },
@@ -606,6 +615,7 @@ var STORE_DOORS = [
606
615
  { name: "levels_raised_by_a_less_specific_rung", args: "", returns: "TABLE(organization_id uuid, organization_name text, member_id uuid, member_email text, record_id uuid, addressed_level permission_level, answered_level permission_level)", security: "definer" },
607
616
  { name: "list_door_disagreements", args: "p_pretend text DEFAULT NULL::text, p_only_organization uuid DEFAULT NULL::uuid, p_sample integer DEFAULT 200", returns: "TABLE(organization_id uuid, organization_name text, member_id uuid, table_id uuid, record_id uuid, door text, why text)", security: "invoker" },
608
617
  { name: "list_door_disagreements", args: "p_pretend text, p_only_organization uuid, p_sample integer, p_exhaustive boolean", returns: "TABLE(organization_id uuid, organization_name text, member_id uuid, table_id uuid, record_id uuid, door text, why text)", security: "invoker" },
618
+ { name: "list_portals", args: "p_organization_id uuid, p_archived text DEFAULT 'active'::text", returns: "TABLE(portal_id uuid, title text, slug text, client_table_id uuid, client_table text, is_active boolean, tables integer, invited integer, signed_in integer, sign_in_method text, opened_at timestamp with time zone)", security: "definer" },
609
619
  { name: "lookup_value", args: "p_organization_id uuid, p_record_id uuid, p_field_data jsonb", returns: "jsonb", security: "invoker" },
610
620
  { 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" },
611
621
  { 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" },
@@ -655,6 +665,7 @@ var STORE_DOORS = [
655
665
  { name: "pipeline_read", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "definer" },
656
666
  { name: "pipeline_transition_refusal", args: "p_organization_id uuid, p_record_id uuid, p_to text", returns: "jsonb", security: "definer" },
657
667
  { name: "portal_admits", args: "p_organization_id uuid, p_user_id uuid DEFAULT NULL::uuid", returns: "boolean", security: "definer" },
668
+ { name: "portal_archive", args: "p_organization_id uuid, p_portal_id uuid, p_confirm_title text, p_reason text DEFAULT NULL::text", returns: "jsonb", security: "definer" },
658
669
  { name: "portal_card", args: "p_organization_id uuid, p_portal_id uuid", returns: "jsonb", security: "definer" },
659
670
  { name: "portal_declare", args: "p_organization_id uuid, p_title text, p_client_table_id uuid, p_tables jsonb, p_portal_id uuid DEFAULT NULL::uuid, p_slug text DEFAULT NULL::text, p_sign_in_method text DEFAULT 'magic_link'::text", returns: "uuid", security: "definer" },
660
671
  { name: "portal_field_map", args: "p_organization_id uuid, p_table_id uuid", returns: "TABLE(field_id uuid, field_key text, field_type text, points_at uuid)", security: "definer" },
@@ -666,6 +677,7 @@ var STORE_DOORS = [
666
677
  { name: "portal_principal_bind", args: "p_organization_id uuid, p_principal_id uuid, p_user_id uuid", returns: "jsonb", security: "definer" },
667
678
  { name: "portal_public", args: "p_slug text", returns: "jsonb", security: "definer" },
668
679
  { name: "portal_record_title", args: "p_organization_id uuid, p_record_id uuid", returns: "text", security: "definer" },
680
+ { name: "portal_restore", args: "p_organization_id uuid, p_portal_id uuid, p_confirm_title text", returns: "jsonb", security: "definer" },
669
681
  { name: "portal_revoke", args: "p_organization_id uuid, p_portal_id uuid, p_principal_id uuid", returns: "jsonb", security: "definer" },
670
682
  { name: "portal_slug", args: "p_organization_id uuid, p_title text, p_portal_id uuid DEFAULT NULL::uuid", returns: "text", security: "definer" },
671
683
  { name: "portal_tables", args: "p_organization_id uuid", returns: "TABLE(portal_id uuid, table_id uuid, name text)", security: "definer" },
@@ -808,6 +820,7 @@ var STORE_DOORS = [
808
820
  { name: "stamp_value_envelopes", args: "p_data jsonb, p_actor text, p_on_behalf_of text, p_at timestamp with time zone", returns: "jsonb", security: "invoker" },
809
821
  { name: "storage_modes", args: "", returns: "text[]", security: "invoker" },
810
822
  { name: "store_is_open", args: "p_organization_id uuid DEFAULT NULL::uuid", returns: "boolean", security: "invoker" },
823
+ { name: "store_off_sentence", args: "p_organization_id uuid", returns: "text", security: "invoker" },
811
824
  { name: "subscription_cadences", args: "p_organization_id uuid", returns: "text[]", security: "definer" },
812
825
  { name: "subscription_declare", args: "p_organization_id uuid, p_table_id uuid, p_spec jsonb", returns: "uuid", security: "definer" },
813
826
  { name: "subscription_mute", args: "p_organization_id uuid, p_rule_id uuid, p_muted boolean DEFAULT true", returns: "boolean", security: "definer" },
@@ -946,16 +959,16 @@ var STORE_KNOBS = [
946
959
  { key: "world_publish_enabled", value: "false", type: "boolean" }
947
960
  ];
948
961
  var STORE_REFUSAL_CODES = [
949
- { code: "02000", raised_by: "_checklist_instantiate,_portal_invite_payload,_share_write_person,_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_invite_accept,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_archive,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" },
962
+ { code: "02000", raised_by: "_checklist_instantiate,_portal_invite_payload,_share_write_person,_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_archive,portal_card,portal_declare,portal_invite,portal_invite_accept,portal_preview,portal_principal_bind,portal_restore,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_archive,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" },
950
963
  { 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" },
951
964
  { code: "22003", raised_by: "context_resolve" },
952
965
  { code: "22004", raised_by: "_entity_custom_fields_guard,_share_write_person,_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_archive,table_declare,table_share_outside_invite,value_restore,view_declare,work_approval_decide,work_approval_request,work_template_declare" },
953
966
  { code: "22007", raised_by: "dashboard_window_sql" },
954
967
  { code: "22012", raised_by: "rule_eval" },
955
- { 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,field_update,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,read_records_archived,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" },
968
+ { 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,field_update,io_export,io_import_begin,io_import_finish,io_import_plan,io_import_report,io_proposal_accept,list_portals,migrate_merge,migrate_reclass,my_levels,organization_clear,page_size,pin_agent_cells,pipeline_move,portal_declare,provenance_write,query_by_coordinates,query_rollup,read_records_archived,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" },
956
969
  { code: "23503", raised_by: "_booking_availability,_checklist_instantiate,_containment_guard,_display_spec_for,_field_document_for,_field_type_parity_guard,_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" },
957
970
  { code: "23505", raised_by: "_share_write_person,_unique_rule_holds,doc_sign,doc_signature_write,entity_field_declare,field_declare,home_add,inbound_declare,io_proposal_accept,relation_carry,relation_own,sign_request_cancel,sign_request_create,table_share_outside_resend,work_approval_decide,work_slot_hold" },
958
- { 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_comment_write,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" },
971
+ { 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_comment_write,io_import_rows,migrate_merge,portal_archive,portal_restore,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" },
959
972
  { code: "40001", raised_by: "has_visibility_at" },
960
973
  { code: "42501", raised_by: "_doc_render_immutable,_doc_signature_immutable,_field_definition_write,_field_write_door,_rule_definition_write,_store_door,agent_table_claim,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,doc_sign,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_invite_accept,portal_principal_bind,promote_table,query_visibility_parity,read_record,read_records,read_records_archived,read_records_by_ids,read_records_matching,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" },
961
974
  { code: "42703", raised_by: "entity_table,portal_declare" },
@@ -2085,6 +2098,19 @@ var DOORS = {
2085
2098
  fieldOptions: "field_options",
2086
2099
  parityValues: "parity_values",
2087
2100
  tableDeclare: "table_declare",
2101
+ // GETTING RID OF A TABLE — which is a JOB, NOT A STATEMENT (VERIFIER-11 F3).
2102
+ // `record_delete` above is the store's one soft-delete door and it is right
2103
+ // for a record; aimed at a TABLE it recurses through everything the Table
2104
+ // contains inside one transaction, and that is unbounded by construction. A
2105
+ // person pressing "Delete this table" on 1,430 records the product itself
2106
+ // had just imported waited twelve seconds and was told `57014`, "canceling
2107
+ // statement due to statement timeout … Nothing was changed. Try a smaller
2108
+ // page" — advice that means nothing when what you are doing is getting rid
2109
+ // of a table. `custom.table_archive` does the same work in passes and
2110
+ // answers each one with numbers, so a screen shows a sentence and a count
2111
+ // instead of a spinner and an SQLSTATE. It is STATELESS, so a run cut in
2112
+ // half resumes exactly where it stopped: there is no job row to lose.
2113
+ tableArchive: "table_archive",
2088
2114
  // ADDING A COLUMN — the first thing anybody does with a table, and until
2089
2115
  // 2026-09-19 there was no door for it. A Field is a record (REC-25), so a
2090
2116
  // screen wrote one with `record_write`; that door writes ONE row with
@@ -2212,6 +2238,7 @@ var DOORS = {
2212
2238
  // ways to start an import from one client is how they drift.
2213
2239
  importPlan: "io_import_plan",
2214
2240
  importBegin: "io_import_begin",
2241
+ importDeclareColumns: "io_import_declare_columns",
2215
2242
  importRows: "io_import_rows",
2216
2243
  importFinish: "io_import_finish",
2217
2244
  importReport: "io_import_report",
@@ -2248,6 +2275,17 @@ var DOORS = {
2248
2275
  portalInvite: "portal_invite",
2249
2276
  portalRevoke: "portal_revoke",
2250
2277
  portalPreview: "portal_preview",
2278
+ // ORG-CLEANUP, 2026-09-22 — A PORTAL IS ARCHIVED, NEVER DELETED.
2279
+ // `portals` keeps its signature and HIDES archived portals (the law's default
2280
+ // is to hide); `list_portals(org, 'active'|'archived'|'all')` is the
2281
+ // archive-aware reader, taking the platform archive filter's own three values
2282
+ // so one door serves both lanes and no screen has to invent a second control.
2283
+ // `portal_archive` / `portal_restore` are the way out and the way back; both
2284
+ // take the portal's own title typed back, because ten portals can carry one
2285
+ // title and the title alone is not what picks this one.
2286
+ listPortals: "list_portals",
2287
+ portalArchive: "portal_archive",
2288
+ portalRestore: "portal_restore",
2251
2289
  // SCR-16 — the canvas. A dashboard is a record in the presentation kernel
2252
2290
  // whose blocks are saved SPECS for the eighth verb; `dashboardRun` walks them
2253
2291
  // under the CALLER'S principal, so nothing here is precomputed and nothing is
@@ -2728,6 +2766,18 @@ function createRecordsClient(config) {
2728
2766
  "recordRestore"
2729
2767
  );
2730
2768
  },
2769
+ async tableArchive({ table_id, chunk, includeTable }) {
2770
+ return callDoor(
2771
+ DOORS.tableArchive,
2772
+ {
2773
+ p_organization_id: org,
2774
+ p_table_id: table_id,
2775
+ p_chunk: chunk ?? 50,
2776
+ p_include_table: includeTable ?? true
2777
+ },
2778
+ "tableArchive"
2779
+ );
2780
+ },
2731
2781
  async recordRead({ record_id, withComputed = false }) {
2732
2782
  const door = await callDoor(
2733
2783
  DOORS.readRecord,
@@ -3281,6 +3331,18 @@ function createRecordsClient(config) {
3281
3331
  "importBegin"
3282
3332
  );
3283
3333
  },
3334
+ async importDeclareColumns(args) {
3335
+ return callDoor(
3336
+ DOORS.importDeclareColumns,
3337
+ {
3338
+ p_organization_id: org,
3339
+ p_table_id: args.table_id,
3340
+ p_rows: args.rows,
3341
+ p_mapping: args.mapping ?? {}
3342
+ },
3343
+ "importDeclareColumns"
3344
+ );
3345
+ },
3284
3346
  async importRows(args) {
3285
3347
  return callDoor(
3286
3348
  DOORS.importRows,
@@ -3351,6 +3413,36 @@ function createRecordsClient(config) {
3351
3413
  async portals() {
3352
3414
  return callDoor(DOORS.portals, { p_organization_id: org }, "portals");
3353
3415
  },
3416
+ async listPortals(args) {
3417
+ return callDoor(
3418
+ DOORS.listPortals,
3419
+ { p_organization_id: org, p_archived: args?.archived ?? "active" },
3420
+ "listPortals"
3421
+ );
3422
+ },
3423
+ async portalArchive(args) {
3424
+ return callDoor(
3425
+ DOORS.portalArchive,
3426
+ {
3427
+ p_organization_id: org,
3428
+ p_portal_id: args.portal_id,
3429
+ p_confirm_title: args.confirm_title,
3430
+ p_reason: args.reason ?? null
3431
+ },
3432
+ "portalArchive"
3433
+ );
3434
+ },
3435
+ async portalRestore(args) {
3436
+ return callDoor(
3437
+ DOORS.portalRestore,
3438
+ {
3439
+ p_organization_id: org,
3440
+ p_portal_id: args.portal_id,
3441
+ p_confirm_title: args.confirm_title
3442
+ },
3443
+ "portalRestore"
3444
+ );
3445
+ },
3354
3446
  async portalTables() {
3355
3447
  return callDoor(DOORS.portalTables, { p_organization_id: org }, "portalTables");
3356
3448
  },
@@ -4757,6 +4849,85 @@ function useRecordMutation() {
4757
4849
  [client, run, saving, error, conflict]
4758
4850
  );
4759
4851
  }
4852
+ var MIN_ARCHIVE_CHUNK = 10;
4853
+ function useTableArchive(tableId, options) {
4854
+ const client = useRecordsClient();
4855
+ const chunk = options?.chunk ?? 50;
4856
+ const includeTable = options?.includeTable ?? true;
4857
+ const [progress, setProgress] = (0, import_react2.useState)(null);
4858
+ const [running, setRunning] = (0, import_react2.useState)(false);
4859
+ const [passes, setPasses] = (0, import_react2.useState)(0);
4860
+ const [error, setError] = (0, import_react2.useState)(null);
4861
+ const [interrupted, setInterrupted] = (0, import_react2.useState)(false);
4862
+ const [chunkInUse, setChunkInUse] = (0, import_react2.useState)(chunk);
4863
+ const [slowedDown, setSlowedDown] = (0, import_react2.useState)(false);
4864
+ const cut = (0, import_react2.useRef)(false);
4865
+ const preview = (0, import_react2.useCallback)(async () => {
4866
+ setError(null);
4867
+ const answered = await client.tableArchive({ table_id: tableId, chunk: 0, includeTable });
4868
+ if (!answered.ok) {
4869
+ setError(answered.error);
4870
+ return null;
4871
+ }
4872
+ setProgress(answered.data);
4873
+ return answered.data;
4874
+ }, [client, tableId, includeTable]);
4875
+ const loop = (0, import_react2.useCallback)(async () => {
4876
+ cut.current = false;
4877
+ setRunning(true);
4878
+ setError(null);
4879
+ setInterrupted(false);
4880
+ setPasses(0);
4881
+ let last = null;
4882
+ let size = chunk;
4883
+ setChunkInUse(size);
4884
+ setSlowedDown(false);
4885
+ try {
4886
+ for (; ; ) {
4887
+ const answered = await client.tableArchive({ table_id: tableId, chunk: size, includeTable });
4888
+ if (!answered.ok) {
4889
+ if (answered.error.code === "timed_out" && size > MIN_ARCHIVE_CHUNK) {
4890
+ size = Math.max(MIN_ARCHIVE_CHUNK, Math.floor(size / 2));
4891
+ setChunkInUse(size);
4892
+ setSlowedDown(true);
4893
+ continue;
4894
+ }
4895
+ setError(answered.error);
4896
+ setInterrupted(true);
4897
+ return last;
4898
+ }
4899
+ last = answered.data;
4900
+ setProgress(answered.data);
4901
+ setPasses((n) => n + 1);
4902
+ if (answered.data.done) return answered.data;
4903
+ if (cut.current) {
4904
+ setInterrupted(true);
4905
+ return answered.data;
4906
+ }
4907
+ }
4908
+ } finally {
4909
+ setRunning(false);
4910
+ }
4911
+ }, [client, tableId, chunk, includeTable]);
4912
+ return (0, import_react2.useMemo)(
4913
+ () => ({
4914
+ progress,
4915
+ running,
4916
+ passes,
4917
+ chunkInUse,
4918
+ slowedDown,
4919
+ error,
4920
+ interrupted,
4921
+ preview,
4922
+ start: loop,
4923
+ carryOn: loop,
4924
+ stop: () => {
4925
+ cut.current = true;
4926
+ }
4927
+ }),
4928
+ [progress, running, passes, chunkInUse, slowedDown, error, interrupted, preview, loop]
4929
+ );
4930
+ }
4760
4931
  function useEntityFields(token) {
4761
4932
  return useAsync(
4762
4933
  (client) => token ? client.entityFields({ token }) : Promise.resolve({ ok: true, data: [] }),
@@ -5239,6 +5410,24 @@ function publicFormPath(formId) {
5239
5410
  function portalPath(slug) {
5240
5411
  return `/portal/c/${slug}`;
5241
5412
  }
5413
+ var PORTAL_ARCHIVE_FILTERS = ["active", "archived", "all"];
5414
+ var DEFAULT_PORTAL_ARCHIVE_FILTER = "active";
5415
+ function isPortalArchiveFilter(word) {
5416
+ return typeof word === "string" && PORTAL_ARCHIVE_FILTERS.includes(word);
5417
+ }
5418
+ function portalArchiveConsequence(title, signedIn, invited) {
5419
+ const people = invited === 0 ? "Nobody is invited to it" : signedIn === 0 ? `The ${invited} ${invited === 1 ? "person" : "people"} invited to it will not be able to sign in` : `The ${signedIn} ${signedIn === 1 ? "person" : "people"} signed in to it, and the ${invited - signedIn} still invited, will not be able to sign in`;
5420
+ return `\u201C${title}\u201D will leave your portal list. ${people}, and their invitation links will say this portal was archived and can be restored. Nothing is deleted \u2014 every Table it shows and everyone invited to it is kept exactly as it is, and you can restore it at any time.`;
5421
+ }
5422
+ function portalConfirmLine(title) {
5423
+ return `Type the portal\u2019s title \u2014 ${title} \u2014 to confirm you mean this one.`;
5424
+ }
5425
+ function portalTitleTypedBack(typed, title) {
5426
+ return typed.trim() === (title ?? "").trim();
5427
+ }
5428
+ function emptyPortalArchiveLine() {
5429
+ return "No portal of this organization has been archived. A portal you put away waits here until somebody restores it, and nothing is ever destroyed.";
5430
+ }
5242
5431
 
5243
5432
  // src/capture-queue.ts
5244
5433
  var DB_NAME = "matrx-capture";