(req: Request, res: Response)
| 101 | * Get a specific data source by ID |
| 102 | */ |
| 103 | export function getSource(req: Request, res: Response): void { |
| 104 | try { |
| 105 | const sourceId = req.params.sourceId; |
| 106 | |
| 107 | // Get source config - will be null if source doesn't exist |
| 108 | const sourceConfig = ConnectorManager.getSourceConfig(sourceId); |
| 109 | if (!sourceConfig) { |
| 110 | const errorResponse: ErrorResponse = { |
| 111 | error: "Source not found", |
| 112 | source_id: sourceId, |
| 113 | }; |
| 114 | res.status(404).json(errorResponse); |
| 115 | return; |
| 116 | } |
| 117 | |
| 118 | // Transform and return |
| 119 | const dataSource = transformSourceConfig(sourceConfig); |
| 120 | res.json(dataSource); |
| 121 | } catch (error) { |
| 122 | console.error(`Error getting source ${req.params.sourceId}:`, error); |
| 123 | const errorResponse: ErrorResponse = { |
| 124 | error: error instanceof Error ? error.message : "Internal server error", |
| 125 | }; |
| 126 | res.status(500).json(errorResponse); |
| 127 | } |
| 128 | } |
nothing calls this directly
no test coverage detected