From 935e47ef91859c727999629d4d18092dd67cb307 Mon Sep 17 00:00:00 2001 From: diy0r Date: Tue, 3 Sep 2024 23:40:36 +0500 Subject: [PATCH] fix: add type to createArcs --- lib/interfaces/graph.interface.ts | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/lib/interfaces/graph.interface.ts b/lib/interfaces/graph.interface.ts index ab10ca7..3800126 100644 --- a/lib/interfaces/graph.interface.ts +++ b/lib/interfaces/graph.interface.ts @@ -1,4 +1,10 @@ -import { IPredicate, IUpdater, IVertex, uuidType } from './params.interface'; +import { + IPredicate, + IUpdater, + IUuidArray, + IVertex, + uuidType, +} from './params.interface'; export abstract class FileGraphAbstract { /** @@ -81,11 +87,11 @@ export abstract class FileGraphAbstract { * Each vertex will be connected to the previous and next vertex in the given list of IDs. * If the vertices are already connected, no duplicate connections will be created. * - * @param {uuidType[]} ids - An array of vertex IDs between which to create edges. The vertices will be connected in the order they appear in the array. + * @param {IUuidArray[]} ids - An array of vertex IDs between which to create edges. The vertices will be connected in the order they appear in the array. * * @returns {Promise} A promise that resolves to a boolean indicating whether the edge creation was successful. */ - public abstract createEdge(ids: uuidType[]): Promise; + public abstract createEdge(ids: IUuidArray): Promise; /** * Creates an arc (edge) from one vertex to another in the graph. @@ -104,6 +110,20 @@ export abstract class FileGraphAbstract { targetVertexId: uuidType, ): Promise; + /** + * Creates directed arcs between vertices in the order specified by their IDs. + * + * This method takes an array of vertex IDs and creates directed arcs (links) from each vertex + * to the next vertex in the provided array. If an arc already exists between two vertices, + * it will not be duplicated. + * + * @param {IUuidArray} ids - An array of vertex IDs representing the order of vertices + * for which arcs (directed edges) should be created. + * @returns {Promise} - A promise that resolves to a boolean indicating whether + * the update was successful. + */ + public abstract createArcs(ids: IUuidArray): Promise; + /** * Removes an arc (edge) between two vertices in the graph. *