autumn-js 1.2.30 → 1.2.32

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 (117) hide show
  1. package/dist/backend/adapters/express.js +2378 -2037
  2. package/dist/backend/adapters/express.mjs +9 -9
  3. package/dist/backend/adapters/fetch.js +2378 -2037
  4. package/dist/backend/adapters/fetch.mjs +9 -9
  5. package/dist/backend/adapters/hono.js +2378 -2037
  6. package/dist/backend/adapters/hono.mjs +9 -9
  7. package/dist/backend/adapters/index.js +2378 -2037
  8. package/dist/backend/adapters/index.mjs +12 -12
  9. package/dist/backend/adapters/next.js +2378 -2037
  10. package/dist/backend/adapters/next.mjs +9 -9
  11. package/dist/backend/{chunk-X3DVYZOC.mjs → chunk-5QIIBIZY.mjs} +7 -7
  12. package/dist/backend/{chunk-MWZDYRO7.mjs → chunk-7MPQ5TCH.mjs} +5 -5
  13. package/dist/backend/{chunk-ECIOGEDC.mjs → chunk-AYS6GLVO.mjs} +1 -1
  14. package/dist/backend/{chunk-TSMOAEQZ.mjs → chunk-MXD3NPQK.mjs} +1 -1
  15. package/dist/backend/{chunk-ILWBT65Y.mjs → chunk-NSAJNDTG.mjs} +1 -1
  16. package/dist/backend/{chunk-N72VCQNK.mjs → chunk-UYURZ75E.mjs} +1 -0
  17. package/dist/backend/{chunk-4D5WTA37.mjs → chunk-W7MG3LB3.mjs} +1 -1
  18. package/dist/backend/{chunk-6H7JNSG4.mjs → chunk-Z7WSDAEZ.mjs} +2377 -2037
  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 +2378 -2037
  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 +2378 -2037
  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 +2378 -2037
  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 +2378 -2037
  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 +1 -0
  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 +1 -0
  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 +2378 -2037
  56. package/dist/backend/index.mjs +10 -10
  57. package/dist/backend/{routeTypes-BZffsFMg.d.ts → routeTypes-ChCnBnee.d.ts} +147 -1
  58. package/dist/backend/{routeTypes-CtouWF41.d.mts → routeTypes-DmFnGvb2.d.mts} +147 -1
  59. package/dist/better-auth/{chunk-R3YUB555.mjs → chunk-56VTK4JS.mjs} +1 -1
  60. package/dist/better-auth/{chunk-NHHBDYNA.mjs → chunk-JBU3OM2O.mjs} +2378 -2038
  61. package/dist/better-auth/{chunk-UOQDNCD2.mjs → chunk-ZQA6B5RX.mjs} +1 -0
  62. package/dist/better-auth/index.js +2378 -2037
  63. package/dist/better-auth/index.mjs +3 -3
  64. package/dist/better-auth/utils/createAutumnEndpoint.js +1 -0
  65. package/dist/better-auth/utils/createAutumnEndpoint.mjs +2 -2
  66. package/dist/better-auth/utils/handleBetterAuthRoute.js +2378 -2037
  67. package/dist/better-auth/utils/handleBetterAuthRoute.mjs +2 -2
  68. package/dist/better-auth/utils/index.js +2378 -2037
  69. package/dist/better-auth/utils/index.mjs +3 -3
  70. package/dist/react/AutumnContext.d.mts +3 -3
  71. package/dist/react/AutumnContext.d.ts +3 -3
  72. package/dist/react/client/AutumnClient.d.mts +3 -3
  73. package/dist/react/client/AutumnClient.d.ts +3 -3
  74. package/dist/react/client/IAutumnClient.d.mts +9 -3
  75. package/dist/react/client/IAutumnClient.d.ts +9 -3
  76. package/dist/react/client/index.d.mts +3 -3
  77. package/dist/react/client/index.d.ts +3 -3
  78. package/dist/react/{customer-DjiQ6w1e.d.mts → customer-B9DcViyn.d.mts} +1 -1
  79. package/dist/react/{customer-BbU458Gc.d.ts → customer-DbS31iZc.d.ts} +1 -1
  80. package/dist/react/hooks/index.d.mts +3 -3
  81. package/dist/react/hooks/index.d.ts +3 -3
  82. package/dist/react/hooks/internal/check/balanceToAllowed.d.mts +2 -2
  83. package/dist/react/hooks/internal/check/balanceToAllowed.d.ts +2 -2
  84. package/dist/react/hooks/internal/check/customerToFeatures.d.mts +2 -2
  85. package/dist/react/hooks/internal/check/customerToFeatures.d.ts +2 -2
  86. package/dist/react/hooks/internal/check/findCreditSystemsByFeature.d.mts +2 -2
  87. package/dist/react/hooks/internal/check/findCreditSystemsByFeature.d.ts +2 -2
  88. package/dist/react/hooks/internal/check/getCreditCost.d.mts +2 -2
  89. package/dist/react/hooks/internal/check/getCreditCost.d.ts +2 -2
  90. package/dist/react/hooks/internal/getLocalCheckResponse.d.mts +3 -3
  91. package/dist/react/hooks/internal/getLocalCheckResponse.d.ts +3 -3
  92. package/dist/react/hooks/internal/useCustomerActions.d.mts +3 -3
  93. package/dist/react/hooks/internal/useCustomerActions.d.ts +3 -3
  94. package/dist/react/hooks/useAggregateEvents.d.mts +2 -2
  95. package/dist/react/hooks/useAggregateEvents.d.ts +2 -2
  96. package/dist/react/hooks/useCustomer.d.mts +3 -3
  97. package/dist/react/hooks/useCustomer.d.ts +3 -3
  98. package/dist/react/hooks/useEntity.d.mts +2 -2
  99. package/dist/react/hooks/useEntity.d.ts +2 -2
  100. package/dist/react/hooks/useListEvents.d.mts +2 -2
  101. package/dist/react/hooks/useListEvents.d.ts +2 -2
  102. package/dist/react/hooks/useListPlans.d.mts +2 -2
  103. package/dist/react/hooks/useListPlans.d.ts +2 -2
  104. package/dist/react/hooks/useReferrals.d.mts +2 -2
  105. package/dist/react/hooks/useReferrals.d.ts +2 -2
  106. package/dist/react/index.d.mts +3 -3
  107. package/dist/react/index.d.ts +3 -3
  108. package/dist/react/{params-B-8mg8Ze.d.mts → params-B8-s4Q1n.d.ts} +1 -1
  109. package/dist/react/{params-Dqm7Np9G.d.ts → params-BquS51Ut.d.mts} +1 -1
  110. package/dist/react/{plan-2RG0aPsm.d.mts → plan-BKltGb1S.d.mts} +6 -0
  111. package/dist/react/{plan-2RG0aPsm.d.ts → plan-BKltGb1S.d.ts} +6 -0
  112. package/dist/sdk/index.d.mts +195 -2
  113. package/dist/sdk/index.d.ts +195 -2
  114. package/dist/sdk/index.js +4572 -4203
  115. package/dist/sdk/index.mjs +4560 -4203
  116. package/package.json +1 -1
  117. package/dist/backend/{chunk-IXUCY7AU.mjs → chunk-MOHYGUMA.mjs} +3 -3
