@oomol-lab/open-flow 0.1.0-beta.56 → 0.1.0-beta.57
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-Btjes3wD.js → createResourceDialog-C23SBjYd.js} +2 -2
- package/dist/browser/flow-authoring-node.d.ts +6 -2
- package/dist/browser/flow-authoring.js +44 -12
- package/dist/browser/flow-change-schema.d.ts +266 -0
- package/dist/browser/flow-change.d.ts +5 -0
- package/dist/browser/flow-change.js +33 -2
- package/dist/browser/{flowChanges-BxutPLYO.js → flowChanges-fBiAeTzR.js} +954 -487
- package/dist/browser/{flowWorkspace-Dg4mqfa6.js → flowWorkspace-MqcEfg7T.js} +3 -3
- package/dist/browser/{icons-p2A9zs8t.js → icons-6oQ8Q9Wm.js} +4298 -4252
- package/dist/browser/preview.js +354 -36
- package/dist/browser/workbench.js +21 -10
- package/dist/browser/{workbenchSelect-LRp_Xjeq.js → workbenchSelect-DpLbIr29.js} +1 -1
- package/dist/common/authoring.d.ts +207 -0
- package/dist/common/authoringSchema.d.ts +1293 -0
- package/dist/common/control-api-conformance.js +975 -505
- package/dist/common/control-api-errors.d.ts +2 -1
- package/dist/common/control-api.d.ts +81 -0
- package/dist/common/control-api.js +973 -586
- package/dist/common/control-requests.d.ts +128 -0
- package/dist/common/control-requests.js +3122 -346
- package/dist/common/decision.js +12 -2
- package/dist/common/flow-encoding.js +12 -2
- package/dist/common/flow-semantics.d.ts +9 -0
- package/dist/common/flow-semantics.js +28 -3
- package/dist/common/integration-trigger.js +12 -2
- package/dist/common/lib-DrKav3HG.js +11403 -0
- package/dist/common/mcp.d.ts +120 -11
- package/dist/common/mcp.js +423 -51
- package/dist/common/openapi.js +12 -2
- package/dist/common/poll-trigger.js +12 -2
- package/dist/common/scheduler.js +12 -2
- package/dist/common/webhook-trigger.js +12 -2
- package/package.json +7 -1
- package/skills/open-flow/SKILL.md +32 -0
- package/skills/open-flow/references/flow-authoring.md +356 -0
- package/skills/open-flow/references/flow-n8n-conversion.md +196 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { o as __toESM, t as __commonJSMin } from "./rolldown-runtime-CEgmsyvS.js";
|
|
2
2
|
import { a as derive, i as compute, l as val, r as combine, t as arrayShallowEqual } from "./dist-bO8nvHFH.js";
|
|
3
3
|
import { l as useTranslate, o as I18nProvider } from "./dist-BFmpkX4P.js";
|
|
4
|
-
import {
|
|
4
|
+
import { A as webhookSupportsBody, An as useImplicitActiveTrigger, Bi as isHTMLElement$1, Bn as useFloatingParentNodeId, Br as useOnMount, Ci as useRenderElement, Cn as useHoverFloatingInteraction, Ct as SelectGroup, D as authoringDefinitionSchemas, Dn as createInitialPopupStoreState, Dt as SelectValue, Ei as NOOP, Et as SelectTrigger, Fn as useClick, Fr as useTransitionStatus, H as applyFlowChanges$1, Hr as createChangeEventDetails, Ii as useStableCallback, In as FloatingFocusManager, Ir as useOpenChangeComplete, Jr as focusOut, Jt as usePositioner, K as normalizeNodeName, Kn as POPUP_COLLISION_AVOIDANCE, Kr as closePress, Kt as useToolbarRootContext, L as comparePorts, Li as useRefWithInit, Ln as FloatingNode, Lr as useAnimationsFinished, Lt as COMPOSITE_KEYS, Mi as formatErrorMessage, Mn as useTriggerDataForwarding, Ni as mergeProps, Nr as Check, O as decodeRevisionContent, Oi as useMergedRefs, On as popupStoreSelectors, P as decisionTask, Pi as useIsoLayoutEffect, Pn as useDismiss, Pr as createLucideIcon, Q as nodeInputMappings, Qt as adaptiveOrigin, R as matchesSchema, Rn as FloatingTree, Si as clsx, Sn as useHoverReferenceInteraction, St as SelectContent, Ti as EMPTY_OBJECT, Tn as useSyncedFloatingRootContext, Tr as contains, U as isSchemaKeyword, Un as FloatingPortal, Vr as useValueChanged, W as nextNodeName, Wn as CLICK_TRIGGER_IDENTIFIER, X as conditionInputPorts, Xt as InternalBackdrop, Yn as ReactStore, Yr as imperativeAction, Yt as getDisabledMountTransitionStyles, Zt as useAnchorPositioning, _i as useControlled, _n as safePolygon, _t as strictObject, ai as triggerHover, an as triggerOpenStateMapping, ar as Label, at as dequal, bi as cn, bt as Select, ci as useFormContext, ct as boolean, d as TooltipContent, di as useBaseUiId, dr as getTabbableBeforeElement, dt as json$2, fr as isOutsideEvent, ft as lazy$1, gi as visuallyHiddenInput, gt as record$2, hi as visuallyHidden, ht as object$1, in as pressableTriggerOpenStateMapping, ir as useOnFirstRender, it as format, jn as useOpenStateTransitions, jr as useLabelableId, ki as useButton, kn as PopupTriggerMap, li as useRegisterFieldControl, lr as getNextTabbable, lt as discriminatedUnion, mi as fieldValidityMapping, mt as number, nr as createSelector, or as Input, ot as _enum, p as TooltipTrigger, pt as literal, q as portsByHandle, qn as FocusGuard, qt as useAnchoredPopupScrollLock, rn as popupStateMapping, si as useLabelableContext, sn as useOpenInteractionType, sr as Timeout, st as array, ti as none, tn as inertValue, tt as otherwiseOutput, u as Tooltip, ui as useFieldRootContext, ur as getTabbableAfterElement, ut as int, vi as Button, vt as string$1, wt as SelectItem, xi as cva, xn as useInteractions, yi as buttonVariants, yn as useRole, yt as union, z as schemaObject, zn as useFloatingNodeId, zr as transitionStatusMapping } from "./icons-6oQ8Q9Wm.js";
|
|
5
5
|
import { c as isUiLanguage, d as uiLanguages, i as objectValue, l as resolveUiLanguage, s as valueType, t as initialValue } from "./value-DL_poNiC.js";
|
|
6
6
|
import "./lib-Dws05GHj.js";
|
|
7
7
|
import * as React from "react";
|
|
@@ -481,9 +481,10 @@ var controlErrorCode = {
|
|
|
481
481
|
};
|
|
482
482
|
controlErrorCode.eventSourceInvalid, controlErrorCode.eventSourceIdentityUnavailable, controlErrorCode.eventSourceNotFound, controlErrorCode.eventSourceConflict, controlErrorCode.authenticationRequired, controlErrorCode.authorizationDenied, controlErrorCode.bindingUnresolved, controlErrorCode.connectorActionNotFound, controlErrorCode.connectorAccessConflict, controlErrorCode.connectorAccessInvalid, controlErrorCode.connectorAccessRequired, controlErrorCode.connectorAccessUnsupported, controlErrorCode.connectorUnconfigured, controlErrorCode.connectorUnavailable, controlErrorCode.connectorConsoleUnconfigured, controlErrorCode.engineUnavailable, controlErrorCode.engineUnsupported, controlErrorCode.flowInvalid, controlErrorCode.flowRepairRequired, controlErrorCode.flowUpgradeRequired, controlErrorCode.flowNotFound, controlErrorCode.flowBusy, controlErrorCode.flowConflict, controlErrorCode.flowPresentationConflict, controlErrorCode.flowRevisionConflict, controlErrorCode.liveConflict, controlErrorCode.liveNotFound, controlErrorCode.pageInvalidCursor, controlErrorCode.publicationConflict, controlErrorCode.publicationNotFound, controlErrorCode.publicationUnsupported, controlErrorCode.publishOperationNotFound, controlErrorCode.routeNotFound, controlErrorCode.runConflict, controlErrorCode.runEventsExpired, controlErrorCode.runInvalid, controlErrorCode.runNotFound, controlErrorCode.runNotTerminal, controlErrorCode.runOverloaded, controlErrorCode.runWaitNotFound, controlErrorCode.triggerKeyInvalid, controlErrorCode.triggerKeyNotFound, controlErrorCode.triggerNotFound, controlErrorCode.variableInvalid, controlErrorCode.variableLimitReached, controlErrorCode.variableNotFound;
|
|
483
483
|
var ApiError = class extends Error {
|
|
484
|
-
constructor(status, code, message) {
|
|
484
|
+
constructor(status, code, message, details) {
|
|
485
485
|
super(message);
|
|
486
486
|
this.code = code;
|
|
487
|
+
this.details = details;
|
|
487
488
|
this.name = "ApiError";
|
|
488
489
|
this.status = status;
|
|
489
490
|
}
|
|
@@ -529,6 +530,756 @@ function optionalString(value) {
|
|
|
529
530
|
return string(value);
|
|
530
531
|
}
|
|
531
532
|
//#endregion
|
|
533
|
+
//#region src/flow/common/inputValue.ts
|
|
534
|
+
/** An explicit clear suppresses the default; absent mappings still inherit it. */
|
|
535
|
+
function inputValue(mapping, fallback) {
|
|
536
|
+
if (mapping?.kind === "unset") return void 0;
|
|
537
|
+
return mapping?.kind === "value" ? mapping.value : fallback;
|
|
538
|
+
}
|
|
539
|
+
/** Converts explicit user values at authoring boundaries, never persisted legacy data. */
|
|
540
|
+
function inputValues(values) {
|
|
541
|
+
return Object.fromEntries(Object.entries(values).map(([name, value]) => [name, {
|
|
542
|
+
kind: "value",
|
|
543
|
+
value
|
|
544
|
+
}]));
|
|
545
|
+
}
|
|
546
|
+
function fixedInputValue(value) {
|
|
547
|
+
return value === void 0 ? { kind: "unset" } : {
|
|
548
|
+
kind: "value",
|
|
549
|
+
value
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
//#endregion
|
|
553
|
+
//#region src/control/common/authoringLlm.ts
|
|
554
|
+
var authoringLlmConfiguration = strictObject({
|
|
555
|
+
mode: _enum(["chat", "json"]),
|
|
556
|
+
resultSchema: json$2(),
|
|
557
|
+
model: json$2().optional().describe("Default model settings: {model, temperature?, top_p?, max_tokens?}. A bound model input takes precedence."),
|
|
558
|
+
template: json$2().optional().describe("Default message templates: [{role: \"system\" | \"user\" | \"assistant\", content: \"Text with {{namedInput}}\"}]."),
|
|
559
|
+
messages: json$2().optional().describe("Default conversation history, prepended without template interpolation; an array of {role, content} or null.")
|
|
560
|
+
});
|
|
561
|
+
//#endregion
|
|
562
|
+
//#region src/openapi/common/openapi.ts
|
|
563
|
+
var methods = [
|
|
564
|
+
"get",
|
|
565
|
+
"put",
|
|
566
|
+
"post",
|
|
567
|
+
"delete",
|
|
568
|
+
"options",
|
|
569
|
+
"head",
|
|
570
|
+
"patch",
|
|
571
|
+
"trace"
|
|
572
|
+
];
|
|
573
|
+
function object(value) {
|
|
574
|
+
if (value == null || typeof value != "object" || Array.isArray(value)) throw new Error("Expected an OpenAPI object.");
|
|
575
|
+
return value;
|
|
576
|
+
}
|
|
577
|
+
function httpUrl(value, base) {
|
|
578
|
+
const url = new URL(value, base);
|
|
579
|
+
if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.hash) throw new Error("An HTTP(S) URL without credentials or fragment is required.");
|
|
580
|
+
return url.href;
|
|
581
|
+
}
|
|
582
|
+
function parseOpenApi(value) {
|
|
583
|
+
const doc = object(value);
|
|
584
|
+
if (typeof doc.openapi != "string" || !/^3\.[01]\.\d+$/.test(doc.openapi)) throw new Error("Only OpenAPI 3.0 and 3.1 JSON documents are supported.");
|
|
585
|
+
object(doc.paths);
|
|
586
|
+
return doc;
|
|
587
|
+
}
|
|
588
|
+
function pointer(doc, ref) {
|
|
589
|
+
if (!ref.startsWith("#/")) throw new Error("External OpenAPI references are not supported.");
|
|
590
|
+
let value = doc;
|
|
591
|
+
for (const key of decodeURIComponent(ref.slice(2)).split("/").map((part) => part.replace(/~1/g, "/").replace(/~0/g, "~"))) {
|
|
592
|
+
const source = object(value);
|
|
593
|
+
if (!Object.hasOwn(source, key)) throw new Error("An OpenAPI reference is missing.");
|
|
594
|
+
value = source[key];
|
|
595
|
+
}
|
|
596
|
+
return value;
|
|
597
|
+
}
|
|
598
|
+
function resolved(doc, value) {
|
|
599
|
+
let result = object(value);
|
|
600
|
+
const seen = /* @__PURE__ */ new Set();
|
|
601
|
+
while (typeof result.$ref == "string") {
|
|
602
|
+
if (seen.has(result.$ref)) throw new Error("Circular non-schema reference is unsupported.");
|
|
603
|
+
seen.add(result.$ref);
|
|
604
|
+
const { $ref, ...siblings } = result;
|
|
605
|
+
result = {
|
|
606
|
+
...object(pointer(doc, $ref)),
|
|
607
|
+
...siblings
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
return result;
|
|
611
|
+
}
|
|
612
|
+
function listOperations(documentValue) {
|
|
613
|
+
const doc = parseOpenApi(documentValue);
|
|
614
|
+
return Object.entries(object(doc.paths)).flatMap(([path, value]) => {
|
|
615
|
+
const item = resolved(doc, value);
|
|
616
|
+
return methods.filter((method) => item[method] != null).map((method) => {
|
|
617
|
+
const op = object(item[method]);
|
|
618
|
+
return {
|
|
619
|
+
method,
|
|
620
|
+
path,
|
|
621
|
+
label: String(op.summary ?? op.operationId ?? `${method.toUpperCase()} ${path}`),
|
|
622
|
+
tag: String(op.tags?.[0] ?? "")
|
|
623
|
+
};
|
|
624
|
+
});
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
function operation(doc, path, method) {
|
|
628
|
+
const item = resolved(doc, object(doc.paths)[path]);
|
|
629
|
+
if (!methods.includes(method) || item[method] == null) throw new Error("The selected operation is no longer available.");
|
|
630
|
+
return {
|
|
631
|
+
item,
|
|
632
|
+
op: object(item[method])
|
|
633
|
+
};
|
|
634
|
+
}
|
|
635
|
+
function servers(value, path, method) {
|
|
636
|
+
const doc = parseOpenApi(value);
|
|
637
|
+
const { item, op } = operation(doc, path, method);
|
|
638
|
+
const entries = op.servers ?? item.servers ?? doc.servers;
|
|
639
|
+
if (!Array.isArray(entries) || entries.length == 0) return [{ url: "/" }];
|
|
640
|
+
return entries.map(object);
|
|
641
|
+
}
|
|
642
|
+
function serverAddress(server, sourceUrl, variables = {}) {
|
|
643
|
+
return httpUrl(String(server.url).replace(/\{([^}]+)\}/g, (_, name) => {
|
|
644
|
+
const definition = object(object(server.variables)[name]);
|
|
645
|
+
const value = variables[name] ?? definition.default;
|
|
646
|
+
if (typeof value != "string" || Array.isArray(definition.enum) && !definition.enum.includes(value)) throw new Error("A server variable is invalid.");
|
|
647
|
+
return value;
|
|
648
|
+
}), sourceUrl);
|
|
649
|
+
}
|
|
650
|
+
function securityOptions(value, path, method) {
|
|
651
|
+
const doc = parseOpenApi(value);
|
|
652
|
+
const { op } = operation(doc, path, method);
|
|
653
|
+
const requirements = op.security ?? doc.security ?? [];
|
|
654
|
+
if (!Array.isArray(requirements)) throw new Error("Invalid security requirements.");
|
|
655
|
+
if (!requirements.length) return [{
|
|
656
|
+
label: "None",
|
|
657
|
+
auth: []
|
|
658
|
+
}];
|
|
659
|
+
return requirements.map((entry) => {
|
|
660
|
+
const names = Object.keys(object(entry));
|
|
661
|
+
const label = names.join(" + ") || "None";
|
|
662
|
+
try {
|
|
663
|
+
if (!names.length) return {
|
|
664
|
+
label,
|
|
665
|
+
auth: []
|
|
666
|
+
};
|
|
667
|
+
const schemes = object(object(doc.components).securitySchemes);
|
|
668
|
+
return {
|
|
669
|
+
label,
|
|
670
|
+
auth: names.map((id) => {
|
|
671
|
+
const scheme = resolved(doc, schemes[id]);
|
|
672
|
+
if (scheme.type == "http" && ["bearer", "basic"].includes(String(scheme.scheme).toLowerCase())) return {
|
|
673
|
+
id,
|
|
674
|
+
type: String(scheme.scheme).toLowerCase()
|
|
675
|
+
};
|
|
676
|
+
if (scheme.type == "apiKey" && (scheme.in == "header" || scheme.in == "query") && typeof scheme.name == "string") return {
|
|
677
|
+
id,
|
|
678
|
+
type: "apiKey",
|
|
679
|
+
name: scheme.name,
|
|
680
|
+
in: scheme.in
|
|
681
|
+
};
|
|
682
|
+
throw new Error("This security scheme is unsupported. Supply an access token using manual Bearer authentication if applicable.");
|
|
683
|
+
})
|
|
684
|
+
};
|
|
685
|
+
} catch (error) {
|
|
686
|
+
return {
|
|
687
|
+
label,
|
|
688
|
+
error: error.message
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
function snapshot$7(documentValue, path, method) {
|
|
694
|
+
const doc = parseOpenApi(documentValue);
|
|
695
|
+
const { item, op } = operation(doc, path, method);
|
|
696
|
+
const security = op.security ?? doc.security ?? [];
|
|
697
|
+
const result = {
|
|
698
|
+
openapi: doc.openapi,
|
|
699
|
+
paths: { [path]: {
|
|
700
|
+
[method]: op,
|
|
701
|
+
...item.parameters == null ? {} : { parameters: item.parameters }
|
|
702
|
+
} },
|
|
703
|
+
servers: servers(doc, path, method),
|
|
704
|
+
security
|
|
705
|
+
};
|
|
706
|
+
const visited = /* @__PURE__ */ new Set();
|
|
707
|
+
function copy(ref) {
|
|
708
|
+
if (visited.has(ref)) return;
|
|
709
|
+
visited.add(ref);
|
|
710
|
+
const value = pointer(doc, ref);
|
|
711
|
+
const keys = decodeURIComponent(ref.slice(2)).split("/").map((part) => part.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
712
|
+
if (keys.some((key) => [
|
|
713
|
+
"__proto__",
|
|
714
|
+
"constructor",
|
|
715
|
+
"prototype"
|
|
716
|
+
].includes(key))) throw new Error("Unsupported reference key.");
|
|
717
|
+
let target = result;
|
|
718
|
+
for (const key of keys.slice(0, -1)) {
|
|
719
|
+
if (!Object.hasOwn(target, key)) target[key] = {};
|
|
720
|
+
target = object(target[key]);
|
|
721
|
+
}
|
|
722
|
+
target[keys.at(-1)] = structuredClone(value);
|
|
723
|
+
visit(value);
|
|
724
|
+
}
|
|
725
|
+
function visit(value) {
|
|
726
|
+
if (value == null || typeof value != "object") return;
|
|
727
|
+
if (Array.isArray(value)) {
|
|
728
|
+
value.forEach(visit);
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
if (typeof object(value).$ref == "string") copy(object(value).$ref);
|
|
732
|
+
for (const [key, child] of Object.entries(value)) if (![
|
|
733
|
+
"example",
|
|
734
|
+
"examples",
|
|
735
|
+
"default"
|
|
736
|
+
].includes(key)) visit(child);
|
|
737
|
+
}
|
|
738
|
+
visit(result);
|
|
739
|
+
for (const entry of security) for (const name of Object.keys(object(entry))) copy(`#/components/securitySchemes/${name.replace(/~/g, "~0").replace(/\//g, "~1")}`);
|
|
740
|
+
return structuredClone(result);
|
|
741
|
+
}
|
|
742
|
+
function schema$1(doc, schemaValue) {
|
|
743
|
+
const defs = {};
|
|
744
|
+
const ids = /* @__PURE__ */ new Map();
|
|
745
|
+
function convert(value) {
|
|
746
|
+
if (typeof value == "boolean") return value;
|
|
747
|
+
const source = object(value);
|
|
748
|
+
if (source.format == "binary" || source.$dynamicRef != null || source.$id != null) throw new Error("Binary and dynamically scoped schemas are unsupported.");
|
|
749
|
+
const result = {};
|
|
750
|
+
for (const [key, child] of Object.entries(source)) {
|
|
751
|
+
if ([
|
|
752
|
+
"nullable",
|
|
753
|
+
"example",
|
|
754
|
+
"xml",
|
|
755
|
+
"discriminator",
|
|
756
|
+
"__proto__"
|
|
757
|
+
].includes(key)) continue;
|
|
758
|
+
if (key == "$ref") {
|
|
759
|
+
if (typeof child != "string") throw new Error("Invalid schema reference.");
|
|
760
|
+
let id = ids.get(child);
|
|
761
|
+
if (id == null) {
|
|
762
|
+
id = `s${ids.size}`;
|
|
763
|
+
ids.set(child, id);
|
|
764
|
+
defs[id] = convert(pointer(doc, child));
|
|
765
|
+
}
|
|
766
|
+
result.$ref = `#/$defs/${id}`;
|
|
767
|
+
} else if ([
|
|
768
|
+
"properties",
|
|
769
|
+
"patternProperties",
|
|
770
|
+
"$defs",
|
|
771
|
+
"definitions",
|
|
772
|
+
"dependentSchemas"
|
|
773
|
+
].includes(key)) result[key] = Object.fromEntries(Object.entries(object(child)).map(([name, childSchema]) => [name, convert(childSchema)]));
|
|
774
|
+
else if ([
|
|
775
|
+
"allOf",
|
|
776
|
+
"anyOf",
|
|
777
|
+
"oneOf",
|
|
778
|
+
"prefixItems"
|
|
779
|
+
].includes(key)) {
|
|
780
|
+
if (!Array.isArray(child)) throw new Error("Invalid schema composition.");
|
|
781
|
+
result[key] = child.map(convert);
|
|
782
|
+
} else if ([
|
|
783
|
+
"items",
|
|
784
|
+
"additionalProperties",
|
|
785
|
+
"not",
|
|
786
|
+
"if",
|
|
787
|
+
"then",
|
|
788
|
+
"else",
|
|
789
|
+
"contains",
|
|
790
|
+
"propertyNames",
|
|
791
|
+
"unevaluatedProperties"
|
|
792
|
+
].includes(key)) result[key] = convert(child);
|
|
793
|
+
else result[key] = child;
|
|
794
|
+
}
|
|
795
|
+
if (source.nullable === true) return { anyOf: [result, { type: "null" }] };
|
|
796
|
+
for (const key of ["minimum", "maximum"]) {
|
|
797
|
+
const exclusive = key == "minimum" ? "exclusiveMinimum" : "exclusiveMaximum";
|
|
798
|
+
if (typeof result[exclusive] == "boolean") {
|
|
799
|
+
if (result[exclusive] && typeof result[key] == "number") {
|
|
800
|
+
result[exclusive] = result[key];
|
|
801
|
+
delete result[key];
|
|
802
|
+
} else delete result[exclusive];
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
return result;
|
|
806
|
+
}
|
|
807
|
+
let converted = convert(schemaValue);
|
|
808
|
+
if (typeof converted == "object" && converted != null && typeof object(converted).$ref == "string") {
|
|
809
|
+
const id = String(object(converted).$ref).slice(8);
|
|
810
|
+
const { $ref: _ref, ...siblings } = object(converted);
|
|
811
|
+
converted = {
|
|
812
|
+
...object(defs[id]),
|
|
813
|
+
...siblings
|
|
814
|
+
};
|
|
815
|
+
}
|
|
816
|
+
if (typeof converted == "boolean") return converted;
|
|
817
|
+
return {
|
|
818
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
819
|
+
...object(converted),
|
|
820
|
+
...Object.keys(defs).length ? { $defs: defs } : {}
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
function parameters(config) {
|
|
824
|
+
const doc = parseOpenApi(config.document);
|
|
825
|
+
const { item, op } = operation(doc, config.path, config.method);
|
|
826
|
+
const entries = /* @__PURE__ */ new Map();
|
|
827
|
+
for (const value of [...item.parameters ?? [], ...op.parameters ?? []]) {
|
|
828
|
+
const p = resolved(doc, value);
|
|
829
|
+
if (![
|
|
830
|
+
"path",
|
|
831
|
+
"query",
|
|
832
|
+
"header"
|
|
833
|
+
].includes(String(p.in)) || typeof p.name != "string" || p.content != null) throw new Error("Only schema-based path, query and header parameters are supported.");
|
|
834
|
+
if (p.allowReserved === true) throw new Error("allowReserved parameters are unsupported.");
|
|
835
|
+
if ((p.style ?? (p.in == "query" ? "form" : "simple")) != (p.in == "query" ? "form" : "simple")) throw new Error("Only form query and simple path/header serialization are supported.");
|
|
836
|
+
entries.set(`${p.in}.${p.in == "header" ? p.name.toLowerCase() : p.name}`, p);
|
|
837
|
+
}
|
|
838
|
+
return [...entries.values()];
|
|
839
|
+
}
|
|
840
|
+
function jsonContent(doc, value) {
|
|
841
|
+
const content = resolved(doc, value);
|
|
842
|
+
const media = object(content.content);
|
|
843
|
+
const mediaType = media["application/json"] != null ? "application/json" : Object.keys(media).find((key) => /^application\/.+\+json$/.test(key));
|
|
844
|
+
const json = mediaType == null ? void 0 : media[mediaType];
|
|
845
|
+
if (json == null) throw new Error("Only JSON request and response bodies are supported.");
|
|
846
|
+
return {
|
|
847
|
+
schema: schema$1(doc, object(json).schema ?? {}),
|
|
848
|
+
required: content.required === true,
|
|
849
|
+
mediaType
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
function authHandles(auth) {
|
|
853
|
+
return auth.flatMap((scheme) => scheme.type == "basic" ? [`auth.${scheme.id}.username`, `auth.${scheme.id}.password`] : [`auth.${scheme.id}.token`]);
|
|
854
|
+
}
|
|
855
|
+
function openApiTask(config, name = "OpenAPI") {
|
|
856
|
+
if (!config.path) return {
|
|
857
|
+
name,
|
|
858
|
+
executor: config,
|
|
859
|
+
inputs: [],
|
|
860
|
+
outputs: []
|
|
861
|
+
};
|
|
862
|
+
const doc = parseOpenApi(config.document);
|
|
863
|
+
const { op } = operation(doc, config.path, config.method);
|
|
864
|
+
const params = parameters(config);
|
|
865
|
+
const inputs = params.map((p) => {
|
|
866
|
+
const jsonSchema = schema$1(doc, p.schema ?? {});
|
|
867
|
+
const defaultValue = typeof jsonSchema == "boolean" ? void 0 : object(jsonSchema).default;
|
|
868
|
+
return {
|
|
869
|
+
handle: `${p.in}.${p.name}`,
|
|
870
|
+
jsonSchema,
|
|
871
|
+
nullable: p.required !== true && p.in != "path" || matchesSchema(null, jsonSchema),
|
|
872
|
+
...typeof p.description == "string" ? { description: p.description } : {},
|
|
873
|
+
...defaultValue === void 0 ? {} : { value: defaultValue }
|
|
874
|
+
};
|
|
875
|
+
});
|
|
876
|
+
if (op.requestBody != null) {
|
|
877
|
+
if (config.method == "get" || config.method == "head") throw new Error("GET and HEAD request bodies are unsupported.");
|
|
878
|
+
const body = jsonContent(doc, op.requestBody);
|
|
879
|
+
inputs.push({
|
|
880
|
+
handle: "body",
|
|
881
|
+
jsonSchema: body.schema,
|
|
882
|
+
nullable: !body.required || matchesSchema(null, body.schema)
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
const occupied = new Set(params.map((p) => `${p.in}.${p.in == "header" ? String(p.name).toLowerCase() : p.name}`));
|
|
886
|
+
for (const auth of config.auth) {
|
|
887
|
+
const location = auth.type == "apiKey" ? `${auth.in}.${auth.in == "header" ? auth.name?.toLowerCase() : auth.name}` : "header.authorization";
|
|
888
|
+
if (occupied.has(location)) throw new Error("Authentication conflicts with a parameter or another security scheme.");
|
|
889
|
+
if (auth.type == "apiKey" && (!auth.name || !["header", "query"].includes(auth.in ?? ""))) throw new Error("API Key requires a name and location.");
|
|
890
|
+
occupied.add(location);
|
|
891
|
+
}
|
|
892
|
+
inputs.push(...authHandles(config.auth).map((handle) => ({
|
|
893
|
+
handle,
|
|
894
|
+
jsonSchema: { type: "string" },
|
|
895
|
+
nullable: false
|
|
896
|
+
})));
|
|
897
|
+
const responses = object(op.responses);
|
|
898
|
+
const schemas = [];
|
|
899
|
+
for (const [status, response] of Object.entries(responses)) if (/^2\d\d$|^2XX$/.test(status) || status == "default") {
|
|
900
|
+
const r = resolved(doc, response);
|
|
901
|
+
if (r.content == null) schemas.push({ type: "null" });
|
|
902
|
+
else {
|
|
903
|
+
jsonContent(doc, r);
|
|
904
|
+
for (const [mediaType, media] of Object.entries(object(r.content))) if (/^application\/(json|.+\+json)$/.test(mediaType)) schemas.push(schema$1(doc, object(media).schema ?? {}));
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
if (!schemas.length) throw new Error("A successful JSON response definition is required.");
|
|
908
|
+
return {
|
|
909
|
+
name,
|
|
910
|
+
executor: config,
|
|
911
|
+
inputs,
|
|
912
|
+
outputs: [
|
|
913
|
+
{
|
|
914
|
+
handle: "body",
|
|
915
|
+
jsonSchema: schemas.length == 1 ? schemas[0] : {
|
|
916
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
917
|
+
anyOf: schemas.map((s, index) => inlineSchema(s, index))
|
|
918
|
+
},
|
|
919
|
+
nullable: config.method == "head" || schemas.some((item) => matchesSchema(null, item))
|
|
920
|
+
},
|
|
921
|
+
{
|
|
922
|
+
handle: "statusCode",
|
|
923
|
+
jsonSchema: { type: "integer" },
|
|
924
|
+
nullable: false
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
handle: "headers",
|
|
928
|
+
jsonSchema: {
|
|
929
|
+
type: "object",
|
|
930
|
+
additionalProperties: { type: "string" }
|
|
931
|
+
},
|
|
932
|
+
nullable: false
|
|
933
|
+
}
|
|
934
|
+
]
|
|
935
|
+
};
|
|
936
|
+
}
|
|
937
|
+
function inlineSchema(value, index) {
|
|
938
|
+
if (Array.isArray(value)) return value.map((item) => inlineSchema(item, index));
|
|
939
|
+
if (value == null || typeof value != "object") return value;
|
|
940
|
+
return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, key == "$ref" && typeof child == "string" && child.startsWith("#/") ? `#/anyOf/${index}/${child.slice(2)}` : inlineSchema(child, index)]));
|
|
941
|
+
}
|
|
942
|
+
/** The canvas validator and property panel share the same configuration contract. */
|
|
943
|
+
function openApiFieldIssues(task) {
|
|
944
|
+
if (task.executor.kind != "openapi") return [];
|
|
945
|
+
const config = task.executor;
|
|
946
|
+
let field = "sourceUrl";
|
|
947
|
+
try {
|
|
948
|
+
if (!config.sourceUrl.trim()) return [{
|
|
949
|
+
field,
|
|
950
|
+
message: "Enter an OpenAPI JSON document URL."
|
|
951
|
+
}];
|
|
952
|
+
httpUrl(config.sourceUrl);
|
|
953
|
+
field = "operation";
|
|
954
|
+
if (!config.path) return [{
|
|
955
|
+
field,
|
|
956
|
+
message: "Select an OpenAPI operation."
|
|
957
|
+
}];
|
|
958
|
+
field = "serverUrl";
|
|
959
|
+
httpUrl(config.serverUrl);
|
|
960
|
+
if (new URL(config.serverUrl).search) throw new Error("Server URLs must not contain a query string.");
|
|
961
|
+
field = "operation";
|
|
962
|
+
if (!dequal(config.document, snapshot$7(config.document, config.path, config.method))) return [{
|
|
963
|
+
field,
|
|
964
|
+
message: "Save only the selected operation and its dependencies."
|
|
965
|
+
}];
|
|
966
|
+
const expected = openApiTask(config, task.name);
|
|
967
|
+
if (!dequal(expected.inputs, task.inputs) || !dequal(expected.outputs, task.outputs)) return [{
|
|
968
|
+
field,
|
|
969
|
+
message: "OpenAPI ports must match the saved operation."
|
|
970
|
+
}];
|
|
971
|
+
return [];
|
|
972
|
+
} catch (error) {
|
|
973
|
+
return [{
|
|
974
|
+
field,
|
|
975
|
+
message: error.message
|
|
976
|
+
}];
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
function selectOperation(value, sourceUrl, path, method) {
|
|
980
|
+
const doc = snapshot$7(value, path, method);
|
|
981
|
+
const choices = securityOptions(doc, path, method);
|
|
982
|
+
const auth = choices.find((choice) => choice.auth != null)?.auth;
|
|
983
|
+
if (auth == null) throw new Error(choices[0]?.error ?? "Unsupported authentication.");
|
|
984
|
+
const config = {
|
|
985
|
+
kind: "openapi",
|
|
986
|
+
sourceUrl: httpUrl(sourceUrl),
|
|
987
|
+
method,
|
|
988
|
+
path,
|
|
989
|
+
serverUrl: serverAddress(servers(doc, path, method)[0], sourceUrl),
|
|
990
|
+
document: doc,
|
|
991
|
+
auth
|
|
992
|
+
};
|
|
993
|
+
openApiTask(config);
|
|
994
|
+
return config;
|
|
995
|
+
}
|
|
996
|
+
//#endregion
|
|
997
|
+
//#region src/control/common/authoringOpenApi.ts
|
|
998
|
+
var authenticationSchema = union([
|
|
999
|
+
strictObject({ schemes: array(string$1().min(1)).describe("One complete security alternative advertised by this operation; [] selects no authentication.") }),
|
|
1000
|
+
strictObject({ type: _enum(["bearer", "basic"]) }),
|
|
1001
|
+
strictObject({
|
|
1002
|
+
type: literal("apiKey"),
|
|
1003
|
+
name: string$1().min(1),
|
|
1004
|
+
in: _enum(["header", "query"])
|
|
1005
|
+
})
|
|
1006
|
+
]);
|
|
1007
|
+
strictObject({
|
|
1008
|
+
sourceUrl: string$1().min(1),
|
|
1009
|
+
path: string$1().min(1),
|
|
1010
|
+
method: string$1().min(1),
|
|
1011
|
+
serverUrl: string$1().optional(),
|
|
1012
|
+
authentication: authenticationSchema.optional().describe("Omit to use the operation default. Bind credentials through the advertised node inputs.")
|
|
1013
|
+
});
|
|
1014
|
+
//#endregion
|
|
1015
|
+
//#region src/control/common/authoringSchema.ts
|
|
1016
|
+
var id$1 = string$1().min(1);
|
|
1017
|
+
var json$1 = json$2();
|
|
1018
|
+
var patch = record$2(id$1, json$1);
|
|
1019
|
+
var type = _enum([
|
|
1020
|
+
"manual",
|
|
1021
|
+
"webhook",
|
|
1022
|
+
"cron",
|
|
1023
|
+
"error",
|
|
1024
|
+
"poll",
|
|
1025
|
+
"integration",
|
|
1026
|
+
"code",
|
|
1027
|
+
"connector",
|
|
1028
|
+
"agent",
|
|
1029
|
+
"llm",
|
|
1030
|
+
"decision",
|
|
1031
|
+
"openapi",
|
|
1032
|
+
"condition",
|
|
1033
|
+
"value",
|
|
1034
|
+
"wait",
|
|
1035
|
+
"approval"
|
|
1036
|
+
]);
|
|
1037
|
+
var referenceSchema = id$1.describe("An existing node reference returned by read/search, or $alias for a preceding node.add in this edit batch. For node.add.as \"step\", reference \"$step\", never bare \"step\". Aliases are local to one batch.");
|
|
1038
|
+
var output = strictObject({
|
|
1039
|
+
kind: literal("output"),
|
|
1040
|
+
node: referenceSchema,
|
|
1041
|
+
port: id$1.optional().describe("Omit for a node with one output. For multiple outputs, choose a name from node details."),
|
|
1042
|
+
field: string$1().optional()
|
|
1043
|
+
});
|
|
1044
|
+
var variable$1 = strictObject({
|
|
1045
|
+
kind: literal("variable"),
|
|
1046
|
+
name: id$1
|
|
1047
|
+
});
|
|
1048
|
+
var authoringSourceSchema = union([
|
|
1049
|
+
output,
|
|
1050
|
+
variable$1,
|
|
1051
|
+
strictObject({
|
|
1052
|
+
kind: literal("value"),
|
|
1053
|
+
value: json$1
|
|
1054
|
+
}),
|
|
1055
|
+
strictObject({ kind: literal("unset") }),
|
|
1056
|
+
strictObject({ kind: literal("default") }),
|
|
1057
|
+
strictObject({
|
|
1058
|
+
kind: literal("sources"),
|
|
1059
|
+
sources: array(union([output, variable$1])).min(1)
|
|
1060
|
+
})
|
|
1061
|
+
]);
|
|
1062
|
+
var operand = union([
|
|
1063
|
+
strictObject({
|
|
1064
|
+
kind: literal("value"),
|
|
1065
|
+
value: json$1.optional(),
|
|
1066
|
+
schema: json$1.optional()
|
|
1067
|
+
}),
|
|
1068
|
+
output,
|
|
1069
|
+
variable$1
|
|
1070
|
+
]);
|
|
1071
|
+
var agentTool$1 = authoringDefinitionSchemas.agent.shape.tools.element.omit({
|
|
1072
|
+
id: true,
|
|
1073
|
+
inputs: true
|
|
1074
|
+
}).extend({ inputs: record$2(id$1, authoringDefinitionSchemas.agent.shape.tools.element.shape.inputs.element.shape.source).optional().describe("Action input sources by name. The tool resolves types from the Action. New inputs default to model-provided; existing sources are preserved when omitted.") }).strict();
|
|
1075
|
+
var notification = strictObject({
|
|
1076
|
+
...authoringDefinitionSchemas.connector.shape,
|
|
1077
|
+
messageHandle: id$1,
|
|
1078
|
+
inputs: record$2(id$1, union([strictObject({
|
|
1079
|
+
kind: literal("value"),
|
|
1080
|
+
value: json$1
|
|
1081
|
+
}), strictObject({
|
|
1082
|
+
kind: literal("input"),
|
|
1083
|
+
input: id$1
|
|
1084
|
+
})]))
|
|
1085
|
+
});
|
|
1086
|
+
var field = strictObject({
|
|
1087
|
+
schema: json$1.optional(),
|
|
1088
|
+
nullable: boolean().optional(),
|
|
1089
|
+
description: string$1().optional()
|
|
1090
|
+
});
|
|
1091
|
+
var inputFields = record$2(id$1, field.extend({ default: json$1.optional() })).describe("Optional business input constraints by name. A binding to a new Code, Agent, LLM, Wait or Approval input automatically declares an input accepting any JSON. Existing constraints are preserved. Omitted schema accepts any JSON; omitted nullable is true. Use default for inherited values; input.set supplies data.");
|
|
1092
|
+
var outputFields = record$2(id$1, field).describe("Code return fields by name. Omitted schema accepts any JSON; omitted nullable is true.");
|
|
1093
|
+
var expression = strictObject({
|
|
1094
|
+
left: operand,
|
|
1095
|
+
operator: authoringDefinitionSchemas.condition.shape.cases.element.shape.groups.element.shape.expressions.element.shape.operator,
|
|
1096
|
+
right: operand.optional()
|
|
1097
|
+
});
|
|
1098
|
+
var all = strictObject({ all: array(expression) });
|
|
1099
|
+
var when = union([
|
|
1100
|
+
expression,
|
|
1101
|
+
all,
|
|
1102
|
+
strictObject({ any: array(union([expression, all])) })
|
|
1103
|
+
]);
|
|
1104
|
+
strictObject({}), strictObject({ sourceFlowIds: array(id$1).optional() }), authoringDefinitionSchemas.webhook.omit({ bodyFields: true }).extend({ body: inputFields }).strict(), strictObject({ schedule: authoringDefinitionSchemas.schedule }), strictObject({
|
|
1105
|
+
key: id$1,
|
|
1106
|
+
connectionId: id$1.optional(),
|
|
1107
|
+
schedule: authoringDefinitionSchemas.schedule
|
|
1108
|
+
}), strictObject({
|
|
1109
|
+
key: id$1,
|
|
1110
|
+
connectionId: id$1.optional()
|
|
1111
|
+
}), strictObject({
|
|
1112
|
+
inputs: inputFields,
|
|
1113
|
+
outputs: outputFields,
|
|
1114
|
+
capabilities: authoringDefinitionSchemas.capabilities.optional()
|
|
1115
|
+
}), authoringDefinitionSchemas.connector.strict(), authoringDefinitionSchemas.agent.omit({
|
|
1116
|
+
prompt: true,
|
|
1117
|
+
tools: true
|
|
1118
|
+
}).extend({
|
|
1119
|
+
inputs: inputFields,
|
|
1120
|
+
resultSchema: json$1.describe("JSON schema of the final result. Defaults to text. The tool manages the output definition; references can omit port."),
|
|
1121
|
+
tools: array(agentTool$1),
|
|
1122
|
+
notification: notification.optional()
|
|
1123
|
+
}).strict(), authoringLlmConfiguration.extend({ inputs: inputFields }), authoringDefinitionSchemas.decision, strictObject({
|
|
1124
|
+
match: _enum(["first", "all"]),
|
|
1125
|
+
branches: array(strictObject({
|
|
1126
|
+
name: id$1,
|
|
1127
|
+
description: string$1().optional(),
|
|
1128
|
+
when
|
|
1129
|
+
}))
|
|
1130
|
+
}), strictObject({
|
|
1131
|
+
values: patch,
|
|
1132
|
+
outputs: outputFields
|
|
1133
|
+
}), strictObject({ inputs: inputFields }), strictObject({ inputs: inputFields });
|
|
1134
|
+
var metadata = {
|
|
1135
|
+
name: id$1.optional(),
|
|
1136
|
+
description: string$1().optional(),
|
|
1137
|
+
icon: string$1().optional(),
|
|
1138
|
+
maxExecutions: int().positive().optional(),
|
|
1139
|
+
timeoutMs: number().nonnegative().optional()
|
|
1140
|
+
};
|
|
1141
|
+
var updates = strictObject({
|
|
1142
|
+
...metadata,
|
|
1143
|
+
config: patch.optional().describe("Recursively merge configuration; omitted fields remain unchanged and arrays replace as a whole. This includes schema objects: {} does not clear an existing schema. Use clear paths to remove fields, e.g. [\"config\",\"inputs\",\"amount\",\"schema\",\"type\"].")
|
|
1144
|
+
});
|
|
1145
|
+
var authoringEditSchema = discriminatedUnion("op", [
|
|
1146
|
+
strictObject({
|
|
1147
|
+
op: literal("node.add"),
|
|
1148
|
+
as: id$1.regex(/^[A-Za-z][\w-]*$/).describe("Unique batch-local alias without the $ prefix. Later edits must reference this new node as $alias; the bare alias is not its node ID."),
|
|
1149
|
+
type,
|
|
1150
|
+
name: id$1,
|
|
1151
|
+
config: patch.optional(),
|
|
1152
|
+
inputs: record$2(id$1, authoringSourceSchema).optional().describe("Input data sources, applied after creation, as input.set operations. Execution edges are separate."),
|
|
1153
|
+
code: string$1().optional(),
|
|
1154
|
+
prompt: string$1().optional()
|
|
1155
|
+
}),
|
|
1156
|
+
strictObject({
|
|
1157
|
+
op: literal("node.update"),
|
|
1158
|
+
node: referenceSchema,
|
|
1159
|
+
set: updates.optional(),
|
|
1160
|
+
clear: array(array(id$1).min(1)).optional()
|
|
1161
|
+
}),
|
|
1162
|
+
strictObject({
|
|
1163
|
+
op: literal("node.remove"),
|
|
1164
|
+
node: referenceSchema
|
|
1165
|
+
}),
|
|
1166
|
+
strictObject({
|
|
1167
|
+
op: literal("input.set"),
|
|
1168
|
+
node: referenceSchema,
|
|
1169
|
+
input: id$1,
|
|
1170
|
+
source: authoringSourceSchema
|
|
1171
|
+
}),
|
|
1172
|
+
strictObject({
|
|
1173
|
+
op: _enum(["edge.connect", "edge.disconnect"]),
|
|
1174
|
+
source: referenceSchema,
|
|
1175
|
+
target: referenceSchema,
|
|
1176
|
+
branch: id$1.optional()
|
|
1177
|
+
}),
|
|
1178
|
+
strictObject({
|
|
1179
|
+
op: literal("text.edit"),
|
|
1180
|
+
node: referenceSchema,
|
|
1181
|
+
field: _enum(["code", "prompt"]),
|
|
1182
|
+
oldText: id$1,
|
|
1183
|
+
newText: string$1()
|
|
1184
|
+
}),
|
|
1185
|
+
strictObject({
|
|
1186
|
+
op: literal("text.set"),
|
|
1187
|
+
node: referenceSchema,
|
|
1188
|
+
field: _enum(["code", "prompt"]),
|
|
1189
|
+
text: string$1()
|
|
1190
|
+
})
|
|
1191
|
+
]);
|
|
1192
|
+
strictObject({
|
|
1193
|
+
baseRevision: id$1,
|
|
1194
|
+
requestId: id$1.max(256),
|
|
1195
|
+
edits: array(authoringEditSchema).min(1).max(1e3)
|
|
1196
|
+
});
|
|
1197
|
+
strictObject({
|
|
1198
|
+
revision: id$1.optional().describe("Fixed revision from a previous read; omit to read the current draft."),
|
|
1199
|
+
nodes: array(id$1).min(1).max(100).optional().describe("Node references to read in one batch. Mutually exclusive with text. Long texts return metadata."),
|
|
1200
|
+
text: strictObject({
|
|
1201
|
+
node: id$1,
|
|
1202
|
+
field: _enum(["code", "prompt"]),
|
|
1203
|
+
start: int().positive().default(1),
|
|
1204
|
+
lines: int().min(1).max(200).default(80)
|
|
1205
|
+
}).optional().describe("Read code or prompt by line (1-based). Mutually exclusive with nodes. Follow nextStart at the same revision until truncated is false.")
|
|
1206
|
+
}).refine((v) => v.nodes == null || v.text == null, "Choose nodes or text.").meta({
|
|
1207
|
+
not: { required: ["nodes", "text"] },
|
|
1208
|
+
description: "Omit nodes and text for an outline; provide nodes for details, or text for an excerpt."
|
|
1209
|
+
});
|
|
1210
|
+
strictObject({ revisionId: id$1 });
|
|
1211
|
+
strictObject({
|
|
1212
|
+
revision: id$1.optional(),
|
|
1213
|
+
query: id$1.max(1e3),
|
|
1214
|
+
type: type.optional(),
|
|
1215
|
+
offset: int().nonnegative().default(0),
|
|
1216
|
+
limit: int().min(1).max(100).default(20)
|
|
1217
|
+
});
|
|
1218
|
+
strictObject({
|
|
1219
|
+
type: type.optional(),
|
|
1220
|
+
action: id$1.optional()
|
|
1221
|
+
}).refine((v) => v.type == null || v.action == null, "Choose type or action.");
|
|
1222
|
+
var authoringDiagnosticSchema = object$1({
|
|
1223
|
+
code: id$1,
|
|
1224
|
+
message: string$1(),
|
|
1225
|
+
nodes: array(id$1),
|
|
1226
|
+
field: string$1().optional(),
|
|
1227
|
+
line: number().optional(),
|
|
1228
|
+
column: number().optional()
|
|
1229
|
+
});
|
|
1230
|
+
var authoringCheckResponse = object$1({
|
|
1231
|
+
flowId: id$1,
|
|
1232
|
+
revisionId: id$1,
|
|
1233
|
+
valid: boolean(),
|
|
1234
|
+
diagnostics: array(authoringDiagnosticSchema),
|
|
1235
|
+
version: literal(1)
|
|
1236
|
+
});
|
|
1237
|
+
var authoringEditResponse = object$1({
|
|
1238
|
+
flowId: id$1,
|
|
1239
|
+
saved: literal(true),
|
|
1240
|
+
revision: id$1,
|
|
1241
|
+
nodes: record$2(id$1, id$1),
|
|
1242
|
+
changes: array(object$1({
|
|
1243
|
+
index: int(),
|
|
1244
|
+
op: id$1,
|
|
1245
|
+
node: id$1.optional()
|
|
1246
|
+
})),
|
|
1247
|
+
validation: object$1({
|
|
1248
|
+
status: _enum([
|
|
1249
|
+
"valid",
|
|
1250
|
+
"invalid",
|
|
1251
|
+
"unavailable"
|
|
1252
|
+
]),
|
|
1253
|
+
diagnostics: array(authoringDiagnosticSchema).optional()
|
|
1254
|
+
}),
|
|
1255
|
+
version: literal(1)
|
|
1256
|
+
});
|
|
1257
|
+
var authoringReadResponse = object$1({
|
|
1258
|
+
flowId: id$1,
|
|
1259
|
+
revision: id$1,
|
|
1260
|
+
data: object$1({
|
|
1261
|
+
nodes: array(record$2(string$1(), json$1)).optional(),
|
|
1262
|
+
edges: array(json$1).optional(),
|
|
1263
|
+
text: record$2(string$1(), json$1).optional()
|
|
1264
|
+
}),
|
|
1265
|
+
version: literal(1)
|
|
1266
|
+
});
|
|
1267
|
+
var authoringSearchResponse = object$1({
|
|
1268
|
+
flowId: id$1,
|
|
1269
|
+
revision: id$1,
|
|
1270
|
+
data: object$1({
|
|
1271
|
+
matches: array(object$1({
|
|
1272
|
+
node: id$1,
|
|
1273
|
+
field: id$1,
|
|
1274
|
+
line: int().optional(),
|
|
1275
|
+
excerpt: string$1()
|
|
1276
|
+
})),
|
|
1277
|
+
total: int(),
|
|
1278
|
+
nextOffset: int().optional()
|
|
1279
|
+
}),
|
|
1280
|
+
version: literal(1)
|
|
1281
|
+
});
|
|
1282
|
+
//#endregion
|
|
532
1283
|
//#region src/control/common/providerIconSprite.ts
|
|
533
1284
|
/** Optional artwork must never make an otherwise usable catalog unavailable. */
|
|
534
1285
|
function providerIconAppearance(metadata, position) {
|
|
@@ -562,26 +1313,6 @@ function providerIconAppearance(metadata, position) {
|
|
|
562
1313
|
}
|
|
563
1314
|
};
|
|
564
1315
|
}
|
|
565
|
-
//#endregion
|
|
566
|
-
//#region src/flow/common/inputValue.ts
|
|
567
|
-
/** An explicit clear suppresses the default; absent mappings still inherit it. */
|
|
568
|
-
function inputValue(mapping, fallback) {
|
|
569
|
-
if (mapping?.kind === "unset") return void 0;
|
|
570
|
-
return mapping?.kind === "value" ? mapping.value : fallback;
|
|
571
|
-
}
|
|
572
|
-
/** Converts explicit user values at authoring boundaries, never persisted legacy data. */
|
|
573
|
-
function inputValues(values) {
|
|
574
|
-
return Object.fromEntries(Object.entries(values).map(([name, value]) => [name, {
|
|
575
|
-
kind: "value",
|
|
576
|
-
value
|
|
577
|
-
}]));
|
|
578
|
-
}
|
|
579
|
-
function fixedInputValue(value) {
|
|
580
|
-
return value === void 0 ? { kind: "unset" } : {
|
|
581
|
-
kind: "value",
|
|
582
|
-
value
|
|
583
|
-
};
|
|
584
|
-
}
|
|
585
1316
|
new TextEncoder();
|
|
586
1317
|
//#endregion
|
|
587
1318
|
//#region src/control/common/providerAccess.ts
|
|
@@ -1504,9 +2235,9 @@ function decodeEventSources(value) {
|
|
|
1504
2235
|
var configInputsSchema = array(union([strictObject({
|
|
1505
2236
|
handle: string$1().min(1),
|
|
1506
2237
|
description: string$1().optional(),
|
|
1507
|
-
jsonSchema: json$
|
|
2238
|
+
jsonSchema: json$2(),
|
|
1508
2239
|
nullable: boolean(),
|
|
1509
|
-
value: json$
|
|
2240
|
+
value: json$2().optional()
|
|
1510
2241
|
}), strictObject({
|
|
1511
2242
|
group: string$1(),
|
|
1512
2243
|
collapsed: boolean().optional()
|
|
@@ -1745,7 +2476,7 @@ strictObject({
|
|
|
1745
2476
|
});
|
|
1746
2477
|
//#endregion
|
|
1747
2478
|
//#region src/control/common/results.ts
|
|
1748
|
-
var json = json$
|
|
2479
|
+
var json = json$2();
|
|
1749
2480
|
var entry = strictObject({
|
|
1750
2481
|
pointer: string$1(),
|
|
1751
2482
|
type: _enum([
|
|
@@ -1909,6 +2640,43 @@ function connectorConnectionsQuery(serviceId, flowId) {
|
|
|
1909
2640
|
}
|
|
1910
2641
|
//#endregion
|
|
1911
2642
|
//#region src/control/common/flowDecoders.ts
|
|
2643
|
+
function strings(value) {
|
|
2644
|
+
return Array.isArray(value) ? value.map(string) : invalidResponse();
|
|
2645
|
+
}
|
|
2646
|
+
function resourceReferences(input) {
|
|
2647
|
+
const source = record$1(input);
|
|
2648
|
+
const draft = source.draft === null ? null : record$1(source.draft);
|
|
2649
|
+
const shared = record$1(source.sharedAccess);
|
|
2650
|
+
if (draft != null && !Array.isArray(draft.connections)) return invalidResponse();
|
|
2651
|
+
if (!Array.isArray(shared.bindings)) return invalidResponse();
|
|
2652
|
+
const accessRevision = integer(shared.accessRevision);
|
|
2653
|
+
if (accessRevision < 0) return invalidResponse();
|
|
2654
|
+
return {
|
|
2655
|
+
draft: draft == null ? null : {
|
|
2656
|
+
variableNames: strings(draft.variableNames),
|
|
2657
|
+
errorSourceFlowIds: strings(draft.errorSourceFlowIds),
|
|
2658
|
+
connections: draft.connections.map((value) => {
|
|
2659
|
+
const connection = record$1(value);
|
|
2660
|
+
return {
|
|
2661
|
+
providerId: string(connection.providerId),
|
|
2662
|
+
connectionId: string(connection.connectionId)
|
|
2663
|
+
};
|
|
2664
|
+
})
|
|
2665
|
+
},
|
|
2666
|
+
sharedAccess: {
|
|
2667
|
+
accessRevision,
|
|
2668
|
+
providerIds: strings(shared.providerIds),
|
|
2669
|
+
bindings: shared.bindings.map((value) => {
|
|
2670
|
+
const binding = record$1(value);
|
|
2671
|
+
return {
|
|
2672
|
+
providerId: string(binding.providerId),
|
|
2673
|
+
connectionId: binding.connectionId === null ? null : string(binding.connectionId),
|
|
2674
|
+
accessBindingId: string(binding.accessBindingId)
|
|
2675
|
+
};
|
|
2676
|
+
})
|
|
2677
|
+
}
|
|
2678
|
+
};
|
|
2679
|
+
}
|
|
1912
2680
|
function flow(value) {
|
|
1913
2681
|
const source = record$1(value);
|
|
1914
2682
|
const status = source.status;
|
|
@@ -1925,6 +2693,7 @@ function flow(value) {
|
|
|
1925
2693
|
createdAt: string(source.createdAt),
|
|
1926
2694
|
...source.connectorTeamId == null ? {} : { connectorTeamId: string(source.connectorTeamId) },
|
|
1927
2695
|
draftRevisionId: string(source.draftRevisionId),
|
|
2696
|
+
resourceReferences: resourceReferences(source.resourceReferences),
|
|
1928
2697
|
flowId: string(source.flowId),
|
|
1929
2698
|
name: string(source.name),
|
|
1930
2699
|
status,
|
|
@@ -3009,6 +3778,37 @@ var ControlClient = class {
|
|
|
3009
3778
|
return invalidResponse();
|
|
3010
3779
|
}
|
|
3011
3780
|
}
|
|
3781
|
+
async readAuthoring(flowId, query = {}) {
|
|
3782
|
+
return authoringReadResponse.parse(await this.request(`/v1/flows/${segment$1(flowId)}/authoring/read`, {
|
|
3783
|
+
method: "POST",
|
|
3784
|
+
body: JSON.stringify(query)
|
|
3785
|
+
}));
|
|
3786
|
+
}
|
|
3787
|
+
async searchAuthoring(flowId, query) {
|
|
3788
|
+
return authoringSearchResponse.parse(await this.request(`/v1/flows/${segment$1(flowId)}/authoring/search`, {
|
|
3789
|
+
method: "POST",
|
|
3790
|
+
body: JSON.stringify(query)
|
|
3791
|
+
}));
|
|
3792
|
+
}
|
|
3793
|
+
async authoringSchema(flowId, query) {
|
|
3794
|
+
return record$1(await this.request(`/v1/flows/${segment$1(flowId)}/authoring/schema`, {
|
|
3795
|
+
method: "POST",
|
|
3796
|
+
body: JSON.stringify(query)
|
|
3797
|
+
}));
|
|
3798
|
+
}
|
|
3799
|
+
async editAuthoring(flowId, request) {
|
|
3800
|
+
return authoringEditResponse.parse(await this.request(`/v1/flows/${segment$1(flowId)}/authoring/edit`, {
|
|
3801
|
+
method: "POST",
|
|
3802
|
+
headers: { "idempotency-key": request.requestId },
|
|
3803
|
+
body: JSON.stringify(request)
|
|
3804
|
+
}));
|
|
3805
|
+
}
|
|
3806
|
+
async checkAuthoring(flowId, revisionId) {
|
|
3807
|
+
return authoringCheckResponse.parse(await this.request(`/v1/flows/${segment$1(flowId)}/authoring/check`, {
|
|
3808
|
+
method: "POST",
|
|
3809
|
+
body: JSON.stringify({ revisionId })
|
|
3810
|
+
}));
|
|
3811
|
+
}
|
|
3012
3812
|
async changeDraft(flowId, expectedRevisionId, operations, changeId = operationKey("change")) {
|
|
3013
3813
|
return draftChange(await this.request(`/v1/flows/${segment$1(flowId)}/draft/changes`, {
|
|
3014
3814
|
body: JSON.stringify({
|
|
@@ -3191,7 +3991,7 @@ var ControlClient = class {
|
|
|
3191
3991
|
}
|
|
3192
3992
|
const error = record$1(value).error;
|
|
3193
3993
|
const source = error == null ? void 0 : record$1(error);
|
|
3194
|
-
throw new ApiError(response.status, typeof source?.code == "string" ? source.code : "request.failed", typeof source?.message == "string" ? source.message : `Request failed with status ${response.status}
|
|
3994
|
+
throw new ApiError(response.status, typeof source?.code == "string" ? source.code : "request.failed", typeof source?.message == "string" ? source.message : `Request failed with status ${response.status}.`, source?.details == null ? void 0 : record$1(source.details));
|
|
3195
3995
|
}
|
|
3196
3996
|
return response;
|
|
3197
3997
|
}
|
|
@@ -23822,6 +24622,19 @@ var codeTaskTemplate = `export default async function (inputs, context) {
|
|
|
23822
24622
|
return { result: inputs.value }
|
|
23823
24623
|
}
|
|
23824
24624
|
`;
|
|
24625
|
+
var defaultCodeTaskPorts = {
|
|
24626
|
+
inputs: [{
|
|
24627
|
+
handle: "value",
|
|
24628
|
+
jsonSchema: { type: "string" },
|
|
24629
|
+
nullable: true,
|
|
24630
|
+
value: "foo"
|
|
24631
|
+
}],
|
|
24632
|
+
outputs: [{
|
|
24633
|
+
handle: "result",
|
|
24634
|
+
jsonSchema: {},
|
|
24635
|
+
nullable: true
|
|
24636
|
+
}]
|
|
24637
|
+
};
|
|
23825
24638
|
function defaultNodeName(_content, node) {
|
|
23826
24639
|
switch (node.kind) {
|
|
23827
24640
|
case "condition": return "Condition";
|
|
@@ -23861,19 +24674,7 @@ function graphNameRepairs(content, targetGraph) {
|
|
|
23861
24674
|
function repairNodeNames(content) {
|
|
23862
24675
|
return graphNameRepairs(content, content.document.graph);
|
|
23863
24676
|
}
|
|
23864
|
-
function createCodeTask(identity, name, module = void 0, ports = {
|
|
23865
|
-
inputs: [{
|
|
23866
|
-
handle: "value",
|
|
23867
|
-
jsonSchema: { type: "string" },
|
|
23868
|
-
nullable: true,
|
|
23869
|
-
value: "foo"
|
|
23870
|
-
}],
|
|
23871
|
-
outputs: [{
|
|
23872
|
-
handle: "result",
|
|
23873
|
-
jsonSchema: {},
|
|
23874
|
-
nullable: true
|
|
23875
|
-
}]
|
|
23876
|
-
}) {
|
|
24677
|
+
function createCodeTask(identity, name, module = void 0, ports = defaultCodeTaskPorts) {
|
|
23877
24678
|
return [{
|
|
23878
24679
|
kind: "module.create",
|
|
23879
24680
|
module: {
|
|
@@ -23920,7 +24721,7 @@ function createManagedTask(identity, task) {
|
|
|
23920
24721
|
function createAgentTask(identity, name, defaults = {}) {
|
|
23921
24722
|
return createManagedTask(identity, {
|
|
23922
24723
|
name,
|
|
23923
|
-
inputs: [{
|
|
24724
|
+
inputs: defaults.inputs ?? [{
|
|
23924
24725
|
handle: "input",
|
|
23925
24726
|
jsonSchema: { type: "string" },
|
|
23926
24727
|
nullable: false,
|
|
@@ -24014,19 +24815,19 @@ function createCondition(nodeId, name) {
|
|
|
24014
24815
|
nodeId
|
|
24015
24816
|
}];
|
|
24016
24817
|
}
|
|
24017
|
-
function createValue(nodeId, name
|
|
24818
|
+
function createValue(nodeId, name, values = [{
|
|
24819
|
+
handle: "value",
|
|
24820
|
+
jsonSchema: {},
|
|
24821
|
+
nullable: true,
|
|
24822
|
+
value: null
|
|
24823
|
+
}]) {
|
|
24018
24824
|
return [{
|
|
24019
24825
|
kind: "graph.node.create",
|
|
24020
24826
|
node: {
|
|
24021
24827
|
inputs: {},
|
|
24022
24828
|
kind: "value",
|
|
24023
24829
|
name,
|
|
24024
|
-
values
|
|
24025
|
-
handle: "value",
|
|
24026
|
-
jsonSchema: {},
|
|
24027
|
-
nullable: true,
|
|
24028
|
-
value: null
|
|
24029
|
-
}]
|
|
24830
|
+
values
|
|
24030
24831
|
},
|
|
24031
24832
|
nodeId
|
|
24032
24833
|
}];
|
|
@@ -24811,441 +25612,6 @@ function connectionUsage(document) {
|
|
|
24811
25612
|
return uses;
|
|
24812
25613
|
}
|
|
24813
25614
|
//#endregion
|
|
24814
|
-
//#region src/openapi/common/openapi.ts
|
|
24815
|
-
var methods = [
|
|
24816
|
-
"get",
|
|
24817
|
-
"put",
|
|
24818
|
-
"post",
|
|
24819
|
-
"delete",
|
|
24820
|
-
"options",
|
|
24821
|
-
"head",
|
|
24822
|
-
"patch",
|
|
24823
|
-
"trace"
|
|
24824
|
-
];
|
|
24825
|
-
function object(value) {
|
|
24826
|
-
if (value == null || typeof value != "object" || Array.isArray(value)) throw new Error("Expected an OpenAPI object.");
|
|
24827
|
-
return value;
|
|
24828
|
-
}
|
|
24829
|
-
function httpUrl(value, base) {
|
|
24830
|
-
const url = new URL(value, base);
|
|
24831
|
-
if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.hash) throw new Error("An HTTP(S) URL without credentials or fragment is required.");
|
|
24832
|
-
return url.href;
|
|
24833
|
-
}
|
|
24834
|
-
function parseOpenApi(value) {
|
|
24835
|
-
const doc = object(value);
|
|
24836
|
-
if (typeof doc.openapi != "string" || !/^3\.[01]\.\d+$/.test(doc.openapi)) throw new Error("Only OpenAPI 3.0 and 3.1 JSON documents are supported.");
|
|
24837
|
-
object(doc.paths);
|
|
24838
|
-
return doc;
|
|
24839
|
-
}
|
|
24840
|
-
function pointer(doc, ref) {
|
|
24841
|
-
if (!ref.startsWith("#/")) throw new Error("External OpenAPI references are not supported.");
|
|
24842
|
-
let value = doc;
|
|
24843
|
-
for (const key of decodeURIComponent(ref.slice(2)).split("/").map((part) => part.replace(/~1/g, "/").replace(/~0/g, "~"))) {
|
|
24844
|
-
const source = object(value);
|
|
24845
|
-
if (!Object.hasOwn(source, key)) throw new Error("An OpenAPI reference is missing.");
|
|
24846
|
-
value = source[key];
|
|
24847
|
-
}
|
|
24848
|
-
return value;
|
|
24849
|
-
}
|
|
24850
|
-
function resolved(doc, value) {
|
|
24851
|
-
let result = object(value);
|
|
24852
|
-
const seen = /* @__PURE__ */ new Set();
|
|
24853
|
-
while (typeof result.$ref == "string") {
|
|
24854
|
-
if (seen.has(result.$ref)) throw new Error("Circular non-schema reference is unsupported.");
|
|
24855
|
-
seen.add(result.$ref);
|
|
24856
|
-
const { $ref, ...siblings } = result;
|
|
24857
|
-
result = {
|
|
24858
|
-
...object(pointer(doc, $ref)),
|
|
24859
|
-
...siblings
|
|
24860
|
-
};
|
|
24861
|
-
}
|
|
24862
|
-
return result;
|
|
24863
|
-
}
|
|
24864
|
-
function listOperations(documentValue) {
|
|
24865
|
-
const doc = parseOpenApi(documentValue);
|
|
24866
|
-
return Object.entries(object(doc.paths)).flatMap(([path, value]) => {
|
|
24867
|
-
const item = resolved(doc, value);
|
|
24868
|
-
return methods.filter((method) => item[method] != null).map((method) => {
|
|
24869
|
-
const op = object(item[method]);
|
|
24870
|
-
return {
|
|
24871
|
-
method,
|
|
24872
|
-
path,
|
|
24873
|
-
label: String(op.summary ?? op.operationId ?? `${method.toUpperCase()} ${path}`),
|
|
24874
|
-
tag: String(op.tags?.[0] ?? "")
|
|
24875
|
-
};
|
|
24876
|
-
});
|
|
24877
|
-
});
|
|
24878
|
-
}
|
|
24879
|
-
function operation(doc, path, method) {
|
|
24880
|
-
const item = resolved(doc, object(doc.paths)[path]);
|
|
24881
|
-
if (!methods.includes(method) || item[method] == null) throw new Error("The selected operation is no longer available.");
|
|
24882
|
-
return {
|
|
24883
|
-
item,
|
|
24884
|
-
op: object(item[method])
|
|
24885
|
-
};
|
|
24886
|
-
}
|
|
24887
|
-
function servers(value, path, method) {
|
|
24888
|
-
const doc = parseOpenApi(value);
|
|
24889
|
-
const { item, op } = operation(doc, path, method);
|
|
24890
|
-
const entries = op.servers ?? item.servers ?? doc.servers;
|
|
24891
|
-
if (!Array.isArray(entries) || entries.length == 0) return [{ url: "/" }];
|
|
24892
|
-
return entries.map(object);
|
|
24893
|
-
}
|
|
24894
|
-
function serverAddress(server, sourceUrl, variables = {}) {
|
|
24895
|
-
return httpUrl(String(server.url).replace(/\{([^}]+)\}/g, (_, name) => {
|
|
24896
|
-
const definition = object(object(server.variables)[name]);
|
|
24897
|
-
const value = variables[name] ?? definition.default;
|
|
24898
|
-
if (typeof value != "string" || Array.isArray(definition.enum) && !definition.enum.includes(value)) throw new Error("A server variable is invalid.");
|
|
24899
|
-
return value;
|
|
24900
|
-
}), sourceUrl);
|
|
24901
|
-
}
|
|
24902
|
-
function securityOptions(value, path, method) {
|
|
24903
|
-
const doc = parseOpenApi(value);
|
|
24904
|
-
const { op } = operation(doc, path, method);
|
|
24905
|
-
const requirements = op.security ?? doc.security ?? [];
|
|
24906
|
-
if (!Array.isArray(requirements)) throw new Error("Invalid security requirements.");
|
|
24907
|
-
if (!requirements.length) return [{
|
|
24908
|
-
label: "None",
|
|
24909
|
-
auth: []
|
|
24910
|
-
}];
|
|
24911
|
-
return requirements.map((entry) => {
|
|
24912
|
-
const names = Object.keys(object(entry));
|
|
24913
|
-
const label = names.join(" + ") || "None";
|
|
24914
|
-
try {
|
|
24915
|
-
if (!names.length) return {
|
|
24916
|
-
label,
|
|
24917
|
-
auth: []
|
|
24918
|
-
};
|
|
24919
|
-
const schemes = object(object(doc.components).securitySchemes);
|
|
24920
|
-
return {
|
|
24921
|
-
label,
|
|
24922
|
-
auth: names.map((id) => {
|
|
24923
|
-
const scheme = resolved(doc, schemes[id]);
|
|
24924
|
-
if (scheme.type == "http" && ["bearer", "basic"].includes(String(scheme.scheme).toLowerCase())) return {
|
|
24925
|
-
id,
|
|
24926
|
-
type: String(scheme.scheme).toLowerCase()
|
|
24927
|
-
};
|
|
24928
|
-
if (scheme.type == "apiKey" && (scheme.in == "header" || scheme.in == "query") && typeof scheme.name == "string") return {
|
|
24929
|
-
id,
|
|
24930
|
-
type: "apiKey",
|
|
24931
|
-
name: scheme.name,
|
|
24932
|
-
in: scheme.in
|
|
24933
|
-
};
|
|
24934
|
-
throw new Error("This security scheme is unsupported. Supply an access token using manual Bearer authentication if applicable.");
|
|
24935
|
-
})
|
|
24936
|
-
};
|
|
24937
|
-
} catch (error) {
|
|
24938
|
-
return {
|
|
24939
|
-
label,
|
|
24940
|
-
error: error.message
|
|
24941
|
-
};
|
|
24942
|
-
}
|
|
24943
|
-
});
|
|
24944
|
-
}
|
|
24945
|
-
function snapshot(documentValue, path, method) {
|
|
24946
|
-
const doc = parseOpenApi(documentValue);
|
|
24947
|
-
const { item, op } = operation(doc, path, method);
|
|
24948
|
-
const security = op.security ?? doc.security ?? [];
|
|
24949
|
-
const result = {
|
|
24950
|
-
openapi: doc.openapi,
|
|
24951
|
-
paths: { [path]: {
|
|
24952
|
-
[method]: op,
|
|
24953
|
-
...item.parameters == null ? {} : { parameters: item.parameters }
|
|
24954
|
-
} },
|
|
24955
|
-
servers: servers(doc, path, method),
|
|
24956
|
-
security
|
|
24957
|
-
};
|
|
24958
|
-
const visited = /* @__PURE__ */ new Set();
|
|
24959
|
-
function copy(ref) {
|
|
24960
|
-
if (visited.has(ref)) return;
|
|
24961
|
-
visited.add(ref);
|
|
24962
|
-
const value = pointer(doc, ref);
|
|
24963
|
-
const keys = decodeURIComponent(ref.slice(2)).split("/").map((part) => part.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
24964
|
-
if (keys.some((key) => [
|
|
24965
|
-
"__proto__",
|
|
24966
|
-
"constructor",
|
|
24967
|
-
"prototype"
|
|
24968
|
-
].includes(key))) throw new Error("Unsupported reference key.");
|
|
24969
|
-
let target = result;
|
|
24970
|
-
for (const key of keys.slice(0, -1)) {
|
|
24971
|
-
if (!Object.hasOwn(target, key)) target[key] = {};
|
|
24972
|
-
target = object(target[key]);
|
|
24973
|
-
}
|
|
24974
|
-
target[keys.at(-1)] = structuredClone(value);
|
|
24975
|
-
visit(value);
|
|
24976
|
-
}
|
|
24977
|
-
function visit(value) {
|
|
24978
|
-
if (value == null || typeof value != "object") return;
|
|
24979
|
-
if (Array.isArray(value)) {
|
|
24980
|
-
value.forEach(visit);
|
|
24981
|
-
return;
|
|
24982
|
-
}
|
|
24983
|
-
if (typeof object(value).$ref == "string") copy(object(value).$ref);
|
|
24984
|
-
for (const [key, child] of Object.entries(value)) if (![
|
|
24985
|
-
"example",
|
|
24986
|
-
"examples",
|
|
24987
|
-
"default"
|
|
24988
|
-
].includes(key)) visit(child);
|
|
24989
|
-
}
|
|
24990
|
-
visit(result);
|
|
24991
|
-
for (const entry of security) for (const name of Object.keys(object(entry))) copy(`#/components/securitySchemes/${name.replace(/~/g, "~0").replace(/\//g, "~1")}`);
|
|
24992
|
-
return structuredClone(result);
|
|
24993
|
-
}
|
|
24994
|
-
function schema$1(doc, schemaValue) {
|
|
24995
|
-
const defs = {};
|
|
24996
|
-
const ids = /* @__PURE__ */ new Map();
|
|
24997
|
-
function convert(value) {
|
|
24998
|
-
if (typeof value == "boolean") return value;
|
|
24999
|
-
const source = object(value);
|
|
25000
|
-
if (source.format == "binary" || source.$dynamicRef != null || source.$id != null) throw new Error("Binary and dynamically scoped schemas are unsupported.");
|
|
25001
|
-
const result = {};
|
|
25002
|
-
for (const [key, child] of Object.entries(source)) {
|
|
25003
|
-
if ([
|
|
25004
|
-
"nullable",
|
|
25005
|
-
"example",
|
|
25006
|
-
"xml",
|
|
25007
|
-
"discriminator",
|
|
25008
|
-
"__proto__"
|
|
25009
|
-
].includes(key)) continue;
|
|
25010
|
-
if (key == "$ref") {
|
|
25011
|
-
if (typeof child != "string") throw new Error("Invalid schema reference.");
|
|
25012
|
-
let id = ids.get(child);
|
|
25013
|
-
if (id == null) {
|
|
25014
|
-
id = `s${ids.size}`;
|
|
25015
|
-
ids.set(child, id);
|
|
25016
|
-
defs[id] = convert(pointer(doc, child));
|
|
25017
|
-
}
|
|
25018
|
-
result.$ref = `#/$defs/${id}`;
|
|
25019
|
-
} else if ([
|
|
25020
|
-
"properties",
|
|
25021
|
-
"patternProperties",
|
|
25022
|
-
"$defs",
|
|
25023
|
-
"definitions",
|
|
25024
|
-
"dependentSchemas"
|
|
25025
|
-
].includes(key)) result[key] = Object.fromEntries(Object.entries(object(child)).map(([name, childSchema]) => [name, convert(childSchema)]));
|
|
25026
|
-
else if ([
|
|
25027
|
-
"allOf",
|
|
25028
|
-
"anyOf",
|
|
25029
|
-
"oneOf",
|
|
25030
|
-
"prefixItems"
|
|
25031
|
-
].includes(key)) {
|
|
25032
|
-
if (!Array.isArray(child)) throw new Error("Invalid schema composition.");
|
|
25033
|
-
result[key] = child.map(convert);
|
|
25034
|
-
} else if ([
|
|
25035
|
-
"items",
|
|
25036
|
-
"additionalProperties",
|
|
25037
|
-
"not",
|
|
25038
|
-
"if",
|
|
25039
|
-
"then",
|
|
25040
|
-
"else",
|
|
25041
|
-
"contains",
|
|
25042
|
-
"propertyNames",
|
|
25043
|
-
"unevaluatedProperties"
|
|
25044
|
-
].includes(key)) result[key] = convert(child);
|
|
25045
|
-
else result[key] = child;
|
|
25046
|
-
}
|
|
25047
|
-
if (source.nullable === true) return { anyOf: [result, { type: "null" }] };
|
|
25048
|
-
for (const key of ["minimum", "maximum"]) {
|
|
25049
|
-
const exclusive = key == "minimum" ? "exclusiveMinimum" : "exclusiveMaximum";
|
|
25050
|
-
if (typeof result[exclusive] == "boolean") {
|
|
25051
|
-
if (result[exclusive] && typeof result[key] == "number") {
|
|
25052
|
-
result[exclusive] = result[key];
|
|
25053
|
-
delete result[key];
|
|
25054
|
-
} else delete result[exclusive];
|
|
25055
|
-
}
|
|
25056
|
-
}
|
|
25057
|
-
return result;
|
|
25058
|
-
}
|
|
25059
|
-
let converted = convert(schemaValue);
|
|
25060
|
-
if (typeof converted == "object" && converted != null && typeof object(converted).$ref == "string") {
|
|
25061
|
-
const id = String(object(converted).$ref).slice(8);
|
|
25062
|
-
const { $ref: _ref, ...siblings } = object(converted);
|
|
25063
|
-
converted = {
|
|
25064
|
-
...object(defs[id]),
|
|
25065
|
-
...siblings
|
|
25066
|
-
};
|
|
25067
|
-
}
|
|
25068
|
-
if (typeof converted == "boolean") return converted;
|
|
25069
|
-
return {
|
|
25070
|
-
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
25071
|
-
...object(converted),
|
|
25072
|
-
...Object.keys(defs).length ? { $defs: defs } : {}
|
|
25073
|
-
};
|
|
25074
|
-
}
|
|
25075
|
-
function parameters(config) {
|
|
25076
|
-
const doc = parseOpenApi(config.document);
|
|
25077
|
-
const { item, op } = operation(doc, config.path, config.method);
|
|
25078
|
-
const entries = /* @__PURE__ */ new Map();
|
|
25079
|
-
for (const value of [...item.parameters ?? [], ...op.parameters ?? []]) {
|
|
25080
|
-
const p = resolved(doc, value);
|
|
25081
|
-
if (![
|
|
25082
|
-
"path",
|
|
25083
|
-
"query",
|
|
25084
|
-
"header"
|
|
25085
|
-
].includes(String(p.in)) || typeof p.name != "string" || p.content != null) throw new Error("Only schema-based path, query and header parameters are supported.");
|
|
25086
|
-
if (p.allowReserved === true) throw new Error("allowReserved parameters are unsupported.");
|
|
25087
|
-
if ((p.style ?? (p.in == "query" ? "form" : "simple")) != (p.in == "query" ? "form" : "simple")) throw new Error("Only form query and simple path/header serialization are supported.");
|
|
25088
|
-
entries.set(`${p.in}.${p.in == "header" ? p.name.toLowerCase() : p.name}`, p);
|
|
25089
|
-
}
|
|
25090
|
-
return [...entries.values()];
|
|
25091
|
-
}
|
|
25092
|
-
function jsonContent(doc, value) {
|
|
25093
|
-
const content = resolved(doc, value);
|
|
25094
|
-
const media = object(content.content);
|
|
25095
|
-
const mediaType = media["application/json"] != null ? "application/json" : Object.keys(media).find((key) => /^application\/.+\+json$/.test(key));
|
|
25096
|
-
const json = mediaType == null ? void 0 : media[mediaType];
|
|
25097
|
-
if (json == null) throw new Error("Only JSON request and response bodies are supported.");
|
|
25098
|
-
return {
|
|
25099
|
-
schema: schema$1(doc, object(json).schema ?? {}),
|
|
25100
|
-
required: content.required === true,
|
|
25101
|
-
mediaType
|
|
25102
|
-
};
|
|
25103
|
-
}
|
|
25104
|
-
function authHandles(auth) {
|
|
25105
|
-
return auth.flatMap((scheme) => scheme.type == "basic" ? [`auth.${scheme.id}.username`, `auth.${scheme.id}.password`] : [`auth.${scheme.id}.token`]);
|
|
25106
|
-
}
|
|
25107
|
-
function openApiTask(config, name = "OpenAPI") {
|
|
25108
|
-
if (!config.path) return {
|
|
25109
|
-
name,
|
|
25110
|
-
executor: config,
|
|
25111
|
-
inputs: [],
|
|
25112
|
-
outputs: []
|
|
25113
|
-
};
|
|
25114
|
-
const doc = parseOpenApi(config.document);
|
|
25115
|
-
const { op } = operation(doc, config.path, config.method);
|
|
25116
|
-
const params = parameters(config);
|
|
25117
|
-
const inputs = params.map((p) => {
|
|
25118
|
-
const jsonSchema = schema$1(doc, p.schema ?? {});
|
|
25119
|
-
const defaultValue = typeof jsonSchema == "boolean" ? void 0 : object(jsonSchema).default;
|
|
25120
|
-
return {
|
|
25121
|
-
handle: `${p.in}.${p.name}`,
|
|
25122
|
-
jsonSchema,
|
|
25123
|
-
nullable: p.required !== true && p.in != "path" || matchesSchema(null, jsonSchema),
|
|
25124
|
-
...typeof p.description == "string" ? { description: p.description } : {},
|
|
25125
|
-
...defaultValue === void 0 ? {} : { value: defaultValue }
|
|
25126
|
-
};
|
|
25127
|
-
});
|
|
25128
|
-
if (op.requestBody != null) {
|
|
25129
|
-
if (config.method == "get" || config.method == "head") throw new Error("GET and HEAD request bodies are unsupported.");
|
|
25130
|
-
const body = jsonContent(doc, op.requestBody);
|
|
25131
|
-
inputs.push({
|
|
25132
|
-
handle: "body",
|
|
25133
|
-
jsonSchema: body.schema,
|
|
25134
|
-
nullable: !body.required || matchesSchema(null, body.schema)
|
|
25135
|
-
});
|
|
25136
|
-
}
|
|
25137
|
-
const occupied = new Set(params.map((p) => `${p.in}.${p.in == "header" ? String(p.name).toLowerCase() : p.name}`));
|
|
25138
|
-
for (const auth of config.auth) {
|
|
25139
|
-
const location = auth.type == "apiKey" ? `${auth.in}.${auth.in == "header" ? auth.name?.toLowerCase() : auth.name}` : "header.authorization";
|
|
25140
|
-
if (occupied.has(location)) throw new Error("Authentication conflicts with a parameter or another security scheme.");
|
|
25141
|
-
if (auth.type == "apiKey" && (!auth.name || !["header", "query"].includes(auth.in ?? ""))) throw new Error("API Key requires a name and location.");
|
|
25142
|
-
occupied.add(location);
|
|
25143
|
-
}
|
|
25144
|
-
inputs.push(...authHandles(config.auth).map((handle) => ({
|
|
25145
|
-
handle,
|
|
25146
|
-
jsonSchema: { type: "string" },
|
|
25147
|
-
nullable: false
|
|
25148
|
-
})));
|
|
25149
|
-
const responses = object(op.responses);
|
|
25150
|
-
const schemas = [];
|
|
25151
|
-
for (const [status, response] of Object.entries(responses)) if (/^2\d\d$|^2XX$/.test(status) || status == "default") {
|
|
25152
|
-
const r = resolved(doc, response);
|
|
25153
|
-
if (r.content == null) schemas.push({ type: "null" });
|
|
25154
|
-
else {
|
|
25155
|
-
jsonContent(doc, r);
|
|
25156
|
-
for (const [mediaType, media] of Object.entries(object(r.content))) if (/^application\/(json|.+\+json)$/.test(mediaType)) schemas.push(schema$1(doc, object(media).schema ?? {}));
|
|
25157
|
-
}
|
|
25158
|
-
}
|
|
25159
|
-
if (!schemas.length) throw new Error("A successful JSON response definition is required.");
|
|
25160
|
-
return {
|
|
25161
|
-
name,
|
|
25162
|
-
executor: config,
|
|
25163
|
-
inputs,
|
|
25164
|
-
outputs: [
|
|
25165
|
-
{
|
|
25166
|
-
handle: "body",
|
|
25167
|
-
jsonSchema: schemas.length == 1 ? schemas[0] : {
|
|
25168
|
-
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
25169
|
-
anyOf: schemas.map((s, index) => inlineSchema(s, index))
|
|
25170
|
-
},
|
|
25171
|
-
nullable: config.method == "head" || schemas.some((item) => matchesSchema(null, item))
|
|
25172
|
-
},
|
|
25173
|
-
{
|
|
25174
|
-
handle: "statusCode",
|
|
25175
|
-
jsonSchema: { type: "integer" },
|
|
25176
|
-
nullable: false
|
|
25177
|
-
},
|
|
25178
|
-
{
|
|
25179
|
-
handle: "headers",
|
|
25180
|
-
jsonSchema: {
|
|
25181
|
-
type: "object",
|
|
25182
|
-
additionalProperties: { type: "string" }
|
|
25183
|
-
},
|
|
25184
|
-
nullable: false
|
|
25185
|
-
}
|
|
25186
|
-
]
|
|
25187
|
-
};
|
|
25188
|
-
}
|
|
25189
|
-
function inlineSchema(value, index) {
|
|
25190
|
-
if (Array.isArray(value)) return value.map((item) => inlineSchema(item, index));
|
|
25191
|
-
if (value == null || typeof value != "object") return value;
|
|
25192
|
-
return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, key == "$ref" && typeof child == "string" && child.startsWith("#/") ? `#/anyOf/${index}/${child.slice(2)}` : inlineSchema(child, index)]));
|
|
25193
|
-
}
|
|
25194
|
-
/** The canvas validator and property panel share the same configuration contract. */
|
|
25195
|
-
function openApiFieldIssues(task) {
|
|
25196
|
-
if (task.executor.kind != "openapi") return [];
|
|
25197
|
-
const config = task.executor;
|
|
25198
|
-
let field = "sourceUrl";
|
|
25199
|
-
try {
|
|
25200
|
-
if (!config.sourceUrl.trim()) return [{
|
|
25201
|
-
field,
|
|
25202
|
-
message: "Enter an OpenAPI JSON document URL."
|
|
25203
|
-
}];
|
|
25204
|
-
httpUrl(config.sourceUrl);
|
|
25205
|
-
field = "operation";
|
|
25206
|
-
if (!config.path) return [{
|
|
25207
|
-
field,
|
|
25208
|
-
message: "Select an OpenAPI operation."
|
|
25209
|
-
}];
|
|
25210
|
-
field = "serverUrl";
|
|
25211
|
-
httpUrl(config.serverUrl);
|
|
25212
|
-
if (new URL(config.serverUrl).search) throw new Error("Server URLs must not contain a query string.");
|
|
25213
|
-
field = "operation";
|
|
25214
|
-
if (!dequal(config.document, snapshot(config.document, config.path, config.method))) return [{
|
|
25215
|
-
field,
|
|
25216
|
-
message: "Save only the selected operation and its dependencies."
|
|
25217
|
-
}];
|
|
25218
|
-
const expected = openApiTask(config, task.name);
|
|
25219
|
-
if (!dequal(expected.inputs, task.inputs) || !dequal(expected.outputs, task.outputs)) return [{
|
|
25220
|
-
field,
|
|
25221
|
-
message: "OpenAPI ports must match the saved operation."
|
|
25222
|
-
}];
|
|
25223
|
-
return [];
|
|
25224
|
-
} catch (error) {
|
|
25225
|
-
return [{
|
|
25226
|
-
field,
|
|
25227
|
-
message: error.message
|
|
25228
|
-
}];
|
|
25229
|
-
}
|
|
25230
|
-
}
|
|
25231
|
-
function selectOperation(value, sourceUrl, path, method) {
|
|
25232
|
-
const doc = snapshot(value, path, method);
|
|
25233
|
-
const choices = securityOptions(doc, path, method);
|
|
25234
|
-
const auth = choices.find((choice) => choice.auth != null)?.auth;
|
|
25235
|
-
if (auth == null) throw new Error(choices[0]?.error ?? "Unsupported authentication.");
|
|
25236
|
-
const config = {
|
|
25237
|
-
kind: "openapi",
|
|
25238
|
-
sourceUrl: httpUrl(sourceUrl),
|
|
25239
|
-
method,
|
|
25240
|
-
path,
|
|
25241
|
-
serverUrl: serverAddress(servers(doc, path, method)[0], sourceUrl),
|
|
25242
|
-
document: doc,
|
|
25243
|
-
auth
|
|
25244
|
-
};
|
|
25245
|
-
openApiTask(config);
|
|
25246
|
-
return config;
|
|
25247
|
-
}
|
|
25248
|
-
//#endregion
|
|
25249
25615
|
//#region src/flow/common/promptTemplate.ts
|
|
25250
25616
|
var promptReferencePattern = /\{\{\s*([^{}\s]+)\s*\}\}/g;
|
|
25251
25617
|
function renamePromptInput(template, before, after) {
|
|
@@ -25297,7 +25663,7 @@ var schema = lazy$1(() => union([boolean(), strictObject({
|
|
|
25297
25663
|
"object",
|
|
25298
25664
|
"string"
|
|
25299
25665
|
])).min(1)]).optional(),
|
|
25300
|
-
const: json$
|
|
25666
|
+
const: json$2().optional(),
|
|
25301
25667
|
allOf: array(schema).min(1).optional(),
|
|
25302
25668
|
anyOf: array(schema).min(1).optional(),
|
|
25303
25669
|
oneOf: array(schema).min(1).optional(),
|
|
@@ -25346,13 +25712,13 @@ var schema = lazy$1(() => union([boolean(), strictObject({
|
|
|
25346
25712
|
unevaluatedProperties: schema.optional(),
|
|
25347
25713
|
description: string$1().optional(),
|
|
25348
25714
|
title: string$1().optional(),
|
|
25349
|
-
default: json$
|
|
25350
|
-
examples: array(json$
|
|
25715
|
+
default: json$2().optional(),
|
|
25716
|
+
examples: array(json$2()).optional(),
|
|
25351
25717
|
readOnly: boolean().optional(),
|
|
25352
25718
|
writeOnly: boolean().optional(),
|
|
25353
25719
|
deprecated: boolean().optional(),
|
|
25354
25720
|
$comment: string$1().optional(),
|
|
25355
|
-
enum: array(json$
|
|
25721
|
+
enum: array(json$2()).min(1).optional(),
|
|
25356
25722
|
properties: record$2(string$1(), schema).optional(),
|
|
25357
25723
|
required: array(string$1()).optional(),
|
|
25358
25724
|
additionalProperties: schema.optional(),
|
|
@@ -25368,6 +25734,107 @@ var schema = lazy$1(() => union([boolean(), strictObject({
|
|
|
25368
25734
|
}).transform(({ title: _title, default: _default, examples: _examples, readOnly: _readOnly, writeOnly: _writeOnly, deprecated: _deprecated, $comment: _comment, ...value }) => value)]));
|
|
25369
25735
|
//#endregion
|
|
25370
25736
|
//#region src/flow/common/semantics.ts
|
|
25737
|
+
function entries(value) {
|
|
25738
|
+
return Object.keys(value).toSorted().map((key) => [key, value[key]]);
|
|
25739
|
+
}
|
|
25740
|
+
function flowDependencies(content, triggerId) {
|
|
25741
|
+
if (triggerId != null) return flowDependencies(runRevision(content, triggerId));
|
|
25742
|
+
const bindings = /* @__PURE__ */ new Set();
|
|
25743
|
+
const modules = /* @__PURE__ */ new Set();
|
|
25744
|
+
function visitModule(id) {
|
|
25745
|
+
if (modules.has(id)) return;
|
|
25746
|
+
modules.add(id);
|
|
25747
|
+
const module = content.modules[id];
|
|
25748
|
+
if (module == null) return;
|
|
25749
|
+
for (const imported of module.imports.toSorted()) visitModule(imported);
|
|
25750
|
+
}
|
|
25751
|
+
function visitInputMappings(value) {
|
|
25752
|
+
for (const mapping of Object.values(value)) {
|
|
25753
|
+
if (mapping.kind != "sources") continue;
|
|
25754
|
+
for (const source of mapping.sources) {
|
|
25755
|
+
if (source.kind != "binding") continue;
|
|
25756
|
+
bindings.add(source.bindingId);
|
|
25757
|
+
}
|
|
25758
|
+
}
|
|
25759
|
+
}
|
|
25760
|
+
function visitGraph(value) {
|
|
25761
|
+
for (const [, node] of entries(value.nodes)) {
|
|
25762
|
+
if ("inputs" in node) visitInputMappings(nodeInputMappings(node));
|
|
25763
|
+
switch (node.kind) {
|
|
25764
|
+
case "condition": break;
|
|
25765
|
+
case "task": if ("moduleId" in node.task) visitModule(node.task.moduleId);
|
|
25766
|
+
}
|
|
25767
|
+
}
|
|
25768
|
+
}
|
|
25769
|
+
visitGraph(content.document.graph);
|
|
25770
|
+
return {
|
|
25771
|
+
bindings,
|
|
25772
|
+
modules,
|
|
25773
|
+
nodes: new Set(Object.keys(content.document.graph.nodes))
|
|
25774
|
+
};
|
|
25775
|
+
}
|
|
25776
|
+
function variableBindings(revision, bindingIds) {
|
|
25777
|
+
return Object.fromEntries([...bindingIds].flatMap((bindingId) => {
|
|
25778
|
+
const binding = revision.document.bindings[bindingId];
|
|
25779
|
+
return binding?.kind == "variable" ? [[bindingId, binding.target]] : [];
|
|
25780
|
+
}));
|
|
25781
|
+
}
|
|
25782
|
+
function flowResourceReferences(content) {
|
|
25783
|
+
const connections = /* @__PURE__ */ new Map();
|
|
25784
|
+
for (const use of connectionUsage(content.document)) {
|
|
25785
|
+
if (use.connectionId == null) continue;
|
|
25786
|
+
connections.set(JSON.stringify([use.providerId, use.connectionId]), {
|
|
25787
|
+
providerId: use.providerId,
|
|
25788
|
+
connectionId: use.connectionId
|
|
25789
|
+
});
|
|
25790
|
+
}
|
|
25791
|
+
return {
|
|
25792
|
+
variableNames: [...new Set(Object.values(variableBindings(content, flowDependencies(content).bindings)))].toSorted(),
|
|
25793
|
+
connections: [...connections].toSorted(([left], [right]) => left < right ? -1 : left > right ? 1 : 0).map(([, value]) => value),
|
|
25794
|
+
errorSourceFlowIds: [...new Set(Object.values(content.document.graph.nodes).flatMap((node) => node.kind == "error" ? node.sourceFlowIds ?? [] : []))].toSorted()
|
|
25795
|
+
};
|
|
25796
|
+
}
|
|
25797
|
+
function runRevision(revision, triggerId) {
|
|
25798
|
+
const graph = revision.document.graph;
|
|
25799
|
+
const reachable = /* @__PURE__ */ new Set([triggerId]);
|
|
25800
|
+
for (const nodeId of reachable) for (const edge of graph.edges) if (edge.source == nodeId) reachable.add(edge.target);
|
|
25801
|
+
function inputs(nodeId, mappings) {
|
|
25802
|
+
const ancestors = /* @__PURE__ */ new Set();
|
|
25803
|
+
for (const edge of graph.edges) if (edge.target == nodeId) ancestors.add(edge.source);
|
|
25804
|
+
for (const ancestor of ancestors) for (const edge of graph.edges) if (edge.target == ancestor) ancestors.add(edge.source);
|
|
25805
|
+
return Object.fromEntries(Object.entries(mappings).map(([handle, mapping]) => [handle, mapping.kind != "sources" ? mapping : {
|
|
25806
|
+
...mapping,
|
|
25807
|
+
sources: mapping.sources.filter((source) => source.kind != "node" || graph.nodes[source.nodeId] == null || reachable.has(source.nodeId) || !ancestors.has(source.nodeId))
|
|
25808
|
+
}]));
|
|
25809
|
+
}
|
|
25810
|
+
const nodes = {};
|
|
25811
|
+
for (const nodeId of reachable) {
|
|
25812
|
+
const node = graph.nodes[nodeId];
|
|
25813
|
+
if (node == null) continue;
|
|
25814
|
+
nodes[nodeId] = !("inputs" in node) ? node : {
|
|
25815
|
+
...node,
|
|
25816
|
+
inputs: inputs(nodeId, node.inputs)
|
|
25817
|
+
};
|
|
25818
|
+
}
|
|
25819
|
+
const content = {
|
|
25820
|
+
...revision,
|
|
25821
|
+
document: {
|
|
25822
|
+
...revision.document,
|
|
25823
|
+
graph: {
|
|
25824
|
+
nodes,
|
|
25825
|
+
edges: graph.edges.filter((edge) => reachable.has(edge.source))
|
|
25826
|
+
}
|
|
25827
|
+
}
|
|
25828
|
+
};
|
|
25829
|
+
const { bindings } = flowDependencies(content);
|
|
25830
|
+
return {
|
|
25831
|
+
...content,
|
|
25832
|
+
document: {
|
|
25833
|
+
...content.document,
|
|
25834
|
+
bindings: Object.fromEntries(Object.entries(content.document.bindings).filter(([id]) => bindings.has(id)))
|
|
25835
|
+
}
|
|
25836
|
+
};
|
|
25837
|
+
}
|
|
25371
25838
|
function agentActions(flow) {
|
|
25372
25839
|
return Object.values(flow.graph.nodes).flatMap((node) => {
|
|
25373
25840
|
if (node.kind != "task" || !("executor" in node.task)) return [];
|
|
@@ -36786,4 +37253,4 @@ function replaceTaskPorts(revision, nodeId, task, values) {
|
|
|
36786
37253
|
return changes;
|
|
36787
37254
|
}
|
|
36788
37255
|
//#endregion
|
|
36789
|
-
export { RunStore as $,
|
|
37256
|
+
export { RunStore as $, EventSourcesPage as $t, datePickerValue as A, providerIconAppearance as An, followWorkbenchLink as At, CacheResource as B, invalidResponse as Bn, ScrollArea as Bt, valueForEditor as C, sampleErrorOutputs as Cn, setCodeActions as Ct, calendarChange as D, triggerConfigValues as Dn, updateTriggerConfig as Dt, typeOfSchema as E, triggerConfigValue as En, setTriggerConnection as Et, feishuResourceKind as F, securityOptions as Fn, PopoverHeader as Ft, semanticNodeIcon as G, controlErrorCode as Gn, InputGroupAddon as Gt, resourceData as H, record$1 as Hn, Z as Ht, supportsFeishuChatFilter as I, selectOperation as In, PopoverPanelContent as It, providerIcon as J, EmptyContent as Jt, triggerNodeIcon as K, Checkbox as Kn, InputGroupInput as Kt, combineSources as L, serverAddress as Ln, PopoverTitle as Lt, addNodeIntent as M, object as Mn, Popover as Mt, deriveAddNodeOptions as N, openApiFieldIssues as Nn, PopoverContent as Nt, calendarDate as O, connection as On, updateTriggerSchedule as Ot, indexAddNodeOptions as P, openApiTask as Pn, PopoverDescription as Pt, useIconifyData as Q, EmptyTitle as Qt, mapSource as R, servers as Rn, PopoverTrigger as Rt, schemaForEditor as S, sourceOutputLabel as Sn, resetInputValues as St, isUnconstrainedSchema as T, isJsonObject as Tn, setInputSources as Tt, resourceValue as U, string as Un, useTriggerFocusGuards as Ut, observeResource as V, jsonValue as Vn, VirtualScrollArea as Vt, designerGraph as W, ApiError as Wn, InputGroup as Wt, IconifyProvider as X, EmptyHeader as Xt, ContentIcon as Y, EmptyDescription as Yt, useIconifyCollectionLoader as Z, EmptyMedia as Zt, updateValue as _, randomId as _n, setComment as _t, nameCreatedNodes as a, zh_TW_default$3 as an, deriveInspectorDiagnostics as at, editorComponent as b, decodeTriggerCatalog as bn, setNodePositions as bt, updateCondition as c, ko_default$3 as cn, diagnosticNodeId as ct, updateNodeName as d, en_default$3 as dn, connectionCatalog as dt, SourceForm as en, canCancelRun as et, updateNodeSettings as f, I18n as fn, canvasPresentationChange as ft, updateTaskPorts as g, WorkbenchClient as gn, restoreCanvasPresentation as gt, updateTaskAdditionalInputs as h, errorNotice as hn, removeComments as ht, deleteSelection as i, waitBranchDescription as in, Latest as it, isDateFormat as j, listOperations as jn, Switch as jt, datePickerChange as k, connectorActionMetadata as kn, IdTooltip as kt, updateNodeDescription as l, ja_default$3 as ln, schemaMismatchMessage as lt, updateTask as m, EventSourceSetup as mn, flowPresentation as mt, agentTool as n, createI18n as nn, revisionView as nt, setInputValue as o, zh_CN_default$3 as on, diagnosticItems as ot, updateResolution as p, FeishuEventPicker as pn, commentIds as pt, actionSummary as q, IconThemeContext as qn, Empty as qt, applyFlowChanges as r, uiLocales as rn, flowResourceReferences as rt, setInputVariable as s, ru_default$3 as sn, diagnosticMessage as st, addNode as t, SourceSelect as tn, hasRunFilter as tt, updateNodeIcon as u, fr_default$3 as un, actionWithConnections as ut, updateWebhook as v, allConnectorConnectionsQuery as vn, setFlowViewport as vt, getDefaultValue as w, triggerOutputDefinitions as wn, setConnectorConnection as wt, editorGroups as x, resolutionOutputPorts as xn, repairNodeNames as xt, defaultValueEditorSchema as y, decodeResultList as yn, setNodeContentHidden as yt, scopedValue as z, inputValue as zn, NativeScrollArea as zt };
|