The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
i18n - docs translations (#17689)
github-actions[bot]60b48339b9b7
diff --git a/packages/twenty-docs/l/ar/developers/extend/capabilities/apps.mdx b/packages/twenty-docs/l/ar/developers/extend/capabilities/apps.mdxindex a34f14a7e56..b1e87ab08b6 100644--- a/packages/twenty-docs/l/ar/developers/extend/capabilities/apps.mdx+++ b/packages/twenty-docs/l/ar/developers/extend/capabilities/apps.mdx@@ -17,10 +17,6 @@ description: أنشئ وأدِر تخصيصات Twenty على هيئة كود.* أنشئ وظائف منطقية مع مشغلات مخصصة* انشر التطبيق نفسه عبر مساحات عمل متعددة-**قريبًا:**--* تخطيطات ومكونات واجهة مستخدم مخصصة-## المتطلبات الأساسية* Node.js 24+ وYarn 4@@ -93,84 +89,57 @@ my-twenty-app/eslint.config.mjstsconfig.jsonREADME.md- public/ # مجلد الأصول العامة (صور، خطوط، إلخ)+ public/ # Public assets folder (images, fonts, etc.)src/- application.config.ts # مطلوب - التكوين الرئيسي للتطبيق- default-function.role.ts # الدور الافتراضي للوظائف بدون خادم- hello-world.function.ts # مثال لوظيفة بدون خادم- hello-world.front-component.tsx # مثال لمكوّن الواجهة الأمامية- // كياناتك (*.object.ts, *.function.ts, *.front-component.tsx, *.role.ts)+ ├── application-config.ts # Required - main application configuration+ ├── roles/+ │ └── default-role.ts # Default role for logic functions+ ├── logic-functions/+ │ └── hello-world.ts # Example logic function+ └── front-components/+ └── hello-world.tsx # Example front component```-### الاتفاقية فوق التهيئة--تستخدم التطبيقات نهج **الاتفاقية فوق التهيئة** حيث تُكتشف الكيانات عبر لاحقة اسم الملف. يتيح ذلك تنظيمًا مرنًا داخل مجلد `src/app/`:+بشكل عام:-| لاحقة الملف | نوع الكيان |-| ----------------------- | --------------------------- |-| `*.object.ts` | تعريفات كائنات مخصصة |-| `*.function.ts` | تعريفات وظائف بلا خادم |-| `*.front-component.tsx` | Front component definitions |-| `*.role.ts` | تعريفات الأدوار |+* **package.json**: Declares the app name, version, engines (Node 24+, Yarn 4), and adds `twenty-sdk` plus scripts like `app:dev`, `app:generate`, `entity:add`, `function:logs`, `function:execute`, `app:uninstall`, and authentication commands that delegate to the local `twenty` CLI.+* **.gitignore**: يتجاهل العناصر الشائعة مثل `node_modules` و`.yarn` و`generated/` (عميل مضبوط الأنواع) و`dist/` و`build/` ومجلدات التغطية وملفات السجلات وملفات `.env*`.+* **yarn.lock**، **.yarnrc.yml**، **.yarn/**: تقوم بقفل وتكوين حزمة أدوات Yarn 4 المستخدمة في المشروع.+* **.nvmrc**: يثبّت إصدار Node.js المتوقع للمشروع.+* **eslint.config.mjs** و**tsconfig.json**: يقدّمان إعدادات الفحص والتهيئة لـ TypeScript لمصادر TypeScript في تطبيقك.+* **README.md**: ملف README قصير في جذر التطبيق يتضمن تعليمات أساسية.+* **public/**: مجلد لتخزين الأصول العامة (صور، خطوط، ملفات ثابتة) التي سيتم تقديمها مع تطبيقك. الملفات الموضوعة هنا تُرفع أثناء المزامنة وتكون متاحة أثناء وقت التشغيل.+* **src/**: المكان الرئيسي حيث تعرّف تطبيقك ككود-### طرق تنظيم المجلدات المدعومة+### Entity detection-يمكنك تنظيم الكيانات بأي من الأنماط التالية:+The SDK detects entities by parsing your TypeScript files for **`export default define<Entity>({...})`** calls. Each entity type has a corresponding helper function exported from `twenty-sdk`:-**تقليدي (حسب النوع):**+| Helper function | نوع الكيان |+| ------------------------ | ------------------------------------- |+| `defineObject()` | تعريفات كائنات مخصصة |+| `defineLogicFunction()` | Logic function definitions |+| `defineFrontComponent()` | Front component definitions |+| `defineRole()` | تعريفات الأدوار |+| `defineField()` | Field extensions for existing objects |-```text-src/-├── application.config.ts-├── objects/-│ └── postCard.object.ts-├── functions/-│ └── createPostCard.function.ts-├── components/-│ └── card.front-component.tsx-└── roles/- └── admin.role.ts-```+<Note>+ **File naming is flexible.** Entity detection is AST-based — the SDK scans your source files for the `export default define<Entity>({...})` pattern. You can organize your files and folders however you like. Grouping by entity type (e.g., `logic-functions/`, `roles/`) is just a convention for code organization, not a requirement.+</Note>-**حسب الميزة:**+Example of a detected entity:-```text-src/-├── application.config.ts-└── post-card/- ├── postCard.object.ts- ├── createPostCard.function.ts- ├── card.front-component.tsx- └── postCardAdmin.role.ts-```--**مسطح:**+```typescript+// This file can be named anything and placed anywhere in src/+import { defineObject, FieldType } from 'twenty-sdk';-```text-src/-├── application.config.ts-├── postCard.object.ts-├── createPostCard.function.ts-├── card.front-component.tsx-└── admin.role.ts+export default defineObject({+ universalIdentifier: '...',+ nameSingular: 'postCard',+ // ... rest of config+});```-بشكل عام:--* **package.json**: يصرّح باسم التطبيق والإصدار والمحرّكات (Node 24+، Yarn 4)، ويضيف `twenty-sdk` فضلًا عن نصوص مثل `app:dev` و`app:generate` و`entity:add` و`function:logs` و`function:execute` و`app:uninstall` و`auth:login` التي تفوِّض إلى `twenty` CLI المحلي.-* **.gitignore**: يتجاهل العناصر الشائعة مثل `node_modules` و`.yarn` و`generated/` (عميل مضبوط الأنواع) و`dist/` و`build/` ومجلدات التغطية وملفات السجلات وملفات `.env*`.-* **yarn.lock**، **.yarnrc.yml**، **.yarn/**: تقوم بقفل وتكوين حزمة أدوات Yarn 4 المستخدمة في المشروع.-* **.nvmrc**: يثبّت إصدار Node.js المتوقع للمشروع.-* **eslint.config.mjs** و**tsconfig.json**: يقدّمان إعدادات الفحص والتهيئة لـ TypeScript لمصادر TypeScript في تطبيقك.-* **README.md**: ملف README قصير في جذر التطبيق يتضمن تعليمات أساسية.-* **public/**: مجلد لتخزين الأصول العامة (صور، خطوط، ملفات ثابتة) التي سيتم تقديمها مع تطبيقك. الملفات الموضوعة هنا تُرفع أثناء المزامنة وتكون متاحة أثناء وقت التشغيل.-* **src/**: المكان الرئيسي حيث تعرّف تطبيقك ككود:- * `application.config.ts`: التكوين العام لتطبيقك (بيانات وصفية وربط وقت التشغيل). انظر "تكوين التطبيق" أدناه.- * `*.role.ts`: تعريفات الأدوار المستخدمة بواسطة وظائفك المنطقية. انظر "الدور الافتراضي للوظيفة" أدناه.- * `*.object.ts`: تعريفات كائنات مخصصة.- * `*.function.ts`: تعريفات الوظائف المنطقية.- * `*.front-component.tsx`: تعريفات المكونات الواجهية.-ستضيف الأوامر اللاحقة مزيدًا من الملفات والمجلدات:* `yarn app:generate` سيُنشئ مجلدًا `generated/` (عميل Twenty مضبوط الأنواع + أنواع مساحة العمل).@@ -215,16 +184,18 @@ Once you've switched workspaces with `auth:switch`, all subsequent commands will### دوال مساعدة-يوفّر SDK أربع دوال مساعدة مع تحقق مدمج لتعريف كيانات تطبيقك:+The SDK provides helper functions for defining your app entities. As described in [Entity detection](#entity-detection), you must use `export default define<Entity>({...})` for your entities to be detected:-| دالة | الغرض |-| --------------------- | ---------------------------------------- |-| `defineApplication()` | تهيئة بيانات التطبيق الوصفية |-| `defineObject()` | تعريف كائنات مخصصة مع حقول |-| `defineFunction()` | تعريف وظائف منطقية مع معالجات |-| `defineRole()` | تهيئة صلاحيات الدور والوصول إلى الكائنات |+| دالة | الغرض |+| ------------------------ | ------------------------------------------------------ |+| `defineApplication()` | Configure application metadata (required, one per app) |+| `defineObject()` | تعريف كائنات مخصصة مع حقول |+| `defineLogicFunction()` | تعريف وظائف منطقية مع معالجات |+| `defineFrontComponent()` | Define front components for custom UI |+| `defineRole()` | تهيئة صلاحيات الدور والوصول إلى الكائنات |+| `defineField()` | Extend existing objects with additional fields |-تتحقق هذه الدوال من تكوينك في وقت التشغيل وتوفر إكمالًا تلقائيًا أفضل في بيئة التطوير وأمان أنواع أعلى.+These functions validate your configuration at build time and provide IDE autocompletion and type safety.### تعريف الكائنات@@ -311,9 +282,9 @@ export default defineObject({**يتم إنشاء الحقول الأساسية تلقائيًا.** عند تعريف كائن مخصص، يضيف Twenty تلقائيًا حقولًا قياسية مثل `name` و`createdAt` و`updatedAt` و`createdBy` و`position` و`deletedAt`. لا تحتاج إلى تعريف هذه في مصفوفة `fields` — أضف فقط حقولك المخصصة.</Note>-### تكوين التطبيق (application.config.ts)+### تكوين التطبيق (application-config.ts)-كل تطبيق لديه ملف واحد `application.config.ts` يصف:+كل تطبيق لديه ملف واحد `application-config.ts` يصف:* **هوية التطبيق**: المعرفات، اسم العرض، والوصف.* **كيفية تشغيل وظائفه**: الدور الذي تستخدمه للأذونات.@@ -322,9 +293,9 @@ export default defineObject({Use `defineApplication()` to define your application configuration:```typescript-// src/app/application.config.ts+// src/application-config.tsimport { defineApplication } from 'twenty-sdk';-import { DEFAULT_ROLE_UNIVERSAL_IDENTIFIER } from './default-function.role';+import { DEFAULT_ROLE_UNIVERSAL_IDENTIFIER } from 'src/roles/default-role';export default defineApplication({universalIdentifier: '4ec0391d-18d5-411c-b2f3-266ddc1c3ef7',@@ -339,7 +310,7 @@ export default defineApplication({isSecret: false,},},- roleUniversalIdentifier: DEFAULT_ROLE_UNIVERSAL_IDENTIFIER,+ defaultRoleUniversalIdentifier: DEFAULT_ROLE_UNIVERSAL_IDENTIFIER,});```@@ -347,11 +318,11 @@ export default defineApplication({* حقول `universalIdentifier` هي معرّفات حتمية تخصك؛ أنشئها مرة واحدة واحتفظ بها ثابتة عبر عمليات المزامنة.* `applicationVariables` تصبح متغيرات بيئة لوظائفك (على سبيل المثال، `DEFAULT_RECIPIENT_NAME` متاح كـ `process.env.DEFAULT_RECIPIENT_NAME`).-* `roleUniversalIdentifier` must match the role you define in your `*.role.ts` file (see below).+* `defaultRoleUniversalIdentifier` must match the role file (see below).#### الأدوار والصلاحيات-يمكن للتطبيقات تعريف أدوار تُغلّف الصلاحيات على كائنات وإجراءات مساحة العمل لديك. The field `roleUniversalIdentifier` in `application.config.ts` designates the default role used by your app's logic functions.+يمكن للتطبيقات تعريف أدوار تُغلّف الصلاحيات على كائنات وإجراءات مساحة العمل لديك. The field `defaultRoleUniversalIdentifier` in `application-config.ts` designates the default role used by your app's logic functions.* مفتاح واجهة البرمجة في وقت التشغيل المحقون باسم `TWENTY_API_KEY` مستمد من دور الوظيفة الافتراضي هذا.* سيُقيَّد العميل مضبوط الأنواع بالأذونات الممنوحة لذلك الدور.@@ -362,7 +333,7 @@ export default defineApplication({عند توليد تطبيق جديد بالقالب، ينشئ CLI أيضًا ملف دور افتراضي. استخدم `defineRole()` لتعريف أدوار مع تحقق مدمج:```typescript-// src/app/default-function.role.ts+// src/roles/default-role.tsimport { defineRole, PermissionFlag } from 'twenty-sdk';export const DEFAULT_ROLE_UNIVERSAL_IDENTIFIER =@@ -401,10 +372,10 @@ export default defineRole({});```-يُشار بعد ذلك إلى `universalIdentifier` لهذا الدور في `application.config.ts` باسم `roleUniversalIdentifier`. بعبارة أخرى:+The `universalIdentifier` of this role is then referenced in `application-config.ts` as `defaultRoleUniversalIdentifier`. بعبارة أخرى:* **\\*.role.ts** يحدد ما يمكن أن يفعله الدور الافتراضي للوظيفة.-* **application.config.ts** يشير إلى ذلك الدور بحيث ترث وظائفك صلاحياته.+* **application-config.ts** points to that role so your functions inherit its permissions.الملاحظات:@@ -415,11 +386,11 @@ export default defineRole({### تكوين الوظيفة المنطقية ونقطة الدخول-كل ملف وظيفة يستخدم `defineFunction()` لتصدير تكوين مع معالج ومشغلات اختيارية. استخدم لاحقة الملف `*.function.ts` للاكتشاف التلقائي.+Each function file uses `defineLogicFunction()` to export a configuration with a handler and optional triggers.```typescript-// src/app/createPostCard.function.ts-import { defineFunction } from 'twenty-sdk';+// src/app/createPostCard.logic-function.ts+import { defineLogicFunction } from 'twenty-sdk';import type { DatabaseEventPayload, ObjectRecordCreateEvent, CronPayload, RoutePayload } from 'twenty-sdk';import Twenty, { type Person } from '~/generated';@@ -439,7 +410,7 @@ const handler = async (params: RoutePayload) => {return result;};-export default defineFunction({+export default defineLogicFunction({universalIdentifier: 'e56d363b-0bdc-4d8a-a393-6f0d1c75bdcf',name: 'create-new-post-card',timeoutSeconds: 2,@@ -515,7 +486,7 @@ export default defineFunction({عندما يستدعي مشغّل المسار وظيفتك المنطقية، يتلقى كائنًا من النوع `RoutePayload` يتبع تنسيق AWS HTTP API v2. استورد النوع من `twenty-sdk`:```typescript-import { defineFunction, type RoutePayload } from 'twenty-sdk';+import { defineLogicFunction, type RoutePayload } from 'twenty-sdk';const handler = async (event: RoutePayload) => {// Access request data@@ -545,7 +516,7 @@ const handler = async (event: RoutePayload) => {افتراضيًا، **لا** تُمرَّر رؤوس HTTP من الطلبات الواردة إلى وظيفتك المنطقية لأسباب أمنية. للوصول إلى رؤوس محددة، قم بإدراجها صراحةً في مصفوفة `forwardedRequestHeaders`:```typescript-export default defineFunction({+export default defineLogicFunction({universalIdentifier: 'e56d363b-0bdc-4d8a-a393-6f0d1c75bdcf',name: 'webhook-handler',handler,@@ -580,8 +551,45 @@ const handler = async (event: RoutePayload) => {يمكنك إنشاء وظائف جديدة بطريقتين:-* **مُنشأ بالقالب**: شغّل `yarn entity:add` واختر خيار إضافة وظيفة جديدة. يُولّد هذا ملفًا مبدئيًا مع معالج وتكوين.-* **يدوي**: أنشئ ملفًا جديدًا `*.function.ts` واستخدم `defineFunction()` مع اتباع النمط نفسه.+* **Scaffolded**: Run `yarn entity:add` and choose the option to add a new logic function. يُولّد هذا ملفًا مبدئيًا مع معالج وتكوين.+* **Manual**: Create a new `*.logic-function.ts` file and use `defineLogicFunction()`, following the same pattern.++### Front components++Front components let you build custom React components that render within Twenty's UI. Use `defineFrontComponent()` to define components with built-in validation:++```typescript+// src/my-widget.front-component.tsx+import { defineFrontComponent } from 'twenty-sdk';++const MyWidget = () => {+ return (+ <div style={{ padding: '20px', fontFamily: 'sans-serif' }}>+ <h1>My Custom Widget</h1>+ <p>This is a custom front component for Twenty.</p>+ </div>+ );+};++export default defineFrontComponent({+ universalIdentifier: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',+ name: 'my-widget',+ description: 'A custom widget component',+ component: MyWidget,+});+```++النقاط الرئيسية:++* Front components are React components that render in isolated contexts within Twenty.+* استخدم لاحقة الملف `*.front-component.tsx` للاكتشاف التلقائي.+* The `component` field references your React component.+* Components are built and synced automatically during `yarn app:dev`.++You can create new front components in two ways:++* **Scaffolded**: Run `yarn entity:add` and choose the option to add a new front component.+* **Manual**: Create a new `*.front-component.tsx` file and use `defineFrontComponent()`.### عميل مُولَّد مضبوط الأنواع@@ -606,12 +614,12 @@ const { me } = await client.query({ me: { id: true, displayName: true } });الملاحظات:* لا تحتاج إلى تمرير عنوان URL أو مفتاح واجهة برمجة التطبيقات إلى العميل المُولَّد. يقوم بقراءة `TWENTY_API_URL` و`TWENTY_API_KEY` من process.env وقت التشغيل.-* تُحدَّد أذونات مفتاح واجهة برمجة التطبيقات بواسطة الدور المشار إليه في `application.config.ts` عبر `roleUniversalIdentifier`. هذا هو الدور الافتراضي الذي تستخدمه الوظائف المنطقية في تطبيقك.-* يمكن للتطبيقات تعريف أدوار لاتباع مبدأ أقل الامتياز. امنح فقط الأذونات التي تحتاجها وظائفك، ثم وجّه `roleUniversalIdentifier` إلى المعرّف الشامل لذلك الدور.+* The API key's permissions are determined by the role referenced in your `application-config.ts` via `defaultRoleUniversalIdentifier`. هذا هو الدور الافتراضي الذي تستخدمه الوظائف المنطقية في تطبيقك.+* يمكن للتطبيقات تعريف أدوار لاتباع مبدأ أقل الامتياز. Grant only the permissions your functions need, then point `defaultRoleUniversalIdentifier` to that role's universal identifier.### مثال Hello World-استكشف مثالًا بسيطًا شاملًا من البداية إلى النهاية يوضح الكائنات والوظائف ومشغلات متعددة [هنا](https://github.com/twentyhq/twenty/tree/main/packages/twenty-apps/hello-world):+Explore a minimal, end-to-end example that demonstrates objects, logic functions, front components, and multiple triggers [here](https://github.com/twentyhq/twenty/tree/main/packages/twenty-apps/hello-world):## إعداد يدوي (بدون المهيئ)diff --git a/packages/twenty-docs/l/cs/developers/extend/capabilities/apps.mdx b/packages/twenty-docs/l/cs/developers/extend/capabilities/apps.mdxindex 35656a84702..66c25497c69 100644--- a/packages/twenty-docs/l/cs/developers/extend/capabilities/apps.mdx+++ b/packages/twenty-docs/l/cs/developers/extend/capabilities/apps.mdx@@ -17,10 +17,6 @@ Aplikace vám umožňují vytvářet a spravovat přizpůsobení Twenty **jako k* Vytvářejte logické funkce s vlastními spouštěči* Nasazujte stejnou aplikaci do více pracovních prostorů-**Již brzy:**--* Vlastní rozvržení a komponenty uživatelského rozhraní-## Předpoklady* Node.js 24+ a Yarn 4@@ -93,84 +89,57 @@ my-twenty-app/eslint.config.mjstsconfig.jsonREADME.md- public/ # Složka s veřejnými prostředky (obrázky, písma apod.)+ public/ # Public assets folder (images, fonts, etc.)src/- application.config.ts # Povinné – hlavní konfigurace aplikace- default-function.role.ts # Výchozí role pro bezserverové funkce- hello-world.function.ts # Ukázková bezserverová funkce- hello-world.front-component.tsx # Ukázková front-endová komponenta- // vaše entity (*.object.ts, *.function.ts, *.front-component.tsx, *.role.ts)+ ├── application-config.ts # Required - main application configuration+ ├── roles/+ │ └── default-role.ts # Default role for logic functions+ ├── logic-functions/+ │ └── hello-world.ts # Example logic function+ └── front-components/+ └── hello-world.tsx # Example front component```-### Konvence před konfigurací--Aplikace používají přístup **konvence před konfigurací**, kde jsou entity detekovány podle přípony souboru. To umožňuje flexibilní organizaci ve složce `src/app/`:+V kostce:-| Přípona souboru | Typ entity |-| ----------------------- | -------------------------------- |-| `*.object.ts` | Definice vlastních objektů |-| `*.function.ts` | Definice serverless funkcí |-| `*.front-component.tsx` | Definice frontendových komponent |-| `*.role.ts` | Definice rolí |+* **package.json**: Declares the app name, version, engines (Node 24+, Yarn 4), and adds `twenty-sdk` plus scripts like `app:dev`, `app:generate`, `entity:add`, `function:logs`, `function:execute`, `app:uninstall`, and authentication commands that delegate to the local `twenty` CLI.+* **.gitignore**: Ignoruje běžné artefakty jako `node_modules`, `.yarn`, `generated/` (typovaný klient), `dist/`, `build/`, složky s coverage, logy a soubory `.env*`.+* **yarn.lock**, **.yarnrc.yml**, **.yarn/**: Zamykají a konfigurují nástrojový řetězec Yarn 4 používaný projektem.+* **.nvmrc**: Fixuje verzi Node.js požadovanou projektem.+* **eslint.config.mjs** a **tsconfig.json**: Poskytují lintování a konfiguraci TypeScriptu pro zdrojové soubory vaší aplikace v TypeScriptu.+* **README.md**: Krátké README v kořeni aplikace se základními pokyny.+* **public/**: Složka pro ukládání veřejných prostředků (obrázky, písma, statické soubory), které bude vaše aplikace poskytovat. Soubory umístěné zde se během synchronizace nahrají a jsou za běhu dostupné.+* **src/**: Hlavní místo, kde definujete svou aplikaci jako kód-### Podporované uspořádání složek+### Entity detection-Entity můžete uspořádat podle některého z těchto vzorů:+The SDK detects entities by parsing your TypeScript files for **`export default define<Entity>({...})`** calls. Each entity type has a corresponding helper function exported from `twenty-sdk`:-**Tradiční (podle typu):**+| Helper function | Typ entity |+| ------------------------ | ------------------------------------- |+| `defineObject()` | Definice vlastních objektů |+| `defineLogicFunction()` | Logic function definitions |+| `defineFrontComponent()` | Definice frontendových komponent |+| `defineRole()` | Definice rolí |+| `defineField()` | Field extensions for existing objects |-```text-src/-├── application.config.ts-├── objects/-│ └── postCard.object.ts-├── functions/-│ └── createPostCard.function.ts-├── components/-│ └── card.front-component.tsx-└── roles/- └── admin.role.ts-```+<Note>+ **File naming is flexible.** Entity detection is AST-based — the SDK scans your source files for the `export default define<Entity>({...})` pattern. You can organize your files and folders however you like. Grouping by entity type (e.g., `logic-functions/`, `roles/`) is just a convention for code organization, not a requirement.+</Note>-**Podle funkcí:**+Example of a detected entity:-```text-src/-├── application.config.ts-└── post-card/- ├── postCard.object.ts- ├── createPostCard.function.ts- ├── card.front-component.tsx- └── postCardAdmin.role.ts-```--**Plochá:**+```typescript+// This file can be named anything and placed anywhere in src/+import { defineObject, FieldType } from 'twenty-sdk';-```text-src/-├── application.config.ts-├── postCard.object.ts-├── createPostCard.function.ts-├── card.front-component.tsx-└── admin.role.ts+export default defineObject({+ universalIdentifier: '...',+ nameSingular: 'postCard',+ // ... rest of config+});```-V kostce:--* **package.json**: Deklaruje název aplikace, verzi, engines (Node 24+, Yarn 4) a přidává `twenty-sdk` plus skripty jako `app:dev`, `app:generate`, `entity:add`, `function:logs`, `function:execute`, `app:uninstall` a `auth:login`, které delegují na lokální `twenty` CLI.-* **.gitignore**: Ignoruje běžné artefakty jako `node_modules`, `.yarn`, `generated/` (typovaný klient), `dist/`, `build/`, složky s coverage, logy a soubory `.env*`.-* **yarn.lock**, **.yarnrc.yml**, **.yarn/**: Zamykají a konfigurují nástrojový řetězec Yarn 4 používaný projektem.-* **.nvmrc**: Fixuje verzi Node.js požadovanou projektem.-* **eslint.config.mjs** a **tsconfig.json**: Poskytují lintování a konfiguraci TypeScriptu pro zdrojové soubory vaší aplikace v TypeScriptu.-* **README.md**: Krátké README v kořeni aplikace se základními pokyny.-* **public/**: Složka pro ukládání veřejných prostředků (obrázky, písma, statické soubory), které bude vaše aplikace poskytovat. Soubory umístěné zde se během synchronizace nahrají a jsou za běhu dostupné.-* **src/**: Hlavní místo, kde definujete svou aplikaci jako kód:- * `application.config.ts`: Globální konfigurace vaší aplikace (metadata a napojení za běhu). Viz „Konfigurace aplikace“ níže.- * `*.role.ts`: Definice rolí používané vašimi logickými funkcemi. Viz „Výchozí role funkce“ níže.- * `*.object.ts`: Definice vlastních objektů.- * `*.function.ts`: Definice logických funkcí.- * `*.front-component.tsx`: Definice frontových komponent.-Pozdější příkazy přidají další soubory a složky:* `yarn app:generate` vytvoří složku `generated/` (typovaný klient Twenty + typy pracovního prostoru).@@ -215,16 +184,18 @@ twenty-sdk poskytuje typované stavební bloky a pomocné funkce, které použí### Pomocné funkce-SDK poskytuje čtyři pomocné funkce s vestavěnou validací pro definování entit vaší aplikace:+The SDK provides helper functions for defining your app entities. As described in [Entity detection](#entity-detection), you must use `export default define<Entity>({...})` for your entities to be detected:-| Funkce | Účel |-| --------------------- | ------------------------------------------------ |-| `defineApplication()` | Konfigurace metadat aplikace |-| `defineObject()` | Definice vlastních objektů s poli |-| `defineFunction()` | Definice logických funkcí s obslužnými funkcemi |-| `defineRole()` | Konfigurace oprávnění rolí a přístupu k objektům |+| Funkce | Účel |+| ------------------------ | ------------------------------------------------------ |+| `defineApplication()` | Configure application metadata (required, one per app) |+| `defineObject()` | Definice vlastních objektů s poli |+| `defineLogicFunction()` | Definice logických funkcí s obslužnými funkcemi |+| `defineFrontComponent()` | Define front components for custom UI |+| `defineRole()` | Konfigurace oprávnění rolí a přístupu k objektům |+| `defineField()` | Extend existing objects with additional fields |-Tyto funkce validují vaši konfiguraci za běhu a poskytují lepší automatické doplňování v IDE a lepší typovou bezpečnost.+These functions validate your configuration at build time and provide IDE autocompletion and type safety.### Definování objektů@@ -311,9 +282,9 @@ Hlavní body:**Základní pole jsou vytvořena automaticky.** Když definujete vlastní objekt, Twenty automaticky přidá standardní pole jako `name`, `createdAt`, `updatedAt`, `createdBy`, `position` a `deletedAt`. Nemusíte je definovat v poli `fields` — přidejte pouze svá vlastní pole.</Note>-### Konfigurace aplikace (application.config.ts)+### Konfigurace aplikace (application-config.ts)-Každá aplikace má jeden soubor `application.config.ts`, který popisuje:+Každá aplikace má jeden soubor `application-config.ts`, který popisuje:* **Identitu aplikace**: identifikátory, zobrazovaný název a popis.* **Jak běží její funkce**: kterou roli používají pro oprávnění.@@ -322,9 +293,9 @@ Každá aplikace má jeden soubor `application.config.ts`, který popisuje:Use `defineApplication()` to define your application configuration:```typescript-// src/app/application.config.ts+// src/application-config.tsimport { defineApplication } from 'twenty-sdk';-import { DEFAULT_ROLE_UNIVERSAL_IDENTIFIER } from './default-function.role';+import { DEFAULT_ROLE_UNIVERSAL_IDENTIFIER } from 'src/roles/default-role';export default defineApplication({universalIdentifier: '4ec0391d-18d5-411c-b2f3-266ddc1c3ef7',@@ -339,7 +310,7 @@ export default defineApplication({isSecret: false,},},- roleUniversalIdentifier: DEFAULT_ROLE_UNIVERSAL_IDENTIFIER,+ defaultRoleUniversalIdentifier: DEFAULT_ROLE_UNIVERSAL_IDENTIFIER,});```@@ -347,11 +318,11 @@ Poznámky:* Pole `universalIdentifier` jsou deterministická ID, která vlastníte; vygenerujte je jednou a udržujte je stabilní napříč synchronizacemi.* `applicationVariables` se stanou proměnnými prostředí pro vaše funkce (například `DEFAULT_RECIPIENT_NAME` je dostupné jako `process.env.DEFAULT_RECIPIENT_NAME`).-* `roleUniversalIdentifier` must match the role you define in your `*.role.ts` file (see below).+* `defaultRoleUniversalIdentifier` must match the role file (see below).#### Role a oprávnění-Aplikace mohou definovat role, které zapouzdřují oprávnění k objektům a akcím ve vašem pracovním prostoru. The field `roleUniversalIdentifier` in `application.config.ts` designates the default role used by your app's logic functions.+Aplikace mohou definovat role, které zapouzdřují oprávnění k objektům a akcím ve vašem pracovním prostoru. The field `defaultRoleUniversalIdentifier` in `application-config.ts` designates the default role used by your app's logic functions.* Běhový klíč API vložený jako `TWENTY_API_KEY` je odvozen z této výchozí role funkcí.* Typovaný klient bude omezen oprávněními udělenými této roli.@@ -362,7 +333,7 @@ Aplikace mohou definovat role, které zapouzdřují oprávnění k objektům a aKdyž vygenerujete novou aplikaci, CLI také vytvoří výchozí soubor role. K definování rolí s vestavěnou validací použijte `defineRole()`:```typescript-// src/app/default-function.role.ts+// src/roles/default-role.tsimport { defineRole, PermissionFlag } from 'twenty-sdk';export const DEFAULT_ROLE_UNIVERSAL_IDENTIFIER =@@ -401,10 +372,10 @@ export default defineRole({});```-Na `universalIdentifier` této role se poté odkazuje v `application.config.ts` jako na `roleUniversalIdentifier`. Jinými slovy:+The `universalIdentifier` of this role is then referenced in `application-config.ts` as `defaultRoleUniversalIdentifier`. Jinými slovy:* **\*.role.ts** definuje, co může výchozí role funkce dělat.-* **application.config.ts** ukazuje na tuto roli, aby vaše funkce zdědily její oprávnění.+* **application-config.ts** points to that role so your functions inherit its permissions.Poznámky:@@ -415,11 +386,11 @@ Poznámky:### Konfigurace logických funkcí a vstupní bod-Každý soubor funkce používá `defineFunction()` k exportu konfigurace s obslužnou funkcí (handlerem) a volitelnými spouštěči. Pro automatickou detekci použijte příponu souboru `*.function.ts`.+Each function file uses `defineLogicFunction()` to export a configuration with a handler and optional triggers.```typescript-// src/app/createPostCard.function.ts-import { defineFunction } from 'twenty-sdk';+// src/app/createPostCard.logic-function.ts+import { defineLogicFunction } from 'twenty-sdk';import type { DatabaseEventPayload, ObjectRecordCreateEvent, CronPayload, RoutePayload } from 'twenty-sdk';import Twenty, { type Person } from '~/generated';@@ -439,7 +410,7 @@ const handler = async (params: RoutePayload) => {return result;};-export default defineFunction({+export default defineLogicFunction({universalIdentifier: 'e56d363b-0bdc-4d8a-a393-6f0d1c75bdcf',name: 'create-new-post-card',timeoutSeconds: 2,@@ -515,7 +486,7 @@ Poznámky:Když spouštěč trasy vyvolá vaši logickou funkci, ta obdrží objekt `RoutePayload`, který odpovídá formátu AWS HTTP API v2. Importujte typ z `twenty-sdk`:```typescript-import { defineFunction, type RoutePayload } from 'twenty-sdk';+import { defineLogicFunction, type RoutePayload } from 'twenty-sdk';const handler = async (event: RoutePayload) => {// Access request data@@ -545,7 +516,7 @@ Typ `RoutePayload` má následující strukturu:Ve výchozím nastavení se záhlaví HTTP z příchozích požadavků z bezpečnostních důvodů do vaší logické funkce **ne** předávají. Chcete-li zpřístupnit konkrétní záhlaví, výslovně je uveďte v poli `forwardedRequestHeaders`:```typescript-export default defineFunction({+export default defineLogicFunction({universalIdentifier: 'e56d363b-0bdc-4d8a-a393-6f0d1c75bdcf',name: 'webhook-handler',handler,@@ -580,8 +551,45 @@ const handler = async (event: RoutePayload) => {Nové funkce můžete vytvářet dvěma způsoby:-* **Vygenerované**: Spusťte `yarn entity:add` a zvolte možnost přidat novou funkci. Tím se vygeneruje startovací soubor s obslužnou funkcí a konfigurací.-* **Ruční**: Vytvořte nový soubor `*.function.ts` a použijte `defineFunction()` podle stejného vzoru.+* **Scaffolded**: Run `yarn entity:add` and choose the option to add a new logic function. Tím se vygeneruje startovací soubor s obslužnou funkcí a konfigurací.+* **Manual**: Create a new `*.logic-function.ts` file and use `defineLogicFunction()`, following the same pattern.++### Front components++Front components let you build custom React components that render within Twenty's UI. Use `defineFrontComponent()` to define components with built-in validation:++```typescript+// src/my-widget.front-component.tsx+import { defineFrontComponent } from 'twenty-sdk';++const MyWidget = () => {+ return (+ <div style={{ padding: '20px', fontFamily: 'sans-serif' }}>+ <h1>My Custom Widget</h1>+ <p>This is a custom front component for Twenty.</p>+ </div>+ );+};++export default defineFrontComponent({+ universalIdentifier: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',+ name: 'my-widget',+ description: 'A custom widget component',+ component: MyWidget,+});+```++Hlavní body:++* Front components are React components that render in isolated contexts within Twenty.+* Pro automatickou detekci použijte příponu souboru `*.front-component.tsx`.+* The `component` field references your React component.+* Components are built and synced automatically during `yarn app:dev`.++You can create new front components in two ways:++* **Scaffolded**: Run `yarn entity:add` and choose the option to add a new front component.+* **Manual**: Create a new `*.front-component.tsx` file and use `defineFrontComponent()`.### Generovaný typovaný klient@@ -606,12 +614,12 @@ Když vaše funkce běží na Twenty, platforma před spuštěním kódu vložíPoznámky:* Není nutné předávat URL ani klíč API vygenerovanému klientovi. Za běhu čte `TWENTY_API_URL` a `TWENTY_API_KEY` z process.env.-* Oprávnění API klíče jsou určena rolí odkazovanou v `application.config.ts` prostřednictvím `roleUniversalIdentifier`. Toto je výchozí role používaná logickými funkcemi vaší aplikace.-* Aplikace mohou definovat role podle principu nejmenších oprávnění. Udělte pouze oprávnění, která vaše funkce potřebují, a poté nastavte `roleUniversalIdentifier` na univerzální identifikátor této role.+* The API key's permissions are determined by the role referenced in your `application-config.ts` via `defaultRoleUniversalIdentifier`. Toto je výchozí role používaná logickými funkcemi vaší aplikace.+* Aplikace mohou definovat role podle principu nejmenších oprávnění. Grant only the permissions your functions need, then point `defaultRoleUniversalIdentifier` to that role's universal identifier.### Příklad Hello World-Prozkoumejte minimalistický end-to-end příklad, který demonstruje objekty, funkce a více spouštěčů [zde](https://github.com/twentyhq/twenty/tree/main/packages/twenty-apps/hello-world):+Explore a minimal, end-to-end example that demonstrates objects, logic functions, front components, and multiple triggers [here](https://github.com/twentyhq/twenty/tree/main/packages/twenty-apps/hello-world):## Ruční nastavení (bez scaffolderu)diff --git a/packages/twenty-docs/l/de/developers/extend/capabilities/apps.mdx b/packages/twenty-docs/l/de/developers/extend/capabilities/apps.mdxindex aff701af317..6e862dd3c11 100644--- a/packages/twenty-docs/l/de/developers/extend/capabilities/apps.mdx+++ b/packages/twenty-docs/l/de/developers/extend/capabilities/apps.mdx@@ -17,10 +17,6 @@ Mit Apps können Sie Twenty-Anpassungen **als Code** erstellen und verwalten. An* Logikfunktionen mit benutzerdefinierten Triggern erstellen* Dieselbe App in mehreren Workspaces bereitstellen-**Bald verfügbar:**--* Benutzerdefinierte UI-Layouts und Komponenten-## Voraussetzungen* Node.js 24+ und Yarn 4@@ -93,84 +89,57 @@ my-twenty-app/eslint.config.mjstsconfig.jsonREADME.md- public/ # Ordner für öffentliche Assets (Bilder, Schriftarten usw.)+ public/ # Public assets folder (images, fonts, etc.)src/- application.config.ts # Erforderlich – Hauptkonfiguration der Anwendung- default-function.role.ts # Standardrolle für serverlose Funktionen- hello-world.function.ts # Beispiel für eine serverlose Funktion- hello-world.front-component.tsx # Beispiel für eine Frontend-Komponente- // Ihre Entitäten (*.object.ts, *.function.ts, *.front-component.tsx, *.role.ts)+ ├── application-config.ts # Required - main application configuration+ ├── roles/+ │ └── default-role.ts # Default role for logic functions+ ├── logic-functions/+ │ └── hello-world.ts # Example logic function+ └── front-components/+ └── hello-world.tsx # Example front component```-### Konvention vor Konfiguration--Anwendungen verwenden einen Ansatz **Konvention vor Konfiguration**, bei dem Entitäten anhand ihrer Dateiendung erkannt werden. Dies ermöglicht eine flexible Organisation im Ordner `src/app/`:+Auf hoher Ebene:-| Dateiendung | Entitätstyp |-| ----------------------- | ------------------------------------- |-| `*.object.ts` | Benutzerdefinierte Objektdefinitionen |-| `*.function.ts` | Definitionen serverloser Funktionen |-| `*.front-component.tsx` | Definitionen von Frontend-Komponenten |-| `*.role.ts` | Rollendefinitionen |+* **package.json**: Declares the app name, version, engines (Node 24+, Yarn 4), and adds `twenty-sdk` plus scripts like `app:dev`, `app:generate`, `entity:add`, `function:logs`, `function:execute`, `app:uninstall`, and authentication commands that delegate to the local `twenty` CLI.+* **.gitignore**: Ignoriert übliche Artefakte wie `node_modules`, `.yarn`, `generated/` (typisierter Client), `dist/`, `build/`, Coverage-Ordner, Logdateien und `.env*`-Dateien.+* **yarn.lock**, **.yarnrc.yml**, **.yarn/**: Fixieren und konfigurieren die vom Projekt verwendete Yarn-4-Toolchain.+* **.nvmrc**: Legt die vom Projekt erwartete Node.js-Version fest.+* **eslint.config.mjs** und **tsconfig.json**: Stellen Linting und TypeScript-Konfiguration für die TypeScript-Quellen Ihrer App bereit.+* **README.md**: Ein kurzes README im App-Root mit grundlegenden Anweisungen.+* **public/**: Ein Ordner zum Speichern öffentlicher Assets (Bilder, Schriftarten, statische Dateien), die zusammen mit Ihrer Anwendung bereitgestellt werden. Hier abgelegte Dateien werden während der Synchronisierung hochgeladen und sind zur Laufzeit zugänglich.+* **src/**: Der Hauptort, an dem Sie Ihre Anwendung als Code definieren-### Unterstützte Ordnerorganisationen+### Entity detection-Sie können Ihre Entitäten nach einem der folgenden Muster organisieren:+The SDK detects entities by parsing your TypeScript files for **`export default define<Entity>({...})`** calls. Each entity type has a corresponding helper function exported from `twenty-sdk`:-**Traditionell (nach Typ):**+| Helper function | Entitätstyp |+| ------------------------ | ------------------------------------- |+| `defineObject()` | Benutzerdefinierte Objektdefinitionen |+| `defineLogicFunction()` | Logic function definitions |+| `defineFrontComponent()` | Definitionen von Frontend-Komponenten |+| `defineRole()` | Rollendefinitionen |+| `defineField()` | Field extensions for existing objects |-```text-src/-├── application.config.ts-├── objects/-│ └── postCard.object.ts-├── functions/-│ └── createPostCard.function.ts-├── components/-│ └── card.front-component.tsx-└── roles/- └── admin.role.ts-```+<Note>+ **File naming is flexible.** Entity detection is AST-based — the SDK scans your source files for the `export default define<Entity>({...})` pattern. You can organize your files and folders however you like. Grouping by entity type (e.g., `logic-functions/`, `roles/`) is just a convention for code organization, not a requirement.+</Note>-**Feature-basiert:**+Example of a detected entity:-```text-src/-├── application.config.ts-└── post-card/- ├── postCard.object.ts- ├── createPostCard.function.ts- ├── card.front-component.tsx- └── postCardAdmin.role.ts-```--**Flach:**+```typescript+// This file can be named anything and placed anywhere in src/+import { defineObject, FieldType } from 'twenty-sdk';-```text-src/-├── application.config.ts-├── postCard.object.ts-├── createPostCard.function.ts-├── card.front-component.tsx-└── admin.role.ts+export default defineObject({+ universalIdentifier: '...',+ nameSingular: 'postCard',+ // ... rest of config+});```-Auf hoher Ebene:--* **package.json**: Deklariert den App-Namen, die Version, Engines (Node 24+, Yarn 4) und fügt `twenty-sdk` sowie Skripte wie `app:dev`, `app:generate`, `entity:add`, `function:logs`, `function:execute`, `app:uninstall` und `auth:login` hinzu, die an die lokale `twenty`-CLI delegieren.-* **.gitignore**: Ignoriert übliche Artefakte wie `node_modules`, `.yarn`, `generated/` (typisierter Client), `dist/`, `build/`, Coverage-Ordner, Logdateien und `.env*`-Dateien.-* **yarn.lock**, **.yarnrc.yml**, **.yarn/**: Fixieren und konfigurieren die vom Projekt verwendete Yarn-4-Toolchain.-* **.nvmrc**: Legt die vom Projekt erwartete Node.js-Version fest.-* **eslint.config.mjs** und **tsconfig.json**: Stellen Linting und TypeScript-Konfiguration für die TypeScript-Quellen Ihrer App bereit.-* **README.md**: Ein kurzes README im App-Root mit grundlegenden Anweisungen.-* **public/**: Ein Ordner zum Speichern öffentlicher Assets (Bilder, Schriftarten, statische Dateien), die zusammen mit Ihrer Anwendung bereitgestellt werden. Hier abgelegte Dateien werden während der Synchronisierung hochgeladen und sind zur Laufzeit zugänglich.-* **src/**: Der Hauptort, an dem Sie Ihre Anwendung als Code definieren:- * `application.config.ts`: Globale Konfiguration für Ihre App (Metadaten und Laufzeit-Anbindung). Siehe unten „Anwendungskonfiguration“.- * `*.role.ts`: Rollendefinitionen, die von Ihren Logikfunktionen verwendet werden. Siehe unten „Standard-Funktionsrolle“.- * `*.object.ts`: Benutzerdefinierte Objektdefinitionen.- * `*.function.ts`: Definitionen von Logikfunktionen.- * `*.front-component.tsx`: Front-Komponenten-Definitionen.-Spätere Befehle fügen weitere Dateien und Ordner hinzu:* `yarn app:generate` erstellt einen `generated/`-Ordner (typisierter Twenty-Client + Workspace-Typen).@@ -215,16 +184,18 @@ Das twenty-sdk stellt typisierte Bausteine und Hilfsfunktionen bereit, die Sie i### Hilfsfunktionen-Das SDK stellt vier Hilfsfunktionen mit eingebauter Validierung bereit, um Ihre App-Entitäten zu definieren:+The SDK provides helper functions for defining your app entities. As described in [Entity detection](#entity-detection), you must use `export default define<Entity>({...})` for your entities to be detected:-| Funktion | Zweck |-| --------------------- | ---------------------------------------------------- |-| `defineApplication()` | Anwendungsmetadaten konfigurieren |-| `defineObject()` | Benutzerdefinierte Objekte mit Feldern definieren |-| `defineFunction()` | Logikfunktionen mit Handlern definieren |-| `defineRole()` | Rollenberechtigungen und Objektzugriff konfigurieren |+| Funktion | Zweck |+| ------------------------ | ------------------------------------------------------ |+| `defineApplication()` | Configure application metadata (required, one per app) |+| `defineObject()` | Benutzerdefinierte Objekte mit Feldern definieren |+| `defineLogicFunction()` | Logikfunktionen mit Handlern definieren |+| `defineFrontComponent()` | Define front components for custom UI |+| `defineRole()` | Rollenberechtigungen und Objektzugriff konfigurieren |+| `defineField()` | Extend existing objects with additional fields |-Diese Funktionen validieren Ihre Konfiguration zur Laufzeit und bieten bessere IDE-Autovervollständigung sowie Typsicherheit.+These functions validate your configuration at build time and provide IDE autocompletion and type safety.### Objekte definieren@@ -311,9 +282,9 @@ Hauptpunkte:**Basisfelder werden automatisch erstellt.** Wenn Sie ein benutzerdefiniertes Objekt definieren, fügt Twenty automatisch Standardfelder wie `name`, `createdAt`, `updatedAt`, `createdBy`, `position` und `deletedAt` hinzu. Sie müssen diese nicht in Ihrem `fields`-Array definieren — fügen Sie nur Ihre benutzerdefinierten Felder hinzu.</Note>-### Anwendungskonfiguration (application.config.ts)+### Anwendungskonfiguration (application-config.ts)-Jede App hat eine einzelne Datei `application.config.ts`, die Folgendes beschreibt:+Jede App hat eine einzelne Datei `application-config.ts`, die Folgendes beschreibt:* **Was die App ist**: Bezeichner, Anzeigename und Beschreibung.* **Wie ihre Funktionen ausgeführt werden**: welche Rolle sie für Berechtigungen verwenden.@@ -322,9 +293,9 @@ Jede App hat eine einzelne Datei `application.config.ts`, die Folgendes beschreiVerwenden Sie `defineApplication()`, um Ihre Anwendungskonfiguration zu definieren:```typescript-// src/app/application.config.ts+// src/application-config.tsimport { defineApplication } from 'twenty-sdk';-import { DEFAULT_ROLE_UNIVERSAL_IDENTIFIER } from './default-function.role';+import { DEFAULT_ROLE_UNIVERSAL_IDENTIFIER } from 'src/roles/default-role';export default defineApplication({universalIdentifier: '4ec0391d-18d5-411c-b2f3-266ddc1c3ef7',@@ -339,7 +310,7 @@ export default defineApplication({isSecret: false,},},- roleUniversalIdentifier: DEFAULT_ROLE_UNIVERSAL_IDENTIFIER,+ defaultRoleUniversalIdentifier: DEFAULT_ROLE_UNIVERSAL_IDENTIFIER,});```@@ -347,11 +318,11 @@ Notizen:* `universalIdentifier`-Felder sind deterministische IDs, die Sie besitzen; generieren Sie sie einmal und halten Sie sie über Synchronisierungen hinweg stabil.* `applicationVariables` werden zu Umgebungsvariablen für Ihre Funktionen (zum Beispiel ist `DEFAULT_RECIPIENT_NAME` als `process.env.DEFAULT_RECIPIENT_NAME` verfügbar).-* `roleUniversalIdentifier` muss mit der Rolle übereinstimmen, die Sie in Ihrer `*.role.ts`-Datei definieren (siehe unten).+* `defaultRoleUniversalIdentifier` must match the role file (see below).#### Rollen und Berechtigungen-Anwendungen können Rollen definieren, die Berechtigungen für die Objekte und Aktionen Ihres Workspaces kapseln. Das Feld `roleUniversalIdentifier` in `application.config.ts` legt die Standardrolle fest, die von den Logikfunktionen Ihrer App verwendet wird.+Anwendungen können Rollen definieren, die Berechtigungen für die Objekte und Aktionen Ihres Workspaces kapseln. The field `defaultRoleUniversalIdentifier` in `application-config.ts` designates the default role used by your app's logic functions.* Der zur Laufzeit als `TWENTY_API_KEY` injizierte API-Schlüssel wird von dieser Standard-Funktionsrolle abgeleitet.* Der typisierte Client ist auf die dieser Rolle gewährten Berechtigungen beschränkt.@@ -362,7 +333,7 @@ Anwendungen können Rollen definieren, die Berechtigungen für die Objekte und AWenn Sie eine neue App erzeugen, erstellt die CLI auch eine Standard-Rolldatei. Verwenden Sie `defineRole()`, um Rollen mit eingebauter Validierung zu definieren:```typescript-// src/app/default-function.role.ts+// src/roles/default-role.tsimport { defineRole, PermissionFlag } from 'twenty-sdk';export const DEFAULT_ROLE_UNIVERSAL_IDENTIFIER =@@ -401,10 +372,10 @@ export default defineRole({});```-Der `universalIdentifier` dieser Rolle wird anschließend in `application.config.ts` als `roleUniversalIdentifier` referenziert. Anders ausgedrückt:+The `universalIdentifier` of this role is then referenced in `application-config.ts` as `defaultRoleUniversalIdentifier`. Anders ausgedrückt:* **\*.role.ts** definiert, was die Standard-Funktionsrolle darf.-* **application.config.ts** verweist auf diese Rolle, sodass Ihre Funktionen deren Berechtigungen erben.+* **application-config.ts** points to that role so your functions inherit its permissions.Notizen:@@ -415,11 +386,11 @@ Notizen:### Konfiguration von Logikfunktionen und Einstiegspunkt-Jede Funktionsdatei verwendet `defineFunction()`, um eine Konfiguration mit einem Handler und optionalen Triggern zu exportieren. Verwenden Sie die Dateiendung `*.function.ts` für die automatische Erkennung.+Each function file uses `defineLogicFunction()` to export a configuration with a handler and optional triggers.```typescript-// src/app/createPostCard.function.ts-import { defineFunction } from 'twenty-sdk';+// src/app/createPostCard.logic-function.ts+import { defineLogicFunction } from 'twenty-sdk';import type { DatabaseEventPayload, ObjectRecordCreateEvent, CronPayload, RoutePayload } from 'twenty-sdk';import Twenty, { type Person } from '~/generated';@@ -439,7 +410,7 @@ const handler = async (params: RoutePayload) => {return result;};-export default defineFunction({+export default defineLogicFunction({universalIdentifier: 'e56d363b-0bdc-4d8a-a393-6f0d1c75bdcf',name: 'create-new-post-card',timeoutSeconds: 2,@@ -515,7 +486,7 @@ Notizen:Wenn ein Routen-Trigger Ihre Logikfunktion aufruft, erhält sie ein `RoutePayload`-Objekt, das dem AWS HTTP API v2-Format entspricht. Importieren Sie den Typ aus `twenty-sdk`:```typescript-import { defineFunction, type RoutePayload } from 'twenty-sdk';+import { defineLogicFunction, type RoutePayload } from 'twenty-sdk';const handler = async (event: RoutePayload) => {// Access request data@@ -545,7 +516,7 @@ Der Typ `RoutePayload` hat die folgende Struktur:Standardmäßig werden HTTP-Header von eingehenden Anfragen aus Sicherheitsgründen nicht an Ihre Logikfunktion weitergegeben. Um auf bestimmte Header zuzugreifen, listen Sie diese explizit im Array `forwardedRequestHeaders` auf:```typescript-export default defineFunction({+export default defineLogicFunction({universalIdentifier: 'e56d363b-0bdc-4d8a-a393-6f0d1c75bdcf',name: 'webhook-handler',handler,@@ -580,8 +551,45 @@ const handler = async (event: RoutePayload) => {Sie können neue Funktionen auf zwei Arten erstellen:-* **Generiert**: Führen Sie `yarn entity:add` aus und wählen Sie die Option zum Hinzufügen einer neuen Funktion. Dadurch wird eine Starterdatei mit Handler und Konfiguration erzeugt.-* **Manuell**: Erstellen Sie eine neue `*.function.ts`-Datei und verwenden Sie `defineFunction()` nach demselben Muster.+* **Scaffolded**: Run `yarn entity:add` and choose the option to add a new logic function. Dadurch wird eine Starterdatei mit Handler und Konfiguration erzeugt.+* **Manual**: Create a new `*.logic-function.ts` file and use `defineLogicFunction()`, following the same pattern.++### Front components++Front components let you build custom React components that render within Twenty's UI. Use `defineFrontComponent()` to define components with built-in validation:++```typescript+// src/my-widget.front-component.tsx+import { defineFrontComponent } from 'twenty-sdk';++const MyWidget = () => {+ return (+ <div style={{ padding: '20px', fontFamily: 'sans-serif' }}>+ <h1>My Custom Widget</h1>+ <p>This is a custom front component for Twenty.</p>+ </div>+ );+};++export default defineFrontComponent({+ universalIdentifier: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',+ name: 'my-widget',+ description: 'A custom widget component',+ component: MyWidget,+});+```++Hauptpunkte:++* Front components are React components that render in isolated contexts within Twenty.+* Verwenden Sie die Dateiendung `*.front-component.tsx` für die automatische Erkennung.+* The `component` field references your React component.+* Components are built and synced automatically during `yarn app:dev`.++You can create new front components in two ways:++* **Scaffolded**: Run `yarn entity:add` and choose the option to add a new front component.+* **Manual**: Create a new `*.front-component.tsx` file and use `defineFrontComponent()`.### Generierter typisierter Client@@ -606,12 +614,12 @@ Wenn Ihre Funktion auf Twenty läuft, injiziert die Plattform vor der AusführunNotizen:* Sie müssen dem generierten Client weder URL noch API-Schlüssel übergeben. Er liest `TWENTY_API_URL` und `TWENTY_API_KEY` zur Laufzeit aus process.env.-* Die Berechtigungen des API-Schlüssels werden durch die Rolle bestimmt, auf die in Ihrer `application.config.ts` über `roleUniversalIdentifier` verwiesen wird. Dies ist die Standardrolle, die von den Logikfunktionen Ihrer Anwendung verwendet wird.-* Anwendungen können Rollen definieren, um das Least-Privilege-Prinzip einzuhalten. Gewähren Sie nur die Berechtigungen, die Ihre Funktionen benötigen, und verweisen Sie dann mit `roleUniversalIdentifier` auf den universellen Bezeichner dieser Rolle.+* The API key's permissions are determined by the role referenced in your `application-config.ts` via `defaultRoleUniversalIdentifier`. Dies ist die Standardrolle, die von den Logikfunktionen Ihrer Anwendung verwendet wird.+* Anwendungen können Rollen definieren, um das Least-Privilege-Prinzip einzuhalten. Grant only the permissions your functions need, then point `defaultRoleUniversalIdentifier` to that role's universal identifier.### Hello-World-Beispiel-Ein minimales End-to-End-Beispiel, das Objekte, Funktionen und mehrere Trigger demonstriert, finden Sie [hier](https://github.com/twentyhq/twenty/tree/main/packages/twenty-apps/hello-world):+Explore a minimal, end-to-end example that demonstrates objects, logic functions, front components, and multiple triggers [here](https://github.com/twentyhq/twenty/tree/main/packages/twenty-apps/hello-world):## Manuelle Einrichtung (ohne Scaffolder)diff --git a/packages/twenty-docs/l/it/developers/extend/capabilities/apps.mdx b/packages/twenty-docs/l/it/developers/extend/capabilities/apps.mdxindex 27f0b386f54..4de757e8bc8 100644--- a/packages/twenty-docs/l/it/developers/extend/capabilities/apps.mdx+++ b/packages/twenty-docs/l/it/developers/extend/capabilities/apps.mdx@@ -17,10 +17,6 @@ Le app ti consentono di creare e gestire le personalizzazioni di Twenty **come c* Crea funzioni logiche con trigger personalizzati* Distribuisci la stessa app su più spazi di lavoro-**In arrivo:**--* Layout e componenti UI personalizzati-## Prerequisiti* Node.js 24+ e Yarn 4@@ -93,84 +89,57 @@ my-twenty-app/eslint.config.mjstsconfig.jsonREADME.md- public/ # Cartella delle risorse pubbliche (immagini, font, ecc.)+ public/ # Public assets folder (images, fonts, etc.)src/- application.config.ts # Obbligatorio - configurazione principale dell'applicazione- default-function.role.ts # Ruolo predefinito per le funzioni serverless- hello-world.function.ts # Funzione serverless di esempio- hello-world.front-component.tsx # Componente front-end di esempio- // le tue entità (*.object.ts, *.function.ts, *.front-component.tsx, *.role.ts)+ ├── application-config.ts # Required - main application configuration+ ├── roles/+ │ └── default-role.ts # Default role for logic functions+ ├── logic-functions/+ │ └── hello-world.ts # Example logic function+ └── front-components/+ └── hello-world.tsx # Example front component```-### Convenzioni invece della configurazione--Le applicazioni usano un approccio basato sulle **convenzioni invece della configurazione** in cui le entità vengono rilevate in base al suffisso del file. Questo consente un'organizzazione flessibile all'interno della cartella `src/app/`:+A livello generale:-| Suffisso del file | Tipo di entità |-| ----------------------- | ------------------------------------- |-| `*.object.ts` | Definizioni di oggetti personalizzati |-| `*.function.ts` | Definizioni di funzioni serverless |-| `*.front-component.tsx` | Definizioni dei componenti front-end |-| `*.role.ts` | Definizioni di ruoli |+* **package.json**: Declares the app name, version, engines (Node 24+, Yarn 4), and adds `twenty-sdk` plus scripts like `app:dev`, `app:generate`, `entity:add`, `function:logs`, `function:execute`, `app:uninstall`, and authentication commands that delegate to the local `twenty` CLI.+* **.gitignore**: Ignora i file generati comuni come `node_modules`, `.yarn`, `generated/` (client tipizzato), `dist/`, `build/`, cartelle di coverage, file di log e file `.env*`.+* **yarn.lock**, **.yarnrc.yml**, **.yarn/**: Bloccano e configurano la toolchain Yarn 4 utilizzata dal progetto.+* **.nvmrc**: Fissa la versione di Node.js prevista dal progetto.+* **eslint.config.mjs** e **tsconfig.json**: Forniscono linting e configurazione TypeScript per i sorgenti TypeScript della tua app.+* **README.md**: Un breve README nella radice dell'app con istruzioni di base.+* **public/**: Una cartella per archiviare risorse pubbliche (immagini, font, file statici) che saranno servite con la tua applicazione. I file collocati qui vengono caricati durante la sincronizzazione e sono accessibili in fase di esecuzione.+* **src/**: Il luogo principale in cui definisci la tua applicazione come codice-### Organizzazioni di cartelle supportate+### Entity detection-Puoi organizzare le tue entità in uno qualsiasi di questi modelli:+The SDK detects entities by parsing your TypeScript files for **`export default define<Entity>({...})`** calls. Each entity type has a corresponding helper function exported from `twenty-sdk`:-**Tradizionale (per tipo):**+| Helper function | Tipo di entità |+| ------------------------ | ------------------------------------- |+| `defineObject()` | Definizioni di oggetti personalizzati |+| `defineLogicFunction()` | Logic function definitions |+| `defineFrontComponent()` | Definizioni dei componenti front-end |+| `defineRole()` | Definizioni di ruoli |+| `defineField()` | Field extensions for existing objects |-```text-src/-├── application.config.ts-├── objects/-│ └── postCard.object.ts-├── functions/-│ └── createPostCard.function.ts-├── components/-│ └── card.front-component.tsx-└── roles/- └── admin.role.ts-```+<Note>+ **File naming is flexible.** Entity detection is AST-based — the SDK scans your source files for the `export default define<Entity>({...})` pattern. You can organize your files and folders however you like. Grouping by entity type (e.g., `logic-functions/`, `roles/`) is just a convention for code organization, not a requirement.+</Note>-**Per funzionalità:**+Example of a detected entity:-```text-src/-├── application.config.ts-└── post-card/- ├── postCard.object.ts- ├── createPostCard.function.ts- ├── card.front-component.tsx- └── postCardAdmin.role.ts-```--**Struttura piatta:**+```typescript+// This file can be named anything and placed anywhere in src/+import { defineObject, FieldType } from 'twenty-sdk';-```text-src/-├── application.config.ts-├── postCard.object.ts-├── createPostCard.function.ts-├── card.front-component.tsx-└── admin.role.ts+export default defineObject({+ universalIdentifier: '...',+ nameSingular: 'postCard',+ // ... rest of config+});```-A livello generale:--* **package.json**: Dichiara il nome dell'app, la versione, i motori (Node 24+, Yarn 4) e aggiunge `twenty-sdk`, oltre a script come `app:dev`, `app:generate`, `entity:add`, `function:logs`, `function:execute`, `app:uninstall` e `auth:login` che delegano alla CLI locale `twenty`.-* **.gitignore**: Ignora i file generati comuni come `node_modules`, `.yarn`, `generated/` (client tipizzato), `dist/`, `build/`, cartelle di coverage, file di log e file `.env*`.-* **yarn.lock**, **.yarnrc.yml**, **.yarn/**: Bloccano e configurano la toolchain Yarn 4 utilizzata dal progetto.-* **.nvmrc**: Fissa la versione di Node.js prevista dal progetto.-* **eslint.config.mjs** e **tsconfig.json**: Forniscono linting e configurazione TypeScript per i sorgenti TypeScript della tua app.-* **README.md**: Un breve README nella radice dell'app con istruzioni di base.-* **public/**: Una cartella per archiviare risorse pubbliche (immagini, font, file statici) che saranno servite con la tua applicazione. I file collocati qui vengono caricati durante la sincronizzazione e sono accessibili in fase di esecuzione.-* **src/**: Il luogo principale in cui definisci la tua applicazione come codice:- * `application.config.ts`: Configurazione globale della tua app (metadati e collegamenti di runtime). Vedi "Configurazione dell'applicazione" qui sotto.- * `*.role.ts`: Definizioni di ruoli usate dalle tue funzioni logiche. Vedi "Ruolo funzione predefinito" qui sotto.- * `*.object.ts`: Definizioni di oggetti personalizzati.- * `*.function.ts`: Definizioni di funzioni logiche.- * `*.front-component.tsx`: Definizioni di componenti front-end.-Comandi successivi aggiungeranno altri file e cartelle:* `yarn app:generate` creerà una cartella `generated/` (client Twenty tipizzato + tipi dello spazio di lavoro).@@ -215,16 +184,18 @@ Il pacchetto twenty-sdk fornisce blocchi tipizzati e funzioni helper da usare ne### Funzioni helper-L'SDK fornisce quattro funzioni helper con convalida integrata per definire le entità della tua app:+The SDK provides helper functions for defining your app entities. As described in [Entity detection](#entity-detection), you must use `export default define<Entity>({...})` for your entities to be detected:-| Funzione | Scopo |-| --------------------- | ------------------------------------------------------- |-| `defineApplication()` | Configura i metadati dell'applicazione |-| `defineObject()` | Definisci oggetti personalizzati con campi |-| `defineFunction()` | Definisci funzioni logiche con handler |-| `defineRole()` | Configura i permessi dei ruoli e l'accesso agli oggetti |+| Funzione | Scopo |+| ------------------------ | ------------------------------------------------------- |+| `defineApplication()` | Configure application metadata (required, one per app) |+| `defineObject()` | Definisci oggetti personalizzati con campi |+| `defineLogicFunction()` | Definisci funzioni logiche con handler |+| `defineFrontComponent()` | Define front components for custom UI |+| `defineRole()` | Configura i permessi dei ruoli e l'accesso agli oggetti |+| `defineField()` | Extend existing objects with additional fields |-Queste funzioni convalidano la configurazione a runtime e offrono un migliore completamento automatico nell'IDE e una maggiore sicurezza dei tipi.+These functions validate your configuration at build time and provide IDE autocompletion and type safety.### Definizione degli oggetti@@ -311,9 +282,9 @@ Punti chiave:**I campi base vengono creati automaticamente.** Quando definisci un oggetto personalizzato, Twenty aggiunge automaticamente i campi standard come `name`, `createdAt`, `updatedAt`, `createdBy`, `position` e `deletedAt`. Non è necessario definirli nel tuo array `fields` — aggiungi solo i tuoi campi personalizzati.</Note>-### Configurazione dell'applicazione (application.config.ts)+### Configurazione dell'applicazione (application-config.ts)-Ogni app ha un singolo file `application.config.ts` che descrive:+Ogni app ha un singolo file `application-config.ts` che descrive:* **Identità dell'app**: identificatori, nome visualizzato e descrizione.* **Come vengono eseguite le sue funzioni**: quale ruolo usano per i permessi.@@ -322,9 +293,9 @@ Ogni app ha un singolo file `application.config.ts` che descrive:Usa `defineApplication()` per definire la configurazione della tua applicazione:```typescript-// src/app/application.config.ts+// src/application-config.tsimport { defineApplication } from 'twenty-sdk';-import { DEFAULT_ROLE_UNIVERSAL_IDENTIFIER } from './default-function.role';+import { DEFAULT_ROLE_UNIVERSAL_IDENTIFIER } from 'src/roles/default-role';export default defineApplication({universalIdentifier: '4ec0391d-18d5-411c-b2f3-266ddc1c3ef7',@@ -339,7 +310,7 @@ export default defineApplication({isSecret: false,},},- roleUniversalIdentifier: DEFAULT_ROLE_UNIVERSAL_IDENTIFIER,+ defaultRoleUniversalIdentifier: DEFAULT_ROLE_UNIVERSAL_IDENTIFIER,});```@@ -347,11 +318,11 @@ Note:* I campi `universalIdentifier` sono ID deterministici sotto il tuo controllo; generali una volta e mantienili stabili tra le sincronizzazioni.* `applicationVariables` diventano variabili d'ambiente per le tue funzioni (ad esempio, `DEFAULT_RECIPIENT_NAME` è disponibile come `process.env.DEFAULT_RECIPIENT_NAME`).-* `roleUniversalIdentifier` deve corrispondere al ruolo che definisci nel tuo file `*.role.ts` (vedi sotto).+* `defaultRoleUniversalIdentifier` must match the role file (see below).#### Ruoli e permessi-Le applicazioni possono definire ruoli che incapsulano i permessi sugli oggetti e sulle azioni del tuo spazio di lavoro. Il campo `roleUniversalIdentifier` in `application.config.ts` designa il ruolo predefinito utilizzato dalle funzioni logiche della tua app.+Le applicazioni possono definire ruoli che incapsulano i permessi sugli oggetti e sulle azioni del tuo spazio di lavoro. The field `defaultRoleUniversalIdentifier` in `application-config.ts` designates the default role used by your app's logic functions.* La chiave API di runtime iniettata come `TWENTY_API_KEY` è derivata da questo ruolo funzione predefinito.* Il client tipizzato sarà limitato ai permessi concessi a quel ruolo.@@ -362,7 +333,7 @@ Le applicazioni possono definire ruoli che incapsulano i permessi sugli oggettiQuando generi una nuova app con lo scaffolder, la CLI crea anche un file di ruolo predefinito. Usa `defineRole()` per definire ruoli con convalida integrata:```typescript-// src/app/default-function.role.ts+// src/roles/default-role.tsimport { defineRole, PermissionFlag } from 'twenty-sdk';export const DEFAULT_ROLE_UNIVERSAL_IDENTIFIER =@@ -401,10 +372,10 @@ export default defineRole({});```-L'`universalIdentifier` di questo ruolo viene quindi referenziato in `application.config.ts` come `roleUniversalIdentifier`. In altre parole:+The `universalIdentifier` of this role is then referenced in `application-config.ts` as `defaultRoleUniversalIdentifier`. In altre parole:* **\*.role.ts** definisce ciò che il ruolo funzione predefinito può fare.-* **application.config.ts** punta a quel ruolo in modo che le tue funzioni ne ereditino i permessi.+* **application-config.ts** points to that role so your functions inherit its permissions.Note:@@ -415,11 +386,11 @@ Note:### Configurazione e punto di ingresso della funzione logica-Ogni file di funzione usa `defineFunction()` per esportare una configurazione con un handler e trigger opzionali. Usa il suffisso di file `*.function.ts` per il rilevamento automatico.+Each function file uses `defineLogicFunction()` to export a configuration with a handler and optional triggers.```typescript-// src/app/createPostCard.function.ts-import { defineFunction } from 'twenty-sdk';+// src/app/createPostCard.logic-function.ts+import { defineLogicFunction } from 'twenty-sdk';import type { DatabaseEventPayload, ObjectRecordCreateEvent, CronPayload, RoutePayload } from 'twenty-sdk';import Twenty, { type Person } from '~/generated';@@ -439,7 +410,7 @@ const handler = async (params: RoutePayload) => {return result;};-export default defineFunction({+export default defineLogicFunction({universalIdentifier: 'e56d363b-0bdc-4d8a-a393-6f0d1c75bdcf',name: 'create-new-post-card',timeoutSeconds: 2,@@ -515,7 +486,7 @@ Note:Quando un trigger di route invoca la tua funzione logica, questa riceve un oggetto `RoutePayload` che segue il formato AWS HTTP API v2. Importa il tipo da `twenty-sdk`:```typescript-import { defineFunction, type RoutePayload } from 'twenty-sdk';+import { defineLogicFunction, type RoutePayload } from 'twenty-sdk';const handler = async (event: RoutePayload) => {// Access request data@@ -545,7 +516,7 @@ Il tipo `RoutePayload` ha la seguente struttura:Per impostazione predefinita, le intestazioni HTTP delle richieste in ingresso **non** vengono passate alla tua funzione logica per motivi di sicurezza. Per accedere a intestazioni specifiche, elencale esplicitamente nell'array `forwardedRequestHeaders`:```typescript-export default defineFunction({+export default defineLogicFunction({universalIdentifier: 'e56d363b-0bdc-4d8a-a393-6f0d1c75bdcf',name: 'webhook-handler',handler,@@ -580,8 +551,45 @@ const handler = async (event: RoutePayload) => {Puoi creare nuove funzioni in due modi:-* **Generata dallo scaffolder**: Esegui `yarn entity:add` e scegli l'opzione per aggiungere una nuova funzione. Questo genera un file iniziale con un handler e una configurazione.-* **Manuale**: Crea un nuovo file `*.function.ts` e usa `defineFunction()`, seguendo lo stesso schema.+* **Scaffolded**: Run `yarn entity:add` and choose the option to add a new logic function. Questo genera un file iniziale con un handler e una configurazione.+* **Manual**: Create a new `*.logic-function.ts` file and use `defineLogicFunction()`, following the same pattern.++### Front components++Front components let you build custom React components that render within Twenty's UI. Use `defineFrontComponent()` to define components with built-in validation:++```typescript+// src/my-widget.front-component.tsx+import { defineFrontComponent } from 'twenty-sdk';++const MyWidget = () => {+ return (+ <div style={{ padding: '20px', fontFamily: 'sans-serif' }}>+ <h1>My Custom Widget</h1>+ <p>This is a custom front component for Twenty.</p>+ </div>+ );+};++export default defineFrontComponent({+ universalIdentifier: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',+ name: 'my-widget',+ description: 'A custom widget component',+ component: MyWidget,+});+```++Punti chiave:++* Front components are React components that render in isolated contexts within Twenty.+* Usa il suffisso di file `*.front-component.tsx` per il rilevamento automatico.+* The `component` field references your React component.+* Components are built and synced automatically during `yarn app:dev`.++You can create new front components in two ways:++* **Scaffolded**: Run `yarn entity:add` and choose the option to add a new front component.+* **Manual**: Create a new `*.front-component.tsx` file and use `defineFrontComponent()`.### Client tipizzato generato@@ -606,12 +614,12 @@ Quando la tua funzione viene eseguita su Twenty, la piattaforma inietta le credeNote:* Non è necessario passare URL o chiave API al client generato. Legge `TWENTY_API_URL` e `TWENTY_API_KEY` da process.env in fase di esecuzione.-* I permessi della chiave API sono determinati dal ruolo referenziato in `application.config.ts` tramite `roleUniversalIdentifier`. Questo è il ruolo predefinito utilizzato dalle funzioni logiche della tua applicazione.-* Le applicazioni possono definire ruoli per seguire il principio del privilegio minimo. Concedi solo i permessi necessari alle tue funzioni, quindi punta `roleUniversalIdentifier` all'identificatore universale di quel ruolo.+* The API key's permissions are determined by the role referenced in your `application-config.ts` via `defaultRoleUniversalIdentifier`. Questo è il ruolo predefinito utilizzato dalle funzioni logiche della tua applicazione.+* Le applicazioni possono definire ruoli per seguire il principio del privilegio minimo. Grant only the permissions your functions need, then point `defaultRoleUniversalIdentifier` to that role's universal identifier.### Esempio Hello World-Esplora un esempio minimale end‑to‑end che dimostra oggetti, funzioni e trigger multipli [qui](https://github.com/twentyhq/twenty/tree/main/packages/twenty-apps/hello-world):+Explore a minimal, end-to-end example that demonstrates objects, logic functions, front components, and multiple triggers [here](https://github.com/twentyhq/twenty/tree/main/packages/twenty-apps/hello-world):## Configurazione manuale (senza lo scaffolder)diff --git a/packages/twenty-docs/l/pt/developers/extend/capabilities/apps.mdx b/packages/twenty-docs/l/pt/developers/extend/capabilities/apps.mdxindex 957d65db630..d98a3edcbd3 100644--- a/packages/twenty-docs/l/pt/developers/extend/capabilities/apps.mdx+++ b/packages/twenty-docs/l/pt/developers/extend/capabilities/apps.mdx@@ -17,10 +17,6 @@ Os aplicativos permitem criar e gerenciar personalizações do Twenty **como có* Crie funções de lógica com gatilhos personalizados* Implemente o mesmo aplicativo em vários espaços de trabalho-**Em breve:**--* Layouts e componentes de UI personalizados-## Pré-requisitos* Node.js 24+ e Yarn 4@@ -93,84 +89,57 @@ my-twenty-app/eslint.config.mjstsconfig.jsonREADME.md- public/ # Pasta de recursos públicos (imagens, fontes, etc.)+ public/ # Public assets folder (images, fonts, etc.)src/- application.config.ts # Obrigatório - configuração principal da aplicação- default-function.role.ts # Papel padrão para funções serverless- hello-world.function.ts # Exemplo de função serverless- hello-world.front-component.tsx # Exemplo de componente de front-end- // suas entidades (*.object.ts, *.function.ts, *.front-component.tsx, *.role.ts)+ ├── application-config.ts # Required - main application configuration+ ├── roles/+ │ └── default-role.ts # Default role for logic functions+ ├── logic-functions/+ │ └── hello-world.ts # Example logic function+ └── front-components/+ └── hello-world.tsx # Example front component```-### Convenção sobre configuração--Os aplicativos usam uma abordagem de **convenção sobre configuração** em que as entidades são detectadas pelo sufixo do arquivo. Isso permite organização flexível dentro da pasta `src/app/`:+Em alto nível:-| Sufixo de arquivo | Tipo de entidade |-| ----------------------- | -------------------------------------- |-| `*.object.ts` | Definições de objetos personalizados |-| `*.function.ts` | Definições de funções serverless |-| `*.front-component.tsx` | Definições de componentes de front-end |-| `*.role.ts` | Definições de papéis |+* **package.json**: Declares the app name, version, engines (Node 24+, Yarn 4), and adds `twenty-sdk` plus scripts like `app:dev`, `app:generate`, `entity:add`, `function:logs`, `function:execute`, `app:uninstall`, and authentication commands that delegate to the local `twenty` CLI.+* **.gitignore**: Ignora artefatos comuns como `node_modules`, `.yarn`, `generated/` (cliente tipado), `dist/`, `build/`, pastas de cobertura, arquivos de log e arquivos `.env*`.+* **yarn.lock**, **.yarnrc.yml**, **.yarn/**: Bloqueiam e configuram a ferramenta Yarn 4 usada pelo projeto.+* **.nvmrc**: Fixa a versão do Node.js esperada pelo projeto.+* **eslint.config.mjs** e **tsconfig.json**: Fornecem lint e configuração do TypeScript para os fontes TypeScript do seu aplicativo.+* **README.md**: Um README curto na raiz do aplicativo com instruções básicas.+* **public/**: Uma pasta para armazenar recursos públicos (imagens, fontes, arquivos estáticos) que serão servidos com sua aplicação. Os arquivos colocados aqui são enviados durante a sincronização e ficam acessíveis em tempo de execução.+* **src/**: O local principal onde você define seu aplicativo como código-### Organizações de pastas suportadas+### Entity detection-Você pode organizar suas entidades em qualquer um destes padrões:+The SDK detects entities by parsing your TypeScript files for **`export default define<Entity>({...})`** calls. Each entity type has a corresponding helper function exported from `twenty-sdk`:-**Tradicional (por tipo):**+| Helper function | Tipo de entidade |+| ------------------------ | -------------------------------------- |+| `defineObject()` | Definições de objetos personalizados |+| `defineLogicFunction()` | Logic function definitions |+| `defineFrontComponent()` | Definições de componentes de front-end |+| `defineRole()` | Definições de papéis |+| `defineField()` | Field extensions for existing objects |-```text-src/-├── application.config.ts-├── objects/-│ └── postCard.object.ts-├── functions/-│ └── createPostCard.function.ts-├── components/-│ └── card.front-component.tsx-└── roles/- └── admin.role.ts-```+<Note>+ **File naming is flexible.** Entity detection is AST-based — the SDK scans your source files for the `export default define<Entity>({...})` pattern. You can organize your files and folders however you like. Grouping by entity type (e.g., `logic-functions/`, `roles/`) is just a convention for code organization, not a requirement.+</Note>-**Baseada em funcionalidades:**+Example of a detected entity:-```text-src/-├── application.config.ts-└── post-card/- ├── postCard.object.ts- ├── createPostCard.function.ts- ├── card.front-component.tsx- └── postCardAdmin.role.ts-```--**Plana:**+```typescript+// This file can be named anything and placed anywhere in src/+import { defineObject, FieldType } from 'twenty-sdk';-```text-src/-├── application.config.ts-├── postCard.object.ts-├── createPostCard.function.ts-├── card.front-component.tsx-└── admin.role.ts+export default defineObject({+ universalIdentifier: '...',+ nameSingular: 'postCard',+ // ... rest of config+});```-Em alto nível:--* **package.json**: Declara o nome do app, versão, engines (Node 24+, Yarn 4) e adiciona `twenty-sdk`, além de scripts como `app:dev`, `app:generate`, `entity:add`, `function:logs`, `function:execute`, `app:uninstall` e `auth:login` que delegam para a CLI local `twenty`.-* **.gitignore**: Ignora artefatos comuns como `node_modules`, `.yarn`, `generated/` (cliente tipado), `dist/`, `build/`, pastas de cobertura, arquivos de log e arquivos `.env*`.-* **yarn.lock**, **.yarnrc.yml**, **.yarn/**: Bloqueiam e configuram a ferramenta Yarn 4 usada pelo projeto.-* **.nvmrc**: Fixa a versão do Node.js esperada pelo projeto.-* **eslint.config.mjs** e **tsconfig.json**: Fornecem lint e configuração do TypeScript para os fontes TypeScript do seu aplicativo.-* **README.md**: Um README curto na raiz do aplicativo com instruções básicas.-* **public/**: Uma pasta para armazenar recursos públicos (imagens, fontes, arquivos estáticos) que serão servidos com sua aplicação. Os arquivos colocados aqui são enviados durante a sincronização e ficam acessíveis em tempo de execução.-* **src/**: O local principal onde você define seu aplicativo como código:- * `application.config.ts`: Configuração global do seu aplicativo (metadados e conexões de execução). Veja "Configuração do aplicativo" abaixo.- * `*.role.ts`: Definições de papéis usadas pelas suas funções de lógica. Veja "Papel de função padrão" abaixo.- * `*.object.ts`: Definições de objetos personalizados.- * `*.function.ts`: Definições de funções de lógica.- * `*.front-component.tsx`: Definições de componentes de front-end.-Comandos posteriores adicionarão mais arquivos e pastas:* `yarn app:generate` criará uma pasta `generated/` (cliente tipado do Twenty + tipos do workspace).@@ -215,16 +184,18 @@ O twenty-sdk fornece blocos de construção tipados e funções utilitárias que### Funções utilitárias-O SDK fornece quatro funções utilitárias com validação integrada para definir as entidades do seu aplicativo:+The SDK provides helper functions for defining your app entities. As described in [Entity detection](#entity-detection), you must use `export default define<Entity>({...})` for your entities to be detected:-| Função | Finalidade |-| --------------------- | ------------------------------------------------- |-| `defineApplication()` | Configura os metadados do aplicativo |-| `defineObject()` | Define objetos personalizados com campos |-| `defineFunction()` | Defina funções de lógica com handlers |-| `defineRole()` | Configura permissões de papéis e acesso a objetos |+| Função | Finalidade |+| ------------------------ | ------------------------------------------------------ |+| `defineApplication()` | Configure application metadata (required, one per app) |+| `defineObject()` | Define objetos personalizados com campos |+| `defineLogicFunction()` | Defina funções de lógica com handlers |+| `defineFrontComponent()` | Define front components for custom UI |+| `defineRole()` | Configura permissões de papéis e acesso a objetos |+| `defineField()` | Extend existing objects with additional fields |-Essas funções validam sua configuração em tempo de execução e oferecem melhor autocompletar na IDE e segurança de tipos.+These functions validate your configuration at build time and provide IDE autocompletion and type safety.### Definindo objetos@@ -311,9 +282,9 @@ Pontos-chave:**Os campos base são criados automaticamente.** Quando você define um objeto personalizado, o Twenty adiciona automaticamente campos padrão como `name`, `createdAt`, `updatedAt`, `createdBy`, `position` e `deletedAt`. Você não precisa definir esses no seu array `fields` — adicione apenas seus campos personalizados.</Note>-### Configuração do aplicativo (application.config.ts)+### Configuração do aplicativo (application-config.ts)-Todo aplicativo tem um único arquivo `application.config.ts` que descreve:+Todo aplicativo tem um único arquivo `application-config.ts` que descreve:* **O que é o aplicativo**: identificadores, nome de exibição e descrição.* **Como suas funções são executadas**: qual papel usam para permissões.@@ -322,9 +293,9 @@ Todo aplicativo tem um único arquivo `application.config.ts` que descreve:Use `defineApplication()` to define your application configuration:```typescript-// src/app/application.config.ts+// src/application-config.tsimport { defineApplication } from 'twenty-sdk';-import { DEFAULT_ROLE_UNIVERSAL_IDENTIFIER } from './default-function.role';+import { DEFAULT_ROLE_UNIVERSAL_IDENTIFIER } from 'src/roles/default-role';export default defineApplication({universalIdentifier: '4ec0391d-18d5-411c-b2f3-266ddc1c3ef7',@@ -339,7 +310,7 @@ export default defineApplication({isSecret: false,},},- roleUniversalIdentifier: DEFAULT_ROLE_UNIVERSAL_IDENTIFIER,+ defaultRoleUniversalIdentifier: DEFAULT_ROLE_UNIVERSAL_IDENTIFIER,});```@@ -347,11 +318,11 @@ Notas:* `universalIdentifier` são IDs determinísticos que você controla; gere-os uma vez e mantenha-os estáveis entre sincronizações.* `applicationVariables` tornam-se variáveis de ambiente para suas funções (por exemplo, `DEFAULT_RECIPIENT_NAME` fica disponível como `process.env.DEFAULT_RECIPIENT_NAME`).-* `roleUniversalIdentifier` must match the role you define in your `*.role.ts` file (see below).+* `defaultRoleUniversalIdentifier` must match the role file (see below).#### Papéis e permissões-Os aplicativos podem definir papéis que encapsulam permissões sobre os objetos e ações do seu espaço de trabalho. The field `roleUniversalIdentifier` in `application.config.ts` designates the default role used by your app's logic functions.+Os aplicativos podem definir papéis que encapsulam permissões sobre os objetos e ações do seu espaço de trabalho. The field `defaultRoleUniversalIdentifier` in `application-config.ts` designates the default role used by your app's logic functions.* A chave de API em tempo de execução, injetada como `TWENTY_API_KEY`, é derivada desse papel padrão de função.* O cliente tipado ficará restrito às permissões concedidas a esse papel.@@ -362,7 +333,7 @@ Os aplicativos podem definir papéis que encapsulam permissões sobre os objetosAo criar um novo aplicativo com o scaffold, a CLI também cria um arquivo de papel padrão. Use `defineRole()` para definir papéis com validação integrada:```typescript-// src/app/default-function.role.ts+// src/roles/default-role.tsimport { defineRole, PermissionFlag } from 'twenty-sdk';export const DEFAULT_ROLE_UNIVERSAL_IDENTIFIER =@@ -401,10 +372,10 @@ export default defineRole({});```-O `universalIdentifier` desse papel é então referenciado em `application.config.ts` como `roleUniversalIdentifier`. Em outras palavras:+The `universalIdentifier` of this role is then referenced in `application-config.ts` as `defaultRoleUniversalIdentifier`. Em outras palavras:* **\*.role.ts** define o que o papel de função padrão pode fazer.-* **application.config.ts** aponta para esse papel para que suas funções herdem suas permissões.+* **application-config.ts** points to that role so your functions inherit its permissions.Notas:@@ -415,11 +386,11 @@ Notas:### Configuração de função de lógica e ponto de entrada-Cada arquivo de função usa `defineFunction()` para exportar uma configuração com um handler e gatilhos opcionais. Use o sufixo de arquivo `*.function.ts` para detecção automática.+Each function file uses `defineLogicFunction()` to export a configuration with a handler and optional triggers.```typescript-// src/app/createPostCard.function.ts-import { defineFunction } from 'twenty-sdk';+// src/app/createPostCard.logic-function.ts+import { defineLogicFunction } from 'twenty-sdk';import type { DatabaseEventPayload, ObjectRecordCreateEvent, CronPayload, RoutePayload } from 'twenty-sdk';import Twenty, { type Person } from '~/generated';@@ -439,7 +410,7 @@ const handler = async (params: RoutePayload) => {return result;};-export default defineFunction({+export default defineLogicFunction({universalIdentifier: 'e56d363b-0bdc-4d8a-a393-6f0d1c75bdcf',name: 'create-new-post-card',timeoutSeconds: 2,@@ -515,7 +486,7 @@ Notas:Quando um gatilho de rota invoca sua função de lógica, ela recebe um objeto `RoutePayload` que segue o formato do AWS HTTP API v2. Importe o tipo de `twenty-sdk`:```typescript-import { defineFunction, type RoutePayload } from 'twenty-sdk';+import { defineLogicFunction, type RoutePayload } from 'twenty-sdk';const handler = async (event: RoutePayload) => {// Access request data@@ -545,7 +516,7 @@ O tipo `RoutePayload` tem a seguinte estrutura:Por padrão, os cabeçalhos HTTP das requisições recebidas **não** são repassados para sua função de lógica por motivos de segurança. Para acessar cabeçalhos específicos, liste-os explicitamente no array `forwardedRequestHeaders`:```typescript-export default defineFunction({+export default defineLogicFunction({universalIdentifier: 'e56d363b-0bdc-4d8a-a393-6f0d1c75bdcf',name: 'webhook-handler',handler,@@ -580,8 +551,45 @@ const handler = async (event: RoutePayload) => {Você pode criar novas funções de duas formas:-* **Gerado automaticamente**: Execute `yarn entity:add` e escolha a opção para adicionar uma nova função. Isso gera um arquivo inicial com um handler e configuração.-* **Manual**: Crie um novo arquivo `*.function.ts` e use `defineFunction()`, seguindo o mesmo padrão.+* **Scaffolded**: Run `yarn entity:add` and choose the option to add a new logic function. Isso gera um arquivo inicial com um handler e configuração.+* **Manual**: Create a new `*.logic-function.ts` file and use `defineLogicFunction()`, following the same pattern.++### Front components++Front components let you build custom React components that render within Twenty's UI. Use `defineFrontComponent()` to define components with built-in validation:++```typescript+// src/my-widget.front-component.tsx+import { defineFrontComponent } from 'twenty-sdk';++const MyWidget = () => {+ return (+ <div style={{ padding: '20px', fontFamily: 'sans-serif' }}>+ <h1>My Custom Widget</h1>+ <p>This is a custom front component for Twenty.</p>+ </div>+ );+};++export default defineFrontComponent({+ universalIdentifier: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',+ name: 'my-widget',+ description: 'A custom widget component',+ component: MyWidget,+});+```++Pontos-chave:++* Front components are React components that render in isolated contexts within Twenty.+* Use o sufixo de arquivo `*.front-component.tsx` para detecção automática.+* The `component` field references your React component.+* Components are built and synced automatically during `yarn app:dev`.++You can create new front components in two ways:++* **Scaffolded**: Run `yarn entity:add` and choose the option to add a new front component.+* **Manual**: Create a new `*.front-component.tsx` file and use `defineFrontComponent()`.### Cliente tipado gerado@@ -606,12 +614,12 @@ Quando sua função é executada no Twenty, a plataforma injeta credenciais comoNotas:* Você não precisa passar a URL ou a chave de API para o cliente gerado. Ele lê `TWENTY_API_URL` e `TWENTY_API_KEY` de process.env em tempo de execução.-* As permissões da chave de API são determinadas pelo papel referenciado no seu `application.config.ts` via `roleUniversalIdentifier`. Este é o papel padrão usado pelas funções de lógica do seu app.-* Os aplicativos podem definir papéis para seguir o princípio do menor privilégio. Conceda apenas as permissões de que suas funções precisam e, em seguida, aponte `roleUniversalIdentifier` para o identificador universal desse papel.+* The API key's permissions are determined by the role referenced in your `application-config.ts` via `defaultRoleUniversalIdentifier`. Este é o papel padrão usado pelas funções de lógica do seu app.+* Os aplicativos podem definir papéis para seguir o princípio do menor privilégio. Grant only the permissions your functions need, then point `defaultRoleUniversalIdentifier` to that role's universal identifier.### Exemplo Hello World-Explore um exemplo mínimo de ponta a ponta que demonstra objetos, funções e vários gatilhos [aqui](https://github.com/twentyhq/twenty/tree/main/packages/twenty-apps/hello-world):+Explore a minimal, end-to-end example that demonstrates objects, logic functions, front components, and multiple triggers [here](https://github.com/twentyhq/twenty/tree/main/packages/twenty-apps/hello-world):## Configuração manual (sem o gerador)diff --git a/packages/twenty-docs/l/ro/developers/extend/capabilities/apps.mdx b/packages/twenty-docs/l/ro/developers/extend/capabilities/apps.mdxindex 9c945360ce8..43a20bfeb5d 100644--- a/packages/twenty-docs/l/ro/developers/extend/capabilities/apps.mdx+++ b/packages/twenty-docs/l/ro/developers/extend/capabilities/apps.mdx@@ -17,10 +17,6 @@ Aplicațiile vă permit să construiți și să gestionați personalizările Twe* Creați funcții de logică cu declanșatoare personalizate* Implementați aceeași aplicație în mai multe spații de lucru-**În curând:**--* Dispuneri și componente UI personalizate-## Cerințe* Node.js 24+ și Yarn 4@@ -93,84 +89,57 @@ my-twenty-app/eslint.config.mjstsconfig.jsonREADME.md- public/ # Director pentru resurse publice (imagini, fonturi etc.)+ public/ # Public assets folder (images, fonts, etc.)src/- application.config.ts # Obligatoriu - configurația principală a aplicației- default-function.role.ts # Rolul implicit pentru funcțiile serverless- hello-world.function.ts # Exemplu de funcție serverless- hello-world.front-component.tsx # Exemplu de componentă de interfață- // entitățile tale (*.object.ts, *.function.ts, *.front-component.tsx, *.role.ts)+ ├── application-config.ts # Required - main application configuration+ ├── roles/+ │ └── default-role.ts # Default role for logic functions+ ├── logic-functions/+ │ └── hello-world.ts # Example logic function+ └── front-components/+ └── hello-world.tsx # Example front component```-### Convenție în locul configurării--Aplicațiile folosesc o abordare bazată pe convenție în locul configurării, în care entitățile sunt detectate după sufixul fișierului. Aceasta permite o organizare flexibilă în folderul `src/app/`:+Pe scurt:-| Sufixul fișierului | Tipul entității |-| ----------------------- | ---------------------------------------- |-| `*.object.ts` | Definiții de obiecte personalizate |-| `*.function.ts` | Definiții de funcții serverless |-| `*.front-component.tsx` | Definiții ale componentelor de interfață |-| `*.role.ts` | Definiții de rol |+* **package.json**: Declares the app name, version, engines (Node 24+, Yarn 4), and adds `twenty-sdk` plus scripts like `app:dev`, `app:generate`, `entity:add`, `function:logs`, `function:execute`, `app:uninstall`, and authentication commands that delegate to the local `twenty` CLI.+* **.gitignore**: Ignoră artefacte comune precum `node_modules`, `.yarn`, `generated/` (client tipizat), `dist/`, `build/`, foldere de coverage, fișiere jurnal și fișiere `.env*`.+* **yarn.lock**, **.yarnrc.yml**, **.yarn/**: Blochează și configurează lanțul de instrumente Yarn 4 folosit de proiect.+* **.nvmrc**: Fixează versiunea Node.js așteptată de proiect.+* **eslint.config.mjs** și **tsconfig.json**: Oferă linting și configurație TypeScript pentru fișierele TypeScript ale aplicației.+* **README.md**: Un README scurt în rădăcina aplicației, cu instrucțiuni de bază.+* **public/**: Un folder pentru stocarea resurselor publice (imagini, fonturi, fișiere statice) care vor fi servite împreună cu aplicația ta. Fișierele plasate aici sunt încărcate în timpul sincronizării și sunt accesibile la rulare.+* **src/**: Locul principal unde vă definiți aplicația sub formă de cod-### Structuri de foldere acceptate+### Entity detection-Vă puteți organiza entitățile în oricare dintre aceste modele:+The SDK detects entities by parsing your TypeScript files for **`export default define<Entity>({...})`** calls. Each entity type has a corresponding helper function exported from `twenty-sdk`:-**Tradițional (după tip):**+| Helper function | Tipul entității |+| ------------------------ | ---------------------------------------- |+| `defineObject()` | Definiții de obiecte personalizate |+| `defineLogicFunction()` | Logic function definitions |+| `defineFrontComponent()` | Definiții ale componentelor de interfață |+| `defineRole()` | Definiții de rol |+| `defineField()` | Field extensions for existing objects |-```text-src/-├── application.config.ts-├── objects/-│ └── postCard.object.ts-├── functions/-│ └── createPostCard.function.ts-├── components/-│ └── card.front-component.tsx-└── roles/- └── admin.role.ts-```+<Note>+ **File naming is flexible.** Entity detection is AST-based — the SDK scans your source files for the `export default define<Entity>({...})` pattern. You can organize your files and folders however you like. Grouping by entity type (e.g., `logic-functions/`, `roles/`) is just a convention for code organization, not a requirement.+</Note>-**Bazat pe funcționalități:**+Example of a detected entity:-```text-src/-├── application.config.ts-└── post-card/- ├── postCard.object.ts- ├── createPostCard.function.ts- ├── card.front-component.tsx- └── postCardAdmin.role.ts-```--**Plat:**+```typescript+// This file can be named anything and placed anywhere in src/+import { defineObject, FieldType } from 'twenty-sdk';-```text-src/-├── application.config.ts-├── postCard.object.ts-├── createPostCard.function.ts-├── card.front-component.tsx-└── admin.role.ts+export default defineObject({+ universalIdentifier: '...',+ nameSingular: 'postCard',+ // ... rest of config+});```-Pe scurt:--* **package.json**: Declară numele aplicației, versiunea, motoarele (Node 24+, Yarn 4) și adaugă `twenty-sdk` plus scripturi precum `app:dev`, `app:generate`, `entity:add`, `function:logs`, `function:execute`, `app:uninstall` și `auth:login` care deleagă către CLI-ul local `twenty`.-* **.gitignore**: Ignoră artefacte comune precum `node_modules`, `.yarn`, `generated/` (client tipizat), `dist/`, `build/`, foldere de coverage, fișiere jurnal și fișiere `.env*`.-* **yarn.lock**, **.yarnrc.yml**, **.yarn/**: Blochează și configurează lanțul de instrumente Yarn 4 folosit de proiect.-* **.nvmrc**: Fixează versiunea Node.js așteptată de proiect.-* **eslint.config.mjs** și **tsconfig.json**: Oferă linting și configurație TypeScript pentru fișierele TypeScript ale aplicației.-* **README.md**: Un README scurt în rădăcina aplicației, cu instrucțiuni de bază.-* **public/**: Un folder pentru stocarea resurselor publice (imagini, fonturi, fișiere statice) care vor fi servite împreună cu aplicația ta. Fișierele plasate aici sunt încărcate în timpul sincronizării și sunt accesibile la rulare.-* **src/**: Locul principal unde vă definiți aplicația sub formă de cod:- * `application.config.ts`: Configurație globală pentru aplicație (metadate și conectare la runtime). Vezi "Configurația aplicației" mai jos.- * `*.role.ts`: Definiții de rol folosite de funcțiile dvs. de logică. Vezi "Rol implicit pentru funcții" mai jos.- * `*.object.ts`: Definiții de obiecte personalizate.- * `*.function.ts`: Definiții de funcții de logică.- * `*.front-component.tsx`: Definiții de componente front-end.-Comenzile ulterioare vor adăuga mai multe fișiere și foldere:* `yarn app:generate` va crea un folder `generated/` (client Twenty tipizat + tipuri pentru spațiul de lucru).@@ -215,16 +184,18 @@ Biblioteca twenty-sdk oferă blocuri de bază tipizate și funcții ajutătoare### Funcții ajutătoare-SDK-ul oferă patru funcții ajutătoare cu validare încorporată pentru definirea entităților aplicației:+The SDK provides helper functions for defining your app entities. As described in [Entity detection](#entity-detection), you must use `export default define<Entity>({...})` for your entities to be detected:-| Funcție | Scop |-| --------------------- | -------------------------------------------------------- |-| `defineApplication()` | Configurați metadatele aplicației |-| `defineObject()` | Definiți obiecte personalizate cu câmpuri |-| `defineFunction()` | Definiți funcții de logică cu handleri |-| `defineRole()` | Configurați permisiunile rolurilor și accesul la obiecte |+| Funcție | Scop |+| ------------------------ | -------------------------------------------------------- |+| `defineApplication()` | Configure application metadata (required, one per app) |+| `defineObject()` | Definiți obiecte personalizate cu câmpuri |+| `defineLogicFunction()` | Definiți funcții de logică cu handleri |+| `defineFrontComponent()` | Define front components for custom UI |+| `defineRole()` | Configurați permisiunile rolurilor și accesul la obiecte |+| `defineField()` | Extend existing objects with additional fields |-Aceste funcții validează configurația în timpul execuției și oferă o completare automată mai bună în IDE și siguranța tipurilor.+These functions validate your configuration at build time and provide IDE autocompletion and type safety.### Definirea obiectelor@@ -311,9 +282,9 @@ Puncte cheie:**Câmpurile de bază sunt create automat.** Când definiți un obiect personalizat, Twenty adaugă automat câmpuri standard precum `name`, `createdAt`, `updatedAt`, `createdBy`, `position` și `deletedAt`. Nu trebuie să le definiți în tabloul `fields` — adăugați doar câmpurile personalizate proprii.</Note>-### Configurația aplicației (application.config.ts)+### Configurația aplicației (application-config.ts)-Fiecare aplicație are un singur fișier `application.config.ts` care descrie:+Fiecare aplicație are un singur fișier `application-config.ts` care descrie:* **Cine este aplicația**: identificatori, nume de afișare și descriere.* **Cum rulează funcțiile**: ce rol folosesc pentru permisiuni.@@ -322,9 +293,9 @@ Fiecare aplicație are un singur fișier `application.config.ts` care descrie:Folosiți `defineApplication()` pentru a defini configurația aplicației:```typescript-// src/app/application.config.ts+// src/application-config.tsimport { defineApplication } from 'twenty-sdk';-import { DEFAULT_ROLE_UNIVERSAL_IDENTIFIER } from './default-function.role';+import { DEFAULT_ROLE_UNIVERSAL_IDENTIFIER } from 'src/roles/default-role';export default defineApplication({universalIdentifier: '4ec0391d-18d5-411c-b2f3-266ddc1c3ef7',@@ -339,7 +310,7 @@ export default defineApplication({isSecret: false,},},- roleUniversalIdentifier: DEFAULT_ROLE_UNIVERSAL_IDENTIFIER,+ defaultRoleUniversalIdentifier: DEFAULT_ROLE_UNIVERSAL_IDENTIFIER,});```@@ -347,11 +318,11 @@ Notițe:* Câmpurile `universalIdentifier` sunt ID-uri deterministe pe care le dețineți; generați-le o singură dată și păstrați-le stabile între sincronizări.* `applicationVariables` devin variabile de mediu pentru funcțiile dvs. (de exemplu, `DEFAULT_RECIPIENT_NAME` este disponibil ca `process.env.DEFAULT_RECIPIENT_NAME`).-* `roleUniversalIdentifier` trebuie să corespundă rolului pe care îl definiți în fișierul `*.role.ts` (vedeți mai jos).+* `defaultRoleUniversalIdentifier` must match the role file (see below).#### Roluri și permisiuni-Aplicațiile pot defini roluri care încapsulează permisiuni asupra obiectelor și acțiunilor din spațiul dvs. de lucru. Câmpul `roleUniversalIdentifier` din `application.config.ts` desemnează rolul implicit folosit de funcțiile de logică ale aplicației.+Aplicațiile pot defini roluri care încapsulează permisiuni asupra obiectelor și acțiunilor din spațiul dvs. de lucru. The field `defaultRoleUniversalIdentifier` in `application-config.ts` designates the default role used by your app's logic functions.* Cheia API de runtime injectată ca `TWENTY_API_KEY` este derivată din acest rol implicit pentru funcții.* Clientul tipizat va fi restricționat la permisiunile acordate acelui rol.@@ -362,7 +333,7 @@ Aplicațiile pot defini roluri care încapsulează permisiuni asupra obiectelorCând generați o aplicație nouă, CLI creează și un fișier de rol implicit. Folosiți `defineRole()` pentru a defini roluri cu validare încorporată:```typescript-// src/app/default-function.role.ts+// src/roles/default-role.tsimport { defineRole, PermissionFlag } from 'twenty-sdk';export const DEFAULT_ROLE_UNIVERSAL_IDENTIFIER =@@ -401,10 +372,10 @@ export default defineRole({});```-`universalIdentifier` al acestui rol este apoi referențiat în `application.config.ts` ca `roleUniversalIdentifier`. Cu alte cuvinte:+The `universalIdentifier` of this role is then referenced in `application-config.ts` as `defaultRoleUniversalIdentifier`. Cu alte cuvinte:* **\*.role.ts** definește ce poate face rolul implicit pentru funcții.-* **application.config.ts** indică acel rol, astfel încât funcțiile moștenesc permisiunile lui.+* **application-config.ts** points to that role so your functions inherit its permissions.Notițe:@@ -415,11 +386,11 @@ Notițe:### Configurația funcției de logică și punctul de intrare-Fiecare fișier de funcție folosește `defineFunction()` pentru a exporta o configurație cu un handler și declanșatoare opționale. Folosiți sufixul de fișier `*.function.ts` pentru detectare automată.+Each function file uses `defineLogicFunction()` to export a configuration with a handler and optional triggers.```typescript-// src/app/createPostCard.function.ts-import { defineFunction } from 'twenty-sdk';+// src/app/createPostCard.logic-function.ts+import { defineLogicFunction } from 'twenty-sdk';import type { DatabaseEventPayload, ObjectRecordCreateEvent, CronPayload, RoutePayload } from 'twenty-sdk';import Twenty, { type Person } from '~/generated';@@ -439,7 +410,7 @@ const handler = async (params: RoutePayload) => {return result;};-export default defineFunction({+export default defineLogicFunction({universalIdentifier: 'e56d363b-0bdc-4d8a-a393-6f0d1c75bdcf',name: 'create-new-post-card',timeoutSeconds: 2,@@ -515,7 +486,7 @@ Notițe:Când un declanșator de rută apelează funcția dvs. de logică, aceasta primește un obiect `RoutePayload` care urmează formatul AWS HTTP API v2. Importă tipul din `twenty-sdk`:```typescript-import { defineFunction, type RoutePayload } from 'twenty-sdk';+import { defineLogicFunction, type RoutePayload } from 'twenty-sdk';const handler = async (event: RoutePayload) => {// Access request data@@ -545,7 +516,7 @@ Tipul `RoutePayload` are următoarea structură:În mod implicit, anteturile HTTP din cererile de intrare **nu** sunt transmise funcției dvs. de logică din motive de securitate. Pentru a accesa anumite anteturi, listează-le explicit în array-ul `forwardedRequestHeaders`:```typescript-export default defineFunction({+export default defineLogicFunction({universalIdentifier: 'e56d363b-0bdc-4d8a-a393-6f0d1c75bdcf',name: 'webhook-handler',handler,@@ -580,8 +551,45 @@ const handler = async (event: RoutePayload) => {Puteți crea funcții noi în două moduri:-* **Generat**: Rulați `yarn entity:add` și alegeți opțiunea de a adăuga o funcție nouă. Aceasta generează un fișier inițial cu un handler și o configurație.-* **Manual**: Creați un fișier nou `*.function.ts` și folosiți `defineFunction()`, urmând același model.+* **Scaffolded**: Run `yarn entity:add` and choose the option to add a new logic function. Aceasta generează un fișier inițial cu un handler și o configurație.+* **Manual**: Create a new `*.logic-function.ts` file and use `defineLogicFunction()`, following the same pattern.++### Front components++Front components let you build custom React components that render within Twenty's UI. Use `defineFrontComponent()` to define components with built-in validation:++```typescript+// src/my-widget.front-component.tsx+import { defineFrontComponent } from 'twenty-sdk';++const MyWidget = () => {+ return (+ <div style={{ padding: '20px', fontFamily: 'sans-serif' }}>+ <h1>My Custom Widget</h1>+ <p>This is a custom front component for Twenty.</p>+ </div>+ );+};++export default defineFrontComponent({+ universalIdentifier: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',+ name: 'my-widget',+ description: 'A custom widget component',+ component: MyWidget,+});+```++Puncte cheie:++* Front components are React components that render in isolated contexts within Twenty.+* Folosiți sufixul de fișier `*.front-component.tsx` pentru detectare automată.+* The `component` field references your React component.+* Components are built and synced automatically during `yarn app:dev`.++You can create new front components in two ways:++* **Scaffolded**: Run `yarn entity:add` and choose the option to add a new front component.+* **Manual**: Create a new `*.front-component.tsx` file and use `defineFrontComponent()`.### Client tipizat generat@@ -606,12 +614,12 @@ Când funcția rulează pe Twenty, platforma injectează acreditări ca variabilNotițe:* Nu trebuie să transmiteți URL-ul sau cheia API către clientul generat. Acesta citește `TWENTY_API_URL` și `TWENTY_API_KEY` din process.env la runtime.-* Permisiunile cheii API sunt determinate de rolul referențiat în `application.config.ts` prin `roleUniversalIdentifier`. Acesta este rolul implicit folosit de funcțiile de logică ale aplicației.-* Aplicațiile pot defini roluri pentru a urma principiul celui mai mic privilegiu. Acordați doar permisiunile de care au nevoie funcțiile, apoi setați `roleUniversalIdentifier` la identificatorul universal al acelui rol.+* The API key's permissions are determined by the role referenced in your `application-config.ts` via `defaultRoleUniversalIdentifier`. Acesta este rolul implicit folosit de funcțiile de logică ale aplicației.+* Aplicațiile pot defini roluri pentru a urma principiul celui mai mic privilegiu. Grant only the permissions your functions need, then point `defaultRoleUniversalIdentifier` to that role's universal identifier.### Exemplu Hello World-Explorați un exemplu minim, cap‑la‑cap, care demonstrează obiecte, funcții și declanșatoare multiple [aici](https://github.com/twentyhq/twenty/tree/main/packages/twenty-apps/hello-world):+Explore a minimal, end-to-end example that demonstrates objects, logic functions, front components, and multiple triggers [here](https://github.com/twentyhq/twenty/tree/main/packages/twenty-apps/hello-world):## Configurare manuală (fără generator)diff --git a/packages/twenty-docs/l/ru/developers/extend/capabilities/apps.mdx b/packages/twenty-docs/l/ru/developers/extend/capabilities/apps.mdxindex 65fcbc68798..19f84484a53 100644--- a/packages/twenty-docs/l/ru/developers/extend/capabilities/apps.mdx+++ b/packages/twenty-docs/l/ru/developers/extend/capabilities/apps.mdx@@ -17,10 +17,6 @@ description: Создавайте и управляйте настройками* Создавайте логические функции с пользовательскими триггерами* Развёртывайте одно и то же приложение в нескольких рабочих пространствах-**Скоро:**--* Пользовательские макеты и компоненты интерфейса-## Требования* Node.js 24+ и Yarn 4@@ -93,84 +89,57 @@ my-twenty-app/eslint.config.mjstsconfig.jsonREADME.md- public/ # Папка общедоступных ресурсов (изображения, шрифты и т. п.)+ public/ # Public assets folder (images, fonts, etc.)src/- application.config.ts # Обязательный — основная конфигурация приложения- default-function.role.ts # Роль по умолчанию для бессерверных функций- hello-world.function.ts # Пример бессерверной функции- hello-world.front-component.tsx # Пример фронтенд-компонента- // ваши сущности (*.object.ts, *.function.ts, *.front-component.tsx, *.role.ts)+ ├── application-config.ts # Required - main application configuration+ ├── roles/+ │ └── default-role.ts # Default role for logic functions+ ├── logic-functions/+ │ └── hello-world.ts # Example logic function+ └── front-components/+ └── hello-world.tsx # Example front component```-### Соглашения важнее конфигурации--Приложения используют подход **соглашения важнее конфигурации**, при котором сущности определяются по суффиксу файла. Это позволяет гибко организовать структуру в папке `src/app/`:+В общих чертах:-| Суффикс файла | Тип сущности |-| ----------------------- | ------------------------------------- |-| `*.object.ts` | Определения пользовательских объектов |-| `*.function.ts` | Определения бессерверных функций |-| `*.front-component.tsx` | Определения компонентов фронтенда |-| `*.role.ts` | Определения ролей |+* **package.json**: Declares the app name, version, engines (Node 24+, Yarn 4), and adds `twenty-sdk` plus scripts like `app:dev`, `app:generate`, `entity:add`, `function:logs`, `function:execute`, `app:uninstall`, and authentication commands that delegate to the local `twenty` CLI.+* **.gitignore**: Игнорирует распространённые артефакты, такие как `node_modules`, `.yarn`, `generated/` (типизированный клиент), `dist/`, `build/`, каталоги coverage, файлы журналов и файлы `.env*`.+* **yarn.lock**, **.yarnrc.yml**, **.yarn/**: Фиксируют и настраивают используемый в проекте инструментарий Yarn 4.+* **.nvmrc**: Фиксирует версию Node.js, ожидаемую проектом.+* **eslint.config.mjs** и **tsconfig.json**: Обеспечивают линтинг и конфигурацию TypeScript для исходников вашего приложения на TypeScript.+* **README.md**: Короткий README в корне приложения с базовыми инструкциями.+* **public/**: Папка для хранения общедоступных ресурсов (изображений, шрифтов, статических файлов), которые будут отдаваться вашим приложением. Файлы, размещённые здесь, загружаются во время синхронизации и доступны во время выполнения.+* **src/**: Основное место, где вы определяете приложение как код-### Поддерживаемые способы организации папок+### Entity detection-Вы можете организовать свои сущности по любому из этих шаблонов:+The SDK detects entities by parsing your TypeScript files for **`export default define<Entity>({...})`** calls. Each entity type has a corresponding helper function exported from `twenty-sdk`:-**Традиционный (по типам):**+| Helper function | Тип сущности |+| ------------------------ | ------------------------------------- |+| `defineObject()` | Определения пользовательских объектов |+| `defineLogicFunction()` | Logic function definitions |+| `defineFrontComponent()` | Определения компонентов фронтенда |+| `defineRole()` | Определения ролей |+| `defineField()` | Field extensions for existing objects |-```text-src/-├── application.config.ts-├── objects/-│ └── postCard.object.ts-├── functions/-│ └── createPostCard.function.ts-├── components/-│ └── card.front-component.tsx-└── roles/- └── admin.role.ts-```+<Note>+ **File naming is flexible.** Entity detection is AST-based — the SDK scans your source files for the `export default define<Entity>({...})` pattern. You can organize your files and folders however you like. Grouping by entity type (e.g., `logic-functions/`, `roles/`) is just a convention for code organization, not a requirement.+</Note>-**По функциональности:**+Example of a detected entity:-```text-src/-├── application.config.ts-└── post-card/- ├── postCard.object.ts- ├── createPostCard.function.ts- ├── card.front-component.tsx- └── postCardAdmin.role.ts-```--**Плоский:**+```typescript+// This file can be named anything and placed anywhere in src/+import { defineObject, FieldType } from 'twenty-sdk';-```text-src/-├── application.config.ts-├── postCard.object.ts-├── createPostCard.function.ts-├── card.front-component.tsx-└── admin.role.ts+export default defineObject({+ universalIdentifier: '...',+ nameSingular: 'postCard',+ // ... rest of config+});```-В общих чертах:--* **package.json**: Объявляет имя приложения, версию, движки (Node 24+, Yarn 4) и добавляет `twenty-sdk`, а также скрипты вроде `app:dev`, `app:generate`, `entity:add`, `function:logs`, `function:execute`, `app:uninstall` и `auth:login`, которые делегируют выполнение локальному CLI `twenty`.-* **.gitignore**: Игнорирует распространённые артефакты, такие как `node_modules`, `.yarn`, `generated/` (типизированный клиент), `dist/`, `build/`, каталоги coverage, файлы журналов и файлы `.env*`.-* **yarn.lock**, **.yarnrc.yml**, **.yarn/**: Фиксируют и настраивают используемый в проекте инструментарий Yarn 4.-* **.nvmrc**: Фиксирует версию Node.js, ожидаемую проектом.-* **eslint.config.mjs** и **tsconfig.json**: Обеспечивают линтинг и конфигурацию TypeScript для исходников вашего приложения на TypeScript.-* **README.md**: Короткий README в корне приложения с базовыми инструкциями.-* **public/**: Папка для хранения общедоступных ресурсов (изображений, шрифтов, статических файлов), которые будут отдаваться вашим приложением. Файлы, размещённые здесь, загружаются во время синхронизации и доступны во время выполнения.-* **src/**: Основное место, где вы определяете приложение как код:- * `application.config.ts`: Глобальная конфигурация вашего приложения (метаданные и параметры выполнения). См. раздел «Конфигурация приложения» ниже.- * `*.role.ts`: Определения ролей, используемых вашими логическими функциями. См. раздел «Роль функции по умолчанию» ниже.- * `*.object.ts`: Определения пользовательских объектов.- * `*.function.ts`: Определения логических функций.- * `*.front-component.tsx`: Определения фронтенд-компонентов.-Позднее команды добавят больше файлов и папок:* `yarn app:generate` создаст папку `generated/` (типизированный клиент Twenty + типы рабочего пространства).@@ -215,16 +184,18 @@ yarn auth:status### Вспомогательные функции-SDK предоставляет четыре вспомогательных функции с встроенной валидацией для определения сущностей вашего приложения:+The SDK provides helper functions for defining your app entities. As described in [Entity detection](#entity-detection), you must use `export default define<Entity>({...})` for your entities to be detected:-| Функция | Назначение |-| --------------------- | ---------------------------------------------- |-| `defineApplication()` | Настраивает метаданные приложения |-| `defineObject()` | Определяет пользовательские объекты с полями |-| `defineFunction()` | Определение логических функций с обработчиками |-| `defineRole()` | Настраивает права роли и доступ к объектам |+| Функция | Назначение |+| ------------------------ | ------------------------------------------------------ |+| `defineApplication()` | Configure application metadata (required, one per app) |+| `defineObject()` | Определяет пользовательские объекты с полями |+| `defineLogicFunction()` | Определение логических функций с обработчиками |+| `defineFrontComponent()` | Define front components for custom UI |+| `defineRole()` | Настраивает права роли и доступ к объектам |+| `defineField()` | Extend existing objects with additional fields |-Эти функции проверяют вашу конфигурацию во время выполнения и обеспечивают лучшую автодополняемость в IDE и безопасность типов.+These functions validate your configuration at build time and provide IDE autocompletion and type safety.### Определение объектов@@ -311,9 +282,9 @@ export default defineObject({**Базовые поля создаются автоматически.** Когда вы определяете пользовательский объект, Twenty автоматически добавляет стандартные поля, такие как `name`, `createdAt`, `updatedAt`, `createdBy`, `position` и `deletedAt`. Вам не нужно определять их в массиве `fields` — добавляйте только свои пользовательские поля.</Note>-### Конфигурация приложения (application.config.ts)+### Конфигурация приложения (application-config.ts)-У каждого приложения есть единственный файл `application.config.ts`, который описывает:+У каждого приложения есть единственный файл `application-config.ts`, который описывает:* **Что это за приложение**: идентификаторы, отображаемое имя и описание.* **Как запускаются его функции**: какую роль они используют для прав доступа.@@ -322,9 +293,9 @@ export default defineObject({Используйте `defineApplication()` для определения конфигурации вашего приложения:```typescript-// src/app/application.config.ts+// src/application-config.tsimport { defineApplication } from 'twenty-sdk';-import { DEFAULT_ROLE_UNIVERSAL_IDENTIFIER } from './default-function.role';+import { DEFAULT_ROLE_UNIVERSAL_IDENTIFIER } from 'src/roles/default-role';export default defineApplication({universalIdentifier: '4ec0391d-18d5-411c-b2f3-266ddc1c3ef7',@@ -339,7 +310,7 @@ export default defineApplication({isSecret: false,},},- roleUniversalIdentifier: DEFAULT_ROLE_UNIVERSAL_IDENTIFIER,+ defaultRoleUniversalIdentifier: DEFAULT_ROLE_UNIVERSAL_IDENTIFIER,});```@@ -347,11 +318,11 @@ export default defineApplication({* `universalIdentifier` — это детерминированные идентификаторы, которыми вы управляете; сгенерируйте их один раз и сохраняйте стабильными между синхронизациями.* `applicationVariables` становятся переменными окружения для ваших функций (например, `DEFAULT_RECIPIENT_NAME` доступна как `process.env.DEFAULT_RECIPIENT_NAME`).-* `roleUniversalIdentifier` должен соответствовать роли, которую вы определяете в файле `*.role.ts` (см. ниже).+* `defaultRoleUniversalIdentifier` must match the role file (see below).#### Роли и разрешения-Приложения могут определять роли, инкапсулирующие права на объекты и действия в вашем рабочем пространстве. Поле `roleUniversalIdentifier` в `application.config.ts` обозначает роль по умолчанию, используемую логическими функциями вашего приложения.+Приложения могут определять роли, инкапсулирующие права на объекты и действия в вашем рабочем пространстве. The field `defaultRoleUniversalIdentifier` in `application-config.ts` designates the default role used by your app's logic functions.* Ключ API во время выполнения, подставляемый как `TWENTY_API_KEY`, получается из этой роли функции по умолчанию.* Типизированный клиент будет ограничен правами, предоставленными этой ролью.@@ -362,7 +333,7 @@ export default defineApplication({Когда вы генерируете новое приложение, CLI также создаёт файл роли по умолчанию. Используйте `defineRole()` для определения ролей со встроенной валидацией:```typescript-// src/app/default-function.role.ts+// src/roles/default-role.tsimport { defineRole, PermissionFlag } from 'twenty-sdk';export const DEFAULT_ROLE_UNIVERSAL_IDENTIFIER =@@ -401,10 +372,10 @@ export default defineRole({});```-`universalIdentifier` этой роли затем указывается в `application.config.ts` как `roleUniversalIdentifier`. Иными словами:+The `universalIdentifier` of this role is then referenced in `application-config.ts` as `defaultRoleUniversalIdentifier`. Иными словами:* **\*.role.ts** определяет, что может делать роль функции по умолчанию.-* **application.config.ts** указывает на эту роль, чтобы ваши функции наследовали её права.+* **application-config.ts** points to that role so your functions inherit its permissions.Заметки:@@ -415,11 +386,11 @@ export default defineRole({### Конфигурация логической функции и точка входа-Каждый файл функции использует `defineFunction()` для экспорта конфигурации с обработчиком и необязательными триггерами. Используйте суффикс файла `*.function.ts` для автоматического обнаружения.+Each function file uses `defineLogicFunction()` to export a configuration with a handler and optional triggers.```typescript-// src/app/createPostCard.function.ts-import { defineFunction } from 'twenty-sdk';+// src/app/createPostCard.logic-function.ts+import { defineLogicFunction } from 'twenty-sdk';import type { DatabaseEventPayload, ObjectRecordCreateEvent, CronPayload, RoutePayload } from 'twenty-sdk';import Twenty, { type Person } from '~/generated';@@ -439,7 +410,7 @@ const handler = async (params: RoutePayload) => {return result;};-export default defineFunction({+export default defineLogicFunction({universalIdentifier: 'e56d363b-0bdc-4d8a-a393-6f0d1c75bdcf',name: 'create-new-post-card',timeoutSeconds: 2,@@ -515,7 +486,7 @@ export default defineFunction({Когда триггер маршрута вызывает вашу логическую функцию, она получает объект `RoutePayload`, соответствующий формату AWS HTTP API v2. Импортируйте тип из `twenty-sdk`:```typescript-import { defineFunction, type RoutePayload } from 'twenty-sdk';+import { defineLogicFunction, type RoutePayload } from 'twenty-sdk';const handler = async (event: RoutePayload) => {// Access request data@@ -545,7 +516,7 @@ const handler = async (event: RoutePayload) => {По умолчанию HTTP-заголовки из входящих запросов **не** передаются в вашу логическую функцию по соображениям безопасности. Чтобы получить доступ к определённым заголовкам, явно перечислите их в массиве `forwardedRequestHeaders`:```typescript-export default defineFunction({+export default defineLogicFunction({universalIdentifier: 'e56d363b-0bdc-4d8a-a393-6f0d1c75bdcf',name: 'webhook-handler',handler,@@ -580,8 +551,45 @@ const handler = async (event: RoutePayload) => {Вы можете создать новые функции двумя способами:-* **Сгенерировано**: Запустите `yarn entity:add` и выберите опцию добавления новой функции. Это создаёт стартовый файл с обработчиком и конфигурацией.-* **Вручную**: Создайте новый файл `*.function.ts` и используйте `defineFunction()`, следуя тому же шаблону.+* **Scaffolded**: Run `yarn entity:add` and choose the option to add a new logic function. Это создаёт стартовый файл с обработчиком и конфигурацией.+* **Manual**: Create a new `*.logic-function.ts` file and use `defineLogicFunction()`, following the same pattern.++### Front components++Front components let you build custom React components that render within Twenty's UI. Use `defineFrontComponent()` to define components with built-in validation:++```typescript+// src/my-widget.front-component.tsx+import { defineFrontComponent } from 'twenty-sdk';++const MyWidget = () => {+ return (+ <div style={{ padding: '20px', fontFamily: 'sans-serif' }}>+ <h1>My Custom Widget</h1>+ <p>This is a custom front component for Twenty.</p>+ </div>+ );+};++export default defineFrontComponent({+ universalIdentifier: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',+ name: 'my-widget',+ description: 'A custom widget component',+ component: MyWidget,+});+```++Основные моменты:++* Front components are React components that render in isolated contexts within Twenty.+* Используйте суффикс файла `*.front-component.tsx` для автоматического обнаружения.+* The `component` field references your React component.+* Components are built and synced automatically during `yarn app:dev`.++You can create new front components in two ways:++* **Scaffolded**: Run `yarn entity:add` and choose the option to add a new front component.+* **Manual**: Create a new `*.front-component.tsx` file and use `defineFrontComponent()`.### Сгенерированный типизированный клиент@@ -606,12 +614,12 @@ const { me } = await client.query({ me: { id: true, displayName: true } });Заметки:* Вам не нужно передавать URL или ключ API сгенерированному клиенту. Он читает `TWENTY_API_URL` и `TWENTY_API_KEY` из process.env во время выполнения.-* Права ключа API определяются ролью, на которую ссылается ваш `application.config.ts` через `roleUniversalIdentifier`. Это роль по умолчанию, используемая логическими функциями вашего приложения.-* Приложения могут определять роли, чтобы следовать принципу наименьших привилегий. Выдавайте только те права, которые нужны вашим функциям, затем укажите в `roleUniversalIdentifier` универсальный идентификатор этой роли.+* The API key's permissions are determined by the role referenced in your `application-config.ts` via `defaultRoleUniversalIdentifier`. Это роль по умолчанию, используемая логическими функциями вашего приложения.+* Приложения могут определять роли, чтобы следовать принципу наименьших привилегий. Grant only the permissions your functions need, then point `defaultRoleUniversalIdentifier` to that role's universal identifier.### Пример Hello World-Посмотрите минимальный сквозной пример, демонстрирующий объекты, функции и несколько триггеров, [здесь](https://github.com/twentyhq/twenty/tree/main/packages/twenty-apps/hello-world):+Explore a minimal, end-to-end example that demonstrates objects, logic functions, front components, and multiple triggers [here](https://github.com/twentyhq/twenty/tree/main/packages/twenty-apps/hello-world):## Ручная настройка (без генератора)diff --git a/packages/twenty-docs/l/tr/developers/extend/capabilities/apps.mdx b/packages/twenty-docs/l/tr/developers/extend/capabilities/apps.mdxindex 08cb0ddc015..7198877148c 100644--- a/packages/twenty-docs/l/tr/developers/extend/capabilities/apps.mdx+++ b/packages/twenty-docs/l/tr/developers/extend/capabilities/apps.mdx@@ -17,10 +17,6 @@ Uygulamalar, Twenty özelleştirmelerini **kod olarak** oluşturup yönetmenizi* Özel tetikleyicilerle mantık fonksiyonları oluşturun* Aynı uygulamayı birden çok çalışma alanına dağıtın-**Yakında:**--* Özel UI düzenleri ve bileşenleri-## Ön Gereksinimler* Node.js 24+ ve Yarn 4@@ -93,84 +89,57 @@ my-twenty-app/eslint.config.mjstsconfig.jsonREADME.md- public/ # Genel varlıklar klasörü (görseller, yazı tipleri vb.)+ public/ # Public assets folder (images, fonts, etc.)src/- application.config.ts # Gerekli - ana uygulama yapılandırması- default-function.role.ts # Sunucusuz işlevler için varsayılan rol- hello-world.function.ts # Örnek sunucusuz işlev- hello-world.front-component.tsx # Örnek ön uç bileşeni- // varlıklarınız (*.object.ts, *.function.ts, *.front-component.tsx, *.role.ts)+ ├── application-config.ts # Required - main application configuration+ ├── roles/+ │ └── default-role.ts # Default role for logic functions+ ├── logic-functions/+ │ └── hello-world.ts # Example logic function+ └── front-components/+ └── hello-world.tsx # Example front component```-### Sözleşme-öncelikli yapılandırma--Uygulamalar, varlıkların dosya sonekiyle algılandığı **sözleşme-öncelikli yapılandırma** yaklaşımını kullanır. Bu, `src/app/` klasörü içinde esnek bir düzenlemeye olanak tanır:+Genel hatlarıyla:-| Dosya soneki | Varlık türü |-| ----------------------- | ----------------------------- |-| `*.object.ts` | Özel nesne tanımları |-| `*.function.ts` | Sunucusuz fonksiyon tanımları |-| `*.front-component.tsx` | Front component definitions |-| `*.role.ts` | Rol tanımları |+* **package.json**: Declares the app name, version, engines (Node 24+, Yarn 4), and adds `twenty-sdk` plus scripts like `app:dev`, `app:generate`, `entity:add`, `function:logs`, `function:execute`, `app:uninstall`, and authentication commands that delegate to the local `twenty` CLI.+* **.gitignore**: `node_modules`, `.yarn`, `generated/` (türlendirilmiş istemci), `dist/`, `build/`, kapsam klasörleri, günlük dosyaları ve `.env*` dosyaları gibi yaygın artifaktları yok sayar.+* **yarn.lock**, **.yarnrc.yml**, **.yarn/**: Proje tarafından kullanılan Yarn 4 araç zincirini kilitler ve yapılandırır.+* **.nvmrc**: Projenin beklediği Node.js sürümünü sabitler.+* **eslint.config.mjs** ve **tsconfig.json**: Uygulamanızın TypeScript kaynakları için linting ve TypeScript yapılandırması sağlar.+* **README.md**: Uygulama kökünde temel talimatların yer aldığı kısa bir README.+* **public/**: Uygulamanızla birlikte sunulacak genel varlıkları (görseller, yazı tipleri, statik dosyalar) depolamak için bir klasör. Buraya yerleştirilen dosyalar senkronizasyon sırasında yüklenir ve çalışma zamanında erişilebilir olur.+* **src/**: Uygulamanızı kod olarak tanımladığınız ana yer-### Desteklenen klasör düzenleri+### Entity detection-Varlıklarınızı şu desenlerden herhangi birine göre düzenleyebilirsiniz:+The SDK detects entities by parsing your TypeScript files for **`export default define<Entity>({...})`** calls. Each entity type has a corresponding helper function exported from `twenty-sdk`:-**Geleneksel (türe göre):**+| Helper function | Varlık türü |+| ------------------------ | ------------------------------------- |+| `defineObject()` | Özel nesne tanımları |+| `defineLogicFunction()` | Logic function definitions |+| `defineFrontComponent()` | Front component definitions |+| `defineRole()` | Rol tanımları |+| `defineField()` | Field extensions for existing objects |-```text-src/-├── application.config.ts-├── objects/-│ └── postCard.object.ts-├── functions/-│ └── createPostCard.function.ts-├── components/-│ └── card.front-component.tsx-└── roles/- └── admin.role.ts-```+<Note>+ **File naming is flexible.** Entity detection is AST-based — the SDK scans your source files for the `export default define<Entity>({...})` pattern. You can organize your files and folders however you like. Grouping by entity type (e.g., `logic-functions/`, `roles/`) is just a convention for code organization, not a requirement.+</Note>-**Özelliğe dayalı:**+Example of a detected entity:-```text-src/-├── application.config.ts-└── post-card/- ├── postCard.object.ts- ├── createPostCard.function.ts- ├── card.front-component.tsx- └── postCardAdmin.role.ts-```--**Düz:**+```typescript+// This file can be named anything and placed anywhere in src/+import { defineObject, FieldType } from 'twenty-sdk';-```text-src/-├── application.config.ts-├── postCard.object.ts-├── createPostCard.function.ts-├── card.front-component.tsx-└── admin.role.ts+export default defineObject({+ universalIdentifier: '...',+ nameSingular: 'postCard',+ // ... rest of config+});```-Genel hatlarıyla:--* **package.json**: Uygulama adını, sürümünü, motorları (Node 24+, Yarn 4) bildirir ve yerel `twenty` CLI’sine yetki devreden `app:dev`, `app:generate`, `entity:add`, `function:logs`, `function:execute`, `app:uninstall` ve `auth:login` gibi betiklerin yanı sıra `twenty-sdk` ekler.-* **.gitignore**: `node_modules`, `.yarn`, `generated/` (türlendirilmiş istemci), `dist/`, `build/`, kapsam klasörleri, günlük dosyaları ve `.env*` dosyaları gibi yaygın artifaktları yok sayar.-* **yarn.lock**, **.yarnrc.yml**, **.yarn/**: Proje tarafından kullanılan Yarn 4 araç zincirini kilitler ve yapılandırır.-* **.nvmrc**: Projenin beklediği Node.js sürümünü sabitler.-* **eslint.config.mjs** ve **tsconfig.json**: Uygulamanızın TypeScript kaynakları için linting ve TypeScript yapılandırması sağlar.-* **README.md**: Uygulama kökünde temel talimatların yer aldığı kısa bir README.-* **public/**: Uygulamanızla birlikte sunulacak genel varlıkları (görseller, yazı tipleri, statik dosyalar) depolamak için bir klasör. Buraya yerleştirilen dosyalar senkronizasyon sırasında yüklenir ve çalışma zamanında erişilebilir olur.-* **src/**: Uygulamanızı kod olarak tanımladığınız ana yer:- * `application.config.ts`: Uygulamanız için genel yapılandırma (meta veriler ve çalışma zamanı bağlantıları). Aşağıda "Uygulama yapılandırması"na bakın.- * `*.role.ts`: Mantık fonksiyonlarınız tarafından kullanılan rol tanımları. Aşağıda "Varsayılan fonksiyon rolü"ne bakın.- * `*.object.ts`: Özel nesne tanımları.- * `*.function.ts`: Mantık fonksiyon tanımları.- * `*.front-component.tsx`: Ön bileşen tanımları.-İlerideki komutlar daha fazla dosya ve klasör ekleyecektir:* `yarn app:generate`, `generated/` klasörünü oluşturur (türlendirilmiş Twenty istemcisi + çalışma alanı türleri).@@ -215,16 +184,18 @@ twenty-sdk, uygulamanız içinde kullandığınız türlendirilmiş yapı taşla### Yardımcı fonksiyonlar-SDK, uygulama varlıklarınızı tanımlamak için yerleşik doğrulamaya sahip dört yardımcı fonksiyon sunar:+The SDK provides helper functions for defining your app entities. As described in [Entity detection](#entity-detection), you must use `export default define<Entity>({...})` for your entities to be detected:-| Fonksiyon | Amaç |-| --------------------- | ---------------------------------------------- |-| `defineApplication()` | Uygulama meta verilerini yapılandırın |-| `defineObject()` | Alanlara sahip özel nesneler tanımlayın |-| `defineFunction()` | İşleyicilerle mantık fonksiyonları tanımlayın |-| `defineRole()` | Rol izinlerini ve nesne erişimini yapılandırın |+| Fonksiyon | Amaç |+| ------------------------ | ------------------------------------------------------ |+| `defineApplication()` | Configure application metadata (required, one per app) |+| `defineObject()` | Alanlara sahip özel nesneler tanımlayın |+| `defineLogicFunction()` | İşleyicilerle mantık fonksiyonları tanımlayın |+| `defineFrontComponent()` | Define front components for custom UI |+| `defineRole()` | Rol izinlerini ve nesne erişimini yapılandırın |+| `defineField()` | Extend existing objects with additional fields |-Bu fonksiyonlar, yapılandırmanızı çalışma anında doğrular ve daha iyi IDE otomatik tamamlama ve tür güvenliği sağlar.+These functions validate your configuration at build time and provide IDE autocompletion and type safety.### Nesnelerin tanımlanması@@ -311,9 +282,9 @@ export default defineObject({**Temel alanlar otomatik olarak oluşturulur.** Özel bir nesne tanımladığınızda Twenty, `name`, `createdAt`, `updatedAt`, `createdBy`, `position` ve `deletedAt` gibi standart alanları otomatik olarak ekler. Bunları `fields` dizinizde tanımlamanız gerekmez — yalnızca özel alanlarınızı ekleyin.</Note>-### Uygulama yapılandırması (application.config.ts)+### Uygulama yapılandırması (application-config.ts)-Her uygulamanın aşağıdakileri açıklayan tek bir `application.config.ts` dosyası vardır:+Her uygulamanın aşağıdakileri açıklayan tek bir `application-config.ts` dosyası vardır:* **Uygulamanın kim olduğu**: tanımlayıcılar, görünen ad ve açıklama.* **Fonksiyonlarının nasıl çalıştığı**: izinler için hangi rolü kullandıkları.@@ -322,9 +293,9 @@ Her uygulamanın aşağıdakileri açıklayan tek bir `application.config.ts` doUygulama yapılandırmanızı tanımlamak için `defineApplication()` kullanın:```typescript-// src/app/application.config.ts+// src/application-config.tsimport { defineApplication } from 'twenty-sdk';-import { DEFAULT_ROLE_UNIVERSAL_IDENTIFIER } from './default-function.role';+import { DEFAULT_ROLE_UNIVERSAL_IDENTIFIER } from 'src/roles/default-role';export default defineApplication({universalIdentifier: '4ec0391d-18d5-411c-b2f3-266ddc1c3ef7',@@ -339,7 +310,7 @@ export default defineApplication({isSecret: false,},},- roleUniversalIdentifier: DEFAULT_ROLE_UNIVERSAL_IDENTIFIER,+ defaultRoleUniversalIdentifier: DEFAULT_ROLE_UNIVERSAL_IDENTIFIER,});```@@ -347,11 +318,11 @@ Notlar:* `universalIdentifier` alanları size ait belirleyici kimliklerdir; bunları bir kez oluşturun ve eşitlemeler boyunca kararlı tutun.* `applicationVariables`, fonksiyonlarınız için ortam değişkenlerine dönüşür (örneğin, `DEFAULT_RECIPIENT_NAME` değeri `process.env.DEFAULT_RECIPIENT_NAME` olarak kullanılabilir).-* `roleUniversalIdentifier`, `*.role.ts` dosyanızda tanımladığınız rolle eşleşmelidir (aşağıya bakın).+* `defaultRoleUniversalIdentifier` must match the role file (see below).#### Roller ve izinler-Uygulamalar, çalışma alanınızdaki nesneler ve eylemler üzerindeki izinleri kapsülleyen roller tanımlayabilir. `application.config.ts` içindeki `roleUniversalIdentifier` alanı, uygulamanızın mantık fonksiyonları tarafından kullanılan varsayılan rolü belirtir.+Uygulamalar, çalışma alanınızdaki nesneler ve eylemler üzerindeki izinleri kapsülleyen roller tanımlayabilir. The field `defaultRoleUniversalIdentifier` in `application-config.ts` designates the default role used by your app's logic functions.* `TWENTY_API_KEY` olarak enjekte edilen çalışma zamanı API anahtarı bu varsayılan fonksiyon rolünden türetilir.* Türlendirilmiş istemci, o role tanınan izinlerle sınırlandırılır.@@ -362,7 +333,7 @@ Uygulamalar, çalışma alanınızdaki nesneler ve eylemler üzerindeki izinleriYeni bir uygulama oluşturduğunuzda CLI ayrıca varsayılan bir rol dosyası da oluşturur. Yerleşik doğrulamayla roller tanımlamak için `defineRole()` kullanın:```typescript-// src/app/default-function.role.ts+// src/roles/default-role.tsimport { defineRole, PermissionFlag } from 'twenty-sdk';export const DEFAULT_ROLE_UNIVERSAL_IDENTIFIER =@@ -401,10 +372,10 @@ export default defineRole({});```-Bu rolün `universalIdentifier` değeri, `application.config.ts` içinde `roleUniversalIdentifier` olarak referans verilir. Başka bir deyişle:+The `universalIdentifier` of this role is then referenced in `application-config.ts` as `defaultRoleUniversalIdentifier`. Başka bir deyişle:* **\*.role.ts**, varsayılan fonksiyon rolünün neler yapabileceğini tanımlar.-* **application.config.ts** bu role işaret eder, böylece fonksiyonlarınız onun izinlerini devralır.+* **application-config.ts** points to that role so your functions inherit its permissions.Notlar:@@ -415,11 +386,11 @@ Notlar:### Mantık fonksiyon yapılandırması ve giriş noktası-Her fonksiyon dosyası, bir işleyici ve isteğe bağlı tetikleyiciler içeren bir yapılandırmayı dışa aktarmak için `defineFunction()` kullanır. Otomatik algılama için `*.function.ts` dosya soneğini kullanın.+Each function file uses `defineLogicFunction()` to export a configuration with a handler and optional triggers.```typescript-// src/app/createPostCard.function.ts-import { defineFunction } from 'twenty-sdk';+// src/app/createPostCard.logic-function.ts+import { defineLogicFunction } from 'twenty-sdk';import type { DatabaseEventPayload, ObjectRecordCreateEvent, CronPayload, RoutePayload } from 'twenty-sdk';import Twenty, { type Person } from '~/generated';@@ -439,7 +410,7 @@ const handler = async (params: RoutePayload) => {return result;};-export default defineFunction({+export default defineLogicFunction({universalIdentifier: 'e56d363b-0bdc-4d8a-a393-6f0d1c75bdcf',name: 'create-new-post-card',timeoutSeconds: 2,@@ -515,7 +486,7 @@ Notlar:Bir rota tetikleyicisi mantık fonksiyonunuzu çağırdığında, AWS HTTP API v2 formatını izleyen bir `RoutePayload` nesnesi alır. Türü `twenty-sdk` içinden içe aktarın:```typescript-import { defineFunction, type RoutePayload } from 'twenty-sdk';+import { defineLogicFunction, type RoutePayload } from 'twenty-sdk';const handler = async (event: RoutePayload) => {// Access request data@@ -545,7 +516,7 @@ const handler = async (event: RoutePayload) => {Varsayılan olarak, güvenlik nedenleriyle gelen isteklerden HTTP başlıkları mantık fonksiyonunuza **aktarılmaz**. Belirli başlıklara erişmek için bunları açıkça `forwardedRequestHeaders` dizisinde listeleyin:```typescript-export default defineFunction({+export default defineLogicFunction({universalIdentifier: 'e56d363b-0bdc-4d8a-a393-6f0d1c75bdcf',name: 'webhook-handler',handler,@@ -580,8 +551,45 @@ const handler = async (event: RoutePayload) => {Yeni fonksiyonları iki şekilde oluşturabilirsiniz:-* **Şablondan**: `yarn entity:add` çalıştırın ve yeni bir fonksiyon ekleme seçeneğini seçin. Bu, bir işleyici ve yapılandırma içeren bir başlangıç dosyası oluşturur.-* **Manuel**: Yeni bir `*.function.ts` dosyası oluşturun ve aynı deseni izleyerek `defineFunction()` kullanın.+* **Scaffolded**: Run `yarn entity:add` and choose the option to add a new logic function. Bu, bir işleyici ve yapılandırma içeren bir başlangıç dosyası oluşturur.+* **Manual**: Create a new `*.logic-function.ts` file and use `defineLogicFunction()`, following the same pattern.++### Front components++Front components let you build custom React components that render within Twenty's UI. Use `defineFrontComponent()` to define components with built-in validation:++```typescript+// src/my-widget.front-component.tsx+import { defineFrontComponent } from 'twenty-sdk';++const MyWidget = () => {+ return (+ <div style={{ padding: '20px', fontFamily: 'sans-serif' }}>+ <h1>My Custom Widget</h1>+ <p>This is a custom front component for Twenty.</p>+ </div>+ );+};++export default defineFrontComponent({+ universalIdentifier: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',+ name: 'my-widget',+ description: 'A custom widget component',+ component: MyWidget,+});+```++Önemli noktalar:++* Front components are React components that render in isolated contexts within Twenty.+* Otomatik algılama için `*.front-component.tsx` dosya soneğini kullanın.+* The `component` field references your React component.+* Components are built and synced automatically during `yarn app:dev`.++You can create new front components in two ways:++* **Scaffolded**: Run `yarn entity:add` and choose the option to add a new front component.+* **Manual**: Create a new `*.front-component.tsx` file and use `defineFrontComponent()`.### Oluşturulmuş türlendirilmiş istemci@@ -606,12 +614,12 @@ Fonksiyonunuz Twenty üzerinde çalıştığında, platform kodunuz yürütülmeNotlar:* Oluşturulan istemciye URL veya API anahtarı geçirmeniz gerekmez. Çalışma zamanında `TWENTY_API_URL` ve `TWENTY_API_KEY` değerlerini process.env üzerinden okur.-* API anahtarının izinleri, `application.config.ts` içinde `roleUniversalIdentifier` aracılığıyla referans verilen role göre belirlenir. Bu, uygulamanızın mantık fonksiyonları tarafından kullanılan varsayılan roldür.-* Uygulamalar, en az ayrıcalık ilkesini izlemek için roller tanımlayabilir. Yalnızca fonksiyonlarınızın ihtiyaç duyduğu izinleri verin ve ardından `roleUniversalIdentifier` değerini o rolün evrensel tanımlayıcısına yönlendirin.+* The API key's permissions are determined by the role referenced in your `application-config.ts` via `defaultRoleUniversalIdentifier`. Bu, uygulamanızın mantık fonksiyonları tarafından kullanılan varsayılan roldür.+* Uygulamalar, en az ayrıcalık ilkesini izlemek için roller tanımlayabilir. Grant only the permissions your functions need, then point `defaultRoleUniversalIdentifier` to that role's universal identifier.### Hello World örneği-Nesneleri, fonksiyonları ve birden çok tetikleyiciyi gösteren minimal, uçtan uca bir örneği [buradan](https://github.com/twentyhq/twenty/tree/main/packages/twenty-apps/hello-world) inceleyin:+Explore a minimal, end-to-end example that demonstrates objects, logic functions, front components, and multiple triggers [here](https://github.com/twentyhq/twenty/tree/main/packages/twenty-apps/hello-world):## Manuel kurulum (scaffolder olmadan)diff --git a/packages/twenty-docs/l/zh/developers/extend/capabilities/apps.mdx b/packages/twenty-docs/l/zh/developers/extend/capabilities/apps.mdxindex 647292b83ee..ec8a1851ed2 100644--- a/packages/twenty-docs/l/zh/developers/extend/capabilities/apps.mdx+++ b/packages/twenty-docs/l/zh/developers/extend/capabilities/apps.mdx@@ -17,10 +17,6 @@ description: 以代码的形式构建并管理 Twenty 自定义项。* 构建带有自定义触发器的逻辑函数* 将同一个应用部署到多个工作空间-**即将推出:**--* 自定义 UI 布局和组件-## 先决条件* Node.js 24+ 和 Yarn 4@@ -93,84 +89,57 @@ my-twenty-app/eslint.config.mjstsconfig.jsonREADME.md- public/ # 公共资源文件夹(图像、字体等)+ public/ # Public assets folder (images, fonts, etc.)src/- application.config.ts # 必需 - 主应用程序配置- default-function.role.ts # 用于无服务器函数的默认角色- hello-world.function.ts # 示例无服务器函数- hello-world.front-component.tsx # 示例前端组件- // 你的实体 (*.object.ts, *.function.ts, *.front-component.tsx, *.role.ts)+ ├── application-config.ts # Required - main application configuration+ ├── roles/+ │ └── default-role.ts # Default role for logic functions+ ├── logic-functions/+ │ └── hello-world.ts # Example logic function+ └── front-components/+ └── hello-world.tsx # Example front component```-### 约定优于配置--应用采用**约定优于配置**的方式,根据文件后缀检测实体。 这使得可以在 `src/app/` 文件夹内灵活组织:+总体来说:-| 文件后缀 | 实体类型 |-| ----------------------- | -------- |-| `*.object.ts` | 自定义对象定义 |-| `*.function.ts` | 无服务器函数定义 |-| `*.front-component.tsx` | 前端组件定义 |-| `*.role.ts` | 角色定义 |+* **package.json**: Declares the app name, version, engines (Node 24+, Yarn 4), and adds `twenty-sdk` plus scripts like `app:dev`, `app:generate`, `entity:add`, `function:logs`, `function:execute`, `app:uninstall`, and authentication commands that delegate to the local `twenty` CLI.+* **.gitignore**:忽略常见产物,如 `node_modules`、`.yarn`、`generated/`(类型化客户端)、`dist/`、`build/`、覆盖率文件夹、日志文件以及 `.env*` 文件。+* **yarn.lock**、**.yarnrc.yml**、**.yarn/**:锁定并配置项目使用的 Yarn 4 工具链。+* **.nvmrc**:固定项目期望的 Node.js 版本。+* **eslint.config.mjs** 和 **tsconfig.json**:为应用的 TypeScript 源码提供 Lint 与 TypeScript 配置。+* **README.md**:应用根目录中的简短 README,包含基本说明。+* **public/**: 一个用于存储公共资源(图像、字体、静态文件)的文件夹,这些资源将随你的应用程序一起提供。 放置在此处的文件会在同步期间上传,并可在运行时访问。+* **src/**: The main place where you define your application-as-code-### 支持的文件夹组织方式+### Entity detection-你可以按以下任一模式组织实体:+The SDK detects entities by parsing your TypeScript files for **`export default define<Entity>({...})`** calls. Each entity type has a corresponding helper function exported from `twenty-sdk`:-**传统(按类型):**+| Helper function | 实体类型 |+| ------------------------ | ------------------------------------- |+| `defineObject()` | 自定义对象定义 |+| `defineLogicFunction()` | Logic function definitions |+| `defineFrontComponent()` | 前端组件定义 |+| `defineRole()` | 角色定义 |+| `defineField()` | Field extensions for existing objects |-```text-src/-├── application.config.ts-├── objects/-│ └── postCard.object.ts-├── functions/-│ └── createPostCard.function.ts-├── components/-│ └── card.front-component.tsx-└── roles/- └── admin.role.ts-```+<Note>+ **File naming is flexible.** Entity detection is AST-based — the SDK scans your source files for the `export default define<Entity>({...})` pattern. You can organize your files and folders however you like. Grouping by entity type (e.g., `logic-functions/`, `roles/`) is just a convention for code organization, not a requirement.+</Note>-**基于特性:**+Example of a detected entity:-```text-src/-├── application.config.ts-└── post-card/- ├── postCard.object.ts- ├── createPostCard.function.ts- ├── card.front-component.tsx- └── postCardAdmin.role.ts-```--**扁平:**+```typescript+// This file can be named anything and placed anywhere in src/+import { defineObject, FieldType } from 'twenty-sdk';-```text-src/-├── application.config.ts-├── postCard.object.ts-├── createPostCard.function.ts-├── card.front-component.tsx-└── admin.role.ts+export default defineObject({+ universalIdentifier: '...',+ nameSingular: 'postCard',+ // ... rest of config+});```-总体来说:--* **package.json**:声明应用名称、版本、运行时(Node 24+、Yarn 4),并添加 `twenty-sdk`,以及诸如 `app:dev`、`app:generate`、`entity:add`、`function:logs`、`function:execute`、`app:uninstall` 和 `auth:login` 等脚本,这些脚本会委托给本地的 `twenty` CLI。-* **.gitignore**:忽略常见产物,如 `node_modules`、`.yarn`、`generated/`(类型化客户端)、`dist/`、`build/`、覆盖率文件夹、日志文件以及 `.env*` 文件。-* **yarn.lock**、**.yarnrc.yml**、**.yarn/**:锁定并配置项目使用的 Yarn 4 工具链。-* **.nvmrc**:固定项目期望的 Node.js 版本。-* **eslint.config.mjs** 和 **tsconfig.json**:为应用的 TypeScript 源码提供 Lint 与 TypeScript 配置。-* **README.md**:应用根目录中的简短 README,包含基本说明。-* **public/**: 一个用于存储公共资源(图像、字体、静态文件)的文件夹,这些资源将随你的应用程序一起提供。 放置在此处的文件会在同步期间上传,并可在运行时访问。-* **src/**:你以代码形式定义应用的主要位置:- * `application.config.ts`:应用的全局配置(元数据和运行时关联)。 参见下方“应用配置”。- * `*.role.ts`:你的逻辑函数所使用的角色定义。 参见下方“默认函数角色”。- * `*.object.ts`:自定义对象定义。- * `*.function.ts`:逻辑函数定义。- * `*.front-component.tsx`:前端组件定义。-后续命令将添加更多文件和文件夹:* `yarn app:generate` 将创建一个 `generated/` 文件夹(类型化 Twenty 客户端 + 工作空间类型)。@@ -215,16 +184,18 @@ twenty-sdk 提供你在应用中使用的类型化构件和辅助函数。 以### 辅助函数-该 SDK 提供四个带内置校验的辅助函数,用于定义你的应用实体:+The SDK provides helper functions for defining your app entities. As described in [Entity detection](#entity-detection), you must use `export default define<Entity>({...})` for your entities to be detected:-| 函数 | 目的 |-| --------------------- | ------------ |-| `defineApplication()` | 配置应用元数据 |-| `defineObject()` | 定义带字段的自定义对象 |-| `defineFunction()` | 定义带处理程序的逻辑函数 |-| `defineRole()` | 配置角色权限和对象访问 |+| 函数 | 目的 |+| ------------------------ | ------------------------------------------------------ |+| `defineApplication()` | Configure application metadata (required, one per app) |+| `defineObject()` | 定义带字段的自定义对象 |+| `defineLogicFunction()` | 定义带处理程序的逻辑函数 |+| `defineFrontComponent()` | Define front components for custom UI |+| `defineRole()` | 配置角色权限和对象访问 |+| `defineField()` | Extend existing objects with additional fields |-这些函数会在运行时校验你的配置,并提供更好的 IDE 自动补全和类型安全。+These functions validate your configuration at build time and provide IDE autocompletion and type safety.### 定义对象@@ -311,9 +282,9 @@ export default defineObject({**基础字段会自动创建。** 当你定义自定义对象时,Twenty 会自动添加 `name`、`createdAt`、`updatedAt`、`createdBy`、`position`、`deletedAt` 等标准字段。 你无需在 `fields` 数组中定义这些字段——只需添加你的自定义字段。</Note>-### 应用配置(application.config.ts)+### 应用配置(application-config.ts)-每个应用都有一个 `application.config.ts` 文件,用于描述:+每个应用都有一个 `application-config.ts` 文件,用于描述:* **应用的身份**:标识符、显示名称和描述。* **函数如何运行**:它们用于权限的角色。@@ -322,9 +293,9 @@ export default defineObject({使用 `defineApplication()` 定义你的应用配置:```typescript-// src/app/application.config.ts+// src/application-config.tsimport { defineApplication } from 'twenty-sdk';-import { DEFAULT_ROLE_UNIVERSAL_IDENTIFIER } from './default-function.role';+import { DEFAULT_ROLE_UNIVERSAL_IDENTIFIER } from 'src/roles/default-role';export default defineApplication({universalIdentifier: '4ec0391d-18d5-411c-b2f3-266ddc1c3ef7',@@ -339,7 +310,7 @@ export default defineApplication({isSecret: false,},},- roleUniversalIdentifier: DEFAULT_ROLE_UNIVERSAL_IDENTIFIER,+ defaultRoleUniversalIdentifier: DEFAULT_ROLE_UNIVERSAL_IDENTIFIER,});```@@ -347,11 +318,11 @@ export default defineApplication({* `universalIdentifier` 字段是你拥有的确定性 ID;生成一次并在多次同步中保持稳定。* `applicationVariables` 会变成函数可用的环境变量(例如,`DEFAULT_RECIPIENT_NAME` 可作为 `process.env.DEFAULT_RECIPIENT_NAME` 使用)。-* `roleUniversalIdentifier` 必须与在 `*.role.ts` 文件中定义的角色一致(见下文)。+* `defaultRoleUniversalIdentifier` must match the role file (see below).#### 角色和权限-应用可以定义角色,以封装对工作空间对象与操作的权限。 `application.config.ts` 中的 `roleUniversalIdentifier` 字段指定你的应用逻辑函数所使用的默认角色。+应用可以定义角色,以封装对工作空间对象与操作的权限。 The field `defaultRoleUniversalIdentifier` in `application-config.ts` designates the default role used by your app's logic functions.* 作为 `TWENTY_API_KEY` 注入的运行时 API 密钥源自该默认函数角色。* 类型化客户端将受限于该角色授予的权限。@@ -362,7 +333,7 @@ export default defineApplication({当你脚手架生成新应用时,CLI 也会创建一个默认角色文件。 使用 `defineRole()` 定义带内置校验的角色:```typescript-// src/app/default-function.role.ts+// src/roles/default-role.tsimport { defineRole, PermissionFlag } from 'twenty-sdk';export const DEFAULT_ROLE_UNIVERSAL_IDENTIFIER =@@ -401,10 +372,10 @@ export default defineRole({});```-随后,该角色的 `universalIdentifier` 会在 `application.config.ts` 中被引用为 `roleUniversalIdentifier`。 换句话说:+The `universalIdentifier` of this role is then referenced in `application-config.ts` as `defaultRoleUniversalIdentifier`. 换句话说:* **\*.role.ts** 定义默认函数角色可以执行的操作。-* **application.config.ts** 指向该角色,使你的函数继承其权限。+* **application-config.ts** points to that role so your functions inherit its permissions.备注:@@ -415,11 +386,11 @@ export default defineRole({### 逻辑函数的配置与入口点-每个函数文件都使用 `defineFunction()` 导出包含处理程序和可选触发器的配置。 使用 `*.function.ts` 文件后缀以便自动检测。+Each function file uses `defineLogicFunction()` to export a configuration with a handler and optional triggers.```typescript-// src/app/createPostCard.function.ts-import { defineFunction } from 'twenty-sdk';+// src/app/createPostCard.logic-function.ts+import { defineLogicFunction } from 'twenty-sdk';import type { DatabaseEventPayload, ObjectRecordCreateEvent, CronPayload, RoutePayload } from 'twenty-sdk';import Twenty, { type Person } from '~/generated';@@ -439,7 +410,7 @@ const handler = async (params: RoutePayload) => {return result;};-export default defineFunction({+export default defineLogicFunction({universalIdentifier: 'e56d363b-0bdc-4d8a-a393-6f0d1c75bdcf',name: 'create-new-post-card',timeoutSeconds: 2,@@ -515,7 +486,7 @@ export default defineFunction({当路由触发器调用你的逻辑函数时,它会接收一个遵循 AWS HTTP API v2 格式的 `RoutePayload` 对象。 从 `twenty-sdk` 导入该类型:```typescript-import { defineFunction, type RoutePayload } from 'twenty-sdk';+import { defineLogicFunction, type RoutePayload } from 'twenty-sdk';const handler = async (event: RoutePayload) => {// Access request data@@ -545,7 +516,7 @@ const handler = async (event: RoutePayload) => {出于安全原因,默认**不会**将传入请求的 HTTP 请求头传递给你的逻辑函数。 如需访问特定请求头,请在 `forwardedRequestHeaders` 数组中显式列出:```typescript-export default defineFunction({+export default defineLogicFunction({universalIdentifier: 'e56d363b-0bdc-4d8a-a393-6f0d1c75bdcf',name: 'webhook-handler',handler,@@ -580,8 +551,45 @@ const handler = async (event: RoutePayload) => {你可以通过两种方式创建新函数:-* **脚手架生成**:运行 `yarn entity:add` 并选择添加新函数的选项。 这将生成一个包含处理程序和配置的入门文件。-* **手动**:创建一个新的 `*.function.ts` 文件,并使用 `defineFunction()`,遵循相同的模式。+* **Scaffolded**: Run `yarn entity:add` and choose the option to add a new logic function. 这将生成一个包含处理程序和配置的入门文件。+* **Manual**: Create a new `*.logic-function.ts` file and use `defineLogicFunction()`, following the same pattern.++### Front components++Front components let you build custom React components that render within Twenty's UI. Use `defineFrontComponent()` to define components with built-in validation:++```typescript+// src/my-widget.front-component.tsx+import { defineFrontComponent } from 'twenty-sdk';++const MyWidget = () => {+ return (+ <div style={{ padding: '20px', fontFamily: 'sans-serif' }}>+ <h1>My Custom Widget</h1>+ <p>This is a custom front component for Twenty.</p>+ </div>+ );+};++export default defineFrontComponent({+ universalIdentifier: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',+ name: 'my-widget',+ description: 'A custom widget component',+ component: MyWidget,+});+```++关键点:++* Front components are React components that render in isolated contexts within Twenty.+* 使用 `*.front-component.tsx` 文件后缀以便自动检测。+* The `component` field references your React component.+* Components are built and synced automatically during `yarn app:dev`.++You can create new front components in two ways:++* **Scaffolded**: Run `yarn entity:add` and choose the option to add a new front component.+* **Manual**: Create a new `*.front-component.tsx` file and use `defineFrontComponent()`.### 生成的类型化客户端@@ -606,12 +614,12 @@ const { me } = await client.query({ me: { id: true, displayName: true } });备注:* 你无需向生成的客户端传递 URL 或 API 密钥。 它会在运行时从 process.env 读取 `TWENTY_API_URL` 和 `TWENTY_API_KEY`。-* API 密钥的权限由 `application.config.ts` 中通过 `roleUniversalIdentifier` 引用的角色决定。 这是你的应用逻辑函数使用的默认角色。-* 应用可以定义角色以遵循最小权限原则。 仅授予函数所需的权限,然后将 `roleUniversalIdentifier` 指向该角色的通用标识符。+* The API key's permissions are determined by the role referenced in your `application-config.ts` via `defaultRoleUniversalIdentifier`. 这是你的应用逻辑函数使用的默认角色。+* 应用可以定义角色以遵循最小权限原则。 Grant only the permissions your functions need, then point `defaultRoleUniversalIdentifier` to that role's universal identifier.### Hello World 示例-在[此处](https://github.com/twentyhq/twenty/tree/main/packages/twenty-apps/hello-world)查看一个最小的端到端示例,展示对象、函数和多种触发器:+Explore a minimal, end-to-end example that demonstrates objects, logic functions, front components, and multiple triggers [here](https://github.com/twentyhq/twenty/tree/main/packages/twenty-apps/hello-world):## 手动设置(不使用脚手架)