autumn-js 1.2.19 → 1.2.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/dist/backend/adapters/express.js +2481 -1919
  2. package/dist/backend/adapters/express.mjs +9 -9
  3. package/dist/backend/adapters/fetch.js +2481 -1919
  4. package/dist/backend/adapters/fetch.mjs +9 -9
  5. package/dist/backend/adapters/hono.js +2481 -1919
  6. package/dist/backend/adapters/hono.mjs +9 -9
  7. package/dist/backend/adapters/index.js +2481 -1919
  8. package/dist/backend/adapters/index.mjs +12 -12
  9. package/dist/backend/adapters/next.js +2481 -1919
  10. package/dist/backend/adapters/next.mjs +9 -9
  11. package/dist/backend/{chunk-VZ5YXSHU.mjs → chunk-5JNYI5HM.mjs} +1 -1
  12. package/dist/backend/{chunk-USOCI4FE.mjs → chunk-73KXFYFC.mjs} +5 -5
  13. package/dist/backend/{chunk-T5RLLZJB.mjs → chunk-GKYVE5XN.mjs} +2424 -1881
  14. package/dist/backend/{chunk-ATDRCSQT.mjs → chunk-H6KJYTJY.mjs} +7 -7
  15. package/dist/backend/{chunk-3TCAUBKX.mjs → chunk-K2JSUNJX.mjs} +1 -1
  16. package/dist/backend/{chunk-JAP7IT2U.mjs → chunk-NNIHXZQM.mjs} +1 -1
  17. package/dist/backend/{chunk-IJ2K62QI.mjs → chunk-NSHGFU5H.mjs} +59 -40
  18. package/dist/backend/{chunk-XBCWZIUH.mjs → chunk-TGR2RWLO.mjs} +1 -1
  19. package/dist/backend/core/handlers/coreHandler.d.mts +1 -1
  20. package/dist/backend/core/handlers/coreHandler.d.ts +1 -1
  21. package/dist/backend/core/handlers/coreHandler.js +2481 -1919
  22. package/dist/backend/core/handlers/coreHandler.mjs +7 -7
  23. package/dist/backend/core/handlers/executeRoute.d.mts +1 -1
  24. package/dist/backend/core/handlers/executeRoute.d.ts +1 -1
  25. package/dist/backend/core/handlers/executeRoute.mjs +4 -4
  26. package/dist/backend/core/handlers/handleRouteByName.js +2481 -1919
  27. package/dist/backend/core/handlers/handleRouteByName.mjs +7 -7
  28. package/dist/backend/core/handlers/index.d.mts +1 -1
  29. package/dist/backend/core/handlers/index.d.ts +1 -1
  30. package/dist/backend/core/handlers/index.js +2481 -1919
  31. package/dist/backend/core/handlers/index.mjs +10 -10
  32. package/dist/backend/core/index.d.mts +1 -1
  33. package/dist/backend/core/index.d.ts +1 -1
  34. package/dist/backend/core/index.js +2481 -1919
  35. package/dist/backend/core/index.mjs +10 -10
  36. package/dist/backend/core/routes/index.d.mts +1 -1
  37. package/dist/backend/core/routes/index.d.ts +1 -1
  38. package/dist/backend/core/routes/index.js +59 -40
  39. package/dist/backend/core/routes/index.mjs +2 -2
  40. package/dist/backend/core/routes/routeBuilder.d.mts +1 -1
  41. package/dist/backend/core/routes/routeBuilder.d.ts +1 -1
  42. package/dist/backend/core/routes/routeConfigs.d.mts +1 -1
  43. package/dist/backend/core/routes/routeConfigs.d.ts +1 -1
  44. package/dist/backend/core/routes/routeConfigs.js +59 -40
  45. package/dist/backend/core/routes/routeConfigs.mjs +2 -2
  46. package/dist/backend/core/types/handlerTypes.d.mts +1 -1
  47. package/dist/backend/core/types/handlerTypes.d.ts +1 -1
  48. package/dist/backend/core/types/index.d.mts +1 -1
  49. package/dist/backend/core/types/index.d.ts +1 -1
  50. package/dist/backend/core/types/routeTypes.d.mts +1 -1
  51. package/dist/backend/core/types/routeTypes.d.ts +1 -1
  52. package/dist/backend/core/utils/index.mjs +3 -3
  53. package/dist/backend/index.d.mts +2 -2
  54. package/dist/backend/index.d.ts +2 -2
  55. package/dist/backend/index.js +2481 -1919
  56. package/dist/backend/index.mjs +10 -10
  57. package/dist/backend/{routeTypes-gNxrwRsV.d.ts → routeTypes-B-Bkse9m.d.ts} +628 -7
  58. package/dist/backend/{routeTypes-BCnBLtb9.d.mts → routeTypes-DZFxBYSb.d.mts} +628 -7
  59. package/dist/better-auth/{chunk-VAQYB57J.mjs → chunk-4OLXYKUC.mjs} +2425 -1882
  60. package/dist/better-auth/{chunk-4QQUN4SQ.mjs → chunk-R35KMMJZ.mjs} +1 -1
  61. package/dist/better-auth/{chunk-XXPUYN7Z.mjs → chunk-X6KOCWP3.mjs} +59 -40
  62. package/dist/better-auth/index.js +2476 -1914
  63. package/dist/better-auth/index.mjs +3 -3
  64. package/dist/better-auth/utils/createAutumnEndpoint.js +59 -40
  65. package/dist/better-auth/utils/createAutumnEndpoint.mjs +2 -2
  66. package/dist/better-auth/utils/handleBetterAuthRoute.js +2481 -1919
  67. package/dist/better-auth/utils/handleBetterAuthRoute.mjs +2 -2
  68. package/dist/better-auth/utils/index.js +2476 -1914
  69. package/dist/better-auth/utils/index.mjs +3 -3
  70. package/dist/react/AutumnContext.d.mts +2 -2
  71. package/dist/react/AutumnContext.d.ts +2 -2
  72. package/dist/react/AutumnProvider.js +15 -15
  73. package/dist/react/AutumnProvider.mjs +2 -2
  74. package/dist/react/{chunk-7IDH4OMG.mjs → chunk-26CKSAPZ.mjs} +1 -1
  75. package/dist/react/{chunk-NSFHAUTD.mjs → chunk-CHU7CIWP.mjs} +1 -1
  76. package/dist/react/{chunk-YQFYWH7J.mjs → chunk-G7FTQLT7.mjs} +1 -1
  77. package/dist/react/{chunk-BDG6JHEW.mjs → chunk-HSQUB3BZ.mjs} +1 -1
  78. package/dist/react/{chunk-DEZBJQEG.mjs → chunk-KB72KQKN.mjs} +1 -1
  79. package/dist/react/{chunk-J6SLKTKE.mjs → chunk-MC2YYATT.mjs} +1 -1
  80. package/dist/react/{chunk-FWWIAOPU.mjs → chunk-OXQG65ZT.mjs} +1 -1
  81. package/dist/react/{chunk-E5ZHOMZ4.mjs → chunk-XJZH5NMZ.mjs} +23 -23
  82. package/dist/react/{chunk-HVBDZARN.mjs → chunk-ZGPE4R6H.mjs} +2 -2
  83. package/dist/react/client/AutumnClient.d.mts +2 -2
  84. package/dist/react/client/AutumnClient.d.ts +2 -2
  85. package/dist/react/client/IAutumnClient.d.mts +2 -2
  86. package/dist/react/client/IAutumnClient.d.ts +2 -2
  87. package/dist/react/client/index.d.mts +2 -2
  88. package/dist/react/client/index.d.ts +2 -2
  89. package/dist/react/{customer-SSq4WO45.d.ts → customer-CzMuZp8W.d.ts} +1 -0
  90. package/dist/react/{customer-BgMiezZt.d.mts → customer-DjlCjlmM.d.mts} +1 -0
  91. package/dist/react/hooks/index.d.mts +2 -2
  92. package/dist/react/hooks/index.d.ts +2 -2
  93. package/dist/react/hooks/index.js +16 -16
  94. package/dist/react/hooks/index.mjs +8 -8
  95. package/dist/react/hooks/internal/check/balanceToAllowed.d.mts +1 -1
  96. package/dist/react/hooks/internal/check/balanceToAllowed.d.ts +1 -1
  97. package/dist/react/hooks/internal/check/customerToFeatures.d.mts +1 -1
  98. package/dist/react/hooks/internal/check/customerToFeatures.d.ts +1 -1
  99. package/dist/react/hooks/internal/check/findCreditSystemsByFeature.d.mts +1 -1
  100. package/dist/react/hooks/internal/check/findCreditSystemsByFeature.d.ts +1 -1
  101. package/dist/react/hooks/internal/check/getCreditCost.d.mts +1 -1
  102. package/dist/react/hooks/internal/check/getCreditCost.d.ts +1 -1
  103. package/dist/react/hooks/internal/getLocalCheckResponse.d.mts +2 -2
  104. package/dist/react/hooks/internal/getLocalCheckResponse.d.ts +2 -2
  105. package/dist/react/hooks/internal/useCustomerActions.d.mts +2 -2
  106. package/dist/react/hooks/internal/useCustomerActions.d.ts +2 -2
  107. package/dist/react/hooks/internal/useCustomerActions.js +1 -1
  108. package/dist/react/hooks/internal/useCustomerActions.mjs +2 -2
  109. package/dist/react/hooks/useAggregateEvents.d.mts +1 -1
  110. package/dist/react/hooks/useAggregateEvents.d.ts +1 -1
  111. package/dist/react/hooks/useAggregateEvents.js +16 -16
  112. package/dist/react/hooks/useAggregateEvents.mjs +2 -2
  113. package/dist/react/hooks/useCustomer.d.mts +2 -2
  114. package/dist/react/hooks/useCustomer.d.ts +2 -2
  115. package/dist/react/hooks/useCustomer.js +16 -16
  116. package/dist/react/hooks/useCustomer.mjs +3 -3
  117. package/dist/react/hooks/useEntity.d.mts +1 -1
  118. package/dist/react/hooks/useEntity.d.ts +1 -1
  119. package/dist/react/hooks/useEntity.js +16 -16
  120. package/dist/react/hooks/useEntity.mjs +2 -2
  121. package/dist/react/hooks/useListEvents.d.mts +1 -1
  122. package/dist/react/hooks/useListEvents.d.ts +1 -1
  123. package/dist/react/hooks/useListEvents.js +16 -16
  124. package/dist/react/hooks/useListEvents.mjs +2 -2
  125. package/dist/react/hooks/useListPlans.d.mts +1 -1
  126. package/dist/react/hooks/useListPlans.d.ts +1 -1
  127. package/dist/react/hooks/useListPlans.js +16 -16
  128. package/dist/react/hooks/useListPlans.mjs +2 -2
  129. package/dist/react/hooks/useReferrals.d.mts +1 -1
  130. package/dist/react/hooks/useReferrals.d.ts +1 -1
  131. package/dist/react/hooks/useReferrals.js +16 -16
  132. package/dist/react/hooks/useReferrals.mjs +2 -2
  133. package/dist/react/index.d.mts +2 -2
  134. package/dist/react/index.d.ts +2 -2
  135. package/dist/react/index.js +22 -22
  136. package/dist/react/index.mjs +9 -9
  137. package/dist/react/{params--mMxYT5w.d.mts → params-BUQLwLrI.d.mts} +52 -0
  138. package/dist/react/{params-DVrQcAu7.d.ts → params-dYykqsvL.d.ts} +52 -0
  139. package/dist/sdk/index.d.mts +850 -106
  140. package/dist/sdk/index.d.ts +850 -106
  141. package/dist/sdk/index.js +4314 -3545
  142. package/dist/sdk/index.mjs +4240 -3539
  143. package/package.json +1 -1
  144. package/dist/backend/{chunk-55C2WWXQ.mjs → chunk-S5HPMJ4U.mjs} +3 -3
