summaryrefslogtreecommitdiff
path: root/lib/api/npm_group_packages.rb
blob: 7e6da6b4b02a91f37beaa4e549acff109f04eb6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# frozen_string_literal: true

module API
  class NpmGroupPackages < ::API::Base
    helpers ::API::Helpers::Packages::Npm

    feature_category :package_registry
    urgency :low

    helpers do
      def endpoint_scope
        :group
      end
    end

    after_validation do
      not_found! unless Feature.enabled?(:npm_group_level_endpoints, group)
    end

    params do
      requires :id, types: [String, Integer], desc: 'The ID or URL-encoded path of the group'
    end
    resource :groups, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
      namespace ':id/-/packages/npm' do
        params do
          requires :package_name, type: String, desc: 'Package name'
        end
        namespace '-/package/*package_name' do
          get 'dist-tags', format: false do
            not_found!
          end

          namespace 'dist-tags/:tag' do
            put format: false do
              not_found!
            end

            delete format: false do
              not_found!
            end
          end
        end

        post '-/npm/v1/security/audits/quick' do
          not_found!
        end

        post '-/npm/v1/security/advisories/bulk' do
          not_found!
        end

        include ::API::Concerns::Packages::NpmEndpoints
      end
    end
  end
end