(file: DeepnoteFile)
| 59 | * @returns A new DeepnoteFile with content hashes added |
| 60 | */ |
| 61 | export function addContentHashes(file: DeepnoteFile): DeepnoteFile { |
| 62 | const result = structuredClone(file) |
| 63 | for (const notebook of result.project.notebooks) { |
| 64 | for (const block of notebook.blocks) { |
| 65 | if (!block.contentHash && block.content) { |
| 66 | ;(block as DeepnoteBlock & { contentHash?: string }).contentHash = computeContentHash(block.content) |
| 67 | } |
| 68 | } |
| 69 | } |
| 70 | return result |
| 71 | } |
no test coverage detected