@@ -22,6 +22,10 @@ import {
2222 type FormRequestPayloadRefs ,
2323 type FormRequestRefs
2424} from '~/src/server/routes/types.js'
25+ import {
26+ buildActionSchema ,
27+ buildParamsSchema
28+ } from '~/src/server/schemas/index.js'
2529import { CacheService } from '~/src/server/services/index.js'
2630
2731export const plugin = {
@@ -51,12 +55,20 @@ export const plugin = {
5155
5256 await registerVision ( server , options )
5357
58+ const buttons = getButtons ( options )
59+ const actionHandlers = getActionHandlers ( options )
60+ const customActions = Object . keys ( actionHandlers )
61+
5462 server . expose ( 'baseLayoutPath' , nunjucksOptions . baseLayoutPath )
5563 server . expose ( 'viewContext' , viewContext )
5664 server . expose ( 'cacheService' , cacheService )
5765 server . expose ( 'saveAndReturn' , saveAndReturn )
58- server . expose ( 'buttons' , getButtons ( options ) )
59- server . expose ( 'actionHandlers' , getActionHandlers ( options ) )
66+ server . expose ( 'buttons' , buttons )
67+ server . expose ( 'actionHandlers' , actionHandlers )
68+ server . expose ( 'schemas' , {
69+ actionSchema : buildActionSchema ( customActions ) ,
70+ paramsSchema : buildParamsSchema ( customActions )
71+ } )
6072
6173 server . app . model = model
6274
@@ -90,12 +102,13 @@ export const plugin = {
90102
91103 const routes = [
92104 ...getQuestionRoutes (
105+ server ,
93106 getRouteOptions ,
94107 postRouteOptions ,
95108 preparePageEventRequestOptions
96109 ) ,
97- ...getRepeaterSummaryRoutes ( getRouteOptions , postRouteOptions ) ,
98- ...getRepeaterItemDeleteRoutes ( getRouteOptions , postRouteOptions ) ,
110+ ...getRepeaterSummaryRoutes ( server , getRouteOptions , postRouteOptions ) ,
111+ ...getRepeaterItemDeleteRoutes ( server , getRouteOptions , postRouteOptions ) ,
99112 ...getSaveAndReturnExitRoutes ( getRouteOptions ) ,
100113 ...getFileUploadStatusRoutes ( )
101114 ]
0 commit comments