@ai-matrx/records 0.76.17 → 0.77.1

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 +25 -0
  2. package/dist/app-table/index.cjs +81 -0
  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 +81 -0
  7. package/dist/app-table/index.js.map +1 -1
  8. package/dist/{client-kVZ54twD.d.ts → client-BbzLb-sB.d.ts} +53 -5
  9. package/dist/{client-PaKP4Cnd.d.cts → client-BcGGEpNi.d.cts} +53 -5
  10. package/dist/core/index.cjs +93 -6
  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 +93 -6
  15. package/dist/core/index.js.map +1 -1
  16. package/dist/data/index.cjs +81 -0
  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 +81 -0
  21. package/dist/data/index.js.map +1 -1
  22. package/dist/{declareTable-Bv4V8Bjm.d.cts → declareTable-COEPJpke.d.cts} +4 -4
  23. package/dist/{declareTable-4MK51nXs.d.ts → declareTable-Dxq0Aega.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 +26 -6
  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 +26 -6
  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 +93 -6
  41. package/dist/react/index.cjs.map +1 -1
  42. package/dist/react/index.d.cts +325 -15
  43. package/dist/react/index.d.ts +325 -15
  44. package/dist/react/index.js +93 -6
  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-BJgDMerQ.d.cts → subscription-BWaRPLyo.d.ts} +67 -3
  51. package/dist/{subscription-D8OHY3kw.d.ts → subscription-Br30ZwIt.d.cts} +67 -3
  52. package/dist/{table-kind-BtguhnRV.d.cts → table-kind-C5jsmotR.d.ts} +140 -4
  53. package/dist/{table-kind-DzyRtFNa.d.ts → table-kind-DrVhYZbX.d.cts} +140 -4
  54. package/dist/templates/index.cjs +27 -3
  55. package/dist/templates/index.cjs.map +1 -1
  56. package/dist/templates/index.d.cts +11 -11
  57. package/dist/templates/index.d.ts +11 -11
  58. package/dist/templates/index.js +27 -3
  59. package/dist/templates/index.js.map +1 -1
  60. package/dist/{types-C6gdqgsI.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-Mx-Wzm_d.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 { b as RecordsDataSource, a as RecordsConfig } from '../ports-C83nhjoM.cjs';
2
- import { T as TemplateSpec } from '../types-Mx-Wzm_d.cjs';
3
- import { P as PgError } from '../record-DVtXK-6L.cjs';
4
- import '../subscription-BJgDMerQ.cjs';
5
- import '../types-DWoJFBbr.cjs';
6
- import '../field-DkB6Nods.cjs';
1
+ import { b as RecordsDataSource, a as RecordsConfig } from '../ports-PpvsH1cQ.cjs';
2
+ import { T as TemplateSpec } from '../types-LvxsZ6Zv.cjs';
3
+ import { P as PgError } from '../record-B7iwye2k.cjs';
4
+ import '../subscription-Br30ZwIt.cjs';
5
+ import '../types-DYoWzHwJ.cjs';
6
+ import '../field-BTW7h7Wh.cjs';
7
7
 
8
8
  type Json$1 = Record<string, unknown>;
9
9
  /** One presented column, exactly as `platform.drill_describe(...).api.columns[]` says it. */
@@ -1,9 +1,9 @@
1
- import { b as RecordsDataSource, a as RecordsConfig } from '../ports-C2_pOWrL.js';
2
- import { T as TemplateSpec } from '../types-C6gdqgsI.js';
3
- import { P as PgError } from '../record-DVtXK-6L.js';
4
- import '../subscription-D8OHY3kw.js';
5
- import '../types-DqCWKOYh.js';
6
- import '../field-cWRPTM3U.js';
1
+ import { b as RecordsDataSource, a as RecordsConfig } from '../ports-CaYEF1dG.js';
2
+ import { T as TemplateSpec } from '../types-DWZ5_3by.js';
3
+ import { P as PgError } from '../record-B7iwye2k.js';
4
+ import '../subscription-BWaRPLyo.js';
5
+ import '../types-DrJLOqVi.js';
6
+ import '../field-D7I9yck6.js';
7
7
 
8
8
  type Json$1 = Record<string, unknown>;
9
9
  /** One presented column, exactly as `platform.drill_describe(...).api.columns[]` says it. */
@@ -828,6 +828,12 @@ var STORE_DOORS = [
828
828
  { name: "assert_public_reader_names_a_public_table", args: "p_organization_id uuid, p_table_id uuid, p_door text", returns: "void", security: "definer" },
829
829
  { name: "assert_scope_door", args: "p_organization_id uuid, p_door text", returns: "void", security: "definer" },
830
830
  { name: "assert_store_door", args: "p_organization_id uuid, p_door text", returns: "void", security: "invoker" },
831
+ { name: "automation_archive", args: "p_organization_id uuid, p_automation_id uuid", returns: "jsonb", security: "definer" },
832
+ { 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" },
833
+ { name: "automation_restore", args: "p_organization_id uuid, p_automation_id uuid", returns: "jsonb", security: "definer" },
834
+ { 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" },
835
+ { name: "automation_set_enabled", args: "p_organization_id uuid, p_automation_id uuid, p_enabled boolean", returns: "jsonb", security: "definer" },
836
+ { name: "automations", args: "p_table_id uuid, p_organization_id uuid DEFAULT NULL::uuid, p_include_archived boolean DEFAULT false", returns: "jsonb", security: "definer" },
831
837
  { name: "autonumber_backfill", args: "p_organization_id uuid, p_field_id uuid", returns: "jsonb", security: "definer" },
832
838
  { name: "barcode_symbologies", args: "", returns: "text[]", security: "invoker" },
833
839
  { 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" },
@@ -1074,13 +1080,18 @@ var STORE_DOORS = [
1074
1080
  { name: "form_look_options", args: "p_organization_id uuid, p_presentation jsonb DEFAULT '{}'::jsonb", returns: "jsonb", security: "definer" },
1075
1081
  { name: "form_notify", args: "p_organization_id uuid, p_form_id uuid, p_record_id uuid, p_submission_id uuid", returns: "uuid", security: "invoker" },
1076
1082
  { 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" },
1083
+ { 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" },
1077
1084
  { 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" },
1078
1085
  { 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" },
1086
+ { name: "form_public_route", args: "p_form_id uuid, p_values jsonb", returns: "jsonb", security: "definer" },
1079
1087
  { name: "form_redirect_domains", args: "p_organization_id uuid", returns: "text[]", security: "invoker" },
1080
1088
  { name: "form_redirect_refusal", args: "p_organization_id uuid, p_url text", returns: "text", security: "invoker" },
1081
1089
  { name: "form_restore", args: "p_organization_id uuid, p_form_id uuid", returns: "jsonb", security: "definer" },
1090
+ { name: "form_results", args: "p_organization_id uuid, p_form_id uuid", returns: "jsonb", security: "definer" },
1082
1091
  { name: "form_slug", args: "p_organization_id uuid, p_title text, p_form_id uuid DEFAULT NULL::uuid", returns: "text", security: "invoker" },
1083
1092
  { 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" },
1093
+ { name: "form_theme_options", args: "", returns: "jsonb", security: "invoker" },
1094
+ { name: "form_visit", args: "p_form_id uuid, p_visit text, p_event text, p_field text DEFAULT NULL::text", returns: "text", security: "definer" },
1084
1095
  { 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" },
1085
1096
  { 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" },
1086
1097
  { name: "formula_compile_sql", args: "p_organization_id uuid, p_expr jsonb, p_values_sql text", returns: "text", security: "invoker" },
@@ -1411,6 +1422,7 @@ var STORE_DOORS = [
1411
1422
  { name: "rollup_value", args: "p_organization_id uuid, p_record_id uuid, p_field_data jsonb", returns: "jsonb", security: "invoker" },
1412
1423
  { name: "row_actions", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "definer" },
1413
1424
  { name: "row_sits_in_a_personal_table", args: "p_type text, p_organization_id uuid, p_id uuid", returns: "boolean", security: "invoker" },
1425
+ { name: "row_template_bodies", args: "p_organization_id uuid, p_table_id uuid", returns: "TABLE(template_id uuid, body jsonb)", security: "definer" },
1414
1426
  { name: "row_template_declare", args: "p_organization_id uuid, p_table_id uuid, p_spec jsonb", returns: "uuid", security: "definer" },
1415
1427
  { 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" },
1416
1428
  { name: "rule_applies", args: "p_organization_id uuid, p_rule_id uuid, p_record_id uuid", returns: "jsonb", security: "invoker" },
@@ -1537,6 +1549,8 @@ var STORE_DOORS = [
1537
1549
  { name: "table_stage_field", args: "p_organization_id uuid, p_table_id uuid", returns: "text", security: "definer" },
1538
1550
  { name: "table_storage", args: "p_organization_id uuid, p_table_id uuid", returns: "text", security: "invoker" },
1539
1551
  { name: "table_sync", args: "p_organization_id uuid, p_home_id uuid, p_spec jsonb", returns: "jsonb", security: "definer" },
1552
+ { name: "table_template_declare", args: "p_org_id uuid, p_name text, p_description text, p_fields jsonb", returns: "uuid", security: "invoker" },
1553
+ { name: "table_templates", args: "p_org_id uuid", returns: "jsonb", security: "definer" },
1540
1554
  { name: "table_transfer_owner", args: "p_table_id uuid, p_to_person uuid, p_reason text", returns: "jsonb", security: "definer" },
1541
1555
  { name: "table_type_field", args: "p_organization_id uuid, p_table_id uuid", returns: "text", security: "definer" },
1542
1556
  { name: "table_unique_rule_fields", args: "p_organization_id uuid, p_table_id uuid", returns: "jsonb", security: "invoker" },
@@ -3007,6 +3021,23 @@ function memoryDataSource(world) {
3007
3021
  })
3008
3022
  );
3009
3023
  },
3024
+ // TYPEFORM-DUP. The memory world answers showIf as form_preview_asks does and takes no jumps;
3025
+ // the store's own walk (custom._form_route) is proven against the live database, never here.
3026
+ form_preview_route: (args) => {
3027
+ const t = tableOf(args);
3028
+ const values = args["p_values"] ?? {};
3029
+ const endings = (args["p_endings"] ?? []).filter((e) => !("when" in e || "score_min" in e || "score_max" in e));
3030
+ return ok2({
3031
+ asks: (args["p_questions"] ?? []).map((q) => {
3032
+ const when = q["show_if"] ?? q["showIf"] ?? null;
3033
+ const asked = !when || !t ? true : rule(t, values, values, when) !== false;
3034
+ return { field_key: String(q["field"] ?? q["key"] ?? ""), asked, decided: true, said: null };
3035
+ }),
3036
+ ending: endings[0] ? String(endings[0]["id"]) : null,
3037
+ score: null
3038
+ });
3039
+ },
3040
+ form_results: (args) => ok2({ form_id: args["p_form_id"], views: 0, starts: 0, completions: 0, completion_rate: null, questions: [], endings: [], hidden: [], score: null }),
3010
3041
  bookings: (args) => ok2(
3011
3042
  world.forms.filter((f) => f.booking && (!args["p_table_id"] || f.table_id === args["p_table_id"])).map((f) => ({
3012
3043
  form_id: f.form_id,