@anvil-works/anvil-cli 0.5.13 → 0.5.15

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.
Files changed (86) hide show
  1. package/dist/CLILogger.d.ts +54 -0
  2. package/dist/CLILogger.d.ts.map +1 -0
  3. package/dist/EditorYaml.d.ts +57 -0
  4. package/dist/EditorYaml.d.ts.map +1 -0
  5. package/dist/Emitter.d.ts +32 -0
  6. package/dist/Emitter.d.ts.map +1 -0
  7. package/dist/SavePathRouter.d.ts +56 -0
  8. package/dist/SavePathRouter.d.ts.map +1 -0
  9. package/dist/WatchSession.d.ts +112 -0
  10. package/dist/WatchSession.d.ts.map +1 -0
  11. package/dist/api.d.ts +35 -0
  12. package/dist/api.d.ts.map +1 -0
  13. package/dist/cli.d.ts +3 -0
  14. package/dist/cli.d.ts.map +1 -0
  15. package/dist/cli.js +2092 -2092
  16. package/dist/commands/checkout-picker.d.ts +25 -0
  17. package/dist/commands/checkout-picker.d.ts.map +1 -0
  18. package/dist/commands/checkout.d.ts +85 -0
  19. package/dist/commands/checkout.d.ts.map +1 -0
  20. package/dist/commands/config.d.ts +30 -0
  21. package/dist/commands/config.d.ts.map +1 -0
  22. package/dist/commands/configure.d.ts +13 -0
  23. package/dist/commands/configure.d.ts.map +1 -0
  24. package/dist/commands/gitCredential.d.ts +21 -0
  25. package/dist/commands/gitCredential.d.ts.map +1 -0
  26. package/dist/commands/index.d.ts +13 -0
  27. package/dist/commands/index.d.ts.map +1 -0
  28. package/dist/commands/login.d.ts +3 -0
  29. package/dist/commands/login.d.ts.map +1 -0
  30. package/dist/commands/logout.d.ts +5 -0
  31. package/dist/commands/logout.d.ts.map +1 -0
  32. package/dist/commands/version.d.ts +10 -0
  33. package/dist/commands/version.d.ts.map +1 -0
  34. package/dist/commands/watch.d.ts +99 -0
  35. package/dist/commands/watch.d.ts.map +1 -0
  36. package/dist/config.d.ts +56 -0
  37. package/dist/config.d.ts.map +1 -0
  38. package/dist/errors.d.ts +151 -0
  39. package/dist/errors.d.ts.map +1 -0
  40. package/dist/globalConfig.d.ts +23 -0
  41. package/dist/globalConfig.d.ts.map +1 -0
  42. package/dist/index.js +41657 -17604
  43. package/dist/logger.d.ts +67 -0
  44. package/dist/logger.d.ts.map +1 -0
  45. package/dist/oauthHtml.d.ts +3 -0
  46. package/dist/oauthHtml.d.ts.map +1 -0
  47. package/dist/program.d.ts +5 -0
  48. package/dist/program.d.ts.map +1 -0
  49. package/dist/services/anvil-api.d.ts +124 -0
  50. package/dist/services/anvil-api.d.ts.map +1 -0
  51. package/dist/services/auth.d.ts +69 -0
  52. package/dist/services/auth.d.ts.map +1 -0
  53. package/dist/services/git-auth.d.ts +19 -0
  54. package/dist/services/git-auth.d.ts.map +1 -0
  55. package/dist/services/git.d.ts +174 -0
  56. package/dist/services/git.d.ts.map +1 -0
  57. package/dist/services/index.d.ts +9 -0
  58. package/dist/services/index.d.ts.map +1 -0
  59. package/dist/services/keychain.d.ts +9 -0
  60. package/dist/services/keychain.d.ts.map +1 -0
  61. package/dist/services/oauth-login.d.ts +46 -0
  62. package/dist/services/oauth-login.d.ts.map +1 -0
  63. package/dist/services/path-open.d.ts +8 -0
  64. package/dist/services/path-open.d.ts.map +1 -0
  65. package/dist/services/token-store.d.ts +37 -0
  66. package/dist/services/token-store.d.ts.map +1 -0
  67. package/dist/services/validation.d.ts +23 -0
  68. package/dist/services/validation.d.ts.map +1 -0
  69. package/dist/utils.d.ts +34 -0
  70. package/dist/utils.d.ts.map +1 -0
  71. package/dist/validators.d.ts +9 -0
  72. package/dist/validators.d.ts.map +1 -0
  73. package/dist/watch/ConflictResolver.d.ts +54 -0
  74. package/dist/watch/ConflictResolver.d.ts.map +1 -0
  75. package/dist/watch/FileWatcher.d.ts +68 -0
  76. package/dist/watch/FileWatcher.d.ts.map +1 -0
  77. package/dist/watch/SaveProcessor.d.ts +97 -0
  78. package/dist/watch/SaveProcessor.d.ts.map +1 -0
  79. package/dist/watch/SyncManager.d.ts +49 -0
  80. package/dist/watch/SyncManager.d.ts.map +1 -0
  81. package/dist/watch/WebSocketClient.d.ts +98 -0
  82. package/dist/watch/WebSocketClient.d.ts.map +1 -0
  83. package/dist/watch/index.d.ts +33 -0
  84. package/dist/watch/index.d.ts.map +1 -0
  85. package/package.json +15 -2
  86. package/scripts/install/install.sh +4 -2
