@particle-academy/fancy-flow 0.63.0 → 0.65.0
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/README.md +15 -0
- package/dist/chunk-77V4QC6Y.js +54 -0
- package/dist/chunk-77V4QC6Y.js.map +1 -0
- package/dist/{chunk-MEIDPBKE.js → chunk-W5DPKJY4.js} +4 -2
- package/dist/chunk-W5DPKJY4.js.map +1 -0
- package/dist/engine.cjs +51 -0
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.d.cts +64 -3
- package/dist/engine.d.ts +64 -3
- package/dist/engine.js +1 -0
- package/dist/engine.js.map +1 -1
- package/dist/index.cjs +58 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -4
- package/dist/index.d.ts +16 -4
- package/dist/index.js +11 -4
- package/dist/index.js.map +1 -1
- package/dist/schema.cjs +50 -0
- package/dist/schema.cjs.map +1 -1
- package/dist/schema.js +2 -1
- package/package.json +1 -1
- package/dist/chunk-MEIDPBKE.js.map +0 -1
package/dist/schema.cjs
CHANGED
|
@@ -10738,6 +10738,55 @@ function categoryAccent(category) {
|
|
|
10738
10738
|
}
|
|
10739
10739
|
}
|
|
10740
10740
|
|
|
10741
|
+
// src/analysis/graph-connectivity.ts
|
|
10742
|
+
function checkGraphConnectivity(graph) {
|
|
10743
|
+
const { nodes, edges } = graph;
|
|
10744
|
+
const issues = [];
|
|
10745
|
+
const hasIncoming = /* @__PURE__ */ new Set();
|
|
10746
|
+
const hasOutgoing = /* @__PURE__ */ new Set();
|
|
10747
|
+
for (const edge of edges) {
|
|
10748
|
+
hasIncoming.add(edge.target);
|
|
10749
|
+
hasOutgoing.add(edge.source);
|
|
10750
|
+
}
|
|
10751
|
+
const single = nodes.length === 1;
|
|
10752
|
+
for (const node of nodes) {
|
|
10753
|
+
if (single || mayFloat(node)) continue;
|
|
10754
|
+
if (!hasIncoming.has(node.id) && !hasOutgoing.has(node.id)) {
|
|
10755
|
+
issues.push({
|
|
10756
|
+
level: "error",
|
|
10757
|
+
nodeId: node.id,
|
|
10758
|
+
message: `Node "${node.id}" is connected to nothing \u2014 no inbound edge and no outbound edge. It still RUNS (a node with no inbound edge is a root), but it receives nothing from the graph and reaches nobody in it, so it is either unwired or left behind by a deletion. Only a note, an annotation or a lane may float.`
|
|
10759
|
+
});
|
|
10760
|
+
}
|
|
10761
|
+
}
|
|
10762
|
+
const byId = new Map(nodes.map((n) => [n.id, n]));
|
|
10763
|
+
for (const edge of edges) {
|
|
10764
|
+
const source = byId.get(edge.source);
|
|
10765
|
+
if (!source || !isTerminator(source)) continue;
|
|
10766
|
+
issues.push({
|
|
10767
|
+
level: "error",
|
|
10768
|
+
edgeId: edge.id,
|
|
10769
|
+
message: `Edge "${edge.id}" reads from "${edge.source}", which is a TERMINAL node and publishes no output ports at all. Nothing can ever travel this edge: it does not fail at run time, it delivers nothing, and "${edge.target}" runs anyway with an empty input.`
|
|
10770
|
+
});
|
|
10771
|
+
}
|
|
10772
|
+
return issues;
|
|
10773
|
+
}
|
|
10774
|
+
function mayFloat(node) {
|
|
10775
|
+
const type = node.type;
|
|
10776
|
+
if (!type) return false;
|
|
10777
|
+
if (type === "note") return true;
|
|
10778
|
+
const kind = getNodeKind(type);
|
|
10779
|
+
if (!kind) return true;
|
|
10780
|
+
return kindIds(kind).includes("note") || kind.category === "annotation" || kind.category === "layout";
|
|
10781
|
+
}
|
|
10782
|
+
function isTerminator(node) {
|
|
10783
|
+
const own = node.data?.outputs;
|
|
10784
|
+
if (Array.isArray(own)) return own.length === 0;
|
|
10785
|
+
const kind = node.type ? getNodeKind(node.type) : null;
|
|
10786
|
+
if (!kind) return false;
|
|
10787
|
+
return Array.isArray(kind.outputs) && kind.outputs.length === 0;
|
|
10788
|
+
}
|
|
10789
|
+
|
|
10741
10790
|
// src/schema/workflow-schema.ts
|
|
10742
10791
|
var WORKFLOW_SCHEMA_VERSION = 1;
|
|
10743
10792
|
var WORKFLOW_SCHEMA_URL = "https://particle.academy/schemas/workflow/v1.json";
|
|
@@ -10885,6 +10934,7 @@ function importWorkflow(schema, options = {}) {
|
|
|
10885
10934
|
label: e.label
|
|
10886
10935
|
};
|
|
10887
10936
|
}).filter((e) => e !== null);
|
|
10937
|
+
issues.push(...checkGraphConnectivity({ nodes, edges }));
|
|
10888
10938
|
const ok = issues.every((i) => i.level !== "error");
|
|
10889
10939
|
const declaredInputs = Array.isArray(s.inputs) ? s.inputs.filter(
|
|
10890
10940
|
(input) => input !== null && typeof input === "object" && typeof input.name === "string"
|