Skip to content

NPM dependency proxy: implement the upload endpoint

🔥 Problem

The NPM dependency proxy will get files from the remote registry and will use workhorse to upload them to the package registry (which is used as a cache).

The problem is that the dependency proxy workhorse logic only works with workhorse assisted uploads.

Now, guess what happens with the NPM package registry upload endpoint? Yes, it's not a workhorse assisted one.

🚒 Solution

In very short words, we will need to implement a custom upload endpoint in the NPM dependency proxy so that it's a workhorse assisted one. This, we can completely re-use the existing upload (workhorse) logic of the dependency proxy.

  • Add an upload endpoint to the NPM dependency proxy API class.
  • Make sure that we can detect the 2 types of uploads: tgz files or metadata documents (json). This is important as those types will not be handled in the same way.
  • For tgz uploads, create the package if it doesn't exist and put the file underneath it.
Edited by 🤖 GitLab Bot 🤖