latchkey 2.3.0 → 2.4.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.
Files changed (62) hide show
  1. package/README.md +3 -1
  2. package/dist/integrations/SKILL.md +0 -12
  3. package/dist/integrations/openclaw/SKILL.md +106 -0
  4. package/dist/package.json +1 -1
  5. package/dist/src/cli.js +7 -0
  6. package/dist/src/cli.js.map +1 -1
  7. package/dist/src/config.d.ts +4 -0
  8. package/dist/src/config.d.ts.map +1 -1
  9. package/dist/src/config.js +7 -0
  10. package/dist/src/config.js.map +1 -1
  11. package/dist/src/curl.d.ts +11 -0
  12. package/dist/src/curl.d.ts.map +1 -1
  13. package/dist/src/curl.js +22 -1
  14. package/dist/src/curl.js.map +1 -1
  15. package/dist/src/dailyCounting.d.ts +10 -0
  16. package/dist/src/dailyCounting.d.ts.map +1 -0
  17. package/dist/src/dailyCounting.js +45 -0
  18. package/dist/src/dailyCounting.js.map +1 -0
  19. package/dist/src/services/core/base.js +1 -1
  20. package/dist/src/services/core/base.js.map +1 -1
  21. package/dist/src/services/dropbox.d.ts +1 -1
  22. package/dist/src/services/dropbox.d.ts.map +1 -1
  23. package/dist/src/services/dropbox.js +3 -1
  24. package/dist/src/services/dropbox.js.map +1 -1
  25. package/dist/src/services/google.d.ts.map +1 -1
  26. package/dist/src/services/google.js +3 -4
  27. package/dist/src/services/google.js.map +1 -1
  28. package/dist/tests/cli.test.js +2 -0
  29. package/dist/tests/cli.test.js.map +1 -1
  30. package/dist/tests/dailyCounting.test.d.ts +2 -0
  31. package/dist/tests/dailyCounting.test.d.ts.map +1 -0
  32. package/dist/tests/dailyCounting.test.js +80 -0
  33. package/dist/tests/dailyCounting.test.js.map +1 -0
  34. package/package.json +1 -1
  35. package/dist/scripts/encryptFile.d.ts +0 -21
  36. package/dist/scripts/encryptFile.d.ts.map +0 -1
  37. package/dist/scripts/encryptFile.js +0 -101
  38. package/dist/scripts/encryptFile.js.map +0 -1
  39. package/dist/src/browserState.d.ts +0 -8
  40. package/dist/src/browserState.d.ts.map +0 -1
  41. package/dist/src/browserState.js +0 -21
  42. package/dist/src/browserState.js.map +0 -1
  43. package/dist/src/registeredService.d.ts +0 -20
  44. package/dist/src/registeredService.d.ts.map +0 -1
  45. package/dist/src/registeredService.js +0 -34
  46. package/dist/src/registeredService.js.map +0 -1
  47. package/dist/src/registeredServiceStore.d.ts +0 -24
  48. package/dist/src/registeredServiceStore.d.ts.map +0 -1
  49. package/dist/src/registeredServiceStore.js +0 -70
  50. package/dist/src/registeredServiceStore.js.map +0 -1
  51. package/dist/src/services/google/maps.d.ts +0 -39
  52. package/dist/src/services/google/maps.d.ts.map +0 -1
  53. package/dist/src/services/google/maps.js +0 -94
  54. package/dist/src/services/google/maps.js.map +0 -1
  55. package/dist/src/services/googleAnalytics.d.ts +0 -11
  56. package/dist/src/services/googleAnalytics.d.ts.map +0 -1
  57. package/dist/src/services/googleAnalytics.js +0 -18
  58. package/dist/src/services/googleAnalytics.js.map +0 -1
  59. package/dist/src/services/googleMaps.d.ts +0 -12
  60. package/dist/src/services/googleMaps.d.ts.map +0 -1
  61. package/dist/src/services/googleMaps.js +0 -17
  62. package/dist/src/services/googleMaps.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"browserState.d.ts","sourceRoot":"","sources":["../../src/browserState.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,GAAG,IAAI,CAUnD"}
