Documentation ¶
Index ¶
- Constants
- func NewMavenDecoder(reader io.Reader) *xml.Decoder
- type DepsDevAPIClient
- func (c *DepsDevAPIClient) GetPackage(ctx context.Context, in *pb.GetPackageRequest, opts ...grpc.CallOption) (*pb.Package, error)
- func (c *DepsDevAPIClient) GetRequirements(ctx context.Context, in *pb.GetRequirementsRequest, opts ...grpc.CallOption) (*pb.Requirements, error)
- func (c *DepsDevAPIClient) GetVersion(ctx context.Context, in *pb.GetVersionRequest, opts ...grpc.CallOption) (*pb.Version, error)
- func (c *DepsDevAPIClient) GobDecode(b []byte) error
- func (c *DepsDevAPIClient) GobEncode() ([]byte, error)
- type MavenRegistry
- type MavenRegistryAPIClient
- func (m *MavenRegistryAPIClient) AddRegistry(registry MavenRegistry) error
- func (m *MavenRegistryAPIClient) GetProject(ctx context.Context, groupID, artifactID, version string) (maven.Project, error)
- func (m *MavenRegistryAPIClient) GetRegistries() (registries []MavenRegistry)
- func (m *MavenRegistryAPIClient) GetVersions(ctx context.Context, groupID, artifactID string) ([]maven.String, error)
- func (m *MavenRegistryAPIClient) GobDecode(b []byte) error
- func (m *MavenRegistryAPIClient) GobEncode() ([]byte, error)
- func (m *MavenRegistryAPIClient) WithoutRegistries() *MavenRegistryAPIClient
- type NpmRegistryAPIClient
- func (c *NpmRegistryAPIClient) Dependencies(ctx context.Context, pkg, version string) (NpmRegistryDependencies, error)
- func (c *NpmRegistryAPIClient) FullJSON(ctx context.Context, pkg, version string) (gjson.Result, error)
- func (c *NpmRegistryAPIClient) GobDecode(b []byte) error
- func (c *NpmRegistryAPIClient) GobEncode() ([]byte, error)
- func (c *NpmRegistryAPIClient) Versions(ctx context.Context, pkg string) (NpmRegistryVersions, error)
- type NpmRegistryAuthInfo
- type NpmRegistryAuthOpts
- type NpmRegistryConfig
- type NpmRegistryDependencies
- type NpmRegistryVersions
- type RequestCache
Constants ¶
const MavenCentral = "https://repo.maven.apache.org/maven2"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DepsDevAPIClient ¶
type DepsDevAPIClient struct { pb.InsightsClient // contains filtered or unexported fields }
DepsDevAPIClient is a wrapper for InsightsClient that caches requests.
func NewDepsDevAPIClient ¶
func NewDepsDevAPIClient(addr string) (*DepsDevAPIClient, error)
func (*DepsDevAPIClient) GetPackage ¶
func (c *DepsDevAPIClient) GetPackage(ctx context.Context, in *pb.GetPackageRequest, opts ...grpc.CallOption) (*pb.Package, error)
func (*DepsDevAPIClient) GetRequirements ¶
func (c *DepsDevAPIClient) GetRequirements(ctx context.Context, in *pb.GetRequirementsRequest, opts ...grpc.CallOption) (*pb.Requirements, error)
func (*DepsDevAPIClient) GetVersion ¶
func (c *DepsDevAPIClient) GetVersion(ctx context.Context, in *pb.GetVersionRequest, opts ...grpc.CallOption) (*pb.Version, error)
func (*DepsDevAPIClient) GobDecode ¶
func (c *DepsDevAPIClient) GobDecode(b []byte) error
func (*DepsDevAPIClient) GobEncode ¶
func (c *DepsDevAPIClient) GobEncode() ([]byte, error)
type MavenRegistry ¶ added in v1.9.2
type MavenRegistryAPIClient ¶ added in v1.7.0
type MavenRegistryAPIClient struct {
// contains filtered or unexported fields
}
func NewMavenRegistryAPIClient ¶ added in v1.7.0
func NewMavenRegistryAPIClient(registry MavenRegistry) (*MavenRegistryAPIClient, error)
func (*MavenRegistryAPIClient) AddRegistry ¶ added in v1.9.1
func (m *MavenRegistryAPIClient) AddRegistry(registry MavenRegistry) error
AddRegistry adds the given registry to the list of registries if it has not been added.
func (*MavenRegistryAPIClient) GetProject ¶ added in v1.7.0
func (m *MavenRegistryAPIClient) GetProject(ctx context.Context, groupID, artifactID, version string) (maven.Project, error)
GetProject fetches a pom.xml specified by groupID, artifactID and version and parses it to maven.Project. Each registry in the list is tried until we find the project. For a snapshot version, version level metadata is used to find the extact version string. More about Maven Repository Metadata Model: https://maven.apache.org/ref/3.9.9/maven-repository-metadata/ More about Maven Metadata: https://maven.apache.org/repositories/metadata.html
func (*MavenRegistryAPIClient) GetRegistries ¶ added in v1.9.1
func (m *MavenRegistryAPIClient) GetRegistries() (registries []MavenRegistry)
func (*MavenRegistryAPIClient) GetVersions ¶ added in v1.9.1
func (m *MavenRegistryAPIClient) GetVersions(ctx context.Context, groupID, artifactID string) ([]maven.String, error)
GetVersions returns the list of available versions of a Maven package specified by groupID and artifactID. Versions found in all registries are unioned, then sorted by semver.
func (*MavenRegistryAPIClient) GobDecode ¶ added in v1.8.5
func (m *MavenRegistryAPIClient) GobDecode(b []byte) error
func (*MavenRegistryAPIClient) GobEncode ¶ added in v1.8.5
func (m *MavenRegistryAPIClient) GobEncode() ([]byte, error)
func (*MavenRegistryAPIClient) WithoutRegistries ¶ added in v1.9.1
func (m *MavenRegistryAPIClient) WithoutRegistries() *MavenRegistryAPIClient
WithoutRegistries makes MavenRegistryAPIClient including its cache but not registries.
type NpmRegistryAPIClient ¶ added in v1.7.0
type NpmRegistryAPIClient struct {
// contains filtered or unexported fields
}
func NewNpmRegistryAPIClient ¶ added in v1.7.0
func NewNpmRegistryAPIClient(workdir string) (*NpmRegistryAPIClient, error)
func (*NpmRegistryAPIClient) Dependencies ¶ added in v1.7.0
func (c *NpmRegistryAPIClient) Dependencies(ctx context.Context, pkg, version string) (NpmRegistryDependencies, error)
func (*NpmRegistryAPIClient) GobDecode ¶ added in v1.7.0
func (c *NpmRegistryAPIClient) GobDecode(b []byte) error
func (*NpmRegistryAPIClient) GobEncode ¶ added in v1.7.0
func (c *NpmRegistryAPIClient) GobEncode() ([]byte, error)
func (*NpmRegistryAPIClient) Versions ¶ added in v1.7.0
func (c *NpmRegistryAPIClient) Versions(ctx context.Context, pkg string) (NpmRegistryVersions, error)
type NpmRegistryAuthInfo ¶ added in v1.9.0
type NpmRegistryAuthInfo struct {
// contains filtered or unexported fields
}
func (NpmRegistryAuthInfo) AddToHeader ¶ added in v1.9.0
func (authInfo NpmRegistryAuthInfo) AddToHeader(header http.Header)
type NpmRegistryAuthOpts ¶ added in v1.7.2
Implementation of npm registry auth matching, adapted from npm-registry-fetch https://github.com/npm/npm-registry-fetch/blob/237d33b45396caa00add61e0549cf09fbf9deb4f/lib/auth.js
func (NpmRegistryAuthOpts) GetAuth ¶ added in v1.7.2
func (opts NpmRegistryAuthOpts) GetAuth(uri string) NpmRegistryAuthInfo
type NpmRegistryConfig ¶ added in v1.7.2
type NpmRegistryConfig struct { ScopeURLs map[string]string // map of @scope to registry URL RegOpts NpmRegistryAuthOpts // the full key-value pairs of relevant npmrc config options. }
func LoadNpmRegistryConfig ¶ added in v1.7.2
func LoadNpmRegistryConfig(workdir string) (NpmRegistryConfig, error)
func (NpmRegistryConfig) BuildRequest ¶ added in v1.7.2
func (r NpmRegistryConfig) BuildRequest(ctx context.Context, urlComponents ...string) (*http.Request, error)
BuildRequest creates the http request to the corresponding npm registry api urlComponents should be (package) or (package, version)
type NpmRegistryDependencies ¶ added in v1.9.0
type NpmRegistryVersions ¶ added in v1.9.0
type RequestCache ¶ added in v1.9.0
type RequestCache[K comparable, V any] struct { // contains filtered or unexported fields }
RequestCache is a map to cache the results of expensive functions that are called concurrently.
func NewRequestCache ¶ added in v1.9.0
func NewRequestCache[K comparable, V any]() *RequestCache[K, V]
func (*RequestCache[K, V]) Get ¶ added in v1.9.0
func (rq *RequestCache[K, V]) Get(key K, fn func() (V, error)) (V, error)
Get gets the value from the cache map if it's cached, otherwise it will call fn to get the value and cache it. fn will only ever be called once for a key, even if there are multiple simultaneous calls to Get before the first call is finished.
func (*RequestCache[K, V]) GetMap ¶ added in v1.9.0
func (rq *RequestCache[K, V]) GetMap() map[K]V
GetMap gets a shallow clone of the stored cache map.
func (*RequestCache[K, V]) SetMap ¶ added in v1.9.0
func (rq *RequestCache[K, V]) SetMap(m map[K]V)
SetMap loads (a shallow clone of) the provided map into the cache map.