@commet/node 9.9.0 → 9.10.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.
Files changed (50) hide show
  1. package/dist/index.d.mts +813 -15
  2. package/dist/index.d.ts +813 -15
  3. package/dist/index.js +199 -6
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +199 -6
  6. package/dist/index.mjs.map +1 -1
  7. package/docs/ai-onboarding/mcp-server.md +2 -0
  8. package/docs/api-reference/addons.md +3 -1
  9. package/docs/api-reference/credit-packs.md +3 -1
  10. package/docs/api-reference/generated-webhooks.md +2 -2
  11. package/docs/api-reference/index.md +3 -3
  12. package/docs/api-reference/plans.md +483 -6
  13. package/docs/api-reference/subscriptions.md +43 -3
  14. package/docs/documentation/api-versioning.md +8 -2
  15. package/docs/documentation/cli.md +4 -0
  16. package/docs/documentation/customers/customer-portal.md +2 -2
  17. package/docs/documentation/plans/add-ons.md +14 -3
  18. package/docs/documentation/plans/consumption-models.md +3 -3
  19. package/docs/documentation/plans/create-plans.md +5 -1
  20. package/docs/documentation/plans/credit-packs.md +19 -9
  21. package/docs/documentation/plans/plan-groups.md +1 -1
  22. package/docs/documentation/plans/plan-versions.md +265 -0
  23. package/docs/documentation/sales/regional-prices.md +23 -9
  24. package/docs/documentation/sales/trial-periods.md +3 -3
  25. package/docs/documentation/subscriptions/manage-subscriptions.md +50 -13
  26. package/docs/documentation/subscriptions/upgrade-and-downgrade-plans.md +2 -0
  27. package/docs/errors/addon_has_activations.md +2 -2
  28. package/docs/errors/addon_unavailable.md +22 -0
  29. package/docs/errors/credit_pack_unavailable.md +22 -0
  30. package/docs/errors/index.md +8 -2
  31. package/docs/errors/missing_regional_price.md +3 -3
  32. package/docs/errors/plan_experiment_not_found.md +22 -0
  33. package/docs/errors/plan_version_not_found.md +22 -0
  34. package/docs/errors/subscribers_do_not_fit.md +22 -0
  35. package/docs/errors/version_not_newer.md +22 -0
  36. package/docs/knowledge-base/how-do-free-plans-work-without-payment.md +4 -3
  37. package/docs/knowledge-base/how-do-trial-periods-work.md +3 -3
  38. package/docs/knowledge-base/how-does-billing-work.md +26 -28
  39. package/docs/knowledge-base/how-does-quota-based-billing-work.md +12 -22
  40. package/docs/knowledge-base/how-does-seat-based-billing-work.md +12 -22
  41. package/docs/knowledge-base/what-happens-when-a-customer-changes-plans.md +11 -8
  42. package/docs/knowledge-base/what-happens-when-you-change-your-prices.md +34 -29
  43. package/docs/knowledge-base/what-invoices-do-customers-receive-and-when.md +1 -1
  44. package/docs/manifest.json +191 -2
  45. package/docs/platform-documentation.md +1 -0
  46. package/docs/schemas.md +107 -0
  47. package/docs/webhooks/introduction.md +3 -1
  48. package/docs/webhooks.md +24 -0
  49. package/docs/webhooks.openapi.json +231 -1
  50. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -58,7 +58,7 @@ var AddonsResource = class {
58
58
  const { id } = params;
59
59
  return this.httpClient.get(`/addons/${id}`, void 0, options);
60
60
  }
