Add sync front component (#17748)

## Context
Allow twenty apps to sync front components
This commit is contained in:
Weiko
2026-02-09 00:00:23 +01:00
committed by GitHub
parent 40d7e740ef
commit 9aa63f7ddc
33 changed files with 643 additions and 97 deletions
@@ -2,4 +2,9 @@ import { type FlatFrontComponent } from 'src/engine/metadata-modules/flat-front-
export const FLAT_FRONT_COMPONENT_EDITABLE_PROPERTIES = [
'name',
'description',
'builtComponentChecksum',
'sourceComponentPath',
'builtComponentPath',
'componentName',
] as const satisfies (keyof FlatFrontComponent)[];
@@ -22,14 +22,21 @@ export const fromCreateFrontComponentInputToFlatFrontComponentToCreate = ({
);
const id = createFrontComponentInput.id ?? v4();
const universalIdentifier =
createFrontComponentInput.universalIdentifier ?? v4();
return {
id,
name,
name: name ?? createFrontComponentInput.componentName,
description: createFrontComponentInput.description ?? null,
sourceComponentPath: createFrontComponentInput.sourceComponentPath,
builtComponentPath: createFrontComponentInput.builtComponentPath,
componentName: createFrontComponentInput.componentName,
builtComponentChecksum: createFrontComponentInput.builtComponentChecksum,
workspaceId,
createdAt: now,
updatedAt: now,
universalIdentifier: id,
universalIdentifier,
applicationId: flatApplication.id,
applicationUniversalIdentifier: flatApplication.universalIdentifier,
};
@@ -1,3 +1,5 @@
import { isDefined } from 'twenty-shared/utils';
import { type FlatFrontComponent } from 'src/engine/metadata-modules/flat-front-component/types/flat-front-component.type';
import { type FrontComponentDTO } from 'src/engine/metadata-modules/front-component/dtos/front-component.dto';
@@ -6,6 +8,16 @@ export const fromFlatFrontComponentToFrontComponentDto = (
): FrontComponentDTO => ({
id: flatFrontComponent.id,
name: flatFrontComponent.name,
description: isDefined(flatFrontComponent.description)
? flatFrontComponent.description
: undefined,
sourceComponentPath: flatFrontComponent.sourceComponentPath,
builtComponentPath: flatFrontComponent.builtComponentPath,
componentName: flatFrontComponent.componentName,
builtComponentChecksum: flatFrontComponent.builtComponentChecksum,
universalIdentifier: isDefined(flatFrontComponent.universalIdentifier)
? flatFrontComponent.universalIdentifier
: undefined,
workspaceId: flatFrontComponent.workspaceId,
applicationId: flatFrontComponent.applicationId,
createdAt: new Date(flatFrontComponent.createdAt),
@@ -26,6 +26,11 @@ export const fromFrontComponentEntityToFlatFrontComponent = ({
return {
id: frontComponentEntity.id,
name: frontComponentEntity.name,
description: frontComponentEntity.description,
sourceComponentPath: frontComponentEntity.sourceComponentPath,
builtComponentPath: frontComponentEntity.builtComponentPath,
componentName: frontComponentEntity.componentName,
builtComponentChecksum: frontComponentEntity.builtComponentChecksum,
workspaceId: frontComponentEntity.workspaceId,
universalIdentifier: frontComponentEntity.universalIdentifier,
applicationId: frontComponentEntity.applicationId,