@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
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { h as REACTOR_CONNECTOR_ID, x as actions } from "./module-DJz6oTX0.js";
|
|
2
2
|
import { t as useConnectionDocumentById } from "./connection-PaKXHYz9.js";
|
|
3
3
|
import { i as connectorIdForPiece, l as planFromAuth, s as packageFromConnectorId } from "./piece-auth-63iuNFTs.js";
|
|
4
|
-
import {
|
|
4
|
+
import { $ as triggerFields, Q as triggerBlock, V as STEP_PRESETS, W as TRIGGER_PRESETS, X as stepBlock, Y as sameBlock, Z as stepFields, b as realRuns, f as stepOutputTreeQuery, g as blockRefKey, i as outputTreeQuery, j as CALLABLE_FLOW_TRIGGER$1, n as catalogQuery, q as isCoreBlock, u as runsQuery, y as TEST_TRIGGER_KIND } from "./runtime-queries-C5bqAgQy.js";
|
|
5
5
|
import { y as actions$1 } from "./module-mFCt9WHJ.js";
|
|
6
6
|
import { t as useSelectedWorkflowDocument } from "./workflow-BFdnSGRD.js";
|
|
7
|
-
import {
|
|
8
|
-
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-
|
|
9
|
-
import { A as
|
|
7
|
+
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-DFzzAWXh.js";
|
|
8
|
+
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-B6zpGmAm.js";
|
|
9
|
+
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-BfIu-QcC.js";
|
|
10
10
|
import { addDocument, dispatchActions, useDocumentModelModules, useDocumentSafe, useFileNodesInSelectedDrive, useSelectedDriveId } from "@powerhousedao/reactor-browser";
|
|
11
11
|
import { generateId } from "document-model";
|
|
12
|
-
import { DEFAULT_TIMEZONE, flowPorts, knownPorts, parseScheduleConfig, scheduleConfigIssue } from "@powerhousedao/pieces-framework/workflow";
|
|
12
|
+
import { DEFAULT_TIMEZONE, flowPorts, knownPorts, parseScheduleConfig, scheduleConfigIssue, stepPortLabel, stepPorts } from "@powerhousedao/pieces-framework/workflow";
|
|
13
13
|
import { createContext, useCallback, useContext, useEffect, useId, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
14
14
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
15
15
|
import { Modal } from "@powerhousedao/design-system/connect";
|
|
@@ -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$1);
|
|
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
|
|
@@ -3572,7 +3666,7 @@ function ApStepNode(props) {
|
|
|
3572
3666
|
]
|
|
3573
3667
|
}), /* @__PURE__ */ jsx("div", {
|
|
3574
3668
|
className: "truncate text-xs text-muted-foreground/80",
|
|
3575
|
-
children: data.kind === "trigger" ? meta.subtitle
|
|
3669
|
+
children: data.kind === "trigger" ? meta.subtitle : stepSubtitle(meta)
|
|
3576
3670
|
})]
|
|
3577
3671
|
})]
|
|
3578
3672
|
}),
|
|
@@ -3587,8 +3681,14 @@ function ApStepNode(props) {
|
|
|
3587
3681
|
const PORT_LABEL_CLASSES = {
|
|
3588
3682
|
true: "bg-wf-ok/10 text-wf-ok hover:bg-green-200",
|
|
3589
3683
|
false: "bg-foreground/5 text-muted-foreground hover:bg-foreground/10",
|
|
3590
|
-
error: "bg-wf-fail/10 text-wf-fail hover:bg-red-200"
|
|
3684
|
+
error: "bg-wf-fail/10 text-wf-fail hover:bg-red-200",
|
|
3685
|
+
each: "bg-violet-500/10 text-violet-500 hover:bg-violet-500/20",
|
|
3686
|
+
otherwise: "bg-foreground/5 text-muted-foreground hover:bg-foreground/10"
|
|
3591
3687
|
};
|
|
3688
|
+
const BRANCH_CLASSES = "bg-wf-run/10 text-wf-run hover:bg-blue-200";
|
|
3689
|
+
function portClasses(port) {
|
|
3690
|
+
return PORT_LABEL_CLASSES[port] ?? (/^branch_\d+$/.test(port) ? BRANCH_CLASSES : void 0);
|
|
3691
|
+
}
|
|
3592
3692
|
function AddButton(props) {
|
|
3593
3693
|
const [open, setOpen] = useState(false);
|
|
3594
3694
|
const anchor = useRef(null);
|
|
@@ -3610,7 +3710,7 @@ function AddButton(props) {
|
|
|
3610
3710
|
width: size,
|
|
3611
3711
|
height: size
|
|
3612
3712
|
},
|
|
3613
|
-
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 ${
|
|
3713
|
+
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"}`,
|
|
3614
3714
|
onClick: (event) => {
|
|
3615
3715
|
event.stopPropagation();
|
|
3616
3716
|
setOpen((value) => !value);
|
|
@@ -3659,6 +3759,7 @@ function useCanvasHandlers() {
|
|
|
3659
3759
|
}
|
|
3660
3760
|
function ApAppendNode(props) {
|
|
3661
3761
|
const data = props.data;
|
|
3762
|
+
const portName = data.portLabel ?? data.port;
|
|
3662
3763
|
const handlers = useCanvasHandlers();
|
|
3663
3764
|
const attachSteps = handlers?.attachableSteps(data.parentId);
|
|
3664
3765
|
const dragging = useDraggingStep();
|
|
@@ -3715,11 +3816,11 @@ function ApAppendNode(props) {
|
|
|
3715
3816
|
style: hiddenHandle
|
|
3716
3817
|
}),
|
|
3717
3818
|
/* @__PURE__ */ jsx("span", {
|
|
3718
|
-
className: `absolute left-3 top-3 rounded px-1.5 text-[10px] font-semibold ${
|
|
3719
|
-
children:
|
|
3819
|
+
className: `absolute left-3 top-3 rounded px-1.5 text-[10px] font-semibold ${portClasses(data.port) ?? "bg-muted text-muted-foreground"}`,
|
|
3820
|
+
children: portName
|
|
3720
3821
|
}),
|
|
3721
3822
|
/* @__PURE__ */ jsx(AddButton, {
|
|
3722
|
-
title: `Add step (${
|
|
3823
|
+
title: `Add step (${portName})`,
|
|
3723
3824
|
presets: STEP_PRESETS,
|
|
3724
3825
|
showPieces: true,
|
|
3725
3826
|
attachSteps,
|
|
@@ -3739,8 +3840,9 @@ function ApAppendNode(props) {
|
|
|
3739
3840
|
children: "Add your first step with +"
|
|
3740
3841
|
}) : null,
|
|
3741
3842
|
/* @__PURE__ */ jsx(AddButton, {
|
|
3742
|
-
title: data.port === "next" ? "Add step" : `Add step (${
|
|
3743
|
-
label: data.port === "next" ? void 0 :
|
|
3843
|
+
title: data.port === "next" && !data.portLabel ? "Add step" : `Add step (${portName})`,
|
|
3844
|
+
label: data.port === "next" && !data.portLabel ? void 0 : portName,
|
|
3845
|
+
port: data.port,
|
|
3744
3846
|
presets: STEP_PRESETS,
|
|
3745
3847
|
showPieces: true,
|
|
3746
3848
|
attachSteps,
|
|
@@ -3766,26 +3868,73 @@ function ApBigButtonNode(_props) {
|
|
|
3766
3868
|
})]
|
|
3767
3869
|
});
|
|
3768
3870
|
}
|
|
3871
|
+
function ApLoopFrameNode(props) {
|
|
3872
|
+
const data = props.data;
|
|
3873
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3874
|
+
style: {
|
|
3875
|
+
width: data.width,
|
|
3876
|
+
height: data.height
|
|
3877
|
+
},
|
|
3878
|
+
className: "pointer-events-none rounded-lg border border-dashed border-violet-500/30 bg-violet-500/[0.03]"
|
|
3879
|
+
});
|
|
3880
|
+
}
|
|
3769
3881
|
const apNodeTypes = {
|
|
3770
3882
|
apStep: ApStepNode,
|
|
3771
3883
|
apAppend: ApAppendNode,
|
|
3772
|
-
apBigButton: ApBigButtonNode
|
|
3884
|
+
apBigButton: ApBigButtonNode,
|
|
3885
|
+
apLoopFrame: ApLoopFrameNode
|
|
3773
3886
|
};
|
|
3774
3887
|
//#endregion
|
|
3775
3888
|
//#region editors/workflow-editor/ui/ap-edge.tsx
|
|
3889
|
+
const RADIUS = 15;
|
|
3890
|
+
function roundedPath(points) {
|
|
3891
|
+
const pts = points.filter((p, i) => i === 0 || p[0] !== points[i - 1][0] || p[1] !== points[i - 1][1]);
|
|
3892
|
+
let d = `M ${pts[0][0]} ${pts[0][1]}`;
|
|
3893
|
+
for (let i = 1; i < pts.length - 1; i++) {
|
|
3894
|
+
const [px, py] = pts[i - 1];
|
|
3895
|
+
const [cx, cy] = pts[i];
|
|
3896
|
+
const [nx, ny] = pts[i + 1];
|
|
3897
|
+
const inLen = Math.hypot(cx - px, cy - py);
|
|
3898
|
+
const outLen = Math.hypot(nx - cx, ny - cy);
|
|
3899
|
+
const r = Math.min(RADIUS, inLen / 2, outLen / 2);
|
|
3900
|
+
const ax = cx - (cx - px) / inLen * r;
|
|
3901
|
+
const ay = cy - (cy - py) / inLen * r;
|
|
3902
|
+
const bx = cx + (nx - cx) / outLen * r;
|
|
3903
|
+
const by = cy + (ny - cy) / outLen * r;
|
|
3904
|
+
d += ` L ${ax} ${ay} Q ${cx} ${cy} ${bx} ${by}`;
|
|
3905
|
+
}
|
|
3906
|
+
const [lx, ly] = pts[pts.length - 1];
|
|
3907
|
+
return `${d} L ${lx} ${ly}`;
|
|
3908
|
+
}
|
|
3909
|
+
function lanePath(sx, sy, lane, tx, ty) {
|
|
3910
|
+
const turn = sy + Math.min(30, (ty - sy) / 2);
|
|
3911
|
+
const entry = Math.max(ty - 15, turn);
|
|
3912
|
+
return [
|
|
3913
|
+
roundedPath([
|
|
3914
|
+
[sx, sy],
|
|
3915
|
+
[sx, turn],
|
|
3916
|
+
[lane, turn],
|
|
3917
|
+
[lane, entry],
|
|
3918
|
+
[tx, entry],
|
|
3919
|
+
[tx, ty]
|
|
3920
|
+
]),
|
|
3921
|
+
(sx + lane) / 2,
|
|
3922
|
+
turn
|
|
3923
|
+
];
|
|
3924
|
+
}
|
|
3776
3925
|
function ApEdge(props) {
|
|
3777
3926
|
const handlers = useCanvasHandlers();
|
|
3778
3927
|
const data = props.data;
|
|
3779
|
-
const [path, labelX, labelY] = getSmoothStepPath({
|
|
3928
|
+
const [path, labelX, labelY] = data.lane !== void 0 && props.targetY > props.sourceY ? lanePath(props.sourceX, props.sourceY, data.lane, props.targetX, props.targetY) : getSmoothStepPath({
|
|
3780
3929
|
sourceX: props.sourceX,
|
|
3781
3930
|
sourceY: props.sourceY,
|
|
3782
3931
|
targetX: props.targetX,
|
|
3783
3932
|
targetY: props.targetY,
|
|
3784
3933
|
sourcePosition: Position.Bottom,
|
|
3785
3934
|
targetPosition: Position.Top,
|
|
3786
|
-
borderRadius:
|
|
3935
|
+
borderRadius: RADIUS
|
|
3787
3936
|
});
|
|
3788
|
-
const portLabel = data.dead ? `${data.port} · never taken` : data.port !== "next" ? data.port : null;
|
|
3937
|
+
const portLabel = data.dead ? `${data.portLabel ?? data.port} · never taken` : data.port !== "next" || data.portLabel ? data.portLabel ?? data.port : null;
|
|
3789
3938
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(BaseEdge, {
|
|
3790
3939
|
id: props.id,
|
|
3791
3940
|
path,
|
|
@@ -3802,7 +3951,7 @@ function ApEdge(props) {
|
|
|
3802
3951
|
className: "nodrag nopan pointer-events-auto absolute flex items-center gap-1",
|
|
3803
3952
|
style: { transform: `translate(-50%, -50%) translate(${labelX}px, ${labelY}px)` },
|
|
3804
3953
|
children: [portLabel ? /* @__PURE__ */ jsxs("span", {
|
|
3805
|
-
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" :
|
|
3954
|
+
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"}`,
|
|
3806
3955
|
title: data.dead ? `The source never leaves on "${data.port}", so no run takes this edge` : void 0,
|
|
3807
3956
|
children: [portLabel, data.condition ? " ?" : ""]
|
|
3808
3957
|
}) : null, /* @__PURE__ */ jsx(AddButton, {
|
|
@@ -4406,7 +4555,7 @@ function WorkflowEditor() {
|
|
|
4406
4555
|
const designTime = useMemo(() => ({
|
|
4407
4556
|
workflowId,
|
|
4408
4557
|
getBlockForm: (block) => client.getBlockForm(block),
|
|
4409
|
-
loadOptions: (
|
|
4558
|
+
loadOptions: (block, propName, input, connectionId, searchValue, reactorConnectionId) => client.loadBlockOptions(block, propName, input, connectionId, searchValue, reactorConnectionId, workflowId),
|
|
4410
4559
|
testTrigger: () => client.testTrigger(workflowId, driveId),
|
|
4411
4560
|
testStep: (stepId) => client.testStep(workflowId, stepId, driveId),
|
|
4412
4561
|
webhookEndpoint: () => client.fetchWebhookEndpoint(workflowId, driveId),
|
|
@@ -4510,4 +4659,4 @@ function Editor({ document }) {
|
|
|
4510
4659
|
//#endregion
|
|
4511
4660
|
export { Editor as default };
|
|
4512
4661
|
|
|
4513
|
-
//# sourceMappingURL=editor-
|
|
4662
|
+
//# sourceMappingURL=editor-Yt-_V04R.js.map
|