@questpie/admin 0.0.1 → 1.0.1

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 (250) hide show
  1. package/README.md +439 -424
  2. package/dist/auth-layout-M8K8_q5R.mjs +181 -0
  3. package/dist/auth-layout-M8K8_q5R.mjs.map +1 -0
  4. package/dist/bulk-upload-dialog-D7w7W1Hl.mjs +273 -0
  5. package/dist/bulk-upload-dialog-D7w7W1Hl.mjs.map +1 -0
  6. package/dist/{components/ui/card.mjs → card-BKHjBQfw.mjs} +8 -8
  7. package/dist/card-BKHjBQfw.mjs.map +1 -0
  8. package/dist/client/styles/index.css +434 -0
  9. package/dist/client-DbpZKSgH.d.mts +13585 -0
  10. package/dist/client-DbpZKSgH.d.mts.map +1 -0
  11. package/dist/client-njX1rZmi.mjs +22612 -0
  12. package/dist/client-njX1rZmi.mjs.map +1 -0
  13. package/dist/client.d.mts +3 -0
  14. package/dist/client.mjs +13 -0
  15. package/dist/content-locales-provider-BXvuIgfg.mjs +1650 -0
  16. package/dist/content-locales-provider-BXvuIgfg.mjs.map +1 -0
  17. package/dist/dashboard-page-B4PGEdc2.mjs +2500 -0
  18. package/dist/dashboard-page-B4PGEdc2.mjs.map +1 -0
  19. package/dist/dashboard-page-mCY0pgZv.mjs +3 -0
  20. package/dist/dropzone-Do3awXKd.mjs +634 -0
  21. package/dist/dropzone-Do3awXKd.mjs.map +1 -0
  22. package/dist/{views/auth/forgot-password-form.mjs → forgot-password-page-Bcp-An4Y.mjs} +87 -14
  23. package/dist/forgot-password-page-Bcp-An4Y.mjs.map +1 -0
  24. package/dist/forgot-password-page-CEwsdLwn.mjs +3 -0
  25. package/dist/index-B9Xwk4hi.d.mts +2753 -0
  26. package/dist/index-B9Xwk4hi.d.mts.map +1 -0
  27. package/dist/index.d.mts +3 -0
  28. package/dist/index.mjs +13 -0
  29. package/dist/login-page-BUnpCbCa.mjs +3 -0
  30. package/dist/login-page-CP4gA-dl.mjs +298 -0
  31. package/dist/login-page-CP4gA-dl.mjs.map +1 -0
  32. package/dist/preview-utils-BKQ9-TMa.mjs +65 -0
  33. package/dist/preview-utils-BKQ9-TMa.mjs.map +1 -0
  34. package/dist/{views/auth/reset-password-form.mjs → reset-password-page-BqfDmLxA.mjs} +111 -14
  35. package/dist/reset-password-page-BqfDmLxA.mjs.map +1 -0
  36. package/dist/reset-password-page-CufHz3h3.mjs +3 -0
  37. package/dist/runtime-6VZM878K.mjs +69 -0
  38. package/dist/runtime-6VZM878K.mjs.map +1 -0
  39. package/dist/saved-views.types-BMsz5mCy.d.mts +42 -0
  40. package/dist/saved-views.types-BMsz5mCy.d.mts.map +1 -0
  41. package/dist/server.d.mts +250 -0
  42. package/dist/server.d.mts.map +1 -0
  43. package/dist/server.mjs +832 -0
  44. package/dist/server.mjs.map +1 -0
  45. package/dist/setup-page-BNNzt_Z6.mjs +3 -0
  46. package/dist/setup-page-YAP_fzqh.mjs +264 -0
  47. package/dist/setup-page-YAP_fzqh.mjs.map +1 -0
  48. package/dist/shared.d.mts +57 -0
  49. package/dist/shared.d.mts.map +1 -0
  50. package/dist/shared.mjs +3 -0
  51. package/dist/{hooks/use-auth.mjs → use-auth-BoLmWtmU.mjs} +42 -30
  52. package/dist/use-auth-BoLmWtmU.mjs.map +1 -0
  53. package/package.json +48 -198
  54. package/.turbo/turbo-build.log +0 -108
  55. package/CHANGELOG.md +0 -10
  56. package/STATUS.md +0 -917
  57. package/VALIDATION.md +0 -602
  58. package/components.json +0 -24
  59. package/dist/__tests__/setup.mjs +0 -38
  60. package/dist/__tests__/test-utils.mjs +0 -45
  61. package/dist/__tests__/vitest.d.mjs +0 -3
  62. package/dist/components/admin-app.mjs +0 -69
  63. package/dist/components/fields/array-field.mjs +0 -190
  64. package/dist/components/fields/checkbox-field.mjs +0 -34
  65. package/dist/components/fields/custom-field.mjs +0 -32
  66. package/dist/components/fields/date-field.mjs +0 -41
  67. package/dist/components/fields/datetime-field.mjs +0 -42
  68. package/dist/components/fields/email-field.mjs +0 -37
  69. package/dist/components/fields/embedded-collection.mjs +0 -253
  70. package/dist/components/fields/field-types.mjs +0 -1
  71. package/dist/components/fields/field-utils.mjs +0 -10
  72. package/dist/components/fields/field-wrapper.mjs +0 -34
  73. package/dist/components/fields/index.mjs +0 -23
  74. package/dist/components/fields/json-field.mjs +0 -243
  75. package/dist/components/fields/locale-badge.mjs +0 -16
  76. package/dist/components/fields/number-field.mjs +0 -39
  77. package/dist/components/fields/password-field.mjs +0 -37
  78. package/dist/components/fields/relation-field.mjs +0 -104
  79. package/dist/components/fields/relation-picker.mjs +0 -229
  80. package/dist/components/fields/relation-select.mjs +0 -188
  81. package/dist/components/fields/rich-text-editor/index.mjs +0 -897
  82. package/dist/components/fields/select-field.mjs +0 -41
  83. package/dist/components/fields/switch-field.mjs +0 -34
  84. package/dist/components/fields/text-field.mjs +0 -38
  85. package/dist/components/fields/textarea-field.mjs +0 -38
  86. package/dist/components/index.mjs +0 -59
  87. package/dist/components/primitives/checkbox-input.mjs +0 -127
  88. package/dist/components/primitives/date-input.mjs +0 -303
  89. package/dist/components/primitives/index.mjs +0 -12
  90. package/dist/components/primitives/number-input.mjs +0 -104
  91. package/dist/components/primitives/select-input.mjs +0 -177
  92. package/dist/components/primitives/tag-input.mjs +0 -135
  93. package/dist/components/primitives/text-input.mjs +0 -39
  94. package/dist/components/primitives/textarea-input.mjs +0 -37
  95. package/dist/components/primitives/toggle-input.mjs +0 -31
  96. package/dist/components/primitives/types.mjs +0 -12
  97. package/dist/components/ui/accordion.mjs +0 -55
  98. package/dist/components/ui/avatar.mjs +0 -54
  99. package/dist/components/ui/badge.mjs +0 -34
  100. package/dist/components/ui/button.mjs +0 -48
  101. package/dist/components/ui/checkbox.mjs +0 -21
  102. package/dist/components/ui/combobox.mjs +0 -163
  103. package/dist/components/ui/dialog.mjs +0 -95
  104. package/dist/components/ui/dropdown-menu.mjs +0 -138
  105. package/dist/components/ui/field.mjs +0 -113
  106. package/dist/components/ui/input-group.mjs +0 -82
  107. package/dist/components/ui/input.mjs +0 -17
  108. package/dist/components/ui/label.mjs +0 -15
  109. package/dist/components/ui/popover.mjs +0 -56
  110. package/dist/components/ui/scroll-area.mjs +0 -38
  111. package/dist/components/ui/select.mjs +0 -100
  112. package/dist/components/ui/separator.mjs +0 -16
  113. package/dist/components/ui/sheet.mjs +0 -90
  114. package/dist/components/ui/sidebar.mjs +0 -387
  115. package/dist/components/ui/skeleton.mjs +0 -14
  116. package/dist/components/ui/spinner.mjs +0 -16
  117. package/dist/components/ui/switch.mjs +0 -22
  118. package/dist/components/ui/table.mjs +0 -68
  119. package/dist/components/ui/tabs.mjs +0 -48
  120. package/dist/components/ui/textarea.mjs +0 -15
  121. package/dist/components/ui/tooltip.mjs +0 -44
  122. package/dist/config/component-registry.mjs +0 -38
  123. package/dist/config/index.mjs +0 -129
  124. package/dist/hooks/admin-provider.mjs +0 -70
  125. package/dist/hooks/index.mjs +0 -7
  126. package/dist/hooks/store.mjs +0 -178
  127. package/dist/hooks/use-collection-db.mjs +0 -146
  128. package/dist/hooks/use-collection.mjs +0 -112
  129. package/dist/hooks/use-global.mjs +0 -46
  130. package/dist/hooks/use-mobile.mjs +0 -20
  131. package/dist/lib/utils.mjs +0 -10
  132. package/dist/styles/index.css +0 -336
  133. package/dist/styles/index.mjs +0 -1
  134. package/dist/utils/index.mjs +0 -9
  135. package/dist/views/auth/auth-layout.mjs +0 -52
  136. package/dist/views/auth/index.mjs +0 -6
  137. package/dist/views/auth/login-form.mjs +0 -156
  138. package/dist/views/collection/auto-form-fields.mjs +0 -525
  139. package/dist/views/collection/collection-form.mjs +0 -91
  140. package/dist/views/collection/collection-list.mjs +0 -76
  141. package/dist/views/collection/form-field.mjs +0 -42
  142. package/dist/views/collection/index.mjs +0 -6
  143. package/dist/views/common/index.mjs +0 -4
  144. package/dist/views/common/locale-switcher.mjs +0 -39
  145. package/dist/views/common/version-history.mjs +0 -272
  146. package/dist/views/index.mjs +0 -9
  147. package/dist/views/layout/admin-layout.mjs +0 -40
  148. package/dist/views/layout/admin-router.mjs +0 -95
  149. package/dist/views/layout/admin-sidebar.mjs +0 -63
  150. package/dist/views/layout/index.mjs +0 -5
  151. package/src/__tests__/setup.ts +0 -44
  152. package/src/__tests__/test-utils.tsx +0 -49
  153. package/src/__tests__/vitest.d.ts +0 -9
  154. package/src/components/admin-app.tsx +0 -221
  155. package/src/components/fields/array-field.tsx +0 -237
  156. package/src/components/fields/checkbox-field.tsx +0 -47
  157. package/src/components/fields/custom-field.tsx +0 -50
  158. package/src/components/fields/date-field.tsx +0 -65
  159. package/src/components/fields/datetime-field.tsx +0 -67
  160. package/src/components/fields/email-field.tsx +0 -51
  161. package/src/components/fields/embedded-collection.tsx +0 -315
  162. package/src/components/fields/field-types.ts +0 -162
  163. package/src/components/fields/field-utils.ts +0 -6
  164. package/src/components/fields/field-wrapper.tsx +0 -52
  165. package/src/components/fields/index.ts +0 -66
  166. package/src/components/fields/json-field.tsx +0 -440
  167. package/src/components/fields/locale-badge.tsx +0 -15
  168. package/src/components/fields/number-field.tsx +0 -57
  169. package/src/components/fields/password-field.tsx +0 -51
  170. package/src/components/fields/relation-field.tsx +0 -243
  171. package/src/components/fields/relation-picker.tsx +0 -402
  172. package/src/components/fields/relation-select.tsx +0 -327
  173. package/src/components/fields/rich-text-editor/index.tsx +0 -1337
  174. package/src/components/fields/select-field.tsx +0 -61
  175. package/src/components/fields/switch-field.tsx +0 -47
  176. package/src/components/fields/text-field.tsx +0 -55
  177. package/src/components/fields/textarea-field.tsx +0 -55
  178. package/src/components/index.ts +0 -40
  179. package/src/components/primitives/checkbox-input.tsx +0 -193
  180. package/src/components/primitives/date-input.tsx +0 -401
  181. package/src/components/primitives/index.ts +0 -24
  182. package/src/components/primitives/number-input.tsx +0 -132
  183. package/src/components/primitives/select-input.tsx +0 -296
  184. package/src/components/primitives/tag-input.tsx +0 -200
  185. package/src/components/primitives/text-input.tsx +0 -49
  186. package/src/components/primitives/textarea-input.tsx +0 -46
  187. package/src/components/primitives/toggle-input.tsx +0 -36
  188. package/src/components/primitives/types.ts +0 -235
  189. package/src/components/ui/accordion.tsx +0 -72
  190. package/src/components/ui/avatar.tsx +0 -106
  191. package/src/components/ui/badge.tsx +0 -48
  192. package/src/components/ui/button.tsx +0 -53
  193. package/src/components/ui/card.tsx +0 -94
  194. package/src/components/ui/checkbox.tsx +0 -27
  195. package/src/components/ui/combobox.tsx +0 -290
  196. package/src/components/ui/dialog.tsx +0 -151
  197. package/src/components/ui/dropdown-menu.tsx +0 -254
  198. package/src/components/ui/field.tsx +0 -227
  199. package/src/components/ui/input-group.tsx +0 -149
  200. package/src/components/ui/input.tsx +0 -20
  201. package/src/components/ui/label.tsx +0 -18
  202. package/src/components/ui/popover.tsx +0 -88
  203. package/src/components/ui/scroll-area.tsx +0 -53
  204. package/src/components/ui/select.tsx +0 -192
  205. package/src/components/ui/separator.tsx +0 -23
  206. package/src/components/ui/sheet.tsx +0 -127
  207. package/src/components/ui/sidebar.tsx +0 -723
  208. package/src/components/ui/skeleton.tsx +0 -13
  209. package/src/components/ui/spinner.tsx +0 -10
  210. package/src/components/ui/switch.tsx +0 -32
  211. package/src/components/ui/table.tsx +0 -99
  212. package/src/components/ui/tabs.tsx +0 -82
  213. package/src/components/ui/textarea.tsx +0 -18
  214. package/src/components/ui/tooltip.tsx +0 -70
  215. package/src/config/component-registry.ts +0 -190
  216. package/src/config/index.ts +0 -1099
  217. package/src/hooks/README.md +0 -269
  218. package/src/hooks/admin-provider.tsx +0 -110
  219. package/src/hooks/index.ts +0 -41
  220. package/src/hooks/store.ts +0 -248
  221. package/src/hooks/use-auth.ts +0 -168
  222. package/src/hooks/use-collection-db.ts +0 -209
  223. package/src/hooks/use-collection.ts +0 -156
  224. package/src/hooks/use-global.ts +0 -69
  225. package/src/hooks/use-mobile.ts +0 -21
  226. package/src/lib/utils.ts +0 -6
  227. package/src/styles/index.css +0 -340
  228. package/src/utils/index.ts +0 -6
  229. package/src/views/auth/auth-layout.tsx +0 -77
  230. package/src/views/auth/forgot-password-form.tsx +0 -192
  231. package/src/views/auth/index.ts +0 -21
  232. package/src/views/auth/login-form.tsx +0 -229
  233. package/src/views/auth/reset-password-form.tsx +0 -232
  234. package/src/views/collection/auto-form-fields.tsx +0 -982
  235. package/src/views/collection/collection-form.tsx +0 -186
  236. package/src/views/collection/collection-list.tsx +0 -223
  237. package/src/views/collection/form-field.tsx +0 -52
  238. package/src/views/collection/index.ts +0 -15
  239. package/src/views/common/index.ts +0 -8
  240. package/src/views/common/locale-switcher.tsx +0 -45
  241. package/src/views/common/version-history.tsx +0 -406
  242. package/src/views/index.ts +0 -25
  243. package/src/views/layout/admin-layout.tsx +0 -117
  244. package/src/views/layout/admin-router.tsx +0 -206
  245. package/src/views/layout/admin-sidebar.tsx +0 -185
  246. package/src/views/layout/index.ts +0 -12
  247. package/tsconfig.json +0 -13
  248. package/tsconfig.tsbuildinfo +0 -1
  249. package/tsdown.config.ts +0 -13
  250. package/vitest.config.ts +0 -29
