diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedCanvas.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedCanvas.ts index 8c283ce64e..bcaf778b6e 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedCanvas.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedCanvas.ts @@ -10,8 +10,8 @@ import { blobToDataURL } from 'features/canvas/util/blobToDataURL'; import { getCanvasData } from 'features/canvas/util/getCanvasData'; import { getCanvasGenerationMode } from 'features/canvas/util/getCanvasGenerationMode'; import { canvasGraphBuilt } from 'features/nodes/store/actions'; -import { buildCanvasGraph } from 'features/nodes/util/graphBuilders/buildCanvasGraph'; -import { prepareLinearUIBatch } from 'features/nodes/util/graphBuilders/buildLinearBatchConfig'; +import { buildCanvasGraph } from 'features/nodes/util/graph/buildCanvasGraph'; +import { prepareLinearUIBatch } from 'features/nodes/util/graph/buildLinearBatchConfig'; import { imagesApi } from 'services/api/endpoints/images'; import { queueApi } from 'services/api/endpoints/queue'; import { ImageDTO } from 'services/api/types'; diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedLinear.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedLinear.ts index bb89d18b91..faeecfb44c 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedLinear.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedLinear.ts @@ -1,9 +1,9 @@ import { enqueueRequested } from 'app/store/actions'; -import { prepareLinearUIBatch } from 'features/nodes/util/graphBuilders/buildLinearBatchConfig'; -import { buildLinearImageToImageGraph } from 'features/nodes/util/graphBuilders/buildLinearImageToImageGraph'; -import { buildLinearSDXLImageToImageGraph } from 'features/nodes/util/graphBuilders/buildLinearSDXLImageToImageGraph'; -import { buildLinearSDXLTextToImageGraph } from 'features/nodes/util/graphBuilders/buildLinearSDXLTextToImageGraph'; -import { buildLinearTextToImageGraph } from 'features/nodes/util/graphBuilders/buildLinearTextToImageGraph'; +import { prepareLinearUIBatch } from 'features/nodes/util/graph/buildLinearBatchConfig'; +import { buildLinearImageToImageGraph } from 'features/nodes/util/graph/buildLinearImageToImageGraph'; +import { buildLinearSDXLImageToImageGraph } from 'features/nodes/util/graph/buildLinearSDXLImageToImageGraph'; +import { buildLinearSDXLTextToImageGraph } from 'features/nodes/util/graph/buildLinearSDXLTextToImageGraph'; +import { buildLinearTextToImageGraph } from 'features/nodes/util/graph/buildLinearTextToImageGraph'; import { queueApi } from 'services/api/endpoints/queue'; import { startAppListening } from '..'; diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedNodes.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedNodes.ts index b87e443a4e..b9b1060f18 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedNodes.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/enqueueRequestedNodes.ts @@ -1,5 +1,5 @@ import { enqueueRequested } from 'app/store/actions'; -import { buildNodesGraph } from 'features/nodes/util/graphBuilders/buildNodesGraph'; +import { buildNodesGraph } from 'features/nodes/util/graph/buildNodesGraph'; import { queueApi } from 'services/api/endpoints/queue'; import { BatchConfig } from 'services/api/types'; import { startAppListening } from '..'; diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/receivedOpenAPISchema.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/receivedOpenAPISchema.ts index f5b630a39d..ff44317fcf 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/receivedOpenAPISchema.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/receivedOpenAPISchema.ts @@ -1,7 +1,7 @@ import { logger } from 'app/logging/logger'; import { parseify } from 'common/util/serialize'; import { nodeTemplatesBuilt } from 'features/nodes/store/nodesSlice'; -import { parseSchema } from 'features/nodes/util/parseSchema'; +import { parseSchema } from 'features/nodes/util/schema/parseSchema'; import { size } from 'lodash-es'; import { receivedOpenAPISchema } from 'services/api/thunks/schema'; import { startAppListening } from '..'; diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationComplete.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationComplete.ts index bc9959b8fc..364a2658bf 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationComplete.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/socketio/socketInvocationComplete.ts @@ -10,7 +10,7 @@ import { IMAGE_CATEGORIES } from 'features/gallery/store/types'; import { LINEAR_UI_OUTPUT, nodeIDDenyList, -} from 'features/nodes/util/graphBuilders/constants'; +} from 'features/nodes/util/graph/constants'; import { boardsApi } from 'services/api/endpoints/boards'; import { imagesApi } from 'services/api/endpoints/images'; import { imagesAdapter } from 'services/api/util'; diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/updateAllNodesRequested.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/updateAllNodesRequested.ts index b2383410bd..1df083c795 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/updateAllNodesRequested.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/updateAllNodesRequested.ts @@ -4,7 +4,7 @@ import { nodeReplaced } from 'features/nodes/store/nodesSlice'; import { getNeedsUpdate, updateNode, -} from 'features/nodes/store/util/nodeUpdate'; +} from 'features/nodes/util/node/nodeUpdate'; import { NodeUpdateError } from 'features/nodes/types/error'; import { isInvocationNode } from 'features/nodes/types/invocation'; import { addToast } from 'features/system/store/systemSlice'; diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/upscaleRequested.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/upscaleRequested.ts index 9ddcdc9701..7dbb7d9fb1 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/upscaleRequested.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/upscaleRequested.ts @@ -1,7 +1,7 @@ import { createAction } from '@reduxjs/toolkit'; import { logger } from 'app/logging/logger'; import { parseify } from 'common/util/serialize'; -import { buildAdHocUpscaleGraph } from 'features/nodes/util/graphBuilders/buildAdHocUpscaleGraph'; +import { buildAdHocUpscaleGraph } from 'features/nodes/util/graph/buildAdHocUpscaleGraph'; import { addToast } from 'features/system/store/systemSlice'; import { t } from 'i18next'; import { queueApi } from 'services/api/endpoints/queue'; diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/workflowLoadRequested.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/workflowLoadRequested.ts index 5336c63942..20d0ac0773 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/workflowLoadRequested.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/workflowLoadRequested.ts @@ -4,7 +4,7 @@ import { workflowLoadRequested } from 'features/nodes/store/actions'; import { workflowLoaded } from 'features/nodes/store/nodesSlice'; import { $flow } from 'features/nodes/store/reactFlowInstance'; import { WorkflowVersionError } from 'features/nodes/types/error'; -import { validateWorkflow } from 'features/nodes/util/validateWorkflow'; +import { validateWorkflow } from 'features/nodes/util/workflow/validateWorkflow'; import { addToast } from 'features/system/store/systemSlice'; import { makeToast } from 'features/system/util/makeToast'; import { setActiveTab } from 'features/ui/store/uiSlice'; diff --git a/invokeai/frontend/web/src/features/nodes/components/flow/AddNodePopover/AddNodePopover.tsx b/invokeai/frontend/web/src/features/nodes/components/flow/AddNodePopover/AddNodePopover.tsx index 419899abdb..7d854484e0 100644 --- a/invokeai/frontend/web/src/features/nodes/components/flow/AddNodePopover/AddNodePopover.tsx +++ b/invokeai/frontend/web/src/features/nodes/components/flow/AddNodePopover/AddNodePopover.tsx @@ -11,7 +11,7 @@ import { stateSelector } from 'app/store/store'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions'; import IAIMantineSearchableSelect from 'common/components/IAIMantineSearchableSelect'; -import { useBuildNodeData } from 'features/nodes/hooks/useBuildNodeData'; +import { useBuildNode } from 'features/nodes/hooks/useBuildNode'; import { addNodePopoverClosed, addNodePopoverOpened, @@ -51,7 +51,7 @@ const selectFilter = (value: string, item: NodeTemplate) => { const AddNodePopover = () => { const dispatch = useAppDispatch(); - const buildInvocation = useBuildNodeData(); + const buildInvocation = useBuildNode(); const toaster = useAppToaster(); const { t } = useTranslation(); diff --git a/invokeai/frontend/web/src/features/nodes/components/sidePanel/inspector/InspectorDetailsTab.tsx b/invokeai/frontend/web/src/features/nodes/components/sidePanel/inspector/InspectorDetailsTab.tsx index ecbe538fcc..fad2443c4f 100644 --- a/invokeai/frontend/web/src/features/nodes/components/sidePanel/inspector/InspectorDetailsTab.tsx +++ b/invokeai/frontend/web/src/features/nodes/components/sidePanel/inspector/InspectorDetailsTab.tsx @@ -11,7 +11,7 @@ import { stateSelector } from 'app/store/store'; import { useAppSelector } from 'app/store/storeHooks'; import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions'; import { IAINoContentFallback } from 'common/components/IAIImageFallback'; -import { getNeedsUpdate } from 'features/nodes/store/util/nodeUpdate'; +import { getNeedsUpdate } from 'features/nodes/util/node/nodeUpdate'; import { InvocationNodeData, InvocationTemplate, diff --git a/invokeai/frontend/web/src/features/nodes/hooks/useAnyOrDirectInputFieldNames.ts b/invokeai/frontend/web/src/features/nodes/hooks/useAnyOrDirectInputFieldNames.ts index ccfa0f57fd..b934c6b959 100644 --- a/invokeai/frontend/web/src/features/nodes/hooks/useAnyOrDirectInputFieldNames.ts +++ b/invokeai/frontend/web/src/features/nodes/hooks/useAnyOrDirectInputFieldNames.ts @@ -5,8 +5,8 @@ import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions'; import { keys, map } from 'lodash-es'; import { useMemo } from 'react'; import { isInvocationNode } from '../types/invocation'; -import { getSortedFilteredFieldNames } from '../util/getSortedFilteredFieldNames'; -import { TEMPLATE_BUILDER_MAP } from '../util/buildFieldInputTemplate'; +import { getSortedFilteredFieldNames } from '../util/node/getSortedFilteredFieldNames'; +import { TEMPLATE_BUILDER_MAP } from '../util/schema/buildFieldInputTemplate'; export const useAnyOrDirectInputFieldNames = (nodeId: string) => { const selector = useMemo( diff --git a/invokeai/frontend/web/src/features/nodes/hooks/useBuildNodeData.ts b/invokeai/frontend/web/src/features/nodes/hooks/useBuildNode.ts similarity index 87% rename from invokeai/frontend/web/src/features/nodes/hooks/useBuildNodeData.ts rename to invokeai/frontend/web/src/features/nodes/hooks/useBuildNode.ts index 46f11b3823..69c0757689 100644 --- a/invokeai/frontend/web/src/features/nodes/hooks/useBuildNodeData.ts +++ b/invokeai/frontend/web/src/features/nodes/hooks/useBuildNode.ts @@ -3,13 +3,12 @@ import { RootState } from 'app/store/store'; import { useAppSelector } from 'app/store/storeHooks'; import { useCallback } from 'react'; import { Node, useReactFlow } from 'reactflow'; -import { - buildCurrentImageNode, - buildInvocationNode, - buildNotesNode, -} from '../store/util/buildNodeData'; import { DRAG_HANDLE_CLASSNAME, NODE_WIDTH } from '../types/constants'; import { AnyNode, InvocationTemplate } from '../types/invocation'; +import { buildCurrentImageNode } from '../util/node/buildCurrentImageNode'; +import { buildInvocationNode } from '../util/node/buildInvocationNode'; +import { buildNotesNode } from '../util/node/buildNotesNode'; + const templatesSelector = createSelector( [(state: RootState) => state.nodes], (nodes) => nodes.nodeTemplates @@ -19,7 +18,7 @@ export const SHARED_NODE_PROPERTIES: Partial = { dragHandle: `.${DRAG_HANDLE_CLASSNAME}`, }; -export const useBuildNodeData = () => { +export const useBuildNode = () => { const nodeTemplates = useAppSelector(templatesSelector); const flow = useReactFlow(); diff --git a/invokeai/frontend/web/src/features/nodes/hooks/useConnectionInputFieldNames.ts b/invokeai/frontend/web/src/features/nodes/hooks/useConnectionInputFieldNames.ts index 2951167944..a2694bd1ba 100644 --- a/invokeai/frontend/web/src/features/nodes/hooks/useConnectionInputFieldNames.ts +++ b/invokeai/frontend/web/src/features/nodes/hooks/useConnectionInputFieldNames.ts @@ -5,8 +5,8 @@ import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions'; import { keys, map } from 'lodash-es'; import { useMemo } from 'react'; import { isInvocationNode } from '../types/invocation'; -import { getSortedFilteredFieldNames } from '../util/getSortedFilteredFieldNames'; -import { TEMPLATE_BUILDER_MAP } from '../util/buildFieldInputTemplate'; +import { getSortedFilteredFieldNames } from '../util/node/getSortedFilteredFieldNames'; +import { TEMPLATE_BUILDER_MAP } from '../util/schema/buildFieldInputTemplate'; export const useConnectionInputFieldNames = (nodeId: string) => { const selector = useMemo( diff --git a/invokeai/frontend/web/src/features/nodes/hooks/useGetNodesNeedUpdate.ts b/invokeai/frontend/web/src/features/nodes/hooks/useGetNodesNeedUpdate.ts index c22c0d9505..9673c6417f 100644 --- a/invokeai/frontend/web/src/features/nodes/hooks/useGetNodesNeedUpdate.ts +++ b/invokeai/frontend/web/src/features/nodes/hooks/useGetNodesNeedUpdate.ts @@ -2,7 +2,7 @@ import { createSelector } from '@reduxjs/toolkit'; import { stateSelector } from 'app/store/store'; import { useAppSelector } from 'app/store/storeHooks'; import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions'; -import { getNeedsUpdate } from '../store/util/nodeUpdate'; +import { getNeedsUpdate } from '../util/node/nodeUpdate'; import { isInvocationNode } from '../types/invocation'; const selector = createSelector( diff --git a/invokeai/frontend/web/src/features/nodes/hooks/useNodeNeedsUpdate.ts b/invokeai/frontend/web/src/features/nodes/hooks/useNodeNeedsUpdate.ts index 99a7c47170..cf3ecfbc12 100644 --- a/invokeai/frontend/web/src/features/nodes/hooks/useNodeNeedsUpdate.ts +++ b/invokeai/frontend/web/src/features/nodes/hooks/useNodeNeedsUpdate.ts @@ -4,7 +4,7 @@ import { useAppSelector } from 'app/store/storeHooks'; import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions'; import { useMemo } from 'react'; import { isInvocationNode } from '../types/invocation'; -import { getNeedsUpdate } from '../store/util/nodeUpdate'; +import { getNeedsUpdate } from '../util/node/nodeUpdate'; export const useNodeNeedsUpdate = (nodeId: string) => { const selector = useMemo( diff --git a/invokeai/frontend/web/src/features/nodes/hooks/useOutputFieldNames.ts b/invokeai/frontend/web/src/features/nodes/hooks/useOutputFieldNames.ts index 93e4ccb833..ec0315b227 100644 --- a/invokeai/frontend/web/src/features/nodes/hooks/useOutputFieldNames.ts +++ b/invokeai/frontend/web/src/features/nodes/hooks/useOutputFieldNames.ts @@ -5,7 +5,7 @@ import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions'; import { map } from 'lodash-es'; import { useMemo } from 'react'; import { isInvocationNode } from '../types/invocation'; -import { getSortedFilteredFieldNames } from '../util/getSortedFilteredFieldNames'; +import { getSortedFilteredFieldNames } from '../util/node/getSortedFilteredFieldNames'; export const useOutputFieldNames = (nodeId: string) => { const selector = useMemo( diff --git a/invokeai/frontend/web/src/features/nodes/hooks/useWorkflow.ts b/invokeai/frontend/web/src/features/nodes/hooks/useWorkflow.ts index f729aa1004..b0799630c9 100644 --- a/invokeai/frontend/web/src/features/nodes/hooks/useWorkflow.ts +++ b/invokeai/frontend/web/src/features/nodes/hooks/useWorkflow.ts @@ -1,6 +1,6 @@ import { RootState } from 'app/store/store'; import { useAppSelector } from 'app/store/storeHooks'; -import { buildWorkflow } from 'features/nodes/util/buildWorkflow'; +import { buildWorkflow } from 'features/nodes/util/workflow/buildWorkflow'; import { useMemo } from 'react'; import { useDebounce } from 'use-debounce'; diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/addControlNetToLinearGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/addControlNetToLinearGraph.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/addControlNetToLinearGraph.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/addControlNetToLinearGraph.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/addHrfToGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/addHrfToGraph.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/addHrfToGraph.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/addHrfToGraph.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/addIPAdapterToLinearGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/addIPAdapterToLinearGraph.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/addIPAdapterToLinearGraph.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/addIPAdapterToLinearGraph.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/addLinearUIOutputNode.ts b/invokeai/frontend/web/src/features/nodes/util/graph/addLinearUIOutputNode.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/addLinearUIOutputNode.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/addLinearUIOutputNode.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/addLoRAsToGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/addLoRAsToGraph.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/addLoRAsToGraph.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/addLoRAsToGraph.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/addNSFWCheckerToGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/addNSFWCheckerToGraph.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/addNSFWCheckerToGraph.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/addNSFWCheckerToGraph.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/addSDXLLoRAstoGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/addSDXLLoRAstoGraph.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/addSDXLLoRAstoGraph.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/addSDXLLoRAstoGraph.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/addSDXLRefinerToGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/addSDXLRefinerToGraph.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/addSDXLRefinerToGraph.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/addSDXLRefinerToGraph.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/addSeamlessToLinearGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/addSeamlessToLinearGraph.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/addSeamlessToLinearGraph.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/addSeamlessToLinearGraph.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/addT2IAdapterToLinearGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/addT2IAdapterToLinearGraph.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/addT2IAdapterToLinearGraph.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/addT2IAdapterToLinearGraph.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/addVAEToGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/addVAEToGraph.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/addVAEToGraph.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/addVAEToGraph.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/addWatermarkerToGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/addWatermarkerToGraph.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/addWatermarkerToGraph.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/addWatermarkerToGraph.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildAdHocUpscaleGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/buildAdHocUpscaleGraph.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildAdHocUpscaleGraph.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/buildAdHocUpscaleGraph.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/buildCanvasGraph.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasGraph.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/buildCanvasGraph.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasImageToImageGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/buildCanvasImageToImageGraph.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasImageToImageGraph.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/buildCanvasImageToImageGraph.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasInpaintGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/buildCanvasInpaintGraph.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasInpaintGraph.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/buildCanvasInpaintGraph.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasOutpaintGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/buildCanvasOutpaintGraph.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasOutpaintGraph.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/buildCanvasOutpaintGraph.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLImageToImageGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/buildCanvasSDXLImageToImageGraph.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLImageToImageGraph.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/buildCanvasSDXLImageToImageGraph.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLInpaintGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/buildCanvasSDXLInpaintGraph.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLInpaintGraph.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/buildCanvasSDXLInpaintGraph.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLOutpaintGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/buildCanvasSDXLOutpaintGraph.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLOutpaintGraph.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/buildCanvasSDXLOutpaintGraph.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLTextToImageGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/buildCanvasSDXLTextToImageGraph.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasSDXLTextToImageGraph.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/buildCanvasSDXLTextToImageGraph.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasTextToImageGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/buildCanvasTextToImageGraph.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildCanvasTextToImageGraph.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/buildCanvasTextToImageGraph.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildLinearBatchConfig.ts b/invokeai/frontend/web/src/features/nodes/util/graph/buildLinearBatchConfig.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildLinearBatchConfig.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/buildLinearBatchConfig.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildLinearImageToImageGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/buildLinearImageToImageGraph.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildLinearImageToImageGraph.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/buildLinearImageToImageGraph.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildLinearSDXLImageToImageGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/buildLinearSDXLImageToImageGraph.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildLinearSDXLImageToImageGraph.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/buildLinearSDXLImageToImageGraph.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildLinearSDXLTextToImageGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/buildLinearSDXLTextToImageGraph.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildLinearSDXLTextToImageGraph.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/buildLinearSDXLTextToImageGraph.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildLinearTextToImageGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/buildLinearTextToImageGraph.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildLinearTextToImageGraph.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/buildLinearTextToImageGraph.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildNodesGraph.ts b/invokeai/frontend/web/src/features/nodes/util/graph/buildNodesGraph.ts similarity index 98% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildNodesGraph.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/buildNodesGraph.ts index 9ed0eb1d32..cfa306b2c6 100644 --- a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/buildNodesGraph.ts +++ b/invokeai/frontend/web/src/features/nodes/util/graph/buildNodesGraph.ts @@ -4,7 +4,7 @@ import { cloneDeep, omit, reduce } from 'lodash-es'; import { Graph } from 'services/api/types'; import { AnyInvocation } from 'services/events/types'; import { v4 as uuidv4 } from 'uuid'; -import { buildWorkflow } from '../buildWorkflow'; +import { buildWorkflow } from '../workflow/buildWorkflow'; import { FieldInputInstance, isColorFieldInputInstance, diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/constants.ts b/invokeai/frontend/web/src/features/nodes/util/graph/constants.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/constants.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/constants.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/helpers/craftSDXLStylePrompt.ts b/invokeai/frontend/web/src/features/nodes/util/graph/helpers/craftSDXLStylePrompt.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/helpers/craftSDXLStylePrompt.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/helpers/craftSDXLStylePrompt.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/graphBuilders/metadata.ts b/invokeai/frontend/web/src/features/nodes/util/graph/metadata.ts similarity index 100% rename from invokeai/frontend/web/src/features/nodes/util/graphBuilders/metadata.ts rename to invokeai/frontend/web/src/features/nodes/util/graph/metadata.ts diff --git a/invokeai/frontend/web/src/features/nodes/util/node/buildCurrentImageNode.ts b/invokeai/frontend/web/src/features/nodes/util/node/buildCurrentImageNode.ts new file mode 100644 index 0000000000..8440cbb3d1 --- /dev/null +++ b/invokeai/frontend/web/src/features/nodes/util/node/buildCurrentImageNode.ts @@ -0,0 +1,23 @@ +import { SHARED_NODE_PROPERTIES } from 'features/nodes/types/constants'; +import { CurrentImageNode } from 'features/nodes/types/invocation'; +import { XYPosition } from 'reactflow'; +import { v4 as uuidv4 } from 'uuid'; + +export const buildCurrentImageNode = ( + position: XYPosition +): CurrentImageNode => { + const nodeId = uuidv4(); + const node: CurrentImageNode = { + ...SHARED_NODE_PROPERTIES, + id: nodeId, + type: 'current_image', + position, + data: { + id: nodeId, + type: 'current_image', + isOpen: true, + label: 'Current Image', + }, + }; + return node; +}; diff --git a/invokeai/frontend/web/src/features/nodes/store/util/buildNodeData.ts b/invokeai/frontend/web/src/features/nodes/util/node/buildInvocationNode.ts similarity index 62% rename from invokeai/frontend/web/src/features/nodes/store/util/buildNodeData.ts rename to invokeai/frontend/web/src/features/nodes/util/node/buildInvocationNode.ts index c2582600c3..1da3b23a9a 100644 --- a/invokeai/frontend/web/src/features/nodes/store/util/buildNodeData.ts +++ b/invokeai/frontend/web/src/features/nodes/util/node/buildInvocationNode.ts @@ -4,57 +4,18 @@ import { FieldOutputInstance, } from 'features/nodes/types/field'; import { - CurrentImageNodeData, - InvocationNodeData, + InvocationNode, InvocationTemplate, - NotesNodeData, } from 'features/nodes/types/invocation'; -import { buildFieldInputInstance } from 'features/nodes/util/buildFieldInputInstance'; +import { buildFieldInputInstance } from 'features/nodes/util/schema/buildFieldInputInstance'; import { reduce } from 'lodash-es'; -import { Node, XYPosition } from 'reactflow'; +import { XYPosition } from 'reactflow'; import { v4 as uuidv4 } from 'uuid'; -export const buildNotesNode = (position: XYPosition): Node => { - const nodeId = uuidv4(); - const node: Node = { - ...SHARED_NODE_PROPERTIES, - id: nodeId, - type: 'notes', - position, - data: { - id: nodeId, - isOpen: true, - label: 'Notes', - notes: '', - type: 'notes', - }, - }; - return node; -}; - -export const buildCurrentImageNode = ( - position: XYPosition -): Node => { - const nodeId = uuidv4(); - const node: Node = { - ...SHARED_NODE_PROPERTIES, - id: nodeId, - type: 'current_image', - position, - data: { - id: nodeId, - type: 'current_image', - isOpen: true, - label: 'Current Image', - }, - }; - return node; -}; - export const buildInvocationNode = ( position: XYPosition, template: InvocationTemplate -): Node => { +): InvocationNode => { const nodeId = uuidv4(); const { type } = template; @@ -94,7 +55,7 @@ export const buildInvocationNode = ( {} as Record ); - const node: Node = { + const node: InvocationNode = { ...SHARED_NODE_PROPERTIES, id: nodeId, type: 'invocation', diff --git a/invokeai/frontend/web/src/features/nodes/util/node/buildNotesNode.ts b/invokeai/frontend/web/src/features/nodes/util/node/buildNotesNode.ts new file mode 100644 index 0000000000..268d23d2db --- /dev/null +++ b/invokeai/frontend/web/src/features/nodes/util/node/buildNotesNode.ts @@ -0,0 +1,22 @@ +import { SHARED_NODE_PROPERTIES } from 'features/nodes/types/constants'; +import { NotesNode } from 'features/nodes/types/invocation'; +import { XYPosition } from 'reactflow'; +import { v4 as uuidv4 } from 'uuid'; + +export const buildNotesNode = (position: XYPosition): NotesNode => { + const nodeId = uuidv4(); + const node: NotesNode = { + ...SHARED_NODE_PROPERTIES, + id: nodeId, + type: 'notes', + position, + data: { + id: nodeId, + isOpen: true, + label: 'Notes', + notes: '', + type: 'notes', + }, + }; + return node; +}; diff --git a/invokeai/frontend/web/src/features/nodes/util/getSortedFilteredFieldNames.ts b/invokeai/frontend/web/src/features/nodes/util/node/getSortedFilteredFieldNames.ts similarity index 90% rename from invokeai/frontend/web/src/features/nodes/util/getSortedFilteredFieldNames.ts rename to invokeai/frontend/web/src/features/nodes/util/node/getSortedFilteredFieldNames.ts index 2ed5faca29..2aa1ccc172 100644 --- a/invokeai/frontend/web/src/features/nodes/util/getSortedFilteredFieldNames.ts +++ b/invokeai/frontend/web/src/features/nodes/util/node/getSortedFilteredFieldNames.ts @@ -1,5 +1,5 @@ import { isNil } from 'lodash-es'; -import { FieldInputTemplate, FieldOutputTemplate } from '../types/field'; +import { FieldInputTemplate, FieldOutputTemplate } from '../../types/field'; export const getSortedFilteredFieldNames = ( fields: FieldInputTemplate[] | FieldOutputTemplate[] diff --git a/invokeai/frontend/web/src/features/nodes/store/util/nodeUpdate.ts b/invokeai/frontend/web/src/features/nodes/util/node/nodeUpdate.ts similarity index 97% rename from invokeai/frontend/web/src/features/nodes/store/util/nodeUpdate.ts rename to invokeai/frontend/web/src/features/nodes/util/node/nodeUpdate.ts index e9e24823f9..d1913f6e05 100644 --- a/invokeai/frontend/web/src/features/nodes/store/util/nodeUpdate.ts +++ b/invokeai/frontend/web/src/features/nodes/util/node/nodeUpdate.ts @@ -7,7 +7,7 @@ import { import { zParsedSemver } from 'features/nodes/types/semver'; import { cloneDeep, defaultsDeep } from 'lodash-es'; import { Node } from 'reactflow'; -import { buildInvocationNode } from './buildNodeData'; +import { buildInvocationNode } from './buildInvocationNode'; export const getNeedsUpdate = ( node: Node, diff --git a/invokeai/frontend/web/src/features/nodes/util/buildFieldInputInstance.ts b/invokeai/frontend/web/src/features/nodes/util/schema/buildFieldInputInstance.ts similarity index 93% rename from invokeai/frontend/web/src/features/nodes/util/buildFieldInputInstance.ts rename to invokeai/frontend/web/src/features/nodes/util/schema/buildFieldInputInstance.ts index 200bd98e86..2e06652d4b 100644 --- a/invokeai/frontend/web/src/features/nodes/util/buildFieldInputInstance.ts +++ b/invokeai/frontend/web/src/features/nodes/util/schema/buildFieldInputInstance.ts @@ -1,5 +1,5 @@ import { get } from 'lodash-es'; -import { FieldInputInstance, FieldInputTemplate } from '../types/field'; +import { FieldInputInstance, FieldInputTemplate } from '../../types/field'; const FIELD_VALUE_FALLBACK_MAP = { EnumField: '', diff --git a/invokeai/frontend/web/src/features/nodes/util/buildFieldInputTemplate.ts b/invokeai/frontend/web/src/features/nodes/util/schema/buildFieldInputTemplate.ts similarity index 99% rename from invokeai/frontend/web/src/features/nodes/util/buildFieldInputTemplate.ts rename to invokeai/frontend/web/src/features/nodes/util/schema/buildFieldInputTemplate.ts index 0deddf0dea..9f33c1328f 100644 --- a/invokeai/frontend/web/src/features/nodes/util/buildFieldInputTemplate.ts +++ b/invokeai/frontend/web/src/features/nodes/util/schema/buildFieldInputTemplate.ts @@ -22,8 +22,8 @@ import { T2IAdapterModelFieldInputTemplate, VAEModelFieldInputTemplate, isStatefulFieldType, -} from '../types/field'; -import { InvocationFieldSchema } from '../types/openapi'; +} from '../../types/field'; +import { InvocationFieldSchema } from '../../types/openapi'; // eslint-disable-next-line @typescript-eslint/no-explicit-any type FieldInputTemplateBuilder = // valid `any`! diff --git a/invokeai/frontend/web/src/features/nodes/util/buildFieldOutputTemplate.ts b/invokeai/frontend/web/src/features/nodes/util/schema/buildFieldOutputTemplate.ts similarity index 81% rename from invokeai/frontend/web/src/features/nodes/util/buildFieldOutputTemplate.ts rename to invokeai/frontend/web/src/features/nodes/util/schema/buildFieldOutputTemplate.ts index 05e3c66386..0d363da429 100644 --- a/invokeai/frontend/web/src/features/nodes/util/buildFieldOutputTemplate.ts +++ b/invokeai/frontend/web/src/features/nodes/util/schema/buildFieldOutputTemplate.ts @@ -1,6 +1,6 @@ import { startCase } from 'lodash-es'; -import { FieldOutputTemplate, FieldType } from '../types/field'; -import { InvocationFieldSchema } from '../types/openapi'; +import { FieldOutputTemplate, FieldType } from '../../types/field'; +import { InvocationFieldSchema } from '../../types/openapi'; export const buildFieldOutputTemplate = ( fieldSchema: InvocationFieldSchema, diff --git a/invokeai/frontend/web/src/features/nodes/util/parseFieldType.ts b/invokeai/frontend/web/src/features/nodes/util/schema/parseFieldType.ts similarity index 97% rename from invokeai/frontend/web/src/features/nodes/util/parseFieldType.ts rename to invokeai/frontend/web/src/features/nodes/util/schema/parseFieldType.ts index 2d25ab9faa..2314faaa39 100644 --- a/invokeai/frontend/web/src/features/nodes/util/parseFieldType.ts +++ b/invokeai/frontend/web/src/features/nodes/util/schema/parseFieldType.ts @@ -1,8 +1,11 @@ import { t } from 'i18next'; import { isArray } from 'lodash-es'; import { OpenAPIV3_1 } from 'openapi-types'; -import { FieldTypeParseError, UnsupportedFieldTypeError } from '../types/error'; -import { FieldType } from '../types/field'; +import { + FieldTypeParseError, + UnsupportedFieldTypeError, +} from '../../types/error'; +import { FieldType } from '../../types/field'; import { OpenAPIV3_1SchemaOrRef, isArraySchemaObject, @@ -10,7 +13,7 @@ import { isNonArraySchemaObject, isRefObject, isSchemaObject, -} from '../types/openapi'; +} from '../../types/openapi'; /** * Transforms an invocation output ref object to field type. diff --git a/invokeai/frontend/web/src/features/nodes/util/parseSchema.ts b/invokeai/frontend/web/src/features/nodes/util/schema/parseSchema.ts similarity index 96% rename from invokeai/frontend/web/src/features/nodes/util/parseSchema.ts rename to invokeai/frontend/web/src/features/nodes/util/schema/parseSchema.ts index 81d79d2976..04b3f66e7d 100644 --- a/invokeai/frontend/web/src/features/nodes/util/parseSchema.ts +++ b/invokeai/frontend/web/src/features/nodes/util/schema/parseSchema.ts @@ -3,15 +3,18 @@ import { parseify } from 'common/util/serialize'; import { t } from 'i18next'; import { reduce } from 'lodash-es'; import { OpenAPIV3_1 } from 'openapi-types'; -import { FieldTypeParseError, UnsupportedFieldTypeError } from '../types/error'; -import { FieldInputTemplate, FieldOutputTemplate } from '../types/field'; -import { InvocationTemplate } from '../types/invocation'; +import { + FieldTypeParseError, + UnsupportedFieldTypeError, +} from '../../types/error'; +import { FieldInputTemplate, FieldOutputTemplate } from '../../types/field'; +import { InvocationTemplate } from '../../types/invocation'; import { InvocationSchemaObject, isInvocationFieldSchema, isInvocationOutputSchemaObject, isInvocationSchemaObject, -} from '../types/openapi'; +} from '../../types/openapi'; import { buildFieldInputTemplate } from './buildFieldInputTemplate'; import { buildFieldOutputTemplate } from './buildFieldOutputTemplate'; import { parseFieldType } from './parseFieldType'; diff --git a/invokeai/frontend/web/src/features/nodes/util/buildWorkflow.ts b/invokeai/frontend/web/src/features/nodes/util/workflow/buildWorkflow.ts similarity index 90% rename from invokeai/frontend/web/src/features/nodes/util/buildWorkflow.ts rename to invokeai/frontend/web/src/features/nodes/util/workflow/buildWorkflow.ts index 7e49be4068..ee28376347 100644 --- a/invokeai/frontend/web/src/features/nodes/util/buildWorkflow.ts +++ b/invokeai/frontend/web/src/features/nodes/util/workflow/buildWorkflow.ts @@ -1,6 +1,6 @@ import { logger } from 'app/logging/logger'; -import { NodesState } from '../store/types'; -import { WorkflowV2, zWorkflowEdge, zWorkflowNode } from '../types/workflow'; +import { NodesState } from '../../store/types'; +import { WorkflowV2, zWorkflowEdge, zWorkflowNode } from '../../types/workflow'; import { fromZodError } from 'zod-validation-error'; import { parseify } from 'common/util/serialize'; import i18n from 'i18next'; diff --git a/invokeai/frontend/web/src/features/nodes/util/validateWorkflow.ts b/invokeai/frontend/web/src/features/nodes/util/workflow/validateWorkflow.ts similarity index 94% rename from invokeai/frontend/web/src/features/nodes/util/validateWorkflow.ts rename to invokeai/frontend/web/src/features/nodes/util/workflow/validateWorkflow.ts index 6d2ee13cf2..08ff0c4daf 100644 --- a/invokeai/frontend/web/src/features/nodes/util/validateWorkflow.ts +++ b/invokeai/frontend/web/src/features/nodes/util/workflow/validateWorkflow.ts @@ -2,10 +2,10 @@ import { parseify } from 'common/util/serialize'; import { t } from 'i18next'; import { keyBy } from 'lodash-es'; import { JsonObject } from 'type-fest'; -import { getNeedsUpdate } from '../store/util/nodeUpdate'; -import { InvocationTemplate } from '../types/invocation'; -import { parseAndMigrateWorkflow } from '../types/migration/migrations'; -import { WorkflowV2, isWorkflowInvocationNode } from '../types/workflow'; +import { getNeedsUpdate } from '../node/nodeUpdate'; +import { InvocationTemplate } from '../../types/invocation'; +import { parseAndMigrateWorkflow } from '../../types/migration/migrations'; +import { WorkflowV2, isWorkflowInvocationNode } from '../../types/workflow'; type WorkflowWarning = { message: string;