@usethrottle/mcp 0.11.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 +79 -2
- package/dist/lib.cjs.map +1 -1
- package/dist/lib.js +79 -2
- package/dist/lib.js.map +1 -1
- package/dist/mcp.js +79 -2
- package/dist/mcp.js.map +1 -1
- package/package.json +3 -3
package/dist/lib.js
CHANGED
|
@@ -1496,6 +1496,62 @@ 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
|
+
},
|
|
1499
1555
|
// ------------------------------------------------------------ order fees
|
|
1500
1556
|
{
|
|
1501
1557
|
id: "list_fees",
|
|
@@ -2608,6 +2664,18 @@ var HANDLERS = {
|
|
|
2608
2664
|
},
|
|
2609
2665
|
idempotencyKey: `mcp-update-customer-${String(args.id)}-${Date.now()}`
|
|
2610
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
|
+
}),
|
|
2611
2679
|
// ----------------------------------------------------------- order fees
|
|
2612
2680
|
list_fees: async (ctx) => ctx.client.get("/api/v1/fees"),
|
|
2613
2681
|
// ----------------------------------------------------------- customer groups
|
|
@@ -3446,6 +3514,8 @@ var MONEY_SPECS = {
|
|
|
3446
3514
|
create_quote: { quote: QUOTE_SUMMARY, revision: QUOTE_REVISION, items: [QUOTE_ITEM] },
|
|
3447
3515
|
manage_subscription: SUBSCRIPTION,
|
|
3448
3516
|
set_subscription_payment_method: SUBSCRIPTION,
|
|
3517
|
+
update_order_line_inputs: ORDER,
|
|
3518
|
+
update_subscription_inputs: SUBSCRIPTION,
|
|
3449
3519
|
// GET /api/v1/stores: `settings.shipping` is stamped with its own currency
|
|
3450
3520
|
// (MC1-R74); an unstamped one takes the store's.
|
|
3451
3521
|
list_applications: [{ settings: { shipping: { flatRateCents: M, freeThresholdCents: M } } }],
|
|
@@ -3667,6 +3737,7 @@ var LINE_RECURRING = {
|
|
|
3667
3737
|
// A custom installment schedule: amounts are money, gaps are numbers and unit tokens, no free text.
|
|
3668
3738
|
schedule: [{ amount: MONEY, intervalUnit: S, intervalCount: S }]
|
|
3669
3739
|
};
|
|
3740
|
+
var LINE_INPUTS = [{ key: S, label: T, type: S }];
|
|
3670
3741
|
var LINE_ITEM2 = {
|
|
3671
3742
|
id: S,
|
|
3672
3743
|
type: S,
|
|
@@ -3678,7 +3749,12 @@ var LINE_ITEM2 = {
|
|
|
3678
3749
|
total: MONEY,
|
|
3679
3750
|
// amount = renewal price on a trial line (whose unitPrice is 0); count = the old display mirror.
|
|
3680
3751
|
recurring: { ...LINE_RECURRING, amount: MONEY, count: S, scheduleUnitTotal: MONEY },
|
|
3681
|
-
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
|
|
3682
3758
|
};
|
|
3683
3759
|
var FEE2 = {
|
|
3684
3760
|
id: S,
|
|
@@ -3824,6 +3900,7 @@ var SUBSCRIPTION2 = {
|
|
|
3824
3900
|
// kept to its country like every other address here.
|
|
3825
3901
|
deliveryMethod: S,
|
|
3826
3902
|
shippingAddress: ADDRESS,
|
|
3903
|
+
inputs: LINE_INPUTS,
|
|
3827
3904
|
paymentSchedule: [{
|
|
3828
3905
|
index: S,
|
|
3829
3906
|
amount: MONEY,
|
|
@@ -4288,7 +4365,7 @@ var OAUTH_PROJECTIONS = {
|
|
|
4288
4365
|
};
|
|
4289
4366
|
|
|
4290
4367
|
// src/server.ts
|
|
4291
|
-
var VERSION = true ? "0.
|
|
4368
|
+
var VERSION = true ? "0.12.0" : "0.0.0-dev";
|
|
4292
4369
|
function registerableActions(policy) {
|
|
4293
4370
|
const isProduction = policy.identity.environment.providerEnvironment === "production";
|
|
4294
4371
|
return actionsForChannel("mcp").filter((action) => {
|