-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathtypes.ts
More file actions
70 lines (59 loc) · 1.91 KB
/
Copy pathtypes.ts
File metadata and controls
70 lines (59 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/**
* Generated from https://github.com/CCIP-App/schedule-json-validator/blob/38cff3eabbde4cb6d84e3a19accf7e620a29eab7/schemas/opass-schedule.v1.schema.json
*/
import { z } from 'zod'
const idSchema = z.string().min(1)
const stringListSchema = z.array(z.string())
const localizedSessionSchema = z.looseObject({
title: z.string(),
description: z.string(),
})
const localizedSpeakerSchema = z.looseObject({
name: z.string(),
bio: z.string(),
})
const localizedNameSchema = z.looseObject({
name: z.string(),
description: z.string().optional(),
})
export const opassSessionSchema = z.looseObject({
id: idSchema,
room: idSchema,
type: idSchema.optional(),
start: z.iso.datetime({ offset: true }),
end: z.iso.datetime({ offset: true }),
zh: localizedSessionSchema,
en: localizedSessionSchema,
speakers: stringListSchema,
tags: stringListSchema,
broadcast: stringListSchema.optional(),
uri: z.string().optional(),
qa: z.string().optional(),
slide: z.string().optional(),
live: z.string().optional(),
record: z.string().optional(),
language: z.string().optional(),
co_write: z.string().optional(),
})
export const opassSpeakerSchema = z.looseObject({
id: idSchema,
avatar: z.string(),
zh: localizedSpeakerSchema,
en: localizedSpeakerSchema,
})
export const opassNamedEntitySchema = z.looseObject({
id: idSchema,
zh: localizedNameSchema,
en: localizedNameSchema,
})
export const opassScheduleSchema = z.looseObject({
sessions: z.array(opassSessionSchema),
speakers: z.array(opassSpeakerSchema),
session_types: z.array(opassNamedEntitySchema),
rooms: z.array(opassNamedEntitySchema),
tags: z.array(opassNamedEntitySchema),
})
export type OpassSession = z.infer<typeof opassSessionSchema>
export type OpassSpeaker = z.infer<typeof opassSpeakerSchema>
export type OpassNamedEntity = z.infer<typeof opassNamedEntitySchema>
export type OpassSchedule = z.infer<typeof opassScheduleSchema>