@powerhousedao/workflow 6.2.3-dev.27 → 6.2.3-dev.29

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 (115) hide show
  1. package/dist/{node/BlockSelector-COZm6-ev.mjs → browser/BlockSelector-D24DIiSX.js} +45 -12
  2. package/dist/browser/{BlockSelector-QQgOCVH3.js.map → BlockSelector-D24DIiSX.js.map} +1 -1
  3. package/dist/browser/{PieceMarkdown-C8Gv88TV.js → PieceMarkdown-B8EEaQgT.js} +2 -2
  4. package/dist/browser/{PieceMarkdown-C8Gv88TV.js.map → PieceMarkdown-B8EEaQgT.js.map} +1 -1
  5. package/dist/browser/{connection-form-XKR4zQgQ.js → connection-form-D-NETdDQ.js} +3 -3
  6. package/dist/browser/{connection-form-XKR4zQgQ.js.map → connection-form-D-NETdDQ.js.map} +1 -1
  7. package/dist/browser/{data-tree-DKrDFeQg.js → data-tree-DA4sc7B7.js} +2 -2
  8. package/dist/browser/{data-tree-DKrDFeQg.js.map → data-tree-DA4sc7B7.js.map} +1 -1
  9. package/dist/browser/{document-models-C6ebrsd9.js → document-models-BohsduV4.js} +2 -2
  10. package/dist/browser/{document-models-C6ebrsd9.js.map → document-models-BohsduV4.js.map} +1 -1
  11. package/dist/browser/{editor-YZw296bf.js → editor-B6N0PCuZ.js} +754 -417
  12. package/dist/browser/editor-B6N0PCuZ.js.map +1 -0
  13. package/dist/browser/{editor-C_E_JTp6.js → editor-BkdwuOC-.js} +4 -4
  14. package/dist/browser/{editor-C_E_JTp6.js.map → editor-BkdwuOC-.js.map} +1 -1
  15. package/dist/browser/{editor-fjwq-8Yq.js → editor-CZ5NvCyv.js} +4 -4
  16. package/dist/browser/{editor-fjwq-8Yq.js.map → editor-CZ5NvCyv.js.map} +1 -1
  17. package/dist/browser/editors/connection-editor/module.js +1 -1
  18. package/dist/browser/editors/workflow-editor/module.js +1 -1
  19. package/dist/browser/editors/workflow-studio/module.js +1 -1
  20. package/dist/browser/index.js +2 -2
  21. package/dist/browser/reactor/index.js +1 -1
  22. package/dist/browser/{runtime-api-xwvg5PzA.js → runtime-api-DDMQc4PB.js} +136 -40
  23. package/dist/browser/runtime-api-DDMQc4PB.js.map +1 -0
  24. package/dist/browser/{trigger-text-CdNxQOHw.js → trigger-text-CUv5Z2Uk.js} +4 -4
  25. package/dist/browser/{trigger-text-CdNxQOHw.js.map → trigger-text-CUv5Z2Uk.js.map} +1 -1
  26. package/dist/{browser/BlockSelector-QQgOCVH3.js → node/BlockSelector-CTmmpYxu.mjs} +45 -12
  27. package/dist/node/{BlockSelector-COZm6-ev.mjs.map → BlockSelector-CTmmpYxu.mjs.map} +1 -1
  28. package/dist/node/{PieceMarkdown-DIxZY5aG.mjs → PieceMarkdown-BMhBGa4t.mjs} +2 -2
  29. package/dist/node/{PieceMarkdown-DIxZY5aG.mjs.map → PieceMarkdown-BMhBGa4t.mjs.map} +1 -1
  30. package/dist/node/{connection-form-BLduFusc.mjs → connection-form-C9vbfSnA.mjs} +3 -3
  31. package/dist/node/{connection-form-BLduFusc.mjs.map → connection-form-C9vbfSnA.mjs.map} +1 -1
  32. package/dist/node/{data-tree-CmiGqG7C.mjs → data-tree-CbqpF3lC.mjs} +2 -2
  33. package/dist/node/{data-tree-CmiGqG7C.mjs.map → data-tree-CbqpF3lC.mjs.map} +1 -1
  34. package/dist/node/{editor-CN4PEGrW.mjs → editor-By9BHI8e.mjs} +4 -4
  35. package/dist/node/{editor-CN4PEGrW.mjs.map → editor-By9BHI8e.mjs.map} +1 -1
  36. package/dist/node/{editor-B2ZoeGue.mjs → editor-DP36YDk5.mjs} +754 -417
  37. package/dist/node/editor-DP36YDk5.mjs.map +1 -0
  38. package/dist/node/{editor-CyNBEKoj.mjs → editor-StBssjcQ.mjs} +4 -4
  39. package/dist/node/{editor-CyNBEKoj.mjs.map → editor-StBssjcQ.mjs.map} +1 -1
  40. package/dist/node/editors/connection-editor/module.mjs +1 -1
  41. package/dist/node/editors/workflow-editor/module.mjs +1 -1
  42. package/dist/node/editors/workflow-studio/module.mjs +1 -1
  43. package/dist/node/index.mjs +2 -2
  44. package/dist/node/pieces/reactor/descriptor.json +72 -16
  45. package/dist/node/pieces/reactor/index.mjs +317 -22
  46. package/dist/node/pieces/reactor/index.mjs.map +1 -1
  47. package/dist/node/{runtime-api-xwvg5PzA.mjs → runtime-api-DDMQc4PB.mjs} +136 -40
  48. package/dist/node/runtime-api-DDMQc4PB.mjs.map +1 -0
  49. package/dist/node/{trigger-text-qj_U3Qzd.mjs → trigger-text-Bzq6VfOQ.mjs} +4 -4
  50. package/dist/node/{trigger-text-qj_U3Qzd.mjs.map → trigger-text-Bzq6VfOQ.mjs.map} +1 -1
  51. package/dist/powerhouse.manifest.json +1 -1
  52. package/dist/style.css +59 -3
  53. package/dist/types/editors/shared/controls.d.ts +8 -0
  54. package/dist/types/editors/shared/controls.d.ts.map +1 -1
  55. package/dist/types/editors/shared/icons.d.ts +2 -0
  56. package/dist/types/editors/shared/icons.d.ts.map +1 -1
  57. package/dist/types/editors/workflow-editor/runtime-api.d.ts +2 -1
  58. package/dist/types/editors/workflow-editor/runtime-api.d.ts.map +1 -1
  59. package/dist/types/editors/workflow-editor/ui/BlockSelector.d.ts.map +1 -1
  60. package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts +3 -2
  61. package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts.map +1 -1
  62. package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts.map +1 -1
  63. package/dist/types/editors/workflow-editor/ui/blocks.d.ts +2 -0
  64. package/dist/types/editors/workflow-editor/ui/blocks.d.ts.map +1 -1
  65. package/dist/types/editors/workflow-editor/ui/forms.d.ts +42 -5
  66. package/dist/types/editors/workflow-editor/ui/forms.d.ts.map +1 -1
  67. package/dist/types/editors/workflow-editor/ui/piece-source.d.ts +1 -0
  68. package/dist/types/editors/workflow-editor/ui/piece-source.d.ts.map +1 -1
  69. package/dist/types/editors/workflow-editor/ui/prop-controls.d.ts +61 -0
  70. package/dist/types/editors/workflow-editor/ui/prop-controls.d.ts.map +1 -0
  71. package/dist/types/editors/workflow-editor/ui/prop-layout.d.ts +12 -0
  72. package/dist/types/editors/workflow-editor/ui/prop-layout.d.ts.map +1 -0
  73. package/dist/types/pieces/reactor/lib/actions/document-create.d.ts +3 -1
  74. package/dist/types/pieces/reactor/lib/actions/document-create.d.ts.map +1 -1
  75. package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts +2 -1
  76. package/dist/types/pieces/reactor/lib/actions/document-dispatch.d.ts.map +1 -1
  77. package/dist/types/pieces/reactor/lib/input-props.d.ts +5 -0
  78. package/dist/types/pieces/reactor/lib/input-props.d.ts.map +1 -0
  79. package/dist/types/pieces/reactor/lib/input-props.test.d.ts +2 -0
  80. package/dist/types/pieces/reactor/lib/input-props.test.d.ts.map +1 -0
  81. package/dist/types/pieces/reactor/lib/input-schema.d.ts +22 -0
  82. package/dist/types/pieces/reactor/lib/input-schema.d.ts.map +1 -0
  83. package/dist/types/pieces/reactor/lib/input-schema.test.d.ts +2 -0
  84. package/dist/types/pieces/reactor/lib/input-schema.test.d.ts.map +1 -0
  85. package/dist/types/pieces/reactor/lib/reactor.d.ts +13 -1
  86. package/dist/types/pieces/reactor/lib/reactor.d.ts.map +1 -1
  87. package/dist/types/pieces/reactor/lib/schema-text.d.ts +7 -0
  88. package/dist/types/pieces/reactor/lib/schema-text.d.ts.map +1 -0
  89. package/dist/types/pieces/reactor/lib/schema-text.test.d.ts +2 -0
  90. package/dist/types/pieces/reactor/lib/schema-text.test.d.ts.map +1 -0
  91. package/dist/types/scripts/ui-stack.d.ts +22 -0
  92. package/dist/types/scripts/ui-stack.d.ts.map +1 -1
  93. package/dist/types/test/ui/harness/prop-controls.d.ts +6 -0
  94. package/dist/types/test/ui/harness/prop-controls.d.ts.map +1 -0
  95. package/dist/types/test/ui/prop-controls.spec.d.ts +2 -0
  96. package/dist/types/test/ui/prop-controls.spec.d.ts.map +1 -0
  97. package/dist/types/test/ui/reactor-steps.spec.d.ts +2 -0
  98. package/dist/types/test/ui/reactor-steps.spec.d.ts.map +1 -0
  99. package/package.json +8 -8
  100. package/dist/browser/editor-YZw296bf.js.map +0 -1
  101. package/dist/browser/runtime-api-xwvg5PzA.js.map +0 -1
  102. package/dist/node/editor-B2ZoeGue.mjs.map +0 -1
  103. package/dist/node/runtime-api-xwvg5PzA.mjs.map +0 -1
  104. package/dist/types/editors/workflow-editor/ui/ActionListEditor.d.ts +0 -6
  105. package/dist/types/editors/workflow-editor/ui/ActionListEditor.d.ts.map +0 -1
  106. package/dist/types/editors/workflow-editor/ui/Autocomplete.d.ts +0 -20
  107. package/dist/types/editors/workflow-editor/ui/Autocomplete.d.ts.map +0 -1
  108. package/dist/types/editors/workflow-editor/ui/action-template.d.ts +0 -2
  109. package/dist/types/editors/workflow-editor/ui/action-template.d.ts.map +0 -1
  110. package/dist/types/editors/workflow-editor/ui/action-template.test.d.ts +0 -2
  111. package/dist/types/editors/workflow-editor/ui/action-template.test.d.ts.map +0 -1
  112. package/dist/types/editors/workflow-editor/ui/reactor-piece-form.d.ts +0 -5
  113. package/dist/types/editors/workflow-editor/ui/reactor-piece-form.d.ts.map +0 -1
  114. package/dist/types/editors/workflow-editor/ui/reactor-piece-form.test.d.ts +0 -2
  115. package/dist/types/editors/workflow-editor/ui/reactor-piece-form.test.d.ts.map +0 -1
@@ -1,34 +1,4 @@
1
1
  import { ambientRenownTokenProvider } from "@powerhousedao/reactor-browser/graphql-client";
2
- //#region editors/workflow-editor/ui/reactor-piece-form.ts
3
- const REACTOR_PIECE = "@powerhousedao/piece-reactor";
4
- const AUTOCOMPLETE_PROPS = /* @__PURE__ */ new Set([
5
- "documentType",
6
- "documentId",
7
- "actionType",
8
- "parentId",
9
- "driveId"
10
- ]);
11
- function isReactorPieceBlock(blockType) {
12
- return blockType.startsWith(`@powerhousedao/piece-reactor#`) || blockType.startsWith(`@powerhousedao/piece-reactor@`);
13
- }
14
- function adaptReactorProps(props) {
15
- const hasActionList = props.some((prop) => prop.name === "actions");
16
- return props.flatMap((prop) => {
17
- if (prop.name === "actions") return [{
18
- ...prop,
19
- type: "PH_ACTIONS",
20
- hasDynamicResolver: true
21
- }];
22
- if (prop.name === "actionType" && hasActionList) return [];
23
- if (AUTOCOMPLETE_PROPS.has(prop.name)) return [{
24
- ...prop,
25
- type: "PH_AUTOCOMPLETE",
26
- hasDynamicResolver: true
27
- }];
28
- return [prop];
29
- });
30
- }
31
- //#endregion
32
2
  //#region editors/workflow-editor/ui/forms.ts
33
3
  const POLL_INTERVAL_PROP = {
34
4
  name: "pollEverySeconds",
@@ -268,6 +238,128 @@ const CORE_FORMS = {
268
238
  }
269
239
  };
270
240
  //#endregion
