feat(ui): add axios client generator and simple example

This commit is contained in:
psychedelicious 2023-03-14 22:14:08 +11:00
parent c4e6511a59
commit 1c7d92dc48
84 changed files with 3244 additions and 9 deletions

View File

@ -6,3 +6,4 @@ stats.html
index.html
.yarn/
*.scss
src/services/api/

View File

@ -4,3 +4,4 @@ node_modules/
patches/
stats.html
.yarn/
src/services/api/

View File

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

View File

@ -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<number>();
const [status, setStatus] = useState<STATUS>(STATUS.waiting);
const [sessionId, setSessionId] = useState<string | null>(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 (
<Flex
sx={{
flexDirection: 'column',
gap: 4,
p: 4,
alignItems: 'center',
borderRadius: 'base',
}}
>
<Heading size="lg">Status: {status}</Heading>
<Text>Session: {sessionId ? sessionId : '...'}</Text>
<IAIButton
onClick={handleCreateSession}
isDisabled={!!sessionId}
colorScheme="accent"
>
Create Session
</IAIButton>
<IAIButton
onClick={handleInvokeSession}
isDisabled={!sessionId || status !== STATUS.ready}
isLoading={[STATUS.preparing, STATUS.generating].includes(status)}
loadingText={`Invoking ${
invocationProgress === undefined
? '...'
: `${Math.round(invocationProgress * 100)}%`
}`}
colorScheme="accent"
>
Invoke
</IAIButton>
</Flex>
);
};
export default NodeAPITest;

View File

@ -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() {
<Flex
sx={{
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
w: '100%',
h: '100%',
gap: 4,
textAlign: 'center',
}}
>
<Heading>{t('common.nodes')}</Heading>
<VStack maxW="50rem" gap={4}>
<Text>{t('common.nodesDesc')}</Text>
</VStack>
<NodeAPITest />
</Flex>
</WorkInProgress>
);

View File

@ -14,6 +14,7 @@ const WorkInProgress = (props: WorkInProgressProps) => {
width: '100%',
height: '100%',
bg: 'base.850',
borderRadius: 'base',
}}
>
{children}

View File