@@ -0,0 +1,67 @@
1
+ type InquirerAnswers = Record<string, any>;
2
+ type InquirerQuestionCollection<T> = any;
3
+ export type LogLevel = "debug" | "verbose" | "info" | "warn" | "error";
4
+ /** JSON log entry structure for NDJSON output */
5
+ export interface JsonLogEntry {
6
+ type: "log";
7
+ level: LogLevel;
8
+ message: string;
9
+ timestamp: string;
10
+ }
11
+ /** JSON progress entry structure */
12
+ export interface JsonProgressEntry {
13
+ type: "progress";
14
+ key: string;
15
+ status: "start" | "update" | "end";
16
+ message: string;
17
+ timestamp: string;
18
+ }
19
+ /** JSON result entry structure */
20
+ export interface JsonResultEntry {
21
+ type: "result";
22
+ success: boolean;
23
+ message?: string;
24
+ data?: unknown;
25
+ error?: string;
26
+ timestamp: string;
27
+ }
28
+ /** Get human-readable timestamp with timezone for verbose logging */
29
+ export declare const verboseTimestamp: () => string;
30
+ /**
31
+ * Output a result in JSON mode.
32
+ */
33
+ export declare function logJsonResult(success: boolean, options?: {
34
+ message?: string;
35
+ data?: unknown;
36
+ error?: string;
37
+ }): void;
38
+ /**
39
+ * Logger interface for centralized logging throughout the application.
40
+ * CLI can provide a custom implementation with spinners, pause/resume, etc.
41
+ */
42
+ export interface Logger {
43
+ debug(...args: any[]): void;
44
+ verbose(...args: any[]): void;
45
+ info(...args: any[]): void;
46
+ warn(...args: any[]): void;
47
+ error(...args: any[]): void;
48
+ success(message: string): void;
49
+ progress(key: string, message: string): void;
50
+ progressUpdate(key: string, message: string): void;
51
+ progressEnd(key: string, message?: string): void;
52
+ pause(): void;
53
+ resume(): void;
54
+ prompt<T extends InquirerAnswers>(questions: InquirerQuestionCollection<T>): Promise<T>;
55
+ confirm(message: string, defaultValue?: boolean): Promise<boolean>;
56
+ select<T>(message: string, choices: Array<{
57
+ name: string;
58
+ value: T;
59
+ }>, defaultValue?: T): Promise<T>;
60
+ }
61
+ export declare let logger: Logger;
62
+ /**
63
+ * Set a custom logger implementation (e.g., CLILogger with spinners)
64
+ */
65
+ export declare function setLogger(newLogger: Logger): void;
66
+ export {};
67
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAKA,KAAK,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAC3C,KAAK,0BAA0B,CAAC,CAAC,IAAI,GAAG,CAAC;AAEzC,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAMvE,iDAAiD;AACjD,MAAM,WAAW,YAAY;IACzB,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE,QAAQ,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,oCAAoC;AACpC,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,UAAU,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,kCAAkC;AAClC,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACrB;AAOD,qEAAqE;AACrE,eAAO,MAAM,g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,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,CAAC,CAAA;KAAE,CAAC,EAAE,YAAY,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CACxG;AAoJD,eAAO,IAAI,MAAM,EAAE,MAA4B,CAAC;AAEhD;;GAEG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAEjD"}
@@ -0,0 +1,3 @@
1
+ export declare const successPage = "<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <title>Anvil Sync \u2022 Login Complete</title>\n <link rel=\"preconnect\" href=\"https://fonts.googleapis.com\">\n <link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin>\n <link href=\"https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap\" rel=\"stylesheet\">\n <style>\n * { box-sizing: border-box; }\n html, body { height: 100%; margin: 0; }\n body {\n font-family: Poppins, -apple-system, system-ui, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif;\n color: #555555;\n background: #f7fdff;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 20px;\n }\n .card {\n width: min(480px, 100%);\n background: #ffffff;\n border-radius: 12px;\n padding: 48px 40px;\n text-align: center;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);\n }\n .icon {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 56px;\n height: 56px;\n margin: 0 auto 24px;\n border-radius: 50%;\n background: #1bb0ee;\n color: white;\n }\n .icon svg {\n width: 28px;\n height: 28px;\n }\n h1 {\n font-size: 24px;\n font-weight: 600;\n line-height: 1.3;\n margin: 0 0 12px;\n color: #1a1a1a;\n }\n p {\n color: #555555;\n font-size: 15px;\n line-height: 1.5;\n margin: 0;\n }\n </style>\n </head>\n <body>\n <main class=\"card\" role=\"status\" aria-live=\"polite\">\n <div class=\"icon\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M20 7L9 18l-5-5\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </div>\n <h1>Anvil login complete</h1>\n <p>Close this window and return to your terminal to continue.</p>\n </main>\n </body>\n </html>";
2
+ export declare function errorPage(errorMsg: string): string;
3
+ //# sourceMappingURL=oauthHtml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauthHtml.d.ts","sourceRoot":"","sources":["../src/oauthHtml.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,o4EAsEd,CAAC;AAEX,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,UAqFzC"}
@@ -0,0 +1,5 @@
1
+ import { Command } from "commander";
2
+ export declare function getUpdateInstructions(platform: NodeJS.Platform): string[];
3
+ export declare function handleUpdateCommand(): Promise<void>;
4
+ export declare function buildProgram(): Command;
5
+ //# sourceMappingURL=program.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkDpC,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,GAAG,MAAM,EAAE,CAezE;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAwFzD;AAiBD,wBAAgB,YAAY,IAAI,OAAO,CAsEtC"}
@@ -0,0 +1,124 @@
1
+ import { AppError, AuthError, NetworkError } from "../errors";
2
+ export interface ValidateAppIdResponse {
3
+ valid: boolean;
4
+ app_name?: string;
5
+ error?: string;
6
+ }
7
+ export interface LookupByCommitResponse {
8
+ apps?: Array<{
9
+ app_id: string;
10
+ app_name?: string;
11
+ branch?: string;
12
+ branches?: string[];
13
+ }>;
14
+ }
15
+ export interface CheckoutAppListItem {
16
+ app_id: string;
17
+ app_name: string;
18
+ last_edited: string | null;
19
+ }
20
+ export interface ListAppsResponse {
21
+ apps: CheckoutAppListItem[];
22
+ next_cursor: string | null;
23
+ }
24
+ export interface SaveRequestPayload {
25
+ edit_session: string;
26
+ save_sequence: number;
27
+ version: string;
28
+ updates: Array<[any[], any]>;
29
+ }
30
+ export interface SaveResponse {
31
+ version?: string;
32
+ overtaken?: boolean;
33
+ latest_version?: string;
34
+ error?: string;
35
+ }
36
+ export type ApiError = AuthError | AppError | NetworkError;
37
+ /**
38
+ * Validate an app ID with the Anvil server.
39
+ * @throws {ApiError} if validation fails
40
+ */
41
+ export declare function validateAppId(appId: string, anvilUrl?: string, username?: string): Promise<ValidateAppIdResponse>;
42
+ /**
43
+ * Lookup apps by commit ID and branch name.
44
+ * @throws {ApiError} if lookup fails
45
+ */
46
+ export declare function lookupByCommit(commitId: string, branchName: string, anvilUrl?: string, username?: string): Promise<LookupByCommitResponse>;
47
+ export declare function listAppsForCheckout(options?: {
48
+ anvilUrl?: string;
49
+ username?: string;
50
+ limit?: number;
51
+ cursor?: string;
52
+ q?: string;
53
+ signal?: AbortSignal;
54
+ }): Promise<ListAppsResponse>;
55
+ /**
56
+ * Send save updates to Anvil.
57
+ * @throws {ApiError} if save fails with auth error
58
+ */
59
+ export declare function saveUpdates(appId: string, branchName: string, payload: SaveRequestPayload, anvilUrl: string | undefined, authToken: string): Promise<SaveResponse>;
60
+ /**
61
+ * Get the git URL for fetching from Anvil.
62
+ */
63
+ export declare function getGitFetchUrl(appId: string, authToken: string, anvilUrl?: string): string;
64
+ /**
65
+ * Get the git URL for pushing to Anvil (no query params).
66
+ */
67
+ export declare function getGitPushUrl(appId: string, authToken: string, anvilUrl?: string): string;
68
+ /**
69
+ * Get the WebSocket URL for real-time updates.
70
+ */
71
+ export declare function getWebSocketUrl(appId: string, authToken: string, anvilUrl?: string): string;
72
+ /**
73
+ * Check for CLI updates from npm registry.
74
+ */
75
+ export declare function getLatestVersion(): Promise<string | null>;
76
+ export interface AppIdCandidate {
77
+ appId: string;
78
+ source: "remote" | "config";
79
+ description: string;
80
+ }
81
+ /** Extended candidate with URL and username context from git remotes */
82
+ export interface AppIdWithContext extends AppIdCandidate {
83
+ detectedUrl?: string;
84
+ detectedUsername?: string;
85
+ }
86
+ /**
87
+ * Filter candidates by explicit --url and --user flags.
88
+ * --url: keep only candidates whose detectedUrl matches (after normalization).
89
+ * --user: keep only candidates whose detectedUsername matches, or those with no detectedUsername.
90
+ */
91
+ export declare function filterCandidates(candidates: AppIdWithContext[], explicitUrl?: string, explicitUsername?: string): AppIdWithContext[];
92
+ /**
93
+ * Build a human-readable label for an app ID candidate in the selection list.
94
+ * Examples:
95
+ * "APPID123 (user@biz.com on anvil.works) - remote 'origin'"
96
+ * "APPID456 (anvil.works) - remote 'personal'"
97
+ * "APPID789 - Reverse lookup by commit"
98
+ */
99
+ export declare function formatCandidateLabel(candidate: AppIdWithContext): string;
100
+ /**
101
+ * Look up remote metadata (URL and username) for a given app ID from detected remotes.
102
+ * If multiple remotes match, prefers the one with a detectedUsername (SSH remote).
103
+ */
104
+ export declare function lookupRemoteInfoForAppId(appId: string, detectedRemotes: AppIdWithContext[]): {
105
+ detectedUrl?: string;
106
+ detectedUsername?: string;
107
+ };
108
+ export type DetectAppIdsOptions = {
109
+ includeReverseLookup?: boolean;
110
+ includeRemotes?: boolean;
111
+ anvilUrl?: string;
112
+ username?: string;
113
+ };
114
+ /**
115
+ * Detect app IDs from all git remotes regardless of Anvil URL.
116
+ * Returns extended information including detected URL and username.
117
+ */
118
+ export declare function detectAppIdsFromAllRemotes(repoPath: string): Promise<AppIdWithContext[]>;
119
+ /**
120
+ * Detect app IDs by reverse lookup with Anvil server.
121
+ * Strategy 3: Ask the Anvil IDE API to reverse-lookup by commit and branch.
122
+ */
123
+ export declare function detectAppIdsByCommitLookup(repoPath: string, options: DetectAppIdsOptions): Promise<AppIdCandidate[]>;
124
+ //# sourceMappingURL=anvil-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anvil-api.d.ts","sourceRoot":"","sources":["../../src/services/anvil-api.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAuD,MAAM,WAAW,CAAC;AAUnH,MAAM,WAAW,qBAAqB;IAClC,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;IACnC,IAAI,CAAC,EAAE,KAAK,CAAC;QACT,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;KACvB,CAAC,CAAC;CACN;AAED,MAAM,WAAW,mBAAmB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,mBAAmB,EAAE,CAAC;IAC5B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,kBAAkB;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,YAAY;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM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 -0,0 +1,69 @@
1
+ import { AccountTokens } from "./token-store";
2
+ /** Token data returned from OAuth token endpoint */
3
+ export interface TokenData {
4
+ access_token: string;
5
+ refresh_token: string;
6
+ expires_in: number;
7
+ token_type: string;
8
+ scope: string;
9
+ }
10
+ /** Stored token data for an account (re-export for convenience) */
11
+ export type { AccountTokens as StoredTokens };
12
+ /** Result of login */
13
+ export interface LoginResult {
14
+ success: boolean;
15
+ email: string;
16
+ }
17
+ /** Result of logout */
18
+ export interface LogoutResult {
19
+ loggedOut: boolean;
20
+ message?: string;
21
+ }
22
+ /**
23
+ * Verify an auth token is valid by calling the IDE API.
24
+ * Returns the user's email on success.
25
+ * @throws {AuthError} if token is invalid or network error occurs
26
+ */
27
+ export declare function verifyAuth(authToken: string, anvilUrl?: string): Promise<string>;
28
+ /**
29
+ * Refresh the access token using a refresh token.
30
+ * @throws {AuthError} if refresh fails
31
+ */
32
+ export declare function refreshAccessToken(refreshToken: string, anvilUrl?: string): Promise<TokenData>;
33
+ /**
34
+ * Get tokens for a specific Anvil URL and username.
35
+ * If no username is provided and only one account exists, returns that account's tokens.
36
+ */
37
+ export declare function getTokensForUrl(anvilUrl: string, username?: string): AccountTokens;
38
+ /**
39
+ * Check if we have tokens for a specific URL and username.
40
+ */
41
+ export declare function hasTokensForUrl(anvilUrl: string, username?: string): boolean;
42
+ /**
43
+ * Get a valid access token, refreshing it if necessary.
44
+ * @throws {AuthError} if no valid token can be obtained
45
+ */
46
+ export declare function getValidAuthToken(anvilUrl?: string, username?: string): Promise<string>;
47
+ /**
48
+ * Log in with token data from OAuth flow.
49
+ * @throws {AuthError} if verification fails
50
+ */
51
+ export declare function login(anvilUrl: string, tokenData: {
52
+ access_token: string;
53
+ refresh_token: string;
54
+ expires_in: number;
55
+ scope?: string;
56
+ }): Promise<LoginResult>;
57
+ /**
58
+ * Log out from Anvil (optionally from a specific URL and/or username).
59
+ */
60
+ export declare function logout(anvilUrl?: string, username?: string): Promise<LogoutResult>;
61
+ /**
62
+ * Get all usernames (accounts) that have authentication tokens for a specific URL.
63
+ */
64
+ export declare function getAccountsForUrl(url: string): string[];
65
+ /**
66
+ * Get all available Anvil URLs that have authentication tokens.
67
+ */
68
+ export declare function getAvailableAnvilUrls(): string[];
69
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/services/auth.ts"],"names":[],"mappings":"AAMA,OAAO,EACH,aAAa,EAWhB,MAAM,eAAe,CAAC;AAUvB,oDAAoD;AACpD,MAAM,WAAW,SAAS;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,mEAAmE;AACnE,YAAY,EAAE,aAAa,IAAI,YAAY,EAAE,CAAC;AAE9C,sBAAsB;AACtB,MAAM,WAAW,WAAW;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,uBAAuB;AACvB,MAAM,WAAW,YAAY;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAMD;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,SAAuB,GAAG,OAAO,CAAC,MAAM,CAAC,CAqBpG;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,SAAuB,GAAG,OAAO,CAAC,SAAS,CAAC,CA2BlH;AAMD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,aAAa,CAElF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAE5E;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,QAAQ,SAAuB,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAuD3G;AAsBD;;;GAGG;AACH,wBAAsB,KAAK,CACvB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAC/F,OAAO,CAAC,WAAW,CAAC,CActB;AAED;;GAEG;AACH,wBAAsB,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CA4BxF;AAMD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAEvD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,EAAE,CAEhD"}
@@ -0,0 +1,19 @@
1
+ export interface AppAuthBinding {
2
+ url?: string;
3
+ username?: string;
4
+ }
5
+ export declare function getAppAuthBinding(repoPath: string, appId: string): Promise<AppAuthBinding>;
6
+ export declare function setAppAuthBinding(repoPath: string, appId: string, binding: AppAuthBinding): Promise<void>;
7
+ export declare function getCleanGitRemoteUrl(appId: string, anvilUrl: string): string;
8
+ export declare function configureCredentialHelperForUrl(repoPath: string, anvilUrl: string): Promise<void>;
9
+ export declare function hardenCheckoutGitAuth(options: {
10
+ repoPath: string;
11
+ appId: string;
12
+ anvilUrl: string;
13
+ username: string;
14
+ remoteName?: string;
15
+ }): Promise<{
16
+ cleanRemoteUrl: string;
17
+ }>;
18
+ export declare function parseAppIdFromGitPath(pathValue?: string): string | undefined;
19
+ //# sourceMappingURL=git-auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-auth.d.ts","sourceRoot":"","sources":["../../src/services/git-auth.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,cAAc;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAmBD,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAUhG;AAED,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ/G;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAI5E;AAED,wBAAsB,+BAA+B,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAuBvG;AAED,wBAAsB,qBAAqB,CAAC,OAAO,EAAE;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC;IAAE,cAAc,EAAE,MAAM,CAAA;CAAE,CAAC,CAiBtC;AAED,wBAAgB,qBAAqB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAK5E"}
@@ -0,0 +1,174 @@
1
+ import { SimpleGit } from "simple-git";
2
+ export interface GitStatus {
3
+ isClean: boolean;
4
+ modified: string[];
5
+ notAdded: string[];
6
+ created: string[];
7
+ deleted: string[];
8
+ staged: string[];
9
+ renamed: Array<{
10
+ from: string;
11
+ to: string;
12
+ }>;
13
+ }
14
+ export interface BranchSyncStatus {
15
+ behind: number;
16
+ ahead: number;
17
+ upstreamRef?: string;
18
+ diverged: boolean;
19
+ branchMissing?: boolean;
20
+ }
21
+ export interface CommitInfo {
22
+ hash: string;
23
+ shortHash: string;
24
+ message: string;
25
+ }
26
+ /**
27
+ * Git service class wrapping simple-git with typed methods.
28
+ */
29
+ export declare class GitService {
30
+ private git;
31
+ private repoPath;
32
+ constructor(repoPath: string);
33
+ /**
34
+ * Get the underlying SimpleGit instance for advanced operations.
35
+ */
36
+ getGit(): SimpleGit;
37
+ /**
38
+ * Get the repository path.
39
+ */
40
+ getRepoPath(): string;
41
+ /**
42
+ * Get the actual git directory path.
43
+ * Handles worktrees where .git is a file pointing elsewhere.
44
+ */
45
+ getGitDir(): Promise<string>;
46
+ /**
47
+ * Get the current branch name.
48
+ * @throws {SyncError} if in detached HEAD state
49
+ */
50
+ getCurrentBranch(): Promise<string>;
51
+ /**
52
+ * Get the current commit ID (full hash).
53
+ * @throws {GitError} if git command fails
54
+ */
55
+ getCommitId(): Promise<string>;
56
+ /**
57
+ * Get information about the current commit.
58
+ * @throws {GitError} if git command fails
59
+ */
60
+ getCommitInfo(): Promise<CommitInfo>;
61
+ /**
62
+ * Get the git status.
63
+ * @throws {GitError} if git command fails
64
+ */
65
+ getStatus(): Promise<GitStatus>;
66
+ /**
67
+ * Check for uncommitted changes.
68
+ * @throws {GitError} if git command fails
69
+ */
70
+ hasUncommittedChanges(): Promise<boolean>;
71
+ /**
72
+ * Fetch from a remote URL to a local ref.
73
+ * @throws {GitError} if fetch fails
74
+ */
75
+ fetch(url: string, refSpec: string): Promise<void>;
76
+ /**
77
+ * Reset to a ref (mixed reset by default).
78
+ * @throws {GitError} if git command fails
79
+ */
80
+ reset(ref: string, mode?: "soft" | "mixed" | "hard"): Promise<void>;
81
+ /**
82
+ * Checkout files or branches.
83
+ * @throws {GitError} if git command fails
84
+ */
85
+ checkout(paths: string[]): Promise<void>;
86
+ /**
87
+ * Stash uncommitted changes (including untracked files).
88
+ * Returns true if anything was stashed, false if working tree was clean.
89
+ * @throws {GitError} if git command fails
90
+ */
91
+ stash(message?: string): Promise<boolean>;
92
+ /**
93
+ * Pop the most recent stash.
94
+ * @throws {GitError} if pop fails (e.g. conflicts)
95
+ */
96
+ stashPop(): Promise<void>;
97
+ /**
98
+ * Clean untracked files.
99
+ * @throws {GitError} if git command fails
100
+ */
101
+ clean(files: string[]): Promise<void>;
102
+ /**
103
+ * Get diff between two commits (file names only).
104
+ * @throws {GitError} if git command fails
105
+ */
106
+ diffNames(fromCommit: string, toCommit: string): Promise<string[]>;
107
+ /**
108
+ * Get ahead/behind count between local and remote refs.
109
+ * @throws {GitError} if git command fails
110
+ */
111
+ getAheadBehind(localRef: string, remoteRef: string): Promise<{
112
+ ahead: number;
113
+ behind: number;
114
+ }>;
115
+ /**
116
+ * Get the content of a file at a specific ref.
117
+ * @throws {GitError} if git command fails
118
+ */
119
+ show(refPath: string): Promise<string>;
120
+ /**
121
+ * Push to a remote URL.
122
+ * @throws {GitError} if push fails
123
+ */
124
+ push(url: string, refSpec: string, force?: boolean): Promise<void>;
125
+ /**
126
+ * Rebase the current branch onto a ref.
127
+ * @throws {GitError} if rebase fails (e.g. conflicts)
128
+ */
129
+ rebase(onto: string): Promise<void>;
130
+ /**
131
+ * Abort an in-progress rebase.
132
+ * @throws {GitError} if abort fails
133
+ */
134
+ rebaseAbort(): Promise<void>;
135
+ /**
136
+ * Delete a local ref.
137
+ * Does not throw if ref doesn't exist.
138
+ */
139
+ deleteRef(ref: string): Promise<void>;
140
+ /**
141
+ * Get git remotes with their URLs.
142
+ * @throws {GitError} if git command fails
143
+ */
144
+ getRemotes(): Promise<Array<{
145
+ name: string;
146
+ fetchUrl?: string;
147
+ }>>;
148
+ /**
149
+ * Check if git is initialized in the repository.
150
+ */
151
+ isGitInitialized(): Promise<boolean>;
152
+ /**
153
+ * Remove empty directories after file deletion.
154
+ */
155
+ removeEmptyDirectories(removedFiles: string[]): Promise<void>;
156
+ }
157
+ /**
158
+ * Staged file change with type info.
159
+ */
160
+ export interface StagedFileChange {
161
+ path: string;
162
+ type: "change" | "add" | "unlink" | "rename";
163
+ from?: string;
164
+ }
165
+ /**
166
+ * Get detailed staged changes with type info.
167
+ * @throws {GitError} if git command fails
168
+ */
169
+ export declare function getStagedFileChanges(git: SimpleGit): Promise<StagedFileChange[]>;
170
+ /**
171
+ * Create a GitService instance for a repository path.
172
+ */
173
+ export declare function createGitService(repoPath: string): GitService;
174
+ //# sourceMappingURL=git.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/services/git.ts"],"names":[],"mappings":"AAOA,OAAkB,EAAgB,SAAS,EAAE,MAAM,YAAY,CAAC;AAGhE,MAAM,WAAW,SAAS;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAChD;AAED,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,qBAAa,UAAU;IACnB,OAAO,CAAC,GAAG,CAAY;IACvB,OAAO,CAAC,QAAQ,CAAS;gBAEb,QAAQ,EAAE,MAAM;IAK5B;;OAEG;IACH,MAAM,IAAI,SAAS;IAInB;;OAEG;IACH,WAAW,IAAI,MAA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AAG,OAAO,CAAC,MAAM,CAAC;IAS5C;;;OAGG;IACG,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAStE;;;OAGG;IACG,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQzC;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAQlC;;;OAGG;IACG,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ3C;;;OAGG;IACG,UAAU,IAAI,OAAO,CAAC,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAYvE;;OAEG;IACG,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC;IAK1C;;OAEG;IACG,sBAAsB,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CA+BtE;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CA0CtF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAE7D"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Services module index.
3
+ * Re-exports all service functions for convenient importing.
4
+ */
5
+ export * from "./auth";
6
+ export * from "./git";
7
+ export * from "./anvil-api";
8
+ export * from "./validation";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,9 @@
1
+ interface KeychainSecrets {
2
+ authToken: string | null;
3
+ refreshToken: string | null;
4
+ }
5
+ export declare function keychainGet(url: string, username: string): KeychainSecrets | null;
6
+ export declare function keychainSet(url: string, username: string, secrets: KeychainSecrets): boolean;
7
+ export declare function keychainDelete(url: string, username: string): void;
8
+ export {};
9
+ //# sourceMappingURL=keychain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keychain.d.ts","sourceRoot":"","sources":["../../src/services/keychain.ts"],"names":[],"mappings":"AAMA,UAAU,eAAe;IACrB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAwBD,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAejF;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAW5F;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAUlE"}
@@ -0,0 +1,46 @@
1
+ import { LoginResult } from "./auth";
2
+ /**
3
+ * OAuth token payload returned by the Anvil OAuth server.
4
+ * This is suitable for handing directly to `login()` if you are running a
5
+ * custom OAuth flow outside the built-in interactive helper.
6
+ */
7
+ export interface OAuthTokenResponse {
8
+ access_token: string;
9
+ refresh_token: string;
10
+ expires_in: number;
11
+ token_type: string;
12
+ scope: string;
13
+ }
14
+ /**
15
+ * OAuth device authorization details returned by the Anvil OAuth server.
16
+ * Use this to render a device-code UX in an external client, then pass the
17
+ * response into `pollDeviceAuthorization()` until the user approves access.
18
+ */
19
+ export interface DeviceAuthorizationResponse {
20
+ device_code: string;
21
+ user_code: string;
22
+ verification_uri: string;
23
+ verification_uri_complete?: string;
24
+ expires_in: number;
25
+ interval?: number;
26
+ }
27
+ /**
28
+ * Start an OAuth device-code login flow against the specified Anvil server.
29
+ * Returns the verification URL and user code that should be shown to the user.
30
+ */
31
+ export declare function requestDeviceAuthorization(anvilUrl: string): Promise<DeviceAuthorizationResponse>;
32
+ /**
33
+ * Poll an OAuth device-code login flow until the user approves access.
34
+ * Throws when the flow is denied, expires, or is cancelled by the caller.
35
+ */
36
+ export declare function pollDeviceAuthorization(anvilUrl: string, deviceAuth: DeviceAuthorizationResponse, options?: {
37
+ isCancelled?: () => boolean;
38
+ }): Promise<OAuthTokenResponse>;
39
+ /**
40
+ * Run the default Anvil interactive login flow.
41
+ * Starts localhost PKCE login and a device-code fallback in parallel, then uses
42
+ * whichever completes first. On success, this also persists the resulting tokens
43
+ * via `login()` and returns the logged-in account email.
44
+ */
45
+ export declare function runInteractiveLoginFlow(anvilUrl: string): Promise<LoginResult>;
46
+ //# sourceMappingURL=oauth-login.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-login.d.ts","sourceRoot":"","sources":["../../src/services/oauth-login.ts"],"names":[],"mappings":"AAOA,OAAO,EAAS,WAAW,EAAE,MAAM,QAAQ,CAAC;AAK5C;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAyGD;;;GAGG;AACH,wBAAsB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAiBvG;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CACzC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,2BAA2B,EACvC,OAAO,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,OAAO,CAAA;CAAE,GAC1C,OAAO,CAAC,kBAAkB,CAAC,CA8C7B;AAuHD;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CA+CpF"}
@@ -0,0 +1,8 @@
1
+ export interface OpenPathDeps {
2
+ openSystem: (path: string) => Promise<unknown>;
3
+ isCommandAvailable: (command: string) => boolean;
4
+ spawnShellCommand: (commandLine: string) => Promise<void>;
5
+ }
6
+ export declare function parseCommandTokens(command: string): string[];
7
+ export declare function openPathInEditorOrDefault(targetPath: string, preferredEditorCommand?: string, deps?: OpenPathDeps): Promise<void>;
8
+ //# sourceMappingURL=path-open.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-open.d.ts","sourceRoot":"","sources":["../../src/services/path-open.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,YAAY;IACzB,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/C,kBAAkB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;IACjD,iBAAiB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7D;AAuBD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CA6D5D;AA6BD,wBAAsB,yBAAyB,CAC3C,UAAU,EAAE,MAAM,EAClB,sBAAsB,CAAC,EAAE,MAAM,EAC/B,IAAI,GAAE,YAA0B,GACjC,OAAO,CAAC,IAAI,CAAC,CAoBf"}
@@ -0,0 +1,37 @@
1
+ /** Tokens stored for a single account */
2
+ export interface AccountTokens {
3
+ authToken: string | null;
4
+ refreshToken: string | null;
5
+ authTokenExpiresAt: number | null;
6
+ }
7
+ /** Map of username to their tokens for a single URL */
8
+ export type UrlTokens = Record<string, AccountTokens>;
9
+ /** The complete token store: URL -> username -> tokens */
10
+ export type TokenStore = Record<string, UrlTokens>;
11
+ /** Get the entire token store, validated and typed */
12
+ export declare function getTokenStore(): TokenStore;
13
+ /** Save the entire token store */
14
+ export declare function setTokenStore(store: TokenStore): void;
15
+ /** Get tokens for a specific URL (all accounts) */
16
+ export declare function getUrlTokens(url: string): UrlTokens | undefined;
17
+ /** Get tokens for a specific account */
18
+ export declare function getAccountTokens(url: string, username: string): AccountTokens;
19
+ /** Get tokens for a URL, auto-selecting if only one account exists */
20
+ export declare function getTokensAutoSelect(url: string, username?: string): AccountTokens;
21
+ /** Set tokens for a specific account */
22
+ export declare function setAccountTokens(url: string, username: string, tokens: AccountTokens): void;
23
+ /** Delete tokens for a specific account */
24
+ export declare function deleteAccountTokens(url: string, username: string): boolean;
25
+ /** Delete all tokens for a URL */
26
+ export declare function deleteUrlTokens(url: string): boolean;
27
+ /** Find account by refresh token */
28
+ export declare function findAccountByRefreshToken(url: string, refreshToken: string): string | undefined;
29
+ /** Get all usernames for a URL that have valid tokens */
30
+ export declare function getAccountsForUrl(url: string): string[];
31
+ /** Get all URLs that have valid tokens */
32
+ export declare function getAvailableUrls(): string[];
33
+ /** Check if tokens exist for a URL/account */
34
+ export declare function hasTokens(url: string, username?: string): boolean;
35
+ /** Clear all tokens */
36
+ export declare function clearAllTokens(): void;
37
+ //# sourceMappingURL=token-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-store.d.ts","sourceRoot":"","sources":["../../src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