Skip to content
Merged
Show file tree
Hide file tree
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 May 25, 2025
cdf6cd5
Adjust models and tests
Knerio May 26, 2025
34b580b
Add Rails helper requirement to ping service spec
Knerio May 26, 2025
ed6786f
Refactor foreign key constraints in generics implementation
Knerio May 26, 2025
d5f457d
Recompile structure.sql
Knerio May 26, 2025
2e8cc11
Make migration reversible
Knerio May 27, 2025
51591c4
Fix rubocop vulnerabilities
Knerio May 27, 2025
770abe6
Refactor generic type and mapper associations (tucana 0.0.28)
Knerio May 27, 2025
f69ad49
Recompile structure.sql
Knerio May 28, 2025
87fc346
Fix rubocop vulnerabilities
Knerio May 28, 2025
7528ffb
Recompile structure.sql
Knerio May 29, 2025
13bad43
Adjust models and tests
Knerio May 26, 2025
67622d6
Update datatype model and runtime function (definition) models
Knerio May 25, 2025
025e136
Adjust models and tests
Knerio May 26, 2025
f134b7d
Adjust models and tests
Knerio May 26, 2025
1842be2
Create flow model and everything associated with it (no functionality…
Knerio May 26, 2025
df1ca1d
Add flows association to NamespaceProject and update schema
Knerio May 26, 2025
89cdb7e
Create create/update/delete services for flows
Knerio May 26, 2025
aeeeca6
Recompile structure.sql
Knerio May 26, 2025
ab23a96
Fix rubocop vulnerabilities
Knerio May 26, 2025
2f904c9
Add flow update and delete services specs
Knerio May 27, 2025
b2d9b4b
Refactor generic type and mapper associations (tucana 0.0.28); update…
Knerio May 27, 2025
dad9ba6
Refactor flow associations to use input_type and return_type instead …
Knerio May 28, 2025
d647f0b
Changeup flow setting to allign with https://github.com/code0-tech/tu…
Knerio May 28, 2025
85b8f5c
Recompile structure.sql
Knerio May 29, 2025
77c7747
Update datatype model and runtime function (definition) models
Knerio May 25, 2025
330d3e2
Adjust models and tests
Knerio May 26, 2025
4693057
Fix singleton methods and runtime assignments
Knerio May 28, 2025
418567e
Add logging capabilities to FlowHandler by including Loggable module
Knerio May 28, 2025
b4893a9
Add logging for data type updates and improve datatype retrieval method
Knerio May 28, 2025
b7c19f6
Fix formatting
Knerio May 28, 2025
0764b7d
Create graphql input/types
Knerio May 28, 2025
e0d0ce1
Add validation services for data types and node functions, enhance in…
Knerio May 28, 2025
2b6b2c9
Enhance flow creation and validation process with new data types and …
Knerio May 29, 2025
d8f76e7
Recompile structure.sql
Knerio May 29, 2025
bf83653
Refactor generic types and mappers, update data type associations, an…
Knerio May 29, 2025
5047588
Refactor validation services and input types, enhance logging, and im…
Knerio May 29, 2025
dc7aa4d
Refactor flow creation and validation services, enhance error handlin…
Knerio May 30, 2025
6a38727
Add generic combination strategies and update generic mapper structur…
Knerio May 30, 2025
360e366
Add Zone.Identifier to .gitignore to prevent unwanted file tracking
Knerio May 30, 2025
a09d8b2
Refactor generic mapper associations and update Gemfile for local pat…
Knerio May 30, 2025
fa0f944
Update tucana gem version to 0.0.30
Knerio May 31, 2025
37731db
remove parameter_id of function generic mapper
Knerio Jun 6, 2025
49786ec
remove_reference also has specifies the foreign key now
Knerio Jun 6, 2025
9b522ce
Add validation and constraints for generic_keys length in data types …
Knerio Jun 6, 2025
12d5a59
Remove runtime association from GenericType and related specs and rem…
Knerio Jun 6, 2025
f17379e
Fix rubocop vulnerabilities
Knerio Jun 6, 2025
c3ddbc9
Update references in runtime and parameter definitions to allow null …
Knerio Jun 6, 2025
10acdb0
Add presence and inclusion validations for type in GenericCombination…
Knerio Jun 6, 2025
0d9487d
Change :base to :value
Knerio Jun 6, 2025
b836858
Change description of abilities and remove update_flows as its not im…
Knerio Jun 6, 2025
a6ff8ba
Update foreign key constraints to use cascade on delete and enforce p…
Knerio Jun 6, 2025
c37d4f1
Regenerate docs
Knerio Jun 6, 2025
1ec9b35
Recompile structure.sql
Knerio Jun 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
*.njsproj
*.sln
*.sw?
**/*Zone.Identifier

################
##
Expand Down
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ gem 'good_job', '~> 4.0'
gem 'rotp'

gem 'grpc', '~> 1.67'
gem 'tucana', '0.0.25'
gem 'tucana', '0.0.30'

gem 'code0-identities', '~> 0.0.1'

Expand All @@ -89,3 +89,5 @@ gem 'pry-byebug', '~> 3.10'
gem 'code0-zero_track', '0.0.4'

gem 'image_processing', '>= 1.2'

gem 'json-schema', '~> 5.1'
11 changes: 9 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ GEM
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
uri (>= 0.13.1)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
ast (2.4.3)
base64 (0.2.0)
bcrypt (3.1.20)
Expand Down Expand Up @@ -154,6 +156,9 @@ GEM
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.12.0)
json-schema (5.1.1)
addressable (~> 2.8)
bigdecimal (~> 3.1)
language_server-protocol (3.17.0.5)
lint_roller (1.1.0)
logger (1.7.0)
Expand Down Expand Up @@ -212,6 +217,7 @@ GEM
psych (5.2.6)
date
stringio
public_suffix (6.0.2)
puma (6.6.0)
nio4r (~> 2.0)
raabro (1.4.0)
Expand Down Expand Up @@ -356,7 +362,7 @@ GEM
test-prof (1.4.4)
thor (1.3.2)
timeout (0.4.3)
tucana (0.0.25)
tucana (0.0.30)
grpc (~> 1.64)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
Expand Down Expand Up @@ -389,6 +395,7 @@ DEPENDENCIES
graphql (~> 2.1)
grpc (~> 1.67)
image_processing (>= 1.2)
json-schema (~> 5.1)
lograge (~> 0.14.0)
pg (~> 1.1)
pry (~> 0.14.2)
Expand All @@ -409,7 +416,7 @@ DEPENDENCIES
simplecov (~> 0.22.0)
simplecov-cobertura (~> 2.1)
test-prof (~> 1.0)
tucana (= 0.0.25)
tucana (= 0.0.30)
tzinfo-data

RUBY VERSION
Expand Down
55 changes: 55 additions & 0 deletions app/graphql/mutations/namespaces/projects/flows/create.rb
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
32 changes: 32 additions & 0 deletions app/graphql/mutations/namespaces/projects/flows/delete.rb
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
1 change: 1 addition & 0 deletions app/graphql/sagittarius_schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def self.object_from_id(global_id, query_ctx = nil)
rescue ActiveRecord::RecordNotFound
nil
end

# rubocop:enable Lint/UnusedMethodArgument
end
# rubocop:enable GraphQL/MaxDepthSchema
Expand Down
4 changes: 4 additions & 0 deletions app/graphql/types/base_input_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
module Types
class BaseInputObject < GraphQL::Schema::InputObject
argument_class Types::BaseArgument

def self.require_one_of(arguments)
validates required: { one_of: arguments, message: "Only one of #{arguments.inspect} should be provided" }
end
end
end
23 changes: 23 additions & 0 deletions app/graphql/types/data_type_identifier_type.rb
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
19 changes: 19 additions & 0 deletions app/graphql/types/data_type_rule_type.rb
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
29 changes: 29 additions & 0 deletions app/graphql/types/data_type_rules/config_type.rb
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)
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 app/graphql/types/data_type_rules/contains_key_config_type.rb
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

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 app/graphql/types/data_type_rules/contains_type_config_type.rb
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 app/graphql/types/data_type_rules/data_type_rule_variant_enum.rb
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 app/graphql/types/data_type_rules/input_types_config_type.rb
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
description 'Represents a rule that can be applied to a data type.'

authorize :read_flow
end
end
end
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 app/graphql/types/data_type_rules/number_range_config_type.rb
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
14 changes: 14 additions & 0 deletions app/graphql/types/data_type_rules/regex_config_type.rb
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
10 changes: 9 additions & 1 deletion app/graphql/types/data_type_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,18 @@ class DataTypeType < Types::BaseObject

authorize :read_datatype

field :generic_keys, [String], null: true, description: 'Generic keys of the datatype'
field :identifier, String, null: false, description: 'The identifier scoped to the namespace'
field :name, Types::TranslationType.connection_type, method: :names, null: false,
description: 'Names of the flow type setting'
field :namespace, Types::NamespaceType, null: true,
description: 'The namespace where this datatype belongs to'
field :variant, Types::DataTypeVariantEnum, null: false, description: 'The type of the datatype'
field :parent, Types::DataTypeIdentifierType,
null: true, description: 'The parent datatype'
field :rules, Types::DataTypeRuleType.connection_type, null: false,
description: 'Rules of the datatype'
field :variant, Types::DataTypeVariantEnum, null: false,
description: 'The type of the datatype'

id_field DataType
timestamps
Expand Down
Loading