@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/mcp.js CHANGED
@@ -1626,6 +1626,62 @@ 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
+ },
1629
1685
  // ------------------------------------------------------------ order fees
1630
1686
  {
1631
1687
  id: "list_fees",
@@ -2607,6 +2663,18 @@ var HANDLERS = {
2607
2663
  },
2608
2664
  idempotencyKey: `mcp-update-customer-${String(args.id)}-${Date.now()}`
2609
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
+ }),
2610
2678
  // ----------------------------------------------------------- order fees
2611
2679
  list_fees: async (ctx) => ctx.client.get("/api/v1/fees"),
2612
2680
  // ----------------------------------------------------------- customer groups
@@ -3362,6 +3430,8 @@ var MONEY_SPECS = {
3362
3430
  create_quote: { quote: QUOTE_SUMMARY, revision: QUOTE_REVISION, items: [QUOTE_ITEM] },
3363
3431
  manage_subscription: SUBSCRIPTION,
3364
3432
  set_subscription_payment_method: SUBSCRIPTION,
3433
+ update_order_line_inputs: ORDER,
3434
+ update_subscription_inputs: SUBSCRIPTION,
3365
3435
  // GET /api/v1/stores: `settings.shipping` is stamped with its own currency
3366
3436
  // (MC1-R74); an unstamped one takes the store's.
3367
3437
  list_applications: [{ settings: { shipping: { flatRateCents: M, freeThresholdCents: M } } }],
@@ -3583,6 +3653,7 @@ var LINE_RECURRING = {
3583
3653
  // A custom installment schedule: amounts are money, gaps are numbers and unit tokens, no free text.
3584
3654
  schedule: [{ amount: MONEY, intervalUnit: S, intervalCount: S }]
3585
3655
  };
3656
+ var LINE_INPUTS = [{ key: S, label: T, type: S }];
3586
3657
  var LINE_ITEM2 = {
3587
3658
  id: S,
3588
3659
  type: S,
@@ -3594,7 +3665,12 @@ var LINE_ITEM2 = {
3594
3665
  total: MONEY,
3595
3666
  // amount = renewal price on a trial line (whose unitPrice is 0); count = the old display mirror.
3596
3667
  recurring: { ...LINE_RECURRING, amount: MONEY, count: S, scheduleUnitTotal: MONEY },
3597
- 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
3598
3674
  };
3599
3675
  var FEE2 = {
3600
3676
  id: S,
@@ -3740,6 +3816,7 @@ var SUBSCRIPTION2 = {
3740
3816
  // kept to its country like every other address here.
3741
3817
  deliveryMethod: S,
3742
3818
  shippingAddress: ADDRESS,
3819
+ inputs: LINE_INPUTS,
3743
3820
  paymentSchedule: [{
3744
3821
  index: S,
3745
3822
  amount: MONEY,
@@ -4204,7 +4281,7 @@ var OAUTH_PROJECTIONS = {
4204
4281
  };
4205
4282
 
4206
4283
  // src/server.ts
4207
- var VERSION = true ? "0.11.0" : "0.0.0-dev";
4284
+ var VERSION = true ? "0.12.0" : "0.0.0-dev";
4208
4285
  function registerableActions(policy) {
4209
4286
  const isProduction = policy.identity.environment.providerEnvironment === "production";
4210
4287
  return actionsForChannel("mcp").filter((action) => {