MCPcopy Index your code
hub / github.com/deepnote/deepnote / getInputBlocks

Function getInputBlocks

packages/cli/src/commands/run.ts:624–662  ·  view source on GitHub ↗

* Extract input block information from a DeepnoteFile.

(file: DeepnoteFile, notebookName?: string)

Source from the content-addressed store, hash-verified

622 * Extract input block information from a DeepnoteFile.
623 */
624function getInputBlocks(file: DeepnoteFile, notebookName?: string): InputInfo[] {
625 const notebooks = notebookName ? file.project.notebooks.filter(n => n.name === notebookName) : file.project.notebooks
626
627 const inputTypes = [
628 'input-text',
629 'input-textarea',
630 'input-checkbox',
631 'input-select',
632 'input-slider',
633 'input-date',
634 'input-date-range',
635 'input-file',
636 ]
637
638 const inputs: InputInfo[] = []
639 for (const notebook of notebooks) {
640 for (const block of notebook.blocks) {
641 if (inputTypes.includes(block.type)) {
642 const metadata = block.metadata as Record<string, unknown>
643 const variableName = metadata.deepnote_variable_name as string
644 const currentValue = metadata.deepnote_variable_value
645 const label = metadata.deepnote_input_label as string | undefined
646
647 // Check if input has a meaningful value
648 const hasValue = currentValue !== undefined && currentValue !== '' && currentValue !== null
649
650 inputs.push({
651 variableName,
652 type: block.type,
653 label,
654 currentValue,
655 hasValue,
656 })
657 }
658 }
659 }
660
661 return inputs
662}
663
664/**
665 * List all input blocks in a notebook file.

Callers 1

listInputsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected