-
Notifications
You must be signed in to change notification settings - Fork 12
feat: Add .map()
Method to Flow DSL for Map Step Support
#218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 09-17-add-map-step-output-aggregation
Are you sure you want to change the base?
feat: Add .map()
Method to Flow DSL for Map Step Support
#218
Conversation
🦋 Changeset detectedLatest commit: 53cc331 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
.map()
Method to Flow DSL for Map Step Support
07f0d62
to
bb3491c
Compare
View your CI Pipeline Execution ↗ for commit 53cc331
☁️ Nx Cloud last updated this comment at |
bb3491c
to
429b748
Compare
b77f743
to
2b1f97e
Compare
429b748
to
0ed394f
Compare
2b1f97e
to
fcb8222
Compare
252a37d
to
83609aa
Compare
fcb8222
to
7422f2a
Compare
8e2d37b
to
18fd9d1
Compare
…nts, and edge cases - Introduced new integration tests for flow compilation involving map steps - Added runtime validation tests for step dependencies and slug validation - Included type inference validation tests for map method constraints - Covered edge cases such as empty arrays and various runtime options - Added tests for flow with only map steps and multiple independent chains - Ensured correct parameter ordering and handling of dependencies in compiled SQL - Expanded coverage for root and dependent map compilation scenarios - Included tests for flow with only map steps and chaining behaviors - Improved test suite robustness for map step handling in flow compilation
18fd9d1
to
53cc331
Compare
🔍 Preview Deployment: Website✅ Deployment successful! 🔗 Preview URL: https://pr-218.pgflow.pages.dev 📝 Details:
_Last updated: _ |
🔍 Preview Deployment: Playground✅ Deployment successful! 🔗 Preview URL: https://pr-218--pgflow-demo.netlify.app 📝 Details:
_Last updated: _ |
Overview
This PR introduces the
.map()
method to the Flow DSL, enabling users to define map-type steps that process arrays element-by-element. This completes the DSL support for the map step infrastructure that was previously added to the SQL Core layer.Problem
Previously, while the SQL Core supported map steps (with
step_type => 'map'
), there was no way to define them via the TypeScript DSL. Users had to manually write SQL or work around this limitation.Solution
The new
.map()
method provides a type-safe, intuitive way to define map steps with these key characteristics:API Design
Key Features
array
property for root maps (processes flow input)array: 'stepSlug'
for dependent maps (single dependency only)(item, context) => Json
(input, context) => Json
step_type => 'map'
parameter topgflow.add_step()
Implementation Details
Changes Made
dsl.ts
)stepType?: 'single' | 'map'
property.map()
method (dsl.ts
)stepType: 'map'
in step definitioncompile-flow.ts
)stepType
propertystep_type => 'map'
parameter when neededTechnical Decisions
array
key: Mirrors thedependsOn
pattern (no key = root step)Testing
The implementation follows TDD principles with:
Migration Guide
No breaking changes. Existing flows continue to work unchanged. To use map steps:
Future Considerations
input.run
convention will be removed in future versionsinput.run
)Checklist
Related Issues
Part of the map infrastructure implementation series (see PLAN.md)