@ai-matrx/records 0.11.0 → 0.16.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.
@@ -382,6 +382,76 @@ declare const STORE_DOORS: readonly [{
382
382
  readonly args: "p_item_type text, p_item_id uuid";
383
383
  readonly returns: "TABLE(container_type text, container_id uuid, conveys_max permission_level)";
384
384
  readonly security: "definer";
385
+ }, {
386
+ readonly name: "choice_census";
387
+ readonly args: "p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid";
388
+ readonly returns: "jsonb";
389
+ readonly security: "definer";
390
+ }, {
391
+ readonly name: "choice_field_map";
392
+ readonly args: "p_organization_id uuid, p_table_id uuid";
393
+ readonly returns: "jsonb";
394
+ readonly security: "invoker";
395
+ }, {
396
+ readonly name: "choice_filter_normalize";
397
+ readonly args: "p_map jsonb, p_filter jsonb";
398
+ readonly returns: "jsonb";
399
+ readonly security: "invoker";
400
+ }, {
401
+ readonly name: "choice_key_for";
402
+ readonly args: "p_organization_id uuid, p_options_table_id uuid, p_title text, p_exclude uuid DEFAULT NULL::uuid";
403
+ readonly returns: "text";
404
+ readonly security: "invoker";
405
+ }, {
406
+ readonly name: "choice_key_of";
407
+ readonly args: "p_field jsonb, p_token text";
408
+ readonly returns: "text";
409
+ readonly security: "invoker";
410
+ }, {
411
+ readonly name: "choice_options";
412
+ readonly args: "p_organization_id uuid, p_options_table_id uuid";
413
+ readonly returns: "jsonb";
414
+ readonly security: "invoker";
415
+ }, {
416
+ readonly name: "choice_render";
417
+ readonly args: "p_organization_id uuid, p_table_id uuid, p_doc jsonb";
418
+ readonly returns: "jsonb";
419
+ readonly security: "invoker";
420
+ }, {
421
+ readonly name: "choice_render_groups";
422
+ readonly args: "p_map jsonb, p_groups jsonb";
423
+ readonly returns: "jsonb";
424
+ readonly security: "invoker";
425
+ }, {
426
+ readonly name: "choice_render_note";
427
+ readonly args: "p_field jsonb, p_value jsonb";
428
+ readonly returns: "jsonb";
429
+ readonly security: "invoker";
430
+ }, {
431
+ readonly name: "choice_render_value";
432
+ readonly args: "p_field jsonb, p_value jsonb";
433
+ readonly returns: "jsonb";
434
+ readonly security: "invoker";
435
+ }, {
436
+ readonly name: "choice_slug";
437
+ readonly args: "p_word text";
438
+ readonly returns: "text";
439
+ readonly security: "invoker";
440
+ }, {
441
+ readonly name: "choice_synonyms";
442
+ readonly args: "p_organization_id uuid, p_table_id uuid, p_token text";
443
+ readonly returns: "text[]";
444
+ readonly security: "invoker";
445
+ }, {
446
+ readonly name: "choice_synonyms_in";
447
+ readonly args: "p_map jsonb, p_token text";
448
+ readonly returns: "text[]";
449
+ readonly security: "invoker";
450
+ }, {
451
+ readonly name: "choice_words";
452
+ readonly args: "p_field jsonb";
453
+ readonly returns: "text";
454
+ readonly security: "invoker";
385
455
  }, {
386
456
  readonly name: "client_write_grants";
387
457
  readonly args: "";
@@ -422,6 +492,61 @@ declare const STORE_DOORS: readonly [{
422
492
  readonly args: "";
423
493
  readonly returns: "TABLE(token text, schema_name text, table_name text)";
424
494
  readonly security: "invoker";
495
+ }, {
496
+ readonly name: "dashboard_block_normalize";
497
+ readonly args: "p_organization_id uuid, p_subject_table_id uuid, p_block jsonb";
498
+ readonly returns: "jsonb";
499
+ readonly security: "definer";
500
+ }, {
501
+ readonly name: "dashboard_class";
502
+ readonly args: "";
503
+ readonly returns: "text";
504
+ readonly security: "invoker";
505
+ }, {
506
+ readonly name: "dashboard_declare";
507
+ readonly args: "p_organization_id uuid, p_table_id uuid, p_name text, p_blocks jsonb DEFAULT '[]'::jsonb, p_presentation jsonb DEFAULT '{}'::jsonb, p_dashboard_id uuid DEFAULT NULL::uuid";
508
+ readonly returns: "uuid";
509
+ readonly security: "definer";
510
+ }, {
511
+ readonly name: "dashboard_delete";
512
+ readonly args: "p_organization_id uuid, p_dashboard_id uuid";
513
+ readonly returns: "boolean";
514
+ readonly security: "definer";
515
+ }, {
516
+ readonly name: "dashboard_field_keys";
517
+ readonly args: "p_organization_id uuid, p_table_id uuid";
518
+ readonly returns: "text[]";
519
+ readonly security: "definer";
520
+ }, {
521
+ readonly name: "dashboard_kinds";
522
+ readonly args: "";
523
+ readonly returns: "text[]";
524
+ readonly security: "invoker";
525
+ }, {
526
+ readonly name: "dashboard_moment_sql";
527
+ readonly args: "p_key text";
528
+ readonly returns: "text";
529
+ readonly security: "invoker";
530
+ }, {
531
+ readonly name: "dashboard_run";
532
+ readonly args: "p_organization_id uuid, p_dashboard_id uuid, p_filter jsonb DEFAULT '{}'::jsonb";
533
+ readonly returns: "jsonb";
534
+ readonly security: "definer";
535
+ }, {
536
+ readonly name: "dashboard_stuck";
537
+ readonly args: "p_organization_id uuid, p_table_id uuid, p_state_key text, p_days integer DEFAULT 14, p_filter jsonb DEFAULT '{}'::jsonb, p_limit integer DEFAULT 50, p_required text DEFAULT 'viewer'::text";
538
+ readonly returns: "TABLE(record_id uuid, title text, state text, last_changed_at timestamp with time zone, days_unchanged numeric, measured_from text)";
539
+ readonly security: "definer";
540
+ }, {
541
+ readonly name: "dashboard_window_sql";
542
+ readonly args: "p_key text, p_window jsonb";
543
+ readonly returns: "text";
544
+ readonly security: "invoker";
545
+ }, {
546
+ readonly name: "dashboards";
547
+ readonly args: "p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid";
548
+ readonly returns: "TABLE(dashboard_id uuid, table_id uuid, name text, blocks jsonb, presentation jsonb, block_count integer, version integer, created_at timestamp with time zone, updated_at timestamp with time zone)";
549
+ readonly security: "definer";
425
550
  }, {
426
551
  readonly name: "delete_cascade_closure";
427
552
  readonly args: "p_organization_id uuid, p_record_id uuid";
@@ -902,6 +1027,16 @@ declare const STORE_DOORS: readonly [{
902
1027
  readonly args: "p_old_deleted timestamp with time zone, p_new_deleted timestamp with time zone, p_old_data jsonb, p_new_data jsonb, p_old_table uuid, p_new_table uuid, p_old_org uuid, p_new_org uuid, p_old_class text, p_new_class text";
903
1028
  readonly returns: "boolean";
904
1029
  readonly security: "invoker";
1030
+ }, {
1031
+ readonly name: "list_door_disagreements";
1032
+ readonly args: "p_pretend text DEFAULT NULL::text, p_only_organization uuid DEFAULT NULL::uuid, p_sample integer DEFAULT 200";
1033
+ readonly returns: "TABLE(organization_id uuid, organization_name text, member_id uuid, table_id uuid, record_id uuid, door text, why text)";
1034
+ readonly security: "invoker";
1035
+ }, {
1036
+ readonly name: "list_door_disagreements";
1037
+ readonly args: "p_pretend text, p_only_organization uuid, p_sample integer, p_exhaustive boolean";
1038
+ readonly returns: "TABLE(organization_id uuid, organization_name text, member_id uuid, table_id uuid, record_id uuid, door text, why text)";
1039
+ readonly security: "invoker";
905
1040
  }, {
906
1041
  readonly name: "lookup_value";
907
1042
  readonly args: "p_organization_id uuid, p_record_id uuid, p_field_data jsonb";
@@ -922,6 +1057,11 @@ declare const STORE_DOORS: readonly [{
922
1057
  readonly args: "";
923
1058
  readonly returns: "uuid";
924
1059
  readonly security: "invoker";
1060
+ }, {
1061
+ readonly name: "migrate_choice_keys";
1062
+ readonly args: "p_organization_id uuid, p_table_id uuid, p_dry_run boolean DEFAULT false";
1063
+ readonly returns: "jsonb";
1064
+ readonly security: "definer";
925
1065
  }, {
926
1066
  readonly name: "migrate_delete";
927
1067
  readonly args: "p_organization_id uuid, p_record_id uuid, p_note text DEFAULT NULL::text";
@@ -952,6 +1092,11 @@ declare const STORE_DOORS: readonly [{
952
1092
  readonly args: "p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid, p_dry_run boolean DEFAULT true";
953
1093
  readonly returns: "jsonb";
954
1094
  readonly security: "definer";
1095
+ }, {
1096
+ readonly name: "migrate_reclass";
1097
+ readonly args: "p_organization_id uuid, p_id uuid, p_to text DEFAULT 'field'::text, p_note text DEFAULT NULL::text";
1098
+ readonly returns: "jsonb";
1099
+ readonly security: "definer";
955
1100
  }, {
956
1101
  readonly name: "migrate_rename";
957
1102
  readonly args: "p_organization_id uuid, p_id uuid, p_to text, p_note text DEFAULT NULL::text";
@@ -1047,6 +1192,76 @@ declare const STORE_DOORS: readonly [{
1047
1192
  readonly args: "";
1048
1193
  readonly returns: "uuid";
1049
1194
  readonly security: "invoker";
1195
+ }, {
1196
+ readonly name: "portal_admits";
1197
+ readonly args: "p_organization_id uuid, p_user_id uuid DEFAULT NULL::uuid";
1198
+ readonly returns: "boolean";
1199
+ readonly security: "definer";
1200
+ }, {
1201
+ readonly name: "portal_card";
1202
+ readonly args: "p_organization_id uuid, p_portal_id uuid";
1203
+ readonly returns: "jsonb";
1204
+ readonly security: "definer";
1205
+ }, {
1206
+ readonly name: "portal_declare";
1207
+ readonly 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";
1208
+ readonly returns: "uuid";
1209
+ readonly security: "definer";
1210
+ }, {
1211
+ readonly name: "portal_field_map";
1212
+ readonly args: "p_organization_id uuid, p_table_id uuid";
1213
+ readonly returns: "TABLE(field_id uuid, field_key text, field_type text, points_at uuid)";
1214
+ readonly security: "definer";
1215
+ }, {
1216
+ readonly name: "portal_invitation";
1217
+ readonly args: "p_slug text, p_email text";
1218
+ readonly returns: "jsonb";
1219
+ readonly security: "definer";
1220
+ }, {
1221
+ readonly name: "portal_invite";
1222
+ readonly args: "p_organization_id uuid, p_portal_id uuid, p_client_record_id uuid, p_email text, p_user_id uuid DEFAULT NULL::uuid";
1223
+ readonly returns: "jsonb";
1224
+ readonly security: "definer";
1225
+ }, {
1226
+ readonly name: "portal_me";
1227
+ readonly args: "";
1228
+ readonly returns: "jsonb";
1229
+ readonly security: "definer";
1230
+ }, {
1231
+ readonly name: "portal_preview";
1232
+ readonly args: "p_organization_id uuid, p_portal_id uuid, p_principal_id uuid, p_table_id uuid";
1233
+ readonly returns: "TABLE(record_id uuid, title text)";
1234
+ readonly security: "definer";
1235
+ }, {
1236
+ readonly name: "portal_principal_bind";
1237
+ readonly args: "p_organization_id uuid, p_principal_id uuid, p_user_id uuid";
1238
+ readonly returns: "jsonb";
1239
+ readonly security: "definer";
1240
+ }, {
1241
+ readonly name: "portal_public";
1242
+ readonly args: "p_slug text";
1243
+ readonly returns: "jsonb";
1244
+ readonly security: "definer";
1245
+ }, {
1246
+ readonly name: "portal_record_title";
1247
+ readonly args: "p_organization_id uuid, p_record_id uuid";
1248
+ readonly returns: "text";
1249
+ readonly security: "definer";
1250
+ }, {
1251
+ readonly name: "portal_revoke";
1252
+ readonly args: "p_organization_id uuid, p_portal_id uuid, p_principal_id uuid";
1253
+ readonly returns: "jsonb";
1254
+ readonly security: "definer";
1255
+ }, {
1256
+ readonly name: "portal_slug";
1257
+ readonly args: "p_organization_id uuid, p_title text, p_portal_id uuid DEFAULT NULL::uuid";
1258
+ readonly returns: "text";
1259
+ readonly security: "definer";
1260
+ }, {
1261
+ readonly name: "portals";
1262
+ readonly args: "p_organization_id uuid";
1263
+ readonly 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)";
1264
+ readonly security: "definer";
1050
1265
  }, {
1051
1266
  readonly name: "presentation_kernel_id";
1052
1267
  readonly args: "";
@@ -1297,6 +1512,11 @@ declare const STORE_DOORS: readonly [{
1297
1512
  readonly args: "p_record_id uuid, p_at timestamp with time zone";
1298
1513
  readonly returns: "TABLE(state jsonb, replayed boolean)";
1299
1514
  readonly security: "definer";
1515
+ }, {
1516
+ readonly name: "record_table";
1517
+ readonly args: "p_organization_id uuid, p_record_id uuid";
1518
+ readonly returns: "uuid";
1519
+ readonly security: "definer";
1300
1520
  }, {
1301
1521
  readonly name: "record_update";
1302
1522
  readonly args: "p_organization_id uuid, p_record_id uuid, p_patch jsonb, p_expected_version integer DEFAULT NULL::integer";
@@ -1317,6 +1537,11 @@ declare const STORE_DOORS: readonly [{
1317
1537
  readonly args: "p_organization_id uuid, p_table_id uuid, p_data jsonb";
1318
1538
  readonly returns: "uuid";
1319
1539
  readonly security: "definer";
1540
+ }, {
1541
+ readonly name: "refusals_claiming_a_level_never_asked";
1542
+ readonly args: "";
1543
+ readonly returns: "TABLE(function_name text, identity_args text, why text)";
1544
+ readonly security: "invoker";
1320
1545
  }, {
1321
1546
  readonly name: "relation_carry";
1322
1547
  readonly args: "p_organization_id uuid, p_container_id uuid, p_item_id uuid";
@@ -1542,11 +1767,26 @@ declare const STORE_DOORS: readonly [{
1542
1767
  readonly args: "p_organization_id uuid DEFAULT NULL::uuid";
1543
1768
  readonly returns: "boolean";
1544
1769
  readonly security: "invoker";
1770
+ }, {
1771
+ readonly name: "subscription_mute";
1772
+ readonly args: "p_organization_id uuid, p_rule_id uuid, p_muted boolean DEFAULT true";
1773
+ readonly returns: "boolean";
1774
+ readonly security: "definer";
1775
+ }, {
1776
+ readonly name: "subscriptions";
1777
+ readonly args: "p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid";
1778
+ readonly returns: "TABLE(rule_id uuid, name text, table_id uuid, saved_view_id uuid, cadence text, schedule text, channel text, recipient_user_id uuid, event_key text, muted boolean, mine boolean, i_may_mute boolean)";
1779
+ readonly security: "definer";
1545
1780
  }, {
1546
1781
  readonly name: "table_capacity";
1547
1782
  readonly args: "p_organization_id uuid, p_table_id uuid";
1548
1783
  readonly returns: "jsonb";
1549
1784
  readonly security: "definer";
1785
+ }, {
1786
+ readonly name: "table_carries_its_rows";
1787
+ readonly args: "p_user_id uuid, p_table_id uuid, p_required permission_level DEFAULT 'viewer'::permission_level";
1788
+ readonly returns: "boolean";
1789
+ readonly security: "definer";
1550
1790
  }, {
1551
1791
  readonly name: "table_contents";
1552
1792
  readonly args: "p_organization_id uuid, p_table_id uuid";
@@ -1712,6 +1952,11 @@ declare const STORE_DOORS: readonly [{
1712
1952
  readonly args: "p_organization_id uuid, p_approval_id uuid, p_approve boolean, p_note text DEFAULT NULL::text";
1713
1953
  readonly returns: "jsonb";
1714
1954
  readonly security: "definer";
1955
+ }, {
1956
+ readonly name: "work_approval_kinds";
1957
+ readonly args: "";
1958
+ readonly returns: "text[]";
1959
+ readonly security: "invoker";
1715
1960
  }, {
1716
1961
  readonly name: "work_approval_may_decide";
1717
1962
  readonly args: "p_organization_id uuid, p_approval_id uuid";
@@ -1807,6 +2052,11 @@ declare const STORE_DOORS: readonly [{
1807
2052
  readonly args: "p_organization_id uuid, p_name text, p_slug text, p_home_id uuid DEFAULT NULL::uuid";
1808
2053
  readonly returns: "jsonb";
1809
2054
  readonly security: "definer";
2055
+ }, {
2056
+ readonly name: "work_state_id";
2057
+ readonly args: "p_organization_id uuid, p_table_id uuid, p_value text";
2058
+ readonly returns: "uuid";
2059
+ readonly security: "invoker";
1810
2060
  }, {
1811
2061
  readonly name: "work_states";
1812
2062
  readonly args: "";
@@ -2003,37 +2253,40 @@ declare const STORE_KNOBS: readonly [{
2003
2253
  */
2004
2254
  declare const STORE_REFUSAL_CODES: readonly [{
2005
2255
  readonly code: "02000";
2006
- readonly raised_by: "doc_render_body,doc_render_document,doc_render_read,doc_sign,doc_signature_intact,doc_signature_read,doc_template_read,doc_template_save,entity_field_retire,entity_field_update,entity_record_read,entity_value_write,external_history_event,external_rows,external_stub_upsert,external_writes_set,migrate_delete,migrate_extract_parent,migrate_merge,migrate_rename,migrate_reparent,migrate_retype,migrate_split,migrate_undo,organization_clear,read_record,record_delete,record_restore,record_update,relation_uncarry,share_access,share_grant,share_lane_set,share_people,share_revoke,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_assign,work_record_states,work_set_state";
2256
+ readonly raised_by: "dashboard_delete,dashboard_run,doc_render_body,doc_render_document,doc_render_read,doc_sign,doc_signature_intact,doc_signature_read,doc_template_read,doc_template_save,entity_field_retire,entity_field_update,entity_record_read,entity_value_write,external_history_event,external_rows,external_stub_upsert,external_writes_set,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_table,record_update,relation_uncarry,share_access,share_grant,share_lane_set,share_people,share_revoke,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_assign,work_record_states,work_set_state";
2007
2257
  }, {
2008
2258
  readonly code: "0A000";
2009
- readonly raised_by: "external_rows,external_source_declare,external_write_through,promote_field,promoted_index_expr,promoted_query_sql,promoted_read,rule_eval,work_assign,work_slots_declare";
2259
+ readonly raised_by: "external_rows,external_source_declare,external_write_through,promote_field,promoted_index_expr,promoted_query_sql,promoted_read,rule_eval,work_assign";
2010
2260
  }, {
2011
2261
  readonly code: "22004";
2012
- 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,doc_render_write,doc_sign,doc_signature_write,doc_template_save,external_history_event,external_rows,external_source_declare,external_stub_upsert,external_write_through,external_writes_set,form_declare,form_submit,home_add,io_comment_write,io_import_open,io_outbox_drain,io_restore,migrate_purge,migrate_split,migrate_undo,organization_clear,organization_contents,query_across_homes,query_by_coordinates,query_rollup,record_delete,record_reparent,record_resolve,record_restore,record_update,record_write,relation_carry,relation_own,rule_declare,share_grant,table_declare,work_approval_decide,work_approval_request,work_template_declare";
2262
+ 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,dashboard_block_normalize,dashboard_declare,dashboard_window_sql,doc_render_write,doc_sign,doc_signature_write,doc_template_save,external_history_event,external_rows,external_source_declare,external_stub_upsert,external_write_through,external_writes_set,form_declare,form_submit,home_add,io_comment_write,io_import_open,io_outbox_drain,io_restore,migrate_choice_keys,migrate_purge,migrate_reclass,migrate_split,migrate_undo,organization_clear,organization_contents,portal_declare,portal_invite,portal_principal_bind,query_across_homes,query_by_coordinates,query_rollup,record_delete,record_reparent,record_resolve,record_restore,record_update,record_write,relation_carry,relation_own,rule_declare,share_grant,table_declare,work_approval_decide,work_approval_request,work_template_declare";
2263
+ }, {
2264
+ readonly code: "22007";
2265
+ readonly raised_by: "dashboard_window_sql";
2013
2266
  }, {
2014
2267
  readonly code: "22012";
2015
2268
  readonly raised_by: "rule_eval";
2016
2269
  }, {
2017
2270
  readonly code: "22023";
2018
- readonly raised_by: "_entity_custom_fields_guard,_value_envelope,_work_shape_guard,actor_word,agg_assert_key,agg_sql,anon_token_issue,containment_parent,doc_render_body,doc_render_write,doc_signature_write,entity_value_write,external_history_event,external_source_declare,external_stub_upsert,external_write_through,io_import_open,io_proposal_accept,migrate_merge,my_levels,organization_clear,query_by_coordinates,query_rollup,record_update,relation_carry,rule_eval,rule_members,share_grant,share_lane_set,table_rules,visibility_as_of,work_approval_request,work_list,work_slot_hold";
2271
+ readonly raised_by: "_entity_custom_fields_guard,_value_envelope,_work_shape_guard,actor_word,agg_assert_key,agg_sql,anon_token_issue,containment_parent,dashboard_block_normalize,dashboard_window_sql,doc_render_body,doc_render_write,doc_signature_write,entity_value_write,external_history_event,external_source_declare,external_stub_upsert,external_write_through,io_import_open,io_proposal_accept,migrate_merge,migrate_reclass,my_levels,organization_clear,portal_declare,query_by_coordinates,query_rollup,record_update,relation_carry,rule_eval,rule_members,share_grant,share_lane_set,table_rules,visibility_as_of,work_approval_request,work_list,work_slot_hold";
2019
2272
  }, {
2020
2273
  readonly code: "23503";
2021
- readonly raised_by: "_containment_guard,_field_document_for,_record_rule_uses,anon_publish,anon_rate_take,anon_token_issue,anon_write,assert_organization_wall,delete_rule,doc_sign,doc_template_save,form_declare,form_submit,home_add,io_comment_write,io_import_rows,io_proposal_accept,migrate_demote,migrate_promote,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,work_set_state,work_take_assignment,work_template_instantiate";
2274
+ readonly raised_by: "_containment_guard,_field_document_for,_record_rule_uses,anon_publish,anon_rate_take,anon_token_issue,anon_write,assert_organization_wall,dashboard_declare,delete_rule,doc_sign,doc_template_save,form_declare,form_submit,home_add,io_comment_write,io_import_rows,io_proposal_accept,migrate_demote,migrate_promote,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,subscription_mute,work_set_state,work_take_assignment,work_template_instantiate";
2022
2275
  }, {
2023
2276
  readonly code: "23505";
2024
2277
  readonly raised_by: "_unique_rule_holds,doc_sign,doc_signature_write,entity_field_declare,field_declare,home_add,io_proposal_accept,relation_carry,relation_own,share_grant,work_approval_decide,work_slot_hold";
2025
2278
  }, {
2026
2279
  readonly code: "23514";
2027
- readonly raised_by: "_containment_guard,_dated_values_guard,_derived_fields,_entity_custom_fields_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_shape_guard,_value_envelope,_work_shape_guard,_workdoors_approval_guard,assert_entity_is_organization_scoped,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,migrate_merge,relation_carry,relation_own,validate_value_envelope,validate_values,work_set_state,work_slots_declare,work_take_assignment,work_template_instantiate";
2280
+ readonly raised_by: "_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_shape_guard,_value_envelope,_work_shape_guard,_workdoors_approval_guard,assert_entity_is_organization_scoped,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,migrate_merge,relation_carry,relation_own,validate_value_envelope,validate_values,work_set_state,work_slots_declare,work_take_assignment,work_template_instantiate";
2028
2281
  }, {
2029
2282
  readonly code: "40001";
2030
2283
  readonly raised_by: "has_visibility_at";
2031
2284
  }, {
2032
2285
  readonly code: "42501";
2033
- 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,entity_field_declare,entity_field_retire,entity_field_update,entity_value_write,external_write_through,form_declare,form_submit,io_comment_resolve,io_comment_write,io_restore,migrate_purge,my_levels,organization_clear,promote_table,query_visibility_parity,read_record,read_records,share_grant,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_person";
2286
+ 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,entity_field_declare,entity_field_retire,entity_field_update,entity_value_write,external_write_through,form_declare,form_submit,io_comment_resolve,io_comment_write,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,share_grant,subscription_mute,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_person";
2034
2287
  }, {
2035
2288
  readonly code: "42703";
2036
- readonly raised_by: "entity_table";
2289
+ readonly raised_by: "entity_table,portal_declare";
2037
2290
  }, {
2038
2291
  readonly code: "53400";
2039
2292
  readonly raised_by: "anon_rate_take,delete_cascade_closure,promote_field";
@@ -2556,6 +2809,14 @@ interface NewFieldDeclaration {
2556
2809
  parity_type?: ParityFieldType;
2557
2810
  /** Plain text, a long text or a plain number — the three that carry no parity type. */
2558
2811
  plain?: "text" | "long_text" | "number";
2812
+ /**
2813
+ * THE ONE WORD EVERY OTHER CALLER REACHES FOR. An agent, a script, an import
2814
+ * and this package's own table-declaring path all say `type`, and until
2815
+ * 2026-09-20 `custom._field_document_for` threw it away — a `number` became a
2816
+ * text column in silence. It now resolves all three vocabularies, so this is
2817
+ * named here rather than left as a shape only the store knows about.
2818
+ */
2819
+ type?: FieldTypeWord;
2559
2820
  /** Derived from the label when absent, which is why the panel never asks for it. */
2560
2821
  key?: string;
2561
2822
  required?: boolean;
@@ -2584,8 +2845,42 @@ interface NewFieldDeclaration {
2584
2845
  expr?: Record<string, unknown>;
2585
2846
  compute_on?: ComputeOn;
2586
2847
  relation_max?: number;
2848
+ /**
2849
+ * REL / FLD-11. The Table this column points at, when it is neither a Person
2850
+ * (`member`) nor a File (`attachment`). The store has taken it since
2851
+ * 2026-09-20 and no client type named it, so a person with an Invoice table
2852
+ * and a Line table could not declare the link through this package at all.
2853
+ */
2854
+ relation_target?: Uuid;
2855
+ /** REL-2. What happens to this record when the thing it points at goes. */
2856
+ on_target_delete?: OnDelete;
2857
+ /**
2858
+ * Presentation and behaviour settings the store carries verbatim — a long
2859
+ * text's `multiline`, a list's existing options table. The door has always
2860
+ * read it (`p_spec -> 'config'`) and this interface never offered it, so a
2861
+ * package-owned table could not declare its own multi-line column.
2862
+ */
2863
+ config?: Record<string, unknown>;
2864
+ /** A text column that holds a signature (`custom.doc_sign` accepts no other). */
2865
+ format?: string;
2587
2866
  }
2588
- /** What `custom.field_update` accepts: a field's settings, never what it holds. */
2867
+ /**
2868
+ * Every word `custom._field_document_for` resolves for `type`: one of the
2869
+ * thirteen, one of the five behaviours, or one of the plain synonyms a person
2870
+ * or an agent actually writes.
2871
+ */
2872
+ type FieldTypeWord = ParityFieldType | FieldBehavior | "number" | "integer" | "decimal" | "float" | "long_text" | "string";
2873
+ /**
2874
+ * What `custom.field_update` accepts.
2875
+ *
2876
+ * THE SETTINGS **AND** THE BEHAVIOUR. The door has had a behaviour arm since
2877
+ * T12 — say `parity_type`, `plain` or `type` and every value of the column is
2878
+ * converted (or kept in `_retired` with its reason) by
2879
+ * `custom._field_type_converts_values`. This interface named only the settings,
2880
+ * so the one client that needed to move a field back onto the behaviour it is
2881
+ * written against had no door and reached for `custom.record_update` instead,
2882
+ * which writes the document under the guards rather than through them.
2883
+ */
2589
2884
  interface FieldPatch {
2590
2885
  label?: string;
2591
2886
  required?: boolean;
@@ -2597,8 +2892,79 @@ interface FieldPatch {
2597
2892
  rules?: FieldRule[];
2598
2893
  /** The choices of a choice list, rewritten. A choice still wanted keeps its id. */
2599
2894
  options?: string[];
2895
+ /** One of the thirteen — a change of what this column HOLDS, not of a setting. */
2896
+ parity_type?: ParityFieldType;
2897
+ /** …or one of the three plain behaviours, …*/
2898
+ plain?: "text" | "long_text" | "number";
2899
+ /** …or the one word every other caller reaches for (see `NewFieldDeclaration`). */
2900
+ type?: FieldTypeWord;
2901
+ /**
2902
+ * FLD-2. The shape of the value. The door reads it ONLY inside its behaviour
2903
+ * arm, so a patch that moves `multi` alone changes nothing — send the
2904
+ * behaviour word with it.
2905
+ */
2906
+ multi?: boolean;
2907
+ /** REL / FLD-11: re-point the column. The old edges are withdrawn by the door. */
2908
+ relation_target?: Uuid;
2909
+ on_target_delete?: OnDelete;
2910
+ /** SEAT-SUITES: whether the store builds an index for this column, and a unique one. */
2911
+ promoted?: boolean;
2912
+ unique?: boolean;
2913
+ /** §D / T7: which fields a worked-out column reads. */
2914
+ depends_on?: Uuid[];
2600
2915
  }
2601
2916
 
2917
+ /** One option, as `_choices` names it and as `optionsOf` returns it. */
2918
+ interface ChoiceOption {
2919
+ /** The stable key the cell actually holds. */
2920
+ key: string;
2921
+ /** What a person reads. */
2922
+ label: string;
2923
+ /** The option RECORD's id, for a caller that needs the row itself. */
2924
+ id?: string;
2925
+ /** True when the option was retired: still readable, no longer pickable. */
2926
+ retired?: boolean;
2927
+ /** Why it is no longer offered, in a sentence, when it is retired. */
2928
+ reason?: string | null;
2929
+ }
2930
+ /**
2931
+ * The stable key of an option RECORD as `custom.field_options` returns it.
2932
+ *
2933
+ * It lives in `metadata.option_key`, not in the document: FLD-5 keeps a category to one title
2934
+ * field, and the key is the store's own bookkeeping rather than a column anybody declared.
2935
+ * The fallback is the same slug the store derives, so an option written by something that has
2936
+ * not caught up still answers.
2937
+ */
2938
+ declare function optionKey(option: StoredRecord): string;
2939
+ /** What a person reads on an option record. */
2940
+ declare function optionLabel(option: StoredRecord): string;
2941
+ /**
2942
+ * The store's own slug, mirrored so a client can predict a key without a round trip.
2943
+ * `custom.choice_slug` is the original; a title with nothing a-z0-9 in it gets a short hash of
2944
+ * itself there, and this returns the empty-ish fallback rather than guessing a hash — a caller
2945
+ * that needs the real key for such a title reads it off the option.
2946
+ */
2947
+ declare function choiceSlug(word: string): string;
2948
+ /**
2949
+ * Does this stored (or typed) value name this option? The key, the label and the option's own
2950
+ * id all name the same choice, and a control has to recognise every one of them: what the read
2951
+ * door hands it is the LABEL, what the store holds is the KEY, and what a screen written before
2952
+ * this contract sends is the ID.
2953
+ */
2954
+ declare function isTheChosen(option: StoredRecord, value: unknown): boolean;
2955
+ /** Every value of one cell, as strings, whether the Field is multi or not. */
2956
+ declare function choiceValuesOf(value: unknown): string[];
2957
+ /**
2958
+ * What the read door said about one column's choices: the key behind the label, and whether the
2959
+ * option was retired and why. Returns an empty array when the document carries no `_choices`
2960
+ * entry for that column, which is also what a document written before this contract looks like.
2961
+ */
2962
+ declare function choicesOf(document: RecordDocument | undefined, fieldKeyOrId: string): ChoiceOption[];
2963
+ /** True when this cell's value points at a choice that has since been retired. */
2964
+ declare function holdsARetiredChoice(document: RecordDocument | undefined, fieldKeyOrId: string): boolean;
2965
+ /** True when a token looks like a uuid — which a choice value is no longer allowed to be. */
2966
+ declare function looksLikeAnId(value: unknown): boolean;
2967
+
2602
2968
  /** The seven table types. Only these two carry custom fields (REC-34, DD-011). */
2603
2969
  type CustomFieldTableType = "entity" | "detail";
2604
2970
  /** What `custom.entity_table` answers about a registry token. */
@@ -2808,10 +3174,144 @@ interface FormSummary {
2808
3174
  */
2809
3175
  declare function publicFormPath(formId: string): string;
2810
3176
 
3177
+ /** One portal as `custom.portals` reports it to its organization. */
3178
+ interface PortalSummary {
3179
+ portal_id: Uuid;
3180
+ title: string;
3181
+ slug: string;
3182
+ /** The Table whose records ARE the clients. A principal is one of its rows. */
3183
+ client_table_id: Uuid;
3184
+ /** That Table's name, so a list never has to read a second door to draw a row. */
3185
+ client_table: string;
3186
+ is_active: boolean;
3187
+ /** How many Tables this portal exposes. */
3188
+ tables: number;
3189
+ /** Everybody invited and not revoked — NOT everybody who can see anything. */
3190
+ invited: number;
3191
+ /** Of those, how many have followed the link and hold an identity. */
3192
+ signed_in: number;
3193
+ /** `magic_link` today, and the door refuses every other word by name. */
3194
+ sign_in_method: string;
3195
+ opened_at: Timestamp | null;
3196
+ }
3197
+ /** One Table a portal exposes, as `custom.portal_card` reports it. */
3198
+ interface PortalTableExposure {
3199
+ table_id: Uuid;
3200
+ /** The Table's own name. */
3201
+ name: string;
3202
+ /**
3203
+ * The key of the relation Field that says WHOSE a record is. This is the
3204
+ * whole of "only theirs": the association that Field writes is what carries
3205
+ * the record to the client, so a portal cannot exist without one.
3206
+ */
3207
+ names_via: string;
3208
+ /** The field keys a client sees. Empty is impossible — the door fills it. */
3209
+ visible_fields: string[];
3210
+ /** The subset a client may change. Always a subset of `visible_fields`. */
3211
+ editable_fields: string[];
3212
+ comments: boolean;
3213
+ /**
3214
+ * The most a client is ever conveyed on this Table — `viewer`, `commenter`
3215
+ * or `editor` — worked out by the door from the two lists above, never by a
3216
+ * screen.
3217
+ */
3218
+ conveys: string;
3219
+ }
3220
+ /** One person a portal was opened to, as `custom.portal_card` reports them. */
3221
+ interface PortalPrincipal {
3222
+ principal_id: Uuid;
3223
+ email: string;
3224
+ /** The record of the client Table this person IS, for the portal's purposes. */
3225
+ client_record_id: Uuid;
3226
+ /** That record's title — what an owner calls this client. */
3227
+ client: string;
3228
+ /** They followed the link and hold an identity. Until then this is false. */
3229
+ signed_in: boolean;
3230
+ /** Not revoked. An invitation that was never followed is still active. */
3231
+ is_active: boolean;
3232
+ invited_at: Timestamp;
3233
+ revoked_at: Timestamp | null;
3234
+ }
3235
+ /** Everything about ONE portal: what it shows, and who it was opened to. */
3236
+ interface PortalCard {
3237
+ portal_id: Uuid;
3238
+ title: string;
3239
+ slug: string;
3240
+ is_active: boolean;
3241
+ sign_in_method: string;
3242
+ client_table_id: Uuid;
3243
+ tables: PortalTableExposure[];
3244
+ principals: PortalPrincipal[];
3245
+ /**
3246
+ * Whether this organization's outside lane is open
3247
+ * (`custom/external_principal_enabled`). Declaring a portal opens it; while
3248
+ * it is false every door refuses an outsider BY NAME, and a screen that drew
3249
+ * the people as reachable anyway would be lying about the one thing that
3250
+ * decides whether they can sign in at all.
3251
+ */
3252
+ external_lane_open: boolean;
3253
+ }
3254
+ /** What `custom.portal_invite` answers. `say` is the door's own sentence. */
3255
+ interface PortalInvitation {
3256
+ invited: boolean;
3257
+ principal_id: Uuid;
3258
+ portal_id: Uuid;
3259
+ slug: string;
3260
+ email: string;
3261
+ client_record_id: Uuid;
3262
+ client: string;
3263
+ /** They already hold an identity. From a screen this is false: the door is passed no user. */
3264
+ bound: boolean;
3265
+ /**
3266
+ * The door's own words, and the ONLY correct summary of what just happened —
3267
+ * it says outright that an invitation confers nothing until the link is
3268
+ * followed. Show it; never paraphrase it.
3269
+ */
3270
+ say: string;
3271
+ }
3272
+ /** What `custom.portal_revoke` answers. `say` names the consequence, past tense. */
3273
+ interface PortalRevocation {
3274
+ revoked: boolean;
3275
+ principal_id: Uuid;
3276
+ email: string;
3277
+ /** The door's own sentence: they can no longer sign in, and their records stop reaching them. */
3278
+ say: string;
3279
+ }
3280
+ /** One row of "what this client sees", from `custom.portal_preview`. */
3281
+ interface PortalPreviewRow {
3282
+ record_id: Uuid;
3283
+ title: string;
3284
+ }
3285
+ /**
3286
+ * THE PUBLIC ADDRESS OF A PORTAL, and the one place its shape is written down.
3287
+ *
3288
+ * Unlike a form's link, a portal's slug is NOT the capability: the page it
3289
+ * serves asks who you are and emails a one-time link, so the slug is a name and
3290
+ * nothing more. That is why it is readable and why copying it is safe.
3291
+ */
3292
+ declare function portalPath(slug: string): string;
3293
+
2811
3294
  /** The measures the store offers. Asked of `custom.agg_operations()` at run time too. */
2812
3295
  type AggregateOperation = "count" | "sum" | "avg" | "min" | "max";
2813
3296
  /** The periods a date Field can be bucketed into (`custom.agg_buckets()`). */
2814
3297
  type AggregateBucket = "day" | "week" | "month" | "quarter" | "year";
3298
+ /**
3299
+ * A HALF-OPEN MOMENT WINDOW: `from` is inclusive, `to` is exclusive. Half-open
3300
+ * is the only shape that makes "September" and "October" meet exactly once —
3301
+ * an inclusive `to` either double-counts the boundary moment or drops it,
3302
+ * depending on the reader, and both of those are a chart telling a lie.
3303
+ */
3304
+ interface AggregateWindow {
3305
+ from?: string | null;
3306
+ to?: string | null;
3307
+ }
3308
+ /**
3309
+ * ONE FILTER VALUE, as `custom.record_aggregate` and `custom.dashboard_run`
3310
+ * both read it: a SCALAR is an equality, and an OBJECT is a window. It is not
3311
+ * `unknown` on purpose — a filter value the store cannot read is a refusal a
3312
+ * caller should get from the compiler, not from the database.
3313
+ */
3314
+ type AggregateFilter = string | number | boolean | null | AggregateWindow;
2815
3315
  /** One measure. `count` counts rows and needs no Field; the rest read one. */
2816
3316
  interface AggregateMeasure {
2817
3317
  op: AggregateOperation;
@@ -2831,6 +3331,107 @@ interface AggregateRow {
2831
3331
  /** The measure key the store answers with, so a chart can find its own series. */
2832
3332
  declare function measureKey(measure: AggregateMeasure): string;
2833
3333
 
3334
+ /** The seven shapes a block can take, exactly as `custom.dashboard_kinds()` answers. */
3335
+ type DashboardBlockKind = "number" | "bar" | "column" | "line" | "donut" | "table" | "stuck";
3336
+ /**
3337
+ * ONE SAVED BLOCK — the spec, not the answer. `table_id` left out means the
3338
+ * dashboard's own subject Table, and `state_key` / `days` belong to `stuck`
3339
+ * alone (the door refuses a `stuck` block that names no field to watch).
3340
+ */
3341
+ interface DashboardBlock {
3342
+ title?: string;
3343
+ kind: DashboardBlockKind;
3344
+ /** Absent = the dashboard's subject Table. */
3345
+ table_id?: Uuid | null;
3346
+ /** Field keys whose values become the groups. */
3347
+ group_by?: string[];
3348
+ /** `count` needs no key; every other operation reads one Field. */
3349
+ measures?: AggregateMeasure[];
3350
+ /** A date Field truncated to a period. */
3351
+ bucket?: {
3352
+ key: string;
3353
+ by: AggregateBucket;
3354
+ } | null;
3355
+ /** A scalar is an equality; an object is a half-open moment window. */
3356
+ filter?: Record<string, AggregateFilter> | null;
3357
+ /** Rows this block reads. The door clamps it to 1…500 and defaults to 50. */
3358
+ limit?: number;
3359
+ /** Columns of the twelve this block occupies. The door clamps it to 2…12 and defaults to 6. */
3360
+ span?: number;
3361
+ /** `stuck` only: the field whose value is watched for a change. */
3362
+ state_key?: string;
3363
+ /** `stuck` only: how long a record may sit on the same value. Defaults to 14. */
3364
+ days?: number;
3365
+ }
3366
+ /** One dashboard as `custom.dashboards` reports it to its organization. */
3367
+ interface DashboardSummary {
3368
+ dashboard_id: Uuid;
3369
+ /** The subject Table: the one a block that names no table of its own reads. */
3370
+ table_id: Uuid | null;
3371
+ name: string;
3372
+ blocks: DashboardBlock[];
3373
+ presentation: Record<string, unknown>;
3374
+ block_count: number;
3375
+ version: number;
3376
+ created_at: Timestamp;
3377
+ updated_at: Timestamp;
3378
+ }
3379
+ /**
3380
+ * One row of a `stuck` block: a record that has sat on the same value of
3381
+ * `state` for `days_unchanged` days. `measured_from` names WHERE that age was
3382
+ * measured from, because a record whose history does not reach back that far is
3383
+ * aged from what the store actually knows and says so.
3384
+ */
3385
+ interface StuckRow {
3386
+ record_id: Uuid;
3387
+ title: string | null;
3388
+ state: string | null;
3389
+ last_changed_at: Timestamp | null;
3390
+ days_unchanged: number;
3391
+ measured_from: string;
3392
+ }
3393
+ /**
3394
+ * ONE BLOCK'S ANSWER. The door echoes the block back NORMALIZED — the defaults
3395
+ * it applied, the merged filter it actually ran — and adds `rows` and `ms`;
3396
+ * a block it could not run carries `refused` and `sqlstate` INSTEAD of rows,
3397
+ * and a block it could not even normalize carries only its title and kind.
3398
+ */
3399
+ interface DashboardBlockResult {
3400
+ title: string;
3401
+ kind: DashboardBlockKind | (string & {});
3402
+ table_id?: Uuid;
3403
+ group_by?: string[];
3404
+ measures?: AggregateMeasure[];
3405
+ bucket?: {
3406
+ key: string;
3407
+ by: AggregateBucket;
3408
+ } | null;
3409
+ /** The block's own filter with the canvas bar merged under it — the block's own key wins. */
3410
+ filter?: Record<string, AggregateFilter>;
3411
+ limit?: number;
3412
+ span?: number;
3413
+ state_key?: string;
3414
+ days?: number;
3415
+ /** An aggregate block's groups and measures, or a `stuck` block's records. Absent when refused. */
3416
+ rows?: AggregateRow[] | StuckRow[];
3417
+ /** How long this one block took, in milliseconds. Absent when refused. */
3418
+ ms?: number;
3419
+ /** The store's own sentence, when this block could not be run. */
3420
+ refused?: string;
3421
+ /** The SQLSTATE that refusal carried. */
3422
+ sqlstate?: string;
3423
+ }
3424
+ /** What `custom.dashboard_run` answers: the canvas, and every block's own result. */
3425
+ interface DashboardRunResult {
3426
+ dashboard_id: Uuid;
3427
+ name: string | null;
3428
+ subject_table_id: Uuid | null;
3429
+ presentation: Record<string, unknown>;
3430
+ /** The one filter bar this run was asked with. */
3431
+ filter: Record<string, AggregateFilter>;
3432
+ blocks: DashboardBlockResult[];
3433
+ }
3434
+
2834
3435
  /** One token found in a body, in the order it appears. */
2835
3436
  interface DocToken {
2836
3437
  ordinal: number;
@@ -2907,6 +3508,25 @@ interface Subscription {
2907
3508
  event_key: string;
2908
3509
  name: string;
2909
3510
  }
3511
+ /**
3512
+ * ONE SUBSCRIPTION AS ITS OWNER SEES IT — `custom.subscriptions`.
3513
+ *
3514
+ * `custom.agg_subscriptions` is the NOTIFIER's reader: it answers the whole
3515
+ * organization's firing subscriptions so the delivery path can run, and it is
3516
+ * not callable by a client. This is the other side of the same rows — narrowed
3517
+ * to Tables the caller can already open, so the list never reveals a Table —
3518
+ * and it carries the two things a screen needs and the notifier does not: is it
3519
+ * switched off, and may I switch it off.
3520
+ */
3521
+ interface MySubscription extends Subscription {
3522
+ table_id: Uuid | null;
3523
+ /** Off. `custom.agg_subscriptions` already excludes a muted one, so this is the truth. */
3524
+ muted: boolean;
3525
+ /** It is addressed to me. */
3526
+ mine: boolean;
3527
+ /** I may switch it off: mine, or I hold admin on the Table it watches. */
3528
+ i_may_mute: boolean;
3529
+ }
2910
3530
  /** The `subscription` block a Rule record carries. Written through `record_write`. */
2911
3531
  interface SubscriptionBlock {
2912
3532
  saved_view_id: Uuid;
@@ -3871,6 +4491,99 @@ interface RecordsClient {
3871
4491
  form_id?: Uuid | null;
3872
4492
  slug?: string | null;
3873
4493
  }): Promise<RecordsResult<Uuid>>;
4494
+ /** Every portal over this organization the caller may know about, with its numbers. */
4495
+ portals(): Promise<RecordsResult<PortalSummary[]>>;
4496
+ /** ONE portal in full: what it shows, and who it was opened to. */
4497
+ portalCard(args: {
4498
+ portal_id: Uuid;
4499
+ }): Promise<RecordsResult<PortalCard>>;
4500
+ /**
4501
+ * Create or RE-STATE one portal. Re-stating REPLACES what it exposes — a
4502
+ * Table left out of `tables` stops being exposed in the same act — and leaves
4503
+ * the people alone: who is invited is not part of what the portal shows.
4504
+ */
4505
+ portalDeclare(args: {
4506
+ title: string;
4507
+ client_table_id: Uuid;
4508
+ tables: Array<{
4509
+ table_id: Uuid;
4510
+ names_via: string;
4511
+ visible_fields?: string[];
4512
+ editable_fields?: string[];
4513
+ comments?: boolean;
4514
+ }>;
4515
+ portal_id?: Uuid | null;
4516
+ slug?: string | null;
4517
+ sign_in_method?: string | null;
4518
+ }): Promise<RecordsResult<Uuid>>;
4519
+ /**
4520
+ * Invite one person, as one record of the portal's client Table.
4521
+ *
4522
+ * `user_id` is deliberately NOT a parameter here. From a screen it is always
4523
+ * null: an invitation confers NOTHING until the person follows their sign-in
4524
+ * link and the platform gives them an identity, and the door's own `say`
4525
+ * sentence states exactly that. A screen that passed an id would be granting
4526
+ * access on somebody else's behalf.
4527
+ */
4528
+ portalInvite(args: {
4529
+ portal_id: Uuid;
4530
+ client_record_id: Uuid;
4531
+ email: string;
4532
+ }): Promise<RecordsResult<PortalInvitation>>;
4533
+ /** Take one person's way in away. The answer's `say` names the consequence. */
4534
+ portalRevoke(args: {
4535
+ portal_id: Uuid;
4536
+ principal_id: Uuid;
4537
+ }): Promise<RecordsResult<PortalRevocation>>;
4538
+ /**
4539
+ * VIEW AS THIS CLIENT. The door asks `custom.visible_set` for HER user id —
4540
+ * the same call `custom.read_records` makes when she opens the page — so this
4541
+ * cannot disagree with what she sees. It REFUSES with `02000` and a sentence
4542
+ * when she has not signed in yet; show the sentence, never an empty list.
4543
+ */
4544
+ portalPreview(args: {
4545
+ portal_id: Uuid;
4546
+ principal_id: Uuid;
4547
+ table_id: Uuid;
4548
+ }): Promise<RecordsResult<PortalPreviewRow[]>>;
4549
+ /** This organization's dashboards, optionally only those whose subject is one Table. */
4550
+ dashboards(args?: {
4551
+ table_id?: Uuid | null;
4552
+ }): Promise<RecordsResult<DashboardSummary[]>>;
4553
+ /**
4554
+ * Create or re-state one dashboard. Every block is judged on the way IN —
4555
+ * a block naming a field this Table does not have is refused BY NAME, with
4556
+ * the table's own field list in the hint — so a canvas cannot be saved broken.
4557
+ */
4558
+ dashboardDeclare(args: {
4559
+ table_id: Uuid;
4560
+ name: string;
4561
+ blocks?: DashboardBlock[];
4562
+ presentation?: Record<string, unknown> | null;
4563
+ dashboard_id?: Uuid | null;
4564
+ }): Promise<RecordsResult<Uuid>>;
4565
+ /**
4566
+ * Run every block and answer the numbers. `filter` is the ONE filter bar
4567
+ * across the canvas: it is merged UNDER each block's own filter, so a block
4568
+ * deliberately scoped to one stage stays scoped while the bar moves the rest.
4569
+ * A block that refuses carries the store's sentence and the others still answer.
4570
+ */
4571
+ dashboardRun(args: {
4572
+ dashboard_id: Uuid;
4573
+ filter?: Record<string, AggregateFilter>;
4574
+ }): Promise<RecordsResult<DashboardRunResult>>;
4575
+ /** The seventh block kind on its own: records that have sat on the same value too long. */
4576
+ dashboardStuck(args: {
4577
+ table_id: Uuid;
4578
+ state_key: string;
4579
+ days?: number;
4580
+ filter?: Record<string, AggregateFilter>;
4581
+ limit?: number;
4582
+ }): Promise<RecordsResult<StuckRow[]>>;
4583
+ /** Take a dashboard away. The records it counted are untouched — a canvas owns nothing. */
4584
+ dashboardDelete(args: {
4585
+ dashboard_id: Uuid;
4586
+ }): Promise<RecordsResult<boolean>>;
3874
4587
  /**
3875
4588
  * Group, bucket, filter and measure INSIDE `custom.record_aggregate`. The
3876
4589
  * aggregate node sits above the visibility join, so what a chart draws is
@@ -3888,8 +4601,11 @@ interface RecordsClient {
3888
4601
  key: string;
3889
4602
  by: AggregateBucket;
3890
4603
  } | null;
3891
- /** Equality only, and it lands in the SAME WHERE as visibility. */
3892
- filter?: Record<string, string>;
4604
+ /**
4605
+ * A scalar is an equality and an object is a half-open moment window, and
4606
+ * either way it lands in the SAME WHERE as visibility.
4607
+ */
4608
+ filter?: Record<string, AggregateFilter>;
3893
4609
  limit?: number;
3894
4610
  }): Promise<RecordsResult<AggregateRow[]>>;
3895
4611
  /** The measures the store itself offers. Asked, never hardcoded in a picker. */
@@ -3908,6 +4624,25 @@ interface RecordsClient {
3908
4624
  }): Promise<RecordsResult<Subscription[]>>;
3909
4625
  /** The cadences the store itself offers. Asked, never hardcoded in a picker. */
3910
4626
  aggSubscriptionCadences(): Promise<RecordsResult<string[]>>;
4627
+ /**
4628
+ * WHAT THIS PERSON IS BEING TOLD ABOUT, and what they may switch off.
4629
+ *
4630
+ * Mine, plus anyone's over a Table I hold admin on — narrowed to Tables I can
4631
+ * already open, so the list never reveals one. `aggSubscriptions` above is the
4632
+ * NOTIFIER's reader and no client can call it; this is the owner's.
4633
+ */
4634
+ subscriptions(args?: {
4635
+ table_id?: Uuid | null;
4636
+ }): Promise<RecordsResult<MySubscription[]>>;
4637
+ /**
4638
+ * Switch one on or off. Muting is honoured in ONE place — the reader every
4639
+ * consumer goes through — so a screen can never say a subscription is off
4640
+ * while it keeps firing.
4641
+ */
4642
+ subscriptionMute(args: {
4643
+ rule_id: Uuid;
4644
+ muted: boolean;
4645
+ }): Promise<RecordsResult<boolean>>;
3911
4646
  docTemplateSave(args: {
3912
4647
  table_id: Uuid;
3913
4648
  name: string;
@@ -4457,4 +5192,4 @@ declare function useFieldMutation(): UseFieldMutation;
4457
5192
  */
4458
5193
  declare function useMergeField(key: string | null, state?: Record<string, unknown>): MergeFieldResolution | null;
4459
5194
 
4460
- export { ABSENCE_REASONS, ACTOR_VOCABULARY, type AbsenceReason, type Actor, type AggregateBucket, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AnonTokenBinding, COMPUTE_ON, CONTEXT_POLICIES, type ComputeOn, type ContextPolicy, type CustomFieldTableType, DELIVERIES, type Delivery, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, ENTITY_TOKENS, type EntityFieldRights, type EntityFieldValue, type EntityRecordMatch, type EntityRecordRead, type EntityRecordsFound, type EntityTableFacts, type EntityToken, type ExternalPrincipalCard, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, type Field, type FieldBehavior, type FieldPatch, type FieldProposal, type FieldRule, type FieldSensitivity, type FieldSource, type ForbiddenEnvelopeWord, type FormSummary, type Freshness, type HiddenFieldNotice, type Home, KERNEL_TABLES, type KernelTableName, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, type MergeField, type MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, type MergeFieldSemanticType, type MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type NewEntityFieldDeclaration, type NewFieldDeclaration, ON_DELETE, OVERRIDE_POLICIES, type OnDelete, type OverridePolicy, PARITY_FIELD_TYPES, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, type ParityFieldType, type ParityFieldTypeDescriptor, type PerValueAccessWord, type PermissionLevel, type PgError, type PredictedRefusal, type ProvenancePointer, type PublishBinding, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, type ReadRow, type ReadValue, type RecordDocument, type RecordRead, type RecordRevision, type RecordsActor, type RecordsConfig, type RecordsDataSource, type RecordsError, type RecordsErrorCode, type RecordsErrorSink, type RecordsFilter, RecordsProvider, type RecordsProviderProps, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsResult, type RecordsTableQuery, type RegisteredTable, type Relation, type RelationBinding, type RelationCardinality, type RelationCarries, type RelationCoordinate, type RelationFlavor, type RelationProperties, type RelationTarget, type ResolutionTriple, type ResolvedPublishBinding, type RetiredActorWord, type Rule, type RuleAnswer, type RuleExpression, type RuleNodeKind, type RuleUse, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, type StaleWriteDetail, type StorageMode, type StoreDoorName, type StoreRefusalCode, type StoredRecord, type Subscription, type SubscriptionBlock, type SubscriptionCadence, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, type Table, type TableCapacity, type TableDisplay, type TableOrigin, type TableProposal, type TableType, type Timestamp, type UseEntityFieldMutation, type UseFieldMutation, type UseRecordMutation, type UseRecordsOptions, type UseRecordsState, type Uuid, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, type ValueAlternate, type ValueAlternateKey, type ValueEnvelope, type ValueEnvelopeKey, type ValueSource, type WorkApprovalDecision, type WorkApprovalFiled, type WorkApprover, type WorkAssignment, type WorkAssignmentField, type WorkChange, type WorkDueState, type WorkGraph, type WorkInboxItem, type WorkInboxKind, type WorkInstantiation, type WorkListFlavour, type WorkListItem, type WorkOrigin, type WorkRecordState, type WorkSlotHold, type WorkState, type WorkTemplateNode, type WorkTemplateRelation, type WorkTurn, type WriteConflict, asPermissionLevel, atLeast, err, highestLevel, isRecordsErr, measureKey, ok, publicFormPath, useEntityFieldMutation, useEntityFieldRights, useEntityFields, useEntityRecord, useEntityTable, useFieldMutation, useFields, useMergeField, useMyLevel, useMyLevels, useOptionalRecordsClient, useRecord, useRecordMutation, useRecords, useRecordsActor, useRecordsClient, useTable, useTables };
5195
+ export { ABSENCE_REASONS, ACTOR_VOCABULARY, type AbsenceReason, type Actor, type AggregateBucket, type AggregateFilter, type AggregateMeasure, type AggregateOperation, type AggregateRow, type AggregateWindow, type AnonTokenBinding, COMPUTE_ON, CONTEXT_POLICIES, type ChoiceOption, type ComputeOn, type ContextPolicy, type CustomFieldTableType, DELIVERIES, type DashboardBlock, type DashboardBlockKind, type DashboardBlockResult, type DashboardRunResult, type DashboardSummary, type Delivery, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, ENTITY_TOKENS, type EntityFieldRights, type EntityFieldValue, type EntityRecordMatch, type EntityRecordRead, type EntityRecordsFound, type EntityTableFacts, type EntityToken, type ExternalPrincipalCard, FIELD_SENSITIVITIES, FIELD_SOURCES, FRESHNESS, type Field, type FieldBehavior, type FieldPatch, type FieldProposal, type FieldRule, type FieldSensitivity, type FieldSource, type FieldTypeWord, type ForbiddenEnvelopeWord, type FormSummary, type Freshness, type HiddenFieldNotice, type Home, KERNEL_TABLES, type KernelTableName, MERGE_FIELD_MODIFIERS, MERGE_FIELD_SEMANTIC_TYPES, MERGE_FIELD_SOURCES, type MergeField, type MergeFieldModifier, type MergeFieldProvenance, type MergeFieldResolution, type MergeFieldSemanticType, type MergeFieldSource, type MergeFieldTransform, type MissingBehavior, type MyLevel, type MySubscription, type NewEntityFieldDeclaration, type NewFieldDeclaration, ON_DELETE, OVERRIDE_POLICIES, type OnDelete, type OverridePolicy, PARITY_FIELD_TYPES, PERMISSION_LEVELS, PER_VALUE_ACCESS_WORDS, type ParityFieldType, type ParityFieldTypeDescriptor, type PerValueAccessWord, type PermissionLevel, type PgError, type PortalCard, type PortalInvitation, type PortalPreviewRow, type PortalPrincipal, type PortalRevocation, type PortalSummary, type PortalTableExposure, type PredictedRefusal, type ProvenancePointer, type PublishBinding, RELATION_BINDINGS, RELATION_CARDINALITIES, RELATION_FLAVORS, RETIRED_ACTOR_WORDS, RULE_NODE_KINDS, RULE_USES, type ReadRow, type ReadValue, type RecordDocument, type RecordRead, type RecordRevision, type RecordsActor, type RecordsConfig, type RecordsDataSource, type RecordsError, type RecordsErrorCode, type RecordsErrorSink, type RecordsFilter, RecordsProvider, type RecordsProviderProps, type RecordsRealtimePort, type RecordsResolverPort, type RecordsResponse, type RecordsResult, type RecordsTableQuery, type RegisteredTable, type Relation, type RelationBinding, type RelationCardinality, type RelationCarries, type RelationCoordinate, type RelationFlavor, type RelationProperties, type RelationTarget, type ResolutionTriple, type ResolvedPublishBinding, type RetiredActorWord, type Rule, type RuleAnswer, type RuleExpression, type RuleNodeKind, type RuleUse, STORAGE_MODES, STORE_DOORS, STORE_KNOBS, STORE_REFUSAL_CODES, type StaleWriteDetail, type StorageMode, type StoreDoorName, type StoreRefusalCode, type StoredRecord, type StuckRow, type Subscription, type SubscriptionBlock, type SubscriptionCadence, TABLE_DISPLAYS, TABLE_ORIGINS, TABLE_TYPES, type Table, type TableCapacity, type TableDisplay, type TableOrigin, type TableProposal, type TableType, type Timestamp, type UseEntityFieldMutation, type UseFieldMutation, type UseRecordMutation, type UseRecordsOptions, type UseRecordsState, type Uuid, VALUE_ALTERNATE_KEYS, VALUE_ENVELOPE_KEYS, type ValueAlternate, type ValueAlternateKey, type ValueEnvelope, type ValueEnvelopeKey, type ValueSource, type WorkApprovalDecision, type WorkApprovalFiled, type WorkApprover, type WorkAssignment, type WorkAssignmentField, type WorkChange, type WorkDueState, type WorkGraph, type WorkInboxItem, type WorkInboxKind, type WorkInstantiation, type WorkListFlavour, type WorkListItem, type WorkOrigin, type WorkRecordState, type WorkSlotHold, type WorkState, type WorkTemplateNode, type WorkTemplateRelation, type WorkTurn, type WriteConflict, asPermissionLevel, atLeast, choiceSlug, choiceValuesOf, choicesOf, err, highestLevel, holdsARetiredChoice, isRecordsErr, isTheChosen, looksLikeAnId, measureKey, ok, optionKey, optionLabel, portalPath, publicFormPath, useEntityFieldMutation, useEntityFieldRights, useEntityFields, useEntityRecord, useEntityTable, useFieldMutation, useFields, useMergeField, useMyLevel, useMyLevels, useOptionalRecordsClient, useRecord, useRecordMutation, useRecords, useRecordsActor, useRecordsClient, useTable, useTables };