refactor(graph): ♻️ Add Edges table in Typebot
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import { PublicTypebot as PublicTypebotFromPrisma } from 'db'
|
||||
import { Block, ChoiceItem, Settings, Step, Theme } from './typebot'
|
||||
import { Block, ChoiceItem, Edge, Settings, Step, Theme } from './typebot'
|
||||
import { Variable } from './typebot/variable'
|
||||
import { Table } from './utils'
|
||||
|
||||
@ -17,6 +17,7 @@ export type PublicTypebot = Omit<
|
||||
steps: Table<Step>
|
||||
choiceItems: Table<ChoiceItem>
|
||||
variables: Table<Variable>
|
||||
edges: Table<Edge>
|
||||
theme: Theme
|
||||
settings: Settings
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { Target } from '.'
|
||||
import { StepBase } from './steps'
|
||||
|
||||
export type InputStep =
|
||||
@ -66,7 +65,7 @@ export type ChoiceItem = {
|
||||
id: string
|
||||
stepId: string
|
||||
content?: string
|
||||
target?: Target
|
||||
edgeId?: string
|
||||
}
|
||||
|
||||
type OptionBase = { variableId?: string }
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { StepBase, Target } from '.'
|
||||
import { StepBase } from '.'
|
||||
import { Table } from '../..'
|
||||
|
||||
export type LogicStep = SetVariableStep | ConditionStep
|
||||
@ -32,8 +32,8 @@ export enum ComparisonOperators {
|
||||
export type ConditionStep = StepBase & {
|
||||
type: LogicStepType.CONDITION
|
||||
options: ConditionOptions
|
||||
trueTarget?: Target
|
||||
falseTarget?: Target
|
||||
trueEdgeId?: string
|
||||
falseEdgeId?: string
|
||||
}
|
||||
|
||||
export type ConditionOptions = {
|
||||
|
@ -36,11 +36,9 @@ export type StepOptions =
|
||||
| LogicStepOptions
|
||||
| IntegrationStepOptions
|
||||
|
||||
export type StepBase = { id: string; blockId: string; target?: Target }
|
||||
export type StepBase = { id: string; blockId: string; edgeId?: string }
|
||||
|
||||
export type StartStep = StepBase & {
|
||||
type: 'start'
|
||||
label: string
|
||||
}
|
||||
|
||||
export type Target = { blockId: string; stepId?: string }
|
||||
|
@ -14,6 +14,7 @@ export type Typebot = Omit<
|
||||
steps: Table<Step>
|
||||
choiceItems: Table<ChoiceItem>
|
||||
variables: Table<Variable>
|
||||
edges: Table<Edge>
|
||||
theme: Theme
|
||||
settings: Settings
|
||||
}
|
||||
@ -27,3 +28,16 @@ export type Block = {
|
||||
}
|
||||
stepIds: string[]
|
||||
}
|
||||
|
||||
export type Source = {
|
||||
blockId: string
|
||||
stepId: string
|
||||
nodeId?: string
|
||||
conditionType?: 'true' | 'false'
|
||||
}
|
||||
export type Target = { blockId: string; stepId?: string }
|
||||
export type Edge = {
|
||||
id: string
|
||||
from: Source
|
||||
to: Target
|
||||
}
|
||||
|
Reference in New Issue
Block a user