mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-22 15:29:44 +00:00
[Refactor] Move zod schemas to schemas/ folder (#2753)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import type { Response } from '@playwright/test'
|
||||
import { expect, mergeTests } from '@playwright/test'
|
||||
|
||||
import type { StatusWsMessage } from '../src/types/apiTypes.ts'
|
||||
import type { StatusWsMessage } from '../src/schemas/apiSchema.ts'
|
||||
import { comfyPageFixture } from './fixtures/ComfyPage'
|
||||
import { webSocketFixture } from './fixtures/ws.ts'
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { expect } from '@playwright/test'
|
||||
|
||||
import type { Palette } from '../src/types/colorPaletteTypes'
|
||||
import type { Palette } from '../src/schemas/colorPaletteSchema'
|
||||
import { comfyPageFixture as test } from './fixtures/ComfyPage'
|
||||
|
||||
const customColorPalettes: Record<string, Palette> = {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Locator, expect } from '@playwright/test'
|
||||
|
||||
import { Keybinding } from '../src/types/keyBindingTypes'
|
||||
import type { Keybinding } from '../src/schemas/keyBindingSchema'
|
||||
import { comfyPageFixture as test } from './fixtures/ComfyPage'
|
||||
|
||||
test.describe('Load workflow warning', () => {
|
||||
|
||||
@@ -5,9 +5,9 @@ import { test as base } from '@playwright/test'
|
||||
import dotenv from 'dotenv'
|
||||
import * as fs from 'fs'
|
||||
|
||||
import type { NodeId } from '../../src/schemas/comfyWorkflowSchema'
|
||||
import type { KeyCombo } from '../../src/schemas/keyBindingSchema'
|
||||
import type { useWorkspaceStore } from '../../src/stores/workspaceStore'
|
||||
import type { NodeId } from '../../src/types/comfyWorkflow'
|
||||
import type { KeyCombo } from '../../src/types/keyBindingTypes'
|
||||
import { NodeBadgeMode } from '../../src/types/nodeSource'
|
||||
import { ComfyActionbar } from '../helpers/actionbar'
|
||||
import { ComfyTemplates } from '../helpers/templates'
|
||||
|
||||
@@ -8,7 +8,7 @@ import type {
|
||||
HistoryTaskItem,
|
||||
TaskItem,
|
||||
TaskOutput
|
||||
} from '../../../src/types/apiTypes'
|
||||
} from '../../../src/schemas/apiSchema'
|
||||
import type { ComfyPage } from '../ComfyPage'
|
||||
|
||||
/** keyof TaskOutput[string] */
|
||||
|
||||
@@ -16,9 +16,9 @@ import ProgressSpinner from 'primevue/progressspinner'
|
||||
import { Ref, onMounted, onUnmounted, ref } from 'vue'
|
||||
|
||||
import type { useTerminal } from '@/composables/bottomPanelTabs/useTerminal'
|
||||
import { LogEntry, LogsWsMessage, TerminalSize } from '@/schemas/apiSchema'
|
||||
import { api } from '@/scripts/api'
|
||||
import { useExecutionStore } from '@/stores/executionStore'
|
||||
import { LogEntry, LogsWsMessage, TerminalSize } from '@/types/apiTypes'
|
||||
|
||||
import BaseTerminal from './BaseTerminal.vue'
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { DeviceStats } from '@/types/apiTypes'
|
||||
import type { DeviceStats } from '@/schemas/apiSchema'
|
||||
import { formatSize } from '@/utils/formatUtil'
|
||||
|
||||
const props = defineProps<{
|
||||
|
||||
@@ -36,7 +36,7 @@ import TabView from 'primevue/tabview'
|
||||
import { computed } from 'vue'
|
||||
|
||||
import DeviceInfo from '@/components/common/DeviceInfo.vue'
|
||||
import type { SystemStats } from '@/types/apiTypes'
|
||||
import type { SystemStats } from '@/schemas/apiSchema'
|
||||
import { formatSize } from '@/utils/formatUtil'
|
||||
|
||||
const props = defineProps<{
|
||||
|
||||
@@ -63,9 +63,9 @@ import { useI18n } from 'vue-i18n'
|
||||
import NoResultsPlaceholder from '@/components/common/NoResultsPlaceholder.vue'
|
||||
import FindIssueButton from '@/components/dialog/content/error/FindIssueButton.vue'
|
||||
import { useCopyToClipboard } from '@/composables/useCopyToClipboard'
|
||||
import type { ExecutionErrorWsMessage, SystemStats } from '@/schemas/apiSchema'
|
||||
import { api } from '@/scripts/api'
|
||||
import { app } from '@/scripts/app'
|
||||
import type { ExecutionErrorWsMessage, SystemStats } from '@/types/apiTypes'
|
||||
import type { ReportField } from '@/types/issueReportTypes'
|
||||
|
||||
import ReportIssuePanel from './error/ReportIssuePanel.vue'
|
||||
|
||||
@@ -117,16 +117,16 @@ import { useToast } from 'primevue/usetoast'
|
||||
import { computed, ref } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import { api } from '@/scripts/api'
|
||||
import { app } from '@/scripts/app'
|
||||
import {
|
||||
type IssueReportFormData,
|
||||
type ReportField,
|
||||
issueReportSchema
|
||||
} from '@/types/issueReportTypes'
|
||||
} from '@/schemas/issueReportSchema'
|
||||
import { api } from '@/scripts/api'
|
||||
import { app } from '@/scripts/app'
|
||||
import type {
|
||||
DefaultField,
|
||||
IssueReportPanelProps
|
||||
IssueReportPanelProps,
|
||||
ReportField
|
||||
} from '@/types/issueReportTypes'
|
||||
import { isElectron } from '@/utils/envUtil'
|
||||
|
||||
|
||||
@@ -104,6 +104,7 @@ import { useI18n } from 'vue-i18n'
|
||||
|
||||
import NoResultsPlaceholder from '@/components/common/NoResultsPlaceholder.vue'
|
||||
import VirtualGrid from '@/components/common/VirtualGrid.vue'
|
||||
import { ComfyNode } from '@/schemas/comfyWorkflowSchema'
|
||||
import { api } from '@/scripts/api'
|
||||
import { app } from '@/scripts/app'
|
||||
import { useLitegraphService } from '@/services/litegraphService'
|
||||
@@ -114,7 +115,6 @@ import {
|
||||
useQueueStore
|
||||
} from '@/stores/queueStore'
|
||||
import { useSettingStore } from '@/stores/settingStore'
|
||||
import { ComfyNode } from '@/types/comfyWorkflow'
|
||||
|
||||
import SidebarTabTemplate from './SidebarTabTemplate.vue'
|
||||
import ResultGallery from './queue/ResultGallery.vue'
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
import { Ref, computed, inject, onMounted, onUnmounted, ref, watch } from 'vue'
|
||||
|
||||
import TreeExplorerTreeNode from '@/components/common/TreeExplorerTreeNode.vue'
|
||||
import type { BookmarkCustomization } from '@/schemas/apiSchema'
|
||||
import { useNodeBookmarkStore } from '@/stores/nodeBookmarkStore'
|
||||
import { ComfyNodeDefImpl } from '@/stores/nodeDefStore'
|
||||
import type { BookmarkCustomization } from '@/types/apiTypes'
|
||||
import { RenderedTreeExplorerNode } from '@/types/treeExplorerTypes'
|
||||
|
||||
const props = defineProps<{
|
||||
|
||||
@@ -73,10 +73,10 @@ import Button from 'primevue/button'
|
||||
import Tag from 'primevue/tag'
|
||||
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
||||
|
||||
import { ComfyNode } from '@/schemas/comfyWorkflowSchema'
|
||||
import { api } from '@/scripts/api'
|
||||
import { useLitegraphService } from '@/services/litegraphService'
|
||||
import { TaskItemDisplayStatus, type TaskItemImpl } from '@/stores/queueStore'
|
||||
import { ComfyNode } from '@/types/comfyWorkflow'
|
||||
|
||||
import ResultItem from './ResultItem.vue'
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@ import { LiteGraph } from '@comfyorg/litegraph'
|
||||
import type { LGraphNode } from '@comfyorg/litegraph'
|
||||
import { useEventListener } from '@vueuse/core'
|
||||
|
||||
import { ComfyWorkflowJSON } from '@/schemas/comfyWorkflowSchema'
|
||||
import { app } from '@/scripts/app'
|
||||
import { useCanvasStore } from '@/stores/graphStore'
|
||||
import { useWorkspaceStore } from '@/stores/workspaceStore'
|
||||
import { ComfyWorkflowJSON } from '@/types/comfyWorkflow'
|
||||
import { isAudioNode, isImageNode, isVideoNode } from '@/utils/litegraphUtil'
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { LGraphNode } from '@comfyorg/litegraph'
|
||||
|
||||
import type { InputSpec } from '@/schemas/apiSchema'
|
||||
import type { ComfyWidgetConstructor } from '@/scripts/widgets'
|
||||
import type { InputSpec } from '@/types/apiTypes'
|
||||
|
||||
export const useBooleanWidget = () => {
|
||||
const widgetConstructor: ComfyWidgetConstructor = (
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { LGraphNode } from '@comfyorg/litegraph'
|
||||
import type { IComboWidget } from '@comfyorg/litegraph/dist/types/widgets'
|
||||
|
||||
import type { InputSpec } from '@/schemas/apiSchema'
|
||||
import { addValueControlWidgets } from '@/scripts/widgets'
|
||||
import type { ComfyWidgetConstructor } from '@/scripts/widgets'
|
||||
import { useWidgetStore } from '@/stores/widgetStore'
|
||||
import type { InputSpec } from '@/types/apiTypes'
|
||||
|
||||
import { useRemoteWidget } from './useRemoteWidget'
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { LGraphNode } from '@comfyorg/litegraph'
|
||||
import type { INumericWidget } from '@comfyorg/litegraph/dist/types/widgets'
|
||||
|
||||
import type { InputSpec } from '@/schemas/apiSchema'
|
||||
import type { ComfyWidgetConstructor } from '@/scripts/widgets'
|
||||
import { useSettingStore } from '@/stores/settingStore'
|
||||
import type { InputSpec } from '@/types/apiTypes'
|
||||
import { getNumberDefaults } from '@/utils/mathUtil'
|
||||
|
||||
export const useFloatWidget = () => {
|
||||
|
||||
@@ -5,10 +5,10 @@ import { useNodeImage, useNodeVideo } from '@/composables/node/useNodeImage'
|
||||
import { useNodeImageUpload } from '@/composables/node/useNodeImageUpload'
|
||||
import { useValueTransform } from '@/composables/useValueTransform'
|
||||
import { t } from '@/i18n'
|
||||
import type { InputSpec, ResultItem } from '@/schemas/apiSchema'
|
||||
import type { ComfyWidgetConstructor } from '@/scripts/widgets'
|
||||
import { useNodeOutputStore } from '@/stores/imagePreviewStore'
|
||||
import type { ComfyApp } from '@/types'
|
||||
import type { InputSpec, ResultItem } from '@/types/apiTypes'
|
||||
import { createAnnotatedPath } from '@/utils/formatUtil'
|
||||
import { addToComboValues } from '@/utils/litegraphUtil'
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import type { LGraphNode } from '@comfyorg/litegraph'
|
||||
import type { INumericWidget } from '@comfyorg/litegraph/dist/types/widgets'
|
||||
|
||||
import { InputSpec } from '@/schemas/apiSchema'
|
||||
import type { ComfyApp } from '@/scripts/app'
|
||||
import {
|
||||
type ComfyWidgetConstructor,
|
||||
addValueControlWidget
|
||||
} from '@/scripts/widgets'
|
||||
import { useSettingStore } from '@/stores/settingStore'
|
||||
import { InputSpec } from '@/types/apiTypes'
|
||||
import { getNumberDefaults } from '@/utils/mathUtil'
|
||||
|
||||
export const useIntWidget = () => {
|
||||
|
||||
@@ -8,9 +8,9 @@ import TiptapTableRow from '@tiptap/extension-table-row'
|
||||
import TiptapStarterKit from '@tiptap/starter-kit'
|
||||
import { Markdown as TiptapMarkdown } from 'tiptap-markdown'
|
||||
|
||||
import type { InputSpec } from '@/schemas/apiSchema'
|
||||
import type { ComfyWidgetConstructor } from '@/scripts/widgets'
|
||||
import type { ComfyApp } from '@/types'
|
||||
import type { InputSpec } from '@/types/apiTypes'
|
||||
|
||||
function addMarkdownWidget(
|
||||
node: LGraphNode,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { LGraphNode } from '@comfyorg/litegraph'
|
||||
import { IWidget } from '@comfyorg/litegraph'
|
||||
import axios from 'axios'
|
||||
|
||||
import type { InputSpec, RemoteWidgetConfig } from '@/types/apiTypes'
|
||||
import type { InputSpec, RemoteWidgetConfig } from '@/schemas/apiSchema'
|
||||
|
||||
const MAX_RETRIES = 5
|
||||
const TIMEOUT = 4096
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { LGraphNode } from '@comfyorg/litegraph'
|
||||
|
||||
import type { InputSpec } from '@/schemas/apiSchema'
|
||||
import type { ComfyWidgetConstructor } from '@/scripts/widgets'
|
||||
import type { ComfyApp } from '@/types'
|
||||
import type { InputSpec } from '@/types/apiTypes'
|
||||
|
||||
import { useIntWidget } from './useIntWidget'
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { IWidget, LGraphNode } from '@comfyorg/litegraph'
|
||||
|
||||
import type { InputSpec } from '@/schemas/apiSchema'
|
||||
import type { ComfyWidgetConstructor } from '@/scripts/widgets'
|
||||
import { useSettingStore } from '@/stores/settingStore'
|
||||
import type { ComfyApp } from '@/types'
|
||||
import type { InputSpec } from '@/types/apiTypes'
|
||||
|
||||
function addMultilineWidget(
|
||||
node: LGraphNode,
|
||||
|
||||
@@ -4,7 +4,10 @@ import github from '@/assets/palettes/github.json'
|
||||
import light from '@/assets/palettes/light.json'
|
||||
import nord from '@/assets/palettes/nord.json'
|
||||
import solarized from '@/assets/palettes/solarized.json'
|
||||
import type { ColorPalettes, CompletedPalette } from '@/types/colorPaletteTypes'
|
||||
import type {
|
||||
ColorPalettes,
|
||||
CompletedPalette
|
||||
} from '@/schemas/colorPaletteSchema'
|
||||
|
||||
export const CORE_COLOR_PALETTES: ColorPalettes = {
|
||||
dark,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Keybinding } from '@/types/keyBindingTypes'
|
||||
import type { Keybinding } from '@/schemas/keyBindingSchema'
|
||||
|
||||
export const CORE_KEYBINDINGS: Keybinding[] = [
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { LinkMarkerShape } from '@comfyorg/litegraph'
|
||||
import { LiteGraph } from '@comfyorg/litegraph'
|
||||
|
||||
import type { ColorPalettes } from '@/types/colorPaletteTypes'
|
||||
import type { Keybinding } from '@/types/keyBindingTypes'
|
||||
import type { ColorPalettes } from '@/schemas/colorPaletteSchema'
|
||||
import type { Keybinding } from '@/schemas/keyBindingSchema'
|
||||
import { NodeBadgeMode } from '@/types/nodeSource'
|
||||
import { LinkReleaseTriggerAction } from '@/types/searchBoxTypes'
|
||||
import type { SettingParams } from '@/types/settingTypes'
|
||||
|
||||
@@ -3,12 +3,16 @@ import { type LGraph, LGraphCanvas, LiteGraph } from '@comfyorg/litegraph'
|
||||
import { LGraphNode, type NodeId } from '@comfyorg/litegraph/dist/LGraphNode'
|
||||
|
||||
import { t } from '@/i18n'
|
||||
import type { ComfyNodeDef } from '@/schemas/apiSchema'
|
||||
import {
|
||||
ComfyLink,
|
||||
ComfyNode,
|
||||
ComfyWorkflowJSON
|
||||
} from '@/schemas/comfyWorkflowSchema'
|
||||
import { useDialogService } from '@/services/dialogService'
|
||||
import { useNodeDefStore } from '@/stores/nodeDefStore'
|
||||
import { useToastStore } from '@/stores/toastStore'
|
||||
import type { ComfyNodeDef } from '@/types/apiTypes'
|
||||
import { ComfyExtension } from '@/types/comfy'
|
||||
import { ComfyLink, ComfyNode, ComfyWorkflowJSON } from '@/types/comfyWorkflow'
|
||||
import { deserialiseAndCreate, serialise } from '@/utils/vintageClipboard'
|
||||
|
||||
import { api } from '../../scripts/api'
|
||||
|
||||
@@ -6,9 +6,9 @@ import { useNodeDragAndDrop } from '@/composables/node/useNodeDragAndDrop'
|
||||
import { useNodeFileInput } from '@/composables/node/useNodeFileInput'
|
||||
import { useNodePaste } from '@/composables/node/useNodePaste'
|
||||
import { t } from '@/i18n'
|
||||
import { ComfyNodeDef } from '@/schemas/apiSchema'
|
||||
import type { DOMWidget } from '@/scripts/domWidget'
|
||||
import { useToastStore } from '@/stores/toastStore'
|
||||
import { ComfyNodeDef } from '@/types/apiTypes'
|
||||
|
||||
import { api } from '../../scripts/api'
|
||||
import { app } from '../../scripts/app'
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import { ComfyNodeDef, InputSpec, isComboInputSpecV1 } from '@/types/apiTypes'
|
||||
import {
|
||||
ComfyNodeDef,
|
||||
InputSpec,
|
||||
isComboInputSpecV1
|
||||
} from '@/schemas/apiSchema'
|
||||
|
||||
import { app } from '../../scripts/app'
|
||||
|
||||
|
||||
@@ -12,12 +12,12 @@ import type {
|
||||
} from '@comfyorg/litegraph'
|
||||
import type { CanvasMouseEvent } from '@comfyorg/litegraph/dist/types/events'
|
||||
|
||||
import type { InputSpec } from '@/schemas/apiSchema'
|
||||
import { app } from '@/scripts/app'
|
||||
import { applyTextReplacements, clone } from '@/scripts/utils'
|
||||
import { ComfyWidgets, addValueControlWidgets } from '@/scripts/widgets'
|
||||
import { useNodeDefStore } from '@/stores/nodeDefStore'
|
||||
import { useSettingStore } from '@/stores/settingStore'
|
||||
import type { InputSpec } from '@/types/apiTypes'
|
||||
import { isPrimitiveNode } from '@/utils/typeGuardUtil'
|
||||
|
||||
const CONVERTED_TYPE = 'converted-widget'
|
||||
|
||||
@@ -2,11 +2,11 @@ import { LinkMarkerShape } from '@comfyorg/litegraph'
|
||||
import { ZodType, z } from 'zod'
|
||||
import { fromZodError } from 'zod-validation-error'
|
||||
|
||||
import { colorPalettesSchema } from './colorPaletteTypes'
|
||||
import { zComfyWorkflow, zNodeId } from './comfyWorkflow'
|
||||
import { zKeybinding } from './keyBindingTypes'
|
||||
import { NodeBadgeMode } from './nodeSource'
|
||||
import { LinkReleaseTriggerAction } from './searchBoxTypes'
|
||||
import { colorPalettesSchema } from '@/schemas/colorPaletteSchema'
|
||||
import { zComfyWorkflow, zNodeId } from '@/schemas/comfyWorkflowSchema'
|
||||
import { zKeybinding } from '@/schemas/keyBindingSchema'
|
||||
import { NodeBadgeMode } from '@/types/nodeSource'
|
||||
import { LinkReleaseTriggerAction } from '@/types/searchBoxTypes'
|
||||
|
||||
const zNodeType = z.string()
|
||||
const zQueueIndex = z.number()
|
||||
13
src/schemas/issueReportSchema.ts
Normal file
13
src/schemas/issueReportSchema.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
const checkboxField = z.boolean().optional()
|
||||
export const issueReportSchema = z
|
||||
.object({
|
||||
contactInfo: z.string().email().max(320).optional().or(z.literal('')),
|
||||
details: z.string().max(5_000).optional()
|
||||
})
|
||||
.catchall(checkboxField)
|
||||
.refine((data) => Object.values(data).some((value) => value), {
|
||||
path: ['details']
|
||||
})
|
||||
export type IssueReportFormData = z.infer<typeof issueReportSchema>
|
||||
@@ -24,9 +24,9 @@ import type {
|
||||
SystemStats,
|
||||
User,
|
||||
UserDataFullInfo
|
||||
} from '@/types/apiTypes'
|
||||
import { validateComfyNodeDef } from '@/types/apiTypes'
|
||||
import type { ComfyWorkflowJSON, NodeId } from '@/types/comfyWorkflow'
|
||||
} from '@/schemas/apiSchema'
|
||||
import { validateComfyNodeDef } from '@/schemas/apiSchema'
|
||||
import type { ComfyWorkflowJSON, NodeId } from '@/schemas/comfyWorkflowSchema'
|
||||
|
||||
interface QueuePromptRequestBody {
|
||||
client_id: string
|
||||
|
||||
@@ -13,6 +13,12 @@ import type { ToastMessageOptions } from 'primevue/toast'
|
||||
import { reactive } from 'vue'
|
||||
|
||||
import { st } from '@/i18n'
|
||||
import type { ComfyNodeDef } from '@/schemas/apiSchema'
|
||||
import {
|
||||
type ComfyWorkflowJSON,
|
||||
type NodeId,
|
||||
validateComfyWorkflow
|
||||
} from '@/schemas/comfyWorkflowSchema'
|
||||
import { useDialogService } from '@/services/dialogService'
|
||||
import { useExtensionService } from '@/services/extensionService'
|
||||
import { useLitegraphService } from '@/services/litegraphService'
|
||||
@@ -29,13 +35,7 @@ import { useWidgetStore } from '@/stores/widgetStore'
|
||||
import { ComfyWorkflow } from '@/stores/workflowStore'
|
||||
import { useColorPaletteStore } from '@/stores/workspace/colorPaletteStore'
|
||||
import { useWorkspaceStore } from '@/stores/workspaceStore'
|
||||
import type { ComfyNodeDef } from '@/types/apiTypes'
|
||||
import type { ComfyExtension, MissingNodeType } from '@/types/comfy'
|
||||
import {
|
||||
type ComfyWorkflowJSON,
|
||||
type NodeId,
|
||||
validateComfyWorkflow
|
||||
} from '@/types/comfyWorkflow'
|
||||
import { ExtensionManager } from '@/types/extensionTypes'
|
||||
import { ColorAdjustOptions, adjustColor } from '@/utils/colorUtil'
|
||||
import { graphToPrompt } from '@/utils/executionUtil'
|
||||
|
||||
@@ -4,10 +4,10 @@ import * as jsondiffpatch from 'jsondiffpatch'
|
||||
import _ from 'lodash'
|
||||
import log from 'loglevel'
|
||||
|
||||
import type { ExecutedWsMessage } from '@/schemas/apiSchema'
|
||||
import type { ComfyWorkflowJSON } from '@/schemas/comfyWorkflowSchema'
|
||||
import { useExecutionStore } from '@/stores/executionStore'
|
||||
import { ComfyWorkflow, useWorkflowStore } from '@/stores/workflowStore'
|
||||
import type { ExecutedWsMessage } from '@/types/apiTypes'
|
||||
import type { ComfyWorkflowJSON } from '@/types/comfyWorkflow'
|
||||
|
||||
import { api } from './api'
|
||||
import type { ComfyApp } from './app'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ComfyWorkflowJSON } from '@/types/comfyWorkflow'
|
||||
import type { ComfyWorkflowJSON } from '@/schemas/comfyWorkflowSchema'
|
||||
|
||||
export const defaultGraph: ComfyWorkflowJSON = {
|
||||
last_node_id: 9,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// @ts-strict-ignore
|
||||
import { type StatusWsMessageStatus, TaskItem } from '@/schemas/apiSchema'
|
||||
import { useDialogService } from '@/services/dialogService'
|
||||
import { useLitegraphService } from '@/services/litegraphService'
|
||||
import { useCommandStore } from '@/stores/commandStore'
|
||||
import { useSettingStore } from '@/stores/settingStore'
|
||||
import { useWorkspaceStore } from '@/stores/workspaceStore'
|
||||
import { type StatusWsMessageStatus, TaskItem } from '@/types/apiTypes'
|
||||
|
||||
import { api } from './api'
|
||||
import { ComfyApp, app } from './app'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// @ts-strict-ignore
|
||||
import { Settings } from '@/schemas/apiSchema'
|
||||
import type { ComfyApp } from '@/scripts/app'
|
||||
import { Settings } from '@/types/apiTypes'
|
||||
|
||||
import type { ComfyComponent } from '.'
|
||||
import { $el } from '../../ui'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Settings } from '@/schemas/apiSchema'
|
||||
import type { ComfyApp } from '@/scripts/app'
|
||||
import { useSettingStore } from '@/stores/settingStore'
|
||||
import { useToastStore } from '@/stores/toastStore'
|
||||
import type { Settings } from '@/types/apiTypes'
|
||||
import type { SettingParams } from '@/types/settingTypes'
|
||||
|
||||
import { ComfyDialog } from './dialog'
|
||||
|
||||
@@ -14,8 +14,8 @@ import { useMarkdownWidget } from '@/composables/widgets/useMarkdownWidget'
|
||||
import { useSeedWidget } from '@/composables/widgets/useSeedWidget'
|
||||
import { useStringWidget } from '@/composables/widgets/useStringWidget'
|
||||
import { t } from '@/i18n'
|
||||
import type { InputSpec } from '@/schemas/apiSchema'
|
||||
import { useSettingStore } from '@/stores/settingStore'
|
||||
import type { InputSpec } from '@/types/apiTypes'
|
||||
|
||||
import type { ComfyApp } from './app'
|
||||
import './domWidget'
|
||||
|
||||
@@ -4,12 +4,16 @@ import { toRaw } from 'vue'
|
||||
import { fromZodError } from 'zod-validation-error'
|
||||
|
||||
import { useErrorHandling } from '@/composables/useErrorHandling'
|
||||
import {
|
||||
Colors,
|
||||
type Palette,
|
||||
paletteSchema
|
||||
} from '@/schemas/colorPaletteSchema'
|
||||
import { app } from '@/scripts/app'
|
||||
import { downloadBlob, uploadFile } from '@/scripts/utils'
|
||||
import { useNodeDefStore } from '@/stores/nodeDefStore'
|
||||
import { useSettingStore } from '@/stores/settingStore'
|
||||
import { useColorPaletteStore } from '@/stores/workspace/colorPaletteStore'
|
||||
import { Colors, type Palette, paletteSchema } from '@/types/colorPaletteTypes'
|
||||
|
||||
export const useColorPaletteService = () => {
|
||||
const colorPaletteStore = useColorPaletteStore()
|
||||
|
||||
@@ -12,14 +12,14 @@ import { IBaseWidget, IWidget } from '@comfyorg/litegraph/dist/types/widgets'
|
||||
|
||||
import { useNodeImage, useNodeVideo } from '@/composables/node/useNodeImage'
|
||||
import { st } from '@/i18n'
|
||||
import { ComfyNodeDef } from '@/schemas/apiSchema'
|
||||
import type { NodeId } from '@/schemas/comfyWorkflowSchema'
|
||||
import { ANIM_PREVIEW_WIDGET, ComfyApp, app } from '@/scripts/app'
|
||||
import { $el } from '@/scripts/ui'
|
||||
import { calculateImageGrid, createImageHost } from '@/scripts/ui/imagePreview'
|
||||
import { useCanvasStore } from '@/stores/graphStore'
|
||||
import { useNodeOutputStore } from '@/stores/imagePreviewStore'
|
||||
import { useToastStore } from '@/stores/toastStore'
|
||||
import { ComfyNodeDef } from '@/types/apiTypes'
|
||||
import type { NodeId } from '@/types/comfyWorkflow'
|
||||
import { normalizeI18nKey } from '@/utils/formatUtil'
|
||||
import { is_all_same_aspect_ratio } from '@/utils/imageUtil'
|
||||
import { getImageTop, isImageNode, isVideoNode } from '@/utils/litegraphUtil'
|
||||
|
||||
@@ -3,6 +3,7 @@ import type { Vector2 } from '@comfyorg/litegraph'
|
||||
import { toRaw } from 'vue'
|
||||
|
||||
import { t } from '@/i18n'
|
||||
import { ComfyWorkflowJSON } from '@/schemas/comfyWorkflowSchema'
|
||||
import { api } from '@/scripts/api'
|
||||
import { app } from '@/scripts/app'
|
||||
import { blankGraph, defaultGraph } from '@/scripts/defaultGraph'
|
||||
@@ -11,7 +12,6 @@ import { useSettingStore } from '@/stores/settingStore'
|
||||
import { useToastStore } from '@/stores/toastStore'
|
||||
import { ComfyWorkflow, useWorkflowStore } from '@/stores/workflowStore'
|
||||
import { useWorkspaceStore } from '@/stores/workspaceStore'
|
||||
import { ComfyWorkflowJSON } from '@/types/comfyWorkflow'
|
||||
import { appendJsonExt } from '@/utils/formatUtil'
|
||||
|
||||
import { useDialogService } from './dialogService'
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
import { api } from '@/scripts/api'
|
||||
import type {
|
||||
ExecutedWsMessage,
|
||||
ExecutingWsMessage,
|
||||
@@ -9,8 +8,12 @@ import type {
|
||||
ExecutionStartWsMessage,
|
||||
ProgressWsMessage,
|
||||
StatusWsMessage
|
||||
} from '@/types/apiTypes'
|
||||
import type { ComfyNode, ComfyWorkflowJSON } from '@/types/comfyWorkflow'
|
||||
} from '@/schemas/apiSchema'
|
||||
import type {
|
||||
ComfyNode,
|
||||
ComfyWorkflowJSON
|
||||
} from '@/schemas/comfyWorkflowSchema'
|
||||
import { api } from '@/scripts/api'
|
||||
|
||||
import { ComfyWorkflow } from './workflowStore'
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { LGraphNode } from '@comfyorg/litegraph'
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
import { ExecutedWsMessage, ResultItem } from '@/schemas/apiSchema'
|
||||
import { api } from '@/scripts/api'
|
||||
import { ExecutedWsMessage, ResultItem } from '@/types/apiTypes'
|
||||
import { parseFilePath } from '@/utils/formatUtil'
|
||||
import { isVideoNode } from '@/utils/litegraphUtil'
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { defineStore } from 'pinia'
|
||||
import { Ref, computed, ref, toRaw } from 'vue'
|
||||
|
||||
import { RESERVED_BY_TEXT_INPUT } from '@/constants/reservedKeyCombos'
|
||||
import { KeyCombo, Keybinding } from '@/types/keyBindingTypes'
|
||||
import { KeyCombo, Keybinding } from '@/schemas/keyBindingSchema'
|
||||
|
||||
export class KeybindingImpl implements Keybinding {
|
||||
commandId: string
|
||||
|
||||
@@ -3,7 +3,7 @@ import { defineStore } from 'pinia'
|
||||
import type { TreeNode } from 'primevue/treenode'
|
||||
import { computed } from 'vue'
|
||||
|
||||
import type { BookmarkCustomization } from '@/types/apiTypes'
|
||||
import type { BookmarkCustomization } from '@/schemas/apiSchema'
|
||||
|
||||
import { useNodeDefStore } from './nodeDefStore'
|
||||
import { ComfyNodeDefImpl, createDummyFolderNodeDef } from './nodeDefStore'
|
||||
|
||||
@@ -4,16 +4,16 @@ import { defineStore } from 'pinia'
|
||||
import type { TreeNode } from 'primevue/treenode'
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
import {
|
||||
NodeSearchService,
|
||||
type SearchAuxScore
|
||||
} from '@/services/nodeSearchService'
|
||||
import {
|
||||
type ComfyInputsSpec as ComfyInputsSpecSchema,
|
||||
type ComfyNodeDef,
|
||||
type ComfyOutputTypesSpec as ComfyOutputTypesSpecSchema,
|
||||
type InputSpec
|
||||
} from '@/types/apiTypes'
|
||||
} from '@/schemas/apiSchema'
|
||||
import {
|
||||
NodeSearchService,
|
||||
type SearchAuxScore
|
||||
} from '@/services/nodeSearchService'
|
||||
import {
|
||||
type NodeSource,
|
||||
NodeSourceType,
|
||||
|
||||
@@ -3,8 +3,6 @@ import { defineStore } from 'pinia'
|
||||
import { toRaw } from 'vue'
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
import { api } from '@/scripts/api'
|
||||
import type { ComfyApp } from '@/scripts/app'
|
||||
import type {
|
||||
ResultItem,
|
||||
StatusWsMessageStatus,
|
||||
@@ -13,8 +11,10 @@ import type {
|
||||
TaskPrompt,
|
||||
TaskStatus,
|
||||
TaskType
|
||||
} from '@/types/apiTypes'
|
||||
import type { ComfyWorkflowJSON, NodeId } from '@/types/comfyWorkflow'
|
||||
} from '@/schemas/apiSchema'
|
||||
import type { ComfyWorkflowJSON, NodeId } from '@/schemas/comfyWorkflowSchema'
|
||||
import { api } from '@/scripts/api'
|
||||
import type { ComfyApp } from '@/scripts/app'
|
||||
|
||||
// Task type used in the API.
|
||||
export type APITaskType = 'queue' | 'history'
|
||||
|
||||
@@ -3,9 +3,9 @@ import { defineStore } from 'pinia'
|
||||
import type { TreeNode } from 'primevue/treenode'
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
import type { Settings } from '@/schemas/apiSchema'
|
||||
import { api } from '@/scripts/api'
|
||||
import { app } from '@/scripts/app'
|
||||
import type { Settings } from '@/types/apiTypes'
|
||||
import type { SettingParams } from '@/types/settingTypes'
|
||||
import { buildTree } from '@/utils/treeUtil'
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
|
||||
import type { SystemStats } from '@/schemas/apiSchema'
|
||||
import { api } from '@/scripts/api'
|
||||
import type { SystemStats } from '@/types/apiTypes'
|
||||
|
||||
export const useSystemStatsStore = defineStore('systemStats', () => {
|
||||
const systemStats = ref<SystemStats | null>(null)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
import { UserDataFullInfo } from '@/schemas/apiSchema'
|
||||
import { api } from '@/scripts/api'
|
||||
import { UserDataFullInfo } from '@/types/apiTypes'
|
||||
import { TreeExplorerNode } from '@/types/treeExplorerTypes'
|
||||
import { getPathDetails } from '@/utils/formatUtil'
|
||||
import { syncEntities } from '@/utils/syncUtil'
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { computed, ref, watchEffect } from 'vue'
|
||||
|
||||
import type { User as UserConfig } from '@/schemas/apiSchema'
|
||||
import { api } from '@/scripts/api'
|
||||
import type { User as UserConfig } from '@/types/apiTypes'
|
||||
|
||||
export interface User {
|
||||
userId: string
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
import { ComfyWidgetConstructor, ComfyWidgets } from '@/scripts/widgets'
|
||||
import {
|
||||
ComboInputSpecV2,
|
||||
InputSpec,
|
||||
isComboInputSpecV1
|
||||
} from '@/types/apiTypes'
|
||||
} from '@/schemas/apiSchema'
|
||||
import { ComfyWidgetConstructor, ComfyWidgets } from '@/scripts/widgets'
|
||||
|
||||
import type { BaseInputSpec } from './nodeDefStore'
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@ import _ from 'lodash'
|
||||
import { defineStore } from 'pinia'
|
||||
import { computed, markRaw, ref } from 'vue'
|
||||
|
||||
import { ComfyWorkflowJSON } from '@/schemas/comfyWorkflowSchema'
|
||||
import { api } from '@/scripts/api'
|
||||
import { ChangeTracker } from '@/scripts/changeTracker'
|
||||
import { defaultGraphJSON } from '@/scripts/defaultGraph'
|
||||
import { ComfyWorkflowJSON } from '@/types/comfyWorkflow'
|
||||
import { getPathDetails } from '@/utils/formatUtil'
|
||||
import { syncEntities } from '@/utils/syncUtil'
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import type {
|
||||
ColorPalettes,
|
||||
CompletedPalette,
|
||||
Palette
|
||||
} from '@/types/colorPaletteTypes'
|
||||
} from '@/schemas/colorPaletteSchema'
|
||||
|
||||
export const useColorPaletteStore = defineStore('colorPalette', () => {
|
||||
const customPalettes = ref<ColorPalettes>({})
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import type { LGraphNode } from '@comfyorg/litegraph'
|
||||
import { Positionable } from '@comfyorg/litegraph/dist/interfaces'
|
||||
|
||||
import type { ComfyNodeDef } from '@/schemas/apiSchema'
|
||||
import type { ComfyWorkflowJSON } from '@/schemas/comfyWorkflowSchema'
|
||||
import type { Keybinding } from '@/schemas/keyBindingSchema'
|
||||
import type { ComfyApp } from '@/scripts/app'
|
||||
import type { ComfyWidgetConstructor } from '@/scripts/widgets'
|
||||
import type { ComfyCommand } from '@/stores/commandStore'
|
||||
import type { ComfyNodeDef } from '@/types/apiTypes'
|
||||
import type { ComfyWorkflowJSON } from '@/types/comfyWorkflow'
|
||||
import type { BottomPanelExtension } from '@/types/extensionTypes'
|
||||
import type { Keybinding } from '@/types/keyBindingTypes'
|
||||
import type { SettingParams } from '@/types/settingTypes'
|
||||
|
||||
export type Widgets = Record<string, ComfyWidgetConstructor>
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export type DefaultField = 'Workflow' | 'Logs' | 'SystemStats' | 'Settings'
|
||||
|
||||
export interface ReportField {
|
||||
@@ -51,15 +49,3 @@ export interface IssueReportPanelProps {
|
||||
*/
|
||||
title?: string
|
||||
}
|
||||
|
||||
const checkboxField = z.boolean().optional()
|
||||
export const issueReportSchema = z
|
||||
.object({
|
||||
contactInfo: z.string().email().max(320).optional().or(z.literal('')),
|
||||
details: z.string().max(5_000).optional()
|
||||
})
|
||||
.catchall(checkboxField)
|
||||
.refine((data) => Object.values(data).some((value) => value), {
|
||||
path: ['details']
|
||||
})
|
||||
export type IssueReportFormData = z.infer<typeof issueReportSchema>
|
||||
|
||||
4
src/types/litegraph-augmentation.d.ts
vendored
4
src/types/litegraph-augmentation.d.ts
vendored
@@ -1,10 +1,10 @@
|
||||
import '@comfyorg/litegraph'
|
||||
import type { LLink, Size } from '@comfyorg/litegraph'
|
||||
|
||||
import type { ComfyNodeDef } from '@/schemas/apiSchema'
|
||||
import type { DOMWidget, DOMWidgetOptions } from '@/scripts/domWidget'
|
||||
import type { ComfyNodeDef } from '@/types/apiTypes'
|
||||
|
||||
import type { NodeId } from './comfyWorkflow'
|
||||
import type { NodeId } from '../schemas/comfyWorkflowSchema'
|
||||
|
||||
/** ComfyUI extensions of litegraph */
|
||||
declare module '@comfyorg/litegraph/dist/types/widgets' {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Settings } from './apiTypes'
|
||||
import type { Settings } from '@/schemas/apiSchema'
|
||||
|
||||
export type SettingInputType =
|
||||
| 'boolean'
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import type { LGraph } from '@comfyorg/litegraph'
|
||||
import { LGraphEventMode } from '@comfyorg/litegraph'
|
||||
|
||||
import type { ComfyApiWorkflow, ComfyWorkflowJSON } from '@/types/comfyWorkflow'
|
||||
import type {
|
||||
ComfyApiWorkflow,
|
||||
ComfyWorkflowJSON
|
||||
} from '@/schemas/comfyWorkflowSchema'
|
||||
|
||||
/**
|
||||
* Converts the current graph workflow for sending to the API.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ResultItem } from '@/types/apiTypes'
|
||||
import { ResultItem } from '@/schemas/apiSchema'
|
||||
|
||||
export function formatCamelCase(str: string): string {
|
||||
// Check if the string is camel case
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { InputSpec } from '@/types/apiTypes'
|
||||
import type { InputSpec } from '@/schemas/apiSchema'
|
||||
|
||||
export function getNumberDefaults(
|
||||
inputOptions: InputSpec[1],
|
||||
|
||||
@@ -36,6 +36,7 @@ import { useCoreCommands } from '@/composables/useCoreCommands'
|
||||
import { useErrorHandling } from '@/composables/useErrorHandling'
|
||||
import { SERVER_CONFIG_ITEMS } from '@/constants/serverConfig'
|
||||
import { i18n } from '@/i18n'
|
||||
import { StatusWsMessageStatus } from '@/schemas/apiSchema'
|
||||
import { api } from '@/scripts/api'
|
||||
import { app } from '@/scripts/app'
|
||||
import { setupAutoQueueHandler } from '@/services/autoQueueService'
|
||||
@@ -55,7 +56,6 @@ import { useBottomPanelStore } from '@/stores/workspace/bottomPanelStore'
|
||||
import { useColorPaletteStore } from '@/stores/workspace/colorPaletteStore'
|
||||
import { useSidebarTabStore } from '@/stores/workspace/sidebarTabStore'
|
||||
import { useWorkspaceStore } from '@/stores/workspaceStore'
|
||||
import { StatusWsMessageStatus } from '@/types/apiTypes'
|
||||
import { electronAPI, isElectron } from '@/utils/envUtil'
|
||||
|
||||
setupAutoQueueHandler()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
|
||||
import { ComfyNodeDef, validateComfyNodeDef } from '@/types/apiTypes'
|
||||
import { ComfyNodeDef, validateComfyNodeDef } from '@/schemas/apiSchema'
|
||||
|
||||
const EXAMPLE_NODE_DEF: ComfyNodeDef = {
|
||||
input: {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// @ts-strict-ignore
|
||||
import fs from 'fs'
|
||||
|
||||
import { validateComfyWorkflow } from '@/schemas/comfyWorkflowSchema'
|
||||
import { defaultGraph } from '@/scripts/defaultGraph'
|
||||
import { validateComfyWorkflow } from '@/types/comfyWorkflow'
|
||||
|
||||
const WORKFLOW_DIR = 'tests-ui/workflows'
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { createPinia, setActivePinia } from 'pinia'
|
||||
|
||||
import { useComboWidget } from '@/composables/widgets/useComboWidget'
|
||||
import type { InputSpec } from '@/types/apiTypes'
|
||||
import type { InputSpec } from '@/schemas/apiSchema'
|
||||
|
||||
jest.mock('@/scripts/widgets', () => ({
|
||||
addValueControlWidgets: jest.fn()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import axios from 'axios'
|
||||
|
||||
import { useRemoteWidget } from '@/composables/widgets/useRemoteWidget'
|
||||
import type { ComboInputSpecV2 } from '@/types/apiTypes'
|
||||
import type { ComboInputSpecV2 } from '@/schemas/apiSchema'
|
||||
|
||||
jest.mock('axios', () => ({
|
||||
get: jest.fn()
|
||||
|
||||
Reference in New Issue
Block a user