From 1c7d92dc48922ee21f291dadc9d748655edeb487 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue, 14 Mar 2023 22:14:08 +1100 Subject: [PATCH] feat(ui): add axios client generator and simple example --- invokeai/frontend/web/.eslintignore | 1 + invokeai/frontend/web/.prettierignore | 1 + invokeai/frontend/web/package.json | 5 + invokeai/frontend/web/src/app/NodeAPITest.tsx | 148 +++++++++ .../components/WorkInProgress/NodesWIP.tsx | 8 +- .../WorkInProgress/WorkInProgress.tsx | 1 + .../frontend/web/src/services/api/README.md | 113 +++++++ .../web/src/services/api/core/ApiError.ts | 24 ++ .../services/api/core/ApiRequestOptions.ts | 16 + .../web/src/services/api/core/ApiResult.ts | 10 + .../services/api/core/CancelablePromise.ts | 128 ++++++++ .../web/src/services/api/core/OpenAPI.ts | 31 ++ .../web/src/services/api/core/request.ts | 304 ++++++++++++++++++ .../src/services/api/generate_openapi_json.py | 13 + .../frontend/web/src/services/api/index.ts | 76 +++++ .../src/services/api/models/BlurInvocation.ts | 29 ++ .../services/api/models/Body_upload_image.ts | 8 + .../services/api/models/CollectInvocation.ts | 23 ++ .../api/models/CollectInvocationOutput.ts | 15 + .../api/models/CropImageInvocation.ts | 37 +++ .../api/models/CvInpaintInvocation.ts | 25 ++ .../src/services/api/models/EdgeConnection.ts | 15 + .../web/src/services/api/models/Graph.ts | 38 +++ .../api/models/GraphExecutionState.ts | 54 ++++ .../services/api/models/GraphInvocation.ts | 22 ++ .../api/models/GraphInvocationOutput.ts | 11 + .../api/models/HTTPValidationError.ts | 10 + .../web/src/services/api/models/ImageField.ts | 18 ++ .../src/services/api/models/ImageOutput.ts | 17 + .../api/models/ImageToImageInvocation.ts | 69 ++++ .../web/src/services/api/models/ImageType.ts | 8 + .../services/api/models/InpaintInvocation.ts | 77 +++++ .../api/models/InverseLerpInvocation.ts | 29 ++ .../services/api/models/IterateInvocation.ts | 24 ++ .../api/models/IterateInvocationOutput.ts | 15 + .../src/services/api/models/LerpInvocation.ts | 29 ++ .../api/models/LoadImageInvocation.ts | 25 ++ .../api/models/MaskFromAlphaInvocation.ts | 25 ++ .../web/src/services/api/models/MaskOutput.ts | 17 + .../PaginatedResults_GraphExecutionState_.ts | 32 ++ .../api/models/PasteImageInvocation.ts | 37 +++ .../src/services/api/models/PromptOutput.ts | 15 + .../api/models/RestoreFaceInvocation.ts | 25 ++ .../api/models/ShowImageInvocation.ts | 21 ++ .../api/models/TextToImageInvocation.ts | 55 ++++ .../services/api/models/UpscaleInvocation.ts | 29 ++ .../services/api/models/ValidationError.ts | 10 + .../web/src/services/api/openapi.json | 1 + .../services/api/schemas/$BlurInvocation.ts | 30 ++ .../api/schemas/$Body_upload_image.ts | 12 + .../api/schemas/$CollectInvocation.ts | 28 ++ .../api/schemas/$CollectInvocationOutput.ts | 19 ++ .../api/schemas/$CropImageInvocation.ts | 39 +++ .../api/schemas/$CvInpaintInvocation.ts | 30 ++ .../services/api/schemas/$EdgeConnection.ts | 17 + .../web/src/services/api/schemas/$Graph.ts | 62 ++++ .../api/schemas/$GraphExecutionState.ts | 79 +++++ .../services/api/schemas/$GraphInvocation.ts | 24 ++ .../api/schemas/$GraphInvocationOutput.ts | 11 + .../api/schemas/$HTTPValidationError.ts | 13 + .../src/services/api/schemas/$ImageField.ts | 16 + .../src/services/api/schemas/$ImageOutput.ts | 18 ++ .../api/schemas/$ImageToImageInvocation.ts | 75 +++++ .../src/services/api/schemas/$ImageType.ts | 6 + .../api/schemas/$InpaintInvocation.ts | 87 +++++ .../api/schemas/$InverseLerpInvocation.ts | 33 ++ .../api/schemas/$IterateInvocation.ts | 28 ++ .../api/schemas/$IterateInvocationOutput.ts | 16 + .../services/api/schemas/$LerpInvocation.ts | 33 ++ .../api/schemas/$LoadImageInvocation.ts | 29 ++ .../api/schemas/$MaskFromAlphaInvocation.ts | 27 ++ .../src/services/api/schemas/$MaskOutput.ts | 18 ++ .../$PaginatedResults_GraphExecutionState_.ts | 35 ++ .../api/schemas/$PasteImageInvocation.ts | 45 +++ .../src/services/api/schemas/$PromptOutput.ts | 15 + .../api/schemas/$RestoreFaceInvocation.ts | 28 ++ .../api/schemas/$ShowImageInvocation.ts | 23 ++ .../api/schemas/$TextToImageInvocation.ts | 59 ++++ .../api/schemas/$UpscaleInvocation.ts | 31 ++ .../services/api/schemas/$ValidationError.ts | 27 ++ .../services/api/services/ImagesService.ts | 59 ++++ .../services/api/services/SessionsService.ts | 283 ++++++++++++++++ invokeai/frontend/web/vite.config.ts | 17 + invokeai/frontend/web/yarn.lock | 137 +++++++- 84 files changed, 3244 insertions(+), 9 deletions(-) create mode 100644 invokeai/frontend/web/src/app/NodeAPITest.tsx create mode 100644 invokeai/frontend/web/src/services/api/README.md create mode 100644 invokeai/frontend/web/src/services/api/core/ApiError.ts create mode 100644 invokeai/frontend/web/src/services/api/core/ApiRequestOptions.ts create mode 100644 invokeai/frontend/web/src/services/api/core/ApiResult.ts create mode 100644 invokeai/frontend/web/src/services/api/core/CancelablePromise.ts create mode 100644 invokeai/frontend/web/src/services/api/core/OpenAPI.ts create mode 100644 invokeai/frontend/web/src/services/api/core/request.ts create mode 100644 invokeai/frontend/web/src/services/api/generate_openapi_json.py create mode 100644 invokeai/frontend/web/src/services/api/index.ts create mode 100644 invokeai/frontend/web/src/services/api/models/BlurInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/models/Body_upload_image.ts create mode 100644 invokeai/frontend/web/src/services/api/models/CollectInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/models/CollectInvocationOutput.ts create mode 100644 invokeai/frontend/web/src/services/api/models/CropImageInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/models/CvInpaintInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/models/EdgeConnection.ts create mode 100644 invokeai/frontend/web/src/services/api/models/Graph.ts create mode 100644 invokeai/frontend/web/src/services/api/models/GraphExecutionState.ts create mode 100644 invokeai/frontend/web/src/services/api/models/GraphInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/models/GraphInvocationOutput.ts create mode 100644 invokeai/frontend/web/src/services/api/models/HTTPValidationError.ts create mode 100644 invokeai/frontend/web/src/services/api/models/ImageField.ts create mode 100644 invokeai/frontend/web/src/services/api/models/ImageOutput.ts create mode 100644 invokeai/frontend/web/src/services/api/models/ImageToImageInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/models/ImageType.ts create mode 100644 invokeai/frontend/web/src/services/api/models/InpaintInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/models/InverseLerpInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/models/IterateInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/models/IterateInvocationOutput.ts create mode 100644 invokeai/frontend/web/src/services/api/models/LerpInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/models/LoadImageInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/models/MaskFromAlphaInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/models/MaskOutput.ts create mode 100644 invokeai/frontend/web/src/services/api/models/PaginatedResults_GraphExecutionState_.ts create mode 100644 invokeai/frontend/web/src/services/api/models/PasteImageInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/models/PromptOutput.ts create mode 100644 invokeai/frontend/web/src/services/api/models/RestoreFaceInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/models/ShowImageInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/models/TextToImageInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/models/UpscaleInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/models/ValidationError.ts create mode 100644 invokeai/frontend/web/src/services/api/openapi.json create mode 100644 invokeai/frontend/web/src/services/api/schemas/$BlurInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$Body_upload_image.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$CollectInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$CollectInvocationOutput.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$CropImageInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$CvInpaintInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$EdgeConnection.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$Graph.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$GraphExecutionState.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$GraphInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$GraphInvocationOutput.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$HTTPValidationError.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$ImageField.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$ImageOutput.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$ImageToImageInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$ImageType.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$InpaintInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$InverseLerpInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$IterateInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$IterateInvocationOutput.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$LerpInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$LoadImageInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$MaskFromAlphaInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$MaskOutput.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$PaginatedResults_GraphExecutionState_.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$PasteImageInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$PromptOutput.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$RestoreFaceInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$ShowImageInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$TextToImageInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$UpscaleInvocation.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$ValidationError.ts create mode 100644 invokeai/frontend/web/src/services/api/services/ImagesService.ts create mode 100644 invokeai/frontend/web/src/services/api/services/SessionsService.ts diff --git a/invokeai/frontend/web/.eslintignore b/invokeai/frontend/web/.eslintignore index 99d8bab48c..43bf109197 100644 --- a/invokeai/frontend/web/.eslintignore +++ b/invokeai/frontend/web/.eslintignore @@ -6,3 +6,4 @@ stats.html index.html .yarn/ *.scss +src/services/api/ diff --git a/invokeai/frontend/web/.prettierignore b/invokeai/frontend/web/.prettierignore index 905f177fde..f82a979dff 100644 --- a/invokeai/frontend/web/.prettierignore +++ b/invokeai/frontend/web/.prettierignore @@ -4,3 +4,4 @@ node_modules/ patches/ stats.html .yarn/ +src/services/api/ diff --git a/invokeai/frontend/web/package.json b/invokeai/frontend/web/package.json index c47948746d..224fe425ec 100644 --- a/invokeai/frontend/web/package.json +++ b/invokeai/frontend/web/package.json @@ -6,6 +6,8 @@ "prepare": "cd ../../../ && husky install invokeai/frontend/web/.husky", "dev": "concurrently \"vite dev\" \"yarn run theme:watch\"", "build": "yarn run lint && vite build", + "api:web": "openapi -i http://localhost:9090/openapi.json -o src/services/api --client axios --useUnionTypes --exportSchemas true --indent 2", + "api:file": "openapi -i openapi.json -o src/services/api --client axios --useUnionTypes --exportSchemas true --indent 2", "preview": "vite preview", "lint:madge": "madge --circular src/main.tsx", "lint:eslint": "eslint --max-warnings=0 .", @@ -83,6 +85,7 @@ "@typescript-eslint/eslint-plugin": "^5.52.0", "@typescript-eslint/parser": "^5.52.0", "@vitejs/plugin-react-swc": "^3.2.0", + "axios": "^1.3.4", "babel-plugin-transform-imports": "^2.0.0", "concurrently": "^7.6.0", "eslint": "^8.34.0", @@ -90,9 +93,11 @@ "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-react": "^7.32.2", "eslint-plugin-react-hooks": "^4.6.0", + "form-data": "^4.0.0", "husky": "^8.0.3", "lint-staged": "^13.1.2", "madge": "^6.0.0", + "openapi-typescript-codegen": "^0.23.0", "postinstall-postinstall": "^2.1.0", "prettier": "^2.8.4", "rollup-plugin-visualizer": "^5.9.0", diff --git a/invokeai/frontend/web/src/app/NodeAPITest.tsx b/invokeai/frontend/web/src/app/NodeAPITest.tsx new file mode 100644 index 0000000000..1420ec04c8 --- /dev/null +++ b/invokeai/frontend/web/src/app/NodeAPITest.tsx @@ -0,0 +1,148 @@ +import { Flex, Heading, Text } from '@chakra-ui/react'; +import IAIButton from 'common/components/IAIButton'; +import { useEffect, useState } from 'react'; +import { SessionsService } from 'services/api'; +import { io } from 'socket.io-client'; + +type GeneratorProgress = { + session_id: string; + invocation_id: string; + step: number; + percent: number; +}; + +const socket_url = `ws://${window.location.host}`; +const socket = io(socket_url, { + path: '/ws/socket.io', +}); + +enum STATUS { + waiting = 'WAITING', + ready = 'READY', + preparing = 'PREPARING', + generating = 'GENERATING', + finished = 'FINISHED', +} + +const NodeAPITest = () => { + const [invocationProgress, setInvocationProgress] = useState(); + const [status, setStatus] = useState(STATUS.waiting); + const [sessionId, setSessionId] = useState(null); + + const handleCreateSession = async () => { + // create a session with a simple graph + const payload = await SessionsService.createSession({ + nodes: { + a: { + id: 'a', + type: 'txt2img', + prompt: 'pizza', + steps: 10, + }, + b: { + id: 'b', + type: 'show_image', + }, + }, + edges: [ + [ + { node_id: 'a', field: 'image' }, + { node_id: 'b', field: 'image' }, + ], + ], + }); + + // the generated types have `id` as optional but i'm pretty sure we always get the id + setSessionId(payload.id!); + setStatus(STATUS.ready); + console.log('payload', payload); + + // subscribe to this session + socket.emit('subscribe', { session: payload.id }); + console.log('subscribe', { session: payload.id }); + }; + + const handleInvokeSession = async () => { + if (!sessionId) { + return; + } + + setStatus(STATUS.preparing); + // invoke the session, the resultant image should open in your platform's native image viewer when completed + await SessionsService.invokeSession(sessionId, true); + }; + + useEffect(() => { + socket.on('generator_progress', (data: GeneratorProgress) => { + // this is broken on the backend, the nodes web server does not get `step` or `steps`, so we don't get a percentage + // see https://github.com/invoke-ai/InvokeAI/issues/2951 + console.log('generator_progress', data); + setInvocationProgress(data.percent); + }); + socket.on('invocation_started', (data) => { + console.log('invocation_started', data); + setStatus(STATUS.generating); + }); + socket.on('invocation_complete', (data) => { + // for now, just unsubscribe from the session when we finish a generation + // in the future we will want to continue building the graph and executing etc + setStatus(STATUS.finished); + console.log('invocation_complete', data); + socket.emit('unsubscribe', { session: data.session_id }); + console.log('unsubscribe', { session: data.session_id }); + setTimeout(() => { + setSessionId(null); + setStatus(STATUS.waiting); + }, 2000); + }); + socket.on('session_complete', (data) => { + console.log('session_complete', data); + socket.emit('unsubscribe', { session: data.session_id }); + console.log('unsubscribe', { session: data.session_id }); + setSessionId(null); + setStatus(STATUS.waiting); + }); + + () => { + socket.removeAllListeners(); + socket.disconnect(); + }; + }, []); + + return ( + + Status: {status} + Session: {sessionId ? sessionId : '...'} + + Create Session + + + Invoke + + + ); +}; + +export default NodeAPITest; diff --git a/invokeai/frontend/web/src/common/components/WorkInProgress/NodesWIP.tsx b/invokeai/frontend/web/src/common/components/WorkInProgress/NodesWIP.tsx index c86aa767dd..923a5bed7e 100644 --- a/invokeai/frontend/web/src/common/components/WorkInProgress/NodesWIP.tsx +++ b/invokeai/frontend/web/src/common/components/WorkInProgress/NodesWIP.tsx @@ -1,4 +1,5 @@ import { Flex, Heading, Text, VStack } from '@chakra-ui/react'; +import NodeAPITest from 'app/NodeAPITest'; import { useTranslation } from 'react-i18next'; import WorkInProgress from './WorkInProgress'; @@ -9,18 +10,13 @@ export default function NodesWIP() { - {t('common.nodes')} - - {t('common.nodesDesc')} - + ); diff --git a/invokeai/frontend/web/src/common/components/WorkInProgress/WorkInProgress.tsx b/invokeai/frontend/web/src/common/components/WorkInProgress/WorkInProgress.tsx index deb9110d56..158fe4a1fa 100644 --- a/invokeai/frontend/web/src/common/components/WorkInProgress/WorkInProgress.tsx +++ b/invokeai/frontend/web/src/common/components/WorkInProgress/WorkInProgress.tsx @@ -14,6 +14,7 @@ const WorkInProgress = (props: WorkInProgressProps) => { width: '100%', height: '100%', bg: 'base.850', + borderRadius: 'base', }} > {children} diff --git a/invokeai/frontend/web/src/services/api/README.md b/invokeai/frontend/web/src/services/api/README.md new file mode 100644 index 0000000000..b893fa1afa --- /dev/null +++ b/invokeai/frontend/web/src/services/api/README.md @@ -0,0 +1,113 @@ +# Generated axios API client + +- [Generated axios API client](#generated-axios-api-client) + - [Generation](#generation) + - [Generate the API client from the nodes web server](#generate-the-api-client-from-the-nodes-web-server) + - [Generate the API client from JSON](#generate-the-api-client-from-json) + - [Getting the JSON from the nodes web server](#getting-the-json-from-the-nodes-web-server) + - [Getting the JSON with a python script](#getting-the-json-with-a-python-script) + - [Generate the API client](#generate-the-api-client) + - [The generated client](#the-generated-client) + - [Fix a small issue](#fix-a-small-issue) + +This API client is generated by an [openapi code generator](https://github.com/ferdikoomen/openapi-typescript-codegen). + +After generation, we will need to fix a small issue. + +## Generation + +The axios client may be generated by from the OpenAPI schema from the nodes web server, or from JSON. + +### Generate the API client from the nodes web server + +We need to start the nodes web server, which serves the OpenAPI schema to the generator. + +1. Start the nodes web server. + +```bash +# from the repo root +python scripts/invoke-new.py --web +``` + +2. Generate the API client. + +```bash +# from invokeai/frontend/web/ +yarn api:web +``` + +### Generate the API client from JSON + +The JSON can be acquired from the nodes web server, or with a python script. + +#### Getting the JSON from the nodes web server + +Start the nodes web server as described above, then download the file. + +```bash +# from invokeai/frontend/web/ +curl http://localhost:9090/openapi.json -o openapi.json +``` + +#### Getting the JSON with a python script + +Run this python script from the repo root, so it can access the nodes server modules. + +The script will output `openapi.json` in the repo root. Then we need to move it to `invokeai/frontend/web/`. + +```bash +# from the repo root +python invokeai/frontend/web/src/services/api/generate_openapi_json.py +mv openapi.json invokeai/frontend/web/ +``` + +#### Generate the API client + +Now we can generate the API client from the JSON. + +```bash +# from invokeai/frontend/web/ +yarn api:file +``` + +## The generated client + +The client will be written to `invokeai/frontend/web/services/api/`: + +- `axios` client +- TS types +- An easily parseable schema, which we can use to generate UI + +## Fix a small issue + +In `models/Graph.ts`, `edges` is not parsed correctly from the OpenAPI schema. The generator outputs: + +```typescript +{ + ... + edges?: Array>; + ... +} +``` + +This is incorrect. It should be: + +```typescript +{ + ... + edges?: Array<[EdgeConnection, EdgeConnection]>; + ... +} +``` + +That is, `edges` is an array of tuples, each consisting of two `EdgeConnections`, where the first `EdgeConnection` is the "from" node, and the second is the "to" node. + +You will also need to import the `EdgeConnection` type: + +```typescript +import type { EdgeConnection } from './EdgeConnection'; +``` + +If you regenerate the client, you will need to manually fix this. + +Hopefully we can fix the parsing of the schema in the future. diff --git a/invokeai/frontend/web/src/services/api/core/ApiError.ts b/invokeai/frontend/web/src/services/api/core/ApiError.ts new file mode 100644 index 0000000000..41a9605a3a --- /dev/null +++ b/invokeai/frontend/web/src/services/api/core/ApiError.ts @@ -0,0 +1,24 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { ApiRequestOptions } from './ApiRequestOptions'; +import type { ApiResult } from './ApiResult'; + +export class ApiError extends Error { + public readonly url: string; + public readonly status: number; + public readonly statusText: string; + public readonly body: any; + public readonly request: ApiRequestOptions; + + constructor(request: ApiRequestOptions, response: ApiResult, message: string) { + super(message); + + this.name = 'ApiError'; + this.url = response.url; + this.status = response.status; + this.statusText = response.statusText; + this.body = response.body; + this.request = request; + } +} diff --git a/invokeai/frontend/web/src/services/api/core/ApiRequestOptions.ts b/invokeai/frontend/web/src/services/api/core/ApiRequestOptions.ts new file mode 100644 index 0000000000..c9350406a1 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/core/ApiRequestOptions.ts @@ -0,0 +1,16 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type ApiRequestOptions = { + readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH'; + readonly url: string; + readonly path?: Record; + readonly cookies?: Record; + readonly headers?: Record; + readonly query?: Record; + readonly formData?: Record; + readonly body?: any; + readonly mediaType?: string; + readonly responseHeader?: string; + readonly errors?: Record; +}; diff --git a/invokeai/frontend/web/src/services/api/core/ApiResult.ts b/invokeai/frontend/web/src/services/api/core/ApiResult.ts new file mode 100644 index 0000000000..91f60ae082 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/core/ApiResult.ts @@ -0,0 +1,10 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type ApiResult = { + readonly url: string; + readonly ok: boolean; + readonly status: number; + readonly statusText: string; + readonly body: any; +}; diff --git a/invokeai/frontend/web/src/services/api/core/CancelablePromise.ts b/invokeai/frontend/web/src/services/api/core/CancelablePromise.ts new file mode 100644 index 0000000000..b923479fea --- /dev/null +++ b/invokeai/frontend/web/src/services/api/core/CancelablePromise.ts @@ -0,0 +1,128 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export class CancelError extends Error { + + constructor(message: string) { + super(message); + this.name = 'CancelError'; + } + + public get isCancelled(): boolean { + return true; + } +} + +export interface OnCancel { + readonly isResolved: boolean; + readonly isRejected: boolean; + readonly isCancelled: boolean; + + (cancelHandler: () => void): void; +} + +export class CancelablePromise implements Promise { + readonly [Symbol.toStringTag]!: string; + + private _isResolved: boolean; + private _isRejected: boolean; + private _isCancelled: boolean; + private readonly _cancelHandlers: (() => void)[]; + private readonly _promise: Promise; + private _resolve?: (value: T | PromiseLike) => void; + private _reject?: (reason?: any) => void; + + constructor( + executor: ( + resolve: (value: T | PromiseLike) => void, + reject: (reason?: any) => void, + onCancel: OnCancel + ) => void + ) { + this._isResolved = false; + this._isRejected = false; + this._isCancelled = false; + this._cancelHandlers = []; + this._promise = new Promise((resolve, reject) => { + this._resolve = resolve; + this._reject = reject; + + const onResolve = (value: T | PromiseLike): void => { + if (this._isResolved || this._isRejected || this._isCancelled) { + return; + } + this._isResolved = true; + this._resolve?.(value); + }; + + const onReject = (reason?: any): void => { + if (this._isResolved || this._isRejected || this._isCancelled) { + return; + } + this._isRejected = true; + this._reject?.(reason); + }; + + const onCancel = (cancelHandler: () => void): void => { + if (this._isResolved || this._isRejected || this._isCancelled) { + return; + } + this._cancelHandlers.push(cancelHandler); + }; + + Object.defineProperty(onCancel, 'isResolved', { + get: (): boolean => this._isResolved, + }); + + Object.defineProperty(onCancel, 'isRejected', { + get: (): boolean => this._isRejected, + }); + + Object.defineProperty(onCancel, 'isCancelled', { + get: (): boolean => this._isCancelled, + }); + + return executor(onResolve, onReject, onCancel as OnCancel); + }); + } + + public then( + onFulfilled?: ((value: T) => TResult1 | PromiseLike) | null, + onRejected?: ((reason: any) => TResult2 | PromiseLike) | null + ): Promise { + return this._promise.then(onFulfilled, onRejected); + } + + public catch( + onRejected?: ((reason: any) => TResult | PromiseLike) | null + ): Promise { + return this._promise.catch(onRejected); + } + + public finally(onFinally?: (() => void) | null): Promise { + return this._promise.finally(onFinally); + } + + public cancel(): void { + if (this._isResolved || this._isRejected || this._isCancelled) { + return; + } + this._isCancelled = true; + if (this._cancelHandlers.length) { + try { + for (const cancelHandler of this._cancelHandlers) { + cancelHandler(); + } + } catch (error) { + console.warn('Cancellation threw an error', error); + return; + } + } + this._cancelHandlers.length = 0; + this._reject?.(new CancelError('Request aborted')); + } + + public get isCancelled(): boolean { + return this._isCancelled; + } +} diff --git a/invokeai/frontend/web/src/services/api/core/OpenAPI.ts b/invokeai/frontend/web/src/services/api/core/OpenAPI.ts new file mode 100644 index 0000000000..ba65dcd55d --- /dev/null +++ b/invokeai/frontend/web/src/services/api/core/OpenAPI.ts @@ -0,0 +1,31 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { ApiRequestOptions } from './ApiRequestOptions'; + +type Resolver = (options: ApiRequestOptions) => Promise; +type Headers = Record; + +export type OpenAPIConfig = { + BASE: string; + VERSION: string; + WITH_CREDENTIALS: boolean; + CREDENTIALS: 'include' | 'omit' | 'same-origin'; + TOKEN?: string | Resolver; + USERNAME?: string | Resolver; + PASSWORD?: string | Resolver; + HEADERS?: Headers | Resolver; + ENCODE_PATH?: (path: string) => string; +}; + +export const OpenAPI: OpenAPIConfig = { + BASE: '', + VERSION: '1.0.0', + WITH_CREDENTIALS: false, + CREDENTIALS: 'include', + TOKEN: undefined, + USERNAME: undefined, + PASSWORD: undefined, + HEADERS: undefined, + ENCODE_PATH: undefined, +}; diff --git a/invokeai/frontend/web/src/services/api/core/request.ts b/invokeai/frontend/web/src/services/api/core/request.ts new file mode 100644 index 0000000000..0b54a83c10 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/core/request.ts @@ -0,0 +1,304 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import axios from 'axios'; +import type { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios'; +import FormData from 'form-data'; + +import { ApiError } from './ApiError'; +import type { ApiRequestOptions } from './ApiRequestOptions'; +import type { ApiResult } from './ApiResult'; +import { CancelablePromise } from './CancelablePromise'; +import type { OnCancel } from './CancelablePromise'; +import type { OpenAPIConfig } from './OpenAPI'; + +const isDefined = (value: T | null | undefined): value is Exclude => { + return value !== undefined && value !== null; +}; + +const isString = (value: any): value is string => { + return typeof value === 'string'; +}; + +const isStringWithValue = (value: any): value is string => { + return isString(value) && value !== ''; +}; + +const isBlob = (value: any): value is Blob => { + return ( + typeof value === 'object' && + typeof value.type === 'string' && + typeof value.stream === 'function' && + typeof value.arrayBuffer === 'function' && + typeof value.constructor === 'function' && + typeof value.constructor.name === 'string' && + /^(Blob|File)$/.test(value.constructor.name) && + /^(Blob|File)$/.test(value[Symbol.toStringTag]) + ); +}; + +const isFormData = (value: any): value is FormData => { + return value instanceof FormData; +}; + +const isSuccess = (status: number): boolean => { + return status >= 200 && status < 300; +}; + +const base64 = (str: string): string => { + try { + return btoa(str); + } catch (err) { + // @ts-ignore + return Buffer.from(str).toString('base64'); + } +}; + +const getQueryString = (params: Record): string => { + const qs: string[] = []; + + const append = (key: string, value: any) => { + qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`); + }; + + const process = (key: string, value: any) => { + if (isDefined(value)) { + if (Array.isArray(value)) { + value.forEach(v => { + process(key, v); + }); + } else if (typeof value === 'object') { + Object.entries(value).forEach(([k, v]) => { + process(`${key}[${k}]`, v); + }); + } else { + append(key, value); + } + } + }; + + Object.entries(params).forEach(([key, value]) => { + process(key, value); + }); + + if (qs.length > 0) { + return `?${qs.join('&')}`; + } + + return ''; +}; + +const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => { + const encoder = config.ENCODE_PATH || encodeURI; + + const path = options.url + .replace('{api-version}', config.VERSION) + .replace(/{(.*?)}/g, (substring: string, group: string) => { + if (options.path?.hasOwnProperty(group)) { + return encoder(String(options.path[group])); + } + return substring; + }); + + const url = `${config.BASE}${path}`; + if (options.query) { + return `${url}${getQueryString(options.query)}`; + } + return url; +}; + +const getFormData = (options: ApiRequestOptions): FormData | undefined => { + if (options.formData) { + const formData = new FormData(); + + const process = (key: string, value: any) => { + if (isString(value) || isBlob(value)) { + formData.append(key, value); + } else { + formData.append(key, JSON.stringify(value)); + } + }; + + Object.entries(options.formData) + .filter(([_, value]) => isDefined(value)) + .forEach(([key, value]) => { + if (Array.isArray(value)) { + value.forEach(v => process(key, v)); + } else { + process(key, value); + } + }); + + return formData; + } + return undefined; +}; + +type Resolver = (options: ApiRequestOptions) => Promise; + +const resolve = async (options: ApiRequestOptions, resolver?: T | Resolver): Promise => { + if (typeof resolver === 'function') { + return (resolver as Resolver)(options); + } + return resolver; +}; + +const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions, formData?: FormData): Promise> => { + const token = await resolve(options, config.TOKEN); + const username = await resolve(options, config.USERNAME); + const password = await resolve(options, config.PASSWORD); + const additionalHeaders = await resolve(options, config.HEADERS); + const formHeaders = typeof formData?.getHeaders === 'function' && formData?.getHeaders() || {} + + const headers = Object.entries({ + Accept: 'application/json', + ...additionalHeaders, + ...options.headers, + ...formHeaders, + }) + .filter(([_, value]) => isDefined(value)) + .reduce((headers, [key, value]) => ({ + ...headers, + [key]: String(value), + }), {} as Record); + + if (isStringWithValue(token)) { + headers['Authorization'] = `Bearer ${token}`; + } + + if (isStringWithValue(username) && isStringWithValue(password)) { + const credentials = base64(`${username}:${password}`); + headers['Authorization'] = `Basic ${credentials}`; + } + + if (options.body) { + if (options.mediaType) { + headers['Content-Type'] = options.mediaType; + } else if (isBlob(options.body)) { + headers['Content-Type'] = options.body.type || 'application/octet-stream'; + } else if (isString(options.body)) { + headers['Content-Type'] = 'text/plain'; + } else if (!isFormData(options.body)) { + headers['Content-Type'] = 'application/json'; + } + } + + return headers; +}; + +const getRequestBody = (options: ApiRequestOptions): any => { + if (options.body) { + return options.body; + } + return undefined; +}; + +const sendRequest = async ( + config: OpenAPIConfig, + options: ApiRequestOptions, + url: string, + body: any, + formData: FormData | undefined, + headers: Record, + onCancel: OnCancel +): Promise> => { + const source = axios.CancelToken.source(); + + const requestConfig: AxiosRequestConfig = { + url, + headers, + data: body ?? formData, + method: options.method, + withCredentials: config.WITH_CREDENTIALS, + cancelToken: source.token, + }; + + onCancel(() => source.cancel('The user aborted a request.')); + + try { + return await axios.request(requestConfig); + } catch (error) { + const axiosError = error as AxiosError; + if (axiosError.response) { + return axiosError.response; + } + throw error; + } +}; + +const getResponseHeader = (response: AxiosResponse, responseHeader?: string): string | undefined => { + if (responseHeader) { + const content = response.headers[responseHeader]; + if (isString(content)) { + return content; + } + } + return undefined; +}; + +const getResponseBody = (response: AxiosResponse): any => { + if (response.status !== 204) { + return response.data; + } + return undefined; +}; + +const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void => { + const errors: Record = { + 400: 'Bad Request', + 401: 'Unauthorized', + 403: 'Forbidden', + 404: 'Not Found', + 500: 'Internal Server Error', + 502: 'Bad Gateway', + 503: 'Service Unavailable', + ...options.errors, + } + + const error = errors[result.status]; + if (error) { + throw new ApiError(options, result, error); + } + + if (!result.ok) { + throw new ApiError(options, result, 'Generic Error'); + } +}; + +/** + * Request method + * @param config The OpenAPI configuration object + * @param options The request options from the service + * @returns CancelablePromise + * @throws ApiError + */ +export const request = (config: OpenAPIConfig, options: ApiRequestOptions): CancelablePromise => { + return new CancelablePromise(async (resolve, reject, onCancel) => { + try { + const url = getUrl(config, options); + const formData = getFormData(options); + const body = getRequestBody(options); + const headers = await getHeaders(config, options, formData); + + if (!onCancel.isCancelled) { + const response = await sendRequest(config, options, url, body, formData, headers, onCancel); + const responseBody = getResponseBody(response); + const responseHeader = getResponseHeader(response, options.responseHeader); + + const result: ApiResult = { + url, + ok: isSuccess(response.status), + status: response.status, + statusText: response.statusText, + body: responseHeader ?? responseBody, + }; + + catchErrorCodes(options, result); + + resolve(result.body); + } + } catch (error) { + reject(error); + } + }); +}; diff --git a/invokeai/frontend/web/src/services/api/generate_openapi_json.py b/invokeai/frontend/web/src/services/api/generate_openapi_json.py new file mode 100644 index 0000000000..2df766c597 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/generate_openapi_json.py @@ -0,0 +1,13 @@ +import json +from invokeai.app.api_app import app +from fastapi.openapi.utils import get_openapi + +openapi_doc = get_openapi( + title=app.title, + version=app.version, + openapi_version=app.openapi_version, + routes=app.routes, +) + +with open("./openapi.json", "w") as f: + json.dump(openapi_doc, f) diff --git a/invokeai/frontend/web/src/services/api/index.ts b/invokeai/frontend/web/src/services/api/index.ts new file mode 100644 index 0000000000..2495235fda --- /dev/null +++ b/invokeai/frontend/web/src/services/api/index.ts @@ -0,0 +1,76 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export { ApiError } from './core/ApiError'; +export { CancelablePromise, CancelError } from './core/CancelablePromise'; +export { OpenAPI } from './core/OpenAPI'; +export type { OpenAPIConfig } from './core/OpenAPI'; + +export type { BlurInvocation } from './models/BlurInvocation'; +export type { Body_upload_image } from './models/Body_upload_image'; +export type { CollectInvocation } from './models/CollectInvocation'; +export type { CollectInvocationOutput } from './models/CollectInvocationOutput'; +export type { CropImageInvocation } from './models/CropImageInvocation'; +export type { CvInpaintInvocation } from './models/CvInpaintInvocation'; +export type { EdgeConnection } from './models/EdgeConnection'; +export type { Graph } from './models/Graph'; +export type { GraphExecutionState } from './models/GraphExecutionState'; +export type { GraphInvocation } from './models/GraphInvocation'; +export type { GraphInvocationOutput } from './models/GraphInvocationOutput'; +export type { HTTPValidationError } from './models/HTTPValidationError'; +export type { ImageField } from './models/ImageField'; +export type { ImageOutput } from './models/ImageOutput'; +export type { ImageToImageInvocation } from './models/ImageToImageInvocation'; +export type { ImageType } from './models/ImageType'; +export type { InpaintInvocation } from './models/InpaintInvocation'; +export type { InverseLerpInvocation } from './models/InverseLerpInvocation'; +export type { IterateInvocation } from './models/IterateInvocation'; +export type { IterateInvocationOutput } from './models/IterateInvocationOutput'; +export type { LerpInvocation } from './models/LerpInvocation'; +export type { LoadImageInvocation } from './models/LoadImageInvocation'; +export type { MaskFromAlphaInvocation } from './models/MaskFromAlphaInvocation'; +export type { MaskOutput } from './models/MaskOutput'; +export type { PaginatedResults_GraphExecutionState_ } from './models/PaginatedResults_GraphExecutionState_'; +export type { PasteImageInvocation } from './models/PasteImageInvocation'; +export type { PromptOutput } from './models/PromptOutput'; +export type { RestoreFaceInvocation } from './models/RestoreFaceInvocation'; +export type { ShowImageInvocation } from './models/ShowImageInvocation'; +export type { TextToImageInvocation } from './models/TextToImageInvocation'; +export type { UpscaleInvocation } from './models/UpscaleInvocation'; +export type { ValidationError } from './models/ValidationError'; + +export { $BlurInvocation } from './schemas/$BlurInvocation'; +export { $Body_upload_image } from './schemas/$Body_upload_image'; +export { $CollectInvocation } from './schemas/$CollectInvocation'; +export { $CollectInvocationOutput } from './schemas/$CollectInvocationOutput'; +export { $CropImageInvocation } from './schemas/$CropImageInvocation'; +export { $CvInpaintInvocation } from './schemas/$CvInpaintInvocation'; +export { $EdgeConnection } from './schemas/$EdgeConnection'; +export { $Graph } from './schemas/$Graph'; +export { $GraphExecutionState } from './schemas/$GraphExecutionState'; +export { $GraphInvocation } from './schemas/$GraphInvocation'; +export { $GraphInvocationOutput } from './schemas/$GraphInvocationOutput'; +export { $HTTPValidationError } from './schemas/$HTTPValidationError'; +export { $ImageField } from './schemas/$ImageField'; +export { $ImageOutput } from './schemas/$ImageOutput'; +export { $ImageToImageInvocation } from './schemas/$ImageToImageInvocation'; +export { $ImageType } from './schemas/$ImageType'; +export { $InpaintInvocation } from './schemas/$InpaintInvocation'; +export { $InverseLerpInvocation } from './schemas/$InverseLerpInvocation'; +export { $IterateInvocation } from './schemas/$IterateInvocation'; +export { $IterateInvocationOutput } from './schemas/$IterateInvocationOutput'; +export { $LerpInvocation } from './schemas/$LerpInvocation'; +export { $LoadImageInvocation } from './schemas/$LoadImageInvocation'; +export { $MaskFromAlphaInvocation } from './schemas/$MaskFromAlphaInvocation'; +export { $MaskOutput } from './schemas/$MaskOutput'; +export { $PaginatedResults_GraphExecutionState_ } from './schemas/$PaginatedResults_GraphExecutionState_'; +export { $PasteImageInvocation } from './schemas/$PasteImageInvocation'; +export { $PromptOutput } from './schemas/$PromptOutput'; +export { $RestoreFaceInvocation } from './schemas/$RestoreFaceInvocation'; +export { $ShowImageInvocation } from './schemas/$ShowImageInvocation'; +export { $TextToImageInvocation } from './schemas/$TextToImageInvocation'; +export { $UpscaleInvocation } from './schemas/$UpscaleInvocation'; +export { $ValidationError } from './schemas/$ValidationError'; + +export { ImagesService } from './services/ImagesService'; +export { SessionsService } from './services/SessionsService'; diff --git a/invokeai/frontend/web/src/services/api/models/BlurInvocation.ts b/invokeai/frontend/web/src/services/api/models/BlurInvocation.ts new file mode 100644 index 0000000000..0643e4b309 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/BlurInvocation.ts @@ -0,0 +1,29 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ImageField } from './ImageField'; + +/** + * Blurs an image + */ +export type BlurInvocation = { + /** + * The id of this node. Must be unique among all nodes. + */ + id: string; + type?: 'blur'; + /** + * The image to blur + */ + image?: ImageField; + /** + * The blur radius + */ + radius?: number; + /** + * The type of blur + */ + blur_type?: 'gaussian' | 'box'; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/Body_upload_image.ts b/invokeai/frontend/web/src/services/api/models/Body_upload_image.ts new file mode 100644 index 0000000000..b81146d3ab --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/Body_upload_image.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type Body_upload_image = { + file: Blob; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/CollectInvocation.ts b/invokeai/frontend/web/src/services/api/models/CollectInvocation.ts new file mode 100644 index 0000000000..d250ae4450 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/CollectInvocation.ts @@ -0,0 +1,23 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Collects values into a collection + */ +export type CollectInvocation = { + /** + * The id of this node. Must be unique among all nodes. + */ + id: string; + type?: 'collect'; + /** + * The item to collect (all inputs must be of the same type) + */ + item?: any; + /** + * The collection, will be provided on execution + */ + collection?: Array; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/CollectInvocationOutput.ts b/invokeai/frontend/web/src/services/api/models/CollectInvocationOutput.ts new file mode 100644 index 0000000000..df769248fb --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/CollectInvocationOutput.ts @@ -0,0 +1,15 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Base class for all invocation outputs + */ +export type CollectInvocationOutput = { + type?: 'collect_output'; + /** + * The collection of input items + */ + collection: Array; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/CropImageInvocation.ts b/invokeai/frontend/web/src/services/api/models/CropImageInvocation.ts new file mode 100644 index 0000000000..2676f5cb87 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/CropImageInvocation.ts @@ -0,0 +1,37 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ImageField } from './ImageField'; + +/** + * Crops an image to a specified box. The box can be outside of the image. + */ +export type CropImageInvocation = { + /** + * The id of this node. Must be unique among all nodes. + */ + id: string; + type?: 'crop'; + /** + * The image to crop + */ + image?: ImageField; + /** + * The left x coordinate of the crop rectangle + */ + 'x'?: number; + /** + * The top y coordinate of the crop rectangle + */ + 'y'?: number; + /** + * The width of the crop rectangle + */ + width?: number; + /** + * The height of the crop rectangle + */ + height?: number; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/CvInpaintInvocation.ts b/invokeai/frontend/web/src/services/api/models/CvInpaintInvocation.ts new file mode 100644 index 0000000000..19342acf8f --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/CvInpaintInvocation.ts @@ -0,0 +1,25 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ImageField } from './ImageField'; + +/** + * Simple inpaint using opencv. + */ +export type CvInpaintInvocation = { + /** + * The id of this node. Must be unique among all nodes. + */ + id: string; + type?: 'cv_inpaint'; + /** + * The image to inpaint + */ + image?: ImageField; + /** + * The mask to use when inpainting + */ + mask?: ImageField; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/EdgeConnection.ts b/invokeai/frontend/web/src/services/api/models/EdgeConnection.ts new file mode 100644 index 0000000000..ecbddccd76 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/EdgeConnection.ts @@ -0,0 +1,15 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type EdgeConnection = { + /** + * The id of the node for this edge connection + */ + node_id: string; + /** + * The field for this connection + */ + field: string; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/Graph.ts b/invokeai/frontend/web/src/services/api/models/Graph.ts new file mode 100644 index 0000000000..9070de7588 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/Graph.ts @@ -0,0 +1,38 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { BlurInvocation } from './BlurInvocation'; +import type { CollectInvocation } from './CollectInvocation'; +import type { CropImageInvocation } from './CropImageInvocation'; +import type { CvInpaintInvocation } from './CvInpaintInvocation'; +import type { EdgeConnection } from './EdgeConnection'; +import type { GraphInvocation } from './GraphInvocation'; +import type { ImageToImageInvocation } from './ImageToImageInvocation'; +import type { InpaintInvocation } from './InpaintInvocation'; +import type { InverseLerpInvocation } from './InverseLerpInvocation'; +import type { IterateInvocation } from './IterateInvocation'; +import type { LerpInvocation } from './LerpInvocation'; +import type { LoadImageInvocation } from './LoadImageInvocation'; +import type { MaskFromAlphaInvocation } from './MaskFromAlphaInvocation'; +import type { PasteImageInvocation } from './PasteImageInvocation'; +import type { RestoreFaceInvocation } from './RestoreFaceInvocation'; +import type { ShowImageInvocation } from './ShowImageInvocation'; +import type { TextToImageInvocation } from './TextToImageInvocation'; +import type { UpscaleInvocation } from './UpscaleInvocation'; + +export type Graph = { + /** + * The id of this graph + */ + id?: string; + /** + * The nodes in this graph + */ + nodes?: Record; + /** + * The connections between nodes and their fields in this graph + */ + edges?: Array<[EdgeConnection, EdgeConnection]>; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/GraphExecutionState.ts b/invokeai/frontend/web/src/services/api/models/GraphExecutionState.ts new file mode 100644 index 0000000000..78c5e125c4 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/GraphExecutionState.ts @@ -0,0 +1,54 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { CollectInvocationOutput } from './CollectInvocationOutput'; +import type { Graph } from './Graph'; +import type { GraphInvocationOutput } from './GraphInvocationOutput'; +import type { ImageOutput } from './ImageOutput'; +import type { IterateInvocationOutput } from './IterateInvocationOutput'; +import type { MaskOutput } from './MaskOutput'; +import type { PromptOutput } from './PromptOutput'; + +/** + * Tracks the state of a graph execution + */ +export type GraphExecutionState = { + /** + * The id of the execution state + */ + id?: string; + /** + * The graph being executed + */ + graph: Graph; + /** + * The expanded graph of activated and executed nodes + */ + execution_graph?: Graph; + /** + * The set of node ids that have been executed + */ + executed?: Array; + /** + * The list of node ids that have been executed, in order of execution + */ + executed_history?: Array; + /** + * The results of node executions + */ + results?: Record; + /** + * Errors raised when executing nodes + */ + errors?: Record; + /** + * The map of prepared nodes to original graph nodes + */ + prepared_source_mapping?: Record; + /** + * The map of original graph nodes to prepared nodes + */ + source_prepared_mapping?: Record>; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/GraphInvocation.ts b/invokeai/frontend/web/src/services/api/models/GraphInvocation.ts new file mode 100644 index 0000000000..5109a49a68 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/GraphInvocation.ts @@ -0,0 +1,22 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { Graph } from './Graph'; + +/** + * A node to process inputs and produce outputs. + * May use dependency injection in __init__ to receive providers. + */ +export type GraphInvocation = { + /** + * The id of this node. Must be unique among all nodes. + */ + id: string; + type?: 'graph'; + /** + * The graph to run + */ + graph?: Graph; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/GraphInvocationOutput.ts b/invokeai/frontend/web/src/services/api/models/GraphInvocationOutput.ts new file mode 100644 index 0000000000..4be8e7eba6 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/GraphInvocationOutput.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Base class for all invocation outputs + */ +export type GraphInvocationOutput = { + type?: 'graph_output'; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/HTTPValidationError.ts b/invokeai/frontend/web/src/services/api/models/HTTPValidationError.ts new file mode 100644 index 0000000000..5e13adc4e5 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/HTTPValidationError.ts @@ -0,0 +1,10 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ValidationError } from './ValidationError'; + +export type HTTPValidationError = { + detail?: Array; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/ImageField.ts b/invokeai/frontend/web/src/services/api/models/ImageField.ts new file mode 100644 index 0000000000..10ef0092d4 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/ImageField.ts @@ -0,0 +1,18 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * An image field used for passing image objects between invocations + */ +export type ImageField = { + /** + * The type of the image + */ + image_type?: string; + /** + * The name of the image + */ + image_name?: string; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/ImageOutput.ts b/invokeai/frontend/web/src/services/api/models/ImageOutput.ts new file mode 100644 index 0000000000..f8ecd105d5 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/ImageOutput.ts @@ -0,0 +1,17 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ImageField } from './ImageField'; + +/** + * Base class for invocations that output an image + */ +export type ImageOutput = { + type?: 'image'; + /** + * The output image + */ + image?: ImageField; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/ImageToImageInvocation.ts b/invokeai/frontend/web/src/services/api/models/ImageToImageInvocation.ts new file mode 100644 index 0000000000..bb58ddb8ba --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/ImageToImageInvocation.ts @@ -0,0 +1,69 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ImageField } from './ImageField'; + +/** + * Generates an image using img2img. + */ +export type ImageToImageInvocation = { + /** + * The id of this node. Must be unique among all nodes. + */ + id: string; + type?: 'img2img'; + /** + * The prompt to generate an image from + */ + prompt?: string; + /** + * The seed to use (-1 for a random seed) + */ + seed?: number; + /** + * The number of steps to use to generate the image + */ + steps?: number; + /** + * The width of the resulting image + */ + width?: number; + /** + * The height of the resulting image + */ + height?: number; + /** + * The Classifier-Free Guidance, higher values may result in a result closer to the prompt + */ + cfg_scale?: number; + /** + * The sampler to use + */ + sampler_name?: 'ddim' | 'dpmpp_2' | 'k_dpm_2' | 'k_dpm_2_a' | 'k_dpmpp_2' | 'k_euler' | 'k_euler_a' | 'k_heun' | 'k_lms' | 'plms'; + /** + * Whether or not to generate an image that can tile without seams + */ + seamless?: boolean; + /** + * The model to use (currently ignored) + */ + model?: string; + /** + * Whether or not to produce progress images during generation + */ + progress_images?: boolean; + /** + * The input image + */ + image?: ImageField; + /** + * The strength of the original image + */ + strength?: number; + /** + * Whether or not the result should be fit to the aspect ratio of the input image + */ + fit?: boolean; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/ImageType.ts b/invokeai/frontend/web/src/services/api/models/ImageType.ts new file mode 100644 index 0000000000..b6468a1ed0 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/ImageType.ts @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * An enumeration. + */ +export type ImageType = 'results' | 'intermediates' | 'uploads'; diff --git a/invokeai/frontend/web/src/services/api/models/InpaintInvocation.ts b/invokeai/frontend/web/src/services/api/models/InpaintInvocation.ts new file mode 100644 index 0000000000..d7fb504c6f --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/InpaintInvocation.ts @@ -0,0 +1,77 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ImageField } from './ImageField'; + +/** + * Generates an image using inpaint. + */ +export type InpaintInvocation = { + /** + * The id of this node. Must be unique among all nodes. + */ + id: string; + type?: 'inpaint'; + /** + * The prompt to generate an image from + */ + prompt?: string; + /** + * The seed to use (-1 for a random seed) + */ + seed?: number; + /** + * The number of steps to use to generate the image + */ + steps?: number; + /** + * The width of the resulting image + */ + width?: number; + /** + * The height of the resulting image + */ + height?: number; + /** + * The Classifier-Free Guidance, higher values may result in a result closer to the prompt + */ + cfg_scale?: number; + /** + * The sampler to use + */ + sampler_name?: 'ddim' | 'dpmpp_2' | 'k_dpm_2' | 'k_dpm_2_a' | 'k_dpmpp_2' | 'k_euler' | 'k_euler_a' | 'k_heun' | 'k_lms' | 'plms'; + /** + * Whether or not to generate an image that can tile without seams + */ + seamless?: boolean; + /** + * The model to use (currently ignored) + */ + model?: string; + /** + * Whether or not to produce progress images during generation + */ + progress_images?: boolean; + /** + * The input image + */ + image?: ImageField; + /** + * The strength of the original image + */ + strength?: number; + /** + * Whether or not the result should be fit to the aspect ratio of the input image + */ + fit?: boolean; + /** + * The mask + */ + mask?: ImageField; + /** + * The amount by which to replace masked areas with latent noise + */ + inpaint_replace?: number; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/InverseLerpInvocation.ts b/invokeai/frontend/web/src/services/api/models/InverseLerpInvocation.ts new file mode 100644 index 0000000000..33c59b7bac --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/InverseLerpInvocation.ts @@ -0,0 +1,29 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ImageField } from './ImageField'; + +/** + * Inverse linear interpolation of all pixels of an image + */ +export type InverseLerpInvocation = { + /** + * The id of this node. Must be unique among all nodes. + */ + id: string; + type?: 'ilerp'; + /** + * The image to lerp + */ + image?: ImageField; + /** + * The minimum input value + */ + min?: number; + /** + * The maximum input value + */ + max?: number; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/IterateInvocation.ts b/invokeai/frontend/web/src/services/api/models/IterateInvocation.ts new file mode 100644 index 0000000000..0ff7a1258d --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/IterateInvocation.ts @@ -0,0 +1,24 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * A node to process inputs and produce outputs. + * May use dependency injection in __init__ to receive providers. + */ +export type IterateInvocation = { + /** + * The id of this node. Must be unique among all nodes. + */ + id: string; + type?: 'iterate'; + /** + * The list of items to iterate over + */ + collection?: Array; + /** + * The index, will be provided on executed iterators + */ + index?: number; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/IterateInvocationOutput.ts b/invokeai/frontend/web/src/services/api/models/IterateInvocationOutput.ts new file mode 100644 index 0000000000..0aca6dda72 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/IterateInvocationOutput.ts @@ -0,0 +1,15 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Used to connect iteration outputs. Will be expanded to a specific output. + */ +export type IterateInvocationOutput = { + type?: 'iterate_output'; + /** + * The item being iterated over + */ + item?: any; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/LerpInvocation.ts b/invokeai/frontend/web/src/services/api/models/LerpInvocation.ts new file mode 100644 index 0000000000..f2406c2246 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/LerpInvocation.ts @@ -0,0 +1,29 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ImageField } from './ImageField'; + +/** + * Linear interpolation of all pixels of an image + */ +export type LerpInvocation = { + /** + * The id of this node. Must be unique among all nodes. + */ + id: string; + type?: 'lerp'; + /** + * The image to lerp + */ + image?: ImageField; + /** + * The minimum output value + */ + min?: number; + /** + * The maximum output value + */ + max?: number; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/LoadImageInvocation.ts b/invokeai/frontend/web/src/services/api/models/LoadImageInvocation.ts new file mode 100644 index 0000000000..084e3f7bf7 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/LoadImageInvocation.ts @@ -0,0 +1,25 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ImageType } from './ImageType'; + +/** + * Load an image from a filename and provide it as output. + */ +export type LoadImageInvocation = { + /** + * The id of this node. Must be unique among all nodes. + */ + id: string; + type?: 'load_image'; + /** + * The type of the image + */ + image_type: ImageType; + /** + * The name of the image + */ + image_name: string; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/MaskFromAlphaInvocation.ts b/invokeai/frontend/web/src/services/api/models/MaskFromAlphaInvocation.ts new file mode 100644 index 0000000000..e71b1f464b --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/MaskFromAlphaInvocation.ts @@ -0,0 +1,25 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ImageField } from './ImageField'; + +/** + * Extracts the alpha channel of an image as a mask. + */ +export type MaskFromAlphaInvocation = { + /** + * The id of this node. Must be unique among all nodes. + */ + id: string; + type?: 'tomask'; + /** + * The image to create the mask from + */ + image?: ImageField; + /** + * Whether or not to invert the mask + */ + invert?: boolean; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/MaskOutput.ts b/invokeai/frontend/web/src/services/api/models/MaskOutput.ts new file mode 100644 index 0000000000..ac5b197a74 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/MaskOutput.ts @@ -0,0 +1,17 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ImageField } from './ImageField'; + +/** + * Base class for invocations that output a mask + */ +export type MaskOutput = { + type?: 'mask'; + /** + * The output mask + */ + mask?: ImageField; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/PaginatedResults_GraphExecutionState_.ts b/invokeai/frontend/web/src/services/api/models/PaginatedResults_GraphExecutionState_.ts new file mode 100644 index 0000000000..dd9f50cd4a --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/PaginatedResults_GraphExecutionState_.ts @@ -0,0 +1,32 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { GraphExecutionState } from './GraphExecutionState'; + +/** + * Paginated results + */ +export type PaginatedResults_GraphExecutionState_ = { + /** + * Items + */ + items: Array; + /** + * Current Page + */ + page: number; + /** + * Total number of pages + */ + pages: number; + /** + * Number of items per page + */ + per_page: number; + /** + * Total number of items in result + */ + total: number; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/PasteImageInvocation.ts b/invokeai/frontend/web/src/services/api/models/PasteImageInvocation.ts new file mode 100644 index 0000000000..8a181ccf07 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/PasteImageInvocation.ts @@ -0,0 +1,37 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ImageField } from './ImageField'; + +/** + * Pastes an image into another image. + */ +export type PasteImageInvocation = { + /** + * The id of this node. Must be unique among all nodes. + */ + id: string; + type?: 'paste'; + /** + * The base image + */ + base_image?: ImageField; + /** + * The image to paste + */ + image?: ImageField; + /** + * The mask to use when pasting + */ + mask?: ImageField; + /** + * The left x coordinate at which to paste the image + */ + 'x'?: number; + /** + * The top y coordinate at which to paste the image + */ + 'y'?: number; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/PromptOutput.ts b/invokeai/frontend/web/src/services/api/models/PromptOutput.ts new file mode 100644 index 0000000000..658dcb6a3a --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/PromptOutput.ts @@ -0,0 +1,15 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Base class for invocations that output a prompt + */ +export type PromptOutput = { + type?: 'prompt'; + /** + * The output prompt + */ + prompt?: string; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/RestoreFaceInvocation.ts b/invokeai/frontend/web/src/services/api/models/RestoreFaceInvocation.ts new file mode 100644 index 0000000000..e03ed01c81 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/RestoreFaceInvocation.ts @@ -0,0 +1,25 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ImageField } from './ImageField'; + +/** + * Restores faces in an image. + */ +export type RestoreFaceInvocation = { + /** + * The id of this node. Must be unique among all nodes. + */ + id: string; + type?: 'restore_face'; + /** + * The input image + */ + image?: ImageField; + /** + * The strength of the restoration + */ + strength?: number; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/ShowImageInvocation.ts b/invokeai/frontend/web/src/services/api/models/ShowImageInvocation.ts new file mode 100644 index 0000000000..145895ad75 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/ShowImageInvocation.ts @@ -0,0 +1,21 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ImageField } from './ImageField'; + +/** + * Displays a provided image, and passes it forward in the pipeline. + */ +export type ShowImageInvocation = { + /** + * The id of this node. Must be unique among all nodes. + */ + id: string; + type?: 'show_image'; + /** + * The image to show + */ + image?: ImageField; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/TextToImageInvocation.ts b/invokeai/frontend/web/src/services/api/models/TextToImageInvocation.ts new file mode 100644 index 0000000000..14485ca206 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/TextToImageInvocation.ts @@ -0,0 +1,55 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Generates an image using text2img. + */ +export type TextToImageInvocation = { + /** + * The id of this node. Must be unique among all nodes. + */ + id: string; + type?: 'txt2img'; + /** + * The prompt to generate an image from + */ + prompt?: string; + /** + * The seed to use (-1 for a random seed) + */ + seed?: number; + /** + * The number of steps to use to generate the image + */ + steps?: number; + /** + * The width of the resulting image + */ + width?: number; + /** + * The height of the resulting image + */ + height?: number; + /** + * The Classifier-Free Guidance, higher values may result in a result closer to the prompt + */ + cfg_scale?: number; + /** + * The sampler to use + */ + sampler_name?: 'ddim' | 'dpmpp_2' | 'k_dpm_2' | 'k_dpm_2_a' | 'k_dpmpp_2' | 'k_euler' | 'k_euler_a' | 'k_heun' | 'k_lms' | 'plms'; + /** + * Whether or not to generate an image that can tile without seams + */ + seamless?: boolean; + /** + * The model to use (currently ignored) + */ + model?: string; + /** + * Whether or not to produce progress images during generation + */ + progress_images?: boolean; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/UpscaleInvocation.ts b/invokeai/frontend/web/src/services/api/models/UpscaleInvocation.ts new file mode 100644 index 0000000000..8416c2454d --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/UpscaleInvocation.ts @@ -0,0 +1,29 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ImageField } from './ImageField'; + +/** + * Upscales an image. + */ +export type UpscaleInvocation = { + /** + * The id of this node. Must be unique among all nodes. + */ + id: string; + type?: 'upscale'; + /** + * The input image + */ + image?: ImageField; + /** + * The strength + */ + strength?: number; + /** + * The upscale level + */ + level?: 2 | 4; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/ValidationError.ts b/invokeai/frontend/web/src/services/api/models/ValidationError.ts new file mode 100644 index 0000000000..14e1fdecd0 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/ValidationError.ts @@ -0,0 +1,10 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type ValidationError = { + loc: Array<(string | number)>; + msg: string; + type: string; +}; + diff --git a/invokeai/frontend/web/src/services/api/openapi.json b/invokeai/frontend/web/src/services/api/openapi.json new file mode 100644 index 0000000000..482256e696 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/openapi.json @@ -0,0 +1 @@ +{"openapi": "3.0.2", "info": {"title": "Invoke AI", "version": "0.1.0"}, "paths": {"/api/v1/sessions/": {"get": {"tags": ["sessions"], "summary": "List Sessions", "description": "Gets a list of sessions, optionally searching", "operationId": "list_sessions", "parameters": [{"description": "The page of results to get", "required": false, "schema": {"title": "Page", "type": "integer", "description": "The page of results to get", "default": 0}, "name": "page", "in": "query"}, {"description": "The number of results per page", "required": false, "schema": {"title": "Per Page", "type": "integer", "description": "The number of results per page", "default": 10}, "name": "per_page", "in": "query"}, {"description": "The query string to search for", "required": false, "schema": {"title": "Query", "type": "string", "description": "The query string to search for", "default": ""}, "name": "query", "in": "query"}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/PaginatedResults_GraphExecutionState_"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "post": {"tags": ["sessions"], "summary": "Create Session", "description": "Creates a new session, optionally initializing it with an invocation graph", "operationId": "create_session", "requestBody": {"content": {"application/json": {"schema": {"title": "Graph", "allOf": [{"$ref": "#/components/schemas/Graph"}], "description": "The graph to initialize the session with"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/GraphExecutionState"}}}}, "400": {"description": "Invalid json"}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/sessions/{session_id}": {"get": {"tags": ["sessions"], "summary": "Get Session", "description": "Gets a session", "operationId": "get_session", "parameters": [{"description": "The id of the session to get", "required": true, "schema": {"title": "Session Id", "type": "string", "description": "The id of the session to get"}, "name": "session_id", "in": "path"}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/GraphExecutionState"}}}}, "404": {"description": "Session not found"}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/sessions/{session_id}/nodes": {"post": {"tags": ["sessions"], "summary": "Add Node", "description": "Adds a node to the graph", "operationId": "add_node", "parameters": [{"description": "The id of the session", "required": true, "schema": {"title": "Session Id", "type": "string", "description": "The id of the session"}, "name": "session_id", "in": "path"}], "requestBody": {"content": {"application/json": {"schema": {"title": "Node", "anyOf": [{"$ref": "#/components/schemas/LoadImageInvocation"}, {"$ref": "#/components/schemas/ShowImageInvocation"}, {"$ref": "#/components/schemas/CropImageInvocation"}, {"$ref": "#/components/schemas/PasteImageInvocation"}, {"$ref": "#/components/schemas/MaskFromAlphaInvocation"}, {"$ref": "#/components/schemas/BlurInvocation"}, {"$ref": "#/components/schemas/LerpInvocation"}, {"$ref": "#/components/schemas/InverseLerpInvocation"}, {"$ref": "#/components/schemas/CvInpaintInvocation"}, {"$ref": "#/components/schemas/UpscaleInvocation"}, {"$ref": "#/components/schemas/RestoreFaceInvocation"}, {"$ref": "#/components/schemas/TextToImageInvocation"}, {"$ref": "#/components/schemas/GraphInvocation"}, {"$ref": "#/components/schemas/IterateInvocation"}, {"$ref": "#/components/schemas/CollectInvocation"}, {"$ref": "#/components/schemas/ImageToImageInvocation"}, {"$ref": "#/components/schemas/InpaintInvocation"}], "description": "The node to add"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"title": "Response 200 Add Node", "type": "string"}}}}, "400": {"description": "Invalid node or link"}, "404": {"description": "Session not found"}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/sessions/{session_id}/nodes/{node_path}": {"put": {"tags": ["sessions"], "summary": "Update Node", "description": "Updates a node in the graph and removes all linked edges", "operationId": "update_node", "parameters": [{"description": "The id of the session", "required": true, "schema": {"title": "Session Id", "type": "string", "description": "The id of the session"}, "name": "session_id", "in": "path"}, {"description": "The path to the node in the graph", "required": true, "schema": {"title": "Node Path", "type": "string", "description": "The path to the node in the graph"}, "name": "node_path", "in": "path"}], "requestBody": {"content": {"application/json": {"schema": {"title": "Node", "anyOf": [{"$ref": "#/components/schemas/LoadImageInvocation"}, {"$ref": "#/components/schemas/ShowImageInvocation"}, {"$ref": "#/components/schemas/CropImageInvocation"}, {"$ref": "#/components/schemas/PasteImageInvocation"}, {"$ref": "#/components/schemas/MaskFromAlphaInvocation"}, {"$ref": "#/components/schemas/BlurInvocation"}, {"$ref": "#/components/schemas/LerpInvocation"}, {"$ref": "#/components/schemas/InverseLerpInvocation"}, {"$ref": "#/components/schemas/CvInpaintInvocation"}, {"$ref": "#/components/schemas/UpscaleInvocation"}, {"$ref": "#/components/schemas/RestoreFaceInvocation"}, {"$ref": "#/components/schemas/TextToImageInvocation"}, {"$ref": "#/components/schemas/GraphInvocation"}, {"$ref": "#/components/schemas/IterateInvocation"}, {"$ref": "#/components/schemas/CollectInvocation"}, {"$ref": "#/components/schemas/ImageToImageInvocation"}, {"$ref": "#/components/schemas/InpaintInvocation"}], "description": "The new node"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/GraphExecutionState"}}}}, "400": {"description": "Invalid node or link"}, "404": {"description": "Session not found"}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "delete": {"tags": ["sessions"], "summary": "Delete Node", "description": "Deletes a node in the graph and removes all linked edges", "operationId": "delete_node", "parameters": [{"description": "The id of the session", "required": true, "schema": {"title": "Session Id", "type": "string", "description": "The id of the session"}, "name": "session_id", "in": "path"}, {"description": "The path to the node to delete", "required": true, "schema": {"title": "Node Path", "type": "string", "description": "The path to the node to delete"}, "name": "node_path", "in": "path"}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/GraphExecutionState"}}}}, "400": {"description": "Invalid node or link"}, "404": {"description": "Session not found"}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/sessions/{session_id}/edges": {"post": {"tags": ["sessions"], "summary": "Add Edge", "description": "Adds an edge to the graph", "operationId": "add_edge", "parameters": [{"description": "The id of the session", "required": true, "schema": {"title": "Session Id", "type": "string", "description": "The id of the session"}, "name": "session_id", "in": "path"}], "requestBody": {"content": {"application/json": {"schema": {"title": "Edge", "maxItems": 2, "minItems": 2, "type": "array", "items": [{"$ref": "#/components/schemas/EdgeConnection"}, {"$ref": "#/components/schemas/EdgeConnection"}], "description": "The edge to add"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/GraphExecutionState"}}}}, "400": {"description": "Invalid node or link"}, "404": {"description": "Session not found"}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/sessions/{session_id}/edges/{from_node_id}/{from_field}/{to_node_id}/{to_field}": {"delete": {"tags": ["sessions"], "summary": "Delete Edge", "description": "Deletes an edge from the graph", "operationId": "delete_edge", "parameters": [{"description": "The id of the session", "required": true, "schema": {"title": "Session Id", "type": "string", "description": "The id of the session"}, "name": "session_id", "in": "path"}, {"description": "The id of the node the edge is coming from", "required": true, "schema": {"title": "From Node Id", "type": "string", "description": "The id of the node the edge is coming from"}, "name": "from_node_id", "in": "path"}, {"description": "The field of the node the edge is coming from", "required": true, "schema": {"title": "From Field", "type": "string", "description": "The field of the node the edge is coming from"}, "name": "from_field", "in": "path"}, {"description": "The id of the node the edge is going to", "required": true, "schema": {"title": "To Node Id", "type": "string", "description": "The id of the node the edge is going to"}, "name": "to_node_id", "in": "path"}, {"description": "The field of the node the edge is going to", "required": true, "schema": {"title": "To Field", "type": "string", "description": "The field of the node the edge is going to"}, "name": "to_field", "in": "path"}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/GraphExecutionState"}}}}, "400": {"description": "Invalid node or link"}, "404": {"description": "Session not found"}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/sessions/{session_id}/invoke": {"put": {"tags": ["sessions"], "summary": "Invoke Session", "description": "Invokes a session", "operationId": "invoke_session", "parameters": [{"description": "The id of the session to invoke", "required": true, "schema": {"title": "Session Id", "type": "string", "description": "The id of the session to invoke"}, "name": "session_id", "in": "path"}, {"description": "Whether or not to invoke all remaining invocations", "required": false, "schema": {"title": "All", "type": "boolean", "description": "Whether or not to invoke all remaining invocations", "default": false}, "name": "all", "in": "query"}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "202": {"description": "The invocation is queued"}, "400": {"description": "The session has no invocations ready to invoke"}, "404": {"description": "Session not found"}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/images/{image_type}/{image_name}": {"get": {"tags": ["images"], "summary": "Get Image", "description": "Gets a result", "operationId": "get_image", "parameters": [{"description": "The type of image to get", "required": true, "schema": {"allOf": [{"$ref": "#/components/schemas/ImageType"}], "description": "The type of image to get"}, "name": "image_type", "in": "path"}, {"description": "The name of the image to get", "required": true, "schema": {"title": "Image Name", "type": "string", "description": "The name of the image to get"}, "name": "image_name", "in": "path"}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/api/v1/images/uploads/": {"post": {"tags": ["images"], "summary": "Upload Image", "operationId": "upload_image", "requestBody": {"content": {"multipart/form-data": {"schema": {"$ref": "#/components/schemas/Body_upload_image"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "201": {"description": "The image was uploaded successfully"}, "404": {"description": "Session not found"}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}}, "components": {"schemas": {"BlurInvocation": {"title": "BlurInvocation", "required": ["id"], "type": "object", "properties": {"id": {"title": "Id", "type": "string", "description": "The id of this node. Must be unique among all nodes."}, "type": {"title": "Type", "enum": ["blur"], "type": "string", "default": "blur"}, "image": {"title": "Image", "allOf": [{"$ref": "#/components/schemas/ImageField"}], "description": "The image to blur"}, "radius": {"title": "Radius", "minimum": 0.0, "type": "number", "description": "The blur radius", "default": 8.0}, "blur_type": {"title": "Blur Type", "enum": ["gaussian", "box"], "type": "string", "description": "The type of blur", "default": "gaussian"}}, "description": "Blurs an image"}, "Body_upload_image": {"title": "Body_upload_image", "required": ["file"], "type": "object", "properties": {"file": {"title": "File", "type": "string", "format": "binary"}}}, "CollectInvocation": {"title": "CollectInvocation", "required": ["id"], "type": "object", "properties": {"id": {"title": "Id", "type": "string", "description": "The id of this node. Must be unique among all nodes."}, "type": {"title": "Type", "enum": ["collect"], "type": "string", "default": "collect"}, "item": {"title": "Item", "description": "The item to collect (all inputs must be of the same type)"}, "collection": {"title": "Collection", "type": "array", "items": {}, "description": "The collection, will be provided on execution"}}, "description": "Collects values into a collection"}, "CollectInvocationOutput": {"title": "CollectInvocationOutput", "required": ["collection"], "type": "object", "properties": {"type": {"title": "Type", "enum": ["collect_output"], "type": "string", "default": "collect_output"}, "collection": {"title": "Collection", "type": "array", "items": {}, "description": "The collection of input items"}}, "description": "Base class for all invocation outputs"}, "CropImageInvocation": {"title": "CropImageInvocation", "required": ["id"], "type": "object", "properties": {"id": {"title": "Id", "type": "string", "description": "The id of this node. Must be unique among all nodes."}, "type": {"title": "Type", "enum": ["crop"], "type": "string", "default": "crop"}, "image": {"title": "Image", "allOf": [{"$ref": "#/components/schemas/ImageField"}], "description": "The image to crop"}, "x": {"title": "X", "type": "integer", "description": "The left x coordinate of the crop rectangle", "default": 0}, "y": {"title": "Y", "type": "integer", "description": "The top y coordinate of the crop rectangle", "default": 0}, "width": {"title": "Width", "exclusiveMinimum": 0.0, "type": "integer", "description": "The width of the crop rectangle", "default": 512}, "height": {"title": "Height", "exclusiveMinimum": 0.0, "type": "integer", "description": "The height of the crop rectangle", "default": 512}}, "description": "Crops an image to a specified box. The box can be outside of the image."}, "CvInpaintInvocation": {"title": "CvInpaintInvocation", "required": ["id"], "type": "object", "properties": {"id": {"title": "Id", "type": "string", "description": "The id of this node. Must be unique among all nodes."}, "type": {"title": "Type", "enum": ["cv_inpaint"], "type": "string", "default": "cv_inpaint"}, "image": {"title": "Image", "allOf": [{"$ref": "#/components/schemas/ImageField"}], "description": "The image to inpaint"}, "mask": {"title": "Mask", "allOf": [{"$ref": "#/components/schemas/ImageField"}], "description": "The mask to use when inpainting"}}, "description": "Simple inpaint using opencv."}, "EdgeConnection": {"title": "EdgeConnection", "required": ["node_id", "field"], "type": "object", "properties": {"node_id": {"title": "Node Id", "type": "string", "description": "The id of the node for this edge connection"}, "field": {"title": "Field", "type": "string", "description": "The field for this connection"}}}, "Graph": {"title": "Graph", "type": "object", "properties": {"id": {"title": "Id", "type": "string", "description": "The id of this graph"}, "nodes": {"title": "Nodes", "type": "object", "additionalProperties": {"oneOf": [{"$ref": "#/components/schemas/LoadImageInvocation"}, {"$ref": "#/components/schemas/ShowImageInvocation"}, {"$ref": "#/components/schemas/CropImageInvocation"}, {"$ref": "#/components/schemas/PasteImageInvocation"}, {"$ref": "#/components/schemas/MaskFromAlphaInvocation"}, {"$ref": "#/components/schemas/BlurInvocation"}, {"$ref": "#/components/schemas/LerpInvocation"}, {"$ref": "#/components/schemas/InverseLerpInvocation"}, {"$ref": "#/components/schemas/CvInpaintInvocation"}, {"$ref": "#/components/schemas/UpscaleInvocation"}, {"$ref": "#/components/schemas/RestoreFaceInvocation"}, {"$ref": "#/components/schemas/TextToImageInvocation"}, {"$ref": "#/components/schemas/GraphInvocation"}, {"$ref": "#/components/schemas/IterateInvocation"}, {"$ref": "#/components/schemas/CollectInvocation"}, {"$ref": "#/components/schemas/ImageToImageInvocation"}, {"$ref": "#/components/schemas/InpaintInvocation"}], "discriminator": {"propertyName": "type", "mapping": {"load_image": "#/components/schemas/LoadImageInvocation", "show_image": "#/components/schemas/ShowImageInvocation", "crop": "#/components/schemas/CropImageInvocation", "paste": "#/components/schemas/PasteImageInvocation", "tomask": "#/components/schemas/MaskFromAlphaInvocation", "blur": "#/components/schemas/BlurInvocation", "lerp": "#/components/schemas/LerpInvocation", "ilerp": "#/components/schemas/InverseLerpInvocation", "cv_inpaint": "#/components/schemas/CvInpaintInvocation", "upscale": "#/components/schemas/UpscaleInvocation", "restore_face": "#/components/schemas/RestoreFaceInvocation", "txt2img": "#/components/schemas/TextToImageInvocation", "graph": "#/components/schemas/GraphInvocation", "iterate": "#/components/schemas/IterateInvocation", "collect": "#/components/schemas/CollectInvocation", "img2img": "#/components/schemas/ImageToImageInvocation", "inpaint": "#/components/schemas/InpaintInvocation"}}}, "description": "The nodes in this graph"}, "edges": {"title": "Edges", "type": "array", "items": {"maxItems": 2, "minItems": 2, "type": "array", "items": [{"$ref": "#/components/schemas/EdgeConnection"}, {"$ref": "#/components/schemas/EdgeConnection"}]}, "description": "The connections between nodes and their fields in this graph"}}}, "GraphExecutionState": {"title": "GraphExecutionState", "required": ["graph"], "type": "object", "properties": {"id": {"title": "Id", "type": "string", "description": "The id of the execution state"}, "graph": {"title": "Graph", "allOf": [{"$ref": "#/components/schemas/Graph"}], "description": "The graph being executed"}, "execution_graph": {"title": "Execution Graph", "allOf": [{"$ref": "#/components/schemas/Graph"}], "description": "The expanded graph of activated and executed nodes"}, "executed": {"title": "Executed", "uniqueItems": true, "type": "array", "items": {"type": "string"}, "description": "The set of node ids that have been executed"}, "executed_history": {"title": "Executed History", "type": "array", "items": {"type": "string"}, "description": "The list of node ids that have been executed, in order of execution"}, "results": {"title": "Results", "type": "object", "additionalProperties": {"oneOf": [{"$ref": "#/components/schemas/ImageOutput"}, {"$ref": "#/components/schemas/MaskOutput"}, {"$ref": "#/components/schemas/PromptOutput"}, {"$ref": "#/components/schemas/GraphInvocationOutput"}, {"$ref": "#/components/schemas/IterateInvocationOutput"}, {"$ref": "#/components/schemas/CollectInvocationOutput"}], "discriminator": {"propertyName": "type", "mapping": {"image": "#/components/schemas/ImageOutput", "mask": "#/components/schemas/MaskOutput", "prompt": "#/components/schemas/PromptOutput", "graph_output": "#/components/schemas/GraphInvocationOutput", "iterate_output": "#/components/schemas/IterateInvocationOutput", "collect_output": "#/components/schemas/CollectInvocationOutput"}}}, "description": "The results of node executions"}, "errors": {"title": "Errors", "type": "object", "additionalProperties": {"type": "string"}, "description": "Errors raised when executing nodes"}, "prepared_source_mapping": {"title": "Prepared Source Mapping", "type": "object", "additionalProperties": {"type": "string"}, "description": "The map of prepared nodes to original graph nodes"}, "source_prepared_mapping": {"title": "Source Prepared Mapping", "type": "object", "additionalProperties": {"uniqueItems": true, "type": "array", "items": {"type": "string"}}, "description": "The map of original graph nodes to prepared nodes"}}, "description": "Tracks the state of a graph execution"}, "GraphInvocation": {"title": "GraphInvocation", "required": ["id"], "type": "object", "properties": {"id": {"title": "Id", "type": "string", "description": "The id of this node. Must be unique among all nodes."}, "type": {"title": "Type", "enum": ["graph"], "type": "string", "default": "graph"}, "graph": {"title": "Graph", "allOf": [{"$ref": "#/components/schemas/Graph"}], "description": "The graph to run"}}, "description": "A node to process inputs and produce outputs.\nMay use dependency injection in __init__ to receive providers."}, "GraphInvocationOutput": {"title": "GraphInvocationOutput", "type": "object", "properties": {"type": {"title": "Type", "enum": ["graph_output"], "type": "string", "default": "graph_output"}}, "description": "Base class for all invocation outputs"}, "HTTPValidationError": {"title": "HTTPValidationError", "type": "object", "properties": {"detail": {"title": "Detail", "type": "array", "items": {"$ref": "#/components/schemas/ValidationError"}}}}, "ImageField": {"title": "ImageField", "type": "object", "properties": {"image_type": {"title": "Image Type", "type": "string", "description": "The type of the image", "default": "results"}, "image_name": {"title": "Image Name", "type": "string", "description": "The name of the image"}}, "description": "An image field used for passing image objects between invocations"}, "ImageOutput": {"title": "ImageOutput", "type": "object", "properties": {"type": {"title": "Type", "enum": ["image"], "type": "string", "default": "image"}, "image": {"title": "Image", "allOf": [{"$ref": "#/components/schemas/ImageField"}], "description": "The output image"}}, "description": "Base class for invocations that output an image"}, "ImageToImageInvocation": {"title": "ImageToImageInvocation", "required": ["id"], "type": "object", "properties": {"id": {"title": "Id", "type": "string", "description": "The id of this node. Must be unique among all nodes."}, "type": {"title": "Type", "enum": ["img2img"], "type": "string", "default": "img2img"}, "prompt": {"title": "Prompt", "type": "string", "description": "The prompt to generate an image from"}, "seed": {"title": "Seed", "maximum": 4294967295.0, "minimum": -1.0, "type": "integer", "description": "The seed to use (-1 for a random seed)", "default": -1}, "steps": {"title": "Steps", "exclusiveMinimum": 0.0, "type": "integer", "description": "The number of steps to use to generate the image", "default": 10}, "width": {"title": "Width", "multipleOf": 64.0, "exclusiveMinimum": 0.0, "type": "integer", "description": "The width of the resulting image", "default": 512}, "height": {"title": "Height", "multipleOf": 64.0, "exclusiveMinimum": 0.0, "type": "integer", "description": "The height of the resulting image", "default": 512}, "cfg_scale": {"title": "Cfg Scale", "exclusiveMinimum": 0.0, "type": "number", "description": "The Classifier-Free Guidance, higher values may result in a result closer to the prompt", "default": 7.5}, "sampler_name": {"title": "Sampler Name", "enum": ["ddim", "dpmpp_2", "k_dpm_2", "k_dpm_2_a", "k_dpmpp_2", "k_euler", "k_euler_a", "k_heun", "k_lms", "plms"], "type": "string", "description": "The sampler to use", "default": "k_lms"}, "seamless": {"title": "Seamless", "type": "boolean", "description": "Whether or not to generate an image that can tile without seams", "default": false}, "model": {"title": "Model", "type": "string", "description": "The model to use (currently ignored)", "default": ""}, "progress_images": {"title": "Progress Images", "type": "boolean", "description": "Whether or not to produce progress images during generation", "default": false}, "image": {"title": "Image", "allOf": [{"$ref": "#/components/schemas/ImageField"}], "description": "The input image"}, "strength": {"title": "Strength", "maximum": 1.0, "exclusiveMinimum": 0.0, "type": "number", "description": "The strength of the original image", "default": 0.75}, "fit": {"title": "Fit", "type": "boolean", "description": "Whether or not the result should be fit to the aspect ratio of the input image", "default": true}}, "description": "Generates an image using img2img."}, "ImageType": {"title": "ImageType", "enum": ["results", "intermediates", "uploads"], "type": "string", "description": "An enumeration."}, "InpaintInvocation": {"title": "InpaintInvocation", "required": ["id"], "type": "object", "properties": {"id": {"title": "Id", "type": "string", "description": "The id of this node. Must be unique among all nodes."}, "type": {"title": "Type", "enum": ["inpaint"], "type": "string", "default": "inpaint"}, "prompt": {"title": "Prompt", "type": "string", "description": "The prompt to generate an image from"}, "seed": {"title": "Seed", "maximum": 4294967295.0, "minimum": -1.0, "type": "integer", "description": "The seed to use (-1 for a random seed)", "default": -1}, "steps": {"title": "Steps", "exclusiveMinimum": 0.0, "type": "integer", "description": "The number of steps to use to generate the image", "default": 10}, "width": {"title": "Width", "multipleOf": 64.0, "exclusiveMinimum": 0.0, "type": "integer", "description": "The width of the resulting image", "default": 512}, "height": {"title": "Height", "multipleOf": 64.0, "exclusiveMinimum": 0.0, "type": "integer", "description": "The height of the resulting image", "default": 512}, "cfg_scale": {"title": "Cfg Scale", "exclusiveMinimum": 0.0, "type": "number", "description": "The Classifier-Free Guidance, higher values may result in a result closer to the prompt", "default": 7.5}, "sampler_name": {"title": "Sampler Name", "enum": ["ddim", "dpmpp_2", "k_dpm_2", "k_dpm_2_a", "k_dpmpp_2", "k_euler", "k_euler_a", "k_heun", "k_lms", "plms"], "type": "string", "description": "The sampler to use", "default": "k_lms"}, "seamless": {"title": "Seamless", "type": "boolean", "description": "Whether or not to generate an image that can tile without seams", "default": false}, "model": {"title": "Model", "type": "string", "description": "The model to use (currently ignored)", "default": ""}, "progress_images": {"title": "Progress Images", "type": "boolean", "description": "Whether or not to produce progress images during generation", "default": false}, "image": {"title": "Image", "allOf": [{"$ref": "#/components/schemas/ImageField"}], "description": "The input image"}, "strength": {"title": "Strength", "maximum": 1.0, "exclusiveMinimum": 0.0, "type": "number", "description": "The strength of the original image", "default": 0.75}, "fit": {"title": "Fit", "type": "boolean", "description": "Whether or not the result should be fit to the aspect ratio of the input image", "default": true}, "mask": {"title": "Mask", "allOf": [{"$ref": "#/components/schemas/ImageField"}], "description": "The mask"}, "inpaint_replace": {"title": "Inpaint Replace", "maximum": 1.0, "minimum": 0.0, "type": "number", "description": "The amount by which to replace masked areas with latent noise", "default": 0.0}}, "description": "Generates an image using inpaint."}, "InverseLerpInvocation": {"title": "InverseLerpInvocation", "required": ["id"], "type": "object", "properties": {"id": {"title": "Id", "type": "string", "description": "The id of this node. Must be unique among all nodes."}, "type": {"title": "Type", "enum": ["ilerp"], "type": "string", "default": "ilerp"}, "image": {"title": "Image", "allOf": [{"$ref": "#/components/schemas/ImageField"}], "description": "The image to lerp"}, "min": {"title": "Min", "maximum": 255.0, "minimum": 0.0, "type": "integer", "description": "The minimum input value", "default": 0}, "max": {"title": "Max", "maximum": 255.0, "minimum": 0.0, "type": "integer", "description": "The maximum input value", "default": 255}}, "description": "Inverse linear interpolation of all pixels of an image"}, "IterateInvocation": {"title": "IterateInvocation", "required": ["id"], "type": "object", "properties": {"id": {"title": "Id", "type": "string", "description": "The id of this node. Must be unique among all nodes."}, "type": {"title": "Type", "enum": ["iterate"], "type": "string", "default": "iterate"}, "collection": {"title": "Collection", "type": "array", "items": {}, "description": "The list of items to iterate over"}, "index": {"title": "Index", "type": "integer", "description": "The index, will be provided on executed iterators", "default": 0}}, "description": "A node to process inputs and produce outputs.\nMay use dependency injection in __init__ to receive providers."}, "IterateInvocationOutput": {"title": "IterateInvocationOutput", "type": "object", "properties": {"type": {"title": "Type", "enum": ["iterate_output"], "type": "string", "default": "iterate_output"}, "item": {"title": "Item", "description": "The item being iterated over"}}, "description": "Used to connect iteration outputs. Will be expanded to a specific output."}, "LerpInvocation": {"title": "LerpInvocation", "required": ["id"], "type": "object", "properties": {"id": {"title": "Id", "type": "string", "description": "The id of this node. Must be unique among all nodes."}, "type": {"title": "Type", "enum": ["lerp"], "type": "string", "default": "lerp"}, "image": {"title": "Image", "allOf": [{"$ref": "#/components/schemas/ImageField"}], "description": "The image to lerp"}, "min": {"title": "Min", "maximum": 255.0, "minimum": 0.0, "type": "integer", "description": "The minimum output value", "default": 0}, "max": {"title": "Max", "maximum": 255.0, "minimum": 0.0, "type": "integer", "description": "The maximum output value", "default": 255}}, "description": "Linear interpolation of all pixels of an image"}, "LoadImageInvocation": {"title": "LoadImageInvocation", "required": ["id", "image_type", "image_name"], "type": "object", "properties": {"id": {"title": "Id", "type": "string", "description": "The id of this node. Must be unique among all nodes."}, "type": {"title": "Type", "enum": ["load_image"], "type": "string", "default": "load_image"}, "image_type": {"allOf": [{"$ref": "#/components/schemas/ImageType"}], "description": "The type of the image"}, "image_name": {"title": "Image Name", "type": "string", "description": "The name of the image"}}, "description": "Load an image from a filename and provide it as output."}, "MaskFromAlphaInvocation": {"title": "MaskFromAlphaInvocation", "required": ["id"], "type": "object", "properties": {"id": {"title": "Id", "type": "string", "description": "The id of this node. Must be unique among all nodes."}, "type": {"title": "Type", "enum": ["tomask"], "type": "string", "default": "tomask"}, "image": {"title": "Image", "allOf": [{"$ref": "#/components/schemas/ImageField"}], "description": "The image to create the mask from"}, "invert": {"title": "Invert", "type": "boolean", "description": "Whether or not to invert the mask", "default": false}}, "description": "Extracts the alpha channel of an image as a mask."}, "MaskOutput": {"title": "MaskOutput", "type": "object", "properties": {"type": {"title": "Type", "enum": ["mask"], "type": "string", "default": "mask"}, "mask": {"title": "Mask", "allOf": [{"$ref": "#/components/schemas/ImageField"}], "description": "The output mask"}}, "description": "Base class for invocations that output a mask"}, "PaginatedResults_GraphExecutionState_": {"title": "PaginatedResults[GraphExecutionState]", "required": ["items", "page", "pages", "per_page", "total"], "type": "object", "properties": {"items": {"title": "Items", "type": "array", "items": {"$ref": "#/components/schemas/GraphExecutionState"}, "description": "Items"}, "page": {"title": "Page", "type": "integer", "description": "Current Page"}, "pages": {"title": "Pages", "type": "integer", "description": "Total number of pages"}, "per_page": {"title": "Per Page", "type": "integer", "description": "Number of items per page"}, "total": {"title": "Total", "type": "integer", "description": "Total number of items in result"}}, "description": "Paginated results"}, "PasteImageInvocation": {"title": "PasteImageInvocation", "required": ["id"], "type": "object", "properties": {"id": {"title": "Id", "type": "string", "description": "The id of this node. Must be unique among all nodes."}, "type": {"title": "Type", "enum": ["paste"], "type": "string", "default": "paste"}, "base_image": {"title": "Base Image", "allOf": [{"$ref": "#/components/schemas/ImageField"}], "description": "The base image"}, "image": {"title": "Image", "allOf": [{"$ref": "#/components/schemas/ImageField"}], "description": "The image to paste"}, "mask": {"title": "Mask", "allOf": [{"$ref": "#/components/schemas/ImageField"}], "description": "The mask to use when pasting"}, "x": {"title": "X", "type": "integer", "description": "The left x coordinate at which to paste the image", "default": 0}, "y": {"title": "Y", "type": "integer", "description": "The top y coordinate at which to paste the image", "default": 0}}, "description": "Pastes an image into another image."}, "PromptOutput": {"title": "PromptOutput", "type": "object", "properties": {"type": {"title": "Type", "enum": ["prompt"], "type": "string", "default": "prompt"}, "prompt": {"title": "Prompt", "type": "string", "description": "The output prompt"}}, "description": "Base class for invocations that output a prompt"}, "RestoreFaceInvocation": {"title": "RestoreFaceInvocation", "required": ["id"], "type": "object", "properties": {"id": {"title": "Id", "type": "string", "description": "The id of this node. Must be unique among all nodes."}, "type": {"title": "Type", "enum": ["restore_face"], "type": "string", "default": "restore_face"}, "image": {"title": "Image", "allOf": [{"$ref": "#/components/schemas/ImageField"}], "description": "The input image"}, "strength": {"title": "Strength", "maximum": 1.0, "exclusiveMinimum": 0.0, "type": "number", "description": "The strength of the restoration", "default": 0.75}}, "description": "Restores faces in an image."}, "ShowImageInvocation": {"title": "ShowImageInvocation", "required": ["id"], "type": "object", "properties": {"id": {"title": "Id", "type": "string", "description": "The id of this node. Must be unique among all nodes."}, "type": {"title": "Type", "enum": ["show_image"], "type": "string", "default": "show_image"}, "image": {"title": "Image", "allOf": [{"$ref": "#/components/schemas/ImageField"}], "description": "The image to show"}}, "description": "Displays a provided image, and passes it forward in the pipeline."}, "TextToImageInvocation": {"title": "TextToImageInvocation", "required": ["id"], "type": "object", "properties": {"id": {"title": "Id", "type": "string", "description": "The id of this node. Must be unique among all nodes."}, "type": {"title": "Type", "enum": ["txt2img"], "type": "string", "default": "txt2img"}, "prompt": {"title": "Prompt", "type": "string", "description": "The prompt to generate an image from"}, "seed": {"title": "Seed", "maximum": 4294967295.0, "minimum": -1.0, "type": "integer", "description": "The seed to use (-1 for a random seed)", "default": -1}, "steps": {"title": "Steps", "exclusiveMinimum": 0.0, "type": "integer", "description": "The number of steps to use to generate the image", "default": 10}, "width": {"title": "Width", "multipleOf": 64.0, "exclusiveMinimum": 0.0, "type": "integer", "description": "The width of the resulting image", "default": 512}, "height": {"title": "Height", "multipleOf": 64.0, "exclusiveMinimum": 0.0, "type": "integer", "description": "The height of the resulting image", "default": 512}, "cfg_scale": {"title": "Cfg Scale", "exclusiveMinimum": 0.0, "type": "number", "description": "The Classifier-Free Guidance, higher values may result in a result closer to the prompt", "default": 7.5}, "sampler_name": {"title": "Sampler Name", "enum": ["ddim", "dpmpp_2", "k_dpm_2", "k_dpm_2_a", "k_dpmpp_2", "k_euler", "k_euler_a", "k_heun", "k_lms", "plms"], "type": "string", "description": "The sampler to use", "default": "k_lms"}, "seamless": {"title": "Seamless", "type": "boolean", "description": "Whether or not to generate an image that can tile without seams", "default": false}, "model": {"title": "Model", "type": "string", "description": "The model to use (currently ignored)", "default": ""}, "progress_images": {"title": "Progress Images", "type": "boolean", "description": "Whether or not to produce progress images during generation", "default": false}}, "description": "Generates an image using text2img."}, "UpscaleInvocation": {"title": "UpscaleInvocation", "required": ["id"], "type": "object", "properties": {"id": {"title": "Id", "type": "string", "description": "The id of this node. Must be unique among all nodes."}, "type": {"title": "Type", "enum": ["upscale"], "type": "string", "default": "upscale"}, "image": {"title": "Image", "allOf": [{"$ref": "#/components/schemas/ImageField"}], "description": "The input image"}, "strength": {"title": "Strength", "maximum": 1.0, "exclusiveMinimum": 0.0, "type": "number", "description": "The strength", "default": 0.75}, "level": {"title": "Level", "enum": [2, 4], "type": "integer", "description": "The upscale level", "default": 2}}, "description": "Upscales an image."}, "ValidationError": {"title": "ValidationError", "required": ["loc", "msg", "type"], "type": "object", "properties": {"loc": {"title": "Location", "type": "array", "items": {"anyOf": [{"type": "string"}, {"type": "integer"}]}}, "msg": {"title": "Message", "type": "string"}, "type": {"title": "Error Type", "type": "string"}}}}}} \ No newline at end of file diff --git a/invokeai/frontend/web/src/services/api/schemas/$BlurInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$BlurInvocation.ts new file mode 100644 index 0000000000..69f5438583 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$BlurInvocation.ts @@ -0,0 +1,30 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $BlurInvocation = { + description: `Blurs an image`, + properties: { + id: { + type: 'string', + description: `The id of this node. Must be unique among all nodes.`, + isRequired: true, + }, + type: { + type: 'Enum', + }, + image: { + type: 'all-of', + description: `The image to blur`, + contains: [{ + type: 'ImageField', + }], + }, + radius: { + type: 'number', + description: `The blur radius`, + }, + blur_type: { + type: 'Enum', + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$Body_upload_image.ts b/invokeai/frontend/web/src/services/api/schemas/$Body_upload_image.ts new file mode 100644 index 0000000000..7d6adf5a84 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$Body_upload_image.ts @@ -0,0 +1,12 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $Body_upload_image = { + properties: { + file: { + type: 'binary', + isRequired: true, + format: 'binary', + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$CollectInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$CollectInvocation.ts new file mode 100644 index 0000000000..1ab0bb0b9b --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$CollectInvocation.ts @@ -0,0 +1,28 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $CollectInvocation = { + description: `Collects values into a collection`, + properties: { + id: { + type: 'string', + description: `The id of this node. Must be unique among all nodes.`, + isRequired: true, + }, + type: { + type: 'Enum', + }, + item: { + description: `The item to collect (all inputs must be of the same type)`, + properties: { + }, + }, + collection: { + type: 'array', + contains: { + properties: { + }, + }, + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$CollectInvocationOutput.ts b/invokeai/frontend/web/src/services/api/schemas/$CollectInvocationOutput.ts new file mode 100644 index 0000000000..f7025f8520 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$CollectInvocationOutput.ts @@ -0,0 +1,19 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $CollectInvocationOutput = { + description: `Base class for all invocation outputs`, + properties: { + type: { + type: 'Enum', + }, + collection: { + type: 'array', + contains: { + properties: { + }, + }, + isRequired: true, + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$CropImageInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$CropImageInvocation.ts new file mode 100644 index 0000000000..f279efe286 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$CropImageInvocation.ts @@ -0,0 +1,39 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $CropImageInvocation = { + description: `Crops an image to a specified box. The box can be outside of the image.`, + properties: { + id: { + type: 'string', + description: `The id of this node. Must be unique among all nodes.`, + isRequired: true, + }, + type: { + type: 'Enum', + }, + image: { + type: 'all-of', + description: `The image to crop`, + contains: [{ + type: 'ImageField', + }], + }, + 'x': { + type: 'number', + description: `The left x coordinate of the crop rectangle`, + }, + 'y': { + type: 'number', + description: `The top y coordinate of the crop rectangle`, + }, + width: { + type: 'number', + description: `The width of the crop rectangle`, + }, + height: { + type: 'number', + description: `The height of the crop rectangle`, + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$CvInpaintInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$CvInpaintInvocation.ts new file mode 100644 index 0000000000..959484f3ed --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$CvInpaintInvocation.ts @@ -0,0 +1,30 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $CvInpaintInvocation = { + description: `Simple inpaint using opencv.`, + properties: { + id: { + type: 'string', + description: `The id of this node. Must be unique among all nodes.`, + isRequired: true, + }, + type: { + type: 'Enum', + }, + image: { + type: 'all-of', + description: `The image to inpaint`, + contains: [{ + type: 'ImageField', + }], + }, + mask: { + type: 'all-of', + description: `The mask to use when inpainting`, + contains: [{ + type: 'ImageField', + }], + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$EdgeConnection.ts b/invokeai/frontend/web/src/services/api/schemas/$EdgeConnection.ts new file mode 100644 index 0000000000..a3f325888e --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$EdgeConnection.ts @@ -0,0 +1,17 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $EdgeConnection = { + properties: { + node_id: { + type: 'string', + description: `The id of the node for this edge connection`, + isRequired: true, + }, + field: { + type: 'string', + description: `The field for this connection`, + isRequired: true, + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$Graph.ts b/invokeai/frontend/web/src/services/api/schemas/$Graph.ts new file mode 100644 index 0000000000..95a51e55b8 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$Graph.ts @@ -0,0 +1,62 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $Graph = { + properties: { + id: { + type: 'string', + description: `The id of this graph`, + }, + nodes: { + type: 'dictionary', + contains: { + type: 'one-of', + contains: [{ + type: 'LoadImageInvocation', + }, { + type: 'ShowImageInvocation', + }, { + type: 'CropImageInvocation', + }, { + type: 'PasteImageInvocation', + }, { + type: 'MaskFromAlphaInvocation', + }, { + type: 'BlurInvocation', + }, { + type: 'LerpInvocation', + }, { + type: 'InverseLerpInvocation', + }, { + type: 'CvInpaintInvocation', + }, { + type: 'UpscaleInvocation', + }, { + type: 'RestoreFaceInvocation', + }, { + type: 'TextToImageInvocation', + }, { + type: 'GraphInvocation', + }, { + type: 'IterateInvocation', + }, { + type: 'CollectInvocation', + }, { + type: 'ImageToImageInvocation', + }, { + type: 'InpaintInvocation', + }], + }, + }, + edges: { + type: 'array', + contains: { + type: 'array', + contains: { + properties: { + }, + }, + }, + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$GraphExecutionState.ts b/invokeai/frontend/web/src/services/api/schemas/$GraphExecutionState.ts new file mode 100644 index 0000000000..a352e79fd6 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$GraphExecutionState.ts @@ -0,0 +1,79 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $GraphExecutionState = { + description: `Tracks the state of a graph execution`, + properties: { + id: { + type: 'string', + description: `The id of the execution state`, + }, + graph: { + type: 'all-of', + description: `The graph being executed`, + contains: [{ + type: 'Graph', + }], + isRequired: true, + }, + execution_graph: { + type: 'all-of', + description: `The expanded graph of activated and executed nodes`, + contains: [{ + type: 'Graph', + }], + }, + executed: { + type: 'array', + contains: { + type: 'string', + }, + }, + executed_history: { + type: 'array', + contains: { + type: 'string', + }, + }, + results: { + type: 'dictionary', + contains: { + type: 'one-of', + contains: [{ + type: 'ImageOutput', + }, { + type: 'MaskOutput', + }, { + type: 'PromptOutput', + }, { + type: 'GraphInvocationOutput', + }, { + type: 'IterateInvocationOutput', + }, { + type: 'CollectInvocationOutput', + }], + }, + }, + errors: { + type: 'dictionary', + contains: { + type: 'string', + }, + }, + prepared_source_mapping: { + type: 'dictionary', + contains: { + type: 'string', + }, + }, + source_prepared_mapping: { + type: 'dictionary', + contains: { + type: 'array', + contains: { + type: 'string', + }, + }, + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$GraphInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$GraphInvocation.ts new file mode 100644 index 0000000000..0b9e4322c8 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$GraphInvocation.ts @@ -0,0 +1,24 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $GraphInvocation = { + description: `A node to process inputs and produce outputs. + May use dependency injection in __init__ to receive providers.`, + properties: { + id: { + type: 'string', + description: `The id of this node. Must be unique among all nodes.`, + isRequired: true, + }, + type: { + type: 'Enum', + }, + graph: { + type: 'all-of', + description: `The graph to run`, + contains: [{ + type: 'Graph', + }], + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$GraphInvocationOutput.ts b/invokeai/frontend/web/src/services/api/schemas/$GraphInvocationOutput.ts new file mode 100644 index 0000000000..cf6ba353c1 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$GraphInvocationOutput.ts @@ -0,0 +1,11 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $GraphInvocationOutput = { + description: `Base class for all invocation outputs`, + properties: { + type: { + type: 'Enum', + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$HTTPValidationError.ts b/invokeai/frontend/web/src/services/api/schemas/$HTTPValidationError.ts new file mode 100644 index 0000000000..0d129d4b67 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$HTTPValidationError.ts @@ -0,0 +1,13 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $HTTPValidationError = { + properties: { + detail: { + type: 'array', + contains: { + type: 'ValidationError', + }, + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$ImageField.ts b/invokeai/frontend/web/src/services/api/schemas/$ImageField.ts new file mode 100644 index 0000000000..a026ff05ef --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$ImageField.ts @@ -0,0 +1,16 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $ImageField = { + description: `An image field used for passing image objects between invocations`, + properties: { + image_type: { + type: 'string', + description: `The type of the image`, + }, + image_name: { + type: 'string', + description: `The name of the image`, + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$ImageOutput.ts b/invokeai/frontend/web/src/services/api/schemas/$ImageOutput.ts new file mode 100644 index 0000000000..fe347d2afe --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$ImageOutput.ts @@ -0,0 +1,18 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $ImageOutput = { + description: `Base class for invocations that output an image`, + properties: { + type: { + type: 'Enum', + }, + image: { + type: 'all-of', + description: `The output image`, + contains: [{ + type: 'ImageField', + }], + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$ImageToImageInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$ImageToImageInvocation.ts new file mode 100644 index 0000000000..0f7e8e547c --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$ImageToImageInvocation.ts @@ -0,0 +1,75 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $ImageToImageInvocation = { + description: `Generates an image using img2img.`, + properties: { + id: { + type: 'string', + description: `The id of this node. Must be unique among all nodes.`, + isRequired: true, + }, + type: { + type: 'Enum', + }, + prompt: { + type: 'string', + description: `The prompt to generate an image from`, + }, + seed: { + type: 'number', + description: `The seed to use (-1 for a random seed)`, + maximum: 4294967295, + minimum: -1, + }, + steps: { + type: 'number', + description: `The number of steps to use to generate the image`, + }, + width: { + type: 'number', + description: `The width of the resulting image`, + multipleOf: 64, + }, + height: { + type: 'number', + description: `The height of the resulting image`, + multipleOf: 64, + }, + cfg_scale: { + type: 'number', + description: `The Classifier-Free Guidance, higher values may result in a result closer to the prompt`, + }, + sampler_name: { + type: 'Enum', + }, + seamless: { + type: 'boolean', + description: `Whether or not to generate an image that can tile without seams`, + }, + model: { + type: 'string', + description: `The model to use (currently ignored)`, + }, + progress_images: { + type: 'boolean', + description: `Whether or not to produce progress images during generation`, + }, + image: { + type: 'all-of', + description: `The input image`, + contains: [{ + type: 'ImageField', + }], + }, + strength: { + type: 'number', + description: `The strength of the original image`, + maximum: 1, + }, + fit: { + type: 'boolean', + description: `Whether or not the result should be fit to the aspect ratio of the input image`, + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$ImageType.ts b/invokeai/frontend/web/src/services/api/schemas/$ImageType.ts new file mode 100644 index 0000000000..92e1f2b218 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$ImageType.ts @@ -0,0 +1,6 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $ImageType = { + type: 'Enum', +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$InpaintInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$InpaintInvocation.ts new file mode 100644 index 0000000000..185687e77b --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$InpaintInvocation.ts @@ -0,0 +1,87 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $InpaintInvocation = { + description: `Generates an image using inpaint.`, + properties: { + id: { + type: 'string', + description: `The id of this node. Must be unique among all nodes.`, + isRequired: true, + }, + type: { + type: 'Enum', + }, + prompt: { + type: 'string', + description: `The prompt to generate an image from`, + }, + seed: { + type: 'number', + description: `The seed to use (-1 for a random seed)`, + maximum: 4294967295, + minimum: -1, + }, + steps: { + type: 'number', + description: `The number of steps to use to generate the image`, + }, + width: { + type: 'number', + description: `The width of the resulting image`, + multipleOf: 64, + }, + height: { + type: 'number', + description: `The height of the resulting image`, + multipleOf: 64, + }, + cfg_scale: { + type: 'number', + description: `The Classifier-Free Guidance, higher values may result in a result closer to the prompt`, + }, + sampler_name: { + type: 'Enum', + }, + seamless: { + type: 'boolean', + description: `Whether or not to generate an image that can tile without seams`, + }, + model: { + type: 'string', + description: `The model to use (currently ignored)`, + }, + progress_images: { + type: 'boolean', + description: `Whether or not to produce progress images during generation`, + }, + image: { + type: 'all-of', + description: `The input image`, + contains: [{ + type: 'ImageField', + }], + }, + strength: { + type: 'number', + description: `The strength of the original image`, + maximum: 1, + }, + fit: { + type: 'boolean', + description: `Whether or not the result should be fit to the aspect ratio of the input image`, + }, + mask: { + type: 'all-of', + description: `The mask`, + contains: [{ + type: 'ImageField', + }], + }, + inpaint_replace: { + type: 'number', + description: `The amount by which to replace masked areas with latent noise`, + maximum: 1, + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$InverseLerpInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$InverseLerpInvocation.ts new file mode 100644 index 0000000000..43dadca876 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$InverseLerpInvocation.ts @@ -0,0 +1,33 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $InverseLerpInvocation = { + description: `Inverse linear interpolation of all pixels of an image`, + properties: { + id: { + type: 'string', + description: `The id of this node. Must be unique among all nodes.`, + isRequired: true, + }, + type: { + type: 'Enum', + }, + image: { + type: 'all-of', + description: `The image to lerp`, + contains: [{ + type: 'ImageField', + }], + }, + min: { + type: 'number', + description: `The minimum input value`, + maximum: 255, + }, + max: { + type: 'number', + description: `The maximum input value`, + maximum: 255, + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$IterateInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$IterateInvocation.ts new file mode 100644 index 0000000000..b570b889e4 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$IterateInvocation.ts @@ -0,0 +1,28 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $IterateInvocation = { + description: `A node to process inputs and produce outputs. + May use dependency injection in __init__ to receive providers.`, + properties: { + id: { + type: 'string', + description: `The id of this node. Must be unique among all nodes.`, + isRequired: true, + }, + type: { + type: 'Enum', + }, + collection: { + type: 'array', + contains: { + properties: { + }, + }, + }, + index: { + type: 'number', + description: `The index, will be provided on executed iterators`, + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$IterateInvocationOutput.ts b/invokeai/frontend/web/src/services/api/schemas/$IterateInvocationOutput.ts new file mode 100644 index 0000000000..82512b40fe --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$IterateInvocationOutput.ts @@ -0,0 +1,16 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $IterateInvocationOutput = { + description: `Used to connect iteration outputs. Will be expanded to a specific output.`, + properties: { + type: { + type: 'Enum', + }, + item: { + description: `The item being iterated over`, + properties: { + }, + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$LerpInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$LerpInvocation.ts new file mode 100644 index 0000000000..bafac85817 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$LerpInvocation.ts @@ -0,0 +1,33 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $LerpInvocation = { + description: `Linear interpolation of all pixels of an image`, + properties: { + id: { + type: 'string', + description: `The id of this node. Must be unique among all nodes.`, + isRequired: true, + }, + type: { + type: 'Enum', + }, + image: { + type: 'all-of', + description: `The image to lerp`, + contains: [{ + type: 'ImageField', + }], + }, + min: { + type: 'number', + description: `The minimum output value`, + maximum: 255, + }, + max: { + type: 'number', + description: `The maximum output value`, + maximum: 255, + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$LoadImageInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$LoadImageInvocation.ts new file mode 100644 index 0000000000..4da7d2d9d1 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$LoadImageInvocation.ts @@ -0,0 +1,29 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $LoadImageInvocation = { + description: `Load an image from a filename and provide it as output.`, + properties: { + id: { + type: 'string', + description: `The id of this node. Must be unique among all nodes.`, + isRequired: true, + }, + type: { + type: 'Enum', + }, + image_type: { + type: 'all-of', + description: `The type of the image`, + contains: [{ + type: 'ImageType', + }], + isRequired: true, + }, + image_name: { + type: 'string', + description: `The name of the image`, + isRequired: true, + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$MaskFromAlphaInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$MaskFromAlphaInvocation.ts new file mode 100644 index 0000000000..88c2089816 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$MaskFromAlphaInvocation.ts @@ -0,0 +1,27 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $MaskFromAlphaInvocation = { + description: `Extracts the alpha channel of an image as a mask.`, + properties: { + id: { + type: 'string', + description: `The id of this node. Must be unique among all nodes.`, + isRequired: true, + }, + type: { + type: 'Enum', + }, + image: { + type: 'all-of', + description: `The image to create the mask from`, + contains: [{ + type: 'ImageField', + }], + }, + invert: { + type: 'boolean', + description: `Whether or not to invert the mask`, + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$MaskOutput.ts b/invokeai/frontend/web/src/services/api/schemas/$MaskOutput.ts new file mode 100644 index 0000000000..c742908d41 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$MaskOutput.ts @@ -0,0 +1,18 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $MaskOutput = { + description: `Base class for invocations that output a mask`, + properties: { + type: { + type: 'Enum', + }, + mask: { + type: 'all-of', + description: `The output mask`, + contains: [{ + type: 'ImageField', + }], + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$PaginatedResults_GraphExecutionState_.ts b/invokeai/frontend/web/src/services/api/schemas/$PaginatedResults_GraphExecutionState_.ts new file mode 100644 index 0000000000..ca574eb463 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$PaginatedResults_GraphExecutionState_.ts @@ -0,0 +1,35 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $PaginatedResults_GraphExecutionState_ = { + description: `Paginated results`, + properties: { + items: { + type: 'array', + contains: { + type: 'GraphExecutionState', + }, + isRequired: true, + }, + page: { + type: 'number', + description: `Current Page`, + isRequired: true, + }, + pages: { + type: 'number', + description: `Total number of pages`, + isRequired: true, + }, + per_page: { + type: 'number', + description: `Number of items per page`, + isRequired: true, + }, + total: { + type: 'number', + description: `Total number of items in result`, + isRequired: true, + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$PasteImageInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$PasteImageInvocation.ts new file mode 100644 index 0000000000..74bb1edfcb --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$PasteImageInvocation.ts @@ -0,0 +1,45 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $PasteImageInvocation = { + description: `Pastes an image into another image.`, + properties: { + id: { + type: 'string', + description: `The id of this node. Must be unique among all nodes.`, + isRequired: true, + }, + type: { + type: 'Enum', + }, + base_image: { + type: 'all-of', + description: `The base image`, + contains: [{ + type: 'ImageField', + }], + }, + image: { + type: 'all-of', + description: `The image to paste`, + contains: [{ + type: 'ImageField', + }], + }, + mask: { + type: 'all-of', + description: `The mask to use when pasting`, + contains: [{ + type: 'ImageField', + }], + }, + 'x': { + type: 'number', + description: `The left x coordinate at which to paste the image`, + }, + 'y': { + type: 'number', + description: `The top y coordinate at which to paste the image`, + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$PromptOutput.ts b/invokeai/frontend/web/src/services/api/schemas/$PromptOutput.ts new file mode 100644 index 0000000000..bdf5ad3a46 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$PromptOutput.ts @@ -0,0 +1,15 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $PromptOutput = { + description: `Base class for invocations that output a prompt`, + properties: { + type: { + type: 'Enum', + }, + prompt: { + type: 'string', + description: `The output prompt`, + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$RestoreFaceInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$RestoreFaceInvocation.ts new file mode 100644 index 0000000000..a9d10c480b --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$RestoreFaceInvocation.ts @@ -0,0 +1,28 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $RestoreFaceInvocation = { + description: `Restores faces in an image.`, + properties: { + id: { + type: 'string', + description: `The id of this node. Must be unique among all nodes.`, + isRequired: true, + }, + type: { + type: 'Enum', + }, + image: { + type: 'all-of', + description: `The input image`, + contains: [{ + type: 'ImageField', + }], + }, + strength: { + type: 'number', + description: `The strength of the restoration`, + maximum: 1, + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$ShowImageInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$ShowImageInvocation.ts new file mode 100644 index 0000000000..99a8ce0068 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$ShowImageInvocation.ts @@ -0,0 +1,23 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $ShowImageInvocation = { + description: `Displays a provided image, and passes it forward in the pipeline.`, + properties: { + id: { + type: 'string', + description: `The id of this node. Must be unique among all nodes.`, + isRequired: true, + }, + type: { + type: 'Enum', + }, + image: { + type: 'all-of', + description: `The image to show`, + contains: [{ + type: 'ImageField', + }], + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$TextToImageInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$TextToImageInvocation.ts new file mode 100644 index 0000000000..be7bea65c8 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$TextToImageInvocation.ts @@ -0,0 +1,59 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $TextToImageInvocation = { + description: `Generates an image using text2img.`, + properties: { + id: { + type: 'string', + description: `The id of this node. Must be unique among all nodes.`, + isRequired: true, + }, + type: { + type: 'Enum', + }, + prompt: { + type: 'string', + description: `The prompt to generate an image from`, + }, + seed: { + type: 'number', + description: `The seed to use (-1 for a random seed)`, + maximum: 4294967295, + minimum: -1, + }, + steps: { + type: 'number', + description: `The number of steps to use to generate the image`, + }, + width: { + type: 'number', + description: `The width of the resulting image`, + multipleOf: 64, + }, + height: { + type: 'number', + description: `The height of the resulting image`, + multipleOf: 64, + }, + cfg_scale: { + type: 'number', + description: `The Classifier-Free Guidance, higher values may result in a result closer to the prompt`, + }, + sampler_name: { + type: 'Enum', + }, + seamless: { + type: 'boolean', + description: `Whether or not to generate an image that can tile without seams`, + }, + model: { + type: 'string', + description: `The model to use (currently ignored)`, + }, + progress_images: { + type: 'boolean', + description: `Whether or not to produce progress images during generation`, + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$UpscaleInvocation.ts b/invokeai/frontend/web/src/services/api/schemas/$UpscaleInvocation.ts new file mode 100644 index 0000000000..21f87f1fb7 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$UpscaleInvocation.ts @@ -0,0 +1,31 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $UpscaleInvocation = { + description: `Upscales an image.`, + properties: { + id: { + type: 'string', + description: `The id of this node. Must be unique among all nodes.`, + isRequired: true, + }, + type: { + type: 'Enum', + }, + image: { + type: 'all-of', + description: `The input image`, + contains: [{ + type: 'ImageField', + }], + }, + strength: { + type: 'number', + description: `The strength`, + maximum: 1, + }, + level: { + type: 'Enum', + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$ValidationError.ts b/invokeai/frontend/web/src/services/api/schemas/$ValidationError.ts new file mode 100644 index 0000000000..d4c5c3e471 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$ValidationError.ts @@ -0,0 +1,27 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $ValidationError = { + properties: { + loc: { + type: 'array', + contains: { + type: 'any-of', + contains: [{ + type: 'string', + }, { + type: 'number', + }], + }, + isRequired: true, + }, + msg: { + type: 'string', + isRequired: true, + }, + type: { + type: 'string', + isRequired: true, + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/services/ImagesService.ts b/invokeai/frontend/web/src/services/api/services/ImagesService.ts new file mode 100644 index 0000000000..316277c8d0 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/services/ImagesService.ts @@ -0,0 +1,59 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { Body_upload_image } from '../models/Body_upload_image'; +import type { ImageType } from '../models/ImageType'; + +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export class ImagesService { + + /** + * Get Image + * Gets a result + * @param imageType The type of image to get + * @param imageName The name of the image to get + * @returns any Successful Response + * @throws ApiError + */ + public static getImage( + imageType: ImageType, + imageName: string, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v1/images/{image_type}/{image_name}', + path: { + 'image_type': imageType, + 'image_name': imageName, + }, + errors: { + 422: `Validation Error`, + }, + }); + } + + /** + * Upload Image + * @param formData + * @returns any Successful Response + * @throws ApiError + */ + public static uploadImage( + formData: Body_upload_image, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/v1/images/uploads/', + formData: formData, + mediaType: 'multipart/form-data', + errors: { + 404: `Session not found`, + 422: `Validation Error`, + }, + }); + } + +} diff --git a/invokeai/frontend/web/src/services/api/services/SessionsService.ts b/invokeai/frontend/web/src/services/api/services/SessionsService.ts new file mode 100644 index 0000000000..17386f8d08 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/services/SessionsService.ts @@ -0,0 +1,283 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { BlurInvocation } from '../models/BlurInvocation'; +import type { CollectInvocation } from '../models/CollectInvocation'; +import type { CropImageInvocation } from '../models/CropImageInvocation'; +import type { CvInpaintInvocation } from '../models/CvInpaintInvocation'; +import type { Graph } from '../models/Graph'; +import type { GraphExecutionState } from '../models/GraphExecutionState'; +import type { GraphInvocation } from '../models/GraphInvocation'; +import type { ImageToImageInvocation } from '../models/ImageToImageInvocation'; +import type { InpaintInvocation } from '../models/InpaintInvocation'; +import type { InverseLerpInvocation } from '../models/InverseLerpInvocation'; +import type { IterateInvocation } from '../models/IterateInvocation'; +import type { LerpInvocation } from '../models/LerpInvocation'; +import type { LoadImageInvocation } from '../models/LoadImageInvocation'; +import type { MaskFromAlphaInvocation } from '../models/MaskFromAlphaInvocation'; +import type { PaginatedResults_GraphExecutionState_ } from '../models/PaginatedResults_GraphExecutionState_'; +import type { PasteImageInvocation } from '../models/PasteImageInvocation'; +import type { RestoreFaceInvocation } from '../models/RestoreFaceInvocation'; +import type { ShowImageInvocation } from '../models/ShowImageInvocation'; +import type { TextToImageInvocation } from '../models/TextToImageInvocation'; +import type { UpscaleInvocation } from '../models/UpscaleInvocation'; + +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export class SessionsService { + + /** + * List Sessions + * Gets a list of sessions, optionally searching + * @param page The page of results to get + * @param perPage The number of results per page + * @param query The query string to search for + * @returns PaginatedResults_GraphExecutionState_ Successful Response + * @throws ApiError + */ + public static listSessions( + page?: number, + perPage: number = 10, + query: string = '', + ): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v1/sessions/', + query: { + 'page': page, + 'per_page': perPage, + 'query': query, + }, + errors: { + 422: `Validation Error`, + }, + }); + } + + /** + * Create Session + * Creates a new session, optionally initializing it with an invocation graph + * @param requestBody + * @returns GraphExecutionState Successful Response + * @throws ApiError + */ + public static createSession( + requestBody?: Graph, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/v1/sessions/', + body: requestBody, + mediaType: 'application/json', + errors: { + 400: `Invalid json`, + 422: `Validation Error`, + }, + }); + } + + /** + * Get Session + * Gets a session + * @param sessionId The id of the session to get + * @returns GraphExecutionState Successful Response + * @throws ApiError + */ + public static getSession( + sessionId: string, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v1/sessions/{session_id}', + path: { + 'session_id': sessionId, + }, + errors: { + 404: `Session not found`, + 422: `Validation Error`, + }, + }); + } + + /** + * Add Node + * Adds a node to the graph + * @param sessionId The id of the session + * @param requestBody + * @returns string Successful Response + * @throws ApiError + */ + public static addNode( + sessionId: string, + requestBody: (LoadImageInvocation | ShowImageInvocation | CropImageInvocation | PasteImageInvocation | MaskFromAlphaInvocation | BlurInvocation | LerpInvocation | InverseLerpInvocation | CvInpaintInvocation | UpscaleInvocation | RestoreFaceInvocation | TextToImageInvocation | GraphInvocation | IterateInvocation | CollectInvocation | ImageToImageInvocation | InpaintInvocation), + ): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/v1/sessions/{session_id}/nodes', + path: { + 'session_id': sessionId, + }, + body: requestBody, + mediaType: 'application/json', + errors: { + 400: `Invalid node or link`, + 404: `Session not found`, + 422: `Validation Error`, + }, + }); + } + + /** + * Update Node + * Updates a node in the graph and removes all linked edges + * @param sessionId The id of the session + * @param nodePath The path to the node in the graph + * @param requestBody + * @returns GraphExecutionState Successful Response + * @throws ApiError + */ + public static updateNode( + sessionId: string, + nodePath: string, + requestBody: (LoadImageInvocation | ShowImageInvocation | CropImageInvocation | PasteImageInvocation | MaskFromAlphaInvocation | BlurInvocation | LerpInvocation | InverseLerpInvocation | CvInpaintInvocation | UpscaleInvocation | RestoreFaceInvocation | TextToImageInvocation | GraphInvocation | IterateInvocation | CollectInvocation | ImageToImageInvocation | InpaintInvocation), + ): CancelablePromise { + return __request(OpenAPI, { + method: 'PUT', + url: '/api/v1/sessions/{session_id}/nodes/{node_path}', + path: { + 'session_id': sessionId, + 'node_path': nodePath, + }, + body: requestBody, + mediaType: 'application/json', + errors: { + 400: `Invalid node or link`, + 404: `Session not found`, + 422: `Validation Error`, + }, + }); + } + + /** + * Delete Node + * Deletes a node in the graph and removes all linked edges + * @param sessionId The id of the session + * @param nodePath The path to the node to delete + * @returns GraphExecutionState Successful Response + * @throws ApiError + */ + public static deleteNode( + sessionId: string, + nodePath: string, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'DELETE', + url: '/api/v1/sessions/{session_id}/nodes/{node_path}', + path: { + 'session_id': sessionId, + 'node_path': nodePath, + }, + errors: { + 400: `Invalid node or link`, + 404: `Session not found`, + 422: `Validation Error`, + }, + }); + } + + /** + * Add Edge + * Adds an edge to the graph + * @param sessionId The id of the session + * @param requestBody + * @returns GraphExecutionState Successful Response + * @throws ApiError + */ + public static addEdge( + sessionId: string, + requestBody: Array, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/v1/sessions/{session_id}/edges', + path: { + 'session_id': sessionId, + }, + body: requestBody, + mediaType: 'application/json', + errors: { + 400: `Invalid node or link`, + 404: `Session not found`, + 422: `Validation Error`, + }, + }); + } + + /** + * Delete Edge + * Deletes an edge from the graph + * @param sessionId The id of the session + * @param fromNodeId The id of the node the edge is coming from + * @param fromField The field of the node the edge is coming from + * @param toNodeId The id of the node the edge is going to + * @param toField The field of the node the edge is going to + * @returns GraphExecutionState Successful Response + * @throws ApiError + */ + public static deleteEdge( + sessionId: string, + fromNodeId: string, + fromField: string, + toNodeId: string, + toField: string, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'DELETE', + url: '/api/v1/sessions/{session_id}/edges/{from_node_id}/{from_field}/{to_node_id}/{to_field}', + path: { + 'session_id': sessionId, + 'from_node_id': fromNodeId, + 'from_field': fromField, + 'to_node_id': toNodeId, + 'to_field': toField, + }, + errors: { + 400: `Invalid node or link`, + 404: `Session not found`, + 422: `Validation Error`, + }, + }); + } + + /** + * Invoke Session + * Invokes a session + * @param sessionId The id of the session to invoke + * @param all Whether or not to invoke all remaining invocations + * @returns any Successful Response + * @throws ApiError + */ + public static invokeSession( + sessionId: string, + all: boolean = false, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'PUT', + url: '/api/v1/sessions/{session_id}/invoke', + path: { + 'session_id': sessionId, + }, + query: { + 'all': all, + }, + errors: { + 400: `The session has no invocations ready to invoke`, + 404: `Session not found`, + 422: `Validation Error`, + }, + }); + } + +} diff --git a/invokeai/frontend/web/vite.config.ts b/invokeai/frontend/web/vite.config.ts index a6071341b3..2128593f10 100644 --- a/invokeai/frontend/web/vite.config.ts +++ b/invokeai/frontend/web/vite.config.ts @@ -38,6 +38,23 @@ export default defineConfig(({ mode }) => { target: 'ws://127.0.0.1:9090', ws: true, }, + // Proxy socket.io to the nodes socketio server + '/ws/socket.io': { + target: 'ws://127.0.0.1:9090', + ws: true, + }, + // Proxy openapi schema definiton + '/openapi.json': { + target: 'http://127.0.0.1:9090/openapi.json', + rewrite: (path) => path.replace(/^\/openapi.json/, ''), + changeOrigin: true, + }, + // proxy nodes api + '/api/v1': { + target: 'http://127.0.0.1:9090/api/v1', + rewrite: (path) => path.replace(/^\/api\/v1/, ''), + changeOrigin: true, + }, }, }, build: { diff --git a/invokeai/frontend/web/yarn.lock b/invokeai/frontend/web/yarn.lock index 1a40014efe..2ce6b95ffa 100644 --- a/invokeai/frontend/web/yarn.lock +++ b/invokeai/frontend/web/yarn.lock @@ -2,6 +2,16 @@ # yarn lockfile v1 +"@apidevtools/json-schema-ref-parser@9.0.9": + version "9.0.9" + resolved "https://registry.yarnpkg.com/@apidevtools/json-schema-ref-parser/-/json-schema-ref-parser-9.0.9.tgz#d720f9256e3609621280584f2b47ae165359268b" + integrity sha512-GBD2Le9w2+lVFoc4vswGI/TjkNIZSVp7+9xPf+X3uidBfWnAeUWmquteSyt0+VCrhNMWj/FTABISQrD3Z/YA+w== + dependencies: + "@jsdevtools/ono" "^7.1.3" + "@types/json-schema" "^7.0.6" + call-me-maybe "^1.0.1" + js-yaml "^4.1.0" + "@babel/code-frame@^7.0.0": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.18.6.tgz#3b25d38c89600baa2dcc219edfa88a74eb2c427a" @@ -1218,6 +1228,11 @@ "@jridgewell/resolve-uri" "3.1.0" "@jridgewell/sourcemap-codec" "1.4.14" +"@jsdevtools/ono@^7.1.3": + version "7.1.3" + resolved "https://registry.yarnpkg.com/@jsdevtools/ono/-/ono-7.1.3.tgz#9df03bbd7c696a5c58885c34aa06da41c8543796" + integrity sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg== + "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -1391,7 +1406,7 @@ "@types/react" "*" hoist-non-react-statics "^3.3.0" -"@types/json-schema@*", "@types/json-schema@^7.0.9": +"@types/json-schema@*", "@types/json-schema@^7.0.6", "@types/json-schema@^7.0.9": version "7.0.11" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== @@ -1768,6 +1783,11 @@ astral-regex@^2.0.0: resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== + at-least-node@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2" @@ -1783,6 +1803,15 @@ available-typed-arrays@^1.0.5: resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7" integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw== +axios@^1.3.4: + version "1.3.4" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.3.4.tgz#f5760cefd9cfb51fd2481acf88c05f67c4523024" + integrity sha512-toYm+Bsyl6VC5wSkfkbbNB6ROv7KY93PEBBL6xyDczaIHasAiv4wPqQ/c4RjoQzipxRD2W5g21cOqQulZ7rHwQ== + dependencies: + follow-redirects "^1.15.0" + form-data "^4.0.0" + proxy-from-env "^1.1.0" + babel-plugin-macros@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/babel-plugin-macros/-/babel-plugin-macros-3.1.0.tgz#9ef6dc74deb934b4db344dc973ee851d148c50c1" @@ -1887,12 +1916,17 @@ call-bind@^1.0.0, call-bind@^1.0.2: function-bind "^1.1.1" get-intrinsic "^1.0.2" +call-me-maybe@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/call-me-maybe/-/call-me-maybe-1.0.2.tgz#03f964f19522ba643b1b0693acb9152fe2074baa" + integrity sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ== + callsites@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== -camelcase@^6.2.0: +camelcase@^6.2.0, camelcase@^6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== @@ -2077,6 +2111,13 @@ colorette@^2.0.19: resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.19.tgz#cdf044f47ad41a0f4b56b3a0d5b4e6e1a2d5a798" integrity sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ== +combined-stream@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== + dependencies: + delayed-stream "~1.0.0" + commander@^2.16.0, commander@^2.20.0, commander@^2.20.3, commander@^2.8.1: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" @@ -2270,6 +2311,11 @@ define-properties@^1.1.3, define-properties@^1.1.4: has-property-descriptors "^1.0.0" object-keys "^1.1.1" +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== + dependency-tree@^9.0.0: version "9.0.0" resolved "https://registry.yarnpkg.com/dependency-tree/-/dependency-tree-9.0.0.tgz#9288dd6daf35f6510c1ea30d9894b75369aa50a2" @@ -2952,6 +2998,11 @@ focus-lock@^0.11.6: dependencies: tslib "^2.0.3" +follow-redirects@^1.15.0: + version "1.15.2" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" + integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== + for-each@^0.3.3: version "0.3.3" resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" @@ -2959,6 +3010,15 @@ for-each@^0.3.3: dependencies: is-callable "^1.1.3" +form-data@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" + integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + formik@^2.2.9: version "2.2.9" resolved "https://registry.yarnpkg.com/formik/-/formik-2.2.9.tgz#8594ba9c5e2e5cf1f42c5704128e119fc46232d0" @@ -2988,6 +3048,15 @@ framesync@6.1.2: dependencies: tslib "2.4.0" +fs-extra@^10.1.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf" + integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ== + dependencies: + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^2.0.0" + fs-extra@^9.0.0: version "9.1.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" @@ -3200,6 +3269,18 @@ grapheme-splitter@^1.0.4: resolved "https://registry.yarnpkg.com/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz#9cf3a665c6247479896834af35cf1dbb4400767e" integrity sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ== +handlebars@^4.7.7: + version "4.7.7" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.7.tgz#9ce33416aad02dbd6c8fafa8240d5d98004945a1" + integrity sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA== + dependencies: + minimist "^1.2.5" + neo-async "^2.6.0" + source-map "^0.6.1" + wordwrap "^1.0.0" + optionalDependencies: + uglify-js "^3.1.4" + has-bigints@^1.0.1, has-bigints@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.2.tgz#0871bd3e3d51626f6ca0966668ba35d5602d6eaa" @@ -3681,6 +3762,13 @@ json-parse-even-better-errors@^2.3.0: resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== +json-schema-ref-parser@^9.0.9: + version "9.0.9" + resolved "https://registry.yarnpkg.com/json-schema-ref-parser/-/json-schema-ref-parser-9.0.9.tgz#66ea538e7450b12af342fa3d5b8458bc1e1e013f" + integrity sha512-qcP2lmGy+JUoQJ4DOQeLaZDqH9qSkeGCK3suKWxJXS82dg728Mn3j97azDMaOUmJAN4uCq91LdPx4K7E8F1a7Q== + dependencies: + "@apidevtools/json-schema-ref-parser" "9.0.9" + json-schema-traverse@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" @@ -3945,6 +4033,18 @@ micromatch@^4.0.2, micromatch@^4.0.4, micromatch@^4.0.5: braces "^3.0.2" picomatch "^2.3.1" +mime-db@1.52.0: + version "1.52.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" + integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== + +mime-types@^2.1.12: + version "2.1.35" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" + integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== + dependencies: + mime-db "1.52.0" + mimic-fn@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" @@ -4019,6 +4119,11 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== +neo-async@^2.6.0: + version "2.6.2" + resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" + integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== + nice-try@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" @@ -4160,6 +4265,17 @@ open@^8.4.0: is-docker "^2.1.1" is-wsl "^2.2.0" +openapi-typescript-codegen@^0.23.0: + version "0.23.0" + resolved "https://registry.yarnpkg.com/openapi-typescript-codegen/-/openapi-typescript-codegen-0.23.0.tgz#702a651eefc536b27e87e4ad54a80a31d36487f0" + integrity sha512-gOJXy5g3H3HlLpVNN+USrNK2i2KYBmDczk9Xk34u6JorwrGiDJZUj+al4S+i9TXdfUQ/ZaLxE59Xf3wqkxGfqA== + dependencies: + camelcase "^6.3.0" + commander "^9.3.0" + fs-extra "^10.1.0" + handlebars "^4.7.7" + json-schema-ref-parser "^9.0.9" + optionator@^0.8.1: version "0.8.3" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" @@ -4449,6 +4565,11 @@ prop-types@^15.6.2, prop-types@^15.8.1: object-assign "^4.1.1" react-is "^16.13.1" +proxy-from-env@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" + integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== + pump@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" @@ -5027,7 +5148,7 @@ source-map@^0.5.7: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" integrity sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ== -source-map@^0.6.0, source-map@~0.6.1: +source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== @@ -5387,6 +5508,11 @@ typescript@^4.0.0, typescript@^4.5.5: resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== +uglify-js@^3.1.4: + version "3.17.4" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.17.4.tgz#61678cf5fa3f5b7eb789bb345df29afb8257c22c" + integrity sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g== + unbox-primitive@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.2.tgz#29032021057d5e6cdbd08c5129c226dff8ed6f9e" @@ -5597,6 +5723,11 @@ word-wrap@^1.2.3, word-wrap@~1.2.3: resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== +wordwrap@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== + wrap-ansi@^6.2.0: version "6.2.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53"