autumn-js 0.0.95 → 0.0.98

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 (164) hide show
  1. package/dist/compose/index.d.mts +201 -0
  2. package/dist/compose/index.d.ts +201 -0
  3. package/dist/compose/index.js +147 -0
  4. package/dist/compose/index.mjs +113 -0
  5. package/dist/libraries/backend/better-auth.d.mts +21 -20
  6. package/dist/libraries/backend/better-auth.d.ts +21 -20
  7. package/dist/libraries/backend/better-auth.js +26 -21
  8. package/dist/libraries/backend/better-auth.mjs +27 -22
  9. package/dist/libraries/backend/express.d.mts +1 -1
  10. package/dist/libraries/backend/express.d.ts +1 -1
  11. package/dist/libraries/backend/next.js +94 -94
  12. package/dist/libraries/backend/next.mjs +94 -94
  13. package/dist/libraries/backend/{referralTypes-HAk2vTns.d.ts → referralTypes-D1Q2i3mG.d.ts} +28 -27
  14. package/dist/libraries/backend/{referralTypes-Dg9pRvI7.d.mts → referralTypes-Dfg6if8j.d.mts} +28 -27
  15. package/dist/libraries/backend/utils/withAuth.d.mts +1 -1
  16. package/dist/libraries/backend/utils/withAuth.d.ts +1 -1
  17. package/dist/libraries/react/AutumnContext.d.mts +4 -4
  18. package/dist/libraries/react/AutumnContext.d.ts +4 -4
  19. package/dist/libraries/react/AutumnContext.mjs +7 -7
  20. package/dist/libraries/react/BaseAutumnProvider.d.mts +4 -4
  21. package/dist/libraries/react/BaseAutumnProvider.d.ts +4 -4
  22. package/dist/libraries/react/BaseAutumnProvider.mjs +12 -12
  23. package/dist/libraries/react/{ReactAutumnClient-k0qbHX8f.d.ts → ReactAutumnClient-ByV3ry6X.d.ts} +10 -10
  24. package/dist/libraries/react/{ReactAutumnClient-BuSRDMJN.d.mts → ReactAutumnClient-Ce34XSNp.d.mts} +10 -10
  25. package/dist/libraries/react/ReactAutumnProvider.d.mts +1 -1
  26. package/dist/libraries/react/ReactAutumnProvider.d.ts +1 -1
  27. package/dist/libraries/react/ReactAutumnProvider.mjs +13 -13
  28. package/dist/libraries/react/{chunk-27OTS3Q5.mjs → chunk-6MNYJ3YQ.mjs} +2 -2
  29. package/dist/libraries/react/{chunk-6CJ3FB74.mjs → chunk-7J5WGHDK.mjs} +2 -2
  30. package/dist/libraries/react/{chunk-DVMVIAZE.mjs → chunk-AISYLQU5.mjs} +1 -1
  31. package/dist/libraries/react/{chunk-P2O4LZFD.mjs → chunk-AL3VJLFU.mjs} +1 -1
  32. package/dist/libraries/react/{chunk-T5PIJ4HG.mjs → chunk-BJRHW2WP.mjs} +2 -2
  33. package/dist/libraries/react/{chunk-MZDRIPNS.mjs → chunk-BQUVIPG4.mjs} +2 -2
  34. package/dist/libraries/react/{chunk-5FZ7IV6P.mjs → chunk-BSF3KB4R.mjs} +46 -46
  35. package/dist/libraries/react/{chunk-CAMHARUX.mjs → chunk-FGNNWWBD.mjs} +2 -2
  36. package/dist/libraries/react/{chunk-G3FBFZLU.mjs → chunk-IJFGEGR2.mjs} +1 -1
  37. package/dist/libraries/react/{chunk-FPI3PLEL.mjs → chunk-OAPUYXBO.mjs} +6 -6
  38. package/dist/libraries/react/{chunk-CMO5LYYU.mjs → chunk-OAWFFAKA.mjs} +6 -6
  39. package/dist/libraries/react/{chunk-5G3DYUNT.mjs → chunk-RURBN53D.mjs} +1 -1
  40. package/dist/libraries/react/{chunk-LVDONEVF.mjs → chunk-SA4NOOHV.mjs} +2 -2
  41. package/dist/libraries/react/{chunk-AOJCMXVS.mjs → chunk-TKHPR5VW.mjs} +3 -3
  42. package/dist/libraries/react/{chunk-APDR7D6A.mjs → chunk-XSJQQSUT.mjs} +2 -2
  43. package/dist/libraries/react/{chunk-R4BYOLST.mjs → chunk-ZFOSCZKA.mjs} +2 -2
  44. package/dist/libraries/react/{chunk-CHXNYNH3.mjs → chunk-ZQ5HNM6O.mjs} +12 -12
  45. package/dist/libraries/react/{chunk-FEFGYFXQ.mjs → chunk-ZVQKDPUP.mjs} +3 -3
  46. package/dist/libraries/react/client/ReactAutumnClient.d.mts +4 -4
  47. package/dist/libraries/react/client/ReactAutumnClient.d.ts +4 -4
  48. package/dist/libraries/react/client/ReactAutumnClient.mjs +6 -6
  49. package/dist/libraries/react/client/clientCompMethods.d.mts +4 -4
  50. package/dist/libraries/react/client/clientCompMethods.d.ts +4 -4
  51. package/dist/libraries/react/client/clientCusMethods.d.mts +4 -4
  52. package/dist/libraries/react/client/clientCusMethods.d.ts +4 -4
  53. package/dist/libraries/react/client/clientEntityMethods.d.mts +4 -4
  54. package/dist/libraries/react/client/clientEntityMethods.d.ts +4 -4
  55. package/dist/libraries/react/client/clientGenMethods.d.mts +4 -4
  56. package/dist/libraries/react/client/clientGenMethods.d.ts +4 -4
  57. package/dist/libraries/react/client/clientProdMethods.d.mts +4 -4
  58. package/dist/libraries/react/client/clientProdMethods.d.ts +4 -4
  59. package/dist/libraries/react/client/clientReferralMethods.d.mts +4 -4
  60. package/dist/libraries/react/client/clientReferralMethods.d.ts +4 -4
  61. package/dist/libraries/react/client/types/clientGenTypes.d.mts +12 -12
  62. package/dist/libraries/react/client/types/clientGenTypes.d.ts +12 -12
  63. package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.d.mts +1 -1
  64. package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.d.ts +1 -1
  65. package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.js +55 -55
  66. package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.mjs +26 -26
  67. package/dist/libraries/react/components/attach-dialog/lib/attach-content.d.mts +1 -1
  68. package/dist/libraries/react/components/attach-dialog/lib/attach-content.d.ts +1 -1
  69. package/dist/libraries/react/components/check-dialog/check-dialog-synced.d.mts +1 -1
  70. package/dist/libraries/react/components/check-dialog/check-dialog-synced.d.ts +1 -1
  71. package/dist/libraries/react/components/check-dialog/check-dialog-synced.js +50 -50
  72. package/dist/libraries/react/components/check-dialog/check-dialog-synced.mjs +5 -5
  73. package/dist/libraries/react/components/check-dialog/lib/check-content.d.mts +1 -1
  74. package/dist/libraries/react/components/check-dialog/lib/check-content.d.ts +1 -1
  75. package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.mts +1 -1
  76. package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.ts +1 -1
  77. package/dist/libraries/react/components/pricing-table/pricing-table-synced.js +55 -55
  78. package/dist/libraries/react/components/pricing-table/pricing-table-synced.mjs +26 -26
  79. package/dist/libraries/react/components/ui/button.js +3 -3
  80. package/dist/libraries/react/components/ui/button.mjs +2 -2
  81. package/dist/libraries/react/components/ui/dialog.js +49 -49
  82. package/dist/libraries/react/components/ui/dialog.mjs +3 -3
  83. package/dist/libraries/react/components/ui/switch.js +12 -12
  84. package/dist/libraries/react/components/ui/switch.mjs +3 -3
  85. package/dist/libraries/react/{cusTypes-Vw94kPR9.d.ts → cusTypes-cFcAuKk6.d.mts} +2 -1
  86. package/dist/libraries/react/{cusTypes-Vw94kPR9.d.mts → cusTypes-cFcAuKk6.d.ts} +2 -1
  87. package/dist/libraries/react/{entTypes-B7nuhHD7.d.ts → entTypes-DPu6Efi2.d.ts} +1 -1
  88. package/dist/libraries/react/{entTypes-Ho-VocKG.d.mts → entTypes-S-Yuznzg.d.mts} +1 -1
  89. package/dist/libraries/react/hooks/handleAllowed.d.mts +2 -2
  90. package/dist/libraries/react/hooks/handleAllowed.d.ts +2 -2
  91. package/dist/libraries/react/hooks/useAutumn.d.mts +2 -2
  92. package/dist/libraries/react/hooks/useAutumn.d.ts +2 -2
  93. package/dist/libraries/react/hooks/useAutumn.mjs +10 -10
  94. package/dist/libraries/react/hooks/useAutumnBase.d.mts +4 -4
  95. package/dist/libraries/react/hooks/useAutumnBase.d.ts +4 -4
  96. package/dist/libraries/react/hooks/useAutumnBase.mjs +9 -9
  97. package/dist/libraries/react/hooks/useCustomer.d.mts +4 -4
  98. package/dist/libraries/react/hooks/useCustomer.d.ts +4 -4
  99. package/dist/libraries/react/hooks/useCustomer.mjs +11 -11
  100. package/dist/libraries/react/hooks/useCustomerBase.d.mts +4 -4
  101. package/dist/libraries/react/hooks/useCustomerBase.d.ts +4 -4
  102. package/dist/libraries/react/hooks/useCustomerBase.mjs +10 -10
  103. package/dist/libraries/react/hooks/useEntity.d.mts +3 -3
  104. package/dist/libraries/react/hooks/useEntity.d.ts +3 -3
  105. package/dist/libraries/react/hooks/useEntity.mjs +11 -11
  106. package/dist/libraries/react/hooks/useEntityBase.d.mts +4 -4
  107. package/dist/libraries/react/hooks/useEntityBase.d.ts +4 -4
  108. package/dist/libraries/react/hooks/useEntityBase.mjs +10 -10
  109. package/dist/libraries/react/hooks/usePricingTable.d.mts +1 -1
  110. package/dist/libraries/react/hooks/usePricingTable.d.ts +1 -1
  111. package/dist/libraries/react/hooks/usePricingTable.mjs +9 -9
  112. package/dist/libraries/react/hooks/usePricingTableBase.d.mts +4 -4
  113. package/dist/libraries/react/hooks/usePricingTableBase.d.ts +4 -4
  114. package/dist/libraries/react/hooks/usePricingTableBase.mjs +8 -8
  115. package/dist/libraries/react/hooks/useProductsBase.mjs +7 -7
  116. package/dist/libraries/react/index.d.mts +1 -0
  117. package/dist/libraries/react/index.d.ts +1 -0
  118. package/dist/libraries/react/index.js +55 -55
  119. package/dist/libraries/react/index.mjs +55 -55
  120. package/dist/libraries/react/{response-CQf3mDB8.d.ts → response-BDOGqtuI.d.ts} +8 -8
  121. package/dist/libraries/react/{response-CWluLfIs.d.mts → response-R1MWYZiA.d.mts} +8 -8
  122. package/dist/next/{AutumnProvider-CCYZC_bN.d.mts → AutumnProvider-Xl1mqxls.d.mts} +1 -0
  123. package/dist/next/{AutumnProvider-CCYZC_bN.d.ts → AutumnProvider-Xl1mqxls.d.ts} +1 -0
  124. package/dist/next/AutumnProvider.d.mts +1 -1
  125. package/dist/next/AutumnProvider.d.ts +1 -1
  126. package/dist/next/client/NextAutumnClient.d.mts +3 -3
  127. package/dist/next/client/NextAutumnClient.d.ts +3 -3
  128. package/dist/next/client/NextAutumnProvider.d.mts +1 -1
  129. package/dist/next/client/NextAutumnProvider.d.ts +1 -1
  130. package/dist/next/client/{clientGenTypes-CxB4go6q.d.ts → clientGenTypes-B_LCNkd5.d.ts} +1 -1
  131. package/dist/next/client/{clientGenTypes-9ngy1q97.d.mts → clientGenTypes-BwevGhcx.d.mts} +1 -1
  132. package/dist/next/client/clientUtils.d.mts +2 -2
  133. package/dist/next/client/clientUtils.d.ts +2 -2
  134. package/dist/next/client/{cusTypes-D8lhXGaX.d.mts → cusTypes-Gh2wfcmj.d.mts} +1 -0
  135. package/dist/next/client/{cusTypes-D8lhXGaX.d.ts → cusTypes-Gh2wfcmj.d.ts} +1 -0
  136. package/dist/next/client/{entTypes-Dq2mbehl.d.ts → entTypes-B_w6I3y-.d.ts} +1 -1
  137. package/dist/next/client/{entTypes-B-2_9hzP.d.mts → entTypes-C_xS1VPE.d.mts} +1 -1
  138. package/dist/next/client/hooks/useAutumn.d.mts +2 -2
  139. package/dist/next/client/hooks/useAutumn.d.ts +2 -2
  140. package/dist/next/client/hooks/useCustomer.d.mts +3 -3
  141. package/dist/next/client/hooks/useCustomer.d.ts +3 -3
  142. package/dist/next/client/hooks/useEntity.d.mts +3 -3
  143. package/dist/next/client/hooks/useEntity.d.ts +3 -3
  144. package/dist/next/client/hooks/usePricingTable.d.mts +1 -1
  145. package/dist/next/client/hooks/usePricingTable.d.ts +1 -1
  146. package/dist/next/client/types.d.mts +2 -2
  147. package/dist/next/client/types.d.ts +2 -2
  148. package/dist/next/index.d.mts +2 -2
  149. package/dist/next/index.d.ts +2 -2
  150. package/dist/next/server/auth/withNextAuth.d.mts +1 -1
  151. package/dist/next/server/auth/withNextAuth.d.ts +1 -1
  152. package/dist/next/server/componentActions.d.mts +1 -1
  153. package/dist/next/server/componentActions.d.ts +1 -1
  154. package/dist/next/server/cusActions.d.mts +21 -21
  155. package/dist/next/server/cusActions.d.ts +21 -21
  156. package/dist/next/server/{cusTypes-Cy72qmFx.d.mts → cusTypes-B8u88Vfq.d.mts} +3 -2
  157. package/dist/next/server/{cusTypes-Cy72qmFx.d.ts → cusTypes-B8u88Vfq.d.ts} +3 -2
  158. package/dist/next/server/genActions.d.mts +1 -1
  159. package/dist/next/server/genActions.d.ts +1 -1
  160. package/dist/sdk/index.d.mts +1 -0
  161. package/dist/sdk/index.d.ts +1 -0
  162. package/package.json +19 -6
  163. package/tsup.config.ts +12 -3
  164. package/dist/libraries/react/{chunk-ALFXUHDD.mjs → chunk-QRI2TNR7.mjs} +15 -15
