fix: read app kind from the app listing and ignore an empty version param

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Guilhem Lemouel
2026-09-23 18:39:53 +02:00
co-authored by Claude Opus 5.5
parent 0caf054295
commit fc92a5e78b
@@ -35,15 +35,13 @@ const scriptHashExists = (workspace: string, hash: string) =>
const appExists =
(raw: boolean): ItemExists =>
async (workspace, path) => {
try {
return (await AppService.getAppLiteByPath({ workspace, path })).raw_app === raw
} catch {
return false
}
// The listing carries `raw_app` without the app value, and omits it when false.
const [app] = await AppService.listApps({ workspace, pathExact: path, perPage: 1 })
return !!app && !!app.raw_app === raw
}
const flowExists: ItemExists = async (workspace, path, search) => {
const version = Number(search.get('version') ?? NaN)
const version = Number(search.get('version') || NaN)
if (!Number.isFinite(version)) return FlowService.existsFlowByPath({ workspace, path })
try {
return (await FlowService.getFlowVersion({ workspace, version })).path === path