@tool-bridge/server 0.21.1 → 0.23.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/admin.js +170 -0
- package/dist/airtable-VMQVXLHK.js +790 -0
- package/dist/{alt_text_generator_ai-W7O34SNG.js → alt_text_generator_ai-FTWY4RU4.js} +12 -11
- package/dist/{amap-VOX4T2AW.js → amap-OK5VBHYC.js} +221 -220
- package/dist/anthropic-S67AZFZ3.js +203 -0
- package/dist/apify-ZE6MYQI3.js +248 -0
- package/dist/brave_search-TG2M2KOD.js +302 -0
- package/dist/chunk-2JNAI4OC.js +161 -0
- package/dist/{chunk-KMTT3I6D.js → chunk-4XJPN3DY.js} +19392 -26136
- package/dist/chunk-5ICRY3VU.js +8432 -0
- package/dist/chunk-7CTWGTDU.js +302 -0
- package/dist/chunk-BADVCN6K.js +378 -0
- package/dist/{chunk-XYBU3WZH.js → chunk-TDAWLMDE.js} +3 -3
- package/dist/chunk-U7PTOA3U.js +7320 -0
- package/dist/{chunk-E6JCVKW6.js → chunk-VWRUGUSU.js} +3 -3
- package/dist/{chunk-ATK45BXV.js → chunk-WJHG6OK7.js} +4 -2
- package/dist/circleci-3L3WJVSK.js +389 -0
- package/dist/clerk-EZPF2V7T.js +1019 -0
- package/dist/cohere-U27DPO64.js +185 -0
- package/dist/{confluence-B3EWPZVE.js → confluence-G2KL6ERH.js} +105 -104
- package/dist/{convertapi-EUWSQYPF.js → convertapi-L4CLJ2M3.js} +32 -31
- package/dist/{currencyapi-KVTIK3GL.js → currencyapi-YPYXG7YY.js} +71 -71
- package/dist/deepseek-6HT6WF3M.js +210 -0
- package/dist/docker_hub-LPE3PCVB.js +933 -0
- package/dist/dropbox-V56ABHTA.js +1305 -0
- package/dist/dub-6OKQ7MHT.js +680 -0
- package/dist/e2b-JS2U2QFU.js +278 -0
- package/dist/exa-DPWVYXSP.js +332 -0
- package/dist/{fal_ai-23E7JPNT.js → fal_ai-DK6Y27ZF.js} +81 -80
- package/dist/{feishu-7QRIDUV6.js → feishu-K7EGSRF3.js} +528 -572
- package/dist/{feishu_custom_bot-TJ4K7QNJ.js → feishu_custom_bot-2JUGFYNG.js} +57 -53
- package/dist/figma-FT5I7ITD.js +777 -0
- package/dist/firehydrant-EIKLKHX2.js +563 -0
- package/dist/{fixer-BWON27UO.js → fixer-U5QXIAKD.js} +34 -33
- package/dist/fly-T3JYFZ2M.js +469 -0
- package/dist/{front-QCGXYEDJ.js → front-D72MGVOR.js} +104 -104
- package/dist/geocodio-BOTD5TI5.js +213 -0
- package/dist/ghost-KYP7SZGB.js +338 -0
- package/dist/github-AGMZT3VY.js +5421 -0
- package/dist/gmail-BLJNJOBG.js +1887 -0
- package/dist/googlecalendar-GTHWNCF6.js +2524 -0
- package/dist/{googledocs-BUHL4J2H.js → googledocs-6EEDMEBQ.js} +341 -340
- package/dist/{grafana-GLU2DWF2.js → grafana-GMW6EKSQ.js} +221 -220
- package/dist/graphhopper-6OLGBDGB.js +325 -0
- package/dist/index.d.ts +1132 -332
- package/dist/index.js +31 -14
- package/dist/{ip2proxy-EZ64Y4ZH.js → ip2proxy-4QN42E6T.js} +28 -27
- package/dist/ipgeolocation_io-SK4XKDA2.js +315 -0
- package/dist/ipqualityscore-6ANBPXKT.js +279 -0
- package/dist/{jina_ai-EFBHTBXL.js → jina_ai-IHPSVRM5.js} +23 -23
- package/dist/{jira-HQSHAA5K.js → jira-46KKM4LC.js} +118 -117
- package/dist/langsmith-JZA345I5.js +593 -0
- package/dist/lemlist-43IV7DK6.js +289 -0
- package/dist/{linear-K7RYFYAD.js → linear-5LFH7XNL.js} +327 -326
- package/dist/logsnag-5RMYAHIL.js +150 -0
- package/dist/main.js +57 -280
- package/dist/{mattermost-S2BRCWLQ.js → mattermost-XFL6SHGG.js} +59 -58
- package/dist/mem0-NYO4DTP6.js +544 -0
- package/dist/memos-37MPQOLV.js +744 -0
- package/dist/{metabase-MMSEPCOF.js → metabase-KYBKZFMG.js} +90 -89
- package/dist/mistral_ai-6PL3K4PM.js +1196 -0
- package/dist/{mother_duck-H7PCQNZ2.js → mother_duck-2NH7W5M5.js} +94 -93
- package/dist/ngrok-UO6CDYCA.js +356 -0
- package/dist/{notes-PFMKRO33.js → notes-I3P32WP4.js} +11 -9
- package/dist/notion-BEAJFUOE.js +940 -0
- package/dist/open_exchange_rates-CMF62JB4.js +215 -0
- package/dist/openai-IHOMKVND.js +800 -0
- package/dist/opengraph_io-ZQ2FGLHX.js +362 -0
- package/dist/openrouter-HXLW3NR5.js +441 -0
- package/dist/outline-ELCP4NEU.js +599 -0
- package/dist/paddle-O77LALVN.js +454 -0
- package/dist/perplexity-JCU654QV.js +220 -0
- package/dist/pinecone-W5W4LRKL.js +571 -0
- package/dist/{pipedrive-Y2O7QGFF.js → pipedrive-ITMJLLPZ.js} +99 -98
- package/dist/polar-R33XU4L3.js +395 -0
- package/dist/posthog-JVNTOLTV.js +3464 -0
- package/dist/postmark-6SBG7HWV.js +427 -0
- package/dist/{prerender-MENYM2TY.js → prerender-GPNKTNFC.js} +31 -30
- package/dist/{pubmed-GOXUVVH5.js → pubmed-UP6ZEEIH.js} +239 -238
- package/dist/{railway-V2SID4WV.js → railway-KWEWXHTY.js} +118 -117
- package/dist/readwise-BLATSMC3.js +470 -0
- package/dist/render-QYRVIXII.js +461 -0
- package/dist/{replicate-756MXPYX.js → replicate-JYTWH4NF.js} +81 -80
- package/dist/{resend-ZKH3BTBI.js → resend-L5N75SZM.js} +20 -16
- package/dist/rootly-MHCPEQ26.js +336 -0
- package/dist/{scrapfly-NSRHFDIQ.js → scrapfly-PTPGYSJM.js} +62 -61
- package/dist/{scrapingbee-OQHLAVEY.js → scrapingbee-JN6UH5PY.js} +56 -56
- package/dist/{screenshot_fyi-DVWG3AXC.js → screenshot_fyi-4QRVSV55.js} +16 -16
- package/dist/semantic_scholar-LRSWA2GE.js +611 -0
- package/dist/{sentry-546MNDJG.js → sentry-2G6PF5W6.js} +208 -207
- package/dist/{shodan-C3OON3Z3.js → shodan-WKKPP5C6.js} +62 -61
- package/dist/shopify-64YDK5T2.js +610 -0
- package/dist/stripe-QAIGGOTF.js +585 -0
- package/dist/{supabase-U2SL4D63.js → supabase-WHTGR6ND.js} +245 -244
- package/dist/tavily-QIXCDDWO.js +326 -0
- package/dist/telegram-E6G7CWI6.js +1767 -0
- package/dist/{telnyx-CXQ4EZUX.js → telnyx-ZDVVS7PK.js} +57 -56
- package/dist/todoist-DMYF3G7J.js +664 -0
- package/dist/trello-HY2RYIRP.js +1080 -0
- package/dist/turso-HAQWMGRP.js +416 -0
- package/dist/{twilio-4PDBJKWX.js → twilio-MLXYPHJE.js} +70 -69
- package/dist/umami-DZHBLPVG.js +389 -0
- package/dist/unsplash-GS2OPXKE.js +351 -0
- package/dist/{upstash_redis-G4LQBYHA.js → upstash_redis-XMXWTNAJ.js} +51 -50
- package/dist/uptimerobot-TF5WRZ4G.js +483 -0
- package/dist/v2ex-2BVXAPDF.js +667 -0
- package/dist/vercel-YMJGQYJE.js +1076 -0
- package/dist/{wolfram_alpha_api-3G4PUJWB.js → wolfram_alpha_api-I56SXWFZ.js} +36 -35
- package/dist/wordpress-R7TDFZ2P.js +812 -0
- package/dist/workos-HDNHWVMS.js +664 -0
- package/dist/zhihu-LX6AGGDS.js +254 -0
- package/package.json +18 -9
- package/dist/airtable-LLZDFN7M.js +0 -789
- package/dist/anthropic-G23NN3X5.js +0 -202
- package/dist/apify-Y3SS734K.js +0 -247
- package/dist/brave_search-ZC7OAPSZ.js +0 -301
- package/dist/chunk-R6P4XAE5.js +0 -248
- package/dist/chunk-U7B6DS2O.js +0 -977
- package/dist/chunk-UZM2RXZH.js +0 -23436
- package/dist/circleci-3BAX5FCG.js +0 -388
- package/dist/clerk-6LEM6TNU.js +0 -1019
- package/dist/cloudflare_dns-KINYTJUD.js +0 -588
- package/dist/cohere-XCJ5AJ6B.js +0 -185
- package/dist/deepseek-PC5YGNC5.js +0 -209
- package/dist/docker_hub-C3MA5FU6.js +0 -932
- package/dist/dropbox-XBV7Z2IR.js +0 -1304
- package/dist/dub-LDOFG3HC.js +0 -679
- package/dist/e2b-JMCPSVBW.js +0 -277
- package/dist/exa-RAK7O7RD.js +0 -331
- package/dist/figma-E6IX5DTH.js +0 -773
- package/dist/firehydrant-ZBLPQREE.js +0 -562
- package/dist/fly-ZH3HFCZJ.js +0 -468
- package/dist/geocodio-YGNI7DA4.js +0 -212
- package/dist/ghost-EVSGKH2Q.js +0 -337
- package/dist/github-MA2BGRCJ.js +0 -5420
- package/dist/gmail-E5E6AADE.js +0 -1886
- package/dist/googlecalendar-BTLFPXTD.js +0 -2523
- package/dist/graphhopper-WSMB3TCD.js +0 -324
- package/dist/ipgeolocation_io-AA7HAS22.js +0 -315
- package/dist/ipqualityscore-BHJXVTJT.js +0 -277
- package/dist/langsmith-5W6SCT6F.js +0 -592
- package/dist/lemlist-HJWH6UMK.js +0 -288
- package/dist/logsnag-4KFOHL37.js +0 -150
- package/dist/mem0-CAW43CIC.js +0 -543
- package/dist/memos-TWEGPKFM.js +0 -740
- package/dist/mistral_ai-64BGZQHP.js +0 -1195
- package/dist/ngrok-GQCUGZKJ.js +0 -356
- package/dist/notion-DQWZWP4N.js +0 -936
- package/dist/open_exchange_rates-QMMD735E.js +0 -214
- package/dist/openai-W6PX32NZ.js +0 -799
- package/dist/opengraph_io-HNDBXYNW.js +0 -361
- package/dist/openrouter-JJYMEAUL.js +0 -437
- package/dist/outline-MCBNQZYY.js +0 -595
- package/dist/paddle-D2SKLUDN.js +0 -453
- package/dist/perplexity-XIFMKUAE.js +0 -219
- package/dist/pinecone-HUFTALV2.js +0 -570
- package/dist/polar-TYTOMOSR.js +0 -394
- package/dist/posthog-43JAR3VW.js +0 -3463
- package/dist/postmark-KL2QJYSG.js +0 -426
- package/dist/readwise-CI4GIMMJ.js +0 -469
- package/dist/render-SUBJ6YRZ.js +0 -460
- package/dist/rootly-CD2LJHPI.js +0 -336
- package/dist/semantic_scholar-T4A252KW.js +0 -610
- package/dist/shopify-Y2HN2MCQ.js +0 -609
- package/dist/stripe-VE3CD3AY.js +0 -584
- package/dist/tavily-KCZHK6HE.js +0 -326
- package/dist/telegram-3URFBCMY.js +0 -1766
- package/dist/todoist-HNPWNYTD.js +0 -663
- package/dist/trello-3W2MIXRP.js +0 -1079
- package/dist/turso-2EQF7C2Z.js +0 -415
- package/dist/umami-5REN7TGP.js +0 -388
- package/dist/unsplash-EIXL424F.js +0 -350
- package/dist/uptimerobot-KNJ3EYLY.js +0 -482
- package/dist/v2ex-RHJ234PZ.js +0 -666
- package/dist/vercel-AS6NCIC7.js +0 -1075
- package/dist/wordpress-KNDAAUV7.js +0 -811
- package/dist/workos-R6UITSJ7.js +0 -663
- package/dist/zhihu-AGK4HILK.js +0 -253
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createProviderHttpClient
|
|
3
|
+
} from "./chunk-VWRUGUSU.js";
|
|
4
|
+
import {
|
|
5
|
+
asJsonObject
|
|
6
|
+
} from "./chunk-JXHMDBAY.js";
|
|
7
|
+
import {
|
|
8
|
+
createProviderPlugin,
|
|
9
|
+
requireApiKey,
|
|
10
|
+
upstreamError
|
|
11
|
+
} from "./chunk-WJHG6OK7.js";
|
|
12
|
+
import "./chunk-2JNAI4OC.js";
|
|
13
|
+
import "./chunk-BADVCN6K.js";
|
|
14
|
+
import {
|
|
15
|
+
TBError
|
|
16
|
+
} from "./chunk-5ICRY3VU.js";
|
|
17
|
+
import "./chunk-U67V476Y.js";
|
|
18
|
+
|
|
19
|
+
// ../plugins/src/open_exchange_rates/api.ts
|
|
20
|
+
var SERVICE = "open_exchange_rates";
|
|
21
|
+
var API_BASE = "https://openexchangerates.org/api";
|
|
22
|
+
var http = createProviderHttpClient({ baseUrl: `${API_BASE}/`, service: SERVICE });
|
|
23
|
+
function text(value) {
|
|
24
|
+
return typeof value === "string" && value !== "" ? value : void 0;
|
|
25
|
+
}
|
|
26
|
+
function errorMessage(payload) {
|
|
27
|
+
const body = asJsonObject(payload);
|
|
28
|
+
if (body === void 0) return void 0;
|
|
29
|
+
return text(body.description) ?? text(body.message) ?? text(body.error);
|
|
30
|
+
}
|
|
31
|
+
async function request(ctx, input) {
|
|
32
|
+
const apiKey = requireApiKey(ctx, SERVICE);
|
|
33
|
+
const query = [
|
|
34
|
+
...input.includeAppId === false ? [] : [["app_id", apiKey]],
|
|
35
|
+
...Object.entries(input.query ?? {})
|
|
36
|
+
];
|
|
37
|
+
const result = await http.request({
|
|
38
|
+
path: input.path.replace(/^\//, ""),
|
|
39
|
+
query,
|
|
40
|
+
headers: { accept: "application/json" },
|
|
41
|
+
invalidJsonMessage: "Open Exchange Rates \u8FD4\u56DE\u4E86\u975E\u6CD5 JSON",
|
|
42
|
+
mapError: ({ bodyKind, data: payload2, status }) => bodyKind === "invalid-json" ? upstreamError(502, "Open Exchange Rates \u8FD4\u56DE\u4E86\u975E\u6CD5 JSON") : upstreamError(
|
|
43
|
+
status,
|
|
44
|
+
errorMessage(payload2) ?? `Open Exchange Rates \u8FD4\u56DE HTTP ${status}`
|
|
45
|
+
),
|
|
46
|
+
mapTransportError: ({ message }) => upstreamError(
|
|
47
|
+
502,
|
|
48
|
+
message === void 0 ? "open_exchange_rates \u8BF7\u6C42\u5931\u8D25" : `open_exchange_rates \u8BF7\u6C42\u5931\u8D25: ${message}`
|
|
49
|
+
)
|
|
50
|
+
});
|
|
51
|
+
const payload = result.data ?? null;
|
|
52
|
+
const body = asJsonObject(payload);
|
|
53
|
+
const flagged = body?.error === true;
|
|
54
|
+
if (flagged) {
|
|
55
|
+
const embedded = body?.status;
|
|
56
|
+
const status = typeof embedded === "number" && embedded >= 400 ? embedded : 502;
|
|
57
|
+
throw upstreamError(status, errorMessage(payload) ?? `Open Exchange Rates \u8FD4\u56DE HTTP ${result.status}`);
|
|
58
|
+
}
|
|
59
|
+
if (body === void 0) throw upstreamError(502, "Open Exchange Rates \u8FD4\u56DE\u4E86\u975E\u5BF9\u8C61\u54CD\u5E94");
|
|
60
|
+
return body;
|
|
61
|
+
}
|
|
62
|
+
function ratesQuery(input) {
|
|
63
|
+
const symbols = input.symbols?.map((item) => item.trim()).filter((item) => item !== "").join(",");
|
|
64
|
+
return {
|
|
65
|
+
base: input.base,
|
|
66
|
+
symbols: symbols === void 0 || symbols === "" ? void 0 : symbols,
|
|
67
|
+
show_alternative: input.showAlternative
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function getCurrencies(_input, ctx) {
|
|
71
|
+
return request(ctx, { path: "/currencies.json", includeAppId: false });
|
|
72
|
+
}
|
|
73
|
+
function getLatestRates(input, ctx) {
|
|
74
|
+
return request(ctx, { path: "/latest.json", query: ratesQuery(input) });
|
|
75
|
+
}
|
|
76
|
+
function getHistoricalRates(input, ctx) {
|
|
77
|
+
return request(ctx, {
|
|
78
|
+
path: `/historical/${encodeURIComponent(input.date)}.json`,
|
|
79
|
+
query: ratesQuery(input)
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function getTimeseriesRates(input, ctx) {
|
|
83
|
+
if (input.startDate > input.endDate) {
|
|
84
|
+
throw new TBError("invalid_argument", "startDate \u5FC5\u987B\u65E9\u4E8E\u6216\u7B49\u4E8E endDate");
|
|
85
|
+
}
|
|
86
|
+
return request(ctx, {
|
|
87
|
+
path: "/time-series.json",
|
|
88
|
+
query: { start: input.startDate, end: input.endDate, ...ratesQuery(input) }
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function convertCurrency(input, ctx) {
|
|
92
|
+
const path = `/convert/${encodeURIComponent(String(input.amount))}/${encodeURIComponent(input.from)}/${encodeURIComponent(input.to)}`;
|
|
93
|
+
return request(ctx, { path });
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// ../plugins/src/open_exchange_rates/schema.ts
|
|
97
|
+
import { z } from "zod/v4";
|
|
98
|
+
var getCurrenciesInput = z.strictObject({}).describe("Input parameters for retrieving supported Open Exchange Rates currencies.");
|
|
99
|
+
var getCurrenciesOutput = z.record(z.string(), z.string().describe("Currency name.")).describe("Mapping of ISO currency codes to full currency names.");
|
|
100
|
+
var getLatestRatesInput = z.strictObject({
|
|
101
|
+
base: z.string().min(3).max(3).regex(new RegExp("^[A-Z]{3}$")).describe("Three-letter base currency code for the returned rates.").optional(),
|
|
102
|
+
symbols: z.array(z.string().min(3).max(3).regex(new RegExp("^[A-Z]{3}$")).describe("Three-letter ISO currency code.")).min(1).describe("List of target currency codes to include in the response.").optional(),
|
|
103
|
+
showAlternative: z.boolean().describe("Whether to include alternative, black-market, and digital currency rates.").optional()
|
|
104
|
+
}).describe("Input parameters for fetching the latest Open Exchange Rates exchange rates.");
|
|
105
|
+
var getLatestRatesOutput = z.looseObject({
|
|
106
|
+
disclaimer: z.string().min(1).describe("Disclaimer text returned by Open Exchange Rates."),
|
|
107
|
+
license: z.string().min(1).describe("License URL returned by Open Exchange Rates."),
|
|
108
|
+
timestamp: z.int().describe("Unix timestamp when the rates snapshot was generated."),
|
|
109
|
+
base: z.string().min(1).describe("Base currency used for the returned rates."),
|
|
110
|
+
rates: z.record(z.string(), z.number().describe("Exchange rate value.")).describe("Mapping of currency codes to exchange rates for the selected base currency.")
|
|
111
|
+
}).describe("Open Exchange Rates exchange rate snapshot.");
|
|
112
|
+
var getHistoricalRatesInput = z.strictObject({
|
|
113
|
+
date: z.iso.date().describe("Historical date to request from Open Exchange Rates in YYYY-MM-DD format."),
|
|
114
|
+
base: z.string().min(3).max(3).regex(new RegExp("^[A-Z]{3}$")).describe("Three-letter base currency code for the returned rates.").optional(),
|
|
115
|
+
symbols: z.array(z.string().min(3).max(3).regex(new RegExp("^[A-Z]{3}$")).describe("Three-letter ISO currency code.")).min(1).describe("List of target currency codes to include in the response.").optional(),
|
|
116
|
+
showAlternative: z.boolean().describe("Whether to include alternative, black-market, and digital currency rates.").optional()
|
|
117
|
+
}).describe("Input parameters for fetching historical Open Exchange Rates exchange rates.");
|
|
118
|
+
var getHistoricalRatesOutput = z.looseObject({
|
|
119
|
+
disclaimer: z.string().min(1).describe("Disclaimer text returned by Open Exchange Rates."),
|
|
120
|
+
license: z.string().min(1).describe("License URL returned by Open Exchange Rates."),
|
|
121
|
+
timestamp: z.int().describe("Unix timestamp when the rates snapshot was generated."),
|
|
122
|
+
historical: z.boolean().describe("Whether the returned rates represent a historical snapshot."),
|
|
123
|
+
base: z.string().min(1).describe("Base currency used for the returned rates."),
|
|
124
|
+
rates: z.record(z.string(), z.number().describe("Exchange rate value.")).describe("Mapping of currency codes to exchange rates for the selected base currency.")
|
|
125
|
+
}).describe("Open Exchange Rates historical exchange rate snapshot.");
|
|
126
|
+
var getTimeseriesRatesInput = z.strictObject({
|
|
127
|
+
startDate: z.iso.date().describe("Start date of the time-series range in YYYY-MM-DD format."),
|
|
128
|
+
endDate: z.iso.date().describe("End date of the time-series range in YYYY-MM-DD format."),
|
|
129
|
+
base: z.string().min(3).max(3).regex(new RegExp("^[A-Z]{3}$")).describe("Three-letter base currency code for the returned rates.").optional(),
|
|
130
|
+
symbols: z.array(z.string().min(3).max(3).regex(new RegExp("^[A-Z]{3}$")).describe("Three-letter ISO currency code.")).min(1).describe("List of target currency codes to include in the response.").optional(),
|
|
131
|
+
showAlternative: z.boolean().describe("Whether to include alternative, black-market, and digital currency rates.").optional()
|
|
132
|
+
}).describe("Input parameters for fetching Open Exchange Rates time-series exchange rates.");
|
|
133
|
+
var getTimeseriesRatesOutput = z.looseObject({
|
|
134
|
+
disclaimer: z.string().min(1).describe("Disclaimer text returned by Open Exchange Rates."),
|
|
135
|
+
license: z.string().min(1).describe("License URL returned by Open Exchange Rates."),
|
|
136
|
+
start_date: z.string().min(1).describe("Start date of the returned time-series range."),
|
|
137
|
+
end_date: z.string().min(1).describe("End date of the returned time-series range."),
|
|
138
|
+
base: z.string().min(1).describe("Base currency used for the returned rates."),
|
|
139
|
+
rates: z.record(z.string(), z.record(z.string(), z.number().describe("Exchange rate value.")).describe("Mapping of currency codes to exchange rates for one date.")).describe("Mapping of YYYY-MM-DD dates to per-currency exchange rates.")
|
|
140
|
+
}).describe("Open Exchange Rates time-series exchange rates.");
|
|
141
|
+
var convertCurrencyInput = z.strictObject({
|
|
142
|
+
amount: z.number().gt(0).describe("Amount to convert."),
|
|
143
|
+
from: z.string().min(3).max(3).regex(new RegExp("^[A-Z]{3}$")).describe("Source currency code for the conversion."),
|
|
144
|
+
to: z.string().min(3).max(3).regex(new RegExp("^[A-Z]{3}$")).describe("Target currency code for the conversion.")
|
|
145
|
+
}).describe("Input parameters for converting an amount between currencies with Open Exchange Rates.");
|
|
146
|
+
var convertCurrencyOutput = z.looseObject({
|
|
147
|
+
disclaimer: z.string().min(1).describe("Disclaimer text returned by Open Exchange Rates."),
|
|
148
|
+
license: z.string().min(1).describe("License URL returned by Open Exchange Rates."),
|
|
149
|
+
request: z.looseObject({
|
|
150
|
+
query: z.string().min(1).describe("Original conversion query."),
|
|
151
|
+
amount: z.number().describe("Amount used for the conversion."),
|
|
152
|
+
from: z.string().min(1).describe("Source currency code used for the conversion."),
|
|
153
|
+
to: z.string().min(1).describe("Target currency code used for the conversion.")
|
|
154
|
+
}).describe("Conversion request echoed by Open Exchange Rates."),
|
|
155
|
+
meta: z.looseObject({
|
|
156
|
+
timestamp: z.int().describe("Unix timestamp used for the conversion rate."),
|
|
157
|
+
rate: z.number().describe("Exchange rate used for the conversion.")
|
|
158
|
+
}).describe("Conversion metadata returned by Open Exchange Rates."),
|
|
159
|
+
response: z.number().describe("Converted amount returned by Open Exchange Rates.")
|
|
160
|
+
}).describe("Currency conversion result returned by Open Exchange Rates.");
|
|
161
|
+
var openExchangeRatesActions = {
|
|
162
|
+
get_currencies: {
|
|
163
|
+
description: "Retrieve all currencies supported by Open Exchange Rates.",
|
|
164
|
+
effect: "read",
|
|
165
|
+
inputSchema: getCurrenciesInput,
|
|
166
|
+
outputSchema: z.toJSONSchema(getCurrenciesOutput, { io: "output", unrepresentable: "any" })
|
|
167
|
+
},
|
|
168
|
+
get_latest_rates: {
|
|
169
|
+
description: "Retrieve the latest Open Exchange Rates exchange rates.",
|
|
170
|
+
effect: "read",
|
|
171
|
+
inputSchema: getLatestRatesInput,
|
|
172
|
+
outputSchema: z.toJSONSchema(getLatestRatesOutput, { io: "output", unrepresentable: "any" })
|
|
173
|
+
},
|
|
174
|
+
get_historical_rates: {
|
|
175
|
+
description: "Retrieve historical Open Exchange Rates exchange rates for a specific date.",
|
|
176
|
+
effect: "read",
|
|
177
|
+
inputSchema: getHistoricalRatesInput,
|
|
178
|
+
outputSchema: z.toJSONSchema(getHistoricalRatesOutput, { io: "output", unrepresentable: "any" })
|
|
179
|
+
},
|
|
180
|
+
get_timeseries_rates: {
|
|
181
|
+
description: "Retrieve Open Exchange Rates exchange rates across a date range.",
|
|
182
|
+
effect: "read",
|
|
183
|
+
inputSchema: getTimeseriesRatesInput,
|
|
184
|
+
outputSchema: z.toJSONSchema(getTimeseriesRatesOutput, { io: "output", unrepresentable: "any" })
|
|
185
|
+
},
|
|
186
|
+
convert_currency: {
|
|
187
|
+
description: "Convert an amount between two currencies using Open Exchange Rates.",
|
|
188
|
+
effect: "write",
|
|
189
|
+
inputSchema: convertCurrencyInput,
|
|
190
|
+
outputSchema: z.toJSONSchema(convertCurrencyOutput, { io: "output", unrepresentable: "any" })
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
// ../plugins/src/open_exchange_rates/index.ts
|
|
195
|
+
function createOpenExchangeRatesPlugin() {
|
|
196
|
+
return createProviderPlugin({
|
|
197
|
+
description: "Open Exchange Rates",
|
|
198
|
+
actions: openExchangeRatesActions,
|
|
199
|
+
// 上游 credentialValidators 打的是 /latest.json;get_currencies 不带 app_id,
|
|
200
|
+
// 校验不了凭证,所以探针选 get_latest_rates(只读、无必填入参)。
|
|
201
|
+
credentialProbe: "get_latest_rates",
|
|
202
|
+
handlers: {
|
|
203
|
+
get_currencies: getCurrencies,
|
|
204
|
+
get_latest_rates: getLatestRates,
|
|
205
|
+
get_historical_rates: getHistoricalRates,
|
|
206
|
+
get_timeseries_rates: getTimeseriesRates,
|
|
207
|
+
convert_currency: convertCurrency
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
var open_exchange_rates_default = createOpenExchangeRatesPlugin();
|
|
212
|
+
export {
|
|
213
|
+
createOpenExchangeRatesPlugin,
|
|
214
|
+
open_exchange_rates_default as default
|
|
215
|
+
};
|