mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
GetRepositoryEndpoint for format=npm now returns a working registry endpoint: real npm/yarn/pnpm clients can publish to and install from it, proxied straight through to a real Verdaccio instance rather than reimplemented. Every request needs Authorization: Bearer <token> from GetAuthorizationToken, matching npm's own _authToken config and, unlike Maven's HTTP Basic support, Bearer only. Unlike Reposilite, Verdaccio has no native concept of multiple named repositories inside one instance, so each CodeArtifact repository gets its own container instead of sharing one, started lazily on first use and identified by a fresh id assigned at CreateRepository time so a repository deleted and recreated under the same name never inherits the previous one's packages. Each container is started with VERDACCIO_PUBLIC_URL set to that repository's own proxy URL so package metadata it returns (dist.tarball) points back through Floci instead of the container's own internal, client-unreachable address. VerdaccioSidecarManager implements the RepositorySidecarManager interface CodeArtifactService already generalized DeleteRepository's cleanup over, so a deleted repository's Verdaccio container is stopped and removed the same generic way Maven's Reposilite storage is released. The per-key container lifecycle (map of running containers, per-key start lock, health poll, restart-on-unhealthy, stop-all) has nothing Verdaccio-specific in it, so it is pulled out into PerKeyContainerPool for a future per-repository sidecar to reuse directly. CodeArtifactNpmDataPlane is a raw streaming proxy rather than a JAX-RS controller, since npm's wire protocol has no fixed path shape the way Maven's GAV layout does; Verdaccio already speaks that protocol correctly, so this only needs to authenticate the request and forward it. The publish/fetch integration test replays a real request the npm CLI sent during manual verification, captured with a tiny Node.js capture server, so it exercises the exact envelope shape (including a real gzip tarball attachment) npm publish actually produces; the full round trip was additionally verified by hand with the real npm CLI against a live Floci instance.