| 221 | } |
| 222 | |
| 223 | export class EmptyGraphSource<const TSchema extends GraphSchema> implements GraphSource<TSchema> { |
| 224 | #config: EmptyGraphSourceConfig<TSchema>; |
| 225 | public constructor(config: EmptyGraphSourceConfig<TSchema>) { |
| 226 | this.#config = config; |
| 227 | } |
| 228 | public get schema(): TSchema { |
| 229 | return this.#config.schema; |
| 230 | } |
| 231 | |
| 232 | public getIncomingEdges(_vertexId: ElementId): Iterable<Edge<TSchema, any>> { |
| 233 | throw new Error("Cannot get incoming edges from an empty graph source."); |
| 234 | } |
| 235 | public getOutgoingEdges(_vertexId: ElementId): Iterable<Edge<TSchema, any>> { |
| 236 | throw new Error("Cannot get outgoing edges from an empty graph source."); |
| 237 | } |
| 238 | public getVertexById<TVertexLabel extends VertexLabel<TSchema>>( |
| 239 | _id: ElementId, |
| 240 | _options: { throwIfNotFound: true }, |
| 241 | ): Vertex<TSchema, TVertexLabel>; |
| 242 | public getVertexById<TVertexLabel extends VertexLabel<TSchema>>( |
| 243 | _id: ElementId, |
| 244 | _options?: { throwIfNotFound?: false }, |
| 245 | ): Vertex<TSchema, TVertexLabel> | undefined; |
| 246 | public getVertexById<TVertexLabel extends VertexLabel<TSchema>>( |
| 247 | _id: ElementId, |
| 248 | _options?: { throwIfNotFound?: boolean }, |
| 249 | ): Vertex<TSchema, TVertexLabel> | undefined { |
| 250 | throw new Error("Cannot get vertex by id from an empty graph source."); |
| 251 | } |
| 252 | public getVertices<TVertexLabel extends VertexLabel<TSchema>>( |
| 253 | ..._labels: TVertexLabel[] |
| 254 | ): Iterable<Vertex<TSchema, TVertexLabel>> { |
| 255 | throw new Error("Cannot get vertices from an empty graph source."); |
| 256 | } |
| 257 | public getEdges<TEdgeLabel extends EdgeLabel<TSchema>>( |
| 258 | ..._labels: TEdgeLabel[] |
| 259 | ): Iterable<Edge<TSchema, TEdgeLabel>> { |
| 260 | throw new Error("Cannot get edges from an empty graph source."); |
| 261 | } |
| 262 | public getEdgeById<TEdgeLabel extends EdgeLabel<TSchema>>( |
| 263 | _id: ElementId, |
| 264 | _options: { throwIfNotFound: true }, |
| 265 | ): Edge<TSchema, TEdgeLabel>; |
| 266 | public getEdgeById<TEdgeLabel extends EdgeLabel<TSchema>>( |
| 267 | _id: ElementId, |
| 268 | _options?: { throwIfNotFound?: false }, |
| 269 | ): Edge<TSchema, TEdgeLabel> | undefined; |
| 270 | public getEdgeById<TEdgeLabel extends EdgeLabel<TSchema>>( |
| 271 | _id: ElementId, |
| 272 | _options?: { throwIfNotFound?: boolean }, |
| 273 | ): Edge<TSchema, TEdgeLabel> | undefined { |
| 274 | throw new Error("Cannot get edge by id from an empty graph source."); |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | /** |
| 279 | * A function that generates a unique identifier. |
nothing calls this directly
no outgoing calls
no test coverage detected