@@ -17,6 +17,9 @@ export type Bundle = {
17
17
spaces : Map < Id , Space >
18
18
traits : Map < Id , Trait < Id > >
19
19
theorems : Map < Id , Theorem >
20
+ lean ?: {
21
+ properties : { id : string ; module : string } [ ]
22
+ }
20
23
version : Version
21
24
}
22
25
@@ -26,6 +29,16 @@ export const serializedSchema = z.object({
26
29
theorems : z . array ( theoremSchema ) ,
27
30
traits : z . array ( traitSchema ( z . string ( ) ) ) ,
28
31
version : z . object ( { ref : z . string ( ) , sha : z . string ( ) } ) ,
32
+ lean : z
33
+ . object ( {
34
+ properties : z . array (
35
+ z . object ( {
36
+ id : z . string ( ) ,
37
+ module : z . string ( ) ,
38
+ } ) ,
39
+ ) ,
40
+ } )
41
+ . optional ( ) ,
29
42
} )
30
43
31
44
export type Serialized = z . infer < typeof serializedSchema >
@@ -41,14 +54,16 @@ export function serialize(bundle: Bundle): Serialized {
41
54
}
42
55
43
56
export function deserialize ( data : unknown ) : Bundle {
44
- const serialized = serializedSchema . parse ( data )
57
+ const { properties, spaces, theorems, traits, version, lean } =
58
+ serializedSchema . parse ( data )
45
59
46
60
return {
47
- properties : indexBy ( serialized . properties , p => p . uid ) ,
48
- spaces : indexBy ( serialized . spaces , s => s . uid ) ,
49
- theorems : indexBy ( serialized . theorems , t => t . uid ) ,
50
- traits : indexBy ( serialized . traits , traitId ) ,
51
- version : serialized . version ,
61
+ properties : indexBy ( properties , p => p . uid ) ,
62
+ spaces : indexBy ( spaces , s => s . uid ) ,
63
+ theorems : indexBy ( theorems , t => t . uid ) ,
64
+ traits : indexBy ( traits , traitId ) ,
65
+ lean,
66
+ version,
52
67
}
53
68
}
54
69
0 commit comments