@tool-bridge/server 0.21.1 → 0.22.1

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.
Files changed (178) hide show
  1. package/dist/admin.js +170 -0
  2. package/dist/airtable-ML2GIGCH.js +790 -0
  3. package/dist/{alt_text_generator_ai-W7O34SNG.js → alt_text_generator_ai-FGYQAF2A.js} +12 -11
  4. package/dist/{amap-VOX4T2AW.js → amap-G7V65NGK.js} +221 -220
  5. package/dist/anthropic-6ZK24TBB.js +203 -0
  6. package/dist/apify-VDGYHP6W.js +248 -0
  7. package/dist/brave_search-TAATLZOS.js +302 -0
  8. package/dist/chunk-2IAI3XQM.js +302 -0
  9. package/dist/chunk-7ISGFRC6.js +161 -0
  10. package/dist/{chunk-E6JCVKW6.js → chunk-BNMLA2RC.js} +3 -3
  11. package/dist/chunk-HA4BGL6C.js +8429 -0
  12. package/dist/{chunk-KMTT3I6D.js → chunk-RMAWSG7E.js} +19172 -25717
  13. package/dist/{chunk-XYBU3WZH.js → chunk-RTW5VRTK.js} +3 -3
  14. package/dist/chunk-U7PTOA3U.js +7320 -0
  15. package/dist/chunk-UY6ANCOY.js +378 -0
  16. package/dist/{chunk-ATK45BXV.js → chunk-X7ZUTKHR.js} +4 -2
  17. package/dist/circleci-BQ2UWXL2.js +389 -0
  18. package/dist/clerk-2JYWQNOI.js +1019 -0
  19. package/dist/cohere-6MI7AQM4.js +185 -0
  20. package/dist/{confluence-B3EWPZVE.js → confluence-6Y6GDETF.js} +105 -104
  21. package/dist/{convertapi-EUWSQYPF.js → convertapi-HBZCSWOX.js} +32 -31
  22. package/dist/{currencyapi-KVTIK3GL.js → currencyapi-337U5TGI.js} +71 -71
  23. package/dist/deepseek-OSPASO7O.js +210 -0
  24. package/dist/docker_hub-3ATQOY5L.js +933 -0
  25. package/dist/dropbox-LSA4GM2Y.js +1305 -0
  26. package/dist/dub-VZPJSPI6.js +680 -0
  27. package/dist/e2b-6SDYQZL2.js +278 -0
  28. package/dist/exa-B6EUYDVP.js +332 -0
  29. package/dist/{fal_ai-23E7JPNT.js → fal_ai-K4Q27IME.js} +81 -80
  30. package/dist/{feishu-7QRIDUV6.js → feishu-4TKXG4SU.js} +528 -572
  31. package/dist/{feishu_custom_bot-TJ4K7QNJ.js → feishu_custom_bot-7CTEAKRB.js} +57 -53
  32. package/dist/figma-OUKSZLD5.js +777 -0
  33. package/dist/firehydrant-7MOYL7QH.js +563 -0
  34. package/dist/{fixer-BWON27UO.js → fixer-H2BV2NO4.js} +34 -33
  35. package/dist/fly-PXKY6PNH.js +469 -0
  36. package/dist/{front-QCGXYEDJ.js → front-UZYIV5DW.js} +104 -104
  37. package/dist/geocodio-NSYO7TFP.js +213 -0
  38. package/dist/ghost-QBKKQQMF.js +338 -0
  39. package/dist/github-ENLSJ4CL.js +5421 -0
  40. package/dist/gmail-KQSDEB47.js +1887 -0
  41. package/dist/googlecalendar-5YCX4SZF.js +2524 -0
  42. package/dist/{googledocs-BUHL4J2H.js → googledocs-SSWIVFKA.js} +341 -340
  43. package/dist/{grafana-GLU2DWF2.js → grafana-TF2LXDQA.js} +221 -220
  44. package/dist/graphhopper-CURBVHYK.js +325 -0
  45. package/dist/index.d.ts +1132 -332
  46. package/dist/index.js +31 -14
  47. package/dist/{ip2proxy-EZ64Y4ZH.js → ip2proxy-YNVMTZEM.js} +28 -27
  48. package/dist/ipgeolocation_io-NAU7VJ4J.js +315 -0
  49. package/dist/ipqualityscore-OT63L4TI.js +279 -0
  50. package/dist/{jina_ai-EFBHTBXL.js → jina_ai-6WBMBGWM.js} +23 -23
  51. package/dist/{jira-HQSHAA5K.js → jira-DVDVTHNO.js} +118 -117
  52. package/dist/langsmith-IM5N4YAU.js +593 -0
  53. package/dist/lemlist-277SHUQF.js +289 -0
  54. package/dist/{linear-K7RYFYAD.js → linear-AEPH7B5V.js} +327 -326
  55. package/dist/logsnag-VEWRAGBG.js +150 -0
  56. package/dist/main.js +57 -280
  57. package/dist/{mattermost-S2BRCWLQ.js → mattermost-Q3A2BIZA.js} +59 -58
  58. package/dist/mem0-AXS7GZGI.js +544 -0
  59. package/dist/memos-7TXG4ZTU.js +744 -0
  60. package/dist/{metabase-MMSEPCOF.js → metabase-NSVACWQM.js} +90 -89
  61. package/dist/mistral_ai-YZ52RGD4.js +1196 -0
  62. package/dist/{mother_duck-H7PCQNZ2.js → mother_duck-XLLL6FVL.js} +94 -93
  63. package/dist/ngrok-4O4W3WZW.js +356 -0
  64. package/dist/{notes-PFMKRO33.js → notes-YTB3TJOO.js} +11 -9
  65. package/dist/notion-4W4O7J7V.js +940 -0
  66. package/dist/open_exchange_rates-23QJXVO5.js +215 -0
  67. package/dist/openai-ZS7GLSLH.js +800 -0
  68. package/dist/opengraph_io-PMVH7OYI.js +362 -0
  69. package/dist/openrouter-ONRGFNB6.js +441 -0
  70. package/dist/outline-UCUYZZ7J.js +599 -0
  71. package/dist/paddle-35HTKTUL.js +454 -0
  72. package/dist/perplexity-NVOBYN24.js +220 -0
  73. package/dist/pinecone-55CJY73C.js +571 -0
  74. package/dist/{pipedrive-Y2O7QGFF.js → pipedrive-WMCAKS72.js} +99 -98
  75. package/dist/polar-SM4ZM53B.js +395 -0
  76. package/dist/posthog-NWCXVXNJ.js +3464 -0
  77. package/dist/postmark-QJV5PHUQ.js +427 -0
  78. package/dist/{prerender-MENYM2TY.js → prerender-2W7UT4SC.js} +31 -30
  79. package/dist/{pubmed-GOXUVVH5.js → pubmed-VVV7XYLU.js} +239 -238
  80. package/dist/{railway-V2SID4WV.js → railway-KGI57S3O.js} +118 -117
  81. package/dist/readwise-AGHTQB42.js +470 -0
  82. package/dist/render-O4HBROCK.js +461 -0
  83. package/dist/{replicate-756MXPYX.js → replicate-KWBOMX7D.js} +81 -80
  84. package/dist/{resend-ZKH3BTBI.js → resend-DRH6Y6I4.js} +20 -16
  85. package/dist/rootly-XGCUDW6X.js +336 -0
  86. package/dist/{scrapfly-NSRHFDIQ.js → scrapfly-OIQ3OY6L.js} +62 -61
  87. package/dist/{scrapingbee-OQHLAVEY.js → scrapingbee-OCZO4FHX.js} +56 -56
  88. package/dist/{screenshot_fyi-DVWG3AXC.js → screenshot_fyi-CUNGFZOC.js} +16 -16
  89. package/dist/semantic_scholar-3UJRLKES.js +611 -0
  90. package/dist/{sentry-546MNDJG.js → sentry-5BWVZFJV.js} +208 -207
  91. package/dist/{shodan-C3OON3Z3.js → shodan-HI37CTEW.js} +62 -61
  92. package/dist/shopify-LJ2EV2HH.js +610 -0
  93. package/dist/stripe-3LHMV55K.js +585 -0
  94. package/dist/{supabase-U2SL4D63.js → supabase-H2KPX3Q2.js} +245 -244
  95. package/dist/tavily-FBEWGH3Z.js +326 -0
  96. package/dist/telegram-MYYO3JND.js +1767 -0
  97. package/dist/{telnyx-CXQ4EZUX.js → telnyx-H4ALEGAX.js} +57 -56
  98. package/dist/todoist-OBWICA5Q.js +664 -0
  99. package/dist/trello-GUFUJRWO.js +1080 -0
  100. package/dist/turso-NIAK4UMS.js +416 -0
  101. package/dist/{twilio-4PDBJKWX.js → twilio-K6SLK2CX.js} +70 -69
  102. package/dist/umami-42RS2EPS.js +389 -0
  103. package/dist/unsplash-V7TOTETT.js +351 -0
  104. package/dist/{upstash_redis-G4LQBYHA.js → upstash_redis-AWQMB6Y3.js} +51 -50
  105. package/dist/uptimerobot-AZC2DHOT.js +483 -0
  106. package/dist/v2ex-4TVRNMLS.js +667 -0
  107. package/dist/vercel-DPHTJ3XR.js +1076 -0
  108. package/dist/{wolfram_alpha_api-3G4PUJWB.js → wolfram_alpha_api-XAG7IXBW.js} +36 -35
  109. package/dist/wordpress-KMPKVGUX.js +812 -0
  110. package/dist/workos-PKB2YR7S.js +664 -0
  111. package/dist/zhihu-Y4H4XYPB.js +254 -0
  112. package/package.json +18 -9
  113. package/dist/airtable-LLZDFN7M.js +0 -789
  114. package/dist/anthropic-G23NN3X5.js +0 -202
  115. package/dist/apify-Y3SS734K.js +0 -247
  116. package/dist/brave_search-ZC7OAPSZ.js +0 -301
  117. package/dist/chunk-R6P4XAE5.js +0 -248
  118. package/dist/chunk-U7B6DS2O.js +0 -977
  119. package/dist/chunk-UZM2RXZH.js +0 -23436
  120. package/dist/circleci-3BAX5FCG.js +0 -388
  121. package/dist/clerk-6LEM6TNU.js +0 -1019
  122. package/dist/cloudflare_dns-KINYTJUD.js +0 -588
  123. package/dist/cohere-XCJ5AJ6B.js +0 -185
  124. package/dist/deepseek-PC5YGNC5.js +0 -209
  125. package/dist/docker_hub-C3MA5FU6.js +0 -932
  126. package/dist/dropbox-XBV7Z2IR.js +0 -1304
  127. package/dist/dub-LDOFG3HC.js +0 -679
  128. package/dist/e2b-JMCPSVBW.js +0 -277
  129. package/dist/exa-RAK7O7RD.js +0 -331
  130. package/dist/figma-E6IX5DTH.js +0 -773
  131. package/dist/firehydrant-ZBLPQREE.js +0 -562
  132. package/dist/fly-ZH3HFCZJ.js +0 -468
  133. package/dist/geocodio-YGNI7DA4.js +0 -212
  134. package/dist/ghost-EVSGKH2Q.js +0 -337
  135. package/dist/github-MA2BGRCJ.js +0 -5420
  136. package/dist/gmail-E5E6AADE.js +0 -1886
  137. package/dist/googlecalendar-BTLFPXTD.js +0 -2523
  138. package/dist/graphhopper-WSMB3TCD.js +0 -324
  139. package/dist/ipgeolocation_io-AA7HAS22.js +0 -315
  140. package/dist/ipqualityscore-BHJXVTJT.js +0 -277
  141. package/dist/langsmith-5W6SCT6F.js +0 -592
  142. package/dist/lemlist-HJWH6UMK.js +0 -288
  143. package/dist/logsnag-4KFOHL37.js +0 -150
  144. package/dist/mem0-CAW43CIC.js +0 -543
  145. package/dist/memos-TWEGPKFM.js +0 -740
  146. package/dist/mistral_ai-64BGZQHP.js +0 -1195
  147. package/dist/ngrok-GQCUGZKJ.js +0 -356
  148. package/dist/notion-DQWZWP4N.js +0 -936
  149. package/dist/open_exchange_rates-QMMD735E.js +0 -214
  150. package/dist/openai-W6PX32NZ.js +0 -799
  151. package/dist/opengraph_io-HNDBXYNW.js +0 -361
  152. package/dist/openrouter-JJYMEAUL.js +0 -437
  153. package/dist/outline-MCBNQZYY.js +0 -595
  154. package/dist/paddle-D2SKLUDN.js +0 -453
  155. package/dist/perplexity-XIFMKUAE.js +0 -219
  156. package/dist/pinecone-HUFTALV2.js +0 -570
  157. package/dist/polar-TYTOMOSR.js +0 -394
  158. package/dist/posthog-43JAR3VW.js +0 -3463
  159. package/dist/postmark-KL2QJYSG.js +0 -426
  160. package/dist/readwise-CI4GIMMJ.js +0 -469
  161. package/dist/render-SUBJ6YRZ.js +0 -460
  162. package/dist/rootly-CD2LJHPI.js +0 -336
  163. package/dist/semantic_scholar-T4A252KW.js +0 -610
  164. package/dist/shopify-Y2HN2MCQ.js +0 -609
  165. package/dist/stripe-VE3CD3AY.js +0 -584
  166. package/dist/tavily-KCZHK6HE.js +0 -326
  167. package/dist/telegram-3URFBCMY.js +0 -1766
  168. package/dist/todoist-HNPWNYTD.js +0 -663
  169. package/dist/trello-3W2MIXRP.js +0 -1079
  170. package/dist/turso-2EQF7C2Z.js +0 -415
  171. package/dist/umami-5REN7TGP.js +0 -388
  172. package/dist/unsplash-EIXL424F.js +0 -350
  173. package/dist/uptimerobot-KNJ3EYLY.js +0 -482
  174. package/dist/v2ex-RHJ234PZ.js +0 -666
  175. package/dist/vercel-AS6NCIC7.js +0 -1075
  176. package/dist/wordpress-KNDAAUV7.js +0 -811
  177. package/dist/workos-R6UITSJ7.js +0 -663
  178. package/dist/zhihu-AGK4HILK.js +0 -253