241
+ //#region editors/workflow-editor/ui/blocks.ts
242
+ const REACTOR_PIECE = "@powerhousedao/piece-reactor";
243
+ function isReactorPieceBlock(blockType) {
244
+ return blockType.startsWith(`@powerhousedao/piece-reactor#`) || blockType.startsWith(`@powerhousedao/piece-reactor@`);
245
+ }
246
+ const TRIGGER_PRESETS = [
247
+ {
248
+ label: "Manual",
249
+ blockType: "core#manual",
250
+ group: "core",
251
+ description: "Fired on demand with a payload.",
252
+ defaultConfig: {}
253
+ },
254
+ {
255
+ label: "Schedule",
256
+ blockType: "core#schedule",
257
+ group: "core",
258
+ description: "Fires on a cron expression or fixed interval.",
259
+ defaultConfig: {
260
+ mode: "cron",
261
+ cron: "0 9 * * 1-5",
262
+ timezone: "UTC"
263
+ }
264
+ },
265
+ {
266
+ label: "Webhook",
267
+ blockType: "core#webhook",
268
+ group: "core",
269
+ description: "Fires when a provider POSTs to this workflow's URL.",
270
+ defaultConfig: {
271
+ methods: "POST",
272
+ scheme: "none",
273
+ responseMode: "async"
274
+ }
275
+ },
276
+ {
277
+ label: "Document event",
278
+ blockType: `${REACTOR_PIECE}#trigger:document-event`,
279
+ group: "powerhouse",
280
+ description: "Fires when a matching document operation lands.",
281
+ defaultConfig: {}
282
+ },
283
+ {
284
+ label: "Document created",
285
+ blockType: `${REACTOR_PIECE}#trigger:document-created`,
286
+ group: "powerhouse",
287
+ description: "Fires when a document is added to a drive.",
288
+ defaultConfig: {}
289
+ },
290
+ {
291
+ label: "Document deleted",
292
+ blockType: `${REACTOR_PIECE}#trigger:document-deleted`,
293
+ group: "powerhouse",
294
+ description: "Fires when a document is removed from a drive.",
295
+ defaultConfig: {}
296
+ }
297
+ ];
298
+ const STEP_PRESETS = [
299
+ {
300
+ label: "Branch",
301
+ blockType: "core#branch",
302
+ group: "core",
303
+ description: "Routes true/false on a condition.",
304
+ defaultConfig: { condition: "{{trigger.payload.ok}}" }
305
+ },
306
+ {
307
+ label: "Assert",
308
+ blockType: "core#assert",
309
+ group: "core",
310
+ description: "Fails the run when a value is blank, rejected or not allowed.",
311
+ defaultConfig: {
312
+ value: "",
313
+ allowValues: []
314
+ }
315
+ },
316
+ {
317
+ label: "Create document",
318
+ blockType: `${REACTOR_PIECE}#document-create`,
319
+ group: "powerhouse",
320
+ description: "Creates a Powerhouse document.",
321
+ defaultConfig: {
322
+ documentType: "",
323
+ name: ""
324
+ }
325
+ },
326
+ {
327
+ label: "Dispatch actions",
328
+ blockType: `${REACTOR_PIECE}#document-dispatch`,
329
+ group: "powerhouse",
330
+ description: "Sends actions to a document.",
331
+ defaultConfig: { documentId: "" }
332
+ },
333
+ {
334
+ label: "Get document",
335
+ blockType: `${REACTOR_PIECE}#document-get`,
336
+ group: "powerhouse",
337
+ description: "Reads a document's current state.",
338
+ defaultConfig: { documentId: "" }
339
+ },
340
+ {
341
+ label: "Find documents",
342
+ blockType: `${REACTOR_PIECE}#document-find`,
343
+ group: "powerhouse",
344
+ description: "Lists documents by type and name.",
345
+ defaultConfig: { documentType: "" }
346
+ },
347
+ {
348
+ label: "List document types",
349
+ blockType: `${REACTOR_PIECE}#document-types`,
350
+ group: "powerhouse",
351
+ description: "Document models installed on this reactor.",
352
+ defaultConfig: {}
353
+ },
354
+ {
355
+ label: "Get document schema",
356
+ blockType: `${REACTOR_PIECE}#document-schema`,
357
+ group: "powerhouse",
358
+ description: "Action and state schemas of a document type.",
359
+ defaultConfig: { documentType: "" }
360
+ }
361
+ ];
362
+ //#endregion
271
363
  //#region editors/workflow-editor/runtime-api.ts
272
364
  const DEFAULT_RUNTIME_URL = "http://localhost:4001/graphql/workflow-runtime";
273
365
  let currentRuntimeUrl;
@@ -311,15 +403,18 @@ function getBlockForm(blockType) {
311
403
  const entry = descriptor?.action ?? descriptor?.trigger;
312
404
  if (!descriptor || !entry) return null;
313
405
  const isTrigger = !descriptor.action && Boolean(descriptor.trigger);
314
- const reactorPiece = isReactorPieceBlock(blockType);
315
- const polled = isTrigger && entry.strategy !== "WEBHOOK" && !reactorPiece;
316
- const props = reactorPiece ? adaptReactorProps(entry.props) : entry.props;
406
+ const polled = isTrigger && entry.strategy !== "WEBHOOK" && !isReactorPieceBlock(blockType);
407
+ const props = entry.props;
317
408
  return {
318
409
  title: `${descriptor.displayName} · ${entry.displayName}`,
319
410
  requireAuth: entry.requireAuth,
320
411
  auth: !descriptor.auth ? "none" : entry.requireAuth ? "required" : "optional",
321
412
  props: polled ? [...props, POLL_INTERVAL_PROP] : props,
322
- triggerStrategy: isTrigger ? entry.strategy : void 0
413
+ triggerStrategy: isTrigger ? entry.strategy : void 0,
414
+ ...entry.description ? { description: entry.description } : {},
415
+ ...entry.propertyGroups ? { propertyGroups: entry.propertyGroups } : {},
416
+ ...entry.classification ? { classification: entry.classification } : {},
417
+ ...entry.errorHandlingOptions ? { errorHandling: entry.errorHandlingOptions } : {}
323
418
  };
324
419
  });
325
420
  formCache.set(blockType, cached);
