@tool-bridge/server 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/airtable-V6446SVY.js +792 -0
- package/dist/alt_text_generator_ai-HV7JZPDT.js +72 -0
- package/dist/amap-TTTVB6WS.js +755 -0
- package/dist/anthropic-JH3RA363.js +224 -0
- package/dist/apify-ETNN7ITU.js +262 -0
- package/dist/brave_search-3DDR2MMB.js +322 -0
- package/dist/chunk-CSJEZHQO.js +252 -0
- package/dist/chunk-JLTYA2B3.js +20121 -0
- package/dist/chunk-K7FVSFUX.js +333 -0
- package/dist/{chunk-MQEYFCJB.js → chunk-KGYJEEBI.js} +2770 -21574
- package/dist/circleci-MX3TX3HC.js +409 -0
- package/dist/clerk-MRPORVF4.js +1036 -0
- package/dist/cloudflare_dns-OWP7DD7L.js +605 -0
- package/dist/cohere-GPECP66S.js +197 -0
- package/dist/confluence-BN7LZ6BC.js +436 -0
- package/dist/convertapi-SBEOFOFQ.js +161 -0
- package/dist/currencyapi-P2YY7Y7P.js +306 -0
- package/dist/deepseek-MWB3NYIN.js +205 -0
- package/dist/docker_hub-3JSCIGQ3.js +946 -0
- package/dist/dropbox-RFIBDAXO.js +1308 -0
- package/dist/dub-YVP57ELQ.js +706 -0
- package/dist/e2b-NFSUHTZR.js +305 -0
- package/dist/exa-KTDY6IV3.js +360 -0
- package/dist/fal_ai-OCUENLNQ.js +405 -0
- package/dist/feishu-5CWBQ7E5.js +225 -0
- package/dist/feishu_custom_bot-ZJR22OK6.js +240 -0
- package/dist/figma-YULGANSA.js +798 -0
- package/dist/firehydrant-2V6YSYAP.js +573 -0
- package/dist/fixer-LTCDB3CJ.js +171 -0
- package/dist/fly-IXPKMAML.js +478 -0
- package/dist/front-KRFB4M5X.js +379 -0
- package/dist/geocodio-VVURKYHQ.js +236 -0
- package/dist/ghost-6J2RIOUB.js +341 -0
- package/dist/github-5Z6KQRYH.js +5410 -0
- package/dist/gmail-KU4NZ7VA.js +1894 -0
- package/dist/googlecalendar-X44DFFXG.js +2539 -0
- package/dist/googledocs-WSGLPKSF.js +1322 -0
- package/dist/grafana-4PKSSDXY.js +817 -0
- package/dist/graphhopper-DF65ZNGK.js +336 -0
- package/dist/index.d.ts +181 -2
- package/dist/index.js +2 -1
- package/dist/ip2proxy-UCAQ5P2J.js +118 -0
- package/dist/ipgeolocation_io-UX6FCA2S.js +333 -0
- package/dist/ipqualityscore-MKTRXIZJ.js +287 -0
- package/dist/jina_ai-MRHPCSV5.js +119 -0
- package/dist/jira-EG7ZPOIW.js +627 -0
- package/dist/langsmith-FNO3RCOZ.js +597 -0
- package/dist/lemlist-SN6BJHSG.js +298 -0
- package/dist/linear-H3VU4PSD.js +2163 -0
- package/dist/logsnag-OY2JJT2H.js +167 -0
- package/dist/main.js +246 -2
- package/dist/mattermost-C5SQ7PGD.js +320 -0
- package/dist/mem0-LMLE5BFC.js +567 -0
- package/dist/memos-UWFAMBZC.js +781 -0
- package/dist/metabase-SRYDSDJ6.js +365 -0
- package/dist/mistral_ai-YNIJ7VDM.js +1195 -0
- package/dist/mother_duck-CPGOFEXE.js +322 -0
- package/dist/ngrok-CDJFBSOM.js +375 -0
- package/dist/notes-DIVFH3P3.js +109 -0
- package/dist/notion-HGDKS4HK.js +945 -0
- package/dist/open_exchange_rates-COHHYJDD.js +216 -0
- package/dist/openai-4TRT66GW.js +795 -0
- package/dist/opengraph_io-YKVW4PXI.js +377 -0
- package/dist/openrouter-6CV7B7V5.js +444 -0
- package/dist/outline-YWDUK5F7.js +604 -0
- package/dist/paddle-MEU7HWDZ.js +464 -0
- package/dist/perplexity-MRQUDBIC.js +238 -0
- package/dist/pinecone-JI7X2TAF.js +599 -0
- package/dist/pipedrive-6JQPAW23.js +453 -0
- package/dist/polar-7BF56CMC.js +400 -0
- package/dist/posthog-YPU5ADEN.js +3462 -0
- package/dist/postmark-BEU5OFKU.js +441 -0
- package/dist/prerender-UT5GOOZH.js +180 -0
- package/dist/pubmed-3SGOE24Q.js +1052 -0
- package/dist/railway-CEK4GLRQ.js +452 -0
- package/dist/readwise-DXQUQU67.js +482 -0
- package/dist/render-7TGAU5AW.js +473 -0
- package/dist/replicate-VICFSQ5A.js +347 -0
- package/dist/resend-3E76WK3O.js +100 -0
- package/dist/rootly-36GY46BY.js +345 -0
- package/dist/scrapfly-VDVUYAHX.js +289 -0
- package/dist/scrapingbee-3KTPMAVY.js +247 -0
- package/dist/screenshot_fyi-LKG62C3J.js +116 -0
- package/dist/semantic_scholar-4WREECYO.js +626 -0
- package/dist/sentry-HUQTGXOV.js +1139 -0
- package/dist/shodan-SGRKU4KS.js +303 -0
- package/dist/shopify-YCZ4L5HT.js +620 -0
- package/dist/stripe-OEBKMELB.js +583 -0
- package/dist/supabase-I3DBY7L4.js +937 -0
- package/dist/tavily-B2YHCNRD.js +349 -0
- package/dist/telegram-2VYJELZX.js +1773 -0
- package/dist/telnyx-HHXD3CXL.js +237 -0
- package/dist/todoist-PHFDEEIS.js +672 -0
- package/dist/trello-WUSAK6YN.js +1091 -0
- package/dist/turso-FW56U2B3.js +432 -0
- package/dist/twilio-M5JI7XHA.js +321 -0
- package/dist/umami-HAYODRC4.js +411 -0
- package/dist/unsplash-EDPTNEHJ.js +364 -0
- package/dist/upstash_redis-GC2CLIWD.js +299 -0
- package/dist/uptimerobot-XMSNYLIT.js +481 -0
- package/dist/v2ex-KU4ECD65.js +672 -0
- package/dist/vercel-THPCEFHW.js +1096 -0
- package/dist/wolfram_alpha_api-WHHTH4GU.js +212 -0
- package/dist/wordpress-O6TQEQNF.js +822 -0
- package/dist/workos-A3VHHWI3.js +681 -0
- package/dist/zhihu-BJAI64YJ.js +273 -0
- package/package.json +5 -4
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createProviderPlugin,
|
|
3
|
+
guardedFetch,
|
|
4
|
+
requireApiKey,
|
|
5
|
+
upstreamError
|
|
6
|
+
} from "./chunk-CSJEZHQO.js";
|
|
7
|
+
import "./chunk-K7FVSFUX.js";
|
|
8
|
+
import {
|
|
9
|
+
TBError,
|
|
10
|
+
external_exports
|
|
11
|
+
} from "./chunk-JLTYA2B3.js";
|
|
12
|
+
import "./chunk-MLKGABMK.js";
|
|
13
|
+
|
|
14
|
+
// ../plugins/src/polar/api.ts
|
|
15
|
+
var SERVICE = "polar";
|
|
16
|
+
var API_BASE = "https://api.polar.sh/v1";
|
|
17
|
+
function text(value) {
|
|
18
|
+
if (typeof value !== "string") return void 0;
|
|
19
|
+
const trimmed = value.trim();
|
|
20
|
+
return trimmed === "" ? void 0 : trimmed;
|
|
21
|
+
}
|
|
22
|
+
function record(value) {
|
|
23
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
24
|
+
}
|
|
25
|
+
function requireRecord(value, label) {
|
|
26
|
+
const result = record(value);
|
|
27
|
+
if (result === void 0) throw new TBError("unavailable", `Polar \u7684${label}\u4E0D\u662F\u5BF9\u8C61`, { retryable: true });
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
30
|
+
function requireId(value, field) {
|
|
31
|
+
const id = text(value);
|
|
32
|
+
if (id === void 0) throw new TBError("invalid_argument", `${field} \u662F\u5FC5\u586B\u7684`);
|
|
33
|
+
return encodeURIComponent(id);
|
|
34
|
+
}
|
|
35
|
+
function appendQueryValue(url, key, value) {
|
|
36
|
+
if (value === void 0 || value === null) return;
|
|
37
|
+
if (Array.isArray(value)) {
|
|
38
|
+
for (const child of value) appendQueryValue(url, key, child);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (typeof value === "boolean") {
|
|
42
|
+
url.searchParams.append(key, value ? "true" : "false");
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (typeof value === "number") {
|
|
46
|
+
url.searchParams.append(key, String(value));
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const stringValue = text(value);
|
|
50
|
+
if (stringValue !== void 0) url.searchParams.append(key, stringValue);
|
|
51
|
+
}
|
|
52
|
+
function listUrl(path, input) {
|
|
53
|
+
const url = new URL(`${API_BASE}${path}`);
|
|
54
|
+
for (const [key, value] of Object.entries(input)) {
|
|
55
|
+
if (key === "metadata") {
|
|
56
|
+
const metadata = record(value);
|
|
57
|
+
if (metadata !== void 0) {
|
|
58
|
+
for (const [name, child] of Object.entries(metadata)) appendQueryValue(url, `metadata[${name}]`, child);
|
|
59
|
+
}
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
appendQueryValue(url, key, value);
|
|
63
|
+
}
|
|
64
|
+
return url.toString();
|
|
65
|
+
}
|
|
66
|
+
function errorDetail(payload) {
|
|
67
|
+
const body = record(payload);
|
|
68
|
+
if (body === void 0) return void 0;
|
|
69
|
+
const detail = body.detail;
|
|
70
|
+
const detailText = text(detail);
|
|
71
|
+
if (detailText !== void 0) return detailText;
|
|
72
|
+
if (Array.isArray(detail)) {
|
|
73
|
+
const message = text(record(detail[0])?.msg);
|
|
74
|
+
if (message !== void 0) return message;
|
|
75
|
+
}
|
|
76
|
+
return text(body.message) ?? text(body.error) ?? text(body.title);
|
|
77
|
+
}
|
|
78
|
+
async function request(ctx, url) {
|
|
79
|
+
const response = await guardedFetch(url, {
|
|
80
|
+
method: "GET",
|
|
81
|
+
headers: {
|
|
82
|
+
accept: "application/json",
|
|
83
|
+
authorization: `Bearer ${requireApiKey(ctx, SERVICE)}`
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
const body = await response.text();
|
|
87
|
+
let payload = null;
|
|
88
|
+
if (body.trim() !== "") {
|
|
89
|
+
try {
|
|
90
|
+
payload = JSON.parse(body);
|
|
91
|
+
} catch {
|
|
92
|
+
if (response.ok) {
|
|
93
|
+
throw new TBError("unavailable", "Polar \u8FD4\u56DE\u4E86\u975E JSON \u54CD\u5E94", { retryable: true });
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (!response.ok) {
|
|
98
|
+
throw upstreamError(response.status, errorDetail(payload) ?? `Polar \u8FD4\u56DE HTTP ${response.status}`);
|
|
99
|
+
}
|
|
100
|
+
return payload;
|
|
101
|
+
}
|
|
102
|
+
async function listResources(path, input, ctx) {
|
|
103
|
+
return requireRecord(await request(ctx, listUrl(path, input)), "\u5217\u8868\u54CD\u5E94");
|
|
104
|
+
}
|
|
105
|
+
async function getResource(path, ctx) {
|
|
106
|
+
return { payload: requireRecord(await request(ctx, `${API_BASE}${path}`), "\u8D44\u6E90\u54CD\u5E94") };
|
|
107
|
+
}
|
|
108
|
+
function listOrganizations(input, ctx) {
|
|
109
|
+
return listResources("/organizations/", input, ctx);
|
|
110
|
+
}
|
|
111
|
+
function getOrganization(input, ctx) {
|
|
112
|
+
return getResource(`/organizations/${requireId(input.id, "id")}`, ctx);
|
|
113
|
+
}
|
|
114
|
+
function listProducts(input, ctx) {
|
|
115
|
+
return listResources("/products/", input, ctx);
|
|
116
|
+
}
|
|
117
|
+
function getProduct(input, ctx) {
|
|
118
|
+
return getResource(`/products/${requireId(input.id, "id")}`, ctx);
|
|
119
|
+
}
|
|
120
|
+
function listCustomers(input, ctx) {
|
|
121
|
+
return listResources("/customers/", input, ctx);
|
|
122
|
+
}
|
|
123
|
+
function getCustomer(input, ctx) {
|
|
124
|
+
return getResource(`/customers/${requireId(input.id, "id")}`, ctx);
|
|
125
|
+
}
|
|
126
|
+
function getCustomerByExternalId(input, ctx) {
|
|
127
|
+
return getResource(`/customers/external/${requireId(input.external_id, "external_id")}`, ctx);
|
|
128
|
+
}
|
|
129
|
+
function getCustomerState(input, ctx) {
|
|
130
|
+
return getResource(`/customers/${requireId(input.id, "id")}/state`, ctx);
|
|
131
|
+
}
|
|
132
|
+
function getCustomerStateByExternalId(input, ctx) {
|
|
133
|
+
return getResource(`/customers/external/${requireId(input.external_id, "external_id")}/state`, ctx);
|
|
134
|
+
}
|
|
135
|
+
function listOrders(input, ctx) {
|
|
136
|
+
return listResources("/orders/", input, ctx);
|
|
137
|
+
}
|
|
138
|
+
function getOrder(input, ctx) {
|
|
139
|
+
return getResource(`/orders/${requireId(input.id, "id")}`, ctx);
|
|
140
|
+
}
|
|
141
|
+
function listSubscriptions(input, ctx) {
|
|
142
|
+
return listResources("/subscriptions/", input, ctx);
|
|
143
|
+
}
|
|
144
|
+
function getSubscription(input, ctx) {
|
|
145
|
+
return getResource(`/subscriptions/${requireId(input.id, "id")}`, ctx);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// ../plugins/src/polar/schema.ts
|
|
149
|
+
var listOrganizationsInput = external_exports.strictObject({
|
|
150
|
+
slug: external_exports.string().min(1).describe("Filter organizations by slug.").optional(),
|
|
151
|
+
page: external_exports.int().min(1).describe("Page number, starting from 1.").optional(),
|
|
152
|
+
limit: external_exports.int().min(1).max(100).describe("Number of items to return per page. Polar supports up to 100.").optional(),
|
|
153
|
+
sorting: external_exports.array(external_exports.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()
|
|
154
|
+
}).describe("Input parameters for listing Polar organizations.");
|
|
155
|
+
var listOrganizationsOutput = external_exports.strictObject({
|
|
156
|
+
items: external_exports.array(external_exports.looseObject({}).describe("organizations")).describe("Polar organizations returned for the requested page.").optional(),
|
|
157
|
+
pagination: external_exports.strictObject({
|
|
158
|
+
total_count: external_exports.int().min(0).describe("Total number of items matching the request.").optional(),
|
|
159
|
+
max_page: external_exports.int().min(0).describe("Maximum page number available for this request.").optional()
|
|
160
|
+
}).describe("Polar pagination metadata.").optional()
|
|
161
|
+
}).describe("A page of Polar organizations.");
|
|
162
|
+
var getOrganizationInput = external_exports.strictObject({
|
|
163
|
+
id: external_exports.uuid().describe("The Polar resource ID.").optional()
|
|
164
|
+
}).describe("Input parameters for retrieving a Polar organization.");
|
|
165
|
+
var getOrganizationOutput = external_exports.strictObject({
|
|
166
|
+
payload: external_exports.looseObject({}).describe("The raw Polar resource payload.").optional()
|
|
167
|
+
}).describe("A Polar organization response.");
|
|
168
|
+
var listProductsInput = external_exports.strictObject({
|
|
169
|
+
id: external_exports.union([external_exports.uuid().describe("A Polar product ID."), external_exports.array(external_exports.uuid().describe("A Polar UUID value.")).min(1).describe("Polar product IDs.")]).describe("Filter by product ID.").optional(),
|
|
170
|
+
organization_id: external_exports.union([external_exports.uuid().describe("A Polar organization ID."), external_exports.array(external_exports.uuid().describe("A Polar UUID value.")).min(1).describe("Polar organization IDs.")]).describe("Filter by organization ID.").optional(),
|
|
171
|
+
query: external_exports.string().min(1).describe("Filter by product name.").optional(),
|
|
172
|
+
is_archived: external_exports.boolean().describe("Filter by archived products.").optional(),
|
|
173
|
+
is_recurring: external_exports.boolean().describe("Filter by recurring products.").optional(),
|
|
174
|
+
benefit_id: external_exports.union([external_exports.uuid().describe("A Polar benefit ID."), external_exports.array(external_exports.uuid().describe("A Polar UUID value.")).min(1).describe("Polar benefit IDs.")]).describe("Filter products granting a benefit.").optional(),
|
|
175
|
+
visibility: external_exports.array(external_exports.enum(["draft", "private", "public"]).describe("Polar product visibility.")).min(1).describe("Product visibility values to include.").optional(),
|
|
176
|
+
page: external_exports.int().min(1).describe("Page number, starting from 1.").optional(),
|
|
177
|
+
limit: external_exports.int().min(1).max(100).describe("Number of items to return per page. Polar supports up to 100.").optional(),
|
|
178
|
+
sorting: external_exports.array(external_exports.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(),
|
|
179
|
+
metadata: external_exports.record(external_exports.string(), external_exports.union([external_exports.string().describe("A string metadata value."), external_exports.int().describe("An integer metadata value."), external_exports.boolean().describe("A boolean metadata value."), external_exports.array(external_exports.string().describe("A string metadata value.")).min(1).describe("String metadata values."), external_exports.array(external_exports.int().describe("An integer metadata value.")).min(1).describe("Integer metadata values."), external_exports.array(external_exports.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()
|
|
180
|
+
}).describe("Input parameters for listing Polar products.");
|
|
181
|
+
var listProductsOutput = external_exports.strictObject({
|
|
182
|
+
items: external_exports.array(external_exports.looseObject({}).describe("products")).describe("Polar products returned for the requested page.").optional(),
|
|
183
|
+
pagination: external_exports.strictObject({
|
|
184
|
+
total_count: external_exports.int().min(0).describe("Total number of items matching the request.").optional(),
|
|
185
|
+
max_page: external_exports.int().min(0).describe("Maximum page number available for this request.").optional()
|
|
186
|
+
}).describe("Polar pagination metadata.").optional()
|
|
187
|
+
}).describe("A page of Polar products.");
|
|
188
|
+
var getProductInput = external_exports.strictObject({
|
|
189
|
+
id: external_exports.uuid().describe("The Polar resource ID.").optional()
|
|
190
|
+
}).describe("Input parameters for retrieving a Polar product.");
|
|
191
|
+
var getProductOutput = external_exports.strictObject({
|
|
192
|
+
payload: external_exports.looseObject({}).describe("The raw Polar resource payload.").optional()
|
|
193
|
+
}).describe("A Polar product response.");
|
|
194
|
+
var listCustomersInput = external_exports.strictObject({
|
|
195
|
+
organization_id: external_exports.union([external_exports.uuid().describe("A Polar organization ID."), external_exports.array(external_exports.uuid().describe("A Polar UUID value.")).min(1).describe("Polar organization IDs.")]).describe("Filter by organization ID.").optional(),
|
|
196
|
+
email: external_exports.email().describe("Filter by exact customer email.").optional(),
|
|
197
|
+
query: external_exports.string().min(1).describe("Filter by customer name, email, or external ID.").optional(),
|
|
198
|
+
active: external_exports.boolean().describe("Filter by active customers.").optional(),
|
|
199
|
+
page: external_exports.int().min(1).describe("Page number, starting from 1.").optional(),
|
|
200
|
+
limit: external_exports.int().min(1).max(100).describe("Number of items to return per page. Polar supports up to 100.").optional(),
|
|
201
|
+
sorting: external_exports.array(external_exports.enum(["created_at", "-created_at", "email", "-email", "name", "-name"]).describe("A Polar customer sorting field.")).min(1).describe("Polar customer sorting fields.").optional(),
|
|
202
|
+
metadata: external_exports.record(external_exports.string(), external_exports.union([external_exports.string().describe("A string metadata value."), external_exports.int().describe("An integer metadata value."), external_exports.boolean().describe("A boolean metadata value."), external_exports.array(external_exports.string().describe("A string metadata value.")).min(1).describe("String metadata values."), external_exports.array(external_exports.int().describe("An integer metadata value.")).min(1).describe("Integer metadata values."), external_exports.array(external_exports.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()
|
|
203
|
+
}).describe("Input parameters for listing Polar customers.");
|
|
204
|
+
var listCustomersOutput = external_exports.strictObject({
|
|
205
|
+
items: external_exports.array(external_exports.looseObject({}).describe("customers")).describe("Polar customers returned for the requested page.").optional(),
|
|
206
|
+
pagination: external_exports.strictObject({
|
|
207
|
+
total_count: external_exports.int().min(0).describe("Total number of items matching the request.").optional(),
|
|
208
|
+
max_page: external_exports.int().min(0).describe("Maximum page number available for this request.").optional()
|
|
209
|
+
}).describe("Polar pagination metadata.").optional()
|
|
210
|
+
}).describe("A page of Polar customers.");
|
|
211
|
+
var getCustomerInput = external_exports.strictObject({
|
|
212
|
+
id: external_exports.uuid().describe("The Polar resource ID.").optional()
|
|
213
|
+
}).describe("Input parameters for retrieving a Polar customer.");
|
|
214
|
+
var getCustomerOutput = external_exports.strictObject({
|
|
215
|
+
payload: external_exports.looseObject({}).describe("The raw Polar resource payload.").optional()
|
|
216
|
+
}).describe("A Polar customer response.");
|
|
217
|
+
var getCustomerByExternalIdInput = external_exports.strictObject({
|
|
218
|
+
external_id: external_exports.string().min(1).describe("The Polar customer external ID.").optional()
|
|
219
|
+
}).describe("Input parameters for retrieving a Polar customer by external ID.");
|
|
220
|
+
var getCustomerByExternalIdOutput = external_exports.strictObject({
|
|
221
|
+
payload: external_exports.looseObject({}).describe("The raw Polar resource payload.").optional()
|
|
222
|
+
}).describe("A Polar customer response.");
|
|
223
|
+
var getCustomerStateInput = external_exports.strictObject({
|
|
224
|
+
id: external_exports.uuid().describe("The Polar resource ID.").optional()
|
|
225
|
+
}).describe("Input parameters for retrieving a Polar customer state.");
|
|
226
|
+
var getCustomerStateOutput = external_exports.strictObject({
|
|
227
|
+
payload: external_exports.looseObject({}).describe("The raw Polar resource payload.").optional()
|
|
228
|
+
}).describe("A Polar customer state response.");
|
|
229
|
+
var getCustomerStateByExternalIdInput = external_exports.strictObject({
|
|
230
|
+
external_id: external_exports.string().min(1).describe("The Polar customer external ID.").optional()
|
|
231
|
+
}).describe("Input parameters for retrieving a Polar customer state by external ID.");
|
|
232
|
+
var getCustomerStateByExternalIdOutput = external_exports.strictObject({
|
|
233
|
+
payload: external_exports.looseObject({}).describe("The raw Polar resource payload.").optional()
|
|
234
|
+
}).describe("A Polar customer state response.");
|
|
235
|
+
var listOrdersInput = external_exports.strictObject({
|
|
236
|
+
organization_id: external_exports.union([external_exports.uuid().describe("A Polar organization ID."), external_exports.array(external_exports.uuid().describe("A Polar UUID value.")).min(1).describe("Polar organization IDs.")]).describe("Filter by organization ID.").optional(),
|
|
237
|
+
product_id: external_exports.union([external_exports.uuid().describe("A Polar product ID."), external_exports.array(external_exports.uuid().describe("A Polar UUID value.")).min(1).describe("Polar product IDs.")]).describe("Filter by product ID.").optional(),
|
|
238
|
+
product_billing_type: external_exports.union([external_exports.enum(["one_time", "recurring"]).describe("Polar product billing type."), external_exports.array(external_exports.enum(["one_time", "recurring"]).describe("Polar product billing type.")).min(1).describe("Product billing types to include.")]).describe("Filter by product billing type.").optional(),
|
|
239
|
+
discount_id: external_exports.union([external_exports.uuid().describe("A Polar discount ID."), external_exports.array(external_exports.uuid().describe("A Polar UUID value.")).min(1).describe("Polar discount IDs.")]).describe("Filter by discount ID.").optional(),
|
|
240
|
+
customer_id: external_exports.union([external_exports.uuid().describe("A Polar customer ID."), external_exports.array(external_exports.uuid().describe("A Polar UUID value.")).min(1).describe("Polar customer IDs.")]).describe("Filter by customer ID.").optional(),
|
|
241
|
+
external_customer_id: external_exports.union([external_exports.string().min(1).describe("A Polar customer external ID."), external_exports.array(external_exports.string().min(1).describe("A string filter value.")).min(1).describe("Polar customer external IDs.")]).describe("Filter by customer external ID.").optional(),
|
|
242
|
+
checkout_id: external_exports.union([external_exports.uuid().describe("A Polar checkout ID."), external_exports.array(external_exports.uuid().describe("A Polar UUID value.")).min(1).describe("Polar checkout IDs.")]).describe("Filter by checkout ID.").optional(),
|
|
243
|
+
subscription_id: external_exports.union([external_exports.uuid().describe("A Polar subscription ID."), external_exports.array(external_exports.uuid().describe("A Polar UUID value.")).min(1).describe("Polar subscription IDs.")]).describe("Filter by subscription ID.").optional(),
|
|
244
|
+
page: external_exports.int().min(1).describe("Page number, starting from 1.").optional(),
|
|
245
|
+
limit: external_exports.int().min(1).max(100).describe("Number of items to return per page. Polar supports up to 100.").optional(),
|
|
246
|
+
sorting: external_exports.array(external_exports.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(),
|
|
247
|
+
metadata: external_exports.record(external_exports.string(), external_exports.union([external_exports.string().describe("A string metadata value."), external_exports.int().describe("An integer metadata value."), external_exports.boolean().describe("A boolean metadata value."), external_exports.array(external_exports.string().describe("A string metadata value.")).min(1).describe("String metadata values."), external_exports.array(external_exports.int().describe("An integer metadata value.")).min(1).describe("Integer metadata values."), external_exports.array(external_exports.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()
|
|
248
|
+
}).describe("Input parameters for listing Polar orders.");
|
|
249
|
+
var listOrdersOutput = external_exports.strictObject({
|
|
250
|
+
items: external_exports.array(external_exports.looseObject({}).describe("orders")).describe("Polar orders returned for the requested page.").optional(),
|
|
251
|
+
pagination: external_exports.strictObject({
|
|
252
|
+
total_count: external_exports.int().min(0).describe("Total number of items matching the request.").optional(),
|
|
253
|
+
max_page: external_exports.int().min(0).describe("Maximum page number available for this request.").optional()
|
|
254
|
+
}).describe("Polar pagination metadata.").optional()
|
|
255
|
+
}).describe("A page of Polar orders.");
|
|
256
|
+
var getOrderInput = external_exports.strictObject({
|
|
257
|
+
id: external_exports.uuid().describe("The Polar resource ID.").optional()
|
|
258
|
+
}).describe("Input parameters for retrieving a Polar order.");
|
|
259
|
+
var getOrderOutput = external_exports.strictObject({
|
|
260
|
+
payload: external_exports.looseObject({}).describe("The raw Polar resource payload.").optional()
|
|
261
|
+
}).describe("A Polar order response.");
|
|
262
|
+
var listSubscriptionsInput = external_exports.strictObject({
|
|
263
|
+
organization_id: external_exports.union([external_exports.uuid().describe("A Polar organization ID."), external_exports.array(external_exports.uuid().describe("A Polar UUID value.")).min(1).describe("Polar organization IDs.")]).describe("Filter by organization ID.").optional(),
|
|
264
|
+
product_id: external_exports.union([external_exports.uuid().describe("A Polar product ID."), external_exports.array(external_exports.uuid().describe("A Polar UUID value.")).min(1).describe("Polar product IDs.")]).describe("Filter by product ID.").optional(),
|
|
265
|
+
customer_id: external_exports.union([external_exports.uuid().describe("A Polar customer ID."), external_exports.array(external_exports.uuid().describe("A Polar UUID value.")).min(1).describe("Polar customer IDs.")]).describe("Filter by customer ID.").optional(),
|
|
266
|
+
external_customer_id: external_exports.union([external_exports.string().min(1).describe("A Polar customer external ID."), external_exports.array(external_exports.string().min(1).describe("A string filter value.")).min(1).describe("Polar customer external IDs.")]).describe("Filter by customer external ID.").optional(),
|
|
267
|
+
discount_id: external_exports.union([external_exports.uuid().describe("A Polar discount ID."), external_exports.array(external_exports.uuid().describe("A Polar UUID value.")).min(1).describe("Polar discount IDs.")]).describe("Filter by discount ID.").optional(),
|
|
268
|
+
active: external_exports.boolean().describe("Filter by active or inactive subscription. This Polar filter is deprecated upstream.").optional(),
|
|
269
|
+
status: external_exports.union([external_exports.enum(["incomplete", "incomplete_expired", "trialing", "active", "past_due", "canceled", "unpaid"]).describe("Polar subscription status."), external_exports.array(external_exports.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(),
|
|
270
|
+
cancel_at_period_end: external_exports.boolean().describe("Filter by subscriptions set to cancel at period end.").optional(),
|
|
271
|
+
customer_cancellation_reason: external_exports.union([external_exports.enum(["customer_service", "low_quality", "missing_features", "switched_service", "too_complex", "too_expensive", "unused", "other"]).describe("Polar customer cancellation reason."), external_exports.array(external_exports.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(),
|
|
272
|
+
canceled_at_after: external_exports.iso.datetime({ offset: true }).describe("Filter by cancellation timestamp after or equal to this value.").optional(),
|
|
273
|
+
canceled_at_before: external_exports.iso.datetime({ offset: true }).describe("Filter by cancellation timestamp before or equal to this value.").optional(),
|
|
274
|
+
page: external_exports.int().min(1).describe("Page number, starting from 1.").optional(),
|
|
275
|
+
limit: external_exports.int().min(1).max(100).describe("Number of items to return per page. Polar supports up to 100.").optional(),
|
|
276
|
+
sorting: external_exports.array(external_exports.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(),
|
|
277
|
+
metadata: external_exports.record(external_exports.string(), external_exports.union([external_exports.string().describe("A string metadata value."), external_exports.int().describe("An integer metadata value."), external_exports.boolean().describe("A boolean metadata value."), external_exports.array(external_exports.string().describe("A string metadata value.")).min(1).describe("String metadata values."), external_exports.array(external_exports.int().describe("An integer metadata value.")).min(1).describe("Integer metadata values."), external_exports.array(external_exports.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()
|
|
278
|
+
}).describe("Input parameters for listing Polar subscriptions.");
|
|
279
|
+
var listSubscriptionsOutput = external_exports.strictObject({
|
|
280
|
+
items: external_exports.array(external_exports.looseObject({}).describe("subscriptions")).describe("Polar subscriptions returned for the requested page.").optional(),
|
|
281
|
+
pagination: external_exports.strictObject({
|
|
282
|
+
total_count: external_exports.int().min(0).describe("Total number of items matching the request.").optional(),
|
|
283
|
+
max_page: external_exports.int().min(0).describe("Maximum page number available for this request.").optional()
|
|
284
|
+
}).describe("Polar pagination metadata.").optional()
|
|
285
|
+
}).describe("A page of Polar subscriptions.");
|
|
286
|
+
var getSubscriptionInput = external_exports.strictObject({
|
|
287
|
+
id: external_exports.uuid().describe("The Polar resource ID.").optional()
|
|
288
|
+
}).describe("Input parameters for retrieving a Polar subscription.");
|
|
289
|
+
var getSubscriptionOutput = external_exports.strictObject({
|
|
290
|
+
payload: external_exports.looseObject({}).describe("The raw Polar resource payload.").optional()
|
|
291
|
+
}).describe("A Polar subscription response.");
|
|
292
|
+
var polarActions = {
|
|
293
|
+
list_organizations: {
|
|
294
|
+
description: "List Polar organizations accessible to the Organization Access Token.",
|
|
295
|
+
effect: "read",
|
|
296
|
+
inputSchema: listOrganizationsInput,
|
|
297
|
+
outputSchema: external_exports.toJSONSchema(listOrganizationsOutput, { io: "output", unrepresentable: "any" })
|
|
298
|
+
},
|
|
299
|
+
get_organization: {
|
|
300
|
+
description: "Get a Polar organization by ID.",
|
|
301
|
+
effect: "read",
|
|
302
|
+
inputSchema: getOrganizationInput,
|
|
303
|
+
outputSchema: external_exports.toJSONSchema(getOrganizationOutput, { io: "output", unrepresentable: "any" })
|
|
304
|
+
},
|
|
305
|
+
list_products: {
|
|
306
|
+
description: "List Polar products with optional organization, name, visibility, and metadata filters.",
|
|
307
|
+
effect: "read",
|
|
308
|
+
inputSchema: listProductsInput,
|
|
309
|
+
outputSchema: external_exports.toJSONSchema(listProductsOutput, { io: "output", unrepresentable: "any" })
|
|
310
|
+
},
|
|
311
|
+
get_product: {
|
|
312
|
+
description: "Get a Polar product by ID.",
|
|
313
|
+
effect: "read",
|
|
314
|
+
inputSchema: getProductInput,
|
|
315
|
+
outputSchema: external_exports.toJSONSchema(getProductOutput, { io: "output", unrepresentable: "any" })
|
|
316
|
+
},
|
|
317
|
+
list_customers: {
|
|
318
|
+
description: "List Polar customers with optional organization, email, search, activity, and metadata filters.",
|
|
319
|
+
effect: "read",
|
|
320
|
+
inputSchema: listCustomersInput,
|
|
321
|
+
outputSchema: external_exports.toJSONSchema(listCustomersOutput, { io: "output", unrepresentable: "any" })
|
|
322
|
+
},
|
|
323
|
+
get_customer: {
|
|
324
|
+
description: "Get a Polar customer by ID.",
|
|
325
|
+
effect: "read",
|
|
326
|
+
inputSchema: getCustomerInput,
|
|
327
|
+
outputSchema: external_exports.toJSONSchema(getCustomerOutput, { io: "output", unrepresentable: "any" })
|
|
328
|
+
},
|
|
329
|
+
get_customer_by_external_id: {
|
|
330
|
+
description: "Get a Polar customer by external ID.",
|
|
331
|
+
effect: "read",
|
|
332
|
+
inputSchema: getCustomerByExternalIdInput,
|
|
333
|
+
outputSchema: external_exports.toJSONSchema(getCustomerByExternalIdOutput, { io: "output", unrepresentable: "any" })
|
|
334
|
+
},
|
|
335
|
+
get_customer_state: {
|
|
336
|
+
description: "Get a Polar customer state by customer ID, including subscriptions and benefits.",
|
|
337
|
+
effect: "read",
|
|
338
|
+
inputSchema: getCustomerStateInput,
|
|
339
|
+
outputSchema: external_exports.toJSONSchema(getCustomerStateOutput, { io: "output", unrepresentable: "any" })
|
|
340
|
+
},
|
|
341
|
+
get_customer_state_by_external_id: {
|
|
342
|
+
description: "Get a Polar customer state by external customer ID, including subscriptions and benefits.",
|
|
343
|
+
effect: "read",
|
|
344
|
+
inputSchema: getCustomerStateByExternalIdInput,
|
|
345
|
+
outputSchema: external_exports.toJSONSchema(getCustomerStateByExternalIdOutput, { io: "output", unrepresentable: "any" })
|
|
346
|
+
},
|
|
347
|
+
list_orders: {
|
|
348
|
+
description: "List Polar orders with optional organization, product, customer, checkout, subscription, and metadata filters.",
|
|
349
|
+
effect: "read",
|
|
350
|
+
inputSchema: listOrdersInput,
|
|
351
|
+
outputSchema: external_exports.toJSONSchema(listOrdersOutput, { io: "output", unrepresentable: "any" })
|
|
352
|
+
},
|
|
353
|
+
get_order: {
|
|
354
|
+
description: "Get a Polar order by ID.",
|
|
355
|
+
effect: "read",
|
|
356
|
+
inputSchema: getOrderInput,
|
|
357
|
+
outputSchema: external_exports.toJSONSchema(getOrderOutput, { io: "output", unrepresentable: "any" })
|
|
358
|
+
},
|
|
359
|
+
list_subscriptions: {
|
|
360
|
+
description: "List Polar subscriptions with optional organization, product, customer, status, cancellation, and metadata filters.",
|
|
361
|
+
effect: "read",
|
|
362
|
+
inputSchema: listSubscriptionsInput,
|
|
363
|
+
outputSchema: external_exports.toJSONSchema(listSubscriptionsOutput, { io: "output", unrepresentable: "any" })
|
|
364
|
+
},
|
|
365
|
+
get_subscription: {
|
|
366
|
+
description: "Get a Polar subscription by ID.",
|
|
367
|
+
effect: "read",
|
|
368
|
+
inputSchema: getSubscriptionInput,
|
|
369
|
+
outputSchema: external_exports.toJSONSchema(getSubscriptionOutput, { io: "output", unrepresentable: "any" })
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
// ../plugins/src/polar/index.ts
|
|
374
|
+
function createPolarPlugin() {
|
|
375
|
+
return createProviderPlugin({
|
|
376
|
+
description: "Polar",
|
|
377
|
+
actions: polarActions,
|
|
378
|
+
credentialProbe: "list_organizations",
|
|
379
|
+
handlers: {
|
|
380
|
+
list_organizations: listOrganizations,
|
|
381
|
+
get_organization: getOrganization,
|
|
382
|
+
list_products: listProducts,
|
|
383
|
+
get_product: getProduct,
|
|
384
|
+
list_customers: listCustomers,
|
|
385
|
+
get_customer: getCustomer,
|
|
386
|
+
get_customer_by_external_id: getCustomerByExternalId,
|
|
387
|
+
get_customer_state: getCustomerState,
|
|
388
|
+
get_customer_state_by_external_id: getCustomerStateByExternalId,
|
|
389
|
+
list_orders: listOrders,
|
|
390
|
+
get_order: getOrder,
|
|
391
|
+
list_subscriptions: listSubscriptions,
|
|
392
|
+
get_subscription: getSubscription
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
var polar_default = createPolarPlugin();
|
|
397
|
+
export {
|
|
398
|
+
createPolarPlugin,
|
|
399
|
+
polar_default as default
|
|
400
|
+
};
|