@usethrottle/mcp 0.9.0 → 0.11.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 +125 -5
- package/dist/lib.cjs.map +1 -1
- package/dist/lib.js +125 -5
- package/dist/lib.js.map +1 -1
- package/dist/mcp.js +125 -5
- package/dist/mcp.js.map +1 -1
- package/package.json +4 -4
package/dist/lib.js
CHANGED
|
@@ -368,6 +368,16 @@ function stripRawProcessorData(value) {
|
|
|
368
368
|
|
|
369
369
|
// ../action-catalog/src/actions.ts
|
|
370
370
|
var OAUTH_WITHHELD = "Over an OAuth connection (ChatGPT, Claude) these are withheld, because a buyer can type them: line-item and quote-item names, SKUs and reference ids; company; every address line except the country; the merchant's external ids; notes, messages, reasons and metadata. Describe items by quantity and amount, and say the rest is withheld rather than missing.";
|
|
371
|
+
var ORDER_STATUSES = [
|
|
372
|
+
"draft",
|
|
373
|
+
"awaiting_payment",
|
|
374
|
+
"awaiting_fulfillment",
|
|
375
|
+
"awaiting_shipment",
|
|
376
|
+
"partially_shipped",
|
|
377
|
+
"shipped",
|
|
378
|
+
"completed",
|
|
379
|
+
"cancelled"
|
|
380
|
+
];
|
|
371
381
|
var ACTIONS = [
|
|
372
382
|
// ---------------------------------------------------------------- identity
|
|
373
383
|
{
|
|
@@ -471,7 +481,20 @@ var ACTIONS = [
|
|
|
471
481
|
scopes: ["orders:read"],
|
|
472
482
|
input: [
|
|
473
483
|
{ name: "q", type: "string", required: false, description: "Free-text search." },
|
|
474
|
-
{
|
|
484
|
+
{
|
|
485
|
+
name: "status",
|
|
486
|
+
type: "string",
|
|
487
|
+
required: false,
|
|
488
|
+
description: "Lifecycle status filter.",
|
|
489
|
+
enum: ORDER_STATUSES
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
name: "effectiveStatus",
|
|
493
|
+
type: "string",
|
|
494
|
+
required: false,
|
|
495
|
+
description: "Filter on the derived effectiveStatus: the lifecycle status unless the order is cancelled, on hold, refunded, partially refunded or disputed.",
|
|
496
|
+
enum: [...ORDER_STATUSES, "on_hold", "refunded", "partially_refunded", "disputed"]
|
|
497
|
+
},
|
|
475
498
|
{ name: "paymentStatus", type: "string", required: false, description: "Payment status filter." },
|
|
476
499
|
{
|
|
477
500
|
name: "createdAfter",
|
|
@@ -1473,6 +1496,17 @@ var ACTIONS = [
|
|
|
1473
1496
|
"The updated record is echoed back with email, phone, firstName, lastName and name nulled unless the credential holds customer_pii:read, which OAuth connections cannot hold \u2014 the update still applied, only the response is redacted."
|
|
1474
1497
|
]
|
|
1475
1498
|
},
|
|
1499
|
+
// ------------------------------------------------------------ order fees
|
|
1500
|
+
{
|
|
1501
|
+
id: "list_fees",
|
|
1502
|
+
title: "List order fees",
|
|
1503
|
+
description: "List the order fee definitions of the application (convenience, handling, insurance fees), in display order: kind (percentage or flat), rate in basis points, flat/min/max/min-order amounts per currency, taxable, which orders they apply to and the customer groups they are limited to. Fees only charge while the application has order fees turned on.",
|
|
1504
|
+
kind: "read",
|
|
1505
|
+
scopes: ["applications:read"],
|
|
1506
|
+
input: [],
|
|
1507
|
+
requests: [{ method: "GET", path: "/api/v1/fees" }],
|
|
1508
|
+
channels: ["mcp"]
|
|
1509
|
+
},
|
|
1476
1510
|
// ------------------------------------------------------------ customer groups
|
|
1477
1511
|
{
|
|
1478
1512
|
id: "list_customer_groups",
|
|
@@ -1814,6 +1848,24 @@ function trigger(id, title, eventType, description) {
|
|
|
1814
1848
|
}
|
|
1815
1849
|
var TRIGGERS = [
|
|
1816
1850
|
trigger("new_order", "New order", "order.created", "Fires when an order is created."),
|
|
1851
|
+
trigger(
|
|
1852
|
+
"order_awaiting_shipment",
|
|
1853
|
+
"Order awaiting shipment",
|
|
1854
|
+
"order.awaiting_shipment",
|
|
1855
|
+
"Fires when an order is being prepared and nothing has shipped yet."
|
|
1856
|
+
),
|
|
1857
|
+
trigger(
|
|
1858
|
+
"order_shipped",
|
|
1859
|
+
"Order shipped",
|
|
1860
|
+
"order.shipped",
|
|
1861
|
+
"Fires when everything an order has to ship has been handed to the carrier."
|
|
1862
|
+
),
|
|
1863
|
+
trigger(
|
|
1864
|
+
"order_completed",
|
|
1865
|
+
"Order completed",
|
|
1866
|
+
"order.completed",
|
|
1867
|
+
"Fires when an order is completed: marked completed after shipping, or finished with nothing to ship."
|
|
1868
|
+
),
|
|
1817
1869
|
trigger(
|
|
1818
1870
|
"payment_captured",
|
|
1819
1871
|
"Payment captured",
|
|
@@ -2266,6 +2318,7 @@ var HANDLERS = {
|
|
|
2266
2318
|
{
|
|
2267
2319
|
q: args.q,
|
|
2268
2320
|
status: args.status,
|
|
2321
|
+
effectiveStatus: args.effectiveStatus,
|
|
2269
2322
|
paymentStatus: args.paymentStatus,
|
|
2270
2323
|
createdAfter: args.createdAfter,
|
|
2271
2324
|
createdBefore: args.createdBefore,
|
|
@@ -2555,6 +2608,8 @@ var HANDLERS = {
|
|
|
2555
2608
|
},
|
|
2556
2609
|
idempotencyKey: `mcp-update-customer-${String(args.id)}-${Date.now()}`
|
|
2557
2610
|
}),
|
|
2611
|
+
// ----------------------------------------------------------- order fees
|
|
2612
|
+
list_fees: async (ctx) => ctx.client.get("/api/v1/fees"),
|
|
2558
2613
|
// ----------------------------------------------------------- customer groups
|
|
2559
2614
|
list_customer_groups: async (ctx) => ctx.client.get("/api/v1/customer-groups"),
|
|
2560
2615
|
get_customer_group: async (ctx, args) => ctx.client.get(`/api/v1/customer-groups/${String(args.id)}`),
|
|
@@ -3200,11 +3255,14 @@ var LINE_ITEM = {
|
|
|
3200
3255
|
// amount: a trial line's renewal price; schedule: per-unit installment amounts.
|
|
3201
3256
|
recurring: { amount: M, scheduleUnitTotal: M, schedule: [{ amount: M }] }
|
|
3202
3257
|
};
|
|
3258
|
+
var FEE = { baseAmount: M, amount: M, taxAmount: M };
|
|
3203
3259
|
var ORDER = {
|
|
3204
3260
|
subtotal: M,
|
|
3205
3261
|
discountTotal: M,
|
|
3206
3262
|
shippingTotal: M,
|
|
3207
3263
|
shippingDiscountTotal: M,
|
|
3264
|
+
feeTotal: M,
|
|
3265
|
+
fees: [FEE],
|
|
3208
3266
|
taxTotal: M,
|
|
3209
3267
|
total: M,
|
|
3210
3268
|
capturedAmount: M,
|
|
@@ -3232,7 +3290,8 @@ var SUBSCRIPTION = {
|
|
|
3232
3290
|
scheduleTotal: M,
|
|
3233
3291
|
nextPaymentAmount: M,
|
|
3234
3292
|
paymentSchedule: [{ amount: M, discount: M, net: M }],
|
|
3235
|
-
renewalIssue: { charge: { amount: M } }
|
|
3293
|
+
renewalIssue: { charge: { amount: M } },
|
|
3294
|
+
fees: [FEE]
|
|
3236
3295
|
};
|
|
3237
3296
|
var QUOTE_ITEM = {
|
|
3238
3297
|
unitPrice: M,
|
|
@@ -3246,6 +3305,8 @@ var QUOTE_REVISION = {
|
|
|
3246
3305
|
subtotal: M,
|
|
3247
3306
|
discountTotal: M,
|
|
3248
3307
|
shippingTotal: M,
|
|
3308
|
+
feeTotal: M,
|
|
3309
|
+
fees: [FEE],
|
|
3249
3310
|
taxTotal: M,
|
|
3250
3311
|
total: M,
|
|
3251
3312
|
depositAmount: M,
|
|
@@ -3268,15 +3329,19 @@ var INVOICE = {
|
|
|
3268
3329
|
taxTotal: M,
|
|
3269
3330
|
shippingTotal: M,
|
|
3270
3331
|
discountTotal: M,
|
|
3332
|
+
feeTotal: M,
|
|
3333
|
+
fees: [{ amount: M }],
|
|
3271
3334
|
total: M,
|
|
3272
3335
|
amountRefunded: M,
|
|
3273
3336
|
billingSnapshot: {
|
|
3274
3337
|
lineItems: [{ unitPrice: M, taxAmount: M, discountAmount: M, total: M }],
|
|
3338
|
+
fees: [FEE],
|
|
3275
3339
|
totals: {
|
|
3276
3340
|
subtotal: M,
|
|
3277
3341
|
taxTotal: M,
|
|
3278
3342
|
shippingTotal: M,
|
|
3279
3343
|
discountTotal: M,
|
|
3344
|
+
feeTotal: M,
|
|
3280
3345
|
total: M,
|
|
3281
3346
|
orderTotal: M,
|
|
3282
3347
|
amountPaid: M,
|
|
@@ -3297,6 +3362,8 @@ var CART = {
|
|
|
3297
3362
|
discountTotal: M,
|
|
3298
3363
|
shippingTotal: M,
|
|
3299
3364
|
shippingDiscountTotal: M,
|
|
3365
|
+
feeTotal: M,
|
|
3366
|
+
fees: [FEE],
|
|
3300
3367
|
total: M,
|
|
3301
3368
|
lineItems: [LINE_ITEM],
|
|
3302
3369
|
items: [LINE_ITEM],
|
|
@@ -3382,6 +3449,8 @@ var MONEY_SPECS = {
|
|
|
3382
3449
|
// GET /api/v1/stores: `settings.shipping` is stamped with its own currency
|
|
3383
3450
|
// (MC1-R74); an unstamped one takes the store's.
|
|
3384
3451
|
list_applications: [{ settings: { shipping: { flatRateCents: M, freeThresholdCents: M } } }],
|
|
3452
|
+
// GET /api/v1/fees: fee definitions hold per-currency amounts, keyed by the currency code.
|
|
3453
|
+
list_fees: [{ flatAmounts: MK(M), minAmounts: MK(M), maxAmounts: MK(M), minOrderAmounts: MK(M) }],
|
|
3385
3454
|
// ---------------------------------------------------------------- analytics
|
|
3386
3455
|
get_sales_timeseries: {
|
|
3387
3456
|
totalGrossCents: DROP,
|
|
@@ -3555,7 +3624,16 @@ var page3 = (row) => ({ data: [row], pagination: PAGINATION });
|
|
|
3555
3624
|
var ADDRESS = { countryCode: S };
|
|
3556
3625
|
var CUSTOMER_REF = { id: S };
|
|
3557
3626
|
var APPLICATION = { id: S, name: T, slug: S };
|
|
3558
|
-
var LIFECYCLE_LABELS = [
|
|
3627
|
+
var LIFECYCLE_LABELS = [
|
|
3628
|
+
"Draft",
|
|
3629
|
+
"Awaiting Payment",
|
|
3630
|
+
"Awaiting Fulfillment",
|
|
3631
|
+
"Awaiting Shipment",
|
|
3632
|
+
"Partially Shipped",
|
|
3633
|
+
"Shipped",
|
|
3634
|
+
"Completed",
|
|
3635
|
+
"Cancelled"
|
|
3636
|
+
];
|
|
3559
3637
|
var DISPLAY_QUALIFIERS = [
|
|
3560
3638
|
"Comped",
|
|
3561
3639
|
"Awaiting payment",
|
|
@@ -3602,10 +3680,24 @@ var LINE_ITEM2 = {
|
|
|
3602
3680
|
recurring: { ...LINE_RECURRING, amount: MONEY, count: S, scheduleUnitTotal: MONEY },
|
|
3603
3681
|
subscriptionId: S
|
|
3604
3682
|
};
|
|
3683
|
+
var FEE2 = {
|
|
3684
|
+
id: S,
|
|
3685
|
+
source: S,
|
|
3686
|
+
label: T,
|
|
3687
|
+
kind: S,
|
|
3688
|
+
rateBps: S,
|
|
3689
|
+
baseAmount: MONEY,
|
|
3690
|
+
amount: MONEY,
|
|
3691
|
+
taxable: S,
|
|
3692
|
+
taxAmount: MONEY,
|
|
3693
|
+
appliesToOneTime: S,
|
|
3694
|
+
appliesToSubscription: S
|
|
3695
|
+
};
|
|
3605
3696
|
var ORDER2 = {
|
|
3606
3697
|
id: S,
|
|
3607
3698
|
orderNumber: S,
|
|
3608
3699
|
status: S,
|
|
3700
|
+
effectiveStatus: S,
|
|
3609
3701
|
displayStatus: DISPLAY_STATUS,
|
|
3610
3702
|
paymentStatus: S,
|
|
3611
3703
|
type: S,
|
|
@@ -3615,6 +3707,8 @@ var ORDER2 = {
|
|
|
3615
3707
|
discountTotal: MONEY,
|
|
3616
3708
|
shippingTotal: MONEY,
|
|
3617
3709
|
shippingDiscountTotal: MONEY,
|
|
3710
|
+
feeTotal: MONEY,
|
|
3711
|
+
fees: [FEE2],
|
|
3618
3712
|
taxTotal: MONEY,
|
|
3619
3713
|
total: MONEY,
|
|
3620
3714
|
capturedAmount: MONEY,
|
|
@@ -3725,6 +3819,7 @@ var SUBSCRIPTION2 = {
|
|
|
3725
3819
|
pendingIntervalCount: S,
|
|
3726
3820
|
scheduleTotal: MONEY,
|
|
3727
3821
|
nextPaymentAmount: MONEY,
|
|
3822
|
+
fees: [FEE2],
|
|
3728
3823
|
// A physical subscription (0236): the method is an enum, and the ship-to is
|
|
3729
3824
|
// kept to its country like every other address here.
|
|
3730
3825
|
deliveryMethod: S,
|
|
@@ -3764,6 +3859,8 @@ var QUOTE2 = {
|
|
|
3764
3859
|
subtotal: MONEY,
|
|
3765
3860
|
discountTotal: MONEY,
|
|
3766
3861
|
shippingTotal: MONEY,
|
|
3862
|
+
feeTotal: MONEY,
|
|
3863
|
+
fees: [FEE2],
|
|
3767
3864
|
taxTotal: MONEY,
|
|
3768
3865
|
total: MONEY,
|
|
3769
3866
|
depositAmount: MONEY,
|
|
@@ -3799,6 +3896,8 @@ var INVOICE2 = {
|
|
|
3799
3896
|
subtotal: MONEY,
|
|
3800
3897
|
discountTotal: MONEY,
|
|
3801
3898
|
shippingTotal: MONEY,
|
|
3899
|
+
feeTotal: MONEY,
|
|
3900
|
+
fees: [{ label: T, amount: MONEY }],
|
|
3802
3901
|
taxTotal: MONEY,
|
|
3803
3902
|
total: MONEY,
|
|
3804
3903
|
amountRefunded: MONEY,
|
|
@@ -3811,7 +3910,7 @@ var INVOICE2 = {
|
|
|
3811
3910
|
planName: T,
|
|
3812
3911
|
period: { start: S, end: S },
|
|
3813
3912
|
lineItems: [{ quantity: S, unitPrice: MONEY, discountAmount: MONEY, taxAmount: MONEY, total: MONEY }],
|
|
3814
|
-
totals: { currency: S, subtotal: MONEY, discountTotal: MONEY, shippingTotal: MONEY, taxTotal: MONEY, total: MONEY },
|
|
3913
|
+
totals: { currency: S, subtotal: MONEY, discountTotal: MONEY, shippingTotal: MONEY, feeTotal: MONEY, taxTotal: MONEY, total: MONEY },
|
|
3815
3914
|
payment: { method: S, brand: S, status: S }
|
|
3816
3915
|
}
|
|
3817
3916
|
};
|
|
@@ -3999,6 +4098,8 @@ var OAUTH_PROJECTIONS = {
|
|
|
3999
4098
|
discountTotal: MONEY,
|
|
4000
4099
|
shippingTotal: MONEY,
|
|
4001
4100
|
shippingDiscountTotal: MONEY,
|
|
4101
|
+
feeTotal: MONEY,
|
|
4102
|
+
fees: [FEE2],
|
|
4002
4103
|
taxTotal: MONEY,
|
|
4003
4104
|
total: MONEY,
|
|
4004
4105
|
itemCount: S,
|
|
@@ -4069,6 +4170,25 @@ var OAUTH_PROJECTIONS = {
|
|
|
4069
4170
|
get_workspace_settings: { name: T, slug: S, brandColor: S, logoUrl: T, onboardingCompletedAt: S },
|
|
4070
4171
|
// What happened and to which record; not which team member did it.
|
|
4071
4172
|
get_audit_log: page3({ id: S, action: S, resourceType: S, resourceId: S, createdAt: S }),
|
|
4173
|
+
list_fees: [{
|
|
4174
|
+
id: S,
|
|
4175
|
+
name: T,
|
|
4176
|
+
kind: S,
|
|
4177
|
+
rateBps: S,
|
|
4178
|
+
flatAmounts: mapOf(MONEY),
|
|
4179
|
+
minAmounts: mapOf(MONEY),
|
|
4180
|
+
maxAmounts: mapOf(MONEY),
|
|
4181
|
+
minOrderAmounts: mapOf(MONEY),
|
|
4182
|
+
taxable: S,
|
|
4183
|
+
taxCode: S,
|
|
4184
|
+
appliesToOneTime: S,
|
|
4185
|
+
appliesToSubscription: S,
|
|
4186
|
+
customerGroupIds: [S],
|
|
4187
|
+
active: S,
|
|
4188
|
+
sortOrder: S,
|
|
4189
|
+
createdAt: S,
|
|
4190
|
+
updatedAt: S
|
|
4191
|
+
}],
|
|
4072
4192
|
list_applications: [{ id: S, name: T, slug: S, currency: S, isActive: S }],
|
|
4073
4193
|
// Analytics: computed aggregates, listed field by field all the same.
|
|
4074
4194
|
get_business_summary: {
|
|
@@ -4168,7 +4288,7 @@ var OAUTH_PROJECTIONS = {
|
|
|
4168
4288
|
};
|
|
4169
4289
|
|
|
4170
4290
|
// src/server.ts
|
|
4171
|
-
var VERSION = true ? "0.
|
|
4291
|
+
var VERSION = true ? "0.11.0" : "0.0.0-dev";
|
|
4172
4292
|
function registerableActions(policy) {
|
|
4173
4293
|
const isProduction = policy.identity.environment.providerEnvironment === "production";
|
|
4174
4294
|
return actionsForChannel("mcp").filter((action) => {
|