@ai-matrx/records 0.8.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +163 -0
- package/dist/core/index.cjs +524 -13
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +280 -5
- package/dist/core/index.d.ts +280 -5
- package/dist/core/index.js +524 -13
- package/dist/core/index.js.map +1 -1
- package/dist/index.cjs +116 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +845 -10
- package/dist/index.d.ts +845 -10
- package/dist/index.js +116 -8
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +592 -10
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +1138 -12
- package/dist/react/index.d.ts +1138 -12
- package/dist/react/index.js +592 -10
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/react/index.cjs
CHANGED
|
@@ -58,12 +58,26 @@ __export(react_exports, {
|
|
|
58
58
|
VALUE_ENVELOPE_KEYS: () => VALUE_ENVELOPE_KEYS,
|
|
59
59
|
asPermissionLevel: () => asPermissionLevel,
|
|
60
60
|
atLeast: () => atLeast,
|
|
61
|
+
choiceSlug: () => choiceSlug,
|
|
62
|
+
choiceValuesOf: () => choiceValuesOf,
|
|
63
|
+
choicesOf: () => choicesOf,
|
|
61
64
|
err: () => err,
|
|
62
65
|
highestLevel: () => highestLevel,
|
|
66
|
+
holdsARetiredChoice: () => holdsARetiredChoice,
|
|
63
67
|
isRecordsErr: () => isRecordsErr,
|
|
68
|
+
isTheChosen: () => isTheChosen,
|
|
69
|
+
looksLikeAnId: () => looksLikeAnId,
|
|
64
70
|
measureKey: () => measureKey,
|
|
65
71
|
ok: () => ok,
|
|
72
|
+
optionKey: () => optionKey,
|
|
73
|
+
optionLabel: () => optionLabel,
|
|
74
|
+
portalPath: () => portalPath,
|
|
66
75
|
publicFormPath: () => publicFormPath,
|
|
76
|
+
useEntityFieldMutation: () => useEntityFieldMutation,
|
|
77
|
+
useEntityFieldRights: () => useEntityFieldRights,
|
|
78
|
+
useEntityFields: () => useEntityFields,
|
|
79
|
+
useEntityRecord: () => useEntityRecord,
|
|
80
|
+
useEntityTable: () => useEntityTable,
|
|
67
81
|
useFieldMutation: () => useFieldMutation,
|
|
68
82
|
useFields: () => useFields,
|
|
69
83
|
useMergeField: () => useMergeField,
|
|
@@ -219,6 +233,20 @@ var STORE_DOORS = [
|
|
|
219
233
|
{ name: "caller_role", args: "", returns: "name", security: "invoker" },
|
|
220
234
|
{ name: "carrying_edges_in", args: "p_organization_id uuid", returns: "TABLE(container_type text, container_id uuid, item_type text, item_id uuid, conveys_max permission_level)", security: "definer" },
|
|
221
235
|
{ name: "carrying_edges_of", args: "p_item_type text, p_item_id uuid", returns: "TABLE(container_type text, container_id uuid, conveys_max permission_level)", security: "definer" },
|
|
236
|
+
{ name: "choice_census", args: "p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid", returns: "jsonb", security: "definer" },
|
|
237
|
+
{ name: "choice_field_map", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "invoker" },
|
|
238
|
+
{ name: "choice_filter_normalize", args: "p_map jsonb, p_filter jsonb", returns: "jsonb", security: "invoker" },
|
|
239
|
+
{ name: "choice_key_for", args: "p_organization_id uuid, p_options_table_id uuid, p_title text, p_exclude uuid DEFAULT NULL::uuid", returns: "text", security: "invoker" },
|
|
240
|
+
{ name: "choice_key_of", args: "p_field jsonb, p_token text", returns: "text", security: "invoker" },
|
|
241
|
+
{ name: "choice_options", args: "p_organization_id uuid, p_options_table_id uuid", returns: "jsonb", security: "invoker" },
|
|
242
|
+
{ name: "choice_render", args: "p_organization_id uuid, p_table_id uuid, p_doc jsonb", returns: "jsonb", security: "invoker" },
|
|
243
|
+
{ name: "choice_render_groups", args: "p_map jsonb, p_groups jsonb", returns: "jsonb", security: "invoker" },
|
|
244
|
+
{ name: "choice_render_note", args: "p_field jsonb, p_value jsonb", returns: "jsonb", security: "invoker" },
|
|
245
|
+
{ name: "choice_render_value", args: "p_field jsonb, p_value jsonb", returns: "jsonb", security: "invoker" },
|
|
246
|
+
{ name: "choice_slug", args: "p_word text", returns: "text", security: "invoker" },
|
|
247
|
+
{ name: "choice_synonyms", args: "p_organization_id uuid, p_table_id uuid, p_token text", returns: "text[]", security: "invoker" },
|
|
248
|
+
{ name: "choice_synonyms_in", args: "p_map jsonb, p_token text", returns: "text[]", security: "invoker" },
|
|
249
|
+
{ name: "choice_words", args: "p_field jsonb", returns: "text", security: "invoker" },
|
|
222
250
|
{ name: "client_write_grants", args: "", returns: "TABLE(role_name text, object_name text, privilege text)", security: "invoker" },
|
|
223
251
|
{ name: "computed_provenance", args: "p_organization_id uuid, p_record_id uuid", returns: "TABLE(field_key text, field_id uuid, value jsonb, rule_id uuid, rule_version integer, computed_at timestamp with time zone)", security: "invoker" },
|
|
224
252
|
{ name: "containment_chain", args: "p_organization_id uuid, p_record_id uuid", returns: "TABLE(ancestor_id uuid, depth integer)", security: "invoker" },
|
|
@@ -227,6 +255,17 @@ var STORE_DOORS = [
|
|
|
227
255
|
{ name: "containment_parent", args: "p_data jsonb", returns: "uuid", security: "invoker" },
|
|
228
256
|
{ name: "cross_organization_links_open", args: "p_source_organization_id uuid, p_target_organization_id uuid", returns: "boolean", security: "invoker" },
|
|
229
257
|
{ name: "custom_fields_tables", args: "", returns: "TABLE(token text, schema_name text, table_name text)", security: "invoker" },
|
|
258
|
+
{ name: "dashboard_block_normalize", args: "p_organization_id uuid, p_subject_table_id uuid, p_block jsonb", returns: "jsonb", security: "definer" },
|
|
259
|
+
{ name: "dashboard_class", args: "", returns: "text", security: "invoker" },
|
|
260
|
+
{ name: "dashboard_declare", args: "p_organization_id uuid, p_table_id uuid, p_name text, p_blocks jsonb DEFAULT '[]'::jsonb, p_presentation jsonb DEFAULT '{}'::jsonb, p_dashboard_id uuid DEFAULT NULL::uuid", returns: "uuid", security: "definer" },
|
|
261
|
+
{ name: "dashboard_delete", args: "p_organization_id uuid, p_dashboard_id uuid", returns: "boolean", security: "definer" },
|
|
262
|
+
{ name: "dashboard_field_keys", args: "p_organization_id uuid, p_table_id uuid", returns: "text[]", security: "definer" },
|
|
263
|
+
{ name: "dashboard_kinds", args: "", returns: "text[]", security: "invoker" },
|
|
264
|
+
{ name: "dashboard_moment_sql", args: "p_key text", returns: "text", security: "invoker" },
|
|
265
|
+
{ name: "dashboard_run", args: "p_organization_id uuid, p_dashboard_id uuid, p_filter jsonb DEFAULT '{}'::jsonb", returns: "jsonb", security: "definer" },
|
|
266
|
+
{ name: "dashboard_stuck", args: "p_organization_id uuid, p_table_id uuid, p_state_key text, p_days integer DEFAULT 14, p_filter jsonb DEFAULT '{}'::jsonb, p_limit integer DEFAULT 50, p_required text DEFAULT 'viewer'::text", returns: "TABLE(record_id uuid, title text, state text, last_changed_at timestamp with time zone, days_unchanged numeric, measured_from text)", security: "definer" },
|
|
267
|
+
{ name: "dashboard_window_sql", args: "p_key text, p_window jsonb", returns: "text", security: "invoker" },
|
|
268
|
+
{ name: "dashboards", args: "p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid", returns: "TABLE(dashboard_id uuid, table_id uuid, name text, blocks jsonb, presentation jsonb, block_count integer, version integer, created_at timestamp with time zone, updated_at timestamp with time zone)", security: "definer" },
|
|
230
269
|
{ name: "delete_cascade_closure", args: "p_organization_id uuid, p_record_id uuid", returns: "uuid[]", security: "invoker" },
|
|
231
270
|
{ name: "delete_preview", args: "p_organization_id uuid, p_record_id uuid", returns: "jsonb", security: "definer" },
|
|
232
271
|
{ name: "delete_rule", args: "p_organization_id uuid, p_record_id uuid, p_apply boolean DEFAULT true", returns: "jsonb", security: "definer" },
|
|
@@ -323,16 +362,20 @@ var STORE_DOORS = [
|
|
|
323
362
|
{ name: "io_restore", args: "p_organization_id uuid, p_record_id uuid, p_version integer", returns: "integer", security: "definer" },
|
|
324
363
|
{ name: "io_revisions", args: "p_organization_id uuid, p_record_id uuid", returns: "TABLE(version integer, changed_at timestamp with time zone, changed_by uuid, summary text, operation text, changed_fields jsonb)", security: "definer" },
|
|
325
364
|
{ name: "is_a_retirement", args: "p_old_deleted timestamp with time zone, p_new_deleted timestamp with time zone, p_old_data jsonb, p_new_data jsonb, p_old_table uuid, p_new_table uuid, p_old_org uuid, p_new_org uuid, p_old_class text, p_new_class text", returns: "boolean", security: "invoker" },
|
|
365
|
+
{ name: "list_door_disagreements", args: "p_pretend text DEFAULT NULL::text, p_only_organization uuid DEFAULT NULL::uuid, p_sample integer DEFAULT 200", returns: "TABLE(organization_id uuid, organization_name text, member_id uuid, table_id uuid, record_id uuid, door text, why text)", security: "invoker" },
|
|
366
|
+
{ name: "list_door_disagreements", args: "p_pretend text, p_only_organization uuid, p_sample integer, p_exhaustive boolean", returns: "TABLE(organization_id uuid, organization_name text, member_id uuid, table_id uuid, record_id uuid, door text, why text)", security: "invoker" },
|
|
326
367
|
{ name: "lookup_value", args: "p_organization_id uuid, p_record_id uuid, p_field_data jsonb", returns: "jsonb", security: "invoker" },
|
|
327
368
|
{ name: "mask_document", args: "p_document jsonb, p_visible_keys text[], p_notices jsonb, p_by_id boolean DEFAULT false, p_key_ids jsonb DEFAULT '{}'::jsonb", returns: "jsonb", security: "invoker" },
|
|
328
369
|
{ name: "mask_document", args: "p_document jsonb, p_visible_keys text[], p_notices jsonb, p_by_id boolean DEFAULT false, p_key_ids jsonb DEFAULT '{}'::jsonb, p_declared_keys text[] DEFAULT NULL::text[]", returns: "jsonb", security: "invoker" },
|
|
329
370
|
{ name: "merge_field_kernel_id", args: "", returns: "uuid", security: "invoker" },
|
|
371
|
+
{ name: "migrate_choice_keys", args: "p_organization_id uuid, p_table_id uuid, p_dry_run boolean DEFAULT false", returns: "jsonb", security: "definer" },
|
|
330
372
|
{ name: "migrate_delete", args: "p_organization_id uuid, p_record_id uuid, p_note text DEFAULT NULL::text", returns: "jsonb", security: "definer" },
|
|
331
373
|
{ name: "migrate_demote", args: "p_organization_id uuid, p_table_id uuid, p_note text DEFAULT NULL::text", returns: "jsonb", security: "definer" },
|
|
332
374
|
{ name: "migrate_extract_parent", args: "p_organization_id uuid, p_id uuid, p_parent_table_id uuid, p_moved_keys text[], p_note text DEFAULT NULL::text", returns: "jsonb", security: "definer" },
|
|
333
375
|
{ 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" },
|
|
334
376
|
{ name: "migrate_promote", args: "p_organization_id uuid, p_table_id uuid, p_note text DEFAULT NULL::text", returns: "jsonb", security: "definer" },
|
|
335
377
|
{ 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" },
|
|
378
|
+
{ 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" },
|
|
336
379
|
{ name: "migrate_rename", args: "p_organization_id uuid, p_id uuid, p_to text, p_note text DEFAULT NULL::text", returns: "jsonb", security: "definer" },
|
|
337
380
|
{ 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" },
|
|
338
381
|
{ name: "migrate_retype", args: "p_organization_id uuid, p_id uuid, p_to text, p_note text DEFAULT NULL::text", returns: "jsonb", security: "definer" },
|
|
@@ -352,6 +395,20 @@ var STORE_DOORS = [
|
|
|
352
395
|
{ name: "parity_values", args: "p_organization_id uuid, p_record_id uuid", returns: "TABLE(field_key text, field_id uuid, parity_type text, behavior text, unit text, format text, value jsonb, value_version integer, actor text, written_at timestamp with time zone)", security: "invoker" },
|
|
353
396
|
{ name: "per_value_access_words", args: "", returns: "text[]", security: "invoker" },
|
|
354
397
|
{ name: "person_kernel_id", args: "", returns: "uuid", security: "invoker" },
|
|
398
|
+
{ name: "portal_admits", args: "p_organization_id uuid, p_user_id uuid DEFAULT NULL::uuid", returns: "boolean", security: "definer" },
|
|
399
|
+
{ name: "portal_card", args: "p_organization_id uuid, p_portal_id uuid", returns: "jsonb", security: "definer" },
|
|
400
|
+
{ name: "portal_declare", args: "p_organization_id uuid, p_title text, p_client_table_id uuid, p_tables jsonb, p_portal_id uuid DEFAULT NULL::uuid, p_slug text DEFAULT NULL::text, p_sign_in_method text DEFAULT 'magic_link'::text", returns: "uuid", security: "definer" },
|
|
401
|
+
{ name: "portal_field_map", args: "p_organization_id uuid, p_table_id uuid", returns: "TABLE(field_id uuid, field_key text, field_type text, points_at uuid)", security: "definer" },
|
|
402
|
+
{ name: "portal_invitation", args: "p_slug text, p_email text", returns: "jsonb", security: "definer" },
|
|
403
|
+
{ name: "portal_invite", args: "p_organization_id uuid, p_portal_id uuid, p_client_record_id uuid, p_email text, p_user_id uuid DEFAULT NULL::uuid", returns: "jsonb", security: "definer" },
|
|
404
|
+
{ name: "portal_me", args: "", returns: "jsonb", security: "definer" },
|
|
405
|
+
{ name: "portal_preview", args: "p_organization_id uuid, p_portal_id uuid, p_principal_id uuid, p_table_id uuid", returns: "TABLE(record_id uuid, title text)", security: "definer" },
|
|
406
|
+
{ name: "portal_principal_bind", args: "p_organization_id uuid, p_principal_id uuid, p_user_id uuid", returns: "jsonb", security: "definer" },
|
|
407
|
+
{ name: "portal_public", args: "p_slug text", returns: "jsonb", security: "definer" },
|
|
408
|
+
{ name: "portal_record_title", args: "p_organization_id uuid, p_record_id uuid", returns: "text", security: "definer" },
|
|
409
|
+
{ name: "portal_revoke", args: "p_organization_id uuid, p_portal_id uuid, p_principal_id uuid", returns: "jsonb", security: "definer" },
|
|
410
|
+
{ name: "portal_slug", args: "p_organization_id uuid, p_title text, p_portal_id uuid DEFAULT NULL::uuid", returns: "text", security: "definer" },
|
|
411
|
+
{ name: "portals", args: "p_organization_id uuid", returns: "TABLE(portal_id uuid, title text, slug text, client_table_id uuid, client_table text, is_active boolean, tables integer, invited integer, signed_in integer, sign_in_method text, opened_at timestamp with time zone)", security: "definer" },
|
|
355
412
|
{ name: "presentation_kernel_id", args: "", returns: "uuid", security: "invoker" },
|
|
356
413
|
{ name: "promote_field", args: "p_organization_id uuid, p_table_id uuid, p_field_id uuid", returns: "jsonb", security: "invoker" },
|
|
357
414
|
{ name: "promote_table", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "definer" },
|
|
@@ -402,10 +459,12 @@ var STORE_DOORS = [
|
|
|
402
459
|
{ name: "record_resolve", args: "p_organization_id uuid, p_id uuid", returns: "jsonb", security: "definer" },
|
|
403
460
|
{ name: "record_restore", args: "p_organization_id uuid, p_record_id uuid", returns: "void", security: "definer" },
|
|
404
461
|
{ name: "record_state_as_of", args: "p_record_id uuid, p_at timestamp with time zone", returns: "TABLE(state jsonb, replayed boolean)", security: "definer" },
|
|
462
|
+
{ name: "record_table", args: "p_organization_id uuid, p_record_id uuid", returns: "uuid", security: "definer" },
|
|
405
463
|
{ name: "record_update", args: "p_organization_id uuid, p_record_id uuid, p_patch jsonb, p_expected_version integer DEFAULT NULL::integer", returns: "integer", security: "definer" },
|
|
406
464
|
{ name: "record_values", args: "p_organization_id uuid, p_record_id uuid", returns: "jsonb", security: "invoker" },
|
|
407
465
|
{ 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" },
|
|
408
466
|
{ name: "record_write", args: "p_organization_id uuid, p_table_id uuid, p_data jsonb", returns: "uuid", security: "definer" },
|
|
467
|
+
{ name: "refusals_claiming_a_level_never_asked", args: "", returns: "TABLE(function_name text, identity_args text, why text)", security: "invoker" },
|
|
409
468
|
{ name: "relation_carry", args: "p_organization_id uuid, p_container_id uuid, p_item_id uuid", returns: "uuid", security: "definer" },
|
|
410
469
|
{ name: "relation_edges_withdraw", args: "p_organization_id uuid, p_field_ids uuid[], p_why text", returns: "integer", security: "definer" },
|
|
411
470
|
{ name: "relation_own", args: "p_organization_id uuid, p_owner_id uuid, p_target_id uuid", returns: "uuid", security: "definer" },
|
|
@@ -451,7 +510,10 @@ var STORE_DOORS = [
|
|
|
451
510
|
{ name: "stamp_value_envelopes", args: "p_data jsonb, p_actor text, p_on_behalf_of text, p_at timestamp with time zone", returns: "jsonb", security: "invoker" },
|
|
452
511
|
{ name: "storage_modes", args: "", returns: "text[]", security: "invoker" },
|
|
453
512
|
{ name: "store_is_open", args: "p_organization_id uuid DEFAULT NULL::uuid", returns: "boolean", security: "invoker" },
|
|
513
|
+
{ name: "subscription_mute", args: "p_organization_id uuid, p_rule_id uuid, p_muted boolean DEFAULT true", returns: "boolean", security: "definer" },
|
|
514
|
+
{ name: "subscriptions", args: "p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid", returns: "TABLE(rule_id uuid, name text, table_id uuid, saved_view_id uuid, cadence text, schedule text, channel text, recipient_user_id uuid, event_key text, muted boolean, mine boolean, i_may_mute boolean)", security: "definer" },
|
|
454
515
|
{ name: "table_capacity", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "definer" },
|
|
516
|
+
{ name: "table_carries_its_rows", args: "p_user_id uuid, p_table_id uuid, p_required permission_level DEFAULT 'viewer'::permission_level", returns: "boolean", security: "definer" },
|
|
455
517
|
{ name: "table_contents", args: "p_organization_id uuid, p_table_id uuid", returns: "TABLE(record_id uuid, kind text, goes_at integer)", security: "invoker" },
|
|
456
518
|
{ name: "table_declare", args: "p_organization_id uuid, p_spec jsonb", returns: "uuid", security: "definer" },
|
|
457
519
|
{ name: "table_has_a_visible_record", args: "p_user uuid, p_organization_id uuid, p_table_id uuid", returns: "boolean", security: "definer" },
|
|
@@ -485,6 +547,7 @@ var STORE_DOORS = [
|
|
|
485
547
|
{ name: "widget_kernel_id", args: "", returns: "uuid", security: "invoker" },
|
|
486
548
|
{ 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" },
|
|
487
549
|
{ 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" },
|
|
550
|
+
{ name: "work_approval_kinds", args: "", returns: "text[]", security: "invoker" },
|
|
488
551
|
{ name: "work_approval_may_decide", args: "p_organization_id uuid, p_approval_id uuid", returns: "boolean", security: "definer" },
|
|
489
552
|
{ name: "work_approval_read", args: "p_organization_id uuid, p_approval_id uuid", returns: "jsonb", security: "definer" },
|
|
490
553
|
{ 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" },
|
|
@@ -504,6 +567,7 @@ var STORE_DOORS = [
|
|
|
504
567
|
{ name: "work_slot_index_name", args: "p_table_id uuid", returns: "text", security: "invoker" },
|
|
505
568
|
{ name: "work_slot_release", args: "p_organization_id uuid, p_hold_id uuid", returns: "boolean", security: "definer" },
|
|
506
569
|
{ 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" },
|
|
570
|
+
{ name: "work_state_id", args: "p_organization_id uuid, p_table_id uuid, p_value text", returns: "uuid", security: "invoker" },
|
|
507
571
|
{ name: "work_states", args: "", returns: "TABLE(sort integer, name text, terminal boolean, next text[])", security: "invoker" },
|
|
508
572
|
{ name: "work_take_assignment", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "definer" },
|
|
509
573
|
{ name: "work_template_declare", args: "p_organization_id uuid, p_name text, p_graph jsonb", returns: "uuid", security: "definer" },
|
|
@@ -552,17 +616,18 @@ var STORE_KNOBS = [
|
|
|
552
616
|
{ key: "world_publish_enabled", value: "false", type: "boolean" }
|
|
553
617
|
];
|
|
554
618
|
var STORE_REFUSAL_CODES = [
|
|
555
|
-
{ 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" },
|
|
556
|
-
{ 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
|
|
557
|
-
{ 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" },
|
|
619
|
+
{ code: "02000", 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" },
|
|
620
|
+
{ 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" },
|
|
621
|
+
{ 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,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" },
|
|
622
|
+
{ code: "22007", raised_by: "dashboard_window_sql" },
|
|
558
623
|
{ code: "22012", raised_by: "rule_eval" },
|
|
559
|
-
{ 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" },
|
|
560
|
-
{ 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" },
|
|
624
|
+
{ 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,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" },
|
|
625
|
+
{ 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,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" },
|
|
561
626
|
{ 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" },
|
|
562
|
-
{ 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" },
|
|
627
|
+
{ code: "23514", raised_by: "_containment_guard,_dated_values_guard,_derived_fields,_entity_custom_fields_guard,_field_class_guard,_field_document_for,_field_shape_guard,_field_type_parity_guard,_merge_field_shape_guard,_merge_field_temporal_guard,_promoted_field_cap_guard,_record_rule_uses,_resolve_choice_words,_rule_shape_guard,_rule_topology_guard,_store_relation_edge_names_its_field,_table_shape_guard,_value_envelope,_work_shape_guard,_workdoors_approval_guard,assert_entity_is_organization_scoped,doc_sign,doc_signature_write,doc_template_save,entity_field_declare,entity_field_retire,entity_field_update,entity_records_find,entity_table,field_declare,field_retire,field_update,home_add,migrate_merge,relation_carry,relation_own,validate_value_envelope,validate_values,work_set_state,work_slots_declare,work_take_assignment,work_template_instantiate" },
|
|
563
628
|
{ code: "40001", raised_by: "has_visibility_at" },
|
|
564
|
-
{ 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" },
|
|
565
|
-
{ code: "42703", raised_by: "entity_table" },
|
|
629
|
+
{ 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,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" },
|
|
630
|
+
{ code: "42703", raised_by: "entity_table,portal_declare" },
|
|
566
631
|
{ code: "53400", raised_by: "anon_rate_take,delete_cascade_closure,promote_field" },
|
|
567
632
|
{ code: "54001", raised_by: "record_delete" },
|
|
568
633
|
{ code: "PT409", raised_by: "record_update" }
|
|
@@ -1672,6 +1737,24 @@ var DOORS = {
|
|
|
1672
1737
|
fieldDeclare: "field_declare",
|
|
1673
1738
|
fieldUpdate: "field_update",
|
|
1674
1739
|
fieldRetire: "field_retire",
|
|
1740
|
+
// CUSTOM FIELDS ON A STANDARD BUSINESS TABLE. Every door above is keyed by a
|
|
1741
|
+
// custom Table's uuid, and a standard table has no Table record - so until
|
|
1742
|
+
// 2026-09-20 `custom.applicable_fields(org, 'party', null)` answered `22P02
|
|
1743
|
+
// invalid input syntax for uuid` and there was no other way in. These are
|
|
1744
|
+
// keyed by the REGISTRY TOKEN instead, and they are one set for all 643
|
|
1745
|
+
// tables the registry types Entity or Detail. The three value doors are
|
|
1746
|
+
// SECURITY INVOKER in the database on purpose: the standard table's own
|
|
1747
|
+
// row-level security is what decides who may read and write its rows, and a
|
|
1748
|
+
// definer wrapper would replace it with a second access system.
|
|
1749
|
+
entityTable: "entity_table",
|
|
1750
|
+
entityFields: "entity_fields",
|
|
1751
|
+
entityFieldDeclare: "entity_field_declare",
|
|
1752
|
+
entityFieldUpdate: "entity_field_update",
|
|
1753
|
+
entityFieldRetire: "entity_field_retire",
|
|
1754
|
+
entityFieldRights: "entity_field_rights",
|
|
1755
|
+
entityRecordRead: "entity_record_read",
|
|
1756
|
+
entityValueWrite: "entity_value_write",
|
|
1757
|
+
entityRecordsFind: "entity_records_find",
|
|
1675
1758
|
tableCapacity: "table_capacity",
|
|
1676
1759
|
tableStorage: "table_storage",
|
|
1677
1760
|
promoteTable: "promote_table",
|
|
@@ -1720,6 +1803,32 @@ var DOORS = {
|
|
|
1720
1803
|
// are server-lane doors and a browser never calls them.
|
|
1721
1804
|
forms: "forms",
|
|
1722
1805
|
formDeclare: "form_declare",
|
|
1806
|
+
// THE CLIENT PORTAL, OWNER'S SIDE (VIS-31 / PORTAL). A portal is how somebody
|
|
1807
|
+
// with NO membership is let in to see the records that name them. `portals`
|
|
1808
|
+
// lists them, `portalCard` opens one, `portalDeclare` states what it exposes,
|
|
1809
|
+
// `portalInvite` and `portalRevoke` are the two acts on a person, and
|
|
1810
|
+
// `portalPreview` is "view as this client" — it asks `custom.visible_set` for
|
|
1811
|
+
// HER user id, the same call `custom.read_records` makes when she opens the
|
|
1812
|
+
// page, so the preview cannot disagree with what she sees. The CLIENT-side
|
|
1813
|
+
// pair (`custom.portal_public`, `custom.portal_invitation`, `custom.portal_me`)
|
|
1814
|
+
// is deliberately absent here: those belong to the outsider's own shell.
|
|
1815
|
+
portals: "portals",
|
|
1816
|
+
portalCard: "portal_card",
|
|
1817
|
+
portalDeclare: "portal_declare",
|
|
1818
|
+
portalInvite: "portal_invite",
|
|
1819
|
+
portalRevoke: "portal_revoke",
|
|
1820
|
+
portalPreview: "portal_preview",
|
|
1821
|
+
// SCR-16 — the canvas. A dashboard is a record in the presentation kernel
|
|
1822
|
+
// whose blocks are saved SPECS for the eighth verb; `dashboardRun` walks them
|
|
1823
|
+
// under the CALLER'S principal, so nothing here is precomputed and nothing is
|
|
1824
|
+
// summed in a browser. `dashboardStuck` is the seventh block kind on its own,
|
|
1825
|
+
// because "what has not moved in fourteen days" is a question a screen asks
|
|
1826
|
+
// outside a canvas too.
|
|
1827
|
+
dashboards: "dashboards",
|
|
1828
|
+
dashboardDeclare: "dashboard_declare",
|
|
1829
|
+
dashboardRun: "dashboard_run",
|
|
1830
|
+
dashboardStuck: "dashboard_stuck",
|
|
1831
|
+
dashboardDelete: "dashboard_delete",
|
|
1723
1832
|
// The eighth verb (AGT-N-8): a grouped, bucketed, filtered count/sum/avg/
|
|
1724
1833
|
// min/max computed INSIDE the read door's own query, so a chart shows exactly
|
|
1725
1834
|
// the rows this person may see and never fetches the ones they may not.
|
|
@@ -1730,6 +1839,12 @@ var DOORS = {
|
|
|
1730
1839
|
// over a saved view. There is no subscription TABLE and no second notifier.
|
|
1731
1840
|
aggSubscriptions: "agg_subscriptions",
|
|
1732
1841
|
aggSubscriptionCadences: "agg_subscription_cadences",
|
|
1842
|
+
// The OWNER's side of DOOR-18. `agg_subscriptions` is the notifier's reader
|
|
1843
|
+
// and is not client-callable; these two are what a person reaches: what am I
|
|
1844
|
+
// being told about, and switch this one off. A form's notify Rule is one of
|
|
1845
|
+
// these rows, so "tell me when a patient arrives" can also be un-told.
|
|
1846
|
+
subscriptions: "subscriptions",
|
|
1847
|
+
subscriptionMute: "subscription_mute",
|
|
1733
1848
|
// The doc doors: a template is saved, a render is written once and frozen,
|
|
1734
1849
|
// and a signature is checked against the exact bytes that were signed.
|
|
1735
1850
|
docTemplateSave: "doc_template_save",
|
|
@@ -1778,6 +1893,23 @@ var DOORS = {
|
|
|
1778
1893
|
workSlotRelease: "work_slot_release",
|
|
1779
1894
|
workSlotHolds: "work_slot_holds",
|
|
1780
1895
|
workSlotExpire: "work_slot_expire",
|
|
1896
|
+
// THE WORK LAYER'S OWN DOORS (lane WORK-DOORS, 2026-09-20). Until this lane
|
|
1897
|
+
// all nineteen `custom.work_*` functions were SECURITY INVOKER with no client
|
|
1898
|
+
// grant: REC-69, REC-70 and REC-71 were live in the store and unreachable
|
|
1899
|
+
// from a browser. These are the verbs a person actually uses.
|
|
1900
|
+
workPerson: "work_person",
|
|
1901
|
+
workAssign: "work_assign",
|
|
1902
|
+
workRecordStates: "work_record_states",
|
|
1903
|
+
workSetState: "work_set_state",
|
|
1904
|
+
workList: "work_list",
|
|
1905
|
+
workTemplates: "work_templates",
|
|
1906
|
+
/** THE ONE QUEUE: assignments, approvals and the agent's proposals together. */
|
|
1907
|
+
workInbox: "work_inbox",
|
|
1908
|
+
workApprovalApprovers: "work_approval_approvers",
|
|
1909
|
+
workApprovalRequest: "work_approval_request",
|
|
1910
|
+
workApprovalMayDecide: "work_approval_may_decide",
|
|
1911
|
+
workApprovalDecide: "work_approval_decide",
|
|
1912
|
+
workApprovalRead: "work_approval_read",
|
|
1781
1913
|
// Declared here BECAUSE they do not exist yet: naming them is what makes the
|
|
1782
1914
|
// absence visible to `pnpm check:store-registry` and to the suite.
|
|
1783
1915
|
metadataSearch: "metadata_search",
|
|
@@ -1809,6 +1941,14 @@ var BY_SQLSTATE = {
|
|
|
1809
1941
|
// caught it raised by a door this package did not know about — which is the
|
|
1810
1942
|
// suite working, and is why the map is a census rather than a guess.
|
|
1811
1943
|
"42703": "invalid_argument",
|
|
1944
|
+
// 22007 — a date or a time the store could not read as one. It is raised by
|
|
1945
|
+
// `custom.dashboard_window_sql`, which is handed a window a caller wrote
|
|
1946
|
+
// ("last 30 days", a literal date), so the class is again "the call named
|
|
1947
|
+
// something the shape does not accept" and the store's own sentence names the
|
|
1948
|
+
// text it could not read. Added 2026-09-20 (lane SCREEN-BREAK) after the
|
|
1949
|
+
// live-door census caught it — the same way 42703 arrived, which is the
|
|
1950
|
+
// census working rather than a guess.
|
|
1951
|
+
"22007": "invalid_argument",
|
|
1812
1952
|
"02000": "not_found",
|
|
1813
1953
|
"23503": "missing_reference",
|
|
1814
1954
|
"23505": "already_exists",
|
|
@@ -2178,9 +2318,11 @@ function createRecordsClient(config) {
|
|
|
2178
2318
|
);
|
|
2179
2319
|
if (!applicable.ok) return err(applicable.error);
|
|
2180
2320
|
const rows = applicable.data ?? [];
|
|
2181
|
-
|
|
2182
|
-
|
|
2321
|
+
const fields = rows.map((row) => ({ id: row.id, ...row.data }));
|
|
2322
|
+
fields.sort(
|
|
2323
|
+
(a, b) => (a.sort ?? 0) - (b.sort ?? 0) || (a.label ?? "").localeCompare(b.label ?? "")
|
|
2183
2324
|
);
|
|
2325
|
+
return ok(fields);
|
|
2184
2326
|
},
|
|
2185
2327
|
async fieldOptions({ field_id }) {
|
|
2186
2328
|
return callDoor(
|
|
@@ -2203,6 +2345,88 @@ function createRecordsClient(config) {
|
|
|
2203
2345
|
"fieldDeclare"
|
|
2204
2346
|
);
|
|
2205
2347
|
},
|
|
2348
|
+
async entityTable({ token }) {
|
|
2349
|
+
const answer = await callDoor(
|
|
2350
|
+
DOORS.entityTable,
|
|
2351
|
+
{ p_token: token },
|
|
2352
|
+
"entityTable"
|
|
2353
|
+
);
|
|
2354
|
+
if (!answer.ok) return err(answer.error);
|
|
2355
|
+
const row = Array.isArray(answer.data) ? answer.data[0] : answer.data;
|
|
2356
|
+
if (!row) {
|
|
2357
|
+
return err({
|
|
2358
|
+
code: "not_found",
|
|
2359
|
+
message: `The registry answered nothing for the table "${token}".`,
|
|
2360
|
+
hint: "REC-33: a standard table is named by its registry token. Nothing was read."
|
|
2361
|
+
});
|
|
2362
|
+
}
|
|
2363
|
+
return ok(row);
|
|
2364
|
+
},
|
|
2365
|
+
async entityFields({ token }) {
|
|
2366
|
+
const rows = await callDoor(
|
|
2367
|
+
DOORS.entityFields,
|
|
2368
|
+
{ p_organization_id: org, p_token: token },
|
|
2369
|
+
"entityFields"
|
|
2370
|
+
);
|
|
2371
|
+
if (!rows.ok) return err(rows.error);
|
|
2372
|
+
return ok((rows.data ?? []).map((row) => ({ id: row.id, ...row.data })));
|
|
2373
|
+
},
|
|
2374
|
+
async entityFieldDeclare({ token, spec }) {
|
|
2375
|
+
return callDoor(
|
|
2376
|
+
DOORS.entityFieldDeclare,
|
|
2377
|
+
{ p_organization_id: org, p_token: token, p_spec: spec },
|
|
2378
|
+
"entityFieldDeclare"
|
|
2379
|
+
);
|
|
2380
|
+
},
|
|
2381
|
+
async entityFieldUpdate({ field_id, patch }) {
|
|
2382
|
+
return callDoor(
|
|
2383
|
+
DOORS.entityFieldUpdate,
|
|
2384
|
+
{ p_organization_id: org, p_field_id: field_id, p_patch: patch },
|
|
2385
|
+
"entityFieldUpdate"
|
|
2386
|
+
);
|
|
2387
|
+
},
|
|
2388
|
+
async entityFieldRetire({ field_id }) {
|
|
2389
|
+
return callDoor(
|
|
2390
|
+
DOORS.entityFieldRetire,
|
|
2391
|
+
{ p_organization_id: org, p_field_id: field_id },
|
|
2392
|
+
"entityFieldRetire"
|
|
2393
|
+
);
|
|
2394
|
+
},
|
|
2395
|
+
async entityFieldRights({ token }) {
|
|
2396
|
+
return callDoor(
|
|
2397
|
+
DOORS.entityFieldRights,
|
|
2398
|
+
{ p_organization_id: org, p_token: token },
|
|
2399
|
+
"entityFieldRights"
|
|
2400
|
+
);
|
|
2401
|
+
},
|
|
2402
|
+
async entityRecordRead({ token, record_id }) {
|
|
2403
|
+
return callDoor(
|
|
2404
|
+
DOORS.entityRecordRead,
|
|
2405
|
+
{ p_organization_id: org, p_token: token, p_record_id: record_id },
|
|
2406
|
+
"entityRecordRead"
|
|
2407
|
+
);
|
|
2408
|
+
},
|
|
2409
|
+
async entityValueWrite({ token, record_id, patch }) {
|
|
2410
|
+
return callDoor(
|
|
2411
|
+
DOORS.entityValueWrite,
|
|
2412
|
+
{ p_organization_id: org, p_token: token, p_record_id: record_id, p_patch: patch },
|
|
2413
|
+
"entityValueWrite"
|
|
2414
|
+
);
|
|
2415
|
+
},
|
|
2416
|
+
async entityRecordsFind({ token, key, value, limit, offset }) {
|
|
2417
|
+
return callDoor(
|
|
2418
|
+
DOORS.entityRecordsFind,
|
|
2419
|
+
{
|
|
2420
|
+
p_organization_id: org,
|
|
2421
|
+
p_token: token,
|
|
2422
|
+
p_key: key,
|
|
2423
|
+
p_value: value === void 0 ? null : value,
|
|
2424
|
+
...limit === void 0 ? {} : { p_limit: limit },
|
|
2425
|
+
...offset === void 0 ? {} : { p_offset: offset }
|
|
2426
|
+
},
|
|
2427
|
+
"entityRecordsFind"
|
|
2428
|
+
);
|
|
2429
|
+
},
|
|
2206
2430
|
async fieldUpdate({ field_id, patch }) {
|
|
2207
2431
|
return callDoor(
|
|
2208
2432
|
DOORS.fieldUpdate,
|
|
@@ -2272,6 +2496,65 @@ function createRecordsClient(config) {
|
|
|
2272
2496
|
"formDeclare"
|
|
2273
2497
|
);
|
|
2274
2498
|
},
|
|
2499
|
+
async portals() {
|
|
2500
|
+
return callDoor(DOORS.portals, { p_organization_id: org }, "portals");
|
|
2501
|
+
},
|
|
2502
|
+
async portalCard({ portal_id }) {
|
|
2503
|
+
return callDoor(
|
|
2504
|
+
DOORS.portalCard,
|
|
2505
|
+
{ p_organization_id: org, p_portal_id: portal_id },
|
|
2506
|
+
"portalCard"
|
|
2507
|
+
);
|
|
2508
|
+
},
|
|
2509
|
+
async portalDeclare(args) {
|
|
2510
|
+
return callDoor(
|
|
2511
|
+
DOORS.portalDeclare,
|
|
2512
|
+
{
|
|
2513
|
+
p_organization_id: org,
|
|
2514
|
+
p_title: args.title,
|
|
2515
|
+
p_client_table_id: args.client_table_id,
|
|
2516
|
+
p_tables: args.tables,
|
|
2517
|
+
p_portal_id: args.portal_id ?? null,
|
|
2518
|
+
p_slug: args.slug ?? null,
|
|
2519
|
+
p_sign_in_method: args.sign_in_method ?? "magic_link"
|
|
2520
|
+
},
|
|
2521
|
+
"portalDeclare"
|
|
2522
|
+
);
|
|
2523
|
+
},
|
|
2524
|
+
async portalInvite(args) {
|
|
2525
|
+
return callDoor(
|
|
2526
|
+
DOORS.portalInvite,
|
|
2527
|
+
{
|
|
2528
|
+
p_organization_id: org,
|
|
2529
|
+
p_portal_id: args.portal_id,
|
|
2530
|
+
p_client_record_id: args.client_record_id,
|
|
2531
|
+
p_email: args.email,
|
|
2532
|
+
// ALWAYS null from a client. See the interface comment: an invitation
|
|
2533
|
+
// confers nothing until the person follows their own sign-in link.
|
|
2534
|
+
p_user_id: null
|
|
2535
|
+
},
|
|
2536
|
+
"portalInvite"
|
|
2537
|
+
);
|
|
2538
|
+
},
|
|
2539
|
+
async portalRevoke({ portal_id, principal_id }) {
|
|
2540
|
+
return callDoor(
|
|
2541
|
+
DOORS.portalRevoke,
|
|
2542
|
+
{ p_organization_id: org, p_portal_id: portal_id, p_principal_id: principal_id },
|
|
2543
|
+
"portalRevoke"
|
|
2544
|
+
);
|
|
2545
|
+
},
|
|
2546
|
+
async portalPreview({ portal_id, principal_id, table_id }) {
|
|
2547
|
+
return callDoor(
|
|
2548
|
+
DOORS.portalPreview,
|
|
2549
|
+
{
|
|
2550
|
+
p_organization_id: org,
|
|
2551
|
+
p_portal_id: portal_id,
|
|
2552
|
+
p_principal_id: principal_id,
|
|
2553
|
+
p_table_id: table_id
|
|
2554
|
+
},
|
|
2555
|
+
"portalPreview"
|
|
2556
|
+
);
|
|
2557
|
+
},
|
|
2275
2558
|
async ruleRun({ rule_id, values, context }) {
|
|
2276
2559
|
return callDoor(
|
|
2277
2560
|
DOORS.ruleRun,
|
|
@@ -2296,6 +2579,55 @@ function createRecordsClient(config) {
|
|
|
2296
2579
|
"ruleEval"
|
|
2297
2580
|
);
|
|
2298
2581
|
},
|
|
2582
|
+
async dashboards(args) {
|
|
2583
|
+
return callDoor(
|
|
2584
|
+
DOORS.dashboards,
|
|
2585
|
+
{ p_organization_id: org, p_table_id: args?.table_id ?? null },
|
|
2586
|
+
"dashboards"
|
|
2587
|
+
);
|
|
2588
|
+
},
|
|
2589
|
+
async dashboardDeclare(args) {
|
|
2590
|
+
return callDoor(
|
|
2591
|
+
DOORS.dashboardDeclare,
|
|
2592
|
+
{
|
|
2593
|
+
p_organization_id: org,
|
|
2594
|
+
p_table_id: args.table_id,
|
|
2595
|
+
p_name: args.name,
|
|
2596
|
+
p_blocks: args.blocks ?? [],
|
|
2597
|
+
p_presentation: args.presentation ?? {},
|
|
2598
|
+
p_dashboard_id: args.dashboard_id ?? null
|
|
2599
|
+
},
|
|
2600
|
+
"dashboardDeclare"
|
|
2601
|
+
);
|
|
2602
|
+
},
|
|
2603
|
+
async dashboardRun({ dashboard_id, filter }) {
|
|
2604
|
+
return callDoor(
|
|
2605
|
+
DOORS.dashboardRun,
|
|
2606
|
+
{ p_organization_id: org, p_dashboard_id: dashboard_id, p_filter: filter ?? {} },
|
|
2607
|
+
"dashboardRun"
|
|
2608
|
+
);
|
|
2609
|
+
},
|
|
2610
|
+
async dashboardStuck({ table_id, state_key, days, filter, limit }) {
|
|
2611
|
+
return callDoor(
|
|
2612
|
+
DOORS.dashboardStuck,
|
|
2613
|
+
{
|
|
2614
|
+
p_organization_id: org,
|
|
2615
|
+
p_table_id: table_id,
|
|
2616
|
+
p_state_key: state_key,
|
|
2617
|
+
p_days: days ?? 14,
|
|
2618
|
+
p_filter: filter ?? {},
|
|
2619
|
+
p_limit: limit ?? 50
|
|
2620
|
+
},
|
|
2621
|
+
"dashboardStuck"
|
|
2622
|
+
);
|
|
2623
|
+
},
|
|
2624
|
+
async dashboardDelete({ dashboard_id }) {
|
|
2625
|
+
return callDoor(
|
|
2626
|
+
DOORS.dashboardDelete,
|
|
2627
|
+
{ p_organization_id: org, p_dashboard_id: dashboard_id },
|
|
2628
|
+
"dashboardDelete"
|
|
2629
|
+
);
|
|
2630
|
+
},
|
|
2299
2631
|
async recordAggregate({ table_id, groupBy, measures, bucket, filter, limit }) {
|
|
2300
2632
|
return callDoor(
|
|
2301
2633
|
DOORS.recordAggregate,
|
|
@@ -2331,6 +2663,20 @@ function createRecordsClient(config) {
|
|
|
2331
2663
|
async aggSubscriptionCadences() {
|
|
2332
2664
|
return callDoor(DOORS.aggSubscriptionCadences, {}, "aggSubscriptionCadences");
|
|
2333
2665
|
},
|
|
2666
|
+
async subscriptions(args) {
|
|
2667
|
+
return callDoor(
|
|
2668
|
+
DOORS.subscriptions,
|
|
2669
|
+
{ p_organization_id: org, p_table_id: args?.table_id ?? null },
|
|
2670
|
+
"subscriptions"
|
|
2671
|
+
);
|
|
2672
|
+
},
|
|
2673
|
+
async subscriptionMute({ rule_id, muted }) {
|
|
2674
|
+
return callDoor(
|
|
2675
|
+
DOORS.subscriptionMute,
|
|
2676
|
+
{ p_organization_id: org, p_rule_id: rule_id, p_muted: muted },
|
|
2677
|
+
"subscriptionMute"
|
|
2678
|
+
);
|
|
2679
|
+
},
|
|
2334
2680
|
async docTemplateSave({ table_id, name, body, template_id }) {
|
|
2335
2681
|
return callDoor(
|
|
2336
2682
|
DOORS.docTemplateSave,
|
|
@@ -2620,6 +2966,128 @@ function createRecordsClient(config) {
|
|
|
2620
2966
|
"workSlotExpire"
|
|
2621
2967
|
);
|
|
2622
2968
|
},
|
|
2969
|
+
// ── the work layer a person actually uses ────────────────────────────
|
|
2970
|
+
async workInbox(args) {
|
|
2971
|
+
return callDoor(
|
|
2972
|
+
DOORS.workInbox,
|
|
2973
|
+
{
|
|
2974
|
+
p_organization_id: org,
|
|
2975
|
+
p_limit: args?.limit ?? 50,
|
|
2976
|
+
p_offset: args?.offset ?? 0,
|
|
2977
|
+
p_include_decided: args?.includeDecided ?? false
|
|
2978
|
+
},
|
|
2979
|
+
"workInbox"
|
|
2980
|
+
);
|
|
2981
|
+
},
|
|
2982
|
+
async workList(args) {
|
|
2983
|
+
return callDoor(
|
|
2984
|
+
DOORS.workList,
|
|
2985
|
+
{
|
|
2986
|
+
p_organization_id: org,
|
|
2987
|
+
p_flavour: args?.flavour ?? "mine",
|
|
2988
|
+
p_include_finished: args?.includeFinished ?? false,
|
|
2989
|
+
p_limit: args?.limit ?? 100,
|
|
2990
|
+
p_offset: args?.offset ?? 0
|
|
2991
|
+
},
|
|
2992
|
+
"workList"
|
|
2993
|
+
);
|
|
2994
|
+
},
|
|
2995
|
+
async workAssign({ record_id, user_id = null, dueDate = null, clearDue = false }) {
|
|
2996
|
+
return callDoor(
|
|
2997
|
+
DOORS.workAssign,
|
|
2998
|
+
{
|
|
2999
|
+
p_organization_id: org,
|
|
3000
|
+
p_record_id: record_id,
|
|
3001
|
+
p_assignee_user_id: user_id,
|
|
3002
|
+
p_due_date: dueDate,
|
|
3003
|
+
p_clear_due: clearDue
|
|
3004
|
+
},
|
|
3005
|
+
"workAssign"
|
|
3006
|
+
);
|
|
3007
|
+
},
|
|
3008
|
+
async workRecordStates({ record_id }) {
|
|
3009
|
+
return callDoor(
|
|
3010
|
+
DOORS.workRecordStates,
|
|
3011
|
+
{ p_organization_id: org, p_record_id: record_id },
|
|
3012
|
+
"workRecordStates"
|
|
3013
|
+
);
|
|
3014
|
+
},
|
|
3015
|
+
async workSetState({ record_id, state_id }) {
|
|
3016
|
+
return callDoor(
|
|
3017
|
+
DOORS.workSetState,
|
|
3018
|
+
{ p_organization_id: org, p_record_id: record_id, p_state_id: state_id },
|
|
3019
|
+
"workSetState"
|
|
3020
|
+
);
|
|
3021
|
+
},
|
|
3022
|
+
async workPerson({ user_id, create = true }) {
|
|
3023
|
+
return callDoor(
|
|
3024
|
+
DOORS.workPerson,
|
|
3025
|
+
{ p_organization_id: org, p_user_id: user_id, p_create: create },
|
|
3026
|
+
"workPerson"
|
|
3027
|
+
);
|
|
3028
|
+
},
|
|
3029
|
+
async workTemplates(args) {
|
|
3030
|
+
return callDoor(
|
|
3031
|
+
DOORS.workTemplates,
|
|
3032
|
+
{ p_organization_id: org, p_limit: args?.limit ?? 100 },
|
|
3033
|
+
"workTemplates"
|
|
3034
|
+
);
|
|
3035
|
+
},
|
|
3036
|
+
async workApprovalApprovers({ subject_id, approver_id = null }) {
|
|
3037
|
+
return callDoor(
|
|
3038
|
+
DOORS.workApprovalApprovers,
|
|
3039
|
+
{ p_organization_id: org, p_subject_id: subject_id, p_approver_id: approver_id },
|
|
3040
|
+
"workApprovalApprovers"
|
|
3041
|
+
);
|
|
3042
|
+
},
|
|
3043
|
+
async workApprovalRequest({
|
|
3044
|
+
subject_id,
|
|
3045
|
+
change,
|
|
3046
|
+
note = null,
|
|
3047
|
+
approver_id = null,
|
|
3048
|
+
origin = "person",
|
|
3049
|
+
conversation_id = null
|
|
3050
|
+
}) {
|
|
3051
|
+
return callDoor(
|
|
3052
|
+
DOORS.workApprovalRequest,
|
|
3053
|
+
{
|
|
3054
|
+
p_organization_id: org,
|
|
3055
|
+
p_subject_id: subject_id,
|
|
3056
|
+
p_change: change,
|
|
3057
|
+
p_note: note,
|
|
3058
|
+
p_approver_id: approver_id,
|
|
3059
|
+
p_origin: origin,
|
|
3060
|
+
p_conversation_id: conversation_id
|
|
3061
|
+
},
|
|
3062
|
+
"workApprovalRequest"
|
|
3063
|
+
);
|
|
3064
|
+
},
|
|
3065
|
+
async workApprovalMayDecide({ approval_id }) {
|
|
3066
|
+
return callDoor(
|
|
3067
|
+
DOORS.workApprovalMayDecide,
|
|
3068
|
+
{ p_organization_id: org, p_approval_id: approval_id },
|
|
3069
|
+
"workApprovalMayDecide"
|
|
3070
|
+
);
|
|
3071
|
+
},
|
|
3072
|
+
async workApprovalDecide({ approval_id, approve, note = null }) {
|
|
3073
|
+
return callDoor(
|
|
3074
|
+
DOORS.workApprovalDecide,
|
|
3075
|
+
{
|
|
3076
|
+
p_organization_id: org,
|
|
3077
|
+
p_approval_id: approval_id,
|
|
3078
|
+
p_approve: approve,
|
|
3079
|
+
p_note: note
|
|
3080
|
+
},
|
|
3081
|
+
"workApprovalDecide"
|
|
3082
|
+
);
|
|
3083
|
+
},
|
|
3084
|
+
async workApprovalRead({ approval_id }) {
|
|
3085
|
+
return callDoor(
|
|
3086
|
+
DOORS.workApprovalRead,
|
|
3087
|
+
{ p_organization_id: org, p_approval_id: approval_id },
|
|
3088
|
+
"workApprovalRead"
|
|
3089
|
+
);
|
|
3090
|
+
},
|
|
2623
3091
|
// ── the trust doors ──────────────────────────────────────────────────
|
|
2624
3092
|
async isExternalPrincipal(args) {
|
|
2625
3093
|
return trustDoor(
|
|
@@ -2946,6 +3414,72 @@ function useRecordMutation() {
|
|
|
2946
3414
|
[client, run, saving, error, conflict]
|
|
2947
3415
|
);
|
|
2948
3416
|
}
|
|
3417
|
+
function useEntityFields(token) {
|
|
3418
|
+
return useAsync(
|
|
3419
|
+
(client) => token ? client.entityFields({ token }) : Promise.resolve({ ok: true, data: [] }),
|
|
3420
|
+
[token]
|
|
3421
|
+
);
|
|
3422
|
+
}
|
|
3423
|
+
function useEntityRecord(token, recordId) {
|
|
3424
|
+
return useAsync(
|
|
3425
|
+
(client) => token && recordId ? client.entityRecordRead({ token, record_id: recordId }) : Promise.resolve({ ok: true, data: null }),
|
|
3426
|
+
[token, recordId]
|
|
3427
|
+
);
|
|
3428
|
+
}
|
|
3429
|
+
function useEntityTable(token) {
|
|
3430
|
+
return useAsync(
|
|
3431
|
+
(client) => token ? client.entityTable({ token }) : Promise.resolve({ ok: true, data: null }),
|
|
3432
|
+
[token]
|
|
3433
|
+
);
|
|
3434
|
+
}
|
|
3435
|
+
function useEntityFieldRights(token) {
|
|
3436
|
+
return useAsync(
|
|
3437
|
+
(client) => token ? client.entityFieldRights({ token }) : Promise.resolve({ ok: true, data: null }),
|
|
3438
|
+
[token]
|
|
3439
|
+
);
|
|
3440
|
+
}
|
|
3441
|
+
function useEntityFieldMutation() {
|
|
3442
|
+
const client = useRecordsClient();
|
|
3443
|
+
const [saving, setSaving] = (0, import_react2.useState)(false);
|
|
3444
|
+
const [error, setError] = (0, import_react2.useState)(null);
|
|
3445
|
+
const run = (0, import_react2.useCallback)(
|
|
3446
|
+
async (call, whenRefused) => {
|
|
3447
|
+
setSaving(true);
|
|
3448
|
+
setError(null);
|
|
3449
|
+
try {
|
|
3450
|
+
const result = await call();
|
|
3451
|
+
if (result.ok) return result.data;
|
|
3452
|
+
setError(result.error);
|
|
3453
|
+
return whenRefused;
|
|
3454
|
+
} finally {
|
|
3455
|
+
setSaving(false);
|
|
3456
|
+
}
|
|
3457
|
+
},
|
|
3458
|
+
[]
|
|
3459
|
+
);
|
|
3460
|
+
return (0, import_react2.useMemo)(
|
|
3461
|
+
() => ({
|
|
3462
|
+
declare: (args) => run(() => client.entityFieldDeclare({ token: args.token, spec: args.spec }), null),
|
|
3463
|
+
update: (args) => run(
|
|
3464
|
+
() => client.entityFieldUpdate({ field_id: args.field_id, patch: args.patch }),
|
|
3465
|
+
null
|
|
3466
|
+
),
|
|
3467
|
+
retire: (args) => run(() => client.entityFieldRetire({ field_id: args.field_id }), null),
|
|
3468
|
+
write: (args) => run(
|
|
3469
|
+
() => client.entityValueWrite({
|
|
3470
|
+
token: args.token,
|
|
3471
|
+
record_id: args.record_id,
|
|
3472
|
+
patch: args.patch
|
|
3473
|
+
}),
|
|
3474
|
+
null
|
|
3475
|
+
),
|
|
3476
|
+
saving,
|
|
3477
|
+
error,
|
|
3478
|
+
clearError: () => setError(null)
|
|
3479
|
+
}),
|
|
3480
|
+
[client, run, saving, error]
|
|
3481
|
+
);
|
|
3482
|
+
}
|
|
2949
3483
|
function useFieldMutation() {
|
|
2950
3484
|
const client = useRecordsClient();
|
|
2951
3485
|
const [saving, setSaving] = (0, import_react2.useState)(false);
|
|
@@ -3074,11 +3608,59 @@ var OVERRIDE_POLICIES = [
|
|
|
3074
3608
|
var FRESHNESS = ["live", "cached", "snapshot"];
|
|
3075
3609
|
var TABLE_DISPLAYS = ["list", "grid", "board", "calendar", "timeline"];
|
|
3076
3610
|
|
|
3611
|
+
// src/choice.ts
|
|
3612
|
+
var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
3613
|
+
function optionKey(option) {
|
|
3614
|
+
const stored = option.metadata?.["option_key"];
|
|
3615
|
+
if (typeof stored === "string" && stored.trim() !== "") return stored;
|
|
3616
|
+
return choiceSlug(optionLabel(option));
|
|
3617
|
+
}
|
|
3618
|
+
function optionLabel(option) {
|
|
3619
|
+
const doc = option.data;
|
|
3620
|
+
const title = doc?.["title"] ?? doc?.["name"];
|
|
3621
|
+
if (typeof title === "string" && title.trim() !== "") return title;
|
|
3622
|
+
return "Unnamed choice";
|
|
3623
|
+
}
|
|
3624
|
+
function choiceSlug(word) {
|
|
3625
|
+
const slug = word.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "").slice(0, 55);
|
|
3626
|
+
return slug === "" ? "choice" : slug;
|
|
3627
|
+
}
|
|
3628
|
+
function isTheChosen(option, value) {
|
|
3629
|
+
if (typeof value !== "string") return false;
|
|
3630
|
+
const asked = value.trim().toLowerCase();
|
|
3631
|
+
if (asked === "") return false;
|
|
3632
|
+
return asked === optionKey(option).toLowerCase() || asked === optionLabel(option).toLowerCase() || asked === option.id.toLowerCase();
|
|
3633
|
+
}
|
|
3634
|
+
function choiceValuesOf(value) {
|
|
3635
|
+
if (Array.isArray(value)) return value.filter((v) => typeof v === "string");
|
|
3636
|
+
if (typeof value === "string" && value !== "") return [value];
|
|
3637
|
+
return [];
|
|
3638
|
+
}
|
|
3639
|
+
function choicesOf(document, fieldKeyOrId) {
|
|
3640
|
+
const block = document?.["_choices"];
|
|
3641
|
+
if (!block || typeof block !== "object") return [];
|
|
3642
|
+
const entry = block[fieldKeyOrId];
|
|
3643
|
+
if (!entry) return [];
|
|
3644
|
+
const list = Array.isArray(entry) ? entry : [entry];
|
|
3645
|
+
return list.filter((x) => !!x && typeof x === "object" && typeof x.key === "string");
|
|
3646
|
+
}
|
|
3647
|
+
function holdsARetiredChoice(document, fieldKeyOrId) {
|
|
3648
|
+
return choicesOf(document, fieldKeyOrId).some((c) => c.retired === true);
|
|
3649
|
+
}
|
|
3650
|
+
function looksLikeAnId(value) {
|
|
3651
|
+
return typeof value === "string" && UUID.test(value);
|
|
3652
|
+
}
|
|
3653
|
+
|
|
3077
3654
|
// src/rule.ts
|
|
3078
3655
|
function publicFormPath(formId) {
|
|
3079
3656
|
return `/f/${formId}`;
|
|
3080
3657
|
}
|
|
3081
3658
|
|
|
3659
|
+
// src/portal.ts
|
|
3660
|
+
function portalPath(slug) {
|
|
3661
|
+
return `/portal/c/${slug}`;
|
|
3662
|
+
}
|
|
3663
|
+
|
|
3082
3664
|
// src/aggregate.ts
|
|
3083
3665
|
function measureKey(measure) {
|
|
3084
3666
|
return measure.op === "count" ? "count" : `${measure.op}_${measure.key ?? ""}`;
|