@@ -1,27 +1,27 @@
1
1
  import "./chunk-WYDGEDEU.mjs";
2
2
  import "./chunk-VXND2UDT.mjs";
3
- import "./chunk-MWZDYRO7.mjs";
3
+ import "./chunk-7MPQ5TCH.mjs";
4
4
  import {
5
5
  createCoreHandler
6
- } from "./chunk-X3DVYZOC.mjs";
6
+ } from "./chunk-5QIIBIZY.mjs";
7
+ import "./chunk-Z7WSDAEZ.mjs";
8
+ import "./chunk-MOHYGUMA.mjs";
9
+ import "./chunk-TBQ27LIK.mjs";
10
+ import "./chunk-J44WR3QZ.mjs";
7
11
  import "./chunk-TSF4YCUO.mjs";
8
12
  import {
9
13
  buildRouter
10
14
  } from "./chunk-UAR3TMWI.mjs";
11
- import "./chunk-6H7JNSG4.mjs";
12
15
  import {
13
16
  routeConfigs
14
- } from "./chunk-N72VCQNK.mjs";
15
- import "./chunk-IXUCY7AU.mjs";
17
+ } from "./chunk-UYURZ75E.mjs";
16
18
  import "./chunk-OTXV5FY7.mjs";
17
- import {
18
- sanitizeBody
19
- } from "./chunk-I7CD6EB6.mjs";
20
19
  import {
21
20
  secretKeyCheck
22
21
  } from "./chunk-VZIMT7AO.mjs";
