@tool-bridge/server 0.16.0 → 0.19.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-S3T4TAN7.js → airtable-23JBIM6X.js} +106 -114
- package/dist/{alt_text_generator_ai-4DIRIDKL.js → alt_text_generator_ai-ADWBTCIH.js} +25 -16
- package/dist/{amap-LGVGNPML.js → amap-CYQCYW2Z.js} +114 -123
- package/dist/{anthropic-27RFZO35.js → anthropic-5P62HDNR.js} +34 -56
- package/dist/{apify-6WLYAIAS.js → apify-54RZUAGW.js} +31 -49
- package/dist/{brave_search-K2SVJ66F.js → brave_search-AHJ6FTD5.js} +52 -77
- package/dist/{chunk-VK3V2WTY.js → chunk-B4P6YZFS.js} +4 -6
- package/dist/{chunk-BB6ZLMTU.js → chunk-CLEZ6YQ6.js} +2600 -481
- package/dist/chunk-JXHMDBAY.js +45 -0
- package/dist/chunk-LMLX3DJF.js +50 -0
- package/dist/{chunk-YB2FLNWI.js → chunk-OKRZPQ3R.js} +2558 -1926
- package/dist/chunk-SWBNHIO4.js +977 -0
- package/dist/chunk-U67V476Y.js +35 -0
- package/dist/chunk-VLOIDU5U.js +283 -0
- package/dist/{circleci-WV3ITU7Q.js → circleci-UM3NSQJ3.js} +36 -55
- package/dist/{clerk-NFQEFKS4.js → clerk-FE5LQ2CZ.js} +60 -80
- package/dist/{cloudflare_dns-2RK5ASBJ.js → cloudflare_dns-KEZABKUT.js} +90 -113
- package/dist/{cohere-5KEW7LWT.js → cohere-4IPJADXP.js} +33 -49
- package/dist/{confluence-SZE63S46.js → confluence-56QEKNQI.js} +79 -115
- package/dist/{convertapi-QPG2JC5K.js → convertapi-3QRM5K5T.js} +13 -16
- package/dist/{currencyapi-UO2APQRY.js → currencyapi-L6G4OND5.js} +30 -53
- package/dist/{deepseek-LJELIMM3.js → deepseek-LGC6HBFG.js} +30 -38
- package/dist/{docker_hub-2MFXSBOF.js → docker_hub-XDMK3BIU.js} +141 -157
- package/dist/{dropbox-GQYNTTVA.js → dropbox-4QARMFZU.js} +134 -141
- package/dist/{dub-KI2LHXST.js → dub-C6JSJKOT.js} +61 -93
- package/dist/{e2b-WO6ISY3C.js → e2b-6A6TVACJ.js} +39 -69
- package/dist/{exa-IZ7B3BPT.js → exa-SIWWW6AA.js} +49 -77
- package/dist/{fal_ai-LTMF36GJ.js → fal_ai-3IJXOKSP.js} +37 -44
- package/dist/{feishu-WM7SLSFD.js → feishu-L4KDA4DC.js} +4 -6
- package/dist/{feishu_custom_bot-66W3MXH2.js → feishu_custom_bot-SDM75H4P.js} +4 -5
- package/dist/{figma-2Z274VQZ.js → figma-6DD436DN.js} +56 -81
- package/dist/{firehydrant-IFI4R65V.js → firehydrant-SYSGYB3R.js} +40 -53
- package/dist/{fixer-BCCZEB3D.js → fixer-FZG7ASTF.js} +31 -43
- package/dist/{fly-755FXYB5.js → fly-HMRCZBUC.js} +50 -66
- package/dist/{front-4FZKKXXK.js → front-FAFSD7I3.js} +43 -66
- package/dist/{geocodio-WYKDJ3DP.js → geocodio-4D3TWENM.js} +37 -63
- package/dist/{ghost-5BNQTCOH.js → ghost-OSO2FOZS.js} +51 -57
- package/dist/{github-ULELF5VX.js → github-OR4I4RHE.js} +48 -41
- package/dist/{gmail-G34WT64J.js → gmail-5AOPJ63E.js} +26 -36
- package/dist/{googlecalendar-BQU255SC.js → googlecalendar-SOJIJUWH.js} +57 -78
- package/dist/{googledocs-HPCNQXYJ.js → googledocs-QSKN5TLN.js} +14 -22
- package/dist/{grafana-VOV24FIC.js → grafana-R3AIZM7M.js} +95 -122
- package/dist/{graphhopper-D5RXW6AP.js → graphhopper-4CR3QOAX.js} +32 -46
- package/dist/index.d.ts +108 -56
- package/dist/index.js +4 -3
- package/dist/{ip2proxy-DAYO7EKZ.js → ip2proxy-OBCG6X6J.js} +35 -42
- package/dist/{ipgeolocation_io-XD4PSLII.js → ipgeolocation_io-NHH3DTQW.js} +40 -60
- package/dist/{ipqualityscore-K27QEAWK.js → ipqualityscore-7POMCBEC.js} +30 -42
- package/dist/{jina_ai-E6UXFV2P.js → jina_ai-YXVKROV4.js} +32 -58
- package/dist/{jira-ZDSXGQ6W.js → jira-LADO3VJU.js} +116 -126
- package/dist/{langsmith-TIFJRREW.js → langsmith-XZ6UAQFU.js} +101 -121
- package/dist/{lemlist-DASEMJMA.js → lemlist-P74GLNE7.js} +57 -68
- package/dist/{linear-KE6UP4SP.js → linear-CXJ7D37A.js} +109 -118
- package/dist/{logsnag-IMNDN4R5.js → logsnag-EVVHWFLK.js} +31 -48
- package/dist/main.js +103 -102
- package/dist/{mattermost-HHHMUXQA.js → mattermost-WG2MRGBD.js} +45 -62
- package/dist/{mem0-D2FGGOIY.js → mem0-HQWUKG6U.js} +72 -98
- package/dist/{memos-4OVIGFPH.js → memos-SQMJIFOE.js} +68 -122
- package/dist/{metabase-33WCX5YD.js → metabase-E27G2DZI.js} +47 -60
- package/dist/{mistral_ai-QIMZ2JYL.js → mistral_ai-MIL63NIT.js} +35 -40
- package/dist/{mother_duck-M6VWS2VH.js → mother_duck-AIZVCBNR.js} +42 -62
- package/dist/{ngrok-Z2PKQBHH.js → ngrok-XS4DVIQS.js} +42 -58
- package/dist/{notes-SS4RPC4K.js → notes-JEOUSL2Y.js} +3 -5
- package/dist/{notion-FJCNQ6I7.js → notion-U4EZVDW2.js} +83 -97
- package/dist/{open_exchange_rates-WU57WTT5.js → open_exchange_rates-AZSQEYEJ.js} +35 -39
- package/dist/{openai-JODZ4GKT.js → openai-HW3SYMTQ.js} +51 -55
- package/dist/{opengraph_io-SQRAUSV5.js → opengraph_io-QX74MAEL.js} +61 -79
- package/dist/{openrouter-Q5XXEJZ7.js → openrouter-OXSKYL6N.js} +41 -55
- package/dist/{outline-RT2EHJ2X.js → outline-CCQAPDSW.js} +89 -104
- package/dist/{paddle-OF2V7GAC.js → paddle-6KQPSSCK.js} +34 -49
- package/dist/{perplexity-LNZEWLHG.js → perplexity-2TXO7IQE.js} +33 -50
- package/dist/{pinecone-JSJIXZYN.js → pinecone-YOO7NULI.js} +65 -91
- package/dist/{pipedrive-D4CKVUXR.js → pipedrive-Q6RIFIFP.js} +37 -59
- package/dist/{polar-M7ZYP6UR.js → polar-KUMGCES3.js} +43 -53
- package/dist/{posthog-YV7CZOH4.js → posthog-VXQHBSMB.js} +58 -77
- package/dist/{postmark-KYHLECRG.js → postmark-YLIPF52S.js} +52 -71
- package/dist/{prerender-HCMHBKV2.js → prerender-CRY7UJN5.js} +32 -50
- package/dist/{pubmed-WYVLCCN3.js → pubmed-3Z4T5AM7.js} +28 -60
- package/dist/{railway-TWIRD5KR.js → railway-BP37IGFL.js} +32 -39
- package/dist/{readwise-UZ467IQ7.js → readwise-HTKICF4K.js} +62 -78
- package/dist/{render-MECUC5CC.js → render-WIVTUXJH.js} +48 -64
- package/dist/{replicate-A5MEK3SW.js → replicate-JJYPA43D.js} +41 -58
- package/dist/{resend-BC6EAWJQ.js → resend-TKHZVG7A.js} +27 -37
- package/dist/{rootly-ZM3QDUIS.js → rootly-FRSZLG5U.js} +64 -76
- package/dist/{scrapfly-WAML42QJ.js → scrapfly-M5WXGQWE.js} +45 -51
- package/dist/{scrapingbee-DG7PET3V.js → scrapingbee-PMXNLLBK.js} +25 -33
- package/dist/{screenshot_fyi-HY6WTHIO.js → screenshot_fyi-HFW4TAOH.js} +29 -47
- package/dist/{semantic_scholar-C5IZA7IP.js → semantic_scholar-KXVH2VZQ.js} +37 -56
- package/dist/{sentry-OKBPSTDM.js → sentry-WWOT2LRX.js} +66 -85
- package/dist/{shodan-PPC6DYU4.js → shodan-FY635H35.js} +42 -53
- package/dist/{shopify-EWGUHBXO.js → shopify-HQLBVSA5.js} +32 -49
- package/dist/{stripe-6RPDPC5W.js → stripe-GJN2GOHB.js} +4 -5
- package/dist/{supabase-SK7DQ42N.js → supabase-BBNZGQU6.js} +69 -88
- package/dist/{tavily-YCG5VQMH.js → tavily-DPENIBOG.js} +37 -62
- package/dist/{telegram-2OES5FYB.js → telegram-L4NONG6H.js} +168 -177
- package/dist/{telnyx-POOSBBR4.js → telnyx-H67MAEZS.js} +30 -50
- package/dist/{todoist-M7YD6YSS.js → todoist-G2BSP4DX.js} +77 -89
- package/dist/{trello-IS6V5W3E.js → trello-7WMVFDG2.js} +108 -122
- package/dist/{turso-RCFHUFVH.js → turso-ZUAESFC2.js} +52 -64
- package/dist/{twilio-OS2RXFGO.js → twilio-EYFYIX3B.js} +48 -55
- package/dist/{umami-PQ2SJ2LN.js → umami-AXAUDUVF.js} +49 -69
- package/dist/{unsplash-C6BPZO4E.js → unsplash-UCQAWPLR.js} +35 -52
- package/dist/{upstash_redis-WH6UER7H.js → upstash_redis-ZPZ4ASU6.js} +28 -40
- package/dist/{uptimerobot-M3YZGS6Z.js → uptimerobot-4QVKKUD5.js} +11 -12
- package/dist/{v2ex-R4JWTEHN.js → v2ex-VGEFJTYC.js} +36 -61
- package/dist/{vercel-FZVYUOQD.js → vercel-JME4TSCN.js} +124 -150
- package/dist/{webapi-VLM4IKVB.js → webapi-GW5QXWXE.js} +1 -1
- package/dist/{wolfram_alpha_api-2KOLO5DC.js → wolfram_alpha_api-TRGU2MDG.js} +26 -34
- package/dist/{wordpress-XRWGO6LG.js → wordpress-WRUKLCZR.js} +87 -104
- package/dist/{workos-WR4NKOYL.js → workos-ZDW4EHS4.js} +37 -56
- package/dist/{zhihu-BKZIB3WA.js → zhihu-4VI67CWU.js} +35 -57
- package/package.json +3 -3
- package/dist/chunk-2O27H4Y2.js +0 -183
- package/dist/chunk-GKX72JMJ.js +0 -378
- package/dist/chunk-MLKGABMK.js +0 -9
|
@@ -1,31 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createProviderHttpClient
|
|
3
|
+
} from "./chunk-VLOIDU5U.js";
|
|
4
|
+
import {
|
|
5
|
+
booleanValue,
|
|
6
|
+
compactDefined
|
|
7
|
+
} from "./chunk-JXHMDBAY.js";
|
|
1
8
|
import {
|
|
2
9
|
createProviderPlugin,
|
|
3
10
|
requireApiKey,
|
|
4
11
|
upstreamError
|
|
5
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-B4P6YZFS.js";
|
|
6
13
|
import {
|
|
7
|
-
assertPublicHttpUrl
|
|
8
|
-
|
|
9
|
-
} from "./chunk-2O27H4Y2.js";
|
|
10
|
-
import "./chunk-GKX72JMJ.js";
|
|
14
|
+
assertPublicHttpUrl
|
|
15
|
+
} from "./chunk-SWBNHIO4.js";
|
|
11
16
|
import {
|
|
12
17
|
TBError,
|
|
13
18
|
external_exports
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
19
|
+
} from "./chunk-OKRZPQ3R.js";
|
|
20
|
+
import "./chunk-U67V476Y.js";
|
|
16
21
|
|
|
17
22
|
// ../plugins/src/posthog/api.ts
|
|
18
23
|
var SERVICE = "posthog";
|
|
19
24
|
var CURRENT_USER_PATH = "/api/users/@me/";
|
|
25
|
+
var http = createProviderHttpClient({ service: SERVICE });
|
|
20
26
|
function str(value) {
|
|
21
27
|
return typeof value === "string" ? value : void 0;
|
|
22
28
|
}
|
|
23
29
|
function num(value) {
|
|
24
30
|
return typeof value === "number" ? value : void 0;
|
|
25
31
|
}
|
|
26
|
-
function bool(value) {
|
|
27
|
-
return typeof value === "boolean" ? value : void 0;
|
|
28
|
-
}
|
|
29
32
|
function nullableStr(value) {
|
|
30
33
|
return value === null ? null : str(value);
|
|
31
34
|
}
|
|
@@ -33,7 +36,7 @@ function nullableNum(value) {
|
|
|
33
36
|
return value === null ? null : num(value);
|
|
34
37
|
}
|
|
35
38
|
function nullableBool(value) {
|
|
36
|
-
return value === null ? null :
|
|
39
|
+
return value === null ? null : booleanValue(value);
|
|
37
40
|
}
|
|
38
41
|
function nullableRecord(value) {
|
|
39
42
|
if (value === null) return null;
|
|
@@ -60,9 +63,6 @@ function looseId(value) {
|
|
|
60
63
|
if (typeof value === "number" && Number.isFinite(value)) return String(value);
|
|
61
64
|
return void 0;
|
|
62
65
|
}
|
|
63
|
-
function compact(input) {
|
|
64
|
-
return Object.fromEntries(Object.entries(input).filter(([, value]) => value !== void 0));
|
|
65
|
-
}
|
|
66
66
|
function optionalSegment(value) {
|
|
67
67
|
if (typeof value === "number" && Number.isFinite(value)) return String(value);
|
|
68
68
|
if (typeof value === "string") {
|
|
@@ -114,57 +114,38 @@ function resolveAuth(ctx) {
|
|
|
114
114
|
const token = requireApiKey(ctx, SERVICE);
|
|
115
115
|
return { baseUrl: resolveBaseUrl(ctx), token };
|
|
116
116
|
}
|
|
117
|
-
function buildUrl(baseUrl, path, query) {
|
|
118
|
-
const url = new URL(`${baseUrl}${path}`);
|
|
119
|
-
for (const [key, value] of Object.entries(query ?? {})) {
|
|
120
|
-
if (value === void 0 || value === null) continue;
|
|
121
|
-
url.searchParams.set(key, String(value));
|
|
122
|
-
}
|
|
123
|
-
return url.toString();
|
|
124
|
-
}
|
|
125
117
|
function posthogError(status, payload, fallback) {
|
|
126
118
|
const body = nullableRecord(payload);
|
|
127
119
|
const detail = str(body?.detail) ?? str(body?.message) ?? fallback;
|
|
128
120
|
const attr = str(body?.attr);
|
|
129
121
|
return upstreamError(status, attr === void 0 || attr === "" ? detail : `${detail} (${attr})`);
|
|
130
122
|
}
|
|
123
|
+
function responsePayload(data, bodyKind) {
|
|
124
|
+
return bodyKind === "json" ? data : void 0;
|
|
125
|
+
}
|
|
131
126
|
async function request(ctx, options) {
|
|
132
127
|
const auth = resolveAuth(ctx);
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
})
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
128
|
+
const result = await http.request({
|
|
129
|
+
baseUrl: `${auth.baseUrl}/`,
|
|
130
|
+
path: options.path,
|
|
131
|
+
method: options.method ?? "GET",
|
|
132
|
+
query: Object.entries(options.query ?? {}),
|
|
133
|
+
// 迁移前 GET 也带 content-type,保留真实 wire。
|
|
134
|
+
headers: { "authorization": `Bearer ${auth.token}`, "content-type": "application/json" },
|
|
135
|
+
...options.body === void 0 ? {} : { json: options.body },
|
|
136
|
+
invalidJson: "text",
|
|
137
|
+
mapError: ({ bodyKind, data, status }) => posthogError(
|
|
138
|
+
status,
|
|
139
|
+
bodyKind === "json" ? data : void 0,
|
|
140
|
+
bodyKind === "empty" ? `${SERVICE} \u8FD4\u56DE HTTP ${status}` : String(data)
|
|
141
|
+
),
|
|
142
|
+
mapTransportError: ({ message }) => new TBError(
|
|
146
143
|
"unavailable",
|
|
147
|
-
`${SERVICE} \u8BF7\u6C42\u5931\u8D25:${
|
|
144
|
+
`${SERVICE} \u8BF7\u6C42\u5931\u8D25:${message ?? "undefined"}`,
|
|
148
145
|
{ retryable: true }
|
|
149
|
-
)
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
let payload;
|
|
153
|
-
if (body !== "") {
|
|
154
|
-
try {
|
|
155
|
-
payload = JSON.parse(body);
|
|
156
|
-
} catch {
|
|
157
|
-
payload = void 0;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
if (!response.ok) {
|
|
161
|
-
throw posthogError(
|
|
162
|
-
response.status,
|
|
163
|
-
payload,
|
|
164
|
-
body === "" ? `${SERVICE} \u8FD4\u56DE HTTP ${response.status}` : body
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
return payload;
|
|
146
|
+
)
|
|
147
|
+
});
|
|
148
|
+
return responsePayload(result.data, result.bodyKind);
|
|
168
149
|
}
|
|
169
150
|
async function requestObject(ctx, options) {
|
|
170
151
|
return looseRecord(await request(ctx, options));
|
|
@@ -198,7 +179,7 @@ async function resolveOrganizationId(ctx, explicit) {
|
|
|
198
179
|
);
|
|
199
180
|
}
|
|
200
181
|
function eventDefinitionBody(input) {
|
|
201
|
-
return
|
|
182
|
+
return compactDefined({
|
|
202
183
|
name: input.name,
|
|
203
184
|
owner: input.owner,
|
|
204
185
|
description: input.description,
|
|
@@ -212,7 +193,7 @@ function eventDefinitionBody(input) {
|
|
|
212
193
|
});
|
|
213
194
|
}
|
|
214
195
|
function propertyDefinitionBody(input) {
|
|
215
|
-
return
|
|
196
|
+
return compactDefined({
|
|
216
197
|
description: input.description,
|
|
217
198
|
tags: input.tags,
|
|
218
199
|
verified: input.verified,
|
|
@@ -228,7 +209,7 @@ function bulkUpdateTagsBody(input) {
|
|
|
228
209
|
};
|
|
229
210
|
}
|
|
230
211
|
function annotationBody(input) {
|
|
231
|
-
return
|
|
212
|
+
return compactDefined({
|
|
232
213
|
content: input.content,
|
|
233
214
|
date_marker: input.date_marker,
|
|
234
215
|
creation_type: input.creation_type,
|
|
@@ -239,7 +220,7 @@ function annotationBody(input) {
|
|
|
239
220
|
});
|
|
240
221
|
}
|
|
241
222
|
function cohortBody(input) {
|
|
242
|
-
return
|
|
223
|
+
return compactDefined({
|
|
243
224
|
name: input.name,
|
|
244
225
|
description: input.description,
|
|
245
226
|
groups: input.groups,
|
|
@@ -252,7 +233,7 @@ function cohortBody(input) {
|
|
|
252
233
|
});
|
|
253
234
|
}
|
|
254
235
|
function insightBody(input) {
|
|
255
|
-
return
|
|
236
|
+
return compactDefined({
|
|
256
237
|
name: input.name,
|
|
257
238
|
description: input.description,
|
|
258
239
|
query: input.query,
|
|
@@ -265,7 +246,7 @@ function insightBody(input) {
|
|
|
265
246
|
});
|
|
266
247
|
}
|
|
267
248
|
function dashboardBody(input) {
|
|
268
|
-
return
|
|
249
|
+
return compactDefined({
|
|
269
250
|
name: input.name,
|
|
270
251
|
description: input.description,
|
|
271
252
|
pinned: input.pinned,
|
|
@@ -282,7 +263,7 @@ function dashboardBody(input) {
|
|
|
282
263
|
});
|
|
283
264
|
}
|
|
284
265
|
function featureFlagBody(input) {
|
|
285
|
-
return
|
|
266
|
+
return compactDefined({
|
|
286
267
|
key: input.key,
|
|
287
268
|
name: input.name,
|
|
288
269
|
filters: input.filters,
|
|
@@ -307,7 +288,7 @@ function mapAnnotation(value) {
|
|
|
307
288
|
created_by: nullableRecord(payload.created_by),
|
|
308
289
|
created_at: nullableStr(payload.created_at),
|
|
309
290
|
updated_at: str(payload.updated_at),
|
|
310
|
-
deleted:
|
|
291
|
+
deleted: booleanValue(payload.deleted),
|
|
311
292
|
scope: str(payload.scope),
|
|
312
293
|
raw: payload
|
|
313
294
|
};
|
|
@@ -338,7 +319,7 @@ function mapInsight(value) {
|
|
|
338
319
|
derived_name: nullableStr(payload.derived_name),
|
|
339
320
|
query: nullableRecord(payload.query),
|
|
340
321
|
order: num(payload.order),
|
|
341
|
-
deleted:
|
|
322
|
+
deleted: booleanValue(payload.deleted),
|
|
342
323
|
dashboards: list(payload.dashboards),
|
|
343
324
|
dashboard_tiles: list(payload.dashboard_tiles).map((item) => looseRecord(item)),
|
|
344
325
|
last_refresh: nullableStr(payload.last_refresh),
|
|
@@ -352,15 +333,15 @@ function mapInsight(value) {
|
|
|
352
333
|
description: nullableStr(payload.description),
|
|
353
334
|
updated_at: str(payload.updated_at),
|
|
354
335
|
tags: list(payload.tags),
|
|
355
|
-
favorited:
|
|
336
|
+
favorited: booleanValue(payload.favorited),
|
|
356
337
|
last_modified_at: str(payload.last_modified_at),
|
|
357
338
|
last_modified_by: nullableRecord(payload.last_modified_by),
|
|
358
|
-
is_sample:
|
|
339
|
+
is_sample: booleanValue(payload.is_sample),
|
|
359
340
|
effective_restriction_level: num(payload.effective_restriction_level),
|
|
360
341
|
effective_privilege_level: num(payload.effective_privilege_level),
|
|
361
342
|
user_access_level: nullableStr(payload.user_access_level),
|
|
362
343
|
timezone: nullableStr(payload.timezone),
|
|
363
|
-
is_cached:
|
|
344
|
+
is_cached: booleanValue(payload.is_cached),
|
|
364
345
|
query_status: nullableRecord(payload.query_status),
|
|
365
346
|
hogql: nullableStr(payload.hogql),
|
|
366
347
|
types: Array.isArray(payload.types) ? payload.types : void 0,
|
|
@@ -375,13 +356,13 @@ function mapDashboardBasic(payload) {
|
|
|
375
356
|
id: requireId(payload, "dashboard"),
|
|
376
357
|
name: nullableStr(payload.name),
|
|
377
358
|
description: str(payload.description),
|
|
378
|
-
pinned:
|
|
359
|
+
pinned: booleanValue(payload.pinned),
|
|
379
360
|
created_at: str(payload.created_at),
|
|
380
361
|
created_by: nullableRecord(payload.created_by),
|
|
381
362
|
last_accessed_at: nullableStr(payload.last_accessed_at),
|
|
382
363
|
last_viewed_at: nullableStr(payload.last_viewed_at),
|
|
383
|
-
is_shared:
|
|
384
|
-
deleted:
|
|
364
|
+
is_shared: booleanValue(payload.is_shared),
|
|
365
|
+
deleted: booleanValue(payload.deleted),
|
|
385
366
|
creation_mode: str(payload.creation_mode),
|
|
386
367
|
tags: list(payload.tags),
|
|
387
368
|
restriction_level: num(payload.restriction_level),
|
|
@@ -426,9 +407,9 @@ function mapFeatureFlag(value) {
|
|
|
426
407
|
id: requireId(payload, "feature flag"),
|
|
427
408
|
key: str(payload.key),
|
|
428
409
|
name: str(payload.name),
|
|
429
|
-
active:
|
|
410
|
+
active: booleanValue(payload.active),
|
|
430
411
|
filters: nullableRecord(payload.filters) ?? {},
|
|
431
|
-
deleted:
|
|
412
|
+
deleted: booleanValue(payload.deleted),
|
|
432
413
|
created_at: nullableStr(payload.created_at),
|
|
433
414
|
updated_at: nullableStr(payload.updated_at),
|
|
434
415
|
created_by: nullableRecord(payload.created_by),
|
|
@@ -477,8 +458,8 @@ function mapMinimalFeatureFlag(value) {
|
|
|
477
458
|
name: str(payload.name),
|
|
478
459
|
key: str(payload.key),
|
|
479
460
|
filters: nullableRecord(payload.filters) ?? {},
|
|
480
|
-
deleted:
|
|
481
|
-
active:
|
|
461
|
+
deleted: booleanValue(payload.deleted),
|
|
462
|
+
active: booleanValue(payload.active),
|
|
482
463
|
ensure_experience_continuity: nullableBool(payload.ensure_experience_continuity),
|
|
483
464
|
version: num(payload.version),
|
|
484
465
|
evaluation_runtime: nullableStr(payload.evaluation_runtime),
|
|
@@ -491,7 +472,7 @@ function mapQueryStatus(payload) {
|
|
|
491
472
|
return {
|
|
492
473
|
id: looseId(payload.id) ?? looseId(payload.query_id),
|
|
493
474
|
query_status: nullableRecord(payload.query_status) ?? payload,
|
|
494
|
-
complete:
|
|
475
|
+
complete: booleanValue(payload.complete),
|
|
495
476
|
results: Array.isArray(payload.results) ? payload.results : void 0,
|
|
496
477
|
error: payload.error,
|
|
497
478
|
raw: payload
|
|
@@ -779,7 +760,7 @@ async function runQuery(input, ctx) {
|
|
|
779
760
|
const payload = await requestObject(ctx, {
|
|
780
761
|
method: "POST",
|
|
781
762
|
path: `/api/projects/${encodeURIComponent(projectId)}/query/`,
|
|
782
|
-
body:
|
|
763
|
+
body: compactDefined({
|
|
783
764
|
query: input.query,
|
|
784
765
|
async: input.async,
|
|
785
766
|
client_query_id: input.client_query_id,
|
|
@@ -900,7 +881,7 @@ async function deleteDashboard(input, ctx) {
|
|
|
900
881
|
const payload = await requestObject(ctx, {
|
|
901
882
|
method: "PATCH",
|
|
902
883
|
path: `/api/environments/${encodeURIComponent(projectId)}/dashboards/${encodeURIComponent(id)}/`,
|
|
903
|
-
body:
|
|
884
|
+
body: compactDefined({ deleted: true, delete_insights: input.delete_insights })
|
|
904
885
|
});
|
|
905
886
|
return { deleted: true, id, dashboard: mapDashboard(payload), raw: payload };
|
|
906
887
|
}
|
|
@@ -1,42 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createProviderHttpClient
|
|
3
|
+
} from "./chunk-VLOIDU5U.js";
|
|
4
|
+
import {
|
|
5
|
+
asJsonObject,
|
|
6
|
+
compactDefined,
|
|
7
|
+
trimmedText
|
|
8
|
+
} from "./chunk-JXHMDBAY.js";
|
|
1
9
|
import {
|
|
2
10
|
createProviderPlugin,
|
|
3
11
|
requireApiKey,
|
|
4
12
|
upstreamError
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import
|
|
7
|
-
guardedFetch
|
|
8
|
-
} from "./chunk-2O27H4Y2.js";
|
|
9
|
-
import "./chunk-GKX72JMJ.js";
|
|
13
|
+
} from "./chunk-B4P6YZFS.js";
|
|
14
|
+
import "./chunk-SWBNHIO4.js";
|
|
10
15
|
import {
|
|
11
16
|
TBError,
|
|
12
17
|
external_exports
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-OKRZPQ3R.js";
|
|
19
|
+
import "./chunk-U67V476Y.js";
|
|
15
20
|
|
|
16
21
|
// ../plugins/src/postmark/api.ts
|
|
17
22
|
var SERVICE = "postmark";
|
|
18
23
|
var API_BASE = "https://api.postmarkapp.com";
|
|
24
|
+
var http = createProviderHttpClient({ baseUrl: API_BASE, service: SERVICE });
|
|
19
25
|
var INVALID_TOKEN_CODE = 10;
|
|
20
26
|
var NOT_FOUND_CODES = /* @__PURE__ */ new Set([12, 701, 1001, 1101]);
|
|
21
27
|
var ACCOUNT_BLOCKED_CODES = /* @__PURE__ */ new Set([405, 412, 413]);
|
|
22
|
-
function text(value) {
|
|
23
|
-
if (typeof value !== "string") return void 0;
|
|
24
|
-
const trimmed = value.trim();
|
|
25
|
-
return trimmed === "" ? void 0 : trimmed;
|
|
26
|
-
}
|
|
27
|
-
function record(value) {
|
|
28
|
-
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
29
|
-
}
|
|
30
|
-
function compact(input) {
|
|
31
|
-
return Object.fromEntries(
|
|
32
|
-
Object.entries(input).filter(([, value]) => value !== void 0)
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
28
|
function responseError(message) {
|
|
36
29
|
return new TBError("unavailable", message, { retryable: true });
|
|
37
30
|
}
|
|
38
31
|
function required(value, field) {
|
|
39
|
-
const result =
|
|
32
|
+
const result = trimmedText(value);
|
|
40
33
|
if (result === void 0) throw new TBError("invalid_argument", `${field} \u662F\u5FC5\u586B\u7684`);
|
|
41
34
|
return result;
|
|
42
35
|
}
|
|
@@ -45,7 +38,7 @@ function pathValue(value, field) {
|
|
|
45
38
|
return required(value, field);
|
|
46
39
|
}
|
|
47
40
|
function postmarkError(status, payload) {
|
|
48
|
-
const message =
|
|
41
|
+
const message = trimmedText(payload.Message) ?? `Postmark \u8FD4\u56DE HTTP ${status}`;
|
|
49
42
|
const code = typeof payload.ErrorCode === "number" ? payload.ErrorCode : void 0;
|
|
50
43
|
if (code !== void 0) {
|
|
51
44
|
if (code === INVALID_TOKEN_CODE) return upstreamError(401, message);
|
|
@@ -55,44 +48,32 @@ function postmarkError(status, payload) {
|
|
|
55
48
|
return upstreamError(status, message);
|
|
56
49
|
}
|
|
57
50
|
async function request(ctx, input) {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
if (value !== void 0) url.searchParams.set(key, String(value));
|
|
61
|
-
}
|
|
62
|
-
const response = await guardedFetch(url.toString(), {
|
|
51
|
+
const { data } = await http.request({
|
|
52
|
+
path: input.path,
|
|
63
53
|
method: input.method ?? "GET",
|
|
54
|
+
query: Object.entries(input.query ?? {}),
|
|
64
55
|
headers: {
|
|
65
56
|
"accept": "application/json",
|
|
66
|
-
...input.body === void 0 ? {} : { "content-type": "application/json" },
|
|
67
57
|
"x-postmark-server-token": requireApiKey(ctx, SERVICE)
|
|
68
58
|
},
|
|
69
|
-
|
|
59
|
+
...input.body === void 0 ? {} : { json: input.body },
|
|
60
|
+
invalidJsonMessage: "Postmark \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94",
|
|
61
|
+
mapError: ({ bodyKind, data: payload, status }) => postmarkError(
|
|
62
|
+
status,
|
|
63
|
+
bodyKind === "json" ? asJsonObject(payload) ?? {} : bodyKind === "empty" ? {} : { Message: payload }
|
|
64
|
+
)
|
|
70
65
|
});
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
let parsed = false;
|
|
74
|
-
if (raw !== "") {
|
|
75
|
-
try {
|
|
76
|
-
payload = JSON.parse(raw);
|
|
77
|
-
parsed = true;
|
|
78
|
-
} catch {
|
|
79
|
-
if (response.ok) throw responseError("Postmark \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94");
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
if (!response.ok) {
|
|
83
|
-
throw postmarkError(response.status, parsed ? record(payload) ?? {} : raw === "" ? {} : { Message: raw });
|
|
84
|
-
}
|
|
85
|
-
if (!parsed) throw responseError("Postmark \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94");
|
|
86
|
-
return payload;
|
|
66
|
+
if (data === void 0) throw responseError("Postmark \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94");
|
|
67
|
+
return data;
|
|
87
68
|
}
|
|
88
69
|
function getServer(_input, ctx) {
|
|
89
70
|
return request(ctx, { path: "/server" });
|
|
90
71
|
}
|
|
91
72
|
function sendEmail(input, ctx) {
|
|
92
|
-
return request(ctx, { path: "/email", method: "POST", body:
|
|
73
|
+
return request(ctx, { path: "/email", method: "POST", body: compactDefined({ ...input }) });
|
|
93
74
|
}
|
|
94
75
|
function sendEmailWithTemplate(input, ctx) {
|
|
95
|
-
return request(ctx, { path: "/email/withTemplate", method: "POST", body:
|
|
76
|
+
return request(ctx, { path: "/email/withTemplate", method: "POST", body: compactDefined({ ...input }) });
|
|
96
77
|
}
|
|
97
78
|
function sendBatchWithTemplates(input, ctx) {
|
|
98
79
|
return request(ctx, { path: "/email/batchWithTemplates", method: "POST", body: { Messages: input.Messages } });
|
|
@@ -102,22 +83,22 @@ function searchOutboundMessages(input, ctx) {
|
|
|
102
83
|
return request(ctx, {
|
|
103
84
|
path: "/messages/outbound",
|
|
104
85
|
query: {
|
|
105
|
-
...
|
|
86
|
+
...compactDefined({
|
|
106
87
|
count: input.count,
|
|
107
88
|
offset: input.offset,
|
|
108
|
-
recipient:
|
|
109
|
-
fromemail:
|
|
110
|
-
tag:
|
|
111
|
-
status:
|
|
112
|
-
todate:
|
|
113
|
-
fromdate:
|
|
114
|
-
subject:
|
|
115
|
-
messagestream:
|
|
89
|
+
recipient: trimmedText(input.recipient),
|
|
90
|
+
fromemail: trimmedText(input.fromemail),
|
|
91
|
+
tag: trimmedText(input.tag),
|
|
92
|
+
status: trimmedText(input.status),
|
|
93
|
+
todate: trimmedText(input.todate),
|
|
94
|
+
fromdate: trimmedText(input.fromdate),
|
|
95
|
+
subject: trimmedText(input.subject),
|
|
96
|
+
messagestream: trimmedText(input.messagestream)
|
|
116
97
|
}),
|
|
117
98
|
// metadata 过滤器摊平成 metadata_<key>=<value>;空值的键整个不发。
|
|
118
99
|
...Object.fromEntries(
|
|
119
100
|
Object.entries(metadata).flatMap(([key, value]) => {
|
|
120
|
-
const item =
|
|
101
|
+
const item = trimmedText(value);
|
|
121
102
|
return item === void 0 ? [] : [[`metadata_${key}`, item]];
|
|
122
103
|
})
|
|
123
104
|
)
|
|
@@ -131,29 +112,29 @@ function getOutboundMessageDetails(input, ctx) {
|
|
|
131
112
|
function getBounces(input, ctx) {
|
|
132
113
|
return request(ctx, {
|
|
133
114
|
path: "/bounces",
|
|
134
|
-
query:
|
|
115
|
+
query: compactDefined({
|
|
135
116
|
count: input.count,
|
|
136
117
|
offset: input.offset,
|
|
137
|
-
type:
|
|
118
|
+
type: trimmedText(input.type),
|
|
138
119
|
// `inactive: false` 是一个有意义的筛选值,不能被当成"没给"丢掉。
|
|
139
120
|
inactive: input.inactive,
|
|
140
|
-
emailFilter:
|
|
141
|
-
messageID:
|
|
142
|
-
mailboxHash:
|
|
143
|
-
tag:
|
|
144
|
-
todate:
|
|
145
|
-
fromdate:
|
|
121
|
+
emailFilter: trimmedText(input.emailFilter),
|
|
122
|
+
messageID: trimmedText(input.messageID),
|
|
123
|
+
mailboxHash: trimmedText(input.mailboxHash),
|
|
124
|
+
tag: trimmedText(input.tag),
|
|
125
|
+
todate: trimmedText(input.todate),
|
|
126
|
+
fromdate: trimmedText(input.fromdate)
|
|
146
127
|
})
|
|
147
128
|
});
|
|
148
129
|
}
|
|
149
130
|
function listTemplates(input, ctx) {
|
|
150
131
|
return request(ctx, {
|
|
151
132
|
path: "/templates",
|
|
152
|
-
query:
|
|
133
|
+
query: compactDefined({
|
|
153
134
|
count: input.count,
|
|
154
135
|
offset: input.offset,
|
|
155
|
-
TemplateType:
|
|
156
|
-
LayoutTemplate:
|
|
136
|
+
TemplateType: trimmedText(input.TemplateType),
|
|
137
|
+
LayoutTemplate: trimmedText(input.LayoutTemplate)
|
|
157
138
|
})
|
|
158
139
|
});
|
|
159
140
|
}
|
|
@@ -162,15 +143,15 @@ function getTemplate(input, ctx) {
|
|
|
162
143
|
return request(ctx, { path: `/templates/${encodeURIComponent(id)}` });
|
|
163
144
|
}
|
|
164
145
|
function createTemplate(input, ctx) {
|
|
165
|
-
return request(ctx, { path: "/templates", method: "POST", body:
|
|
146
|
+
return request(ctx, { path: "/templates", method: "POST", body: compactDefined({ ...input }) });
|
|
166
147
|
}
|
|
167
148
|
function editTemplate(input, ctx) {
|
|
168
149
|
const { templateIdOrAlias, ...rest } = input;
|
|
169
150
|
const id = pathValue(templateIdOrAlias, "templateIdOrAlias");
|
|
170
|
-
return request(ctx, { path: `/templates/${encodeURIComponent(id)}`, method: "PUT", body:
|
|
151
|
+
return request(ctx, { path: `/templates/${encodeURIComponent(id)}`, method: "PUT", body: compactDefined({ ...rest }) });
|
|
171
152
|
}
|
|
172
153
|
function validateTemplate(input, ctx) {
|
|
173
|
-
return request(ctx, { path: "/templates/validate", method: "POST", body:
|
|
154
|
+
return request(ctx, { path: "/templates/validate", method: "POST", body: compactDefined({ ...input }) });
|
|
174
155
|
}
|
|
175
156
|
|
|
176
157
|
// ../plugins/src/postmark/schema.ts
|
|
@@ -1,68 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createProviderHttpClient
|
|
3
|
+
} from "./chunk-VLOIDU5U.js";
|
|
4
|
+
import {
|
|
5
|
+
asJsonObject,
|
|
6
|
+
trimmedText
|
|
7
|
+
} from "./chunk-JXHMDBAY.js";
|
|
1
8
|
import {
|
|
2
9
|
createProviderPlugin,
|
|
3
10
|
requireApiKey,
|
|
4
11
|
upstreamError
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import
|
|
7
|
-
guardedFetch
|
|
8
|
-
} from "./chunk-2O27H4Y2.js";
|
|
9
|
-
import "./chunk-GKX72JMJ.js";
|
|
12
|
+
} from "./chunk-B4P6YZFS.js";
|
|
13
|
+
import "./chunk-SWBNHIO4.js";
|
|
10
14
|
import {
|
|
11
15
|
TBError,
|
|
12
16
|
external_exports
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-OKRZPQ3R.js";
|
|
18
|
+
import "./chunk-U67V476Y.js";
|
|
15
19
|
|
|
16
20
|
// ../plugins/src/prerender/api.ts
|
|
17
21
|
var SERVICE = "prerender";
|
|
18
22
|
var API_BASE = "https://api.prerender.io";
|
|
19
|
-
|
|
20
|
-
if (typeof value !== "string") return void 0;
|
|
21
|
-
const trimmed = value.trim();
|
|
22
|
-
return trimmed === "" ? void 0 : trimmed;
|
|
23
|
-
}
|
|
24
|
-
function record(value) {
|
|
25
|
-
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
26
|
-
}
|
|
23
|
+
var http = createProviderHttpClient({ baseUrl: `${API_BASE}/`, service: SERVICE });
|
|
27
24
|
function errorMessage(payload) {
|
|
28
|
-
if (typeof payload === "string") return
|
|
29
|
-
const body =
|
|
30
|
-
return
|
|
31
|
-
}
|
|
32
|
-
async function readPayload(response) {
|
|
33
|
-
const body = await response.text().catch(() => "");
|
|
34
|
-
if (body.trim() === "") return null;
|
|
35
|
-
try {
|
|
36
|
-
return JSON.parse(body);
|
|
37
|
-
} catch {
|
|
38
|
-
return body;
|
|
39
|
-
}
|
|
25
|
+
if (typeof payload === "string") return trimmedText(payload);
|
|
26
|
+
const body = asJsonObject(payload);
|
|
27
|
+
return trimmedText(body?.error) ?? trimmedText(body?.message) ?? trimmedText(body?.status);
|
|
40
28
|
}
|
|
41
29
|
async function request(ctx, path, input) {
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
30
|
+
const result = await http.request({
|
|
31
|
+
path,
|
|
32
|
+
method: input.method,
|
|
33
|
+
headers: { accept: "application/json" },
|
|
34
|
+
...input.body === void 0 ? {} : { json: input.body },
|
|
35
|
+
acceptStatuses: input.expectedStatuses,
|
|
36
|
+
invalidJson: "text",
|
|
37
|
+
sensitiveValues: [requireApiKey(ctx, SERVICE)],
|
|
38
|
+
mapError: ({ data: payload, status }) => upstreamError(
|
|
39
|
+
status,
|
|
40
|
+
errorMessage(payload) ?? `Prerender \u8BF7\u6C42\u5931\u8D25,HTTP ${status}`
|
|
41
|
+
),
|
|
42
|
+
mapTransportError: ({ message }) => upstreamError(
|
|
54
43
|
502,
|
|
55
|
-
|
|
56
|
-
)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (!response.ok && !(input.expectedStatuses ?? []).includes(response.status)) {
|
|
60
|
-
throw upstreamError(
|
|
61
|
-
response.status,
|
|
62
|
-
errorMessage(payload) ?? `Prerender \u8BF7\u6C42\u5931\u8D25,HTTP ${response.status}`
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
return { payload, status: response.status };
|
|
44
|
+
message === void 0 ? "Prerender \u8BF7\u6C42\u5931\u8D25" : `Prerender \u8BF7\u6C42\u5931\u8D25: ${message}`
|
|
45
|
+
)
|
|
46
|
+
});
|
|
47
|
+
return { payload: result.bodyKind === "empty" ? null : result.data, status: result.status };
|
|
66
48
|
}
|
|
67
49
|
function cacheClearStatusPath(apiKey) {
|
|
68
50
|
return `/cache-clear-status/${encodeURIComponent(apiKey)}`;
|