0

Delete App

by
Published today

Permanently delete an app.

Script windmill Verified

The script

Submitted by hugo989 Typescript (fetch-only)
Verified 4 hours ago
1
//native
2

3
import * as wmill from "windmill-client"
4

5
// windmill-client errors only carry the status text: throw the response body, which says why
6
wmill.OpenAPI.interceptors.response.use(async (response) => {
7
  if (!response.ok) {
8
    throw new Error(`${response.status} ${await response.text()}`)
9
  }
10
  return response
11
})
12

13
export type DynSelect_path = string
14

15
export async function path() {
16
  const apps = await wmill.AppService.listApps({
17
    workspace: wmill.getWorkspace(),
18
  })
19
  return apps.map((a) => ({
20
    value: a.path,
21
    label: a.summary ? `${a.path} (${a.summary})` : a.path,
22
  }))
23
}
24

25
/**
26
 * Delete App
27
 * Permanently delete an app.
28
 */
29
export async function main(path: DynSelect_path) {
30
  return await wmill.AppService.deleteApp({
31
    workspace: wmill.getWorkspace(),
32
    path,
33
  })
34
}
35