diff options
Diffstat (limited to 'app/graphql/types')
38 files changed, 261 insertions, 47 deletions
diff --git a/app/graphql/types/achievements/user_achievement_type.rb b/app/graphql/types/achievements/user_achievement_type.rb index 7cdcb66576c..b92b2c42bee 100644 --- a/app/graphql/types/achievements/user_achievement_type.rb +++ b/app/graphql/types/achievements/user_achievement_type.rb @@ -48,6 +48,11 @@ module Types Types::TimeType, null: true, description: 'Timestamp the achievement was revoked.' + + field :priority, + GraphQL::Types::Int, + null: true, + description: 'Priority of the user achievement.' end end end diff --git a/app/graphql/types/base_argument.rb b/app/graphql/types/base_argument.rb index d2bc1d55408..cda7fa4a5df 100644 --- a/app/graphql/types/base_argument.rb +++ b/app/graphql/types/base_argument.rb @@ -7,7 +7,6 @@ module Types attr_reader :doc_reference def initialize(*args, **kwargs, &block) - init_gitlab_deprecation(kwargs) @doc_reference = kwargs.delete(:see) # our custom addition `nullable` which allows us to declare diff --git a/app/graphql/types/base_enum.rb b/app/graphql/types/base_enum.rb index 45e78b330fb..ca86e399f6b 100644 --- a/app/graphql/types/base_enum.rb +++ b/app/graphql/types/base_enum.rb @@ -5,12 +5,6 @@ module Types class BaseEnum < GraphQL::Schema::Enum class CustomValue < GraphQL::Schema::EnumValue include Gitlab::Graphql::Deprecations - - def initialize(name, desc = nil, **kwargs) - init_gitlab_deprecation(kwargs) - - super(name, desc, **kwargs) - end end enum_value_class(CustomValue) diff --git a/app/graphql/types/base_field.rb b/app/graphql/types/base_field.rb index caeb81c95cb..886490ba62f 100644 --- a/app/graphql/types/base_field.rb +++ b/app/graphql/types/base_field.rb @@ -11,13 +11,15 @@ module Types attr_reader :doc_reference def initialize(**kwargs, &block) - init_gitlab_deprecation(kwargs) - @calls_gitaly = !!kwargs.delete(:calls_gitaly) + @requires_argument = kwargs.delete(:requires_argument) + @calls_gitaly = kwargs.delete(:calls_gitaly) @doc_reference = kwargs.delete(:see) - @constant_complexity = kwargs[:complexity].is_a?(Integer) && kwargs[:complexity] > 0 - @requires_argument = !!kwargs.delete(:requires_argument) + + given_complexity = kwargs[:complexity] || kwargs[:resolver_class].try(:complexity) + @constant_complexity = given_complexity.is_a?(Integer) && given_complexity > 0 + kwargs[:complexity] = field_complexity(kwargs[:resolver_class], given_complexity) + @authorize = Array.wrap(kwargs.delete(:authorize)) - kwargs[:complexity] = field_complexity(kwargs[:resolver_class], kwargs[:complexity]) after_connection_extensions = kwargs.delete(:late_extensions) || [] super(**kwargs, &block) @@ -31,11 +33,12 @@ module Types end def may_call_gitaly? - @constant_complexity || @calls_gitaly + @constant_complexity || calls_gitaly? end def requires_argument? - @requires_argument || arguments.values.any? { |argument| argument.type.non_null? } + value = @requires_argument.nil? ? @resolver_class.try(:requires_argument?) : @requires_argument + !!value || arguments.values.any? { |argument| argument.type.non_null? } end # By default fields authorize against the current object, but that is not how our @@ -82,7 +85,7 @@ module Types end def calls_gitaly? - @calls_gitaly + !!(@calls_gitaly.nil? ? @resolver_class.try(:calls_gitaly?) : @calls_gitaly) end def constant_complexity? diff --git a/app/graphql/types/ci/ci_cd_setting_type.rb b/app/graphql/types/ci/ci_cd_setting_type.rb index 8a49c5a6a95..f01c63d717b 100644 --- a/app/graphql/types/ci/ci_cd_setting_type.rb +++ b/app/graphql/types/ci/ci_cd_setting_type.rb @@ -29,12 +29,6 @@ module Types null: true, description: 'Whether merge pipelines are enabled.', method: :merge_pipelines_enabled? - # TODO(Issue 422295): this is EE only and should be moved to the EE file - 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, diff --git a/app/graphql/types/ci/detailed_status_type.rb b/app/graphql/types/ci/detailed_status_type.rb index e18770c2708..6882a495259 100644 --- a/app/graphql/types/ci/detailed_status_type.rb +++ b/app/graphql/types/ci/detailed_status_type.rb @@ -16,20 +16,34 @@ module Types field :favicon, GraphQL::Types::String, null: true, description: 'Favicon of the status.' field :group, GraphQL::Types::String, null: true, - description: 'Group of the status.' + description: 'Group of the status.', + deprecated: { + reason: 'The `group` attribute is deprecated. Use `name` instead', + milestone: '16.4' + } field :has_details, GraphQL::Types::Boolean, null: true, description: 'Indicates if the status has further details.', method: :has_details? field :icon, GraphQL::Types::String, null: true, - description: 'Icon of the status.' + description: 'Icon of the status.', + deprecated: { + reason: 'The `icon` attribute is deprecated. Use `name` to ' \ + 'identify the status to display instead', + milestone: '16.4' + } field :id, GraphQL::Types::String, null: false, description: 'ID for a detailed status.', extras: [:parent] field :label, GraphQL::Types::String, null: true, - calls_gitaly: true, - description: 'Label of the status.' + description: 'Human-readable label of the status (e.g. success).' + field :name, GraphQL::Types::String, null: true, + description: 'Machine-readable status name (e.g. SUCCESS).' field :text, GraphQL::Types::String, null: true, - description: 'Text of the status.' + description: 'Text of the status.', + deprecated: { + reason: 'The `text` attribute is being deprecated. Use `label` instead', + milestone: '16.4' + } field :tooltip, GraphQL::Types::String, null: true, description: 'Tooltip associated with the status.', method: :status_tooltip diff --git a/app/graphql/types/ci/job_trace_type.rb b/app/graphql/types/ci/job_trace_type.rb index 405c640115d..62fb9340b53 100644 --- a/app/graphql/types/ci/job_trace_type.rb +++ b/app/graphql/types/ci/job_trace_type.rb @@ -21,7 +21,7 @@ module Types def html_summary(last_lines:) object.html( last_lines: last_lines.clamp(1, 100), - max_size: Feature.enabled?(:graphql_job_trace_html_summary_max_size) ? MAX_SIZE_B : nil + max_size: MAX_SIZE_B ).html_safe end end diff --git a/app/graphql/types/ci/pipeline_type.rb b/app/graphql/types/ci/pipeline_type.rb index ba638d4bc47..dfdc3752916 100644 --- a/app/graphql/types/ci/pipeline_type.rb +++ b/app/graphql/types/ci/pipeline_type.rb @@ -18,6 +18,9 @@ module Types field :iid, GraphQL::Types::String, null: false, description: 'Internal ID of the pipeline.' + field :name, GraphQL::Types::String, null: true, + description: 'Name of the pipeline.' + field :sha, GraphQL::Types::String, null: true, method: :sha, description: "SHA of the pipeline's commit." do @@ -61,7 +64,7 @@ module Types description: "Timestamp of the pipeline's last activity." field :started_at, Types::TimeType, null: true, - description: 'Timestamp when the pipeline was started.' + description: 'Timestamp when the pipeline was started.' field :finished_at, Types::TimeType, null: true, description: "Timestamp of the pipeline's completion." @@ -178,6 +181,24 @@ module Types field :merge_request_event_type, Types::Ci::PipelineMergeRequestEventTypeEnum, null: true, description: "Event type of the pipeline associated with a merge request." + field :total_jobs, GraphQL::Types::Int, null: false, method: :total_size, description: "The total number of jobs in the pipeline" + + field :failure_reason, GraphQL::Types::String, null: true, description: "The reason why the pipeline failed" + + field :triggered_by_path, GraphQL::Types::String, null: true, description: "The path that triggered this pipeline" + + field :source, GraphQL::Types::String, null: true, method: :source, description: "The source of the pipeline" + + field :child, GraphQL::Types::Boolean, null: false, method: :child?, description: "If the pipeline is a child or not" + + field :latest, GraphQL::Types::Boolean, null: false, method: :latest?, calls_gitaly: true, description: "If the pipeline is the latest one or not" + + field :ref_text, GraphQL::Types::String, null: false, method: :ref_text, description: "The reference text from the presenter", calls_gitaly: true + + field :merge_request, Types::MergeRequestType, null: true, description: "The MR which the Pipeline is attached to" + + field :stuck, GraphQL::Types::Boolean, method: :stuck?, null: false, description: "If the pipeline is stuck." + def commit BatchLoader::GraphQL.wrap(object.commit) end diff --git a/app/graphql/types/clusters/agent_type.rb b/app/graphql/types/clusters/agent_type.rb index c0989796141..04a4a719ba1 100644 --- a/app/graphql/types/clusters/agent_type.rb +++ b/app/graphql/types/clusters/agent_type.rb @@ -33,7 +33,7 @@ module Types null: true, authorize: :read_project - field :tokens, Types::Clusters::AgentTokenType.connection_type, + field :tokens, description: 'Tokens associated with the cluster agent.', null: true, resolver: ::Resolvers::Clusters::AgentTokensResolver diff --git a/app/graphql/types/custom_emoji_type.rb b/app/graphql/types/custom_emoji_type.rb index b02cd56e6df..08ac3172f2c 100644 --- a/app/graphql/types/custom_emoji_type.rb +++ b/app/graphql/types/custom_emoji_type.rb @@ -7,7 +7,7 @@ module Types authorize :read_custom_emoji - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType expose_permissions Types::PermissionTypes::CustomEmoji diff --git a/app/graphql/types/error_tracking/sentry_error_collection_type.rb b/app/graphql/types/error_tracking/sentry_error_collection_type.rb index 9790560929b..009da29d9c7 100644 --- a/app/graphql/types/error_tracking/sentry_error_collection_type.rb +++ b/app/graphql/types/error_tracking/sentry_error_collection_type.rb @@ -16,7 +16,8 @@ module Types resolver: Resolvers::ErrorTracking::SentryErrorStackTraceResolver field :errors, description: "Collection of Sentry Errors.", - resolver: Resolvers::ErrorTracking::SentryErrorsResolver + resolver: Resolvers::ErrorTracking::SentryErrorsResolver, + connection_extension: Gitlab::Graphql::Extensions::ExternallyPaginatedArrayExtension field :external_url, GraphQL::Types::String, null: true, diff --git a/app/graphql/types/issues/negated_issue_filter_input_type.rb b/app/graphql/types/issues/negated_issue_filter_input_type.rb index fc39efd2493..12f87509ade 100644 --- a/app/graphql/types/issues/negated_issue_filter_input_type.rb +++ b/app/graphql/types/issues/negated_issue_filter_input_type.rb @@ -11,7 +11,7 @@ module Types argument :assignee_usernames, [GraphQL::Types::String], required: false, description: 'Usernames of users not assigned to the issue.' - argument :author_username, GraphQL::Types::String, + argument :author_username, [GraphQL::Types::String], required: false, description: "Username of a user who didn't author the issue." argument :iids, [GraphQL::Types::String], diff --git a/app/graphql/types/merge_request_type.rb b/app/graphql/types/merge_request_type.rb index 4fd2b245de9..e6625e44508 100644 --- a/app/graphql/types/merge_request_type.rb +++ b/app/graphql/types/merge_request_type.rb @@ -102,6 +102,12 @@ module Types calls_gitaly: true, description: 'Detailed merge status of the merge request.' + field :mergeability_checks, [::Types::MergeRequests::MergeabilityCheckType], + null: false, + description: 'Status of all mergeability checks of the merge request.', + method: :all_mergeability_checks_results, + alpha: { milestone: '16.5' } + field :mergeable_discussions_state, GraphQL::Types::Boolean, null: true, calls_gitaly: true, description: 'Indicates if all discussions in the merge request have been resolved, allowing the merge request to be merged.' diff --git a/app/graphql/types/merge_requests/mergeability_check_identifier_enum.rb b/app/graphql/types/merge_requests/mergeability_check_identifier_enum.rb new file mode 100644 index 00000000000..ac25c98941c --- /dev/null +++ b/app/graphql/types/merge_requests/mergeability_check_identifier_enum.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Types + module MergeRequests + class MergeabilityCheckIdentifierEnum < BaseEnum + graphql_name 'MergeabilityCheckIdentifier' + description 'Representation of mergeability check identifier.' + + MergeRequest.all_mergeability_checks.each do |check_class| + identifier = check_class.identifier.to_s + + value identifier.upcase, + value: identifier, + description: "Mergeability check identifier is #{identifier}." + end + end + end +end diff --git a/app/graphql/types/merge_requests/mergeability_check_status_enum.rb b/app/graphql/types/merge_requests/mergeability_check_status_enum.rb new file mode 100644 index 00000000000..d3b95316b67 --- /dev/null +++ b/app/graphql/types/merge_requests/mergeability_check_status_enum.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Types + module MergeRequests + class MergeabilityCheckStatusEnum < BaseEnum + graphql_name 'MergeabilityCheckStatus' + description 'Representation of whether a mergeability check passed, failed or is inactive.' + + value 'SUCCESS', + value: 'success', + description: 'Mergeability check has passed.' + + value 'FAILED', + value: 'failed', + description: 'Mergeability check has failed. The merge request cannot be merged.' + + value 'INACTIVE', + value: 'inactive', + description: 'Mergeability check is disabled via settings.' + end + end +end diff --git a/app/graphql/types/merge_requests/mergeability_check_type.rb b/app/graphql/types/merge_requests/mergeability_check_type.rb new file mode 100644 index 00000000000..4ef44c4b511 --- /dev/null +++ b/app/graphql/types/merge_requests/mergeability_check_type.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module Types + module MergeRequests + class MergeabilityCheckType < BaseObject # rubocop:disable Graphql/AuthorizeTypes + graphql_name 'MergeRequestMergeabilityCheck' + description 'Mergeability check of the merge request.' + + field :identifier, + ::Types::MergeRequests::MergeabilityCheckIdentifierEnum, + null: false, + description: 'Identifier of the mergeability check.' + + field :status, + ::Types::MergeRequests::MergeabilityCheckStatusEnum, + null: false, + description: 'Status of the mergeability check.' + + def status + object.status.to_s + end + + def identifier + object.identifier.to_s + end + end + end +end diff --git a/app/graphql/types/mutation_type.rb b/app/graphql/types/mutation_type.rb index 445f26e2fcf..3af7140aed3 100644 --- a/app/graphql/types/mutation_type.rb +++ b/app/graphql/types/mutation_type.rb @@ -12,6 +12,7 @@ module Types mount_mutation Mutations::Achievements::DeleteUserAchievement, alpha: { milestone: '16.1' } mount_mutation Mutations::Achievements::Revoke, alpha: { milestone: '15.10' } mount_mutation Mutations::Achievements::Update, alpha: { milestone: '15.11' } + mount_mutation Mutations::Achievements::UpdateUserAchievementPriorities, alpha: { milestone: '16.5' } mount_mutation Mutations::Admin::SidekiqQueues::DeleteJobs mount_mutation Mutations::AlertManagement::CreateAlertIssue mount_mutation Mutations::AlertManagement::UpdateAlertStatus @@ -169,6 +170,7 @@ module Types mount_mutation Mutations::Packages::BulkDestroy, extensions: [::Gitlab::Graphql::Limit::FieldCallCount => { limit: 1 }] mount_mutation Mutations::Packages::DestroyFile + mount_mutation Mutations::Packages::Protection::Rule::Create, alpha: { milestone: '16.5' } mount_mutation Mutations::Packages::DestroyFiles mount_mutation Mutations::Packages::Cleanup::Policy::Update mount_mutation Mutations::Echo diff --git a/app/graphql/types/namespace_type.rb b/app/graphql/types/namespace_type.rb index 3420f16213f..85bda507ff7 100644 --- a/app/graphql/types/namespace_type.rb +++ b/app/graphql/types/namespace_type.rb @@ -4,7 +4,7 @@ module Types class NamespaceType < BaseObject graphql_name 'Namespace' - authorize :read_namespace + authorize :read_namespace_via_membership field :id, GraphQL::Types::ID, null: false, description: 'ID of the namespace.' diff --git a/app/graphql/types/notes/note_type.rb b/app/graphql/types/notes/note_type.rb index e7e032c67c6..ffdaab0a5f6 100644 --- a/app/graphql/types/notes/note_type.rb +++ b/app/graphql/types/notes/note_type.rb @@ -5,6 +5,8 @@ module Types class NoteType < BaseObject graphql_name 'Note' + connection_type_class Types::CountableConnectionType + authorize :read_note expose_permissions Types::PermissionTypes::Note diff --git a/app/graphql/types/packages/helm/dependency_type.rb b/app/graphql/types/packages/helm/dependency_type.rb index 72a47d0af51..6ba14145fb5 100644 --- a/app/graphql/types/packages/helm/dependency_type.rb +++ b/app/graphql/types/packages/helm/dependency_type.rb @@ -12,7 +12,7 @@ module Types field :alias, GraphQL::Types::String, null: true, description: 'Alias of the dependency.', resolver_method: :resolve_alias field :condition, GraphQL::Types::String, null: true, description: 'Condition of the dependency.' field :enabled, GraphQL::Types::Boolean, null: true, description: 'Indicates the dependency is enabled.' - field :import_values, [GraphQL::Types::JSON], null: true, description: 'Import-values of the dependency.', hash_key: "import-values" # rubocop:disable Graphql/JSONType + field :import_values, [GraphQL::Types::JSON], null: true, description: 'Import-values of the dependency.', hash_key: :'import-values' # rubocop:disable Graphql/JSONType field :name, GraphQL::Types::String, null: true, description: 'Name of the dependency.' field :repository, GraphQL::Types::String, null: true, description: 'Repository of the dependency.' field :tags, [GraphQL::Types::String], null: true, description: 'Tags of the dependency.' diff --git a/app/graphql/types/packages/helm/metadata_type.rb b/app/graphql/types/packages/helm/metadata_type.rb index ccc5a3029cd..77062a48bc3 100644 --- a/app/graphql/types/packages/helm/metadata_type.rb +++ b/app/graphql/types/packages/helm/metadata_type.rb @@ -10,8 +10,8 @@ module Types # Need to be synced with app/validators/json_schemas/helm_metadata.json field :annotations, GraphQL::Types::JSON, null: true, description: 'Annotations for the chart.' # rubocop:disable Graphql/JSONType - field :api_version, GraphQL::Types::String, null: false, description: 'API version of the chart.', hash_key: "apiVersion" - field :app_version, GraphQL::Types::String, null: true, description: 'App version of the chart.', hash_key: "appVersion" + field :api_version, GraphQL::Types::String, null: false, description: 'API version of the chart.', hash_key: :apiVersion + field :app_version, GraphQL::Types::String, null: true, description: 'App version of the chart.', hash_key: :appVersion field :condition, GraphQL::Types::String, null: true, description: 'Condition for the chart.' field :dependencies, [Types::Packages::Helm::DependencyType], null: true, description: 'Dependencies of the chart.' field :deprecated, GraphQL::Types::Boolean, null: true, description: 'Indicates if the chart is deprecated.' @@ -19,12 +19,12 @@ module Types field :home, GraphQL::Types::String, null: true, description: 'URL of the home page.' field :icon, GraphQL::Types::String, null: true, description: 'URL to an SVG or PNG image for the chart.' field :keywords, [GraphQL::Types::String], null: true, description: 'Keywords for the chart.' - field :kube_version, GraphQL::Types::String, null: true, description: 'Kubernetes versions for the chart.', hash_key: "kubeVersion" + field :kube_version, GraphQL::Types::String, null: true, description: 'Kubernetes versions for the chart.', hash_key: :kubeVersion field :maintainers, [Types::Packages::Helm::MaintainerType], null: true, description: 'Maintainers of the chart.' field :name, GraphQL::Types::String, null: false, description: 'Name of the chart.' field :sources, [GraphQL::Types::String], null: true, description: 'URLs of the source code for the chart.' field :tags, GraphQL::Types::String, null: true, description: 'Tags for the chart.' - field :type, GraphQL::Types::String, null: true, description: 'Type of the chart.', hash_key: "appVersion" + field :type, GraphQL::Types::String, null: true, description: 'Type of the chart.', hash_key: :appVersion field :version, GraphQL::Types::String, null: false, description: 'Version of the chart.' end end diff --git a/app/graphql/types/packages/package_base_type.rb b/app/graphql/types/packages/package_base_type.rb index cc41169bcda..aa580d48709 100644 --- a/app/graphql/types/packages/package_base_type.rb +++ b/app/graphql/types/packages/package_base_type.rb @@ -23,6 +23,7 @@ module Types field :package_type, Types::Packages::PackageTypeEnum, null: false, description: 'Package type.' field :project, Types::ProjectType, null: false, description: 'Project where the package is stored.' field :status, Types::Packages::PackageStatusEnum, null: false, description: 'Package status.' + field :status_message, GraphQL::Types::String, null: true, description: 'Status message.' field :tags, Types::Packages::PackageTagType.connection_type, null: true, description: 'Package tags.' field :updated_at, Types::TimeType, null: false, description: 'Date of most recent update.' field :version, GraphQL::Types::String, null: true, description: 'Version string.' diff --git a/app/graphql/types/packages/package_type.rb b/app/graphql/types/packages/package_type.rb index f6586670c72..4c5b16cc41e 100644 --- a/app/graphql/types/packages/package_type.rb +++ b/app/graphql/types/packages/package_type.rb @@ -10,6 +10,7 @@ module Types field :pipelines, resolver: Resolvers::PackagePipelinesResolver, + connection_extension: Gitlab::Graphql::Extensions::ExternallyPaginatedArrayExtension, description: <<-DESC Pipelines that built the package. Max page size #{Resolvers::PackagePipelinesResolver::MAX_PAGE_SIZE}. DESC diff --git a/app/graphql/types/packages/protection/rule_access_level_enum.rb b/app/graphql/types/packages/protection/rule_access_level_enum.rb new file mode 100644 index 00000000000..098a3e48100 --- /dev/null +++ b/app/graphql/types/packages/protection/rule_access_level_enum.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Types + module Packages + module Protection + class RuleAccessLevelEnum < BaseEnum + graphql_name 'PackagesProtectionRuleAccessLevel' + description 'Access level of a package protection rule resource' + + ::Packages::Protection::Rule.push_protected_up_to_access_levels.each_key do |access_level_key| + value access_level_key.upcase, value: access_level_key.to_s, + description: "#{access_level_key.capitalize} access." + end + end + end + end +end diff --git a/app/graphql/types/packages/protection/rule_package_type_enum.rb b/app/graphql/types/packages/protection/rule_package_type_enum.rb new file mode 100644 index 00000000000..28e9df76adc --- /dev/null +++ b/app/graphql/types/packages/protection/rule_package_type_enum.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Types + module Packages + module Protection + class RulePackageTypeEnum < BaseEnum + graphql_name 'PackagesProtectionRulePackageType' + description 'Package type of a package protection rule resource' + + ::Packages::Protection::Rule.package_types.each_key do |package_type| + value package_type.upcase, value: package_type, + description: "Packages of the #{package_type} format" + end + end + end + end +end diff --git a/app/graphql/types/packages/protection/rule_type.rb b/app/graphql/types/packages/protection/rule_type.rb new file mode 100644 index 00000000000..1e969d39ce2 --- /dev/null +++ b/app/graphql/types/packages/protection/rule_type.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +module Types + module Packages + module Protection + class RuleType < ::Types::BaseObject + graphql_name 'PackagesProtectionRule' + description 'A packages protection rule designed to protect packages ' \ + 'from being pushed by users with a certain access level.' + + authorize :admin_package + + field :package_name_pattern, + GraphQL::Types::String, + null: false, + description: + 'Package name protected by the protection rule. For example `@my-scope/my-package-*`. ' \ + 'Wildcard character `*` allowed.' + + field :package_type, + Types::Packages::Protection::RulePackageTypeEnum, + null: false, + description: 'Package type protected by the protection rule. For example `NPM`.' + + field :push_protected_up_to_access_level, + Types::Packages::Protection::RuleAccessLevelEnum, + null: false, + description: + 'Max GitLab access level unable to push a package. For example `DEVELOPER`, `MAINTAINER`, `OWNER`.' + end + end + end +end diff --git a/app/graphql/types/project_type.rb b/app/graphql/types/project_type.rb index 2738d4da6c2..95caefc3825 100644 --- a/app/graphql/types/project_type.rb +++ b/app/graphql/types/project_type.rb @@ -311,6 +311,12 @@ module Types null: true, description: 'Packages cleanup policy for the project.' + field :packages_protection_rules, + Types::Packages::Protection::RuleType.connection_type, + null: true, + description: 'Packages protection rules for the project.', + resolver: Resolvers::ProjectPackagesProtectionRulesResolver + field :jobs, type: Types::Ci::JobType.connection_type, null: true, @@ -524,7 +530,7 @@ module Types complexity: 5, resolver: ::Resolvers::TimelogResolver - field :agent_configurations, ::Types::Kas::AgentConfigurationType.connection_type, + field :agent_configurations, null: true, description: 'Agent configurations defined by the project', resolver: ::Resolvers::Kas::AgentConfigurationsResolver diff --git a/app/graphql/types/query_type.rb b/app/graphql/types/query_type.rb index d02b3e4136f..d185007f05b 100644 --- a/app/graphql/types/query_type.rb +++ b/app/graphql/types/query_type.rb @@ -109,7 +109,7 @@ module Types null: true, resolver: Resolvers::ProjectResolver, description: "Find a project." - field :projects, Types::ProjectType.connection_type, + field :projects, null: true, resolver: Resolvers::ProjectsResolver, description: "Find projects visible to the current user." @@ -154,7 +154,7 @@ module Types null: true, resolver: Resolvers::TopicsResolver, description: "Find project topics." - field :usage_trends_measurements, Types::Admin::Analytics::UsageTrends::MeasurementType.connection_type, + field :usage_trends_measurements, null: true, description: 'Get statistics on the instance.', resolver: Resolvers::Admin::Analytics::UsageTrends::MeasurementsResolver diff --git a/app/graphql/types/repository_type.rb b/app/graphql/types/repository_type.rb index 40eade3a4d1..a012b60b1c6 100644 --- a/app/graphql/types/repository_type.rb +++ b/app/graphql/types/repository_type.rb @@ -20,6 +20,7 @@ module Types field :exists, GraphQL::Types::Boolean, null: false, method: :exists?, calls_gitaly: true, description: 'Indicates a corresponding Git repository exists on disk.' field :paginated_tree, Types::Tree::TreeType.connection_type, null: true, resolver: Resolvers::PaginatedTreeResolver, calls_gitaly: true, + connection_extension: Gitlab::Graphql::Extensions::ExternallyPaginatedArrayExtension, max_page_size: 100, description: 'Paginated tree of the repository.' field :root_ref, GraphQL::Types::String, null: true, calls_gitaly: true, diff --git a/app/graphql/types/security/codequality_reports_comparer_type.rb b/app/graphql/types/security/codequality_reports_comparer_type.rb index 3b0f790af81..8088bf84627 100644 --- a/app/graphql/types/security/codequality_reports_comparer_type.rb +++ b/app/graphql/types/security/codequality_reports_comparer_type.rb @@ -11,7 +11,7 @@ module Types field :report, type: CodequalityReportsComparer::ReportType, null: true, - hash_key: 'data', + hash_key: :data, description: 'Compared codequality report.' end # rubocop: enable Graphql/AuthorizeTypes diff --git a/app/graphql/types/snippet_type.rb b/app/graphql/types/snippet_type.rb index 6e6d0edbe15..16f01979a43 100644 --- a/app/graphql/types/snippet_type.rb +++ b/app/graphql/types/snippet_type.rb @@ -45,6 +45,11 @@ module Types description: 'Visibility Level of the snippet.', null: false + field :hidden, GraphQL::Types::Boolean, + description: 'Indicates the snippet is hidden because the author has been banned.', + null: false, + method: :hidden_due_to_author_ban? + field :created_at, Types::TimeType, description: 'Timestamp this snippet was created.', null: false diff --git a/app/graphql/types/todo_action_enum.rb b/app/graphql/types/todo_action_enum.rb index 45b83ea1d64..63f96332eab 100644 --- a/app/graphql/types/todo_action_enum.rb +++ b/app/graphql/types/todo_action_enum.rb @@ -13,5 +13,6 @@ module Types 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.' + value 'okr_checkin_requested', value: 12, description: 'An OKR assigned to the user requires an update.' end end diff --git a/app/graphql/types/user_interface.rb b/app/graphql/types/user_interface.rb index 9e5f6810aca..47d486265b0 100644 --- a/app/graphql/types/user_interface.rb +++ b/app/graphql/types/user_interface.rb @@ -160,7 +160,7 @@ module Types description: "Achievements for the user. " \ "Only returns for namespaces where the `achievements` feature flag is enabled.", extras: [:lookahead], - resolver: ::Resolvers::Achievements::UserAchievementsResolver + resolver: ::Resolvers::Achievements::UserAchievementsForUserResolver field :bio, type: ::GraphQL::Types::String, diff --git a/app/graphql/types/user_state_enum.rb b/app/graphql/types/user_state_enum.rb index de15fc19682..72503840bf5 100644 --- a/app/graphql/types/user_state_enum.rb +++ b/app/graphql/types/user_state_enum.rb @@ -5,8 +5,11 @@ module Types graphql_name 'UserState' description 'Possible states of a user' - value 'active', 'User is active and is able to use the system.', value: 'active' - value 'blocked', 'User has been blocked and is prevented from using the system.', value: 'blocked' - value 'deactivated', 'User is no longer active and is unable to use the system.', value: 'deactivated' + value 'active', 'User is active and can use the system.', value: 'active' + value 'blocked', 'User has been blocked by an administrator and cannot use the system.', value: 'blocked' + value 'deactivated', 'User is no longer active and cannot use the system.', value: 'deactivated' + value 'banned', 'User is blocked, and their contributions are hidden.', value: 'banned' + value 'ldap_blocked', 'User has been blocked by the system.', value: 'ldap_blocked' + value 'blocked_pending_approval', 'User is blocked and pending approval.', value: 'blocked_pending_approval' end end diff --git a/app/graphql/types/user_type.rb b/app/graphql/types/user_type.rb index 170f28103eb..87ca5fddf14 100644 --- a/app/graphql/types/user_type.rb +++ b/app/graphql/types/user_type.rb @@ -4,6 +4,9 @@ module Types class UserType < ::Types::BaseObject graphql_name 'UserCore' description 'Core representation of a GitLab user.' + + connection_type_class Types::CountableConnectionType + implements ::Types::UserInterface authorize :read_user diff --git a/app/graphql/types/work_item_type.rb b/app/graphql/types/work_item_type.rb index 05798ba3d2f..103a1c0ec9b 100644 --- a/app/graphql/types/work_item_type.rb +++ b/app/graphql/types/work_item_type.rb @@ -58,6 +58,10 @@ module Types field :work_item_type, Types::WorkItems::TypeType, null: false, description: 'Type assigned to the work item.' + field :archived, GraphQL::Types::Boolean, null: false, + description: 'Whether the work item belongs to an archived project. Always false for group level work items.', + alpha: { milestone: '16.5' } + markdown_field :title_html, null: true markdown_field :description_html, null: true @@ -70,5 +74,11 @@ module Types def create_note_email object.creatable_note_email_address(context[:current_user]) end + + def archived + return false if object.project.blank? + + object.project.archived? + end end end diff --git a/app/graphql/types/work_items/widgets/hierarchy_type.rb b/app/graphql/types/work_items/widgets/hierarchy_type.rb index 4ec8ec84779..41c5af2ce63 100644 --- a/app/graphql/types/work_items/widgets/hierarchy_type.rb +++ b/app/graphql/types/work_items/widgets/hierarchy_type.rb @@ -20,6 +20,12 @@ module Types null: true, complexity: 5, description: 'Child work items.' + field :ancestors, ::Types::WorkItemType.connection_type, + null: true, complexity: 5, + description: 'Ancestors (parents) of the work item.', + extras: [:lookahead], + resolver: Resolvers::WorkItems::AncestorsResolver + field :has_children, GraphQL::Types::Boolean, null: false, description: 'Indicates if the work item has children.' diff --git a/app/graphql/types/work_items/widgets/notes_type.rb b/app/graphql/types/work_items/widgets/notes_type.rb index 7da2777beee..199001649bb 100644 --- a/app/graphql/types/work_items/widgets/notes_type.rb +++ b/app/graphql/types/work_items/widgets/notes_type.rb @@ -18,7 +18,8 @@ module Types field :discussions, Types::Notes::DiscussionType.connection_type, null: true, description: "Notes on this work item.", - resolver: Resolvers::WorkItems::WorkItemDiscussionsResolver + resolver: Resolvers::WorkItems::WorkItemDiscussionsResolver, + connection_extension: Gitlab::Graphql::Extensions::ForwardOnlyExternallyPaginatedArrayExtension end # rubocop:enable Graphql/AuthorizeTypes end |