@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
|
booleanValue,
|
|
6
7
|
compactDefined
|
|
@@ -9,20 +10,19 @@ import {
|
|
|
9
10
|
createProviderPlugin,
|
|
10
11
|
requireApiKey,
|
|
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/posthog/api.ts
|
|
23
24
|
var SERVICE = "posthog";
|
|
24
25
|
var CURRENT_USER_PATH = "/api/users/@me/";
|
|
25
|
-
var http = createProviderHttpClient({ service: SERVICE });
|
|
26
26
|
function str(value) {
|
|
27
27
|
return typeof value === "string" ? value : void 0;
|
|
28
28
|
}
|
|
@@ -111,8 +111,8 @@ function resolveBaseUrl(ctx) {
|
|
|
111
111
|
return `${parsed.origin}${path}`;
|
|
112
112
|
}
|
|
113
113
|
function resolveAuth(ctx) {
|
|
114
|
-
|
|
115
|
-
return
|
|
114
|
+
requireApiKey(ctx, SERVICE);
|
|
115
|
+
return resolveBaseUrl(ctx);
|
|
116
116
|
}
|
|
117
117
|
function posthogError(status, payload, fallback) {
|
|
118
118
|
const body = nullableRecord(payload);
|
|
@@ -123,27 +123,32 @@ function posthogError(status, payload, fallback) {
|
|
|
123
123
|
function responsePayload(data, bodyKind) {
|
|
124
124
|
return bodyKind === "json" ? data : void 0;
|
|
125
125
|
}
|
|
126
|
+
var http = createAuthedClient({
|
|
127
|
+
service: SERVICE,
|
|
128
|
+
auth: { kind: "bearer" },
|
|
129
|
+
// 迁移前 GET 也带 content-type,保留真实 wire。
|
|
130
|
+
headers: { "content-type": "application/json" },
|
|
131
|
+
// DRF 的 attr 要拼进消息尾巴,标准键序提取表达不了,整段覆写。
|
|
132
|
+
mapError: ({ bodyKind, data, status }) => posthogError(
|
|
133
|
+
status,
|
|
134
|
+
bodyKind === "json" ? data : void 0,
|
|
135
|
+
bodyKind === "empty" ? `${SERVICE} \u8FD4\u56DE HTTP ${status}` : String(data)
|
|
136
|
+
),
|
|
137
|
+
mapTransportError: ({ message }) => new TBError(
|
|
138
|
+
"unavailable",
|
|
139
|
+
`${SERVICE} \u8BF7\u6C42\u5931\u8D25:${message ?? "undefined"}`,
|
|
140
|
+
{ retryable: true }
|
|
141
|
+
)
|
|
142
|
+
});
|
|
126
143
|
async function request(ctx, options) {
|
|
127
|
-
const
|
|
128
|
-
const result = await http.request({
|
|
129
|
-
baseUrl: `${
|
|
144
|
+
const baseUrl = resolveAuth(ctx);
|
|
145
|
+
const result = await http.request(ctx, {
|
|
146
|
+
baseUrl: `${baseUrl}/`,
|
|
130
147
|
path: options.path,
|
|
131
148
|
method: options.method ?? "GET",
|
|
132
149
|
query: Object.entries(options.query ?? {}),
|
|
133
|
-
// 迁移前 GET 也带 content-type,保留真实 wire。
|
|
134
|
-
headers: { "authorization": `Bearer ${auth.token}`, "content-type": "application/json" },
|
|
135
150
|
...options.body === void 0 ? {} : { json: options.body },
|
|
136
|
-
invalidJson: "text"
|
|
137
|
-
mapError: ({ bodyKind, data, status }) => posthogError(
|
|
138
|
-
status,
|
|
139
|
-
bodyKind === "json" ? data : void 0,
|
|
140
|
-
bodyKind === "empty" ? `${SERVICE} \u8FD4\u56DE HTTP ${status}` : String(data)
|
|
141
|
-
),
|
|
142
|
-
mapTransportError: ({ message }) => new TBError(
|
|
143
|
-
"unavailable",
|
|
144
|
-
`${SERVICE} \u8BF7\u6C42\u5931\u8D25:${message ?? "undefined"}`,
|
|
145
|
-
{ retryable: true }
|
|
146
|
-
)
|
|
151
|
+
invalidJson: "text"
|
|
147
152
|
});
|
|
148
153
|
return responsePayload(result.data, result.bodyKind);
|
|
149
154
|
}
|
|
@@ -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,
|
|
@@ -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-QR4LK3HF.js";
|
|
14
|
+
import "./chunk-ZTTN6AJG.js";
|
|
15
15
|
import {
|
|
16
16
|
TBError,
|
|
17
17
|
external_exports
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-MZCIPUNQ.js";
|
|
19
19
|
import "./chunk-U67V476Y.js";
|
|
20
20
|
|
|
21
21
|
// ../plugins/src/postmark/api.ts
|
|
22
22
|
var SERVICE = "postmark";
|
|
23
23
|
var API_BASE = "https://api.postmarkapp.com";
|
|
24
|
-
var http = createProviderHttpClient({ baseUrl: API_BASE, service: SERVICE });
|
|
25
24
|
var INVALID_TOKEN_CODE = 10;
|
|
26
25
|
var NOT_FOUND_CODES = /* @__PURE__ */ new Set([12, 701, 1001, 1101]);
|
|
27
26
|
var ACCOUNT_BLOCKED_CODES = /* @__PURE__ */ new Set([405, 412, 413]);
|
|
@@ -47,21 +46,24 @@ function postmarkError(status, payload) {
|
|
|
47
46
|
}
|
|
48
47
|
return upstreamError(status, message);
|
|
49
48
|
}
|
|
49
|
+
var http = createAuthedClient({
|
|
50
|
+
baseUrl: API_BASE,
|
|
51
|
+
service: SERVICE,
|
|
52
|
+
auth: { kind: "header", name: "x-postmark-server-token" },
|
|
53
|
+
headers: { accept: "application/json" },
|
|
54
|
+
// ErrorCode 码表比 HTTP 状态准(见文件头),整段覆写而不用标准键序提取。
|
|
55
|
+
mapError: ({ bodyKind, data: payload, status }) => postmarkError(
|
|
56
|
+
status,
|
|
57
|
+
bodyKind === "json" ? asJsonObject(payload) ?? {} : bodyKind === "empty" ? {} : { Message: payload }
|
|
58
|
+
)
|
|
59
|
+
});
|
|
50
60
|
async function request(ctx, input) {
|
|
51
|
-
const { data } = await http.request({
|
|
61
|
+
const { data } = await http.request(ctx, {
|
|
52
62
|
path: input.path,
|
|
53
63
|
method: input.method ?? "GET",
|
|
54
64
|
query: Object.entries(input.query ?? {}),
|
|
55
|
-
headers: {
|
|
56
|
-
"accept": "application/json",
|
|
57
|
-
"x-postmark-server-token": requireApiKey(ctx, SERVICE)
|
|
58
|
-
},
|
|
59
65
|
...input.body === void 0 ? {} : { json: input.body },
|
|
60
|
-
invalidJsonMessage: "Postmark \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94"
|
|
61
|
-
mapError: ({ bodyKind, data: payload, status }) => postmarkError(
|
|
62
|
-
status,
|
|
63
|
-
bodyKind === "json" ? asJsonObject(payload) ?? {} : bodyKind === "empty" ? {} : { Message: payload }
|
|
64
|
-
)
|
|
66
|
+
invalidJsonMessage: "Postmark \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94"
|
|
65
67
|
});
|
|
66
68
|
if (data === void 0) throw responseError("Postmark \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94");
|
|
67
69
|
return data;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createProviderHttpClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-Q74GLIDK.js";
|
|
4
4
|
import {
|
|
5
5
|
asJsonObject,
|
|
6
6
|
trimmedText
|
|
@@ -9,12 +9,12 @@ import {
|
|
|
9
9
|
createProviderPlugin,
|
|
10
10
|
requireApiKey,
|
|
11
11
|
upstreamError
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-QR4LK3HF.js";
|
|
13
|
+
import "./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/prerender/api.ts
|
|
@@ -8,14 +8,14 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
createProviderPlugin,
|
|
10
10
|
upstreamError
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-QR4LK3HF.js";
|
|
12
12
|
import {
|
|
13
13
|
guardedFetch
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-ZTTN6AJG.js";
|
|
15
15
|
import {
|
|
16
16
|
TBError,
|
|
17
17
|
external_exports
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-MZCIPUNQ.js";
|
|
19
19
|
import "./chunk-U67V476Y.js";
|
|
20
20
|
|
|
21
21
|
// ../plugins/src/pubmed/api.ts
|
|
@@ -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/railway/api.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
|
compactDefined,
|
|
@@ -9,20 +10,18 @@ import {
|
|
|
9
10
|
} from "./chunk-JXHMDBAY.js";
|
|
10
11
|
import {
|
|
11
12
|
createProviderPlugin,
|
|
12
|
-
requireApiKey,
|
|
13
13
|
upstreamError
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-QR4LK3HF.js";
|
|
15
|
+
import "./chunk-ZTTN6AJG.js";
|
|
16
16
|
import {
|
|
17
17
|
TBError,
|
|
18
18
|
external_exports
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-MZCIPUNQ.js";
|
|
20
20
|
import "./chunk-U67V476Y.js";
|
|
21
21
|
|
|
22
22
|
// ../plugins/src/readwise/api.ts
|
|
23
23
|
var SERVICE = "readwise";
|
|
24
24
|
var API_BASE = "https://readwise.io/api";
|
|
25
|
-
var http = createProviderHttpClient({ baseUrl: `${API_BASE}/`, service: SERVICE });
|
|
26
25
|
function readArray(value) {
|
|
27
26
|
return Array.isArray(value) ? value : [];
|
|
28
27
|
}
|
|
@@ -40,19 +39,21 @@ function errorMessage(payload, status) {
|
|
|
40
39
|
}
|
|
41
40
|
return `Readwise request failed with status ${status}`;
|
|
42
41
|
}
|
|
42
|
+
var http = createAuthedClient({
|
|
43
|
+
baseUrl: `${API_BASE}/`,
|
|
44
|
+
service: SERVICE,
|
|
45
|
+
// Readwise 用的是 `Token <key>`,不是 Bearer —— 写成 Bearer 会一直 401。
|
|
46
|
+
auth: { kind: "token" },
|
|
47
|
+
headers: { accept: "application/json" },
|
|
48
|
+
mapError: ({ bodyKind, data, status }) => bodyKind === "invalid-json" ? new TBError("unavailable", "Readwise \u8FD4\u56DE\u4E86\u975E\u6CD5 JSON", { retryable: true }) : upstreamError(status, errorMessage(data, status))
|
|
49
|
+
});
|
|
43
50
|
async function request(ctx, input) {
|
|
44
|
-
const response = await http.request({
|
|
51
|
+
const response = await http.request(ctx, {
|
|
45
52
|
method: input.method ?? "GET",
|
|
46
53
|
path: input.path,
|
|
47
54
|
query: Object.entries(input.query ?? {}),
|
|
48
|
-
headers: {
|
|
49
|
-
accept: "application/json",
|
|
50
|
-
// Readwise 用的是 `Token <key>`,不是 Bearer —— 写成 Bearer 会一直 401。
|
|
51
|
-
authorization: `Token ${requireApiKey(ctx, SERVICE)}`
|
|
52
|
-
},
|
|
53
55
|
...input.body === void 0 ? {} : { json: input.body },
|
|
54
|
-
invalidJsonMessage: "Readwise \u8FD4\u56DE\u4E86\u975E\u6CD5 JSON"
|
|
55
|
-
mapError: ({ bodyKind, data, status }) => bodyKind === "invalid-json" ? new TBError("unavailable", "Readwise \u8FD4\u56DE\u4E86\u975E\u6CD5 JSON", { retryable: true }) : upstreamError(status, errorMessage(data, status))
|
|
56
|
+
invalidJsonMessage: "Readwise \u8FD4\u56DE\u4E86\u975E\u6CD5 JSON"
|
|
56
57
|
});
|
|
57
58
|
return response.bodyKind === "empty" ? {} : response.data;
|
|
58
59
|
}
|
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
createAuthedClient
|
|
3
|
+
} from "./chunk-JEWFX6Z6.js";
|
|
4
|
+
import "./chunk-Q74GLIDK.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-QR4LK3HF.js";
|
|
12
|
+
import "./chunk-ZTTN6AJG.js";
|
|
13
13
|
import {
|
|
14
14
|
TBError,
|
|
15
15
|
external_exports
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-MZCIPUNQ.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-JEWFX6Z6.js";
|
|
4
|
+
import "./chunk-Q74GLIDK.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-QR4LK3HF.js";
|
|
13
|
+
import "./chunk-ZTTN6AJG.js";
|
|
15
14
|
import {
|
|
16
15
|
TBError,
|
|
17
16
|
external_exports
|
|
18
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-MZCIPUNQ.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-JEWFX6Z6.js";
|
|
4
|
+
import "./chunk-Q74GLIDK.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-QR4LK3HF.js";
|
|
13
|
+
import "./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/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-JEWFX6Z6.js";
|
|
4
|
+
import "./chunk-Q74GLIDK.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-QR4LK3HF.js";
|
|
14
|
+
import "./chunk-ZTTN6AJG.js";
|
|
15
15
|
import {
|
|
16
16
|
external_exports
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-MZCIPUNQ.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-Q74GLIDK.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-QR4LK3HF.js";
|
|
10
|
+
import "./chunk-ZTTN6AJG.js";
|
|
11
11
|
import {
|
|
12
12
|
TBError,
|
|
13
13
|
external_exports
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-MZCIPUNQ.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-Q74GLIDK.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-QR4LK3HF.js";
|
|
13
|
+
import "./chunk-ZTTN6AJG.js";
|
|
14
14
|
import {
|
|
15
15
|
external_exports
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-MZCIPUNQ.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-Q74GLIDK.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-QR4LK3HF.js";
|
|
12
|
+
import "./chunk-ZTTN6AJG.js";
|
|
13
13
|
import {
|
|
14
14
|
external_exports
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-MZCIPUNQ.js";
|
|
16
16
|
import "./chunk-U67V476Y.js";
|
|
17
17
|
|
|
18
18
|
// ../plugins/src/screenshot_fyi/schema.ts
|