@@ -0,0 +1,812 @@
1
+ import {
2
+ createAuthedClient
3
+ } from "./chunk-RTW5VRTK.js";
4
+ import "./chunk-BNMLA2RC.js";
5
+ import {
6
+ asJsonObject,
7
+ compactDefined,
8
+ trimmedText
9
+ } from "./chunk-JXHMDBAY.js";
10
+ import {
11
+ createProviderPlugin,
12
+ requireCredential,
13
+ upstreamError
14
+ } from "./chunk-X7ZUTKHR.js";
15
+ import {
16
+ assertPublicHttpUrl
17
+ } from "./chunk-7ISGFRC6.js";
18
+ import "./chunk-UY6ANCOY.js";
19
+ import {
20
+ TBError
21
+ } from "./chunk-HA4BGL6C.js";
22
+ import "./chunk-U67V476Y.js";
23
+
24
+ // ../plugins/src/wordpress/api.ts
25
+ var SERVICE = "wordpress";
26
+ var API_PATH = "wp-json/wp/v2";
27
+ var REST_ROOT_SUFFIXES = ["/wp-json/wp/v2", "/wp-json"];
28
+ var CURRENT_USER_PATH = "/users/me";
29
+ function requireRecord(value, message) {
30
+ const result = asJsonObject(value);
31
+ if (result === void 0) throw upstreamError(502, message);
32
+ return result;
33
+ }
34
+ function list(value) {
35
+ return value !== void 0 && value.length > 0 ? value : void 0;
36
+ }
37
+ function apiBaseUrl(ctx) {
38
+ const raw = requireCredential(ctx, SERVICE, "siteUrl").trim();
39
+ let url;
40
+ try {
41
+ url = assertPublicHttpUrl(raw);
42
+ } catch {
43
+ throw new TBError(
44
+ "invalid_argument",
45
+ "WordPress \u51ED\u8BC1\u91CC\u7684 siteUrl \u4E0D\u662F\u53EF\u51FA\u7AD9\u7684\u516C\u7F51 http(s) \u5730\u5740 \u2014\u2014 \u63D2\u4EF6\u4F1A\u62E6\u4E0B\u79C1\u6709\u7F51\u6BB5\u3001\u56DE\u73AF\u4E0E\u4E91\u5143\u6570\u636E\u5730\u5740(\u9632 SSRF)\u3002\u8BF7\u628A\u8FD9\u4E2A WordPress \u7AD9\u70B9\u7684\u516C\u7F51\u5730\u5740\u586B\u8FDB\u51ED\u8BC1\u7684 siteUrl \u5B57\u6BB5"
46
+ );
47
+ }
48
+ if (url.protocol !== "https:") {
49
+ throw new TBError(
50
+ "invalid_argument",
51
+ "WordPress \u51ED\u8BC1\u91CC\u7684 siteUrl \u5FC5\u987B\u7528 https \u2014\u2014 \u5E94\u7528\u5BC6\u7801\u662F\u4EE5 Basic \u5934\u660E\u6587\u53D1\u9001\u7684"
52
+ );
53
+ }
54
+ if (url.username !== "" || url.password !== "") {
55
+ throw new TBError("invalid_argument", "WordPress \u51ED\u8BC1\u91CC\u7684 siteUrl \u4E0D\u80FD\u5185\u5D4C\u7528\u6237\u540D\u6216\u5BC6\u7801");
56
+ }
57
+ url.hash = "";
58
+ url.search = "";
59
+ let pathname = url.pathname.replace(/\/+$/, "");
60
+ const lowered = pathname.toLowerCase();
61
+ for (const suffix of REST_ROOT_SUFFIXES) {
62
+ if (lowered.endsWith(suffix)) {
63
+ pathname = pathname.slice(0, pathname.length - suffix.length);
64
+ break;
65
+ }
66
+ }
67
+ pathname = pathname.replace(/\/+$/, "");
68
+ return new URL(API_PATH, `${url.origin}${pathname}/`).toString();
69
+ }
70
+ function basicAuthHeader(ctx) {
71
+ const username = requireCredential(ctx, SERVICE, "username").trim();
72
+ if (username === "") {
73
+ throw new TBError("invalid_argument", "WordPress \u51ED\u8BC1\u91CC\u7684 username \u4E0D\u80FD\u662F\u7A7A\u767D");
74
+ }
75
+ const applicationPassword = requireCredential(ctx, SERVICE, "apiKey");
76
+ const bytes = new TextEncoder().encode(`${username}:${applicationPassword}`);
77
+ let binary = "";
78
+ for (const byte of bytes) binary += String.fromCharCode(byte);
79
+ return `Basic ${btoa(binary)}`;
80
+ }
81
+ function queryPairs(query = {}) {
82
+ return Object.entries(query).map(([key, value]) => [
83
+ key,
84
+ Array.isArray(value) ? value.map(String).join(",") : value
85
+ ]);
86
+ }
87
+ function errorMessage(payload, context) {
88
+ return trimmedText(asJsonObject(payload)?.message) ?? (trimmedText(context.statusText) === void 0 ? "WordPress request failed" : `WordPress request failed: ${context.statusText}`);
89
+ }
90
+ function jsonPayload(data, bodyKind) {
91
+ return bodyKind === "json" ? data : null;
92
+ }
93
+ var http = createAuthedClient({
94
+ service: SERVICE,
95
+ auth: { kind: "custom", headers: (ctx) => ({ authorization: basicAuthHeader(ctx) }) },
96
+ headers: { accept: "application/json" },
97
+ mapError: (context) => upstreamError(
98
+ context.status || 502,
99
+ errorMessage(jsonPayload(context.data, context.bodyKind), context)
100
+ ),
101
+ mapTransportError: ({ message }) => upstreamError(
102
+ 502,
103
+ message === void 0 ? "WordPress request failed" : `WordPress request failed: ${message}`
104
+ )
105
+ });
106
+ async function requestResponse(ctx, options) {
107
+ return http.request(ctx, {
108
+ baseUrl: `${apiBaseUrl(ctx)}/`,
109
+ path: options.path,
110
+ method: options.method ?? "GET",
111
+ query: queryPairs(options.query),
112
+ ...options.body === void 0 ? {} : { json: options.body },
113
+ // 上游 response.json().catch(() => null):成功或错误上的非 JSON 都按 null。
114
+ invalidJson: "text"
115
+ });
116
+ }
117
+ async function requestObject(ctx, options) {
118
+ const result = await requestResponse(ctx, options);
119
+ const payload = jsonPayload(result.data, result.bodyKind);
120
+ return requireRecord(payload, "WordPress response must be a JSON object");
121
+ }
122
+ function headerInteger(headers, name) {
123
+ const value = headers.get(name);
124
+ if (value === null || value.trim() === "") return null;
125
+ const parsed = Number(value);
126
+ return Number.isInteger(parsed) ? parsed : null;
127
+ }
128
+ function readPagination(headers) {
129
+ return {
130
+ total: headerInteger(headers, "x-wp-total"),
131
+ totalPages: headerInteger(headers, "x-wp-totalpages")
132
+ };
133
+ }
134
+ function requireId(value) {
135
+ const parsed = Number(value);
136
+ if (!Number.isInteger(parsed)) throw new TBError("invalid_argument", "id must be an integer");
137
+ return parsed;
138
+ }
139
+ function assertNoIncludeExcludeOverlap(input) {
140
+ if (input.include === void 0 || input.exclude === void 0) return;
141
+ const include = new Set(input.include.map(String));
142
+ if (input.exclude.some((item) => include.has(String(item)))) {
143
+ throw new TBError("invalid_argument", "include and exclude must not contain the same ID.");
144
+ }
145
+ }
146
+ async function listCollection(ctx, input, path, outputKey, query) {
147
+ assertNoIncludeExcludeOverlap(input);
148
+ const response = await requestResponse(ctx, { path, query });
149
+ const payload = jsonPayload(response.data, response.bodyKind);
150
+ if (!Array.isArray(payload)) {
151
+ throw upstreamError(502, "WordPress list response must be an array");
152
+ }
153
+ return { [outputKey]: payload, pagination: readPagination(response.headers) };
154
+ }
155
+ async function getResource(ctx, input, collectionPath, outputKey) {
156
+ const id = requireId(input.id);
157
+ const payload = await requestObject(ctx, { path: `${collectionPath}/${encodeURIComponent(String(id))}` });
158
+ return { [outputKey]: payload };
159
+ }
160
+ async function createResource(ctx, path, outputKey, body) {
161
+ const payload = await requestObject(ctx, { path, method: "POST", body });
162
+ return { [outputKey]: payload };
163
+ }
164
+ async function updateResource(ctx, input, collectionPath, outputKey, body) {
165
+ const id = requireId(input.id);
166
+ const payload = await requestObject(ctx, {
167
+ // WordPress 两种方法都收,上游用 POST。
168
+ path: `${collectionPath}/${encodeURIComponent(String(id))}`,
169
+ method: "POST",
170
+ body
171
+ });
172
+ return { [outputKey]: payload };
173
+ }
174
+ async function deleteResource(ctx, input, collectionPath) {
175
+ const id = requireId(input.id);
176
+ const payload = await requestObject(ctx, {
177
+ path: `${collectionPath}/${encodeURIComponent(String(id))}`,
178
+ method: "DELETE",
179
+ query: { force: input.force }
180
+ });
181
+ return {
182
+ // 上游只认 `deleted === true`:少了这一步,"移入回收站"会被当成删除成功。
183
+ deleted: payload.deleted === true,
184
+ previous: asJsonObject(payload.previous) ?? null
185
+ };
186
+ }
187
+ function getCurrentUser(_input, ctx) {
188
+ return requestObject(ctx, { path: CURRENT_USER_PATH, query: { context: "edit" } }).then((user) => ({ user }));
189
+ }
190
+ function listPosts(input, ctx) {
191
+ return listCollection(ctx, input, "/posts", "posts", compactDefined({
192
+ search: trimmedText(input.search),
193
+ status: list(input.status),
194
+ categories: list(input.categories),
195
+ tags: list(input.tags),
196
+ include: list(input.include),
197
+ exclude: list(input.exclude),
198
+ author: list(input.author),
199
+ slug: list(input.slug),
200
+ per_page: input.perPage,
201
+ page: input.page,
202
+ order: trimmedText(input.order),
203
+ orderby: trimmedText(input.orderby)
204
+ }));
205
+ }
206
+ function getPost(input, ctx) {
207
+ return getResource(ctx, input, "/posts", "post");
208
+ }
209
+ function postBody(input) {
210
+ return compactDefined({
211
+ title: trimmedText(input.title),
212
+ content: trimmedText(input.content),
213
+ excerpt: trimmedText(input.excerpt),
214
+ slug: trimmedText(input.slug),
215
+ status: trimmedText(input.status),
216
+ categories: list(input.categories),
217
+ tags: list(input.tags),
218
+ featured_media: input.featuredMedia,
219
+ meta: asJsonObject(input.meta)
220
+ });
221
+ }
222
+ function createPost(input, ctx) {
223
+ return createResource(ctx, "/posts", "post", postBody(input));
224
+ }
225
+ function updatePost(input, ctx) {
226
+ return updateResource(ctx, input, "/posts", "post", postBody(input));
227
+ }
228
+ function deletePost(input, ctx) {
229
+ return deleteResource(ctx, input, "/posts");
230
+ }
231
+ function listPages(input, ctx) {
232
+ return listCollection(ctx, input, "/pages", "pages", compactDefined({
233
+ search: trimmedText(input.search),
234
+ status: list(input.status),
235
+ include: list(input.include),
236
+ exclude: list(input.exclude),
237
+ parent: list(input.parent),
238
+ author: list(input.author),
239
+ slug: list(input.slug),
240
+ per_page: input.perPage,
241
+ page: input.page,
242
+ order: trimmedText(input.order),
243
+ orderby: trimmedText(input.orderby)
244
+ }));
245
+ }
246
+ function getPage(input, ctx) {
247
+ return getResource(ctx, input, "/pages", "page");
248
+ }
249
+ function pageBody(input) {
250
+ return compactDefined({
251
+ title: trimmedText(input.title),
252
+ content: trimmedText(input.content),
253
+ excerpt: trimmedText(input.excerpt),
254
+ slug: trimmedText(input.slug),
255
+ status: trimmedText(input.status),
256
+ parent: input.parent,
257
+ featured_media: input.featuredMedia,
258
+ menu_order: input.menuOrder,
259
+ meta: asJsonObject(input.meta)
260
+ });
261
+ }
262
+ function createPage(input, ctx) {
263
+ return createResource(ctx, "/pages", "page", pageBody(input));
264
+ }
265
+ function updatePage(input, ctx) {
266
+ return updateResource(ctx, input, "/pages", "page", pageBody(input));
267
+ }
268
+ function deletePage(input, ctx) {
269
+ return deleteResource(ctx, input, "/pages");
270
+ }
271
+ function termListQuery(input) {
272
+ return compactDefined({
273
+ search: trimmedText(input.search),
274
+ include: list(input.include),
275
+ exclude: list(input.exclude),
276
+ // term 的 parent 是**单个** ID(post/page/comment 那边才是数组)。
277
+ parent: input.parent,
278
+ slug: list(input.slug),
279
+ hide_empty: input.hideEmpty,
280
+ per_page: input.perPage,
281
+ page: input.page,
282
+ order: trimmedText(input.order),
283
+ orderby: trimmedText(input.orderby)
284
+ });
285
+ }
286
+ function termBody(input) {
287
+ return compactDefined({
288
+ name: trimmedText(input.name),
289
+ slug: trimmedText(input.slug),
290
+ description: trimmedText(input.description),
291
+ parent: input.parent,
292
+ meta: asJsonObject(input.meta)
293
+ });
294
+ }
295
+ function listCategories(input, ctx) {
296
+ return listCollection(ctx, input, "/categories", "categories", termListQuery(input));
297
+ }
298
+ function createCategory(input, ctx) {
299
+ return createResource(ctx, "/categories", "category", termBody(input));
300
+ }
301
+ function listTags(input, ctx) {
302
+ return listCollection(ctx, input, "/tags", "tags", termListQuery(input));
303
+ }
304
+ function createTag(input, ctx) {
305
+ return createResource(ctx, "/tags", "tag", termBody(input));
306
+ }
307
+ function listComments(input, ctx) {
308
+ return listCollection(ctx, input, "/comments", "comments", compactDefined({
309
+ search: trimmedText(input.search),
310
+ status: list(input.status),
311
+ post: list(input.post),
312
+ author: list(input.author),
313
+ parent: list(input.parent),
314
+ include: list(input.include),
315
+ exclude: list(input.exclude),
316
+ per_page: input.perPage,
317
+ page: input.page,
318
+ order: trimmedText(input.order),
319
+ orderby: trimmedText(input.orderby)
320
+ }));
321
+ }
322
+ function updateComment(input, ctx) {
323
+ return updateResource(ctx, input, "/comments", "comment", compactDefined({
324
+ content: trimmedText(input.content),
325
+ status: trimmedText(input.status),
326
+ author_name: trimmedText(input.authorName),
327
+ author_email: trimmedText(input.authorEmail),
328
+ author_url: trimmedText(input.authorUrl)
329
+ }));
330
+ }
331
+ function deleteComment(input, ctx) {
332
+ return deleteResource(ctx, input, "/comments");
333
+ }
334
+
335
+ // ../plugins/src/wordpress/schema.ts
336
+ import { z } from "zod/v4";
337
+ var getCurrentUserInput = z.strictObject({}).describe("The input payload for getting the authenticated WordPress user.");
338
+ var getCurrentUserOutput = z.strictObject({
339
+ user: z.looseObject({
340
+ id: z.int().min(1).describe("The numeric WordPress user ID."),
341
+ name: z.string().describe("The WordPress user display name.")
342
+ }).describe("The authenticated WordPress user.").optional()
343
+ }).describe("The response returned when getting the authenticated WordPress user.");
344
+ var listPostsInput = z.strictObject({
345
+ search: z.string().min(1).regex(new RegExp("\\S")).describe("Limit results to resources matching this search string.").optional(),
346
+ page: z.int().min(1).describe("The page number of WordPress results to return.").optional(),
347
+ perPage: z.int().min(1).max(100).describe("The maximum number of WordPress results to return.").optional(),
348
+ order: z.enum(["asc", "desc"]).describe("The sort direction for WordPress list results.").optional(),
349
+ status: z.array(z.enum(["publish", "future", "draft", "pending", "private"]).describe("The WordPress publication status.")).min(1).describe("WordPress statuses to include.").optional(),
350
+ categories: z.array(z.int().min(1).describe("One numeric WordPress resource ID.")).min(1).describe("Category IDs used to filter WordPress posts.").optional(),
351
+ tags: z.array(z.int().min(1).describe("One numeric WordPress resource ID.")).min(1).describe("Tag IDs used to filter WordPress posts.").optional(),
352
+ include: z.array(z.int().min(1).describe("One numeric WordPress resource ID.")).min(1).describe("Post IDs to include in the response.").optional(),
353
+ exclude: z.array(z.int().min(1).describe("One numeric WordPress resource ID.")).min(1).describe("Post IDs to exclude from the response.").optional(),
354
+ author: z.array(z.int().min(1).describe("One numeric WordPress resource ID.")).min(1).describe("Author user IDs used to filter WordPress posts.").optional(),
355
+ slug: z.array(z.string().min(1).regex(new RegExp("\\S")).describe("The WordPress URL slug.")).min(1).describe("Post slugs used to filter WordPress posts.").optional(),
356
+ orderby: z.enum(["author", "date", "id", "include", "modified", "parent", "relevance", "slug", "include_slugs", "title"]).describe("The field used to sort WordPress posts or pages.").optional()
357
+ }).describe("Input parameters for listing WordPress posts.");
358
+ var listPostsOutput = z.strictObject({
359
+ posts: z.array(z.looseObject({
360
+ id: z.int().min(1).describe("The numeric WordPress post ID."),
361
+ slug: z.string().describe("The WordPress post slug."),
362
+ status: z.string().describe("The WordPress post status."),
363
+ title: z.looseObject({
364
+ rendered: z.string().describe("The rendered HTML value returned by WordPress.").optional()
365
+ }).describe("A WordPress rendered object.")
366
+ }).describe("A WordPress post object.")).describe("The WordPress posts returned by the list request.").optional(),
367
+ pagination: z.strictObject({
368
+ total: z.int().describe("The total number of matching WordPress resources.").nullable().optional(),
369
+ totalPages: z.int().describe("The total number of WordPress result pages.").nullable().optional()
370
+ }).describe("Pagination metadata returned in WordPress response headers.").optional()
371
+ }).describe("The response returned when listing WordPress posts.");
372
+ var getPostInput = z.strictObject({
373
+ id: z.int().min(1).describe("The numeric WordPress resource ID.").optional()
374
+ }).describe("Input parameters for retrieving one WordPress resource.");
375
+ var getPostOutput = z.strictObject({
376
+ post: z.looseObject({
377
+ id: z.int().min(1).describe("The numeric WordPress post ID."),
378
+ slug: z.string().describe("The WordPress post slug."),
379
+ status: z.string().describe("The WordPress post status."),
380
+ title: z.looseObject({
381
+ rendered: z.string().describe("The rendered HTML value returned by WordPress.").optional()
382
+ }).describe("A WordPress rendered object.")
383
+ }).describe("A WordPress post object.").optional()
384
+ }).describe("The response returned when getting a WordPress post.");
385
+ var createPostInput = z.strictObject({
386
+ title: z.string().min(1).regex(new RegExp("\\S")).describe("The post title.").optional(),
387
+ content: z.string().describe("The post content.").optional(),
388
+ excerpt: z.string().describe("The post excerpt.").optional(),
389
+ slug: z.string().min(1).regex(new RegExp("\\S")).describe("The WordPress URL slug.").optional(),
390
+ status: z.enum(["publish", "future", "draft", "pending", "private"]).describe("The WordPress publication status.").optional(),
391
+ categories: z.array(z.int().min(1).describe("One numeric WordPress resource ID.")).min(1).describe("Category IDs assigned to the post.").optional(),
392
+ tags: z.array(z.int().min(1).describe("One numeric WordPress resource ID.")).min(1).describe("Tag IDs assigned to the post.").optional(),
393
+ featuredMedia: z.int().min(1).describe("The featured media attachment ID.").optional(),
394
+ meta: z.looseObject({}).describe("Meta fields to send to WordPress.").optional()
395
+ }).describe("Input fields for creating or updating a WordPress post.");
396
+ var createPostOutput = z.strictObject({
397
+ post: z.looseObject({
398
+ id: z.int().min(1).describe("The numeric WordPress post ID."),
399
+ slug: z.string().describe("The WordPress post slug."),
400
+ status: z.string().describe("The WordPress post status."),
401
+ title: z.looseObject({
402
+ rendered: z.string().describe("The rendered HTML value returned by WordPress.").optional()
403
+ }).describe("A WordPress rendered object.")
404
+ }).describe("A WordPress post object.").optional()
405
+ }).describe("The response returned when creating a WordPress post.");
406
+ var updatePostInput = z.strictObject({
407
+ id: z.int().min(1).describe("The numeric WordPress resource ID."),
408
+ title: z.string().min(1).regex(new RegExp("\\S")).describe("The post title.").optional(),
409
+ content: z.string().describe("The post content.").optional(),
410
+ excerpt: z.string().describe("The post excerpt.").optional(),
411
+ slug: z.string().min(1).regex(new RegExp("\\S")).describe("The WordPress URL slug.").optional(),
412
+ status: z.enum(["publish", "future", "draft", "pending", "private"]).describe("The WordPress publication status.").optional(),
413
+ categories: z.array(z.int().min(1).describe("One numeric WordPress resource ID.")).min(1).describe("Category IDs assigned to the post.").optional(),
414
+ tags: z.array(z.int().min(1).describe("One numeric WordPress resource ID.")).min(1).describe("Tag IDs assigned to the post.").optional(),
415
+ featuredMedia: z.int().min(1).describe("The featured media attachment ID.").optional(),
416
+ meta: z.looseObject({}).describe("Meta fields to send to WordPress.").optional()
417
+ }).describe("Input parameters for updating a WordPress post.");
418
+ var updatePostOutput = z.strictObject({
419
+ post: z.looseObject({
420
+ id: z.int().min(1).describe("The numeric WordPress post ID."),
421
+ slug: z.string().describe("The WordPress post slug."),
422
+ status: z.string().describe("The WordPress post status."),
423
+ title: z.looseObject({
424
+ rendered: z.string().describe("The rendered HTML value returned by WordPress.").optional()
425
+ }).describe("A WordPress rendered object.")
426
+ }).describe("A WordPress post object.").optional()
427
+ }).describe("The response returned when updating a WordPress post.");
428
+ var deletePostInput = z.strictObject({
429
+ id: z.int().min(1).describe("The numeric WordPress resource ID."),
430
+ force: z.boolean().describe("Whether to permanently delete the resource instead of moving it to trash.").optional()
431
+ }).describe("Input parameters for deleting one WordPress resource.");
432
+ var deletePostOutput = z.strictObject({
433
+ deleted: z.boolean().describe("Whether WordPress deleted the resource.").optional(),
434
+ previous: z.looseObject({}).describe("The previous WordPress resource payload when returned.").nullable().optional()
435
+ }).describe("The response returned when deleting a WordPress resource.");
436
+ var listPagesInput = z.strictObject({
437
+ search: z.string().min(1).regex(new RegExp("\\S")).describe("Limit results to resources matching this search string.").optional(),
438
+ page: z.int().min(1).describe("The page number of WordPress results to return.").optional(),
439
+ perPage: z.int().min(1).max(100).describe("The maximum number of WordPress results to return.").optional(),
440
+ order: z.enum(["asc", "desc"]).describe("The sort direction for WordPress list results.").optional(),
441
+ status: z.array(z.enum(["publish", "future", "draft", "pending", "private"]).describe("The WordPress publication status.")).min(1).describe("WordPress statuses to include.").optional(),
442
+ include: z.array(z.int().min(1).describe("One numeric WordPress resource ID.")).min(1).describe("Page IDs to include in the response.").optional(),
443
+ exclude: z.array(z.int().min(1).describe("One numeric WordPress resource ID.")).min(1).describe("Page IDs to exclude from the response.").optional(),
444
+ parent: z.array(z.int().min(1).describe("One numeric WordPress resource ID.")).min(1).describe("Parent page IDs used to filter WordPress pages.").optional(),
445
+ author: z.array(z.int().min(1).describe("One numeric WordPress resource ID.")).min(1).describe("Author user IDs used to filter WordPress pages.").optional(),
446
+ slug: z.array(z.string().min(1).regex(new RegExp("\\S")).describe("The WordPress URL slug.")).min(1).describe("Page slugs used to filter WordPress pages.").optional(),
447
+ orderby: z.enum(["author", "date", "id", "include", "modified", "parent", "relevance", "slug", "include_slugs", "title"]).describe("The field used to sort WordPress posts or pages.").optional()
448
+ }).describe("Input parameters for listing WordPress pages.");
449
+ var listPagesOutput = z.strictObject({
450
+ pages: z.array(z.looseObject({
451
+ id: z.int().min(1).describe("The numeric WordPress page ID."),
452
+ slug: z.string().describe("The WordPress page slug."),
453
+ status: z.string().describe("The WordPress page status."),
454
+ title: z.looseObject({
455
+ rendered: z.string().describe("The rendered HTML value returned by WordPress.").optional()
456
+ }).describe("A WordPress rendered object.")
457
+ }).describe("A WordPress page object.")).describe("The WordPress pages returned by the list request.").optional(),
458
+ pagination: z.strictObject({
459
+ total: z.int().describe("The total number of matching WordPress resources.").nullable().optional(),
460
+ totalPages: z.int().describe("The total number of WordPress result pages.").nullable().optional()
461
+ }).describe("Pagination metadata returned in WordPress response headers.").optional()
462
+ }).describe("The response returned when listing WordPress pages.");
463
+ var getPageInput = z.strictObject({
464
+ id: z.int().min(1).describe("The numeric WordPress resource ID.").optional()
465
+ }).describe("Input parameters for retrieving one WordPress resource.");
466
+ var getPageOutput = z.strictObject({
467
+ page: z.looseObject({
468
+ id: z.int().min(1).describe("The numeric WordPress page ID."),
469
+ slug: z.string().describe("The WordPress page slug."),
470
+ status: z.string().describe("The WordPress page status."),
471
+ title: z.looseObject({
472
+ rendered: z.string().describe("The rendered HTML value returned by WordPress.").optional()
473
+ }).describe("A WordPress rendered object.")
474
+ }).describe("A WordPress page object.").optional()
475
+ }).describe("The response returned when getting a WordPress page.");
476
+ var createPageInput = z.strictObject({
477
+ title: z.string().min(1).regex(new RegExp("\\S")).describe("The page title.").optional(),
478
+ content: z.string().describe("The page content.").optional(),
479
+ excerpt: z.string().describe("The page excerpt.").optional(),
480
+ slug: z.string().min(1).regex(new RegExp("\\S")).describe("The WordPress URL slug.").optional(),
481
+ status: z.enum(["publish", "future", "draft", "pending", "private"]).describe("The WordPress publication status.").optional(),
482
+ parent: z.int().min(1).describe("The parent page ID.").optional(),
483
+ featuredMedia: z.int().min(1).describe("The featured media attachment ID.").optional(),
484
+ menuOrder: z.int().describe("The page menu order.").optional(),
485
+ meta: z.looseObject({}).describe("Meta fields to send to WordPress.").optional()
486
+ }).describe("Input fields for creating or updating a WordPress page.");
487
+ var createPageOutput = z.strictObject({
488
+ page: z.looseObject({
489
+ id: z.int().min(1).describe("The numeric WordPress page ID."),
490
+ slug: z.string().describe("The WordPress page slug."),
491
+ status: z.string().describe("The WordPress page status."),
492
+ title: z.looseObject({
493
+ rendered: z.string().describe("The rendered HTML value returned by WordPress.").optional()
494
+ }).describe("A WordPress rendered object.")
495
+ }).describe("A WordPress page object.").optional()
496
+ }).describe("The response returned when creating a WordPress page.");
497
+ var updatePageInput = z.strictObject({
498
+ id: z.int().min(1).describe("The numeric WordPress resource ID."),
499
+ title: z.string().min(1).regex(new RegExp("\\S")).describe("The page title.").optional(),
500
+ content: z.string().describe("The page content.").optional(),
501
+ excerpt: z.string().describe("The page excerpt.").optional(),
502
+ slug: z.string().min(1).regex(new RegExp("\\S")).describe("The WordPress URL slug.").optional(),
503
+ status: z.enum(["publish", "future", "draft", "pending", "private"]).describe("The WordPress publication status.").optional(),
504
+ parent: z.int().min(1).describe("The parent page ID.").optional(),
505
+ featuredMedia: z.int().min(1).describe("The featured media attachment ID.").optional(),
506
+ menuOrder: z.int().describe("The page menu order.").optional(),
507
+ meta: z.looseObject({}).describe("Meta fields to send to WordPress.").optional()
508
+ }).describe("Input parameters for updating a WordPress page.");
509
+ var updatePageOutput = z.strictObject({
510
+ page: z.looseObject({
511
+ id: z.int().min(1).describe("The numeric WordPress page ID."),
512
+ slug: z.string().describe("The WordPress page slug."),
513
+ status: z.string().describe("The WordPress page status."),
514
+ title: z.looseObject({
515
+ rendered: z.string().describe("The rendered HTML value returned by WordPress.").optional()
516
+ }).describe("A WordPress rendered object.")
517
+ }).describe("A WordPress page object.").optional()
518
+ }).describe("The response returned when updating a WordPress page.");
519
+ var deletePageInput = z.strictObject({
520
+ id: z.int().min(1).describe("The numeric WordPress resource ID."),
521
+ force: z.boolean().describe("Whether to permanently delete the resource instead of moving it to trash.").optional()
522
+ }).describe("Input parameters for deleting one WordPress resource.");
523
+ var deletePageOutput = z.strictObject({
524
+ deleted: z.boolean().describe("Whether WordPress deleted the resource.").optional(),
525
+ previous: z.looseObject({}).describe("The previous WordPress resource payload when returned.").nullable().optional()
526
+ }).describe("The response returned when deleting a WordPress resource.");
527
+ var listCategoriesInput = z.strictObject({
528
+ search: z.string().min(1).regex(new RegExp("\\S")).describe("Limit results to resources matching this search string.").optional(),
529
+ page: z.int().min(1).describe("The page number of WordPress results to return.").optional(),
530
+ perPage: z.int().min(1).max(100).describe("The maximum number of WordPress results to return.").optional(),
531
+ order: z.enum(["asc", "desc"]).describe("The sort direction for WordPress list results.").optional(),
532
+ include: z.array(z.int().min(1).describe("One numeric WordPress resource ID.")).min(1).describe("Term IDs to include in the response.").optional(),
533
+ exclude: z.array(z.int().min(1).describe("One numeric WordPress resource ID.")).min(1).describe("Term IDs to exclude from the response.").optional(),
534
+ parent: z.int().min(1).describe("Parent term ID used to filter child terms.").optional(),
535
+ slug: z.array(z.string().min(1).regex(new RegExp("\\S")).describe("The WordPress URL slug.")).min(1).describe("Term slugs used to filter WordPress terms.").optional(),
536
+ hideEmpty: z.boolean().describe("Whether to hide terms not assigned to any post.").optional(),
537
+ orderby: z.enum(["id", "include", "name", "slug", "include_slugs", "term_group", "description", "count"]).describe("The field used to sort WordPress terms.").optional()
538
+ }).describe("Input parameters for listing WordPress terms.");
539
+ var listCategoriesOutput = z.strictObject({
540
+ categories: z.array(z.looseObject({
541
+ id: z.int().min(1).describe("The numeric WordPress term ID."),
542
+ name: z.string().describe("The term display name."),
543
+ slug: z.string().describe("The WordPress term slug.")
544
+ }).describe("A WordPress taxonomy term object.")).describe("The WordPress categories returned by the list request.").optional(),
545
+ pagination: z.strictObject({
546
+ total: z.int().describe("The total number of matching WordPress resources.").nullable().optional(),
547
+ totalPages: z.int().describe("The total number of WordPress result pages.").nullable().optional()
548
+ }).describe("Pagination metadata returned in WordPress response headers.").optional()
549
+ }).describe("The response returned when listing WordPress categories.");
550
+ var createCategoryInput = z.strictObject({
551
+ name: z.string().min(1).regex(new RegExp("\\S")).describe("The term display name."),
552
+ slug: z.string().min(1).regex(new RegExp("\\S")).describe("The WordPress URL slug.").optional(),
553
+ description: z.string().describe("The term description.").optional(),
554
+ parent: z.int().min(1).describe("The parent term ID.").optional(),
555
+ meta: z.looseObject({}).describe("Meta fields to send to WordPress.").optional()
556
+ }).describe("Input fields for creating a WordPress taxonomy term.");
557
+ var createCategoryOutput = z.strictObject({
558
+ category: z.looseObject({
559
+ id: z.int().min(1).describe("The numeric WordPress term ID."),
560
+ name: z.string().describe("The term display name."),
561
+ slug: z.string().describe("The WordPress term slug.")
562
+ }).describe("A WordPress taxonomy term object.").optional()
563
+ }).describe("The response returned when creating a WordPress category.");
564
+ var listTagsInput = z.strictObject({
565
+ search: z.string().min(1).regex(new RegExp("\\S")).describe("Limit results to resources matching this search string.").optional(),
566
+ page: z.int().min(1).describe("The page number of WordPress results to return.").optional(),
567
+ perPage: z.int().min(1).max(100).describe("The maximum number of WordPress results to return.").optional(),
568
+ order: z.enum(["asc", "desc"]).describe("The sort direction for WordPress list results.").optional(),
569
+ include: z.array(z.int().min(1).describe("One numeric WordPress resource ID.")).min(1).describe("Term IDs to include in the response.").optional(),
570
+ exclude: z.array(z.int().min(1).describe("One numeric WordPress resource ID.")).min(1).describe("Term IDs to exclude from the response.").optional(),
571
+ parent: z.int().min(1).describe("Parent term ID used to filter child terms.").optional(),
572
+ slug: z.array(z.string().min(1).regex(new RegExp("\\S")).describe("The WordPress URL slug.")).min(1).describe("Term slugs used to filter WordPress terms.").optional(),
573
+ hideEmpty: z.boolean().describe("Whether to hide terms not assigned to any post.").optional(),
574
+ orderby: z.enum(["id", "include", "name", "slug", "include_slugs", "term_group", "description", "count"]).describe("The field used to sort WordPress terms.").optional()
575
+ }).describe("Input parameters for listing WordPress terms.");
576
+ var listTagsOutput = z.strictObject({
577
+ tags: z.array(z.looseObject({
578
+ id: z.int().min(1).describe("The numeric WordPress term ID."),
579
+ name: z.string().describe("The term display name."),
580
+ slug: z.string().describe("The WordPress term slug.")
581
+ }).describe("A WordPress taxonomy term object.")).describe("The WordPress tags returned by the list request.").optional(),
582
+ pagination: z.strictObject({
583
+ total: z.int().describe("The total number of matching WordPress resources.").nullable().optional(),
584
+ totalPages: z.int().describe("The total number of WordPress result pages.").nullable().optional()
585
+ }).describe("Pagination metadata returned in WordPress response headers.").optional()
586
+ }).describe("The response returned when listing WordPress tags.");
587
+ var createTagInput = z.strictObject({
588
+ name: z.string().min(1).regex(new RegExp("\\S")).describe("The term display name."),
589
+ slug: z.string().min(1).regex(new RegExp("\\S")).describe("The WordPress URL slug.").optional(),
590
+ description: z.string().describe("The term description.").optional(),
591
+ parent: z.int().min(1).describe("The parent term ID.").optional(),
592
+ meta: z.looseObject({}).describe("Meta fields to send to WordPress.").optional()
593
+ }).describe("Input fields for creating a WordPress taxonomy term.");
594
+ var createTagOutput = z.strictObject({
595
+ tag: z.looseObject({
596
+ id: z.int().min(1).describe("The numeric WordPress term ID."),
597
+ name: z.string().describe("The term display name."),
598
+ slug: z.string().describe("The WordPress term slug.")
599
+ }).describe("A WordPress taxonomy term object.").optional()
600
+ }).describe("The response returned when creating a WordPress tag.");
601
+ var listCommentsInput = z.strictObject({
602
+ search: z.string().min(1).regex(new RegExp("\\S")).describe("Limit results to resources matching this search string.").optional(),
603
+ page: z.int().min(1).describe("The page number of WordPress results to return.").optional(),
604
+ perPage: z.int().min(1).max(100).describe("The maximum number of WordPress results to return.").optional(),
605
+ order: z.enum(["asc", "desc"]).describe("The sort direction for WordPress list results.").optional(),
606
+ status: z.array(z.enum(["hold", "approve", "approved", "spam", "trash"]).describe("The WordPress comment status.")).min(1).describe("WordPress comment statuses to include.").optional(),
607
+ post: z.array(z.int().min(1).describe("One numeric WordPress resource ID.")).min(1).describe("Post IDs used to filter comments.").optional(),
608
+ author: z.array(z.int().min(1).describe("One numeric WordPress resource ID.")).min(1).describe("Author user IDs used to filter comments.").optional(),
609
+ parent: z.array(z.int().min(1).describe("One numeric WordPress resource ID.")).min(1).describe("Parent comment IDs used to filter comments.").optional(),
610
+ include: z.array(z.int().min(1).describe("One numeric WordPress resource ID.")).min(1).describe("Comment IDs to include in the response.").optional(),
611
+ exclude: z.array(z.int().min(1).describe("One numeric WordPress resource ID.")).min(1).describe("Comment IDs to exclude from the response.").optional(),
612
+ orderby: z.enum(["date", "date_gmt", "id", "include", "post", "parent", "type"]).describe("The field used to sort WordPress comments.").optional()
613
+ }).describe("Input parameters for listing WordPress comments.");
614
+ var listCommentsOutput = z.strictObject({
615
+ comments: z.array(z.looseObject({
616
+ id: z.int().min(1).describe("The numeric WordPress comment ID."),
617
+ status: z.string().describe("The WordPress comment status.")
618
+ }).describe("A WordPress comment object.")).describe("The WordPress comments returned by the list request.").optional(),
619
+ pagination: z.strictObject({
620
+ total: z.int().describe("The total number of matching WordPress resources.").nullable().optional(),
621
+ totalPages: z.int().describe("The total number of WordPress result pages.").nullable().optional()
622
+ }).describe("Pagination metadata returned in WordPress response headers.").optional()
623
+ }).describe("The response returned when listing WordPress comments.");
624
+ var updateCommentInput = z.strictObject({
625
+ id: z.int().min(1).describe("The numeric WordPress resource ID."),
626
+ content: z.string().describe("The comment content.").optional(),
627
+ status: z.enum(["hold", "approve", "approved", "spam", "trash"]).describe("The WordPress comment status.").optional(),
628
+ authorName: z.string().min(1).describe("The display name for the comment author.").optional(),
629
+ authorEmail: z.email().describe("The email address for the comment author.").optional(),
630
+ authorUrl: z.url().describe("The URL for the comment author.").optional()
631
+ }).describe("Input fields for updating a WordPress comment.");
632
+ var updateCommentOutput = z.strictObject({
633
+ comment: z.looseObject({
634
+ id: z.int().min(1).describe("The numeric WordPress comment ID."),
635
+ status: z.string().describe("The WordPress comment status.")
636
+ }).describe("A WordPress comment object.").optional()
637
+ }).describe("The response returned when updating a WordPress comment.");
638
+ var deleteCommentInput = z.strictObject({
639
+ id: z.int().min(1).describe("The numeric WordPress resource ID."),
640
+ force: z.boolean().describe("Whether to permanently delete the resource instead of moving it to trash.").optional()
641
+ }).describe("Input parameters for deleting one WordPress resource.");
642
+ var deleteCommentOutput = z.strictObject({
643
+ deleted: z.boolean().describe("Whether WordPress deleted the resource.").optional(),
644
+ previous: z.looseObject({}).describe("The previous WordPress resource payload when returned.").nullable().optional()
645
+ }).describe("The response returned when deleting a WordPress resource.");
646
+ var wordpressActions = {
647
+ get_current_user: {
648
+ description: "Get the authenticated WordPress user.",
649
+ effect: "read",
650
+ inputSchema: getCurrentUserInput,
651
+ outputSchema: z.toJSONSchema(getCurrentUserOutput, { io: "output", unrepresentable: "any" })
652
+ },
653
+ list_posts: {
654
+ description: "List WordPress posts with optional filters and pagination.",
655
+ effect: "read",
656
+ inputSchema: listPostsInput,
657
+ outputSchema: z.toJSONSchema(listPostsOutput, { io: "output", unrepresentable: "any" })
658
+ },
659
+ get_post: {
660
+ description: "Get a WordPress post by ID.",
661
+ effect: "read",
662
+ inputSchema: getPostInput,
663
+ outputSchema: z.toJSONSchema(getPostOutput, { io: "output", unrepresentable: "any" })
664
+ },
665
+ create_post: {
666
+ description: "Create a WordPress post.",
667
+ effect: "write",
668
+ inputSchema: createPostInput,
669
+ outputSchema: z.toJSONSchema(createPostOutput, { io: "output", unrepresentable: "any" })
670
+ },
671
+ update_post: {
672
+ description: "Update a WordPress post by ID.",
673
+ effect: "write",
674
+ inputSchema: updatePostInput,
675
+ outputSchema: z.toJSONSchema(updatePostOutput, { io: "output", unrepresentable: "any" })
676
+ },
677
+ delete_post: {
678
+ description: "Delete a WordPress post by ID.",
679
+ effect: "destructive",
680
+ inputSchema: deletePostInput,
681
+ outputSchema: z.toJSONSchema(deletePostOutput, { io: "output", unrepresentable: "any" })
682
+ },
683
+ list_pages: {
684
+ description: "List WordPress pages with optional filters and pagination.",
685
+ effect: "read",
686
+ inputSchema: listPagesInput,
687
+ outputSchema: z.toJSONSchema(listPagesOutput, { io: "output", unrepresentable: "any" })
688
+ },
689
+ get_page: {
690
+ description: "Get a WordPress page by ID.",
691
+ effect: "read",
692
+ inputSchema: getPageInput,
693
+ outputSchema: z.toJSONSchema(getPageOutput, { io: "output", unrepresentable: "any" })
694
+ },
695
+ create_page: {
696
+ description: "Create a WordPress page.",
697
+ effect: "write",
698
+ inputSchema: createPageInput,
699
+ outputSchema: z.toJSONSchema(createPageOutput, { io: "output", unrepresentable: "any" })
700
+ },
701
+ update_page: {
702
+ description: "Update a WordPress page by ID.",
703
+ effect: "write",
704
+ inputSchema: updatePageInput,
705
+ outputSchema: z.toJSONSchema(updatePageOutput, { io: "output", unrepresentable: "any" })
706
+ },
707
+ delete_page: {
708
+ description: "Delete a WordPress page by ID.",
709
+ effect: "destructive",
710
+ inputSchema: deletePageInput,
711
+ outputSchema: z.toJSONSchema(deletePageOutput, { io: "output", unrepresentable: "any" })
712
+ },
713
+ list_categories: {
714
+ description: "List WordPress categories with optional filters and pagination.",
715
+ effect: "read",
716
+ inputSchema: listCategoriesInput,
717
+ outputSchema: z.toJSONSchema(listCategoriesOutput, { io: "output", unrepresentable: "any" })
718
+ },
719
+ create_category: {
720
+ description: "Create a WordPress category.",
721
+ effect: "write",
722
+ inputSchema: createCategoryInput,
723
+ outputSchema: z.toJSONSchema(createCategoryOutput, { io: "output", unrepresentable: "any" })
724
+ },
725
+ list_tags: {
726
+ description: "List WordPress tags with optional filters and pagination.",
727
+ effect: "read",
728
+ inputSchema: listTagsInput,
729
+ outputSchema: z.toJSONSchema(listTagsOutput, { io: "output", unrepresentable: "any" })
730
+ },
731
+ create_tag: {
732
+ description: "Create a WordPress tag.",
733
+ effect: "write",
734
+ inputSchema: createTagInput,
735
+ outputSchema: z.toJSONSchema(createTagOutput, { io: "output", unrepresentable: "any" })
736
+ },
737
+ list_comments: {
738
+ description: "List WordPress comments with optional filters and pagination.",
739
+ effect: "read",
740
+ inputSchema: listCommentsInput,
741
+ outputSchema: z.toJSONSchema(listCommentsOutput, { io: "output", unrepresentable: "any" })
742
+ },
743
+ update_comment: {
744
+ description: "Update a WordPress comment by ID.",
745
+ effect: "write",
746
+ inputSchema: updateCommentInput,
747
+ outputSchema: z.toJSONSchema(updateCommentOutput, { io: "output", unrepresentable: "any" })
748
+ },
749
+ delete_comment: {
750
+ description: "Delete a WordPress comment by ID.",
751
+ effect: "destructive",
752
+ inputSchema: deleteCommentInput,
753
+ outputSchema: z.toJSONSchema(deleteCommentOutput, { io: "output", unrepresentable: "any" })
754
+ }
755
+ };
756
+
757
+ // ../plugins/src/wordpress/index.ts
758
+ function createWordpressPlugin() {
759
+ return createProviderPlugin({
760
+ description: "WordPress (REST API v2)",
761
+ actions: wordpressActions,
762
+ credentialFields: [
763
+ {
764
+ key: "apiKey",
765
+ label: "Application Password",
766
+ required: true,
767
+ secret: true,
768
+ description: "WordPress \u5E94\u7528\u5BC6\u7801,\u4F5C\u4E3A HTTP Basic \u8BA4\u8BC1\u7684\u5BC6\u7801\u53D1\u9001;\u5728 WordPress \u540E\u53F0\u7684 Users > Profile > Application Passwords \u91CC\u521B\u5EFA"
769
+ },
770
+ {
771
+ key: "siteUrl",
772
+ label: "Site URL",
773
+ required: true,
774
+ secret: false,
775
+ description: "WordPress \u7AD9\u70B9\u7684\u6839\u5730\u5740(https://example.com,\u5B50\u76EE\u5F55\u5B89\u88C5\u5199\u5230\u5B50\u76EE\u5F55);\u5E26 /wp-json \u6216 /wp-json/wp/v2 \u540E\u7F00\u4E5F\u8BA4\u3002\u5FC5\u987B\u662F https \u7684\u516C\u7F51\u5730\u5740,\u79C1\u6709\u7F51\u6BB5\u4F1A\u88AB\u51FA\u7AD9\u7B56\u7565\u62E6\u4E0B"
776
+ },
777
+ {
778
+ key: "username",
779
+ label: "Username",
780
+ required: true,
781
+ secret: false,
782
+ description: "\u4E0E\u5E94\u7528\u5BC6\u7801\u914D\u5BF9\u7684 WordPress \u7528\u6237\u540D,\u4F5C\u4E3A HTTP Basic \u8BA4\u8BC1\u7684\u7528\u6237\u540D\u53D1\u9001"
783
+ }
784
+ ],
785
+ credentialProbe: "get_current_user",
786
+ handlers: {
787
+ get_current_user: getCurrentUser,
788
+ list_posts: listPosts,
789
+ get_post: getPost,
790
+ create_post: createPost,
791
+ update_post: updatePost,
792
+ delete_post: deletePost,
793
+ list_pages: listPages,
794
+ get_page: getPage,
795
+ create_page: createPage,
796
+ update_page: updatePage,
797
+ delete_page: deletePage,
798
+ list_categories: listCategories,
799
+ create_category: createCategory,
800
+ list_tags: listTags,
801
+ create_tag: createTag,
802
+ list_comments: listComments,
803
+ update_comment: updateComment,
804
+ delete_comment: deleteComment
805
+ }
806
+ });
807
+ }
808
+ var wordpress_default = createWordpressPlugin();
809
+ export {
810
+ createWordpressPlugin,
811
+ wordpress_default as default
812
+ };