mirror of
https://github.com/langgenius/dify.git
synced 2026-08-29 19:54:46 +08:00
Co-authored-by: zhangx1n <zhangxin@dify.ai> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
39 lines
1.0 KiB
TypeScript
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' })
|
|
}
|