@ai-matrx/records 0.45.0 → 0.47.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 +43 -0
- package/dist/core/index.cjs +37 -6
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +13 -4
- package/dist/core/index.d.ts +13 -4
- package/dist/core/index.js +37 -6
- package/dist/core/index.js.map +1 -1
- package/dist/{field-D0Rr4Cqb.d.cts → field-CFK39l0H.d.cts} +54 -2
- package/dist/{field-D0Rr4Cqb.d.ts → field-CFK39l0H.d.ts} +54 -2
- package/dist/index.cjs +6 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -3
- package/dist/index.d.ts +23 -3
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +37 -6
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +83 -3
- package/dist/react/index.d.ts +83 -3
- package/dist/react/index.js +37 -6
- 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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# Changelog — @ai-matrx/records
|
|
2
2
|
|
|
3
|
+
## 0.47.0
|
|
4
|
+
|
|
5
|
+
**A refusal this package does not recognise no longer becomes a sentence about this package.**
|
|
6
|
+
(lane TAILS-6.)
|
|
7
|
+
|
|
8
|
+
* **`mapPgError` wrote its own note ONTO `hint` — and `hint` is what every screen treats as
|
|
9
|
+
THE REMEDY.** So when the client met a code it did not know, the person acting on the screen
|
|
10
|
+
was handed this to act on:
|
|
11
|
+
|
|
12
|
+
> `@ai-matrx/records did not recognise SQLSTATE from checklistTemplates`
|
|
13
|
+
|
|
14
|
+
Watched on the live seat by the GUIDE lane on 2026-09-21, on the Checklists tab of a table's
|
|
15
|
+
rail, under the title "Something went wrong at our end". Reproduced here from the shapes
|
|
16
|
+
supabase-js actually returns.
|
|
17
|
+
* **The note moves to `RecordsError.diagnostic`, with `unmapped: true` beside it.** It is still
|
|
18
|
+
said out loud — nobody reads the silence as "handled" — but it is said to whoever debugs
|
|
19
|
+
this and to nobody else. `hint` is the STORE's own words or it is absent.
|
|
20
|
+
* **New code `unreachable`, and it is how the bug got out.** A SQLSTATE is five characters;
|
|
21
|
+
supabase-js puts `""` in `code` for a `FetchError` and the HTTP status (`"404"`, `"502"`) when
|
|
22
|
+
the gateway answers with no body. Neither is a SQLSTATE, both used to land in `internal`, and
|
|
23
|
+
`""` is not nullish so it was carried as one. They now classify as `unreachable` — the call
|
|
24
|
+
never reached the store, nothing was written, and the same call can simply be made again,
|
|
25
|
+
which is a thing a screen can honestly offer. `TypeError: Failed to fetch` is the browser
|
|
26
|
+
talking to itself, so the message becomes "We could not reach your data." and the raw text
|
|
27
|
+
goes to `diagnostic`.
|
|
28
|
+
|
|
29
|
+
**Consumer action:** none required. A host that reads `error.hint` gets the store's hint or
|
|
30
|
+
nothing, never this package's commentary; a host that switches on `error.code` should add
|
|
31
|
+
`unreachable` beside `internal` (`@ai-matrx/records-ui` 0.66.0 already has its title and remedy).
|
|
32
|
+
|
|
33
|
+
## 0.46.0
|
|
34
|
+
|
|
35
|
+
**A portal can say which Tables it shows.**
|
|
36
|
+
|
|
37
|
+
- **`portalTables()`** on the client and **`PortalTableRef`** — the one question a TABLE-scoped
|
|
38
|
+
Portals rail has to ask. `custom.portals` takes no table, so the rail on a Table's page (beside
|
|
39
|
+
Forms, Bookings and Dashboards, all table-scoped) decided emptiness from the ORGANIZATION's
|
|
40
|
+
portal count: on Rincon Plumbing Co's Parts table it read "Portals 10" and listed ten cards
|
|
41
|
+
belonging to Jobs, the empty state never rendered, and the whole "Build it / Ask an agent"
|
|
42
|
+
offer was unreachable on every table of that organization.
|
|
43
|
+
Same wall and same visibility gate as `portals`, so the two lists cannot disagree.
|
|
44
|
+
- Store registry regenerated against the live store: 559 doors, 1024 entity tokens.
|
|
45
|
+
|
|
3
46
|
## 0.45.0
|
|
4
47
|
|
|
5
48
|
**One coercion primitive: what a typed-in answer means to a Field, in one place.**
|
package/dist/core/index.cjs
CHANGED
|
@@ -1188,6 +1188,9 @@ var STORE_DOORS = [
|
|
|
1188
1188
|
{ name: "parity_values", args: "p_organization_id uuid, p_record_id uuid", returns: "TABLE(field_key text, field_id uuid, parity_type text, behavior text, unit text, format text, value jsonb, value_version integer, actor text, written_at timestamp with time zone)", security: "invoker" },
|
|
1189
1189
|
{ name: "per_value_access_words", args: "", returns: "text[]", security: "invoker" },
|
|
1190
1190
|
{ name: "person_kernel_id", args: "", returns: "uuid", security: "invoker" },
|
|
1191
|
+
{ name: "phone_canonical", args: "p_text text", returns: "text", security: "invoker" },
|
|
1192
|
+
{ name: "phone_display", args: "p_text text", returns: "text", security: "invoker" },
|
|
1193
|
+
{ name: "phone_pattern", args: "", returns: "text", security: "invoker" },
|
|
1191
1194
|
{ name: "pin_agent_cells", args: "p_new jsonb, p_old jsonb, p_agent_keys text[]", returns: "jsonb", security: "invoker" },
|
|
1192
1195
|
{ name: "pipeline_board", args: "p_organization_id uuid, p_table_id uuid, p_measure text DEFAULT NULL::text", returns: "TABLE(stage_key text, stage_label text, stage_position integer, cards bigint, total numeric, wip_limit integer, over_limit boolean)", security: "definer" },
|
|
1193
1196
|
{ name: "pipeline_declare", args: "p_organization_id uuid, p_table_id uuid, p_spec jsonb", returns: "jsonb", security: "definer" },
|
|
@@ -1209,6 +1212,7 @@ var STORE_DOORS = [
|
|
|
1209
1212
|
{ name: "portal_record_title", args: "p_organization_id uuid, p_record_id uuid", returns: "text", security: "definer" },
|
|
1210
1213
|
{ name: "portal_revoke", args: "p_organization_id uuid, p_portal_id uuid, p_principal_id uuid", returns: "jsonb", security: "definer" },
|
|
1211
1214
|
{ name: "portal_slug", args: "p_organization_id uuid, p_title text, p_portal_id uuid DEFAULT NULL::uuid", returns: "text", security: "definer" },
|
|
1215
|
+
{ name: "portal_tables", args: "p_organization_id uuid", returns: "TABLE(portal_id uuid, table_id uuid, name text)", security: "definer" },
|
|
1212
1216
|
{ name: "portals", args: "p_organization_id uuid", returns: "TABLE(portal_id uuid, title text, slug text, client_table_id uuid, client_table text, is_active boolean, tables integer, invited integer, signed_in integer, sign_in_method text, opened_at timestamp with time zone)", security: "definer" },
|
|
1213
1217
|
{ name: "presentation_kernel_id", args: "", returns: "uuid", security: "invoker" },
|
|
1214
1218
|
{ name: "promote_field", args: "p_organization_id uuid, p_table_id uuid, p_field_id uuid", returns: "jsonb", security: "invoker" },
|
|
@@ -1487,7 +1491,7 @@ var STORE_REFUSAL_CODES = [
|
|
|
1487
1491
|
{ 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" },
|
|
1488
1492
|
{ code: "22007", raised_by: "dashboard_window_sql" },
|
|
1489
1493
|
{ code: "22012", raised_by: "rule_eval" },
|
|
1490
|
-
{ 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,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" },
|
|
1494
|
+
{ 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" },
|
|
1491
1495
|
{ 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" },
|
|
1492
1496
|
{ code: "23505", raised_by: "_unique_rule_holds,doc_sign,doc_signature_write,entity_field_declare,field_declare,home_add,inbound_declare,io_proposal_accept,relation_carry,relation_own,share_grant,sign_request_cancel,sign_request_create,table_share_outside_invite,table_share_outside_resend,work_approval_decide,work_slot_hold" },
|
|
1493
1497
|
{ 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" },
|
|
@@ -2387,6 +2391,7 @@ var ENTITY_TOKENS = [
|
|
|
2387
2391
|
"template_context_items",
|
|
2388
2392
|
"template_scope_types",
|
|
2389
2393
|
"templates",
|
|
2394
|
+
"test_handset_inbox",
|
|
2390
2395
|
"thread",
|
|
2391
2396
|
"tool",
|
|
2392
2397
|
"tool_binding",
|
|
@@ -2756,6 +2761,14 @@ var DOORS = {
|
|
|
2756
2761
|
// pair (`custom.portal_public`, `custom.portal_invitation`, `custom.portal_me`)
|
|
2757
2762
|
// is deliberately absent here: those belong to the outsider's own shell.
|
|
2758
2763
|
portals: "portals",
|
|
2764
|
+
// WHICH TABLES EACH PORTAL SHOWS (TAILS-3). The Portals RAIL lives on a
|
|
2765
|
+
// Table's page beside Forms, Bookings and Dashboards, all of which are
|
|
2766
|
+
// table-scoped; `custom.portals` takes no table, so an organization with one
|
|
2767
|
+
// portal over Jobs saw that portal's cards on its Parts table, the empty
|
|
2768
|
+
// state never rendered, and the whole build/ask offer was unreachable
|
|
2769
|
+
// everywhere in that organization. This is the one question the rail has to
|
|
2770
|
+
// ask, under the same wall and visibility gate as `portals` itself.
|
|
2771
|
+
portalTables: "portal_tables",
|
|
2759
2772
|
portalCard: "portal_card",
|
|
2760
2773
|
portalDeclare: "portal_declare",
|
|
2761
2774
|
portalInvite: "portal_invite",
|
|
@@ -3057,19 +3070,34 @@ function parseDetail(details) {
|
|
|
3057
3070
|
return details;
|
|
3058
3071
|
}
|
|
3059
3072
|
}
|
|
3073
|
+
function isNotASqlstate(code) {
|
|
3074
|
+
if (!code) return true;
|
|
3075
|
+
return /^[0-9]{3}$/.test(code);
|
|
3076
|
+
}
|
|
3060
3077
|
function mapPgError(error, where) {
|
|
3061
|
-
const
|
|
3062
|
-
const
|
|
3078
|
+
const raw = error.code ?? void 0;
|
|
3079
|
+
const sqlstate = raw && raw !== "" ? raw : void 0;
|
|
3063
3080
|
const mapped = {
|
|
3064
|
-
code,
|
|
3081
|
+
code: "internal",
|
|
3065
3082
|
message: error.message,
|
|
3066
3083
|
...error.hint ? { hint: error.hint } : {},
|
|
3067
3084
|
...sqlstate ? { sqlstate } : {}
|
|
3068
3085
|
};
|
|
3086
|
+
if (isNotASqlstate(sqlstate)) {
|
|
3087
|
+
mapped.code = "unreachable";
|
|
3088
|
+
} else {
|
|
3089
|
+
mapped.code = BY_SQLSTATE[sqlstate] ?? "internal";
|
|
3090
|
+
}
|
|
3069
3091
|
const detail = parseDetail(error.details);
|
|
3070
3092
|
if (detail !== void 0) mapped.detail = detail;
|
|
3071
|
-
if (code === "internal") {
|
|
3072
|
-
mapped.
|
|
3093
|
+
if (mapped.code === "internal") {
|
|
3094
|
+
mapped.unmapped = true;
|
|
3095
|
+
mapped.diagnostic = `@ai-matrx/records did not recognise SQLSTATE ${sqlstate ?? "(none)"} from ${where}; the store's own message is the thing to act on.`;
|
|
3096
|
+
} else if (mapped.code === "unreachable") {
|
|
3097
|
+
mapped.unmapped = true;
|
|
3098
|
+
mapped.diagnostic = `@ai-matrx/records never reached the store from ${where}: ${raw ? `the transport answered ${raw}` : "no response"} \u2014 ${error.message}`;
|
|
3099
|
+
mapped.message = "We could not reach your data.";
|
|
3100
|
+
delete mapped.hint;
|
|
3073
3101
|
}
|
|
3074
3102
|
return mapped;
|
|
3075
3103
|
}
|
|
@@ -3821,6 +3849,9 @@ function createRecordsClient(config) {
|
|
|
3821
3849
|
async portals() {
|
|
3822
3850
|
return callDoor(DOORS.portals, { p_organization_id: org }, "portals");
|
|
3823
3851
|
},
|
|
3852
|
+
async portalTables() {
|
|
3853
|
+
return callDoor(DOORS.portalTables, { p_organization_id: org }, "portalTables");
|
|
3854
|
+
},
|
|
3824
3855
|
async portalCard({ portal_id }) {
|
|
3825
3856
|
return callDoor(
|
|
3826
3857
|
DOORS.portalCard,
|