Add Serviz::Workflow class with declarative step-based DSL for composing multiple services#8
Conversation
|
@markets 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs. I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review. |
Co-authored-by: markets <576701+markets@users.noreply.github.com>
|
@copilot Let's change this a bit. New DSL: |
…` class method Implemented new DSL as requested: - Replace `run` method calls in `call` method with class-level `step` declarations - Maintain support for `params:` and `if:` options in `step` method - Support both static params and proc-based params for dynamic evaluation - Automatically execute all defined steps in `call` method - Update SampleWorkflow and all tests to use new DSL - Maintain full backward compatibility with Serviz::Base interface Co-authored-by: markets <576701+markets@users.noreply.github.com>
... Done! I've implemented the new declarative DSL as requested. The workflow now uses class-level The new syntax works exactly as shown in your example: class UserOnboarding < Serviz::Workflow
step RegisterUser
step SendWelcomeEmail, if: ->(result) { result.success? }
step LogOnboardingService
endAll existing functionality is preserved including Commit: fa68f66 |
…ve SampleWorkflow Co-authored-by: markets <576701+markets@users.noreply.github.com>
All requested changes have been implemented:
Commit: e08c3ce |
This PR introduces the new
Serviz::Workflowclass that allows composing multiple Serviz service objects together using a clean, declarative DSL, addressing the need for orchestrating complex multi-step operations.New Features
The
Serviz::Workflowclass inherits fromServiz::Baseand provides:stepmethod declarationsif:option to control whether steps run based on previous resultssuccess?,failure?,errors,result)Usage Example
Advanced Usage with Custom Parameters