@oomol-lab/open-flow 0.1.0-beta.65 → 0.1.0-beta.67
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/{createResourceDialog-BAJXbzNH.js → createResourceDialog-BQVD8Rqb.js} +2 -2
- package/dist/browser/{icons-Db2Jb2iX.js → dialog-CS2Vt2if.js} +5736 -5621
- package/dist/browser/event-sources.d.ts +4 -1
- package/dist/browser/flow-authoring-node.d.ts +14 -3
- package/dist/browser/flow-authoring.js +120 -24
- package/dist/browser/flow-change-schema.d.ts +3 -1
- package/dist/browser/flow-change.d.ts +15 -3
- package/dist/browser/flow-change.js +117 -21
- package/dist/browser/{flowChanges-DkvG5uDq.js → flowChanges-VB9Y4iy7.js} +3423 -2380
- package/dist/browser/{flowRunInputEditorStore-B2Rw4VsT.js → flowRunInputEditorStore-DJqmR6Qh.js} +3 -2
- package/dist/browser/{flowWorkspace-BEp-lxqF.js → flowWorkspace-C1hlTnZq.js} +1410 -799
- package/dist/browser/preview.css +273 -119
- package/dist/browser/preview.js +17118 -15810
- package/dist/browser/theme.css +1 -0
- package/dist/browser/ui.css +119 -7
- package/dist/browser/ui.js +8 -5
- package/dist/browser/workbench-contract.d.ts +1 -1
- package/dist/browser/workbench.css +282 -162
- package/dist/browser/workbench.d.ts +0 -1
- package/dist/browser/workbench.js +503 -173
- package/dist/browser/{workbenchSelect-C-jf6NIM.js → workbenchSelect-CpXhjUou.js} +1 -1
- package/dist/command/index.js +49 -49
- package/dist/common/authoring.d.ts +7 -5
- package/dist/common/authoringExamples.d.ts +4 -4
- package/dist/common/authoringFields.d.ts +20 -0
- package/dist/common/authoringSchema.d.ts +404 -15
- package/dist/common/control-api-conformance.js +415 -146
- package/dist/common/control-api.d.ts +67 -8
- package/dist/common/control-api.js +3587 -3443
- package/dist/common/control-requests.d.ts +10 -3
- package/dist/common/control-requests.js +425 -49
- package/dist/common/decision.js +33 -7
- package/dist/common/flow-encoding.d.ts +4 -2
- package/dist/common/flow-encoding.js +151 -14
- package/dist/common/flow-graph.d.ts +1 -1
- package/dist/common/flow-semantics.d.ts +12 -2
- package/dist/common/flow-semantics.js +157 -41
- package/dist/common/integration-trigger.js +33 -7
- package/dist/common/liveDetails.d.ts +26 -11
- package/dist/common/mcp.d.ts +6 -3
- package/dist/common/mcp.js +219 -90
- package/dist/common/openapi.js +33 -7
- package/dist/common/poll-trigger.js +33 -7
- package/dist/common/run-events.d.ts +2 -0
- package/dist/common/run-events.js +9 -3
- package/dist/common/scheduler.d.ts +10 -1
- package/dist/common/scheduler.js +172 -49
- package/dist/common/trigger-contract.d.ts +2 -0
- package/dist/common/webhook-trigger.js +33 -7
- package/dist/common/workflow.d.ts +93 -0
- package/dist/common/workflow.js +10492 -0
- package/package.json +5 -1
- package/skills/open-flow/SKILL.md +9 -0
- package/skills/open-flow/references/flow-authoring.md +28 -16
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { $
|
|
1
|
+
import { $t as EmptyDescription, An as EventSourcesPage, Ar as controlErrorCode, At as setTriggerConnection, B as scopedValue, Ct as setNodePositions, Dr as record, Dt as setConnectorConnection, Er as jsonValue, Et as setCodeActions, Ft as IdTooltip, G as connectorActionPorts, Ht as PopoverTitle, I as feishuResourceKind, It as followWorkbenchLink, Jn as randomId, Jt as InputGroup, K as designerGraph, Kn as errorNotice, L as supportsFeishuChatFilter, Lt as Popover, Mt as updateTriggerConfig, N as addNodeIntent, Nn as createI18n, Nr as IconThemeContext, Nt as updateTriggerSchedule, Or as string, Ot as setInputSources, P as deriveAddNodeOptions, Pt as WorkflowExportMenuItem, Qt as EmptyContent, R as combineSources, Rt as PopoverContent, St as setNodeContentHidden, Tr as invalidResponse, Tt as resetInputValues, U as resourceData, Ut as PopoverTrigger, V as CacheResource, W as resourceValue, X as providerIcon, Xt as InputGroupInput, Yn as allConnectorConnectionsQuery, Yt as InputGroupAddon, Zn as decodeTriggerCatalog, Zt as Empty, _ as updateTaskPorts, _t as flowPresentation, a as nameCreatedNodes, an as DropdownMenuContent, ar as connectorActionMetadata, at as revisionView, bt as setComment, c as updateCondition, cr as workflowFileName, ct as deriveInspectorDiagnostics, d as updateNodeName, dn as DropdownMenuSeparator, en as EmptyHeader, er as normalizeTriggerOutputs, f as updateNodeSettings, fr as providerIconAppearance, g as updateTaskAdditionalInputs, gt as commentIds, h as updateTask, hn as DropdownMenuTrigger, ht as canvasPresentationChange, i as deleteSelection, ir as connection, jt as updateStartInputDefs, kn as Badge, kr as ApiError, kt as setServiceConnections, l as updateNodeDescription, lr as workflowNameFromFile, lt as diagnosticItems, m as updateResolution, mt as connectionCatalog, nn as EmptyTitle, nr as triggerOutputDefinitions, nt as RunStore, o as setInputValue, or as encodeWorkflowFile, ot as flowResourceReferences, p as updateOutputPorts, pt as actionWithConnections, qn as WorkbenchClient, r as applyFlowChanges, rn as DropdownMenu, rr as isJsonObject, s as setInputVariable, sn as DropdownMenuItem, sr as parseWorkflowFile, st as Latest, t as addNode, tn as EmptyMedia, tr as sampleErrorOutputs, u as updateNodeIcon, v as updateValue, vt as removeComments, wr as inputValue, wt as repairNodeNames, xr as workflowCandidate, xt as setFlowViewport, y as updateWebhook, yt as restoreCanvasPresentation } from "./flowChanges-VB9Y4iy7.js";
|
|
2
2
|
import { a as derive, i as compute, l as val } from "./dist-bO8nvHFH.js";
|
|
3
3
|
import { c as useLang, l as useTranslate, o as I18nProvider, u as useVal } from "./dist-BFmpkX4P.js";
|
|
4
|
-
import { B as
|
|
4
|
+
import { B as upgradeManualTrigger, E as FieldLabel, Ei as cn, G as mapConditionSources, K as nodeInputMappings, M as applyFlowChanges$1, P as isTriggerNode, S as Field, T as FieldGroup, Tt as dequal$1, V as upgradeRevisionContent, a as DialogFooter, d as TooltipContent, fr as Input, i as DialogDescription, j as FlowChangeError, l as Icon, o as DialogHeader, p as TooltipTrigger, r as DialogContent, s as DialogTitle, t as Dialog, u as Tooltip, w as FieldError, wi as Button, x as Spinner, z as resourceNameIssue } from "./dialog-CS2Vt2if.js";
|
|
5
5
|
import { c as importedWorkflowName, d as uiLanguageNames, f as uiLanguages, l as isUiLanguage, u as resolveUiLanguage } from "./value-BADHeZ9I.js";
|
|
6
6
|
import { Suspense, forwardRef, lazy, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
|
|
7
7
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -189,24 +189,199 @@ function Skeleton({ className, ...props }) {
|
|
|
189
189
|
});
|
|
190
190
|
}
|
|
191
191
|
//#endregion
|
|
192
|
-
//#region src/workbench/browser/runtime/shell/
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
192
|
+
//#region src/workbench/browser/runtime/shell/flowReferences.tsx
|
|
193
|
+
function useFlowReferences(flowId, workspace) {
|
|
194
|
+
const [result, setResult] = useState();
|
|
195
|
+
const [status, setStatus] = useState("loading");
|
|
196
|
+
const [offset, setOffset] = useState(0);
|
|
197
|
+
const [attempt, setAttempt] = useState(0);
|
|
198
|
+
useEffect(() => {
|
|
199
|
+
const controller = new AbortController();
|
|
200
|
+
setStatus("loading");
|
|
201
|
+
workspace.getFlowReferences(flowId, {
|
|
202
|
+
offset,
|
|
203
|
+
signal: controller.signal
|
|
204
|
+
}).then((page) => {
|
|
205
|
+
if (controller.signal.aborted) return;
|
|
206
|
+
setResult((previous) => {
|
|
207
|
+
const references = new Map((offset == 0 ? [] : previous?.references ?? []).map((item) => [item.flowId, item]));
|
|
208
|
+
for (const item of page.references) references.set(item.flowId, item);
|
|
209
|
+
return {
|
|
210
|
+
...page,
|
|
211
|
+
references: [...references.values()]
|
|
212
|
+
};
|
|
213
|
+
});
|
|
214
|
+
setStatus("ready");
|
|
215
|
+
}, () => {
|
|
216
|
+
if (controller.signal.aborted) return;
|
|
217
|
+
setStatus("failed");
|
|
218
|
+
});
|
|
219
|
+
return () => controller.abort();
|
|
220
|
+
}, [
|
|
221
|
+
workspace,
|
|
222
|
+
flowId,
|
|
223
|
+
offset,
|
|
224
|
+
attempt
|
|
225
|
+
]);
|
|
226
|
+
return {
|
|
227
|
+
result,
|
|
228
|
+
status,
|
|
229
|
+
retry: () => {
|
|
230
|
+
setStatus("loading");
|
|
231
|
+
setAttempt((value) => value + 1);
|
|
232
|
+
},
|
|
233
|
+
loadMore: () => {
|
|
234
|
+
if (status != "ready" || result?.nextOffset == null) return;
|
|
235
|
+
setStatus("loading");
|
|
236
|
+
setOffset(result.nextOffset);
|
|
237
|
+
}
|
|
238
|
+
};
|
|
198
239
|
}
|
|
199
|
-
function
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
day: "numeric",
|
|
204
|
-
hour: "2-digit",
|
|
205
|
-
minute: "2-digit",
|
|
206
|
-
month: "short",
|
|
207
|
-
year: date.getFullYear() == current.getFullYear() ? void 0 : "numeric"
|
|
240
|
+
function FlowReferenceQuery({ flowId, workspace, ...navigation }) {
|
|
241
|
+
return /* @__PURE__ */ jsx(FlowReferenceResults, {
|
|
242
|
+
state: useFlowReferences(flowId, workspace),
|
|
243
|
+
...navigation
|
|
208
244
|
});
|
|
209
245
|
}
|
|
246
|
+
function FlowReferenceResults({ state, hrefForFlow, onSelectFlow, showEmpty = true, summary, disabled = false }) {
|
|
247
|
+
const t = useTranslate();
|
|
248
|
+
const { result, status } = state;
|
|
249
|
+
const list = result != null && result.references.length > 0 && /* @__PURE__ */ jsxs("div", {
|
|
250
|
+
className: "space-y-3",
|
|
251
|
+
children: [/* @__PURE__ */ jsx("ul", {
|
|
252
|
+
className: "m-0 max-h-64 list-none space-y-3 overflow-y-auto p-0",
|
|
253
|
+
children: result.references.map((item) => {
|
|
254
|
+
const defaultView = item.draft ? "design" : "publications";
|
|
255
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
256
|
+
className: "flex items-start justify-between gap-3",
|
|
257
|
+
children: [/* @__PURE__ */ jsxs("a", {
|
|
258
|
+
className: "flex min-w-0 items-start gap-2 text-foreground no-underline hover:underline",
|
|
259
|
+
href: hrefForFlow(item, defaultView),
|
|
260
|
+
onClick: (event) => followWorkbenchLink(event, () => onSelectFlow(item, defaultView)),
|
|
261
|
+
children: [/* @__PURE__ */ jsx("i", {
|
|
262
|
+
"aria-hidden": "true",
|
|
263
|
+
className: "i-lucide-light:workflow mt-0.5 size-4 shrink-0 text-muted-foreground"
|
|
264
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
265
|
+
className: "min-w-0 break-words",
|
|
266
|
+
children: item.name ?? item.flowId
|
|
267
|
+
})]
|
|
268
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
269
|
+
className: "flex shrink-0 flex-wrap justify-end gap-1",
|
|
270
|
+
children: [item.draft && /* @__PURE__ */ jsx("a", {
|
|
271
|
+
className: "rounded-md bg-muted px-2 py-0.5 text-muted-foreground no-underline hover:underline",
|
|
272
|
+
href: hrefForFlow(item, "design"),
|
|
273
|
+
onClick: (event) => followWorkbenchLink(event, () => onSelectFlow(item, "design")),
|
|
274
|
+
children: t("flowReferences.draft")
|
|
275
|
+
}), item.live != null && /* @__PURE__ */ jsxs("a", {
|
|
276
|
+
className: "rounded-md bg-muted px-2 py-0.5 text-muted-foreground no-underline hover:underline",
|
|
277
|
+
href: hrefForFlow(item, "publications"),
|
|
278
|
+
onClick: (event) => followWorkbenchLink(event, () => onSelectFlow(item, "publications")),
|
|
279
|
+
children: [t("flowReferences.live"), !item.live.enabled && ` · ${t("flowReferences.disabled")}`]
|
|
280
|
+
})]
|
|
281
|
+
})]
|
|
282
|
+
}, item.flowId);
|
|
283
|
+
})
|
|
284
|
+
}), status != "failed" && result?.nextOffset != null && /* @__PURE__ */ jsx(Button, {
|
|
285
|
+
variant: "outline",
|
|
286
|
+
size: "sm",
|
|
287
|
+
disabled: disabled || status == "loading",
|
|
288
|
+
onClick: state.loadMore,
|
|
289
|
+
children: t("flowReferences.loadMore")
|
|
290
|
+
})]
|
|
291
|
+
});
|
|
292
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
293
|
+
className: "space-y-3 text-sm",
|
|
294
|
+
children: [
|
|
295
|
+
summary != null && list ? /* @__PURE__ */ jsxs("details", {
|
|
296
|
+
className: "group rounded-lg border border-border",
|
|
297
|
+
children: [/* @__PURE__ */ jsxs("summary", {
|
|
298
|
+
className: "flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 text-sm font-medium [&::-webkit-details-marker]:hidden",
|
|
299
|
+
children: [/* @__PURE__ */ jsx("i", {
|
|
300
|
+
"aria-hidden": "true",
|
|
301
|
+
className: "i-lucide-light:chevron-right shrink-0 text-muted-foreground group-open:rotate-90"
|
|
302
|
+
}), /* @__PURE__ */ jsx("span", { children: summary })]
|
|
303
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
304
|
+
className: "border-t border-border py-3 pr-3 pl-[calc(1.25rem+1em)]",
|
|
305
|
+
children: list
|
|
306
|
+
})]
|
|
307
|
+
}) : list,
|
|
308
|
+
status == "loading" && /* @__PURE__ */ jsx("p", {
|
|
309
|
+
className: "m-0 text-muted-foreground",
|
|
310
|
+
role: "status",
|
|
311
|
+
children: t("flowReferences.loading")
|
|
312
|
+
}),
|
|
313
|
+
status == "failed" && /* @__PURE__ */ jsxs("div", {
|
|
314
|
+
className: "space-y-2",
|
|
315
|
+
role: "alert",
|
|
316
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
317
|
+
className: "m-0 text-muted-foreground",
|
|
318
|
+
children: t("flowReferences.failed")
|
|
319
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
320
|
+
variant: "outline",
|
|
321
|
+
size: "sm",
|
|
322
|
+
disabled,
|
|
323
|
+
onClick: state.retry,
|
|
324
|
+
children: t("flowReferences.retry")
|
|
325
|
+
})]
|
|
326
|
+
}),
|
|
327
|
+
showEmpty && status == "ready" && result?.references.length == 0 && /* @__PURE__ */ jsx("p", {
|
|
328
|
+
className: "m-0 text-muted-foreground",
|
|
329
|
+
children: t("flowReferences.empty")
|
|
330
|
+
})
|
|
331
|
+
]
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
function FlowReferencesButton(props) {
|
|
335
|
+
const referenceCount = props.flow.referenceCount;
|
|
336
|
+
if (referenceCount == null || referenceCount == 0) return null;
|
|
337
|
+
return /* @__PURE__ */ jsx(FlowReferencesPopover, {
|
|
338
|
+
...props,
|
|
339
|
+
referenceCount
|
|
340
|
+
}, props.flow.flowId);
|
|
341
|
+
}
|
|
342
|
+
function FlowReferencesPopover({ flow, referenceCount, workspace, container, hrefForFlow, onSelectFlow }) {
|
|
343
|
+
const t = useTranslate();
|
|
344
|
+
const [open, setOpen] = useState(false);
|
|
345
|
+
const label = t("flowReferences.count", { count: referenceCount });
|
|
346
|
+
return /* @__PURE__ */ jsxs(Popover, {
|
|
347
|
+
open,
|
|
348
|
+
onOpenChange: setOpen,
|
|
349
|
+
children: [/* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsxs(TooltipTrigger, {
|
|
350
|
+
render: /* @__PURE__ */ jsx(PopoverTrigger, { render: /* @__PURE__ */ jsx(Button, {
|
|
351
|
+
"aria-label": label,
|
|
352
|
+
variant: "ghost",
|
|
353
|
+
size: "sm",
|
|
354
|
+
className: "text-muted-foreground"
|
|
355
|
+
}) }),
|
|
356
|
+
children: [/* @__PURE__ */ jsx("i", {
|
|
357
|
+
"aria-hidden": "true",
|
|
358
|
+
className: "i-lucide-light:link"
|
|
359
|
+
}), /* @__PURE__ */ jsx("span", { children: referenceCount })]
|
|
360
|
+
}), /* @__PURE__ */ jsx(TooltipContent, {
|
|
361
|
+
container,
|
|
362
|
+
collisionBoundary: [],
|
|
363
|
+
positionMethod: "fixed",
|
|
364
|
+
children: label
|
|
365
|
+
})] }), /* @__PURE__ */ jsxs(PopoverContent, {
|
|
366
|
+
container,
|
|
367
|
+
collisionBoundary: [],
|
|
368
|
+
positionMethod: "fixed",
|
|
369
|
+
align: "end",
|
|
370
|
+
className: "w-96 max-w-[calc(100vw-2rem)] max-h-(--available-height) overflow-y-auto gap-4 p-4",
|
|
371
|
+
children: [/* @__PURE__ */ jsx(PopoverTitle, {
|
|
372
|
+
className: "break-words text-base font-semibold",
|
|
373
|
+
children: t("flowReferences.title", { name: flow.name })
|
|
374
|
+
}), open && /* @__PURE__ */ jsx(FlowReferenceQuery, {
|
|
375
|
+
flowId: flow.flowId,
|
|
376
|
+
workspace,
|
|
377
|
+
hrefForFlow,
|
|
378
|
+
onSelectFlow
|
|
379
|
+
})]
|
|
380
|
+
})]
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
//#endregion
|
|
384
|
+
//#region src/workbench/browser/runtime/shell/flowDeletionDialog.tsx
|
|
210
385
|
function FlowDeletionImpact({ listeners, failed, onRetry }) {
|
|
211
386
|
const t = useTranslate();
|
|
212
387
|
if (failed) return /* @__PURE__ */ jsxs("div", {
|
|
@@ -228,11 +403,17 @@ function FlowDeletionImpact({ listeners, failed, onRetry }) {
|
|
|
228
403
|
children: t("sidebar.listenersLoading")
|
|
229
404
|
});
|
|
230
405
|
if (listeners.length == 0) return null;
|
|
231
|
-
return /* @__PURE__ */ jsxs("
|
|
232
|
-
className: "
|
|
233
|
-
children: [
|
|
234
|
-
|
|
235
|
-
/* @__PURE__ */ jsx("
|
|
406
|
+
return /* @__PURE__ */ jsxs("details", {
|
|
407
|
+
className: "group rounded-lg border border-border text-sm",
|
|
408
|
+
children: [/* @__PURE__ */ jsxs("summary", {
|
|
409
|
+
className: "flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 font-medium [&::-webkit-details-marker]:hidden",
|
|
410
|
+
children: [/* @__PURE__ */ jsx("i", {
|
|
411
|
+
"aria-hidden": "true",
|
|
412
|
+
className: "i-lucide-light:chevron-right shrink-0 text-muted-foreground group-open:rotate-90"
|
|
413
|
+
}), /* @__PURE__ */ jsx("span", { children: t("flowReferences.deleteListeners", { count: listeners.length }) })]
|
|
414
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
415
|
+
className: "space-y-3 border-t border-border py-3 pr-3 pl-[calc(1.25rem+1em)]",
|
|
416
|
+
children: [/* @__PURE__ */ jsx("ul", {
|
|
236
417
|
className: "m-0 max-h-48 list-none space-y-2 overflow-y-auto p-0",
|
|
237
418
|
children: listeners.map((listener) => /* @__PURE__ */ jsxs("li", {
|
|
238
419
|
className: "break-words",
|
|
@@ -249,46 +430,117 @@ function FlowDeletionImpact({ listeners, failed, onRetry }) {
|
|
|
249
430
|
})
|
|
250
431
|
]
|
|
251
432
|
}, `${listener.flowId}/${listener.nodeId}`))
|
|
252
|
-
}),
|
|
253
|
-
|
|
254
|
-
className: "text-muted-foreground",
|
|
433
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
434
|
+
className: "m-0 text-muted-foreground",
|
|
255
435
|
children: t("sidebar.listenersImpact")
|
|
256
|
-
})
|
|
257
|
-
]
|
|
436
|
+
})]
|
|
437
|
+
})]
|
|
258
438
|
});
|
|
259
439
|
}
|
|
260
|
-
function
|
|
261
|
-
const [root, setRoot] = useState(null);
|
|
262
|
-
const renameAnchor = useRef(null);
|
|
263
|
-
const actionsButton = useRef(null);
|
|
264
|
-
const nameInput = useRef(null);
|
|
265
|
-
const cancelDelete = useRef(null);
|
|
266
|
-
const locale = useLang();
|
|
440
|
+
function FlowDeletionDialog({ flow, workspace, container, busy, finalFocus, onClose, onDelete, ...navigation }) {
|
|
267
441
|
const t = useTranslate();
|
|
268
|
-
const
|
|
269
|
-
const
|
|
442
|
+
const cancel = useRef(null);
|
|
443
|
+
const references = useFlowReferences(flow.flowId, workspace);
|
|
270
444
|
const [listeners, setListeners] = useState();
|
|
271
|
-
const [
|
|
272
|
-
const [
|
|
445
|
+
const [listenerStatus, setListenerStatus] = useState("loading");
|
|
446
|
+
const [attempt, setAttempt] = useState(0);
|
|
273
447
|
useEffect(() => {
|
|
274
|
-
if (mode != "delete") return;
|
|
275
448
|
const controller = new AbortController();
|
|
276
449
|
setListeners(void 0);
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
if (
|
|
450
|
+
setListenerStatus("loading");
|
|
451
|
+
workspace.getErrorListeners(flow.flowId, controller.signal).then((value) => {
|
|
452
|
+
if (controller.signal.aborted) return;
|
|
453
|
+
setListeners(value);
|
|
454
|
+
setListenerStatus("ready");
|
|
280
455
|
}, () => {
|
|
281
|
-
if (!controller.signal.aborted)
|
|
456
|
+
if (!controller.signal.aborted) setListenerStatus("failed");
|
|
282
457
|
});
|
|
283
458
|
return () => controller.abort();
|
|
284
459
|
}, [
|
|
285
|
-
mode,
|
|
286
460
|
flow.flowId,
|
|
287
|
-
|
|
288
|
-
|
|
461
|
+
workspace,
|
|
462
|
+
attempt
|
|
289
463
|
]);
|
|
464
|
+
const hasReferences = references.result != null && references.result.total > 0;
|
|
465
|
+
const canDelete = busy == null && references.status == "ready" && listenerStatus == "ready";
|
|
466
|
+
return /* @__PURE__ */ jsx(Dialog, {
|
|
467
|
+
open: true,
|
|
468
|
+
onOpenChange: (open) => {
|
|
469
|
+
if (!open && busy == null) onClose();
|
|
470
|
+
},
|
|
471
|
+
children: /* @__PURE__ */ jsxs(DialogContent, {
|
|
472
|
+
container,
|
|
473
|
+
initialFocus: cancel,
|
|
474
|
+
finalFocus,
|
|
475
|
+
showCloseButton: false,
|
|
476
|
+
className: "max-h-[calc(100dvh-2rem)] grid-rows-[auto_minmax(0,1fr)_auto]",
|
|
477
|
+
children: [
|
|
478
|
+
/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, {
|
|
479
|
+
className: "break-words leading-snug",
|
|
480
|
+
children: t("sidebar.deleteFlowConfirm", { name: flow.name })
|
|
481
|
+
}), /* @__PURE__ */ jsx(DialogDescription, { children: t("resource.deleteDescription") })] }),
|
|
482
|
+
/* @__PURE__ */ jsxs("div", {
|
|
483
|
+
className: "min-h-0 space-y-2 overflow-y-auto",
|
|
484
|
+
children: [/* @__PURE__ */ jsx(FlowReferenceResults, {
|
|
485
|
+
state: references,
|
|
486
|
+
disabled: busy != null,
|
|
487
|
+
showEmpty: false,
|
|
488
|
+
summary: hasReferences ? t("flowReferences.deleteImpact", { count: references.result.total }) : void 0,
|
|
489
|
+
...navigation
|
|
490
|
+
}), /* @__PURE__ */ jsx(FlowDeletionImpact, {
|
|
491
|
+
listeners,
|
|
492
|
+
failed: listenerStatus == "failed",
|
|
493
|
+
onRetry: () => {
|
|
494
|
+
setListenerStatus("loading");
|
|
495
|
+
setAttempt((value) => value + 1);
|
|
496
|
+
}
|
|
497
|
+
})]
|
|
498
|
+
}),
|
|
499
|
+
/* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(Button, {
|
|
500
|
+
ref: cancel,
|
|
501
|
+
variant: "outline",
|
|
502
|
+
disabled: busy != null,
|
|
503
|
+
onClick: onClose,
|
|
504
|
+
children: t("common.cancel")
|
|
505
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
506
|
+
disabled: !canDelete,
|
|
507
|
+
onClick: onDelete,
|
|
508
|
+
variant: "destructive",
|
|
509
|
+
children: t(busy == "flow" ? "common.deleting" : hasReferences ? "flowReferences.deleteAnyway" : "common.delete")
|
|
510
|
+
})] })
|
|
511
|
+
]
|
|
512
|
+
})
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
//#endregion
|
|
516
|
+
//#region src/workbench/browser/runtime/shell/resourceBrowser.tsx
|
|
517
|
+
var CreateResourceDialog = lazy(() => import("./createResourceDialog-BQVD8Rqb.js"));
|
|
518
|
+
var flowIdTooltipAlignOffset = 44;
|
|
519
|
+
var renamePopoverAlignOffset = -12;
|
|
520
|
+
function compactFlowId(flowId) {
|
|
521
|
+
return flowId.length <= 20 ? flowId : `${flowId.slice(0, 10)}…${flowId.slice(-6)}`;
|
|
522
|
+
}
|
|
523
|
+
function formatUpdatedAt(updatedAt, locale) {
|
|
524
|
+
const date = new Date(updatedAt);
|
|
525
|
+
const current = /* @__PURE__ */ new Date();
|
|
526
|
+
return date.toLocaleString(locale, {
|
|
527
|
+
day: "numeric",
|
|
528
|
+
hour: "2-digit",
|
|
529
|
+
minute: "2-digit",
|
|
530
|
+
month: "short",
|
|
531
|
+
year: date.getFullYear() == current.getFullYear() ? void 0 : "numeric"
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
function FlowItem({ busy, flow, href, hrefForFlow, onSelect, store }) {
|
|
535
|
+
const [root, setRoot] = useState(null);
|
|
536
|
+
const renameAnchor = useRef(null);
|
|
537
|
+
const actionsButton = useRef(null);
|
|
538
|
+
const nameInput = useRef(null);
|
|
539
|
+
const locale = useLang();
|
|
540
|
+
const t = useTranslate();
|
|
541
|
+
const [mode, setMode] = useState("idle");
|
|
542
|
+
const [name, setName] = useState(flow.name);
|
|
290
543
|
const [pending, setPending] = useState();
|
|
291
|
-
const hasTeam = showTeam && Boolean(badge?.trim());
|
|
292
544
|
const changed = flow.live != null && flow.live.revisionId != flow.draftRevisionId;
|
|
293
545
|
const publicationStatus = flow.status == "retiring" ? "resource.retiring" : flow.live == null ? "resource.notPublished" : changed ? "resource.unpublishedChanges" : "resource.isPublished";
|
|
294
546
|
const publicationTone = flow.status == "retiring" ? "danger" : flow.live == null ? "neutral" : changed ? "running" : "success";
|
|
@@ -316,7 +568,6 @@ function FlowItem({ showTeam, badge, busy, flow, href, onSelect, store }) {
|
|
|
316
568
|
children: [
|
|
317
569
|
/* @__PURE__ */ jsxs("div", {
|
|
318
570
|
className: "resource-list-row flow-columns",
|
|
319
|
-
"data-has-team": hasTeam,
|
|
320
571
|
children: [
|
|
321
572
|
/* @__PURE__ */ jsxs("span", {
|
|
322
573
|
className: "resource-primary-cell",
|
|
@@ -439,11 +690,6 @@ function FlowItem({ showTeam, badge, busy, flow, href, onSelect, store }) {
|
|
|
439
690
|
alignOffset: flowIdTooltipAlignOffset
|
|
440
691
|
})
|
|
441
692
|
}),
|
|
442
|
-
showTeam && /* @__PURE__ */ jsx("span", {
|
|
443
|
-
className: "resource-team-cell",
|
|
444
|
-
title: badge,
|
|
445
|
-
children: hasTeam ? badge : "—"
|
|
446
|
-
}),
|
|
447
693
|
/* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
448
694
|
render: /* @__PURE__ */ jsx("time", {
|
|
449
695
|
className: "resource-updated-at",
|
|
@@ -475,10 +721,16 @@ function FlowItem({ showTeam, badge, busy, flow, href, onSelect, store }) {
|
|
|
475
721
|
})
|
|
476
722
|
]
|
|
477
723
|
}),
|
|
478
|
-
/* @__PURE__ */
|
|
724
|
+
/* @__PURE__ */ jsxs("div", {
|
|
479
725
|
className: "resource-live-controls",
|
|
480
726
|
"aria-busy": pending != null,
|
|
481
|
-
children:
|
|
727
|
+
children: [/* @__PURE__ */ jsx(FlowReferencesButton, {
|
|
728
|
+
flow,
|
|
729
|
+
workspace: store.workspace,
|
|
730
|
+
container: root,
|
|
731
|
+
hrefForFlow,
|
|
732
|
+
onSelectFlow: onSelect
|
|
733
|
+
}), /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
482
734
|
render: /* @__PURE__ */ jsx(DropdownMenuTrigger, { render: /* @__PURE__ */ jsx(Button, {
|
|
483
735
|
ref: actionsButton,
|
|
484
736
|
"aria-label": t("resource.actions"),
|
|
@@ -569,50 +821,28 @@ function FlowItem({ showTeam, badge, busy, flow, href, onSelect, store }) {
|
|
|
569
821
|
}), t("common.delete")]
|
|
570
822
|
})
|
|
571
823
|
]
|
|
572
|
-
})] })
|
|
824
|
+
})] })]
|
|
573
825
|
}),
|
|
574
|
-
/* @__PURE__ */ jsx(
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
children: [
|
|
585
|
-
/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: t("sidebar.deleteFlowConfirm", { name: flow.name }) }), /* @__PURE__ */ jsx(DialogDescription, { children: t("resource.deleteDescription") })] }),
|
|
586
|
-
/* @__PURE__ */ jsx(FlowDeletionImpact, {
|
|
587
|
-
listeners,
|
|
588
|
-
failed: listenersFailed,
|
|
589
|
-
onRetry: () => setListenersRetry((value) => value + 1)
|
|
590
|
-
}),
|
|
591
|
-
/* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(DialogClose, {
|
|
592
|
-
render: /* @__PURE__ */ jsx(Button, {
|
|
593
|
-
ref: cancelDelete,
|
|
594
|
-
variant: "outline"
|
|
595
|
-
}),
|
|
596
|
-
children: t("common.cancel")
|
|
597
|
-
}), /* @__PURE__ */ jsx(Button, {
|
|
598
|
-
disabled: busy != null || listeners == null && !listenersFailed,
|
|
599
|
-
onClick: () => void remove(),
|
|
600
|
-
variant: "destructive",
|
|
601
|
-
children: t(busy == "flow" ? "common.deleting" : "common.delete")
|
|
602
|
-
})] })
|
|
603
|
-
]
|
|
604
|
-
})
|
|
826
|
+
mode == "delete" && /* @__PURE__ */ jsx(FlowDeletionDialog, {
|
|
827
|
+
flow,
|
|
828
|
+
workspace: store.workspace,
|
|
829
|
+
container: root,
|
|
830
|
+
busy,
|
|
831
|
+
finalFocus: () => actionsButton.current,
|
|
832
|
+
onClose: () => setMode("idle"),
|
|
833
|
+
onDelete: () => void remove(),
|
|
834
|
+
hrefForFlow,
|
|
835
|
+
onSelectFlow: onSelect
|
|
605
836
|
})
|
|
606
837
|
]
|
|
607
838
|
});
|
|
608
839
|
}
|
|
609
|
-
function FlowSkeleton(
|
|
840
|
+
function FlowSkeleton() {
|
|
610
841
|
return /* @__PURE__ */ jsxs("div", {
|
|
611
842
|
"aria-hidden": "true",
|
|
612
843
|
className: "resource-item-row",
|
|
613
844
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
614
845
|
className: "resource-list-row flow-columns",
|
|
615
|
-
"data-has-team": showTeam,
|
|
616
846
|
children: [
|
|
617
847
|
/* @__PURE__ */ jsxs("span", {
|
|
618
848
|
className: "resource-primary-cell",
|
|
@@ -622,7 +852,6 @@ function FlowSkeleton({ showTeam }) {
|
|
|
622
852
|
})]
|
|
623
853
|
}),
|
|
624
854
|
/* @__PURE__ */ jsx(Skeleton, { className: "resource-flow-id-cell h-3 w-36 max-w-full" }),
|
|
625
|
-
showTeam && /* @__PURE__ */ jsx(Skeleton, { className: "resource-team-cell h-3 w-24 max-w-full" }),
|
|
626
855
|
/* @__PURE__ */ jsx(Skeleton, { className: "resource-updated-at h-3 w-28 max-w-full" }),
|
|
627
856
|
/* @__PURE__ */ jsx(Skeleton, { className: "resource-publication-status h-3 w-16" }),
|
|
628
857
|
/* @__PURE__ */ jsx(Skeleton, { className: "resource-status h-3 w-16" })
|
|
@@ -633,7 +862,7 @@ function FlowSkeleton({ showTeam }) {
|
|
|
633
862
|
})]
|
|
634
863
|
});
|
|
635
864
|
}
|
|
636
|
-
var FlowBrowser = forwardRef(function FlowBrowser({ catalogWidth, createFlowDisabled, createFlowField,
|
|
865
|
+
var FlowBrowser = forwardRef(function FlowBrowser({ catalogWidth, createFlowDisabled, createFlowField, hrefForFlow, initializing = false, onCreateFlow, onImportFlow, onSelectFlow, store, language }, ref) {
|
|
637
866
|
const t = useTranslate();
|
|
638
867
|
const busy = useVal(store.workspace.$.busy);
|
|
639
868
|
const loadFailed = useVal(store.workspace.$.flowLoadFailed);
|
|
@@ -647,11 +876,9 @@ var FlowBrowser = forwardRef(function FlowBrowser({ catalogWidth, createFlowDisa
|
|
|
647
876
|
const total = useVal(store.workspace.$.flowTotal);
|
|
648
877
|
const [creation$] = useState(() => val(void 0));
|
|
649
878
|
const creation = useVal(creation$);
|
|
650
|
-
const [importError, setImportError] = useState(false);
|
|
651
879
|
const fileInput = useRef(null);
|
|
652
880
|
const [filter, setFilter] = useState("");
|
|
653
881
|
const [name, setName] = useState("");
|
|
654
|
-
const showTeam = flows.some((flow) => (flowBadges?.[flow.flowId]?.trim().length ?? 0) > 0);
|
|
655
882
|
const normalized = filter.trim().toLocaleLowerCase();
|
|
656
883
|
const visible = flows.filter((flow) => flow.name.toLocaleLowerCase().includes(normalized));
|
|
657
884
|
const command = useRef();
|
|
@@ -664,12 +891,14 @@ var FlowBrowser = forwardRef(function FlowBrowser({ catalogWidth, createFlowDisa
|
|
|
664
891
|
});
|
|
665
892
|
function openImport(input) {
|
|
666
893
|
if (initializing || store.workspace.$.busy.value != null || creation$.value != null || onImportFlow == null) return "unavailable";
|
|
667
|
-
setImportError(false);
|
|
668
894
|
let file;
|
|
669
895
|
try {
|
|
670
896
|
file = parseWorkflowFile(input.text);
|
|
671
897
|
} catch {
|
|
672
|
-
|
|
898
|
+
store.workspace.notify({
|
|
899
|
+
kind: "error",
|
|
900
|
+
message: t("resource.importInvalid")
|
|
901
|
+
});
|
|
673
902
|
return "invalid-file";
|
|
674
903
|
}
|
|
675
904
|
setName(file.name ?? (input.fileName == null ? importedWorkflowName(language) : workflowNameFromFile(input.fileName)));
|
|
@@ -748,13 +977,15 @@ var FlowBrowser = forwardRef(function FlowBrowser({ catalogWidth, createFlowDisa
|
|
|
748
977
|
const file = event.target.files?.[0];
|
|
749
978
|
event.target.value = "";
|
|
750
979
|
if (file == null) return;
|
|
751
|
-
setImportError(false);
|
|
752
980
|
file.text().then((text) => {
|
|
753
981
|
command.current?.({
|
|
754
982
|
text,
|
|
755
983
|
fileName: file.name
|
|
756
984
|
});
|
|
757
|
-
}).catch(() =>
|
|
985
|
+
}).catch(() => store.workspace.notify({
|
|
986
|
+
kind: "error",
|
|
987
|
+
message: t("resource.importInvalid")
|
|
988
|
+
}));
|
|
758
989
|
}
|
|
759
990
|
}), /* @__PURE__ */ jsx(Button, {
|
|
760
991
|
variant: "outline",
|
|
@@ -774,14 +1005,10 @@ var FlowBrowser = forwardRef(function FlowBrowser({ catalogWidth, createFlowDisa
|
|
|
774
1005
|
]
|
|
775
1006
|
})]
|
|
776
1007
|
}),
|
|
777
|
-
importError && /* @__PURE__ */ jsx("p", {
|
|
778
|
-
role: "alert",
|
|
779
|
-
children: t("resource.importInvalid")
|
|
780
|
-
}),
|
|
781
1008
|
/* @__PURE__ */ jsx("div", {
|
|
782
1009
|
className: "resource-table-scroll",
|
|
783
1010
|
children: /* @__PURE__ */ jsxs("div", {
|
|
784
|
-
className:
|
|
1011
|
+
className: "resource-table",
|
|
785
1012
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
786
1013
|
"aria-hidden": "true",
|
|
787
1014
|
className: "resource-list-columns-shell",
|
|
@@ -793,10 +1020,6 @@ var FlowBrowser = forwardRef(function FlowBrowser({ catalogWidth, createFlowDisa
|
|
|
793
1020
|
className: "resource-flow-id-heading",
|
|
794
1021
|
children: t("resource.flowId")
|
|
795
1022
|
}),
|
|
796
|
-
showTeam && /* @__PURE__ */ jsx("span", {
|
|
797
|
-
className: "resource-team-heading",
|
|
798
|
-
children: t("resource.team")
|
|
799
|
-
}),
|
|
800
1023
|
/* @__PURE__ */ jsx("span", {
|
|
801
1024
|
className: "resource-updated-heading",
|
|
802
1025
|
children: t("resource.updated")
|
|
@@ -810,7 +1033,7 @@ var FlowBrowser = forwardRef(function FlowBrowser({ catalogWidth, createFlowDisa
|
|
|
810
1033
|
})]
|
|
811
1034
|
}), /* @__PURE__ */ jsx("div", {
|
|
812
1035
|
className: "resource-list",
|
|
813
|
-
children: loading ? Array.from({ length: 5 }, (_, index) => /* @__PURE__ */ jsx(FlowSkeleton, {
|
|
1036
|
+
children: loading ? Array.from({ length: 5 }, (_, index) => /* @__PURE__ */ jsx(FlowSkeleton, {}, index)) : loadFailed ? /* @__PURE__ */ jsxs(Empty, {
|
|
814
1037
|
className: "min-h-64",
|
|
815
1038
|
role: "alert",
|
|
816
1039
|
children: [/* @__PURE__ */ jsxs(EmptyHeader, { children: [
|
|
@@ -849,11 +1072,10 @@ var FlowBrowser = forwardRef(function FlowBrowser({ catalogWidth, createFlowDisa
|
|
|
849
1072
|
}), t("resource.newFlow")]
|
|
850
1073
|
}) })]
|
|
851
1074
|
}) : visible.map((flow) => /* @__PURE__ */ jsx(FlowItem, {
|
|
852
|
-
showTeam,
|
|
853
|
-
badge: flowBadges?.[flow.flowId],
|
|
854
1075
|
busy,
|
|
855
1076
|
flow,
|
|
856
1077
|
href: hrefForFlow(flow),
|
|
1078
|
+
hrefForFlow,
|
|
857
1079
|
onSelect: onSelectFlow,
|
|
858
1080
|
store
|
|
859
1081
|
}, flow.flowId))
|
|
@@ -1631,26 +1853,30 @@ var PublicationStore = class {
|
|
|
1631
1853
|
var initialState$5 = { starting: false };
|
|
1632
1854
|
function inputSpec(draft, triggerId) {
|
|
1633
1855
|
const trigger = revisionView(draft).graph()?.nodes[triggerId];
|
|
1634
|
-
if (trigger == null ||
|
|
1856
|
+
if (trigger == null || !isTriggerNode(trigger) || trigger.kind == "manual" || trigger.kind == "cron") return void 0;
|
|
1635
1857
|
const definitions = triggerOutputDefinitions(trigger);
|
|
1636
1858
|
return definitions.length === 0 ? void 0 : {
|
|
1637
1859
|
definitions,
|
|
1860
|
+
allowOmittedNullable: trigger.kind == "start",
|
|
1638
1861
|
samples: trigger.kind == "error" ? sampleErrorOutputs : void 0
|
|
1639
1862
|
};
|
|
1640
1863
|
}
|
|
1641
1864
|
function inputSignature(spec) {
|
|
1642
|
-
return JSON.stringify(
|
|
1643
|
-
|
|
1644
|
-
definition
|
|
1645
|
-
|
|
1646
|
-
|
|
1865
|
+
return JSON.stringify({
|
|
1866
|
+
allowOmittedNullable: spec?.allowOmittedNullable ?? false,
|
|
1867
|
+
definitions: spec?.definitions.map((definition) => [
|
|
1868
|
+
definition.handle,
|
|
1869
|
+
definition.jsonSchema,
|
|
1870
|
+
definition.nullable
|
|
1871
|
+
]) ?? []
|
|
1872
|
+
});
|
|
1647
1873
|
}
|
|
1648
1874
|
async function inputEditor(spec, language, values) {
|
|
1649
1875
|
if (spec == null) return void 0;
|
|
1650
|
-
const { FlowRunInputEditorStore } = await import("./flowRunInputEditorStore-
|
|
1651
|
-
const editor = new FlowRunInputEditorStore(spec.definitions, language);
|
|
1876
|
+
const { FlowRunInputEditorStore } = await import("./flowRunInputEditorStore-DJqmR6Qh.js").then((n) => n.t);
|
|
1877
|
+
const editor = new FlowRunInputEditorStore(spec.definitions, language, { allowOmittedNullable: spec.allowOmittedNullable });
|
|
1652
1878
|
const initial = values ?? spec.samples;
|
|
1653
|
-
if (initial != null) editor.replaceValues(initial);
|
|
1879
|
+
if (initial != null) editor.replaceValues(Object.fromEntries(spec.definitions.flatMap(({ handle }) => Object.hasOwn(initial, handle) ? [[handle, initial[handle]]] : [])));
|
|
1654
1880
|
return editor;
|
|
1655
1881
|
}
|
|
1656
1882
|
function testOutputs(revision, triggerId) {
|
|
@@ -1702,7 +1928,7 @@ var RunRequestStore = class {
|
|
|
1702
1928
|
async requestDraft(flow, draft, triggerId) {
|
|
1703
1929
|
const current = this.#requests.begin();
|
|
1704
1930
|
try {
|
|
1705
|
-
return await this.#request("draft", flow, draft,
|
|
1931
|
+
return await this.#request("draft", flow, draft, current, void 0, triggerId);
|
|
1706
1932
|
} catch (error) {
|
|
1707
1933
|
if (current()) this.#setNotice(errorNotice(error, this.#i18n.t));
|
|
1708
1934
|
return "unavailable";
|
|
@@ -1713,7 +1939,7 @@ var RunRequestStore = class {
|
|
|
1713
1939
|
async editDraft(flow, draft, triggerId) {
|
|
1714
1940
|
const current = this.#requests.begin();
|
|
1715
1941
|
try {
|
|
1716
|
-
return await this.#request("draft", flow, draft,
|
|
1942
|
+
return await this.#request("draft", flow, draft, current, void 0, triggerId, true);
|
|
1717
1943
|
} catch (error) {
|
|
1718
1944
|
if (current()) this.#setNotice(errorNotice(error, this.#i18n.t));
|
|
1719
1945
|
return "unavailable";
|
|
@@ -1723,7 +1949,10 @@ var RunRequestStore = class {
|
|
|
1723
1949
|
}
|
|
1724
1950
|
inputStatus(flowId, draft, triggerId) {
|
|
1725
1951
|
const spec = inputSpec(draft, triggerId);
|
|
1726
|
-
if (spec == null)
|
|
1952
|
+
if (spec == null) {
|
|
1953
|
+
const request = this.#state.value.inputRequest;
|
|
1954
|
+
return request?.flow.flowId == flowId && request.triggerId == triggerId ? "ready" : "none";
|
|
1955
|
+
}
|
|
1727
1956
|
const saved = this.#savedInputs.get(this.#inputKey(flowId, triggerId));
|
|
1728
1957
|
return saved?.valid == true && saved.signature == inputSignature(spec) ? "ready" : "missing";
|
|
1729
1958
|
}
|
|
@@ -1735,7 +1964,7 @@ var RunRequestStore = class {
|
|
|
1735
1964
|
if (publication == null) return "unavailable";
|
|
1736
1965
|
const revision = await this.#client.getRevision(flow.flowId, publication.revisionId);
|
|
1737
1966
|
if (!current()) return "unavailable";
|
|
1738
|
-
return await this.#request("live", flow, revision,
|
|
1967
|
+
return await this.#request("live", flow, revision, current, publication.publicationId);
|
|
1739
1968
|
} catch (error) {
|
|
1740
1969
|
if (current()) this.#setNotice(errorNotice(error, this.#i18n.t));
|
|
1741
1970
|
return "unavailable";
|
|
@@ -1752,7 +1981,7 @@ var RunRequestStore = class {
|
|
|
1752
1981
|
async confirmInputs() {
|
|
1753
1982
|
const request = this.#state.value.inputRequest;
|
|
1754
1983
|
if (request == null || request.triggerId == null) return false;
|
|
1755
|
-
if (!request.valid.value) {
|
|
1984
|
+
if (request.source == "live" && !request.valid.value) {
|
|
1756
1985
|
this.#set({ inputRequest: {
|
|
1757
1986
|
...request,
|
|
1758
1987
|
attempted: true
|
|
@@ -1761,10 +1990,10 @@ var RunRequestStore = class {
|
|
|
1761
1990
|
}
|
|
1762
1991
|
this.#rememberInputs(request);
|
|
1763
1992
|
const outputs = request.editor?.values() ?? testOutputs(request.revision, request.triggerId);
|
|
1764
|
-
const started = await this.#start(request.source, request.flow, request.
|
|
1993
|
+
const started = await this.#start(request.source, request.flow, request.revision, {
|
|
1765
1994
|
nodeId: request.triggerId,
|
|
1766
1995
|
outputs
|
|
1767
|
-
}, request.publicationId);
|
|
1996
|
+
}, request.publicationId, request);
|
|
1768
1997
|
if (started && this.#state.value.inputRequest === request) this.dismissInputs();
|
|
1769
1998
|
return started;
|
|
1770
1999
|
}
|
|
@@ -1797,7 +2026,7 @@ var RunRequestStore = class {
|
|
|
1797
2026
|
if (current()) this.#set({ starting: false });
|
|
1798
2027
|
}
|
|
1799
2028
|
}
|
|
1800
|
-
async #request(source, flow, revision,
|
|
2029
|
+
async #request(source, flow, revision, current, publicationId, triggerId, edit = false) {
|
|
1801
2030
|
const previous = this.#state.value.inputRequest;
|
|
1802
2031
|
this.#rememberInputs(previous);
|
|
1803
2032
|
this.#set({
|
|
@@ -1807,7 +2036,7 @@ var RunRequestStore = class {
|
|
|
1807
2036
|
});
|
|
1808
2037
|
this.#disposeInputRequest(previous);
|
|
1809
2038
|
const graph = revisionView(revision).graph();
|
|
1810
|
-
const triggers = Object.entries(graph?.nodes ?? {}).flatMap(([nodeId, node]) =>
|
|
2039
|
+
const triggers = Object.entries(graph?.nodes ?? {}).flatMap(([nodeId, node]) => !isTriggerNode(node) ? [] : [{
|
|
1811
2040
|
nodeId,
|
|
1812
2041
|
title: node.name
|
|
1813
2042
|
}]);
|
|
@@ -1819,7 +2048,7 @@ var RunRequestStore = class {
|
|
|
1819
2048
|
});
|
|
1820
2049
|
return "unavailable";
|
|
1821
2050
|
}
|
|
1822
|
-
const only = triggerId == null ? triggers[0] : triggers.find((trigger) => trigger.nodeId == triggerId);
|
|
2051
|
+
const only = triggerId == null ? triggers.find((trigger) => graph?.nodes[trigger.nodeId]?.kind == "start") ?? triggers[0] : triggers.find((trigger) => trigger.nodeId == triggerId);
|
|
1823
2052
|
if (triggerId != null && only == null) {
|
|
1824
2053
|
this.#set({ starting: false });
|
|
1825
2054
|
this.#setNotice({
|
|
@@ -1836,14 +2065,14 @@ var RunRequestStore = class {
|
|
|
1836
2065
|
editor?.dispose();
|
|
1837
2066
|
return "unavailable";
|
|
1838
2067
|
}
|
|
1839
|
-
if (!edit && only != null && editor == null) return await this.#start(source, flow,
|
|
2068
|
+
if (!edit && only != null && editor == null) return await this.#start(source, flow, revision, {
|
|
1840
2069
|
nodeId: only.nodeId,
|
|
1841
2070
|
outputs: testOutputs(revision, only.nodeId)
|
|
1842
2071
|
}, publicationId) ? "started" : "unavailable";
|
|
1843
2072
|
if (!edit && only != null && saved?.valid == true && saved.signature == signature && editor != null && editor.valid$.value) {
|
|
1844
2073
|
const outputs = editor.values();
|
|
1845
2074
|
editor?.dispose();
|
|
1846
|
-
return await this.#start(source, flow,
|
|
2075
|
+
return await this.#start(source, flow, revision, {
|
|
1847
2076
|
nodeId: only.nodeId,
|
|
1848
2077
|
outputs
|
|
1849
2078
|
}, publicationId) ? "started" : "unavailable";
|
|
@@ -1858,7 +2087,6 @@ var RunRequestStore = class {
|
|
|
1858
2087
|
triggers,
|
|
1859
2088
|
triggerId: only?.nodeId,
|
|
1860
2089
|
...publicationId == null ? {} : { publicationId },
|
|
1861
|
-
revisionId,
|
|
1862
2090
|
source,
|
|
1863
2091
|
valid
|
|
1864
2092
|
},
|
|
@@ -1867,23 +2095,46 @@ var RunRequestStore = class {
|
|
|
1867
2095
|
});
|
|
1868
2096
|
return "input";
|
|
1869
2097
|
}
|
|
1870
|
-
async #start(source, flow,
|
|
2098
|
+
async #start(source, flow, revision, trigger, publicationId, request) {
|
|
1871
2099
|
if (source == "live" && publicationId == null) return false;
|
|
1872
2100
|
const alive = this.#lifetime.capture();
|
|
1873
|
-
const
|
|
2101
|
+
const requestCurrent = this.#requests.begin();
|
|
2102
|
+
let current = this.#runs.captureSelection();
|
|
1874
2103
|
this.#set({
|
|
1875
2104
|
starting: true,
|
|
1876
2105
|
submitting: source
|
|
1877
2106
|
});
|
|
1878
2107
|
try {
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
2108
|
+
const prepared = source == "draft" ? await this.#prepareDraft(flow.flowId) : revision;
|
|
2109
|
+
if (prepared == null || !alive() || !current() || !requestCurrent()) return false;
|
|
2110
|
+
const node = revisionView(prepared).trigger(trigger.nodeId);
|
|
2111
|
+
if (node == null || node.kind !== revisionView(revision).trigger(trigger.nodeId)?.kind || inputSignature(inputSpec(prepared, trigger.nodeId)) !== inputSignature(inputSpec(revision, trigger.nodeId))) {
|
|
2112
|
+
await this.#request(source, flow, prepared, requestCurrent, publicationId, trigger.nodeId, true);
|
|
2113
|
+
return false;
|
|
2114
|
+
}
|
|
2115
|
+
if (request != null && !request.valid.value) {
|
|
2116
|
+
if (this.#state.value.inputRequest === request) this.#set({ inputRequest: {
|
|
2117
|
+
...request,
|
|
2118
|
+
attempted: true
|
|
2119
|
+
} });
|
|
2120
|
+
return false;
|
|
2121
|
+
}
|
|
2122
|
+
const outputs = normalizeTriggerOutputs(node, request?.editor?.values() ?? trigger.outputs);
|
|
2123
|
+
if (outputs == null) {
|
|
2124
|
+
this.#setNotice({
|
|
2125
|
+
kind: "error",
|
|
2126
|
+
message: this.#i18n.t("runInput.invalid")
|
|
2127
|
+
});
|
|
2128
|
+
return false;
|
|
1883
2129
|
}
|
|
2130
|
+
current = this.#runs.prepareStart();
|
|
2131
|
+
trigger = {
|
|
2132
|
+
nodeId: trigger.nodeId,
|
|
2133
|
+
outputs
|
|
2134
|
+
};
|
|
1884
2135
|
const target = source == "draft" ? {
|
|
1885
2136
|
flowId: flow.flowId,
|
|
1886
|
-
revisionId
|
|
2137
|
+
revisionId: prepared.revisionId
|
|
1887
2138
|
} : { publicationId };
|
|
1888
2139
|
const signature = JSON.stringify({
|
|
1889
2140
|
trigger,
|
|
@@ -1895,7 +2146,7 @@ var RunRequestStore = class {
|
|
|
1895
2146
|
signature
|
|
1896
2147
|
};
|
|
1897
2148
|
this.#attempt = attempt;
|
|
1898
|
-
const run = source == "draft" ? await this.#client.createDraftRun(flow.flowId, revisionId, {
|
|
2149
|
+
const run = source == "draft" ? await this.#client.createDraftRun(flow.flowId, prepared.revisionId, {
|
|
1899
2150
|
idempotencyKey: attempt.key,
|
|
1900
2151
|
inputs: {},
|
|
1901
2152
|
trigger
|
|
@@ -1904,14 +2155,14 @@ var RunRequestStore = class {
|
|
|
1904
2155
|
inputs: {},
|
|
1905
2156
|
trigger
|
|
1906
2157
|
});
|
|
1907
|
-
if (!alive() || !current()) return false;
|
|
2158
|
+
if (!alive() || !current() || !requestCurrent()) return false;
|
|
1908
2159
|
this.#attempt = void 0;
|
|
1909
2160
|
return this.#runs.follow(run, current);
|
|
1910
2161
|
} catch (error) {
|
|
1911
|
-
if (alive() && current()) this.#setNotice(errorNotice(error, this.#i18n.t));
|
|
2162
|
+
if (alive() && current() && requestCurrent()) this.#setNotice(errorNotice(error, this.#i18n.t));
|
|
1912
2163
|
return false;
|
|
1913
2164
|
} finally {
|
|
1914
|
-
if (alive()) this.#set({
|
|
2165
|
+
if (alive() && requestCurrent()) this.#set({
|
|
1915
2166
|
starting: false,
|
|
1916
2167
|
submitting: void 0
|
|
1917
2168
|
});
|
|
@@ -3467,7 +3718,7 @@ function connectionDiagnostics(revision, actions, catalogs) {
|
|
|
3467
3718
|
const diagnostics = [];
|
|
3468
3719
|
for (const { nodeId, actionId, connectionId } of revision.connectorNodes()) {
|
|
3469
3720
|
const action = actions[actionId];
|
|
3470
|
-
if (action?.authenticated != true) continue;
|
|
3721
|
+
if (action?.authenticated != true || connectionId === "") continue;
|
|
3471
3722
|
const connection = connectionId == null ? void 0 : catalogs[action.serviceId]?.byId.get(connectionId);
|
|
3472
3723
|
if (connectionId != null && (catalogs[action.serviceId] == null || connection?.status == "active")) continue;
|
|
3473
3724
|
diagnostics.push({
|
|
@@ -4099,11 +4350,19 @@ var TriggerStore = class {
|
|
|
4099
4350
|
};
|
|
4100
4351
|
//#endregion
|
|
4101
4352
|
//#region src/flow/common/inverseChanges.ts
|
|
4102
|
-
/** Invert
|
|
4353
|
+
/** Invert authoring operations and cascading deletions while retaining model upgrades. */
|
|
4103
4354
|
function inverseFlowChanges(content, operations) {
|
|
4104
|
-
let current = content;
|
|
4355
|
+
let current = upgradeRevisionContent(content);
|
|
4105
4356
|
const groups = [];
|
|
4106
|
-
for (const
|
|
4357
|
+
for (const requested of operations) {
|
|
4358
|
+
const operation = requested.kind == "graph.node.create" ? {
|
|
4359
|
+
...requested,
|
|
4360
|
+
node: upgradeManualTrigger(requested.node)
|
|
4361
|
+
} : requested.kind == "graph.node.replace" && requested.before.kind == "manual" && requested.node.kind == "manual" ? {
|
|
4362
|
+
...requested,
|
|
4363
|
+
before: upgradeManualTrigger(requested.before),
|
|
4364
|
+
node: upgradeManualTrigger(requested.node)
|
|
4365
|
+
} : requested;
|
|
4107
4366
|
const after = applyFlowChanges$1(current, [operation]);
|
|
4108
4367
|
const restore = [];
|
|
4109
4368
|
switch (operation.kind) {
|
|
@@ -4200,7 +4459,13 @@ function inverseFlowChanges(content, operations) {
|
|
|
4200
4459
|
const afterGraph = after.document.graph;
|
|
4201
4460
|
const beforeNode = beforeGraph.nodes[operation.nodeId];
|
|
4202
4461
|
const afterNode = afterGraph.nodes[operation.nodeId];
|
|
4203
|
-
if (beforeNode.kind === "
|
|
4462
|
+
if (beforeNode.kind === "outputs") restore.push({
|
|
4463
|
+
kind: "graph.node.replace",
|
|
4464
|
+
nodeId: operation.nodeId,
|
|
4465
|
+
before: afterNode,
|
|
4466
|
+
node: beforeNode
|
|
4467
|
+
});
|
|
4468
|
+
else if (beforeNode.kind === "condition" && afterNode.kind === "condition") restore.push({
|
|
4204
4469
|
kind: "graph.node.condition.set",
|
|
4205
4470
|
nodeId: operation.nodeId,
|
|
4206
4471
|
before: {
|
|
@@ -4332,7 +4597,7 @@ function copyNodes(revision, nodeIds) {
|
|
|
4332
4597
|
return {
|
|
4333
4598
|
edges: (revision.graph()?.edges ?? []).filter((edge) => copied[edge.source] != null && copied[edge.target] != null),
|
|
4334
4599
|
bindings: Object.fromEntries(Object.values(copied).flatMap((node) => {
|
|
4335
|
-
if (!("inputs" in node)) return [];
|
|
4600
|
+
if (!("inputs" in node) && node.kind != "outputs") return [];
|
|
4336
4601
|
return Object.values(nodeInputMappings(node)).flatMap((mapping) => mapping.kind == "sources" ? mapping.sources.flatMap((source) => {
|
|
4337
4602
|
if (source.kind != "binding") return [];
|
|
4338
4603
|
const binding = revision.binding(source.bindingId);
|
|
@@ -4348,15 +4613,16 @@ function copyNodes(revision, nodeIds) {
|
|
|
4348
4613
|
};
|
|
4349
4614
|
}
|
|
4350
4615
|
function pasteNodes(revision, clipboard, identity) {
|
|
4616
|
+
const hasOutputs = Object.values(revision.graph().nodes).some((node) => node.kind == "outputs");
|
|
4351
4617
|
const hasErrorTrigger = Object.values(revision.graph()?.nodes ?? {}).some((node) => node.kind === "error");
|
|
4352
|
-
const
|
|
4353
|
-
const entries = Object.entries(clipboard.nodes).filter(([, node]) => (node.kind !== "manual" || !
|
|
4618
|
+
const hasStartTrigger = Object.values(revision.graph()?.nodes ?? {}).some((node) => node.kind === "manual" || node.kind === "start");
|
|
4619
|
+
const entries = Object.entries(clipboard.nodes).filter(([, node]) => (node.kind !== "manual" && node.kind !== "start" || !hasStartTrigger) && (node.kind !== "outputs" || !hasOutputs) && (node.kind !== "error" || !hasErrorTrigger) && (node.kind != "task" || !("moduleId" in node.task) || clipboard.modules[node.task.moduleId] != null));
|
|
4354
4620
|
const sourceIds = entries.map(([sourceId]) => sourceId);
|
|
4355
4621
|
const ids = new Map(sourceIds.map((sourceId) => [sourceId, identity()]));
|
|
4356
4622
|
const operations = [];
|
|
4357
4623
|
const bindingIds = /* @__PURE__ */ new Map();
|
|
4358
4624
|
for (const [, node] of entries) {
|
|
4359
|
-
if (!("inputs" in node)) continue;
|
|
4625
|
+
if (!("inputs" in node) && node.kind != "outputs") continue;
|
|
4360
4626
|
const inputs = Object.values(nodeInputMappings(node));
|
|
4361
4627
|
for (const mapping of inputs) {
|
|
4362
4628
|
if (mapping.kind != "sources") continue;
|
|
@@ -4376,7 +4642,7 @@ function pasteNodes(revision, clipboard, identity) {
|
|
|
4376
4642
|
}
|
|
4377
4643
|
for (const [sourceId, node] of entries) {
|
|
4378
4644
|
const nodeId = ids.get(sourceId);
|
|
4379
|
-
if (!("inputs" in node)) {
|
|
4645
|
+
if (!("inputs" in node) && node.kind != "outputs") {
|
|
4380
4646
|
operations.push({
|
|
4381
4647
|
kind: "graph.node.create",
|
|
4382
4648
|
node,
|
|
@@ -4418,8 +4684,11 @@ function pasteNodes(revision, clipboard, identity) {
|
|
|
4418
4684
|
}
|
|
4419
4685
|
return inputs;
|
|
4420
4686
|
};
|
|
4421
|
-
const inputs = remapInputs(node
|
|
4422
|
-
let copy = {
|
|
4687
|
+
const inputs = remapInputs(nodeInputMappings(node));
|
|
4688
|
+
let copy = node.kind == "outputs" ? {
|
|
4689
|
+
...node,
|
|
4690
|
+
outputMappings: inputs
|
|
4691
|
+
} : {
|
|
4423
4692
|
...node,
|
|
4424
4693
|
inputs
|
|
4425
4694
|
};
|
|
@@ -4846,11 +5115,12 @@ var FlowCatalog = class {
|
|
|
4846
5115
|
limit: pageLimit
|
|
4847
5116
|
});
|
|
4848
5117
|
if (!current()) return;
|
|
4849
|
-
const
|
|
5118
|
+
const flows = new Map(this.#state.value.flows.map((flow) => [flow.flowId, flow]));
|
|
5119
|
+
for (const flow of page.flows) flows.set(flow.flowId, flow);
|
|
4850
5120
|
this.#set({
|
|
4851
5121
|
loadingMore: false,
|
|
4852
5122
|
nextCursor: page.nextCursor,
|
|
4853
|
-
flows: [...
|
|
5123
|
+
flows: [...flows.values()]
|
|
4854
5124
|
});
|
|
4855
5125
|
} catch (error) {
|
|
4856
5126
|
if (!current()) return;
|
|
@@ -4912,7 +5182,11 @@ var FlowCatalog = class {
|
|
|
4912
5182
|
this.#set({ flows: [...this.#state.value.flows, flow] });
|
|
4913
5183
|
return;
|
|
4914
5184
|
}
|
|
4915
|
-
|
|
5185
|
+
const referenceCount = this.#state.value.flows[index].referenceCount;
|
|
5186
|
+
this.#set({ flows: this.#state.value.flows.with(index, {
|
|
5187
|
+
...flow,
|
|
5188
|
+
...referenceCount == null ? {} : { referenceCount }
|
|
5189
|
+
}) });
|
|
4916
5190
|
}
|
|
4917
5191
|
insert(flow) {
|
|
4918
5192
|
if (this.#state.value.flows.some((candidate) => candidate.flowId == flow.flowId)) return;
|
|
@@ -5346,6 +5620,9 @@ var WorkspaceStore = class {
|
|
|
5346
5620
|
this.filterTriggerConnections = filterTriggerConnections;
|
|
5347
5621
|
this.#canvasCommandListeners = /* @__PURE__ */ new Set();
|
|
5348
5622
|
this.#draftSession = new Latest();
|
|
5623
|
+
this.notify = (notice) => {
|
|
5624
|
+
if (!this.#disposed) this.#setNotice(notice);
|
|
5625
|
+
};
|
|
5349
5626
|
this.#history = new CanvasHistory();
|
|
5350
5627
|
this.history$ = this.#history.state$;
|
|
5351
5628
|
this.#diagnosticFocusId = 0;
|
|
@@ -5491,7 +5768,18 @@ var WorkspaceStore = class {
|
|
|
5491
5768
|
this.#stopFlowWatch = subscription.stop;
|
|
5492
5769
|
await subscription.ready;
|
|
5493
5770
|
if (!current()) return false;
|
|
5494
|
-
|
|
5771
|
+
let editor = await this.#client.getEditor(flowId);
|
|
5772
|
+
for (let attempt = 0; current() && Object.values(revisionView(editor.draft).graph().nodes).some((node) => node.kind == "manual"); attempt += 1) {
|
|
5773
|
+
if (attempt >= 3) throw new ApiError(409, controlErrorCode.flowRevisionConflict, "The Draft changed while upgrading its Start node.");
|
|
5774
|
+
try {
|
|
5775
|
+
await this.#client.upgradeDraft(flowId, editor.draft.revisionId, { idempotencyKey: this.#identity() });
|
|
5776
|
+
} catch (error) {
|
|
5777
|
+
if (!(error instanceof ApiError) || error.code !== controlErrorCode.flowRevisionConflict || attempt >= 2) throw error;
|
|
5778
|
+
}
|
|
5779
|
+
if (!current()) return false;
|
|
5780
|
+
editor = await this.#client.getEditor(flowId);
|
|
5781
|
+
}
|
|
5782
|
+
const { flow, draft, live, presentation } = editor;
|
|
5495
5783
|
if (!current()) return false;
|
|
5496
5784
|
this.#draftChanges.reset(draft);
|
|
5497
5785
|
this.#presentationChanges.reset(presentation);
|
|
@@ -5501,10 +5789,11 @@ var WorkspaceStore = class {
|
|
|
5501
5789
|
live,
|
|
5502
5790
|
presentation,
|
|
5503
5791
|
workspaceLoadFailed: false,
|
|
5504
|
-
workspaceLoadProblem: void 0
|
|
5505
|
-
workspaceLoading: false
|
|
5792
|
+
workspaceLoadProblem: void 0
|
|
5506
5793
|
});
|
|
5507
5794
|
await this.#repairDraftNodeNames(current);
|
|
5795
|
+
if (!current()) return false;
|
|
5796
|
+
this.#set({ workspaceLoading: false });
|
|
5508
5797
|
if (invalidated && pendingRevision != draft.revisionId) this.#refreshDraft(pendingRevision);
|
|
5509
5798
|
} catch (error) {
|
|
5510
5799
|
if (!current()) return false;
|
|
@@ -5623,6 +5912,13 @@ var WorkspaceStore = class {
|
|
|
5623
5912
|
this.#set({ busy: void 0 });
|
|
5624
5913
|
}
|
|
5625
5914
|
}
|
|
5915
|
+
getFlowReferences(flowId, options = {}) {
|
|
5916
|
+
return this.#client.getFlowReferences(flowId, {
|
|
5917
|
+
...options,
|
|
5918
|
+
direction: "incoming",
|
|
5919
|
+
limit: 50
|
|
5920
|
+
});
|
|
5921
|
+
}
|
|
5626
5922
|
getErrorListeners(flowId, signal) {
|
|
5627
5923
|
return this.#client.getErrorListeners(flowId, signal);
|
|
5628
5924
|
}
|
|
@@ -5848,6 +6144,17 @@ var WorkspaceStore = class {
|
|
|
5848
6144
|
if (revision == null) return false;
|
|
5849
6145
|
return await this.#editDraft(resetInputValues(revision.revision.content, nodeId, handles)) != null;
|
|
5850
6146
|
}
|
|
6147
|
+
async saveOutputsDefs(nodeId, definitions, deletion, values) {
|
|
6148
|
+
const revision = this.$.revision.value;
|
|
6149
|
+
if (revision == null || revision.graph().nodes[nodeId]?.kind != "outputs") return false;
|
|
6150
|
+
return await this.#editDraft(updateOutputPorts(revision, nodeId, definitions, values), deletion) != null;
|
|
6151
|
+
}
|
|
6152
|
+
async saveStartInputDefs(nodeId, inputDefs, deletion) {
|
|
6153
|
+
const revision = this.$.revision.value;
|
|
6154
|
+
if (revision == null || revision.graph().nodes[nodeId]?.kind != "start") return false;
|
|
6155
|
+
const changes = updateStartInputDefs(revision.revision.content, nodeId, inputDefs);
|
|
6156
|
+
return await this.#editDraft(changes, deletion) != null;
|
|
6157
|
+
}
|
|
5851
6158
|
async resetTriggerConfig(triggerId, names) {
|
|
5852
6159
|
const revision = this.$.revision.value;
|
|
5853
6160
|
if (revision == null) return false;
|
|
@@ -5908,6 +6215,25 @@ var WorkspaceStore = class {
|
|
|
5908
6215
|
position
|
|
5909
6216
|
}));
|
|
5910
6217
|
}
|
|
6218
|
+
async listWorkflowTargets(signal) {
|
|
6219
|
+
const flowId = this.$.revision.value?.revision.flowId;
|
|
6220
|
+
if (flowId == null) return [];
|
|
6221
|
+
const candidates = [];
|
|
6222
|
+
let cursor;
|
|
6223
|
+
do {
|
|
6224
|
+
const page = await this.#client.listFlows({
|
|
6225
|
+
cursor,
|
|
6226
|
+
limit: 100,
|
|
6227
|
+
signal
|
|
6228
|
+
});
|
|
6229
|
+
candidates.push(...page.flows.filter((flow) => flow.flowId != flowId).map((flow) => workflowCandidate(flow)));
|
|
6230
|
+
cursor = page.nextCursor;
|
|
6231
|
+
} while (cursor != null);
|
|
6232
|
+
return candidates;
|
|
6233
|
+
}
|
|
6234
|
+
loadWorkflowContract(flowId, signal) {
|
|
6235
|
+
return this.#client.getWorkflowContract(flowId, signal);
|
|
6236
|
+
}
|
|
5911
6237
|
loadOpenApiDocument(url, signal) {
|
|
5912
6238
|
return this.#client.loadOpenApiDocument(url, signal);
|
|
5913
6239
|
}
|
|
@@ -5935,6 +6261,12 @@ var WorkspaceStore = class {
|
|
|
5935
6261
|
const changes = setConnectorConnection(revision.revision.content, nodeId, connectionId);
|
|
5936
6262
|
return changes != null && await this.#editDraft(changes) != null;
|
|
5937
6263
|
}
|
|
6264
|
+
async setServiceConnections(providerId, connectionId, previousConnectionId) {
|
|
6265
|
+
const revision = this.$.revision.value;
|
|
6266
|
+
if (revision == null) return false;
|
|
6267
|
+
const changes = setServiceConnections(revision.revision.content, providerId, connectionId, previousConnectionId);
|
|
6268
|
+
return changes.length == 0 || await this.#editDraft(changes) != null;
|
|
6269
|
+
}
|
|
5938
6270
|
async setCodeActions(nodeId, capabilities) {
|
|
5939
6271
|
const revision = this.$.revision.value;
|
|
5940
6272
|
if (revision == null) return false;
|
|
@@ -6135,7 +6467,7 @@ var WorkspaceStore = class {
|
|
|
6135
6467
|
for (let attempt = 0; attempt < 2 && current(); attempt += 1) {
|
|
6136
6468
|
const draft = this.#model.value.draft;
|
|
6137
6469
|
if (draft == null) return;
|
|
6138
|
-
const repairs = repairNodeNames(draft.content);
|
|
6470
|
+
const repairs = repairNodeNames(draft.content, { start: this.#i18n.t("addNode.start") });
|
|
6139
6471
|
if (repairs.length == 0) {
|
|
6140
6472
|
this.#checkDraft();
|
|
6141
6473
|
return;
|
|
@@ -6489,8 +6821,8 @@ var WorkbenchStore = class {
|
|
|
6489
6821
|
this.triggers = new TriggerStore(client, this.workspace, setNotice, host, i18n);
|
|
6490
6822
|
this.publications = new PublicationStore(client, this.workspace, setNotice, preferences, identity, i18n);
|
|
6491
6823
|
this.runRequests = new RunRequestStore(client, this.runs, setNotice, async (flowId) => {
|
|
6492
|
-
if (flowId != this.workspace.$.flowId.value || !await this.workspace.
|
|
6493
|
-
return this.workspace.$.draft.value
|
|
6824
|
+
if (flowId != this.workspace.$.flowId.value || !await this.workspace.saveDraft() || this.#disposed || flowId != this.workspace.$.flowId.value) return;
|
|
6825
|
+
return this.workspace.$.draft.value;
|
|
6494
6826
|
}, i18n, identity);
|
|
6495
6827
|
const diagnostics = compute((get) => {
|
|
6496
6828
|
const check = get(this.workspace.$.diagnostics);
|
|
@@ -6665,14 +6997,14 @@ var WorkbenchStore = class {
|
|
|
6665
6997
|
return await this.#openNewFlow(await this.workspace.importFlow(file, name, key, importer), "notice.flowImported");
|
|
6666
6998
|
}
|
|
6667
6999
|
async createFlow(name, create) {
|
|
6668
|
-
return await this.#openNewFlow(await this.workspace.createFlow(name, create)
|
|
7000
|
+
return await this.#openNewFlow(await this.workspace.createFlow(name, create));
|
|
6669
7001
|
}
|
|
6670
7002
|
async #openNewFlow(created, notice) {
|
|
6671
7003
|
if (this.#disposed || created == null) return false;
|
|
6672
7004
|
await this.selectFlow(created.flowId);
|
|
6673
|
-
if (!this.#disposed) this.#notice.set({
|
|
7005
|
+
if (!this.#disposed && notice != null) this.#notice.set({
|
|
6674
7006
|
kind: "success",
|
|
6675
|
-
message: this.#i18n.t(notice
|
|
7007
|
+
message: this.#i18n.t(notice)
|
|
6676
7008
|
});
|
|
6677
7009
|
return true;
|
|
6678
7010
|
}
|
|
@@ -6852,7 +7184,7 @@ var WorkbenchStore = class {
|
|
|
6852
7184
|
};
|
|
6853
7185
|
//#endregion
|
|
6854
7186
|
//#region src/workbench/browser/runtime/openFlowWorkbench.tsx
|
|
6855
|
-
var FlowWorkspace = lazy(() => import("./flowWorkspace-
|
|
7187
|
+
var FlowWorkspace = lazy(() => import("./flowWorkspace-C1hlTnZq.js"));
|
|
6856
7188
|
function OpenFlowSessionGate({ action, description, error, onSubmit, onTokenChange, pending = false, title, token, tokenLabel }) {
|
|
6857
7189
|
const hasToken = token != null && tokenLabel != null && onTokenChange != null;
|
|
6858
7190
|
const tokenValue = token ?? "";
|
|
@@ -6958,7 +7290,7 @@ function FlowNameBridge({ store, onChange }) {
|
|
|
6958
7290
|
useEffect(() => () => onChange(void 0), [onChange]);
|
|
6959
7291
|
return null;
|
|
6960
7292
|
}
|
|
6961
|
-
function Workbench({ importRef, catalogWidth, createFlow, importFlow, createFlowDisabled, createFlowField,
|
|
7293
|
+
function Workbench({ importRef, catalogWidth, createFlow, importFlow, createFlowDisabled, createFlowField, connectionHref, hrefFor, initializing, language, navigation, onConfigureConnector, onManageConnectorAccess, onLanguageChange, store, theme }) {
|
|
6962
7294
|
const flowId = useVal(store.workspace.$.flowId);
|
|
6963
7295
|
return /* @__PURE__ */ jsx("div", {
|
|
6964
7296
|
className: "app-shell",
|
|
@@ -6967,10 +7299,9 @@ function Workbench({ importRef, catalogWidth, createFlow, importFlow, createFlow
|
|
|
6967
7299
|
catalogWidth,
|
|
6968
7300
|
createFlowDisabled,
|
|
6969
7301
|
createFlowField,
|
|
6970
|
-
|
|
6971
|
-
hrefForFlow: (flow) => hrefFor({
|
|
7302
|
+
hrefForFlow: (flow, view = "design") => hrefFor({
|
|
6972
7303
|
flowId: flow.flowId,
|
|
6973
|
-
view
|
|
7304
|
+
view
|
|
6974
7305
|
}),
|
|
6975
7306
|
initializing,
|
|
6976
7307
|
language,
|
|
@@ -6996,7 +7327,7 @@ function Workbench({ importRef, catalogWidth, createFlow, importFlow, createFlow
|
|
|
6996
7327
|
})
|
|
6997
7328
|
});
|
|
6998
7329
|
}
|
|
6999
|
-
var Session = forwardRef(function Session({ catalogWidth, createFlow, importFlow, createFlowDisabled, createFlowField,
|
|
7330
|
+
var Session = forwardRef(function Session({ catalogWidth, createFlow, importFlow, createFlowDisabled, createFlowField, connectionHref, host, hrefFor, language, location, onConfigureConnector, onManageConnectorAccess, onLanguageChange, onNavigate, onFlowNameChange, preferences, sessionKey, theme, variables = true }, ref) {
|
|
7000
7331
|
const importRef = useRef(null);
|
|
7001
7332
|
useImperativeHandle(ref, () => ({ openImport: (input) => importRef.current?.openImport(input) ?? "unavailable" }), []);
|
|
7002
7333
|
const navigate = useRef(onNavigate);
|
|
@@ -7068,7 +7399,6 @@ var Session = forwardRef(function Session({ catalogWidth, createFlow, importFlow
|
|
|
7068
7399
|
importFlow,
|
|
7069
7400
|
createFlowDisabled,
|
|
7070
7401
|
createFlowField,
|
|
7071
|
-
flowBadges,
|
|
7072
7402
|
connectionHref,
|
|
7073
7403
|
hrefFor,
|
|
7074
7404
|
initializing: !started,
|