* Resolve a block ID or prefix to the full block ID. Returns undefined if not found.
(blocks: DeepnoteBlock[], idOrPrefix: string)
| 39 | * Resolve a block ID or prefix to the full block ID. Returns undefined if not found. |
| 40 | */ |
| 41 | function resolveBlockId(blocks: DeepnoteBlock[], idOrPrefix: string): string | undefined { |
| 42 | const matches = blocks.filter(block => block.id === idOrPrefix || block.id.startsWith(idOrPrefix)) |
| 43 | if (matches.length > 1) { |
| 44 | throw new Error(`Ambiguous block ID prefix "${idOrPrefix}" matches multiple blocks`) |
| 45 | } |
| 46 | return matches[0]?.id |
| 47 | } |
| 48 | |
| 49 | function writingError(message: string) { |
| 50 | return { |
no outgoing calls
no test coverage detected