@@ -17,6 +17,9 @@ export type Bundle = {
1717 spaces : Map < Id , Space >
1818 traits : Map < Id , Trait < Id > >
1919 theorems : Map < Id , Theorem >
20+ lean ?: {
21+ properties : { id : string ; module : string } [ ]
22+ }
2023 version : Version
2124}
2225
@@ -26,6 +29,16 @@ export const serializedSchema = z.object({
2629 theorems : z . array ( theoremSchema ) ,
2730 traits : z . array ( traitSchema ( z . string ( ) ) ) ,
2831 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 ( ) ,
2942} )
3043
3144export type Serialized = z . infer < typeof serializedSchema >
@@ -41,14 +54,16 @@ export function serialize(bundle: Bundle): Serialized {
4154}
4255
4356export function deserialize ( data : unknown ) : Bundle {
44- const serialized = serializedSchema . parse ( data )
57+ const { properties, spaces, theorems, traits, version, lean } =
58+ serializedSchema . parse ( data )
4559
4660 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,
5267 }
5368}
5469
0 commit comments