@tool-bridge/server 0.20.0 → 0.21.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/dist/{airtable-ZNWHIJMO.js → airtable-LLZDFN7M.js} +19 -16
- package/dist/{alt_text_generator_ai-X7RMDDM5.js → alt_text_generator_ai-W7O34SNG.js} +4 -4
- package/dist/{amap-3VER75VH.js → amap-VOX4T2AW.js} +4 -4
- package/dist/{anthropic-N7NTB3UC.js → anthropic-G23NN3X5.js} +23 -25
- package/dist/{apify-JB5P5AJI.js → apify-Y3SS734K.js} +20 -19
- package/dist/{brave_search-USL5OOBS.js → brave_search-ZC7OAPSZ.js} +16 -14
- package/dist/{chunk-6ANLYNFB.js → chunk-ATK45BXV.js} +1 -1
- package/dist/{chunk-6X55ALDX.js → chunk-E6JCVKW6.js} +6 -5
- package/dist/{chunk-RVUERWUZ.js → chunk-KMTT3I6D.js} +768 -1048
- package/dist/chunk-R6P4XAE5.js +248 -0
- package/dist/{chunk-3WL6EXYX.js → chunk-U7B6DS2O.js} +1 -1
- package/dist/{chunk-WIGQCP6O.js → chunk-UZM2RXZH.js} +159 -182
- package/dist/chunk-XYBU3WZH.js +71 -0
- package/dist/{circleci-LBGB25LP.js → circleci-3BAX5FCG.js} +20 -24
- package/dist/{clerk-6RX37CNZ.js → clerk-6LEM6TNU.js} +22 -21
- package/dist/{cloudflare_dns-NQGW7FHV.js → cloudflare_dns-KINYTJUD.js} +21 -17
- package/dist/{cohere-XPC2NAEW.js → cohere-XCJ5AJ6B.js} +19 -17
- package/dist/{confluence-ZUG2LT5A.js → confluence-B3EWPZVE.js} +16 -11
- package/dist/{convertapi-ZLXKWV3L.js → convertapi-EUWSQYPF.js} +3 -3
- package/dist/{currencyapi-T3A3HSOD.js → currencyapi-KVTIK3GL.js} +23 -26
- package/dist/{deepseek-NJMOD23E.js → deepseek-PC5YGNC5.js} +27 -17
- package/dist/{docker_hub-D2MQCSJ7.js → docker_hub-C3MA5FU6.js} +4 -4
- package/dist/{dropbox-MI6U3SOT.js → dropbox-XBV7Z2IR.js} +9 -8
- package/dist/{dub-P2BYBYV4.js → dub-LDOFG3HC.js} +22 -19
- package/dist/{e2b-BGKIAE54.js → e2b-JMCPSVBW.js} +20 -20
- package/dist/{exa-EUY7VV4C.js → exa-RAK7O7RD.js} +22 -25
- package/dist/{fal_ai-AAOG5FYJ.js → fal_ai-23E7JPNT.js} +18 -17
- package/dist/feishu-7QRIDUV6.js +12019 -0
- package/dist/{feishu_custom_bot-BWGMNVXF.js → feishu_custom_bot-TJ4K7QNJ.js} +3 -3
- package/dist/{figma-SJSWYCGD.js → figma-E6IX5DTH.js} +21 -23
- package/dist/{firehydrant-MOXK2PST.js → firehydrant-ZBLPQREE.js} +15 -15
- package/dist/{fixer-ISIDUDZU.js → fixer-BWON27UO.js} +4 -4
- package/dist/{fly-U4KPSGBF.js → fly-ZH3HFCZJ.js} +20 -16
- package/dist/{front-ZHM2YX2E.js → front-QCGXYEDJ.js} +20 -23
- package/dist/{geocodio-SVCCAXAV.js → geocodio-YGNI7DA4.js} +4 -4
- package/dist/{ghost-INTR7FIY.js → ghost-EVSGKH2Q.js} +4 -4
- package/dist/{github-T275VVWR.js → github-MA2BGRCJ.js} +28 -27
- package/dist/{gmail-KSSPOE67.js → gmail-E5E6AADE.js} +17 -17
- package/dist/{googlecalendar-JB5RW27L.js → googlecalendar-BTLFPXTD.js} +22 -19
- package/dist/{googledocs-G522PUGW.js → googledocs-BUHL4J2H.js} +6 -5
- package/dist/{grafana-44ZPIV5P.js → grafana-GLU2DWF2.js} +24 -25
- package/dist/{graphhopper-2MORXLOW.js → graphhopper-WSMB3TCD.js} +4 -4
- package/dist/index.d.ts +31 -30
- package/dist/index.js +4 -3
- package/dist/{ip2proxy-R4K4KEMI.js → ip2proxy-EZ64Y4ZH.js} +4 -4
- package/dist/{ipgeolocation_io-H4J55OGI.js → ipgeolocation_io-AA7HAS22.js} +4 -4
- package/dist/{ipqualityscore-XGID4OHA.js → ipqualityscore-BHJXVTJT.js} +4 -4
- package/dist/{jina_ai-7ZVDOR3Z.js → jina_ai-EFBHTBXL.js} +20 -21
- package/dist/{jira-CTIYZTT3.js → jira-HQSHAA5K.js} +20 -16
- package/dist/{langsmith-ISP567FS.js → langsmith-5W6SCT6F.js} +25 -25
- package/dist/{lemlist-OGKK272F.js → lemlist-HJWH6UMK.js} +23 -24
- package/dist/{linear-6JX4E3JI.js → linear-K7RYFYAD.js} +6 -5
- package/dist/{logsnag-BVB36ZCL.js → logsnag-4KFOHL37.js} +20 -22
- package/dist/main.js +103 -102
- package/dist/{mattermost-UECVPZGY.js → mattermost-S2BRCWLQ.js} +21 -17
- package/dist/{mem0-EUA7S2OO.js → mem0-CAW43CIC.js} +15 -15
- package/dist/{memos-BYSBJRWZ.js → memos-TWEGPKFM.js} +39 -34
- package/dist/{metabase-4JXZH3YG.js → metabase-MMSEPCOF.js} +22 -18
- package/dist/{mistral_ai-2C5BTBKW.js → mistral_ai-64BGZQHP.js} +24 -21
- package/dist/{mother_duck-ZGNNNR3X.js → mother_duck-H7PCQNZ2.js} +23 -19
- package/dist/{ngrok-NTPGMRXI.js → ngrok-GQCUGZKJ.js} +17 -22
- package/dist/{notes-KGYXX6N6.js → notes-PFMKRO33.js} +1 -1
- package/dist/{notion-EX3X2G7G.js → notion-DQWZWP4N.js} +20 -17
- package/dist/{open_exchange_rates-2V2LIGPS.js → open_exchange_rates-QMMD735E.js} +4 -4
- package/dist/{openai-KQFQPK7Z.js → openai-W6PX32NZ.js} +22 -16
- package/dist/{opengraph_io-B63SEYJY.js → opengraph_io-HNDBXYNW.js} +4 -4
- package/dist/{openrouter-62A4H62Q.js → openrouter-JJYMEAUL.js} +19 -14
- package/dist/{outline-QC33XLCK.js → outline-MCBNQZYY.js} +18 -20
- package/dist/{paddle-HDZG35Y7.js → paddle-D2SKLUDN.js} +17 -15
- package/dist/{perplexity-M7LOMJWA.js → perplexity-XIFMKUAE.js} +19 -23
- package/dist/{pinecone-Y7YCJRZM.js → pinecone-HUFTALV2.js} +19 -24
- package/dist/{pipedrive-FLJA62UX.js → pipedrive-Y2O7QGFF.js} +22 -23
- package/dist/{polar-AE55Q425.js → polar-TYTOMOSR.js} +19 -17
- package/dist/{posthog-IAY5D3YW.js → posthog-43JAR3VW.js} +29 -24
- package/dist/{postmark-NMKAXDXZ.js → postmark-KL2QJYSG.js} +19 -17
- package/dist/{prerender-CDJM7I7N.js → prerender-MENYM2TY.js} +4 -4
- package/dist/{pubmed-N437ZJOR.js → pubmed-GOXUVVH5.js} +6 -5
- package/dist/{railway-NBWYXCUM.js → railway-V2SID4WV.js} +3 -3
- package/dist/{readwise-QRO3UC3R.js → readwise-CI4GIMMJ.js} +16 -15
- package/dist/{render-NEW7SROG.js → render-SUBJ6YRZ.js} +21 -20
- package/dist/{replicate-73YQLRTY.js → replicate-756MXPYX.js} +20 -21
- package/dist/{resend-R5BAZFHZ.js → resend-ZKH3BTBI.js} +15 -11
- package/dist/{rootly-5BLALPCS.js → rootly-CD2LJHPI.js} +19 -18
- package/dist/{scrapfly-EHFLNNUZ.js → scrapfly-NSRHFDIQ.js} +4 -4
- package/dist/{scrapingbee-UXLYS72S.js → scrapingbee-OQHLAVEY.js} +4 -4
- package/dist/{screenshot_fyi-KC3NLTJ6.js → screenshot_fyi-DVWG3AXC.js} +4 -4
- package/dist/{semantic_scholar-SA5OIUWA.js → semantic_scholar-T4A252KW.js} +21 -20
- package/dist/{sentry-BAE3XLJN.js → sentry-546MNDJG.js} +22 -19
- package/dist/{shodan-FJR6MKKW.js → shodan-C3OON3Z3.js} +4 -4
- package/dist/{shopify-7OA6SLN5.js → shopify-Y2HN2MCQ.js} +23 -19
- package/dist/{stripe-MUWDZGGF.js → stripe-VE3CD3AY.js} +3 -3
- package/dist/{supabase-SWWGNWYR.js → supabase-U2SL4D63.js} +18 -17
- package/dist/{tavily-XQNJ5EDI.js → tavily-KCZHK6HE.js} +20 -20
- package/dist/{telegram-RR6JPZOG.js → telegram-3URFBCMY.js} +4 -4
- package/dist/{telnyx-7PKXOWSO.js → telnyx-CXQ4EZUX.js} +19 -19
- package/dist/{todoist-63X5IUJE.js → todoist-HNPWNYTD.js} +18 -17
- package/dist/{trello-MOG63DAI.js → trello-3W2MIXRP.js} +4 -4
- package/dist/{turso-ENWTSHDL.js → turso-2EQF7C2Z.js} +23 -30
- package/dist/{twilio-FDXUN7VX.js → twilio-4PDBJKWX.js} +6 -5
- package/dist/{umami-TM7PROWF.js → umami-5REN7TGP.js} +23 -28
- package/dist/{unsplash-NWXLKSOW.js → unsplash-EIXL424F.js} +19 -18
- package/dist/{upstash_redis-CUTQ5L2N.js → upstash_redis-G4LQBYHA.js} +17 -13
- package/dist/{uptimerobot-NNO32M3I.js → uptimerobot-KNJ3EYLY.js} +3 -3
- package/dist/{v2ex-24KMSWS7.js → v2ex-RHJ234PZ.js} +35 -18
- package/dist/{vercel-B45LPF6I.js → vercel-AS6NCIC7.js} +21 -18
- package/dist/{wolfram_alpha_api-DKJWVR6G.js → wolfram_alpha_api-3G4PUJWB.js} +4 -4
- package/dist/{wordpress-XYFSDZXY.js → wordpress-KNDAAUV7.js} +21 -17
- package/dist/{workos-BEM7EPHM.js → workos-R6UITSJ7.js} +26 -27
- package/dist/{zhihu-CFHZ4NC7.js → zhihu-AGK4HILK.js} +21 -21
- package/package.json +5 -5
- package/dist/feishu-AN5IJYOW.js +0 -231
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createProviderHttpClient
|
|
3
|
+
} from "./chunk-E6JCVKW6.js";
|
|
4
|
+
import {
|
|
5
|
+
asJsonObject,
|
|
6
|
+
trimmedText
|
|
7
|
+
} from "./chunk-JXHMDBAY.js";
|
|
8
|
+
import {
|
|
9
|
+
requireApiKey,
|
|
10
|
+
upstreamError
|
|
11
|
+
} from "./chunk-ATK45BXV.js";
|
|
12
|
+
import {
|
|
13
|
+
TBError
|
|
14
|
+
} from "./chunk-UZM2RXZH.js";
|
|
15
|
+
|
|
16
|
+
// ../plugins/src/_runtime/authedClient.ts
|
|
17
|
+
function extractErrorMessage(payload, keys) {
|
|
18
|
+
const direct = trimmedText(payload);
|
|
19
|
+
if (direct !== void 0) return direct;
|
|
20
|
+
if (asJsonObject(payload) === void 0) return void 0;
|
|
21
|
+
for (const key of keys) {
|
|
22
|
+
let value = payload;
|
|
23
|
+
for (const segment of key.split(".")) {
|
|
24
|
+
value = asJsonObject(value)?.[segment];
|
|
25
|
+
}
|
|
26
|
+
const candidate = trimmedText(value);
|
|
27
|
+
if (candidate !== void 0) return candidate;
|
|
28
|
+
}
|
|
29
|
+
return void 0;
|
|
30
|
+
}
|
|
31
|
+
function createAuthedClient(options) {
|
|
32
|
+
const { auth, errorMessage, headers: staticHeaders, mapError, mapTransportError, ...clientOptions } = options;
|
|
33
|
+
if (errorMessage !== void 0 && mapError !== void 0) {
|
|
34
|
+
throw new TBError("invalid_argument", `${options.service} \u4E0D\u80FD\u540C\u65F6\u58F0\u660E errorMessage \u4E0E mapError`);
|
|
35
|
+
}
|
|
36
|
+
const http = createProviderHttpClient(clientOptions);
|
|
37
|
+
const defaultMapError = mapError ?? (errorMessage === void 0 ? void 0 : ({ data, status, statusText }) => upstreamError(
|
|
38
|
+
status,
|
|
39
|
+
extractErrorMessage(data, errorMessage.keys) ?? errorMessage.fallback(status, statusText)
|
|
40
|
+
));
|
|
41
|
+
function authHeaders(ctx) {
|
|
42
|
+
switch (auth.kind) {
|
|
43
|
+
case "bearer":
|
|
44
|
+
return { authorization: `Bearer ${requireApiKey(ctx, options.service)}` };
|
|
45
|
+
case "token":
|
|
46
|
+
return { authorization: `Token ${requireApiKey(ctx, options.service)}` };
|
|
47
|
+
case "header":
|
|
48
|
+
return { [auth.name]: requireApiKey(ctx, options.service) };
|
|
49
|
+
case "custom":
|
|
50
|
+
return auth.headers(ctx);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
async request(ctx, request) {
|
|
55
|
+
const resolvedAuth = authHeaders(ctx);
|
|
56
|
+
const headers = new Headers(staticHeaders);
|
|
57
|
+
for (const [name, value] of new Headers(request.headers)) headers.set(name, value);
|
|
58
|
+
for (const [name, value] of new Headers(resolvedAuth)) headers.set(name, value);
|
|
59
|
+
return await http.request({
|
|
60
|
+
...request,
|
|
61
|
+
headers,
|
|
62
|
+
mapError: request.mapError ?? defaultMapError,
|
|
63
|
+
mapTransportError: request.mapTransportError ?? mapTransportError
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export {
|
|
70
|
+
createAuthedClient
|
|
71
|
+
};
|
|
@@ -1,26 +1,35 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
createAuthedClient
|
|
3
|
+
} from "./chunk-XYBU3WZH.js";
|
|
4
|
+
import "./chunk-E6JCVKW6.js";
|
|
4
5
|
import {
|
|
5
6
|
asJsonObject,
|
|
6
7
|
trimmedText
|
|
7
8
|
} from "./chunk-JXHMDBAY.js";
|
|
8
9
|
import {
|
|
9
|
-
createProviderPlugin
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} from "./chunk-6ANLYNFB.js";
|
|
13
|
-
import "./chunk-3WL6EXYX.js";
|
|
10
|
+
createProviderPlugin
|
|
11
|
+
} from "./chunk-ATK45BXV.js";
|
|
12
|
+
import "./chunk-U7B6DS2O.js";
|
|
14
13
|
import {
|
|
15
14
|
TBError,
|
|
16
15
|
external_exports
|
|
17
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-UZM2RXZH.js";
|
|
18
17
|
import "./chunk-U67V476Y.js";
|
|
19
18
|
|
|
20
19
|
// ../plugins/src/circleci/api.ts
|
|
21
20
|
var SERVICE = "circleci";
|
|
22
21
|
var API_BASE = "https://circleci.com/api/v2";
|
|
23
|
-
var http =
|
|
22
|
+
var http = createAuthedClient({
|
|
23
|
+
baseUrl: `${API_BASE}/`,
|
|
24
|
+
service: SERVICE,
|
|
25
|
+
auth: { kind: "header", name: "circle-token" },
|
|
26
|
+
headers: { accept: "application/json" },
|
|
27
|
+
// 错误消息:正文是纯串就用它,否则取 message、再退回 error。
|
|
28
|
+
errorMessage: {
|
|
29
|
+
keys: ["message", "error"],
|
|
30
|
+
fallback: (status) => `CircleCI \u8FD4\u56DE HTTP ${status}`
|
|
31
|
+
}
|
|
32
|
+
});
|
|
24
33
|
function trimSlashes(value) {
|
|
25
34
|
let start = 0;
|
|
26
35
|
let end = value.length;
|
|
@@ -51,29 +60,16 @@ function projectSlug(value) {
|
|
|
51
60
|
function orgSlug(value) {
|
|
52
61
|
return normalizeSlug(value, "orgSlug", false);
|
|
53
62
|
}
|
|
54
|
-
function errorMessage(payload, status) {
|
|
55
|
-
if (typeof payload === "string") {
|
|
56
|
-
const trimmed = payload.trim();
|
|
57
|
-
if (trimmed !== "") return trimmed;
|
|
58
|
-
}
|
|
59
|
-
const body = asJsonObject(payload);
|
|
60
|
-
return trimmedText(body?.message) ?? trimmedText(body?.error) ?? `CircleCI \u8FD4\u56DE HTTP ${status}`;
|
|
61
|
-
}
|
|
62
63
|
async function request(ctx, input) {
|
|
63
|
-
const { data } = await http.request({
|
|
64
|
+
const { data } = await http.request(ctx, {
|
|
64
65
|
path: input.path,
|
|
65
66
|
method: input.method ?? "GET",
|
|
66
67
|
query: Object.entries(input.query ?? {}).filter((entry) => {
|
|
67
68
|
const value = entry[1];
|
|
68
69
|
return value !== void 0 && value !== "";
|
|
69
70
|
}),
|
|
70
|
-
headers: {
|
|
71
|
-
"accept": "application/json",
|
|
72
|
-
"circle-token": requireApiKey(ctx, SERVICE)
|
|
73
|
-
},
|
|
74
71
|
...input.body === void 0 ? {} : { json: input.body },
|
|
75
|
-
invalidJsonMessage: "CircleCI \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94"
|
|
76
|
-
mapError: ({ data: payload, status }) => upstreamError(status, errorMessage(payload, status))
|
|
72
|
+
invalidJsonMessage: "CircleCI \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94"
|
|
77
73
|
});
|
|
78
74
|
return data ?? {};
|
|
79
75
|
}
|
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
createAuthedClient
|
|
3
|
+
} from "./chunk-XYBU3WZH.js";
|
|
4
|
+
import "./chunk-E6JCVKW6.js";
|
|
4
5
|
import {
|
|
5
6
|
asJsonObject,
|
|
6
7
|
trimmedText
|
|
7
8
|
} from "./chunk-JXHMDBAY.js";
|
|
8
9
|
import {
|
|
9
10
|
createProviderPlugin,
|
|
10
|
-
requireApiKey,
|
|
11
11
|
upstreamError
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-ATK45BXV.js";
|
|
13
|
+
import "./chunk-U7B6DS2O.js";
|
|
14
14
|
import {
|
|
15
15
|
external_exports
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-UZM2RXZH.js";
|
|
17
17
|
import "./chunk-U67V476Y.js";
|
|
18
18
|
|
|
19
19
|
// ../plugins/src/clerk/api.ts
|
|
20
20
|
var SERVICE = "clerk";
|
|
21
|
-
var http = createProviderHttpClient({ baseUrl: "https://api.clerk.com/v1/", service: SERVICE });
|
|
22
21
|
function errorMessage(payload) {
|
|
23
22
|
if (typeof payload === "string") return trimmedText(payload)?.slice(0, 200);
|
|
24
23
|
const body = asJsonObject(payload);
|
|
@@ -29,25 +28,27 @@ function errorMessage(payload) {
|
|
|
29
28
|
}
|
|
30
29
|
return trimmedText(body.message) ?? trimmedText(body.error);
|
|
31
30
|
}
|
|
31
|
+
var http = createAuthedClient({
|
|
32
|
+
baseUrl: "https://api.clerk.com/v1/",
|
|
33
|
+
service: SERVICE,
|
|
34
|
+
auth: { kind: "bearer" },
|
|
35
|
+
headers: { accept: "application/json" },
|
|
36
|
+
mapError: ({ data: payload, status }) => upstreamError(
|
|
37
|
+
status,
|
|
38
|
+
errorMessage(payload) ?? `clerk \u8FD4\u56DE HTTP ${status}`
|
|
39
|
+
),
|
|
40
|
+
mapTransportError: ({ message }) => upstreamError(
|
|
41
|
+
502,
|
|
42
|
+
message === void 0 ? "clerk \u8BF7\u6C42\u5931\u8D25" : `clerk \u8BF7\u6C42\u5931\u8D25: ${message}`
|
|
43
|
+
)
|
|
44
|
+
});
|
|
32
45
|
async function request(ctx, path, input) {
|
|
33
|
-
const { data } = await http.request({
|
|
46
|
+
const { data } = await http.request(ctx, {
|
|
34
47
|
path,
|
|
35
48
|
method: input.method,
|
|
36
49
|
query: input.query,
|
|
37
|
-
headers: {
|
|
38
|
-
accept: "application/json",
|
|
39
|
-
authorization: `Bearer ${requireApiKey(ctx, SERVICE)}`
|
|
40
|
-
},
|
|
41
50
|
...input.body === void 0 ? {} : { json: input.body },
|
|
42
|
-
invalidJson: "text"
|
|
43
|
-
mapError: ({ data: payload, status }) => upstreamError(
|
|
44
|
-
status,
|
|
45
|
-
errorMessage(payload) ?? `clerk \u8FD4\u56DE HTTP ${status}`
|
|
46
|
-
),
|
|
47
|
-
mapTransportError: ({ message }) => upstreamError(
|
|
48
|
-
502,
|
|
49
|
-
message === void 0 ? "clerk \u8BF7\u6C42\u5931\u8D25" : `clerk \u8BF7\u6C42\u5931\u8D25: ${message}`
|
|
50
|
-
)
|
|
51
|
+
invalidJson: "text"
|
|
51
52
|
});
|
|
52
53
|
return data ?? {};
|
|
53
54
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
createAuthedClient
|
|
3
|
+
} from "./chunk-XYBU3WZH.js";
|
|
4
|
+
import "./chunk-E6JCVKW6.js";
|
|
4
5
|
import {
|
|
5
6
|
asJsonObject,
|
|
6
7
|
booleanValue,
|
|
@@ -10,20 +11,18 @@ import {
|
|
|
10
11
|
} from "./chunk-JXHMDBAY.js";
|
|
11
12
|
import {
|
|
12
13
|
createProviderPlugin,
|
|
13
|
-
requireApiKey,
|
|
14
14
|
upstreamError
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-ATK45BXV.js";
|
|
16
|
+
import "./chunk-U7B6DS2O.js";
|
|
17
17
|
import {
|
|
18
18
|
TBError,
|
|
19
19
|
external_exports
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-UZM2RXZH.js";
|
|
21
21
|
import "./chunk-U67V476Y.js";
|
|
22
22
|
|
|
23
23
|
// ../plugins/src/cloudflare_dns/api.ts
|
|
24
24
|
var SERVICE = "cloudflare_dns";
|
|
25
25
|
var API_BASE = "https://api.cloudflare.com/client/v4";
|
|
26
|
-
var http = createProviderHttpClient({ baseUrl: `${API_BASE}/`, service: SERVICE });
|
|
27
26
|
var DEFAULT_ACCOUNTS_PAGE = 1;
|
|
28
27
|
var DEFAULT_ACCOUNTS_PER_PAGE = 50;
|
|
29
28
|
function rawText(value) {
|
|
@@ -61,23 +60,28 @@ function errorMessage(envelope, status) {
|
|
|
61
60
|
}
|
|
62
61
|
return `Cloudflare \u8FD4\u56DE HTTP ${status}`;
|
|
63
62
|
}
|
|
63
|
+
var http = createAuthedClient({
|
|
64
|
+
baseUrl: `${API_BASE}/`,
|
|
65
|
+
service: SERVICE,
|
|
66
|
+
auth: { kind: "bearer" },
|
|
67
|
+
headers: { accept: "application/json" },
|
|
68
|
+
mapError: ({ bodyKind, data, status }) => {
|
|
69
|
+
if (bodyKind === "json" && asJsonObject(data) === void 0) {
|
|
70
|
+
return new TBError("unavailable", "Cloudflare \u54CD\u5E94\u4E0D\u662F\u5BF9\u8C61", { retryable: true });
|
|
71
|
+
}
|
|
72
|
+
const envelope = bodyKind === "json" ? data : {};
|
|
73
|
+
return upstreamError(status, errorMessage(envelope, status));
|
|
74
|
+
}
|
|
75
|
+
});
|
|
64
76
|
async function request(ctx, input) {
|
|
65
77
|
const hasBody = input.body !== void 0;
|
|
66
|
-
const result = await http.request({
|
|
78
|
+
const result = await http.request(ctx, {
|
|
67
79
|
path: input.path,
|
|
68
80
|
method: input.method ?? "GET",
|
|
69
81
|
// 上游 `queryParams`:undefined / null / 空串一律不发。
|
|
70
82
|
query: Object.entries(input.query ?? {}).filter(([, value]) => value !== void 0 && value !== ""),
|
|
71
|
-
headers: { accept: "application/json", authorization: `Bearer ${requireApiKey(ctx, SERVICE)}` },
|
|
72
83
|
...hasBody ? { json: input.body } : {},
|
|
73
|
-
invalidJsonMessage: "Cloudflare \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94"
|
|
74
|
-
mapError: ({ bodyKind, data, status }) => {
|
|
75
|
-
if (bodyKind === "json" && asJsonObject(data) === void 0) {
|
|
76
|
-
return new TBError("unavailable", "Cloudflare \u54CD\u5E94\u4E0D\u662F\u5BF9\u8C61", { retryable: true });
|
|
77
|
-
}
|
|
78
|
-
const envelope2 = bodyKind === "json" ? data : {};
|
|
79
|
-
return upstreamError(status, errorMessage(envelope2, status));
|
|
80
|
-
}
|
|
84
|
+
invalidJsonMessage: "Cloudflare \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94"
|
|
81
85
|
});
|
|
82
86
|
const envelope = result.data === void 0 ? {} : requireRecord(result.data, "Cloudflare \u54CD\u5E94");
|
|
83
87
|
if (envelope.success === false) {
|
|
@@ -1,43 +1,45 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
createAuthedClient
|
|
3
|
+
} from "./chunk-XYBU3WZH.js";
|
|
4
|
+
import "./chunk-E6JCVKW6.js";
|
|
4
5
|
import {
|
|
5
6
|
asJsonObject,
|
|
6
7
|
trimmedText
|
|
7
8
|
} from "./chunk-JXHMDBAY.js";
|
|
8
9
|
import {
|
|
9
10
|
createProviderPlugin,
|
|
10
|
-
requireApiKey,
|
|
11
11
|
upstreamError
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-ATK45BXV.js";
|
|
13
|
+
import "./chunk-U7B6DS2O.js";
|
|
14
14
|
import {
|
|
15
15
|
external_exports
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-UZM2RXZH.js";
|
|
17
17
|
import "./chunk-U67V476Y.js";
|
|
18
18
|
|
|
19
19
|
// ../plugins/src/cohere/api.ts
|
|
20
20
|
var SERVICE = "cohere";
|
|
21
|
-
var http = createProviderHttpClient({ baseUrl: "https://api.cohere.com/", service: SERVICE });
|
|
22
21
|
function errorMessage(payload, status) {
|
|
23
22
|
const fallback = trimmedText(payload) ?? `cohere request failed with ${status}`;
|
|
24
23
|
const root = asJsonObject(payload);
|
|
25
24
|
return trimmedText(asJsonObject(root?.error)?.message) ?? trimmedText(root?.message) ?? fallback;
|
|
26
25
|
}
|
|
26
|
+
var http = createAuthedClient({
|
|
27
|
+
baseUrl: "https://api.cohere.com/",
|
|
28
|
+
service: SERVICE,
|
|
29
|
+
auth: { kind: "bearer" },
|
|
30
|
+
headers: { accept: "application/json" },
|
|
31
|
+
// 498 是 Cohere 表达"token 无效"的私有码,改判 401 让它落 permission_denied。
|
|
32
|
+
mapError: ({ data: payload, status }) => upstreamError(
|
|
33
|
+
status === 498 ? 401 : status,
|
|
34
|
+
errorMessage(payload, status)
|
|
35
|
+
)
|
|
36
|
+
});
|
|
27
37
|
async function post(ctx, path, body) {
|
|
28
|
-
const { data } = await http.request({
|
|
38
|
+
const { data } = await http.request(ctx, {
|
|
29
39
|
path,
|
|
30
40
|
method: "POST",
|
|
31
|
-
headers: {
|
|
32
|
-
accept: "application/json",
|
|
33
|
-
authorization: `Bearer ${requireApiKey(ctx, SERVICE)}`
|
|
34
|
-
},
|
|
35
41
|
json: body,
|
|
36
|
-
invalidJsonMessage: "cohere returned an invalid JSON response"
|
|
37
|
-
mapError: ({ data: payload, status }) => upstreamError(
|
|
38
|
-
status === 498 ? 401 : status,
|
|
39
|
-
errorMessage(payload, status)
|
|
40
|
-
)
|
|
42
|
+
invalidJsonMessage: "cohere returned an invalid JSON response"
|
|
41
43
|
});
|
|
42
44
|
const result = asJsonObject(data);
|
|
43
45
|
if (result === void 0) throw upstreamError(502, "cohere returned an invalid JSON response");
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
createAuthedClient
|
|
3
|
+
} from "./chunk-XYBU3WZH.js";
|
|
4
|
+
import "./chunk-E6JCVKW6.js";
|
|
4
5
|
import {
|
|
5
6
|
asJsonObject,
|
|
6
7
|
booleanValue,
|
|
@@ -12,19 +13,18 @@ import {
|
|
|
12
13
|
createProviderPlugin,
|
|
13
14
|
requireCredential,
|
|
14
15
|
upstreamError
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-ATK45BXV.js";
|
|
17
|
+
import "./chunk-U7B6DS2O.js";
|
|
17
18
|
import {
|
|
18
19
|
TBError,
|
|
19
20
|
external_exports
|
|
20
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-UZM2RXZH.js";
|
|
21
22
|
import "./chunk-U67V476Y.js";
|
|
22
23
|
|
|
23
24
|
// ../plugins/src/confluence/api.ts
|
|
24
25
|
var SERVICE = "confluence";
|
|
25
26
|
var REQUEST_TIMEOUT_MS = 3e4;
|
|
26
27
|
var DEFAULT_LIMIT = 25;
|
|
27
|
-
var http = createProviderHttpClient({ service: SERVICE });
|
|
28
28
|
function requireRecord(value, message) {
|
|
29
29
|
const result = asJsonObject(value);
|
|
30
30
|
if (result === void 0) throw upstreamError(502, message);
|
|
@@ -63,18 +63,23 @@ function errorMessage(payload, context) {
|
|
|
63
63
|
const fromList = Array.isArray(body?.errors) ? body.errors.map((item) => trimmedText(asJsonObject(item)?.message)).find((item) => item !== void 0) : void 0;
|
|
64
64
|
return trimmedText(body?.message) ?? trimmedText(body?.errorMessage) ?? trimmedText(body?.error) ?? fromList ?? trimmedText(context.statusText) ?? "Confluence request failed";
|
|
65
65
|
}
|
|
66
|
+
var http = createAuthedClient({
|
|
67
|
+
service: SERVICE,
|
|
68
|
+
// base URL 由 siteUrl 现算,client 级不配;每次请求逐个传(见 request)。
|
|
69
|
+
auth: { kind: "custom", headers: (ctx) => ({ authorization: basicAuthHeader(ctx) }) },
|
|
70
|
+
headers: { accept: "application/json" },
|
|
71
|
+
mapError: (context) => upstreamError(context.status, errorMessage(context.data, context)),
|
|
72
|
+
mapTransportError: ({ kind, message }) => kind === "timeout" ? upstreamError(504, `Confluence request timed out after ${REQUEST_TIMEOUT_MS / 1e3} seconds`) : upstreamError(502, message === void 0 ? "Confluence request failed" : `Confluence request failed: ${message}`)
|
|
73
|
+
});
|
|
66
74
|
async function request(ctx, options) {
|
|
67
|
-
const result = await http.request({
|
|
75
|
+
const result = await http.request(ctx, {
|
|
68
76
|
baseUrl: `${siteBaseUrl(ctx)}/`,
|
|
69
77
|
path: options.path,
|
|
70
78
|
method: options.method,
|
|
71
79
|
query: Object.entries(options.query ?? {}),
|
|
72
|
-
headers: { accept: "application/json", authorization: basicAuthHeader(ctx) },
|
|
73
80
|
...options.body === void 0 ? {} : { json: options.body },
|
|
74
81
|
timeoutMs: REQUEST_TIMEOUT_MS,
|
|
75
|
-
invalidJson: "text"
|
|
76
|
-
mapError: (context) => upstreamError(context.status, errorMessage(context.data, context)),
|
|
77
|
-
mapTransportError: ({ kind, message }) => kind === "timeout" ? upstreamError(504, `Confluence request timed out after ${REQUEST_TIMEOUT_MS / 1e3} seconds`) : upstreamError(502, message === void 0 ? "Confluence request failed" : `Confluence request failed: ${message}`)
|
|
82
|
+
invalidJson: "text"
|
|
78
83
|
});
|
|
79
84
|
return result.data === void 0 ? null : result.data;
|
|
80
85
|
}
|
|
@@ -6,15 +6,15 @@ import {
|
|
|
6
6
|
createProviderPlugin,
|
|
7
7
|
requireApiKey,
|
|
8
8
|
upstreamError
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ATK45BXV.js";
|
|
10
10
|
import {
|
|
11
11
|
assertPublicHttpUrl,
|
|
12
12
|
guardedFetch
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-U7B6DS2O.js";
|
|
14
14
|
import {
|
|
15
15
|
TBError,
|
|
16
16
|
external_exports
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-UZM2RXZH.js";
|
|
18
18
|
import "./chunk-U67V476Y.js";
|
|
19
19
|
|
|
20
20
|
// ../plugins/src/convertapi/schema.ts
|
|
@@ -1,50 +1,47 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
createAuthedClient
|
|
3
|
+
} from "./chunk-XYBU3WZH.js";
|
|
4
|
+
import "./chunk-E6JCVKW6.js";
|
|
4
5
|
import {
|
|
5
|
-
asJsonObject
|
|
6
|
-
trimmedText
|
|
6
|
+
asJsonObject
|
|
7
7
|
} from "./chunk-JXHMDBAY.js";
|
|
8
8
|
import {
|
|
9
9
|
createProviderPlugin,
|
|
10
|
-
requireApiKey,
|
|
11
10
|
upstreamError
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-ATK45BXV.js";
|
|
12
|
+
import "./chunk-U7B6DS2O.js";
|
|
14
13
|
import {
|
|
15
14
|
external_exports
|
|
16
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-UZM2RXZH.js";
|
|
17
16
|
import "./chunk-U67V476Y.js";
|
|
18
17
|
|
|
19
18
|
// ../plugins/src/currencyapi/api.ts
|
|
20
19
|
var SERVICE = "currencyapi";
|
|
21
20
|
var API_BASE = "https://api.currencyapi.com";
|
|
22
|
-
var http =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
var http = createAuthedClient({
|
|
22
|
+
baseUrl: `${API_BASE}/`,
|
|
23
|
+
service: SERVICE,
|
|
24
|
+
auth: { kind: "header", name: "apikey" },
|
|
25
|
+
headers: { accept: "application/json" },
|
|
26
|
+
errorMessage: {
|
|
27
|
+
keys: ["message", "error.message"],
|
|
28
|
+
fallback: (status) => `currencyapi request failed with ${status || 500}`
|
|
29
|
+
},
|
|
30
|
+
mapTransportError: ({ message }) => upstreamError(
|
|
31
|
+
502,
|
|
32
|
+
message === void 0 ? "currencyapi request failed" : `currencyapi request failed: ${message}`
|
|
33
|
+
)
|
|
34
|
+
});
|
|
28
35
|
function requireObject(value, field) {
|
|
29
36
|
const body = asJsonObject(value);
|
|
30
37
|
if (body === void 0) throw upstreamError(502, `${field} must be an object`);
|
|
31
38
|
return body;
|
|
32
39
|
}
|
|
33
40
|
async function request(ctx, path, query) {
|
|
34
|
-
const
|
|
35
|
-
const { data } = await http.request({
|
|
41
|
+
const { data } = await http.request(ctx, {
|
|
36
42
|
path,
|
|
37
43
|
query: Object.entries(query ?? {}),
|
|
38
|
-
|
|
39
|
-
invalidJson: "text",
|
|
40
|
-
mapError: ({ data: payload, status }) => upstreamError(
|
|
41
|
-
status,
|
|
42
|
-
errorMessage(payload) ?? `currencyapi request failed with ${status || 500}`
|
|
43
|
-
),
|
|
44
|
-
mapTransportError: ({ message }) => upstreamError(
|
|
45
|
-
502,
|
|
46
|
-
message === void 0 ? "currencyapi request failed" : `currencyapi request failed: ${message}`
|
|
47
|
-
)
|
|
44
|
+
invalidJson: "text"
|
|
48
45
|
});
|
|
49
46
|
return requireObject(data ?? null, "payload");
|
|
50
47
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
createAuthedClient
|
|
3
|
+
} from "./chunk-XYBU3WZH.js";
|
|
4
|
+
import "./chunk-E6JCVKW6.js";
|
|
4
5
|
import {
|
|
5
6
|
asJsonObject,
|
|
6
7
|
compactDefined,
|
|
@@ -8,45 +9,54 @@ import {
|
|
|
8
9
|
} from "./chunk-JXHMDBAY.js";
|
|
9
10
|
import {
|
|
10
11
|
createProviderPlugin,
|
|
11
|
-
requireApiKey,
|
|
12
12
|
upstreamError
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-ATK45BXV.js";
|
|
14
|
+
import "./chunk-U7B6DS2O.js";
|
|
15
15
|
import {
|
|
16
16
|
TBError,
|
|
17
17
|
external_exports
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-UZM2RXZH.js";
|
|
19
19
|
import "./chunk-U67V476Y.js";
|
|
20
20
|
|
|
21
21
|
// ../plugins/src/deepseek/api.ts
|
|
22
22
|
var SERVICE = "deepseek";
|
|
23
23
|
var API_BASE = "https://api.deepseek.com";
|
|
24
24
|
var ANTHROPIC_API_PREFIX = "/anthropic";
|
|
25
|
-
var http = createProviderHttpClient({ baseUrl: API_BASE, service: SERVICE });
|
|
26
25
|
function errorMessage(payload, bodyKind, status) {
|
|
27
26
|
const fallback = `deepseek request failed with ${status}`;
|
|
28
27
|
const body = asJsonObject(payload);
|
|
29
28
|
const nested = asJsonObject(body?.error);
|
|
30
29
|
return trimmedText(nested?.message) ?? trimmedText(body?.message) ?? (bodyKind === "invalid-json" || bodyKind === "text" ? trimmedText(payload) : void 0) ?? fallback;
|
|
31
30
|
}
|
|
31
|
+
function mapDeepseekError({ bodyKind, data: payload, status }) {
|
|
32
|
+
return upstreamError(status, errorMessage(payload, bodyKind, status));
|
|
33
|
+
}
|
|
34
|
+
var openaiHttp = createAuthedClient({
|
|
35
|
+
baseUrl: API_BASE,
|
|
36
|
+
service: SERVICE,
|
|
37
|
+
auth: { kind: "bearer" },
|
|
38
|
+
headers: { "content-type": "application/json" },
|
|
39
|
+
mapError: mapDeepseekError
|
|
40
|
+
});
|
|
41
|
+
var anthropicHttp = createAuthedClient({
|
|
42
|
+
baseUrl: `${API_BASE}${ANTHROPIC_API_PREFIX}/`,
|
|
43
|
+
service: SERVICE,
|
|
44
|
+
auth: { kind: "header", name: "x-api-key" },
|
|
45
|
+
headers: { "content-type": "application/json" },
|
|
46
|
+
mapError: mapDeepseekError
|
|
47
|
+
});
|
|
32
48
|
function assertStreamingDisabled(input) {
|
|
33
49
|
if (input.stream === true) {
|
|
34
50
|
throw new TBError("invalid_argument", "stream=true is not supported by connector actions");
|
|
35
51
|
}
|
|
36
52
|
}
|
|
37
53
|
async function request(ctx, options) {
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
path: `${options.anthropic === true ? ANTHROPIC_API_PREFIX : ""}${options.path}`,
|
|
54
|
+
const client = options.anthropic === true ? anthropicHttp : openaiHttp;
|
|
55
|
+
const { data } = await client.request(ctx, {
|
|
56
|
+
path: options.path,
|
|
42
57
|
method: options.method ?? "GET",
|
|
43
|
-
headers,
|
|
44
58
|
...options.body === void 0 ? {} : { json: options.body },
|
|
45
|
-
invalidJsonMessage: "deepseek returned malformed JSON"
|
|
46
|
-
mapError: ({ bodyKind, data: payload, status }) => upstreamError(
|
|
47
|
-
status,
|
|
48
|
-
errorMessage(payload, bodyKind, status)
|
|
49
|
-
)
|
|
59
|
+
invalidJsonMessage: "deepseek returned malformed JSON"
|
|
50
60
|
});
|
|
51
61
|
if (data === void 0) throw upstreamError(502, "deepseek returned malformed JSON");
|
|
52
62
|
return data;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createProviderHttpClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-E6JCVKW6.js";
|
|
4
4
|
import {
|
|
5
5
|
asJsonObject,
|
|
6
6
|
compactDefined,
|
|
@@ -11,12 +11,12 @@ import {
|
|
|
11
11
|
createProviderPlugin,
|
|
12
12
|
requireApiKey,
|
|
13
13
|
upstreamError
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-ATK45BXV.js";
|
|
15
|
+
import "./chunk-U7B6DS2O.js";
|
|
16
16
|
import {
|
|
17
17
|
TBError,
|
|
18
18
|
external_exports
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-UZM2RXZH.js";
|
|
20
20
|
import "./chunk-U67V476Y.js";
|
|
21
21
|
|
|
22
22
|
// ../plugins/src/docker_hub/api.ts
|
|
@@ -2,8 +2,9 @@ import {
|
|
|
2
2
|
bytesToBase64
|
|
3
3
|
} from "./chunk-LMLX3DJF.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./chunk-
|
|
5
|
+
createAuthedClient
|
|
6
|
+
} from "./chunk-XYBU3WZH.js";
|
|
7
|
+
import "./chunk-E6JCVKW6.js";
|
|
7
8
|
import {
|
|
8
9
|
asJsonObject,
|
|
9
10
|
booleanValue,
|
|
@@ -15,21 +16,21 @@ import {
|
|
|
15
16
|
createProviderPlugin,
|
|
16
17
|
requireApiKey,
|
|
17
18
|
upstreamError
|
|
18
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-ATK45BXV.js";
|
|
19
20
|
import {
|
|
20
21
|
guardedFetch
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-U7B6DS2O.js";
|
|
22
23
|
import {
|
|
23
24
|
TBError,
|
|
24
25
|
external_exports
|
|
25
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-UZM2RXZH.js";
|
|
26
27
|
import "./chunk-U67V476Y.js";
|
|
27
28
|
|
|
28
29
|
// ../plugins/src/dropbox/api.ts
|
|
29
30
|
var SERVICE = "dropbox";
|
|
30
31
|
var API_BASE = "https://api.dropboxapi.com/2";
|
|
31
32
|
var CONTENT_BASE = "https://content.dropboxapi.com/2";
|
|
32
|
-
var http =
|
|
33
|
+
var http = createAuthedClient({ baseUrl: `${API_BASE}/`, service: SERVICE, auth: { kind: "bearer" } });
|
|
33
34
|
var MAX_SIMPLE_UPLOAD_BYTES = 150 * 1024 * 1024;
|
|
34
35
|
var DEFAULT_MIME_TYPE = "application/octet-stream";
|
|
35
36
|
function objectArray(value) {
|
|
@@ -117,12 +118,12 @@ function rpcError(context, fallback) {
|
|
|
117
118
|
}
|
|
118
119
|
async function rpc(ctx, route, options = {}) {
|
|
119
120
|
const hasBody = options.body !== void 0;
|
|
120
|
-
const result = await http.request({
|
|
121
|
+
const result = await http.request(ctx, {
|
|
121
122
|
path: route,
|
|
122
123
|
method: "POST",
|
|
123
|
-
headers: { authorization: authHeader(ctx) },
|
|
124
124
|
...hasBody ? { json: options.body } : {},
|
|
125
125
|
invalidJsonMessage: "Dropbox \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94",
|
|
126
|
+
// fallback 文案含 route,只能逐请求给。
|
|
126
127
|
mapError: (context) => rpcError(context, `Dropbox ${route} \u8C03\u7528\u5931\u8D25`)
|
|
127
128
|
});
|
|
128
129
|
if (result.bodyKind === "empty") {
|