49afe5dbc4
- Makes engineComponentKey non-nullable on CommandMenuItem. Adds two new engine component keys: TRIGGER_WORKFLOW_VERSION and FRONT_COMPONENT_RENDERER to cover the former standalone cases. - Unifies the previously separated engine, front component and workflow runners into a single `CommandRunner` component with a unified `useMountCommand` hook that handles all command types.
27 lines
1.4 KiB
TypeScript
27 lines
1.4 KiB
TypeScript
import { type CommandMenuItemDTO } from 'src/engine/metadata-modules/command-menu-item/dtos/command-menu-item.dto';
|
|
import { type FlatCommandMenuItem } from 'src/engine/metadata-modules/flat-command-menu-item/types/flat-command-menu-item.type';
|
|
|
|
export const fromFlatCommandMenuItemToCommandMenuItemDto = (
|
|
flatCommandMenuItem: FlatCommandMenuItem,
|
|
): CommandMenuItemDTO => ({
|
|
id: flatCommandMenuItem.id,
|
|
workflowVersionId: flatCommandMenuItem.workflowVersionId ?? undefined,
|
|
frontComponentId: flatCommandMenuItem.frontComponentId ?? undefined,
|
|
engineComponentKey: flatCommandMenuItem.engineComponentKey,
|
|
label: flatCommandMenuItem.label,
|
|
icon: flatCommandMenuItem.icon ?? undefined,
|
|
shortLabel: flatCommandMenuItem.shortLabel ?? undefined,
|
|
position: flatCommandMenuItem.position,
|
|
isPinned: flatCommandMenuItem.isPinned,
|
|
hotKeys: flatCommandMenuItem.hotKeys ?? undefined,
|
|
availabilityType: flatCommandMenuItem.availabilityType,
|
|
conditionalAvailabilityExpression:
|
|
flatCommandMenuItem.conditionalAvailabilityExpression ?? undefined,
|
|
availabilityObjectMetadataId:
|
|
flatCommandMenuItem.availabilityObjectMetadataId ?? undefined,
|
|
workspaceId: flatCommandMenuItem.workspaceId,
|
|
applicationId: flatCommandMenuItem.applicationId ?? undefined,
|
|
createdAt: new Date(flatCommandMenuItem.createdAt),
|
|
updatedAt: new Date(flatCommandMenuItem.updatedAt),
|
|
});
|