23
- import "./chunk-TBQ27LIK.mjs";
24
- import "./chunk-J44WR3QZ.mjs";
22
+ import {
23
+ sanitizeBody
24
+ } from "./chunk-I7CD6EB6.mjs";
25
25
  import {
26
26
  backendError,
27
27
  backendSuccess,
@@ -1443,6 +1443,10 @@ type RequestBody = {
1443
1443
  properties?: {
1444
1444
  [k: string]: any;
1445
1445
  } | undefined;
1446
+ /**
1447
+ * Unix timestamp in milliseconds to use for the usage event. Defaults to the current time.
1448
+ */
1449
+ timestamp?: number | undefined;
1446
1450
  /**
1447
1451
  * If true, enqueue the event for asynchronous processing and return 204 immediately. The response will not include balance information.
1448
1452
  */
@@ -4079,6 +4083,12 @@ type Plan = {
4079
4083
  * Miscellaneous plan-level configuration flags.
4080
4084
  */
4081
4085
  config: PlanConfig;
4086
+ /**
4087
+ * Arbitrary key-value metadata defined by you for your own use. Shared across all versions of the plan.
4088
+ */
4089
+ metadata: {
4090
+ [k: string]: any;
4091
+ };
4082
4092
  customerEligibility?: CustomerEligibility | undefined;
4083
4093
  };
4084
4094
 
@@ -5167,6 +5177,12 @@ type CreatePlanParams = {
5167
5177
  * Miscellaneous plan-level configuration flags.
5168
5178
  */
5169
5179
  config?: CreatePlanConfigRequest | undefined;
5180
+ /**
5181
+ * Arbitrary key-value metadata defined by you for your own use (e.g. UI copy, feature highlights). Values can be any JSON-serializable value. Shared across all versions of the plan.
5182
+ */
5183
+ metadata?: {
5184
+ [k: string]: any;
5185
+ } | undefined;
5170
5186
  createInStripe?: boolean | undefined;
5171
5187
  };
5172
5188
  /**
@@ -5622,6 +5638,12 @@ type CreatePlanResponse = {
5622
5638
  * Miscellaneous plan-level configuration flags.
5623
5639
  */
5624
5640
  config: CreatePlanConfigResponse;
5641
+ /**
5642
+ * Arbitrary key-value metadata defined by you for your own use. Shared across all versions of the plan.
5643
+ */
5644
+ metadata: {
5645
+ [k: string]: any;
5646
+ };
5625
5647
  customerEligibility?: CreatePlanCustomerEligibility | undefined;
5626
5648
  };
5627
5649
 
@@ -9205,6 +9227,12 @@ type GetPlanResponse = {
9205
9227
  * Miscellaneous plan-level configuration flags.
9206
9228
  */
9207
9229
  config: GetPlanConfig;
9230
+ /**
9231
+ * Arbitrary key-value metadata defined by you for your own use. Shared across all versions of the plan.
9232
+ */
9233
+ metadata: {
9234
+ [k: string]: any;
9235
+ };
9208
9236
  customerEligibility?: GetPlanCustomerEligibility | undefined;
9209
9237
  };
9210
9238
 
@@ -11165,6 +11193,12 @@ type ListPlansList = {
11165
11193
  * Miscellaneous plan-level configuration flags.
11166
11194
  */
11167
11195
  config: ListPlansConfig;
11196
+ /**
11197
+ * Arbitrary key-value metadata defined by you for your own use. Shared across all versions of the plan.
11198
+ */
11199
+ metadata: {
11200
+ [k: string]: any;
11201
+ };
11168
11202
  customerEligibility?: ListPlansCustomerEligibility | undefined;
11169
11203
  };
11170
11204
  /**
@@ -11174,6 +11208,38 @@ type ListPlansResponse = {
11174
11208
  list: Array<ListPlansList>;
11175
11209
  };
11176
11210
 
11211
+ type MintKeyParams = {
11212
+ /**
11213
+ * The customer to mint a token for.
11214
+ */
11215
+ customerId: string;
11216
+ /**
11217
+ * If true, mint a non-expiring access token (no refresh token). Revoke via keys.revoke.
11218
+ */
11219
+ indefinite?: boolean | undefined;
11220
+ };
11221
+ /**
11222
+ * OK
11223
+ */
11224
+ type MintKeyResponse = {
11225
+ /**
11226
+ * Access token (1h, or non-expiring if indefinite), prefixed `am_jwt_`.
11227
+ */
11228
+ accessToken: string;
11229
+ /**
11230
+ * Rotating refresh token (24h). Omitted for indefinite tokens.
11231
+ */
11232
+ refreshToken?: string | undefined;
11233
+ /**
11234
+ * Access-token expiry, ms since epoch. null for indefinite tokens.
11235
+ */
11236
+ expiresAt: number | null;
11237
+ /**
11238
+ * Refresh-token expiry, ms since epoch. Omitted for indefinite tokens.
11239
+ */
11240
+ refreshExpiresAt?: number | undefined;
11241
+ };
11242
+
11177
11243
  /**
11178
11244
  * Billing interval (e.g. 'month', 'year').
11179
11245
  */
@@ -15040,6 +15106,45 @@ type RedeemRewardCodeResponse = {
15040
15106
  entitlementsGranted: Array<EntitlementsGranted>;
15041
15107
  };
15042
15108
 
