@vltpkg/registry-client
Classes
RegistryClient
Defined in: index.ts:162
Constructors
new RegistryClient()
new RegistryClient(options): RegistryClient
Defined in: index.ts:167
Parameters
options
Returns
Properties
agent
agent: RetryAgent
Defined in: index.ts:163
cache
cache: Cache
Defined in: index.ts:164
identity
identity: string
Defined in: index.ts:165
Methods
login()
login(registry): Promise<void>
Defined in: index.ts:269
Log into the registry specified
Does not return the token or expose it, just saves to the auth keychain and returns void if it worked. Otherwise, error is raised.
Parameters
registry
string
Returns
Promise
<void
>
logout()
logout(registry): Promise<void>
Defined in: index.ts:237
Log out from the registry specified, attempting to destroy the token if the registry supports that endpoint.
Parameters
registry
string
Returns
Promise
<void
>
request()
request(url, options): Promise<CacheEntry>
Defined in: index.ts:355
Parameters
url
string
| URL
options
RegistryClientRequestOptions
= {}
Returns
Promise
<CacheEntry
>
scroll()
scroll<T>( url, options,seek?): Promise<T[]>
Defined in: index.ts:206
Fetch the entire set of a paginated list of objects
Type Parameters
• T
Parameters
url
string
| URL
options
RegistryClientRequestOptions
= {}
seek?
(obj
) => boolean
Returns
Promise
<T
[]>
seek()
seek<T>( url, seek,options): Promise<undefined | T>
Defined in: index.ts:225
find a given item in a paginated set
Type Parameters
• T
Parameters
url
string
| URL
seek
(obj
) => boolean
options
RegistryClientRequestOptions
= {}
Returns
Promise
<undefined
| T
>
webAuthOpener()
webAuthOpener(__namedParameters): Promise<TokenResponse>
Defined in: index.ts:310
Given a WebAuthChallenge, open the loginUrl
in
a browser and hang on the doneUrl
until it returns a
TokenResponse object.
Parameters
__namedParameters
Returns
Promise
<TokenResponse
>
Type Aliases
RegistryClientOptions
type RegistryClientOptions = object
Defined in: index.ts:46
Type declaration
cache?
optional cache: string;
Path on disk where the cache should be stored
Default
$HOME/.config/vlt/cache
fetch-retries?
optional fetch-retries: number;
Number of retries to perform when encountering network errors or likely-transient errors from git hosts.
fetch-retry-factor?
optional fetch-retry-factor: number;
The exponential backoff factor to use when retrying git hosts
fetch-retry-maxtimeout?
optional fetch-retry-maxtimeout: number;
Maximum number of milliseconds between two retries
fetch-retry-mintimeout?
optional fetch-retry-mintimeout: number;
Number of milliseconds before starting first retry
identity?
optional identity: string;
the identity to use for storing auth tokens
RegistryClientRequestOptions
type RegistryClientRequestOptions = Omit< Dispatcher.RequestOptions, 'method' | 'path'> & object
Defined in: index.ts:68
Type declaration
cache?
optional cache: false;
Set to false
to suppress ANY lookups from cache. This will also
prevent storing the result to the cache.
integrity?
optional integrity: Integrity;
Provide an SRI string to verify integrity of the item being fetched.
This is only relevant when it must make a request to the registry. Once in the local disk cache, items are assumed to be trustworthy.
maxRedirections?
optional maxRedirections: number;
Follow up to 10 redirections by default. Set this to 0 to just return the 3xx response. If the max redirections are expired, and we still get a redirection response, then fail the request. Redirection cycles are always treated as an error.
method?
optional method: Dispatcher.DispatchOptions["method"];
Method is optional, defaults to ‘GET’
path?
optional path: string;
path
should not be set when using the RegistryClient. It will be
overwritten with the path on the URL being requested. This only here
for compliance with the DispatchOptions base type.
Deprecated
trustIntegrity?
optional trustIntegrity: boolean;
Set to true if the integrity should be trusted implicitly without a recalculation, for example if it comes from a trusted registry that also serves the tarball itself.
Token
type Token = `Bearer ${string}` | `Basic ${string}`
Defined in: auth.ts:3
TokenResponse
type TokenResponse = object
Defined in: token-response.ts:1
Type declaration
token
token: string
WebAuthChallenge
type WebAuthChallenge = object
Defined in: web-auth-challenge.ts:1
Type declaration
doneUrl
doneUrl: string
loginUrl
loginUrl: string
Variables
keychains
const keychains: Map<string, Keychain<Token>>
Defined in: auth.ts:6
userAgent
const userAgent: string
Defined in: index.ts:142
Functions
deleteToken()
function deleteToken(registry, identity): Promise<void>
Defined in: auth.ts:21
Parameters
registry
string
identity
string
Returns
Promise
<void
>
getKC()
function getKC(identity): Keychain<Token>
Defined in: auth.ts:8
Parameters
identity
string
Returns
isToken()
function isToken(t): t is Token
Defined in: auth.ts:17
Parameters
t
any
Returns
t is Token
setToken()
function setToken(registry, token, identity): Promise<void>
Defined in: auth.ts:31
Parameters
registry
string
token
identity
string
Returns
Promise
<void
>
References
CacheEntry
Re-exports CacheEntry
JSONObj
Re-exports JSONObj