@powerhousedao/workflow 6.2.3-dev.88 → 6.2.3-dev.89
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.
- package/dist/browser/{BlockSelector-BKAJwJ4Y.js → BlockSelector-DFzzAWXh.js} +65 -7
- package/dist/browser/BlockSelector-DFzzAWXh.js.map +1 -0
- package/dist/browser/{connection-form-DltdMa8F.js → connection-form-B6zpGmAm.js} +3 -3
- package/dist/browser/{connection-form-DltdMa8F.js.map → connection-form-B6zpGmAm.js.map} +1 -1
- package/dist/browser/{data-tree-DAw8e0j8.js → data-tree-DKS0EQys.js} +2 -2
- package/dist/browser/{data-tree-DAw8e0j8.js.map → data-tree-DKS0EQys.js.map} +1 -1
- package/dist/browser/{editor-Dl6lzxkM.js → editor-Yt-_V04R.js} +207 -58
- package/dist/browser/editor-Yt-_V04R.js.map +1 -0
- package/dist/browser/{editor-CZLe6CAF.js → editor-bHCkW_XB.js} +4 -4
- package/dist/browser/{editor-CZLe6CAF.js.map → editor-bHCkW_XB.js.map} +1 -1
- package/dist/browser/{editor--J61vLSC.js → editor-gCkAwv09.js} +64 -132
- package/dist/browser/editor-gCkAwv09.js.map +1 -0
- package/dist/browser/editors/connection-editor/module.js +1 -1
- package/dist/browser/editors/runtime/index.js +1 -1
- package/dist/browser/editors/workflow-editor/module.js +1 -1
- package/dist/browser/editors/workflow-studio/module.js +1 -1
- package/dist/browser/index.js +2 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/{runtime-queries-D81Ghpok.js → runtime-queries-C5bqAgQy.js} +84 -13
- package/dist/browser/runtime-queries-C5bqAgQy.js.map +1 -0
- package/dist/browser/{trigger-text-BSVi5oGZ.js → trigger-text-BfIu-QcC.js} +176 -11
- package/dist/browser/trigger-text-BfIu-QcC.js.map +1 -0
- package/dist/node/{BlockSelector-DnTRF-C7.mjs → BlockSelector-Cia1Rpwz.mjs} +64 -6
- package/dist/node/BlockSelector-Cia1Rpwz.mjs.map +1 -0
- package/dist/node/{connection-form-DwSHfIRw.mjs → connection-form-CJFKPwfg.mjs} +3 -3
- package/dist/node/{connection-form-DwSHfIRw.mjs.map → connection-form-CJFKPwfg.mjs.map} +1 -1
- package/dist/node/{data-tree-uSJU9Ost.mjs → data-tree-D9jdFsaX.mjs} +2 -2
- package/dist/node/{data-tree-uSJU9Ost.mjs.map → data-tree-D9jdFsaX.mjs.map} +1 -1
- package/dist/node/{editor-B4ZwM3pR.mjs → editor-CwOjO82y.mjs} +63 -131
- package/dist/node/editor-CwOjO82y.mjs.map +1 -0
- package/dist/node/{editor-_4XHbqGl.mjs → editor-NMRVprgI.mjs} +206 -57
- package/dist/node/editor-NMRVprgI.mjs.map +1 -0
- package/dist/node/{editor-cXi5dIsd.mjs → editor-_c6UDRAN.mjs} +4 -4
- package/dist/node/{editor-cXi5dIsd.mjs.map → editor-_c6UDRAN.mjs.map} +1 -1
- package/dist/node/editors/connection-editor/module.mjs +1 -1
- package/dist/node/editors/runtime/index.mjs +1 -1
- package/dist/node/editors/workflow-editor/module.mjs +1 -1
- package/dist/node/editors/workflow-studio/module.mjs +1 -1
- package/dist/node/index.mjs +2 -1
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/pieces/ai/descriptor.json +70 -1
- package/dist/node/pieces/ai/index.mjs +125 -125
- package/dist/node/pieces/ai/package.json +1 -1
- package/dist/node/pieces/reactor/descriptor.json +35 -1
- package/dist/node/pieces/reactor/index.mjs +39 -39
- package/dist/node/pieces/reactor/package.json +1 -1
- package/dist/node/{runtime-queries-VXJsWno5.mjs → runtime-queries-Ck5OoWdy.mjs} +137 -12
- package/dist/node/runtime-queries-Ck5OoWdy.mjs.map +1 -0
- package/dist/node/{trigger-text-BBP7QVLj.mjs → trigger-text-T2D0a2Br.mjs} +175 -10
- package/dist/node/trigger-text-T2D0a2Br.mjs.map +1 -0
- package/dist/powerhouse.manifest.json +2 -2
- package/dist/style.css +1 -1
- package/dist/types/ai/workflow-tools.d.ts.map +1 -1
- package/dist/types/editors/shared/icons.d.ts +4 -0
- package/dist/types/editors/shared/icons.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/editor.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/runtime-client.d.ts +5 -1
- package/dist/types/editors/workflow-editor/runtime-client.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/BlockSelector.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts +1 -0
- package/dist/types/editors/workflow-editor/ui/PropertyForm.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/StepPanel.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/ap-edge.d.ts +1 -0
- package/dist/types/editors/workflow-editor/ui/ap-edge.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/ap-layout.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/ap-nodes.d.ts +4 -0
- package/dist/types/editors/workflow-editor/ui/ap-nodes.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/block-meta.d.ts +3 -0
- package/dist/types/editors/workflow-editor/ui/block-meta.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/blocks.d.ts +8 -0
- package/dist/types/editors/workflow-editor/ui/blocks.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/canvas-menu.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/flow-control.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/flow-control.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/prop-layout.d.ts +1 -0
- package/dist/types/editors/workflow-editor/ui/prop-layout.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/prop-layout.test.d.ts +2 -0
- package/dist/types/editors/workflow-editor/ui/prop-layout.test.d.ts.map +1 -0
- package/dist/types/editors/workflow-editor/ui/trigger-text.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/use-validity.d.ts.map +1 -1
- package/dist/types/editors/workflow-editor/ui/validation.d.ts +4 -1
- package/dist/types/editors/workflow-editor/ui/validation.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/RunsTable.d.ts +4 -1
- package/dist/types/editors/workflow-studio/components/RunsTable.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/Waitpoints.d.ts +9 -1
- package/dist/types/editors/workflow-studio/components/Waitpoints.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/WorkflowGraph.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/graph-layout.d.ts +1 -0
- package/dist/types/editors/workflow-studio/components/graph-layout.d.ts.map +1 -1
- package/dist/types/editors/workflow-studio/components/tips.d.ts.map +1 -1
- package/dist/types/pieces/ai/lib/actions/decide-on-documents.d.ts.map +1 -1
- package/dist/types/pieces/ai/lib/actions/extract.d.ts.map +1 -1
- package/dist/types/pieces/ai/lib/actions/propose-actions.d.ts.map +1 -1
- package/dist/types/pieces/ai/lib/actions/summarize.d.ts.map +1 -1
- package/dist/types/pieces/reactor/lib/actions/document-find.d.ts.map +1 -1
- package/dist/types/test/ui/flow-control.spec.d.ts +2 -0
- package/dist/types/test/ui/flow-control.spec.d.ts.map +1 -0
- package/package.json +9 -9
- package/dist/browser/BlockSelector-BKAJwJ4Y.js.map +0 -1
- package/dist/browser/editor--J61vLSC.js.map +0 -1
- package/dist/browser/editor-Dl6lzxkM.js.map +0 -1
- package/dist/browser/runtime-queries-D81Ghpok.js.map +0 -1
- package/dist/browser/trigger-text-BSVi5oGZ.js.map +0 -1
- package/dist/node/BlockSelector-DnTRF-C7.mjs.map +0 -1
- package/dist/node/editor-B4ZwM3pR.mjs.map +0 -1
- package/dist/node/editor-_4XHbqGl.mjs.map +0 -1
- package/dist/node/runtime-queries-VXJsWno5.mjs.map +0 -1
- package/dist/node/trigger-text-BBP7QVLj.mjs.map +0 -1
|
@@ -2,12 +2,12 @@ import { i as __toESM, r as __require, t as __commonJSMin } from "./rolldown-run
|
|
|
2
2
|
import { h as REACTOR_CONNECTOR_ID, x as actions } from "./module-BEEASith.mjs";
|
|
3
3
|
import { t as useConnectionDocumentById } from "./connection-BZxipUlb.mjs";
|
|
4
4
|
import { i as connectorIdForPiece, l as planFromAuth, s as packageFromConnectorId } from "./piece-auth-C0u0XTO8.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { Ft as scheduleConfigIssue, It as stepPortLabel, Lt as stepPorts, Pt as parseScheduleConfig, Q as CALLABLE_FLOW_TRIGGER, _t as stepFields, b as realRuns, ct as STEP_PRESETS, f as stepOutputTreeQuery, g as blockRefKey, gt as stepBlock, ht as sameBlock, i as outputTreeQuery, jt as knownPorts, kt as flowPorts, n as catalogQuery, pt as isCoreBlock, u as runsQuery, ut as TRIGGER_PRESETS, vt as triggerBlock, y as TEST_TRIGGER_KIND, yt as triggerFields } from "./runtime-queries-Ck5OoWdy.mjs";
|
|
6
|
+
import { At as Button, B as DesignTimeProvider, C as TONE_DOT, Ct as useRuntime, D as formatAbsolute, Ft as Segmented, G as useBlockResolutions, H as useBlockFormLoader, Ht as textAreaClass, It as Select, J as useDesignTime, K as useCachedBlockForm, Kt as DocumentErrorBoundary, Lt as Switch, M as formatWhen, Mt as FieldLabel, Nt as Hint, O as formatDuration, Ot as useSearchParam, Pt as IconButton, Q as useLatestRun, R as toneOf, Rt as Tabs, St as useRunsQuery, U as useBlockForms, Ut as textInputClass, V as useBlockForm, W as useBlockPorts, Wt as Icon, X as useDynamicLookup, Z as useDynamicPrefetch, _ as useBlockMeta, a as BlockResolutionsProvider, at as blockMissing, c as runsDifferentVersion, d as versionBadge, dt as storedSchema, g as stepSubtitle, gt as WorkflowRuntimeProvider, h as pieceLogo, ht as workflowReadiness, i as PickerPopover, it as useWebhookEndpoint, jt as FieldError, l as updateVersion, lt as resolverInputFor, m as pieceDisplayName, n as BlockSelector, nt as useTestStepRunner, o as VersionSummary, p as namedByCoreTab, pt as undeclaredPortIssues, q as useConnectionList, r as PICKER_SIZE, rt as useTestTrigger, s as resolutionText, st as isPropVisible, t as BlockLogo, tt as useRunById, u as useResolution, ut as settingFor, v as usePieceLogos, w as TONE_TEXT, wt as useRuntimeActions, x as RUN_TONE } from "./BlockSelector-Cia1Rpwz.mjs";
|
|
7
7
|
import { y as actions$1 } from "./module-CuTg45ct.mjs";
|
|
8
8
|
import { t as useSelectedWorkflowDocument } from "./workflow-BgURVzdc.mjs";
|
|
9
|
-
import { a as useSignInGate, f as connectionCallbacks, g as newUndoGroup, h as groupedAction, i as useReactorAccessDenial, l as reactorConnections, m as UndoRedo, n as SignInPrompt, o as missingInPublished, p as BackButton, r as usePublisher, s as runsAsText, t as ConnectionForm } from "./connection-form-
|
|
10
|
-
import { A as
|
|
9
|
+
import { a as useSignInGate, f as connectionCallbacks, g as newUndoGroup, h as groupedAction, i as useReactorAccessDenial, l as reactorConnections, m as UndoRedo, n as SignInPrompt, o as missingInPublished, p as BackButton, r as usePublisher, s as runsAsText, t as ConnectionForm } from "./connection-form-CJFKPwfg.mjs";
|
|
10
|
+
import { A as ExpressionTargetProvider, B as documentShape, C as PropertyForm, D as ExpressionPickerButton, E as useSecretRef, F as VARIABLE_TYPES, G as usePendingEcho, H as contextMenuItems, I as VARIABLE_TYPE_LABEL, L as convertVariableValue, M as useExpressionField, N as EMPTY_SCOPE, O as ExpressionPickerPopup, P as buildExpressionScope, R as parseTypedValue, S as PiecePlaceholderContext, T as withPropDefaults, U as menuHeight, V as stateFieldsFromSdl, W as menuPosition, _ as STEP_PARAM, a as StepError, b as uniqueStepKey, d as PublishButton, f as PublishState, g as usePublish, h as StatusToggle, i as DataViewer, j as ExpressionTokenLine, k as ExpressionScopeSourceProvider, l as DraftBanner, m as ReactorDenialNote, n as describeSchedule, p as PublishedMissingNote, r as describeTrigger, s as graphLayout, t as describeCron, u as ManagedBanner, v as VARIABLES_VIEW, w as lacksDefaults, x as AvailableSoon, y as hasDraftChanges, z as valueMismatch } from "./trigger-text-T2D0a2Br.mjs";
|
|
11
11
|
import { addDocument, dispatchActions, useDocumentModelModules, useDocumentSafe, useFileNodesInSelectedDrive, useSelectedDriveId } from "@powerhousedao/reactor-browser";
|
|
12
12
|
import { generateId } from "document-model";
|
|
13
13
|
import React, { createContext, forwardRef, memo, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
@@ -482,14 +482,19 @@ function attachableSteps(model, fromId) {
|
|
|
482
482
|
return model.steps.filter((step) => !attached.has(step.id) && step.id !== fromId && !reachableFrom(step.id, model.edges).has(fromId));
|
|
483
483
|
}
|
|
484
484
|
const PORT_ORDER = [
|
|
485
|
+
"each",
|
|
485
486
|
"next",
|
|
486
487
|
"true",
|
|
487
|
-
"false"
|
|
488
|
-
"error"
|
|
488
|
+
"false"
|
|
489
489
|
];
|
|
490
490
|
function portRank(port) {
|
|
491
491
|
const index = PORT_ORDER.indexOf(port);
|
|
492
|
-
|
|
492
|
+
if (index !== -1) return index;
|
|
493
|
+
const branch = /^branch_(\d+)$/.exec(port);
|
|
494
|
+
if (branch) return PORT_ORDER.length + 1 - 1 / Number(branch[1]);
|
|
495
|
+
if (port === "otherwise") return PORT_ORDER.length + 1;
|
|
496
|
+
if (port === "error") return PORT_ORDER.length + 2;
|
|
497
|
+
return PORT_ORDER.length + 3;
|
|
493
498
|
}
|
|
494
499
|
function layoutWorkflow(model, portsOf = () => void 0) {
|
|
495
500
|
const nodes = [];
|
|
@@ -520,12 +525,16 @@ function layoutWorkflow(model, portsOf = () => void 0) {
|
|
|
520
525
|
outgoing.set(edge.from, list);
|
|
521
526
|
}
|
|
522
527
|
for (const list of outgoing.values()) list.sort((a, b) => portRank(a.port) - portRank(b.port));
|
|
523
|
-
const placed = /* @__PURE__ */ new Set();
|
|
524
528
|
const stepById = new Map(model.steps.map((step) => [step.id, step]));
|
|
525
529
|
const declared = (id) => {
|
|
526
530
|
const step = stepById.get(id);
|
|
527
|
-
|
|
528
|
-
|
|
531
|
+
if (id === model.trigger?.id) return portsOf(triggerBlock(model.trigger));
|
|
532
|
+
const wired = (outgoing.get(id) ?? []).map((edge) => edge.port);
|
|
533
|
+
return step ? stepPorts(stepBlock(step), step.config, portsOf, wired) : void 0;
|
|
534
|
+
};
|
|
535
|
+
const labelOf = (id, port) => {
|
|
536
|
+
const step = stepById.get(id);
|
|
537
|
+
return step ? stepPortLabel(stepBlock(step), step.config, port) : void 0;
|
|
529
538
|
};
|
|
530
539
|
const outPorts = (id) => {
|
|
531
540
|
const ports = declared(id);
|
|
@@ -535,8 +544,50 @@ function layoutWorkflow(model, portsOf = () => void 0) {
|
|
|
535
544
|
const ports = outPorts(id);
|
|
536
545
|
return ports.length > 1 ? ports : [];
|
|
537
546
|
};
|
|
538
|
-
const
|
|
539
|
-
|
|
547
|
+
const reachable = reachableFrom(model.trigger.id, model.edges);
|
|
548
|
+
const via = /* @__PURE__ */ new Map();
|
|
549
|
+
for (const node of graphLayout({
|
|
550
|
+
triggerId: model.trigger.id,
|
|
551
|
+
steps: model.steps,
|
|
552
|
+
edges: model.edges
|
|
553
|
+
}).nodes) if (node.via) via.set(node.step.id, node.via);
|
|
554
|
+
const pending = /* @__PURE__ */ new Map();
|
|
555
|
+
for (const list of outgoing.values()) for (const edge of list) {
|
|
556
|
+
if (!reachable.has(edge.from)) continue;
|
|
557
|
+
pending.set(edge.to, (pending.get(edge.to) ?? 0) + 1);
|
|
558
|
+
}
|
|
559
|
+
const owner = /* @__PURE__ */ new Map();
|
|
560
|
+
const row = /* @__PURE__ */ new Map();
|
|
561
|
+
const visited = /* @__PURE__ */ new Set();
|
|
562
|
+
const visit = (id, gated) => {
|
|
563
|
+
visited.add(id);
|
|
564
|
+
for (const edge of outgoing.get(id) ?? []) {
|
|
565
|
+
if (visited.has(edge.to)) continue;
|
|
566
|
+
const below = row.get(id) + 1;
|
|
567
|
+
row.set(edge.to, gated ? Math.max(row.get(edge.to) ?? 0, below) : below);
|
|
568
|
+
if (gated) {
|
|
569
|
+
const left = pending.get(edge.to) - 1;
|
|
570
|
+
pending.set(edge.to, left);
|
|
571
|
+
if (left > 0) continue;
|
|
572
|
+
}
|
|
573
|
+
const parent = gated ? via.get(edge.to) : void 0;
|
|
574
|
+
const wired = parent && outgoing.get(parent.from)?.includes(parent);
|
|
575
|
+
owner.set(edge.to, wired ? parent : edge);
|
|
576
|
+
visit(edge.to, gated);
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
row.set(model.trigger.id, 0);
|
|
580
|
+
visit(model.trigger.id, true);
|
|
581
|
+
const roots = [];
|
|
582
|
+
for (const step of model.steps) {
|
|
583
|
+
if (visited.has(step.id)) continue;
|
|
584
|
+
roots.push(step.id);
|
|
585
|
+
row.set(step.id, 0);
|
|
586
|
+
visit(step.id, false);
|
|
587
|
+
}
|
|
588
|
+
const owns = (edge) => owner.get(edge.to) === edge;
|
|
589
|
+
const outletsOf = (id) => {
|
|
590
|
+
const edges = outgoing.get(id) ?? [];
|
|
540
591
|
const ports = branchPorts(id);
|
|
541
592
|
if (ports.length === 0) return edges.map((edge) => ({
|
|
542
593
|
port: edge.port,
|
|
@@ -548,20 +599,19 @@ function layoutWorkflow(model, portsOf = () => void 0) {
|
|
|
548
599
|
edge
|
|
549
600
|
})), ...ports.filter((port) => !wired.has(port)).map((port) => ({ port }))].sort((a, b) => portRank(a.port) - portRank(b.port));
|
|
550
601
|
};
|
|
551
|
-
const subtreeWidth = (id
|
|
552
|
-
|
|
553
|
-
visited.add(id);
|
|
554
|
-
const outlets = outletsOf(id, (target) => visited.has(target));
|
|
602
|
+
const subtreeWidth = (id) => {
|
|
603
|
+
const outlets = outletsOf(id);
|
|
555
604
|
if (outlets.length === 0) return 232;
|
|
556
|
-
const total = outlets.map((outlet) => outlet.edge ? subtreeWidth(outlet.edge.to
|
|
605
|
+
const total = outlets.map((outlet) => outlet.edge && owns(outlet.edge) ? subtreeWidth(outlet.edge.to) : 232).reduce((sum, width) => sum + width, 0);
|
|
557
606
|
return Math.max(232, total + (outlets.length - 1) * 80);
|
|
558
607
|
};
|
|
559
608
|
const placeholders = /* @__PURE__ */ new Map();
|
|
560
|
-
const
|
|
561
|
-
|
|
562
|
-
|
|
609
|
+
const lanes = /* @__PURE__ */ new Map();
|
|
610
|
+
const ROW = 120;
|
|
611
|
+
const place = (id, centerX, top) => {
|
|
563
612
|
const step = stepById.get(id);
|
|
564
613
|
const isTrigger = id === model.trigger?.id;
|
|
614
|
+
const y = top + row.get(id) * ROW;
|
|
565
615
|
nodes.push({
|
|
566
616
|
id,
|
|
567
617
|
type: "apStep",
|
|
@@ -581,28 +631,28 @@ function layoutWorkflow(model, portsOf = () => void 0) {
|
|
|
581
631
|
},
|
|
582
632
|
draggable: false
|
|
583
633
|
});
|
|
584
|
-
const outlets = outletsOf(id
|
|
585
|
-
const widths = outlets.map((outlet) => outlet.edge ? subtreeWidth(outlet.edge.to
|
|
586
|
-
|
|
587
|
-
const childY = y + 60 + 60;
|
|
588
|
-
let cursor = centerX - total / 2;
|
|
634
|
+
const outlets = outletsOf(id);
|
|
635
|
+
const widths = outlets.map((outlet) => outlet.edge && owns(outlet.edge) ? subtreeWidth(outlet.edge.to) : 232);
|
|
636
|
+
let cursor = centerX - (widths.reduce((sum, width) => sum + width, 0) + Math.max(outlets.length - 1, 0) * 80) / 2;
|
|
589
637
|
outlets.forEach((outlet, index) => {
|
|
590
638
|
const slotCenter = cursor + widths[index] / 2;
|
|
591
|
-
if (outlet.edge)
|
|
592
|
-
|
|
639
|
+
if (outlet.edge) {
|
|
640
|
+
lanes.set(outlet.edge.id, slotCenter);
|
|
641
|
+
if (owns(outlet.edge)) place(outlet.edge.to, slotCenter, top);
|
|
642
|
+
} else placeholders.set(`${id}:${outlet.port}`, {
|
|
593
643
|
x: slotCenter,
|
|
594
|
-
y:
|
|
644
|
+
y: y + ROW
|
|
595
645
|
});
|
|
596
646
|
cursor += widths[index] + 80;
|
|
597
647
|
});
|
|
598
648
|
};
|
|
599
649
|
place(model.trigger.id, 0, 0);
|
|
650
|
+
const mainWidth = subtreeWidth(model.trigger.id);
|
|
600
651
|
let orphanY = 0;
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
orphanY += 120;
|
|
652
|
+
for (const root of roots) {
|
|
653
|
+
const before = nodes.length;
|
|
654
|
+
place(root, mainWidth / 2 + 80 + 116, orphanY);
|
|
655
|
+
orphanY = Math.max(...nodes.slice(before).map((node) => node.position.y)) + ROW;
|
|
606
656
|
}
|
|
607
657
|
const nodeById = new Map(nodes.map((node) => [node.id, node]));
|
|
608
658
|
for (const edge of model.edges) {
|
|
@@ -615,6 +665,8 @@ function layoutWorkflow(model, portsOf = () => void 0) {
|
|
|
615
665
|
data: {
|
|
616
666
|
edgeId: edge.id,
|
|
617
667
|
port: edge.port,
|
|
668
|
+
portLabel: labelOf(edge.from, edge.port),
|
|
669
|
+
lane: lanes.get(edge.id),
|
|
618
670
|
condition: edge.condition,
|
|
619
671
|
fromSkipped: stepById.get(edge.from)?.skip === true,
|
|
620
672
|
dead: declared(edge.from)?.includes(edge.port) === false
|
|
@@ -645,6 +697,7 @@ function layoutWorkflow(model, portsOf = () => void 0) {
|
|
|
645
697
|
data: {
|
|
646
698
|
parentId: node.id,
|
|
647
699
|
port,
|
|
700
|
+
portLabel: labelOf(node.id, port),
|
|
648
701
|
card: Boolean(slot),
|
|
649
702
|
...model.steps.length === 0 ? { hint: true } : {}
|
|
650
703
|
},
|
|
@@ -661,8 +714,48 @@ function layoutWorkflow(model, portsOf = () => void 0) {
|
|
|
661
714
|
});
|
|
662
715
|
});
|
|
663
716
|
}
|
|
717
|
+
const LOOP_PAD = 16;
|
|
718
|
+
const sizeOf = (node) => node.type === "apAppend" && !node.data.card ? {
|
|
719
|
+
width: 20,
|
|
720
|
+
height: 20
|
|
721
|
+
} : {
|
|
722
|
+
width: 232,
|
|
723
|
+
height: 60
|
|
724
|
+
};
|
|
725
|
+
const frames = [];
|
|
726
|
+
for (const edge of model.edges) {
|
|
727
|
+
if (edge.port !== "each" || !owns(edge)) continue;
|
|
728
|
+
const body = /* @__PURE__ */ new Set();
|
|
729
|
+
const collect = (id) => {
|
|
730
|
+
body.add(id);
|
|
731
|
+
for (const next of outgoing.get(id) ?? []) if (owns(next)) collect(next.to);
|
|
732
|
+
};
|
|
733
|
+
collect(edge.to);
|
|
734
|
+
const members = nodes.filter((node) => node.type === "apStep" ? body.has(node.id) : body.has(node.data.parentId ?? ""));
|
|
735
|
+
const left = Math.min(...members.map((node) => node.position.x));
|
|
736
|
+
const top = Math.min(...members.map((node) => node.position.y));
|
|
737
|
+
const right = Math.max(...members.map((node) => node.position.x + sizeOf(node).width));
|
|
738
|
+
const bottom = Math.max(...members.map((node) => node.position.y + sizeOf(node).height));
|
|
739
|
+
frames.push({
|
|
740
|
+
id: `__loop:${edge.from}`,
|
|
741
|
+
type: "apLoopFrame",
|
|
742
|
+
position: {
|
|
743
|
+
x: left - LOOP_PAD,
|
|
744
|
+
y: top - LOOP_PAD
|
|
745
|
+
},
|
|
746
|
+
data: {
|
|
747
|
+
width: right - left + 32,
|
|
748
|
+
height: bottom - top + 32
|
|
749
|
+
},
|
|
750
|
+
draggable: false,
|
|
751
|
+
selectable: false,
|
|
752
|
+
focusable: false,
|
|
753
|
+
zIndex: -1,
|
|
754
|
+
style: { pointerEvents: "none" }
|
|
755
|
+
});
|
|
756
|
+
}
|
|
664
757
|
return {
|
|
665
|
-
nodes,
|
|
758
|
+
nodes: [...frames, ...nodes],
|
|
666
759
|
edges
|
|
667
760
|
};
|
|
668
761
|
}
|
|
@@ -1865,7 +1958,7 @@ function useBlockCheck(block) {
|
|
|
1865
1958
|
return {
|
|
1866
1959
|
form,
|
|
1867
1960
|
formError: error,
|
|
1868
|
-
issues: block.skip ? [] : undeclaredPortIssues(form, block.outgoingPorts),
|
|
1961
|
+
issues: block.skip ? [] : undeclaredPortIssues(form, block.outgoingPorts, block),
|
|
1869
1962
|
missing: blockMissing({
|
|
1870
1963
|
form,
|
|
1871
1964
|
block: block.block,
|
|
@@ -1922,7 +2015,7 @@ function useWorkflowCheck(model) {
|
|
|
1922
2015
|
propertySettings: block.propertySettings,
|
|
1923
2016
|
skip: block.skip,
|
|
1924
2017
|
resolveDynamic: lookup
|
|
1925
|
-
}), block.skip ? [] : undeclaredPortIssues(formOf(block), block.outgoingPorts))
|
|
2018
|
+
}), block.skip ? [] : undeclaredPortIssues(formOf(block), block.outgoingPorts, block))
|
|
1926
2019
|
}));
|
|
1927
2020
|
return {
|
|
1928
2021
|
readiness: workflowReadiness(results, Boolean(model.trigger)),
|
|
@@ -2328,8 +2421,9 @@ function EdgeRow(props) {
|
|
|
2328
2421
|
}
|
|
2329
2422
|
function FlowPortEditor(props) {
|
|
2330
2423
|
const { step, model, callbacks } = props;
|
|
2331
|
-
const
|
|
2332
|
-
const
|
|
2424
|
+
const block = stepBlock(step);
|
|
2425
|
+
const { form } = useBlockForm(block);
|
|
2426
|
+
const declared = stepPorts(block, step.config, () => form && form !== "loading" ? form.ports : void 0, model.edges.filter((edge) => edge.from === step.id).map((e) => e.port));
|
|
2333
2427
|
const ports = declared ? flowPorts(declared) : [];
|
|
2334
2428
|
const dead = declared ? model.edges.filter((edge) => edge.from === step.id && !declared.includes(edge.port)) : [];
|
|
2335
2429
|
const attached = model.trigger ? reachableFrom(model.trigger.id, model.edges) : /* @__PURE__ */ new Set();
|
|
@@ -2347,7 +2441,7 @@ function FlowPortEditor(props) {
|
|
|
2347
2441
|
})] }) : null, ports.map((port) => {
|
|
2348
2442
|
const edges = model.edges.filter((candidate) => candidate.from === step.id && candidate.port === port);
|
|
2349
2443
|
const targets = candidates.filter((candidate) => !edges.some((edge) => edge.to === candidate.id));
|
|
2350
|
-
return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(FieldLabel, { label: PORT_LABEL[port] ?? port }), /* @__PURE__ */ jsxs("div", {
|
|
2444
|
+
return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(FieldLabel, { label: stepPortLabel(block, step.config, port) ?? PORT_LABEL[port] ?? port }), /* @__PURE__ */ jsxs("div", {
|
|
2351
2445
|
className: "flex flex-col gap-1.5",
|
|
2352
2446
|
children: [edges.map((edge) => /* @__PURE__ */ jsx(EdgeRow, {
|
|
2353
2447
|
target: model.steps.find((entry) => entry.id === edge.to),
|
|
@@ -3026,15 +3120,15 @@ function TriggerPanel(props) {
|
|
|
3026
3120
|
block
|
|
3027
3121
|
});
|
|
3028
3122
|
const writes = !props.readOnly;
|
|
3029
|
-
const isWebhookTrigger = form !== "loading" && form?.triggerDelivery === "webhook";
|
|
3123
|
+
const isWebhookTrigger = form !== "loading" && form?.triggerDelivery === "webhook" && !sameBlock(block, CALLABLE_FLOW_TRIGGER);
|
|
3030
3124
|
const endpoint = useWebhookEndpoint(isWebhookTrigger);
|
|
3031
3125
|
const setTriggerConfig = (config, settings) => callbacks.setTriggerConfig(config, writes ? { propertySettings: settings } : void 0);
|
|
3032
3126
|
return /* @__PURE__ */ jsxs("div", {
|
|
3033
3127
|
className: "flex min-h-full flex-col",
|
|
3034
3128
|
children: [/* @__PURE__ */ jsx(PanelHeader, {
|
|
3035
3129
|
block,
|
|
3036
|
-
name: form && form !== "loading" && form.title ? form.title : meta.displayName,
|
|
3037
|
-
actionLabel: describeTrigger(trigger),
|
|
3130
|
+
name: form && form !== "loading" && form.title && !namedByCoreTab(block) ? form.title : meta.displayName,
|
|
3131
|
+
actionLabel: namedByCoreTab(block) ? meta.subtitle : describeTrigger(trigger),
|
|
3038
3132
|
missing,
|
|
3039
3133
|
loading: form === "loading",
|
|
3040
3134
|
onClose: props.onClose
|
|
@@ -14483,7 +14577,7 @@ function ApStepNode(props) {
|
|
|
14483
14577
|
]
|
|
14484
14578
|
}), /* @__PURE__ */ jsx("div", {
|
|
14485
14579
|
className: "truncate text-xs text-muted-foreground/80",
|
|
14486
|
-
children: data.kind === "trigger" ? meta.subtitle
|
|
14580
|
+
children: data.kind === "trigger" ? meta.subtitle : stepSubtitle(meta)
|
|
14487
14581
|
})]
|
|
14488
14582
|
})]
|
|
14489
14583
|
}),
|
|
@@ -14498,8 +14592,14 @@ function ApStepNode(props) {
|
|
|
14498
14592
|
const PORT_LABEL_CLASSES = {
|
|
14499
14593
|
true: "bg-wf-ok/10 text-wf-ok hover:bg-green-200",
|
|
14500
14594
|
false: "bg-foreground/5 text-muted-foreground hover:bg-foreground/10",
|
|
14501
|
-
error: "bg-wf-fail/10 text-wf-fail hover:bg-red-200"
|
|
14595
|
+
error: "bg-wf-fail/10 text-wf-fail hover:bg-red-200",
|
|
14596
|
+
each: "bg-violet-500/10 text-violet-500 hover:bg-violet-500/20",
|
|
14597
|
+
otherwise: "bg-foreground/5 text-muted-foreground hover:bg-foreground/10"
|
|
14502
14598
|
};
|
|
14599
|
+
const BRANCH_CLASSES = "bg-wf-run/10 text-wf-run hover:bg-blue-200";
|
|
14600
|
+
function portClasses(port) {
|
|
14601
|
+
return PORT_LABEL_CLASSES[port] ?? (/^branch_\d+$/.test(port) ? BRANCH_CLASSES : void 0);
|
|
14602
|
+
}
|
|
14503
14603
|
function AddButton(props) {
|
|
14504
14604
|
const [open, setOpen] = useState(false);
|
|
14505
14605
|
const anchor = useRef(null);
|
|
@@ -14521,7 +14621,7 @@ function AddButton(props) {
|
|
|
14521
14621
|
width: size,
|
|
14522
14622
|
height: size
|
|
14523
14623
|
},
|
|
14524
|
-
className: `flex cursor-pointer items-center justify-center rounded-md border border-solid transition-all ${label ? "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 px-1.5 text-[10px] font-semibold" : ""} ${open ? "border-wf-run bg-wf-run text-card" : label ? `border-transparent ${
|
|
14624
|
+
className: `flex cursor-pointer items-center justify-center rounded-md border border-solid transition-all ${label ? "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 px-1.5 text-[10px] font-semibold" : ""} ${open ? "border-wf-run bg-wf-run text-card" : label ? `border-transparent ${portClasses(props.port ?? label) ?? "bg-muted text-muted-foreground hover:bg-foreground/10"}` : "border-foreground/15 bg-card text-foreground hover:border-foreground/25"}`,
|
|
14525
14625
|
onClick: (event) => {
|
|
14526
14626
|
event.stopPropagation();
|
|
14527
14627
|
setOpen((value) => !value);
|
|
@@ -14570,6 +14670,7 @@ function useCanvasHandlers() {
|
|
|
14570
14670
|
}
|
|
14571
14671
|
function ApAppendNode(props) {
|
|
14572
14672
|
const data = props.data;
|
|
14673
|
+
const portName = data.portLabel ?? data.port;
|
|
14573
14674
|
const handlers = useCanvasHandlers();
|
|
14574
14675
|
const attachSteps = handlers?.attachableSteps(data.parentId);
|
|
14575
14676
|
const dragging = useDraggingStep();
|
|
@@ -14626,11 +14727,11 @@ function ApAppendNode(props) {
|
|
|
14626
14727
|
style: hiddenHandle
|
|
14627
14728
|
}),
|
|
14628
14729
|
/* @__PURE__ */ jsx("span", {
|
|
14629
|
-
className: `absolute left-3 top-3 rounded px-1.5 text-[10px] font-semibold ${
|
|
14630
|
-
children:
|
|
14730
|
+
className: `absolute left-3 top-3 rounded px-1.5 text-[10px] font-semibold ${portClasses(data.port) ?? "bg-muted text-muted-foreground"}`,
|
|
14731
|
+
children: portName
|
|
14631
14732
|
}),
|
|
14632
14733
|
/* @__PURE__ */ jsx(AddButton, {
|
|
14633
|
-
title: `Add step (${
|
|
14734
|
+
title: `Add step (${portName})`,
|
|
14634
14735
|
presets: STEP_PRESETS,
|
|
14635
14736
|
showPieces: true,
|
|
14636
14737
|
attachSteps,
|
|
@@ -14650,8 +14751,9 @@ function ApAppendNode(props) {
|
|
|
14650
14751
|
children: "Add your first step with +"
|
|
14651
14752
|
}) : null,
|
|
14652
14753
|
/* @__PURE__ */ jsx(AddButton, {
|
|
14653
|
-
title: data.port === "next" ? "Add step" : `Add step (${
|
|
14654
|
-
label: data.port === "next" ? void 0 :
|
|
14754
|
+
title: data.port === "next" && !data.portLabel ? "Add step" : `Add step (${portName})`,
|
|
14755
|
+
label: data.port === "next" && !data.portLabel ? void 0 : portName,
|
|
14756
|
+
port: data.port,
|
|
14655
14757
|
presets: STEP_PRESETS,
|
|
14656
14758
|
showPieces: true,
|
|
14657
14759
|
attachSteps,
|
|
@@ -14677,26 +14779,73 @@ function ApBigButtonNode(_props) {
|
|
|
14677
14779
|
})]
|
|
14678
14780
|
});
|
|
14679
14781
|
}
|
|
14782
|
+
function ApLoopFrameNode(props) {
|
|
14783
|
+
const data = props.data;
|
|
14784
|
+
return /* @__PURE__ */ jsx("div", {
|
|
14785
|
+
style: {
|
|
14786
|
+
width: data.width,
|
|
14787
|
+
height: data.height
|
|
14788
|
+
},
|
|
14789
|
+
className: "pointer-events-none rounded-lg border border-dashed border-violet-500/30 bg-violet-500/[0.03]"
|
|
14790
|
+
});
|
|
14791
|
+
}
|
|
14680
14792
|
const apNodeTypes = {
|
|
14681
14793
|
apStep: ApStepNode,
|
|
14682
14794
|
apAppend: ApAppendNode,
|
|
14683
|
-
apBigButton: ApBigButtonNode
|
|
14795
|
+
apBigButton: ApBigButtonNode,
|
|
14796
|
+
apLoopFrame: ApLoopFrameNode
|
|
14684
14797
|
};
|
|
14685
14798
|
//#endregion
|
|
14686
14799
|
//#region editors/workflow-editor/ui/ap-edge.tsx
|
|
14800
|
+
const RADIUS = 15;
|
|
14801
|
+
function roundedPath(points) {
|
|
14802
|
+
const pts = points.filter((p, i) => i === 0 || p[0] !== points[i - 1][0] || p[1] !== points[i - 1][1]);
|
|
14803
|
+
let d = `M ${pts[0][0]} ${pts[0][1]}`;
|
|
14804
|
+
for (let i = 1; i < pts.length - 1; i++) {
|
|
14805
|
+
const [px, py] = pts[i - 1];
|
|
14806
|
+
const [cx, cy] = pts[i];
|
|
14807
|
+
const [nx, ny] = pts[i + 1];
|
|
14808
|
+
const inLen = Math.hypot(cx - px, cy - py);
|
|
14809
|
+
const outLen = Math.hypot(nx - cx, ny - cy);
|
|
14810
|
+
const r = Math.min(RADIUS, inLen / 2, outLen / 2);
|
|
14811
|
+
const ax = cx - (cx - px) / inLen * r;
|
|
14812
|
+
const ay = cy - (cy - py) / inLen * r;
|
|
14813
|
+
const bx = cx + (nx - cx) / outLen * r;
|
|
14814
|
+
const by = cy + (ny - cy) / outLen * r;
|
|
14815
|
+
d += ` L ${ax} ${ay} Q ${cx} ${cy} ${bx} ${by}`;
|
|
14816
|
+
}
|
|
14817
|
+
const [lx, ly] = pts[pts.length - 1];
|
|
14818
|
+
return `${d} L ${lx} ${ly}`;
|
|
14819
|
+
}
|
|
14820
|
+
function lanePath(sx, sy, lane, tx, ty) {
|
|
14821
|
+
const turn = sy + Math.min(30, (ty - sy) / 2);
|
|
14822
|
+
const entry = Math.max(ty - 15, turn);
|
|
14823
|
+
return [
|
|
14824
|
+
roundedPath([
|
|
14825
|
+
[sx, sy],
|
|
14826
|
+
[sx, turn],
|
|
14827
|
+
[lane, turn],
|
|
14828
|
+
[lane, entry],
|
|
14829
|
+
[tx, entry],
|
|
14830
|
+
[tx, ty]
|
|
14831
|
+
]),
|
|
14832
|
+
(sx + lane) / 2,
|
|
14833
|
+
turn
|
|
14834
|
+
];
|
|
14835
|
+
}
|
|
14687
14836
|
function ApEdge(props) {
|
|
14688
14837
|
const handlers = useCanvasHandlers();
|
|
14689
14838
|
const data = props.data;
|
|
14690
|
-
const [path, labelX, labelY] = getSmoothStepPath({
|
|
14839
|
+
const [path, labelX, labelY] = data.lane !== void 0 && props.targetY > props.sourceY ? lanePath(props.sourceX, props.sourceY, data.lane, props.targetX, props.targetY) : getSmoothStepPath({
|
|
14691
14840
|
sourceX: props.sourceX,
|
|
14692
14841
|
sourceY: props.sourceY,
|
|
14693
14842
|
targetX: props.targetX,
|
|
14694
14843
|
targetY: props.targetY,
|
|
14695
14844
|
sourcePosition: Position.Bottom,
|
|
14696
14845
|
targetPosition: Position.Top,
|
|
14697
|
-
borderRadius:
|
|
14846
|
+
borderRadius: RADIUS
|
|
14698
14847
|
});
|
|
14699
|
-
const portLabel = data.dead ? `${data.port} · never taken` : data.port !== "next" ? data.port : null;
|
|
14848
|
+
const portLabel = data.dead ? `${data.portLabel ?? data.port} · never taken` : data.port !== "next" || data.portLabel ? data.portLabel ?? data.port : null;
|
|
14700
14849
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(BaseEdge, {
|
|
14701
14850
|
id: props.id,
|
|
14702
14851
|
path,
|
|
@@ -14713,7 +14862,7 @@ function ApEdge(props) {
|
|
|
14713
14862
|
className: "nodrag nopan pointer-events-auto absolute flex items-center gap-1",
|
|
14714
14863
|
style: { transform: `translate(-50%, -50%) translate(${labelX}px, ${labelY}px)` },
|
|
14715
14864
|
children: [portLabel ? /* @__PURE__ */ jsxs("span", {
|
|
14716
|
-
className: `rounded px-1.5 py-0.5 text-[10px] font-semibold ${data.dead ? "border border-solid border-wf-fail/40 bg-card text-wf-fail" :
|
|
14865
|
+
className: `rounded px-1.5 py-0.5 text-[10px] font-semibold ${data.dead ? "border border-solid border-wf-fail/40 bg-card text-wf-fail" : portClasses(data.port) ?? "bg-muted text-muted-foreground"}`,
|
|
14717
14866
|
title: data.dead ? `The source never leaves on "${data.port}", so no run takes this edge` : void 0,
|
|
14718
14867
|
children: [portLabel, data.condition ? " ?" : ""]
|
|
14719
14868
|
}) : null, /* @__PURE__ */ jsx(AddButton, {
|
|
@@ -15317,7 +15466,7 @@ function WorkflowEditor() {
|
|
|
15317
15466
|
const designTime = useMemo(() => ({
|
|
15318
15467
|
workflowId,
|
|
15319
15468
|
getBlockForm: (block) => client.getBlockForm(block),
|
|
15320
|
-
loadOptions: (
|
|
15469
|
+
loadOptions: (block, propName, input, connectionId, searchValue, reactorConnectionId) => client.loadBlockOptions(block, propName, input, connectionId, searchValue, reactorConnectionId, workflowId),
|
|
15321
15470
|
testTrigger: () => client.testTrigger(workflowId, driveId),
|
|
15322
15471
|
testStep: (stepId) => client.testStep(workflowId, stepId, driveId),
|
|
15323
15472
|
webhookEndpoint: () => client.fetchWebhookEndpoint(workflowId, driveId),
|
|
@@ -15421,4 +15570,4 @@ function Editor({ document }) {
|
|
|
15421
15570
|
//#endregion
|
|
15422
15571
|
export { Editor as default };
|
|
15423
15572
|
|
|
15424
|
-
//# sourceMappingURL=editor-
|
|
15573
|
+
//# sourceMappingURL=editor-NMRVprgI.mjs.map
|