@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.js
CHANGED
|
@@ -1496,6 +1496,73 @@ var ACTIONS = [
|
|
|
1496
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."
|
|
1497
1497
|
]
|
|
1498
1498
|
},
|
|
1499
|
+
{
|
|
1500
|
+
id: "update_order_line_inputs",
|
|
1501
|
+
title: "Edit the product inputs on an order line",
|
|
1502
|
+
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.",
|
|
1503
|
+
kind: "write",
|
|
1504
|
+
scopes: ["orders:write"],
|
|
1505
|
+
input: [
|
|
1506
|
+
{ name: "orderId", type: "string", required: true, description: "Order id." },
|
|
1507
|
+
{ name: "lineItemId", type: "string", required: true, description: "Id of the line on that order (not an add-on line)." },
|
|
1508
|
+
{
|
|
1509
|
+
name: "inputs",
|
|
1510
|
+
type: "object",
|
|
1511
|
+
required: true,
|
|
1512
|
+
description: "Input values by key (string or number). Replaces the line's current inputs."
|
|
1513
|
+
},
|
|
1514
|
+
{
|
|
1515
|
+
name: "skipInputValidation",
|
|
1516
|
+
type: "boolean",
|
|
1517
|
+
required: false,
|
|
1518
|
+
description: "Store the inputs without checking them against the product definitions. Secret keys only."
|
|
1519
|
+
}
|
|
1520
|
+
],
|
|
1521
|
+
requests: [{ method: "PATCH", path: "/api/v1/orders/:orderId/line-items/:lineItemId/inputs" }],
|
|
1522
|
+
channels: ["mcp"],
|
|
1523
|
+
idempotent: true,
|
|
1524
|
+
guardrails: [
|
|
1525
|
+
"Bad values answer 422 invalid_line_inputs with details.lines naming each field. A line that has shipped answers 409 line_already_fulfilled.",
|
|
1526
|
+
"The edit is recorded in the order history and emits order.edited with changedFields lineItemInputs."
|
|
1527
|
+
]
|
|
1528
|
+
},
|
|
1529
|
+
{
|
|
1530
|
+
id: "update_subscription_inputs",
|
|
1531
|
+
title: "Edit the product inputs on a subscription",
|
|
1532
|
+
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.",
|
|
1533
|
+
kind: "write",
|
|
1534
|
+
scopes: ["subscriptions:write"],
|
|
1535
|
+
input: [
|
|
1536
|
+
{ name: "id", type: "string", required: true, description: "Subscription id." },
|
|
1537
|
+
{
|
|
1538
|
+
name: "inputs",
|
|
1539
|
+
type: "object",
|
|
1540
|
+
required: true,
|
|
1541
|
+
description: "Input values by key (string or number). Replaces the current inputs; an empty object clears them."
|
|
1542
|
+
},
|
|
1543
|
+
{
|
|
1544
|
+
name: "skipInputValidation",
|
|
1545
|
+
type: "boolean",
|
|
1546
|
+
required: false,
|
|
1547
|
+
description: "Store the inputs without checking them against the product definitions. Secret keys only."
|
|
1548
|
+
}
|
|
1549
|
+
],
|
|
1550
|
+
requests: [{ method: "PATCH", path: "/api/v1/subscriptions/:id/inputs" }],
|
|
1551
|
+
channels: ["mcp"],
|
|
1552
|
+
idempotent: true,
|
|
1553
|
+
guardrails: ["Bad values answer 422 invalid_line_inputs with details.lines naming each field."]
|
|
1554
|
+
},
|
|
1555
|
+
// ------------------------------------------------------------ order fees
|
|
1556
|
+
{
|
|
1557
|
+
id: "list_fees",
|
|
1558
|
+
title: "List order fees",
|
|
1559
|
+
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.",
|
|
1560
|
+
kind: "read",
|
|
1561
|
+
scopes: ["applications:read"],
|
|
1562
|
+
input: [],
|
|
1563
|
+
requests: [{ method: "GET", path: "/api/v1/fees" }],
|
|
1564
|
+
channels: ["mcp"]
|
|
1565
|
+
},
|
|
1499
1566
|
// ------------------------------------------------------------ customer groups
|
|
1500
1567
|
{
|
|
1501
1568
|
id: "list_customer_groups",
|
|
@@ -2597,6 +2664,20 @@ var HANDLERS = {
|
|
|
2597
2664
|
},
|
|
2598
2665
|
idempotencyKey: `mcp-update-customer-${String(args.id)}-${Date.now()}`
|
|
2599
2666
|
}),
|
|
2667
|
+
update_order_line_inputs: async (ctx, args) => ctx.client.patch(
|
|
2668
|
+
`/api/v1/orders/${encodeURIComponent(String(args.orderId))}/line-items/${encodeURIComponent(String(args.lineItemId))}/inputs`,
|
|
2669
|
+
{
|
|
2670
|
+
// The ids are path parameters; the body is `.strict()`.
|
|
2671
|
+
body: { inputs: args.inputs, skipInputValidation: args.skipInputValidation },
|
|
2672
|
+
idempotencyKey: `mcp-update-order-line-inputs-${String(args.orderId)}-${String(args.lineItemId)}-${Date.now()}`
|
|
2673
|
+
}
|
|
2674
|
+
),
|
|
2675
|
+
update_subscription_inputs: async (ctx, args) => ctx.client.patch(`/api/v1/subscriptions/${encodeURIComponent(String(args.id))}/inputs`, {
|
|
2676
|
+
body: { inputs: args.inputs, skipInputValidation: args.skipInputValidation },
|
|
2677
|
+
idempotencyKey: `mcp-update-subscription-inputs-${String(args.id)}-${Date.now()}`
|
|
2678
|
+
}),
|
|
2679
|
+
// ----------------------------------------------------------- order fees
|
|
2680
|
+
list_fees: async (ctx) => ctx.client.get("/api/v1/fees"),
|
|
2600
2681
|
// ----------------------------------------------------------- customer groups
|
|
2601
2682
|
list_customer_groups: async (ctx) => ctx.client.get("/api/v1/customer-groups"),
|
|
2602
2683
|
get_customer_group: async (ctx, args) => ctx.client.get(`/api/v1/customer-groups/${String(args.id)}`),
|
|
@@ -3242,11 +3323,14 @@ var LINE_ITEM = {
|
|
|
3242
3323
|
// amount: a trial line's renewal price; schedule: per-unit installment amounts.
|
|
3243
3324
|
recurring: { amount: M, scheduleUnitTotal: M, schedule: [{ amount: M }] }
|
|
3244
3325
|
};
|
|
3326
|
+
var FEE = { baseAmount: M, amount: M, taxAmount: M };
|
|
3245
3327
|
var ORDER = {
|
|
3246
3328
|
subtotal: M,
|
|
3247
3329
|
discountTotal: M,
|
|
3248
3330
|
shippingTotal: M,
|
|
3249
3331
|
shippingDiscountTotal: M,
|
|
3332
|
+
feeTotal: M,
|
|
3333
|
+
fees: [FEE],
|
|
3250
3334
|
taxTotal: M,
|
|
3251
3335
|
total: M,
|
|
3252
3336
|
capturedAmount: M,
|
|
@@ -3274,7 +3358,8 @@ var SUBSCRIPTION = {
|
|
|
3274
3358
|
scheduleTotal: M,
|
|
3275
3359
|
nextPaymentAmount: M,
|
|
3276
3360
|
paymentSchedule: [{ amount: M, discount: M, net: M }],
|
|
3277
|
-
renewalIssue: { charge: { amount: M } }
|
|
3361
|
+
renewalIssue: { charge: { amount: M } },
|
|
3362
|
+
fees: [FEE]
|
|
3278
3363
|
};
|
|
3279
3364
|
var QUOTE_ITEM = {
|
|
3280
3365
|
unitPrice: M,
|
|
@@ -3288,6 +3373,8 @@ var QUOTE_REVISION = {
|
|
|
3288
3373
|
subtotal: M,
|
|
3289
3374
|
discountTotal: M,
|
|
3290
3375
|
shippingTotal: M,
|
|
3376
|
+
feeTotal: M,
|
|
3377
|
+
fees: [FEE],
|
|
3291
3378
|
taxTotal: M,
|
|
3292
3379
|
total: M,
|
|
3293
3380
|
depositAmount: M,
|
|
@@ -3310,15 +3397,19 @@ var INVOICE = {
|
|
|
3310
3397
|
taxTotal: M,
|
|
3311
3398
|
shippingTotal: M,
|
|
3312
3399
|
discountTotal: M,
|
|
3400
|
+
feeTotal: M,
|
|
3401
|
+
fees: [{ amount: M }],
|
|
3313
3402
|
total: M,
|
|
3314
3403
|
amountRefunded: M,
|
|
3315
3404
|
billingSnapshot: {
|
|
3316
3405
|
lineItems: [{ unitPrice: M, taxAmount: M, discountAmount: M, total: M }],
|
|
3406
|
+
fees: [FEE],
|
|
3317
3407
|
totals: {
|
|
3318
3408
|
subtotal: M,
|
|
3319
3409
|
taxTotal: M,
|
|
3320
3410
|
shippingTotal: M,
|
|
3321
3411
|
discountTotal: M,
|
|
3412
|
+
feeTotal: M,
|
|
3322
3413
|
total: M,
|
|
3323
3414
|
orderTotal: M,
|
|
3324
3415
|
amountPaid: M,
|
|
@@ -3339,6 +3430,8 @@ var CART = {
|
|
|
3339
3430
|
discountTotal: M,
|
|
3340
3431
|
shippingTotal: M,
|
|
3341
3432
|
shippingDiscountTotal: M,
|
|
3433
|
+
feeTotal: M,
|
|
3434
|
+
fees: [FEE],
|
|
3342
3435
|
total: M,
|
|
3343
3436
|
lineItems: [LINE_ITEM],
|
|
3344
3437
|
items: [LINE_ITEM],
|
|
@@ -3421,9 +3514,13 @@ var MONEY_SPECS = {
|
|
|
3421
3514
|
create_quote: { quote: QUOTE_SUMMARY, revision: QUOTE_REVISION, items: [QUOTE_ITEM] },
|
|
3422
3515
|
manage_subscription: SUBSCRIPTION,
|
|
3423
3516
|
set_subscription_payment_method: SUBSCRIPTION,
|
|
3517
|
+
update_order_line_inputs: ORDER,
|
|
3518
|
+
update_subscription_inputs: SUBSCRIPTION,
|
|
3424
3519
|
// GET /api/v1/stores: `settings.shipping` is stamped with its own currency
|
|
3425
3520
|
// (MC1-R74); an unstamped one takes the store's.
|
|
3426
3521
|
list_applications: [{ settings: { shipping: { flatRateCents: M, freeThresholdCents: M } } }],
|
|
3522
|
+
// GET /api/v1/fees: fee definitions hold per-currency amounts, keyed by the currency code.
|
|
3523
|
+
list_fees: [{ flatAmounts: MK(M), minAmounts: MK(M), maxAmounts: MK(M), minOrderAmounts: MK(M) }],
|
|
3427
3524
|
// ---------------------------------------------------------------- analytics
|
|
3428
3525
|
get_sales_timeseries: {
|
|
3429
3526
|
totalGrossCents: DROP,
|
|
@@ -3640,6 +3737,7 @@ var LINE_RECURRING = {
|
|
|
3640
3737
|
// A custom installment schedule: amounts are money, gaps are numbers and unit tokens, no free text.
|
|
3641
3738
|
schedule: [{ amount: MONEY, intervalUnit: S, intervalCount: S }]
|
|
3642
3739
|
};
|
|
3740
|
+
var LINE_INPUTS = [{ key: S, label: T, type: S }];
|
|
3643
3741
|
var LINE_ITEM2 = {
|
|
3644
3742
|
id: S,
|
|
3645
3743
|
type: S,
|
|
@@ -3651,7 +3749,25 @@ var LINE_ITEM2 = {
|
|
|
3651
3749
|
total: MONEY,
|
|
3652
3750
|
// amount = renewal price on a trial line (whose unitPrice is 0); count = the old display mirror.
|
|
3653
3751
|
recurring: { ...LINE_RECURRING, amount: MONEY, count: S, scheduleUnitTotal: MONEY },
|
|
3654
|
-
subscriptionId: S
|
|
3752
|
+
subscriptionId: S,
|
|
3753
|
+
inputs: LINE_INPUTS,
|
|
3754
|
+
// An add-on line points at its parent; the group label is the merchant's own.
|
|
3755
|
+
parentLineId: S,
|
|
3756
|
+
addOnGroupId: S,
|
|
3757
|
+
addOnGroupLabel: T
|
|
3758
|
+
};
|
|
3759
|
+
var FEE2 = {
|
|
3760
|
+
id: S,
|
|
3761
|
+
source: S,
|
|
3762
|
+
label: T,
|
|
3763
|
+
kind: S,
|
|
3764
|
+
rateBps: S,
|
|
3765
|
+
baseAmount: MONEY,
|
|
3766
|
+
amount: MONEY,
|
|
3767
|
+
taxable: S,
|
|
3768
|
+
taxAmount: MONEY,
|
|
3769
|
+
appliesToOneTime: S,
|
|
3770
|
+
appliesToSubscription: S
|
|
3655
3771
|
};
|
|
3656
3772
|
var ORDER2 = {
|
|
3657
3773
|
id: S,
|
|
@@ -3667,6 +3783,8 @@ var ORDER2 = {
|
|
|
3667
3783
|
discountTotal: MONEY,
|
|
3668
3784
|
shippingTotal: MONEY,
|
|
3669
3785
|
shippingDiscountTotal: MONEY,
|
|
3786
|
+
feeTotal: MONEY,
|
|
3787
|
+
fees: [FEE2],
|
|
3670
3788
|
taxTotal: MONEY,
|
|
3671
3789
|
total: MONEY,
|
|
3672
3790
|
capturedAmount: MONEY,
|
|
@@ -3777,10 +3895,12 @@ var SUBSCRIPTION2 = {
|
|
|
3777
3895
|
pendingIntervalCount: S,
|
|
3778
3896
|
scheduleTotal: MONEY,
|
|
3779
3897
|
nextPaymentAmount: MONEY,
|
|
3898
|
+
fees: [FEE2],
|
|
3780
3899
|
// A physical subscription (0236): the method is an enum, and the ship-to is
|
|
3781
3900
|
// kept to its country like every other address here.
|
|
3782
3901
|
deliveryMethod: S,
|
|
3783
3902
|
shippingAddress: ADDRESS,
|
|
3903
|
+
inputs: LINE_INPUTS,
|
|
3784
3904
|
paymentSchedule: [{
|
|
3785
3905
|
index: S,
|
|
3786
3906
|
amount: MONEY,
|
|
@@ -3816,6 +3936,8 @@ var QUOTE2 = {
|
|
|
3816
3936
|
subtotal: MONEY,
|
|
3817
3937
|
discountTotal: MONEY,
|
|
3818
3938
|
shippingTotal: MONEY,
|
|
3939
|
+
feeTotal: MONEY,
|
|
3940
|
+
fees: [FEE2],
|
|
3819
3941
|
taxTotal: MONEY,
|
|
3820
3942
|
total: MONEY,
|
|
3821
3943
|
depositAmount: MONEY,
|
|
@@ -3851,6 +3973,8 @@ var INVOICE2 = {
|
|
|
3851
3973
|
subtotal: MONEY,
|
|
3852
3974
|
discountTotal: MONEY,
|
|
3853
3975
|
shippingTotal: MONEY,
|
|
3976
|
+
feeTotal: MONEY,
|
|
3977
|
+
fees: [{ label: T, amount: MONEY }],
|
|
3854
3978
|
taxTotal: MONEY,
|
|
3855
3979
|
total: MONEY,
|
|
3856
3980
|
amountRefunded: MONEY,
|
|
@@ -3863,7 +3987,7 @@ var INVOICE2 = {
|
|
|
3863
3987
|
planName: T,
|
|
3864
3988
|
period: { start: S, end: S },
|
|
3865
3989
|
lineItems: [{ quantity: S, unitPrice: MONEY, discountAmount: MONEY, taxAmount: MONEY, total: MONEY }],
|
|
3866
|
-
totals: { currency: S, subtotal: MONEY, discountTotal: MONEY, shippingTotal: MONEY, taxTotal: MONEY, total: MONEY },
|
|
3990
|
+
totals: { currency: S, subtotal: MONEY, discountTotal: MONEY, shippingTotal: MONEY, feeTotal: MONEY, taxTotal: MONEY, total: MONEY },
|
|
3867
3991
|
payment: { method: S, brand: S, status: S }
|
|
3868
3992
|
}
|
|
3869
3993
|
};
|
|
@@ -4051,6 +4175,8 @@ var OAUTH_PROJECTIONS = {
|
|
|
4051
4175
|
discountTotal: MONEY,
|
|
4052
4176
|
shippingTotal: MONEY,
|
|
4053
4177
|
shippingDiscountTotal: MONEY,
|
|
4178
|
+
feeTotal: MONEY,
|
|
4179
|
+
fees: [FEE2],
|
|
4054
4180
|
taxTotal: MONEY,
|
|
4055
4181
|
total: MONEY,
|
|
4056
4182
|
itemCount: S,
|
|
@@ -4121,6 +4247,25 @@ var OAUTH_PROJECTIONS = {
|
|
|
4121
4247
|
get_workspace_settings: { name: T, slug: S, brandColor: S, logoUrl: T, onboardingCompletedAt: S },
|
|
4122
4248
|
// What happened and to which record; not which team member did it.
|
|
4123
4249
|
get_audit_log: page3({ id: S, action: S, resourceType: S, resourceId: S, createdAt: S }),
|
|
4250
|
+
list_fees: [{
|
|
4251
|
+
id: S,
|
|
4252
|
+
name: T,
|
|
4253
|
+
kind: S,
|
|
4254
|
+
rateBps: S,
|
|
4255
|
+
flatAmounts: mapOf(MONEY),
|
|
4256
|
+
minAmounts: mapOf(MONEY),
|
|
4257
|
+
maxAmounts: mapOf(MONEY),
|
|
4258
|
+
minOrderAmounts: mapOf(MONEY),
|
|
4259
|
+
taxable: S,
|
|
4260
|
+
taxCode: S,
|
|
4261
|
+
appliesToOneTime: S,
|
|
4262
|
+
appliesToSubscription: S,
|
|
4263
|
+
customerGroupIds: [S],
|
|
4264
|
+
active: S,
|
|
4265
|
+
sortOrder: S,
|
|
4266
|
+
createdAt: S,
|
|
4267
|
+
updatedAt: S
|
|
4268
|
+
}],
|
|
4124
4269
|
list_applications: [{ id: S, name: T, slug: S, currency: S, isActive: S }],
|
|
4125
4270
|
// Analytics: computed aggregates, listed field by field all the same.
|
|
4126
4271
|
get_business_summary: {
|
|
@@ -4220,7 +4365,7 @@ var OAUTH_PROJECTIONS = {
|
|
|
4220
4365
|
};
|
|
4221
4366
|
|
|
4222
4367
|
// src/server.ts
|
|
4223
|
-
var VERSION = true ? "0.
|
|
4368
|
+
var VERSION = true ? "0.12.0" : "0.0.0-dev";
|
|
4224
4369
|
function registerableActions(policy) {
|
|
4225
4370
|
const isProduction = policy.identity.environment.providerEnvironment === "production";
|
|
4226
4371
|
return actionsForChannel("mcp").filter((action) => {
|