Spaces:
Build error
Build error
File size: 2,726 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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | import {
Field,
HideField,
ObjectType,
registerEnumType,
} from '@nestjs/graphql';
import {
Authorize,
IDField,
QueryOptions,
} from '@ptc-org/nestjs-query-graphql';
import {
IsDateString,
IsEnum,
IsNotEmpty,
IsNumber,
IsObject,
IsOptional,
IsString,
IsUUID,
} from 'class-validator';
import graphqlTypeJson from 'graphql-type-json';
import {
CronTriggerSettings,
DatabaseEventTriggerSettings,
HttpRouteTriggerSettings,
ToolTriggerSettings,
WorkflowActionTriggerSettings,
} from 'twenty-shared/application';
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
import { LogicFunctionExecutionMode } from 'src/engine/metadata-modules/logic-function/logic-function.entity';
registerEnumType(LogicFunctionExecutionMode, {
name: 'LogicFunctionExecutionMode',
});
@ObjectType('LogicFunction')
@Authorize({
// oxlint-disable-next-line typescript/no-explicit-any
authorize: (context: any) => ({
workspaceId: { eq: context?.req?.workspace?.id },
}),
})
@QueryOptions({
defaultResultSize: 10,
maxResultsSize: 1000,
})
export class LogicFunctionDTO {
@IsUUID()
@IsNotEmpty()
@IDField(() => UUIDScalarType)
id: string;
@IsString()
@Field()
name: string;
@IsString()
@Field({ nullable: true })
description?: string;
@IsString()
@IsNotEmpty()
@Field()
runtime: string;
@IsNumber()
@Field()
timeoutSeconds: number;
@IsEnum(LogicFunctionExecutionMode)
@Field(() => LogicFunctionExecutionMode)
executionMode: LogicFunctionExecutionMode;
@IsString()
@Field()
sourceHandlerPath: string;
@IsString()
@Field()
handlerName: string;
@IsObject()
@IsOptional()
@Field(() => graphqlTypeJson, { nullable: true })
cronTriggerSettings?: CronTriggerSettings;
@IsObject()
@IsOptional()
@Field(() => graphqlTypeJson, { nullable: true })
databaseEventTriggerSettings?: DatabaseEventTriggerSettings;
@IsObject()
@IsOptional()
@Field(() => graphqlTypeJson, { nullable: true })
httpRouteTriggerSettings?: HttpRouteTriggerSettings;
@IsObject()
@IsOptional()
@Field(() => graphqlTypeJson, { nullable: true })
toolTriggerSettings?: ToolTriggerSettings;
@IsObject()
@IsOptional()
@Field(() => graphqlTypeJson, { nullable: true })
workflowActionTriggerSettings?: WorkflowActionTriggerSettings;
@IsUUID()
@IsOptional()
@Field(() => UUIDScalarType, { nullable: true })
applicationId?: string;
@IsUUID()
@IsOptional()
@Field(() => UUIDScalarType, { nullable: true })
universalIdentifier?: string;
@HideField()
workspaceId: string;
@IsDateString()
@Field()
createdAt: Date;
@IsDateString()
@Field()
updatedAt: Date;
}
|