runline 0.8.1 → 0.9.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/plugin/loader.js +41 -25
- package/dist/plugins/linear/src/attachments.js +29 -7
- package/dist/plugins/linear/src/comments.js +20 -6
- package/dist/plugins/linear/src/cycles.js +3 -1
- package/dist/plugins/linear/src/index.js +4 -0
- package/dist/plugins/linear/src/initiatives.js +9 -4
- package/dist/plugins/linear/src/issues.js +29 -7
- package/dist/plugins/linear/src/labels.js +6 -1
- package/dist/plugins/linear/src/organization.js +2 -1
- package/dist/plugins/linear/src/projects.js +12 -1
- package/dist/plugins/linear/src/shared.js +103 -0
- package/dist/plugins/linear/src/states.js +3 -1
- package/dist/plugins/linear/src/teams.js +4 -1
- package/dist/plugins/linear/src/users.js +2 -1
- package/dist/plugins/linear/src/views.js +24 -15
- package/dist/plugins/linear/src/webhooks.js +5 -1
- package/dist/plugins/vercel/src/account.js +11 -0
- package/dist/plugins/vercel/src/deployments.js +79 -0
- package/dist/plugins/vercel/src/env.js +101 -0
- package/dist/plugins/vercel/src/index.js +27 -0
- package/dist/plugins/vercel/src/projects.js +29 -0
- package/dist/plugins/vercel/src/shared.js +73 -0
- package/package.json +1 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import * as t from "typebox";
|
|
2
|
+
const BASE_URL = "https://api.vercel.com";
|
|
3
|
+
export function token(ctx) {
|
|
4
|
+
return ctx.connection.config.token;
|
|
5
|
+
}
|
|
6
|
+
export async function api(ctx, path, options = {}) {
|
|
7
|
+
const url = new URL(path, BASE_URL);
|
|
8
|
+
const query = {
|
|
9
|
+
teamId: ctx.connection.config.teamId,
|
|
10
|
+
slug: ctx.connection.config.slug,
|
|
11
|
+
...(options.query ?? {}),
|
|
12
|
+
};
|
|
13
|
+
for (const [key, value] of Object.entries(query)) {
|
|
14
|
+
if (value === undefined || value === null || value === "")
|
|
15
|
+
continue;
|
|
16
|
+
if (Array.isArray(value)) {
|
|
17
|
+
for (const item of value)
|
|
18
|
+
url.searchParams.append(key, String(item));
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
url.searchParams.set(key, String(value));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const init = {
|
|
25
|
+
method: options.method ?? "GET",
|
|
26
|
+
headers: {
|
|
27
|
+
Authorization: `Bearer ${token(ctx)}`,
|
|
28
|
+
"Content-Type": "application/json",
|
|
29
|
+
...(options.headers ?? {}),
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
if (options.body !== undefined)
|
|
33
|
+
init.body = JSON.stringify(options.body);
|
|
34
|
+
const res = await fetch(url.toString(), init);
|
|
35
|
+
const text = await res.text();
|
|
36
|
+
if (!res.ok) {
|
|
37
|
+
throw new Error(`Vercel API error ${res.status}: ${text || res.statusText}`);
|
|
38
|
+
}
|
|
39
|
+
if (!text)
|
|
40
|
+
return {};
|
|
41
|
+
const contentType = res.headers.get("content-type") ?? "";
|
|
42
|
+
if (contentType.includes("application/json") || text.startsWith("{") || text.startsWith("[")) {
|
|
43
|
+
return JSON.parse(text);
|
|
44
|
+
}
|
|
45
|
+
return text;
|
|
46
|
+
}
|
|
47
|
+
export const TEAM_INPUT_SCHEMA = {
|
|
48
|
+
teamId: t.Optional(t.String({ description: "Override the configured Vercel Team ID for this call" })),
|
|
49
|
+
slug: t.Optional(t.String({ description: "Override the configured Vercel Team slug for this call" })),
|
|
50
|
+
};
|
|
51
|
+
export const LIST_INPUT_SCHEMA = {
|
|
52
|
+
...TEAM_INPUT_SCHEMA,
|
|
53
|
+
limit: t.Optional(t.Number({ description: "Maximum number of results" })),
|
|
54
|
+
since: t.Optional(t.Number({ description: "Timestamp in milliseconds to start from" })),
|
|
55
|
+
until: t.Optional(t.Number({ description: "Timestamp in milliseconds to end at" })),
|
|
56
|
+
from: t.Optional(t.Number({ description: "Pagination timestamp/cursor supported by Vercel" })),
|
|
57
|
+
to: t.Optional(t.Number({ description: "Pagination timestamp/cursor supported by Vercel" })),
|
|
58
|
+
};
|
|
59
|
+
export function bindGetAction(rl) {
|
|
60
|
+
return (name, description, pathForId) => {
|
|
61
|
+
rl.registerAction(name, {
|
|
62
|
+
description,
|
|
63
|
+
inputSchema: t.Object({
|
|
64
|
+
id: t.String({ description: "Resource ID, name, or URL" }),
|
|
65
|
+
...TEAM_INPUT_SCHEMA,
|
|
66
|
+
}),
|
|
67
|
+
async execute(input, ctx) {
|
|
68
|
+
const { id, ...query } = input;
|
|
69
|
+
return api(ctx, pathForId(id), { query });
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
}
|