@tool-bridge/server 0.21.1 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/dist/admin.js +170 -0
  2. package/dist/airtable-VMQVXLHK.js +790 -0
  3. package/dist/{alt_text_generator_ai-W7O34SNG.js → alt_text_generator_ai-FTWY4RU4.js} +12 -11
  4. package/dist/{amap-VOX4T2AW.js → amap-OK5VBHYC.js} +221 -220
  5. package/dist/anthropic-S67AZFZ3.js +203 -0
  6. package/dist/apify-ZE6MYQI3.js +248 -0
  7. package/dist/brave_search-TG2M2KOD.js +302 -0
  8. package/dist/chunk-2JNAI4OC.js +161 -0
  9. package/dist/{chunk-KMTT3I6D.js → chunk-4XJPN3DY.js} +19392 -26136
  10. package/dist/chunk-5ICRY3VU.js +8432 -0
  11. package/dist/chunk-7CTWGTDU.js +302 -0
  12. package/dist/chunk-BADVCN6K.js +378 -0
  13. package/dist/{chunk-XYBU3WZH.js → chunk-TDAWLMDE.js} +3 -3
  14. package/dist/chunk-U7PTOA3U.js +7320 -0
  15. package/dist/{chunk-E6JCVKW6.js → chunk-VWRUGUSU.js} +3 -3
  16. package/dist/{chunk-ATK45BXV.js → chunk-WJHG6OK7.js} +4 -2
  17. package/dist/circleci-3L3WJVSK.js +389 -0
  18. package/dist/clerk-EZPF2V7T.js +1019 -0
  19. package/dist/cohere-U27DPO64.js +185 -0
  20. package/dist/{confluence-B3EWPZVE.js → confluence-G2KL6ERH.js} +105 -104
  21. package/dist/{convertapi-EUWSQYPF.js → convertapi-L4CLJ2M3.js} +32 -31
  22. package/dist/{currencyapi-KVTIK3GL.js → currencyapi-YPYXG7YY.js} +71 -71
  23. package/dist/deepseek-6HT6WF3M.js +210 -0
  24. package/dist/docker_hub-LPE3PCVB.js +933 -0
  25. package/dist/dropbox-V56ABHTA.js +1305 -0
  26. package/dist/dub-6OKQ7MHT.js +680 -0
  27. package/dist/e2b-JS2U2QFU.js +278 -0
  28. package/dist/exa-DPWVYXSP.js +332 -0
  29. package/dist/{fal_ai-23E7JPNT.js → fal_ai-DK6Y27ZF.js} +81 -80
  30. package/dist/{feishu-7QRIDUV6.js → feishu-K7EGSRF3.js} +528 -572
  31. package/dist/{feishu_custom_bot-TJ4K7QNJ.js → feishu_custom_bot-2JUGFYNG.js} +57 -53
  32. package/dist/figma-FT5I7ITD.js +777 -0
  33. package/dist/firehydrant-EIKLKHX2.js +563 -0
  34. package/dist/{fixer-BWON27UO.js → fixer-U5QXIAKD.js} +34 -33
  35. package/dist/fly-T3JYFZ2M.js +469 -0
  36. package/dist/{front-QCGXYEDJ.js → front-D72MGVOR.js} +104 -104
  37. package/dist/geocodio-BOTD5TI5.js +213 -0
  38. package/dist/ghost-KYP7SZGB.js +338 -0
  39. package/dist/github-AGMZT3VY.js +5421 -0
  40. package/dist/gmail-BLJNJOBG.js +1887 -0
  41. package/dist/googlecalendar-GTHWNCF6.js +2524 -0
  42. package/dist/{googledocs-BUHL4J2H.js → googledocs-6EEDMEBQ.js} +341 -340
  43. package/dist/{grafana-GLU2DWF2.js → grafana-GMW6EKSQ.js} +221 -220
  44. package/dist/graphhopper-6OLGBDGB.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-4QN42E6T.js} +28 -27
  48. package/dist/ipgeolocation_io-SK4XKDA2.js +315 -0
  49. package/dist/ipqualityscore-6ANBPXKT.js +279 -0
  50. package/dist/{jina_ai-EFBHTBXL.js → jina_ai-IHPSVRM5.js} +23 -23
  51. package/dist/{jira-HQSHAA5K.js → jira-46KKM4LC.js} +118 -117
  52. package/dist/langsmith-JZA345I5.js +593 -0
  53. package/dist/lemlist-43IV7DK6.js +289 -0
  54. package/dist/{linear-K7RYFYAD.js → linear-5LFH7XNL.js} +327 -326
  55. package/dist/logsnag-5RMYAHIL.js +150 -0
  56. package/dist/main.js +57 -280
  57. package/dist/{mattermost-S2BRCWLQ.js → mattermost-XFL6SHGG.js} +59 -58
  58. package/dist/mem0-NYO4DTP6.js +544 -0
  59. package/dist/memos-37MPQOLV.js +744 -0
  60. package/dist/{metabase-MMSEPCOF.js → metabase-KYBKZFMG.js} +90 -89
  61. package/dist/mistral_ai-6PL3K4PM.js +1196 -0
  62. package/dist/{mother_duck-H7PCQNZ2.js → mother_duck-2NH7W5M5.js} +94 -93
  63. package/dist/ngrok-UO6CDYCA.js +356 -0
  64. package/dist/{notes-PFMKRO33.js → notes-I3P32WP4.js} +11 -9
  65. package/dist/notion-BEAJFUOE.js +940 -0
  66. package/dist/open_exchange_rates-CMF62JB4.js +215 -0
  67. package/dist/openai-IHOMKVND.js +800 -0
  68. package/dist/opengraph_io-ZQ2FGLHX.js +362 -0
  69. package/dist/openrouter-HXLW3NR5.js +441 -0
  70. package/dist/outline-ELCP4NEU.js +599 -0
  71. package/dist/paddle-O77LALVN.js +454 -0
  72. package/dist/perplexity-JCU654QV.js +220 -0
  73. package/dist/pinecone-W5W4LRKL.js +571 -0
  74. package/dist/{pipedrive-Y2O7QGFF.js → pipedrive-ITMJLLPZ.js} +99 -98
  75. package/dist/polar-R33XU4L3.js +395 -0
  76. package/dist/posthog-JVNTOLTV.js +3464 -0
  77. package/dist/postmark-6SBG7HWV.js +427 -0
  78. package/dist/{prerender-MENYM2TY.js → prerender-GPNKTNFC.js} +31 -30
  79. package/dist/{pubmed-GOXUVVH5.js → pubmed-UP6ZEEIH.js} +239 -238
  80. package/dist/{railway-V2SID4WV.js → railway-KWEWXHTY.js} +118 -117
  81. package/dist/readwise-BLATSMC3.js +470 -0
  82. package/dist/render-QYRVIXII.js +461 -0
  83. package/dist/{replicate-756MXPYX.js → replicate-JYTWH4NF.js} +81 -80
  84. package/dist/{resend-ZKH3BTBI.js → resend-L5N75SZM.js} +20 -16
  85. package/dist/rootly-MHCPEQ26.js +336 -0
  86. package/dist/{scrapfly-NSRHFDIQ.js → scrapfly-PTPGYSJM.js} +62 -61
  87. package/dist/{scrapingbee-OQHLAVEY.js → scrapingbee-JN6UH5PY.js} +56 -56
  88. package/dist/{screenshot_fyi-DVWG3AXC.js → screenshot_fyi-4QRVSV55.js} +16 -16
  89. package/dist/semantic_scholar-LRSWA2GE.js +611 -0
  90. package/dist/{sentry-546MNDJG.js → sentry-2G6PF5W6.js} +208 -207
  91. package/dist/{shodan-C3OON3Z3.js → shodan-WKKPP5C6.js} +62 -61
  92. package/dist/shopify-64YDK5T2.js +610 -0
  93. package/dist/stripe-QAIGGOTF.js +585 -0
  94. package/dist/{supabase-U2SL4D63.js → supabase-WHTGR6ND.js} +245 -244
  95. package/dist/tavily-QIXCDDWO.js +326 -0
  96. package/dist/telegram-E6G7CWI6.js +1767 -0
  97. package/dist/{telnyx-CXQ4EZUX.js → telnyx-ZDVVS7PK.js} +57 -56
  98. package/dist/todoist-DMYF3G7J.js +664 -0
  99. package/dist/trello-HY2RYIRP.js +1080 -0
  100. package/dist/turso-HAQWMGRP.js +416 -0
  101. package/dist/{twilio-4PDBJKWX.js → twilio-MLXYPHJE.js} +70 -69
  102. package/dist/umami-DZHBLPVG.js +389 -0
  103. package/dist/unsplash-GS2OPXKE.js +351 -0
  104. package/dist/{upstash_redis-G4LQBYHA.js → upstash_redis-XMXWTNAJ.js} +51 -50
  105. package/dist/uptimerobot-TF5WRZ4G.js +483 -0
  106. package/dist/v2ex-2BVXAPDF.js +667 -0
  107. package/dist/vercel-YMJGQYJE.js +1076 -0
  108. package/dist/{wolfram_alpha_api-3G4PUJWB.js → wolfram_alpha_api-I56SXWFZ.js} +36 -35
  109. package/dist/wordpress-R7TDFZ2P.js +812 -0
  110. package/dist/workos-HDNHWVMS.js +664 -0
  111. package/dist/zhihu-LX6AGGDS.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,395 @@
