@@ -175,28 +175,28 @@ async fn udf_version<RT: Runtime>(
175
175
/// - Checking the args size.
176
176
/// - Checking that the args pass validation.
177
177
///
178
- /// This should only be constructed via `ValidatedUdfPath ::new` to use the type
179
- /// system to enforce that validation is never skipped.
178
+ /// This should only be constructed via `ValidatedPathAndArgs ::new` to use the
179
+ /// type system to enforce that validation is never skipped.
180
180
#[ derive( Clone , Eq , PartialEq ) ]
181
181
#[ cfg_attr( any( test, feature = "testing" ) , derive( Debug ) ) ]
182
- pub struct ValidatedUdfPathAndArgs {
182
+ pub struct ValidatedPathAndArgs {
183
183
path : CanonicalizedComponentFunctionPath ,
184
184
args : ConvexArray ,
185
185
// Not set for system modules.
186
186
npm_version : Option < Version > ,
187
187
}
188
188
189
189
#[ cfg( any( test, feature = "testing" ) ) ]
190
- impl Arbitrary for ValidatedUdfPathAndArgs {
190
+ impl Arbitrary for ValidatedPathAndArgs {
191
191
type Parameters = ( ) ;
192
192
193
- type Strategy = impl Strategy < Value = ValidatedUdfPathAndArgs > ;
193
+ type Strategy = impl Strategy < Value = ValidatedPathAndArgs > ;
194
194
195
195
fn arbitrary_with ( ( ) : Self :: Parameters ) -> Self :: Strategy {
196
196
use proptest:: prelude:: * ;
197
197
198
198
any :: < ( CanonicalizedComponentFunctionPath , ConvexArray ) > ( ) . prop_map ( |( path, args) | {
199
- ValidatedUdfPathAndArgs {
199
+ ValidatedPathAndArgs {
200
200
path,
201
201
args,
202
202
npm_version : None ,
@@ -205,9 +205,9 @@ impl Arbitrary for ValidatedUdfPathAndArgs {
205
205
}
206
206
}
207
207
208
- impl ValidatedUdfPathAndArgs {
208
+ impl ValidatedPathAndArgs {
209
209
/// Check if the function being called matches the allowed visibility and
210
- /// return a ValidatedUdfPath or an appropriate JsError.
210
+ /// return a ValidatedPathAndARgs or an appropriate JsError.
211
211
///
212
212
/// We want to use the same error message for "this function exists, but
213
213
/// with the wrong visibility" and "this function does not exist" so we
@@ -218,7 +218,7 @@ impl ValidatedUdfPathAndArgs {
218
218
path : CanonicalizedComponentFunctionPath ,
219
219
args : ConvexArray ,
220
220
expected_udf_type : UdfType ,
221
- ) -> anyhow:: Result < Result < ValidatedUdfPathAndArgs , JsError > > {
221
+ ) -> anyhow:: Result < Result < ValidatedPathAndArgs , JsError > > {
222
222
if path. udf_path . is_system ( ) {
223
223
anyhow:: ensure!(
224
224
path. component. is_root( ) ,
@@ -228,7 +228,7 @@ impl ValidatedUdfPathAndArgs {
228
228
// We don't analyze system modules, so we don't validate anything
229
229
// except the identity for them.
230
230
let result = if tx. identity ( ) . is_admin ( ) || tx. identity ( ) . is_system ( ) {
231
- Ok ( ValidatedUdfPathAndArgs {
231
+ Ok ( ValidatedPathAndArgs {
232
232
path,
233
233
args,
234
234
npm_version : None ,
@@ -321,7 +321,7 @@ impl ValidatedUdfPathAndArgs {
321
321
) ) ) ) ;
322
322
}
323
323
324
- Ok ( Ok ( ValidatedUdfPathAndArgs {
324
+ Ok ( Ok ( ValidatedPathAndArgs {
325
325
path,
326
326
args,
327
327
npm_version : Some ( udf_version) ,
@@ -386,15 +386,15 @@ impl ValidatedUdfPathAndArgs {
386
386
}
387
387
}
388
388
389
- impl TryFrom < ValidatedUdfPathAndArgs > for pb:: common:: PathAndArgs {
389
+ impl TryFrom < ValidatedPathAndArgs > for pb:: common:: PathAndArgs {
390
390
type Error = anyhow:: Error ;
391
391
392
392
fn try_from (
393
- ValidatedUdfPathAndArgs {
393
+ ValidatedPathAndArgs {
394
394
path,
395
395
args,
396
396
npm_version,
397
- } : ValidatedUdfPathAndArgs ,
397
+ } : ValidatedPathAndArgs ,
398
398
) -> anyhow:: Result < Self > {
399
399
let args_json = JsonValue :: from ( args) ;
400
400
let args = serde_json:: to_vec ( & args_json) ?;
@@ -476,16 +476,16 @@ mod test {
476
476
477
477
use proptest:: prelude:: * ;
478
478
479
- use crate :: ValidatedUdfPathAndArgs ;
479
+ use crate :: ValidatedPathAndArgs ;
480
480
proptest ! {
481
481
#![ proptest_config(
482
482
ProptestConfig { failure_persistence: None , ..ProptestConfig :: default ( ) }
483
483
) ]
484
484
485
485
#[ test]
486
- fn test_udf_path_proto_roundtrip( v in any:: <ValidatedUdfPathAndArgs >( ) ) {
486
+ fn test_udf_path_proto_roundtrip( v in any:: <ValidatedPathAndArgs >( ) ) {
487
487
let proto = pb:: common:: PathAndArgs :: try_from( v. clone( ) ) . unwrap( ) ;
488
- let v2 = ValidatedUdfPathAndArgs :: from_proto( proto) . unwrap( ) ;
488
+ let v2 = ValidatedPathAndArgs :: from_proto( proto) . unwrap( ) ;
489
489
assert_eq!( v, v2) ;
490
490
}
491
491
}
0 commit comments