Skip to content

Commit 01b5262

Browse files
committed
Move out auth config from Credential type
1 parent 65f7f36 commit 01b5262

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

src/start-proxy/types.ts

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,38 @@
55
*/
66
export type RawCredential = Partial<Credential>;
77

8-
/**
9-
* A package registry configuration includes identifying information as well as
10-
* authentication credentials.
11-
*/
12-
export type Credential = {
8+
/** Usernames may be present for both authentication with tokens or passwords. */
9+
export type Username = {
1310
/** The username needed to authenticate to the package registry, if any. */
1411
username?: string;
12+
};
13+
14+
/**
15+
* Fields expected for authentication based on a username and password.
16+
* Both username and password are optional.
17+
*/
18+
export type UsernamePassword = {
1519
/** The password needed to authenticate to the package registry, if any. */
1620
password?: string;
21+
} & Username;
22+
23+
/**
24+
* Fields expected for token-based authentication.
25+
* Both username and token are optional.
26+
*/
27+
export type Token = {
1728
/** The token needed to authenticate to the package registry, if any. */
1829
token?: string;
19-
} & Registry;
30+
} & Username;
31+
32+
/** All authentication-related fields. */
33+
export type AuthConfig = UsernamePassword & Token;
34+
35+
/**
36+
* A package registry configuration includes identifying information as well as
37+
* authentication credentials.
38+
*/
39+
export type Credential = AuthConfig & Registry;
2040

2141
/** A package registry is identified by its type and address. */
2242
export type Registry = {

0 commit comments

Comments
 (0)