@ai-matrx/records 0.24.0 → 0.27.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 +97 -0
- package/dist/core/index.cjs +491 -8
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +110 -3
- package/dist/core/index.d.ts +110 -3
- package/dist/core/index.js +491 -8
- package/dist/core/index.js.map +1 -1
- package/dist/index.cjs +350 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +737 -15
- package/dist/index.d.ts +737 -15
- package/dist/index.js +350 -8
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +491 -8
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +831 -15
- package/dist/react/index.d.ts +831 -15
- package/dist/react/index.js +491 -8
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/react/index.cjs
CHANGED
|
@@ -40,6 +40,8 @@ __export(react_exports, {
|
|
|
40
40
|
PARITY_FIELD_TYPES: () => PARITY_FIELD_TYPES,
|
|
41
41
|
PERMISSION_LEVELS: () => PERMISSION_LEVELS,
|
|
42
42
|
PER_VALUE_ACCESS_WORDS: () => PER_VALUE_ACCESS_WORDS,
|
|
43
|
+
PIPELINE_RULE_KINDS: () => PIPELINE_RULE_KINDS,
|
|
44
|
+
REFUSALS_WORTH_REPEATING: () => REFUSALS_WORTH_REPEATING,
|
|
43
45
|
RELATION_BINDINGS: () => RELATION_BINDINGS,
|
|
44
46
|
RELATION_CARDINALITIES: () => RELATION_CARDINALITIES,
|
|
45
47
|
RELATION_FLAVORS: () => RELATION_FLAVORS,
|
|
@@ -64,11 +66,17 @@ __export(react_exports, {
|
|
|
64
66
|
err: () => err,
|
|
65
67
|
highestLevel: () => highestLevel,
|
|
66
68
|
holdsARetiredChoice: () => holdsARetiredChoice,
|
|
69
|
+
indexedDbStore: () => indexedDbStore,
|
|
70
|
+
isDecided: () => isDecided,
|
|
67
71
|
isRecordsErr: () => isRecordsErr,
|
|
68
72
|
isTheChosen: () => isTheChosen,
|
|
69
73
|
looksLikeAnId: () => looksLikeAnId,
|
|
74
|
+
mayDrag: () => mayDrag,
|
|
70
75
|
measureKey: () => measureKey,
|
|
76
|
+
memoryStore: () => memoryStore,
|
|
77
|
+
mintClientKey: () => mintClientKey,
|
|
71
78
|
ok: () => ok,
|
|
79
|
+
openCaptureQueue: () => openCaptureQueue,
|
|
72
80
|
optionKey: () => optionKey,
|
|
73
81
|
optionLabel: () => optionLabel,
|
|
74
82
|
portalPath: () => portalPath,
|
|
@@ -157,6 +165,7 @@ var PARITY_FIELD_TYPES = [
|
|
|
157
165
|
{ parity_type: "url", behavior: "text", made_of: "text whose format is url, with the pattern Rule that makes the format enforceable" }
|
|
158
166
|
];
|
|
159
167
|
var RULE_NODE_KINDS = [
|
|
168
|
+
{ node: "actor_at_least", evaluated_by: "PIPELINES" },
|
|
160
169
|
{ node: "add", evaluated_by: "W1-RULE" },
|
|
161
170
|
{ node: "and", evaluated_by: "W1-RULE" },
|
|
162
171
|
{ node: "concat", evaluated_by: "W1-RULE" },
|
|
@@ -177,6 +186,8 @@ var RULE_NODE_KINDS = [
|
|
|
177
186
|
{ node: "or", evaluated_by: "W1-RULE" },
|
|
178
187
|
{ node: "parent_field", evaluated_by: "W1-RULE-APPLY" },
|
|
179
188
|
{ node: "present", evaluated_by: "W1-RULE" },
|
|
189
|
+
{ node: "previous", evaluated_by: "PIPELINES" },
|
|
190
|
+
{ node: "stage_count", evaluated_by: "PIPELINES" },
|
|
180
191
|
{ node: "sub", evaluated_by: "W1-RULE" }
|
|
181
192
|
];
|
|
182
193
|
var KERNEL_TABLES = [
|
|
@@ -199,16 +210,27 @@ var STORE_DOORS = [
|
|
|
199
210
|
{ name: "agent_table_claim", args: "p_organization uuid, p_table uuid, p_conversation uuid DEFAULT NULL::uuid", returns: "void", security: "definer" },
|
|
200
211
|
{ name: "agg_assert_key", args: "p_key text", returns: "text", security: "invoker" },
|
|
201
212
|
{ name: "agg_buckets", args: "", returns: "text[]", security: "invoker" },
|
|
202
|
-
{ name: "
|
|
213
|
+
{ name: "agg_cadence_normalize", args: "p_cadence text", returns: "text", security: "invoker" },
|
|
214
|
+
{ 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" },
|
|
215
|
+
{ 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" },
|
|
216
|
+
{ 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" },
|
|
217
|
+
{ 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" },
|
|
203
218
|
{ 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" },
|
|
219
|
+
{ name: "agg_digest_tick", args: "", returns: "integer", security: "invoker" },
|
|
204
220
|
{ 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" },
|
|
221
|
+
{ name: "agg_last_digest_at", args: "p_organization_id uuid, p_rule_id uuid", returns: "timestamp with time zone", security: "invoker" },
|
|
205
222
|
{ name: "agg_operations", args: "", returns: "text[]", security: "invoker" },
|
|
223
|
+
{ name: "agg_quiet_until", args: "p_quiet jsonb, p_at timestamp with time zone", returns: "timestamp with time zone", security: "invoker" },
|
|
224
|
+
{ name: "agg_record_name", args: "p_organization_id uuid, p_record_id uuid, p_state jsonb DEFAULT NULL::jsonb", returns: "text", security: "invoker" },
|
|
206
225
|
{ 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" },
|
|
207
226
|
{ name: "agg_subscription_cadences", args: "", returns: "text[]", security: "invoker" },
|
|
208
227
|
{ 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" },
|
|
209
|
-
{ name: "
|
|
228
|
+
{ 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" },
|
|
229
|
+
{ name: "agg_subscription_tick", args: "p_window interval DEFAULT '00:15:00'::interval", returns: "integer", security: "invoker" },
|
|
230
|
+
{ 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" },
|
|
210
231
|
{ name: "agg_value_sql", args: "p_key text", returns: "text", security: "invoker" },
|
|
211
232
|
{ name: "agg_view_admits", args: "p_organization_id uuid, p_saved_view_id uuid, p_record_id uuid", returns: "boolean", security: "invoker" },
|
|
233
|
+
{ name: "agg_view_admits_state", args: "p_definition jsonb, p_state jsonb", returns: "boolean", security: "invoker" },
|
|
212
234
|
{ 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" },
|
|
213
235
|
{ name: "anon_clear", args: "p_organization_id uuid, p_submission_id uuid", returns: "uuid", security: "definer" },
|
|
214
236
|
{ 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" },
|
|
@@ -229,9 +251,23 @@ var STORE_DOORS = [
|
|
|
229
251
|
{ name: "assert_organization_admin", args: "p_organization_id uuid, p_door text, p_what text", returns: "void", security: "invoker" },
|
|
230
252
|
{ name: "assert_organization_wall", args: "p_kind text, p_organization_id uuid, p_row jsonb", returns: "void", security: "invoker" },
|
|
231
253
|
{ name: "assert_store_door", args: "p_organization_id uuid, p_door text", returns: "void", security: "invoker" },
|
|
254
|
+
{ 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" },
|
|
255
|
+
{ 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" },
|
|
256
|
+
{ 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" },
|
|
257
|
+
{ 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" },
|
|
258
|
+
{ 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" },
|
|
259
|
+
{ 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" },
|
|
260
|
+
{ 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" },
|
|
261
|
+
{ 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" },
|
|
262
|
+
{ 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" },
|
|
232
263
|
{ name: "bump_epoch", args: "p_entity_type text, p_entity_id uuid, p_organization_id uuid DEFAULT NULL::uuid", returns: "bigint", security: "definer" },
|
|
233
264
|
{ 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" },
|
|
234
265
|
{ name: "caller_role", args: "", returns: "name", security: "invoker" },
|
|
266
|
+
{ 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" },
|
|
267
|
+
{ name: "capture_publish", args: "p_organization_id uuid, p_sheet_id uuid, p_open boolean DEFAULT true", returns: "timestamp with time zone", security: "definer" },
|
|
268
|
+
{ 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" },
|
|
269
|
+
{ 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" },
|
|
270
|
+
{ 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" },
|
|
235
271
|
{ name: "carry_unchanged_value_stamps", args: "p_old jsonb, p_new jsonb", returns: "jsonb", security: "invoker" },
|
|
236
272
|
{ 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" },
|
|
237
273
|
{ 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" },
|
|
@@ -342,6 +378,7 @@ var STORE_DOORS = [
|
|
|
342
378
|
{ 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" },
|
|
343
379
|
{ 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" },
|
|
344
380
|
{ name: "entity_value_write", args: "p_organization_id uuid, p_token text, p_record_id uuid, p_patch jsonb", returns: "jsonb", security: "invoker" },
|
|
381
|
+
{ name: "export_ceiling", args: "p_organization_id uuid DEFAULT NULL::uuid", returns: "integer", security: "definer" },
|
|
345
382
|
{ 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" },
|
|
346
383
|
{ name: "external_foreign_table_findings", args: "", returns: "SETOF text", security: "definer" },
|
|
347
384
|
{ name: "external_history_event", args: "p_organization_id uuid, p_link_id uuid, p_operation text", returns: "bigint", security: "definer" },
|
|
@@ -369,6 +406,7 @@ var STORE_DOORS = [
|
|
|
369
406
|
{ 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" },
|
|
370
407
|
{ 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" },
|
|
371
408
|
{ 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" },
|
|
409
|
+
{ name: "freshness_verdict", args: "p_written_at timestamp with time zone, p_ceiling_seconds numeric", returns: "jsonb", security: "definer" },
|
|
372
410
|
{ name: "guard_refusals_are_complete", args: "", returns: "TABLE(guard text, said text)", security: "invoker" },
|
|
373
411
|
{ 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" },
|
|
374
412
|
{ 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" },
|
|
@@ -458,12 +496,20 @@ var STORE_DOORS = [
|
|
|
458
496
|
{ 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" },
|
|
459
497
|
{ name: "owning_table", args: "p_organization_id uuid, p_record_id uuid", returns: "uuid", security: "invoker" },
|
|
460
498
|
{ name: "owning_table_gone", args: "p_organization_id uuid, p_record_id uuid", returns: "boolean", security: "invoker" },
|
|
499
|
+
{ name: "page_ceiling", args: "p_organization_id uuid DEFAULT NULL::uuid", returns: "integer", security: "definer" },
|
|
500
|
+
{ name: "page_contract", args: "p_organization_id uuid", returns: "jsonb", security: "definer" },
|
|
501
|
+
{ 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" },
|
|
461
502
|
{ name: "parity_field_types", args: "", returns: "TABLE(parity_type text, behavior text, made_of text)", security: "invoker" },
|
|
462
503
|
{ name: "parity_type", args: "p_field_data jsonb", returns: "text", security: "invoker" },
|
|
463
504
|
{ 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" },
|
|
464
505
|
{ name: "per_value_access_words", args: "", returns: "text[]", security: "invoker" },
|
|
465
506
|
{ name: "person_kernel_id", args: "", returns: "uuid", security: "invoker" },
|
|
466
507
|
{ name: "pin_agent_cells", args: "p_new jsonb, p_old jsonb, p_agent_keys text[]", returns: "jsonb", security: "invoker" },
|
|
508
|
+
{ 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" },
|
|
509
|
+
{ name: "pipeline_declare", args: "p_organization_id uuid, p_table_id uuid, p_spec jsonb", returns: "jsonb", security: "definer" },
|
|
510
|
+
{ 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" },
|
|
511
|
+
{ name: "pipeline_read", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "definer" },
|
|
512
|
+
{ name: "pipeline_transition_refusal", args: "p_organization_id uuid, p_record_id uuid, p_to text", returns: "jsonb", security: "definer" },
|
|
467
513
|
{ name: "portal_admits", args: "p_organization_id uuid, p_user_id uuid DEFAULT NULL::uuid", returns: "boolean", security: "definer" },
|
|
468
514
|
{ name: "portal_card", args: "p_organization_id uuid, p_portal_id uuid", returns: "jsonb", security: "definer" },
|
|
469
515
|
{ 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" },
|
|
@@ -491,6 +537,9 @@ var STORE_DOORS = [
|
|
|
491
537
|
{ name: "promoted_read", args: "p_organization_id uuid, p_table_id uuid, p_field_key text, p_value text", returns: "SETOF uuid", security: "invoker" },
|
|
492
538
|
{ name: "promoted_value_path", args: "p_field_data jsonb", returns: "text", security: "invoker" },
|
|
493
539
|
{ name: "promotion_inline_ceiling", args: "", returns: "integer", security: "invoker" },
|
|
540
|
+
{ 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" },
|
|
541
|
+
{ name: "provenance_retention_days", args: "p_organization_id uuid", returns: "integer", security: "definer" },
|
|
542
|
+
{ name: "provenance_write", args: "p_organization_id uuid, p_conversation_id uuid, p_turn_id text, p_rows jsonb", returns: "integer", security: "definer" },
|
|
494
543
|
{ name: "query_access_ids", args: "p_organization_id uuid, p_required text DEFAULT 'viewer'::text", returns: "uuid[]", security: "invoker" },
|
|
495
544
|
{ 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" },
|
|
496
545
|
{ 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" },
|
|
@@ -591,6 +640,7 @@ var STORE_DOORS = [
|
|
|
591
640
|
{ 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" },
|
|
592
641
|
{ name: "sign_token_decode", args: "p_token text", returns: "bytea", security: "invoker" },
|
|
593
642
|
{ name: "sign_token_encode", args: "p_bytes bytea", returns: "text", security: "invoker" },
|
|
643
|
+
{ name: "silent_page_doors", args: "", returns: "TABLE(door text, why text)", security: "definer" },
|
|
594
644
|
{ name: "size_refusal", args: "p_organization_id uuid, p_data jsonb", returns: "text", security: "invoker" },
|
|
595
645
|
{ name: "source_next_pointer", args: "p_sources jsonb", returns: "text", security: "invoker" },
|
|
596
646
|
{ name: "source_pointer", args: "p_sources jsonb, p_source jsonb", returns: "text", security: "invoker" },
|
|
@@ -598,8 +648,10 @@ var STORE_DOORS = [
|
|
|
598
648
|
{ name: "storage_modes", args: "", returns: "text[]", security: "invoker" },
|
|
599
649
|
{ name: "store_is_open", args: "p_organization_id uuid DEFAULT NULL::uuid", returns: "boolean", security: "invoker" },
|
|
600
650
|
{ name: "subscription_cadences", args: "p_organization_id uuid", returns: "text[]", security: "definer" },
|
|
651
|
+
{ name: "subscription_declare", args: "p_organization_id uuid, p_table_id uuid, p_spec jsonb", returns: "uuid", security: "definer" },
|
|
601
652
|
{ name: "subscription_mute", args: "p_organization_id uuid, p_rule_id uuid, p_muted boolean DEFAULT true", returns: "boolean", security: "definer" },
|
|
602
|
-
{ name: "
|
|
653
|
+
{ name: "subscription_preview", args: "p_organization_id uuid, p_rule_id uuid", returns: "jsonb", security: "definer" },
|
|
654
|
+
{ 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" },
|
|
603
655
|
{ name: "table_capacity", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "definer" },
|
|
604
656
|
{ 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" },
|
|
605
657
|
{ name: "table_contents", args: "p_organization_id uuid, p_table_id uuid", returns: "TABLE(record_id uuid, kind text, goes_at integer)", security: "invoker" },
|
|
@@ -610,6 +662,7 @@ var STORE_DOORS = [
|
|
|
610
662
|
{ name: "table_record_ceiling", args: "", returns: "integer", security: "invoker" },
|
|
611
663
|
{ name: "table_record_ceiling", args: "p_organization_id uuid", returns: "integer", security: "invoker" },
|
|
612
664
|
{ 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" },
|
|
665
|
+
{ name: "table_stage_field", args: "p_organization_id uuid, p_table_id uuid", returns: "text", security: "definer" },
|
|
613
666
|
{ name: "table_storage", args: "p_organization_id uuid, p_table_id uuid", returns: "text", security: "invoker" },
|
|
614
667
|
{ name: "table_type_field", args: "p_organization_id uuid, p_table_id uuid", returns: "text", security: "definer" },
|
|
615
668
|
{ 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" },
|
|
@@ -697,12 +750,15 @@ var STORE_KNOBS = [
|
|
|
697
750
|
{ key: "enrichment_sensitivity_ceiling", value: '"internal"', type: "string" },
|
|
698
751
|
{ key: "entity_custom_fields_guard", value: "false", type: "boolean" },
|
|
699
752
|
{ key: "entity_types_guard", value: "false", type: "boolean" },
|
|
753
|
+
{ key: "export_rows_ceiling", value: "100000", type: "integer" },
|
|
700
754
|
{ key: "external_principal_enabled", value: "false", type: "boolean" },
|
|
701
755
|
{ key: "field_index_guard", value: "false", type: "boolean" },
|
|
702
756
|
{ 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" },
|
|
703
757
|
{ key: "inbound_domain", value: '"inbound.matrxserver.com"', type: "string" },
|
|
704
758
|
{ key: "member_default_level", value: '"viewer"', type: "enum" },
|
|
705
759
|
{ key: "member_default_visibility", value: '"all_records"', type: "enum" },
|
|
760
|
+
{ key: "page_size_ceiling", value: "1000", type: "integer" },
|
|
761
|
+
{ key: "provenance_retention_days", value: "30", type: "number" },
|
|
706
762
|
{ key: "records_tool_default", value: "true", type: "boolean" },
|
|
707
763
|
{ key: "row_versions_guard", value: "false", type: "boolean" },
|
|
708
764
|
{ key: "sandbox_expanded_frame_height_px", value: "20000", type: "integer" },
|
|
@@ -719,15 +775,15 @@ var STORE_REFUSAL_CODES = [
|
|
|
719
775
|
{ 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" },
|
|
720
776
|
{ 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" },
|
|
721
777
|
{ code: "22003", raised_by: "context_resolve" },
|
|
722
|
-
{ 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" },
|
|
778
|
+
{ 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" },
|
|
723
779
|
{ code: "22007", raised_by: "dashboard_window_sql" },
|
|
724
780
|
{ code: "22012", raised_by: "rule_eval" },
|
|
725
|
-
{ 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" },
|
|
726
|
-
{ 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" },
|
|
781
|
+
{ 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" },
|
|
782
|
+
{ 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" },
|
|
727
783
|
{ 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" },
|
|
728
|
-
{ 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" },
|
|
784
|
+
{ 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" },
|
|
729
785
|
{ code: "40001", raised_by: "has_visibility_at" },
|
|
730
|
-
{ 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" },
|
|
786
|
+
{ 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" },
|
|
731
787
|
{ code: "42703", raised_by: "entity_table,portal_declare" },
|
|
732
788
|
{ code: "53400", raised_by: "anon_rate_take,delete_cascade_closure,enrich_due,enrich_land,promote_field" },
|
|
733
789
|
{ code: "54001", raised_by: "record_delete" },
|
|
@@ -1344,6 +1400,7 @@ var ENTITY_TOKENS = [
|
|
|
1344
1400
|
"notification_event_override",
|
|
1345
1401
|
"notification_event_type",
|
|
1346
1402
|
"notification_preference",
|
|
1403
|
+
"notification_submission",
|
|
1347
1404
|
"notify_outsider_door_baseline",
|
|
1348
1405
|
"oauth_handoff_claim",
|
|
1349
1406
|
"opinion_clusters",
|
|
@@ -1889,6 +1946,12 @@ var DOORS = {
|
|
|
1889
1946
|
tableKernelId: "table_kernel_id",
|
|
1890
1947
|
// A saved view references its membership Rule, and the STORE decides who is
|
|
1891
1948
|
// in it — the screen never re-implements the predicate.
|
|
1949
|
+
pipelineDeclare: "pipeline_declare",
|
|
1950
|
+
pipelineRead: "pipeline_read",
|
|
1951
|
+
pipelineBoard: "pipeline_board",
|
|
1952
|
+
pipelineTransitionRefusal: "pipeline_transition_refusal",
|
|
1953
|
+
pipelineMove: "pipeline_move",
|
|
1954
|
+
tableStageField: "table_stage_field",
|
|
1892
1955
|
ruleMembers: "rule_members",
|
|
1893
1956
|
ruleMembership: "rule_membership",
|
|
1894
1957
|
ruleRun: "rule_run",
|
|
@@ -1963,6 +2026,16 @@ var DOORS = {
|
|
|
1963
2026
|
// this product that decides whether anybody ever trusts it: the moment a
|
|
1964
2027
|
// person types over an agent-owned cell the store pins it, and the next run
|
|
1965
2028
|
// leaves it exactly as they left it.
|
|
2029
|
+
// PRODUCTS row 15 — "let my crew photograph each bin and log the weight on
|
|
2030
|
+
// site". A capture sheet is the ONE Form object saying `audience = 'crew'`,
|
|
2031
|
+
// opened by `capture_opened_at`; these five are SIGNED-IN doors granted to
|
|
2032
|
+
// `authenticated`, unlike the public form's two, because a crew member has an
|
|
2033
|
+
// account and their own level on the Table is the whole access decision.
|
|
2034
|
+
captureSheetDeclare: "capture_sheet_declare",
|
|
2035
|
+
capturePublish: "capture_publish",
|
|
2036
|
+
captureSheets: "capture_sheets",
|
|
2037
|
+
captureOpen: "capture_open",
|
|
2038
|
+
captureSubmit: "capture_submit",
|
|
1966
2039
|
enrichments: "enrichments",
|
|
1967
2040
|
enrichDeclare: "enrich_declare",
|
|
1968
2041
|
enrichDue: "enrich_due",
|
|
@@ -2021,6 +2094,11 @@ var DOORS = {
|
|
|
2021
2094
|
// these rows, so "tell me when a patient arrives" can also be un-told.
|
|
2022
2095
|
subscriptions: "subscriptions",
|
|
2023
2096
|
subscriptionMute: "subscription_mute",
|
|
2097
|
+
// The two DOOR-18 acts that had no door at all until 2026-09-20: WRITE a
|
|
2098
|
+
// subscription (a Rule is declared, never written as a record — REC-72) and SEE
|
|
2099
|
+
// the summary it would send right now without sending it.
|
|
2100
|
+
subscriptionDeclare: "subscription_declare",
|
|
2101
|
+
subscriptionPreview: "subscription_preview",
|
|
2024
2102
|
// The cadence CATALOGUE a person's screen may ask for. `agg_subscription_cadences`
|
|
2025
2103
|
// above is the notifier's own and holds no client grant; this door delegates to
|
|
2026
2104
|
// it, so a picker and the digest runner can never offer different words.
|
|
@@ -2665,6 +2743,54 @@ function createRecordsClient(config) {
|
|
|
2665
2743
|
async ruleKernelId() {
|
|
2666
2744
|
return callDoor(DOORS.ruleKernelId, {}, "ruleKernelId");
|
|
2667
2745
|
},
|
|
2746
|
+
async pipelineRead({ table_id }) {
|
|
2747
|
+
return callDoor(
|
|
2748
|
+
DOORS.pipelineRead,
|
|
2749
|
+
{ p_organization_id: org, p_table_id: table_id },
|
|
2750
|
+
"pipelineRead"
|
|
2751
|
+
);
|
|
2752
|
+
},
|
|
2753
|
+
async pipelineBoard({ table_id, measure }) {
|
|
2754
|
+
return callDoor(
|
|
2755
|
+
DOORS.pipelineBoard,
|
|
2756
|
+
{ p_organization_id: org, p_table_id: table_id, p_measure: measure ?? null },
|
|
2757
|
+
"pipelineBoard"
|
|
2758
|
+
);
|
|
2759
|
+
},
|
|
2760
|
+
async pipelineTransitionRefusal({ record_id, to }) {
|
|
2761
|
+
return callDoor(
|
|
2762
|
+
DOORS.pipelineTransitionRefusal,
|
|
2763
|
+
{ p_organization_id: org, p_record_id: record_id, p_to: to },
|
|
2764
|
+
"pipelineTransitionRefusal"
|
|
2765
|
+
);
|
|
2766
|
+
},
|
|
2767
|
+
async pipelineMove({ record_id, to, also, expected_version }) {
|
|
2768
|
+
return callDoor(
|
|
2769
|
+
DOORS.pipelineMove,
|
|
2770
|
+
{
|
|
2771
|
+
p_organization_id: org,
|
|
2772
|
+
p_record_id: record_id,
|
|
2773
|
+
p_to: to,
|
|
2774
|
+
p_also: also ?? {},
|
|
2775
|
+
p_expected_version: expected_version ?? null
|
|
2776
|
+
},
|
|
2777
|
+
"pipelineMove"
|
|
2778
|
+
);
|
|
2779
|
+
},
|
|
2780
|
+
async pipelineDeclare({ table_id, spec }) {
|
|
2781
|
+
return callDoor(
|
|
2782
|
+
DOORS.pipelineDeclare,
|
|
2783
|
+
{ p_organization_id: org, p_table_id: table_id, p_spec: spec },
|
|
2784
|
+
"pipelineDeclare"
|
|
2785
|
+
);
|
|
2786
|
+
},
|
|
2787
|
+
async tableStageField({ table_id }) {
|
|
2788
|
+
return callDoor(
|
|
2789
|
+
DOORS.tableStageField,
|
|
2790
|
+
{ p_organization_id: org, p_table_id: table_id },
|
|
2791
|
+
"tableStageField"
|
|
2792
|
+
);
|
|
2793
|
+
},
|
|
2668
2794
|
async ruleMembers({ rule_id }) {
|
|
2669
2795
|
return callDoor(
|
|
2670
2796
|
DOORS.ruleMembers,
|
|
@@ -2879,6 +3005,64 @@ function createRecordsClient(config) {
|
|
|
2879
3005
|
"ruleEval"
|
|
2880
3006
|
);
|
|
2881
3007
|
},
|
|
3008
|
+
async captureSheetDeclare(args) {
|
|
3009
|
+
return callDoor(
|
|
3010
|
+
DOORS.captureSheetDeclare,
|
|
3011
|
+
{
|
|
3012
|
+
p_organization_id: org,
|
|
3013
|
+
p_table_id: args.table_id,
|
|
3014
|
+
p_title: args.title,
|
|
3015
|
+
p_questions: args.questions,
|
|
3016
|
+
p_presentation: args.presentation ?? {},
|
|
3017
|
+
p_sheet_id: args.sheet_id ?? null,
|
|
3018
|
+
p_notify_rule_id: args.notify_rule_id ?? null
|
|
3019
|
+
},
|
|
3020
|
+
"captureSheetDeclare"
|
|
3021
|
+
);
|
|
3022
|
+
},
|
|
3023
|
+
async capturePublish(args) {
|
|
3024
|
+
return callDoor(
|
|
3025
|
+
DOORS.capturePublish,
|
|
3026
|
+
{ p_organization_id: org, p_sheet_id: args.sheet_id, p_open: args.open ?? true },
|
|
3027
|
+
"capturePublish"
|
|
3028
|
+
);
|
|
3029
|
+
},
|
|
3030
|
+
async captureSheets(args) {
|
|
3031
|
+
return callDoor(
|
|
3032
|
+
DOORS.captureSheets,
|
|
3033
|
+
{ p_organization_id: org, p_table_id: args?.table_id ?? null },
|
|
3034
|
+
"captureSheets"
|
|
3035
|
+
);
|
|
3036
|
+
},
|
|
3037
|
+
async captureOpen(args) {
|
|
3038
|
+
const out = await callDoor(
|
|
3039
|
+
DOORS.captureOpen,
|
|
3040
|
+
{ p_organization_id: org, p_sheet_id: args.sheet_id },
|
|
3041
|
+
"captureOpen"
|
|
3042
|
+
);
|
|
3043
|
+
if (!out.ok) return out;
|
|
3044
|
+
const rows = Array.isArray(out.data) ? out.data : out.data ? [out.data] : [];
|
|
3045
|
+
return { ...out, data: rows[0] ?? null };
|
|
3046
|
+
},
|
|
3047
|
+
async captureSubmit(args) {
|
|
3048
|
+
const out = await callDoor(
|
|
3049
|
+
DOORS.captureSubmit,
|
|
3050
|
+
{
|
|
3051
|
+
p_organization_id: org,
|
|
3052
|
+
p_sheet_id: args.sheet_id,
|
|
3053
|
+
p_client_key: args.client_key,
|
|
3054
|
+
p_payload: args.answers ?? {},
|
|
3055
|
+
p_files: args.files ?? [],
|
|
3056
|
+
p_device: args.device ?? null,
|
|
3057
|
+
p_captured_at: args.captured_at ?? null,
|
|
3058
|
+
p_location: args.location ?? null
|
|
3059
|
+
},
|
|
3060
|
+
"captureSubmit"
|
|
3061
|
+
);
|
|
3062
|
+
if (!out.ok) return out;
|
|
3063
|
+
const rows = Array.isArray(out.data) ? out.data : out.data ? [out.data] : [];
|
|
3064
|
+
return { ...out, data: rows[0] ?? null };
|
|
3065
|
+
},
|
|
2882
3066
|
async enrichments(args) {
|
|
2883
3067
|
return callDoor(
|
|
2884
3068
|
DOORS.enrichments,
|
|
@@ -3038,6 +3222,20 @@ function createRecordsClient(config) {
|
|
|
3038
3222
|
"subscriptions"
|
|
3039
3223
|
);
|
|
3040
3224
|
},
|
|
3225
|
+
async subscriptionDeclare({ table_id, spec }) {
|
|
3226
|
+
return callDoor(
|
|
3227
|
+
DOORS.subscriptionDeclare,
|
|
3228
|
+
{ p_organization_id: org, p_table_id: table_id, p_spec: spec },
|
|
3229
|
+
"subscriptionDeclare"
|
|
3230
|
+
);
|
|
3231
|
+
},
|
|
3232
|
+
async subscriptionPreview({ rule_id }) {
|
|
3233
|
+
return callDoor(
|
|
3234
|
+
DOORS.subscriptionPreview,
|
|
3235
|
+
{ p_organization_id: org, p_rule_id: rule_id },
|
|
3236
|
+
"subscriptionPreview"
|
|
3237
|
+
);
|
|
3238
|
+
},
|
|
3041
3239
|
async subscriptionMute({ rule_id, muted }) {
|
|
3042
3240
|
return callDoor(
|
|
3043
3241
|
DOORS.subscriptionMute,
|
|
@@ -4265,6 +4463,12 @@ function looksLikeAnId(value) {
|
|
|
4265
4463
|
return typeof value === "string" && UUID.test(value);
|
|
4266
4464
|
}
|
|
4267
4465
|
|
|
4466
|
+
// src/pipeline.ts
|
|
4467
|
+
var PIPELINE_RULE_KINDS = ["moves", "requires", "who", "limit", "entry"];
|
|
4468
|
+
function mayDrag(level) {
|
|
4469
|
+
return level === "editor" || level === "admin" || level === "owner";
|
|
4470
|
+
}
|
|
4471
|
+
|
|
4268
4472
|
// src/rule.ts
|
|
4269
4473
|
function publicFormPath(formId) {
|
|
4270
4474
|
return `/f/${formId}`;
|
|
@@ -4280,6 +4484,285 @@ function measureKey(measure) {
|
|
|
4280
4484
|
return measure.op === "count" ? "count" : `${measure.op}_${measure.key ?? ""}`;
|
|
4281
4485
|
}
|
|
4282
4486
|
|
|
4487
|
+
// src/capture-queue.ts
|
|
4488
|
+
var DB_NAME = "matrx-capture";
|
|
4489
|
+
var DB_VERSION = 1;
|
|
4490
|
+
var ITEMS = "captures";
|
|
4491
|
+
var META = "meta";
|
|
4492
|
+
var REFUSALS_WORTH_REPEATING = /* @__PURE__ */ new Set([
|
|
4493
|
+
"stale_read",
|
|
4494
|
+
"timed_out",
|
|
4495
|
+
"store_limit"
|
|
4496
|
+
]);
|
|
4497
|
+
var SQLSTATES_WORTH_REPEATING = /* @__PURE__ */ new Set(["40001", "57014", "53400"]);
|
|
4498
|
+
function isDecided(error) {
|
|
4499
|
+
if (!error) return false;
|
|
4500
|
+
const { code, sqlstate } = error;
|
|
4501
|
+
if (code && REFUSALS_WORTH_REPEATING.has(code)) return false;
|
|
4502
|
+
if (sqlstate && SQLSTATES_WORTH_REPEATING.has(sqlstate)) return false;
|
|
4503
|
+
return !!(code || sqlstate);
|
|
4504
|
+
}
|
|
4505
|
+
function mintClientKey() {
|
|
4506
|
+
const c = typeof crypto !== "undefined" ? crypto : void 0;
|
|
4507
|
+
if (c && typeof c.randomUUID === "function") return `cap-${c.randomUUID()}`;
|
|
4508
|
+
if (c && typeof c.getRandomValues === "function") {
|
|
4509
|
+
const b = c.getRandomValues(new Uint8Array(16));
|
|
4510
|
+
return `cap-${Array.from(b, (x) => x.toString(16).padStart(2, "0")).join("")}`;
|
|
4511
|
+
}
|
|
4512
|
+
return `cap-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 12)}`;
|
|
4513
|
+
}
|
|
4514
|
+
function indexedDbStore(name = DB_NAME) {
|
|
4515
|
+
const idb = typeof globalThis !== "undefined" ? globalThis.indexedDB : void 0;
|
|
4516
|
+
if (!idb) return null;
|
|
4517
|
+
const open = () => new Promise((resolve, reject) => {
|
|
4518
|
+
const req = idb.open(name, DB_VERSION);
|
|
4519
|
+
req.onupgradeneeded = () => {
|
|
4520
|
+
const db = req.result;
|
|
4521
|
+
if (!db.objectStoreNames.contains(ITEMS)) db.createObjectStore(ITEMS, { keyPath: "client_key" });
|
|
4522
|
+
if (!db.objectStoreNames.contains(META)) db.createObjectStore(META);
|
|
4523
|
+
};
|
|
4524
|
+
req.onsuccess = () => resolve(req.result);
|
|
4525
|
+
req.onerror = () => reject(req.error);
|
|
4526
|
+
});
|
|
4527
|
+
const run = (store, mode, fn) => open().then(
|
|
4528
|
+
(db) => new Promise((resolve, reject) => {
|
|
4529
|
+
const tx = db.transaction(store, mode);
|
|
4530
|
+
const req = fn(tx.objectStore(store));
|
|
4531
|
+
req.onsuccess = () => resolve(req.result);
|
|
4532
|
+
req.onerror = () => reject(req.error);
|
|
4533
|
+
tx.oncomplete = () => db.close();
|
|
4534
|
+
})
|
|
4535
|
+
);
|
|
4536
|
+
return {
|
|
4537
|
+
all: () => run(ITEMS, "readonly", (s) => s.getAll()),
|
|
4538
|
+
put: (item) => run(ITEMS, "readwrite", (s) => s.put(item)).then(() => void 0),
|
|
4539
|
+
remove: (key) => run(ITEMS, "readwrite", (s) => s.delete(key)).then(() => void 0),
|
|
4540
|
+
meta: (key) => run(META, "readonly", (s) => s.get(key)).then((v) => v ?? null),
|
|
4541
|
+
setMeta: (key, value) => run(META, "readwrite", (s) => s.put(value, key)).then(() => void 0)
|
|
4542
|
+
};
|
|
4543
|
+
}
|
|
4544
|
+
function memoryStore() {
|
|
4545
|
+
const rows = /* @__PURE__ */ new Map();
|
|
4546
|
+
const meta = /* @__PURE__ */ new Map();
|
|
4547
|
+
return {
|
|
4548
|
+
all: async () => Array.from(rows.values()),
|
|
4549
|
+
put: async (item) => void rows.set(item.client_key, item),
|
|
4550
|
+
remove: async (key) => void rows.delete(key),
|
|
4551
|
+
meta: async (key) => meta.get(key) ?? null,
|
|
4552
|
+
setMeta: async (key, value) => void meta.set(key, value)
|
|
4553
|
+
};
|
|
4554
|
+
}
|
|
4555
|
+
function countOf(items) {
|
|
4556
|
+
const c = { waiting: 0, sending: 0, refused: 0, landed: 0 };
|
|
4557
|
+
for (const i of items) c[i.state] += 1;
|
|
4558
|
+
return c;
|
|
4559
|
+
}
|
|
4560
|
+
function openCaptureQueue(opts) {
|
|
4561
|
+
const now = opts.now ?? (() => /* @__PURE__ */ new Date());
|
|
4562
|
+
const store = opts.store ?? indexedDbStore() ?? memoryStore();
|
|
4563
|
+
let syncing = null;
|
|
4564
|
+
let disposed = false;
|
|
4565
|
+
const online = () => {
|
|
4566
|
+
const nav = typeof navigator !== "undefined" ? navigator : void 0;
|
|
4567
|
+
return nav ? nav.onLine !== false : true;
|
|
4568
|
+
};
|
|
4569
|
+
const announce = async () => {
|
|
4570
|
+
if (!opts.onChange) return;
|
|
4571
|
+
const items = await store.all();
|
|
4572
|
+
opts.onChange(countOf(items), items);
|
|
4573
|
+
};
|
|
4574
|
+
const oldestFirst = (items) => items.slice().sort((a, b) => a.captured_at.localeCompare(b.captured_at));
|
|
4575
|
+
const queue = {
|
|
4576
|
+
async enqueue(input) {
|
|
4577
|
+
const key = input.client_key ?? mintClientKey();
|
|
4578
|
+
const item = {
|
|
4579
|
+
client_key: key,
|
|
4580
|
+
organization_id: input.organization_id,
|
|
4581
|
+
sheet_id: input.sheet_id,
|
|
4582
|
+
sheet_title: input.sheet_title,
|
|
4583
|
+
answers: input.answers ?? {},
|
|
4584
|
+
files: (input.files ?? []).map((f) => ({ ...f, uploaded: null })),
|
|
4585
|
+
device: input.device ?? null,
|
|
4586
|
+
captured_at: input.captured_at ?? now().toISOString(),
|
|
4587
|
+
location: input.location ?? null,
|
|
4588
|
+
state: "waiting",
|
|
4589
|
+
attempts: 0,
|
|
4590
|
+
last_error: null,
|
|
4591
|
+
record_id: null,
|
|
4592
|
+
replayed: false,
|
|
4593
|
+
queued_at: now().toISOString(),
|
|
4594
|
+
landed_at: null
|
|
4595
|
+
};
|
|
4596
|
+
await store.put(item);
|
|
4597
|
+
await announce();
|
|
4598
|
+
return key;
|
|
4599
|
+
},
|
|
4600
|
+
list: () => store.all().then(oldestFirst),
|
|
4601
|
+
counts: () => store.all().then(countOf),
|
|
4602
|
+
async sync() {
|
|
4603
|
+
if (syncing) return syncing;
|
|
4604
|
+
syncing = (async () => {
|
|
4605
|
+
const report = {
|
|
4606
|
+
attempted: 0,
|
|
4607
|
+
landed: 0,
|
|
4608
|
+
replayed: 0,
|
|
4609
|
+
refused: 0,
|
|
4610
|
+
deferred: 0,
|
|
4611
|
+
outcomes: []
|
|
4612
|
+
};
|
|
4613
|
+
const pending = oldestFirst(await store.all()).filter((i) => i.state === "waiting" || i.state === "sending");
|
|
4614
|
+
if (!online()) {
|
|
4615
|
+
report.deferred = pending.length;
|
|
4616
|
+
report.stopped_because = "There is no signal, so nothing was sent. Everything is still here.";
|
|
4617
|
+
return report;
|
|
4618
|
+
}
|
|
4619
|
+
for (const item of pending) {
|
|
4620
|
+
report.attempted += 1;
|
|
4621
|
+
item.state = "sending";
|
|
4622
|
+
item.attempts += 1;
|
|
4623
|
+
await store.put(item);
|
|
4624
|
+
await announce();
|
|
4625
|
+
try {
|
|
4626
|
+
for (const f of item.files) {
|
|
4627
|
+
if (f.uploaded) continue;
|
|
4628
|
+
f.uploaded = await opts.ports.uploadFile(f, item);
|
|
4629
|
+
f.blob = null;
|
|
4630
|
+
await store.put(item);
|
|
4631
|
+
}
|
|
4632
|
+
const refs = item.files.map((f) => ({
|
|
4633
|
+
field: f.field,
|
|
4634
|
+
name: f.name,
|
|
4635
|
+
mime_type: f.mime_type,
|
|
4636
|
+
size_bytes: f.size_bytes,
|
|
4637
|
+
duration_ms: f.duration_ms ?? null,
|
|
4638
|
+
file_id: f.uploaded?.file_id ?? null,
|
|
4639
|
+
url: f.uploaded?.url ?? null
|
|
4640
|
+
}));
|
|
4641
|
+
const res = await opts.ports.submit({
|
|
4642
|
+
sheet_id: item.sheet_id,
|
|
4643
|
+
client_key: item.client_key,
|
|
4644
|
+
answers: item.answers,
|
|
4645
|
+
files: refs,
|
|
4646
|
+
device: item.device,
|
|
4647
|
+
captured_at: item.captured_at,
|
|
4648
|
+
location: item.location
|
|
4649
|
+
});
|
|
4650
|
+
if (res.ok && res.data && res.data.record_id) {
|
|
4651
|
+
item.state = "landed";
|
|
4652
|
+
item.record_id = res.data.record_id;
|
|
4653
|
+
item.replayed = !!res.data.replay;
|
|
4654
|
+
item.landed_at = now().toISOString();
|
|
4655
|
+
item.last_error = null;
|
|
4656
|
+
report.landed += 1;
|
|
4657
|
+
if (item.replayed) report.replayed += 1;
|
|
4658
|
+
report.outcomes.push({
|
|
4659
|
+
client_key: item.client_key,
|
|
4660
|
+
state: item.state,
|
|
4661
|
+
record_id: item.record_id,
|
|
4662
|
+
replay: item.replayed,
|
|
4663
|
+
says: res.data.message ?? null
|
|
4664
|
+
});
|
|
4665
|
+
} else if (res.ok && res.data && !res.data.record_id) {
|
|
4666
|
+
item.state = "refused";
|
|
4667
|
+
item.last_error = res.data.message ?? `This sheet is ${res.data.state}.`;
|
|
4668
|
+
report.refused += 1;
|
|
4669
|
+
report.outcomes.push({
|
|
4670
|
+
client_key: item.client_key,
|
|
4671
|
+
state: item.state,
|
|
4672
|
+
record_id: null,
|
|
4673
|
+
replay: false,
|
|
4674
|
+
says: item.last_error
|
|
4675
|
+
});
|
|
4676
|
+
} else if (isDecided(res.error)) {
|
|
4677
|
+
item.state = "refused";
|
|
4678
|
+
item.last_error = res.error?.message ?? "The store refused this capture.";
|
|
4679
|
+
report.refused += 1;
|
|
4680
|
+
report.outcomes.push({
|
|
4681
|
+
client_key: item.client_key,
|
|
4682
|
+
state: item.state,
|
|
4683
|
+
record_id: null,
|
|
4684
|
+
replay: false,
|
|
4685
|
+
says: item.last_error
|
|
4686
|
+
});
|
|
4687
|
+
} else {
|
|
4688
|
+
item.state = "waiting";
|
|
4689
|
+
item.last_error = res.error?.message ?? "It could not be sent just now.";
|
|
4690
|
+
report.deferred += 1;
|
|
4691
|
+
report.outcomes.push({
|
|
4692
|
+
client_key: item.client_key,
|
|
4693
|
+
state: item.state,
|
|
4694
|
+
record_id: null,
|
|
4695
|
+
replay: false,
|
|
4696
|
+
says: item.last_error
|
|
4697
|
+
});
|
|
4698
|
+
}
|
|
4699
|
+
} catch (err2) {
|
|
4700
|
+
item.state = "waiting";
|
|
4701
|
+
item.last_error = err2 instanceof Error ? err2.message : "It could not be sent just now.";
|
|
4702
|
+
report.deferred += 1;
|
|
4703
|
+
report.outcomes.push({
|
|
4704
|
+
client_key: item.client_key,
|
|
4705
|
+
state: item.state,
|
|
4706
|
+
record_id: null,
|
|
4707
|
+
replay: false,
|
|
4708
|
+
says: item.last_error
|
|
4709
|
+
});
|
|
4710
|
+
}
|
|
4711
|
+
await store.put(item);
|
|
4712
|
+
await announce();
|
|
4713
|
+
if (!online()) {
|
|
4714
|
+
report.stopped_because = "The signal went away again. Everything still on the phone is still here.";
|
|
4715
|
+
break;
|
|
4716
|
+
}
|
|
4717
|
+
}
|
|
4718
|
+
await store.setMeta("last_synced_at", now().toISOString());
|
|
4719
|
+
return report;
|
|
4720
|
+
})();
|
|
4721
|
+
try {
|
|
4722
|
+
return await syncing;
|
|
4723
|
+
} finally {
|
|
4724
|
+
syncing = null;
|
|
4725
|
+
}
|
|
4726
|
+
},
|
|
4727
|
+
async retry(clientKey, patch) {
|
|
4728
|
+
const items = await store.all();
|
|
4729
|
+
const item = items.find((i) => i.client_key === clientKey);
|
|
4730
|
+
if (!item) return;
|
|
4731
|
+
if (patch?.answers) item.answers = { ...item.answers, ...patch.answers };
|
|
4732
|
+
item.state = "waiting";
|
|
4733
|
+
item.last_error = null;
|
|
4734
|
+
await store.put(item);
|
|
4735
|
+
await announce();
|
|
4736
|
+
},
|
|
4737
|
+
async discard(clientKey) {
|
|
4738
|
+
await store.remove(clientKey);
|
|
4739
|
+
await announce();
|
|
4740
|
+
},
|
|
4741
|
+
async clearLanded() {
|
|
4742
|
+
const items = await store.all();
|
|
4743
|
+
const landed = items.filter((i) => i.state === "landed");
|
|
4744
|
+
for (const i of landed) await store.remove(i.client_key);
|
|
4745
|
+
await announce();
|
|
4746
|
+
return landed.length;
|
|
4747
|
+
},
|
|
4748
|
+
lastSyncedAt: () => store.meta("last_synced_at"),
|
|
4749
|
+
isOnline: online,
|
|
4750
|
+
dispose() {
|
|
4751
|
+
disposed = true;
|
|
4752
|
+
if (typeof window !== "undefined" && handler) window.removeEventListener("online", handler);
|
|
4753
|
+
}
|
|
4754
|
+
};
|
|
4755
|
+
let handler = null;
|
|
4756
|
+
const auto = opts.autoSync ?? typeof window !== "undefined";
|
|
4757
|
+
if (auto && typeof window !== "undefined") {
|
|
4758
|
+
handler = () => {
|
|
4759
|
+
if (!disposed) void queue.sync();
|
|
4760
|
+
};
|
|
4761
|
+
window.addEventListener("online", handler);
|
|
4762
|
+
}
|
|
4763
|
+
return queue;
|
|
4764
|
+
}
|
|
4765
|
+
|
|
4283
4766
|
// src/record-scope.ts
|
|
4284
4767
|
function scopeChip(scope) {
|
|
4285
4768
|
return scope.title ? `About: ${scope.title}` : "About: this record";
|