@openclaw/google-meet 2026.5.2 → 2026.5.3-beta.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/src/drive.ts DELETED
@@ -1,72 +0,0 @@
1
- import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/ssrf-runtime";
2
- import { googleApiError } from "./google-api-errors.js";
3
-
4
- const GOOGLE_DRIVE_API_BASE_URL = "https://www.googleapis.com/drive/v3";
5
- const GOOGLE_DRIVE_API_HOST = "www.googleapis.com";
6
- const GOOGLE_DRIVE_MEET_SCOPE = "https://www.googleapis.com/auth/drive.meet.readonly";
7
- const TEXT_PLAIN_MIME = "text/plain";
8
-
9
- function appendQuery(url: string, query: Record<string, string | undefined>) {
10
- const parsed = new URL(url);
11
- for (const [key, value] of Object.entries(query)) {
12
- if (value !== undefined) {
13
- parsed.searchParams.set(key, value);
14
- }
15
- }
16
- return parsed.toString();
17
- }
18
-
19
- export function extractGoogleDriveDocumentId(value: unknown): string | undefined {
20
- if (typeof value !== "string") {
21
- return undefined;
22
- }
23
- const trimmed = value.trim();
24
- if (!trimmed) {
25
- return undefined;
26
- }
27
- if (/^https?:\/\//i.test(trimmed)) {
28
- try {
29
- const url = new URL(trimmed);
30
- const documentMatch = url.pathname.match(/\/document\/d\/([^/]+)/);
31
- return documentMatch?.[1];
32
- } catch {
33
- return undefined;
34
- }
35
- }
36
- const segments = trimmed.split("/").filter(Boolean);
37
- return segments.at(-1);
38
- }
39
-
40
- export async function exportGoogleDriveDocumentText(params: {
41
- accessToken: string;
42
- documentId: string;
43
- }): Promise<string> {
44
- const { response, release } = await fetchWithSsrFGuard({
45
- url: appendQuery(
46
- `${GOOGLE_DRIVE_API_BASE_URL}/files/${encodeURIComponent(params.documentId)}/export`,
47
- { mimeType: TEXT_PLAIN_MIME },
48
- ),
49
- init: {
50
- headers: {
51
- Authorization: `Bearer ${params.accessToken}`,
52
- Accept: TEXT_PLAIN_MIME,
53
- },
54
- },
55
- policy: { allowedHostnames: [GOOGLE_DRIVE_API_HOST] },
56
- auditContext: "google-meet.drive.files.export",
57
- });
58
- try {
59
- if (!response.ok) {
60
- const detail = await response.text();
61
- throw await googleApiError({
62
- response,
63
- detail,
64
- prefix: "Google Drive files.export",
65
- scopes: [GOOGLE_DRIVE_MEET_SCOPE],
66
- });
67
- }
68
- return await response.text();
69
- } finally {
70
- await release();
71
- }
72
- }
@@ -1,20 +0,0 @@
1
- const REAUTH_HINT = "Re-run `openclaw googlemeet auth login` and store the refreshed oauth block.";
2
-
3
- function scopeText(scopes: readonly string[]): string {
4
- return scopes.map((scope) => `\`${scope}\``).join(", ");
5
- }
6
-
7
- export async function googleApiError(params: {
8
- response: Response;
9
- detail: string;
10
- prefix: string;
11
- scopes?: readonly string[];
12
- }): Promise<Error> {
13
- const scopeHint =
14
- params.scopes && params.scopes.length > 0
15
- ? ` Required OAuth scope: ${scopeText(params.scopes)}. ${REAUTH_HINT}`
16
- : "";
17
- return new Error(
18
- `${params.prefix} failed (${params.response.status}): ${params.detail}${scopeHint}`,
19
- );
20
- }