better-auth 1.2.5-beta.4 → 1.2.5-beta.6

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 (235) hide show
  1. package/dist/adapters/drizzle-adapter/index.cjs +1 -1
  2. package/dist/adapters/drizzle-adapter/index.d.cts +2 -2
  3. package/dist/adapters/drizzle-adapter/index.d.mts +2 -2
  4. package/dist/adapters/drizzle-adapter/index.d.ts +2 -2
  5. package/dist/adapters/drizzle-adapter/index.mjs +1 -1
  6. package/dist/adapters/kysely-adapter/index.cjs +2 -2
  7. package/dist/adapters/kysely-adapter/index.d.cts +2 -2
  8. package/dist/adapters/kysely-adapter/index.d.mts +2 -2
  9. package/dist/adapters/kysely-adapter/index.d.ts +2 -2
  10. package/dist/adapters/kysely-adapter/index.mjs +2 -2
  11. package/dist/adapters/memory-adapter/index.cjs +2 -2
  12. package/dist/adapters/memory-adapter/index.d.cts +2 -2
  13. package/dist/adapters/memory-adapter/index.d.mts +2 -2
  14. package/dist/adapters/memory-adapter/index.d.ts +2 -2
  15. package/dist/adapters/memory-adapter/index.mjs +2 -2
  16. package/dist/adapters/mongodb-adapter/index.cjs +1 -1
  17. package/dist/adapters/mongodb-adapter/index.d.cts +2 -2
  18. package/dist/adapters/mongodb-adapter/index.d.mts +2 -2
  19. package/dist/adapters/mongodb-adapter/index.d.ts +2 -2
  20. package/dist/adapters/mongodb-adapter/index.mjs +1 -1
  21. package/dist/adapters/prisma-adapter/index.cjs +1 -1
  22. package/dist/adapters/prisma-adapter/index.d.cts +2 -2
  23. package/dist/adapters/prisma-adapter/index.d.mts +2 -2
  24. package/dist/adapters/prisma-adapter/index.d.ts +2 -2
  25. package/dist/adapters/prisma-adapter/index.mjs +1 -1
  26. package/dist/adapters/test.d.cts +2 -2
  27. package/dist/adapters/test.d.mts +2 -2
  28. package/dist/adapters/test.d.ts +2 -2
  29. package/dist/api/index.cjs +10 -5
  30. package/dist/api/index.d.cts +2 -2
  31. package/dist/api/index.d.mts +2 -2
  32. package/dist/api/index.d.ts +2 -2
  33. package/dist/api/index.mjs +11 -6
  34. package/dist/client/index.cjs +1 -1
  35. package/dist/client/index.d.cts +2 -2
  36. package/dist/client/index.d.mts +2 -2
  37. package/dist/client/index.d.ts +2 -2
  38. package/dist/client/index.mjs +1 -1
  39. package/dist/client/plugins/index.cjs +3 -1
  40. package/dist/client/plugins/index.d.cts +6 -4
  41. package/dist/client/plugins/index.d.mts +6 -4
  42. package/dist/client/plugins/index.d.ts +6 -4
  43. package/dist/client/plugins/index.mjs +3 -1
  44. package/dist/client/react/index.cjs +1 -1
  45. package/dist/client/react/index.d.cts +2 -2
  46. package/dist/client/react/index.d.mts +2 -2
  47. package/dist/client/react/index.d.ts +2 -2
  48. package/dist/client/react/index.mjs +1 -1
  49. package/dist/client/solid/index.cjs +1 -1
  50. package/dist/client/solid/index.d.cts +2 -2
  51. package/dist/client/solid/index.d.mts +2 -2
  52. package/dist/client/solid/index.d.ts +2 -2
  53. package/dist/client/solid/index.mjs +1 -1
  54. package/dist/client/svelte/index.cjs +1 -1
  55. package/dist/client/svelte/index.d.cts +2 -2
  56. package/dist/client/svelte/index.d.mts +2 -2
  57. package/dist/client/svelte/index.d.ts +2 -2
  58. package/dist/client/svelte/index.mjs +1 -1
  59. package/dist/client/vue/index.cjs +1 -1
  60. package/dist/client/vue/index.d.cts +2 -2
  61. package/dist/client/vue/index.d.mts +2 -2
  62. package/dist/client/vue/index.d.ts +2 -2
  63. package/dist/client/vue/index.mjs +1 -1
  64. package/dist/cookies/index.d.cts +2 -2
  65. package/dist/cookies/index.d.mts +2 -2
  66. package/dist/cookies/index.d.ts +2 -2
  67. package/dist/db/index.cjs +4 -4
  68. package/dist/db/index.d.cts +3 -3
  69. package/dist/db/index.d.mts +3 -3
  70. package/dist/db/index.d.ts +3 -3
  71. package/dist/db/index.mjs +4 -4
  72. package/dist/index.cjs +7 -7
  73. package/dist/index.d.cts +3 -3
  74. package/dist/index.d.mts +3 -3
  75. package/dist/index.d.ts +3 -3
  76. package/dist/index.mjs +8 -8
  77. package/dist/integrations/next-js.cjs +6 -6
  78. package/dist/integrations/next-js.d.cts +3 -11
  79. package/dist/integrations/next-js.d.mts +3 -11
  80. package/dist/integrations/next-js.d.ts +3 -11
  81. package/dist/integrations/next-js.mjs +6 -6
  82. package/dist/integrations/node.d.cts +2 -2
  83. package/dist/integrations/node.d.mts +2 -2
  84. package/dist/integrations/node.d.ts +2 -2
  85. package/dist/integrations/svelte-kit.d.cts +2 -2
  86. package/dist/integrations/svelte-kit.d.mts +2 -2
  87. package/dist/integrations/svelte-kit.d.ts +2 -2
  88. package/dist/oauth2/index.cjs +2 -2
  89. package/dist/oauth2/index.d.cts +14 -6
  90. package/dist/oauth2/index.d.mts +14 -6
  91. package/dist/oauth2/index.d.ts +14 -6
  92. package/dist/oauth2/index.mjs +2 -2
  93. package/dist/plugins/admin/index.cjs +5 -5
  94. package/dist/plugins/admin/index.d.cts +615 -295
  95. package/dist/plugins/admin/index.d.mts +615 -295
  96. package/dist/plugins/admin/index.d.ts +615 -295
  97. package/dist/plugins/admin/index.mjs +5 -5
  98. package/dist/plugins/anonymous/index.cjs +5 -5
  99. package/dist/plugins/anonymous/index.d.cts +33 -23
  100. package/dist/plugins/anonymous/index.d.mts +33 -23
  101. package/dist/plugins/anonymous/index.d.ts +33 -23
  102. package/dist/plugins/anonymous/index.mjs +5 -5
  103. package/dist/plugins/bearer/index.cjs +4 -4
  104. package/dist/plugins/bearer/index.d.cts +4 -20
  105. package/dist/plugins/bearer/index.d.mts +4 -20
  106. package/dist/plugins/bearer/index.d.ts +4 -20
  107. package/dist/plugins/bearer/index.mjs +4 -4
  108. package/dist/plugins/custom-session/index.cjs +4 -4
  109. package/dist/plugins/custom-session/index.d.cts +22 -15
  110. package/dist/plugins/custom-session/index.d.mts +22 -15
  111. package/dist/plugins/custom-session/index.d.ts +22 -15
  112. package/dist/plugins/custom-session/index.mjs +4 -4
  113. package/dist/plugins/email-otp/index.cjs +4 -4
  114. package/dist/plugins/email-otp/index.d.cts +241 -95
  115. package/dist/plugins/email-otp/index.d.mts +241 -95
  116. package/dist/plugins/email-otp/index.d.ts +241 -95
  117. package/dist/plugins/email-otp/index.mjs +4 -4
  118. package/dist/plugins/generic-oauth/index.cjs +20 -17
  119. package/dist/plugins/generic-oauth/index.d.cts +129 -50
  120. package/dist/plugins/generic-oauth/index.d.mts +129 -50
  121. package/dist/plugins/generic-oauth/index.d.ts +129 -50
  122. package/dist/plugins/generic-oauth/index.mjs +20 -17
  123. package/dist/plugins/index.cjs +11 -11
  124. package/dist/plugins/index.d.cts +3 -3
  125. package/dist/plugins/index.d.mts +3 -3
  126. package/dist/plugins/index.d.ts +3 -3
  127. package/dist/plugins/index.mjs +12 -12
  128. package/dist/plugins/jwt/index.cjs +4 -4
  129. package/dist/plugins/jwt/index.d.cts +105 -44
  130. package/dist/plugins/jwt/index.d.mts +105 -44
  131. package/dist/plugins/jwt/index.d.ts +105 -44
  132. package/dist/plugins/jwt/index.mjs +4 -4
  133. package/dist/plugins/magic-link/index.cjs +4 -4
  134. package/dist/plugins/magic-link/index.d.cts +77 -33
  135. package/dist/plugins/magic-link/index.d.mts +77 -33
  136. package/dist/plugins/magic-link/index.d.ts +77 -33
  137. package/dist/plugins/magic-link/index.mjs +4 -4
  138. package/dist/plugins/multi-session/index.cjs +5 -5
  139. package/dist/plugins/multi-session/index.d.cts +123 -65
  140. package/dist/plugins/multi-session/index.d.mts +123 -65
  141. package/dist/plugins/multi-session/index.d.ts +123 -65
  142. package/dist/plugins/multi-session/index.mjs +5 -5
  143. package/dist/plugins/oauth-proxy/index.cjs +4 -4
  144. package/dist/plugins/oauth-proxy/index.d.cts +42 -41
  145. package/dist/plugins/oauth-proxy/index.d.mts +42 -41
  146. package/dist/plugins/oauth-proxy/index.d.ts +42 -41
  147. package/dist/plugins/oauth-proxy/index.mjs +4 -4
  148. package/dist/plugins/oidc-provider/index.cjs +17 -11
  149. package/dist/plugins/oidc-provider/index.d.cts +173 -117
  150. package/dist/plugins/oidc-provider/index.d.mts +173 -117
  151. package/dist/plugins/oidc-provider/index.d.ts +173 -117
  152. package/dist/plugins/oidc-provider/index.mjs +17 -11
  153. package/dist/plugins/one-tap/index.cjs +5 -5
  154. package/dist/plugins/one-tap/index.d.cts +39 -12
  155. package/dist/plugins/one-tap/index.d.mts +39 -12
  156. package/dist/plugins/one-tap/index.d.ts +39 -12
  157. package/dist/plugins/one-tap/index.mjs +5 -5
  158. package/dist/plugins/open-api/index.cjs +4 -4
  159. package/dist/plugins/open-api/index.d.cts +15 -26
  160. package/dist/plugins/open-api/index.d.mts +15 -26
  161. package/dist/plugins/open-api/index.d.ts +15 -26
  162. package/dist/plugins/open-api/index.mjs +4 -4
  163. package/dist/plugins/organization/index.cjs +5 -5
  164. package/dist/plugins/organization/index.d.cts +4277 -4932
  165. package/dist/plugins/organization/index.d.mts +4277 -4932
  166. package/dist/plugins/organization/index.d.ts +4277 -4932
  167. package/dist/plugins/organization/index.mjs +5 -5
  168. package/dist/plugins/passkey/index.cjs +4 -4
  169. package/dist/plugins/passkey/index.d.cts +449 -136
  170. package/dist/plugins/passkey/index.d.mts +449 -136
  171. package/dist/plugins/passkey/index.d.ts +449 -136
  172. package/dist/plugins/passkey/index.mjs +4 -4
  173. package/dist/plugins/phone-number/index.cjs +4 -4
  174. package/dist/plugins/phone-number/index.d.cts +164 -64
  175. package/dist/plugins/phone-number/index.d.mts +164 -64
  176. package/dist/plugins/phone-number/index.d.ts +164 -64
  177. package/dist/plugins/phone-number/index.mjs +4 -4
  178. package/dist/plugins/sso/index.cjs +4 -4
  179. package/dist/plugins/sso/index.d.cts +199 -49
  180. package/dist/plugins/sso/index.d.mts +199 -49
  181. package/dist/plugins/sso/index.d.ts +199 -49
  182. package/dist/plugins/sso/index.mjs +4 -4
  183. package/dist/plugins/two-factor/index.cjs +6 -6
  184. package/dist/plugins/two-factor/index.d.cts +731 -233
  185. package/dist/plugins/two-factor/index.d.mts +731 -233
  186. package/dist/plugins/two-factor/index.d.ts +731 -233
  187. package/dist/plugins/two-factor/index.mjs +6 -6
  188. package/dist/plugins/username/index.cjs +5 -5
  189. package/dist/plugins/username/index.d.cts +43 -23
  190. package/dist/plugins/username/index.d.mts +43 -23
  191. package/dist/plugins/username/index.d.ts +43 -23
  192. package/dist/plugins/username/index.mjs +5 -5
  193. package/dist/shared/{better-auth.DpK5DyQT.cjs → better-auth.1GtLBK1J.cjs} +5 -5
  194. package/dist/shared/{better-auth.Dz0hfDVL.d.cts → better-auth.2fbYHU01.d.mts} +186 -115
  195. package/dist/shared/{better-auth.xcEiilVu.d.ts → better-auth.Al7ra9Pe.d.cts} +186 -115
  196. package/dist/shared/{better-auth.BiRM8Fdy.cjs → better-auth.B3unKFue.cjs} +2 -2
  197. package/dist/shared/{better-auth.kkBzxQJx.d.ts → better-auth.BODzPfJo.d.ts} +10299 -11599
  198. package/dist/shared/{better-auth.CbXAPXob.mjs → better-auth.BdyOG_p4.mjs} +1 -1
  199. package/dist/shared/{better-auth.DWb95UJA.d.ts → better-auth.BjXInNL7.d.ts} +1 -1
  200. package/dist/shared/{better-auth.D26n-znb.d.cts → better-auth.BkL9ntGY.d.cts} +10299 -11599
  201. package/dist/shared/{better-auth.B36e4YUo.d.cts → better-auth.BkREA_U6.d.cts} +99 -18
  202. package/dist/shared/{better-auth.HHZU10im.mjs → better-auth.BnRFp-t0.mjs} +1 -1
  203. package/dist/shared/{better-auth.CHyZMcYK.cjs → better-auth.C5H9XEzZ.cjs} +2 -2
  204. package/dist/shared/{better-auth.C678re3w.d.mts → better-auth.C7O0617V.d.mts} +1 -1
  205. package/dist/shared/{better-auth.BJVJYVcJ.mjs → better-auth.CKCPM9Oy.mjs} +2 -2
  206. package/dist/shared/{better-auth.BgAsaHGJ.d.mts → better-auth.CV08HOs_.d.ts} +186 -115
  207. package/dist/shared/{better-auth.2gyOPXIw.d.ts → better-auth.CVEUIYlu.d.ts} +99 -18
  208. package/dist/shared/{better-auth.CUEbBDI6.mjs → better-auth.CbBX7Xla.mjs} +3 -3
  209. package/dist/shared/{better-auth.C24Bzw4w.mjs → better-auth.CepcSj5H.mjs} +2 -2
  210. package/dist/shared/{better-auth.C00ERbVB.cjs → better-auth.ChassmKE.cjs} +11 -4
  211. package/dist/shared/{better-auth.C7bUpbPE.d.mts → better-auth.CmWesETc.d.mts} +99 -18
  212. package/dist/shared/{better-auth.D8LeJoj0.mjs → better-auth.DC8JQbiE.mjs} +1 -1
  213. package/dist/shared/{better-auth.DZnoWLte.cjs → better-auth.DWHWPllD.cjs} +1 -1
  214. package/dist/shared/{better-auth.CSVqSIae.mjs → better-auth.DYm-YVE1.mjs} +1 -1
  215. package/dist/shared/{better-auth.BgoXd7dr.d.mts → better-auth.D_6ikAPh.d.mts} +10299 -11599
  216. package/dist/shared/{better-auth.DdjqxOIu.cjs → better-auth.DgXCgiHI.cjs} +22 -8
  217. package/dist/shared/{better-auth.D7syfoJW.mjs → better-auth.DiMBK1Ep.mjs} +22 -8
  218. package/dist/shared/{better-auth.lwzD09PV.cjs → better-auth.DqLjzBlO.cjs} +1 -1
  219. package/dist/shared/{better-auth.CHHC_PJT.cjs → better-auth.QbbyHMYf.cjs} +1 -1
  220. package/dist/shared/{better-auth.BN2jUYPL.cjs → better-auth.R2B_T2k0.cjs} +1 -1
  221. package/dist/shared/{better-auth.CPv7iscr.d.cts → better-auth.RZCibiKy.d.cts} +1 -1
  222. package/dist/shared/{better-auth.C6ZiueUc.mjs → better-auth.UO_GAdaM.mjs} +5 -5
  223. package/dist/shared/{better-auth.BddF2Yaz.cjs → better-auth.X0ynzeu1.cjs} +3 -3
  224. package/dist/shared/{better-auth.BdiSabiO.cjs → better-auth.aci1hpij.cjs} +11 -11
  225. package/dist/shared/{better-auth.CJ1_dCz5.mjs → better-auth.lijknCkI.mjs} +11 -11
  226. package/dist/shared/{better-auth.CrWUABzd.mjs → better-auth.vdKrG2Zp.mjs} +11 -4
  227. package/dist/social-providers/index.cjs +43 -18
  228. package/dist/social-providers/index.d.cts +1 -1
  229. package/dist/social-providers/index.d.mts +1 -1
  230. package/dist/social-providers/index.d.ts +1 -1
  231. package/dist/social-providers/index.mjs +43 -18
  232. package/dist/types/index.d.cts +3 -3
  233. package/dist/types/index.d.mts +3 -3
  234. package/dist/types/index.d.ts +3 -3
  235. package/package.json +3 -3
