(vertex: StoredVertex)
| 235 | } |
| 236 | |
| 237 | public addVertex(vertex: StoredVertex): void { |
| 238 | const [label, uuid] = parseElementId(vertex.id); |
| 239 | const schema = this.#config.schema.vertices[label]; |
| 240 | if (schema == null) { |
| 241 | throw new LabelNotFoundError(label); |
| 242 | } |
| 243 | const collection = this.getVertexCollectionMap(label); |
| 244 | this.transact(() => { |
| 245 | const map = new Y.Map<unknown>(); |
| 246 | |
| 247 | collection.set(uuid, map); |
| 248 | for (const [key] of Object.entries(schema.properties)) { |
| 249 | const value = vertex.properties[key as keyof typeof vertex.properties]; |
| 250 | if (value === undefined) { |
| 251 | continue; |
| 252 | } |
| 253 | map.set(key, value); |
| 254 | } |
| 255 | }); |
| 256 | } |
| 257 | |
| 258 | public deleteVertex(id: ElementId): void { |
| 259 | const [label, uuid] = parseElementId(id); |
nothing calls this directly
no test coverage detected