@exayard/cli 0.2.0 → 0.5.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/dist/index.d.ts CHANGED
@@ -12,24 +12,39 @@ interface CommandContext {
12
12
  json: boolean;
13
13
  write: (line: string) => void;
14
14
  writeErr: (line: string) => void;
15
+ /** Opens the sign-in page; the default opens the system browser (tests pass their own). */
16
+ openBrowser?: (url: string) => void | Promise<void>;
15
17
  }
16
18
  declare const COMMANDS: Record<string, (ctx: CommandContext) => Promise<number>>;
17
19
 
20
+ interface OAuthSession {
21
+ accessToken: string;
22
+ refreshToken?: string;
23
+ /** Epoch milliseconds; unset when the server gave no `expires_in`. */
24
+ expiresAt?: number;
25
+ clientId: string;
26
+ tokenEndpoint: string;
27
+ redirectUri: string;
28
+ /** The RFC 8707 resource the token was asked for (the API). */
29
+ resource?: string;
30
+ }
31
+
18
32
  /**
19
33
  * Credential storage for the Exayard CLI.
20
34
  *
21
35
  * Written to ~/.exayard/config.json with mode 600 (readable only by the
22
- * owner) — same pattern `gh`, `stripe`, and `vercel` use. Env vars take
23
- * precedence so CI runs don't need to persist anything to disk.
36
+ * owner), in a 700 directory — same pattern `gh`, `stripe`, and `vercel` use.
37
+ * Env vars take precedence so CI runs don't need to persist anything to disk.
24
38
  *
25
- * The file is intentionally tiny: api key + last-used org. Richer state
26
- * (saved commands, history, etc.) can be added without changing the
27
- * precedence rules.
39
+ * Holds an API key (`exayard login --api-key`) or a browser sign-in session
40
+ * (`exayard login`: access and refresh token), plus the last-used org. An API
41
+ * key wins over the session.
28
42
  */
29
43
  interface ExayardConfig {
30
44
  apiKey?: string;
31
45
  organizationId?: string;
32
46
  baseUrl?: string;
47
+ oauth?: OAuthSession;
33
48
  }
34
49
  declare const readConfig: () => ExayardConfig;
35
50
  declare const writeConfig: (config: ExayardConfig) => void;