@@ -446,17 +541,18 @@ async function rerunRun(runId) {
446
541
  workflowRuntime { rerun(runId: $runId) { runId status error } }
447
542
  }`, { runId })).workflowRuntime.rerun;
448
543
  }
449
- async function loadBlockOptions(blockType, propName, input, connectionId) {
450
- return (await gql(`query Options($blockType: String!, $propName: String!, $input: Unknown, $connectionId: String) {
451
- workflowRuntime { blockOptions(blockType: $blockType, propName: $propName, input: $input, connectionId: $connectionId) }
544
+ async function loadBlockOptions(blockType, propName, input, connectionId, searchValue) {
545
+ return (await gql(`query Options($blockType: String!, $propName: String!, $input: Unknown, $connectionId: String, $searchValue: String) {
546
+ workflowRuntime { blockOptions(blockType: $blockType, propName: $propName, input: $input, connectionId: $connectionId, searchValue: $searchValue) }
452
547
  }`, {
453
548
  blockType,
454
549
  propName,
455
550
  input,
456
- connectionId: connectionId ?? null
551
+ connectionId: connectionId ?? null,
552
+ searchValue: searchValue ?? null
457
553
  })).workflowRuntime.blockOptions;
458
554
  }
459
555
  //#endregion
460
- export { REACTOR_PIECE as S, rotateSecret as _, fetchConnections as a, testTrigger as b, fetchPieceTriggers as c, fetchWebhookEndpoint as d, fireWorkflow as f, rerunRun as g, loadBlockOptions as h, fetchBlockOutputTree as i, fetchRuns as l, invalidateConnections as m, checkConnection as n, fetchPieceActions as o, getBlockForm as p, createSecret as r, fetchPieceCatalog as s, DEFAULT_RUNTIME_URL as t, fetchSecretStat as u, searchBlocks as v, CORE_FORMS as x, setRuntimeUrl as y };
556
+ export { CORE_FORMS as C, TRIGGER_PRESETS as S, rotateSecret as _, fetchConnections as a, testTrigger as b, fetchPieceTriggers as c, fetchWebhookEndpoint as d, fireWorkflow as f, rerunRun as g, loadBlockOptions as h, fetchBlockOutputTree as i, fetchRuns as l, invalidateConnections as m, checkConnection as n, fetchPieceActions as o, getBlockForm as p, createSecret as r, fetchPieceCatalog as s, DEFAULT_RUNTIME_URL as t, fetchSecretStat as u, searchBlocks as v, STEP_PRESETS as x, setRuntimeUrl as y };
461
557
 
462
- //# sourceMappingURL=runtime-api-xwvg5PzA.mjs.map
558
+ //# sourceMappingURL=runtime-api-DDMQc4PB.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-api-DDMQc4PB.mjs","names":[],"sources":["../../editors/workflow-editor/ui/forms.ts","../../editors/workflow-editor/ui/blocks.ts","../../editors/workflow-editor/runtime-api.ts"],"sourcesContent":["// Form descriptors driving property panels; pure data, mirrors the\n// ConnectorPropDescriptor shape from the workflow runtime.\n\nexport interface BlockFormProp {\n name: string;\n displayName: string;\n type: string;\n required: boolean;\n defaultValue?: unknown;\n staticOptions?: FormOption[];\n // A STATIC_DROPDOWN's own state, beside its options.\n staticDisabled?: boolean;\n staticPlaceholder?: string;\n hasDynamicResolver?: boolean;\n description?: string;\n placeholder?: string;\n // Sibling prop names whose values feed the resolver; a change re-runs it.\n refreshers?: string[];\n // Nested shape: ARRAY item fields, or what a DYNAMIC resolver produced.\n properties?: BlockFormProp[];\n // Folded behind \"Advanced\": fields with a working default, so the common\n // case is short. Opens expanded when set, else live config would be hidden.\n advanced?: boolean;\n // Shown only while a sibling prop holds one of these values; data, not a\n // predicate, so a piece form arriving as JSON can express it too.\n // Hidden also when `unlessSet` has a value (a mode the runtime infers).\n showWhen?: { prop: string; oneOf: unknown[]; unlessSet?: string };\n // Activepieces layout and control hints, as the piece declared them.\n width?: \"half\" | \"full\";\n icon?: string;\n // CHECKBOX: sibling props shown only while it is checked.\n reveals?: string[];\n // MARKDOWN: BORDERLESS | INFO | WARNING | TIP.\n variant?: string;\n // STATIC_DROPDOWN \"cards\", NUMBER \"stepper\", DATE_RANGE \"dropdown\".\n display?: string;\n min?: number;\n max?: number;\n step?: number;\n // DROPDOWN: options() is re-run with what the author types.\n refreshOnSearch?: boolean;\n // RICH_TEXT: the sibling whose value picks plain, markdown or html.\n formatProperty?: string;\n}\n\nexport interface FormOption {\n label: string;\n value: unknown;\n description?: string;\n icon?: string;\n}\n\nexport interface PropertyGroup {\n key: string;\n // tabs | section | summary | builder | footer\n display: string;\n label?: string;\n description?: string;\n icon?: string;\n props: string[];\n}\n\nexport interface ErrorHandlingDefaults {\n retryOnFailure?: { defaultValue?: boolean; hide?: boolean };\n continueOnFailure?: { defaultValue?: boolean; hide?: boolean };\n}\n\nexport interface BlockForm {\n title: string;\n requireAuth: boolean;\n // Whether the block takes a connection: none hides the field entirely.\n auth?: \"none\" | \"optional\" | \"required\";\n props: BlockFormProp[];\n // Piece triggers only: POLLING | WEBHOOK | APP_WEBHOOK. WEBHOOK triggers\n // are fed by a request, so the panel shows their endpoint URL.\n triggerStrategy?: string;\n // What the step does, as the piece describes it.\n description?: string;\n propertyGroups?: PropertyGroup[];\n // READ | SEARCH | WRITE | DESTRUCTIVE\n classification?: string;\n errorHandling?: ErrorHandlingDefaults;\n}\n\nexport interface ConnectionSummary {\n id: string;\n name: string;\n connectorId: string;\n authType: string;\n status: string;\n accountLabel: string | null;\n}\n\nexport interface SecretStat {\n ref: string;\n label: string | null;\n version: number;\n status: string;\n createdAt: string;\n updatedAt: string;\n}\n\n// Minting seam for PH_SECRET_REF props: the field takes a value and the\n// document only ever receives the ref that comes back.\nexport interface SecretFormService {\n save: (input: {\n ref?: string;\n value: string;\n label: string;\n }) => Promise<SecretStat>;\n stat: (ref: string) => Promise<SecretStat | null>;\n}\n\nexport interface WebhookEndpoint {\n workflowId: string;\n url: string;\n // False when `url` is a bare path because the reactor has no public origin.\n absoluteUrl: boolean;\n armed: boolean;\n createdAt: string;\n}\n\nexport interface DesignTimeService {\n getBlockForm: (blockType: string) => Promise<BlockForm | null>;\n loadOptions: (\n blockType: string,\n propName: string,\n input: Record<string, unknown>,\n connectionId?: string,\n searchValue?: string,\n ) => Promise<unknown>;\n // Runs the current workflow's piece trigger test hook; sample items back.\n testTrigger?: () => Promise<unknown>;\n // The current workflow's webhook endpoint, for core#webhook triggers.\n webhookEndpoint?: () => Promise<WebhookEndpoint | null>;\n // Backs PH_SECRET_REF props; absent when the runtime refuses secret writes.\n secrets?: SecretFormService;\n // powerhouse/connection documents for the connection picker.\n listConnections?: () => Promise<ConnectionSummary[]>;\n // Drops the cached listing after the picker creates a connection.\n refreshConnections?: () => void;\n // The current workflow's most recent run, for a step's \"Last run\" preview.\n latestRun?: () => Promise<LatestRun | null>;\n}\n\nexport interface LatestRun {\n status: string;\n startedAt: string;\n triggerPayload: unknown;\n steps: {\n stepKey: string;\n status: string;\n input: unknown;\n output: unknown;\n error: string | null;\n }[];\n}\n\n// Ours, not the piece's: the reactor's poll cadence for a piece trigger.\n// Appended to every piece trigger's form; see splitPollInterval in the runtime.\nexport const POLL_INTERVAL_PROP: BlockFormProp = {\n name: \"pollEverySeconds\",\n displayName: \"Poll every (seconds)\",\n type: \"NUMBER\",\n required: false,\n description:\n \"How often the reactor checks this trigger; 60 at the least. Omit to follow the piece's own cadence.\",\n};\n\nconst text = (\n name: string,\n displayName: string,\n required = false,\n description?: string,\n): BlockFormProp => ({\n name,\n displayName,\n type: \"SHORT_TEXT\",\n required,\n description,\n});\n\n// Takes a secret VALUE and commits only the minted ref, the way the\n// connection editor's SecretField does; the document never holds the value.\nconst secretRef = (\n name: string,\n displayName: string,\n required = false,\n description?: string,\n): BlockFormProp => ({\n name,\n displayName,\n type: \"PH_SECRET_REF\",\n required,\n description,\n});\n\nconst number = (\n name: string,\n displayName: string,\n required = false,\n description?: string,\n): BlockFormProp => ({\n name,\n displayName,\n type: \"NUMBER\",\n required,\n description,\n});\n\n// Marks a prop for the \"Advanced\" section without repeating the builders.\nconst advanced = (prop: BlockFormProp): BlockFormProp => ({\n ...prop,\n advanced: true,\n});\n\n// Hides a prop until a sibling holds one of `oneOf`.\nconst shownWhen = (\n prop: BlockFormProp,\n sibling: string,\n oneOf: unknown[],\n): BlockFormProp => ({ ...prop, showWhen: { prop: sibling, oneOf } });\n\nconst dropdown = (\n name: string,\n displayName: string,\n options: { label: string; value: unknown }[],\n required = false,\n description?: string,\n): BlockFormProp => ({\n name,\n displayName,\n type: \"STATIC_DROPDOWN\",\n required,\n description,\n staticOptions: options,\n});\n\n// Every scheme that verifies a signature, and so needs a secret.\nconst SIGNED_SCHEMES = [\"token\", \"hmac\", \"hmac-prefixed\", \"hmac-timestamped\"];\n\n// Schemes that compute a digest, and so take a hash and an encoding. `token`\n// presents the secret verbatim, so none of that applies to it.\nconst HMAC_SCHEMES = [\"hmac\", \"hmac-prefixed\", \"hmac-timestamped\"];\n\n// Hand-written forms for core blocks and triggers.\nexport const CORE_FORMS: Record<string, BlockForm> = {\n \"core#manual\": {\n title: \"Manual trigger\",\n requireAuth: false,\n auth: \"none\",\n props: [],\n },\n \"core#schedule\": {\n title: \"Schedule\",\n requireAuth: false,\n auth: \"none\",\n props: [\n // Optional at run time: an omitted mode follows whichever of cron or\n // every is set, so the form defaults to cron rather than demanding one.\n {\n ...dropdown(\"mode\", \"Runs\", [\n { label: \"On a cron schedule\", value: \"cron\" },\n { label: \"At a fixed interval\", value: \"interval\" },\n ]),\n defaultValue: \"cron\",\n },\n // No mode but an `every` is interval mode to the runtime, so no cron.\n {\n ...text(\n \"cron\",\n \"Cron expression\",\n true,\n \"Five fields, e.g. 0 9 * * 1-5 runs at 09:00 on weekdays.\",\n ),\n showWhen: {\n prop: \"mode\",\n oneOf: [\"cron\", undefined],\n unlessSet: \"every\",\n },\n },\n shownWhen(\n number(\"every\", \"Every\", true, \"At least one minute.\"),\n \"mode\",\n [\"interval\"],\n ),\n shownWhen(\n {\n ...dropdown(\"unit\", \"Unit\", [\n { label: \"Minutes\", value: \"minutes\" },\n { label: \"Hours\", value: \"hours\" },\n { label: \"Days\", value: \"days\" },\n ]),\n defaultValue: \"minutes\",\n },\n \"mode\",\n [\"interval\"],\n ),\n text(\n \"timezone\",\n \"Timezone\",\n false,\n \"An IANA name such as Europe/Lisbon. Defaults to UTC.\",\n ),\n ],\n },\n \"core#webhook\": {\n title: \"Webhook\",\n requireAuth: false,\n auth: \"none\",\n props: [\n dropdown(\n \"methods\",\n \"Method\",\n [\n { label: \"POST\", value: \"POST\" },\n { label: \"Any\", value: \"ANY\" },\n { label: \"GET\", value: \"GET\" },\n { label: \"PUT\", value: \"PUT\" },\n { label: \"PATCH\", value: \"PATCH\" },\n { label: \"DELETE\", value: \"DELETE\" },\n ],\n true,\n ),\n // Named by wire format, not by sender: authors match these against their\n // sender's docs, and one brand name would mislead about every other.\n dropdown(\n \"scheme\",\n \"Verification\",\n [\n { label: \"None — the URL's token only\", value: \"none\" },\n { label: \"Shared token in a header\", value: \"token\" },\n { label: \"HMAC digest\", value: \"hmac\" },\n {\n label: \"HMAC digest with a label (sha256=…)\",\n value: \"hmac-prefixed\",\n },\n {\n label: \"HMAC digest, timestamped (t=…,v1=…)\",\n value: \"hmac-timestamped\",\n },\n ],\n true,\n ),\n // Hidden while the scheme is None: a visible secret field on an\n // unverified endpoint invites a secret that is never checked.\n shownWhen(\n secretRef(\n \"secretRef\",\n \"Secret\",\n true,\n \"The shared secret: the value the header must equal, or the key the sender signs with\",\n ),\n \"scheme\",\n SIGNED_SCHEMES,\n ),\n advanced(\n shownWhen(\n text(\n \"header\",\n \"Header\",\n false,\n \"Where the token or signature is read from. Defaults to the header the chosen scheme conventionally uses; set it only if the sender differs\",\n ),\n \"scheme\",\n SIGNED_SCHEMES,\n ),\n ),\n advanced(\n shownWhen(\n number(\n \"toleranceSeconds\",\n \"Replay window (seconds)\",\n false,\n \"Rejects a delivery signed longer ago than this, so a captured request expires. Default 300\",\n ),\n \"scheme\",\n [\"hmac-timestamped\"],\n ),\n ),\n // The layout frames the signature; these say how its digest was computed.\n // Senders pick them independently, so they are fields, not scheme names.\n advanced(\n shownWhen(\n dropdown(\"algorithm\", \"Hash\", [\n { label: \"SHA-256 (default)\", value: \"sha256\" },\n { label: \"SHA-1\", value: \"sha1\" },\n { label: \"SHA-512\", value: \"sha512\" },\n ]),\n \"scheme\",\n HMAC_SCHEMES,\n ),\n ),\n advanced(\n shownWhen(\n dropdown(\"encoding\", \"Digest encoding\", [\n { label: \"Hexadecimal (default)\", value: \"hex\" },\n { label: \"Base64\", value: \"base64\" },\n ]),\n \"scheme\",\n HMAC_SCHEMES,\n ),\n ),\n advanced(\n shownWhen(\n text(\n \"prefix\",\n \"Signature label\",\n false,\n \"The literal before the digest. Defaults to the hash and an equals sign, e.g. sha256=. Leave blank for a sender that sends the digest with no label\",\n ),\n \"scheme\",\n [\"hmac-prefixed\"],\n ),\n ),\n advanced(\n text(\n \"dedupeField\",\n \"Event id field\",\n false,\n \"Where the sender puts its own event id, so a redelivery is accepted without a second run. A bare name reads a query param or a top-level body field; prefix with header: or body: to read a header or a nested path (header:x-delivery-id, body:data.object.id)\",\n ),\n ),\n advanced(\n number(\n \"dedupeTtlSeconds\",\n \"Dedupe window (seconds)\",\n false,\n \"How long an event id is remembered. Default 300\",\n ),\n ),\n advanced(\n text(\n \"challengeField\",\n \"Challenge field\",\n false,\n \"Echo this field back instead of running, for senders that verify the endpoint before registering it. Same header:/body: prefixes as the event id field\",\n ),\n ),\n advanced(\n dropdown(\n \"responseMode\",\n \"Response\",\n [\n { label: \"Answer immediately (202)\", value: \"async\" },\n { label: \"Wait for the run (200)\", value: \"sync\" },\n ],\n false,\n \"Waiting holds the sender's socket open for the whole run\",\n ),\n ),\n advanced(\n number(\n \"responseStatus\",\n \"Success status\",\n false,\n \"Status returned on acceptance. Default 202 async, 200 sync\",\n ),\n ),\n ],\n },\n \"core#branch\": {\n title: \"Branch\",\n requireAuth: false,\n auth: \"none\",\n props: [\n text(\n \"condition\",\n \"Condition\",\n true,\n \"e.g. {{steps.fetch.output.body.ok}}\",\n ),\n text(\n \"equals\",\n \"Equals\",\n false,\n \"Take the true port only when the condition matches this; omit for truthiness\",\n ),\n ],\n },\n \"core#assert\": {\n title: \"Assert\",\n requireAuth: false,\n auth: \"none\",\n props: [\n text(\n \"value\",\n \"Value\",\n true,\n \"e.g. {{steps.describe.output}} - the run fails when it is blank\",\n ),\n {\n name: \"rejectValues\",\n displayName: \"Rejected values\",\n type: \"ARRAY\",\n required: false,\n description:\n \"One per line; the run fails when the value matches any of them\",\n },\n {\n name: \"allowValues\",\n displayName: \"Allowed values\",\n type: \"ARRAY\",\n required: false,\n description:\n \"One per line; when set, anything else fails. Safer than a reject list for model output\",\n },\n {\n name: \"allowEmpty\",\n displayName: \"Allow empty\",\n type: \"CHECKBOX\",\n required: false,\n description: \"Accept a blank value instead of failing\",\n },\n text(\"message\", \"Failure message\", false, \"Replaces the default error\"),\n ],\n },\n};\n","// Palette presets; pure data used by the UI to seed new triggers and steps.\n\n// The document blocks live in the reactor piece, and are offered here too:\n// they are what most workflows on a reactor are built from, and a picker that\n// made an author search for them would be a worse picker.\n\n// The reactor piece this package ships, named as pieces/index.ts declares it.\nexport const REACTOR_PIECE = \"@powerhousedao/piece-reactor\";\n\nexport function isReactorPieceBlock(blockType: string): boolean {\n return (\n blockType.startsWith(`${REACTOR_PIECE}#`) ||\n blockType.startsWith(`${REACTOR_PIECE}@`)\n );\n}\n\nexport interface BlockPreset {\n label: string;\n blockType: string;\n description: string;\n defaultConfig: unknown;\n // Which section of the picker it belongs to: \"core\" is the engine's own,\n // \"powerhouse\" the reactor piece, listed right after it.\n\n // Optional because a pick built from a search hit or an existing step is\n // the same shape but belongs to no section.\n group?: \"core\" | \"powerhouse\";\n}\n\nexport const TRIGGER_PRESETS: BlockPreset[] = [\n {\n label: \"Manual\",\n blockType: \"core#manual\",\n group: \"core\",\n description: \"Fired on demand with a payload.\",\n defaultConfig: {},\n },\n {\n label: \"Schedule\",\n blockType: \"core#schedule\",\n group: \"core\",\n description: \"Fires on a cron expression or fixed interval.\",\n defaultConfig: { mode: \"cron\", cron: \"0 9 * * 1-5\", timezone: \"UTC\" },\n },\n {\n label: \"Webhook\",\n blockType: \"core#webhook\",\n group: \"core\",\n description: \"Fires when a provider POSTs to this workflow's URL.\",\n defaultConfig: { methods: \"POST\", scheme: \"none\", responseMode: \"async\" },\n },\n {\n label: \"Document event\",\n blockType: `${REACTOR_PIECE}#trigger:document-event`,\n group: \"powerhouse\",\n description: \"Fires when a matching document operation lands.\",\n defaultConfig: {},\n },\n {\n label: \"Document created\",\n blockType: `${REACTOR_PIECE}#trigger:document-created`,\n group: \"powerhouse\",\n description: \"Fires when a document is added to a drive.\",\n defaultConfig: {},\n },\n {\n label: \"Document deleted\",\n blockType: `${REACTOR_PIECE}#trigger:document-deleted`,\n group: \"powerhouse\",\n description: \"Fires when a document is removed from a drive.\",\n defaultConfig: {},\n },\n];\n\nexport const STEP_PRESETS: BlockPreset[] = [\n {\n label: \"Branch\",\n blockType: \"core#branch\",\n group: \"core\",\n description: \"Routes true/false on a condition.\",\n defaultConfig: { condition: \"{{trigger.payload.ok}}\" },\n },\n {\n label: \"Assert\",\n blockType: \"core#assert\",\n group: \"core\",\n description:\n \"Fails the run when a value is blank, rejected or not allowed.\",\n defaultConfig: { value: \"\", allowValues: [] },\n },\n {\n label: \"Create document\",\n blockType: `${REACTOR_PIECE}#document-create`,\n group: \"powerhouse\",\n description: \"Creates a Powerhouse document.\",\n defaultConfig: { documentType: \"\", name: \"\" },\n },\n {\n label: \"Dispatch actions\",\n blockType: `${REACTOR_PIECE}#document-dispatch`,\n group: \"powerhouse\",\n description: \"Sends actions to a document.\",\n defaultConfig: { documentId: \"\" },\n },\n {\n label: \"Get document\",\n blockType: `${REACTOR_PIECE}#document-get`,\n group: \"powerhouse\",\n description: \"Reads a document's current state.\",\n defaultConfig: { documentId: \"\" },\n },\n {\n label: \"Find documents\",\n blockType: `${REACTOR_PIECE}#document-find`,\n group: \"powerhouse\",\n description: \"Lists documents by type and name.\",\n defaultConfig: { documentType: \"\" },\n },\n {\n label: \"List document types\",\n blockType: `${REACTOR_PIECE}#document-types`,\n group: \"powerhouse\",\n description: \"Document models installed on this reactor.\",\n defaultConfig: {},\n },\n {\n label: \"Get document schema\",\n blockType: `${REACTOR_PIECE}#document-schema`,\n group: \"powerhouse\",\n description: \"Action and state schemas of a document type.\",\n defaultConfig: { documentType: \"\" },\n },\n];\n","// Design-time channel to the workflow-runtime subgraph: piece descriptors\n// and dynamic option resolution. Not document-model coupled.\nimport { ambientRenownTokenProvider } from \"@powerhousedao/reactor-browser/graphql-client\";\nimport {\n CORE_FORMS,\n POLL_INTERVAL_PROP,\n type BlockForm,\n type BlockFormProp,\n type ErrorHandlingDefaults,\n type PropertyGroup,\n} from \"./ui/forms.js\";\nimport { isReactorPieceBlock } from \"./ui/blocks.js\";\n\nexport const DEFAULT_RUNTIME_URL =\n \"http://localhost:4001/graphql/workflow-runtime\";\n\nlet currentRuntimeUrl: string | undefined;\n\n// Set by useSyncWorkflowRuntimeUrl from the drive's resolved switchboard URL.\nexport function setRuntimeUrl(url: string): void {\n if (url === currentRuntimeUrl) return;\n currentRuntimeUrl = url;\n // Cached design-time results belong to the previous switchboard.\n formCache.clear();\n outputTreeCache.clear();\n catalogCache = undefined;\n}\n\nfunction runtimeUrl(): string {\n return currentRuntimeUrl ?? DEFAULT_RUNTIME_URL;\n}\n\nasync function gql<T>(\n query: string,\n variables: Record<string, unknown>,\n): Promise<T> {\n // Mirrors the reactor-browser switchboard AI tool's auth: attach the\n // Renown bearer token when one is available, else go out anonymously.\n const token = await ambientRenownTokenProvider();\n const response = await fetch(runtimeUrl(), {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n ...(token ? { authorization: `Bearer ${token}` } : {}),\n },\n body: JSON.stringify({ query, variables }),\n });\n const body = (await response.json()) as {\n data?: T;\n errors?: { message: string }[];\n };\n if (body.errors?.length) throw new Error(body.errors[0].message);\n if (!body.data) throw new Error(\"Empty GraphQL response\");\n return body.data;\n}\n\ninterface BlockEntryDescriptor {\n displayName: string;\n description?: string;\n requireAuth: boolean;\n props: BlockFormProp[];\n // Triggers only: POLLING | WEBHOOK | APP_WEBHOOK.\n strategy?: string;\n propertyGroups?: PropertyGroup[];\n classification?: string;\n errorHandlingOptions?: ErrorHandlingDefaults;\n}\n\ninterface BlockDescriptorResult {\n workflowRuntime: {\n blockDescriptor: {\n displayName: string;\n auth?: unknown;\n action?: BlockEntryDescriptor;\n trigger?: BlockEntryDescriptor;\n } | null;\n };\n}\n\nconst formCache = new Map<string, Promise<BlockForm | null>>();\n\nexport function getBlockForm(blockType: string): Promise<BlockForm | null> {\n const core = CORE_FORMS[blockType] as BlockForm | undefined;\n if (core) return Promise.resolve(core);\n let cached = formCache.get(blockType);\n if (!cached) {\n cached = gql<BlockDescriptorResult>(\n `query Descriptor($blockType: String!) {\n workflowRuntime { blockDescriptor(blockType: $blockType) }\n }`,\n { blockType },\n ).then((data) => {\n const descriptor = data.workflowRuntime.blockDescriptor;\n const entry = descriptor?.action ?? descriptor?.trigger;\n if (!descriptor || !entry) return null;\n const isTrigger = !descriptor.action && Boolean(descriptor.trigger);\n // A poll cadence is meaningless for a trigger the provider pushes to,\n // or for one this reactor fires itself, so the prop is only offered\n // where it actually applies.\n const polled =\n isTrigger &&\n entry.strategy !== \"WEBHOOK\" &&\n !isReactorPieceBlock(blockType);\n const props = entry.props;\n return {\n title: `${descriptor.displayName} · ${entry.displayName}`,\n requireAuth: entry.requireAuth,\n auth: !descriptor.auth\n ? (\"none\" as const)\n : entry.requireAuth\n ? (\"required\" as const)\n : (\"optional\" as const),\n props: polled ? [...props, POLL_INTERVAL_PROP] : props,\n triggerStrategy: isTrigger ? entry.strategy : undefined,\n ...(entry.description ? { description: entry.description } : {}),\n ...(entry.propertyGroups\n ? { propertyGroups: entry.propertyGroups }\n : {}),\n ...(entry.classification\n ? { classification: entry.classification }\n : {}),\n ...(entry.errorHandlingOptions\n ? { errorHandling: entry.errorHandlingOptions }\n : {}),\n };\n });\n formCache.set(blockType, cached);\n cached.catch(() => formCache.delete(blockType));\n }\n return cached;\n}\n\nexport interface PieceSummary {\n name: string;\n displayName: string;\n description: string;\n logoUrl: string;\n version: string;\n actionCount: number;\n triggerCount: number;\n // Activepieces category ids, e.g. ARTIFICIAL_INTELLIGENCE, SALES_AND_CRM.\n categories: string[];\n // PieceAuth descriptor, verbatim from the piece; null when authless.\n auth?: unknown;\n // Why none of the piece's blocks can run on this reactor.\n unsupported?: string | null;\n deprecated?: boolean;\n}\n\nexport interface PieceActionEntry {\n name: string;\n displayName: string;\n description: string;\n blockType: string;\n unsupported?: string | null;\n}\n\nlet catalogCache: Promise<PieceSummary[]> | undefined;\n\nexport function fetchPieceCatalog(): Promise<PieceSummary[]> {\n catalogCache ??= gql<{ workflowRuntime: { pieceCatalog: PieceSummary[] } }>(\n `query Catalog { workflowRuntime { pieceCatalog } }`,\n {},\n ).then((data) => data.workflowRuntime.pieceCatalog);\n catalogCache.catch(() => (catalogCache = undefined));\n return catalogCache;\n}\n\nexport async function fetchPieceActions(\n packageName: string,\n): Promise<PieceActionEntry[]> {\n const data = await gql<{\n workflowRuntime: { pieceActions: { actions: PieceActionEntry[] } };\n }>(\n `query Actions($packageName: String!) {\n workflowRuntime { pieceActions(packageName: $packageName) }\n }`,\n { packageName },\n );\n return data.workflowRuntime.pieceActions.actions;\n}\n\nexport interface PieceTriggerEntry {\n name: string;\n displayName: string;\n description: string;\n strategy: string;\n blockType: string;\n unsupported?: string | null;\n}\n\nexport async function fetchPieceTriggers(\n packageName: string,\n): Promise<PieceTriggerEntry[]> {\n const data = await gql<{\n workflowRuntime: { pieceTriggers: { triggers: PieceTriggerEntry[] } };\n }>(\n `query Triggers($packageName: String!) {\n workflowRuntime { pieceTriggers(packageName: $packageName) }\n }`,\n { packageName },\n );\n return data.workflowRuntime.pieceTriggers.triggers;\n}\n\nexport interface BlockSearchHit {\n blockType: string;\n pieceName: string;\n pieceDisplayName: string;\n logoUrl: string;\n displayName: string;\n description: string;\n kind: \"action\" | \"trigger\";\n strategy: string | null;\n unsupported: string | null;\n}\n\nexport interface BlockSearchResult {\n status: \"ready\" | \"indexing\" | \"error\";\n hits: BlockSearchHit[];\n indexedPieces: number;\n error: string | null;\n}\n\n// Catalog-wide action/trigger search; \"indexing\" on the very first calls.\nexport async function searchBlocks(\n query: string,\n limit = 30,\n): Promise<BlockSearchResult> {\n const data = await gql<{\n workflowRuntime: { searchBlocks: BlockSearchResult };\n }>(\n `query SearchBlocks($query: String!, $limit: Int) {\n workflowRuntime { searchBlocks(query: $query, limit: $limit) {\n status indexedPieces error\n hits { blockType pieceName pieceDisplayName logoUrl displayName description kind strategy unsupported }\n } }\n }`,\n { query, limit },\n );\n return data.workflowRuntime.searchBlocks;\n}\n\nexport interface OutputTreeNode {\n name: string;\n type: string;\n description?: string;\n children?: OutputTreeNode[];\n}\n\nexport interface OutputTree {\n source: \"schema\" | \"sample\" | \"static\" | \"none\";\n nodes: OutputTreeNode[];\n}\n\nconst outputTreeCache = new Map<string, Promise<OutputTree>>();\n\nexport function fetchBlockOutputTree(\n blockType: string,\n config: unknown,\n): Promise<OutputTree> {\n const key = `${blockType}:${JSON.stringify(config ?? {})}`;\n let cached = outputTreeCache.get(key);\n if (!cached) {\n cached = gql<{ workflowRuntime: { blockOutputTree: OutputTree } }>(\n `query OutputTree($blockType: String!, $config: Unknown) {\n workflowRuntime { blockOutputTree(blockType: $blockType, config: $config) }\n }`,\n { blockType, config: config ?? {} },\n ).then((data) => data.workflowRuntime.blockOutputTree);\n outputTreeCache.set(key, cached);\n cached.catch(() => outputTreeCache.delete(key));\n }\n return cached;\n}\n\nexport interface ConnectionSummary {\n id: string;\n name: string;\n connectorId: string;\n authType: string;\n status: string;\n accountLabel: string | null;\n}\n\n// Deliberately uncached. The server scopes this list to the caller's read\n// access, and nothing here identifies the caller to key a cache on.\nexport function fetchConnections(): Promise<ConnectionSummary[]> {\n return gql<{\n workflowRuntime: { connections: ConnectionSummary[] };\n }>(\n `query Connections { workflowRuntime { connections { id name connectorId authType status accountLabel } } }`,\n {},\n ).then((data) => data.workflowRuntime.connections);\n}\n\n// Kept for the picker, which creates connections and then refreshes; there is\n// no longer a cache for it to drop.\nexport function invalidateConnections(): void {}\n\nexport interface ConnectionCheckResult {\n ok: boolean;\n detail: string;\n accountLabel: string | null;\n}\n\n// Runs the piece's own connection check against a document's stored credentials.\n// No secrets cross this boundary: the subgraph resolves refs server-side.\nexport function checkConnection(\n connectionId: string,\n): Promise<ConnectionCheckResult> {\n return gql<{\n workflowRuntime: { checkConnection: ConnectionCheckResult };\n }>(\n `mutation CheckConnection($connectionId: String!) {\n workflowRuntime {\n checkConnection(connectionId: $connectionId) {\n ok\n detail\n accountLabel\n }\n }\n }`,\n { connectionId },\n ).then((data) => data.workflowRuntime.checkConnection);\n}\n\nexport interface SecretStat {\n ref: string;\n label: string | null;\n version: number;\n status: \"ACTIVE\" | \"DELETED\";\n createdAt: string;\n updatedAt: string;\n}\n\nconst SECRET_FIELDS = \"ref label version status createdAt updatedAt\";\n\n// Mints a managed secret; only the returned ref ever enters a document.\nexport async function createSecret(\n value: string,\n label?: string,\n): Promise<SecretStat> {\n const data = await gql<{ workflowRuntime: { createSecret: SecretStat } }>(\n `mutation CreateSecret($value: String!, $label: String) {\n workflowRuntime { createSecret(value: $value, label: $label) { ${SECRET_FIELDS} } }\n }`,\n { value, label: label ?? null },\n );\n return data.workflowRuntime.createSecret;\n}\n\n// Same ref, version+1; referencing documents stay untouched.\nexport async function rotateSecret(\n ref: string,\n value: string,\n): Promise<SecretStat> {\n const data = await gql<{ workflowRuntime: { rotateSecret: SecretStat } }>(\n `mutation RotateSecret($ref: String!, $value: String!) {\n workflowRuntime { rotateSecret(ref: $ref, value: $value) { ${SECRET_FIELDS} } }\n }`,\n { ref, value },\n );\n return data.workflowRuntime.rotateSecret;\n}\n\n// Metadata only; null for unknown or legacy refs.\nexport async function fetchSecretStat(ref: string): Promise<SecretStat | null> {\n const data = await gql<{ workflowRuntime: { secret: SecretStat | null } }>(\n `query Secret($ref: String!) {\n workflowRuntime { secret(ref: $ref) { ${SECRET_FIELDS} } }\n }`,\n { ref },\n );\n return data.workflowRuntime.secret;\n}\n\nexport interface WebhookEndpointRecord {\n workflowId: string;\n url: string;\n // False when `url` is a bare path because the reactor has no public origin.\n absoluteUrl: boolean;\n armed: boolean;\n createdAt: string;\n}\n\n// Never cached: the runtime mints the endpoint on the first call and `armed`\n// tracks the workflow's status.\nexport async function fetchWebhookEndpoint(\n workflowId: string,\n): Promise<WebhookEndpointRecord | null> {\n const data = await gql<{\n workflowRuntime: { webhookEndpoint: WebhookEndpointRecord | null };\n }>(\n `query WebhookEndpoint($workflowId: String!) {\n workflowRuntime {\n webhookEndpoint(workflowId: $workflowId) {\n workflowId url absoluteUrl armed createdAt\n }\n }\n }`,\n { workflowId },\n );\n return data.workflowRuntime.webhookEndpoint;\n}\n\nexport async function testTrigger(workflowId: string): Promise<unknown> {\n const data = await gql<{ workflowRuntime: { testTrigger: unknown } }>(\n `mutation TestTrigger($workflowId: String!) {\n workflowRuntime { testTrigger(workflowId: $workflowId) }\n }`,\n { workflowId },\n );\n return data.workflowRuntime.testTrigger;\n}\n\nexport interface RunStepRecord {\n stepId: string;\n stepKey: string;\n blockType: string;\n status: string;\n input: unknown;\n output: unknown;\n port: string | null;\n error: string | null;\n // Null for skipped and replayed steps, and for runs journaled before timings.\n startedAt: string | null;\n endedAt: string | null;\n}\n\nexport interface RunRecord {\n id: string;\n workflowId: string;\n workflowName: string;\n workflowVersion: number;\n triggerKind: string;\n triggerPayload: unknown;\n status: string;\n error: string | null;\n startedAt: string;\n endedAt: string | null;\n rerunOf: string | null;\n steps: RunStepRecord[];\n}\n\nconst RUN_FIELDS = `id workflowId workflowName workflowVersion triggerKind\n triggerPayload status error startedAt endedAt rerunOf\n steps { stepId stepKey blockType status input output port error startedAt endedAt }`;\n\nexport interface RunsScope {\n workflowId?: string;\n // Scopes runs to the workflows the drive holds; ignored alongside workflowId.\n driveId?: string;\n limit?: number;\n}\n\nexport async function fetchRuns(scope: RunsScope = {}): Promise<RunRecord[]> {\n const data = await gql<{ workflowRuntime: { runs: RunRecord[] } }>(\n `query Runs($workflowId: String, $driveId: String, $limit: Int) {\n workflowRuntime { runs(workflowId: $workflowId, driveId: $driveId, limit: $limit) { ${RUN_FIELDS} } }\n }`,\n {\n workflowId: scope.workflowId ?? null,\n driveId: scope.driveId ?? null,\n limit: scope.limit ?? 30,\n },\n );\n return data.workflowRuntime.runs;\n}\n\nexport interface FireResult {\n runId: string | null;\n status: string;\n error: string | null;\n}\n\nexport async function fireWorkflow(\n workflowId: string,\n payload?: unknown,\n): Promise<FireResult> {\n const data = await gql<{ workflowRuntime: { fire: FireResult } }>(\n `mutation Fire($workflowId: String!, $payload: Unknown) {\n workflowRuntime { fire(workflowId: $workflowId, payload: $payload) { runId status error } }\n }`,\n { workflowId, payload: payload ?? {} },\n );\n return data.workflowRuntime.fire;\n}\n\n// Resume a FAILED run: succeeded steps replay, execution restarts at the\n// failure. Returns the new run.\nexport async function rerunRun(runId: string): Promise<FireResult> {\n const data = await gql<{ workflowRuntime: { rerun: FireResult } }>(\n `mutation Rerun($runId: String!) {\n workflowRuntime { rerun(runId: $runId) { runId status error } }\n }`,\n { runId },\n );\n return data.workflowRuntime.rerun;\n}\n\ninterface BlockOptionsResult {\n workflowRuntime: { blockOptions: unknown };\n}\n\nexport async function loadBlockOptions(\n blockType: string,\n propName: string,\n input: Record<string, unknown>,\n connectionId?: string,\n searchValue?: string,\n): Promise<unknown> {\n const data = await gql<BlockOptionsResult>(\n `query Options($blockType: String!, $propName: String!, $input: Unknown, $connectionId: String, $searchValue: String) {\n workflowRuntime { blockOptions(blockType: $blockType, propName: $propName, input: $input, connectionId: $connectionId, searchValue: $searchValue) }\n }`,\n {\n blockType,\n propName,\n input,\n connectionId: connectionId ?? null,\n searchValue: searchValue ?? null,\n },\n );\n return data.workflowRuntime.blockOptions;\n}\n"],"mappings":";;AAgKA,MAAa,qBAAoC;CAC/C,MAAM;CACN,aAAa;CACb,MAAM;CACN,UAAU;CACV,aACE;AACJ;AAEA,MAAM,QACJ,MACA,aACA,WAAW,OACX,iBACmB;CACnB;CACA;CACA,MAAM;CACN;CACA;AACF;AAIA,MAAM,aACJ,MACA,aACA,WAAW,OACX,iBACmB;CACnB;CACA;CACA,MAAM;CACN;CACA;AACF;AAEA,MAAM,UACJ,MACA,aACA,WAAW,OACX,iBACmB;CACnB;CACA;CACA,MAAM;CACN;CACA;AACF;AAGA,MAAM,YAAY,UAAwC;CACxD,GAAG;CACH,UAAU;AACZ;AAGA,MAAM,aACJ,MACA,SACA,WACmB;CAAE,GAAG;CAAM,UAAU;EAAE,MAAM;EAAS;CAAM;AAAE;AAEnE,MAAM,YACJ,MACA,aACA,SACA,WAA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AAE,OAAO;KAA+B,OAAO;IAAO;IACtD;KAAE,OAAO;KAA4B,OAAO;IAAQ;IACpD;KAAE,OAAO;KAAe,OAAO;IAAO;IACtC;KACE,OAAO;KACP,OAAO;IACT;IACA;KACE,OAAO;KACP,OAAO;IACT;GACF,GACA,IACF;GAGA,UACE,UACE,aACA,UACA,MACA,sFACF,GACA,UACA,cACF;GACA,SACE,UACE,KACE,UACA,UACA,OACA,4IACF,GACA,UACA,cACF,CACF;GACA,SACE,UACE,OACE,oBACA,2BACA,OACA,4FACF,GACA,UACA,CAAC,kBAAkB,CACrB,CACF;GAGA,SACE,UACE,SAAS,aAAa,QAAQ;IAC5B;KAAE,OAAO;KAAqB,OAAO;IAAS;IAC9C;KAAE,OAAO;KAAS,OAAO;IAAO;IAChC;KAAE,OAAO;KAAW,OAAO;IAAS;GACtC,CAAC,GACD,UACA,YACF,CACF;GACA,SACE,UACE,SAAS,YAAY,mBAAmB,CACtC;IAAE,OAAO;IAAyB,OAAO;GAAM,GAC/C;IAAE,OAAO;IAAU,OAAO;GAAS,CACrC,CAAC,GACD,UACA,YACF,CACF;GACA,SACE,UACE,KACE,UACA,mBACA,OACA,oJACF,GACA,UACA,CAAC,eAAe,CAClB,CACF;GACA,SACE,KACE,eACA,kBACA,OACA,iQACF,CACF;GACA,SACE,OACE,oBACA,2BACA,OACA,iDACF,CACF;GACA,SACE,KACE,kBACA,mBACA,OACA,wJACF,CACF;GACA,SACE,SACE,gBACA,YACA,CACE;IAAE,OAAO;IAA4B,OAAO;GAAQ,GACpD;IAAE,OAAO;IAA0B,OAAO;GAAO,CACnD,GACA,OACA,0DACF,CACF;GACA,SACE,OACE,kBACA,kBACA,OACA,4DACF,CACF;EACF;CACF;CACA,eAAe;EACb,OAAO;EACP,aAAa;EACb,MAAM;EACN,OAAO,CACL,KACE,aACA,aACA,MACA,qCACF,GACA,KACE,UACA,UACA,OACA,8EACF,CACF;CACF;CACA,eAAe;EACb,OAAO;EACP,aAAa;EACb,MAAM;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C+D,cAAc;QAE7E;EAAE;EAAK;CAAM,CACf,EAAA,CACY,gBAAgB;AAC9B;AAGA,eAAsB,gBAAgB,KAAyC;CAO7E,QAAO,MANY,IACjB;8CAC0C,cAAc;QAExD,EAAE,IAAI,CACR,EAAA,CACY,gBAAgB;AAC9B;AAaA,eAAsB,qBACpB,YACuC;CAavC,QAAO,MAZY,IAGjB;;;;;;QAOA,EAAE,WAAW,CACf,EAAA,CACY,gBAAgB;AAC9B;AAEA,eAAsB,YAAY,YAAsC;CAOtE,QAAO,MANY,IACjB;;QAGA,EAAE,WAAW,CACf,EAAA,CACY,gBAAgB;AAC9B;AA+BA,MAAM,aAAa;;;AAWnB,eAAsB,UAAU,QAAmB,CAAC,GAAyB;CAW3E,QAAO,MAVY,IACjB;4FACwF,WAAW;QAEnG;EACE,YAAY,MAAM,cAAc;EAChC,SAAS,MAAM,WAAW;EAC1B,OAAO,MAAM,SAAS;CACxB,CACF,EAAA,CACY,gBAAgB;AAC9B;AAQA,eAAsB,aACpB,YACA,SACqB;CAOrB,QAAO,MANY,IACjB;;QAGA;EAAE;EAAY,SAAS,WAAW,CAAC;CAAE,CACvC,EAAA,CACY,gBAAgB;AAC9B;AAIA,eAAsB,SAAS,OAAoC;CAOjE,QAAO,MANY,IACjB;;QAGA,EAAE,MAAM,CACV,EAAA,CACY,gBAAgB;AAC9B;AAMA,eAAsB,iBACpB,WACA,UACA,OACA,cACA,aACkB;CAalB,QAAO,MAZY,IACjB;;QAGA;EACE;EACA;EACA;EACA,cAAc,gBAAgB;EAC9B,aAAa,eAAe;CAC9B,CACF,EAAA,CACY,gBAAgB;AAC9B"}
@@ -1,5 +1,5 @@
1
- import { c as fetchPieceTriggers, o as fetchPieceActions, s as fetchPieceCatalog, v as searchBlocks } from "./runtime-api-xwvg5PzA.mjs";
2
- import { N as IconButton, c as registerPieceSource, r as blockMeta } from "./BlockSelector-COZm6-ev.mjs";
1
+ import { c as fetchPieceTriggers, o as fetchPieceActions, s as fetchPieceCatalog, v as searchBlocks } from "./runtime-api-DDMQc4PB.mjs";
2
+ import { N as IconButton, c as registerPieceSource, r as blockMeta } from "./BlockSelector-CTmmpYxu.mjs";
3
3
  import { Suspense, lazy, useState } from "react";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  //#region editors/workflow-editor/runtime-piece-source.ts
@@ -225,7 +225,7 @@ function flowOrder(model) {
225
225
  }
226
226
  //#endregion
227
227
  //#region editors/shared/data-viewer.tsx
228
- const DataTree = lazy(() => import("./data-tree-CmiGqG7C.mjs"));
228
+ const DataTree = lazy(() => import("./data-tree-CbqpF3lC.mjs"));
229
229
  function stringify(value) {
230
230
  try {
231
231
  return JSON.stringify(value, null, 2) ?? "";
@@ -548,4 +548,4 @@ function describeTrigger(trigger) {
548
548
  //#endregion
549
549
  export { draftFromConfig as a, DataViewer as c, flowOrder as d, layoutWorkflow as f, configFromDraft as i, acyclicTargets as l, reachableFrom as m, describeSchedule as n, switchKind as o, portRank as p, describeTrigger as r, timezoneOf as s, describeCron as t, attachableSteps as u };
550
550
 
551
- //# sourceMappingURL=trigger-text-qj_U3Qzd.mjs.map
551
+ //# sourceMappingURL=trigger-text-Bzq6VfOQ.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"trigger-text-qj_U3Qzd.mjs","names":["isInt"],"sources":["../../editors/workflow-editor/runtime-piece-source.ts","../../editors/workflow-editor/ui/ap-layout.ts","../../editors/shared/data-viewer.tsx","../../editors/workflow-editor/ui/schedule-draft.ts","../../editors/workflow-editor/ui/trigger-text.ts"],"sourcesContent":["// Wires the ui/ piece-catalog seam to the workflow-runtime subgraph. Imported\n// for its side effect by every editor shell that renders block metadata\n// (logos come from the catalog, so the studio needs it too).\nimport {\n fetchPieceActions,\n fetchPieceCatalog,\n fetchPieceTriggers,\n searchBlocks,\n} from \"./runtime-api.js\";\nimport { registerPieceSource } from \"./ui/piece-source.js\";\n\nregisterPieceSource({\n loadCatalog: fetchPieceCatalog,\n loadActions: fetchPieceActions,\n loadTriggers: fetchPieceTriggers,\n searchBlocks,\n});\n","// Vertical tree layout, a port of the Activepieces builder flow-canvas\n// layout behavior (MIT, activepieces packages/web) onto our flat graph.\nimport type { Edge, Node } from \"@xyflow/react\";\nimport type { EdgeModel, StepModel, WorkflowModel } from \"./model.js\";\n\nexport function reachableFrom(start: string, edges: EdgeModel[]): Set<string> {\n const outgoing = new Map<string, string[]>();\n for (const edge of edges) {\n const list = outgoing.get(edge.from) ?? [];\n list.push(edge.to);\n outgoing.set(edge.from, list);\n }\n const seen = new Set<string>([start]);\n const queue = [start];\n while (queue.length > 0) {\n for (const next of outgoing.get(queue.pop()!) ?? []) {\n if (!seen.has(next)) {\n seen.add(next);\n queue.push(next);\n }\n }\n }\n return seen;\n}\n\n// Steps an edge from `fromId` may target without creating a cycle.\nexport function acyclicTargets(\n model: WorkflowModel,\n fromId: string,\n): StepModel[] {\n return model.steps.filter(\n (step) =>\n step.id !== fromId && !reachableFrom(step.id, model.edges).has(fromId),\n );\n}\n\n// Steps a new edge from `fromId` may target: unreachable from the trigger,\n// not `fromId` itself, and not an ancestor of it (no cycles).\nexport function attachableSteps(\n model: WorkflowModel,\n fromId: string,\n): StepModel[] {\n if (!model.trigger) return [];\n const attached = reachableFrom(model.trigger.id, model.edges);\n return model.steps.filter(\n (step) =>\n !attached.has(step.id) &&\n step.id !== fromId &&\n !reachableFrom(step.id, model.edges).has(fromId),\n );\n}\n\nexport const STEP_WIDTH = 232;\nexport const STEP_HEIGHT = 60;\nexport const VSPACE = 60;\nexport const HSPACE = 80;\nexport const ADD_BUTTON_SIZE = 20;\nexport const BIG_ADD_BUTTON_SIZE = 50;\n\nconst PORT_ORDER = [\"next\", \"true\", \"false\", \"error\"];\n\nexport function portRank(port: string): number {\n const index = PORT_ORDER.indexOf(port);\n return index === -1 ? PORT_ORDER.length : index;\n}\n\nexport interface ApLayout {\n nodes: Node[];\n edges: Edge[];\n}\n\n// Builds react-flow nodes/edges: steps laid out as a centered vertical tree,\n// append buttons under leaves, and one add button per edge.\nexport function layoutWorkflow(model: WorkflowModel): ApLayout {\n const nodes: Node[] = [];\n const edges: Edge[] = [];\n\n if (!model.trigger) {\n nodes.push({\n id: \"__big-add\",\n type: \"apBigButton\",\n position: { x: -BIG_ADD_BUTTON_SIZE / 2, y: 0 },\n data: {},\n draggable: false,\n selectable: false,\n });\n return { nodes, edges };\n }\n\n const stepIds = new Set(model.steps.map((step) => step.id));\n const outgoing = new Map<string, EdgeModel[]>();\n for (const edge of model.edges) {\n if (!stepIds.has(edge.to)) continue;\n const list = outgoing.get(edge.from) ?? [];\n list.push(edge);\n outgoing.set(edge.from, list);\n }\n for (const list of outgoing.values()) {\n list.sort((a, b) => portRank(a.port) - portRank(b.port));\n }\n\n const placed = new Set<string>();\n const stepById = new Map(model.steps.map((step) => [step.id, step]));\n\n const branchPorts = (id: string): string[] =>\n stepById.get(id)?.blockType === \"core#branch\" ? [\"true\", \"false\"] : [];\n\n // An unwired branch port still occupies a column: it gets a placeholder card\n // where its step would go, so both branches read as branches.\n const outletsOf = (\n id: string,\n used: (target: string) => boolean,\n ): { port: string; edge?: EdgeModel }[] => {\n const edges = (outgoing.get(id) ?? []).filter((edge) => !used(edge.to));\n const ports = branchPorts(id);\n if (ports.length === 0) {\n return edges.map((edge) => ({ port: edge.port, edge }));\n }\n const wired = new Set(edges.map((edge) => edge.port));\n return [\n ...edges.map((edge) => ({ port: edge.port, edge })),\n ...ports.filter((port) => !wired.has(port)).map((port) => ({ port })),\n ].sort((a, b) => portRank(a.port) - portRank(b.port));\n };\n\n const subtreeWidth = (id: string, visited: Set<string>): number => {\n if (visited.has(id)) return STEP_WIDTH;\n visited.add(id);\n const outlets = outletsOf(id, (target) => visited.has(target));\n if (outlets.length === 0) return STEP_WIDTH;\n const total = outlets\n .map((outlet) =>\n outlet.edge ? subtreeWidth(outlet.edge.to, visited) : STEP_WIDTH,\n )\n .reduce((sum, width) => sum + width, 0);\n return Math.max(STEP_WIDTH, total + (outlets.length - 1) * HSPACE);\n };\n\n // Centre of the column reserved for an unwired port, keyed \"stepId:port\".\n const placeholders = new Map<string, { x: number; y: number }>();\n\n const place = (id: string, centerX: number, y: number) => {\n if (placed.has(id)) return;\n placed.add(id);\n const step = stepById.get(id);\n const isTrigger = id === model.trigger?.id;\n nodes.push({\n id,\n type: \"apStep\",\n position: { x: centerX - STEP_WIDTH / 2, y },\n data: isTrigger\n ? { kind: \"trigger\", trigger: model.trigger }\n : { kind: \"step\", step },\n draggable: false,\n });\n\n const outlets = outletsOf(id, (target) => placed.has(target));\n const widths = outlets.map((outlet) =>\n outlet.edge ? subtreeWidth(outlet.edge.to, new Set(placed)) : STEP_WIDTH,\n );\n const total =\n widths.reduce((sum, width) => sum + width, 0) +\n Math.max(outlets.length - 1, 0) * HSPACE;\n const childY = y + STEP_HEIGHT + VSPACE;\n let cursor = centerX - total / 2;\n outlets.forEach((outlet, index) => {\n const slotCenter = cursor + widths[index] / 2;\n if (outlet.edge) {\n place(outlet.edge.to, slotCenter, childY);\n } else {\n placeholders.set(`${id}:${outlet.port}`, { x: slotCenter, y: childY });\n }\n cursor += widths[index] + HSPACE;\n });\n };\n\n place(model.trigger.id, 0, 0);\n\n // Steps unreachable from the trigger stack in a column to the right.\n let orphanY = 0;\n const mainWidth = subtreeWidth(model.trigger.id, new Set());\n for (const step of model.steps) {\n if (placed.has(step.id)) continue;\n place(step.id, mainWidth / 2 + HSPACE + STEP_WIDTH / 2, orphanY);\n orphanY += STEP_HEIGHT + VSPACE;\n }\n\n const nodeById = new Map(nodes.map((node) => [node.id, node]));\n\n for (const edge of model.edges) {\n if (!nodeById.has(edge.from) || !nodeById.has(edge.to)) continue;\n edges.push({\n id: edge.id,\n type: \"apEdge\",\n source: edge.from,\n target: edge.to,\n data: { edgeId: edge.id, port: edge.port, condition: edge.condition },\n selectable: true,\n });\n }\n\n // Append buttons under every step with no outgoing edges (branches get\n // one per untaken port).\n const candidatePorts = (id: string): string[] => {\n if (id === model.trigger?.id) return [\"next\"];\n const step = stepById.get(id);\n if (!step) return [];\n return step.blockType === \"core#branch\" ? [\"true\", \"false\"] : [\"next\"];\n };\n\n const appendPorts = (id: string): string[] => {\n const used = new Set((outgoing.get(id) ?? []).map((edge) => edge.port));\n return candidatePorts(id).filter((port) => !used.has(port));\n };\n\n for (const node of [...nodes]) {\n if (node.type !== \"apStep\") continue;\n appendPorts(node.id).forEach((port) => {\n const slot = placeholders.get(`${node.id}:${port}`);\n const buttonId = `__append:${node.id}:${port}`;\n nodes.push({\n id: buttonId,\n type: \"apAppend\",\n position: slot\n ? { x: slot.x - STEP_WIDTH / 2, y: slot.y }\n : {\n x: node.position.x + STEP_WIDTH / 2 - ADD_BUTTON_SIZE / 2,\n y:\n node.position.y +\n STEP_HEIGHT +\n VSPACE / 2 -\n ADD_BUTTON_SIZE / 2,\n },\n data: { parentId: node.id, port, card: Boolean(slot) },\n draggable: false,\n selectable: false,\n });\n edges.push({\n id: `${buttonId}:line`,\n type: \"apLink\",\n source: node.id,\n target: buttonId,\n data: { port },\n selectable: false,\n });\n });\n }\n\n return { nodes, edges };\n}\n\n// Steps in the order a run meets them (depth first, branches in port order),\n// then anything the trigger can't reach, in authored order.\nexport function flowOrder(model: WorkflowModel): string[] {\n const stepIds = new Set(model.steps.map((step) => step.id));\n const seen = new Set<string>();\n const order: string[] = [];\n const visit = (from: string) => {\n const next = model.edges\n .filter((edge) => edge.from === from && stepIds.has(edge.to))\n .sort((a, b) => portRank(a.port) - portRank(b.port));\n for (const edge of next) {\n if (seen.has(edge.to)) continue;\n seen.add(edge.to);\n order.push(edge.to);\n visit(edge.to);\n }\n };\n if (model.trigger) visit(model.trigger.id);\n for (const step of model.steps) {\n if (!seen.has(step.id)) order.push(step.id);\n }\n return order;\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 { lazy, Suspense, useState } from \"react\";\nimport { IconButton } from \"./controls.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\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=\"max-h-72 overflow-auto\">\n <Suspense fallback={<TreeSkeleton />}>\n <DataTree value={props.value as object} root={props.root} />\n </Suspense>\n </div>\n )}\n </div>\n </section>\n );\n}\n","// The schedule trigger's config as the builder edits it: daily, weekly, a\n// fixed interval, or a raw cron for anything the presets can't say.\n\nexport type IntervalUnit = \"minutes\" | \"hours\" | \"days\";\n\nexport type ScheduleDraft =\n | { kind: \"daily\"; time: string; weekdaysOnly: boolean }\n | { kind: \"weekly\"; time: string; days: number[] }\n | { kind: \"interval\"; every: number; unit: IntervalUnit }\n | { kind: \"custom\"; cron: string };\n\nexport type ScheduleKind = ScheduleDraft[\"kind\"];\n\nexport const DEFAULT_TIME = \"09:00\";\nexport const DEFAULT_TIMEZONE = \"UTC\";\n\nfunction isInt(field: string): boolean {\n return /^\\d+$/.test(field);\n}\n\nfunction toTime(hour: string, minute: string): string {\n return `${hour.padStart(2, \"0\")}:${minute.padStart(2, \"0\")}`;\n}\n\nfunction fromTime(time: string): { hour: number; minute: number } {\n const [hour = \"9\", minute = \"0\"] = time.split(\":\");\n return { hour: Number(hour), minute: Number(minute) };\n}\n\nconst UNIT_MS: [IntervalUnit, number][] = [\n [\"days\", 86_400_000],\n [\"hours\", 3_600_000],\n [\"minutes\", 60_000],\n];\n\n/** An interval config's cadence, from `every` + `unit` or a bare `everyMs`. */\nexport function intervalOf(\n record: Record<string, unknown>,\n): { every: number; unit: IntervalUnit } | undefined {\n const every = Number(record.every);\n if (record.every !== undefined && Number.isFinite(every) && every > 0) {\n const unit =\n record.unit === \"hours\" || record.unit === \"days\"\n ? record.unit\n : \"minutes\";\n return { every, unit };\n }\n const ms = Number(record.everyMs);\n if (record.everyMs === undefined || !Number.isFinite(ms) || ms <= 0) {\n return undefined;\n }\n // The largest unit it divides into evenly; sub-minute rounds up to a minute.\n for (const [unit, size] of UNIT_MS) {\n if (ms % size === 0) return { every: ms / size, unit };\n }\n return { every: Math.max(1, Math.round(ms / 60_000)), unit: \"minutes\" };\n}\n\n/** Reads a stored config back into the builder's terms. */\nexport function draftFromConfig(config: unknown): ScheduleDraft {\n const record = (config ?? {}) as Record<string, unknown>;\n const interval =\n record.mode === \"interval\" ||\n (!record.cron &&\n (record.every !== undefined || record.everyMs !== undefined));\n if (interval) {\n return {\n kind: \"interval\",\n ...(intervalOf(record) ?? { every: 15, unit: \"minutes\" }),\n };\n }\n const cron = typeof record.cron === \"string\" ? record.cron.trim() : \"\";\n if (!cron) return { kind: \"daily\", time: DEFAULT_TIME, weekdaysOnly: false };\n const fields = cron.split(/\\s+/);\n if (fields.length !== 5) return { kind: \"custom\", cron };\n const [minute, hour, dayOfMonth, month, dayOfWeek] = fields;\n if (!isInt(minute) || !isInt(hour) || dayOfMonth !== \"*\" || month !== \"*\") {\n return { kind: \"custom\", cron };\n }\n const time = toTime(hour, minute);\n if (dayOfWeek === \"*\") return { kind: \"daily\", time, weekdaysOnly: false };\n if (dayOfWeek === \"1-5\") return { kind: \"daily\", time, weekdaysOnly: true };\n const days = dayOfWeek.split(\",\");\n if (days.every((day) => isInt(day) && Number(day) <= 7)) {\n const unique = [...new Set(days.map((day) => Number(day) % 7))];\n return { kind: \"weekly\", time, days: unique.sort((a, b) => a - b) };\n }\n return { kind: \"custom\", cron };\n}\n\n/** The cron a draft stands for; undefined for an interval. */\nexport function cronFromDraft(draft: ScheduleDraft): string | undefined {\n switch (draft.kind) {\n case \"daily\": {\n const { hour, minute } = fromTime(draft.time);\n return `${minute} ${hour} * * ${draft.weekdaysOnly ? \"1-5\" : \"*\"}`;\n }\n case \"weekly\": {\n const { hour, minute } = fromTime(draft.time);\n const days = draft.days.length > 0 ? draft.days.join(\",\") : \"1\";\n return `${minute} ${hour} * * ${days}`;\n }\n case \"custom\":\n return draft.cron;\n case \"interval\":\n return undefined;\n }\n}\n\n/** The config the runtime reads; UTC is the default, so it isn't stored. */\nexport function configFromDraft(\n draft: ScheduleDraft,\n timezone: string,\n): Record<string, unknown> {\n const zone =\n timezone && timezone !== DEFAULT_TIMEZONE ? { timezone } : undefined;\n if (draft.kind === \"interval\") {\n return { mode: \"interval\", every: draft.every, unit: draft.unit, ...zone };\n }\n return { mode: \"cron\", cron: cronFromDraft(draft), ...zone };\n}\n\n/** Switches kind, keeping whatever carries over (the time, mostly). */\nexport function switchKind(\n draft: ScheduleDraft,\n kind: ScheduleKind,\n): ScheduleDraft {\n if (draft.kind === kind) return draft;\n const time = \"time\" in draft ? draft.time : DEFAULT_TIME;\n switch (kind) {\n case \"daily\":\n return { kind, time, weekdaysOnly: false };\n case \"weekly\":\n return { kind, time, days: [1] };\n case \"interval\":\n return { kind, every: 15, unit: \"minutes\" };\n case \"custom\":\n return { kind, cron: cronFromDraft(draft) ?? \"0 9 * * *\" };\n }\n}\n\nexport function timezoneOf(config: unknown): string {\n const zone = (config as { timezone?: unknown } | null)?.timezone;\n return typeof zone === \"string\" && zone ? zone : DEFAULT_TIMEZONE;\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 { blockMeta } from \"./block-meta.js\";\nimport { intervalOf } from \"./schedule-draft.js\";\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 const record = (config ?? {}) as Record<string, unknown>;\n const zone =\n typeof record.timezone === \"string\" && record.timezone\n ? record.timezone\n : \"UTC\";\n const interval =\n record.mode === \"interval\" ||\n (!record.cron &&\n (record.every !== undefined || record.everyMs !== undefined));\n if (interval) {\n const cadence = intervalOf(record);\n if (!cadence) return \"On a fixed interval\";\n const unit = UNIT_LABEL[cadence.unit];\n return cadence.every === 1\n ? `Every ${unit[0]}`\n : `Every ${cadence.every} ${unit[1]}`;\n }\n const cron = typeof record.cron === \"string\" ? record.cron : \"\";\n if (!cron) return \"On a schedule\";\n const described = describeCron(cron);\n return described ? `${described} ${zone}` : `On schedule ${cron}`;\n}\n\n/** When a workflow starts, from its trigger. */\nexport function describeTrigger(\n trigger: { blockType: string; config: unknown } | null | undefined,\n): string {\n if (!trigger) return \"Never starts: no trigger\";\n switch (trigger.blockType) {\n case \"core#manual\":\n return \"Manual\";\n case \"core#webhook\":\n return \"When its webhook is called\";\n case \"core#schedule\":\n return describeSchedule(trigger.config);\n default: {\n const meta = blockMeta(trigger.blockType);\n const piece = meta.subtitle.replace(/ · Trigger$/, \"\");\n return `${meta.displayName} in ${piece}`;\n }\n }\n}\n"],"mappings":";;;;;AAWA,oBAAoB;CAClB,aAAa;CACb,aAAa;CACb,cAAc;CACd;AACF,CAAC;;;ACXD,SAAgB,cAAc,OAAe,OAAiC;CAC5E,MAAM,2BAAW,IAAI,IAAsB;CAC3C,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,OAAO,SAAS,IAAI,KAAK,IAAI,KAAK,CAAC;EACzC,KAAK,KAAK,KAAK,EAAE;EACjB,SAAS,IAAI,KAAK,MAAM,IAAI;CAC9B;CACA,MAAM,uBAAO,IAAI,IAAY,CAAC,KAAK,CAAC;CACpC,MAAM,QAAQ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WACP;CAKN,IAHE,OAAO,SAAS,cACf,CAAC,OAAO,SACN,OAAO,UAAU,KAAA,KAAa,OAAO,YAAY,KAAA,IACxC;EACZ,MAAM,UAAU,WAAW,MAAM;EACjC,IAAI,CAAC,SAAS,OAAO;EACrB,MAAM,OAAO,WAAW,QAAQ;EAChC,OAAO,QAAQ,UAAU,IACrB,SAAS,KAAK,OACd,SAAS,QAAQ,MAAM,GAAG,KAAK;CACrC;CACA,MAAM,OAAO,OAAO,OAAO,SAAS,WAAW,OAAO,OAAO;CAC7D,IAAI,CAAC,MAAM,OAAO;CAClB,MAAM,YAAY,aAAa,IAAI;CACnC,OAAO,YAAY,GAAG,UAAU,GAAG,SAAS,eAAe;AAC7D;;AAGA,SAAgB,gBACd,SACQ;CACR,IAAI,CAAC,SAAS,OAAO;CACrB,QAAQ,QAAQ,WAAhB;EACE,KAAK,eACH,OAAO;EACT,KAAK,gBACH,OAAO;EACT,KAAK,iBACH,OAAO,iBAAiB,QAAQ,MAAM;EACxC,SAAS;GACP,MAAM,OAAO,UAAU,QAAQ,SAAS;GACxC,MAAM,QAAQ,KAAK,SAAS,QAAQ,eAAe,EAAE;GACrD,OAAO,GAAG,KAAK,YAAY,MAAM;EACnC;CACF;AACF"}
1
+ {"version":3,"file":"trigger-text-Bzq6VfOQ.mjs","names":["isInt"],"sources":["../../editors/workflow-editor/runtime-piece-source.ts","../../editors/workflow-editor/ui/ap-layout.ts","../../editors/shared/data-viewer.tsx","../../editors/workflow-editor/ui/schedule-draft.ts","../../editors/workflow-editor/ui/trigger-text.ts"],"sourcesContent":["// Wires the ui/ piece-catalog seam to the workflow-runtime subgraph. Imported\n// for its side effect by every editor shell that renders block metadata\n// (logos come from the catalog, so the studio needs it too).\nimport {\n fetchPieceActions,\n fetchPieceCatalog,\n fetchPieceTriggers,\n searchBlocks,\n} from \"./runtime-api.js\";\nimport { registerPieceSource } from \"./ui/piece-source.js\";\n\nregisterPieceSource({\n loadCatalog: fetchPieceCatalog,\n loadActions: fetchPieceActions,\n loadTriggers: fetchPieceTriggers,\n searchBlocks,\n});\n","// Vertical tree layout, a port of the Activepieces builder flow-canvas\n// layout behavior (MIT, activepieces packages/web) onto our flat graph.\nimport type { Edge, Node } from \"@xyflow/react\";\nimport type { EdgeModel, StepModel, WorkflowModel } from \"./model.js\";\n\nexport function reachableFrom(start: string, edges: EdgeModel[]): Set<string> {\n const outgoing = new Map<string, string[]>();\n for (const edge of edges) {\n const list = outgoing.get(edge.from) ?? [];\n list.push(edge.to);\n outgoing.set(edge.from, list);\n }\n const seen = new Set<string>([start]);\n const queue = [start];\n while (queue.length > 0) {\n for (const next of outgoing.get(queue.pop()!) ?? []) {\n if (!seen.has(next)) {\n seen.add(next);\n queue.push(next);\n }\n }\n }\n return seen;\n}\n\n// Steps an edge from `fromId` may target without creating a cycle.\nexport function acyclicTargets(\n model: WorkflowModel,\n fromId: string,\n): StepModel[] {\n return model.steps.filter(\n (step) =>\n step.id !== fromId && !reachableFrom(step.id, model.edges).has(fromId),\n );\n}\n\n// Steps a new edge from `fromId` may target: unreachable from the trigger,\n// not `fromId` itself, and not an ancestor of it (no cycles).\nexport function attachableSteps(\n model: WorkflowModel,\n fromId: string,\n): StepModel[] {\n if (!model.trigger) return [];\n const attached = reachableFrom(model.trigger.id, model.edges);\n return model.steps.filter(\n (step) =>\n !attached.has(step.id) &&\n step.id !== fromId &&\n !reachableFrom(step.id, model.edges).has(fromId),\n );\n}\n\nexport const STEP_WIDTH = 232;\nexport const STEP_HEIGHT = 60;\nexport const VSPACE = 60;\nexport const HSPACE = 80;\nexport const ADD_BUTTON_SIZE = 20;\nexport const BIG_ADD_BUTTON_SIZE = 50;\n\nconst PORT_ORDER = [\"next\", \"true\", \"false\", \"error\"];\n\nexport function portRank(port: string): number {\n const index = PORT_ORDER.indexOf(port);\n return index === -1 ? PORT_ORDER.length : index;\n}\n\nexport interface ApLayout {\n nodes: Node[];\n edges: Edge[];\n}\n\n// Builds react-flow nodes/edges: steps laid out as a centered vertical tree,\n// append buttons under leaves, and one add button per edge.\nexport function layoutWorkflow(model: WorkflowModel): ApLayout {\n const nodes: Node[] = [];\n const edges: Edge[] = [];\n\n if (!model.trigger) {\n nodes.push({\n id: \"__big-add\",\n type: \"apBigButton\",\n position: { x: -BIG_ADD_BUTTON_SIZE / 2, y: 0 },\n data: {},\n draggable: false,\n selectable: false,\n });\n return { nodes, edges };\n }\n\n const stepIds = new Set(model.steps.map((step) => step.id));\n const outgoing = new Map<string, EdgeModel[]>();\n for (const edge of model.edges) {\n if (!stepIds.has(edge.to)) continue;\n const list = outgoing.get(edge.from) ?? [];\n list.push(edge);\n outgoing.set(edge.from, list);\n }\n for (const list of outgoing.values()) {\n list.sort((a, b) => portRank(a.port) - portRank(b.port));\n }\n\n const placed = new Set<string>();\n const stepById = new Map(model.steps.map((step) => [step.id, step]));\n\n const branchPorts = (id: string): string[] =>\n stepById.get(id)?.blockType === \"core#branch\" ? [\"true\", \"false\"] : [];\n\n // An unwired branch port still occupies a column: it gets a placeholder card\n // where its step would go, so both branches read as branches.\n const outletsOf = (\n id: string,\n used: (target: string) => boolean,\n ): { port: string; edge?: EdgeModel }[] => {\n const edges = (outgoing.get(id) ?? []).filter((edge) => !used(edge.to));\n const ports = branchPorts(id);\n if (ports.length === 0) {\n return edges.map((edge) => ({ port: edge.port, edge }));\n }\n const wired = new Set(edges.map((edge) => edge.port));\n return [\n ...edges.map((edge) => ({ port: edge.port, edge })),\n ...ports.filter((port) => !wired.has(port)).map((port) => ({ port })),\n ].sort((a, b) => portRank(a.port) - portRank(b.port));\n };\n\n const subtreeWidth = (id: string, visited: Set<string>): number => {\n if (visited.has(id)) return STEP_WIDTH;\n visited.add(id);\n const outlets = outletsOf(id, (target) => visited.has(target));\n if (outlets.length === 0) return STEP_WIDTH;\n const total = outlets\n .map((outlet) =>\n outlet.edge ? subtreeWidth(outlet.edge.to, visited) : STEP_WIDTH,\n )\n .reduce((sum, width) => sum + width, 0);\n return Math.max(STEP_WIDTH, total + (outlets.length - 1) * HSPACE);\n };\n\n // Centre of the column reserved for an unwired port, keyed \"stepId:port\".\n const placeholders = new Map<string, { x: number; y: number }>();\n\n const place = (id: string, centerX: number, y: number) => {\n if (placed.has(id)) return;\n placed.add(id);\n const step = stepById.get(id);\n const isTrigger = id === model.trigger?.id;\n nodes.push({\n id,\n type: \"apStep\",\n position: { x: centerX - STEP_WIDTH / 2, y },\n data: isTrigger\n ? { kind: \"trigger\", trigger: model.trigger }\n : { kind: \"step\", step },\n draggable: false,\n });\n\n const outlets = outletsOf(id, (target) => placed.has(target));\n const widths = outlets.map((outlet) =>\n outlet.edge ? subtreeWidth(outlet.edge.to, new Set(placed)) : STEP_WIDTH,\n );\n const total =\n widths.reduce((sum, width) => sum + width, 0) +\n Math.max(outlets.length - 1, 0) * HSPACE;\n const childY = y + STEP_HEIGHT + VSPACE;\n let cursor = centerX - total / 2;\n outlets.forEach((outlet, index) => {\n const slotCenter = cursor + widths[index] / 2;\n if (outlet.edge) {\n place(outlet.edge.to, slotCenter, childY);\n } else {\n placeholders.set(`${id}:${outlet.port}`, { x: slotCenter, y: childY });\n }\n cursor += widths[index] + HSPACE;\n });\n };\n\n place(model.trigger.id, 0, 0);\n\n // Steps unreachable from the trigger stack in a column to the right.\n let orphanY = 0;\n const mainWidth = subtreeWidth(model.trigger.id, new Set());\n for (const step of model.steps) {\n if (placed.has(step.id)) continue;\n place(step.id, mainWidth / 2 + HSPACE + STEP_WIDTH / 2, orphanY);\n orphanY += STEP_HEIGHT + VSPACE;\n }\n\n const nodeById = new Map(nodes.map((node) => [node.id, node]));\n\n for (const edge of model.edges) {\n if (!nodeById.has(edge.from) || !nodeById.has(edge.to)) continue;\n edges.push({\n id: edge.id,\n type: \"apEdge\",\n source: edge.from,\n target: edge.to,\n data: { edgeId: edge.id, port: edge.port, condition: edge.condition },\n selectable: true,\n });\n }\n\n // Append buttons under every step with no outgoing edges (branches get\n // one per untaken port).\n const candidatePorts = (id: string): string[] => {\n if (id === model.trigger?.id) return [\"next\"];\n const step = stepById.get(id);\n if (!step) return [];\n return step.blockType === \"core#branch\" ? [\"true\", \"false\"] : [\"next\"];\n };\n\n const appendPorts = (id: string): string[] => {\n const used = new Set((outgoing.get(id) ?? []).map((edge) => edge.port));\n return candidatePorts(id).filter((port) => !used.has(port));\n };\n\n for (const node of [...nodes]) {\n if (node.type !== \"apStep\") continue;\n appendPorts(node.id).forEach((port) => {\n const slot = placeholders.get(`${node.id}:${port}`);\n const buttonId = `__append:${node.id}:${port}`;\n nodes.push({\n id: buttonId,\n type: \"apAppend\",\n position: slot\n ? { x: slot.x - STEP_WIDTH / 2, y: slot.y }\n : {\n x: node.position.x + STEP_WIDTH / 2 - ADD_BUTTON_SIZE / 2,\n y:\n node.position.y +\n STEP_HEIGHT +\n VSPACE / 2 -\n ADD_BUTTON_SIZE / 2,\n },\n data: { parentId: node.id, port, card: Boolean(slot) },\n draggable: false,\n selectable: false,\n });\n edges.push({\n id: `${buttonId}:line`,\n type: \"apLink\",\n source: node.id,\n target: buttonId,\n data: { port },\n selectable: false,\n });\n });\n }\n\n return { nodes, edges };\n}\n\n// Steps in the order a run meets them (depth first, branches in port order),\n// then anything the trigger can't reach, in authored order.\nexport function flowOrder(model: WorkflowModel): string[] {\n const stepIds = new Set(model.steps.map((step) => step.id));\n const seen = new Set<string>();\n const order: string[] = [];\n const visit = (from: string) => {\n const next = model.edges\n .filter((edge) => edge.from === from && stepIds.has(edge.to))\n .sort((a, b) => portRank(a.port) - portRank(b.port));\n for (const edge of next) {\n if (seen.has(edge.to)) continue;\n seen.add(edge.to);\n order.push(edge.to);\n visit(edge.to);\n }\n };\n if (model.trigger) visit(model.trigger.id);\n for (const step of model.steps) {\n if (!seen.has(step.id)) order.push(step.id);\n }\n return order;\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 { lazy, Suspense, useState } from \"react\";\nimport { IconButton } from \"./controls.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\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=\"max-h-72 overflow-auto\">\n <Suspense fallback={<TreeSkeleton />}>\n <DataTree value={props.value as object} root={props.root} />\n </Suspense>\n </div>\n )}\n </div>\n </section>\n );\n}\n","// The schedule trigger's config as the builder edits it: daily, weekly, a\n// fixed interval, or a raw cron for anything the presets can't say.\n\nexport type IntervalUnit = \"minutes\" | \"hours\" | \"days\";\n\nexport type ScheduleDraft =\n | { kind: \"daily\"; time: string; weekdaysOnly: boolean }\n | { kind: \"weekly\"; time: string; days: number[] }\n | { kind: \"interval\"; every: number; unit: IntervalUnit }\n | { kind: \"custom\"; cron: string };\n\nexport type ScheduleKind = ScheduleDraft[\"kind\"];\n\nexport const DEFAULT_TIME = \"09:00\";\nexport const DEFAULT_TIMEZONE = \"UTC\";\n\nfunction isInt(field: string): boolean {\n return /^\\d+$/.test(field);\n}\n\nfunction toTime(hour: string, minute: string): string {\n return `${hour.padStart(2, \"0\")}:${minute.padStart(2, \"0\")}`;\n}\n\nfunction fromTime(time: string): { hour: number; minute: number } {\n const [hour = \"9\", minute = \"0\"] = time.split(\":\");\n return { hour: Number(hour), minute: Number(minute) };\n}\n\nconst UNIT_MS: [IntervalUnit, number][] = [\n [\"days\", 86_400_000],\n [\"hours\", 3_600_000],\n [\"minutes\", 60_000],\n];\n\n/** An interval config's cadence, from `every` + `unit` or a bare `everyMs`. */\nexport function intervalOf(\n record: Record<string, unknown>,\n): { every: number; unit: IntervalUnit } | undefined {\n const every = Number(record.every);\n if (record.every !== undefined && Number.isFinite(every) && every > 0) {\n const unit =\n record.unit === \"hours\" || record.unit === \"days\"\n ? record.unit\n : \"minutes\";\n return { every, unit };\n }\n const ms = Number(record.everyMs);\n if (record.everyMs === undefined || !Number.isFinite(ms) || ms <= 0) {\n return undefined;\n }\n // The largest unit it divides into evenly; sub-minute rounds up to a minute.\n for (const [unit, size] of UNIT_MS) {\n if (ms % size === 0) return { every: ms / size, unit };\n }\n return { every: Math.max(1, Math.round(ms / 60_000)), unit: \"minutes\" };\n}\n\n/** Reads a stored config back into the builder's terms. */\nexport function draftFromConfig(config: unknown): ScheduleDraft {\n const record = (config ?? {}) as Record<string, unknown>;\n const interval =\n record.mode === \"interval\" ||\n (!record.cron &&\n (record.every !== undefined || record.everyMs !== undefined));\n if (interval) {\n return {\n kind: \"interval\",\n ...(intervalOf(record) ?? { every: 15, unit: \"minutes\" }),\n };\n }\n const cron = typeof record.cron === \"string\" ? record.cron.trim() : \"\";\n if (!cron) return { kind: \"daily\", time: DEFAULT_TIME, weekdaysOnly: false };\n const fields = cron.split(/\\s+/);\n if (fields.length !== 5) return { kind: \"custom\", cron };\n const [minute, hour, dayOfMonth, month, dayOfWeek] = fields;\n if (!isInt(minute) || !isInt(hour) || dayOfMonth !== \"*\" || month !== \"*\") {\n return { kind: \"custom\", cron };\n }\n const time = toTime(hour, minute);\n if (dayOfWeek === \"*\") return { kind: \"daily\", time, weekdaysOnly: false };\n if (dayOfWeek === \"1-5\") return { kind: \"daily\", time, weekdaysOnly: true };\n const days = dayOfWeek.split(\",\");\n if (days.every((day) => isInt(day) && Number(day) <= 7)) {\n const unique = [...new Set(days.map((day) => Number(day) % 7))];\n return { kind: \"weekly\", time, days: unique.sort((a, b) => a - b) };\n }\n return { kind: \"custom\", cron };\n}\n\n/** The cron a draft stands for; undefined for an interval. */\nexport function cronFromDraft(draft: ScheduleDraft): string | undefined {\n switch (draft.kind) {\n case \"daily\": {\n const { hour, minute } = fromTime(draft.time);\n return `${minute} ${hour} * * ${draft.weekdaysOnly ? \"1-5\" : \"*\"}`;\n }\n case \"weekly\": {\n const { hour, minute } = fromTime(draft.time);\n const days = draft.days.length > 0 ? draft.days.join(\",\") : \"1\";\n return `${minute} ${hour} * * ${days}`;\n }\n case \"custom\":\n return draft.cron;\n case \"interval\":\n return undefined;\n }\n}\n\n/** The config the runtime reads; UTC is the default, so it isn't stored. */\nexport function configFromDraft(\n draft: ScheduleDraft,\n timezone: string,\n): Record<string, unknown> {\n const zone =\n timezone && timezone !== DEFAULT_TIMEZONE ? { timezone } : undefined;\n if (draft.kind === \"interval\") {\n return { mode: \"interval\", every: draft.every, unit: draft.unit, ...zone };\n }\n return { mode: \"cron\", cron: cronFromDraft(draft), ...zone };\n}\n\n/** Switches kind, keeping whatever carries over (the time, mostly). */\nexport function switchKind(\n draft: ScheduleDraft,\n kind: ScheduleKind,\n): ScheduleDraft {\n if (draft.kind === kind) return draft;\n const time = \"time\" in draft ? draft.time : DEFAULT_TIME;\n switch (kind) {\n case \"daily\":\n return { kind, time, weekdaysOnly: false };\n case \"weekly\":\n return { kind, time, days: [1] };\n case \"interval\":\n return { kind, every: 15, unit: \"minutes\" };\n case \"custom\":\n return { kind, cron: cronFromDraft(draft) ?? \"0 9 * * *\" };\n }\n}\n\nexport function timezoneOf(config: unknown): string {\n const zone = (config as { timezone?: unknown } | null)?.timezone;\n return typeof zone === \"string\" && zone ? zone : DEFAULT_TIMEZONE;\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 { blockMeta } from \"./block-meta.js\";\nimport { intervalOf } from \"./schedule-draft.js\";\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 const record = (config ?? {}) as Record<string, unknown>;\n const zone =\n typeof record.timezone === \"string\" && record.timezone\n ? record.timezone\n : \"UTC\";\n const interval =\n record.mode === \"interval\" ||\n (!record.cron &&\n (record.every !== undefined || record.everyMs !== undefined));\n if (interval) {\n const cadence = intervalOf(record);\n if (!cadence) return \"On a fixed interval\";\n const unit = UNIT_LABEL[cadence.unit];\n return cadence.every === 1\n ? `Every ${unit[0]}`\n : `Every ${cadence.every} ${unit[1]}`;\n }\n const cron = typeof record.cron === \"string\" ? record.cron : \"\";\n if (!cron) return \"On a schedule\";\n const described = describeCron(cron);\n return described ? `${described} ${zone}` : `On schedule ${cron}`;\n}\n\n/** When a workflow starts, from its trigger. */\nexport function describeTrigger(\n trigger: { blockType: string; config: unknown } | null | undefined,\n): string {\n if (!trigger) return \"Never starts: no trigger\";\n switch (trigger.blockType) {\n case \"core#manual\":\n return \"Manual\";\n case \"core#webhook\":\n return \"When its webhook is called\";\n case \"core#schedule\":\n return describeSchedule(trigger.config);\n default: {\n const meta = blockMeta(trigger.blockType);\n const piece = meta.subtitle.replace(/ · Trigger$/, \"\");\n return `${meta.displayName} in ${piece}`;\n }\n }\n}\n"],"mappings":";;;;;AAWA,oBAAoB;CAClB,aAAa;CACb,aAAa;CACb,cAAc;CACd;AACF,CAAC;;;ACXD,SAAgB,cAAc,OAAe,OAAiC;CAC5E,MAAM,2BAAW,IAAI,IAAsB;CAC3C,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,OAAO,SAAS,IAAI,KAAK,IAAI,KAAK,CAAC;EACzC,KAAK,KAAK,KAAK,EAAE;EACjB,SAAS,IAAI,KAAK,MAAM,IAAI;CAC9B;CACA,MAAM,uBAAO,IAAI,IAAY,CAAC,KAAK,CAAC;CACp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,WAC1C,OAAO,WACP;CAKN,IAHE,OAAO,SAAS,cACf,CAAC,OAAO,SACN,OAAO,UAAU,KAAA,KAAa,OAAO,YAAY,KAAA,IACxC;EACZ,MAAM,UAAU,WAAW,MAAM;EACjC,IAAI,CAAC,SAAS,OAAO;EACrB,MAAM,OAAO,WAAW,QAAQ;EAChC,OAAO,QAAQ,UAAU,IACrB,SAAS,KAAK,OACd,SAAS,QAAQ,MAAM,GAAG,KAAK;CACrC;CACA,MAAM,OAAO,OAAO,OAAO,SAAS,WAAW,OAAO,OAAO;CAC7D,IAAI,CAAC,MAAM,OAAO;CAClB,MAAM,YAAY,aAAa,IAAI;CACnC,OAAO,YAAY,GAAG,UAAU,GAAG,SAAS,eAAe;AAC7D;;AAGA,SAAgB,gBACd,SACQ;CACR,IAAI,CAAC,SAAS,OAAO;CACrB,QAAQ,QAAQ,WAAhB;EACE,KAAK,eACH,OAAO;EACT,KAAK,gBACH,OAAO;EACT,KAAK,iBACH,OAAO,iBAAiB,QAAQ,MAAM;EACxC,SAAS;GACP,MAAM,OAAO,UAAU,QAAQ,SAAS;GACxC,MAAM,QAAQ,KAAK,SAAS,QAAQ,eAAe,EAAE;GACrD,OAAO,GAAG,KAAK,YAAY,MAAM;EACnC;CACF;AACF"}
@@ -57,7 +57,7 @@
57
57
  {
58
58
  "name": "PH_WORKFLOWS_SECRETS_MASTER_KEY",
59
59
  "type": "secret",
60
- "description": "64 hex chars (32 bytes) encrypting connection secrets at rest. Unset, a key is generated at ./.ph/secrets.key and reused; a host whose working directory does not survive a restart must set this or every stored secret becomes undecryptable."
60
+ "description": "64 hex chars (32 bytes) encrypting connection secrets at rest. Required on Postgres; on PGlite, unset generates a key at ./.ph/secrets.key. A key other than the one the secrets were stored with is refused, so a lost key means re-entering every secret."
61
61
  },
62
62
  {
63
63
  "name": "PH_WORKFLOWS_EGRESS_ALLOW_ADDRESSES",