@docyrus/cli 0.1.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.
@@ -0,0 +1,90 @@
1
+ import { TokenManager } from '@docyrus/api-client';
2
+
3
+ declare class CliTokenManager implements TokenManager {
4
+ private keychain;
5
+ private fileStorage;
6
+ private keychainAvailable;
7
+ constructor();
8
+ private useKeychain;
9
+ getToken(): Promise<string | null>;
10
+ setToken(token: string): Promise<void>;
11
+ clearToken(): Promise<void>;
12
+ getRefreshToken(): Promise<string | null>;
13
+ setRefreshToken(token: string): Promise<void>;
14
+ clearRefreshToken(): Promise<void>;
15
+ getUserEmail(): Promise<string | null>;
16
+ setUserEmail(email: string): Promise<void>;
17
+ getGithubToken(): Promise<string | null>;
18
+ setGithubToken(token: string): Promise<void>;
19
+ clearAll(): Promise<void>;
20
+ isLoggedIn(): Promise<boolean>;
21
+ }
22
+ declare function getTokenManager(): CliTokenManager;
23
+
24
+ interface AuthCredentials {
25
+ email: string;
26
+ password: string;
27
+ }
28
+ interface AuthTokens {
29
+ accessToken: string;
30
+ refreshToken?: string;
31
+ expiresIn?: number;
32
+ expiresAt?: number;
33
+ tokenType?: string;
34
+ }
35
+ interface UserInfo {
36
+ id: string;
37
+ email: string;
38
+ firstname?: string;
39
+ lastname?: string;
40
+ photo?: string;
41
+ }
42
+ interface OAuthConfig {
43
+ authorizationUrl: string;
44
+ tokenUrl: string;
45
+ clientId: string;
46
+ redirectUri: string;
47
+ scopes: string[];
48
+ }
49
+ interface LoginResult {
50
+ tokens: AuthTokens;
51
+ user?: UserInfo;
52
+ }
53
+
54
+ declare function loginWithCredentials(credentials: AuthCredentials): Promise<LoginResult>;
55
+ declare function getUserInfo(accessToken: string): Promise<UserInfo>;
56
+ declare function refreshAccessToken(refreshToken: string): Promise<AuthTokens>;
57
+
58
+ interface OAuthLoginOptions {
59
+ onOpeningBrowser?: () => void;
60
+ onWaitingForAuth?: (url: string) => void;
61
+ }
62
+ declare function loginWithOAuth(options?: OAuthLoginOptions): Promise<LoginResult>;
63
+
64
+ /**
65
+ * Environment Configuration
66
+ * Values are injected at BUILD TIME via tsup.config.ts
67
+ * See tsup.config.ts for default values and .env.example for configuration
68
+ */
69
+ declare const DOCYRUS_API_URL: string;
70
+ declare const CLI_NAME = "docyrus";
71
+ declare const CLI_VERSION = "0.0.1";
72
+
73
+ interface CliConfig {
74
+ apiUrl?: string;
75
+ lastLoginEmail?: string;
76
+ telemetryEnabled: boolean;
77
+ }
78
+ declare class ConfigManager {
79
+ private config;
80
+ constructor();
81
+ get<K extends keyof CliConfig>(key: K): CliConfig[K];
82
+ set<K extends keyof CliConfig>(key: K, value: CliConfig[K]): void;
83
+ delete<K extends keyof CliConfig>(key: K): void;
84
+ getAll(): CliConfig;
85
+ clear(): void;
86
+ get path(): string;
87
+ }
88
+ declare const configManager: ConfigManager;
89
+
90
+ export { type AuthCredentials, type AuthTokens, CLI_NAME, CLI_VERSION, type CliConfig, CliTokenManager, DOCYRUS_API_URL, type LoginResult, type OAuthConfig, type UserInfo, configManager, getTokenManager, getUserInfo, loginWithCredentials, loginWithOAuth, refreshAccessToken };