The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Add missing objects to rich app integration tests (#18039)
Thomas Trompette9733ff1b8e8c
diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/expected-manifest.ts b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/expected-manifest.tsindex 9b482faa58c..1a910bd8f7a 100644--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/expected-manifest.ts+++ b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/expected-manifest.ts@@ -1,9 +1,15 @@import { FieldType } from '@/sdk';import type { Manifest } from 'twenty-shared/application';import { PermissionFlagType } from 'twenty-shared/constants';-import { FieldMetadataType } from 'twenty-shared/types';+import {+ FieldMetadataType,+ RelationOnDeleteAction,+ RelationType,+ ViewType,+} from 'twenty-shared/types';export const EXPECTED_MANIFEST: Manifest = {+ pageLayouts: [],publicAssets: [{checksum: '99496069dcc2a1488e1cae9f826d2707',@@ -70,6 +76,50 @@ export const EXPECTED_MANIFEST: Manifest = {],fields: [+ {+ label: 'Post Card',+ name: 'postCard',+ objectUniversalIdentifier: 'e1a2b3c4-5e6f-4a7b-8c9d-0e1f2a3b4c5e',+ relationTargetFieldMetadataUniversalIdentifier:+ 'a1a2b3c4-0001-4a7b-8c9d-0e1f2a3b4c5d',+ relationTargetObjectMetadataUniversalIdentifier:+ '54b589ca-eeed-4950-a176-358418b85c05',+ type: FieldType.RELATION,+ universalIdentifier: 'a1a2b3c4-0002-4a7b-8c9d-0e1f2a3b4c5d',+ universalSettings: {+ joinColumnName: 'postCardId',+ onDelete: RelationOnDeleteAction.CASCADE,+ relationType: RelationType.MANY_TO_ONE,+ },+ },+ {+ label: 'Post Card Recipients',+ name: 'postCardRecipients',+ objectUniversalIdentifier: '54b589ca-eeed-4950-a176-358418b85c05',+ relationTargetFieldMetadataUniversalIdentifier:+ 'a1a2b3c4-0002-4a7b-8c9d-0e1f2a3b4c5d',+ relationTargetObjectMetadataUniversalIdentifier:+ 'e1a2b3c4-5e6f-4a7b-8c9d-0e1f2a3b4c5e',+ type: FieldType.RELATION,+ universalIdentifier: 'a1a2b3c4-0001-4a7b-8c9d-0e1f2a3b4c5d',+ universalSettings: {+ relationType: RelationType.ONE_TO_MANY,+ },+ },+ {+ label: 'Post Card Recipients',+ name: 'postCardRecipients',+ objectUniversalIdentifier: 'd1a2b3c4-5e6f-4a7b-8c9d-0e1f2a3b4c5d',+ relationTargetFieldMetadataUniversalIdentifier:+ 'a1a2b3c4-0004-4a7b-8c9d-0e1f2a3b4c5d',+ relationTargetObjectMetadataUniversalIdentifier:+ 'e1a2b3c4-5e6f-4a7b-8c9d-0e1f2a3b4c5e',+ type: FieldType.RELATION,+ universalIdentifier: 'a1a2b3c4-0003-4a7b-8c9d-0e1f2a3b4c5d',+ universalSettings: {+ relationType: RelationType.ONE_TO_MANY,+ },+ },{objectUniversalIdentifier: '54b589ca-eeed-4950-a176-358418b85c05',description: 'Post card category',@@ -78,18 +128,21 @@ export const EXPECTED_MANIFEST: Manifest = {options: [{color: 'blue',+ id: 'c1d2e3f4-0001-4000-8000-000000000001',label: 'Personal',position: 0,value: 'PERSONAL',},{color: 'green',+ id: 'c1d2e3f4-0002-4000-8000-000000000002',label: 'Business',position: 1,value: 'BUSINESS',},{color: 'orange',+ id: 'c1d2e3f4-0003-4000-8000-000000000003',label: 'Promotional',position: 2,value: 'PROMOTIONAL',@@ -106,6 +159,22 @@ export const EXPECTED_MANIFEST: Manifest = {type: FieldType.NUMBER,universalIdentifier: '7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d',},+ {+ label: 'Recipient',+ name: 'recipient',+ objectUniversalIdentifier: 'e1a2b3c4-5e6f-4a7b-8c9d-0e1f2a3b4c5e',+ relationTargetFieldMetadataUniversalIdentifier:+ 'a1a2b3c4-0003-4a7b-8c9d-0e1f2a3b4c5d',+ relationTargetObjectMetadataUniversalIdentifier:+ 'd1a2b3c4-5e6f-4a7b-8c9d-0e1f2a3b4c5d',+ type: FieldType.RELATION,+ universalIdentifier: 'a1a2b3c4-0004-4a7b-8c9d-0e1f2a3b4c5d',+ universalSettings: {+ joinColumnName: 'recipientId',+ onDelete: RelationOnDeleteAction.CASCADE,+ relationType: RelationType.MANY_TO_ONE,+ },+ },],objects: [{@@ -209,6 +278,104 @@ export const EXPECTED_MANIFEST: Manifest = {nameSingular: 'rootNote',universalIdentifier: 'b0b1b2b3-b4b5-4000-8000-000000000001',},+ {+ description: 'Junction object linking post cards to their recipients',+ fields: [+ {+ defaultValue: null,+ icon: 'IconClock',+ isNullable: true,+ label: 'Sent at',+ name: 'sentAt',+ type: FieldType.DATE_TIME,+ universalIdentifier: 'e2a2b3c4-5e6f-4a7b-8c9d-0e1f2a3b4c5e',+ },+ {+ defaultValue: 'uuid',+ description: 'Id',+ icon: 'Icon123',+ isNullable: false,+ label: 'Id',+ name: 'id',+ type: FieldMetadataType.UUID,+ universalIdentifier: '2809d745-deb3-5ac0-8328-ea6256ec22b3',+ },+ {+ defaultValue: null,+ description: 'Name',+ icon: 'IconAbc',+ isNullable: true,+ label: 'Name',+ name: 'name',+ type: FieldMetadataType.TEXT,+ universalIdentifier: 'a6ee6cc8-b9a0-5e23-a39e-bc3fee2aa3d3',+ },+ {+ defaultValue: 'now',+ description: 'Creation date',+ icon: 'IconCalendar',+ isNullable: false,+ label: 'Creation date',+ name: 'createdAt',+ type: FieldMetadataType.DATE_TIME,+ universalIdentifier: '87ad23b6-b04e-5dc1-9907-c1eca54ea6d6',+ },+ {+ defaultValue: 'now',+ description: 'Last time the record was changed',+ icon: 'IconCalendarClock',+ isNullable: false,+ label: 'Last update',+ name: 'updatedAt',+ type: FieldMetadataType.DATE_TIME,+ universalIdentifier: '6d7523dc-c097-5b75-96eb-37502d09cc19',+ },+ {+ defaultValue: null,+ description: 'Deletion date',+ icon: 'IconCalendarClock',+ isNullable: true,+ label: 'Deleted at',+ name: 'deletedAt',+ type: FieldMetadataType.DATE_TIME,+ universalIdentifier: 'bd4fe2fa-373a-5fdd-ba09-cb5435781e4c',+ },+ {+ defaultValue: {+ name: "''",+ source: "'MANUAL'",+ },+ description: 'The creator of the record',+ icon: 'IconCreativeCommonsSa',+ isNullable: false,+ label: 'Created by',+ name: 'createdBy',+ type: FieldMetadataType.ACTOR,+ universalIdentifier: 'c5026f20-ab7a-54e0-900e-37a2d5381aee',+ },+ {+ defaultValue: {+ name: "''",+ source: "'MANUAL'",+ },+ description: 'The workspace member who last updated the record',+ icon: 'IconUserCircle',+ isNullable: false,+ label: 'Updated by',+ name: 'updatedBy',+ type: FieldMetadataType.ACTOR,+ universalIdentifier: '1dd75ff5-5fd0-51df-b3a3-a12e3aff30df',+ },+ ],+ icon: 'IconLink',+ labelIdentifierFieldMetadataUniversalIdentifier:+ 'a6ee6cc8-b9a0-5e23-a39e-bc3fee2aa3d3',+ labelPlural: 'Post Card Recipients',+ labelSingular: 'Post Card Recipient',+ namePlural: 'postCardRecipients',+ nameSingular: 'postCardRecipient',+ universalIdentifier: 'e1a2b3c4-5e6f-4a7b-8c9d-0e1f2a3b4c5e',+ },{description: 'A post card object',fields: [@@ -242,24 +409,28 @@ export const EXPECTED_MANIFEST: Manifest = {options: [{color: 'gray',+ id: 'a1b2c3d4-0001-4000-8000-000000000001',label: 'Draft',position: 0,value: 'DRAFT',},{color: 'orange',+ id: 'a1b2c3d4-0002-4000-8000-000000000002',label: 'Sent',position: 1,value: 'SENT',},{color: 'green',+ id: 'a1b2c3d4-0003-4000-8000-000000000003',label: 'Delivered',position: 2,value: 'DELIVERED',},{color: 'orange',+ id: 'a1b2c3d4-0004-4000-8000-000000000004',label: 'Returned',position: 3,value: 'RETURNED',@@ -363,6 +534,109 @@ export const EXPECTED_MANIFEST: Manifest = {nameSingular: 'postCard',universalIdentifier: '54b589ca-eeed-4950-a176-358418b85c05',},+ {+ description: 'A person or organization that receives post cards',+ fields: [+ {+ icon: 'IconMail',+ label: 'Email',+ name: 'email',+ type: FieldType.EMAILS,+ universalIdentifier: 'd2a2b3c4-5e6f-4a7b-8c9d-0e1f2a3b4c5d',+ },+ {+ icon: 'IconHome',+ label: 'Address',+ name: 'address',+ type: FieldType.ADDRESS,+ universalIdentifier: 'd3a2b3c4-5e6f-4a7b-8c9d-0e1f2a3b4c5d',+ },+ {+ defaultValue: 'uuid',+ description: 'Id',+ icon: 'Icon123',+ isNullable: false,+ label: 'Id',+ name: 'id',+ type: FieldMetadataType.UUID,+ universalIdentifier: '71aa41d7-54d0-5447-bf98-f37435b62bc4',+ },+ {+ defaultValue: null,+ description: 'Name',+ icon: 'IconAbc',+ isNullable: true,+ label: 'Name',+ name: 'name',+ type: FieldMetadataType.TEXT,+ universalIdentifier: 'ff07c707-df79-58fa-91a4-c60c31f90e6e',+ },+ {+ defaultValue: 'now',+ description: 'Creation date',+ icon: 'IconCalendar',+ isNullable: false,+ label: 'Creation date',+ name: 'createdAt',+ type: FieldMetadataType.DATE_TIME,+ universalIdentifier: '8dd42a57-7aca-5e60-89c1-6e0e430dad43',+ },+ {+ defaultValue: 'now',+ description: 'Last time the record was changed',+ icon: 'IconCalendarClock',+ isNullable: false,+ label: 'Last update',+ name: 'updatedAt',+ type: FieldMetadataType.DATE_TIME,+ universalIdentifier: 'a81e915c-f21d-5163-a547-f04029655bf0',+ },+ {+ defaultValue: null,+ description: 'Deletion date',+ icon: 'IconCalendarClock',+ isNullable: true,+ label: 'Deleted at',+ name: 'deletedAt',+ type: FieldMetadataType.DATE_TIME,+ universalIdentifier: '33ba5fa8-dbc3-5a08-b0e0-d85b18ff15e0',+ },+ {+ defaultValue: {+ name: "''",+ source: "'MANUAL'",+ },+ description: 'The creator of the record',+ icon: 'IconCreativeCommonsSa',+ isNullable: false,+ label: 'Created by',+ name: 'createdBy',+ type: FieldMetadataType.ACTOR,+ universalIdentifier: '7c377262-63b7-5a79-ba54-f7b8acd804dc',+ },+ {+ defaultValue: {+ name: "''",+ source: "'MANUAL'",+ },+ description: 'The workspace member who last updated the record',+ icon: 'IconUserCircle',+ isNullable: false,+ label: 'Updated by',+ name: 'updatedBy',+ type: FieldMetadataType.ACTOR,+ universalIdentifier: '8da8e149-b60e-52e2-878d-73d05c8312b2',+ },+ ],+ icon: 'IconUser',+ labelIdentifierFieldMetadataUniversalIdentifier:+ 'ff07c707-df79-58fa-91a4-c60c31f90e6e',+ labelPlural: 'Recipients',+ labelSingular: 'Recipient',+ namePlural: 'recipients',+ nameSingular: 'recipient',+ universalIdentifier: 'd1a2b3c4-5e6f-4a7b-8c9d-0e1f2a3b4c5d',+ },],roles: [{@@ -410,9 +684,87 @@ export const EXPECTED_MANIFEST: Manifest = {universalIdentifier: 'b648f87b-1d26-4961-b974-0908fd991061',},],- views: [],- navigationMenuItems: [],- pageLayouts: [],+ views: [+ {+ fields: [+ {+ fieldMetadataUniversalIdentifier:+ 'e2a2b3c4-5e6f-4a7b-8c9d-0e1f2a3b4c5e',+ isVisible: true,+ position: 0,+ size: 200,+ universalIdentifier: 'bf1a2b3c-0004-4a7b-8c9d-0e1f2a3b4c5d',+ },+ ],+ icon: 'IconLink',+ name: 'All Post Card Recipients',+ objectUniversalIdentifier: 'e1a2b3c4-5e6f-4a7b-8c9d-0e1f2a3b4c5e',+ position: 2,+ type: ViewType.TABLE,+ universalIdentifier: 'b1a2b3c4-0003-4a7b-8c9d-0e1f2a3b4c5d',+ },+ {+ fields: [+ {+ fieldMetadataUniversalIdentifier:+ '58a0a314-d7ea-4865-9850-7fb84e72f30b',+ isVisible: true,+ position: 0,+ size: 200,+ universalIdentifier: 'bf1a2b3c-0001-4a7b-8c9d-0e1f2a3b4c5d',+ },+ {+ fieldMetadataUniversalIdentifier:+ '87b675b8-dd8c-4448-b4ca-20e5a2234a1e',+ isVisible: true,+ position: 1,+ size: 150,+ universalIdentifier: 'bf1a2b3c-0002-4a7b-8c9d-0e1f2a3b4c5d',+ },+ ],+ icon: 'IconMail',+ name: 'All Post Cards',+ objectUniversalIdentifier: '54b589ca-eeed-4950-a176-358418b85c05',+ position: 0,+ type: ViewType.TABLE,+ universalIdentifier: 'b1a2b3c4-0001-4a7b-8c9d-0e1f2a3b4c5d',+ },+ {+ fields: [+ {+ fieldMetadataUniversalIdentifier:+ 'd2a2b3c4-5e6f-4a7b-8c9d-0e1f2a3b4c5d',+ isVisible: true,+ position: 0,+ size: 200,+ universalIdentifier: 'bf1a2b3c-0003-4a7b-8c9d-0e1f2a3b4c5d',+ },+ ],+ icon: 'IconUser',+ name: 'All Recipients',+ objectUniversalIdentifier: 'd1a2b3c4-5e6f-4a7b-8c9d-0e1f2a3b4c5d',+ position: 1,+ type: ViewType.TABLE,+ universalIdentifier: 'b1a2b3c4-0002-4a7b-8c9d-0e1f2a3b4c5d',+ },+ ],+ navigationMenuItems: [+ {+ position: 2,+ universalIdentifier: 'c1a2b3c4-0003-4a7b-8c9d-0e1f2a3b4c5d',+ viewUniversalIdentifier: 'b1a2b3c4-0003-4a7b-8c9d-0e1f2a3b4c5d',+ },+ {+ position: 0,+ universalIdentifier: 'c1a2b3c4-0001-4a7b-8c9d-0e1f2a3b4c5d',+ viewUniversalIdentifier: 'b1a2b3c4-0001-4a7b-8c9d-0e1f2a3b4c5d',+ },+ {+ position: 1,+ universalIdentifier: 'c1a2b3c4-0002-4a7b-8c9d-0e1f2a3b4c5d',+ viewUniversalIdentifier: 'b1a2b3c4-0002-4a7b-8c9d-0e1f2a3b4c5d',+ },+ ],logicFunctions: [{builtHandlerChecksum: '[checksum]',@@ -444,6 +796,39 @@ export const EXPECTED_MANIFEST: Manifest = {},universalIdentifier: '9d412d9e-2caf-487c-8b66-d1585883dd4e',},+ {+ builtHandlerChecksum: '[checksum]',+ builtHandlerPath: 'src/logic-functions/lookup-recipient.function.mjs',+ description: 'Look up a recipient by name to find their details',+ handlerName: 'default.config.handler',+ isTool: true,+ name: 'lookup-recipient',+ sourceHandlerPath: 'src/logic-functions/lookup-recipient.function.ts',+ timeoutSeconds: 5,+ toolInputSchema: {+ type: 'object',+ properties: {+ recipientName: {+ type: 'string',+ },+ },+ },+ universalIdentifier: 'a1b2c3d4-1001-4a7b-8c9d-0e1f2a3b4c5d',+ },+ {+ builtHandlerChecksum: '[checksum]',+ builtHandlerPath: 'src/logic-functions/on-post-card-created.function.mjs',+ databaseEventTriggerSettings: {+ eventName: 'postCard.created',+ },+ description: 'Triggered when a new post card is created',+ handlerName: 'default.config.handler',+ name: 'on-post-card-created',+ sourceHandlerPath: 'src/logic-functions/on-post-card-created.function.ts',+ timeoutSeconds: 5,+ toolInputSchema: { type: 'object', properties: {} },+ universalIdentifier: 'a1b2c3d4-db01-4a7b-8c9d-0e1f2a3b4c5d',+ },{builtHandlerChecksum: '[checksum]',builtHandlerPath: 'src/logic-functions/test-function-2.function.mjs',diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/tests/entities.tests.ts b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/tests/entities.tests.tsindex cfece7e9966..5801109f944 100644--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/tests/entities.tests.ts+++ b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/tests/entities.tests.ts@@ -25,6 +25,10 @@ export const defineEntitiesTests = (appPath: string): void => {'src/logic-functions','src/logic-functions/greeting.function.mjs','src/logic-functions/greeting.function.mjs.map',+ 'src/logic-functions/lookup-recipient.function.mjs',+ 'src/logic-functions/lookup-recipient.function.mjs.map',+ 'src/logic-functions/on-post-card-created.function.mjs',+ 'src/logic-functions/on-post-card-created.function.mjs.map','src/logic-functions/test-function-2.function.mjs','src/logic-functions/test-function-2.function.mjs.map','src/logic-functions/test-function.function.mjs',diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/tests/manifest.tests.ts b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/tests/manifest.tests.tsindex bb835241307..1b631963516 100644--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/tests/manifest.tests.ts+++ b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/__integration__/app-dev/tests/manifest.tests.ts@@ -42,11 +42,13 @@ export const defineManifestTests = (appPath: string): void => {it('should load all entity types', async () => {const manifest = await fs.readJson(manifestOutputPath);- expect(manifest.objects).toHaveLength(2);- expect(manifest.logicFunctions).toHaveLength(4);+ expect(manifest.objects).toHaveLength(4);+ expect(manifest.logicFunctions).toHaveLength(6);expect(manifest.frontComponents).toHaveLength(4);expect(manifest.roles).toHaveLength(2);- expect(manifest.fields).toHaveLength(2);+ expect(manifest.fields).toHaveLength(6);+ expect(manifest.views).toHaveLength(3);+ expect(manifest.navigationMenuItems).toHaveLength(3);});});};diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/post-card-on-post-card-recipient.field.ts b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/post-card-on-post-card-recipient.field.tsnew file mode 100644index 00000000000..1898ba206da--- /dev/null+++ b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/post-card-on-post-card-recipient.field.ts@@ -0,0 +1,24 @@+import {+ POST_CARD_ON_POST_CARD_RECIPIENT_ID,+ POST_CARD_RECIPIENTS_ON_POST_CARD_ID,+} from '@/cli/__tests__/apps/rich-app/src/fields/post-card-recipients-on-post-card.field';+import { POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/post-card-recipient.object';+import { defineField, FieldType, OnDeleteAction, RelationType } from '@/sdk';+import { POST_CARD_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/post-card.object';++export default defineField({+ universalIdentifier: POST_CARD_ON_POST_CARD_RECIPIENT_ID,+ objectUniversalIdentifier: POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER,+ type: FieldType.RELATION,+ name: 'postCard',+ label: 'Post Card',+ relationTargetObjectMetadataUniversalIdentifier:+ POST_CARD_UNIVERSAL_IDENTIFIER,+ relationTargetFieldMetadataUniversalIdentifier:+ POST_CARD_RECIPIENTS_ON_POST_CARD_ID,+ universalSettings: {+ relationType: RelationType.MANY_TO_ONE,+ onDelete: OnDeleteAction.CASCADE,+ joinColumnName: 'postCardId',+ },+});diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/post-card-recipients-on-post-card.field.ts b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/post-card-recipients-on-post-card.field.tsnew file mode 100644index 00000000000..ae35ad1e4f8--- /dev/null+++ b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/post-card-recipients-on-post-card.field.ts@@ -0,0 +1,23 @@+import { POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/post-card-recipient.object';+import { defineField, FieldType, RelationType } from '@/sdk';+import { POST_CARD_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/post-card.object';++export const POST_CARD_RECIPIENTS_ON_POST_CARD_ID =+ 'a1a2b3c4-0001-4a7b-8c9d-0e1f2a3b4c5d';+export const POST_CARD_ON_POST_CARD_RECIPIENT_ID =+ 'a1a2b3c4-0002-4a7b-8c9d-0e1f2a3b4c5d';++export default defineField({+ universalIdentifier: POST_CARD_RECIPIENTS_ON_POST_CARD_ID,+ objectUniversalIdentifier: POST_CARD_UNIVERSAL_IDENTIFIER,+ type: FieldType.RELATION,+ name: 'postCardRecipients',+ label: 'Post Card Recipients',+ relationTargetObjectMetadataUniversalIdentifier:+ POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER,+ relationTargetFieldMetadataUniversalIdentifier:+ POST_CARD_ON_POST_CARD_RECIPIENT_ID,+ universalSettings: {+ relationType: RelationType.ONE_TO_MANY,+ },+});diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/post-card-recipients-on-recipient.field.ts b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/post-card-recipients-on-recipient.field.tsnew file mode 100644index 00000000000..c7bbe21a54f--- /dev/null+++ b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/post-card-recipients-on-recipient.field.ts@@ -0,0 +1,23 @@+import { defineField, FieldType, RelationType } from '@/sdk';+import { RECIPIENT_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/recipient.object';+import { POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/post-card-recipient.object';++export const POST_CARD_RECIPIENTS_ON_RECIPIENT_ID =+ 'a1a2b3c4-0003-4a7b-8c9d-0e1f2a3b4c5d';+export const RECIPIENT_ON_POST_CARD_RECIPIENT_ID =+ 'a1a2b3c4-0004-4a7b-8c9d-0e1f2a3b4c5d';++export default defineField({+ universalIdentifier: POST_CARD_RECIPIENTS_ON_RECIPIENT_ID,+ objectUniversalIdentifier: RECIPIENT_UNIVERSAL_IDENTIFIER,+ type: FieldType.RELATION,+ name: 'postCardRecipients',+ label: 'Post Card Recipients',+ relationTargetObjectMetadataUniversalIdentifier:+ POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER,+ relationTargetFieldMetadataUniversalIdentifier:+ RECIPIENT_ON_POST_CARD_RECIPIENT_ID,+ universalSettings: {+ relationType: RelationType.ONE_TO_MANY,+ },+});diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/postCardCategoryField.ts b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/postCardCategoryField.tsindex 5be87474eb3..2d02b2955c8 100644--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/postCardCategoryField.ts+++ b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/postCardCategoryField.ts@@ -1,5 +1,5 @@import { defineField, FieldType } from '@/sdk';-import { POST_CARD_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/postCard.object';+import { POST_CARD_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/post-card.object';export default defineField({objectUniversalIdentifier: POST_CARD_UNIVERSAL_IDENTIFIER,@@ -9,9 +9,22 @@ export default defineField({label: 'Category',description: 'Post card category',options: [- { value: 'PERSONAL', label: 'Personal', color: 'blue', position: 0 },- { value: 'BUSINESS', label: 'Business', color: 'green', position: 1 },{+ id: 'c1d2e3f4-0001-4000-8000-000000000001',+ value: 'PERSONAL',+ label: 'Personal',+ color: 'blue',+ position: 0,+ },+ {+ id: 'c1d2e3f4-0002-4000-8000-000000000002',+ value: 'BUSINESS',+ label: 'Business',+ color: 'green',+ position: 1,+ },+ {+ id: 'c1d2e3f4-0003-4000-8000-000000000003',value: 'PROMOTIONAL',label: 'Promotional',color: 'orange',diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/postCardNumber.field.ts b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/postCardNumber.field.tsindex f96d4560b21..0aa42d9884f 100644--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/postCardNumber.field.ts+++ b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/postCardNumber.field.ts@@ -1,5 +1,5 @@import { defineField, FieldType } from '@/sdk';-import { POST_CARD_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/postCard.object';+import { POST_CARD_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/post-card.object';export default defineField({objectUniversalIdentifier: POST_CARD_UNIVERSAL_IDENTIFIER,diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/recipient-on-post-card-recipient.field.ts b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/recipient-on-post-card-recipient.field.tsnew file mode 100644index 00000000000..04295115ebd--- /dev/null+++ b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/fields/recipient-on-post-card-recipient.field.ts@@ -0,0 +1,24 @@+import { defineField, FieldType, RelationType, OnDeleteAction } from '@/sdk';+import { RECIPIENT_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/recipient.object';+import { POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER } from '@/cli/__tests__/apps/rich-app/src/objects/post-card-recipient.object';+import {+ POST_CARD_RECIPIENTS_ON_RECIPIENT_ID,+ RECIPIENT_ON_POST_CARD_RECIPIENT_ID,+} from '@/cli/__tests__/apps/rich-app/src/fields/post-card-recipients-on-recipient.field';++export default defineField({+ universalIdentifier: RECIPIENT_ON_POST_CARD_RECIPIENT_ID,+ objectUniversalIdentifier: POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER,+ type: FieldType.RELATION,+ name: 'recipient',+ label: 'Recipient',+ relationTargetObjectMetadataUniversalIdentifier:+ RECIPIENT_UNIVERSAL_IDENTIFIER,+ relationTargetFieldMetadataUniversalIdentifier:+ POST_CARD_RECIPIENTS_ON_RECIPIENT_ID,+ universalSettings: {+ relationType: RelationType.MANY_TO_ONE,+ onDelete: OnDeleteAction.CASCADE,+ joinColumnName: 'recipientId',+ },+});diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/lookup-recipient.function.ts b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/lookup-recipient.function.tsnew file mode 100644index 00000000000..859cb00b42c--- /dev/null+++ b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/lookup-recipient.function.ts@@ -0,0 +1,14 @@+import { defineLogicFunction } from '@/sdk';++const handler = async (params: { recipientName: string }) => {+ return { found: true, name: params.recipientName };+};++export default defineLogicFunction({+ universalIdentifier: 'a1b2c3d4-1001-4a7b-8c9d-0e1f2a3b4c5d',+ name: 'lookup-recipient',+ description: 'Look up a recipient by name to find their details',+ timeoutSeconds: 5,+ handler,+ isTool: true,+});diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/on-post-card-created.function.ts b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/on-post-card-created.function.tsnew file mode 100644index 00000000000..09a8bdb02f4--- /dev/null+++ b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/logic-functions/on-post-card-created.function.ts@@ -0,0 +1,16 @@+import { defineLogicFunction } from '@/sdk';++const handler = async () => {+ return { processed: true };+};++export default defineLogicFunction({+ universalIdentifier: 'a1b2c3d4-db01-4a7b-8c9d-0e1f2a3b4c5d',+ name: 'on-post-card-created',+ description: 'Triggered when a new post card is created',+ timeoutSeconds: 5,+ handler,+ databaseEventTriggerSettings: {+ eventName: 'postCard.created',+ },+});diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/navigation-menu-items/post-card-recipients.navigation-menu-item.ts b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/navigation-menu-items/post-card-recipients.navigation-menu-item.tsnew file mode 100644index 00000000000..5735595cdb0--- /dev/null+++ b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/navigation-menu-items/post-card-recipients.navigation-menu-item.ts@@ -0,0 +1,8 @@+import { defineNavigationMenuItem } from '@/sdk';+import { ALL_POST_CARD_RECIPIENTS_VIEW_ID } from '@/cli/__tests__/apps/rich-app/src/views/all-post-card-recipients.view';++export default defineNavigationMenuItem({+ universalIdentifier: 'c1a2b3c4-0003-4a7b-8c9d-0e1f2a3b4c5d',+ position: 2,+ viewUniversalIdentifier: ALL_POST_CARD_RECIPIENTS_VIEW_ID,+});diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/navigation-menu-items/post-cards.navigation-menu-item.ts b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/navigation-menu-items/post-cards.navigation-menu-item.tsnew file mode 100644index 00000000000..d10c4ac1f98--- /dev/null+++ b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/navigation-menu-items/post-cards.navigation-menu-item.ts@@ -0,0 +1,8 @@+import { defineNavigationMenuItem } from '@/sdk';+import { ALL_POST_CARDS_VIEW_ID } from '@/cli/__tests__/apps/rich-app/src/views/all-post-cards.view';++export default defineNavigationMenuItem({+ universalIdentifier: 'c1a2b3c4-0001-4a7b-8c9d-0e1f2a3b4c5d',+ position: 0,+ viewUniversalIdentifier: ALL_POST_CARDS_VIEW_ID,+});diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/navigation-menu-items/recipients.navigation-menu-item.ts b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/navigation-menu-items/recipients.navigation-menu-item.tsnew file mode 100644index 00000000000..290311fe6bb--- /dev/null+++ b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/navigation-menu-items/recipients.navigation-menu-item.ts@@ -0,0 +1,8 @@+import { defineNavigationMenuItem } from '@/sdk';+import { ALL_RECIPIENTS_VIEW_ID } from '@/cli/__tests__/apps/rich-app/src/views/all-recipients.view';++export default defineNavigationMenuItem({+ universalIdentifier: 'c1a2b3c4-0002-4a7b-8c9d-0e1f2a3b4c5d',+ position: 1,+ viewUniversalIdentifier: ALL_RECIPIENTS_VIEW_ID,+});diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/post-card-recipient.object.ts b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/post-card-recipient.object.tsnew file mode 100644index 00000000000..62deafc4aeb--- /dev/null+++ b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/post-card-recipient.object.ts@@ -0,0 +1,28 @@+import { defineObject, FieldType } from '@/sdk';++export const POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER =+ 'e1a2b3c4-5e6f-4a7b-8c9d-0e1f2a3b4c5e';++export const SENT_AT_FIELD_UNIVERSAL_IDENTIFIER =+ 'e2a2b3c4-5e6f-4a7b-8c9d-0e1f2a3b4c5e';++export default defineObject({+ universalIdentifier: POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER,+ nameSingular: 'postCardRecipient',+ namePlural: 'postCardRecipients',+ labelSingular: 'Post Card Recipient',+ labelPlural: 'Post Card Recipients',+ description: 'Junction object linking post cards to their recipients',+ icon: 'IconLink',+ fields: [+ {+ universalIdentifier: SENT_AT_FIELD_UNIVERSAL_IDENTIFIER,+ type: FieldType.DATE_TIME,+ label: 'Sent at',+ name: 'sentAt',+ icon: 'IconClock',+ isNullable: true,+ defaultValue: null,+ },+ ],+});diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/postCard.object.ts b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/post-card.object.tssimilarity index 91%rename from packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/postCard.object.tsrename to packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/post-card.object.tsindex 286ad8a781b..8bd7a6790a5 100644--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/postCard.object.ts+++ b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/post-card.object.ts@@ -53,24 +53,28 @@ export default defineObject({defaultValue: `'${PostCardStatus.DRAFT}'`,options: [{+ id: 'a1b2c3d4-0001-4000-8000-000000000001',value: PostCardStatus.DRAFT,label: 'Draft',position: 0,color: 'gray',},{+ id: 'a1b2c3d4-0002-4000-8000-000000000002',value: PostCardStatus.SENT,label: 'Sent',position: 1,color: 'orange',},{+ id: 'a1b2c3d4-0003-4000-8000-000000000003',value: PostCardStatus.DELIVERED,label: 'Delivered',position: 2,color: 'green',},{+ id: 'a1b2c3d4-0004-4000-8000-000000000004',value: PostCardStatus.RETURNED,label: 'Returned',position: 3,diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/recipient.object.ts b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/recipient.object.tsnew file mode 100644index 00000000000..e6abb7ff9c7--- /dev/null+++ b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/objects/recipient.object.ts@@ -0,0 +1,33 @@+import { defineObject, FieldType } from '@/sdk';++export const RECIPIENT_UNIVERSAL_IDENTIFIER =+ 'd1a2b3c4-5e6f-4a7b-8c9d-0e1f2a3b4c5d';++export const RECIPIENT_EMAIL_FIELD_UNIVERSAL_IDENTIFIER =+ 'd2a2b3c4-5e6f-4a7b-8c9d-0e1f2a3b4c5d';++export default defineObject({+ universalIdentifier: RECIPIENT_UNIVERSAL_IDENTIFIER,+ nameSingular: 'recipient',+ namePlural: 'recipients',+ labelSingular: 'Recipient',+ labelPlural: 'Recipients',+ description: 'A person or organization that receives post cards',+ icon: 'IconUser',+ fields: [+ {+ universalIdentifier: RECIPIENT_EMAIL_FIELD_UNIVERSAL_IDENTIFIER,+ type: FieldType.EMAILS,+ label: 'Email',+ name: 'email',+ icon: 'IconMail',+ },+ {+ universalIdentifier: 'd3a2b3c4-5e6f-4a7b-8c9d-0e1f2a3b4c5d',+ type: FieldType.ADDRESS,+ label: 'Address',+ name: 'address',+ icon: 'IconHome',+ },+ ],+});diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/roles/default-function.role.ts b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/roles/default-function.role.tsindex b2955db9878..4852725a843 100644--- a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/roles/default-function.role.ts+++ b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/roles/default-function.role.ts@@ -2,7 +2,7 @@ import { PermissionFlag, defineRole } from '@/sdk';import {CONTENT_FIELD_UNIVERSAL_IDENTIFIER,POST_CARD_UNIVERSAL_IDENTIFIER,-} from '@/cli/__tests__/apps/rich-app/src/objects/postCard.object';+} from '@/cli/__tests__/apps/rich-app/src/objects/post-card.object';export const DEFAULT_ROLE_UNIVERSAL_IDENTIFIER ='b648f87b-1d26-4961-b974-0908fd991061';diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/views/all-post-card-recipients.view.ts b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/views/all-post-card-recipients.view.tsnew file mode 100644index 00000000000..8dac15d3a56--- /dev/null+++ b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/views/all-post-card-recipients.view.ts@@ -0,0 +1,27 @@+import {+ POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER,+ SENT_AT_FIELD_UNIVERSAL_IDENTIFIER,+} from '@/cli/__tests__/apps/rich-app/src/objects/post-card-recipient.object';+import { defineView } from '@/sdk';+import { ViewType } from 'twenty-shared/types';++export const ALL_POST_CARD_RECIPIENTS_VIEW_ID =+ 'b1a2b3c4-0003-4a7b-8c9d-0e1f2a3b4c5d';++export default defineView({+ universalIdentifier: ALL_POST_CARD_RECIPIENTS_VIEW_ID,+ name: 'All Post Card Recipients',+ objectUniversalIdentifier: POST_CARD_RECIPIENT_UNIVERSAL_IDENTIFIER,+ type: ViewType.TABLE,+ icon: 'IconLink',+ position: 2,+ fields: [+ {+ universalIdentifier: 'bf1a2b3c-0004-4a7b-8c9d-0e1f2a3b4c5d',+ fieldMetadataUniversalIdentifier: SENT_AT_FIELD_UNIVERSAL_IDENTIFIER,+ position: 0,+ isVisible: true,+ size: 200,+ },+ ],+});diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/views/all-post-cards.view.ts b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/views/all-post-cards.view.tsnew file mode 100644index 00000000000..21e1288df6d--- /dev/null+++ b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/views/all-post-cards.view.ts@@ -0,0 +1,33 @@+import { defineView } from '@/sdk';+import {+ CONTENT_FIELD_UNIVERSAL_IDENTIFIER,+ POST_CARD_UNIVERSAL_IDENTIFIER,+} from '@/cli/__tests__/apps/rich-app/src/objects/post-card.object';+import { ViewType } from 'twenty-shared/types';++export const ALL_POST_CARDS_VIEW_ID = 'b1a2b3c4-0001-4a7b-8c9d-0e1f2a3b4c5d';++export default defineView({+ universalIdentifier: ALL_POST_CARDS_VIEW_ID,+ name: 'All Post Cards',+ objectUniversalIdentifier: POST_CARD_UNIVERSAL_IDENTIFIER,+ type: ViewType.TABLE,+ icon: 'IconMail',+ position: 0,+ fields: [+ {+ universalIdentifier: 'bf1a2b3c-0001-4a7b-8c9d-0e1f2a3b4c5d',+ fieldMetadataUniversalIdentifier: CONTENT_FIELD_UNIVERSAL_IDENTIFIER,+ position: 0,+ isVisible: true,+ size: 200,+ },+ {+ universalIdentifier: 'bf1a2b3c-0002-4a7b-8c9d-0e1f2a3b4c5d',+ fieldMetadataUniversalIdentifier: '87b675b8-dd8c-4448-b4ca-20e5a2234a1e',+ position: 1,+ isVisible: true,+ size: 150,+ },+ ],+});diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/views/all-recipients.view.ts b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/views/all-recipients.view.tsnew file mode 100644index 00000000000..7fd86807c24--- /dev/null+++ b/packages/twenty-sdk/src/cli/__tests__/apps/rich-app/src/views/all-recipients.view.ts@@ -0,0 +1,27 @@+import {+ RECIPIENT_EMAIL_FIELD_UNIVERSAL_IDENTIFIER,+ RECIPIENT_UNIVERSAL_IDENTIFIER,+} from '@/cli/__tests__/apps/rich-app/src/objects/recipient.object';+import { defineView } from '@/sdk';+import { ViewType } from 'twenty-shared/types';++export const ALL_RECIPIENTS_VIEW_ID = 'b1a2b3c4-0002-4a7b-8c9d-0e1f2a3b4c5d';++export default defineView({+ universalIdentifier: ALL_RECIPIENTS_VIEW_ID,+ name: 'All Recipients',+ objectUniversalIdentifier: RECIPIENT_UNIVERSAL_IDENTIFIER,+ type: ViewType.TABLE,+ icon: 'IconUser',+ position: 1,+ fields: [+ {+ universalIdentifier: 'bf1a2b3c-0003-4a7b-8c9d-0e1f2a3b4c5d',+ fieldMetadataUniversalIdentifier:+ RECIPIENT_EMAIL_FIELD_UNIVERSAL_IDENTIFIER,+ position: 0,+ isVisible: true,+ size: 200,+ },+ ],+});