Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions app/graphql/types/data_type_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class DataTypeType < Types::BaseObject
authorize :read_datatype

field :aliases, [Types::TranslationType], null: true, description: 'Name of the function'
field :definition_source, String, null: true, description: 'The source that defines this datatype'
field :display_messages, [Types::TranslationType], null: true,
description: 'Display message of the function'
field :generic_keys, [String], null: false, description: 'The generic keys of the datatype'
Expand All @@ -18,6 +19,7 @@ class DataTypeType < Types::BaseObject
field :runtime, Types::RuntimeType, null: true,
description: 'The runtime where this datatype belongs to'
field :type, String, null: false, description: 'The type of the datatype'
field :version, String, null: false, description: 'The version of the datatype'

field :linked_data_types, Types::DataTypeType.connection_type,
null: false,
Expand Down
1 change: 1 addition & 0 deletions app/graphql/types/flow_type_setting_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class FlowTypeSettingType < Types::BaseObject

authorize :read_flow_type_setting

field :default_value, GraphQL::Types::JSON, null: true, description: 'Default value of the flow type setting'
field :descriptions, [Types::TranslationType], null: false,
description: 'Descriptions of the flow type setting'
field :flow_type, Types::FlowTypeType, null: true, description: 'Flow type of the flow type setting'
Expand Down
9 changes: 9 additions & 0 deletions app/graphql/types/flow_type_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class FlowTypeType < Types::BaseObject
description: 'Descriptions of the flow type'
field :display_messages, [Types::TranslationType], null: true,
description: 'Display message of the function'
field :documentations, [Types::TranslationType], null: true,
description: 'Documentations of the flow type'
field :editable, Boolean, null: false, description: 'Editable status of the flow type'
field :flow_type_settings, [Types::FlowTypeSettingType], null: false,
description: 'Flow type settings of the flow type'
Expand All @@ -20,6 +22,13 @@ class FlowTypeType < Types::BaseObject
description: 'Runtime of the flow type'
field :signature, String, null: false, description: 'Signature of the flow type'

# rubocop:disable GraphQL/ExtractType
field :display_icon, String, null: true, description: 'Display icon of the flow type'
# rubocop:enable GraphQL/ExtractType

field :definition_source, String, null: true, description: 'The source that defines this flow type'
field :version, String, null: false, description: 'Version of the flow type'

field :linked_data_types, Types::DataTypeType.connection_type,
null: false,
description: 'The data types that are referenced in this flow type'
Expand Down
9 changes: 9 additions & 0 deletions app/graphql/types/function_definition_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ class FunctionDefinitionType < Types::BaseObject
field :throws_error, Boolean,
null: false, description: 'Indicates if the function can throw an error'

# rubocop:disable GraphQL/ExtractType
field :display_icon, String,
null: true, description: 'Display icon of the function'
# rubocop:enable GraphQL/ExtractType

field :linked_data_types, Types::DataTypeType.connection_type,
null: false,
description: 'All data types referenced within this function definition'
Expand All @@ -52,6 +57,10 @@ def throws_error
object.runtime_function_definition&.throws_error
end

def display_icon
object.runtime_function_definition&.display_icon
end

def linked_data_types
return [] unless object.runtime_function_definition

Expand Down
3 changes: 3 additions & 0 deletions app/graphql/types/parameter_definition_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ class ParameterDefinitionType < Types::BaseObject
field :runtime_parameter_definition, Types::RuntimeParameterDefinitionType,
null: true, description: 'Runtime parameter definition'

field :default_value, GraphQL::Types::JSON,
null: true, description: 'Default value of the parameter'

id_field ParameterDefinition
timestamps

Expand Down
28 changes: 28 additions & 0 deletions app/graphql/types/runtime_function_definition_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,34 @@ class RuntimeFunctionDefinitionType < Types::BaseObject
null: false,
description: 'Signature of the runtime function definition'

field :throws_error, Boolean,
null: false,
description: 'Indicates if the function can throw an error'

field :display_icon, String,
null: true,
description: 'Display icon of the runtime function definition'

field :version, String,
null: false,
description: 'Version of the runtime function definition'

field :definition_source, String,
null: true,
description: 'The source that defines this definition'

field :aliases, [Types::TranslationType], null: true, description: 'Aliases'
field :deprecation_messages, [Types::TranslationType], null: true,
description: 'Deprecation messages'
field :descriptions, [Types::TranslationType], null: true,
description: 'Descriptions of the runtime function definition'
# rubocop:disable GraphQL/ExtractType
field :display_messages, [Types::TranslationType], null: true, description: 'Display messages'
# rubocop:enable GraphQL/ExtractType
field :documentations, [Types::TranslationType], null: true,
description: 'Documentations of the runtime function definition'
field :names, [Types::TranslationType], null: true, description: 'Names of the runtime function definition'

