@usethrottle/mcp 0.10.0 → 0.12.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 +149 -4
- package/dist/lib.cjs.map +1 -1
- package/dist/lib.js +149 -4
- package/dist/lib.js.map +1 -1
- package/dist/mcp.js +149 -4
- package/dist/mcp.js.map +1 -1
- package/package.json +4 -4
package/dist/lib.cjs
CHANGED
|
@@ -1533,6 +1533,73 @@ var ACTIONS = [
|
|
|
1533
1533
|
"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."
|
|
1534
1534
|
]
|
|
1535
1535
|
},
|
|
1536
|
+
{
|
|
1537
|
+
id: "update_order_line_inputs",
|
|
1538
|
+
title: "Edit the product inputs on an order line",
|
|
1539
|
+
description: "Replace the product inputs (an engraving, a size, a vehicle year) on one line of a placed order. Inputs never change price: no total, tax or payment moves. Values are validated against the product's input definitions unless skipInputValidation is set. An empty inputs object clears them. Refused on an add-on line, a fulfilled line, and a cancelled, refunded or voided order.",
|
|
1540
|
+
kind: "write",
|
|
1541
|
+
scopes: ["orders:write"],
|
|
1542
|
+
input: [
|
|
1543
|
+
{ name: "orderId", type: "string", required: true, description: "Order id." },
|
|
1544
|
+
{ name: "lineItemId", type: "string", required: true, description: "Id of the line on that order (not an add-on line)." },
|
|
1545
|
+
{
|
|
1546
|
+
name: "inputs",
|
|
1547
|
+
type: "object",
|
|
1548
|
+
required: true,
|
|
1549
|
+
description: "Input values by key (string or number). Replaces the line's current inputs."
|
|
1550
|
+
},
|
|
1551
|
+
{
|
|
1552
|
+
name: "skipInputValidation",
|
|
1553
|
+
type: "boolean",
|
|
1554
|
+
required: false,
|
|
1555
|
+
description: "Store the inputs without checking them against the product definitions. Secret keys only."
|
|
1556
|
+
}
|
|
1557
|
+
],
|
|
1558
|
+
requests: [{ method: "PATCH", path: "/api/v1/orders/:orderId/line-items/:lineItemId/inputs" }],
|
|
1559
|
+
channels: ["mcp"],
|
|
1560
|
+
idempotent: true,
|
|
1561
|
+
guardrails: [
|
|
1562
|
+
"Bad values answer 422 invalid_line_inputs with details.lines naming each field. A line that has shipped answers 409 line_already_fulfilled.",
|
|
1563
|
+
"The edit is recorded in the order history and emits order.edited with changedFields lineItemInputs."
|
|
1564
|
+
]
|
|
1565
|
+
},
|
|
1566
|
+
{
|
|
1567
|
+
id: "update_subscription_inputs",
|
|
1568
|
+
title: "Edit the product inputs on a subscription",
|
|
1569
|
+
description: "Replace the product inputs on a subscription's plan. Renewal orders created from now on carry the new values; orders already created never change. Validated against the plan product's input definitions unless skipInputValidation is set.",
|
|
1570
|
+
kind: "write",
|
|
1571
|
+
scopes: ["subscriptions:write"],
|
|
1572
|
+
input: [
|
|
1573
|
+
{ name: "id", type: "string", required: true, description: "Subscription id." },
|
|
1574
|
+
{
|
|
1575
|
+
name: "inputs",
|
|
1576
|
+
type: "object",
|
|
1577
|
+
required: true,
|
|
1578
|
+
description: "Input values by key (string or number). Replaces the current inputs; an empty object clears them."
|
|
1579
|
+
},
|
|
1580
|
+
{
|
|
1581
|
+
name: "skipInputValidation",
|
|
1582
|
+
type: "boolean",
|
|
1583
|
+
required: false,
|
|
1584
|
+
description: "Store the inputs without checking them against the product definitions. Secret keys only."
|
|
1585
|
+
}
|
|
1586
|
+
],
|
|
1587
|
+
requests: [{ method: "PATCH", path: "/api/v1/subscriptions/:id/inputs" }],
|
|
1588
|
+
channels: ["mcp"],
|
|
1589
|
+
idempotent: true,
|
|
1590
|
+
guardrails: ["Bad values answer 422 invalid_line_inputs with details.lines naming each field."]
|
|
1591
|
+
},
|
|
1592
|
+
// ------------------------------------------------------------ order fees
|
|
1593
|
+
{
|
|
1594
|
+
id: "list_fees",
|
|
1595
|
+
title: "List order fees",
|
|
1596
|
+
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.",
|
|
1597
|
+
kind: "read",
|
|
1598
|
+
scopes: ["applications:read"],
|
|
1599
|
+
input: [],
|
|
1600
|
+
requests: [{ method: "GET", path: "/api/v1/fees" }],
|
|
1601
|
+
channels: ["mcp"]
|
|
1602
|
+
},
|
|
1536
1603
|
// ------------------------------------------------------------ customer groups
|
|
1537
1604
|
{
|
|
1538
1605
|
id: "list_customer_groups",
|
|
@@ -2634,6 +2701,20 @@ var HANDLERS = {
|
|
|
2634
2701
|
},
|
|
2635
2702
|
idempotencyKey: `mcp-update-customer-${String(args.id)}-${Date.now()}`
|
|
2636
2703
|
}),
|
|
2704
|
+
update_order_line_inputs: async (ctx, args) => ctx.client.patch(
|
|
2705
|
+
`/api/v1/orders/${encodeURIComponent(String(args.orderId))}/line-items/${encodeURIComponent(String(args.lineItemId))}/inputs`,
|
|
2706
|
+
{
|
|
2707
|
+
// The ids are path parameters; the body is `.strict()`.
|
|
2708
|
+
body: { inputs: args.inputs, skipInputValidation: args.skipInputValidation },
|
|
2709
|
+
idempotencyKey: `mcp-update-order-line-inputs-${String(args.orderId)}-${String(args.lineItemId)}-${Date.now()}`
|
|
2710
|
+
}
|
|
2711
|
+
),
|
|
2712
|
+
update_subscription_inputs: async (ctx, args) => ctx.client.patch(`/api/v1/subscriptions/${encodeURIComponent(String(args.id))}/inputs`, {
|
|
2713
|
+
body: { inputs: args.inputs, skipInputValidation: args.skipInputValidation },
|
|
2714
|
+
idempotencyKey: `mcp-update-subscription-inputs-${String(args.id)}-${Date.now()}`
|
|
2715
|
+
}),
|
|
2716
|
+
// ----------------------------------------------------------- order fees
|
|
2717
|
+
list_fees: async (ctx) => ctx.client.get("/api/v1/fees"),
|
|
2637
2718
|
// ----------------------------------------------------------- customer groups
|
|
2638
2719
|
list_customer_groups: async (ctx) => ctx.client.get("/api/v1/customer-groups"),
|
|
2639
2720
|
get_customer_group: async (ctx, args) => ctx.client.get(`/api/v1/customer-groups/${String(args.id)}`),
|
|
@@ -3279,11 +3360,14 @@ var LINE_ITEM = {
|
|
|
3279
3360
|
// amount: a trial line's renewal price; schedule: per-unit installment amounts.
|
|
3280
3361
|
recurring: { amount: M, scheduleUnitTotal: M, schedule: [{ amount: M }] }
|
|
3281
3362
|
};
|
|
3363
|
+
var FEE = { baseAmount: M, amount: M, taxAmount: M };
|
|
3282
3364
|
var ORDER = {
|
|
3283
3365
|
subtotal: M,
|
|
3284
3366
|
discountTotal: M,
|
|
3285
3367
|
shippingTotal: M,
|
|
3286
3368
|
shippingDiscountTotal: M,
|
|
3369
|
+
feeTotal: M,
|
|
3370
|
+
fees: [FEE],
|
|
3287
3371
|
taxTotal: M,
|
|
3288
3372
|
total: M,
|
|
3289
3373
|
capturedAmount: M,
|
|
@@ -3311,7 +3395,8 @@ var SUBSCRIPTION = {
|
|
|
3311
3395
|
scheduleTotal: M,
|
|
3312
3396
|
nextPaymentAmount: M,
|
|
3313
3397
|
paymentSchedule: [{ amount: M, discount: M, net: M }],
|
|
3314
|
-
renewalIssue: { charge: { amount: M } }
|
|
3398
|
+
renewalIssue: { charge: { amount: M } },
|
|
3399
|
+
fees: [FEE]
|
|
3315
3400
|
};
|
|
3316
3401
|
var QUOTE_ITEM = {
|
|
3317
3402
|
unitPrice: M,
|
|
@@ -3325,6 +3410,8 @@ var QUOTE_REVISION = {
|
|
|
3325
3410
|
subtotal: M,
|
|
3326
3411
|
discountTotal: M,
|
|
3327
3412
|
shippingTotal: M,
|
|
3413
|
+
feeTotal: M,
|
|
3414
|
+
fees: [FEE],
|
|
3328
3415
|
taxTotal: M,
|
|
3329
3416
|
total: M,
|
|
3330
3417
|
depositAmount: M,
|
|
@@ -3347,15 +3434,19 @@ var INVOICE = {
|
|
|
3347
3434
|
taxTotal: M,
|
|
3348
3435
|
shippingTotal: M,
|
|
3349
3436
|
discountTotal: M,
|
|
3437
|
+
feeTotal: M,
|
|
3438
|
+
fees: [{ amount: M }],
|
|
3350
3439
|
total: M,
|
|
3351
3440
|
amountRefunded: M,
|
|
3352
3441
|
billingSnapshot: {
|
|
3353
3442
|
lineItems: [{ unitPrice: M, taxAmount: M, discountAmount: M, total: M }],
|
|
3443
|
+
fees: [FEE],
|
|
3354
3444
|
totals: {
|
|
3355
3445
|
subtotal: M,
|
|
3356
3446
|
taxTotal: M,
|
|
3357
3447
|
shippingTotal: M,
|
|
3358
3448
|
discountTotal: M,
|
|
3449
|
+
feeTotal: M,
|
|
3359
3450
|
total: M,
|
|
3360
3451
|
orderTotal: M,
|
|
3361
3452
|
amountPaid: M,
|
|
@@ -3376,6 +3467,8 @@ var CART = {
|
|
|
3376
3467
|
discountTotal: M,
|
|
3377
3468
|
shippingTotal: M,
|
|
3378
3469
|
shippingDiscountTotal: M,
|
|
3470
|
+
feeTotal: M,
|
|
3471
|
+
fees: [FEE],
|
|
3379
3472
|
total: M,
|
|
3380
3473
|
lineItems: [LINE_ITEM],
|
|
3381
3474
|
items: [LINE_ITEM],
|
|
@@ -3458,9 +3551,13 @@ var MONEY_SPECS = {
|
|
|
3458
3551
|
create_quote: { quote: QUOTE_SUMMARY, revision: QUOTE_REVISION, items: [QUOTE_ITEM] },
|
|
3459
3552
|
manage_subscription: SUBSCRIPTION,
|
|
3460
3553
|
set_subscription_payment_method: SUBSCRIPTION,
|
|
3554
|
+
update_order_line_inputs: ORDER,
|
|
3555
|
+
update_subscription_inputs: SUBSCRIPTION,
|
|
3461
3556
|
// GET /api/v1/stores: `settings.shipping` is stamped with its own currency
|
|
3462
3557
|
// (MC1-R74); an unstamped one takes the store's.
|
|
3463
3558
|
list_applications: [{ settings: { shipping: { flatRateCents: M, freeThresholdCents: M } } }],
|
|
3559
|
+
// GET /api/v1/fees: fee definitions hold per-currency amounts, keyed by the currency code.
|
|
3560
|
+
list_fees: [{ flatAmounts: MK(M), minAmounts: MK(M), maxAmounts: MK(M), minOrderAmounts: MK(M) }],
|
|
3464
3561
|
// ---------------------------------------------------------------- analytics
|
|
3465
3562
|
get_sales_timeseries: {
|
|
3466
3563
|
totalGrossCents: DROP,
|
|
@@ -3677,6 +3774,7 @@ var LINE_RECURRING = {
|
|
|
3677
3774
|
// A custom installment schedule: amounts are money, gaps are numbers and unit tokens, no free text.
|
|
3678
3775
|
schedule: [{ amount: MONEY, intervalUnit: S, intervalCount: S }]
|
|
3679
3776
|
};
|
|
3777
|
+
var LINE_INPUTS = [{ key: S, label: T, type: S }];
|
|
3680
3778
|
var LINE_ITEM2 = {
|
|
3681
3779
|
id: S,
|
|
3682
3780
|
type: S,
|
|
@@ -3688,7 +3786,25 @@ var LINE_ITEM2 = {
|
|
|
3688
3786
|
total: MONEY,
|
|
3689
3787
|
// amount = renewal price on a trial line (whose unitPrice is 0); count = the old display mirror.
|
|
3690
3788
|
recurring: { ...LINE_RECURRING, amount: MONEY, count: S, scheduleUnitTotal: MONEY },
|
|
3691
|
-
subscriptionId: S
|
|
3789
|
+
subscriptionId: S,
|
|
3790
|
+
inputs: LINE_INPUTS,
|
|
3791
|
+
// An add-on line points at its parent; the group label is the merchant's own.
|
|
3792
|
+
parentLineId: S,
|
|
3793
|
+
addOnGroupId: S,
|
|
3794
|
+
addOnGroupLabel: T
|
|
3795
|
+
};
|
|
3796
|
+
var FEE2 = {
|
|
3797
|
+
id: S,
|
|
3798
|
+
source: S,
|
|
3799
|
+
label: T,
|
|
3800
|
+
kind: S,
|
|
3801
|
+
rateBps: S,
|
|
3802
|
+
baseAmount: MONEY,
|
|
3803
|
+
amount: MONEY,
|
|
3804
|
+
taxable: S,
|
|
3805
|
+
taxAmount: MONEY,
|
|
3806
|
+
appliesToOneTime: S,
|
|
3807
|
+
appliesToSubscription: S
|
|
3692
3808
|
};
|
|
3693
3809
|
var ORDER2 = {
|
|
3694
3810
|
id: S,
|
|
@@ -3704,6 +3820,8 @@ var ORDER2 = {
|
|
|
3704
3820
|
discountTotal: MONEY,
|
|
3705
3821
|
shippingTotal: MONEY,
|
|
3706
3822
|
shippingDiscountTotal: MONEY,
|
|
3823
|
+
feeTotal: MONEY,
|
|
3824
|
+
fees: [FEE2],
|
|
3707
3825
|
taxTotal: MONEY,
|
|
3708
3826
|
total: MONEY,
|
|
3709
3827
|
capturedAmount: MONEY,
|
|
@@ -3814,10 +3932,12 @@ var SUBSCRIPTION2 = {
|
|
|
3814
3932
|
pendingIntervalCount: S,
|
|
3815
3933
|
scheduleTotal: MONEY,
|
|
3816
3934
|
nextPaymentAmount: MONEY,
|
|
3935
|
+
fees: [FEE2],
|
|
3817
3936
|
// A physical subscription (0236): the method is an enum, and the ship-to is
|
|
3818
3937
|
// kept to its country like every other address here.
|
|
3819
3938
|
deliveryMethod: S,
|
|
3820
3939
|
shippingAddress: ADDRESS,
|
|
3940
|
+
inputs: LINE_INPUTS,
|
|
3821
3941
|
paymentSchedule: [{
|
|
3822
3942
|
index: S,
|
|
3823
3943
|
amount: MONEY,
|
|
@@ -3853,6 +3973,8 @@ var QUOTE2 = {
|
|
|
3853
3973
|
subtotal: MONEY,
|
|
3854
3974
|
discountTotal: MONEY,
|
|
3855
3975
|
shippingTotal: MONEY,
|
|
3976
|
+
feeTotal: MONEY,
|
|
3977
|
+
fees: [FEE2],
|
|
3856
3978
|
taxTotal: MONEY,
|
|
3857
3979
|
total: MONEY,
|
|
3858
3980
|
depositAmount: MONEY,
|
|
@@ -3888,6 +4010,8 @@ var INVOICE2 = {
|
|
|
3888
4010
|
subtotal: MONEY,
|
|
3889
4011
|
discountTotal: MONEY,
|
|
3890
4012
|
shippingTotal: MONEY,
|
|
4013
|
+
feeTotal: MONEY,
|
|
4014
|
+
fees: [{ label: T, amount: MONEY }],
|
|
3891
4015
|
taxTotal: MONEY,
|
|
3892
4016
|
total: MONEY,
|
|
3893
4017
|
amountRefunded: MONEY,
|
|
@@ -3900,7 +4024,7 @@ var INVOICE2 = {
|
|
|
3900
4024
|
planName: T,
|
|
3901
4025
|
period: { start: S, end: S },
|
|
3902
4026
|
lineItems: [{ quantity: S, unitPrice: MONEY, discountAmount: MONEY, taxAmount: MONEY, total: MONEY }],
|
|
3903
|
-
totals: { currency: S, subtotal: MONEY, discountTotal: MONEY, shippingTotal: MONEY, taxTotal: MONEY, total: MONEY },
|
|
4027
|
+
totals: { currency: S, subtotal: MONEY, discountTotal: MONEY, shippingTotal: MONEY, feeTotal: MONEY, taxTotal: MONEY, total: MONEY },
|
|
3904
4028
|
payment: { method: S, brand: S, status: S }
|
|
3905
4029
|
}
|
|
3906
4030
|
};
|
|
@@ -4088,6 +4212,8 @@ var OAUTH_PROJECTIONS = {
|
|
|
4088
4212
|
discountTotal: MONEY,
|
|
4089
4213
|
shippingTotal: MONEY,
|
|
4090
4214
|
shippingDiscountTotal: MONEY,
|
|
4215
|
+
feeTotal: MONEY,
|
|
4216
|
+
fees: [FEE2],
|
|
4091
4217
|
taxTotal: MONEY,
|
|
4092
4218
|
total: MONEY,
|
|
4093
4219
|
itemCount: S,
|
|
@@ -4158,6 +4284,25 @@ var OAUTH_PROJECTIONS = {
|
|
|
4158
4284
|
get_workspace_settings: { name: T, slug: S, brandColor: S, logoUrl: T, onboardingCompletedAt: S },
|
|
4159
4285
|
// What happened and to which record; not which team member did it.
|
|
4160
4286
|
get_audit_log: page3({ id: S, action: S, resourceType: S, resourceId: S, createdAt: S }),
|
|
4287
|
+
list_fees: [{
|
|
4288
|
+
id: S,
|
|
4289
|
+
name: T,
|
|
4290
|
+
kind: S,
|
|
4291
|
+
rateBps: S,
|
|
4292
|
+
flatAmounts: mapOf(MONEY),
|
|
4293
|
+
minAmounts: mapOf(MONEY),
|
|
4294
|
+
maxAmounts: mapOf(MONEY),
|
|
4295
|
+
minOrderAmounts: mapOf(MONEY),
|
|
4296
|
+
taxable: S,
|
|
4297
|
+
taxCode: S,
|
|
4298
|
+
appliesToOneTime: S,
|
|
4299
|
+
appliesToSubscription: S,
|
|
4300
|
+
customerGroupIds: [S],
|
|
4301
|
+
active: S,
|
|
4302
|
+
sortOrder: S,
|
|
4303
|
+
createdAt: S,
|
|
4304
|
+
updatedAt: S
|
|
4305
|
+
}],
|
|
4161
4306
|
list_applications: [{ id: S, name: T, slug: S, currency: S, isActive: S }],
|
|
4162
4307
|
// Analytics: computed aggregates, listed field by field all the same.
|
|
4163
4308
|
get_business_summary: {
|
|
@@ -4257,7 +4402,7 @@ var OAUTH_PROJECTIONS = {
|
|
|
4257
4402
|
};
|
|
4258
4403
|
|
|
4259
4404
|
// src/server.ts
|
|
4260
|
-
var VERSION = true ? "0.
|
|
4405
|
+
var VERSION = true ? "0.12.0" : "0.0.0-dev";
|
|
4261
4406
|
function registerableActions(policy) {
|
|
4262
4407
|
const isProduction = policy.identity.environment.providerEnvironment === "production";
|
|
4263
4408
|
return actionsForChannel("mcp").filter((action) => {
|