@@ -39,9 +39,9 @@ export function validateConfig(config) {
3939 device : z
4040 . object ( {
4141 userAgent : z . string ( ) . optional ( ) ,
42- deviceScaleFactor : z . number ( ) . positive ( ) . optional ( ) ,
43- width : z . number ( ) . positive ( ) . optional ( ) ,
44- height : z . number ( ) . positive ( ) . optional ( ) ,
42+ scale : z . number ( ) . positive ( ) . optional ( ) ,
43+ width : z . number ( ) . nonnegative ( ) . optional ( ) ,
44+ height : z . number ( ) . nonnegative ( ) . optional ( ) ,
4545 locale : z . string ( ) . optional ( ) ,
4646 timezone : z . string ( ) . optional ( ) ,
4747 cache : z . boolean ( ) . optional ( ) ,
@@ -83,35 +83,14 @@ export function validateConfig(config) {
8383 height : z . number ( ) . positive ( ) . default ( 1080 ) ,
8484 } )
8585 . optional ( ) ,
86- videoCrf : z
87- . number ( )
88- . positive ( )
89- . default ( 23 )
90- . refine ( ( val ) => val === 23 , {
91- message : "videoCrf must be strictly 23" ,
92- } )
93- . optional ( ) ,
86+ videoCrf : z . number ( ) . min ( 0 ) . max ( 51 ) . default ( 23 ) . optional ( ) ,
9487 videoCodec : z . literal ( "libx264" ) . optional ( ) ,
9588 videoPreset : z
96- . enum ( [ "ultrafast" , "fast" , "slower" ] )
89+ . enum ( [ "ultrafast" , "superfast" , "veryfast" , "faster" , " fast", "medium" , "slow" , " slower" , "veryslow "] )
9790 . default ( "ultrafast" )
9891 . optional ( ) ,
99- videoBitrate : z
100- . number ( )
101- . positive ( )
102- . default ( 3000 )
103- . refine ( ( val ) => val === 3000 , {
104- message : "videoBitrate must be strictly 3000" ,
105- } )
106- . optional ( ) ,
107- recordDurationLimit : z
108- . number ( )
109- . positive ( )
110- . default ( 30 )
111- . refine ( ( val ) => val === 30 , {
112- message : "recordDurationLimit must be strictly 30" ,
113- } )
114- . optional ( ) ,
92+ videoBitrate : z . number ( ) . min ( 500 ) . max ( 10000 ) . default ( 3000 ) . optional ( ) ,
93+ recordDurationLimit : z . number ( ) . min ( 1 ) . max ( 60 ) . default ( 30 ) . optional ( ) ,
11594 } )
11695 . optional ( ) ,
11796 pdf : z
@@ -124,8 +103,8 @@ export function validateConfig(config) {
124103 landscape : z . boolean ( ) . default ( false ) ,
125104 pageRanges : z . string ( ) . default ( "" ) ,
126105 format : z . string ( ) . default ( "A4" ) ,
127- width : z . number ( ) . positive ( ) . optional ( ) ,
128- height : z . number ( ) . positive ( ) . optional ( ) ,
106+ width : z . string ( ) . optional ( ) ,
107+ height : z . string ( ) . optional ( ) ,
129108 margin : z
130109 . object ( {
131110 top : z . string ( ) . default ( "0px" ) ,
@@ -136,7 +115,7 @@ export function validateConfig(config) {
136115 . optional ( ) ,
137116 preferCSSPageSize : z . boolean ( ) . default ( false ) ,
138117 omitBackground : z . boolean ( ) . default ( false ) ,
139- timeout : z . number ( ) . positive ( ) . default ( 30000 ) ,
118+ timeout : z . number ( ) . nonnegative ( ) . default ( 30000 ) ,
140119 } )
141120 . optional ( ) ,
142121 } ) . refine ( ( data ) => data . url || data . html , {
0 commit comments