Rename serverlessFunction to logicFunction (#17494)
## Summary Rename "Serverless Function" to "Logic Function" across the codebase for clearer naming. ### Environment Variable Changes | Old | New | |-----|-----| | `SERVERLESS_TYPE` | `LOGIC_FUNCTION_TYPE` | | `SERVERLESS_LAMBDA_REGION` | `LOGIC_FUNCTION_LAMBDA_REGION` | | `SERVERLESS_LAMBDA_ROLE` | `LOGIC_FUNCTION_LAMBDA_ROLE` | | `SERVERLESS_LAMBDA_SUBHOSTING_URL` | `LOGIC_FUNCTION_LAMBDA_SUBHOSTING_URL` | | `SERVERLESS_LAMBDA_ACCESS_KEY_ID` | `LOGIC_FUNCTION_LAMBDA_ACCESS_KEY_ID` | | `SERVERLESS_LAMBDA_SECRET_ACCESS_KEY` | `LOGIC_FUNCTION_LAMBDA_SECRET_ACCESS_KEY` | ### Breaking Changes - Environment variables must be updated in production deployments - Database migration renames `serverlessFunction` → `logicFunction` tables
This commit is contained in:
+3
-3
@@ -98,10 +98,10 @@ export class WorkflowExecutionContextService {
|
||||
|
||||
// Use the application's role if set, otherwise fall back to admin role
|
||||
// In the future we should probably assign the Admin role to the Standard Application
|
||||
let roleId = application.defaultServerlessFunctionRoleId;
|
||||
let roleId = application.defaultLogicFunctionRoleId;
|
||||
|
||||
if (!isDefined(roleId)) {
|
||||
// Fallback: Look up admin role for existing workspaces without defaultServerlessFunctionRoleId
|
||||
// Fallback: Look up admin role for existing workspaces without defaultLogicFunctionRoleId
|
||||
const adminRole = await this.roleService.getRoleByUniversalIdentifier({
|
||||
universalIdentifier: ADMIN_ROLE.standardId,
|
||||
workspaceId,
|
||||
@@ -119,7 +119,7 @@ export class WorkflowExecutionContextService {
|
||||
apiKey: null,
|
||||
application: {
|
||||
...application,
|
||||
defaultServerlessFunctionRoleId: roleId,
|
||||
defaultLogicFunctionRoleId: roleId,
|
||||
},
|
||||
workspace,
|
||||
workspaceMemberId: undefined,
|
||||
|
||||
+3
-3
@@ -242,9 +242,9 @@ describe('shouldExecuteStep', () => {
|
||||
type: WorkflowActionType.CODE,
|
||||
settings: {
|
||||
input: {
|
||||
serverlessFunctionId: 'mock-function-id',
|
||||
serverlessFunctionVersion: 'mock-function-version',
|
||||
serverlessFunctionInput: {},
|
||||
logicFunctionId: 'mock-function-id',
|
||||
logicFunctionVersion: 'mock-function-version',
|
||||
logicFunctionInput: {},
|
||||
},
|
||||
errorHandlingOptions: {
|
||||
continueOnFailure: { value: false },
|
||||
|
||||
+3
-3
@@ -16,9 +16,9 @@ describe('shouldSkipStepExecution', () => {
|
||||
type: WorkflowActionType.CODE,
|
||||
settings: {
|
||||
input: {
|
||||
serverlessFunctionId: 'mock-function-id',
|
||||
serverlessFunctionVersion: 'mock-function-version',
|
||||
serverlessFunctionInput: {},
|
||||
logicFunctionId: 'mock-function-id',
|
||||
logicFunctionVersion: 'mock-function-version',
|
||||
logicFunctionInput: {},
|
||||
},
|
||||
errorHandlingOptions: {
|
||||
continueOnFailure: { value: false },
|
||||
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
|
||||
import { ServerlessFunctionModule } from 'src/engine/metadata-modules/serverless-function/serverless-function.module';
|
||||
import { LogicFunctionModule } from 'src/engine/metadata-modules/logic-function/logic-function.module';
|
||||
import { CodeWorkflowAction } from 'src/modules/workflow/workflow-executor/workflow-actions/code/code.workflow-action';
|
||||
|
||||
@Module({
|
||||
imports: [ServerlessFunctionModule],
|
||||
imports: [LogicFunctionModule],
|
||||
providers: [CodeWorkflowAction],
|
||||
exports: [CodeWorkflowAction],
|
||||
})
|
||||
|
||||
+8
-11
@@ -4,7 +4,7 @@ import { resolveInput } from 'twenty-shared/utils';
|
||||
|
||||
import { type WorkflowAction } from 'src/modules/workflow/workflow-executor/interfaces/workflow-action.interface';
|
||||
|
||||
import { ServerlessFunctionService } from 'src/engine/metadata-modules/serverless-function/serverless-function.service';
|
||||
import { LogicFunctionService } from 'src/engine/metadata-modules/logic-function/logic-function.service';
|
||||
import {
|
||||
WorkflowStepExecutorException,
|
||||
WorkflowStepExecutorExceptionCode,
|
||||
@@ -17,9 +17,7 @@ import { type WorkflowCodeActionInput } from 'src/modules/workflow/workflow-exec
|
||||
|
||||
@Injectable()
|
||||
export class CodeWorkflowAction implements WorkflowAction {
|
||||
constructor(
|
||||
private readonly serverlessFunctionService: ServerlessFunctionService,
|
||||
) {}
|
||||
constructor(private readonly logicFunctionService: LogicFunctionService) {}
|
||||
|
||||
async execute({
|
||||
currentStepId,
|
||||
@@ -47,13 +45,12 @@ export class CodeWorkflowAction implements WorkflowAction {
|
||||
try {
|
||||
const { workspaceId } = runInfo;
|
||||
|
||||
const result =
|
||||
await this.serverlessFunctionService.executeOneServerlessFunction({
|
||||
id: workflowActionInput.serverlessFunctionId,
|
||||
workspaceId,
|
||||
payload: workflowActionInput.serverlessFunctionInput,
|
||||
version: workflowActionInput.serverlessFunctionVersion,
|
||||
});
|
||||
const result = await this.logicFunctionService.executeOneLogicFunction({
|
||||
id: workflowActionInput.logicFunctionId,
|
||||
workspaceId,
|
||||
payload: workflowActionInput.logicFunctionInput,
|
||||
version: workflowActionInput.logicFunctionVersion,
|
||||
});
|
||||
|
||||
if (result.error) {
|
||||
return { error: result.error.errorMessage };
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
export type WorkflowCodeActionInput = {
|
||||
serverlessFunctionId: string;
|
||||
serverlessFunctionVersion: string;
|
||||
serverlessFunctionInput: {
|
||||
logicFunctionId: string;
|
||||
logicFunctionVersion: string;
|
||||
logicFunctionInput: {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
+3
-3
@@ -51,9 +51,9 @@ describe('shouldExecuteIteratorStep', () => {
|
||||
type: WorkflowActionType.CODE,
|
||||
settings: {
|
||||
input: {
|
||||
serverlessFunctionId: 'mock-function-id',
|
||||
serverlessFunctionVersion: 'mock-function-version',
|
||||
serverlessFunctionInput: {},
|
||||
logicFunctionId: 'mock-function-id',
|
||||
logicFunctionVersion: 'mock-function-version',
|
||||
logicFunctionInput: {},
|
||||
},
|
||||
errorHandlingOptions: {
|
||||
continueOnFailure: { value: false },
|
||||
|
||||
+3
-3
@@ -51,9 +51,9 @@ describe('shouldSkipIteratorStepExecution', () => {
|
||||
type: WorkflowActionType.CODE,
|
||||
settings: {
|
||||
input: {
|
||||
serverlessFunctionId: 'mock-function-id',
|
||||
serverlessFunctionVersion: 'mock-function-version',
|
||||
serverlessFunctionInput: {},
|
||||
logicFunctionId: 'mock-function-id',
|
||||
logicFunctionVersion: 'mock-function-version',
|
||||
logicFunctionInput: {},
|
||||
},
|
||||
errorHandlingOptions: {
|
||||
continueOnFailure: { value: false },
|
||||
|
||||
Reference in New Issue
Block a user