@ai-matrx/records 0.76.19 → 0.77.2

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.
Files changed (70) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/app-table/index.cjs +84 -2
  3. package/dist/app-table/index.cjs.map +1 -1
  4. package/dist/app-table/index.d.cts +7 -7
  5. package/dist/app-table/index.d.ts +7 -7
  6. package/dist/app-table/index.js +84 -2
  7. package/dist/app-table/index.js.map +1 -1
  8. package/dist/{client-EaE4ta6p.d.cts → client-DZ3UcU4_.d.cts} +53 -5
  9. package/dist/{client-C8G7zUMQ.d.ts → client-ZIxyAOdh.d.ts} +53 -5
  10. package/dist/core/index.cjs +97 -8
  11. package/dist/core/index.cjs.map +1 -1
  12. package/dist/core/index.d.cts +21 -11
  13. package/dist/core/index.d.ts +21 -11
  14. package/dist/core/index.js +97 -8
  15. package/dist/core/index.js.map +1 -1
  16. package/dist/data/index.cjs +85 -3
  17. package/dist/data/index.cjs.map +1 -1
  18. package/dist/data/index.d.cts +6 -6
  19. package/dist/data/index.d.ts +6 -6
  20. package/dist/data/index.js +85 -3
  21. package/dist/data/index.js.map +1 -1
  22. package/dist/{declareTable-aoFu32Ca.d.cts → declareTable-BYZdFrt5.d.cts} +4 -4
  23. package/dist/{declareTable-3yW8GrJE.d.ts → declareTable-DGSJMqGx.d.ts} +4 -4
  24. package/dist/{field-DkB6Nods.d.cts → field-BTW7h7Wh.d.cts} +1 -1
  25. package/dist/{field-cWRPTM3U.d.ts → field-D7I9yck6.d.ts} +1 -1
  26. package/dist/index.cjs +30 -8
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +7 -7
  29. package/dist/index.d.ts +7 -7
  30. package/dist/index.js +30 -8
  31. package/dist/index.js.map +1 -1
  32. package/dist/memory/index.cjs +31 -0
  33. package/dist/memory/index.cjs.map +1 -1
  34. package/dist/memory/index.d.cts +6 -6
  35. package/dist/memory/index.d.ts +6 -6
  36. package/dist/memory/index.js +31 -0
  37. package/dist/memory/index.js.map +1 -1
  38. package/dist/{ports-C2_pOWrL.d.ts → ports-CaYEF1dG.d.ts} +1 -1
  39. package/dist/{ports-C83nhjoM.d.cts → ports-PpvsH1cQ.d.cts} +1 -1
  40. package/dist/react/index.cjs +98 -9
  41. package/dist/react/index.cjs.map +1 -1
  42. package/dist/react/index.d.cts +324 -15
  43. package/dist/react/index.d.ts +324 -15
  44. package/dist/react/index.js +98 -9
  45. package/dist/react/index.js.map +1 -1
  46. package/dist/realtime/index.d.cts +2 -2
  47. package/dist/realtime/index.d.ts +2 -2
  48. package/dist/{record-DVtXK-6L.d.cts → record-B7iwye2k.d.cts} +75 -13
  49. package/dist/{record-DVtXK-6L.d.ts → record-B7iwye2k.d.ts} +75 -13
  50. package/dist/{subscription-DxtZgyFR.d.ts → subscription-BWaRPLyo.d.ts} +60 -2
  51. package/dist/{subscription-vpnl6GxJ.d.cts → subscription-Br30ZwIt.d.cts} +60 -2
  52. package/dist/{table-kind-BtguhnRV.d.cts → table-kind-Da21ZLdJ.d.ts} +146 -5
  53. package/dist/{table-kind-DzyRtFNa.d.ts → table-kind-HAQ6WNxZ.d.cts} +146 -5
  54. package/dist/templates/index.cjs +14 -0
  55. package/dist/templates/index.cjs.map +1 -1
  56. package/dist/templates/index.d.cts +9 -9
  57. package/dist/templates/index.d.ts +9 -9
  58. package/dist/templates/index.js +14 -0
  59. package/dist/templates/index.js.map +1 -1
  60. package/dist/{types-y8GX3-QC.d.ts → types-DWZ5_3by.d.ts} +2 -2
  61. package/dist/{types-DWoJFBbr.d.cts → types-DYoWzHwJ.d.cts} +2 -2
  62. package/dist/{types-DqCWKOYh.d.ts → types-DrJLOqVi.d.ts} +2 -2
  63. package/dist/{types-X9P-cQd0.d.cts → types-LvxsZ6Zv.d.cts} +2 -2
  64. package/dist/use-cases/index.cjs.map +1 -1
  65. package/dist/use-cases/index.d.cts +5 -5
  66. package/dist/use-cases/index.d.ts +5 -5
  67. package/dist/use-cases/index.js.map +1 -1
  68. package/dist/{validate-CEE0ts9g.d.cts → validate-CRdXE73G.d.cts} +1 -1
  69. package/dist/{validate-d9QMYjBm.d.ts → validate-j0WQoC3C.d.ts} +1 -1
  70. package/package.json +3 -3
