@ai-matrx/records 0.54.0 → 0.55.1
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.
- package/CHANGELOG.md +49 -0
- package/dist/core/index.cjs +76 -8
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +56 -9
- package/dist/core/index.d.ts +56 -9
- package/dist/core/index.js +76 -8
- package/dist/core/index.js.map +1 -1
- package/dist/{field-Ct7_iYEF.d.cts → field-Dr7Ugek4.d.cts} +61 -5
- package/dist/{field-Ct7_iYEF.d.ts → field-Dr7Ugek4.d.ts} +61 -5
- package/dist/index.cjs +11 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -3
- package/dist/index.d.ts +34 -3
- package/dist/index.js +11 -4
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +76 -8
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +142 -9
- package/dist/react/index.d.ts +142 -9
- package/dist/react/index.js +76 -8
- package/dist/react/index.js.map +1 -1
- package/dist/use-cases/index.cjs +15 -0
- package/dist/use-cases/index.cjs.map +1 -1
- package/dist/use-cases/index.d.cts +1 -1
- package/dist/use-cases/index.d.ts +1 -1
- package/dist/use-cases/index.js +15 -0
- package/dist/use-cases/index.js.map +1 -1
- package/package.json +7 -7
package/dist/react/index.js
CHANGED
|
@@ -367,6 +367,7 @@ var STORE_DOORS = [
|
|
|
367
367
|
{ name: "doors_not_deciding_the_record", args: "", returns: "TABLE(function_name text, identity_args text, why text)", security: "invoker" },
|
|
368
368
|
{ name: "doors_not_masking_fields", args: "", returns: "TABLE(function_name text, identity_args text, why text)", security: "invoker" },
|
|
369
369
|
{ name: "doors_not_on_one_ladder", args: "", returns: "TABLE(function_name text, identity_args text, why text)", security: "invoker" },
|
|
370
|
+
{ name: "doors_refusing_in_another_doors_name", args: "", returns: "TABLE(function_name text, identity_args text, why text)", security: "invoker" },
|
|
370
371
|
{ name: "effective_level", args: "p_user_id uuid, p_organization_id uuid, p_id uuid, p_type text DEFAULT 'record'::text", returns: "permission_level", security: "definer" },
|
|
371
372
|
{ name: "enrich_cells", args: "p_organization_id uuid, p_table_id uuid, p_field_keys text[] DEFAULT NULL::text[], p_record_ids uuid[] DEFAULT NULL::uuid[]", returns: "TABLE(record_id uuid, field_key text, agent_owned boolean, value jsonb, value_version integer, actor text, on_behalf_of text, written_at timestamp with time zone, source jsonb, absent_reason text, alternates jsonb, pinned boolean, stale boolean, due_at timestamp with time zone)", security: "definer" },
|
|
372
373
|
{ name: "enrich_declare", args: "p_organization_id uuid, p_field_id uuid, p_spec jsonb", returns: "jsonb", security: "definer" },
|
|
@@ -409,6 +410,7 @@ var STORE_DOORS = [
|
|
|
409
410
|
{ name: "field_rules", args: "p_field_data jsonb", returns: "TABLE(kind text, spec jsonb)", security: "invoker" },
|
|
410
411
|
{ name: "field_update", args: "p_organization_id uuid, p_field_id uuid, p_patch jsonb", returns: "uuid", security: "definer" },
|
|
411
412
|
{ name: "field_value_convert", args: "p_to jsonb, p_value jsonb", returns: "jsonb", security: "invoker" },
|
|
413
|
+
{ name: "field_words", args: "p_organization_id uuid, p_field_id uuid, p_value jsonb", returns: "text", security: "invoker" },
|
|
412
414
|
{ name: "file_kernel_id", args: "", returns: "uuid", security: "invoker" },
|
|
413
415
|
{ name: "form_declare", 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", returns: "uuid", security: "definer" },
|
|
414
416
|
{ name: "form_notify", args: "p_organization_id uuid, p_form_id uuid, p_record_id uuid, p_submission_id uuid", returns: "uuid", security: "invoker" },
|
|
@@ -500,6 +502,7 @@ var STORE_DOORS = [
|
|
|
500
502
|
{ name: "migrate_merge", args: "p_organization_id uuid, p_winner_id uuid, p_loser_id uuid, p_note text DEFAULT NULL::text", returns: "jsonb", security: "definer" },
|
|
501
503
|
{ name: "migrate_promote", args: "p_organization_id uuid, p_table_id uuid, p_note text DEFAULT NULL::text", returns: "jsonb", security: "definer" },
|
|
502
504
|
{ name: "migrate_purge", args: "p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid, p_dry_run boolean DEFAULT true", returns: "jsonb", security: "definer" },
|
|
505
|
+
{ name: "migrate_purge_hard", args: "p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid, p_compliance_reason text DEFAULT NULL::text, p_chunk integer DEFAULT 200, p_dry_run boolean DEFAULT true", returns: "jsonb", security: "definer" },
|
|
503
506
|
{ name: "migrate_reclass", args: "p_organization_id uuid, p_id uuid, p_to text DEFAULT 'field'::text, p_note text DEFAULT NULL::text", returns: "jsonb", security: "definer" },
|
|
504
507
|
{ name: "migrate_rename", args: "p_organization_id uuid, p_id uuid, p_to text, p_note text DEFAULT NULL::text", returns: "jsonb", security: "definer" },
|
|
505
508
|
{ name: "migrate_reparent", args: "p_organization_id uuid, p_id uuid, p_parent_id uuid, p_note text DEFAULT NULL::text", returns: "jsonb", security: "definer" },
|
|
@@ -627,6 +630,7 @@ var STORE_DOORS = [
|
|
|
627
630
|
{ name: "record_values_versioned", args: "p_organization_id uuid, p_record_id uuid", 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)", security: "definer" },
|
|
628
631
|
{ name: "record_words", args: "p_organization_id uuid, p_record_id uuid, p_noun text DEFAULT NULL::text", returns: "text", security: "definer" },
|
|
629
632
|
{ name: "record_write", args: "p_organization_id uuid, p_table_id uuid, p_data jsonb", returns: "uuid", security: "definer" },
|
|
633
|
+
{ name: "record_write_graph", args: "p_organization_id uuid, p_table_id uuid, p_parent jsonb, p_edges jsonb DEFAULT '[]'::jsonb, p_children jsonb DEFAULT '[]'::jsonb", returns: "jsonb", security: "definer" },
|
|
630
634
|
{ name: "record_write_many", args: "p_organization_id uuid, p_table_id uuid, p_rows jsonb[], p_ids uuid[] DEFAULT NULL::uuid[]", returns: "uuid[]", security: "definer" },
|
|
631
635
|
{ name: "refusals_claiming_a_level_never_asked", args: "", returns: "TABLE(function_name text, identity_args text, why text)", security: "invoker" },
|
|
632
636
|
{ name: "relation_carry", args: "p_organization_id uuid, p_container_id uuid, p_item_id uuid", returns: "uuid", security: "definer" },
|
|
@@ -705,6 +709,7 @@ var STORE_DOORS = [
|
|
|
705
709
|
{ name: "table_declare", args: "p_organization_id uuid, p_spec jsonb", returns: "uuid", security: "definer" },
|
|
706
710
|
{ name: "table_has_a_visible_record", args: "p_user uuid, p_organization_id uuid, p_table_id uuid", returns: "boolean", security: "definer" },
|
|
707
711
|
{ name: "table_is_live", args: "p_organization_id uuid, p_table_id uuid", returns: "boolean", security: "invoker" },
|
|
712
|
+
{ name: "table_is_options_table", args: "p_organization_id uuid, p_table_id uuid", returns: "boolean", security: "invoker" },
|
|
708
713
|
{ name: "table_kernel_id", args: "", returns: "uuid", security: "invoker" },
|
|
709
714
|
{ name: "table_record_ceiling", args: "", returns: "integer", security: "invoker" },
|
|
710
715
|
{ name: "table_record_ceiling", args: "p_organization_id uuid", returns: "integer", security: "invoker" },
|
|
@@ -718,6 +723,8 @@ var STORE_DOORS = [
|
|
|
718
723
|
{ name: "table_stage_field", args: "p_organization_id uuid, p_table_id uuid", returns: "text", security: "definer" },
|
|
719
724
|
{ name: "table_storage", args: "p_organization_id uuid, p_table_id uuid", returns: "text", security: "invoker" },
|
|
720
725
|
{ name: "table_type_field", args: "p_organization_id uuid, p_table_id uuid", returns: "text", security: "definer" },
|
|
726
|
+
{ name: "table_unique_rule_fields", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "invoker" },
|
|
727
|
+
{ name: "table_work_kind", args: "p_organization_id uuid, p_table_id uuid", returns: "text", security: "invoker" },
|
|
721
728
|
{ name: "tables_at_home", args: "p_organization_id uuid, p_home_ids uuid[]", returns: "TABLE(table_id uuid, home_record_id uuid, kind text)", security: "definer" },
|
|
722
729
|
{ name: "tables_described_without_asking", args: "", returns: "TABLE(function_name text, identity_args text, why text)", security: "invoker" },
|
|
723
730
|
{ name: "trg_associations_bump_visibility", args: "", returns: "trigger", security: "definer" },
|
|
@@ -833,15 +840,15 @@ var STORE_REFUSAL_CODES = [
|
|
|
833
840
|
{ code: "02000", raised_by: "_checklist_instantiate,_portal_invite_payload,_share_write_person,_table_share_invite_payload,checklist_declare,checklist_run,checklist_step_complete,checklist_step_refusal,checklist_template_shape,conversation_scope_bind,dashboard_delete,dashboard_run,doc_letterhead,doc_render_body,doc_render_document,doc_render_read,doc_sign,doc_signature_intact,doc_signature_read,doc_template_delete,doc_template_read,doc_template_save,enrich_pin,entity_field_retire,entity_field_update,entity_record_read,entity_value_write,external_history_event,external_rows,external_stub_upsert,external_writes_set,io_restore,migrate_delete,migrate_extract_parent,migrate_merge,migrate_reclass,migrate_rename,migrate_reparent,migrate_retype,migrate_split,migrate_undo,organization_clear,portal_archive,portal_card,portal_declare,portal_invite,portal_invite_accept,portal_preview,portal_principal_bind,portal_restore,portal_revoke,read_record,record_delete,record_restore,record_restore_preview,record_table,record_update,relation_uncarry,share_access,share_grant,share_lane_set,share_people,share_revoke,sign_request_cancel,sign_request_create,sign_request_remind,sign_request_unchanged,table_archive,table_share_outside_accept,table_share_outside_invite,table_share_outside_resend,table_share_outside_revoke,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_assign,work_record_states,work_set_state" },
|
|
834
841
|
{ code: "0A000", raised_by: "checklist_step_complete,external_rows,external_source_declare,external_write_through,promote_field,promoted_index_expr,promoted_query_sql,promoted_read,rule_eval,work_assign" },
|
|
835
842
|
{ code: "22003", raised_by: "context_resolve" },
|
|
836
|
-
{ code: "22004", raised_by: "_entity_custom_fields_guard,_share_write_person,_value_envelope,actor_word,agg_assert_key,agg_sql,anon_capture,anon_token_issue,anon_write,assert_client_may_reach,booking_declare,capture_submit,checklist_declare,context_resolve,dashboard_block_normalize,dashboard_declare,dashboard_window_sql,doc_render_write,doc_sign,doc_signature_write,doc_template_save,enrich_land,enrich_normalize,external_history_event,external_rows,external_source_declare,external_stub_upsert,external_write_through,external_writes_set,field_history,form_declare,form_submit,home_add,io_comment_write,io_import_begin,io_infer_column,io_outbox_drain,io_restore,migrate_choice_keys,migrate_purge,migrate_reclass,migrate_split,migrate_undo,organization_clear,organization_contents,pipeline_declare,pipeline_gate_preview,portal_declare,portal_invite,portal_principal_bind,provenance_retention_days,provenance_write,query_across_homes,query_by_coordinates,query_rollup,record_delete,record_reparent,record_resolve,record_restore,record_update,record_write,record_write_many,relation_carry,relation_own,rule_declare,share_grant,sign_request_create,sign_request_sign,subscription_declare,table_archive,table_declare,table_share_outside_invite,value_restore,view_declare,work_approval_decide,work_approval_request,work_template_declare" },
|
|
843
|
+
{ code: "22004", raised_by: "_entity_custom_fields_guard,_share_write_person,_value_envelope,actor_word,agg_assert_key,agg_sql,anon_capture,anon_token_issue,anon_write,assert_client_may_reach,booking_declare,capture_submit,checklist_declare,context_resolve,dashboard_block_normalize,dashboard_declare,dashboard_window_sql,doc_render_write,doc_sign,doc_signature_write,doc_template_save,enrich_land,enrich_normalize,external_history_event,external_rows,external_source_declare,external_stub_upsert,external_write_through,external_writes_set,field_history,form_declare,form_submit,home_add,io_comment_write,io_import_begin,io_infer_column,io_outbox_drain,io_restore,migrate_choice_keys,migrate_purge,migrate_purge_hard,migrate_reclass,migrate_split,migrate_undo,organization_clear,organization_contents,pipeline_declare,pipeline_gate_preview,portal_declare,portal_invite,portal_principal_bind,provenance_retention_days,provenance_write,query_across_homes,query_by_coordinates,query_rollup,record_delete,record_reparent,record_resolve,record_restore,record_update,record_write,record_write_graph,record_write_many,relation_carry,relation_own,rule_declare,share_grant,sign_request_create,sign_request_sign,subscription_declare,table_archive,table_declare,table_share_outside_invite,value_restore,view_declare,work_approval_decide,work_approval_request,work_template_declare" },
|
|
837
844
|
{ code: "22007", raised_by: "dashboard_window_sql" },
|
|
838
845
|
{ code: "22012", raised_by: "rule_eval" },
|
|
839
|
-
{ code: "22023", raised_by: "_booking_availability,_entity_custom_fields_guard,_take_op_id,_value_envelope,_work_shape_guard,actor_word,agg_assert_key,agg_sql,anon_token_issue,booking_declare,containment_parent,dashboard_block_normalize,dashboard_window_sql,doc_render_body,doc_render_write,doc_signature_write,enrich_declare,enrich_land,enrich_normalize,enrich_pin,entity_value_write,external_history_event,external_source_declare,external_stub_upsert,external_write_through,field_history,field_update,io_export,io_import_begin,io_import_finish,io_import_plan,io_import_report,io_proposal_accept,list_portals,migrate_merge,migrate_reclass,my_levels,organization_clear,page_size,pin_agent_cells,pipeline_move,portal_declare,provenance_write,query_by_coordinates,query_rollup,read_records_archived,record_update,record_write_many,relation_carry,rule_eval,rule_members,share_grant,share_lane_set,sign_request_create,sign_request_sign,subscription_declare,table_rules,visibility_as_of,work_approval_request,work_list,work_slot_hold" },
|
|
846
|
+
{ code: "22023", raised_by: "_booking_availability,_entity_custom_fields_guard,_take_op_id,_value_envelope,_work_shape_guard,actor_word,agg_assert_key,agg_sql,anon_token_issue,booking_declare,containment_parent,dashboard_block_normalize,dashboard_window_sql,doc_render_body,doc_render_write,doc_signature_write,enrich_declare,enrich_land,enrich_normalize,enrich_pin,entity_value_write,external_history_event,external_source_declare,external_stub_upsert,external_write_through,field_history,field_update,io_export,io_import_begin,io_import_finish,io_import_plan,io_import_report,io_proposal_accept,list_portals,migrate_merge,migrate_reclass,my_levels,organization_clear,page_size,pin_agent_cells,pipeline_move,portal_declare,provenance_write,query_by_coordinates,query_rollup,read_records_archived,record_update,record_write_graph,record_write_many,relation_carry,rule_eval,rule_members,share_grant,share_lane_set,sign_request_create,sign_request_sign,subscription_declare,table_rules,visibility_as_of,work_approval_request,work_list,work_slot_hold" },
|
|
840
847
|
{ code: "23503", raised_by: "_booking_availability,_checklist_instantiate,_containment_guard,_display_spec_for,_field_document_for,_field_type_parity_guard,_pipeline_stage_key,_record_rule_uses,agg_digest_assemble,anon_publish,anon_rate_take,anon_token_issue,anon_write,assert_organization_wall,booking_cancel,booking_confirm,booking_declare,booking_hold,booking_reschedule,capture_publish,checklist_declare,checklist_steps_table,comment_write,dashboard_declare,delete_rule,doc_sign,doc_template_save,enrich_declare,enrich_due,enrich_land,form_declare,form_submit,home_add,inbound_declare,inbound_mail_land,inbound_set,io_comment_write,io_import_begin,io_import_finish,io_import_report,io_import_rows,io_proposal_accept,migrate_demote,migrate_promote,pipeline_board,pipeline_declare,pipeline_move,pipeline_read,pipeline_transition_refusal,promote_field,promote_table,record_applicability,record_reparent,relation_carry,relation_own,resolve_first_match,rule_applies,rule_declare,rule_eval,rule_members,rule_run,sign_request_create,subscription_mute,subscription_preview,view_declare,work_set_state,work_take_assignment,work_template_instantiate" },
|
|
841
848
|
{ code: "23505", raised_by: "_share_write_person,_unique_rule_holds,doc_sign,doc_signature_write,entity_field_declare,field_declare,home_add,inbound_declare,io_proposal_accept,relation_carry,relation_own,sign_request_cancel,sign_request_create,table_share_outside_resend,work_approval_decide,work_slot_hold" },
|
|
842
|
-
{ code: "23514", raised_by: "_checklist_instantiate,_checklist_step_guard,_containment_guard,_dated_values_guard,_derived_fields,_display_spec_for,_entity_custom_fields_guard,_field_class_guard,_field_document_for,_field_shape_guard,_field_type_parity_guard,_merge_field_shape_guard,_merge_field_temporal_guard,_promoted_field_cap_guard,_record_rule_uses,_resolve_choice_words,_rule_shape_guard,_rule_topology_guard,_store_relation_edge_names_its_field,_table_columns_word_guard,_table_shape_guard,_undeclared_key_guard,_value_envelope,_with_display,_work_shape_guard,_workdoors_approval_guard,assert_columns_are_defined,assert_entity_is_organization_scoped,booking_declare,capture_publish,capture_sheet_declare,checklist_declare,checklist_step_complete,doc_sign,doc_signature_write,doc_template_save,entity_field_declare,entity_field_retire,entity_field_update,entity_records_find,entity_table,field_declare,field_retire,field_update,home_add,io_comment_write,io_import_rows,migrate_merge,portal_archive,portal_restore,relation_carry,relation_own,sign_request_create,sign_request_sign,table_declare,validate_value_envelope,validate_values,work_set_state,work_slots_declare,work_take_assignment,work_template_instantiate" },
|
|
849
|
+
{ code: "23514", raised_by: "_checklist_instantiate,_checklist_step_guard,_containment_guard,_dated_values_guard,_derived_fields,_display_spec_for,_entity_custom_fields_guard,_field_class_guard,_field_document_for,_field_shape_guard,_field_type_parity_guard,_merge_field_shape_guard,_merge_field_temporal_guard,_promoted_field_cap_guard,_record_rule_uses,_relation_halves_agree,_resolve_choice_words,_rule_shape_guard,_rule_topology_guard,_store_relation_edge_names_its_field,_table_columns_word_guard,_table_shape_guard,_undeclared_key_guard,_value_envelope,_with_display,_work_shape_guard,_workdoors_approval_guard,assert_columns_are_defined,assert_entity_is_organization_scoped,booking_declare,capture_publish,capture_sheet_declare,checklist_declare,checklist_step_complete,doc_sign,doc_signature_write,doc_template_save,entity_field_declare,entity_field_retire,entity_field_update,entity_records_find,entity_table,field_declare,field_retire,field_update,home_add,io_comment_write,io_import_rows,migrate_merge,migrate_purge_hard,portal_archive,portal_restore,record_write_graph,relation_carry,relation_own,sign_request_create,sign_request_sign,table_declare,validate_value_envelope,validate_values,work_set_state,work_slots_declare,work_take_assignment,work_template_instantiate" },
|
|
843
850
|
{ code: "40001", raised_by: "has_visibility_at" },
|
|
844
|
-
{ code: "42501", raised_by: "_doc_render_immutable,_doc_signature_immutable,_field_definition_write,_field_write_door,_rule_definition_write,_store_door,agent_table_claim,anon_capture,anon_inbound_land,anon_publish,anon_token_issue,anon_token_verify,anon_write,assert_client_may_change,assert_client_may_open,assert_client_may_reach,assert_may_know_table,assert_organization_admin,assert_store_door,booking_confirm,booking_declare,booking_hold,capture_submit,checklist_run,comment_write,conversation_scope_bind,conversation_scope_unbind,doc_sign,enrich_declare,enrich_due,enrich_land,enrich_normalize,entity_field_declare,entity_field_retire,entity_field_update,entity_value_write,external_write_through,form_declare,form_submit,inbound_mail_land,io_comment_resolve,io_comment_write,io_import_begin,io_import_finish,io_restore,migrate_purge,migrate_reclass,my_levels,organization_clear,portal_declare,portal_invitation,portal_invite,portal_invite_accept,portal_principal_bind,promote_table,query_visibility_parity,read_record,read_records,read_records_archived,read_records_by_ids,read_records_matching,record_table,share_grant,subscription_mute,subscription_preview,table_share_outside_accept,table_share_outside_invite,table_share_outside_resend,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_person" },
|
|
851
|
+
{ code: "42501", raised_by: "_doc_render_immutable,_doc_signature_immutable,_field_definition_write,_field_write_door,_rule_definition_write,_store_door,agent_table_claim,anon_capture,anon_inbound_land,anon_publish,anon_token_issue,anon_token_verify,anon_write,assert_client_may_change,assert_client_may_open,assert_client_may_reach,assert_may_know_table,assert_organization_admin,assert_store_door,booking_confirm,booking_declare,booking_hold,capture_submit,checklist_run,comment_write,conversation_scope_bind,conversation_scope_unbind,doc_sign,enrich_declare,enrich_due,enrich_land,enrich_normalize,entity_field_declare,entity_field_retire,entity_field_update,entity_value_write,external_write_through,form_declare,form_submit,inbound_mail_land,io_comment_resolve,io_comment_write,io_import_begin,io_import_finish,io_restore,migrate_purge,migrate_purge_hard,migrate_reclass,my_levels,organization_clear,portal_declare,portal_invitation,portal_invite,portal_invite_accept,portal_principal_bind,promote_table,query_visibility_parity,read_record,read_records,read_records_archived,read_records_by_ids,read_records_matching,record_table,record_write_graph,share_grant,subscription_mute,subscription_preview,table_share_outside_accept,table_share_outside_invite,table_share_outside_resend,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_person" },
|
|
845
852
|
{ code: "42703", raised_by: "entity_table,portal_declare" },
|
|
846
853
|
{ code: "53400", raised_by: "anon_rate_take,delete_cascade_closure,enrich_due,enrich_land,promote_field" },
|
|
847
854
|
{ code: "54001", raised_by: "record_delete" },
|
|
@@ -1905,6 +1912,18 @@ var TRUST_DOORS = {
|
|
|
1905
1912
|
worldPublishAdmit: "world_publish_admit",
|
|
1906
1913
|
claimWorldNamespace: "claim_world_namespace"
|
|
1907
1914
|
};
|
|
1915
|
+
var WORKBENCH_SCHEMA = "workbench";
|
|
1916
|
+
var WORKBENCH_DOORS = {
|
|
1917
|
+
/**
|
|
1918
|
+
* What a page of the OLDER store's relation cells reads, in one round trip.
|
|
1919
|
+
* Same answer shape as `custom.relation_words_many`, same withheld sentence,
|
|
1920
|
+
* and the ladder is asked per record inside it — so batching buys a round
|
|
1921
|
+
* trip and never a disclosure. An id that names nothing comes back as
|
|
1922
|
+
* NOTHING rather than as the withheld sentence, which is what makes an
|
|
1923
|
+
* unresolvable cell distinguishable from a refused one in that store.
|
|
1924
|
+
*/
|
|
1925
|
+
udtRowWordsMany: "udt_row_words_many"
|
|
1926
|
+
};
|
|
1908
1927
|
var DOOR_NAMES = new Set(STORE_DOORS.map((d) => d.name));
|
|
1909
1928
|
function doorExists(name) {
|
|
1910
1929
|
return DOOR_NAMES.has(name);
|
|
@@ -1957,6 +1976,17 @@ var DOORS = {
|
|
|
1957
1976
|
queryTableAsOf: "query_table_as_of",
|
|
1958
1977
|
recordWrite: "record_write",
|
|
1959
1978
|
recordWriteMany: "record_write_many",
|
|
1979
|
+
// A PARENT, THE EDGES IT STANDS ON AND THE ROWS THAT BELONG TO IT — ALL OR NOTHING.
|
|
1980
|
+
// `recordWrite` and `recordWriteMany` are each ONE statement, so a caller that needs a
|
|
1981
|
+
// parent, its provenance edge and its child rows to land together had no door at all: a
|
|
1982
|
+
// loop is N transactions, and a failure on child nineteen leaves a parent standing without
|
|
1983
|
+
// the lines it promised. `custom.record_write_graph` is one statement, so it is one
|
|
1984
|
+
// transaction — and it is not a second write path: it CALLS `custom.record_write_many` for
|
|
1985
|
+
// the rows, `public.assoc_add` for an edge that points out of the store, and
|
|
1986
|
+
// `platform.relation_set` for the parent's own declared relation to its children. Every
|
|
1987
|
+
// guard, every trigger and the same editor rung, once. A refusal anywhere refuses the whole
|
|
1988
|
+
// graph, by name, and nothing is written.
|
|
1989
|
+
recordWriteGraph: "record_write_graph",
|
|
1960
1990
|
recordUpdate: "record_update",
|
|
1961
1991
|
recordDelete: "record_delete",
|
|
1962
1992
|
recordRestore: "record_restore",
|
|
@@ -2571,6 +2601,15 @@ function createRecordsClient(config) {
|
|
|
2571
2601
|
}
|
|
2572
2602
|
return ok(response.data);
|
|
2573
2603
|
}
|
|
2604
|
+
async function workbenchDoor(door, args, where) {
|
|
2605
|
+
const response = await config.dataSource.rpc(door, args, { schema: WORKBENCH_SCHEMA });
|
|
2606
|
+
if (response.error) {
|
|
2607
|
+
const refusal = mapPgError(response.error, where);
|
|
2608
|
+
scream({ code: refusal.code, message: refusal.message, ...refusal.hint ? { hint: refusal.hint } : {}, where });
|
|
2609
|
+
return err(refusal);
|
|
2610
|
+
}
|
|
2611
|
+
return ok(response.data);
|
|
2612
|
+
}
|
|
2574
2613
|
function unfold(document) {
|
|
2575
2614
|
const raw = document ?? {};
|
|
2576
2615
|
const hidden = raw._hidden ?? {};
|
|
@@ -2610,6 +2649,25 @@ function createRecordsClient(config) {
|
|
|
2610
2649
|
"recordWriteMany"
|
|
2611
2650
|
);
|
|
2612
2651
|
},
|
|
2652
|
+
async recordWriteGraph({ table_id, parent, children, edges }) {
|
|
2653
|
+
const opId = mintOpId();
|
|
2654
|
+
return callDoor(
|
|
2655
|
+
DOORS.recordWriteGraph,
|
|
2656
|
+
{
|
|
2657
|
+
p_organization_id: org,
|
|
2658
|
+
p_table_id: table_id,
|
|
2659
|
+
p_parent: { ...parent, _op_id: opId },
|
|
2660
|
+
p_edges: edges ?? [],
|
|
2661
|
+
p_children: (children ?? []).map((child) => ({
|
|
2662
|
+
data: child.data,
|
|
2663
|
+
role: child.role,
|
|
2664
|
+
...child.table_id === void 0 ? {} : { table_id: child.table_id },
|
|
2665
|
+
...child.position === void 0 ? {} : { position: child.position }
|
|
2666
|
+
}))
|
|
2667
|
+
},
|
|
2668
|
+
"recordWriteGraph"
|
|
2669
|
+
);
|
|
2670
|
+
},
|
|
2613
2671
|
async recordUpdate({ record_id, patch, expectedVersion }) {
|
|
2614
2672
|
const result = await callDoor(
|
|
2615
2673
|
DOORS.recordUpdate,
|
|
@@ -2995,16 +3053,26 @@ function createRecordsClient(config) {
|
|
|
2995
3053
|
"relationWords"
|
|
2996
3054
|
);
|
|
2997
3055
|
},
|
|
2998
|
-
async relationWordsMany(
|
|
2999
|
-
const
|
|
3056
|
+
async relationWordsMany(args) {
|
|
3057
|
+
const older = args.store === "older";
|
|
3058
|
+
const result = older ? await workbenchDoor(
|
|
3059
|
+
WORKBENCH_DOORS.udtRowWordsMany,
|
|
3060
|
+
{
|
|
3061
|
+
p_organization_id: org,
|
|
3062
|
+
p_display: args.display ?? null,
|
|
3063
|
+
p_row_ids: args.record_ids
|
|
3064
|
+
},
|
|
3065
|
+
"relationWordsMany(older)"
|
|
3066
|
+
) : await callDoor(
|
|
3000
3067
|
DOORS.relationWordsMany,
|
|
3001
|
-
{ p_organization_id: org, p_field_id: field_id, p_record_ids: record_ids },
|
|
3068
|
+
{ p_organization_id: org, p_field_id: args.field_id, p_record_ids: args.record_ids },
|
|
3002
3069
|
"relationWordsMany"
|
|
3003
3070
|
);
|
|
3004
3071
|
if (!result.ok) return result;
|
|
3005
3072
|
const map = {};
|
|
3006
3073
|
for (const row of result.data ?? []) {
|
|
3007
|
-
|
|
3074
|
+
const id = row?.record_id ?? row?.row_id;
|
|
3075
|
+
if (id && typeof row.words === "string") map[id] = row.words;
|
|
3008
3076
|
}
|
|
3009
3077
|
return { ok: true, data: map };
|
|
3010
3078
|
},
|