@commet/node 5.5.1 → 7.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/dist/index.mjs CHANGED
@@ -3,28 +3,29 @@ var AddonsResource = class {
3
3
  constructor(httpClient) {
4
4
  this.httpClient = httpClient;
5
5
  }
6
+ /** List all active add-ons for a customer's subscription. */
6
7
  async listActive(params, options) {
7
- return this.httpClient.get(
8
- "/addons/active",
9
- { customerId: params.customerId },
10
- options
11
- );
8
+ return this.httpClient.get("/active-addons", params, options);
12
9
  }
10
+ /** List all add-ons with cursor-based pagination. */
13
11
  async list(params, options) {
14
12
  return this.httpClient.get("/addons", params, options);
15
13
  }
14
+ /** Retrieve an add-on by its public ID or slug. */
16
15
  async get(params, options) {
17
16
  const { id } = params;
18
17
  return this.httpClient.get(`/addons/${id}`, void 0, options);
19
18
  }
19
+ /** Create a new add-on linked to a feature. Each feature can only be assigned to one add-on. */
20
20
  async create(params, options) {
21
21
  return this.httpClient.post("/addons", params, options);
22
22
  }
23
+ /** Update an add-on's name, description, or pricing. */
23
24
  async update(params, options) {
24
- const { id, ...body } = params;
25
- return this.httpClient.put(`/addons/${id}`, body, options);
25
+ const { id, ...rest } = params;
26
+ return this.httpClient.put(`/addons/${id}`, rest, options);
26
27
  }
27
- /** Fails if addon has active subscriptions. */
28
+ /** Soft-delete an add-on. Fails if the add-on has active subscriptions. */
28
29
  async delete(params, options) {
29
30
  const { id } = params;
30
31
  return this.httpClient.delete(`/addons/${id}`, void 0, options);
@@ -36,15 +37,18 @@ var ApiKeysResource = class {
36
37
  constructor(httpClient) {
37
38
  this.httpClient = httpClient;
38
39
  }
39
- async list(params) {
40
- return this.httpClient.get("/api-keys", params);
40
+ /** List API keys with cursor-based pagination. Keys are returned without the full secret. */
41
+ async list(params, options) {
42
+ return this.httpClient.get("/api-keys", params, options);
41
43
  }
42
- /** Response includes full `apiKey` which is only returned once. */
44
+ /** Create a new API key. The full key is only returned once in the response. */
43
45
  async create(params, options) {
44
46
  return this.httpClient.post("/api-keys", params, options);
45
47
  }
48
+ /** Permanently revoke and delete an API key. */
46
49
  async delete(params, options) {
47
- return this.httpClient.delete(`/api-keys/${params.id}`, void 0, options);
50
+ const { id } = params;
51
+ return this.httpClient.delete(`/api-keys/${id}`, void 0, options);
48
52
  }
49
53
  };
50
54
 
@@ -53,16 +57,20 @@ var CreditPacksResource = class {
53
57
  constructor(httpClient) {
54
58
  this.httpClient = httpClient;
55
59
  }
60
+ /** List all active credit packs. */
56
61
  async list() {
57
62
  return this.httpClient.get("/credit-packs");
58
63
  }
64
+ /** Create a new credit pack. */
59
65
  async create(params, options) {
60
66
  return this.httpClient.post("/credit-packs/manage", params, options);
61
67
  }
68
+ /** Update a credit pack's name, description, credits, price, or active status. */
62
69
  async update(params, options) {
63
- const { id, ...body } = params;
64
- return this.httpClient.put(`/credit-packs/${id}`, body, options);
70
+ const { id, ...rest } = params;
71
+ return this.httpClient.put(`/credit-packs/${id}`, rest, options);
65
72
  }
73
+ /** Soft-delete a credit pack. */
66
74
  async delete(params, options) {
67
75
  const { id } = params;
68
76
  return this.httpClient.delete(`/credit-packs/${id}`, void 0, options);
@@ -74,100 +82,79 @@ var CustomersResource = class {
74
82
  constructor(httpClient) {
75
83
  this.httpClient = httpClient;
76
84
  }
77
- /** Idempotent when `id` is provided — returns existing customer instead of duplicating. */
85
+ /** List customers with cursor-based pagination. */
86
+ async list(params, options) {
87
+ return this.httpClient.get("/customers", params, options);
88
+ }
89
+ /** Create a new customer. Idempotent when customerId is provided. */
78
90
  async create(params, options) {
79
- return this.httpClient.post(
80
- "/customers",
81
- {
82
- billingEmail: params.email,
83
- id: params.id,
84
- fullName: params.fullName,
85
- domain: params.domain,
86
- website: params.website,
87
- timezone: params.timezone,
88
- language: params.language,
89
- industry: params.industry,
90
- metadata: params.metadata,
91
- address: params.address
92
- },
93
- options
94
- );
91
+ return this.httpClient.post("/customers", params, options);
95
92
  }
96
- async createBatch(params, options) {
97
- const customers = params.customers.map((c) => ({
98
- billingEmail: c.email,
99
- id: c.id,
100
- fullName: c.fullName,
101
- domain: c.domain,
102
- website: c.website,
103
- timezone: c.timezone,
104
- language: c.language,
105
- industry: c.industry,
106
- metadata: c.metadata,
107
- address: c.address
108
- }));
109
- return this.httpClient.post("/customers/batch", { customers }, options);
110
- }
111
- async get(params) {
112
- return this.httpClient.get(`/customers/${params.id}`);
93
+ /** Retrieve a customer by their public ID, including subscription status and metadata. */
94
+ async get(params, options) {
95
+ const { id } = params;
96
+ return this.httpClient.get(`/customers/${id}`, void 0, options);
113
97
  }
98
+ /** Update a customer's name, external ID, or metadata. */
114
99
  async update(params, options) {
115
- return this.httpClient.put(
116
- `/customers/${params.id}`,
117
- {
118
- billingEmail: params.email,
119
- fullName: params.fullName,
120
- domain: params.domain,
121
- website: params.website,
122
- timezone: params.timezone,
123
- language: params.language,
124
- industry: params.industry,
125
- metadata: params.metadata,
126
- address: params.address
127
- },
128
- options
129
- );
100
+ const { id, ...rest } = params;
101
+ return this.httpClient.put(`/customers/${id}`, rest, options);
130
102
  }
131
- async list(params) {
132
- return this.httpClient.get("/customers", params);
103
+ /** Create up to 100 customers in a single request. */
104
+ async createBatch(params, options) {
105
+ return this.httpClient.post("/customers/batch", params, options);
133
106
  }
134
107
  };
135
108
 
136
- // src/resources/features.ts
137
- var FeaturesResource = class {
109
+ // src/resources/feature-access.ts
110
+ var FeatureAccessResource = class {
138
111
  constructor(httpClient) {
139
112
  this.httpClient = httpClient;
140
113
  }
114
+ /** List all features for a customer's active subscription, scoped by the customerId query parameter. */
115
+ async list(params, options) {
116
+ return this.httpClient.get("/feature-access", params, options);
117
+ }
118
+ /** Get feature access details for a customer. Use action=canUse to check if the customer can consume one more unit. */
141
119
  async get(params, options) {
142
- return this.httpClient.get(
143
- `/features/${params.code}`,
144
- { customerId: params.customerId },
145
- options
146
- );
120
+ const { code, ...rest } = params;
121
+ return this.httpClient.get(`/feature-access/${code}`, rest, options);
147
122
  }
148
- /** Checks if the customer can consume one more unit — returns billing impact and reason if blocked. */
123
+ /** Get feature access details for a customer. Use action=canUse to check if the customer can consume one more unit. */
149
124
  async canUse(params, options) {
125
+ const { code, ...rest } = params;
150
126
  return this.httpClient.get(
151
- `/features/${params.code}`,
152
- { customerId: params.customerId, action: "canUse" },
127
+ `/feature-access/${code}`,
128
+ { ...rest, action: "canUse" },
153
129
  options
154
130
  );
155
131
  }
156
- async list(params, options) {
157
- return this.httpClient.get(
158
- "/features",
159
- { customerId: params.customerId },
160
- options
161
- );
132
+ };
133
+
134
+ // src/resources/features.ts
135
+ var FeaturesResource = class {
136
+ constructor(httpClient) {
137
+ this.httpClient = httpClient;
138
+ }
139
+ /** List every feature defined in the organization. This is the organization's feature catalog (definitions), not a customer's feature access. */
140
+ async list() {
141
+ return this.httpClient.get("/features");
162
142
  }
143
+ /** Get a single feature definition by code from the organization's feature catalog. */
144
+ async get(params, options) {
145
+ const { code } = params;
146
+ return this.httpClient.get(`/features/${code}`, void 0, options);
147
+ }
148
+ /** Create a new feature. Code must be lowercase alphanumeric with underscores. */
163
149
  async create(params, options) {
164
150
  return this.httpClient.post("/features/manage", params, options);
165
151
  }
152
+ /** Update a feature's name, description, or unit name. At least one field must be provided. */
166
153
  async update(params, options) {
167
- const { code, ...body } = params;
168
- return this.httpClient.put(`/features/${code}/manage`, body, options);
154
+ const { code, ...rest } = params;
155
+ return this.httpClient.put(`/features/${code}/manage`, rest, options);
169
156
  }
170
- /** Fails if feature is attached to active plans or has an active addon. */
157
+ /** Delete a feature. Fails if the feature is attached to active plans or has an active add-on. */
171
158
  async delete(params, options) {
172
159
  const { code } = params;
173
160
  return this.httpClient.delete(
@@ -183,27 +170,52 @@ var InvoicesResource = class {
183
170
  constructor(httpClient) {
184
171
  this.httpClient = httpClient;
185
172
  }
186
- async list(params) {
187
- return this.httpClient.get("/invoices", params);
173
+ /** List invoices with cursor-based pagination. Filter by customer, status, or subscription. */
174
+ async list(params, options) {
175
+ return this.httpClient.get("/invoices", params, options);
188
176
  }
189
- async get(params) {
190
- return this.httpClient.get(`/invoices/${params.id}`);
177
+ /** Retrieve a single invoice by its public ID, including line items. */
178
+ async get(params, options) {
179
+ const { id } = params;
180
+ return this.httpClient.get(`/invoices/${id}`, void 0, options);
191
181
  }
192
- /** Negative amount creates a credit. */
182
+ /** Create a one-off adjustment invoice. Use a negative amount for a credit. */
193
183
  async createAdjustment(params, options) {
194
184
  return this.httpClient.post("/invoices", params, options);
195
185
  }
196
- /** Signed URL, expires after 7 days. */
197
- async getDownloadUrl(params) {
198
- return this.httpClient.get(`/invoices/${params.id}/download`);
186
+ /** Generate a signed URL to download the invoice as a PDF. The URL expires after 7 days. */
187
+ async getDownloadUrl(params, options) {
188
+ const { id } = params;
189
+ return this.httpClient.get(`/invoices/${id}/download`, void 0, options);
199
190
  }
191
+ /** Send the invoice to the customer via email. */
200
192
  async send(params, options) {
201
- return this.httpClient.post(`/invoices/${params.id}/send`, {}, options);
193
+ const { id } = params;
194
+ return this.httpClient.post(`/invoices/${id}/send`, {}, options);
202
195
  }
203
- /** Only outstanding invoices can be changed to paid or void. */
196
+ /** Mark an outstanding invoice as "paid" or "void". Cannot change the status of already paid or voided invoices. */
204
197
  async updateStatus(params, options) {
205
- const { id, ...body } = params;
206
- return this.httpClient.put(`/invoices/${id}/status`, body, options);
198
+ const { id, ...rest } = params;
199
+ return this.httpClient.put(`/invoices/${id}/status`, rest, options);
200
+ }
201
+ };
202
+
203
+ // src/resources/payouts.ts
204
+ var PayoutsResource = class {
205
+ constructor(httpClient) {
206
+ this.httpClient = httpClient;
207
+ }
208
+ /** Add an additional destination bank account to the organization's existing payout account. Country and currency are resolved from the organization. The full account number is never returned — only `last4`. */
209
+ async addBankAccount(params, options) {
210
+ return this.httpClient.post("/payouts/bank-accounts", params, options);
211
+ }
212
+ /** Withdraw available balance to the organization's verified payout account. `amount` is in cents (USD, minimum 1000 = $10). The payout is created in `pending` and settles to `paid` asynchronously as provider webhooks arrive. */
213
+ async request(params, options) {
214
+ return this.httpClient.post("/payouts", params, options);
215
+ }
216
+ /** Provision the organization's payout account in a single call with the full KYC + bank payload. Uploads the identity document, persists the destination bank, and creates the connected account through the org's payout provider. The account starts `pending_verification` and flips to `verified` via the provider's webhook. Idempotent: returns the existing account if the org already has one. */
217
+ async completeVerification(params, options) {
218
+ return this.httpClient.post("/payouts/verification", params, options);
207
219
  }
208
220
  };
209
221
 
@@ -212,31 +224,35 @@ var PlanGroupsResource = class {
212
224
  constructor(httpClient) {
213
225
  this.httpClient = httpClient;
214
226
  }
215
- async list(params) {
216
- return this.httpClient.get("/plan-groups", params);
227
+ /** List plan groups with cursor-based pagination. */
228
+ async list(params, options) {
229
+ return this.httpClient.get("/plan-groups", params, options);
217
230
  }
218
- async get(params) {
219
- return this.httpClient.get(`/plan-groups/${params.id}`);
231
+ /** Retrieve a plan group by ID, including its plans ordered by sortOrder. */
232
+ async get(params, options) {
233
+ const { id } = params;
234
+ return this.httpClient.get(`/plan-groups/${id}`, void 0, options);
220
235
  }
236
+ /** Create a new plan group for organizing plans. */
221
237
  async create(params, options) {
222
238
  return this.httpClient.post("/plan-groups", params, options);
223
239
  }
240
+ /** Update a plan group's name, description, or visibility. */
224
241
  async update(params, options) {
225
- const { id, ...body } = params;
226
- return this.httpClient.put(`/plan-groups/${id}`, body, options);
242
+ const { id, ...rest } = params;
243
+ return this.httpClient.put(`/plan-groups/${id}`, rest, options);
227
244
  }
228
- /** Plans in the group are unlinked, not deleted. */
245
+ /** Delete a plan group. Plans in the group are unlinked, not deleted. */
229
246
  async delete(params, options) {
230
- return this.httpClient.delete(
231
- `/plan-groups/${params.id}`,
232
- void 0,
233
- options
234
- );
247
+ const { id } = params;
248
+ return this.httpClient.delete(`/plan-groups/${id}`, void 0, options);
235
249
  }
250
+ /** Add an existing plan to a plan group with optional sort order. */
236
251
  async addPlan(params, options) {
237
- const { id, ...body } = params;
238
- return this.httpClient.post(`/plan-groups/${id}/plans`, body, options);
252
+ const { id, ...rest } = params;
253
+ return this.httpClient.post(`/plan-groups/${id}/plans`, rest, options);
239
254
  }
255
+ /** Remove a plan from a plan group. */
240
256
  async removePlan(params, options) {
241
257
  const { id, planId } = params;
242
258
  return this.httpClient.delete(
@@ -245,11 +261,12 @@ var PlanGroupsResource = class {
245
261
  options
246
262
  );
247
263
  }
264
+ /** Set the display order of plans within a group. All plan IDs in the group must be provided. */
248
265
  async reorderPlans(params, options) {
249
- const { id, ...body } = params;
266
+ const { id, ...rest } = params;
250
267
  return this.httpClient.put(
251
268
  `/plan-groups/${id}/plans/reorder`,
252
- body,
269
+ rest,
253
270
  options
254
271
  );
255
272
  }
@@ -260,90 +277,104 @@ var PlansResource = class {
260
277
  constructor(httpClient) {
261
278
  this.httpClient = httpClient;
262
279
  }
263
- async list(params) {
264
- return this.httpClient.get("/plans", params);
280
+ /** List all plans with their prices and features. Optionally include private plans. */
281
+ async list(params, options) {
282
+ return this.httpClient.get("/plans", params, options);
265
283
  }
266
- async get(params) {
267
- return this.httpClient.get(`/plans/${params.id}`);
284
+ /** Get detailed plan information by code or ID. */
285
+ async get(params, options) {
286
+ const { id } = params;
287
+ return this.httpClient.get(`/plans/${id}`, void 0, options);
268
288
  }
289
+ /** Create a new plan with optional consumption model, visibility, and plan group assignment. */
269
290
  async create(params, options) {
270
291
  return this.httpClient.post("/plans/manage", params, options);
271
292
  }
293
+ /** Update a plan's name, description, visibility, or metadata. */
272
294
  async update(params, options) {
273
- const { id, ...body } = params;
274
- return this.httpClient.put(`/plans/${id}/manage`, body, options);
295
+ const { id, ...rest } = params;
296
+ return this.httpClient.put(`/plans/${id}/manage`, rest, options);
275
297
  }
298
+ /** Soft-delete a plan. */
276
299
  async delete(params, options) {
277
- return this.httpClient.delete(
278
- `/plans/${params.id}/manage`,
279
- void 0,
280
- options
281
- );
300
+ const { id } = params;
301
+ return this.httpClient.delete(`/plans/${id}/manage`, void 0, options);
282
302
  }
303
+ /** Toggle a plan between public and private. */
283
304
  async setVisibility(params, options) {
284
- const { id, ...body } = params;
285
- return this.httpClient.put(`/plans/${id}/visibility`, body, options);
305
+ const { id, ...rest } = params;
306
+ return this.httpClient.put(`/plans/${id}/visibility`, rest, options);
286
307
  }
308
+ /** Attach a feature to a plan with limits, overage, and credits configuration. */
287
309
  async addFeature(params, options) {
288
- const { planId, ...body } = params;
289
- return this.httpClient.post(`/plans/${planId}/features`, body, options);
310
+ const { id, ...rest } = params;
311
+ return this.httpClient.post(`/plans/${id}/features`, rest, options);
290
312
  }
313
+ /** Update limits, overage, or enabled status of a feature on a plan. */
291
314
  async updateFeature(params, options) {
292
- const { planId, featureId, ...body } = params;
315
+ const { id, featureId, ...rest } = params;
293
316
  return this.httpClient.put(
294
- `/plans/${planId}/features/${featureId}`,
295
- body,
317
+ `/plans/${id}/features/${featureId}`,
318
+ rest,
296
319
  options
297
320
  );
298
321
  }
322
+ /** Detach a feature from a plan. */
299
323
  async removeFeature(params, options) {
300
- const { planId, featureId } = params;
324
+ const { id, featureId } = params;
301
325
  return this.httpClient.delete(
302
- `/plans/${planId}/features/${featureId}`,
326
+ `/plans/${id}/features/${featureId}`,
303
327
  void 0,
304
328
  options
305
329
  );
306
330
  }
331
+ /** Add a billing interval price to a plan with optional trial days and included balance/credits. */
307
332
  async addPrice(params, options) {
308
- const { planId, ...body } = params;
309
- return this.httpClient.post(`/plans/${planId}/prices`, body, options);
333
+ const { id, ...rest } = params;
334
+ return this.httpClient.post(`/plans/${id}/prices`, rest, options);
310
335
  }
336
+ /** Update an existing price on a plan. */
311
337
  async updatePrice(params, options) {
312
- const { planId, priceId, ...body } = params;
313
- return this.httpClient.put(
314
- `/plans/${planId}/prices/${priceId}`,
315
- body,
316
- options
317
- );
338
+ const { id, priceId, ...rest } = params;
339
+ return this.httpClient.put(`/plans/${id}/prices/${priceId}`, rest, options);
318
340
  }
341
+ /** Remove a price from a plan. */
319
342
  async deletePrice(params, options) {
320
- const { planId, priceId } = params;
343
+ const { id, priceId } = params;
321
344
  return this.httpClient.delete(
322
- `/plans/${planId}/prices/${priceId}`,
345
+ `/plans/${id}/prices/${priceId}`,
323
346
  void 0,
324
347
  options
325
348
  );
326
349
  }
350
+ /** Set a specific price as the default for its plan. Unsets previous default. */
327
351
  async setDefaultPrice(params, options) {
328
- const { planId, priceId } = params;
352
+ const { id, priceId } = params;
329
353
  return this.httpClient.put(
330
- `/plans/${planId}/prices/${priceId}/default`,
354
+ `/plans/${id}/prices/${priceId}/default`,
331
355
  {},
332
356
  options
333
357
  );
334
358
  }
359
+ /** Create or update regional currency price overrides for a plan price. */
335
360
  async setRegionalPrices(params, options) {
336
- const { planId, priceId, ...body } = params;
361
+ const { id, priceId, ...rest } = params;
337
362
  return this.httpClient.put(
338
- `/plans/${planId}/prices/${priceId}/regional`,
339
- body,
363
+ `/plans/${id}/prices/${priceId}/regional`,
364
+ rest,
340
365
  options
341
366
  );
342
367
  }
368
+ /** Configure a plan's regional pricing for one currency. Sending only currency and exchangeRate derives every regional value (base price, included balance, feature overage, intro offer) from the USD value at that rate. Optional per-price and per-feature overrides are stored as manual values. */
369
+ async setRegionalPricing(params, options) {
370
+ const { id, ...rest } = params;
371
+ return this.httpClient.put(`/plans/${id}/regional`, rest, options);
372
+ }
373
+ /** Remove all regional currency overrides for a plan price. */
343
374
  async deleteRegionalPrices(params, options) {
344
- const { planId, priceId } = params;
375
+ const { id, priceId } = params;
345
376
  return this.httpClient.delete(
346
- `/plans/${planId}/prices/${priceId}/regional`,
377
+ `/plans/${id}/prices/${priceId}/regional`,
347
378
  void 0,
348
379
  options
349
380
  );
@@ -355,6 +386,7 @@ var PortalResource = class {
355
386
  constructor(httpClient) {
356
387
  this.httpClient = httpClient;
357
388
  }
389
+ /** Generate a customer portal URL. Exactly one identifier (email or customerId) is required. */
358
390
  async getUrl(params, options) {
359
391
  return this.httpClient.post("/portal/request-access", params, options);
360
392
  }
@@ -365,18 +397,23 @@ var PromoCodesResource = class {
365
397
  constructor(httpClient) {
366
398
  this.httpClient = httpClient;
367
399
  }
368
- async list(params) {
369
- return this.httpClient.get("/promo-codes", params);
400
+ /** List promo codes with cursor-based pagination. */
401
+ async list(params, options) {
402
+ return this.httpClient.get("/promo-codes", params, options);
370
403
  }
371
- async get(params) {
372
- return this.httpClient.get(`/promo-codes/${params.id}`);
404
+ /** Retrieve a promo code by its public ID. */
405
+ async get(params, options) {
406
+ const { id } = params;
407
+ return this.httpClient.get(`/promo-codes/${id}`, void 0, options);
373
408
  }
409
+ /** Create a new promo code. Optionally restrict to specific plans. */
374
410
  async create(params, options) {
375
411
  return this.httpClient.post("/promo-codes", params, options);
376
412
  }
413
+ /** Update a promo code's redemption limits, expiration, active status, or plan restrictions. */
377
414
  async update(params, options) {
378
- const { id, ...body } = params;
379
- return this.httpClient.put(`/promo-codes/${id}`, body, options);
415
+ const { id, ...rest } = params;
416
+ return this.httpClient.put(`/promo-codes/${id}`, rest, options);
380
417
  }
381
418
  };
382
419
 
@@ -385,49 +422,25 @@ var QuotaResource = class {
385
422
  constructor(httpClient) {
386
423
  this.httpClient = httpClient;
387
424
  }
425
+ /** Add to a customer's quota allowance for a feature. Defaults to 1 if count is omitted. */
388
426
  async add(params, options) {
389
- return this.httpClient.post(
390
- "/usage/quota",
391
- {
392
- customerId: params.customerId,
393
- featureCode: params.featureCode,
394
- count: params.count ?? 1
395
- },
396
- options
397
- );
427
+ return this.httpClient.post("/usage/quota", params, options);
398
428
  }
429
+ /** Set a customer's quota allowance for a feature to an exact value. */
399
430
  async set(params, options) {
400
- return this.httpClient.put(
401
- "/usage/quota",
402
- {
403
- customerId: params.customerId,
404
- featureCode: params.featureCode,
405
- count: params.count
406
- },
407
- options
408
- );
431
+ return this.httpClient.put("/usage/quota", params, options);
409
432
  }
433
+ /** Remove from a customer's quota allowance for a feature. Defaults to 1 if count is omitted. Returns 400 insufficient_balance if the balance would go negative. */
410
434
  async remove(params, options) {
411
- return this.httpClient.delete(
412
- "/usage/quota",
413
- {
414
- customerId: params.customerId,
415
- featureCode: params.featureCode,
416
- count: params.count ?? 1
417
- },
418
- options
419
- );
435
+ return this.httpClient.delete("/usage/quota", params, options);
420
436
  }
421
- async get(params) {
422
- return this.httpClient.get("/usage/quota", {
423
- customerId: params.customerId,
424
- featureCode: params.featureCode
425
- });
437
+ /** Get the current quota allowance (used vs included) for a specific feature. */
438
+ async get(params, options) {
439
+ return this.httpClient.get("/usage/quota", params, options);
426
440
  }
427
- async getAll(params) {
428
- return this.httpClient.get("/usage/quota/all", {
429
- customerId: params.customerId
430
- });
441
+ /** Get all quota allowances for a customer across every quota feature in their plan. */
442
+ async getAll(params, options) {
443
+ return this.httpClient.get("/usage/quota/all", params, options);
431
444
  }
432
445
  };
433
446
 
@@ -436,54 +449,29 @@ var SeatsResource = class {
436
449
  constructor(httpClient) {
437
450
  this.httpClient = httpClient;
438
451
  }
439
- /** Prorates charges for the current billing period. */
452
+ /** Add seats to a customer's subscription. Prorates charges for the current billing period. */
440
453
  async add(params, options) {
441
- return this.httpClient.post(
442
- "/seats",
443
- {
444
- customerId: params.customerId,
445
- featureCode: params.featureCode,
446
- count: params.count ?? 1
447
- },
448
- options
449
- );
450
- }
451
- /** Removal takes effect at the end of the billing period. */
452
- async remove(params, options) {
453
- return this.httpClient.delete(
454
- "/seats",
455
- {
456
- customerId: params.customerId,
457
- featureCode: params.featureCode,
458
- count: params.count ?? 1
459
- },
460
- options
461
- );
454
+ return this.httpClient.post("/seats", params, options);
462
455
  }
456
+ /** Set seats to an exact count. */
463
457
  async set(params, options) {
464
- return this.httpClient.put(
465
- "/seats",
466
- {
467
- customerId: params.customerId,
468
- featureCode: params.featureCode,
469
- count: params.count
470
- },
471
- options
472
- );
458
+ return this.httpClient.put("/seats", params, options);
459
+ }
460
+ /** Remove seats from a customer's subscription. Takes effect at the end of the billing period. */
461
+ async remove(params, options) {
462
+ return this.httpClient.delete("/seats", params, options);
473
463
  }
464
+ /** Set all seat types at once. */
474
465
  async setAll(params, options) {
475
466
  return this.httpClient.put("/seats/bulk", params, options);
476
467
  }
477
- async getBalance(params) {
478
- return this.httpClient.get("/seats/balance", {
479
- customerId: params.customerId,
480
- featureCode: params.featureCode
481
- });
468
+ /** Get current balance for a specific seat type. */
469
+ async getBalance(params, options) {
470
+ return this.httpClient.get("/seats/balance", params, options);
482
471
  }
483
- async getAllBalances(params) {
484
- return this.httpClient.get("/seats/balances", {
485
- customerId: params.customerId
486
- });
472
+ /** Get the current balance for all seat types in a customer's subscription. */
473
+ async getAllBalances(params, options) {
474
+ return this.httpClient.get("/seats/balances", params, options);
487
475
  }
488
476
  };
489
477
 
@@ -492,54 +480,57 @@ var SubscriptionsResource = class {
492
480
  constructor(httpClient) {
493
481
  this.httpClient = httpClient;
494
482
  }
495
- /** Returns a `checkoutUrl` when payment is required before activation. */
483
+ /** List all subscriptions. Filter by customer ID or status. */
484
+ async list(params, options) {
485
+ return this.httpClient.get("/subscriptions", params, options);
486
+ }
487
+ /** Create a subscription for a customer. Requires planId or planCode plus customerId. */
496
488
  async create(params, options) {
497
489
  return this.httpClient.post("/subscriptions", params, options);
498
490
  }
499
- async getActive(params) {
500
- return this.httpClient.get("/subscriptions/active", {
501
- customerId: params.customerId
502
- });
491
+ /** Get a subscription by its public ID, regardless of status (including pending_payment and past_due). */
492
+ async get(params, options) {
493
+ const { id } = params;
494
+ return this.httpClient.get(`/subscriptions/${id}`, void 0, options);
495
+ }
496
+ /** Get the active subscription for a customer. Returns null if none. */
497
+ async getActive(params, options) {
498
+ return this.httpClient.get("/subscriptions/active", params, options);
503
499
  }
504
- /** Schedules cancellation at period end by default. Set `immediate: true` to cancel now. */
500
+ /** Cancel immediately or at period end. */
505
501
  async cancel(params, options) {
506
- const { id, ...body } = params;
507
- return this.httpClient.post(`/subscriptions/${id}/cancel`, body, options);
502
+ const { id, ...rest } = params;
503
+ return this.httpClient.post(`/subscriptions/${id}/cancel`, rest, options);
508
504
  }
509
- /** Only works on subscriptions with a pending cancellation cannot revert already-canceled. */
505
+ /** Revert a scheduled cancellation. Only works when canceledAt is set but status is not yet 'canceled'. */
510
506
  async uncancel(params, options) {
511
- return this.httpClient.post(
512
- `/subscriptions/${params.id}/uncancel`,
513
- {},
514
- options
515
- );
507
+ const { id } = params;
508
+ return this.httpClient.post(`/subscriptions/${id}/uncancel`, {}, options);
516
509
  }
517
- /** Upgrades execute immediately with proration. Downgrades are scheduled for end of period. */
510
+ /** Upgrade, downgrade, or change billing interval. */
518
511
  async changePlan(params, options) {
519
- const { id, ...body } = params;
512
+ const { id, ...rest } = params;
520
513
  return this.httpClient.post(
521
514
  `/subscriptions/${id}/change-plan`,
522
- body,
515
+ rest,
523
516
  options
524
517
  );
525
518
  }
526
- async list(params) {
527
- return this.httpClient.get("/subscriptions", params);
528
- }
529
- /** Dry-run: returns proration details without applying the change. */
519
+ /** Preview proration details for an immediate plan change (an upgrade or a longer interval) without applying it. Returns credit, charge, and net amount. Downgrades — a cheaper plan in the same group, or a shorter interval — are scheduled for the end of the current period instead of being prorated, so they return a 400 with code `plan_change_scheduled`; apply those via the change-plan endpoint. */
530
520
  async previewChange(params, options) {
531
- const { id, ...body } = params;
521
+ const { id, ...rest } = params;
532
522
  return this.httpClient.post(
533
523
  `/subscriptions/${id}/preview-change`,
534
- body,
524
+ rest,
535
525
  options
536
526
  );
537
527
  }
538
- /** Prorated charge for the current billing period. */
528
+ /** Activate an add-on on a subscription. Charges a prorated amount for the current billing period. */
539
529
  async activateAddon(params, options) {
540
- const { id, ...body } = params;
541
- return this.httpClient.post(`/subscriptions/${id}/addons`, body, options);
530
+ const { id, ...rest } = params;
531
+ return this.httpClient.post(`/subscriptions/${id}/addons`, rest, options);
542
532
  }
533
+ /** Deactivate an add-on from a subscription. */
543
534
  async deactivateAddon(params, options) {
544
535
  const { id, addonId } = params;
545
536
  return this.httpClient.delete(
@@ -548,27 +539,47 @@ var SubscriptionsResource = class {
548
539
  options
549
540
  );
550
541
  }
551
- /** Positive amount adds, negative subtracts. */
542
+ /** Adjust a subscription's balance or credits by a signed amount. Positive adds, negative subtracts. */
552
543
  async adjustBalance(params, options) {
553
- const { id, ...body } = params;
544
+ const { id, ...rest } = params;
554
545
  return this.httpClient.post(
555
546
  `/subscriptions/${id}/balance/adjust`,
556
- body,
547
+ rest,
557
548
  options
558
549
  );
559
550
  }
560
- /** Charges the customer's payment method. */
551
+ /** Top up a subscription's balance. Charges the customer's payment method for the specified amount. */
561
552
  async topupBalance(params, options) {
562
- const { id, ...body } = params;
553
+ const { id, ...rest } = params;
563
554
  return this.httpClient.post(
564
555
  `/subscriptions/${id}/balance/topup`,
565
- body,
556
+ rest,
566
557
  options
567
558
  );
568
559
  }
560
+ /** Purchase a credit pack for a subscription. Charges the customer and adds credits to their balance. */
569
561
  async purchaseCredits(params, options) {
570
- const { id, ...body } = params;
571
- return this.httpClient.post(`/subscriptions/${id}/credits`, body, options);
562
+ const { id, ...rest } = params;
563
+ return this.httpClient.post(`/subscriptions/${id}/credits`, rest, options);
564
+ }
565
+ };
566
+
567
+ // src/resources/test-clock.ts
568
+ var TestClockResource = class {
569
+ constructor(httpClient) {
570
+ this.httpClient = httpClient;
571
+ }
572
+ /** Returns the organization's current test clock state. Sandbox only. */
573
+ async get() {
574
+ return this.httpClient.get("/test-clock");
575
+ }
576
+ /** Moves the test clock forward, by a number of days (advanceDays) or to an absolute instant (frozenTime). The clock can only move forward. Sandbox only. */
577
+ async advance(params, options) {
578
+ return this.httpClient.post("/test-clock", params, options);
579
+ }
580
+ /** Discovers customers due for billing at the org's current (simulated) time and enqueues a billing cycle for each — renewals, expired trials, pending cancellations. Enqueueing is asynchronous. Sandbox only. */
581
+ async processBilling() {
582
+ return this.httpClient.post("/test-clock/process-billing", {});
572
583
  }
573
584
  };
574
585
 
@@ -577,27 +588,47 @@ var TransactionsResource = class {
577
588
  constructor(httpClient) {
578
589
  this.httpClient = httpClient;
579
590
  }
580
- async list(params) {
581
- return this.httpClient.get("/transactions", params);
591
+ /** List payment transactions with cursor-based pagination. Filter by status or customer email. */
592
+ async list(params, options) {
593
+ return this.httpClient.get("/transactions", params, options);
582
594
  }
583
- async get(params) {
584
- return this.httpClient.get(`/transactions/${params.id}`);
595
+ /** Retrieve a single payment transaction by its public ID, including provider details. */
596
+ async get(params, options) {
597
+ const { id } = params;
598
+ return this.httpClient.get(`/transactions/${id}`, void 0, options);
585
599
  }
586
- /** Full refund only. */
600
+ /** Issue a full refund for a payment transaction. */
587
601
  async refund(params, options) {
588
- return this.httpClient.post(
589
- `/transactions/${params.id}/refund`,
590
- {},
591
- options
592
- );
602
+ const { id } = params;
603
+ return this.httpClient.post(`/transactions/${id}/refund`, {}, options);
593
604
  }
594
- /** Creates a new invoice and initiates a new payment attempt. */
605
+ /** Retry a failed payment transaction. Creates a new invoice and initiates a new payment attempt. */
595
606
  async retry(params, options) {
596
- return this.httpClient.post(
597
- `/transactions/${params.id}/retry`,
598
- {},
599
- options
600
- );
607
+ const { id } = params;
608
+ return this.httpClient.post(`/transactions/${id}/retry`, {}, options);
609
+ }
610
+ };
611
+
612
+ // src/_generated_resources.ts
613
+ var GeneratedResources = class {
614
+ initResources(http) {
615
+ this.addons = new AddonsResource(http);
616
+ this.apiKeys = new ApiKeysResource(http);
617
+ this.creditPacks = new CreditPacksResource(http);
618
+ this.customers = new CustomersResource(http);
619
+ this.featureAccess = new FeatureAccessResource(http);
620
+ this.features = new FeaturesResource(http);
621
+ this.invoices = new InvoicesResource(http);
622
+ this.payouts = new PayoutsResource(http);
623
+ this.planGroups = new PlanGroupsResource(http);
624
+ this.plans = new PlansResource(http);
625
+ this.portal = new PortalResource(http);
626
+ this.promoCodes = new PromoCodesResource(http);
627
+ this.quota = new QuotaResource(http);
628
+ this.seats = new SeatsResource(http);
629
+ this.subscriptions = new SubscriptionsResource(http);
630
+ this.testClock = new TestClockResource(http);
631
+ this.transactions = new TransactionsResource(http);
601
632
  }
602
633
  };
603
634
 
@@ -732,8 +763,8 @@ var CommetValidationError = class extends CommetError {
732
763
  };
733
764
 
734
765
  // src/version.ts
735
- var API_VERSION = "2026-05-25";
736
- var SDK_VERSION = "5.5.1";
766
+ var API_VERSION = "2026-06-10";
767
+ var SDK_VERSION = "7.0.0";
737
768
 
738
769
  // src/utils/telemetry.ts
739
770
  var registeredIntegrations = /* @__PURE__ */ new Set();
@@ -1041,8 +1072,9 @@ _CommetHTTPClient.BODY_METHODS = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH"
1041
1072
  var CommetHTTPClient = _CommetHTTPClient;
1042
1073
 
1043
1074
  // src/client.ts
1044
- var Commet = class {
1075
+ var Commet = class extends GeneratedResources {
1045
1076
  constructor(config) {
1077
+ super();
1046
1078
  if (!config.apiKey) {
1047
1079
  throw new Error("Commet SDK: API key is required");
1048
1080
  }
@@ -1052,20 +1084,7 @@ var Commet = class {
1052
1084
  );
1053
1085
  }
1054
1086
  this.httpClient = new CommetHTTPClient(config);
1055
- this.addons = new AddonsResource(this.httpClient);
1056
- this.apiKeys = new ApiKeysResource(this.httpClient);
1057
- this.creditPacks = new CreditPacksResource(this.httpClient);
1058
- this.customers = new CustomersResource(this.httpClient);
1059
- this.features = new FeaturesResource(this.httpClient);
1060
- this.invoices = new InvoicesResource(this.httpClient);
1061
- this.planGroups = new PlanGroupsResource(this.httpClient);
1062
- this.plans = new PlansResource(this.httpClient);
1063
- this.portal = new PortalResource(this.httpClient);
1064
- this.promoCodes = new PromoCodesResource(this.httpClient);
1065
- this.quota = new QuotaResource(this.httpClient);
1066
- this.seats = new SeatsResource(this.httpClient);
1067
- this.subscriptions = new SubscriptionsResource(this.httpClient);
1068
- this.transactions = new TransactionsResource(this.httpClient);
1087
+ this.initResources(this.httpClient);
1069
1088
  this.usage = new UsageResource(this.httpClient);
1070
1089
  this.webhooks = new Webhooks(this.httpClient);
1071
1090
  }