@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
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
createAuthedClient
|
|
3
|
+
} from "./chunk-XYBU3WZH.js";
|
|
4
|
+
import "./chunk-E6JCVKW6.js";
|
|
4
5
|
import {
|
|
5
6
|
trimmedText
|
|
6
7
|
} from "./chunk-JXHMDBAY.js";
|
|
7
8
|
import {
|
|
8
9
|
createProviderPlugin,
|
|
9
|
-
requireApiKey,
|
|
10
10
|
upstreamError
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-ATK45BXV.js";
|
|
12
|
+
import "./chunk-U7B6DS2O.js";
|
|
13
13
|
import {
|
|
14
14
|
TBError,
|
|
15
15
|
external_exports
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-UZM2RXZH.js";
|
|
17
17
|
import "./chunk-U67V476Y.js";
|
|
18
18
|
|
|
19
19
|
// ../plugins/src/render/api.ts
|
|
20
20
|
var SERVICE = "render";
|
|
21
21
|
var API_BASE = "https://api.render.com/v1";
|
|
22
|
-
var http = createProviderHttpClient({ baseUrl: `${API_BASE}/`, service: SERVICE });
|
|
23
22
|
function pathSegment(value, field) {
|
|
24
23
|
const parsed = trimmedText(value);
|
|
25
24
|
if (parsed === void 0) throw new TBError("invalid_argument", `${field} \u4E0D\u80FD\u4E3A\u7A7A`);
|
|
@@ -51,28 +50,30 @@ function errorMessage(context) {
|
|
|
51
50
|
}
|
|
52
51
|
return `Render \u8FD4\u56DE HTTP ${context.status}`;
|
|
53
52
|
}
|
|
53
|
+
var http = createAuthedClient({
|
|
54
|
+
baseUrl: `${API_BASE}/`,
|
|
55
|
+
service: SERVICE,
|
|
56
|
+
auth: { kind: "bearer" },
|
|
57
|
+
headers: { accept: "application/json" },
|
|
58
|
+
// errors 数组与 bodyKind 分叉(非 JSON 原文 String 化不 trim),标准键序提取表达不了,整段覆写。
|
|
59
|
+
mapError: (context) => upstreamError(context.status, errorMessage(context)),
|
|
60
|
+
mapTransportError: ({ message }) => new TBError(
|
|
61
|
+
"unavailable",
|
|
62
|
+
message === void 0 ? "Render \u8BF7\u6C42\u5931\u8D25" : `Render \u8BF7\u6C42\u5931\u8D25: ${message}`,
|
|
63
|
+
{ retryable: true }
|
|
64
|
+
)
|
|
65
|
+
});
|
|
54
66
|
async function send(ctx, input) {
|
|
55
|
-
const apiKey = requireApiKey(ctx, SERVICE);
|
|
56
67
|
const query = Object.entries(input.query ?? {}).flatMap(([key, value]) => {
|
|
57
68
|
if (Array.isArray(value)) return value.length === 0 ? [] : [[key, value.join(",")]];
|
|
58
69
|
return [[key, value]];
|
|
59
70
|
});
|
|
60
|
-
return await http.request({
|
|
71
|
+
return await http.request(ctx, {
|
|
61
72
|
method: input.method ?? "GET",
|
|
62
73
|
path: input.path,
|
|
63
74
|
query,
|
|
64
|
-
headers: {
|
|
65
|
-
accept: "application/json",
|
|
66
|
-
authorization: `Bearer ${apiKey}`
|
|
67
|
-
},
|
|
68
75
|
...input.body === void 0 ? {} : { json: input.body },
|
|
69
|
-
invalidJson: "text"
|
|
70
|
-
mapError: (context) => upstreamError(context.status, errorMessage(context)),
|
|
71
|
-
mapTransportError: ({ message }) => new TBError(
|
|
72
|
-
"unavailable",
|
|
73
|
-
message === void 0 ? "Render \u8BF7\u6C42\u5931\u8D25" : `Render \u8BF7\u6C42\u5931\u8D25: ${message}`,
|
|
74
|
-
{ retryable: true }
|
|
75
|
-
)
|
|
76
|
+
invalidJson: "text"
|
|
76
77
|
});
|
|
77
78
|
}
|
|
78
79
|
async function requestJson(ctx, input) {
|
|
@@ -1,28 +1,36 @@
|
|
|
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,
|
|
7
8
|
trimmedText
|
|
8
9
|
} from "./chunk-JXHMDBAY.js";
|
|
9
10
|
import {
|
|
10
|
-
createProviderPlugin
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} from "./chunk-6ANLYNFB.js";
|
|
14
|
-
import "./chunk-3WL6EXYX.js";
|
|
11
|
+
createProviderPlugin
|
|
12
|
+
} from "./chunk-ATK45BXV.js";
|
|
13
|
+
import "./chunk-U7B6DS2O.js";
|
|
15
14
|
import {
|
|
16
15
|
TBError,
|
|
17
16
|
external_exports
|
|
18
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-UZM2RXZH.js";
|
|
19
18
|
import "./chunk-U67V476Y.js";
|
|
20
19
|
|
|
21
20
|
// ../plugins/src/replicate/api.ts
|
|
22
21
|
var SERVICE = "replicate";
|
|
23
22
|
var API_BASE = "https://api.replicate.com";
|
|
24
23
|
var ACCOUNT_PATH = "/v1/account";
|
|
25
|
-
var http =
|
|
24
|
+
var http = createAuthedClient({
|
|
25
|
+
baseUrl: `${API_BASE}/`,
|
|
26
|
+
service: SERVICE,
|
|
27
|
+
auth: { kind: "bearer" },
|
|
28
|
+
headers: { accept: "application/json" },
|
|
29
|
+
errorMessage: {
|
|
30
|
+
keys: ["detail", "title"],
|
|
31
|
+
fallback: (status) => `Replicate \u8FD4\u56DE HTTP ${status}`
|
|
32
|
+
}
|
|
33
|
+
});
|
|
26
34
|
function required(value, field) {
|
|
27
35
|
const trimmed = trimmedText(value);
|
|
28
36
|
if (trimmed === void 0) throw new TBError("invalid_argument", `${field} \u4E0D\u80FD\u4E3A\u7A7A`);
|
|
@@ -32,23 +40,14 @@ function segment(value, field) {
|
|
|
32
40
|
return encodeURIComponent(required(value, field));
|
|
33
41
|
}
|
|
34
42
|
async function request(ctx, input) {
|
|
35
|
-
const
|
|
36
|
-
accept: "application/json",
|
|
37
|
-
authorization: `Bearer ${requireApiKey(ctx, SERVICE)}`,
|
|
38
|
-
...input.headers
|
|
39
|
-
};
|
|
40
|
-
const response = await http.request({
|
|
43
|
+
const response = await http.request(ctx, {
|
|
41
44
|
method: input.method ?? "GET",
|
|
42
45
|
path: input.path,
|
|
43
46
|
// 上游这里连空串一起跳过(空的 created_after 打出去会被上游当成非法时间戳)。
|
|
44
47
|
query: Object.entries(input.query ?? {}).filter(([, value]) => value !== void 0 && value !== ""),
|
|
45
|
-
headers,
|
|
48
|
+
headers: input.headers,
|
|
46
49
|
...input.body === void 0 ? {} : { json: input.body },
|
|
47
|
-
invalidJson: "text"
|
|
48
|
-
mapError: ({ bodyKind, data, status }) => {
|
|
49
|
-
const body = bodyKind === "json" ? asJsonObject(data) ?? {} : { detail: data };
|
|
50
|
-
return upstreamError(status, trimmedText(body.detail) ?? trimmedText(body.title) ?? `Replicate \u8FD4\u56DE HTTP ${status}`);
|
|
51
|
-
}
|
|
50
|
+
invalidJson: "text"
|
|
52
51
|
});
|
|
53
52
|
if (response.bodyKind === "empty") return {};
|
|
54
53
|
if (response.bodyKind !== "json") {
|
|
@@ -1,20 +1,20 @@
|
|
|
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
|
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/resend/schema.handwritten.ts
|
|
@@ -45,7 +45,6 @@ var resendActions = {
|
|
|
45
45
|
// ../plugins/src/resend/api.ts
|
|
46
46
|
var SERVICE = "resend";
|
|
47
47
|
var AUTH_ERROR_NAMES = /* @__PURE__ */ new Set(["invalid_api_key", "missing_api_key"]);
|
|
48
|
-
var http = createProviderHttpClient({ baseUrl: "https://api.resend.com/", service: SERVICE });
|
|
49
48
|
function payloadOf(data) {
|
|
50
49
|
return asJsonObject(data) ?? (typeof data === "string" ? { message: data } : {});
|
|
51
50
|
}
|
|
@@ -55,11 +54,17 @@ function resendError(status, data) {
|
|
|
55
54
|
const message = trimmedText(payload.message) ?? trimmedText(payload.error_description) ?? `Resend \u8FD4\u56DE HTTP ${status}`;
|
|
56
55
|
return AUTH_ERROR_NAMES.has(name) ? new TBError("permission_denied", message, { httpStatus: 401 }) : upstreamError(status, message);
|
|
57
56
|
}
|
|
57
|
+
var http = createAuthedClient({
|
|
58
|
+
baseUrl: "https://api.resend.com/",
|
|
59
|
+
service: SERVICE,
|
|
60
|
+
auth: { kind: "bearer" },
|
|
61
|
+
// 错误码表(invalid_api_key 等改判 permission_denied),整段覆写而不用标准键序提取。
|
|
62
|
+
mapError: ({ data: payload, status }) => resendError(status, payload)
|
|
63
|
+
});
|
|
58
64
|
async function sendEmail(input, ctx) {
|
|
59
|
-
const { data } = await http.request({
|
|
65
|
+
const { data } = await http.request(ctx, {
|
|
60
66
|
path: "emails",
|
|
61
67
|
method: "POST",
|
|
62
|
-
headers: { authorization: `Bearer ${requireApiKey(ctx, SERVICE)}` },
|
|
63
68
|
json: {
|
|
64
69
|
from: input.from,
|
|
65
70
|
to: input.to,
|
|
@@ -67,8 +72,7 @@ async function sendEmail(input, ctx) {
|
|
|
67
72
|
...input.html === void 0 ? {} : { html: input.html },
|
|
68
73
|
...input.text === void 0 ? {} : { text: input.text }
|
|
69
74
|
},
|
|
70
|
-
invalidJson: "text"
|
|
71
|
-
mapError: ({ data: payload, status }) => resendError(status, payload)
|
|
75
|
+
invalidJson: "text"
|
|
72
76
|
});
|
|
73
77
|
const emailId = trimmedText(payloadOf(data).id);
|
|
74
78
|
if (emailId === void 0) {
|
|
@@ -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,20 +9,18 @@ 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
|
external_exports
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-UZM2RXZH.js";
|
|
18
18
|
import "./chunk-U67V476Y.js";
|
|
19
19
|
|
|
20
20
|
// ../plugins/src/rootly/api.ts
|
|
21
21
|
var SERVICE = "rootly";
|
|
22
22
|
var API_BASE = "https://api.rootly.com/v1";
|
|
23
23
|
var JSON_API_CONTENT_TYPE = "application/vnd.api+json";
|
|
24
|
-
var http = createProviderHttpClient({ baseUrl: `${API_BASE}/`, service: SERVICE });
|
|
25
24
|
function requireRecord(value, label) {
|
|
26
25
|
const record = asJsonObject(value);
|
|
27
26
|
if (record === void 0) throw upstreamError(502, `${label} was not an object`);
|
|
@@ -33,20 +32,22 @@ function errorMessage(payload, status) {
|
|
|
33
32
|
const first = asJsonObject(errors[0]);
|
|
34
33
|
return trimmedText(first?.detail) ?? trimmedText(first?.title) ?? `Rootly request failed with ${status}`;
|
|
35
34
|
}
|
|
35
|
+
var http = createAuthedClient({
|
|
36
|
+
baseUrl: `${API_BASE}/`,
|
|
37
|
+
service: SERVICE,
|
|
38
|
+
auth: { kind: "bearer" },
|
|
39
|
+
headers: { "accept": JSON_API_CONTENT_TYPE, "content-type": JSON_API_CONTENT_TYPE },
|
|
40
|
+
// JSON:API 的消息在 `errors[0].detail/title`,非 JSON 体还要包成同形再提取,整段覆写。
|
|
41
|
+
mapError: ({ bodyKind, data, status }) => upstreamError(
|
|
42
|
+
status,
|
|
43
|
+
errorMessage(bodyKind === "json" ? data : { errors: [{ detail: data }] }, status)
|
|
44
|
+
)
|
|
45
|
+
});
|
|
36
46
|
async function requestJson(ctx, path, query) {
|
|
37
|
-
const response = await http.request({
|
|
47
|
+
const response = await http.request(ctx, {
|
|
38
48
|
path,
|
|
39
49
|
query: Object.entries(query),
|
|
40
|
-
|
|
41
|
-
"accept": JSON_API_CONTENT_TYPE,
|
|
42
|
-
"authorization": `Bearer ${requireApiKey(ctx, SERVICE)}`,
|
|
43
|
-
"content-type": JSON_API_CONTENT_TYPE
|
|
44
|
-
},
|
|
45
|
-
invalidJson: "text",
|
|
46
|
-
mapError: ({ bodyKind, data, status }) => upstreamError(
|
|
47
|
-
status,
|
|
48
|
-
errorMessage(bodyKind === "json" ? data : { errors: [{ detail: data }] }, status)
|
|
49
|
-
)
|
|
50
|
+
invalidJson: "text"
|
|
50
51
|
});
|
|
51
52
|
if (response.bodyKind === "empty") return {};
|
|
52
53
|
if (response.bodyKind !== "json") throw upstreamError(502, "Rootly returned invalid JSON");
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createProviderHttpClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-E6JCVKW6.js";
|
|
4
4
|
import "./chunk-JXHMDBAY.js";
|
|
5
5
|
import {
|
|
6
6
|
createProviderPlugin,
|
|
7
7
|
requireApiKey,
|
|
8
8
|
upstreamError
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-ATK45BXV.js";
|
|
10
|
+
import "./chunk-U7B6DS2O.js";
|
|
11
11
|
import {
|
|
12
12
|
TBError,
|
|
13
13
|
external_exports
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-UZM2RXZH.js";
|
|
15
15
|
import "./chunk-U67V476Y.js";
|
|
16
16
|
|
|
17
17
|
// ../plugins/src/scrapfly/api.ts
|
|
@@ -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
|
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
createProviderPlugin,
|
|
10
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/scrapingbee/api.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createProviderHttpClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-E6JCVKW6.js";
|
|
4
4
|
import {
|
|
5
5
|
trimmedText
|
|
6
6
|
} from "./chunk-JXHMDBAY.js";
|
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
createProviderPlugin,
|
|
9
9
|
requireApiKey,
|
|
10
10
|
upstreamError
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-ATK45BXV.js";
|
|
12
|
+
import "./chunk-U7B6DS2O.js";
|
|
13
13
|
import {
|
|
14
14
|
external_exports
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-UZM2RXZH.js";
|
|
16
16
|
import "./chunk-U67V476Y.js";
|
|
17
17
|
|
|
18
18
|
// ../plugins/src/screenshot_fyi/schema.ts
|
|
@@ -1,19 +1,19 @@
|
|
|
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
|
} from "./chunk-JXHMDBAY.js";
|
|
7
8
|
import {
|
|
8
9
|
createProviderPlugin,
|
|
9
|
-
requireApiKey,
|
|
10
10
|
upstreamError
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-ATK45BXV.js";
|
|
12
|
+
import "./chunk-U7B6DS2O.js";
|
|
13
13
|
import {
|
|
14
14
|
TBError,
|
|
15
15
|
external_exports
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-UZM2RXZH.js";
|
|
17
17
|
import "./chunk-U67V476Y.js";
|
|
18
18
|
|
|
19
19
|
// ../plugins/src/semantic_scholar/api.ts
|
|
@@ -21,11 +21,6 @@ var SERVICE = "semantic_scholar";
|
|
|
21
21
|
var GRAPH_BASE = "https://api.semanticscholar.org/graph/v1";
|
|
22
22
|
var RECOMMENDATIONS_BASE = "https://api.semanticscholar.org/recommendations/v1";
|
|
23
23
|
var REQUEST_TIMEOUT_MS = 3e4;
|
|
24
|
-
var graphHttp = createProviderHttpClient({ baseUrl: `${GRAPH_BASE}/`, service: SERVICE });
|
|
25
|
-
var recommendationsHttp = createProviderHttpClient({
|
|
26
|
-
baseUrl: `${RECOMMENDATIONS_BASE}/`,
|
|
27
|
-
service: SERVICE
|
|
28
|
-
});
|
|
29
24
|
function trimmed(value) {
|
|
30
25
|
if (typeof value !== "string") return void 0;
|
|
31
26
|
const result = value.trim();
|
|
@@ -82,23 +77,29 @@ function errorMessage(payload, status) {
|
|
|
82
77
|
const body = asJsonObject(payload);
|
|
83
78
|
return trimmed(body?.message) ?? trimmed(body?.error) ?? trimmed(body?.detail) ?? `Semantic Scholar \u8FD4\u56DE HTTP ${status}`;
|
|
84
79
|
}
|
|
80
|
+
function s2Client(baseUrl) {
|
|
81
|
+
return createAuthedClient({
|
|
82
|
+
baseUrl,
|
|
83
|
+
service: SERVICE,
|
|
84
|
+
auth: { kind: "header", name: "x-api-key" },
|
|
85
|
+
headers: { accept: "application/json" },
|
|
86
|
+
// invalid-json 与常规错误体走不同分支,标准键序提取表达不了,整段覆写。
|
|
87
|
+
mapError: ({ bodyKind, data, status }) => bodyKind === "invalid-json" ? new TBError("unavailable", "Semantic Scholar \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94", { retryable: true }) : upstreamError(status, errorMessage(data, status)),
|
|
88
|
+
mapTransportError: ({ kind, message }) => kind === "timeout" ? upstreamError(504, `Semantic Scholar \u8BF7\u6C42\u8D85\u65F6(${REQUEST_TIMEOUT_MS / 1e3} \u79D2)`) : upstreamError(502, `Semantic Scholar \u8BF7\u6C42\u5931\u8D25:${message ?? "unknown network error"}`)
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
var graphHttp = s2Client(`${GRAPH_BASE}/`);
|
|
92
|
+
var recommendationsHttp = s2Client(`${RECOMMENDATIONS_BASE}/`);
|
|
85
93
|
async function request(ctx, input) {
|
|
86
|
-
const headers = {
|
|
87
|
-
"accept": "application/json",
|
|
88
|
-
"x-api-key": requireApiKey(ctx, SERVICE)
|
|
89
|
-
};
|
|
90
94
|
const http = input.family === "graph" ? graphHttp : recommendationsHttp;
|
|
91
|
-
const response = await http.request({
|
|
95
|
+
const response = await http.request(ctx, {
|
|
92
96
|
method: input.method,
|
|
93
97
|
path: input.path,
|
|
94
98
|
query: Object.entries(input.params ?? {}),
|
|
95
|
-
headers,
|
|
96
99
|
// 上游对 POST 一律发 body(没给就发 `{}`),保留:batch 端点不接受空请求。
|
|
97
100
|
...input.method === "POST" ? { json: input.body ?? {} } : {},
|
|
98
101
|
timeoutMs: REQUEST_TIMEOUT_MS,
|
|
99
|
-
invalidJsonMessage: "Semantic Scholar \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94"
|
|
100
|
-
mapError: ({ bodyKind, data, status }) => bodyKind === "invalid-json" ? new TBError("unavailable", "Semantic Scholar \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94", { retryable: true }) : upstreamError(status, errorMessage(data, status)),
|
|
101
|
-
mapTransportError: ({ kind, message }) => kind === "timeout" ? upstreamError(504, `Semantic Scholar \u8BF7\u6C42\u8D85\u65F6(${REQUEST_TIMEOUT_MS / 1e3} \u79D2)`) : upstreamError(502, `Semantic Scholar \u8BF7\u6C42\u5931\u8D25:${message ?? "unknown network error"}`)
|
|
102
|
+
invalidJsonMessage: "Semantic Scholar \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94"
|
|
102
103
|
});
|
|
103
104
|
return response.bodyKind === "empty" ? null : response.data;
|
|
104
105
|
}
|
|
@@ -1,26 +1,25 @@
|
|
|
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
|
|
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
|
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/sentry/api.ts
|
|
21
21
|
var SERVICE = "sentry";
|
|
22
22
|
var API_BASE = "https://sentry.io/api/0/";
|
|
23
|
-
var http = createProviderHttpClient({ baseUrl: API_BASE, service: SERVICE });
|
|
24
23
|
function str(value) {
|
|
25
24
|
return typeof value === "string" ? value : void 0;
|
|
26
25
|
}
|
|
@@ -77,26 +76,30 @@ function errorMessage(payload, status) {
|
|
|
77
76
|
const nested = str(asJsonObject(body?.detail)?.message);
|
|
78
77
|
return pickStr(body?.error_description, body?.detail, body?.error, body?.message) ?? (nonEmpty(nested) ? nested : void 0) ?? `Sentry \u8FD4\u56DE HTTP ${status}`;
|
|
79
78
|
}
|
|
79
|
+
var http = createAuthedClient({
|
|
80
|
+
baseUrl: API_BASE,
|
|
81
|
+
service: SERVICE,
|
|
82
|
+
auth: { kind: "bearer" },
|
|
83
|
+
headers: { accept: "application/json" },
|
|
84
|
+
mapError: ({ bodyKind, data, headers, status }) => {
|
|
85
|
+
const payload = headers.get("content-type")?.includes("application/json") === true && bodyKind === "json" ? data : null;
|
|
86
|
+
return upstreamError(status, errorMessage(payload, status));
|
|
87
|
+
},
|
|
88
|
+
mapTransportError: ({ message }) => upstreamError(
|
|
89
|
+
502,
|
|
90
|
+
`Sentry \u8BF7\u6C42\u5931\u8D25:${message ?? "\u672A\u77E5\u9519\u8BEF"}`
|
|
91
|
+
)
|
|
92
|
+
});
|
|
80
93
|
async function request(ctx, path, options = {}) {
|
|
81
|
-
const
|
|
82
|
-
const result = await http.request({
|
|
94
|
+
const result = await http.request(ctx, {
|
|
83
95
|
// path 不带前导斜杠 —— 见文件头注释,否则 /api/0 前缀会被整段吃掉。
|
|
84
96
|
path,
|
|
85
97
|
method: options.method ?? "GET",
|
|
86
98
|
// 多值过滤器(environment / project / field …)展开成重复的同名参数。
|
|
87
99
|
query: Object.entries(options.query ?? {}),
|
|
88
|
-
headers: { accept: "application/json", authorization: `Bearer ${token}` },
|
|
89
100
|
...options.body === void 0 ? {} : { json: options.body },
|
|
90
101
|
invalidJson: "text",
|
|
91
|
-
responseType: "auto"
|
|
92
|
-
mapError: ({ bodyKind, data, headers, status }) => {
|
|
93
|
-
const payload2 = headers.get("content-type")?.includes("application/json") === true && bodyKind === "json" ? data : null;
|
|
94
|
-
return upstreamError(status, errorMessage(payload2, status));
|
|
95
|
-
},
|
|
96
|
-
mapTransportError: ({ message }) => upstreamError(
|
|
97
|
-
502,
|
|
98
|
-
`Sentry \u8BF7\u6C42\u5931\u8D25:${message ?? "\u672A\u77E5\u9519\u8BEF"}`
|
|
99
|
-
)
|
|
102
|
+
responseType: "auto"
|
|
100
103
|
});
|
|
101
104
|
const payload = result.headers.get("content-type")?.includes("application/json") === true && result.bodyKind === "json" ? result.data : null;
|
|
102
105
|
return { payload, headers: result.headers };
|
|
@@ -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
|
booleanValue,
|
|
@@ -10,12 +10,12 @@ import {
|
|
|
10
10
|
createProviderPlugin,
|
|
11
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/shodan/api.ts
|
|
@@ -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
|
trimmedText
|
|
@@ -9,19 +10,18 @@ import {
|
|
|
9
10
|
createProviderPlugin,
|
|
10
11
|
requireCredential,
|
|
11
12
|
upstreamError
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-ATK45BXV.js";
|
|
14
|
+
import "./chunk-U7B6DS2O.js";
|
|
14
15
|
import {
|
|
15
16
|
TBError,
|
|
16
17
|
external_exports
|
|
17
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-UZM2RXZH.js";
|
|
18
19
|
import "./chunk-U67V476Y.js";
|
|
19
20
|
|
|
20
21
|
// ../plugins/src/shopify/api.ts
|
|
21
22
|
var SERVICE = "shopify";
|
|
22
23
|
var REST_API_VERSION = "2026-04";
|
|
23
24
|
var MYSHOPIFY_SUFFIX = ".myshopify.com";
|
|
24
|
-
var http = createProviderHttpClient({ service: SERVICE });
|
|
25
25
|
function requireRecord(value, label) {
|
|
26
26
|
const result = asJsonObject(value);
|
|
27
27
|
if (result === void 0) throw new TBError("unavailable", `Shopify \u54CD\u5E94\u7F3A\u5C11 ${label}`, { retryable: true });
|
|
@@ -102,23 +102,27 @@ function pageInfoForRel(linkHeader, rel) {
|
|
|
102
102
|
}
|
|
103
103
|
return null;
|
|
104
104
|
}
|
|
105
|
+
var http = createAuthedClient({
|
|
106
|
+
service: SERVICE,
|
|
107
|
+
auth: {
|
|
108
|
+
kind: "custom",
|
|
109
|
+
headers: (ctx) => ({ "x-shopify-access-token": requireCredential(ctx, SERVICE, "apiKey") })
|
|
110
|
+
},
|
|
111
|
+
headers: { accept: "application/json" },
|
|
112
|
+
mapError: ({ data, status }) => {
|
|
113
|
+
const detail = errorDetail(data);
|
|
114
|
+
return upstreamError(
|
|
115
|
+
status,
|
|
116
|
+
detail === void 0 ? `Shopify REST \u8FD4\u56DE HTTP ${status}` : `Shopify REST \u8FD4\u56DE HTTP ${status}: ${detail}`
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
105
120
|
async function request(ctx, path, query) {
|
|
106
|
-
const result = await http.request({
|
|
121
|
+
const result = await http.request(ctx, {
|
|
107
122
|
baseUrl: `https://${shopHost(ctx)}/admin/api/${REST_API_VERSION}/`,
|
|
108
123
|
path,
|
|
109
124
|
query: Object.entries(query ?? {}),
|
|
110
|
-
|
|
111
|
-
"accept": "application/json",
|
|
112
|
-
"x-shopify-access-token": requireCredential(ctx, SERVICE, "apiKey")
|
|
113
|
-
},
|
|
114
|
-
invalidJsonMessage: "Shopify REST \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94",
|
|
115
|
-
mapError: ({ data, status }) => {
|
|
116
|
-
const detail = errorDetail(data);
|
|
117
|
-
return upstreamError(
|
|
118
|
-
status,
|
|
119
|
-
detail === void 0 ? `Shopify REST \u8FD4\u56DE HTTP ${status}` : `Shopify REST \u8FD4\u56DE HTTP ${status}: ${detail}`
|
|
120
|
-
);
|
|
121
|
-
}
|
|
125
|
+
invalidJsonMessage: "Shopify REST \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94"
|
|
122
126
|
});
|
|
123
127
|
return {
|
|
124
128
|
payload: result.data === void 0 ? null : result.data,
|
|
@@ -2,14 +2,14 @@ import {
|
|
|
2
2
|
createProviderPlugin,
|
|
3
3
|
requireApiKey,
|
|
4
4
|
upstreamError
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ATK45BXV.js";
|
|
6
6
|
import {
|
|
7
7
|
guardedFetch
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-U7B6DS2O.js";
|
|
9
9
|
import {
|
|
10
10
|
TBError,
|
|
11
11
|
external_exports
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-UZM2RXZH.js";
|
|
13
13
|
import "./chunk-U67V476Y.js";
|
|
14
14
|
|
|
15
15
|
// ../plugins/src/stripe/api.ts
|