(file: DeepnoteFile, inputs: Record<string, unknown>)
| 595 | * instead of their saved values. |
| 596 | */ |
| 597 | export function applyInputOverrides(file: DeepnoteFile, inputs: Record<string, unknown>): void { |
| 598 | if (Object.keys(inputs).length === 0) return |
| 599 | |
| 600 | for (const notebook of file.project.notebooks) { |
| 601 | for (const block of notebook.blocks) { |
| 602 | if (!block.type.startsWith('input-')) continue |
| 603 | const metadata = block.metadata as Record<string, unknown> |
| 604 | const varName = metadata.deepnote_variable_name as string | undefined |
| 605 | if (varName && Object.hasOwn(inputs, varName)) { |
| 606 | metadata.deepnote_variable_value = inputs[varName] |
| 607 | } |
| 608 | } |
| 609 | } |
| 610 | } |
| 611 | |
| 612 | /** Information about an input block */ |
| 613 | interface InputInfo { |
no outgoing calls
no test coverage detected