tidy(ui): clean up unused code 5

variables, types and schemas
This commit is contained in:
psychedelicious 2024-02-27 18:13:16 +11:00
parent b661d93bd8
commit d99bec8b1a
44 changed files with 151 additions and 996 deletions

View File

@ -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'],
};

View File

@ -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",

View File

@ -19,7 +19,7 @@ declare global {
}
export const $socketOptions = map<Partial<ManagerOptions & SocketOptions>>({});
export const $isSocketInitialized = atom<boolean>(false);
const $isSocketInitialized = atom<boolean>(false);
/**
* Initializes the socket.io connection and sets up event listeners.

View File

@ -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<UseStore>(createIDBKeyValStore('invoke', 'invoke-store'));
const $idbKeyValStore = atom<UseStore>(createIDBKeyValStore('invoke', 'invoke-store'));
export const clearIdbKeyValStore = () => {
clear($idbKeyValStore.get());

View File

@ -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

View File

@ -8,7 +8,7 @@ export const $tool = atom<CanvasTool>('move');
export const $toolStash = atom<CanvasTool | null>(null);
export const $isDrawing = atom<boolean>(false);
export const $isMouseOverBoundingBox = atom<boolean>(false);
export const $isMoveBoundingBoxKeyHeld = atom<boolean>(false);
const $isMoveBoundingBoxKeyHeld = atom<boolean>(false);
export const $isMoveStageKeyHeld = atom<boolean>(false);
export const $isMovingBoundingBox = atom<boolean>(false);
export const $isMovingStage = atom<boolean>(false);

View File

@ -674,7 +674,6 @@ export const {
setShouldAutoSave,
setShouldCropToBoundingBoxOnSave,
setShouldDarkenOutsideBoundingBox,
setShouldLockBoundingBox,
setShouldPreserveMaskedArea,
setShouldShowBoundingBox,
setShouldShowCanvasDebugInfo,

View File

@ -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<{

View File

@ -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<Active, 'data'> {
data: React.MutableRefObject<TypesafeDraggableData | undefined>;
}
export interface TypesafeOver extends Omit<Over, 'data'> {
interface TypesafeOver extends Omit<Over, 'data'> {
data: React.MutableRefObject<TypesafeDroppableData | undefined>;
}
@ -127,10 +123,10 @@ interface DragEvent {
}
export interface DragStartEvent extends Pick<DragEvent, 'active'> {}
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<DndContextProps, 'onDragStart' | 'onDragMove' | 'onDragOver' | 'onDragEnd' | 'onDragCancel'> {

View File

@ -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<typeof zSeedBehaviour>;
type SeedBehaviour = z.infer<typeof zSeedBehaviour>;
export const isSeedBehaviour = (v: unknown): v is SeedBehaviour => zSeedBehaviour.safeParse(v).success;
interface DynamicPromptsState {

View File

@ -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<HTMLTextAreaElement>;
onChange: (v: string) => void;

View File

@ -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<VirtuosoGridHandle>;
rootRef?: RefObject<HTMLDivElement>;
virtuosoRangeRef?: RefObject<ListRange>;

View File

@ -105,7 +105,7 @@ const getImageFuncs = {
down: getDownImage,
};
export type UseGalleryNavigationReturn = {
type UseGalleryNavigationReturn = {
handleLeftImage: () => void;
handleRightImage: () => void;
handleUpImage: () => void;

View File

@ -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;

View File

@ -16,7 +16,7 @@ export const defaultLoRAConfig: Pick<LoRA, 'weight' | 'isEnabled'> = {
isEnabled: true,
};
export type LoraState = {
type LoraState = {
_version: 1;
loras: Record<string, LoRA>;
};

View File

@ -11,13 +11,6 @@ export type MetadataRenderValueFunc<T> = (value: T) => Promise<React.ReactNode>;
*/
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<TValue = unknown, TItem = unknown> = {
// type MetadataHandlersInferItem<TValue> = TValue extends Array<infer TItem> ? MetadataParseFunc<TItem> : never
// While this works for the types as expected, I couldn't satisfy TS in the implementations of the handlers.
export type BuildMetadataHandlersArg<TValue, TItem> = {
type BuildMetadataHandlersArg<TValue, TItem> = {
parser: MetadataParseFunc<TValue>;
itemParser?: MetadataParseFunc<TItem>;
recaller?: MetadataRecallFunc<TValue>;

View File

@ -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<AnyModelConfig> =>
* @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<AnyModelConfig> => {
const fetchModelConfigByAttrs = async (name: string, base: BaseModelType, type: ModelType): Promise<AnyModelConfig> => {
const { dispatch } = getStore();
try {
const req = dispatch(modelsApi.endpoints.getModelConfigByAttrs.initiate({ name, base, type }));

View File

@ -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

View File

@ -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';

View File

@ -45,7 +45,3 @@ export type WorkflowsState = Omit<WorkflowV3, 'nodes' | 'edges'> & {
mode: WorkflowMode;
originalExposedFieldValues: FieldIdentifierWithValue[];
};
export type NodeTemplatesState = {
templates: Record<string, InvocationTemplate>;
};

View File

@ -55,16 +55,6 @@ export type SchedulerField = z.infer<typeof zSchedulerField>;
// #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<typeof zBaseModel>;
export type ModelType = z.infer<typeof zModelType>;
export type ModelIdentifier = z.infer<typeof zModelIdentifier>;
type ModelIdentifier = z.infer<typeof zModelIdentifier>;
export type ModelIdentifierWithBase = z.infer<typeof zModelIdentifierWithBase>;
// #endregion

View File

@ -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<typeof zFieldInput>;
const zFieldUIComponent = z.enum(['none', 'textarea', 'slider']);
export type FieldUIComponent = z.infer<typeof zFieldUIComponent>;
const zFieldInputInstanceBase = z.object({
name: z.string().trim().min(1),
label: z.string().nullish(),
});
export type FieldInputInstanceBase = z.infer<typeof zFieldInputInstanceBase>;
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<typeof zFieldTemplateBase>;
export type FieldInputTemplateBase = z.infer<typeof zFieldInputTemplateBase>;
export type FieldOutputTemplateBase = z.infer<typeof zFieldOutputTemplateBase>;
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<typeof zIntegerFieldType>;
export type IntegerFieldValue = z.infer<typeof zIntegerFieldValue>;
export type IntegerFieldInputInstance = z.infer<typeof zIntegerFieldInputInstance>;
export type IntegerFieldInputTemplate = z.infer<typeof zIntegerFieldInputTemplate>;
@ -125,11 +115,9 @@ const zFloatFieldInputTemplate = zFieldInputTemplateBase.extend({
const zFloatFieldOutputTemplate = zFieldOutputTemplateBase.extend({
type: zFloatFieldType,
});
export type FloatFieldType = z.infer<typeof zFloatFieldType>;
export type FloatFieldValue = z.infer<typeof zFloatFieldValue>;
export type FloatFieldInputInstance = z.infer<typeof zFloatFieldInputInstance>;
export type FloatFieldInputTemplate = z.infer<typeof zFloatFieldInputTemplate>;
export type FloatFieldOutputTemplate = z.infer<typeof zFloatFieldOutputTemplate>;
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<typeof zStringFieldType>;
export type StringFieldValue = z.infer<typeof zStringFieldValue>;
export type StringFieldInputInstance = z.infer<typeof zStringFieldInputInstance>;
export type StringFieldInputTemplate = z.infer<typeof zStringFieldInputTemplate>;
export type StringFieldOutputTemplate = z.infer<typeof zStringFieldOutputTemplate>;
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<typeof zBooleanFieldType>;
export type BooleanFieldValue = z.infer<typeof zBooleanFieldValue>;
export type BooleanFieldInputInstance = z.infer<typeof zBooleanFieldInputInstance>;
export type BooleanFieldInputTemplate = z.infer<typeof zBooleanFieldInputTemplate>;
export type BooleanFieldOutputTemplate = z.infer<typeof zBooleanFieldOutputTemplate>;
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<typeof zEnumFieldType>;
export type EnumFieldValue = z.infer<typeof zEnumFieldValue>;
export type EnumFieldInputInstance = z.infer<typeof zEnumFieldInputInstance>;
export type EnumFieldInputTemplate = z.infer<typeof zEnumFieldInputTemplate>;
export type EnumFieldOutputTemplate = z.infer<typeof zEnumFieldOutputTemplate>;
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<typeof zImageFieldType>;
export type ImageFieldValue = z.infer<typeof zImageFieldValue>;
export type ImageFieldInputInstance = z.infer<typeof zImageFieldInputInstance>;
export type ImageFieldInputTemplate = z.infer<typeof zImageFieldInputTemplate>;
export type ImageFieldOutputTemplate = z.infer<typeof zImageFieldOutputTemplate>;
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<typeof zBoardFieldType>;
export type BoardFieldValue = z.infer<typeof zBoardFieldValue>;
export type BoardFieldInputInstance = z.infer<typeof zBoardFieldInputInstance>;
export type BoardFieldInputTemplate = z.infer<typeof zBoardFieldInputTemplate>;
export type BoardFieldOutputTemplate = z.infer<typeof zBoardFieldOutputTemplate>;
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<typeof zColorFieldType>;
export type ColorFieldValue = z.infer<typeof zColorFieldValue>;
export type ColorFieldInputInstance = z.infer<typeof zColorFieldInputInstance>;
export type ColorFieldInputTemplate = z.infer<typeof zColorFieldInputTemplate>;
export type ColorFieldOutputTemplate = z.infer<typeof zColorFieldOutputTemplate>;
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<typeof zMainModelFieldType>;
export type MainModelFieldValue = z.infer<typeof zMainModelFieldValue>;
export type MainModelFieldInputInstance = z.infer<typeof zMainModelFieldInputInstance>;
export type MainModelFieldInputTemplate = z.infer<typeof zMainModelFieldInputTemplate>;
export type MainModelFieldOutputTemplate = z.infer<typeof zMainModelFieldOutputTemplate>;
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<typeof zSDXLMainModelFieldType>;
export type SDXLMainModelFieldValue = z.infer<typeof zSDXLMainModelFieldValue>;
export type SDXLMainModelFieldInputInstance = z.infer<typeof zSDXLMainModelFieldInputInstance>;
export type SDXLMainModelFieldInputTemplate = z.infer<typeof zSDXLMainModelFieldInputTemplate>;
export type SDXLMainModelFieldOutputTemplate = z.infer<typeof zSDXLMainModelFieldOutputTemplate>;
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<typeof zSDXLRefinerModelFieldType>;
export type SDXLRefinerModelFieldValue = z.infer<typeof zSDXLRefinerModelFieldValue>;
export type SDXLRefinerModelFieldInputInstance = z.infer<typeof zSDXLRefinerModelFieldInputInstance>;
export type SDXLRefinerModelFieldInputTemplate = z.infer<typeof zSDXLRefinerModelFieldInputTemplate>;
export type SDXLRefinerModelFieldOutputTemplate = z.infer<typeof zSDXLRefinerModelFieldOutputTemplate>;
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<typeof zVAEModelFieldType>;
export type VAEModelFieldValue = z.infer<typeof zVAEModelFieldValue>;
export type VAEModelFieldInputInstance = z.infer<typeof zVAEModelFieldInputInstance>;
export type VAEModelFieldInputTemplate = z.infer<typeof zVAEModelFieldInputTemplate>;
export type VAEModelFieldOutputTemplate = z.infer<typeof zVAEModelFieldOutputTemplate>;
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<typeof zLoRAModelFieldType>;
export type LoRAModelFieldValue = z.infer<typeof zLoRAModelFieldValue>;
export type LoRAModelFieldInputInstance = z.infer<typeof zLoRAModelFieldInputInstance>;
export type LoRAModelFieldInputTemplate = z.infer<typeof zLoRAModelFieldInputTemplate>;
export type LoRAModelFieldOutputTemplate = z.infer<typeof zLoRAModelFieldOutputTemplate>;
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<typeof zControlNetModelFieldType>;
export type ControlNetModelFieldValue = z.infer<typeof zControlNetModelFieldValue>;
export type ControlNetModelFieldInputInstance = z.infer<typeof zControlNetModelFieldInputInstance>;
export type ControlNetModelFieldInputTemplate = z.infer<typeof zControlNetModelFieldInputTemplate>;
export type ControlNetModelFieldOutputTemplate = z.infer<typeof zControlNetModelFieldOutputTemplate>;
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<typeof zIPAdapterModelFieldType>;
export type IPAdapterModelFieldValue = z.infer<typeof zIPAdapterModelFieldValue>;
export type IPAdapterModelFieldInputInstance = z.infer<typeof zIPAdapterModelFieldInputInstance>;
export type IPAdapterModelFieldInputTemplate = z.infer<typeof zIPAdapterModelFieldInputTemplate>;
export type IPAdapterModelFieldOutputTemplate = z.infer<typeof zIPAdapterModelFieldOutputTemplate>;
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<typeof zT2IAdapterModelFieldType>;
export type T2IAdapterModelFieldValue = z.infer<typeof zT2IAdapterModelFieldValue>;
export type T2IAdapterModelFieldInputInstance = z.infer<typeof zT2IAdapterModelFieldInputInstance>;
export type T2IAdapterModelFieldInputTemplate = z.infer<typeof zT2IAdapterModelFieldInputTemplate>;
export type T2IAdapterModelFieldOutputTemplate = z.infer<typeof zT2IAdapterModelFieldOutputTemplate>;
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<typeof zSchedulerFieldType>;
export type SchedulerFieldValue = z.infer<typeof zSchedulerFieldValue>;
export type SchedulerFieldInputInstance = z.infer<typeof zSchedulerFieldInputInstance>;
export type SchedulerFieldInputTemplate = z.infer<typeof zSchedulerFieldInputTemplate>;
export type SchedulerFieldOutputTemplate = z.infer<typeof zSchedulerFieldOutputTemplate>;
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<typeof zStatelessFieldType>;
export type StatelessFieldValue = z.infer<typeof zStatelessFieldValue>;
export type StatelessFieldInputInstance = z.infer<typeof zStatelessFieldInputInstance>;
export type StatelessFieldInputTemplate = z.infer<typeof zStatelessFieldInputTemplate>;
export type StatelessFieldOutputTemplate = z.infer<typeof zStatelessFieldOutputTemplate>;
// #endregion
/**
@ -655,7 +608,6 @@ const zStatefulFieldInputInstance = z.union([
zColorFieldInputInstance,
zSchedulerFieldInputInstance,
]);
export type StatefulFieldInputInstance = z.infer<typeof zStatefulFieldInputInstance>;
export const zFieldInputInstance = z.union([zStatefulFieldInputInstance, zStatelessFieldInputInstance]);
export type FieldInputInstance = z.infer<typeof zFieldInputInstance>;
@ -684,7 +636,6 @@ const zStatefulFieldInputTemplate = z.union([
zSchedulerFieldInputTemplate,
zStatelessFieldInputTemplate,
]);
export type StatefulFieldInputTemplate = z.infer<typeof zFieldInputTemplate>;
export const zFieldInputTemplate = z.union([zStatefulFieldInputTemplate, zStatelessFieldInputTemplate]);
export type FieldInputTemplate = z.infer<typeof zFieldInputTemplate>;
@ -712,7 +663,6 @@ const zStatefulFieldOutputTemplate = z.union([
zColorFieldOutputTemplate,
zSchedulerFieldOutputTemplate,
]);
export type StatefulFieldOutputTemplate = z.infer<typeof zStatefulFieldOutputTemplate>;
export const zFieldOutputTemplate = z.union([zStatefulFieldOutputTemplate, zStatelessFieldOutputTemplate]);
export type FieldOutputTemplate = z.infer<typeof zFieldOutputTemplate>;

View File

@ -53,8 +53,8 @@ const zAnyNodeData = z.union([zInvocationNodeData, zNotesNodeData, zCurrentImage
export type NotesNodeData = z.infer<typeof zNotesNodeData>;
export type InvocationNodeData = z.infer<typeof zInvocationNodeData>;
export type CurrentImageNodeData = z.infer<typeof zCurrentImageNodeData>;
export type AnyNodeData = z.infer<typeof zAnyNodeData>;
type CurrentImageNodeData = z.infer<typeof zCurrentImageNodeData>;
type AnyNodeData = z.infer<typeof zAnyNodeData>;
export type InvocationNode = Node<InvocationNodeData, 'invocation'>;
export type NotesNode = Node<NotesNodeData, 'notes'>;
@ -79,13 +79,12 @@ const zNodeExecutionState = z.object({
outputs: z.array(z.any()),
});
export type NodeExecutionState = z.infer<typeof zNodeExecutionState>;
export type NodeStatus = z.infer<typeof zNodeStatus>;
// #endregion
// #region Edges
const zInvocationNodeEdgeExtra = z.object({
type: z.union([z.literal('default'), z.literal('collapsed')]),
});
export type InvocationNodeEdgeExtra = z.infer<typeof zInvocationNodeEdgeExtra>;
type InvocationNodeEdgeExtra = z.infer<typeof zInvocationNodeEdgeExtra>;
export type InvocationNodeEdge = Edge<InvocationNodeEdgeExtra>;
// #endregion

View File

@ -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<OpenAPIV3_1.BaseSchemaObject, 'title' | 'type' | 'properties'> &
type InvocationBaseSchemaObject = Omit<OpenAPIV3_1.BaseSchemaObject, 'title' | 'type' | 'properties'> &
InvocationSchemaExtra;
export type InvocationOutputSchemaObject = Omit<OpenAPIV3_1.SchemaObject, 'properties'> & {
type InvocationOutputSchemaObject = Omit<OpenAPIV3_1.SchemaObject, 'properties'> & {
properties: OpenAPIV3_1.SchemaObject['properties'] & {
type: Omit<OpenAPIV3_1.SchemaObject, 'default'> & {
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;
}

View File

@ -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<typeof zImageField>;
export const zBoardField = z.object({
board_id: z.string().trim().min(1),
});
export type BoardField = z.infer<typeof zBoardField>;
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<typeof zColorField>;
export const zClassification = z.enum(['stable', 'beta', 'prototype']);
export type Classification = z.infer<typeof zClassification>;
export const zSchedulerField = z.enum([
'euler',
@ -47,19 +41,15 @@ export const zSchedulerField = z.enum([
'kdpm_2_a',
'lcm',
]);
export type SchedulerField = z.infer<typeof zSchedulerField>;
// #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<typeof zBaseModel>;
export type ModelType = z.infer<typeof zModelType>;
export type ModelIdentifier = z.infer<typeof zModelIdentifier>;
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<typeof zMainModelField>;
export type SDXLRefinerModelField = z.infer<typeof zSDXLRefinerModelField>;
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<typeof zSubModelType>;
export const zVAEModelField = zModelIdentifier;
export const zModelInfo = zModelIdentifier.extend({
model_type: zModelType,
submodel: zSubModelType.optional(),
});
export type ModelInfo = z.infer<typeof zModelInfo>;
export const zLoRAModelField = zModelIdentifier;
export type LoRAModelField = z.infer<typeof zLoRAModelField>;
export const zControlNetModelField = zModelIdentifier;
export type ControlNetModelField = z.infer<typeof zControlNetModelField>;
export const zIPAdapterModelField = zModelIdentifier;
export type IPAdapterModelField = z.infer<typeof zIPAdapterModelField>;
export const zT2IAdapterModelField = zModelIdentifier;
export type T2IAdapterModelField = z.infer<typeof zT2IAdapterModelField>;
export const zLoraInfo = zModelInfo.extend({
weight: z.number().optional(),
});
export type LoraInfo = z.infer<typeof zLoraInfo>;
export const zUNetField = z.object({
unet: zModelInfo,
scheduler: zModelInfo,
loras: z.array(zLoraInfo),
});
export type UNetField = z.infer<typeof zUNetField>;
export const zCLIPField = z.object({
tokenizer: zModelInfo,
text_encoder: zModelInfo,
skipped_layers: z.number(),
loras: z.array(zLoraInfo),
});
export type CLIPField = z.infer<typeof zCLIPField>;
export const zVAEField = z.object({
vae: zModelInfo,
});
export type VAEField = z.infer<typeof zVAEField>;
// #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<typeof zControlField>;
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<typeof zIPAdapterField>;
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<typeof zT2IAdapterField>;
// #endregion
// #region ProgressImage
export const zProgressImage = z.object({
dataURL: z.string(),
width: z.number().int(),
height: z.number().int(),
});
export type ProgressImage = z.infer<typeof zProgressImage>;
// #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<typeof zImageOutput>;
export const isImageOutput = (output: unknown): output is ImageOutput => zImageOutput.safeParse(output).success;
// #endregion

View File

@ -40,50 +40,19 @@ import {
/** */
// #region Base schemas & misc
export const zFieldInput = z.enum(['connection', 'direct', 'any']);
export type FieldInput = z.infer<typeof zFieldInput>;
export const zFieldUIComponent = z.enum(['none', 'textarea', 'slider']);
export type FieldUIComponent = z.infer<typeof zFieldUIComponent>;
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<typeof zFieldInstanceBase>;
export type FieldInputInstanceBase = z.infer<typeof zFieldInputInstanceBase>;
export type FieldOutputInstanceBase = z.infer<typeof zFieldOutputInstanceBase>;
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<typeof zFieldTemplateBase>;
export type FieldInputTemplateBase = z.infer<typeof zFieldInputTemplateBase>;
export type FieldOutputTemplateBase = z.infer<typeof zFieldOutputTemplateBase>;
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<typeof zFieldIdentifier>;
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<typeof zIntegerFieldType>;
export type IntegerFieldValue = z.infer<typeof zIntegerFieldValue>;
export type IntegerFieldInputInstance = z.infer<typeof zIntegerFieldInputInstance>;
export type IntegerFieldInputTemplate = z.infer<typeof zIntegerFieldInputTemplate>;
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<typeof zFloatFieldType>;
export type FloatFieldValue = z.infer<typeof zFloatFieldValue>;
export type FloatFieldInputInstance = z.infer<typeof zFloatFieldInputInstance>;
export type FloatFieldOutputInstance = z.infer<typeof zFloatFieldOutputInstance>;
export type FloatFieldInputTemplate = z.infer<typeof zFloatFieldInputTemplate>;
export type FloatFieldOutputTemplate = z.infer<typeof zFloatFieldOutputTemplate>;
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<typeof zStringFieldType>;
export type StringFieldValue = z.infer<typeof zStringFieldValue>;
export type StringFieldInputInstance = z.infer<typeof zStringFieldInputInstance>;
export type StringFieldOutputInstance = z.infer<typeof zStringFieldOutputInstance>;
export type StringFieldInputTemplate = z.infer<typeof zStringFieldInputTemplate>;
export type StringFieldOutputTemplate = z.infer<typeof zStringFieldOutputTemplate>;
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<typeof zBooleanFieldType>;
export type BooleanFieldValue = z.infer<typeof zBooleanFieldValue>;
export type BooleanFieldInputInstance = z.infer<typeof zBooleanFieldInputInstance>;
export type BooleanFieldOutputInstance = z.infer<typeof zBooleanFieldOutputInstance>;
export type BooleanFieldInputTemplate = z.infer<typeof zBooleanFieldInputTemplate>;
export type BooleanFieldOutputTemplate = z.infer<typeof zBooleanFieldOutputTemplate>;
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<typeof zEnumFieldType>;
export type EnumFieldValue = z.infer<typeof zEnumFieldValue>;
export type EnumFieldInputInstance = z.infer<typeof zEnumFieldInputInstance>;
export type EnumFieldOutputInstance = z.infer<typeof zEnumFieldOutputInstance>;
export type EnumFieldInputTemplate = z.infer<typeof zEnumFieldInputTemplate>;
export type EnumFieldOutputTemplate = z.infer<typeof zEnumFieldOutputTemplate>;
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<typeof zImageFieldType>;
export type ImageFieldValue = z.infer<typeof zImageFieldValue>;
export type ImageFieldInputInstance = z.infer<typeof zImageFieldInputInstance>;
export type ImageFieldOutputInstance = z.infer<typeof zImageFieldOutputInstance>;
export type ImageFieldInputTemplate = z.infer<typeof zImageFieldInputTemplate>;
export type ImageFieldOutputTemplate = z.infer<typeof zImageFieldOutputTemplate>;
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<typeof zBoardFieldType>;
export type BoardFieldValue = z.infer<typeof zBoardFieldValue>;
export type BoardFieldInputInstance = z.infer<typeof zBoardFieldInputInstance>;
export type BoardFieldOutputInstance = z.infer<typeof zBoardFieldOutputInstance>;
export type BoardFieldInputTemplate = z.infer<typeof zBoardFieldInputTemplate>;
export type BoardFieldOutputTemplate = z.infer<typeof zBoardFieldOutputTemplate>;
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<typeof zColorFieldType>;
export type ColorFieldValue = z.infer<typeof zColorFieldValue>;
export type ColorFieldInputInstance = z.infer<typeof zColorFieldInputInstance>;
export type ColorFieldOutputInstance = z.infer<typeof zColorFieldOutputInstance>;
export type ColorFieldInputTemplate = z.infer<typeof zColorFieldInputTemplate>;
export type ColorFieldOutputTemplate = z.infer<typeof zColorFieldOutputTemplate>;
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<typeof zMainModelFieldType>;
export type MainModelFieldValue = z.infer<typeof zMainModelFieldValue>;
export type MainModelFieldInputInstance = z.infer<typeof zMainModelFieldInputInstance>;
export type MainModelFieldOutputInstance = z.infer<typeof zMainModelFieldOutputInstance>;
export type MainModelFieldInputTemplate = z.infer<typeof zMainModelFieldInputTemplate>;
export type MainModelFieldOutputTemplate = z.infer<typeof zMainModelFieldOutputTemplate>;
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<typeof zSDXLMainModelFieldType>;
export type SDXLMainModelFieldValue = z.infer<typeof zSDXLMainModelFieldValue>;
export type SDXLMainModelFieldInputInstance = z.infer<typeof zSDXLMainModelFieldInputInstance>;
export type SDXLMainModelFieldOutputInstance = z.infer<typeof zSDXLMainModelFieldOutputInstance>;
export type SDXLMainModelFieldInputTemplate = z.infer<typeof zSDXLMainModelFieldInputTemplate>;
export type SDXLMainModelFieldOutputTemplate = z.infer<typeof zSDXLMainModelFieldOutputTemplate>;
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<typeof zSDXLRefinerModelFieldType>;
export type SDXLRefinerModelFieldValue = z.infer<typeof zSDXLRefinerModelFieldValue>;
export type SDXLRefinerModelFieldInputInstance = z.infer<typeof zSDXLRefinerModelFieldInputInstance>;
export type SDXLRefinerModelFieldOutputInstance = z.infer<typeof zSDXLRefinerModelFieldOutputInstance>;
export type SDXLRefinerModelFieldInputTemplate = z.infer<typeof zSDXLRefinerModelFieldInputTemplate>;
export type SDXLRefinerModelFieldOutputTemplate = z.infer<typeof zSDXLRefinerModelFieldOutputTemplate>;
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<typeof zVAEModelFieldType>;
export type VAEModelFieldValue = z.infer<typeof zVAEModelFieldValue>;
export type VAEModelFieldInputInstance = z.infer<typeof zVAEModelFieldInputInstance>;
export type VAEModelFieldOutputInstance = z.infer<typeof zVAEModelFieldOutputInstance>;
export type VAEModelFieldInputTemplate = z.infer<typeof zVAEModelFieldInputTemplate>;
export type VAEModelFieldOutputTemplate = z.infer<typeof zVAEModelFieldOutputTemplate>;
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<typeof zLoRAModelFieldType>;
export type LoRAModelFieldValue = z.infer<typeof zLoRAModelFieldValue>;
export type LoRAModelFieldInputInstance = z.infer<typeof zLoRAModelFieldInputInstance>;
export type LoRAModelFieldOutputInstance = z.infer<typeof zLoRAModelFieldOutputInstance>;
export type LoRAModelFieldInputTemplate = z.infer<typeof zLoRAModelFieldInputTemplate>;
export type LoRAModelFieldOutputTemplate = z.infer<typeof zLoRAModelFieldOutputTemplate>;
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<typeof zControlNetModelFieldType>;
export type ControlNetModelFieldValue = z.infer<typeof zControlNetModelFieldValue>;
export type ControlNetModelFieldInputInstance = z.infer<typeof zControlNetModelFieldInputInstance>;
export type ControlNetModelFieldOutputInstance = z.infer<typeof zControlNetModelFieldOutputInstance>;
export type ControlNetModelFieldInputTemplate = z.infer<typeof zControlNetModelFieldInputTemplate>;
export type ControlNetModelFieldOutputTemplate = z.infer<typeof zControlNetModelFieldOutputTemplate>;
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<typeof zIPAdapterModelFieldType>;
export type IPAdapterModelFieldValue = z.infer<typeof zIPAdapterModelFieldValue>;
export type IPAdapterModelFieldInputInstance = z.infer<typeof zIPAdapterModelFieldInputInstance>;
export type IPAdapterModelFieldOutputInstance = z.infer<typeof zIPAdapterModelFieldOutputInstance>;
export type IPAdapterModelFieldInputTemplate = z.infer<typeof zIPAdapterModelFieldInputTemplate>;
export type IPAdapterModelFieldOutputTemplate = z.infer<typeof zIPAdapterModelFieldOutputTemplate>;
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<typeof zT2IAdapterModelFieldType>;
export type T2IAdapterModelFieldValue = z.infer<typeof zT2IAdapterModelFieldValue>;
export type T2IAdapterModelFieldInputInstance = z.infer<typeof zT2IAdapterModelFieldInputInstance>;
export type T2IAdapterModelFieldOutputInstance = z.infer<typeof zT2IAdapterModelFieldOutputInstance>;
export type T2IAdapterModelFieldInputTemplate = z.infer<typeof zT2IAdapterModelFieldInputTemplate>;
export type T2IAdapterModelFieldOutputTemplate = z.infer<typeof zT2IAdapterModelFieldOutputTemplate>;
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<typeof zSchedulerFieldType>;
export type SchedulerFieldValue = z.infer<typeof zSchedulerFieldValue>;
export type SchedulerFieldInputInstance = z.infer<typeof zSchedulerFieldInputInstance>;
export type SchedulerFieldOutputInstance = z.infer<typeof zSchedulerFieldOutputInstance>;
export type SchedulerFieldInputTemplate = z.infer<typeof zSchedulerFieldInputTemplate>;
export type SchedulerFieldOutputTemplate = z.infer<typeof zSchedulerFieldOutputTemplate>;
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<typeof zStatelessFieldType>;
export type StatelessFieldValue = z.infer<typeof zStatelessFieldValue>;
export type StatelessFieldInputInstance = z.infer<typeof zStatelessFieldInputInstance>;
export type StatelessFieldOutputInstance = z.infer<typeof zStatelessFieldOutputInstance>;
export type StatelessFieldInputTemplate = z.infer<typeof zStatelessFieldInputTemplate>;
export type StatelessFieldOutputTemplate = z.infer<typeof zStatelessFieldOutputTemplate>;
// #endregion
/**
@ -695,66 +342,10 @@ export type StatelessFieldOutputTemplate = z.infer<typeof zStatelessFieldOutputT
* for all other StatelessFields.
*/
// #region StatefulFieldType & FieldType
export const zStatefulFieldType = z.union([
zIntegerFieldType,
zFloatFieldType,
zStringFieldType,
zBooleanFieldType,
zEnumFieldType,
zImageFieldType,
zBoardFieldType,
zMainModelFieldType,
zSDXLMainModelFieldType,
zSDXLRefinerModelFieldType,
zVAEModelFieldType,
zLoRAModelFieldType,
zControlNetModelFieldType,
zIPAdapterModelFieldType,
zT2IAdapterModelFieldType,
zColorFieldType,
zSchedulerFieldType,
]);
export type StatefulFieldType = z.infer<typeof zStatefulFieldType>;
export const isStatefulFieldType = (val: unknown): val is StatefulFieldType =>
zStatefulFieldType.safeParse(val).success;
export const zFieldType = z.union([zStatefulFieldType, zStatelessFieldType]);
export type FieldType = z.infer<typeof zFieldType>;
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<typeof zStatefulFieldValue>;
export const isStatefulFieldValue = (val: unknown): val is StatefulFieldValue =>
zStatefulFieldValue.safeParse(val).success;
export const zFieldValue = z.union([zStatefulFieldValue, zStatelessFieldValue]);
export type FieldValue = z.infer<typeof zFieldValue>;
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<typeof zStatefulFieldInputInstance>;
export const isStatefulFieldInputInstance = (val: unknown): val is StatefulFieldInputInstance =>
zStatefulFieldInputInstance.safeParse(val).success;
export const zFieldInputInstance = z.union([zStatefulFieldInputInstance, zStatelessFieldInputInstance]);
export type FieldInputInstance = z.infer<typeof zFieldInputInstance>;
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<typeof zStatefulFieldOutputInstance>;
export const isStatefulFieldOutputInstance = (val: unknown): val is StatefulFieldOutputInstance =>
zStatefulFieldOutputInstance.safeParse(val).success;
export const zFieldOutputInstance = z.union([zStatefulFieldOutputInstance, zStatelessFieldOutputInstance]);
export type FieldOutputInstance = z.infer<typeof zFieldOutputInstance>;
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<typeof zFieldInputTemplate>;
export const isStatefulFieldInputTemplate = (val: unknown): val is StatefulFieldInputTemplate =>
zStatefulFieldInputTemplate.safeParse(val).success;
export const zFieldInputTemplate = z.union([zStatefulFieldInputTemplate, zStatelessFieldInputTemplate]);
export type FieldInputTemplate = z.infer<typeof zFieldInputTemplate>;
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<typeof zStatefulFieldOutputTemplate>;
export const isStatefulFieldOutputTemplate = (val: unknown): val is StatefulFieldOutputTemplate =>
zStatefulFieldOutputTemplate.safeParse(val).success;
export const zFieldOutputTemplate = z.union([zStatefulFieldOutputTemplate, zStatelessFieldOutputTemplate]);
export type FieldOutputTemplate = z.infer<typeof zFieldOutputTemplate>;
export const isFieldOutputTemplate = (val: unknown): val is FieldOutputTemplate =>
zFieldOutputTemplate.safeParse(val).success;
// #endregion

View File

@ -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<typeof zInvocationTemplate>;
// #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<typeof zNotesNodeData>;
export type InvocationNodeData = z.infer<typeof zInvocationNodeData>;
export type CurrentImageNodeData = z.infer<typeof zCurrentImageNodeData>;
export type AnyNodeData = z.infer<typeof zAnyNodeData>;
export type InvocationNode = Node<InvocationNodeData, 'invocation'>;
export type NotesNode = Node<NotesNodeData, 'notes'>;
export type CurrentImageNode = Node<CurrentImageNodeData, 'current_image'>;
export type AnyNode = Node<AnyNodeData>;
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<typeof zNodeExecutionState>;
export type NodeStatus = z.infer<typeof zNodeStatus>;
// #endregion
// #region Edges
export const zInvocationNodeEdgeExtra = z.object({
type: z.union([z.literal('default'), z.literal('collapsed')]),
});
export type InvocationNodeEdgeExtra = z.infer<typeof zInvocationNodeEdgeExtra>;
export type InvocationNodeEdge = Edge<InvocationNodeEdgeExtra>;
// #endregion

View File

@ -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),
};
});

View File

@ -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<typeof zXYPosition>;
export const zDimension = z.number().gt(0).nullish();
export type Dimension = z.infer<typeof zDimension>;
const zDimension = z.number().gt(0).nullish();
export const zWorkflowCategory = z.enum(['user', 'default', 'project']);
export type WorkflowCategory = z.infer<typeof zWorkflowCategory>;
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<typeof zWorkflowInvocationNode>;
export type WorkflowNotesNode = z.infer<typeof zWorkflowNotesNode>;
export type WorkflowNode = z.infer<typeof zWorkflowNode>;
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<typeof zWorkflowEdgeDefault>;
export type WorkflowEdgeCollapsed = z.infer<typeof zWorkflowEdgeCollapsed>;
export type WorkflowEdge = z.infer<typeof zWorkflowEdge>;
const zWorkflowEdge = z.union([zWorkflowEdgeDefault, zWorkflowEdgeCollapsed]);
// #endregion
// #region Workflow

View File

@ -12,9 +12,6 @@ const zXYPosition = z
.default({ x: 0, y: 0 });
export type XYPosition = z.infer<typeof zXYPosition>;
const zDimension = z.number().gt(0).nullish();
export type Dimension = z.infer<typeof zDimension>;
const zWorkflowCategory = z.enum(['user', 'default', 'project']);
export type WorkflowCategory = z.infer<typeof zWorkflowCategory>;
// #endregion
@ -34,9 +31,7 @@ const zWorkflowNotesNode = z.object({
});
const zWorkflowNode = z.union([zWorkflowInvocationNode, zWorkflowNotesNode]);
export type WorkflowInvocationNode = z.infer<typeof zWorkflowInvocationNode>;
export type WorkflowNotesNode = z.infer<typeof zWorkflowNotesNode>;
export type WorkflowNode = z.infer<typeof zWorkflowNode>;
type WorkflowInvocationNode = z.infer<typeof zWorkflowInvocationNode>;
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<typeof zWorkflowEdgeDefault>;
export type WorkflowEdgeCollapsed = z.infer<typeof zWorkflowEdgeCollapsed>;
export type WorkflowEdge = z.infer<typeof zWorkflowEdge>;
// #endregion
// #region Workflow

View File

@ -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);

View File

@ -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<HTMLDivElement>(null);

View File

@ -9,11 +9,11 @@ const zParamESRGANModelName = z.enum([
'ESRGAN_SRx4_DF2KOST_official-ff704c30.pth',
'RealESRGAN_x2plus.pth',
]);
export type ParamESRGANModelName = z.infer<typeof zParamESRGANModelName>;
type ParamESRGANModelName = z.infer<typeof zParamESRGANModelName>;
export const isParamESRGANModelName = (v: unknown): v is ParamESRGANModelName =>
zParamESRGANModelName.safeParse(v).success;
export interface PostprocessingState {
interface PostprocessingState {
_version: 1;
esrganModelName: ParamESRGANModelName;
}

View File

@ -91,11 +91,6 @@ export type ParameterHeight = z.infer<typeof zParameterHeight>;
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<typeof zParameterAspectRatio>;
// #endregion
// #region Model
export const zParameterModel = zModelIdentifierWithBase;
export type ParameterModel = z.infer<typeof zParameterModel>;
@ -198,6 +193,6 @@ export const isParameterCanvasCoherenceMode = (val: unknown): val is ParameterCa
// #region LoRA weight
const zLoRAWeight = z.number();
export type ParameterLoRAWeight = z.infer<typeof zLoRAWeight>;
type ParameterLoRAWeight = z.infer<typeof zLoRAWeight>;
export const isParameterLoRAWeight = (val: unknown): val is ParameterLoRAWeight => zLoRAWeight.safeParse(val).success;
// #endregion

View File

@ -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;

View File

@ -1,7 +1,7 @@
import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
export type HotkeyListItem = {
type HotkeyListItem = {
title: string;
desc: string;
hotkeys: string[][];

View File

@ -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;

View File

@ -28,7 +28,7 @@ const StickyScrollableContent = memo((props: StickyScrollableContentProps) => {
StickyScrollableContent.displayName = 'StickyScrollableContent';
export type StickyScrollableProps = PropsWithChildren<{
type StickyScrollableProps = PropsWithChildren<{
title: string;
}>;

View File

@ -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;

View File

@ -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;

View File

@ -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<MainModelConfig, string>({
selectId: (entity) => entity.key,

View File

@ -572,7 +572,7 @@ export type paths = {
};
};
export type webhooks = Record<string, never>;
type webhooks = Record<string, never>;
export type components = {
schemas: {
@ -10929,9 +10929,9 @@ export type components = {
pathItems: never;
};
export type $defs = Record<string, never>;
type $defs = Record<string, never>;
export type external = Record<string, never>;
type external = Record<string, never>;
export type operations = {

View File

@ -12,8 +12,6 @@ export type ListImagesArgs = NonNullable<paths['/api/v1/images/']['get']['parame
export type DeleteBoardResult =
paths['/api/v1/boards/{board_id}']['delete']['responses']['200']['content']['application/json'];
export type ListBoardsArg = NonNullable<paths['/api/v1/boards/']['get']['parameters']['query']>;
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';
};

View File

@ -14,7 +14,7 @@ export type AnyInvocation = NonNullable<NonNullable<Graph['nodes']>[string]>;
export type AnyResult = NonNullable<GraphExecutionState['results'][string]>;
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;
};