@tool-bridge/server 0.20.0 → 0.21.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-ZNWHIJMO.js → airtable-DMJEEGJP.js} +19 -16
- package/dist/{alt_text_generator_ai-X7RMDDM5.js → alt_text_generator_ai-RELFQ5FV.js} +4 -4
- package/dist/{amap-3VER75VH.js → amap-YSYEACKQ.js} +4 -4
- package/dist/{anthropic-N7NTB3UC.js → anthropic-D5X5GSYE.js} +23 -25
- package/dist/{apify-JB5P5AJI.js → apify-5NVFU3IZ.js} +20 -19
- package/dist/{brave_search-USL5OOBS.js → brave_search-X557FMGO.js} +16 -14
- package/dist/chunk-JEWFX6Z6.js +71 -0
- package/dist/{chunk-RVUERWUZ.js → chunk-MDY7K5CX.js} +748 -788
- package/dist/{chunk-WIGQCP6O.js → chunk-MZCIPUNQ.js} +141 -176
- package/dist/{chunk-6X55ALDX.js → chunk-Q74GLIDK.js} +3 -3
- package/dist/{chunk-6ANLYNFB.js → chunk-QR4LK3HF.js} +1 -1
- package/dist/{chunk-3WL6EXYX.js → chunk-ZTTN6AJG.js} +1 -1
- package/dist/{circleci-LBGB25LP.js → circleci-3P3QTUX2.js} +20 -24
- package/dist/{clerk-6RX37CNZ.js → clerk-GNMZQ2MY.js} +22 -21
- package/dist/{cloudflare_dns-NQGW7FHV.js → cloudflare_dns-VWZH3ZTR.js} +21 -17
- package/dist/{cohere-XPC2NAEW.js → cohere-C7QVIIMG.js} +19 -17
- package/dist/{confluence-ZUG2LT5A.js → confluence-52I37IUT.js} +16 -11
- package/dist/{convertapi-ZLXKWV3L.js → convertapi-3TRJ3WEO.js} +3 -3
- package/dist/{currencyapi-T3A3HSOD.js → currencyapi-LWEANWVI.js} +23 -26
- package/dist/{deepseek-NJMOD23E.js → deepseek-5U24YG4P.js} +27 -17
- package/dist/{docker_hub-D2MQCSJ7.js → docker_hub-CMISLRSE.js} +4 -4
- package/dist/{dropbox-MI6U3SOT.js → dropbox-TW4QN6FT.js} +9 -8
- package/dist/{dub-P2BYBYV4.js → dub-EFXGI5UH.js} +22 -19
- package/dist/{e2b-BGKIAE54.js → e2b-PHM63OVF.js} +20 -20
- package/dist/{exa-EUY7VV4C.js → exa-DYOQWURR.js} +22 -25
- package/dist/{fal_ai-AAOG5FYJ.js → fal_ai-VJPMCNRH.js} +18 -17
- package/dist/{feishu-AN5IJYOW.js → feishu-TFIZXPIN.js} +2 -2
- package/dist/{feishu_custom_bot-BWGMNVXF.js → feishu_custom_bot-ADSE23KU.js} +3 -3
- package/dist/{figma-SJSWYCGD.js → figma-4AK47AYY.js} +21 -23
- package/dist/{firehydrant-MOXK2PST.js → firehydrant-RGPTW4EA.js} +15 -15
- package/dist/{fixer-ISIDUDZU.js → fixer-OAMF4DKP.js} +4 -4
- package/dist/{fly-U4KPSGBF.js → fly-YB4AQD4O.js} +20 -16
- package/dist/{front-ZHM2YX2E.js → front-6GTVYKUM.js} +20 -23
- package/dist/{geocodio-SVCCAXAV.js → geocodio-YRT4K25M.js} +4 -4
- package/dist/{ghost-INTR7FIY.js → ghost-JCW6UIP2.js} +4 -4
- package/dist/{github-T275VVWR.js → github-CEGVRMNX.js} +28 -27
- package/dist/{gmail-KSSPOE67.js → gmail-JCMJD55P.js} +17 -17
- package/dist/{googlecalendar-JB5RW27L.js → googlecalendar-2EAW4MNM.js} +16 -14
- package/dist/{googledocs-G522PUGW.js → googledocs-YNKKBM6Q.js} +3 -3
- package/dist/{grafana-44ZPIV5P.js → grafana-353VSGXN.js} +24 -25
- package/dist/{graphhopper-2MORXLOW.js → graphhopper-H3IVJNDS.js} +4 -4
- package/dist/index.d.ts +31 -30
- package/dist/index.js +3 -3
- package/dist/{ip2proxy-R4K4KEMI.js → ip2proxy-DBGRWH7S.js} +4 -4
- package/dist/{ipgeolocation_io-H4J55OGI.js → ipgeolocation_io-5I2BDVMG.js} +4 -4
- package/dist/{ipqualityscore-XGID4OHA.js → ipqualityscore-ILV7TQCV.js} +4 -4
- package/dist/{jina_ai-7ZVDOR3Z.js → jina_ai-L5BH455V.js} +20 -21
- package/dist/{jira-CTIYZTT3.js → jira-IGTILUZA.js} +20 -16
- package/dist/{langsmith-ISP567FS.js → langsmith-BYRX4AOF.js} +25 -25
- package/dist/{lemlist-OGKK272F.js → lemlist-ZGNYTIQO.js} +23 -24
- package/dist/{linear-6JX4E3JI.js → linear-HLGOWISN.js} +3 -3
- package/dist/{logsnag-BVB36ZCL.js → logsnag-5RGTMTU2.js} +20 -22
- package/dist/main.js +102 -102
- package/dist/{mattermost-UECVPZGY.js → mattermost-BONGXVC7.js} +21 -17
- package/dist/{mem0-EUA7S2OO.js → mem0-RUVNUPTE.js} +15 -15
- package/dist/{memos-BYSBJRWZ.js → memos-TED4HI54.js} +36 -32
- package/dist/{metabase-4JXZH3YG.js → metabase-ZHXHRHZK.js} +22 -18
- package/dist/{mistral_ai-2C5BTBKW.js → mistral_ai-NGP5SHU7.js} +24 -21
- package/dist/{mother_duck-ZGNNNR3X.js → mother_duck-TKVQM35M.js} +23 -19
- package/dist/{ngrok-NTPGMRXI.js → ngrok-BYCUJ7QV.js} +17 -22
- package/dist/{notes-KGYXX6N6.js → notes-KXRNNYDW.js} +1 -1
- package/dist/{notion-EX3X2G7G.js → notion-2ILYKJOO.js} +20 -17
- package/dist/{open_exchange_rates-2V2LIGPS.js → open_exchange_rates-JU4DC6HZ.js} +4 -4
- package/dist/{openai-KQFQPK7Z.js → openai-6SOT26ZK.js} +22 -16
- package/dist/{opengraph_io-B63SEYJY.js → opengraph_io-ZEFHV2OL.js} +4 -4
- package/dist/{openrouter-62A4H62Q.js → openrouter-R4P7JL5L.js} +19 -14
- package/dist/{outline-QC33XLCK.js → outline-VCTQ5V2X.js} +18 -20
- package/dist/{paddle-HDZG35Y7.js → paddle-AZOAKBJS.js} +17 -15
- package/dist/{perplexity-M7LOMJWA.js → perplexity-OMRLGVAT.js} +19 -23
- package/dist/{pinecone-Y7YCJRZM.js → pinecone-DI62W3ZX.js} +19 -24
- package/dist/{pipedrive-FLJA62UX.js → pipedrive-CW7HONYW.js} +22 -23
- package/dist/{polar-AE55Q425.js → polar-5DRGTXNR.js} +19 -17
- package/dist/{posthog-IAY5D3YW.js → posthog-3DTHFCKE.js} +29 -24
- package/dist/{postmark-NMKAXDXZ.js → postmark-ME2V2XXI.js} +19 -17
- package/dist/{prerender-CDJM7I7N.js → prerender-5EAY7GDM.js} +4 -4
- package/dist/{pubmed-N437ZJOR.js → pubmed-GRQUBGVA.js} +3 -3
- package/dist/{railway-NBWYXCUM.js → railway-FTM75TMX.js} +3 -3
- package/dist/{readwise-QRO3UC3R.js → readwise-IJQGV6IQ.js} +16 -15
- package/dist/{render-NEW7SROG.js → render-TMSPHRTY.js} +21 -20
- package/dist/{replicate-73YQLRTY.js → replicate-RJCMDB7H.js} +20 -21
- package/dist/{resend-R5BAZFHZ.js → resend-YYN22NIL.js} +15 -11
- package/dist/{rootly-5BLALPCS.js → rootly-7RXE4K7L.js} +19 -18
- package/dist/{scrapfly-EHFLNNUZ.js → scrapfly-ZJJ6XM4Q.js} +4 -4
- package/dist/{scrapingbee-UXLYS72S.js → scrapingbee-QNGEOD6D.js} +4 -4
- package/dist/{screenshot_fyi-KC3NLTJ6.js → screenshot_fyi-SPZAABVD.js} +4 -4
- package/dist/{semantic_scholar-SA5OIUWA.js → semantic_scholar-SDPVGDDI.js} +21 -20
- package/dist/{sentry-BAE3XLJN.js → sentry-SJ5NN4C4.js} +22 -19
- package/dist/{shodan-FJR6MKKW.js → shodan-YMGOY7KW.js} +4 -4
- package/dist/{shopify-7OA6SLN5.js → shopify-SU5ABP54.js} +23 -19
- package/dist/{stripe-MUWDZGGF.js → stripe-JAC425KE.js} +3 -3
- package/dist/{supabase-SWWGNWYR.js → supabase-GQ2OFVIL.js} +18 -17
- package/dist/{tavily-XQNJ5EDI.js → tavily-Y7MDA5CI.js} +20 -20
- package/dist/{telegram-RR6JPZOG.js → telegram-OIDT3ZLH.js} +4 -4
- package/dist/{telnyx-7PKXOWSO.js → telnyx-4JGMC3K7.js} +19 -19
- package/dist/{todoist-63X5IUJE.js → todoist-O7S2OUGX.js} +18 -17
- package/dist/{trello-MOG63DAI.js → trello-3LDE4TAQ.js} +4 -4
- package/dist/{turso-ENWTSHDL.js → turso-MUQ44KCA.js} +23 -30
- package/dist/{twilio-FDXUN7VX.js → twilio-VYF3HUU6.js} +3 -3
- package/dist/{umami-TM7PROWF.js → umami-SVQIK26J.js} +23 -28
- package/dist/{unsplash-NWXLKSOW.js → unsplash-333XYDCJ.js} +19 -18
- package/dist/{upstash_redis-CUTQ5L2N.js → upstash_redis-IUM2HDLU.js} +17 -13
- package/dist/{uptimerobot-NNO32M3I.js → uptimerobot-7ZRU2NJV.js} +3 -3
- package/dist/{v2ex-24KMSWS7.js → v2ex-AVSJCQPS.js} +35 -18
- package/dist/{vercel-B45LPF6I.js → vercel-J7RGXNSA.js} +21 -18
- package/dist/{wolfram_alpha_api-DKJWVR6G.js → wolfram_alpha_api-6CRVUZOJ.js} +4 -4
- package/dist/{wordpress-XYFSDZXY.js → wordpress-THOJLPKA.js} +21 -17
- package/dist/{workos-BEM7EPHM.js → workos-ENTGRWF2.js} +26 -27
- package/dist/{zhihu-CFHZ4NC7.js → zhihu-W2BXICTX.js} +21 -21
- package/package.json +5 -5
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
createAuthedClient
|
|
3
|
+
} from "./chunk-JEWFX6Z6.js";
|
|
4
|
+
import "./chunk-Q74GLIDK.js";
|
|
4
5
|
import {
|
|
5
6
|
asJsonObject,
|
|
6
7
|
booleanValue,
|
|
@@ -12,20 +13,19 @@ import {
|
|
|
12
13
|
createProviderPlugin,
|
|
13
14
|
requireCredential,
|
|
14
15
|
upstreamError
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-QR4LK3HF.js";
|
|
16
17
|
import {
|
|
17
18
|
assertPublicHttpUrl
|
|
18
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-ZTTN6AJG.js";
|
|
19
20
|
import {
|
|
20
21
|
TBError,
|
|
21
22
|
external_exports
|
|
22
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-MZCIPUNQ.js";
|
|
23
24
|
import "./chunk-U67V476Y.js";
|
|
24
25
|
|
|
25
26
|
// ../plugins/src/jira/api.ts
|
|
26
27
|
var SERVICE = "jira";
|
|
27
28
|
var DEFAULT_LIMIT = 50;
|
|
28
|
-
var http = createProviderHttpClient({ service: SERVICE });
|
|
29
29
|
var DEFAULT_ISSUE_FIELD_IDS = [
|
|
30
30
|
"summary",
|
|
31
31
|
"description",
|
|
@@ -116,23 +116,27 @@ function responsePayload(data, bodyKind) {
|
|
|
116
116
|
if (bodyKind === "empty") return {};
|
|
117
117
|
return bodyKind === "invalid-json" ? { message: data } : data;
|
|
118
118
|
}
|
|
119
|
+
var http = createAuthedClient({
|
|
120
|
+
service: SERVICE,
|
|
121
|
+
auth: {
|
|
122
|
+
kind: "custom",
|
|
123
|
+
headers: (ctx) => ({ authorization: `Bearer ${requireCredential(ctx, SERVICE, "personalAccessToken")}` })
|
|
124
|
+
},
|
|
125
|
+
headers: { accept: "application/json" },
|
|
126
|
+
mapError: ({ bodyKind, data, status }) => upstreamError(
|
|
127
|
+
status,
|
|
128
|
+
errorMessage(responsePayload(data, bodyKind))
|
|
129
|
+
)
|
|
130
|
+
});
|
|
119
131
|
async function requestValue(ctx, options) {
|
|
120
132
|
const baseUrl = apiBaseUrl(ctx);
|
|
121
|
-
const result = await http.request({
|
|
133
|
+
const result = await http.request(ctx, {
|
|
122
134
|
baseUrl,
|
|
123
135
|
// create_issue 会跟随 Jira 返回的 self;buildUrl 先锁定 origin 与 REST API path 前缀。
|
|
124
136
|
path: buildUrl(baseUrl, options.path, options.query),
|
|
125
137
|
method: options.method ?? (options.body === void 0 ? "GET" : "POST"),
|
|
126
|
-
headers: {
|
|
127
|
-
accept: "application/json",
|
|
128
|
-
authorization: `Bearer ${requireCredential(ctx, SERVICE, "personalAccessToken")}`
|
|
129
|
-
},
|
|
130
138
|
...options.body === void 0 ? {} : { json: options.body },
|
|
131
|
-
invalidJson: "text"
|
|
132
|
-
mapError: ({ bodyKind, data, status }) => upstreamError(
|
|
133
|
-
status,
|
|
134
|
-
errorMessage(responsePayload(data, bodyKind))
|
|
135
|
-
)
|
|
139
|
+
invalidJson: "text"
|
|
136
140
|
});
|
|
137
141
|
return responsePayload(result.data, result.bodyKind);
|
|
138
142
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
createAuthedClient
|
|
3
|
+
} from "./chunk-JEWFX6Z6.js";
|
|
4
|
+
import "./chunk-Q74GLIDK.js";
|
|
4
5
|
import {
|
|
5
6
|
asJsonObject,
|
|
6
7
|
compactDefined,
|
|
@@ -12,19 +13,32 @@ import {
|
|
|
12
13
|
createProviderPlugin,
|
|
13
14
|
requireApiKey,
|
|
14
15
|
upstreamError
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-QR4LK3HF.js";
|
|
17
|
+
import "./chunk-ZTTN6AJG.js";
|
|
17
18
|
import {
|
|
18
19
|
TBError,
|
|
19
20
|
external_exports
|
|
20
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-MZCIPUNQ.js";
|
|
21
22
|
import "./chunk-U67V476Y.js";
|
|
22
23
|
|
|
23
24
|
// ../plugins/src/langsmith/api.ts
|
|
24
25
|
var SERVICE = "langsmith";
|
|
25
26
|
var WORKSPACES_PATH = "/api/v1/workspaces";
|
|
26
27
|
var DEFAULT_REGION = "us";
|
|
27
|
-
var http =
|
|
28
|
+
var http = createAuthedClient({
|
|
29
|
+
service: SERVICE,
|
|
30
|
+
auth: { kind: "header", name: "X-Api-Key" },
|
|
31
|
+
headers: { accept: "application/json" },
|
|
32
|
+
// 错误消息四处之一;拿不到就退回状态行。
|
|
33
|
+
errorMessage: {
|
|
34
|
+
keys: ["detail", "message", "error", "title"],
|
|
35
|
+
fallback: (status, statusText) => trimmedText(statusText) ?? `langsmith \u8FD4\u56DE HTTP ${status}`
|
|
36
|
+
},
|
|
37
|
+
mapTransportError: ({ message }) => upstreamError(
|
|
38
|
+
502,
|
|
39
|
+
`langsmith \u8BF7\u6C42\u5931\u8D25: ${message ?? "\u672A\u77E5\u9519\u8BEF"}`
|
|
40
|
+
)
|
|
41
|
+
});
|
|
28
42
|
var REGION_BASE_URLS = {
|
|
29
43
|
us: "https://api.smith.langchain.com",
|
|
30
44
|
eu: "https://eu.api.smith.langchain.com",
|
|
@@ -48,12 +62,6 @@ function resolveWorkspaceId(ctx) {
|
|
|
48
62
|
if (configured !== void 0 && typeof configured !== "string") throw configError("workspaceId \u5FC5\u987B\u662F\u5B57\u7B26\u4E32");
|
|
49
63
|
return trimmedText(configured);
|
|
50
64
|
}
|
|
51
|
-
function errorMessage(context) {
|
|
52
|
-
const payload = context.data;
|
|
53
|
-
const fromText = typeof payload === "string" ? trimmedText(payload) : void 0;
|
|
54
|
-
const body = asJsonObject(payload);
|
|
55
|
-
return fromText ?? trimmedText(body?.detail) ?? trimmedText(body?.message) ?? trimmedText(body?.error) ?? trimmedText(body?.title) ?? trimmedText(context.statusText) ?? `langsmith \u8FD4\u56DE HTTP ${context.status}`;
|
|
56
|
-
}
|
|
57
65
|
function queryPairs(query) {
|
|
58
66
|
return Object.entries(query ?? {}).flatMap(([key, value]) => {
|
|
59
67
|
if (value === void 0 || value === null) return [];
|
|
@@ -61,25 +69,17 @@ function queryPairs(query) {
|
|
|
61
69
|
});
|
|
62
70
|
}
|
|
63
71
|
async function request(ctx, input) {
|
|
64
|
-
|
|
72
|
+
requireApiKey(ctx, SERVICE);
|
|
65
73
|
const workspaceId = resolveWorkspaceId(ctx);
|
|
66
|
-
const result = await http.request({
|
|
74
|
+
const result = await http.request(ctx, {
|
|
67
75
|
baseUrl: resolveApiBase(ctx),
|
|
68
76
|
path: input.path,
|
|
69
77
|
method: input.method ?? "GET",
|
|
70
78
|
query: queryPairs(input.query),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"X-Api-Key": apiKey,
|
|
74
|
-
...workspaceId === void 0 ? {} : { "X-Tenant-Id": workspaceId }
|
|
75
|
-
},
|
|
79
|
+
// 一个 API key 能看到多个 workspace 时,靠 `X-Tenant-Id` 指定用哪个。
|
|
80
|
+
...workspaceId === void 0 ? {} : { headers: { "X-Tenant-Id": workspaceId } },
|
|
76
81
|
...input.body === void 0 ? {} : { json: input.body },
|
|
77
|
-
invalidJson: "text"
|
|
78
|
-
mapError: (context) => upstreamError(context.status, errorMessage(context)),
|
|
79
|
-
mapTransportError: ({ message }) => upstreamError(
|
|
80
|
-
502,
|
|
81
|
-
`langsmith \u8BF7\u6C42\u5931\u8D25: ${message ?? "\u672A\u77E5\u9519\u8BEF"}`
|
|
82
|
-
)
|
|
82
|
+
invalidJson: "text"
|
|
83
83
|
});
|
|
84
84
|
return result.data === void 0 ? null : result.data;
|
|
85
85
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
createAuthedClient
|
|
3
|
+
} from "./chunk-JEWFX6Z6.js";
|
|
4
|
+
import "./chunk-Q74GLIDK.js";
|
|
4
5
|
import {
|
|
5
6
|
asJsonObject,
|
|
6
7
|
compactDefined,
|
|
@@ -10,18 +11,17 @@ import {
|
|
|
10
11
|
createProviderPlugin,
|
|
11
12
|
requireApiKey,
|
|
12
13
|
upstreamError
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-QR4LK3HF.js";
|
|
15
|
+
import "./chunk-ZTTN6AJG.js";
|
|
15
16
|
import {
|
|
16
17
|
TBError,
|
|
17
18
|
external_exports
|
|
18
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-MZCIPUNQ.js";
|
|
19
20
|
import "./chunk-U67V476Y.js";
|
|
20
21
|
|
|
21
22
|
// ../plugins/src/lemlist/api.ts
|
|
22
23
|
var SERVICE = "lemlist";
|
|
23
24
|
var API_BASE = "https://api.lemlist.com/api";
|
|
24
|
-
var http = createProviderHttpClient({ baseUrl: `${API_BASE}/`, service: SERVICE });
|
|
25
25
|
function stringArray(value) {
|
|
26
26
|
return Array.isArray(value) ? value.filter((item) => typeof item === "string") : void 0;
|
|
27
27
|
}
|
|
@@ -35,33 +35,32 @@ function basicAuthHeader(apiKey) {
|
|
|
35
35
|
for (const byte of bytes) binary += String.fromCharCode(byte);
|
|
36
36
|
return `Basic ${btoa(binary)}`;
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
38
|
+
var http = createAuthedClient({
|
|
39
|
+
baseUrl: `${API_BASE}/`,
|
|
40
|
+
service: SERVICE,
|
|
41
|
+
// Basic(用户名留空、key 当密码)不在 helper 的三种头型里,自己拼。
|
|
42
|
+
auth: { kind: "custom", headers: (ctx) => ({ authorization: basicAuthHeader(requireApiKey(ctx, SERVICE)) }) },
|
|
43
|
+
headers: { accept: "application/json" },
|
|
44
|
+
errorMessage: {
|
|
45
|
+
keys: ["message", "error", "reason"],
|
|
46
|
+
fallback: (status) => `lemlist \u8BF7\u6C42\u5931\u8D25,HTTP ${status}`
|
|
47
|
+
},
|
|
48
|
+
mapTransportError: ({ message }) => upstreamError(
|
|
49
|
+
502,
|
|
50
|
+
message === void 0 ? "lemlist \u8BF7\u6C42\u5931\u8D25" : `lemlist \u8BF7\u6C42\u5931\u8D25: ${message}`
|
|
51
|
+
)
|
|
52
|
+
});
|
|
44
53
|
async function request(ctx, path, query = {}) {
|
|
45
|
-
const apiKey = requireApiKey(ctx, SERVICE);
|
|
46
54
|
const pairs = [];
|
|
47
55
|
for (const [key, value] of Object.entries(query)) {
|
|
48
56
|
if (typeof value === "number" || typeof value === "string" && value !== "") {
|
|
49
57
|
pairs.push([key, value]);
|
|
50
58
|
}
|
|
51
59
|
}
|
|
52
|
-
const { data } = await http.request({
|
|
60
|
+
const { data } = await http.request(ctx, {
|
|
53
61
|
path,
|
|
54
62
|
query: pairs,
|
|
55
|
-
|
|
56
|
-
invalidJson: "text",
|
|
57
|
-
mapError: ({ data: payload, status }) => upstreamError(
|
|
58
|
-
status,
|
|
59
|
-
errorMessage(payload) ?? `lemlist \u8BF7\u6C42\u5931\u8D25,HTTP ${status}`
|
|
60
|
-
),
|
|
61
|
-
mapTransportError: ({ message }) => upstreamError(
|
|
62
|
-
502,
|
|
63
|
-
message === void 0 ? "lemlist \u8BF7\u6C42\u5931\u8D25" : `lemlist \u8BF7\u6C42\u5931\u8D25: ${message}`
|
|
64
|
-
)
|
|
63
|
+
invalidJson: "text"
|
|
65
64
|
});
|
|
66
65
|
return data ?? null;
|
|
67
66
|
}
|
|
@@ -7,14 +7,14 @@ import {
|
|
|
7
7
|
createProviderPlugin,
|
|
8
8
|
requireApiKey,
|
|
9
9
|
upstreamError
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-QR4LK3HF.js";
|
|
11
11
|
import {
|
|
12
12
|
guardedFetch
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-ZTTN6AJG.js";
|
|
14
14
|
import {
|
|
15
15
|
TBError,
|
|
16
16
|
external_exports
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-MZCIPUNQ.js";
|
|
18
18
|
import "./chunk-U67V476Y.js";
|
|
19
19
|
|
|
20
20
|
// ../plugins/src/linear/api.ts
|
|
@@ -1,38 +1,36 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
createAuthedClient
|
|
3
|
+
} from "./chunk-JEWFX6Z6.js";
|
|
4
|
+
import "./chunk-Q74GLIDK.js";
|
|
5
|
+
import "./chunk-JXHMDBAY.js";
|
|
4
6
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import
|
|
8
|
-
createProviderPlugin,
|
|
9
|
-
requireApiKey,
|
|
10
|
-
upstreamError
|
|
11
|
-
} from "./chunk-6ANLYNFB.js";
|
|
12
|
-
import "./chunk-3WL6EXYX.js";
|
|
7
|
+
createProviderPlugin
|
|
8
|
+
} from "./chunk-QR4LK3HF.js";
|
|
9
|
+
import "./chunk-ZTTN6AJG.js";
|
|
13
10
|
import {
|
|
14
11
|
external_exports
|
|
15
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-MZCIPUNQ.js";
|
|
16
13
|
import "./chunk-U67V476Y.js";
|
|
17
14
|
|
|
18
15
|
// ../plugins/src/logsnag/api.ts
|
|
19
16
|
var SERVICE = "logsnag";
|
|
20
|
-
var http =
|
|
17
|
+
var http = createAuthedClient({
|
|
18
|
+
baseUrl: "https://api.logsnag.com/v1/",
|
|
19
|
+
service: SERVICE,
|
|
20
|
+
auth: { kind: "bearer" },
|
|
21
|
+
headers: { accept: "application/json" },
|
|
22
|
+
errorMessage: {
|
|
23
|
+
keys: ["message", "error", "detail"],
|
|
24
|
+
fallback: (status) => `LogSnag request failed with ${status}`
|
|
25
|
+
}
|
|
26
|
+
});
|
|
21
27
|
async function request(path, method, body, ctx) {
|
|
22
|
-
const result = await http.request({
|
|
28
|
+
const result = await http.request(ctx, {
|
|
23
29
|
path,
|
|
24
30
|
method,
|
|
25
|
-
headers: {
|
|
26
|
-
accept: "application/json",
|
|
27
|
-
authorization: `Bearer ${requireApiKey(ctx, SERVICE)}`
|
|
28
|
-
},
|
|
29
31
|
json: body,
|
|
30
32
|
responseType: "auto",
|
|
31
|
-
invalidJson: "text"
|
|
32
|
-
mapError: ({ data, status }) => upstreamError(
|
|
33
|
-
status,
|
|
34
|
-
messageFrom(data, ["message", "error", "detail"], `LogSnag request failed with ${status}`)
|
|
35
|
-
)
|
|
33
|
+
invalidJson: "text"
|
|
36
34
|
});
|
|
37
35
|
return {
|
|
38
36
|
ok: true,
|
package/dist/main.js
CHANGED
|
@@ -2,112 +2,112 @@
|
|
|
2
2
|
import {
|
|
3
3
|
configFromEnv,
|
|
4
4
|
createTbServer
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-MDY7K5CX.js";
|
|
6
|
+
import "./chunk-ZTTN6AJG.js";
|
|
7
|
+
import "./chunk-MZCIPUNQ.js";
|
|
8
8
|
import "./chunk-U67V476Y.js";
|
|
9
9
|
|
|
10
10
|
// ../plugins/src/registry.generated.ts
|
|
11
11
|
var BUILTIN_PLUGIN_LOADERS = {
|
|
12
|
-
airtable: () => import("./airtable-
|
|
13
|
-
alt_text_generator_ai: () => import("./alt_text_generator_ai-
|
|
14
|
-
amap: () => import("./amap-
|
|
15
|
-
anthropic: () => import("./anthropic-
|
|
16
|
-
apify: () => import("./apify-
|
|
17
|
-
brave_search: () => import("./brave_search-
|
|
18
|
-
circleci: () => import("./circleci-
|
|
19
|
-
clerk: () => import("./clerk-
|
|
20
|
-
cloudflare_dns: () => import("./cloudflare_dns-
|
|
21
|
-
cohere: () => import("./cohere-
|
|
22
|
-
confluence: () => import("./confluence-
|
|
23
|
-
convertapi: () => import("./convertapi-
|
|
24
|
-
currencyapi: () => import("./currencyapi-
|
|
25
|
-
deepseek: () => import("./deepseek-
|
|
26
|
-
docker_hub: () => import("./docker_hub-
|
|
27
|
-
dropbox: () => import("./dropbox-
|
|
28
|
-
dub: () => import("./dub-
|
|
29
|
-
e2b: () => import("./e2b-
|
|
30
|
-
exa: () => import("./exa-
|
|
31
|
-
fal_ai: () => import("./fal_ai-
|
|
32
|
-
feishu: () => import("./feishu-
|
|
33
|
-
feishu_custom_bot: () => import("./feishu_custom_bot-
|
|
34
|
-
figma: () => import("./figma-
|
|
35
|
-
firehydrant: () => import("./firehydrant-
|
|
36
|
-
fixer: () => import("./fixer-
|
|
37
|
-
fly: () => import("./fly-
|
|
38
|
-
front: () => import("./front-
|
|
39
|
-
geocodio: () => import("./geocodio-
|
|
40
|
-
ghost: () => import("./ghost-
|
|
41
|
-
github: () => import("./github-
|
|
42
|
-
gmail: () => import("./gmail-
|
|
43
|
-
googlecalendar: () => import("./googlecalendar-
|
|
44
|
-
googledocs: () => import("./googledocs-
|
|
45
|
-
grafana: () => import("./grafana-
|
|
46
|
-
graphhopper: () => import("./graphhopper-
|
|
47
|
-
ip2proxy: () => import("./ip2proxy-
|
|
48
|
-
ipgeolocation_io: () => import("./ipgeolocation_io-
|
|
49
|
-
ipqualityscore: () => import("./ipqualityscore-
|
|
50
|
-
jina_ai: () => import("./jina_ai-
|
|
51
|
-
jira: () => import("./jira-
|
|
52
|
-
langsmith: () => import("./langsmith-
|
|
53
|
-
lemlist: () => import("./lemlist-
|
|
54
|
-
linear: () => import("./linear-
|
|
55
|
-
logsnag: () => import("./logsnag-
|
|
56
|
-
mattermost: () => import("./mattermost-
|
|
57
|
-
mem0: () => import("./mem0-
|
|
58
|
-
memos: () => import("./memos-
|
|
59
|
-
metabase: () => import("./metabase-
|
|
60
|
-
mistral_ai: () => import("./mistral_ai-
|
|
61
|
-
mother_duck: () => import("./mother_duck-
|
|
62
|
-
ngrok: () => import("./ngrok-
|
|
63
|
-
notes: () => import("./notes-
|
|
64
|
-
notion: () => import("./notion-
|
|
65
|
-
open_exchange_rates: () => import("./open_exchange_rates-
|
|
66
|
-
openai: () => import("./openai-
|
|
67
|
-
opengraph_io: () => import("./opengraph_io-
|
|
68
|
-
openrouter: () => import("./openrouter-
|
|
69
|
-
outline: () => import("./outline-
|
|
70
|
-
paddle: () => import("./paddle-
|
|
71
|
-
perplexity: () => import("./perplexity-
|
|
72
|
-
pinecone: () => import("./pinecone-
|
|
73
|
-
pipedrive: () => import("./pipedrive-
|
|
74
|
-
polar: () => import("./polar-
|
|
75
|
-
posthog: () => import("./posthog-
|
|
76
|
-
postmark: () => import("./postmark-
|
|
77
|
-
prerender: () => import("./prerender-
|
|
78
|
-
pubmed: () => import("./pubmed-
|
|
79
|
-
railway: () => import("./railway-
|
|
80
|
-
readwise: () => import("./readwise-
|
|
81
|
-
render: () => import("./render-
|
|
82
|
-
replicate: () => import("./replicate-
|
|
83
|
-
resend: () => import("./resend-
|
|
84
|
-
rootly: () => import("./rootly-
|
|
85
|
-
scrapfly: () => import("./scrapfly-
|
|
86
|
-
scrapingbee: () => import("./scrapingbee-
|
|
87
|
-
screenshot_fyi: () => import("./screenshot_fyi-
|
|
88
|
-
semantic_scholar: () => import("./semantic_scholar-
|
|
89
|
-
sentry: () => import("./sentry-
|
|
90
|
-
shodan: () => import("./shodan-
|
|
91
|
-
shopify: () => import("./shopify-
|
|
92
|
-
stripe: () => import("./stripe-
|
|
93
|
-
supabase: () => import("./supabase-
|
|
94
|
-
tavily: () => import("./tavily-
|
|
95
|
-
telegram: () => import("./telegram-
|
|
96
|
-
telnyx: () => import("./telnyx-
|
|
97
|
-
todoist: () => import("./todoist-
|
|
98
|
-
trello: () => import("./trello-
|
|
99
|
-
turso: () => import("./turso-
|
|
100
|
-
twilio: () => import("./twilio-
|
|
101
|
-
umami: () => import("./umami-
|
|
102
|
-
unsplash: () => import("./unsplash-
|
|
103
|
-
upstash_redis: () => import("./upstash_redis-
|
|
104
|
-
uptimerobot: () => import("./uptimerobot-
|
|
105
|
-
v2ex: () => import("./v2ex-
|
|
106
|
-
vercel: () => import("./vercel-
|
|
107
|
-
wolfram_alpha_api: () => import("./wolfram_alpha_api-
|
|
108
|
-
wordpress: () => import("./wordpress-
|
|
109
|
-
workos: () => import("./workos-
|
|
110
|
-
zhihu: () => import("./zhihu-
|
|
12
|
+
airtable: () => import("./airtable-DMJEEGJP.js"),
|
|
13
|
+
alt_text_generator_ai: () => import("./alt_text_generator_ai-RELFQ5FV.js"),
|
|
14
|
+
amap: () => import("./amap-YSYEACKQ.js"),
|
|
15
|
+
anthropic: () => import("./anthropic-D5X5GSYE.js"),
|
|
16
|
+
apify: () => import("./apify-5NVFU3IZ.js"),
|
|
17
|
+
brave_search: () => import("./brave_search-X557FMGO.js"),
|
|
18
|
+
circleci: () => import("./circleci-3P3QTUX2.js"),
|
|
19
|
+
clerk: () => import("./clerk-GNMZQ2MY.js"),
|
|
20
|
+
cloudflare_dns: () => import("./cloudflare_dns-VWZH3ZTR.js"),
|
|
21
|
+
cohere: () => import("./cohere-C7QVIIMG.js"),
|
|
22
|
+
confluence: () => import("./confluence-52I37IUT.js"),
|
|
23
|
+
convertapi: () => import("./convertapi-3TRJ3WEO.js"),
|
|
24
|
+
currencyapi: () => import("./currencyapi-LWEANWVI.js"),
|
|
25
|
+
deepseek: () => import("./deepseek-5U24YG4P.js"),
|
|
26
|
+
docker_hub: () => import("./docker_hub-CMISLRSE.js"),
|
|
27
|
+
dropbox: () => import("./dropbox-TW4QN6FT.js"),
|
|
28
|
+
dub: () => import("./dub-EFXGI5UH.js"),
|
|
29
|
+
e2b: () => import("./e2b-PHM63OVF.js"),
|
|
30
|
+
exa: () => import("./exa-DYOQWURR.js"),
|
|
31
|
+
fal_ai: () => import("./fal_ai-VJPMCNRH.js"),
|
|
32
|
+
feishu: () => import("./feishu-TFIZXPIN.js"),
|
|
33
|
+
feishu_custom_bot: () => import("./feishu_custom_bot-ADSE23KU.js"),
|
|
34
|
+
figma: () => import("./figma-4AK47AYY.js"),
|
|
35
|
+
firehydrant: () => import("./firehydrant-RGPTW4EA.js"),
|
|
36
|
+
fixer: () => import("./fixer-OAMF4DKP.js"),
|
|
37
|
+
fly: () => import("./fly-YB4AQD4O.js"),
|
|
38
|
+
front: () => import("./front-6GTVYKUM.js"),
|
|
39
|
+
geocodio: () => import("./geocodio-YRT4K25M.js"),
|
|
40
|
+
ghost: () => import("./ghost-JCW6UIP2.js"),
|
|
41
|
+
github: () => import("./github-CEGVRMNX.js"),
|
|
42
|
+
gmail: () => import("./gmail-JCMJD55P.js"),
|
|
43
|
+
googlecalendar: () => import("./googlecalendar-2EAW4MNM.js"),
|
|
44
|
+
googledocs: () => import("./googledocs-YNKKBM6Q.js"),
|
|
45
|
+
grafana: () => import("./grafana-353VSGXN.js"),
|
|
46
|
+
graphhopper: () => import("./graphhopper-H3IVJNDS.js"),
|
|
47
|
+
ip2proxy: () => import("./ip2proxy-DBGRWH7S.js"),
|
|
48
|
+
ipgeolocation_io: () => import("./ipgeolocation_io-5I2BDVMG.js"),
|
|
49
|
+
ipqualityscore: () => import("./ipqualityscore-ILV7TQCV.js"),
|
|
50
|
+
jina_ai: () => import("./jina_ai-L5BH455V.js"),
|
|
51
|
+
jira: () => import("./jira-IGTILUZA.js"),
|
|
52
|
+
langsmith: () => import("./langsmith-BYRX4AOF.js"),
|
|
53
|
+
lemlist: () => import("./lemlist-ZGNYTIQO.js"),
|
|
54
|
+
linear: () => import("./linear-HLGOWISN.js"),
|
|
55
|
+
logsnag: () => import("./logsnag-5RGTMTU2.js"),
|
|
56
|
+
mattermost: () => import("./mattermost-BONGXVC7.js"),
|
|
57
|
+
mem0: () => import("./mem0-RUVNUPTE.js"),
|
|
58
|
+
memos: () => import("./memos-TED4HI54.js"),
|
|
59
|
+
metabase: () => import("./metabase-ZHXHRHZK.js"),
|
|
60
|
+
mistral_ai: () => import("./mistral_ai-NGP5SHU7.js"),
|
|
61
|
+
mother_duck: () => import("./mother_duck-TKVQM35M.js"),
|
|
62
|
+
ngrok: () => import("./ngrok-BYCUJ7QV.js"),
|
|
63
|
+
notes: () => import("./notes-KXRNNYDW.js"),
|
|
64
|
+
notion: () => import("./notion-2ILYKJOO.js"),
|
|
65
|
+
open_exchange_rates: () => import("./open_exchange_rates-JU4DC6HZ.js"),
|
|
66
|
+
openai: () => import("./openai-6SOT26ZK.js"),
|
|
67
|
+
opengraph_io: () => import("./opengraph_io-ZEFHV2OL.js"),
|
|
68
|
+
openrouter: () => import("./openrouter-R4P7JL5L.js"),
|
|
69
|
+
outline: () => import("./outline-VCTQ5V2X.js"),
|
|
70
|
+
paddle: () => import("./paddle-AZOAKBJS.js"),
|
|
71
|
+
perplexity: () => import("./perplexity-OMRLGVAT.js"),
|
|
72
|
+
pinecone: () => import("./pinecone-DI62W3ZX.js"),
|
|
73
|
+
pipedrive: () => import("./pipedrive-CW7HONYW.js"),
|
|
74
|
+
polar: () => import("./polar-5DRGTXNR.js"),
|
|
75
|
+
posthog: () => import("./posthog-3DTHFCKE.js"),
|
|
76
|
+
postmark: () => import("./postmark-ME2V2XXI.js"),
|
|
77
|
+
prerender: () => import("./prerender-5EAY7GDM.js"),
|
|
78
|
+
pubmed: () => import("./pubmed-GRQUBGVA.js"),
|
|
79
|
+
railway: () => import("./railway-FTM75TMX.js"),
|
|
80
|
+
readwise: () => import("./readwise-IJQGV6IQ.js"),
|
|
81
|
+
render: () => import("./render-TMSPHRTY.js"),
|
|
82
|
+
replicate: () => import("./replicate-RJCMDB7H.js"),
|
|
83
|
+
resend: () => import("./resend-YYN22NIL.js"),
|
|
84
|
+
rootly: () => import("./rootly-7RXE4K7L.js"),
|
|
85
|
+
scrapfly: () => import("./scrapfly-ZJJ6XM4Q.js"),
|
|
86
|
+
scrapingbee: () => import("./scrapingbee-QNGEOD6D.js"),
|
|
87
|
+
screenshot_fyi: () => import("./screenshot_fyi-SPZAABVD.js"),
|
|
88
|
+
semantic_scholar: () => import("./semantic_scholar-SDPVGDDI.js"),
|
|
89
|
+
sentry: () => import("./sentry-SJ5NN4C4.js"),
|
|
90
|
+
shodan: () => import("./shodan-YMGOY7KW.js"),
|
|
91
|
+
shopify: () => import("./shopify-SU5ABP54.js"),
|
|
92
|
+
stripe: () => import("./stripe-JAC425KE.js"),
|
|
93
|
+
supabase: () => import("./supabase-GQ2OFVIL.js"),
|
|
94
|
+
tavily: () => import("./tavily-Y7MDA5CI.js"),
|
|
95
|
+
telegram: () => import("./telegram-OIDT3ZLH.js"),
|
|
96
|
+
telnyx: () => import("./telnyx-4JGMC3K7.js"),
|
|
97
|
+
todoist: () => import("./todoist-O7S2OUGX.js"),
|
|
98
|
+
trello: () => import("./trello-3LDE4TAQ.js"),
|
|
99
|
+
turso: () => import("./turso-MUQ44KCA.js"),
|
|
100
|
+
twilio: () => import("./twilio-VYF3HUU6.js"),
|
|
101
|
+
umami: () => import("./umami-SVQIK26J.js"),
|
|
102
|
+
unsplash: () => import("./unsplash-333XYDCJ.js"),
|
|
103
|
+
upstash_redis: () => import("./upstash_redis-IUM2HDLU.js"),
|
|
104
|
+
uptimerobot: () => import("./uptimerobot-7ZRU2NJV.js"),
|
|
105
|
+
v2ex: () => import("./v2ex-AVSJCQPS.js"),
|
|
106
|
+
vercel: () => import("./vercel-J7RGXNSA.js"),
|
|
107
|
+
wolfram_alpha_api: () => import("./wolfram_alpha_api-6CRVUZOJ.js"),
|
|
108
|
+
wordpress: () => import("./wordpress-THOJLPKA.js"),
|
|
109
|
+
workos: () => import("./workos-ENTGRWF2.js"),
|
|
110
|
+
zhihu: () => import("./zhihu-W2BXICTX.js")
|
|
111
111
|
};
|
|
112
112
|
|
|
113
113
|
// ../plugins/src/catalog.generated.ts
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
createAuthedClient
|
|
3
|
+
} from "./chunk-JEWFX6Z6.js";
|
|
4
|
+
import "./chunk-Q74GLIDK.js";
|
|
4
5
|
import {
|
|
5
6
|
asJsonObject,
|
|
6
7
|
trimmedText
|
|
@@ -9,21 +10,20 @@ import {
|
|
|
9
10
|
createProviderPlugin,
|
|
10
11
|
requireCredential,
|
|
11
12
|
upstreamError
|
|
12
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-QR4LK3HF.js";
|
|
13
14
|
import {
|
|
14
15
|
assertPublicHttpUrl
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-ZTTN6AJG.js";
|
|
16
17
|
import {
|
|
17
18
|
TBError,
|
|
18
19
|
external_exports
|
|
19
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-MZCIPUNQ.js";
|
|
20
21
|
import "./chunk-U67V476Y.js";
|
|
21
22
|
|
|
22
23
|
// ../plugins/src/mattermost/api.ts
|
|
23
24
|
var SERVICE = "mattermost";
|
|
24
25
|
var API_PATH_PREFIX = "/api/v4";
|
|
25
26
|
var REQUEST_TIMEOUT_MS = 3e4;
|
|
26
|
-
var http = createProviderHttpClient({ service: SERVICE });
|
|
27
27
|
var SINCE_CONFLICTING_FIELDS = ["page", "perPage", "beforePostId", "afterPostId"];
|
|
28
28
|
function invalidResponse(message) {
|
|
29
29
|
return new TBError("unavailable", message, { retryable: true });
|
|
@@ -72,24 +72,28 @@ function errorMessage(payload, status) {
|
|
|
72
72
|
const body = asJsonObject(payload);
|
|
73
73
|
return trimmedText(body?.message) ?? trimmedText(body?.error) ?? trimmedText(body?.details) ?? trimmedText(body?.id) ?? `Mattermost \u8FD4\u56DE HTTP ${status}`;
|
|
74
74
|
}
|
|
75
|
+
var http = createAuthedClient({
|
|
76
|
+
service: SERVICE,
|
|
77
|
+
auth: {
|
|
78
|
+
kind: "custom",
|
|
79
|
+
headers: (ctx) => ({ authorization: `Bearer ${requireCredential(ctx, SERVICE, "apiKey")}` })
|
|
80
|
+
},
|
|
81
|
+
headers: { accept: "application/json" },
|
|
82
|
+
mapError: ({ bodyKind, data, status }) => upstreamError(
|
|
83
|
+
status,
|
|
84
|
+
errorMessage(responsePayload(data, bodyKind), status)
|
|
85
|
+
),
|
|
86
|
+
mapTransportError: ({ kind, message }) => kind === "timeout" ? upstreamError(504, `Mattermost \u8BF7\u6C42\u8D85\u65F6(${REQUEST_TIMEOUT_MS / 1e3} \u79D2)`) : upstreamError(502, `Mattermost \u8BF7\u6C42\u5931\u8D25:${message ?? "unknown network error"}`)
|
|
87
|
+
});
|
|
75
88
|
async function request(ctx, input) {
|
|
76
|
-
const result = await http.request({
|
|
89
|
+
const result = await http.request(ctx, {
|
|
77
90
|
baseUrl: `${apiBaseUrl(ctx)}/`,
|
|
78
91
|
path: input.path,
|
|
79
92
|
method: input.method ?? "GET",
|
|
80
93
|
query: Object.entries(input.query ?? {}),
|
|
81
|
-
headers: {
|
|
82
|
-
accept: "application/json",
|
|
83
|
-
authorization: `Bearer ${requireCredential(ctx, SERVICE, "apiKey")}`
|
|
84
|
-
},
|
|
85
94
|
...input.body === void 0 ? {} : { json: input.body },
|
|
86
95
|
timeoutMs: REQUEST_TIMEOUT_MS,
|
|
87
|
-
invalidJsonMessage: "Mattermost \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94"
|
|
88
|
-
mapError: ({ bodyKind, data, status }) => upstreamError(
|
|
89
|
-
status,
|
|
90
|
-
errorMessage(responsePayload(data, bodyKind), status)
|
|
91
|
-
),
|
|
92
|
-
mapTransportError: ({ kind, message }) => kind === "timeout" ? upstreamError(504, `Mattermost \u8BF7\u6C42\u8D85\u65F6(${REQUEST_TIMEOUT_MS / 1e3} \u79D2)`) : upstreamError(502, `Mattermost \u8BF7\u6C42\u5931\u8D25:${message ?? "unknown network error"}`)
|
|
96
|
+
invalidJsonMessage: "Mattermost \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94"
|
|
93
97
|
});
|
|
94
98
|
return responsePayload(result.data, result.bodyKind);
|
|
95
99
|
}
|