feat: improve graph building and modernize tooling#201
Merged
ricardozanini merged 12 commits intoserverlessworkflow:mainfrom Apr 13, 2026
Merged
feat: improve graph building and modernize tooling#201ricardozanini merged 12 commits intoserverlessworkflow:mainfrom
ricardozanini merged 12 commits intoserverlessworkflow:mainfrom
Conversation
- add the posibility to simplify the graph by flattening the nodes and edges, and removing internal entry/exit nodes - fix the transition of the last node of a subgraph, use `exit` instead of `end` - fix the transition of the `end` node, was using the context exitNode instead of the root one - move parent from Graph to GraphNode - fix type in rootId constant name - remove null from optional params/props Signed-off-by: Jean-Baptiste Bianchi <jb.bianchi@neuroglia.io>
- add serve command to serve browser examples Signed-off-by: Jean-Baptiste Bianchi <jb.bianchi@neuroglia.io>
workaround issue mermaid-js/mermaid#6452 Signed-off-by: Jean-Baptiste Bianchi <jb.bianchi@neuroglia.io>
- remove duplicated nodes - remove duplicated edges - use simplified graph for Mermaid code generation - fix edges remapping when simplifying graph Signed-off-by: Jean-Baptiste Bianchi <jb.bianchi@neuroglia.io>
Signed-off-by: Jean-Baptiste Bianchi <jb.bianchi@neuroglia.io>
Signed-off-by: Jean-Baptiste Bianchi <jb.bianchi@neuroglia.io>
Signed-off-by: Jean-Baptiste Bianchi <jb.bianchi@neuroglia.io>
…amples to use ESM Signed-off-by: Jean-Baptiste Bianchi <jb.bianchi@neuroglia.io>
Signed-off-by: Jean-Baptiste Bianchi <jb.bianchi@neuroglia.io>
|
@JBBianchi Thanks for the PR, would you please update the PR description with the changes made to improve graph building etc as well |
Member
ricardozanini
left a comment
There was a problem hiding this comment.
Great work updating all this! I just have a few comments regarding the pipeline updates.
Member
Author
@lornakelly Updated the PR description with a more comprehensive summary, including the graph building improvements. |
Signed-off-by: Jean-Baptiste Bianchi <jb.bianchi@neuroglia.io>
lornakelly
reviewed
Apr 10, 2026
- Split `buildGraph(workflow)` (returns `Graph`) from new `buildFlatGraph(workflow, removePorts?)` (returns `FlatGraph`) - Export `flattenGraph(graph, removePorts?)` utility (instead of `reshapeGraph(graph)`) - Document the new API in README - Expand graph tests: cover every task type, verify nodes/edges by id, add unit tests for `flattenEdges`/`flattenNodes`/`remapEdges`/`flattenGraph` Signed-off-by: Jean-Baptiste Bianchi <jb.bianchi@neuroglia.io>
Signed-off-by: Jean-Baptiste Bianchi <jb.bianchi@neuroglia.io>
ricardozanini
approved these changes
Apr 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Many thanks for submitting your Pull Request ❤️!
What this PR does / why we need it:
This PR combines two related improvement tracks:
The graph-related changes improve how workflow graphs are built, simplified, and rendered, especially for nested flows and Mermaid output.
The modernization changes refresh the project’s build/test/release toolchain, strengthen package validation, and make browser usage clearer across both ESM and UMD scenarios.
Overall, this PR is meant to make the SDK easier to consume, easier to maintain, and more predictable both at runtime and during release validation.
Graph representation and Mermaid generation improvements:
This part of the PR improves the workflow graph model itself as well as the Mermaid generation pipeline that consumes it.
Main functional changes:
endtransitions so they resolve to the root end nodeGraph API/model changes:
buildGraphnow supports flattened / port-free graph generation through additional optionstargetIdinstead ofdestinationIdparentIdinstead of carrying full parent graph referencestaskMermaid-specific changes:
This part of the PR is covered by graph and Mermaid tests, including simplified graph scenarios, empty workflows, and duplicate-switch-transition handling.
Tooling, packaging, and browser-consumption modernization:
This part of the PR modernizes the project toolchain and release pipeline.
Build/test/lint modernization:
Packaging and publish validation:
exportsand type declaration wiring for import/require consumersBrowser-consumption changes:
Compatibility/runtime notes:
Special notes for reviewers:
This PR mixes a feature-level improvement area (graph / Mermaid behavior) with a broad infrastructure modernization track.
They are mostly orthogonal, but they landed together because the modernization work also affects how the package is built, tested, validated, and demonstrated in browser examples.
Suggested review split:
Additional information (if needed):
Validation coverage includes: