-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathknowledge-model-data.ts
More file actions
41 lines (35 loc) · 1.35 KB
/
knowledge-model-data.ts
File metadata and controls
41 lines (35 loc) · 1.35 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
import { z } from 'zod'
import { makeJsonCodecSimple } from '../utils'
import { AnnotationDataSchema } from './annotation-data'
export const EntityDataSchema = z
.object({
uuid: z.string(),
annotations: z.array(AnnotationDataSchema).optional(),
})
.loose()
export const EntityMapDataSchema = z.record(z.string(), EntityDataSchema)
export const KnowledgeModelDataSchema = z
.object({
entities: z.object({
answers: EntityMapDataSchema,
chapters: EntityMapDataSchema,
choices: EntityMapDataSchema,
experts: EntityMapDataSchema,
integrations: EntityMapDataSchema,
metrics: EntityMapDataSchema,
phases: EntityMapDataSchema,
questions: EntityMapDataSchema,
references: EntityMapDataSchema,
resourceCollections: EntityMapDataSchema,
resourcePages: EntityMapDataSchema,
tags: EntityMapDataSchema,
}),
structure: z.object({
questions: EntityMapDataSchema,
}),
})
.loose()
export type EntityData = z.infer<typeof EntityDataSchema>
export type EntityMapData = z.infer<typeof EntityMapDataSchema>
export type KnowledgeModelData = z.infer<typeof KnowledgeModelDataSchema>
export const KnowledgeModelDataCodec = makeJsonCodecSimple(KnowledgeModelDataSchema)