fix(ui): update types

This commit is contained in:
psychedelicious 2024-05-29 21:06:16 +10:00
parent 7cb32d3d83
commit a983f27aad
3 changed files with 7 additions and 7 deletions

View File

@ -11,7 +11,7 @@ import { selectLastSelectedNode } from 'features/nodes/store/selectors';
import { isInvocationNode } from 'features/nodes/types/invocation'; import { isInvocationNode } from 'features/nodes/types/invocation';
import { memo, useMemo } from 'react'; import { memo, useMemo } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import type { ImageOutput, S } from 'services/api/types'; import type { AnyInvocationOutput, ImageOutput } from 'services/api/types';
import ImageOutputPreview from './outputs/ImageOutputPreview'; import ImageOutputPreview from './outputs/ImageOutputPreview';
@ -65,4 +65,4 @@ const InspectorOutputsTab = () => {
export default memo(InspectorOutputsTab); export default memo(InspectorOutputsTab);
const getKey = (result: S['AnyInvocationOutput'], i: number) => `${result.type}-${i}`; const getKey = (result: AnyInvocationOutput, i: number) => `${result.type}-${i}`;

View File

@ -1,7 +1,7 @@
import type { NodesState } from 'features/nodes/store/types'; import type { NodesState } from 'features/nodes/store/types';
import { isInvocationNode } from 'features/nodes/types/invocation'; import { isInvocationNode } from 'features/nodes/types/invocation';
import { omit, reduce } from 'lodash-es'; import { omit, reduce } from 'lodash-es';
import type { Graph, S } from 'services/api/types'; import type { AnyInvocation, Graph } from 'services/api/types';
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
/** /**
@ -81,7 +81,7 @@ export const buildNodesGraph = (nodesState: NodesState): Graph => {
parsedEdges.forEach((edge) => { parsedEdges.forEach((edge) => {
const destination_node = parsedNodes[edge.destination.node_id]; const destination_node = parsedNodes[edge.destination.node_id];
const field = edge.destination.field; const field = edge.destination.field;
parsedNodes[edge.destination.node_id] = omit(destination_node, field) as S['AnyInvocation']; parsedNodes[edge.destination.node_id] = omit(destination_node, field) as AnyInvocation;
}); });
// Assemble! // Assemble!

View File

@ -131,14 +131,14 @@ export type WorkflowRecordListItemDTO = S['WorkflowRecordListItemDTO'];
type KeysOfUnion<T> = T extends T ? keyof T : never; type KeysOfUnion<T> = T extends T ? keyof T : never;
export type AnyInvocation = Exclude< export type AnyInvocation = Exclude<
S['AnyInvocation'], NonNullable<S['Graph']['nodes']>[string],
S['CoreMetadataInvocation'] | S['MetadataInvocation'] | S['MetadataItemInvocation'] | S['MergeMetadataInvocation'] S['CoreMetadataInvocation'] | S['MetadataInvocation'] | S['MetadataItemInvocation'] | S['MergeMetadataInvocation']
>; >;
export type AnyInvocationIncMetadata = S['AnyInvocation']; export type AnyInvocationIncMetadata = NonNullable<S['Graph']['nodes']>[string];
export type InvocationType = AnyInvocation['type']; export type InvocationType = AnyInvocation['type'];
type InvocationOutputMap = S['InvocationOutputMap']; type InvocationOutputMap = S['InvocationOutputMap'];
type AnyInvocationOutput = InvocationOutputMap[InvocationType]; export type AnyInvocationOutput = InvocationOutputMap[InvocationType];
export type Invocation<T extends InvocationType> = Extract<AnyInvocation, { type: T }>; export type Invocation<T extends InvocationType> = Extract<AnyInvocation, { type: T }>;
// export type InvocationOutput<T extends InvocationType> = InvocationOutputMap[T]; // export type InvocationOutput<T extends InvocationType> = InvocationOutputMap[T];