@usethrottle/mcp 0.2.2 → 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/contract-index.json +1 -1
- package/dist/docs-index.json +1 -1
- package/dist/lib.cjs +54 -19
- package/dist/lib.cjs.map +1 -1
- package/dist/lib.js +54 -19
- package/dist/lib.js.map +1 -1
- package/dist/mcp.js +54 -19
- package/dist/mcp.js.map +1 -1
- package/package.json +3 -3
package/dist/lib.cjs
CHANGED
|
@@ -1503,14 +1503,22 @@ var ACTIONS = [
|
|
|
1503
1503
|
scopes: ["quotes:write"],
|
|
1504
1504
|
input: [
|
|
1505
1505
|
{ name: "customerId", type: "string", required: true, description: "Customer the quote is for." },
|
|
1506
|
-
{
|
|
1506
|
+
{
|
|
1507
|
+
name: "items",
|
|
1508
|
+
type: "array",
|
|
1509
|
+
required: true,
|
|
1510
|
+
description: "Quote line items: { name, unitPrice, quantity }. Add `recurring: { plan, interval | intervalUnit + intervalCount, totalPayments?, trialDays? }` to make a line a subscription (one per line when the quote is paid, quantity = seats; at most 10). unitPrice is then the per-period price; a free-trial line is charged nothing at acceptance."
|
|
1511
|
+
},
|
|
1507
1512
|
{ name: "expiresAt", type: "string", required: false, description: "ISO 8601 expiry." },
|
|
1508
|
-
{ name: "netN", type: "number", required: false, description: "Payment terms in days. Omit for pay-in-full." },
|
|
1513
|
+
{ name: "netN", type: "number", required: false, description: "Payment terms in days. Omit for pay-in-full. Not allowed when any item is recurring." },
|
|
1509
1514
|
{ name: "notes", type: "string", required: false, description: "Buyer-visible notes." }
|
|
1510
1515
|
],
|
|
1511
1516
|
requests: [{ method: "POST", path: "/api/v1/quotes" }],
|
|
1512
1517
|
channels: ["mcp", "zapier", "make", "n8n"],
|
|
1513
|
-
idempotent: true
|
|
1518
|
+
idempotent: true,
|
|
1519
|
+
guardrails: [
|
|
1520
|
+
"A quote with a recurring item must be pay-in-full: issuing it with net terms or a deposit fails with 422 recurring_terms_unsupported."
|
|
1521
|
+
]
|
|
1514
1522
|
},
|
|
1515
1523
|
{
|
|
1516
1524
|
id: "send_quote",
|
|
@@ -1617,12 +1625,12 @@ var ACTIONS = [
|
|
|
1617
1625
|
{
|
|
1618
1626
|
id: "send_test_webhook",
|
|
1619
1627
|
title: "Send a test webhook",
|
|
1620
|
-
description: "Send a synthetic signed event to a webhook endpoint to verify signature handling and reachability.",
|
|
1628
|
+
description: "Send a synthetic signed event to a webhook endpoint to verify signature handling and reachability. The event type must be one the endpoint is subscribed to (an endpoint subscribed to all events accepts any); otherwise the call fails with 400 validation_error naming the allowed types.",
|
|
1621
1629
|
kind: "write",
|
|
1622
1630
|
scopes: ["webhooks:write"],
|
|
1623
1631
|
input: [
|
|
1624
1632
|
{ name: "id", type: "string", required: true, description: "Endpoint id." },
|
|
1625
|
-
{ name: "eventType", type: "string", required: false, description: "Event type to simulate." }
|
|
1633
|
+
{ name: "eventType", type: "string", required: false, description: "Event type to simulate. Must be in the endpoint's subscribed events unless it subscribes to all." }
|
|
1626
1634
|
],
|
|
1627
1635
|
requests: [{ method: "POST", path: "/api/v1/webhook-endpoints/:id/test" }],
|
|
1628
1636
|
channels: ["mcp", "n8n"],
|
|
@@ -2418,14 +2426,14 @@ var HANDLERS = {
|
|
|
2418
2426
|
idempotencyKey: `mcp-manage-subscription-${id}-${action}-${Date.now()}`
|
|
2419
2427
|
});
|
|
2420
2428
|
},
|
|
2421
|
-
create_quote: async (ctx, args) =>
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
ctx.client.post("/api/v1/quotes", {
|
|
2429
|
+
create_quote: async (ctx, args) => {
|
|
2430
|
+
const items = Array.isArray(args.items) ? args.items : [];
|
|
2431
|
+
if (args.netN !== void 0 && items.some((item) => item && item.recurring)) {
|
|
2432
|
+
throw new Error(
|
|
2433
|
+
"create_quote: items with `recurring` need pay-in-full terms \u2014 omit netN. Net terms cannot start a subscription."
|
|
2434
|
+
);
|
|
2435
|
+
}
|
|
2436
|
+
return ctx.client.post("/api/v1/quotes", {
|
|
2429
2437
|
body: {
|
|
2430
2438
|
customerId: args.customerId,
|
|
2431
2439
|
items: args.items,
|
|
@@ -2434,8 +2442,8 @@ var HANDLERS = {
|
|
|
2434
2442
|
buyerNote: args.notes
|
|
2435
2443
|
},
|
|
2436
2444
|
idempotencyKey: `mcp-create-quote-${String(args.customerId)}-${Date.now()}`
|
|
2437
|
-
})
|
|
2438
|
-
|
|
2445
|
+
});
|
|
2446
|
+
},
|
|
2439
2447
|
get_sales_timeseries: async (ctx, args) => ctx.client.get(
|
|
2440
2448
|
"/api/v1/analytics/orders-timeseries",
|
|
2441
2449
|
{
|
|
@@ -2692,6 +2700,14 @@ var ORDER_DISPLAY_STATUSES = new Set(
|
|
|
2692
2700
|
);
|
|
2693
2701
|
var DISPLAY_STATUS = oneOf(ORDER_DISPLAY_STATUSES);
|
|
2694
2702
|
var RANGE = { from: S, to: S, timezone: S, groupBy: S };
|
|
2703
|
+
var LINE_RECURRING = {
|
|
2704
|
+
plan: S,
|
|
2705
|
+
interval: S,
|
|
2706
|
+
intervalUnit: S,
|
|
2707
|
+
intervalCount: S,
|
|
2708
|
+
totalPayments: S,
|
|
2709
|
+
trialDays: S
|
|
2710
|
+
};
|
|
2695
2711
|
var LINE_ITEM = {
|
|
2696
2712
|
id: S,
|
|
2697
2713
|
type: S,
|
|
@@ -2701,7 +2717,9 @@ var LINE_ITEM = {
|
|
|
2701
2717
|
discountAmount: S,
|
|
2702
2718
|
taxAmount: S,
|
|
2703
2719
|
total: S,
|
|
2704
|
-
|
|
2720
|
+
// amount = renewal price on a trial line (whose unitPrice is 0); count = the old display mirror.
|
|
2721
|
+
recurring: { ...LINE_RECURRING, amount: S, count: S },
|
|
2722
|
+
subscriptionId: S
|
|
2705
2723
|
};
|
|
2706
2724
|
var ORDER = {
|
|
2707
2725
|
id: S,
|
|
@@ -2725,6 +2743,7 @@ var ORDER = {
|
|
|
2725
2743
|
customerId: S,
|
|
2726
2744
|
customer: CUSTOMER_REF,
|
|
2727
2745
|
subscriptionId: S,
|
|
2746
|
+
subscriptionIds: [S],
|
|
2728
2747
|
shippingAddress: ADDRESS,
|
|
2729
2748
|
billingAddress: ADDRESS,
|
|
2730
2749
|
fulfillmentSummary: { itemsFulfilled: S, itemsRemaining: S, itemsTotal: S },
|
|
@@ -2847,7 +2866,8 @@ var QUOTE = {
|
|
|
2847
2866
|
taxAmount: S,
|
|
2848
2867
|
total: S,
|
|
2849
2868
|
optional: S,
|
|
2850
|
-
optionalSelected: S
|
|
2869
|
+
optionalSelected: S,
|
|
2870
|
+
recurring: LINE_RECURRING
|
|
2851
2871
|
}]
|
|
2852
2872
|
}],
|
|
2853
2873
|
// Who commented and when, never what they wrote.
|
|
@@ -3013,7 +3033,22 @@ var OAUTH_PROJECTIONS = {
|
|
|
3013
3033
|
trialDays: S,
|
|
3014
3034
|
currency: S,
|
|
3015
3035
|
firstChargeAmountMinor: S
|
|
3016
|
-
}
|
|
3036
|
+
},
|
|
3037
|
+
hasSubscriptions: S,
|
|
3038
|
+
// One entry per subscription line. No `name`: it is the line's name.
|
|
3039
|
+
subscriptions: [{
|
|
3040
|
+
lineItemId: S,
|
|
3041
|
+
amount: S,
|
|
3042
|
+
quantity: S,
|
|
3043
|
+
interval: S,
|
|
3044
|
+
intervalUnit: S,
|
|
3045
|
+
intervalCount: S,
|
|
3046
|
+
totalPayments: S,
|
|
3047
|
+
trialDays: S,
|
|
3048
|
+
trialEndsAt: S,
|
|
3049
|
+
planChargedToday: S,
|
|
3050
|
+
taxApplies: S
|
|
3051
|
+
}]
|
|
3017
3052
|
},
|
|
3018
3053
|
cart: section({
|
|
3019
3054
|
id: S,
|
|
@@ -3154,7 +3189,7 @@ var OAUTH_PROJECTIONS = {
|
|
|
3154
3189
|
};
|
|
3155
3190
|
|
|
3156
3191
|
// src/server.ts
|
|
3157
|
-
var VERSION = true ? "0.
|
|
3192
|
+
var VERSION = true ? "0.3.0" : "0.0.0-dev";
|
|
3158
3193
|
function registerableActions(policy) {
|
|
3159
3194
|
const isProduction = policy.identity.environment.providerEnvironment === "production";
|
|
3160
3195
|
return actionsForChannel("mcp").filter((action) => {
|