@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
@@ -864,6 +864,9 @@ function ledgerOver(ours) {
864
864
  }
865
865
  var defaultOpLedger = ledgerOver((0, import_global_slot2.globalSlot)("ai-matrx.records.op-ledger", () => /* @__PURE__ */ new Map()));
866
866
 
867
+ // src/scopes/types.ts
868
+ var SYSTEM_CONTEXT_TYPE_ID = "__system__";
869
+
867
870
  // src/scopes/codec.ts
868
871
  var str = (v, fallback = "") => typeof v === "string" ? v : fallback;
869
872
  var strOrNull = (v) => typeof v === "string" ? v : null;
@@ -1035,6 +1038,51 @@ var SENSITIVITY_TO_DOOR = {
1035
1038
  confidential: "restricted",
1036
1039
  restricted: "privileged"
1037
1040
  };
1041
+ var SENSITIVITY_FROM_DOOR = {
1042
+ public: "public",
1043
+ internal: "internal",
1044
+ restricted: "confidential",
1045
+ privileged: "restricted"
1046
+ };
1047
+ function systemContextFieldFromStore(row, index) {
1048
+ const key = str(row.key);
1049
+ const kind = str(row.value_type, "string");
1050
+ return {
1051
+ id: str(row.id),
1052
+ scope_type_id: SYSTEM_CONTEXT_TYPE_ID,
1053
+ organization_id: "",
1054
+ key,
1055
+ label: str(row.display_name, key),
1056
+ description: str(row.description),
1057
+ kind: KINDS.has(kind) ? kind : "string",
1058
+ type: "system",
1059
+ multi: kind === "array",
1060
+ format: null,
1061
+ config: {},
1062
+ relation_target: null,
1063
+ sort: typeof row.sort_order === "number" ? row.sort_order : index,
1064
+ context_policy: "include",
1065
+ // The system table keeps the old sensitivity words (`restricted`/`privileged`), like the write doors.
1066
+ sensitivity: SENSITIVITY_FROM_DOOR[str(row.sensitivity)] ?? "public",
1067
+ source: "system",
1068
+ status: "active",
1069
+ status_note: null,
1070
+ category: null,
1071
+ tags: [],
1072
+ max_items: 0,
1073
+ custom_component: null,
1074
+ reference_source: null,
1075
+ allowed_scope_type_ids: null,
1076
+ allowed_reference_types: null,
1077
+ review_interval_days: null,
1078
+ depends_on: [],
1079
+ version: 0,
1080
+ created_by: null,
1081
+ created_at: "",
1082
+ updated_at: "",
1083
+ item_class: strOrNull(row.item_class)
1084
+ };
1085
+ }
1038
1086
  var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
1039
1087
  function referencesOf(row) {
1040
1088
  const v = row.value;
@@ -1369,7 +1417,11 @@ function createScopeDoors(call) {
1369
1417
  },
1370
1418
  async systemItems() {
1371
1419
  const res = await call("context_system_items", {}, "scopes.systemItems");
1372
- return res.ok ? { ok: true, data: res.data ?? [] } : res;
1420
+ return res.ok ? { ok: true, data: (res.data ?? []).map(systemContextFieldFromStore) } : res;
1421
+ },
1422
+ async tableTemplates(organizationId) {
1423
+ const res = await call("table_templates", { p_org_id: organizationId }, "scopes.tableTemplates");
1424
+ return res.ok ? { ok: true, data: Array.isArray(res.data) ? res.data : [] } : res;
1373
1425
  },
1374
1426
  async templates() {
1375
1427
  const res = await call("context_templates", {}, "scopes.templates");