@smthrs/flow 1.0.0-rc.3 → 1.0.0-rc.4
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/cjs/Graph.d.ts.map +1 -1
- package/dist/cjs/Graph.js +7 -8
- package/dist/cjs/Graph.js.map +2 -2
- package/dist/esm/Graph.d.ts.map +1 -1
- package/dist/esm/Graph.js +9 -8
- package/dist/esm/Graph.js.map +1 -1
- package/package.json +6 -6
- package/src/Graph.ts +10 -8
package/dist/esm/Graph.js
CHANGED
|
@@ -1435,6 +1435,9 @@ export const inspect = (flow) => {
|
|
|
1435
1435
|
const prompt = "prompt" in flow && typeof flow.prompt === "function"
|
|
1436
1436
|
? Function.prototype.toString.call(flow.prompt)
|
|
1437
1437
|
: undefined;
|
|
1438
|
+
// The prompt source belongs to the declaration, so it rides on every
|
|
1439
|
+
// inspection, whether or not the graph could be built.
|
|
1440
|
+
const withPrompt = (inspection) => prompt === undefined ? inspection : { ...inspection, prompt };
|
|
1438
1441
|
try {
|
|
1439
1442
|
const graph = build(flow, Planned.make("input"));
|
|
1440
1443
|
const nodes = graph.nodes.map((node) => ({
|
|
@@ -1454,16 +1457,15 @@ export const inspect = (flow) => {
|
|
|
1454
1457
|
: node.ast._tag === "FlowCall" && node.ast.mode !== "inline"
|
|
1455
1458
|
? [{ id: node.id, label: node.ast.flow }]
|
|
1456
1459
|
: []);
|
|
1457
|
-
return {
|
|
1460
|
+
return withPrompt({
|
|
1458
1461
|
nodes,
|
|
1459
1462
|
edges: graph.edges,
|
|
1460
1463
|
steps,
|
|
1461
|
-
diagnostics: graph.diagnostics.map(({ code, message }) => ({ code, message }))
|
|
1462
|
-
|
|
1463
|
-
};
|
|
1464
|
+
diagnostics: graph.diagnostics.map(({ code, message }) => ({ code, message }))
|
|
1465
|
+
});
|
|
1464
1466
|
}
|
|
1465
1467
|
catch (error) {
|
|
1466
|
-
return {
|
|
1468
|
+
return withPrompt({
|
|
1467
1469
|
// The declaration itself is a known boundary even when its internals
|
|
1468
1470
|
// require real input. Do not publish a fictitious empty execution.
|
|
1469
1471
|
nodes: [{ id: "root", kind: "FlowCall", label: flow._tag, dependencies: [] }],
|
|
@@ -1474,9 +1476,8 @@ export const inspect = (flow) => {
|
|
|
1474
1476
|
? error.code === "planned_value_computed" ? "declaration_requires_input" : error.code
|
|
1475
1477
|
: "declaration_inspection_failed",
|
|
1476
1478
|
message: error instanceof Error ? error.message : String(error)
|
|
1477
|
-
}]
|
|
1478
|
-
|
|
1479
|
-
};
|
|
1479
|
+
}]
|
|
1480
|
+
});
|
|
1480
1481
|
}
|
|
1481
1482
|
};
|
|
1482
1483
|
//# sourceMappingURL=Graph.js.map
|