ado-npm-auth 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ado/make-ado-request.d.ts +15 -0
- package/lib/azureauth/ado.d.ts +26 -0
- package/lib/azureauth/ado.test.d.ts +2 -0
- package/lib/azureauth/azureauth-command.d.ts +11 -0
- package/lib/azureauth/index.d.ts +2 -0
- package/lib/azureauth/is-azureauth-installed.d.ts +7 -0
- package/lib/azureauth/is-azureauth-installed.test.d.ts +2 -0
- package/lib/azureauth/is-supported-platform-and-architecture.d.ts +6 -0
- package/lib/npmrc/generate-npmrc-pat.d.ts +6 -0
- package/lib/npmrc/index.d.ts +2 -0
- package/lib/npmrc/npmrcFileProvider.d.ts +12 -0
- package/lib/telemetry/index.d.ts +20 -0
- package/lib/utils/encoding.d.ts +13 -0
- package/lib/utils/exec.d.ts +3 -0
- package/lib/utils/get-feed-without-protocol.d.ts +5 -0
- package/lib/utils/get-feed-without-protocol.test.d.ts +2 -0
- package/lib/utils/get-organization-from-feed-url.d.ts +8 -0
- package/lib/utils/get-organization-from-feed-url.test.d.ts +2 -0
- package/lib/utils/is-codespaces.d.ts +6 -0
- package/lib/utils/is-wsl.d.ts +6 -0
- package/lib/utils/partition.d.ts +2 -0
- package/lib/utils/request.d.ts +8 -0
- package/lib/yarnrc/yarnrcFileProvider.d.ts +29 -0
- package/package.json +2 -2
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if the user is authenticated to the ADO API.
|
|
3
|
+
* This function performs a network request to retrieve an ADO feed for the given organization
|
|
4
|
+
* Since that request is usually slow, and we don't actually know the ID of a valid feed, we just use the "invalid" ID of "1"
|
|
5
|
+
* If the network request returns 401, then the PAT is invalid. If the request returns 404 (or somehow 200) then the PAT is valid
|
|
6
|
+
* @param {Object} options
|
|
7
|
+
* @param {string} options.password The password to use for the login
|
|
8
|
+
* @param {string} options.organization The organization to check against
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
export declare const makeADORequest: ({ password, organization, }: {
|
|
12
|
+
password: string;
|
|
13
|
+
organization: string;
|
|
14
|
+
}) => Promise<void>;
|
|
15
|
+
//# sourceMappingURL=make-ado-request.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type AdoPatOptions = {
|
|
2
|
+
promptHint: string;
|
|
3
|
+
organization: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
scope: string[];
|
|
6
|
+
output?: string;
|
|
7
|
+
mode?: string;
|
|
8
|
+
domain?: string;
|
|
9
|
+
timeout?: string;
|
|
10
|
+
};
|
|
11
|
+
export type AdoPatResponse = {
|
|
12
|
+
displayName: string;
|
|
13
|
+
validTo: string;
|
|
14
|
+
scope: string[];
|
|
15
|
+
targetAccounts: string[];
|
|
16
|
+
validFrom: string;
|
|
17
|
+
authorizationId: string;
|
|
18
|
+
token: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Wrapper for `azureauth ado pat`. Please run `azureauth ado pat --help` for full command options and description
|
|
22
|
+
* @param options Options for PAT generation
|
|
23
|
+
* @returns ADO PAT details
|
|
24
|
+
*/
|
|
25
|
+
export declare const adoPat: (options: AdoPatOptions, azureAuthLocation?: string) => Promise<AdoPatResponse | string>;
|
|
26
|
+
//# sourceMappingURL=ado.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const clearMemo: () => void;
|
|
2
|
+
/**
|
|
3
|
+
* Get the executable path of azureauth command
|
|
4
|
+
* @returns the string of the executable command to run azureauth, and any
|
|
5
|
+
* necessary environment variables if using npx
|
|
6
|
+
*/
|
|
7
|
+
export declare const azureAuthCommand: () => {
|
|
8
|
+
command: string[];
|
|
9
|
+
env: Record<string, string>;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=azureauth-command.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const clearMemo: () => void;
|
|
2
|
+
/**
|
|
3
|
+
* Determine if a valid version (>=0.8.0.0) is installed
|
|
4
|
+
* @returns { boolean } Whether a valid version of azureauth is installed
|
|
5
|
+
*/
|
|
6
|
+
export declare const isAzureAuthInstalled: () => Promise<boolean>;
|
|
7
|
+
//# sourceMappingURL=is-azureauth-installed.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determines if the currently running platform is supported by azureauth. Currently, supported platforms are Windows, Mac & WSL
|
|
3
|
+
* @returns { boolean } if the current platform is supported by azureauth
|
|
4
|
+
*/
|
|
5
|
+
export declare const isSupportedPlatformAndArchitecture: () => boolean;
|
|
6
|
+
//# sourceMappingURL=is-supported-platform-and-architecture.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a valid ADO PAT, scoped for vso.packaging in the given ado organization, 30 minute timeout
|
|
3
|
+
* @returns { string } a valid ADO PAT
|
|
4
|
+
*/
|
|
5
|
+
export declare const generateNpmrcPat: (organization: string, encode?: boolean, azureAuthLocation?: string) => Promise<string>;
|
|
6
|
+
//# sourceMappingURL=generate-npmrc-pat.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Feed, FileProvider } from "../fileProvider.js";
|
|
2
|
+
export declare class NpmrcFileProvider extends FileProvider {
|
|
3
|
+
constructor(configFile?: string);
|
|
4
|
+
prepUserFile(): Promise<void>;
|
|
5
|
+
getWorkspaceRegistries(): Promise<string[]>;
|
|
6
|
+
getUserFeeds(): Promise<Map<string, Feed>>;
|
|
7
|
+
patchUserNpmRcFile(newLinesByRegistryAndField: Map<string, string>): Promise<string[]>;
|
|
8
|
+
toRegistryAndFunctionKey(registry: string, field: string): string;
|
|
9
|
+
writeWorkspaceRegistries(feedsToPatch: Iterable<Feed>): Promise<void>;
|
|
10
|
+
processNpmRcFile(npmrcFilePath: string, handleFeedConfig: (line: string, registry: string, field: string, value: string) => string | void, handleOtherLine?: (line: string) => string | void): Promise<string[]>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=npmrcFileProvider.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type TelemetryProperties = {
|
|
2
|
+
success: boolean;
|
|
3
|
+
automaticSuccess: boolean;
|
|
4
|
+
platform: string;
|
|
5
|
+
arch: string;
|
|
6
|
+
error: string;
|
|
7
|
+
};
|
|
8
|
+
export interface TelemetryClient {
|
|
9
|
+
LogEvent: (eventName: string, properties: Map<string, string>) => void;
|
|
10
|
+
flush(): void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Logs an node-azure-auth event to telemetry.
|
|
14
|
+
*/
|
|
15
|
+
export declare const logTelemetry: (inputProperties: {
|
|
16
|
+
success?: boolean;
|
|
17
|
+
automaticSuccess?: boolean;
|
|
18
|
+
error?: string;
|
|
19
|
+
}, flush?: boolean, client?: TelemetryClient) => void;
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a base64 encoded string from a string
|
|
3
|
+
* @param {string} input
|
|
4
|
+
* @returns {string}
|
|
5
|
+
*/
|
|
6
|
+
export declare function toBase64(input: string | undefined): string;
|
|
7
|
+
/**
|
|
8
|
+
* Decode a base64 encoded string
|
|
9
|
+
* @param {string} base64string
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
export declare const fromBase64: (base64string: string) => string;
|
|
13
|
+
//# sourceMappingURL=encoding.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the ADO Org for a npm feed
|
|
3
|
+
* @param {string} feedUrl URL of the feed to get the ADO organization from
|
|
4
|
+
* @param {string} [defaultOrg] Backup org in case it cannot be determined from the feed url
|
|
5
|
+
* @returns ADO Organization for the feed
|
|
6
|
+
*/
|
|
7
|
+
export declare const getOrganizationFromFeedUrl: (feedUrl: string, defaultOrg?: string) => string;
|
|
8
|
+
//# sourceMappingURL=get-organization-from-feed-url.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Feed, FileProvider } from "../fileProvider.js";
|
|
2
|
+
export declare class YarnRcFileProvider extends FileProvider {
|
|
3
|
+
constructor(configFile?: string);
|
|
4
|
+
prepUserFile(): Promise<void>;
|
|
5
|
+
getUserFeeds(): Promise<Map<string, Feed>>;
|
|
6
|
+
getWorkspaceRegistries(): Promise<string[]>;
|
|
7
|
+
writeWorkspaceRegistries(feedsToPatch: Iterable<Feed>): Promise<void>;
|
|
8
|
+
paseYarnRc(filePath: string): Promise<YarnRc>;
|
|
9
|
+
}
|
|
10
|
+
interface YarnRc {
|
|
11
|
+
npmRegistryServer?: string;
|
|
12
|
+
npmScopes?: {
|
|
13
|
+
[org: string]: {
|
|
14
|
+
npmRegistryServer?: string;
|
|
15
|
+
npmAlwaysAuth?: boolean;
|
|
16
|
+
npmAuthIdent?: string;
|
|
17
|
+
npmAuthToken?: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
npmRegistries?: {
|
|
21
|
+
[registry: string]: {
|
|
22
|
+
npmAlwaysAuth?: boolean;
|
|
23
|
+
npmAuthIdent?: string;
|
|
24
|
+
npmAuthToken?: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=yarnrcFileProvider.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ado-npm-auth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "The ado-npm-auth package can automatically use the azureauth CLI to fetch tokens and update a user's .npmrc file for authenticating to ADO package feeds.",
|
|
5
5
|
"repository": "https://github.com/microsoft/ado-npm-auth",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"files": [
|
|
14
14
|
"dist/index.js",
|
|
15
15
|
"dist/ado-npm-auth.cjs",
|
|
16
|
-
"lib
|
|
16
|
+
"lib/**/*.d.ts",
|
|
17
17
|
"bin",
|
|
18
18
|
"static",
|
|
19
19
|
"LICENCSE.txt",
|