Skip to content

Commit e4b0039

Browse files
committed
wip
1 parent 104dd9e commit e4b0039

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

packages/core/src/Bundle.ts

+21-6
Original file line numberDiff line numberDiff line change
@@ -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: { name: string; id: 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+
name: z.string(),
38+
}),
39+
),
40+
})
41+
.optional(),
2942
})
3043

3144
export type Serialized = z.infer<typeof serializedSchema>
@@ -41,14 +54,16 @@ export function serialize(bundle: Bundle): Serialized {
4154
}
4255

4356
export 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

packages/viewer/src/gateway.ts

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export function sync(
3030
return async (host: string, branch: string, etag?: string) => {
3131
trace({ event: 'remote_fetch_started', host, branch })
3232
const result = await pb.bundle.fetch({ host, branch, etag, fetch })
33+
console.log('fetched', result)
3334

3435
if (result) {
3536
trace({ event: 'remote_fetch_complete', result })

0 commit comments

Comments
 (0)