Skip to content

Commit 4321ece

Browse files
committed
Greptile feedbacks
1 parent 3c82fdf commit 4321ece

File tree

7 files changed

+29
-32
lines changed

7 files changed

+29
-32
lines changed

packages/twenty-front/src/generated-metadata/graphql.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,7 @@ export type ServerlessFunction = {
12321232
createdAt: Scalars['DateTime']['output'];
12331233
description?: Maybe<Scalars['String']['output']>;
12341234
id: Scalars['UUID']['output'];
1235-
inputSchema: Array<FunctionParameter>;
1235+
inputSchema?: Maybe<Array<FunctionParameter>>;
12361236
latestVersion?: Maybe<Scalars['String']['output']>;
12371237
name: Scalars['String']['output'];
12381238
publishedVersions: Array<Scalars['String']['output']>;
@@ -1987,21 +1987,21 @@ export type ObjectMetadataItemsQueryVariables = Exact<{
19871987

19881988
export type ObjectMetadataItemsQuery = { __typename?: 'Query', objects: { __typename?: 'ObjectConnection', edges: Array<{ __typename?: 'objectEdge', node: { __typename?: 'object', id: any, dataSourceId: string, nameSingular: string, namePlural: string, labelSingular: string, labelPlural: string, description?: string | null, icon?: string | null, isCustom: boolean, isRemote: boolean, isActive: boolean, isSystem: boolean, createdAt: any, updatedAt: any, labelIdentifierFieldMetadataId?: string | null, imageIdentifierFieldMetadataId?: string | null, shortcut?: string | null, isLabelSyncedWithName: boolean, indexMetadatas: { __typename?: 'ObjectIndexMetadatasConnection', edges: Array<{ __typename?: 'indexEdge', node: { __typename?: 'index', id: any, createdAt: any, updatedAt: any, name: string, indexWhereClause?: string | null, indexType: IndexType, isUnique: boolean, indexFieldMetadatas: { __typename?: 'IndexIndexFieldMetadatasConnection', edges: Array<{ __typename?: 'indexFieldEdge', node: { __typename?: 'indexField', id: any, createdAt: any, updatedAt: any, order: number, fieldMetadataId: any } }> } } }> }, fields: { __typename?: 'ObjectFieldsConnection', edges: Array<{ __typename?: 'fieldEdge', node: { __typename?: 'field', id: any, type: FieldMetadataType, name: string, label: string, description?: string | null, icon?: string | null, isCustom?: boolean | null, isActive?: boolean | null, isSystem?: boolean | null, isNullable?: boolean | null, isUnique?: boolean | null, createdAt: any, updatedAt: any, defaultValue?: any | null, options?: any | null, settings?: any | null, relationDefinition?: { __typename?: 'RelationDefinition', relationId: any, direction: RelationDefinitionType, sourceObjectMetadata: { __typename?: 'object', id: any, nameSingular: string, namePlural: string }, sourceFieldMetadata: { __typename?: 'field', id: any, name: string }, targetObjectMetadata: { __typename?: 'object', id: any, nameSingular: string, namePlural: string }, targetFieldMetadata: { __typename?: 'field', id: any, name: string } } | null } }>, pageInfo: { __typename?: 'PageInfo', hasNextPage?: boolean | null, hasPreviousPage?: boolean | null, startCursor?: any | null, endCursor?: any | null } } } }>, pageInfo: { __typename?: 'PageInfo', hasNextPage?: boolean | null, hasPreviousPage?: boolean | null, startCursor?: any | null, endCursor?: any | null } } };
19891989

1990-
export type ServerlessFunctionFieldsFragment = { __typename?: 'ServerlessFunction', id: any, name: string, description?: string | null, runtime: string, syncStatus: ServerlessFunctionSyncStatus, latestVersion?: string | null, publishedVersions: Array<string>, createdAt: any, updatedAt: any, inputSchema: Array<{ __typename?: 'FunctionParameter', name: string, type: string }> };
1990+
export type ServerlessFunctionFieldsFragment = { __typename?: 'ServerlessFunction', id: any, name: string, description?: string | null, runtime: string, syncStatus: ServerlessFunctionSyncStatus, latestVersion?: string | null, publishedVersions: Array<string>, createdAt: any, updatedAt: any, inputSchema?: Array<{ __typename?: 'FunctionParameter', name: string, type: string }> | null };
19911991

19921992
export type CreateOneServerlessFunctionItemMutationVariables = Exact<{
19931993
input: CreateServerlessFunctionInput;
19941994
}>;
19951995

19961996

1997-
export type CreateOneServerlessFunctionItemMutation = { __typename?: 'Mutation', createOneServerlessFunction: { __typename?: 'ServerlessFunction', id: any, name: string, description?: string | null, runtime: string, syncStatus: ServerlessFunctionSyncStatus, latestVersion?: string | null, publishedVersions: Array<string>, createdAt: any, updatedAt: any, inputSchema: Array<{ __typename?: 'FunctionParameter', name: string, type: string }> } };
1997+
export type CreateOneServerlessFunctionItemMutation = { __typename?: 'Mutation', createOneServerlessFunction: { __typename?: 'ServerlessFunction', id: any, name: string, description?: string | null, runtime: string, syncStatus: ServerlessFunctionSyncStatus, latestVersion?: string | null, publishedVersions: Array<string>, createdAt: any, updatedAt: any, inputSchema?: Array<{ __typename?: 'FunctionParameter', name: string, type: string }> | null } };
19981998

19991999
export type DeleteOneServerlessFunctionMutationVariables = Exact<{
20002000
input: ServerlessFunctionIdInput;
20012001
}>;
20022002

20032003

2004-
export type DeleteOneServerlessFunctionMutation = { __typename?: 'Mutation', deleteOneServerlessFunction: { __typename?: 'ServerlessFunction', id: any, name: string, description?: string | null, runtime: string, syncStatus: ServerlessFunctionSyncStatus, latestVersion?: string | null, publishedVersions: Array<string>, createdAt: any, updatedAt: any, inputSchema: Array<{ __typename?: 'FunctionParameter', name: string, type: string }> } };
2004+
export type DeleteOneServerlessFunctionMutation = { __typename?: 'Mutation', deleteOneServerlessFunction: { __typename?: 'ServerlessFunction', id: any, name: string, description?: string | null, runtime: string, syncStatus: ServerlessFunctionSyncStatus, latestVersion?: string | null, publishedVersions: Array<string>, createdAt: any, updatedAt: any, inputSchema?: Array<{ __typename?: 'FunctionParameter', name: string, type: string }> | null } };
20052005

20062006
export type ExecuteOneServerlessFunctionMutationVariables = Exact<{
20072007
input: ExecuteServerlessFunctionInput;
@@ -2015,14 +2015,14 @@ export type PublishOneServerlessFunctionMutationVariables = Exact<{
20152015
}>;
20162016

20172017

2018-
export type PublishOneServerlessFunctionMutation = { __typename?: 'Mutation', publishServerlessFunction: { __typename?: 'ServerlessFunction', id: any, name: string, description?: string | null, runtime: string, syncStatus: ServerlessFunctionSyncStatus, latestVersion?: string | null, publishedVersions: Array<string>, createdAt: any, updatedAt: any, inputSchema: Array<{ __typename?: 'FunctionParameter', name: string, type: string }> } };
2018+
export type PublishOneServerlessFunctionMutation = { __typename?: 'Mutation', publishServerlessFunction: { __typename?: 'ServerlessFunction', id: any, name: string, description?: string | null, runtime: string, syncStatus: ServerlessFunctionSyncStatus, latestVersion?: string | null, publishedVersions: Array<string>, createdAt: any, updatedAt: any, inputSchema?: Array<{ __typename?: 'FunctionParameter', name: string, type: string }> | null } };
20192019

20202020
export type UpdateOneServerlessFunctionMutationVariables = Exact<{
20212021
input: UpdateServerlessFunctionInput;
20222022
}>;
20232023

20242024

2025-
export type UpdateOneServerlessFunctionMutation = { __typename?: 'Mutation', updateOneServerlessFunction: { __typename?: 'ServerlessFunction', id: any, name: string, description?: string | null, runtime: string, syncStatus: ServerlessFunctionSyncStatus, latestVersion?: string | null, publishedVersions: Array<string>, createdAt: any, updatedAt: any, inputSchema: Array<{ __typename?: 'FunctionParameter', name: string, type: string }> } };
2025+
export type UpdateOneServerlessFunctionMutation = { __typename?: 'Mutation', updateOneServerlessFunction: { __typename?: 'ServerlessFunction', id: any, name: string, description?: string | null, runtime: string, syncStatus: ServerlessFunctionSyncStatus, latestVersion?: string | null, publishedVersions: Array<string>, createdAt: any, updatedAt: any, inputSchema?: Array<{ __typename?: 'FunctionParameter', name: string, type: string }> | null } };
20262026

20272027
export type FindManyAvailablePackagesQueryVariables = Exact<{ [key: string]: never; }>;
20282028

@@ -2032,14 +2032,14 @@ export type FindManyAvailablePackagesQuery = { __typename?: 'Query', getAvailabl
20322032
export type GetManyServerlessFunctionsQueryVariables = Exact<{ [key: string]: never; }>;
20332033

20342034

2035-
export type GetManyServerlessFunctionsQuery = { __typename?: 'Query', findManyServerlessFunctions: Array<{ __typename?: 'ServerlessFunction', id: any, name: string, description?: string | null, runtime: string, syncStatus: ServerlessFunctionSyncStatus, latestVersion?: string | null, publishedVersions: Array<string>, createdAt: any, updatedAt: any, inputSchema: Array<{ __typename?: 'FunctionParameter', name: string, type: string }> }> };
2035+
export type GetManyServerlessFunctionsQuery = { __typename?: 'Query', findManyServerlessFunctions: Array<{ __typename?: 'ServerlessFunction', id: any, name: string, description?: string | null, runtime: string, syncStatus: ServerlessFunctionSyncStatus, latestVersion?: string | null, publishedVersions: Array<string>, createdAt: any, updatedAt: any, inputSchema?: Array<{ __typename?: 'FunctionParameter', name: string, type: string }> | null }> };
20362036

20372037
export type GetOneServerlessFunctionQueryVariables = Exact<{
20382038
input: ServerlessFunctionIdInput;
20392039
}>;
20402040

20412041

2042-
export type GetOneServerlessFunctionQuery = { __typename?: 'Query', findOneServerlessFunction: { __typename?: 'ServerlessFunction', id: any, name: string, description?: string | null, runtime: string, syncStatus: ServerlessFunctionSyncStatus, latestVersion?: string | null, publishedVersions: Array<string>, createdAt: any, updatedAt: any, inputSchema: Array<{ __typename?: 'FunctionParameter', name: string, type: string }> } };
2042+
export type GetOneServerlessFunctionQuery = { __typename?: 'Query', findOneServerlessFunction: { __typename?: 'ServerlessFunction', id: any, name: string, description?: string | null, runtime: string, syncStatus: ServerlessFunctionSyncStatus, latestVersion?: string | null, publishedVersions: Array<string>, createdAt: any, updatedAt: any, inputSchema?: Array<{ __typename?: 'FunctionParameter', name: string, type: string }> | null } };
20432043

20442044
export type FindOneServerlessFunctionSourceCodeQueryVariables = Exact<{
20452045
input: GetServerlessFunctionSourceCodeInput;

packages/twenty-front/src/generated/graphql.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,12 @@ export type FullName = {
321321
lastName: Scalars['String'];
322322
};
323323

324+
export type FunctionParameter = {
325+
__typename?: 'FunctionParameter';
326+
name: Scalars['String'];
327+
type: Scalars['String'];
328+
};
329+
324330
export type GenerateJwt = GenerateJwtOutputWithAuthTokens | GenerateJwtOutputWithSsoauth;
325331

326332
export type GenerateJwtOutputWithAuthTokens = {
@@ -966,7 +972,7 @@ export type ServerlessFunction = {
966972
createdAt: Scalars['DateTime'];
967973
description?: Maybe<Scalars['String']>;
968974
id: Scalars['UUID'];
969-
inputSchema?: Maybe<Scalars['String']>;
975+
inputSchema?: Maybe<Array<FunctionParameter>>;
970976
latestVersion?: Maybe<Scalars['String']>;
971977
name: Scalars['String'];
972978
publishedVersions: Array<Scalars['String']>;

packages/twenty-front/src/modules/workflow/components/WorkflowEditActionFormServerlessFunction.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,10 @@ export const WorkflowEditActionFormServerlessFunction = (
116116
serverlessFunction?.latestVersion || 'latest';
117117

118118
const defaultFunctionInput = serverlessFunction?.inputSchema
119-
.map((parameter) => parameter.name)
120-
.reduce((acc, name) => ({ ...acc, [name]: null }), {});
119+
? serverlessFunction.inputSchema
120+
.map((parameter) => parameter.name)
121+
.reduce((acc, name) => ({ ...acc, [name]: null }), {})
122+
: {};
121123

122124
form.handleSubmit(async () => {
123125
if (props.readonly === true) {
@@ -143,6 +145,7 @@ export const WorkflowEditActionFormServerlessFunction = (
143145
{defaultFunctionInput &&
144146
Object.keys(defaultFunctionInput).map((inputKey) => (
145147
<Controller
148+
key={inputKey}
146149
name={inputKey}
147150
control={form.control}
148151
render={({ field }) => (

packages/twenty-server/src/engine/core-modules/workflow/dtos/compute-serverless-function-input-schema-input.dto.ts

-16
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import { Field, ObjectType } from '@nestjs/graphql';
22

3+
import { IsString } from 'class-validator';
4+
35
@ObjectType()
46
export class FunctionParameter {
7+
@IsString()
58
@Field(() => String)
69
name: string;
710

11+
@IsString()
812
@Field(() => String)
913
type: string;
1014
}

packages/twenty-server/src/engine/metadata-modules/serverless-function/dtos/serverless-function.dto.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ export class ServerlessFunctionDTO {
6666
publishedVersions: string[];
6767

6868
@IsArray()
69-
@Field(() => [FunctionParameter])
70-
inputSchema: FunctionParameter[];
69+
@Field(() => [FunctionParameter], { nullable: true })
70+
inputSchema: FunctionParameter[] | null;
7171

7272
@IsEnum(ServerlessFunctionSyncStatus)
7373
@IsNotEmpty()

packages/twenty-server/src/modules/code-introspection/__tests__/code-introspection.service.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('CodeIntrospectionService', () => {
1919
});
2020

2121
describe('getFunctionInputSchema', () => {
22-
it('should getFunctionInputSchema a function declaration correctly', () => {
22+
it('should analyze a function declaration correctly', () => {
2323
const fileContent = `
2424
function testFunction(param1: string, param2: number): void {
2525
console.log(param1, param2);
@@ -34,7 +34,7 @@ describe('CodeIntrospectionService', () => {
3434
]);
3535
});
3636

37-
it('should getFunctionInputSchema an arrow function correctly', () => {
37+
it('should analyze an arrow function correctly', () => {
3838
const fileContent = `
3939
const testArrowFunction = (param1: string, param2: number): void => {
4040
console.log(param1, param2);
@@ -88,7 +88,7 @@ describe('CodeIntrospectionService', () => {
8888
);
8989
});
9090

91-
it('should correctly getFunctionInputSchema complex types', () => {
91+
it('should correctly analyze complex types', () => {
9292
const fileContent = `
9393
function complexFunction(param1: string[], param2: { key: number }): Promise<boolean> {
9494
return Promise.resolve(true);

0 commit comments

Comments
 (0)