@@ -1,9 +1,9 @@
1
- import { bF as EntityRefWithWords } from '../table-kind-BtguhnRV.cjs';
2
- import { U as Uuid, h as RecordsResult, n as RecordPageSort, m as ReadRow } from '../record-DVtXK-6L.cjs';
3
- import { R as RecordsClient } from '../client-EaE4ta6p.cjs';
4
- import { b as Field } from '../field-DkB6Nods.cjs';
5
- import { s as RuleExpression } from '../subscription-vpnl6GxJ.cjs';
6
- import '../ports-C83nhjoM.cjs';
1
+ import { bK as EntityRefWithWords } from '../table-kind-HAQ6WNxZ.cjs';
2
+ import { U as Uuid, h as RecordsResult, n as RecordPageSort, m as ReadRow } from '../record-B7iwye2k.cjs';
3
+ import { R as RecordsClient } from '../client-DZ3UcU4_.cjs';
4
+ import { b as Field } from '../field-BTW7h7Wh.cjs';
5
+ import { u as RuleExpression } from '../subscription-Br30ZwIt.cjs';
6
+ import '../ports-PpvsH1cQ.cjs';
7
7
 
8
8
  /** §0. A link to any thing: `{token, id, label}`. A custom row's token is `record`. Every link reads as `EntityRef[]`. */
9
9
  type EntityRef = EntityRefWithWords;
@@ -1,9 +1,9 @@
1
- import { bF as EntityRefWithWords } from '../table-kind-DzyRtFNa.js';
2
- import { U as Uuid, h as RecordsResult, n as RecordPageSort, m as ReadRow } from '../record-DVtXK-6L.js';
3
- import { R as RecordsClient } from '../client-C8G7zUMQ.js';
4
- import { b as Field } from '../field-cWRPTM3U.js';
5
- import { s as RuleExpression } from '../subscription-DxtZgyFR.js';
6
- import '../ports-C2_pOWrL.js';
1
+ import { bK as EntityRefWithWords } from '../table-kind-Da21ZLdJ.js';
2
+ import { U as Uuid, h as RecordsResult, n as RecordPageSort, m as ReadRow } from '../record-B7iwye2k.js';
3
+ import { R as RecordsClient } from '../client-ZIxyAOdh.js';
4
+ import { b as Field } from '../field-D7I9yck6.js';
5
+ import { u as RuleExpression } from '../subscription-BWaRPLyo.js';
6
+ import '../ports-CaYEF1dG.js';
7
7
 
8
8
  /** §0. A link to any thing: `{token, id, label}`. A custom row's token is `record`. Every link reads as `EntityRef[]`. */
9
9
  type EntityRef = EntityRefWithWords;