@@ -0,0 +1,2753 @@
1
+ import { i as ViewConfiguration } from "./saved-views.types-BMsz5mCy.mjs";
2
+ import * as zod0 from "zod";
3
+ import * as questpie181 from "questpie";
4
+ import { Questpie } from "questpie";
5
+ import * as drizzle_orm_pg_core183 from "drizzle-orm/pg-core";
6
+ import * as drizzle_orm94 from "drizzle-orm";
7
+ import * as better_auth0 from "better-auth";
8
+ import * as better_call0 from "better-call";
9
+ import * as better_auth_plugins0 from "better-auth/plugins";
10
+
11
+ //#region src/server/auth-helpers.d.ts
12
+
13
+ /**
14
+ * Session object from Better Auth
15
+ */
16
+ interface AuthSession {
17
+ user: {
18
+ id: string;
19
+ email: string;
20
+ name?: string | null;
21
+ role?: string | null;
22
+ [key: string]: unknown;
23
+ };
24
+ session: {
25
+ id: string;
26
+ userId: string;
27
+ expiresAt: Date;
28
+ [key: string]: unknown;
29
+ };
30
+ }
31
+ /**
32
+ * Options for requireAdminAuth
33
+ */
34
+ interface RequireAdminAuthOptions {
35
+ /**
36
+ * The incoming request
37
+ */
38
+ request: Request;
39
+ /**
40
+ * The CMS instance with auth configured
41
+ */
42
+ cms: Questpie<any>;
43
+ /**
44
+ * Path to redirect to when not authenticated
45
+ * @default "/admin/login"
46
+ */
47
+ loginPath?: string;
48
+ /**
49
+ * Required role for access
50
+ * @default "admin"
51
+ */
52
+ requiredRole?: string;
53
+ /**
54
+ * Query parameter name for redirect URL
55
+ * @default "redirect"
56
+ */
57
+ redirectParam?: string;
58
+ }
59
+ /**
60
+ * Options for getAdminSession
61
+ */
62
+ interface GetAdminSessionOptions {
63
+ /**
64
+ * The incoming request
65
+ */
66
+ request: Request;
67
+ /**
68
+ * The CMS instance with auth configured
69
+ */
70
+ cms: Questpie<any>;
71
+ }
72
+ /**
73
+ * Check if user is authenticated with required role on the server.
74
+ * Returns a redirect Response if not authenticated, null if authenticated.
75
+ *
76
+ * Use this in server loaders/middleware to protect routes.
77
+ *
78
+ * @example TanStack Router
79
+ * ```ts
80
+ * export const Route = createFileRoute("/admin")({
81
+ * beforeLoad: async ({ context }) => {
82
+ * const redirect = await requireAdminAuth({
83
+ * request: context.request,
84
+ * cms,
85
+ * loginPath: "/admin/login",
86
+ * });
87
+ * if (redirect) throw redirect;
88
+ * },
89
+ * });
90
+ * ```
91
+ *
92
+ * @example Next.js Middleware
93
+ * ```ts
94
+ * export async function middleware(request: NextRequest) {
95
+ * const redirect = await requireAdminAuth({
96
+ * request,
97
+ * cms,
98
+ * loginPath: "/admin/login",
99
+ * });
100
+ * if (redirect) return redirect;
101
+ * return NextResponse.next();
102
+ * }
103
+ * ```
104
+ */
105
+ declare function requireAdminAuth({
106
+ request,
107
+ cms,
108
+ loginPath,
109
+ requiredRole,
110
+ redirectParam
111
+ }: RequireAdminAuthOptions): Promise<Response | null>;
112
+ /**
113
+ * Get the current admin session on the server.
114
+ * Returns null if not authenticated.
115
+ *
116
+ * Use this when you need access to the session data in server code.
117
+ *
118
+ * @example
119
+ * ```ts
120
+ * const session = await getAdminSession({ request, cms });
121
+ * if (!session) {
122
+ * return redirect("/admin/login");
123
+ * }
124
+ * console.log("User:", session.user.name);
125
+ * ```
126
+ */
127
+ declare function getAdminSession({
128
+ request,
129
+ cms
130
+ }: GetAdminSessionOptions): Promise<AuthSession | null>;
131
+ /**
132
+ * Check if the current user has admin role on the server.
133
+ *
134
+ * @example
135
+ * ```ts
136
+ * const isAdmin = await isAdminUser({ request, cms });
137
+ * if (!isAdmin) {
138
+ * return json({ error: "Unauthorized" }, { status: 403 });
139
+ * }
140
+ * ```
141
+ */
142
+ declare function isAdminUser({
143
+ request,
144
+ cms,
145
+ requiredRole
146
+ }: GetAdminSessionOptions & {
147
+ requiredRole?: string;
148
+ }): Promise<boolean>;
149
+ //#endregion
150
+ //#region src/server/modules/admin-preferences/collections/saved-views.collection.d.ts
151
+ /**
152
+ * Admin Saved Views Collection
153
+ *
154
+ * Stores user-specific view configurations for collection lists.
155
+ * Each view can contain:
156
+ * - Filter rules (field/operator/value combinations)
157
+ * - Sort configuration (field/direction)
158
+ * - Visible columns selection
159
+ *
160
+ * @example
161
+ * ```ts
162
+ * import { adminModule } from "@questpie/admin/server";
163
+ *
164
+ * const cms = q({ name: "my-app" })
165
+ * .use(starterModule)
166
+ * .use(adminModule)
167
+ * .collections({ ... })
168
+ * .build({ ... });
169
+ *
170
+ * // Access saved views
171
+ * const views = await cms.api.collections.adminSavedViews.find({
172
+ * where: { collectionName: "posts", userId: currentUser.id }
173
+ * });
174
+ * ```
175
+ */
176
+ declare const savedViewsCollection: questpie181.CollectionBuilder<questpie181.SetProperty<questpie181.TypeMerge<questpie181.UnsetProperty<questpie181.CollectionBuilderState & {
177
+ name: "admin_saved_views";
178
+ fields: {};
179
+ localized: [];
180
+ virtuals: undefined;
181
+ relations: {};
182
+ indexes: {};
183
+ title: undefined;
184
+ options: {};
185
+ hooks: questpie181.CollectionHooks<any, any, any>;
186
+ access: {};
187
+ functions: {};
188
+ searchable: undefined;
189
+ validation: undefined;
190
+ output: undefined;
191
+ upload: undefined;
192
+ }, "localized" | "fields">, {
193
+ fields: {
194
+ userId: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
195
+ collectionName: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
196
+ name: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
197
+ configuration: drizzle_orm94.$Type<drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgJsonbBuilder>, ViewConfiguration>;
198
+ isDefault: drizzle_orm94.NotNull<drizzle_orm94.HasDefault<drizzle_orm_pg_core183.PgBooleanBuilder>>;
199
+ };
200
+ localized: [];
201
+ }>, "options", {
202
+ timestamps: true;
203
+ }>>;
204
+ //#endregion
205
+ //#region src/server/modules/admin/functions/preview.d.ts
206
+ /**
207
+ * Preview Functions - Server-side
208
+ *
209
+ * RPC functions for draft mode preview.
210
+ * Handles token minting for secure, shareable preview links.
211
+ *
212
+ * Browser-safe utilities (isDraftMode, createDraftModeCookie, etc.) are in @questpie/admin/shared
213
+ */
214
+ interface PreviewTokenPayload {
215
+ path: string;
216
+ exp: number;
217
+ }
218
+ /**
219
+ * Create preview-related RPC functions.
220
+ *
221
+ * @param secret - Secret key for signing tokens
222
+ * @returns Object with preview functions
223
+ */
224
+ declare function createPreviewFunctions(secret: string): {
225
+ mintPreviewToken: questpie181.JsonFunctionDefinition<{
226
+ path: string;
227
+ ttlMs?: number | undefined;
228
+ }, {
229
+ token: string;
230
+ expiresAt: number;
231
+ }, any>;
232
+ verifyPreviewToken: questpie181.JsonFunctionDefinition<{
233
+ token: string;
234
+ }, {
235
+ valid: boolean;
236
+ path?: string | undefined;
237
+ error?: string | undefined;
238
+ }, any>;
239
+ };
240
+ /**
241
+ * Verify a preview token without RPC.
242
+ * Used directly in route handlers where RPC is not available.
243
+ *
244
+ * @param token - The preview token to verify
245
+ * @param secret - The secret used to sign the token
246
+ * @returns The payload if valid, null otherwise
247
+ */
248
+ declare function verifyPreviewTokenDirect(token: string, secret: string): PreviewTokenPayload | null;
249
+ /**
250
+ * Create a preview token verifier with bound secret.
251
+ * Use this in route handlers to avoid passing secret repeatedly.
252
+ *
253
+ * @param secret - The secret used to sign tokens (optional, uses env if not provided)
254
+ * @returns A verify function that only needs the token
255
+ *
256
+ * @example
257
+ * ```ts
258
+ * // Create once at module level
259
+ * const verifyPreviewToken = createPreviewTokenVerifier();
260
+ *
261
+ * // Use in route handler
262
+ * const payload = verifyPreviewToken(token);
263
+ * if (!payload) {
264
+ * return new Response("Invalid token", { status: 401 });
265
+ * }
266
+ * ```
267
+ */
268
+ declare function createPreviewTokenVerifier(secret?: string): (token: string) => PreviewTokenPayload | null;
269
+ //#endregion
270
+ //#region src/server/modules/admin/functions/setup.d.ts
271
+ /**
272
+ * Setup Functions
273
+ *
274
+ * Built-in functions for bootstrapping the first admin user.
275
+ * Solves the chicken-and-egg problem where invitation-based systems
276
+ * need an existing admin to create the first invitation.
277
+ */
278
+ /**
279
+ * Check if setup is required (no users exist in the system).
280
+ *
281
+ * @example
282
+ * ```ts
283
+ * const result = await client.rpc.isSetupRequired({});
284
+ * if (result.required) {
285
+ * // Redirect to setup page
286
+ * }
287
+ * ```
288
+ */
289
+ declare const isSetupRequired: questpie181.JsonFunctionDefinition<Record<string, never>, {
290
+ required: boolean;
291
+ }, any>;
292
+ /**
293
+ * Create the first admin user in the system.
294
+ * This function only works when no users exist (setup mode).
295
+ *
296
+ * Security: Once any user exists, this function will refuse to create more users.
297
+ * This prevents unauthorized admin creation after initial setup.
298
+ *
299
+ * @example
300
+ * ```ts
301
+ * const result = await client.rpc.createFirstAdmin({
302
+ * email: "admin@example.com",
303
+ * password: "securepassword123",
304
+ * name: "Admin User",
305
+ * });
306
+ *
307
+ * if (result.success) {
308
+ * // Redirect to login page
309
+ * } else {
310
+ * console.error(result.error);
311
+ * }
312
+ * ```
313
+ */
314
+ declare const createFirstAdmin: questpie181.JsonFunctionDefinition<{
315
+ email: string;
316
+ password: string;
317
+ name: string;
318
+ }, {
319
+ success: boolean;
320
+ user?: {
321
+ id: string;
322
+ email: string;
323
+ name: string;
324
+ } | undefined;
325
+ error?: string | undefined;
326
+ }, any>;
327
+ /**
328
+ * Bundle of setup-related functions.
329
+ */
330
+ declare const setupFunctions: {
331
+ readonly isSetupRequired: questpie181.JsonFunctionDefinition<Record<string, never>, {
332
+ required: boolean;
333
+ }, any>;
334
+ readonly createFirstAdmin: questpie181.JsonFunctionDefinition<{
335
+ email: string;
336
+ password: string;
337
+ name: string;
338
+ }, {
339
+ success: boolean;
340
+ user?: {
341
+ id: string;
342
+ email: string;
343
+ name: string;
344
+ } | undefined;
345
+ error?: string | undefined;
346
+ }, any>;
347
+ };
348
+ //#endregion
349
+ //#region src/server/modules/admin/index.d.ts
350
+ /**
351
+ * Admin Module - the complete backend for QuestPie admin panel.
352
+ *
353
+ * This module provides everything needed to run the admin panel:
354
+ * - User authentication (Better Auth) - from starterModule
355
+ * - File uploads (assets) - from starterModule
356
+ * - Saved views for collection filters (named configurations)
357
+ * - User preferences (view state synced across devices)
358
+ * - Setup flow for first admin creation
359
+ *
360
+ * @example
361
+ * ```ts
362
+ * import { q } from "questpie";
363
+ * import { adminModule } from "@questpie/admin/server";
364
+ *
365
+ * const cms = q({ name: "my-app" })
366
+ * .use(adminModule)
367
+ * .collections({
368
+ * posts: postsCollection,
369
+ * })
370
+ * .build({
371
+ * db: { url: process.env.DATABASE_URL },
372
+ * });
373
+ * ```
374
+ *
375
+ * @example
376
+ * ```ts
377
+ * // Extend assets collection with custom fields
378
+ * import { q, collection, varchar } from "questpie";
379
+ * import { adminModule } from "@questpie/admin/server";
380
+ *
381
+ * const cms = q({ name: "my-app" })
382
+ * .use(adminModule)
383
+ * .collections({
384
+ * // Override assets with additional fields
385
+ * assets: adminModule.state.collections.assets.merge(
386
+ * collection("assets").fields({
387
+ * folder: varchar("folder", { length: 255 }),
388
+ * tags: varchar("tags", { length: 1000 }),
389
+ * })
390
+ * ),
391
+ * })
392
+ * .build({ ... });
393
+ * ```
394
+ */
395
+ declare const adminModule: questpie181.QuestpieBuilder<questpie181.SetProperty<questpie181.SetProperty<{
396
+ name: "questpie-admin";
397
+ collections: questpie181.TypeMerge<questpie181.UnsetProperty<{}, keyof TOtherCollections>, {
398
+ assets: questpie181.CollectionBuilder<{
399
+ options: {
400
+ timestamps: true;
401
+ };
402
+ name: "assets";
403
+ fields: {
404
+ width: drizzle_orm_pg_core183.PgIntegerBuilder;
405
+ height: drizzle_orm_pg_core183.PgIntegerBuilder;
406
+ alt: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
407
+ caption: drizzle_orm_pg_core183.PgTextBuilder<[string, ...string[]]>;
408
+ } & {
409
+ key: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
410
+ filename: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
411
+ mimeType: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
412
+ size: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgIntegerBuilder>;
413
+ visibility: drizzle_orm94.HasDefault<drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<["public", "private"]>>>;
414
+ };
415
+ localized: [];
416
+ virtuals: undefined;
417
+ relations: Record<string, questpie181.RelationConfig>;
418
+ indexes: Record<string, any>;
419
+ title: "filename";
420
+ hooks: {
421
+ afterDelete: ({
422
+ data,
423
+ app
424
+ }: questpie181.HookContext<{
425
+ width: number | null;
426
+ height: number | null;
427
+ alt: string | null;
428
+ caption: string | null;
429
+ visibility: "public" | "private";
430
+ id: string;
431
+ key: string;
432
+ filename: string;
433
+ size: number;
434
+ mimeType: string;
435
+ createdAt: Date;
436
+ updatedAt: Date;
437
+ _title: string;
438
+ url: string;
439
+ }, never, "delete", any>) => Promise<void>;
440
+ };
441
+ access: questpie181.CollectionAccess<any, any>;
442
+ functions: {
443
+ [x: string]: questpie181.FunctionDefinition<any, any, any>;
444
+ };
445
+ searchable: undefined;
446
+ validation: undefined;
447
+ output: questpie181.TypeMerge<{}, {
448
+ url: string;
449
+ }>;
450
+ upload: questpie181.UploadOptions;
451
+ }>;
452
+ user: questpie181.CollectionBuilder<{
453
+ options: {
454
+ timestamps: true;
455
+ };
456
+ name: "user";
457
+ fields: {
458
+ name: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
459
+ email: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
460
+ emailVerified: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgBooleanBuilder>;
461
+ image: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
462
+ role: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
463
+ banned: drizzle_orm94.HasDefault<drizzle_orm_pg_core183.PgBooleanBuilder>;
464
+ banReason: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
465
+ banExpires: drizzle_orm_pg_core183.PgTimestampBuilder;
466
+ };
467
+ localized: [];
468
+ virtuals: undefined;
469
+ relations: Record<string, questpie181.RelationConfig>;
470
+ indexes: Record<string, any>;
471
+ title: "name";
472
+ hooks: questpie181.CollectionHooks<any, any, any, any>;
473
+ access: questpie181.CollectionAccess<any, any>;
474
+ functions: {
475
+ [x: string]: questpie181.FunctionDefinition<any, any, any>;
476
+ };
477
+ searchable: undefined;
478
+ validation: undefined;
479
+ output: undefined;
480
+ upload: undefined;
481
+ }>;
482
+ session: questpie181.CollectionBuilder<{
483
+ options: questpie181.CollectionOptions;
484
+ name: "session";
485
+ fields: {
486
+ userId: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
487
+ token: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
488
+ expiresAt: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgTimestampBuilder>;
489
+ ipAddress: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
490
+ userAgent: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
491
+ impersonatedBy: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
492
+ };
493
+ localized: [];
494
+ virtuals: undefined;
495
+ relations: Record<string, questpie181.RelationConfig>;
496
+ indexes: Record<string, any>;
497
+ title: "token";
498
+ hooks: questpie181.CollectionHooks<any, any, any, any>;
499
+ access: questpie181.CollectionAccess<any, any>;
500
+ functions: {
501
+ [x: string]: questpie181.FunctionDefinition<any, any, any>;
502
+ };
503
+ searchable: undefined;
504
+ validation: undefined;
505
+ output: undefined;
506
+ upload: undefined;
507
+ }>;
508
+ account: questpie181.CollectionBuilder<{
509
+ options: questpie181.CollectionOptions;
510
+ name: "account";
511
+ fields: {
512
+ userId: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
513
+ accountId: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
514
+ providerId: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
515
+ accessToken: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
516
+ refreshToken: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
517
+ accessTokenExpiresAt: drizzle_orm_pg_core183.PgTimestampBuilder;
518
+ refreshTokenExpiresAt: drizzle_orm_pg_core183.PgTimestampBuilder;
519
+ scope: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
520
+ idToken: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
521
+ password: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
522
+ };
523
+ localized: [];
524
+ virtuals: undefined;
525
+ relations: Record<string, questpie181.RelationConfig>;
526
+ indexes: Record<string, any>;
527
+ title: "providerId";
528
+ hooks: questpie181.CollectionHooks<any, any, any, any>;
529
+ access: questpie181.CollectionAccess<any, any>;
530
+ functions: {
531
+ [x: string]: questpie181.FunctionDefinition<any, any, any>;
532
+ };
533
+ searchable: undefined;
534
+ validation: undefined;
535
+ output: undefined;
536
+ upload: undefined;
537
+ }>;
538
+ verification: questpie181.CollectionBuilder<{
539
+ options: questpie181.CollectionOptions;
540
+ name: "verification";
541
+ fields: {
542
+ identifier: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
543
+ value: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
544
+ expiresAt: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgTimestampBuilder>;
545
+ };
546
+ localized: [];
547
+ virtuals: undefined;
548
+ relations: Record<string, questpie181.RelationConfig>;
549
+ indexes: Record<string, any>;
550
+ title: "identifier";
551
+ hooks: questpie181.CollectionHooks<any, any, any, any>;
552
+ access: questpie181.CollectionAccess<any, any>;
553
+ functions: {
554
+ [x: string]: questpie181.FunctionDefinition<any, any, any>;
555
+ };
556
+ searchable: undefined;
557
+ validation: undefined;
558
+ output: undefined;
559
+ upload: undefined;
560
+ }>;
561
+ apikey: questpie181.CollectionBuilder<{
562
+ options: {
563
+ timestamps: true;
564
+ };
565
+ name: "apikey";
566
+ fields: {
567
+ name: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
568
+ start: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
569
+ prefix: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
570
+ key: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
571
+ userId: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
572
+ refillInterval: drizzle_orm_pg_core183.PgIntegerBuilder;
573
+ refillAmount: drizzle_orm_pg_core183.PgIntegerBuilder;
574
+ lastRefillAt: drizzle_orm_pg_core183.PgTimestampBuilder;
575
+ enabled: drizzle_orm94.HasDefault<drizzle_orm_pg_core183.PgBooleanBuilder>;
576
+ rateLimitEnabled: drizzle_orm94.HasDefault<drizzle_orm_pg_core183.PgBooleanBuilder>;
577
+ rateLimitTimeWindow: drizzle_orm_pg_core183.PgIntegerBuilder;
578
+ rateLimitMax: drizzle_orm_pg_core183.PgIntegerBuilder;
579
+ requestCount: drizzle_orm94.HasDefault<drizzle_orm_pg_core183.PgIntegerBuilder>;
580
+ remaining: drizzle_orm_pg_core183.PgIntegerBuilder;
581
+ lastRequest: drizzle_orm_pg_core183.PgTimestampBuilder;
582
+ expiresAt: drizzle_orm_pg_core183.PgTimestampBuilder;
583
+ permissions: drizzle_orm_pg_core183.PgTextBuilder<[string, ...string[]]>;
584
+ metadata: drizzle_orm_pg_core183.PgTextBuilder<[string, ...string[]]>;
585
+ };
586
+ localized: [];
587
+ virtuals: undefined;
588
+ relations: Record<string, questpie181.RelationConfig>;
589
+ indexes: Record<string, any>;
590
+ title: "key";
591
+ hooks: questpie181.CollectionHooks<any, any, any, any>;
592
+ access: questpie181.CollectionAccess<any, any>;
593
+ functions: {
594
+ [x: string]: questpie181.FunctionDefinition<any, any, any>;
595
+ };
596
+ searchable: undefined;
597
+ validation: undefined;
598
+ output: undefined;
599
+ upload: undefined;
600
+ }>;
601
+ }>;
602
+ globals: questpie181.TypeMerge<questpie181.UnsetProperty<{}, keyof TOtherGlobals>, {}>;
603
+ jobs: questpie181.TypeMerge<questpie181.UnsetProperty<{}, keyof TOtherJobs>, {}>;
604
+ emailTemplates: questpie181.TypeMerge<questpie181.UnsetProperty<{}, keyof TOtherEmailTemplates>, {}>;
605
+ functions: questpie181.TypeMerge<questpie181.UnsetProperty<{}, keyof TOtherFunctions>, {}>;
606
+ auth: questpie181.MergeAuthOptions<{}, questpie181.MergeAuthOptions<{}, {
607
+ baseURL: string | undefined;
608
+ secret: string | undefined;
609
+ advanced: {
610
+ useSecureCookies: boolean;
611
+ };
612
+ plugins: [{
613
+ id: "admin";
614
+ init(): {
615
+ options: {
616
+ databaseHooks: {
617
+ user: {
618
+ create: {
619
+ before(user: {
620
+ id: string;
621
+ createdAt: Date;
622
+ updatedAt: Date;
623
+ email: string;
624
+ emailVerified: boolean;
625
+ name: string;
626
+ image?: string | null | undefined;
627
+ } & Record<string, unknown>): Promise<{
628
+ data: {
629
+ id: string;
630
+ createdAt: Date;
631
+ updatedAt: Date;
632
+ email: string;
633
+ emailVerified: boolean;
634
+ name: string;
635
+ image?: string | null | undefined;
636
+ role: string;
637
+ };
638
+ }>;
639
+ };
640
+ };
641
+ session: {
642
+ create: {
643
+ before(session: {
644
+ id: string;
645
+ createdAt: Date;
646
+ updatedAt: Date;
647
+ userId: string;
648
+ expiresAt: Date;
649
+ token: string;
650
+ ipAddress?: string | null | undefined;
651
+ userAgent?: string | null | undefined;
652
+ } & Record<string, unknown>, ctx: better_auth0.GenericEndpointContext | null): Promise<void>;
653
+ };
654
+ };
655
+ };
656
+ };
657
+ };
658
+ hooks: {
659
+ after: {
660
+ matcher(context: better_auth0.HookEndpointContext): boolean;
661
+ handler: (inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<better_auth_plugins0.SessionWithImpersonatedBy[] | undefined>;
662
+ }[];
663
+ };
664
+ endpoints: {
665
+ setRole: better_call0.StrictEndpoint<"/admin/set-role", {
666
+ method: "POST";
667
+ body: zod0.ZodObject<{
668
+ userId: zod0.ZodCoercedString<unknown>;
669
+ role: zod0.ZodUnion<readonly [zod0.ZodString, zod0.ZodArray<zod0.ZodString>]>;
670
+ }, better_auth0.$strip>;
671
+ requireHeaders: true;
672
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
673
+ session: {
674
+ user: better_auth_plugins0.UserWithRole;
675
+ session: better_auth0.Session;
676
+ };
677
+ }>)[];
678
+ metadata: {
679
+ openapi: {
680
+ operationId: string;
681
+ summary: string;
682
+ description: string;
683
+ responses: {
684
+ 200: {
685
+ description: string;
686
+ content: {
687
+ "application/json": {
688
+ schema: {
689
+ type: "object";
690
+ properties: {
691
+ user: {
692
+ $ref: string;
693
+ };
694
+ };
695
+ };
696
+ };
697
+ };
698
+ };
699
+ };
700
+ };
701
+ $Infer: {
702
+ body: {
703
+ userId: string;
704
+ role: "user" | "admin" | ("user" | "admin")[];
705
+ };
706
+ };
707
+ };
708
+ }, {
709
+ user: better_auth_plugins0.UserWithRole;
710
+ }>;
711
+ getUser: better_call0.StrictEndpoint<"/admin/get-user", {
712
+ method: "GET";
713
+ query: zod0.ZodObject<{
714
+ id: zod0.ZodString;
715
+ }, better_auth0.$strip>;
716
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
717
+ session: {
718
+ user: better_auth_plugins0.UserWithRole;
719
+ session: better_auth0.Session;
720
+ };
721
+ }>)[];
722
+ metadata: {
723
+ openapi: {
724
+ operationId: string;
725
+ summary: string;
726
+ description: string;
727
+ responses: {
728
+ 200: {
729
+ description: string;
730
+ content: {
731
+ "application/json": {
732
+ schema: {
733
+ type: "object";
734
+ properties: {
735
+ user: {
736
+ $ref: string;
737
+ };
738
+ };
739
+ };
740
+ };
741
+ };
742
+ };
743
+ };
744
+ };
745
+ };
746
+ }, better_auth_plugins0.UserWithRole>;
747
+ createUser: better_call0.StrictEndpoint<"/admin/create-user", {
748
+ method: "POST";
749
+ body: zod0.ZodObject<{
750
+ email: zod0.ZodString;
751
+ password: zod0.ZodOptional<zod0.ZodString>;
752
+ name: zod0.ZodString;
753
+ role: zod0.ZodOptional<zod0.ZodUnion<readonly [zod0.ZodString, zod0.ZodArray<zod0.ZodString>]>>;
754
+ data: zod0.ZodOptional<zod0.ZodRecord<zod0.ZodString, zod0.ZodAny>>;
755
+ }, better_auth0.$strip>;
756
+ metadata: {
757
+ openapi: {
758
+ operationId: string;
759
+ summary: string;
760
+ description: string;
761
+ responses: {
762
+ 200: {
763
+ description: string;
764
+ content: {
765
+ "application/json": {
766
+ schema: {
767
+ type: "object";
768
+ properties: {
769
+ user: {
770
+ $ref: string;
771
+ };
772
+ };
773
+ };
774
+ };
775
+ };
776
+ };
777
+ };
778
+ };
779
+ $Infer: {
780
+ body: {
781
+ email: string;
782
+ password?: string | undefined;
783
+ name: string;
784
+ role?: "user" | "admin" | ("user" | "admin")[] | undefined;
785
+ data?: Record<string, any> | undefined;
786
+ };
787
+ };
788
+ };
789
+ }, {
790
+ user: better_auth_plugins0.UserWithRole;
791
+ }>;
792
+ adminUpdateUser: better_call0.StrictEndpoint<"/admin/update-user", {
793
+ method: "POST";
794
+ body: zod0.ZodObject<{
795
+ userId: zod0.ZodCoercedString<unknown>;
796
+ data: zod0.ZodRecord<zod0.ZodAny, zod0.ZodAny>;
797
+ }, better_auth0.$strip>;
798
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
799
+ session: {
800
+ user: better_auth_plugins0.UserWithRole;
801
+ session: better_auth0.Session;
802
+ };
803
+ }>)[];
804
+ metadata: {
805
+ openapi: {
806
+ operationId: string;
807
+ summary: string;
808
+ description: string;
809
+ responses: {
810
+ 200: {
811
+ description: string;
812
+ content: {
813
+ "application/json": {
814
+ schema: {
815
+ type: "object";
816
+ properties: {
817
+ user: {
818
+ $ref: string;
819
+ };
820
+ };
821
+ };
822
+ };
823
+ };
824
+ };
825
+ };
826
+ };
827
+ };
828
+ }, better_auth_plugins0.UserWithRole>;
829
+ listUsers: better_call0.StrictEndpoint<"/admin/list-users", {
830
+ method: "GET";
831
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
832
+ session: {
833
+ user: better_auth_plugins0.UserWithRole;
834
+ session: better_auth0.Session;
835
+ };
836
+ }>)[];
837
+ query: zod0.ZodObject<{
838
+ searchValue: zod0.ZodOptional<zod0.ZodString>;
839
+ searchField: zod0.ZodOptional<zod0.ZodEnum<{
840
+ name: "name";
841
+ email: "email";
842
+ }>>;
843
+ searchOperator: zod0.ZodOptional<zod0.ZodEnum<{
844
+ contains: "contains";
845
+ starts_with: "starts_with";
846
+ ends_with: "ends_with";
847
+ }>>;
848
+ limit: zod0.ZodOptional<zod0.ZodUnion<[zod0.ZodString, zod0.ZodNumber]>>;
849
+ offset: zod0.ZodOptional<zod0.ZodUnion<[zod0.ZodString, zod0.ZodNumber]>>;
850
+ sortBy: zod0.ZodOptional<zod0.ZodString>;
851
+ sortDirection: zod0.ZodOptional<zod0.ZodEnum<{
852
+ asc: "asc";
853
+ desc: "desc";
854
+ }>>;
855
+ filterField: zod0.ZodOptional<zod0.ZodString>;
856
+ filterValue: zod0.ZodOptional<zod0.ZodUnion<[zod0.ZodUnion<[zod0.ZodString, zod0.ZodNumber]>, zod0.ZodBoolean]>>;
857
+ filterOperator: zod0.ZodOptional<zod0.ZodEnum<{
858
+ eq: "eq";
859
+ ne: "ne";
860
+ lt: "lt";
861
+ lte: "lte";
862
+ gt: "gt";
863
+ gte: "gte";
864
+ contains: "contains";
865
+ }>>;
866
+ }, better_auth0.$strip>;
867
+ metadata: {
868
+ openapi: {
869
+ operationId: string;
870
+ summary: string;
871
+ description: string;
872
+ responses: {
873
+ 200: {
874
+ description: string;
875
+ content: {
876
+ "application/json": {
877
+ schema: {
878
+ type: "object";
879
+ properties: {
880
+ users: {
881
+ type: string;
882
+ items: {
883
+ $ref: string;
884
+ };
885
+ };
886
+ total: {
887
+ type: string;
888
+ };
889
+ limit: {
890
+ type: string;
891
+ };
892
+ offset: {
893
+ type: string;
894
+ };
895
+ };
896
+ required: string[];
897
+ };
898
+ };
899
+ };
900
+ };
901
+ };
902
+ };
903
+ };
904
+ }, {
905
+ users: better_auth_plugins0.UserWithRole[];
906
+ total: number;
907
+ limit: number | undefined;
908
+ offset: number | undefined;
909
+ } | {
910
+ users: never[];
911
+ total: number;
912
+ }>;
913
+ listUserSessions: better_call0.StrictEndpoint<"/admin/list-user-sessions", {
914
+ method: "POST";
915
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
916
+ session: {
917
+ user: better_auth_plugins0.UserWithRole;
918
+ session: better_auth0.Session;
919
+ };
920
+ }>)[];
921
+ body: zod0.ZodObject<{
922
+ userId: zod0.ZodCoercedString<unknown>;
923
+ }, better_auth0.$strip>;
924
+ metadata: {
925
+ openapi: {
926
+ operationId: string;
927
+ summary: string;
928
+ description: string;
929
+ responses: {
930
+ 200: {
931
+ description: string;
932
+ content: {
933
+ "application/json": {
934
+ schema: {
935
+ type: "object";
936
+ properties: {
937
+ sessions: {
938
+ type: string;
939
+ items: {
940
+ $ref: string;
941
+ };
942
+ };
943
+ };
944
+ };
945
+ };
946
+ };
947
+ };
948
+ };
949
+ };
950
+ };
951
+ }, {
952
+ sessions: better_auth_plugins0.SessionWithImpersonatedBy[];
953
+ }>;
954
+ unbanUser: better_call0.StrictEndpoint<"/admin/unban-user", {
955
+ method: "POST";
956
+ body: zod0.ZodObject<{
957
+ userId: zod0.ZodCoercedString<unknown>;
958
+ }, better_auth0.$strip>;
959
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
960
+ session: {
961
+ user: better_auth_plugins0.UserWithRole;
962
+ session: better_auth0.Session;
963
+ };
964
+ }>)[];
965
+ metadata: {
966
+ openapi: {
967
+ operationId: string;
968
+ summary: string;
969
+ description: string;
970
+ responses: {
971
+ 200: {
972
+ description: string;
973
+ content: {
974
+ "application/json": {
975
+ schema: {
976
+ type: "object";
977
+ properties: {
978
+ user: {
979
+ $ref: string;
980
+ };
981
+ };
982
+ };
983
+ };
984
+ };
985
+ };
986
+ };
987
+ };
988
+ };
989
+ }, {
990
+ user: better_auth_plugins0.UserWithRole;
991
+ }>;
992
+ banUser: better_call0.StrictEndpoint<"/admin/ban-user", {
993
+ method: "POST";
994
+ body: zod0.ZodObject<{
995
+ userId: zod0.ZodCoercedString<unknown>;
996
+ banReason: zod0.ZodOptional<zod0.ZodString>;
997
+ banExpiresIn: zod0.ZodOptional<zod0.ZodNumber>;
998
+ }, better_auth0.$strip>;
999
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
1000
+ session: {
1001
+ user: better_auth_plugins0.UserWithRole;
1002
+ session: better_auth0.Session;
1003
+ };
1004
+ }>)[];
1005
+ metadata: {
1006
+ openapi: {
1007
+ operationId: string;
1008
+ summary: string;
1009
+ description: string;
1010
+ responses: {
1011
+ 200: {
1012
+ description: string;
1013
+ content: {
1014
+ "application/json": {
1015
+ schema: {
1016
+ type: "object";
1017
+ properties: {
1018
+ user: {
1019
+ $ref: string;
1020
+ };
1021
+ };
1022
+ };
1023
+ };
1024
+ };
1025
+ };
1026
+ };
1027
+ };
1028
+ };
1029
+ }, {
1030
+ user: better_auth_plugins0.UserWithRole;
1031
+ }>;
1032
+ impersonateUser: better_call0.StrictEndpoint<"/admin/impersonate-user", {
1033
+ method: "POST";
1034
+ body: zod0.ZodObject<{
1035
+ userId: zod0.ZodCoercedString<unknown>;
1036
+ }, better_auth0.$strip>;
1037
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
1038
+ session: {
1039
+ user: better_auth_plugins0.UserWithRole;
1040
+ session: better_auth0.Session;
1041
+ };
1042
+ }>)[];
1043
+ metadata: {
1044
+ openapi: {
1045
+ operationId: string;
1046
+ summary: string;
1047
+ description: string;
1048
+ responses: {
1049
+ 200: {
1050
+ description: string;
1051
+ content: {
1052
+ "application/json": {
1053
+ schema: {
1054
+ type: "object";
1055
+ properties: {
1056
+ session: {
1057
+ $ref: string;
1058
+ };
1059
+ user: {
1060
+ $ref: string;
1061
+ };
1062
+ };
1063
+ };
1064
+ };
1065
+ };
1066
+ };
1067
+ };
1068
+ };
1069
+ };
1070
+ }, {
1071
+ session: {
1072
+ id: string;
1073
+ createdAt: Date;
1074
+ updatedAt: Date;
1075
+ userId: string;
1076
+ expiresAt: Date;
1077
+ token: string;
1078
+ ipAddress?: string | null | undefined;
1079
+ userAgent?: string | null | undefined;
1080
+ };
1081
+ user: better_auth_plugins0.UserWithRole;
1082
+ }>;
1083
+ stopImpersonating: better_call0.StrictEndpoint<"/admin/stop-impersonating", {
1084
+ method: "POST";
1085
+ requireHeaders: true;
1086
+ }, {
1087
+ session: {
1088
+ id: string;
1089
+ createdAt: Date;
1090
+ updatedAt: Date;
1091
+ userId: string;
1092
+ expiresAt: Date;
1093
+ token: string;
1094
+ ipAddress?: string | null | undefined;
1095
+ userAgent?: string | null | undefined;
1096
+ } & Record<string, any>;
1097
+ user: {
1098
+ id: string;
1099
+ createdAt: Date;
1100
+ updatedAt: Date;
1101
+ email: string;
1102
+ emailVerified: boolean;
1103
+ name: string;
1104
+ image?: string | null | undefined;
1105
+ } & Record<string, any>;
1106
+ }>;
1107
+ revokeUserSession: better_call0.StrictEndpoint<"/admin/revoke-user-session", {
1108
+ method: "POST";
1109
+ body: zod0.ZodObject<{
1110
+ sessionToken: zod0.ZodString;
1111
+ }, better_auth0.$strip>;
1112
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
1113
+ session: {
1114
+ user: better_auth_plugins0.UserWithRole;
1115
+ session: better_auth0.Session;
1116
+ };
1117
+ }>)[];
1118
+ metadata: {
1119
+ openapi: {
1120
+ operationId: string;
1121
+ summary: string;
1122
+ description: string;
1123
+ responses: {
1124
+ 200: {
1125
+ description: string;
1126
+ content: {
1127
+ "application/json": {
1128
+ schema: {
1129
+ type: "object";
1130
+ properties: {
1131
+ success: {
1132
+ type: string;
1133
+ };
1134
+ };
1135
+ };
1136
+ };
1137
+ };
1138
+ };
1139
+ };
1140
+ };
1141
+ };
1142
+ }, {
1143
+ success: boolean;
1144
+ }>;
1145
+ revokeUserSessions: better_call0.StrictEndpoint<"/admin/revoke-user-sessions", {
1146
+ method: "POST";
1147
+ body: zod0.ZodObject<{
1148
+ userId: zod0.ZodCoercedString<unknown>;
1149
+ }, better_auth0.$strip>;
1150
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
1151
+ session: {
1152
+ user: better_auth_plugins0.UserWithRole;
1153
+ session: better_auth0.Session;
1154
+ };
1155
+ }>)[];
1156
+ metadata: {
1157
+ openapi: {
1158
+ operationId: string;
1159
+ summary: string;
1160
+ description: string;
1161
+ responses: {
1162
+ 200: {
1163
+ description: string;
1164
+ content: {
1165
+ "application/json": {
1166
+ schema: {
1167
+ type: "object";
1168
+ properties: {
1169
+ success: {
1170
+ type: string;
1171
+ };
1172
+ };
1173
+ };
1174
+ };
1175
+ };
1176
+ };
1177
+ };
1178
+ };
1179
+ };
1180
+ }, {
1181
+ success: boolean;
1182
+ }>;
1183
+ removeUser: better_call0.StrictEndpoint<"/admin/remove-user", {
1184
+ method: "POST";
1185
+ body: zod0.ZodObject<{
1186
+ userId: zod0.ZodCoercedString<unknown>;
1187
+ }, better_auth0.$strip>;
1188
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
1189
+ session: {
1190
+ user: better_auth_plugins0.UserWithRole;
1191
+ session: better_auth0.Session;
1192
+ };
1193
+ }>)[];
1194
+ metadata: {
1195
+ openapi: {
1196
+ operationId: string;
1197
+ summary: string;
1198
+ description: string;
1199
+ responses: {
1200
+ 200: {
1201
+ description: string;
1202
+ content: {
1203
+ "application/json": {
1204
+ schema: {
1205
+ type: "object";
1206
+ properties: {
1207
+ success: {
1208
+ type: string;
1209
+ };
1210
+ };
1211
+ };
1212
+ };
1213
+ };
1214
+ };
1215
+ };
1216
+ };
1217
+ };
1218
+ }, {
1219
+ success: boolean;
1220
+ }>;
1221
+ setUserPassword: better_call0.StrictEndpoint<"/admin/set-user-password", {
1222
+ method: "POST";
1223
+ body: zod0.ZodObject<{
1224
+ newPassword: zod0.ZodString;
1225
+ userId: zod0.ZodCoercedString<unknown>;
1226
+ }, better_auth0.$strip>;
1227
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
1228
+ session: {
1229
+ user: better_auth_plugins0.UserWithRole;
1230
+ session: better_auth0.Session;
1231
+ };
1232
+ }>)[];
1233
+ metadata: {
1234
+ openapi: {
1235
+ operationId: string;
1236
+ summary: string;
1237
+ description: string;
1238
+ responses: {
1239
+ 200: {
1240
+ description: string;
1241
+ content: {
1242
+ "application/json": {
1243
+ schema: {
1244
+ type: "object";
1245
+ properties: {
1246
+ status: {
1247
+ type: string;
1248
+ };
1249
+ };
1250
+ };
1251
+ };
1252
+ };
1253
+ };
1254
+ };
1255
+ };
1256
+ };
1257
+ }, {
1258
+ status: boolean;
1259
+ }>;
1260
+ userHasPermission: better_call0.StrictEndpoint<"/admin/has-permission", {
1261
+ method: "POST";
1262
+ body: zod0.ZodIntersection<zod0.ZodObject<{
1263
+ userId: zod0.ZodOptional<zod0.ZodCoercedString<unknown>>;
1264
+ role: zod0.ZodOptional<zod0.ZodString>;
1265
+ }, better_auth0.$strip>, zod0.ZodUnion<readonly [zod0.ZodObject<{
1266
+ permission: zod0.ZodRecord<zod0.ZodString, zod0.ZodArray<zod0.ZodString>>;
1267
+ permissions: zod0.ZodUndefined;
1268
+ }, better_auth0.$strip>, zod0.ZodObject<{
1269
+ permission: zod0.ZodUndefined;
1270
+ permissions: zod0.ZodRecord<zod0.ZodString, zod0.ZodArray<zod0.ZodString>>;
1271
+ }, better_auth0.$strip>]>>;
1272
+ metadata: {
1273
+ openapi: {
1274
+ description: string;
1275
+ requestBody: {
1276
+ content: {
1277
+ "application/json": {
1278
+ schema: {
1279
+ type: "object";
1280
+ properties: {
1281
+ permission: {
1282
+ type: string;
1283
+ description: string;
1284
+ deprecated: boolean;
1285
+ };
1286
+ permissions: {
1287
+ type: string;
1288
+ description: string;
1289
+ };
1290
+ };
1291
+ required: string[];
1292
+ };
1293
+ };
1294
+ };
1295
+ };
1296
+ responses: {
1297
+ "200": {
1298
+ description: string;
1299
+ content: {
1300
+ "application/json": {
1301
+ schema: {
1302
+ type: "object";
1303
+ properties: {
1304
+ error: {
1305
+ type: string;
1306
+ };
1307
+ success: {
1308
+ type: string;
1309
+ };
1310
+ };
1311
+ required: string[];
1312
+ };
1313
+ };
1314
+ };
1315
+ };
1316
+ };
1317
+ };
1318
+ $Infer: {
1319
+ body: ({
1320
+ permission: {
1321
+ readonly user?: ("delete" | "set-role" | "create" | "get" | "update" | "list" | "ban" | "impersonate" | "set-password")[] | undefined;
1322
+ readonly session?: ("delete" | "list" | "revoke")[] | undefined;
1323
+ };
1324
+ permissions?: never | undefined;
1325
+ } | {
1326
+ permissions: {
1327
+ readonly user?: ("delete" | "set-role" | "create" | "get" | "update" | "list" | "ban" | "impersonate" | "set-password")[] | undefined;
1328
+ readonly session?: ("delete" | "list" | "revoke")[] | undefined;
1329
+ };
1330
+ permission?: never | undefined;
1331
+ }) & {
1332
+ userId?: string | undefined;
1333
+ role?: "user" | "admin" | undefined;
1334
+ };
1335
+ };
1336
+ };
1337
+ }, {
1338
+ error: null;
1339
+ success: boolean;
1340
+ }>;
1341
+ };
1342
+ $ERROR_CODES: {
1343
+ readonly FAILED_TO_CREATE_USER: "Failed to create user";
1344
+ readonly USER_ALREADY_EXISTS: "User already exists.";
1345
+ readonly USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL: "User already exists. Use another email.";
1346
+ readonly YOU_CANNOT_BAN_YOURSELF: "You cannot ban yourself";
1347
+ readonly YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE: "You are not allowed to change users role";
1348
+ readonly YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS: "You are not allowed to create users";
1349
+ readonly YOU_ARE_NOT_ALLOWED_TO_LIST_USERS: "You are not allowed to list users";
1350
+ readonly YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS: "You are not allowed to list users sessions";
1351
+ readonly YOU_ARE_NOT_ALLOWED_TO_BAN_USERS: "You are not allowed to ban users";
1352
+ readonly YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS: "You are not allowed to impersonate users";
1353
+ readonly YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS: "You are not allowed to revoke users sessions";
1354
+ readonly YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS: "You are not allowed to delete users";
1355
+ readonly YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD: "You are not allowed to set users password";
1356
+ readonly BANNED_USER: "You have been banned from this application";
1357
+ readonly YOU_ARE_NOT_ALLOWED_TO_GET_USER: "You are not allowed to get user";
1358
+ readonly NO_DATA_TO_UPDATE: "No data to update";
1359
+ readonly YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS: "You are not allowed to update users";
1360
+ readonly YOU_CANNOT_REMOVE_YOURSELF: "You cannot remove yourself";
1361
+ readonly YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE: "You are not allowed to set a non-existent role value";
1362
+ readonly YOU_CANNOT_IMPERSONATE_ADMINS: "You cannot impersonate admins";
1363
+ readonly INVALID_ROLE_TYPE: "Invalid role type";
1364
+ };
1365
+ schema: {
1366
+ user: {
1367
+ fields: {
1368
+ role: {
1369
+ type: "string";
1370
+ required: false;
1371
+ input: false;
1372
+ };
1373
+ banned: {
1374
+ type: "boolean";
1375
+ defaultValue: false;
1376
+ required: false;
1377
+ input: false;
1378
+ };
1379
+ banReason: {
1380
+ type: "string";
1381
+ required: false;
1382
+ input: false;
1383
+ };
1384
+ banExpires: {
1385
+ type: "date";
1386
+ required: false;
1387
+ input: false;
1388
+ };
1389
+ };
1390
+ };
1391
+ session: {
1392
+ fields: {
1393
+ impersonatedBy: {
1394
+ type: "string";
1395
+ required: false;
1396
+ };
1397
+ };
1398
+ };
1399
+ };
1400
+ options: NoInfer<better_auth_plugins0.AdminOptions>;
1401
+ }, {
1402
+ id: "api-key";
1403
+ $ERROR_CODES: {
1404
+ readonly INVALID_METADATA_TYPE: "metadata must be an object or undefined";
1405
+ readonly REFILL_AMOUNT_AND_INTERVAL_REQUIRED: "refillAmount is required when refillInterval is provided";
1406
+ readonly REFILL_INTERVAL_AND_AMOUNT_REQUIRED: "refillInterval is required when refillAmount is provided";
1407
+ readonly USER_BANNED: "User is banned";
1408
+ readonly UNAUTHORIZED_SESSION: "Unauthorized or invalid session";
1409
+ readonly KEY_NOT_FOUND: "API Key not found";
1410
+ readonly KEY_DISABLED: "API Key is disabled";
1411
+ readonly KEY_EXPIRED: "API Key has expired";
1412
+ readonly USAGE_EXCEEDED: "API Key has reached its usage limit";
1413
+ readonly KEY_NOT_RECOVERABLE: "API Key is not recoverable";
1414
+ readonly EXPIRES_IN_IS_TOO_SMALL: "The expiresIn is smaller than the predefined minimum value.";
1415
+ readonly EXPIRES_IN_IS_TOO_LARGE: "The expiresIn is larger than the predefined maximum value.";
1416
+ readonly INVALID_REMAINING: "The remaining count is either too large or too small.";
1417
+ readonly INVALID_PREFIX_LENGTH: "The prefix length is either too large or too small.";
1418
+ readonly INVALID_NAME_LENGTH: "The name length is either too large or too small.";
1419
+ readonly METADATA_DISABLED: "Metadata is disabled.";
1420
+ readonly RATE_LIMIT_EXCEEDED: "Rate limit exceeded.";
1421
+ readonly NO_VALUES_TO_UPDATE: "No values to update.";
1422
+ readonly KEY_DISABLED_EXPIRATION: "Custom key expiration values are disabled.";
1423
+ readonly INVALID_API_KEY: "Invalid API key.";
1424
+ readonly INVALID_USER_ID_FROM_API_KEY: "The user id from the API key is invalid.";
1425
+ readonly INVALID_API_KEY_GETTER_RETURN_TYPE: "API Key getter returned an invalid key type. Expected string.";
1426
+ readonly SERVER_ONLY_PROPERTY: "The property you're trying to set can only be set from the server auth instance only.";
1427
+ readonly FAILED_TO_UPDATE_API_KEY: "Failed to update API key";
1428
+ readonly NAME_REQUIRED: "API Key name is required.";
1429
+ };
1430
+ hooks: {
1431
+ before: {
1432
+ matcher: (ctx: better_auth0.HookEndpointContext) => boolean;
1433
+ handler: (inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
1434
+ user: {
1435
+ id: string;
1436
+ createdAt: Date;
1437
+ updatedAt: Date;
1438
+ email: string;
1439
+ emailVerified: boolean;
1440
+ name: string;
1441
+ image?: string | null | undefined;
1442
+ };
1443
+ session: {
1444
+ id: string;
1445
+ token: string;
1446
+ userId: string;
1447
+ userAgent: string | null;
1448
+ ipAddress: string | null;
1449
+ createdAt: Date;
1450
+ updatedAt: Date;
1451
+ expiresAt: Date;
1452
+ };
1453
+ } | {
1454
+ context: better_call0.MiddlewareContext<better_call0.MiddlewareOptions, {
1455
+ returned?: unknown | undefined;
1456
+ responseHeaders?: Headers | undefined;
1457
+ } & better_auth0.PluginContext & better_auth0.InfoContext & {
1458
+ options: better_auth0.BetterAuthOptions;
1459
+ trustedOrigins: string[];
1460
+ isTrustedOrigin: (url: string, settings?: {
1461
+ allowRelativePaths: boolean;
1462
+ }) => boolean;
1463
+ oauthConfig: {
1464
+ skipStateCookieCheck?: boolean | undefined;
1465
+ storeStateStrategy: "database" | "cookie";
1466
+ };
1467
+ newSession: {
1468
+ session: better_auth0.Session & Record<string, any>;
1469
+ user: better_auth0.User & Record<string, any>;
1470
+ } | null;
1471
+ session: {
1472
+ session: better_auth0.Session & Record<string, any>;
1473
+ user: better_auth0.User & Record<string, any>;
1474
+ } | null;
1475
+ setNewSession: (session: {
1476
+ session: better_auth0.Session & Record<string, any>;
1477
+ user: better_auth0.User & Record<string, any>;
1478
+ } | null) => void;
1479
+ socialProviders: better_auth0.OAuthProvider[];
1480
+ authCookies: better_auth0.BetterAuthCookies;
1481
+ logger: ReturnType<(options?: better_auth0.Logger | undefined) => better_auth0.InternalLogger>;
1482
+ rateLimit: {
1483
+ enabled: boolean;
1484
+ window: number;
1485
+ max: number;
1486
+ storage: "memory" | "database" | "secondary-storage";
1487
+ } & Omit<better_auth0.BetterAuthRateLimitOptions, "enabled" | "window" | "max" | "storage">;
1488
+ adapter: better_auth0.DBAdapter<better_auth0.BetterAuthOptions>;
1489
+ internalAdapter: better_auth0.InternalAdapter<better_auth0.BetterAuthOptions>;
1490
+ createAuthCookie: (cookieName: string, overrideAttributes?: Partial<better_call0.CookieOptions> | undefined) => better_auth0.BetterAuthCookie;
1491
+ secret: string;
1492
+ sessionConfig: {
1493
+ updateAge: number;
1494
+ expiresIn: number;
1495
+ freshAge: number;
1496
+ cookieRefreshCache: false | {
1497
+ enabled: true;
1498
+ updateAge: number;
1499
+ };
1500
+ };
1501
+ generateId: (options: {
1502
+ model: better_auth0.ModelNames;
1503
+ size?: number | undefined;
1504
+ }) => string | false;
1505
+ secondaryStorage: better_auth0.SecondaryStorage | undefined;
1506
+ password: {
1507
+ hash: (password: string) => Promise<string>;
1508
+ verify: (data: {
1509
+ password: string;
1510
+ hash: string;
1511
+ }) => Promise<boolean>;
1512
+ config: {
1513
+ minPasswordLength: number;
1514
+ maxPasswordLength: number;
1515
+ };
1516
+ checkPassword: (userId: string, ctx: better_auth0.GenericEndpointContext<better_auth0.BetterAuthOptions>) => Promise<boolean>;
1517
+ };
1518
+ tables: better_auth0.BetterAuthDBSchema;
1519
+ runMigrations: () => Promise<void>;
1520
+ publishTelemetry: (event: {
1521
+ type: string;
1522
+ anonymousId?: string | undefined;
1523
+ payload: Record<string, any>;
1524
+ }) => Promise<void>;
1525
+ skipOriginCheck: boolean | string[];
1526
+ skipCSRFCheck: boolean;
1527
+ runInBackground: (promise: Promise<void>) => void;
1528
+ runInBackgroundOrAwait: (promise: Promise<unknown> | Promise<void> | void | unknown) => Promise<unknown>;
1529
+ }>;
1530
+ }>;
1531
+ }[];
1532
+ };
1533
+ endpoints: {
1534
+ createApiKey: better_call0.StrictEndpoint<"/api-key/create", {
1535
+ method: "POST";
1536
+ body: zod0.ZodObject<{
1537
+ name: zod0.ZodOptional<zod0.ZodString>;
1538
+ expiresIn: zod0.ZodDefault<zod0.ZodNullable<zod0.ZodOptional<zod0.ZodNumber>>>;
1539
+ userId: zod0.ZodOptional<zod0.ZodCoercedString<unknown>>;
1540
+ prefix: zod0.ZodOptional<zod0.ZodString>;
1541
+ remaining: zod0.ZodDefault<zod0.ZodNullable<zod0.ZodOptional<zod0.ZodNumber>>>;
1542
+ metadata: zod0.ZodOptional<zod0.ZodAny>;
1543
+ refillAmount: zod0.ZodOptional<zod0.ZodNumber>;
1544
+ refillInterval: zod0.ZodOptional<zod0.ZodNumber>;
1545
+ rateLimitTimeWindow: zod0.ZodOptional<zod0.ZodNumber>;
1546
+ rateLimitMax: zod0.ZodOptional<zod0.ZodNumber>;
1547
+ rateLimitEnabled: zod0.ZodOptional<zod0.ZodBoolean>;
1548
+ permissions: zod0.ZodOptional<zod0.ZodRecord<zod0.ZodString, zod0.ZodArray<zod0.ZodString>>>;
1549
+ }, better_auth0.$strip>;
1550
+ metadata: {
1551
+ openapi: {
1552
+ description: string;
1553
+ responses: {
1554
+ "200": {
1555
+ description: string;
1556
+ content: {
1557
+ "application/json": {
1558
+ schema: {
1559
+ type: "object";
1560
+ properties: {
1561
+ id: {
1562
+ type: string;
1563
+ description: string;
1564
+ };
1565
+ createdAt: {
1566
+ type: string;
1567
+ format: string;
1568
+ description: string;
1569
+ };
1570
+ updatedAt: {
1571
+ type: string;
1572
+ format: string;
1573
+ description: string;
1574
+ };
1575
+ name: {
1576
+ type: string;
1577
+ nullable: boolean;
1578
+ description: string;
1579
+ };
1580
+ prefix: {
1581
+ type: string;
1582
+ nullable: boolean;
1583
+ description: string;
1584
+ };
1585
+ start: {
1586
+ type: string;
1587
+ nullable: boolean;
1588
+ description: string;
1589
+ };
1590
+ key: {
1591
+ type: string;
1592
+ description: string;
1593
+ };
1594
+ enabled: {
1595
+ type: string;
1596
+ description: string;
1597
+ };
1598
+ expiresAt: {
1599
+ type: string;
1600
+ format: string;
1601
+ nullable: boolean;
1602
+ description: string;
1603
+ };
1604
+ userId: {
1605
+ type: string;
1606
+ description: string;
1607
+ };
1608
+ lastRefillAt: {
1609
+ type: string;
1610
+ format: string;
1611
+ nullable: boolean;
1612
+ description: string;
1613
+ };
1614
+ lastRequest: {
1615
+ type: string;
1616
+ format: string;
1617
+ nullable: boolean;
1618
+ description: string;
1619
+ };
1620
+ metadata: {
1621
+ type: string;
1622
+ nullable: boolean;
1623
+ additionalProperties: boolean;
1624
+ description: string;
1625
+ };
1626
+ rateLimitMax: {
1627
+ type: string;
1628
+ nullable: boolean;
1629
+ description: string;
1630
+ };
1631
+ rateLimitTimeWindow: {
1632
+ type: string;
1633
+ nullable: boolean;
1634
+ description: string;
1635
+ };
1636
+ remaining: {
1637
+ type: string;
1638
+ nullable: boolean;
1639
+ description: string;
1640
+ };
1641
+ refillAmount: {
1642
+ type: string;
1643
+ nullable: boolean;
1644
+ description: string;
1645
+ };
1646
+ refillInterval: {
1647
+ type: string;
1648
+ nullable: boolean;
1649
+ description: string;
1650
+ };
1651
+ rateLimitEnabled: {
1652
+ type: string;
1653
+ description: string;
1654
+ };
1655
+ requestCount: {
1656
+ type: string;
1657
+ description: string;
1658
+ };
1659
+ permissions: {
1660
+ type: string;
1661
+ nullable: boolean;
1662
+ additionalProperties: {
1663
+ type: string;
1664
+ items: {
1665
+ type: string;
1666
+ };
1667
+ };
1668
+ description: string;
1669
+ };
1670
+ };
1671
+ required: string[];
1672
+ };
1673
+ };
1674
+ };
1675
+ };
1676
+ };
1677
+ };
1678
+ };
1679
+ }, {
1680
+ key: string;
1681
+ metadata: any;
1682
+ permissions: any;
1683
+ id: string;
1684
+ name: string | null;
1685
+ start: string | null;
1686
+ prefix: string | null;
1687
+ userId: string;
1688
+ refillInterval: number | null;
1689
+ refillAmount: number | null;
1690
+ lastRefillAt: Date | null;
1691
+ enabled: boolean;
1692
+ rateLimitEnabled: boolean;
1693
+ rateLimitTimeWindow: number | null;
1694
+ rateLimitMax: number | null;
1695
+ requestCount: number;
1696
+ remaining: number | null;
1697
+ lastRequest: Date | null;
1698
+ expiresAt: Date | null;
1699
+ createdAt: Date;
1700
+ updatedAt: Date;
1701
+ }>;
1702
+ verifyApiKey: better_call0.StrictEndpoint<string, {
1703
+ method: "POST";
1704
+ body: zod0.ZodObject<{
1705
+ key: zod0.ZodString;
1706
+ permissions: zod0.ZodOptional<zod0.ZodRecord<zod0.ZodString, zod0.ZodArray<zod0.ZodString>>>;
1707
+ }, better_auth0.$strip>;
1708
+ }, {
1709
+ valid: boolean;
1710
+ error: {
1711
+ message: string | undefined;
1712
+ code: string;
1713
+ };
1714
+ key: null;
1715
+ } | {
1716
+ valid: boolean;
1717
+ error: null;
1718
+ key: Omit<better_auth_plugins0.ApiKey, "key"> | null;
1719
+ }>;
1720
+ getApiKey: better_call0.StrictEndpoint<"/api-key/get", {
1721
+ method: "GET";
1722
+ query: zod0.ZodObject<{
1723
+ id: zod0.ZodString;
1724
+ }, better_auth0.$strip>;
1725
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
1726
+ session: {
1727
+ session: Record<string, any> & {
1728
+ id: string;
1729
+ createdAt: Date;
1730
+ updatedAt: Date;
1731
+ userId: string;
1732
+ expiresAt: Date;
1733
+ token: string;
1734
+ ipAddress?: string | null | undefined;
1735
+ userAgent?: string | null | undefined;
1736
+ };
1737
+ user: Record<string, any> & {
1738
+ id: string;
1739
+ createdAt: Date;
1740
+ updatedAt: Date;
1741
+ email: string;
1742
+ emailVerified: boolean;
1743
+ name: string;
1744
+ image?: string | null | undefined;
1745
+ };
1746
+ };
1747
+ }>)[];
1748
+ metadata: {
1749
+ openapi: {
1750
+ description: string;
1751
+ responses: {
1752
+ "200": {
1753
+ description: string;
1754
+ content: {
1755
+ "application/json": {
1756
+ schema: {
1757
+ type: "object";
1758
+ properties: {
1759
+ id: {
1760
+ type: string;
1761
+ description: string;
1762
+ };
1763
+ name: {
1764
+ type: string;
1765
+ nullable: boolean;
1766
+ description: string;
1767
+ };
1768
+ start: {
1769
+ type: string;
1770
+ nullable: boolean;
1771
+ description: string;
1772
+ };
1773
+ prefix: {
1774
+ type: string;
1775
+ nullable: boolean;
1776
+ description: string;
1777
+ };
1778
+ userId: {
1779
+ type: string;
1780
+ description: string;
1781
+ };
1782
+ refillInterval: {
1783
+ type: string;
1784
+ nullable: boolean;
1785
+ description: string;
1786
+ };
1787
+ refillAmount: {
1788
+ type: string;
1789
+ nullable: boolean;
1790
+ description: string;
1791
+ };
1792
+ lastRefillAt: {
1793
+ type: string;
1794
+ format: string;
1795
+ nullable: boolean;
1796
+ description: string;
1797
+ };
1798
+ enabled: {
1799
+ type: string;
1800
+ description: string;
1801
+ default: boolean;
1802
+ };
1803
+ rateLimitEnabled: {
1804
+ type: string;
1805
+ description: string;
1806
+ };
1807
+ rateLimitTimeWindow: {
1808
+ type: string;
1809
+ nullable: boolean;
1810
+ description: string;
1811
+ };
1812
+ rateLimitMax: {
1813
+ type: string;
1814
+ nullable: boolean;
1815
+ description: string;
1816
+ };
1817
+ requestCount: {
1818
+ type: string;
1819
+ description: string;
1820
+ };
1821
+ remaining: {
1822
+ type: string;
1823
+ nullable: boolean;
1824
+ description: string;
1825
+ };
1826
+ lastRequest: {
1827
+ type: string;
1828
+ format: string;
1829
+ nullable: boolean;
1830
+ description: string;
1831
+ };
1832
+ expiresAt: {
1833
+ type: string;
1834
+ format: string;
1835
+ nullable: boolean;
1836
+ description: string;
1837
+ };
1838
+ createdAt: {
1839
+ type: string;
1840
+ format: string;
1841
+ description: string;
1842
+ };
1843
+ updatedAt: {
1844
+ type: string;
1845
+ format: string;
1846
+ description: string;
1847
+ };
1848
+ metadata: {
1849
+ type: string;
1850
+ nullable: boolean;
1851
+ additionalProperties: boolean;
1852
+ description: string;
1853
+ };
1854
+ permissions: {
1855
+ type: string;
1856
+ nullable: boolean;
1857
+ description: string;
1858
+ };
1859
+ };
1860
+ required: string[];
1861
+ };
1862
+ };
1863
+ };
1864
+ };
1865
+ };
1866
+ };
1867
+ };
1868
+ }, {
1869
+ metadata: Record<string, any> | null;
1870
+ permissions: {
1871
+ [key: string]: string[];
1872
+ } | null;
1873
+ id: string;
1874
+ name: string | null;
1875
+ start: string | null;
1876
+ prefix: string | null;
1877
+ userId: string;
1878
+ refillInterval: number | null;
1879
+ refillAmount: number | null;
1880
+ lastRefillAt: Date | null;
1881
+ enabled: boolean;
1882
+ rateLimitEnabled: boolean;
1883
+ rateLimitTimeWindow: number | null;
1884
+ rateLimitMax: number | null;
1885
+ requestCount: number;
1886
+ remaining: number | null;
1887
+ lastRequest: Date | null;
1888
+ expiresAt: Date | null;
1889
+ createdAt: Date;
1890
+ updatedAt: Date;
1891
+ }>;
1892
+ updateApiKey: better_call0.StrictEndpoint<"/api-key/update", {
1893
+ method: "POST";
1894
+ body: zod0.ZodObject<{
1895
+ keyId: zod0.ZodString;
1896
+ userId: zod0.ZodOptional<zod0.ZodCoercedString<unknown>>;
1897
+ name: zod0.ZodOptional<zod0.ZodString>;
1898
+ enabled: zod0.ZodOptional<zod0.ZodBoolean>;
1899
+ remaining: zod0.ZodOptional<zod0.ZodNumber>;
1900
+ refillAmount: zod0.ZodOptional<zod0.ZodNumber>;
1901
+ refillInterval: zod0.ZodOptional<zod0.ZodNumber>;
1902
+ metadata: zod0.ZodOptional<zod0.ZodAny>;
1903
+ expiresIn: zod0.ZodNullable<zod0.ZodOptional<zod0.ZodNumber>>;
1904
+ rateLimitEnabled: zod0.ZodOptional<zod0.ZodBoolean>;
1905
+ rateLimitTimeWindow: zod0.ZodOptional<zod0.ZodNumber>;
1906
+ rateLimitMax: zod0.ZodOptional<zod0.ZodNumber>;
1907
+ permissions: zod0.ZodNullable<zod0.ZodOptional<zod0.ZodRecord<zod0.ZodString, zod0.ZodArray<zod0.ZodString>>>>;
1908
+ }, better_auth0.$strip>;
1909
+ metadata: {
1910
+ openapi: {
1911
+ description: string;
1912
+ responses: {
1913
+ "200": {
1914
+ description: string;
1915
+ content: {
1916
+ "application/json": {
1917
+ schema: {
1918
+ type: "object";
1919
+ properties: {
1920
+ id: {
1921
+ type: string;
1922
+ description: string;
1923
+ };
1924
+ name: {
1925
+ type: string;
1926
+ nullable: boolean;
1927
+ description: string;
1928
+ };
1929
+ start: {
1930
+ type: string;
1931
+ nullable: boolean;
1932
+ description: string;
1933
+ };
1934
+ prefix: {
1935
+ type: string;
1936
+ nullable: boolean;
1937
+ description: string;
1938
+ };
1939
+ userId: {
1940
+ type: string;
1941
+ description: string;
1942
+ };
1943
+ refillInterval: {
1944
+ type: string;
1945
+ nullable: boolean;
1946
+ description: string;
1947
+ };
1948
+ refillAmount: {
1949
+ type: string;
1950
+ nullable: boolean;
1951
+ description: string;
1952
+ };
1953
+ lastRefillAt: {
1954
+ type: string;
1955
+ format: string;
1956
+ nullable: boolean;
1957
+ description: string;
1958
+ };
1959
+ enabled: {
1960
+ type: string;
1961
+ description: string;
1962
+ default: boolean;
1963
+ };
1964
+ rateLimitEnabled: {
1965
+ type: string;
1966
+ description: string;
1967
+ };
1968
+ rateLimitTimeWindow: {
1969
+ type: string;
1970
+ nullable: boolean;
1971
+ description: string;
1972
+ };
1973
+ rateLimitMax: {
1974
+ type: string;
1975
+ nullable: boolean;
1976
+ description: string;
1977
+ };
1978
+ requestCount: {
1979
+ type: string;
1980
+ description: string;
1981
+ };
1982
+ remaining: {
1983
+ type: string;
1984
+ nullable: boolean;
1985
+ description: string;
1986
+ };
1987
+ lastRequest: {
1988
+ type: string;
1989
+ format: string;
1990
+ nullable: boolean;
1991
+ description: string;
1992
+ };
1993
+ expiresAt: {
1994
+ type: string;
1995
+ format: string;
1996
+ nullable: boolean;
1997
+ description: string;
1998
+ };
1999
+ createdAt: {
2000
+ type: string;
2001
+ format: string;
2002
+ description: string;
2003
+ };
2004
+ updatedAt: {
2005
+ type: string;
2006
+ format: string;
2007
+ description: string;
2008
+ };
2009
+ metadata: {
2010
+ type: string;
2011
+ nullable: boolean;
2012
+ additionalProperties: boolean;
2013
+ description: string;
2014
+ };
2015
+ permissions: {
2016
+ type: string;
2017
+ nullable: boolean;
2018
+ description: string;
2019
+ };
2020
+ };
2021
+ required: string[];
2022
+ };
2023
+ };
2024
+ };
2025
+ };
2026
+ };
2027
+ };
2028
+ };
2029
+ }, {
2030
+ metadata: Record<string, any> | null;
2031
+ permissions: {
2032
+ [key: string]: string[];
2033
+ } | null;
2034
+ id: string;
2035
+ name: string | null;
2036
+ start: string | null;
2037
+ prefix: string | null;
2038
+ userId: string;
2039
+ refillInterval: number | null;
2040
+ refillAmount: number | null;
2041
+ lastRefillAt: Date | null;
2042
+ enabled: boolean;
2043
+ rateLimitEnabled: boolean;
2044
+ rateLimitTimeWindow: number | null;
2045
+ rateLimitMax: number | null;
2046
+ requestCount: number;
2047
+ remaining: number | null;
2048
+ lastRequest: Date | null;
2049
+ expiresAt: Date | null;
2050
+ createdAt: Date;
2051
+ updatedAt: Date;
2052
+ }>;
2053
+ deleteApiKey: better_call0.StrictEndpoint<"/api-key/delete", {
2054
+ method: "POST";
2055
+ body: zod0.ZodObject<{
2056
+ keyId: zod0.ZodString;
2057
+ }, better_auth0.$strip>;
2058
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
2059
+ session: {
2060
+ session: Record<string, any> & {
2061
+ id: string;
2062
+ createdAt: Date;
2063
+ updatedAt: Date;
2064
+ userId: string;
2065
+ expiresAt: Date;
2066
+ token: string;
2067
+ ipAddress?: string | null | undefined;
2068
+ userAgent?: string | null | undefined;
2069
+ };
2070
+ user: Record<string, any> & {
2071
+ id: string;
2072
+ createdAt: Date;
2073
+ updatedAt: Date;
2074
+ email: string;
2075
+ emailVerified: boolean;
2076
+ name: string;
2077
+ image?: string | null | undefined;
2078
+ };
2079
+ };
2080
+ }>)[];
2081
+ metadata: {
2082
+ openapi: {
2083
+ description: string;
2084
+ requestBody: {
2085
+ content: {
2086
+ "application/json": {
2087
+ schema: {
2088
+ type: "object";
2089
+ properties: {
2090
+ keyId: {
2091
+ type: string;
2092
+ description: string;
2093
+ };
2094
+ };
2095
+ required: string[];
2096
+ };
2097
+ };
2098
+ };
2099
+ };
2100
+ responses: {
2101
+ "200": {
2102
+ description: string;
2103
+ content: {
2104
+ "application/json": {
2105
+ schema: {
2106
+ type: "object";
2107
+ properties: {
2108
+ success: {
2109
+ type: string;
2110
+ description: string;
2111
+ };
2112
+ };
2113
+ required: string[];
2114
+ };
2115
+ };
2116
+ };
2117
+ };
2118
+ };
2119
+ };
2120
+ };
2121
+ }, {
2122
+ success: boolean;
2123
+ }>;
2124
+ listApiKeys: better_call0.StrictEndpoint<"/api-key/list", {
2125
+ method: "GET";
2126
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
2127
+ session: {
2128
+ session: Record<string, any> & {
2129
+ id: string;
2130
+ createdAt: Date;
2131
+ updatedAt: Date;
2132
+ userId: string;
2133
+ expiresAt: Date;
2134
+ token: string;
2135
+ ipAddress?: string | null | undefined;
2136
+ userAgent?: string | null | undefined;
2137
+ };
2138
+ user: Record<string, any> & {
2139
+ id: string;
2140
+ createdAt: Date;
2141
+ updatedAt: Date;
2142
+ email: string;
2143
+ emailVerified: boolean;
2144
+ name: string;
2145
+ image?: string | null | undefined;
2146
+ };
2147
+ };
2148
+ }>)[];
2149
+ metadata: {
2150
+ openapi: {
2151
+ description: string;
2152
+ responses: {
2153
+ "200": {
2154
+ description: string;
2155
+ content: {
2156
+ "application/json": {
2157
+ schema: {
2158
+ type: "array";
2159
+ items: {
2160
+ type: string;
2161
+ properties: {
2162
+ id: {
2163
+ type: string;
2164
+ description: string;
2165
+ };
2166
+ name: {
2167
+ type: string;
2168
+ nullable: boolean;
2169
+ description: string;
2170
+ };
2171
+ start: {
2172
+ type: string;
2173
+ nullable: boolean;
2174
+ description: string;
2175
+ };
2176
+ prefix: {
2177
+ type: string;
2178
+ nullable: boolean;
2179
+ description: string;
2180
+ };
2181
+ userId: {
2182
+ type: string;
2183
+ description: string;
2184
+ };
2185
+ refillInterval: {
2186
+ type: string;
2187
+ nullable: boolean;
2188
+ description: string;
2189
+ };
2190
+ refillAmount: {
2191
+ type: string;
2192
+ nullable: boolean;
2193
+ description: string;
2194
+ };
2195
+ lastRefillAt: {
2196
+ type: string;
2197
+ format: string;
2198
+ nullable: boolean;
2199
+ description: string;
2200
+ };
2201
+ enabled: {
2202
+ type: string;
2203
+ description: string;
2204
+ default: boolean;
2205
+ };
2206
+ rateLimitEnabled: {
2207
+ type: string;
2208
+ description: string;
2209
+ };
2210
+ rateLimitTimeWindow: {
2211
+ type: string;
2212
+ nullable: boolean;
2213
+ description: string;
2214
+ };
2215
+ rateLimitMax: {
2216
+ type: string;
2217
+ nullable: boolean;
2218
+ description: string;
2219
+ };
2220
+ requestCount: {
2221
+ type: string;
2222
+ description: string;
2223
+ };
2224
+ remaining: {
2225
+ type: string;
2226
+ nullable: boolean;
2227
+ description: string;
2228
+ };
2229
+ lastRequest: {
2230
+ type: string;
2231
+ format: string;
2232
+ nullable: boolean;
2233
+ description: string;
2234
+ };
2235
+ expiresAt: {
2236
+ type: string;
2237
+ format: string;
2238
+ nullable: boolean;
2239
+ description: string;
2240
+ };
2241
+ createdAt: {
2242
+ type: string;
2243
+ format: string;
2244
+ description: string;
2245
+ };
2246
+ updatedAt: {
2247
+ type: string;
2248
+ format: string;
2249
+ description: string;
2250
+ };
2251
+ metadata: {
2252
+ type: string;
2253
+ nullable: boolean;
2254
+ additionalProperties: boolean;
2255
+ description: string;
2256
+ };
2257
+ permissions: {
2258
+ type: string;
2259
+ nullable: boolean;
2260
+ description: string;
2261
+ };
2262
+ };
2263
+ required: string[];
2264
+ };
2265
+ };
2266
+ };
2267
+ };
2268
+ };
2269
+ };
2270
+ };
2271
+ };
2272
+ }, {
2273
+ metadata: Record<string, any> | null;
2274
+ permissions: {
2275
+ [key: string]: string[];
2276
+ } | null;
2277
+ id: string;
2278
+ name: string | null;
2279
+ start: string | null;
2280
+ prefix: string | null;
2281
+ userId: string;
2282
+ refillInterval: number | null;
2283
+ refillAmount: number | null;
2284
+ lastRefillAt: Date | null;
2285
+ enabled: boolean;
2286
+ rateLimitEnabled: boolean;
2287
+ rateLimitTimeWindow: number | null;
2288
+ rateLimitMax: number | null;
2289
+ requestCount: number;
2290
+ remaining: number | null;
2291
+ lastRequest: Date | null;
2292
+ expiresAt: Date | null;
2293
+ createdAt: Date;
2294
+ updatedAt: Date;
2295
+ }[]>;
2296
+ deleteAllExpiredApiKeys: better_call0.StrictEndpoint<string, {
2297
+ method: "POST";
2298
+ }, {
2299
+ success: boolean;
2300
+ error: unknown;
2301
+ }>;
2302
+ };
2303
+ schema: {
2304
+ apikey: {
2305
+ fields: {
2306
+ name: {
2307
+ type: "string";
2308
+ required: false;
2309
+ input: false;
2310
+ };
2311
+ start: {
2312
+ type: "string";
2313
+ required: false;
2314
+ input: false;
2315
+ };
2316
+ prefix: {
2317
+ type: "string";
2318
+ required: false;
2319
+ input: false;
2320
+ };
2321
+ key: {
2322
+ type: "string";
2323
+ required: true;
2324
+ input: false;
2325
+ index: true;
2326
+ };
2327
+ userId: {
2328
+ type: "string";
2329
+ references: {
2330
+ model: string;
2331
+ field: string;
2332
+ onDelete: "cascade";
2333
+ };
2334
+ required: true;
2335
+ input: false;
2336
+ index: true;
2337
+ };
2338
+ refillInterval: {
2339
+ type: "number";
2340
+ required: false;
2341
+ input: false;
2342
+ };
2343
+ refillAmount: {
2344
+ type: "number";
2345
+ required: false;
2346
+ input: false;
2347
+ };
2348
+ lastRefillAt: {
2349
+ type: "date";
2350
+ required: false;
2351
+ input: false;
2352
+ };
2353
+ enabled: {
2354
+ type: "boolean";
2355
+ required: false;
2356
+ input: false;
2357
+ defaultValue: true;
2358
+ };
2359
+ rateLimitEnabled: {
2360
+ type: "boolean";
2361
+ required: false;
2362
+ input: false;
2363
+ defaultValue: true;
2364
+ };
2365
+ rateLimitTimeWindow: {
2366
+ type: "number";
2367
+ required: false;
2368
+ input: false;
2369
+ defaultValue: number;
2370
+ };
2371
+ rateLimitMax: {
2372
+ type: "number";
2373
+ required: false;
2374
+ input: false;
2375
+ defaultValue: number;
2376
+ };
2377
+ requestCount: {
2378
+ type: "number";
2379
+ required: false;
2380
+ input: false;
2381
+ defaultValue: number;
2382
+ };
2383
+ remaining: {
2384
+ type: "number";
2385
+ required: false;
2386
+ input: false;
2387
+ };
2388
+ lastRequest: {
2389
+ type: "date";
2390
+ required: false;
2391
+ input: false;
2392
+ };
2393
+ expiresAt: {
2394
+ type: "date";
2395
+ required: false;
2396
+ input: false;
2397
+ };
2398
+ createdAt: {
2399
+ type: "date";
2400
+ required: true;
2401
+ input: false;
2402
+ };
2403
+ updatedAt: {
2404
+ type: "date";
2405
+ required: true;
2406
+ input: false;
2407
+ };
2408
+ permissions: {
2409
+ type: "string";
2410
+ required: false;
2411
+ input: false;
2412
+ };
2413
+ metadata: {
2414
+ type: "string";
2415
+ required: false;
2416
+ input: true;
2417
+ transform: {
2418
+ input(value: better_auth0.DBPrimitive): string;
2419
+ output(value: better_auth0.DBPrimitive): any;
2420
+ };
2421
+ };
2422
+ };
2423
+ };
2424
+ };
2425
+ options: better_auth_plugins0.ApiKeyOptions | undefined;
2426
+ }, {
2427
+ id: "bearer";
2428
+ hooks: {
2429
+ before: {
2430
+ matcher(context: better_auth0.HookEndpointContext): boolean;
2431
+ handler: (inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
2432
+ context: {
2433
+ headers: Headers;
2434
+ };
2435
+ } | undefined>;
2436
+ }[];
2437
+ after: {
2438
+ matcher(context: better_auth0.HookEndpointContext): true;
2439
+ handler: (inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>;
2440
+ }[];
2441
+ };
2442
+ options: better_auth_plugins0.BearerOptions | undefined;
2443
+ }];
2444
+ emailAndPassword: {
2445
+ enabled: true;
2446
+ requireEmailVerification: true;
2447
+ };
2448
+ }>>;
2449
+ locale?: questpie181.LocaleConfig | undefined;
2450
+ migrations?: questpie181.Migration[] | undefined;
2451
+ translations?: questpie181.TranslationsConfig | undefined;
2452
+ "~messageKeys"?: "error.notFound" | "error.notFound.withId" | "error.forbidden" | "error.unauthorized" | "error.validation" | "error.internal" | "error.badRequest" | "error.conflict" | "error.notImplemented" | "error.timeout" | "crud.create.forbidden" | "crud.read.forbidden" | "crud.update.forbidden" | "crud.delete.forbidden" | "crud.notFound" | "validation.required" | "validation.invalidType" | "validation.string.tooSmall" | "validation.string.tooBig" | "validation.string.email" | "validation.string.url" | "validation.string.uuid" | "validation.string.regex" | "validation.number.tooSmall" | "validation.number.tooBig" | "validation.number.notInteger" | "validation.number.notPositive" | "validation.number.notNegative" | "validation.array.tooSmall" | "validation.array.tooBig" | "validation.date.invalid" | "validation.date.tooEarly" | "validation.date.tooLate" | "auth.invalidCredentials" | "auth.sessionExpired" | "auth.tokenInvalid" | "auth.tokenExpired" | "auth.accountLocked" | "auth.emailNotVerified" | "auth.userNotFound" | "auth.userAlreadyExists" | "upload.tooLarge" | "upload.invalidType" | "upload.failed" | "hook.beforeCreate.failed" | "hook.afterCreate.failed" | "hook.beforeUpdate.failed" | "hook.afterUpdate.failed" | "hook.beforeDelete.failed" | "hook.afterDelete.failed" | "hook.validate.failed" | "access.denied" | "access.fieldDenied" | "access.operationDenied" | "error.database.uniqueViolation" | "error.database.foreignKeyViolation" | "error.database.notNullViolation" | "error.database.checkViolation" | undefined;
2453
+ }, "collections", {
2454
+ user: questpie181.CollectionBuilder<{
2455
+ options: {
2456
+ timestamps: true;
2457
+ };
2458
+ name: "user";
2459
+ fields: {
2460
+ name: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
2461
+ email: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
2462
+ emailVerified: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgBooleanBuilder>;
2463
+ image: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
2464
+ role: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
2465
+ banned: drizzle_orm94.HasDefault<drizzle_orm_pg_core183.PgBooleanBuilder>;
2466
+ banReason: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
2467
+ banExpires: drizzle_orm_pg_core183.PgTimestampBuilder;
2468
+ };
2469
+ localized: [];
2470
+ virtuals: undefined;
2471
+ relations: Record<string, questpie181.RelationConfig>;
2472
+ indexes: Record<string, any>;
2473
+ title: "name";
2474
+ hooks: questpie181.CollectionHooks<any, any, any, any>;
2475
+ access: questpie181.CollectionAccess<any, any>;
2476
+ functions: {
2477
+ [x: string]: questpie181.FunctionDefinition<any, any, any>;
2478
+ };
2479
+ searchable: undefined;
2480
+ validation: undefined;
2481
+ output: undefined;
2482
+ upload: undefined;
2483
+ }>;
2484
+ session: questpie181.CollectionBuilder<{
2485
+ options: questpie181.CollectionOptions;
2486
+ name: "session";
2487
+ fields: {
2488
+ userId: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
2489
+ token: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
2490
+ expiresAt: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgTimestampBuilder>;
2491
+ ipAddress: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
2492
+ userAgent: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
2493
+ impersonatedBy: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
2494
+ };
2495
+ localized: [];
2496
+ virtuals: undefined;
2497
+ relations: Record<string, questpie181.RelationConfig>;
2498
+ indexes: Record<string, any>;
2499
+ title: "token";
2500
+ hooks: questpie181.CollectionHooks<any, any, any, any>;
2501
+ access: questpie181.CollectionAccess<any, any>;
2502
+ functions: {
2503
+ [x: string]: questpie181.FunctionDefinition<any, any, any>;
2504
+ };
2505
+ searchable: undefined;
2506
+ validation: undefined;
2507
+ output: undefined;
2508
+ upload: undefined;
2509
+ }>;
2510
+ account: questpie181.CollectionBuilder<{
2511
+ options: questpie181.CollectionOptions;
2512
+ name: "account";
2513
+ fields: {
2514
+ userId: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
2515
+ accountId: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
2516
+ providerId: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
2517
+ accessToken: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
2518
+ refreshToken: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
2519
+ accessTokenExpiresAt: drizzle_orm_pg_core183.PgTimestampBuilder;
2520
+ refreshTokenExpiresAt: drizzle_orm_pg_core183.PgTimestampBuilder;
2521
+ scope: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
2522
+ idToken: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
2523
+ password: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
2524
+ };
2525
+ localized: [];
2526
+ virtuals: undefined;
2527
+ relations: Record<string, questpie181.RelationConfig>;
2528
+ indexes: Record<string, any>;
2529
+ title: "providerId";
2530
+ hooks: questpie181.CollectionHooks<any, any, any, any>;
2531
+ access: questpie181.CollectionAccess<any, any>;
2532
+ functions: {
2533
+ [x: string]: questpie181.FunctionDefinition<any, any, any>;
2534
+ };
2535
+ searchable: undefined;
2536
+ validation: undefined;
2537
+ output: undefined;
2538
+ upload: undefined;
2539
+ }>;
2540
+ verification: questpie181.CollectionBuilder<{
2541
+ options: questpie181.CollectionOptions;
2542
+ name: "verification";
2543
+ fields: {
2544
+ identifier: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
2545
+ value: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
2546
+ expiresAt: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgTimestampBuilder>;
2547
+ };
2548
+ localized: [];
2549
+ virtuals: undefined;
2550
+ relations: Record<string, questpie181.RelationConfig>;
2551
+ indexes: Record<string, any>;
2552
+ title: "identifier";
2553
+ hooks: questpie181.CollectionHooks<any, any, any, any>;
2554
+ access: questpie181.CollectionAccess<any, any>;
2555
+ functions: {
2556
+ [x: string]: questpie181.FunctionDefinition<any, any, any>;
2557
+ };
2558
+ searchable: undefined;
2559
+ validation: undefined;
2560
+ output: undefined;
2561
+ upload: undefined;
2562
+ }>;
2563
+ assets: questpie181.CollectionBuilder<{
2564
+ options: {
2565
+ timestamps: true;
2566
+ };
2567
+ name: "assets";
2568
+ fields: {
2569
+ width: drizzle_orm_pg_core183.PgIntegerBuilder;
2570
+ height: drizzle_orm_pg_core183.PgIntegerBuilder;
2571
+ alt: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
2572
+ caption: drizzle_orm_pg_core183.PgTextBuilder<[string, ...string[]]>;
2573
+ } & {
2574
+ key: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
2575
+ filename: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
2576
+ mimeType: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
2577
+ size: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgIntegerBuilder>;
2578
+ visibility: drizzle_orm94.HasDefault<drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<["public", "private"]>>>;
2579
+ };
2580
+ localized: [];
2581
+ virtuals: undefined;
2582
+ relations: Record<string, questpie181.RelationConfig>;
2583
+ indexes: Record<string, any>;
2584
+ title: "filename";
2585
+ hooks: {
2586
+ afterDelete: ({
2587
+ data,
2588
+ app
2589
+ }: questpie181.HookContext<{
2590
+ width: number | null;
2591
+ height: number | null;
2592
+ alt: string | null;
2593
+ caption: string | null;
2594
+ visibility: "public" | "private";
2595
+ id: string;
2596
+ key: string;
2597
+ filename: string;
2598
+ size: number;
2599
+ mimeType: string;
2600
+ createdAt: Date;
2601
+ updatedAt: Date;
2602
+ _title: string;
2603
+ url: string;
2604
+ }, never, "delete", any>) => Promise<void>;
2605
+ };
2606
+ access: questpie181.CollectionAccess<any, any>;
2607
+ functions: {
2608
+ [x: string]: questpie181.FunctionDefinition<any, any, any>;
2609
+ };
2610
+ searchable: undefined;
2611
+ validation: undefined;
2612
+ output: questpie181.TypeMerge<{}, {
2613
+ url: string;
2614
+ }>;
2615
+ upload: questpie181.UploadOptions;
2616
+ }>;
2617
+ apikey: questpie181.CollectionBuilder<{
2618
+ options: {
2619
+ timestamps: true;
2620
+ };
2621
+ name: "apikey";
2622
+ fields: {
2623
+ name: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
2624
+ start: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
2625
+ prefix: drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>;
2626
+ key: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
2627
+ userId: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
2628
+ refillInterval: drizzle_orm_pg_core183.PgIntegerBuilder;
2629
+ refillAmount: drizzle_orm_pg_core183.PgIntegerBuilder;
2630
+ lastRefillAt: drizzle_orm_pg_core183.PgTimestampBuilder;
2631
+ enabled: drizzle_orm94.HasDefault<drizzle_orm_pg_core183.PgBooleanBuilder>;
2632
+ rateLimitEnabled: drizzle_orm94.HasDefault<drizzle_orm_pg_core183.PgBooleanBuilder>;
2633
+ rateLimitTimeWindow: drizzle_orm_pg_core183.PgIntegerBuilder;
2634
+ rateLimitMax: drizzle_orm_pg_core183.PgIntegerBuilder;
2635
+ requestCount: drizzle_orm94.HasDefault<drizzle_orm_pg_core183.PgIntegerBuilder>;
2636
+ remaining: drizzle_orm_pg_core183.PgIntegerBuilder;
2637
+ lastRequest: drizzle_orm_pg_core183.PgTimestampBuilder;
2638
+ expiresAt: drizzle_orm_pg_core183.PgTimestampBuilder;
2639
+ permissions: drizzle_orm_pg_core183.PgTextBuilder<[string, ...string[]]>;
2640
+ metadata: drizzle_orm_pg_core183.PgTextBuilder<[string, ...string[]]>;
2641
+ };
2642
+ localized: [];
2643
+ virtuals: undefined;
2644
+ relations: Record<string, questpie181.RelationConfig>;
2645
+ indexes: Record<string, any>;
2646
+ title: "key";
2647
+ hooks: questpie181.CollectionHooks<any, any, any, any>;
2648
+ access: questpie181.CollectionAccess<any, any>;
2649
+ functions: {
2650
+ [x: string]: questpie181.FunctionDefinition<any, any, any>;
2651
+ };
2652
+ searchable: undefined;
2653
+ validation: undefined;
2654
+ output: undefined;
2655
+ upload: undefined;
2656
+ }>;
2657
+ admin_saved_views: questpie181.CollectionBuilder<{
2658
+ name: "admin_saved_views";
2659
+ localized: [];
2660
+ output: undefined;
2661
+ title: undefined;
2662
+ options: {
2663
+ timestamps: true;
2664
+ };
2665
+ fields: {
2666
+ userId: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
2667
+ collectionName: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
2668
+ name: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
2669
+ configuration: drizzle_orm94.$Type<drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgJsonbBuilder>, ViewConfiguration>;
2670
+ isDefault: drizzle_orm94.NotNull<drizzle_orm94.HasDefault<drizzle_orm_pg_core183.PgBooleanBuilder>>;
2671
+ };
2672
+ upload: undefined;
2673
+ functions: {
2674
+ [x: string]: questpie181.FunctionDefinition<any, any, any>;
2675
+ };
2676
+ hooks: questpie181.CollectionHooks<any, any, any, any>;
2677
+ indexes: Record<string, any>;
2678
+ searchable: undefined;
2679
+ virtuals: undefined;
2680
+ relations: Record<string, questpie181.RelationConfig>;
2681
+ access: questpie181.CollectionAccess<any, any>;
2682
+ validation: undefined;
2683
+ }>;
2684
+ admin_preferences: questpie181.CollectionBuilder<{
2685
+ name: "admin_preferences";
2686
+ localized: [];
2687
+ output: undefined;
2688
+ title: undefined;
2689
+ options: {
2690
+ timestamps: true;
2691
+ };
2692
+ fields: {
2693
+ userId: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
2694
+ key: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgVarcharBuilder<[string, ...string[]]>>;
2695
+ value: drizzle_orm94.NotNull<drizzle_orm_pg_core183.PgJsonbBuilder>;
2696
+ };
2697
+ upload: undefined;
2698
+ functions: {
2699
+ [x: string]: questpie181.FunctionDefinition<any, any, any>;
2700
+ };
2701
+ hooks: questpie181.CollectionHooks<any, any, any, any>;
2702
+ indexes: drizzle_orm_pg_core183.IndexBuilder[];
2703
+ searchable: undefined;
2704
+ virtuals: undefined;
2705
+ relations: Record<string, questpie181.RelationConfig>;
2706
+ access: questpie181.CollectionAccess<any, any>;
2707
+ validation: undefined;
2708
+ }>;
2709
+ }>, "functions", {
2710
+ mintPreviewToken: questpie181.JsonFunctionDefinition<{
2711
+ path: string;
2712
+ ttlMs?: number | undefined;
2713
+ }, {
2714
+ token: string;
2715
+ expiresAt: number;
2716
+ }, any>;
2717
+ verifyPreviewToken: questpie181.JsonFunctionDefinition<{
2718
+ token: string;
2719
+ }, {
2720
+ valid: boolean;
2721
+ path?: string | undefined;
2722
+ error?: string | undefined;
2723
+ }, any>;
2724
+ getContentLocales: questpie181.JsonFunctionDefinition<Record<string, never> | undefined, {
2725
+ locales: {
2726
+ code: string;
2727
+ label?: string | undefined;
2728
+ fallback?: boolean | undefined;
2729
+ flagCountryCode?: string | undefined;
2730
+ }[];
2731
+ defaultLocale: string;
2732
+ fallbacks?: Record<string, string> | undefined;
2733
+ }, any>;
2734
+ isSetupRequired: questpie181.JsonFunctionDefinition<Record<string, never>, {
2735
+ required: boolean;
2736
+ }, any>;
2737
+ createFirstAdmin: questpie181.JsonFunctionDefinition<{
2738
+ email: string;
2739
+ password: string;
2740
+ name: string;
2741
+ }, {
2742
+ success: boolean;
2743
+ user?: {
2744
+ id: string;
2745
+ email: string;
2746
+ name: string;
2747
+ } | undefined;
2748
+ error?: string | undefined;
2749
+ }, any>;
2750
+ }>>;
2751
+ //#endregion
2752
+ export { PreviewTokenPayload as a, verifyPreviewTokenDirect as c, GetAdminSessionOptions as d, RequireAdminAuthOptions as f, requireAdminAuth as h, setupFunctions as i, savedViewsCollection as l, isAdminUser as m, createFirstAdmin as n, createPreviewFunctions as o, getAdminSession as p, isSetupRequired as r, createPreviewTokenVerifier as s, adminModule as t, AuthSession as u };
2753
+ //# sourceMappingURL=index-B9Xwk4hi.d.mts.map