@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.cjs
CHANGED
|
@@ -1533,6 +1533,62 @@ 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
|
+
},
|
|
1536
1592
|
// ------------------------------------------------------------ order fees
|
|
1537
1593
|
{
|
|
1538
1594
|
id: "list_fees",
|
|
@@ -2645,6 +2701,18 @@ var HANDLERS = {
|
|
|
2645
2701
|
},
|
|
2646
2702
|
idempotencyKey: `mcp-update-customer-${String(args.id)}-${Date.now()}`
|
|
2647
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
|
+
}),
|
|
2648
2716
|
// ----------------------------------------------------------- order fees
|
|
2649
2717
|
list_fees: async (ctx) => ctx.client.get("/api/v1/fees"),
|
|
2650
2718
|
// ----------------------------------------------------------- customer groups
|
|
@@ -3483,6 +3551,8 @@ var MONEY_SPECS = {
|
|
|
3483
3551
|
create_quote: { quote: QUOTE_SUMMARY, revision: QUOTE_REVISION, items: [QUOTE_ITEM] },
|
|
3484
3552
|
manage_subscription: SUBSCRIPTION,
|
|
3485
3553
|
set_subscription_payment_method: SUBSCRIPTION,
|
|
3554
|
+
update_order_line_inputs: ORDER,
|
|
3555
|
+
update_subscription_inputs: SUBSCRIPTION,
|
|
3486
3556
|
// GET /api/v1/stores: `settings.shipping` is stamped with its own currency
|
|
3487
3557
|
// (MC1-R74); an unstamped one takes the store's.
|
|
3488
3558
|
list_applications: [{ settings: { shipping: { flatRateCents: M, freeThresholdCents: M } } }],
|
|
@@ -3704,6 +3774,7 @@ var LINE_RECURRING = {
|
|
|
3704
3774
|
// A custom installment schedule: amounts are money, gaps are numbers and unit tokens, no free text.
|
|
3705
3775
|
schedule: [{ amount: MONEY, intervalUnit: S, intervalCount: S }]
|
|
3706
3776
|
};
|
|
3777
|
+
var LINE_INPUTS = [{ key: S, label: T, type: S }];
|
|
3707
3778
|
var LINE_ITEM2 = {
|
|
3708
3779
|
id: S,
|
|
3709
3780
|
type: S,
|
|
@@ -3715,7 +3786,12 @@ var LINE_ITEM2 = {
|
|
|
3715
3786
|
total: MONEY,
|
|
3716
3787
|
// amount = renewal price on a trial line (whose unitPrice is 0); count = the old display mirror.
|
|
3717
3788
|
recurring: { ...LINE_RECURRING, amount: MONEY, count: S, scheduleUnitTotal: MONEY },
|
|
3718
|
-
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
|
|
3719
3795
|
};
|
|
3720
3796
|
var FEE2 = {
|
|
3721
3797
|
id: S,
|
|
@@ -3861,6 +3937,7 @@ var SUBSCRIPTION2 = {
|
|
|
3861
3937
|
// kept to its country like every other address here.
|
|
3862
3938
|
deliveryMethod: S,
|
|
3863
3939
|
shippingAddress: ADDRESS,
|
|
3940
|
+
inputs: LINE_INPUTS,
|
|
3864
3941
|
paymentSchedule: [{
|
|
3865
3942
|
index: S,
|
|
3866
3943
|
amount: MONEY,
|
|
@@ -4325,7 +4402,7 @@ var OAUTH_PROJECTIONS = {
|
|
|
4325
4402
|
};
|
|
4326
4403
|
|
|
4327
4404
|
// src/server.ts
|
|
4328
|
-
var VERSION = true ? "0.
|
|
4405
|
+
var VERSION = true ? "0.12.0" : "0.0.0-dev";
|
|
4329
4406
|
function registerableActions(policy) {
|
|
4330
4407
|
const isProduction = policy.identity.environment.providerEnvironment === "production";
|
|
4331
4408
|
return actionsForChannel("mcp").filter((action) => {
|