@ai-matrx/records 0.97.5 → 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 +6 -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
@@ -666,6 +666,9 @@ function ledgerOver(ours) {
666
666
  }
667
667
  var defaultOpLedger = ledgerOver((0, import_global_slot2.globalSlot)("ai-matrx.records.op-ledger", () => /* @__PURE__ */ new Map()));
668
668
 
669
+ // src/scopes/types.ts
670
+ var SYSTEM_CONTEXT_TYPE_ID = "__system__";
671
+
669
672
  // src/scopes/codec.ts
670
673
  var str = (v, fallback = "") => typeof v === "string" ? v : fallback;
671
674
  var strOrNull = (v) => typeof v === "string" ? v : null;
@@ -837,6 +840,51 @@ var SENSITIVITY_TO_DOOR = {
837
840
  confidential: "restricted",
838
841
  restricted: "privileged"
839
842
  };
843
+ var SENSITIVITY_FROM_DOOR = {
844
+ public: "public",
845
+ internal: "internal",
846
+ restricted: "confidential",
847
+ privileged: "restricted"
848
+ };
849
+ function systemContextFieldFromStore(row, index) {
850
+ const key = str(row.key);
851
+ const kind = str(row.value_type, "string");
852
+ return {
853
+ id: str(row.id),
854
+ scope_type_id: SYSTEM_CONTEXT_TYPE_ID,
855
+ organization_id: "",
856
+ key,
857
+ label: str(row.display_name, key),
858
+ description: str(row.description),
859
+ kind: KINDS.has(kind) ? kind : "string",
860
+ type: "system",
861
+ multi: kind === "array",
862
+ format: null,
863
+ config: {},
864
+ relation_target: null,
865
+ sort: typeof row.sort_order === "number" ? row.sort_order : index,
866
+ context_policy: "include",
867
+ // The system table keeps the old sensitivity words (`restricted`/`privileged`), like the write doors.
868
+ sensitivity: SENSITIVITY_FROM_DOOR[str(row.sensitivity)] ?? "public",
869
+ source: "system",
870
+ status: "active",
871
+ status_note: null,
872
+ category: null,
873
+ tags: [],
874
+ max_items: 0,
875
+ custom_component: null,
876
+ reference_source: null,
877
+ allowed_scope_type_ids: null,
878
+ allowed_reference_types: null,
879
+ review_interval_days: null,
880
+ depends_on: [],
881
+ version: 0,
882
+ created_by: null,
883
+ created_at: "",
884
+ updated_at: "",
885
+ item_class: strOrNull(row.item_class)
886
+ };
887
+ }
840
888
  var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
841
889
  function referencesOf(row) {
842
890
  const v = row.value;
@@ -1171,7 +1219,11 @@ function createScopeDoors(call) {
1171
1219
  },
1172
1220
  async systemItems() {
1173
1221
  const res = await call("context_system_items", {}, "scopes.systemItems");
1174
- return res.ok ? { ok: true, data: res.data ?? [] } : res;
1222
+ return res.ok ? { ok: true, data: (res.data ?? []).map(systemContextFieldFromStore) } : res;
1223
+ },
1224
+ async tableTemplates(organizationId) {
1225
+ const res = await call("table_templates", { p_org_id: organizationId }, "scopes.tableTemplates");
1226
+ return res.ok ? { ok: true, data: Array.isArray(res.data) ? res.data : [] } : res;
1175
1227
  },
1176
1228
  async templates() {
1177
1229
  const res = await call("context_templates", {}, "scopes.templates");