MCPcopy Create free account
hub / github.com/codemix/graph / getElementById

Method getElementById

packages/graph/src/Graph.ts:361–370  ·  view source on GitHub ↗
(id: ElementId<TLabel>)

Source from the content-addressed store, hash-verified

359 id: ElementId<TLabel>,
360 ): Edge<TSchema, TLabel>;
361 public getElementById<TLabel extends AnyLabel<TSchema>>(id: ElementId<TLabel>) {
362 const label = getLabelFromElementId<TLabel>(id);
363 if (label in this.#config.schema.vertices) {
364 return this.getVertexById<TLabel>(id);
365 } else if (label in this.#config.schema.edges) {
366 return this.getEdgeById<TLabel>(id);
367 } else {
368 throw new LabelNotFoundError(label);
369 }
370 }
371
372 /**
373 * Instantiate a vertex from a stored vertex.

Callers

nothing calls this directly

Calls 3

getVertexByIdMethod · 0.95
getEdgeByIdMethod · 0.95
getLabelFromElementIdFunction · 0.85

Tested by

no test coverage detected