@synergenius/flow-weaver 0.17.15 → 0.19.1
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/cli/flow-weaver.mjs +819 -301
- package/dist/cli/index.js +9 -2
- package/dist/cli/pack-commands.d.ts +13 -0
- package/dist/cli/pack-commands.js +75 -0
- package/dist/diagram/geometry.js +101 -11
- package/dist/diagram/html-viewer.js +377 -39
- package/dist/generated-version.d.ts +1 -1
- package/dist/generated-version.js +1 -1
- package/dist/marketplace/index.d.ts +1 -1
- package/dist/marketplace/types.d.ts +30 -0
- package/dist/mcp/pack-tools.d.ts +9 -0
- package/dist/mcp/pack-tools.js +36 -0
- package/dist/mcp/server.js +2 -0
- package/package.json +1 -1
package/dist/cli/flow-weaver.mjs
CHANGED
|
@@ -935,7 +935,7 @@ var require_command = __commonJS({
|
|
|
935
935
|
"node_modules/commander/lib/command.js"(exports2) {
|
|
936
936
|
var EventEmitter2 = __require("events").EventEmitter;
|
|
937
937
|
var childProcess = __require("child_process");
|
|
938
|
-
var
|
|
938
|
+
var path56 = __require("path");
|
|
939
939
|
var fs53 = __require("fs");
|
|
940
940
|
var process6 = __require("process");
|
|
941
941
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
@@ -1759,9 +1759,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1759
1759
|
let launchWithNode = false;
|
|
1760
1760
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1761
1761
|
function findFile(baseDir, baseName) {
|
|
1762
|
-
const localBin =
|
|
1762
|
+
const localBin = path56.resolve(baseDir, baseName);
|
|
1763
1763
|
if (fs53.existsSync(localBin)) return localBin;
|
|
1764
|
-
if (sourceExt.includes(
|
|
1764
|
+
if (sourceExt.includes(path56.extname(baseName))) return void 0;
|
|
1765
1765
|
const foundExt = sourceExt.find((ext2) => fs53.existsSync(`${localBin}${ext2}`));
|
|
1766
1766
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
1767
1767
|
return void 0;
|
|
@@ -1777,19 +1777,19 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1777
1777
|
} catch (err) {
|
|
1778
1778
|
resolvedScriptPath = this._scriptPath;
|
|
1779
1779
|
}
|
|
1780
|
-
executableDir =
|
|
1780
|
+
executableDir = path56.resolve(path56.dirname(resolvedScriptPath), executableDir);
|
|
1781
1781
|
}
|
|
1782
1782
|
if (executableDir) {
|
|
1783
1783
|
let localFile = findFile(executableDir, executableFile);
|
|
1784
1784
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
1785
|
-
const legacyName =
|
|
1785
|
+
const legacyName = path56.basename(this._scriptPath, path56.extname(this._scriptPath));
|
|
1786
1786
|
if (legacyName !== this._name) {
|
|
1787
1787
|
localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
|
|
1788
1788
|
}
|
|
1789
1789
|
}
|
|
1790
1790
|
executableFile = localFile || executableFile;
|
|
1791
1791
|
}
|
|
1792
|
-
launchWithNode = sourceExt.includes(
|
|
1792
|
+
launchWithNode = sourceExt.includes(path56.extname(executableFile));
|
|
1793
1793
|
let proc2;
|
|
1794
1794
|
if (process6.platform !== "win32") {
|
|
1795
1795
|
if (launchWithNode) {
|
|
@@ -2572,7 +2572,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2572
2572
|
* @return {Command}
|
|
2573
2573
|
*/
|
|
2574
2574
|
nameFromFilename(filename) {
|
|
2575
|
-
this._name =
|
|
2575
|
+
this._name = path56.basename(filename, path56.extname(filename));
|
|
2576
2576
|
return this;
|
|
2577
2577
|
}
|
|
2578
2578
|
/**
|
|
@@ -2586,9 +2586,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2586
2586
|
* @param {string} [path]
|
|
2587
2587
|
* @return {string|null|Command}
|
|
2588
2588
|
*/
|
|
2589
|
-
executableDir(
|
|
2590
|
-
if (
|
|
2591
|
-
this._executableDir =
|
|
2589
|
+
executableDir(path57) {
|
|
2590
|
+
if (path57 === void 0) return this._executableDir;
|
|
2591
|
+
this._executableDir = path57;
|
|
2592
2592
|
return this;
|
|
2593
2593
|
}
|
|
2594
2594
|
/**
|
|
@@ -7088,12 +7088,12 @@ var init_esm4 = __esm({
|
|
|
7088
7088
|
/**
|
|
7089
7089
|
* Get the Path object referenced by the string path, resolved from this Path
|
|
7090
7090
|
*/
|
|
7091
|
-
resolve(
|
|
7092
|
-
if (!
|
|
7091
|
+
resolve(path56) {
|
|
7092
|
+
if (!path56) {
|
|
7093
7093
|
return this;
|
|
7094
7094
|
}
|
|
7095
|
-
const rootPath = this.getRootString(
|
|
7096
|
-
const dir =
|
|
7095
|
+
const rootPath = this.getRootString(path56);
|
|
7096
|
+
const dir = path56.substring(rootPath.length);
|
|
7097
7097
|
const dirParts = dir.split(this.splitSep);
|
|
7098
7098
|
const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
|
|
7099
7099
|
return result;
|
|
@@ -7845,8 +7845,8 @@ var init_esm4 = __esm({
|
|
|
7845
7845
|
/**
|
|
7846
7846
|
* @internal
|
|
7847
7847
|
*/
|
|
7848
|
-
getRootString(
|
|
7849
|
-
return win32.parse(
|
|
7848
|
+
getRootString(path56) {
|
|
7849
|
+
return win32.parse(path56).root;
|
|
7850
7850
|
}
|
|
7851
7851
|
/**
|
|
7852
7852
|
* @internal
|
|
@@ -7892,8 +7892,8 @@ var init_esm4 = __esm({
|
|
|
7892
7892
|
/**
|
|
7893
7893
|
* @internal
|
|
7894
7894
|
*/
|
|
7895
|
-
getRootString(
|
|
7896
|
-
return
|
|
7895
|
+
getRootString(path56) {
|
|
7896
|
+
return path56.startsWith("/") ? "/" : "";
|
|
7897
7897
|
}
|
|
7898
7898
|
/**
|
|
7899
7899
|
* @internal
|
|
@@ -7982,11 +7982,11 @@ var init_esm4 = __esm({
|
|
|
7982
7982
|
/**
|
|
7983
7983
|
* Get the depth of a provided path, string, or the cwd
|
|
7984
7984
|
*/
|
|
7985
|
-
depth(
|
|
7986
|
-
if (typeof
|
|
7987
|
-
|
|
7985
|
+
depth(path56 = this.cwd) {
|
|
7986
|
+
if (typeof path56 === "string") {
|
|
7987
|
+
path56 = this.cwd.resolve(path56);
|
|
7988
7988
|
}
|
|
7989
|
-
return
|
|
7989
|
+
return path56.depth();
|
|
7990
7990
|
}
|
|
7991
7991
|
/**
|
|
7992
7992
|
* Return the cache of child entries. Exposed so subclasses can create
|
|
@@ -8473,9 +8473,9 @@ var init_esm4 = __esm({
|
|
|
8473
8473
|
process6();
|
|
8474
8474
|
return results;
|
|
8475
8475
|
}
|
|
8476
|
-
chdir(
|
|
8476
|
+
chdir(path56 = this.cwd) {
|
|
8477
8477
|
const oldCwd = this.cwd;
|
|
8478
|
-
this.cwd = typeof
|
|
8478
|
+
this.cwd = typeof path56 === "string" ? this.cwd.resolve(path56) : path56;
|
|
8479
8479
|
this.cwd[setAsCwd](oldCwd);
|
|
8480
8480
|
}
|
|
8481
8481
|
};
|
|
@@ -8850,8 +8850,8 @@ var init_processor = __esm({
|
|
|
8850
8850
|
}
|
|
8851
8851
|
// match, absolute, ifdir
|
|
8852
8852
|
entries() {
|
|
8853
|
-
return [...this.store.entries()].map(([
|
|
8854
|
-
|
|
8853
|
+
return [...this.store.entries()].map(([path56, n]) => [
|
|
8854
|
+
path56,
|
|
8855
8855
|
!!(n & 2),
|
|
8856
8856
|
!!(n & 1)
|
|
8857
8857
|
]);
|
|
@@ -9064,9 +9064,9 @@ var init_walker = __esm({
|
|
|
9064
9064
|
signal;
|
|
9065
9065
|
maxDepth;
|
|
9066
9066
|
includeChildMatches;
|
|
9067
|
-
constructor(patterns,
|
|
9067
|
+
constructor(patterns, path56, opts) {
|
|
9068
9068
|
this.patterns = patterns;
|
|
9069
|
-
this.path =
|
|
9069
|
+
this.path = path56;
|
|
9070
9070
|
this.opts = opts;
|
|
9071
9071
|
this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
|
|
9072
9072
|
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
@@ -9085,11 +9085,11 @@ var init_walker = __esm({
|
|
|
9085
9085
|
});
|
|
9086
9086
|
}
|
|
9087
9087
|
}
|
|
9088
|
-
#ignored(
|
|
9089
|
-
return this.seen.has(
|
|
9088
|
+
#ignored(path56) {
|
|
9089
|
+
return this.seen.has(path56) || !!this.#ignore?.ignored?.(path56);
|
|
9090
9090
|
}
|
|
9091
|
-
#childrenIgnored(
|
|
9092
|
-
return !!this.#ignore?.childrenIgnored?.(
|
|
9091
|
+
#childrenIgnored(path56) {
|
|
9092
|
+
return !!this.#ignore?.childrenIgnored?.(path56);
|
|
9093
9093
|
}
|
|
9094
9094
|
// backpressure mechanism
|
|
9095
9095
|
pause() {
|
|
@@ -9304,8 +9304,8 @@ var init_walker = __esm({
|
|
|
9304
9304
|
};
|
|
9305
9305
|
GlobWalker = class extends GlobUtil {
|
|
9306
9306
|
matches = /* @__PURE__ */ new Set();
|
|
9307
|
-
constructor(patterns,
|
|
9308
|
-
super(patterns,
|
|
9307
|
+
constructor(patterns, path56, opts) {
|
|
9308
|
+
super(patterns, path56, opts);
|
|
9309
9309
|
}
|
|
9310
9310
|
matchEmit(e) {
|
|
9311
9311
|
this.matches.add(e);
|
|
@@ -9342,8 +9342,8 @@ var init_walker = __esm({
|
|
|
9342
9342
|
};
|
|
9343
9343
|
GlobStream = class extends GlobUtil {
|
|
9344
9344
|
results;
|
|
9345
|
-
constructor(patterns,
|
|
9346
|
-
super(patterns,
|
|
9345
|
+
constructor(patterns, path56, opts) {
|
|
9346
|
+
super(patterns, path56, opts);
|
|
9347
9347
|
this.results = new Minipass({
|
|
9348
9348
|
signal: this.signal,
|
|
9349
9349
|
objectMode: true
|
|
@@ -9671,7 +9671,7 @@ var VERSION;
|
|
|
9671
9671
|
var init_generated_version = __esm({
|
|
9672
9672
|
"src/generated-version.ts"() {
|
|
9673
9673
|
"use strict";
|
|
9674
|
-
VERSION = "0.
|
|
9674
|
+
VERSION = "0.19.1";
|
|
9675
9675
|
}
|
|
9676
9676
|
});
|
|
9677
9677
|
|
|
@@ -12783,7 +12783,7 @@ var require_util = __commonJS({
|
|
|
12783
12783
|
var normalize2 = createSafeHandler((url2) => {
|
|
12784
12784
|
});
|
|
12785
12785
|
exports2.normalize = normalize2;
|
|
12786
|
-
function
|
|
12786
|
+
function join29(aRoot, aPath) {
|
|
12787
12787
|
const pathType = getURLType(aPath);
|
|
12788
12788
|
const rootType = getURLType(aRoot);
|
|
12789
12789
|
aRoot = ensureDirectory(aRoot);
|
|
@@ -12813,7 +12813,7 @@ var require_util = __commonJS({
|
|
|
12813
12813
|
const newPath = withBase(aPath, withBase(aRoot, base));
|
|
12814
12814
|
return computeRelativeURL(base, newPath);
|
|
12815
12815
|
}
|
|
12816
|
-
exports2.join =
|
|
12816
|
+
exports2.join = join29;
|
|
12817
12817
|
function relative9(rootURL, targetURL) {
|
|
12818
12818
|
const result = relativeIfPossible(rootURL, targetURL);
|
|
12819
12819
|
return typeof result === "string" ? result : normalize2(targetURL);
|
|
@@ -12842,8 +12842,8 @@ var require_util = __commonJS({
|
|
|
12842
12842
|
sourceURL = sourceURL.replace(/^\//, "");
|
|
12843
12843
|
}
|
|
12844
12844
|
let url2 = normalize2(sourceURL || "");
|
|
12845
|
-
if (sourceRoot) url2 =
|
|
12846
|
-
if (sourceMapURL) url2 =
|
|
12845
|
+
if (sourceRoot) url2 = join29(sourceRoot, url2);
|
|
12846
|
+
if (sourceMapURL) url2 = join29(trimFilename(sourceMapURL), url2);
|
|
12847
12847
|
return url2;
|
|
12848
12848
|
}
|
|
12849
12849
|
exports2.computeSourceURL = computeSourceURL;
|
|
@@ -13395,10 +13395,10 @@ var require_read_wasm = __commonJS({
|
|
|
13395
13395
|
"node_modules/source-map/lib/read-wasm.js"(exports2, module2) {
|
|
13396
13396
|
"use strict";
|
|
13397
13397
|
var fs53 = __require("fs");
|
|
13398
|
-
var
|
|
13398
|
+
var path56 = __require("path");
|
|
13399
13399
|
module2.exports = function readWasm() {
|
|
13400
13400
|
return new Promise((resolve37, reject2) => {
|
|
13401
|
-
const wasmPath =
|
|
13401
|
+
const wasmPath = path56.join(__dirname, "mappings.wasm");
|
|
13402
13402
|
fs53.readFile(wasmPath, null, (error2, data) => {
|
|
13403
13403
|
if (error2) {
|
|
13404
13404
|
reject2(error2);
|
|
@@ -16273,7 +16273,7 @@ ${file}:${line}:${column}: ERROR: ${pluginText}${e.text}`;
|
|
|
16273
16273
|
}
|
|
16274
16274
|
var fs53 = __require("fs");
|
|
16275
16275
|
var os3 = __require("os");
|
|
16276
|
-
var
|
|
16276
|
+
var path56 = __require("path");
|
|
16277
16277
|
var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH;
|
|
16278
16278
|
var isValidBinaryPath = (x) => !!x && x !== "/usr/bin/esbuild";
|
|
16279
16279
|
var packageDarwin_arm64 = "@esbuild/darwin-arm64";
|
|
@@ -16332,19 +16332,19 @@ ${file}:${line}:${column}: ERROR: ${pluginText}${e.text}`;
|
|
|
16332
16332
|
}
|
|
16333
16333
|
function pkgForSomeOtherPlatform() {
|
|
16334
16334
|
const libMainJS = __require.resolve("esbuild");
|
|
16335
|
-
const nodeModulesDirectory =
|
|
16336
|
-
if (
|
|
16335
|
+
const nodeModulesDirectory = path56.dirname(path56.dirname(path56.dirname(libMainJS)));
|
|
16336
|
+
if (path56.basename(nodeModulesDirectory) === "node_modules") {
|
|
16337
16337
|
for (const unixKey in knownUnixlikePackages) {
|
|
16338
16338
|
try {
|
|
16339
16339
|
const pkg = knownUnixlikePackages[unixKey];
|
|
16340
|
-
if (fs53.existsSync(
|
|
16340
|
+
if (fs53.existsSync(path56.join(nodeModulesDirectory, pkg))) return pkg;
|
|
16341
16341
|
} catch {
|
|
16342
16342
|
}
|
|
16343
16343
|
}
|
|
16344
16344
|
for (const windowsKey in knownWindowsPackages) {
|
|
16345
16345
|
try {
|
|
16346
16346
|
const pkg = knownWindowsPackages[windowsKey];
|
|
16347
|
-
if (fs53.existsSync(
|
|
16347
|
+
if (fs53.existsSync(path56.join(nodeModulesDirectory, pkg))) return pkg;
|
|
16348
16348
|
} catch {
|
|
16349
16349
|
}
|
|
16350
16350
|
}
|
|
@@ -16352,8 +16352,8 @@ ${file}:${line}:${column}: ERROR: ${pluginText}${e.text}`;
|
|
|
16352
16352
|
return null;
|
|
16353
16353
|
}
|
|
16354
16354
|
function downloadedBinPath(pkg, subpath) {
|
|
16355
|
-
const esbuildLibDir =
|
|
16356
|
-
return
|
|
16355
|
+
const esbuildLibDir = path56.dirname(__require.resolve("esbuild"));
|
|
16356
|
+
return path56.join(esbuildLibDir, `downloaded-${pkg.replace("/", "-")}-${path56.basename(subpath)}`);
|
|
16357
16357
|
}
|
|
16358
16358
|
function generateBinPath() {
|
|
16359
16359
|
if (isValidBinaryPath(ESBUILD_BINARY_PATH)) {
|
|
@@ -16443,15 +16443,15 @@ for your current platform.`);
|
|
|
16443
16443
|
}
|
|
16444
16444
|
if (pnpapi) {
|
|
16445
16445
|
const root2 = pnpapi.getPackageInformation(pnpapi.topLevel).packageLocation;
|
|
16446
|
-
const binTargetPath =
|
|
16446
|
+
const binTargetPath = path56.join(
|
|
16447
16447
|
root2,
|
|
16448
16448
|
"node_modules",
|
|
16449
16449
|
".cache",
|
|
16450
16450
|
"esbuild",
|
|
16451
|
-
`pnpapi-${pkg.replace("/", "-")}-${"0.27.3"}-${
|
|
16451
|
+
`pnpapi-${pkg.replace("/", "-")}-${"0.27.3"}-${path56.basename(subpath)}`
|
|
16452
16452
|
);
|
|
16453
16453
|
if (!fs53.existsSync(binTargetPath)) {
|
|
16454
|
-
fs53.mkdirSync(
|
|
16454
|
+
fs53.mkdirSync(path56.dirname(binTargetPath), { recursive: true });
|
|
16455
16455
|
fs53.copyFileSync(binPath, binTargetPath);
|
|
16456
16456
|
fs53.chmodSync(binTargetPath, 493);
|
|
16457
16457
|
}
|
|
@@ -18055,9 +18055,9 @@ var init_port_tag_utils = __esm({
|
|
|
18055
18055
|
});
|
|
18056
18056
|
|
|
18057
18057
|
// src/sugar-optimizer.ts
|
|
18058
|
-
function validatePathMacro(
|
|
18058
|
+
function validatePathMacro(path56, connections, instances) {
|
|
18059
18059
|
const instanceIds = new Set(instances.map((inst) => inst.id));
|
|
18060
|
-
for (const step of
|
|
18060
|
+
for (const step of path56.steps) {
|
|
18061
18061
|
if (step.node === "Start" || step.node === "Exit") continue;
|
|
18062
18062
|
if (!instanceIds.has(step.node)) return false;
|
|
18063
18063
|
}
|
|
@@ -18067,9 +18067,9 @@ function validatePathMacro(path54, connections, instances) {
|
|
|
18067
18067
|
connKeys.add(`${conn.from.node}.${conn.from.port}->${conn.to.node}.${conn.to.port}`);
|
|
18068
18068
|
}
|
|
18069
18069
|
}
|
|
18070
|
-
for (let i = 0; i <
|
|
18071
|
-
const current2 =
|
|
18072
|
-
const next =
|
|
18070
|
+
for (let i = 0; i < path56.steps.length - 1; i++) {
|
|
18071
|
+
const current2 = path56.steps[i];
|
|
18072
|
+
const next = path56.steps[i + 1];
|
|
18073
18073
|
const route = current2.route || "ok";
|
|
18074
18074
|
let expectedKey;
|
|
18075
18075
|
if (current2.node === "Start") {
|
|
@@ -18173,12 +18173,12 @@ function detectSugarPatterns(connections, instances, existingMacros, nodeTypes,
|
|
|
18173
18173
|
}
|
|
18174
18174
|
const candidateRoutes = [];
|
|
18175
18175
|
const MAX_ROUTES = 20;
|
|
18176
|
-
function dfs(node,
|
|
18176
|
+
function dfs(node, path56, visited) {
|
|
18177
18177
|
if (candidateRoutes.length >= MAX_ROUTES) return;
|
|
18178
18178
|
if (node === "Exit") {
|
|
18179
|
-
|
|
18180
|
-
candidateRoutes.push([...
|
|
18181
|
-
|
|
18179
|
+
path56.push({ node: "Exit" });
|
|
18180
|
+
candidateRoutes.push([...path56]);
|
|
18181
|
+
path56.pop();
|
|
18182
18182
|
return;
|
|
18183
18183
|
}
|
|
18184
18184
|
if (visited.has(node)) return;
|
|
@@ -18190,15 +18190,15 @@ function detectSugarPatterns(connections, instances, existingMacros, nodeTypes,
|
|
|
18190
18190
|
}
|
|
18191
18191
|
if (edges.ok && !coveredByExistingMacro.has(edges.ok === "Exit" ? "" : edges.ok)) {
|
|
18192
18192
|
const step = node === "Start" ? { node: "Start" } : { node };
|
|
18193
|
-
|
|
18194
|
-
dfs(edges.ok,
|
|
18195
|
-
|
|
18193
|
+
path56.push(step);
|
|
18194
|
+
dfs(edges.ok, path56, visited);
|
|
18195
|
+
path56.pop();
|
|
18196
18196
|
}
|
|
18197
18197
|
if (edges.fail && !coveredByExistingMacro.has(edges.fail === "Exit" ? "" : edges.fail)) {
|
|
18198
18198
|
const step = { node, route: "fail" };
|
|
18199
|
-
|
|
18200
|
-
dfs(edges.fail,
|
|
18201
|
-
|
|
18199
|
+
path56.push(step);
|
|
18200
|
+
dfs(edges.fail, path56, visited);
|
|
18201
|
+
path56.pop();
|
|
18202
18202
|
}
|
|
18203
18203
|
visited.delete(node);
|
|
18204
18204
|
}
|
|
@@ -21787,11 +21787,11 @@ var init_toKey = __esm({
|
|
|
21787
21787
|
});
|
|
21788
21788
|
|
|
21789
21789
|
// node_modules/lodash-es/_baseGet.js
|
|
21790
|
-
function baseGet(object3,
|
|
21791
|
-
|
|
21792
|
-
var index = 0, length =
|
|
21790
|
+
function baseGet(object3, path56) {
|
|
21791
|
+
path56 = castPath_default(path56, object3);
|
|
21792
|
+
var index = 0, length = path56.length;
|
|
21793
21793
|
while (object3 != null && index < length) {
|
|
21794
|
-
object3 = object3[toKey_default(
|
|
21794
|
+
object3 = object3[toKey_default(path56[index++])];
|
|
21795
21795
|
}
|
|
21796
21796
|
return index && index == length ? object3 : void 0;
|
|
21797
21797
|
}
|
|
@@ -21805,8 +21805,8 @@ var init_baseGet = __esm({
|
|
|
21805
21805
|
});
|
|
21806
21806
|
|
|
21807
21807
|
// node_modules/lodash-es/get.js
|
|
21808
|
-
function get(object3,
|
|
21809
|
-
var result = object3 == null ? void 0 : baseGet_default(object3,
|
|
21808
|
+
function get(object3, path56, defaultValue) {
|
|
21809
|
+
var result = object3 == null ? void 0 : baseGet_default(object3, path56);
|
|
21810
21810
|
return result === void 0 ? defaultValue : result;
|
|
21811
21811
|
}
|
|
21812
21812
|
var get_default;
|
|
@@ -23169,11 +23169,11 @@ var init_baseHasIn = __esm({
|
|
|
23169
23169
|
});
|
|
23170
23170
|
|
|
23171
23171
|
// node_modules/lodash-es/_hasPath.js
|
|
23172
|
-
function hasPath(object3,
|
|
23173
|
-
|
|
23174
|
-
var index = -1, length =
|
|
23172
|
+
function hasPath(object3, path56, hasFunc) {
|
|
23173
|
+
path56 = castPath_default(path56, object3);
|
|
23174
|
+
var index = -1, length = path56.length, result = false;
|
|
23175
23175
|
while (++index < length) {
|
|
23176
|
-
var key = toKey_default(
|
|
23176
|
+
var key = toKey_default(path56[index]);
|
|
23177
23177
|
if (!(result = object3 != null && hasFunc(object3, key))) {
|
|
23178
23178
|
break;
|
|
23179
23179
|
}
|
|
@@ -23199,8 +23199,8 @@ var init_hasPath = __esm({
|
|
|
23199
23199
|
});
|
|
23200
23200
|
|
|
23201
23201
|
// node_modules/lodash-es/hasIn.js
|
|
23202
|
-
function hasIn(object3,
|
|
23203
|
-
return object3 != null && hasPath_default(object3,
|
|
23202
|
+
function hasIn(object3, path56) {
|
|
23203
|
+
return object3 != null && hasPath_default(object3, path56, baseHasIn_default);
|
|
23204
23204
|
}
|
|
23205
23205
|
var hasIn_default;
|
|
23206
23206
|
var init_hasIn = __esm({
|
|
@@ -23212,13 +23212,13 @@ var init_hasIn = __esm({
|
|
|
23212
23212
|
});
|
|
23213
23213
|
|
|
23214
23214
|
// node_modules/lodash-es/_baseMatchesProperty.js
|
|
23215
|
-
function baseMatchesProperty(
|
|
23216
|
-
if (isKey_default(
|
|
23217
|
-
return matchesStrictComparable_default(toKey_default(
|
|
23215
|
+
function baseMatchesProperty(path56, srcValue) {
|
|
23216
|
+
if (isKey_default(path56) && isStrictComparable_default(srcValue)) {
|
|
23217
|
+
return matchesStrictComparable_default(toKey_default(path56), srcValue);
|
|
23218
23218
|
}
|
|
23219
23219
|
return function(object3) {
|
|
23220
|
-
var objValue = get_default(object3,
|
|
23221
|
-
return objValue === void 0 && objValue === srcValue ? hasIn_default(object3,
|
|
23220
|
+
var objValue = get_default(object3, path56);
|
|
23221
|
+
return objValue === void 0 && objValue === srcValue ? hasIn_default(object3, path56) : baseIsEqual_default(srcValue, objValue, COMPARE_PARTIAL_FLAG6 | COMPARE_UNORDERED_FLAG4);
|
|
23222
23222
|
};
|
|
23223
23223
|
}
|
|
23224
23224
|
var COMPARE_PARTIAL_FLAG6, COMPARE_UNORDERED_FLAG4, baseMatchesProperty_default;
|
|
@@ -23251,9 +23251,9 @@ var init_baseProperty = __esm({
|
|
|
23251
23251
|
});
|
|
23252
23252
|
|
|
23253
23253
|
// node_modules/lodash-es/_basePropertyDeep.js
|
|
23254
|
-
function basePropertyDeep(
|
|
23254
|
+
function basePropertyDeep(path56) {
|
|
23255
23255
|
return function(object3) {
|
|
23256
|
-
return baseGet_default(object3,
|
|
23256
|
+
return baseGet_default(object3, path56);
|
|
23257
23257
|
};
|
|
23258
23258
|
}
|
|
23259
23259
|
var basePropertyDeep_default;
|
|
@@ -23265,8 +23265,8 @@ var init_basePropertyDeep = __esm({
|
|
|
23265
23265
|
});
|
|
23266
23266
|
|
|
23267
23267
|
// node_modules/lodash-es/property.js
|
|
23268
|
-
function property(
|
|
23269
|
-
return isKey_default(
|
|
23268
|
+
function property(path56) {
|
|
23269
|
+
return isKey_default(path56) ? baseProperty_default(toKey_default(path56)) : basePropertyDeep_default(path56);
|
|
23270
23270
|
}
|
|
23271
23271
|
var property_default;
|
|
23272
23272
|
var init_property = __esm({
|
|
@@ -23885,8 +23885,8 @@ var init_baseHas = __esm({
|
|
|
23885
23885
|
});
|
|
23886
23886
|
|
|
23887
23887
|
// node_modules/lodash-es/has.js
|
|
23888
|
-
function has(object3,
|
|
23889
|
-
return object3 != null && hasPath_default(object3,
|
|
23888
|
+
function has(object3, path56) {
|
|
23889
|
+
return object3 != null && hasPath_default(object3, path56, baseHas_default);
|
|
23890
23890
|
}
|
|
23891
23891
|
var has_default;
|
|
23892
23892
|
var init_has = __esm({
|
|
@@ -24092,14 +24092,14 @@ var init_negate = __esm({
|
|
|
24092
24092
|
});
|
|
24093
24093
|
|
|
24094
24094
|
// node_modules/lodash-es/_baseSet.js
|
|
24095
|
-
function baseSet(object3,
|
|
24095
|
+
function baseSet(object3, path56, value2, customizer) {
|
|
24096
24096
|
if (!isObject_default(object3)) {
|
|
24097
24097
|
return object3;
|
|
24098
24098
|
}
|
|
24099
|
-
|
|
24100
|
-
var index = -1, length =
|
|
24099
|
+
path56 = castPath_default(path56, object3);
|
|
24100
|
+
var index = -1, length = path56.length, lastIndex = length - 1, nested = object3;
|
|
24101
24101
|
while (nested != null && ++index < length) {
|
|
24102
|
-
var key = toKey_default(
|
|
24102
|
+
var key = toKey_default(path56[index]), newValue = value2;
|
|
24103
24103
|
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
24104
24104
|
return object3;
|
|
24105
24105
|
}
|
|
@@ -24107,7 +24107,7 @@ function baseSet(object3, path54, value2, customizer) {
|
|
|
24107
24107
|
var objValue = nested[key];
|
|
24108
24108
|
newValue = customizer ? customizer(objValue, key, nested) : void 0;
|
|
24109
24109
|
if (newValue === void 0) {
|
|
24110
|
-
newValue = isObject_default(objValue) ? objValue : isIndex_default(
|
|
24110
|
+
newValue = isObject_default(objValue) ? objValue : isIndex_default(path56[index + 1]) ? [] : {};
|
|
24111
24111
|
}
|
|
24112
24112
|
}
|
|
24113
24113
|
assignValue_default(nested, key, newValue);
|
|
@@ -24131,9 +24131,9 @@ var init_baseSet = __esm({
|
|
|
24131
24131
|
function basePickBy(object3, paths, predicate) {
|
|
24132
24132
|
var index = -1, length = paths.length, result = {};
|
|
24133
24133
|
while (++index < length) {
|
|
24134
|
-
var
|
|
24135
|
-
if (predicate(value2,
|
|
24136
|
-
baseSet_default(result, castPath_default(
|
|
24134
|
+
var path56 = paths[index], value2 = baseGet_default(object3, path56);
|
|
24135
|
+
if (predicate(value2, path56)) {
|
|
24136
|
+
baseSet_default(result, castPath_default(path56, object3), value2);
|
|
24137
24137
|
}
|
|
24138
24138
|
}
|
|
24139
24139
|
return result;
|
|
@@ -24157,8 +24157,8 @@ function pickBy(object3, predicate) {
|
|
|
24157
24157
|
return [prop];
|
|
24158
24158
|
});
|
|
24159
24159
|
predicate = baseIteratee_default(predicate);
|
|
24160
|
-
return basePickBy_default(object3, props, function(value2,
|
|
24161
|
-
return predicate(value2,
|
|
24160
|
+
return basePickBy_default(object3, props, function(value2, path56) {
|
|
24161
|
+
return predicate(value2, path56[0]);
|
|
24162
24162
|
});
|
|
24163
24163
|
}
|
|
24164
24164
|
var pickBy_default;
|
|
@@ -26905,12 +26905,12 @@ function assignCategoriesMapProp(tokenTypes) {
|
|
|
26905
26905
|
singleAssignCategoriesToksMap([], currTokType);
|
|
26906
26906
|
});
|
|
26907
26907
|
}
|
|
26908
|
-
function singleAssignCategoriesToksMap(
|
|
26909
|
-
forEach_default(
|
|
26908
|
+
function singleAssignCategoriesToksMap(path56, nextNode) {
|
|
26909
|
+
forEach_default(path56, (pathNode) => {
|
|
26910
26910
|
nextNode.categoryMatchesMap[pathNode.tokenTypeIdx] = true;
|
|
26911
26911
|
});
|
|
26912
26912
|
forEach_default(nextNode.CATEGORIES, (nextCategory) => {
|
|
26913
|
-
const newPath =
|
|
26913
|
+
const newPath = path56.concat(nextNode);
|
|
26914
26914
|
if (!includes_default(newPath, nextCategory)) {
|
|
26915
26915
|
singleAssignCategoriesToksMap(newPath, nextCategory);
|
|
26916
26916
|
}
|
|
@@ -28080,10 +28080,10 @@ var init_interpreter = __esm({
|
|
|
28080
28080
|
init_rest();
|
|
28081
28081
|
init_api2();
|
|
28082
28082
|
AbstractNextPossibleTokensWalker = class extends RestWalker {
|
|
28083
|
-
constructor(topProd,
|
|
28083
|
+
constructor(topProd, path56) {
|
|
28084
28084
|
super();
|
|
28085
28085
|
this.topProd = topProd;
|
|
28086
|
-
this.path =
|
|
28086
|
+
this.path = path56;
|
|
28087
28087
|
this.possibleTokTypes = [];
|
|
28088
28088
|
this.nextProductionName = "";
|
|
28089
28089
|
this.nextProductionOccurrence = 0;
|
|
@@ -28127,9 +28127,9 @@ var init_interpreter = __esm({
|
|
|
28127
28127
|
}
|
|
28128
28128
|
};
|
|
28129
28129
|
NextAfterTokenWalker = class extends AbstractNextPossibleTokensWalker {
|
|
28130
|
-
constructor(topProd,
|
|
28131
|
-
super(topProd,
|
|
28132
|
-
this.path =
|
|
28130
|
+
constructor(topProd, path56) {
|
|
28131
|
+
super(topProd, path56);
|
|
28132
|
+
this.path = path56;
|
|
28133
28133
|
this.nextTerminalName = "";
|
|
28134
28134
|
this.nextTerminalOccurrence = 0;
|
|
28135
28135
|
this.nextTerminalName = this.path.lastTok.name;
|
|
@@ -28370,10 +28370,10 @@ function initializeArrayOfArrays(size) {
|
|
|
28370
28370
|
}
|
|
28371
28371
|
return result;
|
|
28372
28372
|
}
|
|
28373
|
-
function pathToHashKeys(
|
|
28373
|
+
function pathToHashKeys(path56) {
|
|
28374
28374
|
let keys2 = [""];
|
|
28375
|
-
for (let i = 0; i <
|
|
28376
|
-
const tokType =
|
|
28375
|
+
for (let i = 0; i < path56.length; i++) {
|
|
28376
|
+
const tokType = path56[i];
|
|
28377
28377
|
const longerKeys = [];
|
|
28378
28378
|
for (let j = 0; j < keys2.length; j++) {
|
|
28379
28379
|
const currShorterKey = keys2[j];
|
|
@@ -28676,7 +28676,7 @@ function validateRuleIsOverridden(ruleName, definedRulesNames, className) {
|
|
|
28676
28676
|
}
|
|
28677
28677
|
return errors2;
|
|
28678
28678
|
}
|
|
28679
|
-
function validateNoLeftRecursion(topRule, currRule, errMsgProvider,
|
|
28679
|
+
function validateNoLeftRecursion(topRule, currRule, errMsgProvider, path56 = []) {
|
|
28680
28680
|
const errors2 = [];
|
|
28681
28681
|
const nextNonTerminals = getFirstNoneTerminal(currRule.definition);
|
|
28682
28682
|
if (isEmpty_default(nextNonTerminals)) {
|
|
@@ -28688,15 +28688,15 @@ function validateNoLeftRecursion(topRule, currRule, errMsgProvider, path54 = [])
|
|
|
28688
28688
|
errors2.push({
|
|
28689
28689
|
message: errMsgProvider.buildLeftRecursionError({
|
|
28690
28690
|
topLevelRule: topRule,
|
|
28691
|
-
leftRecursionPath:
|
|
28691
|
+
leftRecursionPath: path56
|
|
28692
28692
|
}),
|
|
28693
28693
|
type: ParserDefinitionErrorType.LEFT_RECURSION,
|
|
28694
28694
|
ruleName
|
|
28695
28695
|
});
|
|
28696
28696
|
}
|
|
28697
|
-
const validNextSteps = difference_default(nextNonTerminals,
|
|
28697
|
+
const validNextSteps = difference_default(nextNonTerminals, path56.concat([topRule]));
|
|
28698
28698
|
const errorsFromNextSteps = flatMap_default(validNextSteps, (currRefRule) => {
|
|
28699
|
-
const newPath = clone_default(
|
|
28699
|
+
const newPath = clone_default(path56);
|
|
28700
28700
|
newPath.push(currRefRule);
|
|
28701
28701
|
return validateNoLeftRecursion(topRule, currRefRule, errMsgProvider, newPath);
|
|
28702
28702
|
});
|
|
@@ -39026,13 +39026,13 @@ Add '@param ${fromPort}' to the workflow JSDoc and include it in the params obje
|
|
|
39026
39026
|
connections.filter((c) => c.from.node === c.to.node).map((c) => c.from.node)
|
|
39027
39027
|
);
|
|
39028
39028
|
const nonSelfLoopConnections = connections.filter((c) => c.from.node !== c.to.node);
|
|
39029
|
-
const dfs = (nodeName,
|
|
39029
|
+
const dfs = (nodeName, path56) => {
|
|
39030
39030
|
if (recursionStack.has(nodeName)) {
|
|
39031
39031
|
if (selfLoopNodes.has(nodeName)) {
|
|
39032
39032
|
return false;
|
|
39033
39033
|
}
|
|
39034
|
-
const cycleStart =
|
|
39035
|
-
const cyclePath = [...
|
|
39034
|
+
const cycleStart = path56.indexOf(nodeName);
|
|
39035
|
+
const cyclePath = [...path56.slice(cycleStart), nodeName];
|
|
39036
39036
|
const cycleNodes = cyclePath.slice(0, -1);
|
|
39037
39037
|
const sortedCycle = [...cycleNodes].sort();
|
|
39038
39038
|
const cycleKey = sortedCycle.join(",");
|
|
@@ -39054,7 +39054,7 @@ Add '@param ${fromPort}' to the workflow JSDoc and include it in the params obje
|
|
|
39054
39054
|
return false;
|
|
39055
39055
|
}
|
|
39056
39056
|
recursionStack.add(nodeName);
|
|
39057
|
-
const newPath = [...
|
|
39057
|
+
const newPath = [...path56, nodeName];
|
|
39058
39058
|
const instance = instances.find((n) => n.id === nodeName);
|
|
39059
39059
|
if (!instance) {
|
|
39060
39060
|
recursionStack.delete(nodeName);
|
|
@@ -40314,7 +40314,7 @@ function processResult(result, scope) {
|
|
|
40314
40314
|
}
|
|
40315
40315
|
return result !== NOTHING ? result : void 0;
|
|
40316
40316
|
}
|
|
40317
|
-
function finalize(rootScope, value2,
|
|
40317
|
+
function finalize(rootScope, value2, path56) {
|
|
40318
40318
|
if (isFrozen(value2))
|
|
40319
40319
|
return value2;
|
|
40320
40320
|
const useStrictIteration = rootScope.immer_.shouldUseStrictIteration();
|
|
@@ -40322,7 +40322,7 @@ function finalize(rootScope, value2, path54) {
|
|
|
40322
40322
|
if (!state) {
|
|
40323
40323
|
each(
|
|
40324
40324
|
value2,
|
|
40325
|
-
(key, childValue) => finalizeProperty(rootScope, state, value2, key, childValue,
|
|
40325
|
+
(key, childValue) => finalizeProperty(rootScope, state, value2, key, childValue, path56),
|
|
40326
40326
|
useStrictIteration
|
|
40327
40327
|
);
|
|
40328
40328
|
return value2;
|
|
@@ -40352,16 +40352,16 @@ function finalize(rootScope, value2, path54) {
|
|
|
40352
40352
|
result,
|
|
40353
40353
|
key,
|
|
40354
40354
|
childValue,
|
|
40355
|
-
|
|
40355
|
+
path56,
|
|
40356
40356
|
isSet22
|
|
40357
40357
|
),
|
|
40358
40358
|
useStrictIteration
|
|
40359
40359
|
);
|
|
40360
40360
|
maybeFreeze(rootScope, result, false);
|
|
40361
|
-
if (
|
|
40361
|
+
if (path56 && rootScope.patches_) {
|
|
40362
40362
|
getPlugin("Patches").generatePatches_(
|
|
40363
40363
|
state,
|
|
40364
|
-
|
|
40364
|
+
path56,
|
|
40365
40365
|
rootScope.patches_,
|
|
40366
40366
|
rootScope.inversePatches_
|
|
40367
40367
|
);
|
|
@@ -40383,9 +40383,9 @@ function finalizeProperty(rootScope, parentState, targetObject, prop, childValue
|
|
|
40383
40383
|
if (process.env.NODE_ENV !== "production" && childValue === targetObject)
|
|
40384
40384
|
die(5);
|
|
40385
40385
|
if (isDraft(childValue)) {
|
|
40386
|
-
const
|
|
40386
|
+
const path56 = rootPath && parentState && parentState.type_ !== 3 && // Set objects are atomic since they have no keys.
|
|
40387
40387
|
!has2(parentState.assigned_, prop) ? rootPath.concat(prop) : void 0;
|
|
40388
|
-
const res = finalize(rootScope, childValue,
|
|
40388
|
+
const res = finalize(rootScope, childValue, path56);
|
|
40389
40389
|
set(targetObject, prop, res);
|
|
40390
40390
|
if (isDraft(res)) {
|
|
40391
40391
|
rootScope.canAutoFreeze_ = false;
|
|
@@ -49966,14 +49966,14 @@ function waypointsToSvgPath(waypoints, cornerRadius) {
|
|
|
49966
49966
|
radii[i + 1] *= scale;
|
|
49967
49967
|
}
|
|
49968
49968
|
}
|
|
49969
|
-
let
|
|
49969
|
+
let path56 = `M ${waypoints[0][0]},${waypoints[0][1]}`;
|
|
49970
49970
|
for (let i = 1; i < waypoints.length - 1; i++) {
|
|
49971
49971
|
const prev = waypoints[i - 1];
|
|
49972
49972
|
const curr = waypoints[i];
|
|
49973
49973
|
const next = waypoints[i + 1];
|
|
49974
49974
|
const r = radii[i];
|
|
49975
49975
|
if (r < 2) {
|
|
49976
|
-
|
|
49976
|
+
path56 += ` L ${curr[0]},${curr[1]}`;
|
|
49977
49977
|
continue;
|
|
49978
49978
|
}
|
|
49979
49979
|
const dPrev = [prev[0] - curr[0], prev[1] - curr[1]];
|
|
@@ -49986,12 +49986,12 @@ function waypointsToSvgPath(waypoints, cornerRadius) {
|
|
|
49986
49986
|
const arcEnd = [curr[0] + uNext[0] * r, curr[1] + uNext[1] * r];
|
|
49987
49987
|
const cross = dPrev[0] * dNext[1] - dPrev[1] * dNext[0];
|
|
49988
49988
|
const sweep = cross > 0 ? 0 : 1;
|
|
49989
|
-
|
|
49990
|
-
|
|
49989
|
+
path56 += ` L ${arcStart[0]},${arcStart[1]}`;
|
|
49990
|
+
path56 += ` A ${r} ${r} 0 0 ${sweep} ${arcEnd[0]},${arcEnd[1]}`;
|
|
49991
49991
|
}
|
|
49992
49992
|
const last2 = waypoints[waypoints.length - 1];
|
|
49993
|
-
|
|
49994
|
-
return
|
|
49993
|
+
path56 += ` L ${last2[0]},${last2[1]}`;
|
|
49994
|
+
return path56;
|
|
49995
49995
|
}
|
|
49996
49996
|
function computeWaypoints(from, to, nodeBoxes, sourceNodeId, targetNodeId, padding, exitStub, entryStub, allocator) {
|
|
49997
49997
|
const isSelfConnection = sourceNodeId === targetNodeId;
|
|
@@ -50138,7 +50138,7 @@ function calculateOrthogonalPath(from, to, nodeBoxes, sourceNodeId, targetNodeId
|
|
|
50138
50138
|
}
|
|
50139
50139
|
function calculateOrthogonalPathSafe(from, to, nodeBoxes, sourceNodeId, targetNodeId, options, allocator) {
|
|
50140
50140
|
try {
|
|
50141
|
-
const
|
|
50141
|
+
const path56 = calculateOrthogonalPath(
|
|
50142
50142
|
from,
|
|
50143
50143
|
to,
|
|
50144
50144
|
nodeBoxes,
|
|
@@ -50147,8 +50147,8 @@ function calculateOrthogonalPathSafe(from, to, nodeBoxes, sourceNodeId, targetNo
|
|
|
50147
50147
|
options,
|
|
50148
50148
|
allocator
|
|
50149
50149
|
);
|
|
50150
|
-
if (!
|
|
50151
|
-
return
|
|
50150
|
+
if (!path56 || path56.length < 5) return null;
|
|
50151
|
+
return path56;
|
|
50152
50152
|
} catch {
|
|
50153
50153
|
return null;
|
|
50154
50154
|
}
|
|
@@ -50372,13 +50372,13 @@ function computeConnectionPath(sx, sy, tx, ty) {
|
|
|
50372
50372
|
const deUy = deY / deLen;
|
|
50373
50373
|
const [cx, cy] = quadCurveControl(bx, by, dx, dy, -deUx, -deUy);
|
|
50374
50374
|
const [fx, fy] = quadCurveControl(gx, gy, ex, ey, deUx, deUy);
|
|
50375
|
-
let
|
|
50376
|
-
|
|
50377
|
-
|
|
50378
|
-
|
|
50379
|
-
|
|
50380
|
-
|
|
50381
|
-
return
|
|
50375
|
+
let path56 = `M ${cx},${cy} M ${ax},${ay}`;
|
|
50376
|
+
path56 += ` L ${bx},${by}`;
|
|
50377
|
+
path56 += ` Q ${cx},${cy} ${dx},${dy}`;
|
|
50378
|
+
path56 += ` L ${ex},${ey}`;
|
|
50379
|
+
path56 += ` Q ${fx},${fy} ${gx},${gy}`;
|
|
50380
|
+
path56 += ` L ${hx},${hy}`;
|
|
50381
|
+
return path56;
|
|
50382
50382
|
}
|
|
50383
50383
|
function orderedPorts(ports, direction) {
|
|
50384
50384
|
const cloned = {};
|
|
@@ -50668,7 +50668,7 @@ function finalizeScopePositions(parentNode, ast, theme = "dark") {
|
|
|
50668
50668
|
function buildConnection(fromNode, fromPort, toNode, toPort, sourcePort, targetPort, theme = "dark") {
|
|
50669
50669
|
const sourceColor = getPortColor(sourcePort.dataType, sourcePort.isFailure, theme);
|
|
50670
50670
|
const targetColor = getPortColor(targetPort.dataType, targetPort.isFailure, theme);
|
|
50671
|
-
const
|
|
50671
|
+
const path56 = computeConnectionPath(sourcePort.cx, sourcePort.cy, targetPort.cx, targetPort.cy);
|
|
50672
50672
|
return {
|
|
50673
50673
|
fromNode,
|
|
50674
50674
|
fromPort,
|
|
@@ -50677,7 +50677,7 @@ function buildConnection(fromNode, fromPort, toNode, toPort, sourcePort, targetP
|
|
|
50677
50677
|
sourceColor,
|
|
50678
50678
|
targetColor,
|
|
50679
50679
|
isStepConnection: sourcePort.dataType === "STEP",
|
|
50680
|
-
path:
|
|
50680
|
+
path: path56
|
|
50681
50681
|
};
|
|
50682
50682
|
}
|
|
50683
50683
|
function portsColumnHeight(count) {
|
|
@@ -51065,6 +51065,13 @@ function buildDiagramGraph(ast, options = {}) {
|
|
|
51065
51065
|
width: node.width,
|
|
51066
51066
|
height: node.height
|
|
51067
51067
|
}));
|
|
51068
|
+
for (const node of nodes) {
|
|
51069
|
+
if (node.scopeChildren) {
|
|
51070
|
+
for (const child of node.scopeChildren) {
|
|
51071
|
+
nodeBoxes.push({ id: child.id, x: child.x, y: child.y, width: child.width, height: child.height });
|
|
51072
|
+
}
|
|
51073
|
+
}
|
|
51074
|
+
}
|
|
51068
51075
|
pendingConnections.sort((a, b) => {
|
|
51069
51076
|
const aSpan = Math.abs(a.targetPort.cx - a.sourcePort.cx);
|
|
51070
51077
|
const bSpan = Math.abs(b.targetPort.cx - b.sourcePort.cx);
|
|
@@ -51109,7 +51116,7 @@ function buildDiagramGraph(ast, options = {}) {
|
|
|
51109
51116
|
const dy = ty - sy;
|
|
51110
51117
|
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
51111
51118
|
const useCurve = forceCurveSet.has(pc2);
|
|
51112
|
-
let
|
|
51119
|
+
let path56;
|
|
51113
51120
|
if (!useCurve && distance > ORTHOGONAL_DISTANCE_THRESHOLD) {
|
|
51114
51121
|
const orthoPath = calculateOrthogonalPathSafe(
|
|
51115
51122
|
[sx, sy],
|
|
@@ -51120,9 +51127,9 @@ function buildDiagramGraph(ast, options = {}) {
|
|
|
51120
51127
|
{ fromPortIndex: pc2.fromPortIndex, toPortIndex: pc2.toPortIndex },
|
|
51121
51128
|
allocator
|
|
51122
51129
|
);
|
|
51123
|
-
|
|
51130
|
+
path56 = orthoPath ?? computeConnectionPath(sx, sy, tx, ty);
|
|
51124
51131
|
} else {
|
|
51125
|
-
|
|
51132
|
+
path56 = computeConnectionPath(sx, sy, tx, ty);
|
|
51126
51133
|
}
|
|
51127
51134
|
const sourceColor = getPortColor(pc2.sourcePort.dataType, pc2.sourcePort.isFailure, themeName);
|
|
51128
51135
|
const targetColor = getPortColor(pc2.targetPort.dataType, pc2.targetPort.isFailure, themeName);
|
|
@@ -51134,19 +51141,97 @@ function buildDiagramGraph(ast, options = {}) {
|
|
|
51134
51141
|
sourceColor,
|
|
51135
51142
|
targetColor,
|
|
51136
51143
|
isStepConnection: pc2.sourcePort.dataType === "STEP",
|
|
51137
|
-
path:
|
|
51144
|
+
path: path56
|
|
51138
51145
|
});
|
|
51139
51146
|
}
|
|
51140
51147
|
for (const node of nodes) {
|
|
51141
|
-
if (node.scopeConnections
|
|
51142
|
-
|
|
51143
|
-
|
|
51144
|
-
|
|
51145
|
-
|
|
51146
|
-
|
|
51147
|
-
|
|
51148
|
-
|
|
51149
|
-
|
|
51148
|
+
if (!node.scopeConnections || !node.scopePorts || !node.scopeChildren) continue;
|
|
51149
|
+
const childMap = /* @__PURE__ */ new Map();
|
|
51150
|
+
for (const c of node.scopeChildren) childMap.set(c.id, c);
|
|
51151
|
+
const scopePending = [];
|
|
51152
|
+
for (const conn of node.scopeConnections) {
|
|
51153
|
+
const sPort = findScopePort(conn.fromNode, conn.fromPort, node, childMap, "output");
|
|
51154
|
+
const tPort = findScopePort(conn.toNode, conn.toPort, node, childMap, "input");
|
|
51155
|
+
if (!sPort || !tPort) continue;
|
|
51156
|
+
let fromPortIndex = 0;
|
|
51157
|
+
let toPortIndex = 0;
|
|
51158
|
+
if (conn.fromNode === node.id) {
|
|
51159
|
+
fromPortIndex = node.scopePorts.outputs.indexOf(sPort);
|
|
51160
|
+
} else {
|
|
51161
|
+
const fromChild = childMap.get(conn.fromNode);
|
|
51162
|
+
if (fromChild) fromPortIndex = fromChild.outputs.indexOf(sPort);
|
|
51163
|
+
}
|
|
51164
|
+
if (conn.toNode === node.id) {
|
|
51165
|
+
toPortIndex = node.scopePorts.inputs.indexOf(tPort);
|
|
51166
|
+
} else {
|
|
51167
|
+
const toChild = childMap.get(conn.toNode);
|
|
51168
|
+
if (toChild) toPortIndex = toChild.inputs.indexOf(tPort);
|
|
51169
|
+
}
|
|
51170
|
+
scopePending.push({
|
|
51171
|
+
conn,
|
|
51172
|
+
sourcePort: sPort,
|
|
51173
|
+
targetPort: tPort,
|
|
51174
|
+
fromNodeId: conn.fromNode,
|
|
51175
|
+
toNodeId: conn.toNode,
|
|
51176
|
+
fromPortIndex: Math.max(0, fromPortIndex),
|
|
51177
|
+
toPortIndex: Math.max(0, toPortIndex)
|
|
51178
|
+
});
|
|
51179
|
+
}
|
|
51180
|
+
scopePending.sort((a, b) => {
|
|
51181
|
+
const aSpan = Math.abs(a.targetPort.cx - a.sourcePort.cx);
|
|
51182
|
+
const bSpan = Math.abs(b.targetPort.cx - b.sourcePort.cx);
|
|
51183
|
+
if (Math.abs(aSpan - bSpan) > 1) return aSpan - bSpan;
|
|
51184
|
+
if (Math.abs(a.sourcePort.cx - b.sourcePort.cx) > 1) return a.sourcePort.cx - b.sourcePort.cx;
|
|
51185
|
+
return a.sourcePort.cy - b.sourcePort.cy;
|
|
51186
|
+
});
|
|
51187
|
+
const spSrcKey = (sp) => `s:${sp.fromNodeId}.${sp.conn.fromPort}`;
|
|
51188
|
+
const spTgtKey = (sp) => `t:${sp.toNodeId}.${sp.conn.toPort}`;
|
|
51189
|
+
const spTgtNodeKey = (sp) => `n:${sp.toNodeId}`;
|
|
51190
|
+
const spGroups = /* @__PURE__ */ new Map();
|
|
51191
|
+
for (const sp of scopePending) {
|
|
51192
|
+
for (const key of [spSrcKey(sp), spTgtKey(sp), spTgtNodeKey(sp)]) {
|
|
51193
|
+
if (!spGroups.has(key)) spGroups.set(key, []);
|
|
51194
|
+
spGroups.get(key).push(sp);
|
|
51195
|
+
}
|
|
51196
|
+
}
|
|
51197
|
+
const spForceCurveKeys = /* @__PURE__ */ new Set();
|
|
51198
|
+
for (const [key, group] of spGroups) {
|
|
51199
|
+
if (group.length < 2) continue;
|
|
51200
|
+
const anyShort = group.some((sp) => {
|
|
51201
|
+
const ddx = sp.targetPort.cx - sp.sourcePort.cx;
|
|
51202
|
+
const ddy = sp.targetPort.cy - sp.sourcePort.cy;
|
|
51203
|
+
return Math.sqrt(ddx * ddx + ddy * ddy) <= ORTHOGONAL_DISTANCE_THRESHOLD;
|
|
51204
|
+
});
|
|
51205
|
+
if (anyShort) spForceCurveKeys.add(key);
|
|
51206
|
+
}
|
|
51207
|
+
const spForceCurveSet = /* @__PURE__ */ new Set();
|
|
51208
|
+
for (const sp of scopePending) {
|
|
51209
|
+
if (spForceCurveKeys.has(spSrcKey(sp)) || spForceCurveKeys.has(spTgtKey(sp)) || spForceCurveKeys.has(spTgtNodeKey(sp))) {
|
|
51210
|
+
spForceCurveSet.add(sp);
|
|
51211
|
+
}
|
|
51212
|
+
}
|
|
51213
|
+
for (const sp of scopePending) {
|
|
51214
|
+
const sx = sp.sourcePort.cx;
|
|
51215
|
+
const sy = sp.sourcePort.cy;
|
|
51216
|
+
const tx = sp.targetPort.cx;
|
|
51217
|
+
const ty = sp.targetPort.cy;
|
|
51218
|
+
const ddx = tx - sx;
|
|
51219
|
+
const ddy = ty - sy;
|
|
51220
|
+
const dist = Math.sqrt(ddx * ddx + ddy * ddy);
|
|
51221
|
+
const useCurve = spForceCurveSet.has(sp);
|
|
51222
|
+
if (!useCurve && dist > ORTHOGONAL_DISTANCE_THRESHOLD) {
|
|
51223
|
+
const orthoPath = calculateOrthogonalPathSafe(
|
|
51224
|
+
[sx, sy],
|
|
51225
|
+
[tx, ty],
|
|
51226
|
+
nodeBoxes,
|
|
51227
|
+
sp.fromNodeId,
|
|
51228
|
+
sp.toNodeId,
|
|
51229
|
+
{ fromPortIndex: sp.fromPortIndex, toPortIndex: sp.toPortIndex },
|
|
51230
|
+
allocator
|
|
51231
|
+
);
|
|
51232
|
+
sp.conn.path = orthoPath ?? computeConnectionPath(sx, sy, tx, ty);
|
|
51233
|
+
} else {
|
|
51234
|
+
sp.conn.path = computeConnectionPath(sx, sy, tx, ty);
|
|
51150
51235
|
}
|
|
51151
51236
|
}
|
|
51152
51237
|
}
|
|
@@ -51214,12 +51299,12 @@ function resolveDefaultIcon(nt) {
|
|
|
51214
51299
|
if (nt.variant === "WORKFLOW" || nt.variant === "IMPORTED_WORKFLOW") return "flow";
|
|
51215
51300
|
return "code";
|
|
51216
51301
|
}
|
|
51217
|
-
function pathExtent(
|
|
51302
|
+
function pathExtent(path56) {
|
|
51218
51303
|
let minX = Infinity, minY = Infinity;
|
|
51219
51304
|
let maxX = -Infinity, maxY = -Infinity;
|
|
51220
51305
|
const pattern = /(-?[\d.]+),(-?[\d.]+)/g;
|
|
51221
51306
|
let m;
|
|
51222
|
-
while ((m = pattern.exec(
|
|
51307
|
+
while ((m = pattern.exec(path56)) !== null) {
|
|
51223
51308
|
const x = parseFloat(m[1]);
|
|
51224
51309
|
const y = parseFloat(m[2]);
|
|
51225
51310
|
minX = Math.min(minX, x);
|
|
@@ -52580,7 +52665,10 @@ path[data-source].port-hover { opacity: 1; }
|
|
|
52580
52665
|
portConnections[tgt].push(src);
|
|
52581
52666
|
});
|
|
52582
52667
|
|
|
52583
|
-
// ---- Connection path computation (from geometry.ts) ----
|
|
52668
|
+
// ---- Connection path computation (bezier from geometry.ts + orthogonal router) ----
|
|
52669
|
+
var TRACK_SPACING = 15, EDGE_OFFSET = 5, MAX_CANDIDATES = 5;
|
|
52670
|
+
var MIN_SEG_LEN = 3, JOG_THRESHOLD = 10, ORTHO_THRESHOLD = 300;
|
|
52671
|
+
|
|
52584
52672
|
function quadCurveControl(ax, ay, bx, by, ux, uy) {
|
|
52585
52673
|
var dn = Math.abs(ay - by);
|
|
52586
52674
|
return [bx + (ux * dn) / Math.abs(uy), ay];
|
|
@@ -52610,18 +52698,326 @@ path[data-source].port-hover { opacity: 1; }
|
|
|
52610
52698
|
' L ' + hx + ',' + hy;
|
|
52611
52699
|
}
|
|
52612
52700
|
|
|
52613
|
-
// ----
|
|
52701
|
+
// ---- Orthogonal router (ported from orthogonal-router.ts) ----
|
|
52702
|
+
function createAllocator() {
|
|
52703
|
+
var claims = [], vclaims = [];
|
|
52704
|
+
function isOcc(xn, xx, y) {
|
|
52705
|
+
for (var i = 0; i < claims.length; i++) {
|
|
52706
|
+
var c = claims[i];
|
|
52707
|
+
if (c.xn < xx && c.xx > xn && Math.abs(c.y - y) < TRACK_SPACING) return true;
|
|
52708
|
+
}
|
|
52709
|
+
return false;
|
|
52710
|
+
}
|
|
52711
|
+
function isOccV(yn, yx, x) {
|
|
52712
|
+
for (var i = 0; i < vclaims.length; i++) {
|
|
52713
|
+
var c = vclaims[i];
|
|
52714
|
+
if (c.yn < yx && c.yx > yn && Math.abs(c.x - x) < TRACK_SPACING) return true;
|
|
52715
|
+
}
|
|
52716
|
+
return false;
|
|
52717
|
+
}
|
|
52718
|
+
function blockedByNode(xn, xx, y, boxes) {
|
|
52719
|
+
for (var i = 0; i < boxes.length; i++) {
|
|
52720
|
+
var b = boxes[i]; if (xn < b.r && xx > b.l && y >= b.t && y <= b.b) return true;
|
|
52721
|
+
}
|
|
52722
|
+
return false;
|
|
52723
|
+
}
|
|
52724
|
+
function blockedByNodeV(yn, yx, x, boxes) {
|
|
52725
|
+
for (var i = 0; i < boxes.length; i++) {
|
|
52726
|
+
var b = boxes[i]; if (x >= b.l && x <= b.r && yn < b.b && yx > b.t) return true;
|
|
52727
|
+
}
|
|
52728
|
+
return false;
|
|
52729
|
+
}
|
|
52730
|
+
function countHCross(xn, xx, y) {
|
|
52731
|
+
var n = 0;
|
|
52732
|
+
for (var i = 0; i < vclaims.length; i++) {
|
|
52733
|
+
var c = vclaims[i]; if (c.x > xn && c.x < xx && y >= c.yn && y <= c.yx) n++;
|
|
52734
|
+
}
|
|
52735
|
+
return n;
|
|
52736
|
+
}
|
|
52737
|
+
function countVCross(yn, yx, x) {
|
|
52738
|
+
var n = 0;
|
|
52739
|
+
for (var i = 0; i < claims.length; i++) {
|
|
52740
|
+
var c = claims[i]; if (c.y > yn && c.y < yx && x >= c.xn && x <= c.xx) n++;
|
|
52741
|
+
}
|
|
52742
|
+
return n;
|
|
52743
|
+
}
|
|
52744
|
+
return {
|
|
52745
|
+
findFreeY: function(xn, xx, cy, nb) {
|
|
52746
|
+
var free = function(y) { return !isOcc(xn, xx, y) && (!nb || !blockedByNode(xn, xx, y, nb)); };
|
|
52747
|
+
if (free(cy)) return cy;
|
|
52748
|
+
var cands = [];
|
|
52749
|
+
for (var off = TRACK_SPACING; off < 800 && cands.length < MAX_CANDIDATES * 2; off += TRACK_SPACING) {
|
|
52750
|
+
if (free(cy - off)) cands.push({ y: cy - off, d: off });
|
|
52751
|
+
if (free(cy + off)) cands.push({ y: cy + off, d: off });
|
|
52752
|
+
}
|
|
52753
|
+
if (!cands.length) return cy;
|
|
52754
|
+
var best = cands[0].y, bc = countHCross(xn, xx, cands[0].y), bd = cands[0].d;
|
|
52755
|
+
for (var i = 1; i < cands.length; i++) {
|
|
52756
|
+
var cr = countHCross(xn, xx, cands[i].y);
|
|
52757
|
+
if (cr < bc || (cr === bc && cands[i].d < bd)) { best = cands[i].y; bc = cr; bd = cands[i].d; }
|
|
52758
|
+
}
|
|
52759
|
+
return best;
|
|
52760
|
+
},
|
|
52761
|
+
findFreeX: function(yn, yx, cx, nb) {
|
|
52762
|
+
var free = function(x) { return !isOccV(yn, yx, x) && (!nb || !blockedByNodeV(yn, yx, x, nb)); };
|
|
52763
|
+
if (free(cx)) return cx;
|
|
52764
|
+
var cands = [];
|
|
52765
|
+
for (var off = TRACK_SPACING; off < 800 && cands.length < MAX_CANDIDATES * 2; off += TRACK_SPACING) {
|
|
52766
|
+
if (free(cx - off)) cands.push({ x: cx - off, d: off });
|
|
52767
|
+
if (free(cx + off)) cands.push({ x: cx + off, d: off });
|
|
52768
|
+
}
|
|
52769
|
+
if (!cands.length) return cx;
|
|
52770
|
+
var best = cands[0].x, bc = countVCross(yn, yx, cands[0].x), bd = cands[0].d;
|
|
52771
|
+
for (var i = 1; i < cands.length; i++) {
|
|
52772
|
+
var cr = countVCross(yn, yx, cands[i].x);
|
|
52773
|
+
if (cr < bc || (cr === bc && cands[i].d < bd)) { best = cands[i].x; bc = cr; bd = cands[i].d; }
|
|
52774
|
+
}
|
|
52775
|
+
return best;
|
|
52776
|
+
},
|
|
52777
|
+
claim: function(xn, xx, y) { claims.push({ xn: xn, xx: xx, y: y }); },
|
|
52778
|
+
claimV: function(yn, yx, x) { vclaims.push({ yn: yn, yx: yx, x: x }); }
|
|
52779
|
+
};
|
|
52780
|
+
}
|
|
52781
|
+
|
|
52782
|
+
function inflateBox(b, pad) { return { l: b.x - pad, r: b.x + b.w + pad, t: b.y - pad, b: b.y + b.h + pad }; }
|
|
52783
|
+
function segOvlp(xn, xx, y, bx) { return xn < bx.r && xx > bx.l && y >= bx.t && y <= bx.b; }
|
|
52784
|
+
function vSegClear(x, yn, yx, boxes) {
|
|
52785
|
+
for (var i = 0; i < boxes.length; i++) { var b = boxes[i]; if (x >= b.l && x <= b.r && yn < b.b && yx > b.t) return false; }
|
|
52786
|
+
return true;
|
|
52787
|
+
}
|
|
52788
|
+
|
|
52789
|
+
function findClearY(xn, xx, cy, boxes) {
|
|
52790
|
+
var blocked = function(y) { for (var i = 0; i < boxes.length; i++) if (segOvlp(xn, xx, y, boxes[i])) return true; return false; };
|
|
52791
|
+
if (!blocked(cy)) return cy;
|
|
52792
|
+
var edges = [];
|
|
52793
|
+
for (var i = 0; i < boxes.length; i++) { var b = boxes[i]; if (xn < b.r && xx > b.l) { edges.push(b.t); edges.push(b.b); } }
|
|
52794
|
+
if (!edges.length) return cy;
|
|
52795
|
+
edges.sort(function(a, b) { return a - b; });
|
|
52796
|
+
var best = cy, bd = Infinity;
|
|
52797
|
+
for (var i = 0; i < edges.length; i++) {
|
|
52798
|
+
var vals = [edges[i] - EDGE_OFFSET, edges[i] + EDGE_OFFSET];
|
|
52799
|
+
for (var j = 0; j < 2; j++) { if (!blocked(vals[j])) { var d = Math.abs(vals[j] - cy); if (d < bd) { bd = d; best = vals[j]; } } }
|
|
52800
|
+
}
|
|
52801
|
+
if (bd === Infinity) {
|
|
52802
|
+
var mn = Math.min.apply(null, edges) - EDGE_OFFSET * 2, mx = Math.max.apply(null, edges) + EDGE_OFFSET * 2;
|
|
52803
|
+
best = Math.abs(mn - cy) <= Math.abs(mx - cy) ? mn : mx;
|
|
52804
|
+
if (blocked(best)) { for (var off = TRACK_SPACING; off < 800; off += TRACK_SPACING) { if (!blocked(best - off)) { best -= off; break; } if (!blocked(best + off)) { best += off; break; } } }
|
|
52805
|
+
}
|
|
52806
|
+
return best;
|
|
52807
|
+
}
|
|
52808
|
+
|
|
52809
|
+
function findClearX(yn, yx, cx, boxes) {
|
|
52810
|
+
var blocked = function(x) { for (var i = 0; i < boxes.length; i++) { var b = boxes[i]; if (x >= b.l && x <= b.r && yn < b.b && yx > b.t) return true; } return false; };
|
|
52811
|
+
if (!blocked(cx)) return cx;
|
|
52812
|
+
var edges = [];
|
|
52813
|
+
for (var i = 0; i < boxes.length; i++) { var b = boxes[i]; if (yn < b.b && yx > b.t) { edges.push(b.l); edges.push(b.r); } }
|
|
52814
|
+
if (!edges.length) return cx;
|
|
52815
|
+
edges.sort(function(a, b) { return a - b; });
|
|
52816
|
+
var best = cx, bd = Infinity;
|
|
52817
|
+
for (var i = 0; i < edges.length; i++) {
|
|
52818
|
+
var vals = [edges[i] - EDGE_OFFSET, edges[i] + EDGE_OFFSET];
|
|
52819
|
+
for (var j = 0; j < 2; j++) { if (!blocked(vals[j])) { var d = Math.abs(vals[j] - cx); if (d < bd) { bd = d; best = vals[j]; } } }
|
|
52820
|
+
}
|
|
52821
|
+
if (bd === Infinity) {
|
|
52822
|
+
var mn = Math.min.apply(null, edges) - EDGE_OFFSET * 2, mx = Math.max.apply(null, edges) + EDGE_OFFSET * 2;
|
|
52823
|
+
best = Math.abs(mn - cx) <= Math.abs(mx - cx) ? mn : mx;
|
|
52824
|
+
if (blocked(best)) { for (var off = TRACK_SPACING; off < 800; off += TRACK_SPACING) { if (!blocked(best - off)) { best -= off; break; } if (!blocked(best + off)) { best += off; break; } } }
|
|
52825
|
+
}
|
|
52826
|
+
return best;
|
|
52827
|
+
}
|
|
52828
|
+
|
|
52829
|
+
function simplifyWaypoints(pts) {
|
|
52830
|
+
if (pts.length <= 2) return pts;
|
|
52831
|
+
var jogFound = true;
|
|
52832
|
+
while (jogFound) {
|
|
52833
|
+
jogFound = false;
|
|
52834
|
+
for (var i = 0; i < pts.length - 3; i++) {
|
|
52835
|
+
var a = pts[i], b = pts[i+1], c = pts[i+2], d = pts[i+3];
|
|
52836
|
+
var jogH = Math.abs(b[1] - c[1]);
|
|
52837
|
+
if (Math.abs(a[1] - b[1]) < 0.5 && Math.abs(b[0] - c[0]) < 0.5 && Math.abs(c[1] - d[1]) < 0.5 && jogH > 0.5 && jogH < JOG_THRESHOLD) {
|
|
52838
|
+
var mid = (b[1] + c[1]) / 2, snap = Math.abs(a[1] - mid) <= Math.abs(d[1] - mid) ? a[1] : d[1];
|
|
52839
|
+
pts = pts.slice(); pts[i+1] = [b[0], snap]; pts[i+2] = [c[0], snap]; jogFound = true; break;
|
|
52840
|
+
}
|
|
52841
|
+
var jogW = Math.abs(b[0] - c[0]);
|
|
52842
|
+
if (Math.abs(a[0] - b[0]) < 0.5 && Math.abs(b[1] - c[1]) < 0.5 && Math.abs(c[0] - d[0]) < 0.5 && jogW > 0.5 && jogW < JOG_THRESHOLD) {
|
|
52843
|
+
var mid = (b[0] + c[0]) / 2, snap = Math.abs(a[0] - mid) <= Math.abs(d[0] - mid) ? a[0] : d[0];
|
|
52844
|
+
pts = pts.slice(); pts[i+1] = [snap, b[1]]; pts[i+2] = [snap, c[1]]; jogFound = true; break;
|
|
52845
|
+
}
|
|
52846
|
+
}
|
|
52847
|
+
}
|
|
52848
|
+
var res = [pts[0]];
|
|
52849
|
+
for (var i = 1; i < pts.length - 1; i++) {
|
|
52850
|
+
var prev = res[res.length - 1], cur = pts[i], next = pts[i+1];
|
|
52851
|
+
if (Math.abs(prev[0] - cur[0]) + Math.abs(prev[1] - cur[1]) < MIN_SEG_LEN) continue;
|
|
52852
|
+
var sameX = Math.abs(prev[0] - cur[0]) < 0.01 && Math.abs(cur[0] - next[0]) < 0.01;
|
|
52853
|
+
var sameY = Math.abs(prev[1] - cur[1]) < 0.01 && Math.abs(cur[1] - next[1]) < 0.01;
|
|
52854
|
+
if (!sameX && !sameY) res.push(cur);
|
|
52855
|
+
}
|
|
52856
|
+
res.push(pts[pts.length - 1]);
|
|
52857
|
+
return res;
|
|
52858
|
+
}
|
|
52859
|
+
|
|
52860
|
+
function waypointsToPath(wp, cr) {
|
|
52861
|
+
if (wp.length < 2) return '';
|
|
52862
|
+
if (wp.length === 2) return 'M ' + wp[0][0] + ',' + wp[0][1] + ' L ' + wp[1][0] + ',' + wp[1][1];
|
|
52863
|
+
var radii = [];
|
|
52864
|
+
for (var i = 0; i < wp.length; i++) radii[i] = 0;
|
|
52865
|
+
for (var i = 1; i < wp.length - 1; i++) {
|
|
52866
|
+
var p = wp[i-1], c = wp[i], n = wp[i+1];
|
|
52867
|
+
var lp = Math.sqrt((p[0]-c[0])*(p[0]-c[0]) + (p[1]-c[1])*(p[1]-c[1]));
|
|
52868
|
+
var ln = Math.sqrt((n[0]-c[0])*(n[0]-c[0]) + (n[1]-c[1])*(n[1]-c[1]));
|
|
52869
|
+
radii[i] = (lp < 0.01 || ln < 0.01) ? 0 : Math.min(cr, lp / 2, ln / 2);
|
|
52870
|
+
}
|
|
52871
|
+
for (var i = 1; i < wp.length - 2; i++) {
|
|
52872
|
+
var c = wp[i], n = wp[i+1];
|
|
52873
|
+
var sl = Math.sqrt((n[0]-c[0])*(n[0]-c[0]) + (n[1]-c[1])*(n[1]-c[1]));
|
|
52874
|
+
var tot = radii[i] + radii[i+1];
|
|
52875
|
+
if (tot > sl && tot > 0) { var sc = sl / tot; radii[i] *= sc; radii[i+1] *= sc; }
|
|
52876
|
+
}
|
|
52877
|
+
var path = 'M ' + wp[0][0] + ',' + wp[0][1];
|
|
52878
|
+
for (var i = 1; i < wp.length - 1; i++) {
|
|
52879
|
+
var p = wp[i-1], c = wp[i], n = wp[i+1], r = radii[i];
|
|
52880
|
+
if (r < 2) { path += ' L ' + c[0] + ',' + c[1]; continue; }
|
|
52881
|
+
var dpx = p[0]-c[0], dpy = p[1]-c[1], dnx = n[0]-c[0], dny = n[1]-c[1];
|
|
52882
|
+
var lp = Math.sqrt(dpx*dpx + dpy*dpy), ln = Math.sqrt(dnx*dnx + dny*dny);
|
|
52883
|
+
var upx = dpx/lp, upy = dpy/lp, unx = dnx/ln, uny = dny/ln;
|
|
52884
|
+
var asx = c[0] + upx*r, asy = c[1] + upy*r, aex = c[0] + unx*r, aey = c[1] + uny*r;
|
|
52885
|
+
var cross = dpx*dny - dpy*dnx, sweep = cross > 0 ? 0 : 1;
|
|
52886
|
+
path += ' L ' + asx + ',' + asy + ' A ' + r + ' ' + r + ' 0 0 ' + sweep + ' ' + aex + ',' + aey;
|
|
52887
|
+
}
|
|
52888
|
+
path += ' L ' + wp[wp.length-1][0] + ',' + wp[wp.length-1][1];
|
|
52889
|
+
return path;
|
|
52890
|
+
}
|
|
52891
|
+
|
|
52892
|
+
function computeWaypoints(from, to, nboxes, srcId, tgtId, pad, exitStub, entryStub, alloc) {
|
|
52893
|
+
var isSelf = srcId === tgtId;
|
|
52894
|
+
var iboxes = [];
|
|
52895
|
+
for (var i = 0; i < nboxes.length; i++) {
|
|
52896
|
+
var b = nboxes[i];
|
|
52897
|
+
if (isSelf || (b.id !== srcId && b.id !== tgtId)) iboxes.push(inflateBox(b, pad));
|
|
52898
|
+
}
|
|
52899
|
+
var se = [from[0] + exitStub, from[1]], sn = [to[0] - entryStub, to[1]];
|
|
52900
|
+
var xn = Math.min(se[0], sn[0]), xx = Math.max(se[0], sn[0]);
|
|
52901
|
+
|
|
52902
|
+
if (!isSelf && to[0] > from[0]) {
|
|
52903
|
+
var cy = (from[1] + to[1]) / 2;
|
|
52904
|
+
var intBoxes = [];
|
|
52905
|
+
for (var i = 0; i < iboxes.length; i++) { var b = iboxes[i]; if (b.l < xx && b.r > xn) intBoxes.push(b); }
|
|
52906
|
+
if (intBoxes.length >= 2) {
|
|
52907
|
+
var ct = Infinity, cb = -Infinity;
|
|
52908
|
+
for (var i = 0; i < intBoxes.length; i++) { ct = Math.min(ct, intBoxes[i].t); cb = Math.max(cb, intBoxes[i].b); }
|
|
52909
|
+
if (cy > ct && cy < cb) { cy = (cy - ct <= cb - cy) ? ct - pad : cb + pad; }
|
|
52910
|
+
}
|
|
52911
|
+
var clearY = findClearY(xn, xx, cy, iboxes);
|
|
52912
|
+
if (Math.abs(from[1] - to[1]) < JOG_THRESHOLD && Math.abs(clearY - from[1]) < JOG_THRESHOLD) return null;
|
|
52913
|
+
|
|
52914
|
+
var midX = (se[0] + sn[0]) / 2, ymn = Math.min(from[1], to[1]), ymx = Math.max(from[1], to[1]);
|
|
52915
|
+
var cmx = findClearX(ymn, ymx, midX, iboxes);
|
|
52916
|
+
var fmx = alloc.findFreeX(ymn, ymx, cmx, iboxes);
|
|
52917
|
+
if (ymx - ymn >= JOG_THRESHOLD && fmx > se[0] && fmx < sn[0] &&
|
|
52918
|
+
vSegClear(fmx, ymn, ymx, iboxes) &&
|
|
52919
|
+
alloc.findFreeY(from[0], fmx, from[1], iboxes) === from[1] &&
|
|
52920
|
+
alloc.findFreeY(fmx, to[0], to[1], iboxes) === to[1]) {
|
|
52921
|
+
alloc.claim(from[0], fmx, from[1]); alloc.claim(fmx, to[0], to[1]); alloc.claimV(ymn, ymx, fmx);
|
|
52922
|
+
return simplifyWaypoints([from, [fmx, from[1]], [fmx, to[1]], to]);
|
|
52923
|
+
}
|
|
52924
|
+
|
|
52925
|
+
clearY = alloc.findFreeY(xn, xx, clearY, iboxes);
|
|
52926
|
+
if (Math.abs(clearY - from[1]) < JOG_THRESHOLD && !iboxes.some(function(b) { return segOvlp(xn, xx, from[1], b); })) clearY = from[1];
|
|
52927
|
+
else if (Math.abs(clearY - to[1]) < JOG_THRESHOLD && !iboxes.some(function(b) { return segOvlp(xn, xx, to[1], b); })) clearY = to[1];
|
|
52928
|
+
alloc.claim(xn, xx, clearY);
|
|
52929
|
+
|
|
52930
|
+
var eymn = Math.min(from[1], clearY), eymx = Math.max(from[1], clearY);
|
|
52931
|
+
var exX = findClearX(eymn, eymx, se[0], iboxes); exX = alloc.findFreeX(eymn, eymx, exX, iboxes);
|
|
52932
|
+
if (exX < from[0]) { exX = se[0]; if (!vSegClear(exX, eymn, eymx, iboxes)) { exX = findClearX(eymn, eymx, se[0] + TRACK_SPACING, iboxes); exX = alloc.findFreeX(eymn, eymx, exX, iboxes); } }
|
|
52933
|
+
alloc.claimV(eymn, eymx, exX);
|
|
52934
|
+
|
|
52935
|
+
var nymn = Math.min(to[1], clearY), nymx = Math.max(to[1], clearY);
|
|
52936
|
+
var nxX = findClearX(nymn, nymx, sn[0], iboxes); nxX = alloc.findFreeX(nymn, nymx, nxX, iboxes);
|
|
52937
|
+
if (nxX > to[0]) { nxX = sn[0]; if (!vSegClear(nxX, nymn, nymx, iboxes)) { nxX = findClearX(nymn, nymx, sn[0] - TRACK_SPACING, iboxes); nxX = alloc.findFreeX(nymn, nymx, nxX, iboxes); } }
|
|
52938
|
+
alloc.claimV(nymn, nymx, nxX);
|
|
52939
|
+
|
|
52940
|
+
return simplifyWaypoints([from, [exX, from[1]], [exX, clearY], [nxX, clearY], [nxX, to[1]], to]);
|
|
52941
|
+
} else {
|
|
52942
|
+
var srcBox = null, tgtBox = null;
|
|
52943
|
+
for (var i = 0; i < nboxes.length; i++) { if (nboxes[i].id === srcId) srcBox = nboxes[i]; if (nboxes[i].id === tgtId) tgtBox = nboxes[i]; }
|
|
52944
|
+
var corBoxes = []; for (var i = 0; i < iboxes.length; i++) { var b = iboxes[i]; if (b.l < xx && b.r > xn) corBoxes.push(b); }
|
|
52945
|
+
var bots = corBoxes.map(function(b) { return b.b; }), tops = corBoxes.map(function(b) { return b.t; });
|
|
52946
|
+
if (srcBox) { bots.push(srcBox.y + srcBox.h + pad); tops.push(srcBox.y - pad); }
|
|
52947
|
+
if (tgtBox) { bots.push(tgtBox.y + tgtBox.h + pad); tops.push(tgtBox.y - pad); }
|
|
52948
|
+
var maxBot = Math.max.apply(null, bots.concat([from[1] + 50, to[1] + 50]));
|
|
52949
|
+
var minTop = Math.min.apply(null, tops.concat([from[1] - 50, to[1] - 50]));
|
|
52950
|
+
var avgY = (from[1] + to[1]) / 2;
|
|
52951
|
+
var escBelow = maxBot + pad, escAbove = minTop - pad;
|
|
52952
|
+
var escY = Math.abs(escAbove - avgY) <= Math.abs(escBelow - avgY) ? escAbove : escBelow;
|
|
52953
|
+
escY = findClearY(xn, xx, escY, iboxes); escY = alloc.findFreeY(xn, xx, escY, iboxes); alloc.claim(xn, xx, escY);
|
|
52954
|
+
|
|
52955
|
+
var bymn = Math.min(from[1], escY), bymx = Math.max(from[1], escY);
|
|
52956
|
+
var bexX = findClearX(bymn, bymx, se[0], iboxes); bexX = alloc.findFreeX(bymn, bymx, bexX, iboxes); alloc.claimV(bymn, bymx, bexX);
|
|
52957
|
+
|
|
52958
|
+
var bnmn = Math.min(to[1], escY), bnmx = Math.max(to[1], escY);
|
|
52959
|
+
var bnxX = findClearX(bnmn, bnmx, sn[0], iboxes); bnxX = alloc.findFreeX(bnmn, bnmx, bnxX, iboxes); alloc.claimV(bnmn, bnmx, bnxX);
|
|
52960
|
+
|
|
52961
|
+
return simplifyWaypoints([from, [bexX, from[1]], [bexX, escY], [bnxX, escY], [bnxX, to[1]], to]);
|
|
52962
|
+
}
|
|
52963
|
+
}
|
|
52964
|
+
|
|
52965
|
+
function calcOrthogonalPath(from, to, nboxes, srcId, tgtId, fromIdx, toIdx, alloc) {
|
|
52966
|
+
var pad = 15, stubLen = 20, stubSpc = 12, maxStub = 80, cr = 10;
|
|
52967
|
+
var exitStub = Math.min(stubLen + fromIdx * stubSpc, maxStub);
|
|
52968
|
+
var entryStub = Math.min(stubLen + toIdx * stubSpc, maxStub);
|
|
52969
|
+
try {
|
|
52970
|
+
var wp = computeWaypoints(from, to, nboxes, srcId, tgtId, pad, exitStub, entryStub, alloc);
|
|
52971
|
+
if (!wp) return null;
|
|
52972
|
+
var p = waypointsToPath(wp, cr);
|
|
52973
|
+
return (p && p.length >= 5) ? p : null;
|
|
52974
|
+
} catch (e) { return null; }
|
|
52975
|
+
}
|
|
52976
|
+
|
|
52977
|
+
// ---- Port position + node box + connection path indexes ----
|
|
52614
52978
|
var portPositions = {};
|
|
52615
52979
|
content.querySelectorAll('[data-port-id]').forEach(function(el) {
|
|
52616
52980
|
var id = el.getAttribute('data-port-id');
|
|
52617
52981
|
portPositions[id] = { cx: parseFloat(el.getAttribute('cx')), cy: parseFloat(el.getAttribute('cy')) };
|
|
52618
52982
|
});
|
|
52619
52983
|
|
|
52984
|
+
// Extract node bounding boxes from SVG rect elements
|
|
52985
|
+
var nodeBoxMap = {};
|
|
52986
|
+
content.querySelectorAll('.nodes [data-node-id]').forEach(function(g) {
|
|
52987
|
+
var nid = g.getAttribute('data-node-id');
|
|
52988
|
+
var rect = g.querySelector(':scope > rect');
|
|
52989
|
+
if (!rect) return;
|
|
52990
|
+
nodeBoxMap[nid] = {
|
|
52991
|
+
id: nid,
|
|
52992
|
+
x: parseFloat(rect.getAttribute('x')),
|
|
52993
|
+
y: parseFloat(rect.getAttribute('y')),
|
|
52994
|
+
w: parseFloat(rect.getAttribute('width')),
|
|
52995
|
+
h: parseFloat(rect.getAttribute('height'))
|
|
52996
|
+
};
|
|
52997
|
+
});
|
|
52998
|
+
|
|
52999
|
+
// Build port-to-node mapping and compute port indices within each node
|
|
53000
|
+
var portNodeMap = {};
|
|
53001
|
+
var portIndexMap = {};
|
|
53002
|
+
content.querySelectorAll('[data-port-id]').forEach(function(el) {
|
|
53003
|
+
var id = el.getAttribute('data-port-id');
|
|
53004
|
+
var dir = el.getAttribute('data-direction');
|
|
53005
|
+
var parts = id.split('.');
|
|
53006
|
+
var nodeId = parts[0];
|
|
53007
|
+
portNodeMap[id] = nodeId;
|
|
53008
|
+
if (!portIndexMap[nodeId]) portIndexMap[nodeId] = { input: [], output: [] };
|
|
53009
|
+
portIndexMap[nodeId][dir].push(id);
|
|
53010
|
+
});
|
|
53011
|
+
|
|
52620
53012
|
var nodeOffsets = {};
|
|
52621
53013
|
var connIndex = [];
|
|
52622
53014
|
content.querySelectorAll('path[data-source]').forEach(function(p) {
|
|
52623
53015
|
var src = p.getAttribute('data-source'), tgt = p.getAttribute('data-target');
|
|
52624
|
-
|
|
53016
|
+
var srcNode = src.split('.')[0], tgtNode = tgt.split('.')[0];
|
|
53017
|
+
var srcIdx = portIndexMap[srcNode] ? portIndexMap[srcNode].output.indexOf(src) : 0;
|
|
53018
|
+
var tgtIdx = portIndexMap[tgtNode] ? portIndexMap[tgtNode].input.indexOf(tgt) : 0;
|
|
53019
|
+
connIndex.push({ el: p, src: src, tgt: tgt, srcNode: srcNode, tgtNode: tgtNode,
|
|
53020
|
+
scopeOf: p.getAttribute('data-scope') || null, srcIdx: Math.max(0, srcIdx), tgtIdx: Math.max(0, tgtIdx) });
|
|
52625
53021
|
});
|
|
52626
53022
|
|
|
52627
53023
|
// Snapshot of original port positions for reset
|
|
@@ -52629,6 +53025,47 @@ path[data-source].port-hover { opacity: 1; }
|
|
|
52629
53025
|
for (var pid in portPositions) {
|
|
52630
53026
|
origPortPositions[pid] = { cx: portPositions[pid].cx, cy: portPositions[pid].cy };
|
|
52631
53027
|
}
|
|
53028
|
+
var origNodeBoxMap = {};
|
|
53029
|
+
for (var nid in nodeBoxMap) {
|
|
53030
|
+
var b = nodeBoxMap[nid];
|
|
53031
|
+
origNodeBoxMap[nid] = { id: b.id, x: b.x, y: b.y, w: b.w, h: b.h };
|
|
53032
|
+
}
|
|
53033
|
+
|
|
53034
|
+
// ---- Recalculate all connection paths using orthogonal + bezier routing ----
|
|
53035
|
+
function recalcAllPaths() {
|
|
53036
|
+
var boxes = [];
|
|
53037
|
+
for (var nid in nodeBoxMap) boxes.push(nodeBoxMap[nid]);
|
|
53038
|
+
var sorted = connIndex.slice().sort(function(a, b) {
|
|
53039
|
+
var spa = portPositions[a.src] && portPositions[a.tgt] ? Math.abs(portPositions[a.tgt].cx - portPositions[a.src].cx) : 0;
|
|
53040
|
+
var spb = portPositions[b.src] && portPositions[b.tgt] ? Math.abs(portPositions[b.tgt].cx - portPositions[b.src].cx) : 0;
|
|
53041
|
+
if (Math.abs(spa - spb) > 1) return spa - spb;
|
|
53042
|
+
var sxa = portPositions[a.src] ? portPositions[a.src].cx : 0, sxb = portPositions[b.src] ? portPositions[b.src].cx : 0;
|
|
53043
|
+
if (Math.abs(sxa - sxb) > 1) return sxa - sxb;
|
|
53044
|
+
var sya = portPositions[a.src] ? portPositions[a.src].cy : 0, syb = portPositions[b.src] ? portPositions[b.src].cy : 0;
|
|
53045
|
+
return sya - syb;
|
|
53046
|
+
});
|
|
53047
|
+
var alloc = createAllocator();
|
|
53048
|
+
for (var i = 0; i < sorted.length; i++) {
|
|
53049
|
+
var c = sorted[i];
|
|
53050
|
+
var sp = portPositions[c.src], tp = portPositions[c.tgt];
|
|
53051
|
+
if (!sp || !tp) continue;
|
|
53052
|
+
var sx = sp.cx, sy = sp.cy, tx = tp.cx, ty = tp.cy;
|
|
53053
|
+
// For scope connections, use parent-local coords
|
|
53054
|
+
if (c.scopeOf) {
|
|
53055
|
+
var pOff = nodeOffsets[c.scopeOf] || { dx: 0, dy: 0 };
|
|
53056
|
+
sx -= pOff.dx; sy -= pOff.dy; tx -= pOff.dx; ty -= pOff.dy;
|
|
53057
|
+
}
|
|
53058
|
+
var ddx = tx - sx, ddy = ty - sy, dist = Math.sqrt(ddx * ddx + ddy * ddy);
|
|
53059
|
+
var path;
|
|
53060
|
+
if (dist > ORTHO_THRESHOLD) {
|
|
53061
|
+
path = calcOrthogonalPath([sx, sy], [tx, ty], boxes, c.srcNode, c.tgtNode, c.srcIdx, c.tgtIdx, alloc);
|
|
53062
|
+
if (!path) path = computeConnectionPath(sx, sy, tx, ty);
|
|
53063
|
+
} else {
|
|
53064
|
+
path = computeConnectionPath(sx, sy, tx, ty);
|
|
53065
|
+
}
|
|
53066
|
+
c.el.setAttribute('d', path);
|
|
53067
|
+
}
|
|
53068
|
+
}
|
|
52632
53069
|
|
|
52633
53070
|
function resetLayout() {
|
|
52634
53071
|
for (var nid in nodeOffsets) {
|
|
@@ -52648,10 +53085,11 @@ path[data-source].port-hover { opacity: 1; }
|
|
|
52648
53085
|
for (var pid in origPortPositions) {
|
|
52649
53086
|
portPositions[pid] = { cx: origPortPositions[pid].cx, cy: origPortPositions[pid].cy };
|
|
52650
53087
|
}
|
|
52651
|
-
|
|
52652
|
-
var
|
|
52653
|
-
|
|
52654
|
-
}
|
|
53088
|
+
for (var nid in origNodeBoxMap) {
|
|
53089
|
+
var b = origNodeBoxMap[nid];
|
|
53090
|
+
nodeBoxMap[nid] = { id: b.id, x: b.x, y: b.y, w: b.w, h: b.h };
|
|
53091
|
+
}
|
|
53092
|
+
recalcAllPaths();
|
|
52655
53093
|
fitToView();
|
|
52656
53094
|
}
|
|
52657
53095
|
document.getElementById('btn-reset').addEventListener('click', resetLayout);
|
|
@@ -52721,39 +53159,24 @@ path[data-source].port-hover { opacity: 1; }
|
|
|
52721
53159
|
});
|
|
52722
53160
|
}
|
|
52723
53161
|
|
|
52724
|
-
//
|
|
52725
|
-
|
|
52726
|
-
|
|
52727
|
-
if (
|
|
52728
|
-
|
|
52729
|
-
|
|
52730
|
-
|
|
52731
|
-
|
|
52732
|
-
|
|
52733
|
-
|
|
52734
|
-
|
|
52735
|
-
|
|
52736
|
-
}
|
|
53162
|
+
// Update node box positions for orthogonal routing
|
|
53163
|
+
if (nodeBoxMap[nodeId]) {
|
|
53164
|
+
var nb = origNodeBoxMap[nodeId];
|
|
53165
|
+
if (nb) nodeBoxMap[nodeId] = { id: nb.id, x: nb.x + off.dx, y: nb.y + off.dy, w: nb.w, h: nb.h };
|
|
53166
|
+
}
|
|
53167
|
+
if (nodeG) {
|
|
53168
|
+
var children = nodeG.querySelectorAll(':scope > g[data-node-id]');
|
|
53169
|
+
children.forEach(function(childG) {
|
|
53170
|
+
var childId = childG.getAttribute('data-node-id');
|
|
53171
|
+
var cnb = origNodeBoxMap[childId];
|
|
53172
|
+
if (cnb && nodeOffsets[childId]) {
|
|
53173
|
+
nodeBoxMap[childId] = { id: cnb.id, x: cnb.x + nodeOffsets[childId].dx, y: cnb.y + nodeOffsets[childId].dy, w: cnb.w, h: cnb.h };
|
|
52737
53174
|
}
|
|
52738
|
-
}
|
|
52739
|
-
|
|
52740
|
-
|
|
52741
|
-
|
|
52742
|
-
|
|
52743
|
-
if (c.srcNode === childId || c.tgtNode === childId) {
|
|
52744
|
-
var sp = portPositions[c.src], tp = portPositions[c.tgt];
|
|
52745
|
-
if (sp && tp) {
|
|
52746
|
-
if (c.scopeOf) {
|
|
52747
|
-
var pOff = nodeOffsets[c.scopeOf] || { dx: 0, dy: 0 };
|
|
52748
|
-
c.el.setAttribute('d', computeConnectionPath(sp.cx - pOff.dx, sp.cy - pOff.dy, tp.cx - pOff.dx, tp.cy - pOff.dy));
|
|
52749
|
-
} else {
|
|
52750
|
-
c.el.setAttribute('d', computeConnectionPath(sp.cx, sp.cy, tp.cx, tp.cy));
|
|
52751
|
-
}
|
|
52752
|
-
}
|
|
52753
|
-
}
|
|
52754
|
-
});
|
|
52755
|
-
}
|
|
52756
|
-
});
|
|
53175
|
+
});
|
|
53176
|
+
}
|
|
53177
|
+
|
|
53178
|
+
// Recalculate all connection paths with orthogonal routing
|
|
53179
|
+
recalcAllPaths();
|
|
52757
53180
|
}
|
|
52758
53181
|
|
|
52759
53182
|
var allLabelIds = Object.keys(labelMap);
|
|
@@ -54736,15 +55159,15 @@ var require_route = __commonJS({
|
|
|
54736
55159
|
};
|
|
54737
55160
|
}
|
|
54738
55161
|
function wrapConversion(toModel, graph) {
|
|
54739
|
-
const
|
|
55162
|
+
const path56 = [graph[toModel].parent, toModel];
|
|
54740
55163
|
let fn = conversions[graph[toModel].parent][toModel];
|
|
54741
55164
|
let cur = graph[toModel].parent;
|
|
54742
55165
|
while (graph[cur].parent) {
|
|
54743
|
-
|
|
55166
|
+
path56.unshift(graph[cur].parent);
|
|
54744
55167
|
fn = link(conversions[graph[cur].parent][cur], fn);
|
|
54745
55168
|
cur = graph[cur].parent;
|
|
54746
55169
|
}
|
|
54747
|
-
fn.conversion =
|
|
55170
|
+
fn.conversion = path56;
|
|
54748
55171
|
return fn;
|
|
54749
55172
|
}
|
|
54750
55173
|
module2.exports = function(fromModel) {
|
|
@@ -67050,8 +67473,8 @@ var require_utils = __commonJS({
|
|
|
67050
67473
|
}
|
|
67051
67474
|
return ind;
|
|
67052
67475
|
}
|
|
67053
|
-
function removeDotSegments(
|
|
67054
|
-
let input =
|
|
67476
|
+
function removeDotSegments(path56) {
|
|
67477
|
+
let input = path56;
|
|
67055
67478
|
const output = [];
|
|
67056
67479
|
let nextSlash = -1;
|
|
67057
67480
|
let len = 0;
|
|
@@ -67250,8 +67673,8 @@ var require_schemes = __commonJS({
|
|
|
67250
67673
|
wsComponent.secure = void 0;
|
|
67251
67674
|
}
|
|
67252
67675
|
if (wsComponent.resourceName) {
|
|
67253
|
-
const [
|
|
67254
|
-
wsComponent.path =
|
|
67676
|
+
const [path56, query] = wsComponent.resourceName.split("?");
|
|
67677
|
+
wsComponent.path = path56 && path56 !== "/" ? path56 : void 0;
|
|
67255
67678
|
wsComponent.query = query;
|
|
67256
67679
|
wsComponent.resourceName = void 0;
|
|
67257
67680
|
}
|
|
@@ -71649,8 +72072,8 @@ var init_generator = __esm({
|
|
|
71649
72072
|
doc.paths["/health"] = this.generateHealthEndpoint();
|
|
71650
72073
|
doc.paths["/workflows"] = this.generateListEndpoint();
|
|
71651
72074
|
for (const endpoint of endpoints) {
|
|
71652
|
-
const
|
|
71653
|
-
doc.paths[
|
|
72075
|
+
const path56 = options.basePath ? `${options.basePath}${endpoint.path}` : endpoint.path;
|
|
72076
|
+
doc.paths[path56] = this.generateWorkflowEndpoint(endpoint);
|
|
71654
72077
|
}
|
|
71655
72078
|
return doc;
|
|
71656
72079
|
}
|
|
@@ -72789,6 +73212,66 @@ var init_deployment = __esm({
|
|
|
72789
73212
|
}
|
|
72790
73213
|
});
|
|
72791
73214
|
|
|
73215
|
+
// src/cli/pack-commands.ts
|
|
73216
|
+
var pack_commands_exports = {};
|
|
73217
|
+
__export(pack_commands_exports, {
|
|
73218
|
+
registerPackCommands: () => registerPackCommands
|
|
73219
|
+
});
|
|
73220
|
+
import * as path55 from "path";
|
|
73221
|
+
function deriveNamespace(packageName) {
|
|
73222
|
+
const base = packageName.replace(/^@[^/]+\//, "");
|
|
73223
|
+
return base.replace(/^flowweaver-pack-/, "");
|
|
73224
|
+
}
|
|
73225
|
+
async function registerPackCommands(program3) {
|
|
73226
|
+
const projectDir = process.cwd();
|
|
73227
|
+
let packages;
|
|
73228
|
+
try {
|
|
73229
|
+
packages = await listInstalledPackages(projectDir);
|
|
73230
|
+
} catch {
|
|
73231
|
+
return;
|
|
73232
|
+
}
|
|
73233
|
+
for (const pkg of packages) {
|
|
73234
|
+
const manifest = pkg.manifest;
|
|
73235
|
+
if (!manifest.cliEntrypoint || !manifest.cliCommands?.length) continue;
|
|
73236
|
+
const namespace = deriveNamespace(pkg.name);
|
|
73237
|
+
const entrypointPath = path55.join(pkg.path, manifest.cliEntrypoint);
|
|
73238
|
+
const group = program3.command(namespace).description(`Commands from ${pkg.name}`);
|
|
73239
|
+
for (const cmd of manifest.cliCommands) {
|
|
73240
|
+
const sub = group.command(cmd.name).description(cmd.description);
|
|
73241
|
+
if (cmd.usage) {
|
|
73242
|
+
sub.argument(cmd.usage);
|
|
73243
|
+
}
|
|
73244
|
+
if (cmd.options) {
|
|
73245
|
+
for (const opt of cmd.options) {
|
|
73246
|
+
if (opt.default !== void 0) {
|
|
73247
|
+
sub.option(opt.flags, opt.description, String(opt.default));
|
|
73248
|
+
} else {
|
|
73249
|
+
sub.option(opt.flags, opt.description);
|
|
73250
|
+
}
|
|
73251
|
+
}
|
|
73252
|
+
}
|
|
73253
|
+
sub.allowUnknownOption(true);
|
|
73254
|
+
sub.action(async (...actionArgs) => {
|
|
73255
|
+
try {
|
|
73256
|
+
const bridge = await import(entrypointPath);
|
|
73257
|
+
const rawArgs = sub.args ?? [];
|
|
73258
|
+
await bridge.handleCommand(cmd.name, rawArgs);
|
|
73259
|
+
} catch (err) {
|
|
73260
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
73261
|
+
console.error(`Error running ${namespace} ${cmd.name}: ${msg}`);
|
|
73262
|
+
process.exit(1);
|
|
73263
|
+
}
|
|
73264
|
+
});
|
|
73265
|
+
}
|
|
73266
|
+
}
|
|
73267
|
+
}
|
|
73268
|
+
var init_pack_commands = __esm({
|
|
73269
|
+
"src/cli/pack-commands.ts"() {
|
|
73270
|
+
"use strict";
|
|
73271
|
+
init_registry();
|
|
73272
|
+
}
|
|
73273
|
+
});
|
|
73274
|
+
|
|
72792
73275
|
// src/cli/env-setup.ts
|
|
72793
73276
|
if (process.env.FORCE_COLOR === "0") {
|
|
72794
73277
|
process.env.NO_COLOR = "1";
|
|
@@ -74507,17 +74990,17 @@ function buildAdjacency(ast) {
|
|
|
74507
74990
|
function enumeratePaths(ast) {
|
|
74508
74991
|
const { fromStart, toExit, edges } = buildAdjacency(ast);
|
|
74509
74992
|
const paths = [];
|
|
74510
|
-
function dfs(current2,
|
|
74993
|
+
function dfs(current2, path56, visited) {
|
|
74511
74994
|
if (toExit.has(current2)) {
|
|
74512
|
-
paths.push([...
|
|
74995
|
+
paths.push([...path56, "Exit"]);
|
|
74513
74996
|
}
|
|
74514
74997
|
const targets = edges.get(current2) || [];
|
|
74515
74998
|
for (const next of targets) {
|
|
74516
74999
|
if (!visited.has(next)) {
|
|
74517
75000
|
visited.add(next);
|
|
74518
|
-
|
|
74519
|
-
dfs(next,
|
|
74520
|
-
|
|
75001
|
+
path56.push(next);
|
|
75002
|
+
dfs(next, path56, visited);
|
|
75003
|
+
path56.pop();
|
|
74521
75004
|
visited.delete(next);
|
|
74522
75005
|
}
|
|
74523
75006
|
}
|
|
@@ -74531,22 +75014,22 @@ function enumeratePaths(ast) {
|
|
|
74531
75014
|
function buildGraph(ast) {
|
|
74532
75015
|
const { fromStart, toExit, edges } = buildAdjacency(ast);
|
|
74533
75016
|
const lines = [];
|
|
74534
|
-
function dfs(current2,
|
|
75017
|
+
function dfs(current2, path56, visited) {
|
|
74535
75018
|
if (toExit.has(current2)) {
|
|
74536
|
-
lines.push([...
|
|
75019
|
+
lines.push([...path56, "Exit"].join(" -> "));
|
|
74537
75020
|
}
|
|
74538
75021
|
const targets = edges.get(current2) || [];
|
|
74539
75022
|
for (const next of targets) {
|
|
74540
75023
|
if (!visited.has(next)) {
|
|
74541
75024
|
visited.add(next);
|
|
74542
|
-
|
|
74543
|
-
dfs(next,
|
|
74544
|
-
|
|
75025
|
+
path56.push(next);
|
|
75026
|
+
dfs(next, path56, visited);
|
|
75027
|
+
path56.pop();
|
|
74545
75028
|
visited.delete(next);
|
|
74546
75029
|
}
|
|
74547
75030
|
}
|
|
74548
75031
|
if (targets.length === 0 && !toExit.has(current2)) {
|
|
74549
|
-
lines.push(
|
|
75032
|
+
lines.push(path56.join(" -> "));
|
|
74550
75033
|
}
|
|
74551
75034
|
}
|
|
74552
75035
|
fromStart.forEach((startNode) => {
|
|
@@ -81319,12 +81802,12 @@ function parse4(str2) {
|
|
|
81319
81802
|
uri.queryKey = queryKey(uri, uri["query"]);
|
|
81320
81803
|
return uri;
|
|
81321
81804
|
}
|
|
81322
|
-
function pathNames(obj,
|
|
81323
|
-
const regx = /\/{2,9}/g, names =
|
|
81324
|
-
if (
|
|
81805
|
+
function pathNames(obj, path56) {
|
|
81806
|
+
const regx = /\/{2,9}/g, names = path56.replace(regx, "/").split("/");
|
|
81807
|
+
if (path56.slice(0, 1) == "/" || path56.length === 0) {
|
|
81325
81808
|
names.splice(0, 1);
|
|
81326
81809
|
}
|
|
81327
|
-
if (
|
|
81810
|
+
if (path56.slice(-1) == "/") {
|
|
81328
81811
|
names.splice(names.length - 1, 1);
|
|
81329
81812
|
}
|
|
81330
81813
|
return names;
|
|
@@ -81942,7 +82425,7 @@ var protocol2 = Socket.protocol;
|
|
|
81942
82425
|
// node_modules/socket.io-client/build/esm-debug/url.js
|
|
81943
82426
|
var import_debug7 = __toESM(require_src(), 1);
|
|
81944
82427
|
var debug7 = (0, import_debug7.default)("socket.io-client:url");
|
|
81945
|
-
function url(uri,
|
|
82428
|
+
function url(uri, path56 = "", loc) {
|
|
81946
82429
|
let obj = uri;
|
|
81947
82430
|
loc = loc || typeof location !== "undefined" && location;
|
|
81948
82431
|
if (null == uri)
|
|
@@ -81976,7 +82459,7 @@ function url(uri, path54 = "", loc) {
|
|
|
81976
82459
|
obj.path = obj.path || "/";
|
|
81977
82460
|
const ipv62 = obj.host.indexOf(":") !== -1;
|
|
81978
82461
|
const host = ipv62 ? "[" + obj.host + "]" : obj.host;
|
|
81979
|
-
obj.id = obj.protocol + "://" + host + ":" + obj.port +
|
|
82462
|
+
obj.id = obj.protocol + "://" + host + ":" + obj.port + path56;
|
|
81980
82463
|
obj.href = obj.protocol + "://" + host + (loc && loc.port === obj.port ? "" : ":" + obj.port);
|
|
81981
82464
|
return obj;
|
|
81982
82465
|
}
|
|
@@ -83603,8 +84086,8 @@ function lookup(uri, opts) {
|
|
|
83603
84086
|
const parsed = url(uri, opts.path || "/socket.io");
|
|
83604
84087
|
const source = parsed.source;
|
|
83605
84088
|
const id = parsed.id;
|
|
83606
|
-
const
|
|
83607
|
-
const sameNamespace = cache[id] &&
|
|
84089
|
+
const path56 = parsed.path;
|
|
84090
|
+
const sameNamespace = cache[id] && path56 in cache[id]["nsps"];
|
|
83608
84091
|
const newConnection = opts.forceNew || opts["force new connection"] || false === opts.multiplex || sameNamespace;
|
|
83609
84092
|
let io;
|
|
83610
84093
|
if (newConnection) {
|
|
@@ -85323,8 +85806,8 @@ function getErrorMap() {
|
|
|
85323
85806
|
|
|
85324
85807
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
85325
85808
|
var makeIssue = (params) => {
|
|
85326
|
-
const { data, path:
|
|
85327
|
-
const fullPath = [...
|
|
85809
|
+
const { data, path: path56, errorMaps, issueData } = params;
|
|
85810
|
+
const fullPath = [...path56, ...issueData.path || []];
|
|
85328
85811
|
const fullIssue = {
|
|
85329
85812
|
...issueData,
|
|
85330
85813
|
path: fullPath
|
|
@@ -85440,11 +85923,11 @@ var errorUtil;
|
|
|
85440
85923
|
|
|
85441
85924
|
// node_modules/zod/v3/types.js
|
|
85442
85925
|
var ParseInputLazyPath = class {
|
|
85443
|
-
constructor(parent, value2,
|
|
85926
|
+
constructor(parent, value2, path56, key) {
|
|
85444
85927
|
this._cachedPath = [];
|
|
85445
85928
|
this.parent = parent;
|
|
85446
85929
|
this.data = value2;
|
|
85447
|
-
this._path =
|
|
85930
|
+
this._path = path56;
|
|
85448
85931
|
this._key = key;
|
|
85449
85932
|
}
|
|
85450
85933
|
get path() {
|
|
@@ -89081,10 +89564,10 @@ function assignProp(target, prop, value2) {
|
|
|
89081
89564
|
configurable: true
|
|
89082
89565
|
});
|
|
89083
89566
|
}
|
|
89084
|
-
function getElementAtPath(obj,
|
|
89085
|
-
if (!
|
|
89567
|
+
function getElementAtPath(obj, path56) {
|
|
89568
|
+
if (!path56)
|
|
89086
89569
|
return obj;
|
|
89087
|
-
return
|
|
89570
|
+
return path56.reduce((acc, key) => acc?.[key], obj);
|
|
89088
89571
|
}
|
|
89089
89572
|
function promiseAllObject(promisesObj) {
|
|
89090
89573
|
const keys2 = Object.keys(promisesObj);
|
|
@@ -89404,11 +89887,11 @@ function aborted(x, startIndex = 0) {
|
|
|
89404
89887
|
}
|
|
89405
89888
|
return false;
|
|
89406
89889
|
}
|
|
89407
|
-
function prefixIssues(
|
|
89890
|
+
function prefixIssues(path56, issues) {
|
|
89408
89891
|
return issues.map((iss) => {
|
|
89409
89892
|
var _a2;
|
|
89410
89893
|
(_a2 = iss).path ?? (_a2.path = []);
|
|
89411
|
-
iss.path.unshift(
|
|
89894
|
+
iss.path.unshift(path56);
|
|
89412
89895
|
return iss;
|
|
89413
89896
|
});
|
|
89414
89897
|
}
|
|
@@ -103091,6 +103574,34 @@ function registerPrompts(mcp) {
|
|
|
103091
103574
|
}));
|
|
103092
103575
|
}
|
|
103093
103576
|
|
|
103577
|
+
// src/mcp/pack-tools.ts
|
|
103578
|
+
init_registry();
|
|
103579
|
+
import * as path44 from "path";
|
|
103580
|
+
async function registerPackMcpTools(mcp) {
|
|
103581
|
+
const projectDir = process.cwd();
|
|
103582
|
+
let packages;
|
|
103583
|
+
try {
|
|
103584
|
+
packages = await listInstalledPackages(projectDir);
|
|
103585
|
+
} catch {
|
|
103586
|
+
return;
|
|
103587
|
+
}
|
|
103588
|
+
for (const pkg of packages) {
|
|
103589
|
+
const manifest = pkg.manifest;
|
|
103590
|
+
if (!manifest.mcpEntrypoint || !manifest.mcpTools?.length) continue;
|
|
103591
|
+
const entrypointPath = path44.join(pkg.path, manifest.mcpEntrypoint);
|
|
103592
|
+
try {
|
|
103593
|
+
const mod = await import(entrypointPath);
|
|
103594
|
+
if (typeof mod.registerMcpTools === "function") {
|
|
103595
|
+
await mod.registerMcpTools(mcp);
|
|
103596
|
+
}
|
|
103597
|
+
} catch (err) {
|
|
103598
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
103599
|
+
process.stderr.write(`[mcp] Failed to load pack tools from ${pkg.name}: ${msg}
|
|
103600
|
+
`);
|
|
103601
|
+
}
|
|
103602
|
+
}
|
|
103603
|
+
}
|
|
103604
|
+
|
|
103094
103605
|
// src/mcp/server.ts
|
|
103095
103606
|
function parseEventFilterFromEnv() {
|
|
103096
103607
|
const filter3 = {};
|
|
@@ -103143,6 +103654,7 @@ async function startMcpServer(options) {
|
|
|
103143
103654
|
registerContextTools(mcp);
|
|
103144
103655
|
registerResources(mcp, connection, buffer);
|
|
103145
103656
|
registerPrompts(mcp);
|
|
103657
|
+
await registerPackMcpTools(mcp);
|
|
103146
103658
|
if (!options._testDeps && options.stdio) {
|
|
103147
103659
|
const transport = new StdioServerTransport();
|
|
103148
103660
|
await mcp.connect(transport);
|
|
@@ -103320,7 +103832,7 @@ async function grammarCommand(options = {}) {
|
|
|
103320
103832
|
|
|
103321
103833
|
// src/cli/commands/run.ts
|
|
103322
103834
|
init_workflow_executor();
|
|
103323
|
-
import * as
|
|
103835
|
+
import * as path45 from "path";
|
|
103324
103836
|
import * as fs41 from "fs";
|
|
103325
103837
|
import * as readline8 from "readline";
|
|
103326
103838
|
init_query();
|
|
@@ -103328,7 +103840,7 @@ init_logger();
|
|
|
103328
103840
|
init_error_utils();
|
|
103329
103841
|
init_api6();
|
|
103330
103842
|
function displayPath2(filePath) {
|
|
103331
|
-
const rel =
|
|
103843
|
+
const rel = path45.relative(process.cwd(), filePath);
|
|
103332
103844
|
if (rel && !rel.startsWith("..") && rel.length < filePath.length) {
|
|
103333
103845
|
return rel;
|
|
103334
103846
|
}
|
|
@@ -103347,7 +103859,7 @@ async function runCommand(input, options) {
|
|
|
103347
103859
|
await runCommandInner(input, options);
|
|
103348
103860
|
}
|
|
103349
103861
|
async function runCommandInner(input, options) {
|
|
103350
|
-
const filePath =
|
|
103862
|
+
const filePath = path45.resolve(input);
|
|
103351
103863
|
if (!fs41.existsSync(filePath)) {
|
|
103352
103864
|
throw new Error(`File not found: ${displayPath2(filePath)}`);
|
|
103353
103865
|
}
|
|
@@ -103359,7 +103871,7 @@ async function runCommandInner(input, options) {
|
|
|
103359
103871
|
throw new Error(`Invalid JSON in --params: ${options.params}`);
|
|
103360
103872
|
}
|
|
103361
103873
|
} else if (options.paramsFile) {
|
|
103362
|
-
const paramsFilePath =
|
|
103874
|
+
const paramsFilePath = path45.resolve(options.paramsFile);
|
|
103363
103875
|
if (!fs41.existsSync(paramsFilePath)) {
|
|
103364
103876
|
throw new Error(`Params file not found: ${paramsFilePath}`);
|
|
103365
103877
|
}
|
|
@@ -103378,7 +103890,7 @@ async function runCommandInner(input, options) {
|
|
|
103378
103890
|
throw new Error(`Invalid JSON in --mocks: ${options.mocks}`);
|
|
103379
103891
|
}
|
|
103380
103892
|
} else if (options.mocksFile) {
|
|
103381
|
-
const mocksFilePath =
|
|
103893
|
+
const mocksFilePath = path45.resolve(options.mocksFile);
|
|
103382
103894
|
if (!fs41.existsSync(mocksFilePath)) {
|
|
103383
103895
|
throw new Error(`Mocks file not found: ${mocksFilePath}`);
|
|
103384
103896
|
}
|
|
@@ -103960,7 +104472,7 @@ function promptForInput(question) {
|
|
|
103960
104472
|
}
|
|
103961
104473
|
|
|
103962
104474
|
// src/cli/commands/serve.ts
|
|
103963
|
-
import * as
|
|
104475
|
+
import * as path46 from "path";
|
|
103964
104476
|
import * as fs43 from "fs";
|
|
103965
104477
|
|
|
103966
104478
|
// src/server/workflow-registry.ts
|
|
@@ -104395,7 +104907,7 @@ var WebhookServer = class {
|
|
|
104395
104907
|
// src/cli/commands/serve.ts
|
|
104396
104908
|
init_logger();
|
|
104397
104909
|
async function serveCommand(dir, options) {
|
|
104398
|
-
const workflowDir =
|
|
104910
|
+
const workflowDir = path46.resolve(dir || ".");
|
|
104399
104911
|
if (!fs43.existsSync(workflowDir)) {
|
|
104400
104912
|
throw new Error(`Directory not found: ${workflowDir}`);
|
|
104401
104913
|
}
|
|
@@ -104444,7 +104956,7 @@ async function serveCommand(dir, options) {
|
|
|
104444
104956
|
// src/export/index.ts
|
|
104445
104957
|
init_compile();
|
|
104446
104958
|
init_parser2();
|
|
104447
|
-
import * as
|
|
104959
|
+
import * as path47 from "path";
|
|
104448
104960
|
import * as fs44 from "fs";
|
|
104449
104961
|
import * as os2 from "os";
|
|
104450
104962
|
async function exportWorkflow(options) {
|
|
@@ -104457,8 +104969,8 @@ async function exportWorkflow(options) {
|
|
|
104457
104969
|
available.length === 0 ? `No export targets installed. Install a target pack (e.g. npm install flowweaver-pack-${options.target})` : `Unknown target "${options.target}". Installed: ${available.join(", ")}`
|
|
104458
104970
|
);
|
|
104459
104971
|
}
|
|
104460
|
-
const inputPath =
|
|
104461
|
-
const outputDir =
|
|
104972
|
+
const inputPath = path47.resolve(options.input);
|
|
104973
|
+
const outputDir = path47.resolve(options.output);
|
|
104462
104974
|
const isDryRun = options.dryRun ?? false;
|
|
104463
104975
|
if (options.multi) {
|
|
104464
104976
|
return exportMultiWorkflowViaRegistry(
|
|
@@ -104482,7 +104994,7 @@ async function exportSingleWorkflowViaRegistry(target, inputPath, outputDir, isD
|
|
|
104482
104994
|
throw new Error(`Input file not found: ${inputPath}`);
|
|
104483
104995
|
}
|
|
104484
104996
|
const parser3 = new AnnotationParser();
|
|
104485
|
-
const projectDir =
|
|
104997
|
+
const projectDir = path47.dirname(inputPath);
|
|
104486
104998
|
await parser3.loadPackHandlers(projectDir);
|
|
104487
104999
|
const parseResult = parser3.parse(inputPath);
|
|
104488
105000
|
if (parseResult.workflows.length === 0) {
|
|
@@ -104512,7 +105024,7 @@ async function exportSingleWorkflowViaRegistry(target, inputPath, outputDir, isD
|
|
|
104512
105024
|
);
|
|
104513
105025
|
let compiledContent;
|
|
104514
105026
|
if (needsCompiledWorkflow) {
|
|
104515
|
-
const workDir = isDryRun ?
|
|
105027
|
+
const workDir = isDryRun ? path47.join(os2.tmpdir(), `fw-export-dryrun-${Date.now()}`) : outputDir;
|
|
104516
105028
|
fs44.mkdirSync(workDir, { recursive: true });
|
|
104517
105029
|
try {
|
|
104518
105030
|
const compiledPath = await compileToOutput(
|
|
@@ -104532,16 +105044,16 @@ async function exportSingleWorkflowViaRegistry(target, inputPath, outputDir, isD
|
|
|
104532
105044
|
}
|
|
104533
105045
|
}
|
|
104534
105046
|
const files = artifacts.files.map((f) => ({
|
|
104535
|
-
path:
|
|
105047
|
+
path: path47.join(outputDir, f.relativePath),
|
|
104536
105048
|
content: f.content
|
|
104537
105049
|
}));
|
|
104538
105050
|
if (compiledContent) {
|
|
104539
|
-
const workflowOutputPath =
|
|
105051
|
+
const workflowOutputPath = path47.join(outputDir, "workflow.ts");
|
|
104540
105052
|
files.push({ path: workflowOutputPath, content: compiledContent });
|
|
104541
105053
|
}
|
|
104542
105054
|
if (!isDryRun) {
|
|
104543
105055
|
for (const file of files) {
|
|
104544
|
-
const dirPath =
|
|
105056
|
+
const dirPath = path47.dirname(file.path);
|
|
104545
105057
|
fs44.mkdirSync(dirPath, { recursive: true });
|
|
104546
105058
|
fs44.writeFileSync(file.path, file.content, "utf-8");
|
|
104547
105059
|
}
|
|
@@ -104559,7 +105071,7 @@ async function exportMultiWorkflowViaRegistry(target, inputPath, outputDir, isDr
|
|
|
104559
105071
|
throw new Error(`Input file not found: ${inputPath}`);
|
|
104560
105072
|
}
|
|
104561
105073
|
const parser3 = new AnnotationParser();
|
|
104562
|
-
const projectDir =
|
|
105074
|
+
const projectDir = path47.dirname(inputPath);
|
|
104563
105075
|
await parser3.loadPackHandlers(projectDir);
|
|
104564
105076
|
const parseResult = parser3.parse(inputPath);
|
|
104565
105077
|
if (parseResult.workflows.length === 0) {
|
|
@@ -104575,7 +105087,7 @@ async function exportMultiWorkflowViaRegistry(target, inputPath, outputDir, isDr
|
|
|
104575
105087
|
throw new Error(`None of the requested workflows found. Available: ${available}`);
|
|
104576
105088
|
}
|
|
104577
105089
|
}
|
|
104578
|
-
const serviceName =
|
|
105090
|
+
const serviceName = path47.basename(options.input, path47.extname(options.input)) + "-service";
|
|
104579
105091
|
const bundleWorkflows = selectedWorkflows.map((w) => ({
|
|
104580
105092
|
name: w.name,
|
|
104581
105093
|
functionName: w.functionName,
|
|
@@ -104600,13 +105112,13 @@ async function exportMultiWorkflowViaRegistry(target, inputPath, outputDir, isDr
|
|
|
104600
105112
|
});
|
|
104601
105113
|
const files = artifacts.files.map(
|
|
104602
105114
|
(f) => ({
|
|
104603
|
-
path:
|
|
105115
|
+
path: path47.join(outputDir, f.relativePath),
|
|
104604
105116
|
content: f.content
|
|
104605
105117
|
})
|
|
104606
105118
|
);
|
|
104607
105119
|
if (!isDryRun) {
|
|
104608
105120
|
for (const file of files) {
|
|
104609
|
-
const dirPath =
|
|
105121
|
+
const dirPath = path47.dirname(file.path);
|
|
104610
105122
|
fs44.mkdirSync(dirPath, { recursive: true });
|
|
104611
105123
|
fs44.writeFileSync(file.path, file.content, "utf-8");
|
|
104612
105124
|
}
|
|
@@ -104620,7 +105132,7 @@ async function exportMultiWorkflowViaRegistry(target, inputPath, outputDir, isDr
|
|
|
104620
105132
|
};
|
|
104621
105133
|
}
|
|
104622
105134
|
async function compileToOutput(inputPath, functionName, outputDir, production) {
|
|
104623
|
-
const outputPath =
|
|
105135
|
+
const outputPath = path47.join(outputDir, "workflow.ts");
|
|
104624
105136
|
fs44.copyFileSync(inputPath, outputPath);
|
|
104625
105137
|
await compileWorkflow(outputPath, {
|
|
104626
105138
|
write: true,
|
|
@@ -104749,12 +105261,12 @@ async function exportCommand(input, options) {
|
|
|
104749
105261
|
}
|
|
104750
105262
|
|
|
104751
105263
|
// src/cli/commands/openapi.ts
|
|
104752
|
-
import * as
|
|
105264
|
+
import * as path48 from "path";
|
|
104753
105265
|
import * as fs45 from "fs";
|
|
104754
105266
|
init_generator();
|
|
104755
105267
|
init_logger();
|
|
104756
105268
|
async function openapiCommand(dir, options) {
|
|
104757
|
-
const workflowDir =
|
|
105269
|
+
const workflowDir = path48.resolve(dir);
|
|
104758
105270
|
if (!fs45.existsSync(workflowDir)) {
|
|
104759
105271
|
throw new Error(`Directory not found: ${workflowDir}`);
|
|
104760
105272
|
}
|
|
@@ -104779,7 +105291,7 @@ async function openapiCommand(dir, options) {
|
|
|
104779
105291
|
const format = options.format || "json";
|
|
104780
105292
|
const spec = format === "yaml" ? generateOpenAPIYaml(endpoints, generatorOptions) : generateOpenAPIJson(endpoints, generatorOptions);
|
|
104781
105293
|
if (options.output) {
|
|
104782
|
-
const outputPath =
|
|
105294
|
+
const outputPath = path48.resolve(options.output);
|
|
104783
105295
|
fs45.writeFileSync(outputPath, spec);
|
|
104784
105296
|
logger.success(`OpenAPI specification written to ${outputPath}`);
|
|
104785
105297
|
} else {
|
|
@@ -104790,7 +105302,7 @@ async function openapiCommand(dir, options) {
|
|
|
104790
105302
|
// src/cli/commands/plugin.ts
|
|
104791
105303
|
init_logger();
|
|
104792
105304
|
import * as fs46 from "fs";
|
|
104793
|
-
import * as
|
|
105305
|
+
import * as path49 from "path";
|
|
104794
105306
|
var PLUGIN_NAME_RE = /^[a-zA-Z0-9][-a-zA-Z0-9_.]*$/;
|
|
104795
105307
|
var VALID_AREAS = ["sidebar", "main", "toolbar", "modal", "panel"];
|
|
104796
105308
|
function validatePluginName(name) {
|
|
@@ -104917,12 +105429,12 @@ async function pluginInitCommand(name, options) {
|
|
|
104917
105429
|
}
|
|
104918
105430
|
return;
|
|
104919
105431
|
}
|
|
104920
|
-
const targetDir =
|
|
105432
|
+
const targetDir = path49.resolve("plugins", name);
|
|
104921
105433
|
const filesCreated = [];
|
|
104922
105434
|
const filesSkipped = [];
|
|
104923
105435
|
for (const [relativePath, content] of Object.entries(files)) {
|
|
104924
|
-
const absPath =
|
|
104925
|
-
const dir =
|
|
105436
|
+
const absPath = path49.join(targetDir, relativePath);
|
|
105437
|
+
const dir = path49.dirname(absPath);
|
|
104926
105438
|
fs46.mkdirSync(dir, { recursive: true });
|
|
104927
105439
|
if (fs46.existsSync(absPath) && !force) {
|
|
104928
105440
|
filesSkipped.push(relativePath);
|
|
@@ -104950,7 +105462,7 @@ init_esm5();
|
|
|
104950
105462
|
init_api6();
|
|
104951
105463
|
init_generate_in_place();
|
|
104952
105464
|
import * as fs47 from "fs";
|
|
104953
|
-
import * as
|
|
105465
|
+
import * as path50 from "path";
|
|
104954
105466
|
init_logger();
|
|
104955
105467
|
init_error_utils();
|
|
104956
105468
|
async function migrateCommand(globPattern, options = {}) {
|
|
@@ -104969,7 +105481,7 @@ async function migrateCommand(globPattern, options = {}) {
|
|
|
104969
105481
|
let skippedCount = 0;
|
|
104970
105482
|
let errorCount = 0;
|
|
104971
105483
|
for (const file of files) {
|
|
104972
|
-
const filePath =
|
|
105484
|
+
const filePath = path50.resolve(file);
|
|
104973
105485
|
try {
|
|
104974
105486
|
const sourceCode = fs47.readFileSync(filePath, "utf8");
|
|
104975
105487
|
const parseResult = await parseWorkflow(filePath);
|
|
@@ -105140,13 +105652,13 @@ init_esm5();
|
|
|
105140
105652
|
init_generate_in_place();
|
|
105141
105653
|
init_logger();
|
|
105142
105654
|
import * as fs48 from "fs";
|
|
105143
|
-
import * as
|
|
105655
|
+
import * as path51 from "path";
|
|
105144
105656
|
async function stripCommand(input, options = {}) {
|
|
105145
105657
|
const { output, dryRun = false, verbose = false } = options;
|
|
105146
105658
|
let pattern = input;
|
|
105147
105659
|
try {
|
|
105148
105660
|
if (fs48.existsSync(input) && fs48.statSync(input).isDirectory()) {
|
|
105149
|
-
pattern =
|
|
105661
|
+
pattern = path51.join(input, "**/*.ts");
|
|
105150
105662
|
}
|
|
105151
105663
|
} catch {
|
|
105152
105664
|
}
|
|
@@ -105170,24 +105682,24 @@ async function stripCommand(input, options = {}) {
|
|
|
105170
105682
|
if (!hasInPlaceMarkers(content)) {
|
|
105171
105683
|
skipped++;
|
|
105172
105684
|
if (verbose) {
|
|
105173
|
-
logger.info(`Skipped (no markers): ${
|
|
105685
|
+
logger.info(`Skipped (no markers): ${path51.relative(process.cwd(), filePath)}`);
|
|
105174
105686
|
}
|
|
105175
105687
|
continue;
|
|
105176
105688
|
}
|
|
105177
105689
|
const result = stripGeneratedSections(content);
|
|
105178
105690
|
if (dryRun) {
|
|
105179
|
-
logger.info(`Would strip: ${
|
|
105691
|
+
logger.info(`Would strip: ${path51.relative(process.cwd(), filePath)}`);
|
|
105180
105692
|
stripped++;
|
|
105181
105693
|
continue;
|
|
105182
105694
|
}
|
|
105183
|
-
const outPath = output ?
|
|
105695
|
+
const outPath = output ? path51.join(path51.resolve(output), path51.basename(filePath)) : filePath;
|
|
105184
105696
|
if (output) {
|
|
105185
|
-
fs48.mkdirSync(
|
|
105697
|
+
fs48.mkdirSync(path51.dirname(outPath), { recursive: true });
|
|
105186
105698
|
}
|
|
105187
105699
|
fs48.writeFileSync(outPath, result);
|
|
105188
105700
|
stripped++;
|
|
105189
105701
|
if (verbose) {
|
|
105190
|
-
logger.success(`Stripped: ${
|
|
105702
|
+
logger.success(`Stripped: ${path51.relative(process.cwd(), outPath)}`);
|
|
105191
105703
|
}
|
|
105192
105704
|
}
|
|
105193
105705
|
const verb = dryRun ? "would be stripped" : "stripped";
|
|
@@ -105323,14 +105835,14 @@ init_validator();
|
|
|
105323
105835
|
init_logger();
|
|
105324
105836
|
init_error_utils();
|
|
105325
105837
|
import * as fs50 from "fs";
|
|
105326
|
-
import * as
|
|
105838
|
+
import * as path52 from "path";
|
|
105327
105839
|
function formatPortList(ports) {
|
|
105328
105840
|
return Object.entries(ports).filter(([name]) => name !== "execute" && name !== "onSuccess" && name !== "onFailure").map(([name, port]) => `${name}(${port.dataType.toLowerCase()})`);
|
|
105329
105841
|
}
|
|
105330
105842
|
async function statusCommand(input, options = {}) {
|
|
105331
105843
|
const { workflowName, json: json2 = false } = options;
|
|
105332
105844
|
try {
|
|
105333
|
-
const filePath =
|
|
105845
|
+
const filePath = path52.resolve(input);
|
|
105334
105846
|
if (!fs50.existsSync(filePath)) {
|
|
105335
105847
|
if (json2) {
|
|
105336
105848
|
console.log(JSON.stringify({ error: `File not found: ${input}` }));
|
|
@@ -105428,7 +105940,7 @@ init_annotation_generator();
|
|
|
105428
105940
|
init_logger();
|
|
105429
105941
|
init_error_utils();
|
|
105430
105942
|
import * as fs51 from "fs";
|
|
105431
|
-
import * as
|
|
105943
|
+
import * as path53 from "path";
|
|
105432
105944
|
function findDeclareFunction2(source, functionName) {
|
|
105433
105945
|
const lines = source.split("\n");
|
|
105434
105946
|
const escaped = functionName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -105450,7 +105962,7 @@ function findDeclareFunction2(source, functionName) {
|
|
|
105450
105962
|
async function implementCommand(input, nodeName, options = {}) {
|
|
105451
105963
|
const { workflowName, preview = false } = options;
|
|
105452
105964
|
try {
|
|
105453
|
-
const filePath =
|
|
105965
|
+
const filePath = path53.resolve(input);
|
|
105454
105966
|
if (!fs51.existsSync(filePath)) {
|
|
105455
105967
|
logger.error(`File not found: ${input}`);
|
|
105456
105968
|
process.exit(1);
|
|
@@ -105497,7 +106009,7 @@ async function implementCommand(input, nodeName, options = {}) {
|
|
|
105497
106009
|
} else {
|
|
105498
106010
|
const updated = source.replace(found.match, replacement);
|
|
105499
106011
|
fs51.writeFileSync(filePath, updated, "utf8");
|
|
105500
|
-
logger.success(`Implemented ${stubNodeType.functionName} in ${
|
|
106012
|
+
logger.success(`Implemented ${stubNodeType.functionName} in ${path53.basename(filePath)}`);
|
|
105501
106013
|
}
|
|
105502
106014
|
} catch (error2) {
|
|
105503
106015
|
logger.error(`Implement failed: ${getErrorMessage(error2)}`);
|
|
@@ -105508,7 +106020,7 @@ async function implementCommand(input, nodeName, options = {}) {
|
|
|
105508
106020
|
// src/cli/commands/market.ts
|
|
105509
106021
|
init_logger();
|
|
105510
106022
|
import * as fs52 from "fs";
|
|
105511
|
-
import * as
|
|
106023
|
+
import * as path54 from "path";
|
|
105512
106024
|
import { execSync as execSync7 } from "child_process";
|
|
105513
106025
|
init_error_utils();
|
|
105514
106026
|
async function marketInitCommand(name, options = {}) {
|
|
@@ -105517,7 +106029,7 @@ async function marketInitCommand(name, options = {}) {
|
|
|
105517
106029
|
logger.warn(`Name should follow "flowweaver-pack-*" convention, using "${suggested}"`);
|
|
105518
106030
|
name = suggested;
|
|
105519
106031
|
}
|
|
105520
|
-
const targetDir =
|
|
106032
|
+
const targetDir = path54.resolve(name);
|
|
105521
106033
|
if (fs52.existsSync(targetDir)) {
|
|
105522
106034
|
const stat2 = fs52.statSync(targetDir);
|
|
105523
106035
|
if (stat2.isDirectory()) {
|
|
@@ -105536,10 +106048,10 @@ async function marketInitCommand(name, options = {}) {
|
|
|
105536
106048
|
logger.newline();
|
|
105537
106049
|
const dirs = [
|
|
105538
106050
|
targetDir,
|
|
105539
|
-
|
|
105540
|
-
|
|
105541
|
-
|
|
105542
|
-
|
|
106051
|
+
path54.join(targetDir, "src"),
|
|
106052
|
+
path54.join(targetDir, "src", "node-types"),
|
|
106053
|
+
path54.join(targetDir, "src", "workflows"),
|
|
106054
|
+
path54.join(targetDir, "src", "patterns")
|
|
105543
106055
|
];
|
|
105544
106056
|
for (const dir of dirs) {
|
|
105545
106057
|
fs52.mkdirSync(dir, { recursive: true });
|
|
@@ -105574,7 +106086,7 @@ async function marketInitCommand(name, options = {}) {
|
|
|
105574
106086
|
files: ["dist", "flowweaver.manifest.json", "README.md", "LICENSE"]
|
|
105575
106087
|
};
|
|
105576
106088
|
fs52.writeFileSync(
|
|
105577
|
-
|
|
106089
|
+
path54.join(targetDir, "package.json"),
|
|
105578
106090
|
JSON.stringify(pkg, null, 2) + "\n"
|
|
105579
106091
|
);
|
|
105580
106092
|
const tsconfig = {
|
|
@@ -105593,7 +106105,7 @@ async function marketInitCommand(name, options = {}) {
|
|
|
105593
106105
|
exclude: ["node_modules", "dist"]
|
|
105594
106106
|
};
|
|
105595
106107
|
fs52.writeFileSync(
|
|
105596
|
-
|
|
106108
|
+
path54.join(targetDir, "tsconfig.json"),
|
|
105597
106109
|
JSON.stringify(tsconfig, null, 2) + "\n"
|
|
105598
106110
|
);
|
|
105599
106111
|
const sampleNodeType = `/**
|
|
@@ -105611,21 +106123,21 @@ export function sample(execute: () => void, data: string): { result: string } {
|
|
|
105611
106123
|
return { result: data.toUpperCase() };
|
|
105612
106124
|
}
|
|
105613
106125
|
`;
|
|
105614
|
-
fs52.writeFileSync(
|
|
106126
|
+
fs52.writeFileSync(path54.join(targetDir, "src", "node-types", "sample.ts"), sampleNodeType);
|
|
105615
106127
|
fs52.writeFileSync(
|
|
105616
|
-
|
|
106128
|
+
path54.join(targetDir, "src", "node-types", "index.ts"),
|
|
105617
106129
|
"export { sample } from './sample.js';\n"
|
|
105618
106130
|
);
|
|
105619
106131
|
fs52.writeFileSync(
|
|
105620
|
-
|
|
106132
|
+
path54.join(targetDir, "src", "workflows", "index.ts"),
|
|
105621
106133
|
"// Export workflows here\n"
|
|
105622
106134
|
);
|
|
105623
106135
|
fs52.writeFileSync(
|
|
105624
|
-
|
|
106136
|
+
path54.join(targetDir, "src", "patterns", "index.ts"),
|
|
105625
106137
|
"// Export patterns here\n"
|
|
105626
106138
|
);
|
|
105627
106139
|
fs52.writeFileSync(
|
|
105628
|
-
|
|
106140
|
+
path54.join(targetDir, "src", "index.ts"),
|
|
105629
106141
|
[
|
|
105630
106142
|
"export * from './node-types/index.js';",
|
|
105631
106143
|
"export * from './workflows/index.js';",
|
|
@@ -105658,9 +106170,9 @@ npm run pack # Generate flowweaver.manifest.json
|
|
|
105658
106170
|
npm publish # Publish to npm
|
|
105659
106171
|
\`\`\`
|
|
105660
106172
|
`;
|
|
105661
|
-
fs52.writeFileSync(
|
|
106173
|
+
fs52.writeFileSync(path54.join(targetDir, "README.md"), readme);
|
|
105662
106174
|
fs52.writeFileSync(
|
|
105663
|
-
|
|
106175
|
+
path54.join(targetDir, ".gitignore"),
|
|
105664
106176
|
["node_modules", "dist", "*.tgz", ""].join("\n")
|
|
105665
106177
|
);
|
|
105666
106178
|
logger.success("Created package.json");
|
|
@@ -105680,7 +106192,7 @@ npm publish # Publish to npm
|
|
|
105680
106192
|
logger.newline();
|
|
105681
106193
|
}
|
|
105682
106194
|
async function marketPackCommand(directory, options = {}) {
|
|
105683
|
-
const dir =
|
|
106195
|
+
const dir = path54.resolve(directory ?? ".");
|
|
105684
106196
|
const { json: json2 = false, verbose = false } = options;
|
|
105685
106197
|
if (!json2) {
|
|
105686
106198
|
logger.section("Packing Marketplace Package");
|
|
@@ -105721,21 +106233,21 @@ async function marketPackCommand(directory, options = {}) {
|
|
|
105721
106233
|
}
|
|
105722
106234
|
const outPath = writeManifest(dir, manifest);
|
|
105723
106235
|
logger.newline();
|
|
105724
|
-
logger.success(`Manifest written to ${
|
|
106236
|
+
logger.success(`Manifest written to ${path54.relative(dir, outPath)}`);
|
|
105725
106237
|
if (warnings.length > 0) {
|
|
105726
106238
|
logger.warn(`${warnings.length} warning(s) \u2014 consider fixing before publishing`);
|
|
105727
106239
|
}
|
|
105728
106240
|
logger.newline();
|
|
105729
106241
|
}
|
|
105730
106242
|
async function marketPublishCommand(directory, options = {}) {
|
|
105731
|
-
const dir =
|
|
106243
|
+
const dir = path54.resolve(directory ?? ".");
|
|
105732
106244
|
const { dryRun = false, tag } = options;
|
|
105733
106245
|
logger.section("Publishing Marketplace Package");
|
|
105734
106246
|
await marketPackCommand(dir, { json: false });
|
|
105735
|
-
if (!fs52.existsSync(
|
|
106247
|
+
if (!fs52.existsSync(path54.join(dir, "LICENSE"))) {
|
|
105736
106248
|
logger.warn("LICENSE file not found \u2014 consider adding one");
|
|
105737
106249
|
}
|
|
105738
|
-
const pkg = JSON.parse(fs52.readFileSync(
|
|
106250
|
+
const pkg = JSON.parse(fs52.readFileSync(path54.join(dir, "package.json"), "utf-8"));
|
|
105739
106251
|
logger.info(`Publishing ${pkg.name}@${pkg.version}`);
|
|
105740
106252
|
const npmArgs = ["publish"];
|
|
105741
106253
|
if (dryRun) npmArgs.push("--dry-run");
|
|
@@ -105771,7 +106283,7 @@ async function marketInstallCommand(packageSpec, options = {}) {
|
|
|
105771
106283
|
return;
|
|
105772
106284
|
}
|
|
105773
106285
|
const packageName = resolvePackageName2(packageSpec);
|
|
105774
|
-
const manifest = readManifest(
|
|
106286
|
+
const manifest = readManifest(path54.join(process.cwd(), "node_modules", packageName));
|
|
105775
106287
|
if (json2) {
|
|
105776
106288
|
console.log(JSON.stringify({
|
|
105777
106289
|
success: true,
|
|
@@ -105862,7 +106374,7 @@ async function marketListCommand(options = {}) {
|
|
|
105862
106374
|
}
|
|
105863
106375
|
function resolvePackageName2(spec) {
|
|
105864
106376
|
if (spec.endsWith(".tgz") || spec.endsWith(".tar.gz")) {
|
|
105865
|
-
const base =
|
|
106377
|
+
const base = path54.basename(spec, spec.endsWith(".tar.gz") ? ".tar.gz" : ".tgz");
|
|
105866
106378
|
const match2 = base.match(/^(.+)-\d+\.\d+\.\d+/);
|
|
105867
106379
|
return match2 ? match2[1] : base;
|
|
105868
106380
|
}
|
|
@@ -105913,7 +106425,7 @@ function displayInstalledPackage(pkg) {
|
|
|
105913
106425
|
// src/cli/index.ts
|
|
105914
106426
|
init_logger();
|
|
105915
106427
|
init_error_utils();
|
|
105916
|
-
var version2 = true ? "0.
|
|
106428
|
+
var version2 = true ? "0.19.1" : "0.0.0-dev";
|
|
105917
106429
|
var program2 = new Command();
|
|
105918
106430
|
program2.name("flow-weaver").description("Flow Weaver Annotations - Compile and validate workflow files").option("-v, --version", "Output the current version").option("--no-color", "Disable colors").option("--color", "Force colors").on("option:version", () => {
|
|
105919
106431
|
logger.banner(version2);
|
|
@@ -106137,7 +106649,13 @@ if (!process.argv.slice(2).length) {
|
|
|
106137
106649
|
console.log();
|
|
106138
106650
|
process.exit(0);
|
|
106139
106651
|
}
|
|
106140
|
-
|
|
106652
|
+
if (!process.env["VITEST"]) {
|
|
106653
|
+
(async () => {
|
|
106654
|
+
const { registerPackCommands: registerPackCommands2 } = await Promise.resolve().then(() => (init_pack_commands(), pack_commands_exports));
|
|
106655
|
+
await registerPackCommands2(program2);
|
|
106656
|
+
program2.parse(process.argv);
|
|
106657
|
+
})();
|
|
106658
|
+
}
|
|
106141
106659
|
/*! Bundled license information:
|
|
106142
106660
|
|
|
106143
106661
|
lodash-es/lodash.js:
|