From cdf42d5ad73157c5759d2681906080629311de0c Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Thu, 27 Feb 2025 13:05:01 -0500 Subject: [PATCH] [Refactor] Move zod schemas to schemas/ folder (#2753) --- browser_tests/actionbar.spec.ts | 2 +- browser_tests/colorPalette.spec.ts | 2 +- browser_tests/dialog.spec.ts | 2 +- browser_tests/fixtures/ComfyPage.ts | 4 ++-- browser_tests/fixtures/utils/taskHistory.ts | 2 +- .../bottomPanel/tabs/terminal/LogsTerminal.vue | 2 +- src/components/common/DeviceInfo.vue | 2 +- src/components/common/SystemStatsPanel.vue | 2 +- .../dialog/content/ExecutionErrorDialogContent.vue | 2 +- .../dialog/content/error/ReportIssuePanel.vue | 10 +++++----- src/components/sidebar/tabs/QueueSidebarTab.vue | 2 +- .../sidebar/tabs/nodeLibrary/NodeTreeFolder.vue | 2 +- src/components/sidebar/tabs/queue/TaskItem.vue | 2 +- src/composables/usePaste.ts | 2 +- src/composables/widgets/useBooleanWidget.ts | 2 +- src/composables/widgets/useComboWidget.ts | 2 +- src/composables/widgets/useFloatWidget.ts | 2 +- src/composables/widgets/useImageUploadWidget.ts | 2 +- src/composables/widgets/useIntWidget.ts | 2 +- src/composables/widgets/useMarkdownWidget.ts | 2 +- src/composables/widgets/useRemoteWidget.ts | 2 +- src/composables/widgets/useSeedWidget.ts | 2 +- src/composables/widgets/useStringWidget.ts | 2 +- src/constants/coreColorPalettes.ts | 5 ++++- src/constants/coreKeybindings.ts | 2 +- src/constants/coreSettings.ts | 4 ++-- src/extensions/core/groupNode.ts | 8 ++++++-- src/extensions/core/uploadAudio.ts | 2 +- src/extensions/core/uploadImage.ts | 6 +++++- src/extensions/core/widgetInputs.ts | 2 +- src/{types/apiTypes.ts => schemas/apiSchema.ts} | 10 +++++----- .../colorPaletteSchema.ts} | 0 .../comfyWorkflowSchema.ts} | 0 src/schemas/issueReportSchema.ts | 13 +++++++++++++ .../keyBindingSchema.ts} | 0 src/scripts/api.ts | 6 +++--- src/scripts/app.ts | 12 ++++++------ src/scripts/changeTracker.ts | 4 ++-- src/scripts/defaultGraph.ts | 2 +- src/scripts/ui.ts | 2 +- src/scripts/ui/components/button.ts | 2 +- src/scripts/ui/settings.ts | 2 +- src/scripts/widgets.ts | 2 +- src/services/colorPaletteService.ts | 6 +++++- src/services/litegraphService.ts | 4 ++-- src/services/workflowService.ts | 2 +- src/stores/executionStore.ts | 9 ++++++--- src/stores/imagePreviewStore.ts | 2 +- src/stores/keybindingStore.ts | 2 +- src/stores/nodeBookmarkStore.ts | 2 +- src/stores/nodeDefStore.ts | 10 +++++----- src/stores/queueStore.ts | 8 ++++---- src/stores/settingStore.ts | 2 +- src/stores/systemStatsStore.ts | 2 +- src/stores/userFileStore.ts | 2 +- src/stores/userStore.ts | 2 +- src/stores/widgetStore.ts | 4 ++-- src/stores/workflowStore.ts | 2 +- src/stores/workspace/colorPaletteStore.ts | 2 +- src/types/comfy.ts | 6 +++--- src/types/issueReportTypes.ts | 14 -------------- src/types/litegraph-augmentation.d.ts | 4 ++-- src/types/settingTypes.ts | 2 +- src/utils/executionUtil.ts | 5 ++++- src/utils/formatUtil.ts | 2 +- src/utils/mathUtil.ts | 2 +- src/views/GraphView.vue | 2 +- tests-ui/tests/apiTypes.test.ts | 2 +- tests-ui/tests/comfyWorkflow.test.ts | 2 +- .../composables/widgets/useComboWidget.test.ts | 2 +- .../composables/widgets/useRemoteWidget.test.ts | 2 +- 71 files changed, 133 insertions(+), 113 deletions(-) rename src/{types/apiTypes.ts => schemas/apiSchema.ts} (98%) rename src/{types/colorPaletteTypes.ts => schemas/colorPaletteSchema.ts} (100%) rename src/{types/comfyWorkflow.ts => schemas/comfyWorkflowSchema.ts} (100%) create mode 100644 src/schemas/issueReportSchema.ts rename src/{types/keyBindingTypes.ts => schemas/keyBindingSchema.ts} (100%) diff --git a/browser_tests/actionbar.spec.ts b/browser_tests/actionbar.spec.ts index 690d4be76..3b2c59ce9 100644 --- a/browser_tests/actionbar.spec.ts +++ b/browser_tests/actionbar.spec.ts @@ -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' diff --git a/browser_tests/colorPalette.spec.ts b/browser_tests/colorPalette.spec.ts index a8e1e6094..2daf0326b 100644 --- a/browser_tests/colorPalette.spec.ts +++ b/browser_tests/colorPalette.spec.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 = { diff --git a/browser_tests/dialog.spec.ts b/browser_tests/dialog.spec.ts index fc9ebb64f..edf656679 100644 --- a/browser_tests/dialog.spec.ts +++ b/browser_tests/dialog.spec.ts @@ -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', () => { diff --git a/browser_tests/fixtures/ComfyPage.ts b/browser_tests/fixtures/ComfyPage.ts index 301bc3348..0cb047990 100644 --- a/browser_tests/fixtures/ComfyPage.ts +++ b/browser_tests/fixtures/ComfyPage.ts @@ -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' diff --git a/browser_tests/fixtures/utils/taskHistory.ts b/browser_tests/fixtures/utils/taskHistory.ts index 33c0ba626..93d5b9b07 100644 --- a/browser_tests/fixtures/utils/taskHistory.ts +++ b/browser_tests/fixtures/utils/taskHistory.ts @@ -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] */ diff --git a/src/components/bottomPanel/tabs/terminal/LogsTerminal.vue b/src/components/bottomPanel/tabs/terminal/LogsTerminal.vue index ab1c5516a..f8fe342c2 100644 --- a/src/components/bottomPanel/tabs/terminal/LogsTerminal.vue +++ b/src/components/bottomPanel/tabs/terminal/LogsTerminal.vue @@ -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' diff --git a/src/components/common/DeviceInfo.vue b/src/components/common/DeviceInfo.vue index 8fbb57e45..5f81cefaf 100644 --- a/src/components/common/DeviceInfo.vue +++ b/src/components/common/DeviceInfo.vue @@ -8,7 +8,7 @@