@@ -0,0 +1,201 @@
1
+ import { z } from 'zod';
2
+
3
+ declare enum ProductItemInterval {
4
+ Minute = "minute",
5
+ Hour = "hour",
6
+ Day = "day",
7
+ Week = "week",
8
+ Month = "month",
9
+ Quarter = "quarter",
10
+ SemiAnnual = "semi_annual",
11
+ Year = "year"
12
+ }
13
+ declare enum UsageModel {
14
+ Prepaid = "prepaid",
15
+ PayPerUse = "pay_per_use"
16
+ }
17
+ declare const ProductItemSchema: z.ZodObject<{
18
+ type: z.ZodOptional<z.ZodNullable<z.ZodEnum<["feature", "priced_feature"]>>>;
19
+ feature_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
20
+ included_usage: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodLiteral<"inf">]>>>;
21
+ interval: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof ProductItemInterval>>>;
22
+ usage_model: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof UsageModel>>>;
23
+ price: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
24
+ billing_units: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
25
+ }, "strip", z.ZodTypeAny, {
26
+ type?: "feature" | "priced_feature" | null | undefined;
27
+ feature_id?: string | null | undefined;
28
+ included_usage?: number | "inf" | null | undefined;
29
+ interval?: ProductItemInterval | null | undefined;
30
+ usage_model?: UsageModel | null | undefined;
31
+ price?: number | null | undefined;
32
+ billing_units?: number | null | undefined;
33
+ }, {
34
+ type?: "feature" | "priced_feature" | null | undefined;
35
+ feature_id?: string | null | undefined;
36
+ included_usage?: number | "inf" | null | undefined;
37
+ interval?: ProductItemInterval | null | undefined;
38
+ usage_model?: UsageModel | null | undefined;
39
+ price?: number | null | undefined;
40
+ billing_units?: number | null | undefined;
41
+ }>;
42
+ declare const ProductSchema: z.ZodObject<{
43
+ id: z.ZodString;
44
+ name: z.ZodString;
45
+ is_add_on: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
46
+ is_default: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
47
+ items: z.ZodArray<z.ZodObject<{
48
+ type: z.ZodOptional<z.ZodNullable<z.ZodEnum<["feature", "priced_feature"]>>>;
49
+ feature_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
+ included_usage: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodLiteral<"inf">]>>>;
51
+ interval: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof ProductItemInterval>>>;
52
+ usage_model: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof UsageModel>>>;
53
+ price: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
54
+ billing_units: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
55
+ }, "strip", z.ZodTypeAny, {
56
+ type?: "feature" | "priced_feature" | null | undefined;
57
+ feature_id?: string | null | undefined;
58
+ included_usage?: number | "inf" | null | undefined;
59
+ interval?: ProductItemInterval | null | undefined;
60
+ usage_model?: UsageModel | null | undefined;
61
+ price?: number | null | undefined;
62
+ billing_units?: number | null | undefined;
63
+ }, {
64
+ type?: "feature" | "priced_feature" | null | undefined;
65
+ feature_id?: string | null | undefined;
66
+ included_usage?: number | "inf" | null | undefined;
67
+ interval?: ProductItemInterval | null | undefined;
68
+ usage_model?: UsageModel | null | undefined;
69
+ price?: number | null | undefined;
70
+ billing_units?: number | null | undefined;
71
+ }>, "many">;
72
+ }, "strip", z.ZodTypeAny, {
73
+ id: string;
74
+ name: string;
75
+ items: {
76
+ type?: "feature" | "priced_feature" | null | undefined;
77
+ feature_id?: string | null | undefined;
78
+ included_usage?: number | "inf" | null | undefined;
79
+ interval?: ProductItemInterval | null | undefined;
80
+ usage_model?: UsageModel | null | undefined;
81
+ price?: number | null | undefined;
82
+ billing_units?: number | null | undefined;
83
+ }[];
84
+ is_add_on?: boolean | undefined;
85
+ is_default?: boolean | undefined;
86
+ }, {
87
+ id: string;
88
+ name: string;
89
+ items: {
90
+ type?: "feature" | "priced_feature" | null | undefined;
91
+ feature_id?: string | null | undefined;
92
+ included_usage?: number | "inf" | null | undefined;
93
+ interval?: ProductItemInterval | null | undefined;
94
+ usage_model?: UsageModel | null | undefined;
95
+ price?: number | null | undefined;
96
+ billing_units?: number | null | undefined;
97
+ }[];
98
+ is_add_on?: boolean | undefined;
99
+ is_default?: boolean | undefined;
100
+ }>;
101
+ declare const FeatureSchema: z.ZodObject<{
102
+ id: z.ZodString;
103
+ name: z.ZodString;
104
+ type: z.ZodEnum<["boolean", "continuous_use", "credit_system", "metered"]>;
105
+ display: z.ZodObject<{
106
+ singular: z.ZodString;
107
+ plural: z.ZodString;
108
+ }, "strip", z.ZodTypeAny, {
109
+ singular: string;
110
+ plural: string;
111
+ }, {
112
+ singular: string;
113
+ plural: string;
114
+ }>;
115
+ credit_schema: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
116
+ metered_feature_id: z.ZodString;
117
+ credit_cost: z.ZodNumber;
118
+ }, "strip", z.ZodTypeAny, {
119
+ metered_feature_id: string;
120
+ credit_cost: number;
121
+ }, {
122
+ metered_feature_id: string;
123
+ credit_cost: number;
124
+ }>, "many">>>;
125
+ }, "strip", z.ZodTypeAny, {
126
+ type: "boolean" | "continuous_use" | "credit_system" | "metered";
127
+ id: string;
128
+ name: string;
129
+ display: {
130
+ singular: string;
131
+ plural: string;
132
+ };
133
+ credit_schema?: {
134
+ metered_feature_id: string;
135
+ credit_cost: number;
136
+ }[] | null | undefined;
137
+ }, {
138
+ type: "boolean" | "continuous_use" | "credit_system" | "metered";
139
+ id: string;
140
+ name: string;
141
+ display: {
142
+ singular: string;
143
+ plural: string;
144
+ };
145
+ credit_schema?: {
146
+ metered_feature_id: string;
147
+ credit_cost: number;
148
+ }[] | null | undefined;
149
+ }>;
150
+ type ProductItem = z.infer<typeof ProductItemSchema>;
151
+ type Feature = z.infer<typeof FeatureSchema>;
152
+ type Product = z.infer<typeof ProductSchema>;
153
+
154
+ interface AutumnKeys {
155
+ prodKey: string;
156
+ sandboxKey: string;
157
+ }
158
+ interface AuthInfo {
159
+ keys: AutumnKeys;
160
+ }
161
+
162
+ declare const product: (p: Product) => {
163
+ id: string;
164
+ name: string;
165
+ items: {
166
+ type?: "feature" | "priced_feature" | null | undefined;
167
+ feature_id?: string | null | undefined;
168
+ included_usage?: number | "inf" | null | undefined;
169
+ interval?: ProductItemInterval | null | undefined;
170
+ usage_model?: UsageModel | null | undefined;
171
+ price?: number | null | undefined;
172
+ billing_units?: number | null | undefined;
173
+ }[];
174
+ is_add_on?: boolean | undefined;
175
+ is_default?: boolean | undefined;
176
+ };
177
+ declare const auth: (info: AuthInfo) => AuthInfo;
178
+ declare function feature(f: Omit<Feature, "display"> & {
179
+ display?: Feature["display"];
180
+ }): Feature;
181
+ declare const priceItem: ({ price, interval, }: {
182
+ price: number;
183
+ interval: ProductItemInterval;
184
+ }) => ProductItem;
185
+ declare const pricedFeatureItem: ({ feature_id, price, interval, included_usage, billing_units, usage_model, }: {
186
+ feature_id: string;
187
+ price: number;
188
+ interval: ProductItemInterval;
189
+ billing_units?: number;
190
+ usage_model?: UsageModel;
191
+ included_usage?: number;
192
+ }) => ProductItem;
193
+ declare const featureItem: ({ feature_id, included_usage, interval, }: {
194
+ feature_id: string;
195
+ included_usage: number;
196
+ interval?: ProductItemInterval;
197
+ }) => ProductItem;
198
+
199
+ type Infinity = "infinity";
200
+
201
+ export { type Feature, type Infinity, type Product, type ProductItem, ProductItemInterval, UsageModel, auth, feature, featureItem, priceItem, pricedFeatureItem, product };
@@ -0,0 +1,201 @@
1
+ import { z } from 'zod';
2
+
3
+ declare enum ProductItemInterval {
4
+ Minute = "minute",
5
+ Hour = "hour",
6
+ Day = "day",
7
+ Week = "week",
8
+ Month = "month",
9
+ Quarter = "quarter",
10
+ SemiAnnual = "semi_annual",
11
+ Year = "year"
12
+ }
13
+ declare enum UsageModel {
14
+ Prepaid = "prepaid",
15
+ PayPerUse = "pay_per_use"
16
+ }
17
+ declare const ProductItemSchema: z.ZodObject<{
18
+ type: z.ZodOptional<z.ZodNullable<z.ZodEnum<["feature", "priced_feature"]>>>;
19
+ feature_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
20
+ included_usage: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodLiteral<"inf">]>>>;
21
+ interval: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof ProductItemInterval>>>;
22
+ usage_model: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof UsageModel>>>;
23
+ price: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
24
+ billing_units: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
25
+ }, "strip", z.ZodTypeAny, {
26
+ type?: "feature" | "priced_feature" | null | undefined;
27
+ feature_id?: string | null | undefined;
28
+ included_usage?: number | "inf" | null | undefined;
29
+ interval?: ProductItemInterval | null | undefined;
30
+ usage_model?: UsageModel | null | undefined;
31
+ price?: number | null | undefined;
32
+ billing_units?: number | null | undefined;
33
+ }, {
34
+ type?: "feature" | "priced_feature" | null | undefined;
35
+ feature_id?: string | null | undefined;
36
+ included_usage?: number | "inf" | null | undefined;
37
+ interval?: ProductItemInterval | null | undefined;
38
+ usage_model?: UsageModel | null | undefined;
39
+ price?: number | null | undefined;
40
+ billing_units?: number | null | undefined;
41
+ }>;
42
+ declare const ProductSchema: z.ZodObject<{
43
+ id: z.ZodString;
44
+ name: z.ZodString;
45
+ is_add_on: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
46
+ is_default: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
47
+ items: z.ZodArray<z.ZodObject<{
48
+ type: z.ZodOptional<z.ZodNullable<z.ZodEnum<["feature", "priced_feature"]>>>;
49
+ feature_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
+ included_usage: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodLiteral<"inf">]>>>;
51
+ interval: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof ProductItemInterval>>>;
52
+ usage_model: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof UsageModel>>>;
53
+ price: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
54
+ billing_units: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
55
+ }, "strip", z.ZodTypeAny, {
56
+ type?: "feature" | "priced_feature" | null | undefined;
57
+ feature_id?: string | null | undefined;
58
+ included_usage?: number | "inf" | null | undefined;
59
+ interval?: ProductItemInterval | null | undefined;
60
+ usage_model?: UsageModel | null | undefined;
61
+ price?: number | null | undefined;
62
+ billing_units?: number | null | undefined;
63
+ }, {
64
+ type?: "feature" | "priced_feature" | null | undefined;
65
+ feature_id?: string | null | undefined;
66
+ included_usage?: number | "inf" | null | undefined;
67
+ interval?: ProductItemInterval | null | undefined;
68
+ usage_model?: UsageModel | null | undefined;
69
+ price?: number | null | undefined;
70
+ billing_units?: number | null | undefined;
71
+ }>, "many">;
72
+ }, "strip", z.ZodTypeAny, {
73
+ id: string;
74
+ name: string;
75
+ items: {
76
+ type?: "feature" | "priced_feature" | null | undefined;
77
+ feature_id?: string | null | undefined;
78
+ included_usage?: number | "inf" | null | undefined;
79
+ interval?: ProductItemInterval | null | undefined;
80
+ usage_model?: UsageModel | null | undefined;
81
+ price?: number | null | undefined;
82
+ billing_units?: number | null | undefined;
83
+ }[];
84
+ is_add_on?: boolean | undefined;
85
+ is_default?: boolean | undefined;
86
+ }, {
87
+ id: string;
88
+ name: string;
89
+ items: {
90
+ type?: "feature" | "priced_feature" | null | undefined;
91
+ feature_id?: string | null | undefined;
92
+ included_usage?: number | "inf" | null | undefined;
93
+ interval?: ProductItemInterval | null | undefined;
94
+ usage_model?: UsageModel | null | undefined;
95
+ price?: number | null | undefined;
96
+ billing_units?: number | null | undefined;
97
+ }[];
98
+ is_add_on?: boolean | undefined;
99
+ is_default?: boolean | undefined;
100
+ }>;
101
+ declare const FeatureSchema: z.ZodObject<{
102
+ id: z.ZodString;
103
+ name: z.ZodString;
104
+ type: z.ZodEnum<["boolean", "continuous_use", "credit_system", "metered"]>;
105
+ display: z.ZodObject<{
106
+ singular: z.ZodString;
107
+ plural: z.ZodString;
108
+ }, "strip", z.ZodTypeAny, {
109
+ singular: string;
110
+ plural: string;
111
+ }, {
112
+ singular: string;
113
+ plural: string;
114
+ }>;
115
+ credit_schema: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
116
+ metered_feature_id: z.ZodString;
117
+ credit_cost: z.ZodNumber;
118
+ }, "strip", z.ZodTypeAny, {
119
+ metered_feature_id: string;
120
+ credit_cost: number;
121
+ }, {
122
+ metered_feature_id: string;
123
+ credit_cost: number;
124
+ }>, "many">>>;
125
+ }, "strip", z.ZodTypeAny, {
126
+ type: "boolean" | "continuous_use" | "credit_system" | "metered";
127
+ id: string;
128
+ name: string;
129
+ display: {
130
+ singular: string;
131
+ plural: string;
132
+ };
133
+ credit_schema?: {
134
+ metered_feature_id: string;
135
+ credit_cost: number;
136
+ }[] | null | undefined;
137
+ }, {
138
+ type: "boolean" | "continuous_use" | "credit_system" | "metered";
139
+ id: string;
140
+ name: string;
141
+ display: {
142
+ singular: string;
143
+ plural: string;
144
+ };
145
+ credit_schema?: {
146
+ metered_feature_id: string;
147
+ credit_cost: number;
148
+ }[] | null | undefined;
149
+ }>;
150
+ type ProductItem = z.infer<typeof ProductItemSchema>;
151
+ type Feature = z.infer<typeof FeatureSchema>;
152
+ type Product = z.infer<typeof ProductSchema>;
153
+
154
+ interface AutumnKeys {
155
+ prodKey: string;
156
+ sandboxKey: string;
157
+ }
158
+ interface AuthInfo {
159
+ keys: AutumnKeys;
160
+ }
161
+
162
+ declare const product: (p: Product) => {
163
+ id: string;
164
+ name: string;
165
+ items: {
166
+ type?: "feature" | "priced_feature" | null | undefined;
167
+ feature_id?: string | null | undefined;
168
+ included_usage?: number | "inf" | null | undefined;
169
+ interval?: ProductItemInterval | null | undefined;
170
+ usage_model?: UsageModel | null | undefined;
171
+ price?: number | null | undefined;
172
+ billing_units?: number | null | undefined;
173
+ }[];
174
+ is_add_on?: boolean | undefined;
175
+ is_default?: boolean | undefined;
176
+ };
177
+ declare const auth: (info: AuthInfo) => AuthInfo;
178
+ declare function feature(f: Omit<Feature, "display"> & {
179
+ display?: Feature["display"];
180
+ }): Feature;
181
+ declare const priceItem: ({ price, interval, }: {
182
+ price: number;
183
+ interval: ProductItemInterval;
184
+ }) => ProductItem;
185
+ declare const pricedFeatureItem: ({ feature_id, price, interval, included_usage, billing_units, usage_model, }: {
186
+ feature_id: string;
187
+ price: number;
188
+ interval: ProductItemInterval;
189
+ billing_units?: number;
190
+ usage_model?: UsageModel;
191
+ included_usage?: number;
192
+ }) => ProductItem;
193
+ declare const featureItem: ({ feature_id, included_usage, interval, }: {
194
+ feature_id: string;
195
+ included_usage: number;
196
+ interval?: ProductItemInterval;
197
+ }) => ProductItem;
198
+
199
+ type Infinity = "infinity";
200
+
201
+ export { type Feature, type Infinity, type Product, type ProductItem, ProductItemInterval, UsageModel, auth, feature, featureItem, priceItem, pricedFeatureItem, product };
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/compose/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ ProductItemInterval: () => ProductItemInterval,
24
+ UsageModel: () => UsageModel,
25
+ auth: () => auth,
26
+ feature: () => feature,
27
+ featureItem: () => featureItem,
28
+ priceItem: () => priceItem,
29
+ pricedFeatureItem: () => pricedFeatureItem,
30
+ product: () => product
31
+ });
32
+ module.exports = __toCommonJS(index_exports);
33
+
34
+ // src/compose/models/core.ts
35
+ var import_zod = require("zod");
36
+ var ProductItemInterval = /* @__PURE__ */ ((ProductItemInterval3) => {
37
+ ProductItemInterval3["Minute"] = "minute";
38
+ ProductItemInterval3["Hour"] = "hour";
39
+ ProductItemInterval3["Day"] = "day";
40
+ ProductItemInterval3["Week"] = "week";
41
+ ProductItemInterval3["Month"] = "month";
42
+ ProductItemInterval3["Quarter"] = "quarter";
43
+ ProductItemInterval3["SemiAnnual"] = "semi_annual";
44
+ ProductItemInterval3["Year"] = "year";
45
+ return ProductItemInterval3;
46
+ })(ProductItemInterval || {});
47
+ var UsageModel = /* @__PURE__ */ ((UsageModel2) => {
48
+ UsageModel2["Prepaid"] = "prepaid";
49
+ UsageModel2["PayPerUse"] = "pay_per_use";
50
+ return UsageModel2;
51
+ })(UsageModel || {});
52
+ var ProductItemSchema = import_zod.z.object({
53
+ // Feature stuff
54
+ type: import_zod.z.enum(["feature", "priced_feature"]).nullish(),
55
+ feature_id: import_zod.z.string().nullish(),
56
+ included_usage: import_zod.z.union([import_zod.z.number(), import_zod.z.literal("inf")]).nullish(),
57
+ interval: import_zod.z.nativeEnum(ProductItemInterval).nullish(),
58
+ // Price config
59
+ usage_model: import_zod.z.nativeEnum(UsageModel).nullish(),
60
+ price: import_zod.z.number().nullish(),
61
+ billing_units: import_zod.z.number().nullish()
62
+ // amount per billing unit (eg. $9 / 250 units)
63
+ });
64
+ var ProductSchema = import_zod.z.object({
65
+ id: import_zod.z.string().nonempty(),
66
+ name: import_zod.z.string().nonempty(),
67
+ is_add_on: import_zod.z.boolean().default(false).optional(),
68
+ is_default: import_zod.z.boolean().default(false).optional(),
69
+ items: import_zod.z.array(ProductItemSchema)
70
+ });
71
+ var FeatureSchema = import_zod.z.object({
72
+ id: import_zod.z.string().nonempty(),
73
+ name: import_zod.z.string().nonempty(),
74
+ type: import_zod.z.enum(["boolean", "continuous_use", "credit_system", "metered"]),
75
+ display: import_zod.z.object({
76
+ singular: import_zod.z.string(),
77
+ plural: import_zod.z.string()
78
+ }),
79
+ credit_schema: import_zod.z.array(
80
+ import_zod.z.object({
81
+ metered_feature_id: import_zod.z.string(),
82
+ credit_cost: import_zod.z.number()
83
+ })
84
+ ).nullish()
85
+ });
86
+
87
+ // src/compose/builders/core.ts
88
+ var product = (p) => p;
89
+ var auth = (info) => info;
90
+ function feature(f) {
91
+ let f_ = f;
92
+ if (!f_.display) {
93
+ f_.display = {
94
+ singular: f_.name,
95
+ plural: f_.name
96
+ };
97
+ }
98
+ return f_;
99
+ }
100
+ var priceItem = ({
101
+ price,
102
+ interval
103
+ }) => {
104
+ return {
105
+ price,
106
+ interval
107
+ };
108
+ };
109
+ var pricedFeatureItem = ({
110
+ feature_id,
111
+ price,
112
+ interval,
113
+ included_usage = void 0,
114
+ billing_units = 1,
115
+ usage_model = "prepaid" /* Prepaid */
116
+ }) => {
117
+ return {
118
+ price,
119
+ interval,
120
+ billing_units,
121
+ feature_id,
122
+ usage_model,
123
+ included_usage
124
+ };
125
+ };
126
+ var featureItem = ({
127
+ feature_id,
128
+ included_usage,
129
+ interval
130
+ }) => {
131
+ return {
132
+ included_usage,
133
+ interval,
134
+ feature_id
135
+ };
136
+ };
137
+ // Annotate the CommonJS export names for ESM import in node:
138
+ 0 && (module.exports = {
139
+ ProductItemInterval,
140
+ UsageModel,
141
+ auth,
142
+ feature,
143
+ featureItem,
144
+ priceItem,
145
+ pricedFeatureItem,
146
+ product
147
+ });
@@ -0,0 +1,113 @@
1
+ // src/compose/models/core.ts
2
+ import { z } from "zod";
3
+ var ProductItemInterval = /* @__PURE__ */ ((ProductItemInterval3) => {
4
+ ProductItemInterval3["Minute"] = "minute";
5
+ ProductItemInterval3["Hour"] = "hour";
6
+ ProductItemInterval3["Day"] = "day";
7
+ ProductItemInterval3["Week"] = "week";
8
+ ProductItemInterval3["Month"] = "month";
9
+ ProductItemInterval3["Quarter"] = "quarter";
10
+ ProductItemInterval3["SemiAnnual"] = "semi_annual";
11
+ ProductItemInterval3["Year"] = "year";
12
+ return ProductItemInterval3;
13
+ })(ProductItemInterval || {});
14
+ var UsageModel = /* @__PURE__ */ ((UsageModel2) => {
15
+ UsageModel2["Prepaid"] = "prepaid";
16
+ UsageModel2["PayPerUse"] = "pay_per_use";
17
+ return UsageModel2;
18
+ })(UsageModel || {});
19
+ var ProductItemSchema = z.object({
20
+ // Feature stuff
21
+ type: z.enum(["feature", "priced_feature"]).nullish(),
22
+ feature_id: z.string().nullish(),
23
+ included_usage: z.union([z.number(), z.literal("inf")]).nullish(),
24
+ interval: z.nativeEnum(ProductItemInterval).nullish(),
25
+ // Price config
26
+ usage_model: z.nativeEnum(UsageModel).nullish(),
27
+ price: z.number().nullish(),
28
+ billing_units: z.number().nullish()
29
+ // amount per billing unit (eg. $9 / 250 units)
30
+ });
31
+ var ProductSchema = z.object({
32
+ id: z.string().nonempty(),
33
+ name: z.string().nonempty(),
34
+ is_add_on: z.boolean().default(false).optional(),
35
+ is_default: z.boolean().default(false).optional(),
36
+ items: z.array(ProductItemSchema)
37
+ });
38
+ var FeatureSchema = z.object({
39
+ id: z.string().nonempty(),
40
+ name: z.string().nonempty(),
41
+ type: z.enum(["boolean", "continuous_use", "credit_system", "metered"]),
42
+ display: z.object({
43
+ singular: z.string(),
44
+ plural: z.string()
45
+ }),
46
+ credit_schema: z.array(
47
+ z.object({
48
+ metered_feature_id: z.string(),
49
+ credit_cost: z.number()
50
+ })
51
+ ).nullish()
52
+ });
53
+
54
+ // src/compose/builders/core.ts
55
+ var product = (p) => p;
56
+ var auth = (info) => info;
57
+ function feature(f) {
58
+ let f_ = f;
59
+ if (!f_.display) {
60
+ f_.display = {
61
+ singular: f_.name,
62
+ plural: f_.name
63
+ };
64
+ }
65
+ return f_;
66
+ }
67
+ var priceItem = ({
68
+ price,
69
+ interval
70
+ }) => {
71
+ return {
72
+ price,
73
+ interval
74
+ };
75
+ };
76
+ var pricedFeatureItem = ({
77
+ feature_id,
78
+ price,
79
+ interval,
80
+ included_usage = void 0,
81
+ billing_units = 1,
82
+ usage_model = "prepaid" /* Prepaid */
83
+ }) => {
84
+ return {
85
+ price,
86
+ interval,
87
+ billing_units,
88
+ feature_id,
89
+ usage_model,
90
+ included_usage
91
+ };
92
+ };
93
+ var featureItem = ({
94
+ feature_id,
95
+ included_usage,
96
+ interval
97
+ }) => {
98
+ return {
99
+ included_usage,
100
+ interval,
101
+ feature_id
102
+ };
103
+ };
104
+ export {
105
+ ProductItemInterval,
106
+ UsageModel,
107
+ auth,
108
+ feature,
109
+ featureItem,
110
+ priceItem,
111
+ pricedFeatureItem,
112
+ product
113
+ };