(result: TransportableValue)
| 110 | } |
| 111 | |
| 112 | protected instantiateResult<TPath>(result: TransportableValue): TPath { |
| 113 | switch (result["@type"]) { |
| 114 | case "TraversalPath": { |
| 115 | let value: any = result.value; |
| 116 | if (value != null && "@type" in value) { |
| 117 | value = this.instantiateResult(value); |
| 118 | } |
| 119 | return new TraversalPath( |
| 120 | result.parent == null ? undefined : this.instantiateResult(result.parent), |
| 121 | value, |
| 122 | result.labels, |
| 123 | ) as TPath; |
| 124 | } |
| 125 | case "Vertex": |
| 126 | this.#storage.push(result); |
| 127 | return this.#graph.getVertexById(result.id) as TPath; |
| 128 | case "Edge": |
| 129 | this.#storage.push(result); |
| 130 | return this.#graph.getEdgeById(result.id) as TPath; |
| 131 | case "AsyncOperationSuccess": |
| 132 | return undefined as TPath; |
| 133 | case "AsyncOperationFailure": |
| 134 | throw new Error(result.error); |
| 135 | default: |
| 136 | throw new Error(`Unknown result type: ${result["@type"]}`); |
| 137 | } |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | class AsyncGraphStorage extends InMemoryGraphStorage { |
no test coverage detected