@ai-matrx/records 0.6.2 → 0.8.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 +68 -0
- package/dist/core/index.cjs +191 -33
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +44 -4
- package/dist/core/index.d.ts +44 -4
- package/dist/core/index.js +191 -33
- package/dist/core/index.js.map +1 -1
- package/dist/index.cjs +126 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +375 -30
- package/dist/index.d.ts +375 -30
- package/dist/index.js +126 -30
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +222 -33
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +443 -31
- package/dist/react/index.d.ts +443 -31
- package/dist/react/index.js +222 -33
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/react/index.cjs
CHANGED
|
@@ -38,6 +38,7 @@ __export(react_exports, {
|
|
|
38
38
|
ON_DELETE: () => ON_DELETE,
|
|
39
39
|
OVERRIDE_POLICIES: () => OVERRIDE_POLICIES,
|
|
40
40
|
PARITY_FIELD_TYPES: () => PARITY_FIELD_TYPES,
|
|
41
|
+
PERMISSION_LEVELS: () => PERMISSION_LEVELS,
|
|
41
42
|
PER_VALUE_ACCESS_WORDS: () => PER_VALUE_ACCESS_WORDS,
|
|
42
43
|
RELATION_BINDINGS: () => RELATION_BINDINGS,
|
|
43
44
|
RELATION_CARDINALITIES: () => RELATION_CARDINALITIES,
|
|
@@ -55,13 +56,20 @@ __export(react_exports, {
|
|
|
55
56
|
TABLE_TYPES: () => TABLE_TYPES,
|
|
56
57
|
VALUE_ALTERNATE_KEYS: () => VALUE_ALTERNATE_KEYS,
|
|
57
58
|
VALUE_ENVELOPE_KEYS: () => VALUE_ENVELOPE_KEYS,
|
|
59
|
+
asPermissionLevel: () => asPermissionLevel,
|
|
60
|
+
atLeast: () => atLeast,
|
|
58
61
|
err: () => err,
|
|
62
|
+
highestLevel: () => highestLevel,
|
|
59
63
|
isRecordsErr: () => isRecordsErr,
|
|
60
64
|
measureKey: () => measureKey,
|
|
61
65
|
ok: () => ok,
|
|
66
|
+
publicFormPath: () => publicFormPath,
|
|
62
67
|
useFieldMutation: () => useFieldMutation,
|
|
63
68
|
useFields: () => useFields,
|
|
64
69
|
useMergeField: () => useMergeField,
|
|
70
|
+
useMyLevel: () => useMyLevel,
|
|
71
|
+
useMyLevels: () => useMyLevels,
|
|
72
|
+
useOptionalRecordsClient: () => useOptionalRecordsClient,
|
|
65
73
|
useRecord: () => useRecord,
|
|
66
74
|
useRecordMutation: () => useRecordMutation,
|
|
67
75
|
useRecords: () => useRecords,
|
|
@@ -75,6 +83,33 @@ module.exports = __toCommonJS(react_exports);
|
|
|
75
83
|
// src/react/context.tsx
|
|
76
84
|
var import_react = require("react");
|
|
77
85
|
|
|
86
|
+
// src/level.ts
|
|
87
|
+
var PERMISSION_LEVELS = [
|
|
88
|
+
"viewer",
|
|
89
|
+
"commenter",
|
|
90
|
+
"editor",
|
|
91
|
+
"admin"
|
|
92
|
+
];
|
|
93
|
+
var ORDINAL = {
|
|
94
|
+
viewer: 1,
|
|
95
|
+
commenter: 2,
|
|
96
|
+
editor: 3,
|
|
97
|
+
admin: 4
|
|
98
|
+
};
|
|
99
|
+
function atLeast(held, needed) {
|
|
100
|
+
if (!held) return false;
|
|
101
|
+
const have = ORDINAL[held];
|
|
102
|
+
return have !== void 0 && have >= ORDINAL[needed];
|
|
103
|
+
}
|
|
104
|
+
function asPermissionLevel(word) {
|
|
105
|
+
return typeof word === "string" && word in ORDINAL ? word : null;
|
|
106
|
+
}
|
|
107
|
+
function highestLevel(left, right) {
|
|
108
|
+
if (!left) return right ?? null;
|
|
109
|
+
if (!right) return left;
|
|
110
|
+
return ORDINAL[left] >= ORDINAL[right] ? left : right;
|
|
111
|
+
}
|
|
112
|
+
|
|
78
113
|
// src/results.ts
|
|
79
114
|
function isRecordsErr(result) {
|
|
80
115
|
return result.ok === false;
|
|
@@ -144,7 +179,9 @@ var STORE_DOORS = [
|
|
|
144
179
|
{ name: "absence_reasons", args: "", returns: "text[]", security: "invoker" },
|
|
145
180
|
{ name: "actor_vocabulary", args: "", returns: "text[]", security: "invoker" },
|
|
146
181
|
{ name: "actor_word", args: "p_declared text", returns: "text", security: "invoker" },
|
|
182
|
+
{ name: "agent_change_approval", args: "p_organization uuid, p_conversation uuid DEFAULT NULL::uuid, p_table uuid DEFAULT NULL::uuid", returns: "jsonb", security: "definer" },
|
|
147
183
|
{ name: "agent_context", args: "p_organization_id uuid, p_table_id uuid, p_limit integer DEFAULT 50", returns: "jsonb", security: "invoker" },
|
|
184
|
+
{ name: "agent_table_claim", args: "p_organization uuid, p_table uuid, p_conversation uuid DEFAULT NULL::uuid", returns: "void", security: "definer" },
|
|
148
185
|
{ name: "agg_assert_key", args: "p_key text", returns: "text", security: "invoker" },
|
|
149
186
|
{ name: "agg_buckets", args: "", returns: "text[]", security: "invoker" },
|
|
150
187
|
{ 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", returns: "uuid", security: "invoker" },
|
|
@@ -162,6 +199,7 @@ var STORE_DOORS = [
|
|
|
162
199
|
{ 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" },
|
|
163
200
|
{ name: "anon_publish", args: "p_organization_id uuid, p_form_id uuid, p_published boolean DEFAULT true", returns: "timestamp with time zone", security: "definer" },
|
|
164
201
|
{ name: "anon_rate_take", args: "p_organization_id uuid, p_form_id uuid, p_bucket text, p_token_id uuid DEFAULT NULL::uuid", returns: "integer", security: "definer" },
|
|
202
|
+
{ name: "anon_submissions", args: "p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid, p_state text DEFAULT NULL::text, p_limit integer DEFAULT 100, p_offset integer DEFAULT 0", returns: "TABLE(id uuid, form_id uuid, inbound_id uuid, table_id uuid, source text, state text, payload jsonb, raw_payload jsonb, client_key text, record_id uuid, remote_origin text, rejection_reason text, created_at timestamp with time zone, cleared_at timestamp with time zone)", security: "definer" },
|
|
165
203
|
{ name: "anon_token_issue", args: "p_organization_id uuid, p_mode text, p_allowed_origins jsonb, p_form_id uuid DEFAULT NULL::uuid, p_saved_view_id uuid DEFAULT NULL::uuid, p_record_id uuid DEFAULT NULL::uuid, p_expires_at timestamp with time zone DEFAULT NULL::timestamp with time zone", returns: "TABLE(token_id uuid, secret text)", security: "definer" },
|
|
166
204
|
{ name: "anon_token_revoke", args: "p_organization_id uuid, p_token_id uuid", returns: "boolean", security: "definer" },
|
|
167
205
|
{ name: "anon_token_verify", args: "p_secret text, p_origin text, p_required_mode text", returns: "TABLE(token_id uuid, organization_id uuid, form_id uuid, saved_view_id uuid, record_id uuid, mode text)", security: "definer" },
|
|
@@ -170,6 +208,8 @@ var STORE_DOORS = [
|
|
|
170
208
|
{ name: "assert_client_may_change", args: "p_organization_id uuid, p_subject_id uuid, p_door text, p_required permission_level DEFAULT 'editor'::permission_level, p_subject_word text DEFAULT 'record'::text", returns: "void", security: "invoker" },
|
|
171
209
|
{ name: "assert_client_may_open", args: "p_organization_id uuid, p_subject_id uuid, p_door text, p_required permission_level DEFAULT 'viewer'::permission_level, p_subject_word text DEFAULT 'record'::text", returns: "void", security: "invoker" },
|
|
172
210
|
{ name: "assert_client_may_reach", args: "p_organization_id uuid, p_door text", returns: "void", security: "invoker" },
|
|
211
|
+
{ name: "assert_entity_door", args: "p_organization_id uuid, p_door text", returns: "void", security: "definer" },
|
|
212
|
+
{ name: "assert_entity_is_organization_scoped", args: "p_token text, p_label text, p_scoped boolean", returns: "void", security: "invoker" },
|
|
173
213
|
{ name: "assert_may_know_table", args: "p_organization_id uuid, p_table_id uuid, p_door text", returns: "void", security: "invoker" },
|
|
174
214
|
{ name: "assert_organization_admin", args: "p_organization_id uuid, p_door text, p_what text", returns: "void", security: "invoker" },
|
|
175
215
|
{ name: "assert_organization_wall", args: "p_kind text, p_organization_id uuid, p_row jsonb", returns: "void", security: "invoker" },
|
|
@@ -177,6 +217,8 @@ var STORE_DOORS = [
|
|
|
177
217
|
{ name: "bump_epoch", args: "p_entity_type text, p_entity_id uuid, p_organization_id uuid DEFAULT NULL::uuid", returns: "bigint", security: "definer" },
|
|
178
218
|
{ 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" },
|
|
179
219
|
{ name: "caller_role", args: "", returns: "name", security: "invoker" },
|
|
220
|
+
{ 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" },
|
|
221
|
+
{ 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" },
|
|
180
222
|
{ name: "client_write_grants", args: "", returns: "TABLE(role_name text, object_name text, privilege text)", security: "invoker" },
|
|
181
223
|
{ name: "computed_provenance", args: "p_organization_id uuid, p_record_id uuid", returns: "TABLE(field_key text, field_id uuid, value jsonb, rule_id uuid, rule_version integer, computed_at timestamp with time zone)", security: "invoker" },
|
|
182
224
|
{ name: "containment_chain", args: "p_organization_id uuid, p_record_id uuid", returns: "TABLE(ancestor_id uuid, depth integer)", security: "invoker" },
|
|
@@ -186,6 +228,7 @@ var STORE_DOORS = [
|
|
|
186
228
|
{ name: "cross_organization_links_open", args: "p_source_organization_id uuid, p_target_organization_id uuid", returns: "boolean", security: "invoker" },
|
|
187
229
|
{ name: "custom_fields_tables", args: "", returns: "TABLE(token text, schema_name text, table_name text)", security: "invoker" },
|
|
188
230
|
{ name: "delete_cascade_closure", args: "p_organization_id uuid, p_record_id uuid", returns: "uuid[]", security: "invoker" },
|
|
231
|
+
{ name: "delete_preview", args: "p_organization_id uuid, p_record_id uuid", returns: "jsonb", security: "definer" },
|
|
189
232
|
{ name: "delete_rule", args: "p_organization_id uuid, p_record_id uuid, p_apply boolean DEFAULT true", returns: "jsonb", security: "definer" },
|
|
190
233
|
{ name: "dependency_cycle", args: "p_organization_id uuid, p_row custom.record", returns: "text[]", security: "invoker" },
|
|
191
234
|
{ name: "dependency_label", args: "p_organization_id uuid, p_node text", returns: "text", security: "invoker" },
|
|
@@ -196,11 +239,14 @@ var STORE_DOORS = [
|
|
|
196
239
|
{ name: "doc_format_value", args: "p_field_data jsonb, p_value jsonb", returns: "text", security: "invoker" },
|
|
197
240
|
{ name: "doc_render_body", args: "p_organization_id uuid, p_template_id uuid, p_record_id uuid", returns: "text", security: "invoker" },
|
|
198
241
|
{ name: "doc_render_document", args: "p_organization_id uuid, p_template_id uuid, p_record_id uuid", returns: "uuid", security: "definer" },
|
|
242
|
+
{ name: "doc_render_read", args: "p_organization_id uuid, p_render_id uuid", returns: "jsonb", security: "definer" },
|
|
199
243
|
{ name: "doc_render_write", args: "p_organization_id uuid, p_template_id uuid, p_record_id uuid, p_table_id uuid, p_template_version integer, p_body text, p_content_hash text", returns: "uuid", security: "definer" },
|
|
200
244
|
{ name: "doc_sign", args: "p_organization_id uuid, p_render_id uuid, p_field_key text, p_signer_name text, p_signer_user_id uuid DEFAULT NULL::uuid", returns: "uuid", security: "definer" },
|
|
201
245
|
{ name: "doc_signature_field_ok", args: "p_field_data jsonb", returns: "boolean", security: "invoker" },
|
|
202
246
|
{ name: "doc_signature_intact", args: "p_organization_id uuid, p_signature_id uuid", returns: "jsonb", security: "invoker" },
|
|
247
|
+
{ name: "doc_signature_read", args: "p_organization_id uuid, p_signature_id uuid", returns: "jsonb", security: "definer" },
|
|
203
248
|
{ name: "doc_signature_write", args: "p_organization_id uuid, p_render_id uuid, p_record_id uuid, p_field_key text, p_signer_name text, p_signer_user_id uuid, p_document_hash text, p_document_version integer", returns: "uuid", security: "definer" },
|
|
249
|
+
{ name: "doc_template_read", args: "p_organization_id uuid, p_template_id uuid", returns: "jsonb", security: "definer" },
|
|
204
250
|
{ name: "doc_template_save", args: "p_organization_id uuid, p_table_id uuid, p_name text, p_body text, p_template_id uuid DEFAULT NULL::uuid", returns: "uuid", security: "definer" },
|
|
205
251
|
{ name: "doc_token_pattern", args: "", returns: "text", security: "invoker" },
|
|
206
252
|
{ name: "doc_tokens", args: "p_body text", returns: "TABLE(ordinal integer, raw text, field_id uuid)", security: "invoker" },
|
|
@@ -209,6 +255,15 @@ var STORE_DOORS = [
|
|
|
209
255
|
{ name: "doors_not_deciding_the_record", args: "", returns: "TABLE(function_name text, identity_args text, why text)", security: "invoker" },
|
|
210
256
|
{ name: "doors_not_on_one_ladder", args: "", returns: "TABLE(function_name text, identity_args text, why text)", security: "invoker" },
|
|
211
257
|
{ name: "effective_level", args: "p_user_id uuid, p_organization_id uuid, p_id uuid, p_type text DEFAULT 'record'::text", returns: "permission_level", security: "definer" },
|
|
258
|
+
{ name: "entity_field_declare", args: "p_organization_id uuid, p_token text, p_spec jsonb", returns: "uuid", security: "definer" },
|
|
259
|
+
{ name: "entity_field_retire", args: "p_organization_id uuid, p_field_id uuid", returns: "uuid", security: "definer" },
|
|
260
|
+
{ name: "entity_field_rights", args: "p_organization_id uuid, p_token text", returns: "jsonb", security: "definer" },
|
|
261
|
+
{ name: "entity_field_update", args: "p_organization_id uuid, p_field_id uuid, p_patch jsonb", returns: "uuid", security: "definer" },
|
|
262
|
+
{ name: "entity_fields", args: "p_organization_id uuid, p_token text", returns: "SETOF custom.record", security: "definer" },
|
|
263
|
+
{ name: "entity_record_read", args: "p_organization_id uuid, p_token text, p_record_id uuid", returns: "jsonb", security: "invoker" },
|
|
264
|
+
{ 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" },
|
|
265
|
+
{ 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" },
|
|
266
|
+
{ name: "entity_value_write", args: "p_organization_id uuid, p_token text, p_record_id uuid, p_patch jsonb", returns: "jsonb", security: "invoker" },
|
|
212
267
|
{ 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" },
|
|
213
268
|
{ name: "external_foreign_table_findings", args: "", returns: "SETOF text", security: "definer" },
|
|
214
269
|
{ name: "external_history_event", args: "p_organization_id uuid, p_link_id uuid, p_operation text", returns: "bigint", security: "definer" },
|
|
@@ -220,7 +275,7 @@ var STORE_DOORS = [
|
|
|
220
275
|
{ name: "external_writes_set", args: "p_organization_id uuid, p_source_id uuid, p_enabled boolean", returns: "boolean", security: "definer" },
|
|
221
276
|
{ name: "field_behaviour", args: "p_field_data jsonb", returns: "text", security: "invoker" },
|
|
222
277
|
{ name: "field_declare", args: "p_organization_id uuid, p_table_id uuid, p_spec jsonb", returns: "uuid", security: "definer" },
|
|
223
|
-
{ name: "field_dependants", args: "p_organization_id uuid, p_field_id uuid", returns: "TABLE(kind text, dependant_id uuid, label text, how text)", security: "
|
|
278
|
+
{ 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" },
|
|
224
279
|
{ name: "field_kernel_id", args: "", returns: "uuid", security: "invoker" },
|
|
225
280
|
{ name: "field_options", args: "p_organization_id uuid, p_field_id uuid", returns: "SETOF custom.record", security: "definer" },
|
|
226
281
|
{ name: "field_retire", args: "p_organization_id uuid, p_field_id uuid", returns: "boolean", security: "definer" },
|
|
@@ -228,7 +283,14 @@ var STORE_DOORS = [
|
|
|
228
283
|
{ name: "field_update", args: "p_organization_id uuid, p_field_id uuid, p_patch jsonb", returns: "uuid", security: "definer" },
|
|
229
284
|
{ name: "field_value_convert", args: "p_to jsonb, p_value jsonb", returns: "jsonb", security: "invoker" },
|
|
230
285
|
{ name: "file_kernel_id", args: "", returns: "uuid", security: "invoker" },
|
|
286
|
+
{ name: "form_declare", args: "p_organization_id uuid, p_table_id uuid, p_title text, p_questions jsonb, p_presentation jsonb DEFAULT '{}'::jsonb, p_submission_cap integer DEFAULT NULL::integer, p_quarantine_rule_id uuid DEFAULT NULL::uuid, p_notify_rule_id uuid DEFAULT NULL::uuid, p_form_id uuid DEFAULT NULL::uuid, p_slug text DEFAULT NULL::text", returns: "uuid", security: "definer" },
|
|
287
|
+
{ name: "form_notify", args: "p_organization_id uuid, p_form_id uuid, p_record_id uuid, p_submission_id uuid", returns: "uuid", security: "invoker" },
|
|
288
|
+
{ name: "form_public", args: "p_form_id uuid", returns: "TABLE(form_id uuid, organization_id uuid, table_id uuid, title text, presentation jsonb, fields jsonb, honeypot_key text, state text, message text)", security: "definer" },
|
|
289
|
+
{ name: "form_slug", args: "p_organization_id uuid, p_title text, p_form_id uuid DEFAULT NULL::uuid", returns: "text", security: "invoker" },
|
|
290
|
+
{ 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" },
|
|
291
|
+
{ 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" },
|
|
231
292
|
{ 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" },
|
|
293
|
+
{ name: "guard_refusals_are_complete", args: "", returns: "TABLE(guard text, said text)", security: "invoker" },
|
|
232
294
|
{ 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" },
|
|
233
295
|
{ 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" },
|
|
234
296
|
{ name: "hidden_field_notice", args: "p_field custom.record, p_action text DEFAULT 'read'::text", returns: "jsonb", security: "invoker" },
|
|
@@ -260,6 +322,7 @@ var STORE_DOORS = [
|
|
|
260
322
|
{ name: "io_record_changed", args: "", returns: "trigger", security: "definer" },
|
|
261
323
|
{ name: "io_restore", args: "p_organization_id uuid, p_record_id uuid, p_version integer", returns: "integer", security: "definer" },
|
|
262
324
|
{ name: "io_revisions", args: "p_organization_id uuid, p_record_id uuid", returns: "TABLE(version integer, changed_at timestamp with time zone, changed_by uuid, summary text, operation text, changed_fields jsonb)", security: "definer" },
|
|
325
|
+
{ name: "is_a_retirement", args: "p_old_deleted timestamp with time zone, p_new_deleted timestamp with time zone, p_old_data jsonb, p_new_data jsonb, p_old_table uuid, p_new_table uuid, p_old_org uuid, p_new_org uuid, p_old_class text, p_new_class text", returns: "boolean", security: "invoker" },
|
|
263
326
|
{ name: "lookup_value", args: "p_organization_id uuid, p_record_id uuid, p_field_data jsonb", returns: "jsonb", security: "invoker" },
|
|
264
327
|
{ name: "mask_document", args: "p_document jsonb, p_visible_keys text[], p_notices jsonb, p_by_id boolean DEFAULT false, p_key_ids jsonb DEFAULT '{}'::jsonb", returns: "jsonb", security: "invoker" },
|
|
265
328
|
{ name: "mask_document", args: "p_document jsonb, p_visible_keys text[], p_notices jsonb, p_by_id boolean DEFAULT false, p_key_ids jsonb DEFAULT '{}'::jsonb, p_declared_keys text[] DEFAULT NULL::text[]", returns: "jsonb", security: "invoker" },
|
|
@@ -272,9 +335,14 @@ var STORE_DOORS = [
|
|
|
272
335
|
{ name: "migrate_purge", args: "p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid, p_dry_run boolean DEFAULT true", returns: "jsonb", security: "definer" },
|
|
273
336
|
{ name: "migrate_rename", args: "p_organization_id uuid, p_id uuid, p_to text, p_note text DEFAULT NULL::text", returns: "jsonb", security: "definer" },
|
|
274
337
|
{ name: "migrate_reparent", args: "p_organization_id uuid, p_id uuid, p_parent_id uuid, p_note text DEFAULT NULL::text", returns: "jsonb", security: "definer" },
|
|
275
|
-
{ name: "migrate_retype", args: "p_organization_id uuid, p_id uuid, p_to text, p_note text DEFAULT NULL::text", returns: "jsonb", security: "
|
|
338
|
+
{ name: "migrate_retype", args: "p_organization_id uuid, p_id uuid, p_to text, p_note text DEFAULT NULL::text", returns: "jsonb", security: "definer" },
|
|
276
339
|
{ name: "migrate_split", args: "p_organization_id uuid, p_record_id uuid, p_moved_keys text[], p_note text DEFAULT NULL::text", returns: "jsonb", security: "definer" },
|
|
277
340
|
{ name: "migrate_undo", args: "p_organization_id uuid, p_log_id uuid", returns: "jsonb", security: "definer" },
|
|
341
|
+
{ name: "migrations", args: "p_organization_id uuid, p_target_id uuid DEFAULT NULL::uuid, p_limit integer DEFAULT 100", returns: "TABLE(id uuid, verb text, target_kind text, target_id uuid, note text, applied_at timestamp with time zone, applied_by uuid, undone_at timestamp with time zone)", security: "definer" },
|
|
342
|
+
{ name: "my_level", args: "p_organization_id uuid, p_id uuid, p_type text DEFAULT 'record'::text", returns: "permission_level", security: "definer" },
|
|
343
|
+
{ name: "my_levels", args: "p_organization_id uuid, p_ids jsonb, p_type text DEFAULT 'record'::text", returns: "TABLE(id uuid, level permission_level)", security: "definer" },
|
|
344
|
+
{ name: "organization_clear", args: "p_organization_id uuid, p_confirm text, p_and_destroy boolean DEFAULT false", returns: "jsonb", security: "definer" },
|
|
345
|
+
{ name: "organization_contents", args: "p_organization_id uuid", returns: "jsonb", security: "definer" },
|
|
278
346
|
{ name: "organization_kernel_id", args: "", returns: "uuid", security: "invoker" },
|
|
279
347
|
{ 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" },
|
|
280
348
|
{ name: "owning_table", args: "p_organization_id uuid, p_record_id uuid", returns: "uuid", security: "invoker" },
|
|
@@ -315,11 +383,17 @@ var STORE_DOORS = [
|
|
|
315
383
|
{ name: "query_visibility_parity", args: "p_organization_id uuid", returns: "TABLE(side text, container_type text, container_id uuid, item_type text, item_id uuid, stored_level permission_level, derived_level permission_level, reason text)", security: "definer" },
|
|
316
384
|
{ name: "query_visible_ids", args: "p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid, p_required text DEFAULT 'viewer'::text", returns: "SETOF uuid", security: "definer" },
|
|
317
385
|
{ name: "reachable_from", args: "p_organization_id uuid, p_roots uuid[]", returns: "TABLE(record_id uuid, depth integer, via text)", security: "invoker" },
|
|
386
|
+
{ name: "reaches_directly", args: "p_user_id uuid, p_type text, p_id uuid, p_required permission_level DEFAULT 'viewer'::permission_level", returns: "boolean", security: "definer" },
|
|
387
|
+
{ name: "read_door_carried_ids", args: "p_user uuid, p_organization_id uuid, p_table_id uuid, p_required permission_level, OUT o_ids uuid[], OUT o_containers integer", returns: "record", security: "definer" },
|
|
388
|
+
{ name: "read_door_granted_ids", args: "p_organization_id uuid, p_table_id uuid", returns: "uuid[]", security: "definer" },
|
|
389
|
+
{ name: "read_door_ladder_ceiling", args: "", returns: "integer", security: "invoker" },
|
|
390
|
+
{ name: "read_door_parity", args: "p_organization_id uuid, p_table_id uuid, p_user uuid, p_required permission_level, p_sample integer", returns: "TABLE(record_id uuid, set_based boolean, per_row boolean, verdict text)", security: "definer" },
|
|
318
391
|
{ name: "read_paths_outside_the_door", args: "", returns: "TABLE(object_name text, why text)", security: "invoker" },
|
|
319
392
|
{ name: "read_record", args: "p_organization_id uuid, p_record_id uuid, p_by_id boolean DEFAULT false", returns: "jsonb", security: "definer" },
|
|
320
393
|
{ 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" },
|
|
321
394
|
{ 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" },
|
|
322
395
|
{ 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" },
|
|
396
|
+
{ 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" },
|
|
323
397
|
{ name: "record_card", args: "p_viewer uuid, p_organization_id uuid, p_record_id uuid", returns: "jsonb", security: "definer" },
|
|
324
398
|
{ 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" },
|
|
325
399
|
{ name: "record_delete", args: "p_organization_id uuid, p_record_id uuid", returns: "timestamp with time zone", security: "definer" },
|
|
@@ -333,6 +407,7 @@ var STORE_DOORS = [
|
|
|
333
407
|
{ name: "record_values_versioned", args: "p_organization_id uuid, p_record_id uuid", returns: "TABLE(field_key text, field_id uuid, value jsonb, value_version integer, source jsonb, absent_reason text, actor text, on_behalf_of text, written_at timestamp with time zone, alternates jsonb)", security: "definer" },
|
|
334
408
|
{ name: "record_write", args: "p_organization_id uuid, p_table_id uuid, p_data jsonb", returns: "uuid", security: "definer" },
|
|
335
409
|
{ name: "relation_carry", args: "p_organization_id uuid, p_container_id uuid, p_item_id uuid", returns: "uuid", security: "definer" },
|
|
410
|
+
{ name: "relation_edges_withdraw", args: "p_organization_id uuid, p_field_ids uuid[], p_why text", returns: "integer", security: "definer" },
|
|
336
411
|
{ name: "relation_own", args: "p_organization_id uuid, p_owner_id uuid, p_target_id uuid", returns: "uuid", security: "definer" },
|
|
337
412
|
{ name: "relation_target_card", args: "p_organization_id uuid, p_record_id uuid, p_via_key text DEFAULT NULL::text", returns: "TABLE(target_id uuid, target_organization_id uuid, is_foreign boolean, masked boolean, reader_level permission_level, card jsonb, why text)", security: "definer" },
|
|
338
413
|
{ name: "relation_target_external", args: "p_connection_token text, p_external_table text, p_external_key text", returns: "jsonb", security: "definer" },
|
|
@@ -347,6 +422,7 @@ var STORE_DOORS = [
|
|
|
347
422
|
{ name: "rollup_value", args: "p_organization_id uuid, p_record_id uuid, p_field_data jsonb", returns: "jsonb", security: "invoker" },
|
|
348
423
|
{ name: "rule_applies", args: "p_organization_id uuid, p_rule_id uuid, p_record_id uuid", returns: "jsonb", security: "invoker" },
|
|
349
424
|
{ name: "rule_context", args: "p_organization_id uuid, p_record_id uuid", returns: "jsonb", security: "invoker" },
|
|
425
|
+
{ name: "rule_declare", args: "p_organization_id uuid, p_spec jsonb, p_rule_id uuid DEFAULT NULL::uuid", returns: "uuid", security: "definer" },
|
|
350
426
|
{ name: "rule_dependency_edges", args: "p_organization_id uuid, p_row custom.record DEFAULT NULL::custom.record", returns: "TABLE(needs text, needed text)", security: "invoker" },
|
|
351
427
|
{ name: "rule_eval", args: "p_organization_id uuid, p_expr jsonb, p_values jsonb, p_context jsonb DEFAULT '{}'::jsonb", returns: "jsonb", security: "invoker" },
|
|
352
428
|
{ name: "rule_field_key", args: "p_organization_id uuid, p_field_id uuid", returns: "text", security: "invoker" },
|
|
@@ -359,6 +435,7 @@ var STORE_DOORS = [
|
|
|
359
435
|
{ name: "rule_truth", args: "p_answer jsonb", returns: "boolean", security: "invoker" },
|
|
360
436
|
{ name: "rule_uses", args: "", returns: "text[]", security: "invoker" },
|
|
361
437
|
{ name: "rule_version", args: "p_organization_id uuid, p_rule_id uuid", returns: "integer", security: "invoker" },
|
|
438
|
+
{ name: "said", args: "p_value text, p_when_there_is_none text", returns: "text", security: "invoker" },
|
|
362
439
|
{ name: "share_access", args: "p_organization_id uuid, p_subject_id uuid", returns: "TABLE(principal_kind text, principal_id uuid, principal_label text, level permission_level, reason text, reason_detail text, via_type text, via_id uuid, revocable boolean)", security: "definer" },
|
|
363
440
|
{ name: "share_grant", args: "p_organization_id uuid, p_subject_id uuid, p_principal_kind text, p_principal_id uuid, p_level permission_level DEFAULT 'viewer'::permission_level", returns: "jsonb", security: "definer" },
|
|
364
441
|
{ name: "share_lane_set", args: "p_organization_id uuid, p_subject_id uuid, p_choice text, p_level permission_level DEFAULT NULL::permission_level", returns: "jsonb", security: "definer" },
|
|
@@ -367,6 +444,7 @@ var STORE_DOORS = [
|
|
|
367
444
|
{ name: "share_people", args: "p_organization_id uuid, p_subject_id uuid DEFAULT NULL::uuid, p_query text DEFAULT NULL::text, p_limit integer DEFAULT 25", returns: "TABLE(user_id uuid, email text, display_name text, membership text, already_at permission_level, already_why text)", security: "definer" },
|
|
368
445
|
{ name: "share_revoke", args: "p_organization_id uuid, p_subject_id uuid, p_principal_kind text, p_principal_id uuid", returns: "jsonb", security: "definer" },
|
|
369
446
|
{ name: "share_subject_name", args: "p_organization_id uuid, p_type text, p_id uuid", returns: "text", security: "definer" },
|
|
447
|
+
{ name: "shared_only_disagreements", args: "p_pretend text DEFAULT NULL::text", returns: "TABLE(organization_id uuid, organization_name text, member_id uuid, record_id uuid, table_id uuid, ladder boolean, read_door boolean, rls_mirror boolean, why text)", security: "invoker" },
|
|
370
448
|
{ name: "size_refusal", args: "p_organization_id uuid, p_data jsonb", returns: "text", security: "invoker" },
|
|
371
449
|
{ name: "source_next_pointer", args: "p_sources jsonb", returns: "text", security: "invoker" },
|
|
372
450
|
{ name: "source_pointer", args: "p_sources jsonb, p_source jsonb", returns: "text", security: "invoker" },
|
|
@@ -376,13 +454,14 @@ var STORE_DOORS = [
|
|
|
376
454
|
{ name: "table_capacity", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "definer" },
|
|
377
455
|
{ name: "table_contents", args: "p_organization_id uuid, p_table_id uuid", returns: "TABLE(record_id uuid, kind text, goes_at integer)", security: "invoker" },
|
|
378
456
|
{ name: "table_declare", args: "p_organization_id uuid, p_spec jsonb", returns: "uuid", security: "definer" },
|
|
457
|
+
{ name: "table_has_a_visible_record", args: "p_user uuid, p_organization_id uuid, p_table_id uuid", returns: "boolean", security: "definer" },
|
|
379
458
|
{ name: "table_is_live", args: "p_organization_id uuid, p_table_id uuid", returns: "boolean", security: "invoker" },
|
|
380
459
|
{ name: "table_kernel_id", args: "", returns: "uuid", security: "invoker" },
|
|
381
460
|
{ name: "table_record_ceiling", args: "", returns: "integer", security: "invoker" },
|
|
382
461
|
{ name: "table_record_ceiling", args: "p_organization_id uuid", returns: "integer", security: "invoker" },
|
|
383
462
|
{ 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" },
|
|
384
463
|
{ name: "table_storage", args: "p_organization_id uuid, p_table_id uuid", returns: "text", security: "invoker" },
|
|
385
|
-
{ name: "table_type_field", args: "p_organization_id uuid, p_table_id uuid", returns: "text", security: "
|
|
464
|
+
{ name: "table_type_field", args: "p_organization_id uuid, p_table_id uuid", returns: "text", security: "definer" },
|
|
386
465
|
{ 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" },
|
|
387
466
|
{ name: "tables_described_without_asking", args: "", returns: "TABLE(function_name text, identity_args text, why text)", security: "invoker" },
|
|
388
467
|
{ name: "trg_associations_bump_visibility", args: "", returns: "trigger", security: "definer" },
|
|
@@ -393,38 +472,52 @@ var STORE_DOORS = [
|
|
|
393
472
|
{ name: "value_envelope_keys", args: "", returns: "text[]", security: "invoker" },
|
|
394
473
|
{ name: "value_envelope_ok", args: "p_data jsonb", returns: "boolean", security: "invoker" },
|
|
395
474
|
{ name: "value_envelope_refusal", args: "p_data jsonb", returns: "text", security: "invoker" },
|
|
396
|
-
{ name: "value_read", args: "p_organization_id uuid, p_record_id uuid, p_key text", returns: "TABLE(field_key text, field_id uuid, value jsonb, value_version integer, source jsonb, absent_reason text, actor text, on_behalf_of text, written_at timestamp with time zone, alternates jsonb)", security: "
|
|
475
|
+
{ name: "value_read", args: "p_organization_id uuid, p_record_id uuid, p_key text", returns: "TABLE(field_key text, field_id uuid, value jsonb, value_version integer, source jsonb, absent_reason text, actor text, on_behalf_of text, written_at timestamp with time zone, alternates jsonb)", security: "definer" },
|
|
397
476
|
{ name: "value_versions", args: "p_old jsonb, p_new jsonb", returns: "jsonb", security: "invoker" },
|
|
398
477
|
{ name: "visibility_ancestors", args: "p_item_type text, p_item_id uuid", returns: "TABLE(container_type text, container_id uuid, depth integer, max_level permission_level)", security: "definer" },
|
|
399
478
|
{ name: "visibility_as_of", args: "p_organization_id uuid, p_record_id uuid, p_at timestamp with time zone", returns: "TABLE(principal_kind text, principal_id uuid, level permission_level, through_kind text, through_id uuid, reason text, replayed boolean, held_from timestamp with time zone, held_to timestamp with time zone)", security: "definer" },
|
|
400
479
|
{ name: "visibility_cache_rebuild", args: "", returns: "integer", security: "definer" },
|
|
401
480
|
{ name: "visibility_parity", args: "", returns: "TABLE(side text, container_type text, container_id uuid, item_type text, item_id uuid, stored_level permission_level, derived_level permission_level, reason text)", security: "definer" },
|
|
402
481
|
{ name: "visibility_warm", args: "p_container_type text, p_container_id uuid", returns: "integer", security: "definer" },
|
|
482
|
+
{ name: "visible_predicate_sql", args: "p_user uuid, p_organization_id uuid, p_table_id uuid, p_required permission_level DEFAULT 'viewer'::permission_level, p_alias text DEFAULT 'r'::text", returns: "text", security: "definer" },
|
|
403
483
|
{ name: "visible_record_ids", args: "p_user_id uuid, p_required permission_level DEFAULT 'viewer'::permission_level", returns: "TABLE(id uuid)", security: "definer" },
|
|
484
|
+
{ name: "visible_set", args: "p_user uuid, p_organization_id uuid, p_table_id uuid, p_required permission_level DEFAULT 'viewer'::permission_level, OUT o_all_visible boolean, OUT o_true_visibility platform.visibility[], OUT o_granted_all uuid[], OUT o_granted_visible uuid[], OUT o_carried_visible uuid[], OUT o_ladder_calls integer, OUT o_fallback boolean, OUT o_note text", returns: "record", security: "definer" },
|
|
404
485
|
{ name: "widget_kernel_id", args: "", returns: "uuid", security: "invoker" },
|
|
486
|
+
{ name: "work_approval_approvers", args: "p_organization_id uuid, p_subject_id uuid, p_approver_id uuid DEFAULT NULL::uuid", returns: "TABLE(user_id uuid, name text, why text)", security: "definer" },
|
|
487
|
+
{ name: "work_approval_decide", args: "p_organization_id uuid, p_approval_id uuid, p_approve boolean, p_note text DEFAULT NULL::text", returns: "jsonb", security: "definer" },
|
|
488
|
+
{ name: "work_approval_may_decide", args: "p_organization_id uuid, p_approval_id uuid", returns: "boolean", security: "definer" },
|
|
489
|
+
{ name: "work_approval_read", args: "p_organization_id uuid, p_approval_id uuid", returns: "jsonb", security: "definer" },
|
|
490
|
+
{ name: "work_approval_request", args: "p_organization_id uuid, p_subject_id uuid, p_change jsonb, p_note text DEFAULT NULL::text, p_approver_id uuid DEFAULT NULL::uuid, p_origin text DEFAULT 'person'::text, p_conversation_id uuid DEFAULT NULL::uuid", returns: "jsonb", security: "definer" },
|
|
491
|
+
{ name: "work_assign", args: "p_organization_id uuid, p_record_id uuid, p_assignee_user_id uuid, p_due_date timestamp with time zone DEFAULT NULL::timestamp with time zone, p_clear_due boolean DEFAULT false", returns: "jsonb", security: "definer" },
|
|
405
492
|
{ name: "work_assignment_fields", args: "p_options_table_id uuid DEFAULT NULL::uuid", returns: "TABLE(key text, label text, spec jsonb)", security: "invoker" },
|
|
406
|
-
{ name: "work_has_assignment", args: "p_organization_id uuid, p_table_id uuid", returns: "boolean", security: "
|
|
407
|
-
{ name: "
|
|
493
|
+
{ name: "work_has_assignment", args: "p_organization_id uuid, p_table_id uuid", returns: "boolean", security: "definer" },
|
|
494
|
+
{ name: "work_inbox", args: "p_organization_id uuid, p_limit integer DEFAULT 50, p_offset integer DEFAULT 0, p_include_decided boolean DEFAULT false", returns: "TABLE(item_id uuid, kind text, origin text, title text, subject_id uuid, subject_kind text, summary text, state text, due_on timestamp with time zone, due_state text, actionable boolean, requested_by uuid, requested_by_name text, at timestamp with time zone)", security: "definer" },
|
|
495
|
+
{ name: "work_instantiation_shape", args: "p_organization_id uuid, p_instantiation_id uuid", returns: "jsonb", security: "definer" },
|
|
496
|
+
{ name: "work_list", args: "p_organization_id uuid, p_flavour text DEFAULT 'mine'::text, p_include_finished boolean DEFAULT false, p_limit integer DEFAULT 100, p_offset integer DEFAULT 0", returns: "TABLE(record_id uuid, table_id uuid, table_name text, title text, assignee_id uuid, assignee_name text, assignee_user_id uuid, due_on timestamp with time zone, due_state text, status text, terminal boolean, assigned_by uuid, updated_at timestamp with time zone)", security: "definer" },
|
|
497
|
+
{ name: "work_person", args: "p_organization_id uuid, p_user_id uuid, p_create boolean DEFAULT true", returns: "uuid", security: "definer" },
|
|
498
|
+
{ name: "work_record_states", args: "p_organization_id uuid, p_record_id uuid", returns: "TABLE(state_id uuid, name text, sort integer, terminal boolean, is_current boolean, allowed boolean, refusal text)", security: "definer" },
|
|
408
499
|
{ name: "work_relation_kinds", args: "", returns: "TABLE(kind text, available boolean, why text)", security: "invoker" },
|
|
409
|
-
{ name: "
|
|
410
|
-
{ name: "
|
|
411
|
-
{ name: "
|
|
500
|
+
{ name: "work_set_state", args: "p_organization_id uuid, p_record_id uuid, p_state_id uuid", returns: "jsonb", security: "definer" },
|
|
501
|
+
{ name: "work_slot_expire", args: "p_organization_id uuid, p_table_id uuid", returns: "integer", security: "definer" },
|
|
502
|
+
{ name: "work_slot_hold", args: "p_organization_id uuid, p_table_id uuid, p_slot_key text, p_holder text, p_ttl interval DEFAULT '00:15:00'::interval", returns: "jsonb", security: "definer" },
|
|
503
|
+
{ name: "work_slot_holds", args: "p_organization_id uuid, p_table_id uuid", returns: "TABLE(hold_id uuid, slot_key text, holder text, expires_at timestamp with time zone, expired boolean)", security: "definer" },
|
|
412
504
|
{ name: "work_slot_index_name", args: "p_table_id uuid", returns: "text", security: "invoker" },
|
|
413
|
-
{ name: "work_slot_release", args: "p_organization_id uuid, p_hold_id uuid", returns: "boolean", security: "
|
|
414
|
-
{ name: "work_slots_declare", args: "p_organization_id uuid, p_name text, p_slug text, p_home_id uuid DEFAULT NULL::uuid", returns: "jsonb", security: "
|
|
505
|
+
{ name: "work_slot_release", args: "p_organization_id uuid, p_hold_id uuid", returns: "boolean", security: "definer" },
|
|
506
|
+
{ name: "work_slots_declare", args: "p_organization_id uuid, p_name text, p_slug text, p_home_id uuid DEFAULT NULL::uuid", returns: "jsonb", security: "definer" },
|
|
415
507
|
{ name: "work_states", args: "", returns: "TABLE(sort integer, name text, terminal boolean, next text[])", security: "invoker" },
|
|
416
|
-
{ name: "work_take_assignment", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "
|
|
417
|
-
{ name: "work_template_declare", args: "p_organization_id uuid, p_name text, p_graph jsonb", returns: "uuid", security: "
|
|
418
|
-
{ name: "work_template_instantiate", args: "p_organization_id uuid, p_template_id uuid, p_overrides jsonb DEFAULT '{}'::jsonb", returns: "jsonb", security: "
|
|
508
|
+
{ name: "work_take_assignment", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "definer" },
|
|
509
|
+
{ name: "work_template_declare", args: "p_organization_id uuid, p_name text, p_graph jsonb", returns: "uuid", security: "definer" },
|
|
510
|
+
{ name: "work_template_instantiate", args: "p_organization_id uuid, p_template_id uuid, p_overrides jsonb DEFAULT '{}'::jsonb", returns: "jsonb", security: "definer" },
|
|
419
511
|
{ name: "work_template_refusal", args: "p_graph jsonb", returns: "text", security: "invoker" },
|
|
420
|
-
{ name: "work_template_shape", args: "p_organization_id uuid, p_template_id uuid", returns: "jsonb", security: "
|
|
421
|
-
{ name: "
|
|
422
|
-
{ name: "
|
|
512
|
+
{ name: "work_template_shape", args: "p_organization_id uuid, p_template_id uuid", returns: "jsonb", security: "definer" },
|
|
513
|
+
{ name: "work_templates", args: "p_organization_id uuid, p_limit integer DEFAULT 100", returns: "TABLE(template_id uuid, name text, nodes integer, relations integer, created_at timestamp with time zone)", security: "definer" },
|
|
514
|
+
{ name: "work_transition_refusal", args: "p_organization_id uuid, p_from_state_id uuid, p_to_state_id uuid", returns: "text", security: "definer" },
|
|
515
|
+
{ name: "work_whose_turn", args: "p_organization_id uuid, p_table_id uuid, p_include_finished boolean DEFAULT false", returns: "TABLE(record_id uuid, title text, assignee_id uuid, turn text, due_on timestamp with time zone, state text, status text, terminal boolean)", security: "definer" }
|
|
423
516
|
];
|
|
424
517
|
var STORE_KNOBS = [
|
|
425
|
-
{ key: "accessible_entity_ids_guard", value: "
|
|
426
|
-
{ key: "agent_schema_changes", value: '"
|
|
427
|
-
{ key: "associations_guard", value: "
|
|
518
|
+
{ key: "accessible_entity_ids_guard", value: "true", type: "boolean" },
|
|
519
|
+
{ key: "agent_schema_changes", value: '"ask"', type: "string" },
|
|
520
|
+
{ key: "associations_guard", value: "true", type: "boolean" },
|
|
428
521
|
{ key: "code_paths_enabled", value: "false", type: "boolean" },
|
|
429
522
|
{ key: "consumer_chat_seeding_enabled", value: "false", type: "boolean" },
|
|
430
523
|
{ key: "consumer_checkout_enabled", value: "false", type: "boolean" },
|
|
@@ -444,7 +537,7 @@ var STORE_KNOBS = [
|
|
|
444
537
|
{ key: "external_principal_enabled", value: "false", type: "boolean" },
|
|
445
538
|
{ key: "field_index_guard", value: "false", type: "boolean" },
|
|
446
539
|
{ 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" },
|
|
447
|
-
{ key: "member_default_level", value: '"viewer"', type: "
|
|
540
|
+
{ key: "member_default_level", value: '"viewer"', type: "enum" },
|
|
448
541
|
{ key: "member_default_visibility", value: '"all_records"', type: "enum" },
|
|
449
542
|
{ key: "records_tool_default", value: "true", type: "boolean" },
|
|
450
543
|
{ key: "row_versions_guard", value: "false", type: "boolean" },
|
|
@@ -459,16 +552,17 @@ var STORE_KNOBS = [
|
|
|
459
552
|
{ key: "world_publish_enabled", value: "false", type: "boolean" }
|
|
460
553
|
];
|
|
461
554
|
var STORE_REFUSAL_CODES = [
|
|
462
|
-
{ code: "02000", raised_by: "doc_render_body,doc_render_document,doc_sign,doc_signature_intact,doc_template_save,external_history_event,external_rows,external_stub_upsert,external_writes_set,migrate_delete,migrate_extract_parent,migrate_merge,migrate_rename,migrate_reparent,migrate_retype,migrate_split,migrate_undo,read_record,record_delete,record_restore,record_update,relation_uncarry,share_access,share_grant,share_lane_set,share_people,share_revoke,visibility_as_of" },
|
|
463
|
-
{ code: "0A000", raised_by: "external_rows,external_source_declare,external_write_through,promote_field,promoted_index_expr,promoted_query_sql,promoted_read,rule_eval,work_slots_declare" },
|
|
464
|
-
{ code: "22004", raised_by: "_value_envelope,actor_word,agg_assert_key,agg_sql,anon_capture,anon_token_issue,anon_write,assert_client_may_reach,doc_render_write,doc_sign,doc_signature_write,doc_template_save,external_history_event,external_rows,external_source_declare,external_stub_upsert,external_write_through,external_writes_set,home_add,io_comment_write,io_import_open,io_outbox_drain,io_restore,migrate_purge,migrate_split,migrate_undo,query_across_homes,query_by_coordinates,query_rollup,record_delete,record_reparent,record_resolve,record_restore,record_update,record_write,relation_carry,relation_own,share_grant,table_declare,work_template_declare" },
|
|
555
|
+
{ code: "02000", raised_by: "doc_render_body,doc_render_document,doc_render_read,doc_sign,doc_signature_intact,doc_signature_read,doc_template_read,doc_template_save,entity_field_retire,entity_field_update,entity_record_read,entity_value_write,external_history_event,external_rows,external_stub_upsert,external_writes_set,migrate_delete,migrate_extract_parent,migrate_merge,migrate_rename,migrate_reparent,migrate_retype,migrate_split,migrate_undo,organization_clear,read_record,record_delete,record_restore,record_update,relation_uncarry,share_access,share_grant,share_lane_set,share_people,share_revoke,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_assign,work_record_states,work_set_state" },
|
|
556
|
+
{ code: "0A000", raised_by: "external_rows,external_source_declare,external_write_through,promote_field,promoted_index_expr,promoted_query_sql,promoted_read,rule_eval,work_assign,work_slots_declare" },
|
|
557
|
+
{ code: "22004", raised_by: "_entity_custom_fields_guard,_value_envelope,actor_word,agg_assert_key,agg_sql,anon_capture,anon_token_issue,anon_write,assert_client_may_reach,doc_render_write,doc_sign,doc_signature_write,doc_template_save,external_history_event,external_rows,external_source_declare,external_stub_upsert,external_write_through,external_writes_set,form_declare,form_submit,home_add,io_comment_write,io_import_open,io_outbox_drain,io_restore,migrate_purge,migrate_split,migrate_undo,organization_clear,organization_contents,query_across_homes,query_by_coordinates,query_rollup,record_delete,record_reparent,record_resolve,record_restore,record_update,record_write,relation_carry,relation_own,rule_declare,share_grant,table_declare,work_approval_decide,work_approval_request,work_template_declare" },
|
|
465
558
|
{ code: "22012", raised_by: "rule_eval" },
|
|
466
|
-
{ code: "22023", raised_by: "_value_envelope,_work_shape_guard,actor_word,agg_assert_key,agg_sql,anon_token_issue,containment_parent,doc_render_body,doc_render_write,doc_signature_write,external_history_event,external_source_declare,external_stub_upsert,external_write_through,io_import_open,io_proposal_accept,migrate_merge,query_by_coordinates,query_rollup,record_update,relation_carry,rule_eval,rule_members,share_grant,share_lane_set,table_rules,visibility_as_of,work_slot_hold" },
|
|
467
|
-
{ code: "23503", raised_by: "_containment_guard,_record_rule_uses,anon_publish,anon_rate_take,anon_token_issue,anon_write,assert_organization_wall,delete_rule,doc_sign,doc_template_save,home_add,io_comment_write,io_import_rows,io_proposal_accept,migrate_demote,migrate_promote,promote_field,promote_table,record_applicability,record_reparent,relation_carry,relation_own,resolve_first_match,rule_applies,rule_eval,rule_members,rule_run,work_take_assignment,work_template_instantiate" },
|
|
468
|
-
{ code: "23505", raised_by: "doc_sign,doc_signature_write,field_declare,home_add,io_proposal_accept,relation_carry,relation_own,share_grant,work_slot_hold" },
|
|
469
|
-
{ code: "23514", raised_by: "_containment_guard,_dated_values_guard,_derived_fields,_field_document_for,_field_shape_guard,_field_type_parity_guard,_merge_field_shape_guard,_merge_field_temporal_guard,_promoted_field_cap_guard,_record_rule_uses,_rule_shape_guard,_rule_topology_guard,_store_relation_edge_names_its_field,_table_shape_guard,_value_envelope,_work_shape_guard,doc_sign,doc_signature_write,doc_template_save,field_declare,field_retire,field_update,home_add,migrate_merge,relation_carry,relation_own,validate_value_envelope,validate_values,work_slots_declare,work_take_assignment,work_template_instantiate" },
|
|
559
|
+
{ code: "22023", raised_by: "_entity_custom_fields_guard,_value_envelope,_work_shape_guard,actor_word,agg_assert_key,agg_sql,anon_token_issue,containment_parent,doc_render_body,doc_render_write,doc_signature_write,entity_value_write,external_history_event,external_source_declare,external_stub_upsert,external_write_through,io_import_open,io_proposal_accept,migrate_merge,my_levels,organization_clear,query_by_coordinates,query_rollup,record_update,relation_carry,rule_eval,rule_members,share_grant,share_lane_set,table_rules,visibility_as_of,work_approval_request,work_list,work_slot_hold" },
|
|
560
|
+
{ code: "23503", raised_by: "_containment_guard,_field_document_for,_record_rule_uses,anon_publish,anon_rate_take,anon_token_issue,anon_write,assert_organization_wall,delete_rule,doc_sign,doc_template_save,form_declare,form_submit,home_add,io_comment_write,io_import_rows,io_proposal_accept,migrate_demote,migrate_promote,promote_field,promote_table,record_applicability,record_reparent,relation_carry,relation_own,resolve_first_match,rule_applies,rule_declare,rule_eval,rule_members,rule_run,work_set_state,work_take_assignment,work_template_instantiate" },
|
|
561
|
+
{ code: "23505", raised_by: "_unique_rule_holds,doc_sign,doc_signature_write,entity_field_declare,field_declare,home_add,io_proposal_accept,relation_carry,relation_own,share_grant,work_approval_decide,work_slot_hold" },
|
|
562
|
+
{ code: "23514", raised_by: "_containment_guard,_dated_values_guard,_derived_fields,_entity_custom_fields_guard,_field_document_for,_field_shape_guard,_field_type_parity_guard,_merge_field_shape_guard,_merge_field_temporal_guard,_promoted_field_cap_guard,_record_rule_uses,_resolve_choice_words,_rule_shape_guard,_rule_topology_guard,_store_relation_edge_names_its_field,_table_shape_guard,_value_envelope,_work_shape_guard,_workdoors_approval_guard,assert_entity_is_organization_scoped,doc_sign,doc_signature_write,doc_template_save,entity_field_declare,entity_field_retire,entity_field_update,entity_records_find,entity_table,field_declare,field_retire,field_update,home_add,migrate_merge,relation_carry,relation_own,validate_value_envelope,validate_values,work_set_state,work_slots_declare,work_take_assignment,work_template_instantiate" },
|
|
470
563
|
{ code: "40001", raised_by: "has_visibility_at" },
|
|
471
|
-
{ 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_organization_admin,assert_store_door,external_write_through,io_comment_resolve,io_comment_write,io_restore,migrate_purge,promote_table,query_visibility_parity,read_record,read_records,share_grant,visibility_as_of" },
|
|
564
|
+
{ code: "42501", raised_by: "_doc_render_immutable,_doc_signature_immutable,_field_definition_write,_field_write_door,_rule_definition_write,_store_door,anon_capture,anon_inbound_land,anon_publish,anon_token_issue,anon_token_verify,anon_write,assert_client_may_change,assert_client_may_open,assert_client_may_reach,assert_may_know_table,assert_organization_admin,assert_store_door,entity_field_declare,entity_field_retire,entity_field_update,entity_value_write,external_write_through,form_declare,form_submit,io_comment_resolve,io_comment_write,io_restore,migrate_purge,my_levels,organization_clear,promote_table,query_visibility_parity,read_record,read_records,share_grant,visibility_as_of,work_approval_decide,work_approval_read,work_approval_request,work_person" },
|
|
565
|
+
{ code: "42703", raised_by: "entity_table" },
|
|
472
566
|
{ code: "53400", raised_by: "anon_rate_take,delete_cascade_closure,promote_field" },
|
|
473
567
|
{ code: "54001", raised_by: "record_delete" },
|
|
474
568
|
{ code: "PT409", raised_by: "record_update" }
|
|
@@ -1590,6 +1684,10 @@ var DOORS = {
|
|
|
1590
1684
|
recordReparent: "record_reparent",
|
|
1591
1685
|
containmentChain: "containment_chain",
|
|
1592
1686
|
storeIsOpen: "store_is_open",
|
|
1687
|
+
// DOOR-1, from the screen's side. What level the CALLER holds on the subjects
|
|
1688
|
+
// they name — the one question a screen has to answer BEFORE it draws a
|
|
1689
|
+
// control, and the only one the store had no client answer to.
|
|
1690
|
+
myLevels: "my_levels",
|
|
1593
1691
|
// DOOR-11. The record's own revision list. A screen that offers an optimistic
|
|
1594
1692
|
// save needs the version it LOADED, and the read door answers documents, not
|
|
1595
1693
|
// versions — so the version comes from here, once, for the one record being
|
|
@@ -1611,6 +1709,17 @@ var DOORS = {
|
|
|
1611
1709
|
ruleMembership: "rule_membership",
|
|
1612
1710
|
ruleRun: "rule_run",
|
|
1613
1711
|
ruleEval: "rule_eval",
|
|
1712
|
+
// REC-15: the door that makes a Rule a RULE. `custom.record_write` into the
|
|
1713
|
+
// Rule kernel produces a valid Rule document carrying `data_class = 'record'`,
|
|
1714
|
+
// and every reader that goes LOOKING for a Rule looks for the class — so a
|
|
1715
|
+
// subscription written that way was invisible to DOOR-18 and nothing fired.
|
|
1716
|
+
// PRODUCTS row 1 — a form is a view on a real Table. `forms` lists an
|
|
1717
|
+
// organization's own, `formDeclare` writes one, and `anonPublish` is the one
|
|
1718
|
+
// act that opens it to people with no account. The PUBLIC pair
|
|
1719
|
+
// (`custom.form_public`, `custom.form_submit`) is deliberately absent: those
|
|
1720
|
+
// are server-lane doors and a browser never calls them.
|
|
1721
|
+
forms: "forms",
|
|
1722
|
+
formDeclare: "form_declare",
|
|
1614
1723
|
// The eighth verb (AGT-N-8): a grouped, bucketed, filtered count/sum/avg/
|
|
1615
1724
|
// min/max computed INSIDE the read door's own query, so a chart shows exactly
|
|
1616
1725
|
// the rows this person may see and never fetches the ones they may not.
|
|
@@ -1692,6 +1801,14 @@ var BY_SQLSTATE = {
|
|
|
1692
1801
|
// is wrong for the shape the store holds, which is what `invalid_argument`
|
|
1693
1802
|
// already means — the store's own sentence names the value and the type.
|
|
1694
1803
|
"22P02": "invalid_argument",
|
|
1804
|
+
// 42703 — a column that is not there. The store raises it from
|
|
1805
|
+
// `custom.entity_table`, which is asked for a column by NAME, so the class is
|
|
1806
|
+
// exactly "the call named something the shape does not have": the same thing
|
|
1807
|
+
// `invalid_argument` already means, and the store's own sentence names the
|
|
1808
|
+
// column. Added 2026-09-20 (lane FORMS) because the package's live-door suite
|
|
1809
|
+
// caught it raised by a door this package did not know about — which is the
|
|
1810
|
+
// suite working, and is why the map is a census rather than a guess.
|
|
1811
|
+
"42703": "invalid_argument",
|
|
1695
1812
|
"02000": "not_found",
|
|
1696
1813
|
"23503": "missing_reference",
|
|
1697
1814
|
"23505": "already_exists",
|
|
@@ -2130,6 +2247,31 @@ function createRecordsClient(config) {
|
|
|
2130
2247
|
"ruleMembership"
|
|
2131
2248
|
);
|
|
2132
2249
|
},
|
|
2250
|
+
async forms(args) {
|
|
2251
|
+
return callDoor(
|
|
2252
|
+
DOORS.forms,
|
|
2253
|
+
{ p_organization_id: org, p_table_id: args?.table_id ?? null },
|
|
2254
|
+
"forms"
|
|
2255
|
+
);
|
|
2256
|
+
},
|
|
2257
|
+
async formDeclare(args) {
|
|
2258
|
+
return callDoor(
|
|
2259
|
+
DOORS.formDeclare,
|
|
2260
|
+
{
|
|
2261
|
+
p_organization_id: org,
|
|
2262
|
+
p_table_id: args.table_id,
|
|
2263
|
+
p_title: args.title,
|
|
2264
|
+
p_questions: args.questions,
|
|
2265
|
+
p_presentation: args.presentation ?? {},
|
|
2266
|
+
p_submission_cap: args.submission_cap ?? null,
|
|
2267
|
+
p_quarantine_rule_id: args.quarantine_rule_id ?? null,
|
|
2268
|
+
p_notify_rule_id: args.notify_rule_id ?? null,
|
|
2269
|
+
p_form_id: args.form_id ?? null,
|
|
2270
|
+
p_slug: args.slug ?? null
|
|
2271
|
+
},
|
|
2272
|
+
"formDeclare"
|
|
2273
|
+
);
|
|
2274
|
+
},
|
|
2133
2275
|
async ruleRun({ rule_id, values, context }) {
|
|
2134
2276
|
return callDoor(
|
|
2135
2277
|
DOORS.ruleRun,
|
|
@@ -2538,10 +2680,12 @@ function createRecordsClient(config) {
|
|
|
2538
2680
|
"publishToWorld"
|
|
2539
2681
|
);
|
|
2540
2682
|
},
|
|
2541
|
-
async ruleDeclare() {
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2683
|
+
async ruleDeclare({ spec, rule_id }) {
|
|
2684
|
+
return callDoor(
|
|
2685
|
+
DOORS.ruleDeclare,
|
|
2686
|
+
{ p_organization_id: org, p_spec: spec, p_rule_id: rule_id ?? null },
|
|
2687
|
+
"ruleDeclare"
|
|
2688
|
+
);
|
|
2545
2689
|
},
|
|
2546
2690
|
async metadataSearch() {
|
|
2547
2691
|
const refusal = doorAbsent(DOORS.metadataSearch);
|
|
@@ -2574,6 +2718,18 @@ function createRecordsClient(config) {
|
|
|
2574
2718
|
},
|
|
2575
2719
|
async storeIsOpen() {
|
|
2576
2720
|
return callDoor(DOORS.storeIsOpen, { p_organization_id: org }, "storeIsOpen");
|
|
2721
|
+
},
|
|
2722
|
+
async myLevels({ ids, subject }) {
|
|
2723
|
+
if (ids.length === 0) return ok([]);
|
|
2724
|
+
const answered = await callDoor(
|
|
2725
|
+
DOORS.myLevels,
|
|
2726
|
+
{ p_organization_id: org, p_ids: ids, p_type: subject ?? "record" },
|
|
2727
|
+
"myLevels"
|
|
2728
|
+
);
|
|
2729
|
+
if (!answered.ok) return err(answered.error);
|
|
2730
|
+
return ok(
|
|
2731
|
+
(answered.data ?? []).map((row) => ({ id: row.id, level: asPermissionLevel(row.level) }))
|
|
2732
|
+
);
|
|
2577
2733
|
}
|
|
2578
2734
|
};
|
|
2579
2735
|
return client;
|
|
@@ -2619,6 +2775,9 @@ function useRecordsClient() {
|
|
|
2619
2775
|
}
|
|
2620
2776
|
return client;
|
|
2621
2777
|
}
|
|
2778
|
+
function useOptionalRecordsClient() {
|
|
2779
|
+
return (0, import_react.useContext)(RecordsContext);
|
|
2780
|
+
}
|
|
2622
2781
|
function useRecordsActor() {
|
|
2623
2782
|
return useRecordsClient().config.actor;
|
|
2624
2783
|
}
|
|
@@ -2668,6 +2827,31 @@ function useTable(tableId) {
|
|
|
2668
2827
|
function useTables() {
|
|
2669
2828
|
return useAsync((client) => client.tableList(), []);
|
|
2670
2829
|
}
|
|
2830
|
+
function useMyLevels(ids) {
|
|
2831
|
+
const key = ids.join(",");
|
|
2832
|
+
return useAsync(
|
|
2833
|
+
async (client) => {
|
|
2834
|
+
const asked = key === "" ? [] : key.split(",");
|
|
2835
|
+
const answered = await client.myLevels({ ids: asked });
|
|
2836
|
+
if (!answered.ok) return answered;
|
|
2837
|
+
const held = {};
|
|
2838
|
+
for (const row of answered.data) held[row.id] = row.level;
|
|
2839
|
+
return { ok: true, data: held };
|
|
2840
|
+
},
|
|
2841
|
+
[key]
|
|
2842
|
+
);
|
|
2843
|
+
}
|
|
2844
|
+
function useMyLevel(id) {
|
|
2845
|
+
return useAsync(
|
|
2846
|
+
async (client) => {
|
|
2847
|
+
if (!id) return { ok: true, data: null };
|
|
2848
|
+
const answered = await client.myLevels({ ids: [id] });
|
|
2849
|
+
if (!answered.ok) return answered;
|
|
2850
|
+
return { ok: true, data: answered.data[0]?.level ?? null };
|
|
2851
|
+
},
|
|
2852
|
+
[id]
|
|
2853
|
+
);
|
|
2854
|
+
}
|
|
2671
2855
|
function useFields(tableId, recordType) {
|
|
2672
2856
|
return useAsync(
|
|
2673
2857
|
async (client) => {
|
|
@@ -2890,6 +3074,11 @@ var OVERRIDE_POLICIES = [
|
|
|
2890
3074
|
var FRESHNESS = ["live", "cached", "snapshot"];
|
|
2891
3075
|
var TABLE_DISPLAYS = ["list", "grid", "board", "calendar", "timeline"];
|
|
2892
3076
|
|
|
3077
|
+
// src/rule.ts
|
|
3078
|
+
function publicFormPath(formId) {
|
|
3079
|
+
return `/f/${formId}`;
|
|
3080
|
+
}
|
|
3081
|
+
|
|
2893
3082
|
// src/aggregate.ts
|
|
2894
3083
|
function measureKey(measure) {
|
|
2895
3084
|
return measure.op === "count" ? "count" : `${measure.op}_${measure.key ?? ""}`;
|