-
Notifications
You must be signed in to change notification settings - Fork 0
flow type structure #486
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
flow type structure #486
Changes from all commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
7950e10
Update datatype model and runtime function (definition) models
Knerio cdf6cd5
Adjust models and tests
Knerio 34b580b
Add Rails helper requirement to ping service spec
Knerio ed6786f
Refactor foreign key constraints in generics implementation
Knerio d5f457d
Recompile structure.sql
Knerio 2e8cc11
Make migration reversible
Knerio 51591c4
Fix rubocop vulnerabilities
Knerio 770abe6
Refactor generic type and mapper associations (tucana 0.0.28)
Knerio f69ad49
Recompile structure.sql
Knerio 87fc346
Fix rubocop vulnerabilities
Knerio 7528ffb
Recompile structure.sql
Knerio 13bad43
Adjust models and tests
Knerio 67622d6
Update datatype model and runtime function (definition) models
Knerio 025e136
Adjust models and tests
Knerio f134b7d
Adjust models and tests
Knerio 1842be2
Create flow model and everything associated with it (no functionality…
Knerio df1ca1d
Add flows association to NamespaceProject and update schema
Knerio 89cdb7e
Create create/update/delete services for flows
Knerio aeeeca6
Recompile structure.sql
Knerio ab23a96
Fix rubocop vulnerabilities
Knerio 2f904c9
Add flow update and delete services specs
Knerio b2d9b4b
Refactor generic type and mapper associations (tucana 0.0.28); update…
Knerio dad9ba6
Refactor flow associations to use input_type and return_type instead …
Knerio d647f0b
Changeup flow setting to allign with https://github.com/code0-tech/tu…
Knerio 85b8f5c
Recompile structure.sql
Knerio 77c7747
Update datatype model and runtime function (definition) models
Knerio 330d3e2
Adjust models and tests
Knerio 4693057
Fix singleton methods and runtime assignments
Knerio 418567e
Add logging capabilities to FlowHandler by including Loggable module
Knerio b4893a9
Add logging for data type updates and improve datatype retrieval method
Knerio b7c19f6
Fix formatting
Knerio 0764b7d
Create graphql input/types
Knerio e0d0ce1
Add validation services for data types and node functions, enhance in…
Knerio 2b6b2c9
Enhance flow creation and validation process with new data types and …
Knerio d8f76e7
Recompile structure.sql
Knerio bf83653
Refactor generic types and mappers, update data type associations, an…
Knerio 5047588
Refactor validation services and input types, enhance logging, and im…
Knerio dc7aa4d
Refactor flow creation and validation services, enhance error handlin…
Knerio 6a38727
Add generic combination strategies and update generic mapper structur…
Knerio 360e366
Add Zone.Identifier to .gitignore to prevent unwanted file tracking
Knerio a09d8b2
Refactor generic mapper associations and update Gemfile for local pat…
Knerio fa0f944
Update tucana gem version to 0.0.30
Knerio 37731db
remove parameter_id of function generic mapper
Knerio 49786ec
remove_reference also has specifies the foreign key now
Knerio 9b522ce
Add validation and constraints for generic_keys length in data types …
Knerio 12d5a59
Remove runtime association from GenericType and related specs and rem…
Knerio f17379e
Fix rubocop vulnerabilities
Knerio c3ddbc9
Update references in runtime and parameter definitions to allow null …
Knerio 10acdb0
Add presence and inclusion validations for type in GenericCombination…
Knerio 0d9487d
Change :base to :value
Knerio b836858
Change description of abilities and remove update_flows as its not im…
Knerio a6ff8ba
Update foreign key constraints to use cascade on delete and enforce p…
Knerio c37d4f1
Regenerate docs
Knerio 1ec9b35
Recompile structure.sql
Knerio 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,7 @@ | |
*.njsproj | ||
*.sln | ||
*.sw? | ||
**/*Zone.Identifier | ||
|
||
################ | ||
## | ||
|
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,55 @@ | ||
# frozen_string_literal: true | ||
|
||
module Mutations | ||
module Namespaces | ||
module Projects | ||
module Flows | ||
class Create < BaseMutation | ||
description 'Creates a new flow.' | ||
|
||
field :flow, Types::FlowType, null: true, description: 'The newly created flow.' | ||
|
||
argument :project_id, Types::GlobalIdType[NamespaceProject], | ||
required: true, description: 'The ID of the project to which the flow belongs to' | ||
|
||
argument :flow, Types::Input::FlowInputType, description: 'The flow to create', required: true | ||
|
||
def resolve(project_id:, flow:, **params) | ||
project = SagittariusSchema.object_from_id(project_id) | ||
|
||
return error('Invalid project id') if project.nil? | ||
|
||
input_type = SagittariusSchema.object_from_id(flow.input_type) | ||
|
||
return error('Invalid input type id') if input_type.nil? | ||
|
||
return_type = SagittariusSchema.object_from_id(flow.return_type) | ||
return error('Invalid return type id') if return_type.nil? | ||
|
||
flow_type = SagittariusSchema.object_from_id(flow.flow_type) | ||
return error('Invalid flow type id') if flow_type.nil? | ||
|
||
Namespaces::Projects::Flows::CreateService.new( | ||
create_authentication(context[:current_user]), | ||
namespace_project: project, | ||
params: { | ||
return_type: return_type, | ||
input_type: input_type, | ||
flow_type: flow_type, | ||
starting_node: params[:starting_node], | ||
settings: params[:settings] || [], | ||
} | ||
).execute.to_mutation_response(success_key: :flow) | ||
end | ||
|
||
def error(message) | ||
{ | ||
flow: nil, | ||
errors: [create_message_error(message)], | ||
} | ||
end | ||
end | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# frozen_string_literal: true | ||
|
||
module Mutations | ||
module Namespaces | ||
module Projects | ||
module Flows | ||
class Delete < BaseMutation | ||
description 'Deletes a namespace project.' | ||
|
||
field :flow, Types::FlowType, null: true, description: 'The deleted flow.' | ||
|
||
argument :flow_id, Types::GlobalIdType[::Flow], | ||
description: 'The id of the flow which will be deleted' | ||
|
||
def resolve(flow_id:) | ||
flow = SagittariusSchema.object_from_id(flow_id) | ||
|
||
if flow.nil? | ||
return { flow: nil, | ||
errors: [create_message_error('Invalid flow')] } | ||
end | ||
|
||
::Namespaces::Projects::Flows::DeleteService.new( | ||
current_authentication, | ||
flow | ||
).execute.to_mutation_response(success_key: :flow) | ||
end | ||
end | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# frozen_string_literal: true | ||
|
||
module Types | ||
class DataTypeIdentifierType < Types::BaseUnion | ||
description 'Represents a data type identifier.' | ||
|
||
possible_types Types::GenericTypeType, Types::DataTypeType, Types::GenericKeyType, | ||
description: 'The identifier can be a generic type, a data type, or a generic key.' | ||
|
||
def self.resolve_type(object, _context) | ||
case object | ||
when GenericType | ||
Types::GenericTypeType | ||
when DataType | ||
Types::DataTypeType | ||
when GenericKey | ||
Types::GenericKeyType | ||
else | ||
raise "Unexpected value type: #{object.class}" | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
module Types | ||
class DataTypeRuleType < Types::BaseObject | ||
description 'Represents a rule that can be applied to a data type.' | ||
|
||
field :variant, Types::DataTypeRules::DataTypeRuleVariantEnum, null: false, | ||
description: 'The type of the rule' | ||
|
||
field :config, Types::DataTypeRules::ConfigType, null: false, | ||
description: 'The configuration of the rule' | ||
|
||
timestamps | ||
|
||
def config | ||
object.config.merge(variant: object.variant) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# frozen_string_literal: true | ||
|
||
module Types | ||
module DataTypeRules | ||
class ConfigType < Types::BaseUnion | ||
description 'Represents a rule that can be applied to a data type.' | ||
|
||
possible_types ContainsKeyConfigType, ContainsTypeConfigType, NumberRangeConfigType, ItemOfCollectionConfigType, | ||
RegexConfigType | ||
|
||
def self.resolve_type(object, _context) | ||
Knerio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
case object[:variant] | ||
when :contains_key | ||
Types::DataTypeRuleContainsKeyType | ||
when :contains_type | ||
Types::DataTypeRuleContainsTypeType | ||
when :number_range | ||
Types::DataTypeRuleNumberRangeType | ||
when :item_of_collection | ||
Types::DataTypeRuleItemOfCollectionType | ||
when :regex | ||
Types::DataTypeRuleRegexType | ||
else | ||
raise GraphQL::ExecutionError, "Unknown data type rule variant: #{object.variant}" | ||
end | ||
end | ||
end | ||
end | ||
end |
15 changes: 15 additions & 0 deletions
15
app/graphql/types/data_type_rules/contains_key_config_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,15 @@ | ||
# frozen_string_literal: true | ||
|
||
module Types | ||
module DataTypeRules | ||
class ContainsKeyConfigType < Types::BaseObject | ||
description 'Represents a rule that can be applied to a data type.' | ||
|
||
authorize :read_flow | ||
Knerio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
field :data_type_identifier, Types::DataTypeIdentifierType, | ||
null: false, description: 'The identifier of the data type this rule belongs to' | ||
field :key, String, null: false, description: 'The key of the rule' | ||
end | ||
end | ||
end |
14 changes: 14 additions & 0 deletions
14
app/graphql/types/data_type_rules/contains_type_config_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,14 @@ | ||
# frozen_string_literal: true | ||
|
||
module Types | ||
module DataTypeRules | ||
class ContainsTypeConfigType < Types::BaseObject | ||
description 'Represents a rule that can be applied to a data type.' | ||
|
||
authorize :read_flow | ||
|
||
field :data_type_identifier, Types::DataTypeIdentifierType, | ||
null: false, description: 'The identifier of the data type this rule belongs to' | ||
end | ||
end | ||
end |
24 changes: 24 additions & 0 deletions
24
app/graphql/types/data_type_rules/data_type_rule_variant_enum.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,24 @@ | ||
# frozen_string_literal: true | ||
|
||
module Types | ||
module DataTypeRules | ||
class DataTypeRuleVariantEnum < Types::BaseEnum | ||
description 'The type of rule that can be applied to a data type.' | ||
|
||
value :CONTAINS_KEY, 'The rule checks if a key is present in the data type.', | ||
value: :contains_key | ||
value :CONTAINS_TYPE, 'The rule checks if a specific type is present in the data type.', | ||
value: :contains_type | ||
value :NUMBER_RANGE, 'The rule checks if a number falls within a specified range.', | ||
value: :number_range | ||
value :ITEM_OF_COLLECTION, 'The rule checks if an item is part of a collection in the data type.', | ||
value: :item_of_collection | ||
value :REGEX, 'The rule checks if a string matches a specified regular expression.', | ||
value: :regex | ||
value :INPUT_TYPE, 'The rule checks if the data type matches a specific input type.', | ||
value: :input_type | ||
value :RETURN_TYPE, 'The rule checks if the data type matches a specific return type.', | ||
value: :return_type | ||
end | ||
end | ||
end |
11 changes: 11 additions & 0 deletions
11
app/graphql/types/data_type_rules/input_types_config_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,11 @@ | ||
# frozen_string_literal: true | ||
|
||
module Types | ||
module DataTypeRules | ||
class InputTypesConfigType < Types::BaseObject | ||
Knerio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
description 'Represents a rule that can be applied to a data type.' | ||
|
||
authorize :read_flow | ||
end | ||
end | ||
end |
14 changes: 14 additions & 0 deletions
14
app/graphql/types/data_type_rules/item_of_collection_config_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,14 @@ | ||
# frozen_string_literal: true | ||
|
||
module Types | ||
module DataTypeRules | ||
class ItemOfCollectionConfigType < Types::BaseObject | ||
description 'Represents a rule that can be applied to a data type.' | ||
|
||
authorize :read_flow | ||
|
||
field :items, [GraphQL::Types::JSON], null: true, | ||
description: 'The items that can be configured for this rule.' | ||
end | ||
end | ||
end |
18 changes: 18 additions & 0 deletions
18
app/graphql/types/data_type_rules/number_range_config_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,18 @@ | ||
# frozen_string_literal: true | ||
|
||
module Types | ||
module DataTypeRules | ||
class NumberRangeConfigType < Types::BaseObject | ||
description 'Represents a rule that can be applied to a data type.' | ||
|
||
authorize :read_flow | ||
|
||
field :from, Integer, null: false, | ||
description: 'The minimum value of the range' | ||
field :steps, Integer, null: true, | ||
description: 'The step value for the range, if applicable' | ||
field :to, Integer, null: false, | ||
description: 'The maximum value of the range' | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# frozen_string_literal: true | ||
|
||
module Types | ||
module DataTypeRules | ||
class RegexConfigType < Types::BaseObject | ||
description 'Represents a rule that can be applied to a data type.' | ||
|
||
authorize :read_flow | ||
|
||
field :pattern, String, null: false, | ||
description: 'The regex pattern to match against the data type value.' | ||
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
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.