1
+ import {
2
+ createAuthedClient
3
+ } from "./chunk-TDAWLMDE.js";
4
+ import "./chunk-VWRUGUSU.js";
5
+ import {
6
+ asJsonObject,
7
+ trimmedText
8
+ } from "./chunk-JXHMDBAY.js";
9
+ import {
10
+ createProviderPlugin,
11
+ upstreamError
12
+ } from "./chunk-WJHG6OK7.js";
13
+ import "./chunk-2JNAI4OC.js";
14
+ import "./chunk-BADVCN6K.js";
15
+ import {
16
+ TBError
17
+ } from "./chunk-5ICRY3VU.js";
18
+ import "./chunk-U67V476Y.js";
19
+
20
+ // ../plugins/src/polar/api.ts
21
+ var SERVICE = "polar";
22
+ var API_BASE = "https://api.polar.sh/v1";
23
+ function requireRecord(value, label) {
24
+ const result = asJsonObject(value);
25
+ if (result === void 0) throw new TBError("unavailable", `Polar \u7684${label}\u4E0D\u662F\u5BF9\u8C61`, { retryable: true });
26
+ return result;
27
+ }
28
+ function requireId(value, field) {
29
+ const id = trimmedText(value);
30
+ if (id === void 0) throw new TBError("invalid_argument", `${field} \u662F\u5FC5\u586B\u7684`);
31
+ return encodeURIComponent(id);
32
+ }
33
+ function appendQueryValue(query, key, value) {
34
+ if (value === void 0 || value === null) return;
35
+ if (Array.isArray(value)) {
36
+ for (const child of value) appendQueryValue(query, key, child);
37
+ return;
38
+ }
39
+ if (typeof value === "boolean") {
40
+ query.push([key, value ? "true" : "false"]);
41
+ return;
42
+ }
43
+ if (typeof value === "number") {
44
+ query.push([key, String(value)]);
45
+ return;
46
+ }
47
+ const stringValue = trimmedText(value);
48
+ if (stringValue !== void 0) query.push([key, stringValue]);
49
+ }
50
+ function listQuery(input) {
51
+ const query = [];
52
+ for (const [key, value] of Object.entries(input)) {
53
+ if (key === "metadata") {
54
+ const metadata = asJsonObject(value);
55
+ if (metadata !== void 0) {
56
+ for (const [name, child] of Object.entries(metadata)) appendQueryValue(query, `metadata[${name}]`, child);
57
+ }
58
+ continue;
59
+ }
60
+ appendQueryValue(query, key, value);
61
+ }
62
+ return query;
63
+ }
64
+ function errorDetail(payload) {
65
+ const body = asJsonObject(payload);
66
+ if (body === void 0) return void 0;
67
+ const detail = body.detail;
68
+ const detailText = trimmedText(detail);
69
+ if (detailText !== void 0) return detailText;
70
+ if (Array.isArray(detail)) {
71
+ const message = trimmedText(asJsonObject(detail[0])?.msg);
72
+ if (message !== void 0) return message;
73
+ }
74
+ return trimmedText(body.message) ?? trimmedText(body.error) ?? trimmedText(body.title);
75
+ }
76
+ var http = createAuthedClient({
77
+ baseUrl: `${API_BASE}/`,
78
+ service: SERVICE,
79
+ auth: { kind: "bearer" },
80
+ headers: { accept: "application/json" },
81
+ // detail 可能是 FastAPI 校验错误数组(取 `detail[0].msg`),标准键序提取表达不了,整段覆写。
82
+ mapError: ({ data: payload, status }) => upstreamError(
83
+ status,
84
+ errorDetail(payload) ?? `Polar \u8FD4\u56DE HTTP ${status}`
85
+ )
86
+ });
87
+ async function request(ctx, path, query) {
88
+ const { data } = await http.request(ctx, {
89
+ path,
90
+ method: "GET",
91
+ query,
92
+ invalidJsonMessage: "Polar \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94"
93
+ });
94
+ return data ?? null;
95
+ }
96
+ async function listResources(path, input, ctx) {
97
+ return requireRecord(await request(ctx, path, listQuery(input)), "\u5217\u8868\u54CD\u5E94");
98
+ }
99
+ async function getResource(path, ctx) {
100
+ return { payload: requireRecord(await request(ctx, path), "\u8D44\u6E90\u54CD\u5E94") };
101
+ }
102
+ function listOrganizations(input, ctx) {
103
+ return listResources("/organizations/", input, ctx);
104
+ }
105
+ function getOrganization(input, ctx) {
106
+ return getResource(`/organizations/${requireId(input.id, "id")}`, ctx);
107
+ }
108
+ function listProducts(input, ctx) {
109
+ return listResources("/products/", input, ctx);
110
+ }
111
+ function getProduct(input, ctx) {
112
+ return getResource(`/products/${requireId(input.id, "id")}`, ctx);
113
+ }
114
+ function listCustomers(input, ctx) {
115
+ return listResources("/customers/", input, ctx);
116
+ }
117
+ function getCustomer(input, ctx) {
118
+ return getResource(`/customers/${requireId(input.id, "id")}`, ctx);
119
+ }
120
+ function getCustomerByExternalId(input, ctx) {
121
+ return getResource(`/customers/external/${requireId(input.external_id, "external_id")}`, ctx);
122
+ }
123
+ function getCustomerState(input, ctx) {
124
+ return getResource(`/customers/${requireId(input.id, "id")}/state`, ctx);
125
+ }
126
+ function getCustomerStateByExternalId(input, ctx) {
127
+ return getResource(`/customers/external/${requireId(input.external_id, "external_id")}/state`, ctx);
128
+ }
129
+ function listOrders(input, ctx) {
130
+ return listResources("/orders/", input, ctx);
131
+ }
132
+ function getOrder(input, ctx) {
133
+ return getResource(`/orders/${requireId(input.id, "id")}`, ctx);
134
+ }
135
+ function listSubscriptions(input, ctx) {
136
+ return listResources("/subscriptions/", input, ctx);
137
+ }
138
+ function getSubscription(input, ctx) {
139
+ return getResource(`/subscriptions/${requireId(input.id, "id")}`, ctx);
140
+ }
141
+
142
+ // ../plugins/src/polar/schema.ts
143
+ import { z } from "zod/v4";
144
+ var listOrganizationsInput = z.strictObject({
145
+ slug: z.string().min(1).describe("Filter organizations by slug.").optional(),
146
+ page: z.int().min(1).describe("Page number, starting from 1.").optional(),
147
+ limit: z.int().min(1).max(100).describe("Number of items to return per page. Polar supports up to 100.").optional(),
148
+ sorting: z.array(z.enum(["created_at", "-created_at", "slug", "-slug", "name", "-name", "next_review_threshold", "-next_review_threshold", "days_in_status", "-days_in_status"]).describe("A Polar organization sorting field.")).min(1).describe("Polar organization sorting fields.").optional()
149
+ }).describe("Input parameters for listing Polar organizations.");
150
+ var listOrganizationsOutput = z.strictObject({
151
+ items: z.array(z.looseObject({}).describe("organizations")).describe("Polar organizations returned for the requested page.").optional(),
152
+ pagination: z.strictObject({
153
+ total_count: z.int().min(0).describe("Total number of items matching the request.").optional(),
154
+ max_page: z.int().min(0).describe("Maximum page number available for this request.").optional()
155
+ }).describe("Polar pagination metadata.").optional()
156
+ }).describe("A page of Polar organizations.");
157
+ var getOrganizationInput = z.strictObject({
158
+ id: z.uuid().describe("The Polar resource ID.").optional()
159
+ }).describe("Input parameters for retrieving a Polar organization.");
160
+ var getOrganizationOutput = z.strictObject({
161
+ payload: z.looseObject({}).describe("The raw Polar resource payload.").optional()
162
+ }).describe("A Polar organization response.");
163
+ var listProductsInput = z.strictObject({
164
+ id: z.union([z.uuid().describe("A Polar product ID."), z.array(z.uuid().describe("A Polar UUID value.")).min(1).describe("Polar product IDs.")]).describe("Filter by product ID.").optional(),
165
+ organization_id: z.union([z.uuid().describe("A Polar organization ID."), z.array(z.uuid().describe("A Polar UUID value.")).min(1).describe("Polar organization IDs.")]).describe("Filter by organization ID.").optional(),
166
+ query: z.string().min(1).describe("Filter by product name.").optional(),
167
+ is_archived: z.boolean().describe("Filter by archived products.").optional(),
168
+ is_recurring: z.boolean().describe("Filter by recurring products.").optional(),
169
+ benefit_id: z.union([z.uuid().describe("A Polar benefit ID."), z.array(z.uuid().describe("A Polar UUID value.")).min(1).describe("Polar benefit IDs.")]).describe("Filter products granting a benefit.").optional(),
170
+ visibility: z.array(z.enum(["draft", "private", "public"]).describe("Polar product visibility.")).min(1).describe("Product visibility values to include.").optional(),
171
+ page: z.int().min(1).describe("Page number, starting from 1.").optional(),
172
+ limit: z.int().min(1).max(100).describe("Number of items to return per page. Polar supports up to 100.").optional(),
173
+ sorting: z.array(z.enum(["created_at", "-created_at", "name", "-name", "price_amount_type", "-price_amount_type", "price_amount", "-price_amount"]).describe("A Polar product sorting field.")).min(1).describe("Polar product sorting fields.").optional(),
174
+ metadata: z.record(z.string(), z.union([z.string().describe("A string metadata value."), z.int().describe("An integer metadata value."), z.boolean().describe("A boolean metadata value."), z.array(z.string().describe("A string metadata value.")).min(1).describe("String metadata values."), z.array(z.int().describe("An integer metadata value.")).min(1).describe("Integer metadata values."), z.array(z.boolean().describe("A boolean metadata value.")).min(1).describe("Boolean metadata values.")]).describe("A Polar metadata filter value.")).describe("Metadata filters sent with Polar's deepObject query style.").optional()
175
+ }).describe("Input parameters for listing Polar products.");
176
+ var listProductsOutput = z.strictObject({
177
+ items: z.array(z.looseObject({}).describe("products")).describe("Polar products returned for the requested page.").optional(),
178
+ pagination: z.strictObject({
179
+ total_count: z.int().min(0).describe("Total number of items matching the request.").optional(),
180
+ max_page: z.int().min(0).describe("Maximum page number available for this request.").optional()
181
+ }).describe("Polar pagination metadata.").optional()
182
+ }).describe("A page of Polar products.");
183
+ var getProductInput = z.strictObject({
184
+ id: z.uuid().describe("The Polar resource ID.").optional()
185
+ }).describe("Input parameters for retrieving a Polar product.");
186
+ var getProductOutput = z.strictObject({
187
+ payload: z.looseObject({}).describe("The raw Polar resource payload.").optional()
188
+ }).describe("A Polar product response.");
189
+ var listCustomersInput = z.strictObject({
190
+ organization_id: z.union([z.uuid().describe("A Polar organization ID."), z.array(z.uuid().describe("A Polar UUID value.")).min(1).describe("Polar organization IDs.")]).describe("Filter by organization ID.").optional(),
191
+ email: z.email().describe("Filter by exact customer email.").optional(),
192
+ query: z.string().min(1).describe("Filter by customer name, email, or external ID.").optional(),
193
+ active: z.boolean().describe("Filter by active customers.").optional(),
194
+ page: z.int().min(1).describe("Page number, starting from 1.").optional(),
195
+ limit: z.int().min(1).max(100).describe("Number of items to return per page. Polar supports up to 100.").optional(),
196
+ sorting: z.array(z.enum(["created_at", "-created_at", "email", "-email", "name", "-name"]).describe("A Polar customer sorting field.")).min(1).describe("Polar customer sorting fields.").optional(),
197
+ metadata: z.record(z.string(), z.union([z.string().describe("A string metadata value."), z.int().describe("An integer metadata value."), z.boolean().describe("A boolean metadata value."), z.array(z.string().describe("A string metadata value.")).min(1).describe("String metadata values."), z.array(z.int().describe("An integer metadata value.")).min(1).describe("Integer metadata values."), z.array(z.boolean().describe("A boolean metadata value.")).min(1).describe("Boolean metadata values.")]).describe("A Polar metadata filter value.")).describe("Metadata filters sent with Polar's deepObject query style.").optional()
198
+ }).describe("Input parameters for listing Polar customers.");
199
+ var listCustomersOutput = z.strictObject({
200
+ items: z.array(z.looseObject({}).describe("customers")).describe("Polar customers returned for the requested page.").optional(),
201
+ pagination: z.strictObject({
202
+ total_count: z.int().min(0).describe("Total number of items matching the request.").optional(),
203
+ max_page: z.int().min(0).describe("Maximum page number available for this request.").optional()
204
+ }).describe("Polar pagination metadata.").optional()
205
+ }).describe("A page of Polar customers.");
206
+ var getCustomerInput = z.strictObject({
207
+ id: z.uuid().describe("The Polar resource ID.").optional()
208
+ }).describe("Input parameters for retrieving a Polar customer.");
209
+ var getCustomerOutput = z.strictObject({
210
+ payload: z.looseObject({}).describe("The raw Polar resource payload.").optional()
211
+ }).describe("A Polar customer response.");
212
+ var getCustomerByExternalIdInput = z.strictObject({
213
+ external_id: z.string().min(1).describe("The Polar customer external ID.").optional()
214
+ }).describe("Input parameters for retrieving a Polar customer by external ID.");
215
+ var getCustomerByExternalIdOutput = z.strictObject({
216
+ payload: z.looseObject({}).describe("The raw Polar resource payload.").optional()
217
+ }).describe("A Polar customer response.");
218
+ var getCustomerStateInput = z.strictObject({
219
+ id: z.uuid().describe("The Polar resource ID.").optional()
220
+ }).describe("Input parameters for retrieving a Polar customer state.");
221
+ var getCustomerStateOutput = z.strictObject({
222
+ payload: z.looseObject({}).describe("The raw Polar resource payload.").optional()
223
+ }).describe("A Polar customer state response.");
224
+ var getCustomerStateByExternalIdInput = z.strictObject({
225
+ external_id: z.string().min(1).describe("The Polar customer external ID.").optional()
226
+ }).describe("Input parameters for retrieving a Polar customer state by external ID.");
227
+ var getCustomerStateByExternalIdOutput = z.strictObject({
228
+ payload: z.looseObject({}).describe("The raw Polar resource payload.").optional()
229
+ }).describe("A Polar customer state response.");
230
+ var listOrdersInput = z.strictObject({
231
+ organization_id: z.union([z.uuid().describe("A Polar organization ID."), z.array(z.uuid().describe("A Polar UUID value.")).min(1).describe("Polar organization IDs.")]).describe("Filter by organization ID.").optional(),
232
+ product_id: z.union([z.uuid().describe("A Polar product ID."), z.array(z.uuid().describe("A Polar UUID value.")).min(1).describe("Polar product IDs.")]).describe("Filter by product ID.").optional(),
233
+ product_billing_type: z.union([z.enum(["one_time", "recurring"]).describe("Polar product billing type."), z.array(z.enum(["one_time", "recurring"]).describe("Polar product billing type.")).min(1).describe("Product billing types to include.")]).describe("Filter by product billing type.").optional(),
234
+ discount_id: z.union([z.uuid().describe("A Polar discount ID."), z.array(z.uuid().describe("A Polar UUID value.")).min(1).describe("Polar discount IDs.")]).describe("Filter by discount ID.").optional(),
235
+ customer_id: z.union([z.uuid().describe("A Polar customer ID."), z.array(z.uuid().describe("A Polar UUID value.")).min(1).describe("Polar customer IDs.")]).describe("Filter by customer ID.").optional(),
236
+ external_customer_id: z.union([z.string().min(1).describe("A Polar customer external ID."), z.array(z.string().min(1).describe("A string filter value.")).min(1).describe("Polar customer external IDs.")]).describe("Filter by customer external ID.").optional(),
237
+ checkout_id: z.union([z.uuid().describe("A Polar checkout ID."), z.array(z.uuid().describe("A Polar UUID value.")).min(1).describe("Polar checkout IDs.")]).describe("Filter by checkout ID.").optional(),
238
+ subscription_id: z.union([z.uuid().describe("A Polar subscription ID."), z.array(z.uuid().describe("A Polar UUID value.")).min(1).describe("Polar subscription IDs.")]).describe("Filter by subscription ID.").optional(),
239
+ page: z.int().min(1).describe("Page number, starting from 1.").optional(),
240
+ limit: z.int().min(1).max(100).describe("Number of items to return per page. Polar supports up to 100.").optional(),
241
+ sorting: z.array(z.enum(["created_at", "-created_at", "status", "-status", "invoice_number", "-invoice_number", "amount", "-amount", "net_amount", "-net_amount", "customer", "-customer", "product", "-product", "discount", "-discount", "subscription", "-subscription"]).describe("A Polar order sorting field.")).min(1).describe("Polar order sorting fields.").optional(),
242
+ metadata: z.record(z.string(), z.union([z.string().describe("A string metadata value."), z.int().describe("An integer metadata value."), z.boolean().describe("A boolean metadata value."), z.array(z.string().describe("A string metadata value.")).min(1).describe("String metadata values."), z.array(z.int().describe("An integer metadata value.")).min(1).describe("Integer metadata values."), z.array(z.boolean().describe("A boolean metadata value.")).min(1).describe("Boolean metadata values.")]).describe("A Polar metadata filter value.")).describe("Metadata filters sent with Polar's deepObject query style.").optional()
243
+ }).describe("Input parameters for listing Polar orders.");
244
+ var listOrdersOutput = z.strictObject({
245
+ items: z.array(z.looseObject({}).describe("orders")).describe("Polar orders returned for the requested page.").optional(),
246
+ pagination: z.strictObject({
247
+ total_count: z.int().min(0).describe("Total number of items matching the request.").optional(),
248
+ max_page: z.int().min(0).describe("Maximum page number available for this request.").optional()
249
+ }).describe("Polar pagination metadata.").optional()
250
+ }).describe("A page of Polar orders.");
251
+ var getOrderInput = z.strictObject({
252
+ id: z.uuid().describe("The Polar resource ID.").optional()
253
+ }).describe("Input parameters for retrieving a Polar order.");
254
+ var getOrderOutput = z.strictObject({
255
+ payload: z.looseObject({}).describe("The raw Polar resource payload.").optional()
256
+ }).describe("A Polar order response.");
257
+ var listSubscriptionsInput = z.strictObject({
258
+ organization_id: z.union([z.uuid().describe("A Polar organization ID."), z.array(z.uuid().describe("A Polar UUID value.")).min(1).describe("Polar organization IDs.")]).describe("Filter by organization ID.").optional(),
259
+ product_id: z.union([z.uuid().describe("A Polar product ID."), z.array(z.uuid().describe("A Polar UUID value.")).min(1).describe("Polar product IDs.")]).describe("Filter by product ID.").optional(),
260
+ customer_id: z.union([z.uuid().describe("A Polar customer ID."), z.array(z.uuid().describe("A Polar UUID value.")).min(1).describe("Polar customer IDs.")]).describe("Filter by customer ID.").optional(),
261
+ external_customer_id: z.union([z.string().min(1).describe("A Polar customer external ID."), z.array(z.string().min(1).describe("A string filter value.")).min(1).describe("Polar customer external IDs.")]).describe("Filter by customer external ID.").optional(),
262
+ discount_id: z.union([z.uuid().describe("A Polar discount ID."), z.array(z.uuid().describe("A Polar UUID value.")).min(1).describe("Polar discount IDs.")]).describe("Filter by discount ID.").optional(),
263
+ active: z.boolean().describe("Filter by active or inactive subscription. This Polar filter is deprecated upstream.").optional(),
264
+ status: z.union([z.enum(["incomplete", "incomplete_expired", "trialing", "active", "past_due", "canceled", "unpaid"]).describe("Polar subscription status."), z.array(z.enum(["incomplete", "incomplete_expired", "trialing", "active", "past_due", "canceled", "unpaid"]).describe("Polar subscription status.")).min(1).describe("Subscription statuses to include.")]).describe("Filter by subscription status.").optional(),
265
+ cancel_at_period_end: z.boolean().describe("Filter by subscriptions set to cancel at period end.").optional(),
266
+ customer_cancellation_reason: z.union([z.enum(["customer_service", "low_quality", "missing_features", "switched_service", "too_complex", "too_expensive", "unused", "other"]).describe("Polar customer cancellation reason."), z.array(z.enum(["customer_service", "low_quality", "missing_features", "switched_service", "too_complex", "too_expensive", "unused", "other"]).describe("Polar customer cancellation reason.")).min(1).describe("Customer cancellation reasons to include.")]).describe("Filter by customer cancellation reason.").optional(),
267
+ canceled_at_after: z.iso.datetime({ offset: true }).describe("Filter by cancellation timestamp after or equal to this value.").optional(),
268
+ canceled_at_before: z.iso.datetime({ offset: true }).describe("Filter by cancellation timestamp before or equal to this value.").optional(),
269
+ page: z.int().min(1).describe("Page number, starting from 1.").optional(),
270
+ limit: z.int().min(1).max(100).describe("Number of items to return per page. Polar supports up to 100.").optional(),
271
+ sorting: z.array(z.enum(["customer", "-customer", "status", "-status", "started_at", "-started_at", "current_period_end", "-current_period_end", "ended_at", "-ended_at", "ends_at", "-ends_at", "amount", "-amount", "product", "-product", "discount", "-discount"]).describe("A Polar subscription sorting field.")).min(1).describe("Polar subscription sorting fields.").optional(),
272
+ metadata: z.record(z.string(), z.union([z.string().describe("A string metadata value."), z.int().describe("An integer metadata value."), z.boolean().describe("A boolean metadata value."), z.array(z.string().describe("A string metadata value.")).min(1).describe("String metadata values."), z.array(z.int().describe("An integer metadata value.")).min(1).describe("Integer metadata values."), z.array(z.boolean().describe("A boolean metadata value.")).min(1).describe("Boolean metadata values.")]).describe("A Polar metadata filter value.")).describe("Metadata filters sent with Polar's deepObject query style.").optional()
273
+ }).describe("Input parameters for listing Polar subscriptions.");
274
+ var listSubscriptionsOutput = z.strictObject({
275
+ items: z.array(z.looseObject({}).describe("subscriptions")).describe("Polar subscriptions returned for the requested page.").optional(),
276
+ pagination: z.strictObject({
277
+ total_count: z.int().min(0).describe("Total number of items matching the request.").optional(),
278
+ max_page: z.int().min(0).describe("Maximum page number available for this request.").optional()
279
+ }).describe("Polar pagination metadata.").optional()
280
+ }).describe("A page of Polar subscriptions.");
281
+ var getSubscriptionInput = z.strictObject({
282
+ id: z.uuid().describe("The Polar resource ID.").optional()
283
+ }).describe("Input parameters for retrieving a Polar subscription.");
284
+ var getSubscriptionOutput = z.strictObject({
285
+ payload: z.looseObject({}).describe("The raw Polar resource payload.").optional()
286
+ }).describe("A Polar subscription response.");
287
+ var polarActions = {
288
+ list_organizations: {
289
+ description: "List Polar organizations accessible to the Organization Access Token.",
290
+ effect: "read",
291
+ inputSchema: listOrganizationsInput,
292
+ outputSchema: z.toJSONSchema(listOrganizationsOutput, { io: "output", unrepresentable: "any" })
293
+ },
294
+ get_organization: {
295
+ description: "Get a Polar organization by ID.",
296
+ effect: "read",
297
+ inputSchema: getOrganizationInput,
298
+ outputSchema: z.toJSONSchema(getOrganizationOutput, { io: "output", unrepresentable: "any" })
299
+ },
300
+ list_products: {
301
+ description: "List Polar products with optional organization, name, visibility, and metadata filters.",
302
+ effect: "read",
303
+ inputSchema: listProductsInput,
304
+ outputSchema: z.toJSONSchema(listProductsOutput, { io: "output", unrepresentable: "any" })
305
+ },
306
+ get_product: {
307
+ description: "Get a Polar product by ID.",
308
+ effect: "read",
309
+ inputSchema: getProductInput,
310
+ outputSchema: z.toJSONSchema(getProductOutput, { io: "output", unrepresentable: "any" })
311
+ },
312
+ list_customers: {
313
+ description: "List Polar customers with optional organization, email, search, activity, and metadata filters.",
314
+ effect: "read",
315
+ inputSchema: listCustomersInput,
316
+ outputSchema: z.toJSONSchema(listCustomersOutput, { io: "output", unrepresentable: "any" })
317
+ },
318
+ get_customer: {
319
+ description: "Get a Polar customer by ID.",
320
+ effect: "read",
321
+ inputSchema: getCustomerInput,
322
+ outputSchema: z.toJSONSchema(getCustomerOutput, { io: "output", unrepresentable: "any" })
323
+ },
324
+ get_customer_by_external_id: {
325
+ description: "Get a Polar customer by external ID.",
326
+ effect: "read",
327
+ inputSchema: getCustomerByExternalIdInput,
328
+ outputSchema: z.toJSONSchema(getCustomerByExternalIdOutput, { io: "output", unrepresentable: "any" })
329
+ },
330
+ get_customer_state: {
331
+ description: "Get a Polar customer state by customer ID, including subscriptions and benefits.",
332
+ effect: "read",
333
+ inputSchema: getCustomerStateInput,
334
+ outputSchema: z.toJSONSchema(getCustomerStateOutput, { io: "output", unrepresentable: "any" })
335
+ },
336
+ get_customer_state_by_external_id: {
337
+ description: "Get a Polar customer state by external customer ID, including subscriptions and benefits.",
338
+ effect: "read",
339
+ inputSchema: getCustomerStateByExternalIdInput,
340
+ outputSchema: z.toJSONSchema(getCustomerStateByExternalIdOutput, { io: "output", unrepresentable: "any" })
341
+ },
342
+ list_orders: {
343
+ description: "List Polar orders with optional organization, product, customer, checkout, subscription, and metadata filters.",
344
+ effect: "read",
345
+ inputSchema: listOrdersInput,
346
+ outputSchema: z.toJSONSchema(listOrdersOutput, { io: "output", unrepresentable: "any" })
347
+ },
348
+ get_order: {
349
+ description: "Get a Polar order by ID.",
350
+ effect: "read",
351
+ inputSchema: getOrderInput,
352
+ outputSchema: z.toJSONSchema(getOrderOutput, { io: "output", unrepresentable: "any" })
353
+ },
354
+ list_subscriptions: {
355
+ description: "List Polar subscriptions with optional organization, product, customer, status, cancellation, and metadata filters.",
356
+ effect: "read",
357
+ inputSchema: listSubscriptionsInput,
358
+ outputSchema: z.toJSONSchema(listSubscriptionsOutput, { io: "output", unrepresentable: "any" })
359
+ },
360
+ get_subscription: {
361
+ description: "Get a Polar subscription by ID.",
362
+ effect: "read",
363
+ inputSchema: getSubscriptionInput,
364
+ outputSchema: z.toJSONSchema(getSubscriptionOutput, { io: "output", unrepresentable: "any" })
365
+ }
366
+ };
367
+
368
+ // ../plugins/src/polar/index.ts
369
+ function createPolarPlugin() {
370
+ return createProviderPlugin({
371
+ description: "Polar",
372
+ actions: polarActions,
373
+ credentialProbe: "list_organizations",
374
+ handlers: {
375
+ list_organizations: listOrganizations,
376
+ get_organization: getOrganization,
377
+ list_products: listProducts,
378
+ get_product: getProduct,
379
+ list_customers: listCustomers,
380
+ get_customer: getCustomer,
381
+ get_customer_by_external_id: getCustomerByExternalId,
382
+ get_customer_state: getCustomerState,
383
+ get_customer_state_by_external_id: getCustomerStateByExternalId,
384
+ list_orders: listOrders,
385
+ get_order: getOrder,
386
+ list_subscriptions: listSubscriptions,
387
+ get_subscription: getSubscription
388
+ }
389
+ });
390
+ }
391
+ var polar_default = createPolarPlugin();
392
+ export {
393
+ createPolarPlugin,
394
+ polar_default as default
395
+ };