@powerhousedao/workflow 6.2.3-dev.83 → 6.2.3-dev.84

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 (73) hide show
  1. package/README.md +3 -1
  2. package/dist/browser/{BlockSelector-DHVzUGjW.js → BlockSelector-CtoMNZ9A.js} +4 -3
  3. package/dist/browser/BlockSelector-CtoMNZ9A.js.map +1 -0
  4. package/dist/browser/{connection-form-D2qAEHsl.js → connection-form-_H-tP2Vk.js} +2 -2
  5. package/dist/browser/{connection-form-D2qAEHsl.js.map → connection-form-_H-tP2Vk.js.map} +1 -1
  6. package/dist/browser/{data-tree-BOuPR-2J.js → data-tree-CjWQllC7.js} +2 -2
  7. package/dist/browser/{data-tree-BOuPR-2J.js.map → data-tree-CjWQllC7.js.map} +1 -1
  8. package/dist/browser/{editor-BD-5ClkW.js → editor-B1AzXxaF.js} +207 -33
  9. package/dist/browser/editor-B1AzXxaF.js.map +1 -0
  10. package/dist/browser/{editor--59WtNaj.js → editor-B9069RYZ.js} +9 -2535
  11. package/dist/browser/editor-B9069RYZ.js.map +1 -0
  12. package/dist/browser/{editor-0XPrGeLT.js → editor-DgdTF2up.js} +3 -3
  13. package/dist/browser/{editor-0XPrGeLT.js.map → editor-DgdTF2up.js.map} +1 -1
  14. package/dist/browser/editors/connection-editor/module.js +1 -1
  15. package/dist/browser/editors/workflow-editor/module.js +1 -1
  16. package/dist/browser/editors/workflow-studio/module.js +1 -1
  17. package/dist/browser/trigger-text-BgpPIXEJ.js +3040 -0
  18. package/dist/browser/trigger-text-BgpPIXEJ.js.map +1 -0
  19. package/dist/node/{BlockSelector-D2UAnFpN.mjs → BlockSelector-CbdgYJfp.mjs} +5 -4
  20. package/dist/node/BlockSelector-CbdgYJfp.mjs.map +1 -0
  21. package/dist/node/{connection-form-Btmejfyn.mjs → connection-form-DPbyrUIm.mjs} +3 -3
  22. package/dist/node/{connection-form-Btmejfyn.mjs.map → connection-form-DPbyrUIm.mjs.map} +1 -1
  23. package/dist/node/{data-tree-rZiK2Ev-.mjs → data-tree-CXa2kEuD.mjs} +2 -2
  24. package/dist/node/{data-tree-rZiK2Ev-.mjs.map → data-tree-CXa2kEuD.mjs.map} +1 -1
  25. package/dist/node/{editor-U6trS0QO.mjs → editor-BGz1Ljdk.mjs} +9 -2534
  26. package/dist/node/editor-BGz1Ljdk.mjs.map +1 -0
  27. package/dist/node/{editor-C_eWGGi8.mjs → editor-D3MlbYBN.mjs} +207 -34
  28. package/dist/node/editor-D3MlbYBN.mjs.map +1 -0
  29. package/dist/node/{editor-ChJMxbeM.mjs → editor-DzxyNgYk.mjs} +4 -4
  30. package/dist/node/{editor-ChJMxbeM.mjs.map → editor-DzxyNgYk.mjs.map} +1 -1
  31. package/dist/node/editors/connection-editor/module.mjs +1 -1
  32. package/dist/node/editors/runtime/index.mjs +1 -1
  33. package/dist/node/editors/workflow-editor/module.mjs +1 -1
  34. package/dist/node/editors/workflow-studio/module.mjs +1 -1
  35. package/dist/node/index.mjs +1 -1
  36. package/dist/node/pieces/ai/descriptor.json +1 -1
  37. package/dist/node/pieces/ai/package.json +1 -1
  38. package/dist/node/pieces/reactor/descriptor.json +1 -1
  39. package/dist/node/pieces/reactor/package.json +1 -1
  40. package/dist/node/{runtime-queries-CmrHBPRw.mjs → runtime-queries-CatdoDey.mjs} +155 -4
  41. package/dist/node/runtime-queries-CatdoDey.mjs.map +1 -0
  42. package/dist/node/trigger-text-yNCaB6pd.mjs +3040 -0
  43. package/dist/node/trigger-text-yNCaB6pd.mjs.map +1 -0
  44. package/dist/powerhouse.manifest.json +2 -2
  45. package/dist/style.css +1 -1
  46. package/dist/types/editors/shared/controls.d.ts.map +1 -1
  47. package/dist/types/editors/workflow-editor/ui/manual-inputs.d.ts +7 -0
  48. package/dist/types/editors/workflow-editor/ui/manual-inputs.d.ts.map +1 -0
  49. package/dist/types/editors/workflow-editor/ui/manual-inputs.test.d.ts +2 -0
  50. package/dist/types/editors/workflow-editor/ui/manual-inputs.test.d.ts.map +1 -0
  51. package/dist/types/editors/workflow-studio/components/RunDialog.d.ts +7 -0
  52. package/dist/types/editors/workflow-studio/components/RunDialog.d.ts.map +1 -0
  53. package/dist/types/editors/workflow-studio/components/RunsView.d.ts +3 -1
  54. package/dist/types/editors/workflow-studio/components/RunsView.d.ts.map +1 -1
  55. package/dist/types/editors/workflow-studio/components/WorkflowStudio.d.ts.map +1 -1
  56. package/dist/types/editors/workflow-studio/components/run-dialog.test.d.ts +2 -0
  57. package/dist/types/editors/workflow-studio/components/run-dialog.test.d.ts.map +1 -0
  58. package/dist/types/test/graphql-server.d.ts +9 -0
  59. package/dist/types/test/graphql-server.d.ts.map +1 -0
  60. package/dist/types/test/ui/manual-inputs.spec.d.ts +2 -0
  61. package/dist/types/test/ui/manual-inputs.spec.d.ts.map +1 -0
  62. package/package.json +9 -9
  63. package/dist/browser/BlockSelector-DHVzUGjW.js.map +0 -1
  64. package/dist/browser/editor--59WtNaj.js.map +0 -1
  65. package/dist/browser/editor-BD-5ClkW.js.map +0 -1
  66. package/dist/browser/trigger-text-Co-dn9x-.js +0 -513
  67. package/dist/browser/trigger-text-Co-dn9x-.js.map +0 -1
  68. package/dist/node/BlockSelector-D2UAnFpN.mjs.map +0 -1
  69. package/dist/node/editor-C_eWGGi8.mjs.map +0 -1
  70. package/dist/node/editor-U6trS0QO.mjs.map +0 -1
  71. package/dist/node/runtime-queries-CmrHBPRw.mjs.map +0 -1
  72. package/dist/node/trigger-text-CAiRCG2X.mjs +0 -512
  73. package/dist/node/trigger-text-CAiRCG2X.mjs.map +0 -1
