6181 workflows create a custom code executor (#6235)

Closes #6181

## Testing
- download Altair graphql dev tool https://altairgraphql.dev/#download
- create a file locally `test.ts` containing:
```
export const handler = async (event: object, context: object) => {
  return { test: 'toto', data: event['data'] };
}
```
- play those requests in Altair:
mutation UpsertFunction($file: Upload!) {
  upsertFunction(name: "toto", file: $file)
}

mutation ExecFunction {
  executeFunction(name:"toto", payload: {data: "titi"})
}
- it will run the local driver, add those env variable to test with
lambda driver
```
CUSTOM_CODE_ENGINE_DRIVER_TYPE=lambda
LAMBDA_REGION=eu-west-2
LAMBDA_ROLE=<ASK_ME>
```
This commit is contained in:
martmull
2024-07-17 17:53:01 +02:00
committed by GitHub
parent e6f6069fe7
commit 47ddc7be83
37 changed files with 2382 additions and 16 deletions

View File

@ -26,6 +26,13 @@ export type Scalars = {
Upload: { input: any; output: any; }
};
export type AisqlQueryResult = {
__typename?: 'AISQLQueryResult';
queryFailedErrorMessage?: Maybe<Scalars['String']['output']>;
sqlQuery: Scalars['String']['output'];
sqlQueryResult?: Maybe<Scalars['String']['output']>;
};
export type ActivateWorkspaceInput = {
displayName?: InputMaybe<Scalars['String']['input']>;
};
@ -345,6 +352,7 @@ export enum FileFolder {
Attachment = 'Attachment',
PersonPicture = 'PersonPicture',
ProfilePicture = 'ProfilePicture',
ServerlessFunction = 'ServerlessFunction',
WorkspaceLogo = 'WorkspaceLogo'
}
@ -397,6 +405,7 @@ export type Mutation = {
createOneObject: Object;
createOneRelation: Relation;
createOneRemoteServer: RemoteServer;
createOneServerlessFunction: ServerlessFunction;
deleteCurrentWorkspace: Workspace;
deleteOneField: Field;
deleteOneObject: Object;
@ -407,6 +416,7 @@ export type Mutation = {
emailPasswordResetLink: EmailPasswordResetLink;
enablePostgresProxy: PostgresCredentials;
exchangeAuthorizationCode: ExchangeAuthCode;
executeOneServerlessFunction: ServerlessFunctionExecutionResult;
generateApiKeyToken: ApiKeyToken;
generateJWT: AuthTokens;
generateTransientToken: TransientToken;
@ -488,6 +498,12 @@ export type MutationCreateOneRemoteServerArgs = {
};
export type MutationCreateOneServerlessFunctionArgs = {
file: Scalars['Upload']['input'];
name: Scalars['String']['input'];
};
export type MutationDeleteOneFieldArgs = {
input: DeleteOneFieldInput;
};
@ -520,6 +536,12 @@ export type MutationExchangeAuthorizationCodeArgs = {
};
export type MutationExecuteOneServerlessFunctionArgs = {
name: Scalars['String']['input'];
payload?: InputMaybe<Scalars['JSON']['input']>;
};
export type MutationGenerateApiKeyTokenArgs = {
apiKeyId: Scalars['String']['input'];
expiresAt: Scalars['String']['input'];
@ -707,6 +729,7 @@ export type Query = {
findManyRemoteServersByType: Array<RemoteServer>;
findOneRemoteServerById: RemoteServer;
findWorkspaceFromInviteHash: Workspace;
getAISQLQuery: AisqlQueryResult;
getPostgresCredentials?: Maybe<PostgresCredentials>;
getProductPrices: ProductPricesEntity;
getTimelineCalendarEventsFromCompanyId: TimelineCalendarEventsWithTotal;
@ -717,6 +740,8 @@ export type Query = {
objects: ObjectConnection;
relation: Relation;
relations: RelationConnection;
serverlessFunction: ServerlessFunction;
serverlessFunctions: ServerlessFunctionConnection;
validatePasswordResetToken: ValidatePasswordResetToken;
};
@ -768,6 +793,11 @@ export type QueryFindWorkspaceFromInviteHashArgs = {
};
export type QueryGetAisqlQueryArgs = {
text: Scalars['String']['input'];
};
export type QueryGetProductPricesArgs = {
product: Scalars['String']['input'];
};
@ -822,6 +852,18 @@ export type QueryRelationsArgs = {
};
export type QueryServerlessFunctionArgs = {
id: Scalars['UUID']['input'];
};
export type QueryServerlessFunctionsArgs = {
filter?: ServerlessFunctionFilter;
paging?: CursorPaging;
sorting?: Array<ServerlessFunctionSort>;
};
export type QueryValidatePasswordResetTokenArgs = {
passwordResetToken: Scalars['String']['input'];
};
@ -915,6 +957,26 @@ export type Sentry = {
release?: Maybe<Scalars['String']['output']>;
};
export type ServerlessFunctionConnection = {
__typename?: 'ServerlessFunctionConnection';
/** Array of edges. */
edges: Array<ServerlessFunctionEdge>;
/** Paging information */
pageInfo: PageInfo;
};
export type ServerlessFunctionExecutionResult = {
__typename?: 'ServerlessFunctionExecutionResult';
/** Execution result in JSON format */
result: Scalars['JSON']['output'];
};
/** SyncStatus of the serverlessFunction */
export enum ServerlessFunctionSyncStatus {
NotReady = 'NOT_READY',
Ready = 'READY'
}
export type SessionEntity = {
__typename?: 'SessionEntity';
url?: Maybe<Scalars['String']['output']>;
@ -1345,6 +1407,39 @@ export type RelationEdge = {
node: Relation;
};
export type ServerlessFunction = {
__typename?: 'serverlessFunction';
createdAt: Scalars['DateTime']['output'];
id: Scalars['UUID']['output'];
name: Scalars['String']['output'];
syncStatus: ServerlessFunctionSyncStatus;
updatedAt: Scalars['DateTime']['output'];
};
export type ServerlessFunctionEdge = {
__typename?: 'serverlessFunctionEdge';
/** Cursor for this node. */
cursor: Scalars['ConnectionCursor']['output'];
/** The node containing the serverlessFunction */
node: ServerlessFunction;
};
export type ServerlessFunctionFilter = {
and?: InputMaybe<Array<ServerlessFunctionFilter>>;
id?: InputMaybe<UuidFilterComparison>;
or?: InputMaybe<Array<ServerlessFunctionFilter>>;
};
export type ServerlessFunctionSort = {
direction: SortDirection;
field: ServerlessFunctionSortFields;
nulls?: InputMaybe<SortNulls>;
};
export enum ServerlessFunctionSortFields {
Id = 'id'
}
export type RemoteServerFieldsFragment = { __typename?: 'RemoteServer', id: string, createdAt: any, foreignDataWrapperId: string, foreignDataWrapperOptions?: any | null, foreignDataWrapperType: string, updatedAt: any, schema?: string | null, label: string, userMappingOptions?: { __typename?: 'UserMappingOptionsUser', user?: string | null } | null };
export type RemoteTableFieldsFragment = { __typename?: 'RemoteTable', id?: any | null, name: string, schema?: string | null, status: RemoteTableStatus, schemaPendingUpdates?: Array<DistantTableUpdate> | null };

View File

@ -258,6 +258,7 @@ export enum FileFolder {
Attachment = 'Attachment',
PersonPicture = 'PersonPicture',
ProfilePicture = 'ProfilePicture',
ServerlessFunction = 'ServerlessFunction',
WorkspaceLogo = 'WorkspaceLogo'
}
@ -683,6 +684,26 @@ export type Sentry = {
release?: Maybe<Scalars['String']>;
};
export type ServerlessFunctionConnection = {
__typename?: 'ServerlessFunctionConnection';
/** Array of edges. */
edges: Array<ServerlessFunctionEdge>;
/** Paging information */
pageInfo: PageInfo;
};
export type ServerlessFunctionExecutionResult = {
__typename?: 'ServerlessFunctionExecutionResult';
/** Execution result in JSON format */
result: Scalars['JSON'];
};
/** SyncStatus of the serverlessFunction */
export enum ServerlessFunctionSyncStatus {
NotReady = 'NOT_READY',
Ready = 'READY'
}
export type SessionEntity = {
__typename?: 'SessionEntity';
url?: Maybe<Scalars['String']>;
@ -1064,6 +1085,23 @@ export type RelationEdge = {
node: Relation;
};
export type ServerlessFunction = {
__typename?: 'serverlessFunction';
createdAt: Scalars['DateTime'];
id: Scalars['UUID'];
name: Scalars['String'];
syncStatus: ServerlessFunctionSyncStatus;
updatedAt: Scalars['DateTime'];
};
export type ServerlessFunctionEdge = {
__typename?: 'serverlessFunctionEdge';
/** Cursor for this node. */
cursor: Scalars['ConnectionCursor'];
/** The node containing the serverlessFunction */
node: ServerlessFunction;
};
export type TimelineCalendarEventFragmentFragment = { __typename?: 'TimelineCalendarEvent', id: any, title: string, description: string, location: string, startsAt: string, endsAt: string, isFullDay: boolean, visibility: CalendarChannelVisibility, participants: Array<{ __typename?: 'TimelineCalendarEventParticipant', personId?: any | null, workspaceMemberId?: any | null, firstName: string, lastName: string, displayName: string, avatarUrl: string, handle: string }> };
export type TimelineCalendarEventParticipantFragmentFragment = { __typename?: 'TimelineCalendarEventParticipant', personId?: any | null, workspaceMemberId?: any | null, firstName: string, lastName: string, displayName: string, avatarUrl: string, handle: string };