Skip to content

Commit

Permalink
Greptile feedbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
thomtrp committed Nov 4, 2024
1 parent abea6d8 commit a245a27
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 32 deletions.
16 changes: 8 additions & 8 deletions packages/twenty-front/src/generated-metadata/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,7 @@ export type ServerlessFunction = {
createdAt: Scalars['DateTime']['output'];
description?: Maybe<Scalars['String']['output']>;
id: Scalars['UUID']['output'];
inputSchema: Array<FunctionParameter>;
inputSchema?: Maybe<Array<FunctionParameter>>;
latestVersion?: Maybe<Scalars['String']['output']>;
name: Scalars['String']['output'];
publishedVersions: Array<Scalars['String']['output']>;
Expand Down Expand Up @@ -1987,21 +1987,21 @@ export type ObjectMetadataItemsQueryVariables = Exact<{

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 } } };

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 }> };
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 };

export type CreateOneServerlessFunctionItemMutationVariables = Exact<{
input: CreateServerlessFunctionInput;
}>;


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 }> } };
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 } };

export type DeleteOneServerlessFunctionMutationVariables = Exact<{
input: ServerlessFunctionIdInput;
}>;


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 }> } };
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 } };

export type ExecuteOneServerlessFunctionMutationVariables = Exact<{
input: ExecuteServerlessFunctionInput;
Expand All @@ -2015,14 +2015,14 @@ export type PublishOneServerlessFunctionMutationVariables = Exact<{
}>;


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 }> } };
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 } };

export type UpdateOneServerlessFunctionMutationVariables = Exact<{
input: UpdateServerlessFunctionInput;
}>;


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 }> } };
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 } };

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

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


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 }> }> };
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 }> };

export type GetOneServerlessFunctionQueryVariables = Exact<{
input: ServerlessFunctionIdInput;
}>;


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 }> } };
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 } };

export type FindOneServerlessFunctionSourceCodeQueryVariables = Exact<{
input: GetServerlessFunctionSourceCodeInput;
Expand Down
8 changes: 7 additions & 1 deletion packages/twenty-front/src/generated/graphql.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,12 @@ export type FullName = {
lastName: Scalars['String'];
};

export type FunctionParameter = {
__typename?: 'FunctionParameter';
name: Scalars['String'];
type: Scalars['String'];
};

export type GenerateJwt = GenerateJwtOutputWithAuthTokens | GenerateJwtOutputWithSsoauth;

export type GenerateJwtOutputWithAuthTokens = {
Expand Down Expand Up @@ -966,7 +972,7 @@ export type ServerlessFunction = {
createdAt: Scalars['DateTime'];
description?: Maybe<Scalars['String']>;
id: Scalars['UUID'];
inputSchema?: Maybe<Scalars['String']>;
inputSchema?: Maybe<Array<FunctionParameter>>;
latestVersion?: Maybe<Scalars['String']>;
name: Scalars['String'];
publishedVersions: Array<Scalars['String']>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,10 @@ export const WorkflowEditActionFormServerlessFunction = (
serverlessFunction?.latestVersion || 'latest';

const defaultFunctionInput = serverlessFunction?.inputSchema
.map((parameter) => parameter.name)
.reduce((acc, name) => ({ ...acc, [name]: null }), {});
? serverlessFunction.inputSchema
.map((parameter) => parameter.name)
.reduce((acc, name) => ({ ...acc, [name]: null }), {})
: {};

form.handleSubmit(async () => {
if (props.readonly === true) {
Expand All @@ -143,6 +145,7 @@ export const WorkflowEditActionFormServerlessFunction = (
{defaultFunctionInput &&
Object.keys(defaultFunctionInput).map((inputKey) => (
<Controller
key={inputKey}
name={inputKey}
control={form.control}
render={({ field }) => (
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { Field, ObjectType } from '@nestjs/graphql';

import { IsString } from 'class-validator';

@ObjectType()
export class FunctionParameter {
@IsString()
@Field(() => String)
name: string;

@IsString()
@Field(() => String)
type: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ export class ServerlessFunctionDTO {
publishedVersions: string[];

@IsArray()
@Field(() => [FunctionParameter])
inputSchema: FunctionParameter[];
@Field(() => [FunctionParameter], { nullable: true })
inputSchema: FunctionParameter[] | null;

@IsEnum(ServerlessFunctionSyncStatus)
@IsNotEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('CodeIntrospectionService', () => {
});

describe('getFunctionInputSchema', () => {
it('should getFunctionInputSchema a function declaration correctly', () => {
it('should analyze a function declaration correctly', () => {
const fileContent = `
function testFunction(param1: string, param2: number): void {
console.log(param1, param2);
Expand All @@ -34,7 +34,7 @@ describe('CodeIntrospectionService', () => {
]);
});

it('should getFunctionInputSchema an arrow function correctly', () => {
it('should analyze an arrow function correctly', () => {
const fileContent = `
const testArrowFunction = (param1: string, param2: number): void => {
console.log(param1, param2);
Expand Down Expand Up @@ -88,7 +88,7 @@ describe('CodeIntrospectionService', () => {
);
});

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

0 comments on commit a245a27

Please sign in to comment.