@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
package/dist/index.js
CHANGED
|
@@ -4,31 +4,48 @@ import {
|
|
|
4
4
|
DEVICE_WS_PATH,
|
|
5
5
|
DeviceHub,
|
|
6
6
|
DeviceRouter,
|
|
7
|
+
KeyManager,
|
|
8
|
+
MaintenanceManager,
|
|
9
|
+
PgKeyRotation,
|
|
10
|
+
PgMailboxRepository,
|
|
7
11
|
PgSearchIndex,
|
|
8
12
|
PgStateStore,
|
|
13
|
+
PgStoreRepository,
|
|
9
14
|
RedisDeviceRouterBackend,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import
|
|
15
|
+
StorageManager,
|
|
16
|
+
createManagedServer,
|
|
17
|
+
createS3ObjectStore,
|
|
18
|
+
createTbServer,
|
|
19
|
+
probeS3ObjectStore,
|
|
20
|
+
runtimeAppSettings
|
|
21
|
+
} from "./chunk-4XJPN3DY.js";
|
|
22
|
+
import "./chunk-U7PTOA3U.js";
|
|
23
|
+
import {
|
|
24
|
+
BootstrapStateStore
|
|
25
|
+
} from "./chunk-7CTWGTDU.js";
|
|
26
|
+
import "./chunk-2JNAI4OC.js";
|
|
27
|
+
import "./chunk-BADVCN6K.js";
|
|
28
|
+
import "./chunk-5ICRY3VU.js";
|
|
19
29
|
import "./chunk-U67V476Y.js";
|
|
20
30
|
export {
|
|
31
|
+
BootstrapStateStore,
|
|
21
32
|
DEVICE_FORWARD_TIMEOUT_MS,
|
|
22
33
|
DEVICE_ROUTE_TTL_SEC,
|
|
23
34
|
DEVICE_WS_PATH,
|
|
24
35
|
DeviceHub,
|
|
25
36
|
DeviceRouter,
|
|
37
|
+
KeyManager,
|
|
38
|
+
MaintenanceManager,
|
|
39
|
+
PgKeyRotation,
|
|
40
|
+
PgMailboxRepository,
|
|
26
41
|
PgSearchIndex,
|
|
27
42
|
PgStateStore,
|
|
43
|
+
PgStoreRepository,
|
|
28
44
|
RedisDeviceRouterBackend,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
45
|
+
StorageManager,
|
|
46
|
+
createManagedServer,
|
|
47
|
+
createS3ObjectStore,
|
|
48
|
+
createTbServer,
|
|
49
|
+
probeS3ObjectStore,
|
|
50
|
+
runtimeAppSettings
|
|
34
51
|
};
|
|
@@ -1,48 +1,49 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createProviderHttpClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VWRUGUSU.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-WJHG6OK7.js";
|
|
10
|
+
import "./chunk-2JNAI4OC.js";
|
|
11
|
+
import "./chunk-BADVCN6K.js";
|
|
11
12
|
import {
|
|
12
|
-
TBError
|
|
13
|
-
|
|
14
|
-
} from "./chunk-UZM2RXZH.js";
|
|
13
|
+
TBError
|
|
14
|
+
} from "./chunk-5ICRY3VU.js";
|
|
15
15
|
import "./chunk-U67V476Y.js";
|
|
16
16
|
|
|
17
17
|
// ../plugins/src/ip2proxy/schema.ts
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
import { z } from "zod/v4";
|
|
19
|
+
var lookupIpInput = z.strictObject({
|
|
20
|
+
ip: z.union([z.ipv4().describe("The IPv4 address to look up."), z.ipv6().describe("The IPv6 address to look up.")]).describe("The IPv4 or IPv6 address to look up.").optional(),
|
|
21
|
+
package: z.enum(["PX1", "PX2", "PX3", "PX4", "PX5", "PX6", "PX7", "PX8", "PX9", "PX10", "PX11"]).default("PX1").describe("The IP2Proxy package code to query. The official API defaults to PX1 when omitted.").optional()
|
|
21
22
|
}).describe("The input payload for one proxy detection lookup.");
|
|
22
|
-
var lookupIpOutput =
|
|
23
|
-
response:
|
|
24
|
-
countryCode:
|
|
25
|
-
countryName:
|
|
26
|
-
regionName:
|
|
27
|
-
cityName:
|
|
28
|
-
isp:
|
|
29
|
-
domain:
|
|
30
|
-
usageType:
|
|
31
|
-
asn:
|
|
32
|
-
as:
|
|
33
|
-
lastSeen:
|
|
34
|
-
proxyType:
|
|
35
|
-
isProxy:
|
|
36
|
-
threat:
|
|
37
|
-
provider:
|
|
38
|
-
creditsConsumed:
|
|
23
|
+
var lookupIpOutput = z.looseObject({
|
|
24
|
+
response: z.string().min(1).describe("The response status string returned by IP2Proxy."),
|
|
25
|
+
countryCode: z.string().describe("The two-character ISO 3166 country code.").optional(),
|
|
26
|
+
countryName: z.string().describe("The country name.").optional(),
|
|
27
|
+
regionName: z.string().describe("The region or state name.").optional(),
|
|
28
|
+
cityName: z.string().describe("The city name.").optional(),
|
|
29
|
+
isp: z.string().describe("The ISP or company name.").optional(),
|
|
30
|
+
domain: z.string().describe("The internet domain associated with the IP range.").optional(),
|
|
31
|
+
usageType: z.string().describe("The usage type classification returned by IP2Proxy.").optional(),
|
|
32
|
+
asn: z.string().describe("The autonomous system number.").optional(),
|
|
33
|
+
as: z.string().describe("The autonomous system name.").optional(),
|
|
34
|
+
lastSeen: z.int().describe("How many days ago the proxy was last seen.").optional(),
|
|
35
|
+
proxyType: z.string().describe("The proxy type returned by IP2Proxy.").optional(),
|
|
36
|
+
isProxy: z.string().describe("Whether the IP address is identified as a proxy.").optional(),
|
|
37
|
+
threat: z.string().describe("The security threat classification returned by IP2Proxy.").optional(),
|
|
38
|
+
provider: z.string().describe("The VPN provider name when IP2Proxy has one.").optional(),
|
|
39
|
+
creditsConsumed: z.int().describe("The credit count consumed by the query.").optional()
|
|
39
40
|
}).describe("The proxy detection payload returned by IP2Proxy.");
|
|
40
41
|
var ip2proxyActions = {
|
|
41
42
|
lookup_ip: {
|
|
42
43
|
description: "Detect whether one IPv4 or IPv6 address is a proxy and return the official IP2Proxy lookup payload.",
|
|
43
44
|
effect: "write",
|
|
44
45
|
inputSchema: lookupIpInput,
|
|
45
|
-
outputSchema:
|
|
46
|
+
outputSchema: z.toJSONSchema(lookupIpOutput, { io: "output", unrepresentable: "any" })
|
|
46
47
|
}
|
|
47
48
|
};
|
|
48
49
|
|
|
@@ -0,0 +1,315 @@
|
|
|
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 "./chunk-5ICRY3VU.js";
|
|
15
|
+
import "./chunk-U67V476Y.js";
|
|
16
|
+
|
|
17
|
+
// ../plugins/src/ipgeolocation_io/api.ts
|
|
18
|
+
var SERVICE = "ipgeolocation_io";
|
|
19
|
+
var API_BASE = "https://api.ipgeolocation.io/";
|
|
20
|
+
var REQUEST_TIMEOUT_MS = 3e4;
|
|
21
|
+
var http = createProviderHttpClient({ baseUrl: API_BASE, service: SERVICE });
|
|
22
|
+
function nullableString(value) {
|
|
23
|
+
if (typeof value === "string") return value;
|
|
24
|
+
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
function nullableNumber(value) {
|
|
28
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
29
|
+
if (typeof value === "string" && value.trim() !== "") {
|
|
30
|
+
const parsed = Number(value);
|
|
31
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
function nullableInteger(value) {
|
|
36
|
+
const parsed = nullableNumber(value);
|
|
37
|
+
return parsed !== null && Number.isInteger(parsed) ? parsed : null;
|
|
38
|
+
}
|
|
39
|
+
function errorMessage(payload, status) {
|
|
40
|
+
if (typeof payload === "string" && payload.trim() !== "") return payload;
|
|
41
|
+
const record = asJsonObject(payload);
|
|
42
|
+
const message = record?.message ?? record?.error;
|
|
43
|
+
if (typeof message === "string" && message.trim() !== "") return message;
|
|
44
|
+
return `IPGeolocation.io request failed with status ${status}`;
|
|
45
|
+
}
|
|
46
|
+
async function request(ctx, path, params) {
|
|
47
|
+
const { data: payload } = await http.request({
|
|
48
|
+
path,
|
|
49
|
+
method: "GET",
|
|
50
|
+
query: [["apiKey", requireApiKey(ctx, SERVICE)], ...Object.entries(params)],
|
|
51
|
+
headers: { accept: "application/json" },
|
|
52
|
+
timeoutMs: REQUEST_TIMEOUT_MS,
|
|
53
|
+
invalidJsonMessage: "IPGeolocation.io returned invalid JSON",
|
|
54
|
+
mapError: ({ bodyKind, data, status }) => {
|
|
55
|
+
if (bodyKind === "invalid-json") return upstreamError(502, "IPGeolocation.io returned invalid JSON");
|
|
56
|
+
const normalized = status === 429 || status === 401 || status === 403 ? status : status >= 400 && status < 500 ? 400 : status || 500;
|
|
57
|
+
return upstreamError(normalized, errorMessage(data, status));
|
|
58
|
+
},
|
|
59
|
+
mapTransportError: ({ kind }) => kind === "timeout" ? upstreamError(504, "IPGeolocation.io request timed out") : upstreamError(502, "IPGeolocation.io request failed")
|
|
60
|
+
});
|
|
61
|
+
const record = asJsonObject(payload);
|
|
62
|
+
if (record === void 0) throw upstreamError(502, "IPGeolocation.io returned an invalid payload");
|
|
63
|
+
return record;
|
|
64
|
+
}
|
|
65
|
+
function joinList(value) {
|
|
66
|
+
if (value === void 0) return void 0;
|
|
67
|
+
const items = value.map((item) => item.trim()).filter((item) => item !== "");
|
|
68
|
+
return items.length === 0 ? void 0 : items.join(",");
|
|
69
|
+
}
|
|
70
|
+
function numberParam(value) {
|
|
71
|
+
return typeof value === "number" && Number.isFinite(value) ? String(value) : void 0;
|
|
72
|
+
}
|
|
73
|
+
async function lookupIp(input, ctx) {
|
|
74
|
+
const includes = [
|
|
75
|
+
input.includeHostname === true ? "hostname" : void 0,
|
|
76
|
+
input.includeGeoAccuracy === true ? "geo_accuracy" : void 0,
|
|
77
|
+
input.includeDmaCode === true ? "dma_code" : void 0,
|
|
78
|
+
input.includeSecurity === true ? "security" : void 0,
|
|
79
|
+
input.includeAbuse === true ? "abuse" : void 0,
|
|
80
|
+
input.includeUserAgent === true ? "user_agent" : void 0
|
|
81
|
+
].filter((item) => item !== void 0);
|
|
82
|
+
const payload = await request(ctx, "v3/ipgeo", {
|
|
83
|
+
ip: input.ip,
|
|
84
|
+
fields: joinList(input.fields),
|
|
85
|
+
excludes: joinList(input.excludes),
|
|
86
|
+
include: includes.length > 0 ? includes.join(",") : void 0
|
|
87
|
+
});
|
|
88
|
+
const location = asJsonObject(payload.location) ?? payload;
|
|
89
|
+
return {
|
|
90
|
+
geolocation: {
|
|
91
|
+
ip: nullableString(payload.ip),
|
|
92
|
+
hostname: nullableString(payload.hostname),
|
|
93
|
+
continentCode: nullableString(location.continent_code),
|
|
94
|
+
continentName: nullableString(location.continent_name),
|
|
95
|
+
countryCode2: nullableString(location.country_code2),
|
|
96
|
+
countryCode3: nullableString(location.country_code3),
|
|
97
|
+
countryName: nullableString(location.country_name),
|
|
98
|
+
stateProvince: nullableString(location.state_prov),
|
|
99
|
+
district: nullableString(location.district),
|
|
100
|
+
city: nullableString(location.city),
|
|
101
|
+
zipcode: nullableString(location.zipcode),
|
|
102
|
+
latitude: nullableNumber(location.latitude),
|
|
103
|
+
longitude: nullableNumber(location.longitude),
|
|
104
|
+
callingCode: nullableString(asJsonObject(payload.country_metadata)?.calling_code),
|
|
105
|
+
countryFlag: nullableString(location.country_flag),
|
|
106
|
+
countryMetadata: asJsonObject(payload.country_metadata) ?? null,
|
|
107
|
+
network: asJsonObject(payload.network) ?? null,
|
|
108
|
+
asn: asJsonObject(payload.asn) ?? null,
|
|
109
|
+
company: asJsonObject(payload.company) ?? null,
|
|
110
|
+
timeZone: asJsonObject(payload.time_zone) ?? null,
|
|
111
|
+
currency: asJsonObject(payload.currency) ?? null,
|
|
112
|
+
security: asJsonObject(payload.security) ?? null,
|
|
113
|
+
abuse: asJsonObject(payload.abuse) ?? null,
|
|
114
|
+
userAgent: asJsonObject(payload.user_agent) ?? null,
|
|
115
|
+
raw: payload
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
async function getTimezone(input, ctx) {
|
|
120
|
+
const payload = await request(ctx, "v3/timezone", {
|
|
121
|
+
ip: input.ip,
|
|
122
|
+
lat: numberParam(input.lat),
|
|
123
|
+
long: numberParam(input.long),
|
|
124
|
+
location: input.location,
|
|
125
|
+
// 入参叫 timeZone,上游 query 叫 tz。
|
|
126
|
+
tz: input.timeZone
|
|
127
|
+
});
|
|
128
|
+
return {
|
|
129
|
+
timeZone: {
|
|
130
|
+
timeZone: nullableString(payload.timezone),
|
|
131
|
+
date: nullableString(payload.date),
|
|
132
|
+
dateTime: nullableString(payload.date_time),
|
|
133
|
+
dateTimeTxt: nullableString(payload.date_time_txt),
|
|
134
|
+
dateTimeWti: nullableString(payload.date_time_wti),
|
|
135
|
+
dateTimeYmd: nullableString(payload.date_time_ymd),
|
|
136
|
+
dateTimeUnix: nullableNumber(payload.date_time_unix),
|
|
137
|
+
time24: nullableString(payload.time_24),
|
|
138
|
+
time12: nullableString(payload.time_12),
|
|
139
|
+
week: nullableInteger(payload.week),
|
|
140
|
+
month: nullableInteger(payload.month),
|
|
141
|
+
year: nullableInteger(payload.year),
|
|
142
|
+
yearAbbr: nullableString(payload.year_abbr),
|
|
143
|
+
isDst: typeof payload.is_dst === "boolean" ? payload.is_dst : null,
|
|
144
|
+
dstSavings: nullableInteger(payload.dst_savings),
|
|
145
|
+
geo: asJsonObject(payload.geo) ?? null,
|
|
146
|
+
raw: payload
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
async function getAstronomy(input, ctx) {
|
|
151
|
+
const payload = await request(ctx, "v3/astronomy", {
|
|
152
|
+
ip: input.ip,
|
|
153
|
+
lat: numberParam(input.lat),
|
|
154
|
+
long: numberParam(input.long),
|
|
155
|
+
location: input.location,
|
|
156
|
+
date: input.date
|
|
157
|
+
});
|
|
158
|
+
return {
|
|
159
|
+
astronomy: {
|
|
160
|
+
location: asJsonObject(payload.location) ?? null,
|
|
161
|
+
date: nullableString(payload.date),
|
|
162
|
+
currentTime: nullableString(payload.current_time),
|
|
163
|
+
sunrise: nullableString(payload.sunrise),
|
|
164
|
+
sunset: nullableString(payload.sunset),
|
|
165
|
+
sunStatus: nullableString(payload.sun_status),
|
|
166
|
+
solarNoon: nullableString(payload.solar_noon),
|
|
167
|
+
dayLength: nullableString(payload.day_length),
|
|
168
|
+
moonrise: nullableString(payload.moonrise),
|
|
169
|
+
moonset: nullableString(payload.moonset),
|
|
170
|
+
moonStatus: nullableString(payload.moon_status),
|
|
171
|
+
moonPhase: nullableString(payload.moon_phase),
|
|
172
|
+
moonIlluminationPercentage: nullableNumber(payload.moon_illumination_percentage),
|
|
173
|
+
moonAngle: nullableNumber(payload.moon_angle),
|
|
174
|
+
raw: payload
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// ../plugins/src/ipgeolocation_io/schema.ts
|
|
180
|
+
import { z } from "zod/v4";
|
|
181
|
+
var lookupIpInput = z.strictObject({
|
|
182
|
+
ip: z.string().min(1).regex(new RegExp("\\S")).describe("The IPv4 or IPv6 address to look up.").optional(),
|
|
183
|
+
fields: z.array(z.string().min(1).describe("One IPGeolocation.io field name.")).min(1).describe("Specific response fields to request from IPGeolocation.io.").optional(),
|
|
184
|
+
excludes: z.array(z.string().min(1).describe("One IPGeolocation.io field name.")).min(1).describe("Specific response fields to exclude from the IPGeolocation.io response.").optional(),
|
|
185
|
+
includeHostname: z.boolean().describe("Whether to include hostname data in the geolocation response.").optional(),
|
|
186
|
+
includeGeoAccuracy: z.boolean().describe("Whether to include geo accuracy fields in the geolocation response.").optional(),
|
|
187
|
+
includeDmaCode: z.boolean().describe("Whether to include DMA code fields in the geolocation response.").optional(),
|
|
188
|
+
includeSecurity: z.boolean().describe("Whether to include security threat intelligence fields.").optional(),
|
|
189
|
+
includeAbuse: z.boolean().describe("Whether to include abuse contact fields.").optional(),
|
|
190
|
+
includeUserAgent: z.boolean().describe("Whether to include user-agent derived fields when supported.").optional()
|
|
191
|
+
}).describe("The input payload for looking up an IP address.");
|
|
192
|
+
var lookupIpOutput = z.strictObject({
|
|
193
|
+
geolocation: z.strictObject({
|
|
194
|
+
ip: z.string().describe("The queried IP address.").nullable().optional(),
|
|
195
|
+
hostname: z.string().describe("The hostname associated with the IP address when returned.").nullable().optional(),
|
|
196
|
+
continentCode: z.string().describe("The continent code.").nullable().optional(),
|
|
197
|
+
continentName: z.string().describe("The continent name.").nullable().optional(),
|
|
198
|
+
countryCode2: z.string().describe("The ISO 3166-1 alpha-2 country code.").nullable().optional(),
|
|
199
|
+
countryCode3: z.string().describe("The ISO 3166-1 alpha-3 country code.").nullable().optional(),
|
|
200
|
+
countryName: z.string().describe("The country name.").nullable().optional(),
|
|
201
|
+
stateProvince: z.string().describe("The state or province name.").nullable().optional(),
|
|
202
|
+
district: z.string().describe("The district name.").nullable().optional(),
|
|
203
|
+
city: z.string().describe("The city name.").nullable().optional(),
|
|
204
|
+
zipcode: z.string().describe("The postal code.").nullable().optional(),
|
|
205
|
+
latitude: z.number().describe("The latitude returned by IPGeolocation.io.").nullable().optional(),
|
|
206
|
+
longitude: z.number().describe("The longitude returned by IPGeolocation.io.").nullable().optional(),
|
|
207
|
+
callingCode: z.string().describe("The international calling code.").nullable().optional(),
|
|
208
|
+
countryFlag: z.string().describe("The country flag URL or emoji field returned by IPGeolocation.io.").nullable().optional(),
|
|
209
|
+
countryMetadata: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").nullable().optional(),
|
|
210
|
+
network: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").nullable().optional(),
|
|
211
|
+
asn: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").nullable().optional(),
|
|
212
|
+
company: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").nullable().optional(),
|
|
213
|
+
timeZone: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").nullable().optional(),
|
|
214
|
+
currency: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").nullable().optional(),
|
|
215
|
+
security: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").nullable().optional(),
|
|
216
|
+
abuse: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").nullable().optional(),
|
|
217
|
+
userAgent: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").nullable().optional(),
|
|
218
|
+
raw: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").optional()
|
|
219
|
+
}).describe("The normalized IP geolocation result.").optional()
|
|
220
|
+
}).describe("The response returned when looking up an IP address.");
|
|
221
|
+
var getTimezoneInput = z.strictObject({
|
|
222
|
+
ip: z.string().min(1).regex(new RegExp("\\S")).describe("The IPv4 or IPv6 address to look up.").optional(),
|
|
223
|
+
lat: z.number().min(-90).max(90).describe("The latitude coordinate.").optional(),
|
|
224
|
+
long: z.number().min(-180).max(180).describe("The longitude coordinate.").optional(),
|
|
225
|
+
location: z.string().min(1).regex(new RegExp("\\S")).describe("The location string accepted by IPGeolocation.io.").optional(),
|
|
226
|
+
timeZone: z.string().min(1).regex(new RegExp("\\S")).describe("The IANA time zone name.").optional()
|
|
227
|
+
}).describe("The input payload for getting IPGeolocation.io time zone data.");
|
|
228
|
+
var getTimezoneOutput = z.strictObject({
|
|
229
|
+
timeZone: z.strictObject({
|
|
230
|
+
timeZone: z.string().describe("The IANA time zone name.").nullable().optional(),
|
|
231
|
+
date: z.string().describe("The date returned by IPGeolocation.io.").nullable().optional(),
|
|
232
|
+
dateTime: z.string().describe("The local date and time string.").nullable().optional(),
|
|
233
|
+
dateTimeTxt: z.string().describe("The formatted local date and time text.").nullable().optional(),
|
|
234
|
+
dateTimeWti: z.string().describe("The local date and time with time zone information.").nullable().optional(),
|
|
235
|
+
dateTimeYmd: z.string().describe("The local date in YYYY-MM-DD format.").nullable().optional(),
|
|
236
|
+
dateTimeUnix: z.number().describe("The local date and time as a Unix timestamp when returned.").nullable().optional(),
|
|
237
|
+
time24: z.string().describe("The 24-hour local time string.").nullable().optional(),
|
|
238
|
+
time12: z.string().describe("The 12-hour local time string.").nullable().optional(),
|
|
239
|
+
week: z.int().describe("The week number.").nullable().optional(),
|
|
240
|
+
month: z.int().describe("The month number.").nullable().optional(),
|
|
241
|
+
year: z.int().describe("The year.").nullable().optional(),
|
|
242
|
+
yearAbbr: z.string().describe("The abbreviated year.").nullable().optional(),
|
|
243
|
+
isDst: z.boolean().describe("Whether daylight saving time is active.").nullable().optional(),
|
|
244
|
+
dstSavings: z.int().describe("The daylight saving time offset in seconds.").nullable().optional(),
|
|
245
|
+
geo: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").nullable().optional(),
|
|
246
|
+
raw: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").optional()
|
|
247
|
+
}).describe("The normalized IPGeolocation.io time zone result.").optional()
|
|
248
|
+
}).describe("The response returned when getting time zone data.");
|
|
249
|
+
var getAstronomyInput = z.strictObject({
|
|
250
|
+
ip: z.string().min(1).regex(new RegExp("\\S")).describe("The IPv4 or IPv6 address to look up.").optional(),
|
|
251
|
+
lat: z.number().min(-90).max(90).describe("The latitude coordinate.").optional(),
|
|
252
|
+
long: z.number().min(-180).max(180).describe("The longitude coordinate.").optional(),
|
|
253
|
+
location: z.string().min(1).regex(new RegExp("\\S")).describe("The location string accepted by IPGeolocation.io.").optional(),
|
|
254
|
+
date: z.iso.date().describe("The date to use for astronomy data in YYYY-MM-DD format.").optional()
|
|
255
|
+
}).describe("The input payload for getting IPGeolocation.io astronomy data.");
|
|
256
|
+
var getAstronomyOutput = z.strictObject({
|
|
257
|
+
astronomy: z.strictObject({
|
|
258
|
+
location: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").nullable().optional(),
|
|
259
|
+
date: z.string().describe("The date used for the astronomy result.").nullable().optional(),
|
|
260
|
+
currentTime: z.string().describe("The current local time returned by IPGeolocation.io.").nullable().optional(),
|
|
261
|
+
sunrise: z.string().describe("The sunrise time.").nullable().optional(),
|
|
262
|
+
sunset: z.string().describe("The sunset time.").nullable().optional(),
|
|
263
|
+
sunStatus: z.string().describe("The current sun status when returned.").nullable().optional(),
|
|
264
|
+
solarNoon: z.string().describe("The solar noon time.").nullable().optional(),
|
|
265
|
+
dayLength: z.string().describe("The day length.").nullable().optional(),
|
|
266
|
+
moonrise: z.string().describe("The moonrise time.").nullable().optional(),
|
|
267
|
+
moonset: z.string().describe("The moonset time.").nullable().optional(),
|
|
268
|
+
moonStatus: z.string().describe("The current moon status when returned.").nullable().optional(),
|
|
269
|
+
moonPhase: z.string().describe("The moon phase name.").nullable().optional(),
|
|
270
|
+
moonIlluminationPercentage: z.number().describe("The moon illumination percentage when returned.").nullable().optional(),
|
|
271
|
+
moonAngle: z.number().describe("The moon angle when returned.").nullable().optional(),
|
|
272
|
+
raw: z.looseObject({}).describe("The raw object returned by IPGeolocation.io.").optional()
|
|
273
|
+
}).describe("The normalized IPGeolocation.io astronomy result.").optional()
|
|
274
|
+
}).describe("The response returned when getting astronomy data.");
|
|
275
|
+
var ipgeolocationIoActions = {
|
|
276
|
+
lookup_ip: {
|
|
277
|
+
description: "Look up IP geolocation data with optional field controls.",
|
|
278
|
+
effect: "write",
|
|
279
|
+
inputSchema: lookupIpInput,
|
|
280
|
+
outputSchema: z.toJSONSchema(lookupIpOutput, { io: "output", unrepresentable: "any" })
|
|
281
|
+
},
|
|
282
|
+
get_timezone: {
|
|
283
|
+
description: "Get time zone information by IP address, coordinates, location, or time zone name.",
|
|
284
|
+
effect: "read",
|
|
285
|
+
inputSchema: getTimezoneInput,
|
|
286
|
+
outputSchema: z.toJSONSchema(getTimezoneOutput, { io: "output", unrepresentable: "any" })
|
|
287
|
+
},
|
|
288
|
+
get_astronomy: {
|
|
289
|
+
description: "Get sunrise, sunset, moonrise, moonset, and moon phase data for a location.",
|
|
290
|
+
effect: "read",
|
|
291
|
+
inputSchema: getAstronomyInput,
|
|
292
|
+
outputSchema: z.toJSONSchema(getAstronomyOutput, { io: "output", unrepresentable: "any" })
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
// ../plugins/src/ipgeolocation_io/index.ts
|
|
297
|
+
function createIpgeolocationIoPlugin() {
|
|
298
|
+
return createProviderPlugin({
|
|
299
|
+
description: "IPGeolocation.io",
|
|
300
|
+
actions: ipgeolocationIoActions,
|
|
301
|
+
// 上游的 credentialValidator 打的是 /v3/ipgeo,但 lookup_ip 的 effect 被播种成 write,
|
|
302
|
+
// 不能当探针。get_timezone 同样只读、无必填入参、同一把 key,等效且合规。
|
|
303
|
+
credentialProbe: "get_timezone",
|
|
304
|
+
handlers: {
|
|
305
|
+
lookup_ip: lookupIp,
|
|
306
|
+
get_timezone: getTimezone,
|
|
307
|
+
get_astronomy: getAstronomy
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
var ipgeolocation_io_default = createIpgeolocationIoPlugin();
|
|
312
|
+
export {
|
|
313
|
+
createIpgeolocationIoPlugin,
|
|
314
|
+
ipgeolocation_io_default as default
|
|
315
|
+
};
|