@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.
- package/CHANGELOG.md +50 -0
- package/dist/core/index.cjs +353 -25
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +177 -4
- package/dist/core/index.d.ts +177 -4
- package/dist/core/index.js +353 -25
- package/dist/core/index.js.map +1 -1
- package/dist/index.cjs +65 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +451 -22
- package/dist/index.d.ts +451 -22
- package/dist/index.js +65 -22
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +428 -25
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +667 -23
- package/dist/react/index.d.ts +667 -23
- package/dist/react/index.js +428 -25
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,55 @@
|
|
|
1
1
|
# Changelog — @ai-matrx/records
|
|
2
2
|
|
|
3
|
+
## 0.11.0
|
|
4
|
+
|
|
5
|
+
**The publish gate stops red-lighting on other lanes' migrations.** `the
|
|
6
|
+
generated door catalogue is the store's` asserted `STORE_DOORS.length === live`,
|
|
7
|
+
so every publish failed in which anybody anywhere had shipped a new `custom`
|
|
8
|
+
routine — 337 mirrored against 342 live on 2026-09-20, and not one of the five
|
|
9
|
+
was this package's. A release that red-lights on somebody else's work teaches
|
|
10
|
+
everyone to ignore red.
|
|
11
|
+
|
|
12
|
+
What the package must be right about is asserted and still gates: **every door
|
|
13
|
+
this mirror names exists in the live store**. A name here the store does not
|
|
14
|
+
have is this package claiming a door it cannot open, which is the whole reason
|
|
15
|
+
`store.generated.ts` is generated rather than typed. Doors the store has and the
|
|
16
|
+
mirror has not seen are REPORTED by name, loudly, and gate nothing.
|
|
17
|
+
|
|
18
|
+
### Consumer action
|
|
19
|
+
|
|
20
|
+
None. No API changed.
|
|
21
|
+
|
|
22
|
+
## 0.10.0
|
|
23
|
+
|
|
24
|
+
**The work layer has client doors, and this package can reach them.** Until lane
|
|
25
|
+
WORK-DOORS (2026-09-20) all nineteen `custom.work_*` functions were SECURITY
|
|
26
|
+
INVOKER, held no EXECUTE for `authenticated` and carried zero rows in
|
|
27
|
+
`platform.client_callable_door`: REC-69 (assignment and action state), REC-70
|
|
28
|
+
(template instantiation) and REC-71 (the slot hold) were live in the store and
|
|
29
|
+
unreachable from a browser. Thirteen new client methods, all against doors that
|
|
30
|
+
ask the one ladder first:
|
|
31
|
+
|
|
32
|
+
* `workInbox` — **THE ONE QUEUE.** Assignments, approvals and the agent's
|
|
33
|
+
proposals in one ordered list with one row shape (PRODUCTS.md row 6).
|
|
34
|
+
* `workList` — "my work", "work I assigned", "waiting on somebody being chosen",
|
|
35
|
+
across every Table in the organization, every row decided by the one ladder.
|
|
36
|
+
* `workAssign` — the Assignee value AND editor access, in one transaction. An
|
|
37
|
+
assignment that did not give access put a row in somebody's inbox that they
|
|
38
|
+
were refused when they opened it.
|
|
39
|
+
* `workRecordStates` / `workSetState` — the moves the workflow model allows, with
|
|
40
|
+
the sentence for each one it does not, so a screen offers real moves.
|
|
41
|
+
* `workApprovalRequest` / `workApprovalMayDecide` / `workApprovalDecide` /
|
|
42
|
+
`workApprovalRead` / `workApprovalApprovers` — asking for a change instead of
|
|
43
|
+
making it, and a decision that **applies** the change in the same transaction.
|
|
44
|
+
* `workPerson`, `workTemplates`.
|
|
45
|
+
|
|
46
|
+
New types in `work.ts`: `WorkInboxItem`, `WorkListItem`, `WorkRecordState`,
|
|
47
|
+
`WorkApprover`, `WorkApprovalFiled`, `WorkApprovalDecision`, `WorkAssignment`,
|
|
48
|
+
`WorkChange`, `WorkInboxKind`, `WorkOrigin`, `WorkDueState`, `WorkListFlavour`.
|
|
49
|
+
|
|
50
|
+
**Consumer action:** none required — every addition is new surface. A host that
|
|
51
|
+
wants the inbox takes `@ai-matrx/records-ui` 0.15.0 with it.
|
|
52
|
+
|
|
3
53
|
## 0.7.2
|
|
4
54
|
|
|
5
55
|
**The door catalogue, regenerated while the store was still growing.** 0.7.1
|
package/dist/core/index.cjs
CHANGED
|
@@ -93,6 +93,7 @@ __export(core_exports, {
|
|
|
93
93
|
predictSizeRefusal: () => predictSizeRefusal,
|
|
94
94
|
predictValueRefusals: () => predictValueRefusals,
|
|
95
95
|
predictWriteRefusals: () => predictWriteRefusals,
|
|
96
|
+
publicFormPath: () => publicFormPath,
|
|
96
97
|
staleWriteDetail: () => staleWriteDetail,
|
|
97
98
|
supabaseDataSource: () => supabaseDataSource,
|
|
98
99
|
toAoa: () => toAoa
|
|
@@ -182,6 +183,11 @@ function highestLevel(left, right) {
|
|
|
182
183
|
return ORDINAL[left] >= ORDINAL[right] ? left : right;
|
|
183
184
|
}
|
|
184
185
|
|
|
186
|
+
// src/rule.ts
|
|
187
|
+
function publicFormPath(formId) {
|
|
188
|
+
return `/f/${formId}`;
|
|
189
|
+
}
|
|
190
|
+
|
|
185
191
|
// src/aggregate.ts
|
|
186
192
|
function measureKey(measure) {
|
|
187
193
|
return measure.op === "count" ? "count" : `${measure.op}_${measure.key ?? ""}`;
|
|
@@ -285,6 +291,8 @@ var STORE_DOORS = [
|
|
|
285
291
|
{ 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" },
|
|
286
292
|
{ 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" },
|
|
287
293
|
{ name: "assert_client_may_reach", args: "p_organization_id uuid, p_door text", returns: "void", security: "invoker" },
|
|
294
|
+
{ name: "assert_entity_door", args: "p_organization_id uuid, p_door text", returns: "void", security: "definer" },
|
|
295
|
+
{ name: "assert_entity_is_organization_scoped", args: "p_token text, p_label text, p_scoped boolean", returns: "void", security: "invoker" },
|
|
288
296
|
{ name: "assert_may_know_table", args: "p_organization_id uuid, p_table_id uuid, p_door text", returns: "void", security: "invoker" },
|
|
289
297
|
{ name: "assert_organization_admin", args: "p_organization_id uuid, p_door text, p_what text", returns: "void", security: "invoker" },
|
|
290
298
|
{ name: "assert_organization_wall", args: "p_kind text, p_organization_id uuid, p_row jsonb", returns: "void", security: "invoker" },
|
|
@@ -314,11 +322,14 @@ var STORE_DOORS = [
|
|
|
314
322
|
{ name: "doc_format_value", args: "p_field_data jsonb, p_value jsonb", returns: "text", security: "invoker" },
|
|
315
323
|
{ name: "doc_render_body", args: "p_organization_id uuid, p_template_id uuid, p_record_id uuid", returns: "text", security: "invoker" },
|
|
316
324
|
{ name: "doc_render_document", args: "p_organization_id uuid, p_template_id uuid, p_record_id uuid", returns: "uuid", security: "definer" },
|
|
325
|
+
{ name: "doc_render_read", args: "p_organization_id uuid, p_render_id uuid", returns: "jsonb", security: "definer" },
|
|
317
326
|
{ 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" },
|
|
318
327
|
{ 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" },
|
|
319
328
|
{ name: "doc_signature_field_ok", args: "p_field_data jsonb", returns: "boolean", security: "invoker" },
|
|
320
329
|
{ name: "doc_signature_intact", args: "p_organization_id uuid, p_signature_id uuid", returns: "jsonb", security: "invoker" },
|
|
330
|
+
{ name: "doc_signature_read", args: "p_organization_id uuid, p_signature_id uuid", returns: "jsonb", security: "definer" },
|
|
321
331
|
{ 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" },
|
|
332
|
+
{ name: "doc_template_read", args: "p_organization_id uuid, p_template_id uuid", returns: "jsonb", security: "definer" },
|
|
322
333
|
{ 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" },
|
|
323
334
|
{ name: "doc_token_pattern", args: "", returns: "text", security: "invoker" },
|
|
324
335
|
{ name: "doc_tokens", args: "p_body text", returns: "TABLE(ordinal integer, raw text, field_id uuid)", security: "invoker" },
|
|
@@ -327,6 +338,15 @@ var STORE_DOORS = [
|
|
|
327
338
|
{ name: "doors_not_deciding_the_record", args: "", returns: "TABLE(function_name text, identity_args text, why text)", security: "invoker" },
|
|
328
339
|
{ name: "doors_not_on_one_ladder", args: "", returns: "TABLE(function_name text, identity_args text, why text)", security: "invoker" },
|
|
329
340
|
{ 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" },
|
|
341
|
+
{ name: "entity_field_declare", args: "p_organization_id uuid, p_token text, p_spec jsonb", returns: "uuid", security: "definer" },
|
|
342
|
+
{ name: "entity_field_retire", args: "p_organization_id uuid, p_field_id uuid", returns: "uuid", security: "definer" },
|
|
343
|
+
{ name: "entity_field_rights", args: "p_organization_id uuid, p_token text", returns: "jsonb", security: "definer" },
|
|
344
|
+
{ name: "entity_field_update", args: "p_organization_id uuid, p_field_id uuid, p_patch jsonb", returns: "uuid", security: "definer" },
|
|
345
|
+
{ name: "entity_fields", args: "p_organization_id uuid, p_token text", returns: "SETOF custom.record", security: "definer" },
|
|
346
|
+
{ name: "entity_record_read", args: "p_organization_id uuid, p_token text, p_record_id uuid", returns: "jsonb", security: "invoker" },
|
|
347
|
+
{ 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" },
|
|
348
|
+
{ 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" },
|
|
349
|
+
{ name: "entity_value_write", args: "p_organization_id uuid, p_token text, p_record_id uuid, p_patch jsonb", returns: "jsonb", security: "invoker" },
|
|
330
350
|
{ 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" },
|
|
331
351
|
{ name: "external_foreign_table_findings", args: "", returns: "SETOF text", security: "definer" },
|
|
332
352
|
{ name: "external_history_event", args: "p_organization_id uuid, p_link_id uuid, p_operation text", returns: "bigint", security: "definer" },
|
|
@@ -346,6 +366,12 @@ var STORE_DOORS = [
|
|
|
346
366
|
{ name: "field_update", args: "p_organization_id uuid, p_field_id uuid, p_patch jsonb", returns: "uuid", security: "definer" },
|
|
347
367
|
{ name: "field_value_convert", args: "p_to jsonb, p_value jsonb", returns: "jsonb", security: "invoker" },
|
|
348
368
|
{ name: "file_kernel_id", args: "", returns: "uuid", security: "invoker" },
|
|
369
|
+
{ 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" },
|
|
370
|
+
{ name: "form_notify", args: "p_organization_id uuid, p_form_id uuid, p_record_id uuid, p_submission_id uuid", returns: "uuid", security: "invoker" },
|
|
371
|
+
{ 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" },
|
|
372
|
+
{ name: "form_slug", args: "p_organization_id uuid, p_title text, p_form_id uuid DEFAULT NULL::uuid", returns: "text", security: "invoker" },
|
|
373
|
+
{ 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" },
|
|
374
|
+
{ 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" },
|
|
349
375
|
{ 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" },
|
|
350
376
|
{ name: "guard_refusals_are_complete", args: "", returns: "TABLE(guard text, said text)", security: "invoker" },
|
|
351
377
|
{ 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" },
|
|
@@ -398,6 +424,8 @@ var STORE_DOORS = [
|
|
|
398
424
|
{ 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" },
|
|
399
425
|
{ name: "my_level", args: "p_organization_id uuid, p_id uuid, p_type text DEFAULT 'record'::text", returns: "permission_level", security: "definer" },
|
|
400
426
|
{ 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" },
|
|
427
|
+
{ name: "organization_clear", args: "p_organization_id uuid, p_confirm text, p_and_destroy boolean DEFAULT false", returns: "jsonb", security: "definer" },
|
|
428
|
+
{ name: "organization_contents", args: "p_organization_id uuid", returns: "jsonb", security: "definer" },
|
|
401
429
|
{ name: "organization_kernel_id", args: "", returns: "uuid", security: "invoker" },
|
|
402
430
|
{ 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" },
|
|
403
431
|
{ name: "owning_table", args: "p_organization_id uuid, p_record_id uuid", returns: "uuid", security: "invoker" },
|
|
@@ -462,6 +490,7 @@ var STORE_DOORS = [
|
|
|
462
490
|
{ 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" },
|
|
463
491
|
{ name: "record_write", args: "p_organization_id uuid, p_table_id uuid, p_data jsonb", returns: "uuid", security: "definer" },
|
|
464
492
|
{ name: "relation_carry", args: "p_organization_id uuid, p_container_id uuid, p_item_id uuid", returns: "uuid", security: "definer" },
|
|
493
|
+
{ name: "relation_edges_withdraw", args: "p_organization_id uuid, p_field_ids uuid[], p_why text", returns: "integer", security: "definer" },
|
|
465
494
|
{ name: "relation_own", args: "p_organization_id uuid, p_owner_id uuid, p_target_id uuid", returns: "uuid", security: "definer" },
|
|
466
495
|
{ 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" },
|
|
467
496
|
{ name: "relation_target_external", args: "p_connection_token text, p_external_table text, p_external_key text", returns: "jsonb", security: "definer" },
|
|
@@ -476,6 +505,7 @@ var STORE_DOORS = [
|
|
|
476
505
|
{ name: "rollup_value", args: "p_organization_id uuid, p_record_id uuid, p_field_data jsonb", returns: "jsonb", security: "invoker" },
|
|
477
506
|
{ name: "rule_applies", args: "p_organization_id uuid, p_rule_id uuid, p_record_id uuid", returns: "jsonb", security: "invoker" },
|
|
478
507
|
{ name: "rule_context", args: "p_organization_id uuid, p_record_id uuid", returns: "jsonb", security: "invoker" },
|
|
508
|
+
{ name: "rule_declare", args: "p_organization_id uuid, p_spec jsonb, p_rule_id uuid DEFAULT NULL::uuid", returns: "uuid", security: "definer" },
|
|
479
509
|
{ 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" },
|
|
480
510
|
{ name: "rule_eval", args: "p_organization_id uuid, p_expr jsonb, p_values jsonb, p_context jsonb DEFAULT '{}'::jsonb", returns: "jsonb", security: "invoker" },
|
|
481
511
|
{ name: "rule_field_key", args: "p_organization_id uuid, p_field_id uuid", returns: "text", security: "invoker" },
|
|
@@ -536,24 +566,36 @@ var STORE_DOORS = [
|
|
|
536
566
|
{ name: "visible_record_ids", args: "p_user_id uuid, p_required permission_level DEFAULT 'viewer'::permission_level", returns: "TABLE(id uuid)", security: "definer" },
|
|
537
567
|
{ 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" },
|
|
538
568
|
{ name: "widget_kernel_id", args: "", returns: "uuid", security: "invoker" },
|
|
569
|
+
{ 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" },
|
|
570
|
+
{ 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" },
|
|
571
|
+
{ name: "work_approval_may_decide", args: "p_organization_id uuid, p_approval_id uuid", returns: "boolean", security: "definer" },
|
|
572
|
+
{ name: "work_approval_read", args: "p_organization_id uuid, p_approval_id uuid", returns: "jsonb", security: "definer" },
|
|
573
|
+
{ 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" },
|
|
574
|
+
{ 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" },
|
|
539
575
|
{ name: "work_assignment_fields", args: "p_options_table_id uuid DEFAULT NULL::uuid", returns: "TABLE(key text, label text, spec jsonb)", security: "invoker" },
|
|
540
|
-
{ name: "work_has_assignment", args: "p_organization_id uuid, p_table_id uuid", returns: "boolean", security: "
|
|
541
|
-
{ name: "
|
|
576
|
+
{ name: "work_has_assignment", args: "p_organization_id uuid, p_table_id uuid", returns: "boolean", security: "definer" },
|
|
577
|
+
{ 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" },
|
|
578
|
+
{ name: "work_instantiation_shape", args: "p_organization_id uuid, p_instantiation_id uuid", returns: "jsonb", security: "definer" },
|
|
579
|
+
{ 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" },
|
|
580
|
+
{ name: "work_person", args: "p_organization_id uuid, p_user_id uuid, p_create boolean DEFAULT true", returns: "uuid", security: "definer" },
|
|
581
|
+
{ 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" },
|
|
542
582
|
{ name: "work_relation_kinds", args: "", returns: "TABLE(kind text, available boolean, why text)", security: "invoker" },
|
|
543
|
-
{ name: "
|
|
544
|
-
{ name: "
|
|
545
|
-
{ name: "
|
|
583
|
+
{ name: "work_set_state", args: "p_organization_id uuid, p_record_id uuid, p_state_id uuid", returns: "jsonb", security: "definer" },
|
|
584
|
+
{ name: "work_slot_expire", args: "p_organization_id uuid, p_table_id uuid", returns: "integer", security: "definer" },
|
|
585
|
+
{ 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" },
|
|
586
|
+
{ 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" },
|
|
546
587
|
{ name: "work_slot_index_name", args: "p_table_id uuid", returns: "text", security: "invoker" },
|
|
547
|
-
{ name: "work_slot_release", args: "p_organization_id uuid, p_hold_id uuid", returns: "boolean", security: "
|
|
548
|
-
{ 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: "
|
|
588
|
+
{ name: "work_slot_release", args: "p_organization_id uuid, p_hold_id uuid", returns: "boolean", security: "definer" },
|
|
589
|
+
{ 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" },
|
|
549
590
|
{ name: "work_states", args: "", returns: "TABLE(sort integer, name text, terminal boolean, next text[])", security: "invoker" },
|
|
550
|
-
{ name: "work_take_assignment", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "
|
|
551
|
-
{ name: "work_template_declare", args: "p_organization_id uuid, p_name text, p_graph jsonb", returns: "uuid", security: "
|
|
552
|
-
{ name: "work_template_instantiate", args: "p_organization_id uuid, p_template_id uuid, p_overrides jsonb DEFAULT '{}'::jsonb", returns: "jsonb", security: "
|
|
591
|
+
{ name: "work_take_assignment", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "definer" },
|
|
592
|
+
{ name: "work_template_declare", args: "p_organization_id uuid, p_name text, p_graph jsonb", returns: "uuid", security: "definer" },
|
|
593
|
+
{ name: "work_template_instantiate", args: "p_organization_id uuid, p_template_id uuid, p_overrides jsonb DEFAULT '{}'::jsonb", returns: "jsonb", security: "definer" },
|
|
553
594
|
{ name: "work_template_refusal", args: "p_graph jsonb", returns: "text", security: "invoker" },
|
|
554
|
-
{ name: "work_template_shape", args: "p_organization_id uuid, p_template_id uuid", returns: "jsonb", security: "
|
|
555
|
-
{ name: "
|
|
556
|
-
{ name: "
|
|
595
|
+
{ name: "work_template_shape", args: "p_organization_id uuid, p_template_id uuid", returns: "jsonb", security: "definer" },
|
|
596
|
+
{ 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" },
|
|
597
|
+
{ name: "work_transition_refusal", args: "p_organization_id uuid, p_from_state_id uuid, p_to_state_id uuid", returns: "text", security: "definer" },
|
|
598
|
+
{ 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" }
|
|
557
599
|
];
|
|
558
600
|
var STORE_KNOBS = [
|
|
559
601
|
{ key: "accessible_entity_ids_guard", value: "true", type: "boolean" },
|
|
@@ -593,16 +635,17 @@ var STORE_KNOBS = [
|
|
|
593
635
|
{ key: "world_publish_enabled", value: "false", type: "boolean" }
|
|
594
636
|
];
|
|
595
637
|
var STORE_REFUSAL_CODES = [
|
|
596
|
-
{ 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" },
|
|
597
|
-
{ 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" },
|
|
598
|
-
{ 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" },
|
|
638
|
+
{ 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" },
|
|
639
|
+
{ 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" },
|
|
640
|
+
{ 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" },
|
|
599
641
|
{ code: "22012", raised_by: "rule_eval" },
|
|
600
|
-
{ 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" },
|
|
601
|
-
{ 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" },
|
|
602
|
-
{ 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" },
|
|
603
|
-
{ 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" },
|
|
642
|
+
{ 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" },
|
|
643
|
+
{ 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" },
|
|
644
|
+
{ 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" },
|
|
645
|
+
{ 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" },
|
|
604
646
|
{ code: "40001", raised_by: "has_visibility_at" },
|
|
605
|
-
{ 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" },
|
|
647
|
+
{ 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" },
|
|
648
|
+
{ code: "42703", raised_by: "entity_table" },
|
|
606
649
|
{ code: "53400", raised_by: "anon_rate_take,delete_cascade_closure,promote_field" },
|
|
607
650
|
{ code: "54001", raised_by: "record_delete" },
|
|
608
651
|
{ code: "PT409", raised_by: "record_update" }
|
|
@@ -1712,6 +1755,24 @@ var DOORS = {
|
|
|
1712
1755
|
fieldDeclare: "field_declare",
|
|
1713
1756
|
fieldUpdate: "field_update",
|
|
1714
1757
|
fieldRetire: "field_retire",
|
|
1758
|
+
// CUSTOM FIELDS ON A STANDARD BUSINESS TABLE. Every door above is keyed by a
|
|
1759
|
+
// custom Table's uuid, and a standard table has no Table record - so until
|
|
1760
|
+
// 2026-09-20 `custom.applicable_fields(org, 'party', null)` answered `22P02
|
|
1761
|
+
// invalid input syntax for uuid` and there was no other way in. These are
|
|
1762
|
+
// keyed by the REGISTRY TOKEN instead, and they are one set for all 643
|
|
1763
|
+
// tables the registry types Entity or Detail. The three value doors are
|
|
1764
|
+
// SECURITY INVOKER in the database on purpose: the standard table's own
|
|
1765
|
+
// row-level security is what decides who may read and write its rows, and a
|
|
1766
|
+
// definer wrapper would replace it with a second access system.
|
|
1767
|
+
entityTable: "entity_table",
|
|
1768
|
+
entityFields: "entity_fields",
|
|
1769
|
+
entityFieldDeclare: "entity_field_declare",
|
|
1770
|
+
entityFieldUpdate: "entity_field_update",
|
|
1771
|
+
entityFieldRetire: "entity_field_retire",
|
|
1772
|
+
entityFieldRights: "entity_field_rights",
|
|
1773
|
+
entityRecordRead: "entity_record_read",
|
|
1774
|
+
entityValueWrite: "entity_value_write",
|
|
1775
|
+
entityRecordsFind: "entity_records_find",
|
|
1715
1776
|
tableCapacity: "table_capacity",
|
|
1716
1777
|
tableStorage: "table_storage",
|
|
1717
1778
|
promoteTable: "promote_table",
|
|
@@ -1749,6 +1810,17 @@ var DOORS = {
|
|
|
1749
1810
|
ruleMembership: "rule_membership",
|
|
1750
1811
|
ruleRun: "rule_run",
|
|
1751
1812
|
ruleEval: "rule_eval",
|
|
1813
|
+
// REC-15: the door that makes a Rule a RULE. `custom.record_write` into the
|
|
1814
|
+
// Rule kernel produces a valid Rule document carrying `data_class = 'record'`,
|
|
1815
|
+
// and every reader that goes LOOKING for a Rule looks for the class — so a
|
|
1816
|
+
// subscription written that way was invisible to DOOR-18 and nothing fired.
|
|
1817
|
+
// PRODUCTS row 1 — a form is a view on a real Table. `forms` lists an
|
|
1818
|
+
// organization's own, `formDeclare` writes one, and `anonPublish` is the one
|
|
1819
|
+
// act that opens it to people with no account. The PUBLIC pair
|
|
1820
|
+
// (`custom.form_public`, `custom.form_submit`) is deliberately absent: those
|
|
1821
|
+
// are server-lane doors and a browser never calls them.
|
|
1822
|
+
forms: "forms",
|
|
1823
|
+
formDeclare: "form_declare",
|
|
1752
1824
|
// The eighth verb (AGT-N-8): a grouped, bucketed, filtered count/sum/avg/
|
|
1753
1825
|
// min/max computed INSIDE the read door's own query, so a chart shows exactly
|
|
1754
1826
|
// the rows this person may see and never fetches the ones they may not.
|
|
@@ -1807,6 +1879,23 @@ var DOORS = {
|
|
|
1807
1879
|
workSlotRelease: "work_slot_release",
|
|
1808
1880
|
workSlotHolds: "work_slot_holds",
|
|
1809
1881
|
workSlotExpire: "work_slot_expire",
|
|
1882
|
+
// THE WORK LAYER'S OWN DOORS (lane WORK-DOORS, 2026-09-20). Until this lane
|
|
1883
|
+
// all nineteen `custom.work_*` functions were SECURITY INVOKER with no client
|
|
1884
|
+
// grant: REC-69, REC-70 and REC-71 were live in the store and unreachable
|
|
1885
|
+
// from a browser. These are the verbs a person actually uses.
|
|
1886
|
+
workPerson: "work_person",
|
|
1887
|
+
workAssign: "work_assign",
|
|
1888
|
+
workRecordStates: "work_record_states",
|
|
1889
|
+
workSetState: "work_set_state",
|
|
1890
|
+
workList: "work_list",
|
|
1891
|
+
workTemplates: "work_templates",
|
|
1892
|
+
/** THE ONE QUEUE: assignments, approvals and the agent's proposals together. */
|
|
1893
|
+
workInbox: "work_inbox",
|
|
1894
|
+
workApprovalApprovers: "work_approval_approvers",
|
|
1895
|
+
workApprovalRequest: "work_approval_request",
|
|
1896
|
+
workApprovalMayDecide: "work_approval_may_decide",
|
|
1897
|
+
workApprovalDecide: "work_approval_decide",
|
|
1898
|
+
workApprovalRead: "work_approval_read",
|
|
1810
1899
|
// Declared here BECAUSE they do not exist yet: naming them is what makes the
|
|
1811
1900
|
// absence visible to `pnpm check:store-registry` and to the suite.
|
|
1812
1901
|
metadataSearch: "metadata_search",
|
|
@@ -1838,6 +1927,14 @@ var BY_SQLSTATE = {
|
|
|
1838
1927
|
// is wrong for the shape the store holds, which is what `invalid_argument`
|
|
1839
1928
|
// already means — the store's own sentence names the value and the type.
|
|
1840
1929
|
"22P02": "invalid_argument",
|
|
1930
|
+
// 42703 — a column that is not there. The store raises it from
|
|
1931
|
+
// `custom.entity_table`, which is asked for a column by NAME, so the class is
|
|
1932
|
+
// exactly "the call named something the shape does not have": the same thing
|
|
1933
|
+
// `invalid_argument` already means, and the store's own sentence names the
|
|
1934
|
+
// column. Added 2026-09-20 (lane FORMS) because the package's live-door suite
|
|
1935
|
+
// caught it raised by a door this package did not know about — which is the
|
|
1936
|
+
// suite working, and is why the map is a census rather than a guess.
|
|
1937
|
+
"42703": "invalid_argument",
|
|
1841
1938
|
"02000": "not_found",
|
|
1842
1939
|
"23503": "missing_reference",
|
|
1843
1940
|
"23505": "already_exists",
|
|
@@ -2232,6 +2329,88 @@ function createRecordsClient(config) {
|
|
|
2232
2329
|
"fieldDeclare"
|
|
2233
2330
|
);
|
|
2234
2331
|
},
|
|
2332
|
+
async entityTable({ token }) {
|
|
2333
|
+
const answer = await callDoor(
|
|
2334
|
+
DOORS.entityTable,
|
|
2335
|
+
{ p_token: token },
|
|
2336
|
+
"entityTable"
|
|
2337
|
+
);
|
|
2338
|
+
if (!answer.ok) return err(answer.error);
|
|
2339
|
+
const row = Array.isArray(answer.data) ? answer.data[0] : answer.data;
|
|
2340
|
+
if (!row) {
|
|
2341
|
+
return err({
|
|
2342
|
+
code: "not_found",
|
|
2343
|
+
message: `The registry answered nothing for the table "${token}".`,
|
|
2344
|
+
hint: "REC-33: a standard table is named by its registry token. Nothing was read."
|
|
2345
|
+
});
|
|
2346
|
+
}
|
|
2347
|
+
return ok(row);
|
|
2348
|
+
},
|
|
2349
|
+
async entityFields({ token }) {
|
|
2350
|
+
const rows = await callDoor(
|
|
2351
|
+
DOORS.entityFields,
|
|
2352
|
+
{ p_organization_id: org, p_token: token },
|
|
2353
|
+
"entityFields"
|
|
2354
|
+
);
|
|
2355
|
+
if (!rows.ok) return err(rows.error);
|
|
2356
|
+
return ok((rows.data ?? []).map((row) => ({ id: row.id, ...row.data })));
|
|
2357
|
+
},
|
|
2358
|
+
async entityFieldDeclare({ token, spec }) {
|
|
2359
|
+
return callDoor(
|
|
2360
|
+
DOORS.entityFieldDeclare,
|
|
2361
|
+
{ p_organization_id: org, p_token: token, p_spec: spec },
|
|
2362
|
+
"entityFieldDeclare"
|
|
2363
|
+
);
|
|
2364
|
+
},
|
|
2365
|
+
async entityFieldUpdate({ field_id, patch }) {
|
|
2366
|
+
return callDoor(
|
|
2367
|
+
DOORS.entityFieldUpdate,
|
|
2368
|
+
{ p_organization_id: org, p_field_id: field_id, p_patch: patch },
|
|
2369
|
+
"entityFieldUpdate"
|
|
2370
|
+
);
|
|
2371
|
+
},
|
|
2372
|
+
async entityFieldRetire({ field_id }) {
|
|
2373
|
+
return callDoor(
|
|
2374
|
+
DOORS.entityFieldRetire,
|
|
2375
|
+
{ p_organization_id: org, p_field_id: field_id },
|
|
2376
|
+
"entityFieldRetire"
|
|
2377
|
+
);
|
|
2378
|
+
},
|
|
2379
|
+
async entityFieldRights({ token }) {
|
|
2380
|
+
return callDoor(
|
|
2381
|
+
DOORS.entityFieldRights,
|
|
2382
|
+
{ p_organization_id: org, p_token: token },
|
|
2383
|
+
"entityFieldRights"
|
|
2384
|
+
);
|
|
2385
|
+
},
|
|
2386
|
+
async entityRecordRead({ token, record_id }) {
|
|
2387
|
+
return callDoor(
|
|
2388
|
+
DOORS.entityRecordRead,
|
|
2389
|
+
{ p_organization_id: org, p_token: token, p_record_id: record_id },
|
|
2390
|
+
"entityRecordRead"
|
|
2391
|
+
);
|
|
2392
|
+
},
|
|
2393
|
+
async entityValueWrite({ token, record_id, patch }) {
|
|
2394
|
+
return callDoor(
|
|
2395
|
+
DOORS.entityValueWrite,
|
|
2396
|
+
{ p_organization_id: org, p_token: token, p_record_id: record_id, p_patch: patch },
|
|
2397
|
+
"entityValueWrite"
|
|
2398
|
+
);
|
|
2399
|
+
},
|
|
2400
|
+
async entityRecordsFind({ token, key, value, limit, offset }) {
|
|
2401
|
+
return callDoor(
|
|
2402
|
+
DOORS.entityRecordsFind,
|
|
2403
|
+
{
|
|
2404
|
+
p_organization_id: org,
|
|
2405
|
+
p_token: token,
|
|
2406
|
+
p_key: key,
|
|
2407
|
+
p_value: value === void 0 ? null : value,
|
|
2408
|
+
...limit === void 0 ? {} : { p_limit: limit },
|
|
2409
|
+
...offset === void 0 ? {} : { p_offset: offset }
|
|
2410
|
+
},
|
|
2411
|
+
"entityRecordsFind"
|
|
2412
|
+
);
|
|
2413
|
+
},
|
|
2235
2414
|
async fieldUpdate({ field_id, patch }) {
|
|
2236
2415
|
return callDoor(
|
|
2237
2416
|
DOORS.fieldUpdate,
|
|
@@ -2276,6 +2455,31 @@ function createRecordsClient(config) {
|
|
|
2276
2455
|
"ruleMembership"
|
|
2277
2456
|
);
|
|
2278
2457
|
},
|
|
2458
|
+
async forms(args) {
|
|
2459
|
+
return callDoor(
|
|
2460
|
+
DOORS.forms,
|
|
2461
|
+
{ p_organization_id: org, p_table_id: args?.table_id ?? null },
|
|
2462
|
+
"forms"
|
|
2463
|
+
);
|
|
2464
|
+
},
|
|
2465
|
+
async formDeclare(args) {
|
|
2466
|
+
return callDoor(
|
|
2467
|
+
DOORS.formDeclare,
|
|
2468
|
+
{
|
|
2469
|
+
p_organization_id: org,
|
|
2470
|
+
p_table_id: args.table_id,
|
|
2471
|
+
p_title: args.title,
|
|
2472
|
+
p_questions: args.questions,
|
|
2473
|
+
p_presentation: args.presentation ?? {},
|
|
2474
|
+
p_submission_cap: args.submission_cap ?? null,
|
|
2475
|
+
p_quarantine_rule_id: args.quarantine_rule_id ?? null,
|
|
2476
|
+
p_notify_rule_id: args.notify_rule_id ?? null,
|
|
2477
|
+
p_form_id: args.form_id ?? null,
|
|
2478
|
+
p_slug: args.slug ?? null
|
|
2479
|
+
},
|
|
2480
|
+
"formDeclare"
|
|
2481
|
+
);
|
|
2482
|
+
},
|
|
2279
2483
|
async ruleRun({ rule_id, values, context }) {
|
|
2280
2484
|
return callDoor(
|
|
2281
2485
|
DOORS.ruleRun,
|
|
@@ -2624,6 +2828,128 @@ function createRecordsClient(config) {
|
|
|
2624
2828
|
"workSlotExpire"
|
|
2625
2829
|
);
|
|
2626
2830
|
},
|
|
2831
|
+
// ── the work layer a person actually uses ────────────────────────────
|
|
2832
|
+
async workInbox(args) {
|
|
2833
|
+
return callDoor(
|
|
2834
|
+
DOORS.workInbox,
|
|
2835
|
+
{
|
|
2836
|
+
p_organization_id: org,
|
|
2837
|
+
p_limit: args?.limit ?? 50,
|
|
2838
|
+
p_offset: args?.offset ?? 0,
|
|
2839
|
+
p_include_decided: args?.includeDecided ?? false
|
|
2840
|
+
},
|
|
2841
|
+
"workInbox"
|
|
2842
|
+
);
|
|
2843
|
+
},
|
|
2844
|
+
async workList(args) {
|
|
2845
|
+
return callDoor(
|
|
2846
|
+
DOORS.workList,
|
|
2847
|
+
{
|
|
2848
|
+
p_organization_id: org,
|
|
2849
|
+
p_flavour: args?.flavour ?? "mine",
|
|
2850
|
+
p_include_finished: args?.includeFinished ?? false,
|
|
2851
|
+
p_limit: args?.limit ?? 100,
|
|
2852
|
+
p_offset: args?.offset ?? 0
|
|
2853
|
+
},
|
|
2854
|
+
"workList"
|
|
2855
|
+
);
|
|
2856
|
+
},
|
|
2857
|
+
async workAssign({ record_id, user_id = null, dueDate = null, clearDue = false }) {
|
|
2858
|
+
return callDoor(
|
|
2859
|
+
DOORS.workAssign,
|
|
2860
|
+
{
|
|
2861
|
+
p_organization_id: org,
|
|
2862
|
+
p_record_id: record_id,
|
|
2863
|
+
p_assignee_user_id: user_id,
|
|
2864
|
+
p_due_date: dueDate,
|
|
2865
|
+
p_clear_due: clearDue
|
|
2866
|
+
},
|
|
2867
|
+
"workAssign"
|
|
2868
|
+
);
|
|
2869
|
+
},
|
|
2870
|
+
async workRecordStates({ record_id }) {
|
|
2871
|
+
return callDoor(
|
|
2872
|
+
DOORS.workRecordStates,
|
|
2873
|
+
{ p_organization_id: org, p_record_id: record_id },
|
|
2874
|
+
"workRecordStates"
|
|
2875
|
+
);
|
|
2876
|
+
},
|
|
2877
|
+
async workSetState({ record_id, state_id }) {
|
|
2878
|
+
return callDoor(
|
|
2879
|
+
DOORS.workSetState,
|
|
2880
|
+
{ p_organization_id: org, p_record_id: record_id, p_state_id: state_id },
|
|
2881
|
+
"workSetState"
|
|
2882
|
+
);
|
|
2883
|
+
},
|
|
2884
|
+
async workPerson({ user_id, create = true }) {
|
|
2885
|
+
return callDoor(
|
|
2886
|
+
DOORS.workPerson,
|
|
2887
|
+
{ p_organization_id: org, p_user_id: user_id, p_create: create },
|
|
2888
|
+
"workPerson"
|
|
2889
|
+
);
|
|
2890
|
+
},
|
|
2891
|
+
async workTemplates(args) {
|
|
2892
|
+
return callDoor(
|
|
2893
|
+
DOORS.workTemplates,
|
|
2894
|
+
{ p_organization_id: org, p_limit: args?.limit ?? 100 },
|
|
2895
|
+
"workTemplates"
|
|
2896
|
+
);
|
|
2897
|
+
},
|
|
2898
|
+
async workApprovalApprovers({ subject_id, approver_id = null }) {
|
|
2899
|
+
return callDoor(
|
|
2900
|
+
DOORS.workApprovalApprovers,
|
|
2901
|
+
{ p_organization_id: org, p_subject_id: subject_id, p_approver_id: approver_id },
|
|
2902
|
+
"workApprovalApprovers"
|
|
2903
|
+
);
|
|
2904
|
+
},
|
|
2905
|
+
async workApprovalRequest({
|
|
2906
|
+
subject_id,
|
|
2907
|
+
change,
|
|
2908
|
+
note = null,
|
|
2909
|
+
approver_id = null,
|
|
2910
|
+
origin = "person",
|
|
2911
|
+
conversation_id = null
|
|
2912
|
+
}) {
|
|
2913
|
+
return callDoor(
|
|
2914
|
+
DOORS.workApprovalRequest,
|
|
2915
|
+
{
|
|
2916
|
+
p_organization_id: org,
|
|
2917
|
+
p_subject_id: subject_id,
|
|
2918
|
+
p_change: change,
|
|
2919
|
+
p_note: note,
|
|
2920
|
+
p_approver_id: approver_id,
|
|
2921
|
+
p_origin: origin,
|
|
2922
|
+
p_conversation_id: conversation_id
|
|
2923
|
+
},
|
|
2924
|
+
"workApprovalRequest"
|
|
2925
|
+
);
|
|
2926
|
+
},
|
|
2927
|
+
async workApprovalMayDecide({ approval_id }) {
|
|
2928
|
+
return callDoor(
|
|
2929
|
+
DOORS.workApprovalMayDecide,
|
|
2930
|
+
{ p_organization_id: org, p_approval_id: approval_id },
|
|
2931
|
+
"workApprovalMayDecide"
|
|
2932
|
+
);
|
|
2933
|
+
},
|
|
2934
|
+
async workApprovalDecide({ approval_id, approve, note = null }) {
|
|
2935
|
+
return callDoor(
|
|
2936
|
+
DOORS.workApprovalDecide,
|
|
2937
|
+
{
|
|
2938
|
+
p_organization_id: org,
|
|
2939
|
+
p_approval_id: approval_id,
|
|
2940
|
+
p_approve: approve,
|
|
2941
|
+
p_note: note
|
|
2942
|
+
},
|
|
2943
|
+
"workApprovalDecide"
|
|
2944
|
+
);
|
|
2945
|
+
},
|
|
2946
|
+
async workApprovalRead({ approval_id }) {
|
|
2947
|
+
return callDoor(
|
|
2948
|
+
DOORS.workApprovalRead,
|
|
2949
|
+
{ p_organization_id: org, p_approval_id: approval_id },
|
|
2950
|
+
"workApprovalRead"
|
|
2951
|
+
);
|
|
2952
|
+
},
|
|
2627
2953
|
// ── the trust doors ──────────────────────────────────────────────────
|
|
2628
2954
|
async isExternalPrincipal(args) {
|
|
2629
2955
|
return trustDoor(
|
|
@@ -2684,10 +3010,12 @@ function createRecordsClient(config) {
|
|
|
2684
3010
|
"publishToWorld"
|
|
2685
3011
|
);
|
|
2686
3012
|
},
|
|
2687
|
-
async ruleDeclare() {
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
3013
|
+
async ruleDeclare({ spec, rule_id }) {
|
|
3014
|
+
return callDoor(
|
|
3015
|
+
DOORS.ruleDeclare,
|
|
3016
|
+
{ p_organization_id: org, p_spec: spec, p_rule_id: rule_id ?? null },
|
|
3017
|
+
"ruleDeclare"
|
|
3018
|
+
);
|
|
2691
3019
|
},
|
|
2692
3020
|
async metadataSearch() {
|
|
2693
3021
|
const refusal = doorAbsent(DOORS.metadataSearch);
|