-
Notifications
You must be signed in to change notification settings - Fork 0
support sub flows #980
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
Merged
Merged
support sub flows #980
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f8edfb6
feat: added sub flows and sub flow settings
raphael-goetz 3e57aa4
feat: adjusted service layers to new sub flow
raphael-goetz c79b48e
fix: corrected migrations
raphael-goetz 9dade74
Update app/models/node_parameter.rb
raphael-goetz 9aec8ee
Update app/models/sub_flow.rb
raphael-goetz c280de1
Apply suggestions from code review
raphael-goetz 2b3def6
feat: added direct reference to function definition
raphael-goetz d47a3ab
Potential fix for pull request finding
raphael-goetz 6fe1a76
Update db/migrate/20260520120000_add_tucana_shared_flow_sub_flows.rb
raphael-goetz f6ed328
feat: correct sql schema
raphael-goetz 078613c
feat: direct references for function definition
raphael-goetz 1679312
docs: regen graphql docs
raphael-goetz b74a181
ref: renamed sub flow objects
raphael-goetz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module Types | ||
| module Input | ||
| class SubFlowValueInputType < Types::BaseInputObject | ||
| description 'Input type for sub-flow parameter values' | ||
|
|
||
| argument :function_identifier, String, | ||
| required: false, | ||
| description: 'The function identifier to execute' | ||
| argument :settings, [Types::Input::SubFlowValueSettingInputType], | ||
| required: false, | ||
| description: 'The sub-flow settings' | ||
| argument :signature, String, | ||
| required: true, | ||
| description: 'The sub-flow signature' | ||
| argument :starting_node_id, Types::GlobalIdType[::NodeFunction], | ||
| required: false, | ||
| description: 'The starting node to execute' | ||
|
|
||
| require_one_of %i[starting_node_id function_identifier] | ||
| end | ||
| end | ||
| end | ||
22 changes: 22 additions & 0 deletions
22
app/graphql/types/input/sub_flow_value_setting_input_type.rb
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module Types | ||
| module Input | ||
| class SubFlowValueSettingInputType < Types::BaseInputObject | ||
| description 'Input type for sub-flow settings' | ||
|
|
||
| argument :default_value, GraphQL::Types::JSON, | ||
|
Taucher2003 marked this conversation as resolved.
|
||
| required: false, | ||
| description: 'The default value of the sub-flow setting' | ||
| argument :hidden, Boolean, | ||
|
Taucher2003 marked this conversation as resolved.
|
||
| required: false, | ||
| description: 'Whether the sub-flow setting is hidden' | ||
| argument :identifier, String, | ||
| required: true, | ||
| description: 'The identifier of the sub-flow setting' | ||
| argument :optional, Boolean, | ||
|
Taucher2003 marked this conversation as resolved.
|
||
| required: false, | ||
| description: 'Whether the sub-flow setting is optional' | ||
| end | ||
| end | ||
| end | ||
This file was deleted.
Oops, something went wrong.
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
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
|
Taucher2003 marked this conversation as resolved.
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module Types | ||
| class SubFlowValueSettingType < Types::BaseObject | ||
| description 'Represents a sub-flow setting.' | ||
|
|
||
| field :default_value, GraphQL::Types::JSON, | ||
| null: true, | ||
| description: 'The default value of the sub-flow setting.' | ||
| field :hidden, Boolean, | ||
| null: true, | ||
| description: 'Whether the sub-flow setting is hidden.' | ||
| field :identifier, String, | ||
| null: false, | ||
| description: 'The identifier of the sub-flow setting.' | ||
| field :optional, Boolean, | ||
| null: true, | ||
| description: 'Whether the sub-flow setting is optional.' | ||
| end | ||
| end |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module Types | ||
| class SubFlowValueType < Types::BaseObject | ||
| description 'Represents a sub-flow parameter value.' | ||
|
|
||
| field :function_definition, Types::FunctionDefinitionType, | ||
| null: true, | ||
| description: 'The resolved function definition to execute.' | ||
| field :settings, [Types::SubFlowValueSettingType], | ||
| method: :sub_flow_settings, | ||
| null: false, | ||
| description: 'The sub-flow settings.' | ||
| field :signature, String, | ||
| null: false, | ||
| description: 'The sub-flow signature.' | ||
| field :starting_node_id, GlobalIdType[::NodeFunction], | ||
| null: true, | ||
| description: 'The starting node to execute.' | ||
|
|
||
| def starting_node_id | ||
| object.starting_node&.to_global_id | ||
| end | ||
| end | ||
| end |
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| class SubFlow < ApplicationRecord | ||
| belongs_to :node_parameter, inverse_of: :sub_flow | ||
| belongs_to :starting_node, class_name: 'NodeFunction', optional: true | ||
| belongs_to :function_definition, optional: true | ||
|
|
||
| has_many :sub_flow_settings, inverse_of: :sub_flow, autosave: true | ||
|
|
||
| validate :validate_execution_reference | ||
|
|
||
| def function_identifier | ||
| function_definition&.identifier | ||
| end | ||
|
|
||
| def to_grpc | ||
| Tucana::Shared::SubFlow.new( | ||
| starting_node_id: starting_node_id, | ||
| function_identifier: function_identifier, | ||
| signature: signature, | ||
| settings: sub_flow_settings.map(&:to_grpc) | ||
| ) | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def validate_execution_reference | ||
| return if [starting_node.present?, function_definition.present?].count(true) == 1 | ||
|
|
||
| errors.add(:base, 'Exactly one of starting_node or function_definition must be present') | ||
| end | ||
| end |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| class SubFlowSetting < ApplicationRecord | ||
| belongs_to :sub_flow, inverse_of: :sub_flow_settings | ||
|
|
||
| validates :identifier, presence: true | ||
|
|
||
| def to_grpc | ||
| Tucana::Shared::SubFlowSetting.new( | ||
| identifier: identifier, | ||
| default_value: Tucana::Shared::Value.from_ruby(default_value), | ||
| optional: optional, | ||
| hidden: hidden | ||
| ) | ||
| end | ||
| end |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.