@usethrottle/mcp 0.3.0 → 0.4.1

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
@@ -444,6 +444,29 @@ function redactShopperPii(value) {
444
444
  return walk(value, null, 0);
445
445
  }
446
446
 
447
+ // ../core-scopes/src/public-payment.ts
448
+ var RAW_PROCESSOR_KEYS = ["processorResponse", "gr4vy_payment_method"];
449
+ var RAW = new Set(RAW_PROCESSOR_KEYS);
450
+ function isPlainObject2(value) {
451
+ if (value === null || typeof value !== "object") return false;
452
+ const proto = Object.getPrototypeOf(value);
453
+ return proto === Object.prototype || proto === null;
454
+ }
455
+ function strip(value, depth) {
456
+ if (depth > 32) return value;
457
+ if (Array.isArray(value)) return value.map((v) => strip(v, depth + 1));
458
+ if (!isPlainObject2(value)) return value;
459
+ const out = {};
460
+ for (const [key, child] of Object.entries(value)) {
461
+ if (RAW.has(key)) continue;
462
+ out[key] = strip(child, depth + 1);
463
+ }
464
+ return out;
465
+ }
466
+ function stripRawProcessorData(value) {
467
+ return strip(value, 0);
468
+ }
469
+
447
470
  // ../action-catalog/src/actions.ts
448
471
  var OAUTH_WITHHELD = "Over an OAuth connection (ChatGPT, Claude) these are withheld, because a buyer can type them: line-item and quote-item names, SKUs and reference ids; company; every address line except the country; the merchant's external ids; notes, messages, reasons and metadata. Describe items by quantity and amount, and say the rest is withheld rather than missing.";
449
472
  var ACTIONS = [
@@ -2679,7 +2702,9 @@ var LINE_RECURRING = {
2679
2702
  intervalUnit: S,
2680
2703
  intervalCount: S,
2681
2704
  totalPayments: S,
2682
- trialDays: S
2705
+ trialDays: S,
2706
+ // A custom installment schedule: amounts and gaps are numbers and unit tokens, no free text.
2707
+ schedule: [{ amount: S, intervalUnit: S, intervalCount: S }]
2683
2708
  };
2684
2709
  var LINE_ITEM = {
2685
2710
  id: S,
@@ -2691,7 +2716,7 @@ var LINE_ITEM = {
2691
2716
  taxAmount: S,
2692
2717
  total: S,
2693
2718
  // amount = renewal price on a trial line (whose unitPrice is 0); count = the old display mirror.
2694
- recurring: { ...LINE_RECURRING, amount: S, count: S },
2719
+ recurring: { ...LINE_RECURRING, amount: S, count: S, scheduleUnitTotal: S },
2695
2720
  subscriptionId: S
2696
2721
  };
2697
2722
  var ORDER = {
@@ -2798,6 +2823,18 @@ var SUBSCRIPTION = {
2798
2823
  pendingQuantity: S,
2799
2824
  pendingIntervalUnit: S,
2800
2825
  pendingIntervalCount: S,
2826
+ scheduleTotal: S,
2827
+ nextPaymentAmount: S,
2828
+ paymentSchedule: [{
2829
+ index: S,
2830
+ amount: S,
2831
+ discount: S,
2832
+ net: S,
2833
+ intervalUnit: S,
2834
+ intervalCount: S,
2835
+ status: S,
2836
+ dueAt: S
2837
+ }],
2801
2838
  createdAt: S
2802
2839
  };
2803
2840
  var QUOTE_SUMMARY = {
@@ -3020,7 +3057,9 @@ var OAUTH_PROJECTIONS = {
3020
3057
  trialDays: S,
3021
3058
  trialEndsAt: S,
3022
3059
  planChargedToday: S,
3023
- taxApplies: S
3060
+ taxApplies: S,
3061
+ scheduleGapUnits: [S],
3062
+ schedule: [{ net: S, dueAt: S }]
3024
3063
  }]
3025
3064
  },
3026
3065
  cart: section({
@@ -3162,7 +3201,7 @@ var OAUTH_PROJECTIONS = {
3162
3201
  };
3163
3202
 
3164
3203
  // src/server.ts
3165
- var VERSION = true ? "0.3.0" : "0.0.0-dev";
3204
+ var VERSION = true ? "0.4.1" : "0.0.0-dev";
3166
3205
  function registerableActions(policy) {
3167
3206
  const isProduction = policy.identity.environment.providerEnvironment === "production";
3168
3207
  return actionsForChannel("mcp").filter((action) => {
@@ -3275,7 +3314,7 @@ function createServer(options) {
3275
3314
  isError: true
3276
3315
  };
3277
3316
  }
3278
- const result = await handler(ctx, args ?? {});
3317
+ const result = stripRawProcessorData(await handler(ctx, args ?? {}));
3279
3318
  const shown = redactPii ? redactShopperPii(project(result, OAUTH_PROJECTIONS[action.id])) : result;
3280
3319
  return { content: [{ type: "text", text: formatResult(shown) }] };
3281
3320
  } catch (error) {