Remove logic function layer (#17697)

## Remove logic function layer

Package.json and yarn.lock are now on the application entity, so the
logic function layer is no longer used except as a legacy source for the
1.17 backfill. This PR removes all layer usage outside of that migration
and keeps only the entity for backfill.

### Summary

- **Kept:** `LogicFunctionLayerEntity` and its table, only used by the
1.17 backfill command to read legacy layer data and backfill application
package files.
- **Removed:** All other layer logic: CRUD, cache, resolvers, services,
DTOs, and frontend types. Logic functions now depend only on the
application for package/dependency context.


### Why Dependencies instead of Source for package files

Package.json and yarn.lock are the application’s dependency set and are
stored under the application in **FileFolder.Dependencies**. The build
service and drivers now read them only from Dependencies; nothing is
written to Source for these files.
This commit is contained in:
Charles Bochet
2026-02-04 10:17:27 +01:00
committed by GitHub
parent e10e0b337e
commit 402d149ee1
36 changed files with 171 additions and 643 deletions
@@ -38,9 +38,6 @@ export class CreateLogicFunctionInput {
@HideField()
universalIdentifier?: string;
@HideField()
logicFunctionLayerId?: string;
@Field(() => graphqlTypeJson, { nullable: true })
@IsObject()
@IsOptional()
@@ -6,16 +6,12 @@ import {
DeleteDateColumn,
Entity,
Index,
JoinColumn,
ManyToOne,
PrimaryGeneratedColumn,
Relation,
UpdateDateColumn,
} from 'typeorm';
import { type JsonbProperty } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/jsonb-property.type';
import { LogicFunctionLayerEntity } from 'src/engine/metadata-modules/logic-function-layer/logic-function-layer.entity';
import { SyncableEntity } from 'src/engine/workspace-manager/types/syncable-entity.interface';
import { type JsonbProperty } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/jsonb-property.type';
export type CronTriggerSettings = {
pattern: string;
@@ -46,7 +42,6 @@ export const DEFAULT_HANDLER_NAME = 'main';
@Entity('logicFunction')
@Index('IDX_LOGIC_FUNCTION_ID_DELETED_AT', ['id', 'deletedAt'])
@Index('IDX_LOGIC_FUNCTION_LAYER_ID', ['logicFunctionLayerId'])
export class LogicFunctionEntity
extends SyncableEntity
implements Required<LogicFunctionEntity>
@@ -85,17 +80,6 @@ export class LogicFunctionEntity
@Column({ nullable: false, default: false })
isTool: boolean;
@Column({ nullable: false, type: 'uuid' })
logicFunctionLayerId: string;
@ManyToOne(
() => LogicFunctionLayerEntity,
(logicFunctionLayer) => logicFunctionLayer.logicFunctions,
{ nullable: false },
)
@JoinColumn({ name: 'logicFunctionLayerId' })
logicFunctionLayer: Relation<LogicFunctionLayerEntity>;
@Column({ nullable: true, type: 'jsonb' })
cronTriggerSettings: JsonbProperty<CronTriggerSettings> | null;
@@ -12,7 +12,6 @@ import { FeatureFlagModule } from 'src/engine/core-modules/feature-flag/feature-
import { FileUploadModule } from 'src/engine/core-modules/file/file-upload/file-upload.module';
import { FileModule } from 'src/engine/core-modules/file/file.module';
import { LogicFunctionExecutorModule } from 'src/engine/core-modules/logic-function/logic-function-executor/logic-function-executor.module';
import { CoreLogicFunctionLayerModule } from 'src/engine/core-modules/logic-function/logic-function-layer/logic-function-layer.module';
import { SecretEncryptionModule } from 'src/engine/core-modules/secret-encryption/secret-encryption.module';
import { ThrottlerModule } from 'src/engine/core-modules/throttler/throttler.module';
import { WorkspaceManyOrAllFlatEntityMapsCacheModule } from 'src/engine/metadata-modules/flat-entity/services/workspace-many-or-all-flat-entity-maps-cache.module';
@@ -40,7 +39,6 @@ import { WorkspaceMigrationModule } from 'src/engine/workspace-manager/workspace
WorkspaceManyOrAllFlatEntityMapsCacheModule,
WorkspaceMigrationModule,
LogicFunctionLayerModule,
CoreLogicFunctionLayerModule,
LogicFunctionExecutorModule,
SubscriptionsModule,
WorkspaceCacheModule,
@@ -7,10 +7,9 @@ import { ApplicationService } from 'src/engine/core-modules/application/services
import { type FlatApplication } from 'src/engine/core-modules/application/types/flat-application.type';
import { FileStorageService } from 'src/engine/core-modules/file-storage/file-storage.service';
import { getLogicFunctionBaseFolderPath } from 'src/engine/core-modules/logic-function/logic-function-build/utils/get-logic-function-base-folder-path.util';
import { LogicFunctionLayerService } from 'src/engine/core-modules/logic-function/logic-function-layer/services/logic-function-layer.service';
import { WorkspaceManyOrAllFlatEntityMapsCacheService } from 'src/engine/metadata-modules/flat-entity/services/workspace-many-or-all-flat-entity-maps-cache.service';
import { findFlatEntityByIdInFlatEntityMaps } from 'src/engine/metadata-modules/flat-entity/utils/find-flat-entity-by-id-in-flat-entity-maps.util';
import { findFlatEntityByIdInFlatEntityMapsOrThrow } from 'src/engine/metadata-modules/flat-entity/utils/find-flat-entity-by-id-in-flat-entity-maps-or-throw.util';
import { findFlatEntityByIdInFlatEntityMaps } from 'src/engine/metadata-modules/flat-entity/utils/find-flat-entity-by-id-in-flat-entity-maps.util';
import type { CreateLogicFunctionInput } from 'src/engine/metadata-modules/logic-function/dtos/create-logic-function.input';
import type { UpdateLogicFunctionInput } from 'src/engine/metadata-modules/logic-function/dtos/update-logic-function.input';
import {
@@ -31,7 +30,6 @@ export class LogicFunctionService {
private readonly flatEntityMapsCacheService: WorkspaceManyOrAllFlatEntityMapsCacheService,
private readonly workspaceMigrationValidateBuildAndRunService: WorkspaceMigrationValidateBuildAndRunService,
private readonly applicationService: ApplicationService,
private readonly logicFunctionLayerService: LogicFunctionLayerService,
private readonly workspaceCacheService: WorkspaceCacheService,
private readonly fileStorageService: FileStorageService,
) {}
@@ -41,9 +39,7 @@ export class LogicFunctionService {
workspaceId,
ownerFlatApplication,
}: {
input: Omit<CreateLogicFunctionInput, 'applicationId'> & {
logicFunctionLayerId?: string;
};
input: Omit<CreateLogicFunctionInput, 'applicationId'>;
ownerFlatApplication?: FlatApplication;
workspaceId: string;
applicationId?: string;
@@ -56,32 +52,9 @@ export class LogicFunctionService {
)
).workspaceCustomFlatApplication;
let logicFunctionToCreateLayerId = input.logicFunctionLayerId;
const { workspaceCustomFlatApplication } =
await this.applicationService.findWorkspaceTwentyStandardAndCustomApplicationOrThrow(
{
workspaceId,
},
);
if (!isDefined(logicFunctionToCreateLayerId)) {
const { id: commonLogicFunctionLayerId } =
await this.logicFunctionLayerService.createCommonLayer({
workspaceId,
applicationUniversalIdentifier:
workspaceCustomFlatApplication.universalIdentifier,
});
logicFunctionToCreateLayerId = commonLogicFunctionLayerId;
}
const flatLogicFunctionToCreate =
fromCreateLogicFunctionInputToFlatLogicFunction({
createLogicFunctionInput: {
...input,
logicFunctionLayerId: logicFunctionToCreateLayerId,
},
createLogicFunctionInput: input,
workspaceId,
ownerFlatApplication: resolvedOwnerFlatApplication,
});
@@ -333,7 +306,6 @@ export class LogicFunctionService {
name: existingLogicFunction.name,
description: existingLogicFunction.description ?? undefined,
timeoutSeconds: existingLogicFunction.timeoutSeconds,
logicFunctionLayerId: existingLogicFunction.logicFunctionLayerId,
},
workspaceId,
applicationId: existingLogicFunction.applicationId ?? undefined,
@@ -16,9 +16,7 @@ import { logicFunctionCreateHash } from 'src/engine/metadata-modules/logic-funct
const WORKFLOW_BASE_FOLDER_PREFIX = 'workflow';
export type FromCreateLogicFunctionInputToFlatLogicFunctionArgs = {
createLogicFunctionInput: CreateLogicFunctionInput & {
logicFunctionLayerId: string;
};
createLogicFunctionInput: CreateLogicFunctionInput;
workspaceId: string;
ownerFlatApplication: FlatApplication;
};
@@ -61,7 +59,6 @@ export const fromCreateLogicFunctionInputToFlatLogicFunction = ({
applicationId: ownerFlatApplication.id,
runtime: LogicFunctionRuntime.NODE22,
timeoutSeconds: rawCreateLogicFunctionInput.timeoutSeconds ?? 300,
logicFunctionLayerId: rawCreateLogicFunctionInput.logicFunctionLayerId,
workspaceId,
code: rawCreateLogicFunctionInput?.code,
checksum: rawCreateLogicFunctionInput?.code