@ -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<Array<any>>;
...
}
```
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.

View File

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

View File

@ -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<string, any>;
readonly cookies?: Record<string, any>;
readonly headers?: Record<string, any>;
readonly query?: Record<string, any>;
readonly formData?: Record<string, any>;
readonly body?: any;
readonly mediaType?: string;
readonly responseHeader?: string;
readonly errors?: Record<number, string>;
};

View File

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

View File

@ -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<T> implements Promise<T> {
readonly [Symbol.toStringTag]!: string;
private _isResolved: boolean;
private _isRejected: boolean;
private _isCancelled: boolean;
private readonly _cancelHandlers: (() => void)[];
private readonly _promise: Promise<T>;
private _resolve?: (value: T | PromiseLike<T>) => void;
private _reject?: (reason?: any) => void;
constructor(
executor: (
resolve: (value: T | PromiseLike<T>) => void,
reject: (reason?: any) => void,
onCancel: OnCancel
) => void
) {
this._isResolved = false;
this._isRejected = false;
this._isCancelled = false;
this._cancelHandlers = [];
this._promise = new Promise<T>((resolve, reject) => {
this._resolve = resolve;
this._reject = reject;
const onResolve = (value: T | PromiseLike<T>): 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<TResult1 = T, TResult2 = never>(
onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null
): Promise<TResult1 | TResult2> {
return this._promise.then(onFulfilled, onRejected);
}
public catch<TResult = never>(
onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null
): Promise<T | TResult> {
return this._promise.catch(onRejected);
}
public finally(onFinally?: (() => void) | null): Promise<T> {
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;
}
}

View File

@ -0,0 +1,31 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ApiRequestOptions } from './ApiRequestOptions';
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
type Headers = Record<string, string>;
export type OpenAPIConfig = {
BASE: string;
VERSION: string;
WITH_CREDENTIALS: boolean;
CREDENTIALS: 'include' | 'omit' | 'same-origin';
TOKEN?: string | Resolver<string>;
USERNAME?: string | Resolver<string>;
PASSWORD?: string | Resolver<string>;
HEADERS?: Headers | Resolver<Headers>;
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,
};

View File

@ -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 = <T>(value: T | null | undefined): value is Exclude<T, null | undefined> => {
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, any>): 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<T> = (options: ApiRequestOptions) => Promise<T>;
const resolve = async <T>(options: ApiRequestOptions, resolver?: T | Resolver<T>): Promise<T | undefined> => {
if (typeof resolver === 'function') {
return (resolver as Resolver<T>)(options);
}
return resolver;
};
const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions, formData?: FormData): Promise<Record<string, string>> => {
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<string, string>);
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 <T>(
config: OpenAPIConfig,
options: ApiRequestOptions,
url: string,
body: any,
formData: FormData | undefined,
headers: Record<string, string>,
onCancel: OnCancel
): Promise<AxiosResponse<T>> => {
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<T>;
if (axiosError.response) {
return axiosError.response;
}
throw error;
}
};
const getResponseHeader = (response: AxiosResponse<any>, responseHeader?: string): string | undefined => {
if (responseHeader) {
const content = response.headers[responseHeader];
if (isString(content)) {
return content;
}
}
return undefined;
};
const getResponseBody = (response: AxiosResponse<any>): any => {
if (response.status !== 204) {
return response.data;
}
return undefined;
};
const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void => {
const errors: Record<number, string> = {
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<T>
* @throws ApiError
*/
export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions): CancelablePromise<T> => {
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<T>(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);
}
});
};

View File

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

View File

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

View File

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

View File

@ -0,0 +1,8 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type Body_upload_image = {
file: Blob;
};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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<string, (LoadImageInvocation | ShowImageInvocation | CropImageInvocation | PasteImageInvocation | MaskFromAlphaInvocation | BlurInvocation | LerpInvocation | InverseLerpInvocation | CvInpaintInvocation | UpscaleInvocation | RestoreFaceInvocation | TextToImageInvocation | GraphInvocation | IterateInvocation | CollectInvocation | ImageToImageInvocation | InpaintInvocation)>;
/**
* The connections between nodes and their fields in this graph
*/
edges?: Array<[EdgeConnection, EdgeConnection]>;
};

View File

@ -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<string>;
/**
* The list of node ids that have been executed, in order of execution
*/
executed_history?: Array<string>;
/**
* The results of node executions
*/
results?: Record<string, (ImageOutput | MaskOutput | PromptOutput | GraphInvocationOutput | IterateInvocationOutput | CollectInvocationOutput)>;
/**
* Errors raised when executing nodes
*/
errors?: Record<string, string>;
/**
* The map of prepared nodes to original graph nodes
*/
prepared_source_mapping?: Record<string, string>;
/**
* The map of original graph nodes to prepared nodes
*/
source_prepared_mapping?: Record<string, Array<string>>;
};

View File

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

View File

@ -0,0 +1,11 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
/**
* Base class for all invocation outputs
*/
export type GraphInvocationOutput = {
type?: 'graph_output';
};

View File

@ -0,0 +1,10 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ValidationError } from './ValidationError';
export type HTTPValidationError = {
detail?: Array<ValidationError>;
};

View File

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

View File

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

View File

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

View File

@ -0,0 +1,8 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
/**
* An enumeration.
*/
export type ImageType = 'results' | 'intermediates' | 'uploads';

View File

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

View File

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

View File

@ -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<any>;
/**
* The index, will be provided on executed iterators
*/
index?: number;
};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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<GraphExecutionState>;
/**
* 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;
};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,10 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type ValidationError = {
loc: Array<(string | number)>;
msg: string;
type: string;
};

File diff suppressed because one or more lines are too long

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,13 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $HTTPValidationError = {
properties: {
detail: {
type: 'array',
contains: {
type: 'ValidationError',
},
},
},
} as const;

View File

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

View File

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

View File

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

View File

@ -0,0 +1,6 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $ImageType = {
type: 'Enum',
} as const;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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<any> {
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<any> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/v1/images/uploads/',
formData: formData,
mediaType: 'multipart/form-data',
errors: {
404: `Session not found`,
422: `Validation Error`,
},
});
}
}

View File

@ -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<PaginatedResults_GraphExecutionState_> {
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<GraphExecutionState> {
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<GraphExecutionState> {
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<string> {
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<GraphExecutionState> {
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<GraphExecutionState> {
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<any>,
): CancelablePromise<GraphExecutionState> {
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<GraphExecutionState> {
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<any> {
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`,
},
});
}
}

View File

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

View File

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