15109
+ /**
15110
+ * No body. The refresh token is supplied as the Bearer credential; the response is a freshly rotated access + refresh pair.
15111
+ */
15112
+ type RefreshKeyParams = {};
15113
+ /**
15114
+ * OK
15115
+ */
15116
+ type RefreshKeyResponse = {
15117
+ /**
15118
+ * Access token (1h, or non-expiring if indefinite), prefixed `am_jwt_`.
15119
+ */
15120
+ accessToken: string;
15121
+ /**
15122
+ * Rotating refresh token (24h). Omitted for indefinite tokens.
15123
+ */
15124
+ refreshToken?: string | undefined;
15125
+ /**
15126
+ * Access-token expiry, ms since epoch. null for indefinite tokens.
15127
+ */
15128
+ expiresAt: number | null;
15129
+ /**
15130
+ * Refresh-token expiry, ms since epoch. Omitted for indefinite tokens.
15131
+ */
15132
+ refreshExpiresAt?: number | undefined;
15133
+ };
15134
+
15135
+ type RevokeKeyParams = {
15136
+ /**
15137
+ * The customer whose tokens (every outstanding access + refresh token) should be revoked.
15138
+ */
15139
+ customerId: string;
15140
+ };
15141
+ /**
15142
+ * OK
15143
+ */
15144
+ type RevokeKeyResponse = {
15145
+ revoked: true;
15146
+ };
15147
+
15043
15148
  /**
15044
15149
  * Quantity configuration for a prepaid feature.
15045
15150
  */
