diff --git a/invokeai/frontend/web/knip.ts b/invokeai/frontend/web/knip.ts index a47edbf6b4..479dd27a96 100644 --- a/invokeai/frontend/web/knip.ts +++ b/invokeai/frontend/web/knip.ts @@ -5,7 +5,6 @@ const config: KnipConfig = { // This file is only used during debugging 'src/app/store/middleware/debugLoggerMiddleware.ts', ], - ignoreDependencies: ['@storybook/addon-docs', '@storybook/blocks', '@storybook/test', 'public/.*'], ignoreBinaries: ['only-allow'], }; diff --git a/invokeai/frontend/web/package.json b/invokeai/frontend/web/package.json index 39c9722441..8e8faa5c84 100644 --- a/invokeai/frontend/web/package.json +++ b/invokeai/frontend/web/package.json @@ -112,16 +112,13 @@ "devDependencies": { "@invoke-ai/eslint-config-react": "^0.0.14", "@invoke-ai/prettier-config-react": "^0.0.7", - "@storybook/addon-docs": "^7.6.17", "@storybook/addon-essentials": "^7.6.17", "@storybook/addon-interactions": "^7.6.17", "@storybook/addon-links": "^7.6.17", "@storybook/addon-storysource": "^7.6.17", - "@storybook/blocks": "^7.6.17", "@storybook/manager-api": "^7.6.17", "@storybook/react": "^7.6.17", "@storybook/react-vite": "^7.6.17", - "@storybook/test": "^7.6.17", "@storybook/theming": "^7.6.17", "@types/dateformat": "^5.0.2", "@types/lodash-es": "^4.17.12", diff --git a/invokeai/frontend/web/src/app/hooks/useSocketIO.ts b/invokeai/frontend/web/src/app/hooks/useSocketIO.ts index 058a607261..e1c4cebdb9 100644 --- a/invokeai/frontend/web/src/app/hooks/useSocketIO.ts +++ b/invokeai/frontend/web/src/app/hooks/useSocketIO.ts @@ -19,7 +19,7 @@ declare global { } export const $socketOptions = map>({}); -export const $isSocketInitialized = atom(false); +const $isSocketInitialized = atom(false); /** * Initializes the socket.io connection and sets up event listeners. diff --git a/invokeai/frontend/web/src/app/store/enhancers/reduxRemember/driver.ts b/invokeai/frontend/web/src/app/store/enhancers/reduxRemember/driver.ts index c8237664c2..7196e1fcea 100644 --- a/invokeai/frontend/web/src/app/store/enhancers/reduxRemember/driver.ts +++ b/invokeai/frontend/web/src/app/store/enhancers/reduxRemember/driver.ts @@ -6,7 +6,7 @@ import { atom } from 'nanostores'; import type { Driver } from 'redux-remember'; // Create a custom idb-keyval store (just needed to customize the name) -export const $idbKeyValStore = atom(createIDBKeyValStore('invoke', 'invoke-store')); +const $idbKeyValStore = atom(createIDBKeyValStore('invoke', 'invoke-store')); export const clearIdbKeyValStore = () => { clear($idbKeyValStore.get()); diff --git a/invokeai/frontend/web/src/app/store/nanostores/store.ts b/invokeai/frontend/web/src/app/store/nanostores/store.ts index f4cd001c96..65c59dad5d 100644 --- a/invokeai/frontend/web/src/app/store/nanostores/store.ts +++ b/invokeai/frontend/web/src/app/store/nanostores/store.ts @@ -11,7 +11,7 @@ declare global { /** * Raised when the redux store is unable to be retrieved. */ -export class ReduxStoreNotInitialized extends Error { +class ReduxStoreNotInitialized extends Error { /** * Create ReduxStoreNotInitialized * @param {String} message diff --git a/invokeai/frontend/web/src/features/canvas/store/canvasNanostore.ts b/invokeai/frontend/web/src/features/canvas/store/canvasNanostore.ts index f971886d5e..b225f66677 100644 --- a/invokeai/frontend/web/src/features/canvas/store/canvasNanostore.ts +++ b/invokeai/frontend/web/src/features/canvas/store/canvasNanostore.ts @@ -8,7 +8,7 @@ export const $tool = atom('move'); export const $toolStash = atom(null); export const $isDrawing = atom(false); export const $isMouseOverBoundingBox = atom(false); -export const $isMoveBoundingBoxKeyHeld = atom(false); +const $isMoveBoundingBoxKeyHeld = atom(false); export const $isMoveStageKeyHeld = atom(false); export const $isMovingBoundingBox = atom(false); export const $isMovingStage = atom(false); diff --git a/invokeai/frontend/web/src/features/canvas/store/canvasSlice.ts b/invokeai/frontend/web/src/features/canvas/store/canvasSlice.ts index 8ae6a2176d..465bc11409 100644 --- a/invokeai/frontend/web/src/features/canvas/store/canvasSlice.ts +++ b/invokeai/frontend/web/src/features/canvas/store/canvasSlice.ts @@ -674,7 +674,6 @@ export const { setShouldAutoSave, setShouldCropToBoundingBoxOnSave, setShouldDarkenOutsideBoundingBox, - setShouldLockBoundingBox, setShouldPreserveMaskedArea, setShouldShowBoundingBox, setShouldShowCanvasDebugInfo, diff --git a/invokeai/frontend/web/src/features/controlAdapters/store/controlAdaptersSlice.ts b/invokeai/frontend/web/src/features/controlAdapters/store/controlAdaptersSlice.ts index d90ccd0f2a..a20e287011 100644 --- a/invokeai/frontend/web/src/features/controlAdapters/store/controlAdaptersSlice.ts +++ b/invokeai/frontend/web/src/features/controlAdapters/store/controlAdaptersSlice.ts @@ -38,9 +38,7 @@ const caAdapterSelectors = caAdapter.getSelectors(undefined, getSelectorsOptions export const { selectById: selectControlAdapterById, selectAll: selectControlAdapterAll, - selectEntities: selectControlAdapterEntities, selectIds: selectControlAdapterIds, - selectTotal: selectControlAdapterTotal, } = caAdapterSelectors; const initialControlAdaptersState: ControlAdaptersState = caAdapter.getInitialState<{ diff --git a/invokeai/frontend/web/src/features/dnd/types/index.ts b/invokeai/frontend/web/src/features/dnd/types/index.ts index 6e680b4ba9..b2b7820762 100644 --- a/invokeai/frontend/web/src/features/dnd/types/index.ts +++ b/invokeai/frontend/web/src/features/dnd/types/index.ts @@ -18,30 +18,26 @@ type BaseDropData = { id: string; }; -export type CurrentImageDropData = BaseDropData & { +type CurrentImageDropData = BaseDropData & { actionType: 'SET_CURRENT_IMAGE'; }; -export type InitialImageDropData = BaseDropData & { +type InitialImageDropData = BaseDropData & { actionType: 'SET_INITIAL_IMAGE'; }; -export type ControlAdapterDropData = BaseDropData & { +type ControlAdapterDropData = BaseDropData & { actionType: 'SET_CONTROL_ADAPTER_IMAGE'; context: { id: string; }; }; -export type IPAdapterImageDropData = BaseDropData & { - actionType: 'SET_IP_ADAPTER_IMAGE'; -}; - export type CanvasInitialImageDropData = BaseDropData & { actionType: 'SET_CANVAS_INITIAL_IMAGE'; }; -export type NodesImageDropData = BaseDropData & { +type NodesImageDropData = BaseDropData & { actionType: 'SET_NODES_IMAGE'; context: { nodeId: string; @@ -71,7 +67,7 @@ type BaseDragData = { id: string; }; -export type NodeFieldDraggableData = BaseDragData & { +type NodeFieldDraggableData = BaseDragData & { payloadType: 'NODE_FIELD'; payload: { nodeId: string; @@ -114,7 +110,7 @@ export interface TypesafeActive extends Omit { data: React.MutableRefObject; } -export interface TypesafeOver extends Omit { +interface TypesafeOver extends Omit { data: React.MutableRefObject; } @@ -127,10 +123,10 @@ interface DragEvent { } export interface DragStartEvent extends Pick {} -export interface DragMoveEvent extends DragEvent {} -export interface DragOverEvent extends DragMoveEvent {} +interface DragMoveEvent extends DragEvent {} +interface DragOverEvent extends DragMoveEvent {} export interface DragEndEvent extends DragEvent {} -export interface DragCancelEvent extends DragEndEvent {} +interface DragCancelEvent extends DragEndEvent {} export interface DndContextTypesafeProps extends Omit { diff --git a/invokeai/frontend/web/src/features/dynamicPrompts/store/dynamicPromptsSlice.ts b/invokeai/frontend/web/src/features/dynamicPrompts/store/dynamicPromptsSlice.ts index 27925c833f..d73db3e810 100644 --- a/invokeai/frontend/web/src/features/dynamicPrompts/store/dynamicPromptsSlice.ts +++ b/invokeai/frontend/web/src/features/dynamicPrompts/store/dynamicPromptsSlice.ts @@ -4,7 +4,7 @@ import type { PersistConfig, RootState } from 'app/store/store'; import { z } from 'zod'; const zSeedBehaviour = z.enum(['PER_ITERATION', 'PER_PROMPT']); -export type SeedBehaviour = z.infer; +type SeedBehaviour = z.infer; export const isSeedBehaviour = (v: unknown): v is SeedBehaviour => zSeedBehaviour.safeParse(v).success; interface DynamicPromptsState { diff --git a/invokeai/frontend/web/src/features/embedding/usePrompt.ts b/invokeai/frontend/web/src/features/embedding/usePrompt.ts index c3a708e6ce..b5f245d7f2 100644 --- a/invokeai/frontend/web/src/features/embedding/usePrompt.ts +++ b/invokeai/frontend/web/src/features/embedding/usePrompt.ts @@ -4,7 +4,7 @@ import type { ChangeEventHandler, KeyboardEventHandler, RefObject } from 'react' import { useCallback } from 'react'; import { flushSync } from 'react-dom'; -export type UseInsertEmbeddingArg = { +type UseInsertEmbeddingArg = { prompt: string; textareaRef: RefObject; onChange: (v: string) => void; diff --git a/invokeai/frontend/web/src/features/gallery/components/ImageGrid/types.ts b/invokeai/frontend/web/src/features/gallery/components/ImageGrid/types.ts index e43a55270e..1b7286d6a0 100644 --- a/invokeai/frontend/web/src/features/gallery/components/ImageGrid/types.ts +++ b/invokeai/frontend/web/src/features/gallery/components/ImageGrid/types.ts @@ -2,7 +2,7 @@ import { atom } from 'nanostores'; import type { RefObject } from 'react'; import type { ListRange, VirtuosoGridHandle } from 'react-virtuoso'; -export type VirtuosoGridRefs = { +type VirtuosoGridRefs = { virtuosoRef?: RefObject; rootRef?: RefObject; virtuosoRangeRef?: RefObject; diff --git a/invokeai/frontend/web/src/features/gallery/hooks/useGalleryNavigation.ts b/invokeai/frontend/web/src/features/gallery/hooks/useGalleryNavigation.ts index b6fdb183e6..1464c23285 100644 --- a/invokeai/frontend/web/src/features/gallery/hooks/useGalleryNavigation.ts +++ b/invokeai/frontend/web/src/features/gallery/hooks/useGalleryNavigation.ts @@ -105,7 +105,7 @@ const getImageFuncs = { down: getDownImage, }; -export type UseGalleryNavigationReturn = { +type UseGalleryNavigationReturn = { handleLeftImage: () => void; handleRightImage: () => void; handleUpImage: () => void; diff --git a/invokeai/frontend/web/src/features/hrf/store/hrfSlice.ts b/invokeai/frontend/web/src/features/hrf/store/hrfSlice.ts index 9b6e1f944e..46a562d34f 100644 --- a/invokeai/frontend/web/src/features/hrf/store/hrfSlice.ts +++ b/invokeai/frontend/web/src/features/hrf/store/hrfSlice.ts @@ -3,7 +3,7 @@ import { createSlice } from '@reduxjs/toolkit'; import type { PersistConfig, RootState } from 'app/store/store'; import type { ParameterHRFMethod, ParameterStrength } from 'features/parameters/types/parameterSchemas'; -export interface HRFState { +interface HRFState { _version: 1; hrfEnabled: boolean; hrfStrength: ParameterStrength; diff --git a/invokeai/frontend/web/src/features/lora/store/loraSlice.ts b/invokeai/frontend/web/src/features/lora/store/loraSlice.ts index c6518c214e..7d6a2fccaf 100644 --- a/invokeai/frontend/web/src/features/lora/store/loraSlice.ts +++ b/invokeai/frontend/web/src/features/lora/store/loraSlice.ts @@ -16,7 +16,7 @@ export const defaultLoRAConfig: Pick = { isEnabled: true, }; -export type LoraState = { +type LoraState = { _version: 1; loras: Record; }; diff --git a/invokeai/frontend/web/src/features/metadata/types.ts b/invokeai/frontend/web/src/features/metadata/types.ts index aa8d334521..7b102fa160 100644 --- a/invokeai/frontend/web/src/features/metadata/types.ts +++ b/invokeai/frontend/web/src/features/metadata/types.ts @@ -11,13 +11,6 @@ export type MetadataRenderValueFunc = (value: T) => Promise; */ export type MetadataGetLabelFunc = () => string; -export type MetadataParseOptions = { - toastOnFailure?: boolean; - toastOnSuccess?: boolean; -}; - -export type MetadataRecallOptions = MetadataParseOptions; - /** * A function that recalls a parsed and validated metadata value. * @@ -119,7 +112,7 @@ export type MetadataHandlers = { // type MetadataHandlersInferItem = TValue extends Array ? MetadataParseFunc : never // While this works for the types as expected, I couldn't satisfy TS in the implementations of the handlers. -export type BuildMetadataHandlersArg = { +type BuildMetadataHandlersArg = { parser: MetadataParseFunc; itemParser?: MetadataParseFunc; recaller?: MetadataRecallFunc; diff --git a/invokeai/frontend/web/src/features/metadata/util/modelFetchingHelpers.ts b/invokeai/frontend/web/src/features/metadata/util/modelFetchingHelpers.ts index 98aa633259..3c0745917a 100644 --- a/invokeai/frontend/web/src/features/metadata/util/modelFetchingHelpers.ts +++ b/invokeai/frontend/web/src/features/metadata/util/modelFetchingHelpers.ts @@ -7,7 +7,7 @@ import type { AnyModelConfig, BaseModelType, ModelType } from 'services/api/type /** * Raised when a model config is unable to be fetched. */ -export class ModelConfigNotFoundError extends Error { +class ModelConfigNotFoundError extends Error { /** * Create ModelConfigNotFoundError * @param {String} message @@ -58,11 +58,7 @@ export const fetchModelConfig = async (key: string): Promise => * @returns A promise that resolves to the model config. * @throws {ModelConfigNotFoundError} If the model config is unable to be fetched. */ -export const fetchModelConfigByAttrs = async ( - name: string, - base: BaseModelType, - type: ModelType -): Promise => { +const fetchModelConfigByAttrs = async (name: string, base: BaseModelType, type: ModelType): Promise => { const { dispatch } = getStore(); try { const req = dispatch(modelsApi.endpoints.getModelConfigByAttrs.initiate({ name, base, type })); diff --git a/invokeai/frontend/web/src/features/metadata/util/parsers.ts b/invokeai/frontend/web/src/features/metadata/util/parsers.ts index eba51f4fd6..30ec37991c 100644 --- a/invokeai/frontend/web/src/features/metadata/util/parsers.ts +++ b/invokeai/frontend/web/src/features/metadata/util/parsers.ts @@ -78,7 +78,7 @@ export const MetadataParseFailedToken = Symbol('failed'); /** * Raised when metadata parsing fails. */ -export class MetadataParseError extends Error { +class MetadataParseError extends Error { /** * Create MetadataParseError * @param {String} message diff --git a/invokeai/frontend/web/src/features/nodes/hooks/useConnectionState.ts b/invokeai/frontend/web/src/features/nodes/hooks/useConnectionState.ts index 97b96f323a..f0a512277a 100644 --- a/invokeai/frontend/web/src/features/nodes/hooks/useConnectionState.ts +++ b/invokeai/frontend/web/src/features/nodes/hooks/useConnectionState.ts @@ -11,7 +11,7 @@ const selectIsConnectionInProgress = createSelector( (nodes) => nodes.connectionStartFieldType !== null && nodes.connectionStartParams !== null ); -export type UseConnectionStateProps = { +type UseConnectionStateProps = { nodeId: string; fieldName: string; kind: 'inputs' | 'outputs'; diff --git a/invokeai/frontend/web/src/features/nodes/store/types.ts b/invokeai/frontend/web/src/features/nodes/store/types.ts index 1a040d2c70..3f7d210dcb 100644 --- a/invokeai/frontend/web/src/features/nodes/store/types.ts +++ b/invokeai/frontend/web/src/features/nodes/store/types.ts @@ -45,7 +45,3 @@ export type WorkflowsState = Omit & { mode: WorkflowMode; originalExposedFieldValues: FieldIdentifierWithValue[]; }; - -export type NodeTemplatesState = { - templates: Record; -}; diff --git a/invokeai/frontend/web/src/features/nodes/types/common.ts b/invokeai/frontend/web/src/features/nodes/types/common.ts index 82c41096d9..f665c7780d 100644 --- a/invokeai/frontend/web/src/features/nodes/types/common.ts +++ b/invokeai/frontend/web/src/features/nodes/types/common.ts @@ -55,16 +55,6 @@ export type SchedulerField = z.infer; // #region Model-related schemas const zBaseModel = z.enum(['any', 'sd-1', 'sd-2', 'sdxl', 'sdxl-refiner']); -const zModelType = z.enum([ - 'main', - 'vae', - 'lora', - 'controlnet', - 'embedding', - 'ip_adapter', - 'clip_vision', - 't2i_adapter', -]); const zModelIdentifier = z.object({ key: z.string().min(1), }); @@ -75,8 +65,7 @@ export const isModelIdentifierV2 = (field: unknown): field is ModelIdentifierV2 const zModelFieldBase = zModelIdentifier; export const zModelIdentifierWithBase = zModelIdentifier.extend({ base: zBaseModel }); export type BaseModel = z.infer; -export type ModelType = z.infer; -export type ModelIdentifier = z.infer; +type ModelIdentifier = z.infer; export type ModelIdentifierWithBase = z.infer; // #endregion diff --git a/invokeai/frontend/web/src/features/nodes/types/field.ts b/invokeai/frontend/web/src/features/nodes/types/field.ts index 83dbf27e1e..39fa903fd7 100644 --- a/invokeai/frontend/web/src/features/nodes/types/field.ts +++ b/invokeai/frontend/web/src/features/nodes/types/field.ts @@ -30,17 +30,11 @@ import { zBoardField, zColorField, zImageField, zModelIdentifierWithBase, zSched // #region Base schemas & misc const zFieldInput = z.enum(['connection', 'direct', 'any']); -export type FieldInput = z.infer; - const zFieldUIComponent = z.enum(['none', 'textarea', 'slider']); -export type FieldUIComponent = z.infer; - const zFieldInputInstanceBase = z.object({ name: z.string().trim().min(1), label: z.string().nullish(), }); -export type FieldInputInstanceBase = z.infer; - const zFieldTemplateBase = z.object({ name: z.string().min(1), title: z.string().min(1), @@ -59,9 +53,6 @@ const zFieldInputTemplateBase = zFieldTemplateBase.extend({ const zFieldOutputTemplateBase = zFieldTemplateBase.extend({ fieldKind: z.literal('output'), }); -export type FieldTemplateBase = z.infer; -export type FieldInputTemplateBase = z.infer; -export type FieldOutputTemplateBase = z.infer; const zFieldTypeBase = z.object({ isCollection: z.boolean(), @@ -95,7 +86,6 @@ const zIntegerFieldInputTemplate = zFieldInputTemplateBase.extend({ const zIntegerFieldOutputTemplate = zFieldOutputTemplateBase.extend({ type: zIntegerFieldType, }); -export type IntegerFieldType = z.infer; export type IntegerFieldValue = z.infer; export type IntegerFieldInputInstance = z.infer; export type IntegerFieldInputTemplate = z.infer; @@ -125,11 +115,9 @@ const zFloatFieldInputTemplate = zFieldInputTemplateBase.extend({ const zFloatFieldOutputTemplate = zFieldOutputTemplateBase.extend({ type: zFloatFieldType, }); -export type FloatFieldType = z.infer; export type FloatFieldValue = z.infer; export type FloatFieldInputInstance = z.infer; export type FloatFieldInputTemplate = z.infer; -export type FloatFieldOutputTemplate = z.infer; export const isFloatFieldInputInstance = (val: unknown): val is FloatFieldInputInstance => zFloatFieldInputInstance.safeParse(val).success; export const isFloatFieldInputTemplate = (val: unknown): val is FloatFieldInputTemplate => @@ -154,11 +142,9 @@ const zStringFieldOutputTemplate = zFieldOutputTemplateBase.extend({ type: zStringFieldType, }); -export type StringFieldType = z.infer; export type StringFieldValue = z.infer; export type StringFieldInputInstance = z.infer; export type StringFieldInputTemplate = z.infer; -export type StringFieldOutputTemplate = z.infer; export const isStringFieldInputInstance = (val: unknown): val is StringFieldInputInstance => zStringFieldInputInstance.safeParse(val).success; export const isStringFieldInputTemplate = (val: unknown): val is StringFieldInputTemplate => @@ -180,11 +166,9 @@ const zBooleanFieldInputTemplate = zFieldInputTemplateBase.extend({ const zBooleanFieldOutputTemplate = zFieldOutputTemplateBase.extend({ type: zBooleanFieldType, }); -export type BooleanFieldType = z.infer; export type BooleanFieldValue = z.infer; export type BooleanFieldInputInstance = z.infer; export type BooleanFieldInputTemplate = z.infer; -export type BooleanFieldOutputTemplate = z.infer; export const isBooleanFieldInputInstance = (val: unknown): val is BooleanFieldInputInstance => zBooleanFieldInputInstance.safeParse(val).success; export const isBooleanFieldInputTemplate = (val: unknown): val is BooleanFieldInputTemplate => @@ -208,11 +192,9 @@ const zEnumFieldInputTemplate = zFieldInputTemplateBase.extend({ const zEnumFieldOutputTemplate = zFieldOutputTemplateBase.extend({ type: zEnumFieldType, }); -export type EnumFieldType = z.infer; export type EnumFieldValue = z.infer; export type EnumFieldInputInstance = z.infer; export type EnumFieldInputTemplate = z.infer; -export type EnumFieldOutputTemplate = z.infer; export const isEnumFieldInputInstance = (val: unknown): val is EnumFieldInputInstance => zEnumFieldInputInstance.safeParse(val).success; export const isEnumFieldInputTemplate = (val: unknown): val is EnumFieldInputTemplate => @@ -234,11 +216,9 @@ const zImageFieldInputTemplate = zFieldInputTemplateBase.extend({ const zImageFieldOutputTemplate = zFieldOutputTemplateBase.extend({ type: zImageFieldType, }); -export type ImageFieldType = z.infer; export type ImageFieldValue = z.infer; export type ImageFieldInputInstance = z.infer; export type ImageFieldInputTemplate = z.infer; -export type ImageFieldOutputTemplate = z.infer; export const isImageFieldInputInstance = (val: unknown): val is ImageFieldInputInstance => zImageFieldInputInstance.safeParse(val).success; export const isImageFieldInputTemplate = (val: unknown): val is ImageFieldInputTemplate => @@ -260,11 +240,9 @@ const zBoardFieldInputTemplate = zFieldInputTemplateBase.extend({ const zBoardFieldOutputTemplate = zFieldOutputTemplateBase.extend({ type: zBoardFieldType, }); -export type BoardFieldType = z.infer; export type BoardFieldValue = z.infer; export type BoardFieldInputInstance = z.infer; export type BoardFieldInputTemplate = z.infer; -export type BoardFieldOutputTemplate = z.infer; export const isBoardFieldInputInstance = (val: unknown): val is BoardFieldInputInstance => zBoardFieldInputInstance.safeParse(val).success; export const isBoardFieldInputTemplate = (val: unknown): val is BoardFieldInputTemplate => @@ -286,11 +264,9 @@ const zColorFieldInputTemplate = zFieldInputTemplateBase.extend({ const zColorFieldOutputTemplate = zFieldOutputTemplateBase.extend({ type: zColorFieldType, }); -export type ColorFieldType = z.infer; export type ColorFieldValue = z.infer; export type ColorFieldInputInstance = z.infer; export type ColorFieldInputTemplate = z.infer; -export type ColorFieldOutputTemplate = z.infer; export const isColorFieldInputInstance = (val: unknown): val is ColorFieldInputInstance => zColorFieldInputInstance.safeParse(val).success; export const isColorFieldInputTemplate = (val: unknown): val is ColorFieldInputTemplate => @@ -312,11 +288,9 @@ const zMainModelFieldInputTemplate = zFieldInputTemplateBase.extend({ const zMainModelFieldOutputTemplate = zFieldOutputTemplateBase.extend({ type: zMainModelFieldType, }); -export type MainModelFieldType = z.infer; export type MainModelFieldValue = z.infer; export type MainModelFieldInputInstance = z.infer; export type MainModelFieldInputTemplate = z.infer; -export type MainModelFieldOutputTemplate = z.infer; export const isMainModelFieldInputInstance = (val: unknown): val is MainModelFieldInputInstance => zMainModelFieldInputInstance.safeParse(val).success; export const isMainModelFieldInputTemplate = (val: unknown): val is MainModelFieldInputTemplate => @@ -338,11 +312,8 @@ const zSDXLMainModelFieldInputTemplate = zFieldInputTemplateBase.extend({ const zSDXLMainModelFieldOutputTemplate = zFieldOutputTemplateBase.extend({ type: zSDXLMainModelFieldType, }); -export type SDXLMainModelFieldType = z.infer; -export type SDXLMainModelFieldValue = z.infer; export type SDXLMainModelFieldInputInstance = z.infer; export type SDXLMainModelFieldInputTemplate = z.infer; -export type SDXLMainModelFieldOutputTemplate = z.infer; export const isSDXLMainModelFieldInputInstance = (val: unknown): val is SDXLMainModelFieldInputInstance => zSDXLMainModelFieldInputInstance.safeParse(val).success; export const isSDXLMainModelFieldInputTemplate = (val: unknown): val is SDXLMainModelFieldInputTemplate => @@ -364,11 +335,9 @@ const zSDXLRefinerModelFieldInputTemplate = zFieldInputTemplateBase.extend({ const zSDXLRefinerModelFieldOutputTemplate = zFieldOutputTemplateBase.extend({ type: zSDXLRefinerModelFieldType, }); -export type SDXLRefinerModelFieldType = z.infer; export type SDXLRefinerModelFieldValue = z.infer; export type SDXLRefinerModelFieldInputInstance = z.infer; export type SDXLRefinerModelFieldInputTemplate = z.infer; -export type SDXLRefinerModelFieldOutputTemplate = z.infer; export const isSDXLRefinerModelFieldInputInstance = (val: unknown): val is SDXLRefinerModelFieldInputInstance => zSDXLRefinerModelFieldInputInstance.safeParse(val).success; export const isSDXLRefinerModelFieldInputTemplate = (val: unknown): val is SDXLRefinerModelFieldInputTemplate => @@ -390,11 +359,9 @@ const zVAEModelFieldInputTemplate = zFieldInputTemplateBase.extend({ const zVAEModelFieldOutputTemplate = zFieldOutputTemplateBase.extend({ type: zVAEModelFieldType, }); -export type VAEModelFieldType = z.infer; export type VAEModelFieldValue = z.infer; export type VAEModelFieldInputInstance = z.infer; export type VAEModelFieldInputTemplate = z.infer; -export type VAEModelFieldOutputTemplate = z.infer; export const isVAEModelFieldInputInstance = (val: unknown): val is VAEModelFieldInputInstance => zVAEModelFieldInputInstance.safeParse(val).success; export const isVAEModelFieldInputTemplate = (val: unknown): val is VAEModelFieldInputTemplate => @@ -416,11 +383,9 @@ const zLoRAModelFieldInputTemplate = zFieldInputTemplateBase.extend({ const zLoRAModelFieldOutputTemplate = zFieldOutputTemplateBase.extend({ type: zLoRAModelFieldType, }); -export type LoRAModelFieldType = z.infer; export type LoRAModelFieldValue = z.infer; export type LoRAModelFieldInputInstance = z.infer; export type LoRAModelFieldInputTemplate = z.infer; -export type LoRAModelFieldOutputTemplate = z.infer; export const isLoRAModelFieldInputInstance = (val: unknown): val is LoRAModelFieldInputInstance => zLoRAModelFieldInputInstance.safeParse(val).success; export const isLoRAModelFieldInputTemplate = (val: unknown): val is LoRAModelFieldInputTemplate => @@ -442,11 +407,9 @@ const zControlNetModelFieldInputTemplate = zFieldInputTemplateBase.extend({ const zControlNetModelFieldOutputTemplate = zFieldOutputTemplateBase.extend({ type: zControlNetModelFieldType, }); -export type ControlNetModelFieldType = z.infer; export type ControlNetModelFieldValue = z.infer; export type ControlNetModelFieldInputInstance = z.infer; export type ControlNetModelFieldInputTemplate = z.infer; -export type ControlNetModelFieldOutputTemplate = z.infer; export const isControlNetModelFieldInputInstance = (val: unknown): val is ControlNetModelFieldInputInstance => zControlNetModelFieldInputInstance.safeParse(val).success; export const isControlNetModelFieldInputTemplate = (val: unknown): val is ControlNetModelFieldInputTemplate => @@ -468,11 +431,9 @@ const zIPAdapterModelFieldInputTemplate = zFieldInputTemplateBase.extend({ const zIPAdapterModelFieldOutputTemplate = zFieldOutputTemplateBase.extend({ type: zIPAdapterModelFieldType, }); -export type IPAdapterModelFieldType = z.infer; export type IPAdapterModelFieldValue = z.infer; export type IPAdapterModelFieldInputInstance = z.infer; export type IPAdapterModelFieldInputTemplate = z.infer; -export type IPAdapterModelFieldOutputTemplate = z.infer; export const isIPAdapterModelFieldInputInstance = (val: unknown): val is IPAdapterModelFieldInputInstance => zIPAdapterModelFieldInputInstance.safeParse(val).success; export const isIPAdapterModelFieldInputTemplate = (val: unknown): val is IPAdapterModelFieldInputTemplate => @@ -494,11 +455,9 @@ const zT2IAdapterModelFieldInputTemplate = zFieldInputTemplateBase.extend({ const zT2IAdapterModelFieldOutputTemplate = zFieldOutputTemplateBase.extend({ type: zT2IAdapterModelFieldType, }); -export type T2IAdapterModelFieldType = z.infer; export type T2IAdapterModelFieldValue = z.infer; export type T2IAdapterModelFieldInputInstance = z.infer; export type T2IAdapterModelFieldInputTemplate = z.infer; -export type T2IAdapterModelFieldOutputTemplate = z.infer; export const isT2IAdapterModelFieldInputInstance = (val: unknown): val is T2IAdapterModelFieldInputInstance => zT2IAdapterModelFieldInputInstance.safeParse(val).success; export const isT2IAdapterModelFieldInputTemplate = (val: unknown): val is T2IAdapterModelFieldInputTemplate => @@ -520,11 +479,9 @@ const zSchedulerFieldInputTemplate = zFieldInputTemplateBase.extend({ const zSchedulerFieldOutputTemplate = zFieldOutputTemplateBase.extend({ type: zSchedulerFieldType, }); -export type SchedulerFieldType = z.infer; export type SchedulerFieldValue = z.infer; export type SchedulerFieldInputInstance = z.infer; export type SchedulerFieldInputTemplate = z.infer; -export type SchedulerFieldOutputTemplate = z.infer; export const isSchedulerFieldInputInstance = (val: unknown): val is SchedulerFieldInputInstance => zSchedulerFieldInputInstance.safeParse(val).success; export const isSchedulerFieldInputTemplate = (val: unknown): val is SchedulerFieldInputTemplate => @@ -559,11 +516,7 @@ const zStatelessFieldOutputTemplate = zFieldOutputTemplateBase.extend({ type: zStatelessFieldType, }); -export type StatelessFieldType = z.infer; -export type StatelessFieldValue = z.infer; -export type StatelessFieldInputInstance = z.infer; export type StatelessFieldInputTemplate = z.infer; -export type StatelessFieldOutputTemplate = z.infer; // #endregion /** @@ -655,7 +608,6 @@ const zStatefulFieldInputInstance = z.union([ zColorFieldInputInstance, zSchedulerFieldInputInstance, ]); -export type StatefulFieldInputInstance = z.infer; export const zFieldInputInstance = z.union([zStatefulFieldInputInstance, zStatelessFieldInputInstance]); export type FieldInputInstance = z.infer; @@ -684,7 +636,6 @@ const zStatefulFieldInputTemplate = z.union([ zSchedulerFieldInputTemplate, zStatelessFieldInputTemplate, ]); -export type StatefulFieldInputTemplate = z.infer; export const zFieldInputTemplate = z.union([zStatefulFieldInputTemplate, zStatelessFieldInputTemplate]); export type FieldInputTemplate = z.infer; @@ -712,7 +663,6 @@ const zStatefulFieldOutputTemplate = z.union([ zColorFieldOutputTemplate, zSchedulerFieldOutputTemplate, ]); -export type StatefulFieldOutputTemplate = z.infer; export const zFieldOutputTemplate = z.union([zStatefulFieldOutputTemplate, zStatelessFieldOutputTemplate]); export type FieldOutputTemplate = z.infer; diff --git a/invokeai/frontend/web/src/features/nodes/types/invocation.ts b/invokeai/frontend/web/src/features/nodes/types/invocation.ts index 52db5de5ee..66a3db62bf 100644 --- a/invokeai/frontend/web/src/features/nodes/types/invocation.ts +++ b/invokeai/frontend/web/src/features/nodes/types/invocation.ts @@ -53,8 +53,8 @@ const zAnyNodeData = z.union([zInvocationNodeData, zNotesNodeData, zCurrentImage export type NotesNodeData = z.infer; export type InvocationNodeData = z.infer; -export type CurrentImageNodeData = z.infer; -export type AnyNodeData = z.infer; +type CurrentImageNodeData = z.infer; +type AnyNodeData = z.infer; export type InvocationNode = Node; export type NotesNode = Node; @@ -79,13 +79,12 @@ const zNodeExecutionState = z.object({ outputs: z.array(z.any()), }); export type NodeExecutionState = z.infer; -export type NodeStatus = z.infer; // #endregion // #region Edges const zInvocationNodeEdgeExtra = z.object({ type: z.union([z.literal('default'), z.literal('collapsed')]), }); -export type InvocationNodeEdgeExtra = z.infer; +type InvocationNodeEdgeExtra = z.infer; export type InvocationNodeEdge = Edge; // #endregion diff --git a/invokeai/frontend/web/src/features/nodes/types/openapi.ts b/invokeai/frontend/web/src/features/nodes/types/openapi.ts index 83d774439a..8a8a16f1fd 100644 --- a/invokeai/frontend/web/src/features/nodes/types/openapi.ts +++ b/invokeai/frontend/web/src/features/nodes/types/openapi.ts @@ -7,7 +7,7 @@ import type { // Janky customization of OpenAPI Schema :/ -export type InvocationSchemaExtra = InvocationJSONSchemaExtra & { +type InvocationSchemaExtra = InvocationJSONSchemaExtra & { output: OpenAPIV3_1.ReferenceObject; // the output of the invocation title: string; category?: string; @@ -26,14 +26,10 @@ export type InvocationSchemaExtra = InvocationJSONSchemaExtra & { }; }; -export type InvocationSchemaType = { - default: string; // the type of the invocation -}; - -export type InvocationBaseSchemaObject = Omit & +type InvocationBaseSchemaObject = Omit & InvocationSchemaExtra; -export type InvocationOutputSchemaObject = Omit & { +type InvocationOutputSchemaObject = Omit & { properties: OpenAPIV3_1.SchemaObject['properties'] & { type: Omit & { default: string; @@ -47,11 +43,11 @@ export type InvocationFieldSchema = OpenAPIV3_1.SchemaObject & InputFieldJSONSch export type OpenAPIV3_1SchemaOrRef = OpenAPIV3_1.ReferenceObject | OpenAPIV3_1.SchemaObject; -export interface ArraySchemaObject extends InvocationBaseSchemaObject { +interface ArraySchemaObject extends InvocationBaseSchemaObject { type: OpenAPIV3_1.ArraySchemaObjectType; items: OpenAPIV3_1.ReferenceObject | OpenAPIV3_1.SchemaObject; } -export interface NonArraySchemaObject extends InvocationBaseSchemaObject { +interface NonArraySchemaObject extends InvocationBaseSchemaObject { type?: OpenAPIV3_1.NonArraySchemaObjectType; } diff --git a/invokeai/frontend/web/src/features/nodes/types/v2/common.ts b/invokeai/frontend/web/src/features/nodes/types/v2/common.ts index b524474379..8613076132 100644 --- a/invokeai/frontend/web/src/features/nodes/types/v2/common.ts +++ b/invokeai/frontend/web/src/features/nodes/types/v2/common.ts @@ -4,12 +4,10 @@ import { z } from 'zod'; export const zImageField = z.object({ image_name: z.string().trim().min(1), }); -export type ImageField = z.infer; export const zBoardField = z.object({ board_id: z.string().trim().min(1), }); -export type BoardField = z.infer; export const zColorField = z.object({ r: z.number().int().min(0).max(255), @@ -17,10 +15,6 @@ export const zColorField = z.object({ b: z.number().int().min(0).max(255), a: z.number().int().min(0).max(255), }); -export type ColorField = z.infer; - -export const zClassification = z.enum(['stable', 'beta', 'prototype']); -export type Classification = z.infer; export const zSchedulerField = z.enum([ 'euler', @@ -47,19 +41,15 @@ export const zSchedulerField = z.enum([ 'kdpm_2_a', 'lcm', ]); -export type SchedulerField = z.infer; // #endregion // #region Model-related schemas -export const zBaseModel = z.enum(['any', 'sd-1', 'sd-2', 'sdxl', 'sdxl-refiner']); -export const zModelType = z.enum(['main', 'vae', 'lora', 'controlnet', 'embedding']); -export const zModelName = z.string().min(3); +const zBaseModel = z.enum(['any', 'sd-1', 'sd-2', 'sdxl', 'sdxl-refiner']); +const zModelName = z.string().min(3); export const zModelIdentifier = z.object({ model_name: zModelName, base_model: zBaseModel, }); -export type BaseModel = z.infer; -export type ModelType = z.infer; export type ModelIdentifier = z.infer; export const zMainModelField = z.object({ @@ -67,122 +57,10 @@ export const zMainModelField = z.object({ base_model: zBaseModel, model_type: z.literal('main'), }); -export const zSDXLRefinerModelField = z.object({ - model_name: z.string().min(1), - base_model: z.literal('sdxl-refiner'), - model_type: z.literal('main'), -}); -export type MainModelField = z.infer; -export type SDXLRefinerModelField = z.infer; - -export const zSubModelType = z.enum([ - 'unet', - 'text_encoder', - 'text_encoder_2', - 'tokenizer', - 'tokenizer_2', - 'vae', - 'vae_decoder', - 'vae_encoder', - 'scheduler', - 'safety_checker', -]); -export type SubModelType = z.infer; export const zVAEModelField = zModelIdentifier; - -export const zModelInfo = zModelIdentifier.extend({ - model_type: zModelType, - submodel: zSubModelType.optional(), -}); -export type ModelInfo = z.infer; - export const zLoRAModelField = zModelIdentifier; -export type LoRAModelField = z.infer; - export const zControlNetModelField = zModelIdentifier; -export type ControlNetModelField = z.infer; - export const zIPAdapterModelField = zModelIdentifier; -export type IPAdapterModelField = z.infer; - export const zT2IAdapterModelField = zModelIdentifier; -export type T2IAdapterModelField = z.infer; - -export const zLoraInfo = zModelInfo.extend({ - weight: z.number().optional(), -}); -export type LoraInfo = z.infer; - -export const zUNetField = z.object({ - unet: zModelInfo, - scheduler: zModelInfo, - loras: z.array(zLoraInfo), -}); -export type UNetField = z.infer; - -export const zCLIPField = z.object({ - tokenizer: zModelInfo, - text_encoder: zModelInfo, - skipped_layers: z.number(), - loras: z.array(zLoraInfo), -}); -export type CLIPField = z.infer; - -export const zVAEField = z.object({ - vae: zModelInfo, -}); -export type VAEField = z.infer; -// #endregion - -// #region Control Adapters -export const zControlField = z.object({ - image: zImageField, - control_model: zControlNetModelField, - control_weight: z.union([z.number(), z.array(z.number())]).optional(), - begin_step_percent: z.number().optional(), - end_step_percent: z.number().optional(), - control_mode: z.enum(['balanced', 'more_prompt', 'more_control', 'unbalanced']).optional(), - resize_mode: z.enum(['just_resize', 'crop_resize', 'fill_resize', 'just_resize_simple']).optional(), -}); -export type ControlField = z.infer; - -export const zIPAdapterField = z.object({ - image: zImageField, - ip_adapter_model: zIPAdapterModelField, - weight: z.number(), - begin_step_percent: z.number().optional(), - end_step_percent: z.number().optional(), -}); -export type IPAdapterField = z.infer; - -export const zT2IAdapterField = z.object({ - image: zImageField, - t2i_adapter_model: zT2IAdapterModelField, - weight: z.union([z.number(), z.array(z.number())]).optional(), - begin_step_percent: z.number().optional(), - end_step_percent: z.number().optional(), - resize_mode: z.enum(['just_resize', 'crop_resize', 'fill_resize', 'just_resize_simple']).optional(), -}); -export type T2IAdapterField = z.infer; -// #endregion - -// #region ProgressImage -export const zProgressImage = z.object({ - dataURL: z.string(), - width: z.number().int(), - height: z.number().int(), -}); -export type ProgressImage = z.infer; -// #endregion - -// #region ImageOutput -export const zImageOutput = z.object({ - image: zImageField, - width: z.number().int().gt(0), - height: z.number().int().gt(0), - type: z.literal('image_output'), -}); -export type ImageOutput = z.infer; -export const isImageOutput = (output: unknown): output is ImageOutput => zImageOutput.safeParse(output).success; // #endregion diff --git a/invokeai/frontend/web/src/features/nodes/types/v2/field.ts b/invokeai/frontend/web/src/features/nodes/types/v2/field.ts index 38f1af55dd..1e464fa76d 100644 --- a/invokeai/frontend/web/src/features/nodes/types/v2/field.ts +++ b/invokeai/frontend/web/src/features/nodes/types/v2/field.ts @@ -40,50 +40,19 @@ import { /** */ // #region Base schemas & misc -export const zFieldInput = z.enum(['connection', 'direct', 'any']); -export type FieldInput = z.infer; - -export const zFieldUIComponent = z.enum(['none', 'textarea', 'slider']); -export type FieldUIComponent = z.infer; - -export const zFieldInstanceBase = z.object({ +const zFieldInstanceBase = z.object({ id: z.string().trim().min(1), name: z.string().trim().min(1), }); -export const zFieldInputInstanceBase = zFieldInstanceBase.extend({ +const zFieldInputInstanceBase = zFieldInstanceBase.extend({ fieldKind: z.literal('input'), label: z.string().nullish(), }); -export const zFieldOutputInstanceBase = zFieldInstanceBase.extend({ +const zFieldOutputInstanceBase = zFieldInstanceBase.extend({ fieldKind: z.literal('output'), }); -export type FieldInstanceBase = z.infer; -export type FieldInputInstanceBase = z.infer; -export type FieldOutputInstanceBase = z.infer; -export const zFieldTemplateBase = z.object({ - name: z.string().min(1), - title: z.string().min(1), - description: z.string().nullish(), - ui_hidden: z.boolean(), - ui_type: z.string().nullish(), - ui_order: z.number().int().nullish(), -}); -export const zFieldInputTemplateBase = zFieldTemplateBase.extend({ - fieldKind: z.literal('input'), - input: zFieldInput, - required: z.boolean(), - ui_component: zFieldUIComponent.nullish(), - ui_choice_labels: z.record(z.string()).nullish(), -}); -export const zFieldOutputTemplateBase = zFieldTemplateBase.extend({ - fieldKind: z.literal('output'), -}); -export type FieldTemplateBase = z.infer; -export type FieldInputTemplateBase = z.infer; -export type FieldOutputTemplateBase = z.infer; - -export const zFieldTypeBase = z.object({ +const zFieldTypeBase = z.object({ isCollection: z.boolean(), isCollectionOrScalar: z.boolean(), }); @@ -92,552 +61,244 @@ export const zFieldIdentifier = z.object({ nodeId: z.string().trim().min(1), fieldName: z.string().trim().min(1), }); -export type FieldIdentifier = z.infer; -export const isFieldIdentifier = (val: unknown): val is FieldIdentifier => zFieldIdentifier.safeParse(val).success; // #endregion // #region IntegerField -export const zIntegerFieldType = zFieldTypeBase.extend({ +const zIntegerFieldType = zFieldTypeBase.extend({ name: z.literal('IntegerField'), }); -export const zIntegerFieldValue = z.number().int(); -export const zIntegerFieldInputInstance = zFieldInputInstanceBase.extend({ +const zIntegerFieldValue = z.number().int(); +const zIntegerFieldInputInstance = zFieldInputInstanceBase.extend({ type: zIntegerFieldType, value: zIntegerFieldValue, }); -export const zIntegerFieldOutputInstance = zFieldOutputInstanceBase.extend({ +const zIntegerFieldOutputInstance = zFieldOutputInstanceBase.extend({ type: zIntegerFieldType, }); -export const zIntegerFieldInputTemplate = zFieldInputTemplateBase.extend({ - type: zIntegerFieldType, - default: zIntegerFieldValue, - multipleOf: z.number().int().optional(), - maximum: z.number().int().optional(), - exclusiveMaximum: z.number().int().optional(), - minimum: z.number().int().optional(), - exclusiveMinimum: z.number().int().optional(), -}); -export const zIntegerFieldOutputTemplate = zFieldOutputTemplateBase.extend({ - type: zIntegerFieldType, -}); -export type IntegerFieldType = z.infer; -export type IntegerFieldValue = z.infer; -export type IntegerFieldInputInstance = z.infer; -export type IntegerFieldInputTemplate = z.infer; -export const isIntegerFieldInputInstance = (val: unknown): val is IntegerFieldInputInstance => - zIntegerFieldInputInstance.safeParse(val).success; -export const isIntegerFieldInputTemplate = (val: unknown): val is IntegerFieldInputTemplate => - zIntegerFieldInputTemplate.safeParse(val).success; // #endregion // #region FloatField -export const zFloatFieldType = zFieldTypeBase.extend({ +const zFloatFieldType = zFieldTypeBase.extend({ name: z.literal('FloatField'), }); -export const zFloatFieldValue = z.number(); -export const zFloatFieldInputInstance = zFieldInputInstanceBase.extend({ +const zFloatFieldValue = z.number(); +const zFloatFieldInputInstance = zFieldInputInstanceBase.extend({ type: zFloatFieldType, value: zFloatFieldValue, }); -export const zFloatFieldOutputInstance = zFieldOutputInstanceBase.extend({ +const zFloatFieldOutputInstance = zFieldOutputInstanceBase.extend({ type: zFloatFieldType, }); -export const zFloatFieldInputTemplate = zFieldInputTemplateBase.extend({ - type: zFloatFieldType, - default: zFloatFieldValue, - multipleOf: z.number().optional(), - maximum: z.number().optional(), - exclusiveMaximum: z.number().optional(), - minimum: z.number().optional(), - exclusiveMinimum: z.number().optional(), -}); -export const zFloatFieldOutputTemplate = zFieldOutputTemplateBase.extend({ - type: zFloatFieldType, -}); -export type FloatFieldType = z.infer; -export type FloatFieldValue = z.infer; -export type FloatFieldInputInstance = z.infer; -export type FloatFieldOutputInstance = z.infer; -export type FloatFieldInputTemplate = z.infer; -export type FloatFieldOutputTemplate = z.infer; -export const isFloatFieldInputInstance = (val: unknown): val is FloatFieldInputInstance => - zFloatFieldInputInstance.safeParse(val).success; -export const isFloatFieldInputTemplate = (val: unknown): val is FloatFieldInputTemplate => - zFloatFieldInputTemplate.safeParse(val).success; // #endregion // #region StringField -export const zStringFieldType = zFieldTypeBase.extend({ +const zStringFieldType = zFieldTypeBase.extend({ name: z.literal('StringField'), }); -export const zStringFieldValue = z.string(); -export const zStringFieldInputInstance = zFieldInputInstanceBase.extend({ +const zStringFieldValue = z.string(); +const zStringFieldInputInstance = zFieldInputInstanceBase.extend({ type: zStringFieldType, value: zStringFieldValue, }); -export const zStringFieldOutputInstance = zFieldOutputInstanceBase.extend({ +const zStringFieldOutputInstance = zFieldOutputInstanceBase.extend({ type: zStringFieldType, }); -export const zStringFieldInputTemplate = zFieldInputTemplateBase.extend({ - type: zStringFieldType, - default: zStringFieldValue, - maxLength: z.number().int().optional(), - minLength: z.number().int().optional(), -}); -export const zStringFieldOutputTemplate = zFieldOutputTemplateBase.extend({ - type: zStringFieldType, -}); - -export type StringFieldType = z.infer; -export type StringFieldValue = z.infer; -export type StringFieldInputInstance = z.infer; -export type StringFieldOutputInstance = z.infer; -export type StringFieldInputTemplate = z.infer; -export type StringFieldOutputTemplate = z.infer; -export const isStringFieldInputInstance = (val: unknown): val is StringFieldInputInstance => - zStringFieldInputInstance.safeParse(val).success; -export const isStringFieldInputTemplate = (val: unknown): val is StringFieldInputTemplate => - zStringFieldInputTemplate.safeParse(val).success; // #endregion // #region BooleanField -export const zBooleanFieldType = zFieldTypeBase.extend({ +const zBooleanFieldType = zFieldTypeBase.extend({ name: z.literal('BooleanField'), }); -export const zBooleanFieldValue = z.boolean(); -export const zBooleanFieldInputInstance = zFieldInputInstanceBase.extend({ +const zBooleanFieldValue = z.boolean(); +const zBooleanFieldInputInstance = zFieldInputInstanceBase.extend({ type: zBooleanFieldType, value: zBooleanFieldValue, }); -export const zBooleanFieldOutputInstance = zFieldOutputInstanceBase.extend({ +const zBooleanFieldOutputInstance = zFieldOutputInstanceBase.extend({ type: zBooleanFieldType, }); -export const zBooleanFieldInputTemplate = zFieldInputTemplateBase.extend({ - type: zBooleanFieldType, - default: zBooleanFieldValue, -}); -export const zBooleanFieldOutputTemplate = zFieldOutputTemplateBase.extend({ - type: zBooleanFieldType, -}); -export type BooleanFieldType = z.infer; -export type BooleanFieldValue = z.infer; -export type BooleanFieldInputInstance = z.infer; -export type BooleanFieldOutputInstance = z.infer; -export type BooleanFieldInputTemplate = z.infer; -export type BooleanFieldOutputTemplate = z.infer; -export const isBooleanFieldInputInstance = (val: unknown): val is BooleanFieldInputInstance => - zBooleanFieldInputInstance.safeParse(val).success; -export const isBooleanFieldInputTemplate = (val: unknown): val is BooleanFieldInputTemplate => - zBooleanFieldInputTemplate.safeParse(val).success; // #endregion // #region EnumField -export const zEnumFieldType = zFieldTypeBase.extend({ +const zEnumFieldType = zFieldTypeBase.extend({ name: z.literal('EnumField'), }); -export const zEnumFieldValue = z.string(); -export const zEnumFieldInputInstance = zFieldInputInstanceBase.extend({ +const zEnumFieldValue = z.string(); +const zEnumFieldInputInstance = zFieldInputInstanceBase.extend({ type: zEnumFieldType, value: zEnumFieldValue, }); -export const zEnumFieldOutputInstance = zFieldOutputInstanceBase.extend({ +const zEnumFieldOutputInstance = zFieldOutputInstanceBase.extend({ type: zEnumFieldType, }); -export const zEnumFieldInputTemplate = zFieldInputTemplateBase.extend({ - type: zEnumFieldType, - default: zEnumFieldValue, - options: z.array(z.string()), - labels: z.record(z.string()).optional(), -}); -export const zEnumFieldOutputTemplate = zFieldOutputTemplateBase.extend({ - type: zEnumFieldType, -}); -export type EnumFieldType = z.infer; -export type EnumFieldValue = z.infer; -export type EnumFieldInputInstance = z.infer; -export type EnumFieldOutputInstance = z.infer; -export type EnumFieldInputTemplate = z.infer; -export type EnumFieldOutputTemplate = z.infer; -export const isEnumFieldInputInstance = (val: unknown): val is EnumFieldInputInstance => - zEnumFieldInputInstance.safeParse(val).success; -export const isEnumFieldInputTemplate = (val: unknown): val is EnumFieldInputTemplate => - zEnumFieldInputTemplate.safeParse(val).success; // #endregion // #region ImageField -export const zImageFieldType = zFieldTypeBase.extend({ +const zImageFieldType = zFieldTypeBase.extend({ name: z.literal('ImageField'), }); -export const zImageFieldValue = zImageField.optional(); -export const zImageFieldInputInstance = zFieldInputInstanceBase.extend({ +const zImageFieldValue = zImageField.optional(); +const zImageFieldInputInstance = zFieldInputInstanceBase.extend({ type: zImageFieldType, value: zImageFieldValue, }); -export const zImageFieldOutputInstance = zFieldOutputInstanceBase.extend({ +const zImageFieldOutputInstance = zFieldOutputInstanceBase.extend({ type: zImageFieldType, }); -export const zImageFieldInputTemplate = zFieldInputTemplateBase.extend({ - type: zImageFieldType, - default: zImageFieldValue, -}); -export const zImageFieldOutputTemplate = zFieldOutputTemplateBase.extend({ - type: zImageFieldType, -}); -export type ImageFieldType = z.infer; -export type ImageFieldValue = z.infer; -export type ImageFieldInputInstance = z.infer; -export type ImageFieldOutputInstance = z.infer; -export type ImageFieldInputTemplate = z.infer; -export type ImageFieldOutputTemplate = z.infer; -export const isImageFieldInputInstance = (val: unknown): val is ImageFieldInputInstance => - zImageFieldInputInstance.safeParse(val).success; -export const isImageFieldInputTemplate = (val: unknown): val is ImageFieldInputTemplate => - zImageFieldInputTemplate.safeParse(val).success; // #endregion // #region BoardField -export const zBoardFieldType = zFieldTypeBase.extend({ +const zBoardFieldType = zFieldTypeBase.extend({ name: z.literal('BoardField'), }); -export const zBoardFieldValue = zBoardField.optional(); -export const zBoardFieldInputInstance = zFieldInputInstanceBase.extend({ +const zBoardFieldValue = zBoardField.optional(); +const zBoardFieldInputInstance = zFieldInputInstanceBase.extend({ type: zBoardFieldType, value: zBoardFieldValue, }); -export const zBoardFieldOutputInstance = zFieldOutputInstanceBase.extend({ +const zBoardFieldOutputInstance = zFieldOutputInstanceBase.extend({ type: zBoardFieldType, }); -export const zBoardFieldInputTemplate = zFieldInputTemplateBase.extend({ - type: zBoardFieldType, - default: zBoardFieldValue, -}); -export const zBoardFieldOutputTemplate = zFieldOutputTemplateBase.extend({ - type: zBoardFieldType, -}); -export type BoardFieldType = z.infer; -export type BoardFieldValue = z.infer; -export type BoardFieldInputInstance = z.infer; -export type BoardFieldOutputInstance = z.infer; -export type BoardFieldInputTemplate = z.infer; -export type BoardFieldOutputTemplate = z.infer; -export const isBoardFieldInputInstance = (val: unknown): val is BoardFieldInputInstance => - zBoardFieldInputInstance.safeParse(val).success; -export const isBoardFieldInputTemplate = (val: unknown): val is BoardFieldInputTemplate => - zBoardFieldInputTemplate.safeParse(val).success; // #endregion // #region ColorField -export const zColorFieldType = zFieldTypeBase.extend({ +const zColorFieldType = zFieldTypeBase.extend({ name: z.literal('ColorField'), }); -export const zColorFieldValue = zColorField.optional(); -export const zColorFieldInputInstance = zFieldInputInstanceBase.extend({ +const zColorFieldValue = zColorField.optional(); +const zColorFieldInputInstance = zFieldInputInstanceBase.extend({ type: zColorFieldType, value: zColorFieldValue, }); -export const zColorFieldOutputInstance = zFieldOutputInstanceBase.extend({ +const zColorFieldOutputInstance = zFieldOutputInstanceBase.extend({ type: zColorFieldType, }); -export const zColorFieldInputTemplate = zFieldInputTemplateBase.extend({ - type: zColorFieldType, - default: zColorFieldValue, -}); -export const zColorFieldOutputTemplate = zFieldOutputTemplateBase.extend({ - type: zColorFieldType, -}); -export type ColorFieldType = z.infer; -export type ColorFieldValue = z.infer; -export type ColorFieldInputInstance = z.infer; -export type ColorFieldOutputInstance = z.infer; -export type ColorFieldInputTemplate = z.infer; -export type ColorFieldOutputTemplate = z.infer; -export const isColorFieldInputInstance = (val: unknown): val is ColorFieldInputInstance => - zColorFieldInputInstance.safeParse(val).success; -export const isColorFieldInputTemplate = (val: unknown): val is ColorFieldInputTemplate => - zColorFieldInputTemplate.safeParse(val).success; // #endregion // #region MainModelField -export const zMainModelFieldType = zFieldTypeBase.extend({ +const zMainModelFieldType = zFieldTypeBase.extend({ name: z.literal('MainModelField'), }); -export const zMainModelFieldValue = zMainModelField.optional(); -export const zMainModelFieldInputInstance = zFieldInputInstanceBase.extend({ +const zMainModelFieldValue = zMainModelField.optional(); +const zMainModelFieldInputInstance = zFieldInputInstanceBase.extend({ type: zMainModelFieldType, value: zMainModelFieldValue, }); -export const zMainModelFieldOutputInstance = zFieldOutputInstanceBase.extend({ +const zMainModelFieldOutputInstance = zFieldOutputInstanceBase.extend({ type: zMainModelFieldType, }); -export const zMainModelFieldInputTemplate = zFieldInputTemplateBase.extend({ - type: zMainModelFieldType, - default: zMainModelFieldValue, -}); -export const zMainModelFieldOutputTemplate = zFieldOutputTemplateBase.extend({ - type: zMainModelFieldType, -}); -export type MainModelFieldType = z.infer; -export type MainModelFieldValue = z.infer; -export type MainModelFieldInputInstance = z.infer; -export type MainModelFieldOutputInstance = z.infer; -export type MainModelFieldInputTemplate = z.infer; -export type MainModelFieldOutputTemplate = z.infer; -export const isMainModelFieldInputInstance = (val: unknown): val is MainModelFieldInputInstance => - zMainModelFieldInputInstance.safeParse(val).success; -export const isMainModelFieldInputTemplate = (val: unknown): val is MainModelFieldInputTemplate => - zMainModelFieldInputTemplate.safeParse(val).success; // #endregion // #region SDXLMainModelField -export const zSDXLMainModelFieldType = zFieldTypeBase.extend({ +const zSDXLMainModelFieldType = zFieldTypeBase.extend({ name: z.literal('SDXLMainModelField'), }); -export const zSDXLMainModelFieldValue = zMainModelFieldValue; // TODO: Narrow to SDXL models only. -export const zSDXLMainModelFieldInputInstance = zFieldInputInstanceBase.extend({ +const zSDXLMainModelFieldValue = zMainModelFieldValue; // TODO: Narrow to SDXL models only. +const zSDXLMainModelFieldInputInstance = zFieldInputInstanceBase.extend({ type: zSDXLMainModelFieldType, value: zSDXLMainModelFieldValue, }); -export const zSDXLMainModelFieldOutputInstance = zFieldOutputInstanceBase.extend({ +const zSDXLMainModelFieldOutputInstance = zFieldOutputInstanceBase.extend({ type: zSDXLMainModelFieldType, }); -export const zSDXLMainModelFieldInputTemplate = zFieldInputTemplateBase.extend({ - type: zSDXLMainModelFieldType, - default: zSDXLMainModelFieldValue, -}); -export const zSDXLMainModelFieldOutputTemplate = zFieldOutputTemplateBase.extend({ - type: zSDXLMainModelFieldType, -}); -export type SDXLMainModelFieldType = z.infer; -export type SDXLMainModelFieldValue = z.infer; -export type SDXLMainModelFieldInputInstance = z.infer; -export type SDXLMainModelFieldOutputInstance = z.infer; -export type SDXLMainModelFieldInputTemplate = z.infer; -export type SDXLMainModelFieldOutputTemplate = z.infer; -export const isSDXLMainModelFieldInputInstance = (val: unknown): val is SDXLMainModelFieldInputInstance => - zSDXLMainModelFieldInputInstance.safeParse(val).success; -export const isSDXLMainModelFieldInputTemplate = (val: unknown): val is SDXLMainModelFieldInputTemplate => - zSDXLMainModelFieldInputTemplate.safeParse(val).success; // #endregion // #region SDXLRefinerModelField -export const zSDXLRefinerModelFieldType = zFieldTypeBase.extend({ +const zSDXLRefinerModelFieldType = zFieldTypeBase.extend({ name: z.literal('SDXLRefinerModelField'), }); -export const zSDXLRefinerModelFieldValue = zMainModelFieldValue; // TODO: Narrow to SDXL Refiner models only. -export const zSDXLRefinerModelFieldInputInstance = zFieldInputInstanceBase.extend({ +const zSDXLRefinerModelFieldValue = zMainModelFieldValue; // TODO: Narrow to SDXL Refiner models only. +const zSDXLRefinerModelFieldInputInstance = zFieldInputInstanceBase.extend({ type: zSDXLRefinerModelFieldType, value: zSDXLRefinerModelFieldValue, }); -export const zSDXLRefinerModelFieldOutputInstance = zFieldOutputInstanceBase.extend({ +const zSDXLRefinerModelFieldOutputInstance = zFieldOutputInstanceBase.extend({ type: zSDXLRefinerModelFieldType, }); -export const zSDXLRefinerModelFieldInputTemplate = zFieldInputTemplateBase.extend({ - type: zSDXLRefinerModelFieldType, - default: zSDXLRefinerModelFieldValue, -}); -export const zSDXLRefinerModelFieldOutputTemplate = zFieldOutputTemplateBase.extend({ - type: zSDXLRefinerModelFieldType, -}); -export type SDXLRefinerModelFieldType = z.infer; -export type SDXLRefinerModelFieldValue = z.infer; -export type SDXLRefinerModelFieldInputInstance = z.infer; -export type SDXLRefinerModelFieldOutputInstance = z.infer; -export type SDXLRefinerModelFieldInputTemplate = z.infer; -export type SDXLRefinerModelFieldOutputTemplate = z.infer; -export const isSDXLRefinerModelFieldInputInstance = (val: unknown): val is SDXLRefinerModelFieldInputInstance => - zSDXLRefinerModelFieldInputInstance.safeParse(val).success; -export const isSDXLRefinerModelFieldInputTemplate = (val: unknown): val is SDXLRefinerModelFieldInputTemplate => - zSDXLRefinerModelFieldInputTemplate.safeParse(val).success; // #endregion // #region VAEModelField -export const zVAEModelFieldType = zFieldTypeBase.extend({ +const zVAEModelFieldType = zFieldTypeBase.extend({ name: z.literal('VAEModelField'), }); -export const zVAEModelFieldValue = zVAEModelField.optional(); -export const zVAEModelFieldInputInstance = zFieldInputInstanceBase.extend({ +const zVAEModelFieldValue = zVAEModelField.optional(); +const zVAEModelFieldInputInstance = zFieldInputInstanceBase.extend({ type: zVAEModelFieldType, value: zVAEModelFieldValue, }); -export const zVAEModelFieldOutputInstance = zFieldOutputInstanceBase.extend({ +const zVAEModelFieldOutputInstance = zFieldOutputInstanceBase.extend({ type: zVAEModelFieldType, }); -export const zVAEModelFieldInputTemplate = zFieldInputTemplateBase.extend({ - type: zVAEModelFieldType, - default: zVAEModelFieldValue, -}); -export const zVAEModelFieldOutputTemplate = zFieldOutputTemplateBase.extend({ - type: zVAEModelFieldType, -}); -export type VAEModelFieldType = z.infer; -export type VAEModelFieldValue = z.infer; -export type VAEModelFieldInputInstance = z.infer; -export type VAEModelFieldOutputInstance = z.infer; -export type VAEModelFieldInputTemplate = z.infer; -export type VAEModelFieldOutputTemplate = z.infer; -export const isVAEModelFieldInputInstance = (val: unknown): val is VAEModelFieldInputInstance => - zVAEModelFieldInputInstance.safeParse(val).success; -export const isVAEModelFieldInputTemplate = (val: unknown): val is VAEModelFieldInputTemplate => - zVAEModelFieldInputTemplate.safeParse(val).success; // #endregion // #region LoRAModelField -export const zLoRAModelFieldType = zFieldTypeBase.extend({ +const zLoRAModelFieldType = zFieldTypeBase.extend({ name: z.literal('LoRAModelField'), }); -export const zLoRAModelFieldValue = zLoRAModelField.optional(); -export const zLoRAModelFieldInputInstance = zFieldInputInstanceBase.extend({ +const zLoRAModelFieldValue = zLoRAModelField.optional(); +const zLoRAModelFieldInputInstance = zFieldInputInstanceBase.extend({ type: zLoRAModelFieldType, value: zLoRAModelFieldValue, }); -export const zLoRAModelFieldOutputInstance = zFieldOutputInstanceBase.extend({ +const zLoRAModelFieldOutputInstance = zFieldOutputInstanceBase.extend({ type: zLoRAModelFieldType, }); -export const zLoRAModelFieldInputTemplate = zFieldInputTemplateBase.extend({ - type: zLoRAModelFieldType, - default: zLoRAModelFieldValue, -}); -export const zLoRAModelFieldOutputTemplate = zFieldOutputTemplateBase.extend({ - type: zLoRAModelFieldType, -}); -export type LoRAModelFieldType = z.infer; -export type LoRAModelFieldValue = z.infer; -export type LoRAModelFieldInputInstance = z.infer; -export type LoRAModelFieldOutputInstance = z.infer; -export type LoRAModelFieldInputTemplate = z.infer; -export type LoRAModelFieldOutputTemplate = z.infer; -export const isLoRAModelFieldInputInstance = (val: unknown): val is LoRAModelFieldInputInstance => - zLoRAModelFieldInputInstance.safeParse(val).success; -export const isLoRAModelFieldInputTemplate = (val: unknown): val is LoRAModelFieldInputTemplate => - zLoRAModelFieldInputTemplate.safeParse(val).success; // #endregion // #region ControlNetModelField -export const zControlNetModelFieldType = zFieldTypeBase.extend({ +const zControlNetModelFieldType = zFieldTypeBase.extend({ name: z.literal('ControlNetModelField'), }); -export const zControlNetModelFieldValue = zControlNetModelField.optional(); -export const zControlNetModelFieldInputInstance = zFieldInputInstanceBase.extend({ +const zControlNetModelFieldValue = zControlNetModelField.optional(); +const zControlNetModelFieldInputInstance = zFieldInputInstanceBase.extend({ type: zControlNetModelFieldType, value: zControlNetModelFieldValue, }); -export const zControlNetModelFieldOutputInstance = zFieldOutputInstanceBase.extend({ +const zControlNetModelFieldOutputInstance = zFieldOutputInstanceBase.extend({ type: zControlNetModelFieldType, }); -export const zControlNetModelFieldInputTemplate = zFieldInputTemplateBase.extend({ - type: zControlNetModelFieldType, - default: zControlNetModelFieldValue, -}); -export const zControlNetModelFieldOutputTemplate = zFieldOutputTemplateBase.extend({ - type: zControlNetModelFieldType, -}); -export type ControlNetModelFieldType = z.infer; -export type ControlNetModelFieldValue = z.infer; -export type ControlNetModelFieldInputInstance = z.infer; -export type ControlNetModelFieldOutputInstance = z.infer; -export type ControlNetModelFieldInputTemplate = z.infer; -export type ControlNetModelFieldOutputTemplate = z.infer; -export const isControlNetModelFieldInputInstance = (val: unknown): val is ControlNetModelFieldInputInstance => - zControlNetModelFieldInputInstance.safeParse(val).success; -export const isControlNetModelFieldInputTemplate = (val: unknown): val is ControlNetModelFieldInputTemplate => - zControlNetModelFieldInputTemplate.safeParse(val).success; -export const isControlNetModelFieldValue = (v: unknown): v is ControlNetModelFieldValue => - zControlNetModelFieldValue.safeParse(v).success; // #endregion // #region IPAdapterModelField -export const zIPAdapterModelFieldType = zFieldTypeBase.extend({ +const zIPAdapterModelFieldType = zFieldTypeBase.extend({ name: z.literal('IPAdapterModelField'), }); -export const zIPAdapterModelFieldValue = zIPAdapterModelField.optional(); -export const zIPAdapterModelFieldInputInstance = zFieldInputInstanceBase.extend({ +const zIPAdapterModelFieldValue = zIPAdapterModelField.optional(); +const zIPAdapterModelFieldInputInstance = zFieldInputInstanceBase.extend({ type: zIPAdapterModelFieldType, value: zIPAdapterModelFieldValue, }); -export const zIPAdapterModelFieldOutputInstance = zFieldOutputInstanceBase.extend({ +const zIPAdapterModelFieldOutputInstance = zFieldOutputInstanceBase.extend({ type: zIPAdapterModelFieldType, }); -export const zIPAdapterModelFieldInputTemplate = zFieldInputTemplateBase.extend({ - type: zIPAdapterModelFieldType, - default: zIPAdapterModelFieldValue, -}); -export const zIPAdapterModelFieldOutputTemplate = zFieldOutputTemplateBase.extend({ - type: zIPAdapterModelFieldType, -}); -export type IPAdapterModelFieldType = z.infer; -export type IPAdapterModelFieldValue = z.infer; -export type IPAdapterModelFieldInputInstance = z.infer; -export type IPAdapterModelFieldOutputInstance = z.infer; -export type IPAdapterModelFieldInputTemplate = z.infer; -export type IPAdapterModelFieldOutputTemplate = z.infer; -export const isIPAdapterModelFieldInputInstance = (val: unknown): val is IPAdapterModelFieldInputInstance => - zIPAdapterModelFieldInputInstance.safeParse(val).success; -export const isIPAdapterModelFieldInputTemplate = (val: unknown): val is IPAdapterModelFieldInputTemplate => - zIPAdapterModelFieldInputTemplate.safeParse(val).success; -export const isIPAdapterModelFieldValue = (val: unknown): val is IPAdapterModelFieldValue => - zIPAdapterModelFieldValue.safeParse(val).success; // #endregion // #region T2IAdapterField -export const zT2IAdapterModelFieldType = zFieldTypeBase.extend({ +const zT2IAdapterModelFieldType = zFieldTypeBase.extend({ name: z.literal('T2IAdapterModelField'), }); -export const zT2IAdapterModelFieldValue = zT2IAdapterModelField.optional(); -export const zT2IAdapterModelFieldInputInstance = zFieldInputInstanceBase.extend({ +const zT2IAdapterModelFieldValue = zT2IAdapterModelField.optional(); +const zT2IAdapterModelFieldInputInstance = zFieldInputInstanceBase.extend({ type: zT2IAdapterModelFieldType, value: zT2IAdapterModelFieldValue, }); -export const zT2IAdapterModelFieldOutputInstance = zFieldOutputInstanceBase.extend({ +const zT2IAdapterModelFieldOutputInstance = zFieldOutputInstanceBase.extend({ type: zT2IAdapterModelFieldType, }); -export const zT2IAdapterModelFieldInputTemplate = zFieldInputTemplateBase.extend({ - type: zT2IAdapterModelFieldType, - default: zT2IAdapterModelFieldValue, -}); -export const zT2IAdapterModelFieldOutputTemplate = zFieldOutputTemplateBase.extend({ - type: zT2IAdapterModelFieldType, -}); -export type T2IAdapterModelFieldType = z.infer; -export type T2IAdapterModelFieldValue = z.infer; -export type T2IAdapterModelFieldInputInstance = z.infer; -export type T2IAdapterModelFieldOutputInstance = z.infer; -export type T2IAdapterModelFieldInputTemplate = z.infer; -export type T2IAdapterModelFieldOutputTemplate = z.infer; -export const isT2IAdapterModelFieldInputInstance = (val: unknown): val is T2IAdapterModelFieldInputInstance => - zT2IAdapterModelFieldInputInstance.safeParse(val).success; -export const isT2IAdapterModelFieldInputTemplate = (val: unknown): val is T2IAdapterModelFieldInputTemplate => - zT2IAdapterModelFieldInputTemplate.safeParse(val).success; // #endregion // #region SchedulerField -export const zSchedulerFieldType = zFieldTypeBase.extend({ +const zSchedulerFieldType = zFieldTypeBase.extend({ name: z.literal('SchedulerField'), }); -export const zSchedulerFieldValue = zSchedulerField.optional(); -export const zSchedulerFieldInputInstance = zFieldInputInstanceBase.extend({ +const zSchedulerFieldValue = zSchedulerField.optional(); +const zSchedulerFieldInputInstance = zFieldInputInstanceBase.extend({ type: zSchedulerFieldType, value: zSchedulerFieldValue, }); -export const zSchedulerFieldOutputInstance = zFieldOutputInstanceBase.extend({ +const zSchedulerFieldOutputInstance = zFieldOutputInstanceBase.extend({ type: zSchedulerFieldType, }); -export const zSchedulerFieldInputTemplate = zFieldInputTemplateBase.extend({ - type: zSchedulerFieldType, - default: zSchedulerFieldValue, -}); -export const zSchedulerFieldOutputTemplate = zFieldOutputTemplateBase.extend({ - type: zSchedulerFieldType, -}); -export type SchedulerFieldType = z.infer; -export type SchedulerFieldValue = z.infer; -export type SchedulerFieldInputInstance = z.infer; -export type SchedulerFieldOutputInstance = z.infer; -export type SchedulerFieldInputTemplate = z.infer; -export type SchedulerFieldOutputTemplate = z.infer; -export const isSchedulerFieldInputInstance = (val: unknown): val is SchedulerFieldInputInstance => - zSchedulerFieldInputInstance.safeParse(val).success; -export const isSchedulerFieldInputTemplate = (val: unknown): val is SchedulerFieldInputTemplate => - zSchedulerFieldInputTemplate.safeParse(val).success; // #endregion // #region StatelessField @@ -652,32 +313,18 @@ export const isSchedulerFieldInputTemplate = (val: unknown): val is SchedulerFie * - Reserved fields like IsIntermediate * - Any other field we don't have full-on schemas for */ -export const zStatelessFieldType = zFieldTypeBase.extend({ +const zStatelessFieldType = zFieldTypeBase.extend({ name: z.string().min(1), // stateless --> we accept the field's name as the type }); -export const zStatelessFieldValue = z.undefined().catch(undefined); // stateless --> no value, but making this z.never() introduces a lot of extra TS fanagling -export const zStatelessFieldInputInstance = zFieldInputInstanceBase.extend({ +const zStatelessFieldValue = z.undefined().catch(undefined); // stateless --> no value, but making this z.never() introduces a lot of extra TS fanagling +const zStatelessFieldInputInstance = zFieldInputInstanceBase.extend({ type: zStatelessFieldType, value: zStatelessFieldValue, }); -export const zStatelessFieldOutputInstance = zFieldOutputInstanceBase.extend({ - type: zStatelessFieldType, -}); -export const zStatelessFieldInputTemplate = zFieldInputTemplateBase.extend({ - type: zStatelessFieldType, - default: zStatelessFieldValue, - input: z.literal('connection'), // stateless --> only accepts connection inputs -}); -export const zStatelessFieldOutputTemplate = zFieldOutputTemplateBase.extend({ +const zStatelessFieldOutputInstance = zFieldOutputInstanceBase.extend({ type: zStatelessFieldType, }); -export type StatelessFieldType = z.infer; -export type StatelessFieldValue = z.infer; -export type StatelessFieldInputInstance = z.infer; -export type StatelessFieldOutputInstance = z.infer; -export type StatelessFieldInputTemplate = z.infer; -export type StatelessFieldOutputTemplate = z.infer; // #endregion /** @@ -695,66 +342,10 @@ export type StatelessFieldOutputTemplate = z.infer; -export const isStatefulFieldType = (val: unknown): val is StatefulFieldType => - zStatefulFieldType.safeParse(val).success; - -export const zFieldType = z.union([zStatefulFieldType, zStatelessFieldType]); -export type FieldType = z.infer; -export const isFieldType = (val: unknown): val is FieldType => zFieldType.safeParse(val).success; -// #endregion - -// #region StatefulFieldValue & FieldValue -export const zStatefulFieldValue = z.union([ - zIntegerFieldValue, - zFloatFieldValue, - zStringFieldValue, - zBooleanFieldValue, - zEnumFieldValue, - zImageFieldValue, - zBoardFieldValue, - zMainModelFieldValue, - zSDXLMainModelFieldValue, - zSDXLRefinerModelFieldValue, - zVAEModelFieldValue, - zLoRAModelFieldValue, - zControlNetModelFieldValue, - zIPAdapterModelFieldValue, - zT2IAdapterModelFieldValue, - zColorFieldValue, - zSchedulerFieldValue, -]); -export type StatefulFieldValue = z.infer; -export const isStatefulFieldValue = (val: unknown): val is StatefulFieldValue => - zStatefulFieldValue.safeParse(val).success; - -export const zFieldValue = z.union([zStatefulFieldValue, zStatelessFieldValue]); -export type FieldValue = z.infer; -export const isFieldValue = (val: unknown): val is FieldValue => zFieldValue.safeParse(val).success; // #endregion // #region StatefulFieldInputInstance & FieldInputInstance -export const zStatefulFieldInputInstance = z.union([ +const zStatefulFieldInputInstance = z.union([ zIntegerFieldInputInstance, zFloatFieldInputInstance, zStringFieldInputInstance, @@ -773,18 +364,12 @@ export const zStatefulFieldInputInstance = z.union([ zColorFieldInputInstance, zSchedulerFieldInputInstance, ]); -export type StatefulFieldInputInstance = z.infer; -export const isStatefulFieldInputInstance = (val: unknown): val is StatefulFieldInputInstance => - zStatefulFieldInputInstance.safeParse(val).success; export const zFieldInputInstance = z.union([zStatefulFieldInputInstance, zStatelessFieldInputInstance]); -export type FieldInputInstance = z.infer; -export const isFieldInputInstance = (val: unknown): val is FieldInputInstance => - zFieldInputInstance.safeParse(val).success; // #endregion // #region StatefulFieldOutputInstance & FieldOutputInstance -export const zStatefulFieldOutputInstance = z.union([ +const zStatefulFieldOutputInstance = z.union([ zIntegerFieldOutputInstance, zFloatFieldOutputInstance, zStringFieldOutputInstance, @@ -803,73 +388,6 @@ export const zStatefulFieldOutputInstance = z.union([ zColorFieldOutputInstance, zSchedulerFieldOutputInstance, ]); -export type StatefulFieldOutputInstance = z.infer; -export const isStatefulFieldOutputInstance = (val: unknown): val is StatefulFieldOutputInstance => - zStatefulFieldOutputInstance.safeParse(val).success; export const zFieldOutputInstance = z.union([zStatefulFieldOutputInstance, zStatelessFieldOutputInstance]); -export type FieldOutputInstance = z.infer; -export const isFieldOutputInstance = (val: unknown): val is FieldOutputInstance => - zFieldOutputInstance.safeParse(val).success; -// #endregion - -// #region StatefulFieldInputTemplate & FieldInputTemplate -export const zStatefulFieldInputTemplate = z.union([ - zIntegerFieldInputTemplate, - zFloatFieldInputTemplate, - zStringFieldInputTemplate, - zBooleanFieldInputTemplate, - zEnumFieldInputTemplate, - zImageFieldInputTemplate, - zBoardFieldInputTemplate, - zMainModelFieldInputTemplate, - zSDXLMainModelFieldInputTemplate, - zSDXLRefinerModelFieldInputTemplate, - zVAEModelFieldInputTemplate, - zLoRAModelFieldInputTemplate, - zControlNetModelFieldInputTemplate, - zIPAdapterModelFieldInputTemplate, - zT2IAdapterModelFieldInputTemplate, - zColorFieldInputTemplate, - zSchedulerFieldInputTemplate, - zStatelessFieldInputTemplate, -]); -export type StatefulFieldInputTemplate = z.infer; -export const isStatefulFieldInputTemplate = (val: unknown): val is StatefulFieldInputTemplate => - zStatefulFieldInputTemplate.safeParse(val).success; - -export const zFieldInputTemplate = z.union([zStatefulFieldInputTemplate, zStatelessFieldInputTemplate]); -export type FieldInputTemplate = z.infer; -export const isFieldInputTemplate = (val: unknown): val is FieldInputTemplate => - zFieldInputTemplate.safeParse(val).success; -// #endregion - -// #region StatefulFieldOutputTemplate & FieldOutputTemplate -export const zStatefulFieldOutputTemplate = z.union([ - zIntegerFieldOutputTemplate, - zFloatFieldOutputTemplate, - zStringFieldOutputTemplate, - zBooleanFieldOutputTemplate, - zEnumFieldOutputTemplate, - zImageFieldOutputTemplate, - zBoardFieldOutputTemplate, - zMainModelFieldOutputTemplate, - zSDXLMainModelFieldOutputTemplate, - zSDXLRefinerModelFieldOutputTemplate, - zVAEModelFieldOutputTemplate, - zLoRAModelFieldOutputTemplate, - zControlNetModelFieldOutputTemplate, - zIPAdapterModelFieldOutputTemplate, - zT2IAdapterModelFieldOutputTemplate, - zColorFieldOutputTemplate, - zSchedulerFieldOutputTemplate, -]); -export type StatefulFieldOutputTemplate = z.infer; -export const isStatefulFieldOutputTemplate = (val: unknown): val is StatefulFieldOutputTemplate => - zStatefulFieldOutputTemplate.safeParse(val).success; - -export const zFieldOutputTemplate = z.union([zStatefulFieldOutputTemplate, zStatelessFieldOutputTemplate]); -export type FieldOutputTemplate = z.infer; -export const isFieldOutputTemplate = (val: unknown): val is FieldOutputTemplate => - zFieldOutputTemplate.safeParse(val).success; // #endregion diff --git a/invokeai/frontend/web/src/features/nodes/types/v2/invocation.ts b/invokeai/frontend/web/src/features/nodes/types/v2/invocation.ts index 86ec70fd9b..f2783e7458 100644 --- a/invokeai/frontend/web/src/features/nodes/types/v2/invocation.ts +++ b/invokeai/frontend/web/src/features/nodes/types/v2/invocation.ts @@ -1,27 +1,8 @@ -import type { Edge, Node } from 'reactflow'; import { z } from 'zod'; -import { zClassification, zProgressImage } from './common'; -import { zFieldInputInstance, zFieldInputTemplate, zFieldOutputInstance, zFieldOutputTemplate } from './field'; +import { zFieldInputInstance, zFieldOutputInstance } from './field'; import { zSemVer } from './semver'; -// #region InvocationTemplate -export const zInvocationTemplate = z.object({ - type: z.string(), - title: z.string(), - description: z.string(), - tags: z.array(z.string().min(1)), - inputs: z.record(zFieldInputTemplate), - outputs: z.record(zFieldOutputTemplate), - outputType: z.string().min(1), - version: zSemVer, - useCache: z.boolean(), - nodePack: z.string().min(1).nullish(), - classification: zClassification, -}); -export type InvocationTemplate = z.infer; -// #endregion - // #region NodeData export const zInvocationNodeData = z.object({ id: z.string().trim().min(1), @@ -44,50 +25,4 @@ export const zNotesNodeData = z.object({ isOpen: z.boolean(), notes: z.string(), }); -export const zCurrentImageNodeData = z.object({ - id: z.string().trim().min(1), - type: z.literal('current_image'), - label: z.string(), - isOpen: z.boolean(), -}); -export const zAnyNodeData = z.union([zInvocationNodeData, zNotesNodeData, zCurrentImageNodeData]); - -export type NotesNodeData = z.infer; -export type InvocationNodeData = z.infer; -export type CurrentImageNodeData = z.infer; -export type AnyNodeData = z.infer; - -export type InvocationNode = Node; -export type NotesNode = Node; -export type CurrentImageNode = Node; -export type AnyNode = Node; - -export const isInvocationNode = (node?: AnyNode): node is InvocationNode => Boolean(node && node.type === 'invocation'); -export const isNotesNode = (node?: AnyNode): node is NotesNode => Boolean(node && node.type === 'notes'); -export const isCurrentImageNode = (node?: AnyNode): node is CurrentImageNode => - Boolean(node && node.type === 'current_image'); -export const isInvocationNodeData = (node?: AnyNodeData): node is InvocationNodeData => - Boolean(node && !['notes', 'current_image'].includes(node.type)); // node.type may be 'notes', 'current_image', or any invocation type -// #endregion - -// #region NodeExecutionState -export const zNodeStatus = z.enum(['PENDING', 'IN_PROGRESS', 'COMPLETED', 'FAILED']); -export const zNodeExecutionState = z.object({ - nodeId: z.string().trim().min(1), - status: zNodeStatus, - progress: z.number().nullable(), - progressImage: zProgressImage.nullable(), - error: z.string().nullable(), - outputs: z.array(z.any()), -}); -export type NodeExecutionState = z.infer; -export type NodeStatus = z.infer; -// #endregion - -// #region Edges -export const zInvocationNodeEdgeExtra = z.object({ - type: z.union([z.literal('default'), z.literal('collapsed')]), -}); -export type InvocationNodeEdgeExtra = z.infer; -export type InvocationNodeEdge = Edge; // #endregion diff --git a/invokeai/frontend/web/src/features/nodes/types/v2/semver.ts b/invokeai/frontend/web/src/features/nodes/types/v2/semver.ts index 3ba330eac4..1b76577938 100644 --- a/invokeai/frontend/web/src/features/nodes/types/v2/semver.ts +++ b/invokeai/frontend/web/src/features/nodes/types/v2/semver.ts @@ -10,12 +10,3 @@ export const zSemVer = z.string().refine((val) => { zVersionInt.safeParse(major).success && zVersionInt.safeParse(minor).success && zVersionInt.safeParse(patch).success ); }); - -export const zParsedSemver = zSemVer.transform((val) => { - const [major, minor, patch] = val.split('.'); - return { - major: Number(major), - minor: Number(minor), - patch: Number(patch), - }; -}); diff --git a/invokeai/frontend/web/src/features/nodes/types/v2/workflow.ts b/invokeai/frontend/web/src/features/nodes/types/v2/workflow.ts index 723a354013..511a28cdc3 100644 --- a/invokeai/frontend/web/src/features/nodes/types/v2/workflow.ts +++ b/invokeai/frontend/web/src/features/nodes/types/v2/workflow.ts @@ -4,23 +4,20 @@ import { zFieldIdentifier } from './field'; import { zInvocationNodeData, zNotesNodeData } from './invocation'; // #region Workflow misc -export const zXYPosition = z +const zXYPosition = z .object({ x: z.number(), y: z.number(), }) .default({ x: 0, y: 0 }); -export type XYPosition = z.infer; -export const zDimension = z.number().gt(0).nullish(); -export type Dimension = z.infer; +const zDimension = z.number().gt(0).nullish(); -export const zWorkflowCategory = z.enum(['user', 'default', 'project']); -export type WorkflowCategory = z.infer; +const zWorkflowCategory = z.enum(['user', 'default', 'project']); // #endregion // #region Workflow Nodes -export const zWorkflowInvocationNode = z.object({ +const zWorkflowInvocationNode = z.object({ id: z.string().trim().min(1), type: z.literal('invocation'), data: zInvocationNodeData, @@ -28,7 +25,7 @@ export const zWorkflowInvocationNode = z.object({ height: zDimension, position: zXYPosition, }); -export const zWorkflowNotesNode = z.object({ +const zWorkflowNotesNode = z.object({ id: z.string().trim().min(1), type: z.literal('notes'), data: zNotesNodeData, @@ -36,35 +33,24 @@ export const zWorkflowNotesNode = z.object({ height: zDimension, position: zXYPosition, }); -export const zWorkflowNode = z.union([zWorkflowInvocationNode, zWorkflowNotesNode]); - -export type WorkflowInvocationNode = z.infer; -export type WorkflowNotesNode = z.infer; -export type WorkflowNode = z.infer; - -export const isWorkflowInvocationNode = (val: unknown): val is WorkflowInvocationNode => - zWorkflowInvocationNode.safeParse(val).success; +const zWorkflowNode = z.union([zWorkflowInvocationNode, zWorkflowNotesNode]); // #endregion // #region Workflow Edges -export const zWorkflowEdgeBase = z.object({ +const zWorkflowEdgeBase = z.object({ id: z.string().trim().min(1), source: z.string().trim().min(1), target: z.string().trim().min(1), }); -export const zWorkflowEdgeDefault = zWorkflowEdgeBase.extend({ +const zWorkflowEdgeDefault = zWorkflowEdgeBase.extend({ type: z.literal('default'), sourceHandle: z.string().trim().min(1), targetHandle: z.string().trim().min(1), }); -export const zWorkflowEdgeCollapsed = zWorkflowEdgeBase.extend({ +const zWorkflowEdgeCollapsed = zWorkflowEdgeBase.extend({ type: z.literal('collapsed'), }); -export const zWorkflowEdge = z.union([zWorkflowEdgeDefault, zWorkflowEdgeCollapsed]); - -export type WorkflowEdgeDefault = z.infer; -export type WorkflowEdgeCollapsed = z.infer; -export type WorkflowEdge = z.infer; +const zWorkflowEdge = z.union([zWorkflowEdgeDefault, zWorkflowEdgeCollapsed]); // #endregion // #region Workflow diff --git a/invokeai/frontend/web/src/features/nodes/types/workflow.ts b/invokeai/frontend/web/src/features/nodes/types/workflow.ts index 6bc6be8cd7..a424bf8d4b 100644 --- a/invokeai/frontend/web/src/features/nodes/types/workflow.ts +++ b/invokeai/frontend/web/src/features/nodes/types/workflow.ts @@ -12,9 +12,6 @@ const zXYPosition = z .default({ x: 0, y: 0 }); export type XYPosition = z.infer; -const zDimension = z.number().gt(0).nullish(); -export type Dimension = z.infer; - const zWorkflowCategory = z.enum(['user', 'default', 'project']); export type WorkflowCategory = z.infer; // #endregion @@ -34,9 +31,7 @@ const zWorkflowNotesNode = z.object({ }); const zWorkflowNode = z.union([zWorkflowInvocationNode, zWorkflowNotesNode]); -export type WorkflowInvocationNode = z.infer; -export type WorkflowNotesNode = z.infer; -export type WorkflowNode = z.infer; +type WorkflowInvocationNode = z.infer; export const isWorkflowInvocationNode = (val: unknown): val is WorkflowInvocationNode => zWorkflowInvocationNode.safeParse(val).success; @@ -57,10 +52,6 @@ const zWorkflowEdgeCollapsed = zWorkflowEdgeBase.extend({ type: z.literal('collapsed'), }); const zWorkflowEdge = z.union([zWorkflowEdgeDefault, zWorkflowEdgeCollapsed]); - -export type WorkflowEdgeDefault = z.infer; -export type WorkflowEdgeCollapsed = z.infer; -export type WorkflowEdge = z.infer; // #endregion // #region Workflow diff --git a/invokeai/frontend/web/src/features/nodes/util/workflow/buildWorkflow.ts b/invokeai/frontend/web/src/features/nodes/util/workflow/buildWorkflow.ts index 720da16464..c242eba1f4 100644 --- a/invokeai/frontend/web/src/features/nodes/util/workflow/buildWorkflow.ts +++ b/invokeai/frontend/web/src/features/nodes/util/workflow/buildWorkflow.ts @@ -27,7 +27,7 @@ const workflowKeys = [ 'id', ] satisfies (keyof WorkflowV3)[]; -export type BuildWorkflowFunction = (arg: BuildWorkflowArg) => WorkflowV3; +type BuildWorkflowFunction = (arg: BuildWorkflowArg) => WorkflowV3; export const buildWorkflowFast: BuildWorkflowFunction = ({ nodes, edges, workflow }: BuildWorkflowArg): WorkflowV3 => { const clonedWorkflow = pick(cloneDeep(workflow), workflowKeys); diff --git a/invokeai/frontend/web/src/features/parameters/components/ImageSize/AspectRatioPreview.tsx b/invokeai/frontend/web/src/features/parameters/components/ImageSize/AspectRatioPreview.tsx index 950422aa65..e662acae7d 100644 --- a/invokeai/frontend/web/src/features/parameters/components/ImageSize/AspectRatioPreview.tsx +++ b/invokeai/frontend/web/src/features/parameters/components/ImageSize/AspectRatioPreview.tsx @@ -15,11 +15,6 @@ import { MOTION_ICON_INITIAL, } from './constants'; -export type AspectRatioPreviewProps = { - width: number; - height: number; -}; - export const AspectRatioPreview = () => { const ctx = useImageSizeContext(); const containerRef = useRef(null); diff --git a/invokeai/frontend/web/src/features/parameters/store/postprocessingSlice.ts b/invokeai/frontend/web/src/features/parameters/store/postprocessingSlice.ts index 65a30ab4d0..c15bf982b8 100644 --- a/invokeai/frontend/web/src/features/parameters/store/postprocessingSlice.ts +++ b/invokeai/frontend/web/src/features/parameters/store/postprocessingSlice.ts @@ -9,11 +9,11 @@ const zParamESRGANModelName = z.enum([ 'ESRGAN_SRx4_DF2KOST_official-ff704c30.pth', 'RealESRGAN_x2plus.pth', ]); -export type ParamESRGANModelName = z.infer; +type ParamESRGANModelName = z.infer; export const isParamESRGANModelName = (v: unknown): v is ParamESRGANModelName => zParamESRGANModelName.safeParse(v).success; -export interface PostprocessingState { +interface PostprocessingState { _version: 1; esrganModelName: ParamESRGANModelName; } diff --git a/invokeai/frontend/web/src/features/parameters/types/parameterSchemas.ts b/invokeai/frontend/web/src/features/parameters/types/parameterSchemas.ts index e2cc277d6a..2476634c26 100644 --- a/invokeai/frontend/web/src/features/parameters/types/parameterSchemas.ts +++ b/invokeai/frontend/web/src/features/parameters/types/parameterSchemas.ts @@ -91,11 +91,6 @@ export type ParameterHeight = z.infer; export const isParameterHeight = (val: unknown): val is ParameterHeight => zParameterHeight.safeParse(val).success; // #endregion -// #region Aspect Ratio -const zParameterAspectRatio = z.number().int().min(0).max(6); -export type ParameterAspectRatio = z.infer; -// #endregion - // #region Model export const zParameterModel = zModelIdentifierWithBase; export type ParameterModel = z.infer; @@ -198,6 +193,6 @@ export const isParameterCanvasCoherenceMode = (val: unknown): val is ParameterCa // #region LoRA weight const zLoRAWeight = z.number(); -export type ParameterLoRAWeight = z.infer; +type ParameterLoRAWeight = z.infer; export const isParameterLoRAWeight = (val: unknown): val is ParameterLoRAWeight => zLoRAWeight.safeParse(val).success; // #endregion diff --git a/invokeai/frontend/web/src/features/queue/store/queueSlice.ts b/invokeai/frontend/web/src/features/queue/store/queueSlice.ts index a5750712c3..38c1cf5349 100644 --- a/invokeai/frontend/web/src/features/queue/store/queueSlice.ts +++ b/invokeai/frontend/web/src/features/queue/store/queueSlice.ts @@ -1,7 +1,7 @@ import type { PayloadAction } from '@reduxjs/toolkit'; import { createSlice } from '@reduxjs/toolkit'; -export interface QueueState { +interface QueueState { listCursor: number | undefined; listPriority: number | undefined; selectedQueueItem: string | undefined; diff --git a/invokeai/frontend/web/src/features/system/components/HotkeysModal/useHotkeyData.ts b/invokeai/frontend/web/src/features/system/components/HotkeysModal/useHotkeyData.ts index f3f5056eae..f9a0df52e4 100644 --- a/invokeai/frontend/web/src/features/system/components/HotkeysModal/useHotkeyData.ts +++ b/invokeai/frontend/web/src/features/system/components/HotkeysModal/useHotkeyData.ts @@ -1,7 +1,7 @@ import { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; -export type HotkeyListItem = { +type HotkeyListItem = { title: string; desc: string; hotkeys: string[][]; diff --git a/invokeai/frontend/web/src/features/system/components/SettingsModal/useClearIntermediates.ts b/invokeai/frontend/web/src/features/system/components/SettingsModal/useClearIntermediates.ts index 96d3b0f7ee..e9f1debcf8 100644 --- a/invokeai/frontend/web/src/features/system/components/SettingsModal/useClearIntermediates.ts +++ b/invokeai/frontend/web/src/features/system/components/SettingsModal/useClearIntermediates.ts @@ -7,7 +7,7 @@ import { useTranslation } from 'react-i18next'; import { useClearIntermediatesMutation, useGetIntermediatesCountQuery } from 'services/api/endpoints/images'; import { useGetQueueStatusQuery } from 'services/api/endpoints/queue'; -export type UseClearIntermediatesReturn = { +type UseClearIntermediatesReturn = { intermediatesCount: number | undefined; clearIntermediates: () => void; isLoading: boolean; diff --git a/invokeai/frontend/web/src/features/system/components/StickyScrollable.tsx b/invokeai/frontend/web/src/features/system/components/StickyScrollable.tsx index 9359731d5b..012e6dcd6e 100644 --- a/invokeai/frontend/web/src/features/system/components/StickyScrollable.tsx +++ b/invokeai/frontend/web/src/features/system/components/StickyScrollable.tsx @@ -28,7 +28,7 @@ const StickyScrollableContent = memo((props: StickyScrollableContentProps) => { StickyScrollableContent.displayName = 'StickyScrollableContent'; -export type StickyScrollableProps = PropsWithChildren<{ +type StickyScrollableProps = PropsWithChildren<{ title: string; }>; diff --git a/invokeai/frontend/web/src/features/system/store/types.ts b/invokeai/frontend/web/src/features/system/store/types.ts index c8790e0104..430df9aa7d 100644 --- a/invokeai/frontend/web/src/features/system/store/types.ts +++ b/invokeai/frontend/web/src/features/system/store/types.ts @@ -3,9 +3,9 @@ import type { LogLevel } from 'app/logging/logger'; import type { ProgressImage } from 'services/events/types'; import { z } from 'zod'; -export type SystemStatus = 'CONNECTED' | 'DISCONNECTED' | 'PROCESSING' | 'ERROR' | 'LOADING_MODEL'; +type SystemStatus = 'CONNECTED' | 'DISCONNECTED' | 'PROCESSING' | 'ERROR' | 'LOADING_MODEL'; -export type DenoiseProgress = { +type DenoiseProgress = { session_id: string; batch_id: string; progress_image: ProgressImage | null | undefined; diff --git a/invokeai/frontend/web/src/features/ui/components/InvokeTabs.tsx b/invokeai/frontend/web/src/features/ui/components/InvokeTabs.tsx index c6682e33fc..cb49696dbf 100644 --- a/invokeai/frontend/web/src/features/ui/components/InvokeTabs.tsx +++ b/invokeai/frontend/web/src/features/ui/components/InvokeTabs.tsx @@ -35,7 +35,7 @@ import ResizeHandle from './tabs/ResizeHandle'; import TextToImageTab from './tabs/TextToImageTab'; import UnifiedCanvasTab from './tabs/UnifiedCanvasTab'; -export interface InvokeTabInfo { +interface InvokeTabInfo { id: InvokeTabName; translationKey: string; icon: ReactElement; diff --git a/invokeai/frontend/web/src/services/api/endpoints/models.ts b/invokeai/frontend/web/src/services/api/endpoints/models.ts index e7e63eeecc..04c65b59f6 100644 --- a/invokeai/frontend/web/src/services/api/endpoints/models.ts +++ b/invokeai/frontend/web/src/services/api/endpoints/models.ts @@ -64,7 +64,7 @@ export type ScanFolderResponse = paths['/api/v2/models/scan_folder']['get']['responses']['200']['content']['application/json']; type ScanFolderArg = operations['scan_for_models']['parameters']['query']; -export type GetByAttrsArg = operations['get_model_records_by_attrs']['parameters']['query']; +type GetByAttrsArg = operations['get_model_records_by_attrs']['parameters']['query']; const mainModelsAdapter = createEntityAdapter({ selectId: (entity) => entity.key, diff --git a/invokeai/frontend/web/src/services/api/schema.ts b/invokeai/frontend/web/src/services/api/schema.ts index 0dbe908979..de3761b946 100644 --- a/invokeai/frontend/web/src/services/api/schema.ts +++ b/invokeai/frontend/web/src/services/api/schema.ts @@ -572,7 +572,7 @@ export type paths = { }; }; -export type webhooks = Record; +type webhooks = Record; export type components = { schemas: { @@ -10929,9 +10929,9 @@ export type components = { pathItems: never; }; -export type $defs = Record; +type $defs = Record; -export type external = Record; +type external = Record; export type operations = { diff --git a/invokeai/frontend/web/src/services/api/types.ts b/invokeai/frontend/web/src/services/api/types.ts index c57d242f97..e28c8bdae6 100644 --- a/invokeai/frontend/web/src/services/api/types.ts +++ b/invokeai/frontend/web/src/services/api/types.ts @@ -12,8 +12,6 @@ export type ListImagesArgs = NonNullable; - export type UpdateBoardArg = paths['/api/v1/boards/{board_id}']['patch']['parameters']['path'] & { changes: paths['/api/v1/boards/{board_id}']['patch']['requestBody']['content']['application/json']; }; @@ -21,8 +19,6 @@ export type UpdateBoardArg = paths['/api/v1/boards/{board_id}']['patch']['parame export type BatchConfig = paths['/api/v1/queue/{queue_id}/enqueue_batch']['post']['requestBody']['content']['application/json']; -export type EnqueueBatchResult = components['schemas']['EnqueueBatchResult']; - export type InputFieldJSONSchemaExtra = S['InputFieldJSONSchemaExtra']; export type OutputFieldJSONSchemaExtra = S['OutputFieldJSONSchemaExtra']; export type InvocationJSONSchemaExtra = S['UIConfigBase']; @@ -35,26 +31,14 @@ export type AppDependencyVersions = S['AppDependencyVersions']; // Images export type ImageDTO = S['ImageDTO']; export type BoardDTO = S['BoardDTO']; -export type BoardChanges = S['BoardChanges']; -export type ImageChanges = S['ImageRecordChanges']; export type ImageCategory = S['ImageCategory']; -export type ResourceOrigin = S['ResourceOrigin']; -export type ImageField = S['ImageField']; -export type OffsetPaginatedResults_BoardDTO_ = S['OffsetPaginatedResults_BoardDTO_']; export type OffsetPaginatedResults_ImageDTO_ = S['OffsetPaginatedResults_ImageDTO_']; // Models export type ModelType = S['ModelType']; export type SubModelType = S['SubModelType']; export type BaseModelType = S['BaseModelType']; -export type MainModelField = S['MainModelField']; -export type VAEModelField = S['VAEModelField']; -export type LoRAModelField = S['LoRAModelField']; -export type ControlNetModelField = S['ControlNetModelField']; -export type IPAdapterModelField = S['IPAdapterModelField']; -export type T2IAdapterModelField = S['T2IAdapterModelField']; export type ControlField = S['ControlField']; -export type IPAdapterField = S['IPAdapterField']; // Model Configs @@ -113,7 +97,6 @@ export type ModelInstallJob = S['ModelInstallJob']; export type ModelInstallStatus = S['InstallStatus']; export type HFModelSource = S['HFModelSource']; -export type CivitaiModelSource = S['CivitaiModelSource']; export type LocalModelSource = S['LocalModelSource']; export type URLModelSource = S['URLModelSource']; @@ -124,50 +107,31 @@ export type Edge = S['Edge']; export type GraphExecutionState = S['GraphExecutionState']; export type Batch = S['Batch']; export type SessionQueueItemDTO = S['SessionQueueItemDTO']; -export type SessionQueueItem = S['SessionQueueItem']; export type WorkflowRecordOrderBy = S['WorkflowRecordOrderBy']; export type SQLiteDirection = S['SQLiteDirection']; -export type WorkflowDTO = S['WorkflowRecordDTO']; export type WorkflowRecordListItemDTO = S['WorkflowRecordListItemDTO']; // General nodes export type CollectInvocation = S['CollectInvocation']; -export type IterateInvocation = S['IterateInvocation']; -export type RangeInvocation = S['RangeInvocation']; -export type RandomRangeInvocation = S['RandomRangeInvocation']; -export type RangeOfSizeInvocation = S['RangeOfSizeInvocation']; export type ImageResizeInvocation = S['ImageResizeInvocation']; -export type ImageBlurInvocation = S['ImageBlurInvocation']; -export type ImageScaleInvocation = S['ImageScaleInvocation']; export type InfillPatchMatchInvocation = S['InfillPatchMatchInvocation']; export type InfillTileInvocation = S['InfillTileInvocation']; export type CreateDenoiseMaskInvocation = S['CreateDenoiseMaskInvocation']; export type CreateGradientMaskInvocation = S['CreateGradientMaskInvocation']; export type CanvasPasteBackInvocation = S['CanvasPasteBackInvocation']; -export type MaskEdgeInvocation = S['MaskEdgeInvocation']; -export type RandomIntInvocation = S['RandomIntInvocation']; -export type CompelInvocation = S['CompelInvocation']; -export type DynamicPromptInvocation = S['DynamicPromptInvocation']; export type NoiseInvocation = S['NoiseInvocation']; export type DenoiseLatentsInvocation = S['DenoiseLatentsInvocation']; export type SDXLLoraLoaderInvocation = S['SDXLLoraLoaderInvocation']; export type ImageToLatentsInvocation = S['ImageToLatentsInvocation']; export type LatentsToImageInvocation = S['LatentsToImageInvocation']; -export type ImageCollectionInvocation = S['ImageCollectionInvocation']; -export type MainModelLoaderInvocation = S['MainModelLoaderInvocation']; export type LoraLoaderInvocation = S['LoraLoaderInvocation']; export type ESRGANInvocation = S['ESRGANInvocation']; -export type DivideInvocation = S['DivideInvocation']; export type ImageNSFWBlurInvocation = S['ImageNSFWBlurInvocation']; export type ImageWatermarkInvocation = S['ImageWatermarkInvocation']; export type SeamlessModeInvocation = S['SeamlessModeInvocation']; -export type MetadataInvocation = S['MetadataInvocation']; export type CoreMetadataInvocation = S['CoreMetadataInvocation']; -export type MetadataItemInvocation = S['MetadataItemInvocation']; -export type MergeMetadataInvocation = S['MergeMetadataInvocation']; export type IPAdapterMetadataField = S['IPAdapterMetadataField']; export type T2IAdapterField = S['T2IAdapterField']; -export type LoRAMetadataField = S['LoRAMetadataField']; // ControlNet Nodes export type ControlNetInvocation = S['ControlNetInvocation']; @@ -190,40 +154,34 @@ export type ZoeDepthImageProcessorInvocation = S['ZoeDepthImageProcessorInvocati // Node Outputs export type ImageOutput = S['ImageOutput']; -export type StringOutput = S['StringOutput']; -export type FloatOutput = S['FloatOutput']; -export type IntegerOutput = S['IntegerOutput']; -export type IterateInvocationOutput = S['IterateInvocationOutput']; -export type CollectInvocationOutput = S['CollectInvocationOutput']; -export type LatentsOutput = S['LatentsOutput']; // Post-image upload actions, controls workflows when images are uploaded -export type ControlAdapterAction = { +type ControlAdapterAction = { type: 'SET_CONTROL_ADAPTER_IMAGE'; id: string; }; -export type InitialImageAction = { +type InitialImageAction = { type: 'SET_INITIAL_IMAGE'; }; -export type NodesAction = { +type NodesAction = { type: 'SET_NODES_IMAGE'; nodeId: string; fieldName: string; }; -export type CanvasInitialImageAction = { +type CanvasInitialImageAction = { type: 'SET_CANVAS_INITIAL_IMAGE'; }; -export type ToastAction = { +type ToastAction = { type: 'TOAST'; toastOptions?: UseToastOptions; }; -export type AddToBatchAction = { +type AddToBatchAction = { type: 'ADD_TO_BATCH'; }; diff --git a/invokeai/frontend/web/src/services/events/types.ts b/invokeai/frontend/web/src/services/events/types.ts index ab5b0e6799..6fda5a16b1 100644 --- a/invokeai/frontend/web/src/services/events/types.ts +++ b/invokeai/frontend/web/src/services/events/types.ts @@ -14,7 +14,7 @@ export type AnyInvocation = NonNullable[string]>; export type AnyResult = NonNullable; -export type BaseNode = { +type BaseNode = { id: string; type: string; [key: string]: AnyInvocation[keyof AnyInvocation]; @@ -218,11 +218,11 @@ export type QueueItemStatusChangedEvent = { }; }; -export type ClientEmitSubscribeQueue = { +type ClientEmitSubscribeQueue = { queue_id: string; }; -export type ClientEmitUnsubscribeQueue = { +type ClientEmitUnsubscribeQueue = { queue_id: string; }; @@ -245,11 +245,11 @@ export type BulkDownloadFailedEvent = { error: string; }; -export type ClientEmitSubscribeBulkDownload = { +type ClientEmitSubscribeBulkDownload = { bulk_download_id: string; }; -export type ClientEmitUnsubscribeBulkDownload = { +type ClientEmitUnsubscribeBulkDownload = { bulk_download_id: string; };