File tree Expand file tree Collapse file tree
packages/chaingraph-trpc/server/procedures/flow Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,9 +26,15 @@ import {
2626} from '@badaitech/chaingraph-types'
2727import { NodeStatus } from '@badaitech/chaingraph-types'
2828import { SerializedEdgeSchema , SerializedNodeSchema } from '@badaitech/chaingraph-types'
29+ import { customAlphabet } from 'nanoid'
30+ import { nolookalikes } from 'nanoid-dictionary'
2931import { z } from 'zod'
3032import { flowContextProcedure } from '../../trpc'
3133
34+ function generateEdgeID ( ) : string {
35+ return `ED${ customAlphabet ( nolookalikes , 18 ) ( ) } `
36+ }
37+
3238// Input schema for position
3339const PositionSchema = z . object ( {
3440 x : z . number ( ) ,
@@ -226,7 +232,7 @@ export const pasteNodes = flowContextProcedure
226232 }
227233
228234 const edge = new Edge (
229- edgeData . id ,
235+ generateEdgeID ( ) ,
230236 sourceNode ,
231237 sourcePort ,
232238 targetNode ,
You can’t perform that action at this time.
0 commit comments