(
wsIdParam: string,
exportParam: string,
)
| 112 | |
| 113 | /** Shared workspace+export resolution for both routes. */ |
| 114 | const resolveCtx = ( |
| 115 | wsIdParam: string, |
| 116 | exportParam: string, |
| 117 | ): |
| 118 | | { ok: true; exp: CliExport; ws: WsMeta } |
| 119 | | { ok: false; status: 404 | 503; error: string } => { |
| 120 | const ws = resolveWs(wsIdParam) |
| 121 | if ('error' in ws) { |
| 122 | return ws.error === 'unavailable' |
| 123 | ? { ok: false, status: 503, error: 'workspace service unavailable' } |
| 124 | : { ok: false, status: 404, error: 'unknown workspace' } |
| 125 | } |
| 126 | const exp = getExport(exportParam) |
| 127 | if (!exp) return { ok: false, status: 404, error: `unknown CLI export: ${exportParam}` } |
| 128 | return { ok: true, exp, ws: ws.meta } |
| 129 | } |
| 130 | |
| 131 | app.get('/cli/:wsId/:export/manifest', (c) => { |
| 132 | const r = resolveCtx(c.req.param('wsId'), c.req.param('export')) |
no test coverage detected