mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-04 23:20:07 +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 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({
|
||||
filename: z.string().optional(),
|
||||
subfolder: z.string().optional(),
|
||||
|
||||
@@ -22,6 +22,7 @@ import type {
|
||||
} from '@/platform/workflow/validation/schemas/workflowSchema'
|
||||
import type {
|
||||
AssetDownloadWsMessage,
|
||||
CustomNodesI18n,
|
||||
EmbeddingsResponse,
|
||||
ExecutedWsMessage,
|
||||
ExecutingWsMessage,
|
||||
@@ -1074,7 +1075,7 @@ export class ComfyApi extends EventTarget {
|
||||
*/
|
||||
async storeUserData(
|
||||
file: string,
|
||||
data: BodyInit | Record<string, unknown> | null,
|
||||
data: unknown,
|
||||
options: RequestInit & {
|
||||
overwrite?: boolean
|
||||
stringify?: boolean
|
||||
@@ -1251,7 +1252,7 @@ export class ComfyApi extends EventTarget {
|
||||
*
|
||||
* @returns The custom nodes i18n data
|
||||
*/
|
||||
async getCustomNodesI18n(): Promise<Record<string, unknown>> {
|
||||
async getCustomNodesI18n(): Promise<CustomNodesI18n> {
|
||||
return (await axios.get(this.apiURL('/i18n'))).data
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user