@@ -4686,6 +4686,7 @@ type CreatePlanParams = {
4686
4686
  * Miscellaneous plan-level configuration flags.
4687
4687
  */
4688
4688
  config?: CreatePlanConfigRequest | undefined;
4689
+ createInStripe?: boolean | undefined;
4689
4690
  };
4690
4691
  /**
4691
4692
  * Billing interval (e.g. 'month', 'year').
@@ -6151,6 +6152,7 @@ declare const CustomerRewardsType: {
6151
6152
  readonly FixedDiscount: "fixed_discount";
6152
6153
  readonly FreeProduct: "free_product";
6153
6154
  readonly InvoiceCredits: "invoice_credits";
6155
+ readonly FeatureGrant: "feature_grant";
6154
6156
  };
6155
6157
  /**
6156
6158
  * The type of reward
@@ -7002,6 +7004,7 @@ declare const GetCustomerRewardsType: {
7002
7004
  readonly FixedDiscount: "fixed_discount";
7003
7005
  readonly FreeProduct: "free_product";
7004
7006
  readonly InvoiceCredits: "invoice_credits";
7007
+ readonly FeatureGrant: "feature_grant";
7005
7008
  };
7006
7009
  /**
7007
7010
  * The type of reward
@@ -8130,20 +8133,20 @@ type ListCustomersPlan = {
8130
8133
  /**
8131
8134
  * Filter by customer product status. Defaults to active and scheduled
8132
8135
  */
