mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-07 11:10:11 +08:00
feat: add global exceptions
This commit is contained in:
1 parent
fb823814e0
commit
cfce5ececa
6 files changed
+71
-5
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { z } from 'zod'
|
||||
import { conditionSchema } from './condition.js'
|
||||
import { responseSchema } from './response.js'
|
||||
import { requirementsSchema } from './requirements.js'
|
||||
|
||||
export const exceptionSchema = z.object({
|
||||
id: z.string(),
|
||||
@@ -17,7 +18,7 @@ export const stageExceptionSchema = exceptionSchema.extend({
|
||||
export type StageException = z.infer<typeof stageExceptionSchema>
|
||||
|
||||
export const globalExceptionSchema = exceptionSchema.extend({
|
||||
requirements: z.array(z.string()),
|
||||
requirements: requirementsSchema.default([]),
|
||||
})
|
||||
|
||||
export type GlobalException = z.infer<typeof globalExceptionSchema>
|
||||
@@ -1,8 +1,7 @@
|
||||
import { z } from 'zod'
|
||||
import { stageSchema } from './stage.js'
|
||||
import { requirementsSchema } from './requirements.js'
|
||||
// import { globalExceptionSchema } from './exception.js'
|
||||
// import { requirementSchema } from './requirement.js'
|
||||
import { globalExceptionSchema } from './exception.js'
|
||||
|
||||
export const questSchema = z.object({
|
||||
id: z.string(),
|
||||
@@ -11,7 +10,7 @@ export const questSchema = z.object({
|
||||
instruction: z.string(),
|
||||
requirements: requirementsSchema,
|
||||
stages: z.array(stageSchema),
|
||||
// exceptions: z.array(globalExceptionSchema).default([]),
|
||||
exceptions: z.array(globalExceptionSchema).optional(),
|
||||
})
|
||||
|
||||
export type IQuest = z.infer<typeof questSchema>
|
||||
Reference in new issue
Block a user