@ai-matrx/records 0.30.0 → 0.37.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 CHANGED
@@ -1,5 +1,113 @@
1
1
  # Changelog — @ai-matrx/records
2
2
 
3
+ ## 0.37.0
4
+
5
+ **Three doors the store already had and this client could not reach.**
6
+
7
+ Until this release the only way to a booking page or a saved view was to ask an
8
+ agent, because no method on `RecordsClient` called the doors that make them —
9
+ so the agent was not the FASTER path to those things, it was the ONLY one.
10
+
11
+ * `bookingDeclare` — `custom.booking_declare`, the owner's side of a booking
12
+ page. `admin` on the Table, because a booking page decides what a stranger may
13
+ write into it and which hours of the organization's week are on offer. It does
14
+ NOT publish: `anonPublish` is still the one act that opens a public surface,
15
+ for a booking page exactly as for a form. `BookingAvailability`,
16
+ `BookingWindow` and `BookingDeclared` are the answer's shape — a screen shows
17
+ the availability that came BACK, never the draft it sent, because the store
18
+ owns every default.
19
+ * `views` — `custom.views`, the saved views of a Table. Narrowed in SQL as the
20
+ definer to Tables the caller can already open, so a list can never reveal a
21
+ Table.
22
+ * `viewDeclare` — `custom.view_declare`. VIEWER on the Table, not editor:
23
+ writing down a question about a Table is not changing it. A subscription is
24
+ written OVER a saved view, so without this door a person who had never saved
25
+ one had nothing to subscribe to and "email me this every Monday" had nowhere
26
+ to land.
27
+
28
+ ## 0.36.0
29
+
30
+ Republish of 0.35.0's contents. 0.35.0 never reached npm: its gate was red on
31
+ this package's OWN live-doors fixture, which wrote an undeclared column `n` into
32
+ its probe table — refused, correctly, by `custom._undeclared_key_guard` (23514,
33
+ REC-1 / REC-51) the moment lane FIELD-TRUTH landed it. The door had not
34
+ regressed; the fixture was writing a column nobody had declared. Fixed at the
35
+ fixture, never at the guard.
36
+
37
+ ## 0.35.0
38
+
39
+ **A gate a screen can read back, and a preview of what it would do today.**
40
+
41
+ A stage gate was saved as one Rule whose expression is an `or` of four arms, and
42
+ that compiled form was the only copy of it. `pipelineRead` handed a settings
43
+ screen the gate's name and its sentence and nothing else — so an editor built on
44
+ it would open the Birchwood Avenue renovation's "$5,000 needs a second quote"
45
+ rule with a BLANK condition and overwrite it the first time somebody pressed
46
+ Save.
47
+
48
+ `PipelineRule` now carries `when` and `demands` as they were written, and
49
+ `on_fail` — so an approval gate can never read back as a refusal.
50
+
51
+ `pipelineGatePreview({ table_id, stage, gate })` answers the one question
52
+ somebody writing a rule that refuses their colleagues' work actually has: of the
53
+ cards on this board today, how many would this turn away, and which three. It
54
+ takes the GATE rather than a rule id, because the whole point is judging one
55
+ that has not been saved. The store compiles it with the same compiler
56
+ `pipelineDeclare` uses, so this count and the refusal at the door cannot
57
+ disagree at the edge of the condition — which is the only place anybody looks.
58
+
59
+ **`PT428` is a real answer and this package called it `internal`.** The release
60
+ gate's live refusal census found it. A gate whose `on_fail` is
61
+ `require_approval` files the request and leaves the record where it was; a
62
+ caller meets that code whenever the move went through the ordinary write door.
63
+ It gets its own `needs_approval` code rather than joining `refused_by_rule`,
64
+ because the work was neither rejected nor done — a screen that drew it as a
65
+ refusal would tell somebody their work was turned down while it is being
66
+ considered.
67
+
68
+ **The door mirror had gone stale, twice.** `store.generated.ts` claimed
69
+ `pipeline_pending` was absent while the store had it, which is what turned the
70
+ 0.32.0 publish red; 0.34.0 then went red on `pipeline_gate_preview` the same
71
+ way, because the regenerated file was lost to a merge in the shared checkout
72
+ before it was committed. Regenerated from the live store and committed with the
73
+ change it describes: 538 doors, 25 rule node kinds — which picks up
74
+ `sibling_count`, the node a second-quote demand is written with.
75
+
76
+ That census is the guard working, and it has now been the thing that found a
77
+ missing door or a missing refusal class six times. It is worth saying why it
78
+ keeps firing: this package mirrors a store several lanes are landing on at once,
79
+ so a mirror regenerated ten minutes before a commit is already a claim about the
80
+ past.
81
+
82
+ ## 0.33.0
83
+
84
+ **One closed door beside a record took the record away.**
85
+
86
+ Cedar Ridge Dental's own owner opened a staff record in his own organization and
87
+ read "You do not have access to this" — above a version history, a running
88
+ onboarding checklist and a comment box that had all loaded perfectly. Reported
89
+ twice: by lane SCREENS-2 on that practice, and by crew E2, who asked the doors
90
+ from that very seat and found the record read answering correctly. It was never
91
+ the store.
92
+
93
+ `recordRead({ withComputed: true })` makes a second call, to
94
+ `custom.computed_provenance` — which Rule produced which worked-out value (FLD-9),
95
+ a footnote beside the record. Measured on the live catalogue, 2026-09-21:
96
+ `read_record` t, `record_history` t, `field_history` t, `computed_provenance` **f**.
97
+ That footnote's refusal was returned AS THE RECORD'S. `Peek` is the one caller
98
+ that asks with provenance, which is exactly why the record page refused and every
99
+ other panel on it did not.
100
+
101
+ A decorative read may never fail the primary one — and may not fail silently
102
+ either. The record comes back, `computed` is empty, and the new
103
+ `RecordRead.computedUnavailable` carries what the footnote's door said, so a
104
+ screen can say it could not look rather than draw nothing and mean two different
105
+ things by it. `src/__tests__/a-footnote-never-takes-the-record.test.ts` — three
106
+ clauses, two red on 0.32.0's bytes.
107
+
108
+ **Consumer action:** none. `computedUnavailable` is optional, and `null` when the
109
+ footnote read fine or was never asked for.
110
+
3
111
  ## 0.30.0
