runline 0.5.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/plugins/_shared/googleAuth.js +113 -0
- package/dist/plugins/gmail/src/index.js +30 -42
- package/dist/plugins/googleCalendar/src/index.js +30 -42
- package/dist/plugins/googleContacts/src/index.js +10 -41
- package/dist/plugins/googleDocs/src/index.js +10 -41
- package/dist/plugins/googleDrive/src/index.js +30 -42
- package/dist/plugins/googleSheets/src/index.js +30 -41
- package/dist/plugins/googleSlides/src/index.js +10 -41
- package/dist/plugins/googleTasks/src/index.js +10 -41
- package/dist/plugins/linear/src/index.js +986 -128
- package/package.json +1 -1
|
@@ -20,45 +20,10 @@
|
|
|
20
20
|
* `POST /v1/presentations/{id}:batchUpdate` endpoint.
|
|
21
21
|
*/
|
|
22
22
|
import { writeFileSync } from "node:fs";
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const REFRESH_SKEW_MS = 60_000;
|
|
26
|
-
async function refreshAccessToken(ctx) {
|
|
27
|
-
const cfg = ctx.connection.config;
|
|
28
|
-
const { clientId, clientSecret, refreshToken } = cfg;
|
|
29
|
-
if (!clientId || !clientSecret || !refreshToken) {
|
|
30
|
-
throw new Error("googleSlides: missing clientId/clientSecret/refreshToken. Run the Slides OAuth helper to seed these.");
|
|
31
|
-
}
|
|
32
|
-
const body = new URLSearchParams({
|
|
33
|
-
client_id: clientId,
|
|
34
|
-
client_secret: clientSecret,
|
|
35
|
-
refresh_token: refreshToken,
|
|
36
|
-
grant_type: "refresh_token",
|
|
37
|
-
});
|
|
38
|
-
const res = await fetch(TOKEN_ENDPOINT, {
|
|
39
|
-
method: "POST",
|
|
40
|
-
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
41
|
-
body: body.toString(),
|
|
42
|
-
});
|
|
43
|
-
if (!res.ok) {
|
|
44
|
-
throw new Error(`googleSlides: token refresh failed (${res.status}): ${await res.text()}`);
|
|
45
|
-
}
|
|
46
|
-
const data = (await res.json());
|
|
47
|
-
const expiresAt = Date.now() + data.expires_in * 1000;
|
|
48
|
-
await ctx.updateConnection({
|
|
49
|
-
accessToken: data.access_token,
|
|
50
|
-
accessTokenExpiresAt: expiresAt,
|
|
51
|
-
});
|
|
52
|
-
return data.access_token;
|
|
53
|
-
}
|
|
23
|
+
import { googleAccessToken } from "../../_shared/googleAuth.js";
|
|
24
|
+
// ─── Auth ────────────────────────────────────────────────────────
|
|
54
25
|
async function accessToken(ctx) {
|
|
55
|
-
|
|
56
|
-
if (cfg.accessToken &&
|
|
57
|
-
typeof cfg.accessTokenExpiresAt === "number" &&
|
|
58
|
-
Date.now() < cfg.accessTokenExpiresAt - REFRESH_SKEW_MS) {
|
|
59
|
-
return cfg.accessToken;
|
|
60
|
-
}
|
|
61
|
-
return refreshAccessToken(ctx);
|
|
26
|
+
return googleAccessToken(ctx, "googleSlides", SCOPES);
|
|
62
27
|
}
|
|
63
28
|
// ─── Request ─────────────────────────────────────────────────────
|
|
64
29
|
const API_BASE = "https://slides.googleapis.com/v1";
|
|
@@ -144,9 +109,13 @@ export default function googleSlides(rl) {
|
|
|
144
109
|
],
|
|
145
110
|
});
|
|
146
111
|
rl.setConnectionSchema({
|
|
147
|
-
clientId: { type: "string", required:
|
|
148
|
-
clientSecret: { type: "string", required:
|
|
149
|
-
refreshToken: { type: "string", required:
|
|
112
|
+
clientId: { type: "string", required: false, env: "GOOGLE_SLIDES_CLIENT_ID" },
|
|
113
|
+
clientSecret: { type: "string", required: false, env: "GOOGLE_SLIDES_CLIENT_SECRET" },
|
|
114
|
+
refreshToken: { type: "string", required: false, env: "GOOGLE_SLIDES_REFRESH_TOKEN" },
|
|
115
|
+
serviceAccountJson: { type: "string", required: false, env: "GOOGLE_SLIDES_SERVICE_ACCOUNT_JSON" },
|
|
116
|
+
serviceAccountEmail: { type: "string", required: false, env: "GOOGLE_SLIDES_SERVICE_ACCOUNT_EMAIL" },
|
|
117
|
+
serviceAccountPrivateKey: { type: "string", required: false, env: "GOOGLE_SLIDES_SERVICE_ACCOUNT_PRIVATE_KEY" },
|
|
118
|
+
serviceAccountSubject: { type: "string", required: false, env: "GOOGLE_SLIDES_SERVICE_ACCOUNT_SUBJECT" },
|
|
150
119
|
accessToken: { type: "string", required: false },
|
|
151
120
|
accessTokenExpiresAt: { type: "number", required: false },
|
|
152
121
|
});
|
|
@@ -19,45 +19,10 @@
|
|
|
19
19
|
* Google's Tasks API is strict about RFC3339 with a timezone — we
|
|
20
20
|
* normalize ISO input via `Date.toISOString()` when detected.
|
|
21
21
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const REFRESH_SKEW_MS = 60_000;
|
|
25
|
-
async function refreshAccessToken(ctx) {
|
|
26
|
-
const cfg = ctx.connection.config;
|
|
27
|
-
const { clientId, clientSecret, refreshToken } = cfg;
|
|
28
|
-
if (!clientId || !clientSecret || !refreshToken) {
|
|
29
|
-
throw new Error("googleTasks: missing clientId/clientSecret/refreshToken. Run the Tasks OAuth helper to seed these.");
|
|
30
|
-
}
|
|
31
|
-
const body = new URLSearchParams({
|
|
32
|
-
client_id: clientId,
|
|
33
|
-
client_secret: clientSecret,
|
|
34
|
-
refresh_token: refreshToken,
|
|
35
|
-
grant_type: "refresh_token",
|
|
36
|
-
});
|
|
37
|
-
const res = await fetch(TOKEN_ENDPOINT, {
|
|
38
|
-
method: "POST",
|
|
39
|
-
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
40
|
-
body: body.toString(),
|
|
41
|
-
});
|
|
42
|
-
if (!res.ok) {
|
|
43
|
-
throw new Error(`googleTasks: token refresh failed (${res.status}): ${await res.text()}`);
|
|
44
|
-
}
|
|
45
|
-
const data = (await res.json());
|
|
46
|
-
const expiresAt = Date.now() + data.expires_in * 1000;
|
|
47
|
-
await ctx.updateConnection({
|
|
48
|
-
accessToken: data.access_token,
|
|
49
|
-
accessTokenExpiresAt: expiresAt,
|
|
50
|
-
});
|
|
51
|
-
return data.access_token;
|
|
52
|
-
}
|
|
22
|
+
import { googleAccessToken } from "../../_shared/googleAuth.js";
|
|
23
|
+
// ─── Auth ────────────────────────────────────────────────────────
|
|
53
24
|
async function accessToken(ctx) {
|
|
54
|
-
|
|
55
|
-
if (cfg.accessToken &&
|
|
56
|
-
typeof cfg.accessTokenExpiresAt === "number" &&
|
|
57
|
-
Date.now() < cfg.accessTokenExpiresAt - REFRESH_SKEW_MS) {
|
|
58
|
-
return cfg.accessToken;
|
|
59
|
-
}
|
|
60
|
-
return refreshAccessToken(ctx);
|
|
25
|
+
return googleAccessToken(ctx, "googleTasks", SCOPES);
|
|
61
26
|
}
|
|
62
27
|
// ─── Request ─────────────────────────────────────────────────────
|
|
63
28
|
const API_BASE = "https://tasks.googleapis.com/tasks/v1";
|
|
@@ -162,9 +127,13 @@ export default function googleTasks(rl) {
|
|
|
162
127
|
],
|
|
163
128
|
});
|
|
164
129
|
rl.setConnectionSchema({
|
|
165
|
-
clientId: { type: "string", required:
|
|
166
|
-
clientSecret: { type: "string", required:
|
|
167
|
-
refreshToken: { type: "string", required:
|
|
130
|
+
clientId: { type: "string", required: false, env: "GOOGLE_TASKS_CLIENT_ID" },
|
|
131
|
+
clientSecret: { type: "string", required: false, env: "GOOGLE_TASKS_CLIENT_SECRET" },
|
|
132
|
+
refreshToken: { type: "string", required: false, env: "GOOGLE_TASKS_REFRESH_TOKEN" },
|
|
133
|
+
serviceAccountJson: { type: "string", required: false, env: "GOOGLE_TASKS_SERVICE_ACCOUNT_JSON" },
|
|
134
|
+
serviceAccountEmail: { type: "string", required: false, env: "GOOGLE_TASKS_SERVICE_ACCOUNT_EMAIL" },
|
|
135
|
+
serviceAccountPrivateKey: { type: "string", required: false, env: "GOOGLE_TASKS_SERVICE_ACCOUNT_PRIVATE_KEY" },
|
|
136
|
+
serviceAccountSubject: { type: "string", required: false, env: "GOOGLE_TASKS_SERVICE_ACCOUNT_SUBJECT" },
|
|
168
137
|
accessToken: { type: "string", required: false },
|
|
169
138
|
accessTokenExpiresAt: { type: "number", required: false },
|
|
170
139
|
});
|