@uipath/auth 1.195.0 → 1.197.0-preview.59

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.
@@ -1,3 +1,4 @@
1
+ import { type GetLoginStatusOptions, type LoginStatus } from "./loginStatus";
1
2
  export interface AuthContext {
2
3
  baseUrl: string;
3
4
  accessToken: string;
@@ -13,5 +14,26 @@ export interface GetAuthContextOptions {
13
14
  requireOrganizationName?: boolean;
14
15
  requireTenantId?: boolean;
15
16
  requireTenantName?: boolean;
17
+ /**
18
+ * Resolve credentials from this exact `.uipath/.auth` path instead of the
19
+ * default cwd→ancestors→home walk-up. Lets an in-process host (e.g. the VS
20
+ * Code extension) pin auth to a specific file — the same `envFilePath`
21
+ * {@link getLoginStatusAsync} already accepts — so concurrent operations
22
+ * against different credential files don't cross-contaminate.
23
+ */
24
+ envFilePath?: string;
16
25
  }
17
26
  export declare const getAuthContext: (options?: GetAuthContextOptions) => Promise<AuthContext>;
27
+ export interface AuthEnvResult {
28
+ /** UiPath credential env vars to merge into a subprocess env. Empty when not logged in. */
29
+ authEnv: Record<string, string>;
30
+ /** The login status used to build {@link authEnv}, or undefined when it could not be read. */
31
+ loginStatus?: LoginStatus;
32
+ }
33
+ /**
34
+ * Build UiPath credential env vars from the live `uip login` status, for
35
+ * injecting into a spawned process. The token is refreshed so the child gets
36
+ * a valid bearer token, not a stale one off disk. Never throws: returns an
37
+ * empty `authEnv` when there is no usable login.
38
+ */
39
+ export declare const getAuthEnv: (options?: GetLoginStatusOptions) => Promise<AuthEnvResult>;
@@ -0,0 +1,11 @@
1
+ export declare const DEFAULT_AUTH_PROFILE = "default";
2
+ export declare class AuthProfileValidationError extends Error {
3
+ constructor(message: string);
4
+ }
5
+ export declare function normalizeAuthProfileName(profile: string | undefined): string | undefined;
6
+ export declare function setActiveAuthProfile(profile: string | undefined): void;
7
+ export declare function clearActiveAuthProfile(): void;
8
+ export declare function getActiveAuthProfile(): string | undefined;
9
+ export declare function runWithAuthProfile<T>(profile: string | undefined, fn: () => T): T;
10
+ export declare function resolveAuthProfileFilePath(profile: string): string;
11
+ export declare function getActiveAuthProfileFilePath(): string | undefined;
@@ -5,5 +5,9 @@ interface ClientCredentialsLoginProps {
5
5
  scope?: string[];
6
6
  authority?: string;
7
7
  }
8
+ export declare class ClientCredentialsAuthenticationError extends Error {
9
+ readonly status: number;
10
+ constructor(message: string, status: number);
11
+ }
8
12
  export declare const clientCredentialsLogin: ({ clientId, clientSecret, scope, authority, }: ClientCredentialsLoginProps) => Promise<BaseCredentials>;
9
13
  export {};
package/dist/envAuth.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { LoginStatus } from "./loginStatus";
1
+ import { type LoginStatus } from "./loginStatus";
2
2
  /**
3
3
  * Environment variable that opts the CLI into sourcing authentication
4
4
  * data from env vars instead of the `.uipath/.auth` file. Must be set
@@ -1,4 +1,5 @@
1
1
  export * from "./authContext";
2
+ export * from "./authProfile";
2
3
  export * from "./clientCredentials";
3
4
  export { type AuthFileConfig, InvalidBaseUrlError, setAuthFileConfig, } from "./config";
4
5
  export * from "./loginStatus";