@@ -1,21 +0,0 @@
1
- /**
2
- * Browser state management utilities.
3
- */
4
- import { homedir } from 'node:os';
5
- import { resolve } from 'node:path';
6
- const LATCHKEY_BROWSER_STATE_ENV_VAR = 'LATCHKEY_BROWSER_STATE';
7
- /**
8
- * Get the browser state path from the LATCHKEY_BROWSER_STATE environment variable.
9
- */
10
- export function getBrowserStatePath() {
11
- const envValue = process.env[LATCHKEY_BROWSER_STATE_ENV_VAR];
12
- if (envValue) {
13
- // Expand ~ to home directory
14
- if (envValue.startsWith('~')) {
15
- return resolve(homedir(), envValue.slice(2));
16
- }
17
- return resolve(envValue);
18
- }
19
- return null;
20
- }
21
- //# sourceMappingURL=browserState.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"browserState.js","sourceRoot":"","sources":["../../src/browserState.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,8BAA8B,GAAG,wBAAwB,CAAC;AAEhE;;GAEG;AACH,MAAM,UAAU,mBAAmB;IACjC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;IAC7D,IAAI,QAAQ,EAAE,CAAC;QACb,6BAA6B;QAC7B,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7B,OAAO,OAAO,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/C,CAAC;QACD,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,20 +0,0 @@
1
- /**
2
- * A user-registered service that wraps a built-in "family" service
3
- * with a custom name and base API URL. Used for self-hosted instances.
4
- */
5
- import type { ApiCredentials } from './apiCredentials.js';
6
- import { Service, type ServiceSession } from './services/base.js';
7
- export declare class RegisteredService extends Service {
8
- readonly name: string;
9
- readonly displayName: string;
10
- readonly baseApiUrls: readonly string[];
11
- readonly loginUrl: string;
12
- readonly info: string;
13
- readonly credentialCheckCurlArguments: readonly string[];
14
- private readonly familyService;
15
- constructor(name: string, baseApiUrl: string, familyService: Service, loginUrl?: string);
16
- getSession?(): ServiceSession;
17
- setCredentialsExample(serviceName: string): string;
18
- getCredentialsNoCurl(arguments_: readonly string[]): ApiCredentials;
19
- }
20
- //# sourceMappingURL=registeredService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registeredService.d.ts","sourceRoot":"","sources":["../../src/registeredService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAElE,qBAAa,iBAAkB,SAAQ,OAAO;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,4BAA4B,EAAE,SAAS,MAAM,EAAE,CAAC;IAEzD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAU;gBAE5B,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM;IAe9E,UAAU,CAAC,IAAI,cAAc;IAEtC,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IAIzC,oBAAoB,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,cAAc;CAG7E"}
@@ -1,34 +0,0 @@
1
- /**
2
- * A user-registered service that wraps a built-in "family" service
3
- * with a custom name and base API URL. Used for self-hosted instances.
4
- */
5
- import { Service } from './services/base.js';
6
- export class RegisteredService extends Service {
7
- name;
8
- displayName;
9
- baseApiUrls;
10
- loginUrl;
11
- info;
12
- credentialCheckCurlArguments;
13
- familyService;
14
- constructor(name, baseApiUrl, familyService, loginUrl) {
15
- super();
16
- this.name = name;
17
- this.displayName = name;
18
- this.baseApiUrls = [baseApiUrl];
19
- this.loginUrl = loginUrl ?? '';
20
- this.info = `Self-hosted ${familyService.displayName} instance. ${familyService.info}`;
21
- this.credentialCheckCurlArguments = [];
22
- this.familyService = familyService;
23
- if (loginUrl !== undefined && familyService.getSession !== undefined) {
24
- this.getSession = () => familyService.getSession();
25
- }
26
- }
27
- setCredentialsExample(serviceName) {
28
- return this.familyService.setCredentialsExample(serviceName);
29
- }
30
- getCredentialsNoCurl(arguments_) {
31
- return this.familyService.getCredentialsNoCurl(arguments_);
32
- }
33
- }
34
- //# sourceMappingURL=registeredService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registeredService.js","sourceRoot":"","sources":["../../src/registeredService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,OAAO,EAAuB,MAAM,oBAAoB,CAAC;AAElE,MAAM,OAAO,iBAAkB,SAAQ,OAAO;IACnC,IAAI,CAAS;IACb,WAAW,CAAS;IACpB,WAAW,CAAoB;IAC/B,QAAQ,CAAS;IACjB,IAAI,CAAS;IACb,4BAA4B,CAAoB;IAExC,aAAa,CAAU;IAExC,YAAY,IAAY,EAAE,UAAkB,EAAE,aAAsB,EAAE,QAAiB;QACrF,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,WAAW,GAAG,CAAC,UAAU,CAAC,CAAC;QAChC,IAAI,CAAC,QAAQ,GAAG,QAAQ,IAAI,EAAE,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,eAAe,aAAa,CAAC,WAAW,cAAc,aAAa,CAAC,IAAI,EAAE,CAAC;QACvF,IAAI,CAAC,4BAA4B,GAAG,EAAE,CAAC;QACvC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QAEnC,IAAI,QAAQ,KAAK,SAAS,IAAI,aAAa,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YACrE,IAAI,CAAC,UAAU,GAAG,GAAG,EAAE,CAAC,aAAa,CAAC,UAAW,EAAE,CAAC;QACtD,CAAC;IACH,CAAC;IAID,qBAAqB,CAAC,WAAmB;QACvC,OAAO,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAC/D,CAAC;IAEQ,oBAAoB,CAAC,UAA6B;QACzD,OAAO,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;IAC7D,CAAC;CACF"}
@@ -1,24 +0,0 @@
1
- /**
2
- * Persistence for user-registered services in config.json.
3
- */
4
- import { z } from 'zod';
5
- import type { Registry } from './registry.js';
6
- declare const RegisteredServiceEntrySchema: z.ZodObject<{
7
- baseApiUrl: z.ZodString;
8
- serviceFamily: z.ZodString;
9
- loginUrl: z.ZodOptional<z.ZodString>;
10
- }, "strip", z.ZodTypeAny, {
11
- baseApiUrl: string;
12
- serviceFamily: string;
13
- loginUrl?: string | undefined;
14
- }, {
15
- baseApiUrl: string;
16
- serviceFamily: string;
17
- loginUrl?: string | undefined;
18
- }>;
19
- export type RegisteredServiceEntry = z.infer<typeof RegisteredServiceEntrySchema>;
20
- export declare function loadRegisteredServices(configPath: string): ReadonlyMap<string, RegisteredServiceEntry>;
21
- export declare function saveRegisteredService(configPath: string, name: string, entry: RegisteredServiceEntry): void;
22
- export declare function loadRegisteredServicesIntoRegistry(configPath: string, registry: Registry): void;
23
- export {};
24
- //# sourceMappingURL=registeredServiceStore.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registeredServiceStore.d.ts","sourceRoot":"","sources":["../../src/registeredServiceStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,QAAA,MAAM,4BAA4B;;;;;;;;;;;;EAIhC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAIlF,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,MAAM,GACjB,WAAW,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAiB7C;AAED,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,sBAAsB,GAC5B,IAAI,CA2BN;AAED,wBAAgB,kCAAkC,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAkB/F"}
@@ -1,70 +0,0 @@
1
- /**
2
- * Persistence for user-registered services in config.json.
3
- */
4
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
5
- import { dirname } from 'node:path';
6
- import { z } from 'zod';
7
- import { RegisteredService } from './registeredService.js';
8
- const RegisteredServiceEntrySchema = z.object({
9
- baseApiUrl: z.string(),
10
- serviceFamily: z.string(),
11
- loginUrl: z.string().optional(),
12
- });
13
- const RegisteredServicesSchema = z.record(z.string(), RegisteredServiceEntrySchema);
14
- export function loadRegisteredServices(configPath) {
15
- if (!existsSync(configPath)) {
16
- return new Map();
17
- }
18
- try {
19
- const content = readFileSync(configPath, 'utf-8');
20
- const data = JSON.parse(content);
21
- if (typeof data !== 'object' || data === null) {
22
- return new Map();
23
- }
24
- const record = data;
25
- const registeredServices = RegisteredServicesSchema.parse(record.registeredServices ?? {});
26
- return new Map(Object.entries(registeredServices));
27
- }
28
- catch {
29
- return new Map();
30
- }
31
- }
32
- export function saveRegisteredService(configPath, name, entry) {
33
- const directory = dirname(configPath);
34
- if (!existsSync(directory)) {
35
- mkdirSync(directory, { recursive: true, mode: 0o700 });
36
- }
37
- let existingConfig = {};
38
- if (existsSync(configPath)) {
39
- try {
40
- const existingContent = readFileSync(configPath, 'utf-8');
41
- existingConfig = JSON.parse(existingContent);
42
- }
43
- catch {
44
- // Ignore parse errors, start fresh
45
- }
46
- }
47
- const registeredServices = typeof existingConfig.registeredServices === 'object' &&
48
- existingConfig.registeredServices !== null
49
- ? existingConfig.registeredServices
50
- : {};
51
- registeredServices[name] = entry;
52
- existingConfig.registeredServices = registeredServices;
53
- const content = JSON.stringify(existingConfig, null, 2);
54
- writeFileSync(configPath, content, { encoding: 'utf-8' });
55
- }
56
- export function loadRegisteredServicesIntoRegistry(configPath, registry) {
57
- const entries = loadRegisteredServices(configPath);
58
- for (const [name, entry] of entries) {
59
- const familyService = registry.getByName(entry.serviceFamily);
60
- if (familyService === null) {
61
- continue;
62
- }
63
- if (registry.getByName(name) !== null) {
64
- continue;
65
- }
66
- const registeredService = new RegisteredService(name, entry.baseApiUrl, familyService, entry.loginUrl);
67
- registry.addService(registeredService);
68
- }
69
- }
70
- //# sourceMappingURL=registeredServiceStore.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registeredServiceStore.js","sourceRoot":"","sources":["../../src/registeredServiceStore.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IACzB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC;AAIH,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,4BAA4B,CAAC,CAAC;AAEpF,MAAM,UAAU,sBAAsB,CACpC,UAAkB;IAElB,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC5B,OAAO,IAAI,GAAG,E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KAAK,QAAQ;QACrD,cAAc,CAAC,kBAAkB,KAAK,IAAI;QACxC,CAAC,CAAE,cAAc,CAAC,kBAA8C;QAChE,CAAC,CAAC,EAAE,CAAC;IAET,kBAAkB,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;IACjC,cAAc,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IAEvD,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACxD,aAAa,CAAC,UAAU,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,kCAAkC,CAAC,UAAkB,EAAE,QAAkB;IACvF,MAAM,OAAO,GAAG,sBAAsB,CAAC,UAAU,CAAC,CAAC;IACnD,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,OAAO,EAAE,CAAC;QACpC,MAAM,aAAa,GAAG,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QAC9D,IAAI,aAAa,KAAK,IAAI,EAAE,CAAC;YAC3B,SAAS;QACX,CAAC;QACD,IAAI,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YACtC,SAAS;QACX,CAAC;QACD,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,CAC7C,IAAI,EACJ,KAAK,CAAC,UAAU,EAChB,aAAa,EACb,KAAK,CAAC,QAAQ,CACf,CAAC;QACF,QAAQ,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;IACzC,CAAC;AACH,CAAC"}
@@ -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,CA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AAC,CAAC,KAAK,SAAS,EAAE,CAAC;YAC3D,MAAM,IAAI,yBAAyB,CACjC,+CAA+C;gBAC7C,0EAA0E,CAC7E,CAAC;QACJ,CAAC;QACD,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QAC7B,IAAI,MAAM,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;YACvB,MAAM,IAAI,yBAAyB,CACjC,yEAAyE;gBACvE,qCAAqC,CACxC,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,2BAA2B,CAAC,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,11 +0,0 @@
1
- import { Service } from './base.js';
2
- export declare class GoogleAnalytics extends Service {
3
- readonly name = "google-analytics";
4
- readonly displayName = "Google Analytics";
5
- readonly baseApiUrls: readonly ["https://analyticsdata.googleapis.com/", "https://analyticsadmin.googleapis.com/"];
6
- readonly loginUrl = "https://analytics.google.com/";
7
- readonly info: string;
8
- readonly credentialCheckCurlArguments: readonly ["https://analyticsadmin.googleapis.com/v1beta/accountSummaries"];
9
- }
10
- export declare const GOOGLE_ANALYTICS: GoogleAnalytics;
11
- //# sourceMappingURL=googleAnalytics.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"googleAnalytics.d.ts","sourceRoot":"","sources":["../../../src/services/googleAnalytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,qBAAa,eAAgB,SAAQ,OAAO;IAC1C,QAAQ,CAAC,IAAI,sBAAsB;IACnC,QAAQ,CAAC,WAAW,sBAAsB;IAC1C,QAAQ,CAAC,WAAW,+FAGT;IACX,QAAQ,CAAC,QAAQ,mCAAmC;IACpD,QAAQ,CAAC,IAAI,SAGgG;IAE7G,QAAQ,CAAC,4BAA4B,6EAE1B;CACZ;AAED,eAAO,MAAM,gBAAgB,iBAAwB,CAAC"}
@@ -1,18 +0,0 @@
1
- import { Service } from './base.js';
2
- export class GoogleAnalytics extends Service {
3
- name = 'google-analytics';
4
- displayName = 'Google Analytics';
5
- baseApiUrls = [
6
- 'https://analyticsdata.googleapis.com/',
7
- 'https://analyticsadmin.googleapis.com/',
8
- ];
9
- loginUrl = 'https://analytics.google.com/';
10
- info = 'https://developers.google.com/analytics/devguides/reporting/data/v1. ' +
11
- 'Browser-based authentication is not yet supported. ' +
12
- 'Use `latchkey auth set google-analytics -H "Authorization: Bearer <token>"` to add credentials manually.';
13
- credentialCheckCurlArguments = [
14
- 'https://analyticsadmin.googleapis.com/v1beta/accountSummaries',
15
- ];
16
- }
17
- export const GOOGLE_ANALYTICS = new GoogleAnalytics();
18
- //# sourceMappingURL=googleAnalytics.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"googleAnalytics.js","sourceRoot":"","sources":["../../../src/services/googleAnalytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,OAAO,eAAgB,SAAQ,OAAO;IACjC,IAAI,GAAG,kBAAkB,CAAC;IAC1B,WAAW,GAAG,kBAAkB,CAAC;IACjC,WAAW,GAAG;QACrB,uCAAuC;QACvC,wCAAwC;KAChC,CAAC;IACF,QAAQ,GAAG,+BAA+B,CAAC;IAC3C,IAAI,GACX,uEAAuE;QACvE,qDAAqD;QACrD,0GAA0G,CAAC;IAEpG,4BAA4B,GAAG;QACtC,+DAA+D;KACvD,CAAC;CACZ;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,eAAe,EAAE,CAAC"}
@@ -1,12 +0,0 @@
1
- import { Service } from './base.js';
2
- /** Work in progress — not yet registered in the service registry. */
3
- export declare class GoogleMaps extends Service {
4
- readonly name = "google-maps";
5
- readonly displayName = "Google Maps";
6
- readonly baseApiUrls: readonly ["https://maps.googleapis.com/"];
7
- readonly loginUrl = "https://console.cloud.google.com/google/maps-apis/";
8
- readonly info: string;
9
- readonly credentialCheckCurlArguments: readonly ["https://maps.googleapis.com/maps/api/geocode/json?address=test"];
10
- }
11
- export declare const GOOGLE_MAPS: GoogleMaps;
12
- //# sourceMappingURL=googleMaps.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"googleMaps.d.ts","sourceRoot":"","sources":["../../../src/services/googleMaps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,qEAAqE;AACrE,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,SAIgD;IAE7D,QAAQ,CAAC,4BAA4B,8EAE1B;CACZ;AAED,eAAO,MAAM,WAAW,YAAmB,CAAC"}
@@ -1,17 +0,0 @@
1
- import { Service } from './base.js';
2
- /** Work in progress — not yet registered in the service registry. */
3
- export class GoogleMaps extends Service {
4
- name = 'google-maps';
5
- displayName = 'Google Maps';
6
- baseApiUrls = ['https://maps.googleapis.com/'];
7
- loginUrl = 'https://console.cloud.google.com/google/maps-apis/';
8
- info = 'https://developers.google.com/maps/documentation. ' +
9
- 'Browser-based authentication is not yet supported. ' +
10
- 'Use `latchkey auth set google-maps -H "X-Goog-Api-Key: <key>"` to add credentials manually. ' +
11
- 'Only a subset of the APIs accept API keys in the header.';
12
- credentialCheckCurlArguments = [
13
- 'https://maps.googleapis.com/maps/api/geocode/json?address=test',
14
- ];
15
- }
16
- export const GOOGLE_MAPS = new GoogleMaps();
17
- //# sourceMappingURL=googleMaps.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"googleMaps.js","sourceRoot":"","sources":["../../../src/services/googleMaps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,qEAAqE;AACrE,MAAM,OAAO,UAAW,SAAQ,OAAO;IAC5B,IAAI,GAAG,aAAa,CAAC;IACrB,WAAW,GAAG,aAAa,CAAC;IAC5B,WAAW,GAAG,CAAC,8BAA8B,CAAU,CAAC;IACxD,QAAQ,GAAG,oDAAoD,CAAC;IAChE,IAAI,GACX,oDAAoD;QACpD,qDAAqD;QACrD,8FAA8F;QAC9F,0DAA0D,CAAC;IAEpD,4BAA4B,GAAG;QACtC,gEAAgE;KACxD,CAAC;CACZ;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,UAAU,EAAE,CAAC"}