//native
import * as wmill from "windmill-client"
// windmill-client errors only carry the status text: throw the response body, which says why
wmill.OpenAPI.interceptors.response.use(async (response) => {
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return response
})
export type DynSelect_path = string
export async function path() {
const apps = await wmill.AppService.listApps({
workspace: wmill.getWorkspace(),
})
return apps.map((a) => ({
value: a.path,
label: a.summary ? `${a.path} (${a.summary})` : a.path,
}))
}
/**
* Get App
* Get an app by path: summary, policy and its full definition.
*/
export async function main(path: DynSelect_path) {
return await wmill.AppService.getAppByPath({
workspace: wmill.getWorkspace(),
path,
})
}
Submitted by hugo989 5 hours ago