@ai-matrx/records 0.97.4 → 0.97.6

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 (48) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/{client-C6_v0Jnq.d.ts → client-B1PjSTav.d.ts} +1 -1
  3. package/dist/{client-BSe721CI.d.cts → client-ijtYioVl.d.cts} +1 -1
  4. package/dist/core/index.cjs +53 -1
  5. package/dist/core/index.cjs.map +1 -1
  6. package/dist/core/index.d.cts +3 -3
  7. package/dist/core/index.d.ts +3 -3
  8. package/dist/core/index.js +53 -1
  9. package/dist/core/index.js.map +1 -1
  10. package/dist/data/index.cjs +53 -1
  11. package/dist/data/index.cjs.map +1 -1
  12. package/dist/data/index.d.cts +2 -2
  13. package/dist/data/index.d.ts +2 -2
  14. package/dist/data/index.js +53 -1
  15. package/dist/data/index.js.map +1 -1
  16. package/dist/{declareTable-B6ps9KX8.d.cts → declareTable-BE423RBb.d.cts} +1 -1
  17. package/dist/{declareTable-C_ZguQb4.d.ts → declareTable-W3aD-9fQ.d.ts} +1 -1
  18. package/dist/{doors-DEvCdeYB.d.cts → doors-Bopr9YVf.d.cts} +52 -5
  19. package/dist/{doors-DnHM_tkC.d.ts → doors-DfHUqP7j.d.ts} +52 -5
  20. package/dist/questions/index.d.cts +2 -2
  21. package/dist/questions/index.d.ts +2 -2
  22. package/dist/react/index.cjs +53 -1
  23. package/dist/react/index.cjs.map +1 -1
  24. package/dist/react/index.d.cts +32 -4
  25. package/dist/react/index.d.ts +32 -4
  26. package/dist/react/index.js +53 -1
  27. package/dist/react/index.js.map +1 -1
  28. package/dist/scopes/index.cjs +53 -1
  29. package/dist/scopes/index.cjs.map +1 -1
  30. package/dist/scopes/index.d.cts +2 -2
  31. package/dist/scopes/index.d.ts +2 -2
  32. package/dist/scopes/index.js +53 -1
  33. package/dist/scopes/index.js.map +1 -1
  34. package/dist/setup/index.cjs +53 -1
  35. package/dist/setup/index.cjs.map +1 -1
  36. package/dist/setup/index.d.cts +2 -2
  37. package/dist/setup/index.d.ts +2 -2
  38. package/dist/setup/index.js +53 -1
  39. package/dist/setup/index.js.map +1 -1
  40. package/dist/typed-table/index.cjs +53 -1
  41. package/dist/typed-table/index.cjs.map +1 -1
  42. package/dist/typed-table/index.d.cts +3 -3
  43. package/dist/typed-table/index.d.ts +3 -3
  44. package/dist/typed-table/index.js +53 -1
  45. package/dist/typed-table/index.js.map +1 -1
  46. package/dist/views/index.d.cts +2 -2
  47. package/dist/views/index.d.ts +2 -2
  48. package/package.json +2 -2
@@ -453,6 +453,9 @@ function createOpLedger() {
453
453
  }
454
454
  var defaultOpLedger = ledgerOver((0, import_global_slot2.globalSlot)("ai-matrx.records.op-ledger", () => /* @__PURE__ */ new Map()));
455
455
 
456
+ // src/scopes/types.ts
457
+ var SYSTEM_CONTEXT_TYPE_ID = "__system__";
458
+
456
459
  // src/scopes/codec.ts
457
460
  var str = (v, fallback = "") => typeof v === "string" ? v : fallback;
458
461
  var strOrNull = (v) => typeof v === "string" ? v : null;
@@ -624,6 +627,51 @@ var SENSITIVITY_TO_DOOR = {
624
627
  confidential: "restricted",
625
628
  restricted: "privileged"
626
629
  };
630
+ var SENSITIVITY_FROM_DOOR = {
631
+ public: "public",
632
+ internal: "internal",
633
+ restricted: "confidential",
634
+ privileged: "restricted"
635
+ };
636
+ function systemContextFieldFromStore(row, index) {
637
+ const key = str(row.key);
638
+ const kind = str(row.value_type, "string");
639
+ return {
640
+ id: str(row.id),
641
+ scope_type_id: SYSTEM_CONTEXT_TYPE_ID,
642
+ organization_id: "",
643
+ key,
644
+ label: str(row.display_name, key),
645
+ description: str(row.description),
646
+ kind: KINDS.has(kind) ? kind : "string",
647
+ type: "system",
648
+ multi: kind === "array",
649
+ format: null,
650
+ config: {},
651
+ relation_target: null,
652
+ sort: typeof row.sort_order === "number" ? row.sort_order : index,
653
+ context_policy: "include",
654
+ // The system table keeps the old sensitivity words (`restricted`/`privileged`), like the write doors.
655
+ sensitivity: SENSITIVITY_FROM_DOOR[str(row.sensitivity)] ?? "public",
656
+ source: "system",
657
+ status: "active",
658
+ status_note: null,
659
+ category: null,
660
+ tags: [],
661
+ max_items: 0,
662
+ custom_component: null,
663
+ reference_source: null,
664
+ allowed_scope_type_ids: null,
665
+ allowed_reference_types: null,
666
+ review_interval_days: null,
667
+ depends_on: [],
668
+ version: 0,
669
+ created_by: null,
670
+ created_at: "",
671
+ updated_at: "",
672
+ item_class: strOrNull(row.item_class)
673
+ };
674
+ }
627
675
  var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
628
676
  function referencesOf(row) {
629
677
  const v = row.value;
@@ -958,7 +1006,11 @@ function createScopeDoors(call) {
958
1006
  },
959
1007
  async systemItems() {
960
1008
  const res = await call("context_system_items", {}, "scopes.systemItems");
961
- return res.ok ? { ok: true, data: res.data ?? [] } : res;
1009
+ return res.ok ? { ok: true, data: (res.data ?? []).map(systemContextFieldFromStore) } : res;
1010
+ },
1011
+ async tableTemplates(organizationId) {
1012
+ const res = await call("table_templates", { p_org_id: organizationId }, "scopes.tableTemplates");
1013
+ return res.ok ? { ok: true, data: Array.isArray(res.data) ? res.data : [] } : res;
962
1014
  },
963
1015
  async templates() {
964
1016
  const res = await call("context_templates", {}, "scopes.templates");