@usethrottle/mcp 0.9.0 → 0.11.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/lib.cjs CHANGED
@@ -405,6 +405,16 @@ function stripRawProcessorData(value) {
405
405
 
406
406
  // ../action-catalog/src/actions.ts
407
407
  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.";
408
+ var ORDER_STATUSES = [
409
+ "draft",
410
+ "awaiting_payment",
411
+ "awaiting_fulfillment",
412
+ "awaiting_shipment",
413
+ "partially_shipped",
414
+ "shipped",
415
+ "completed",
416
+ "cancelled"
417
+ ];
408
418
  var ACTIONS = [
409
419
  // ---------------------------------------------------------------- identity
410
420
  {
@@ -508,7 +518,20 @@ var ACTIONS = [
508
518
  scopes: ["orders:read"],
509
519
  input: [
510
520
  { name: "q", type: "string", required: false, description: "Free-text search." },
511
- { name: "status", type: "string", required: false, description: "Order status filter." },
521
+ {
522
+ name: "status",
523
+ type: "string",
524
+ required: false,
525
+ description: "Lifecycle status filter.",
526
+ enum: ORDER_STATUSES
527
+ },
528
+ {
529
+ name: "effectiveStatus",
530
+ type: "string",
531
+ required: false,
532
+ description: "Filter on the derived effectiveStatus: the lifecycle status unless the order is cancelled, on hold, refunded, partially refunded or disputed.",
533
+ enum: [...ORDER_STATUSES, "on_hold", "refunded", "partially_refunded", "disputed"]
534
+ },
512
535
  { name: "paymentStatus", type: "string", required: false, description: "Payment status filter." },
513
536
  {
514
537
  name: "createdAfter",
@@ -1510,6 +1533,17 @@ var ACTIONS = [
1510
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."
1511
1534
  ]
1512
1535
  },
1536
+ // ------------------------------------------------------------ order fees
1537
+ {
1538
+ id: "list_fees",
1539
+ title: "List order fees",
1540
+ description: "List the order fee definitions of the application (convenience, handling, insurance fees), in display order: kind (percentage or flat), rate in basis points, flat/min/max/min-order amounts per currency, taxable, which orders they apply to and the customer groups they are limited to. Fees only charge while the application has order fees turned on.",
1541
+ kind: "read",
1542
+ scopes: ["applications:read"],
1543
+ input: [],
1544
+ requests: [{ method: "GET", path: "/api/v1/fees" }],
1545
+ channels: ["mcp"]
1546
+ },
1513
1547
  // ------------------------------------------------------------ customer groups
1514
1548
  {
1515
1549
  id: "list_customer_groups",
@@ -1851,6 +1885,24 @@ function trigger(id, title, eventType, description) {
1851
1885
  }
1852
1886
  var TRIGGERS = [
1853
1887
  trigger("new_order", "New order", "order.created", "Fires when an order is created."),
1888
+ trigger(
1889
+ "order_awaiting_shipment",
1890
+ "Order awaiting shipment",
1891
+ "order.awaiting_shipment",
1892
+ "Fires when an order is being prepared and nothing has shipped yet."
1893
+ ),
1894
+ trigger(
1895
+ "order_shipped",
1896
+ "Order shipped",
1897
+ "order.shipped",
1898
+ "Fires when everything an order has to ship has been handed to the carrier."
1899
+ ),
1900
+ trigger(
1901
+ "order_completed",
1902
+ "Order completed",
1903
+ "order.completed",
1904
+ "Fires when an order is completed: marked completed after shipping, or finished with nothing to ship."
1905
+ ),
1854
1906
  trigger(
1855
1907
  "payment_captured",
1856
1908
  "Payment captured",
@@ -2303,6 +2355,7 @@ var HANDLERS = {
2303
2355
  {
2304
2356
  q: args.q,
2305
2357
  status: args.status,
2358
+ effectiveStatus: args.effectiveStatus,
2306
2359
  paymentStatus: args.paymentStatus,
2307
2360
  createdAfter: args.createdAfter,
2308
2361
  createdBefore: args.createdBefore,
@@ -2592,6 +2645,8 @@ var HANDLERS = {
2592
2645
  },
2593
2646
  idempotencyKey: `mcp-update-customer-${String(args.id)}-${Date.now()}`
2594
2647
  }),
2648
+ // ----------------------------------------------------------- order fees
2649
+ list_fees: async (ctx) => ctx.client.get("/api/v1/fees"),
2595
2650
  // ----------------------------------------------------------- customer groups
2596
2651
  list_customer_groups: async (ctx) => ctx.client.get("/api/v1/customer-groups"),
2597
2652
  get_customer_group: async (ctx, args) => ctx.client.get(`/api/v1/customer-groups/${String(args.id)}`),
@@ -3237,11 +3292,14 @@ var LINE_ITEM = {
3237
3292
  // amount: a trial line's renewal price; schedule: per-unit installment amounts.
3238
3293
  recurring: { amount: M, scheduleUnitTotal: M, schedule: [{ amount: M }] }
3239
3294
  };
3295
+ var FEE = { baseAmount: M, amount: M, taxAmount: M };
3240
3296
  var ORDER = {
3241
3297
  subtotal: M,
3242
3298
  discountTotal: M,
3243
3299
  shippingTotal: M,
3244
3300
  shippingDiscountTotal: M,
3301
+ feeTotal: M,
3302
+ fees: [FEE],
3245
3303
  taxTotal: M,
3246
3304
  total: M,
3247
3305
  capturedAmount: M,
@@ -3269,7 +3327,8 @@ var SUBSCRIPTION = {
3269
3327
  scheduleTotal: M,
3270
3328
  nextPaymentAmount: M,
3271
3329
  paymentSchedule: [{ amount: M, discount: M, net: M }],
3272
- renewalIssue: { charge: { amount: M } }
3330
+ renewalIssue: { charge: { amount: M } },
3331
+ fees: [FEE]
3273
3332
  };
3274
3333
  var QUOTE_ITEM = {
3275
3334
  unitPrice: M,
@@ -3283,6 +3342,8 @@ var QUOTE_REVISION = {
3283
3342
  subtotal: M,
3284
3343
  discountTotal: M,
3285
3344
  shippingTotal: M,
3345
+ feeTotal: M,
3346
+ fees: [FEE],
3286
3347
  taxTotal: M,
3287
3348
  total: M,
3288
3349
  depositAmount: M,
@@ -3305,15 +3366,19 @@ var INVOICE = {
3305
3366
  taxTotal: M,
3306
3367
  shippingTotal: M,
3307
3368
  discountTotal: M,
3369
+ feeTotal: M,
3370
+ fees: [{ amount: M }],
3308
3371
  total: M,
3309
3372
  amountRefunded: M,
3310
3373
  billingSnapshot: {
3311
3374
  lineItems: [{ unitPrice: M, taxAmount: M, discountAmount: M, total: M }],
3375
+ fees: [FEE],
3312
3376
  totals: {
3313
3377
  subtotal: M,
3314
3378
  taxTotal: M,
3315
3379
  shippingTotal: M,
3316
3380
  discountTotal: M,
3381
+ feeTotal: M,
3317
3382
  total: M,
3318
3383
  orderTotal: M,
3319
3384
  amountPaid: M,
@@ -3334,6 +3399,8 @@ var CART = {
3334
3399
  discountTotal: M,
3335
3400
  shippingTotal: M,
3336
3401
  shippingDiscountTotal: M,
3402
+ feeTotal: M,
3403
+ fees: [FEE],
3337
3404
  total: M,
3338
3405
  lineItems: [LINE_ITEM],
3339
3406
  items: [LINE_ITEM],
@@ -3419,6 +3486,8 @@ var MONEY_SPECS = {
3419
3486
  // GET /api/v1/stores: `settings.shipping` is stamped with its own currency
3420
3487
  // (MC1-R74); an unstamped one takes the store's.
3421
3488
  list_applications: [{ settings: { shipping: { flatRateCents: M, freeThresholdCents: M } } }],
3489
+ // GET /api/v1/fees: fee definitions hold per-currency amounts, keyed by the currency code.
3490
+ list_fees: [{ flatAmounts: MK(M), minAmounts: MK(M), maxAmounts: MK(M), minOrderAmounts: MK(M) }],
3422
3491
  // ---------------------------------------------------------------- analytics
3423
3492
  get_sales_timeseries: {
3424
3493
  totalGrossCents: DROP,
@@ -3592,7 +3661,16 @@ var page3 = (row) => ({ data: [row], pagination: PAGINATION });
3592
3661
  var ADDRESS = { countryCode: S };
3593
3662
  var CUSTOMER_REF = { id: S };
3594
3663
  var APPLICATION = { id: S, name: T, slug: S };
3595
- var LIFECYCLE_LABELS = ["Draft", "Pending", "Processing", "Partially fulfilled", "Fulfilled", "Cancelled", "Closed"];
3664
+ var LIFECYCLE_LABELS = [
3665
+ "Draft",
3666
+ "Awaiting Payment",
3667
+ "Awaiting Fulfillment",
3668
+ "Awaiting Shipment",
3669
+ "Partially Shipped",
3670
+ "Shipped",
3671
+ "Completed",
3672
+ "Cancelled"
3673
+ ];
3596
3674
  var DISPLAY_QUALIFIERS = [
3597
3675
  "Comped",
3598
3676
  "Awaiting payment",
@@ -3639,10 +3717,24 @@ var LINE_ITEM2 = {
3639
3717
  recurring: { ...LINE_RECURRING, amount: MONEY, count: S, scheduleUnitTotal: MONEY },
3640
3718
  subscriptionId: S
3641
3719
  };
3720
+ var FEE2 = {
3721
+ id: S,
3722
+ source: S,
3723
+ label: T,
3724
+ kind: S,
3725
+ rateBps: S,
3726
+ baseAmount: MONEY,
3727
+ amount: MONEY,
3728
+ taxable: S,
3729
+ taxAmount: MONEY,
3730
+ appliesToOneTime: S,
3731
+ appliesToSubscription: S
3732
+ };
3642
3733
  var ORDER2 = {
3643
3734
  id: S,
3644
3735
  orderNumber: S,
3645
3736
  status: S,
3737
+ effectiveStatus: S,
3646
3738
  displayStatus: DISPLAY_STATUS,
3647
3739
  paymentStatus: S,
3648
3740
  type: S,
@@ -3652,6 +3744,8 @@ var ORDER2 = {
3652
3744
  discountTotal: MONEY,
3653
3745
  shippingTotal: MONEY,
3654
3746
  shippingDiscountTotal: MONEY,
3747
+ feeTotal: MONEY,
3748
+ fees: [FEE2],
3655
3749
  taxTotal: MONEY,
3656
3750
  total: MONEY,
3657
3751
  capturedAmount: MONEY,
@@ -3762,6 +3856,7 @@ var SUBSCRIPTION2 = {
3762
3856
  pendingIntervalCount: S,
3763
3857
  scheduleTotal: MONEY,
3764
3858
  nextPaymentAmount: MONEY,
3859
+ fees: [FEE2],
3765
3860
  // A physical subscription (0236): the method is an enum, and the ship-to is
3766
3861
  // kept to its country like every other address here.
3767
3862
  deliveryMethod: S,
@@ -3801,6 +3896,8 @@ var QUOTE2 = {
3801
3896
  subtotal: MONEY,
3802
3897
  discountTotal: MONEY,
3803
3898
  shippingTotal: MONEY,
3899
+ feeTotal: MONEY,
3900
+ fees: [FEE2],
3804
3901
  taxTotal: MONEY,
3805
3902
  total: MONEY,
3806
3903
  depositAmount: MONEY,
@@ -3836,6 +3933,8 @@ var INVOICE2 = {
3836
3933
  subtotal: MONEY,
3837
3934
  discountTotal: MONEY,
3838
3935
  shippingTotal: MONEY,
3936
+ feeTotal: MONEY,
3937
+ fees: [{ label: T, amount: MONEY }],
3839
3938
  taxTotal: MONEY,
3840
3939
  total: MONEY,
3841
3940
  amountRefunded: MONEY,
@@ -3848,7 +3947,7 @@ var INVOICE2 = {
3848
3947
  planName: T,
3849
3948
  period: { start: S, end: S },
3850
3949
  lineItems: [{ quantity: S, unitPrice: MONEY, discountAmount: MONEY, taxAmount: MONEY, total: MONEY }],
3851
- totals: { currency: S, subtotal: MONEY, discountTotal: MONEY, shippingTotal: MONEY, taxTotal: MONEY, total: MONEY },
3950
+ totals: { currency: S, subtotal: MONEY, discountTotal: MONEY, shippingTotal: MONEY, feeTotal: MONEY, taxTotal: MONEY, total: MONEY },
3852
3951
  payment: { method: S, brand: S, status: S }
3853
3952
  }
3854
3953
  };
@@ -4036,6 +4135,8 @@ var OAUTH_PROJECTIONS = {
4036
4135
  discountTotal: MONEY,
4037
4136
  shippingTotal: MONEY,
4038
4137
  shippingDiscountTotal: MONEY,
4138
+ feeTotal: MONEY,
4139
+ fees: [FEE2],
4039
4140
  taxTotal: MONEY,
4040
4141
  total: MONEY,
4041
4142
  itemCount: S,
@@ -4106,6 +4207,25 @@ var OAUTH_PROJECTIONS = {
4106
4207
  get_workspace_settings: { name: T, slug: S, brandColor: S, logoUrl: T, onboardingCompletedAt: S },
4107
4208
  // What happened and to which record; not which team member did it.
4108
4209
  get_audit_log: page3({ id: S, action: S, resourceType: S, resourceId: S, createdAt: S }),
4210
+ list_fees: [{
4211
+ id: S,
4212
+ name: T,
4213
+ kind: S,
4214
+ rateBps: S,
4215
+ flatAmounts: mapOf(MONEY),
4216
+ minAmounts: mapOf(MONEY),
4217
+ maxAmounts: mapOf(MONEY),
4218
+ minOrderAmounts: mapOf(MONEY),
4219
+ taxable: S,
4220
+ taxCode: S,
4221
+ appliesToOneTime: S,
4222
+ appliesToSubscription: S,
4223
+ customerGroupIds: [S],
4224
+ active: S,
4225
+ sortOrder: S,
4226
+ createdAt: S,
4227
+ updatedAt: S
4228
+ }],
4109
4229
  list_applications: [{ id: S, name: T, slug: S, currency: S, isActive: S }],
4110
4230
  // Analytics: computed aggregates, listed field by field all the same.
4111
4231
  get_business_summary: {
@@ -4205,7 +4325,7 @@ var OAUTH_PROJECTIONS = {
4205
4325
  };
4206
4326
 
4207
4327
  // src/server.ts
4208
- var VERSION = true ? "0.9.0" : "0.0.0-dev";
4328
+ var VERSION = true ? "0.11.0" : "0.0.0-dev";
4209
4329
  function registerableActions(policy) {
4210
4330
  const isProduction = policy.identity.environment.providerEnvironment === "production";
4211
4331
  return actionsForChannel("mcp").filter((action) => {