@@ -1,513 +0,0 @@
1
- import { A as MANUAL_TRIGGER, F as WEBHOOK_TRIGGER, M as SCHEDULE_TRIGGER } from "./runtime-queries-LAcyniYz.js";
2
- import { At as IconButton, Et as Button, Ft as Toggle, It as Tooltip, f as blockMeta } from "./BlockSelector-DHVzUGjW.js";
3
- import { useSetSelectedNode } from "@powerhousedao/reactor-browser";
4
- import { blockKey } from "@powerhousedao/pieces-framework/block-type";
5
- import { DOCUMENT_REF_KEY, documentRefsIn, isDocumentRefMarker, parseScheduleConfig } from "@powerhousedao/pieces-framework/workflow";
6
- import { Suspense, lazy, useState } from "react";
7
- import { jsx, jsxs } from "react/jsx-runtime";
8
- //#region editors/workflow-editor/ui/model.ts
9
- const VARIABLES_VIEW = "__variables";
10
- /** Query params of the editor's view: the open panel and its tab. */
11
- const STEP_PARAM = "step";
12
- function hasDraftChanges(model) {
13
- return !model.published || model.published.version !== model.version;
14
- }
15
- function uniqueStepKey(taken, label) {
16
- const base = label.toLowerCase().replaceAll(/[^a-z0-9]+/g, "_").replaceAll(/^_+|_+$/g, "") || "step";
17
- const keys = new Set(taken);
18
- let key = base;
19
- let suffix = 2;
20
- while (keys.has(key)) key = `${base}_${suffix++}`;
21
- return key;
22
- }
23
- //#endregion
24
- //#region editors/workflow-editor/ui/PublishControls.tsx
25
- function blockedReason(readiness) {
26
- if (!readiness.hasTrigger) return "Add a trigger first";
27
- if (readiness.firstIncomplete) return "You have incomplete steps";
28
- return "Checking the steps…";
29
- }
30
- function usePublish(callbacks) {
31
- const [publishing, setPublishing] = useState(false);
32
- const [error, setError] = useState(null);
33
- const publish = () => {
34
- if (publishing) return;
35
- setPublishing(true);
36
- setError(null);
37
- callbacks.publish().catch((cause) => setError(cause instanceof Error ? cause.message : String(cause))).finally(() => setPublishing(false));
38
- };
39
- return {
40
- publishing,
41
- error,
42
- publish
43
- };
44
- }
45
- function PublishButton(props) {
46
- const { model, readiness } = props;
47
- if (props.signIn?.required) return /* @__PURE__ */ jsx(Tooltip, {
48
- content: "This Switchboard enforces document permissions, so a publish must be signed",
49
- children: /* @__PURE__ */ jsx(Button, {
50
- size: props.size ?? "sm",
51
- variant: "primary",
52
- disabled: props.signIn.pending,
53
- onClick: props.signIn.login,
54
- children: "Sign in to publish"
55
- })
56
- });
57
- const incomplete = !readiness.ready;
58
- const changes = hasDraftChanges(model);
59
- const target = readiness.firstIncomplete;
60
- const select = () => {
61
- if (target) props.onSelect(target);
62
- };
63
- return /* @__PURE__ */ jsx(Tooltip, {
64
- enabled: incomplete,
65
- content: /* @__PURE__ */ jsx("button", {
66
- type: "button",
67
- className: "font-medium text-wf-warn hover:underline",
68
- onClick: select,
69
- children: blockedReason(readiness)
70
- }),
71
- children: /* @__PURE__ */ jsx("span", {
72
- className: "inline-flex",
73
- onClick: incomplete ? select : void 0,
74
- children: /* @__PURE__ */ jsx(Button, {
75
- size: props.size ?? "sm",
76
- variant: "primary",
77
- disabled: incomplete || !changes || props.publishing,
78
- title: !changes && !incomplete ? "No unpublished changes" : void 0,
79
- onClick: props.onPublish,
80
- children: props.publishing ? "Publishing…" : "Publish"
81
- })
82
- })
83
- });
84
- }
85
- function PublishState(props) {
86
- const draft = hasDraftChanges(props.model);
87
- return /* @__PURE__ */ jsxs("span", {
88
- className: "flex shrink-0 items-center gap-1.5 whitespace-nowrap text-xs text-muted-foreground",
89
- title: props.model.published ? `Published ${new Date(props.model.published.publishedAt).toLocaleString()}` : "Never published",
90
- children: [
91
- /* @__PURE__ */ jsx("span", {
92
- "aria-hidden": true,
93
- className: `h-2 w-2 rounded-full ${draft ? "bg-wf-warn" : "bg-wf-ok"}`
94
- }),
95
- /* @__PURE__ */ jsx("span", { children: !props.model.published ? "Draft" : draft ? "Unpublished changes" : "Published" }),
96
- props.model.published && draft ? /* @__PURE__ */ jsxs("span", {
97
- className: "text-muted-foreground/80",
98
- children: [
99
- "· v",
100
- props.model.published.version,
101
- " live"
102
- ]
103
- }) : null
104
- ]
105
- });
106
- }
107
- function StatusToggle(props) {
108
- const allowed = props.published;
109
- const on = props.status === "ENABLED";
110
- return /* @__PURE__ */ jsx(Tooltip, {
111
- enabled: !allowed,
112
- content: "Publish the workflow first",
113
- align: "end",
114
- side: props.tooltipSide,
115
- children: /* @__PURE__ */ jsxs("span", {
116
- className: "flex items-center gap-2 text-xs text-muted-foreground",
117
- children: [/* @__PURE__ */ jsx(Toggle, {
118
- checked: on,
119
- disabled: !allowed,
120
- label: on ? "Turn the workflow off" : "Turn the workflow on",
121
- onChange: (checked) => props.onChange(checked ? "ENABLED" : "DISABLED")
122
- }), /* @__PURE__ */ jsx("span", {
123
- className: "w-6",
124
- children: on ? "On" : "Off"
125
- })]
126
- })
127
- });
128
- }
129
- function PublishedMissingNote(props) {
130
- if (props.missing.length === 0) return null;
131
- return /* @__PURE__ */ jsx("span", {
132
- role: "alert",
133
- "aria-label": "Published version incomplete",
134
- className: "shrink-0 whitespace-nowrap rounded-full bg-wf-warn/12 px-2 py-0.5 text-xs text-wf-warn",
135
- title: `The published version is missing a reactor connection on: ${props.missing.join(", ")}`,
136
- children: "Live version incomplete"
137
- });
138
- }
139
- function ReactorDenialNote(props) {
140
- if (!props.denial) return null;
141
- return /* @__PURE__ */ jsxs("span", {
142
- role: "alert",
143
- "aria-label": "Reactor access denied",
144
- className: "max-w-80 truncate rounded-full bg-wf-warn/12 px-2 py-0.5 text-xs text-wf-warn",
145
- title: props.denial,
146
- children: ["No reactor access: ", props.denial]
147
- });
148
- }
149
- /** Instead of the draft banner on a managed workflow: who keeps it, and that edits here are not saved. */
150
- function ManagedBanner(props) {
151
- const manager = props.model.managedBy;
152
- if (!manager) return null;
153
- return /* @__PURE__ */ jsxs("div", {
154
- role: "status",
155
- className: "pointer-events-auto flex max-w-xl items-center gap-3 rounded-lg border border-solid border-foreground/10 bg-card px-3 py-1.5 text-[13px] shadow-sm",
156
- children: [/* @__PURE__ */ jsx("span", {
157
- className: "h-2 w-2 shrink-0 rounded-full bg-muted-foreground",
158
- "aria-hidden": true
159
- }), /* @__PURE__ */ jsxs("span", {
160
- className: "text-foreground",
161
- children: [
162
- "Managed by ",
163
- /* @__PURE__ */ jsx("strong", { children: manager.label || manager.documentType }),
164
- ". Change it there: edits here are not saved."
165
- ]
166
- })]
167
- });
168
- }
169
- function DraftBanner(props) {
170
- if (!hasDraftChanges(props.model)) return null;
171
- const { readiness } = props;
172
- const target = readiness.firstIncomplete;
173
- return /* @__PURE__ */ jsxs("div", {
174
- role: "status",
175
- className: "pointer-events-auto flex items-center gap-3 rounded-lg border border-solid border-foreground/10 bg-card py-1.5 pl-3 pr-1.5 text-[13px] shadow-sm",
176
- children: [
177
- /* @__PURE__ */ jsx("span", {
178
- className: "h-2 w-2 shrink-0 rounded-full bg-wf-warn",
179
- "aria-hidden": true
180
- }),
181
- /* @__PURE__ */ jsx("span", {
182
- className: "text-foreground",
183
- children: "You have unpublished changes"
184
- }),
185
- props.error ? /* @__PURE__ */ jsx("span", {
186
- className: "text-xs text-wf-fail",
187
- children: props.error
188
- }) : null,
189
- !readiness.hasTrigger || target ? /* @__PURE__ */ jsxs("span", {
190
- className: "flex items-center gap-1.5 text-xs text-wf-warn",
191
- children: [/* @__PURE__ */ jsx("span", { children: target ? "Incomplete steps" : "No trigger yet" }), target ? /* @__PURE__ */ jsx("button", {
192
- type: "button",
193
- className: "font-medium underline underline-offset-2 hover:no-underline",
194
- onClick: () => props.onSelect(target),
195
- children: "Show"
196
- }) : null]
197
- }) : null,
198
- /* @__PURE__ */ jsxs("span", {
199
- className: "flex items-center gap-1",
200
- children: [props.model.published ? /* @__PURE__ */ jsx(Button, {
201
- size: "sm",
202
- variant: "ghost",
203
- onClick: props.onDiscard,
204
- children: "Discard changes"
205
- }) : null, /* @__PURE__ */ jsx(PublishButton, {
206
- model: props.model,
207
- readiness,
208
- publishing: props.publishing,
209
- onPublish: props.onPublish,
210
- onSelect: props.onSelect,
211
- signIn: props.signIn
212
- })]
213
- })
214
- ]
215
- });
216
- }
217
- //#endregion
218
- //#region editors/workflow-editor/ui/StepError.tsx
219
- function StepError(props) {
220
- return /* @__PURE__ */ jsx("pre", {
221
- className: "overflow-auto whitespace-pre-wrap rounded-md bg-wf-fail/10 p-2.5 text-xs text-wf-fail",
222
- children: props.error
223
- });
224
- }
225
- //#endregion
226
- //#region editors/shared/document-ref.tsx
227
- const SHOWN = 3;
228
- function shortId(id) {
229
- return id.length > 16 ? `${id.slice(0, 6)}…${id.slice(-6)}` : id;
230
- }
231
- function revisionText(reference) {
232
- const scopes = Object.entries(reference.revision).map(([scope, count]) => `${scope} ${count}`).join(" · ");
233
- return reference.branch === "main" ? scopes : `${reference.branch}: ${scopes}`;
234
- }
235
- function DocumentRefRow(props) {
236
- const { reference } = props;
237
- const setSelectedNode = useSetSelectedNode();
238
- return /* @__PURE__ */ jsxs("li", {
239
- "aria-label": `Document ${reference.documentId}`,
240
- className: "flex items-center gap-2",
241
- children: [/* @__PURE__ */ jsxs("div", {
242
- className: "min-w-0 flex-1 text-xs",
243
- children: [/* @__PURE__ */ jsxs("div", {
244
- className: "flex min-w-0 items-baseline gap-1.5",
245
- children: [/* @__PURE__ */ jsx("span", {
246
- className: "truncate font-medium text-foreground",
247
- children: reference.documentType
248
- }), /* @__PURE__ */ jsx("span", {
249
- className: "shrink-0 font-mono text-[11px] text-muted-foreground",
250
- title: reference.documentId,
251
- children: shortId(reference.documentId)
252
- })]
253
- }), /* @__PURE__ */ jsxs("div", {
254
- className: "truncate text-[11px] text-muted-foreground",
255
- children: ["Revision ", revisionText(reference)]
256
- })]
257
- }), /* @__PURE__ */ jsx(Button, {
258
- size: "sm",
259
- onClick: () => setSelectedNode(reference.documentId),
260
- "aria-label": `Open document ${reference.documentId}`,
261
- children: "Open document"
262
- })]
263
- });
264
- }
265
- function DocumentRefs(props) {
266
- const { references } = props;
267
- const hidden = references.length - SHOWN;
268
- return /* @__PURE__ */ jsxs("div", {
269
- role: "group",
270
- "aria-label": "Document references",
271
- className: "flex flex-col gap-1.5",
272
- children: [
273
- /* @__PURE__ */ jsx("ul", {
274
- className: "m-0 flex list-none flex-col gap-1.5 p-0",
275
- children: references.slice(0, SHOWN).map((reference, index) => /* @__PURE__ */ jsx(DocumentRefRow, { reference }, `${reference.documentId}-${index}`))
276
- }),
277
- hidden > 0 ? /* @__PURE__ */ jsxs("p", {
278
- className: "text-[11px] text-muted-foreground",
279
- children: [
280
- "and ",
281
- hidden,
282
- " more in the data below"
283
- ]
284
- }) : null,
285
- /* @__PURE__ */ jsx("p", {
286
- className: "text-[11px] text-muted-foreground",
287
- children: "The run kept a reference, not the state. Opening shows the document as it is now: past revisions can't be read yet (#3179)."
288
- })
289
- ]
290
- });
291
- }
292
- //#endregion
293
- //#region editors/shared/data-viewer.tsx
294
- const DataTree = lazy(() => import("./data-tree-BOuPR-2J.js"));
295
- function stringify(value) {
296
- try {
297
- return JSON.stringify(value, null, 2) ?? "";
298
- } catch {
299
- return String(value);
300
- }
301
- }
302
- function isEmpty(value) {
303
- if (value === void 0 || value === null) return true;
304
- if (typeof value === "object") return Object.keys(value).length === 0;
305
- return false;
306
- }
307
- function RawJson(props) {
308
- return /* @__PURE__ */ jsx("pre", {
309
- className: "max-h-72 overflow-auto whitespace-pre-wrap break-words font-mono text-xs text-foreground",
310
- children: props.text
311
- });
312
- }
313
- function TreeSkeleton() {
314
- return /* @__PURE__ */ jsx("div", {
315
- role: "status",
316
- "aria-label": "Loading data",
317
- className: "flex animate-pulse flex-col gap-2 py-1",
318
- children: [
319
- "w-2/5",
320
- "w-3/5",
321
- "w-1/2",
322
- "w-1/3"
323
- ].map((width, index) => /* @__PURE__ */ jsx("span", {
324
- className: `h-2.5 rounded bg-muted ${width}`,
325
- style: { marginLeft: index === 0 ? 0 : 16 }
326
- }, width))
327
- });
328
- }
329
- function DataViewer(props) {
330
- const [raw, setRaw] = useState(false);
331
- const [copied, setCopied] = useState(false);
332
- const empty = isEmpty(props.value);
333
- const text = stringify(props.value);
334
- const tree = typeof props.value === "object" && props.value !== null;
335
- const references = tree ? documentRefsIn(props.value) : [];
336
- const treeValue = isDocumentRefMarker(props.value) ? Object.fromEntries(Object.entries(props.value).filter(([key]) => key !== DOCUMENT_REF_KEY)) : props.value;
337
- return /* @__PURE__ */ jsxs("section", {
338
- "aria-label": props.label,
339
- className: "min-w-0 rounded-md border border-solid border-border bg-card",
340
- children: [/* @__PURE__ */ jsxs("header", {
341
- className: "flex h-8 items-center gap-1 border-b border-solid border-border pl-3 pr-1",
342
- children: [
343
- /* @__PURE__ */ jsx("h4", {
344
- className: "mr-auto text-xs font-medium text-foreground",
345
- children: props.label
346
- }),
347
- !empty && tree ? /* @__PURE__ */ jsx("button", {
348
- type: "button",
349
- "aria-pressed": raw,
350
- className: "rounded px-1.5 py-0.5 text-[11px] text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",
351
- onClick: () => setRaw((value) => !value),
352
- children: raw ? "Tree" : "JSON"
353
- }) : null,
354
- !empty ? /* @__PURE__ */ jsx(IconButton, {
355
- icon: copied ? "check" : "copy",
356
- label: `Copy ${props.label.toLowerCase()} as JSON`,
357
- onClick: () => {
358
- navigator.clipboard.writeText(text).then(() => {
359
- setCopied(true);
360
- setTimeout(() => setCopied(false), 1500);
361
- });
362
- }
363
- }) : null
364
- ]
365
- }), /* @__PURE__ */ jsx("div", {
366
- className: "px-3 py-2",
367
- children: empty ? /* @__PURE__ */ jsx("p", {
368
- className: "text-xs text-muted-foreground",
369
- children: props.emptyText ?? "Nothing"
370
- }) : !tree ? /* @__PURE__ */ jsx("p", {
371
- className: "break-words font-mono text-xs text-foreground",
372
- children: text
373
- }) : raw ? /* @__PURE__ */ jsx(RawJson, { text }) : /* @__PURE__ */ jsxs("div", {
374
- className: "flex flex-col gap-2",
375
- children: [references.length > 0 ? /* @__PURE__ */ jsx(DocumentRefs, { references }) : null, isEmpty(treeValue) ? null : /* @__PURE__ */ jsx("div", {
376
- className: "max-h-72 overflow-auto",
377
- children: /* @__PURE__ */ jsx(Suspense, {
378
- fallback: /* @__PURE__ */ jsx(TreeSkeleton, {}),
379
- children: /* @__PURE__ */ jsx(DataTree, {
380
- value: treeValue,
381
- root: props.root
382
- })
383
- })
384
- })]
385
- })
386
- })]
387
- });
388
- }
389
- //#endregion
390
- //#region editors/workflow-editor/ui/trigger-text.ts
391
- const WEEKDAYS = [
392
- "Sunday",
393
- "Monday",
394
- "Tuesday",
395
- "Wednesday",
396
- "Thursday",
397
- "Friday",
398
- "Saturday"
399
- ];
400
- const UNIT_LABEL = {
401
- minutes: ["minute", "minutes"],
402
- hours: ["hour", "hours"],
403
- days: ["day", "days"]
404
- };
405
- function isInt(field) {
406
- return /^\d+$/.test(field);
407
- }
408
- function clock(hour, minute) {
409
- return `${hour.padStart(2, "0")}:${minute.padStart(2, "0")}`;
410
- }
411
- function dayList(field) {
412
- if (field === "1-5") return "on weekdays";
413
- if (field === "0,6" || field === "6,0") return "at weekends";
414
- const days = field.split(",");
415
- if (!days.every((day) => isInt(day) && Number(day) <= 7)) return void 0;
416
- const names = days.map((day) => WEEKDAYS[Number(day) % 7]);
417
- if (names.length === 1) return `every ${names[0]}`;
418
- return `on ${names.slice(0, -1).join(", ")} and ${names[names.length - 1]}`;
419
- }
420
- /** Describes a five-field cron expression, or returns undefined. */
421
- function describeCron(cron) {
422
- const fields = cron.trim().split(/\s+/);
423
- if (fields.length !== 5) return void 0;
424
- const [minute, hour, dayOfMonth, month, dayOfWeek] = fields;
425
- if (month !== "*") return void 0;
426
- const everyMinutes = /^\*\/(\d+)$/.exec(minute);
427
- if (everyMinutes && hour === "*" && dayOfMonth === "*" && dayOfWeek === "*") {
428
- const n = Number(everyMinutes[1]);
429
- return n === 1 ? "Every minute" : `Every ${n} minutes`;
430
- }
431
- if (minute === "*" && hour === "*" && dayOfMonth === "*" && dayOfWeek === "*") return "Every minute";
432
- if (isInt(minute) && hour === "*" && dayOfMonth === "*" && dayOfWeek === "*") return minute === "0" ? "Every hour, on the hour" : `Every hour at ${minute.padStart(2, "0")} past`;
433
- const everyHours = /^\*\/(\d+)$/.exec(hour);
434
- if (isInt(minute) && everyHours && dayOfMonth === "*" && dayOfWeek === "*") return `Every ${everyHours[1]} hours`;
435
- if (!isInt(minute) || !isInt(hour)) return void 0;
436
- const at = clock(hour, minute);
437
- if (dayOfMonth === "*" && dayOfWeek === "*") return `Every day at ${at}`;
438
- if (dayOfMonth === "*") {
439
- const days = dayList(dayOfWeek);
440
- return days ? `${days.charAt(0).toUpperCase()}${days.slice(1)} at ${at}` : void 0;
441
- }
442
- if (isInt(dayOfMonth) && dayOfWeek === "*") return `Every month on day ${dayOfMonth} at ${at}`;
443
- }
444
- function describeSchedule(config) {
445
- let schedule;
446
- try {
447
- schedule = parseScheduleConfig(config);
448
- } catch {
449
- return "On a schedule that does not parse";
450
- }
451
- if (schedule.mode === "interval") {
452
- const unit = UNIT_LABEL[schedule.unit];
453
- return schedule.every === 1 ? `Every ${unit[0]}` : `Every ${schedule.every} ${unit[1]}`;
454
- }
455
- const described = describeCron(schedule.cron);
456
- return described ? `${described} ${schedule.timezone}` : `On schedule ${schedule.cron}`;
457
- }
458
- function literal(config, key) {
459
- if (!config || typeof config !== "object") return void 0;
460
- const value = config[key];
461
- if (typeof value !== "string") return void 0;
462
- const text = value.trim();
463
- return text && !text.includes("{{") ? text : void 0;
464
- }
465
- function documentTypeLabel(documentType) {
466
- return (documentType.split("/").pop() ?? documentType).split(/[-_\s]+/).filter(Boolean).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
467
- }
468
- function actionTypeLabel(actionType) {
469
- const text = actionType.toLowerCase().split(/[_\s]+/).filter(Boolean).join(" ");
470
- return text.charAt(0).toUpperCase() + text.slice(1);
471
- }
472
- /** Describes a reactor document trigger by what it filters on. */
473
- function describeDocumentTrigger(triggerName, config) {
474
- const documentType = literal(config, "documentType");
475
- const label = documentType ? documentTypeLabel(documentType) : "";
476
- const subject = label ? `${/^[AEIOU]/.test(label) ? "an" : "a"} ${label}` : literal(config, "documentId") ? "its document" : "a document";
477
- switch (triggerName) {
478
- case "document-event": {
479
- const actionType = literal(config, "actionType");
480
- return actionType ? `When ${actionTypeLabel(actionType)} runs on ${subject}` : `When ${subject} changes`;
481
- }
482
- case "document-created": return `When ${subject} is created`;
483
- case "document-deleted": return `When ${subject} is deleted`;
484
- default: return;
485
- }
486
- }
487
- /** When a workflow starts, from its trigger. */
488
- function describeTrigger(trigger) {
489
- if (!trigger) return "Never starts: no trigger";
490
- const block = {
491
- pieceName: trigger.pieceName,
492
- kind: "trigger",
493
- name: trigger.triggerName
494
- };
495
- switch (blockKey(block)) {
496
- case blockKey(MANUAL_TRIGGER): return "Manual";
497
- case blockKey(WEBHOOK_TRIGGER): return "When its webhook is called";
498
- case blockKey(SCHEDULE_TRIGGER): return describeSchedule(trigger.config);
499
- default: {
500
- if (trigger.pieceName === "@powerhousedao/piece-reactor") {
501
- const described = describeDocumentTrigger(trigger.triggerName, trigger.config);
502
- if (described) return described;
503
- }
504
- const meta = blockMeta(block);
505
- const piece = meta.subtitle.replace(/ · Trigger$/, "");
506
- return `${meta.displayName} in ${piece}`;
507
- }
508
- }
509
- }
510
- //#endregion
511
- export { uniqueStepKey as _, StepError as a, PublishButton as c, ReactorDenialNote as d, StatusToggle as f, hasDraftChanges as g, VARIABLES_VIEW as h, DataViewer as i, PublishState as l, STEP_PARAM as m, describeSchedule as n, DraftBanner as o, usePublish as p, describeTrigger as r, ManagedBanner as s, describeCron as t, PublishedMissingNote as u };
512
-
513
- //# sourceMappingURL=trigger-text-Co-dn9x-.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"trigger-text-Co-dn9x-.js","names":[],"sources":["../../editors/workflow-editor/ui/model.ts","../../editors/workflow-editor/ui/PublishControls.tsx","../../editors/workflow-editor/ui/StepError.tsx","../../editors/shared/document-ref.tsx","../../editors/shared/data-viewer.tsx","../../editors/workflow-editor/ui/trigger-text.ts"],"sourcesContent":["// Plain view model + callbacks; no document-model imports so the UI layer\n// stays independent of Powerhouse document plumbing.\nimport type { AddedBlock } from \"./add-follow-up.js\";\nimport type { BlockForm } from \"./forms.js\";\n\nexport type WorkflowStatusValue = \"DRAFT\" | \"ENABLED\" | \"DISABLED\" | \"ARCHIVED\";\n\nexport interface PointModel {\n x: number;\n y: number;\n}\n\nexport type PropertyModeValue = \"MANUAL\" | \"EXPRESSION\";\n\nexport interface PropertySettingModel {\n prop: string;\n mode: PropertyModeValue;\n // A DYNAMIC prop's resolved children, options stripped.\n schema?: unknown;\n}\n\nexport interface TestRecordModel {\n runId: string;\n testedAt: string;\n}\n\n// Editor bookkeeping on a step or the trigger; absent on older documents.\nexport interface BlockStateModel {\n propertySettings?: PropertySettingModel[] | null;\n lastTest?: TestRecordModel | null;\n updatedAt?: string | null;\n}\n\nexport interface TriggerModel extends BlockStateModel {\n id: string;\n pieceName: string;\n pieceVersion: string;\n triggerName: string;\n config: unknown;\n connectionId: string | null;\n // A REACTOR connection, for a trigger that declares requireReactor.\n reactorConnectionId?: string | null;\n}\n\nexport type BackoffKindValue = \"FIXED\" | \"EXPONENTIAL\";\n\nexport interface RetryPolicyModel {\n maxAttempts: number;\n backoff: BackoffKindValue;\n initialDelaySeconds: number;\n maxDelaySeconds: number;\n retryOn: string[];\n}\n\nexport interface StepModel extends BlockStateModel {\n id: string;\n key: string;\n name: string;\n pieceName: string;\n pieceVersion: string;\n actionName: string;\n connectionId: string | null;\n // A REACTOR connection, for an action that declares requireReactor.\n reactorConnectionId?: string | null;\n config: unknown;\n retry: RetryPolicyModel | null;\n timeoutSeconds: number | null;\n idempotencyKeyExpression: string | null;\n position: PointModel | null;\n skip?: boolean;\n}\n\nexport interface EdgeModel {\n id: string;\n from: string;\n to: string;\n port: string;\n condition: string | null;\n}\n\nexport type VariableTypeValue =\n | \"TEXT\"\n | \"NUMBER\"\n | \"BOOLEAN\"\n | \"JSON\"\n | \"SECRET\";\n\nexport interface VariableModel {\n id: string;\n key: string;\n value: unknown;\n description: string | null;\n // Null means untyped: the type is inferred from the value.\n type?: VariableTypeValue | null;\n}\n\nexport interface PublishedBlockModel {\n id: string;\n // The step's name, or \"Trigger\".\n label: string;\n pieceName: string;\n pieceVersion: string;\n kind: \"action\" | \"trigger\";\n name: string;\n reactorConnectionId: string | null;\n}\n\nexport interface PublishedModel {\n version: number;\n publishedAt: string;\n // The snapshot's blocks, trigger first; what actually runs.\n blocks?: PublishedBlockModel[];\n}\n\nexport interface WorkflowModel {\n name: string;\n description?: string | null;\n status: WorkflowStatusValue;\n version: number;\n trigger: TriggerModel | null;\n steps: StepModel[];\n edges: EdgeModel[];\n variables: VariableModel[];\n // The policy's defaultRetry attempts; 1 retries nothing.\n defaultRetryAttempts?: number;\n published?: PublishedModel | null;\n // Writes nothing, bookkeeping included.\n readOnly?: boolean;\n // Kept by another document (an app's integration): shown read-only.\n managedBy?: {\n documentId: string;\n documentType: string;\n label: string;\n } | null;\n}\n\n// The side panel's id for the variables editor, beside step and trigger ids.\nexport const VARIABLES_VIEW = \"__variables\";\n\n/** Query params of the editor's view: the open panel and its tab. */\nexport const STEP_PARAM = \"step\";\nexport const TAB_PARAM = \"tab\";\n\n// Unpublished changes: never published, or edited since.\nexport function hasDraftChanges(\n model: Pick<WorkflowModel, \"version\" | \"published\">,\n): boolean {\n return !model.published || model.published.version !== model.version;\n}\n\nexport interface AddStepInputModel {\n key: string;\n name: string;\n pieceName: string;\n pieceVersion: string;\n actionName: string;\n config: unknown;\n position?: PointModel;\n}\n\nexport interface UpdateStepInputModel {\n id: string;\n key?: string;\n name?: string;\n // \"Update to vZ\" edits only pieceVersion.\n pieceName?: string;\n pieceVersion?: string;\n actionName?: string;\n // null clears the step's connection.\n connectionId?: string | null;\n reactorConnectionId?: string | null;\n config?: unknown;\n // null clears each of these; undefined leaves them unchanged.\n retry?: RetryPolicyModel | null;\n timeoutSeconds?: number | null;\n idempotencyKeyExpression?: string | null;\n position?: PointModel;\n skip?: boolean;\n}\n\n// Field modes and DYNAMIC schemas ride along with the config edit they\n// belong to; undefined leaves them as they are.\nexport interface ConfigExtras {\n propertySettings?: PropertySettingModel[];\n}\n\nexport interface WorkflowEditorCallbacks {\n setName: (name: string) => void;\n setDescription: (description: string) => void;\n setStatus: (status: WorkflowStatusValue) => void;\n setTrigger: (\n input: {\n pieceName: string;\n pieceVersion: string;\n triggerName: string;\n config: unknown;\n connectionId?: string | null;\n reactorConnectionId?: string | null;\n } & ConfigExtras,\n ) => AddedBlock;\n // Field-level trigger edits: each leaves the trigger's other fields alone.\n setTriggerConfig: (config: unknown, extras?: ConfigExtras) => void;\n // null clears a connection; undefined leaves it unchanged.\n setTriggerConnection: (input: {\n connectionId?: string | null;\n reactorConnectionId?: string | null;\n }) => void;\n setTriggerPieceVersion: (pieceVersion: string) => void;\n clearTrigger: () => void;\n addStep: (input: AddStepInputModel) => AddedBlock;\n updateStep: (input: UpdateStepInputModel) => void;\n setStepConfig: (id: string, config: unknown, extras?: ConfigExtras) => void;\n // Snapshots the draft and turns the workflow on; resolves once applied.\n publish: () => Promise<void>;\n discardChanges: () => void;\n removeStep: (id: string) => void;\n addEdge: (input: {\n from: string;\n to: string;\n port: string;\n condition?: string;\n }) => void;\n removeEdge: (id: string) => void;\n // Upserts by id; no id adds a variable. Keys are unique.\n setVariable: (input: {\n id?: string;\n key: string;\n value: unknown;\n description?: string;\n // Undefined leaves the type as is; null clears it.\n type?: VariableTypeValue | null;\n }) => void;\n removeVariable: (id: string) => void;\n // Composite operations backing the canvas add buttons.\n // `port` is the inserted block's own port the old edge's target hangs off.\n insertStepOnEdge: (\n edgeId: string,\n input: AddStepInputModel,\n port: string,\n ) => AddedBlock | undefined;\n appendStep: (\n fromId: string,\n port: string,\n input: AddStepInputModel,\n ) => AddedBlock;\n // Completes a block added before its form loaded: the defaults still unset\n // and the port it continues on. Nothing when the block is gone.\n completeBlock: (added: AddedBlock, form: BlockForm) => void;\n // Copies a step with its config and advanced settings, detached from the\n // graph so no port ends up with two edges.\n duplicateStep: (id: string) => void;\n // Re-parents a step onto a port, keeping whatever follows it.\n moveStep: (move: {\n stepId: string;\n toParentId: string;\n port: string;\n }) => void;\n}\n\n// Slugified step key derived from a label, suffixed until it is free.\nexport function uniqueStepKey(taken: string[], label: string): string {\n const base =\n label\n .toLowerCase()\n .replaceAll(/[^a-z0-9]+/g, \"_\")\n .replaceAll(/^_+|_+$/g, \"\") || \"step\";\n const keys = new Set(taken);\n let key = base;\n let suffix = 2;\n while (keys.has(key)) key = `${base}_${suffix++}`;\n return key;\n}\n","// Publishing, the Activepieces way: a draft that is always editable, a\n// Publish that snapshots it, and an on/off switch for the published flow.\nimport { useState } from \"react\";\nimport { Button, Toggle, Tooltip } from \"../../shared/controls.js\";\nimport {\n hasDraftChanges,\n type WorkflowEditorCallbacks,\n type WorkflowModel,\n type WorkflowStatusValue,\n} from \"./model.js\";\nimport type { WorkflowReadiness } from \"./validation.js\";\n\n// Under enforcement a publish must be signed, or its runs reach no documents.\nexport interface PublishSignIn {\n required: boolean;\n pending: boolean;\n login: () => void;\n}\n\nfunction blockedReason(readiness: WorkflowReadiness): string {\n if (!readiness.hasTrigger) return \"Add a trigger first\";\n if (readiness.firstIncomplete) return \"You have incomplete steps\";\n return \"Checking the steps…\";\n}\n\nexport function usePublish(callbacks: WorkflowEditorCallbacks) {\n const [publishing, setPublishing] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const publish = () => {\n if (publishing) return;\n setPublishing(true);\n setError(null);\n callbacks\n .publish()\n .catch((cause: unknown) =>\n setError(cause instanceof Error ? cause.message : String(cause)),\n )\n .finally(() => setPublishing(false));\n };\n return { publishing, error, publish };\n}\n\nexport function PublishButton(props: {\n model: WorkflowModel;\n readiness: WorkflowReadiness;\n publishing: boolean;\n onPublish: () => void;\n onSelect: (id: string) => void;\n size?: \"sm\" | \"md\";\n signIn?: PublishSignIn;\n}) {\n const { model, readiness } = props;\n if (props.signIn?.required) {\n return (\n <Tooltip content=\"This Switchboard enforces document permissions, so a publish must be signed\">\n <Button\n size={props.size ?? \"sm\"}\n variant=\"primary\"\n disabled={props.signIn.pending}\n onClick={props.signIn.login}\n >\n Sign in to publish\n </Button>\n </Tooltip>\n );\n }\n const incomplete = !readiness.ready;\n const changes = hasDraftChanges(model);\n const target = readiness.firstIncomplete;\n const select = () => {\n if (target) props.onSelect(target);\n };\n return (\n <Tooltip\n enabled={incomplete}\n content={\n <button\n type=\"button\"\n className=\"font-medium text-wf-warn hover:underline\"\n onClick={select}\n >\n {blockedReason(readiness)}\n </button>\n }\n >\n {/* The disabled button passes clicks through to this wrapper. */}\n <span className=\"inline-flex\" onClick={incomplete ? select : undefined}>\n <Button\n size={props.size ?? \"sm\"}\n variant=\"primary\"\n disabled={incomplete || !changes || props.publishing}\n title={!changes && !incomplete ? \"No unpublished changes\" : undefined}\n onClick={props.onPublish}\n >\n {props.publishing ? \"Publishing…\" : \"Publish\"}\n </Button>\n </span>\n </Tooltip>\n );\n}\n\n// A dot and a word: Draft until first published, then Published, or\n// Unpublished changes once the draft moves on.\nexport function PublishState(props: {\n model: Pick<WorkflowModel, \"version\" | \"published\">;\n}) {\n const draft = hasDraftChanges(props.model);\n return (\n <span\n className=\"flex shrink-0 items-center gap-1.5 whitespace-nowrap text-xs text-muted-foreground\"\n title={\n props.model.published\n ? `Published ${new Date(props.model.published.publishedAt).toLocaleString()}`\n : \"Never published\"\n }\n >\n <span\n aria-hidden\n className={`h-2 w-2 rounded-full ${draft ? \"bg-wf-warn\" : \"bg-wf-ok\"}`}\n />\n <span>\n {!props.model.published\n ? \"Draft\"\n : draft\n ? \"Unpublished changes\"\n : \"Published\"}\n </span>\n {props.model.published && draft ? (\n <span className=\"text-muted-foreground/80\">\n · v{props.model.published.version} live\n </span>\n ) : null}\n </span>\n );\n}\n\nexport function StatusToggle(props: {\n published: boolean;\n status: WorkflowStatusValue;\n onChange: (status: WorkflowStatusValue) => void;\n tooltipSide?: \"below\" | \"left\";\n}) {\n // Nothing runs until the first publish.\n const allowed = props.published;\n const on = props.status === \"ENABLED\";\n return (\n <Tooltip\n enabled={!allowed}\n content=\"Publish the workflow first\"\n align=\"end\"\n side={props.tooltipSide}\n >\n <span className=\"flex items-center gap-2 text-xs text-muted-foreground\">\n <Toggle\n checked={on}\n disabled={!allowed}\n label={on ? \"Turn the workflow off\" : \"Turn the workflow on\"}\n onChange={(checked) =>\n props.onChange(checked ? \"ENABLED\" : \"DISABLED\")\n }\n />\n <span className=\"w-6\">{on ? \"On\" : \"Off\"}</span>\n </span>\n </Tooltip>\n );\n}\n\n// The live snapshot's blocks that need a reactor connection and bind none.\nexport function PublishedMissingNote(props: { missing: readonly string[] }) {\n if (props.missing.length === 0) return null;\n return (\n <span\n role=\"alert\"\n aria-label=\"Published version incomplete\"\n className=\"shrink-0 whitespace-nowrap rounded-full bg-wf-warn/12 px-2 py-0.5 text-xs text-wf-warn\"\n title={`The published version is missing a reactor connection on: ${props.missing.join(\", \")}`}\n >\n Live version incomplete\n </span>\n );\n}\n\n// Why the runtime won't give the published workflow reactor access.\nexport function ReactorDenialNote(props: { denial: string | null }) {\n if (!props.denial) return null;\n return (\n <span\n role=\"alert\"\n aria-label=\"Reactor access denied\"\n className=\"max-w-80 truncate rounded-full bg-wf-warn/12 px-2 py-0.5 text-xs text-wf-warn\"\n title={props.denial}\n >\n No reactor access: {props.denial}\n </span>\n );\n}\n\n/** Instead of the draft banner on a managed workflow: who keeps it, and that edits here are not saved. */\nexport function ManagedBanner(props: { model: WorkflowModel }) {\n const manager = props.model.managedBy;\n if (!manager) return null;\n return (\n <div\n role=\"status\"\n className=\"pointer-events-auto flex max-w-xl items-center gap-3 rounded-lg border border-solid border-foreground/10 bg-card px-3 py-1.5 text-[13px] shadow-sm\"\n >\n <span\n className=\"h-2 w-2 shrink-0 rounded-full bg-muted-foreground\"\n aria-hidden\n />\n <span className=\"text-foreground\">\n Managed by <strong>{manager.label || manager.documentType}</strong>.\n Change it there: edits here are not saved.\n </span>\n </div>\n );\n}\n\nexport function DraftBanner(props: {\n model: WorkflowModel;\n readiness: WorkflowReadiness;\n publishing: boolean;\n error: string | null;\n onPublish: () => void;\n onDiscard: () => void;\n onSelect: (id: string) => void;\n signIn?: PublishSignIn;\n}) {\n if (!hasDraftChanges(props.model)) return null;\n const { readiness } = props;\n const target = readiness.firstIncomplete;\n return (\n <div\n role=\"status\"\n className=\"pointer-events-auto flex items-center gap-3 rounded-lg border border-solid border-foreground/10 bg-card py-1.5 pl-3 pr-1.5 text-[13px] shadow-sm\"\n >\n <span className=\"h-2 w-2 shrink-0 rounded-full bg-wf-warn\" aria-hidden />\n <span className=\"text-foreground\">You have unpublished changes</span>\n {props.error ? (\n <span className=\"text-xs text-wf-fail\">{props.error}</span>\n ) : null}\n {!readiness.hasTrigger || target ? (\n <span className=\"flex items-center gap-1.5 text-xs text-wf-warn\">\n <span>{target ? \"Incomplete steps\" : \"No trigger yet\"}</span>\n {target ? (\n <button\n type=\"button\"\n className=\"font-medium underline underline-offset-2 hover:no-underline\"\n onClick={() => props.onSelect(target)}\n >\n Show\n </button>\n ) : null}\n </span>\n ) : null}\n <span className=\"flex items-center gap-1\">\n {props.model.published ? (\n <Button size=\"sm\" variant=\"ghost\" onClick={props.onDiscard}>\n Discard changes\n </Button>\n ) : null}\n <PublishButton\n model={props.model}\n readiness={readiness}\n publishing={props.publishing}\n onPublish={props.onPublish}\n onSelect={props.onSelect}\n signIn={props.signIn}\n />\n </span>\n </div>\n );\n}\n","// A step's error from a run.\nexport function StepError(props: { error: string }) {\n return (\n <pre className=\"overflow-auto whitespace-pre-wrap rounded-md bg-wf-fail/10 p-2.5 text-xs text-wf-fail\">\n {props.error}\n </pre>\n );\n}\n","// The documents a run's data references: the run journal keeps a reference\n// (id, type, branch, revision) in place of a document's state.\nimport type { DocumentReference } from \"@powerhousedao/pieces-framework/workflow\";\nimport { useSetSelectedNode } from \"@powerhousedao/reactor-browser\";\nimport { Button } from \"./controls.js\";\n\n// Beyond this many, the rest are counted.\nconst SHOWN = 3;\n\nfunction shortId(id: string): string {\n return id.length > 16 ? `${id.slice(0, 6)}…${id.slice(-6)}` : id;\n}\n\nfunction revisionText(reference: DocumentReference): string {\n const scopes = Object.entries(reference.revision)\n .map(([scope, count]) => `${scope} ${count}`)\n .join(\" · \");\n return reference.branch === \"main\"\n ? scopes\n : `${reference.branch}: ${scopes}`;\n}\n\nfunction DocumentRefRow(props: { reference: DocumentReference }) {\n const { reference } = props;\n const setSelectedNode = useSetSelectedNode();\n return (\n <li\n aria-label={`Document ${reference.documentId}`}\n className=\"flex items-center gap-2\"\n >\n <div className=\"min-w-0 flex-1 text-xs\">\n <div className=\"flex min-w-0 items-baseline gap-1.5\">\n <span className=\"truncate font-medium text-foreground\">\n {reference.documentType}\n </span>\n <span\n className=\"shrink-0 font-mono text-[11px] text-muted-foreground\"\n title={reference.documentId}\n >\n {shortId(reference.documentId)}\n </span>\n </div>\n <div className=\"truncate text-[11px] text-muted-foreground\">\n Revision {revisionText(reference)}\n </div>\n </div>\n <Button\n size=\"sm\"\n onClick={() => setSelectedNode(reference.documentId)}\n aria-label={`Open document ${reference.documentId}`}\n >\n Open document\n </Button>\n </li>\n );\n}\n\nexport function DocumentRefs(props: { references: DocumentReference[] }) {\n const { references } = props;\n const hidden = references.length - SHOWN;\n return (\n <div\n role=\"group\"\n aria-label=\"Document references\"\n className=\"flex flex-col gap-1.5\"\n >\n <ul className=\"m-0 flex list-none flex-col gap-1.5 p-0\">\n {references.slice(0, SHOWN).map((reference, index) => (\n <DocumentRefRow\n key={`${reference.documentId}-${index}`}\n reference={reference}\n />\n ))}\n </ul>\n {hidden > 0 ? (\n <p className=\"text-[11px] text-muted-foreground\">\n and {hidden} more in the data below\n </p>\n ) : null}\n <p className=\"text-[11px] text-muted-foreground\">\n The run kept a reference, not the state. Opening shows the document as\n it is now: past revisions can&apos;t be read yet (#3179).\n </p>\n </div>\n );\n}\n","// A run's data (a step's input or output, a trigger payload) as a foldable\n// tree, with a raw JSON view and, given a root, per-key {{references}}.\nimport {\n DOCUMENT_REF_KEY,\n documentRefsIn,\n isDocumentRefMarker,\n} from \"@powerhousedao/pieces-framework/workflow\";\nimport { lazy, Suspense, useState } from \"react\";\nimport { IconButton } from \"./controls.js\";\nimport { DocumentRefs } from \"./document-ref.js\";\n\nconst DataTree = lazy(() => import(\"./data-tree.js\"));\n\nfunction stringify(value: unknown): string {\n try {\n // undefined for functions and symbols, despite the typing.\n return (JSON.stringify(value, null, 2) as string | undefined) ?? \"\";\n } catch {\n return String(value as string);\n }\n}\n\nfunction isEmpty(value: unknown): boolean {\n if (value === undefined || value === null) return true;\n if (typeof value === \"object\") return Object.keys(value).length === 0;\n return false;\n}\n\nfunction RawJson(props: { text: string }) {\n return (\n <pre className=\"max-h-72 overflow-auto whitespace-pre-wrap break-words font-mono text-xs text-foreground\">\n {props.text}\n </pre>\n );\n}\n\n// Stands in while the tree's chunk loads.\nfunction TreeSkeleton() {\n return (\n <div\n role=\"status\"\n aria-label=\"Loading data\"\n className=\"flex animate-pulse flex-col gap-2 py-1\"\n >\n {[\"w-2/5\", \"w-3/5\", \"w-1/2\", \"w-1/3\"].map((width, index) => (\n <span\n key={width}\n className={`h-2.5 rounded bg-muted ${width}`}\n style={{ marginLeft: index === 0 ? 0 : 16 }}\n />\n ))}\n </div>\n );\n}\n\nexport function DataViewer(props: {\n label: string;\n value: unknown;\n // Expression prefix for this value, e.g. \"steps.fetch.output\".\n root?: string;\n emptyText?: string;\n}) {\n const [raw, setRaw] = useState(false);\n const [copied, setCopied] = useState(false);\n const empty = isEmpty(props.value);\n const text = stringify(props.value);\n const tree = typeof props.value === \"object\" && props.value !== null;\n const references = tree ? documentRefsIn(props.value) : [];\n // A whole value that is a reference shows as one; its other keys stay a tree.\n const treeValue = isDocumentRefMarker(props.value)\n ? Object.fromEntries(\n Object.entries(props.value).filter(([key]) => key !== DOCUMENT_REF_KEY),\n )\n : props.value;\n\n return (\n <section\n aria-label={props.label}\n className=\"min-w-0 rounded-md border border-solid border-border bg-card\"\n >\n <header className=\"flex h-8 items-center gap-1 border-b border-solid border-border pl-3 pr-1\">\n <h4 className=\"mr-auto text-xs font-medium text-foreground\">\n {props.label}\n </h4>\n {!empty && tree ? (\n <button\n type=\"button\"\n aria-pressed={raw}\n className=\"rounded px-1.5 py-0.5 text-[11px] text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40\"\n onClick={() => setRaw((value) => !value)}\n >\n {raw ? \"Tree\" : \"JSON\"}\n </button>\n ) : null}\n {!empty ? (\n <IconButton\n icon={copied ? \"check\" : \"copy\"}\n label={`Copy ${props.label.toLowerCase()} as JSON`}\n onClick={() => {\n void navigator.clipboard.writeText(text).then(() => {\n setCopied(true);\n setTimeout(() => setCopied(false), 1500);\n });\n }}\n />\n ) : null}\n </header>\n <div className=\"px-3 py-2\">\n {empty ? (\n <p className=\"text-xs text-muted-foreground\">\n {props.emptyText ?? \"Nothing\"}\n </p>\n ) : !tree ? (\n <p className=\"break-words font-mono text-xs text-foreground\">\n {text}\n </p>\n ) : raw ? (\n <RawJson text={text} />\n ) : (\n <div className=\"flex flex-col gap-2\">\n {references.length > 0 ? (\n <DocumentRefs references={references} />\n ) : null}\n {isEmpty(treeValue) ? null : (\n <div className=\"max-h-72 overflow-auto\">\n <Suspense fallback={<TreeSkeleton />}>\n <DataTree value={treeValue as object} root={props.root} />\n </Suspense>\n </div>\n )}\n </div>\n )}\n </div>\n </section>\n );\n}\n","// Plain-language descriptions of when a workflow starts: \"Every day at\n// 08:00 UTC\" rather than \"0 8 * * *\". Unknown shapes fall back to the raw text.\nimport { blockKey } from \"@powerhousedao/pieces-framework/block-type\";\nimport { blockMeta } from \"./block-meta.js\";\nimport {\n MANUAL_TRIGGER,\n REACTOR_PIECE,\n SCHEDULE_TRIGGER,\n WEBHOOK_TRIGGER,\n} from \"./blocks.js\";\nimport { parseScheduleConfig } from \"@powerhousedao/pieces-framework/workflow\";\n\nconst WEEKDAYS = [\n \"Sunday\",\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\",\n];\n\nconst UNIT_LABEL: Record<string, [string, string]> = {\n minutes: [\"minute\", \"minutes\"],\n hours: [\"hour\", \"hours\"],\n days: [\"day\", \"days\"],\n};\n\nfunction isInt(field: string): boolean {\n return /^\\d+$/.test(field);\n}\n\nfunction clock(hour: string, minute: string): string {\n return `${hour.padStart(2, \"0\")}:${minute.padStart(2, \"0\")}`;\n}\n\nfunction dayList(field: string): string | undefined {\n if (field === \"1-5\") return \"on weekdays\";\n if (field === \"0,6\" || field === \"6,0\") return \"at weekends\";\n const days = field.split(\",\");\n if (!days.every((day) => isInt(day) && Number(day) <= 7)) return undefined;\n const names = days.map((day) => WEEKDAYS[Number(day) % 7]);\n if (names.length === 1) return `every ${names[0]}`;\n return `on ${names.slice(0, -1).join(\", \")} and ${names[names.length - 1]}`;\n}\n\n/** Describes a five-field cron expression, or returns undefined. */\nexport function describeCron(cron: string): string | undefined {\n const fields = cron.trim().split(/\\s+/);\n if (fields.length !== 5) return undefined;\n const [minute, hour, dayOfMonth, month, dayOfWeek] = fields;\n if (month !== \"*\") return undefined;\n\n const everyMinutes = /^\\*\\/(\\d+)$/.exec(minute);\n if (everyMinutes && hour === \"*\" && dayOfMonth === \"*\" && dayOfWeek === \"*\") {\n const n = Number(everyMinutes[1]);\n return n === 1 ? \"Every minute\" : `Every ${n} minutes`;\n }\n if (minute === \"*\" && hour === \"*\" && dayOfMonth === \"*\" && dayOfWeek === \"*\")\n return \"Every minute\";\n if (isInt(minute) && hour === \"*\" && dayOfMonth === \"*\" && dayOfWeek === \"*\")\n return minute === \"0\"\n ? \"Every hour, on the hour\"\n : `Every hour at ${minute.padStart(2, \"0\")} past`;\n\n const everyHours = /^\\*\\/(\\d+)$/.exec(hour);\n if (isInt(minute) && everyHours && dayOfMonth === \"*\" && dayOfWeek === \"*\") {\n return `Every ${everyHours[1]} hours`;\n }\n if (!isInt(minute) || !isInt(hour)) return undefined;\n const at = clock(hour, minute);\n\n if (dayOfMonth === \"*\" && dayOfWeek === \"*\") return `Every day at ${at}`;\n if (dayOfMonth === \"*\") {\n const days = dayList(dayOfWeek);\n return days\n ? `${days.charAt(0).toUpperCase()}${days.slice(1)} at ${at}`\n : undefined;\n }\n if (isInt(dayOfMonth) && dayOfWeek === \"*\") {\n return `Every month on day ${dayOfMonth} at ${at}`;\n }\n return undefined;\n}\n\nexport function describeSchedule(config: unknown): string {\n let schedule;\n try {\n schedule = parseScheduleConfig(config);\n } catch {\n return \"On a schedule that does not parse\";\n }\n if (schedule.mode === \"interval\") {\n const unit = UNIT_LABEL[schedule.unit];\n return schedule.every === 1\n ? `Every ${unit[0]}`\n : `Every ${schedule.every} ${unit[1]}`;\n }\n const described = describeCron(schedule.cron);\n return described\n ? `${described} ${schedule.timezone}`\n : `On schedule ${schedule.cron}`;\n}\n\n// A literal config value; an expression or a blank says nothing to show.\nfunction literal(config: unknown, key: string): string | undefined {\n if (!config || typeof config !== \"object\") return undefined;\n const value = (config as Record<string, unknown>)[key];\n if (typeof value !== \"string\") return undefined;\n const text = value.trim();\n return text && !text.includes(\"{{\") ? text : undefined;\n}\n\n// \"umh/production-ledger\" reads as \"Production Ledger\".\nfunction documentTypeLabel(documentType: string): string {\n const name = documentType.split(\"/\").pop() ?? documentType;\n return name\n .split(/[-_\\s]+/)\n .filter(Boolean)\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \");\n}\n\n// \"APPROVE_ORDER\" reads as \"Approve order\".\nfunction actionTypeLabel(actionType: string): string {\n const words = actionType\n .toLowerCase()\n .split(/[_\\s]+/)\n .filter(Boolean);\n const text = words.join(\" \");\n return text.charAt(0).toUpperCase() + text.slice(1);\n}\n\n/** Describes a reactor document trigger by what it filters on. */\nexport function describeDocumentTrigger(\n triggerName: string,\n config: unknown,\n): string | undefined {\n const documentType = literal(config, \"documentType\");\n const label = documentType ? documentTypeLabel(documentType) : \"\";\n const subject = label\n ? `${/^[AEIOU]/.test(label) ? \"an\" : \"a\"} ${label}`\n : literal(config, \"documentId\")\n ? \"its document\"\n : \"a document\";\n switch (triggerName) {\n case \"document-event\": {\n const actionType = literal(config, \"actionType\");\n return actionType\n ? `When ${actionTypeLabel(actionType)} runs on ${subject}`\n : `When ${subject} changes`;\n }\n case \"document-created\":\n return `When ${subject} is created`;\n case \"document-deleted\":\n return `When ${subject} is deleted`;\n default:\n return undefined;\n }\n}\n\n/** When a workflow starts, from its trigger. */\nexport function describeTrigger(\n trigger:\n | { pieceName: string; triggerName: string; config: unknown }\n | null\n | undefined,\n): string {\n if (!trigger) return \"Never starts: no trigger\";\n const block = {\n pieceName: trigger.pieceName,\n kind: \"trigger\" as const,\n name: trigger.triggerName,\n };\n switch (blockKey(block)) {\n case blockKey(MANUAL_TRIGGER):\n return \"Manual\";\n case blockKey(WEBHOOK_TRIGGER):\n return \"When its webhook is called\";\n case blockKey(SCHEDULE_TRIGGER):\n return describeSchedule(trigger.config);\n default: {\n if (trigger.pieceName === REACTOR_PIECE) {\n const described = describeDocumentTrigger(\n trigger.triggerName,\n trigger.config,\n );\n if (described) return described;\n }\n const meta = blockMeta(block);\n const piece = meta.subtitle.replace(/ · Trigger$/, \"\");\n return `${meta.displayName} in ${piece}`;\n }\n }\n}\n"],"mappings":";;;;;;;;AAyIA,MAAa,iBAAiB;;AAG9B,MAAa,aAAa;AAI1B,SAAgB,gBACd,OACS;CACT,OAAO,CAAC,MAAM,aAAa,MAAM,UAAU,YAAY,MAAM;AAC/D;AAgHA,SAAgB,cAAc,OAAiB,OAAuB;CACpE,MAAM,OACJ,MACG,YAAY,CAAC,CACb,WAAW,eAAe,GAAG,CAAC,CAC9B,WAAW,YAAY,EAAE,KAAK;CACnC,MAAM,OAAO,IAAI,IAAI,KAAK;CAC1B,IAAI,MAAM;CACV,IAAI,SAAS;CACb,OAAO,KAAK,IAAI,GAAG,GAAG,MAAM,GAAG,KAAK,GAAG;CACvC,OAAO;AACT;;;AC5PA,SAAS,cAAc,WAAsC;CAC3D,IAAI,CAAC,UAAU,YAAY,OAAO;CAClC,IAAI,UAAU,iBAAiB,OAAO;CACtC,OAAO;AACT;AAEA,SAAgB,WAAW,WAAoC;CAC7D,MAAM,CAAC,YAAY,iBAAiB,SAAS,KAAK;CAClD,MAAM,CAAC,OAAO,YAAY,SAAwB,IAAI;CACtD,MAAM,gBAAgB;EACpB,IAAI,YAAY;EAChB,cAAc,IAAI;EAClB,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