|
| 1 | +import { z } from 'zod'; |
| 2 | +import { DateTimeSchema, IdSchema, KeyValuePairInputSchema, VersionLabelSchema } from '../../shared'; |
| 3 | +import { FlowStageActionNotProcessedBehaviorSchema, FlowStageActionTypeSchema, FlowTypeSchema } from './flow'; |
| 4 | + |
| 5 | +export const FlowStageMoveActionTypeSchema = z.enum(['advance', 'move', 'removeFromFlow']); |
| 6 | +export type FlowStageMoveActionType = z.infer<typeof FlowStageMoveActionTypeSchema>; |
| 7 | + |
| 8 | +export const FlowStageActionMoveInputSchema = z.object({ |
| 9 | + targetStageIdentifier: z.string().min(1), |
| 10 | +}); |
| 11 | +export type FlowStageActionMoveInput = z.infer<typeof FlowStageActionMoveInputSchema>; |
| 12 | + |
| 13 | +export const FlowStageMoveActionInputSchema = z.object({ |
| 14 | + action: FlowStageMoveActionTypeSchema, |
| 15 | + move: FlowStageActionMoveInputSchema.nullish(), |
| 16 | +}); |
| 17 | +export type FlowStageMoveActionInput = z.infer<typeof FlowStageMoveActionInputSchema>; |
| 18 | + |
| 19 | +export const FlowStageActionPublishInputSchema = z.object({ |
| 20 | + onFailure: FlowStageMoveActionInputSchema.nullish(), |
| 21 | +}); |
| 22 | +export type FlowStageActionPublishInput = z.infer<typeof FlowStageActionPublishInputSchema>; |
| 23 | + |
| 24 | +export const FlowStageActionUnpublishInputSchema = z.object({ |
| 25 | + onFailure: FlowStageMoveActionInputSchema.nullish(), |
| 26 | +}); |
| 27 | +export type FlowStageActionUnpublishInput = z.infer<typeof FlowStageActionUnpublishInputSchema>; |
| 28 | + |
| 29 | +export const FlowStageActionWaitAbsoluteInputSchema = z.object({ |
| 30 | + until: DateTimeSchema, |
| 31 | +}); |
| 32 | +export type FlowStageActionWaitAbsoluteInput = z.infer<typeof FlowStageActionWaitAbsoluteInputSchema>; |
| 33 | + |
| 34 | +export const FlowStageActionWaitIndividualInputSchema = z.object({ |
| 35 | + onExpiredDatetime: FlowStageActionNotProcessedBehaviorSchema.nullish(), |
| 36 | + onMissingDatetime: FlowStageActionNotProcessedBehaviorSchema.nullish(), |
| 37 | +}); |
| 38 | +export type FlowStageActionWaitIndividualInput = z.infer<typeof FlowStageActionWaitIndividualInputSchema>; |
| 39 | + |
| 40 | +export const FlowStageActionWaitRelativeInputSchema = z.object({ |
| 41 | + days: z.int().nullish(), |
| 42 | + hours: z.int().nullish(), |
| 43 | + minutes: z.int().nullish(), |
| 44 | +}); |
| 45 | +export type FlowStageActionWaitRelativeInput = z.infer<typeof FlowStageActionWaitRelativeInputSchema>; |
| 46 | + |
| 47 | +export const FlowStageActionInputSchema = z.object({ |
| 48 | + action: FlowStageActionTypeSchema, |
| 49 | + move: FlowStageActionMoveInputSchema.nullish(), |
| 50 | + publish: FlowStageActionPublishInputSchema.nullish(), |
| 51 | + unpublish: FlowStageActionUnpublishInputSchema.nullish(), |
| 52 | + waitAbsolute: FlowStageActionWaitAbsoluteInputSchema.nullish(), |
| 53 | + waitIndividual: FlowStageActionWaitIndividualInputSchema.nullish(), |
| 54 | + waitRelative: FlowStageActionWaitRelativeInputSchema.nullish(), |
| 55 | +}); |
| 56 | +export type FlowStageActionInput = z.infer<typeof FlowStageActionInputSchema>; |
| 57 | + |
| 58 | +export const ItemFlowRestrictionsInputSchema = z.object({ |
| 59 | + acceptedShapeIdentifiers: z.array(z.string().min(1)).nullish(), |
| 60 | +}); |
| 61 | +export type ItemFlowRestrictionsInput = z.infer<typeof ItemFlowRestrictionsInputSchema>; |
| 62 | + |
| 63 | +export const FlowRestrictionsInputSchema = z.object({ |
| 64 | + item: ItemFlowRestrictionsInputSchema.nullish(), |
| 65 | +}); |
| 66 | +export type FlowRestrictionsInput = z.infer<typeof FlowRestrictionsInputSchema>; |
| 67 | + |
| 68 | +export const EmbeddedFlowStageInputSchema = z.object({ |
| 69 | + actions: z.array(FlowStageActionInputSchema).nullish(), |
| 70 | + identifier: z.string().min(1), |
| 71 | + meta: z.array(KeyValuePairInputSchema).nullish(), |
| 72 | + name: z.string().min(1), |
| 73 | +}); |
| 74 | +export type EmbeddedFlowStageInput = z.infer<typeof EmbeddedFlowStageInputSchema>; |
| 75 | + |
| 76 | +export const CreateFlowInputSchema = z.object({ |
| 77 | + meta: z.array(KeyValuePairInputSchema).nullish(), |
| 78 | + name: z.string().min(1), |
| 79 | + restrictions: FlowRestrictionsInputSchema.nullish(), |
| 80 | + stages: z.array(EmbeddedFlowStageInputSchema), |
| 81 | + type: FlowTypeSchema, |
| 82 | +}); |
| 83 | +export type CreateFlowInput = z.infer<typeof CreateFlowInputSchema>; |
| 84 | + |
| 85 | +export const UpdateFlowInputSchema = z.object({ |
| 86 | + meta: z.array(KeyValuePairInputSchema).nullish(), |
| 87 | + name: z.string().min(1).nullish(), |
| 88 | + restrictions: FlowRestrictionsInputSchema.nullish(), |
| 89 | + stages: z.array(EmbeddedFlowStageInputSchema).nullish(), |
| 90 | +}); |
| 91 | +export type UpdateFlowInput = z.infer<typeof UpdateFlowInputSchema>; |
| 92 | + |
| 93 | +export const FlowContentActionConfigWaitIndividualInputSchema = z.object({ |
| 94 | + until: DateTimeSchema, |
| 95 | +}); |
| 96 | +export type FlowContentActionConfigWaitIndividualInput = z.infer< |
| 97 | + typeof FlowContentActionConfigWaitIndividualInputSchema |
| 98 | +>; |
| 99 | + |
| 100 | +export const FlowContentActionConfigInputSchema = z.object({ |
| 101 | + stageIdentifier: z.string().min(1).optional(), |
| 102 | + waitIndividual: FlowContentActionConfigWaitIndividualInputSchema.optional(), |
| 103 | +}); |
| 104 | +export type FlowContentActionConfigInput = z.infer<typeof FlowContentActionConfigInputSchema>; |
| 105 | + |
| 106 | +export const ItemFlowStageAssociationInputSchema = z.object({ |
| 107 | + id: IdSchema, |
| 108 | + language: z.string().min(1).optional(), |
| 109 | + version: VersionLabelSchema.optional(), |
| 110 | +}); |
| 111 | +export type ItemFlowStageAssociationInput = z.infer<typeof ItemFlowStageAssociationInputSchema>; |
0 commit comments