@@ -15905,6 +16010,10 @@ type TrackParams = {
15905
16010
  properties?: {
15906
16011
  [k: string]: any;
15907
16012
  } | undefined;
16013
+ /**
16014
+ * Unix timestamp in milliseconds to use for the usage event. Defaults to the current time.
16015
+ */
16016
+ timestamp?: number | undefined;
15908
16017
  /**
15909
16018
  * If true, enqueue the event for asynchronous processing and return 204 immediately. The response will not include balance information.
15910
16019
  */
@@ -16130,6 +16239,10 @@ type TrackTokensParams = {
16130
16239
  properties?: {
16131
16240
  [k: string]: any;
16132
16241
  } | undefined;
16242
+ /**
16243
+ * Unix timestamp in milliseconds to use for the usage event. Defaults to the current time.
16244
+ */
16245
+ timestamp?: number | undefined;
16133
16246
  /**
16134
16247
  * If true, enqueue the event for asynchronous processing and return 204 immediately. The response will not include balance information.
16135
16248
  */
@@ -18243,6 +18356,12 @@ type UpdatePlanParams = {
18243
18356
  * Miscellaneous plan-level configuration flags.
18244
18357
  */
18245
18358
  config?: UpdatePlanConfigRequest | undefined;
18359
+ /**
18360
+ * Arbitrary key-value metadata defined by you for your own use (e.g. UI copy, feature highlights). Values can be any JSON-serializable value. Shared across all versions of the plan.
18361
+ */
18362
+ metadata?: {
18363
+ [k: string]: any;
18364
+ } | undefined;
18246
18365
  createInStripe?: boolean | undefined;
18247
18366
  version?: number | undefined;
18248
18367
  archived?: boolean | undefined;
@@ -18705,6 +18824,12 @@ type UpdatePlanResponse = {
18705
18824
  * Miscellaneous plan-level configuration flags.
18706
18825
  */
18707
18826
  config: UpdatePlanConfigResponse;
18827
+ /**
18828
+ * Arbitrary key-value metadata defined by you for your own use. Shared across all versions of the plan.
18829
+ */
18830
+ metadata: {
18831
+ [k: string]: any;
18832
+ };
18708
18833
  customerEligibility?: UpdatePlanCustomerEligibility | undefined;
18709
18834
  };
18710
18835
 
@@ -18960,7 +19085,7 @@ declare class Billing extends ClientSDK {
18960
19085
  * @example
18961
19086
  * ```typescript
18962
19087
  * // Schedule a transition from a trial plan to a paid plan
18963
- * const response = await client.billing.createSchedule({ customerId: "cus_123", phases: [{"startsAt":1782124314923,"plans":[{"planId":"trial_plan"}]},{"startsAt":1783333914923,"plans":[{"planId":"pro_plan"}]}] });
19088
+ * const response = await client.billing.createSchedule({ customerId: "cus_123", phases: [{"startsAt":1782402442343,"plans":[{"planId":"trial_plan"}]},{"startsAt":1783612042343,"plans":[{"planId":"pro_plan"}]}] });
18964
19089
  * ```
18965
19090
  *
18966
19091
  * @param customerId - The ID of the customer to create the schedule for.
@@ -19467,6 +19592,21 @@ declare class Features extends ClientSDK {
19467
19592
  delete(request: DeleteFeatureParams, options?: RequestOptions): Promise<DeleteFeatureResponse>;
19468
19593
  }
19469
19594
 
19595
+ declare class Keys extends ClientSDK {
19596
+ /**
19597
+ * Mints a per-customer token (a scoped `am_jwt_` credential) so a downstream / self-hosted app can call Autumn directly without your secret key. Returns a short-lived access token plus a rotating refresh token, both bound to the given customer. Authenticated with your secret key.
19598
+ */
19599
+ mint(request: MintKeyParams, options?: RequestOptions): Promise<MintKeyResponse>;
19600
+ /**
19601
+ * Exchanges a refresh token (sent as the Bearer credential) for a freshly rotated access + refresh pair. Self-service for the token holder — no secret key required. The previous refresh token is honored for one rotation as a grace window; replaying an older one revokes the customer's tokens.
19602
+ */
19603
+ refresh(request: RefreshKeyParams, options?: RequestOptions): Promise<RefreshKeyResponse>;
19604
+ /**
19605
+ * Revokes every outstanding token (access and refresh) for a customer. Authenticated with your secret key. New tokens can be issued afterwards with `keys.mint`.
19606
+ */
19607
+ revoke(request: RevokeKeyParams, options?: RequestOptions): Promise<RevokeKeyResponse>;
19608
+ }
19609
+
19470
19610
  declare class Plans extends ClientSDK {
19471
19611
  /**
19472
19612
  * Create a plan
@@ -19547,6 +19687,7 @@ declare class Plans extends ClientSDK {
19547
19687
  * @param items - Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. (optional)
19548
19688
  * @param freeTrial - Free trial configuration. Customers can try this plan before being charged. (optional)
19549
19689
  * @param config - Miscellaneous plan-level configuration flags. (optional)
19690
+ * @param metadata - Arbitrary key-value metadata defined by you for your own use (e.g. UI copy, feature highlights). Values can be any JSON-serializable value. Shared across all versions of the plan. (optional)
19550
19691
  *
19551
19692
  * @returns The created plan object.
19552
19693
  */
@@ -19635,6 +19776,7 @@ declare class Plans extends ClientSDK {
19635
19776
  * @param items - Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. (optional)
19636
19777
  * @param freeTrial - The free trial of the plan. Set to null to remove the free trial. (optional)
19637
19778
  * @param config - Miscellaneous plan-level configuration flags. (optional)
19779
+ * @param metadata - Arbitrary key-value metadata defined by you for your own use (e.g. UI copy, feature highlights). Values can be any JSON-serializable value. Shared across all versions of the plan. (optional)
19638
19780
  * @param newPlanId - The new ID to use for the plan. Can only be updated if the plan has not been used by any customers. (optional)
19639
19781
  *
19640
19782
  * @returns The updated plan object.
@@ -19722,6 +19864,8 @@ declare class Autumn extends ClientSDK {
19722
19864
  get rewards(): Rewards;
19723
19865
  private _platform?;
19724
19866
  get platform(): Platform;
19867
+ private _keys?;
19868
+ get keys(): Keys;
19725
19869
  /**
19726
19870
  * Checks whether a customer currently has enough balance to use a feature.
19727
19871
  *
@@ -19780,6 +19924,7 @@ declare class Autumn extends ClientSDK {
19780
19924
  * @param eventName - Event name to track usage for. Use instead of feature_id when multiple features should be tracked from a single event. (optional)
19781
19925
  * @param value - The amount of usage to record. Defaults to 1. Use negative values to credit balance (e.g., when removing a seat). (optional)
19782
19926
  * @param properties - Additional properties to attach to this usage event. (optional)
19927
+ * @param timestamp - Unix timestamp in milliseconds to use for the usage event. Defaults to the current time. (optional)
19783
19928
  * @param async - If true, enqueue the event for asynchronous processing and return 204 immediately. The response will not include balance information. (optional)
19784
19929
  *
19785
19930
  * @returns The usage value recorded, with either a single updated balance or a map of updated balances. If Autumn is experiencing degraded service from a downstream provider, the API may return 202 after accepting the event for replay so it can be tracked as soon as the service is restored.
@@ -19815,6 +19960,7 @@ declare class Autumn extends ClientSDK {
19815
19960
  * @param audioOutputTokens - Number of audio output tokens generated. (optional)
19816
19961
  * @param reasoningTokens - Number of reasoning tokens generated. (optional)
19817
19962
  * @param properties - Additional properties to attach to this usage event. (optional)
19963
+ * @param timestamp - Unix timestamp in milliseconds to use for the usage event. Defaults to the current time. (optional)
19818
19964
  * @param async - If true, enqueue the event for asynchronous processing and return 204 immediately. The response will not include balance information. (optional)
19819
19965
  *
19820
19966
  * @returns The dollar value recorded and the updated AI credit system balance. If Autumn is experiencing degraded service from a downstream provider, the API may return 202 after accepting the token usage event for replay so it can be tracked as soon as the service is restored.
@@ -1443,6 +1443,10 @@ type RequestBody = {
1443
1443
  properties?: {
1444
1444
  [k: string]: any;
1445
1445
  } | undefined;
1446
+ /**
1447
+ * Unix timestamp in milliseconds to use for the usage event. Defaults to the current time.
1448
+ */
1449
+ timestamp?: number | undefined;
1446
1450
  /**
1447
1451
  * If true, enqueue the event for asynchronous processing and return 204 immediately. The response will not include balance information.
1448
1452
  */
@@ -4079,6 +4083,12 @@ type Plan = {
4079
4083
  * Miscellaneous plan-level configuration flags.
4080
4084
  */
4081
4085
  config: PlanConfig;
4086
+ /**
4087
+ * Arbitrary key-value metadata defined by you for your own use. Shared across all versions of the plan.
4088
+ */
4089
+ metadata: {
4090
+ [k: string]: any;
4091
+ };
4082
4092
  customerEligibility?: CustomerEligibility | undefined;
4083
4093
  };
4084
4094
 
@@ -5167,6 +5177,12 @@ type CreatePlanParams = {
5167
5177
  * Miscellaneous plan-level configuration flags.
5168
5178
  */
5169
5179
  config?: CreatePlanConfigRequest | undefined;
5180
+ /**
5181
+ * Arbitrary key-value metadata defined by you for your own use (e.g. UI copy, feature highlights). Values can be any JSON-serializable value. Shared across all versions of the plan.
5182
+ */
5183
+ metadata?: {
5184
+ [k: string]: any;
5185
+ } | undefined;
5170
5186
  createInStripe?: boolean | undefined;
5171
5187
  };
5172
5188
  /**
@@ -5622,6 +5638,12 @@ type CreatePlanResponse = {
5622
5638
  * Miscellaneous plan-level configuration flags.
5623
5639
  */
5624
5640
  config: CreatePlanConfigResponse;
5641
+ /**
5642
+ * Arbitrary key-value metadata defined by you for your own use. Shared across all versions of the plan.
5643
+ */
5644
+ metadata: {
5645
+ [k: string]: any;
5646
+ };
5625
5647
  customerEligibility?: CreatePlanCustomerEligibility | undefined;
5626
5648
  };
5627
5649
 
@@ -9205,6 +9227,12 @@ type GetPlanResponse = {
9205
9227
  * Miscellaneous plan-level configuration flags.
9206
9228
  */
9207
9229
  config: GetPlanConfig;
9230
+ /**
9231
+ * Arbitrary key-value metadata defined by you for your own use. Shared across all versions of the plan.
9232
+ */
9233
+ metadata: {
9234
+ [k: string]: any;
9235
+ };
9208
9236
  customerEligibility?: GetPlanCustomerEligibility | undefined;
9209
9237
  };
9210
9238
 
@@ -11165,6 +11193,12 @@ type ListPlansList = {
11165
11193
  * Miscellaneous plan-level configuration flags.
11166
11194
  */
11167
11195
  config: ListPlansConfig;
11196
+ /**
11197
+ * Arbitrary key-value metadata defined by you for your own use. Shared across all versions of the plan.
11198
+ */
11199
+ metadata: {
11200
+ [k: string]: any;
11201
+ };
11168
11202
  customerEligibility?: ListPlansCustomerEligibility | undefined;
11169
11203
  };
11170
11204
  /**
@@ -11174,6 +11208,38 @@ type ListPlansResponse = {
11174
11208
  list: Array<ListPlansList>;
11175
11209
  };
11176
11210
 
11211
+ type MintKeyParams = {
11212
+ /**
11213
+ * The customer to mint a token for.
11214
+ */
11215
+ customerId: string;
11216
+ /**
11217
+ * If true, mint a non-expiring access token (no refresh token). Revoke via keys.revoke.
11218
+ */
11219
+ indefinite?: boolean | undefined;
11220
+ };
11221
+ /**
11222
+ * OK
11223
+ */
11224
+ type MintKeyResponse = {
11225
+ /**
11226
+ * Access token (1h, or non-expiring if indefinite), prefixed `am_jwt_`.
11227
+ */
11228
+ accessToken: string;
11229
+ /**
11230
+ * Rotating refresh token (24h). Omitted for indefinite tokens.
11231
+ */
11232
+ refreshToken?: string | undefined;
11233
+ /**
11234
+ * Access-token expiry, ms since epoch. null for indefinite tokens.
11235
+ */
11236
+ expiresAt: number | null;
11237
+ /**
11238
+ * Refresh-token expiry, ms since epoch. Omitted for indefinite tokens.
11239
+ */
11240
+ refreshExpiresAt?: number | undefined;
11241
+ };
11242
+
11177
11243
  /**
11178
11244
  * Billing interval (e.g. 'month', 'year').
11179
11245
  */
@@ -15040,6 +15106,45 @@ type RedeemRewardCodeResponse = {
15040
15106
  entitlementsGranted: Array<EntitlementsGranted>;
15041
15107
  };
15042
15108
 
15109
+ /**
15110
+ * No body. The refresh token is supplied as the Bearer credential; the response is a freshly rotated access + refresh pair.
15111
+ */
15112
+ type RefreshKeyParams = {};
15113
+ /**
15114
+ * OK
15115
+ */
15116
+ type RefreshKeyResponse = {
15117
+ /**
15118
+ * Access token (1h, or non-expiring if indefinite), prefixed `am_jwt_`.
15119
+ */
15120
+ accessToken: string;
15121
+ /**
15122
+ * Rotating refresh token (24h). Omitted for indefinite tokens.
15123
+ */
15124
+ refreshToken?: string | undefined;
15125
+ /**
15126
+ * Access-token expiry, ms since epoch. null for indefinite tokens.
15127
+ */
15128
+ expiresAt: number | null;
15129
+ /**
15130
+ * Refresh-token expiry, ms since epoch. Omitted for indefinite tokens.
15131
+ */
15132
+ refreshExpiresAt?: number | undefined;
15133
+ };
15134
+
15135
+ type RevokeKeyParams = {
15136
+ /**
15137
+ * The customer whose tokens (every outstanding access + refresh token) should be revoked.
15138
+ */
15139
+ customerId: string;
15140
+ };
15141
+ /**
15142
+ * OK
15143
+ */
15144
+ type RevokeKeyResponse = {
15145
+ revoked: true;
15146
+ };
15147
+
15043
15148
  /**
15044
15149
  * Quantity configuration for a prepaid feature.
15045
15150
  */
@@ -15905,6 +16010,10 @@ type TrackParams = {
15905
16010
  properties?: {
15906
16011
  [k: string]: any;
15907
16012
  } | undefined;
16013
+ /**
16014
+ * Unix timestamp in milliseconds to use for the usage event. Defaults to the current time.
16015
+ */
16016
+ timestamp?: number | undefined;
15908
16017
  /**
15909
16018
  * If true, enqueue the event for asynchronous processing and return 204 immediately. The response will not include balance information.
15910
16019
  */
@@ -16130,6 +16239,10 @@ type TrackTokensParams = {
16130
16239
  properties?: {
16131
16240
  [k: string]: any;
16132
16241
  } | undefined;
16242
+ /**
16243
+ * Unix timestamp in milliseconds to use for the usage event. Defaults to the current time.
16244
+ */
16245
+ timestamp?: number | undefined;
16133
16246
  /**
16134
16247
  * If true, enqueue the event for asynchronous processing and return 204 immediately. The response will not include balance information.
16135
16248
  */
@@ -18243,6 +18356,12 @@ type UpdatePlanParams = {
18243
18356
  * Miscellaneous plan-level configuration flags.
18244
18357
  */
18245
18358
  config?: UpdatePlanConfigRequest | undefined;
18359
+ /**
18360
+ * Arbitrary key-value metadata defined by you for your own use (e.g. UI copy, feature highlights). Values can be any JSON-serializable value. Shared across all versions of the plan.
18361
+ */
18362
+ metadata?: {
18363
+ [k: string]: any;
18364
+ } | undefined;
18246
18365
  createInStripe?: boolean | undefined;
18247
18366
  version?: number | undefined;
18248
18367
  archived?: boolean | undefined;
@@ -18705,6 +18824,12 @@ type UpdatePlanResponse = {
18705
18824
  * Miscellaneous plan-level configuration flags.
18706
18825
  */
18707
18826
  config: UpdatePlanConfigResponse;
18827
+ /**
18828
+ * Arbitrary key-value metadata defined by you for your own use. Shared across all versions of the plan.
18829
+ */
18830
+ metadata: {
18831
+ [k: string]: any;
18832
+ };
18708
18833
  customerEligibility?: UpdatePlanCustomerEligibility | undefined;
18709
18834
  };
18710
18835
 
@@ -18960,7 +19085,7 @@ declare class Billing extends ClientSDK {
18960
19085
  * @example
18961
19086
  * ```typescript
18962
19087
  * // Schedule a transition from a trial plan to a paid plan
18963
- * const response = await client.billing.createSchedule({ customerId: "cus_123", phases: [{"startsAt":1782124314923,"plans":[{"planId":"trial_plan"}]},{"startsAt":1783333914923,"plans":[{"planId":"pro_plan"}]}] });
19088
+ * const response = await client.billing.createSchedule({ customerId: "cus_123", phases: [{"startsAt":1782402442343,"plans":[{"planId":"trial_plan"}]},{"startsAt":1783612042343,"plans":[{"planId":"pro_plan"}]}] });
18964
19089
  * ```
18965
19090
  *
18966
19091
  * @param customerId - The ID of the customer to create the schedule for.
@@ -19467,6 +19592,21 @@ declare class Features extends ClientSDK {
19467
19592
  delete(request: DeleteFeatureParams, options?: RequestOptions): Promise<DeleteFeatureResponse>;
19468
19593
  }
19469
19594
 
19595
+ declare class Keys extends ClientSDK {
19596
+ /**
19597
+ * Mints a per-customer token (a scoped `am_jwt_` credential) so a downstream / self-hosted app can call Autumn directly without your secret key. Returns a short-lived access token plus a rotating refresh token, both bound to the given customer. Authenticated with your secret key.
19598
+ */
19599
+ mint(request: MintKeyParams, options?: RequestOptions): Promise<MintKeyResponse>;
19600
+ /**
19601
+ * Exchanges a refresh token (sent as the Bearer credential) for a freshly rotated access + refresh pair. Self-service for the token holder — no secret key required. The previous refresh token is honored for one rotation as a grace window; replaying an older one revokes the customer's tokens.
19602
+ */
19603
+ refresh(request: RefreshKeyParams, options?: RequestOptions): Promise<RefreshKeyResponse>;
19604
+ /**
19605
+ * Revokes every outstanding token (access and refresh) for a customer. Authenticated with your secret key. New tokens can be issued afterwards with `keys.mint`.
19606
+ */
19607
+ revoke(request: RevokeKeyParams, options?: RequestOptions): Promise<RevokeKeyResponse>;
19608
+ }
19609
+
19470
19610
  declare class Plans extends ClientSDK {
19471
19611
  /**
19472
19612
  * Create a plan
@@ -19547,6 +19687,7 @@ declare class Plans extends ClientSDK {
19547
19687
  * @param items - Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. (optional)
19548
19688
  * @param freeTrial - Free trial configuration. Customers can try this plan before being charged. (optional)
19549
19689
  * @param config - Miscellaneous plan-level configuration flags. (optional)
19690
+ * @param metadata - Arbitrary key-value metadata defined by you for your own use (e.g. UI copy, feature highlights). Values can be any JSON-serializable value. Shared across all versions of the plan. (optional)
19550
19691
  *
19551
19692
  * @returns The created plan object.
19552
19693
  */
@@ -19635,6 +19776,7 @@ declare class Plans extends ClientSDK {
19635
19776
  * @param items - Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. (optional)
19636
19777
  * @param freeTrial - The free trial of the plan. Set to null to remove the free trial. (optional)
19637
19778
  * @param config - Miscellaneous plan-level configuration flags. (optional)
19779
+ * @param metadata - Arbitrary key-value metadata defined by you for your own use (e.g. UI copy, feature highlights). Values can be any JSON-serializable value. Shared across all versions of the plan. (optional)
19638
19780
  * @param newPlanId - The new ID to use for the plan. Can only be updated if the plan has not been used by any customers. (optional)
19639
19781
  *
19640
19782
  * @returns The updated plan object.
@@ -19722,6 +19864,8 @@ declare class Autumn extends ClientSDK {
19722
19864
  get rewards(): Rewards;
19723
19865
  private _platform?;
19724
19866
  get platform(): Platform;
19867
+ private _keys?;
19868
+ get keys(): Keys;
19725
19869
  /**
19726
19870
  * Checks whether a customer currently has enough balance to use a feature.
19727
19871
  *
@@ -19780,6 +19924,7 @@ declare class Autumn extends ClientSDK {
19780
19924
  * @param eventName - Event name to track usage for. Use instead of feature_id when multiple features should be tracked from a single event. (optional)
19781
19925
  * @param value - The amount of usage to record. Defaults to 1. Use negative values to credit balance (e.g., when removing a seat). (optional)
19782
19926
  * @param properties - Additional properties to attach to this usage event. (optional)
19927
+ * @param timestamp - Unix timestamp in milliseconds to use for the usage event. Defaults to the current time. (optional)
19783
19928
  * @param async - If true, enqueue the event for asynchronous processing and return 204 immediately. The response will not include balance information. (optional)
19784
19929
  *
19785
19930
  * @returns The usage value recorded, with either a single updated balance or a map of updated balances. If Autumn is experiencing degraded service from a downstream provider, the API may return 202 after accepting the event for replay so it can be tracked as soon as the service is restored.
@@ -19815,6 +19960,7 @@ declare class Autumn extends ClientSDK {
19815
19960
  * @param audioOutputTokens - Number of audio output tokens generated. (optional)
19816
19961
  * @param reasoningTokens - Number of reasoning tokens generated. (optional)
19817
19962
  * @param properties - Additional properties to attach to this usage event. (optional)
19963
+ * @param timestamp - Unix timestamp in milliseconds to use for the usage event. Defaults to the current time. (optional)
19818
19964
  * @param async - If true, enqueue the event for asynchronous processing and return 204 immediately. The response will not include balance information. (optional)
19819
19965
  *
19820
19966
  * @returns The dollar value recorded and the updated AI credit system balance. If Autumn is experiencing degraded service from a downstream provider, the API may return 202 after accepting the token usage event for replay so it can be tracked as soon as the service is restored.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  routeConfigs
3
- } from "./chunk-UOQDNCD2.mjs";
3
+ } from "./chunk-ZQA6B5RX.mjs";
4
4
  import {
5
5
  omitProtectedBodyFields
6
6
  } from "./chunk-GJAMWZNZ.mjs";