Replies: 4 comments 20 replies
-
The |
Beta Was this translation helpful? Give feedback.
-
I'm still very fuzzy on how namespace mapping/aliasing would work in practice. If I publish a package with a dependency on I can imagine scenarios where the registry I published to would be able to replace the dependency (via a "trust reset" of the package name); I have already trusted the registry to some extent to manage my package name so that doesn't seem like a major leap. Allowing a proxying registry to override a dependency is harder to reason about; certainly there are use-cases for it (my company needs to swap in a dependency hotfix) but I'm not sure how to balance that against a potential for misuse. This may ultimately be more of a question of UX than technical features, but I think in this kind of design spec'ing the UX can be as important as protocol design. |
Beta Was this translation helpful? Give feedback.
-
I was proposing Namespace Mapping and Aliasing. Do we need finer grain mapping/aliasing down to the Package Identifier? |
Beta Was this translation helpful? Give feedback.
-
Proposed API Changes:
|
Beta Was this translation helpful? Give feedback.
-
Federation is one of the few outstanding protocol features not implemented.
Effort is underway to update the docs with targeted use cases. To highlight two use cases:
This proposed implementation can be thought of as a composition of three new features:
Registry Proxying
Simply adds a request header (perhaps named
Warg-Registry
) that specifies the registry domain name that is the registry subject of the API request. If that header is present, the registry server would either respond like a read-thru cache of the other registry's API or error if that registry is not supported. A registry could choose to support (or not) passing along publish requests to the subject registry.Since this is just an HTTP request header, there are many implementation options. For instance, a proxy service could sit in front of the registry servers and route the request based upon the header.
Registries are expected to be selective which other registries (if any) that they support proxying.
Namespace Mapping
A package identifier, such as
my-company:foo-package
, does not indicate the registry domain name where it is published. Also, namespaces (my-company
in this example) are not expected to be globally unique across all registries.The client CLI needs to know which registry has which package. Also, when publishing packages, a registry needs to validate package imports and know which registry has which package.
This implementation proposes using namespaces to group package identifiers and associate them with their published registry domain name.
This proposes a new registry API endpoint for the client to retrieve the registry's namespace mappings to its published registry domain names. This is the mappings that the registry will use to validate package imports published to the registry. The registry will also indicate if it supports proxying those registry domain names.
The client CLI can use the mappings provided by the registry as well as extend them or override them. This configuration can be set for user profile global use or project-based with a lock file. The lock file includes the checkpoints for each registry.
Namespace Aliasing
The following proposes an extension to the namespace mapping configuration.
To resolve naming conflicts, namespace mappings can alias the source registry's namespace to a new name to be used by packages published to its registry.
By default, package imports are resolved in the context of the mappings of the registry it was published. To resolve package imports as if it was published to a different registry, the namespace mappings can specify a registry context.
Beta Was this translation helpful? Give feedback.
All reactions