Logic function refactorization (#17861)

As title
This commit is contained in:
martmull
2026-02-12 11:40:49 +01:00
committed by GitHub
parent b456f79167
commit a4ed043d43
122 changed files with 1441 additions and 1897 deletions
@@ -0,0 +1 @@
generated
@@ -3,7 +3,6 @@ import type { Manifest } from 'twenty-shared/application';
import { PermissionFlagType } from 'twenty-shared/constants';
export const EXPECTED_MANIFEST: Manifest = {
sources: {},
publicAssets: [
{
checksum: '99496069dcc2a1488e1cae9f826d2707',
@@ -2,7 +2,6 @@ import { FieldType } from '@/sdk';
import type { Manifest } from 'twenty-shared/application';
export const EXPECTED_MANIFEST: Manifest = {
sources: {},
application: {
universalIdentifier: 'e1e2e3e4-e5e6-4000-8000-000000000001',
displayName: 'Root App',
@@ -26,5 +26,4 @@ export const normalizeManifestForComparison = <T extends JsonManifestInput>(
? '[checksum]'
: '',
})),
sources: {}, // removing sources for now, waiting compressed file implementation
});
@@ -574,7 +574,7 @@ export class ApiService {
);
const response: AxiosResponse = await this.client.post(
'/graphql',
'/metadata',
formData,
);
@@ -32,7 +32,6 @@ const validManifest: Manifest = {
logicFunctions: [],
roles: [],
publicAssets: [],
sources: {},
};
describe('manifestValidate', () => {
@@ -11,9 +11,8 @@ import {
type LogicFunctionConfig,
} from '@/sdk';
import { glob } from 'fast-glob';
import * as fs from 'fs-extra';
import { readFile } from 'fs-extra';
import { basename, extname, relative, sep } from 'path';
import { basename, extname, relative } from 'path';
import {
type ApplicationManifest,
type AssetManifest,
@@ -25,7 +24,6 @@ import {
type ObjectManifest,
type RoleManifest,
} from 'twenty-shared/application';
import { type Sources } from 'twenty-shared/types';
import { assertUnreachable } from 'twenty-shared/utils';
const loadSources = async (appPath: string): Promise<string[]> => {
@@ -44,32 +42,6 @@ const loadAssets = async (appPath: string) => {
});
};
const computeSources = async (
appPath: string,
sourceFilePaths: string[],
): Promise<Sources> => {
const sources: Sources = {};
for (const filepath of sourceFilePaths) {
const relPath = relative(appPath, filepath);
const parts = relPath.split(sep);
const content = await fs.readFile(filepath, 'utf8');
let current: Sources = sources;
for (let i = 0; i < parts.length; i++) {
const part = parts[i];
if (i === parts.length - 1) {
current[part] = content;
} else {
current[part] = (current[part] ?? {}) as Sources;
current = current[part] as Sources;
}
}
}
return sources;
};
export const buildManifest = async (
appPath: string,
): Promise<{
@@ -240,7 +212,6 @@ export const buildManifest = async (
logicFunctions,
frontComponents,
publicAssets,
sources: await computeSources(appPath, filePaths),
};
const entityFilePaths: EntityFilePaths = {