8133
- declare const SubscriptionStatus: {
8136
+ declare const ListCustomersSubscriptionStatus: {
8134
8137
  readonly Active: "active";
8135
8138
  readonly Scheduled: "scheduled";
8136
8139
  };
8137
8140
  /**
8138
8141
  * Filter by customer product status. Defaults to active and scheduled
8139
8142
  */
8140
- type SubscriptionStatus = ClosedEnum<typeof SubscriptionStatus>;
8141
- declare const Processor: {
8143
+ type ListCustomersSubscriptionStatus = ClosedEnum<typeof ListCustomersSubscriptionStatus>;
8144
+ declare const ListCustomersProcessor: {
8142
8145
  readonly Stripe: "stripe";
8143
8146
  readonly Revenuecat: "revenuecat";
8144
8147
  readonly Vercel: "vercel";
8145
8148
  };
8146
- type Processor = ClosedEnum<typeof Processor>;
8149
+ type ListCustomersProcessor = ClosedEnum<typeof ListCustomersProcessor>;
8147
8150
  type ListCustomersParams = {
8148
8151
  /**
8149
8152
  * Number of items to skip
@@ -8160,7 +8163,7 @@ type ListCustomersParams = {
8160
8163
  /**
8161
8164
  * Filter by customer product status. Defaults to active and scheduled
8162
8165
  */
8163
- subscriptionStatus?: SubscriptionStatus | undefined;
8166
+ subscriptionStatus?: ListCustomersSubscriptionStatus | undefined;
8164
8167
  /**
8165
8168
  * Search customers by id, name, or email
8166
8169
  */
@@ -8168,7 +8171,7 @@ type ListCustomersParams = {
8168
8171
  /**
8169
8172
  * Filter by customer processor type (stripe, revenuecat, vercel)
8170
8173
  */
8171
- processors?: Array<Processor> | undefined;
8174
+ processors?: Array<ListCustomersProcessor> | undefined;
8172
8175
  };
8173
8176
  /**
8174
8177
  * The environment this customer was created in.
@@ -8685,6 +8688,440 @@ type ListCustomersResponse = {
8685
8688
  totalFilteredCount: number;
8686
8689
  };
8687
8690
 
8691
+ type ListEntitiesPlan = {
8692
+ id: string;
8693
+ versions?: Array<number> | undefined;
8694
+ };
8695
+ /**
8696
+ * Filter customer products used for entity hydration and plan matching. Defaults to active and scheduled.
8697
+ */
8698
+ declare const ListEntitiesSubscriptionStatus: {
8699
+ readonly Active: "active";
8700
+ readonly Scheduled: "scheduled";
8701
+ };
8702
+ /**
8703
+ * Filter customer products used for entity hydration and plan matching. Defaults to active and scheduled.
8704
+ */
8705
+ type ListEntitiesSubscriptionStatus = ClosedEnum<typeof ListEntitiesSubscriptionStatus>;
8706
+ declare const ListEntitiesProcessor: {
8707
+ readonly Stripe: "stripe";
8708
+ readonly Revenuecat: "revenuecat";
8709
+ readonly Vercel: "vercel";
8710
+ };
8711
+ type ListEntitiesProcessor = ClosedEnum<typeof ListEntitiesProcessor>;
8712
+ type ListEntitiesParams = {
8713
+ /**
8714
+ * Number of items to skip
8715
+ */
8716
+ offset?: number | undefined;
8717
+ /**
8718
+ * Number of items to return. Default 10, max 1000.
8719
+ */
8720
+ limit?: number | undefined;
8721
+ /**
8722
+ * Filter by plan ID and version. Returns entities with active subscriptions to this plan, including plans inherited from the parent customer.
8723
+ */
8724
+ plans?: Array<ListEntitiesPlan> | undefined;
8725
+ /**
8726
+ * Filter customer products used for entity hydration and plan matching. Defaults to active and scheduled.
8727
+ */
8728
+ subscriptionStatus?: ListEntitiesSubscriptionStatus | undefined;
8729
+ /**
8730
+ * Search entities by id or name.
8731
+ */
8732
+ search?: string | undefined;
8733
+ /**
8734
+ * Filter by parent customer processor type (stripe, revenuecat, vercel).
8735
+ */
8736
+ processors?: Array<ListEntitiesProcessor> | undefined;
8737
+ };
8738
+ /**
8739
+ * The environment (sandbox/live)
8740
+ */
8741
+ declare const ListEntitiesEnv: {
8742
+ readonly Sandbox: "sandbox";
8743
+ readonly Live: "live";
8744
+ };
8745
+ /**
8746
+ * The environment (sandbox/live)
8747
+ */
8748
+ type ListEntitiesEnv = OpenEnum<typeof ListEntitiesEnv>;
8749
+ /**
8750
+ * Current status of the subscription.
8751
+ */
8752
+ declare const ListEntitiesStatus: {
8753
+ readonly Active: "active";
8754
+ readonly Scheduled: "scheduled";
8755
+ };
8756
+ /**
8757
+ * Current status of the subscription.
8758
+ */
8759
+ type ListEntitiesStatus = OpenEnum<typeof ListEntitiesStatus>;
8760
+ type ListEntitiesSubscription = {
8761
+ /**
8762
+ * The unique identifier of this subscription. If a subscription_id was provided at attach time, it is used; otherwise, falls back to the internal ID.
8763
+ */
8764
+ id: string;
8765
+ plan?: Plan | undefined;
8766
+ /**
8767
+ * The unique identifier of the subscribed plan.
8768
+ */
8769
+ planId: string;
8770
+ /**
8771
+ * Whether the plan was automatically enabled for the customer.
8772
+ */
8773
+ autoEnable: boolean;
8774
+ /**
8775
+ * Whether this is an add-on plan rather than a base subscription.
8776
+ */
8777
+ addOn: boolean;
8778
+ /**
8779
+ * Current status of the subscription.
8780
+ */
8781
+ status: ListEntitiesStatus;
8782
+ /**
8783
+ * Whether the subscription has overdue payments.
8784
+ */
8785
+ pastDue: boolean;
8786
+ /**
8787
+ * Timestamp when the subscription was canceled, or null if not canceled.
8788
+ */
8789
+ canceledAt: number | null;
8790
+ /**
8791
+ * Timestamp when the subscription will expire, or null if no expiry set.
8792
+ */
8793
+ expiresAt: number | null;
8794
+ /**
8795
+ * Timestamp when the trial period ends, or null if not on trial.
8796
+ */
8797
+ trialEndsAt: number | null;
8798
+ /**
8799
+ * Timestamp when the subscription started.
8800
+ */
8801
+ startedAt: number;
8802
+ /**
8803
+ * Start timestamp of the current billing period.
8804
+ */
8805
+ currentPeriodStart: number | null;
8806
+ /**
8807
+ * End timestamp of the current billing period.
8808
+ */
8809
+ currentPeriodEnd: number | null;
8810
+ /**
8811
+ * Number of units of this subscription (for per-seat plans).
8812
+ */
8813
+ quantity: number;
8814
+ };
8815
+ type ListEntitiesPurchase = {
8816
+ plan?: Plan | undefined;
8817
+ /**
8818
+ * The unique identifier of the purchased plan.
8819
+ */
8820
+ planId: string;
8821
+ /**
8822
+ * Timestamp when the purchase expires, or null for lifetime access.
8823
+ */
8824
+ expiresAt: number | null;
8825
+ /**
8826
+ * Timestamp when the purchase was made.
8827
+ */
8828
+ startedAt: number;
8829
+ /**
8830
+ * Number of units purchased.
8831
+ */
8832
+ quantity: number;
8833
+ };
8834
+ /**
8835
+ * Feature type: 'boolean' for on/off access, 'metered' for usage-tracked features, 'credit_system' for unified credit pools.
8836
+ */
8837
+ declare const ListEntitiesType: {
8838
+ readonly Boolean: "boolean";
8839
+ readonly Metered: "metered";
8840
+ readonly CreditSystem: "credit_system";
8841
+ };
8842
+ /**
8843
+ * Feature type: 'boolean' for on/off access, 'metered' for usage-tracked features, 'credit_system' for unified credit pools.
8844
+ */
8845
+ type ListEntitiesType = OpenEnum<typeof ListEntitiesType>;
8846
+ type ListEntitiesCreditSchema = {
8847
+ /**
8848
+ * ID of the metered feature that draws from this credit system.
8849
+ */
8850
+ meteredFeatureId: string;
8851
+ /**
8852
+ * Credits consumed per unit of the metered feature.
8853
+ */
8854
+ creditCost: number;
8855
+ };
8856
+ /**
8857
+ * Display names for the feature in billing UI and customer-facing components.
8858
+ */
8859
+ type ListEntitiesDisplay = {
8860
+ /**
8861
+ * Singular form for UI display (e.g., 'API call', 'seat').
8862
+ */
8863
+ singular?: string | null | undefined;
8864
+ /**
8865
+ * Plural form for UI display (e.g., 'API calls', 'seats').
8866
+ */
8867
+ plural?: string | null | undefined;
8868
+ };
8869
+ /**
8870
+ * The full feature object if expanded.
8871
+ */
8872
+ type ListEntitiesFeature = {
8873
+ /**
8874
+ * The unique identifier for this feature, used in /check and /track calls.
8875
+ */
8876
+ id: string;
8877
+ /**
8878
+ * Human-readable name displayed in the dashboard and billing UI.
8879
+ */
8880
+ name: string;
8881
+ /**
8882
+ * Feature type: 'boolean' for on/off access, 'metered' for usage-tracked features, 'credit_system' for unified credit pools.
8883
+ */
8884
+ type: ListEntitiesType;
8885
+ /**
8886
+ * For metered features: true if usage resets periodically (API calls, credits), false if allocated persistently (seats, storage).
8887
+ */
8888
+ consumable: boolean;
8889
+ /**
8890
+ * Event names that trigger this feature's balance. Allows multiple features to respond to a single event.
8891
+ */
8892
+ eventNames?: Array<string> | undefined;
8893
+ /**
8894
+ * For credit_system features: maps metered features to their credit costs.
8895
+ */
8896
+ creditSchema?: Array<ListEntitiesCreditSchema> | undefined;
8897
+ /**
8898
+ * Display names for the feature in billing UI and customer-facing components.
8899
+ */
8900
+ display?: ListEntitiesDisplay | undefined;
8901
+ /**
8902
+ * Whether the feature is archived and hidden from the dashboard.
8903
+ */
8904
+ archived: boolean;
8905
+ };
8906
+ type ListEntitiesFlags = {
8907
+ /**
8908
+ * The unique identifier for this flag.
8909
+ */
8910
+ id: string;
8911
+ /**
8912
+ * The plan ID this flag originates from, or null for standalone flags.
8913
+ */
8914
+ planId: string | null;
8915
+ /**
8916
+ * Timestamp when this flag expires, or null for no expiration.
8917
+ */
8918
+ expiresAt: number | null;
8919
+ /**
8920
+ * The feature ID this flag is for.
8921
+ */
8922
+ featureId: string;
8923
+ /**
8924
+ * The full feature object if expanded.
8925
+ */
8926
+ feature?: ListEntitiesFeature | undefined;
8927
+ };
8928
+ type ListEntitiesSpendLimit = {
8929
+ /**
8930
+ * Optional feature ID this spend limit applies to.
8931
+ */
8932
+ featureId?: string | undefined;
8933
+ /**
8934
+ * Whether this spend limit is enabled.
8935
+ */
8936
+ enabled: boolean;
8937
+ /**
8938
+ * Maximum allowed overage spend for the target feature.
8939
+ */
8940
+ overageLimit?: number | undefined;
8941
+ };
8942
+ /**
8943
+ * Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
8944
+ */
8945
+ declare const ListEntitiesThresholdType: {
8946
+ readonly Usage: "usage";
8947
+ readonly UsagePercentage: "usage_percentage";
8948
+ readonly Remaining: "remaining";
8949
+ readonly RemainingPercentage: "remaining_percentage";
8950
+ };
8951
+ /**
8952
+ * Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
8953
+ */
8954
+ type ListEntitiesThresholdType = OpenEnum<typeof ListEntitiesThresholdType>;
8955
+ type ListEntitiesUsageAlert = {
8956
+ /**
8957
+ * The feature ID this alert applies to.
8958
+ */
8959
+ featureId?: string | undefined;
8960
+ /**
8961
+ * Whether this usage alert is enabled.
8962
+ */
8963
+ enabled: boolean;
8964
+ /**
8965
+ * The threshold value that triggers the alert. For usage or remaining, this is an absolute count. For usage_percentage or remaining_percentage, this is a percentage (0-100).
8966
+ */
8967
+ threshold: number;
8968
+ /**
8969
+ * Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
8970
+ */
8971
+ thresholdType: ListEntitiesThresholdType;
8972
+ /**
8973
+ * Optional user-defined label to distinguish multiple alerts on the same feature.
8974
+ */
8975
+ name?: string | undefined;
8976
+ };
8977
+ type ListEntitiesOverageAllowed = {
8978
+ /**
8979
+ * The feature ID this overage allowed control applies to.
8980
+ */
8981
+ featureId: string;
8982
+ /**
8983
+ * Whether overage is allowed for this feature.
8984
+ */
8985
+ enabled: boolean;
8986
+ };
8987
+ /**
8988
+ * Billing controls for the entity.
8989
+ */
8990
+ type ListEntitiesBillingControls = {
8991
+ /**
8992
+ * List of overage spend limits per feature.
8993
+ */
8994
+ spendLimits?: Array<ListEntitiesSpendLimit> | undefined;
8995
+ /**
8996
+ * List of usage alert configurations per feature.
8997
+ */
8998
+ usageAlerts?: Array<ListEntitiesUsageAlert> | undefined;
8999
+ /**
9000
+ * List of overage allowed controls per feature. When enabled, usage can exceed balance.
9001
+ */
9002
+ overageAllowed?: Array<ListEntitiesOverageAllowed> | undefined;
9003
+ };
9004
+ /**
9005
+ * The billing processor that owns this invoice.
9006
+ */
9007
+ declare const ListEntitiesProcessorType: {
9008
+ readonly Stripe: "stripe";
9009
+ readonly Revenuecat: "revenuecat";
9010
+ };
9011
+ /**
9012
+ * The billing processor that owns this invoice.
9013
+ */
9014
+ type ListEntitiesProcessorType = OpenEnum<typeof ListEntitiesProcessorType>;
9015
+ type ListEntitiesInvoice = {
9016
+ /**
9017
+ * Array of plan IDs included in this invoice
9018
+ */
9019
+ planIds: Array<string>;
9020
+ /**
9021
+ * The Stripe invoice ID
9022
+ */
9023
+ stripeId: string;
9024
+ /**
9025
+ * The billing processor that owns this invoice.
9026
+ */
9027
+ processorType: ListEntitiesProcessorType;
9028
+ /**
9029
+ * The status of the invoice
9030
+ */
9031
+ status: string;
9032
+ /**
9033
+ * The total amount of the invoice
9034
+ */
9035
+ total: number;
9036
+ /**
9037
+ * The currency code for the invoice
9038
+ */
9039
+ currency: string;
9040
+ /**
9041
+ * Timestamp when the invoice was created
9042
+ */
9043
+ createdAt: number;
9044
+ /**
9045
+ * URL to the Stripe-hosted invoice page
9046
+ */
9047
+ hostedInvoiceUrl?: string | null | undefined;
9048
+ };
9049
+ type ListEntitiesList = {
9050
+ /**
9051
+ * The unique identifier of the entity
9052
+ */
9053
+ id: string | null;
9054
+ /**
9055
+ * The name of the entity
9056
+ */
9057
+ name: string | null;
9058
+ /**
9059
+ * The customer ID this entity belongs to
9060
+ */
9061
+ customerId?: string | null | undefined;
9062
+ /**
9063
+ * The feature ID this entity belongs to
9064
+ */
9065
+ featureId?: string | null | undefined;
9066
+ /**
9067
+ * Unix timestamp when the entity was created
9068
+ */
9069
+ createdAt: number;
9070
+ /**
9071
+ * The environment (sandbox/live)
9072
+ */
9073
+ env: ListEntitiesEnv;
9074
+ subscriptions: Array<ListEntitiesSubscription>;
9075
+ purchases: Array<ListEntitiesPurchase>;
9076
+ balances: {
9077
+ [k: string]: Balance;
9078
+ };
9079
+ flags: {
9080
+ [k: string]: ListEntitiesFlags;
9081
+ };
9082
+ /**
9083
+ * Billing controls for the entity.
9084
+ */
9085
+ billingControls?: ListEntitiesBillingControls | undefined;
9086
+ /**
9087
+ * Invoices for this entity (only included when expand=invoices)
9088
+ */
9089
+ invoices?: Array<ListEntitiesInvoice> | undefined;
9090
+ };
9091
+ /**
9092
+ * OK
9093
+ */
9094
+ type ListEntitiesResponse = {
9095
+ /**
9096
+ * Array of items for current page
9097
+ */
9098
+ list: Array<ListEntitiesList>;
9099
+ /**
9100
+ * Whether more results exist after this page
9101
+ */
9102
+ hasMore: boolean;
9103
+ /**
9104
+ * Current offset position
9105
+ */
9106
+ offset: number;
9107
+ /**
9108
+ * Limit passed in the request
9109
+ */
9110
+ limit: number;
9111
+ /**
9112
+ * Total number of items returned in the current page
9113
+ */
9114
+ total: number;
9115
+ /**
9116
+ * Total number of entities available in the current organization and environment
9117
+ */
9118
+ totalCount: number;
9119
+ /**
9120
+ * Total number of entities matching the current filter before pagination is applied
9121
+ */
9122
+ totalFilteredCount: number;
9123
+ };
9124
+
8688
9125
  /**
8689
9126
  * Filter events by time range
8690
9127
  */
@@ -8724,6 +9161,54 @@ type EventsListParams = {
8724
9161
  */
8725
9162
  customRange?: ListEventsCustomRange | undefined;
8726
9163
  };
9164
+ declare const ListEventsIntervalEnum: {
9165
+ readonly OneOff: "one_off";
9166
+ readonly Minute: "minute";
9167
+ readonly Hour: "hour";
9168
+ readonly Day: "day";
9169
+ readonly Week: "week";
9170
+ readonly Month: "month";
9171
+ readonly Quarter: "quarter";
9172
+ readonly SemiAnnual: "semi_annual";
9173
+ readonly Year: "year";
9174
+ };
9175
+ type ListEventsIntervalEnum = OpenEnum<typeof ListEventsIntervalEnum>;
9176
+ type ListEventsReset = {
9177
+ /**
9178
+ * The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.
9179
+ */
9180
+ interval: ListEventsIntervalEnum | string;
9181
+ /**
9182
+ * Number of intervals between resets (eg. 2 for bi-monthly).
9183
+ */
9184
+ intervalCount?: number | undefined;
9185
+ /**
9186
+ * Timestamp when the balance will next reset.
9187
+ */
9188
+ resetsAt: number | null;
9189
+ };
9190
+ type Deductions = {
9191
+ /**
9192
+ * ID of the underlying balance row that was deducted from (customer_entitlement or rollover).
9193
+ */
9194
+ balanceId: string;
9195
+ /**
9196
+ * The feature this balance belongs to.
9197
+ */
9198
+ featureId: string;
9199
+ /**
9200
+ * ID of the plan/product this balance belongs to. Null when the balance can't be attributed to a single plan (e.g. it spans multiple).
9201
+ */
9202
+ planId: string | null;
9203
+ /**
9204
+ * Reset configuration for the balance this deduction came from, or null if the balance doesn't reset.
9205
+ */
9206
+ reset: ListEventsReset | null;
9207
+ /**
9208
+ * Amount deducted from this balance. Positive when usage was consumed, negative when credit was restored (e.g. a refund via negative track value).
9209
+ */
9210
+ value: number;
9211
+ };
8727
9212
  type ListEventsList = {
8728
9213
  /**
8729
9214
  * Event ID (KSUID)
@@ -8751,6 +9236,10 @@ type ListEventsList = {
8751
9236
  properties: {
8752
9237
  [k: string]: any;
8753
9238
  };
9239
+ /**
9240
+ * Per-balance breakdown of what this event deducted. Null for events ingested before deductions were tracked; an empty array means the event was accepted but no balance moved.
9241
+ */
9242
+ deductions: Array<Deductions> | null;
8754
9243
  };
8755
9244
  /**
8756
9245
  * OK
@@ -13718,6 +14207,54 @@ type TrackParams = {
13718
14207
  } | undefined;
13719
14208
  lock?: TrackLock | undefined;
13720
14209
  };
14210
+ declare const TrackIntervalEnum2: {
14211
+ readonly OneOff: "one_off";
14212
+ readonly Minute: "minute";
14213
+ readonly Hour: "hour";
14214
+ readonly Day: "day";
14215
+ readonly Week: "week";
14216
+ readonly Month: "month";
14217
+ readonly Quarter: "quarter";
14218
+ readonly SemiAnnual: "semi_annual";
14219
+ readonly Year: "year";
14220
+ };
14221
+ type TrackIntervalEnum2 = OpenEnum<typeof TrackIntervalEnum2>;
14222
+ type TrackReset2 = {
14223
+ /**
14224
+ * The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.
14225
+ */
14226
+ interval: TrackIntervalEnum2 | string;
14227
+ /**
14228
+ * Number of intervals between resets (eg. 2 for bi-monthly).
14229
+ */
14230
+ intervalCount?: number | undefined;
14231
+ /**
14232
+ * Timestamp when the balance will next reset.
14233
+ */
14234
+ resetsAt: number | null;
14235
+ };
14236
+ type Deduction2 = {
14237
+ /**
14238
+ * ID of the underlying balance row that was deducted from (customer_entitlement or rollover).
14239
+ */
14240
+ balanceId: string;
14241
+ /**
14242
+ * The feature this balance belongs to.
14243
+ */
14244
+ featureId: string;
14245
+ /**
14246
+ * ID of the plan/product this balance belongs to. Null when the balance can't be attributed to a single plan (e.g. it spans multiple).
14247
+ */
14248
+ planId: string | null;
14249
+ /**
14250
+ * Reset configuration for the balance this deduction came from, or null if the balance doesn't reset.
14251
+ */
14252
+ reset: TrackReset2 | null;
14253
+ /**
14254
+ * Amount deducted from this balance. Positive when usage was consumed, negative when credit was restored (e.g. a refund via negative track value).
14255
+ */
14256
+ value: number;
14257
+ };
13721
14258
  /**
13722
14259
  * Accepted. Autumn is experiencing degraded service from a downstream provider, so the event was accepted for replay and will be tracked as soon as the service is restored.
13723
14260
  */
@@ -13748,6 +14285,58 @@ type TrackResponseBody2 = {
13748
14285
  balances?: {
13749
14286
  [k: string]: Balance | null;
13750
14287
  } | undefined;
14288
+ /**
14289
+ * Per-balance breakdown of what this event deducted. A single event can consume from multiple balance rows when credit systems or rollovers are involved; this surfaces each one so callers can build per-feature usage views without polling.
14290
+ */
14291
+ deductions?: Array<Deduction2> | undefined;
14292
+ };
14293
+ declare const TrackIntervalEnum1: {
14294
+ readonly OneOff: "one_off";
14295
+ readonly Minute: "minute";
14296
+ readonly Hour: "hour";
14297
+ readonly Day: "day";
14298
+ readonly Week: "week";
14299
+ readonly Month: "month";
14300
+ readonly Quarter: "quarter";
14301
+ readonly SemiAnnual: "semi_annual";
14302
+ readonly Year: "year";
14303
+ };
14304
+ type TrackIntervalEnum1 = OpenEnum<typeof TrackIntervalEnum1>;
14305
+ type TrackReset1 = {
14306
+ /**
14307
+ * The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.
14308
+ */
14309
+ interval: TrackIntervalEnum1 | string;
14310
+ /**
14311
+ * Number of intervals between resets (eg. 2 for bi-monthly).
14312
+ */
14313
+ intervalCount?: number | undefined;
14314
+ /**
14315
+ * Timestamp when the balance will next reset.
14316
+ */
14317
+ resetsAt: number | null;
14318
+ };
14319
+ type Deduction1 = {
14320
+ /**
14321
+ * ID of the underlying balance row that was deducted from (customer_entitlement or rollover).
14322
+ */
14323
+ balanceId: string;
14324
+ /**
14325
+ * The feature this balance belongs to.
14326
+ */
14327
+ featureId: string;
14328
+ /**
14329
+ * ID of the plan/product this balance belongs to. Null when the balance can't be attributed to a single plan (e.g. it spans multiple).
14330
+ */
14331
+ planId: string | null;
14332
+ /**
14333
+ * Reset configuration for the balance this deduction came from, or null if the balance doesn't reset.
14334
+ */
14335
+ reset: TrackReset1 | null;
14336
+ /**
14337
+ * Amount deducted from this balance. Positive when usage was consumed, negative when credit was restored (e.g. a refund via negative track value).
14338
+ */
14339
+ value: number;
13751
14340
  };
13752
14341
  /**
13753
14342
  * OK
@@ -13779,6 +14368,10 @@ type TrackResponseBody1 = {
13779
14368
  balances?: {
13780
14369
  [k: string]: Balance | null;
13781
14370
  } | undefined;
14371
+ /**
14372
+ * Per-balance breakdown of what this event deducted. A single event can consume from multiple balance rows when credit systems or rollovers are involved; this surfaces each one so callers can build per-feature usage views without polling.
14373
+ */
14374
+ deductions?: Array<Deduction1> | undefined;
13782
14375
  };
13783
14376
  type TrackResponse = TrackResponseBody1 | TrackResponseBody2;
13784
14377
 
@@ -15415,6 +16008,7 @@ type UpdatePlanParams = {
15415
16008
  * Miscellaneous plan-level configuration flags.
15416
16009
  */
15417
16010
  config?: UpdatePlanConfigRequest | undefined;
16011
+ createInStripe?: boolean | undefined;
15418
16012
  version?: number | undefined;
15419
16013
  archived?: boolean | undefined;
15420
16014
  /**
@@ -16113,7 +16707,7 @@ declare class Billing extends ClientSDK {
16113
16707
  * @example
16114
16708
  * ```typescript
16115
16709
  * // Schedule a transition from a trial plan to a paid plan
16116
- * const response = await client.billing.createSchedule({ customerId: "cus_123", phases: [{"startsAt":1778177242707,"plans":[{"planId":"trial_plan"}]},{"startsAt":1779386842707,"plans":[{"planId":"pro_plan"}]}] });
16710
+ * const response = await client.billing.createSchedule({ customerId: "cus_123", phases: [{"startsAt":1778684108513,"plans":[{"planId":"trial_plan"}]},{"startsAt":1779893708513,"plans":[{"planId":"pro_plan"}]}] });
16117
16711
  * ```
16118
16712
  *
16119
16713
  * @param customerId - The ID of the customer to create the schedule for.
@@ -16428,6 +17022,33 @@ declare class Entities extends ClientSDK {
16428
17022
  * @returns The entity object including its current subscriptions, purchases, and balances.
16429
17023
  */
16430
17024
  get(request: GetEntityParams, options?: RequestOptions): Promise<GetEntityResponse>;
17025
+ /**
17026
+ * Lists entities across the organization with pagination and optional filters.
17027
+ *
17028
+ * Use this to page through entities globally, including filtering by plans inherited from parent customers or attached directly to entities.
17029
+ *
17030
+ * @example
17031
+ * ```typescript
17032
+ * // List entities on a plan
17033
+ * const response = await client.entities.list({ plans: [{"id":"pro_plan"}], limit: 10, offset: 0 });
17034
+ * ```
17035
+ *
17036
+ * @example
17037
+ * ```typescript
17038
+ * // Search entities by ID or name
17039
+ * const response = await client.entities.list({ search: "workspace" });
17040
+ * ```
17041
+ *
17042
+ * @param offset - Number of items to skip (optional)
17043
+ * @param limit - Number of items to return. Default 10, max 1000. (optional)
17044
+ * @param plans - Filter by plan ID and version. Returns entities with active subscriptions to this plan, including plans inherited from the parent customer. (optional)
17045
+ * @param subscriptionStatus - Filter customer products used for entity hydration and plan matching. Defaults to active and scheduled. (optional)
17046
+ * @param search - Search entities by id or name. (optional)
17047
+ * @param processors - Filter by parent customer processor type (stripe, revenuecat, vercel). (optional)
17048
+ *
17049
+ * @returns A paginated list of entity objects including their current subscriptions, purchases, balances, and flags.
17050
+ */
17051
+ list(request?: ListEntitiesParams | undefined, options?: RequestOptions): Promise<ListEntitiesResponse>;
16431
17052
  /**
16432
17053
  * Updates an existing entity and returns the refreshed entity object.
16433
17054
  *