mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 03:01:54 +00:00
fix: add schema for custom nodes i18n and simplify storeUserData type
- Add zCustomNodesI18n schema and CustomNodesI18n type to apiSchema.ts - Update getCustomNodesI18n to use new CustomNodesI18n type - Simplify storeUserData data parameter from BodyInit | Record<string, unknown> | null to unknown
This commit is contained in:
@@ -13,6 +13,9 @@ export type PromptId = z.infer<typeof zPromptId>
|
|||||||
export const resultItemType = z.enum(['input', 'output', 'temp'])
|
export const resultItemType = z.enum(['input', 'output', 'temp'])
|
||||||
export type ResultItemType = z.infer<typeof resultItemType>
|
export type ResultItemType = z.infer<typeof resultItemType>
|
||||||
|
|
||||||
|
const zCustomNodesI18n = z.record(z.string(), z.unknown())
|
||||||
|
export type CustomNodesI18n = z.infer<typeof zCustomNodesI18n>
|
||||||
|
|
||||||
const zResultItem = z.object({
|
const zResultItem = z.object({
|
||||||
filename: z.string().optional(),
|
filename: z.string().optional(),
|
||||||
subfolder: z.string().optional(),
|
subfolder: z.string().optional(),
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import type {
|
|||||||
} from '@/platform/workflow/validation/schemas/workflowSchema'
|
} from '@/platform/workflow/validation/schemas/workflowSchema'
|
||||||
import type {
|
import type {
|
||||||
AssetDownloadWsMessage,
|
AssetDownloadWsMessage,
|
||||||
|
CustomNodesI18n,
|
||||||
EmbeddingsResponse,
|
EmbeddingsResponse,
|
||||||
ExecutedWsMessage,
|
ExecutedWsMessage,
|
||||||
ExecutingWsMessage,
|
ExecutingWsMessage,
|
||||||
@@ -1074,7 +1075,7 @@ export class ComfyApi extends EventTarget {
|
|||||||
*/
|
*/
|
||||||
async storeUserData(
|
async storeUserData(
|
||||||
file: string,
|
file: string,
|
||||||
data: BodyInit | Record<string, unknown> | null,
|
data: unknown,
|
||||||
options: RequestInit & {
|
options: RequestInit & {
|
||||||
overwrite?: boolean
|
overwrite?: boolean
|
||||||
stringify?: boolean
|
stringify?: boolean
|
||||||
@@ -1251,7 +1252,7 @@ export class ComfyApi extends EventTarget {
|
|||||||
*
|
*
|
||||||
* @returns The custom nodes i18n data
|
* @returns The custom nodes i18n data
|
||||||
*/
|
*/
|
||||||
async getCustomNodesI18n(): Promise<Record<string, unknown>> {
|
async getCustomNodesI18n(): Promise<CustomNodesI18n> {
|
||||||
return (await axios.get(this.apiURL('/i18n'))).data
|
return (await axios.get(this.apiURL('/i18n'))).data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user