recurly-mcp 0.1.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/CHANGELOG.md +61 -0
- package/LICENSE +21 -0
- package/README.md +179 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +19 -0
- package/dist/bin.js.map +1 -0
- package/dist/client/errors.d.ts +16 -0
- package/dist/client/errors.js +44 -0
- package/dist/client/errors.js.map +1 -0
- package/dist/client/pagination.d.ts +8 -0
- package/dist/client/pagination.js +33 -0
- package/dist/client/pagination.js.map +1 -0
- package/dist/client/recurly.d.ts +19 -0
- package/dist/client/recurly.js +277 -0
- package/dist/client/recurly.js.map +1 -0
- package/dist/config.d.ts +9 -0
- package/dist/config.js +99 -0
- package/dist/config.js.map +1 -0
- package/dist/responseGuard.d.ts +1 -0
- package/dist/responseGuard.js +124 -0
- package/dist/responseGuard.js.map +1 -0
- package/dist/server.d.ts +7 -0
- package/dist/server.js +119 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/accounts.d.ts +217 -0
- package/dist/tools/accounts.js +71 -0
- package/dist/tools/accounts.js.map +1 -0
- package/dist/tools/addOns.d.ts +46 -0
- package/dist/tools/addOns.js +24 -0
- package/dist/tools/addOns.js.map +1 -0
- package/dist/tools/billingInfo.d.ts +57 -0
- package/dist/tools/billingInfo.js +31 -0
- package/dist/tools/billingInfo.js.map +1 -0
- package/dist/tools/businessEntities.d.ts +80 -0
- package/dist/tools/businessEntities.js +32 -0
- package/dist/tools/businessEntities.js.map +1 -0
- package/dist/tools/couponRedemptions.d.ts +135 -0
- package/dist/tools/couponRedemptions.js +57 -0
- package/dist/tools/couponRedemptions.js.map +1 -0
- package/dist/tools/coupons.d.ts +86 -0
- package/dist/tools/coupons.js +37 -0
- package/dist/tools/coupons.js.map +1 -0
- package/dist/tools/creditPayments.d.ts +73 -0
- package/dist/tools/creditPayments.js +28 -0
- package/dist/tools/creditPayments.js.map +1 -0
- package/dist/tools/customFieldDefinitions.d.ts +46 -0
- package/dist/tools/customFieldDefinitions.js +32 -0
- package/dist/tools/customFieldDefinitions.js.map +1 -0
- package/dist/tools/dunningCampaigns.d.ts +42 -0
- package/dist/tools/dunningCampaigns.js +21 -0
- package/dist/tools/dunningCampaigns.js.map +1 -0
- package/dist/tools/exports.d.ts +20 -0
- package/dist/tools/exports.js +21 -0
- package/dist/tools/exports.js.map +1 -0
- package/dist/tools/externalAccounts.d.ts +48 -0
- package/dist/tools/externalAccounts.js +28 -0
- package/dist/tools/externalAccounts.js.map +1 -0
- package/dist/tools/externalInvoices.d.ts +73 -0
- package/dist/tools/externalInvoices.js +28 -0
- package/dist/tools/externalInvoices.js.map +1 -0
- package/dist/tools/externalProducts.d.ts +85 -0
- package/dist/tools/externalProducts.js +34 -0
- package/dist/tools/externalProducts.js.map +1 -0
- package/dist/tools/externalSubscriptions.d.ts +147 -0
- package/dist/tools/externalSubscriptions.js +47 -0
- package/dist/tools/externalSubscriptions.js.map +1 -0
- package/dist/tools/generalLedgerAccounts.d.ts +46 -0
- package/dist/tools/generalLedgerAccounts.js +32 -0
- package/dist/tools/generalLedgerAccounts.js.map +1 -0
- package/dist/tools/giftCards.d.ts +42 -0
- package/dist/tools/giftCards.js +21 -0
- package/dist/tools/giftCards.js.map +1 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.js +68 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/invoiceTemplates.d.ts +83 -0
- package/dist/tools/invoiceTemplates.js +39 -0
- package/dist/tools/invoiceTemplates.js.map +1 -0
- package/dist/tools/invoices.d.ts +168 -0
- package/dist/tools/invoices.js +58 -0
- package/dist/tools/invoices.js.map +1 -0
- package/dist/tools/items.d.ts +46 -0
- package/dist/tools/items.js +24 -0
- package/dist/tools/items.js.map +1 -0
- package/dist/tools/lineItems.d.ts +93 -0
- package/dist/tools/lineItems.js +37 -0
- package/dist/tools/lineItems.js.map +1 -0
- package/dist/tools/measuredUnits.d.ts +46 -0
- package/dist/tools/measuredUnits.js +24 -0
- package/dist/tools/measuredUnits.js.map +1 -0
- package/dist/tools/performanceObligations.d.ts +42 -0
- package/dist/tools/performanceObligations.js +24 -0
- package/dist/tools/performanceObligations.js.map +1 -0
- package/dist/tools/plans.d.ts +93 -0
- package/dist/tools/plans.js +34 -0
- package/dist/tools/plans.js.map +1 -0
- package/dist/tools/priceSegments.d.ts +42 -0
- package/dist/tools/priceSegments.js +21 -0
- package/dist/tools/priceSegments.js.map +1 -0
- package/dist/tools/request.d.ts +17 -0
- package/dist/tools/request.js +55 -0
- package/dist/tools/request.js.map +1 -0
- package/dist/tools/shared.d.ts +32 -0
- package/dist/tools/shared.js +73 -0
- package/dist/tools/shared.js.map +1 -0
- package/dist/tools/shippingAddresses.d.ts +48 -0
- package/dist/tools/shippingAddresses.js +28 -0
- package/dist/tools/shippingAddresses.js.map +1 -0
- package/dist/tools/shippingMethods.d.ts +42 -0
- package/dist/tools/shippingMethods.js +21 -0
- package/dist/tools/shippingMethods.js.map +1 -0
- package/dist/tools/sites.d.ts +46 -0
- package/dist/tools/sites.js +24 -0
- package/dist/tools/sites.js.map +1 -0
- package/dist/tools/subscriptions.d.ts +178 -0
- package/dist/tools/subscriptions.js +68 -0
- package/dist/tools/subscriptions.js.map +1 -0
- package/dist/tools/transactions.d.ts +87 -0
- package/dist/tools/transactions.js +36 -0
- package/dist/tools/transactions.js.map +1 -0
- package/dist/tools/types.d.ts +13 -0
- package/dist/tools/types.js +2 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/usage.d.ts +52 -0
- package/dist/tools/usage.js +33 -0
- package/dist/tools/usage.js.map +1 -0
- package/package.json +77 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ToolDefinition } from './types.js';
|
|
3
|
+
declare const inputSchema: z.ZodDiscriminatedUnion<"action", [z.ZodObject<{
|
|
4
|
+
action: z.ZodLiteral<"list">;
|
|
5
|
+
} & {
|
|
6
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
order: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
|
|
8
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
9
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
10
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
11
|
+
begin_time: z.ZodOptional<z.ZodString>;
|
|
12
|
+
end_time: z.ZodOptional<z.ZodString>;
|
|
13
|
+
} & {
|
|
14
|
+
account_type: z.ZodOptional<z.ZodString>;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
action: "list";
|
|
17
|
+
cursor?: string | undefined;
|
|
18
|
+
limit?: number | undefined;
|
|
19
|
+
order?: "asc" | "desc" | undefined;
|
|
20
|
+
sort?: string | undefined;
|
|
21
|
+
ids?: string[] | undefined;
|
|
22
|
+
begin_time?: string | undefined;
|
|
23
|
+
end_time?: string | undefined;
|
|
24
|
+
account_type?: string | undefined;
|
|
25
|
+
}, {
|
|
26
|
+
action: "list";
|
|
27
|
+
cursor?: string | undefined;
|
|
28
|
+
limit?: number | undefined;
|
|
29
|
+
order?: "asc" | "desc" | undefined;
|
|
30
|
+
sort?: string | undefined;
|
|
31
|
+
ids?: string[] | undefined;
|
|
32
|
+
begin_time?: string | undefined;
|
|
33
|
+
end_time?: string | undefined;
|
|
34
|
+
account_type?: string | undefined;
|
|
35
|
+
}>, z.ZodObject<{
|
|
36
|
+
action: z.ZodLiteral<"get">;
|
|
37
|
+
general_ledger_account_id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
action: "get";
|
|
40
|
+
general_ledger_account_id: string;
|
|
41
|
+
}, {
|
|
42
|
+
action: "get";
|
|
43
|
+
general_ledger_account_id: string;
|
|
44
|
+
}>]>;
|
|
45
|
+
export declare const generalLedgerAccountsTool: ToolDefinition<typeof inputSchema>;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { enc, fetchList, idParam, listParamsSchema } from './shared.js';
|
|
3
|
+
const inputSchema = z.discriminatedUnion('action', [
|
|
4
|
+
z
|
|
5
|
+
.object({ action: z.literal('list') })
|
|
6
|
+
.merge(listParamsSchema)
|
|
7
|
+
.extend({
|
|
8
|
+
account_type: z
|
|
9
|
+
.string()
|
|
10
|
+
.optional()
|
|
11
|
+
.describe('Filter by general ledger account type, e.g. liability or revenue.'),
|
|
12
|
+
}),
|
|
13
|
+
z.object({
|
|
14
|
+
action: z.literal('get'),
|
|
15
|
+
general_ledger_account_id: idParam('general_ledger_account_id'),
|
|
16
|
+
}),
|
|
17
|
+
]);
|
|
18
|
+
export const generalLedgerAccountsTool = {
|
|
19
|
+
name: 'recurly_general_ledger_accounts',
|
|
20
|
+
description: 'Recurly general ledger accounts (read-only). Actions: list, get. Returns raw Recurly JSON; list adds a _pagination cursor hint.',
|
|
21
|
+
inputSchema,
|
|
22
|
+
handler: async (ctx, input) => {
|
|
23
|
+
const parsed = inputSchema.parse(input);
|
|
24
|
+
switch (parsed.action) {
|
|
25
|
+
case 'list':
|
|
26
|
+
return fetchList(ctx, '/general_ledger_accounts', parsed);
|
|
27
|
+
case 'get':
|
|
28
|
+
return ctx.client.request('GET', `/general_ledger_accounts/${enc(parsed.general_ledger_account_id)}`);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=generalLedgerAccounts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generalLedgerAccounts.js","sourceRoot":"","sources":["../../src/tools/generalLedgerAccounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGxE,MAAM,WAAW,GAAG,CAAC,CAAC,kBAAkB,CAAC,QAAQ,EAAE;IACjD,CAAC;SACE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;SACrC,KAAK,CAAC,gBAAgB,CAAC;SACvB,MAAM,CAAC;QACN,YAAY,EAAE,CAAC;aACZ,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,mEAAmE,CAAC;KACjF,CAAC;IACJ,CAAC,CAAC,MAAM,CAAC;QACP,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;QACxB,yBAAyB,EAAE,OAAO,CAAC,2BAA2B,CAAC;KAChE,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAuC;IAC3E,IAAI,EAAE,iCAAiC;IACvC,WAAW,EACT,iIAAiI;IACnI,WAAW;IACX,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;QAC5B,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACxC,QAAQ,MAAM,CAAC,MAAM,EAAE,CAAC;YACtB,KAAK,MAAM;gBACT,OAAO,SAAS,CAAC,GAAG,EAAE,0BAA0B,EAAE,MAAM,CAAC,CAAC;YAC5D,KAAK,KAAK;gBACR,OAAO,GAAG,CAAC,MAAM,CAAC,OAAO,CACvB,KAAK,EACL,4BAA4B,GAAG,CAAC,MAAM,CAAC,yBAAyB,CAAC,EAAE,CACpE,CAAC;QACN,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ToolDefinition } from './types.js';
|
|
3
|
+
declare const inputSchema: z.ZodDiscriminatedUnion<"action", [z.ZodObject<{
|
|
4
|
+
action: z.ZodLiteral<"list">;
|
|
5
|
+
} & {
|
|
6
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
order: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
|
|
8
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
9
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
10
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
11
|
+
begin_time: z.ZodOptional<z.ZodString>;
|
|
12
|
+
end_time: z.ZodOptional<z.ZodString>;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
action: "list";
|
|
15
|
+
cursor?: string | undefined;
|
|
16
|
+
limit?: number | undefined;
|
|
17
|
+
order?: "asc" | "desc" | undefined;
|
|
18
|
+
sort?: string | undefined;
|
|
19
|
+
ids?: string[] | undefined;
|
|
20
|
+
begin_time?: string | undefined;
|
|
21
|
+
end_time?: string | undefined;
|
|
22
|
+
}, {
|
|
23
|
+
action: "list";
|
|
24
|
+
cursor?: string | undefined;
|
|
25
|
+
limit?: number | undefined;
|
|
26
|
+
order?: "asc" | "desc" | undefined;
|
|
27
|
+
sort?: string | undefined;
|
|
28
|
+
ids?: string[] | undefined;
|
|
29
|
+
begin_time?: string | undefined;
|
|
30
|
+
end_time?: string | undefined;
|
|
31
|
+
}>, z.ZodObject<{
|
|
32
|
+
action: z.ZodLiteral<"get">;
|
|
33
|
+
gift_card_id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
action: "get";
|
|
36
|
+
gift_card_id: string;
|
|
37
|
+
}, {
|
|
38
|
+
action: "get";
|
|
39
|
+
gift_card_id: string;
|
|
40
|
+
}>]>;
|
|
41
|
+
export declare const giftCardsTool: ToolDefinition<typeof inputSchema>;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { enc, fetchList, idParam, listParamsSchema } from './shared.js';
|
|
3
|
+
const inputSchema = z.discriminatedUnion('action', [
|
|
4
|
+
z.object({ action: z.literal('list') }).merge(listParamsSchema),
|
|
5
|
+
z.object({ action: z.literal('get'), gift_card_id: idParam('gift_card_id') }),
|
|
6
|
+
]);
|
|
7
|
+
export const giftCardsTool = {
|
|
8
|
+
name: 'recurly_gift_cards',
|
|
9
|
+
description: 'Recurly gift cards (read-only). Actions: list, get. Returns raw Recurly JSON; list adds a _pagination cursor hint.',
|
|
10
|
+
inputSchema,
|
|
11
|
+
handler: async (ctx, input) => {
|
|
12
|
+
const parsed = inputSchema.parse(input);
|
|
13
|
+
switch (parsed.action) {
|
|
14
|
+
case 'list':
|
|
15
|
+
return fetchList(ctx, '/gift_cards', parsed);
|
|
16
|
+
case 'get':
|
|
17
|
+
return ctx.client.request('GET', `/gift_cards/${enc(parsed.gift_card_id)}`);
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=giftCards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"giftCards.js","sourceRoot":"","sources":["../../src/tools/giftCards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGxE,MAAM,WAAW,GAAG,CAAC,CAAC,kBAAkB,CAAC,QAAQ,EAAE;IACjD,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC;IAC/D,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;CAC9E,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,aAAa,GAAuC;IAC/D,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EACT,oHAAoH;IACtH,WAAW;IACX,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;QAC5B,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACxC,QAAQ,MAAM,CAAC,MAAM,EAAE,CAAC;YACtB,KAAK,MAAM;gBACT,OAAO,SAAS,CAAC,GAAG,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;YAC/C,KAAK,KAAK;gBACR,OAAO,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,eAAe,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;QAChF,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { accountsTool } from './accounts.js';
|
|
2
|
+
import { addOnsTool } from './addOns.js';
|
|
3
|
+
import { billingInfoTool } from './billingInfo.js';
|
|
4
|
+
import { businessEntitiesTool } from './businessEntities.js';
|
|
5
|
+
import { couponRedemptionsTool } from './couponRedemptions.js';
|
|
6
|
+
import { couponsTool } from './coupons.js';
|
|
7
|
+
import { creditPaymentsTool } from './creditPayments.js';
|
|
8
|
+
import { customFieldDefinitionsTool } from './customFieldDefinitions.js';
|
|
9
|
+
import { dunningCampaignsTool } from './dunningCampaigns.js';
|
|
10
|
+
import { exportTool } from './exports.js';
|
|
11
|
+
import { externalAccountsTool } from './externalAccounts.js';
|
|
12
|
+
import { externalInvoicesTool } from './externalInvoices.js';
|
|
13
|
+
import { externalProductsTool } from './externalProducts.js';
|
|
14
|
+
import { externalSubscriptionsTool } from './externalSubscriptions.js';
|
|
15
|
+
import { generalLedgerAccountsTool } from './generalLedgerAccounts.js';
|
|
16
|
+
import { giftCardsTool } from './giftCards.js';
|
|
17
|
+
import { invoiceTemplatesTool } from './invoiceTemplates.js';
|
|
18
|
+
import { invoicesTool } from './invoices.js';
|
|
19
|
+
import { itemsTool } from './items.js';
|
|
20
|
+
import { lineItemsTool } from './lineItems.js';
|
|
21
|
+
import { measuredUnitsTool } from './measuredUnits.js';
|
|
22
|
+
import { performanceObligationsTool } from './performanceObligations.js';
|
|
23
|
+
import { plansTool } from './plans.js';
|
|
24
|
+
import { priceSegmentsTool } from './priceSegments.js';
|
|
25
|
+
import { requestTool } from './request.js';
|
|
26
|
+
import { shippingAddressesTool } from './shippingAddresses.js';
|
|
27
|
+
import { shippingMethodsTool } from './shippingMethods.js';
|
|
28
|
+
import { sitesTool } from './sites.js';
|
|
29
|
+
import { subscriptionsTool } from './subscriptions.js';
|
|
30
|
+
import { transactionsTool } from './transactions.js';
|
|
31
|
+
import { usageTool } from './usage.js';
|
|
32
|
+
// One resource-grouped tool per Recurly resource, plus the generic
|
|
33
|
+
// `recurly_request` escape hatch. All actions are read-only (GET).
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
35
|
+
export const allTools = [
|
|
36
|
+
sitesTool,
|
|
37
|
+
accountsTool,
|
|
38
|
+
billingInfoTool,
|
|
39
|
+
shippingAddressesTool,
|
|
40
|
+
couponsTool,
|
|
41
|
+
couponRedemptionsTool,
|
|
42
|
+
creditPaymentsTool,
|
|
43
|
+
invoicesTool,
|
|
44
|
+
lineItemsTool,
|
|
45
|
+
subscriptionsTool,
|
|
46
|
+
transactionsTool,
|
|
47
|
+
customFieldDefinitionsTool,
|
|
48
|
+
itemsTool,
|
|
49
|
+
measuredUnitsTool,
|
|
50
|
+
plansTool,
|
|
51
|
+
addOnsTool,
|
|
52
|
+
shippingMethodsTool,
|
|
53
|
+
usageTool,
|
|
54
|
+
exportTool,
|
|
55
|
+
dunningCampaignsTool,
|
|
56
|
+
invoiceTemplatesTool,
|
|
57
|
+
externalProductsTool,
|
|
58
|
+
externalSubscriptionsTool,
|
|
59
|
+
externalInvoicesTool,
|
|
60
|
+
externalAccountsTool,
|
|
61
|
+
generalLedgerAccountsTool,
|
|
62
|
+
performanceObligationsTool,
|
|
63
|
+
priceSegmentsTool,
|
|
64
|
+
businessEntitiesTool,
|
|
65
|
+
giftCardsTool,
|
|
66
|
+
requestTool,
|
|
67
|
+
];
|
|
68
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,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from './types.js';
|
|
3
|
+
declare const inputSchema: z.ZodDiscriminatedUnion<"action", [z.ZodObject<{
|
|
4
|
+
action: z.ZodLiteral<"list">;
|
|
5
|
+
} & {
|
|
6
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
order: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
|
|
8
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
9
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
10
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
11
|
+
begin_time: z.ZodOptional<z.ZodString>;
|
|
12
|
+
end_time: z.ZodOptional<z.ZodString>;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
action: "list";
|
|
15
|
+
cursor?: string | undefined;
|
|
16
|
+
limit?: number | undefined;
|
|
17
|
+
order?: "asc" | "desc" | undefined;
|
|
18
|
+
sort?: string | undefined;
|
|
19
|
+
ids?: string[] | undefined;
|
|
20
|
+
begin_time?: string | undefined;
|
|
21
|
+
end_time?: string | undefined;
|
|
22
|
+
}, {
|
|
23
|
+
action: "list";
|
|
24
|
+
cursor?: string | undefined;
|
|
25
|
+
limit?: number | undefined;
|
|
26
|
+
order?: "asc" | "desc" | undefined;
|
|
27
|
+
sort?: string | undefined;
|
|
28
|
+
ids?: string[] | undefined;
|
|
29
|
+
begin_time?: string | undefined;
|
|
30
|
+
end_time?: string | undefined;
|
|
31
|
+
}>, z.ZodObject<{
|
|
32
|
+
action: z.ZodLiteral<"get">;
|
|
33
|
+
invoice_template_id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
action: "get";
|
|
36
|
+
invoice_template_id: string;
|
|
37
|
+
}, {
|
|
38
|
+
action: "get";
|
|
39
|
+
invoice_template_id: string;
|
|
40
|
+
}>, z.ZodObject<{
|
|
41
|
+
action: z.ZodLiteral<"list_accounts">;
|
|
42
|
+
invoice_template_id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
43
|
+
} & {
|
|
44
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
order: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
|
|
46
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
47
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
48
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
49
|
+
begin_time: z.ZodOptional<z.ZodString>;
|
|
50
|
+
end_time: z.ZodOptional<z.ZodString>;
|
|
51
|
+
} & {
|
|
52
|
+
email: z.ZodOptional<z.ZodString>;
|
|
53
|
+
subscriber: z.ZodOptional<z.ZodBoolean>;
|
|
54
|
+
past_due: z.ZodOptional<z.ZodString>;
|
|
55
|
+
}, "strip", z.ZodTypeAny, {
|
|
56
|
+
action: "list_accounts";
|
|
57
|
+
invoice_template_id: string;
|
|
58
|
+
cursor?: string | undefined;
|
|
59
|
+
limit?: number | undefined;
|
|
60
|
+
order?: "asc" | "desc" | undefined;
|
|
61
|
+
sort?: string | undefined;
|
|
62
|
+
ids?: string[] | undefined;
|
|
63
|
+
begin_time?: string | undefined;
|
|
64
|
+
end_time?: string | undefined;
|
|
65
|
+
email?: string | undefined;
|
|
66
|
+
subscriber?: boolean | undefined;
|
|
67
|
+
past_due?: string | undefined;
|
|
68
|
+
}, {
|
|
69
|
+
action: "list_accounts";
|
|
70
|
+
invoice_template_id: string;
|
|
71
|
+
cursor?: string | undefined;
|
|
72
|
+
limit?: number | undefined;
|
|
73
|
+
order?: "asc" | "desc" | undefined;
|
|
74
|
+
sort?: string | undefined;
|
|
75
|
+
ids?: string[] | undefined;
|
|
76
|
+
begin_time?: string | undefined;
|
|
77
|
+
end_time?: string | undefined;
|
|
78
|
+
email?: string | undefined;
|
|
79
|
+
subscriber?: boolean | undefined;
|
|
80
|
+
past_due?: string | undefined;
|
|
81
|
+
}>]>;
|
|
82
|
+
export declare const invoiceTemplatesTool: ToolDefinition<typeof inputSchema>;
|
|
83
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { enc, fetchList, idParam, listParamsSchema } from './shared.js';
|
|
3
|
+
const invoiceTemplateId = idParam('invoice_template_id');
|
|
4
|
+
const accountFilters = {
|
|
5
|
+
email: z.string().optional().describe('Filter for accounts with this exact email address.'),
|
|
6
|
+
subscriber: z
|
|
7
|
+
.boolean()
|
|
8
|
+
.optional()
|
|
9
|
+
.describe('Filter for accounts with (true) or without (false) a subscription.'),
|
|
10
|
+
past_due: z
|
|
11
|
+
.string()
|
|
12
|
+
.optional()
|
|
13
|
+
.describe('Filter for accounts with an invoice in the past_due state ("true"/"false").'),
|
|
14
|
+
};
|
|
15
|
+
const inputSchema = z.discriminatedUnion('action', [
|
|
16
|
+
z.object({ action: z.literal('list') }).merge(listParamsSchema),
|
|
17
|
+
z.object({ action: z.literal('get'), invoice_template_id: invoiceTemplateId }),
|
|
18
|
+
z
|
|
19
|
+
.object({ action: z.literal('list_accounts'), invoice_template_id: invoiceTemplateId })
|
|
20
|
+
.merge(listParamsSchema)
|
|
21
|
+
.extend(accountFilters),
|
|
22
|
+
]);
|
|
23
|
+
export const invoiceTemplatesTool = {
|
|
24
|
+
name: 'recurly_invoice_templates',
|
|
25
|
+
description: 'Recurly invoice templates (read-only). Actions: list, get, list_accounts (accounts assigned to a template). Returns raw Recurly JSON; list actions add a _pagination cursor hint.',
|
|
26
|
+
inputSchema,
|
|
27
|
+
handler: async (ctx, input) => {
|
|
28
|
+
const parsed = inputSchema.parse(input);
|
|
29
|
+
switch (parsed.action) {
|
|
30
|
+
case 'list':
|
|
31
|
+
return fetchList(ctx, '/invoice_templates', parsed);
|
|
32
|
+
case 'get':
|
|
33
|
+
return ctx.client.request('GET', `/invoice_templates/${enc(parsed.invoice_template_id)}`);
|
|
34
|
+
case 'list_accounts':
|
|
35
|
+
return fetchList(ctx, `/invoice_templates/${enc(parsed.invoice_template_id)}/accounts`, parsed, ['invoice_template_id']);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=invoiceTemplates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoiceTemplates.js","sourceRoot":"","sources":["../../src/tools/invoiceTemplates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGxE,MAAM,iBAAiB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAEzD,MAAM,cAAc,GAAG;IACrB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oDAAoD,CAAC;IAC3F,UAAU,EAAE,CAAC;SACV,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,QAAQ,CAAC,oEAAoE,CAAC;IACjF,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,6EAA6E,CAAC;CAC3F,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,CAAC,kBAAkB,CAAC,QAAQ,EAAE;IACjD,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC;IAC/D,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,CAAC;IAC9E,CAAC;SACE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,CAAC;SACtF,KAAK,CAAC,gBAAgB,CAAC;SACvB,MAAM,CAAC,cAAc,CAAC;CAC1B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAuC;IACtE,IAAI,EAAE,2BAA2B;IACjC,WAAW,EACT,mLAAmL;IACrL,WAAW;IACX,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;QAC5B,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACxC,QAAQ,MAAM,CAAC,MAAM,EAAE,CAAC;YACtB,KAAK,MAAM;gBACT,OAAO,SAAS,CAAC,GAAG,EAAE,oBAAoB,EAAE,MAAM,CAAC,CAAC;YACtD,KAAK,KAAK;gBACR,OAAO,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,sBAAsB,GAAG,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;YAC5F,KAAK,eAAe;gBAClB,OAAO,SAAS,CACd,GAAG,EACH,sBAAsB,GAAG,CAAC,MAAM,CAAC,mBAAmB,CAAC,WAAW,EAChE,MAAM,EACN,CAAC,qBAAqB,CAAC,CACxB,CAAC;QACN,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ToolDefinition } from './types.js';
|
|
3
|
+
declare const inputSchema: z.ZodDiscriminatedUnion<"action", [z.ZodObject<{
|
|
4
|
+
action: z.ZodLiteral<"list">;
|
|
5
|
+
} & {
|
|
6
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
order: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
|
|
8
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
9
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
10
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
11
|
+
begin_time: z.ZodOptional<z.ZodString>;
|
|
12
|
+
end_time: z.ZodOptional<z.ZodString>;
|
|
13
|
+
} & {
|
|
14
|
+
state: z.ZodOptional<z.ZodString>;
|
|
15
|
+
type: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
action: "list";
|
|
18
|
+
cursor?: string | undefined;
|
|
19
|
+
limit?: number | undefined;
|
|
20
|
+
order?: "asc" | "desc" | undefined;
|
|
21
|
+
sort?: string | undefined;
|
|
22
|
+
type?: string | undefined;
|
|
23
|
+
ids?: string[] | undefined;
|
|
24
|
+
begin_time?: string | undefined;
|
|
25
|
+
end_time?: string | undefined;
|
|
26
|
+
state?: string | undefined;
|
|
27
|
+
}, {
|
|
28
|
+
action: "list";
|
|
29
|
+
cursor?: string | undefined;
|
|
30
|
+
limit?: number | undefined;
|
|
31
|
+
order?: "asc" | "desc" | undefined;
|
|
32
|
+
sort?: string | undefined;
|
|
33
|
+
type?: string | undefined;
|
|
34
|
+
ids?: string[] | undefined;
|
|
35
|
+
begin_time?: string | undefined;
|
|
36
|
+
end_time?: string | undefined;
|
|
37
|
+
state?: string | undefined;
|
|
38
|
+
}>, z.ZodObject<{
|
|
39
|
+
action: z.ZodLiteral<"get">;
|
|
40
|
+
invoice_id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
action: "get";
|
|
43
|
+
invoice_id: string;
|
|
44
|
+
}, {
|
|
45
|
+
action: "get";
|
|
46
|
+
invoice_id: string;
|
|
47
|
+
}>, z.ZodObject<{
|
|
48
|
+
action: z.ZodLiteral<"get_pdf">;
|
|
49
|
+
invoice_id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
50
|
+
}, "strip", z.ZodTypeAny, {
|
|
51
|
+
action: "get_pdf";
|
|
52
|
+
invoice_id: string;
|
|
53
|
+
}, {
|
|
54
|
+
action: "get_pdf";
|
|
55
|
+
invoice_id: string;
|
|
56
|
+
}>, z.ZodObject<{
|
|
57
|
+
action: z.ZodLiteral<"list_line_items">;
|
|
58
|
+
invoice_id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
59
|
+
} & {
|
|
60
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
order: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
|
|
62
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
63
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
64
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
65
|
+
begin_time: z.ZodOptional<z.ZodString>;
|
|
66
|
+
end_time: z.ZodOptional<z.ZodString>;
|
|
67
|
+
} & {
|
|
68
|
+
original: z.ZodOptional<z.ZodString>;
|
|
69
|
+
state: z.ZodOptional<z.ZodString>;
|
|
70
|
+
type: z.ZodOptional<z.ZodString>;
|
|
71
|
+
}, "strip", z.ZodTypeAny, {
|
|
72
|
+
action: "list_line_items";
|
|
73
|
+
invoice_id: string;
|
|
74
|
+
cursor?: string | undefined;
|
|
75
|
+
limit?: number | undefined;
|
|
76
|
+
order?: "asc" | "desc" | undefined;
|
|
77
|
+
sort?: string | undefined;
|
|
78
|
+
type?: string | undefined;
|
|
79
|
+
ids?: string[] | undefined;
|
|
80
|
+
begin_time?: string | undefined;
|
|
81
|
+
end_time?: string | undefined;
|
|
82
|
+
state?: string | undefined;
|
|
83
|
+
original?: string | undefined;
|
|
84
|
+
}, {
|
|
85
|
+
action: "list_line_items";
|
|
86
|
+
invoice_id: string;
|
|
87
|
+
cursor?: string | undefined;
|
|
88
|
+
limit?: number | undefined;
|
|
89
|
+
order?: "asc" | "desc" | undefined;
|
|
90
|
+
sort?: string | undefined;
|
|
91
|
+
type?: string | undefined;
|
|
92
|
+
ids?: string[] | undefined;
|
|
93
|
+
begin_time?: string | undefined;
|
|
94
|
+
end_time?: string | undefined;
|
|
95
|
+
state?: string | undefined;
|
|
96
|
+
original?: string | undefined;
|
|
97
|
+
}>, z.ZodObject<{
|
|
98
|
+
action: z.ZodLiteral<"list_related">;
|
|
99
|
+
invoice_id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
100
|
+
} & {
|
|
101
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
102
|
+
order: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
|
|
103
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
104
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
105
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
106
|
+
begin_time: z.ZodOptional<z.ZodString>;
|
|
107
|
+
end_time: z.ZodOptional<z.ZodString>;
|
|
108
|
+
}, "strip", z.ZodTypeAny, {
|
|
109
|
+
action: "list_related";
|
|
110
|
+
invoice_id: string;
|
|
111
|
+
cursor?: string | undefined;
|
|
112
|
+
limit?: number | undefined;
|
|
113
|
+
order?: "asc" | "desc" | undefined;
|
|
114
|
+
sort?: string | undefined;
|
|
115
|
+
ids?: string[] | undefined;
|
|
116
|
+
begin_time?: string | undefined;
|
|
117
|
+
end_time?: string | undefined;
|
|
118
|
+
}, {
|
|
119
|
+
action: "list_related";
|
|
120
|
+
invoice_id: string;
|
|
121
|
+
cursor?: string | undefined;
|
|
122
|
+
limit?: number | undefined;
|
|
123
|
+
order?: "asc" | "desc" | undefined;
|
|
124
|
+
sort?: string | undefined;
|
|
125
|
+
ids?: string[] | undefined;
|
|
126
|
+
begin_time?: string | undefined;
|
|
127
|
+
end_time?: string | undefined;
|
|
128
|
+
}>, z.ZodObject<{
|
|
129
|
+
action: z.ZodLiteral<"list_for_account">;
|
|
130
|
+
account_id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
131
|
+
} & {
|
|
132
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
133
|
+
order: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
|
|
134
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
135
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
136
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
137
|
+
begin_time: z.ZodOptional<z.ZodString>;
|
|
138
|
+
end_time: z.ZodOptional<z.ZodString>;
|
|
139
|
+
} & {
|
|
140
|
+
state: z.ZodOptional<z.ZodString>;
|
|
141
|
+
type: z.ZodOptional<z.ZodString>;
|
|
142
|
+
}, "strip", z.ZodTypeAny, {
|
|
143
|
+
action: "list_for_account";
|
|
144
|
+
account_id: string;
|
|
145
|
+
cursor?: string | undefined;
|
|
146
|
+
limit?: number | undefined;
|
|
147
|
+
order?: "asc" | "desc" | undefined;
|
|
148
|
+
sort?: string | undefined;
|
|
149
|
+
type?: string | undefined;
|
|
150
|
+
ids?: string[] | undefined;
|
|
151
|
+
begin_time?: string | undefined;
|
|
152
|
+
end_time?: string | undefined;
|
|
153
|
+
state?: string | undefined;
|
|
154
|
+
}, {
|
|
155
|
+
action: "list_for_account";
|
|
156
|
+
account_id: string;
|
|
157
|
+
cursor?: string | undefined;
|
|
158
|
+
limit?: number | undefined;
|
|
159
|
+
order?: "asc" | "desc" | undefined;
|
|
160
|
+
sort?: string | undefined;
|
|
161
|
+
type?: string | undefined;
|
|
162
|
+
ids?: string[] | undefined;
|
|
163
|
+
begin_time?: string | undefined;
|
|
164
|
+
end_time?: string | undefined;
|
|
165
|
+
state?: string | undefined;
|
|
166
|
+
}>]>;
|
|
167
|
+
export declare const invoicesTool: ToolDefinition<typeof inputSchema>;
|
|
168
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { enc, fetchList, idParam, listParamsSchema } from './shared.js';
|
|
3
|
+
const invoiceId = idParam('invoice_id');
|
|
4
|
+
const invoiceFilters = {
|
|
5
|
+
state: z.string().optional().describe('Filter by invoice state, e.g. open, paid, past_due.'),
|
|
6
|
+
type: z.string().optional().describe('Filter by invoice type, e.g. charge, credit.'),
|
|
7
|
+
};
|
|
8
|
+
const lineItemFilters = {
|
|
9
|
+
original: z.string().optional().describe('Filter by original line-item state.'),
|
|
10
|
+
state: z.string().optional().describe('Filter by line-item state.'),
|
|
11
|
+
type: z.string().optional().describe('Filter by line-item type, e.g. charge, credit.'),
|
|
12
|
+
};
|
|
13
|
+
const inputSchema = z.discriminatedUnion('action', [
|
|
14
|
+
z
|
|
15
|
+
.object({ action: z.literal('list') })
|
|
16
|
+
.merge(listParamsSchema)
|
|
17
|
+
.extend(invoiceFilters),
|
|
18
|
+
z.object({ action: z.literal('get'), invoice_id: invoiceId }),
|
|
19
|
+
z.object({ action: z.literal('get_pdf'), invoice_id: invoiceId }),
|
|
20
|
+
z
|
|
21
|
+
.object({ action: z.literal('list_line_items'), invoice_id: invoiceId })
|
|
22
|
+
.merge(listParamsSchema)
|
|
23
|
+
.extend(lineItemFilters),
|
|
24
|
+
z.object({ action: z.literal('list_related'), invoice_id: invoiceId }).merge(listParamsSchema),
|
|
25
|
+
z
|
|
26
|
+
.object({ action: z.literal('list_for_account'), account_id: idParam('account_id') })
|
|
27
|
+
.merge(listParamsSchema)
|
|
28
|
+
.extend(invoiceFilters),
|
|
29
|
+
]);
|
|
30
|
+
export const invoicesTool = {
|
|
31
|
+
name: 'recurly_invoices',
|
|
32
|
+
description: 'Recurly invoices (read-only). Actions: list, get, get_pdf (returns the PDF as a base64 binary_file wrapper), list_line_items, list_related (related invoices), list_for_account. invoice_id accepts a Recurly ID or `number-<invoice_number>`. Returns raw Recurly JSON; list actions add a _pagination cursor hint.',
|
|
33
|
+
inputSchema,
|
|
34
|
+
handler: async (ctx, input) => {
|
|
35
|
+
const parsed = inputSchema.parse(input);
|
|
36
|
+
switch (parsed.action) {
|
|
37
|
+
case 'list':
|
|
38
|
+
return fetchList(ctx, '/invoices', parsed);
|
|
39
|
+
case 'get':
|
|
40
|
+
return ctx.client.request('GET', `/invoices/${enc(parsed.invoice_id)}`);
|
|
41
|
+
case 'get_pdf':
|
|
42
|
+
return ctx.client.request('GET', `/invoices/${enc(parsed.invoice_id)}.pdf`);
|
|
43
|
+
case 'list_line_items':
|
|
44
|
+
return fetchList(ctx, `/invoices/${enc(parsed.invoice_id)}/line_items`, parsed, [
|
|
45
|
+
'invoice_id',
|
|
46
|
+
]);
|
|
47
|
+
case 'list_related':
|
|
48
|
+
return fetchList(ctx, `/invoices/${enc(parsed.invoice_id)}/related_invoices`, parsed, [
|
|
49
|
+
'invoice_id',
|
|
50
|
+
]);
|
|
51
|
+
case 'list_for_account':
|
|
52
|
+
return fetchList(ctx, `/accounts/${enc(parsed.account_id)}/invoices`, parsed, [
|
|
53
|
+
'account_id',
|
|
54
|
+
]);
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=invoices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoices.js","sourceRoot":"","sources":["../../src/tools/invoices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGxE,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAExC,MAAM,cAAc,GAAG;IACrB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qDAAqD,CAAC;IAC5F,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,8CAA8C,CAAC;CACrF,CAAC;AAEF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AC;CACF,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ToolDefinition } from './types.js';
|
|
3
|
+
declare const inputSchema: z.ZodDiscriminatedUnion<"action", [z.ZodObject<{
|
|
4
|
+
action: z.ZodLiteral<"list">;
|
|
5
|
+
} & {
|
|
6
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
order: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
|
|
8
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
9
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
10
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
11
|
+
begin_time: z.ZodOptional<z.ZodString>;
|
|
12
|
+
end_time: z.ZodOptional<z.ZodString>;
|
|
13
|
+
} & {
|
|
14
|
+
state: z.ZodOptional<z.ZodString>;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
action: "list";
|
|
17
|
+
cursor?: string | undefined;
|
|
18
|
+
limit?: number | undefined;
|
|
19
|
+
order?: "asc" | "desc" | undefined;
|
|
20
|
+
sort?: string | undefined;
|
|
21
|
+
ids?: string[] | undefined;
|
|
22
|
+
begin_time?: string | undefined;
|
|
23
|
+
end_time?: string | undefined;
|
|
24
|
+
state?: string | undefined;
|
|
25
|
+
}, {
|
|
26
|
+
action: "list";
|
|
27
|
+
cursor?: string | undefined;
|
|
28
|
+
limit?: number | undefined;
|
|
29
|
+
order?: "asc" | "desc" | undefined;
|
|
30
|
+
sort?: string | undefined;
|
|
31
|
+
ids?: string[] | undefined;
|
|
32
|
+
begin_time?: string | undefined;
|
|
33
|
+
end_time?: string | undefined;
|
|
34
|
+
state?: string | undefined;
|
|
35
|
+
}>, z.ZodObject<{
|
|
36
|
+
action: z.ZodLiteral<"get">;
|
|
37
|
+
item_id: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
action: "get";
|
|
40
|
+
item_id: string;
|
|
41
|
+
}, {
|
|
42
|
+
action: "get";
|
|
43
|
+
item_id: string;
|
|
44
|
+
}>]>;
|
|
45
|
+
export declare const itemsTool: ToolDefinition<typeof inputSchema>;
|
|
46
|
+
export {};
|