@ai-matrx/records 0.7.2 → 0.11.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.
@@ -63,11 +63,18 @@ __export(react_exports, {
63
63
  isRecordsErr: () => isRecordsErr,
64
64
  measureKey: () => measureKey,
65
65
  ok: () => ok,
66
+ publicFormPath: () => publicFormPath,
67
+ useEntityFieldMutation: () => useEntityFieldMutation,
68
+ useEntityFieldRights: () => useEntityFieldRights,
69
+ useEntityFields: () => useEntityFields,
70
+ useEntityRecord: () => useEntityRecord,
71
+ useEntityTable: () => useEntityTable,
66
72
  useFieldMutation: () => useFieldMutation,
67
73
  useFields: () => useFields,
68
74
  useMergeField: () => useMergeField,
69
75
  useMyLevel: () => useMyLevel,
70
76
  useMyLevels: () => useMyLevels,
77
+ useOptionalRecordsClient: () => useOptionalRecordsClient,
71
78
  useRecord: () => useRecord,
72
79
  useRecordMutation: () => useRecordMutation,
73
80
  useRecords: () => useRecords,
@@ -206,6 +213,8 @@ var STORE_DOORS = [
206
213
  { name: "assert_client_may_change", args: "p_organization_id uuid, p_subject_id uuid, p_door text, p_required permission_level DEFAULT 'editor'::permission_level, p_subject_word text DEFAULT 'record'::text", returns: "void", security: "invoker" },
207
214
  { name: "assert_client_may_open", args: "p_organization_id uuid, p_subject_id uuid, p_door text, p_required permission_level DEFAULT 'viewer'::permission_level, p_subject_word text DEFAULT 'record'::text", returns: "void", security: "invoker" },
208
215
  { name: "assert_client_may_reach", args: "p_organization_id uuid, p_door text", returns: "void", security: "invoker" },
216
+ { name: "assert_entity_door", args: "p_organization_id uuid, p_door text", returns: "void", security: "definer" },
217
+ { name: "assert_entity_is_organization_scoped", args: "p_token text, p_label text, p_scoped boolean", returns: "void", security: "invoker" },
209
218
  { name: "assert_may_know_table", args: "p_organization_id uuid, p_table_id uuid, p_door text", returns: "void", security: "invoker" },
210
219
  { name: "assert_organization_admin", args: "p_organization_id uuid, p_door text, p_what text", returns: "void", security: "invoker" },
211
220
  { name: "assert_organization_wall", args: "p_kind text, p_organization_id uuid, p_row jsonb", returns: "void", security: "invoker" },
@@ -235,11 +244,14 @@ var STORE_DOORS = [
235
244
  { name: "doc_format_value", args: "p_field_data jsonb, p_value jsonb", returns: "text", security: "invoker" },
236
245
  { name: "doc_render_body", args: "p_organization_id uuid, p_template_id uuid, p_record_id uuid", returns: "text", security: "invoker" },
237
246
  { name: "doc_render_document", args: "p_organization_id uuid, p_template_id uuid, p_record_id uuid", returns: "uuid", security: "definer" },
247
+ { name: "doc_render_read", args: "p_organization_id uuid, p_render_id uuid", returns: "jsonb", security: "definer" },
238
248
  { name: "doc_render_write", 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", returns: "uuid", security: "definer" },
239
249
  { name: "doc_sign", 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", returns: "uuid", security: "definer" },
240
250
  { name: "doc_signature_field_ok", args: "p_field_data jsonb", returns: "boolean", security: "invoker" },
241
251
  { name: "doc_signature_intact", args: "p_organization_id uuid, p_signature_id uuid", returns: "jsonb", security: "invoker" },
252
+ { name: "doc_signature_read", args: "p_organization_id uuid, p_signature_id uuid", returns: "jsonb", security: "definer" },
242
253
  { name: "doc_signature_write", 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", returns: "uuid", security: "definer" },
254
+ { name: "doc_template_read", args: "p_organization_id uuid, p_template_id uuid", returns: "jsonb", security: "definer" },
243
255
  { name: "doc_template_save", args: "p_organization_id uuid, p_table_id uuid, p_name text, p_body text, p_template_id uuid DEFAULT NULL::uuid", returns: "uuid", security: "definer" },
244
256
  { name: "doc_token_pattern", args: "", returns: "text", security: "invoker" },
245
257
  { name: "doc_tokens", args: "p_body text", returns: "TABLE(ordinal integer, raw text, field_id uuid)", security: "invoker" },
@@ -248,6 +260,15 @@ var STORE_DOORS = [
248
260
  { name: "doors_not_deciding_the_record", args: "", returns: "TABLE(function_name text, identity_args text, why text)", security: "invoker" },
249
261
  { name: "doors_not_on_one_ladder", args: "", returns: "TABLE(function_name text, identity_args text, why text)", security: "invoker" },
250
262
  { 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" },
263
+ { name: "entity_field_declare", args: "p_organization_id uuid, p_token text, p_spec jsonb", returns: "uuid", security: "definer" },
264
+ { name: "entity_field_retire", args: "p_organization_id uuid, p_field_id uuid", returns: "uuid", security: "definer" },
265
+ { name: "entity_field_rights", args: "p_organization_id uuid, p_token text", returns: "jsonb", security: "definer" },
266
+ { name: "entity_field_update", args: "p_organization_id uuid, p_field_id uuid, p_patch jsonb", returns: "uuid", security: "definer" },
267
+ { name: "entity_fields", args: "p_organization_id uuid, p_token text", returns: "SETOF custom.record", security: "definer" },
268
+ { name: "entity_record_read", args: "p_organization_id uuid, p_token text, p_record_id uuid", returns: "jsonb", security: "invoker" },
269
+ { name: "entity_records_find", 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", returns: "jsonb", security: "invoker" },
270
+ { name: "entity_table", args: "p_token text", returns: "TABLE(token text, schema_name text, table_name text, type text, title_column text, label text, has_organization boolean, has_deleted_at boolean)", security: "invoker" },
271
+ { name: "entity_value_write", args: "p_organization_id uuid, p_token text, p_record_id uuid, p_patch jsonb", returns: "jsonb", security: "invoker" },
251
272
  { name: "export_records", args: "p_organization_id uuid, p_table_id uuid, p_limit integer DEFAULT 1000", returns: "TABLE(id uuid, document jsonb)", security: "invoker" },
252
273
  { name: "external_foreign_table_findings", args: "", returns: "SETOF text", security: "definer" },
253
274
  { name: "external_history_event", args: "p_organization_id uuid, p_link_id uuid, p_operation text", returns: "bigint", security: "definer" },
@@ -267,6 +288,12 @@ var STORE_DOORS = [
267
288
  { name: "field_update", args: "p_organization_id uuid, p_field_id uuid, p_patch jsonb", returns: "uuid", security: "definer" },
268
289
  { name: "field_value_convert", args: "p_to jsonb, p_value jsonb", returns: "jsonb", security: "invoker" },
269
290
  { name: "file_kernel_id", args: "", returns: "uuid", security: "invoker" },
291
+ { 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" },
292
+ { name: "form_notify", args: "p_organization_id uuid, p_form_id uuid, p_record_id uuid, p_submission_id uuid", returns: "uuid", security: "invoker" },
293
+ { name: "form_public", args: "p_form_id uuid", returns: "TABLE(form_id uuid, organization_id uuid, table_id uuid, title text, presentation jsonb, fields jsonb, honeypot_key text, state text, message text)", security: "definer" },
294
+ { name: "form_slug", args: "p_organization_id uuid, p_title text, p_form_id uuid DEFAULT NULL::uuid", returns: "text", security: "invoker" },
295
+ { name: "form_submit", 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", returns: "TABLE(submission_id uuid, record_id uuid, state text, message text)", security: "definer" },
296
+ { name: "forms", args: "p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid", 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)", security: "definer" },
270
297
  { name: "formula_value", args: "p_organization_id uuid, p_record_id uuid, p_field_data jsonb, p_values jsonb DEFAULT NULL::jsonb", returns: "jsonb", security: "invoker" },
271
298
  { name: "guard_refusals_are_complete", args: "", returns: "TABLE(guard text, said text)", security: "invoker" },
272
299
  { name: "has_visibility", args: "p_user_id uuid, p_type text, p_id uuid, p_required permission_level DEFAULT 'viewer'::permission_level", returns: "boolean", security: "definer" },
@@ -319,6 +346,8 @@ var STORE_DOORS = [
319
346
  { name: "migrations", args: "p_organization_id uuid, p_target_id uuid DEFAULT NULL::uuid, p_limit integer DEFAULT 100", returns: "TABLE(id uuid, verb text, target_kind text, target_id uuid, note text, applied_at timestamp with time zone, applied_by uuid, undone_at timestamp with time zone)", security: "definer" },
320
347
  { name: "my_level", args: "p_organization_id uuid, p_id uuid, p_type text DEFAULT 'record'::text", returns: "permission_level", security: "definer" },
321
348
  { name: "my_levels", args: "p_organization_id uuid, p_ids jsonb, p_type text DEFAULT 'record'::text", returns: "TABLE(id uuid, level permission_level)", security: "definer" },
349
+ { name: "organization_clear", args: "p_organization_id uuid, p_confirm text, p_and_destroy boolean DEFAULT false", returns: "jsonb", security: "definer" },
350
+ { name: "organization_contents", args: "p_organization_id uuid", returns: "jsonb", security: "definer" },
322
351
  { name: "organization_kernel_id", args: "", returns: "uuid", security: "invoker" },
323
352
  { name: "organization_references", args: "p_kind text, p_organization_id uuid, p_row jsonb", returns: "TABLE(site text, what text, ref_id uuid, openable boolean)", security: "invoker" },
324
353
  { name: "owning_table", args: "p_organization_id uuid, p_record_id uuid", returns: "uuid", security: "invoker" },
@@ -383,6 +412,7 @@ var STORE_DOORS = [
383
412
  { 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" },
384
413
  { name: "record_write", args: "p_organization_id uuid, p_table_id uuid, p_data jsonb", returns: "uuid", security: "definer" },
385
414
  { name: "relation_carry", args: "p_organization_id uuid, p_container_id uuid, p_item_id uuid", returns: "uuid", security: "definer" },
415
+ { name: "relation_edges_withdraw", args: "p_organization_id uuid, p_field_ids uuid[], p_why text", returns: "integer", security: "definer" },
386
416
  { name: "relation_own", args: "p_organization_id uuid, p_owner_id uuid, p_target_id uuid", returns: "uuid", security: "definer" },
387
417
  { name: "relation_target_card", args: "p_organization_id uuid, p_record_id uuid, p_via_key text DEFAULT NULL::text", returns: "TABLE(target_id uuid, target_organization_id uuid, is_foreign boolean, masked boolean, reader_level permission_level, card jsonb, why text)", security: "definer" },
388
418
  { name: "relation_target_external", args: "p_connection_token text, p_external_table text, p_external_key text", returns: "jsonb", security: "definer" },
@@ -397,6 +427,7 @@ var STORE_DOORS = [
397
427
  { name: "rollup_value", args: "p_organization_id uuid, p_record_id uuid, p_field_data jsonb", returns: "jsonb", security: "invoker" },
398
428
  { name: "rule_applies", args: "p_organization_id uuid, p_rule_id uuid, p_record_id uuid", returns: "jsonb", security: "invoker" },
399
429
  { name: "rule_context", args: "p_organization_id uuid, p_record_id uuid", returns: "jsonb", security: "invoker" },
430
+ { name: "rule_declare", args: "p_organization_id uuid, p_spec jsonb, p_rule_id uuid DEFAULT NULL::uuid", returns: "uuid", security: "definer" },
400
431
  { name: "rule_dependency_edges", args: "p_organization_id uuid, p_row custom.record DEFAULT NULL::custom.record", returns: "TABLE(needs text, needed text)", security: "invoker" },
401
432
  { name: "rule_eval", args: "p_organization_id uuid, p_expr jsonb, p_values jsonb, p_context jsonb DEFAULT '{}'::jsonb", returns: "jsonb", security: "invoker" },
402
433
  { name: "rule_field_key", args: "p_organization_id uuid, p_field_id uuid", returns: "text", security: "invoker" },
@@ -457,24 +488,36 @@ var STORE_DOORS = [
457
488
  { name: "visible_record_ids", args: "p_user_id uuid, p_required permission_level DEFAULT 'viewer'::permission_level", returns: "TABLE(id uuid)", security: "definer" },
458
489
  { name: "visible_set", args: "p_user uuid, p_organization_id uuid, p_table_id uuid, p_required permission_level DEFAULT 'viewer'::permission_level, OUT o_all_visible boolean, OUT o_true_visibility platform.visibility[], OUT o_granted_all uuid[], OUT o_granted_visible uuid[], OUT o_carried_visible uuid[], OUT o_ladder_calls integer, OUT o_fallback boolean, OUT o_note text", returns: "record", security: "definer" },
459
490
  { name: "widget_kernel_id", args: "", returns: "uuid", security: "invoker" },
491
+ { name: "work_approval_approvers", args: "p_organization_id uuid, p_subject_id uuid, p_approver_id uuid DEFAULT NULL::uuid", returns: "TABLE(user_id uuid, name text, why text)", security: "definer" },
492
+ { name: "work_approval_decide", args: "p_organization_id uuid, p_approval_id uuid, p_approve boolean, p_note text DEFAULT NULL::text", returns: "jsonb", security: "definer" },
493
+ { name: "work_approval_may_decide", args: "p_organization_id uuid, p_approval_id uuid", returns: "boolean", security: "definer" },
494
+ { name: "work_approval_read", args: "p_organization_id uuid, p_approval_id uuid", returns: "jsonb", security: "definer" },
495
+ { name: "work_approval_request", 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", returns: "jsonb", security: "definer" },
496
+ { name: "work_assign", 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", returns: "jsonb", security: "definer" },
460
497
  { name: "work_assignment_fields", args: "p_options_table_id uuid DEFAULT NULL::uuid", returns: "TABLE(key text, label text, spec jsonb)", security: "invoker" },
461
- { name: "work_has_assignment", args: "p_organization_id uuid, p_table_id uuid", returns: "boolean", security: "invoker" },
462
- { name: "work_instantiation_shape", args: "p_organization_id uuid, p_instantiation_id uuid", returns: "jsonb", security: "invoker" },
498
+ { name: "work_has_assignment", args: "p_organization_id uuid, p_table_id uuid", returns: "boolean", security: "definer" },
499
+ { name: "work_inbox", args: "p_organization_id uuid, p_limit integer DEFAULT 50, p_offset integer DEFAULT 0, p_include_decided boolean DEFAULT false", 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)", security: "definer" },
500
+ { name: "work_instantiation_shape", args: "p_organization_id uuid, p_instantiation_id uuid", returns: "jsonb", security: "definer" },
501
+ { name: "work_list", 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", 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)", security: "definer" },
502
+ { name: "work_person", args: "p_organization_id uuid, p_user_id uuid, p_create boolean DEFAULT true", returns: "uuid", security: "definer" },
503
+ { name: "work_record_states", args: "p_organization_id uuid, p_record_id uuid", returns: "TABLE(state_id uuid, name text, sort integer, terminal boolean, is_current boolean, allowed boolean, refusal text)", security: "definer" },
463
504
  { name: "work_relation_kinds", args: "", returns: "TABLE(kind text, available boolean, why text)", security: "invoker" },
464
- { name: "work_slot_expire", args: "p_organization_id uuid, p_table_id uuid", returns: "integer", security: "invoker" },
465
- { name: "work_slot_hold", args: "p_organization_id uuid, p_table_id uuid, p_slot_key text, p_holder text, p_ttl interval DEFAULT '00:15:00'::interval", returns: "jsonb", security: "invoker" },
466
- { name: "work_slot_holds", args: "p_organization_id uuid, p_table_id uuid", returns: "TABLE(hold_id uuid, slot_key text, holder text, expires_at timestamp with time zone, expired boolean)", security: "invoker" },
505
+ { name: "work_set_state", args: "p_organization_id uuid, p_record_id uuid, p_state_id uuid", returns: "jsonb", security: "definer" },
506
+ { name: "work_slot_expire", args: "p_organization_id uuid, p_table_id uuid", returns: "integer", security: "definer" },
507
+ { name: "work_slot_hold", args: "p_organization_id uuid, p_table_id uuid, p_slot_key text, p_holder text, p_ttl interval DEFAULT '00:15:00'::interval", returns: "jsonb", security: "definer" },
508
+ { name: "work_slot_holds", args: "p_organization_id uuid, p_table_id uuid", returns: "TABLE(hold_id uuid, slot_key text, holder text, expires_at timestamp with time zone, expired boolean)", security: "definer" },
467
509
  { name: "work_slot_index_name", args: "p_table_id uuid", returns: "text", security: "invoker" },
468
- { name: "work_slot_release", args: "p_organization_id uuid, p_hold_id uuid", returns: "boolean", security: "invoker" },
469
- { name: "work_slots_declare", args: "p_organization_id uuid, p_name text, p_slug text, p_home_id uuid DEFAULT NULL::uuid", returns: "jsonb", security: "invoker" },
510
+ { name: "work_slot_release", args: "p_organization_id uuid, p_hold_id uuid", returns: "boolean", security: "definer" },
511
+ { name: "work_slots_declare", args: "p_organization_id uuid, p_name text, p_slug text, p_home_id uuid DEFAULT NULL::uuid", returns: "jsonb", security: "definer" },
470
512
  { name: "work_states", args: "", returns: "TABLE(sort integer, name text, terminal boolean, next text[])", security: "invoker" },
471
- { name: "work_take_assignment", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "invoker" },
472
- { name: "work_template_declare", args: "p_organization_id uuid, p_name text, p_graph jsonb", returns: "uuid", security: "invoker" },
473
- { name: "work_template_instantiate", args: "p_organization_id uuid, p_template_id uuid, p_overrides jsonb DEFAULT '{}'::jsonb", returns: "jsonb", security: "invoker" },
513
+ { name: "work_take_assignment", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "definer" },
514
+ { name: "work_template_declare", args: "p_organization_id uuid, p_name text, p_graph jsonb", returns: "uuid", security: "definer" },
515
+ { name: "work_template_instantiate", args: "p_organization_id uuid, p_template_id uuid, p_overrides jsonb DEFAULT '{}'::jsonb", returns: "jsonb", security: "definer" },
474
516
  { name: "work_template_refusal", args: "p_graph jsonb", returns: "text", security: "invoker" },
475
- { name: "work_template_shape", args: "p_organization_id uuid, p_template_id uuid", returns: "jsonb", security: "invoker" },
476
- { name: "work_transition_refusal", args: "p_organization_id uuid, p_from_state_id uuid, p_to_state_id uuid", returns: "text", security: "invoker" },
477
- { name: "work_whose_turn", args: "p_organization_id uuid, p_table_id uuid, p_include_finished boolean DEFAULT false", returns: "TABLE(record_id uuid, title text, assignee_id uuid, turn text, due_on timestamp with time zone, state text, status text, terminal boolean)", security: "invoker" }
517
+ { name: "work_template_shape", args: "p_organization_id uuid, p_template_id uuid", returns: "jsonb", security: "definer" },
518
+ { name: "work_templates", args: "p_organization_id uuid, p_limit integer DEFAULT 100", returns: "TABLE(template_id uuid, name text, nodes integer, relations integer, created_at timestamp with time zone)", security: "definer" },
519
+ { name: "work_transition_refusal", args: "p_organization_id uuid, p_from_state_id uuid, p_to_state_id uuid", returns: "text", security: "definer" },
520
+ { name: "work_whose_turn", args: "p_organization_id uuid, p_table_id uuid, p_include_finished boolean DEFAULT false", returns: "TABLE(record_id uuid, title text, assignee_id uuid, turn text, due_on timestamp with time zone, state text, status text, terminal boolean)", security: "definer" }
478
521
  ];
479
522
  var STORE_KNOBS = [
480
523
  { key: "accessible_entity_ids_guard", value: "true", type: "boolean" },
@@ -514,16 +557,17 @@ var STORE_KNOBS = [
514
557
  { key: "world_publish_enabled", value: "false", type: "boolean" }
515
558
  ];
516
559
  var STORE_REFUSAL_CODES = [
517
- { code: "02000", 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" },
518
- { code: "0A000", 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" },
519
- { code: "22004", 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" },
560
+ { code: "02000", 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" },
561
+ { code: "0A000", 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" },
562
+ { code: "22004", 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" },
520
563
  { code: "22012", raised_by: "rule_eval" },
521
- { code: "22023", 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" },
522
- { code: "23503", 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" },
523
- { code: "23505", 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" },
524
- { code: "23514", 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" },
564
+ { code: "22023", 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" },
565
+ { code: "23503", 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" },
566
+ { code: "23505", 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" },
567
+ { code: "23514", 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" },
525
568
  { code: "40001", raised_by: "has_visibility_at" },
526
- { code: "42501", 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" },
569
+ { code: "42501", 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" },
570
+ { code: "42703", raised_by: "entity_table" },
527
571
  { code: "53400", raised_by: "anon_rate_take,delete_cascade_closure,promote_field" },
528
572
  { code: "54001", raised_by: "record_delete" },
529
573
  { code: "PT409", raised_by: "record_update" }
@@ -1633,6 +1677,24 @@ var DOORS = {
1633
1677
  fieldDeclare: "field_declare",
1634
1678
  fieldUpdate: "field_update",
1635
1679
  fieldRetire: "field_retire",
1680
+ // CUSTOM FIELDS ON A STANDARD BUSINESS TABLE. Every door above is keyed by a
1681
+ // custom Table's uuid, and a standard table has no Table record - so until
1682
+ // 2026-09-20 `custom.applicable_fields(org, 'party', null)` answered `22P02
1683
+ // invalid input syntax for uuid` and there was no other way in. These are
1684
+ // keyed by the REGISTRY TOKEN instead, and they are one set for all 643
1685
+ // tables the registry types Entity or Detail. The three value doors are
1686
+ // SECURITY INVOKER in the database on purpose: the standard table's own
1687
+ // row-level security is what decides who may read and write its rows, and a
1688
+ // definer wrapper would replace it with a second access system.
1689
+ entityTable: "entity_table",
1690
+ entityFields: "entity_fields",
1691
+ entityFieldDeclare: "entity_field_declare",
1692
+ entityFieldUpdate: "entity_field_update",
1693
+ entityFieldRetire: "entity_field_retire",
1694
+ entityFieldRights: "entity_field_rights",
1695
+ entityRecordRead: "entity_record_read",
1696
+ entityValueWrite: "entity_value_write",
1697
+ entityRecordsFind: "entity_records_find",
1636
1698
  tableCapacity: "table_capacity",
1637
1699
  tableStorage: "table_storage",
1638
1700
  promoteTable: "promote_table",
@@ -1670,6 +1732,17 @@ var DOORS = {
1670
1732
  ruleMembership: "rule_membership",
1671
1733
  ruleRun: "rule_run",
1672
1734
  ruleEval: "rule_eval",
1735
+ // REC-15: the door that makes a Rule a RULE. `custom.record_write` into the
1736
+ // Rule kernel produces a valid Rule document carrying `data_class = 'record'`,
1737
+ // and every reader that goes LOOKING for a Rule looks for the class — so a
1738
+ // subscription written that way was invisible to DOOR-18 and nothing fired.
1739
+ // PRODUCTS row 1 — a form is a view on a real Table. `forms` lists an
1740
+ // organization's own, `formDeclare` writes one, and `anonPublish` is the one
1741
+ // act that opens it to people with no account. The PUBLIC pair
1742
+ // (`custom.form_public`, `custom.form_submit`) is deliberately absent: those
1743
+ // are server-lane doors and a browser never calls them.
1744
+ forms: "forms",
1745
+ formDeclare: "form_declare",
1673
1746
  // The eighth verb (AGT-N-8): a grouped, bucketed, filtered count/sum/avg/
1674
1747
  // min/max computed INSIDE the read door's own query, so a chart shows exactly
1675
1748
  // the rows this person may see and never fetches the ones they may not.
@@ -1728,6 +1801,23 @@ var DOORS = {
1728
1801
  workSlotRelease: "work_slot_release",
1729
1802
  workSlotHolds: "work_slot_holds",
1730
1803
  workSlotExpire: "work_slot_expire",
1804
+ // THE WORK LAYER'S OWN DOORS (lane WORK-DOORS, 2026-09-20). Until this lane
1805
+ // all nineteen `custom.work_*` functions were SECURITY INVOKER with no client
1806
+ // grant: REC-69, REC-70 and REC-71 were live in the store and unreachable
1807
+ // from a browser. These are the verbs a person actually uses.
1808
+ workPerson: "work_person",
1809
+ workAssign: "work_assign",
1810
+ workRecordStates: "work_record_states",
1811
+ workSetState: "work_set_state",
1812
+ workList: "work_list",
1813
+ workTemplates: "work_templates",
1814
+ /** THE ONE QUEUE: assignments, approvals and the agent's proposals together. */
1815
+ workInbox: "work_inbox",
1816
+ workApprovalApprovers: "work_approval_approvers",
1817
+ workApprovalRequest: "work_approval_request",
1818
+ workApprovalMayDecide: "work_approval_may_decide",
1819
+ workApprovalDecide: "work_approval_decide",
1820
+ workApprovalRead: "work_approval_read",
1731
1821
  // Declared here BECAUSE they do not exist yet: naming them is what makes the
1732
1822
  // absence visible to `pnpm check:store-registry` and to the suite.
1733
1823
  metadataSearch: "metadata_search",
@@ -1751,6 +1841,14 @@ var BY_SQLSTATE = {
1751
1841
  // is wrong for the shape the store holds, which is what `invalid_argument`
1752
1842
  // already means — the store's own sentence names the value and the type.
1753
1843
  "22P02": "invalid_argument",
1844
+ // 42703 — a column that is not there. The store raises it from
1845
+ // `custom.entity_table`, which is asked for a column by NAME, so the class is
1846
+ // exactly "the call named something the shape does not have": the same thing
1847
+ // `invalid_argument` already means, and the store's own sentence names the
1848
+ // column. Added 2026-09-20 (lane FORMS) because the package's live-door suite
1849
+ // caught it raised by a door this package did not know about — which is the
1850
+ // suite working, and is why the map is a census rather than a guess.
1851
+ "42703": "invalid_argument",
1754
1852
  "02000": "not_found",
1755
1853
  "23503": "missing_reference",
1756
1854
  "23505": "already_exists",
@@ -2145,6 +2243,88 @@ function createRecordsClient(config) {
2145
2243
  "fieldDeclare"
2146
2244
  );
2147
2245
  },
2246
+ async entityTable({ token }) {
2247
+ const answer = await callDoor(
2248
+ DOORS.entityTable,
2249
+ { p_token: token },
2250
+ "entityTable"
2251
+ );
2252
+ if (!answer.ok) return err(answer.error);
2253
+ const row = Array.isArray(answer.data) ? answer.data[0] : answer.data;
2254
+ if (!row) {
2255
+ return err({
2256
+ code: "not_found",
2257
+ message: `The registry answered nothing for the table "${token}".`,
2258
+ hint: "REC-33: a standard table is named by its registry token. Nothing was read."
2259
+ });
2260
+ }
2261
+ return ok(row);
2262
+ },
2263
+ async entityFields({ token }) {
2264
+ const rows = await callDoor(
2265
+ DOORS.entityFields,
2266
+ { p_organization_id: org, p_token: token },
2267
+ "entityFields"
2268
+ );
2269
+ if (!rows.ok) return err(rows.error);
2270
+ return ok((rows.data ?? []).map((row) => ({ id: row.id, ...row.data })));
2271
+ },
2272
+ async entityFieldDeclare({ token, spec }) {
2273
+ return callDoor(
2274
+ DOORS.entityFieldDeclare,
2275
+ { p_organization_id: org, p_token: token, p_spec: spec },
2276
+ "entityFieldDeclare"
2277
+ );
2278
+ },
2279
+ async entityFieldUpdate({ field_id, patch }) {
2280
+ return callDoor(
2281
+ DOORS.entityFieldUpdate,
2282
+ { p_organization_id: org, p_field_id: field_id, p_patch: patch },
2283
+ "entityFieldUpdate"
2284
+ );
2285
+ },
2286
+ async entityFieldRetire({ field_id }) {
2287
+ return callDoor(
2288
+ DOORS.entityFieldRetire,
2289
+ { p_organization_id: org, p_field_id: field_id },
2290
+ "entityFieldRetire"
2291
+ );
2292
+ },
2293
+ async entityFieldRights({ token }) {
2294
+ return callDoor(
2295
+ DOORS.entityFieldRights,
2296
+ { p_organization_id: org, p_token: token },
2297
+ "entityFieldRights"
2298
+ );
2299
+ },
2300
+ async entityRecordRead({ token, record_id }) {
2301
+ return callDoor(
2302
+ DOORS.entityRecordRead,
2303
+ { p_organization_id: org, p_token: token, p_record_id: record_id },
2304
+ "entityRecordRead"
2305
+ );
2306
+ },
2307
+ async entityValueWrite({ token, record_id, patch }) {
2308
+ return callDoor(
2309
+ DOORS.entityValueWrite,
2310
+ { p_organization_id: org, p_token: token, p_record_id: record_id, p_patch: patch },
2311
+ "entityValueWrite"
2312
+ );
2313
+ },
2314
+ async entityRecordsFind({ token, key, value, limit, offset }) {
2315
+ return callDoor(
2316
+ DOORS.entityRecordsFind,
2317
+ {
2318
+ p_organization_id: org,
2319
+ p_token: token,
2320
+ p_key: key,
2321
+ p_value: value === void 0 ? null : value,
2322
+ ...limit === void 0 ? {} : { p_limit: limit },
2323
+ ...offset === void 0 ? {} : { p_offset: offset }
2324
+ },
2325
+ "entityRecordsFind"
2326
+ );
2327
+ },
2148
2328
  async fieldUpdate({ field_id, patch }) {
2149
2329
  return callDoor(
2150
2330
  DOORS.fieldUpdate,
@@ -2189,6 +2369,31 @@ function createRecordsClient(config) {
2189
2369
  "ruleMembership"
2190
2370
  );
2191
2371
  },
2372
+ async forms(args) {
2373
+ return callDoor(
2374
+ DOORS.forms,
2375
+ { p_organization_id: org, p_table_id: args?.table_id ?? null },
2376
+ "forms"
2377
+ );
2378
+ },
2379
+ async formDeclare(args) {
2380
+ return callDoor(
2381
+ DOORS.formDeclare,
2382
+ {
2383
+ p_organization_id: org,
2384
+ p_table_id: args.table_id,
2385
+ p_title: args.title,
2386
+ p_questions: args.questions,
2387
+ p_presentation: args.presentation ?? {},
2388
+ p_submission_cap: args.submission_cap ?? null,
2389
+ p_quarantine_rule_id: args.quarantine_rule_id ?? null,
2390
+ p_notify_rule_id: args.notify_rule_id ?? null,
2391
+ p_form_id: args.form_id ?? null,
2392
+ p_slug: args.slug ?? null
2393
+ },
2394
+ "formDeclare"
2395
+ );
2396
+ },
2192
2397
  async ruleRun({ rule_id, values, context }) {
2193
2398
  return callDoor(
2194
2399
  DOORS.ruleRun,
@@ -2537,6 +2742,128 @@ function createRecordsClient(config) {
2537
2742
  "workSlotExpire"
2538
2743
  );
2539
2744
  },
2745
+ // ── the work layer a person actually uses ────────────────────────────
2746
+ async workInbox(args) {
2747
+ return callDoor(
2748
+ DOORS.workInbox,
2749
+ {
2750
+ p_organization_id: org,
2751
+ p_limit: args?.limit ?? 50,
2752
+ p_offset: args?.offset ?? 0,
2753
+ p_include_decided: args?.includeDecided ?? false
2754
+ },
2755
+ "workInbox"
2756
+ );
2757
+ },
2758
+ async workList(args) {
2759
+ return callDoor(
2760
+ DOORS.workList,
2761
+ {
2762
+ p_organization_id: org,
2763
+ p_flavour: args?.flavour ?? "mine",
2764
+ p_include_finished: args?.includeFinished ?? false,
2765
+ p_limit: args?.limit ?? 100,
2766
+ p_offset: args?.offset ?? 0
2767
+ },
2768
+ "workList"
2769
+ );
2770
+ },
2771
+ async workAssign({ record_id, user_id = null, dueDate = null, clearDue = false }) {
2772
+ return callDoor(
2773
+ DOORS.workAssign,
2774
+ {
2775
+ p_organization_id: org,
2776
+ p_record_id: record_id,
2777
+ p_assignee_user_id: user_id,
2778
+ p_due_date: dueDate,
2779
+ p_clear_due: clearDue
2780
+ },
2781
+ "workAssign"
2782
+ );
2783
+ },
2784
+ async workRecordStates({ record_id }) {
2785
+ return callDoor(
2786
+ DOORS.workRecordStates,
2787
+ { p_organization_id: org, p_record_id: record_id },
2788
+ "workRecordStates"
2789
+ );
2790
+ },
2791
+ async workSetState({ record_id, state_id }) {
2792
+ return callDoor(
2793
+ DOORS.workSetState,
2794
+ { p_organization_id: org, p_record_id: record_id, p_state_id: state_id },
2795
+ "workSetState"
2796
+ );
2797
+ },
2798
+ async workPerson({ user_id, create = true }) {
2799
+ return callDoor(
2800
+ DOORS.workPerson,
2801
+ { p_organization_id: org, p_user_id: user_id, p_create: create },
2802
+ "workPerson"
2803
+ );
2804
+ },
2805
+ async workTemplates(args) {
2806
+ return callDoor(
2807
+ DOORS.workTemplates,
2808
+ { p_organization_id: org, p_limit: args?.limit ?? 100 },
2809
+ "workTemplates"
2810
+ );
2811
+ },
2812
+ async workApprovalApprovers({ subject_id, approver_id = null }) {
2813
+ return callDoor(
2814
+ DOORS.workApprovalApprovers,
2815
+ { p_organization_id: org, p_subject_id: subject_id, p_approver_id: approver_id },
2816
+ "workApprovalApprovers"
2817
+ );
2818
+ },
2819
+ async workApprovalRequest({
2820
+ subject_id,
2821
+ change,
2822
+ note = null,
2823
+ approver_id = null,
2824
+ origin = "person",
2825
+ conversation_id = null
2826
+ }) {
2827
+ return callDoor(
2828
+ DOORS.workApprovalRequest,
2829
+ {
2830
+ p_organization_id: org,
2831
+ p_subject_id: subject_id,
2832
+ p_change: change,
2833
+ p_note: note,
2834
+ p_approver_id: approver_id,
2835
+ p_origin: origin,
2836
+ p_conversation_id: conversation_id
2837
+ },
2838
+ "workApprovalRequest"
2839
+ );
2840
+ },
2841
+ async workApprovalMayDecide({ approval_id }) {
2842
+ return callDoor(
2843
+ DOORS.workApprovalMayDecide,
2844
+ { p_organization_id: org, p_approval_id: approval_id },
2845
+ "workApprovalMayDecide"
2846
+ );
2847
+ },
2848
+ async workApprovalDecide({ approval_id, approve, note = null }) {
2849
+ return callDoor(
2850
+ DOORS.workApprovalDecide,
2851
+ {
2852
+ p_organization_id: org,
2853
+ p_approval_id: approval_id,
2854
+ p_approve: approve,
2855
+ p_note: note
2856
+ },
2857
+ "workApprovalDecide"
2858
+ );
2859
+ },
2860
+ async workApprovalRead({ approval_id }) {
2861
+ return callDoor(
2862
+ DOORS.workApprovalRead,
2863
+ { p_organization_id: org, p_approval_id: approval_id },
2864
+ "workApprovalRead"
2865
+ );
2866
+ },
2540
2867
  // ── the trust doors ──────────────────────────────────────────────────
2541
2868
  async isExternalPrincipal(args) {
2542
2869
  return trustDoor(
@@ -2597,10 +2924,12 @@ function createRecordsClient(config) {
2597
2924
  "publishToWorld"
2598
2925
  );
2599
2926
  },
2600
- async ruleDeclare() {
2601
- const refusal = doorAbsent(DOORS.ruleDeclare);
2602
- scream({ code: refusal.code, message: refusal.message, ...refusal.hint ? { hint: refusal.hint } : {}, where: "ruleDeclare" });
2603
- return err(refusal);
2927
+ async ruleDeclare({ spec, rule_id }) {
2928
+ return callDoor(
2929
+ DOORS.ruleDeclare,
2930
+ { p_organization_id: org, p_spec: spec, p_rule_id: rule_id ?? null },
2931
+ "ruleDeclare"
2932
+ );
2604
2933
  },
2605
2934
  async metadataSearch() {
2606
2935
  const refusal = doorAbsent(DOORS.metadataSearch);
@@ -2690,6 +3019,9 @@ function useRecordsClient() {
2690
3019
  }
2691
3020
  return client;
2692
3021
  }
3022
+ function useOptionalRecordsClient() {
3023
+ return (0, import_react.useContext)(RecordsContext);
3024
+ }
2693
3025
  function useRecordsActor() {
2694
3026
  return useRecordsClient().config.actor;
2695
3027
  }
@@ -2858,6 +3190,72 @@ function useRecordMutation() {
2858
3190
  [client, run, saving, error, conflict]
2859
3191
  );
2860
3192
  }
3193
+ function useEntityFields(token) {
3194
+ return useAsync(
3195
+ (client) => token ? client.entityFields({ token }) : Promise.resolve({ ok: true, data: [] }),
3196
+ [token]
3197
+ );
3198
+ }
3199
+ function useEntityRecord(token, recordId) {
3200
+ return useAsync(
3201
+ (client) => token && recordId ? client.entityRecordRead({ token, record_id: recordId }) : Promise.resolve({ ok: true, data: null }),
3202
+ [token, recordId]
3203
+ );
3204
+ }
3205
+ function useEntityTable(token) {
3206
+ return useAsync(
3207
+ (client) => token ? client.entityTable({ token }) : Promise.resolve({ ok: true, data: null }),
3208
+ [token]
3209
+ );
3210
+ }
3211
+ function useEntityFieldRights(token) {
3212
+ return useAsync(
3213
+ (client) => token ? client.entityFieldRights({ token }) : Promise.resolve({ ok: true, data: null }),
3214
+ [token]
3215
+ );
3216
+ }
3217
+ function useEntityFieldMutation() {
3218
+ const client = useRecordsClient();
3219
+ const [saving, setSaving] = (0, import_react2.useState)(false);
3220
+ const [error, setError] = (0, import_react2.useState)(null);
3221
+ const run = (0, import_react2.useCallback)(
3222
+ async (call, whenRefused) => {
3223
+ setSaving(true);
3224
+ setError(null);
3225
+ try {
3226
+ const result = await call();
3227
+ if (result.ok) return result.data;
3228
+ setError(result.error);
3229
+ return whenRefused;
3230
+ } finally {
3231
+ setSaving(false);
3232
+ }
3233
+ },
3234
+ []
3235
+ );
3236
+ return (0, import_react2.useMemo)(
3237
+ () => ({
3238
+ declare: (args) => run(() => client.entityFieldDeclare({ token: args.token, spec: args.spec }), null),
3239
+ update: (args) => run(
3240
+ () => client.entityFieldUpdate({ field_id: args.field_id, patch: args.patch }),
3241
+ null
3242
+ ),
3243
+ retire: (args) => run(() => client.entityFieldRetire({ field_id: args.field_id }), null),
3244
+ write: (args) => run(
3245
+ () => client.entityValueWrite({
3246
+ token: args.token,
3247
+ record_id: args.record_id,
3248
+ patch: args.patch
3249
+ }),
3250
+ null
3251
+ ),
3252
+ saving,
3253
+ error,
3254
+ clearError: () => setError(null)
3255
+ }),
3256
+ [client, run, saving, error]
3257
+ );
3258
+ }
2861
3259
  function useFieldMutation() {
2862
3260
  const client = useRecordsClient();
2863
3261
  const [saving, setSaving] = (0, import_react2.useState)(false);
@@ -2986,6 +3384,11 @@ var OVERRIDE_POLICIES = [
2986
3384
  var FRESHNESS = ["live", "cached", "snapshot"];
2987
3385
  var TABLE_DISPLAYS = ["list", "grid", "board", "calendar", "timeline"];
2988
3386
 
3387
+ // src/rule.ts
3388
+ function publicFormPath(formId) {
3389
+ return `/f/${formId}`;
3390
+ }
3391
+
2989
3392
  // src/aggregate.ts
2990
3393
  function measureKey(measure) {
2991
3394
  return measure.op === "count" ? "count" : `${measure.op}_${measure.key ?? ""}`;