@@ -8,7 +8,7 @@ import type {
8
8
ServerCodeFn ,
9
9
StateServerCodeFn ,
10
10
} from "./index.types" ;
11
- import type { Infer , Schema } from "./validation-adapters" ;
11
+ import type { Infer , Schema , ValidationAdapter } from "./validation-adapters" ;
12
12
import type {
13
13
BindArgsValidationErrors ,
14
14
FlattenedBindArgsValidationErrors ,
@@ -42,6 +42,7 @@ export class SafeActionClient<
42
42
readonly #metadata: MD ;
43
43
readonly #schemaFn: SF ;
44
44
readonly #bindArgsSchemas: BAS ;
45
+ readonly #validationAdapter: ValidationAdapter ;
45
46
readonly #handleValidationErrorsShape: HandleValidationErrorsShapeFn < S , CVE > ;
46
47
readonly #handleBindArgsValidationErrorsShape: HandleBindArgsValidationErrorsShapeFn < BAS , CBAVE > ;
47
48
readonly #defaultValidationErrorsShape: ODVES ;
@@ -54,6 +55,7 @@ export class SafeActionClient<
54
55
metadata : MD ;
55
56
schemaFn : SF ;
56
57
bindArgsSchemas : BAS ;
58
+ validationAdapter : ValidationAdapter ;
57
59
handleValidationErrorsShape : HandleValidationErrorsShapeFn < S , CVE > ;
58
60
handleBindArgsValidationErrorsShape : HandleBindArgsValidationErrorsShapeFn < BAS , CBAVE > ;
59
61
ctxType : Ctx ;
@@ -71,6 +73,7 @@ export class SafeActionClient<
71
73
this . #metadata = opts . metadata ;
72
74
this . #schemaFn = ( opts . schemaFn ?? undefined ) as SF ;
73
75
this . #bindArgsSchemas = opts . bindArgsSchemas ?? [ ] ;
76
+ this . #validationAdapter = opts . validationAdapter ;
74
77
this . #handleValidationErrorsShape = opts . handleValidationErrorsShape ;
75
78
this . #handleBindArgsValidationErrorsShape = opts . handleBindArgsValidationErrorsShape ;
76
79
this . #defaultValidationErrorsShape = opts . defaultValidationErrorsShape ;
@@ -92,6 +95,7 @@ export class SafeActionClient<
92
95
metadata : this . #metadata,
93
96
schemaFn : this . #schemaFn,
94
97
bindArgsSchemas : this . #bindArgsSchemas,
98
+ validationAdapter : this . #validationAdapter,
95
99
handleValidationErrorsShape : this . #handleValidationErrorsShape,
96
100
handleBindArgsValidationErrorsShape : this . #handleBindArgsValidationErrorsShape,
97
101
ctxType : undefined as NextCtx ,
@@ -115,6 +119,7 @@ export class SafeActionClient<
115
119
metadata : data ,
116
120
schemaFn : this . #schemaFn,
117
121
bindArgsSchemas : this . #bindArgsSchemas,
122
+ validationAdapter : this . #validationAdapter,
118
123
handleValidationErrorsShape : this . #handleValidationErrorsShape,
119
124
handleBindArgsValidationErrorsShape : this . #handleBindArgsValidationErrorsShape,
120
125
ctxType : undefined as Ctx ,
@@ -155,6 +160,7 @@ export class SafeActionClient<
155
160
}
156
161
: async ( ) => schema ) as SF ,
157
162
bindArgsSchemas : this . #bindArgsSchemas,
163
+ validationAdapter : this . #validationAdapter,
158
164
handleValidationErrorsShape : ( utils ?. handleValidationErrorsShape ??
159
165
this . #handleValidationErrorsShape) as HandleValidationErrorsShapeFn < AS , OCVE > ,
160
166
handleBindArgsValidationErrorsShape : this . #handleBindArgsValidationErrorsShape,
@@ -188,6 +194,7 @@ export class SafeActionClient<
188
194
metadata : this . #metadata,
189
195
schemaFn : this . #schemaFn,
190
196
bindArgsSchemas,
197
+ validationAdapter : this . #validationAdapter,
191
198
handleValidationErrorsShape : this . #handleValidationErrorsShape,
192
199
handleBindArgsValidationErrorsShape : ( utils ?. handleBindArgsValidationErrorsShape ??
193
200
this . #handleBindArgsValidationErrorsShape) as HandleBindArgsValidationErrorsShapeFn < OBAS , OCBAVE > ,
@@ -217,6 +224,7 @@ export class SafeActionClient<
217
224
metadata : this . #metadata,
218
225
schemaFn : this . #schemaFn,
219
226
bindArgsSchemas : this . #bindArgsSchemas,
227
+ validationAdapter : this . #validationAdapter,
220
228
handleValidationErrorsShape : this . #handleValidationErrorsShape,
221
229
handleBindArgsValidationErrorsShape : this . #handleBindArgsValidationErrorsShape,
222
230
throwValidationErrors : this . #throwValidationErrors,
@@ -244,6 +252,7 @@ export class SafeActionClient<
244
252
metadata : this . #metadata,
245
253
schemaFn : this . #schemaFn,
246
254
bindArgsSchemas : this . #bindArgsSchemas,
255
+ validationAdapter : this . #validationAdapter,
247
256
handleValidationErrorsShape : this . #handleValidationErrorsShape,
248
257
handleBindArgsValidationErrorsShape : this . #handleBindArgsValidationErrorsShape,
249
258
throwValidationErrors : this . #throwValidationErrors,
0 commit comments