@@ -31,10 +31,11 @@ import { TransformDecode, TransformEncode, HasTransform } from '../transform/ind
31
31
import { TSchema } from '../../type/schema/index'
32
32
import { StaticDecode } from '../../type/static/index'
33
33
import { Assert } from '../assert/index'
34
- import { Default } from '../default/index'
35
- import { Convert } from '../convert/index'
34
+ import { Cast } from '../cast/index'
36
35
import { Clean } from '../clean/index'
37
36
import { Clone } from '../clone/index'
37
+ import { Convert } from '../convert/index'
38
+ import { Default } from '../default/index'
38
39
39
40
// ------------------------------------------------------------------
40
41
// Guards
@@ -53,18 +54,19 @@ export class ParseError extends TypeBoxError {
53
54
// ------------------------------------------------------------------
54
55
// ParseRegistry
55
56
// ------------------------------------------------------------------
56
- export type TParseOperation = 'Clone ' | 'Clean' | 'Default ' | 'Convert' | 'Assert ' | 'Decode ' | 'Encode' | ( { } & string )
57
+ export type TParseOperation = 'Assert ' | 'Cast' | ' Clean' | 'Clone ' | 'Convert' | 'Decode ' | 'Default ' | 'Encode' | ( { } & string )
57
58
export type TParseFunction = ( type : TSchema , references : TSchema [ ] , value : unknown ) => unknown
58
59
59
60
// prettier-ignore
60
61
export namespace ParseRegistry {
61
62
const registry = new Map < string , TParseFunction > ( [
62
- [ 'Clone' , ( _type , _references , value : unknown ) => Clone ( value ) ] ,
63
+ [ 'Assert' , ( type , references , value : unknown ) => { Assert ( type , references , value ) ; return value } ] ,
64
+ [ 'Cast' , ( type , references , value : unknown ) => Cast ( type , references , value ) ] ,
63
65
[ 'Clean' , ( type , references , value : unknown ) => Clean ( type , references , value ) ] ,
64
- [ 'Default ' , ( type , references , value : unknown ) => Default ( type , references , value ) ] ,
66
+ [ 'Clone ' , ( _type , _references , value : unknown ) => Clone ( value ) ] ,
65
67
[ 'Convert' , ( type , references , value : unknown ) => Convert ( type , references , value ) ] ,
66
- [ 'Assert' , ( type , references , value : unknown ) => { Assert ( type , references , value ) ; return value } ] ,
67
68
[ 'Decode' , ( type , references , value : unknown ) => ( HasTransform ( type , references ) ? TransformDecode ( type , references , value ) : value ) ] ,
69
+ [ 'Default' , ( type , references , value : unknown ) => Default ( type , references , value ) ] ,
68
70
[ 'Encode' , ( type , references , value : unknown ) => ( HasTransform ( type , references ) ? TransformEncode ( type , references , value ) : value ) ] ,
69
71
] )
70
72
// Deletes an entry from the registry
@@ -81,7 +83,7 @@ export namespace ParseRegistry {
81
83
}
82
84
}
83
85
// ------------------------------------------------------------------
84
- // Default Parse Sequence
86
+ // Default Parse Pipeline
85
87
// ------------------------------------------------------------------
86
88
// prettier-ignore
87
89
export const ParseDefault = [
0 commit comments