latchkey 2.4.3 → 2.5.1
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/README.md +5 -0
- package/dist/src/cli.js +0 -0
- package/dist/src/skillMd.js +2 -2
- package/dist/src/skillMd.js.map +1 -1
- package/package.json +7 -3
- package/dist/package.json +0 -67
- package/dist/scripts/encryptFile.d.ts +0 -21
- package/dist/scripts/encryptFile.d.ts.map +0 -1
- package/dist/scripts/encryptFile.js +0 -101
- package/dist/scripts/encryptFile.js.map +0 -1
- package/dist/src/browserState.d.ts +0 -8
- package/dist/src/browserState.d.ts.map +0 -1
- package/dist/src/browserState.js +0 -21
- package/dist/src/browserState.js.map +0 -1
- package/dist/src/latestVersionCheck.d.ts +0 -10
- package/dist/src/latestVersionCheck.d.ts.map +0 -1
- package/dist/src/latestVersionCheck.js +0 -42
- package/dist/src/latestVersionCheck.js.map +0 -1
- package/dist/src/registeredService.d.ts +0 -20
- package/dist/src/registeredService.d.ts.map +0 -1
- package/dist/src/registeredService.js +0 -34
- package/dist/src/registeredService.js.map +0 -1
- package/dist/src/registeredServiceStore.d.ts +0 -24
- package/dist/src/registeredServiceStore.d.ts.map +0 -1
- package/dist/src/registeredServiceStore.js +0 -70
- package/dist/src/registeredServiceStore.js.map +0 -1
- package/dist/src/services/base.d.ts +0 -141
- package/dist/src/services/base.d.ts.map +0 -1
- package/dist/src/services/base.js +0 -189
- package/dist/src/services/base.js.map +0 -1
- package/dist/src/services/google/maps.d.ts +0 -39
- package/dist/src/services/google/maps.d.ts.map +0 -1
- package/dist/src/services/google/maps.js +0 -94
- package/dist/src/services/google/maps.js.map +0 -1
- package/dist/src/services/google.d.ts +0 -34
- package/dist/src/services/google.d.ts.map +0 -1
- package/dist/src/services/google.js +0 -336
- package/dist/src/services/google.js.map +0 -1
- package/dist/src/services/googleAnalytics.d.ts +0 -11
- package/dist/src/services/googleAnalytics.d.ts.map +0 -1
- package/dist/src/services/googleAnalytics.js +0 -18
- package/dist/src/services/googleAnalytics.js.map +0 -1
- package/dist/src/services/googleMaps.d.ts +0 -12
- package/dist/src/services/googleMaps.d.ts.map +0 -1
- package/dist/src/services/googleMaps.js +0 -17
- package/dist/src/services/googleMaps.js.map +0 -1
- package/dist/tests/latestVersionCheck.test.d.ts +0 -2
- package/dist/tests/latestVersionCheck.test.d.ts.map +0 -1
- package/dist/tests/latestVersionCheck.test.js +0 -80
- package/dist/tests/latestVersionCheck.test.js.map +0 -1
- /package/dist/{integrations → skills/generic/latchkey}/SKILL.md +0 -0
- /package/dist/{integrations/openclaw → skills/openclaw/latchkey}/SKILL.md +0 -0
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base classes and interfaces for service implementations.
|
|
3
|
-
*/
|
|
4
|
-
import type { Browser, BrowserContext, Response } from 'playwright';
|
|
5
|
-
import { ApiCredentialStatus, ApiCredentials } from '../apiCredentials.js';
|
|
6
|
-
import { EncryptedStorage } from '../encryptedStorage.js';
|
|
7
|
-
import { type BrowserLaunchOptions } from '../playwrightUtils.js';
|
|
8
|
-
export declare class NoCurlCredentialsNotSupportedError extends Error {
|
|
9
|
-
constructor(serviceName: string);
|
|
10
|
-
}
|
|
11
|
-
export declare class LoginCancelledError extends Error {
|
|
12
|
-
constructor(message?: string);
|
|
13
|
-
}
|
|
14
|
-
export declare class LoginFailedError extends Error {
|
|
15
|
-
constructor(message?: string);
|
|
16
|
-
}
|
|
17
|
-
export declare function isBrowserClosedError(error: Error): boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Abstract base class for services that latchkey can authenticate with.
|
|
20
|
-
*/
|
|
21
|
-
export declare abstract class Service {
|
|
22
|
-
abstract readonly name: string;
|
|
23
|
-
abstract readonly displayName: string;
|
|
24
|
-
abstract readonly baseApiUrls: readonly (string | RegExp)[];
|
|
25
|
-
abstract readonly loginUrl: string;
|
|
26
|
-
/**
|
|
27
|
-
* Developer notes about this service for agents and users.
|
|
28
|
-
*/
|
|
29
|
-
abstract readonly info: string;
|
|
30
|
-
/**
|
|
31
|
-
* Return curl arguments for checking credentials (excluding auth headers).
|
|
32
|
-
*/
|
|
33
|
-
abstract readonly credentialCheckCurlArguments: readonly string[];
|
|
34
|
-
/**
|
|
35
|
-
* Check if the given API credentials are valid for this service.
|
|
36
|
-
*/
|
|
37
|
-
checkApiCredentials(apiCredentials: ApiCredentials): ApiCredentialStatus;
|
|
38
|
-
/**
|
|
39
|
-
* Return an example showing how to set credentials for this service via the CLI.
|
|
40
|
-
* The service name is passed as a parameter (not baked in) so the same example
|
|
41
|
-
* can be reused for aliased services in the future.
|
|
42
|
-
*/
|
|
43
|
-
abstract setCredentialsExample(serviceName: string): string;
|
|
44
|
-
/**
|
|
45
|
-
* Set credentials from arbitrary (non-curl) arguments.
|
|
46
|
-
* Services that support this should override to validate and return typed credentials.
|
|
47
|
-
*/
|
|
48
|
-
getCredentialsNoCurl(_arguments: readonly string[]): ApiCredentials;
|
|
49
|
-
/**
|
|
50
|
-
* Get a new session for the login flow.
|
|
51
|
-
* Services that don't support browser login should not implement this method.
|
|
52
|
-
*/
|
|
53
|
-
getSession?(): ServiceSession;
|
|
54
|
-
/**
|
|
55
|
-
* Optional method to refresh expired credentials.
|
|
56
|
-
* Services can implement this to refresh access tokens without user interaction.
|
|
57
|
-
* @param apiCredentials - The expired credentials
|
|
58
|
-
* @returns New credentials if refresh succeeded, null otherwise
|
|
59
|
-
*/
|
|
60
|
-
refreshCredentials?(apiCredentials: ApiCredentials): Promise<ApiCredentials | null>;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Base class for service sessions that handle browser-based interactions.
|
|
64
|
-
* This includes login, preparation steps, and any other browser automation.
|
|
65
|
-
*/
|
|
66
|
-
export declare abstract class ServiceSession {
|
|
67
|
-
readonly service: Service;
|
|
68
|
-
constructor(service: Service);
|
|
69
|
-
/**
|
|
70
|
-
* Handle a response during the headful login phase.
|
|
71
|
-
*/
|
|
72
|
-
abstract onResponse(response: Response): void;
|
|
73
|
-
/**
|
|
74
|
-
* Check if the login phase is complete.
|
|
75
|
-
*/
|
|
76
|
-
protected abstract isLoginComplete(): boolean;
|
|
77
|
-
/**
|
|
78
|
-
* Finalize credentials after the headful login phase.
|
|
79
|
-
* Receives the browser and context from the login phase, which are still open.
|
|
80
|
-
* @param browser - Browser instance
|
|
81
|
-
* @param context - Browser context
|
|
82
|
-
* @param oldCredentials - Optional existing credentials to reuse
|
|
83
|
-
*/
|
|
84
|
-
protected abstract finalizeCredentials(browser: Browser, context: BrowserContext, oldCredentials?: ApiCredentials): Promise<ApiCredentials | null>;
|
|
85
|
-
/**
|
|
86
|
-
* Wait until the browser login phase is complete.
|
|
87
|
-
*/
|
|
88
|
-
private waitForLoginComplete;
|
|
89
|
-
/**
|
|
90
|
-
* Optionally diagnose a timeout error that occurred during credential finalization.
|
|
91
|
-
*
|
|
92
|
-
* Services can override this to inspect the page state and return a more
|
|
93
|
-
* specific error (e.g., checking for permission denied messages).
|
|
94
|
-
* If this returns an error, it will be thrown instead of the generic
|
|
95
|
-
* LoginFailedError. If it returns null, the original timeout error message is used.
|
|
96
|
-
*/
|
|
97
|
-
protected diagnoseTimeoutError(_context: BrowserContext, _originalError: Error): Promise<Error | null>;
|
|
98
|
-
/**
|
|
99
|
-
* Optional preparation step before login.
|
|
100
|
-
* Services can override this to perform setup (e.g., creating OAuth clients).
|
|
101
|
-
*/
|
|
102
|
-
prepare?(encryptedStorage: EncryptedStorage, launchOptions?: BrowserLaunchOptions): Promise<ApiCredentials>;
|
|
103
|
-
/**
|
|
104
|
-
* Perform the login flow and return the extracted credentials.
|
|
105
|
-
* @param encryptedStorage - Storage for managing credentials
|
|
106
|
-
* @param launchOptions - Browser launch options
|
|
107
|
-
* @param oldCredentials - Optional existing credentials to reuse (e.g., client ID/secret)
|
|
108
|
-
*/
|
|
109
|
-
login(encryptedStorage: EncryptedStorage, launchOptions?: BrowserLaunchOptions, oldCredentials?: ApiCredentials): Promise<ApiCredentials>;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Simple service session where credentials are extracted by observing requests during login.
|
|
113
|
-
*/
|
|
114
|
-
export declare abstract class SimpleServiceSession extends ServiceSession {
|
|
115
|
-
protected apiCredentials: ApiCredentials | null;
|
|
116
|
-
/**
|
|
117
|
-
* Extract API credentials from a response during the headful login phase.
|
|
118
|
-
*/
|
|
119
|
-
protected abstract getApiCredentialsFromResponse(response: Response): Promise<ApiCredentials | null>;
|
|
120
|
-
onResponse(response: Response): void;
|
|
121
|
-
protected isLoginComplete(): boolean;
|
|
122
|
-
protected finalizeCredentials(_browser: Browser, _context: BrowserContext, _oldCredentials?: ApiCredentials): Promise<ApiCredentials | null>;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Service session that requires a browser followup to finalize credentials.
|
|
126
|
-
*
|
|
127
|
-
* The login phase captures login state. After login completes,
|
|
128
|
-
* the same browser session is reused to perform additional actions
|
|
129
|
-
* (e.g., navigating to settings and creating an API key).
|
|
130
|
-
*/
|
|
131
|
-
export declare abstract class BrowserFollowupServiceSession extends ServiceSession {
|
|
132
|
-
/**
|
|
133
|
-
* Perform actions in the browser to finalize and extract API credentials.
|
|
134
|
-
* This runs in the same browser session used for login.
|
|
135
|
-
* @param context - Browser context
|
|
136
|
-
* @param oldCredentials - Optional existing credentials to reuse
|
|
137
|
-
*/
|
|
138
|
-
protected abstract performBrowserFollowup(context: BrowserContext, oldCredentials?: ApiCredentials): Promise<ApiCredentials | null>;
|
|
139
|
-
protected finalizeCredentials(_browser: Browser, context: BrowserContext, oldCredentials?: ApiCredentials): Promise<ApiCredentials | null>;
|
|
140
|
-
}
|
|
141
|
-
//# sourceMappingURL=base.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/services/base.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAQ,QAAQ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OAAO;IAIpC,SAAS,CAAC,mBAAmB,CAC3B,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,cAAc,EACxB,eAAe,CAAC,EAAE,cAAc,GAC/B,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;CAGlC;AAED;;;;;;GAMG;AACH,8BAAsB,6BAA8B,SAAQ,cAAc;IACxE;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,CAAC,sBAAsB,CACvC,OAAO,EAAE,cAAc,EACvB,cAAc,CAAC,EAAE,cAAc,GAC9B,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;cAER,mBAAmB,CAC1C,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,cAAc,EACvB,cAAc,CAAC,EAAE,cAAc,GAC9B,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;CAIlC"}
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base classes and interfaces for service implementations.
|
|
3
|
-
*/
|
|
4
|
-
import { ApiCredentialStatus, ApiCredentialsUsageError, } from '../apiCredentials.js';
|
|
5
|
-
import { runCaptured } from '../curl.js';
|
|
6
|
-
import { showSpinnerPage, withTempBrowserContext, } from '../playwrightUtils.js';
|
|
7
|
-
export class NoCurlCredentialsNotSupportedError extends Error {
|
|
8
|
-
constructor(serviceName) {
|
|
9
|
-
super(`Service '${serviceName}' does not support set-nocurl credentials.`);
|
|
10
|
-
this.name = 'NoCurlCredentialsNotSupportedError';
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export class LoginCancelledError extends Error {
|
|
14
|
-
constructor(message = 'Login was cancelled because the browser was closed.') {
|
|
15
|
-
super(message);
|
|
16
|
-
this.name = 'LoginCancelledError';
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
export class LoginFailedError extends Error {
|
|
20
|
-
constructor(message = 'Login failed: no credentials were extracted.') {
|
|
21
|
-
super(message);
|
|
22
|
-
this.name = 'LoginFailedError';
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
export function isBrowserClosedError(error) {
|
|
26
|
-
const message = error.message.toLowerCase();
|
|
27
|
-
return (message.includes('target closed') ||
|
|
28
|
-
message.includes('browser closed') ||
|
|
29
|
-
message.includes('browser has been closed') ||
|
|
30
|
-
message.includes('context has been closed') ||
|
|
31
|
-
message.includes('page has been closed') ||
|
|
32
|
-
message.includes('net::err_aborted'));
|
|
33
|
-
}
|
|
34
|
-
function isTimeoutError(error) {
|
|
35
|
-
return error.name === 'TimeoutError';
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Abstract base class for services that latchkey can authenticate with.
|
|
39
|
-
*/
|
|
40
|
-
export class Service {
|
|
41
|
-
/**
|
|
42
|
-
* Check if the given API credentials are valid for this service.
|
|
43
|
-
*/
|
|
44
|
-
checkApiCredentials(apiCredentials) {
|
|
45
|
-
let allCurlArgs;
|
|
46
|
-
try {
|
|
47
|
-
allCurlArgs = apiCredentials.injectIntoCurlCall([
|
|
48
|
-
'-s',
|
|
49
|
-
'-o',
|
|
50
|
-
'/dev/null',
|
|
51
|
-
'-w',
|
|
52
|
-
'%{http_code}',
|
|
53
|
-
...this.credentialCheckCurlArguments,
|
|
54
|
-
]);
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
if (error instanceof ApiCredentialsUsageError) {
|
|
58
|
-
return ApiCredentialStatus.Missing;
|
|
59
|
-
}
|
|
60
|
-
throw error;
|
|
61
|
-
}
|
|
62
|
-
const result = runCaptured(allCurlArgs, 10);
|
|
63
|
-
if (result.stdout === '200') {
|
|
64
|
-
return ApiCredentialStatus.Valid;
|
|
65
|
-
}
|
|
66
|
-
return ApiCredentialStatus.Invalid;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Set credentials from arbitrary (non-curl) arguments.
|
|
70
|
-
* Services that support this should override to validate and return typed credentials.
|
|
71
|
-
*/
|
|
72
|
-
getCredentialsNoCurl(_arguments) {
|
|
73
|
-
throw new NoCurlCredentialsNotSupportedError(this.name);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Base class for service sessions that handle browser-based interactions.
|
|
78
|
-
* This includes login, preparation steps, and any other browser automation.
|
|
79
|
-
*/
|
|
80
|
-
export class ServiceSession {
|
|
81
|
-
service;
|
|
82
|
-
constructor(service) {
|
|
83
|
-
this.service = service;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Wait until the browser login phase is complete.
|
|
87
|
-
*/
|
|
88
|
-
async waitForLoginComplete(page) {
|
|
89
|
-
while (!this.isLoginComplete()) {
|
|
90
|
-
await page.waitForTimeout(100);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Optionally diagnose a timeout error that occurred during credential finalization.
|
|
95
|
-
*
|
|
96
|
-
* Services can override this to inspect the page state and return a more
|
|
97
|
-
* specific error (e.g., checking for permission denied messages).
|
|
98
|
-
* If this returns an error, it will be thrown instead of the generic
|
|
99
|
-
* LoginFailedError. If it returns null, the original timeout error message is used.
|
|
100
|
-
*/
|
|
101
|
-
diagnoseTimeoutError(_context, _originalError) {
|
|
102
|
-
return Promise.resolve(null);
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Perform the login flow and return the extracted credentials.
|
|
106
|
-
* @param encryptedStorage - Storage for managing credentials
|
|
107
|
-
* @param launchOptions - Browser launch options
|
|
108
|
-
* @param oldCredentials - Optional existing credentials to reuse (e.g., client ID/secret)
|
|
109
|
-
*/
|
|
110
|
-
async login(encryptedStorage, launchOptions = {}, oldCredentials) {
|
|
111
|
-
return withTempBrowserContext(encryptedStorage, launchOptions, async ({ browser, context }) => {
|
|
112
|
-
const page = await context.newPage();
|
|
113
|
-
page.on('response', (response) => {
|
|
114
|
-
this.onResponse(response);
|
|
115
|
-
});
|
|
116
|
-
try {
|
|
117
|
-
await page.goto(this.service.loginUrl);
|
|
118
|
-
await this.waitForLoginComplete(page);
|
|
119
|
-
}
|
|
120
|
-
catch (error) {
|
|
121
|
-
if (error instanceof Error && isBrowserClosedError(error)) {
|
|
122
|
-
throw new LoginCancelledError();
|
|
123
|
-
}
|
|
124
|
-
throw error;
|
|
125
|
-
}
|
|
126
|
-
let apiCredentials;
|
|
127
|
-
try {
|
|
128
|
-
apiCredentials = await this.finalizeCredentials(browser, context, oldCredentials);
|
|
129
|
-
}
|
|
130
|
-
catch (error) {
|
|
131
|
-
if (error instanceof Error && isBrowserClosedError(error)) {
|
|
132
|
-
throw new LoginCancelledError();
|
|
133
|
-
}
|
|
134
|
-
if (error instanceof Error && isTimeoutError(error)) {
|
|
135
|
-
const diagnosedError = await this.diagnoseTimeoutError(context, error);
|
|
136
|
-
if (diagnosedError !== null) {
|
|
137
|
-
throw diagnosedError;
|
|
138
|
-
}
|
|
139
|
-
throw new LoginFailedError(`Login failed: ${error.message}`);
|
|
140
|
-
}
|
|
141
|
-
throw error;
|
|
142
|
-
}
|
|
143
|
-
if (apiCredentials === null) {
|
|
144
|
-
throw new LoginFailedError();
|
|
145
|
-
}
|
|
146
|
-
return apiCredentials;
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Simple service session where credentials are extracted by observing requests during login.
|
|
152
|
-
*/
|
|
153
|
-
export class SimpleServiceSession extends ServiceSession {
|
|
154
|
-
apiCredentials = null;
|
|
155
|
-
onResponse(response) {
|
|
156
|
-
if (this.apiCredentials !== null) {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
this.getApiCredentialsFromResponse(response)
|
|
160
|
-
.then((credentials) => {
|
|
161
|
-
if (this.apiCredentials === null && credentials !== null) {
|
|
162
|
-
this.apiCredentials = credentials;
|
|
163
|
-
}
|
|
164
|
-
})
|
|
165
|
-
.catch(() => {
|
|
166
|
-
// Ignore errors extracting credentials
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
isLoginComplete() {
|
|
170
|
-
return this.apiCredentials !== null;
|
|
171
|
-
}
|
|
172
|
-
finalizeCredentials(_browser, _context, _oldCredentials) {
|
|
173
|
-
return Promise.resolve(this.apiCredentials);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Service session that requires a browser followup to finalize credentials.
|
|
178
|
-
*
|
|
179
|
-
* The login phase captures login state. After login completes,
|
|
180
|
-
* the same browser session is reused to perform additional actions
|
|
181
|
-
* (e.g., navigating to settings and creating an API key).
|
|
182
|
-
*/
|
|
183
|
-
export class BrowserFollowupServiceSession extends ServiceSession {
|
|
184
|
-
async finalizeCredentials(_browser, context, oldCredentials) {
|
|
185
|
-
await showSpinnerPage(context, `Finalizing ${this.service.displayName} login...`);
|
|
186
|
-
return this.performBrowserFollowup(context, oldCredentials);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
//# sourceMappingURL=base.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/services/base.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACL,mBAAmB,EAEnB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,EACL,eAAe,EACf,sBAAsB,GAEvB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,OAAO,kCAAmC,SAAQ,KAAK;IAC3D,YAAY,WAAmB;QAC7B,KAAK,CAAC,YAAY,WAAW,4CAA4C,CAAC,CAAC;QAC3E,IAAI,CAAC,IAAI,GAAG,oCAAoC,CAAC;IACnD,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,OAAO,GAAG,qDAAqD;QACzE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AAED,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACzC,YAAY,OAAO,GAAG,8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C,WAAW,EAAE,EAAE;YACpB,IAAI,IAAI,CAAC,cAAc,KAAK,IAAI,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;gBACzD,IAAI,CAAC,cAAc,GAAG,WAAW,CAAC;YACpC,CAAC;QACH,CAAC,CAAC;aACD,KAAK,CAAC,GAAG,EAAE;YACV,uCAAuC;QACzC,CAAC,CAAC,CAAC;IACP,CAAC;IAES,eAAe;QACvB,OAAO,IAAI,CAAC,cAAc,KAAK,IAAI,CAAC;IACtC,CAAC;IAES,mBAAmB,CAC3B,QAAiB,EACjB,QAAwB,EACxB,eAAgC;QAEhC,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC9C,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,OAAgB,6BAA8B,SAAQ,cAAc;IAYrD,KAAK,CAAC,mBAAmB,CAC1C,QAAiB,EACjB,OAAuB,EACvB,cAA+B;QAE/B,MAAM,eAAe,CAAC,OAAO,EAAE,cAAc,IAAI,CAAC,OAAO,CAAC,WAAW,WAAW,CAAC,CAAC;QAClF,OAAO,IAAI,CAAC,sBAAsB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAC9D,CAAC;CACF"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { ApiCredentialStatus, type ApiCredentials } from '../../apiCredentials.js';
|
|
3
|
-
import { Service } from '../base.js';
|
|
4
|
-
/**
|
|
5
|
-
* Google Maps API key credentials.
|
|
6
|
-
* The API key is injected as a `key=` query parameter in the URL.
|
|
7
|
-
*/
|
|
8
|
-
export declare const GoogleMapsApiKeyCredentialsSchema: z.ZodObject<{
|
|
9
|
-
objectType: z.ZodLiteral<"googleMapsApiKey">;
|
|
10
|
-
apiKey: z.ZodString;
|
|
11
|
-
}, "strip", z.ZodTypeAny, {
|
|
12
|
-
objectType: "googleMapsApiKey";
|
|
13
|
-
apiKey: string;
|
|
14
|
-
}, {
|
|
15
|
-
objectType: "googleMapsApiKey";
|
|
16
|
-
apiKey: string;
|
|
17
|
-
}>;
|
|
18
|
-
export type GoogleMapsApiKeyCredentialsData = z.infer<typeof GoogleMapsApiKeyCredentialsSchema>;
|
|
19
|
-
export declare class GoogleMapsApiKeyCredentials implements ApiCredentials {
|
|
20
|
-
readonly objectType: "googleMapsApiKey";
|
|
21
|
-
readonly apiKey: string;
|
|
22
|
-
constructor(apiKey: string);
|
|
23
|
-
injectIntoCurlCall(curlArguments: readonly string[]): readonly string[];
|
|
24
|
-
isExpired(): boolean | undefined;
|
|
25
|
-
toJSON(): GoogleMapsApiKeyCredentialsData;
|
|
26
|
-
static fromJSON(data: GoogleMapsApiKeyCredentialsData): GoogleMapsApiKeyCredentials;
|
|
27
|
-
}
|
|
28
|
-
export declare class GoogleMaps extends Service {
|
|
29
|
-
readonly name = "google-maps";
|
|
30
|
-
readonly displayName = "Google Maps";
|
|
31
|
-
readonly baseApiUrls: readonly ["https://maps.googleapis.com/"];
|
|
32
|
-
readonly loginUrl = "https://console.cloud.google.com/google/maps-apis/";
|
|
33
|
-
readonly info: string;
|
|
34
|
-
readonly credentialCheckCurlArguments: readonly ["https://maps.googleapis.com/maps/api/geocode/json?address=test"];
|
|
35
|
-
getCredentialsNoCurl(arguments_: readonly string[]): ApiCredentials;
|
|
36
|
-
checkApiCredentials(apiCredentials: ApiCredentials): ApiCredentialStatus;
|
|
37
|
-
}
|
|
38
|
-
export declare const GOOGLE_MAPS: GoogleMaps;
|
|
39
|
-
//# sourceMappingURL=maps.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"maps.d.ts","sourceRoot":"","sources":["../../../../src/services/google/maps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEnF,OAAO,EAAsC,OAAO,EAAE,MAAM,YAAY,CAAC;AAEzE;;;GAGG;AACH,eAAO,MAAM,iCAAiC;;;;;;;;;EAG5C,CAAC;AAEH,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAC;AAEhG,qBAAa,2BAA4B,YAAW,cAAc;IAChE,QAAQ,CAAC,UAAU,EAAG,kBAAkB,CAAU;IAClD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM;IAI1B,kBAAkB,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE;IAcvE,SAAS,IAAI,OAAO,GAAG,SAAS;IAIhC,MAAM,IAAI,+BAA+B;IAOzC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,+BAA+B,GAAG,2BAA2B;CAGpF;AAED,qBAAa,UAAW,SAAQ,OAAO;IACrC,QAAQ,CAAC,IAAI,iBAAiB;IAC9B,QAAQ,CAAC,WAAW,iBAAiB;IACrC,QAAQ,CAAC,WAAW,4CAA6C;IACjE,QAAQ,CAAC,QAAQ,wDAAwD;IACzE,QAAQ,CAAC,IAAI,SAKkC;IAE/C,QAAQ,CAAC,4BAA4B,8EAE1B;IAEF,oBAAoB,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,cAAc;IAiBnE,mBAAmB,CAAC,cAAc,EAAE,cAAc,GAAG,mBAAmB;CAiBlF;AAUD,eAAO,MAAM,WAAW,YAAmB,CAAC"}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { ApiCredentialStatus } from '../../apiCredentials.js';
|
|
3
|
-
import { extractUrlFromCurlArguments, runCaptured } from '../../curl.js';
|
|
4
|
-
import { NoCurlCredentialsNotSupportedError, Service } from '../base.js';
|
|
5
|
-
/**
|
|
6
|
-
* Google Maps API key credentials.
|
|
7
|
-
* The API key is injected as a `key=` query parameter in the URL.
|
|
8
|
-
*/
|
|
9
|
-
export const GoogleMapsApiKeyCredentialsSchema = z.object({
|
|
10
|
-
objectType: z.literal('googleMapsApiKey'),
|
|
11
|
-
apiKey: z.string(),
|
|
12
|
-
});
|
|
13
|
-
export class GoogleMapsApiKeyCredentials {
|
|
14
|
-
objectType = 'googleMapsApiKey';
|
|
15
|
-
apiKey;
|
|
16
|
-
constructor(apiKey) {
|
|
17
|
-
this.apiKey = apiKey;
|
|
18
|
-
}
|
|
19
|
-
injectIntoCurlCall(curlArguments) {
|
|
20
|
-
const url = extractUrlFromCurlArguments(curlArguments);
|
|
21
|
-
if (!url?.startsWith('https://maps.googleapis.com/')) {
|
|
22
|
-
return curlArguments;
|
|
23
|
-
}
|
|
24
|
-
const parsed = new URL(url);
|
|
25
|
-
if (parsed.searchParams.has('key')) {
|
|
26
|
-
return curlArguments;
|
|
27
|
-
}
|
|
28
|
-
parsed.searchParams.set('key', this.apiKey);
|
|
29
|
-
const rewrittenUrl = parsed.toString();
|
|
30
|
-
return curlArguments.map((argument) => (argument === url ? rewrittenUrl : argument));
|
|
31
|
-
}
|
|
32
|
-
isExpired() {
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
toJSON() {
|
|
36
|
-
return {
|
|
37
|
-
objectType: this.objectType,
|
|
38
|
-
apiKey: this.apiKey,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
static fromJSON(data) {
|
|
42
|
-
return new GoogleMapsApiKeyCredentials(data.apiKey);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
export class GoogleMaps extends Service {
|
|
46
|
-
name = 'google-maps';
|
|
47
|
-
displayName = 'Google Maps';
|
|
48
|
-
baseApiUrls = ['https://maps.googleapis.com/'];
|
|
49
|
-
loginUrl = 'https://console.cloud.google.com/google/maps-apis/';
|
|
50
|
-
info = 'https://developers.google.com/maps/documentation. ' +
|
|
51
|
-
'Browser-based authentication is not yet supported. ' +
|
|
52
|
-
'Use `latchkey auth set-nocurl google-maps <api-key>` to add credentials. ' +
|
|
53
|
-
'Example invocation: `latchkey curl google-maps https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway` ' +
|
|
54
|
-
'(the API key will be added automatically).';
|
|
55
|
-
credentialCheckCurlArguments = [
|
|
56
|
-
'https://maps.googleapis.com/maps/api/geocode/json?address=test',
|
|
57
|
-
];
|
|
58
|
-
getCredentialsNoCurl(arguments_) {
|
|
59
|
-
if (arguments_.length !== 1 || arguments_[0] === undefined) {
|
|
60
|
-
throw new GoogleMapsCredentialError('Expected exactly one argument: the API key.\n' +
|
|
61
|
-
'Example: latchkey auth set-nocurl google-maps AIzaSyA1B2C3D4E5F6G7H8I9J0');
|
|
62
|
-
}
|
|
63
|
-
const apiKey = arguments_[0];
|
|
64
|
-
if (apiKey.length < 10) {
|
|
65
|
-
throw new GoogleMapsCredentialError("The provided key doesn't look like a Google Maps API key (too short).\n" +
|
|
66
|
-
'Example: AIzaSyA1B2C3D4E5F6G7H8I9J0');
|
|
67
|
-
}
|
|
68
|
-
return new GoogleMapsApiKeyCredentials(apiKey);
|
|
69
|
-
}
|
|
70
|
-
checkApiCredentials(apiCredentials) {
|
|
71
|
-
const allCurlArgs = apiCredentials.injectIntoCurlCall([
|
|
72
|
-
'-s',
|
|
73
|
-
'-o',
|
|
74
|
-
'/dev/null',
|
|
75
|
-
'-w',
|
|
76
|
-
'%{http_code}',
|
|
77
|
-
...this.credentialCheckCurlArguments,
|
|
78
|
-
]);
|
|
79
|
-
const result = runCaptured(allCurlArgs, 10);
|
|
80
|
-
if (result.stdout === '200') {
|
|
81
|
-
return ApiCredentialStatus.Valid;
|
|
82
|
-
}
|
|
83
|
-
return ApiCredentialStatus.Invalid;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
class GoogleMapsCredentialError extends NoCurlCredentialsNotSupportedError {
|
|
87
|
-
constructor(message) {
|
|
88
|
-
super('google-maps');
|
|
89
|
-
this.message = message;
|
|
90
|
-
this.name = 'GoogleMapsCredentialError';
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
export const GOOGLE_MAPS = new GoogleMaps();
|
|
94
|
-
//# sourceMappingURL=maps.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"maps.js","sourceRoot":"","sources":["../../../../src/services/google/maps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAuB,MAAM,yBAAyB,CAAC;AACnF,OAAO,EAAE,2BAA2B,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,kCAAkC,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEzE;;;GAGG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,CAAC,MAAM,CAAC;IACxD,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC;IACzC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;CACnB,CAAC,CAAC;AAIH,MAAM,OAAO,2BAA2B;IAC7B,UAAU,GAAG,kBAA2B,CAAC;IACzC,MAAM,CAAS;IAExB,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,kBAAkB,CAAC,aAAgC;QACjD,MAAM,GAAG,GAAG,2BAA2B,CAAC,aAAyB,CAAC,CAAC;QACnE,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,8BAA8B,CAAC,EAAE,CAAC;YACrD,OAAO,aAAa,CAAC;QACvB,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YACnC,OAAO,aAAa,CAAC;QACvB,CAAC;QACD,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5C,MAAM,YAAY,GA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MAAM,CAAC,CAAC;IACjD,CAAC;IAEQ,mBAAmB,CAAC,cAA8B;QACzD,MAAM,WAAW,GAAG,cAAc,CAAC,kBAAkB,CAAC;YACpD,IAAI;YACJ,IAAI;YACJ,WAAW;YACX,IAAI;YACJ,cAAc;YACd,GAAG,IAAI,CAAC,4BAA4B;SACrC,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,WAAW,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAE5C,IAAI,MAAM,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;YAC5B,OAAO,mBAAmB,CAAC,KAAK,CAAC;QACnC,CAAC;QACD,OAAO,mBAAmB,CAAC,OAAO,CAAC;IACrC,CAAC;CACF;AAED,MAAM,yBAA0B,SAAQ,kCAAkC;IACxE,YAAY,OAAe;QACzB,KAAK,CAAC,aAAa,CAAC,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;IAC1C,CAAC;CACF;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,UAAU,EAAE,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Google service implementation with OAuth flow.
|
|
3
|
-
*/
|
|
4
|
-
import type { Browser, BrowserContext, Response } from 'playwright';
|
|
5
|
-
import { ApiCredentials } from '../apiCredentials.js';
|
|
6
|
-
import { type BrowserLaunchOptions } from '../playwrightUtils.js';
|
|
7
|
-
import { Service, BrowserFollowupServiceSession } from './base.js';
|
|
8
|
-
import type { EncryptedStorage } from '../encryptedStorage.js';
|
|
9
|
-
declare class GoogleServiceSession extends BrowserFollowupServiceSession {
|
|
10
|
-
private readonly loginDetector;
|
|
11
|
-
onResponse(response: Response): void;
|
|
12
|
-
protected isLoginComplete(): boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Override to skip the spinner page since the OAuth flow requires user interaction
|
|
15
|
-
* (granting consent on Google's authorization page).
|
|
16
|
-
*/
|
|
17
|
-
protected finalizeCredentials(_browser: Browser, context: BrowserContext, oldCredentials?: ApiCredentials): Promise<ApiCredentials | null>;
|
|
18
|
-
protected performBrowserFollowup(context: BrowserContext, oldCredentials?: ApiCredentials): Promise<ApiCredentials | null>;
|
|
19
|
-
prepare(encryptedStorage: EncryptedStorage, launchOptions?: BrowserLaunchOptions): Promise<ApiCredentials>;
|
|
20
|
-
private performOAuthFlow;
|
|
21
|
-
}
|
|
22
|
-
export declare class Google extends Service {
|
|
23
|
-
readonly name = "google";
|
|
24
|
-
readonly displayName = "Google Workspace";
|
|
25
|
-
readonly baseApiUrls: readonly ["https://www.googleapis.com/"];
|
|
26
|
-
readonly loginUrl = "https://console.cloud.google.com/";
|
|
27
|
-
readonly info: string;
|
|
28
|
-
readonly credentialCheckCurlArguments: readonly ["https://www.googleapis.com/oauth2/v1/userinfo"];
|
|
29
|
-
getSession(): GoogleServiceSession;
|
|
30
|
-
refreshCredentials(apiCredentials: ApiCredentials): Promise<ApiCredentials | null>;
|
|
31
|
-
}
|
|
32
|
-
export declare const GOOGLE: Google;
|
|
33
|
-
export {};
|
|
34
|
-
//# sourceMappingURL=google.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../../src/services/google.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAQ,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAoB,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAIL,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAM/B,OAAO,EACL,OAAO,EACP,6BAA6B,EAI9B,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAqQ/D,cAAM,oBAAqB,SAAQ,6BAA6B;IAC9D,OAAO,CAAC,QAAQ,CA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