@burdenoff/microfe-planmagnet 2026.1014.1 → 2026.1031.1

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.
@@ -27,12 +27,15 @@
27
27
  * OFF in prod (`isChannelPostingEnabled()` in the engine) until Platform ticket BOFF-8240 ships: saving one
28
28
  * is refused server-side with "Posting to a chat channel from an automation is not available yet", so this
29
29
  * UI never lets it be selected or saved either (see `CHANNEL_POSTING_AVAILABLE` below).
30
+ * - `RUN_WORKFLOW` (OVL-09, BOFF-3532) hands the rule off to the shared workflow engine: it starts a run of an
31
+ * ACTIVE workflow from the workspace's workflow builder, with the PlanMagnet event as its trigger data. It
32
+ * needs no work item, so it is the action that makes sprint and release triggers useful. Everything beyond
33
+ * PlanMagnet's own record changes (calling other systems, branching, retries, AI steps) belongs there rather
34
+ * than in this builder.
30
35
  * - `SPRINT_STARTED`/`SPRINT_COMPLETED`/`RELEASE_RELEASED` carry NO target work item (`sprint.service.ts`/
31
- * `release.service.ts` never set `workItemId` on their `TriggerData`), so every work-item action — all five
32
- * above except `POST_TO_CHANNEL` — cannot run for them. Today that leaves such a rule able to do nothing
33
- * (the only action that *could* apply, `POST_TO_CHANNEL`, is itself gated off), so the builder below refuses
34
- * to offer work-item actions for these triggers and blocks Save entirely rather than let someone build a
35
- * rule that silently never fires anything.
36
+ * `release.service.ts` never set `workItemId` on their `TriggerData`), so every work-item action cannot run
37
+ * for them. The builder below offers only `RUN_WORKFLOW` for these triggers (`POST_TO_CHANNEL` is gated off)
38
+ * and blocks Save until the rule has one, rather than let someone build a rule that never does anything.
36
39
  */
37
40
  export declare const TRIGGER_TYPES: readonly ["WORK_ITEM_CREATED", "WORK_ITEM_STATUS_CHANGED", "WORK_ITEM_ASSIGNED", "SPRINT_STARTED", "SPRINT_COMPLETED", "RELEASE_RELEASED", "SCHEDULE", "WORK_ITEM_UPDATED", "MILESTONE_DUE", "WEBHOOK", "MANUAL"];
38
41
  export type TriggerType = (typeof TRIGGER_TYPES)[number];
@@ -61,12 +64,15 @@ export declare function triggerOptionSuffix(trigger: TriggerType): string;
61
64
  export declare function triggerHint(trigger: TriggerType): string | null;
62
65
  export declare const RULE_STATUSES: readonly ["ACTIVE", "PAUSED", "DISABLED", "ERROR"];
63
66
  export type RuleStatus = (typeof RULE_STATUSES)[number];
64
- export declare const ACTION_TYPES: readonly ["ASSIGN_TO_USER", "ADD_LABEL", "SET_STATUS", "SET_PRIORITY", "POST_COMMENT", "POST_TO_CHANNEL"];
67
+ export declare const ACTION_TYPES: readonly ["ASSIGN_TO_USER", "ADD_LABEL", "SET_STATUS", "SET_PRIORITY", "POST_COMMENT", "POST_TO_CHANNEL", "RUN_WORKFLOW"];
65
68
  export type ActionType = (typeof ACTION_TYPES)[number];
66
69
  export declare const ACTION_TYPE_LABEL: Record<ActionType, string>;
67
70
  /** Every action that mutates/comments on the triggering WORK ITEM (automation-engine.ts's `dispatchAction`: only
68
- * `POST_TO_CHANNEL` is handled without one). These are the actions `NO_WORK_ITEM_TRIGGER_TYPES` cannot run. */
71
+ * `POST_TO_CHANNEL` and `RUN_WORKFLOW` are handled without one). These are the actions `NO_WORK_ITEM_TRIGGER_TYPES` cannot run. */
69
72
  export declare const WORK_ITEM_ACTION_TYPES: ReadonlySet<ActionType>;
73
+ /** True when the rule declares actions and none of them targets a work item — "Run now" then needs no work
74
+ * item (mirrors `needsNoWorkItem` in the service's automation.service.ts). */
75
+ export declare function actionsNeedNoWorkItem(actions: RuleAction[]): boolean;
70
76
  /** `POST_TO_CHANNEL` is gated off (BOFF-8240) — mirrors `isChannelPostingEnabled()` in automation-engine.ts,
71
77
  * which this frontend has no way to read directly (it is a server env flag). Flip this only once that ships
72
78
  * AND the option below is meant to become selectable — until then it stays visible but disabled everywhere. */
@@ -179,9 +185,9 @@ export declare function templatePlaceholdersForTrigger(trigger: TriggerType): re
179
185
  /** Sample values for exactly the placeholders `templatePlaceholdersForTrigger` says apply to this trigger — any
180
186
  * other `{{...}}` in the template previews empty, matching what the real engine would do. */
