@ai-matrx/records 0.87.23 → 0.87.24

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.
@@ -2649,6 +2649,8 @@ type AutomationAction = {
2649
2649
  author: true;
2650
2650
  };
2651
2651
  text: string;
2652
+ subject?: string;
2653
+ link?: string;
2652
2654
  } | {
2653
2655
  do: "webhook";
2654
2656
  url: string;
@@ -2649,6 +2649,8 @@ type AutomationAction = {
2649
2649
  author: true;
2650
2650
  };
2651
2651
  text: string;
2652
+ subject?: string;
2653
+ link?: string;
2652
2654
  } | {
2653
2655
  do: "webhook";
2654
2656
  url: string;
@@ -6801,7 +6801,14 @@ async function ensureAppAutomations(client, def, specs, options = {}) {
6801
6801
  if (a.do === "set") actions.push({ do: "set", values: keyed(a.values, own.data, own.data, def.name) });
6802
6802
  else if (a.do === "notify") {
6803
6803
  const to = "field" in a.to ? { field: byId(own.data, a.to.field, def.name) } : a.to;
6804
- actions.push({ do: "notify", to, text: a.text.replace(/\{\{(\w+)\}\}/g, (_m, k) => `{{${byId(own.data, k, def.name)}}}`) });
6804
+ const words = (t) => t.replace(/\{\{(\w+)\}\}/g, (m, k) => k === "record_id" || k === "organization_id" ? m : `{{${byId(own.data, k, def.name)}}}`);
6805
+ actions.push({
6806
+ do: "notify",
6807
+ to,
6808
+ text: words(a.text),
6809
+ ...a.subject ? { subject: words(a.subject) } : {},
6810
+ ...a.link ? { link: words(a.link) } : {}
6811
+ });
6805
6812
  } else {
6806
6813
  const other = await ensureTypedTable(client, a.table, { organizationId: org.data });
6807
6814
  if (!other.ok) return other;