Update manifest structure (#17547)

Move all sync entities in an `entities` key. Rename functions to
logicFunctions

```json
{
  application: {
    ...
  },
  entities: {
    objects: [],
    logicFunctions: [],
    ...
  }
}
```
This commit is contained in:
martmull
2026-01-30 16:26:45 +01:00
committed by GitHub
parent bc022f82cb
commit f46da3eefd
162 changed files with 2555 additions and 3778 deletions
@@ -1,14 +1,16 @@
import { getFunctionBaseFile } from '@/cli/utilities/entity/entity-function-template';
import { getLogicFunctionBaseFile } from '@/cli/utilities/entity/entity-logic-function-template';
describe('getFunctionBaseFile', () => {
it('should render proper file using defineFunction', () => {
const result = getFunctionBaseFile({
const result = getLogicFunctionBaseFile({
name: 'my-function',
universalIdentifier: '71e45a58-41da-4ae4-8b73-a543c0a9d3d4',
});
expect(result).toContain("import { defineFunction } from 'twenty-sdk'");
expect(result).toContain('export default defineFunction({');
expect(result).toContain(
"import { defineLogicFunction } from 'twenty-sdk'",
);
expect(result).toContain('export default defineLogicFunction({');
expect(result).toContain(
"universalIdentifier: '71e45a58-41da-4ae4-8b73-a543c0a9d3d4'",
@@ -21,12 +23,12 @@ describe('getFunctionBaseFile', () => {
expect(result).toContain('const handler = async');
expect(result).toContain(
"description: 'Add a description for your function'",
"description: 'Add a description for your logic function'",
);
});
it('should generate unique UUID when not provided', () => {
const result = getFunctionBaseFile({
const result = getLogicFunctionBaseFile({
name: 'auto-uuid-function',
});
@@ -36,7 +38,7 @@ describe('getFunctionBaseFile', () => {
});
it('should use kebab-case for function name', () => {
const result = getFunctionBaseFile({
const result = getLogicFunctionBaseFile({
name: 'my-awesome-function',
});
@@ -45,7 +47,7 @@ describe('getFunctionBaseFile', () => {
});
it('should include trigger examples as comments', () => {
const result = getFunctionBaseFile({
const result = getLogicFunctionBaseFile({
name: 'example-function',
});
@@ -0,0 +1,31 @@
import { type FieldMetadataType } from 'twenty-shared/types';
import { v4 } from 'uuid';
export const getFieldBaseFile = ({
data,
}: {
data: {
name: string;
label: string;
type: FieldMetadataType;
objectUniversalIdentifier: string;
description?: string;
};
name: string;
}) => {
const universalIdentifier = v4();
const descriptionLine = data.description
? `\n description: '${data.description}',`
: '';
return `import { defineField, FieldType } from 'twenty-sdk';
export default defineField({
universalIdentifier: '${universalIdentifier}',
name: '${data.name}',
label: '${data.label}',
type: FieldMetadataType.${data.type},
objectUniversalIdentifier: '${data.objectUniversalIdentifier}',${descriptionLine}
});
`;
};
@@ -1,7 +1,7 @@
import kebabCase from 'lodash.kebabcase';
import { v4 } from 'uuid';
export const getFunctionBaseFile = ({
export const getLogicFunctionBaseFile = ({
name,
universalIdentifier = v4(),
}: {
@@ -11,9 +11,9 @@ export const getFunctionBaseFile = ({
const kebabCaseName = kebabCase(name);
const triggerUniversalIdentifier = v4();
return `import { defineFunction } from 'twenty-sdk';
return `import { defineLogicFunction } from 'twenty-sdk';
// Handler function - rename and implement your logic
// Logic function handler - rename and implement your logic
const handler = async (params: {
a: string;
b: number;
@@ -26,10 +26,10 @@ const handler = async (params: {
return { message };
};
export default defineFunction({
export default defineLogicFunction({
universalIdentifier: '${universalIdentifier}',
name: '${kebabCaseName}',
description: 'Add a description for your function',
description: 'Add a description for your logic function',
timeoutSeconds: 5,
handler,
triggers: [