@commet/node 8.0.0 → 9.0.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/README.md +44 -0
- package/dist/index.d.mts +185 -99
- package/dist/index.d.ts +185 -99
- package/dist/index.js +43 -51
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +43 -51
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -233,31 +233,61 @@ var InvoicesResource = class {
|
|
|
233
233
|
}
|
|
234
234
|
};
|
|
235
235
|
|
|
236
|
+
// src/resources/markets.ts
|
|
237
|
+
var MarketsResource = class {
|
|
238
|
+
constructor(httpClient) {
|
|
239
|
+
this.httpClient = httpClient;
|
|
240
|
+
}
|
|
241
|
+
/** Get one reusable market. */
|
|
242
|
+
async get(params, options) {
|
|
243
|
+
const { id } = params;
|
|
244
|
+
return this.httpClient.get(`/markets/${id}`, void 0, options);
|
|
245
|
+
}
|
|
246
|
+
/** Replace the name, countries, and metadata of a market. */
|
|
247
|
+
async update(params, options) {
|
|
248
|
+
const { id, ...rest } = params;
|
|
249
|
+
return this.httpClient.patch(`/markets/${id}`, rest, options);
|
|
250
|
+
}
|
|
251
|
+
/** Delete an unused market. Markets referenced by prices or subscriptions cannot be deleted. */
|
|
252
|
+
async delete(params, options) {
|
|
253
|
+
const { id } = params;
|
|
254
|
+
return this.httpClient.delete(`/markets/${id}`, void 0, options);
|
|
255
|
+
}
|
|
256
|
+
/** List reusable country groups that resolve market-specific prices independently from currency. */
|
|
257
|
+
async list() {
|
|
258
|
+
return this.httpClient.get("/markets");
|
|
259
|
+
}
|
|
260
|
+
/** Create a reusable market without attaching it to a plan or price. Countries can belong to only one active market. */
|
|
261
|
+
async create(params, options) {
|
|
262
|
+
return this.httpClient.post("/markets", params, options);
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
|
|
236
266
|
// src/resources/offers.ts
|
|
237
267
|
var OffersResource = class {
|
|
238
268
|
constructor(httpClient) {
|
|
239
269
|
this.httpClient = httpClient;
|
|
240
270
|
}
|
|
241
|
-
/** Retrieve
|
|
271
|
+
/** Retrieve reusable offer terms by public ID. */
|
|
242
272
|
async get(params, options) {
|
|
243
273
|
const { id } = params;
|
|
244
274
|
return this.httpClient.get(`/offers/${id}`, void 0, options);
|
|
245
275
|
}
|
|
246
|
-
/** Replace
|
|
276
|
+
/** Replace reusable offer terms. Existing applications keep their immutable accepted terms. */
|
|
247
277
|
async update(params, options) {
|
|
248
278
|
const { id, ...rest } = params;
|
|
249
279
|
return this.httpClient.patch(`/offers/${id}`, rest, options);
|
|
250
280
|
}
|
|
251
|
-
/** Soft-delete an
|
|
281
|
+
/** Soft-delete an Offer. Existing applications and their accepted terms remain available for billing and audit. */
|
|
252
282
|
async delete(params, options) {
|
|
253
283
|
const { id } = params;
|
|
254
284
|
return this.httpClient.delete(`/offers/${id}`, void 0, options);
|
|
255
285
|
}
|
|
256
|
-
/** List
|
|
286
|
+
/** List reusable offer terms. Offers are independent from plans, prices, eligibility, and distribution channels. */
|
|
257
287
|
async list(params, options) {
|
|
258
288
|
return this.httpClient.get("/offers", params, options);
|
|
259
289
|
}
|
|
260
|
-
/** Create
|
|
290
|
+
/** Create reusable offer terms without assigning a plan, price, eligibility rule, or distribution channel. */
|
|
261
291
|
async create(params, options) {
|
|
262
292
|
return this.httpClient.post("/offers", params, options);
|
|
263
293
|
}
|
|
@@ -488,44 +518,6 @@ var PortalResource = class {
|
|
|
488
518
|
}
|
|
489
519
|
};
|
|
490
520
|
|
|
491
|
-
// src/resources/pricing.ts
|
|
492
|
-
var PricingResource = class {
|
|
493
|
-
constructor(httpClient) {
|
|
494
|
-
this.httpClient = httpClient;
|
|
495
|
-
}
|
|
496
|
-
/** Get one reusable pricing market group. */
|
|
497
|
-
async getMarketGroup(params, options) {
|
|
498
|
-
const { id } = params;
|
|
499
|
-
return this.httpClient.get(
|
|
500
|
-
`/pricing/market-groups/${id}`,
|
|
501
|
-
void 0,
|
|
502
|
-
options
|
|
503
|
-
);
|
|
504
|
-
}
|
|
505
|
-
/** Replace the name, countries, and metadata of a pricing market group. */
|
|
506
|
-
async updateMarketGroup(params, options) {
|
|
507
|
-
const { id, ...rest } = params;
|
|
508
|
-
return this.httpClient.patch(`/pricing/market-groups/${id}`, rest, options);
|
|
509
|
-
}
|
|
510
|
-
/** Delete an unused pricing market group. Groups referenced by prices or subscriptions cannot be deleted. */
|
|
511
|
-
async deleteMarketGroup(params, options) {
|
|
512
|
-
const { id } = params;
|
|
513
|
-
return this.httpClient.delete(
|
|
514
|
-
`/pricing/market-groups/${id}`,
|
|
515
|
-
void 0,
|
|
516
|
-
options
|
|
517
|
-
);
|
|
518
|
-
}
|
|
519
|
-
/** List reusable country groups used to resolve market-specific prices independently from currency. */
|
|
520
|
-
async listMarketGroups() {
|
|
521
|
-
return this.httpClient.get("/pricing/market-groups");
|
|
522
|
-
}
|
|
523
|
-
/** Create a reusable country group. Countries can belong to only one active group; each price chooses its currency independently. */
|
|
524
|
-
async createMarketGroup(params, options) {
|
|
525
|
-
return this.httpClient.post("/pricing/market-groups", params, options);
|
|
526
|
-
}
|
|
527
|
-
};
|
|
528
|
-
|
|
529
521
|
// src/resources/promo-codes.ts
|
|
530
522
|
var PromoCodesResource = class {
|
|
531
523
|
constructor(httpClient) {
|
|
@@ -545,7 +537,7 @@ var PromoCodesResource = class {
|
|
|
545
537
|
async list(params, options) {
|
|
546
538
|
return this.httpClient.get("/promo-codes", params, options);
|
|
547
539
|
}
|
|
548
|
-
/** Create a distribution code for an existing
|
|
540
|
+
/** Create a distribution code for an existing Offer. The referenced Offer owns the benefit and duration; the promo code owns redemption restrictions. */
|
|
549
541
|
async create(params, options) {
|
|
550
542
|
return this.httpClient.post("/promo-codes", params, options);
|
|
551
543
|
}
|
|
@@ -662,7 +654,7 @@ var SubscriptionsResource = class {
|
|
|
662
654
|
const { id, ...rest } = params;
|
|
663
655
|
return this.httpClient.post(`/subscriptions/${id}/cancel`, rest, options);
|
|
664
656
|
}
|
|
665
|
-
/** Upgrade or change billing interval immediately, optionally applying
|
|
657
|
+
/** Upgrade or change billing interval immediately, optionally applying an Offer. Scheduled changes do not accept offers. */
|
|
666
658
|
async changePlan(params, options) {
|
|
667
659
|
const { id, ...rest } = params;
|
|
668
660
|
return this.httpClient.post(
|
|
@@ -685,7 +677,7 @@ var SubscriptionsResource = class {
|
|
|
685
677
|
options
|
|
686
678
|
);
|
|
687
679
|
}
|
|
688
|
-
/** Preview proration details for an immediate plan change
|
|
680
|
+
/** Preview proration details for an immediate plan change without applying it. Interval direction takes precedence: a longer interval is immediate and a shorter interval is scheduled. When the interval is unchanged, a higher-sort-order plan is immediate and a lower-sort-order plan is scheduled. A paid-to-free change is always scheduled. Returns credit, charge, and net amount. The target plan must belong to the same plan group as the current plan, otherwise a 400 with code `plans_not_in_same_group` is returned. A change between two free plans has nothing to prorate and returns a zero-amount estimate. Scheduled changes return a 400 with code `plan_change_scheduled`; apply those via the change-plan endpoint. Pass offerId to quote the destination plan with an Offer. */
|
|
689
681
|
async previewChange(params, options) {
|
|
690
682
|
const { id, ...rest } = params;
|
|
691
683
|
return this.httpClient.post(
|
|
@@ -694,7 +686,7 @@ var SubscriptionsResource = class {
|
|
|
694
686
|
options
|
|
695
687
|
);
|
|
696
688
|
}
|
|
697
|
-
/** Reactivates a subscription. A past_due subscription retries its outstanding renewal charge (recovering to active on success). A canceled subscription generates a fresh invoice, charges the saved card, and resets the billing period. On a successful charge the subscription becomes active; a declined charge returns an error with a recoveryUrl in the error details that can be sent to the customer to update their card. A canceled subscription may apply
|
|
689
|
+
/** Reactivates a subscription. A past_due subscription retries its outstanding renewal charge (recovering to active on success). A canceled subscription generates a fresh invoice, charges the saved card, and resets the billing period. On a successful charge the subscription becomes active; a declined charge returns an error with a recoveryUrl in the error details that can be sent to the customer to update their card. A canceled subscription may apply an Offer by offerId; past-due recovery cannot. */
|
|
698
690
|
async reactivate(params, options) {
|
|
699
691
|
const { id, ...rest } = params;
|
|
700
692
|
return this.httpClient.post(
|
|
@@ -730,7 +722,7 @@ var SubscriptionsResource = class {
|
|
|
730
722
|
async list(params, options) {
|
|
731
723
|
return this.httpClient.get("/subscriptions", params, options);
|
|
732
724
|
}
|
|
733
|
-
/** Create a subscription for a customer. Commet selects the default price when priceId is omitted and resolves its market from the customer's billing country. Without an offer override, Commet applies the price's automatic introductory
|
|
725
|
+
/** Create a subscription for a customer. Commet selects the default price when priceId is omitted and resolves its market from the customer's billing country. Without an offer override, Commet applies the price's automatic introductory Offer. Pass offerId to apply any active compatible Offer directly; the Offer does not need a prior plan-price association. */
|
|
734
726
|
async create(params, options) {
|
|
735
727
|
return this.httpClient.post("/subscriptions", params, options);
|
|
736
728
|
}
|
|
@@ -810,13 +802,13 @@ var GeneratedResources = class {
|
|
|
810
802
|
this.featureAccess = new FeatureAccessResource(http);
|
|
811
803
|
this.features = new FeaturesResource(http);
|
|
812
804
|
this.invoices = new InvoicesResource(http);
|
|
805
|
+
this.markets = new MarketsResource(http);
|
|
813
806
|
this.offers = new OffersResource(http);
|
|
814
807
|
this.payments = new PaymentsResource(http);
|
|
815
808
|
this.payouts = new PayoutsResource(http);
|
|
816
809
|
this.planGroups = new PlanGroupsResource(http);
|
|
817
810
|
this.plans = new PlansResource(http);
|
|
818
811
|
this.portal = new PortalResource(http);
|
|
819
|
-
this.pricing = new PricingResource(http);
|
|
820
812
|
this.promoCodes = new PromoCodesResource(http);
|
|
821
813
|
this.provisioning = new ProvisioningResource(http);
|
|
822
814
|
this.quota = new QuotaResource(http);
|
|
@@ -947,8 +939,8 @@ var CommetValidationError = class extends CommetError {
|
|
|
947
939
|
};
|
|
948
940
|
|
|
949
941
|
// src/version.ts
|
|
950
|
-
var API_VERSION = "2026-07-
|
|
951
|
-
var SDK_VERSION = "
|
|
942
|
+
var API_VERSION = "2026-07-31";
|
|
943
|
+
var SDK_VERSION = "9.0.0";
|
|
952
944
|
|
|
953
945
|
// src/utils/telemetry.ts
|
|
954
946
|
var registeredIntegrations = /* @__PURE__ */ new Set();
|