@ai-matrx/records 0.16.0 → 0.17.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.
@@ -457,6 +457,21 @@ declare const STORE_DOORS: readonly [{
457
457
  readonly args: "";
458
458
  readonly returns: "TABLE(role_name text, object_name text, privilege text)";
459
459
  readonly security: "invoker";
460
+ }, {
461
+ readonly name: "comment_mention_deliver";
462
+ readonly args: "p_organization_id uuid, p_record_id uuid, p_table_id uuid, p_comment_id uuid, p_recipient uuid, p_author_name text, p_record_title text, p_body text";
463
+ readonly returns: "uuid";
464
+ readonly security: "definer";
465
+ }, {
466
+ readonly name: "comment_thread";
467
+ readonly args: "p_organization_id uuid, p_record_id uuid, p_include_resolved boolean DEFAULT false";
468
+ readonly returns: "jsonb";
469
+ readonly security: "definer";
470
+ }, {
471
+ readonly name: "comment_write";
472
+ readonly args: "p_organization_id uuid, p_record_id uuid, p_body text, p_anchor jsonb DEFAULT '{}'::jsonb, p_parent_comment_id uuid DEFAULT NULL::uuid, p_mentions uuid[] DEFAULT NULL::uuid[]";
473
+ readonly returns: "jsonb";
474
+ readonly security: "definer";
460
475
  }, {
461
476
  readonly name: "computed_provenance";
462
477
  readonly args: "p_organization_id uuid, p_record_id uuid";
@@ -617,6 +632,11 @@ declare const STORE_DOORS: readonly [{
617
632
  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";
618
633
  readonly returns: "uuid";
619
634
  readonly security: "definer";
635
+ }, {
636
+ readonly name: "doc_renders";
637
+ readonly args: "p_organization_id uuid, p_record_id uuid";
638
+ readonly returns: "TABLE(render_id uuid, template_id uuid, record_id uuid, table_id uuid, template_version integer, body text, content_hash text, rendered_at timestamp with time zone)";
639
+ readonly security: "definer";
620
640
  }, {
621
641
  readonly name: "doc_sign";
622
642
  readonly args: "p_organization_id uuid, p_render_id uuid, p_field_key text, p_signer_name text, p_signer_user_id uuid DEFAULT NULL::uuid";
@@ -642,6 +662,16 @@ declare const STORE_DOORS: readonly [{
642
662
  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";
643
663
  readonly returns: "uuid";
644
664
  readonly security: "definer";
665
+ }, {
666
+ readonly name: "doc_signatures";
667
+ readonly args: "p_organization_id uuid, p_record_id uuid";
668
+ readonly returns: "TABLE(signature_id uuid, render_id uuid, record_id uuid, field_key text, signer_name text, signer_user_id uuid, signed_at timestamp with time zone, document_hash text, document_version integer)";
669
+ readonly security: "definer";
670
+ }, {
671
+ readonly name: "doc_template_delete";
672
+ readonly args: "p_organization_id uuid, p_template_id uuid";
673
+ readonly returns: "boolean";
674
+ readonly security: "definer";
645
675
  }, {
646
676
  readonly name: "doc_template_read";
647
677
  readonly args: "p_organization_id uuid, p_template_id uuid";
@@ -652,6 +682,11 @@ declare const STORE_DOORS: readonly [{
652
682
  readonly args: "p_organization_id uuid, p_table_id uuid, p_name text, p_body text, p_template_id uuid DEFAULT NULL::uuid";
653
683
  readonly returns: "uuid";
654
684
  readonly security: "definer";
685
+ }, {
686
+ readonly name: "doc_templates";
687
+ readonly args: "p_organization_id uuid, p_table_id uuid";
688
+ readonly returns: "TABLE(template_id uuid, renders_table_id uuid, name text, body text, template_version integer, token_count bigint, updated_at timestamp with time zone)";
689
+ readonly security: "definer";
655
690
  }, {
656
691
  readonly name: "doc_token_pattern";
657
692
  readonly args: "";
@@ -792,6 +827,11 @@ declare const STORE_DOORS: readonly [{
792
827
  readonly args: "p_organization_id uuid, p_field_id uuid";
793
828
  readonly returns: "TABLE(kind text, dependant_id uuid, label text, how text)";
794
829
  readonly security: "definer";
830
+ }, {
831
+ readonly name: "field_history";
832
+ readonly args: "p_organization_id uuid, p_table_id uuid, p_field_key text, p_limit integer DEFAULT 100, p_offset integer DEFAULT 0, p_record_id uuid DEFAULT NULL::uuid";
833
+ readonly returns: "TABLE(record_id uuid, record_title text, version integer, occurred_at timestamp with time zone, operation_label text, actor jsonb, before jsonb, after jsonb)";
834
+ readonly security: "definer";
795
835
  }, {
796
836
  readonly name: "field_kernel_id";
797
837
  readonly args: "";
@@ -882,11 +922,31 @@ declare const STORE_DOORS: readonly [{
882
922
  readonly args: "p_field custom.record, p_action text DEFAULT 'read'::text";
883
923
  readonly returns: "jsonb";
884
924
  readonly security: "invoker";
925
+ }, {
926
+ readonly name: "history_actor";
927
+ readonly args: "p_tier text, p_document jsonb, p_actor_id uuid, p_people jsonb";
928
+ readonly returns: "jsonb";
929
+ readonly security: "invoker";
930
+ }, {
931
+ readonly name: "history_changes";
932
+ readonly args: "p_organization_id uuid, p_table_id uuid, p_old jsonb, p_new jsonb";
933
+ readonly returns: "jsonb";
934
+ readonly security: "invoker";
935
+ }, {
936
+ readonly name: "history_people";
937
+ readonly args: "p_organization_id uuid, p_ids uuid[]";
938
+ readonly returns: "jsonb";
939
+ readonly security: "definer";
885
940
  }, {
886
941
  readonly name: "history_prune";
887
942
  readonly args: "p_organization_id uuid, p_scope text DEFAULT 'values'::text, p_table_id uuid DEFAULT NULL::uuid, p_dry_run boolean DEFAULT true";
888
943
  readonly returns: "jsonb";
889
944
  readonly security: "definer";
945
+ }, {
946
+ readonly name: "history_restore_body";
947
+ readonly args: "p_current jsonb, p_target jsonb, p_field_key text DEFAULT NULL::text";
948
+ readonly returns: "jsonb";
949
+ readonly security: "invoker";
890
950
  }, {
891
951
  readonly name: "history_retention";
892
952
  readonly args: "p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid";
@@ -1487,6 +1547,11 @@ declare const STORE_DOORS: readonly [{
1487
1547
  readonly args: "p_organization_id uuid, p_record_id uuid";
1488
1548
  readonly returns: "timestamp with time zone";
1489
1549
  readonly security: "definer";
1550
+ }, {
1551
+ readonly name: "record_history";
1552
+ readonly args: "p_organization_id uuid, p_record_id uuid, p_limit integer DEFAULT 200, p_offset integer DEFAULT 0";
1553
+ readonly returns: "TABLE(version integer, occurred_at timestamp with time zone, operation text, operation_label text, actor jsonb, changes jsonb, migration_id uuid, undoable boolean)";
1554
+ readonly security: "definer";
1490
1555
  }, {
1491
1556
  readonly name: "record_relation_edges";
1492
1557
  readonly args: "p_organization_id uuid, p_id uuid, p_table_id uuid, p_data_class text, p_data jsonb, p_deleted_at timestamp with time zone";
@@ -1507,6 +1572,16 @@ declare const STORE_DOORS: readonly [{
1507
1572
  readonly args: "p_organization_id uuid, p_record_id uuid";
1508
1573
  readonly returns: "void";
1509
1574
  readonly security: "definer";
1575
+ }, {
1576
+ readonly name: "record_restore_preview";
1577
+ readonly args: "p_organization_id uuid, p_record_id uuid, p_version integer, p_field_key text DEFAULT NULL::text";
1578
+ readonly returns: "jsonb";
1579
+ readonly security: "definer";
1580
+ }, {
1581
+ readonly name: "record_restore_version";
1582
+ readonly args: "p_organization_id uuid, p_record_id uuid, p_version integer";
1583
+ readonly returns: "jsonb";
1584
+ readonly security: "definer";
1510
1585
  }, {
1511
1586
  readonly name: "record_state_as_of";
1512
1587
  readonly args: "p_record_id uuid, p_at timestamp with time zone";
@@ -1767,6 +1842,11 @@ declare const STORE_DOORS: readonly [{
1767
1842
  readonly args: "p_organization_id uuid DEFAULT NULL::uuid";
1768
1843
  readonly returns: "boolean";
1769
1844
  readonly security: "invoker";
1845
+ }, {
1846
+ readonly name: "subscription_cadences";
1847
+ readonly args: "p_organization_id uuid";
1848
+ readonly returns: "text[]";
1849
+ readonly security: "definer";
1770
1850
  }, {
1771
1851
  readonly name: "subscription_mute";
1772
1852
  readonly args: "p_organization_id uuid, p_rule_id uuid, p_muted boolean DEFAULT true";
@@ -1892,6 +1972,11 @@ declare const STORE_DOORS: readonly [{
1892
1972
  readonly args: "p_organization_id uuid, p_record_id uuid, p_key text";
1893
1973
  readonly returns: "TABLE(field_key text, field_id uuid, value jsonb, value_version integer, source jsonb, absent_reason text, actor text, on_behalf_of text, written_at timestamp with time zone, alternates jsonb)";
1894
1974
  readonly security: "definer";
1975
+ }, {
1976
+ readonly name: "value_restore";
1977
+ readonly args: "p_organization_id uuid, p_record_id uuid, p_field_key text, p_version integer";
1978
+ readonly returns: "jsonb";
1979
+ readonly security: "definer";
1895
1980
  }, {
1896
1981
  readonly name: "value_versions";
1897
1982
  readonly args: "p_old jsonb, p_new jsonb";
@@ -2128,6 +2213,10 @@ declare const STORE_KNOBS: readonly [{
2128
2213
  readonly key: "consumer_checkout_enabled";
2129
2214
  readonly value: "false";
2130
2215
  readonly type: "boolean";
2216
+ }, {
2217
+ readonly key: "consumer_context_enabled";
2218
+ readonly value: "false";
2219
+ readonly type: "boolean";
2131
2220
  }, {
2132
2221
  readonly key: "consumer_education_enabled";
2133
2222
  readonly value: "false";
@@ -2253,13 +2342,13 @@ declare const STORE_KNOBS: readonly [{
2253
2342
  */
2254
2343
  declare const STORE_REFUSAL_CODES: readonly [{
2255
2344
  readonly code: "02000";
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";
2345
+ 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_delete,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,io_restore,migrate_delete,migrate_extract_parent,migrate_merge,migrate_reclass,migrate_rename,migrate_reparent,migrate_retype,migrate_split,migrate_undo,organization_clear,portal_card,portal_declare,portal_invite,portal_preview,portal_principal_bind,portal_revoke,read_record,record_delete,record_restore,record_restore_preview,record_table,record_update,relation_uncarry,share_access,share_grant,share_lane_set,share_people,share_revoke,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_assign,work_record_states,work_set_state";
2257
2346
  }, {
2258
2347
  readonly code: "0A000";
2259
2348
  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";
2260
2349
  }, {
2261
2350
  readonly code: "22004";
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";
2351
+ 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,field_history,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,value_restore,work_approval_decide,work_approval_request,work_template_declare";
2263
2352
  }, {
2264
2353
  readonly code: "22007";
2265
2354
  readonly raised_by: "dashboard_window_sql";
@@ -2268,10 +2357,10 @@ declare const STORE_REFUSAL_CODES: readonly [{
2268
2357
  readonly raised_by: "rule_eval";
2269
2358
  }, {
2270
2359
  readonly code: "22023";
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";
2360
+ 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,field_history,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";
2272
2361
  }, {
2273
2362
  readonly code: "23503";
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";
2363
+ readonly raised_by: "_containment_guard,_field_document_for,_record_rule_uses,anon_publish,anon_rate_take,anon_token_issue,anon_write,assert_organization_wall,comment_write,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";
2275
2364
  }, {
2276
2365
  readonly code: "23505";
2277
2366
  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";
@@ -2283,7 +2372,7 @@ declare const STORE_REFUSAL_CODES: readonly [{
2283
2372
  readonly raised_by: "has_visibility_at";
2284
2373
  }, {
2285
2374
  readonly code: "42501";
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";
2375
+ 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,comment_write,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,record_table,share_grant,subscription_mute,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_person";
2287
2376
  }, {
2288
2377
  readonly code: "42703";
2289
2378
  readonly raised_by: "entity_table,portal_declare";
@@ -3456,7 +3545,6 @@ interface DocSignatureCheck {
3456
3545
  /** `custom.doc_template` — a body with tokens, and the Table it renders. */
3457
3546
  interface DocTemplateRow {
3458
3547
  id: Uuid;
3459
- organization_id: Uuid;
3460
3548
  renders_table_id: Uuid;
3461
3549
  name: string;
3462
3550
  body: string;
@@ -4624,6 +4712,14 @@ interface RecordsClient {
4624
4712
  }): Promise<RecordsResult<Subscription[]>>;
4625
4713
  /** The cadences the store itself offers. Asked, never hardcoded in a picker. */
4626
4714
  aggSubscriptionCadences(): Promise<RecordsResult<string[]>>;
4715
+ /**
4716
+ * The same cadences, through the door a PERSON may call.
4717
+ * `aggSubscriptionCadences` is the notifier's own and holds no client grant,
4718
+ * so a screen that asked for it was refused and fell back to a list typed
4719
+ * into the picker — which drifts from what the digest runner honours. This
4720
+ * one delegates to the same array, so there is exactly one list.
4721
+ */
4722
+ subscriptionCadences(): Promise<RecordsResult<string[]>>;
4627
4723
  /**
4628
4724
  * WHAT THIS PERSON IS BEING TOLD ABOUT, and what they may switch off.
4629
4725
  *
@@ -4678,15 +4774,23 @@ interface RecordsClient {
4678
4774
  docSignatureIntact(args: {
4679
4775
  signature_id: Uuid;
4680
4776
  }): Promise<RecordsResult<unknown>>;
4681
- /** Every template that renders one Table. */
4777
+ /** Every template that renders one Table. Viewer on the Table. */
4682
4778
  docTemplates(args: {
4683
4779
  table_id: Uuid;
4684
4780
  }): Promise<RecordsResult<DocTemplateRow[]>>;
4685
- /** Every frozen render of one record, newest first. */
4781
+ /**
4782
+ * Retire one template. EDITOR on the Table it renders, because a template is
4783
+ * that Table's wording. Documents already rendered keep their frozen bytes
4784
+ * and their seals, so this can never invalidate a signature.
4785
+ */
4786
+ docTemplateDelete(args: {
4787
+ template_id: Uuid;
4788
+ }): Promise<RecordsResult<boolean>>;
4789
+ /** Every frozen render of one record, newest first. Viewer on the record. */
4686
4790
  docRenders(args: {
4687
4791
  record_id: Uuid;
4688
4792
  }): Promise<RecordsResult<DocRenderRow[]>>;
4689
- /** Every signature on one record. */
4793
+ /** Every signature on one record. Viewer on the record. */
4690
4794
  docSignatures(args: {
4691
4795
  record_id: Uuid;
4692
4796
  }): Promise<RecordsResult<DocSignatureRow[]>>;
@@ -457,6 +457,21 @@ declare const STORE_DOORS: readonly [{
457
457
  readonly args: "";
458
458
  readonly returns: "TABLE(role_name text, object_name text, privilege text)";
459
459
  readonly security: "invoker";
460
+ }, {
461
+ readonly name: "comment_mention_deliver";
462
+ readonly args: "p_organization_id uuid, p_record_id uuid, p_table_id uuid, p_comment_id uuid, p_recipient uuid, p_author_name text, p_record_title text, p_body text";
463
+ readonly returns: "uuid";
464
+ readonly security: "definer";
465
+ }, {
466
+ readonly name: "comment_thread";
467
+ readonly args: "p_organization_id uuid, p_record_id uuid, p_include_resolved boolean DEFAULT false";
468
+ readonly returns: "jsonb";
469
+ readonly security: "definer";
470
+ }, {
471
+ readonly name: "comment_write";
472
+ readonly args: "p_organization_id uuid, p_record_id uuid, p_body text, p_anchor jsonb DEFAULT '{}'::jsonb, p_parent_comment_id uuid DEFAULT NULL::uuid, p_mentions uuid[] DEFAULT NULL::uuid[]";
473
+ readonly returns: "jsonb";
474
+ readonly security: "definer";
460
475
  }, {
461
476
  readonly name: "computed_provenance";
462
477
  readonly args: "p_organization_id uuid, p_record_id uuid";
@@ -617,6 +632,11 @@ declare const STORE_DOORS: readonly [{
617
632
  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";
618
633
  readonly returns: "uuid";
619
634
  readonly security: "definer";
635
+ }, {
636
+ readonly name: "doc_renders";
637
+ readonly args: "p_organization_id uuid, p_record_id uuid";
638
+ readonly returns: "TABLE(render_id uuid, template_id uuid, record_id uuid, table_id uuid, template_version integer, body text, content_hash text, rendered_at timestamp with time zone)";
639
+ readonly security: "definer";
620
640
  }, {
621
641
  readonly name: "doc_sign";
622
642
  readonly args: "p_organization_id uuid, p_render_id uuid, p_field_key text, p_signer_name text, p_signer_user_id uuid DEFAULT NULL::uuid";
@@ -642,6 +662,16 @@ declare const STORE_DOORS: readonly [{
642
662
  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";
643
663
  readonly returns: "uuid";
644
664
  readonly security: "definer";
665
+ }, {
666
+ readonly name: "doc_signatures";
667
+ readonly args: "p_organization_id uuid, p_record_id uuid";
668
+ readonly returns: "TABLE(signature_id uuid, render_id uuid, record_id uuid, field_key text, signer_name text, signer_user_id uuid, signed_at timestamp with time zone, document_hash text, document_version integer)";
669
+ readonly security: "definer";
670
+ }, {
671
+ readonly name: "doc_template_delete";
672
+ readonly args: "p_organization_id uuid, p_template_id uuid";
673
+ readonly returns: "boolean";
674
+ readonly security: "definer";
645
675
  }, {
646
676
  readonly name: "doc_template_read";
647
677
  readonly args: "p_organization_id uuid, p_template_id uuid";
@@ -652,6 +682,11 @@ declare const STORE_DOORS: readonly [{
652
682
  readonly args: "p_organization_id uuid, p_table_id uuid, p_name text, p_body text, p_template_id uuid DEFAULT NULL::uuid";
653
683
  readonly returns: "uuid";
654
684
  readonly security: "definer";
685
+ }, {
686
+ readonly name: "doc_templates";
687
+ readonly args: "p_organization_id uuid, p_table_id uuid";
688
+ readonly returns: "TABLE(template_id uuid, renders_table_id uuid, name text, body text, template_version integer, token_count bigint, updated_at timestamp with time zone)";
689
+ readonly security: "definer";
655
690
  }, {
656
691
  readonly name: "doc_token_pattern";
657
692
  readonly args: "";
@@ -792,6 +827,11 @@ declare const STORE_DOORS: readonly [{
792
827
  readonly args: "p_organization_id uuid, p_field_id uuid";
793
828
  readonly returns: "TABLE(kind text, dependant_id uuid, label text, how text)";
794
829
  readonly security: "definer";
830
+ }, {
831
+ readonly name: "field_history";
832
+ readonly args: "p_organization_id uuid, p_table_id uuid, p_field_key text, p_limit integer DEFAULT 100, p_offset integer DEFAULT 0, p_record_id uuid DEFAULT NULL::uuid";
833
+ readonly returns: "TABLE(record_id uuid, record_title text, version integer, occurred_at timestamp with time zone, operation_label text, actor jsonb, before jsonb, after jsonb)";
834
+ readonly security: "definer";
795
835
  }, {
796
836
  readonly name: "field_kernel_id";
797
837
  readonly args: "";
@@ -882,11 +922,31 @@ declare const STORE_DOORS: readonly [{
882
922
  readonly args: "p_field custom.record, p_action text DEFAULT 'read'::text";
883
923
  readonly returns: "jsonb";
884
924
  readonly security: "invoker";
925
+ }, {
926
+ readonly name: "history_actor";
927
+ readonly args: "p_tier text, p_document jsonb, p_actor_id uuid, p_people jsonb";
928
+ readonly returns: "jsonb";
929
+ readonly security: "invoker";
930
+ }, {
931
+ readonly name: "history_changes";
932
+ readonly args: "p_organization_id uuid, p_table_id uuid, p_old jsonb, p_new jsonb";
933
+ readonly returns: "jsonb";
934
+ readonly security: "invoker";
935
+ }, {
936
+ readonly name: "history_people";
937
+ readonly args: "p_organization_id uuid, p_ids uuid[]";
938
+ readonly returns: "jsonb";
939
+ readonly security: "definer";
885
940
  }, {
886
941
  readonly name: "history_prune";
887
942
  readonly args: "p_organization_id uuid, p_scope text DEFAULT 'values'::text, p_table_id uuid DEFAULT NULL::uuid, p_dry_run boolean DEFAULT true";
888
943
  readonly returns: "jsonb";
889
944
  readonly security: "definer";
945
+ }, {
946
+ readonly name: "history_restore_body";
947
+ readonly args: "p_current jsonb, p_target jsonb, p_field_key text DEFAULT NULL::text";
948
+ readonly returns: "jsonb";
949
+ readonly security: "invoker";
890
950
  }, {
891
951
  readonly name: "history_retention";
892
952
  readonly args: "p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid";
@@ -1487,6 +1547,11 @@ declare const STORE_DOORS: readonly [{
1487
1547
  readonly args: "p_organization_id uuid, p_record_id uuid";
1488
1548
  readonly returns: "timestamp with time zone";
1489
1549
  readonly security: "definer";
1550
+ }, {
1551
+ readonly name: "record_history";
1552
+ readonly args: "p_organization_id uuid, p_record_id uuid, p_limit integer DEFAULT 200, p_offset integer DEFAULT 0";
1553
+ readonly returns: "TABLE(version integer, occurred_at timestamp with time zone, operation text, operation_label text, actor jsonb, changes jsonb, migration_id uuid, undoable boolean)";
1554
+ readonly security: "definer";
1490
1555
  }, {
1491
1556
  readonly name: "record_relation_edges";
1492
1557
  readonly args: "p_organization_id uuid, p_id uuid, p_table_id uuid, p_data_class text, p_data jsonb, p_deleted_at timestamp with time zone";
@@ -1507,6 +1572,16 @@ declare const STORE_DOORS: readonly [{
1507
1572
  readonly args: "p_organization_id uuid, p_record_id uuid";
1508
1573
  readonly returns: "void";
1509
1574
  readonly security: "definer";
1575
+ }, {
1576
+ readonly name: "record_restore_preview";
1577
+ readonly args: "p_organization_id uuid, p_record_id uuid, p_version integer, p_field_key text DEFAULT NULL::text";
1578
+ readonly returns: "jsonb";
1579
+ readonly security: "definer";
1580
+ }, {
1581
+ readonly name: "record_restore_version";
1582
+ readonly args: "p_organization_id uuid, p_record_id uuid, p_version integer";
1583
+ readonly returns: "jsonb";
1584
+ readonly security: "definer";
1510
1585
  }, {
1511
1586
  readonly name: "record_state_as_of";
1512
1587
  readonly args: "p_record_id uuid, p_at timestamp with time zone";
@@ -1767,6 +1842,11 @@ declare const STORE_DOORS: readonly [{
1767
1842
  readonly args: "p_organization_id uuid DEFAULT NULL::uuid";
1768
1843
  readonly returns: "boolean";
1769
1844
  readonly security: "invoker";
1845
+ }, {
1846
+ readonly name: "subscription_cadences";
1847
+ readonly args: "p_organization_id uuid";
1848
+ readonly returns: "text[]";
1849
+ readonly security: "definer";
1770
1850
  }, {
1771
1851
  readonly name: "subscription_mute";
1772
1852
  readonly args: "p_organization_id uuid, p_rule_id uuid, p_muted boolean DEFAULT true";
@@ -1892,6 +1972,11 @@ declare const STORE_DOORS: readonly [{
1892
1972
  readonly args: "p_organization_id uuid, p_record_id uuid, p_key text";
1893
1973
  readonly returns: "TABLE(field_key text, field_id uuid, value jsonb, value_version integer, source jsonb, absent_reason text, actor text, on_behalf_of text, written_at timestamp with time zone, alternates jsonb)";
1894
1974
  readonly security: "definer";
1975
+ }, {
1976
+ readonly name: "value_restore";
1977
+ readonly args: "p_organization_id uuid, p_record_id uuid, p_field_key text, p_version integer";
1978
+ readonly returns: "jsonb";
1979
+ readonly security: "definer";
1895
1980
  }, {
1896
1981
  readonly name: "value_versions";
1897
1982
  readonly args: "p_old jsonb, p_new jsonb";
@@ -2128,6 +2213,10 @@ declare const STORE_KNOBS: readonly [{
2128
2213
  readonly key: "consumer_checkout_enabled";
2129
2214
  readonly value: "false";
2130
2215
  readonly type: "boolean";
2216
+ }, {
2217
+ readonly key: "consumer_context_enabled";
2218
+ readonly value: "false";
2219
+ readonly type: "boolean";
2131
2220
  }, {
2132
2221
  readonly key: "consumer_education_enabled";
2133
2222
  readonly value: "false";
@@ -2253,13 +2342,13 @@ declare const STORE_KNOBS: readonly [{
2253
2342
  */
2254
2343
  declare const STORE_REFUSAL_CODES: readonly [{
2255
2344
  readonly code: "02000";
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";
2345
+ 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_delete,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,io_restore,migrate_delete,migrate_extract_parent,migrate_merge,migrate_reclass,migrate_rename,migrate_reparent,migrate_retype,migrate_split,migrate_undo,organization_clear,portal_card,portal_declare,portal_invite,portal_preview,portal_principal_bind,portal_revoke,read_record,record_delete,record_restore,record_restore_preview,record_table,record_update,relation_uncarry,share_access,share_grant,share_lane_set,share_people,share_revoke,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_assign,work_record_states,work_set_state";
2257
2346
  }, {
2258
2347
  readonly code: "0A000";
2259
2348
  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";
2260
2349
  }, {
2261
2350
  readonly code: "22004";
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";
2351
+ 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,field_history,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,value_restore,work_approval_decide,work_approval_request,work_template_declare";
2263
2352
  }, {
2264
2353
  readonly code: "22007";
2265
2354
  readonly raised_by: "dashboard_window_sql";
@@ -2268,10 +2357,10 @@ declare const STORE_REFUSAL_CODES: readonly [{
2268
2357
  readonly raised_by: "rule_eval";
2269
2358
  }, {
2270
2359
  readonly code: "22023";
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";
2360
+ 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,field_history,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";
2272
2361
  }, {
2273
2362
  readonly code: "23503";
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";
2363
+ readonly raised_by: "_containment_guard,_field_document_for,_record_rule_uses,anon_publish,anon_rate_take,anon_token_issue,anon_write,assert_organization_wall,comment_write,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";
2275
2364
  }, {
2276
2365
  readonly code: "23505";
2277
2366
  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";
@@ -2283,7 +2372,7 @@ declare const STORE_REFUSAL_CODES: readonly [{
2283
2372
  readonly raised_by: "has_visibility_at";
2284
2373
  }, {
2285
2374
  readonly code: "42501";
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";
2375
+ 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,comment_write,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,record_table,share_grant,subscription_mute,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_person";
2287
2376
  }, {
2288
2377
  readonly code: "42703";
2289
2378
  readonly raised_by: "entity_table,portal_declare";
@@ -3456,7 +3545,6 @@ interface DocSignatureCheck {
3456
3545
  /** `custom.doc_template` — a body with tokens, and the Table it renders. */
3457
3546
  interface DocTemplateRow {
3458
3547
  id: Uuid;
3459
- organization_id: Uuid;
3460
3548
  renders_table_id: Uuid;
3461
3549
  name: string;
3462
3550
  body: string;
@@ -4624,6 +4712,14 @@ interface RecordsClient {
4624
4712
  }): Promise<RecordsResult<Subscription[]>>;
4625
4713
  /** The cadences the store itself offers. Asked, never hardcoded in a picker. */
4626
4714
  aggSubscriptionCadences(): Promise<RecordsResult<string[]>>;
4715
+ /**
4716
+ * The same cadences, through the door a PERSON may call.
4717
+ * `aggSubscriptionCadences` is the notifier's own and holds no client grant,
4718
+ * so a screen that asked for it was refused and fell back to a list typed
4719
+ * into the picker — which drifts from what the digest runner honours. This
4720
+ * one delegates to the same array, so there is exactly one list.
4721
+ */
4722
+ subscriptionCadences(): Promise<RecordsResult<string[]>>;
4627
4723
  /**
4628
4724
  * WHAT THIS PERSON IS BEING TOLD ABOUT, and what they may switch off.
4629
4725
  *
@@ -4678,15 +4774,23 @@ interface RecordsClient {
4678
4774
  docSignatureIntact(args: {
4679
4775
  signature_id: Uuid;
4680
4776
  }): Promise<RecordsResult<unknown>>;
4681
- /** Every template that renders one Table. */
4777
+ /** Every template that renders one Table. Viewer on the Table. */
4682
4778
  docTemplates(args: {
4683
4779
  table_id: Uuid;
4684
4780
  }): Promise<RecordsResult<DocTemplateRow[]>>;
4685
- /** Every frozen render of one record, newest first. */
4781
+ /**
4782
+ * Retire one template. EDITOR on the Table it renders, because a template is
4783
+ * that Table's wording. Documents already rendered keep their frozen bytes
4784
+ * and their seals, so this can never invalidate a signature.
4785
+ */
4786
+ docTemplateDelete(args: {
4787
+ template_id: Uuid;
4788
+ }): Promise<RecordsResult<boolean>>;
4789
+ /** Every frozen render of one record, newest first. Viewer on the record. */
4686
4790
  docRenders(args: {
4687
4791
  record_id: Uuid;
4688
4792
  }): Promise<RecordsResult<DocRenderRow[]>>;
4689
- /** Every signature on one record. */
4793
+ /** Every signature on one record. Viewer on the record. */
4690
4794
  docSignatures(args: {
4691
4795
  record_id: Uuid;
4692
4796
  }): Promise<RecordsResult<DocSignatureRow[]>>;