181
187
  export declare function templateSampleValues(trigger: TriggerType): Record<string, string | undefined>;
182
- /** `null` when this trigger needs no explanation blocking Save; the reason string otherwise (same text as
183
- * `triggerHint` for a `NO_WORK_ITEM_TRIGGER_TYPES` trigger — the one case that blocks Save outright). */
184
- export declare function triggerSaveBlockReason(trigger: TriggerType): string | null;
188
+ /** `null` when the trigger and actions fit together; the reason string otherwise. A `NO_WORK_ITEM_TRIGGER_TYPES`
189
+ * trigger needs at least one `RUN_WORKFLOW` action and no work-item action (those could never run for it). */
190
+ export declare function triggerSaveBlockReason(trigger: TriggerType, actions?: RuleAction[]): string | null;
185
191
  /** Combines every reason a rule form cannot be saved yet: a trigger with no possible action, a `POST_TO_CHANNEL`
186
192
  * action while channel posting is gated off, or (for `SCHEDULE`) a not-yet-valid schedule window. `null` means
187
193
  * the form is save-able as far as these rules are concerned (the caller still checks name/project separately). */
@@ -36,7 +36,7 @@ function a(e) {
36
36
  return e === "SCHEDULE" || e === "MILESTONE_DUE" ? " (runs daily)" : i.has(e) ? " (no target work item)" : r.has(e) ? " (not yet automatic)" : e === "MANUAL" ? " (run manually)" : "";
37
37
  }
38
38
  function o(e) {
39
- return i.has(e) ? "This trigger fires automatically, but it has no target work item — only \"Post to a channel\" could apply, and that is not available yet (waiting on a platform change). A rule with this trigger cannot do anything right now, so it cannot be saved yet." : e === "SCHEDULE" ? "Runs once a day against every work item matching the statuses and staleness window below, and acts on each matching item at most once per day." : e === "WORK_ITEM_UPDATED" ? "Fires on any field edit, including a save that writes back exactly the values it already had — the dispatcher does not check whether anything actually changed. Fires alongside \"Work item status changed\" / \"Work item assigned\" on an edit that also touches status or assignee, not instead of them." : e === "MILESTONE_DUE" ? "Runs once a day for a rule whose Milestone's due date is today — same daily check as Schedule, but with no extra condition shape of its own: use the conditions below as you would for any other trigger." : r.has(e) ? "This trigger is saved but does not fire on its own yet — use Run now to run it against a work item." : e === "MANUAL" ? "Manual rules never fire on their own — use Run now to run this rule against a work item." : null;
39
+ return i.has(e) ? "This trigger fires automatically, but it has no target work item, so only \"Run a workflow\" can apply. Add one to save the rule." : e === "SCHEDULE" ? "Runs once a day against every work item matching the statuses and staleness window below, and acts on each matching item at most once per day." : e === "WORK_ITEM_UPDATED" ? "Fires on any field edit, including a save that writes back exactly the values it already had — the dispatcher does not check whether anything actually changed. Fires alongside \"Work item status changed\" / \"Work item assigned\" on an edit that also touches status or assignee, not instead of them." : e === "MILESTONE_DUE" ? "Runs once a day for a rule whose Milestone's due date is today — same daily check as Schedule, but with no extra condition shape of its own: use the conditions below as you would for any other trigger." : r.has(e) ? "This trigger is saved but does not fire on its own yet — use Run now to run it against a work item." : e === "MANUAL" ? "Manual rules never fire on their own — use Run now to run this rule against a work item." : null;
40
40
  }