field :linked_data_types, Types::DataTypeType.connection_type,
null: false,
description: 'The data types that are referenced in this runtime function definition'
Expand Down
10 changes: 10 additions & 0 deletions app/graphql/types/runtime_parameter_definition_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ class RuntimeParameterDefinitionType < Types::BaseObject
description: 'Identifier of the runtime parameter definition',
method: :runtime_name

field :default_value, GraphQL::Types::JSON,
null: true,
description: 'Default value of the runtime parameter definition'

field :descriptions, [Types::TranslationType], null: true,
description: 'Descriptions of the runtime parameter definition'
field :documentations, [Types::TranslationType], null: true,
description: 'Documentations of the runtime parameter definition'
field :names, [Types::TranslationType], null: true, description: 'Names of the runtime parameter definition'

id_field RuntimeParameterDefinition
timestamps
end
Expand Down
4 changes: 3 additions & 1 deletion app/models/data_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class DataType < ApplicationRecord
has_many :aliases, -> { by_purpose(:alias) }, class_name: 'Translation', as: :owner, inverse_of: :owner

validates :type, presence: true, length: { maximum: 2000 }
validates :definition_source, length: { maximum: 50 }

validate :validate_version

Expand All @@ -41,7 +42,8 @@ def to_grpc
generic_keys: generic_keys,
type: type,
linked_data_type_identifiers: referenced_data_types.map(&:identifier),
version: version
version: version,
definition_source: definition_source
)
end
end
2 changes: 2 additions & 0 deletions app/models/flow_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class FlowType < ApplicationRecord
validates :identifier, presence: true, uniqueness: { scope: :runtime_id }
validates :editable, inclusion: { in: [true, false] }
validates :signature, presence: true, length: { maximum: 500 }
validates :definition_source, length: { maximum: 50 }
validates :display_icon, length: { maximum: 100 }

has_many :names, -> { by_purpose(:name) }, class_name: 'Translation', as: :owner, inverse_of: :owner
has_many :descriptions, -> { by_purpose(:description) }, class_name: 'Translation', as: :owner, inverse_of: :owner
Expand Down
3 changes: 2 additions & 1 deletion app/models/node_function.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ def to_grpc
database_id: id,
runtime_function_id: function_definition.runtime_function_definition.runtime_name,
parameters: ordered_parameters.map(&:to_grpc),
next_node_id: next_node&.id
next_node_id: next_node&.id,
definition_source: function_definition.runtime_function_definition.definition_source
)
end

Expand Down
6 changes: 5 additions & 1 deletion app/models/runtime_function_definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class RuntimeFunctionDefinition < ApplicationRecord
uniqueness: { case_sensitive: false, scope: :runtime_id }

validates :signature, presence: true, length: { maximum: 500 }
validates :definition_source, length: { maximum: 50 }
validates :display_icon, length: { maximum: 100 }

validate :validate_version

