File size: 1,509 Bytes
d9494a5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { type LogicFunctionDTO } from 'src/engine/metadata-modules/logic-function/dtos/logic-function.dto';
import { type FlatLogicFunction } from 'src/engine/metadata-modules/logic-function/types/flat-logic-function.type';

export const fromFlatLogicFunctionToLogicFunctionDto = ({
  flatLogicFunction,
}: {
  flatLogicFunction: FlatLogicFunction;
}): LogicFunctionDTO => {
  return {
    id: flatLogicFunction.id,
    universalIdentifier: flatLogicFunction.universalIdentifier,
    name: flatLogicFunction.name,
    description: flatLogicFunction.description ?? undefined,
    runtime: flatLogicFunction.runtime,
    timeoutSeconds: flatLogicFunction.timeoutSeconds,
    executionMode: flatLogicFunction.executionMode,
    sourceHandlerPath: flatLogicFunction.sourceHandlerPath,
    handlerName: flatLogicFunction.handlerName,
    applicationId: flatLogicFunction.applicationId ?? undefined,
    workspaceId: flatLogicFunction.workspaceId,
    createdAt: new Date(flatLogicFunction.createdAt),
    updatedAt: new Date(flatLogicFunction.updatedAt),
    cronTriggerSettings: flatLogicFunction.cronTriggerSettings ?? undefined,
    databaseEventTriggerSettings:
      flatLogicFunction.databaseEventTriggerSettings ?? undefined,
    httpRouteTriggerSettings:
      flatLogicFunction.httpRouteTriggerSettings ?? undefined,
    toolTriggerSettings: flatLogicFunction.toolTriggerSettings ?? undefined,
    workflowActionTriggerSettings:
      flatLogicFunction.workflowActionTriggerSettings ?? undefined,
  };
};