diff options
Diffstat (limited to 'app/graphql/types')
66 files changed, 886 insertions, 479 deletions
diff --git a/app/graphql/types/abuse_report_type.rb b/app/graphql/types/abuse_report_type.rb new file mode 100644 index 00000000000..012e709cdb5 --- /dev/null +++ b/app/graphql/types/abuse_report_type.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Types + class AbuseReportType < BaseObject + graphql_name 'AbuseReport' + description 'An abuse report' + authorize :read_abuse_report + + field :labels, ::Types::LabelType.connection_type, + null: true, description: 'Labels of the abuse report.' + end +end diff --git a/app/graphql/types/access_levels/deploy_key_type.rb b/app/graphql/types/access_levels/deploy_key_type.rb new file mode 100644 index 00000000000..e4e90619891 --- /dev/null +++ b/app/graphql/types/access_levels/deploy_key_type.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module Types + module AccessLevels + class DeployKeyType < BaseObject + graphql_name 'AccessLevelDeployKey' + description 'Representation of a GitLab deploy key.' + + authorize :read_deploy_key + + field :id, + type: GraphQL::Types::ID, + null: false, + description: 'ID of the deploy key.' + + field :title, + type: GraphQL::Types::String, + null: false, + description: 'Title of the deploy key.' + + field :expires_at, + type: Types::DateType, + null: true, + description: 'Expiration date of the deploy key.' + + field :user, + type: Types::AccessLevels::UserType, + null: false, + description: 'User assigned to the deploy key.' + end + end +end diff --git a/app/graphql/types/access_levels/user_type.rb b/app/graphql/types/access_levels/user_type.rb new file mode 100644 index 00000000000..82aba673250 --- /dev/null +++ b/app/graphql/types/access_levels/user_type.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true + +module Types + module AccessLevels + class UserType < BaseObject + graphql_name 'AccessLevelUser' + description 'Representation of a GitLab user.' + + authorize :read_user + + present_using UserPresenter + + field :id, + type: GraphQL::Types::ID, + null: false, + description: 'ID of the user.' + + field :username, + type: GraphQL::Types::String, + null: false, + description: 'Username of the user.' + + field :name, + type: GraphQL::Types::String, + null: false, + resolver_method: :redacted_name, + description: <<~DESC + Human-readable name of the user. + Returns `****` if the user is a project bot and the requester does not have permission to view the project. + DESC + + field :public_email, + type: GraphQL::Types::String, + null: true, + description: "User's public email." + + field :avatar_url, + type: GraphQL::Types::String, + null: true, + description: "URL of the user's avatar." + + field :web_url, + type: GraphQL::Types::String, + null: false, + description: 'Web URL of the user.' + + field :web_path, + type: GraphQL::Types::String, + null: false, + description: 'Web path of the user.' + + def redacted_name + object.redacted_name(context[:current_user]) + end + + def avatar_url + object.avatar_url(only_path: false) + end + end + end +end diff --git a/app/graphql/types/achievements/achievement_type.rb b/app/graphql/types/achievements/achievement_type.rb index ec558981465..d733bf39a51 100644 --- a/app/graphql/types/achievements/achievement_type.rb +++ b/app/graphql/types/achievements/achievement_type.rb @@ -5,6 +5,8 @@ module Types class AchievementType < BaseObject graphql_name 'Achievement' + connection_type_class Types::CountableConnectionType + authorize :read_achievement field :id, diff --git a/app/graphql/types/achievements/user_achievement_type.rb b/app/graphql/types/achievements/user_achievement_type.rb index bf161d2f1e5..7cdcb66576c 100644 --- a/app/graphql/types/achievements/user_achievement_type.rb +++ b/app/graphql/types/achievements/user_achievement_type.rb @@ -5,6 +5,8 @@ module Types class UserAchievementType < BaseObject graphql_name 'UserAchievement' + connection_type_class Types::CountableConnectionType + authorize :read_user_achievement field :id, diff --git a/app/graphql/types/alert_management/alert_type.rb b/app/graphql/types/alert_management/alert_type.rb index c17406b3e56..e85d0213613 100644 --- a/app/graphql/types/alert_management/alert_type.rb +++ b/app/graphql/types/alert_management/alert_type.rb @@ -8,8 +8,8 @@ module Types present_using ::AlertManagement::AlertPresenter - implements(Types::Notes::NoteableInterface) - implements(Types::TodoableInterface) + implements Types::Notes::NoteableInterface + implements Types::TodoableInterface authorize :read_alert_management_alert @@ -111,6 +111,12 @@ module Types null: true, description: 'Assignees of the alert.' + field :metrics_dashboard_url, + GraphQL::Types::String, + null: true, + description: 'URL for metrics embed for the alert.', + deprecated: { reason: 'Returns no data. Underlying feature was removed in 16.0', + milestone: '16.0' } field :runbook, GraphQL::Types::String, null: true, @@ -136,6 +142,10 @@ module Types method: :details_url, null: false, description: 'URL of the alert.' + + def metrics_dashboard_url + nil + end end end end diff --git a/app/graphql/types/alert_management/http_integration_type.rb b/app/graphql/types/alert_management/http_integration_type.rb index bba9cb1bbfc..7c026be86a3 100644 --- a/app/graphql/types/alert_management/http_integration_type.rb +++ b/app/graphql/types/alert_management/http_integration_type.rb @@ -6,7 +6,7 @@ module Types graphql_name 'AlertManagementHttpIntegration' description 'An endpoint and credentials used to accept alerts for a project' - implements(Types::AlertManagement::IntegrationType) + implements Types::AlertManagement::IntegrationType authorize :admin_operations diff --git a/app/graphql/types/alert_management/prometheus_integration_type.rb b/app/graphql/types/alert_management/prometheus_integration_type.rb index 9a2ef78eca7..0f61eeaa177 100644 --- a/app/graphql/types/alert_management/prometheus_integration_type.rb +++ b/app/graphql/types/alert_management/prometheus_integration_type.rb @@ -8,7 +8,7 @@ module Types include ::Gitlab::Routing - implements(Types::AlertManagement::IntegrationType) + implements Types::AlertManagement::IntegrationType authorize :admin_project diff --git a/app/graphql/types/branch_protections/push_access_level_type.rb b/app/graphql/types/branch_protections/push_access_level_type.rb index c5e21fad88d..2a66f1a4ec5 100644 --- a/app/graphql/types/branch_protections/push_access_level_type.rb +++ b/app/graphql/types/branch_protections/push_access_level_type.rb @@ -6,6 +6,11 @@ module Types graphql_name 'PushAccessLevel' description 'Defines which user roles, users, or groups can push to a protected branch.' accepts ::ProtectedBranch::PushAccessLevel + + field :deploy_key, + Types::AccessLevels::DeployKeyType, + null: true, + description: 'Deploy key assigned to the access level.' end end end diff --git a/app/graphql/types/ci/ci_cd_setting_type.rb b/app/graphql/types/ci/ci_cd_setting_type.rb index f7ef94f58c0..45ecbf5c084 100644 --- a/app/graphql/types/ci/ci_cd_setting_type.rb +++ b/app/graphql/types/ci/ci_cd_setting_type.rb @@ -7,32 +7,37 @@ module Types authorize :admin_project - field :job_token_scope_enabled, - GraphQL::Types::Boolean, - null: true, - description: 'Indicates CI/CD job tokens generated in this project ' \ - 'have restricted access to other projects.', - method: :job_token_scope_enabled? - field :inbound_job_token_scope_enabled, - GraphQL::Types::Boolean, - null: true, - description: 'Indicates CI/CD job tokens generated in other projects ' \ - 'have restricted access to this project.', - method: :inbound_job_token_scope_enabled? - - field :keep_latest_artifact, GraphQL::Types::Boolean, null: true, - description: 'Whether to keep the latest builds artifacts.', - method: :keep_latest_artifacts_available? - field :merge_pipelines_enabled, GraphQL::Types::Boolean, null: true, - description: 'Whether merge pipelines are enabled.', - method: :merge_pipelines_enabled? - field :merge_trains_enabled, GraphQL::Types::Boolean, null: true, - description: 'Whether merge trains are enabled.', - method: :merge_trains_enabled? - - field :project, Types::ProjectType, null: true, - description: 'Project the CI/CD settings belong to.' + GraphQL::Types::Boolean, + null: true, + description: 'Indicates CI/CD job tokens generated in other projects ' \ + 'have restricted access to this project.', + method: :inbound_job_token_scope_enabled? + field :job_token_scope_enabled, + GraphQL::Types::Boolean, + null: true, + description: 'Indicates CI/CD job tokens generated in this project ' \ + 'have restricted access to other projects.', + method: :job_token_scope_enabled? + field :keep_latest_artifact, + GraphQL::Types::Boolean, + null: true, + description: 'Whether to keep the latest builds artifacts.', + method: :keep_latest_artifacts_available? + field :merge_pipelines_enabled, + GraphQL::Types::Boolean, + null: true, + description: 'Whether merge pipelines are enabled.', + method: :merge_pipelines_enabled? + field :merge_trains_enabled, + GraphQL::Types::Boolean, + null: true, + description: 'Whether merge trains are enabled.', + method: :merge_trains_enabled? + field :project, + Types::ProjectType, + null: true, + description: 'Project the CI/CD settings belong to.' end end end diff --git a/app/graphql/types/ci/detailed_status_type.rb b/app/graphql/types/ci/detailed_status_type.rb index 8bc50e974bb..e18770c2708 100644 --- a/app/graphql/types/ci/detailed_status_type.rb +++ b/app/graphql/types/ci/detailed_status_type.rb @@ -39,17 +39,15 @@ module Types end def action - if object.has_action? - { - button_title: object.action_button_title, - icon: object.action_icon, - method: object.action_method, - path: object.action_path, - title: object.action_title - } - else - nil - end + return unless object.has_action? + + { + button_title: object.action_button_title, + icon: object.action_icon, + method: object.action_method, + path: object.action_path, + title: object.action_title + } end end # rubocop: enable Graphql/AuthorizeTypes diff --git a/app/graphql/types/ci/group_environment_scope_type.rb b/app/graphql/types/ci/group_environment_scope_type.rb index 3a3a5a3f59f..0dd0ad963ac 100644 --- a/app/graphql/types/ci/group_environment_scope_type.rb +++ b/app/graphql/types/ci/group_environment_scope_type.rb @@ -7,7 +7,7 @@ module Types graphql_name 'CiGroupEnvironmentScope' description 'Ci/CD environment scope for a group.' - connection_type_class(Types::Ci::GroupEnvironmentScopeConnectionType) + connection_type_class Types::Ci::GroupEnvironmentScopeConnectionType field :name, GraphQL::Types::String, null: true, diff --git a/app/graphql/types/ci/group_variable_type.rb b/app/graphql/types/ci/group_variable_type.rb index 7e2afba0d53..7be9b3df0b8 100644 --- a/app/graphql/types/ci/group_variable_type.rb +++ b/app/graphql/types/ci/group_variable_type.rb @@ -7,8 +7,8 @@ module Types graphql_name 'CiGroupVariable' description 'CI/CD variables for a group.' - connection_type_class(Types::Ci::GroupVariableConnectionType) - implements(VariableInterface) + connection_type_class Types::Ci::GroupVariableConnectionType + implements VariableInterface field :environment_scope, GraphQL::Types::String, null: true, diff --git a/app/graphql/types/ci/instance_variable_type.rb b/app/graphql/types/ci/instance_variable_type.rb index 7ffc52deb73..e3230556769 100644 --- a/app/graphql/types/ci/instance_variable_type.rb +++ b/app/graphql/types/ci/instance_variable_type.rb @@ -7,7 +7,7 @@ module Types graphql_name 'CiInstanceVariable' description 'CI/CD variables for a GitLab instance.' - implements(VariableInterface) + implements VariableInterface field :id, GraphQL::Types::ID, null: false, diff --git a/app/graphql/types/ci/job_type.rb b/app/graphql/types/ci/job_type.rb index 02b10f3e4bd..22eb32993c5 100644 --- a/app/graphql/types/ci/job_type.rb +++ b/app/graphql/types/ci/job_type.rb @@ -9,7 +9,7 @@ module Types present_using ::Ci::BuildPresenter - connection_type_class(Types::LimitedCountableConnectionType) + connection_type_class Types::LimitedCountableConnectionType expose_permissions Types::PermissionTypes::Ci::Job diff --git a/app/graphql/types/ci/manual_variable_type.rb b/app/graphql/types/ci/manual_variable_type.rb index ed92a6645b4..dcdaa3a6b19 100644 --- a/app/graphql/types/ci/manual_variable_type.rb +++ b/app/graphql/types/ci/manual_variable_type.rb @@ -7,7 +7,7 @@ module Types graphql_name 'CiManualVariable' description 'CI/CD variables given to a manual job.' - implements(VariableInterface) + implements VariableInterface field :environment_scope, GraphQL::Types::String, null: true, diff --git a/app/graphql/types/ci/pipeline_schedule_type.rb b/app/graphql/types/ci/pipeline_schedule_type.rb index 904fa3f1c72..71a1f28ea38 100644 --- a/app/graphql/types/ci/pipeline_schedule_type.rb +++ b/app/graphql/types/ci/pipeline_schedule_type.rb @@ -7,7 +7,7 @@ module Types description 'Represents a pipeline schedule' - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType expose_permissions Types::PermissionTypes::Ci::PipelineSchedules diff --git a/app/graphql/types/ci/pipeline_schedule_variable_type.rb b/app/graphql/types/ci/pipeline_schedule_variable_type.rb index 1cb407bc2e4..f9c18d6f7df 100644 --- a/app/graphql/types/ci/pipeline_schedule_variable_type.rb +++ b/app/graphql/types/ci/pipeline_schedule_variable_type.rb @@ -7,7 +7,7 @@ module Types authorize :read_pipeline_schedule_variables - implements(VariableInterface) + implements VariableInterface end end end diff --git a/app/graphql/types/ci/pipeline_trigger_type.rb b/app/graphql/types/ci/pipeline_trigger_type.rb new file mode 100644 index 00000000000..81345c14ba0 --- /dev/null +++ b/app/graphql/types/ci/pipeline_trigger_type.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +module Types + module Ci + class PipelineTriggerType < BaseObject + graphql_name 'PipelineTrigger' + + present_using ::Ci::TriggerPresenter + connection_type_class Types::CountableConnectionType + + authorize :admin_build + + field :can_access_project, GraphQL::Types::Boolean, + null: false, + description: 'Indicates if the pipeline trigger token has access to the project.', + method: :can_access_project? + + field :description, GraphQL::Types::String, + null: true, + description: 'Description of the pipeline trigger token.' + + field :has_token_exposed, GraphQL::Types::Boolean, + null: false, + description: 'Indicates if the token is exposed.', + method: :has_token_exposed? + + field :id, GraphQL::Types::ID, + null: false, + description: 'ID of the pipeline trigger token.' + + field :last_used, Types::TimeType, + null: true, + description: 'Timestamp of the last usage of the pipeline trigger token.' + + field :owner, Types::UserType, + null: false, + description: 'Owner of the pipeline trigger token.' + + field :token, GraphQL::Types::String, + null: false, + description: 'Value of the pipeline trigger token.' + end + end +end diff --git a/app/graphql/types/ci/pipeline_type.rb b/app/graphql/types/ci/pipeline_type.rb index 19d261853a7..ba638d4bc47 100644 --- a/app/graphql/types/ci/pipeline_type.rb +++ b/app/graphql/types/ci/pipeline_type.rb @@ -5,7 +5,7 @@ module Types class PipelineType < BaseObject graphql_name 'Pipeline' - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType authorize :read_pipeline present_using ::Ci::PipelinePresenter diff --git a/app/graphql/types/ci/project_variable_type.rb b/app/graphql/types/ci/project_variable_type.rb index a9679000511..cd069be3320 100644 --- a/app/graphql/types/ci/project_variable_type.rb +++ b/app/graphql/types/ci/project_variable_type.rb @@ -7,8 +7,8 @@ module Types graphql_name 'CiProjectVariable' description 'CI/CD variables for a project.' - connection_type_class(Types::Ci::ProjectVariableConnectionType) - implements(VariableInterface) + connection_type_class Types::Ci::ProjectVariableConnectionType + implements VariableInterface field :environment_scope, GraphQL::Types::String, null: true, diff --git a/app/graphql/types/ci/recent_failures_type.rb b/app/graphql/types/ci/recent_failures_type.rb index 0892cb2735c..37850c62658 100644 --- a/app/graphql/types/ci/recent_failures_type.rb +++ b/app/graphql/types/ci/recent_failures_type.rb @@ -7,7 +7,7 @@ module Types graphql_name 'RecentFailures' description 'Recent failure history of a test case.' - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType field :count, GraphQL::Types::Int, null: true, description: 'Number of times the test case has failed in the past 14 days.' diff --git a/app/graphql/types/ci/runner_manager_type.rb b/app/graphql/types/ci/runner_manager_type.rb index 9c89b6537ea..9311836cf27 100644 --- a/app/graphql/types/ci/runner_manager_type.rb +++ b/app/graphql/types/ci/runner_manager_type.rb @@ -5,7 +5,7 @@ module Types class RunnerManagerType < BaseObject graphql_name 'CiRunnerManager' - connection_type_class(::Types::CountableConnectionType) + connection_type_class ::Types::CountableConnectionType authorize :read_runner_manager @@ -26,6 +26,11 @@ module Types description: 'ID of the runner manager.' field :ip_address, GraphQL::Types::String, null: true, description: 'IP address of the runner manager.' + field :job_execution_status, + Types::Ci::RunnerJobExecutionStatusEnum, + null: true, + description: 'Job execution status of the runner manager.', + alpha: { milestone: '16.3' } field :platform_name, GraphQL::Types::String, null: true, description: 'Platform provided by the runner manager.', method: :platform @@ -44,6 +49,16 @@ module Types def executor_name ::Ci::Runner::EXECUTOR_TYPE_TO_NAMES[runner_manager.executor_type&.to_sym] end + + def job_execution_status + BatchLoader::GraphQL.for(runner_manager.id).batch(key: :running_builds_exist) do |runner_manager_ids, loader| + statuses = ::Ci::RunnerManager.id_in(runner_manager_ids).with_running_builds.index_by(&:id) + + runner_manager_ids.each do |runner_manager_id| + loader.call(runner_manager_id, statuses[runner_manager_id] ? :running : :idle) + end + end + end end end end diff --git a/app/graphql/types/ci/runner_type.rb b/app/graphql/types/ci/runner_type.rb index 2baf64ca663..c9f92c05975 100644 --- a/app/graphql/types/ci/runner_type.rb +++ b/app/graphql/types/ci/runner_type.rb @@ -6,7 +6,7 @@ module Types graphql_name 'CiRunner' edge_type_class(RunnerWebUrlEdge) - connection_type_class(RunnerCountableConnectionType) + connection_type_class RunnerCountableConnectionType authorize :read_runner present_using ::Ci::RunnerPresenter @@ -59,7 +59,9 @@ module Types deprecated: { reason: "Use field in `manager` object instead", milestone: '16.2' }, description: 'IP address of the runner.' field :job_count, GraphQL::Types::Int, null: true, - description: "Number of jobs processed by the runner (limited to #{JOB_COUNT_LIMIT}, plus one to indicate that more items exist).", + description: "Number of jobs processed by the runner (limited to #{JOB_COUNT_LIMIT}, plus one to " \ + "indicate that more items exist).\n`jobCount` is an optimized version of `jobs { count }`, " \ + "and can be requested for multiple runners on the same request.", resolver: ::Resolvers::Ci::RunnerJobCountResolver field :job_execution_status, Types::Ci::RunnerJobExecutionStatusEnum, @@ -76,7 +78,6 @@ module Types description: 'Runner\'s maintenance notes.' field :managers, ::Types::Ci::RunnerManagerType.connection_type, null: true, description: 'Machines associated with the runner configuration.', - method: :runner_managers, alpha: { milestone: '15.10' } field :maximum_timeout, GraphQL::Types::Int, null: true, description: 'Maximum timeout (in seconds) for jobs processed by the runner.' @@ -173,6 +174,18 @@ module Types end end + def managers + BatchLoader::GraphQL.for(runner.id).batch(key: :runner_managers) do |runner_ids, loader| + runner_managers_by_runner_id = + ::Ci::RunnerManager.for_runner(runner_ids).order_id_desc.group_by(&:runner_id) + + runner_ids.each do |runner_id| + runner_managers = Array.wrap(runner_managers_by_runner_id[runner_id]) + loader.call(runner_id, runner_managers) + end + end + end + def job_execution_status BatchLoader::GraphQL.for(runner.id).batch(key: :running_builds_exist) do |runner_ids, loader| statuses = ::Ci::Runner.id_in(runner_ids).with_running_builds.index_by(&:id) diff --git a/app/graphql/types/ci/test_case_type.rb b/app/graphql/types/ci/test_case_type.rb index f88923215eb..78c70fbcc7c 100644 --- a/app/graphql/types/ci/test_case_type.rb +++ b/app/graphql/types/ci/test_case_type.rb @@ -7,7 +7,7 @@ module Types graphql_name 'TestCase' description 'Test case in pipeline test report.' - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType field :status, Types::Ci::TestCaseStatusEnum, diff --git a/app/graphql/types/ci/test_suite_summary_type.rb b/app/graphql/types/ci/test_suite_summary_type.rb index 8801501c8d4..a98c47c6a30 100644 --- a/app/graphql/types/ci/test_suite_summary_type.rb +++ b/app/graphql/types/ci/test_suite_summary_type.rb @@ -7,7 +7,7 @@ module Types graphql_name 'TestSuiteSummary' description 'Test suite summary in a pipeline test report.' - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType field :name, GraphQL::Types::String, null: true, description: 'Name of the test suite.' diff --git a/app/graphql/types/ci/test_suite_type.rb b/app/graphql/types/ci/test_suite_type.rb index 8845338ed6d..a5cc6282abc 100644 --- a/app/graphql/types/ci/test_suite_type.rb +++ b/app/graphql/types/ci/test_suite_type.rb @@ -7,7 +7,7 @@ module Types graphql_name 'TestSuite' description 'Test suite in a pipeline test report.' - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType field :name, GraphQL::Types::String, null: true, description: 'Name of the test suite.' diff --git a/app/graphql/types/clusters/agent_activity_event_type.rb b/app/graphql/types/clusters/agent_activity_event_type.rb index 1d0ec7c4959..8c7dfa9c10a 100644 --- a/app/graphql/types/clusters/agent_activity_event_type.rb +++ b/app/graphql/types/clusters/agent_activity_event_type.rb @@ -7,7 +7,7 @@ module Types authorize :read_cluster_agent - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType field :recorded_at, Types::TimeType, diff --git a/app/graphql/types/clusters/agent_token_type.rb b/app/graphql/types/clusters/agent_token_type.rb index 720ee2f685b..260c634e12e 100644 --- a/app/graphql/types/clusters/agent_token_type.rb +++ b/app/graphql/types/clusters/agent_token_type.rb @@ -7,7 +7,7 @@ module Types authorize :read_cluster_agent - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType field :cluster_agent, Types::Clusters::AgentType, diff --git a/app/graphql/types/clusters/agent_type.rb b/app/graphql/types/clusters/agent_type.rb index 317a1aab628..c0989796141 100644 --- a/app/graphql/types/clusters/agent_type.rb +++ b/app/graphql/types/clusters/agent_type.rb @@ -7,7 +7,7 @@ module Types authorize :read_cluster_agent - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType field :created_at, Types::TimeType, diff --git a/app/graphql/types/commit_type.rb b/app/graphql/types/commit_type.rb index 5dd862c7388..9f83e955f4c 100644 --- a/app/graphql/types/commit_type.rb +++ b/app/graphql/types/commit_type.rb @@ -8,7 +8,7 @@ module Types present_using CommitPresenter - implements(Types::TodoableInterface) + implements Types::TodoableInterface field :id, type: GraphQL::Types::ID, null: false, description: 'ID (global ID) of the commit.' @@ -34,6 +34,9 @@ module Types field :authored_date, type: Types::TimeType, null: true, description: 'Timestamp of when the commit was authored.' + field :committed_date, type: Types::TimeType, null: true, + description: 'Timestamp of when the commit was committed.' + field :web_url, type: GraphQL::Types::String, null: false, description: 'Web URL of the commit.' @@ -55,10 +58,24 @@ module Types field :author_name, type: GraphQL::Types::String, null: true, description: 'Commit authors name.' + field :committer_email, type: GraphQL::Types::String, null: true, + description: "Email of the committer." + + field :committer_name, type: GraphQL::Types::String, null: true, + description: "Name of the committer." + # models/commit lazy loads the author by email field :author, type: Types::UserType, null: true, description: 'Author of the commit.' + field :diffs, [Types::DiffType], null: true, calls_gitaly: true, + description: 'Diffs contained within the commit. ' \ + 'This field can only be resolved for 10 diffs in any single request.' do + # Limited to 10 calls per GraphQL request as calling `diffs` multiple times will + # lead to N+1 queries to Gitaly. + extension ::Gitlab::Graphql::Limit::FieldCallCount, limit: 10 + end + field :pipelines, null: true, description: 'Pipelines of the commit ordered latest first.', @@ -68,6 +85,10 @@ module Types markdown_field :full_title_html, null: true markdown_field :description_html, null: true + def diffs + object.diffs.diffs + end + def author_gravatar GravatarService.new.execute(object.author_email, 40) end diff --git a/app/graphql/types/custom_emoji_type.rb b/app/graphql/types/custom_emoji_type.rb index 379a0c44d67..b02cd56e6df 100644 --- a/app/graphql/types/custom_emoji_type.rb +++ b/app/graphql/types/custom_emoji_type.rb @@ -7,6 +7,10 @@ module Types authorize :read_custom_emoji + connection_type_class(Types::CountableConnectionType) + + expose_permissions Types::PermissionTypes::CustomEmoji + field :id, ::Types::GlobalIDType[::CustomEmoji], null: false, description: 'ID of the emoji.' @@ -23,5 +27,9 @@ module Types field :external, GraphQL::Types::Boolean, null: false, description: 'Whether the emoji is an external link.' + + field :created_at, Types::TimeType, + null: false, + description: 'Timestamp of when the custom emoji was created.' end end diff --git a/app/graphql/types/deployment_type.rb b/app/graphql/types/deployment_type.rb index 6d895cc81cf..c49633275fb 100644 --- a/app/graphql/types/deployment_type.rb +++ b/app/graphql/types/deployment_type.rb @@ -54,8 +54,7 @@ module Types field :job, Types::Ci::JobType, - description: 'Pipeline job of the deployment.', - method: :build + description: 'Pipeline job of the deployment.' field :triggerer, Types::UserType, diff --git a/app/graphql/types/design_management/design_type.rb b/app/graphql/types/design_management/design_type.rb index be5edd17643..d253ca8bfea 100644 --- a/app/graphql/types/design_management/design_type.rb +++ b/app/graphql/types/design_management/design_type.rb @@ -10,10 +10,10 @@ module Types alias_method :design, :object - implements(Types::Notes::NoteableInterface) - implements(Types::DesignManagement::DesignFields) - implements(Types::CurrentUserTodos) - implements(Types::TodoableInterface) + implements Types::Notes::NoteableInterface + implements Types::DesignManagement::DesignFields + implements Types::CurrentUserTodos + implements Types::TodoableInterface field :description, GraphQL::Types::String, diff --git a/app/graphql/types/diff_type.rb b/app/graphql/types/diff_type.rb new file mode 100644 index 00000000000..1c67c8c645a --- /dev/null +++ b/app/graphql/types/diff_type.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module Types + # rubocop: disable Graphql/AuthorizeTypes + class DiffType < BaseObject + graphql_name 'Diff' + + field :a_mode, GraphQL::Types::String, null: true, + description: 'Old file mode of the file.' + field :b_mode, GraphQL::Types::String, null: true, + description: 'New file mode of the file.' + field :deleted_file, GraphQL::Types::String, null: true, + description: 'Indicates if the file has been removed. ' + field :diff, GraphQL::Types::String, null: true, + description: 'Diff representation of the changes made to the file.' + field :new_file, GraphQL::Types::String, null: true, + description: 'Indicates if the file has just been added. ' + field :new_path, GraphQL::Types::String, null: true, + description: 'New path of the file.' + field :old_path, GraphQL::Types::String, null: true, + description: 'Old path of the file.' + field :renamed_file, GraphQL::Types::String, null: true, + description: 'Indicates if the file has been renamed.' + end + # rubocop: enable Graphql/AuthorizeTypes +end diff --git a/app/graphql/types/environment_type.rb b/app/graphql/types/environment_type.rb index aee09e5a143..63f2b247e01 100644 --- a/app/graphql/types/environment_type.rb +++ b/app/graphql/types/environment_type.rb @@ -36,6 +36,9 @@ module Types field :kubernetes_namespace, GraphQL::Types::String, null: true, description: 'Kubernetes namespace of the environment.' + field :flux_resource_path, GraphQL::Types::String, null: true, + description: 'Flux resource path of the environment.' + field :created_at, Types::TimeType, description: 'When the environment was created.' diff --git a/app/graphql/types/group_type.rb b/app/graphql/types/group_type.rb index 5fd6ee948d3..258cf1539fb 100644 --- a/app/graphql/types/group_type.rb +++ b/app/graphql/types/group_type.rb @@ -87,6 +87,7 @@ module Types Types::Ci::GroupEnvironmentScopeType.connection_type, description: 'Environment scopes of the group.', null: true, + authorize: :admin_group, resolver: Resolvers::GroupEnvironmentScopesResolver field :milestones, @@ -261,6 +262,17 @@ module Types resolver: Resolvers::DataTransfer::GroupDataTransferResolver, description: 'Data transfer data point for a specific period. This is mocked data under a development feature flag.' + field :work_items, + null: true, + description: 'Work items that belong to the namespace.', + alpha: { milestone: '16.3' }, + resolver: ::Resolvers::Namespaces::WorkItemsResolver + + field :autocomplete_users, + null: true, + resolver: Resolvers::AutocompleteUsersResolver, + description: 'Search users for autocompletion' + def label(title:) BatchLoader::GraphQL.for(title).batch(key: group) do |titles, loader, args| LabelsFinder diff --git a/app/graphql/types/issue_type.rb b/app/graphql/types/issue_type.rb index 488e4d10cbc..4b7118d75a5 100644 --- a/app/graphql/types/issue_type.rb +++ b/app/graphql/types/issue_type.rb @@ -4,11 +4,11 @@ module Types class IssueType < BaseObject graphql_name 'Issue' - connection_type_class(Types::IssueConnectionType) + connection_type_class Types::IssueConnectionType - implements(Types::Notes::NoteableInterface) - implements(Types::CurrentUserTodos) - implements(Types::TodoableInterface) + implements Types::Notes::NoteableInterface + implements Types::CurrentUserTodos + implements Types::TodoableInterface authorize :read_issue @@ -92,7 +92,13 @@ module Types field :emails_disabled, GraphQL::Types::Boolean, null: false, method: :project_emails_disabled?, - description: 'Indicates if a project has email notifications disabled: `true` if email notifications are disabled.' + description: 'Indicates if a project has email notifications disabled: `true` if email notifications are disabled.', + deprecated: { reason: 'Use `emails_enabled`', milestone: '16.3' } + + field :emails_enabled, GraphQL::Types::Boolean, null: false, + method: :project_emails_enabled?, + description: 'Indicates if a project has email notifications disabled: `false` if email notifications are disabled.' + field :human_time_estimate, GraphQL::Types::String, null: true, description: 'Human-readable time estimate of the issue.' field :human_total_time_spent, GraphQL::Types::String, null: true, diff --git a/app/graphql/types/label_type.rb b/app/graphql/types/label_type.rb index 05b703e60af..4848ee30950 100644 --- a/app/graphql/types/label_type.rb +++ b/app/graphql/types/label_type.rb @@ -4,7 +4,7 @@ module Types class LabelType < BaseObject graphql_name 'Label' - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType authorize :read_label diff --git a/app/graphql/types/merge_request_state_enum.rb b/app/graphql/types/merge_request_state_enum.rb index bcf18b836de..e03b79dfeb8 100644 --- a/app/graphql/types/merge_request_state_enum.rb +++ b/app/graphql/types/merge_request_state_enum.rb @@ -5,6 +5,7 @@ module Types graphql_name 'MergeRequestState' description 'State of a GitLab merge request' - value 'merged', description: "Merge request has been merged." + value 'merged', description: 'Merge request has been merged.' + value 'opened', description: 'Opened merge request.' end end diff --git a/app/graphql/types/merge_request_type.rb b/app/graphql/types/merge_request_type.rb index 99c719f1402..3fe8a05b311 100644 --- a/app/graphql/types/merge_request_type.rb +++ b/app/graphql/types/merge_request_type.rb @@ -4,11 +4,11 @@ module Types class MergeRequestType < BaseObject graphql_name 'MergeRequest' - connection_type_class(Types::MergeRequestConnectionType) + connection_type_class Types::MergeRequestConnectionType - implements(Types::Notes::NoteableInterface) - implements(Types::CurrentUserTodos) - implements(Types::TodoableInterface) + implements Types::Notes::NoteableInterface + implements Types::CurrentUserTodos + implements Types::TodoableInterface authorize :read_merge_request @@ -192,6 +192,11 @@ module Types field :total_time_spent, GraphQL::Types::Int, null: false, description: 'Total time reported as spent on the merge request.' + field :approved, GraphQL::Types::Boolean, + method: :approved?, + null: false, calls_gitaly: true, + description: 'Indicates if the merge request has all the required approvals.' + field :approved_by, Types::UserType.connection_type, null: true, description: 'Users who approved the merge request.', method: :approved_by_users field :auto_merge_strategy, GraphQL::Types::String, null: true, @@ -221,7 +226,7 @@ module Types field :award_emoji, Types::AwardEmojis::AwardEmojiType.connection_type, null: true, - description: 'List of award emojis associated with the merge request.' + description: 'List of emoji reactions associated with the merge request.' field :prepared_at, Types::TimeType, null: true, description: 'Timestamp of when the merge request was prepared.' diff --git a/app/graphql/types/mutation_type.rb b/app/graphql/types/mutation_type.rb index 16c46d172f3..957fd10690f 100644 --- a/app/graphql/types/mutation_type.rb +++ b/app/graphql/types/mutation_type.rb @@ -143,6 +143,9 @@ module Types mount_mutation Mutations::Ci::PipelineSchedule::Play mount_mutation Mutations::Ci::PipelineSchedule::Create mount_mutation Mutations::Ci::PipelineSchedule::Update + mount_mutation Mutations::Ci::PipelineTrigger::Create, alpha: { milestone: '16.3' } + mount_mutation Mutations::Ci::PipelineTrigger::Update, alpha: { milestone: '16.3' } + mount_mutation Mutations::Ci::PipelineTrigger::Delete, alpha: { milestone: '16.3' } mount_mutation Mutations::Ci::ProjectCiCdSettingsUpdate mount_mutation Mutations::Ci::Job::ArtifactsDestroy mount_mutation Mutations::Ci::Job::Play @@ -177,12 +180,14 @@ module Types mount_mutation Mutations::WorkItems::UpdateTask, alpha: { milestone: '15.1' } mount_mutation Mutations::WorkItems::Export, alpha: { milestone: '15.10' } mount_mutation Mutations::WorkItems::Convert, alpha: { milestone: '15.11' } + mount_mutation Mutations::WorkItems::LinkedItems::Add, alpha: { milestone: '16.3' } mount_mutation Mutations::SavedReplies::Create mount_mutation Mutations::SavedReplies::Update mount_mutation Mutations::Pages::MarkOnboardingComplete mount_mutation Mutations::SavedReplies::Destroy mount_mutation Mutations::Uploads::Delete mount_mutation Mutations::Users::SetNamespaceCommitEmail + mount_mutation Mutations::WorkItems::Subscribe, alpha: { milestone: '16.3' } end end diff --git a/app/graphql/types/namespace/package_settings_type.rb b/app/graphql/types/namespace/package_settings_type.rb index 84becba8001..61240243b1f 100644 --- a/app/graphql/types/namespace/package_settings_type.rb +++ b/app/graphql/types/namespace/package_settings_type.rb @@ -20,6 +20,14 @@ module Types field :maven_duplicates_allowed, GraphQL::Types::Boolean, null: false, description: 'Indicates whether duplicate Maven packages are allowed for this namespace.' + field :nuget_duplicate_exception_regex, Types::UntrustedRegexp, + null: true, + description: 'When nuget_duplicates_allowed is false, you can publish duplicate packages with names that match this regex. Otherwise, this setting has no effect. ' \ + 'Error is raised if `nuget_duplicates_option` feature flag is disabled.' + field :nuget_duplicates_allowed, GraphQL::Types::Boolean, + null: false, + description: 'Indicates whether duplicate NuGet packages are allowed for this namespace. ' \ + 'Error is raised if `nuget_duplicates_option` feature flag is disabled.' field :maven_package_requests_forwarding, GraphQL::Types::Boolean, null: true, diff --git a/app/graphql/types/notes/discussion_type.rb b/app/graphql/types/notes/discussion_type.rb index 5e40c8008a9..7afb1f392d3 100644 --- a/app/graphql/types/notes/discussion_type.rb +++ b/app/graphql/types/notes/discussion_type.rb @@ -9,7 +9,7 @@ module Types authorize :read_note - implements(Types::ResolvableInterface) + implements Types::ResolvableInterface field :created_at, Types::TimeType, null: false, description: "Timestamp of the discussion's creation." diff --git a/app/graphql/types/notes/note_type.rb b/app/graphql/types/notes/note_type.rb index eb1963f976a..e7e032c67c6 100644 --- a/app/graphql/types/notes/note_type.rb +++ b/app/graphql/types/notes/note_type.rb @@ -9,7 +9,7 @@ module Types expose_permissions Types::PermissionTypes::Note - implements(Types::ResolvableInterface) + implements Types::ResolvableInterface field :max_access_level_of_author, GraphQL::Types::String, null: true, @@ -43,7 +43,7 @@ module Types field :award_emoji, Types::AwardEmojis::AwardEmojiType.connection_type, null: true, - description: 'List of award emojis associated with the note.' + description: 'List of emoji reactions associated with the note.' field :confidential, GraphQL::Types::Boolean, null: true, diff --git a/app/graphql/types/notes/position_type_enum.rb b/app/graphql/types/notes/position_type_enum.rb index 157b0b4b884..b585d531192 100644 --- a/app/graphql/types/notes/position_type_enum.rb +++ b/app/graphql/types/notes/position_type_enum.rb @@ -8,6 +8,7 @@ module Types value 'text', description: "Text file." value 'image', description: "An image." + value 'file', description: "Unknown file type." end end end diff --git a/app/graphql/types/packages/package_base_type.rb b/app/graphql/types/packages/package_base_type.rb index 8dd2a4467d6..cc41169bcda 100644 --- a/app/graphql/types/packages/package_base_type.rb +++ b/app/graphql/types/packages/package_base_type.rb @@ -6,7 +6,7 @@ module Types graphql_name 'PackageBase' description 'Represents a package in the Package Registry' - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType authorize :read_package diff --git a/app/graphql/types/permission_types/group.rb b/app/graphql/types/permission_types/group.rb index 6a1031e2532..fbd1140babc 100644 --- a/app/graphql/types/permission_types/group.rb +++ b/app/graphql/types/permission_types/group.rb @@ -5,7 +5,7 @@ module Types class Group < BasePermissionType graphql_name 'GroupPermissions' - abilities :read_group, :create_projects + abilities :read_group, :create_projects, :create_custom_emoji end end end diff --git a/app/graphql/types/project_type.rb b/app/graphql/types/project_type.rb index 992663b4d98..2738d4da6c2 100644 --- a/app/graphql/types/project_type.rb +++ b/app/graphql/types/project_type.rb @@ -4,618 +4,625 @@ module Types class ProjectType < BaseObject graphql_name 'Project' - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType authorize :read_project expose_permissions Types::PermissionTypes::Project field :id, GraphQL::Types::ID, - null: false, - description: 'ID of the project.' + null: false, + description: 'ID of the project.' field :ci_config_path_or_default, GraphQL::Types::String, - null: false, - description: 'Path of the CI configuration file.' + null: false, + description: 'Path of the CI configuration file.' field :ci_config_variables, [Types::Ci::ConfigVariableType], - null: true, - calls_gitaly: true, - authorize: :create_pipeline, - alpha: { milestone: '15.3' }, - description: 'CI/CD config variable.' do - argument :ref, GraphQL::Types::String, - required: true, - description: 'Ref.' - end + null: true, + calls_gitaly: true, + authorize: :create_pipeline, + alpha: { milestone: '15.3' }, + description: 'CI/CD config variable.' do + argument :ref, GraphQL::Types::String, + required: true, + description: 'Ref.' + end field :full_path, GraphQL::Types::ID, - null: false, - description: 'Full path of the project.' + null: false, + description: 'Full path of the project.' field :path, GraphQL::Types::String, - null: false, - description: 'Path of the project.' + null: false, + description: 'Path of the project.' field :incident_management_timeline_event_tags, [Types::IncidentManagement::TimelineEventTagType], - null: true, - description: 'Timeline event tags for the project.' + null: true, + description: 'Timeline event tags for the project.' field :sast_ci_configuration, Types::CiConfiguration::Sast::Type, - null: true, - calls_gitaly: true, - description: 'SAST CI configuration for the project.' + null: true, + calls_gitaly: true, + description: 'SAST CI configuration for the project.' field :name, GraphQL::Types::String, - null: false, - description: 'Name of the project (without namespace).' + null: false, + description: 'Name of the project (without namespace).' field :name_with_namespace, GraphQL::Types::String, - null: false, - description: 'Full name of the project with its namespace.' + null: false, + description: 'Full name of the project with its namespace.' field :description, GraphQL::Types::String, - null: true, - description: 'Short description of the project.' + null: true, + description: 'Short description of the project.' field :tag_list, GraphQL::Types::String, - null: true, - deprecated: { reason: 'Use `topics`', milestone: '13.12' }, - description: 'List of project topics (not Git tags).', - method: :topic_list + null: true, + deprecated: { reason: 'Use `topics`', milestone: '13.12' }, + description: 'List of project topics (not Git tags).', + method: :topic_list field :topics, [GraphQL::Types::String], - null: true, - description: 'List of project topics.', - method: :topic_list + null: true, + description: 'List of project topics.', + method: :topic_list field :http_url_to_repo, GraphQL::Types::String, - null: true, - description: 'URL to connect to the project via HTTPS.' + null: true, + description: 'URL to connect to the project via HTTPS.' field :ssh_url_to_repo, GraphQL::Types::String, - null: true, - description: 'URL to connect to the project via SSH.' + null: true, + description: 'URL to connect to the project via SSH.' field :web_url, GraphQL::Types::String, - null: true, - description: 'Web URL of the project.' + null: true, + description: 'Web URL of the project.' field :forks_count, GraphQL::Types::Int, - null: false, - calls_gitaly: true, # 4 times - description: 'Number of times the project has been forked.' + null: false, + calls_gitaly: true, # 4 times + description: 'Number of times the project has been forked.' field :star_count, GraphQL::Types::Int, - null: false, - description: 'Number of times the project has been starred.' + null: false, + description: 'Number of times the project has been starred.' field :created_at, Types::TimeType, - null: true, - description: 'Timestamp of the project creation.' + null: true, + description: 'Timestamp of the project creation.' field :last_activity_at, Types::TimeType, - null: true, - description: 'Timestamp of the project last activity.' + null: true, + description: 'Timestamp of the project last activity.' field :archived, GraphQL::Types::Boolean, - null: true, - description: 'Indicates the archived status of the project.' + null: true, + description: 'Indicates the archived status of the project.' field :visibility, GraphQL::Types::String, - null: true, - description: 'Visibility of the project.' + null: true, + description: 'Visibility of the project.' field :lfs_enabled, GraphQL::Types::Boolean, - null: true, - description: 'Indicates if the project has Large File Storage (LFS) enabled.' + null: true, + description: 'Indicates if the project has Large File Storage (LFS) enabled.' field :merge_requests_ff_only_enabled, GraphQL::Types::Boolean, - null: true, - description: 'Indicates if no merge commits should be created and all merges should instead be ' \ - 'fast-forwarded, which means that merging is only allowed if the branch could be fast-forwarded.' + null: true, + description: 'Indicates if no merge commits should be created and all merges should instead be ' \ + 'fast-forwarded, which means that merging is only allowed if the branch could be fast-forwarded.' field :shared_runners_enabled, GraphQL::Types::Boolean, - null: true, - description: 'Indicates if shared runners are enabled for the project.' + null: true, + description: 'Indicates if shared runners are enabled for the project.' field :service_desk_enabled, GraphQL::Types::Boolean, - null: true, - description: 'Indicates if the project has Service Desk enabled.' + null: true, + description: 'Indicates if the project has Service Desk enabled.' field :service_desk_address, GraphQL::Types::String, - null: true, - description: 'E-mail address of the Service Desk.' + null: true, + description: 'E-mail address of the Service Desk.' field :avatar_url, GraphQL::Types::String, - null: true, - calls_gitaly: true, - description: 'URL to avatar image file of the project.' + null: true, + calls_gitaly: true, + description: 'URL to avatar image file of the project.' field :jobs_enabled, GraphQL::Types::Boolean, - null: true, - description: 'Indicates if CI/CD pipeline jobs are enabled for the current user.' + null: true, + description: 'Indicates if CI/CD pipeline jobs are enabled for the current user.' field :is_catalog_resource, GraphQL::Types::Boolean, - alpha: { milestone: '15.11' }, - null: true, - description: 'Indicates if a project is a catalog resource.' + alpha: { milestone: '15.11' }, + null: true, + description: 'Indicates if a project is a catalog resource.' field :public_jobs, GraphQL::Types::Boolean, - null: true, - description: 'Indicates if there is public access to pipelines and job details of the project, ' \ - 'including output logs and artifacts.', - method: :public_builds + null: true, + description: 'Indicates if there is public access to pipelines and job details of the project, ' \ + 'including output logs and artifacts.', + method: :public_builds field :open_issues_count, GraphQL::Types::Int, - null: true, - description: 'Number of open issues for the project.' + null: true, + description: 'Number of open issues for the project.' field :allow_merge_on_skipped_pipeline, GraphQL::Types::Boolean, - null: true, - description: 'If `only_allow_merge_if_pipeline_succeeds` is true, indicates if merge requests of ' \ - 'the project can also be merged with skipped jobs.' + null: true, + description: 'If `only_allow_merge_if_pipeline_succeeds` is true, indicates if merge requests of ' \ + 'the project can also be merged with skipped jobs.' field :autoclose_referenced_issues, GraphQL::Types::Boolean, - null: true, - description: 'Indicates if issues referenced by merge requests and commits within the default branch ' \ - 'are closed automatically.' + null: true, + description: 'Indicates if issues referenced by merge requests and commits within the default branch ' \ + 'are closed automatically.' field :import_status, GraphQL::Types::String, - null: true, - description: 'Status of import background job of the project.' + null: true, + description: 'Status of import background job of the project.' field :jira_import_status, GraphQL::Types::String, - null: true, - description: 'Status of Jira import background job of the project.' + null: true, + description: 'Status of Jira import background job of the project.' field :only_allow_merge_if_all_discussions_are_resolved, GraphQL::Types::Boolean, - null: true, - description: 'Indicates if merge requests of the project can only be merged when all the discussions are resolved.' + null: true, + description: 'Indicates if merge requests of the project can only be merged when all the discussions are resolved.' field :only_allow_merge_if_pipeline_succeeds, GraphQL::Types::Boolean, - null: true, - description: 'Indicates if merge requests of the project can only be merged with successful jobs.' + null: true, + description: 'Indicates if merge requests of the project can only be merged with successful jobs.' field :printing_merge_request_link_enabled, GraphQL::Types::Boolean, - null: true, - description: 'Indicates if a link to create or view a merge request should display after a push to Git ' \ - 'repositories of the project from the command line.' + null: true, + description: 'Indicates if a link to create or view a merge request should display after a push to Git ' \ + 'repositories of the project from the command line.' field :remove_source_branch_after_merge, GraphQL::Types::Boolean, - null: true, - description: 'Indicates if `Delete source branch` option should be enabled by default for all ' \ - 'new merge requests of the project.' + null: true, + description: 'Indicates if `Delete source branch` option should be enabled by default for all ' \ + 'new merge requests of the project.' field :request_access_enabled, GraphQL::Types::Boolean, - null: true, - description: 'Indicates if users can request member access to the project.' + null: true, + description: 'Indicates if users can request member access to the project.' field :squash_read_only, GraphQL::Types::Boolean, - null: false, - description: 'Indicates if `squashReadOnly` is enabled.', - method: :squash_readonly? + null: false, + description: 'Indicates if `squashReadOnly` is enabled.', + method: :squash_readonly? field :suggestion_commit_message, GraphQL::Types::String, - null: true, - description: 'Commit message used to apply merge request suggestions.' + null: true, + description: 'Commit message used to apply merge request suggestions.' # No, the quotes are not a typo. Used to get around circular dependencies. # See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/27536#note_871009675 field :group, 'Types::GroupType', - null: true, - description: 'Group of the project.' + null: true, + description: 'Group of the project.' field :namespace, Types::NamespaceType, - null: true, - description: 'Namespace of the project.' + null: true, + description: 'Namespace of the project.' field :statistics, Types::ProjectStatisticsType, - null: true, - description: 'Statistics of the project.' + null: true, + description: 'Statistics of the project.' field :statistics_details_paths, Types::ProjectStatisticsRedirectType, - null: true, - description: 'Redirects for Statistics of the project.', - calls_gitaly: true + null: true, + description: 'Redirects for Statistics of the project.', + calls_gitaly: true field :repository, Types::RepositoryType, - null: true, - description: 'Git repository of the project.' + null: true, + description: 'Git repository of the project.' field :merge_requests, - Types::MergeRequestType.connection_type, - null: true, - description: 'Merge requests of the project.', - extras: [:lookahead], - resolver: Resolvers::ProjectMergeRequestsResolver + Types::MergeRequestType.connection_type, + null: true, + description: 'Merge requests of the project.', + extras: [:lookahead], + resolver: Resolvers::ProjectMergeRequestsResolver field :merge_request, - Types::MergeRequestType, - null: true, - description: 'A single merge request of the project.', - resolver: Resolvers::MergeRequestsResolver.single + Types::MergeRequestType, + null: true, + description: 'A single merge request of the project.', + resolver: Resolvers::MergeRequestsResolver.single field :issues, - Types::IssueType.connection_type, - null: true, - description: 'Issues of the project.', - resolver: Resolvers::ProjectIssuesResolver + Types::IssueType.connection_type, + null: true, + description: 'Issues of the project.', + resolver: Resolvers::ProjectIssuesResolver field :work_items, - Types::WorkItemType.connection_type, - null: true, - alpha: { milestone: '15.1' }, - description: 'Work items of the project.', - extras: [:lookahead], - resolver: Resolvers::WorkItemsResolver + Types::WorkItemType.connection_type, + null: true, + alpha: { milestone: '15.1' }, + description: 'Work items of the project.', + extras: [:lookahead], + resolver: Resolvers::WorkItemsResolver field :issue_status_counts, - Types::IssueStatusCountsType, - null: true, - description: 'Counts of issues by status for the project.', - resolver: Resolvers::IssueStatusCountsResolver + Types::IssueStatusCountsType, + null: true, + description: 'Counts of issues by status for the project.', + resolver: Resolvers::IssueStatusCountsResolver field :milestones, Types::MilestoneType.connection_type, - null: true, - description: 'Milestones of the project.', - resolver: Resolvers::ProjectMilestonesResolver + null: true, + description: 'Milestones of the project.', + resolver: Resolvers::ProjectMilestonesResolver field :project_members, - description: 'Members of the project.', - resolver: Resolvers::ProjectMembersResolver + description: 'Members of the project.', + resolver: Resolvers::ProjectMembersResolver field :environments, - Types::EnvironmentType.connection_type, - null: true, - description: 'Environments of the project. ' \ - 'This field can only be resolved for one project in any single request.', - resolver: Resolvers::EnvironmentsResolver do - extension ::Gitlab::Graphql::Limit::FieldCallCount, limit: 1 - end + Types::EnvironmentType.connection_type, + null: true, + description: 'Environments of the project. ' \ + 'This field can only be resolved for one project in any single request.', + resolver: Resolvers::EnvironmentsResolver do + extension ::Gitlab::Graphql::Limit::FieldCallCount, limit: 1 + end field :environment, - Types::EnvironmentType, - null: true, - description: 'A single environment of the project.', - resolver: Resolvers::EnvironmentsResolver.single + Types::EnvironmentType, + null: true, + description: 'A single environment of the project.', + resolver: Resolvers::EnvironmentsResolver.single field :nested_environments, - Types::NestedEnvironmentType.connection_type, - null: true, - calls_gitaly: true, - description: 'Environments for this project with nested folders, ' \ - 'can only be resolved for one project in any single request', - resolver: Resolvers::Environments::NestedEnvironmentsResolver do - extension ::Gitlab::Graphql::Limit::FieldCallCount, limit: 1 - end + Types::NestedEnvironmentType.connection_type, + null: true, + calls_gitaly: true, + description: 'Environments for this project with nested folders, ' \ + 'can only be resolved for one project in any single request', + resolver: Resolvers::Environments::NestedEnvironmentsResolver do + extension ::Gitlab::Graphql::Limit::FieldCallCount, limit: 1 + end field :deployment, - Types::DeploymentType, - null: true, - description: 'Details of the deployment of the project.', - resolver: Resolvers::DeploymentResolver.single + Types::DeploymentType, + null: true, + description: 'Details of the deployment of the project.', + resolver: Resolvers::DeploymentResolver.single field :issue, - Types::IssueType, - null: true, - description: 'A single issue of the project.', - resolver: Resolvers::ProjectIssuesResolver.single + Types::IssueType, + null: true, + description: 'A single issue of the project.', + resolver: Resolvers::ProjectIssuesResolver.single field :packages, - description: 'Packages of the project.', - resolver: Resolvers::ProjectPackagesResolver + description: 'Packages of the project.', + resolver: Resolvers::ProjectPackagesResolver field :packages_cleanup_policy, - Types::Packages::Cleanup::PolicyType, - null: true, - description: 'Packages cleanup policy for the project.' + Types::Packages::Cleanup::PolicyType, + null: true, + description: 'Packages cleanup policy for the project.' field :jobs, - type: Types::Ci::JobType.connection_type, - null: true, - authorize: :read_build, - description: 'Jobs of a project. This field can only be resolved for one project in any single request.', - resolver: Resolvers::ProjectJobsResolver + type: Types::Ci::JobType.connection_type, + null: true, + authorize: :read_build, + description: 'Jobs of a project. This field can only be resolved for one project in any single request.', + resolver: Resolvers::ProjectJobsResolver field :job, - type: Types::Ci::JobType, - null: true, - authorize: :read_build, - description: 'One job belonging to the project, selected by ID.' do - argument :id, Types::GlobalIDType[::CommitStatus], - required: true, - description: 'ID of the job.' - end + type: Types::Ci::JobType, + null: true, + authorize: :read_build, + description: 'One job belonging to the project, selected by ID.' do + argument :id, Types::GlobalIDType[::CommitStatus], + required: true, + description: 'ID of the job.' + end field :pipelines, - null: true, - description: 'Build pipelines of the project.', - extras: [:lookahead], - resolver: Resolvers::ProjectPipelinesResolver + null: true, + description: 'Build pipelines of the project.', + extras: [:lookahead], + resolver: Resolvers::ProjectPipelinesResolver field :pipeline_schedules, - type: Types::Ci::PipelineScheduleType.connection_type, - null: true, - description: 'Pipeline schedules of the project. This field can only be resolved for one project per request.', - resolver: Resolvers::ProjectPipelineSchedulesResolver + type: Types::Ci::PipelineScheduleType.connection_type, + null: true, + description: 'Pipeline schedules of the project. This field can only be resolved for one project per request.', + resolver: Resolvers::ProjectPipelineSchedulesResolver + + field :pipeline_triggers, + Types::Ci::PipelineTriggerType.connection_type, + null: true, + description: 'List of pipeline trigger tokens.', + resolver: Resolvers::Ci::PipelineTriggersResolver, + alpha: { milestone: '16.3' } field :pipeline, Types::Ci::PipelineType, - null: true, - description: 'Build pipeline of the project.', - extras: [:lookahead], - resolver: Resolvers::ProjectPipelineResolver + null: true, + description: 'Build pipeline of the project.', + extras: [:lookahead], + resolver: Resolvers::ProjectPipelineResolver field :pipeline_counts, Types::Ci::PipelineCountsType, - null: true, - description: 'Build pipeline counts of the project.', - resolver: Resolvers::Ci::ProjectPipelineCountsResolver + null: true, + description: 'Build pipeline counts of the project.', + resolver: Resolvers::Ci::ProjectPipelineCountsResolver field :ci_variables, Types::Ci::ProjectVariableType.connection_type, - null: true, - description: "List of the project's CI/CD variables.", - authorize: :admin_build, - resolver: Resolvers::Ci::VariablesResolver + null: true, + description: "List of the project's CI/CD variables.", + authorize: :admin_build, + resolver: Resolvers::Ci::VariablesResolver field :inherited_ci_variables, Types::Ci::InheritedCiVariableType.connection_type, - null: true, - description: "List of CI/CD variables the project inherited from its parent group and ancestors.", - authorize: :admin_build, - resolver: Resolvers::Ci::InheritedVariablesResolver + null: true, + description: "List of CI/CD variables the project inherited from its parent group and ancestors.", + authorize: :admin_build, + resolver: Resolvers::Ci::InheritedVariablesResolver field :ci_cd_settings, Types::Ci::CiCdSettingType, - null: true, - description: 'CI/CD settings for the project.' + null: true, + description: 'CI/CD settings for the project.' field :sentry_detailed_error, Types::ErrorTracking::SentryDetailedErrorType, - null: true, - description: 'Detailed version of a Sentry error on the project.', - resolver: Resolvers::ErrorTracking::SentryDetailedErrorResolver + null: true, + description: 'Detailed version of a Sentry error on the project.', + resolver: Resolvers::ErrorTracking::SentryDetailedErrorResolver field :grafana_integration, Types::GrafanaIntegrationType, - null: true, - description: 'Grafana integration details for the project.', - resolver: Resolvers::Projects::GrafanaIntegrationResolver + null: true, + description: 'Grafana integration details for the project.', + resolver: Resolvers::Projects::GrafanaIntegrationResolver field :snippets, Types::SnippetType.connection_type, - null: true, - description: 'Snippets of the project.', - resolver: Resolvers::Projects::SnippetsResolver + null: true, + description: 'Snippets of the project.', + resolver: Resolvers::Projects::SnippetsResolver field :sentry_errors, Types::ErrorTracking::SentryErrorCollectionType, - null: true, - description: 'Paginated collection of Sentry errors on the project.', - resolver: Resolvers::ErrorTracking::SentryErrorCollectionResolver + null: true, + description: 'Paginated collection of Sentry errors on the project.', + resolver: Resolvers::ErrorTracking::SentryErrorCollectionResolver field :boards, Types::BoardType.connection_type, - null: true, - description: 'Boards of the project.', - max_page_size: 2000, - resolver: Resolvers::BoardsResolver + null: true, + description: 'Boards of the project.', + max_page_size: 2000, + resolver: Resolvers::BoardsResolver field :recent_issue_boards, Types::BoardType.connection_type, - null: true, - description: 'List of recently visited boards of the project. Maximum size is 4.', - resolver: Resolvers::RecentBoardsResolver + null: true, + description: 'List of recently visited boards of the project. Maximum size is 4.', + resolver: Resolvers::RecentBoardsResolver field :board, Types::BoardType, - null: true, - description: 'A single board of the project.', - resolver: Resolvers::BoardResolver + null: true, + description: 'A single board of the project.', + resolver: Resolvers::BoardResolver field :jira_imports, Types::JiraImportType.connection_type, - null: true, - description: 'Jira imports into the project.' + null: true, + description: 'Jira imports into the project.' field :services, Types::Projects::ServiceType.connection_type, - null: true, - deprecated: { - reason: 'This will be renamed to `Project.integrations`', - milestone: '15.9' - }, - description: 'Project services.', - resolver: Resolvers::Projects::ServicesResolver + null: true, + deprecated: { + reason: 'This will be renamed to `Project.integrations`', + milestone: '15.9' + }, + description: 'Project services.', + resolver: Resolvers::Projects::ServicesResolver field :alert_management_alerts, Types::AlertManagement::AlertType.connection_type, - null: true, - description: 'Alert Management alerts of the project.', - extras: [:lookahead], - resolver: Resolvers::AlertManagement::AlertResolver + null: true, + description: 'Alert Management alerts of the project.', + extras: [:lookahead], + resolver: Resolvers::AlertManagement::AlertResolver field :alert_management_alert, Types::AlertManagement::AlertType, - null: true, - description: 'A single Alert Management alert of the project.', - resolver: Resolvers::AlertManagement::AlertResolver.single + null: true, + description: 'A single Alert Management alert of the project.', + resolver: Resolvers::AlertManagement::AlertResolver.single field :alert_management_alert_status_counts, Types::AlertManagement::AlertStatusCountsType, - null: true, - description: 'Counts of alerts by status for the project.', - resolver: Resolvers::AlertManagement::AlertStatusCountsResolver + null: true, + description: 'Counts of alerts by status for the project.', + resolver: Resolvers::AlertManagement::AlertStatusCountsResolver field :alert_management_integrations, Types::AlertManagement::IntegrationType.connection_type, - null: true, - description: 'Integrations which can receive alerts for the project.', - resolver: Resolvers::AlertManagement::IntegrationsResolver + null: true, + description: 'Integrations which can receive alerts for the project.', + resolver: Resolvers::AlertManagement::IntegrationsResolver field :alert_management_http_integrations, Types::AlertManagement::HttpIntegrationType.connection_type, - null: true, - description: 'HTTP Integrations which can receive alerts for the project.', - resolver: Resolvers::AlertManagement::HttpIntegrationsResolver + null: true, + description: 'HTTP Integrations which can receive alerts for the project.', + resolver: Resolvers::AlertManagement::HttpIntegrationsResolver field :incident_management_timeline_events, Types::IncidentManagement::TimelineEventType.connection_type, - null: true, - description: 'Incident Management Timeline events associated with the incident.', - extras: [:lookahead], - resolver: Resolvers::IncidentManagement::TimelineEventsResolver + null: true, + description: 'Incident Management Timeline events associated with the incident.', + extras: [:lookahead], + resolver: Resolvers::IncidentManagement::TimelineEventsResolver field :incident_management_timeline_event, Types::IncidentManagement::TimelineEventType, - null: true, - description: 'Incident Management Timeline event associated with the incident.', - resolver: Resolvers::IncidentManagement::TimelineEventsResolver.single + null: true, + description: 'Incident Management Timeline event associated with the incident.', + resolver: Resolvers::IncidentManagement::TimelineEventsResolver.single field :releases, Types::ReleaseType.connection_type, - null: true, - description: 'Releases of the project.', - resolver: Resolvers::ReleasesResolver + null: true, + description: 'Releases of the project.', + resolver: Resolvers::ReleasesResolver field :release, Types::ReleaseType, - null: true, - description: 'A single release of the project.', - resolver: Resolvers::ReleasesResolver.single, - authorize: :read_release + null: true, + description: 'A single release of the project.', + resolver: Resolvers::ReleasesResolver.single, + authorize: :read_release field :container_expiration_policy, Types::ContainerExpirationPolicyType, - null: true, - description: 'Container expiration policy of the project.' + null: true, + description: 'Container expiration policy of the project.' field :container_repositories, Types::ContainerRepositoryType.connection_type, - null: true, - description: 'Container repositories of the project.', - resolver: Resolvers::ContainerRepositoriesResolver + null: true, + description: 'Container repositories of the project.', + resolver: Resolvers::ContainerRepositoriesResolver field :container_repositories_count, GraphQL::Types::Int, - null: false, - description: 'Number of container repositories in the project.' + null: false, + description: 'Number of container repositories in the project.' field :label, Types::LabelType, - null: true, - description: 'Label available on this project.' do - argument :title, GraphQL::Types::String, - required: true, - description: 'Title of the label.' - end + null: true, + description: 'Label available on this project.' do + argument :title, GraphQL::Types::String, + required: true, + description: 'Title of the label.' + end field :terraform_state, Types::Terraform::StateType, - null: true, - description: 'Find a single Terraform state by name.', - resolver: Resolvers::Terraform::StatesResolver.single + null: true, + description: 'Find a single Terraform state by name.', + resolver: Resolvers::Terraform::StatesResolver.single field :terraform_states, Types::Terraform::StateType.connection_type, - null: true, - description: 'Terraform states associated with the project.', - resolver: Resolvers::Terraform::StatesResolver + null: true, + description: 'Terraform states associated with the project.', + resolver: Resolvers::Terraform::StatesResolver field :pipeline_analytics, Types::Ci::AnalyticsType, - null: true, - description: 'Pipeline analytics.', - resolver: Resolvers::ProjectPipelineStatisticsResolver + null: true, + description: 'Pipeline analytics.', + resolver: Resolvers::ProjectPipelineStatisticsResolver field :ci_template, Types::Ci::TemplateType, - null: true, - description: 'Find a single CI/CD template by name.', - resolver: Resolvers::Ci::TemplateResolver + null: true, + description: 'Find a single CI/CD template by name.', + resolver: Resolvers::Ci::TemplateResolver field :ci_job_token_scope, Types::Ci::JobTokenScopeType, - null: true, - description: 'The CI Job Tokens scope of access.', - resolver: Resolvers::Ci::JobTokenScopeResolver + null: true, + description: 'The CI Job Tokens scope of access.', + resolver: Resolvers::Ci::JobTokenScopeResolver field :timelogs, Types::TimelogType.connection_type, - null: true, - description: 'Time logged on issues and merge requests in the project.', - extras: [:lookahead], - complexity: 5, - resolver: ::Resolvers::TimelogResolver + null: true, + description: 'Time logged on issues and merge requests in the project.', + extras: [:lookahead], + complexity: 5, + resolver: ::Resolvers::TimelogResolver field :agent_configurations, ::Types::Kas::AgentConfigurationType.connection_type, - null: true, - description: 'Agent configurations defined by the project', - resolver: ::Resolvers::Kas::AgentConfigurationsResolver + null: true, + description: 'Agent configurations defined by the project', + resolver: ::Resolvers::Kas::AgentConfigurationsResolver field :cluster_agent, ::Types::Clusters::AgentType, - null: true, - description: 'Find a single cluster agent by name.', - resolver: ::Resolvers::Clusters::AgentsResolver.single + null: true, + description: 'Find a single cluster agent by name.', + resolver: ::Resolvers::Clusters::AgentsResolver.single field :cluster_agents, ::Types::Clusters::AgentType.connection_type, - extras: [:lookahead], - null: true, - description: 'Cluster agents associated with the project.', - resolver: ::Resolvers::Clusters::AgentsResolver + extras: [:lookahead], + null: true, + description: 'Cluster agents associated with the project.', + resolver: ::Resolvers::Clusters::AgentsResolver field :ci_access_authorized_agents, ::Types::Clusters::Agents::Authorizations::CiAccessType.connection_type, - null: true, - description: 'Authorized cluster agents for the project through ci_access keyword.', - resolver: ::Resolvers::Clusters::Agents::Authorizations::CiAccessResolver, - authorize: :read_cluster_agent + null: true, + description: 'Authorized cluster agents for the project through ci_access keyword.', + resolver: ::Resolvers::Clusters::Agents::Authorizations::CiAccessResolver, + authorize: :read_cluster_agent field :user_access_authorized_agents, ::Types::Clusters::Agents::Authorizations::UserAccessType.connection_type, - null: true, - description: 'Authorized cluster agents for the project through user_access keyword.', - resolver: ::Resolvers::Clusters::Agents::Authorizations::UserAccessResolver, - authorize: :read_cluster_agent + null: true, + description: 'Authorized cluster agents for the project through user_access keyword.', + resolver: ::Resolvers::Clusters::Agents::Authorizations::UserAccessResolver, + authorize: :read_cluster_agent field :merge_commit_template, GraphQL::Types::String, - null: true, - description: 'Template used to create merge commit message in merge requests.' + null: true, + description: 'Template used to create merge commit message in merge requests.' field :squash_commit_template, GraphQL::Types::String, - null: true, - description: 'Template used to create squash commit message in merge requests.' + null: true, + description: 'Template used to create squash commit message in merge requests.' field :labels, Types::LabelType.connection_type, - null: true, - description: 'Labels available on this project.', - resolver: Resolvers::LabelsResolver + null: true, + description: 'Labels available on this project.', + resolver: Resolvers::LabelsResolver field :work_item_types, Types::WorkItems::TypeType.connection_type, - resolver: Resolvers::WorkItems::TypesResolver, - description: 'Work item types available to the project.' + resolver: Resolvers::WorkItems::TypesResolver, + description: 'Work item types available to the project.' field :timelog_categories, Types::TimeTracking::TimelogCategoryType.connection_type, - null: true, - description: "Timelog categories for the project.", - alpha: { milestone: '15.3' } + null: true, + description: "Timelog categories for the project.", + alpha: { milestone: '15.3' } field :fork_targets, Types::NamespaceType.connection_type, - resolver: Resolvers::Projects::ForkTargetsResolver, - description: 'Namespaces in which the current user can fork the project into.' + resolver: Resolvers::Projects::ForkTargetsResolver, + description: 'Namespaces in which the current user can fork the project into.' field :fork_details, Types::Projects::ForkDetailsType, - calls_gitaly: true, - alpha: { milestone: '15.7' }, - authorize: :read_code, - resolver: Resolvers::Projects::ForkDetailsResolver, - description: 'Details of the fork project compared to its upstream project.' + calls_gitaly: true, + alpha: { milestone: '15.7' }, + authorize: :read_code, + resolver: Resolvers::Projects::ForkDetailsResolver, + description: 'Details of the fork project compared to its upstream project.' field :branch_rules, - Types::Projects::BranchRuleType.connection_type, - null: true, - description: "Branch rules configured for the project.", - resolver: Resolvers::Projects::BranchRulesResolver + Types::Projects::BranchRuleType.connection_type, + null: true, + description: "Branch rules configured for the project.", + resolver: Resolvers::Projects::BranchRulesResolver field :languages, [Types::Projects::RepositoryLanguageType], - null: true, - description: "Programming languages used in the project.", - calls_gitaly: true + null: true, + description: "Programming languages used in the project.", + calls_gitaly: true field :runners, Types::Ci::RunnerType.connection_type, - null: true, - resolver: ::Resolvers::Ci::ProjectRunnersResolver, - description: "Find runners visible to the current user." + null: true, + resolver: ::Resolvers::Ci::ProjectRunnersResolver, + description: "Find runners visible to the current user." field :data_transfer, Types::DataTransfer::ProjectDataTransferType, - null: true, # disallow null once data_transfer_monitoring feature flag is rolled-out! https://gitlab.com/gitlab-org/gitlab/-/issues/391682 - resolver: Resolvers::DataTransfer::ProjectDataTransferResolver, - description: 'Data transfer data point for a specific period. This is mocked data under a development feature flag.' + null: true, # disallow null once data_transfer_monitoring feature flag is rolled-out! https://gitlab.com/gitlab-org/gitlab/-/issues/391682 + resolver: Resolvers::DataTransfer::ProjectDataTransferResolver, + description: 'Data transfer data point for a specific period. This is mocked data under a development feature flag.' field :visible_forks, Types::ProjectType.connection_type, - null: true, - alpha: { milestone: '15.10' }, - description: "Visible forks of the project." do - argument :minimum_access_level, - type: ::Types::AccessLevelEnum, - required: false, - description: 'Minimum access level.' - end + null: true, + alpha: { milestone: '15.10' }, + description: "Visible forks of the project." do + argument :minimum_access_level, + type: ::Types::AccessLevelEnum, + required: false, + description: 'Minimum access level.' + end field :flow_metrics, - ::Types::Analytics::CycleAnalytics::FlowMetrics[:project], - null: true, - description: 'Flow metrics for value stream analytics.', - method: :project_namespace, - authorize: :read_cycle_analytics, - alpha: { milestone: '15.10' } + ::Types::Analytics::CycleAnalytics::FlowMetrics[:project], + null: true, + description: 'Flow metrics for value stream analytics.', + method: :project_namespace, + authorize: :read_cycle_analytics, + alpha: { milestone: '15.10' } field :commit_references, ::Types::CommitReferencesType, null: true, @@ -623,6 +630,11 @@ module Types alpha: { milestone: '16.0' }, description: "Get tag names containing a given commit." + field :autocomplete_users, + null: true, + resolver: Resolvers::AutocompleteUsersResolver, + description: 'Search users for autocompletion' + def timelog_categories object.project_namespace.timelog_categories if Feature.enabled?(:timelog_categories) end @@ -644,7 +656,7 @@ module Types container_registry: 'Container Registry is' }.each do |feature, name_string| field "#{feature}_enabled", GraphQL::Types::Boolean, null: true, - description: "Indicates if #{name_string} enabled for the current user" + description: "Indicates if #{name_string} enabled for the current user" define_method "#{feature}_enabled" do object.feature_available?(feature, context[:current_user]) @@ -707,7 +719,7 @@ module Types if project.repository.empty? raise Gitlab::Graphql::Errors::MutationError, - Gitlab::Utils::ErrorMessage.to_user_facing(_(format('You must %s before using Security features.', add_file_docs_link.html_safe)).html_safe) + _(format('You must %s before using Security features.', add_file_docs_link.html_safe)).html_safe end ::Security::CiConfiguration::SastParserService.new(object).configuration @@ -754,11 +766,11 @@ module Types def add_file_docs_link ActionController::Base.helpers.link_to _('add at least one file to the repository'), - Rails.application.routes.url_helpers.help_page_url( - 'user/project/repository/index.md', - anchor: 'add-files-to-a-repository'), - target: '_blank', - rel: 'noopener noreferrer' + Rails.application.routes.url_helpers.help_page_url( + 'user/project/repository/index.md', + anchor: 'add-files-to-a-repository'), + target: '_blank', + rel: 'noopener noreferrer' end end end diff --git a/app/graphql/types/projects/services/base_service_type.rb b/app/graphql/types/projects/services/base_service_type.rb index 9a48aafa5a8..c77dc5c8539 100644 --- a/app/graphql/types/projects/services/base_service_type.rb +++ b/app/graphql/types/projects/services/base_service_type.rb @@ -7,7 +7,7 @@ module Types class BaseServiceType < BaseObject graphql_name 'BaseService' - implements(Types::Projects::ServiceType) + implements Types::Projects::ServiceType authorize :admin_project end diff --git a/app/graphql/types/projects/services/jira_service_type.rb b/app/graphql/types/projects/services/jira_service_type.rb index ac274d7f890..a774d381e2b 100644 --- a/app/graphql/types/projects/services/jira_service_type.rb +++ b/app/graphql/types/projects/services/jira_service_type.rb @@ -7,7 +7,7 @@ module Types class JiraServiceType < BaseObject graphql_name 'JiraService' - implements(Types::Projects::ServiceType) + implements Types::Projects::ServiceType authorize :admin_project diff --git a/app/graphql/types/query_type.rb b/app/graphql/types/query_type.rb index b26e447f622..38b8973034d 100644 --- a/app/graphql/types/query_type.rb +++ b/app/graphql/types/query_type.rb @@ -171,6 +171,18 @@ module Types description: 'Definitions for all audit events available on the instance.', resolver: Resolvers::AuditEvents::AuditEventDefinitionsResolver + field :abuse_report, ::Types::AbuseReportType, + null: true, + alpha: { milestone: '16.3' }, + description: 'Find an abuse report.', + resolver: Resolvers::AbuseReportResolver + + field :abuse_report_labels, ::Types::LabelType.connection_type, + null: true, + alpha: { milestone: '16.3' }, + description: 'Abuse report labels.', + resolver: Resolvers::AbuseReportLabelsResolver + def design_management DesignManagementObject.new(nil) end diff --git a/app/graphql/types/release_type.rb b/app/graphql/types/release_type.rb index 8516256b433..0bf723bcb1b 100644 --- a/app/graphql/types/release_type.rb +++ b/app/graphql/types/release_type.rb @@ -5,7 +5,7 @@ module Types graphql_name 'Release' description 'Represents a release' - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType authorize :read_release diff --git a/app/graphql/types/saved_reply_type.rb b/app/graphql/types/saved_reply_type.rb index 8c9f3d19810..74b3796ef8a 100644 --- a/app/graphql/types/saved_reply_type.rb +++ b/app/graphql/types/saved_reply_type.rb @@ -4,7 +4,7 @@ module Types class SavedReplyType < BaseObject graphql_name 'SavedReply' - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType authorize :read_saved_replies diff --git a/app/graphql/types/snippet_type.rb b/app/graphql/types/snippet_type.rb index 5ee0500b1e0..6e6d0edbe15 100644 --- a/app/graphql/types/snippet_type.rb +++ b/app/graphql/types/snippet_type.rb @@ -5,7 +5,7 @@ module Types graphql_name 'Snippet' description 'Represents a snippet entry' - implements(Types::Notes::NoteableInterface) + implements Types::Notes::NoteableInterface present_using SnippetPresenter diff --git a/app/graphql/types/snippets/blob_type.rb b/app/graphql/types/snippets/blob_type.rb index bb4a0a64de8..2d1993225d1 100644 --- a/app/graphql/types/snippets/blob_type.rb +++ b/app/graphql/types/snippets/blob_type.rb @@ -8,7 +8,7 @@ module Types description 'Represents the snippet blob' present_using SnippetBlobPresenter - connection_type_class(Types::Snippets::BlobConnectionType) + connection_type_class Types::Snippets::BlobConnectionType field :rich_data, GraphQL::Types::String, description: 'Blob highlighted data.', diff --git a/app/graphql/types/terraform/state_type.rb b/app/graphql/types/terraform/state_type.rb index be17fc41c2c..0870194a934 100644 --- a/app/graphql/types/terraform/state_type.rb +++ b/app/graphql/types/terraform/state_type.rb @@ -7,7 +7,7 @@ module Types authorize :read_terraform_state - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType field :id, GraphQL::Types::ID, null: false, diff --git a/app/graphql/types/timelog_type.rb b/app/graphql/types/timelog_type.rb index 88baca028ef..2adf2847221 100644 --- a/app/graphql/types/timelog_type.rb +++ b/app/graphql/types/timelog_type.rb @@ -4,7 +4,7 @@ module Types class TimelogType < BaseObject graphql_name 'Timelog' - connection_type_class(Types::TimeTracking::TimelogConnectionType) + connection_type_class Types::TimeTracking::TimelogConnectionType authorize :read_issuable diff --git a/app/graphql/types/todo_action_enum.rb b/app/graphql/types/todo_action_enum.rb index fda96796c0f..45b83ea1d64 100644 --- a/app/graphql/types/todo_action_enum.rb +++ b/app/graphql/types/todo_action_enum.rb @@ -12,5 +12,6 @@ module Types value 'merge_train_removed', value: 8, description: 'Merge request authored by the user was removed from the merge train.' value 'review_requested', value: 9, description: 'Review was requested from the user.' value 'member_access_requested', value: 10, description: 'Group or project access requested from the user.' + value 'review_submitted', value: 11, description: 'Merge request authored by the user received a review.' end end diff --git a/app/graphql/types/users/autocompleted_user_type.rb b/app/graphql/types/users/autocompleted_user_type.rb new file mode 100644 index 00000000000..8a70f398954 --- /dev/null +++ b/app/graphql/types/users/autocompleted_user_type.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Types + module Users + class AutocompletedUserType < ::Types::UserType + graphql_name 'AutocompletedUser' + + authorize :read_user + + field :merge_request_interaction, Types::UserMergeRequestInteractionType, + null: true, + description: 'Merge request state related to the user.' do + argument :id, ::Types::GlobalIDType[::MergeRequest], required: true, + description: 'Global ID of the merge request.' + end + + def merge_request_interaction(id: nil) + Gitlab::Graphql::Lazy.with_value(GitlabSchema.object_from_id(id, expected_class: ::MergeRequest)) do |mr| + ::Users::MergeRequestInteraction.new(user: object.user, merge_request: mr) if mr + end + end + end + end +end diff --git a/app/graphql/types/work_item_type.rb b/app/graphql/types/work_item_type.rb index 1e58781dbb9..05798ba3d2f 100644 --- a/app/graphql/types/work_item_type.rb +++ b/app/graphql/types/work_item_type.rb @@ -4,7 +4,7 @@ module Types class WorkItemType < BaseObject graphql_name 'WorkItem' - implements(Types::TodoableInterface) + implements Types::TodoableInterface authorize :read_work_item diff --git a/app/graphql/types/work_items/linked_item_type.rb b/app/graphql/types/work_items/linked_item_type.rb new file mode 100644 index 00000000000..a4dbeed7480 --- /dev/null +++ b/app/graphql/types/work_items/linked_item_type.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Types + module WorkItems + # rubocop:disable Graphql/AuthorizeTypes + class LinkedItemType < BaseObject + graphql_name 'LinkedWorkItemType' + + field :link_created_at, Types::TimeType, + description: 'Timestamp the link was created.', null: false + field :link_id, ::Types::GlobalIDType[::WorkItems::RelatedWorkItemLink], + description: 'Global ID of the link.', null: false + field :link_type, GraphQL::Types::String, + description: 'Type of link.', null: false + field :link_updated_at, Types::TimeType, + description: 'Timestamp the link was updated.', null: false + field :work_item, Types::WorkItemType, + description: 'Linked work item.', null: false + end + # rubocop:enable Graphql/AuthorizeTypes + end +end diff --git a/app/graphql/types/work_items/related_link_type_enum.rb b/app/graphql/types/work_items/related_link_type_enum.rb new file mode 100644 index 00000000000..d4bbc7cc404 --- /dev/null +++ b/app/graphql/types/work_items/related_link_type_enum.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Types + module WorkItems + class RelatedLinkTypeEnum < BaseEnum + graphql_name 'WorkItemRelatedLinkType' + description 'Values for work item link types' + + value 'RELATED', 'Related type.', value: 'relates_to' + end + end +end + +Types::WorkItems::RelatedLinkTypeEnum.prepend_mod_with('Types::WorkItems::RelatedLinkTypeEnum') diff --git a/app/graphql/types/work_items/widget_interface.rb b/app/graphql/types/work_items/widget_interface.rb index 53ea901ea10..9f4dbdd1038 100644 --- a/app/graphql/types/work_items/widget_interface.rb +++ b/app/graphql/types/work_items/widget_interface.rb @@ -21,7 +21,8 @@ module Types ::Types::WorkItems::Widgets::NotesType, ::Types::WorkItems::Widgets::NotificationsType, ::Types::WorkItems::Widgets::CurrentUserTodosType, - ::Types::WorkItems::Widgets::AwardEmojiType + ::Types::WorkItems::Widgets::AwardEmojiType, + ::Types::WorkItems::Widgets::LinkedItemsType ].freeze def self.ce_orphan_types @@ -53,6 +54,8 @@ module Types ::Types::WorkItems::Widgets::CurrentUserTodosType when ::WorkItems::Widgets::AwardEmoji ::Types::WorkItems::Widgets::AwardEmojiType + when ::WorkItems::Widgets::LinkedItems + ::Types::WorkItems::Widgets::LinkedItemsType else raise "Unknown GraphQL type for widget #{object}" end diff --git a/app/graphql/types/work_items/widgets/award_emoji_type.rb b/app/graphql/types/work_items/widgets/award_emoji_type.rb index 421bb8f0e98..eee04696df2 100644 --- a/app/graphql/types/work_items/widgets/award_emoji_type.rb +++ b/app/graphql/types/work_items/widgets/award_emoji_type.rb @@ -8,14 +8,14 @@ module Types # rubocop:disable Graphql/AuthorizeTypes class AwardEmojiType < BaseObject graphql_name 'WorkItemWidgetAwardEmoji' - description 'Represents the award emoji widget' + description 'Represents the emoji reactions widget' implements Types::WorkItems::WidgetInterface field :award_emoji, ::Types::AwardEmojis::AwardEmojiType.connection_type, null: true, - description: 'Award emoji on the work item.' + description: 'Emoji reactions on the work item.' field :downvotes, GraphQL::Types::Int, null: false, diff --git a/app/graphql/types/work_items/widgets/linked_items_type.rb b/app/graphql/types/work_items/widgets/linked_items_type.rb new file mode 100644 index 00000000000..fa51742b9c1 --- /dev/null +++ b/app/graphql/types/work_items/widgets/linked_items_type.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Types + module WorkItems + module Widgets + # rubocop:disable Graphql/AuthorizeTypes + class LinkedItemsType < BaseObject + graphql_name 'WorkItemWidgetLinkedItems' + description 'Represents the linked items widget' + + implements Types::WorkItems::WidgetInterface + + field :linked_items, Types::WorkItems::LinkedItemType.connection_type, + null: true, complexity: 5, + alpha: { milestone: '16.3' }, + description: 'Linked items for the work item. Returns `null`' \ + 'if `linked_work_items` feature flag is disabled.', + resolver: Resolvers::WorkItems::LinkedItemsResolver + end + # rubocop:enable Graphql/AuthorizeTypes + end + end +end + +Types::WorkItems::Widgets::LinkedItemsType.prepend_mod |