@tool-bridge/server 0.1.0 → 0.3.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/airtable-V6446SVY.js +792 -0
- package/dist/alt_text_generator_ai-HV7JZPDT.js +72 -0
- package/dist/amap-TTTVB6WS.js +755 -0
- package/dist/anthropic-JH3RA363.js +224 -0
- package/dist/apify-ETNN7ITU.js +262 -0
- package/dist/brave_search-3DDR2MMB.js +322 -0
- package/dist/chunk-CSJEZHQO.js +252 -0
- package/dist/chunk-JLTYA2B3.js +20121 -0
- package/dist/chunk-K7FVSFUX.js +333 -0
- package/dist/{chunk-6SMIQ6QU.js → chunk-KGYJEEBI.js} +2770 -21574
- package/dist/circleci-MX3TX3HC.js +409 -0
- package/dist/clerk-MRPORVF4.js +1036 -0
- package/dist/cloudflare_dns-OWP7DD7L.js +605 -0
- package/dist/cohere-GPECP66S.js +197 -0
- package/dist/confluence-BN7LZ6BC.js +436 -0
- package/dist/convertapi-SBEOFOFQ.js +161 -0
- package/dist/currencyapi-P2YY7Y7P.js +306 -0
- package/dist/deepseek-MWB3NYIN.js +205 -0
- package/dist/docker_hub-3JSCIGQ3.js +946 -0
- package/dist/dropbox-RFIBDAXO.js +1308 -0
- package/dist/dub-YVP57ELQ.js +706 -0
- package/dist/e2b-NFSUHTZR.js +305 -0
- package/dist/exa-KTDY6IV3.js +360 -0
- package/dist/fal_ai-OCUENLNQ.js +405 -0
- package/dist/feishu-5CWBQ7E5.js +225 -0
- package/dist/feishu_custom_bot-ZJR22OK6.js +240 -0
- package/dist/figma-YULGANSA.js +798 -0
- package/dist/firehydrant-2V6YSYAP.js +573 -0
- package/dist/fixer-LTCDB3CJ.js +171 -0
- package/dist/fly-IXPKMAML.js +478 -0
- package/dist/front-KRFB4M5X.js +379 -0
- package/dist/geocodio-VVURKYHQ.js +236 -0
- package/dist/ghost-6J2RIOUB.js +341 -0
- package/dist/github-5Z6KQRYH.js +5410 -0
- package/dist/gmail-KU4NZ7VA.js +1894 -0
- package/dist/googlecalendar-X44DFFXG.js +2539 -0
- package/dist/googledocs-WSGLPKSF.js +1322 -0
- package/dist/grafana-4PKSSDXY.js +817 -0
- package/dist/graphhopper-DF65ZNGK.js +336 -0
- package/dist/index.d.ts +181 -2
- package/dist/index.js +2 -1
- package/dist/ip2proxy-UCAQ5P2J.js +118 -0
- package/dist/ipgeolocation_io-UX6FCA2S.js +333 -0
- package/dist/ipqualityscore-MKTRXIZJ.js +287 -0
- package/dist/jina_ai-MRHPCSV5.js +119 -0
- package/dist/jira-EG7ZPOIW.js +627 -0
- package/dist/langsmith-FNO3RCOZ.js +597 -0
- package/dist/lemlist-SN6BJHSG.js +298 -0
- package/dist/linear-H3VU4PSD.js +2163 -0
- package/dist/logsnag-OY2JJT2H.js +167 -0
- package/dist/main.js +246 -2
- package/dist/mattermost-C5SQ7PGD.js +320 -0
- package/dist/mem0-LMLE5BFC.js +567 -0
- package/dist/memos-UWFAMBZC.js +781 -0
- package/dist/metabase-SRYDSDJ6.js +365 -0
- package/dist/mistral_ai-YNIJ7VDM.js +1195 -0
- package/dist/mother_duck-CPGOFEXE.js +322 -0
- package/dist/ngrok-CDJFBSOM.js +375 -0
- package/dist/notes-DIVFH3P3.js +109 -0
- package/dist/notion-HGDKS4HK.js +945 -0
- package/dist/open_exchange_rates-COHHYJDD.js +216 -0
- package/dist/openai-4TRT66GW.js +795 -0
- package/dist/opengraph_io-YKVW4PXI.js +377 -0
- package/dist/openrouter-6CV7B7V5.js +444 -0
- package/dist/outline-YWDUK5F7.js +604 -0
- package/dist/paddle-MEU7HWDZ.js +464 -0
- package/dist/perplexity-MRQUDBIC.js +238 -0
- package/dist/pinecone-JI7X2TAF.js +599 -0
- package/dist/pipedrive-6JQPAW23.js +453 -0
- package/dist/polar-7BF56CMC.js +400 -0
- package/dist/posthog-YPU5ADEN.js +3462 -0
- package/dist/postmark-BEU5OFKU.js +441 -0
- package/dist/prerender-UT5GOOZH.js +180 -0
- package/dist/pubmed-3SGOE24Q.js +1052 -0
- package/dist/railway-CEK4GLRQ.js +452 -0
- package/dist/readwise-DXQUQU67.js +482 -0
- package/dist/render-7TGAU5AW.js +473 -0
- package/dist/replicate-VICFSQ5A.js +347 -0
- package/dist/resend-3E76WK3O.js +100 -0
- package/dist/rootly-36GY46BY.js +345 -0
- package/dist/scrapfly-VDVUYAHX.js +289 -0
- package/dist/scrapingbee-3KTPMAVY.js +247 -0
- package/dist/screenshot_fyi-LKG62C3J.js +116 -0
- package/dist/semantic_scholar-4WREECYO.js +626 -0
- package/dist/sentry-HUQTGXOV.js +1139 -0
- package/dist/shodan-SGRKU4KS.js +303 -0
- package/dist/shopify-YCZ4L5HT.js +620 -0
- package/dist/stripe-OEBKMELB.js +583 -0
- package/dist/supabase-I3DBY7L4.js +937 -0
- package/dist/tavily-B2YHCNRD.js +349 -0
- package/dist/telegram-2VYJELZX.js +1773 -0
- package/dist/telnyx-HHXD3CXL.js +237 -0
- package/dist/todoist-PHFDEEIS.js +672 -0
- package/dist/trello-WUSAK6YN.js +1091 -0
- package/dist/turso-FW56U2B3.js +432 -0
- package/dist/twilio-M5JI7XHA.js +321 -0
- package/dist/umami-HAYODRC4.js +411 -0
- package/dist/unsplash-EDPTNEHJ.js +364 -0
- package/dist/upstash_redis-GC2CLIWD.js +299 -0
- package/dist/uptimerobot-XMSNYLIT.js +481 -0
- package/dist/v2ex-KU4ECD65.js +672 -0
- package/dist/vercel-THPCEFHW.js +1096 -0
- package/dist/wolfram_alpha_api-WHHTH4GU.js +212 -0
- package/dist/wordpress-O6TQEQNF.js +822 -0
- package/dist/workos-A3VHHWI3.js +681 -0
- package/dist/zhihu-BJAI64YJ.js +273 -0
- package/package.json +5 -4
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import {
|
|
2
|
+
assertPublicHttpUrl,
|
|
3
|
+
createProviderPlugin,
|
|
4
|
+
guardedFetch,
|
|
5
|
+
requireCredential,
|
|
6
|
+
upstreamError
|
|
7
|
+
} from "./chunk-CSJEZHQO.js";
|
|
8
|
+
import "./chunk-K7FVSFUX.js";
|
|
9
|
+
import {
|
|
10
|
+
TBError,
|
|
11
|
+
external_exports
|
|
12
|
+
} from "./chunk-JLTYA2B3.js";
|
|
13
|
+
import "./chunk-MLKGABMK.js";
|
|
14
|
+
|
|
15
|
+
// ../plugins/src/mattermost/api.ts
|
|
16
|
+
var SERVICE = "mattermost";
|
|
17
|
+
var API_PATH_PREFIX = "/api/v4";
|
|
18
|
+
var REQUEST_TIMEOUT_MS = 3e4;
|
|
19
|
+
var SINCE_CONFLICTING_FIELDS = ["page", "perPage", "beforePostId", "afterPostId"];
|
|
20
|
+
function text(value) {
|
|
21
|
+
if (typeof value !== "string") return void 0;
|
|
22
|
+
const trimmed = value.trim();
|
|
23
|
+
return trimmed === "" ? void 0 : trimmed;
|
|
24
|
+
}
|
|
25
|
+
function record(value) {
|
|
26
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
27
|
+
}
|
|
28
|
+
function invalidResponse(message) {
|
|
29
|
+
return new TBError("unavailable", message, { retryable: true });
|
|
30
|
+
}
|
|
31
|
+
function requireRecord(value, label) {
|
|
32
|
+
const result = record(value);
|
|
33
|
+
if (result === void 0) throw invalidResponse(`${label}\u4E0D\u662F\u5BF9\u8C61`);
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
function requireRecordArray(value, label) {
|
|
37
|
+
if (!Array.isArray(value)) throw invalidResponse(`${label}\u4E0D\u662F\u6570\u7EC4`);
|
|
38
|
+
return value.map((item, index) => requireRecord(item, `${label} \u7684\u7B2C ${index} \u9879`));
|
|
39
|
+
}
|
|
40
|
+
function requireText(value, field) {
|
|
41
|
+
const result = text(value);
|
|
42
|
+
if (result === void 0) throw new TBError("invalid_argument", `${field} \u662F\u5FC5\u586B\u7684`);
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
function pathSegment(value, field) {
|
|
46
|
+
const segment = requireText(value, field);
|
|
47
|
+
if (segment.includes("/") || segment.includes("?") || segment.includes("#")) {
|
|
48
|
+
throw new TBError("invalid_argument", `${field} \u5FC5\u987B\u662F\u5355\u4E2A Mattermost \u8DEF\u5F84\u6BB5`);
|
|
49
|
+
}
|
|
50
|
+
return encodeURIComponent(segment);
|
|
51
|
+
}
|
|
52
|
+
function apiBaseUrl(ctx) {
|
|
53
|
+
const raw = requireCredential(ctx, SERVICE, "instanceUrl");
|
|
54
|
+
const url = assertPublicHttpUrl(raw.includes("://") ? raw : `https://${raw}`);
|
|
55
|
+
if (url.protocol !== "https:") {
|
|
56
|
+
throw new TBError("invalid_argument", "instanceUrl \u5FC5\u987B\u7528 https");
|
|
57
|
+
}
|
|
58
|
+
if (url.username !== "" || url.password !== "") {
|
|
59
|
+
throw new TBError("invalid_argument", "instanceUrl \u4E0D\u80FD\u5185\u5D4C\u7528\u6237\u540D\u6216\u5BC6\u7801");
|
|
60
|
+
}
|
|
61
|
+
url.search = "";
|
|
62
|
+
url.hash = "";
|
|
63
|
+
const path = (url.pathname === "/" ? "" : url.pathname).replace(/\/+$/, "");
|
|
64
|
+
url.pathname = path.endsWith(API_PATH_PREFIX) ? path.slice(0, -API_PATH_PREFIX.length) : path;
|
|
65
|
+
return `${url.toString().replace(/\/$/, "")}${API_PATH_PREFIX}`;
|
|
66
|
+
}
|
|
67
|
+
async function readPayload(response) {
|
|
68
|
+
const body = await response.text();
|
|
69
|
+
if (body === "") return null;
|
|
70
|
+
try {
|
|
71
|
+
return JSON.parse(body);
|
|
72
|
+
} catch {
|
|
73
|
+
if (response.ok) throw invalidResponse("Mattermost \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94");
|
|
74
|
+
return { message: body };
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function errorMessage(payload, status) {
|
|
78
|
+
const body = record(payload);
|
|
79
|
+
return text(body?.message) ?? text(body?.error) ?? text(body?.details) ?? text(body?.id) ?? `Mattermost \u8FD4\u56DE HTTP ${status}`;
|
|
80
|
+
}
|
|
81
|
+
async function request(ctx, input) {
|
|
82
|
+
const url = new URL(`${apiBaseUrl(ctx)}${input.path}`);
|
|
83
|
+
for (const [key, value] of Object.entries(input.query ?? {})) {
|
|
84
|
+
if (value !== void 0) url.searchParams.set(key, String(value));
|
|
85
|
+
}
|
|
86
|
+
const headers = {
|
|
87
|
+
accept: "application/json",
|
|
88
|
+
authorization: `Bearer ${requireCredential(ctx, SERVICE, "apiKey")}`
|
|
89
|
+
};
|
|
90
|
+
if (input.body !== void 0) headers["content-type"] = "application/json";
|
|
91
|
+
let response;
|
|
92
|
+
try {
|
|
93
|
+
response = await guardedFetch(url.toString(), {
|
|
94
|
+
method: input.method ?? "GET",
|
|
95
|
+
headers,
|
|
96
|
+
body: input.body === void 0 ? void 0 : JSON.stringify(input.body),
|
|
97
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
98
|
+
});
|
|
99
|
+
} catch (error) {
|
|
100
|
+
if (error instanceof TBError) throw error;
|
|
101
|
+
if (error instanceof Error && error.name === "TimeoutError") {
|
|
102
|
+
throw upstreamError(504, `Mattermost \u8BF7\u6C42\u8D85\u65F6(${REQUEST_TIMEOUT_MS / 1e3} \u79D2)`);
|
|
103
|
+
}
|
|
104
|
+
const message = error instanceof Error ? error.message : "unknown network error";
|
|
105
|
+
throw upstreamError(502, `Mattermost \u8BF7\u6C42\u5931\u8D25:${message}`);
|
|
106
|
+
}
|
|
107
|
+
const payload = await readPayload(response);
|
|
108
|
+
if (!response.ok) throw upstreamError(response.status, errorMessage(payload, response.status));
|
|
109
|
+
return payload;
|
|
110
|
+
}
|
|
111
|
+
async function getCurrentUser(_input, ctx) {
|
|
112
|
+
const payload = await request(ctx, { path: "/users/me" });
|
|
113
|
+
return { user: requireRecord(payload, "Mattermost \u7528\u6237"), raw: payload };
|
|
114
|
+
}
|
|
115
|
+
async function listUserTeams(_input, ctx) {
|
|
116
|
+
const payload = await request(ctx, { path: "/users/me/teams" });
|
|
117
|
+
return { teams: requireRecordArray(payload, "Mattermost \u56E2\u961F\u5217\u8868"), raw: payload };
|
|
118
|
+
}
|
|
119
|
+
async function getTeam(input, ctx) {
|
|
120
|
+
const payload = await request(ctx, { path: `/teams/${pathSegment(input.teamId, "teamId")}` });
|
|
121
|
+
return { team: requireRecord(payload, "Mattermost \u56E2\u961F"), raw: payload };
|
|
122
|
+
}
|
|
123
|
+
async function listTeamChannels(input, ctx) {
|
|
124
|
+
const payload = await request(ctx, {
|
|
125
|
+
path: `/teams/${pathSegment(input.teamId, "teamId")}/channels`,
|
|
126
|
+
query: { page: input.page, per_page: input.perPage }
|
|
127
|
+
});
|
|
128
|
+
return { channels: requireRecordArray(payload, "Mattermost \u9891\u9053\u5217\u8868"), raw: payload };
|
|
129
|
+
}
|
|
130
|
+
async function getChannel(input, ctx) {
|
|
131
|
+
const payload = await request(ctx, { path: `/channels/${pathSegment(input.channelId, "channelId")}` });
|
|
132
|
+
return { channel: requireRecord(payload, "Mattermost \u9891\u9053"), raw: payload };
|
|
133
|
+
}
|
|
134
|
+
function normalizePostList(payload) {
|
|
135
|
+
const raw = requireRecord(payload, "Mattermost \u5E16\u5B50\u5217\u8868");
|
|
136
|
+
const order = Array.isArray(raw.order) ? raw.order.filter((item) => typeof item === "string") : [];
|
|
137
|
+
const postsById = record(raw.posts);
|
|
138
|
+
const posts = postsById !== void 0 && order.length > 0 ? order.map((id) => record(postsById[id]) ?? { id }) : Object.values(postsById ?? {}).map((item) => record(item) ?? { value: item });
|
|
139
|
+
return { posts, order, raw };
|
|
140
|
+
}
|
|
141
|
+
async function listChannelPosts(input, ctx) {
|
|
142
|
+
if (input.since !== void 0) {
|
|
143
|
+
const conflicting = SINCE_CONFLICTING_FIELDS.filter((field) => input[field] !== void 0);
|
|
144
|
+
if (conflicting.length > 0) {
|
|
145
|
+
throw new TBError(
|
|
146
|
+
"invalid_argument",
|
|
147
|
+
`since \u4E0D\u80FD\u4E0E ${SINCE_CONFLICTING_FIELDS.join(" / ")} \u540C\u65F6\u4F7F\u7528(\u672C\u6B21\u7ED9\u4E86 ${conflicting.join(" / ")})`
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
const payload = await request(ctx, {
|
|
152
|
+
path: `/channels/${pathSegment(input.channelId, "channelId")}/posts`,
|
|
153
|
+
// 见文件头第 1 条:这四个参数在 wire 上是另一套名字。
|
|
154
|
+
query: {
|
|
155
|
+
page: input.page,
|
|
156
|
+
per_page: input.perPage,
|
|
157
|
+
since: input.since,
|
|
158
|
+
before: text(input.beforePostId),
|
|
159
|
+
after: text(input.afterPostId)
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
return normalizePostList(payload);
|
|
163
|
+
}
|
|
164
|
+
async function createPost(input, ctx) {
|
|
165
|
+
const rootId = text(input.rootId);
|
|
166
|
+
const props = record(input.props);
|
|
167
|
+
const payload = await request(ctx, {
|
|
168
|
+
path: "/posts",
|
|
169
|
+
method: "POST",
|
|
170
|
+
body: {
|
|
171
|
+
channel_id: requireText(input.channelId, "channelId"),
|
|
172
|
+
message: requireText(input.message, "message"),
|
|
173
|
+
// 缺省时整个键不发(上游 `compactObject`):发 `null` 会被 Mattermost 当成非法入参。
|
|
174
|
+
...rootId === void 0 ? {} : { root_id: rootId },
|
|
175
|
+
...props === void 0 ? {} : { props }
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
return { post: requireRecord(payload, "Mattermost \u5E16\u5B50"), raw: payload };
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// ../plugins/src/mattermost/schema.ts
|
|
182
|
+
var getCurrentUserInput = external_exports.strictObject({}).describe("No input parameters are required.");
|
|
183
|
+
var getCurrentUserOutput = external_exports.strictObject({
|
|
184
|
+
user: external_exports.looseObject({}).describe("A Mattermost API entity object.").optional(),
|
|
185
|
+
raw: external_exports.unknown().describe("The raw Mattermost API JSON response.").optional()
|
|
186
|
+
}).describe("Output payload for the current Mattermost user.");
|
|
187
|
+
var listUserTeamsInput = external_exports.strictObject({}).describe("No input parameters are required.");
|
|
188
|
+
var listUserTeamsOutput = external_exports.strictObject({
|
|
189
|
+
teams: external_exports.array(external_exports.looseObject({}).describe("A Mattermost API entity object.")).describe("Mattermost teams returned by the API.").optional(),
|
|
190
|
+
raw: external_exports.unknown().describe("The raw Mattermost API JSON response.").optional()
|
|
191
|
+
}).describe("Output payload for Mattermost teams.");
|
|
192
|
+
var getTeamInput = external_exports.strictObject({
|
|
193
|
+
teamId: external_exports.string().min(1).describe("A Mattermost object ID.").optional()
|
|
194
|
+
}).describe("Input parameters for retrieving one Mattermost team.");
|
|
195
|
+
var getTeamOutput = external_exports.strictObject({
|
|
196
|
+
team: external_exports.looseObject({}).describe("A Mattermost API entity object.").optional(),
|
|
197
|
+
raw: external_exports.unknown().describe("The raw Mattermost API JSON response.").optional()
|
|
198
|
+
}).describe("Output payload for one Mattermost team.");
|
|
199
|
+
var listTeamChannelsInput = external_exports.strictObject({
|
|
200
|
+
teamId: external_exports.string().min(1).describe("A Mattermost object ID."),
|
|
201
|
+
page: external_exports.int().min(0).describe("The zero-based page number to request.").optional(),
|
|
202
|
+
perPage: external_exports.int().min(1).describe("The number of records to request per page.").optional()
|
|
203
|
+
}).describe("Query parameters for listing Mattermost channels in a team.");
|
|
204
|
+
var listTeamChannelsOutput = external_exports.strictObject({
|
|
205
|
+
channels: external_exports.array(external_exports.looseObject({}).describe("A Mattermost API entity object.")).describe("Mattermost channels returned by the API.").optional(),
|
|
206
|
+
raw: external_exports.unknown().describe("The raw Mattermost API JSON response.").optional()
|
|
207
|
+
}).describe("Output payload for Mattermost channels.");
|
|
208
|
+
var getChannelInput = external_exports.strictObject({
|
|
209
|
+
channelId: external_exports.string().min(1).describe("A Mattermost object ID.").optional()
|
|
210
|
+
}).describe("Input parameters for retrieving one Mattermost channel.");
|
|
211
|
+
var getChannelOutput = external_exports.strictObject({
|
|
212
|
+
channel: external_exports.looseObject({}).describe("A Mattermost API entity object.").optional(),
|
|
213
|
+
raw: external_exports.unknown().describe("The raw Mattermost API JSON response.").optional()
|
|
214
|
+
}).describe("Output payload for one Mattermost channel.");
|
|
215
|
+
var listChannelPostsInput = external_exports.strictObject({
|
|
216
|
+
channelId: external_exports.string().min(1).describe("A Mattermost object ID."),
|
|
217
|
+
page: external_exports.int().min(0).describe("The zero-based page number to request.").optional(),
|
|
218
|
+
perPage: external_exports.int().min(1).describe("The number of records to request per page.").optional(),
|
|
219
|
+
since: external_exports.int().min(0).describe("Only return posts created after this Unix timestamp in milliseconds.").optional(),
|
|
220
|
+
beforePostId: external_exports.string().min(1).describe("Return posts before this Mattermost post ID.").optional(),
|
|
221
|
+
afterPostId: external_exports.string().min(1).describe("Return posts after this Mattermost post ID.").optional()
|
|
222
|
+
}).describe("Query parameters for listing posts in a Mattermost channel. since cannot be used with page, perPage, beforePostId, or afterPostId.");
|
|
223
|
+
var listChannelPostsOutput = external_exports.strictObject({
|
|
224
|
+
posts: external_exports.array(external_exports.looseObject({}).describe("A Mattermost post object.")).describe("Mattermost posts returned by the API in response order.").optional(),
|
|
225
|
+
order: external_exports.array(external_exports.string().min(1).describe("A Mattermost object ID.")).describe("Mattermost post IDs in response order.").optional(),
|
|
226
|
+
raw: external_exports.unknown().describe("The raw Mattermost API JSON response.").optional()
|
|
227
|
+
}).describe("Output payload for Mattermost channel posts.");
|
|
228
|
+
var createPostInput = external_exports.strictObject({
|
|
229
|
+
channelId: external_exports.string().min(1).describe("A Mattermost object ID."),
|
|
230
|
+
message: external_exports.string().min(1).describe("The Markdown message body to post."),
|
|
231
|
+
rootId: external_exports.string().min(1).describe("Optional root post ID for replying in a thread.").optional(),
|
|
232
|
+
props: external_exports.looseObject({}).describe("Optional Mattermost post props object.").optional()
|
|
233
|
+
}).describe("Input parameters for creating a Mattermost channel post.");
|
|
234
|
+
var createPostOutput = external_exports.strictObject({
|
|
235
|
+
post: external_exports.looseObject({}).describe("A Mattermost post object.").optional(),
|
|
236
|
+
raw: external_exports.unknown().describe("The raw Mattermost API JSON response.").optional()
|
|
237
|
+
}).describe("Output payload for a created Mattermost post.");
|
|
238
|
+
var mattermostActions = {
|
|
239
|
+
get_current_user: {
|
|
240
|
+
description: "Get the Mattermost user associated with the Personal Access Token.",
|
|
241
|
+
effect: "read",
|
|
242
|
+
inputSchema: getCurrentUserInput,
|
|
243
|
+
outputSchema: external_exports.toJSONSchema(getCurrentUserOutput, { io: "output", unrepresentable: "any" })
|
|
244
|
+
},
|
|
245
|
+
list_user_teams: {
|
|
246
|
+
description: "List Mattermost teams visible to the current user.",
|
|
247
|
+
effect: "read",
|
|
248
|
+
inputSchema: listUserTeamsInput,
|
|
249
|
+
outputSchema: external_exports.toJSONSchema(listUserTeamsOutput, { io: "output", unrepresentable: "any" })
|
|
250
|
+
},
|
|
251
|
+
get_team: {
|
|
252
|
+
description: "Retrieve one Mattermost team by ID.",
|
|
253
|
+
effect: "read",
|
|
254
|
+
inputSchema: getTeamInput,
|
|
255
|
+
outputSchema: external_exports.toJSONSchema(getTeamOutput, { io: "output", unrepresentable: "any" })
|
|
256
|
+
},
|
|
257
|
+
list_team_channels: {
|
|
258
|
+
description: "List public Mattermost channels in a team.",
|
|
259
|
+
effect: "read",
|
|
260
|
+
inputSchema: listTeamChannelsInput,
|
|
261
|
+
outputSchema: external_exports.toJSONSchema(listTeamChannelsOutput, { io: "output", unrepresentable: "any" })
|
|
262
|
+
},
|
|
263
|
+
get_channel: {
|
|
264
|
+
description: "Retrieve one Mattermost channel by ID.",
|
|
265
|
+
effect: "read",
|
|
266
|
+
inputSchema: getChannelInput,
|
|
267
|
+
outputSchema: external_exports.toJSONSchema(getChannelOutput, { io: "output", unrepresentable: "any" })
|
|
268
|
+
},
|
|
269
|
+
list_channel_posts: {
|
|
270
|
+
description: "List Mattermost posts in a channel.",
|
|
271
|
+
effect: "read",
|
|
272
|
+
inputSchema: listChannelPostsInput,
|
|
273
|
+
outputSchema: external_exports.toJSONSchema(listChannelPostsOutput, { io: "output", unrepresentable: "any" })
|
|
274
|
+
},
|
|
275
|
+
create_post: {
|
|
276
|
+
description: "Create a Mattermost post in a channel.",
|
|
277
|
+
effect: "write",
|
|
278
|
+
inputSchema: createPostInput,
|
|
279
|
+
outputSchema: external_exports.toJSONSchema(createPostOutput, { io: "output", unrepresentable: "any" })
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
// ../plugins/src/mattermost/index.ts
|
|
284
|
+
function createMattermostPlugin() {
|
|
285
|
+
return createProviderPlugin({
|
|
286
|
+
description: "Mattermost",
|
|
287
|
+
credentialFields: [
|
|
288
|
+
{
|
|
289
|
+
key: "apiKey",
|
|
290
|
+
label: "Personal access token",
|
|
291
|
+
required: true,
|
|
292
|
+
secret: true,
|
|
293
|
+
description: "Mattermost \u4E2A\u4EBA\u8BBF\u95EE\u4EE4\u724C,\u4EE5 Bearer \u53D1\u9001;\u5728\u8D26\u53F7\u8BBE\u7F6E\u7684 Security \u2192 Personal Access Tokens \u91CC\u521B\u5EFA"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
key: "instanceUrl",
|
|
297
|
+
label: "Instance URL",
|
|
298
|
+
required: true,
|
|
299
|
+
secret: false,
|
|
300
|
+
description: "Mattermost \u5B9E\u4F8B\u7684\u6839\u5730\u5740(https://mattermost.example.com,\u5E26 /api/v4 \u540E\u7F00\u4E5F\u80FD\u8BC6\u522B);\u5FC5\u987B\u662F https \u7684\u516C\u7F51\u53EF\u8FBE\u5730\u5740,\u79C1\u6709\u7F51\u6BB5\u4F1A\u88AB\u51FA\u7AD9\u7B56\u7565\u62E6\u4E0B"
|
|
301
|
+
}
|
|
302
|
+
],
|
|
303
|
+
credentialProbe: "get_current_user",
|
|
304
|
+
actions: mattermostActions,
|
|
305
|
+
handlers: {
|
|
306
|
+
get_current_user: getCurrentUser,
|
|
307
|
+
list_user_teams: listUserTeams,
|
|
308
|
+
get_team: getTeam,
|
|
309
|
+
list_team_channels: listTeamChannels,
|
|
310
|
+
get_channel: getChannel,
|
|
311
|
+
list_channel_posts: listChannelPosts,
|
|
312
|
+
create_post: createPost
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
var mattermost_default = createMattermostPlugin();
|
|
317
|
+
export {
|
|
318
|
+
createMattermostPlugin,
|
|
319
|
+
mattermost_default as default
|
|
320
|
+
};
|