mirror of
https://github.com/langgenius/dify.git
synced 2026-05-04 01:18:05 +08:00
update
This commit is contained in:
@ -6,18 +6,21 @@ import { handler } from './plugin'
|
||||
|
||||
export const defaultConfig: OrpcPlugin['Config'] = {
|
||||
config: {
|
||||
contractNameBuilder: (id: string) => `${id}Contract`,
|
||||
defaultTag: 'default',
|
||||
exportFromIndex: false,
|
||||
output: 'orpc',
|
||||
},
|
||||
dependencies: ['@hey-api/typescript', 'zod'],
|
||||
handler,
|
||||
name: 'orpc',
|
||||
resolveConfig: (plugin) => {
|
||||
plugin.config.output = plugin.config.output ?? 'orpc'
|
||||
plugin.config.exportFromIndex = plugin.config.exportFromIndex ?? false
|
||||
plugin.config.contractNameBuilder = plugin.config.contractNameBuilder
|
||||
?? ((id: string) => `${id}Contract`)
|
||||
plugin.config.defaultTag = plugin.config.defaultTag ?? 'default'
|
||||
resolveConfig: (plugin, _context) => {
|
||||
plugin.config.output ??= 'orpc'
|
||||
plugin.config.exportFromIndex ??= false
|
||||
plugin.config.contractNameBuilder ??= (id: string) => `${id}Contract`
|
||||
plugin.config.defaultTag ??= 'default'
|
||||
},
|
||||
tags: ['client'],
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
export { defaultConfig, defineConfig } from './config'
|
||||
export type { Config, OrpcPlugin, ResolvedConfig } from './types'
|
||||
export type { OrpcPlugin, UserConfig } from './types'
|
||||
|
||||
35
web/plugins/hey-api-orpc/types.d.ts
vendored
Normal file
35
web/plugins/hey-api-orpc/types.d.ts
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
import type { DefinePlugin, Plugin } from '@hey-api/openapi-ts'
|
||||
|
||||
export type UserConfig = Plugin.Name<'orpc'>
|
||||
& Plugin.Hooks & {
|
||||
/**
|
||||
* Name of the generated file.
|
||||
* @default 'orpc'
|
||||
*/
|
||||
output?: string
|
||||
/**
|
||||
* Whether exports should be re-exported in the index file.
|
||||
* @default false
|
||||
*/
|
||||
exportFromIndex?: boolean
|
||||
/**
|
||||
* Custom naming function for contract symbols.
|
||||
* @default (id) => `${id}Contract`
|
||||
*/
|
||||
contractNameBuilder?: (operationId: string) => string
|
||||
/**
|
||||
* Default tag name for operations without tags.
|
||||
* @default 'default'
|
||||
*/
|
||||
defaultTag?: string
|
||||
}
|
||||
|
||||
export type Config = Plugin.Name<'orpc'>
|
||||
& Plugin.Hooks & {
|
||||
output: string
|
||||
exportFromIndex: boolean
|
||||
contractNameBuilder: (operationId: string) => string
|
||||
defaultTag: string
|
||||
}
|
||||
|
||||
export type OrpcPlugin = DefinePlugin<UserConfig, Config>
|
||||
@ -1,34 +0,0 @@
|
||||
import type { DefinePlugin } from '@hey-api/openapi-ts'
|
||||
|
||||
export type Config = { name: 'orpc' } & {
|
||||
/**
|
||||
* Name of the generated file.
|
||||
* @default 'orpc'
|
||||
*/
|
||||
output?: string
|
||||
/**
|
||||
* Whether exports should be re-exported in the index file.
|
||||
* @default false
|
||||
*/
|
||||
exportFromIndex?: boolean
|
||||
/**
|
||||
* Custom naming function for contract symbols.
|
||||
* @default (id) => `${id}Contract`
|
||||
*/
|
||||
contractNameBuilder?: (operationId: string) => string
|
||||
/**
|
||||
* Default tag name for operations without tags.
|
||||
* @default 'default'
|
||||
*/
|
||||
defaultTag?: string
|
||||
}
|
||||
|
||||
export type ResolvedConfig = {
|
||||
name: 'orpc'
|
||||
output: string
|
||||
exportFromIndex: boolean
|
||||
contractNameBuilder: (operationId: string) => string
|
||||
defaultTag: string
|
||||
}
|
||||
|
||||
export type OrpcPlugin = DefinePlugin<Config, ResolvedConfig>
|
||||
Reference in New Issue
Block a user