@@ -626,8 +626,9 @@ function parseTableDuplicated(raw) {
626
626
  var ORDINAL = {
627
627
  viewer: 1,
628
628
  commenter: 2,
629
- editor: 3,
630
- admin: 4
629
+ edit_content: 3,
630
+ editor: 4,
631
+ admin: 5
631
632
  };
632
633
  function atLeast(held, needed) {
633
634
  if (!held) return false;
@@ -792,6 +793,12 @@ var STORE_DOORS = [
792
793
  { name: "assert_public_reader_names_a_public_table", args: "p_organization_id uuid, p_table_id uuid, p_door text", returns: "void", security: "definer" },
793
794
  { name: "assert_scope_door", args: "p_organization_id uuid, p_door text", returns: "void", security: "definer" },
794
795
  { name: "assert_store_door", args: "p_organization_id uuid, p_door text", returns: "void", security: "invoker" },
796
+ { name: "automation_archive", args: "p_organization_id uuid, p_automation_id uuid", returns: "jsonb", security: "definer" },
797
+ { name: "automation_declare", args: "p_organization_id uuid, p_table_id uuid, p_spec jsonb, p_automation_id uuid DEFAULT NULL::uuid", returns: "jsonb", security: "definer" },
798
+ { name: "automation_restore", args: "p_organization_id uuid, p_automation_id uuid", returns: "jsonb", security: "definer" },
799
+ { name: "automation_runs", args: "p_automation_id uuid, p_limit integer DEFAULT 50, p_cursor timestamp with time zone DEFAULT NULL::timestamp with time zone, p_organization_id uuid DEFAULT NULL::uuid", returns: "jsonb", security: "definer" },
800
+ { name: "automation_set_enabled", args: "p_organization_id uuid, p_automation_id uuid, p_enabled boolean", returns: "jsonb", security: "definer" },
801
+ { name: "automations", args: "p_table_id uuid, p_organization_id uuid DEFAULT NULL::uuid, p_include_archived boolean DEFAULT false", returns: "jsonb", security: "definer" },
795
802
  { name: "autonumber_backfill", args: "p_organization_id uuid, p_field_id uuid", returns: "jsonb", security: "definer" },
796
803
  { name: "barcode_symbologies", args: "", returns: "text[]", security: "invoker" },
797
804
  { name: "booking_cancel", args: "p_booking_ref text, p_origin text DEFAULT NULL::text", returns: "TABLE(booking_ref text, record_id uuid, slot_key text, state text, message text)", security: "definer" },
@@ -1038,13 +1045,18 @@ var STORE_DOORS = [
1038
1045
  { name: "form_look_options", args: "p_organization_id uuid, p_presentation jsonb DEFAULT '{}'::jsonb", returns: "jsonb", security: "definer" },
1039
1046
  { name: "form_notify", args: "p_organization_id uuid, p_form_id uuid, p_record_id uuid, p_submission_id uuid", returns: "uuid", security: "invoker" },
1040
1047
  { name: "form_preview_asks", args: "p_organization_id uuid, p_table_id uuid, p_questions jsonb, p_values jsonb", returns: "TABLE(field_key text, asked boolean, decided boolean, said text)", security: "definer" },
1048
+ { name: "form_preview_route", args: "p_organization_id uuid, p_table_id uuid, p_questions jsonb, p_endings jsonb, p_values jsonb", returns: "jsonb", security: "definer" },
1041
1049
  { 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" },
1042
1050
  { name: "form_public_asks", args: "p_form_id uuid, p_values jsonb, p_secret text DEFAULT NULL::text, p_origin text DEFAULT NULL::text", returns: "TABLE(field_key text, asked boolean, decided boolean, said text)", security: "definer" },
1051
+ { name: "form_public_route", args: "p_form_id uuid, p_values jsonb", returns: "jsonb", security: "definer" },
1043
1052
  { name: "form_redirect_domains", args: "p_organization_id uuid", returns: "text[]", security: "invoker" },
1044
1053
  { name: "form_redirect_refusal", args: "p_organization_id uuid, p_url text", returns: "text", security: "invoker" },
1045
1054
  { name: "form_restore", args: "p_organization_id uuid, p_form_id uuid", returns: "jsonb", security: "definer" },
1055
+ { name: "form_results", args: "p_organization_id uuid, p_form_id uuid", returns: "jsonb", security: "definer" },
1046
1056
  { name: "form_slug", args: "p_organization_id uuid, p_title text, p_form_id uuid DEFAULT NULL::uuid", returns: "text", security: "invoker" },
1047
1057
  { 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" },
1058
+ { name: "form_theme_options", args: "", returns: "jsonb", security: "invoker" },
1059
+ { name: "form_visit", args: "p_form_id uuid, p_visit text, p_event text, p_field text DEFAULT NULL::text", returns: "text", security: "definer" },
1048
1060
  { 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" },
1049
1061
  { name: "forms_archived", args: "p_organization_id uuid, p_table_id uuid DEFAULT NULL::uuid, p_limit integer DEFAULT 100", returns: "TABLE(form_id uuid, table_id uuid, table_name text, kind text, title text, slug text, archived_at timestamp with time zone, archived_by uuid, table_archived boolean, can_restore boolean)", security: "definer" },
1050
1062
  { name: "formula_compile_sql", args: "p_organization_id uuid, p_expr jsonb, p_values_sql text", returns: "text", security: "invoker" },
@@ -1375,6 +1387,7 @@ var STORE_DOORS = [
1375
1387
  { name: "rollup_value", args: "p_organization_id uuid, p_record_id uuid, p_field_data jsonb", returns: "jsonb", security: "invoker" },
1376
1388
  { name: "row_actions", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "definer" },
1377
1389
  { name: "row_sits_in_a_personal_table", args: "p_type text, p_organization_id uuid, p_id uuid", returns: "boolean", security: "invoker" },
1390
+ { name: "row_template_bodies", args: "p_organization_id uuid, p_table_id uuid", returns: "TABLE(template_id uuid, body jsonb)", security: "definer" },
1378
1391
  { name: "row_template_declare", args: "p_organization_id uuid, p_table_id uuid, p_spec jsonb", returns: "uuid", security: "definer" },
1379
1392
  { name: "row_templates", args: "p_organization_id uuid, p_table_id uuid", returns: 'TABLE(template_id uuid, name text, table_id uuid, "values" jsonb, created_at timestamp with time zone, updated_at timestamp with time zone)', security: "definer" },
1380
1393
  { name: "rule_applies", args: "p_organization_id uuid, p_rule_id uuid, p_record_id uuid", returns: "jsonb", security: "invoker" },
@@ -1501,6 +1514,8 @@ var STORE_DOORS = [
1501
1514
  { name: "table_stage_field", args: "p_organization_id uuid, p_table_id uuid", returns: "text", security: "definer" },
1502
1515
  { name: "table_storage", args: "p_organization_id uuid, p_table_id uuid", returns: "text", security: "invoker" },
1503
1516
  { name: "table_sync", args: "p_organization_id uuid, p_home_id uuid, p_spec jsonb", returns: "jsonb", security: "definer" },
1517
+ { name: "table_template_declare", args: "p_org_id uuid, p_name text, p_description text, p_fields jsonb", returns: "uuid", security: "invoker" },
1518
+ { name: "table_templates", args: "p_org_id uuid", returns: "jsonb", security: "definer" },
1504
1519
  { name: "table_transfer_owner", args: "p_table_id uuid, p_to_person uuid, p_reason text", returns: "jsonb", security: "definer" },
1505
1520
  { name: "table_type_field", args: "p_organization_id uuid, p_table_id uuid", returns: "text", security: "definer" },
1506
1521
  { name: "table_unique_rule_fields", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "invoker" },
@@ -1966,6 +1981,10 @@ var DOORS = {
1966
1981
  * organization wall and the caller's own rung on the Table — never `rule_eval` from a browser.
1967
1982
  */
1968
1983
  formPreviewAsks: "form_preview_asks",
1984
+ /** TYPEFORM-DUP: the owner's preview of the whole route — jumps, ending, score (`custom._form_route`). */
1985
+ formPreviewRoute: "form_preview_route",
1986
+ /** TYPEFORM-DUP: views, starts, completions, drop-off and answers per question. */
1987
+ formResults: "form_results",
1969
1988
  formLookOptions: "form_look_options",
1970
1989
  // PRODUCTS row 14 — "let clients book a 30-minute consult". A booking page IS an
1971
1990
  // `anon_form`, so it is opened and closed by `anonPublish` like any other; this is
@@ -2283,6 +2302,13 @@ var DOORS = {
2283
2302
  actionDeclare: "action_declare",
2284
2303
  rowActions: "row_actions",
2285
2304
  actionRun: "action_run",
2305
+ // AUTOMATION-DOOR (2026-10-07) — automations on a table. See ../automation.ts.
2306
+ automationDeclare: "automation_declare",
2307
+ automations: "automations",
2308
+ automationArchive: "automation_archive",
2309
+ automationRestore: "automation_restore",
2310
+ automationSetEnabled: "automation_set_enabled",
2311
+ automationRuns: "automation_runs",
2286
2312
  tableWebhookDeclare: "table_webhook_declare",
2287
2313
  tableWebhooks: "table_webhooks",
2288
2314
  tableWebhookArchive: "table_webhook_archive",
@@ -3862,6 +3888,20 @@ function createRecordsClient(given) {
3862
3888
  "formPreviewAsks"
3863
3889
  );
3864
3890
  },
3891
+ async formPreviewRoute({ table_id, questions, endings, values }) {
3892
+ return callDoor(
3893
+ DOORS.formPreviewRoute,
3894
+ { p_organization_id: org, p_table_id: table_id, p_questions: questions, p_endings: endings ?? [], p_values: values },
3895
+ "formPreviewRoute"
3896
+ );
3897
+ },
3898
+ async formResults({ form_id }) {
3899
+ return callDoor(
3900
+ DOORS.formResults,
3901
+ { p_organization_id: org, p_form_id: form_id },
3902
+ "formResults"
3903
+ );
3904
+ },
3865
3905
  async formLookOptions(args) {
3866
3906
  return callDoor(
3867
3907
  DOORS.formLookOptions,
@@ -5538,6 +5578,48 @@ function createRecordsClient(given) {
5538
5578
  }
5539
5579
  return result;
5540
5580
  },
5581
+ async automationDeclare({ table_id, spec, automation_id }) {
5582
+ return callDoor(
5583
+ DOORS.automationDeclare,
5584
+ { p_organization_id: org, p_table_id: table_id, p_spec: spec, p_automation_id: automation_id ?? null },
5585
+ "automationDeclare"
5586
+ );
5587
+ },
5588
+ async automations({ table_id, include_archived }) {
5589
+ return callDoor(
5590
+ DOORS.automations,
5591
+ { p_table_id: table_id, p_organization_id: org, p_include_archived: include_archived ?? false },
5592
+ "automations"
5593
+ );
5594
+ },
5595
+ async automationArchive({ automation_id }) {
5596
+ return callDoor(
5597
+ DOORS.automationArchive,
5598
+ { p_organization_id: org, p_automation_id: automation_id },
5599
+ "automationArchive"
5600
+ );
5601
+ },
5602
+ async automationRestore({ automation_id }) {
5603
+ return callDoor(
5604
+ DOORS.automationRestore,
5605
+ { p_organization_id: org, p_automation_id: automation_id },
5606
+ "automationRestore"
5607
+ );
5608
+ },
5609
+ async automationSetEnabled({ automation_id, enabled }) {
5610
+ return callDoor(
5611
+ DOORS.automationSetEnabled,
5612
+ { p_organization_id: org, p_automation_id: automation_id, p_enabled: enabled },
5613
+ "automationSetEnabled"
5614
+ );
5615
+ },
5616
+ async automationRuns({ automation_id, limit, cursor }) {
5617
+ return callDoor(
5618
+ DOORS.automationRuns,
5619
+ { p_automation_id: automation_id, p_limit: limit ?? 50, p_cursor: cursor ?? null, p_organization_id: org },
5620
+ "automationRuns"
5621
+ );
5622
+ },
5541
5623
  async tableWebhookDeclare({ table_id, target_url, events, description }) {
5542
5624
  return callDoor(
5543
5625
  DOORS.tableWebhookDeclare,
@@ -5855,7 +5937,7 @@ function createTableDataPort({ client, aliases }) {
5855
5937
  const levels = await seat(binding).myLevels({ ids: [binding.tableId] });
5856
5938
  level = levels.ok ? levels.data[0]?.level ?? null : null;
5857
5939
  }
5858
- const may = atLeast(level, "editor");
5940
+ const may = atLeast(level, "edit_content");
5859
5941
  out.push({ alias, label: binding.label ?? table.data?.name ?? alias, kind: "table", canCreate: may, canUpdate: may });
5860
5942
  }
5861
5943
  return { ok: true, data: out };