@commet/node 7.6.0 → 7.8.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
@@ -110,6 +110,10 @@ commet pull
110
110
 
111
111
  This generates type-safe autocomplete for your plan codes, feature codes, and seat types.
112
112
 
113
+ ## Update notifications
114
+
115
+ During local development, the SDK checks npm once per process and warns when a newer `@commet/node` version is available. The check never runs in production or CI and does not block SDK initialization. Set `COMMET_NO_UPDATE_CHECK=1` to disable it.
116
+
113
117
  ## Documentation
114
118
 
115
119
  Visit [commet.co/docs](https://commet.co/docs) for:
package/dist/index.d.mts CHANGED
@@ -923,9 +923,13 @@ interface TestClockBilling {
923
923
  interface Transaction {
924
924
  id: string;
925
925
  invoiceId: string | null;
926
- grossAmount: number;
927
- subtotal: number;
926
+ /** Gross amount in USD cents. Null when the charge never settled in USD — a failed non-USD attempt has no exchange rate, so no USD figure exists; see presentmentAmount. */
927
+ grossAmount: number | null;
928
+ /** Subtotal in USD cents (gross minus tax). Null when grossAmount is null. */
929
+ subtotal: number | null;
928
930
  taxAmount: number | null;
931
+ /** Amount in the charge currency's smallest unit, as presented to the customer. Set for non-USD charges; null when the charge was made in USD. */
932
+ presentmentAmount: number | null;
929
933
  currency: string;
930
934
  /** The payment provider the charge was routed to: stripe, commet, or dlocal. */
931
935
  provider: PaymentProvider;
@@ -1383,7 +1387,7 @@ declare class PaymentsResource {
1383
1387
  list(params?: ListPaymentsParams, options?: RequestOptions): Promise<ApiResponse<Array<Payment>>>;
1384
1388
  /** Create a hosted payment link. Returns a url the customer opens to pay with any card. Calculates tax, generates an invoice, and vaults the payment method on confirmation. No subscription or plan required. */
1385
1389
  create(params: CreatePaymentParams, options?: RequestOptions): Promise<ApiResponse<Payment>>;
1386
- /** Charge a customer's vaulted payment method off-session. Calculates tax, generates an invoice, and sends a receipt. No subscription or plan required. */
1390
+ /** Charge a customer's vaulted payment method off-session. Calculates tax, generates an invoice, and sends a receipt. Requires the customer to have a subscription in active, trialing, or past_due state. */
1387
1391
  charge(params: ChargePaymentParams, options?: RequestOptions): Promise<ApiResponse<Payment>>;
1388
1392
  /** Retrieve a payment by its public ID. */
1389
1393
  get(params: GetPaymentParams, options?: RequestOptions): Promise<ApiResponse<Payment>>;
@@ -1833,6 +1837,7 @@ interface CreateSubscriptionParams {
1833
1837
  billingInterval?: BillingInterval | null;
1834
1838
  initialSeats?: Record<string, number>;
1835
1839
  skipTrial?: boolean;
1840
+ customTrialDays?: number;
1836
1841
  introOffer?: {
1837
1842
  discountType: DiscountType;
1838
1843
  discountValue: number;
@@ -1923,7 +1928,7 @@ declare class SubscriptionsResource {
1923
1928
  updatePaymentMethod(params: UpdatePaymentMethodParams, options?: RequestOptions): Promise<ApiResponse<PaymentMethodUpdateCheckout>>;
1924
1929
  /** Upgrade, downgrade, or change billing interval. */
1925
1930
  changePlan(params: ChangePlanParams, options?: RequestOptions): Promise<ApiResponse<PlanChange>>;
1926
- /** 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. */
1931
+ /** Preview proration details for an immediate plan change (an upgrade or a longer interval) without applying it. 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. 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. */
1927
1932
  previewChange(params: PreviewChangePlanParams, options?: RequestOptions): Promise<ApiResponse<PreviewChange>>;
1928
1933
  /** Activate an add-on on a subscription. Charges a prorated amount for the current billing period. */
1929
1934
  activateAddon(params: ActivateAddonParams, options?: RequestOptions): Promise<ApiResponse<SubscriptionAddon>>;
@@ -2260,7 +2265,7 @@ interface SubscriptionPlanChangeRevokedData {
2260
2265
  /** The previously scheduled billing interval, if the revoked change included one. */
2261
2266
  revokedBillingInterval: string | null;
2262
2267
  }
2263
- /** Fired when a recurring payment fails on a previously paid subscription and its status becomes past_due. Access is cut immediately for past_due subscriptions — use this to notify the customer and recover the payment. */
2268
+ /** Fired when a recurring payment fails on a previously paid subscription and its status becomes past_due. past_due is a grace window, not a cutoff: usage and seats keep working while new purchases are blocked, and dunning retries the charge — use this to notify the customer and recover the payment. */
2264
2269
  interface SubscriptionPastDueData {
2265
2270
  /** The subscription ID. */
2266
2271
  subscriptionId: string;
@@ -3208,7 +3213,7 @@ declare function createCommet<const TConfig extends BillingConfig>(_billingConfi
3208
3213
 
3209
3214
  declare function registerIntegration(name: string, version: string): void;
3210
3215
 
3211
- declare const API_VERSION = "2026-06-23";
3216
+ declare const API_VERSION = "2026-07-11";
3212
3217
  declare const SDK_VERSION: string;
3213
3218
 
3214
3219
  export { API_VERSION, type ActivateAddonParams, type ActiveAddon, type AddPayoutBankAccountParams, type AddPlanFeatureParams, type AddPlanPriceParams, type AddPlanToGroupParams, type AddQuotaParams, type AddSeatsParams, type AddedPlanToGroup, type Addon, type AddonActivatedData, type AddonDeactivatedData, type AdjustBalanceParams, type AdvanceTestClockParams, type ApiErrorDetail, type ApiKey, type ApiResponse, type BalanceAdjustment, type BalanceDepletedData, type BalanceLowData, type BalanceToppedUpData, type BalanceTopup, type BatchCreateCustomersParams, type BillingConfig, type BillingInterval, type BulkSeatUpdate, type BulkSetSeatsParams, type CanUseFeatureParams, type CancelPaymentParams, type CancelSubscriptionParams, type CanceledSubscription, type ChangePlanParams, type ChargePaymentParams, type CheckUsageParams, type CheckoutReadyData, Commet, CommetAPIError, type CommetClientOptions, CommetError, CommetValidationError, type CompletePayoutVerificationParams, type ConsumptionModel, type CreateAddonParams, type CreateAdjustmentInvoiceParams, type CreateApiKeyParams, type CreateCreditPackParams, type CreateCustomerParams, type CreateFeatureParams, type CreatePaymentParams, type CreatePlanGroupParams, type CreatePlanParams, type CreatePromoCodeParams, type CreateSubscriptionParams, type CreateSubscriptionRecoveryLinkParams, type CreateWebhookParams, type CreatedApiKey, type CreatedInvoice, type CreditGrant, type CreditPack, type CreditsDepletedData, type CreditsExpiredData, type CreditsGrantedData, type CreditsLowData, type CreditsPurchasedData, type Currency, type Customer, type CustomerBatch, type CustomerCreatedData, type CustomerID, type CustomerStateChangedData, type CustomerUpdatedData, 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 GetPaymentParams, 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 InvoiceCreatedData, type InvoiceDownload, type InvoiceOverdueData, type InvoiceStatus, type InvoiceType, type InvoiceUpcomingData, type InvoiceVoidedData, type ListActiveAddonsParams, type ListAddonsParams, type ListApiKeysParams, type ListCustomersParams, type ListFeatureAccessParams, type ListInvoicesParams, type ListPaymentsParams, type ListPlanGroupsParams, type ListPlansParams, type ListPromoCodesParams, type ListSubscriptionsParams, type ListTransactionsParams, type ListWebhooksParams, type PaginatedList, type PaginatedResponse, type Payment, type PaymentDisputeResolvedData, type PaymentDisputedData, type PaymentFailedData, type PaymentLinkCanceledData, type PaymentLinkCompletedData, type PaymentLinkCreatedData, type PaymentLinkFailedData, type PaymentMethodAttachedData, type PaymentMethodUpdateCheckout, type PaymentMethodUpdatedData, type PaymentProvider, type PaymentReceivedData, type PaymentRecoveredData, type PaymentRefundedData, type PaymentRetryFailedData, type Payout, type PayoutAvailableData, type PayoutBankAccount, type PayoutCreatedData, type PayoutFailedData, type PayoutPaidData, 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 QuotaExceededData, type QuotaThresholdReachedData, type ReactivateSubscriptionParams, type ReactivatedSubscription, type RecoveryLink, 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 SeatsLimitReachedData, type SeatsUpdatedData, type SendInvoiceParams, type SentInvoice, type SetDefaultPlanPriceParams, type SetPlanRegionalPricingParams, type SetPlanVisibilityParams, type SetQuotaParams, type SetSeatsParams, type Subscription, type SubscriptionActivatedData, type SubscriptionAddon, type SubscriptionCanceledData, type SubscriptionCancellationRevokedData, type SubscriptionCancellationScheduledData, type SubscriptionCreatedData, type SubscriptionPastDueData, type SubscriptionPlanChangeRevokedData, type SubscriptionPlanChangeScheduledData, type SubscriptionPlanChangedData, type SubscriptionReactivatedData, type SubscriptionStatus, type SubscriptionUpdatedData, 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 TrialCheckoutReadyData, type TrialConvertedData, type TrialExpiredData, type TrialStartedData, type TrialWillEndData, type UncancelSubscriptionParams, type UncanceledSubscription, type UpdateAddonParams, type UpdateCreditPackParams, type UpdateCustomerParams, type UpdateFeatureParams, type UpdateInvoiceStatusParams, type UpdatePaymentMethodParams, 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 UsageRecordedData, type WebhookAddonRef, type WebhookBalance, type WebhookBankRef, type WebhookCardInfo, type WebhookCreditsBalance, type WebhookData, type WebhookEndpoint, type WebhookEndpointCreated, type WebhookEvent, type WebhookEventDataMap, type WebhookEventEnvelope, type WebhookEventHandler, type WebhookEventPayload, type WebhookFeatureAccess, type WebhookPayload, type WebhookPlanRef, type WebhookSeatSummary, type WebhookTestResult, Webhooks, createCommet, Commet as default, defineConfig, registerIntegration };
package/dist/index.d.ts CHANGED
@@ -923,9 +923,13 @@ interface TestClockBilling {
923
923
  interface Transaction {
924
924
  id: string;
925
925
  invoiceId: string | null;
926
- grossAmount: number;
927
- subtotal: number;
926
+ /** Gross amount in USD cents. Null when the charge never settled in USD — a failed non-USD attempt has no exchange rate, so no USD figure exists; see presentmentAmount. */
927
+ grossAmount: number | null;
928
+ /** Subtotal in USD cents (gross minus tax). Null when grossAmount is null. */
929
+ subtotal: number | null;
928
930
  taxAmount: number | null;
931
+ /** Amount in the charge currency's smallest unit, as presented to the customer. Set for non-USD charges; null when the charge was made in USD. */
932
+ presentmentAmount: number | null;
929
933
  currency: string;
930
934
  /** The payment provider the charge was routed to: stripe, commet, or dlocal. */
931
935
  provider: PaymentProvider;
@@ -1383,7 +1387,7 @@ declare class PaymentsResource {
1383
1387
  list(params?: ListPaymentsParams, options?: RequestOptions): Promise<ApiResponse<Array<Payment>>>;
1384
1388
  /** Create a hosted payment link. Returns a url the customer opens to pay with any card. Calculates tax, generates an invoice, and vaults the payment method on confirmation. No subscription or plan required. */
1385
1389
  create(params: CreatePaymentParams, options?: RequestOptions): Promise<ApiResponse<Payment>>;
1386
- /** Charge a customer's vaulted payment method off-session. Calculates tax, generates an invoice, and sends a receipt. No subscription or plan required. */
1390
+ /** Charge a customer's vaulted payment method off-session. Calculates tax, generates an invoice, and sends a receipt. Requires the customer to have a subscription in active, trialing, or past_due state. */
1387
1391
  charge(params: ChargePaymentParams, options?: RequestOptions): Promise<ApiResponse<Payment>>;
1388
1392
  /** Retrieve a payment by its public ID. */
1389
1393
  get(params: GetPaymentParams, options?: RequestOptions): Promise<ApiResponse<Payment>>;
@@ -1833,6 +1837,7 @@ interface CreateSubscriptionParams {
1833
1837
  billingInterval?: BillingInterval | null;
1834
1838
  initialSeats?: Record<string, number>;
1835
1839
  skipTrial?: boolean;
1840
+ customTrialDays?: number;
1836
1841
  introOffer?: {
1837
1842
  discountType: DiscountType;
1838
1843
  discountValue: number;
@@ -1923,7 +1928,7 @@ declare class SubscriptionsResource {
1923
1928
  updatePaymentMethod(params: UpdatePaymentMethodParams, options?: RequestOptions): Promise<ApiResponse<PaymentMethodUpdateCheckout>>;
1924
1929
  /** Upgrade, downgrade, or change billing interval. */
1925
1930
  changePlan(params: ChangePlanParams, options?: RequestOptions): Promise<ApiResponse<PlanChange>>;
1926
- /** 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. */
1931
+ /** Preview proration details for an immediate plan change (an upgrade or a longer interval) without applying it. 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. 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. */
1927
1932
  previewChange(params: PreviewChangePlanParams, options?: RequestOptions): Promise<ApiResponse<PreviewChange>>;
1928
1933
  /** Activate an add-on on a subscription. Charges a prorated amount for the current billing period. */
1929
1934
  activateAddon(params: ActivateAddonParams, options?: RequestOptions): Promise<ApiResponse<SubscriptionAddon>>;
@@ -2260,7 +2265,7 @@ interface SubscriptionPlanChangeRevokedData {
2260
2265
  /** The previously scheduled billing interval, if the revoked change included one. */
2261
2266
  revokedBillingInterval: string | null;
2262
2267
  }
2263
- /** Fired when a recurring payment fails on a previously paid subscription and its status becomes past_due. Access is cut immediately for past_due subscriptions — use this to notify the customer and recover the payment. */
2268
+ /** Fired when a recurring payment fails on a previously paid subscription and its status becomes past_due. past_due is a grace window, not a cutoff: usage and seats keep working while new purchases are blocked, and dunning retries the charge — use this to notify the customer and recover the payment. */
2264
2269
  interface SubscriptionPastDueData {
2265
2270
  /** The subscription ID. */
2266
2271
  subscriptionId: string;
@@ -3208,7 +3213,7 @@ declare function createCommet<const TConfig extends BillingConfig>(_billingConfi
3208
3213
 
3209
3214
  declare function registerIntegration(name: string, version: string): void;
3210
3215
 
3211
- declare const API_VERSION = "2026-06-23";
3216
+ declare const API_VERSION = "2026-07-11";
3212
3217
  declare const SDK_VERSION: string;
3213
3218
 
3214
3219
  export { API_VERSION, type ActivateAddonParams, type ActiveAddon, type AddPayoutBankAccountParams, type AddPlanFeatureParams, type AddPlanPriceParams, type AddPlanToGroupParams, type AddQuotaParams, type AddSeatsParams, type AddedPlanToGroup, type Addon, type AddonActivatedData, type AddonDeactivatedData, type AdjustBalanceParams, type AdvanceTestClockParams, type ApiErrorDetail, type ApiKey, type ApiResponse, type BalanceAdjustment, type BalanceDepletedData, type BalanceLowData, type BalanceToppedUpData, type BalanceTopup, type BatchCreateCustomersParams, type BillingConfig, type BillingInterval, type BulkSeatUpdate, type BulkSetSeatsParams, type CanUseFeatureParams, type CancelPaymentParams, type CancelSubscriptionParams, type CanceledSubscription, type ChangePlanParams, type ChargePaymentParams, type CheckUsageParams, type CheckoutReadyData, Commet, CommetAPIError, type CommetClientOptions, CommetError, CommetValidationError, type CompletePayoutVerificationParams, type ConsumptionModel, type CreateAddonParams, type CreateAdjustmentInvoiceParams, type CreateApiKeyParams, type CreateCreditPackParams, type CreateCustomerParams, type CreateFeatureParams, type CreatePaymentParams, type CreatePlanGroupParams, type CreatePlanParams, type CreatePromoCodeParams, type CreateSubscriptionParams, type CreateSubscriptionRecoveryLinkParams, type CreateWebhookParams, type CreatedApiKey, type CreatedInvoice, type CreditGrant, type CreditPack, type CreditsDepletedData, type CreditsExpiredData, type CreditsGrantedData, type CreditsLowData, type CreditsPurchasedData, type Currency, type Customer, type CustomerBatch, type CustomerCreatedData, type CustomerID, type CustomerStateChangedData, type CustomerUpdatedData, 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 GetPaymentParams, 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 InvoiceCreatedData, type InvoiceDownload, type InvoiceOverdueData, type InvoiceStatus, type InvoiceType, type InvoiceUpcomingData, type InvoiceVoidedData, type ListActiveAddonsParams, type ListAddonsParams, type ListApiKeysParams, type ListCustomersParams, type ListFeatureAccessParams, type ListInvoicesParams, type ListPaymentsParams, type ListPlanGroupsParams, type ListPlansParams, type ListPromoCodesParams, type ListSubscriptionsParams, type ListTransactionsParams, type ListWebhooksParams, type PaginatedList, type PaginatedResponse, type Payment, type PaymentDisputeResolvedData, type PaymentDisputedData, type PaymentFailedData, type PaymentLinkCanceledData, type PaymentLinkCompletedData, type PaymentLinkCreatedData, type PaymentLinkFailedData, type PaymentMethodAttachedData, type PaymentMethodUpdateCheckout, type PaymentMethodUpdatedData, type PaymentProvider, type PaymentReceivedData, type PaymentRecoveredData, type PaymentRefundedData, type PaymentRetryFailedData, type Payout, type PayoutAvailableData, type PayoutBankAccount, type PayoutCreatedData, type PayoutFailedData, type PayoutPaidData, 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 QuotaExceededData, type QuotaThresholdReachedData, type ReactivateSubscriptionParams, type ReactivatedSubscription, type RecoveryLink, 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 SeatsLimitReachedData, type SeatsUpdatedData, type SendInvoiceParams, type SentInvoice, type SetDefaultPlanPriceParams, type SetPlanRegionalPricingParams, type SetPlanVisibilityParams, type SetQuotaParams, type SetSeatsParams, type Subscription, type SubscriptionActivatedData, type SubscriptionAddon, type SubscriptionCanceledData, type SubscriptionCancellationRevokedData, type SubscriptionCancellationScheduledData, type SubscriptionCreatedData, type SubscriptionPastDueData, type SubscriptionPlanChangeRevokedData, type SubscriptionPlanChangeScheduledData, type SubscriptionPlanChangedData, type SubscriptionReactivatedData, type SubscriptionStatus, type SubscriptionUpdatedData, 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 TrialCheckoutReadyData, type TrialConvertedData, type TrialExpiredData, type TrialStartedData, type TrialWillEndData, type UncancelSubscriptionParams, type UncanceledSubscription, type UpdateAddonParams, type UpdateCreditPackParams, type UpdateCustomerParams, type UpdateFeatureParams, type UpdateInvoiceStatusParams, type UpdatePaymentMethodParams, 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 UsageRecordedData, type WebhookAddonRef, type WebhookBalance, type WebhookBankRef, type WebhookCardInfo, type WebhookCreditsBalance, type WebhookData, type WebhookEndpoint, type WebhookEndpointCreated, type WebhookEvent, type WebhookEventDataMap, type WebhookEventEnvelope, type WebhookEventHandler, type WebhookEventPayload, type WebhookFeatureAccess, type WebhookPayload, type WebhookPlanRef, type WebhookSeatSummary, type WebhookTestResult, Webhooks, createCommet, Commet as default, defineConfig, registerIntegration };
package/dist/index.js CHANGED
@@ -259,7 +259,7 @@ var PaymentsResource = class {
259
259
  async create(params, options) {
260
260
  return this.httpClient.post("/payments", params, options);
261
261
  }
262
- /** Charge a customer's vaulted payment method off-session. Calculates tax, generates an invoice, and sends a receipt. No subscription or plan required. */
262
+ /** Charge a customer's vaulted payment method off-session. Calculates tax, generates an invoice, and sends a receipt. Requires the customer to have a subscription in active, trialing, or past_due state. */
263
263
  async charge(params, options) {
264
264
  return this.httpClient.post("/payments/charge", params, options);
265
265
  }
@@ -618,7 +618,7 @@ var SubscriptionsResource = class {
618
618
  options
619
619
  );
620
620
  }
621
- /** 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. */
621
+ /** Preview proration details for an immediate plan change (an upgrade or a longer interval) without applying it. 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. 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. */
622
622
  async previewChange(params, options) {
623
623
  const { id, ...rest } = params;
624
624
  return this.httpClient.post(
@@ -879,8 +879,8 @@ var CommetValidationError = class extends CommetError {
879
879
  };
880
880
 
881
881
  // src/version.ts
882
- var API_VERSION = "2026-06-23";
883
- var SDK_VERSION = "7.6.0";
882
+ var API_VERSION = "2026-07-11";
883
+ var SDK_VERSION = "7.8.0";
884
884
 
885
885
  // src/utils/telemetry.ts
886
886
  var registeredIntegrations = /* @__PURE__ */ new Set();
@@ -1204,6 +1204,116 @@ var _CommetHTTPClient = class _CommetHTTPClient {
1204
1204
  _CommetHTTPClient.BODY_METHODS = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH"]);
1205
1205
  var CommetHTTPClient = _CommetHTTPClient;
1206
1206
 
1207
+ // src/utils/update-check.ts
1208
+ var NPM_DIST_TAGS_URL = "https://registry.npmjs.org/-/package/%40commet%2Fnode/dist-tags";
1209
+ var UPDATE_CHECK_TIMEOUT_MS = 3e3;
1210
+ var UPDATE_CHECK_STATE_KEY = Symbol.for("@commet/node.update-check");
1211
+ function parseVersion(version) {
1212
+ const match = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/.exec(
1213
+ version
1214
+ );
1215
+ if (!match) return null;
1216
+ const numbers = [
1217
+ Number(match[1]),
1218
+ Number(match[2]),
1219
+ Number(match[3])
1220
+ ];
1221
+ if (!numbers.every(Number.isSafeInteger)) return null;
1222
+ return {
1223
+ numbers,
1224
+ prereleaseIdentifiers: match[4] ? match[4].split(".") : []
1225
+ };
1226
+ }
1227
+ function compareNumericIdentifier(latest, installed) {
1228
+ const normalizedLatest = latest.replace(/^0+(?=\d)/, "");
1229
+ const normalizedInstalled = installed.replace(/^0+(?=\d)/, "");
1230
+ if (normalizedLatest.length > normalizedInstalled.length) return 1;
1231
+ if (normalizedLatest.length < normalizedInstalled.length) return -1;
1232
+ if (normalizedLatest > normalizedInstalled) return 1;
1233
+ if (normalizedLatest < normalizedInstalled) return -1;
1234
+ return 0;
1235
+ }
1236
+ function comparePrereleaseIdentifier(latest, installed) {
1237
+ const latestIsNumber = /^\d+$/.test(latest);
1238
+ const installedIsNumber = /^\d+$/.test(installed);
1239
+ if (latestIsNumber && installedIsNumber) {
1240
+ return compareNumericIdentifier(latest, installed);
1241
+ }
1242
+ if (latestIsNumber) return -1;
1243
+ if (installedIsNumber) return 1;
1244
+ if (latest > installed) return 1;
1245
+ if (latest < installed) return -1;
1246
+ return 0;
1247
+ }
1248
+ function comparePrereleaseVersions(latest, installed) {
1249
+ if (latest.length === 0) return installed.length === 0 ? 0 : 1;
1250
+ if (installed.length === 0) return -1;
1251
+ const identifierCount = Math.max(latest.length, installed.length);
1252
+ for (let index = 0; index < identifierCount; index++) {
1253
+ const latestIdentifier = latest[index];
1254
+ const installedIdentifier = installed[index];
1255
+ if (latestIdentifier === void 0) return -1;
1256
+ if (installedIdentifier === void 0) return 1;
1257
+ const comparison = comparePrereleaseIdentifier(
1258
+ latestIdentifier,
1259
+ installedIdentifier
1260
+ );
1261
+ if (comparison !== 0) return comparison;
1262
+ }
1263
+ return 0;
1264
+ }
1265
+ function isNewerVersion(latest, installed) {
1266
+ const latestVersion = parseVersion(latest);
1267
+ const installedVersion = parseVersion(installed);
1268
+ if (!latestVersion || !installedVersion) return false;
1269
+ for (let index = 0; index < latestVersion.numbers.length; index++) {
1270
+ if (latestVersion.numbers[index] > installedVersion.numbers[index]) {
1271
+ return true;
1272
+ }
1273
+ if (latestVersion.numbers[index] < installedVersion.numbers[index]) {
1274
+ return false;
1275
+ }
1276
+ }
1277
+ return comparePrereleaseVersions(
1278
+ latestVersion.prereleaseIdentifiers,
1279
+ installedVersion.prereleaseIdentifiers
1280
+ ) > 0;
1281
+ }
1282
+ function claimSdkUpdateCheck() {
1283
+ if (Reflect.get(globalThis, UPDATE_CHECK_STATE_KEY) === true) return false;
1284
+ Reflect.set(globalThis, UPDATE_CHECK_STATE_KEY, true);
1285
+ return true;
1286
+ }
1287
+ function shouldCheckForSdkUpdates() {
1288
+ if (process.env.NODE_ENV !== "development") return false;
1289
+ if (process.env.CI) return false;
1290
+ return process.env.COMMET_NO_UPDATE_CHECK !== "1";
1291
+ }
1292
+ async function checkForSdkUpdate(installedVersion) {
1293
+ try {
1294
+ const response = await fetch(NPM_DIST_TAGS_URL, {
1295
+ signal: AbortSignal.timeout(UPDATE_CHECK_TIMEOUT_MS)
1296
+ });
1297
+ if (!response.ok) return;
1298
+ const distTags = await response.json();
1299
+ if (typeof distTags !== "object" || distTags === null || !("latest" in distTags) || typeof distTags.latest !== "string" || !isNewerVersion(distTags.latest, installedVersion)) {
1300
+ return;
1301
+ }
1302
+ console.warn(
1303
+ `[Commet] @commet/node ${installedVersion} is out of date. The latest version is ${distTags.latest}.
1304
+ Update with: npm install @commet/node@latest`
1305
+ );
1306
+ } catch {
1307
+ }
1308
+ }
1309
+ function scheduleSdkUpdateCheck() {
1310
+ if (!shouldCheckForSdkUpdates() || !claimSdkUpdateCheck()) return;
1311
+ const scheduledCheck = setImmediate(() => {
1312
+ void checkForSdkUpdate(SDK_VERSION);
1313
+ });
1314
+ scheduledCheck.unref();
1315
+ }
1316
+
1207
1317
  // src/client.ts
1208
1318
  var Commet = class extends GeneratedResources {
1209
1319
  constructor(config) {
@@ -1220,6 +1330,7 @@ var Commet = class extends GeneratedResources {
1220
1330
  this.initResources(this.httpClient);
1221
1331
  this.usage = new UsageResource(this.httpClient);
1222
1332
  this.webhooks = new Webhooks(this.httpClient);
1333
+ scheduleSdkUpdateCheck();
1223
1334
  }
1224
1335
  };
1225
1336
  function createCommet(_billingConfig, options) {