@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.
@@ -10124,6 +10124,8 @@ type AutomationAction = {
10124
10124
  author: true;
10125
10125
  };
10126
10126
  text: string;
10127
+ subject?: string;
10128
+ link?: string;
10127
10129
  } | {
10128
10130
  do: "webhook";
10129
10131
  url: string;
@@ -16508,6 +16510,10 @@ interface AppAutomationSpec {
16508
16510
  author: true;
16509
16511
  };
16510
16512
  text: string;
16513
+ /** The notice's subject line (in-app and email); defaults to the automation's name. Same `{{key}}` words as `text`. */
16514
+ subject?: string;
16515
+ /** Where the notice opens: a path (`/hr/performance/{{record_id}}?org={{organization_id}}`) or a URL field's `{{key}}`. */
16516
+ link?: string;
16511
16517
  }>;
16512
16518
  }
16513
16519
  /**
@@ -10124,6 +10124,8 @@ type AutomationAction = {
10124
10124
  author: true;
10125
10125
  };
10126
10126
  text: string;
10127
+ subject?: string;
10128
+ link?: string;
10127
10129
  } | {
10128
10130
  do: "webhook";
10129
10131
  url: string;
@@ -16508,6 +16510,10 @@ interface AppAutomationSpec {
16508
16510
  author: true;
16509
16511
  };
16510
16512
  text: string;
16513
+ /** The notice's subject line (in-app and email); defaults to the automation's name. Same `{{key}}` words as `text`. */
16514
+ subject?: string;
16515
+ /** Where the notice opens: a path (`/hr/performance/{{record_id}}?org={{organization_id}}`) or a URL field's `{{key}}`. */
16516
+ link?: string;
16511
16517
  }>;
16512
16518
  }
16513
16519
  /**
@@ -9343,7 +9343,14 @@ async function ensureAppAutomations(client, def, specs, options = {}) {
9343
9343
  if (a.do === "set") actions.push({ do: "set", values: keyed(a.values, own.data, own.data, def.name) });
9344
9344
  else if (a.do === "notify") {
9345
9345
  const to = "field" in a.to ? { field: byId(own.data, a.to.field, def.name) } : a.to;
9346
- actions.push({ do: "notify", to, text: a.text.replace(/\{\{(\w+)\}\}/g, (_m, k) => `{{${byId(own.data, k, def.name)}}}`) });
9346
+ const words = (t) => t.replace(/\{\{(\w+)\}\}/g, (m, k) => k === "record_id" || k === "organization_id" ? m : `{{${byId(own.data, k, def.name)}}}`);
9347
+ actions.push({
9348
+ do: "notify",
9349
+ to,
9350
+ text: words(a.text),
9351
+ ...a.subject ? { subject: words(a.subject) } : {},
9352
+ ...a.link ? { link: words(a.link) } : {}
9353
+ });
9347
9354
  } else {
9348
9355
  const other = await ensureTypedTable(client, a.table, { organizationId: org.data });
9349
9356
  if (!other.ok) return other;