@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/lib.js CHANGED
@@ -312,6 +312,29 @@ function redactShopperPii(value) {
312
312
  return walk(value, null, 0);
313
313
  }
314
314
 
315
+ // ../core-scopes/src/public-payment.ts
316
+ var RAW_PROCESSOR_KEYS = ["processorResponse", "gr4vy_payment_method"];
317
+ var RAW = new Set(RAW_PROCESSOR_KEYS);
318
+ function isPlainObject2(value) {
319
+ if (value === null || typeof value !== "object") return false;
320
+ const proto = Object.getPrototypeOf(value);
321
+ return proto === Object.prototype || proto === null;
322
+ }
323
+ function strip(value, depth) {
324
+ if (depth > 32) return value;
325
+ if (Array.isArray(value)) return value.map((v) => strip(v, depth + 1));
326
+ if (!isPlainObject2(value)) return value;
327
+ const out = {};
328
+ for (const [key, child] of Object.entries(value)) {
329
+ if (RAW.has(key)) continue;
330
+ out[key] = strip(child, depth + 1);
331
+ }
332
+ return out;
333
+ }
334
+ function stripRawProcessorData(value) {
335
+ return strip(value, 0);
336
+ }
337
+
315
338
  // ../action-catalog/src/actions.ts
316
339
  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.";
317
340
  var ACTIONS = [
@@ -2674,7 +2697,9 @@ var LINE_RECURRING = {
2674
2697
  intervalUnit: S,
2675
2698
  intervalCount: S,
2676
2699
  totalPayments: S,
2677
- trialDays: S
2700
+ trialDays: S,
2701
+ // A custom installment schedule: amounts and gaps are numbers and unit tokens, no free text.
2702
+ schedule: [{ amount: S, intervalUnit: S, intervalCount: S }]
2678
2703
  };
2679
2704
  var LINE_ITEM = {
2680
2705
  id: S,
@@ -2686,7 +2711,7 @@ var LINE_ITEM = {
2686
2711
  taxAmount: S,
2687
2712
  total: S,
2688
2713
  // amount = renewal price on a trial line (whose unitPrice is 0); count = the old display mirror.
2689
- recurring: { ...LINE_RECURRING, amount: S, count: S },
2714
+ recurring: { ...LINE_RECURRING, amount: S, count: S, scheduleUnitTotal: S },
2690
2715
  subscriptionId: S
2691
2716
  };
2692
2717
  var ORDER = {
@@ -2793,6 +2818,18 @@ var SUBSCRIPTION = {
2793
2818
  pendingQuantity: S,
2794
2819
  pendingIntervalUnit: S,
2795
2820
  pendingIntervalCount: S,
2821
+ scheduleTotal: S,
2822
+ nextPaymentAmount: S,
2823
+ paymentSchedule: [{
2824
+ index: S,
2825
+ amount: S,
2826
+ discount: S,
2827
+ net: S,
2828
+ intervalUnit: S,
2829
+ intervalCount: S,
2830
+ status: S,
2831
+ dueAt: S
2832
+ }],
2796
2833
  createdAt: S
2797
2834
  };
2798
2835
  var QUOTE_SUMMARY = {
@@ -3015,7 +3052,9 @@ var OAUTH_PROJECTIONS = {
3015
3052
  trialDays: S,
3016
3053
  trialEndsAt: S,
3017
3054
  planChargedToday: S,
3018
- taxApplies: S
3055
+ taxApplies: S,
3056
+ scheduleGapUnits: [S],
3057
+ schedule: [{ net: S, dueAt: S }]
3019
3058
  }]
3020
3059
  },
3021
3060
  cart: section({
@@ -3157,7 +3196,7 @@ var OAUTH_PROJECTIONS = {
3157
3196
  };
3158
3197
 
3159
3198
  // src/server.ts
3160
- var VERSION = true ? "0.3.0" : "0.0.0-dev";
3199
+ var VERSION = true ? "0.4.1" : "0.0.0-dev";
3161
3200
  function registerableActions(policy) {
3162
3201
  const isProduction = policy.identity.environment.providerEnvironment === "production";
3163
3202
  return actionsForChannel("mcp").filter((action) => {
@@ -3270,7 +3309,7 @@ function createServer(options) {
3270
3309
  isError: true
3271
3310
  };
3272
3311
  }
3273
- const result = await handler(ctx, args ?? {});
3312
+ const result = stripRawProcessorData(await handler(ctx, args ?? {}));
3274
3313
  const shown = redactPii ? redactShopperPii(project(result, OAUTH_PROJECTIONS[action.id])) : result;
3275
3314
  return { content: [{ type: "text", text: formatResult(shown) }] };
3276
3315
  } catch (error) {