Remove serverless functions on version archivation (#9535)

Fixes https://github.com/twentyhq/core-team-issues/issues/52
- contrary to title, we do not remove serverless functions on workflow
version archivation because serverless fucntion might be used in another
workflow version
- we fix the serverless funciton version displayed in the code step
- we allow test function version in step display right drawer
- we delete serverless function only when serverless function has no
published version
This commit is contained in:
martmull
2025-01-13 14:09:57 +01:00
committed by GitHub
parent 8643eaa28f
commit 5783d68d62
10 changed files with 64 additions and 33 deletions

View File

@ -4,7 +4,7 @@ import { InjectRepository } from '@nestjs/typeorm';
import { basename, dirname, join } from 'path';
import deepEqual from 'deep-equal';
import { Repository } from 'typeorm';
import { IsNull, Not, Repository } from 'typeorm';
import { FileStorageExceptionCode } from 'src/engine/core-modules/file-storage/interfaces/file-storage-exception';
import { ServerlessExecuteResult } from 'src/engine/core-modules/serverless/drivers/interfaces/serverless-driver.interface';
@ -58,6 +58,15 @@ export class ServerlessFunctionService {
return this.serverlessFunctionRepository.findBy(where);
}
async hasServerlessFunctionPublishedVersion(serverlessFunctionId: string) {
return await this.serverlessFunctionRepository.exists({
where: {
id: serverlessFunctionId,
latestVersion: Not(IsNull()),
},
});
}
async getServerlessFunctionSourceCode(
workspaceId: string,
id: string,