61
- /** Update an add-on's name, description, or pricing. */
61
+ /** Update an add-on's name, description, pricing, or the plans that sell it. */
62
62
  async update(params, options) {
63
63
  const { id, ...rest } = params;
64
64
  return this.httpClient.patch(`/addons/${id}`, rest, options);
@@ -103,7 +103,7 @@ var CreditPacksResource = class {
103
103
  constructor(httpClient) {
104
104
  this.httpClient = httpClient;
105
105
  }
106
- /** Update a credit pack's name, description, credits, price, or active status. */
106
+ /** Update a credit pack's name, description, credits, price, active status, or the plans that sell it. */
107
107
  async update(params, options) {
108
108
  const { id, ...rest } = params;
109
109
  return this.httpClient.patch(`/credit-packs/${id}`, rest, options);
@@ -453,6 +453,98 @@ var PlansResource = class {
453
453
  constructor(httpClient) {
454
454
  this.httpClient = httpClient;
455
455
  }
456
+ /** Publish a draft as the plan's current version, as a new experiment with its own code, or as the next version of the experiment it started from. A country missing a price, or removing the signup trial of the plan's group from the current version, stops the publication. With move, subscribers of earlier versions move at their renewal or now; if any of them does not fit the new version, nothing is published and the response lists each one with what would make it fit, to send back in changes. Paused subscribers stay where they are. Send preview to check without publishing. */
457
+ async publishDraft(params, options) {
458
+ const { id, draftId, ...rest } = params;
459
+ return this.httpClient.post(
460
+ `/plans/${id}/drafts/${draftId}/publish`,
461
+ rest,
462
+ options
463
+ );
464
+ }
465
+ /** Retrieve a draft with the version it started from and what it changes. */
466
+ async getDraft(params, options) {
467
+ const { id, draftId } = params;
468
+ return this.httpClient.get(
469
+ `/plans/${id}/drafts/${draftId}`,
470
+ void 0,
471
+ options
472
+ );
473
+ }
474
+ /** Change a draft's prices per interval, trials, the interval shown first, countries with their currency and prices, and credit or balance rules, or undo single changes. Each block sent replaces that block; blocks left out stay as they are. Buyers and subscribers see nothing until the draft is published. */
475
+ async updateDraft(params, options) {
476
+ const { id, draftId, ...rest } = params;
477
+ return this.httpClient.patch(
478
+ `/plans/${id}/drafts/${draftId}`,
479
+ rest,
480
+ options
481
+ );
482
+ }
483
+ /** Discard a draft. Nothing it changed was ever sold. */
484
+ async deleteDraft(params, options) {
485
+ const { id, draftId } = params;
486
+ return this.httpClient.delete(
487
+ `/plans/${id}/drafts/${draftId}`,
488
+ void 0,
489
+ options
490
+ );
491
+ }
492
+ /** List the plan's open drafts, oldest first, each with the version it started from and what it changes. Drafts sell nothing until published. */
493
+ async listDrafts(params, options) {
494
+ const { id } = params;
495
+ return this.httpClient.get(`/plans/${id}/drafts`, void 0, options);
496
+ }
497
+ /** Start a draft from a version of the plan: the current one, an experiment's version or an older one. A plan can have any number of drafts. Edit it, then publish it as the current version, as an experiment or as an experiment's next version; nothing changes for buyers or subscribers until then. */
498
+ async createDraft(params, options) {
499
+ const { id, ...rest } = params;
500
+ return this.httpClient.post(`/plans/${id}/drafts`, rest, options);
501
+ }
502
+ /** Stop selling the experiment. Its code sells the plan's current version from then on, so links already shared keep working. Choose what happens to its subscribers: keep them on its versions, or move them to the current version at their renewal or now. If any of them does not fit, nothing changes and the response lists each one with what would make it fit, to send back in changes. */
503
+ async archiveExperiment(params, options) {
504
+ const { id, code, ...rest } = params;
505
+ return this.httpClient.post(
506
+ `/plans/${id}/experiments/${code}/archive`,
507
+ rest,
508
+ options
509
+ );
510
+ }
511
+ /** Make the experiment's latest version the plan's current version, with exactly its content and the next version number. New buyers get it; its subscribers are already on it. The experiment closes, and its code sells the plan's current version from then on. Nobody else moves. */
512
+ async makeExperimentCurrent(params, options) {
513
+ const { id, code } = params;
514
+ return this.httpClient.post(
515
+ `/plans/${id}/experiments/${code}/make-current`,
516
+ {},
517
+ options
518
+ );
519
+ }
520
+ /** Get one experiment of a plan by its own code, with the version it sells and how many subscriptions are on it. */
521
+ async getExperiment(params, options) {
522
+ const { id, code } = params;
523
+ return this.httpClient.get(
524
+ `/plans/${id}/experiments/${code}`,
525
+ void 0,
526
+ options
527
+ );
528
+ }
529
+ /** Publish the experiment's next version from its latest version with the changes given. Its code sells the new version from now on; subscribers on its earlier versions stay where they are until moved. */
530
+ async createExperimentVersion(params, options) {
531
+ const { id, code, ...rest } = params;
532
+ return this.httpClient.post(
533
+ `/plans/${id}/experiments/${code}/versions`,
534
+ rest,
535
+ options
536
+ );
537
+ }
538
+ /** List a plan's experiments, newest first, with the version each one sells and how many subscriptions are on them. */
539
+ async listExperiments(params, options) {
540
+ const { id } = params;
541
+ return this.httpClient.get(`/plans/${id}/experiments`, void 0, options);
542
+ }
543
+ /** Start an experiment from the plan's current version with the changes given. It is sold only through its code (planCode `<plan code>:<code>`); new buyers of the plan keep getting the current version. */
544
+ async createExperiment(params, options) {
545
+ const { id, ...rest } = params;
546
+ return this.httpClient.post(`/plans/${id}/experiments`, rest, options);
547
+ }
456
548
  /** Update limits, overage, or enabled status of a feature on a plan. */
457
549
  async updateFeature(params, options) {
458
550
  const { id, featureId, ...rest } = params;
@@ -476,6 +568,61 @@ var PlansResource = class {
476
568
  const { id, ...rest } = params;
477
569
  return this.httpClient.post(`/plans/${id}/features`, rest, options);
478
570
  }
571
+ /** Cancel a move for every subscriber who has not moved yet. They stay on their version; those already moved stay moved. */
572
+ async cancelMove(params, options) {
573
+ const { id, moveId } = params;
574
+ return this.httpClient.post(
575
+ `/plans/${id}/moves/${moveId}/cancel`,
576
+ {},
577
+ options
578
+ );
579
+ }
580
+ /** Read a move of subscribers between plan versions with each subscriber's status: moving, moved, needs a change, left out, canceled or kept on its version. */
581
+ async getMove(params, options) {
582
+ const { id, moveId } = params;
583
+ return this.httpClient.get(
584
+ `/plans/${id}/moves/${moveId}`,
585
+ void 0,
586
+ options
587
+ );
588
+ }
589
+ /** Cancel a move for one subscriber who has not moved yet. It stays on its version; the rest of the move continues. */
590
+ async cancelMoveSubscription(params, options) {
591
+ const { id, moveId, subscriptionId } = params;
592
+ return this.httpClient.post(
593
+ `/plans/${id}/moves/${moveId}/subscriptions/${subscriptionId}/cancel`,
594
+ {},
595
+ options
596
+ );
597
+ }
598
+ /** List a plan's latest moves of subscribers between versions, newest first, including the change of a single subscription, with how many are moving, moved, need a change, were left out, canceled or kept on their version. */
599
+ async listMoves(params, options) {
600
+ const { id } = params;
601
+ return this.httpClient.get(`/plans/${id}/moves`, void 0, options);
602
+ }
603
+ /** Move a list of subscriptions, or every subscription of another version, to a newer version of the plan, at their next renewal or now. Nobody moves unless every one of them fits or has a change in changes; otherwise the response lists each one with what would make it fit. Only active, trialing and past due subscriptions move. Paused ones, and listed subscriptions in another status or already on the destination, are left out. Send preview to check without moving anyone. */
604
+ async createMove(params, options) {
605
+ const { id, ...rest } = params;
606
+ return this.httpClient.post(`/plans/${id}/moves`, rest, options);
607
+ }
608
+ /** Leave a subscriber that needs a change on its version. It stops appearing among the subscribers that need a change; move it later like any other subscriber. */
609
+ async keepSubscriberOnVersion(params, options) {
610
+ const { id, subscriptionId } = params;
611
+ return this.httpClient.post(
612
+ `/plans/${id}/needs-a-change/${subscriptionId}/keep`,
613
+ {},
614
+ options
615
+ );
616
+ }
617
+ /** List the plan's subscribers whose move could not complete, with the version they stay on, the one they could not move to and why. Move them again with a change, or keep them on their version so they leave this list. */
618
+ async listSubscribersNeedingAChange(params, options) {
619
+ const { id } = params;
620
+ return this.httpClient.get(
621
+ `/plans/${id}/needs-a-change`,
622
+ void 0,
623
+ options
624
+ );
625
+ }
479
626
  /** Set a specific price as the default and return the updated plan price. */
480
627
  async setDefaultPrice(params, options) {
481
628
  const { id, priceId } = params;
@@ -512,7 +659,7 @@ var PlansResource = class {
512
659
  options
513
660
  );
514
661
  }
515
- /** Archive a price for new subscriptions. Existing subscriptions that selected it continue using its current catalog value. */
662
+ /** Archive a price for new subscriptions. This publishes a new version of the plan; existing subscriptions that selected the price keep paying it on their version until moved. */
516
663
  async deletePrice(params, options) {
517
664
  const { id, priceId } = params;
518
665
  return this.httpClient.delete(
@@ -546,6 +693,34 @@ var PlansResource = class {
546
693
  const { id } = params;
547
694
  return this.httpClient.delete(`/plans/${id}`, void 0, options);
548
695
  }
696
+ /** List what changes from one version of a plan to another: prices, trials, features, rules, add-ons, credit packs and countries. */
697
+ async compareVersions(params, options) {
698
+ const { id, versionId, ...rest } = params;
699
+ return this.httpClient.get(
700
+ `/plans/${id}/versions/${versionId}/changes`,
701
+ rest,
702
+ options
703
+ );
704
+ }
705
+ /** Get one published version of a plan with its prices and how many subscriptions are on it. */
706
+ async getVersion(params, options) {
707
+ const { id, versionId } = params;
708
+ return this.httpClient.get(
709
+ `/plans/${id}/versions/${versionId}`,
710
+ void 0,
711
+ options
712
+ );
713
+ }
714
+ /** List a plan's published versions, newest first, with their prices and how many subscriptions are on each. Versions published before Commet recorded every term are not listed. */
715
+ async listVersions(params, options) {
716
+ const { id, ...rest } = params;
717
+ return this.httpClient.get(`/plans/${id}/versions`, rest, options);
718
+ }
719
+ /** Publish a new current version of the plan from its current version, changing prices per interval, included credits or balance, per-currency amounts and the rollover cap. New buyers get it; every subscriber stays on its version until moved. To try changes without selling them to everyone, create an experiment instead. */
720
+ async createVersion(params, options) {
721
+ const { id, ...rest } = params;
722
+ return this.httpClient.post(`/plans/${id}/versions`, rest, options);
723
+ }
549
724
  /** Set a plan's public visibility and return the updated plan. */
550
725
  async setVisibility(params, options) {
551
726
  const { id, ...rest } = params;
@@ -680,7 +855,7 @@ var SubscriptionsResource = class {
680
855
  options
681
856
  );
682
857
  }
683
- /** Activate an add-on on a subscription. Charges a prorated amount for the current billing period. */
858
+ /** Activate an add-on on a subscription. Charges a prorated amount for the current billing period. An add-on that the subscription's plan version does not sell is rejected with addon_unavailable. */
684
859
  async activateAddon(params, options) {
685
860
  const { id, ...rest } = params;
686
861
  return this.httpClient.post(`/subscriptions/${id}/addons`, rest, options);
@@ -735,7 +910,16 @@ var SubscriptionsResource = class {
735
910
  options
736
911
  );
737
912
  }
738
- /** Purchase a fixed credit pack or choose a whole credit quantity at the subscription plan price and minimum. Charges the saved payment method and adds purchased credits. */
913
+ /** Move a subscription to a newer published version of its plan, now or at the end of the period, without proration; an older version is rejected with version_not_newer, and a subscription on a running experiment moves only to a later version of that experiment. The subscription keeps its currency and its price: a destination that does not sell its currency is rejected with missing_regional_price, and one that does not sell the price it pays with price_not_found. A free version moves only to a free version and a paid one only to a paid one (validation_error). A subscription whose usage does not fit the destination, or with an active add-on the destination does not sell, is not moved either, and the error says why. Each change is recorded as a move of this one subscription in the plan's moves. Repeating the same request changes nothing; a new one replaces the pending move. */
914
+ async changeVersion(params, options) {
915
+ const { id, ...rest } = params;
916
+ return this.httpClient.post(
917
+ `/subscriptions/${id}/change-version`,
918
+ rest,
919
+ options
920
+ );
921
+ }
922
+ /** Purchase a fixed credit pack or choose a whole credit quantity at the subscription plan price and minimum. Charges the saved payment method and adds purchased credits. A credit pack that the subscription's plan version does not sell is rejected with credit_pack_unavailable. */
739
923
  async purchaseCredits(params, options) {
740
924
  const { id, ...rest } = params;
741
925
  return this.httpClient.post(`/subscriptions/${id}/credits`, rest, options);
@@ -837,6 +1021,15 @@ var SubscriptionsResource = class {
837
1021
  options
838
1022
  );
839
1023
  }
1024
+ /** Cancel the move to another plan version pending for the next renewal, so the subscription stays on its version, and send subscription.version_change_canceled with reason canceled_by_merchant. A move made now has nothing pending to revoke. With nothing pending it changes nothing. Returns the subscription. */
1025
+ async revokeScheduledVersionChange(params, options) {
1026
+ const { id } = params;
1027
+ return this.httpClient.delete(
1028
+ `/subscriptions/${id}/scheduled-version-change`,
1029
+ void 0,
1030
+ options
1031
+ );
1032
+ }
840
1033
  /** Revert a scheduled cancellation and return the updated subscription. Only works before cancellation takes effect. */
841
1034
  async uncancel(params, options) {
842
1035
  const { id } = params;
@@ -1097,7 +1290,7 @@ var CommetValidationError = class extends CommetAPIError {
1097
1290
 
1098
1291
  // src/version.ts
1099
1292
  var API_VERSION = "2026-08-27";
1100
- var SDK_VERSION = "9.9.0";
1293
+ var SDK_VERSION = "9.10.0";
1101
1294
 
1102
1295
  // src/utils/telemetry.ts
1103
1296
  var registeredIntegrations = /* @__PURE__ */ new Set();