diff --git a/packages/graph-explorer/src/connector/gremlin/queries/fetchNeighbors.test.ts b/packages/graph-explorer/src/connector/gremlin/queries/fetchNeighbors.test.ts index 77f936df7..43b358f87 100644 --- a/packages/graph-explorer/src/connector/gremlin/queries/fetchNeighbors.test.ts +++ b/packages/graph-explorer/src/connector/gremlin/queries/fetchNeighbors.test.ts @@ -1,6 +1,7 @@ import globalMockFetch from "@/connector/testUtils/globalMockFetch"; import mockGremlinFetch from "@/connector/testUtils/mockGremlinFetch"; import fetchNeighbors from "./fetchNeighbors"; +import { VertexId } from "@/@types/entities"; describe("Gremlin > fetchNeighbors", () => { beforeEach(globalMockFetch); @@ -89,8 +90,7 @@ describe("Gremlin > fetchNeighbors", () => { ]; const response = await fetchNeighbors(mockGremlinFetch(), { - vertexId: "2018", - idType: "string", + vertex: { id: "2018" as VertexId, idType: "string" }, vertexType: "airport", }); @@ -224,8 +224,7 @@ describe("Gremlin > fetchNeighbors", () => { ]; const response = await fetchNeighbors(mockGremlinFetch(), { - vertexId: "2018", - idType: "string", + vertex: { id: "2018" as VertexId, idType: "string" }, vertexType: "airport", filterByVertexTypes: ["airport"], filterCriteria: [{ name: "code", value: "TF", operator: "LIKE" }], diff --git a/packages/graph-explorer/src/connector/gremlin/queries/fetchNeighborsCount.test.ts b/packages/graph-explorer/src/connector/gremlin/queries/fetchNeighborsCount.test.ts index b9ed680fc..d4d69dc66 100644 --- a/packages/graph-explorer/src/connector/gremlin/queries/fetchNeighborsCount.test.ts +++ b/packages/graph-explorer/src/connector/gremlin/queries/fetchNeighborsCount.test.ts @@ -1,14 +1,17 @@ import globalMockFetch from "@/connector/testUtils/globalMockFetch"; import mockGremlinFetch from "@/connector/testUtils/mockGremlinFetch"; import fetchNeighborsCount from "./fetchNeighborsCount"; +import { VertexId } from "@/@types/entities"; describe("Gremlin > fetchNeighborsCount", () => { beforeEach(globalMockFetch); it("Should return neighbors counts for node 2018", async () => { const response = await fetchNeighborsCount(mockGremlinFetch(), { - vertexId: "123", - idType: "string", + vertex: { + id: "123" as VertexId, + idType: "string", + }, }); expect(response).toMatchObject({ diff --git a/packages/graph-explorer/src/connector/gremlin/templates/neighborsCountTemplate.test.ts b/packages/graph-explorer/src/connector/gremlin/templates/neighborsCountTemplate.test.ts index 6c202e459..837ffcd87 100644 --- a/packages/graph-explorer/src/connector/gremlin/templates/neighborsCountTemplate.test.ts +++ b/packages/graph-explorer/src/connector/gremlin/templates/neighborsCountTemplate.test.ts @@ -1,11 +1,11 @@ +import { VertexId } from "@/@types/entities"; import neighborsCountTemplate from "./neighborsCountTemplate"; import { normalizeWithNoSpace as normalize } from "@/utils/testing"; describe("Gremlin > neighborsCountTemplate", () => { it("Should return a template for the given vertex id", () => { const template = neighborsCountTemplate({ - vertexId: "12", - idType: "string", + vertex: { id: "12" as VertexId, idType: "string" }, }); expect(normalize(template)).toBe( @@ -17,8 +17,7 @@ describe("Gremlin > neighborsCountTemplate", () => { it("Should return a template for the given vertex id with number type", () => { const template = neighborsCountTemplate({ - vertexId: "12", - idType: "number", + vertex: { id: "12" as VertexId, idType: "number" }, }); expect(normalize(template)).toBe( @@ -30,8 +29,7 @@ describe("Gremlin > neighborsCountTemplate", () => { it("Should return a template for the given vertex id with defined limit", () => { const template = neighborsCountTemplate({ - vertexId: "12", - idType: "string", + vertex: { id: "12" as VertexId, idType: "string" }, limit: 20, }); @@ -44,8 +42,7 @@ describe("Gremlin > neighborsCountTemplate", () => { it("Should return a template for the given vertex id with no limit", () => { const template = neighborsCountTemplate({ - vertexId: "12", - idType: "string", + vertex: { id: "12" as VertexId, idType: "string" }, limit: 0, }); diff --git a/packages/graph-explorer/src/connector/gremlin/templates/neighborsCountTemplate.ts b/packages/graph-explorer/src/connector/gremlin/templates/neighborsCountTemplate.ts index 3a18499cb..cdd90bb29 100644 --- a/packages/graph-explorer/src/connector/gremlin/templates/neighborsCountTemplate.ts +++ b/packages/graph-explorer/src/connector/gremlin/templates/neighborsCountTemplate.ts @@ -12,15 +12,14 @@ import type { NeighborsCountRequest } from "@/connector/useGEFetchTypes"; * .group().by(label).by(count()) */ export default function neighborsCountTemplate({ - vertexId, + vertex, limit = 0, - idType, }: NeighborsCountRequest) { let template = ""; - if (idType === "number") { - template = `g.V(${vertexId}L).both()`; + if (vertex.idType === "number") { + template = `g.V(${vertex.id}L).both()`; } else { - template = `g.V("${vertexId}").both()`; + template = `g.V("${vertex.id}").both()`; } if (limit > 0) { diff --git a/packages/graph-explorer/src/connector/gremlin/templates/oneHopTemplate.test.ts b/packages/graph-explorer/src/connector/gremlin/templates/oneHopTemplate.test.ts index d207cd0f6..1e6b9cc34 100644 --- a/packages/graph-explorer/src/connector/gremlin/templates/oneHopTemplate.test.ts +++ b/packages/graph-explorer/src/connector/gremlin/templates/oneHopTemplate.test.ts @@ -1,11 +1,11 @@ import { normalizeWithNoSpace as normalize } from "@/utils/testing"; import oneHopTemplate from "./oneHopTemplate"; +import { VertexId } from "@/@types/entities"; describe("Gremlin > oneHopTemplate", () => { it("Should return a template for a simple vertex id", () => { const template = oneHopTemplate({ - vertexId: "12", - idType: "string", + vertex: { id: "12" as VertexId, idType: "string" }, }); expect(normalize(template)).toBe( @@ -25,8 +25,7 @@ describe("Gremlin > oneHopTemplate", () => { it("Should return a template for a simple vertex id with number type", () => { const template = oneHopTemplate({ - vertexId: "12", - idType: "number", + vertex: { id: "12" as VertexId, idType: "number" }, }); expect(normalize(template)).toBe( @@ -46,8 +45,7 @@ describe("Gremlin > oneHopTemplate", () => { it("Should return a template with an offset and limit", () => { const template = oneHopTemplate({ - vertexId: "12", - idType: "string", + vertex: { id: "12" as VertexId, idType: "string" }, offset: 5, limit: 5, }); @@ -69,8 +67,7 @@ describe("Gremlin > oneHopTemplate", () => { it("Should return a template for specific vertex type", () => { const template = oneHopTemplate({ - vertexId: "12", - idType: "string", + vertex: { id: "12" as VertexId, idType: "string" }, filterByVertexTypes: ["country"], offset: 5, limit: 10, @@ -93,8 +90,7 @@ describe("Gremlin > oneHopTemplate", () => { it("Should return a template for multiple vertex type", () => { const template = oneHopTemplate({ - vertexId: "12", - idType: "string", + vertex: { id: "12" as VertexId, idType: "string" }, filterByVertexTypes: ["country", "airport", "continent"], offset: 5, limit: 10, @@ -117,8 +113,7 @@ describe("Gremlin > oneHopTemplate", () => { it("Should return a template with specific filter criteria", () => { const template = oneHopTemplate({ - vertexId: "12", - idType: "string", + vertex: { id: "12" as VertexId, idType: "string" }, filterByVertexTypes: ["country"], filterCriteria: [ { name: "longest", value: 10000, operator: "gte", dataType: "Number" }, diff --git a/packages/graph-explorer/src/connector/gremlin/templates/oneHopTemplate.ts b/packages/graph-explorer/src/connector/gremlin/templates/oneHopTemplate.ts index ab8e4762f..19c6878fe 100644 --- a/packages/graph-explorer/src/connector/gremlin/templates/oneHopTemplate.ts +++ b/packages/graph-explorer/src/connector/gremlin/templates/oneHopTemplate.ts @@ -127,15 +127,15 @@ function criterionTemplate(criterion: Criterion): string { * ) */ export default function oneHopTemplate({ - vertexId, - idType, + vertex, filterByVertexTypes = [], edgeTypes = [], filterCriteria = [], limit = 0, offset = 0, }: Omit): string { - const idTemplate = idType === "number" ? `${vertexId}L` : `"${vertexId}"`; + const idTemplate = + vertex.idType === "number" ? `${vertex.id}L` : `"${vertex.id}"`; const range = limit > 0 ? `.range(${offset}, ${offset + limit})` : ""; const vertexTypes = filterByVertexTypes.flatMap(type => type.split("::")); diff --git a/packages/graph-explorer/src/connector/openCypher/templates/neighborsCountTemplate.test.ts b/packages/graph-explorer/src/connector/openCypher/templates/neighborsCountTemplate.test.ts index ed95e9e00..6a991fe53 100644 --- a/packages/graph-explorer/src/connector/openCypher/templates/neighborsCountTemplate.test.ts +++ b/packages/graph-explorer/src/connector/openCypher/templates/neighborsCountTemplate.test.ts @@ -1,11 +1,11 @@ import { normalize } from "@/utils/testing"; import neighborsCountTemplate from "./neighborsCountTemplate"; +import { VertexId } from "@/@types/entities"; describe("OpenCypher > neighborsCountTemplate", () => { it("Should return a template for the given vertex id", () => { const template = neighborsCountTemplate({ - vertexId: "12", - idType: "string", + vertex: { id: "12" as VertexId, idType: "string" }, }); expect(normalize(template)).toBe( @@ -22,8 +22,7 @@ describe("OpenCypher > neighborsCountTemplate", () => { it("Should return a template for the given vertex id with defined limit", () => { const template = neighborsCountTemplate({ - vertexId: "12", - idType: "string", + vertex: { id: "12" as VertexId, idType: "string" }, limit: 20, }); @@ -42,8 +41,7 @@ describe("OpenCypher > neighborsCountTemplate", () => { it("Should return a template for the given vertex id with no limit", () => { const template = neighborsCountTemplate({ - vertexId: "12", - idType: "string", + vertex: { id: "12" as VertexId, idType: "string" }, limit: 0, }); diff --git a/packages/graph-explorer/src/connector/openCypher/templates/neighborsCountTemplate.ts b/packages/graph-explorer/src/connector/openCypher/templates/neighborsCountTemplate.ts index 790b52235..4cdaa0e42 100644 --- a/packages/graph-explorer/src/connector/openCypher/templates/neighborsCountTemplate.ts +++ b/packages/graph-explorer/src/connector/openCypher/templates/neighborsCountTemplate.ts @@ -16,12 +16,12 @@ import type { NeighborsCountRequest } from "@/connector/useGEFetchTypes"; * */ export default function neighborsCountTemplate({ - vertexId, + vertex, limit = 0, }: NeighborsCountRequest) { return query` MATCH (v)-[]-(neighbor) - WHERE ID(v) = "${vertexId}" + WHERE ID(v) = "${vertex.id}" WITH DISTINCT neighbor ${limit > 0 ? `LIMIT ${limit}` : ``} RETURN labels(neighbor) AS vertexLabel, count(DISTINCT neighbor) AS count diff --git a/packages/graph-explorer/src/connector/openCypher/templates/oneHopTemplate.test.ts b/packages/graph-explorer/src/connector/openCypher/templates/oneHopTemplate.test.ts index 8ec0214f5..2d6f12f54 100644 --- a/packages/graph-explorer/src/connector/openCypher/templates/oneHopTemplate.test.ts +++ b/packages/graph-explorer/src/connector/openCypher/templates/oneHopTemplate.test.ts @@ -1,11 +1,11 @@ import { normalize } from "@/utils/testing"; import oneHopTemplate from "./oneHopTemplate"; +import { VertexId } from "@/@types/entities"; describe("OpenCypher > oneHopTemplate", () => { it("Should return a template for a simple vertex id", () => { const template = oneHopTemplate({ - vertexId: "12", - idType: "string", + vertex: { id: "12" as VertexId, idType: "string" }, }); expect(normalize(template)).toEqual( @@ -25,8 +25,7 @@ describe("OpenCypher > oneHopTemplate", () => { it("Should return a template with an offset and limit", () => { const template = oneHopTemplate({ - vertexId: "12", - idType: "string", + vertex: { id: "12" as VertexId, idType: "string" }, offset: 5, limit: 5, }); @@ -50,8 +49,7 @@ describe("OpenCypher > oneHopTemplate", () => { it("Should return a template for specific vertex type", () => { const template = oneHopTemplate({ - vertexId: "12", - idType: "string", + vertex: { id: "12" as VertexId, idType: "string" }, filterByVertexTypes: ["country"], offset: 5, limit: 10, @@ -76,8 +74,7 @@ describe("OpenCypher > oneHopTemplate", () => { it("Should return a template for many vertex types", () => { const template = oneHopTemplate({ - vertexId: "12", - idType: "string", + vertex: { id: "12" as VertexId, idType: "string" }, filterByVertexTypes: ["country", "continent", "airport", "person"], }); @@ -98,8 +95,7 @@ describe("OpenCypher > oneHopTemplate", () => { it("Should return a template for specific edge type", () => { const template = oneHopTemplate({ - vertexId: "12", - idType: "string", + vertex: { id: "12" as VertexId, idType: "string" }, edgeTypes: ["locatedIn"], offset: 5, limit: 10, @@ -124,8 +120,7 @@ describe("OpenCypher > oneHopTemplate", () => { it("Should return a template with specific filter criteria", () => { const template = oneHopTemplate({ - vertexId: "12", - idType: "string", + vertex: { id: "12" as VertexId, idType: "string" }, filterByVertexTypes: ["country"], filterCriteria: [ { name: "longest", value: 10000, operator: "gte", dataType: "Number" }, diff --git a/packages/graph-explorer/src/connector/openCypher/templates/oneHopTemplate.ts b/packages/graph-explorer/src/connector/openCypher/templates/oneHopTemplate.ts index 1ed0cccde..0f8ef349c 100644 --- a/packages/graph-explorer/src/connector/openCypher/templates/oneHopTemplate.ts +++ b/packages/graph-explorer/src/connector/openCypher/templates/oneHopTemplate.ts @@ -103,7 +103,7 @@ const criterionTemplate = (criterion: Criterion): string => { * LIMIT 10 */ const oneHopTemplate = ({ - vertexId, + vertex, filterByVertexTypes = [], edgeTypes = [], filterCriteria = [], @@ -129,7 +129,7 @@ const oneHopTemplate = ({ // Combine all the WHERE conditions const whereConditions = [ - `ID(v) = "${vertexId}"`, + `ID(v) = "${vertex.id}"`, formattedVertexTypes, ...(filterCriteria?.map(criterionTemplate) ?? []), ] diff --git a/packages/graph-explorer/src/connector/queries.ts b/packages/graph-explorer/src/connector/queries.ts index cdf1eaf66..8d0df7488 100644 --- a/packages/graph-explorer/src/connector/queries.ts +++ b/packages/graph-explorer/src/connector/queries.ts @@ -4,9 +4,7 @@ import { Explorer, KeywordSearchRequest, KeywordSearchResponse, - NeighborsRequest, - NeighborsResponse, - VertexIdType, + VertexRef, } from "./useGEFetchTypes"; import { VertexId } from "@/@types/entities"; @@ -32,28 +30,6 @@ export function searchQuery( }); } -/** - * Retrieves the neighbor info for the given node using the provided filters to - * limit the results. - * @param request The node and filters. - * @param explorer The service client to use for fetching the neighbors count. - * @returns The nodes and edges for the neighbors or null. - */ -export const neighborsQuery = ( - request: NeighborsRequest | null, - explorer: Explorer | null -) => - queryOptions({ - queryKey: ["neighbors", request, explorer], - enabled: Boolean(explorer) && Boolean(request), - queryFn: async (): Promise => { - if (!explorer || !request) { - return null; - } - return await explorer.fetchNeighbors(request); - }, - }); - export type NeighborCountsQueryResponse = { nodeId: VertexId; totalCount: number; @@ -66,19 +42,20 @@ export type NeighborCountsQueryResponse = { * @param explorer The service client to use for fetching the neighbors count. * @returns The count of neighbors for the given node as a total and per type. */ -export const neighborsCountQuery = ( - id: VertexId, - idType: VertexIdType, +export function neighborsCountQuery( + vertex: VertexRef, limit: number | undefined, explorer: Explorer | null -) => - queryOptions({ +) { + // Ensure the query key remains stable by removing extra properties from the vertex + const { id, idType } = vertex; + + return queryOptions({ queryKey: ["neighborsCount", id, idType, limit, explorer], enabled: Boolean(explorer), queryFn: async (): Promise => { const result = await explorer?.fetchNeighborsCount({ - vertexId: id.toString(), - idType: idType, + vertex: { id, idType }, limit, }); @@ -93,6 +70,7 @@ export const neighborsCountQuery = ( }; }, }); +} /** * Retrieves the count of nodes for a specific node type. diff --git a/packages/graph-explorer/src/connector/sparql/sparqlExplorer.ts b/packages/graph-explorer/src/connector/sparql/sparqlExplorer.ts index 6bb7782fa..95af55836 100644 --- a/packages/graph-explorer/src/connector/sparql/sparqlExplorer.ts +++ b/packages/graph-explorer/src/connector/sparql/sparqlExplorer.ts @@ -220,7 +220,7 @@ export function createSparqlExplorer( async fetchNeighbors(req, options) { remoteLogger.info("[SPARQL Explorer] Fetching neighbors..."); const request: SPARQLNeighborsRequest = { - resourceURI: req.vertexId, + resourceURI: req.vertex.id, resourceClass: req.vertexType, subjectClasses: req.filterByVertexTypes, filterCriteria: req.filterCriteria?.map((c: Criterion) => ({ @@ -231,7 +231,7 @@ export function createSparqlExplorer( offset: req.offset, }; - const bNode = blankNodes.get(req.vertexId); + const bNode = blankNodes.get(req.vertex.id); if (bNode?.neighbors) { return storedBlankNodeNeighborsRequest(blankNodes, request); } @@ -249,7 +249,7 @@ export function createSparqlExplorer( }, async fetchNeighborsCount(req, options) { remoteLogger.info("[SPARQL Explorer] Fetching neighbors count..."); - const bNode = blankNodes.get(req.vertexId); + const bNode = blankNodes.get(req.vertex.id); if (bNode?.neighbors) { return { @@ -268,7 +268,7 @@ export function createSparqlExplorer( } ); - blankNodes.set(req.vertexId, { + blankNodes.set(req.vertex.id, { ...bNode, vertex: { ...bNode.vertex, @@ -287,7 +287,7 @@ export function createSparqlExplorer( return fetchNeighborsCount( _sparqlFetch(connection, featureFlags, options), { - resourceURI: req.vertexId, + resourceURI: req.vertex.id, limit: req.limit, } ); diff --git a/packages/graph-explorer/src/connector/useGEFetchTypes.ts b/packages/graph-explorer/src/connector/useGEFetchTypes.ts index 8a91d430f..8a417c7de 100644 --- a/packages/graph-explorer/src/connector/useGEFetchTypes.ts +++ b/packages/graph-explorer/src/connector/useGEFetchTypes.ts @@ -5,6 +5,7 @@ import { } from "@/core"; import { ConnectionConfig } from "@shared/types"; import { MappedQueryResults } from "./gremlin/mappers/mapResults"; +import { VertexId } from "@/@types/entities"; export type QueryOptions = RequestInit & { queryId?: string; @@ -15,6 +16,11 @@ export type QueryOptions = RequestInit & { */ export type VertexIdType = "string" | "number"; +export type VertexRef = { + id: VertexId; + idType: VertexIdType; +}; + export type VertexSchemaResponse = Pick< VertexTypeConfig, | "type" @@ -81,13 +87,9 @@ export type Criterion = { export type NeighborsRequest = { /** - * Source vertex ID. + * Source vertex ID & type. */ - vertexId: string; - /** - * The type of the vertex ID. - */ - idType: VertexIdType; + vertex: VertexRef; /** * Source vertex type. */ @@ -119,13 +121,9 @@ export type NeighborsResponse = MappedQueryResults; export type NeighborsCountRequest = { /** - * Source vertex ID. - */ - vertexId: string; - /** - * The type of the vertex ID. + * Source vertex ID & type. */ - idType: VertexIdType; + vertex: VertexRef; /** * Limit the number of results. * 0 = No limit. diff --git a/packages/graph-explorer/src/hooks/useExpandNode.tsx b/packages/graph-explorer/src/hooks/useExpandNode.tsx index 104345627..03bf27a85 100644 --- a/packages/graph-explorer/src/hooks/useExpandNode.tsx +++ b/packages/graph-explorer/src/hooks/useExpandNode.tsx @@ -34,10 +34,7 @@ will be run regardless if the view is unmounted. */ -type ExpandNodeFilters = Omit< - NeighborsRequest, - "vertexId" | "idType" | "vertexType" ->; +type ExpandNodeFilters = Omit; export type ExpandNodeRequest = { vertex: Vertex; @@ -66,8 +63,7 @@ export function ExpandNodeProvider(props: PropsWithChildren) { ): Promise => { // Perform the query when a request exists const request: NeighborsRequest | null = expandNodeRequest && { - vertexId: expandNodeRequest.vertex.id, - idType: expandNodeRequest.vertex.idType, + vertex: expandNodeRequest.vertex, vertexType: expandNodeRequest.vertex.types?.join("::") ?? expandNodeRequest.vertex.type, diff --git a/packages/graph-explorer/src/hooks/useUpdateNodeCounts.ts b/packages/graph-explorer/src/hooks/useUpdateNodeCounts.ts index 0eeb321fd..c6161d07e 100644 --- a/packages/graph-explorer/src/hooks/useUpdateNodeCounts.ts +++ b/packages/graph-explorer/src/hooks/useUpdateNodeCounts.ts @@ -1,26 +1,18 @@ import { useQueries, useQuery } from "@tanstack/react-query"; import { useEffect } from "react"; import { useRecoilValue } from "recoil"; -import { Vertex, VertexId } from "@/types/entities"; +import { Vertex } from "@/types/entities"; import { useNotification } from "@/components/NotificationProvider"; import { neighborsCountQuery } from "@/connector/queries"; import { activeConnectionSelector, explorerSelector } from "@/core/connector"; import useEntities from "./useEntities"; -import { VertexIdType } from "@/connector/useGEFetchTypes"; +import { VertexRef } from "@/connector/useGEFetchTypes"; -export function useUpdateNodeCountsQuery( - nodeId: VertexId, - nodeIdType: VertexIdType -) { +export function useUpdateNodeCountsQuery(vertex: VertexRef) { const connection = useRecoilValue(activeConnectionSelector); const explorer = useRecoilValue(explorerSelector); return useQuery( - neighborsCountQuery( - nodeId, - nodeIdType, - connection?.nodeExpansionLimit, - explorer - ) + neighborsCountQuery(vertex, connection?.nodeExpansionLimit, explorer) ); } @@ -38,13 +30,8 @@ export function useUpdateAllNodeCounts() { const query = useQueries({ queries: entities.nodes .values() - .map(node => - neighborsCountQuery( - node.id, - node.idType, - connection?.nodeExpansionLimit, - explorer - ) + .map(vertex => + neighborsCountQuery(vertex, connection?.nodeExpansionLimit, explorer) ) .toArray(), combine: results => { diff --git a/packages/graph-explorer/src/modules/NodeExpand/NodeExpandContent.tsx b/packages/graph-explorer/src/modules/NodeExpand/NodeExpandContent.tsx index 717ade0e6..424fbb46f 100644 --- a/packages/graph-explorer/src/modules/NodeExpand/NodeExpandContent.tsx +++ b/packages/graph-explorer/src/modules/NodeExpand/NodeExpandContent.tsx @@ -39,7 +39,7 @@ export default function NodeExpandContent({ vertex }: NodeExpandContentProps) { function ExpandSidebarContent({ id }: { id: VertexId }) { const vertex = useNode(id); const t = useTranslations(); - const query = useUpdateNodeCountsQuery(vertex.id, vertex.idType); + const query = useUpdateNodeCountsQuery(vertex); const neighborsOptions = useNeighborsOptions(vertex); if (query.isError) { diff --git a/packages/graph-explorer/src/utils/testing/randomData.ts b/packages/graph-explorer/src/utils/testing/randomData.ts index 9207699c3..a32d2d473 100644 --- a/packages/graph-explorer/src/utils/testing/randomData.ts +++ b/packages/graph-explorer/src/utils/testing/randomData.ts @@ -151,7 +151,7 @@ export function createRandomVertex(): Vertex { return { entityType: "vertex", id: createRandomName("VertexId") as VertexId, - idType: "string", + idType: pickRandomElement(["number", "string"]), type: createRandomName("VertexType"), attributes: createRecord(3, createRandomEntityAttribute), neighborsCount: 0,