@tool-bridge/server 0.1.1 → 0.3.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-V6446SVY.js +792 -0
- package/dist/alt_text_generator_ai-HV7JZPDT.js +72 -0
- package/dist/amap-TTTVB6WS.js +755 -0
- package/dist/anthropic-JH3RA363.js +224 -0
- package/dist/apify-ETNN7ITU.js +262 -0
- package/dist/brave_search-3DDR2MMB.js +322 -0
- package/dist/chunk-CSJEZHQO.js +252 -0
- package/dist/chunk-JLTYA2B3.js +20121 -0
- package/dist/chunk-K7FVSFUX.js +333 -0
- package/dist/{chunk-MQEYFCJB.js → chunk-KGYJEEBI.js} +2770 -21574
- package/dist/circleci-MX3TX3HC.js +409 -0
- package/dist/clerk-MRPORVF4.js +1036 -0
- package/dist/cloudflare_dns-OWP7DD7L.js +605 -0
- package/dist/cohere-GPECP66S.js +197 -0
- package/dist/confluence-BN7LZ6BC.js +436 -0
- package/dist/convertapi-SBEOFOFQ.js +161 -0
- package/dist/currencyapi-P2YY7Y7P.js +306 -0
- package/dist/deepseek-MWB3NYIN.js +205 -0
- package/dist/docker_hub-3JSCIGQ3.js +946 -0
- package/dist/dropbox-RFIBDAXO.js +1308 -0
- package/dist/dub-YVP57ELQ.js +706 -0
- package/dist/e2b-NFSUHTZR.js +305 -0
- package/dist/exa-KTDY6IV3.js +360 -0
- package/dist/fal_ai-OCUENLNQ.js +405 -0
- package/dist/feishu-5CWBQ7E5.js +225 -0
- package/dist/feishu_custom_bot-ZJR22OK6.js +240 -0
- package/dist/figma-YULGANSA.js +798 -0
- package/dist/firehydrant-2V6YSYAP.js +573 -0
- package/dist/fixer-LTCDB3CJ.js +171 -0
- package/dist/fly-IXPKMAML.js +478 -0
- package/dist/front-KRFB4M5X.js +379 -0
- package/dist/geocodio-VVURKYHQ.js +236 -0
- package/dist/ghost-6J2RIOUB.js +341 -0
- package/dist/github-5Z6KQRYH.js +5410 -0
- package/dist/gmail-KU4NZ7VA.js +1894 -0
- package/dist/googlecalendar-X44DFFXG.js +2539 -0
- package/dist/googledocs-WSGLPKSF.js +1322 -0
- package/dist/grafana-4PKSSDXY.js +817 -0
- package/dist/graphhopper-DF65ZNGK.js +336 -0
- package/dist/index.d.ts +181 -2
- package/dist/index.js +2 -1
- package/dist/ip2proxy-UCAQ5P2J.js +118 -0
- package/dist/ipgeolocation_io-UX6FCA2S.js +333 -0
- package/dist/ipqualityscore-MKTRXIZJ.js +287 -0
- package/dist/jina_ai-MRHPCSV5.js +119 -0
- package/dist/jira-EG7ZPOIW.js +627 -0
- package/dist/langsmith-FNO3RCOZ.js +597 -0
- package/dist/lemlist-SN6BJHSG.js +298 -0
- package/dist/linear-H3VU4PSD.js +2163 -0
- package/dist/logsnag-OY2JJT2H.js +167 -0
- package/dist/main.js +246 -2
- package/dist/mattermost-C5SQ7PGD.js +320 -0
- package/dist/mem0-LMLE5BFC.js +567 -0
- package/dist/memos-UWFAMBZC.js +781 -0
- package/dist/metabase-SRYDSDJ6.js +365 -0
- package/dist/mistral_ai-YNIJ7VDM.js +1195 -0
- package/dist/mother_duck-CPGOFEXE.js +322 -0
- package/dist/ngrok-CDJFBSOM.js +375 -0
- package/dist/notes-DIVFH3P3.js +109 -0
- package/dist/notion-HGDKS4HK.js +945 -0
- package/dist/open_exchange_rates-COHHYJDD.js +216 -0
- package/dist/openai-4TRT66GW.js +795 -0
- package/dist/opengraph_io-YKVW4PXI.js +377 -0
- package/dist/openrouter-6CV7B7V5.js +444 -0
- package/dist/outline-YWDUK5F7.js +604 -0
- package/dist/paddle-MEU7HWDZ.js +464 -0
- package/dist/perplexity-MRQUDBIC.js +238 -0
- package/dist/pinecone-JI7X2TAF.js +599 -0
- package/dist/pipedrive-6JQPAW23.js +453 -0
- package/dist/polar-7BF56CMC.js +400 -0
- package/dist/posthog-YPU5ADEN.js +3462 -0
- package/dist/postmark-BEU5OFKU.js +441 -0
- package/dist/prerender-UT5GOOZH.js +180 -0
- package/dist/pubmed-3SGOE24Q.js +1052 -0
- package/dist/railway-CEK4GLRQ.js +452 -0
- package/dist/readwise-DXQUQU67.js +482 -0
- package/dist/render-7TGAU5AW.js +473 -0
- package/dist/replicate-VICFSQ5A.js +347 -0
- package/dist/resend-3E76WK3O.js +100 -0
- package/dist/rootly-36GY46BY.js +345 -0
- package/dist/scrapfly-VDVUYAHX.js +289 -0
- package/dist/scrapingbee-3KTPMAVY.js +247 -0
- package/dist/screenshot_fyi-LKG62C3J.js +116 -0
- package/dist/semantic_scholar-4WREECYO.js +626 -0
- package/dist/sentry-HUQTGXOV.js +1139 -0
- package/dist/shodan-SGRKU4KS.js +303 -0
- package/dist/shopify-YCZ4L5HT.js +620 -0
- package/dist/stripe-OEBKMELB.js +583 -0
- package/dist/supabase-I3DBY7L4.js +937 -0
- package/dist/tavily-B2YHCNRD.js +349 -0
- package/dist/telegram-2VYJELZX.js +1773 -0
- package/dist/telnyx-HHXD3CXL.js +237 -0
- package/dist/todoist-PHFDEEIS.js +672 -0
- package/dist/trello-WUSAK6YN.js +1091 -0
- package/dist/turso-FW56U2B3.js +432 -0
- package/dist/twilio-M5JI7XHA.js +321 -0
- package/dist/umami-HAYODRC4.js +411 -0
- package/dist/unsplash-EDPTNEHJ.js +364 -0
- package/dist/upstash_redis-GC2CLIWD.js +299 -0
- package/dist/uptimerobot-XMSNYLIT.js +481 -0
- package/dist/v2ex-KU4ECD65.js +672 -0
- package/dist/vercel-THPCEFHW.js +1096 -0
- package/dist/wolfram_alpha_api-WHHTH4GU.js +212 -0
- package/dist/wordpress-O6TQEQNF.js +822 -0
- package/dist/workos-A3VHHWI3.js +681 -0
- package/dist/zhihu-BJAI64YJ.js +273 -0
- package/package.json +5 -4
|
@@ -0,0 +1,755 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createProviderPlugin,
|
|
3
|
+
guardedFetch,
|
|
4
|
+
requireApiKey,
|
|
5
|
+
upstreamError
|
|
6
|
+
} from "./chunk-CSJEZHQO.js";
|
|
7
|
+
import "./chunk-K7FVSFUX.js";
|
|
8
|
+
import {
|
|
9
|
+
TBError,
|
|
10
|
+
external_exports
|
|
11
|
+
} from "./chunk-JLTYA2B3.js";
|
|
12
|
+
import "./chunk-MLKGABMK.js";
|
|
13
|
+
|
|
14
|
+
// ../plugins/src/amap/api.ts
|
|
15
|
+
var SERVICE = "amap";
|
|
16
|
+
var API_BASE = "https://restapi.amap.com";
|
|
17
|
+
var MAX_GET_URL_LENGTH = 2e3;
|
|
18
|
+
var AUTH_INFOS = /* @__PURE__ */ new Set([
|
|
19
|
+
"INVALID_USER_KEY",
|
|
20
|
+
"SERVICE_NOT_AVAILABLE",
|
|
21
|
+
"USERKEY_PLAT_NOMATCH",
|
|
22
|
+
"INVALID_USER_DOMAIN",
|
|
23
|
+
"INVALID_USER_IP",
|
|
24
|
+
"INVALID_USER_SIGNATURE",
|
|
25
|
+
"INVALID_USER_SCODE"
|
|
26
|
+
]);
|
|
27
|
+
var AUTH_INFOCODES = /* @__PURE__ */ new Set(["10001", "10002"]);
|
|
28
|
+
var RATE_LIMIT_INFOS = /* @__PURE__ */ new Set(["DAILY_QUERY_OVER_LIMIT", "ACCESS_TOO_FREQUENT"]);
|
|
29
|
+
var RATE_LIMIT_INFOCODES = /* @__PURE__ */ new Set(["10003", "10004"]);
|
|
30
|
+
var INPUT_ERROR_INFOS = /* @__PURE__ */ new Set(["MISSING_REQUIRED_PARAMS", "INVALID_PARAMS"]);
|
|
31
|
+
var INPUT_ERROR_INFOCODES = /* @__PURE__ */ new Set(["18001", "18002"]);
|
|
32
|
+
function text(value) {
|
|
33
|
+
if (typeof value !== "string") return void 0;
|
|
34
|
+
const trimmed = value.trim();
|
|
35
|
+
return trimmed === "" ? void 0 : trimmed;
|
|
36
|
+
}
|
|
37
|
+
function number(value) {
|
|
38
|
+
return typeof value === "number" ? value : void 0;
|
|
39
|
+
}
|
|
40
|
+
function boolean(value) {
|
|
41
|
+
return typeof value === "boolean" ? value : void 0;
|
|
42
|
+
}
|
|
43
|
+
function record(value) {
|
|
44
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
45
|
+
}
|
|
46
|
+
function recordArray(value) {
|
|
47
|
+
if (!Array.isArray(value)) return [];
|
|
48
|
+
return value.map((item) => record(item)).filter((item) => item !== void 0);
|
|
49
|
+
}
|
|
50
|
+
function stringOrStringArray(value) {
|
|
51
|
+
if (typeof value === "string") return value;
|
|
52
|
+
if (!Array.isArray(value)) return void 0;
|
|
53
|
+
return value.filter((item) => typeof item === "string");
|
|
54
|
+
}
|
|
55
|
+
function requireText(value, field) {
|
|
56
|
+
const result = text(value);
|
|
57
|
+
if (result === void 0) throw new TBError("invalid_argument", `${field} is required.`);
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
function hasShowField(value, field) {
|
|
61
|
+
if (typeof value !== "string") return false;
|
|
62
|
+
return value.split(",").map((item) => item.trim()).includes(field);
|
|
63
|
+
}
|
|
64
|
+
function buildUrl(path, query) {
|
|
65
|
+
const url = new URL(path, API_BASE);
|
|
66
|
+
for (const [key, value] of Object.entries(query)) {
|
|
67
|
+
if (value === void 0) continue;
|
|
68
|
+
url.searchParams.set(key, String(value));
|
|
69
|
+
}
|
|
70
|
+
return url.toString();
|
|
71
|
+
}
|
|
72
|
+
function errorMessage(status, info, infocode) {
|
|
73
|
+
if (info !== void 0 && infocode !== void 0) return `${info} (${infocode})`;
|
|
74
|
+
if (info !== void 0) return info;
|
|
75
|
+
if (infocode !== void 0) return `amap request failed with ${infocode}`;
|
|
76
|
+
return `amap request failed with ${status}`;
|
|
77
|
+
}
|
|
78
|
+
function amapError(status, payload) {
|
|
79
|
+
const info = typeof payload.info === "string" ? payload.info : void 0;
|
|
80
|
+
const infocode = typeof payload.infocode === "string" ? payload.infocode : void 0;
|
|
81
|
+
const message = errorMessage(status, info, infocode);
|
|
82
|
+
if (status === 429 || RATE_LIMIT_INFOS.has(info ?? "") || RATE_LIMIT_INFOCODES.has(infocode ?? "")) {
|
|
83
|
+
return upstreamError(429, message);
|
|
84
|
+
}
|
|
85
|
+
if (status === 401 || status === 403 || AUTH_INFOS.has(info ?? "") || AUTH_INFOCODES.has(infocode ?? "")) {
|
|
86
|
+
return upstreamError(401, message);
|
|
87
|
+
}
|
|
88
|
+
if (status === 400 || INPUT_ERROR_INFOS.has(info ?? "") || INPUT_ERROR_INFOCODES.has(infocode ?? "")) {
|
|
89
|
+
return upstreamError(400, message);
|
|
90
|
+
}
|
|
91
|
+
return upstreamError(status === 0 ? 500 : status, message);
|
|
92
|
+
}
|
|
93
|
+
async function amapGet(ctx, path, query) {
|
|
94
|
+
const url = buildUrl(path, { ...query, key: requireApiKey(ctx, SERVICE) });
|
|
95
|
+
let response;
|
|
96
|
+
try {
|
|
97
|
+
response = await guardedFetch(url, { method: "GET", headers: { accept: "application/json" } });
|
|
98
|
+
} catch (error) {
|
|
99
|
+
if (error instanceof TBError) throw error;
|
|
100
|
+
throw upstreamError(
|
|
101
|
+
502,
|
|
102
|
+
error instanceof Error ? `amap request failed: ${error.message}` : "amap request failed"
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
const raw = await response.text().catch(() => "");
|
|
106
|
+
let payload;
|
|
107
|
+
if (raw.trim() !== "") {
|
|
108
|
+
try {
|
|
109
|
+
payload = record(JSON.parse(raw));
|
|
110
|
+
} catch {
|
|
111
|
+
payload = void 0;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (payload === void 0) {
|
|
115
|
+
throw new TBError("unavailable", "amap \u8FD4\u56DE\u4E86\u975E JSON \u5BF9\u8C61\u54CD\u5E94", { retryable: true });
|
|
116
|
+
}
|
|
117
|
+
if (!response.ok || payload.status !== "1") throw amapError(response.status, payload);
|
|
118
|
+
return payload;
|
|
119
|
+
}
|
|
120
|
+
function assertGetUrlLength(ctx, path, query) {
|
|
121
|
+
if (buildUrl(path, { ...query, key: requireApiKey(ctx, SERVICE) }).length > MAX_GET_URL_LENGTH) {
|
|
122
|
+
throw new TBError("invalid_argument", "amap GET request is too long");
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function poi(item) {
|
|
126
|
+
return {
|
|
127
|
+
id: text(item.id),
|
|
128
|
+
name: text(item.name),
|
|
129
|
+
type: text(item.type),
|
|
130
|
+
typecode: text(item.typecode),
|
|
131
|
+
address: text(item.address),
|
|
132
|
+
location: text(item.location),
|
|
133
|
+
pname: text(item.pname),
|
|
134
|
+
cityname: text(item.cityname),
|
|
135
|
+
adname: text(item.adname)
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function poiSearchOutput(payload) {
|
|
139
|
+
return {
|
|
140
|
+
count: text(payload.count),
|
|
141
|
+
pois: recordArray(payload.pois).map((item) => poi(item))
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
async function geocode(input, ctx) {
|
|
145
|
+
const payload = await amapGet(ctx, "/v3/geocode/geo", {
|
|
146
|
+
address: requireText(input.address, "address"),
|
|
147
|
+
city: text(input.city)
|
|
148
|
+
});
|
|
149
|
+
return {
|
|
150
|
+
geocodes: recordArray(payload.geocodes).map((item) => ({
|
|
151
|
+
formattedAddress: text(item.formatted_address),
|
|
152
|
+
country: text(item.country),
|
|
153
|
+
province: text(item.province),
|
|
154
|
+
city: stringOrStringArray(item.city),
|
|
155
|
+
district: text(item.district),
|
|
156
|
+
adcode: text(item.adcode),
|
|
157
|
+
location: text(item.location)
|
|
158
|
+
}))
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
async function reverseGeocode(input, ctx) {
|
|
162
|
+
const payload = await amapGet(ctx, "/v3/geocode/regeo", {
|
|
163
|
+
location: requireText(input.location, "location"),
|
|
164
|
+
radius: number(input.radius),
|
|
165
|
+
extensions: text(input.extensions),
|
|
166
|
+
// 入参是 camelCase 的 roadLevel,高德认的是全小写 roadlevel。
|
|
167
|
+
roadlevel: number(input.roadLevel)
|
|
168
|
+
});
|
|
169
|
+
const regeocode = record(payload.regeocode);
|
|
170
|
+
return {
|
|
171
|
+
formattedAddress: text(regeocode?.formatted_address),
|
|
172
|
+
addressComponent: record(regeocode?.addressComponent),
|
|
173
|
+
pois: recordArray(regeocode?.pois),
|
|
174
|
+
roads: recordArray(regeocode?.roads),
|
|
175
|
+
roadinters: recordArray(regeocode?.roadinters),
|
|
176
|
+
aois: recordArray(regeocode?.aois)
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
async function searchPlaces(input, ctx) {
|
|
180
|
+
return poiSearchOutput(await amapGet(ctx, "/v5/place/text", {
|
|
181
|
+
keywords: requireText(input.keywords, "keywords"),
|
|
182
|
+
region: text(input.region),
|
|
183
|
+
city_limit: boolean(input.cityLimit),
|
|
184
|
+
types: text(input.types),
|
|
185
|
+
page_num: number(input.pageNum),
|
|
186
|
+
page_size: number(input.pageSize),
|
|
187
|
+
show_fields: text(input.showFields)
|
|
188
|
+
}));
|
|
189
|
+
}
|
|
190
|
+
async function searchPlacesAround(input, ctx) {
|
|
191
|
+
return poiSearchOutput(await amapGet(ctx, "/v5/place/around", {
|
|
192
|
+
location: requireText(input.location, "location"),
|
|
193
|
+
radius: number(input.radius),
|
|
194
|
+
keywords: text(input.keywords),
|
|
195
|
+
types: text(input.types),
|
|
196
|
+
sortrule: text(input.sortRule),
|
|
197
|
+
page_num: number(input.pageNum),
|
|
198
|
+
page_size: number(input.pageSize),
|
|
199
|
+
show_fields: text(input.showFields)
|
|
200
|
+
}));
|
|
201
|
+
}
|
|
202
|
+
async function searchPlacesPolygon(input, ctx) {
|
|
203
|
+
return poiSearchOutput(await amapGet(ctx, "/v5/place/polygon", {
|
|
204
|
+
polygon: requireText(input.polygon, "polygon"),
|
|
205
|
+
keywords: text(input.keywords),
|
|
206
|
+
types: text(input.types),
|
|
207
|
+
page_num: number(input.pageNum),
|
|
208
|
+
page_size: number(input.pageSize),
|
|
209
|
+
show_fields: text(input.showFields)
|
|
210
|
+
}));
|
|
211
|
+
}
|
|
212
|
+
async function getPlaceDetail(input, ctx) {
|
|
213
|
+
const payload = await amapGet(ctx, "/v5/place/detail", {
|
|
214
|
+
id: requireText(input.id, "id"),
|
|
215
|
+
show_fields: text(input.showFields)
|
|
216
|
+
});
|
|
217
|
+
return { pois: recordArray(payload.pois).map((item) => poi(item)) };
|
|
218
|
+
}
|
|
219
|
+
async function inputTips(input, ctx) {
|
|
220
|
+
const payload = await amapGet(ctx, "/v3/assistant/inputtips", {
|
|
221
|
+
keywords: requireText(input.keywords, "keywords"),
|
|
222
|
+
type: text(input.type),
|
|
223
|
+
location: text(input.location),
|
|
224
|
+
city: text(input.city),
|
|
225
|
+
// 入参 cityLimit,高德认的是全小写 citylimit;下面 datatype 同理。
|
|
226
|
+
citylimit: boolean(input.cityLimit),
|
|
227
|
+
datatype: text(input.dataType)
|
|
228
|
+
});
|
|
229
|
+
return { tips: recordArray(payload.tips) };
|
|
230
|
+
}
|
|
231
|
+
async function ipLocate(input, ctx) {
|
|
232
|
+
const ip = text(input.ip);
|
|
233
|
+
if (ip === void 0) {
|
|
234
|
+
throw new TBError("invalid_argument", "ip is required: \u672C\u5C42\u62FF\u4E0D\u5230\u8C03\u7528\u65B9\u7684\u6765\u6E90 IP,\u5FC5\u987B\u663E\u5F0F\u7ED9\u51FA\u8981\u5B9A\u4F4D\u7684 IP");
|
|
235
|
+
}
|
|
236
|
+
const payload = await amapGet(ctx, "/v3/ip", { ip });
|
|
237
|
+
return {
|
|
238
|
+
province: text(payload.province),
|
|
239
|
+
city: text(payload.city),
|
|
240
|
+
adcode: text(payload.adcode),
|
|
241
|
+
rectangle: text(payload.rectangle)
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
async function districtSearch(input, ctx) {
|
|
245
|
+
const payload = await amapGet(ctx, "/v3/config/district", {
|
|
246
|
+
keywords: requireText(input.keywords, "keywords"),
|
|
247
|
+
subdistrict: number(input.subDistrict),
|
|
248
|
+
extensions: text(input.extensions),
|
|
249
|
+
page: number(input.page),
|
|
250
|
+
offset: number(input.offset),
|
|
251
|
+
filter: text(input.filter)
|
|
252
|
+
});
|
|
253
|
+
return {
|
|
254
|
+
count: text(payload.count),
|
|
255
|
+
districts: recordArray(payload.districts)
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
async function weather(input, ctx) {
|
|
259
|
+
const extensions = text(input.extensions);
|
|
260
|
+
const payload = await amapGet(ctx, "/v3/weather/weatherInfo", {
|
|
261
|
+
city: requireText(input.city, "city"),
|
|
262
|
+
extensions
|
|
263
|
+
});
|
|
264
|
+
if (extensions === "all") return { forecasts: recordArray(payload.forecasts) };
|
|
265
|
+
return { lives: recordArray(payload.lives) };
|
|
266
|
+
}
|
|
267
|
+
function simpleRoutePaths(value, includeCost) {
|
|
268
|
+
return recordArray(value).map((item) => {
|
|
269
|
+
const path = {
|
|
270
|
+
distance: text(item.distance),
|
|
271
|
+
steps: recordArray(item.steps)
|
|
272
|
+
};
|
|
273
|
+
const cost = record(item.cost);
|
|
274
|
+
if (!includeCost || cost === void 0) return path;
|
|
275
|
+
return { ...path, cost: { duration: text(cost.duration) } };
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
async function simpleRoute(ctx, path, input, extra = {}) {
|
|
279
|
+
const query = {
|
|
280
|
+
origin: requireText(input.origin, "origin"),
|
|
281
|
+
destination: requireText(input.destination, "destination"),
|
|
282
|
+
show_fields: text(input.showFields),
|
|
283
|
+
...extra
|
|
284
|
+
};
|
|
285
|
+
assertGetUrlLength(ctx, path, query);
|
|
286
|
+
const payload = await amapGet(ctx, path, query);
|
|
287
|
+
const route = record(payload.route);
|
|
288
|
+
return {
|
|
289
|
+
route: {
|
|
290
|
+
origin: text(route?.origin),
|
|
291
|
+
destination: text(route?.destination),
|
|
292
|
+
paths: simpleRoutePaths(route?.paths, hasShowField(input.showFields, "cost"))
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
async function routeWalking(input, ctx) {
|
|
297
|
+
return simpleRoute(ctx, "/v5/direction/walking", input);
|
|
298
|
+
}
|
|
299
|
+
async function routeBicycling(input, ctx) {
|
|
300
|
+
return simpleRoute(ctx, "/v5/direction/bicycling", input, {
|
|
301
|
+
alternative_route: text(input.alternativeRoute)
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
async function routeElectrobike(input, ctx) {
|
|
305
|
+
return simpleRoute(ctx, "/v5/direction/electrobike", input);
|
|
306
|
+
}
|
|
307
|
+
async function routeDriving(input, ctx) {
|
|
308
|
+
const query = {
|
|
309
|
+
origin: requireText(input.origin, "origin"),
|
|
310
|
+
destination: requireText(input.destination, "destination"),
|
|
311
|
+
waypoints: text(input.waypoints),
|
|
312
|
+
strategy: text(input.strategy),
|
|
313
|
+
plate: text(input.plate),
|
|
314
|
+
cartype: text(input.carType),
|
|
315
|
+
avoidpolygons: text(input.avoidPolygons),
|
|
316
|
+
show_fields: text(input.showFields)
|
|
317
|
+
};
|
|
318
|
+
assertGetUrlLength(ctx, "/v5/direction/driving", query);
|
|
319
|
+
const payload = await amapGet(ctx, "/v5/direction/driving", query);
|
|
320
|
+
const route = record(payload.route);
|
|
321
|
+
const includeCost = hasShowField(input.showFields, "cost");
|
|
322
|
+
return {
|
|
323
|
+
route: {
|
|
324
|
+
origin: text(route?.origin),
|
|
325
|
+
destination: text(route?.destination),
|
|
326
|
+
taxi_cost: text(route?.taxi_cost),
|
|
327
|
+
// 驾车路径多两个字段:限行信息与过路费。
|
|
328
|
+
paths: recordArray(route?.paths).map((item) => {
|
|
329
|
+
const path = {
|
|
330
|
+
distance: text(item.distance),
|
|
331
|
+
restriction: text(item.restriction),
|
|
332
|
+
steps: recordArray(item.steps)
|
|
333
|
+
};
|
|
334
|
+
const cost = record(item.cost);
|
|
335
|
+
if (!includeCost || cost === void 0) return path;
|
|
336
|
+
return { ...path, cost: { duration: text(cost.duration), tolls: text(cost.tolls) } };
|
|
337
|
+
})
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
function transitSegments(value, includeCost) {
|
|
342
|
+
return recordArray(value).map((item) => {
|
|
343
|
+
if (!includeCost) {
|
|
344
|
+
const rest = { ...item };
|
|
345
|
+
delete rest.cost;
|
|
346
|
+
return rest;
|
|
347
|
+
}
|
|
348
|
+
const cost = record(item.cost);
|
|
349
|
+
if (cost === void 0) return item;
|
|
350
|
+
return { ...item, cost: { transit_fee: text(cost.transit_fee) } };
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
async function routeTransit(input, ctx) {
|
|
354
|
+
const query = {
|
|
355
|
+
origin: requireText(input.origin, "origin"),
|
|
356
|
+
destination: requireText(input.destination, "destination"),
|
|
357
|
+
// 入参是 originCity / destinationCity,高德认的是 city1 / city2。
|
|
358
|
+
city1: requireText(input.originCity, "originCity"),
|
|
359
|
+
city2: requireText(input.destinationCity, "destinationCity"),
|
|
360
|
+
strategy: text(input.strategy),
|
|
361
|
+
nightflag: text(input.nightFlag),
|
|
362
|
+
show_fields: text(input.showFields)
|
|
363
|
+
};
|
|
364
|
+
assertGetUrlLength(ctx, "/v5/direction/transit/integrated", query);
|
|
365
|
+
const payload = await amapGet(ctx, "/v5/direction/transit/integrated", query);
|
|
366
|
+
const route = record(payload.route);
|
|
367
|
+
const includeCost = hasShowField(input.showFields, "cost");
|
|
368
|
+
const taxiCost = record(route?.cost);
|
|
369
|
+
return {
|
|
370
|
+
route: {
|
|
371
|
+
origin: text(route?.origin),
|
|
372
|
+
destination: text(route?.destination),
|
|
373
|
+
cost: includeCost && taxiCost !== void 0 ? { taxi_fee: text(taxiCost.taxi_fee) } : void 0,
|
|
374
|
+
transits: recordArray(route?.transits).map((item) => {
|
|
375
|
+
const transit = {
|
|
376
|
+
distance: text(item.distance),
|
|
377
|
+
nightflag: text(item.nightflag),
|
|
378
|
+
segments: transitSegments(item.segments, includeCost)
|
|
379
|
+
};
|
|
380
|
+
const cost = record(item.cost);
|
|
381
|
+
if (!includeCost || cost === void 0) return transit;
|
|
382
|
+
return { ...transit, cost: { duration: text(cost.duration) } };
|
|
383
|
+
})
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// ../plugins/src/amap/schema.ts
|
|
389
|
+
var geocodeInput = external_exports.strictObject({
|
|
390
|
+
address: external_exports.string().describe("The address to geocode."),
|
|
391
|
+
city: external_exports.string().describe("The city used to narrow the geocode lookup.").optional()
|
|
392
|
+
}).describe("The input parameters for geocoding an address.");
|
|
393
|
+
var geocodeOutput = external_exports.strictObject({
|
|
394
|
+
geocodes: external_exports.array(external_exports.strictObject({
|
|
395
|
+
formattedAddress: external_exports.string().describe("The formatted address.").optional(),
|
|
396
|
+
country: external_exports.string().describe("The country name.").optional(),
|
|
397
|
+
province: external_exports.string().describe("The province or state name.").optional(),
|
|
398
|
+
city: external_exports.union([external_exports.string().describe("A single string value."), external_exports.array(external_exports.string().describe("A string value in the list.")).describe("A list of string values.")]).describe("A string or an array of strings.").optional(),
|
|
399
|
+
district: external_exports.string().describe("The district or county name.").optional(),
|
|
400
|
+
adcode: external_exports.string().describe("The administrative code.").optional(),
|
|
401
|
+
location: external_exports.string().describe("The coordinate string.").optional()
|
|
402
|
+
}).describe("A geocoding result entry.")).describe("The list of geocoding results.").optional()
|
|
403
|
+
}).describe("The response payload returned by the geocode action.");
|
|
404
|
+
var reverseGeocodeInput = external_exports.strictObject({
|
|
405
|
+
location: external_exports.string().describe("The coordinates to reverse geocode."),
|
|
406
|
+
radius: external_exports.int().describe("The search radius in meters.").optional(),
|
|
407
|
+
extensions: external_exports.enum(["base", "all"]).describe("The requested response detail level.").optional(),
|
|
408
|
+
roadLevel: external_exports.int().describe("The road level filter.").optional()
|
|
409
|
+
}).describe("The input parameters for reverse geocoding coordinates.");
|
|
410
|
+
var reverseGeocodeOutput = external_exports.strictObject({
|
|
411
|
+
formattedAddress: external_exports.string().describe("The formatted address.").optional(),
|
|
412
|
+
addressComponent: external_exports.looseObject({}).describe("A JSON-like object with arbitrary string keys.").optional(),
|
|
413
|
+
pois: external_exports.array(external_exports.looseObject({}).describe("A JSON-like object with arbitrary string keys.")).describe("The nearby points of interest."),
|
|
414
|
+
roads: external_exports.array(external_exports.looseObject({}).describe("A JSON-like object with arbitrary string keys.")).describe("The nearby roads."),
|
|
415
|
+
roadinters: external_exports.array(external_exports.looseObject({}).describe("A JSON-like object with arbitrary string keys.")).describe("The nearby road intersections."),
|
|
416
|
+
aois: external_exports.array(external_exports.looseObject({}).describe("A JSON-like object with arbitrary string keys.")).describe("The nearby areas of interest.")
|
|
417
|
+
}).describe("The response payload returned by the reverse geocode action.");
|
|
418
|
+
var searchPlacesInput = external_exports.strictObject({
|
|
419
|
+
keywords: external_exports.string().describe("The keywords used to search places."),
|
|
420
|
+
region: external_exports.string().describe("The optional region filter.").optional(),
|
|
421
|
+
cityLimit: external_exports.boolean().describe("Whether to limit results to the region.").optional(),
|
|
422
|
+
types: external_exports.string().describe("The optional place type filter.").optional(),
|
|
423
|
+
pageNum: external_exports.int().describe("The page number to fetch.").optional(),
|
|
424
|
+
pageSize: external_exports.int().describe("The page size to fetch.").optional(),
|
|
425
|
+
showFields: external_exports.string().describe("The requested output fields.").optional()
|
|
426
|
+
}).describe("The input parameters for searching places by keyword.");
|
|
427
|
+
var searchPlacesOutput = external_exports.strictObject({
|
|
428
|
+
count: external_exports.string().describe("The total number of matching points of interest.").optional(),
|
|
429
|
+
pois: external_exports.array(external_exports.strictObject({
|
|
430
|
+
id: external_exports.string().describe("The point of interest identifier.").optional(),
|
|
431
|
+
name: external_exports.string().describe("The point of interest name.").optional(),
|
|
432
|
+
type: external_exports.string().describe("The point of interest type.").optional(),
|
|
433
|
+
typecode: external_exports.string().describe("The type code.").optional(),
|
|
434
|
+
address: external_exports.string().describe("The formatted address.").optional(),
|
|
435
|
+
location: external_exports.string().describe("The coordinate string.").optional(),
|
|
436
|
+
pname: external_exports.string().describe("The province name.").optional(),
|
|
437
|
+
cityname: external_exports.string().describe("The city name.").optional(),
|
|
438
|
+
adname: external_exports.string().describe("The district or area name.").optional()
|
|
439
|
+
}).describe("A point of interest record.")).describe("The matching points of interest.")
|
|
440
|
+
}).describe("The response payload returned by the place search actions.");
|
|
441
|
+
var searchPlacesAroundInput = external_exports.strictObject({
|
|
442
|
+
location: external_exports.string().describe("The center coordinate for the search."),
|
|
443
|
+
radius: external_exports.int().describe("The search radius in meters.").optional(),
|
|
444
|
+
keywords: external_exports.string().describe("The optional keyword filter.").optional(),
|
|
445
|
+
types: external_exports.string().describe("The optional place type filter.").optional(),
|
|
446
|
+
sortRule: external_exports.string().describe("The optional sort rule.").optional(),
|
|
447
|
+
pageNum: external_exports.int().describe("The page number to fetch.").optional(),
|
|
448
|
+
pageSize: external_exports.int().describe("The page size to fetch.").optional(),
|
|
449
|
+
showFields: external_exports.string().describe("The requested output fields.").optional()
|
|
450
|
+
}).describe("The input parameters for searching places around a location.");
|
|
451
|
+
var searchPlacesAroundOutput = external_exports.strictObject({
|
|
452
|
+
count: external_exports.string().describe("The total number of matching points of interest.").optional(),
|
|
453
|
+
pois: external_exports.array(external_exports.strictObject({
|
|
454
|
+
id: external_exports.string().describe("The point of interest identifier.").optional(),
|
|
455
|
+
name: external_exports.string().describe("The point of interest name.").optional(),
|
|
456
|
+
type: external_exports.string().describe("The point of interest type.").optional(),
|
|
457
|
+
typecode: external_exports.string().describe("The type code.").optional(),
|
|
458
|
+
address: external_exports.string().describe("The formatted address.").optional(),
|
|
459
|
+
location: external_exports.string().describe("The coordinate string.").optional(),
|
|
460
|
+
pname: external_exports.string().describe("The province name.").optional(),
|
|
461
|
+
cityname: external_exports.string().describe("The city name.").optional(),
|
|
462
|
+
adname: external_exports.string().describe("The district or area name.").optional()
|
|
463
|
+
}).describe("A point of interest record.")).describe("The matching points of interest.")
|
|
464
|
+
}).describe("The response payload returned by the place search actions.");
|
|
465
|
+
var searchPlacesPolygonInput = external_exports.strictObject({
|
|
466
|
+
polygon: external_exports.string().describe("The polygon used to bound the search."),
|
|
467
|
+
keywords: external_exports.string().describe("The optional keyword filter.").optional(),
|
|
468
|
+
types: external_exports.string().describe("The optional place type filter.").optional(),
|
|
469
|
+
pageNum: external_exports.int().describe("The page number to fetch.").optional(),
|
|
470
|
+
pageSize: external_exports.int().describe("The page size to fetch.").optional(),
|
|
471
|
+
showFields: external_exports.string().describe("The requested output fields.").optional()
|
|
472
|
+
}).describe("The input parameters for searching places inside a polygon.");
|
|
473
|
+
var searchPlacesPolygonOutput = external_exports.strictObject({
|
|
474
|
+
count: external_exports.string().describe("The total number of matching points of interest.").optional(),
|
|
475
|
+
pois: external_exports.array(external_exports.strictObject({
|
|
476
|
+
id: external_exports.string().describe("The point of interest identifier.").optional(),
|
|
477
|
+
name: external_exports.string().describe("The point of interest name.").optional(),
|
|
478
|
+
type: external_exports.string().describe("The point of interest type.").optional(),
|
|
479
|
+
typecode: external_exports.string().describe("The type code.").optional(),
|
|
480
|
+
address: external_exports.string().describe("The formatted address.").optional(),
|
|
481
|
+
location: external_exports.string().describe("The coordinate string.").optional(),
|
|
482
|
+
pname: external_exports.string().describe("The province name.").optional(),
|
|
483
|
+
cityname: external_exports.string().describe("The city name.").optional(),
|
|
484
|
+
adname: external_exports.string().describe("The district or area name.").optional()
|
|
485
|
+
}).describe("A point of interest record.")).describe("The matching points of interest.")
|
|
486
|
+
}).describe("The response payload returned by the place search actions.");
|
|
487
|
+
var getPlaceDetailInput = external_exports.strictObject({
|
|
488
|
+
id: external_exports.string().describe("The place identifier."),
|
|
489
|
+
showFields: external_exports.string().describe("The requested output fields.").optional()
|
|
490
|
+
}).describe("The input parameters for fetching place details.");
|
|
491
|
+
var getPlaceDetailOutput = external_exports.strictObject({
|
|
492
|
+
pois: external_exports.array(external_exports.strictObject({
|
|
493
|
+
id: external_exports.string().describe("The point of interest identifier.").optional(),
|
|
494
|
+
name: external_exports.string().describe("The point of interest name.").optional(),
|
|
495
|
+
type: external_exports.string().describe("The point of interest type.").optional(),
|
|
496
|
+
typecode: external_exports.string().describe("The type code.").optional(),
|
|
497
|
+
address: external_exports.string().describe("The formatted address.").optional(),
|
|
498
|
+
location: external_exports.string().describe("The coordinate string.").optional(),
|
|
499
|
+
pname: external_exports.string().describe("The province name.").optional(),
|
|
500
|
+
cityname: external_exports.string().describe("The city name.").optional(),
|
|
501
|
+
adname: external_exports.string().describe("The district or area name.").optional()
|
|
502
|
+
}).describe("A point of interest record.")).describe("The place detail records.").optional()
|
|
503
|
+
}).describe("The response payload returned by the place detail action.");
|
|
504
|
+
var inputTipsInput = external_exports.strictObject({
|
|
505
|
+
keywords: external_exports.string().describe("The keywords used to search tips."),
|
|
506
|
+
type: external_exports.string().describe("The optional category filter.").optional(),
|
|
507
|
+
location: external_exports.string().describe("The optional location bias.").optional(),
|
|
508
|
+
city: external_exports.string().describe("The optional city filter.").optional(),
|
|
509
|
+
cityLimit: external_exports.boolean().describe("Whether to limit results to the specified city.").optional(),
|
|
510
|
+
dataType: external_exports.string().describe("The optional data type filter.").optional()
|
|
511
|
+
}).describe("The input parameters for fetching input tips.");
|
|
512
|
+
var inputTipsOutput = external_exports.strictObject({
|
|
513
|
+
tips: external_exports.array(external_exports.looseObject({}).describe("A JSON-like object with arbitrary string keys.")).describe("The returned tip records.").optional()
|
|
514
|
+
}).describe("The response payload returned by the input tips action.");
|
|
515
|
+
var ipLocateInput = external_exports.strictObject({
|
|
516
|
+
ip: external_exports.string().describe("The IP address to locate.").optional()
|
|
517
|
+
}).describe("The input parameters for IP geolocation.");
|
|
518
|
+
var ipLocateOutput = external_exports.strictObject({
|
|
519
|
+
province: external_exports.string().describe("The province or state name.").optional(),
|
|
520
|
+
city: external_exports.string().describe("The city name.").optional(),
|
|
521
|
+
adcode: external_exports.string().describe("The administrative code.").optional(),
|
|
522
|
+
rectangle: external_exports.string().describe("The bounding rectangle string.").optional()
|
|
523
|
+
}).describe("The response payload returned by the IP locate action.");
|
|
524
|
+
var districtSearchInput = external_exports.strictObject({
|
|
525
|
+
keywords: external_exports.string().describe("The district search keywords."),
|
|
526
|
+
subDistrict: external_exports.int().describe("The subdistrict depth.").optional(),
|
|
527
|
+
extensions: external_exports.string().describe("The requested response detail level.").optional(),
|
|
528
|
+
page: external_exports.int().describe("The page number to fetch.").optional(),
|
|
529
|
+
offset: external_exports.int().describe("The result offset.").optional(),
|
|
530
|
+
filter: external_exports.string().describe("The optional filter expression.").optional()
|
|
531
|
+
}).describe("The input parameters for district search.");
|
|
532
|
+
var districtSearchOutput = external_exports.strictObject({
|
|
533
|
+
count: external_exports.string().describe("The total number of matching districts.").optional(),
|
|
534
|
+
districts: external_exports.array(external_exports.looseObject({}).describe("A JSON-like object with arbitrary string keys.")).describe("The matching districts.")
|
|
535
|
+
}).describe("The response payload returned by the district search action.");
|
|
536
|
+
var weatherInput = external_exports.strictObject({
|
|
537
|
+
city: external_exports.string().describe("The city to query."),
|
|
538
|
+
extensions: external_exports.enum(["base", "all"]).describe("The requested response detail level.").optional()
|
|
539
|
+
}).describe("The input parameters for fetching weather information.");
|
|
540
|
+
var weatherOutput = external_exports.strictObject({
|
|
541
|
+
lives: external_exports.array(external_exports.looseObject({}).describe("A JSON-like object with arbitrary string keys.")).describe("The current weather records.").optional(),
|
|
542
|
+
forecasts: external_exports.array(external_exports.looseObject({}).describe("A JSON-like object with arbitrary string keys.")).describe("The forecast weather records.").optional()
|
|
543
|
+
}).describe("The response payload returned by the weather action.");
|
|
544
|
+
var routeDrivingInput = external_exports.strictObject({
|
|
545
|
+
origin: external_exports.string().describe("The route origin."),
|
|
546
|
+
destination: external_exports.string().describe("The route destination."),
|
|
547
|
+
waypoints: external_exports.string().describe("The optional waypoint list.").optional(),
|
|
548
|
+
strategy: external_exports.string().describe("The optional routing strategy.").optional(),
|
|
549
|
+
plate: external_exports.string().describe("The optional license plate.").optional(),
|
|
550
|
+
carType: external_exports.string().describe("The optional car type.").optional(),
|
|
551
|
+
avoidPolygons: external_exports.string().describe("The optional avoid polygon list.").optional(),
|
|
552
|
+
showFields: external_exports.string().describe("The requested output fields.").optional()
|
|
553
|
+
}).describe("The input parameters for planning a driving route.");
|
|
554
|
+
var routeDrivingOutput = external_exports.strictObject({
|
|
555
|
+
route: external_exports.strictObject({
|
|
556
|
+
origin: external_exports.string().describe("The route origin.").optional(),
|
|
557
|
+
destination: external_exports.string().describe("The route destination.").optional(),
|
|
558
|
+
taxi_cost: external_exports.string().describe("The estimated taxi cost.").optional(),
|
|
559
|
+
paths: external_exports.array(external_exports.looseObject({}).describe("A JSON-like object with arbitrary string keys.")).describe("The available driving paths.")
|
|
560
|
+
}).describe("The route summary returned by the driving route API.").optional()
|
|
561
|
+
}).describe("The response payload returned by the driving route action.");
|
|
562
|
+
var routeWalkingInput = external_exports.strictObject({
|
|
563
|
+
origin: external_exports.string().describe("The route origin."),
|
|
564
|
+
destination: external_exports.string().describe("The route destination."),
|
|
565
|
+
showFields: external_exports.string().describe("The requested output fields.").optional()
|
|
566
|
+
}).describe("The input parameters for planning a walking route.");
|
|
567
|
+
var routeWalkingOutput = external_exports.strictObject({
|
|
568
|
+
route: external_exports.strictObject({
|
|
569
|
+
origin: external_exports.string().describe("The route origin.").optional(),
|
|
570
|
+
destination: external_exports.string().describe("The route destination.").optional(),
|
|
571
|
+
paths: external_exports.array(external_exports.strictObject({
|
|
572
|
+
distance: external_exports.string().describe("The route distance.").optional(),
|
|
573
|
+
steps: external_exports.array(external_exports.looseObject({}).describe("A JSON-like object with arbitrary string keys.")).describe("The route steps."),
|
|
574
|
+
cost: external_exports.strictObject({
|
|
575
|
+
duration: external_exports.string().describe("The estimated duration.").optional()
|
|
576
|
+
}).describe("The cost summary for the route path.").optional()
|
|
577
|
+
}).describe("A single route path entry.")).describe("The available route paths.")
|
|
578
|
+
}).describe("The route summary returned by the API.").optional()
|
|
579
|
+
}).describe("The response payload returned by the simple route actions.");
|
|
580
|
+
var routeBicyclingInput = external_exports.strictObject({
|
|
581
|
+
origin: external_exports.string().describe("The route origin."),
|
|
582
|
+
destination: external_exports.string().describe("The route destination."),
|
|
583
|
+
alternativeRoute: external_exports.string().describe("The optional alternative route mode.").optional(),
|
|
584
|
+
showFields: external_exports.string().describe("The requested output fields.").optional()
|
|
585
|
+
}).describe("The input parameters for planning a bicycling route.");
|
|
586
|
+
var routeBicyclingOutput = external_exports.strictObject({
|
|
587
|
+
route: external_exports.strictObject({
|
|
588
|
+
origin: external_exports.string().describe("The route origin.").optional(),
|
|
589
|
+
destination: external_exports.string().describe("The route destination.").optional(),
|
|
590
|
+
paths: external_exports.array(external_exports.strictObject({
|
|
591
|
+
distance: external_exports.string().describe("The route distance.").optional(),
|
|
592
|
+
steps: external_exports.array(external_exports.looseObject({}).describe("A JSON-like object with arbitrary string keys.")).describe("The route steps."),
|
|
593
|
+
cost: external_exports.strictObject({
|
|
594
|
+
duration: external_exports.string().describe("The estimated duration.").optional()
|
|
595
|
+
}).describe("The cost summary for the route path.").optional()
|
|
596
|
+
}).describe("A single route path entry.")).describe("The available route paths.")
|
|
597
|
+
}).describe("The route summary returned by the API.").optional()
|
|
598
|
+
}).describe("The response payload returned by the simple route actions.");
|
|
599
|
+
var routeElectrobikeInput = external_exports.strictObject({
|
|
600
|
+
origin: external_exports.string().describe("The route origin."),
|
|
601
|
+
destination: external_exports.string().describe("The route destination."),
|
|
602
|
+
showFields: external_exports.string().describe("The requested output fields.").optional()
|
|
603
|
+
}).describe("The input parameters for planning a walking route.");
|
|
604
|
+
var routeElectrobikeOutput = external_exports.strictObject({
|
|
605
|
+
route: external_exports.strictObject({
|
|
606
|
+
origin: external_exports.string().describe("The route origin.").optional(),
|
|
607
|
+
destination: external_exports.string().describe("The route destination.").optional(),
|
|
608
|
+
paths: external_exports.array(external_exports.strictObject({
|
|
609
|
+
distance: external_exports.string().describe("The route distance.").optional(),
|
|
610
|
+
steps: external_exports.array(external_exports.looseObject({}).describe("A JSON-like object with arbitrary string keys.")).describe("The route steps."),
|
|
611
|
+
cost: external_exports.strictObject({
|
|
612
|
+
duration: external_exports.string().describe("The estimated duration.").optional()
|
|
613
|
+
}).describe("The cost summary for the route path.").optional()
|
|
614
|
+
}).describe("A single route path entry.")).describe("The available route paths.")
|
|
615
|
+
}).describe("The route summary returned by the API.").optional()
|
|
616
|
+
}).describe("The response payload returned by the simple route actions.");
|
|
617
|
+
var routeTransitInput = external_exports.strictObject({
|
|
618
|
+
origin: external_exports.string().describe("The route origin."),
|
|
619
|
+
destination: external_exports.string().describe("The route destination."),
|
|
620
|
+
originCity: external_exports.string().describe("The origin city."),
|
|
621
|
+
destinationCity: external_exports.string().describe("The destination city."),
|
|
622
|
+
strategy: external_exports.string().describe("The optional routing strategy.").optional(),
|
|
623
|
+
nightFlag: external_exports.string().describe("The optional night transit flag.").optional(),
|
|
624
|
+
showFields: external_exports.string().describe("The requested output fields.").optional()
|
|
625
|
+
}).describe("The input parameters for planning a transit route.");
|
|
626
|
+
var routeTransitOutput = external_exports.strictObject({
|
|
627
|
+
route: external_exports.strictObject({
|
|
628
|
+
origin: external_exports.string().describe("The route origin.").optional(),
|
|
629
|
+
destination: external_exports.string().describe("The route destination.").optional(),
|
|
630
|
+
cost: external_exports.looseObject({}).describe("A JSON-like object with arbitrary string keys.").optional(),
|
|
631
|
+
transits: external_exports.array(external_exports.looseObject({}).describe("A JSON-like object with arbitrary string keys.")).describe("The available transit options.")
|
|
632
|
+
}).describe("The route summary returned by the transit route API.").optional()
|
|
633
|
+
}).describe("The response payload returned by the transit route action.");
|
|
634
|
+
var amapActions = {
|
|
635
|
+
geocode: {
|
|
636
|
+
description: "Convert an address to coordinates.",
|
|
637
|
+
effect: "write",
|
|
638
|
+
inputSchema: geocodeInput,
|
|
639
|
+
outputSchema: external_exports.toJSONSchema(geocodeOutput, { io: "output", unrepresentable: "any" })
|
|
640
|
+
},
|
|
641
|
+
reverse_geocode: {
|
|
642
|
+
description: "Convert coordinates to an address.",
|
|
643
|
+
effect: "write",
|
|
644
|
+
inputSchema: reverseGeocodeInput,
|
|
645
|
+
outputSchema: external_exports.toJSONSchema(reverseGeocodeOutput, { io: "output", unrepresentable: "any" })
|
|
646
|
+
},
|
|
647
|
+
search_places: {
|
|
648
|
+
description: "Search places by keyword.",
|
|
649
|
+
effect: "read",
|
|
650
|
+
inputSchema: searchPlacesInput,
|
|
651
|
+
outputSchema: external_exports.toJSONSchema(searchPlacesOutput, { io: "output", unrepresentable: "any" })
|
|
652
|
+
},
|
|
653
|
+
search_places_around: {
|
|
654
|
+
description: "Search places around a location.",
|
|
655
|
+
effect: "read",
|
|
656
|
+
inputSchema: searchPlacesAroundInput,
|
|
657
|
+
outputSchema: external_exports.toJSONSchema(searchPlacesAroundOutput, { io: "output", unrepresentable: "any" })
|
|
658
|
+
},
|
|
659
|
+
search_places_polygon: {
|
|
660
|
+
description: "Search places inside a polygon.",
|
|
661
|
+
effect: "read",
|
|
662
|
+
inputSchema: searchPlacesPolygonInput,
|
|
663
|
+
outputSchema: external_exports.toJSONSchema(searchPlacesPolygonOutput, { io: "output", unrepresentable: "any" })
|
|
664
|
+
},
|
|
665
|
+
get_place_detail: {
|
|
666
|
+
description: "Get place details by id.",
|
|
667
|
+
effect: "read",
|
|
668
|
+
inputSchema: getPlaceDetailInput,
|
|
669
|
+
outputSchema: external_exports.toJSONSchema(getPlaceDetailOutput, { io: "output", unrepresentable: "any" })
|
|
670
|
+
},
|
|
671
|
+
input_tips: {
|
|
672
|
+
description: "Get input tips by keywords.",
|
|
673
|
+
effect: "write",
|
|
674
|
+
inputSchema: inputTipsInput,
|
|
675
|
+
outputSchema: external_exports.toJSONSchema(inputTipsOutput, { io: "output", unrepresentable: "any" })
|
|
676
|
+
},
|
|
677
|
+
ip_locate: {
|
|
678
|
+
description: "Locate by IP address.",
|
|
679
|
+
effect: "write",
|
|
680
|
+
inputSchema: ipLocateInput,
|
|
681
|
+
outputSchema: external_exports.toJSONSchema(ipLocateOutput, { io: "output", unrepresentable: "any" })
|
|
682
|
+
},
|
|
683
|
+
district_search: {
|
|
684
|
+
description: "Search administrative districts.",
|
|
685
|
+
effect: "write",
|
|
686
|
+
inputSchema: districtSearchInput,
|
|
687
|
+
outputSchema: external_exports.toJSONSchema(districtSearchOutput, { io: "output", unrepresentable: "any" })
|
|
688
|
+
},
|
|
689
|
+
weather: {
|
|
690
|
+
description: "Get weather information.",
|
|
691
|
+
effect: "write",
|
|
692
|
+
inputSchema: weatherInput,
|
|
693
|
+
outputSchema: external_exports.toJSONSchema(weatherOutput, { io: "output", unrepresentable: "any" })
|
|
694
|
+
},
|
|
695
|
+
route_driving: {
|
|
696
|
+
description: "Plan a driving route.",
|
|
697
|
+
effect: "write",
|
|
698
|
+
inputSchema: routeDrivingInput,
|
|
699
|
+
outputSchema: external_exports.toJSONSchema(routeDrivingOutput, { io: "output", unrepresentable: "any" })
|
|
700
|
+
},
|
|
701
|
+
route_walking: {
|
|
702
|
+
description: "Plan a walking route.",
|
|
703
|
+
effect: "write",
|
|
704
|
+
inputSchema: routeWalkingInput,
|
|
705
|
+
outputSchema: external_exports.toJSONSchema(routeWalkingOutput, { io: "output", unrepresentable: "any" })
|
|
706
|
+
},
|
|
707
|
+
route_bicycling: {
|
|
708
|
+
description: "Plan a bicycling route.",
|
|
709
|
+
effect: "write",
|
|
710
|
+
inputSchema: routeBicyclingInput,
|
|
711
|
+
outputSchema: external_exports.toJSONSchema(routeBicyclingOutput, { io: "output", unrepresentable: "any" })
|
|
712
|
+
},
|
|
713
|
+
route_electrobike: {
|
|
714
|
+
description: "Plan an electric bike route.",
|
|
715
|
+
effect: "write",
|
|
716
|
+
inputSchema: routeElectrobikeInput,
|
|
717
|
+
outputSchema: external_exports.toJSONSchema(routeElectrobikeOutput, { io: "output", unrepresentable: "any" })
|
|
718
|
+
},
|
|
719
|
+
route_transit: {
|
|
720
|
+
description: "Plan a transit route.",
|
|
721
|
+
effect: "write",
|
|
722
|
+
inputSchema: routeTransitInput,
|
|
723
|
+
outputSchema: external_exports.toJSONSchema(routeTransitOutput, { io: "output", unrepresentable: "any" })
|
|
724
|
+
}
|
|
725
|
+
};
|
|
726
|
+
|
|
727
|
+
// ../plugins/src/amap/index.ts
|
|
728
|
+
function createAmapPlugin() {
|
|
729
|
+
return createProviderPlugin({
|
|
730
|
+
description: "AMap (\u9AD8\u5FB7\u5730\u56FE)",
|
|
731
|
+
actions: amapActions,
|
|
732
|
+
handlers: {
|
|
733
|
+
geocode,
|
|
734
|
+
reverse_geocode: reverseGeocode,
|
|
735
|
+
search_places: searchPlaces,
|
|
736
|
+
search_places_around: searchPlacesAround,
|
|
737
|
+
search_places_polygon: searchPlacesPolygon,
|
|
738
|
+
get_place_detail: getPlaceDetail,
|
|
739
|
+
input_tips: inputTips,
|
|
740
|
+
ip_locate: ipLocate,
|
|
741
|
+
district_search: districtSearch,
|
|
742
|
+
weather,
|
|
743
|
+
route_driving: routeDriving,
|
|
744
|
+
route_walking: routeWalking,
|
|
745
|
+
route_bicycling: routeBicycling,
|
|
746
|
+
route_electrobike: routeElectrobike,
|
|
747
|
+
route_transit: routeTransit
|
|
748
|
+
}
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
var amap_default = createAmapPlugin();
|
|
752
|
+
export {
|
|
753
|
+
createAmapPlugin,
|
|
754
|
+
amap_default as default
|
|
755
|
+
};
|