* Read the partial message for a workspace, if it exists.
(workspaceId: string)
| 1157 | * Read the partial message for a workspace, if it exists. |
| 1158 | */ |
| 1159 | async readPartial(workspaceId: string): Promise<MuxMessage | null> { |
| 1160 | try { |
| 1161 | const partialPath = this.getPartialPath(workspaceId); |
| 1162 | const data = await fs.readFile(partialPath, "utf-8"); |
| 1163 | const message = JSON.parse(data) as MuxMessage; |
| 1164 | return normalizeLegacyMuxMetadata(message); |
| 1165 | } catch (error) { |
| 1166 | if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") { |
| 1167 | return null; |
| 1168 | } |
| 1169 | |
| 1170 | log.error("Error reading partial:", error); |
| 1171 | return null; |
| 1172 | } |
| 1173 | } |
| 1174 | |
| 1175 | /** |
| 1176 | * Write a partial message to disk. |
no test coverage detected