@@ -69,28 +69,28 @@ import { parseCookie } from 'cookie';
6969import { addMinutes } from 'date-fns/addMinutes' ;
7070import { z } from 'zod' ;
7171import { redirect , sendJson , setCsrfCookie } from '../utils/response.handlers' ;
72- import { createRoute } from '../utils/route.utils' ;
72+ import { createRoute , RouteValidator } from '../utils/route.utils' ;
7373
7474export const routeDefinition = {
7575 logout : {
7676 controllerFn : ( ) => logout ,
7777 validators : {
7878 hasSourceOrg : false ,
79- } ,
79+ } satisfies RouteValidator ,
8080 } ,
8181 getProviders : {
8282 controllerFn : ( ) => getProviders ,
8383 responseType : ProvidersSchema ,
8484 validators : {
8585 hasSourceOrg : false ,
86- } ,
86+ } satisfies RouteValidator ,
8787 } ,
8888 getCsrfToken : {
8989 controllerFn : ( ) => getCsrfToken ,
9090 responseType : z . object ( { csrfToken : z . string ( ) } ) ,
9191 validators : {
9292 hasSourceOrg : false ,
93- } ,
93+ } satisfies RouteValidator ,
9494 } ,
9595 getSession : {
9696 controllerFn : ( ) => getSession ,
@@ -105,7 +105,7 @@ export const routeDefinition = {
105105 } ) ,
106106 validators : {
107107 hasSourceOrg : false ,
108- } ,
108+ } satisfies RouteValidator ,
109109 } ,
110110 signin : {
111111 controllerFn : ( ) => signin ,
@@ -114,7 +114,7 @@ export const routeDefinition = {
114114 query : z . object ( { returnUrl : z . string ( ) . nullish ( ) , isAccountLink : z . literal ( 'true' ) . nullish ( ) } ) ,
115115 body : z . object ( { csrfToken : z . string ( ) , callbackUrl : z . string ( ) . url ( ) } ) ,
116116 hasSourceOrg : false ,
117- } ,
117+ } satisfies RouteValidator ,
118118 } ,
119119 callback : {
120120 controllerFn : ( ) => callback ,
@@ -143,7 +143,7 @@ export const routeDefinition = {
143143 z . object ( { } ) . nullish ( ) ,
144144 ] ) ,
145145 hasSourceOrg : false ,
146- } ,
146+ } satisfies RouteValidator ,
147147 } ,
148148 verification : {
149149 controllerFn : ( ) => verification ,
@@ -160,7 +160,7 @@ export const routeDefinition = {
160160 type : z . enum ( [ 'email' , '2fa-otp' , '2fa-email' ] ) ,
161161 } ) ,
162162 hasSourceOrg : false ,
163- } ,
163+ } satisfies RouteValidator ,
164164 } ,
165165 verifyEmailViaLink : {
166166 controllerFn : ( ) => verifyEmailViaLink ,
@@ -170,23 +170,23 @@ export const routeDefinition = {
170170 code : z . string ( ) ,
171171 } ) ,
172172 hasSourceOrg : false ,
173- } ,
173+ } satisfies RouteValidator ,
174174 } ,
175175 resendVerification : {
176176 controllerFn : ( ) => resendVerification ,
177177 responseType : z . object ( { error : z . boolean ( ) } ) . nullable ( ) ,
178178 validators : {
179179 body : z . object ( { captchaToken : z . string ( ) . nullish ( ) , csrfToken : z . string ( ) , type : z . enum ( [ 'email' , '2fa-email' ] ) } ) ,
180180 hasSourceOrg : false ,
181- } ,
181+ } satisfies RouteValidator ,
182182 } ,
183183 requestPasswordReset : {
184184 controllerFn : ( ) => requestPasswordReset ,
185185 responseType : z . object ( { error : z . boolean ( ) } ) . nullable ( ) ,
186186 validators : {
187187 body : z . object ( { captchaToken : z . string ( ) . nullish ( ) , email : z . string ( ) . toLowerCase ( ) , csrfToken : z . string ( ) } ) ,
188188 hasSourceOrg : false ,
189- } ,
189+ } satisfies RouteValidator ,
190190 } ,
191191 validatePasswordReset : {
192192 controllerFn : ( ) => validatePasswordReset ,
@@ -200,14 +200,14 @@ export const routeDefinition = {
200200 captchaToken : z . string ( ) . nullish ( ) ,
201201 } ) ,
202202 hasSourceOrg : false ,
203- } ,
203+ } satisfies RouteValidator ,
204204 } ,
205205 getOtpEnrollmentData : {
206206 controllerFn : ( ) => getOtpEnrollmentData ,
207207 responseType : z . object ( { secret : z . string ( ) , secretToken : z . string ( ) , imageUri : z . string ( ) , uri : z . string ( ) } ) ,
208208 validators : {
209209 hasSourceOrg : false ,
210- } ,
210+ } satisfies RouteValidator ,
211211 } ,
212212 enrollOtpFactor : {
213213 controllerFn : ( ) => enrollOtpFactor ,
@@ -219,46 +219,46 @@ export const routeDefinition = {
219219 csrfToken : z . string ( ) ,
220220 } ) ,
221221 hasSourceOrg : false ,
222- } ,
222+ } satisfies RouteValidator ,
223223 } ,
224224 // SSO Routes
225225 discoverSso : {
226226 controllerFn : ( ) => discoverSso ,
227227 validators : {
228228 body : z . object ( { csrfToken : z . string ( ) , email : z . email ( ) . toLowerCase ( ) } ) ,
229229 hasSourceOrg : false ,
230- } ,
230+ } satisfies RouteValidator ,
231231 } ,
232232 startSso : {
233233 controllerFn : ( ) => startSso ,
234234 validators : {
235235 body : z . object ( { csrfToken : z . string ( ) , email : z . email ( ) . toLowerCase ( ) } ) ,
236236 query : z . object ( { returnUrl : z . string ( ) . optional ( ) } ) ,
237237 hasSourceOrg : false ,
238- } ,
238+ } satisfies RouteValidator ,
239239 } ,
240240 handleSamlCallback : {
241241 controllerFn : ( ) => handleSamlCallback ,
242242 validators : {
243243 params : z . object ( { teamId : z . uuid ( ) } ) ,
244244 body : z . object ( { SAMLResponse : z . string ( ) } ) ,
245245 hasSourceOrg : false ,
246- } ,
246+ } satisfies RouteValidator ,
247247 } ,
248248 getSamlMetadata : {
249249 controllerFn : ( ) => getSamlMetadata ,
250250 validators : {
251251 params : z . object ( { teamId : z . uuid ( ) } ) ,
252252 hasSourceOrg : false ,
253- } ,
253+ } satisfies RouteValidator ,
254254 } ,
255255 handleOidcCallback : {
256256 controllerFn : ( ) => handleOidcCallback ,
257257 validators : {
258258 params : z . object ( { teamId : z . uuid ( ) } ) ,
259259 query : z . object ( { } ) . loose ( ) ,
260260 hasSourceOrg : false ,
261- } ,
261+ } satisfies RouteValidator ,
262262 } ,
263263} ;
264264
0 commit comments