@ai-matrx/records 0.21.0 → 0.26.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 +159 -1
- package/dist/core/index.cjs +518 -25
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +151 -17
- package/dist/core/index.d.ts +151 -17
- package/dist/core/index.js +518 -25
- package/dist/core/index.js.map +1 -1
- package/dist/index.cjs +342 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +711 -12
- package/dist/index.d.ts +711 -12
- package/dist/index.js +342 -8
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +506 -8
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +821 -12
- package/dist/react/index.d.ts +821 -12
- package/dist/react/index.js +506 -8
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -68,6 +68,7 @@ var PARITY_FIELD_TYPES = [
|
|
|
68
68
|
{ parity_type: "url", behavior: "text", made_of: "text whose format is url, with the pattern Rule that makes the format enforceable" }
|
|
69
69
|
];
|
|
70
70
|
var RULE_NODE_KINDS = [
|
|
71
|
+
{ node: "actor_at_least", evaluated_by: "PIPELINES" },
|
|
71
72
|
{ node: "add", evaluated_by: "W1-RULE" },
|
|
72
73
|
{ node: "and", evaluated_by: "W1-RULE" },
|
|
73
74
|
{ node: "concat", evaluated_by: "W1-RULE" },
|
|
@@ -88,6 +89,8 @@ var RULE_NODE_KINDS = [
|
|
|
88
89
|
{ node: "or", evaluated_by: "W1-RULE" },
|
|
89
90
|
{ node: "parent_field", evaluated_by: "W1-RULE-APPLY" },
|
|
90
91
|
{ node: "present", evaluated_by: "W1-RULE" },
|
|
92
|
+
{ node: "previous", evaluated_by: "PIPELINES" },
|
|
93
|
+
{ node: "stage_count", evaluated_by: "PIPELINES" },
|
|
91
94
|
{ node: "sub", evaluated_by: "W1-RULE" }
|
|
92
95
|
];
|
|
93
96
|
var KERNEL_TABLES = [
|
|
@@ -110,16 +113,27 @@ var STORE_DOORS = [
|
|
|
110
113
|
{ name: "agent_table_claim", args: "p_organization uuid, p_table uuid, p_conversation uuid DEFAULT NULL::uuid", returns: "void", security: "definer" },
|
|
111
114
|
{ name: "agg_assert_key", args: "p_key text", returns: "text", security: "invoker" },
|
|
112
115
|
{ name: "agg_buckets", args: "", returns: "text[]", security: "invoker" },
|
|
113
|
-
{ name: "
|
|
116
|
+
{ name: "agg_cadence_normalize", args: "p_cadence text", returns: "text", security: "invoker" },
|
|
117
|
+
{ name: "agg_deliver", args: "p_organization_id uuid, p_rule_id uuid, p_record_id uuid, p_channel text, p_recipient_user_id uuid, p_event_key text, p_subject text, p_body text, p_payload jsonb DEFAULT '{}'::jsonb, p_dedupe_suffix text DEFAULT NULL::text", returns: "uuid", security: "invoker" },
|
|
118
|
+
{ name: "agg_deliver_quietly", args: "p_organization_id uuid, p_rule_id uuid, p_subject_id uuid, p_channel text, p_recipient_user_id uuid, p_event_key text, p_subject text, p_body text, p_payload jsonb, p_quiet_hours jsonb, p_link text, p_dedupe_suffix text DEFAULT NULL::text", returns: "uuid", security: "invoker" },
|
|
119
|
+
{ name: "agg_digest_assemble", args: "p_organization_id uuid, p_rule_id uuid, p_since timestamp with time zone DEFAULT NULL::timestamp with time zone, p_until timestamp with time zone DEFAULT NULL::timestamp with time zone", returns: "jsonb", security: "invoker" },
|
|
120
|
+
{ name: "agg_digest_due_at", args: "p_cadence text, p_schedule text, p_quiet jsonb, p_after timestamp with time zone", returns: "timestamp with time zone", security: "invoker" },
|
|
114
121
|
{ name: "agg_digest_run", args: "p_organization_id uuid, p_rule_id uuid DEFAULT NULL::uuid, p_since timestamp with time zone DEFAULT NULL::timestamp with time zone", returns: "integer", security: "invoker" },
|
|
122
|
+
{ name: "agg_digest_tick", args: "", returns: "integer", security: "invoker" },
|
|
115
123
|
{ name: "agg_explain", args: "p_organization_id uuid, p_table_id uuid, p_group_by jsonb DEFAULT '[]'::jsonb, p_measures jsonb DEFAULT '[]'::jsonb, p_bucket jsonb DEFAULT NULL::jsonb, p_filter jsonb DEFAULT '{}'::jsonb, p_required text DEFAULT 'viewer'::text", returns: "jsonb", security: "definer" },
|
|
124
|
+
{ name: "agg_last_digest_at", args: "p_organization_id uuid, p_rule_id uuid", returns: "timestamp with time zone", security: "invoker" },
|
|
116
125
|
{ name: "agg_operations", args: "", returns: "text[]", security: "invoker" },
|
|
126
|
+
{ name: "agg_quiet_until", args: "p_quiet jsonb, p_at timestamp with time zone", returns: "timestamp with time zone", security: "invoker" },
|
|
127
|
+
{ name: "agg_record_name", args: "p_organization_id uuid, p_record_id uuid, p_state jsonb DEFAULT NULL::jsonb", returns: "text", security: "invoker" },
|
|
117
128
|
{ name: "agg_sql", args: "p_organization_id uuid, p_table_id uuid, p_group_by jsonb DEFAULT '[]'::jsonb, p_measures jsonb DEFAULT '[]'::jsonb, p_bucket jsonb DEFAULT NULL::jsonb, p_filter jsonb DEFAULT '{}'::jsonb, p_limit integer DEFAULT 200, p_required text DEFAULT 'viewer'::text", returns: "text", security: "invoker" },
|
|
118
129
|
{ name: "agg_subscription_cadences", args: "", returns: "text[]", security: "invoker" },
|
|
119
130
|
{ name: "agg_subscription_fire", args: "p_organization_id uuid, p_record_id uuid, p_table_id uuid DEFAULT NULL::uuid, p_changed_field_ids jsonb DEFAULT '[]'::jsonb", returns: "integer", security: "invoker" },
|
|
120
|
-
{ name: "
|
|
131
|
+
{ name: "agg_subscription_fire_entered", args: "p_organization_id uuid, p_record_id uuid, p_table_id uuid DEFAULT NULL::uuid, p_since timestamp with time zone DEFAULT NULL::timestamp with time zone", returns: "integer", security: "invoker" },
|
|
132
|
+
{ name: "agg_subscription_tick", args: "p_window interval DEFAULT '00:15:00'::interval", returns: "integer", security: "invoker" },
|
|
133
|
+
{ name: "agg_subscriptions", args: "p_organization_id uuid, p_saved_view_id uuid DEFAULT NULL::uuid, p_cadence text DEFAULT NULL::text", returns: "TABLE(rule_id uuid, saved_view_id uuid, table_id uuid, cadence text, schedule text, quiet_hours jsonb, channel text, recipient_user_id uuid, event_key text, name text)", security: "invoker" },
|
|
121
134
|
{ name: "agg_value_sql", args: "p_key text", returns: "text", security: "invoker" },
|
|
122
135
|
{ name: "agg_view_admits", args: "p_organization_id uuid, p_saved_view_id uuid, p_record_id uuid", returns: "boolean", security: "invoker" },
|
|
136
|
+
{ name: "agg_view_admits_state", args: "p_definition jsonb, p_state jsonb", returns: "boolean", security: "invoker" },
|
|
123
137
|
{ name: "anon_capture", args: "p_organization_id uuid, p_client_key text, p_table_id uuid, p_payload jsonb, p_device text DEFAULT NULL::text, p_captured_at timestamp with time zone DEFAULT NULL::timestamp with time zone", returns: "uuid", security: "definer" },
|
|
124
138
|
{ name: "anon_clear", args: "p_organization_id uuid, p_submission_id uuid", returns: "uuid", security: "definer" },
|
|
125
139
|
{ name: "anon_inbound_land", args: "p_address text, p_secret text, p_payload jsonb, p_raw_payload jsonb DEFAULT '{}'::jsonb, p_client_key text DEFAULT NULL::text", returns: "uuid", security: "definer" },
|
|
@@ -140,9 +154,23 @@ var STORE_DOORS = [
|
|
|
140
154
|
{ name: "assert_organization_admin", args: "p_organization_id uuid, p_door text, p_what text", returns: "void", security: "invoker" },
|
|
141
155
|
{ name: "assert_organization_wall", args: "p_kind text, p_organization_id uuid, p_row jsonb", returns: "void", security: "invoker" },
|
|
142
156
|
{ name: "assert_store_door", args: "p_organization_id uuid, p_door text", returns: "void", security: "invoker" },
|
|
157
|
+
{ name: "booking_cancel", args: "p_booking_ref text, p_origin text DEFAULT NULL::text", returns: "TABLE(booking_ref text, record_id uuid, slot_key text, state text, message text)", security: "definer" },
|
|
158
|
+
{ name: "booking_confirm", args: "p_form_id uuid, p_hold_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(booking_ref text, record_id uuid, submission_id uuid, slot_key text, slot_at timestamp with time zone, state text, message text)", security: "definer" },
|
|
159
|
+
{ name: "booking_declare", args: "p_organization_id uuid, p_table_id uuid, p_title text, p_questions jsonb, p_availability jsonb DEFAULT '{}'::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, p_home_id uuid DEFAULT NULL::uuid", returns: "jsonb", security: "definer" },
|
|
160
|
+
{ name: "booking_hold", args: "p_form_id uuid, p_slot_key text, p_origin text, p_bucket text, p_client_key text DEFAULT NULL::text", returns: "TABLE(hold_id uuid, slot_key text, expires_at timestamp with time zone, member_user_id uuid, state text, message text)", security: "definer" },
|
|
161
|
+
{ name: "booking_manage", args: "p_booking_ref text, p_days integer DEFAULT NULL::integer", returns: "TABLE(booking_ref text, form_id uuid, title text, slot_key text, slot_at timestamp with time zone, status text, slots jsonb, availability jsonb, state text, message text)", security: "definer" },
|
|
162
|
+
{ name: "booking_notify", args: "p_organization_id uuid, p_form_id uuid, p_record_id uuid, p_submission_id uuid, p_event text, p_when text", returns: "uuid", security: "invoker" },
|
|
163
|
+
{ name: "booking_public", args: "p_form_id uuid, p_days integer DEFAULT NULL::integer", returns: "TABLE(form_id uuid, organization_id uuid, table_id uuid, title text, presentation jsonb, fields jsonb, honeypot_key text, availability jsonb, slots jsonb, state text, message text)", security: "definer" },
|
|
164
|
+
{ name: "booking_reschedule", args: "p_booking_ref text, p_slot_key text, p_origin text, p_bucket text DEFAULT NULL::text", returns: "TABLE(booking_ref text, record_id uuid, slot_key text, slot_at timestamp with time zone, state text, message text)", security: "definer" },
|
|
165
|
+
{ name: "bookings", 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, slot_minutes integer, timezone text, slot_table_id uuid, booked bigint, cancelled bigint, upcoming bigint, held bigint, next_at timestamp with time zone, state text)", security: "definer" },
|
|
143
166
|
{ name: "bump_epoch", args: "p_entity_type text, p_entity_id uuid, p_organization_id uuid DEFAULT NULL::uuid", returns: "bigint", security: "definer" },
|
|
144
167
|
{ name: "cache_lookup", args: "p_container_type text, p_container_id uuid, p_item_type text, p_item_id uuid", returns: "permission_level", security: "definer" },
|
|
145
168
|
{ name: "caller_role", args: "", returns: "name", security: "invoker" },
|
|
169
|
+
{ name: "capture_open", args: "p_organization_id uuid, p_sheet_id uuid", returns: "TABLE(sheet_id uuid, organization_id uuid, table_id uuid, title text, presentation jsonb, fields jsonb, state text, may_capture boolean, message text)", security: "definer" },
|
|
170
|
+
{ name: "capture_publish", args: "p_organization_id uuid, p_sheet_id uuid, p_open boolean DEFAULT true", returns: "timestamp with time zone", security: "definer" },
|
|
171
|
+
{ name: "capture_sheet_declare", args: "p_organization_id uuid, p_table_id uuid, p_title text, p_questions jsonb, p_presentation jsonb DEFAULT '{}'::jsonb, p_sheet_id uuid DEFAULT NULL::uuid, p_notify_rule_id uuid DEFAULT NULL::uuid", returns: "uuid", security: "definer" },
|
|
172
|
+
{ name: "capture_sheets", args: "p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid", returns: "TABLE(sheet_id uuid, table_id uuid, title text, slug text, state text, opened_at timestamp with time zone, captures bigint, replays bigint, last_capture_at timestamp with time zone, presentation jsonb)", security: "definer" },
|
|
173
|
+
{ name: "capture_submit", args: "p_organization_id uuid, p_sheet_id uuid, p_client_key text, p_payload jsonb, p_files jsonb DEFAULT '[]'::jsonb, p_device text DEFAULT NULL::text, p_captured_at timestamp with time zone DEFAULT NULL::timestamp with time zone, p_location jsonb DEFAULT NULL::jsonb", returns: "TABLE(record_id uuid, state text, message text, replay boolean, file_ids uuid[])", security: "definer" },
|
|
146
174
|
{ name: "carry_unchanged_value_stamps", args: "p_old jsonb, p_new jsonb", returns: "jsonb", security: "invoker" },
|
|
147
175
|
{ 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" },
|
|
148
176
|
{ 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" },
|
|
@@ -253,6 +281,7 @@ var STORE_DOORS = [
|
|
|
253
281
|
{ 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" },
|
|
254
282
|
{ 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" },
|
|
255
283
|
{ name: "entity_value_write", args: "p_organization_id uuid, p_token text, p_record_id uuid, p_patch jsonb", returns: "jsonb", security: "invoker" },
|
|
284
|
+
{ name: "export_ceiling", args: "p_organization_id uuid DEFAULT NULL::uuid", returns: "integer", security: "definer" },
|
|
256
285
|
{ 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" },
|
|
257
286
|
{ name: "external_foreign_table_findings", args: "", returns: "SETOF text", security: "definer" },
|
|
258
287
|
{ name: "external_history_event", args: "p_organization_id uuid, p_link_id uuid, p_operation text", returns: "bigint", security: "definer" },
|
|
@@ -280,6 +309,7 @@ var STORE_DOORS = [
|
|
|
280
309
|
{ 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" },
|
|
281
310
|
{ 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" },
|
|
282
311
|
{ 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" },
|
|
312
|
+
{ name: "freshness_verdict", args: "p_written_at timestamp with time zone, p_ceiling_seconds numeric", returns: "jsonb", security: "definer" },
|
|
283
313
|
{ name: "guard_refusals_are_complete", args: "", returns: "TABLE(guard text, said text)", security: "invoker" },
|
|
284
314
|
{ 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" },
|
|
285
315
|
{ name: "has_visibility_at", args: "p_user_id uuid, p_type text, p_id uuid, p_required permission_level DEFAULT 'viewer'::permission_level, p_organization_id uuid DEFAULT NULL::uuid, p_min_version bigint DEFAULT NULL::bigint", returns: "boolean", security: "definer" },
|
|
@@ -369,12 +399,20 @@ var STORE_DOORS = [
|
|
|
369
399
|
{ 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" },
|
|
370
400
|
{ name: "owning_table", args: "p_organization_id uuid, p_record_id uuid", returns: "uuid", security: "invoker" },
|
|
371
401
|
{ name: "owning_table_gone", args: "p_organization_id uuid, p_record_id uuid", returns: "boolean", security: "invoker" },
|
|
402
|
+
{ name: "page_ceiling", args: "p_organization_id uuid DEFAULT NULL::uuid", returns: "integer", security: "definer" },
|
|
403
|
+
{ name: "page_contract", args: "p_organization_id uuid", returns: "jsonb", security: "definer" },
|
|
404
|
+
{ name: "page_size", args: "p_organization_id uuid, p_door text, p_limit integer, p_default integer DEFAULT NULL::integer, p_ceiling integer DEFAULT NULL::integer", returns: "integer", security: "definer" },
|
|
372
405
|
{ name: "parity_field_types", args: "", returns: "TABLE(parity_type text, behavior text, made_of text)", security: "invoker" },
|
|
373
406
|
{ name: "parity_type", args: "p_field_data jsonb", returns: "text", security: "invoker" },
|
|
374
407
|
{ 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" },
|
|
375
408
|
{ name: "per_value_access_words", args: "", returns: "text[]", security: "invoker" },
|
|
376
409
|
{ name: "person_kernel_id", args: "", returns: "uuid", security: "invoker" },
|
|
377
410
|
{ name: "pin_agent_cells", args: "p_new jsonb, p_old jsonb, p_agent_keys text[]", returns: "jsonb", security: "invoker" },
|
|
411
|
+
{ 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" },
|
|
412
|
+
{ name: "pipeline_declare", args: "p_organization_id uuid, p_table_id uuid, p_spec jsonb", returns: "jsonb", security: "definer" },
|
|
413
|
+
{ 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" },
|
|
414
|
+
{ name: "pipeline_read", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "definer" },
|
|
415
|
+
{ name: "pipeline_transition_refusal", args: "p_organization_id uuid, p_record_id uuid, p_to text", returns: "jsonb", security: "definer" },
|
|
378
416
|
{ name: "portal_admits", args: "p_organization_id uuid, p_user_id uuid DEFAULT NULL::uuid", returns: "boolean", security: "definer" },
|
|
379
417
|
{ name: "portal_card", args: "p_organization_id uuid, p_portal_id uuid", returns: "jsonb", security: "definer" },
|
|
380
418
|
{ 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" },
|
|
@@ -402,6 +440,9 @@ var STORE_DOORS = [
|
|
|
402
440
|
{ name: "promoted_read", args: "p_organization_id uuid, p_table_id uuid, p_field_key text, p_value text", returns: "SETOF uuid", security: "invoker" },
|
|
403
441
|
{ name: "promoted_value_path", args: "p_field_data jsonb", returns: "text", security: "invoker" },
|
|
404
442
|
{ name: "promotion_inline_ceiling", args: "", returns: "integer", security: "invoker" },
|
|
443
|
+
{ name: "provenance_prune", args: "p_organization_id uuid DEFAULT NULL::uuid, p_dry_run boolean DEFAULT true, p_limit integer DEFAULT 200000", returns: "jsonb", security: "definer" },
|
|
444
|
+
{ name: "provenance_retention_days", args: "p_organization_id uuid", returns: "integer", security: "definer" },
|
|
445
|
+
{ name: "provenance_write", args: "p_organization_id uuid, p_conversation_id uuid, p_turn_id text, p_rows jsonb", returns: "integer", security: "definer" },
|
|
405
446
|
{ name: "query_access_ids", args: "p_organization_id uuid, p_required text DEFAULT 'viewer'::text", returns: "uuid[]", security: "invoker" },
|
|
406
447
|
{ name: "query_across_homes", args: "p_organization_id uuid, p_table_id uuid, p_limit integer DEFAULT 50, p_offset integer DEFAULT 0, p_required text DEFAULT 'viewer'::text", returns: "TABLE(record_id uuid, home_record_id uuid, data jsonb, created_at timestamp with time zone)", security: "definer" },
|
|
407
448
|
{ name: "query_by_coordinates", args: "p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid, p_coordinates jsonb DEFAULT '[]'::jsonb, p_limit integer DEFAULT 50, p_offset integer DEFAULT 0, p_required text DEFAULT 'viewer'::text", returns: "TABLE(record_id uuid, table_id uuid, data jsonb, coordinates_matched integer)", security: "definer" },
|
|
@@ -502,6 +543,7 @@ var STORE_DOORS = [
|
|
|
502
543
|
{ name: "sign_requests", args: "p_organization_id uuid, p_record_id uuid", returns: "TABLE(request_id uuid, render_id uuid, record_id uuid, field_key text, document_title text, signer_name text, signer_email text, signer_has_account boolean, state text, sentence text, document_version integer, document_hash text, sent_at timestamp with time zone, expires_at timestamp with time zone, viewed_at timestamp with time zone, signed_at timestamp with time zone, declined_at timestamp with time zone, invalidated_at timestamp with time zone, signature_id uuid, signature_mark text, reminder_count integer)", security: "definer" },
|
|
503
544
|
{ name: "sign_token_decode", args: "p_token text", returns: "bytea", security: "invoker" },
|
|
504
545
|
{ name: "sign_token_encode", args: "p_bytes bytea", returns: "text", security: "invoker" },
|
|
546
|
+
{ name: "silent_page_doors", args: "", returns: "TABLE(door text, why text)", security: "definer" },
|
|
505
547
|
{ name: "size_refusal", args: "p_organization_id uuid, p_data jsonb", returns: "text", security: "invoker" },
|
|
506
548
|
{ name: "source_next_pointer", args: "p_sources jsonb", returns: "text", security: "invoker" },
|
|
507
549
|
{ name: "source_pointer", args: "p_sources jsonb, p_source jsonb", returns: "text", security: "invoker" },
|
|
@@ -509,8 +551,10 @@ var STORE_DOORS = [
|
|
|
509
551
|
{ name: "storage_modes", args: "", returns: "text[]", security: "invoker" },
|
|
510
552
|
{ name: "store_is_open", args: "p_organization_id uuid DEFAULT NULL::uuid", returns: "boolean", security: "invoker" },
|
|
511
553
|
{ name: "subscription_cadences", args: "p_organization_id uuid", returns: "text[]", security: "definer" },
|
|
554
|
+
{ name: "subscription_declare", args: "p_organization_id uuid, p_table_id uuid, p_spec jsonb", returns: "uuid", security: "definer" },
|
|
512
555
|
{ name: "subscription_mute", args: "p_organization_id uuid, p_rule_id uuid, p_muted boolean DEFAULT true", returns: "boolean", security: "definer" },
|
|
513
|
-
{ name: "
|
|
556
|
+
{ name: "subscription_preview", args: "p_organization_id uuid, p_rule_id uuid", returns: "jsonb", security: "definer" },
|
|
557
|
+
{ 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" },
|
|
514
558
|
{ name: "table_capacity", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "definer" },
|
|
515
559
|
{ 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" },
|
|
516
560
|
{ name: "table_contents", args: "p_organization_id uuid, p_table_id uuid", returns: "TABLE(record_id uuid, kind text, goes_at integer)", security: "invoker" },
|
|
@@ -521,6 +565,7 @@ var STORE_DOORS = [
|
|
|
521
565
|
{ name: "table_record_ceiling", args: "", returns: "integer", security: "invoker" },
|
|
522
566
|
{ name: "table_record_ceiling", args: "p_organization_id uuid", returns: "integer", security: "invoker" },
|
|
523
567
|
{ name: "table_rules", args: "p_organization_id uuid, p_table_id uuid, p_use text, p_record_type text DEFAULT NULL::text", returns: "SETOF custom.record", security: "invoker" },
|
|
568
|
+
{ name: "table_stage_field", args: "p_organization_id uuid, p_table_id uuid", returns: "text", security: "definer" },
|
|
524
569
|
{ name: "table_storage", args: "p_organization_id uuid, p_table_id uuid", returns: "text", security: "invoker" },
|
|
525
570
|
{ name: "table_type_field", args: "p_organization_id uuid, p_table_id uuid", returns: "text", security: "definer" },
|
|
526
571
|
{ 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" },
|
|
@@ -608,12 +653,15 @@ var STORE_KNOBS = [
|
|
|
608
653
|
{ key: "enrichment_sensitivity_ceiling", value: '"internal"', type: "string" },
|
|
609
654
|
{ key: "entity_custom_fields_guard", value: "false", type: "boolean" },
|
|
610
655
|
{ key: "entity_types_guard", value: "false", type: "boolean" },
|
|
656
|
+
{ key: "export_rows_ceiling", value: "100000", type: "integer" },
|
|
611
657
|
{ key: "external_principal_enabled", value: "false", type: "boolean" },
|
|
612
658
|
{ key: "field_index_guard", value: "false", type: "boolean" },
|
|
613
659
|
{ key: "field_sensitivity_levels", value: '{"edit": {"public": "editor", "internal": "editor", "restricted": "admin", "confidential": "admin"}, "read": {"public": "viewer", "internal": "viewer", "restricted": "admin", "confidential": "editor"}}', type: "json" },
|
|
614
660
|
{ key: "inbound_domain", value: '"inbound.matrxserver.com"', type: "string" },
|
|
615
661
|
{ key: "member_default_level", value: '"viewer"', type: "enum" },
|
|
616
662
|
{ key: "member_default_visibility", value: '"all_records"', type: "enum" },
|
|
663
|
+
{ key: "page_size_ceiling", value: "1000", type: "integer" },
|
|
664
|
+
{ key: "provenance_retention_days", value: "30", type: "number" },
|
|
617
665
|
{ key: "records_tool_default", value: "true", type: "boolean" },
|
|
618
666
|
{ key: "row_versions_guard", value: "false", type: "boolean" },
|
|
619
667
|
{ key: "sandbox_expanded_frame_height_px", value: "20000", type: "integer" },
|
|
@@ -630,15 +678,15 @@ var STORE_REFUSAL_CODES = [
|
|
|
630
678
|
{ 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" },
|
|
631
679
|
{ 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" },
|
|
632
680
|
{ code: "22003", raised_by: "context_resolve" },
|
|
633
|
-
{ 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,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,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,sign_request_create,sign_request_sign,table_declare,value_restore,work_approval_decide,work_approval_request,work_template_declare" },
|
|
681
|
+
{ 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,relation_carry,relation_own,rule_declare,share_grant,sign_request_create,sign_request_sign,subscription_declare,table_declare,value_restore,work_approval_decide,work_approval_request,work_template_declare" },
|
|
634
682
|
{ code: "22007", raised_by: "dashboard_window_sql" },
|
|
635
683
|
{ code: "22012", raised_by: "rule_eval" },
|
|
636
|
-
{ 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,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_import_begin,io_import_finish,io_import_plan,io_import_report,io_proposal_accept,migrate_merge,migrate_reclass,my_levels,organization_clear,pin_agent_cells,portal_declare,query_by_coordinates,query_rollup,record_update,relation_carry,rule_eval,rule_members,share_grant,share_lane_set,sign_request_create,sign_request_sign,table_rules,visibility_as_of,work_approval_request,work_list,work_slot_hold" },
|
|
637
|
-
{ code: "23503", raised_by: "_checklist_instantiate,_containment_guard,_field_document_for,_record_rule_uses,anon_publish,anon_rate_take,anon_token_issue,anon_write,assert_organization_wall,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,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,work_set_state,work_take_assignment,work_template_instantiate" },
|
|
684
|
+
{ 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_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,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" },
|
|
685
|
+
{ 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,work_set_state,work_take_assignment,work_template_instantiate" },
|
|
638
686
|
{ 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" },
|
|
639
|
-
{ 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,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,validate_value_envelope,validate_values,work_set_state,work_slots_declare,work_take_assignment,work_template_instantiate" },
|
|
687
|
+
{ 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,validate_value_envelope,validate_values,work_set_state,work_slots_declare,work_take_assignment,work_template_instantiate" },
|
|
640
688
|
{ code: "40001", raised_by: "has_visibility_at" },
|
|
641
|
-
{ 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,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,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_person" },
|
|
689
|
+
{ 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" },
|
|
642
690
|
{ code: "42703", raised_by: "entity_table,portal_declare" },
|
|
643
691
|
{ code: "53400", raised_by: "anon_rate_take,delete_cascade_closure,enrich_due,enrich_land,promote_field" },
|
|
644
692
|
{ code: "54001", raised_by: "record_delete" },
|
|
@@ -1255,6 +1303,7 @@ var ENTITY_TOKENS = [
|
|
|
1255
1303
|
"notification_event_override",
|
|
1256
1304
|
"notification_event_type",
|
|
1257
1305
|
"notification_preference",
|
|
1306
|
+
"notification_submission",
|
|
1258
1307
|
"notify_outsider_door_baseline",
|
|
1259
1308
|
"oauth_handoff_claim",
|
|
1260
1309
|
"opinion_clusters",
|
|
@@ -1865,6 +1914,32 @@ var DOORS = {
|
|
|
1865
1914
|
dashboardRun: "dashboard_run",
|
|
1866
1915
|
dashboardStuck: "dashboard_stuck",
|
|
1867
1916
|
dashboardDelete: "dashboard_delete",
|
|
1917
|
+
// PRODUCTS row 10 — "fill in each company's industry and headcount, and keep
|
|
1918
|
+
// it fresh". An Enrichment is not an object of its own: it is a Field saying
|
|
1919
|
+
// `source = agent`, with its instruction, inputs, model, confidence floor and
|
|
1920
|
+
// freshness in `source_config` (AGT-6). `enrichCells` is the one a GRID calls —
|
|
1921
|
+
// the badge data for a whole page in one round trip, because a badge asked per
|
|
1922
|
+
// cell is fifty round trips to draw fifty badges. `enrichPin` is the half of
|
|
1923
|
+
// this product that decides whether anybody ever trusts it: the moment a
|
|
1924
|
+
// person types over an agent-owned cell the store pins it, and the next run
|
|
1925
|
+
// leaves it exactly as they left it.
|
|
1926
|
+
// PRODUCTS row 15 — "let my crew photograph each bin and log the weight on
|
|
1927
|
+
// site". A capture sheet is the ONE Form object saying `audience = 'crew'`,
|
|
1928
|
+
// opened by `capture_opened_at`; these five are SIGNED-IN doors granted to
|
|
1929
|
+
// `authenticated`, unlike the public form's two, because a crew member has an
|
|
1930
|
+
// account and their own level on the Table is the whole access decision.
|
|
1931
|
+
captureSheetDeclare: "capture_sheet_declare",
|
|
1932
|
+
capturePublish: "capture_publish",
|
|
1933
|
+
captureSheets: "capture_sheets",
|
|
1934
|
+
captureOpen: "capture_open",
|
|
1935
|
+
captureSubmit: "capture_submit",
|
|
1936
|
+
enrichments: "enrichments",
|
|
1937
|
+
enrichDeclare: "enrich_declare",
|
|
1938
|
+
enrichDue: "enrich_due",
|
|
1939
|
+
enrichCells: "enrich_cells",
|
|
1940
|
+
enrichLand: "enrich_land",
|
|
1941
|
+
enrichPin: "enrich_pin",
|
|
1942
|
+
enrichRuns: "enrich_runs",
|
|
1868
1943
|
// PRODUCTS row 4 — "Who changed this price, and can I put it back?" The
|
|
1869
1944
|
// history has been in the store since W3-HIST; until 2026-09-20 the only way
|
|
1870
1945
|
// to ask for it was `io_revisions`, which answers a raw uuid for the author
|
|
@@ -1916,6 +1991,11 @@ var DOORS = {
|
|
|
1916
1991
|
// these rows, so "tell me when a patient arrives" can also be un-told.
|
|
1917
1992
|
subscriptions: "subscriptions",
|
|
1918
1993
|
subscriptionMute: "subscription_mute",
|
|
1994
|
+
// The two DOOR-18 acts that had no door at all until 2026-09-20: WRITE a
|
|
1995
|
+
// subscription (a Rule is declared, never written as a record — REC-72) and SEE
|
|
1996
|
+
// the summary it would send right now without sending it.
|
|
1997
|
+
subscriptionDeclare: "subscription_declare",
|
|
1998
|
+
subscriptionPreview: "subscription_preview",
|
|
1919
1999
|
// The cadence CATALOGUE a person's screen may ask for. `agg_subscription_cadences`
|
|
1920
2000
|
// above is the notifier's own and holds no client grant; this door delegates to
|
|
1921
2001
|
// it, so a picker and the digest runner can never offer different words.
|
|
@@ -2774,6 +2854,125 @@ function createRecordsClient(config) {
|
|
|
2774
2854
|
"ruleEval"
|
|
2775
2855
|
);
|
|
2776
2856
|
},
|
|
2857
|
+
async captureSheetDeclare(args) {
|
|
2858
|
+
return callDoor(
|
|
2859
|
+
DOORS.captureSheetDeclare,
|
|
2860
|
+
{
|
|
2861
|
+
p_organization_id: org,
|
|
2862
|
+
p_table_id: args.table_id,
|
|
2863
|
+
p_title: args.title,
|
|
2864
|
+
p_questions: args.questions,
|
|
2865
|
+
p_presentation: args.presentation ?? {},
|
|
2866
|
+
p_sheet_id: args.sheet_id ?? null,
|
|
2867
|
+
p_notify_rule_id: args.notify_rule_id ?? null
|
|
2868
|
+
},
|
|
2869
|
+
"captureSheetDeclare"
|
|
2870
|
+
);
|
|
2871
|
+
},
|
|
2872
|
+
async capturePublish(args) {
|
|
2873
|
+
return callDoor(
|
|
2874
|
+
DOORS.capturePublish,
|
|
2875
|
+
{ p_organization_id: org, p_sheet_id: args.sheet_id, p_open: args.open ?? true },
|
|
2876
|
+
"capturePublish"
|
|
2877
|
+
);
|
|
2878
|
+
},
|
|
2879
|
+
async captureSheets(args) {
|
|
2880
|
+
return callDoor(
|
|
2881
|
+
DOORS.captureSheets,
|
|
2882
|
+
{ p_organization_id: org, p_table_id: args?.table_id ?? null },
|
|
2883
|
+
"captureSheets"
|
|
2884
|
+
);
|
|
2885
|
+
},
|
|
2886
|
+
async captureOpen(args) {
|
|
2887
|
+
const out = await callDoor(
|
|
2888
|
+
DOORS.captureOpen,
|
|
2889
|
+
{ p_organization_id: org, p_sheet_id: args.sheet_id },
|
|
2890
|
+
"captureOpen"
|
|
2891
|
+
);
|
|
2892
|
+
if (!out.ok) return out;
|
|
2893
|
+
const rows = Array.isArray(out.data) ? out.data : out.data ? [out.data] : [];
|
|
2894
|
+
return { ...out, data: rows[0] ?? null };
|
|
2895
|
+
},
|
|
2896
|
+
async captureSubmit(args) {
|
|
2897
|
+
const out = await callDoor(
|
|
2898
|
+
DOORS.captureSubmit,
|
|
2899
|
+
{
|
|
2900
|
+
p_organization_id: org,
|
|
2901
|
+
p_sheet_id: args.sheet_id,
|
|
2902
|
+
p_client_key: args.client_key,
|
|
2903
|
+
p_payload: args.answers ?? {},
|
|
2904
|
+
p_files: args.files ?? [],
|
|
2905
|
+
p_device: args.device ?? null,
|
|
2906
|
+
p_captured_at: args.captured_at ?? null,
|
|
2907
|
+
p_location: args.location ?? null
|
|
2908
|
+
},
|
|
2909
|
+
"captureSubmit"
|
|
2910
|
+
);
|
|
2911
|
+
if (!out.ok) return out;
|
|
2912
|
+
const rows = Array.isArray(out.data) ? out.data : out.data ? [out.data] : [];
|
|
2913
|
+
return { ...out, data: rows[0] ?? null };
|
|
2914
|
+
},
|
|
2915
|
+
async enrichments(args) {
|
|
2916
|
+
return callDoor(
|
|
2917
|
+
DOORS.enrichments,
|
|
2918
|
+
{ p_organization_id: org, p_table_id: args?.table_id ?? null },
|
|
2919
|
+
"enrichments"
|
|
2920
|
+
);
|
|
2921
|
+
},
|
|
2922
|
+
async enrichDeclare(args) {
|
|
2923
|
+
return callDoor(
|
|
2924
|
+
DOORS.enrichDeclare,
|
|
2925
|
+
{ p_organization_id: org, p_field_id: args.field_id, p_spec: args.spec },
|
|
2926
|
+
"enrichDeclare"
|
|
2927
|
+
);
|
|
2928
|
+
},
|
|
2929
|
+
async enrichDue(args) {
|
|
2930
|
+
return callDoor(
|
|
2931
|
+
DOORS.enrichDue,
|
|
2932
|
+
{
|
|
2933
|
+
p_organization_id: org,
|
|
2934
|
+
p_field_id: args.field_id,
|
|
2935
|
+
p_limit: args.limit ?? 50,
|
|
2936
|
+
p_include_fresh: args.include_fresh ?? false
|
|
2937
|
+
},
|
|
2938
|
+
"enrichDue"
|
|
2939
|
+
);
|
|
2940
|
+
},
|
|
2941
|
+
async enrichCells(args) {
|
|
2942
|
+
return callDoor(
|
|
2943
|
+
DOORS.enrichCells,
|
|
2944
|
+
{
|
|
2945
|
+
p_organization_id: org,
|
|
2946
|
+
p_table_id: args.table_id,
|
|
2947
|
+
p_field_keys: args.field_keys ?? null,
|
|
2948
|
+
p_record_ids: args.record_ids ?? null
|
|
2949
|
+
},
|
|
2950
|
+
"enrichCells"
|
|
2951
|
+
);
|
|
2952
|
+
},
|
|
2953
|
+
async enrichPin(args) {
|
|
2954
|
+
return callDoor(
|
|
2955
|
+
DOORS.enrichPin,
|
|
2956
|
+
{
|
|
2957
|
+
p_organization_id: org,
|
|
2958
|
+
p_record_id: args.record_id,
|
|
2959
|
+
p_field_key: args.field_key,
|
|
2960
|
+
p_pinned: args.pinned ?? true
|
|
2961
|
+
},
|
|
2962
|
+
"enrichPin"
|
|
2963
|
+
);
|
|
2964
|
+
},
|
|
2965
|
+
async enrichRuns(args) {
|
|
2966
|
+
return callDoor(
|
|
2967
|
+
DOORS.enrichRuns,
|
|
2968
|
+
{
|
|
2969
|
+
p_organization_id: org,
|
|
2970
|
+
p_field_id: args?.field_id ?? null,
|
|
2971
|
+
p_limit: args?.limit ?? 50
|
|
2972
|
+
},
|
|
2973
|
+
"enrichRuns"
|
|
2974
|
+
);
|
|
2975
|
+
},
|
|
2777
2976
|
async dashboards(args) {
|
|
2778
2977
|
return callDoor(
|
|
2779
2978
|
DOORS.dashboards,
|
|
@@ -2872,6 +3071,20 @@ function createRecordsClient(config) {
|
|
|
2872
3071
|
"subscriptions"
|
|
2873
3072
|
);
|
|
2874
3073
|
},
|
|
3074
|
+
async subscriptionDeclare({ table_id, spec }) {
|
|
3075
|
+
return callDoor(
|
|
3076
|
+
DOORS.subscriptionDeclare,
|
|
3077
|
+
{ p_organization_id: org, p_table_id: table_id, p_spec: spec },
|
|
3078
|
+
"subscriptionDeclare"
|
|
3079
|
+
);
|
|
3080
|
+
},
|
|
3081
|
+
async subscriptionPreview({ rule_id }) {
|
|
3082
|
+
return callDoor(
|
|
3083
|
+
DOORS.subscriptionPreview,
|
|
3084
|
+
{ p_organization_id: org, p_rule_id: rule_id },
|
|
3085
|
+
"subscriptionPreview"
|
|
3086
|
+
);
|
|
3087
|
+
},
|
|
2875
3088
|
async subscriptionMute({ rule_id, muted }) {
|
|
2876
3089
|
return callDoor(
|
|
2877
3090
|
DOORS.subscriptionMute,
|
|
@@ -4114,6 +4327,285 @@ function measureKey(measure) {
|
|
|
4114
4327
|
return measure.op === "count" ? "count" : `${measure.op}_${measure.key ?? ""}`;
|
|
4115
4328
|
}
|
|
4116
4329
|
|
|
4330
|
+
// src/capture-queue.ts
|
|
4331
|
+
var DB_NAME = "matrx-capture";
|
|
4332
|
+
var DB_VERSION = 1;
|
|
4333
|
+
var ITEMS = "captures";
|
|
4334
|
+
var META = "meta";
|
|
4335
|
+
var REFUSALS_WORTH_REPEATING = /* @__PURE__ */ new Set([
|
|
4336
|
+
"stale_read",
|
|
4337
|
+
"timed_out",
|
|
4338
|
+
"store_limit"
|
|
4339
|
+
]);
|
|
4340
|
+
var SQLSTATES_WORTH_REPEATING = /* @__PURE__ */ new Set(["40001", "57014", "53400"]);
|
|
4341
|
+
function isDecided(error) {
|
|
4342
|
+
if (!error) return false;
|
|
4343
|
+
const { code, sqlstate } = error;
|
|
4344
|
+
if (code && REFUSALS_WORTH_REPEATING.has(code)) return false;
|
|
4345
|
+
if (sqlstate && SQLSTATES_WORTH_REPEATING.has(sqlstate)) return false;
|
|
4346
|
+
return !!(code || sqlstate);
|
|
4347
|
+
}
|
|
4348
|
+
function mintClientKey() {
|
|
4349
|
+
const c = typeof crypto !== "undefined" ? crypto : void 0;
|
|
4350
|
+
if (c && typeof c.randomUUID === "function") return `cap-${c.randomUUID()}`;
|
|
4351
|
+
if (c && typeof c.getRandomValues === "function") {
|
|
4352
|
+
const b = c.getRandomValues(new Uint8Array(16));
|
|
4353
|
+
return `cap-${Array.from(b, (x) => x.toString(16).padStart(2, "0")).join("")}`;
|
|
4354
|
+
}
|
|
4355
|
+
return `cap-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 12)}`;
|
|
4356
|
+
}
|
|
4357
|
+
function indexedDbStore(name = DB_NAME) {
|
|
4358
|
+
const idb = typeof globalThis !== "undefined" ? globalThis.indexedDB : void 0;
|
|
4359
|
+
if (!idb) return null;
|
|
4360
|
+
const open = () => new Promise((resolve, reject) => {
|
|
4361
|
+
const req = idb.open(name, DB_VERSION);
|
|
4362
|
+
req.onupgradeneeded = () => {
|
|
4363
|
+
const db = req.result;
|
|
4364
|
+
if (!db.objectStoreNames.contains(ITEMS)) db.createObjectStore(ITEMS, { keyPath: "client_key" });
|
|
4365
|
+
if (!db.objectStoreNames.contains(META)) db.createObjectStore(META);
|
|
4366
|
+
};
|
|
4367
|
+
req.onsuccess = () => resolve(req.result);
|
|
4368
|
+
req.onerror = () => reject(req.error);
|
|
4369
|
+
});
|
|
4370
|
+
const run = (store, mode, fn) => open().then(
|
|
4371
|
+
(db) => new Promise((resolve, reject) => {
|
|
4372
|
+
const tx = db.transaction(store, mode);
|
|
4373
|
+
const req = fn(tx.objectStore(store));
|
|
4374
|
+
req.onsuccess = () => resolve(req.result);
|
|
4375
|
+
req.onerror = () => reject(req.error);
|
|
4376
|
+
tx.oncomplete = () => db.close();
|
|
4377
|
+
})
|
|
4378
|
+
);
|
|
4379
|
+
return {
|
|
4380
|
+
all: () => run(ITEMS, "readonly", (s) => s.getAll()),
|
|
4381
|
+
put: (item) => run(ITEMS, "readwrite", (s) => s.put(item)).then(() => void 0),
|
|
4382
|
+
remove: (key) => run(ITEMS, "readwrite", (s) => s.delete(key)).then(() => void 0),
|
|
4383
|
+
meta: (key) => run(META, "readonly", (s) => s.get(key)).then((v) => v ?? null),
|
|
4384
|
+
setMeta: (key, value) => run(META, "readwrite", (s) => s.put(value, key)).then(() => void 0)
|
|
4385
|
+
};
|
|
4386
|
+
}
|
|
4387
|
+
function memoryStore() {
|
|
4388
|
+
const rows = /* @__PURE__ */ new Map();
|
|
4389
|
+
const meta = /* @__PURE__ */ new Map();
|
|
4390
|
+
return {
|
|
4391
|
+
all: async () => Array.from(rows.values()),
|
|
4392
|
+
put: async (item) => void rows.set(item.client_key, item),
|
|
4393
|
+
remove: async (key) => void rows.delete(key),
|
|
4394
|
+
meta: async (key) => meta.get(key) ?? null,
|
|
4395
|
+
setMeta: async (key, value) => void meta.set(key, value)
|
|
4396
|
+
};
|
|
4397
|
+
}
|
|
4398
|
+
function countOf(items) {
|
|
4399
|
+
const c = { waiting: 0, sending: 0, refused: 0, landed: 0 };
|
|
4400
|
+
for (const i of items) c[i.state] += 1;
|
|
4401
|
+
return c;
|
|
4402
|
+
}
|
|
4403
|
+
function openCaptureQueue(opts) {
|
|
4404
|
+
const now = opts.now ?? (() => /* @__PURE__ */ new Date());
|
|
4405
|
+
const store = opts.store ?? indexedDbStore() ?? memoryStore();
|
|
4406
|
+
let syncing = null;
|
|
4407
|
+
let disposed = false;
|
|
4408
|
+
const online = () => {
|
|
4409
|
+
const nav = typeof navigator !== "undefined" ? navigator : void 0;
|
|
4410
|
+
return nav ? nav.onLine !== false : true;
|
|
4411
|
+
};
|
|
4412
|
+
const announce = async () => {
|
|
4413
|
+
if (!opts.onChange) return;
|
|
4414
|
+
const items = await store.all();
|
|
4415
|
+
opts.onChange(countOf(items), items);
|
|
4416
|
+
};
|
|
4417
|
+
const oldestFirst = (items) => items.slice().sort((a, b) => a.captured_at.localeCompare(b.captured_at));
|
|
4418
|
+
const queue = {
|
|
4419
|
+
async enqueue(input) {
|
|
4420
|
+
const key = input.client_key ?? mintClientKey();
|
|
4421
|
+
const item = {
|
|
4422
|
+
client_key: key,
|
|
4423
|
+
organization_id: input.organization_id,
|
|
4424
|
+
sheet_id: input.sheet_id,
|
|
4425
|
+
sheet_title: input.sheet_title,
|
|
4426
|
+
answers: input.answers ?? {},
|
|
4427
|
+
files: (input.files ?? []).map((f) => ({ ...f, uploaded: null })),
|
|
4428
|
+
device: input.device ?? null,
|
|
4429
|
+
captured_at: input.captured_at ?? now().toISOString(),
|
|
4430
|
+
location: input.location ?? null,
|
|
4431
|
+
state: "waiting",
|
|
4432
|
+
attempts: 0,
|
|
4433
|
+
last_error: null,
|
|
4434
|
+
record_id: null,
|
|
4435
|
+
replayed: false,
|
|
4436
|
+
queued_at: now().toISOString(),
|
|
4437
|
+
landed_at: null
|
|
4438
|
+
};
|
|
4439
|
+
await store.put(item);
|
|
4440
|
+
await announce();
|
|
4441
|
+
return key;
|
|
4442
|
+
},
|
|
4443
|
+
list: () => store.all().then(oldestFirst),
|
|
4444
|
+
counts: () => store.all().then(countOf),
|
|
4445
|
+
async sync() {
|
|
4446
|
+
if (syncing) return syncing;
|
|
4447
|
+
syncing = (async () => {
|
|
4448
|
+
const report = {
|
|
4449
|
+
attempted: 0,
|
|
4450
|
+
landed: 0,
|
|
4451
|
+
replayed: 0,
|
|
4452
|
+
refused: 0,
|
|
4453
|
+
deferred: 0,
|
|
4454
|
+
outcomes: []
|
|
4455
|
+
};
|
|
4456
|
+
const pending = oldestFirst(await store.all()).filter((i) => i.state === "waiting" || i.state === "sending");
|
|
4457
|
+
if (!online()) {
|
|
4458
|
+
report.deferred = pending.length;
|
|
4459
|
+
report.stopped_because = "There is no signal, so nothing was sent. Everything is still here.";
|
|
4460
|
+
return report;
|
|
4461
|
+
}
|
|
4462
|
+
for (const item of pending) {
|
|
4463
|
+
report.attempted += 1;
|
|
4464
|
+
item.state = "sending";
|
|
4465
|
+
item.attempts += 1;
|
|
4466
|
+
await store.put(item);
|
|
4467
|
+
await announce();
|
|
4468
|
+
try {
|
|
4469
|
+
for (const f of item.files) {
|
|
4470
|
+
if (f.uploaded) continue;
|
|
4471
|
+
f.uploaded = await opts.ports.uploadFile(f, item);
|
|
4472
|
+
f.blob = null;
|
|
4473
|
+
await store.put(item);
|
|
4474
|
+
}
|
|
4475
|
+
const refs = item.files.map((f) => ({
|
|
4476
|
+
field: f.field,
|
|
4477
|
+
name: f.name,
|
|
4478
|
+
mime_type: f.mime_type,
|
|
4479
|
+
size_bytes: f.size_bytes,
|
|
4480
|
+
duration_ms: f.duration_ms ?? null,
|
|
4481
|
+
file_id: f.uploaded?.file_id ?? null,
|
|
4482
|
+
url: f.uploaded?.url ?? null
|
|
4483
|
+
}));
|
|
4484
|
+
const res = await opts.ports.submit({
|
|
4485
|
+
sheet_id: item.sheet_id,
|
|
4486
|
+
client_key: item.client_key,
|
|
4487
|
+
answers: item.answers,
|
|
4488
|
+
files: refs,
|
|
4489
|
+
device: item.device,
|
|
4490
|
+
captured_at: item.captured_at,
|
|
4491
|
+
location: item.location
|
|
4492
|
+
});
|
|
4493
|
+
if (res.ok && res.data && res.data.record_id) {
|
|
4494
|
+
item.state = "landed";
|
|
4495
|
+
item.record_id = res.data.record_id;
|
|
4496
|
+
item.replayed = !!res.data.replay;
|
|
4497
|
+
item.landed_at = now().toISOString();
|
|
4498
|
+
item.last_error = null;
|
|
4499
|
+
report.landed += 1;
|
|
4500
|
+
if (item.replayed) report.replayed += 1;
|
|
4501
|
+
report.outcomes.push({
|
|
4502
|
+
client_key: item.client_key,
|
|
4503
|
+
state: item.state,
|
|
4504
|
+
record_id: item.record_id,
|
|
4505
|
+
replay: item.replayed,
|
|
4506
|
+
says: res.data.message ?? null
|
|
4507
|
+
});
|
|
4508
|
+
} else if (res.ok && res.data && !res.data.record_id) {
|
|
4509
|
+
item.state = "refused";
|
|
4510
|
+
item.last_error = res.data.message ?? `This sheet is ${res.data.state}.`;
|
|
4511
|
+
report.refused += 1;
|
|
4512
|
+
report.outcomes.push({
|
|
4513
|
+
client_key: item.client_key,
|
|
4514
|
+
state: item.state,
|
|
4515
|
+
record_id: null,
|
|
4516
|
+
replay: false,
|
|
4517
|
+
says: item.last_error
|
|
4518
|
+
});
|
|
4519
|
+
} else if (isDecided(res.error)) {
|
|
4520
|
+
item.state = "refused";
|
|
4521
|
+
item.last_error = res.error?.message ?? "The store refused this capture.";
|
|
4522
|
+
report.refused += 1;
|
|
4523
|
+
report.outcomes.push({
|
|
4524
|
+
client_key: item.client_key,
|
|
4525
|
+
state: item.state,
|
|
4526
|
+
record_id: null,
|
|
4527
|
+
replay: false,
|
|
4528
|
+
says: item.last_error
|
|
4529
|
+
});
|
|
4530
|
+
} else {
|
|
4531
|
+
item.state = "waiting";
|
|
4532
|
+
item.last_error = res.error?.message ?? "It could not be sent just now.";
|
|
4533
|
+
report.deferred += 1;
|
|
4534
|
+
report.outcomes.push({
|
|
4535
|
+
client_key: item.client_key,
|
|
4536
|
+
state: item.state,
|
|
4537
|
+
record_id: null,
|
|
4538
|
+
replay: false,
|
|
4539
|
+
says: item.last_error
|
|
4540
|
+
});
|
|
4541
|
+
}
|
|
4542
|
+
} catch (err2) {
|
|
4543
|
+
item.state = "waiting";
|
|
4544
|
+
item.last_error = err2 instanceof Error ? err2.message : "It could not be sent just now.";
|
|
4545
|
+
report.deferred += 1;
|
|
4546
|
+
report.outcomes.push({
|
|
4547
|
+
client_key: item.client_key,
|
|
4548
|
+
state: item.state,
|
|
4549
|
+
record_id: null,
|
|
4550
|
+
replay: false,
|
|
4551
|
+
says: item.last_error
|
|
4552
|
+
});
|
|
4553
|
+
}
|
|
4554
|
+
await store.put(item);
|
|
4555
|
+
await announce();
|
|
4556
|
+
if (!online()) {
|
|
4557
|
+
report.stopped_because = "The signal went away again. Everything still on the phone is still here.";
|
|
4558
|
+
break;
|
|
4559
|
+
}
|
|
4560
|
+
}
|
|
4561
|
+
await store.setMeta("last_synced_at", now().toISOString());
|
|
4562
|
+
return report;
|
|
4563
|
+
})();
|
|
4564
|
+
try {
|
|
4565
|
+
return await syncing;
|
|
4566
|
+
} finally {
|
|
4567
|
+
syncing = null;
|
|
4568
|
+
}
|
|
4569
|
+
},
|
|
4570
|
+
async retry(clientKey, patch) {
|
|
4571
|
+
const items = await store.all();
|
|
4572
|
+
const item = items.find((i) => i.client_key === clientKey);
|
|
4573
|
+
if (!item) return;
|
|
4574
|
+
if (patch?.answers) item.answers = { ...item.answers, ...patch.answers };
|
|
4575
|
+
item.state = "waiting";
|
|
4576
|
+
item.last_error = null;
|
|
4577
|
+
await store.put(item);
|
|
4578
|
+
await announce();
|
|
4579
|
+
},
|
|
4580
|
+
async discard(clientKey) {
|
|
4581
|
+
await store.remove(clientKey);
|
|
4582
|
+
await announce();
|
|
4583
|
+
},
|
|
4584
|
+
async clearLanded() {
|
|
4585
|
+
const items = await store.all();
|
|
4586
|
+
const landed = items.filter((i) => i.state === "landed");
|
|
4587
|
+
for (const i of landed) await store.remove(i.client_key);
|
|
4588
|
+
await announce();
|
|
4589
|
+
return landed.length;
|
|
4590
|
+
},
|
|
4591
|
+
lastSyncedAt: () => store.meta("last_synced_at"),
|
|
4592
|
+
isOnline: online,
|
|
4593
|
+
dispose() {
|
|
4594
|
+
disposed = true;
|
|
4595
|
+
if (typeof window !== "undefined" && handler) window.removeEventListener("online", handler);
|
|
4596
|
+
}
|
|
4597
|
+
};
|
|
4598
|
+
let handler = null;
|
|
4599
|
+
const auto = opts.autoSync ?? typeof window !== "undefined";
|
|
4600
|
+
if (auto && typeof window !== "undefined") {
|
|
4601
|
+
handler = () => {
|
|
4602
|
+
if (!disposed) void queue.sync();
|
|
4603
|
+
};
|
|
4604
|
+
window.addEventListener("online", handler);
|
|
4605
|
+
}
|
|
4606
|
+
return queue;
|
|
4607
|
+
}
|
|
4608
|
+
|
|
4117
4609
|
// src/record-scope.ts
|
|
4118
4610
|
function scopeChip(scope) {
|
|
4119
4611
|
return scope.title ? `About: ${scope.title}` : "About: this record";
|
|
@@ -4137,6 +4629,7 @@ export {
|
|
|
4137
4629
|
PARITY_FIELD_TYPES,
|
|
4138
4630
|
PERMISSION_LEVELS,
|
|
4139
4631
|
PER_VALUE_ACCESS_WORDS,
|
|
4632
|
+
REFUSALS_WORTH_REPEATING,
|
|
4140
4633
|
RELATION_BINDINGS,
|
|
4141
4634
|
RELATION_CARDINALITIES,
|
|
4142
4635
|
RELATION_FLAVORS,
|
|
@@ -4161,11 +4654,16 @@ export {
|
|
|
4161
4654
|
err,
|
|
4162
4655
|
highestLevel,
|
|
4163
4656
|
holdsARetiredChoice,
|
|
4657
|
+
indexedDbStore,
|
|
4658
|
+
isDecided,
|
|
4164
4659
|
isRecordsErr,
|
|
4165
4660
|
isTheChosen,
|
|
4166
4661
|
looksLikeAnId,
|
|
4167
4662
|
measureKey,
|
|
4663
|
+
memoryStore,
|
|
4664
|
+
mintClientKey,
|
|
4168
4665
|
ok,
|
|
4666
|
+
openCaptureQueue,
|
|
4169
4667
|
optionKey,
|
|
4170
4668
|
optionLabel,
|
|
4171
4669
|
portalPath,
|