mirror of
https://github.com/langgenius/dify.git
synced 2026-05-03 00:48:04 +08:00
refactor(web): split sandbox provider contracts into separate file
Move sandbox provider related contracts from contract/console.ts to contract/console/sandbox-provider.ts for better organization
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
import type { SystemFeatures } from '@/types/feature'
|
||||
import type { SandboxProvider } from '@/types/sandbox-provider'
|
||||
import { type } from '@orpc/contract'
|
||||
import { base } from './base'
|
||||
|
||||
@ -33,71 +32,3 @@ export const bindPartnerStackContract = base
|
||||
}
|
||||
}>())
|
||||
.output(type<unknown>())
|
||||
|
||||
// Sandbox Provider contracts
|
||||
export const getSandboxProviderListContract = base
|
||||
.route({
|
||||
path: '/workspaces/current/sandbox-providers',
|
||||
method: 'GET',
|
||||
})
|
||||
.input(type<unknown>())
|
||||
.output(type<SandboxProvider[]>())
|
||||
|
||||
export const getSandboxProviderContract = base
|
||||
.route({
|
||||
path: '/workspaces/current/sandbox-provider/{providerType}',
|
||||
method: 'GET',
|
||||
})
|
||||
.input(type<{
|
||||
params: {
|
||||
providerType: string
|
||||
}
|
||||
}>())
|
||||
.output(type<SandboxProvider>())
|
||||
|
||||
export const saveSandboxProviderConfigContract = base
|
||||
.route({
|
||||
path: '/workspaces/current/sandbox-provider/{providerType}/config',
|
||||
method: 'POST',
|
||||
})
|
||||
.input(type<{
|
||||
params: {
|
||||
providerType: string
|
||||
}
|
||||
body: {
|
||||
config: Record<string, string>
|
||||
}
|
||||
}>())
|
||||
.output(type<{ result: string }>())
|
||||
|
||||
export const deleteSandboxProviderConfigContract = base
|
||||
.route({
|
||||
path: '/workspaces/current/sandbox-provider/{providerType}/config',
|
||||
method: 'DELETE',
|
||||
})
|
||||
.input(type<{
|
||||
params: {
|
||||
providerType: string
|
||||
}
|
||||
}>())
|
||||
.output(type<{ result: string }>())
|
||||
|
||||
export const activateSandboxProviderContract = base
|
||||
.route({
|
||||
path: '/workspaces/current/sandbox-provider/{providerType}/activate',
|
||||
method: 'POST',
|
||||
})
|
||||
.input(type<{
|
||||
params: {
|
||||
providerType: string
|
||||
}
|
||||
}>())
|
||||
.output(type<{ result: string }>())
|
||||
|
||||
export const getActiveSandboxProviderContract = base
|
||||
.route({
|
||||
path: '/workspaces/current/sandbox-provider/active',
|
||||
method: 'GET',
|
||||
})
|
||||
.input(type<unknown>())
|
||||
.output(type<{ provider_type: string | null }>())
|
||||
|
||||
70
web/contract/console/sandbox-provider.ts
Normal file
70
web/contract/console/sandbox-provider.ts
Normal file
@ -0,0 +1,70 @@
|
||||
import type { SandboxProvider } from '@/types/sandbox-provider'
|
||||
import { type } from '@orpc/contract'
|
||||
import { base } from '../base'
|
||||
|
||||
export const getSandboxProviderListContract = base
|
||||
.route({
|
||||
path: '/workspaces/current/sandbox-providers',
|
||||
method: 'GET',
|
||||
})
|
||||
.input(type<unknown>())
|
||||
.output(type<SandboxProvider[]>())
|
||||
|
||||
export const getSandboxProviderContract = base
|
||||
.route({
|
||||
path: '/workspaces/current/sandbox-provider/{providerType}',
|
||||
method: 'GET',
|
||||
})
|
||||
.input(type<{
|
||||
params: {
|
||||
providerType: string
|
||||
}
|
||||
}>())
|
||||
.output(type<SandboxProvider>())
|
||||
|
||||
export const saveSandboxProviderConfigContract = base
|
||||
.route({
|
||||
path: '/workspaces/current/sandbox-provider/{providerType}/config',
|
||||
method: 'POST',
|
||||
})
|
||||
.input(type<{
|
||||
params: {
|
||||
providerType: string
|
||||
}
|
||||
body: {
|
||||
config: Record<string, string>
|
||||
}
|
||||
}>())
|
||||
.output(type<{ result: string }>())
|
||||
|
||||
export const deleteSandboxProviderConfigContract = base
|
||||
.route({
|
||||
path: '/workspaces/current/sandbox-provider/{providerType}/config',
|
||||
method: 'DELETE',
|
||||
})
|
||||
.input(type<{
|
||||
params: {
|
||||
providerType: string
|
||||
}
|
||||
}>())
|
||||
.output(type<{ result: string }>())
|
||||
|
||||
export const activateSandboxProviderContract = base
|
||||
.route({
|
||||
path: '/workspaces/current/sandbox-provider/{providerType}/activate',
|
||||
method: 'POST',
|
||||
})
|
||||
.input(type<{
|
||||
params: {
|
||||
providerType: string
|
||||
}
|
||||
}>())
|
||||
.output(type<{ result: string }>())
|
||||
|
||||
export const getActiveSandboxProviderContract = base
|
||||
.route({
|
||||
path: '/workspaces/current/sandbox-provider/active',
|
||||
method: 'GET',
|
||||
})
|
||||
.input(type<unknown>())
|
||||
.output(type<{ provider_type: string | null }>())
|
||||
@ -1,15 +1,17 @@
|
||||
import type { InferContractRouterInputs } from '@orpc/contract'
|
||||
import {
|
||||
activateSandboxProviderContract,
|
||||
billingUrlContract,
|
||||
bindPartnerStackContract,
|
||||
systemFeaturesContract,
|
||||
} from './console'
|
||||
import {
|
||||
activateSandboxProviderContract,
|
||||
deleteSandboxProviderConfigContract,
|
||||
getActiveSandboxProviderContract,
|
||||
getSandboxProviderContract,
|
||||
getSandboxProviderListContract,
|
||||
saveSandboxProviderConfigContract,
|
||||
systemFeaturesContract,
|
||||
} from './console'
|
||||
} from './console/sandbox-provider'
|
||||
import { collectionPluginsContract, collectionsContract, searchAdvancedContract } from './marketplace'
|
||||
|
||||
export const marketplaceRouterContract = {
|
||||
|
||||
Reference in New Issue
Block a user