@ai-matrx/records 0.58.6 → 0.58.8

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.
package/dist/index.cjs CHANGED
@@ -137,6 +137,8 @@ __export(src_exports, {
137
137
  portalTitleTypedBack: () => portalTitleTypedBack,
138
138
  publicFormPath: () => publicFormPath,
139
139
  recordChangeTrigger: () => recordChangeTrigger,
140
+ recordSourceKey: () => recordSourceKey,
141
+ recordSourceTable: () => recordSourceTable,
140
142
  rememberedOpCount: () => rememberedOpCount,
141
143
  sameDocument: () => sameDocument,
142
144
  scopeChip: () => scopeChip,
@@ -702,10 +704,18 @@ async function exportPageXlsx(page, labels = {}, sheetLabel = "Records") {
702
704
  }
703
705
  return XLSX.write(workbook, { type: "array", bookType: "xlsx", compression: true });
704
706
  }
707
+ function recordSourceKey(tableId) {
708
+ return `record:${tableId}`;
709
+ }
710
+ var SOURCE_KEY = /^(record|custom_record):([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
711
+ function recordSourceTable(key) {
712
+ const m = key ? SOURCE_KEY.exec(key) : null;
713
+ return m ? m[2] : null;
714
+ }
705
715
  function recordChangeTrigger(tableId, options = {}) {
706
716
  return {
707
717
  type: "event",
708
- entity_type: `custom_record:${tableId}`,
718
+ entity_type: recordSourceKey(tableId),
709
719
  table_id: tableId,
710
720
  ...options.actions && options.actions.length > 0 ? { actions: options.actions } : {},
711
721
  ...options.changedFields && options.changedFields.length > 0 ? { changed_fields: options.changedFields } : {}
@@ -829,6 +839,7 @@ function parseTableHome(raw) {
829
839
  destinations: destinations.filter((d) => !!d && typeof d === "object" && !!wordsOf(d.id)).map((d) => ({
830
840
  id: String(d.id),
831
841
  name: wordsOf(d.name) ?? "An organization",
842
+ slug: wordsOf(d.slug),
832
843
  role: wordsOf(d.role) ?? "member",
833
844
  ok: d.ok === true,
834
845
  why: wordsOf(d.why)