File: index.d.ts

package info (click to toggle)
node-registry-auth-token 5.0.1%2B~cs2.0.5-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 548 kB
  • sloc: javascript: 1,417; makefile: 2
file content (64 lines) | stat: -rw-r--r-- 2,017 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
declare namespace registryAuthToken {
    /**
     * The options for passing into `registry-auth-token`
     */
    interface AuthOptions {
        /**
         * Whether or not url's path parts are recursively trimmed from the registry
         * url when searching for tokens
         */
        recursive?: boolean | undefined;
        /**
         * An npmrc configuration object used when searching for tokens. If no object is provided,
         * the `.npmrc` file at the base of the project is used.
         */
        npmrc?: {
            /**
             * A registry url used for matching
             */
            registry?: string | undefined;
            /**
             * Registry url's with token information
             */
            [registryUrls: string]: string | undefined;
        } | undefined;
    }
    /**
     * The generated authentication information
     */
    interface NpmCredentials {
        /**
         * The token representing the users credentials
         */
        token: string;
        /**
         * The type of token
         */
        type: 'Basic' | 'Bearer';
        /**
         * The username used in `Basic`
         */
        username?: string | undefined;
        /**
         * The password used in `Basic`
         */
        password?: string | undefined;
    }
}

/**
 * Retrieves the auth token to use for a given registry URL
 *
 * @param registryUrl - Either the registry url used for matching, or a configuration
 * object describing the contents of the .npmrc file
 * @param [options] - a configuration object describing the
 * contents of the .npmrc file.  If an `npmrc` config object was passed in as the
 * first parameter, this parameter is ignored.
 * @returns The `NpmCredentials` object or undefined if no match found.
 */
declare function registryAuthToken(
    registryUrl: string | registryAuthToken.AuthOptions,
    options?: registryAuthToken.AuthOptions,
): registryAuthToken.NpmCredentials | undefined;

export = registryAuthToken;