41
41
  var s = [
42
42
  "ACTIVE",
@@ -49,21 +49,27 @@ var s = [
49
49
  "SET_STATUS",
50
50
  "SET_PRIORITY",
51
51
  "POST_COMMENT",
52
- "POST_TO_CHANNEL"
52
+ "POST_TO_CHANNEL",
53
+ "RUN_WORKFLOW"
53
54
  ], l = {
54
55
  ASSIGN_TO_USER: "Assign to user",
55
56
  ADD_LABEL: "Add label",
56
57
  SET_STATUS: "Set status",
57
58
  SET_PRIORITY: "Set priority",
58
59
  POST_COMMENT: "Post a comment",
59
- POST_TO_CHANNEL: "Post to a channel"
60
+ POST_TO_CHANNEL: "Post to a channel",
61
+ RUN_WORKFLOW: "Run a workflow"
60
62
  }, u = new Set([
61
63
  "ASSIGN_TO_USER",
62
64
  "ADD_LABEL",
63
65
  "SET_STATUS",
64
66
  "SET_PRIORITY",
65
67
  "POST_COMMENT"
66
- ]), d = "Not available yet — waiting on a platform change", f = "Posting to a chat channel from an automation is not available yet.", p = [
68
+ ]);
69
+ function d(e) {
70
+ return e.length > 0 && e.every((e) => !u.has(e.type) && c.includes(e.type));
71
+ }
72
+ var f = "Not available yet — waiting on a platform change", p = "Posting to a chat channel from an automation is not available yet.", m = [
67
73
  "eq",
68
74
  "neq",
69
75
  "in",
@@ -74,7 +80,7 @@ var s = [
74
80
  "lt",
75
81
  "lte",
76
82
  "exists"
77
- ], m = {
83
+ ], h = {
78
84
  eq: "is",
79
85
  neq: "is not",
80
86
  in: "is one of",
@@ -85,7 +91,7 @@ var s = [
85
91
  lt: "<",
86
92
  lte: "<=",
87
93
  exists: "is set"
88
- }, h = [
94
+ }, g = [
89
95
  "status",
90
96
  "previousStatus",
91
97
  "priority",
@@ -96,13 +102,13 @@ var s = [
96
102
  "sprintId",
97
103
  "projectId"
98
104
  ];
99
- function g(e) {
105
+ function _(e) {
100
106
  return e.filter((e) => e.value.trim() !== "").map((e) => ({
101
107
  type: e.type,
102
108
  value: e.value.trim()
103
109
  }));
104
110
  }
105
- function _(e) {
111
+ function v(e) {
106
112
  let t = e.filter((e) => e.field.trim() !== "");
107
113
  if (t.length !== 0) return t.map((e) => e.operator === "exists" ? {
108
114
  field: e.field.trim(),
@@ -117,26 +123,26 @@ function _(e) {
117
123
  value: e.value
118
124
  });
119
125
  }
120
- function v(e) {
126
+ function y(e) {
121
127
  return Array.isArray(e) ? e.filter((e) => !!e && typeof e == "object" && typeof e.field == "string").map((e) => ({
122
128
  field: e.field,
123
- operator: p.includes(e.operator) ? e.operator : "eq",
129
+ operator: m.includes(e.operator) ? e.operator : "eq",
124
130
  value: Array.isArray(e.value) ? e.value.join(", ") : e.value == null ? "" : String(e.value)
125
131
  })) : [];
126
132
  }
127
- function y(e) {
133
+ function b(e) {
128
134
  return Array.isArray(e) ? e.filter((e) => !!e && typeof e == "object" && typeof e.type == "string").map((e) => ({
129
135
  type: e.type,
130
136
  value: e.value == null ? "" : String(e.value)
131
137
  })) : [];
132
138
  }
133
- function b(e) {
139
+ function x(e) {
134
140
  let t = e.trim();
135
141
  if (!/^\d+$/.test(t)) return null;
136
142
  let n = Number(t);
137
143
  return n >= 1 ? n : null;
138
144
  }
139
- function x(e) {
145
+ function S(e) {
140
146
  if (!e || typeof e != "object") return {
141
147
  statuses: [],
142
148
  days: ""
@@ -147,18 +153,18 @@ function x(e) {
147
153
  days: typeof n == "number" && Number.isFinite(n) ? String(n) : ""
148
154
  };
149
155
  }
150
- function S(e, t) {
151
- let n = b(t);
156
+ function C(e, t) {
157
+ let n = x(t);
152
158
  if (!(e.length === 0 || n === null)) return {
153
159
  status: e,
154
160
  notUpdatedForDays: n
155
161
  };
156
162
  }
157
- function C(e, t) {
158
- return e.length > 0 && b(t) !== null;
163
+ function w(e, t) {
164
+ return e.length > 0 && x(t) !== null;
159
165
  }
160
- var w = 2e3, T = 2e3, E = /\{\{\s*([a-zA-Z][a-zA-Z0-9_.]*)\s*\}\}/g;
161
- function D(e) {
166
+ var T = 2e3, E = 2e3, D = /\{\{\s*([a-zA-Z][a-zA-Z0-9_.]*)\s*\}\}/g;
167
+ function O(e) {
162
168
  let t = "";
163
169
  for (let n of e) {
164
170
  let e = n.codePointAt(0) ?? 0;
@@ -166,14 +172,14 @@ function D(e) {
166
172
  }
167
173
  return t.trim();
168
174
  }
169
- function O(e, t, n) {
170
- let r = e.replace(E, (e, n) => {
175
+ function k(e, t, n) {
176
+ let r = e.replace(D, (e, n) => {
171
177
  let r = t[n];
172
- return r === void 0 ? "" : D(r);
178
+ return r === void 0 ? "" : O(r);
173
179
  }).trim();
174
180
  return r.length <= n ? r : `${r.slice(0, Math.max(0, n - 1))}…`;
175
181
  }
176
- var k = {
182
+ var A = {
177
183
  "workItem.key": {
178
184
  label: "Work item key",
179
185
  sample: "PM-42"
@@ -207,7 +213,7 @@ var k = {
207
213
  sample: "September release"
208
214
  }
209
215
  };
210
- function A(e) {
216
+ function j(e) {
211
217
  return e === "SPRINT_STARTED" || e === "SPRINT_COMPLETED" ? ["sprint.name", "actor"] : e === "RELEASE_RELEASED" ? [
212
218
  "release.version",
213
219
  "release.name",
@@ -229,19 +235,19 @@ function A(e) {
229
235
  "actor"
230
236
  ];
231
237
  }
232
- function j(e) {
238
+ function M(e) {
233
239
  let t = {};
234
- for (let n of A(e)) t[n] = k[n]?.sample;
240
+ for (let n of j(e)) t[n] = A[n]?.sample;
235
241
  return t;
236
242
  }
237
- function M(e) {
238
- return i.has(e) ? o(e) : null;
239
- }
240
- function N(e) {
241
- return M(e.triggerType) || (e.actions.some((e) => e.type === "POST_TO_CHANNEL") ? f : e.triggerType === "SCHEDULE" && !C(e.scheduleStatuses, e.scheduleNotUpdatedForDays) ? "Choose at least one status and a whole number of days (1 or more) before saving this schedule." : null);
243
+ function N(e, t = []) {
244
+ return i.has(e) ? t.some((e) => u.has(e.type)) ? "This trigger has no target work item, so work item actions cannot run for it. Remove them before saving." : t.some((e) => e.type === "RUN_WORKFLOW" && e.value.trim() !== "") ? null : o(e) : null;
242
245
  }
243
246
  function P(e) {
247
+ return N(e.triggerType, e.actions) || (e.actions.some((e) => e.type === "POST_TO_CHANNEL") ? p : e.actions.some((e) => e.type === "RUN_WORKFLOW" && e.value.trim() === "") ? "Choose the workflow each \"Run a workflow\" action should start." : e.triggerType === "SCHEDULE" && !w(e.scheduleStatuses, e.scheduleNotUpdatedForDays) ? "Choose at least one status and a whole number of days (1 or more) before saving this schedule." : null);
248
+ }
249
+ function F(e) {
244
250
  return e ? e.split("; ").map((e) => e.trim()).filter(Boolean) : [];
245
251
  }
246
252
  //#endregion
247
- export { c as ACTION_TYPES, l as ACTION_TYPE_LABEL, w as AUTOMATION_TEMPLATE_MAX_LENGTH, f as CHANNEL_POSTING_BLOCKED_MESSAGE, d as CHANNEL_POSTING_OPTION_REASON, h as CONDITION_FIELDS, p as CONDITION_OPERATORS, m as CONDITION_OPERATOR_LABEL, i as NO_WORK_ITEM_TRIGGER_TYPES, T as POST_COMMENT_MAX_RENDERED_LENGTH, s as RULE_STATUSES, k as TEMPLATE_PLACEHOLDER_INFO, e as TRIGGER_TYPES, t as TRIGGER_TYPE_LABEL, u as WORK_ITEM_ACTION_TYPES, y as actionsFromApi, g as actionsToApi, v as conditionsFromApi, _ as conditionsToApi, b as parseScheduleDays, O as renderTemplatePreview, N as saveBlockReason, x as scheduleConditionsFromApi, S as scheduleConditionsToApi, P as splitExecutionErrors, A as templatePlaceholdersForTrigger, j as templateSampleValues, o as triggerHint, a as triggerOptionSuffix, n as triggerTypeLabel };
253
+ export { c as ACTION_TYPES, l as ACTION_TYPE_LABEL, T as AUTOMATION_TEMPLATE_MAX_LENGTH, p as CHANNEL_POSTING_BLOCKED_MESSAGE, f as CHANNEL_POSTING_OPTION_REASON, g as CONDITION_FIELDS, m as CONDITION_OPERATORS, h as CONDITION_OPERATOR_LABEL, i as NO_WORK_ITEM_TRIGGER_TYPES, E as POST_COMMENT_MAX_RENDERED_LENGTH, s as RULE_STATUSES, A as TEMPLATE_PLACEHOLDER_INFO, e as TRIGGER_TYPES, t as TRIGGER_TYPE_LABEL, u as WORK_ITEM_ACTION_TYPES, b as actionsFromApi, d as actionsNeedNoWorkItem, _ as actionsToApi, y as conditionsFromApi, v as conditionsToApi, x as parseScheduleDays, k as renderTemplatePreview, P as saveBlockReason, S as scheduleConditionsFromApi, C as scheduleConditionsToApi, F as splitExecutionErrors, j as templatePlaceholdersForTrigger, M as templateSampleValues, o as triggerHint, a as triggerOptionSuffix, N as triggerSaveBlockReason, n as triggerTypeLabel };
@@ -16,8 +16,10 @@ export declare function AutomationRuleDeleteButton({ ruleId, name }: {
16
16
  }): import("react/jsx-runtime").JSX.Element;
17
17
  /** Runs a rule against one chosen work item — works for a rule of ANY trigger type, including the ones that
18
18
  * cannot fire on their own (see automationRuleTypes.ts). Always records an outcome, including a non-match. */
19
- export declare function RunAutomationRuleDialog({ ruleId, projectId, }: {
19
+ export declare function RunAutomationRuleDialog({ ruleId, projectId, needsWorkItem, }: {
20
20
  ruleId: string;
21
21
  projectId?: string;
22
+ /** False when every action of the rule needs no work item (RUN_WORKFLOW, OVL-09) — the run then names none. */
23
+ needsWorkItem?: boolean;
22
24
  }): import("react/jsx-runtime").JSX.Element;
23
25
  //# sourceMappingURL=AutomationRuleControls.d.ts.map
@@ -94,27 +94,27 @@ var M = {
94
94
  FAILURE: "destructive",
95
95
  SKIPPED: "secondary"
96
96
  };
97
- function N({ ruleId: e, projectId: r }) {
98
- let [a, d] = l(!1), [f, T] = l(""), [D, O] = l(null), [A, j] = l(null), [N, { loading: P }] = p(k, {
97
+ function N({ ruleId: e, projectId: r, needsWorkItem: a = !0 }) {
98
+ let [d, f] = l(!1), [T, D] = l(""), [O, A] = l(null), [j, N] = l(null), [P, { loading: F }] = p(k, {
99
99
  refetchQueries: ["AutomationExecutionsForRule", ...E],
100
100
  awaitRefetchQueries: !0
101
- }), F = async () => {
102
- if (f) {
103
- O(null), j(null);
101
+ }), I = async () => {
102
+ if (!(a && !T)) {
103
+ A(null), N(null);
104
104
  try {
105
- j((await i(N({ variables: {
105
+ N((await i(P({ variables: {
106
106
  id: e,
107
- triggerData: { workItemId: f }
107
+ triggerData: T ? { workItemId: T } : {}
108
108
  } }))).data?.planmagnetExecuteAutomationRule ?? null);
109
109
  } catch (e) {
110
- O(t(e) ? "Your role can view automation rules but not run them." : n(e, "The rule could not be run."));
110
+ A(t(e) ? "Your role can view automation rules but not run them." : n(e, "The rule could not be run."));
111
111
  }
112
112
  }
113
113
  };
114
114
  return /* @__PURE__ */ h(v, {
115
- open: a,
115
+ open: d,
116
116
  onOpenChange: (e) => {
117
- d(e), e && (T(""), O(null), j(null));
117
+ f(e), e && (D(""), A(null), N(null));
118
118
  },
119
119
  children: [/* @__PURE__ */ m(w, {
120
120
  asChild: !0,
@@ -134,27 +134,27 @@ function N({ ruleId: e, projectId: r }) {
134
134
  /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("label", {
135
135
  htmlFor: "automation-run-work-item",
136
136
  className: "text-sm font-medium",
137
- children: "Work item"
137
+ children: a ? "Work item" : "Work item (optional)"
138
138
  }), /* @__PURE__ */ m("div", {
139
139
  className: "mt-1",
140
140
  children: /* @__PURE__ */ m(s, {
141
141
  id: "automation-run-work-item",
142
142
  projectId: r,
143
- value: f,
144
- onChange: T
143
+ value: T,
144
+ onChange: D
145
145
  })
146
146
  })] }),
147
- D && /* @__PURE__ */ m(o, { message: D }),
148
- A && /* @__PURE__ */ h("div", {
147
+ O && /* @__PURE__ */ m(o, { message: O }),
148
+ j && /* @__PURE__ */ h("div", {
149
149
  role: "status",
150
150
  className: "rounded-md border p-3 text-sm space-y-1",
151
151
  children: [/* @__PURE__ */ m(g, {
152
- variant: M[A.status] ?? "secondary",
153
- children: A.status.toLowerCase().replace("_", " ")
154
- }), A.errorMessage && /* @__PURE__ */ m("ul", {
152
+ variant: M[j.status] ?? "secondary",
153
+ children: j.status.toLowerCase().replace("_", " ")
154
+ }), j.errorMessage && /* @__PURE__ */ m("ul", {
155
155
  className: "space-y-0.5",
156
- children: c(A.errorMessage).map((e, t) => /* @__PURE__ */ m("li", {
157
- className: A.status === "SUCCESS" ? "text-muted-foreground" : "text-destructive",
156
+ children: c(j.errorMessage).map((e, t) => /* @__PURE__ */ m("li", {
157
+ className: j.status === "SUCCESS" ? "text-muted-foreground" : "text-destructive",
158
158
  children: e
159
159
  }, t))
160
160
  })]
@@ -162,10 +162,10 @@ function N({ ruleId: e, projectId: r }) {
162
162
  ]
163
163
  }),
164
164
  /* @__PURE__ */ m(x, { children: /* @__PURE__ */ m(_, {
165
- onClick: () => void F(),
166
- disabled: !f || P,
165
+ onClick: () => void I(),
166
+ disabled: a && !T || F,
167
167
  "data-testid": "automation-run-submit",
168
- children: P ? "Running…" : "Run"
168
+ children: F ? "Running…" : "Run"
169
169
  }) })
170
170
  ]
171
171
  })]
@@ -3,18 +3,18 @@ import { isForbidden as t, mutationErrorMessage as n } from "../utils/graphqlErr
3
3
  import { throwOnError as r } from "../utils/mutationResult.js";
4
4
  import { ErrorLine as i } from "../controls/ConfirmButton.js";
5
5
  import { useEntityId as a } from "../hooks/useEntityId.js";
6
- import { actionsFromApi as o, actionsToApi as s, conditionsFromApi as c, conditionsToApi as l, saveBlockReason as u, scheduleConditionsFromApi as d, scheduleConditionsToApi as f } from "../automation/automationRuleTypes.js";
7
- import { AUTOMATION_RULE_QUERIES as p, AutomationRuleDeleteButton as m, AutomationRuleStatusSwitch as h, RunAutomationRuleDialog as g } from "../controls/AutomationRuleControls.js";
8
- import { AutomationExecutionsPanel as _ } from "../automation/AutomationExecutionsPanel.js";
9
- import { AutomationRuleFields as v } from "../automation/AutomationRuleFields.js";
10
- import { useState as y } from "react";
11
- import { Bot as b, History as x, Save as S } from "lucide-react";
12
- import { gql as C } from "@apollo/client";
13
- import { useMutation as w, useQuery as T } from "@apollo/client/react";
14
- import { jsx as E, jsxs as D } from "react/jsx-runtime";
15
- import { Button as O, Card as k, CardContent as A, CardHeader as j, CardTitle as M } from "@burdenoff/fe-libs/ui";
6
+ import { actionsFromApi as o, actionsNeedNoWorkItem as s, actionsToApi as c, conditionsFromApi as l, conditionsToApi as u, saveBlockReason as d, scheduleConditionsFromApi as f, scheduleConditionsToApi as p } from "../automation/automationRuleTypes.js";
7
+ import { AUTOMATION_RULE_QUERIES as m, AutomationRuleDeleteButton as h, AutomationRuleStatusSwitch as g, RunAutomationRuleDialog as _ } from "../controls/AutomationRuleControls.js";
8
+ import { AutomationExecutionsPanel as v } from "../automation/AutomationExecutionsPanel.js";
9
+ import { AutomationRuleFields as y } from "../automation/AutomationRuleFields.js";
10
+ import { useState as b } from "react";
11
+ import { Bot as x, History as S, Save as C } from "lucide-react";
12
+ import { gql as w } from "@apollo/client";
13
+ import { useMutation as T, useQuery as E } from "@apollo/client/react";
14
+ import { jsx as D, jsxs as O } from "react/jsx-runtime";
15
+ import { Button as k, Card as A, CardContent as j, CardHeader as M, CardTitle as N } from "@burdenoff/fe-libs/ui";
16
16
  //#region src/planmagnet/pages/AutomationAutomationRuleDetailPagePage.tsx
17
- var N = C`
17
+ var P = w`
18
18
  query GetAutomationRule($id: ID!) {
19
19
  planmagnetAutomationRule(id: $id) {
20
20
  id
@@ -33,7 +33,7 @@ var N = C`
33
33
  }
34
34
  }
35
35
  }
36
- `, P = C`
36
+ `, F = w`
37
37
  mutation UpdateAutomationRule($id: ID!, $input: PlanmagnetUpdateAutomationRuleInput!) {
38
38
  planmagnetUpdateAutomationRule(id: $id, input: $input) {
39
39
  id
@@ -45,134 +45,135 @@ var N = C`
45
45
  }
46
46
  }
47
47
  `;
48
- function F(e) {
49
- let t = d(e.conditions);
48
+ function I(e) {
49
+ let t = f(e.conditions);
50
50
  return {
51
51
  name: e.name,
52
52
  description: e.description ?? "",
53
53
  projectId: e.projectId ?? "",
54
54
  triggerType: e.triggerType,
55
- conditions: c(e.conditions),
55
+ conditions: l(e.conditions),
56
56
  scheduleStatuses: t.statuses,
57
57
  scheduleNotUpdatedForDays: t.days,
58
58
  actions: o(e.actions)
59
59
  };
60
60
  }
61
- function I(e) {
62
- return e.triggerType === "SCHEDULE" ? f(e.scheduleStatuses, e.scheduleNotUpdatedForDays) ?? null : l(e.conditions) ?? null;
61
+ function L(e) {
62
+ return e.triggerType === "SCHEDULE" ? p(e.scheduleStatuses, e.scheduleNotUpdatedForDays) ?? null : u(e.conditions) ?? null;
63
63
  }
64
- function L() {
65
- let o = a(), { workspaceId: c } = e(), { data: l, loading: d, error: f } = T(N, {
66
- variables: { id: o ?? "" },
67
- skip: !o,
64
+ function R() {
65
+ let l = a(), { workspaceId: u } = e(), { data: f, loading: p, error: w } = E(P, {
66
+ variables: { id: l ?? "" },
67
+ skip: !l,
68
68
  fetchPolicy: "cache-and-network"
69
- }), [C, { loading: L }] = w(P, { refetchQueries: p }), [R, z] = y(null), [B, V] = y(!1), H = l?.planmagnetAutomationRule ?? null, [U, W] = y(null), [G, K] = y(null);
70
- if (H && G !== H.id && (K(H.id), W(F(H))), !o) return /* @__PURE__ */ E("div", {
69
+ }), [R, { loading: z }] = T(F, { refetchQueries: m }), [B, V] = b(null), [H, U] = b(!1), W = f?.planmagnetAutomationRule ?? null, [G, K] = b(null), [q, J] = b(null);
70
+ if (W && q !== W.id && (J(W.id), K(I(W))), !l) return /* @__PURE__ */ D("div", {
71
71
  className: "p-6 text-muted-foreground",
72
72
  children: "No rule selected. Open one from the list."
73
73
  });
74
- if (d && !l) return /* @__PURE__ */ E("div", {
74
+ if (p && !f) return /* @__PURE__ */ D("div", {
75
75
  className: "flex items-center justify-center p-12",
76
- children: /* @__PURE__ */ E("div", { className: "animate-spin h-8 w-8 border-2 border-primary border-t-transparent rounded-full" })
76
+ children: /* @__PURE__ */ D("div", { className: "animate-spin h-8 w-8 border-2 border-primary border-t-transparent rounded-full" })
77
77
  });
78
- if (f) return /* @__PURE__ */ D("div", {
78
+ if (w) return /* @__PURE__ */ O("div", {
79
79
  className: "p-6 text-destructive",
80
- children: ["Automation rule could not be loaded: ", f.message]
80
+ children: ["Automation rule could not be loaded: ", w.message]
81
81
  });
82
- if (!H || !U) return /* @__PURE__ */ E("div", {
82
+ if (!W || !G) return /* @__PURE__ */ D("div", {
83
83
  className: "p-6 text-muted-foreground",
84
84
  children: "Automation rule not found."
85
85
  });
86
- let q = u(U), J = async () => {
87
- if (q) return;
88
- z(null), V(!1);
89
- let e = F(H), i = {};
90
- U.name.trim() !== e.name && (i.name = U.name.trim()), U.description.trim() !== e.description.trim() && (i.description = U.description.trim() || null), U.triggerType !== e.triggerType && (i.triggerType = U.triggerType);
91
- let a = I(U);
92
- JSON.stringify(a) !== JSON.stringify(I(e)) && (i.conditions = a);
93
- let o = s(U.actions);
94
- if (JSON.stringify(o) !== JSON.stringify(s(e.actions)) && (i.actions = o), Object.keys(i).length === 0) {
95
- V(!0);
86
+ let Y = d(G), X = async () => {
87
+ if (Y) return;
88
+ V(null), U(!1);
89
+ let e = I(W), i = {};
90
+ G.name.trim() !== e.name && (i.name = G.name.trim()), G.description.trim() !== e.description.trim() && (i.description = G.description.trim() || null), G.triggerType !== e.triggerType && (i.triggerType = G.triggerType);
91
+ let a = L(G);
92
+ JSON.stringify(a) !== JSON.stringify(L(e)) && (i.conditions = a);
93
+ let o = c(G.actions);
94
+ if (JSON.stringify(o) !== JSON.stringify(c(e.actions)) && (i.actions = o), Object.keys(i).length === 0) {
95
+ U(!0);
96
96
  return;
97
97
  }
98
98
  try {
99
- await r(C({ variables: {
100
- id: H.id,
99
+ await r(R({ variables: {
100
+ id: W.id,
101
101
  input: i
102
- } })), V(!0);
102
+ } })), U(!0);
103
103
  } catch (e) {
104
- z(t(e) ? "Your role can view automation rules but not change them." : n(e, "The rule could not be saved."));
104
+ V(t(e) ? "Your role can view automation rules but not change them." : n(e, "The rule could not be saved."));
105
105
  }
106
106
  };
107
- return /* @__PURE__ */ D("div", {
107
+ return /* @__PURE__ */ O("div", {
108
108
  className: "space-y-6 p-6 max-w-3xl",
109
109
  children: [
110
- /* @__PURE__ */ D("div", {
110
+ /* @__PURE__ */ O("div", {
111
111
  className: "flex flex-wrap items-start justify-between gap-3",
112
- children: [/* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("h1", {
112
+ children: [/* @__PURE__ */ O("div", { children: [/* @__PURE__ */ D("h1", {
113
113
  className: "text-2xl font-semibold",
114
- children: H.name
115
- }), /* @__PURE__ */ E("p", {
114
+ children: W.name
115
+ }), /* @__PURE__ */ D("p", {
116
116
  className: "text-sm text-muted-foreground",
117
- children: H.project?.name ?? "Unknown project"
118
- })] }), /* @__PURE__ */ E("div", {
117
+ children: W.project?.name ?? "Unknown project"
118
+ })] }), /* @__PURE__ */ D("div", {
119
119
  className: "flex flex-col items-end gap-2",
120
- children: /* @__PURE__ */ D("div", {
120
+ children: /* @__PURE__ */ O("div", {
121
121
  className: "flex items-center gap-2",
122
122
  children: [
123
- /* @__PURE__ */ E(g, {
124
- ruleId: H.id,
125
- projectId: H.projectId ?? void 0
123
+ /* @__PURE__ */ D(_, {
124
+ ruleId: W.id,
125
+ projectId: W.projectId ?? void 0,
126
+ needsWorkItem: !s(o(W.actions))
126
127
  }),
127
- /* @__PURE__ */ E(h, {
128
- ruleId: H.id,
129
- status: H.status
128
+ /* @__PURE__ */ D(g, {
129
+ ruleId: W.id,
130
+ status: W.status
130
131
  }),
131
- /* @__PURE__ */ E(m, {
132
- ruleId: H.id,
133
- name: H.name
132
+ /* @__PURE__ */ D(h, {
133
+ ruleId: W.id,
134
+ name: W.name
134
135
  })
135
136
  ]
136
137
  })
137
138
  })]
138
139
  }),
139
- R && /* @__PURE__ */ E(i, { message: R }),
140
- B && !R && /* @__PURE__ */ E("p", {
140
+ B && /* @__PURE__ */ D(i, { message: B }),
141
+ H && !B && /* @__PURE__ */ D("p", {
141
142
  className: "text-sm text-muted-foreground",
142
143
  children: "Saved."
143
144
  }),
144
- /* @__PURE__ */ D(k, { children: [/* @__PURE__ */ E(j, { children: /* @__PURE__ */ D(M, {
145
+ /* @__PURE__ */ O(A, { children: [/* @__PURE__ */ D(M, { children: /* @__PURE__ */ O(N, {
145
146
  className: "flex items-center gap-2",
146
- children: [/* @__PURE__ */ E(b, { className: "h-4 w-4" }), "Rule details"]
147
- }) }), /* @__PURE__ */ D(A, {
147
+ children: [/* @__PURE__ */ D(x, { className: "h-4 w-4" }), "Rule details"]
148
+ }) }), /* @__PURE__ */ O(j, {
148
149
  className: "space-y-4",
149
- children: [/* @__PURE__ */ E(v, {
150
- form: U,
150
+ children: [/* @__PURE__ */ D(y, {
151
+ form: G,
151
152
  onChange: (e) => {
152
- W(e), V(!1);
153
+ K(e), U(!1);
153
154
  },
154
155
  projectLocked: !0
155
- }), /* @__PURE__ */ E("div", {
156
+ }), /* @__PURE__ */ D("div", {
156
157
  className: "flex justify-end",
157
- children: /* @__PURE__ */ D(O, {
158
+ children: /* @__PURE__ */ O(k, {
158
159
  size: "sm",
159
- onClick: () => void J(),
160
- disabled: L || !!q,
161
- title: q ?? void 0,
160
+ onClick: () => void X(),
161
+ disabled: z || !!Y,
162
+ title: Y ?? void 0,
162
163
  "data-testid": "automation-save",
163
- children: [/* @__PURE__ */ E(S, { className: "mr-1 h-4 w-4" }), L ? "Saving…" : "Save changes"]
164
+ children: [/* @__PURE__ */ D(C, { className: "mr-1 h-4 w-4" }), z ? "Saving…" : "Save changes"]
164
165
  })
165
166
  })]
166
167
  })] }),
167
- /* @__PURE__ */ D(k, { children: [/* @__PURE__ */ E(j, { children: /* @__PURE__ */ D(M, {
168
+ /* @__PURE__ */ O(A, { children: [/* @__PURE__ */ D(M, { children: /* @__PURE__ */ O(N, {
168
169
  className: "flex items-center gap-2",
169
- children: [/* @__PURE__ */ E(x, { className: "h-4 w-4" }), "Recent executions"]
170
- }) }), /* @__PURE__ */ E(A, { children: /* @__PURE__ */ E(_, {
171
- workspaceId: c,
172
- ruleId: H.id
170
+ children: [/* @__PURE__ */ D(S, { className: "h-4 w-4" }), "Recent executions"]
171
+ }) }), /* @__PURE__ */ D(j, { children: /* @__PURE__ */ D(v, {
172
+ workspaceId: u,
173
+ ruleId: W.id
173
174
  }) })] })
174
175
  ]
175
176
  });
176
177
  }
177
178
  //#endregion
178
- export { L as AutomationAutomationRuleDetailPagePage };
179
+ export { R as AutomationAutomationRuleDetailPagePage };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-planmagnet",
3
- "version": "2026.1014.1",
3
+ "version": "2026.1031.1",
4
4
  "description": "Burdenoff PlanMagnet Microfrontend",
5
5
  "type": "module",
6
6
  "files": [
@@ -109,6 +109,7 @@
109
109
  "access": "public"
110
110
  },
111
111
  "overrides": {
112
+ "image-size": "^2.0.3",
112
113
  "lodash": ">=4.17.21",
113
114
  "lodash-es": ">=4.17.21",
114
115
  "dompurify": ">=3.3.4",