@ -1,9 +0,0 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const itemBaseSchema = z.object({
|
||||
id: z.string(),
|
||||
blockId: z.string().optional().describe('Deprecated'),
|
||||
outgoingEdgeId: z.string().optional(),
|
||||
})
|
||||
|
||||
export type ItemBase = z.infer<typeof itemBaseSchema>
|
1
packages/schemas/features/items/constants.ts
Normal file
1
packages/schemas/features/items/constants.ts
Normal file
@ -0,0 +1 @@
|
||||
|
@ -1,6 +0,0 @@
|
||||
export enum ItemType {
|
||||
BUTTON,
|
||||
CONDITION,
|
||||
AB_TEST,
|
||||
PICTURE_CHOICE,
|
||||
}
|
@ -1,4 +1,2 @@
|
||||
export * from './baseSchemas'
|
||||
export * from './enums'
|
||||
export * from './schemas'
|
||||
export * from './schema'
|
||||
export * from './types'
|
||||
|
30
packages/schemas/features/items/schema.ts
Normal file
30
packages/schemas/features/items/schema.ts
Normal file
@ -0,0 +1,30 @@
|
||||
import { z } from 'zod'
|
||||
import {
|
||||
buttonItemSchemas,
|
||||
conditionItemSchemas,
|
||||
pictureChoiceItemSchemas,
|
||||
aItemSchemas,
|
||||
bItemSchemas,
|
||||
} from '../blocks'
|
||||
|
||||
const itemSchemas = {
|
||||
v5: z.union([
|
||||
buttonItemSchemas.v5,
|
||||
conditionItemSchemas.v5,
|
||||
pictureChoiceItemSchemas.v5,
|
||||
aItemSchemas.v5,
|
||||
bItemSchemas.v5,
|
||||
]),
|
||||
v6: z.union([
|
||||
buttonItemSchemas.v6,
|
||||
conditionItemSchemas.v6,
|
||||
pictureChoiceItemSchemas.v6,
|
||||
aItemSchemas.v6,
|
||||
bItemSchemas.v6,
|
||||
]),
|
||||
} as const
|
||||
|
||||
const itemSchema = z.union([itemSchemas.v5, itemSchemas.v6])
|
||||
export type Item = z.infer<typeof itemSchema>
|
||||
export type ItemV5 = z.infer<typeof itemSchemas.v5>
|
||||
export type ItemV6 = z.infer<typeof itemSchemas.v6>
|
@ -1,15 +0,0 @@
|
||||
import { z } from 'zod'
|
||||
import { buttonItemSchema } from '../blocks/inputs/choice'
|
||||
import { conditionItemSchema } from '../blocks/logic/condition'
|
||||
import { aItemSchema, bItemSchema } from '../blocks'
|
||||
import { pictureChoiceItemSchema } from '../blocks/inputs/pictureChoice'
|
||||
|
||||
const itemSchema = z.union([
|
||||
buttonItemSchema,
|
||||
conditionItemSchema,
|
||||
pictureChoiceItemSchema,
|
||||
aItemSchema,
|
||||
bItemSchema,
|
||||
])
|
||||
|
||||
export type Item = z.infer<typeof itemSchema>
|
16
packages/schemas/features/items/shared.ts
Normal file
16
packages/schemas/features/items/shared.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
const itemBaseV5Schema = z.object({
|
||||
id: z.string(),
|
||||
blockId: z.string().optional(),
|
||||
outgoingEdgeId: z.string().optional(),
|
||||
})
|
||||
|
||||
export const itemBaseSchemas = {
|
||||
v5: itemBaseV5Schema,
|
||||
v6: itemBaseV5Schema.omit({ blockId: true }),
|
||||
}
|
||||
|
||||
export const itemBaseSchema = z.union([itemBaseSchemas.v5, itemBaseSchemas.v6])
|
||||
|
||||
export type ItemBase = z.infer<typeof itemBaseSchema>
|
Reference in New Issue
Block a user