@ai-matrx/records 0.48.0 → 0.51.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 +77 -0
- package/dist/core/index.cjs +160 -13
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +51 -11
- package/dist/core/index.d.ts +51 -11
- package/dist/core/index.js +160 -13
- package/dist/core/index.js.map +1 -1
- package/dist/{field-CFK39l0H.d.cts → field-C6_QKP1G.d.cts} +158 -10
- package/dist/{field-CFK39l0H.d.ts → field-C6_QKP1G.d.ts} +158 -10
- package/dist/index.cjs +102 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +105 -5
- package/dist/index.d.ts +105 -5
- package/dist/index.js +102 -8
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +173 -19
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +313 -17
- package/dist/react/index.d.ts +313 -17
- package/dist/react/index.js +173 -19
- package/dist/react/index.js.map +1 -1
- package/dist/use-cases/index.cjs.map +1 -1
- package/dist/use-cases/index.d.cts +1 -1
- package/dist/use-cases/index.d.ts +1 -1
- package/dist/use-cases/index.js.map +1 -1
- package/package.json +1 -1
package/dist/react/index.cjs
CHANGED
|
@@ -24,8 +24,13 @@ var react_exports = {};
|
|
|
24
24
|
__export(react_exports, {
|
|
25
25
|
ABSENCE_REASONS: () => ABSENCE_REASONS,
|
|
26
26
|
ACTOR_VOCABULARY: () => ACTOR_VOCABULARY,
|
|
27
|
+
ARCHIVE_LANES: () => ARCHIVE_LANES,
|
|
28
|
+
ARCHIVE_LANE_LABEL: () => ARCHIVE_LANE_LABEL,
|
|
29
|
+
ARCHIVE_LANE_MEANS: () => ARCHIVE_LANE_MEANS,
|
|
27
30
|
COMPUTE_ON: () => COMPUTE_ON,
|
|
28
31
|
CONTEXT_POLICIES: () => CONTEXT_POLICIES,
|
|
32
|
+
DECLARABLE_FIELD_KINDS: () => DECLARABLE_FIELD_KINDS,
|
|
33
|
+
DEFAULT_ARCHIVE_LANE: () => DEFAULT_ARCHIVE_LANE,
|
|
29
34
|
DELIVERIES: () => DELIVERIES,
|
|
30
35
|
ENTITY_TOKENS: () => ENTITY_TOKENS,
|
|
31
36
|
FIELD_KINDS: () => FIELD_KINDS,
|
|
@@ -61,6 +66,8 @@ __export(react_exports, {
|
|
|
61
66
|
TABLE_TYPES: () => TABLE_TYPES,
|
|
62
67
|
VALUE_ALTERNATE_KEYS: () => VALUE_ALTERNATE_KEYS,
|
|
63
68
|
VALUE_ENVELOPE_KEYS: () => VALUE_ENVELOPE_KEYS,
|
|
69
|
+
archivedByLine: () => archivedByLine,
|
|
70
|
+
archivedWhen: () => archivedWhen,
|
|
64
71
|
asPermissionLevel: () => asPermissionLevel,
|
|
65
72
|
atLeast: () => atLeast,
|
|
66
73
|
bookingPath: () => bookingPath,
|
|
@@ -70,12 +77,14 @@ __export(react_exports, {
|
|
|
70
77
|
coerceTypedAnswer: () => coerceTypedAnswer,
|
|
71
78
|
coerceTypedAnswers: () => coerceTypedAnswers,
|
|
72
79
|
coercionLabel: () => coercionLabel,
|
|
80
|
+
emptyArchiveLine: () => emptyArchiveLine,
|
|
73
81
|
err: () => err,
|
|
74
82
|
fieldKindFor: () => fieldKindFor,
|
|
75
83
|
forgetAllOps: () => forgetAllOps,
|
|
76
84
|
highestLevel: () => highestLevel,
|
|
77
85
|
holdsARetiredChoice: () => holdsARetiredChoice,
|
|
78
86
|
indexedDbStore: () => indexedDbStore,
|
|
87
|
+
isArchiveLane: () => isArchiveLane,
|
|
79
88
|
isDecided: () => isDecided,
|
|
80
89
|
isOwnOp: () => isOwnOp,
|
|
81
90
|
isRecordsErr: () => isRecordsErr,
|
|
@@ -93,7 +102,9 @@ __export(react_exports, {
|
|
|
93
102
|
portalPath: () => portalPath,
|
|
94
103
|
publicFormPath: () => publicFormPath,
|
|
95
104
|
rememberedOpCount: () => rememberedOpCount,
|
|
105
|
+
sameDocument: () => sameDocument,
|
|
96
106
|
scopeChip: () => scopeChip,
|
|
107
|
+
stableFilterKey: () => stableFilterKey,
|
|
97
108
|
tableShapeChanged: () => tableShapeChanged,
|
|
98
109
|
useEntityFieldMutation: () => useEntityFieldMutation,
|
|
99
110
|
useEntityFieldRights: () => useEntityFieldRights,
|
|
@@ -119,6 +130,46 @@ module.exports = __toCommonJS(react_exports);
|
|
|
119
130
|
// src/react/context.tsx
|
|
120
131
|
var import_react = require("react");
|
|
121
132
|
|
|
133
|
+
// src/archive.ts
|
|
134
|
+
var ARCHIVE_LANES = ["mine", "org"];
|
|
135
|
+
var DEFAULT_ARCHIVE_LANE = "org";
|
|
136
|
+
var ARCHIVE_LANE_LABEL = {
|
|
137
|
+
mine: "Archived by me",
|
|
138
|
+
org: "Archived by anyone"
|
|
139
|
+
};
|
|
140
|
+
var ARCHIVE_LANE_MEANS = {
|
|
141
|
+
mine: "The records you archived yourself.",
|
|
142
|
+
org: "Everything anybody in this organization archived, including you."
|
|
143
|
+
};
|
|
144
|
+
function isArchiveLane(word) {
|
|
145
|
+
return typeof word === "string" && ARCHIVE_LANES.includes(word);
|
|
146
|
+
}
|
|
147
|
+
function archivedWhen(at, locale = "en-GB") {
|
|
148
|
+
const when = new Date(at);
|
|
149
|
+
if (Number.isNaN(when.getTime())) return "a moment nobody recorded";
|
|
150
|
+
return new Intl.DateTimeFormat(locale, {
|
|
151
|
+
day: "numeric",
|
|
152
|
+
month: "long",
|
|
153
|
+
year: "numeric",
|
|
154
|
+
hour: "2-digit",
|
|
155
|
+
minute: "2-digit"
|
|
156
|
+
}).format(when);
|
|
157
|
+
}
|
|
158
|
+
function archivedByLine(row, locale = "en-GB") {
|
|
159
|
+
const when = archivedWhen(row.archivedAt, locale);
|
|
160
|
+
const who = (row.archivedByName ?? "").trim();
|
|
161
|
+
if (who === "") {
|
|
162
|
+
return `Archived on ${when}. The store does not know who archived it \u2014 whoever did is no longer in this organization, or it happened before this table kept that.`;
|
|
163
|
+
}
|
|
164
|
+
return `Archived by ${who} on ${when}.`;
|
|
165
|
+
}
|
|
166
|
+
function emptyArchiveLine(lane) {
|
|
167
|
+
return lane === "mine" ? "You have not archived anything in this table. Switch to \u201CArchived by anyone\u201D to see what the rest of the organization has." : "Nothing in this table has been archived. Records you remove from the grid arrive here, and nothing is ever destroyed.";
|
|
168
|
+
}
|
|
169
|
+
function sameDocument(a, b) {
|
|
170
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
|
171
|
+
}
|
|
172
|
+
|
|
122
173
|
// src/ops.ts
|
|
123
174
|
var REMEMBER_MS = 3e4;
|
|
124
175
|
var REMEMBER_MAX = 500;
|
|
@@ -217,6 +268,27 @@ var PARITY_FIELD_TYPES = [
|
|
|
217
268
|
{ parity_type: "select", behavior: "list", made_of: "one choice from a Table shown as a list (FLD-5/FLD-6)" },
|
|
218
269
|
{ parity_type: "url", behavior: "text", made_of: "text whose format is url, with the pattern Rule that makes the format enforceable" }
|
|
219
270
|
];
|
|
271
|
+
var DECLARABLE_FIELD_KINDS = [
|
|
272
|
+
{ kind: "attachment", behavior: "relation", parity: true, made_of: "REC-31: a File record reached through a relation, target the kernel `File` Table" },
|
|
273
|
+
{ kind: "checkbox", behavior: "boolean", parity: true, made_of: "a ticked or unticked answer, stored as a REAL boolean \u2014 and a record that never answered holds neither, so filters and group-by see three states, not two" },
|
|
274
|
+
{ kind: "currency", behavior: "range", parity: true, made_of: "FLD-N-1: a number whose UNIT is the currency and whose format is currency \u2014 on the Field, never in presentation" },
|
|
275
|
+
{ kind: "datetime", behavior: "range", parity: true, made_of: "a range of kind date or datetime \u2014 the dated modifier says the VALUES are dated, which is a different question" },
|
|
276
|
+
{ kind: "email", behavior: "text", parity: true, made_of: "text whose format is email" },
|
|
277
|
+
{ kind: "formula", behavior: "formula", parity: true, made_of: "FLD-9: a declared computation, on read or on write, evaluated by custom.rule_eval" },
|
|
278
|
+
{ kind: "long_text", behavior: "text", parity: false, made_of: "behaviour text with format long and config.multiline, for several lines rather than one" },
|
|
279
|
+
{ kind: "lookup", behavior: "formula", parity: true, made_of: "a Value read THROUGH a relation \u2014 config.via names the relation field, config.pick the Value on the far side" },
|
|
280
|
+
{ kind: "member", behavior: "relation", parity: true, made_of: "a person: a relation whose target is the kernel `Person` Table" },
|
|
281
|
+
{ kind: "multi_select", behavior: "list", parity: true, made_of: "many choices from the same Table \u2014 the multi modifier, never a second behaviour" },
|
|
282
|
+
{ kind: "number", behavior: "range", parity: false, made_of: "a plain number: behaviour range with no date kind and neither the currency nor the percent format" },
|
|
283
|
+
{ kind: "percent", behavior: "range", parity: true, made_of: "a number whose unit is % and whose format is percent" },
|
|
284
|
+
{ kind: "phone", behavior: "text", parity: true, made_of: "text whose format is phone" },
|
|
285
|
+
{ kind: "relation", behavior: "relation", parity: false, made_of: "REL / FLD-11: a relation a person aims themselves \u2014 relation_target names a Table of this organization, and it is a BEHAVIOUR, never a parity type of its own" },
|
|
286
|
+
{ kind: "rollup", behavior: "formula", parity: true, made_of: "an aggregate ALONG a relation \u2014 config.via, config.of, config.agg; far-side ids are taken DISTINCT, so nothing is counted twice" },
|
|
287
|
+
{ kind: "select", behavior: "list", parity: true, made_of: "one choice from a Table shown as a list (FLD-5/FLD-6)" },
|
|
288
|
+
{ kind: "signature", behavior: "text", parity: false, made_of: "VAL-10: behaviour text whose format is signature \u2014 the one shape custom.doc_sign accepts, sealed by custom.doc_signature_write and checked by custom.doc_signature_intact" },
|
|
289
|
+
{ kind: "text", behavior: "text", parity: false, made_of: "plain text: behaviour text with no format \u2014 it carries no parity type, which is exactly what custom.parity_type answers for it" },
|
|
290
|
+
{ kind: "url", behavior: "text", parity: true, made_of: "text whose format is url, with the pattern Rule that makes the format enforceable" }
|
|
291
|
+
];
|
|
220
292
|
var RULE_NODE_KINDS = [
|
|
221
293
|
{ node: "actor_at_least", evaluated_by: "PIPELINES" },
|
|
222
294
|
{ node: "add", evaluated_by: "W1-RULE" },
|
|
@@ -452,6 +524,7 @@ var STORE_DOORS = [
|
|
|
452
524
|
{ name: "field_dependants", args: "p_organization_id uuid, p_field_id uuid", returns: "TABLE(kind text, dependant_id uuid, label text, how text)", security: "definer" },
|
|
453
525
|
{ name: "field_history", args: "p_organization_id uuid, p_table_id uuid, p_field_key text, p_limit integer DEFAULT 100, p_offset integer DEFAULT 0, p_record_id uuid DEFAULT NULL::uuid", returns: "TABLE(record_id uuid, record_title text, version integer, occurred_at timestamp with time zone, operation_label text, actor jsonb, before jsonb, after jsonb)", security: "definer" },
|
|
454
526
|
{ name: "field_kernel_id", args: "", returns: "uuid", security: "invoker" },
|
|
527
|
+
{ name: "field_kinds", args: "", returns: "TABLE(kind text, behavior text, parity boolean, made_of text)", security: "invoker" },
|
|
455
528
|
{ name: "field_options", args: "p_organization_id uuid, p_field_id uuid", returns: "SETOF custom.record", security: "definer" },
|
|
456
529
|
{ name: "field_retire", args: "p_organization_id uuid, p_field_id uuid", returns: "boolean", security: "definer" },
|
|
457
530
|
{ name: "field_rules", args: "p_field_data jsonb", returns: "TABLE(kind text, spec jsonb)", security: "invoker" },
|
|
@@ -587,6 +660,7 @@ var STORE_DOORS = [
|
|
|
587
660
|
{ name: "portal_field_map", args: "p_organization_id uuid, p_table_id uuid", returns: "TABLE(field_id uuid, field_key text, field_type text, points_at uuid)", security: "definer" },
|
|
588
661
|
{ name: "portal_invitation", args: "p_slug text, p_email text", returns: "jsonb", security: "definer" },
|
|
589
662
|
{ name: "portal_invite", args: "p_organization_id uuid, p_portal_id uuid, p_client_record_id uuid, p_email text, p_user_id uuid DEFAULT NULL::uuid", returns: "jsonb", security: "definer" },
|
|
663
|
+
{ name: "portal_invite_accept", args: "p_token text", returns: "jsonb", security: "definer" },
|
|
590
664
|
{ name: "portal_me", args: "", returns: "jsonb", security: "definer" },
|
|
591
665
|
{ name: "portal_preview", args: "p_organization_id uuid, p_portal_id uuid, p_principal_id uuid, p_table_id uuid", returns: "TABLE(record_id uuid, title text)", security: "definer" },
|
|
592
666
|
{ name: "portal_principal_bind", args: "p_organization_id uuid, p_principal_id uuid, p_user_id uuid", returns: "jsonb", security: "definer" },
|
|
@@ -639,14 +713,18 @@ var STORE_DOORS = [
|
|
|
639
713
|
{ name: "read_paths_outside_the_door", args: "", returns: "TABLE(object_name text, why text)", security: "invoker" },
|
|
640
714
|
{ name: "read_record", args: "p_organization_id uuid, p_record_id uuid, p_by_id boolean DEFAULT false", returns: "jsonb", security: "definer" },
|
|
641
715
|
{ name: "read_records", args: "p_organization_id uuid, p_table_id uuid, p_by_id boolean DEFAULT false, p_limit integer DEFAULT 200, p_offset integer DEFAULT 0", returns: "TABLE(id uuid, document jsonb, level permission_level)", security: "definer" },
|
|
716
|
+
{ name: "read_records_archived", args: "p_organization_id uuid, p_table_id uuid, p_lane text DEFAULT 'org'::text, p_by_id boolean DEFAULT false, p_limit integer DEFAULT 200, p_offset integer DEFAULT 0", returns: "TABLE(id uuid, document jsonb, level permission_level, archived_at timestamp with time zone, archived_by uuid, archived_by_name text)", security: "definer" },
|
|
642
717
|
{ name: "read_records_by_ids", args: "p_organization_id uuid, p_table_id uuid, p_record_ids uuid[], p_by_id boolean DEFAULT false", returns: "TABLE(id uuid, document jsonb, level permission_level)", security: "definer" },
|
|
718
|
+
{ name: "read_records_matching", args: "p_organization_id uuid, p_table_id uuid, p_filter jsonb DEFAULT '{}'::jsonb, p_by_id boolean DEFAULT false, p_limit integer DEFAULT 200, p_offset integer DEFAULT 0", returns: "TABLE(id uuid, document jsonb, level permission_level)", security: "definer" },
|
|
643
719
|
{ name: "realtime_topic_admits", args: "p_topic text", returns: "boolean", security: "definer" },
|
|
644
720
|
{ name: "record_aggregate", 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: "TABLE(groups jsonb, measures jsonb, row_count bigint)", security: "definer" },
|
|
645
721
|
{ name: "record_applicability", args: "p_organization_id uuid, p_record_id uuid", returns: "TABLE(rule_id uuid, rule_name text, rule_version integer, applies boolean, answer jsonb)", security: "invoker" },
|
|
722
|
+
{ name: "record_archiver", args: "p_organization_id uuid, p_record_id uuid", returns: "uuid", security: "definer" },
|
|
646
723
|
{ name: "record_as_of", args: "p_organization_id uuid, p_record_id uuid, p_at timestamp with time zone", returns: "TABLE(state jsonb, replayed boolean)", security: "definer" },
|
|
647
724
|
{ name: "record_card", args: "p_viewer uuid, p_organization_id uuid, p_record_id uuid", returns: "jsonb", security: "definer" },
|
|
648
725
|
{ name: "record_carrying_edges", args: "p_id uuid, p_data_class text, p_data jsonb, p_deleted_at timestamp with time zone", returns: "TABLE(container_id uuid, item_id uuid, edge_role text)", security: "invoker" },
|
|
649
726
|
{ name: "record_delete", args: "p_organization_id uuid, p_record_id uuid", returns: "timestamp with time zone", security: "definer" },
|
|
727
|
+
{ name: "record_filter_sql", args: "p_filter jsonb", returns: "text", security: "invoker" },
|
|
650
728
|
{ name: "record_history", args: "p_organization_id uuid, p_record_id uuid, p_limit integer DEFAULT 200, p_offset integer DEFAULT 0", returns: "TABLE(version integer, occurred_at timestamp with time zone, operation text, operation_label text, actor jsonb, changes jsonb, migration_id uuid, undoable boolean)", security: "definer" },
|
|
651
729
|
{ name: "record_platform_keys", args: "", returns: "text[]", security: "invoker" },
|
|
652
730
|
{ name: "record_relation_edges", args: "p_organization_id uuid, p_id uuid, p_table_id uuid, p_data_class text, p_data jsonb, p_deleted_at timestamp with time zone", returns: "TABLE(target_id uuid, edge_role text, field_id uuid, ord integer)", security: "invoker" },
|
|
@@ -735,6 +813,7 @@ var STORE_DOORS = [
|
|
|
735
813
|
{ name: "subscription_mute", args: "p_organization_id uuid, p_rule_id uuid, p_muted boolean DEFAULT true", returns: "boolean", security: "definer" },
|
|
736
814
|
{ name: "subscription_preview", args: "p_organization_id uuid, p_rule_id uuid", returns: "jsonb", security: "definer" },
|
|
737
815
|
{ 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" },
|
|
816
|
+
{ name: "table_archive", args: "p_organization_id uuid, p_table_id uuid, p_chunk integer DEFAULT 50, p_include_table boolean DEFAULT true", returns: "jsonb", security: "definer" },
|
|
738
817
|
{ name: "table_capacity", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "definer" },
|
|
739
818
|
{ 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" },
|
|
740
819
|
{ name: "table_column_source", args: "p_organization_id uuid, p_table_id uuid", returns: "text", security: "invoker" },
|
|
@@ -867,18 +946,18 @@ var STORE_KNOBS = [
|
|
|
867
946
|
{ key: "world_publish_enabled", value: "false", type: "boolean" }
|
|
868
947
|
];
|
|
869
948
|
var STORE_REFUSAL_CODES = [
|
|
870
|
-
{ code: "02000", raised_by: "_checklist_instantiate,_table_share_invite_payload,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,table_share_outside_accept,table_share_outside_invite,table_share_outside_resend,table_share_outside_revoke,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_assign,work_record_states,work_set_state" },
|
|
949
|
+
{ code: "02000", raised_by: "_checklist_instantiate,_portal_invite_payload,_share_write_person,_table_share_invite_payload,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_invite_accept,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,table_archive,table_share_outside_accept,table_share_outside_invite,table_share_outside_resend,table_share_outside_revoke,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_assign,work_record_states,work_set_state" },
|
|
871
950
|
{ 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" },
|
|
872
951
|
{ code: "22003", raised_by: "context_resolve" },
|
|
873
|
-
{ code: "22004", raised_by: "_entity_custom_fields_guard,_value_envelope,actor_word,agg_assert_key,agg_sql,anon_capture,anon_token_issue,anon_write,assert_client_may_reach,booking_declare,capture_submit,checklist_declare,context_resolve,dashboard_block_normalize,dashboard_declare,dashboard_window_sql,doc_render_write,doc_sign,doc_signature_write,doc_template_save,enrich_land,enrich_normalize,external_history_event,external_rows,external_source_declare,external_stub_upsert,external_write_through,external_writes_set,field_history,form_declare,form_submit,home_add,io_comment_write,io_import_begin,io_infer_column,io_outbox_drain,io_restore,migrate_choice_keys,migrate_purge,migrate_reclass,migrate_split,migrate_undo,organization_clear,organization_contents,pipeline_declare,pipeline_gate_preview,portal_declare,portal_invite,portal_principal_bind,provenance_retention_days,provenance_write,query_across_homes,query_by_coordinates,query_rollup,record_delete,record_reparent,record_resolve,record_restore,record_update,record_write,record_write_many,relation_carry,relation_own,rule_declare,share_grant,sign_request_create,sign_request_sign,subscription_declare,table_declare,table_share_outside_invite,value_restore,view_declare,work_approval_decide,work_approval_request,work_template_declare" },
|
|
952
|
+
{ code: "22004", raised_by: "_entity_custom_fields_guard,_share_write_person,_value_envelope,actor_word,agg_assert_key,agg_sql,anon_capture,anon_token_issue,anon_write,assert_client_may_reach,booking_declare,capture_submit,checklist_declare,context_resolve,dashboard_block_normalize,dashboard_declare,dashboard_window_sql,doc_render_write,doc_sign,doc_signature_write,doc_template_save,enrich_land,enrich_normalize,external_history_event,external_rows,external_source_declare,external_stub_upsert,external_write_through,external_writes_set,field_history,form_declare,form_submit,home_add,io_comment_write,io_import_begin,io_infer_column,io_outbox_drain,io_restore,migrate_choice_keys,migrate_purge,migrate_reclass,migrate_split,migrate_undo,organization_clear,organization_contents,pipeline_declare,pipeline_gate_preview,portal_declare,portal_invite,portal_principal_bind,provenance_retention_days,provenance_write,query_across_homes,query_by_coordinates,query_rollup,record_delete,record_reparent,record_resolve,record_restore,record_update,record_write,record_write_many,relation_carry,relation_own,rule_declare,share_grant,sign_request_create,sign_request_sign,subscription_declare,table_archive,table_declare,table_share_outside_invite,value_restore,view_declare,work_approval_decide,work_approval_request,work_template_declare" },
|
|
874
953
|
{ code: "22007", raised_by: "dashboard_window_sql" },
|
|
875
954
|
{ code: "22012", raised_by: "rule_eval" },
|
|
876
|
-
{ code: "22023", raised_by: "_booking_availability,_entity_custom_fields_guard,_take_op_id,_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,field_update,io_export,io_import_begin,io_import_finish,io_import_plan,io_import_report,io_proposal_accept,migrate_merge,migrate_reclass,my_levels,organization_clear,page_size,pin_agent_cells,pipeline_move,portal_declare,provenance_write,query_by_coordinates,query_rollup,record_update,record_write_many,relation_carry,rule_eval,rule_members,share_grant,share_lane_set,sign_request_create,sign_request_sign,subscription_declare,table_rules,visibility_as_of,work_approval_request,work_list,work_slot_hold" },
|
|
877
|
-
{ code: "23503", raised_by: "_booking_availability,_checklist_instantiate,_containment_guard,_display_spec_for,_field_document_for,_pipeline_stage_key,_record_rule_uses,agg_digest_assemble,anon_publish,anon_rate_take,anon_token_issue,anon_write,assert_organization_wall,booking_cancel,booking_confirm,booking_declare,booking_hold,booking_reschedule,capture_publish,checklist_declare,checklist_steps_table,comment_write,dashboard_declare,delete_rule,doc_sign,doc_template_save,enrich_declare,enrich_due,enrich_land,form_declare,form_submit,home_add,inbound_declare,inbound_mail_land,inbound_set,io_comment_write,io_import_begin,io_import_finish,io_import_report,io_import_rows,io_proposal_accept,migrate_demote,migrate_promote,pipeline_board,pipeline_declare,pipeline_move,pipeline_read,pipeline_transition_refusal,promote_field,promote_table,record_applicability,record_reparent,relation_carry,relation_own,resolve_first_match,rule_applies,rule_declare,rule_eval,rule_members,rule_run,sign_request_create,subscription_mute,subscription_preview,view_declare,work_set_state,work_take_assignment,work_template_instantiate" },
|
|
878
|
-
{ 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,
|
|
879
|
-
{ code: "23514", raised_by: "_checklist_instantiate,_checklist_step_guard,_containment_guard,_dated_values_guard,_derived_fields,_display_spec_for,_entity_custom_fields_guard,_field_class_guard,_field_document_for,_field_shape_guard,_field_type_parity_guard,_merge_field_shape_guard,_merge_field_temporal_guard,_promoted_field_cap_guard,_record_rule_uses,_resolve_choice_words,_rule_shape_guard,_rule_topology_guard,_store_relation_edge_names_its_field,_table_columns_word_guard,_table_shape_guard,_undeclared_key_guard,_value_envelope,_with_display,_work_shape_guard,_workdoors_approval_guard,assert_columns_are_defined,assert_entity_is_organization_scoped,booking_declare,capture_publish,capture_sheet_declare,checklist_declare,checklist_step_complete,doc_sign,doc_signature_write,doc_template_save,entity_field_declare,entity_field_retire,entity_field_update,entity_records_find,entity_table,field_declare,field_retire,field_update,home_add,io_import_rows,migrate_merge,relation_carry,relation_own,sign_request_create,sign_request_sign,table_declare,validate_value_envelope,validate_values,work_set_state,work_slots_declare,work_take_assignment,work_template_instantiate" },
|
|
955
|
+
{ code: "22023", raised_by: "_booking_availability,_entity_custom_fields_guard,_take_op_id,_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,field_update,io_export,io_import_begin,io_import_finish,io_import_plan,io_import_report,io_proposal_accept,migrate_merge,migrate_reclass,my_levels,organization_clear,page_size,pin_agent_cells,pipeline_move,portal_declare,provenance_write,query_by_coordinates,query_rollup,read_records_archived,record_update,record_write_many,relation_carry,rule_eval,rule_members,share_grant,share_lane_set,sign_request_create,sign_request_sign,subscription_declare,table_rules,visibility_as_of,work_approval_request,work_list,work_slot_hold" },
|
|
956
|
+
{ code: "23503", raised_by: "_booking_availability,_checklist_instantiate,_containment_guard,_display_spec_for,_field_document_for,_field_type_parity_guard,_pipeline_stage_key,_record_rule_uses,agg_digest_assemble,anon_publish,anon_rate_take,anon_token_issue,anon_write,assert_organization_wall,booking_cancel,booking_confirm,booking_declare,booking_hold,booking_reschedule,capture_publish,checklist_declare,checklist_steps_table,comment_write,dashboard_declare,delete_rule,doc_sign,doc_template_save,enrich_declare,enrich_due,enrich_land,form_declare,form_submit,home_add,inbound_declare,inbound_mail_land,inbound_set,io_comment_write,io_import_begin,io_import_finish,io_import_report,io_import_rows,io_proposal_accept,migrate_demote,migrate_promote,pipeline_board,pipeline_declare,pipeline_move,pipeline_read,pipeline_transition_refusal,promote_field,promote_table,record_applicability,record_reparent,relation_carry,relation_own,resolve_first_match,rule_applies,rule_declare,rule_eval,rule_members,rule_run,sign_request_create,subscription_mute,subscription_preview,view_declare,work_set_state,work_take_assignment,work_template_instantiate" },
|
|
957
|
+
{ code: "23505", raised_by: "_share_write_person,_unique_rule_holds,doc_sign,doc_signature_write,entity_field_declare,field_declare,home_add,inbound_declare,io_proposal_accept,relation_carry,relation_own,sign_request_cancel,sign_request_create,table_share_outside_resend,work_approval_decide,work_slot_hold" },
|
|
958
|
+
{ code: "23514", raised_by: "_checklist_instantiate,_checklist_step_guard,_containment_guard,_dated_values_guard,_derived_fields,_display_spec_for,_entity_custom_fields_guard,_field_class_guard,_field_document_for,_field_shape_guard,_field_type_parity_guard,_merge_field_shape_guard,_merge_field_temporal_guard,_promoted_field_cap_guard,_record_rule_uses,_resolve_choice_words,_rule_shape_guard,_rule_topology_guard,_store_relation_edge_names_its_field,_table_columns_word_guard,_table_shape_guard,_undeclared_key_guard,_value_envelope,_with_display,_work_shape_guard,_workdoors_approval_guard,assert_columns_are_defined,assert_entity_is_organization_scoped,booking_declare,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_comment_write,io_import_rows,migrate_merge,relation_carry,relation_own,sign_request_create,sign_request_sign,table_declare,validate_value_envelope,validate_values,work_set_state,work_slots_declare,work_take_assignment,work_template_instantiate" },
|
|
880
959
|
{ code: "40001", raised_by: "has_visibility_at" },
|
|
881
|
-
{ 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,read_records_by_ids,record_table,share_grant,subscription_mute,subscription_preview,table_share_outside_accept,table_share_outside_invite,table_share_outside_resend,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_person" },
|
|
960
|
+
{ code: "42501", raised_by: "_doc_render_immutable,_doc_signature_immutable,_field_definition_write,_field_write_door,_rule_definition_write,_store_door,agent_table_claim,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,doc_sign,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_invite_accept,portal_principal_bind,promote_table,query_visibility_parity,read_record,read_records,read_records_archived,read_records_by_ids,read_records_matching,record_table,share_grant,subscription_mute,subscription_preview,table_share_outside_accept,table_share_outside_invite,table_share_outside_resend,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_person" },
|
|
882
961
|
{ code: "42703", raised_by: "entity_table,portal_declare" },
|
|
883
962
|
{ code: "53400", raised_by: "anon_rate_take,delete_cascade_closure,enrich_due,enrich_land,promote_field" },
|
|
884
963
|
{ code: "54001", raised_by: "record_delete" },
|
|
@@ -1774,6 +1853,7 @@ var ENTITY_TOKENS = [
|
|
|
1774
1853
|
"template_scope_types",
|
|
1775
1854
|
"templates",
|
|
1776
1855
|
"test_handset_inbox",
|
|
1856
|
+
"test_handset_verification",
|
|
1777
1857
|
"thread",
|
|
1778
1858
|
"tool",
|
|
1779
1859
|
"tool_binding",
|
|
@@ -1969,6 +2049,23 @@ var DOORS = {
|
|
|
1969
2049
|
// live Postgres function makes every existing call ambiguous — `is not unique`. Same
|
|
1970
2050
|
// ladder, same level, same masking, same page ceiling.
|
|
1971
2051
|
readRecordsByIds: "read_records_by_ids",
|
|
2052
|
+
// THE SAME READ DOOR, ADDRESSED BY A QUESTION. `custom.read_records_matching`
|
|
2053
|
+
// takes the store's one filter shape (`RecordFilter` — the object
|
|
2054
|
+
// `platform.saved_view` carries as `filters` and `custom.record_aggregate`
|
|
2055
|
+
// takes as `p_filter`) and narrows the page INSIDE its own query, in the same
|
|
2056
|
+
// WHERE as Visibility. A separate NAME for the same reason as above. It is
|
|
2057
|
+
// what makes a number on a dashboard walkable: the filter is evaluated by
|
|
2058
|
+
// `custom.record_filter_sql`, the one body `custom.agg_sql` also calls, so the
|
|
2059
|
+
// rows it opens are the rows the number counted.
|
|
2060
|
+
readRecordsMatching: "read_records_matching",
|
|
2061
|
+
// THE SAME READ DOOR, ADDRESSED BY ABSENCE. Every door above answers LIVE rows
|
|
2062
|
+
// only — each of them hard-codes `and r.deleted_at is null` — so until this one
|
|
2063
|
+
// existed no screen could list an archived record however it was written, and
|
|
2064
|
+
// `record_restore` below had nothing that could reach it (VERIFIER-10 F4).
|
|
2065
|
+
// `custom.read_records_archived` is that body with the sign of one comparison
|
|
2066
|
+
// flipped, plus the two facts only an archive needs: who archived it and when.
|
|
2067
|
+
// A separate NAME for the same reason as its two siblings above.
|
|
2068
|
+
readRecordsArchived: "read_records_archived",
|
|
1972
2069
|
// DOOR-8, the two clocks. `p_recorded_at` is what the store SAID then;
|
|
1973
2070
|
// `p_world_on` is what was TRUE of the world on that date, read out of dated
|
|
1974
2071
|
// values. A client that answered either one itself would be guessing.
|
|
@@ -2263,7 +2360,14 @@ var DOORS = {
|
|
|
2263
2360
|
docTokens: "doc_tokens",
|
|
2264
2361
|
docUnresolvedTokens: "doc_unresolved_tokens",
|
|
2265
2362
|
docSign: "doc_sign",
|
|
2266
|
-
|
|
2363
|
+
// THE SEAL IS ASKED THROUGH ITS OWN DOOR. `custom.doc_signature_intact` is the INTERNAL
|
|
2364
|
+
// half of this pair — SECURITY INVOKER over a doors-only table, so a browser that calls it
|
|
2365
|
+
// gets `42501 permission denied for table doc_signature`, which is what every SignBlock
|
|
2366
|
+
// seal check got until 2026-09-22 (FIX-10B). `custom.doc_signature_read` is the definer
|
|
2367
|
+
// door built for a client: it asks may_reach and may_open on the RECORD by name and
|
|
2368
|
+
// returns the seal AND the verdict in one answer, because a seal a person can read and a
|
|
2369
|
+
// verdict they cannot is how a changed agreement keeps wearing somebody's signature.
|
|
2370
|
+
docSignatureRead: "doc_signature_read",
|
|
2267
2371
|
// THE PLURAL ACTS. Until 2026-09-20 this package read `custom.doc_template`,
|
|
2268
2372
|
// `custom.doc_render` and `custom.doc_signature` with a direct PostgREST
|
|
2269
2373
|
// `.from()`, and all three hold NO client SELECT — so every list in product #5
|
|
@@ -2660,12 +2764,41 @@ function createRecordsClient(config) {
|
|
|
2660
2764
|
})
|
|
2661
2765
|
);
|
|
2662
2766
|
},
|
|
2663
|
-
async
|
|
2767
|
+
async listArchived({ table_id, lane = DEFAULT_ARCHIVE_LANE, limit = 50, offset = 0 }) {
|
|
2664
2768
|
const door = await callDoor(
|
|
2665
|
-
DOORS.
|
|
2769
|
+
DOORS.readRecordsArchived,
|
|
2770
|
+
{
|
|
2771
|
+
p_organization_id: org,
|
|
2772
|
+
p_table_id: table_id,
|
|
2773
|
+
p_lane: lane,
|
|
2774
|
+
p_limit: limit,
|
|
2775
|
+
p_offset: offset
|
|
2776
|
+
},
|
|
2777
|
+
"listArchived"
|
|
2778
|
+
);
|
|
2779
|
+
if (!door.ok) return err(door.error);
|
|
2780
|
+
const rows = (door.data ?? []).map((row) => {
|
|
2781
|
+
const { document, hidden } = unfold(row.document);
|
|
2782
|
+
return {
|
|
2783
|
+
id: row.id,
|
|
2784
|
+
document,
|
|
2785
|
+
level: row.level,
|
|
2786
|
+
hidden,
|
|
2787
|
+
archivedAt: row.archived_at,
|
|
2788
|
+
archivedBy: row.archived_by ?? null,
|
|
2789
|
+
archivedByName: row.archived_by_name ?? null
|
|
2790
|
+
};
|
|
2791
|
+
});
|
|
2792
|
+
const total = rows.length < limit ? offset + rows.length : null;
|
|
2793
|
+
return ok({ rows, total });
|
|
2794
|
+
},
|
|
2795
|
+
async list({ table_id, filter, limit = 50, offset = 0 }) {
|
|
2796
|
+
const door = await callDoor(
|
|
2797
|
+
DOORS.readRecordsMatching,
|
|
2666
2798
|
{
|
|
2667
2799
|
p_organization_id: org,
|
|
2668
2800
|
p_table_id: table_id,
|
|
2801
|
+
p_filter: filter ?? {},
|
|
2669
2802
|
p_limit: limit,
|
|
2670
2803
|
p_offset: offset
|
|
2671
2804
|
},
|
|
@@ -3806,11 +3939,11 @@ function createRecordsClient(config) {
|
|
|
3806
3939
|
"commentResolve"
|
|
3807
3940
|
);
|
|
3808
3941
|
},
|
|
3809
|
-
async
|
|
3942
|
+
async docSignatureRead({ signature_id }) {
|
|
3810
3943
|
return callDoor(
|
|
3811
|
-
DOORS.
|
|
3944
|
+
DOORS.docSignatureRead,
|
|
3812
3945
|
{ p_organization_id: org, p_signature_id: signature_id },
|
|
3813
|
-
"
|
|
3946
|
+
"docSignatureRead"
|
|
3814
3947
|
);
|
|
3815
3948
|
},
|
|
3816
3949
|
// ── the anonymous lane ───────────────────────────────────────────────
|
|
@@ -4374,6 +4507,27 @@ function useRecordsActor() {
|
|
|
4374
4507
|
|
|
4375
4508
|
// src/react/hooks.ts
|
|
4376
4509
|
var import_react2 = require("react");
|
|
4510
|
+
|
|
4511
|
+
// src/aggregate.ts
|
|
4512
|
+
function measureKey(measure) {
|
|
4513
|
+
return measure.op === "count" ? "count" : `${measure.op}_${measure.key ?? ""}`;
|
|
4514
|
+
}
|
|
4515
|
+
function stableFilterKey(filter) {
|
|
4516
|
+
if (!filter) return "{}";
|
|
4517
|
+
const keys = Object.keys(filter).sort();
|
|
4518
|
+
if (keys.length === 0) return "{}";
|
|
4519
|
+
const parts = keys.map((key) => {
|
|
4520
|
+
const value = filter[key];
|
|
4521
|
+
if (value !== null && typeof value === "object") {
|
|
4522
|
+
const window2 = value;
|
|
4523
|
+
return `${JSON.stringify(key)}:{"from":${JSON.stringify(window2.from ?? null)},"to":${JSON.stringify(window2.to ?? null)}}`;
|
|
4524
|
+
}
|
|
4525
|
+
return `${JSON.stringify(key)}:${JSON.stringify(value ?? null)}`;
|
|
4526
|
+
});
|
|
4527
|
+
return `{${parts.join(",")}}`;
|
|
4528
|
+
}
|
|
4529
|
+
|
|
4530
|
+
// src/react/hooks.ts
|
|
4377
4531
|
function useAsync(run, deps) {
|
|
4378
4532
|
const client = useRecordsClient();
|
|
4379
4533
|
const [state, setState] = (0, import_react2.useState)(
|
|
@@ -4482,16 +4636,21 @@ function useRecords(tableId, options = {}) {
|
|
|
4482
4636
|
const client = useRecordsClient();
|
|
4483
4637
|
const pageSize = options.pageSize ?? 50;
|
|
4484
4638
|
const page = options.page ?? 0;
|
|
4639
|
+
const filterKey = stableFilterKey(options.filter);
|
|
4485
4640
|
const base = useAsync(
|
|
4486
4641
|
async (c) => {
|
|
4487
4642
|
if (!tableId) return { ok: true, data: { rows: [], total: null } };
|
|
4488
4643
|
return c.list({
|
|
4489
4644
|
table_id: tableId,
|
|
4645
|
+
...filterKey === "{}" ? {} : { filter: options.filter },
|
|
4490
4646
|
limit: pageSize,
|
|
4491
4647
|
offset: page * pageSize
|
|
4492
4648
|
});
|
|
4493
4649
|
},
|
|
4494
|
-
|
|
4650
|
+
// The QUESTION, not the object: a parent that rebuilds `{status: "Cancelled"}`
|
|
4651
|
+
// on every render must not re-read the page on every render, and a parent
|
|
4652
|
+
// that changes the question must re-read on the first one.
|
|
4653
|
+
[tableId, pageSize, page, filterKey]
|
|
4495
4654
|
);
|
|
4496
4655
|
const realtime = client.config.realtime;
|
|
4497
4656
|
const { reload, setData } = base;
|
|
@@ -5081,11 +5240,6 @@ function portalPath(slug) {
|
|
|
5081
5240
|
return `/portal/c/${slug}`;
|
|
5082
5241
|
}
|
|
5083
5242
|
|
|
5084
|
-
// src/aggregate.ts
|
|
5085
|
-
function measureKey(measure) {
|
|
5086
|
-
return measure.op === "count" ? "count" : `${measure.op}_${measure.key ?? ""}`;
|
|
5087
|
-
}
|
|
5088
|
-
|
|
5089
5243
|
// src/capture-queue.ts
|
|
5090
5244
|
var DB_NAME = "matrx-capture";
|
|
5091
5245
|
var DB_VERSION = 1;
|