diff --git a/app/graphql/types/data_type_type.rb b/app/graphql/types/data_type_type.rb index 887d8442..62260d1d 100644 --- a/app/graphql/types/data_type_type.rb +++ b/app/graphql/types/data_type_type.rb @@ -4,7 +4,7 @@ module Types class DataTypeType < Types::BaseObject description 'Represents a DataType' - authorize :read_datatype + authorize :read_data_type field :aliases, Types::TranslationType.connection_type, null: true, description: 'Name of the function' field :display_messages, Types::TranslationType.connection_type, null: true, diff --git a/app/graphql/types/runtime_function_definition_type.rb b/app/graphql/types/runtime_function_definition_type.rb index 0b0d75cc..3183963b 100644 --- a/app/graphql/types/runtime_function_definition_type.rb +++ b/app/graphql/types/runtime_function_definition_type.rb @@ -4,7 +4,7 @@ module Types class RuntimeFunctionDefinitionType < Types::BaseObject description 'Represents a runtime function definition' - authorize :read_flow + authorize :read_runtime_function_definition field :runtime, Types::RuntimeType, null: false, description: 'The runtime this runtime function definition belongs to' diff --git a/app/graphql/types/runtime_parameter_definition_type.rb b/app/graphql/types/runtime_parameter_definition_type.rb index 05ecc659..bd7f6eb8 100644 --- a/app/graphql/types/runtime_parameter_definition_type.rb +++ b/app/graphql/types/runtime_parameter_definition_type.rb @@ -4,7 +4,12 @@ module Types class RuntimeParameterDefinitionType < Types::BaseObject description 'Represents a runtime parameter definition' - authorize :read_flow + authorize :read_runtime_parameter_definition + + field :identifier, String, + null: false, + description: 'Identifier of the runtime parameter definition', + method: :runtime_name id_field RuntimeParameterDefinition timestamps diff --git a/app/graphql/types/runtime_type.rb b/app/graphql/types/runtime_type.rb index 80c98162..22026e1b 100644 --- a/app/graphql/types/runtime_type.rb +++ b/app/graphql/types/runtime_type.rb @@ -13,6 +13,9 @@ class RuntimeType < Types::BaseObject field :namespace, Types::NamespaceType, null: true, description: 'The parent namespace for the runtime' field :projects, Types::NamespaceProjectType.connection_type, null: false, description: 'Projects associated with the runtime' + field :runtime_function_definitions, Types::RuntimeFunctionDefinitionType.connection_type, + null: false, + description: 'Functions of the runtime' field :status, Types::RuntimeStatusType, null: false, description: 'The status of the runtime' field :token, String, null: true, description: 'Token belonging to the runtime, only present on creation' diff --git a/app/policies/runtime_parameter_definition_policy.rb b/app/policies/runtime_parameter_definition_policy.rb new file mode 100644 index 00000000..1d4ed609 --- /dev/null +++ b/app/policies/runtime_parameter_definition_policy.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +class RuntimeParameterDefinitionPolicy < BasePolicy + delegate { subject.runtime_function_definition } +end diff --git a/app/policies/runtime_policy.rb b/app/policies/runtime_policy.rb index 12bbd462..280a980a 100644 --- a/app/policies/runtime_policy.rb +++ b/app/policies/runtime_policy.rb @@ -2,4 +2,10 @@ class RuntimePolicy < BasePolicy delegate { subject.namespace || :global } + + rule { can?(:read_runtime) }.policy do + enable :read_data_type + enable :read_runtime_function_definition + enable :read_runtime_parameter_definition + end end diff --git a/docs/graphql/object/runtime.md b/docs/graphql/object/runtime.md index edee1f73..d9dee5e0 100644 --- a/docs/graphql/object/runtime.md +++ b/docs/graphql/object/runtime.md @@ -16,6 +16,7 @@ Represents a runtime | `name` | [`String!`](../scalar/string.md) | The name for the runtime | | `namespace` | [`Namespace`](../object/namespace.md) | The parent namespace for the runtime | | `projects` | [`NamespaceProjectConnection!`](../object/namespaceprojectconnection.md) | Projects associated with the runtime | +| `runtimeFunctionDefinitions` | [`RuntimeFunctionDefinitionConnection!`](../object/runtimefunctiondefinitionconnection.md) | Functions of the runtime | | `status` | [`RuntimeStatusType!`](../enum/runtimestatustype.md) | The status of the runtime | | `token` | [`String`](../scalar/string.md) | Token belonging to the runtime, only present on creation | | `updatedAt` | [`Time!`](../scalar/time.md) | Time when this Runtime was last updated | diff --git a/docs/graphql/object/runtimefunctiondefinitionconnection.md b/docs/graphql/object/runtimefunctiondefinitionconnection.md new file mode 100644 index 00000000..9de26754 --- /dev/null +++ b/docs/graphql/object/runtimefunctiondefinitionconnection.md @@ -0,0 +1,15 @@ +--- +title: RuntimeFunctionDefinitionConnection +--- + +The connection type for RuntimeFunctionDefinition. + +## Fields without arguments + +| Name | Type | Description | +|------|------|-------------| +| `count` | [`Int!`](../scalar/int.md) | Total count of collection. | +| `edges` | [`[RuntimeFunctionDefinitionEdge]`](../object/runtimefunctiondefinitionedge.md) | A list of edges. | +| `nodes` | [`[RuntimeFunctionDefinition]`](../object/runtimefunctiondefinition.md) | A list of nodes. | +| `pageInfo` | [`PageInfo!`](../object/pageinfo.md) | Information to aid in pagination. | + diff --git a/docs/graphql/object/runtimefunctiondefinitionedge.md b/docs/graphql/object/runtimefunctiondefinitionedge.md new file mode 100644 index 00000000..72b92fe7 --- /dev/null +++ b/docs/graphql/object/runtimefunctiondefinitionedge.md @@ -0,0 +1,13 @@ +--- +title: RuntimeFunctionDefinitionEdge +--- + +An edge in a connection. + +## Fields without arguments + +| Name | Type | Description | +|------|------|-------------| +| `cursor` | [`String!`](../scalar/string.md) | A cursor for use in pagination. | +| `node` | [`RuntimeFunctionDefinition`](../object/runtimefunctiondefinition.md) | The item at the end of the edge. | + diff --git a/docs/graphql/object/runtimeparameterdefinition.md b/docs/graphql/object/runtimeparameterdefinition.md index 5435fe13..8fb321d4 100644 --- a/docs/graphql/object/runtimeparameterdefinition.md +++ b/docs/graphql/object/runtimeparameterdefinition.md @@ -10,5 +10,6 @@ Represents a runtime parameter definition |------|------|-------------| | `createdAt` | [`Time!`](../scalar/time.md) | Time when this RuntimeParameterDefinition was created | | `id` | [`RuntimeParameterDefinitionID!`](../scalar/runtimeparameterdefinitionid.md) | Global ID of this RuntimeParameterDefinition | +| `identifier` | [`String!`](../scalar/string.md) | Identifier of the runtime parameter definition | | `updatedAt` | [`Time!`](../scalar/time.md) | Time when this RuntimeParameterDefinition was last updated | diff --git a/spec/graphql/types/runtime_function_definition_type_spec.rb b/spec/graphql/types/runtime_function_definition_type_spec.rb index ce3088a7..5769f8c0 100644 --- a/spec/graphql/types/runtime_function_definition_type_spec.rb +++ b/spec/graphql/types/runtime_function_definition_type_spec.rb @@ -17,5 +17,5 @@ it { expect(described_class.graphql_name).to eq('RuntimeFunctionDefinition') } it { expect(described_class).to have_graphql_fields(fields) } - it { expect(described_class).to require_graphql_authorizations(:read_flow) } + it { expect(described_class).to require_graphql_authorizations(:read_runtime_function_definition) } end diff --git a/spec/graphql/types/runtime_parameter_definition_type_spec.rb b/spec/graphql/types/runtime_parameter_definition_type_spec.rb index b087e41a..a5f835a1 100644 --- a/spec/graphql/types/runtime_parameter_definition_type_spec.rb +++ b/spec/graphql/types/runtime_parameter_definition_type_spec.rb @@ -6,6 +6,7 @@ let(:fields) do %w[ id + identifier createdAt updatedAt ] @@ -13,5 +14,5 @@ it { expect(described_class.graphql_name).to eq('RuntimeParameterDefinition') } it { expect(described_class).to have_graphql_fields(fields) } - it { expect(described_class).to require_graphql_authorizations(:read_flow) } + it { expect(described_class).to require_graphql_authorizations(:read_runtime_parameter_definition) } end diff --git a/spec/graphql/types/runtime_type_spec.rb b/spec/graphql/types/runtime_type_spec.rb index 094ad85f..a59b6d67 100644 --- a/spec/graphql/types/runtime_type_spec.rb +++ b/spec/graphql/types/runtime_type_spec.rb @@ -10,6 +10,7 @@ name dataTypes flowTypes + runtimeFunctionDefinitions description projects status