@@ -1,10 +1,10 @@
1
1
  import { AccessControl, Role, Statements } from '../access/index.cjs';
2
2
  import * as better_call from 'better-call';
3
3
  import { z } from 'zod';
4
- import { I as InferOptionSchema, l as AuthContext, H as HookEndpointContext, S as Session, U as User } from '../../shared/better-auth.D26n-znb.cjs';
4
+ import { I as InferOptionSchema, l as AuthContext, H as HookEndpointContext, S as Session, U as User } from '../../shared/better-auth.BkL9ntGY.cjs';
5
5
  import '../../shared/better-auth.Bi8FQwDD.cjs';
6
6
  import 'kysely';
7
- import '../../shared/better-auth.B36e4YUo.cjs';
7
+ import '../../shared/better-auth.BkREA_U6.cjs';
8
8
  import 'jose';
9
9
  import 'better-sqlite3';
10
10
 
@@ -128,34 +128,56 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
128
128
  hooks: {
129
129
  after: {
130
130
  matcher(context: HookEndpointContext): boolean;
131
- handler: (inputContext: {
132
- body?: any;
133
- query?: Record<string, any> | undefined;
134
- request?: Request | undefined;
135
- headers?: Headers | undefined;
136
- asResponse?: boolean | undefined;
137
- returnHeaders?: boolean | undefined;
138
- use?: better_call.Middleware[] | undefined;
139
- }) => Promise<SessionWithImpersonatedBy[] | undefined>;
131
+ handler: (inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<SessionWithImpersonatedBy[] | undefined>;
140
132
  }[];
141
133
  };
142
134
  endpoints: {
143
135
  setRole: {
144
- <C extends [{
145
- body: {
136
+ <C extends [better_call.InputContext<"/admin/set-role", {
137
+ method: "POST";
138
+ body: z.ZodObject<{
139
+ userId: z.ZodString;
140
+ role: z.ZodString;
141
+ }, "strip", z.ZodTypeAny, {
142
+ userId: string;
143
+ role: string;
144
+ }, {
146
145
  userId: string;
147
146
  role: string;
147
+ }>;
148
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
149
+ session: {
150
+ user: UserWithRole;
151
+ session: Session;
152
+ };
153
+ }>)[];
154
+ metadata: {
155
+ openapi: {
156
+ operationId: string;
157
+ summary: string;
158
+ description: string;
159
+ responses: {
160
+ 200: {
161
+ description: string;
162
+ content: {
163
+ "application/json": {
164
+ schema: {
165
+ type: "object";
166
+ properties: {
167
+ user: {
168
+ $ref: string;
169
+ };
170
+ };
171
+ };
172
+ };
173
+ };
174
+ };
175
+ };
176
+ };
148
177
  };
149
- method?: "POST" | undefined;
150
- query?: Record<string, any> | undefined;
151
- params?: Record<string, any> | undefined;
152
- request?: Request | undefined;
153
- headers?: HeadersInit | undefined;
154
- asResponse?: boolean | undefined;
155
- returnHeaders?: boolean | undefined;
156
- use?: better_call.Middleware[] | undefined;
157
- path?: string | undefined;
158
- }]>(...inputCtx: C): Promise<C extends [{
178
+ } & {
179
+ use: any[];
180
+ }>]>(...inputCtx: C): Promise<C extends [{
159
181
  asResponse: true;
160
182
  }] ? Response : C extends [{
161
183
  returnHeaders: true;
@@ -179,15 +201,7 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
179
201
  userId: string;
180
202
  role: string;
181
203
  }>;
182
- use: ((inputContext: {
183
- body?: any;
184
- query?: Record<string, any> | undefined;
185
- request?: Request | undefined;
186
- headers?: Headers | undefined;
187
- asResponse?: boolean | undefined;
188
- returnHeaders?: boolean | undefined;
189
- use?: better_call.Middleware[] | undefined;
190
- }) => Promise<{
204
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
191
205
  session: {
192
206
  user: UserWithRole;
193
207
  session: Session;
@@ -223,24 +237,57 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
223
237
  path: "/admin/set-role";
224
238
  };
225
239
  createUser: {
226
- <C extends [{
227
- body: {
240
+ <C extends [better_call.InputContext<"/admin/create-user", {
241
+ method: "POST";
242
+ body: z.ZodObject<{
243
+ email: z.ZodString;
244
+ password: z.ZodString;
245
+ name: z.ZodString;
246
+ role: z.ZodOptional<z.ZodString>;
247
+ /**
248
+ * extra fields for user
249
+ */
250
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
251
+ }, "strip", z.ZodTypeAny, {
252
+ password: string;
253
+ name: string;
254
+ email: string;
255
+ data?: Record<string, any> | undefined;
256
+ role?: string | undefined;
257
+ }, {
228
258
  password: string;
229
259
  name: string;
230
260
  email: string;
231
261
  data?: Record<string, any> | undefined;
232
262
  role?: string | undefined;
263
+ }>;
264
+ metadata: {
265
+ openapi: {
266
+ operationId: string;
267
+ summary: string;
268
+ description: string;
269
+ responses: {
270
+ 200: {
271
+ description: string;
272
+ content: {
273
+ "application/json": {
274
+ schema: {
275
+ type: "object";
276
+ properties: {
277
+ user: {
278
+ $ref: string;
279
+ };
280
+ };
281
+ };
282
+ };
283
+ };
284
+ };
285
+ };
286
+ };
233
287
  };
234
- method?: "POST" | undefined;
235
- query?: Record<string, any> | undefined;
236
- params?: Record<string, any> | undefined;
237
- request?: Request | undefined;
238
- headers?: HeadersInit | undefined;
239
- asResponse?: boolean | undefined;
240
- returnHeaders?: boolean | undefined;
241
- use?: better_call.Middleware[] | undefined;
242
- path?: string | undefined;
243
- }]>(...inputCtx: C): Promise<C extends [{
288
+ } & {
289
+ use: any[];
290
+ }>]>(...inputCtx: C): Promise<C extends [{
244
291
  asResponse: true;
245
292
  }] ? Response : C extends [{
246
293
  returnHeaders: true;
@@ -306,8 +353,37 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
306
353
  path: "/admin/create-user";
307
354
  };
308
355
  listUsers: {
309
- <C extends [{
310
- query: {
356
+ <C extends [better_call.InputContext<"/admin/list-users", {
357
+ method: "GET";
358
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
359
+ session: {
360
+ user: UserWithRole;
361
+ session: Session;
362
+ };
363
+ }>)[];
364
+ query: z.ZodObject<{
365
+ searchValue: z.ZodOptional<z.ZodString>;
366
+ searchField: z.ZodOptional<z.ZodEnum<["email", "name"]>>;
367
+ searchOperator: z.ZodOptional<z.ZodEnum<["contains", "starts_with", "ends_with"]>>;
368
+ limit: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
369
+ offset: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
370
+ sortBy: z.ZodOptional<z.ZodString>;
371
+ sortDirection: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
372
+ filterField: z.ZodOptional<z.ZodString>;
373
+ filterValue: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodBoolean]>>;
374
+ filterOperator: z.ZodOptional<z.ZodEnum<["eq", "ne", "lt", "lte", "gt", "gte"]>>;
375
+ }, "strip", z.ZodTypeAny, {
376
+ searchValue?: string | undefined;
377
+ searchField?: "name" | "email" | undefined;
378
+ searchOperator?: "contains" | "starts_with" | "ends_with" | undefined;
379
+ limit?: string | number | undefined;
380
+ offset?: string | number | undefined;
381
+ sortBy?: string | undefined;
382
+ sortDirection?: "asc" | "desc" | undefined;
383
+ filterField?: string | undefined;
384
+ filterValue?: string | number | boolean | undefined;
385
+ filterOperator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | undefined;
386
+ }, {
311
387
  searchValue?: string | undefined;
312
388
  searchField?: "name" | "email" | undefined;
313
389
  searchOperator?: "contains" | "starts_with" | "ends_with" | undefined;
@@ -318,17 +394,47 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
318
394
  filterField?: string | undefined;
319
395
  filterValue?: string | number | boolean | undefined;
320
396
  filterOperator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | undefined;
397
+ }>;
398
+ metadata: {
399
+ openapi: {
400
+ operationId: string;
401
+ summary: string;
402
+ description: string;
403
+ responses: {
404
+ 200: {
405
+ description: string;
406
+ content: {
407
+ "application/json": {
408
+ schema: {
409
+ type: "object";
410
+ properties: {
411
+ users: {
412
+ type: string;
413
+ items: {
414
+ $ref: string;
415
+ };
416
+ };
417
+ total: {
418
+ type: string;
419
+ };
420
+ limit: {
421
+ type: string;
422
+ };
423
+ offset: {
424
+ type: string;
425
+ };
426
+ };
427
+ required: string[];
428
+ };
429
+ };
430
+ };
431
+ };
432
+ };
433
+ };
321
434
  };
322
- body?: undefined;
323
- method?: "GET" | undefined;
324
- params?: Record<string, any> | undefined;
325
- request?: Request | undefined;
326
- headers?: HeadersInit | undefined;
327
- asResponse?: boolean | undefined;
328
- returnHeaders?: boolean | undefined;
329
- use?: better_call.Middleware[] | undefined;
330
- path?: string | undefined;
331
- }]>(...inputCtx: C): Promise<C extends [{
435
+ } & {
436
+ use: any[];
437
+ }>]>(...inputCtx: C): Promise<C extends [{
332
438
  asResponse: true;
333
439
  }] ? Response : C extends [{
334
440
  returnHeaders: true;
@@ -354,15 +460,7 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
354
460
  }>;
355
461
  options: {
356
462
  method: "GET";
357
- use: ((inputContext: {
358
- body?: any;
359
- query?: Record<string, any> | undefined;
360
- request?: Request | undefined;
361
- headers?: Headers | undefined;
362
- asResponse?: boolean | undefined;
363
- returnHeaders?: boolean | undefined;
364
- use?: better_call.Middleware[] | undefined;
365
- }) => Promise<{
463
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
366
464
  session: {
367
465
  user: UserWithRole;
368
466
  session: Session;
@@ -445,20 +543,51 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
445
543
  path: "/admin/list-users";
446
544
  };
447
545
  listUserSessions: {
448
- <C extends [{
449
- body: {
546
+ <C extends [better_call.InputContext<"/admin/list-user-sessions", {
547
+ method: "POST";
548
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
549
+ session: {
550
+ user: UserWithRole;
551
+ session: Session;
552
+ };
553
+ }>)[];
554
+ body: z.ZodObject<{
555
+ userId: z.ZodString;
556
+ }, "strip", z.ZodTypeAny, {
557
+ userId: string;
558
+ }, {
450
559
  userId: string;
560
+ }>;
561
+ metadata: {
562
+ openapi: {
563
+ operationId: string;
564
+ summary: string;
565
+ description: string;
566
+ responses: {
567
+ 200: {
568
+ description: string;
569
+ content: {
570
+ "application/json": {
571
+ schema: {
572
+ type: "object";
573
+ properties: {
574
+ sessions: {
575
+ type: string;
576
+ items: {
577
+ $ref: string;
578
+ };
579
+ };
580
+ };
581
+ };
582
+ };
583
+ };
584
+ };
585
+ };
586
+ };
451
587
  };
452
- method?: "POST" | undefined;
453
- query?: Record<string, any> | undefined;
454
- params?: Record<string, any> | undefined;
455
- request?: Request | undefined;
456
- headers?: HeadersInit | undefined;
457
- asResponse?: boolean | undefined;
458
- returnHeaders?: boolean | undefined;
459
- use?: better_call.Middleware[] | undefined;
460
- path?: string | undefined;
461
- }]>(...inputCtx: C): Promise<C extends [{
588
+ } & {
589
+ use: any[];
590
+ }>]>(...inputCtx: C): Promise<C extends [{
462
591
  asResponse: true;
463
592
  }] ? Response : C extends [{
464
593
  returnHeaders: true;
@@ -490,15 +619,7 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
490
619
  }>;
491
620
  options: {
492
621
  method: "POST";
493
- use: ((inputContext: {
494
- body?: any;
495
- query?: Record<string, any> | undefined;
496
- request?: Request | undefined;
497
- headers?: Headers | undefined;
498
- asResponse?: boolean | undefined;
499
- returnHeaders?: boolean | undefined;
500
- use?: better_call.Middleware[] | undefined;
501
- }) => Promise<{
622
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
502
623
  session: {
503
624
  user: UserWithRole;
504
625
  session: Session;
@@ -544,20 +665,48 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
544
665
  path: "/admin/list-user-sessions";
545
666
  };
546
667
  unbanUser: {
547
- <C extends [{
548
- body: {
668
+ <C extends [better_call.InputContext<"/admin/unban-user", {
669
+ method: "POST";
670
+ body: z.ZodObject<{
671
+ userId: z.ZodString;
672
+ }, "strip", z.ZodTypeAny, {
673
+ userId: string;
674
+ }, {
549
675
  userId: string;
676
+ }>;
677
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
678
+ session: {
679
+ user: UserWithRole;
680
+ session: Session;
681
+ };
682
+ }>)[];
683
+ metadata: {
684
+ openapi: {
685
+ operationId: string;
686
+ summary: string;
687
+ description: string;
688
+ responses: {
689
+ 200: {
690
+ description: string;
691
+ content: {
692
+ "application/json": {
693
+ schema: {
694
+ type: "object";
695
+ properties: {
696
+ user: {
697
+ $ref: string;
698
+ };
699
+ };
700
+ };
701
+ };
702
+ };
703
+ };
704
+ };
705
+ };
550
706
  };
551
- method?: "POST" | undefined;
552
- query?: Record<string, any> | undefined;
553
- params?: Record<string, any> | undefined;
554
- request?: Request | undefined;
555
- headers?: HeadersInit | undefined;
556
- asResponse?: boolean | undefined;
557
- returnHeaders?: boolean | undefined;
558
- use?: better_call.Middleware[] | undefined;
559
- path?: string | undefined;
560
- }]>(...inputCtx: C): Promise<C extends [{
707
+ } & {
708
+ use: any[];
709
+ }>]>(...inputCtx: C): Promise<C extends [{
561
710
  asResponse: true;
562
711
  }] ? Response : C extends [{
563
712
  returnHeaders: true;
@@ -578,15 +727,7 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
578
727
  }, {
579
728
  userId: string;
580
729
  }>;
581
- use: ((inputContext: {
582
- body?: any;
583
- query?: Record<string, any> | undefined;
584
- request?: Request | undefined;
585
- headers?: Headers | undefined;
586
- asResponse?: boolean | undefined;
587
- returnHeaders?: boolean | undefined;
588
- use?: better_call.Middleware[] | undefined;
589
- }) => Promise<{
730
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
590
731
  session: {
591
732
  user: UserWithRole;
592
733
  session: Session;
@@ -622,34 +763,7 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
622
763
  path: "/admin/unban-user";
623
764
  };
624
765
  banUser: {
625
- <C extends [{
626
- body: {
627
- userId: string;
628
- banReason?: string | undefined;
629
- banExpiresIn?: number | undefined;
630
- };
631
- method?: "POST" | undefined;
632
- query?: Record<string, any> | undefined;
633
- params?: Record<string, any> | undefined;
634
- request?: Request | undefined;
635
- headers?: HeadersInit | undefined;
636
- asResponse?: boolean | undefined;
637
- returnHeaders?: boolean | undefined;
638
- use?: better_call.Middleware[] | undefined;
639
- path?: string | undefined;
640
- }]>(...inputCtx: C): Promise<C extends [{
641
- asResponse: true;
642
- }] ? Response : C extends [{
643
- returnHeaders: true;
644
- }] ? {
645
- headers: Headers;
646
- response: {
647
- user: any;
648
- };
649
- } : {
650
- user: any;
651
- }>;
652
- options: {
766
+ <C extends [better_call.InputContext<"/admin/ban-user", {
653
767
  method: "POST";
654
768
  body: z.ZodObject<{
655
769
  userId: z.ZodString;
@@ -670,15 +784,7 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
670
784
  banReason?: string | undefined;
671
785
  banExpiresIn?: number | undefined;
672
786
  }>;
673
- use: ((inputContext: {
674
- body?: any;
675
- query?: Record<string, any> | undefined;
676
- request?: Request | undefined;
677
- headers?: Headers | undefined;
678
- asResponse?: boolean | undefined;
679
- returnHeaders?: boolean | undefined;
680
- use?: better_call.Middleware[] | undefined;
681
- }) => Promise<{
787
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
682
788
  session: {
683
789
  user: UserWithRole;
684
790
  session: Session;
@@ -710,37 +816,133 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
710
816
  };
711
817
  } & {
712
818
  use: any[];
713
- };
714
- path: "/admin/ban-user";
715
- };
716
- impersonateUser: {
717
- <C extends [{
718
- body: {
719
- userId: string;
720
- };
721
- method?: "POST" | undefined;
722
- query?: Record<string, any> | undefined;
723
- params?: Record<string, any> | undefined;
724
- request?: Request | undefined;
725
- headers?: HeadersInit | undefined;
726
- asResponse?: boolean | undefined;
727
- returnHeaders?: boolean | undefined;
728
- use?: better_call.Middleware[] | undefined;
729
- path?: string | undefined;
730
- }]>(...inputCtx: C): Promise<C extends [{
819
+ }>]>(...inputCtx: C): Promise<C extends [{
731
820
  asResponse: true;
732
821
  }] ? Response : C extends [{
733
822
  returnHeaders: true;
734
823
  }] ? {
735
824
  headers: Headers;
736
825
  response: {
737
- session: {
738
- id: string;
739
- createdAt: Date;
740
- updatedAt: Date;
741
- userId: string;
742
- expiresAt: Date;
743
- token: string;
826
+ user: any;
827
+ };
828
+ } : {
829
+ user: any;
830
+ }>;
831
+ options: {
832
+ method: "POST";
833
+ body: z.ZodObject<{
834
+ userId: z.ZodString;
835
+ /**
836
+ * Reason for the ban
837
+ */
838
+ banReason: z.ZodOptional<z.ZodString>;
839
+ /**
840
+ * Number of seconds until the ban expires
841
+ */
842
+ banExpiresIn: z.ZodOptional<z.ZodNumber>;
843
+ }, "strip", z.ZodTypeAny, {
844
+ userId: string;
845
+ banReason?: string | undefined;
846
+ banExpiresIn?: number | undefined;
847
+ }, {
848
+ userId: string;
849
+ banReason?: string | undefined;
850
+ banExpiresIn?: number | undefined;
851
+ }>;
852
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
853
+ session: {
854
+ user: UserWithRole;
855
+ session: Session;
856
+ };
857
+ }>)[];
858
+ metadata: {
859
+ openapi: {
860
+ operationId: string;
861
+ summary: string;
862
+ description: string;
863
+ responses: {
864
+ 200: {
865
+ description: string;
866
+ content: {
867
+ "application/json": {
868
+ schema: {
869
+ type: "object";
870
+ properties: {
871
+ user: {
872
+ $ref: string;
873
+ };
874
+ };
875
+ };
876
+ };
877
+ };
878
+ };
879
+ };
880
+ };
881
+ };
882
+ } & {
883
+ use: any[];
884
+ };
885
+ path: "/admin/ban-user";
886
+ };
887
+ impersonateUser: {
888
+ <C extends [better_call.InputContext<"/admin/impersonate-user", {
889
+ method: "POST";
890
+ body: z.ZodObject<{
891
+ userId: z.ZodString;
892
+ }, "strip", z.ZodTypeAny, {
893
+ userId: string;
894
+ }, {
895
+ userId: string;
896
+ }>;
897
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
898
+ session: {
899
+ user: UserWithRole;
900
+ session: Session;
901
+ };
902
+ }>)[];
903
+ metadata: {
904
+ openapi: {
905
+ operationId: string;
906
+ summary: string;
907
+ description: string;
908
+ responses: {
909
+ 200: {
910
+ description: string;
911
+ content: {
912
+ "application/json": {
913
+ schema: {
914
+ type: "object";
915
+ properties: {
916
+ session: {
917
+ $ref: string;
918
+ };
919
+ user: {
920
+ $ref: string;
921
+ };
922
+ };
923
+ };
924
+ };
925
+ };
926
+ };
927
+ };
928
+ };
929
+ };
930
+ } & {
931
+ use: any[];
932
+ }>]>(...inputCtx: C): Promise<C extends [{
933
+ asResponse: true;
934
+ }] ? Response : C extends [{
935
+ returnHeaders: true;
936
+ }] ? {
937
+ headers: Headers;
938
+ response: {
939
+ session: {
940
+ id: string;
941
+ createdAt: Date;
942
+ updatedAt: Date;
943
+ userId: string;
944
+ expiresAt: Date;
945
+ token: string;
744
946
  ipAddress?: string | null | undefined;
745
947
  userAgent?: string | null | undefined;
746
948
  };
@@ -784,15 +986,7 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
784
986
  }, {
785
987
  userId: string;
786
988
  }>;
787
- use: ((inputContext: {
788
- body?: any;
789
- query?: Record<string, any> | undefined;
790
- request?: Request | undefined;
791
- headers?: Headers | undefined;
792
- asResponse?: boolean | undefined;
793
- returnHeaders?: boolean | undefined;
794
- use?: better_call.Middleware[] | undefined;
795
- }) => Promise<{
989
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
796
990
  session: {
797
991
  user: UserWithRole;
798
992
  session: Session;
@@ -831,18 +1025,11 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
831
1025
  path: "/admin/impersonate-user";
832
1026
  };
833
1027
  stopImpersonating: {
834
- <C extends [({
835
- body?: undefined;
836
- method?: "POST" | undefined;
837
- query?: Record<string, any> | undefined;
838
- params?: Record<string, any> | undefined;
839
- request?: Request | undefined;
840
- headers?: HeadersInit | undefined;
841
- asResponse?: boolean | undefined;
842
- returnHeaders?: boolean | undefined;
843
- use?: better_call.Middleware[] | undefined;
844
- path?: string | undefined;
845
- } | undefined)?]>(...inputCtx: C): Promise<C extends [{
1028
+ <C extends [(better_call.InputContext<"/admin/stop-impersonating", {
1029
+ method: "POST";
1030
+ } & {
1031
+ use: any[];
1032
+ }> | undefined)?]>(...inputCtx: C): Promise<C extends [{
846
1033
  asResponse: true;
847
1034
  }] ? Response : C extends [{
848
1035
  returnHeaders: true;
@@ -864,20 +1051,48 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
864
1051
  path: "/admin/stop-impersonating";
865
1052
  };
866
1053
  revokeUserSession: {
867
- <C extends [{
868
- body: {
1054
+ <C extends [better_call.InputContext<"/admin/revoke-user-session", {
1055
+ method: "POST";
1056
+ body: z.ZodObject<{
1057
+ sessionToken: z.ZodString;
1058
+ }, "strip", z.ZodTypeAny, {
869
1059
  sessionToken: string;
1060
+ }, {
1061
+ sessionToken: string;
1062
+ }>;
1063
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
1064
+ session: {
1065
+ user: UserWithRole;
1066
+ session: Session;
1067
+ };
1068
+ }>)[];
1069
+ metadata: {
1070
+ openapi: {
1071
+ operationId: string;
1072
+ summary: string;
1073
+ description: string;
1074
+ responses: {
1075
+ 200: {
1076
+ description: string;
1077
+ content: {
1078
+ "application/json": {
1079
+ schema: {
1080
+ type: "object";
1081
+ properties: {
1082
+ success: {
1083
+ type: string;
1084
+ };
1085
+ };
1086
+ };
1087
+ };
1088
+ };
1089
+ };
1090
+ };
1091
+ };
870
1092
  };
871
- method?: "POST" | undefined;
872
- query?: Record<string, any> | undefined;
873
- params?: Record<string, any> | undefined;
874
- request?: Request | undefined;
875
- headers?: HeadersInit | undefined;
876
- asResponse?: boolean | undefined;
877
- returnHeaders?: boolean | undefined;
878
- use?: better_call.Middleware[] | undefined;
879
- path?: string | undefined;
880
- }]>(...inputCtx: C): Promise<C extends [{
1093
+ } & {
1094
+ use: any[];
1095
+ }>]>(...inputCtx: C): Promise<C extends [{
881
1096
  asResponse: true;
882
1097
  }] ? Response : C extends [{
883
1098
  returnHeaders: true;
@@ -898,15 +1113,7 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
898
1113
  }, {
899
1114
  sessionToken: string;
900
1115
  }>;
901
- use: ((inputContext: {
902
- body?: any;
903
- query?: Record<string, any> | undefined;
904
- request?: Request | undefined;
905
- headers?: Headers | undefined;
906
- asResponse?: boolean | undefined;
907
- returnHeaders?: boolean | undefined;
908
- use?: better_call.Middleware[] | undefined;
909
- }) => Promise<{
1116
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
910
1117
  session: {
911
1118
  user: UserWithRole;
912
1119
  session: Session;
@@ -942,20 +1149,48 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
942
1149
  path: "/admin/revoke-user-session";
943
1150
  };
944
1151
  revokeUserSessions: {
945
- <C extends [{
946
- body: {
1152
+ <C extends [better_call.InputContext<"/admin/revoke-user-sessions", {
1153
+ method: "POST";
1154
+ body: z.ZodObject<{
1155
+ userId: z.ZodString;
1156
+ }, "strip", z.ZodTypeAny, {
947
1157
  userId: string;
1158
+ }, {
1159
+ userId: string;
1160
+ }>;
1161
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
1162
+ session: {
1163
+ user: UserWithRole;
1164
+ session: Session;
1165
+ };
1166
+ }>)[];
1167
+ metadata: {
1168
+ openapi: {
1169
+ operationId: string;
1170
+ summary: string;
1171
+ description: string;
1172
+ responses: {
1173
+ 200: {
1174
+ description: string;
1175
+ content: {
1176
+ "application/json": {
1177
+ schema: {
1178
+ type: "object";
1179
+ properties: {
1180
+ success: {
1181
+ type: string;
1182
+ };
1183
+ };
1184
+ };
1185
+ };
1186
+ };
1187
+ };
1188
+ };
1189
+ };
948
1190
  };
949
- method?: "POST" | undefined;
950
- query?: Record<string, any> | undefined;
951
- params?: Record<string, any> | undefined;
952
- request?: Request | undefined;
953
- headers?: HeadersInit | undefined;
954
- asResponse?: boolean | undefined;
955
- returnHeaders?: boolean | undefined;
956
- use?: better_call.Middleware[] | undefined;
957
- path?: string | undefined;
958
- }]>(...inputCtx: C): Promise<C extends [{
1191
+ } & {
1192
+ use: any[];
1193
+ }>]>(...inputCtx: C): Promise<C extends [{
959
1194
  asResponse: true;
960
1195
  }] ? Response : C extends [{
961
1196
  returnHeaders: true;
@@ -976,15 +1211,7 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
976
1211
  }, {
977
1212
  userId: string;
978
1213
  }>;
979
- use: ((inputContext: {
980
- body?: any;
981
- query?: Record<string, any> | undefined;
982
- request?: Request | undefined;
983
- headers?: Headers | undefined;
984
- asResponse?: boolean | undefined;
985
- returnHeaders?: boolean | undefined;
986
- use?: better_call.Middleware[] | undefined;
987
- }) => Promise<{
1214
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
988
1215
  session: {
989
1216
  user: UserWithRole;
990
1217
  session: Session;
@@ -1020,20 +1247,48 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
1020
1247
  path: "/admin/revoke-user-sessions";
1021
1248
  };
1022
1249
  removeUser: {
1023
- <C extends [{
1024
- body: {
1250
+ <C extends [better_call.InputContext<"/admin/remove-user", {
1251
+ method: "POST";
1252
+ body: z.ZodObject<{
1253
+ userId: z.ZodString;
1254
+ }, "strip", z.ZodTypeAny, {
1025
1255
  userId: string;
1256
+ }, {
1257
+ userId: string;
1258
+ }>;
1259
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
1260
+ session: {
1261
+ user: UserWithRole;
1262
+ session: Session;
1263
+ };
1264
+ }>)[];
1265
+ metadata: {
1266
+ openapi: {
1267
+ operationId: string;
1268
+ summary: string;
1269
+ description: string;
1270
+ responses: {
1271
+ 200: {
1272
+ description: string;
1273
+ content: {
1274
+ "application/json": {
1275
+ schema: {
1276
+ type: "object";
1277
+ properties: {
1278
+ success: {
1279
+ type: string;
1280
+ };
1281
+ };
1282
+ };
1283
+ };
1284
+ };
1285
+ };
1286
+ };
1287
+ };
1026
1288
  };
1027
- method?: "POST" | undefined;
1028
- query?: Record<string, any> | undefined;
1029
- params?: Record<string, any> | undefined;
1030
- request?: Request | undefined;
1031
- headers?: HeadersInit | undefined;
1032
- asResponse?: boolean | undefined;
1033
- returnHeaders?: boolean | undefined;
1034
- use?: better_call.Middleware[] | undefined;
1035
- path?: string | undefined;
1036
- }]>(...inputCtx: C): Promise<C extends [{
1289
+ } & {
1290
+ use: any[];
1291
+ }>]>(...inputCtx: C): Promise<C extends [{
1037
1292
  asResponse: true;
1038
1293
  }] ? Response : C extends [{
1039
1294
  returnHeaders: true;
@@ -1054,15 +1309,7 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
1054
1309
  }, {
1055
1310
  userId: string;
1056
1311
  }>;
1057
- use: ((inputContext: {
1058
- body?: any;
1059
- query?: Record<string, any> | undefined;
1060
- request?: Request | undefined;
1061
- headers?: Headers | undefined;
1062
- asResponse?: boolean | undefined;
1063
- returnHeaders?: boolean | undefined;
1064
- use?: better_call.Middleware[] | undefined;
1065
- }) => Promise<{
1312
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
1066
1313
  session: {
1067
1314
  user: UserWithRole;
1068
1315
  session: Session;
@@ -1098,21 +1345,51 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
1098
1345
  path: "/admin/remove-user";
1099
1346
  };
1100
1347
  setUserPassword: {
1101
- <C extends [{
1102
- body: {
1348
+ <C extends [better_call.InputContext<"/admin/set-user-password", {
1349
+ method: "POST";
1350
+ body: z.ZodObject<{
1351
+ newPassword: z.ZodString;
1352
+ userId: z.ZodString;
1353
+ }, "strip", z.ZodTypeAny, {
1354
+ userId: string;
1355
+ newPassword: string;
1356
+ }, {
1103
1357
  userId: string;
1104
1358
  newPassword: string;
1359
+ }>;
1360
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
1361
+ session: {
1362
+ user: UserWithRole;
1363
+ session: Session;
1364
+ };
1365
+ }>)[];
1366
+ metadata: {
1367
+ openapi: {
1368
+ operationId: string;
1369
+ summary: string;
1370
+ description: string;
1371
+ responses: {
1372
+ 200: {
1373
+ description: string;
1374
+ content: {
1375
+ "application/json": {
1376
+ schema: {
1377
+ type: "object";
1378
+ properties: {
1379
+ status: {
1380
+ type: string;
1381
+ };
1382
+ };
1383
+ };
1384
+ };
1385
+ };
1386
+ };
1387
+ };
1388
+ };
1105
1389
  };
1106
- method?: "POST" | undefined;
1107
- query?: Record<string, any> | undefined;
1108
- params?: Record<string, any> | undefined;
1109
- request?: Request | undefined;
1110
- headers?: HeadersInit | undefined;
1111
- asResponse?: boolean | undefined;
1112
- returnHeaders?: boolean | undefined;
1113
- use?: better_call.Middleware[] | undefined;
1114
- path?: string | undefined;
1115
- }]>(...inputCtx: C): Promise<C extends [{
1390
+ } & {
1391
+ use: any[];
1392
+ }>]>(...inputCtx: C): Promise<C extends [{
1116
1393
  asResponse: true;
1117
1394
  }] ? Response : C extends [{
1118
1395
  returnHeaders: true;
@@ -1136,15 +1413,7 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
1136
1413
  userId: string;
1137
1414
  newPassword: string;
1138
1415
  }>;
1139
- use: ((inputContext: {
1140
- body?: any;
1141
- query?: Record<string, any> | undefined;
1142
- request?: Request | undefined;
1143
- headers?: Headers | undefined;
1144
- asResponse?: boolean | undefined;
1145
- returnHeaders?: boolean | undefined;
1146
- use?: better_call.Middleware[] | undefined;
1147
- }) => Promise<{
1416
+ use: ((inputContext: better_call.MiddlewareInputContext<better_call.MiddlewareOptions>) => Promise<{
1148
1417
  session: {
1149
1418
  user: UserWithRole;
1150
1419
  session: Session;
@@ -1180,28 +1449,79 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
1180
1449
  path: "/admin/set-user-password";
1181
1450
  };
1182
1451
  userHasPermission: {
1183
- <C extends [{
1184
- body: {
1185
- permission: { [key in keyof (O["ac"] extends AccessControl<infer S extends Statements> ? S : {
1186
- readonly user: readonly ["create", "list", "set-role", "ban", "impersonate", "delete", "set-password"];
1187
- readonly session: readonly ["list", "revoke", "delete"];
1188
- })]?: Array<(O["ac"] extends AccessControl<infer S extends Statements> ? S : {
1189
- readonly user: readonly ["create", "list", "set-role", "ban", "impersonate", "delete", "set-password"];
1190
- readonly session: readonly ["list", "revoke", "delete"];
1191
- })[key][number]>; };
1192
- userId?: string;
1193
- role?: string;
1452
+ <C extends [better_call.InputContext<"/admin/has-permission", {
1453
+ method: "POST";
1454
+ body: z.ZodObject<{
1455
+ permission: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>;
1456
+ userId: z.ZodOptional<z.ZodString>;
1457
+ role: z.ZodOptional<z.ZodString>;
1458
+ }, "strip", z.ZodTypeAny, {
1459
+ permission: Record<string, string[]>;
1460
+ userId?: string | undefined;
1461
+ role?: string | undefined;
1462
+ }, {
1463
+ permission: Record<string, string[]>;
1464
+ userId?: string | undefined;
1465
+ role?: string | undefined;
1466
+ }>;
1467
+ metadata: {
1468
+ openapi: {
1469
+ description: string;
1470
+ requestBody: {
1471
+ content: {
1472
+ "application/json": {
1473
+ schema: {
1474
+ type: "object";
1475
+ properties: {
1476
+ permission: {
1477
+ type: string;
1478
+ description: string;
1479
+ };
1480
+ };
1481
+ required: string[];
1482
+ };
1483
+ };
1484
+ };
1485
+ };
1486
+ responses: {
1487
+ "200": {
1488
+ description: string;
1489
+ content: {
1490
+ "application/json": {
1491
+ schema: {
1492
+ type: "object";
1493
+ properties: {
1494
+ error: {
1495
+ type: string;
1496
+ };
1497
+ success: {
1498
+ type: string;
1499
+ };
1500
+ };
1501
+ required: string[];
1502
+ };
1503
+ };
1504
+ };
1505
+ };
1506
+ };
1507
+ };
1508
+ $Infer: {
1509
+ body: {
1510
+ permission: { [key in keyof (O["ac"] extends AccessControl<infer S extends Statements> ? S : {
1511
+ readonly user: readonly ["create", "list", "set-role", "ban", "impersonate", "delete", "set-password"];
1512
+ readonly session: readonly ["list", "revoke", "delete"];
1513
+ })]?: Array<(O["ac"] extends AccessControl<infer S extends Statements> ? S : {
1514
+ readonly user: readonly ["create", "list", "set-role", "ban", "impersonate", "delete", "set-password"];
1515
+ readonly session: readonly ["list", "revoke", "delete"];
1516
+ })[key][number]>; };
1517
+ userId?: string;
1518
+ role?: string;
1519
+ };
1520
+ };
1194
1521
  };
1195
- method?: "POST" | undefined;
1196
- query?: Record<string, any> | undefined;
1197
- params?: Record<string, any> | undefined;
1198
- request?: Request | undefined;
1199
- headers?: HeadersInit | undefined;
1200
- asResponse?: boolean | undefined;
1201
- returnHeaders?: boolean | undefined;
1202
- use?: better_call.Middleware[] | undefined;
1203
- path?: string | undefined;
1204
- }]>(...inputCtx: C): Promise<C extends [{
1522
+ } & {
1523
+ use: any[];
1524
+ }>]>(...inputCtx: C): Promise<C extends [{
1205
1525
  asResponse: true;
1206
1526
  }] ? Response : C extends [{
1207
1527
  returnHeaders: true;