@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/mcp.js
CHANGED
|
@@ -1626,6 +1626,73 @@ var ACTIONS = [
|
|
|
1626
1626
|
"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."
|
|
1627
1627
|
]
|
|
1628
1628
|
},
|
|
1629
|
+
{
|
|
1630
|
+
id: "update_order_line_inputs",
|
|
1631
|
+
title: "Edit the product inputs on an order line",
|
|
1632
|
+
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.",
|
|
1633
|
+
kind: "write",
|
|
1634
|
+
scopes: ["orders:write"],
|
|
1635
|
+
input: [
|
|
1636
|
+
{ name: "orderId", type: "string", required: true, description: "Order id." },
|
|
1637
|
+
{ name: "lineItemId", type: "string", required: true, description: "Id of the line on that order (not an add-on line)." },
|
|
1638
|
+
{
|
|
1639
|
+
name: "inputs",
|
|
1640
|
+
type: "object",
|
|
1641
|
+
required: true,
|
|
1642
|
+
description: "Input values by key (string or number). Replaces the line's current inputs."
|
|
1643
|
+
},
|
|
1644
|
+
{
|
|
1645
|
+
name: "skipInputValidation",
|
|
1646
|
+
type: "boolean",
|
|
1647
|
+
required: false,
|
|
1648
|
+
description: "Store the inputs without checking them against the product definitions. Secret keys only."
|
|
1649
|
+
}
|
|
1650
|
+
],
|
|
1651
|
+
requests: [{ method: "PATCH", path: "/api/v1/orders/:orderId/line-items/:lineItemId/inputs" }],
|
|
1652
|
+
channels: ["mcp"],
|
|
1653
|
+
idempotent: true,
|
|
1654
|
+
guardrails: [
|
|
1655
|
+
"Bad values answer 422 invalid_line_inputs with details.lines naming each field. A line that has shipped answers 409 line_already_fulfilled.",
|
|
1656
|
+
"The edit is recorded in the order history and emits order.edited with changedFields lineItemInputs."
|
|
1657
|
+
]
|
|
1658
|
+
},
|
|
1659
|
+
{
|
|
1660
|
+
id: "update_subscription_inputs",
|
|
1661
|
+
title: "Edit the product inputs on a subscription",
|
|
1662
|
+
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.",
|
|
1663
|
+
kind: "write",
|
|
1664
|
+
scopes: ["subscriptions:write"],
|
|
1665
|
+
input: [
|
|
1666
|
+
{ name: "id", type: "string", required: true, description: "Subscription id." },
|
|
1667
|
+
{
|
|
1668
|
+
name: "inputs",
|
|
1669
|
+
type: "object",
|
|
1670
|
+
required: true,
|
|
1671
|
+
description: "Input values by key (string or number). Replaces the current inputs; an empty object clears them."
|
|
1672
|
+
},
|
|
1673
|
+
{
|
|
1674
|
+
name: "skipInputValidation",
|
|
1675
|
+
type: "boolean",
|
|
1676
|
+
required: false,
|
|
1677
|
+
description: "Store the inputs without checking them against the product definitions. Secret keys only."
|
|
1678
|
+
}
|
|
1679
|
+
],
|
|
1680
|
+
requests: [{ method: "PATCH", path: "/api/v1/subscriptions/:id/inputs" }],
|
|
1681
|
+
channels: ["mcp"],
|
|
1682
|
+
idempotent: true,
|
|
1683
|
+
guardrails: ["Bad values answer 422 invalid_line_inputs with details.lines naming each field."]
|
|
1684
|
+
},
|
|
1685
|
+
// ------------------------------------------------------------ order fees
|
|
1686
|
+
{
|
|
1687
|
+
id: "list_fees",
|
|
1688
|
+
title: "List order fees",
|
|
1689
|
+
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.",
|
|
1690
|
+
kind: "read",
|
|
1691
|
+
scopes: ["applications:read"],
|
|
1692
|
+
input: [],
|
|
1693
|
+
requests: [{ method: "GET", path: "/api/v1/fees" }],
|
|
1694
|
+
channels: ["mcp"]
|
|
1695
|
+
},
|
|
1629
1696
|
// ------------------------------------------------------------ customer groups
|
|
1630
1697
|
{
|
|
1631
1698
|
id: "list_customer_groups",
|
|
@@ -2596,6 +2663,20 @@ var HANDLERS = {
|
|
|
2596
2663
|
},
|
|
2597
2664
|
idempotencyKey: `mcp-update-customer-${String(args.id)}-${Date.now()}`
|
|
2598
2665
|
}),
|
|
2666
|
+
update_order_line_inputs: async (ctx, args) => ctx.client.patch(
|
|
2667
|
+
`/api/v1/orders/${encodeURIComponent(String(args.orderId))}/line-items/${encodeURIComponent(String(args.lineItemId))}/inputs`,
|
|
2668
|
+
{
|
|
2669
|
+
// The ids are path parameters; the body is `.strict()`.
|
|
2670
|
+
body: { inputs: args.inputs, skipInputValidation: args.skipInputValidation },
|
|
2671
|
+
idempotencyKey: `mcp-update-order-line-inputs-${String(args.orderId)}-${String(args.lineItemId)}-${Date.now()}`
|
|
2672
|
+
}
|
|
2673
|
+
),
|
|
2674
|
+
update_subscription_inputs: async (ctx, args) => ctx.client.patch(`/api/v1/subscriptions/${encodeURIComponent(String(args.id))}/inputs`, {
|
|
2675
|
+
body: { inputs: args.inputs, skipInputValidation: args.skipInputValidation },
|
|
2676
|
+
idempotencyKey: `mcp-update-subscription-inputs-${String(args.id)}-${Date.now()}`
|
|
2677
|
+
}),
|
|
2678
|
+
// ----------------------------------------------------------- order fees
|
|
2679
|
+
list_fees: async (ctx) => ctx.client.get("/api/v1/fees"),
|
|
2599
2680
|
// ----------------------------------------------------------- customer groups
|
|
2600
2681
|
list_customer_groups: async (ctx) => ctx.client.get("/api/v1/customer-groups"),
|
|
2601
2682
|
get_customer_group: async (ctx, args) => ctx.client.get(`/api/v1/customer-groups/${String(args.id)}`),
|
|
@@ -3158,11 +3239,14 @@ var LINE_ITEM = {
|
|
|
3158
3239
|
// amount: a trial line's renewal price; schedule: per-unit installment amounts.
|
|
3159
3240
|
recurring: { amount: M, scheduleUnitTotal: M, schedule: [{ amount: M }] }
|
|
3160
3241
|
};
|
|
3242
|
+
var FEE = { baseAmount: M, amount: M, taxAmount: M };
|
|
3161
3243
|
var ORDER = {
|
|
3162
3244
|
subtotal: M,
|
|
3163
3245
|
discountTotal: M,
|
|
3164
3246
|
shippingTotal: M,
|
|
3165
3247
|
shippingDiscountTotal: M,
|
|
3248
|
+
feeTotal: M,
|
|
3249
|
+
fees: [FEE],
|
|
3166
3250
|
taxTotal: M,
|
|
3167
3251
|
total: M,
|
|
3168
3252
|
capturedAmount: M,
|
|
@@ -3190,7 +3274,8 @@ var SUBSCRIPTION = {
|
|
|
3190
3274
|
scheduleTotal: M,
|
|
3191
3275
|
nextPaymentAmount: M,
|
|
3192
3276
|
paymentSchedule: [{ amount: M, discount: M, net: M }],
|
|
3193
|
-
renewalIssue: { charge: { amount: M } }
|
|
3277
|
+
renewalIssue: { charge: { amount: M } },
|
|
3278
|
+
fees: [FEE]
|
|
3194
3279
|
};
|
|
3195
3280
|
var QUOTE_ITEM = {
|
|
3196
3281
|
unitPrice: M,
|
|
@@ -3204,6 +3289,8 @@ var QUOTE_REVISION = {
|
|
|
3204
3289
|
subtotal: M,
|
|
3205
3290
|
discountTotal: M,
|
|
3206
3291
|
shippingTotal: M,
|
|
3292
|
+
feeTotal: M,
|
|
3293
|
+
fees: [FEE],
|
|
3207
3294
|
taxTotal: M,
|
|
3208
3295
|
total: M,
|
|
3209
3296
|
depositAmount: M,
|
|
@@ -3226,15 +3313,19 @@ var INVOICE = {
|
|
|
3226
3313
|
taxTotal: M,
|
|
3227
3314
|
shippingTotal: M,
|
|
3228
3315
|
discountTotal: M,
|
|
3316
|
+
feeTotal: M,
|
|
3317
|
+
fees: [{ amount: M }],
|
|
3229
3318
|
total: M,
|
|
3230
3319
|
amountRefunded: M,
|
|
3231
3320
|
billingSnapshot: {
|
|
3232
3321
|
lineItems: [{ unitPrice: M, taxAmount: M, discountAmount: M, total: M }],
|
|
3322
|
+
fees: [FEE],
|
|
3233
3323
|
totals: {
|
|
3234
3324
|
subtotal: M,
|
|
3235
3325
|
taxTotal: M,
|
|
3236
3326
|
shippingTotal: M,
|
|
3237
3327
|
discountTotal: M,
|
|
3328
|
+
feeTotal: M,
|
|
3238
3329
|
total: M,
|
|
3239
3330
|
orderTotal: M,
|
|
3240
3331
|
amountPaid: M,
|
|
@@ -3255,6 +3346,8 @@ var CART = {
|
|
|
3255
3346
|
discountTotal: M,
|
|
3256
3347
|
shippingTotal: M,
|
|
3257
3348
|
shippingDiscountTotal: M,
|
|
3349
|
+
feeTotal: M,
|
|
3350
|
+
fees: [FEE],
|
|
3258
3351
|
total: M,
|
|
3259
3352
|
lineItems: [LINE_ITEM],
|
|
3260
3353
|
items: [LINE_ITEM],
|
|
@@ -3337,9 +3430,13 @@ var MONEY_SPECS = {
|
|
|
3337
3430
|
create_quote: { quote: QUOTE_SUMMARY, revision: QUOTE_REVISION, items: [QUOTE_ITEM] },
|
|
3338
3431
|
manage_subscription: SUBSCRIPTION,
|
|
3339
3432
|
set_subscription_payment_method: SUBSCRIPTION,
|
|
3433
|
+
update_order_line_inputs: ORDER,
|
|
3434
|
+
update_subscription_inputs: SUBSCRIPTION,
|
|
3340
3435
|
// GET /api/v1/stores: `settings.shipping` is stamped with its own currency
|
|
3341
3436
|
// (MC1-R74); an unstamped one takes the store's.
|
|
3342
3437
|
list_applications: [{ settings: { shipping: { flatRateCents: M, freeThresholdCents: M } } }],
|
|
3438
|
+
// GET /api/v1/fees: fee definitions hold per-currency amounts, keyed by the currency code.
|
|
3439
|
+
list_fees: [{ flatAmounts: MK(M), minAmounts: MK(M), maxAmounts: MK(M), minOrderAmounts: MK(M) }],
|
|
3343
3440
|
// ---------------------------------------------------------------- analytics
|
|
3344
3441
|
get_sales_timeseries: {
|
|
3345
3442
|
totalGrossCents: DROP,
|
|
@@ -3556,6 +3653,7 @@ var LINE_RECURRING = {
|
|
|
3556
3653
|
// A custom installment schedule: amounts are money, gaps are numbers and unit tokens, no free text.
|
|
3557
3654
|
schedule: [{ amount: MONEY, intervalUnit: S, intervalCount: S }]
|
|
3558
3655
|
};
|
|
3656
|
+
var LINE_INPUTS = [{ key: S, label: T, type: S }];
|
|
3559
3657
|
var LINE_ITEM2 = {
|
|
3560
3658
|
id: S,
|
|
3561
3659
|
type: S,
|
|
@@ -3567,7 +3665,25 @@ var LINE_ITEM2 = {
|
|
|
3567
3665
|
total: MONEY,
|
|
3568
3666
|
// amount = renewal price on a trial line (whose unitPrice is 0); count = the old display mirror.
|
|
3569
3667
|
recurring: { ...LINE_RECURRING, amount: MONEY, count: S, scheduleUnitTotal: MONEY },
|
|
3570
|
-
subscriptionId: S
|
|
3668
|
+
subscriptionId: S,
|
|
3669
|
+
inputs: LINE_INPUTS,
|
|
3670
|
+
// An add-on line points at its parent; the group label is the merchant's own.
|
|
3671
|
+
parentLineId: S,
|
|
3672
|
+
addOnGroupId: S,
|
|
3673
|
+
addOnGroupLabel: T
|
|
3674
|
+
};
|
|
3675
|
+
var FEE2 = {
|
|
3676
|
+
id: S,
|
|
3677
|
+
source: S,
|
|
3678
|
+
label: T,
|
|
3679
|
+
kind: S,
|
|
3680
|
+
rateBps: S,
|
|
3681
|
+
baseAmount: MONEY,
|
|
3682
|
+
amount: MONEY,
|
|
3683
|
+
taxable: S,
|
|
3684
|
+
taxAmount: MONEY,
|
|
3685
|
+
appliesToOneTime: S,
|
|
3686
|
+
appliesToSubscription: S
|
|
3571
3687
|
};
|
|
3572
3688
|
var ORDER2 = {
|
|
3573
3689
|
id: S,
|
|
@@ -3583,6 +3699,8 @@ var ORDER2 = {
|
|
|
3583
3699
|
discountTotal: MONEY,
|
|
3584
3700
|
shippingTotal: MONEY,
|
|
3585
3701
|
shippingDiscountTotal: MONEY,
|
|
3702
|
+
feeTotal: MONEY,
|
|
3703
|
+
fees: [FEE2],
|
|
3586
3704
|
taxTotal: MONEY,
|
|
3587
3705
|
total: MONEY,
|
|
3588
3706
|
capturedAmount: MONEY,
|
|
@@ -3693,10 +3811,12 @@ var SUBSCRIPTION2 = {
|
|
|
3693
3811
|
pendingIntervalCount: S,
|
|
3694
3812
|
scheduleTotal: MONEY,
|
|
3695
3813
|
nextPaymentAmount: MONEY,
|
|
3814
|
+
fees: [FEE2],
|
|
3696
3815
|
// A physical subscription (0236): the method is an enum, and the ship-to is
|
|
3697
3816
|
// kept to its country like every other address here.
|
|
3698
3817
|
deliveryMethod: S,
|
|
3699
3818
|
shippingAddress: ADDRESS,
|
|
3819
|
+
inputs: LINE_INPUTS,
|
|
3700
3820
|
paymentSchedule: [{
|
|
3701
3821
|
index: S,
|
|
3702
3822
|
amount: MONEY,
|
|
@@ -3732,6 +3852,8 @@ var QUOTE2 = {
|
|
|
3732
3852
|
subtotal: MONEY,
|
|
3733
3853
|
discountTotal: MONEY,
|
|
3734
3854
|
shippingTotal: MONEY,
|
|
3855
|
+
feeTotal: MONEY,
|
|
3856
|
+
fees: [FEE2],
|
|
3735
3857
|
taxTotal: MONEY,
|
|
3736
3858
|
total: MONEY,
|
|
3737
3859
|
depositAmount: MONEY,
|
|
@@ -3767,6 +3889,8 @@ var INVOICE2 = {
|
|
|
3767
3889
|
subtotal: MONEY,
|
|
3768
3890
|
discountTotal: MONEY,
|
|
3769
3891
|
shippingTotal: MONEY,
|
|
3892
|
+
feeTotal: MONEY,
|
|
3893
|
+
fees: [{ label: T, amount: MONEY }],
|
|
3770
3894
|
taxTotal: MONEY,
|
|
3771
3895
|
total: MONEY,
|
|
3772
3896
|
amountRefunded: MONEY,
|
|
@@ -3779,7 +3903,7 @@ var INVOICE2 = {
|
|
|
3779
3903
|
planName: T,
|
|
3780
3904
|
period: { start: S, end: S },
|
|
3781
3905
|
lineItems: [{ quantity: S, unitPrice: MONEY, discountAmount: MONEY, taxAmount: MONEY, total: MONEY }],
|
|
3782
|
-
totals: { currency: S, subtotal: MONEY, discountTotal: MONEY, shippingTotal: MONEY, taxTotal: MONEY, total: MONEY },
|
|
3906
|
+
totals: { currency: S, subtotal: MONEY, discountTotal: MONEY, shippingTotal: MONEY, feeTotal: MONEY, taxTotal: MONEY, total: MONEY },
|
|
3783
3907
|
payment: { method: S, brand: S, status: S }
|
|
3784
3908
|
}
|
|
3785
3909
|
};
|
|
@@ -3967,6 +4091,8 @@ var OAUTH_PROJECTIONS = {
|
|
|
3967
4091
|
discountTotal: MONEY,
|
|
3968
4092
|
shippingTotal: MONEY,
|
|
3969
4093
|
shippingDiscountTotal: MONEY,
|
|
4094
|
+
feeTotal: MONEY,
|
|
4095
|
+
fees: [FEE2],
|
|
3970
4096
|
taxTotal: MONEY,
|
|
3971
4097
|
total: MONEY,
|
|
3972
4098
|
itemCount: S,
|
|
@@ -4037,6 +4163,25 @@ var OAUTH_PROJECTIONS = {
|
|
|
4037
4163
|
get_workspace_settings: { name: T, slug: S, brandColor: S, logoUrl: T, onboardingCompletedAt: S },
|
|
4038
4164
|
// What happened and to which record; not which team member did it.
|
|
4039
4165
|
get_audit_log: page3({ id: S, action: S, resourceType: S, resourceId: S, createdAt: S }),
|
|
4166
|
+
list_fees: [{
|
|
4167
|
+
id: S,
|
|
4168
|
+
name: T,
|
|
4169
|
+
kind: S,
|
|
4170
|
+
rateBps: S,
|
|
4171
|
+
flatAmounts: mapOf(MONEY),
|
|
4172
|
+
minAmounts: mapOf(MONEY),
|
|
4173
|
+
maxAmounts: mapOf(MONEY),
|
|
4174
|
+
minOrderAmounts: mapOf(MONEY),
|
|
4175
|
+
taxable: S,
|
|
4176
|
+
taxCode: S,
|
|
4177
|
+
appliesToOneTime: S,
|
|
4178
|
+
appliesToSubscription: S,
|
|
4179
|
+
customerGroupIds: [S],
|
|
4180
|
+
active: S,
|
|
4181
|
+
sortOrder: S,
|
|
4182
|
+
createdAt: S,
|
|
4183
|
+
updatedAt: S
|
|
4184
|
+
}],
|
|
4040
4185
|
list_applications: [{ id: S, name: T, slug: S, currency: S, isActive: S }],
|
|
4041
4186
|
// Analytics: computed aggregates, listed field by field all the same.
|
|
4042
4187
|
get_business_summary: {
|
|
@@ -4136,7 +4281,7 @@ var OAUTH_PROJECTIONS = {
|
|
|
4136
4281
|
};
|
|
4137
4282
|
|
|
4138
4283
|
// src/server.ts
|
|
4139
|
-
var VERSION = true ? "0.
|
|
4284
|
+
var VERSION = true ? "0.12.0" : "0.0.0-dev";
|
|
4140
4285
|
function registerableActions(policy) {
|
|
4141
4286
|
const isProduction = policy.identity.environment.providerEnvironment === "production";
|
|
4142
4287
|
return actionsForChannel("mcp").filter((action) => {
|