dify/web/service/workflow-queries.ts
Wu Tianwei 7aba539e82
feat: app deployment v2 (#39829)
Co-authored-by: zhangx1n <zhangxin@dify.ai>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-08-12 01:55:36 +00:00

39 lines
1.0 KiB
TypeScript

import { skipToken } from '@tanstack/react-query'
import { consoleQuery } from './client'
const WORKFLOW_VERSIONS_PAGE_SIZE = 10
export function appWorkflowQueryOptions(appId: string | null | undefined) {
return consoleQuery.apps.byAppId.workflows.publish.get.queryOptions({
input: appId
? {
params: {
app_id: appId,
},
}
: skipToken,
})
}
export function appWorkflowVersionsInfiniteQueryOptions(appId: string | null | undefined) {
return consoleQuery.apps.byAppId.workflows.get.infiniteOptions({
input: appId
? (pageParam) => ({
params: {
app_id: appId,
},
query: {
limit: WORKFLOW_VERSIONS_PAGE_SIZE,
page: Number(pageParam),
},
})
: skipToken,
getNextPageParam: (lastPage) => (lastPage.has_more ? lastPage.page + 1 : undefined),
initialPageParam: 1,
})
}
export function appWorkflowVersionsInfiniteQueryKey() {
return consoleQuery.apps.byAppId.workflows.get.key({ type: 'infinite' })
}