@ai-matrx/records 0.7.2 → 0.8.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.
@@ -327,6 +327,16 @@ declare const STORE_DOORS: readonly [{
327
327
  readonly args: "p_organization_id uuid, p_door text";
328
328
  readonly returns: "void";
329
329
  readonly security: "invoker";
330
+ }, {
331
+ readonly name: "assert_entity_door";
332
+ readonly args: "p_organization_id uuid, p_door text";
333
+ readonly returns: "void";
334
+ readonly security: "definer";
335
+ }, {
336
+ readonly name: "assert_entity_is_organization_scoped";
337
+ readonly args: "p_token text, p_label text, p_scoped boolean";
338
+ readonly returns: "void";
339
+ readonly security: "invoker";
330
340
  }, {
331
341
  readonly name: "assert_may_know_table";
332
342
  readonly args: "p_organization_id uuid, p_table_id uuid, p_door text";
@@ -472,6 +482,11 @@ declare const STORE_DOORS: readonly [{
472
482
  readonly args: "p_organization_id uuid, p_template_id uuid, p_record_id uuid";
473
483
  readonly returns: "uuid";
474
484
  readonly security: "definer";
485
+ }, {
486
+ readonly name: "doc_render_read";
487
+ readonly args: "p_organization_id uuid, p_render_id uuid";
488
+ readonly returns: "jsonb";
489
+ readonly security: "definer";
475
490
  }, {
476
491
  readonly name: "doc_render_write";
477
492
  readonly args: "p_organization_id uuid, p_template_id uuid, p_record_id uuid, p_table_id uuid, p_template_version integer, p_body text, p_content_hash text";
@@ -492,11 +507,21 @@ declare const STORE_DOORS: readonly [{
492
507
  readonly args: "p_organization_id uuid, p_signature_id uuid";
493
508
  readonly returns: "jsonb";
494
509
  readonly security: "invoker";
510
+ }, {
511
+ readonly name: "doc_signature_read";
512
+ readonly args: "p_organization_id uuid, p_signature_id uuid";
513
+ readonly returns: "jsonb";
514
+ readonly security: "definer";
495
515
  }, {
496
516
  readonly name: "doc_signature_write";
497
517
  readonly args: "p_organization_id uuid, p_render_id uuid, p_record_id uuid, p_field_key text, p_signer_name text, p_signer_user_id uuid, p_document_hash text, p_document_version integer";
498
518
  readonly returns: "uuid";
499
519
  readonly security: "definer";
520
+ }, {
521
+ readonly name: "doc_template_read";
522
+ readonly args: "p_organization_id uuid, p_template_id uuid";
523
+ readonly returns: "jsonb";
524
+ readonly security: "definer";
500
525
  }, {
501
526
  readonly name: "doc_template_save";
502
527
  readonly args: "p_organization_id uuid, p_table_id uuid, p_name text, p_body text, p_template_id uuid DEFAULT NULL::uuid";
@@ -537,6 +562,51 @@ declare const STORE_DOORS: readonly [{
537
562
  readonly args: "p_user_id uuid, p_organization_id uuid, p_id uuid, p_type text DEFAULT 'record'::text";
538
563
  readonly returns: "permission_level";
539
564
  readonly security: "definer";
565
+ }, {
566
+ readonly name: "entity_field_declare";
567
+ readonly args: "p_organization_id uuid, p_token text, p_spec jsonb";
568
+ readonly returns: "uuid";
569
+ readonly security: "definer";
570
+ }, {
571
+ readonly name: "entity_field_retire";
572
+ readonly args: "p_organization_id uuid, p_field_id uuid";
573
+ readonly returns: "uuid";
574
+ readonly security: "definer";
575
+ }, {
576
+ readonly name: "entity_field_rights";
577
+ readonly args: "p_organization_id uuid, p_token text";
578
+ readonly returns: "jsonb";
579
+ readonly security: "definer";
580
+ }, {
581
+ readonly name: "entity_field_update";
582
+ readonly args: "p_organization_id uuid, p_field_id uuid, p_patch jsonb";
583
+ readonly returns: "uuid";
584
+ readonly security: "definer";
585
+ }, {
586
+ readonly name: "entity_fields";
587
+ readonly args: "p_organization_id uuid, p_token text";
588
+ readonly returns: "SETOF custom.record";
589
+ readonly security: "definer";
590
+ }, {
591
+ readonly name: "entity_record_read";
592
+ readonly args: "p_organization_id uuid, p_token text, p_record_id uuid";
593
+ readonly returns: "jsonb";
594
+ readonly security: "invoker";
595
+ }, {
596
+ readonly name: "entity_records_find";
597
+ readonly args: "p_organization_id uuid, p_token text, p_key text, p_value jsonb DEFAULT NULL::jsonb, p_limit integer DEFAULT 50, p_offset integer DEFAULT 0";
598
+ readonly returns: "jsonb";
599
+ readonly security: "invoker";
600
+ }, {
601
+ readonly name: "entity_table";
602
+ readonly args: "p_token text";
603
+ readonly returns: "TABLE(token text, schema_name text, table_name text, type text, title_column text, label text, has_organization boolean, has_deleted_at boolean)";
604
+ readonly security: "invoker";
605
+ }, {
606
+ readonly name: "entity_value_write";
607
+ readonly args: "p_organization_id uuid, p_token text, p_record_id uuid, p_patch jsonb";
608
+ readonly returns: "jsonb";
609
+ readonly security: "invoker";
540
610
  }, {
541
611
  readonly name: "export_records";
542
612
  readonly args: "p_organization_id uuid, p_table_id uuid, p_limit integer DEFAULT 1000";
@@ -632,6 +702,36 @@ declare const STORE_DOORS: readonly [{
632
702
  readonly args: "";
633
703
  readonly returns: "uuid";
634
704
  readonly security: "invoker";
705
+ }, {
706
+ readonly name: "form_declare";
707
+ readonly args: "p_organization_id uuid, p_table_id uuid, p_title text, p_questions jsonb, p_presentation jsonb DEFAULT '{}'::jsonb, p_submission_cap integer DEFAULT NULL::integer, p_quarantine_rule_id uuid DEFAULT NULL::uuid, p_notify_rule_id uuid DEFAULT NULL::uuid, p_form_id uuid DEFAULT NULL::uuid, p_slug text DEFAULT NULL::text";
708
+ readonly returns: "uuid";
709
+ readonly security: "definer";
710
+ }, {
711
+ readonly name: "form_notify";
712
+ readonly args: "p_organization_id uuid, p_form_id uuid, p_record_id uuid, p_submission_id uuid";
713
+ readonly returns: "uuid";
714
+ readonly security: "invoker";
715
+ }, {
716
+ readonly name: "form_public";
717
+ readonly args: "p_form_id uuid";
718
+ readonly returns: "TABLE(form_id uuid, organization_id uuid, table_id uuid, title text, presentation jsonb, fields jsonb, honeypot_key text, state text, message text)";
719
+ readonly security: "definer";
720
+ }, {
721
+ readonly name: "form_slug";
722
+ readonly args: "p_organization_id uuid, p_title text, p_form_id uuid DEFAULT NULL::uuid";
723
+ readonly returns: "text";
724
+ readonly security: "invoker";
725
+ }, {
726
+ readonly name: "form_submit";
727
+ readonly args: "p_form_id uuid, p_origin text, p_payload jsonb, p_bucket text, p_honeypot text DEFAULT NULL::text, p_client_key text DEFAULT NULL::text";
728
+ readonly returns: "TABLE(submission_id uuid, record_id uuid, state text, message text)";
729
+ readonly security: "definer";
730
+ }, {
731
+ readonly name: "forms";
732
+ readonly args: "p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid";
733
+ readonly returns: "TABLE(form_id uuid, table_id uuid, title text, slug text, published_at timestamp with time zone, closed_at timestamp with time zone, submission_cap integer, responses bigint, in_table bigint, held bigint, rejected bigint, state text, quarantine_rule_id uuid, notify_rule_id uuid, presentation jsonb)";
734
+ readonly security: "definer";
635
735
  }, {
636
736
  readonly name: "formula_value";
637
737
  readonly args: "p_organization_id uuid, p_record_id uuid, p_field_data jsonb, p_values jsonb DEFAULT NULL::jsonb";
@@ -892,6 +992,16 @@ declare const STORE_DOORS: readonly [{
892
992
  readonly args: "p_organization_id uuid, p_ids jsonb, p_type text DEFAULT 'record'::text";
893
993
  readonly returns: "TABLE(id uuid, level permission_level)";
894
994
  readonly security: "definer";
995
+ }, {
996
+ readonly name: "organization_clear";
997
+ readonly args: "p_organization_id uuid, p_confirm text, p_and_destroy boolean DEFAULT false";
998
+ readonly returns: "jsonb";
999
+ readonly security: "definer";
1000
+ }, {
1001
+ readonly name: "organization_contents";
1002
+ readonly args: "p_organization_id uuid";
1003
+ readonly returns: "jsonb";
1004
+ readonly security: "definer";
895
1005
  }, {
896
1006
  readonly name: "organization_kernel_id";
897
1007
  readonly args: "";
@@ -1212,6 +1322,11 @@ declare const STORE_DOORS: readonly [{
1212
1322
  readonly args: "p_organization_id uuid, p_container_id uuid, p_item_id uuid";
1213
1323
  readonly returns: "uuid";
1214
1324
  readonly security: "definer";
1325
+ }, {
1326
+ readonly name: "relation_edges_withdraw";
1327
+ readonly args: "p_organization_id uuid, p_field_ids uuid[], p_why text";
1328
+ readonly returns: "integer";
1329
+ readonly security: "definer";
1215
1330
  }, {
1216
1331
  readonly name: "relation_own";
1217
1332
  readonly args: "p_organization_id uuid, p_owner_id uuid, p_target_id uuid";
@@ -1282,6 +1397,11 @@ declare const STORE_DOORS: readonly [{
1282
1397
  readonly args: "p_organization_id uuid, p_record_id uuid";
1283
1398
  readonly returns: "jsonb";
1284
1399
  readonly security: "invoker";
1400
+ }, {
1401
+ readonly name: "rule_declare";
1402
+ readonly args: "p_organization_id uuid, p_spec jsonb, p_rule_id uuid DEFAULT NULL::uuid";
1403
+ readonly returns: "uuid";
1404
+ readonly security: "definer";
1285
1405
  }, {
1286
1406
  readonly name: "rule_dependency_edges";
1287
1407
  readonly args: "p_organization_id uuid, p_row custom.record DEFAULT NULL::custom.record";
@@ -1582,6 +1702,36 @@ declare const STORE_DOORS: readonly [{
1582
1702
  readonly args: "";
1583
1703
  readonly returns: "uuid";
1584
1704
  readonly security: "invoker";
1705
+ }, {
1706
+ readonly name: "work_approval_approvers";
1707
+ readonly args: "p_organization_id uuid, p_subject_id uuid, p_approver_id uuid DEFAULT NULL::uuid";
1708
+ readonly returns: "TABLE(user_id uuid, name text, why text)";
1709
+ readonly security: "definer";
1710
+ }, {
1711
+ readonly name: "work_approval_decide";
1712
+ readonly args: "p_organization_id uuid, p_approval_id uuid, p_approve boolean, p_note text DEFAULT NULL::text";
1713
+ readonly returns: "jsonb";
1714
+ readonly security: "definer";
1715
+ }, {
1716
+ readonly name: "work_approval_may_decide";
1717
+ readonly args: "p_organization_id uuid, p_approval_id uuid";
1718
+ readonly returns: "boolean";
1719
+ readonly security: "definer";
1720
+ }, {
1721
+ readonly name: "work_approval_read";
1722
+ readonly args: "p_organization_id uuid, p_approval_id uuid";
1723
+ readonly returns: "jsonb";
1724
+ readonly security: "definer";
1725
+ }, {
1726
+ readonly name: "work_approval_request";
1727
+ readonly args: "p_organization_id uuid, p_subject_id uuid, p_change jsonb, p_note text DEFAULT NULL::text, p_approver_id uuid DEFAULT NULL::uuid, p_origin text DEFAULT 'person'::text, p_conversation_id uuid DEFAULT NULL::uuid";
1728
+ readonly returns: "jsonb";
1729
+ readonly security: "definer";
1730
+ }, {
1731
+ readonly name: "work_assign";
1732
+ readonly args: "p_organization_id uuid, p_record_id uuid, p_assignee_user_id uuid, p_due_date timestamp with time zone DEFAULT NULL::timestamp with time zone, p_clear_due boolean DEFAULT false";
1733
+ readonly returns: "jsonb";
1734
+ readonly security: "definer";
1585
1735
  }, {
1586
1736
  readonly name: "work_assignment_fields";
1587
1737
  readonly args: "p_options_table_id uuid DEFAULT NULL::uuid";
@@ -1591,32 +1741,57 @@ declare const STORE_DOORS: readonly [{
1591
1741
  readonly name: "work_has_assignment";
1592
1742
  readonly args: "p_organization_id uuid, p_table_id uuid";
1593
1743
  readonly returns: "boolean";
1594
- readonly security: "invoker";
1744
+ readonly security: "definer";
1745
+ }, {
1746
+ readonly name: "work_inbox";
1747
+ readonly args: "p_organization_id uuid, p_limit integer DEFAULT 50, p_offset integer DEFAULT 0, p_include_decided boolean DEFAULT false";
1748
+ readonly returns: "TABLE(item_id uuid, kind text, origin text, title text, subject_id uuid, subject_kind text, summary text, state text, due_on timestamp with time zone, due_state text, actionable boolean, requested_by uuid, requested_by_name text, at timestamp with time zone)";
1749
+ readonly security: "definer";
1595
1750
  }, {
1596
1751
  readonly name: "work_instantiation_shape";
1597
1752
  readonly args: "p_organization_id uuid, p_instantiation_id uuid";
1598
1753
  readonly returns: "jsonb";
1599
- readonly security: "invoker";
1754
+ readonly security: "definer";
1755
+ }, {
1756
+ readonly name: "work_list";
1757
+ readonly args: "p_organization_id uuid, p_flavour text DEFAULT 'mine'::text, p_include_finished boolean DEFAULT false, p_limit integer DEFAULT 100, p_offset integer DEFAULT 0";
1758
+ readonly returns: "TABLE(record_id uuid, table_id uuid, table_name text, title text, assignee_id uuid, assignee_name text, assignee_user_id uuid, due_on timestamp with time zone, due_state text, status text, terminal boolean, assigned_by uuid, updated_at timestamp with time zone)";
1759
+ readonly security: "definer";
1760
+ }, {
1761
+ readonly name: "work_person";
1762
+ readonly args: "p_organization_id uuid, p_user_id uuid, p_create boolean DEFAULT true";
1763
+ readonly returns: "uuid";
1764
+ readonly security: "definer";
1765
+ }, {
1766
+ readonly name: "work_record_states";
1767
+ readonly args: "p_organization_id uuid, p_record_id uuid";
1768
+ readonly returns: "TABLE(state_id uuid, name text, sort integer, terminal boolean, is_current boolean, allowed boolean, refusal text)";
1769
+ readonly security: "definer";
1600
1770
  }, {
1601
1771
  readonly name: "work_relation_kinds";
1602
1772
  readonly args: "";
1603
1773
  readonly returns: "TABLE(kind text, available boolean, why text)";
1604
1774
  readonly security: "invoker";
1775
+ }, {
1776
+ readonly name: "work_set_state";
1777
+ readonly args: "p_organization_id uuid, p_record_id uuid, p_state_id uuid";
1778
+ readonly returns: "jsonb";
1779
+ readonly security: "definer";
1605
1780
  }, {
1606
1781
  readonly name: "work_slot_expire";
1607
1782
  readonly args: "p_organization_id uuid, p_table_id uuid";
1608
1783
  readonly returns: "integer";
1609
- readonly security: "invoker";
1784
+ readonly security: "definer";
1610
1785
  }, {
1611
1786
  readonly name: "work_slot_hold";
1612
1787
  readonly args: "p_organization_id uuid, p_table_id uuid, p_slot_key text, p_holder text, p_ttl interval DEFAULT '00:15:00'::interval";
1613
1788
  readonly returns: "jsonb";
1614
- readonly security: "invoker";
1789
+ readonly security: "definer";
1615
1790
  }, {
1616
1791
  readonly name: "work_slot_holds";
1617
1792
  readonly args: "p_organization_id uuid, p_table_id uuid";
1618
1793
  readonly returns: "TABLE(hold_id uuid, slot_key text, holder text, expires_at timestamp with time zone, expired boolean)";
1619
- readonly security: "invoker";
1794
+ readonly security: "definer";
1620
1795
  }, {
1621
1796
  readonly name: "work_slot_index_name";
1622
1797
  readonly args: "p_table_id uuid";
@@ -1626,12 +1801,12 @@ declare const STORE_DOORS: readonly [{
1626
1801
  readonly name: "work_slot_release";
1627
1802
  readonly args: "p_organization_id uuid, p_hold_id uuid";
1628
1803
  readonly returns: "boolean";
1629
- readonly security: "invoker";
1804
+ readonly security: "definer";
1630
1805
  }, {
1631
1806
  readonly name: "work_slots_declare";
1632
1807
  readonly args: "p_organization_id uuid, p_name text, p_slug text, p_home_id uuid DEFAULT NULL::uuid";
1633
1808
  readonly returns: "jsonb";
1634
- readonly security: "invoker";
1809
+ readonly security: "definer";
1635
1810
  }, {
1636
1811
  readonly name: "work_states";
1637
1812
  readonly args: "";
@@ -1641,17 +1816,17 @@ declare const STORE_DOORS: readonly [{
1641
1816
  readonly name: "work_take_assignment";
1642
1817
  readonly args: "p_organization_id uuid, p_table_id uuid";
1643
1818
  readonly returns: "jsonb";
1644
- readonly security: "invoker";
1819
+ readonly security: "definer";
1645
1820
  }, {
1646
1821
  readonly name: "work_template_declare";
1647
1822
  readonly args: "p_organization_id uuid, p_name text, p_graph jsonb";
1648
1823
  readonly returns: "uuid";
1649
- readonly security: "invoker";
1824
+ readonly security: "definer";
1650
1825
  }, {
1651
1826
  readonly name: "work_template_instantiate";
1652
1827
  readonly args: "p_organization_id uuid, p_template_id uuid, p_overrides jsonb DEFAULT '{}'::jsonb";
1653
1828
  readonly returns: "jsonb";
1654
- readonly security: "invoker";
1829
+ readonly security: "definer";
1655
1830
  }, {
1656
1831
  readonly name: "work_template_refusal";
1657
1832
  readonly args: "p_graph jsonb";
@@ -1661,17 +1836,22 @@ declare const STORE_DOORS: readonly [{
1661
1836
  readonly name: "work_template_shape";
1662
1837
  readonly args: "p_organization_id uuid, p_template_id uuid";
1663
1838
  readonly returns: "jsonb";
1664
- readonly security: "invoker";
1839
+ readonly security: "definer";
1840
+ }, {
1841
+ readonly name: "work_templates";
1842
+ readonly args: "p_organization_id uuid, p_limit integer DEFAULT 100";
1843
+ readonly returns: "TABLE(template_id uuid, name text, nodes integer, relations integer, created_at timestamp with time zone)";
1844
+ readonly security: "definer";
1665
1845
  }, {
1666
1846
  readonly name: "work_transition_refusal";
1667
1847
  readonly args: "p_organization_id uuid, p_from_state_id uuid, p_to_state_id uuid";
1668
1848
  readonly returns: "text";
1669
- readonly security: "invoker";
1849
+ readonly security: "definer";
1670
1850
  }, {
1671
1851
  readonly name: "work_whose_turn";
1672
1852
  readonly args: "p_organization_id uuid, p_table_id uuid, p_include_finished boolean DEFAULT false";
1673
1853
  readonly returns: "TABLE(record_id uuid, title text, assignee_id uuid, turn text, due_on timestamp with time zone, state text, status text, terminal boolean)";
1674
- readonly security: "invoker";
1854
+ readonly security: "definer";
1675
1855
  }];
1676
1856
  /** The campaign's own knobs, with the value the store resolves them to today. */
1677
1857
  declare const STORE_KNOBS: readonly [{
@@ -1823,34 +2003,37 @@ declare const STORE_KNOBS: readonly [{
1823
2003
  */
1824
2004
  declare const STORE_REFUSAL_CODES: readonly [{
1825
2005
  readonly code: "02000";
1826
- readonly raised_by: "doc_render_body,doc_render_document,doc_sign,doc_signature_intact,doc_template_save,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,read_record,record_delete,record_restore,record_update,relation_uncarry,share_access,share_grant,share_lane_set,share_people,share_revoke,visibility_as_of";
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";
1827
2007
  }, {
1828
2008
  readonly code: "0A000";
1829
- readonly raised_by: "external_rows,external_source_declare,external_write_through,promote_field,promoted_index_expr,promoted_query_sql,promoted_read,rule_eval,work_slots_declare";
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";
1830
2010
  }, {
1831
2011
  readonly code: "22004";
1832
- readonly raised_by: "_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,home_add,io_comment_write,io_import_open,io_outbox_drain,io_restore,migrate_purge,migrate_split,migrate_undo,query_across_homes,query_by_coordinates,query_rollup,record_delete,record_reparent,record_resolve,record_restore,record_update,record_write,relation_carry,relation_own,share_grant,table_declare,work_template_declare";
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";
1833
2013
  }, {
1834
2014
  readonly code: "22012";
1835
2015
  readonly raised_by: "rule_eval";
1836
2016
  }, {
1837
2017
  readonly code: "22023";
1838
- readonly raised_by: "_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,external_history_event,external_source_declare,external_stub_upsert,external_write_through,io_import_open,io_proposal_accept,migrate_merge,my_levels,query_by_coordinates,query_rollup,record_update,relation_carry,rule_eval,rule_members,share_grant,share_lane_set,table_rules,visibility_as_of,work_slot_hold";
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";
1839
2019
  }, {
1840
2020
  readonly code: "23503";
1841
- readonly raised_by: "_containment_guard,_record_rule_uses,anon_publish,anon_rate_take,anon_token_issue,anon_write,assert_organization_wall,delete_rule,doc_sign,doc_template_save,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_eval,rule_members,rule_run,work_take_assignment,work_template_instantiate";
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";
1842
2022
  }, {
1843
2023
  readonly code: "23505";
1844
- readonly raised_by: "_unique_rule_holds,doc_sign,doc_signature_write,field_declare,home_add,io_proposal_accept,relation_carry,relation_own,share_grant,work_slot_hold";
2024
+ 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";
1845
2025
  }, {
1846
2026
  readonly code: "23514";
1847
- readonly raised_by: "_containment_guard,_dated_values_guard,_derived_fields,_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,doc_sign,doc_signature_write,doc_template_save,field_declare,field_retire,field_update,home_add,migrate_merge,relation_carry,relation_own,validate_value_envelope,validate_values,work_slots_declare,work_take_assignment,work_template_instantiate";
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";
1848
2028
  }, {
1849
2029
  readonly code: "40001";
1850
2030
  readonly raised_by: "has_visibility_at";
1851
2031
  }, {
1852
2032
  readonly code: "42501";
1853
- 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,external_write_through,io_comment_resolve,io_comment_write,io_restore,migrate_purge,my_levels,promote_table,query_visibility_parity,read_record,read_records,share_grant,visibility_as_of";
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";
2034
+ }, {
2035
+ readonly code: "42703";
2036
+ readonly raised_by: "entity_table";
1854
2037
  }, {
1855
2038
  readonly code: "53400";
1856
2039
  readonly raised_by: "anon_rate_take,delete_cascade_closure,promote_field";
@@ -2483,6 +2666,37 @@ interface RuleAnswer {
2483
2666
  applies: boolean;
2484
2667
  answer: unknown;
2485
2668
  }
2669
+ /** One form as `custom.forms` reports it to its owner. */
2670
+ interface FormSummary {
2671
+ form_id: string;
2672
+ table_id: string;
2673
+ title: string | null;
2674
+ slug: string;
2675
+ published_at: string | null;
2676
+ closed_at: string | null;
2677
+ submission_cap: number | null;
2678
+ /** Every answer that arrived, rejected ones excluded from `in_table` and `held`. */
2679
+ responses: number;
2680
+ /** Answers that became records — the only number that means "it is in the table". */
2681
+ in_table: number;
2682
+ /** Answers waiting for a person, because the form's accept Rule did not clear them. */
2683
+ held: number;
2684
+ /** Answers the accept Rule or the decoy turned away. */
2685
+ rejected: number;
2686
+ /** draft · open · closed · full — the store's own word, never derived on a screen. */
2687
+ state: "draft" | "open" | "closed" | "full";
2688
+ quarantine_rule_id: string | null;
2689
+ notify_rule_id: string | null;
2690
+ presentation: Record<string, unknown>;
2691
+ }
2692
+ /**
2693
+ * THE PUBLIC LINK, and the one place its shape is written down.
2694
+ *
2695
+ * The form's own id IS the capability — 122 bits of UUIDv4, exactly as
2696
+ * Typeform's form id in `/to/<id>` is and as an unguessable meeting slug is
2697
+ * here. There is no second secret to keep, and revoking it is closing the form.
2698
+ */
2699
+ declare function publicFormPath(formId: string): string;
2486
2700
 
2487
2701
  /** The measures the store offers. Asked of `custom.agg_operations()` at run time too. */
2488
2702
  type AggregateOperation = "count" | "sum" | "avg" | "min" | "max";
@@ -3374,6 +3588,29 @@ interface RecordsClient {
3374
3588
  values: Record<string, unknown>;
3375
3589
  context?: Record<string, unknown>;
3376
3590
  }): Promise<RecordsResult<unknown>>;
3591
+ /**
3592
+ * Write ONE Rule as a real Rule. `recordWrite` into the Rule kernel makes a
3593
+ * valid Rule document that carries `data_class = 'record'`, and every reader
3594
+ * that looks for a Rule looks for the class — `custom.agg_subscriptions`
3595
+ * selects `where data_class = 'rule'` — so a subscription written that way
3596
+ * fires at nobody. This is the door that closes it.
3597
+ */
3598
+ /** This organization's forms, with how many answers arrived and how many are in the table. */
3599
+ forms(args?: {
3600
+ table_id?: Uuid | null;
3601
+ }): Promise<RecordsResult<FormSummary[]>>;
3602
+ /** Create or re-state one form. A question naming no Field of that Table is refused BY NAME. */
3603
+ formDeclare(args: {
3604
+ table_id: Uuid;
3605
+ title: string;
3606
+ questions: unknown[];
3607
+ presentation?: Record<string, unknown> | null;
3608
+ submission_cap?: number | null;
3609
+ quarantine_rule_id?: Uuid | null;
3610
+ notify_rule_id?: Uuid | null;
3611
+ form_id?: Uuid | null;
3612
+ slug?: string | null;
3613
+ }): Promise<RecordsResult<Uuid>>;
3377
3614
  /**
3378
3615
  * Group, bucket, filter and measure INSIDE `custom.record_aggregate`. The
3379
3616
  * aggregate node sits above the visibility join, so what a chart draws is
@@ -3656,7 +3893,8 @@ interface RecordsClient {
3656
3893
  */
3657
3894
  ruleDeclare(args: {
3658
3895
  spec: Record<string, unknown>;
3659
- }): Promise<RecordsResult<never>>;
3896
+ rule_id?: Uuid | null;
3897
+ }): Promise<RecordsResult<Uuid>>;
3660
3898
  fieldPropose(proposal: FieldProposal): Promise<RecordsResult<never>>;
3661
3899
  tablePropose(proposal: TableProposal): Promise<RecordsResult<never>>;
3662
3900
  promoteTable(args: {
@@ -3693,6 +3931,21 @@ declare function RecordsProvider({ config, children }: RecordsProviderProps): re
3693
3931
  * mounted the provider is the silent failure this throws instead of.
3694
3932
  */
3695
3933
  declare function useRecordsClient(): RecordsClient;
3934
+ /**
3935
+ * The client IF one is mounted, and `null` if none is — for the ONE case where
3936
+ * that is not a mistake: a screen served to somebody who has no account.
3937
+ *
3938
+ * A public form page (DOOR-17) renders for a stranger. There is no session to
3939
+ * build a client from, no organization the caller may name and no read of the
3940
+ * table it writes into; the server resolved the form through
3941
+ * `custom.form_public` and hands the screen its questions and a submit port.
3942
+ * `useRecordsClient` is right to throw for every other caller — a hook that
3943
+ * quietly did nothing is the silent failure it exists to prevent — so this is a
3944
+ * SECOND, NAMED hook rather than a softening of the first. A component using it
3945
+ * must work with `null`, and the ones in `@ai-matrx/records-ui` say out loud
3946
+ * which half of themselves is unavailable when it is.
3947
+ */
3948
+ declare function useOptionalRecordsClient(): RecordsClient | null;
3696
3949
  /** For a screen that wants to show who it is acting as (AGT-N-4). */
3697
3950
  declare function useRecordsActor(): RecordsActor;
3698
3951
 
@@ -3813,4 +4066,4 @@ declare function useFieldMutation(): UseFieldMutation;
3813
4066
  */
3814
4067
  declare function useMergeField(key: string | null, state?: Record<string, unknown>): MergeFieldResolution | null;
3815
4068
 
3816
- 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, DELIVERIES, type Delivery, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, ENTITY_TOKENS, 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 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 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 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 WorkAssignmentField, type WorkGraph, type WorkInstantiation, type WorkSlotHold, type WorkState, type WorkTemplateNode, type WorkTemplateRelation, type WorkTurn, type WriteConflict, asPermissionLevel, atLeast, err, highestLevel, isRecordsErr, measureKey, ok, useFieldMutation, useFields, useMergeField, useMyLevel, useMyLevels, useRecord, useRecordMutation, useRecords, useRecordsActor, useRecordsClient, useTable, useTables };
4069
+ 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, DELIVERIES, type Delivery, type DocRenderRow, type DocSignatureCheck, type DocSignatureRow, type DocTemplateRow, type DocToken, type DocUnresolvedToken, ENTITY_TOKENS, 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 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 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 WorkAssignmentField, type WorkGraph, type WorkInstantiation, type WorkSlotHold, type WorkState, type WorkTemplateNode, type WorkTemplateRelation, type WorkTurn, type WriteConflict, asPermissionLevel, atLeast, err, highestLevel, isRecordsErr, measureKey, ok, publicFormPath, useFieldMutation, useFields, useMergeField, useMyLevel, useMyLevels, useOptionalRecordsClient, useRecord, useRecordMutation, useRecords, useRecordsActor, useRecordsClient, useTable, useTables };