@commet/node 6.0.0 → 7.1.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 CHANGED
@@ -48,12 +48,12 @@ const commet = new Commet({
48
48
  // Create a customer
49
49
  const customer = await commet.customers.create({
50
50
  fullName: 'Acme Corp',
51
- billingEmail: 'billing@acme.com'
51
+ email: 'billing@acme.com'
52
52
  });
53
53
 
54
54
  // Subscribe them to a plan
55
55
  await commet.subscriptions.create({
56
- externalId: 'user_123',
56
+ customerId: 'cus_123',
57
57
  planCode: 'pro', // autocomplete works after `commet pull`
58
58
  billingInterval: 'yearly',
59
59
  });
@@ -86,14 +86,14 @@ const projects = await commet.quota.get({
86
86
  });
87
87
 
88
88
  // Check feature access
89
- const feature = await commet.features.get({
90
- externalId: 'user_123',
89
+ const access = await commet.featureAccess.canUse({
90
+ customerId: 'cus_123',
91
91
  code: 'api_calls'
92
92
  });
93
93
 
94
94
  // Generate customer portal link
95
95
  const portal = await commet.portal.getUrl({
96
- externalId: 'user_123'
96
+ customerId: 'cus_123'
97
97
  });
98
98
  ```
99
99
 
package/dist/index.d.mts CHANGED
@@ -820,6 +820,14 @@ interface Subscription {
820
820
  effectiveAt: string;
821
821
  } | null;
822
822
  cancelAtPeriodEnd: boolean;
823
+ scheduledPlanChange: {
824
+ changeType: "plan_downgrade" | "interval_change";
825
+ newPlanId: string | null;
826
+ newPlanName: string | null;
827
+ newBillingInterval: string | null;
828
+ /** @format date-time */
829
+ scheduledFor: string;
830
+ } | null;
823
831
  discount: {
824
832
  type: DiscountType;
825
833
  value: number;
@@ -949,6 +957,8 @@ declare class CommetHTTPClient {
949
957
  * Build full URL from endpoint and params
950
958
  */
951
959
  private buildURL;
960
+ private retryDelayMs;
961
+ private backoffDelayMs;
952
962
  private generateIdempotencyKey;
953
963
  /**
954
964
  * Sleep for specified milliseconds
@@ -957,7 +967,7 @@ declare class CommetHTTPClient {
957
967
  }
958
968
 
959
969
  interface ListActiveAddonsParams {
960
- customerId?: string;
970
+ customerId: string;
961
971
  }
962
972
  interface ListAddonsParams {
963
973
  limit?: number;
@@ -991,7 +1001,7 @@ declare class AddonsResource {
991
1001
  private httpClient;
992
1002
  constructor(httpClient: CommetHTTPClient);
993
1003
  /** List all active add-ons for a customer's subscription. */
994
- listActive(params?: ListActiveAddonsParams, options?: RequestOptions): Promise<ApiResponse<Array<ActiveAddon>>>;
1004
+ listActive(params: ListActiveAddonsParams, options?: RequestOptions): Promise<ApiResponse<Array<ActiveAddon>>>;
995
1005
  /** List all add-ons with cursor-based pagination. */
996
1006
  list(params?: ListAddonsParams, options?: RequestOptions): Promise<ApiResponse<Array<Addon>>>;
997
1007
  /** Retrieve an add-on by its public ID or slug. */
@@ -1135,7 +1145,7 @@ declare class CustomersResource {
1135
1145
  createBatch(params: BatchCreateCustomersParams, options?: RequestOptions): Promise<ApiResponse<CustomerBatch>>;
1136
1146
  }
1137
1147
 
1138
- interface ListFeaturesParams {
1148
+ interface ListFeatureAccessParams {
1139
1149
  customerId: string;
1140
1150
  }
1141
1151
  interface GetFeatureAccessParams {
@@ -1147,6 +1157,20 @@ interface CanUseFeatureParams {
1147
1157
  code: string;
1148
1158
  customerId: string;
1149
1159
  }
1160
+ declare class FeatureAccessResource {
1161
+ private httpClient;
1162
+ constructor(httpClient: CommetHTTPClient);
1163
+ /** List all features for a customer's active subscription, scoped by the customerId query parameter. */
1164
+ list(params: ListFeatureAccessParams, options?: RequestOptions): Promise<ApiResponse<Array<FeatureAccess>>>;
1165
+ /** Get feature access details for a customer. Use action=canUse to check if the customer can consume one more unit. */
1166
+ get(params: GetFeatureAccessParams, options?: RequestOptions): Promise<ApiResponse<FeatureLookup>>;
1167
+ /** Get feature access details for a customer. Use action=canUse to check if the customer can consume one more unit. */
1168
+ canUse(params: CanUseFeatureParams, options?: RequestOptions): Promise<ApiResponse<FeatureLookup>>;
1169
+ }
1170
+
1171
+ interface GetFeatureParams {
1172
+ code: string;
1173
+ }
1150
1174
  interface CreateFeatureParams {
1151
1175
  name: string;
1152
1176
  code: string;
@@ -1166,12 +1190,10 @@ interface DeleteFeatureParams {
1166
1190
  declare class FeaturesResource {
1167
1191
  private httpClient;
1168
1192
  constructor(httpClient: CommetHTTPClient);
1169
- /** List all features for a customer's active subscription. */
1170
- list(params: ListFeaturesParams, options?: RequestOptions): Promise<ApiResponse<Array<FeatureAccess>>>;
1171
- /** Get feature access details. Use action=canUse to check if customer can consume one more unit. */
1172
- get(params: GetFeatureAccessParams, options?: RequestOptions): Promise<ApiResponse<FeatureLookup>>;
1173
- /** Get feature access details. Use action=canUse to check if customer can consume one more unit. */
1174
- canUse(params: CanUseFeatureParams, options?: RequestOptions): Promise<ApiResponse<FeatureLookup>>;
1193
+ /** List every feature defined in the organization. This is the organization's feature catalog (definitions), not a customer's feature access. */
1194
+ list(): Promise<ApiResponse<Array<Feature>>>;
1195
+ /** Get a single feature definition by code from the organization's feature catalog. */
1196
+ get(params: GetFeatureParams, options?: RequestOptions): Promise<ApiResponse<Feature>>;
1175
1197
  /** Create a new feature. Code must be lowercase alphanumeric with underscores. */
1176
1198
  create(params: CreateFeatureParams, options?: RequestOptions): Promise<ApiResponse<Feature>>;
1177
1199
  /** Update a feature's name, description, or unit name. At least one field must be provided. */
@@ -1798,6 +1820,7 @@ declare class GeneratedResources {
1798
1820
  apiKeys: ApiKeysResource;
1799
1821
  creditPacks: CreditPacksResource;
1800
1822
  customers: CustomersResource;
1823
+ featureAccess: FeatureAccessResource;
1801
1824
  features: FeaturesResource;
1802
1825
  invoices: InvoicesResource;
1803
1826
  payouts: PayoutsResource;
@@ -2012,7 +2035,7 @@ declare function createCommet<const TConfig extends BillingConfig>(_billingConfi
2012
2035
 
2013
2036
  declare function registerIntegration(name: string, version: string): void;
2014
2037
 
2015
- declare const API_VERSION = "2026-06-07";
2038
+ declare const API_VERSION = "2026-06-10";
2016
2039
  declare const SDK_VERSION: string;
2017
2040
 
2018
- export { API_VERSION, type ActivateAddonParams, type ActiveAddon, type AddPayoutBankAccountParams, type AddPlanFeatureParams, type AddPlanPriceParams, type AddPlanToGroupParams, type AddQuotaParams, type AddSeatsParams, type AddedPlanToGroup, type Addon, type AdjustBalanceParams, type AdvanceTestClockParams, type ApiErrorDetail, type ApiKey, type ApiResponse, type BalanceAdjustment, type BalanceTopup, type BatchCreateCustomersParams, type BillingConfig, type BillingInterval, type BulkSeatUpdate, type BulkSetSeatsParams, type CanUseFeatureParams, type CancelSubscriptionParams, type CanceledSubscription, type ChangePlanParams, type CheckUsageParams, Commet, CommetAPIError, type CommetClientOptions, CommetError, CommetValidationError, type CompletePayoutVerificationParams, type ConsumptionModel, type CreateAddonParams, type CreateAdjustmentInvoiceParams, type CreateApiKeyParams, type CreateCreditPackParams, type CreateCustomerParams, type CreateFeatureParams, type CreatePlanGroupParams, type CreatePlanParams, type CreatePromoCodeParams, type CreateSubscriptionParams, type CreateWebhookParams, type CreatedApiKey, type CreatedInvoice, type CreditGrant, type CreditPack, type Currency, type Customer, type CustomerBatch, type CustomerID, type DeactivateAddonParams, type DefaultPlanPrice, type DeleteAddonParams, type DeleteApiKeyParams, type DeleteCreditPackParams, type DeleteFeatureParams, type DeletePlanGroupParams, type DeletePlanParams, type DeletePlanPriceParams, type DeleteRegionalPricesParams, type DeleteWebhookParams, type DeletedObject, type DeletedPlanRegionalPricing, type DeletedSubscriptionAddon, type DiscountType, type DownloadInvoiceParams, type EventID, type Feature, type FeatureAccess, type FeatureDef, type FeatureLookup, type FeatureType, type GetActiveSubscriptionParams, type GetAddonParams, type GetAllQuotaAllowancesParams, type GetAllSeatBalancesParams, type GetCustomerParams, type GetFeatureAccessParams, type GetInvoiceParams, type GetPlanGroupParams, type GetPlanParams, type GetPromoCodeParams, type GetQuotaAllowanceParams, type GetSeatBalanceParams, type GetSubscriptionParams, type GetTransactionParams, type GetWebhookParams, type InferFeatureCodes, type InferPlanCodes, type InferSeatCodes, type InferUsageCodes, type Invoice, type InvoiceDownload, type InvoiceStatus, type InvoiceType, type ListActiveAddonsParams, type ListAddonsParams, type ListApiKeysParams, type ListCustomersParams, type ListFeaturesParams, type ListInvoicesParams, type ListPlanGroupsParams, type ListPlansParams, type ListPromoCodesParams, type ListSubscriptionsParams, type ListTransactionsParams, type ListWebhooksParams, type PaginatedList, type PaginatedResponse, type Payout, type PayoutBankAccount, type PayoutVerification, type Plan, type PlanChange, type PlanDef, type PlanFeature, type PlanFeatureValue, type PlanGroup, type PlanPrice, type PlanRegionalPricing, type PlanRegionalPricingResult, type PlanVisibility, type PortalAccess, type PreviewChange, type PreviewChangePlanParams, type PriceDef, type PromoCode, type PurchaseCreditsParams, type RefundTransactionParams, type RemovePlanFeatureParams, type RemovePlanFromGroupParams, type RemoveQuotaParams, type RemoveSeatsParams, type RemovedPlanFeature, type RemovedPlanFromGroup, type ReorderPlansInGroupParams, type ReorderedPlans, type RequestOptions, type RequestPayoutParams, type RequestPortalAccessParams, type ResolvedFeatureCode, type ResolvedPlanCode, type ResolvedSeatCode, type ResolvedUsageCode, type RetryTransactionParams, SDK_VERSION, type SeatBalance, type SeatBalanceListItem, type SeatEvent, type SendInvoiceParams, type SentInvoice, type SetDefaultPlanPriceParams, type SetPlanRegionalPricingParams, type SetPlanVisibilityParams, type SetQuotaParams, type SetSeatsParams, type Subscription, type SubscriptionAddon, type SubscriptionStatus, type TestClock, type TestClockBilling, type TestWebhookParams, type Timezone, type TopupBalanceParams, type TrackModelTokensParams, type TrackParams, type TrackUsageParams, type Transaction, type TransactionRefund, type TransactionRetry, type TransactionStatus, type UncancelSubscriptionParams, type UncanceledSubscription, type UpdateAddonParams, type UpdateCreditPackParams, type UpdateCustomerParams, type UpdateFeatureParams, type UpdateInvoiceStatusParams, type UpdatePlanFeatureParams, type UpdatePlanGroupParams, type UpdatePlanParams, type UpdatePlanPriceParams, type UpdatePromoCodeParams, type UpdateWebhookParams, type UpsertRegionalPricesParams, type UsageCheckDenialReason, type UsageCheckResult, type UsageEvent, type UsageEventProperty, type UsageQuota, type UsageQuotaEvent, type WebhookData, type WebhookEndpoint, type WebhookEndpointCreated, type WebhookEvent, type WebhookPayload, type WebhookTestResult, Webhooks, createCommet, Commet as default, defineConfig, registerIntegration };
2041
+ export { API_VERSION, type ActivateAddonParams, type ActiveAddon, type AddPayoutBankAccountParams, type AddPlanFeatureParams, type AddPlanPriceParams, type AddPlanToGroupParams, type AddQuotaParams, type AddSeatsParams, type AddedPlanToGroup, type Addon, type AdjustBalanceParams, type AdvanceTestClockParams, type ApiErrorDetail, type ApiKey, type ApiResponse, type BalanceAdjustment, type BalanceTopup, type BatchCreateCustomersParams, type BillingConfig, type BillingInterval, type BulkSeatUpdate, type BulkSetSeatsParams, type CanUseFeatureParams, type CancelSubscriptionParams, type CanceledSubscription, type ChangePlanParams, type CheckUsageParams, Commet, CommetAPIError, type CommetClientOptions, CommetError, CommetValidationError, type CompletePayoutVerificationParams, type ConsumptionModel, type CreateAddonParams, type CreateAdjustmentInvoiceParams, type CreateApiKeyParams, type CreateCreditPackParams, type CreateCustomerParams, type CreateFeatureParams, type CreatePlanGroupParams, type CreatePlanParams, type CreatePromoCodeParams, type CreateSubscriptionParams, type CreateWebhookParams, type CreatedApiKey, type CreatedInvoice, type CreditGrant, type CreditPack, type Currency, type Customer, type CustomerBatch, type CustomerID, type DeactivateAddonParams, type DefaultPlanPrice, type DeleteAddonParams, type DeleteApiKeyParams, type DeleteCreditPackParams, type DeleteFeatureParams, type DeletePlanGroupParams, type DeletePlanParams, type DeletePlanPriceParams, type DeleteRegionalPricesParams, type DeleteWebhookParams, type DeletedObject, type DeletedPlanRegionalPricing, type DeletedSubscriptionAddon, type DiscountType, type DownloadInvoiceParams, type EventID, type Feature, type FeatureAccess, type FeatureDef, type FeatureLookup, type FeatureType, type GetActiveSubscriptionParams, type GetAddonParams, type GetAllQuotaAllowancesParams, type GetAllSeatBalancesParams, type GetCustomerParams, type GetFeatureAccessParams, type GetFeatureParams, type GetInvoiceParams, type GetPlanGroupParams, type GetPlanParams, type GetPromoCodeParams, type GetQuotaAllowanceParams, type GetSeatBalanceParams, type GetSubscriptionParams, type GetTransactionParams, type GetWebhookParams, type InferFeatureCodes, type InferPlanCodes, type InferSeatCodes, type InferUsageCodes, type Invoice, type InvoiceDownload, type InvoiceStatus, type InvoiceType, type ListActiveAddonsParams, type ListAddonsParams, type ListApiKeysParams, type ListCustomersParams, type ListFeatureAccessParams, type ListInvoicesParams, type ListPlanGroupsParams, type ListPlansParams, type ListPromoCodesParams, type ListSubscriptionsParams, type ListTransactionsParams, type ListWebhooksParams, type PaginatedList, type PaginatedResponse, type Payout, type PayoutBankAccount, type PayoutVerification, type Plan, type PlanChange, type PlanDef, type PlanFeature, type PlanFeatureValue, type PlanGroup, type PlanPrice, type PlanRegionalPricing, type PlanRegionalPricingResult, type PlanVisibility, type PortalAccess, type PreviewChange, type PreviewChangePlanParams, type PriceDef, type PromoCode, type PurchaseCreditsParams, type RefundTransactionParams, type RemovePlanFeatureParams, type RemovePlanFromGroupParams, type RemoveQuotaParams, type RemoveSeatsParams, type RemovedPlanFeature, type RemovedPlanFromGroup, type ReorderPlansInGroupParams, type ReorderedPlans, type RequestOptions, type RequestPayoutParams, type RequestPortalAccessParams, type ResolvedFeatureCode, type ResolvedPlanCode, type ResolvedSeatCode, type ResolvedUsageCode, type RetryTransactionParams, SDK_VERSION, type SeatBalance, type SeatBalanceListItem, type SeatEvent, type SendInvoiceParams, type SentInvoice, type SetDefaultPlanPriceParams, type SetPlanRegionalPricingParams, type SetPlanVisibilityParams, type SetQuotaParams, type SetSeatsParams, type Subscription, type SubscriptionAddon, type SubscriptionStatus, type TestClock, type TestClockBilling, type TestWebhookParams, type Timezone, type TopupBalanceParams, type TrackModelTokensParams, type TrackParams, type TrackUsageParams, type Transaction, type TransactionRefund, type TransactionRetry, type TransactionStatus, type UncancelSubscriptionParams, type UncanceledSubscription, type UpdateAddonParams, type UpdateCreditPackParams, type UpdateCustomerParams, type UpdateFeatureParams, type UpdateInvoiceStatusParams, type UpdatePlanFeatureParams, type UpdatePlanGroupParams, type UpdatePlanParams, type UpdatePlanPriceParams, type UpdatePromoCodeParams, type UpdateWebhookParams, type UpsertRegionalPricesParams, type UsageCheckDenialReason, type UsageCheckResult, type UsageEvent, type UsageEventProperty, type UsageQuota, type UsageQuotaEvent, type WebhookData, type WebhookEndpoint, type WebhookEndpointCreated, type WebhookEvent, type WebhookPayload, type WebhookTestResult, Webhooks, createCommet, Commet as default, defineConfig, registerIntegration };
package/dist/index.d.ts CHANGED
@@ -820,6 +820,14 @@ interface Subscription {
820
820
  effectiveAt: string;
821
821
  } | null;
822
822
  cancelAtPeriodEnd: boolean;
823
+ scheduledPlanChange: {
824
+ changeType: "plan_downgrade" | "interval_change";
825
+ newPlanId: string | null;
826
+ newPlanName: string | null;
827
+ newBillingInterval: string | null;
828
+ /** @format date-time */
829
+ scheduledFor: string;
830
+ } | null;
823
831
  discount: {
824
832
  type: DiscountType;
825
833
  value: number;
@@ -949,6 +957,8 @@ declare class CommetHTTPClient {
949
957
  * Build full URL from endpoint and params
950
958
  */
951
959
  private buildURL;
960
+ private retryDelayMs;
961
+ private backoffDelayMs;
952
962
  private generateIdempotencyKey;
953
963
  /**
954
964
  * Sleep for specified milliseconds
@@ -957,7 +967,7 @@ declare class CommetHTTPClient {
957
967
  }
958
968
 
959
969
  interface ListActiveAddonsParams {
960
- customerId?: string;
970
+ customerId: string;
961
971
  }
962
972
  interface ListAddonsParams {
963
973
  limit?: number;
@@ -991,7 +1001,7 @@ declare class AddonsResource {
991
1001
  private httpClient;
992
1002
  constructor(httpClient: CommetHTTPClient);
993
1003
  /** List all active add-ons for a customer's subscription. */
994
- listActive(params?: ListActiveAddonsParams, options?: RequestOptions): Promise<ApiResponse<Array<ActiveAddon>>>;
1004
+ listActive(params: ListActiveAddonsParams, options?: RequestOptions): Promise<ApiResponse<Array<ActiveAddon>>>;
995
1005
  /** List all add-ons with cursor-based pagination. */
996
1006
  list(params?: ListAddonsParams, options?: RequestOptions): Promise<ApiResponse<Array<Addon>>>;
997
1007
  /** Retrieve an add-on by its public ID or slug. */
@@ -1135,7 +1145,7 @@ declare class CustomersResource {
1135
1145
  createBatch(params: BatchCreateCustomersParams, options?: RequestOptions): Promise<ApiResponse<CustomerBatch>>;
1136
1146
  }
1137
1147
 
1138
- interface ListFeaturesParams {
1148
+ interface ListFeatureAccessParams {
1139
1149
  customerId: string;
1140
1150
  }
1141
1151
  interface GetFeatureAccessParams {
@@ -1147,6 +1157,20 @@ interface CanUseFeatureParams {
1147
1157
  code: string;
1148
1158
  customerId: string;
1149
1159
  }
1160
+ declare class FeatureAccessResource {
1161
+ private httpClient;
1162
+ constructor(httpClient: CommetHTTPClient);
1163
+ /** List all features for a customer's active subscription, scoped by the customerId query parameter. */
1164
+ list(params: ListFeatureAccessParams, options?: RequestOptions): Promise<ApiResponse<Array<FeatureAccess>>>;
1165
+ /** Get feature access details for a customer. Use action=canUse to check if the customer can consume one more unit. */
1166
+ get(params: GetFeatureAccessParams, options?: RequestOptions): Promise<ApiResponse<FeatureLookup>>;
1167
+ /** Get feature access details for a customer. Use action=canUse to check if the customer can consume one more unit. */
1168
+ canUse(params: CanUseFeatureParams, options?: RequestOptions): Promise<ApiResponse<FeatureLookup>>;
1169
+ }
1170
+
1171
+ interface GetFeatureParams {
1172
+ code: string;
1173
+ }
1150
1174
  interface CreateFeatureParams {
1151
1175
  name: string;
1152
1176
  code: string;
@@ -1166,12 +1190,10 @@ interface DeleteFeatureParams {
1166
1190
  declare class FeaturesResource {
1167
1191
  private httpClient;
1168
1192
  constructor(httpClient: CommetHTTPClient);
1169
- /** List all features for a customer's active subscription. */
1170
- list(params: ListFeaturesParams, options?: RequestOptions): Promise<ApiResponse<Array<FeatureAccess>>>;
1171
- /** Get feature access details. Use action=canUse to check if customer can consume one more unit. */
1172
- get(params: GetFeatureAccessParams, options?: RequestOptions): Promise<ApiResponse<FeatureLookup>>;
1173
- /** Get feature access details. Use action=canUse to check if customer can consume one more unit. */
1174
- canUse(params: CanUseFeatureParams, options?: RequestOptions): Promise<ApiResponse<FeatureLookup>>;
1193
+ /** List every feature defined in the organization. This is the organization's feature catalog (definitions), not a customer's feature access. */
1194
+ list(): Promise<ApiResponse<Array<Feature>>>;
1195
+ /** Get a single feature definition by code from the organization's feature catalog. */
1196
+ get(params: GetFeatureParams, options?: RequestOptions): Promise<ApiResponse<Feature>>;
1175
1197
  /** Create a new feature. Code must be lowercase alphanumeric with underscores. */
1176
1198
  create(params: CreateFeatureParams, options?: RequestOptions): Promise<ApiResponse<Feature>>;
1177
1199
  /** Update a feature's name, description, or unit name. At least one field must be provided. */
@@ -1798,6 +1820,7 @@ declare class GeneratedResources {
1798
1820
  apiKeys: ApiKeysResource;
1799
1821
  creditPacks: CreditPacksResource;
1800
1822
  customers: CustomersResource;
1823
+ featureAccess: FeatureAccessResource;
1801
1824
  features: FeaturesResource;
1802
1825
  invoices: InvoicesResource;
1803
1826
  payouts: PayoutsResource;
@@ -2012,7 +2035,7 @@ declare function createCommet<const TConfig extends BillingConfig>(_billingConfi
2012
2035
 
2013
2036
  declare function registerIntegration(name: string, version: string): void;
2014
2037
 
2015
- declare const API_VERSION = "2026-06-07";
2038
+ declare const API_VERSION = "2026-06-10";
2016
2039
  declare const SDK_VERSION: string;
2017
2040
 
2018
- export { API_VERSION, type ActivateAddonParams, type ActiveAddon, type AddPayoutBankAccountParams, type AddPlanFeatureParams, type AddPlanPriceParams, type AddPlanToGroupParams, type AddQuotaParams, type AddSeatsParams, type AddedPlanToGroup, type Addon, type AdjustBalanceParams, type AdvanceTestClockParams, type ApiErrorDetail, type ApiKey, type ApiResponse, type BalanceAdjustment, type BalanceTopup, type BatchCreateCustomersParams, type BillingConfig, type BillingInterval, type BulkSeatUpdate, type BulkSetSeatsParams, type CanUseFeatureParams, type CancelSubscriptionParams, type CanceledSubscription, type ChangePlanParams, type CheckUsageParams, Commet, CommetAPIError, type CommetClientOptions, CommetError, CommetValidationError, type CompletePayoutVerificationParams, type ConsumptionModel, type CreateAddonParams, type CreateAdjustmentInvoiceParams, type CreateApiKeyParams, type CreateCreditPackParams, type CreateCustomerParams, type CreateFeatureParams, type CreatePlanGroupParams, type CreatePlanParams, type CreatePromoCodeParams, type CreateSubscriptionParams, type CreateWebhookParams, type CreatedApiKey, type CreatedInvoice, type CreditGrant, type CreditPack, type Currency, type Customer, type CustomerBatch, type CustomerID, type DeactivateAddonParams, type DefaultPlanPrice, type DeleteAddonParams, type DeleteApiKeyParams, type DeleteCreditPackParams, type DeleteFeatureParams, type DeletePlanGroupParams, type DeletePlanParams, type DeletePlanPriceParams, type DeleteRegionalPricesParams, type DeleteWebhookParams, type DeletedObject, type DeletedPlanRegionalPricing, type DeletedSubscriptionAddon, type DiscountType, type DownloadInvoiceParams, type EventID, type Feature, type FeatureAccess, type FeatureDef, type FeatureLookup, type FeatureType, type GetActiveSubscriptionParams, type GetAddonParams, type GetAllQuotaAllowancesParams, type GetAllSeatBalancesParams, type GetCustomerParams, type GetFeatureAccessParams, type GetInvoiceParams, type GetPlanGroupParams, type GetPlanParams, type GetPromoCodeParams, type GetQuotaAllowanceParams, type GetSeatBalanceParams, type GetSubscriptionParams, type GetTransactionParams, type GetWebhookParams, type InferFeatureCodes, type InferPlanCodes, type InferSeatCodes, type InferUsageCodes, type Invoice, type InvoiceDownload, type InvoiceStatus, type InvoiceType, type ListActiveAddonsParams, type ListAddonsParams, type ListApiKeysParams, type ListCustomersParams, type ListFeaturesParams, type ListInvoicesParams, type ListPlanGroupsParams, type ListPlansParams, type ListPromoCodesParams, type ListSubscriptionsParams, type ListTransactionsParams, type ListWebhooksParams, type PaginatedList, type PaginatedResponse, type Payout, type PayoutBankAccount, type PayoutVerification, type Plan, type PlanChange, type PlanDef, type PlanFeature, type PlanFeatureValue, type PlanGroup, type PlanPrice, type PlanRegionalPricing, type PlanRegionalPricingResult, type PlanVisibility, type PortalAccess, type PreviewChange, type PreviewChangePlanParams, type PriceDef, type PromoCode, type PurchaseCreditsParams, type RefundTransactionParams, type RemovePlanFeatureParams, type RemovePlanFromGroupParams, type RemoveQuotaParams, type RemoveSeatsParams, type RemovedPlanFeature, type RemovedPlanFromGroup, type ReorderPlansInGroupParams, type ReorderedPlans, type RequestOptions, type RequestPayoutParams, type RequestPortalAccessParams, type ResolvedFeatureCode, type ResolvedPlanCode, type ResolvedSeatCode, type ResolvedUsageCode, type RetryTransactionParams, SDK_VERSION, type SeatBalance, type SeatBalanceListItem, type SeatEvent, type SendInvoiceParams, type SentInvoice, type SetDefaultPlanPriceParams, type SetPlanRegionalPricingParams, type SetPlanVisibilityParams, type SetQuotaParams, type SetSeatsParams, type Subscription, type SubscriptionAddon, type SubscriptionStatus, type TestClock, type TestClockBilling, type TestWebhookParams, type Timezone, type TopupBalanceParams, type TrackModelTokensParams, type TrackParams, type TrackUsageParams, type Transaction, type TransactionRefund, type TransactionRetry, type TransactionStatus, type UncancelSubscriptionParams, type UncanceledSubscription, type UpdateAddonParams, type UpdateCreditPackParams, type UpdateCustomerParams, type UpdateFeatureParams, type UpdateInvoiceStatusParams, type UpdatePlanFeatureParams, type UpdatePlanGroupParams, type UpdatePlanParams, type UpdatePlanPriceParams, type UpdatePromoCodeParams, type UpdateWebhookParams, type UpsertRegionalPricesParams, type UsageCheckDenialReason, type UsageCheckResult, type UsageEvent, type UsageEventProperty, type UsageQuota, type UsageQuotaEvent, type WebhookData, type WebhookEndpoint, type WebhookEndpointCreated, type WebhookEvent, type WebhookPayload, type WebhookTestResult, Webhooks, createCommet, Commet as default, defineConfig, registerIntegration };
2041
+ export { API_VERSION, type ActivateAddonParams, type ActiveAddon, type AddPayoutBankAccountParams, type AddPlanFeatureParams, type AddPlanPriceParams, type AddPlanToGroupParams, type AddQuotaParams, type AddSeatsParams, type AddedPlanToGroup, type Addon, type AdjustBalanceParams, type AdvanceTestClockParams, type ApiErrorDetail, type ApiKey, type ApiResponse, type BalanceAdjustment, type BalanceTopup, type BatchCreateCustomersParams, type BillingConfig, type BillingInterval, type BulkSeatUpdate, type BulkSetSeatsParams, type CanUseFeatureParams, type CancelSubscriptionParams, type CanceledSubscription, type ChangePlanParams, type CheckUsageParams, Commet, CommetAPIError, type CommetClientOptions, CommetError, CommetValidationError, type CompletePayoutVerificationParams, type ConsumptionModel, type CreateAddonParams, type CreateAdjustmentInvoiceParams, type CreateApiKeyParams, type CreateCreditPackParams, type CreateCustomerParams, type CreateFeatureParams, type CreatePlanGroupParams, type CreatePlanParams, type CreatePromoCodeParams, type CreateSubscriptionParams, type CreateWebhookParams, type CreatedApiKey, type CreatedInvoice, type CreditGrant, type CreditPack, type Currency, type Customer, type CustomerBatch, type CustomerID, type DeactivateAddonParams, type DefaultPlanPrice, type DeleteAddonParams, type DeleteApiKeyParams, type DeleteCreditPackParams, type DeleteFeatureParams, type DeletePlanGroupParams, type DeletePlanParams, type DeletePlanPriceParams, type DeleteRegionalPricesParams, type DeleteWebhookParams, type DeletedObject, type DeletedPlanRegionalPricing, type DeletedSubscriptionAddon, type DiscountType, type DownloadInvoiceParams, type EventID, type Feature, type FeatureAccess, type FeatureDef, type FeatureLookup, type FeatureType, type GetActiveSubscriptionParams, type GetAddonParams, type GetAllQuotaAllowancesParams, type GetAllSeatBalancesParams, type GetCustomerParams, type GetFeatureAccessParams, type GetFeatureParams, type GetInvoiceParams, type GetPlanGroupParams, type GetPlanParams, type GetPromoCodeParams, type GetQuotaAllowanceParams, type GetSeatBalanceParams, type GetSubscriptionParams, type GetTransactionParams, type GetWebhookParams, type InferFeatureCodes, type InferPlanCodes, type InferSeatCodes, type InferUsageCodes, type Invoice, type InvoiceDownload, type InvoiceStatus, type InvoiceType, type ListActiveAddonsParams, type ListAddonsParams, type ListApiKeysParams, type ListCustomersParams, type ListFeatureAccessParams, type ListInvoicesParams, type ListPlanGroupsParams, type ListPlansParams, type ListPromoCodesParams, type ListSubscriptionsParams, type ListTransactionsParams, type ListWebhooksParams, type PaginatedList, type PaginatedResponse, type Payout, type PayoutBankAccount, type PayoutVerification, type Plan, type PlanChange, type PlanDef, type PlanFeature, type PlanFeatureValue, type PlanGroup, type PlanPrice, type PlanRegionalPricing, type PlanRegionalPricingResult, type PlanVisibility, type PortalAccess, type PreviewChange, type PreviewChangePlanParams, type PriceDef, type PromoCode, type PurchaseCreditsParams, type RefundTransactionParams, type RemovePlanFeatureParams, type RemovePlanFromGroupParams, type RemoveQuotaParams, type RemoveSeatsParams, type RemovedPlanFeature, type RemovedPlanFromGroup, type ReorderPlansInGroupParams, type ReorderedPlans, type RequestOptions, type RequestPayoutParams, type RequestPortalAccessParams, type ResolvedFeatureCode, type ResolvedPlanCode, type ResolvedSeatCode, type ResolvedUsageCode, type RetryTransactionParams, SDK_VERSION, type SeatBalance, type SeatBalanceListItem, type SeatEvent, type SendInvoiceParams, type SentInvoice, type SetDefaultPlanPriceParams, type SetPlanRegionalPricingParams, type SetPlanVisibilityParams, type SetQuotaParams, type SetSeatsParams, type Subscription, type SubscriptionAddon, type SubscriptionStatus, type TestClock, type TestClockBilling, type TestWebhookParams, type Timezone, type TopupBalanceParams, type TrackModelTokensParams, type TrackParams, type TrackUsageParams, type Transaction, type TransactionRefund, type TransactionRetry, type TransactionStatus, type UncancelSubscriptionParams, type UncanceledSubscription, type UpdateAddonParams, type UpdateCreditPackParams, type UpdateCustomerParams, type UpdateFeatureParams, type UpdateInvoiceStatusParams, type UpdatePlanFeatureParams, type UpdatePlanGroupParams, type UpdatePlanParams, type UpdatePlanPriceParams, type UpdatePromoCodeParams, type UpdateWebhookParams, type UpsertRegionalPricesParams, type UsageCheckDenialReason, type UsageCheckResult, type UsageEvent, type UsageEventProperty, type UsageQuota, type UsageQuotaEvent, type WebhookData, type WebhookEndpoint, type WebhookEndpointCreated, type WebhookEvent, type WebhookPayload, type WebhookTestResult, Webhooks, createCommet, Commet as default, defineConfig, registerIntegration };
package/dist/index.js CHANGED
@@ -51,7 +51,7 @@ var AddonsResource = class {
51
51
  }
52
52
  /** List all active add-ons for a customer's subscription. */
53
53
  async listActive(params, options) {
54
- return this.httpClient.get("/addons/active", params, options);
54
+ return this.httpClient.get("/active-addons", params, options);
55
55
  }
56
56
  /** List all add-ons with cursor-based pagination. */
57
57
  async list(params, options) {
@@ -152,29 +152,45 @@ var CustomersResource = class {
152
152
  }
153
153
  };
154
154
 
155
- // src/resources/features.ts
156
- var FeaturesResource = class {
155
+ // src/resources/feature-access.ts
156
+ var FeatureAccessResource = class {
157
157
  constructor(httpClient) {
158
158
  this.httpClient = httpClient;
159
159
  }
160
- /** List all features for a customer's active subscription. */
160
+ /** List all features for a customer's active subscription, scoped by the customerId query parameter. */
161
161
  async list(params, options) {
162
- return this.httpClient.get("/features", params, options);
162
+ return this.httpClient.get("/feature-access", params, options);
163
163
  }
164
- /** Get feature access details. Use action=canUse to check if customer can consume one more unit. */
164
+ /** Get feature access details for a customer. Use action=canUse to check if the customer can consume one more unit. */
165
165
  async get(params, options) {
166
166
  const { code, ...rest } = params;
167
- return this.httpClient.get(`/features/${code}`, rest, options);
167
+ return this.httpClient.get(`/feature-access/${code}`, rest, options);
168
168
  }
169
- /** Get feature access details. Use action=canUse to check if customer can consume one more unit. */
169
+ /** Get feature access details for a customer. Use action=canUse to check if the customer can consume one more unit. */
170
170
  async canUse(params, options) {
171
171
  const { code, ...rest } = params;
172
172
  return this.httpClient.get(
173
- `/features/${code}`,
173
+ `/feature-access/${code}`,
174
174
  { ...rest, action: "canUse" },
175
175
  options
176
176
  );
177
177
  }
178
+ };
179
+
180
+ // src/resources/features.ts
181
+ var FeaturesResource = class {
182
+ constructor(httpClient) {
183
+ this.httpClient = httpClient;
184
+ }
185
+ /** List every feature defined in the organization. This is the organization's feature catalog (definitions), not a customer's feature access. */
186
+ async list() {
187
+ return this.httpClient.get("/features");
188
+ }
189
+ /** Get a single feature definition by code from the organization's feature catalog. */
190
+ async get(params, options) {
191
+ const { code } = params;
192
+ return this.httpClient.get(`/features/${code}`, void 0, options);
193
+ }
178
194
  /** Create a new feature. Code must be lowercase alphanumeric with underscores. */
179
195
  async create(params, options) {
180
196
  return this.httpClient.post("/features/manage", params, options);
@@ -646,6 +662,7 @@ var GeneratedResources = class {
646
662
  this.apiKeys = new ApiKeysResource(http);
647
663
  this.creditPacks = new CreditPacksResource(http);
648
664
  this.customers = new CustomersResource(http);
665
+ this.featureAccess = new FeatureAccessResource(http);
649
666
  this.features = new FeaturesResource(http);
650
667
  this.invoices = new InvoicesResource(http);
651
668
  this.payouts = new PayoutsResource(http);
@@ -792,8 +809,8 @@ var CommetValidationError = class extends CommetError {
792
809
  };
793
810
 
794
811
  // src/version.ts
795
- var API_VERSION = "2026-06-07";
796
- var SDK_VERSION = "6.0.0";
812
+ var API_VERSION = "2026-06-10";
813
+ var SDK_VERSION = "7.1.0";
797
814
 
798
815
  // src/utils/telemetry.ts
799
816
  var registeredIntegrations = /* @__PURE__ */ new Set();
@@ -877,6 +894,7 @@ var DEFAULT_RETRY_CONFIG = {
877
894
  // 8s
878
895
  retryableStatusCodes: [408, 429, 500, 502, 503, 504]
879
896
  };
897
+ var RETRY_AFTER_CAP_MS = 3e4;
880
898
  var _CommetHTTPClient = class _CommetHTTPClient {
881
899
  constructor(config) {
882
900
  this.lastRequestMetrics = null;
@@ -988,17 +1006,16 @@ var _CommetHTTPClient = class _CommetHTTPClient {
988
1006
  }
989
1007
  if (!response.ok) {
990
1008
  if (attempt <= this.retryConfig.maxRetries && this.retryConfig.retryableStatusCodes.includes(response.status)) {
991
- const delay = Math.min(
992
- this.retryConfig.baseDelay * 2 ** (attempt - 1),
993
- this.retryConfig.maxDelay
994
- );
995
- if (this.config.debug) {
996
- console.log(
997
- `[Commet SDK] Retrying in ${delay}ms (attempt ${attempt}/${this.retryConfig.maxRetries})`
998
- );
1009
+ const delay = this.retryDelayMs(attempt, response);
1010
+ if (delay !== null) {
1011
+ if (this.config.debug) {
1012
+ console.log(
1013
+ `[Commet SDK] Retrying in ${delay}ms (attempt ${attempt}/${this.retryConfig.maxRetries})`
1014
+ );
1015
+ }
1016
+ await this.sleep(delay);
1017
+ return this.executeRequest(method, url, data, options, attempt + 1);
999
1018
  }
1000
- await this.sleep(delay);
1001
- return this.executeRequest(method, url, data, options, attempt + 1);
1002
1019
  }
1003
1020
  if (this.config.debug) {
1004
1021
  console.log(
@@ -1048,10 +1065,7 @@ var _CommetHTTPClient = class _CommetHTTPClient {
1048
1065
  const isTimeoutErrorModern = typeof globalThis.DOMException !== "undefined" && error instanceof DOMException && error.name === "TimeoutError";
1049
1066
  if (isNetworkError || isTimeoutError || isTimeoutErrorModern) {
1050
1067
  if (attempt <= this.retryConfig.maxRetries) {
1051
- const delay = Math.min(
1052
- this.retryConfig.baseDelay * 2 ** (attempt - 1),
1053
- this.retryConfig.maxDelay
1054
- );
1068
+ const delay = this.backoffDelayMs(attempt);
1055
1069
  if (this.config.debug) {
1056
1070
  console.log(`[Commet SDK] Network error, retrying in ${delay}ms`);
1057
1071
  }
@@ -1087,6 +1101,26 @@ var _CommetHTTPClient = class _CommetHTTPClient {
1087
1101
  }
1088
1102
  return finalUrl;
1089
1103
  }
1104
+ // 429 retries wait exactly what the rate limiter reports in Retry-After
1105
+ // (seconds until the window resets); a 429 without the header did not come
1106
+ // from the rate limiter, so it is not retried (returns null). Exponential
1107
+ // backoff only applies to statuses that carry no server-provided wait.
1108
+ retryDelayMs(attempt, response) {
1109
+ if (response.status === 429) {
1110
+ const retryAfterSeconds = Number(response.headers.get("retry-after"));
1111
+ if (Number.isFinite(retryAfterSeconds) && retryAfterSeconds > 0) {
1112
+ return Math.min(retryAfterSeconds * 1e3, RETRY_AFTER_CAP_MS);
1113
+ }
1114
+ return null;
1115
+ }
1116
+ return this.backoffDelayMs(attempt);
1117
+ }
1118
+ backoffDelayMs(attempt) {
1119
+ return Math.min(
1120
+ this.retryConfig.baseDelay * 2 ** (attempt - 1),
1121
+ this.retryConfig.maxDelay
1122
+ );
1123
+ }
1090
1124
  generateIdempotencyKey() {
1091
1125
  return `commet-node-retry-${crypto.randomUUID()}`;
1092
1126
  }