Expand Down Expand Up @@ -53,7 +55,9 @@ def to_grpc
display_message: display_messages.map(&:to_grpc),
alias: aliases.map(&:to_grpc),
linked_data_type_identifiers: referenced_data_types.map(&:identifier),
version: version
version: version,
definition_source: definition_source,
display_icon: display_icon
)
end
end
1 change: 1 addition & 0 deletions app/services/runtimes/grpc/data_types/update_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def update_datatype(data_type, t)
db_object.display_messages = update_translations(data_type.display_message, db_object.display_messages)
db_object.generic_keys = data_type.generic_keys.to_a
db_object.version = data_type.version
db_object.definition_source = data_type.definition_source
link_data_types(db_object, data_type.linked_data_type_identifiers, t)
db_object.save
db_object
Expand Down
2 changes: 2 additions & 0 deletions app/services/runtimes/grpc/flow_types/update_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ def update_flowtype(flow_type, t)
db_object.display_messages = update_translations(flow_type.display_message, db_object.display_messages)
db_object.aliases = update_translations(flow_type.alias, db_object.aliases)
db_object.version = flow_type.version
db_object.definition_source = flow_type.definition_source
db_object.display_icon = flow_type.display_icon
db_object.flow_type_settings = update_settings(flow_type.settings, db_object, t)
link_data_types(db_object, flow_type.linked_data_type_identifiers, t)
db_object.save
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ def update_runtime_function_definition(runtime_function_definition, t)
db_object.signature = runtime_function_definition.signature
db_object.throws_error = runtime_function_definition.throws_error
db_object.version = runtime_function_definition.version
db_object.definition_source = runtime_function_definition.definition_source
db_object.display_icon = runtime_function_definition.display_icon
db_object.names = update_translations(runtime_function_definition.name, db_object.names)
db_object.descriptions = update_translations(runtime_function_definition.description, db_object.descriptions)
db_object.documentations = update_translations(runtime_function_definition.documentation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ class UpdateFlowAndFlowTypeToTucana0066 < Code0::ZeroTrack::Database::Migration[
def change
remove_column :flow_types, :input_type, :text, limit: 2000
remove_column :flow_types, :return_type, :text, limit: 2000
add_column :flow_types, :signature, :text, null: false, default: ''
add_check_constraint :flow_types, 'char_length(signature) <= 500'
add_column :flow_types, :signature, :text, null: false, default: '', limit: 500

remove_column :flows, :input_type, :text, limit: 2000
remove_column :flows, :return_type, :text, limit: 2000
add_column :flows, :signature, :text, null: false, default: ''
add_check_constraint :flows, 'char_length(signature) <= 500'
add_column :flows, :signature, :text, null: false, default: '', limit: 500

remove_column :flow_type_settings, :type, :text, null: false, limit: 2000

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

class AddDefinitionSourceAndDisplayIcon < Code0::ZeroTrack::Database::Migration[1.0]
def change
add_column :runtime_function_definitions, :definition_source, :text, limit: 50
add_column :runtime_function_definitions, :display_icon, :text, limit: 100

add_column :data_types, :definition_source, :text, limit: 50

add_column :flow_types, :definition_source, :text, limit: 50
add_column :flow_types, :display_icon, :text, limit: 100
end
end
1 change: 1 addition & 0 deletions db/schema_migrations/20260405161500
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3ff259a273ef1870a93522ef10c71fea404d4dd3bb144ddd3e9e9cc53f4fedbb
16 changes: 13 additions & 3 deletions db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,10 @@ CREATE TABLE data_types (
generic_keys text[] DEFAULT '{}'::text[] NOT NULL,
version text NOT NULL,
type text NOT NULL,
definition_source text,
CONSTRAINT check_01ca31b7b9 CHECK ((char_length(type) <= 2000)),
CONSTRAINT check_3a7198812e CHECK ((char_length(identifier) <= 50))
CONSTRAINT check_3a7198812e CHECK ((char_length(identifier) <= 50)),
CONSTRAINT check_a133157a46 CHECK ((char_length(definition_source) <= 50))
);

CREATE SEQUENCE data_types_id_seq
Expand Down Expand Up @@ -260,7 +262,11 @@ CREATE TABLE flow_types (
updated_at timestamp with time zone NOT NULL,
version text NOT NULL,
signature text DEFAULT ''::text NOT NULL,
CONSTRAINT chk_rails_7fce2d945c CHECK ((char_length(signature) <= 500))
definition_source text,
display_icon text,
CONSTRAINT check_3311b57eb7 CHECK ((char_length(definition_source) <= 50)),
CONSTRAINT check_3f33e69ae0 CHECK ((char_length(display_icon) <= 100)),
CONSTRAINT check_dfcfd661f1 CHECK ((char_length(signature) <= 500))
);

CREATE SEQUENCE flow_types_id_seq
Expand All @@ -283,7 +289,7 @@ CREATE TABLE flows (
validation_status integer DEFAULT 0 NOT NULL,
disabled_reason integer,
signature text DEFAULT ''::text NOT NULL,
CONSTRAINT chk_rails_8058ebff6e CHECK ((char_length(signature) <= 500))
CONSTRAINT check_8c731c24ec CHECK ((char_length(signature) <= 500))
);

CREATE SEQUENCE flows_id_seq
Expand Down Expand Up @@ -703,7 +709,11 @@ CREATE TABLE runtime_function_definitions (
updated_at timestamp with time zone NOT NULL,
version text NOT NULL,
signature text NOT NULL,
definition_source text,
display_icon text,
CONSTRAINT check_4cf530fb6a CHECK ((char_length(definition_source) <= 50)),
CONSTRAINT check_86da361565 CHECK ((char_length(signature) <= 500)),
CONSTRAINT check_ef62cf61e5 CHECK ((char_length(display_icon) <= 100)),
CONSTRAINT check_fe8fff4f27 CHECK ((char_length(runtime_name) <= 50))
);

Expand Down
2 changes: 2 additions & 0 deletions docs/graphql/object/datatype.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Represents a DataType
|------|------|-------------|
| `aliases` | [`[Translation!]`](../object/translation.md) | Name of the function |
| `createdAt` | [`Time!`](../scalar/time.md) | Time when this DataType was created |
| `definitionSource` | [`String`](../scalar/string.md) | The source that defines this datatype |
| `displayMessages` | [`[Translation!]`](../object/translation.md) | Display message of the function |
| `genericKeys` | [`[String!]!`](../scalar/string.md) | The generic keys of the datatype |
| `id` | [`DataTypeID!`](../scalar/datatypeid.md) | Global ID of this DataType |
Expand All @@ -20,4 +21,5 @@ Represents a DataType
| `runtime` | [`Runtime`](../object/runtime.md) | The runtime where this datatype belongs to |
| `type` | [`String!`](../scalar/string.md) | The type of the datatype |
| `updatedAt` | [`Time!`](../scalar/time.md) | Time when this DataType was last updated |
| `version` | [`String!`](../scalar/string.md) | The version of the datatype |

4 changes: 4 additions & 0 deletions docs/graphql/object/flowtype.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ Represents a flow type
|------|------|-------------|
| `aliases` | [`[Translation!]`](../object/translation.md) | Name of the function |
| `createdAt` | [`Time!`](../scalar/time.md) | Time when this FlowType was created |
| `definitionSource` | [`String`](../scalar/string.md) | The source that defines this flow type |
| `descriptions` | [`[Translation!]`](../object/translation.md) | Descriptions of the flow type |
| `displayIcon` | [`String`](../scalar/string.md) | Display icon of the flow type |
| `displayMessages` | [`[Translation!]`](../object/translation.md) | Display message of the function |
| `documentations` | [`[Translation!]`](../object/translation.md) | Documentations of the flow type |
| `editable` | [`Boolean!`](../scalar/boolean.md) | Editable status of the flow type |
| `flowTypeSettings` | [`[FlowTypeSetting!]!`](../object/flowtypesetting.md) | Flow type settings of the flow type |
| `id` | [`FlowTypeID!`](../scalar/flowtypeid.md) | Global ID of this FlowType |
Expand All @@ -21,4 +24,5 @@ Represents a flow type
| `runtime` | [`Runtime!`](../object/runtime.md) | Runtime of the flow type |
| `signature` | [`String!`](../scalar/string.md) | Signature of the flow type |
| `updatedAt` | [`Time!`](../scalar/time.md) | Time when this FlowType was last updated |
| `version` | [`String!`](../scalar/string.md) | Version of the flow type |

1 change: 1 addition & 0 deletions docs/graphql/object/flowtypesetting.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Represents a flow type setting
| Name | Type | Description |
|------|------|-------------|
| `createdAt` | [`Time!`](../scalar/time.md) | Time when this FlowTypeSetting was created |
| `defaultValue` | [`JSON`](../scalar/json.md) | Default value of the flow type setting |
| `descriptions` | [`[Translation!]!`](../object/translation.md) | Descriptions of the flow type setting |
| `flowType` | [`FlowType`](../object/flowtype.md) | Flow type of the flow type setting |
| `id` | [`FlowTypeSettingID!`](../scalar/flowtypesettingid.md) | Global ID of this FlowTypeSetting |
Expand Down
1 change: 1 addition & 0 deletions docs/graphql/object/functiondefinition.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Represents a function definition
| `createdAt` | [`Time!`](../scalar/time.md) | Time when this FunctionDefinition was created |
| `deprecationMessages` | [`[Translation!]`](../object/translation.md) | Deprecation message of the function |
| `descriptions` | [`[Translation!]`](../object/translation.md) | Description of the function |
| `displayIcon` | [`String`](../scalar/string.md) | Display icon of the function |
| `displayMessages` | [`[Translation!]`](../object/translation.md) | Display message of the function |
| `documentations` | [`[Translation!]`](../object/translation.md) | Documentation of the function |
| `id` | [`FunctionDefinitionID!`](../scalar/functiondefinitionid.md) | Global ID of this FunctionDefinition |
Expand Down
1 change: 1 addition & 0 deletions docs/graphql/object/parameterdefinition.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Represents a parameter definition
| Name | Type | Description |
|------|------|-------------|
| `createdAt` | [`Time!`](../scalar/time.md) | Time when this ParameterDefinition was created |
| `defaultValue` | [`JSON`](../scalar/json.md) | Default value of the parameter |
| `descriptions` | [`[Translation!]`](../object/translation.md) | Description of the parameter |
| `documentations` | [`[Translation!]`](../object/translation.md) | Documentation of the parameter |
| `id` | [`ParameterDefinitionID!`](../scalar/parameterdefinitionid.md) | Global ID of this ParameterDefinition |
Expand Down
Loading