4
112
 
5
113
  **The chair's two rulings on the no-fake-data law, made structural.**
@@ -61,6 +61,8 @@ __export(core_exports, {
61
61
  RETIRED_ACTOR_WORDS: () => RETIRED_ACTOR_WORDS,
62
62
  RULE_NODE_KINDS: () => RULE_NODE_KINDS,
63
63
  RULE_USES: () => RULE_USES,
64
+ STAGE_RULE_ENFORCEMENT: () => STAGE_RULE_ENFORCEMENT,
65
+ STAGE_RULE_ON_FAIL: () => STAGE_RULE_ON_FAIL,
64
66
  STORAGE_MODES: () => STORAGE_MODES,
65
67
  STORE_DOORS: () => STORE_DOORS,
66
68
  STORE_KNOBS: () => STORE_KNOBS,
@@ -247,6 +249,8 @@ function looksLikeAnId(value) {
247
249
 
248
250
  // src/pipeline.ts
249
251
  var PIPELINE_RULE_KINDS = ["moves", "requires", "who", "limit", "entry"];
252
+ var STAGE_RULE_ON_FAIL = ["refuse", "require_approval"];
253
+ var STAGE_RULE_ENFORCEMENT = ["refuse", "warn"];
250
254
  function mayDrag(level) {
251
255
  return level === "editor" || level === "admin" || level === "owner";
252
256
  }
@@ -603,6 +607,7 @@ var RULE_NODE_KINDS = [
603
607
  { node: "parent_field", evaluated_by: "W1-RULE-APPLY" },
604
608
  { node: "present", evaluated_by: "W1-RULE" },
605
609
  { node: "previous", evaluated_by: "PIPELINES" },
610
+ { node: "sibling_count", evaluated_by: "STAGE-RULES" },
606
611
  { node: "stage_count", evaluated_by: "PIPELINES" },
607
612
  { node: "sub", evaluated_by: "W1-RULE" }
608
613
  ];
@@ -930,7 +935,9 @@ var STORE_DOORS = [
930
935
  { name: "pin_agent_cells", args: "p_new jsonb, p_old jsonb, p_agent_keys text[]", returns: "jsonb", security: "invoker" },
931
936
  { name: "pipeline_board", args: "p_organization_id uuid, p_table_id uuid, p_measure text DEFAULT NULL::text", returns: "TABLE(stage_key text, stage_label text, stage_position integer, cards bigint, total numeric, wip_limit integer, over_limit boolean)", security: "definer" },
932
937
  { name: "pipeline_declare", args: "p_organization_id uuid, p_table_id uuid, p_spec jsonb", returns: "jsonb", security: "definer" },
938
+ { name: "pipeline_gate_preview", args: "p_organization_id uuid, p_table_id uuid, p_stage text, p_gate jsonb", returns: "jsonb", security: "definer" },
933
939
  { name: "pipeline_move", args: "p_organization_id uuid, p_record_id uuid, p_to text, p_also jsonb DEFAULT '{}'::jsonb, p_expected_version integer DEFAULT NULL::integer", returns: "jsonb", security: "definer" },
940
+ { name: "pipeline_pending", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "definer" },
934
941
  { name: "pipeline_read", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "definer" },
935
942
  { name: "pipeline_transition_refusal", args: "p_organization_id uuid, p_record_id uuid, p_to text", returns: "jsonb", security: "definer" },
936
943
  { name: "portal_admits", args: "p_organization_id uuid, p_user_id uuid DEFAULT NULL::uuid", returns: "boolean", security: "definer" },
@@ -997,6 +1004,7 @@ var STORE_DOORS = [
997
1004
  { name: "record_carrying_edges", args: "p_id uuid, p_data_class text, p_data jsonb, p_deleted_at timestamp with time zone", returns: "TABLE(container_id uuid, item_id uuid, edge_role text)", security: "invoker" },
998
1005
  { name: "record_delete", args: "p_organization_id uuid, p_record_id uuid", returns: "timestamp with time zone", security: "definer" },
999
1006
  { name: "record_history", args: "p_organization_id uuid, p_record_id uuid, p_limit integer DEFAULT 200, p_offset integer DEFAULT 0", returns: "TABLE(version integer, occurred_at timestamp with time zone, operation text, operation_label text, actor jsonb, changes jsonb, migration_id uuid, undoable boolean)", security: "definer" },
1007
+ { name: "record_platform_keys", args: "", returns: "text[]", security: "invoker" },
1000
1008
  { name: "record_relation_edges", args: "p_organization_id uuid, p_id uuid, p_table_id uuid, p_data_class text, p_data jsonb, p_deleted_at timestamp with time zone", returns: "TABLE(target_id uuid, edge_role text, field_id uuid, ord integer)", security: "invoker" },
1001
1009
  { name: "record_reparent", args: "p_organization_id uuid, p_record_id uuid, p_parent_id uuid", returns: "void", security: "definer" },
1002
1010
  { name: "record_resolve", args: "p_organization_id uuid, p_id uuid", returns: "jsonb", security: "definer" },
@@ -1005,6 +1013,7 @@ var STORE_DOORS = [
1005
1013
  { name: "record_restore_version", args: "p_organization_id uuid, p_record_id uuid, p_version integer", returns: "jsonb", security: "definer" },
1006
1014
  { name: "record_restore_version", args: "p_organization_id uuid, p_record_id uuid, p_version integer, p_author jsonb", returns: "jsonb", security: "definer" },
1007
1015
  { name: "record_scope_context", args: "p_organization_id uuid, p_record_id uuid, p_relations integer DEFAULT 12, p_history integer DEFAULT 15, p_siblings integer DEFAULT 8", returns: "jsonb", security: "definer" },
1016
+ { name: "record_stage_pending", args: "p_organization_id uuid, p_record_id uuid", returns: "jsonb", security: "definer" },
1008
1017
  { name: "record_state_as_of", args: "p_record_id uuid, p_at timestamp with time zone", returns: "TABLE(state jsonb, replayed boolean)", security: "definer" },
1009
1018
  { name: "record_table", args: "p_organization_id uuid, p_record_id uuid", returns: "uuid", security: "definer" },
1010
1019
  { 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" },
@@ -1068,6 +1077,8 @@ var STORE_DOORS = [
1068
1077
  { name: "size_refusal", args: "p_organization_id uuid, p_data jsonb", returns: "text", security: "invoker" },
1069
1078
  { name: "source_next_pointer", args: "p_sources jsonb", returns: "text", security: "invoker" },
1070
1079
  { name: "source_pointer", args: "p_sources jsonb, p_source jsonb", returns: "text", security: "invoker" },
1080
+ { name: "stage_rule_enforcement", args: "p_organization_id uuid", returns: "text", security: "invoker" },
1081
+ { name: "stage_rule_on_fail_kinds", args: "", returns: "TABLE(behaviour text, note text)", security: "invoker" },
1071
1082
  { 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" },
1072
1083
  { name: "storage_modes", args: "", returns: "text[]", security: "invoker" },
1073
1084
  { name: "store_is_open", args: "p_organization_id uuid DEFAULT NULL::uuid", returns: "boolean", security: "invoker" },
@@ -1078,6 +1089,7 @@ var STORE_DOORS = [
1078
1089
  { 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, quiet_hours jsonb, channel text, recipient_user_id uuid, event_key text, muted boolean, mine boolean, i_may_mute boolean, last_sent_at timestamp with time zone, next_digest_at timestamp with time zone)", security: "definer" },
1079
1090
  { name: "table_capacity", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "definer" },
1080
1091
  { 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" },
1092
+ { name: "table_column_source", args: "p_organization_id uuid, p_table_id uuid", returns: "text", security: "invoker" },
1081
1093
  { name: "table_contents", args: "p_organization_id uuid, p_table_id uuid", returns: "TABLE(record_id uuid, kind text, goes_at integer)", security: "invoker" },
1082
1094
  { name: "table_declare", args: "p_organization_id uuid, p_spec jsonb", returns: "uuid", security: "definer" },
1083
1095
  { name: "table_has_a_visible_record", args: "p_user uuid, p_organization_id uuid, p_table_id uuid", returns: "boolean", security: "definer" },
@@ -1092,6 +1104,7 @@ var STORE_DOORS = [
1092
1104
  { name: "tables_at_home", args: "p_organization_id uuid, p_home_ids uuid[]", returns: "TABLE(table_id uuid, home_record_id uuid, kind text)", security: "definer" },
1093
1105
  { name: "tables_described_without_asking", args: "", returns: "TABLE(function_name text, identity_args text, why text)", security: "invoker" },
1094
1106
  { name: "trg_associations_bump_visibility", args: "", returns: "trigger", security: "definer" },
1107
+ { name: "undeclared_keys", args: "p_organization_id uuid, p_table_id uuid, p_data jsonb", returns: "text[]", security: "invoker" },
1095
1108
  { name: "validate_custom_fields", args: "p_token text, p_organization_id uuid, p_values jsonb", returns: "void", security: "invoker" },
1096
1109
  { name: "validate_value_envelope", args: "p_organization_id uuid, p_fields custom.record[], p_data jsonb", returns: "void", security: "invoker" },
1097
1110
  { name: "validate_values", args: "p_organization_id uuid, p_fields custom.record[], p_values jsonb, p_record_type text DEFAULT NULL::text", returns: "void", security: "invoker" },
@@ -1192,6 +1205,7 @@ var STORE_KNOBS = [
1192
1205
  { key: "sandbox_message_bytes", value: "65536", type: "integer" },
1193
1206
  { key: "sandbox_org_components", value: "true", type: "boolean" },
1194
1207
  { key: "signup_provisioning_guard", value: "false", type: "boolean" },
1208
+ { key: "stage_rule_enforcement", value: '"refuse"', type: "enum" },
1195
1209
  { key: "system_enabled", value: "false", type: "boolean" },
1196
1210
  { key: "table_record_ceiling", value: "150000", type: "integer" },
1197
1211
  { key: "value_max_bytes", value: "100000", type: "integer" },
@@ -1201,19 +1215,20 @@ var STORE_REFUSAL_CODES = [
1201
1215
  { code: "02000", raised_by: "_checklist_instantiate,checklist_declare,checklist_run,checklist_step_complete,checklist_step_refusal,checklist_template_shape,conversation_scope_bind,dashboard_delete,dashboard_run,doc_letterhead,doc_render_body,doc_render_document,doc_render_read,doc_sign,doc_signature_intact,doc_signature_read,doc_template_delete,doc_template_read,doc_template_save,enrich_pin,entity_field_retire,entity_field_update,entity_record_read,entity_value_write,external_history_event,external_rows,external_stub_upsert,external_writes_set,io_restore,migrate_delete,migrate_extract_parent,migrate_merge,migrate_reclass,migrate_rename,migrate_reparent,migrate_retype,migrate_split,migrate_undo,organization_clear,portal_card,portal_declare,portal_invite,portal_preview,portal_principal_bind,portal_revoke,read_record,record_delete,record_restore,record_restore_preview,record_table,record_update,relation_uncarry,share_access,share_grant,share_lane_set,share_people,share_revoke,sign_request_cancel,sign_request_create,sign_request_remind,sign_request_unchanged,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_assign,work_record_states,work_set_state" },
1202
1216
  { code: "0A000", raised_by: "checklist_step_complete,external_rows,external_source_declare,external_write_through,promote_field,promoted_index_expr,promoted_query_sql,promoted_read,rule_eval,work_assign" },
1203
1217
  { code: "22003", raised_by: "context_resolve" },
1204
- { 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,booking_declare,capture_submit,checklist_declare,context_resolve,dashboard_block_normalize,dashboard_declare,dashboard_window_sql,doc_render_write,doc_sign,doc_signature_write,doc_template_save,enrich_land,enrich_normalize,external_history_event,external_rows,external_source_declare,external_stub_upsert,external_write_through,external_writes_set,field_history,form_declare,form_submit,home_add,io_comment_write,io_import_begin,io_infer_column,io_outbox_drain,io_restore,migrate_choice_keys,migrate_purge,migrate_reclass,migrate_split,migrate_undo,organization_clear,organization_contents,pipeline_declare,portal_declare,portal_invite,portal_principal_bind,provenance_retention_days,provenance_write,query_across_homes,query_by_coordinates,query_rollup,record_delete,record_reparent,record_resolve,record_restore,record_update,record_write,record_write_many,relation_carry,relation_own,rule_declare,share_grant,sign_request_create,sign_request_sign,subscription_declare,table_declare,value_restore,view_declare,work_approval_decide,work_approval_request,work_template_declare" },
1218
+ { 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,booking_declare,capture_submit,checklist_declare,context_resolve,dashboard_block_normalize,dashboard_declare,dashboard_window_sql,doc_render_write,doc_sign,doc_signature_write,doc_template_save,enrich_land,enrich_normalize,external_history_event,external_rows,external_source_declare,external_stub_upsert,external_write_through,external_writes_set,field_history,form_declare,form_submit,home_add,io_comment_write,io_import_begin,io_infer_column,io_outbox_drain,io_restore,migrate_choice_keys,migrate_purge,migrate_reclass,migrate_split,migrate_undo,organization_clear,organization_contents,pipeline_declare,pipeline_gate_preview,portal_declare,portal_invite,portal_principal_bind,provenance_retention_days,provenance_write,query_across_homes,query_by_coordinates,query_rollup,record_delete,record_reparent,record_resolve,record_restore,record_update,record_write,record_write_many,relation_carry,relation_own,rule_declare,share_grant,sign_request_create,sign_request_sign,subscription_declare,table_declare,value_restore,view_declare,work_approval_decide,work_approval_request,work_template_declare" },
1205
1219
  { code: "22007", raised_by: "dashboard_window_sql" },
1206
1220
  { code: "22012", raised_by: "rule_eval" },
1207
1221
  { code: "22023", raised_by: "_booking_availability,_entity_custom_fields_guard,_value_envelope,_work_shape_guard,actor_word,agg_assert_key,agg_sql,anon_token_issue,booking_declare,containment_parent,dashboard_block_normalize,dashboard_window_sql,doc_render_body,doc_render_write,doc_signature_write,enrich_declare,enrich_land,enrich_normalize,enrich_pin,entity_value_write,external_history_event,external_source_declare,external_stub_upsert,external_write_through,field_history,io_export,io_import_begin,io_import_finish,io_import_plan,io_import_report,io_proposal_accept,migrate_merge,migrate_reclass,my_levels,organization_clear,page_size,pin_agent_cells,pipeline_move,portal_declare,provenance_write,query_by_coordinates,query_rollup,record_update,record_write_many,relation_carry,rule_eval,rule_members,share_grant,share_lane_set,sign_request_create,sign_request_sign,subscription_declare,table_rules,visibility_as_of,work_approval_request,work_list,work_slot_hold" },
1208
1222
  { code: "23503", raised_by: "_booking_availability,_checklist_instantiate,_containment_guard,_field_document_for,_pipeline_stage_key,_record_rule_uses,agg_digest_assemble,anon_publish,anon_rate_take,anon_token_issue,anon_write,assert_organization_wall,booking_cancel,booking_confirm,booking_declare,booking_hold,booking_reschedule,capture_publish,checklist_declare,checklist_steps_table,comment_write,dashboard_declare,delete_rule,doc_sign,doc_template_save,enrich_declare,enrich_due,enrich_land,form_declare,form_submit,home_add,inbound_declare,inbound_mail_land,inbound_set,io_comment_write,io_import_begin,io_import_finish,io_import_report,io_import_rows,io_proposal_accept,migrate_demote,migrate_promote,pipeline_board,pipeline_declare,pipeline_move,pipeline_read,pipeline_transition_refusal,promote_field,promote_table,record_applicability,record_reparent,relation_carry,relation_own,resolve_first_match,rule_applies,rule_declare,rule_eval,rule_members,rule_run,sign_request_create,subscription_mute,subscription_preview,view_declare,work_set_state,work_take_assignment,work_template_instantiate" },
1209
1223
  { code: "23505", raised_by: "_unique_rule_holds,doc_sign,doc_signature_write,entity_field_declare,field_declare,home_add,inbound_declare,io_proposal_accept,relation_carry,relation_own,share_grant,sign_request_cancel,sign_request_create,work_approval_decide,work_slot_hold" },
1210
- { code: "23514", raised_by: "_checklist_instantiate,_checklist_step_guard,_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,capture_publish,capture_sheet_declare,checklist_declare,checklist_step_complete,doc_sign,doc_signature_write,doc_template_save,entity_field_declare,entity_field_retire,entity_field_update,entity_records_find,entity_table,field_declare,field_retire,field_update,home_add,io_import_rows,migrate_merge,relation_carry,relation_own,sign_request_create,sign_request_sign,table_declare,validate_value_envelope,validate_values,work_set_state,work_slots_declare,work_take_assignment,work_template_instantiate" },
1224
+ { code: "23514", raised_by: "_checklist_instantiate,_checklist_step_guard,_claimed_column_guard,_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_columns_word_guard,_table_shape_guard,_undeclared_key_guard,_value_envelope,_work_shape_guard,_workdoors_approval_guard,assert_entity_is_organization_scoped,capture_publish,capture_sheet_declare,checklist_declare,checklist_step_complete,doc_sign,doc_signature_write,doc_template_save,entity_field_declare,entity_field_retire,entity_field_update,entity_records_find,entity_table,field_declare,field_retire,field_update,home_add,io_import_rows,migrate_merge,relation_carry,relation_own,sign_request_create,sign_request_sign,table_declare,validate_value_envelope,validate_values,work_set_state,work_slots_declare,work_take_assignment,work_template_instantiate" },
1211
1225
  { code: "40001", raised_by: "has_visibility_at" },
1212
1226
  { 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,booking_confirm,booking_declare,booking_hold,capture_submit,checklist_run,comment_write,conversation_scope_bind,conversation_scope_unbind,enrich_declare,enrich_due,enrich_land,enrich_normalize,entity_field_declare,entity_field_retire,entity_field_update,entity_value_write,external_write_through,form_declare,form_submit,inbound_mail_land,io_comment_resolve,io_comment_write,io_import_begin,io_import_finish,io_restore,migrate_purge,migrate_reclass,my_levels,organization_clear,portal_declare,portal_invitation,portal_invite,portal_principal_bind,promote_table,query_visibility_parity,read_record,read_records,record_table,share_grant,subscription_mute,subscription_preview,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_person" },
1213
1227
  { code: "42703", raised_by: "entity_table,portal_declare" },
1214
1228
  { code: "53400", raised_by: "anon_rate_take,delete_cascade_closure,enrich_due,enrich_land,promote_field" },
1215
1229
  { code: "54001", raised_by: "record_delete" },
1216
- { code: "PT409", raised_by: "record_update" }
1230
+ { code: "PT409", raised_by: "record_update" },
1231
+ { code: "PT428", raised_by: "_record_rule_uses" }
1217
1232
  ];
1218
1233
  var ENTITY_TOKENS = [
1219
1234
  "access_delta_probe",
@@ -1877,6 +1892,7 @@ var ENTITY_TOKENS = [
1877
1892
  "plan_node_artifact",
1878
1893
  "plan_node_step",
1879
1894
  "plan_profile",
1895
+ "platform_action_request",
1880
1896
  "platform_actor_session",
1881
1897
  "platform_actor_token",
1882
1898
  "platform_actor_token_event",
@@ -2383,6 +2399,14 @@ var DOORS = {
2383
2399
  pipelineTransitionRefusal: "pipeline_transition_refusal",
2384
2400
  pipelineMove: "pipeline_move",
2385
2401
  tableStageField: "table_stage_field",
2402
+ // STAGE-RULES. A gate can refuse or it can hand the change to the approvals queue; the
2403
+ // closed list is the store's, the knob is the organization's, and what is WAITING on a
2404
+ // card has to be askable or a card that did not move looks like a card nobody dragged.
2405
+ stageRuleOnFailKinds: "stage_rule_on_fail_kinds",
2406
+ stageRuleEnforcement: "stage_rule_enforcement",
2407
+ recordStagePending: "record_stage_pending",
2408
+ pipelinePending: "pipeline_pending",
2409
+ pipelineGatePreview: "pipeline_gate_preview",
2386
2410
  ruleMembers: "rule_members",
2387
2411
  ruleMembership: "rule_membership",
2388
2412
  ruleRun: "rule_run",
@@ -2404,6 +2428,10 @@ var DOORS = {
2404
2428
  // VISITOR's three (`booking_public`, `booking_hold`, `booking_confirm`) are
2405
2429
  // deliberately absent: they are server-lane and a browser never calls them.
2406
2430
  bookings: "bookings",
2431
+ // The OWNER's side of a booking page, and the door that had no client method at
2432
+ // all until 2026-09-21: without it the only way to get a booking page was to ask
2433
+ // an agent, which made the agent the ONLY path rather than the faster one.
2434
+ bookingDeclare: "booking_declare",
2407
2435
  // PRODUCTS row 9 — "pull my spreadsheet in". W4-IO built `io_import_open` and
2408
2436
  // `io_import_rows`; lane IMPORT gave a run an IDENTITY (the file's sha-256, so
2409
2437
  // a re-import doubles nothing), a duplicate key, a policy, per-row outcomes
@@ -2536,6 +2564,13 @@ var DOORS = {
2536
2564
  // the summary it would send right now without sending it.
2537
2565
  subscriptionDeclare: "subscription_declare",
2538
2566
  subscriptionPreview: "subscription_preview",
2567
+ // A SUBSCRIPTION IS OVER A SAVED VIEW, so a person who has never saved one has
2568
+ // nothing to subscribe to. These two are the saved-view pair (lane DIGESTS'
2569
+ // `digests_a_saved_view_has_a_door.sql`), unreachable from this client until
2570
+ // 2026-09-21: `views` lists this Table's, `viewDeclare` writes one. A LIST IS A
2571
+ // DOOR, never a grant on `platform.saved_view` behind it.
2572
+ views: "views",
2573
+ viewDeclare: "view_declare",
2539
2574
  // The cadence CATALOGUE a person's screen may ask for. `agg_subscription_cadences`
2540
2575
  // above is the notifier's own and holds no client grant; this door delegates to
2541
2576
  // it, so a picker and the digest runner can never offer different words.
@@ -2709,7 +2744,17 @@ var BY_SQLSTATE = {
2709
2744
  // the grants not copied, land here.
2710
2745
  PGRST202: "store_not_served",
2711
2746
  PGRST205: "store_not_served",
2712
- PGRST301: "door"
2747
+ PGRST301: "door",
2748
+ // PT428 — NOT A FAILURE, and the release gate's live census is what found it
2749
+ // missing: the store raises it and this package answered `internal`, which is
2750
+ // the one classification that tells a screen nothing. A stage gate whose
2751
+ // `on_fail` is `require_approval` files the request and leaves the record
2752
+ // where it was; the transaction is rolled back to the pipeline's own block, so
2753
+ // "nothing was written" is a fact rather than a promise. Landed by lane
2754
+ // STAGE-RULES; mapped here by STAGE-RULES-2 the day after, when the census
2755
+ // caught it — the sixth time that census has been the thing that found a
2756
+ // refusal class rather than a person guessing one.
2757
+ PT428: "needs_approval"
2713
2758
  };
2714
2759
  var MAPPED_SQLSTATES = Object.keys(BY_SQLSTATE);
2715
2760
  function parseDetail(details) {
@@ -2888,16 +2933,17 @@ function createRecordsClient(config) {
2888
2933
  if (!door.ok) return err(door.error);
2889
2934
  const { document, hidden } = unfold(door.data);
2890
2935
  let computed = [];
2936
+ let computedUnavailable = null;
2891
2937
  if (withComputed) {
2892
2938
  const provenance = await callDoor(
2893
2939
  DOORS.computedProvenance,
2894
2940
  { p_organization_id: org, p_record_id: record_id },
2895
2941
  "recordRead.computed"
2896
2942
  );
2897
- if (!provenance.ok) return err(provenance.error);
2898
- computed = provenance.data ?? [];
2943
+ if (provenance.ok) computed = provenance.data ?? [];
2944
+ else computedUnavailable = provenance.error;
2899
2945
  }
2900
- return ok({ record_id, document, hidden, computed });
2946
+ return ok({ record_id, document, hidden, computed, computedUnavailable });
2901
2947
  },
2902
2948
  async list({ table_id, limit = 50, offset = 0 }) {
2903
2949
  const door = await callDoor(
@@ -3236,6 +3282,41 @@ function createRecordsClient(config) {
3236
3282
  "tableStageField"
3237
3283
  );
3238
3284
  },
3285
+ async stageRuleOnFailKinds() {
3286
+ return callDoor(
3287
+ DOORS.stageRuleOnFailKinds,
3288
+ {},
3289
+ "stageRuleOnFailKinds"
3290
+ );
3291
+ },
3292
+ async stageRuleEnforcement() {
3293
+ return callDoor(
3294
+ DOORS.stageRuleEnforcement,
3295
+ { p_organization_id: org },
3296
+ "stageRuleEnforcement"
3297
+ );
3298
+ },
3299
+ async recordStagePending({ record_id }) {
3300
+ return callDoor(
3301
+ DOORS.recordStagePending,
3302
+ { p_organization_id: org, p_record_id: record_id },
3303
+ "recordStagePending"
3304
+ );
3305
+ },
3306
+ async pipelinePending({ table_id }) {
3307
+ return callDoor(
3308
+ DOORS.pipelinePending,
3309
+ { p_organization_id: org, p_table_id: table_id },
3310
+ "pipelinePending"
3311
+ );
3312
+ },
3313
+ async pipelineGatePreview({ table_id, stage, gate }) {
3314
+ return callDoor(
3315
+ DOORS.pipelineGatePreview,
3316
+ { p_organization_id: org, p_table_id: table_id, p_stage: stage, p_gate: gate },
3317
+ "pipelineGatePreview"
3318
+ );
3319
+ },
3239
3320
  async ruleMembers({ rule_id }) {
3240
3321
  return callDoor(
3241
3322
  DOORS.ruleMembers,
@@ -3264,6 +3345,30 @@ function createRecordsClient(config) {
3264
3345
  "bookings"
3265
3346
  );
3266
3347
  },
3348
+ async bookingDeclare(args) {
3349
+ return callDoor(
3350
+ DOORS.bookingDeclare,
3351
+ {
3352
+ p_organization_id: org,
3353
+ p_table_id: args.table_id,
3354
+ p_title: args.title,
3355
+ p_questions: args.questions,
3356
+ // AN EMPTY OBJECT IS NOT A MISTAKE. The store owns every default, so a
3357
+ // page declared with no availability comes back Monday-to-Friday,
3358
+ // nine-to-five, in the organization's own zone — and the screen draws
3359
+ // what came BACK rather than what it sent.
3360
+ p_availability: args.availability ?? {},
3361
+ p_presentation: args.presentation ?? {},
3362
+ p_submission_cap: args.submission_cap ?? null,
3363
+ p_quarantine_rule_id: args.quarantine_rule_id ?? null,
3364
+ p_notify_rule_id: args.notify_rule_id ?? null,
3365
+ p_form_id: args.form_id ?? null,
3366
+ p_slug: args.slug ?? null,
3367
+ p_home_id: args.home_id ?? null
3368
+ },
3369
+ "bookingDeclare"
3370
+ );
3371
+ },
3267
3372
  async formDeclare(args) {
3268
3373
  return callDoor(
3269
3374
  DOORS.formDeclare,
@@ -3688,6 +3793,20 @@ function createRecordsClient(config) {
3688
3793
  "subscriptionPreview"
3689
3794
  );
3690
3795
  },
3796
+ async views(args) {
3797
+ return callDoor(
3798
+ DOORS.views,
3799
+ { p_organization_id: org, p_table_id: args?.table_id ?? null },
3800
+ "views"
3801
+ );
3802
+ },
3803
+ async viewDeclare({ table_id, spec }) {
3804
+ return callDoor(
3805
+ DOORS.viewDeclare,
3806
+ { p_organization_id: org, p_table_id: table_id, p_spec: spec },
3807
+ "viewDeclare"
3808
+ );
3809
+ },
3691
3810
  async subscriptionMute({ rule_id, muted }) {
3692
3811
  return callDoor(
3693
3812
  DOORS.subscriptionMute,