The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Share front component dependencies through a per-app bundle (#23773)
Raphaël Bosidce877870b14
diff --git a/packages/twenty-apps/examples/postcard/e2e/card-front-component.spec.ts b/packages/twenty-apps/examples/postcard/e2e/card-front-component.spec.tsindex de057567112..b219030b447 100644--- a/packages/twenty-apps/examples/postcard/e2e/card-front-component.spec.ts+++ b/packages/twenty-apps/examples/postcard/e2e/card-front-component.spec.ts@@ -1,8 +1,7 @@import { expect, test } from '@playwright/test';-import * as fs from 'fs';-import * as path from 'path';import { CARD_TEST_IDS } from '../src/components/card-test-ids';+import { resolveE2eWorkspaceUrl } from './utils/resolve-e2e-workspace-url';// Seeded postcard record the preview should display.const RECORD_ID = process.env.E2E_POSTCARD_RECORD_ID;@@ -17,28 +16,6 @@ const STATUS_BADGE_BACKGROUND: Record<string, string> = {RETURNED: 'rgb(224, 82, 82)',};-const WORKSPACE_ORIGIN_FILE = path.resolve(- __dirname,- '.auth',- 'workspace-origin.txt',-);--const resolveWorkspaceUrl = (): string => {- const fromEnv = process.env.E2E_WORKSPACE_URL;- if (fromEnv) {- return fromEnv.replace(/\/$/, '');- }-- try {- return fs- .readFileSync(WORKSPACE_ORIGIN_FILE, 'utf8')- .trim()- .replace(/\/$/, '');- } catch {- return 'http://app.localhost:3001';- }-};-// Error states rendered by card.front-component.tsx when it cannot authenticate// or fetch the record. None of these may appear once the component renders.const FALLBACK_TEXTS = [@@ -97,7 +74,7 @@ test.describe('Postcard card front component', () => {test('renders the postcard name and status badge in the record preview', async ({page,}) => {- await page.goto(`${resolveWorkspaceUrl()}/object/postCard/${RECORD_ID}`);+ await page.goto(`${resolveE2eWorkspaceUrl()}/object/postCard/${RECORD_ID}`);const card = page.getByTestId(CARD_TEST_IDS.root);await expect(card).toBeVisible();diff --git a/packages/twenty-apps/examples/postcard/e2e/shared-dependencies-bundle.spec.ts b/packages/twenty-apps/examples/postcard/e2e/shared-dependencies-bundle.spec.tsnew file mode 100644index 00000000000..c77c3197030--- /dev/null+++ b/packages/twenty-apps/examples/postcard/e2e/shared-dependencies-bundle.spec.ts@@ -0,0 +1,146 @@+import { expect, test, type Page, type Response } from '@playwright/test';++import { CARD_TEST_IDS } from '../src/components/card-test-ids';+import { resolveE2eWorkspaceUrl } from './utils/resolve-e2e-workspace-url';++const RECORD_ID = process.env.E2E_POSTCARD_RECORD_ID;++const FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER = 'twenty:front-component-shared-dependencies';+const REACT_LICENSE_BANNER = '@license React';++const MIN_SHARED_DEPENDENCIES_BUNDLE_BYTES = 50_000;+const MAX_COMPONENT_TO_SHARED_DEPENDENCIES_RATIO = 1 / 2;++const resolveJavaScriptBody = async (+ page: Page,+ response: Response,+): Promise<Buffer> => {+ const contentType = response.headers()['content-type'] ?? '';++ if (contentType.includes('application/json')) {+ const { url } = (await response.json()) as { url: string };+ const redirectedResponse = await page.request.get(url);++ return Buffer.from(await redirectedResponse.body());+ }++ return response.body();+};++const findCardComponentBundleBody = async (+ page: Page,+ frontComponentResponses: Response[],+): Promise<Buffer | null> => {+ for (const response of frontComponentResponses) {+ if (response.status() !== 200) {+ continue;+ }++ const body = await resolveJavaScriptBody(page, response);++ if (body.toString('utf-8').includes(CARD_TEST_IDS.root)) {+ return body;+ }+ }++ return null;+};++test.describe('Postcard shared dependencies bundle', () => {+ test.beforeAll(() => {+ if (!RECORD_ID) {+ throw new Error(+ 'E2E_POSTCARD_RECORD_ID is required and must point to a seeded postcard record. ' ++ 'Ensure the postcard app is installed and a record exists before running this test.',+ );+ }+ });++ test.beforeEach(({ page }) => {+ page.on('console', (message) => {+ console.log(`[browser:${message.type()}] ${message.text()}`);+ });++ page.on('pageerror', (error) => {+ console.log(`[pageerror] ${error.message}\n${error.stack ?? ''}`);+ });++ page.on('requestfailed', (request) => {+ console.log(+ `[requestfailed] ${request.method()} ${request.url()} — ${+ request.failure()?.errorText ?? 'unknown error'+ }`,+ );+ });++ page.on('response', (response) => {+ if (response.status() >= 400) {+ console.log(+ `[response ${response.status()}] ${response+ .request()+ .method()} ${response.url()}`,+ );+ }+ });++ page.on('worker', (worker) => {+ console.log(`[worker started] ${worker.url()}`);+ });+ });++ test('serves the shared dependencies bundle and keeps react out of the component bundle', async ({+ page,+ }) => {+ const sharedDependenciesResponses: Response[] = [];+ const frontComponentResponses: Response[] = [];++ page.on('response', (response) => {+ const url = response.url();++ if (url.includes('/rest/front-component-shared-dependencies/')) {+ sharedDependenciesResponses.push(response);+ }++ if (url.includes('/rest/front-components/')) {+ frontComponentResponses.push(response);+ }+ });++ await page.goto(`${resolveE2eWorkspaceUrl()}/object/postCard/${RECORD_ID}`);++ const card = page.getByTestId(CARD_TEST_IDS.root);+ await expect(card).toBeVisible();+ await expect(card.getByTestId(CARD_TEST_IDS.name)).toHaveCount(1);++ expect(sharedDependenciesResponses.length).toBeGreaterThan(0);++ const sharedDependenciesResponse = sharedDependenciesResponses[0];+ expect(sharedDependenciesResponse.status()).toBe(200);+ expect(sharedDependenciesResponse.url()).toMatch(+ /\/rest\/front-component-shared-dependencies\/[0-9a-f-]{36}\/[0-9a-f]{64}\.js$/,+ );++ const sharedDependenciesBundleBody = await resolveJavaScriptBody(+ page,+ sharedDependenciesResponse,+ );+ expect(sharedDependenciesBundleBody.byteLength).toBeGreaterThan(+ MIN_SHARED_DEPENDENCIES_BUNDLE_BYTES,+ );++ const cardBundleBody = await findCardComponentBundleBody(+ page,+ frontComponentResponses,+ );+ expect(cardBundleBody).not.toBeNull();++ const cardBundleSource = (cardBundleBody as Buffer).toString('utf-8');+ expect(cardBundleSource).toContain(FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER);+ expect(cardBundleSource).not.toContain(REACT_LICENSE_BANNER);++ expect((cardBundleBody as Buffer).byteLength).toBeLessThan(+ sharedDependenciesBundleBody.byteLength *+ MAX_COMPONENT_TO_SHARED_DEPENDENCIES_RATIO,+ );+ });+});diff --git a/packages/twenty-apps/examples/postcard/e2e/utils/resolve-e2e-workspace-url.ts b/packages/twenty-apps/examples/postcard/e2e/utils/resolve-e2e-workspace-url.tsnew file mode 100644index 00000000000..d85c1b7770d--- /dev/null+++ b/packages/twenty-apps/examples/postcard/e2e/utils/resolve-e2e-workspace-url.ts@@ -0,0 +1,25 @@+import * as fs from 'fs';+import * as path from 'path';++const WORKSPACE_ORIGIN_FILE = path.resolve(+ __dirname,+ '..',+ '.auth',+ 'workspace-origin.txt',+);++export const resolveE2eWorkspaceUrl = (): string => {+ const fromEnv = process.env.E2E_WORKSPACE_URL;+ if (fromEnv) {+ return fromEnv.replace(/\/$/, '');+ }++ try {+ return fs+ .readFileSync(WORKSPACE_ORIGIN_FILE, 'utf8')+ .trim()+ .replace(/\/$/, '');+ } catch {+ return 'http://app.localhost:3001';+ }+};diff --git a/packages/twenty-apps/examples/postcard/package.json b/packages/twenty-apps/examples/postcard/package.jsonindex 9309c70264b..76d6bcfcfbd 100644--- a/packages/twenty-apps/examples/postcard/package.json+++ b/packages/twenty-apps/examples/postcard/package.json@@ -12,6 +12,7 @@"twenty-app"],"packageManager": "[email protected]",+ "frontComponentSharedDependencies": ["react", "react-dom/client"],"scripts": {"twenty": "twenty","lint": "oxlint -c .oxlintrc.json .",diff --git a/packages/twenty-apps/fixtures/shared-dependencies-app/.gitignore b/packages/twenty-apps/fixtures/shared-dependencies-app/.gitignorenew file mode 100644index 00000000000..ec984e99cb8--- /dev/null+++ b/packages/twenty-apps/fixtures/shared-dependencies-app/.gitignore@@ -0,0 +1,3 @@+generated+.twenty+node_modulesdiff --git a/packages/twenty-apps/fixtures/shared-dependencies-app/.oxlintrc.json b/packages/twenty-apps/fixtures/shared-dependencies-app/.oxlintrc.jsonnew file mode 100644index 00000000000..87c62c51832--- /dev/null+++ b/packages/twenty-apps/fixtures/shared-dependencies-app/.oxlintrc.json@@ -0,0 +1,19 @@+{+ "$schema": "./node_modules/oxlint/configuration_schema.json",+ "plugins": ["typescript"],+ "categories": {+ "correctness": "off"+ },+ "ignorePatterns": ["node_modules", "dist"],+ "rules": {+ "no-unused-vars": "off",++ "typescript/no-unused-vars": [+ "warn",+ {+ "argsIgnorePattern": "^_"+ }+ ],+ "typescript/no-explicit-any": "off"+ }+}diff --git a/packages/twenty-apps/fixtures/shared-dependencies-app/application.config.ts b/packages/twenty-apps/fixtures/shared-dependencies-app/application.config.tsnew file mode 100644index 00000000000..092e0ecb1c3--- /dev/null+++ b/packages/twenty-apps/fixtures/shared-dependencies-app/application.config.ts@@ -0,0 +1,8 @@+import { defineApplication } from 'twenty-sdk/define';++export default defineApplication({+ universalIdentifier: 'e1e2e3e4-e5e6-4000-8000-000000000101',+ displayName: 'Shared Dependencies App',+ description: 'An app sharing dependencies across its front components',+ defaultRoleUniversalIdentifier: 'e1e2e3e4-e5e6-4000-8000-000000000102',+});diff --git a/packages/twenty-apps/fixtures/shared-dependencies-app/my.role.ts b/packages/twenty-apps/fixtures/shared-dependencies-app/my.role.tsnew file mode 100644index 00000000000..0ff01295452--- /dev/null+++ b/packages/twenty-apps/fixtures/shared-dependencies-app/my.role.ts@@ -0,0 +1,15 @@+import { defineRole } from 'twenty-sdk/define';++export default defineRole({+ universalIdentifier: 'e1e2e3e4-e5e6-4000-8000-000000000102',+ label: 'Shared dependencies app role',+ description: 'The default role of the shared dependencies app',+ canReadAllObjectRecords: true,+ canUpdateAllObjectRecords: false,+ canSoftDeleteAllObjectRecords: false,+ canDestroyAllObjectRecords: false,+ canUpdateAllSettings: false,+ canBeAssignedToAgents: false,+ canBeAssignedToUsers: true,+ canBeAssignedToApiKeys: false,+});diff --git a/packages/twenty-apps/fixtures/shared-dependencies-app/package.json b/packages/twenty-apps/fixtures/shared-dependencies-app/package.jsonnew file mode 100644index 00000000000..2123d8b789a--- /dev/null+++ b/packages/twenty-apps/fixtures/shared-dependencies-app/package.json@@ -0,0 +1,29 @@+{+ "name": "shared-dependencies-app",+ "version": "0.1.0",+ "license": "MIT",+ "engines": {+ "node": "^24.5.0",+ "npm": "please-use-yarn",+ "yarn": ">=4.0.2"+ },+ "packageManager": "[email protected]",+ "frontComponentSharedDependencies": ["react", "react-dom/client"],+ "scripts": {+ "twenty": "twenty",+ "lint": "oxlint -c .oxlintrc.json .",+ "lint:fix": "oxlint --fix -c .oxlintrc.json ."+ },+ "dependencies": {+ "twenty-sdk": "latest",+ "twenty-client-sdk": "latest"+ },+ "devDependencies": {+ "typescript": "^5.9.3",+ "@types/node": "^24.7.2",+ "@types/react": "^19.0.2",+ "react": "^19.2.7",+ "react-dom": "^19.2.7",+ "oxlint": "^0.16.0"+ }+}diff --git a/packages/twenty-apps/fixtures/shared-dependencies-app/src/counter.front-component.tsx b/packages/twenty-apps/fixtures/shared-dependencies-app/src/counter.front-component.tsxnew file mode 100644index 00000000000..44e8f5d406b--- /dev/null+++ b/packages/twenty-apps/fixtures/shared-dependencies-app/src/counter.front-component.tsx@@ -0,0 +1,20 @@+import { useState } from 'react';+import { defineFrontComponent } from 'twenty-sdk/define';++export const Counter = () => {+ const [count, setCount] = useState(0);++ return (+ <div>+ <span>{count}</span>+ <button onClick={() => setCount(count + 1)}>Increment</button>+ </div>+ );+};++export default defineFrontComponent({+ universalIdentifier: 'e1e2e3e4-e5e6-4000-8000-000000000103',+ name: 'counter',+ description: 'A component relying on the shared react',+ component: Counter,+});diff --git a/packages/twenty-apps/fixtures/shared-dependencies-app/tsconfig.json b/packages/twenty-apps/fixtures/shared-dependencies-app/tsconfig.jsonnew file mode 100644index 00000000000..97050faf758--- /dev/null+++ b/packages/twenty-apps/fixtures/shared-dependencies-app/tsconfig.json@@ -0,0 +1,17 @@+{+ "compilerOptions": {+ "target": "ES2020",+ "module": "ESNext",+ "moduleResolution": "bundler",+ "strict": true,+ "esModuleInterop": true,+ "skipLibCheck": true,+ "jsx": "react-jsx",+ "baseUrl": ".",+ "paths": {+ "src/*": ["./src/*"]+ }+ },+ "include": ["**/*"],+ "exclude": ["node_modules", "dist", ".twenty"]+}diff --git a/packages/twenty-apps/fixtures/shared-dependencies-app/yarn.lock b/packages/twenty-apps/fixtures/shared-dependencies-app/yarn.locknew file mode 100644index 00000000000..e69de29bb2ddiff --git a/packages/twenty-client-sdk/src/metadata/generated/schema.graphql b/packages/twenty-client-sdk/src/metadata/generated/schema.graphqlindex 9f00375333d..a91ba4bb0f9 100644--- a/packages/twenty-client-sdk/src/metadata/generated/schema.graphql+++ b/packages/twenty-client-sdk/src/metadata/generated/schema.graphql@@ -109,6 +109,7 @@ type FrontComponent {usesSdkClient: Boolean!applicationTokenPair: ApplicationTokenPairapplicationVariables: JSON+ frontComponentSharedDependenciesChecksum: String}type CommandMenuItem {diff --git a/packages/twenty-client-sdk/src/metadata/generated/schema.ts b/packages/twenty-client-sdk/src/metadata/generated/schema.tsindex 192984fc7ae..92401db3771 100644--- a/packages/twenty-client-sdk/src/metadata/generated/schema.ts+++ b/packages/twenty-client-sdk/src/metadata/generated/schema.ts@@ -108,6 +108,7 @@ export interface FrontComponent {usesSdkClient: Scalars['Boolean']applicationTokenPair?: ApplicationTokenPairapplicationVariables?: Scalars['JSON']+ frontComponentSharedDependenciesChecksum?: Scalars['String']__typename: 'FrontComponent'}@@ -3339,6 +3340,7 @@ export interface FrontComponentGenqlSelection{usesSdkClient?: boolean | numberapplicationTokenPair?: ApplicationTokenPairGenqlSelectionapplicationVariables?: boolean | number+ frontComponentSharedDependenciesChecksum?: boolean | number__typename?: boolean | number__scalar?: boolean | number}diff --git a/packages/twenty-client-sdk/src/metadata/generated/types.ts b/packages/twenty-client-sdk/src/metadata/generated/types.tsindex 789c7d33b36..531235be0d7 100644--- a/packages/twenty-client-sdk/src/metadata/generated/types.ts+++ b/packages/twenty-client-sdk/src/metadata/generated/types.ts@@ -344,6 +344,9 @@ export default {"applicationVariables": [5],+ "frontComponentSharedDependenciesChecksum": [+ 1+ ],"__typename": [1]diff --git a/packages/twenty-docs/developers/extend/apps/getting-started/concepts.mdx b/packages/twenty-docs/developers/extend/apps/getting-started/concepts.mdxindex 0e78b9d7126..8e89c6449f0 100644--- a/packages/twenty-docs/developers/extend/apps/getting-started/concepts.mdx+++ b/packages/twenty-docs/developers/extend/apps/getting-started/concepts.mdx@@ -49,6 +49,7 @@ your-app/| **Navigation Menu Item** | Custom sidebar entries | [Navigation Menu Items](/developers/extend/apps/layout/navigation-menu-items) || **Page Layout** | Tabs and widgets on a record's detail page | [Page Layouts](/developers/extend/apps/layout/page-layouts) || **Front Component** | Sandboxed React UI inside Twenty | [Front Components](/developers/extend/apps/layout/front-components) |+| **Shared Dependencies** | Dependencies shared by the app's front components, declared in package.json | [Shared Dependencies](/developers/extend/apps/layout/front-components#sharing-dependencies-across-front-components) || **Command Menu Item** | Quick actions and Cmd+K entries | [Command Menu Items](/developers/extend/apps/layout/command-menu-items) |## Sandboxingdiff --git a/packages/twenty-docs/developers/extend/apps/layout/front-components.mdx b/packages/twenty-docs/developers/extend/apps/layout/front-components.mdxindex c29a65b0a04..d3ad9295e5d 100644--- a/packages/twenty-docs/developers/extend/apps/layout/front-components.mdx+++ b/packages/twenty-docs/developers/extend/apps/layout/front-components.mdx@@ -601,6 +601,43 @@ export default defineFrontComponent({See the [public assets section](/developers/extend/apps/config/public-assets) for details.+## Sharing dependencies across front components++By default, every front component bundles its own copy of the libraries it imports, so an app with five components ships React five times. Declare shared dependencies in your app's `package.json` to build those libraries once and have every component of the app load them from a single cached file:++```json package.json+{+ "frontComponentSharedDependencies": ["react", "react-dom/client", "twenty-ui/input"]+}+```++Each component then imports its dependencies exactly as before — nothing changes in your component code:++```tsx src/front-components/counter.tsx+import { useState } from 'react';+import { defineFrontComponent } from 'twenty-sdk/define';++const Counter = () => {+ const [count, setCount] = useState(0);++ return <button onClick={() => setCount(count + 1)}>{count}</button>;+};++export default defineFrontComponent({+ universalIdentifier: '...',+ name: 'counter',+ component: Counter,+});+```++A few things to know:++- **One shared dependencies bundle per app.** The bundle is built from your app's own dependencies, so you keep full control of the versions you ship.+- **List the exact specifiers you import.** `twenty-ui/input` and `twenty-ui/display` are two entries; a package name alone does not cover its subpaths. Listing `react` automatically covers `react/jsx-runtime`.+- **Share `react-dom/client` alongside `react`.** Every component renders through `createRoot`, so leaving it out means each component still bundles React DOM.+- **The bundle is cached.** It is served under a content-hash URL with a long-lived immutable cache, so it is downloaded once and reused across all components of the app until one of its dependencies changes.+- **Components that import none of the shared packages never download it.**+## StylingFront components support multiple styling approaches. You can use:diff --git a/packages/twenty-docs/developers/extend/apps/operations/testing.mdx b/packages/twenty-docs/developers/extend/apps/operations/testing.mdxindex 762939d64aa..03bf56e336a 100644--- a/packages/twenty-docs/developers/extend/apps/operations/testing.mdx+++ b/packages/twenty-docs/developers/extend/apps/operations/testing.mdx@@ -8,7 +8,7 @@ The SDK provides programmatic APIs that let you build, deploy, install, and unin## Using npm packages-You can install and use any npm package in your app. Both logic functions and front components are bundled with [esbuild](https://esbuild.github.io/), which inlines all dependencies into the output — no `node_modules` are needed at runtime.+You can install and use any npm package in your app. Both logic functions and front components are bundled with [esbuild](https://esbuild.github.io/), which inlines their dependencies into the output — no `node_modules` are needed at runtime.### Installing a package@@ -56,7 +56,7 @@ export default defineFrontComponent({### How bundling works-The build step uses esbuild to produce a single self-contained file per logic function and per front component. All imported packages are inlined into the bundle.+The build step uses esbuild to produce a single self-contained file per logic function and per front component. Imported packages are inlined into the bundle, except for the ones listed below.**Logic functions** run in a Node.js environment. Node built-in modules (`fs`, `path`, `crypto`, `http`, etc.) are available and do not need to be installed.@@ -64,6 +64,8 @@ The build step uses esbuild to produce a single self-contained file per logic fuBoth environments have `twenty-client-sdk/core` and `twenty-client-sdk/metadata` available as pre-provided modules — these are not bundled but resolved at runtime by the server.+Front components can also share dependencies through a [shared dependencies bundle](/developers/extend/apps/layout/front-components#sharing-dependencies-across-front-components). Packages listed in the `frontComponentSharedDependencies` field of the app's package.json are built once into a separate file and loaded from it at runtime instead of being inlined into each component, so a component that imports only shared packages carries almost no dependency code of its own.+## SetupThe scaffolded app already includes Vitest. If you set it up manually, install the dependencies:diff --git a/packages/twenty-front-component-renderer/src/host/components/FrontComponentRenderer.tsx b/packages/twenty-front-component-renderer/src/host/components/FrontComponentRenderer.tsxindex 5124f325a54..b7fbef0008c 100644--- a/packages/twenty-front-component-renderer/src/host/components/FrontComponentRenderer.tsx+++ b/packages/twenty-front-component-renderer/src/host/components/FrontComponentRenderer.tsx@@ -34,6 +34,7 @@ type FrontComponentRendererProps = {apiUrl?: string;functionsBaseUrl?: string;sdkClientUrls?: SdkClientUrls;+ sharedDependenciesUrl?: string;applicationVariables?: Record<string, string>;executionContext: FrontComponentExecutionContext;frontComponentHostCommunicationApi: FrontComponentHostCommunicationApi;@@ -48,6 +49,7 @@ export const FrontComponentRenderer = ({apiUrl,functionsBaseUrl,sdkClientUrls,+ sharedDependenciesUrl,applicationVariables,executionContext,frontComponentHostCommunicationApi,@@ -73,6 +75,7 @@ export const FrontComponentRenderer = ({apiUrl={apiUrl}functionsBaseUrl={functionsBaseUrl}sdkClientUrls={sdkClientUrls}+ sharedDependenciesUrl={sharedDependenciesUrl}applicationVariables={applicationVariables}geometryTracker={geometryTracker}setReceiver={setReceiver}diff --git a/packages/twenty-front-component-renderer/src/host/utils/__tests__/fetchComponentSource.spec.ts b/packages/twenty-front-component-renderer/src/host/utils/__tests__/fetchComponentSource.spec.tsindex 303da49c419..b0ebbce295d 100644--- a/packages/twenty-front-component-renderer/src/host/utils/__tests__/fetchComponentSource.spec.ts+++ b/packages/twenty-front-component-renderer/src/host/utils/__tests__/fetchComponentSource.spec.ts@@ -15,6 +15,17 @@ const FINGERPRINTED_URL = buildFingerprintedUrl(computeSha256Hex(COMPONENT_SOURCE),);const BARE_URL = 'https://api.twenty.com/rest/front-components/component-id';++const SHARED_DEPENDENCIES_SOURCE =+ 'export const __shared_dependencies_react__ = {};';++const buildFingerprintedSharedDependenciesUrl = (checksum: string): string =>+ `https://api.twenty.com/rest/front-component-shared-dependencies/application-id/${checksum}.js`;++const FINGERPRINTED_SHARED_DEPENDENCIES_URL =+ buildFingerprintedSharedDependenciesUrl(+ computeSha256Hex(SHARED_DEPENDENCIES_SOURCE),+ );const LEGACY_MD5_URL = buildFingerprintedUrl(createHash('md5').update(COMPONENT_SOURCE).digest('hex'),);@@ -247,6 +258,43 @@ describe('fetchComponentSource', () => {expect(cache.put).not.toHaveBeenCalled();});+ it('evicts the previous shared dependencies bundle of the same application only', async () => {+ const cache = new FakeCache();++ const staleSharedDependenciesUrl = buildFingerprintedSharedDependenciesUrl(+ computeSha256Hex('previous shared dependencies build'),+ );+ const otherApplicationSharedDependenciesUrl =+ 'https://api.twenty.com/rest/front-component-shared-dependencies/other-application-id/0000000000000000000000000000000000000000000000000000000000000000.js';++ await cache.put(staleSharedDependenciesUrl, {+ text: async () => 'previous shared dependencies build',+ });+ await cache.put(otherApplicationSharedDependenciesUrl, {+ text: async () => 'other application shared dependencies',+ });+ cache.put.mockClear();++ setupCaches(cache);++ const fetchMock = jest.fn(async () =>+ createFakeJsResponse(SHARED_DEPENDENCIES_SOURCE),+ );++ globalThis.fetch = fetchMock as unknown as typeof fetch;++ await fetchComponentSource({ url: FINGERPRINTED_SHARED_DEPENDENCIES_URL });++ await new Promise((resolve) => setTimeout(resolve, 0));++ expect(cache.delete).toHaveBeenCalledWith({+ url: staleSharedDependenciesUrl,+ });+ expect(cache.delete).not.toHaveBeenCalledWith({+ url: otherApplicationSharedDependenciesUrl,+ });+ });+it('never touches the cache for a non-fingerprinted URL', async () => {const cache = new FakeCache();diff --git a/packages/twenty-front-component-renderer/src/host/utils/buildHostFetchPolicyFromFrontComponentUrls.ts b/packages/twenty-front-component-renderer/src/host/utils/buildHostFetchPolicyFromFrontComponentUrls.tsindex 064591a5778..c338760b76c 100644--- a/packages/twenty-front-component-renderer/src/host/utils/buildHostFetchPolicyFromFrontComponentUrls.ts+++ b/packages/twenty-front-component-renderer/src/host/utils/buildHostFetchPolicyFromFrontComponentUrls.ts@@ -9,6 +9,7 @@ type BuildHostFetchPolicyInput = {apiUrl?: string;functionsBaseUrl?: string;sdkClientUrls?: SdkClientUrls;+ sharedDependenciesUrl?: string;};export const buildHostFetchPolicyFromFrontComponentUrls = ({@@ -16,17 +17,20 @@ export const buildHostFetchPolicyFromFrontComponentUrls = ({apiUrl,functionsBaseUrl,sdkClientUrls,+ sharedDependenciesUrl,}: BuildHostFetchPolicyInput): HostFetchPolicy => {const allowedOrigins = getUniqueHttpOriginsFromUrls([apiUrl,functionsBaseUrl,componentUrl,+ sharedDependenciesUrl,]);const fileStorageRedirectableUrls = [componentUrl,sdkClientUrls?.core,sdkClientUrls?.metadata,+ sharedDependenciesUrl,].filter(isDefined);return { allowedOrigins, fileStorageRedirectableUrls };diff --git a/packages/twenty-front-component-renderer/src/remote/components/FrontComponentWorkerEffect.tsx b/packages/twenty-front-component-renderer/src/remote/components/FrontComponentWorkerEffect.tsxindex c03bd42e4e6..840248d19e8 100644--- a/packages/twenty-front-component-renderer/src/remote/components/FrontComponentWorkerEffect.tsx+++ b/packages/twenty-front-component-renderer/src/remote/components/FrontComponentWorkerEffect.tsx@@ -16,6 +16,7 @@ import { type FrontComponentThread } from '@/types/FrontComponentThread';import { type SdkClientUrls } from '@/types/SdkClientUrls';import { buildAuthorizationHeadersFromAccessToken } from '@/utils/buildAuthorizationHeadersFromAccessToken';import { containsSdkClientImportSpecifier } from '@/utils/containsSdkClientImportSpecifier';+import { containsSharedDependenciesImportSpecifier } from '@/utils/containsSharedDependenciesImportSpecifier';type FrontComponentWorkerEffectProps = {componentUrl: string;@@ -23,6 +24,7 @@ type FrontComponentWorkerEffectProps = {apiUrl?: string;functionsBaseUrl?: string;sdkClientUrls?: SdkClientUrls;+ sharedDependenciesUrl?: string;applicationVariables?: Record<string, string>;geometryTracker: GeometryTracker;setReceiver: React.Dispatch<React.SetStateAction<RemoteReceiver | null>>;@@ -36,6 +38,7 @@ export const FrontComponentWorkerEffect = ({apiUrl,functionsBaseUrl,sdkClientUrls,+ sharedDependenciesUrl,applicationVariables,geometryTracker,setReceiver,@@ -63,6 +66,7 @@ export const FrontComponentWorkerEffect = ({apiUrl,functionsBaseUrl,sdkClientUrls,+ sharedDependenciesUrl,});const hostFetch = createHostFetchEnforcingPolicy(hostFetchPolicy);@@ -100,14 +104,22 @@ export const FrontComponentWorkerEffect = ({return;}- const sdkClientSources =+ const [sdkClientSources, sharedDependenciesSource] = await Promise.all([isDefined(sdkClientUrls) &&containsSdkClientImportSpecifier(componentSource)- ? await fetchSdkClientSources({+ ? fetchSdkClientSources({sdkClientUrls,headers: authorizationHeaders,})- : undefined;+ : undefined,+ isDefined(sharedDependenciesUrl) &&+ containsSharedDependenciesImportSpecifier(componentSource)+ ? fetchComponentSource({+ url: sharedDependenciesUrl,+ headers: authorizationHeaders,+ })+ : undefined,+ ]);if (isCancelled) {return;@@ -120,6 +132,7 @@ export const FrontComponentWorkerEffect = ({apiUrl,functionsBaseUrl,sdkClientSources,+ sharedDependenciesSource,hostFetchOrigins: hostFetchPolicy.allowedOrigins,applicationVariables,initialViewportGeometry: geometryTracker.getViewportGeometry(),@@ -150,6 +163,7 @@ export const FrontComponentWorkerEffect = ({apiUrl,functionsBaseUrl,sdkClientUrls,+ sharedDependenciesUrl,applicationVariables,geometryTracker,setError,diff --git a/packages/twenty-front-component-renderer/src/remote/worker/utils/__tests__/loadFrontComponentModule.test.ts b/packages/twenty-front-component-renderer/src/remote/worker/utils/__tests__/loadFrontComponentModule.test.tsnew file mode 100644index 00000000000..ed3f2b8a910--- /dev/null+++ b/packages/twenty-front-component-renderer/src/remote/worker/utils/__tests__/loadFrontComponentModule.test.ts@@ -0,0 +1,15 @@+import { FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER } from 'twenty-shared/application';++import { loadFrontComponentModule } from '../loadFrontComponentModule';++describe('loadFrontComponentModule', () => {+ it('should fail closed when the component needs a shared dependencies bundle that was not provided', async () => {+ await expect(+ loadFrontComponentModule({+ componentSource: `import { __shared_dependencies_react__ } from "${FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER}";\nexport default () => {};`,+ }),+ ).rejects.toMatchObject({+ code: 'FRONT_COMPONENT_SHARED_DEPENDENCIES_MISSING',+ });+ });+});diff --git a/packages/twenty-front-component-renderer/src/remote/worker/utils/__tests__/rewriteModuleImportsToBlobUrls.test.ts b/packages/twenty-front-component-renderer/src/remote/worker/utils/__tests__/rewriteModuleImportsToBlobUrls.test.tsnew file mode 100644index 00000000000..1113bd71d31--- /dev/null+++ b/packages/twenty-front-component-renderer/src/remote/worker/utils/__tests__/rewriteModuleImportsToBlobUrls.test.ts@@ -0,0 +1,93 @@+import { FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER } from 'twenty-shared/application';++import { rewriteModuleImportsToBlobUrls } from '../rewriteModuleImportsToBlobUrls';++const blobUrlBySpecifier = {+ [FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER]:+ 'blob:shared-dependencies-url',+ 'twenty-client-sdk/core': 'blob:core-url',+ 'twenty-client-sdk/metadata': 'blob:metadata-url',+};++describe('rewriteModuleImportsToBlobUrls', () => {+ it('should rewrite every specifier of the map to its blob url', () => {+ const source = `import { __shared_dependencies_react__ } from "${FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER}";\nimport { CoreApiClient } from 'twenty-client-sdk/core';\nimport { MetadataApiClient } from "twenty-client-sdk/metadata";`;++ expect(rewriteModuleImportsToBlobUrls(source, blobUrlBySpecifier)).toBe(+ 'import { __shared_dependencies_react__ } from "blob:shared-dependencies-url";\nimport { CoreApiClient } from \'blob:core-url\';\nimport { MetadataApiClient } from "blob:metadata-url";',+ );+ });++ it('should rewrite minified imports without whitespace', () => {+ const source = `import{__shared_dependencies_react__}from"${FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER}";`;++ expect(rewriteModuleImportsToBlobUrls(source, blobUrlBySpecifier)).toBe(+ 'import{__shared_dependencies_react__}from"blob:shared-dependencies-url";',+ );+ });++ it('should rewrite export from statements', () => {+ const source = 'export { CoreApiClient } from "twenty-client-sdk/core";';++ expect(rewriteModuleImportsToBlobUrls(source, blobUrlBySpecifier)).toBe(+ 'export { CoreApiClient } from "blob:core-url";',+ );+ });++ it('should rewrite a deferred import of the shared dependencies bundle', () => {+ const source = `const sharedDependencies = await import('${FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER}');`;++ expect(rewriteModuleImportsToBlobUrls(source, blobUrlBySpecifier)).toBe(+ "const sharedDependencies = await import('blob:shared-dependencies-url');",+ );+ });++ it('should rewrite a side effect only import of the shared dependencies bundle', () => {+ const source = `import "${FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER}";`;++ expect(rewriteModuleImportsToBlobUrls(source, blobUrlBySpecifier)).toBe(+ 'import "blob:shared-dependencies-url";',+ );+ });++ it('should rewrite every occurrence when a specifier appears multiple times', () => {+ const source =+ 'import "twenty-client-sdk/core";\nconst lazy = () => import("twenty-client-sdk/core");';++ expect(rewriteModuleImportsToBlobUrls(source, blobUrlBySpecifier)).toBe(+ 'import "blob:core-url";\nconst lazy = () => import("blob:core-url");',+ );+ });++ it('should leave a source without any mapped specifier unchanged', () => {+ const source = 'export const answer = 42;';++ expect(rewriteModuleImportsToBlobUrls(source, blobUrlBySpecifier)).toBe(+ source,+ );+ });++ it('should not rewrite a specifier that is a prefix of a longer specifier', () => {+ const source = 'import "twenty-client-sdk/core-utils";';++ expect(rewriteModuleImportsToBlobUrls(source, blobUrlBySpecifier)).toBe(+ source,+ );+ });++ it('should not rewrite a specifier that only appears as a string literal', () => {+ const source = `const specifier = "${FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER}";`;++ expect(rewriteModuleImportsToBlobUrls(source, blobUrlBySpecifier)).toBe(+ source,+ );+ });++ it('should not rewrite a specifier inside a template literal', () => {+ const source = 'const specifier = `twenty-client-sdk/core`;';++ expect(rewriteModuleImportsToBlobUrls(source, blobUrlBySpecifier)).toBe(+ source,+ );+ });+});diff --git a/packages/twenty-front-component-renderer/src/remote/worker/utils/__tests__/rewriteSdkClientImportsToBlobUrls.test.ts b/packages/twenty-front-component-renderer/src/remote/worker/utils/__tests__/rewriteSdkClientImportsToBlobUrls.test.tsdeleted file mode 100644index c320704f7e2..00000000000--- a/packages/twenty-front-component-renderer/src/remote/worker/utils/__tests__/rewriteSdkClientImportsToBlobUrls.test.ts+++ /dev/null@@ -1,82 +0,0 @@-import { rewriteSdkClientImportsToBlobUrls } from '../rewriteSdkClientImportsToBlobUrls';--const sdkModuleBlobUrls = {- core: 'blob:core-url',- metadata: 'blob:metadata-url',-};--describe('rewriteSdkClientImportsToBlobUrls', () => {- it('should rewrite double quoted core and metadata specifiers to blob urls', () => {- const source =- 'import { CoreApiClient } from "twenty-client-sdk/core";\nimport { MetadataApiClient } from "twenty-client-sdk/metadata";';-- expect(rewriteSdkClientImportsToBlobUrls(source, sdkModuleBlobUrls)).toBe(- 'import { CoreApiClient } from "blob:core-url";\nimport { MetadataApiClient } from "blob:metadata-url";',- );- });-- it('should rewrite single quoted specifiers', () => {- const source = "import { CoreApiClient } from 'twenty-client-sdk/core';";-- expect(rewriteSdkClientImportsToBlobUrls(source, sdkModuleBlobUrls)).toBe(- "import { CoreApiClient } from 'blob:core-url';",- );- });-- it('should rewrite every occurrence when a specifier appears multiple times', () => {- const source =- 'import "twenty-client-sdk/core";\nconst lazy = () => import("twenty-client-sdk/core");';-- expect(rewriteSdkClientImportsToBlobUrls(source, sdkModuleBlobUrls)).toBe(- 'import "blob:core-url";\nconst lazy = () => import("blob:core-url");',- );- });-- it('should leave sources without sdk specifiers unchanged', () => {- const source = 'export const answer = 42;';-- expect(rewriteSdkClientImportsToBlobUrls(source, sdkModuleBlobUrls)).toBe(- source,- );- });-- it('should not rewrite specifiers that are a prefix of a longer specifier', () => {- const source = 'import "twenty-client-sdk/core-utils";';-- expect(rewriteSdkClientImportsToBlobUrls(source, sdkModuleBlobUrls)).toBe(- source,- );- });-- it('should not rewrite the specifier without surrounding quotes', () => {- const source = 'const specifier = `twenty-client-sdk/core`;';-- expect(rewriteSdkClientImportsToBlobUrls(source, sdkModuleBlobUrls)).toBe(- source,- );- });-- it('should not rewrite the specifier inside a plain string literal', () => {- const source = 'const specifierName = "twenty-client-sdk/core";';-- expect(rewriteSdkClientImportsToBlobUrls(source, sdkModuleBlobUrls)).toBe(- source,- );- });-- it('should rewrite export from statements', () => {- const source = 'export { CoreApiClient } from "twenty-client-sdk/core";';-- expect(rewriteSdkClientImportsToBlobUrls(source, sdkModuleBlobUrls)).toBe(- 'export { CoreApiClient } from "blob:core-url";',- );- });-- it('should rewrite minified imports without whitespace', () => {- const source = 'import{CoreApiClient}from"twenty-client-sdk/core";';-- expect(rewriteSdkClientImportsToBlobUrls(source, sdkModuleBlobUrls)).toBe(- 'import{CoreApiClient}from"blob:core-url";',- );- });-});diff --git a/packages/twenty-front-component-renderer/src/remote/worker/utils/buildBlobUrlBySpecifier.ts b/packages/twenty-front-component-renderer/src/remote/worker/utils/buildBlobUrlBySpecifier.tsnew file mode 100644index 00000000000..352794af408--- /dev/null+++ b/packages/twenty-front-component-renderer/src/remote/worker/utils/buildBlobUrlBySpecifier.ts@@ -0,0 +1,24 @@+import { type SdkClientUrls } from '@/types/SdkClientUrls';+import { FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER } from 'twenty-shared/application';+import { isDefined } from 'twenty-shared/utils';++export const buildBlobUrlBySpecifier = ({+ sdkModuleBlobUrls,+ sharedDependenciesModuleBlobUrl,+}: {+ sdkModuleBlobUrls: SdkClientUrls | null;+ sharedDependenciesModuleBlobUrl: string | null;+}): Record<string, string> => ({+ ...(isDefined(sdkModuleBlobUrls)+ ? {+ 'twenty-client-sdk/core': sdkModuleBlobUrls.core,+ 'twenty-client-sdk/metadata': sdkModuleBlobUrls.metadata,+ }+ : {}),+ ...(isDefined(sharedDependenciesModuleBlobUrl)+ ? {+ [FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER]:+ sharedDependenciesModuleBlobUrl,+ }+ : {}),+});diff --git a/packages/twenty-front-component-renderer/src/remote/worker/utils/loadFrontComponentModule.ts b/packages/twenty-front-component-renderer/src/remote/worker/utils/loadFrontComponentModule.tsindex bfc3447cd80..506315aa17a 100644--- a/packages/twenty-front-component-renderer/src/remote/worker/utils/loadFrontComponentModule.ts+++ b/packages/twenty-front-component-renderer/src/remote/worker/utils/loadFrontComponentModule.ts@@ -1,14 +1,17 @@-import { isDefined } from 'twenty-shared/utils';+import { CustomError, isDefined } from 'twenty-shared/utils';+import { buildBlobUrlBySpecifier } from '@/remote/worker/utils/buildBlobUrlBySpecifier';import { createJavaScriptModuleBlobUrl } from '@/remote/worker/utils/createJavaScriptModuleBlobUrl';import { createSdkClientModuleBlobUrls } from '@/remote/worker/utils/createSdkClientModuleBlobUrls';import { revokeSdkClientModuleBlobUrls } from '@/remote/worker/utils/revokeSdkClientModuleBlobUrls';-import { rewriteSdkClientImportsToBlobUrls } from '@/remote/worker/utils/rewriteSdkClientImportsToBlobUrls';+import { rewriteModuleImportsToBlobUrls } from '@/remote/worker/utils/rewriteModuleImportsToBlobUrls';import { type SdkClientSources } from '@/types/SdkClientSources';+import { containsSharedDependenciesImportSpecifier } from '@/utils/containsSharedDependenciesImportSpecifier';type LoadFrontComponentModuleInput = {componentSource: string;sdkClientSources?: SdkClientSources;+ sharedDependenciesSource?: string;};type FrontComponentModule = {@@ -18,14 +21,34 @@ type FrontComponentModule = {export const loadFrontComponentModule = async ({componentSource,sdkClientSources,+ sharedDependenciesSource,}: LoadFrontComponentModuleInput): Promise<FrontComponentModule> => {+ const requiresSharedDependencies =+ containsSharedDependenciesImportSpecifier(componentSource);++ if (requiresSharedDependencies && !isDefined(sharedDependenciesSource)) {+ throw new CustomError(+ 'The front component imports its shared dependencies bundle, but none was provided',+ 'FRONT_COMPONENT_SHARED_DEPENDENCIES_MISSING',+ );+ }+const sdkModuleBlobUrls = isDefined(sdkClientSources)? createSdkClientModuleBlobUrls(sdkClientSources): null;- const componentModuleSource = isDefined(sdkModuleBlobUrls)- ? rewriteSdkClientImportsToBlobUrls(componentSource, sdkModuleBlobUrls)- : componentSource;+ const sharedDependenciesModuleBlobUrl =+ requiresSharedDependencies && isDefined(sharedDependenciesSource)+ ? createJavaScriptModuleBlobUrl(sharedDependenciesSource)+ : null;++ const componentModuleSource = rewriteModuleImportsToBlobUrls(+ componentSource,+ buildBlobUrlBySpecifier({+ sdkModuleBlobUrls,+ sharedDependenciesModuleBlobUrl,+ }),+ );const componentModuleBlobUrl = createJavaScriptModuleBlobUrl(componentModuleSource,@@ -37,6 +60,10 @@ export const loadFrontComponentModule = async ({} finally {URL.revokeObjectURL(componentModuleBlobUrl);+ if (isDefined(sharedDependenciesModuleBlobUrl)) {+ URL.revokeObjectURL(sharedDependenciesModuleBlobUrl);+ }+if (isDefined(sdkModuleBlobUrls)) {revokeSdkClientModuleBlobUrls(sdkModuleBlobUrls);}diff --git a/packages/twenty-front-component-renderer/src/remote/worker/utils/renderFrontComponent.ts b/packages/twenty-front-component-renderer/src/remote/worker/utils/renderFrontComponent.tsindex d3c9c649c6a..3d60b1122eb 100644--- a/packages/twenty-front-component-renderer/src/remote/worker/utils/renderFrontComponent.ts+++ b/packages/twenty-front-component-renderer/src/remote/worker/utils/renderFrontComponent.ts@@ -42,6 +42,7 @@ export const renderFrontComponent = async ({const componentModule = await loadFrontComponentModule({componentSource: renderContext.componentSource,sdkClientSources: renderContext.sdkClientSources,+ sharedDependenciesSource: renderContext.sharedDependenciesSource,});componentModule.default(renderContainer);diff --git a/packages/twenty-front-component-renderer/src/remote/worker/utils/rewriteModuleImportsToBlobUrls.ts b/packages/twenty-front-component-renderer/src/remote/worker/utils/rewriteModuleImportsToBlobUrls.tsnew file mode 100644index 00000000000..599698bc5dd--- /dev/null+++ b/packages/twenty-front-component-renderer/src/remote/worker/utils/rewriteModuleImportsToBlobUrls.ts@@ -0,0 +1,18 @@+import { buildModuleImportContextPattern } from '@/utils/buildModuleImportContextPattern';++export const rewriteModuleImportsToBlobUrls = (+ source: string,+ blobUrlBySpecifier: Record<string, string>,+): string => {+ let rewrittenSource = source;++ for (const [specifier, blobUrl] of Object.entries(blobUrlBySpecifier)) {+ rewrittenSource = rewrittenSource.replace(+ buildModuleImportContextPattern(specifier),+ (_fullMatch, importContext: string, quote: string) =>+ `${importContext}${quote}${blobUrl}${quote}`,+ );+ }++ return rewrittenSource;+};diff --git a/packages/twenty-front-component-renderer/src/remote/worker/utils/rewriteSdkClientImportsToBlobUrls.ts b/packages/twenty-front-component-renderer/src/remote/worker/utils/rewriteSdkClientImportsToBlobUrls.tsdeleted file mode 100644index 3adbcdd58ed..00000000000--- a/packages/twenty-front-component-renderer/src/remote/worker/utils/rewriteSdkClientImportsToBlobUrls.ts+++ /dev/null@@ -1,28 +0,0 @@-import { type SDK_CLIENT_IMPORT_SPECIFIERS } from '@/constants/SdkClientImportSpecifiers';-import { type SdkClientUrls } from '@/types/SdkClientUrls';-import { buildSdkClientImportContextPattern } from '@/utils/buildSdkClientImportContextPattern';--export const rewriteSdkClientImportsToBlobUrls = (- source: string,- sdkModuleBlobUrls: SdkClientUrls,-): string => {- const specifierToBlobUrl: Record<- (typeof SDK_CLIENT_IMPORT_SPECIFIERS)[number],- string- > = {- 'twenty-client-sdk/core': sdkModuleBlobUrls.core,- 'twenty-client-sdk/metadata': sdkModuleBlobUrls.metadata,- };-- let rewrittenSource = source;-- for (const [specifier, blobUrl] of Object.entries(specifierToBlobUrl)) {- rewrittenSource = rewrittenSource.replace(- buildSdkClientImportContextPattern(specifier),- (_fullMatch, importContext: string, quote: string) =>- `${importContext}${quote}${blobUrl}${quote}`,- );- }-- return rewrittenSource;-};diff --git a/packages/twenty-front-component-renderer/src/types/HostToWorkerRenderContext.ts b/packages/twenty-front-component-renderer/src/types/HostToWorkerRenderContext.tsindex b69adf8aedf..d1b828038cd 100644--- a/packages/twenty-front-component-renderer/src/types/HostToWorkerRenderContext.ts+++ b/packages/twenty-front-component-renderer/src/types/HostToWorkerRenderContext.ts@@ -8,6 +8,7 @@ export type HostToWorkerRenderContext = {apiUrl?: string;functionsBaseUrl?: string;sdkClientSources?: SdkClientSources;+ sharedDependenciesSource?: string;hostFetchOrigins?: string[];applicationVariables?: Record<string, string>;initialViewportGeometry?: ViewportGeometrySnapshot;diff --git a/packages/twenty-front-component-renderer/src/utils/__tests__/containsSharedDependenciesImportSpecifier.test.ts b/packages/twenty-front-component-renderer/src/utils/__tests__/containsSharedDependenciesImportSpecifier.test.tsnew file mode 100644index 00000000000..963c8664ddf--- /dev/null+++ b/packages/twenty-front-component-renderer/src/utils/__tests__/containsSharedDependenciesImportSpecifier.test.ts@@ -0,0 +1,35 @@+import { FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER } from 'twenty-shared/application';++import { containsSharedDependenciesImportSpecifier } from '../containsSharedDependenciesImportSpecifier';++describe('containsSharedDependenciesImportSpecifier', () => {+ it('should detect a static import of the shared dependencies bundle', () => {+ expect(+ containsSharedDependenciesImportSpecifier(+ `import { __shared_dependencies_react__ } from "${FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER}";`,+ ),+ ).toBe(true);+ });++ it('should detect a dynamic import of the shared dependencies bundle', () => {+ expect(+ containsSharedDependenciesImportSpecifier(+ `const sharedDependencies = await import('${FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER}');`,+ ),+ ).toBe(true);+ });++ it('should not detect the specifier outside of an import context', () => {+ expect(+ containsSharedDependenciesImportSpecifier(+ `const specifier = "${FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER}";`,+ ),+ ).toBe(false);+ });++ it('should not detect anything in a component that bundles its dependencies', () => {+ expect(+ containsSharedDependenciesImportSpecifier('export default () => null;'),+ ).toBe(false);+ });+});diff --git a/packages/twenty-front-component-renderer/src/utils/buildSdkClientImportContextPattern.ts b/packages/twenty-front-component-renderer/src/utils/buildModuleImportContextPattern.tssimilarity index 73%rename from packages/twenty-front-component-renderer/src/utils/buildSdkClientImportContextPattern.tsrename to packages/twenty-front-component-renderer/src/utils/buildModuleImportContextPattern.tsindex 20d03bea811..d1ee4c2eedd 100644--- a/packages/twenty-front-component-renderer/src/utils/buildSdkClientImportContextPattern.ts+++ b/packages/twenty-front-component-renderer/src/utils/buildModuleImportContextPattern.ts@@ -1,7 +1,7 @@const escapeRegExpToken = (value: string): string =>value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');-export const buildSdkClientImportContextPattern = (specifier: string): RegExp =>+export const buildModuleImportContextPattern = (specifier: string): RegExp =>new RegExp(`(\\bfrom\\s*|\\bimport\\s*\\(\\s*|\\bimport\\s*)(["'])${escapeRegExpToken(specifier)}\\2`,'g',diff --git a/packages/twenty-front-component-renderer/src/utils/containsSdkClientImportSpecifier.ts b/packages/twenty-front-component-renderer/src/utils/containsSdkClientImportSpecifier.tsindex d31763aeb2d..4ef7776c421 100644--- a/packages/twenty-front-component-renderer/src/utils/containsSdkClientImportSpecifier.ts+++ b/packages/twenty-front-component-renderer/src/utils/containsSdkClientImportSpecifier.ts@@ -1,7 +1,7 @@import { SDK_CLIENT_IMPORT_SPECIFIERS } from '@/constants/SdkClientImportSpecifiers';-import { buildSdkClientImportContextPattern } from '@/utils/buildSdkClientImportContextPattern';+import { buildModuleImportContextPattern } from '@/utils/buildModuleImportContextPattern';export const containsSdkClientImportSpecifier = (source: string): boolean =>SDK_CLIENT_IMPORT_SPECIFIERS.some((specifier) =>- buildSdkClientImportContextPattern(specifier).test(source),+ buildModuleImportContextPattern(specifier).test(source),);diff --git a/packages/twenty-front-component-renderer/src/utils/containsSharedDependenciesImportSpecifier.ts b/packages/twenty-front-component-renderer/src/utils/containsSharedDependenciesImportSpecifier.tsnew file mode 100644index 00000000000..4e6d0b2ec75--- /dev/null+++ b/packages/twenty-front-component-renderer/src/utils/containsSharedDependenciesImportSpecifier.ts@@ -0,0 +1,9 @@+import { buildModuleImportContextPattern } from '@/utils/buildModuleImportContextPattern';+import { FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER } from 'twenty-shared/application';++export const containsSharedDependenciesImportSpecifier = (+ source: string,+): boolean =>+ buildModuleImportContextPattern(+ FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER,+ ).test(source);diff --git a/packages/twenty-front/src/generated-metadata/graphql.ts b/packages/twenty-front/src/generated-metadata/graphql.tsindex 0acf680b8fc..77e3991f416 100644--- a/packages/twenty-front/src/generated-metadata/graphql.ts+++ b/packages/twenty-front/src/generated-metadata/graphql.ts@@ -2041,6 +2041,7 @@ export type FrontComponent = {componentName: Scalars['String']['output'];createdAt: Scalars['DateTime']['output'];description?: Maybe<Scalars['String']['output']>;+ frontComponentSharedDependenciesChecksum?: Maybe<Scalars['String']['output']>;id: Scalars['UUID']['output'];isHeadless: Scalars['Boolean']['output'];name: Scalars['String']['output'];@@ -7064,7 +7065,7 @@ export type TrackAnalyticsMutationVariables = Exact<{export type TrackAnalyticsMutation = { __typename?: 'Mutation', trackAnalytics: { __typename?: 'Analytics', success: boolean } };-export type ApplicationFieldsFragment = { __typename?: 'Application', id: string, name: string, description?: string | null, logoUrl?: string | null, version?: string | null, universalIdentifier: string, applicationRegistrationId?: string | null, canBeUninstalled: boolean, autoUpgrade: boolean, defaultRoleId?: string | null, settingsCustomTabFrontComponentId?: string | null, availablePackages: any, applicationRegistration?: { __typename?: 'ApplicationRegistrationSummary', id: string, latestAvailableVersion?: string | null, sourceType: ApplicationRegistrationSourceType, logoUrl?: string | null } | null, applicationVariables: Array<{ __typename?: 'ApplicationVariable', id: string, key: string, value: string, description: string, isSecret: boolean, type: string, options?: any | null }>, agents: Array<{ __typename?: 'Agent', id: string, name: string, label: string, description?: string | null, icon?: string | null, prompt: string, modelId: string, responseFormat?: any | null, roleId?: string | null, isCustom: boolean, modelConfiguration?: any | null, evaluationInputs: Array<string>, applicationId?: string | null, createdAt: string, updatedAt: string }>, frontComponents: Array<{ __typename?: 'FrontComponent', id: string, name: string, description?: string | null, applicationId: string, componentName: string, builtComponentChecksum: string, universalIdentifier?: string | null, isHeadless: boolean, usesSdkClient: boolean, createdAt: string, updatedAt: string }>, commandMenuItems: Array<{ __typename?: 'CommandMenuItem', id: string, label: string, shortLabel?: string | null, icon?: string | null, isPinned: boolean, availabilityType: CommandMenuItemAvailabilityType, conditionalAvailabilityExpression?: string | null, frontComponentId?: string | null, universalIdentifier?: string | null, applicationId?: string | null, createdAt: string, updatedAt: string }>, objects: Array<{ __typename?: 'Object', id: string, universalIdentifier: string, nameSingular: string, namePlural: string, labelSingular: string, labelPlural: string, color?: string | null, description?: string | null, icon?: string | null, isRemote: boolean, isActive: boolean, isSystem: boolean, isUIEditable: boolean, isUICreatable: boolean, createdAt: string, updatedAt: string, labelIdentifierFieldMetadataId?: string | null, imageIdentifierFieldMetadataId?: string | null, applicationId: string, shortcut?: string | null, isLabelSyncedWithName: boolean, isSearchable: boolean, openRecordIn: ObjectOpenRecordIn, duplicateCriteria?: Array<Array<string>> | null, searchFieldMetadataList: Array<{ __typename?: 'SearchField', id: string, fieldMetadataId: string, tsVectorFieldMetadataId: string, position: number, createdAt: string, updatedAt: string }>, indexMetadataList: Array<{ __typename?: 'Index', id: string, createdAt: string, updatedAt: string, name: string, indexWhereClause?: string | null, indexType: IndexType, isUnique: boolean, isCustom?: boolean | null, indexFieldMetadataList: Array<{ __typename?: 'IndexField', id: string, fieldMetadataId: string, subFieldName?: string | null, createdAt: string, updatedAt: string, order: number }> }>, fieldsList: Array<{ __typename?: 'Field', id: string, universalIdentifier: string, type: FieldMetadataType, name: string, label: string, description?: string | null, icon?: string | null, isActive?: boolean | null, isSystem?: boolean | null, isUIEditable?: boolean | null, isNullable?: boolean | null, isUnique?: boolean | null, createdAt: string, updatedAt: string, defaultValue?: any | null, options?: any | null, settings?: any | null, isLabelSyncedWithName?: boolean | null, morphId?: string | null, applicationId: string, relation?: { __typename?: 'Relation', type: RelationType, sourceObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, targetObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, sourceFieldMetadata: { __typename?: 'Field', id: string, name: string }, targetFieldMetadata: { __typename?: 'Field', id: string, name: string } } | null, morphRelations?: Array<{ __typename?: 'Relation', type: RelationType, sourceObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, targetObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, sourceFieldMetadata: { __typename?: 'Field', id: string, name: string }, targetFieldMetadata: { __typename?: 'Field', id: string, name: string } }> | null }> }>, logicFunctions: Array<{ __typename?: 'LogicFunction', id: string, name: string, description?: string | null, runtime: string, timeoutSeconds: number, executionMode: LogicFunctionExecutionMode, sourceHandlerPath: string, handlerName: string, cronTriggerSettings?: any | null, databaseEventTriggerSettings?: any | null, httpRouteTriggerSettings?: any | null, toolTriggerSettings?: any | null, workflowActionTriggerSettings?: any | null, applicationId?: string | null, universalIdentifier?: string | null, createdAt: string, updatedAt: string }> };+export type ApplicationFieldsFragment = { __typename?: 'Application', id: string, name: string, description?: string | null, logoUrl?: string | null, version?: string | null, universalIdentifier: string, applicationRegistrationId?: string | null, canBeUninstalled: boolean, autoUpgrade: boolean, defaultRoleId?: string | null, settingsCustomTabFrontComponentId?: string | null, availablePackages: any, applicationRegistration?: { __typename?: 'ApplicationRegistrationSummary', id: string, latestAvailableVersion?: string | null, sourceType: ApplicationRegistrationSourceType, logoUrl?: string | null } | null, applicationVariables: Array<{ __typename?: 'ApplicationVariable', id: string, key: string, value: string, description: string, isSecret: boolean, type: string, options?: any | null }>, agents: Array<{ __typename?: 'Agent', id: string, name: string, label: string, description?: string | null, icon?: string | null, prompt: string, modelId: string, responseFormat?: any | null, roleId?: string | null, isCustom: boolean, modelConfiguration?: any | null, evaluationInputs: Array<string>, applicationId?: string | null, createdAt: string, updatedAt: string }>, frontComponents: Array<{ __typename?: 'FrontComponent', id: string, name: string, description?: string | null, applicationId: string, componentName: string, builtComponentChecksum: string, universalIdentifier?: string | null, isHeadless: boolean, usesSdkClient: boolean, frontComponentSharedDependenciesChecksum?: string | null, createdAt: string, updatedAt: string }>, commandMenuItems: Array<{ __typename?: 'CommandMenuItem', id: string, label: string, shortLabel?: string | null, icon?: string | null, isPinned: boolean, availabilityType: CommandMenuItemAvailabilityType, conditionalAvailabilityExpression?: string | null, frontComponentId?: string | null, universalIdentifier?: string | null, applicationId?: string | null, createdAt: string, updatedAt: string }>, objects: Array<{ __typename?: 'Object', id: string, universalIdentifier: string, nameSingular: string, namePlural: string, labelSingular: string, labelPlural: string, color?: string | null, description?: string | null, icon?: string | null, isRemote: boolean, isActive: boolean, isSystem: boolean, isUIEditable: boolean, isUICreatable: boolean, createdAt: string, updatedAt: string, labelIdentifierFieldMetadataId?: string | null, imageIdentifierFieldMetadataId?: string | null, applicationId: string, shortcut?: string | null, isLabelSyncedWithName: boolean, isSearchable: boolean, openRecordIn: ObjectOpenRecordIn, duplicateCriteria?: Array<Array<string>> | null, searchFieldMetadataList: Array<{ __typename?: 'SearchField', id: string, fieldMetadataId: string, tsVectorFieldMetadataId: string, position: number, createdAt: string, updatedAt: string }>, indexMetadataList: Array<{ __typename?: 'Index', id: string, createdAt: string, updatedAt: string, name: string, indexWhereClause?: string | null, indexType: IndexType, isUnique: boolean, isCustom?: boolean | null, indexFieldMetadataList: Array<{ __typename?: 'IndexField', id: string, fieldMetadataId: string, subFieldName?: string | null, createdAt: string, updatedAt: string, order: number }> }>, fieldsList: Array<{ __typename?: 'Field', id: string, universalIdentifier: string, type: FieldMetadataType, name: string, label: string, description?: string | null, icon?: string | null, isActive?: boolean | null, isSystem?: boolean | null, isUIEditable?: boolean | null, isNullable?: boolean | null, isUnique?: boolean | null, createdAt: string, updatedAt: string, defaultValue?: any | null, options?: any | null, settings?: any | null, isLabelSyncedWithName?: boolean | null, morphId?: string | null, applicationId: string, relation?: { __typename?: 'Relation', type: RelationType, sourceObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, targetObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, sourceFieldMetadata: { __typename?: 'Field', id: string, name: string }, targetFieldMetadata: { __typename?: 'Field', id: string, name: string } } | null, morphRelations?: Array<{ __typename?: 'Relation', type: RelationType, sourceObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, targetObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, sourceFieldMetadata: { __typename?: 'Field', id: string, name: string }, targetFieldMetadata: { __typename?: 'Field', id: string, name: string } }> | null }> }>, logicFunctions: Array<{ __typename?: 'LogicFunction', id: string, name: string, description?: string | null, runtime: string, timeoutSeconds: number, executionMode: LogicFunctionExecutionMode, sourceHandlerPath: string, handlerName: string, cronTriggerSettings?: any | null, databaseEventTriggerSettings?: any | null, httpRouteTriggerSettings?: any | null, toolTriggerSettings?: any | null, workflowActionTriggerSettings?: any | null, applicationId?: string | null, universalIdentifier?: string | null, createdAt: string, updatedAt: string }> };export type FindManyApplicationsQueryVariables = Exact<{ [key: string]: never; }>;@@ -7076,7 +7077,7 @@ export type FindOneApplicationQueryVariables = Exact<{}>;-export type FindOneApplicationQuery = { __typename?: 'Query', findOneApplication: { __typename?: 'Application', id: string, name: string, description?: string | null, logoUrl?: string | null, version?: string | null, universalIdentifier: string, applicationRegistrationId?: string | null, canBeUninstalled: boolean, autoUpgrade: boolean, defaultRoleId?: string | null, settingsCustomTabFrontComponentId?: string | null, availablePackages: any, applicationRegistration?: { __typename?: 'ApplicationRegistrationSummary', id: string, latestAvailableVersion?: string | null, sourceType: ApplicationRegistrationSourceType, logoUrl?: string | null } | null, applicationVariables: Array<{ __typename?: 'ApplicationVariable', id: string, key: string, value: string, description: string, isSecret: boolean, type: string, options?: any | null }>, agents: Array<{ __typename?: 'Agent', id: string, name: string, label: string, description?: string | null, icon?: string | null, prompt: string, modelId: string, responseFormat?: any | null, roleId?: string | null, isCustom: boolean, modelConfiguration?: any | null, evaluationInputs: Array<string>, applicationId?: string | null, createdAt: string, updatedAt: string }>, frontComponents: Array<{ __typename?: 'FrontComponent', id: string, name: string, description?: string | null, applicationId: string, componentName: string, builtComponentChecksum: string, universalIdentifier?: string | null, isHeadless: boolean, usesSdkClient: boolean, createdAt: string, updatedAt: string }>, commandMenuItems: Array<{ __typename?: 'CommandMenuItem', id: string, label: string, shortLabel?: string | null, icon?: string | null, isPinned: boolean, availabilityType: CommandMenuItemAvailabilityType, conditionalAvailabilityExpression?: string | null, frontComponentId?: string | null, universalIdentifier?: string | null, applicationId?: string | null, createdAt: string, updatedAt: string }>, objects: Array<{ __typename?: 'Object', id: string, universalIdentifier: string, nameSingular: string, namePlural: string, labelSingular: string, labelPlural: string, color?: string | null, description?: string | null, icon?: string | null, isRemote: boolean, isActive: boolean, isSystem: boolean, isUIEditable: boolean, isUICreatable: boolean, createdAt: string, updatedAt: string, labelIdentifierFieldMetadataId?: string | null, imageIdentifierFieldMetadataId?: string | null, applicationId: string, shortcut?: string | null, isLabelSyncedWithName: boolean, isSearchable: boolean, openRecordIn: ObjectOpenRecordIn, duplicateCriteria?: Array<Array<string>> | null, searchFieldMetadataList: Array<{ __typename?: 'SearchField', id: string, fieldMetadataId: string, tsVectorFieldMetadataId: string, position: number, createdAt: string, updatedAt: string }>, indexMetadataList: Array<{ __typename?: 'Index', id: string, createdAt: string, updatedAt: string, name: string, indexWhereClause?: string | null, indexType: IndexType, isUnique: boolean, isCustom?: boolean | null, indexFieldMetadataList: Array<{ __typename?: 'IndexField', id: string, fieldMetadataId: string, subFieldName?: string | null, createdAt: string, updatedAt: string, order: number }> }>, fieldsList: Array<{ __typename?: 'Field', id: string, universalIdentifier: string, type: FieldMetadataType, name: string, label: string, description?: string | null, icon?: string | null, isActive?: boolean | null, isSystem?: boolean | null, isUIEditable?: boolean | null, isNullable?: boolean | null, isUnique?: boolean | null, createdAt: string, updatedAt: string, defaultValue?: any | null, options?: any | null, settings?: any | null, isLabelSyncedWithName?: boolean | null, morphId?: string | null, applicationId: string, relation?: { __typename?: 'Relation', type: RelationType, sourceObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, targetObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, sourceFieldMetadata: { __typename?: 'Field', id: string, name: string }, targetFieldMetadata: { __typename?: 'Field', id: string, name: string } } | null, morphRelations?: Array<{ __typename?: 'Relation', type: RelationType, sourceObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, targetObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, sourceFieldMetadata: { __typename?: 'Field', id: string, name: string }, targetFieldMetadata: { __typename?: 'Field', id: string, name: string } }> | null }> }>, logicFunctions: Array<{ __typename?: 'LogicFunction', id: string, name: string, description?: string | null, runtime: string, timeoutSeconds: number, executionMode: LogicFunctionExecutionMode, sourceHandlerPath: string, handlerName: string, cronTriggerSettings?: any | null, databaseEventTriggerSettings?: any | null, httpRouteTriggerSettings?: any | null, toolTriggerSettings?: any | null, workflowActionTriggerSettings?: any | null, applicationId?: string | null, universalIdentifier?: string | null, createdAt: string, updatedAt: string }> } };+export type FindOneApplicationQuery = { __typename?: 'Query', findOneApplication: { __typename?: 'Application', id: string, name: string, description?: string | null, logoUrl?: string | null, version?: string | null, universalIdentifier: string, applicationRegistrationId?: string | null, canBeUninstalled: boolean, autoUpgrade: boolean, defaultRoleId?: string | null, settingsCustomTabFrontComponentId?: string | null, availablePackages: any, applicationRegistration?: { __typename?: 'ApplicationRegistrationSummary', id: string, latestAvailableVersion?: string | null, sourceType: ApplicationRegistrationSourceType, logoUrl?: string | null } | null, applicationVariables: Array<{ __typename?: 'ApplicationVariable', id: string, key: string, value: string, description: string, isSecret: boolean, type: string, options?: any | null }>, agents: Array<{ __typename?: 'Agent', id: string, name: string, label: string, description?: string | null, icon?: string | null, prompt: string, modelId: string, responseFormat?: any | null, roleId?: string | null, isCustom: boolean, modelConfiguration?: any | null, evaluationInputs: Array<string>, applicationId?: string | null, createdAt: string, updatedAt: string }>, frontComponents: Array<{ __typename?: 'FrontComponent', id: string, name: string, description?: string | null, applicationId: string, componentName: string, builtComponentChecksum: string, universalIdentifier?: string | null, isHeadless: boolean, usesSdkClient: boolean, frontComponentSharedDependenciesChecksum?: string | null, createdAt: string, updatedAt: string }>, commandMenuItems: Array<{ __typename?: 'CommandMenuItem', id: string, label: string, shortLabel?: string | null, icon?: string | null, isPinned: boolean, availabilityType: CommandMenuItemAvailabilityType, conditionalAvailabilityExpression?: string | null, frontComponentId?: string | null, universalIdentifier?: string | null, applicationId?: string | null, createdAt: string, updatedAt: string }>, objects: Array<{ __typename?: 'Object', id: string, universalIdentifier: string, nameSingular: string, namePlural: string, labelSingular: string, labelPlural: string, color?: string | null, description?: string | null, icon?: string | null, isRemote: boolean, isActive: boolean, isSystem: boolean, isUIEditable: boolean, isUICreatable: boolean, createdAt: string, updatedAt: string, labelIdentifierFieldMetadataId?: string | null, imageIdentifierFieldMetadataId?: string | null, applicationId: string, shortcut?: string | null, isLabelSyncedWithName: boolean, isSearchable: boolean, openRecordIn: ObjectOpenRecordIn, duplicateCriteria?: Array<Array<string>> | null, searchFieldMetadataList: Array<{ __typename?: 'SearchField', id: string, fieldMetadataId: string, tsVectorFieldMetadataId: string, position: number, createdAt: string, updatedAt: string }>, indexMetadataList: Array<{ __typename?: 'Index', id: string, createdAt: string, updatedAt: string, name: string, indexWhereClause?: string | null, indexType: IndexType, isUnique: boolean, isCustom?: boolean | null, indexFieldMetadataList: Array<{ __typename?: 'IndexField', id: string, fieldMetadataId: string, subFieldName?: string | null, createdAt: string, updatedAt: string, order: number }> }>, fieldsList: Array<{ __typename?: 'Field', id: string, universalIdentifier: string, type: FieldMetadataType, name: string, label: string, description?: string | null, icon?: string | null, isActive?: boolean | null, isSystem?: boolean | null, isUIEditable?: boolean | null, isNullable?: boolean | null, isUnique?: boolean | null, createdAt: string, updatedAt: string, defaultValue?: any | null, options?: any | null, settings?: any | null, isLabelSyncedWithName?: boolean | null, morphId?: string | null, applicationId: string, relation?: { __typename?: 'Relation', type: RelationType, sourceObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, targetObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, sourceFieldMetadata: { __typename?: 'Field', id: string, name: string }, targetFieldMetadata: { __typename?: 'Field', id: string, name: string } } | null, morphRelations?: Array<{ __typename?: 'Relation', type: RelationType, sourceObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, targetObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, sourceFieldMetadata: { __typename?: 'Field', id: string, name: string }, targetFieldMetadata: { __typename?: 'Field', id: string, name: string } }> | null }> }>, logicFunctions: Array<{ __typename?: 'LogicFunction', id: string, name: string, description?: string | null, runtime: string, timeoutSeconds: number, executionMode: LogicFunctionExecutionMode, sourceHandlerPath: string, handlerName: string, cronTriggerSettings?: any | null, databaseEventTriggerSettings?: any | null, httpRouteTriggerSettings?: any | null, toolTriggerSettings?: any | null, workflowActionTriggerSettings?: any | null, applicationId?: string | null, universalIdentifier?: string | null, createdAt: string, updatedAt: string }> } };export type FindOneApplicationByUniversalIdentifierQueryVariables = Exact<{universalIdentifier: Scalars['UUID']['input'];@@ -7567,14 +7568,14 @@ export type RenewApplicationTokenMutation = { __typename?: 'Mutation', renewApplexport type FindManyFrontComponentsQueryVariables = Exact<{ [key: string]: never; }>;-export type FindManyFrontComponentsQuery = { __typename?: 'Query', frontComponents: Array<{ __typename?: 'FrontComponent', id: string, name: string, applicationId: string, builtComponentChecksum: string, builtComponentPath: string, componentName: string, createdAt: string, description?: string | null, isHeadless: boolean, sourceComponentPath: string, universalIdentifier?: string | null, updatedAt: string, usesSdkClient: boolean }> };+export type FindManyFrontComponentsQuery = { __typename?: 'Query', frontComponents: Array<{ __typename?: 'FrontComponent', id: string, name: string, applicationId: string, builtComponentChecksum: string, builtComponentPath: string, componentName: string, createdAt: string, description?: string | null, isHeadless: boolean, sourceComponentPath: string, universalIdentifier?: string | null, updatedAt: string, usesSdkClient: boolean, frontComponentSharedDependenciesChecksum?: string | null }> };export type FindOneFrontComponentQueryVariables = Exact<{id: Scalars['UUID']['input'];}>;-export type FindOneFrontComponentQuery = { __typename?: 'Query', frontComponent?: { __typename?: 'FrontComponent', id: string, name: string, applicationId: string, builtComponentChecksum: string, isHeadless: boolean, usesSdkClient: boolean, applicationVariables?: any | null, applicationTokenPair?: { __typename?: 'ApplicationTokenPair', applicationAccessToken: { __typename?: 'AuthToken', token: string, expiresAt: string }, applicationRefreshToken: { __typename?: 'AuthToken', token: string, expiresAt: string } } | null } | null };+export type FindOneFrontComponentQuery = { __typename?: 'Query', frontComponent?: { __typename?: 'FrontComponent', id: string, name: string, applicationId: string, builtComponentChecksum: string, isHeadless: boolean, usesSdkClient: boolean, frontComponentSharedDependenciesChecksum?: string | null, applicationVariables?: any | null, applicationTokenPair?: { __typename?: 'ApplicationTokenPair', applicationAccessToken: { __typename?: 'AuthToken', token: string, expiresAt: string }, applicationRefreshToken: { __typename?: 'AuthToken', token: string, expiresAt: string } } | null } | null };export type GetApplicationSdkClientChecksumsQueryVariables = Exact<{applicationId: Scalars['UUID']['input'];@@ -9359,7 +9360,7 @@ export const SkillFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":export const AgentFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Agent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"prompt"}},{"kind":"Field","name":{"kind":"Name","value":"modelId"}},{"kind":"Field","name":{"kind":"Name","value":"responseFormat"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"modelConfiguration"}},{"kind":"Field","name":{"kind":"Name","value":"evaluationInputs"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<AgentFieldsFragment, unknown>;export const ObjectMetadataFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ObjectMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Object"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}},{"kind":"Field","name":{"kind":"Name","value":"labelSingular"}},{"kind":"Field","name":{"kind":"Name","value":"labelPlural"}},{"kind":"Field","name":{"kind":"Name","value":"color"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"isRemote"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isUIEditable"}},{"kind":"Field","name":{"kind":"Name","value":"isUICreatable"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"labelIdentifierFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"imageIdentifierFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"shortcut"}},{"kind":"Field","name":{"kind":"Name","value":"isLabelSyncedWithName"}},{"kind":"Field","name":{"kind":"Name","value":"isSearchable"}},{"kind":"Field","name":{"kind":"Name","value":"openRecordIn"}},{"kind":"Field","name":{"kind":"Name","value":"duplicateCriteria"}},{"kind":"Field","name":{"kind":"Name","value":"searchFieldMetadataList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"tsVectorFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"indexMetadataList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"indexWhereClause"}},{"kind":"Field","name":{"kind":"Name","value":"indexType"}},{"kind":"Field","name":{"kind":"Name","value":"isUnique"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"indexFieldMetadataList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"subFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"order"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"fieldsList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isUIEditable"}},{"kind":"Field","name":{"kind":"Name","value":"isNullable"}},{"kind":"Field","name":{"kind":"Name","value":"isUnique"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"defaultValue"}},{"kind":"Field","name":{"kind":"Name","value":"options"}},{"kind":"Field","name":{"kind":"Name","value":"settings"}},{"kind":"Field","name":{"kind":"Name","value":"isLabelSyncedWithName"}},{"kind":"Field","name":{"kind":"Name","value":"morphId"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"relation"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"sourceObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sourceFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"morphRelations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"sourceObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sourceFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}}]} as unknown as DocumentNode<ObjectMetadataFieldsFragment, unknown>;export const LogicFunctionFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"LogicFunctionFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"LogicFunction"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"runtime"}},{"kind":"Field","name":{"kind":"Name","value":"timeoutSeconds"}},{"kind":"Field","name":{"kind":"Name","value":"executionMode"}},{"kind":"Field","name":{"kind":"Name","value":"sourceHandlerPath"}},{"kind":"Field","name":{"kind":"Name","value":"handlerName"}},{"kind":"Field","name":{"kind":"Name","value":"cronTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"databaseEventTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"httpRouteTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"toolTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"workflowActionTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<LogicFunctionFieldsFragment, unknown>;-export const ApplicationFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ApplicationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Application"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"logoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"version"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"applicationRegistrationId"}},{"kind":"Field","name":{"kind":"Name","value":"applicationRegistration"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"latestAvailableVersion"}},{"kind":"Field","name":{"kind":"Name","value":"sourceType"}},{"kind":"Field","name":{"kind":"Name","value":"logoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"canBeUninstalled"}},{"kind":"Field","name":{"kind":"Name","value":"autoUpgrade"}},{"kind":"Field","name":{"kind":"Name","value":"defaultRoleId"}},{"kind":"Field","name":{"kind":"Name","value":"settingsCustomTabFrontComponentId"}},{"kind":"Field","name":{"kind":"Name","value":"availablePackages"}},{"kind":"Field","name":{"kind":"Name","value":"applicationVariables"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"value"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"isSecret"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"options"}}]}},{"kind":"Field","name":{"kind":"Name","value":"agents"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AgentFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"frontComponents"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"componentName"}},{"kind":"Field","name":{"kind":"Name","value":"builtComponentChecksum"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"isHeadless"}},{"kind":"Field","name":{"kind":"Name","value":"usesSdkClient"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"commandMenuItems"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"shortLabel"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"isPinned"}},{"kind":"Field","name":{"kind":"Name","value":"availabilityType"}},{"kind":"Field","name":{"kind":"Name","value":"conditionalAvailabilityExpression"}},{"kind":"Field","name":{"kind":"Name","value":"frontComponentId"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"objects"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ObjectMetadataFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"logicFunctions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"LogicFunctionFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Agent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"prompt"}},{"kind":"Field","name":{"kind":"Name","value":"modelId"}},{"kind":"Field","name":{"kind":"Name","value":"responseFormat"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"modelConfiguration"}},{"kind":"Field","name":{"kind":"Name","value":"evaluationInputs"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ObjectMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Object"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}},{"kind":"Field","name":{"kind":"Name","value":"labelSingular"}},{"kind":"Field","name":{"kind":"Name","value":"labelPlural"}},{"kind":"Field","name":{"kind":"Name","value":"color"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"isRemote"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isUIEditable"}},{"kind":"Field","name":{"kind":"Name","value":"isUICreatable"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"labelIdentifierFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"imageIdentifierFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"shortcut"}},{"kind":"Field","name":{"kind":"Name","value":"isLabelSyncedWithName"}},{"kind":"Field","name":{"kind":"Name","value":"isSearchable"}},{"kind":"Field","name":{"kind":"Name","value":"openRecordIn"}},{"kind":"Field","name":{"kind":"Name","value":"duplicateCriteria"}},{"kind":"Field","name":{"kind":"Name","value":"searchFieldMetadataList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"tsVectorFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"indexMetadataList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"indexWhereClause"}},{"kind":"Field","name":{"kind":"Name","value":"indexType"}},{"kind":"Field","name":{"kind":"Name","value":"isUnique"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"indexFieldMetadataList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"subFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"order"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"fieldsList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isUIEditable"}},{"kind":"Field","name":{"kind":"Name","value":"isNullable"}},{"kind":"Field","name":{"kind":"Name","value":"isUnique"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"defaultValue"}},{"kind":"Field","name":{"kind":"Name","value":"options"}},{"kind":"Field","name":{"kind":"Name","value":"settings"}},{"kind":"Field","name":{"kind":"Name","value":"isLabelSyncedWithName"}},{"kind":"Field","name":{"kind":"Name","value":"morphId"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"relation"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"sourceObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sourceFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"morphRelations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"sourceObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sourceFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"LogicFunctionFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"LogicFunction"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"runtime"}},{"kind":"Field","name":{"kind":"Name","value":"timeoutSeconds"}},{"kind":"Field","name":{"kind":"Name","value":"executionMode"}},{"kind":"Field","name":{"kind":"Name","value":"sourceHandlerPath"}},{"kind":"Field","name":{"kind":"Name","value":"handlerName"}},{"kind":"Field","name":{"kind":"Name","value":"cronTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"databaseEventTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"httpRouteTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"toolTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"workflowActionTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<ApplicationFieldsFragment, unknown>;+export const ApplicationFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ApplicationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Application"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"logoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"version"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"applicationRegistrationId"}},{"kind":"Field","name":{"kind":"Name","value":"applicationRegistration"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"latestAvailableVersion"}},{"kind":"Field","name":{"kind":"Name","value":"sourceType"}},{"kind":"Field","name":{"kind":"Name","value":"logoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"canBeUninstalled"}},{"kind":"Field","name":{"kind":"Name","value":"autoUpgrade"}},{"kind":"Field","name":{"kind":"Name","value":"defaultRoleId"}},{"kind":"Field","name":{"kind":"Name","value":"settingsCustomTabFrontComponentId"}},{"kind":"Field","name":{"kind":"Name","value":"availablePackages"}},{"kind":"Field","name":{"kind":"Name","value":"applicationVariables"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"value"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"isSecret"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"options"}}]}},{"kind":"Field","name":{"kind":"Name","value":"agents"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AgentFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"frontComponents"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"componentName"}},{"kind":"Field","name":{"kind":"Name","value":"builtComponentChecksum"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"isHeadless"}},{"kind":"Field","name":{"kind":"Name","value":"usesSdkClient"}},{"kind":"Field","name":{"kind":"Name","value":"frontComponentSharedDependenciesChecksum"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"commandMenuItems"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"shortLabel"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"isPinned"}},{"kind":"Field","name":{"kind":"Name","value":"availabilityType"}},{"kind":"Field","name":{"kind":"Name","value":"conditionalAvailabilityExpression"}},{"kind":"Field","name":{"kind":"Name","value":"frontComponentId"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"objects"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ObjectMetadataFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"logicFunctions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"LogicFunctionFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Agent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"prompt"}},{"kind":"Field","name":{"kind":"Name","value":"modelId"}},{"kind":"Field","name":{"kind":"Name","value":"responseFormat"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"modelConfiguration"}},{"kind":"Field","name":{"kind":"Name","value":"evaluationInputs"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ObjectMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Object"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}},{"kind":"Field","name":{"kind":"Name","value":"labelSingular"}},{"kind":"Field","name":{"kind":"Name","value":"labelPlural"}},{"kind":"Field","name":{"kind":"Name","value":"color"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"isRemote"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isUIEditable"}},{"kind":"Field","name":{"kind":"Name","value":"isUICreatable"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"labelIdentifierFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"imageIdentifierFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"shortcut"}},{"kind":"Field","name":{"kind":"Name","value":"isLabelSyncedWithName"}},{"kind":"Field","name":{"kind":"Name","value":"isSearchable"}},{"kind":"Field","name":{"kind":"Name","value":"openRecordIn"}},{"kind":"Field","name":{"kind":"Name","value":"duplicateCriteria"}},{"kind":"Field","name":{"kind":"Name","value":"searchFieldMetadataList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"tsVectorFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"indexMetadataList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"indexWhereClause"}},{"kind":"Field","name":{"kind":"Name","value":"indexType"}},{"kind":"Field","name":{"kind":"Name","value":"isUnique"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"indexFieldMetadataList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"subFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"order"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"fieldsList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isUIEditable"}},{"kind":"Field","name":{"kind":"Name","value":"isNullable"}},{"kind":"Field","name":{"kind":"Name","value":"isUnique"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"defaultValue"}},{"kind":"Field","name":{"kind":"Name","value":"options"}},{"kind":"Field","name":{"kind":"Name","value":"settings"}},{"kind":"Field","name":{"kind":"Name","value":"isLabelSyncedWithName"}},{"kind":"Field","name":{"kind":"Name","value":"morphId"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"relation"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"sourceObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sourceFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"morphRelations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"sourceObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sourceFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"LogicFunctionFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"LogicFunction"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"runtime"}},{"kind":"Field","name":{"kind":"Name","value":"timeoutSeconds"}},{"kind":"Field","name":{"kind":"Name","value":"executionMode"}},{"kind":"Field","name":{"kind":"Name","value":"sourceHandlerPath"}},{"kind":"Field","name":{"kind":"Name","value":"handlerName"}},{"kind":"Field","name":{"kind":"Name","value":"cronTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"databaseEventTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"httpRouteTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"toolTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"workflowActionTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<ApplicationFieldsFragment, unknown>;export const AuthTokenFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AuthTokenFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AuthToken"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"token"}},{"kind":"Field","name":{"kind":"Name","value":"expiresAt"}}]}}]} as unknown as DocumentNode<AuthTokenFragmentFragment, unknown>;export const AuthTokenPairFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AuthTokenPairFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AuthTokenPair"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessOrWorkspaceAgnosticToken"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AuthTokenFragment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"refreshToken"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AuthTokenFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AuthTokenFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AuthToken"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"token"}},{"kind":"Field","name":{"kind":"Name","value":"expiresAt"}}]}}]} as unknown as DocumentNode<AuthTokenPairFragmentFragment, unknown>;export const AvailableSsoIdentityProvidersFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AvailableSSOIdentityProvidersFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"FindAvailableSSOIDP"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"issuer"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"workspace"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}}]}}]}}]} as unknown as DocumentNode<AvailableSsoIdentityProvidersFragmentFragment, unknown>;@@ -9443,7 +9444,7 @@ export const GetToolInputSchemaDocument = {"kind":"Document","definitions":[{"kiexport const OnAgentChatEventDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"subscription","name":{"kind":"Name","value":"OnAgentChatEvent"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"onAgentChatEvent"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"threadId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"event"}}]}}]}}]} as unknown as DocumentNode<OnAgentChatEventSubscription, OnAgentChatEventSubscriptionVariables>;export const TrackAnalyticsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"TrackAnalytics"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"type"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"AnalyticsType"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"event"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"name"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"properties"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"JSON"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"trackAnalytics"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"type"},"value":{"kind":"Variable","name":{"kind":"Name","value":"type"}}},{"kind":"Argument","name":{"kind":"Name","value":"event"},"value":{"kind":"Variable","name":{"kind":"Name","value":"event"}}},{"kind":"Argument","name":{"kind":"Name","value":"name"},"value":{"kind":"Variable","name":{"kind":"Name","value":"name"}}},{"kind":"Argument","name":{"kind":"Name","value":"properties"},"value":{"kind":"Variable","name":{"kind":"Name","value":"properties"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"success"}}]}}]}}]} as unknown as DocumentNode<TrackAnalyticsMutation, TrackAnalyticsMutationVariables>;export const FindManyApplicationsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindManyApplications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"findManyApplications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"logoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"version"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"applicationRegistrationId"}},{"kind":"Field","name":{"kind":"Name","value":"applicationRegistration"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"latestAvailableVersion"}},{"kind":"Field","name":{"kind":"Name","value":"sourceType"}}]}}]}}]}}]} as unknown as DocumentNode<FindManyApplicationsQuery, FindManyApplicationsQueryVariables>;-export const FindOneApplicationDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindOneApplication"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"findOneApplication"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ApplicationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Agent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"prompt"}},{"kind":"Field","name":{"kind":"Name","value":"modelId"}},{"kind":"Field","name":{"kind":"Name","value":"responseFormat"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"modelConfiguration"}},{"kind":"Field","name":{"kind":"Name","value":"evaluationInputs"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ObjectMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Object"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}},{"kind":"Field","name":{"kind":"Name","value":"labelSingular"}},{"kind":"Field","name":{"kind":"Name","value":"labelPlural"}},{"kind":"Field","name":{"kind":"Name","value":"color"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"isRemote"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isUIEditable"}},{"kind":"Field","name":{"kind":"Name","value":"isUICreatable"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"labelIdentifierFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"imageIdentifierFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"shortcut"}},{"kind":"Field","name":{"kind":"Name","value":"isLabelSyncedWithName"}},{"kind":"Field","name":{"kind":"Name","value":"isSearchable"}},{"kind":"Field","name":{"kind":"Name","value":"openRecordIn"}},{"kind":"Field","name":{"kind":"Name","value":"duplicateCriteria"}},{"kind":"Field","name":{"kind":"Name","value":"searchFieldMetadataList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"tsVectorFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"indexMetadataList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"indexWhereClause"}},{"kind":"Field","name":{"kind":"Name","value":"indexType"}},{"kind":"Field","name":{"kind":"Name","value":"isUnique"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"indexFieldMetadataList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"subFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"order"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"fieldsList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isUIEditable"}},{"kind":"Field","name":{"kind":"Name","value":"isNullable"}},{"kind":"Field","name":{"kind":"Name","value":"isUnique"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"defaultValue"}},{"kind":"Field","name":{"kind":"Name","value":"options"}},{"kind":"Field","name":{"kind":"Name","value":"settings"}},{"kind":"Field","name":{"kind":"Name","value":"isLabelSyncedWithName"}},{"kind":"Field","name":{"kind":"Name","value":"morphId"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"relation"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"sourceObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sourceFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"morphRelations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"sourceObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sourceFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"LogicFunctionFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"LogicFunction"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"runtime"}},{"kind":"Field","name":{"kind":"Name","value":"timeoutSeconds"}},{"kind":"Field","name":{"kind":"Name","value":"executionMode"}},{"kind":"Field","name":{"kind":"Name","value":"sourceHandlerPath"}},{"kind":"Field","name":{"kind":"Name","value":"handlerName"}},{"kind":"Field","name":{"kind":"Name","value":"cronTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"databaseEventTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"httpRouteTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"toolTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"workflowActionTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ApplicationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Application"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"logoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"version"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"applicationRegistrationId"}},{"kind":"Field","name":{"kind":"Name","value":"applicationRegistration"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"latestAvailableVersion"}},{"kind":"Field","name":{"kind":"Name","value":"sourceType"}},{"kind":"Field","name":{"kind":"Name","value":"logoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"canBeUninstalled"}},{"kind":"Field","name":{"kind":"Name","value":"autoUpgrade"}},{"kind":"Field","name":{"kind":"Name","value":"defaultRoleId"}},{"kind":"Field","name":{"kind":"Name","value":"settingsCustomTabFrontComponentId"}},{"kind":"Field","name":{"kind":"Name","value":"availablePackages"}},{"kind":"Field","name":{"kind":"Name","value":"applicationVariables"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"value"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"isSecret"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"options"}}]}},{"kind":"Field","name":{"kind":"Name","value":"agents"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AgentFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"frontComponents"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"componentName"}},{"kind":"Field","name":{"kind":"Name","value":"builtComponentChecksum"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"isHeadless"}},{"kind":"Field","name":{"kind":"Name","value":"usesSdkClient"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"commandMenuItems"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"shortLabel"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"isPinned"}},{"kind":"Field","name":{"kind":"Name","value":"availabilityType"}},{"kind":"Field","name":{"kind":"Name","value":"conditionalAvailabilityExpression"}},{"kind":"Field","name":{"kind":"Name","value":"frontComponentId"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"objects"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ObjectMetadataFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"logicFunctions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"LogicFunctionFields"}}]}}]}}]} as unknown as DocumentNode<FindOneApplicationQuery, FindOneApplicationQueryVariables>;+export const FindOneApplicationDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindOneApplication"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"findOneApplication"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ApplicationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Agent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"prompt"}},{"kind":"Field","name":{"kind":"Name","value":"modelId"}},{"kind":"Field","name":{"kind":"Name","value":"responseFormat"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"modelConfiguration"}},{"kind":"Field","name":{"kind":"Name","value":"evaluationInputs"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ObjectMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Object"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}},{"kind":"Field","name":{"kind":"Name","value":"labelSingular"}},{"kind":"Field","name":{"kind":"Name","value":"labelPlural"}},{"kind":"Field","name":{"kind":"Name","value":"color"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"isRemote"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isUIEditable"}},{"kind":"Field","name":{"kind":"Name","value":"isUICreatable"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"labelIdentifierFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"imageIdentifierFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"shortcut"}},{"kind":"Field","name":{"kind":"Name","value":"isLabelSyncedWithName"}},{"kind":"Field","name":{"kind":"Name","value":"isSearchable"}},{"kind":"Field","name":{"kind":"Name","value":"openRecordIn"}},{"kind":"Field","name":{"kind":"Name","value":"duplicateCriteria"}},{"kind":"Field","name":{"kind":"Name","value":"searchFieldMetadataList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"tsVectorFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"indexMetadataList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"indexWhereClause"}},{"kind":"Field","name":{"kind":"Name","value":"indexType"}},{"kind":"Field","name":{"kind":"Name","value":"isUnique"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"indexFieldMetadataList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"subFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"order"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"fieldsList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isUIEditable"}},{"kind":"Field","name":{"kind":"Name","value":"isNullable"}},{"kind":"Field","name":{"kind":"Name","value":"isUnique"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"defaultValue"}},{"kind":"Field","name":{"kind":"Name","value":"options"}},{"kind":"Field","name":{"kind":"Name","value":"settings"}},{"kind":"Field","name":{"kind":"Name","value":"isLabelSyncedWithName"}},{"kind":"Field","name":{"kind":"Name","value":"morphId"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"relation"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"sourceObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sourceFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"morphRelations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"sourceObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sourceFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"LogicFunctionFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"LogicFunction"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"runtime"}},{"kind":"Field","name":{"kind":"Name","value":"timeoutSeconds"}},{"kind":"Field","name":{"kind":"Name","value":"executionMode"}},{"kind":"Field","name":{"kind":"Name","value":"sourceHandlerPath"}},{"kind":"Field","name":{"kind":"Name","value":"handlerName"}},{"kind":"Field","name":{"kind":"Name","value":"cronTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"databaseEventTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"httpRouteTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"toolTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"workflowActionTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ApplicationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Application"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"logoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"version"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"applicationRegistrationId"}},{"kind":"Field","name":{"kind":"Name","value":"applicationRegistration"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"latestAvailableVersion"}},{"kind":"Field","name":{"kind":"Name","value":"sourceType"}},{"kind":"Field","name":{"kind":"Name","value":"logoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"canBeUninstalled"}},{"kind":"Field","name":{"kind":"Name","value":"autoUpgrade"}},{"kind":"Field","name":{"kind":"Name","value":"defaultRoleId"}},{"kind":"Field","name":{"kind":"Name","value":"settingsCustomTabFrontComponentId"}},{"kind":"Field","name":{"kind":"Name","value":"availablePackages"}},{"kind":"Field","name":{"kind":"Name","value":"applicationVariables"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"value"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"isSecret"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"options"}}]}},{"kind":"Field","name":{"kind":"Name","value":"agents"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AgentFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"frontComponents"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"componentName"}},{"kind":"Field","name":{"kind":"Name","value":"builtComponentChecksum"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"isHeadless"}},{"kind":"Field","name":{"kind":"Name","value":"usesSdkClient"}},{"kind":"Field","name":{"kind":"Name","value":"frontComponentSharedDependenciesChecksum"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"commandMenuItems"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"shortLabel"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"isPinned"}},{"kind":"Field","name":{"kind":"Name","value":"availabilityType"}},{"kind":"Field","name":{"kind":"Name","value":"conditionalAvailabilityExpression"}},{"kind":"Field","name":{"kind":"Name","value":"frontComponentId"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"objects"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ObjectMetadataFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"logicFunctions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"LogicFunctionFields"}}]}}]}}]} as unknown as DocumentNode<FindOneApplicationQuery, FindOneApplicationQueryVariables>;export const FindOneApplicationByUniversalIdentifierDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindOneApplicationByUniversalIdentifier"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"universalIdentifier"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"findOneApplication"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"universalIdentifier"},"value":{"kind":"Variable","name":{"kind":"Name","value":"universalIdentifier"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"version"}}]}}]}}]} as unknown as DocumentNode<FindOneApplicationByUniversalIdentifierQuery, FindOneApplicationByUniversalIdentifierQueryVariables>;export const FindOneApplicationNameDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindOneApplicationName"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"findOneApplication"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<FindOneApplicationNameQuery, FindOneApplicationNameQueryVariables>;export const FindOneApplicationSummaryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindOneApplicationSummary"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"universalIdentifier"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"findOneApplication"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"universalIdentifier"},"value":{"kind":"Variable","name":{"kind":"Name","value":"universalIdentifier"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode<FindOneApplicationSummaryQuery, FindOneApplicationSummaryQueryVariables>;@@ -9492,8 +9493,8 @@ export const UploadEmailAttachmentFileDocument = {"kind":"Document","definitionsexport const UploadFilesFieldFileDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UploadFilesFieldFile"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"file"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Upload"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"fieldMetadataId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"uploadFilesFieldFile"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"file"},"value":{"kind":"Variable","name":{"kind":"Name","value":"file"}}},{"kind":"Argument","name":{"kind":"Name","value":"fieldMetadataId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"fieldMetadataId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"path"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]} as unknown as DocumentNode<UploadFilesFieldFileMutation, UploadFilesFieldFileMutationVariables>;export const UploadWorkflowFileDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UploadWorkflowFile"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"file"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Upload"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"uploadWorkflowFile"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"file"},"value":{"kind":"Variable","name":{"kind":"Name","value":"file"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"path"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]} as unknown as DocumentNode<UploadWorkflowFileMutation, UploadWorkflowFileMutationVariables>;export const RenewApplicationTokenDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"RenewApplicationToken"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"applicationRefreshToken"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"renewApplicationToken"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"applicationRefreshToken"},"value":{"kind":"Variable","name":{"kind":"Name","value":"applicationRefreshToken"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"applicationAccessToken"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"token"}},{"kind":"Field","name":{"kind":"Name","value":"expiresAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"applicationRefreshToken"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"token"}},{"kind":"Field","name":{"kind":"Name","value":"expiresAt"}}]}}]}}]}}]} as unknown as DocumentNode<RenewApplicationTokenMutation, RenewApplicationTokenMutationVariables>;-export const FindManyFrontComponentsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindManyFrontComponents"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"frontComponents"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"builtComponentChecksum"}},{"kind":"Field","name":{"kind":"Name","value":"builtComponentPath"}},{"kind":"Field","name":{"kind":"Name","value":"componentName"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"isHeadless"}},{"kind":"Field","name":{"kind":"Name","value":"sourceComponentPath"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"usesSdkClient"}}]}}]}}]} as unknown as DocumentNode<FindManyFrontComponentsQuery, FindManyFrontComponentsQueryVariables>;-export const FindOneFrontComponentDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindOneFrontComponent"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"frontComponent"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"builtComponentChecksum"}},{"kind":"Field","name":{"kind":"Name","value":"isHeadless"}},{"kind":"Field","name":{"kind":"Name","value":"usesSdkClient"}},{"kind":"Field","name":{"kind":"Name","value":"applicationVariables"}},{"kind":"Field","name":{"kind":"Name","value":"applicationTokenPair"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"applicationAccessToken"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"token"}},{"kind":"Field","name":{"kind":"Name","value":"expiresAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"applicationRefreshToken"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"token"}},{"kind":"Field","name":{"kind":"Name","value":"expiresAt"}}]}}]}}]}}]}}]} as unknown as DocumentNode<FindOneFrontComponentQuery, FindOneFrontComponentQueryVariables>;+export const FindManyFrontComponentsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindManyFrontComponents"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"frontComponents"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"builtComponentChecksum"}},{"kind":"Field","name":{"kind":"Name","value":"builtComponentPath"}},{"kind":"Field","name":{"kind":"Name","value":"componentName"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"isHeadless"}},{"kind":"Field","name":{"kind":"Name","value":"sourceComponentPath"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"usesSdkClient"}},{"kind":"Field","name":{"kind":"Name","value":"frontComponentSharedDependenciesChecksum"}}]}}]}}]} as unknown as DocumentNode<FindManyFrontComponentsQuery, FindManyFrontComponentsQueryVariables>;+export const FindOneFrontComponentDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindOneFrontComponent"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"frontComponent"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"builtComponentChecksum"}},{"kind":"Field","name":{"kind":"Name","value":"isHeadless"}},{"kind":"Field","name":{"kind":"Name","value":"usesSdkClient"}},{"kind":"Field","name":{"kind":"Name","value":"frontComponentSharedDependenciesChecksum"}},{"kind":"Field","name":{"kind":"Name","value":"applicationVariables"}},{"kind":"Field","name":{"kind":"Name","value":"applicationTokenPair"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"applicationAccessToken"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"token"}},{"kind":"Field","name":{"kind":"Name","value":"expiresAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"applicationRefreshToken"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"token"}},{"kind":"Field","name":{"kind":"Name","value":"expiresAt"}}]}}]}}]}}]}}]} as unknown as DocumentNode<FindOneFrontComponentQuery, FindOneFrontComponentQueryVariables>;export const GetApplicationSdkClientChecksumsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetApplicationSdkClientChecksums"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"applicationId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"applicationSdkClientChecksums"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"applicationId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"applicationId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"core"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}}]}}]}}]} as unknown as DocumentNode<GetApplicationSdkClientChecksumsQuery, GetApplicationSdkClientChecksumsQueryVariables>;export const GetAutoCompleteAddressDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAutoCompleteAddress"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"address"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"token"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"country"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"isFieldCity"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Boolean"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getAutoCompleteAddress"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"address"},"value":{"kind":"Variable","name":{"kind":"Name","value":"address"}}},{"kind":"Argument","name":{"kind":"Name","value":"token"},"value":{"kind":"Variable","name":{"kind":"Name","value":"token"}}},{"kind":"Argument","name":{"kind":"Name","value":"country"},"value":{"kind":"Variable","name":{"kind":"Name","value":"country"}}},{"kind":"Argument","name":{"kind":"Name","value":"isFieldCity"},"value":{"kind":"Variable","name":{"kind":"Name","value":"isFieldCity"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"text"}},{"kind":"Field","name":{"kind":"Name","value":"placeId"}}]}}]}}]} as unknown as DocumentNode<GetAutoCompleteAddressQuery, GetAutoCompleteAddressQueryVariables>;export const GetAddressDetailsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAddressDetails"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"placeId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"token"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getAddressDetails"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"placeId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"placeId"}}},{"kind":"Argument","name":{"kind":"Name","value":"token"},"value":{"kind":"Variable","name":{"kind":"Name","value":"token"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"street"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"postcode"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"country"}},{"kind":"Field","name":{"kind":"Name","value":"location"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"lat"}},{"kind":"Field","name":{"kind":"Name","value":"lng"}}]}}]}}]}}]} as unknown as DocumentNode<GetAddressDetailsQuery, GetAddressDetailsQueryVariables>;diff --git a/packages/twenty-front/src/modules/applications/graphql/fragments/applicationFragment.ts b/packages/twenty-front/src/modules/applications/graphql/fragments/applicationFragment.tsindex b7b54ac4110..d717d57b128 100644--- a/packages/twenty-front/src/modules/applications/graphql/fragments/applicationFragment.ts+++ b/packages/twenty-front/src/modules/applications/graphql/fragments/applicationFragment.ts@@ -48,6 +48,7 @@ export const APPLICATION_FRAGMENT = gql`universalIdentifierisHeadlessusesSdkClient+ frontComponentSharedDependenciesChecksumcreatedAtupdatedAt}diff --git a/packages/twenty-front/src/modules/front-components/components/FrontComponentRenderer.tsx b/packages/twenty-front/src/modules/front-components/components/FrontComponentRenderer.tsxindex ca0a00048a7..a2290c0d160 100644--- a/packages/twenty-front/src/modules/front-components/components/FrontComponentRenderer.tsx+++ b/packages/twenty-front/src/modules/front-components/components/FrontComponentRenderer.tsx@@ -4,7 +4,7 @@ import { FrontComponentRendererProvider } from '@/front-components/components/Frimport { useFrontComponentExecutionContext } from '@/front-components/hooks/useFrontComponentExecutionContext';import { useOnApplicationSdkClientChecksumsUpdated } from '@/front-components/hooks/useOnApplicationSdkClientChecksumsUpdated';import { useOnFrontComponentUpdated } from '@/front-components/hooks/useOnFrontComponentUpdated';-import { getFrontComponentUrl } from '@/front-components/utils/getFrontComponentUrl';+import { getFingerprintedRestUrl } from '@/front-components/utils/getFingerprintedRestUrl';import { getSdkClientUrls } from '@/front-components/utils/getSdkClientUrls';import { useGetLogicFunctionHttpUrl } from '@/settings/logic-functions/hooks/useGetLogicFunctionHttpUrl';import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';@@ -81,7 +81,12 @@ const FrontComponentRendererContent = ({const { enqueueErrorSnackBar } = useSnackBar();const { functionsBaseUrl } = useGetLogicFunctionHttpUrl();- const { id: frontComponentId, applicationId, usesSdkClient } = frontComponent;+ const {+ id: frontComponentId,+ applicationId,+ usesSdkClient,+ frontComponentSharedDependenciesChecksum,+ } = frontComponent;const { executionContext, frontComponentHostCommunicationApi } =useFrontComponentExecutionContext({@@ -125,8 +130,15 @@ const FrontComponentRendererContent = ({[applicationId, sdkClientChecksums],);- const componentUrl = getFrontComponentUrl({- frontComponentId,+ const sharedDependenciesUrl = getFingerprintedRestUrl({+ resource: 'front-component-shared-dependencies',+ id: applicationId,+ checksum: frontComponentSharedDependenciesChecksum ?? undefined,+ });++ const componentUrl = getFingerprintedRestUrl({+ resource: 'front-components',+ id: frontComponentId,checksum: frontComponent.builtComponentChecksum,});@@ -153,6 +165,7 @@ const FrontComponentRendererContent = ({apiUrl={REACT_APP_SERVER_BASE_URL}functionsBaseUrl={functionsBaseUrl}sdkClientUrls={sdkClientUrls}+ sharedDependenciesUrl={sharedDependenciesUrl}executionContext={executionContext}frontComponentHostCommunicationApi={frontComponentHostCommunicationApidiff --git a/packages/twenty-front/src/modules/front-components/graphql/queries/findManyFrontComponents.ts b/packages/twenty-front/src/modules/front-components/graphql/queries/findManyFrontComponents.tsindex 340ac46b22d..bd3c78066d7 100644--- a/packages/twenty-front/src/modules/front-components/graphql/queries/findManyFrontComponents.ts+++ b/packages/twenty-front/src/modules/front-components/graphql/queries/findManyFrontComponents.ts@@ -16,6 +16,7 @@ export const FIND_MANY_FRONT_COMPONENTS = gql`universalIdentifierupdatedAtusesSdkClient+ frontComponentSharedDependenciesChecksum}}`;diff --git a/packages/twenty-front/src/modules/front-components/graphql/queries/findOneFrontComponent.ts b/packages/twenty-front/src/modules/front-components/graphql/queries/findOneFrontComponent.tsindex 17c80c18a03..aed078f3a1f 100644--- a/packages/twenty-front/src/modules/front-components/graphql/queries/findOneFrontComponent.ts+++ b/packages/twenty-front/src/modules/front-components/graphql/queries/findOneFrontComponent.ts@@ -9,6 +9,7 @@ export const FIND_ONE_FRONT_COMPONENT = gql`builtComponentChecksumisHeadlessusesSdkClient+ frontComponentSharedDependenciesChecksumapplicationVariablesapplicationTokenPair {applicationAccessToken {diff --git a/packages/twenty-front/src/modules/front-components/utils/__tests__/getFingerprintedRestUrl.test.ts b/packages/twenty-front/src/modules/front-components/utils/__tests__/getFingerprintedRestUrl.test.tsnew file mode 100644index 00000000000..aa5c8e6f5a8--- /dev/null+++ b/packages/twenty-front/src/modules/front-components/utils/__tests__/getFingerprintedRestUrl.test.ts@@ -0,0 +1,27 @@+import { REST_API_BASE_URL } from '@/apollo/constant/rest-api-base-url';+import { getFingerprintedRestUrl } from '@/front-components/utils/getFingerprintedRestUrl';++describe('getFingerprintedRestUrl', () => {+ it('builds a checksum-fingerprinted path URL when a checksum is provided', () => {+ expect(+ getFingerprintedRestUrl({+ resource: 'front-components',+ id: 'front-component-id',+ checksum: 'abc123',+ }),+ ).toBe(+ `${REST_API_BASE_URL}/front-components/front-component-id/abc123.js`,+ );+ });++ it('falls back to the bare id URL when no checksum is provided', () => {+ expect(+ getFingerprintedRestUrl({+ resource: 'front-component-shared-dependencies',+ id: 'application-id',+ }),+ ).toBe(+ `${REST_API_BASE_URL}/front-component-shared-dependencies/application-id`,+ );+ });+});diff --git a/packages/twenty-front/src/modules/front-components/utils/__tests__/getFrontComponentUrl.test.ts b/packages/twenty-front/src/modules/front-components/utils/__tests__/getFrontComponentUrl.test.tsdeleted file mode 100644index 53867c6e4be..00000000000--- a/packages/twenty-front/src/modules/front-components/utils/__tests__/getFrontComponentUrl.test.ts+++ /dev/null@@ -1,21 +0,0 @@-import { REST_API_BASE_URL } from '@/apollo/constant/rest-api-base-url';-import { getFrontComponentUrl } from '@/front-components/utils/getFrontComponentUrl';--describe('getFrontComponentUrl', () => {- it('builds a checksum-fingerprinted path URL when a checksum is provided', () => {- expect(- getFrontComponentUrl({- frontComponentId: 'front-component-id',- checksum: 'abc123',- }),- ).toBe(- `${REST_API_BASE_URL}/front-components/front-component-id/abc123.js`,- );- });-- it('falls back to the bare id URL when no checksum is provided', () => {- expect(- getFrontComponentUrl({ frontComponentId: 'front-component-id' }),- ).toBe(`${REST_API_BASE_URL}/front-components/front-component-id`);- });-});diff --git a/packages/twenty-front/src/modules/front-components/utils/getFingerprintedRestUrl.ts b/packages/twenty-front/src/modules/front-components/utils/getFingerprintedRestUrl.tsnew file mode 100644index 00000000000..213678a576d--- /dev/null+++ b/packages/twenty-front/src/modules/front-components/utils/getFingerprintedRestUrl.ts@@ -0,0 +1,15 @@+import { REST_API_BASE_URL } from '@/apollo/constant/rest-api-base-url';+import { isDefined } from 'twenty-shared/utils';++export const getFingerprintedRestUrl = ({+ resource,+ id,+ checksum,+}: {+ resource: 'front-components' | 'front-component-shared-dependencies';+ id: string;+ checksum?: string;+}): string =>+ isDefined(checksum)+ ? `${REST_API_BASE_URL}/${resource}/${id}/${checksum}.js`+ : `${REST_API_BASE_URL}/${resource}/${id}`;diff --git a/packages/twenty-front/src/modules/front-components/utils/getFrontComponentUrl.ts b/packages/twenty-front/src/modules/front-components/utils/getFrontComponentUrl.tsdeleted file mode 100644index 891d9c59fd2..00000000000--- a/packages/twenty-front/src/modules/front-components/utils/getFrontComponentUrl.ts+++ /dev/null@@ -1,14 +0,0 @@-import { REST_API_BASE_URL } from '@/apollo/constant/rest-api-base-url';-import { isDefined } from 'twenty-shared/utils';--export const getFrontComponentUrl = ({- frontComponentId,- checksum,-}: {- frontComponentId: string;- checksum?: string;-}): string => {- return isDefined(checksum)- ? `${REST_API_BASE_URL}/front-components/${frontComponentId}/${checksum}.js`- : `${REST_API_BASE_URL}/front-components/${frontComponentId}`;-};diff --git a/packages/twenty-sdk/src/cli/__tests__/apps/fixture-paths.ts b/packages/twenty-sdk/src/cli/__tests__/apps/fixture-paths.tsindex 01458831216..0f8bf87452a 100644--- a/packages/twenty-sdk/src/cli/__tests__/apps/fixture-paths.ts+++ b/packages/twenty-sdk/src/cli/__tests__/apps/fixture-paths.ts@@ -5,6 +5,10 @@ const FIXTURES_ROOT = resolve(__dirname, '../../../../../twenty-apps/fixtures');export const RICH_APP_PATH = resolve(FIXTURES_ROOT, 'rich-app');export const MINIMAL_APP_PATH = resolve(FIXTURES_ROOT, 'minimal-app');export const INVALID_APP_PATH = resolve(FIXTURES_ROOT, 'invalid-app');+export const SHARED_DEPENDENCIES_APP_PATH = resolve(+ FIXTURES_ROOT,+ 'shared-dependencies-app',+);export const FUNCTION_EXECUTE_APP_PATH = resolve(FIXTURES_ROOT,'function-execute-app',diff --git a/packages/twenty-sdk/src/cli/utilities/build/common/__tests__/esbuild-watcher.spec.ts b/packages/twenty-sdk/src/cli/utilities/build/common/__tests__/esbuild-watcher.spec.tsnew file mode 100644index 00000000000..18ca109354d--- /dev/null+++ b/packages/twenty-sdk/src/cli/utilities/build/common/__tests__/esbuild-watcher.spec.ts@@ -0,0 +1,81 @@+import { beforeEach, describe, expect, it, vi } from 'vitest';++import * as esbuild from 'esbuild';+import { FileFolder } from 'twenty-shared/types';++import { EsbuildWatcher } from '@/cli/utilities/build/common/esbuild-watcher';++vi.mock('esbuild', () => ({+ context: vi.fn(),+}));++vi.mock('@/cli/utilities/build/common/cleanup-removed-files', () => ({+ cleanupRemovedFiles: vi.fn(async () => {}),+}));++const contextMock = vi.mocked(esbuild.context);++const createWatcher = () =>+ new EsbuildWatcher({+ appPath: '/app',+ sourcePaths: [],+ watch: false,+ handleFileBuilt: vi.fn(),+ handleBuildError: vi.fn(),+ config: {+ externalModules: [],+ fileFolder: FileFolder.BuiltFrontComponent,+ },+ });++describe('EsbuildWatcher', () => {+ beforeEach(() => {+ vi.clearAllMocks();++ contextMock.mockImplementation(async (options: esbuild.BuildOptions) => {+ const onEndCallbacks: ((result: esbuild.BuildResult) => void)[] = [];++ for (const plugin of options.plugins ?? []) {+ plugin.setup({+ onEnd: (callback: (result: esbuild.BuildResult) => void) => {+ onEndCallbacks.push(callback);+ },+ } as esbuild.PluginBuild);+ }++ return {+ rebuild: vi.fn(async () => {+ for (const callback of onEndCallbacks) {+ await callback({+ errors: [],+ metafile: { inputs: {}, outputs: {} },+ } as unknown as esbuild.BuildResult);+ }+ }),+ watch: vi.fn(async () => {}),+ dispose: vi.fn(async () => {}),+ } as unknown as esbuild.BuildContext;+ });+ });++ it('applies the last requested source paths exactly once when restarted during a restart', async () => {+ const watcher = createWatcher();++ await watcher.start();++ await Promise.all([+ watcher.restart(['a.front-component.tsx']),+ watcher.restart(['b.front-component.tsx']),+ watcher.restart(['c.front-component.tsx']),+ ]);++ expect(contextMock).toHaveBeenCalledTimes(2);++ const lastContextOptions = contextMock.mock.calls[1][0];++ expect(Object.keys(lastContextOptions.entryPoints ?? {})).toEqual([+ 'c.front-component',+ ]);+ expect(watcher.shouldRestart(['c.front-component.tsx'])).toBe(false);+ });+});diff --git a/packages/twenty-sdk/src/cli/utilities/build/common/build-application.ts b/packages/twenty-sdk/src/cli/utilities/build/common/build-application.tsindex aed19bf457a..f608dafda7b 100644--- a/packages/twenty-sdk/src/cli/utilities/build/common/build-application.ts+++ b/packages/twenty-sdk/src/cli/utilities/build/common/build-application.ts@@ -7,6 +7,7 @@ import {type Manifest,} from 'twenty-shared/application';import { FileFolder } from 'twenty-shared/types';+import { isDefined } from 'twenty-shared/utils';import { copyReadmeToOutput } from '@/cli/utilities/build/common/copy-readme-to-output';import { type GeneratedAsset } from '@/cli/utilities/build/cover/generated-asset.type';@@ -16,6 +17,8 @@ import { getBaseFrontComponentBuildOptions } from '@/cli/utilities/build/common/import { getFrontComponentBuildPlugins } from '@/cli/utilities/build/common/front-component-build/utils/get-front-component-build-plugins';import { createStubTwentySdkDefinePlugin } from '@/cli/utilities/build/common/plugins/stub-twenty-sdk-define.plugin';import { type OnFileBuiltCallback } from '@/cli/utilities/build/common/restartable-watcher-interface';+import { buildSharedDependenciesBundle } from '@/cli/utilities/build/common/front-component-build/shared-dependencies-build/build-shared-dependencies-bundle';+import { type SharedDependenciesBuildContext } from '@/cli/utilities/build/common/front-component-build/shared-dependencies-build/types/shared-dependencies-build-context.type';import { type EntityFilePaths } from '@/cli/utilities/build/manifest/manifest-extract-config';import { loadFrontComponentTranslationCatalogs } from '@/cli/utilities/translations/load-front-component-translation-catalogs';import {@@ -67,6 +70,8 @@ export const buildApplication = async (};const { logicFunctions, frontComponents } = options.filePaths;+ const sharedDependencies =+ options.manifest.application.frontComponentSharedDependencies;// Bake the app's compiled translation catalogs into every front-component// bundle so the runtime t()/<Trans> resolves them in the sandboxed worker@@ -107,6 +112,15 @@ export const buildApplication = async (onFileBuilt: collectFileBuilt,});+ const sharedDependenciesBuildContext: SharedDependenciesBuildContext | null =+ isDefined(sharedDependencies)+ ? await buildSharedDependenciesBundle({+ appPath: options.appPath,+ sharedDependencies,+ onFileBuilt: collectFileBuilt,+ })+ : null;+await esbuildOneShotBuild({appPath: options.appPath,sourcePaths: frontComponents,@@ -123,7 +137,10 @@ export const buildApplication = async (? { banner: frontComponentTranslationsBanner }: {}),plugins: [- ...getFrontComponentBuildPlugins(),+ ...getFrontComponentBuildPlugins({+ getSharedDependenciesBuildContext: () =>+ sharedDependenciesBuildContext,+ }),createStubTwentySdkDefinePlugin(),],},diff --git a/packages/twenty-sdk/src/cli/utilities/build/common/esbuild-result-processor.ts b/packages/twenty-sdk/src/cli/utilities/build/common/esbuild-result-processor.tsindex 8bc84486061..1e428084850 100644--- a/packages/twenty-sdk/src/cli/utilities/build/common/esbuild-result-processor.ts+++ b/packages/twenty-sdk/src/cli/utilities/build/common/esbuild-result-processor.ts@@ -57,7 +57,6 @@ export const processEsbuildResult = async ({imp.external === true &&imp.path.startsWith(SDK_CLIENT_IMPORT_PREFIX),) ?? false;-if (onFileBuilt) {await onFileBuilt({fileFolder,diff --git a/packages/twenty-sdk/src/cli/utilities/build/common/esbuild-watcher.ts b/packages/twenty-sdk/src/cli/utilities/build/common/esbuild-watcher.tsindex c3666f3eae8..f159859d54f 100644--- a/packages/twenty-sdk/src/cli/utilities/build/common/esbuild-watcher.ts+++ b/packages/twenty-sdk/src/cli/utilities/build/common/esbuild-watcher.ts@@ -1,7 +1,5 @@import { cleanupRemovedFiles } from '@/cli/utilities/build/common/cleanup-removed-files';import { processEsbuildResult } from '@/cli/utilities/build/common/esbuild-result-processor';-import { FRONT_COMPONENT_EXTERNAL_MODULES } from '@/cli/utilities/build/common/front-component-build/constants/front-component-external-modules';-import { getFrontComponentBuildPlugins } from '@/cli/utilities/build/common/front-component-build/utils/get-front-component-build-plugins';import { createStubTwentySdkDefinePlugin } from '@/cli/utilities/build/common/plugins/stub-twenty-sdk-define.plugin';import {type OnBuildErrorCallback,@@ -14,6 +12,7 @@ import * as esbuild from 'esbuild';import path from 'path';import { NODE_ESM_CJS_BANNER, OUTPUT_DIR } from 'twenty-shared/application';import { FileFolder } from 'twenty-shared/types';+import { isDefined } from 'twenty-shared/utils';export const LOGIC_FUNCTION_EXTERNAL_MODULES: string[] = ['twenty-client-sdk/core',@@ -57,6 +56,7 @@ export class EsbuildWatcher implements RestartableWatcher {private sourcePaths: string[];private esBuildContext: esbuild.BuildContext | null = null;private isRestarting = false;+ private pendingRestartSourcePaths: string[] | null = null;private watchMode: boolean;private lastChecksums: Map<string, string> = new Map();private onFileBuilt?: OnFileBuiltCallback;@@ -92,7 +92,11 @@ export class EsbuildWatcher implements RestartableWatcher {}async restart(sourcePaths: string[]): Promise<void> {- if (this.isRestarting) return;+ if (this.isRestarting) {+ this.pendingRestartSourcePaths = sourcePaths;++ return;+ }this.isRestarting = true;try {@@ -108,6 +112,14 @@ export class EsbuildWatcher implements RestartableWatcher {}} finally {this.isRestarting = false;++ const pendingRestartSourcePaths = this.pendingRestartSourcePaths;++ if (isDefined(pendingRestartSourcePaths)) {+ this.pendingRestartSourcePaths = null;++ await this.restart(pendingRestartSourcePaths);+ }}}@@ -208,20 +220,3 @@ export const createLogicFunctionsWatcher = (banner: NODE_ESM_CJS_BANNER,},});--export const createFrontComponentsWatcher = (- options: EsbuildWatcherFactoryOptions,-): EsbuildWatcher =>- new EsbuildWatcher({- ...options,- config: {- externalModules: FRONT_COMPONENT_EXTERNAL_MODULES,- fileFolder: FileFolder.BuiltFrontComponent,- jsx: 'automatic',- extraPlugins: [- createTypecheckPlugin(options.appPath, options.shouldSkipTypecheck),- ...getFrontComponentBuildPlugins(),- createStubTwentySdkDefinePlugin(),- ],- },- });diff --git a/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/__tests__/front-components-watcher.spec.ts b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/__tests__/front-components-watcher.spec.tsnew file mode 100644index 00000000000..8a1f327e43f--- /dev/null+++ b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/__tests__/front-components-watcher.spec.ts@@ -0,0 +1,225 @@+import { beforeEach, describe, expect, it, vi } from 'vitest';++import { FileFolder } from 'twenty-shared/types';++import { EsbuildWatcher } from '@/cli/utilities/build/common/esbuild-watcher';+import { FrontComponentsWatcher } from '@/cli/utilities/build/common/front-component-build/front-components-watcher';+import { buildSharedDependenciesBundle } from '@/cli/utilities/build/common/front-component-build/shared-dependencies-build/build-shared-dependencies-bundle';++vi.mock(+ '@/cli/utilities/build/common/front-component-build/shared-dependencies-build/build-shared-dependencies-bundle',+ () => ({+ buildSharedDependenciesBundle: vi.fn(),+ }),+);++vi.mock('@/cli/utilities/file/fs-utils', () => ({+ pathExists: vi.fn(async () => false),+}));++vi.mock('@/cli/utilities/build/common/esbuild-watcher', () => ({+ EsbuildWatcher: vi.fn(),+}));++const SHARED_DEPENDENCIES_MANIFEST = {+ dependencies: ['react'],+ builtPath: 'src/sharedDependencies.mjs',+ builtChecksum: null,+};++const SOURCE_PATHS = ['src/my.front-component.tsx'];++const buildSharedDependenciesBundleMock = vi.mocked(+ buildSharedDependenciesBundle,+);+const esbuildWatcherMock = vi.mocked(EsbuildWatcher);++const createComponentsWatcherInstance = () => ({+ start: vi.fn(async () => {}),+ restart: vi.fn(async () => {}),+ close: vi.fn(async () => {}),+ shouldRestart: vi.fn(() => false),+});++let componentsWatcherInstance: ReturnType<+ typeof createComponentsWatcherInstance+>;++const mockSharedDependenciesBuildWithChecksum = (checksum: string) => {+ buildSharedDependenciesBundleMock.mockImplementation(+ async ({ onFileBuilt }) => {+ await onFileBuilt?.({+ fileFolder: FileFolder.BuiltFrontComponent,+ builtPath: 'src/sharedDependencies.mjs',+ sourcePath: 'package.json',+ checksum,+ });++ return { exportNamesBySpecifier: new Map() };+ },+ );+};++const createWatcher = (+ sharedDependencies?: typeof SHARED_DEPENDENCIES_MANIFEST,+) =>+ new FrontComponentsWatcher({+ appPath: '/app',+ sourcePaths: SOURCE_PATHS,+ sharedDependencies,+ shouldSkipTypecheck: () => true,+ handleFileBuilt: vi.fn(),+ handleBuildError: vi.fn(),+ });++const triggerSharedDependenciesBuild = (+ watcher: FrontComponentsWatcher,+): Promise<void> =>+ (+ watcher as unknown as {+ requestSharedDependenciesBuild: () => Promise<void>;+ }+ ).requestSharedDependenciesBuild();++describe('FrontComponentsWatcher', () => {+ beforeEach(() => {+ vi.clearAllMocks();+ componentsWatcherInstance = createComponentsWatcherInstance();+ esbuildWatcherMock.mockImplementation(function () {+ return componentsWatcherInstance as unknown as EsbuildWatcher;+ });+ mockSharedDependenciesBuildWithChecksum('checksum-1');+ });++ it('builds the sharedDependencies before starting the component builds, without a restart', async () => {+ const watcher = createWatcher(SHARED_DEPENDENCIES_MANIFEST);++ await watcher.start();++ expect(buildSharedDependenciesBundleMock).toHaveBeenCalledTimes(1);+ expect(componentsWatcherInstance.start).toHaveBeenCalledTimes(1);+ expect(+ buildSharedDependenciesBundleMock.mock.invocationCallOrder[0],+ ).toBeLessThan(componentsWatcherInstance.start.mock.invocationCallOrder[0]);+ expect(componentsWatcherInstance.restart).not.toHaveBeenCalled();+ });++ it('serializes concurrent build requests into one in flight build and one queued build', async () => {+ let concurrentBuildCount = 0;+ let maxConcurrentBuildCount = 0;++ buildSharedDependenciesBundleMock.mockImplementation(async () => {+ concurrentBuildCount += 1;+ maxConcurrentBuildCount = Math.max(+ maxConcurrentBuildCount,+ concurrentBuildCount,+ );++ await new Promise((resolve) => setTimeout(resolve, 10));++ concurrentBuildCount -= 1;++ return { exportNamesBySpecifier: new Map() };+ });++ const watcher = createWatcher(SHARED_DEPENDENCIES_MANIFEST);++ await Promise.all([+ triggerSharedDependenciesBuild(watcher),+ triggerSharedDependenciesBuild(watcher),+ triggerSharedDependenciesBuild(watcher),+ ]);++ expect(maxConcurrentBuildCount).toBe(1);+ expect(buildSharedDependenciesBundleMock).toHaveBeenCalledTimes(2);+ });++ it('restarts the components exactly once when a sharedDependencies is added', async () => {+ const watcher = createWatcher(undefined);++ await watcher.start();++ expect(buildSharedDependenciesBundleMock).not.toHaveBeenCalled();++ await watcher.restart(SOURCE_PATHS, SHARED_DEPENDENCIES_MANIFEST);++ expect(buildSharedDependenciesBundleMock).toHaveBeenCalledTimes(1);+ expect(componentsWatcherInstance.restart).toHaveBeenCalledTimes(1);+ });++ it('restarts the components when a dependency rebuild changes the sharedDependencies checksum', async () => {+ const watcher = createWatcher(SHARED_DEPENDENCIES_MANIFEST);++ await watcher.start();++ mockSharedDependenciesBuildWithChecksum('checksum-2');++ await triggerSharedDependenciesBuild(watcher);++ expect(componentsWatcherInstance.restart).toHaveBeenCalledTimes(1);+ });++ it('does not restart the components when the rebuilt sharedDependencies is unchanged', async () => {+ const watcher = createWatcher(SHARED_DEPENDENCIES_MANIFEST);++ await watcher.start();++ await triggerSharedDependenciesBuild(watcher);++ expect(componentsWatcherInstance.restart).not.toHaveBeenCalled();+ });++ it('ignores a sharedDependencies build that was in flight when the manifest changed', async () => {+ const handleFileBuilt = vi.fn();+ const watcher = new FrontComponentsWatcher({+ appPath: '/app',+ sourcePaths: SOURCE_PATHS,+ sharedDependencies: SHARED_DEPENDENCIES_MANIFEST,+ shouldSkipTypecheck: () => true,+ handleFileBuilt,+ handleBuildError: vi.fn(),+ });++ await watcher.start();++ let resolveInFlightBuild: (() => void) | undefined;++ buildSharedDependenciesBundleMock.mockImplementationOnce(+ async ({ onFileBuilt }) => {+ await new Promise<void>((resolve) => {+ resolveInFlightBuild = resolve;+ });++ await onFileBuilt?.({+ fileFolder: FileFolder.BuiltFrontComponent,+ builtPath: 'src/sharedDependencies.mjs',+ sourcePath: 'package.json',+ checksum: 'stale-checksum',+ });++ return { exportNamesBySpecifier: new Map() };+ },+ );++ const inFlightBuild = triggerSharedDependenciesBuild(watcher);++ mockSharedDependenciesBuildWithChecksum('checksum-2');++ const restartPromise = watcher.restart(SOURCE_PATHS, {+ ...SHARED_DEPENDENCIES_MANIFEST,+ dependencies: ['react', 'react-dom/client'],+ });++ resolveInFlightBuild?.();++ await Promise.all([inFlightBuild, restartPromise]);++ expect(handleFileBuilt).not.toHaveBeenCalledWith(+ expect.objectContaining({ checksum: 'stale-checksum' }),+ );+ expect(handleFileBuilt).toHaveBeenCalledWith(+ expect.objectContaining({ checksum: 'checksum-2' }),+ );+ });++});diff --git a/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/constants/front-component-external-modules.ts b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/constants/front-component-external-modules.tsindex b98a52b75b4..6811916427d 100644--- a/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/constants/front-component-external-modules.ts+++ b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/constants/front-component-external-modules.ts@@ -1,4 +1,7 @@+import { FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER } from 'twenty-shared/application';+export const FRONT_COMPONENT_EXTERNAL_MODULES: string[] = ['twenty-client-sdk/core','twenty-client-sdk/metadata',+ FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER,];diff --git a/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/front-components-watcher.ts b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/front-components-watcher.tsnew file mode 100644index 00000000000..2c730393cb6--- /dev/null+++ b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/front-components-watcher.ts@@ -0,0 +1,275 @@+import { EsbuildWatcher } from '@/cli/utilities/build/common/esbuild-watcher';+import { FRONT_COMPONENT_EXTERNAL_MODULES } from '@/cli/utilities/build/common/front-component-build/constants/front-component-external-modules';+import { getFrontComponentBuildPlugins } from '@/cli/utilities/build/common/front-component-build/utils/get-front-component-build-plugins';+import { createStubTwentySdkDefinePlugin } from '@/cli/utilities/build/common/plugins/stub-twenty-sdk-define.plugin';+import {+ type OnBuildErrorCallback,+ type OnFileBuiltCallback,+} from '@/cli/utilities/build/common/restartable-watcher-interface';+import { createTypecheckPlugin } from '@/cli/utilities/build/common/typecheck-plugin';+import { buildSharedDependenciesBundle } from '@/cli/utilities/build/common/front-component-build/shared-dependencies-build/build-shared-dependencies-bundle';+import { type SharedDependenciesBuildContext } from '@/cli/utilities/build/common/front-component-build/shared-dependencies-build/types/shared-dependencies-build-context.type';+import { pathExists } from '@/cli/utilities/file/fs-utils';+import { isNonEmptyArray } from '@sniptt/guards';+import chokidar, { type FSWatcher } from 'chokidar';+import { join } from 'path';+import { FileFolder } from 'twenty-shared/types';+import { type FrontComponentSharedDependenciesManifest } from 'twenty-shared/application';+import { isDefined } from 'twenty-shared/utils';++const INSTALLED_DEPENDENCY_VERSION_PATHS = ['package.json', 'yarn.lock'];++export type FrontComponentsWatcherOptions = {+ appPath: string;+ sourcePaths: string[];+ sharedDependencies?: FrontComponentSharedDependenciesManifest;+ watch?: boolean;+ shouldSkipTypecheck: () => boolean;+ handleFileBuilt: OnFileBuiltCallback;+ handleBuildError: OnBuildErrorCallback;+};++export class FrontComponentsWatcher {+ private appPath: string;+ private sourcePaths: string[];+ private sharedDependencies:+ | FrontComponentSharedDependenciesManifest+ | undefined;+ private watchMode: boolean;+ private shouldSkipTypecheck: () => boolean;+ private handleFileBuilt: OnFileBuiltCallback;+ private handleBuildError: OnBuildErrorCallback;+ private componentsWatcher: EsbuildWatcher | null = null;+ private sharedDependenciesBuildContext: SharedDependenciesBuildContext | null =+ null;+ private lastSharedDependenciesChecksum: string | null = null;+ private installedDependenciesWatcher: FSWatcher | null = null;+ private isClosed = false;+ private isApplyingRestart = false;+ private sharedDependenciesBuildGeneration = 0;+ private inFlightSharedDependenciesBuildPromise: Promise<void> | null = null;+ private hasSharedDependenciesBuildRequestedDuringInFlightBuild = false;++ constructor(options: FrontComponentsWatcherOptions) {+ this.appPath = options.appPath;+ this.sourcePaths = options.sourcePaths;+ this.sharedDependencies = options.sharedDependencies;+ this.watchMode = options.watch ?? true;+ this.shouldSkipTypecheck = options.shouldSkipTypecheck;+ this.handleFileBuilt = options.handleFileBuilt;+ this.handleBuildError = options.handleBuildError;+ }++ getSharedDependenciesBuildContext(): SharedDependenciesBuildContext | null {+ return this.sharedDependenciesBuildContext;+ }++ shouldRestart(+ sourcePaths: string[],+ sharedDependencies: FrontComponentSharedDependenciesManifest | undefined,+ ): boolean {+ return (+ (this.componentsWatcher?.shouldRestart(sourcePaths) ?? true) ||+ this.hasSharedDependenciesManifestChanged(sharedDependencies)+ );+ }++ async start(): Promise<void> {+ if (isDefined(this.sharedDependencies)) {+ await this.requestSharedDependenciesBuild();+ await this.startInstalledDependenciesWatcher();+ }++ this.componentsWatcher = new EsbuildWatcher({+ appPath: this.appPath,+ sourcePaths: this.sourcePaths,+ watch: this.watchMode,+ handleFileBuilt: this.handleFileBuilt,+ handleBuildError: this.handleBuildError,+ config: {+ externalModules: FRONT_COMPONENT_EXTERNAL_MODULES,+ fileFolder: FileFolder.BuiltFrontComponent,+ jsx: 'automatic',+ extraPlugins: [+ createTypecheckPlugin(this.appPath, this.shouldSkipTypecheck),+ ...getFrontComponentBuildPlugins({+ getSharedDependenciesBuildContext: () =>+ this.sharedDependenciesBuildContext,+ }),+ createStubTwentySdkDefinePlugin(),+ ],+ },+ });++ await this.componentsWatcher.start();+ }++ async restart(+ sourcePaths: string[],+ sharedDependencies: FrontComponentSharedDependenciesManifest | undefined,+ ): Promise<void> {+ this.isApplyingRestart = true;++ try {+ const hasSharedDependenciesManifestChanged =+ this.hasSharedDependenciesManifestChanged(sharedDependencies);++ this.sourcePaths = sourcePaths;++ if (hasSharedDependenciesManifestChanged) {+ this.sharedDependenciesBuildGeneration += 1;+ this.hasSharedDependenciesBuildRequestedDuringInFlightBuild = false;+ await this.inFlightSharedDependenciesBuildPromise;+ await this.installedDependenciesWatcher?.close();+ this.installedDependenciesWatcher = null;+ this.sharedDependencies = sharedDependencies;+ this.sharedDependenciesBuildContext = null;+ this.lastSharedDependenciesChecksum = null;++ if (isDefined(sharedDependencies)) {+ await this.requestSharedDependenciesBuild();+ await this.startInstalledDependenciesWatcher();+ }+ }++ await this.componentsWatcher?.restart(sourcePaths);+ } finally {+ this.isApplyingRestart = false;+ }+ }++ async close(): Promise<void> {+ this.isClosed = true;+ await this.installedDependenciesWatcher?.close();+ this.installedDependenciesWatcher = null;+ await this.componentsWatcher?.close();+ this.componentsWatcher = null;+ }++ private hasSharedDependenciesManifestChanged(+ sharedDependencies: FrontComponentSharedDependenciesManifest | undefined,+ ): boolean {+ if (!isDefined(sharedDependencies) || !isDefined(this.sharedDependencies)) {+ return (+ isDefined(sharedDependencies) !== isDefined(this.sharedDependencies)+ );+ }++ return (+ sharedDependencies.dependencies.join(',') !==+ this.sharedDependencies.dependencies.join(',')+ );+ }++ private async requestSharedDependenciesBuild(): Promise<void> {+ if (isDefined(this.inFlightSharedDependenciesBuildPromise)) {+ this.hasSharedDependenciesBuildRequestedDuringInFlightBuild = true;++ return;+ }++ this.inFlightSharedDependenciesBuildPromise =+ this.runSharedDependenciesBuild();++ try {+ await this.inFlightSharedDependenciesBuildPromise;+ } finally {+ this.inFlightSharedDependenciesBuildPromise = null;++ if (this.hasSharedDependenciesBuildRequestedDuringInFlightBuild) {+ this.hasSharedDependenciesBuildRequestedDuringInFlightBuild = false;++ await this.requestSharedDependenciesBuild();+ }+ }+ }++ private async runSharedDependenciesBuild(): Promise<void> {+ const sharedDependencies = this.sharedDependencies;+ const generation = this.sharedDependenciesBuildGeneration;++ if (!isDefined(sharedDependencies)) {+ return;+ }++ const isObsolete = () =>+ this.isClosed || generation !== this.sharedDependenciesBuildGeneration;++ try {+ let builtChecksum: string | null = null;++ const sharedDependenciesBuildContext =+ await buildSharedDependenciesBundle({+ appPath: this.appPath,+ sharedDependencies,+ onFileBuilt: async (event) => {+ builtChecksum = event.checksum;++ if (+ isObsolete() ||+ event.checksum === this.lastSharedDependenciesChecksum+ ) {+ return;+ }++ await this.handleFileBuilt(event);+ },+ });++ if (isObsolete()) {+ return;+ }++ this.sharedDependenciesBuildContext = sharedDependenciesBuildContext;++ if (builtChecksum !== this.lastSharedDependenciesChecksum) {+ this.lastSharedDependenciesChecksum = builtChecksum;++ if (!this.isApplyingRestart) {+ await this.componentsWatcher?.restart(this.sourcePaths);+ }+ }+ } catch (error) {+ if (isObsolete()) {+ return;+ }++ await this.handleBuildError([+ {+ error: error instanceof Error ? error.message : String(error),+ location: null,+ },+ ]);+ }+ }++ private async startInstalledDependenciesWatcher(): Promise<void> {+ const watchedPaths = (+ await Promise.all(+ INSTALLED_DEPENDENCY_VERSION_PATHS.map(async (watchPath) => {+ const absolutePath = join(this.appPath, watchPath);++ return (await pathExists(absolutePath)) ? absolutePath : null;+ }),+ )+ ).filter(isDefined);++ if (!isNonEmptyArray(watchedPaths)) {+ return;+ }++ this.installedDependenciesWatcher = chokidar.watch(watchedPaths, {+ ignoreInitial: true,+ awaitWriteFinish: {+ stabilityThreshold: 100,+ pollInterval: 50,+ },+ });++ this.installedDependenciesWatcher.on('all', (event) => {+ if (event === 'add' || event === 'change') {+ void this.requestSharedDependenciesBuild();+ }+ });+ }+}diff --git a/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/__tests__/build-application-with-shared-dependencies.spec.ts b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/__tests__/build-application-with-shared-dependencies.spec.tsnew file mode 100644index 00000000000..ff0c94f4724--- /dev/null+++ b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/__tests__/build-application-with-shared-dependencies.spec.ts@@ -0,0 +1,60 @@+import { rm } from 'node:fs/promises';+import { join } from 'path';++import { isDefined } from 'twenty-shared/utils';+import {+ FRONT_COMPONENT_SHARED_DEPENDENCIES_BUILT_PATH,+ OUTPUT_DIR,+ type Manifest,+} from 'twenty-shared/application';++import { SHARED_DEPENDENCIES_APP_PATH } from '@/cli/__tests__/apps/fixture-paths';+import { buildApplication } from '@/cli/utilities/build/common/build-application';+import { buildManifest } from '@/cli/utilities/build/manifest/manifest-build';+import { manifestUpdateChecksums } from '@/cli/utilities/build/manifest/manifest-update-checksums';++describe('buildApplication with a shared dependencies bundle', () => {+ let builtManifest: Manifest;++ beforeAll(async () => {+ const { manifest, filePaths, errors } = await buildManifest(+ SHARED_DEPENDENCIES_APP_PATH,+ );++ expect(errors).toEqual([]);++ if (!isDefined(manifest)) {+ throw new Error(+ 'The shared-dependencies-app manifest could not be built',+ );+ }++ const { builtFileInfos } = await buildApplication({+ appPath: SHARED_DEPENDENCIES_APP_PATH,+ manifest,+ filePaths,+ });++ builtManifest = manifestUpdateChecksums({ manifest, builtFileInfos });+ }, 180000);++ afterAll(async () => {+ await rm(join(SHARED_DEPENDENCIES_APP_PATH, OUTPUT_DIR), {+ recursive: true,+ force: true,+ });+ });++ it('records the declared dependencies and the built bundle checksum in the manifest', () => {+ expect(+ builtManifest.application.frontComponentSharedDependencies,+ ).toMatchObject({+ dependencies: ['react', 'react-dom/client', 'react/jsx-runtime'],+ builtPath: FRONT_COMPONENT_SHARED_DEPENDENCIES_BUILT_PATH,+ });+ expect(+ builtManifest.application.frontComponentSharedDependencies?.builtChecksum,+ ).toMatch(/^[0-9a-f]{64}$/);+ });++});diff --git a/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/__tests__/enumerate-shared-dependencies-export-names.spec.ts b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/__tests__/enumerate-shared-dependencies-export-names.spec.tsnew file mode 100644index 00000000000..ae5a3e0e0a4--- /dev/null+++ b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/__tests__/enumerate-shared-dependencies-export-names.spec.ts@@ -0,0 +1,34 @@+import { MINIMAL_APP_PATH } from '@/cli/__tests__/apps/fixture-paths';+import { enumerateSharedDependenciesExportNames } from '@/cli/utilities/build/common/front-component-build/shared-dependencies-build/utils/enumerate-shared-dependencies-export-names';++describe('enumerateSharedDependenciesExportNames', () => {+ it('reports the named exports and the default of a commonjs dependency', async () => {+ const exportNames = await enumerateSharedDependenciesExportNames({+ appPath: MINIMAL_APP_PATH,+ specifier: 'react',+ });++ expect(exportNames.namedExports).toContain('useState');+ expect(exportNames.namedExports).not.toContain('default');+ expect(exportNames.hasDefaultExport).toBe(true);+ }, 60000);++ it('reports no default for an es module without one', async () => {+ const exportNames = await enumerateSharedDependenciesExportNames({+ appPath: MINIMAL_APP_PATH,+ specifier: '@remote-dom/core',+ });++ expect(exportNames.namedExports).toContain('ROOT_ID');+ expect(exportNames.hasDefaultExport).toBe(false);+ }, 60000);++ it('throws for a dependency the application cannot resolve', async () => {+ await expect(+ enumerateSharedDependenciesExportNames({+ appPath: MINIMAL_APP_PATH,+ specifier: 'this-package-does-not-exist',+ }),+ ).rejects.toThrow('Unable to determine the exports');+ }, 60000);+});diff --git a/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/__tests__/shared-dependencies-build.spec.ts b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/__tests__/shared-dependencies-build.spec.tsnew file mode 100644index 00000000000..0b352121c80--- /dev/null+++ b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/__tests__/shared-dependencies-build.spec.ts@@ -0,0 +1,140 @@+import { mkdtemp, readFile, rm } from 'node:fs/promises';+import { tmpdir } from 'node:os';+import { join } from 'path';++import * as esbuild from 'esbuild';+import {+ OUTPUT_DIR,+ FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER,+} from 'twenty-shared/application';++import { MINIMAL_APP_PATH } from '@/cli/__tests__/apps/fixture-paths';+import { getBaseFrontComponentBuildOptions } from '@/cli/utilities/build/common/front-component-build/utils/get-base-front-component-build-options';+import { getFrontComponentBuildPlugins } from '@/cli/utilities/build/common/front-component-build/utils/get-front-component-build-plugins';+import { buildSharedDependenciesBundle } from '@/cli/utilities/build/common/front-component-build/shared-dependencies-build/build-shared-dependencies-bundle';+import { removeBuiltSharedDependenciesBundle } from '@/cli/utilities/build/common/front-component-build/shared-dependencies-build/__tests__/utils/remove-built-shared-dependencies-bundle';+import { type SharedDependenciesBuildContext } from '@/cli/utilities/build/common/front-component-build/shared-dependencies-build/types/shared-dependencies-build-context.type';++const REACT_BUNDLED_MARKER = '@license React';++const SHARED_DEPENDENCIES_MANIFEST = {+ dependencies: ['react', 'react/jsx-runtime', 'react-dom/client'],+ builtPath: 'front-component-shared-dependencies.mjs',+ builtChecksum: null,+};++const buildFrontComponent = async ({+ outputDir,+ sharedDependenciesBuildContext,+}: {+ outputDir: string;+ sharedDependenciesBuildContext: SharedDependenciesBuildContext | null;+}) => {+ const result = await esbuild.build({+ ...getBaseFrontComponentBuildOptions(),+ entryPoints: [join(MINIMAL_APP_PATH, 'my.front-component.tsx')],+ outdir: outputDir,+ plugins: getFrontComponentBuildPlugins({+ getSharedDependenciesBuildContext: () => sharedDependenciesBuildContext,+ }),+ });++ const output = await readFile(+ join(outputDir, 'my.front-component.mjs'),+ 'utf-8',+ );++ return { result, output };+};++describe('shared dependencies build', () => {+ let sharedDependenciesBuildContext: SharedDependenciesBuildContext;+ let frontComponentSharedDependenciesChecksum: string;++ beforeAll(async () => {+ sharedDependenciesBuildContext = await buildSharedDependenciesBundle({+ appPath: MINIMAL_APP_PATH,+ sharedDependencies: SHARED_DEPENDENCIES_MANIFEST,+ onFileBuilt: ({ checksum }) => {+ frontComponentSharedDependenciesChecksum = checksum;+ },+ });+ }, 120000);++ afterAll(async () => {+ await removeBuiltSharedDependenciesBundle({+ appPath: MINIMAL_APP_PATH,+ builtPath: SHARED_DEPENDENCIES_MANIFEST.builtPath,+ });+ });++ it('bundles every declared dependency behind its own namespace export, through the jsx wrapper', async () => {+ const sharedDependenciesBundle = await readFile(+ join(+ MINIMAL_APP_PATH,+ OUTPUT_DIR,+ SHARED_DEPENDENCIES_MANIFEST.builtPath,+ ),+ 'utf-8',+ );++ expect(sharedDependenciesBundle).toContain('__shared_dependencies_react__');+ expect(sharedDependenciesBundle).toContain(+ '__shared_dependencies_react_jsx_runtime__',+ );+ expect(sharedDependenciesBundle).toContain(+ '__shared_dependencies_react_dom_client__',+ );+ expect(sharedDependenciesBundle).toContain(+ '__HTML_TAG_TO_CUSTOM_ELEMENT_TAG__',+ );+ expect(frontComponentSharedDependenciesChecksum).toMatch(/^[0-9a-f]{64}$/);+ });++ it('keeps react out of a front component bundle that shares them', async () => {+ const outputDir = await mkdtemp(+ join(tmpdir(), 'shared-dependencies-component-'),+ );++ try {+ const { result, output } = await buildFrontComponent({+ outputDir,+ sharedDependenciesBuildContext,+ });++ expect(output).toContain(FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER);+ expect(output).not.toContain(REACT_BUNDLED_MARKER);++ const outputMeta = Object.values(result.metafile?.outputs ?? {}).find(+ (metaOutput) => metaOutput.entryPoint?.endsWith('.tsx'),+ );++ expect(+ outputMeta?.imports.some(+ (moduleImport) =>+ moduleImport.external === true &&+ moduleImport.path === FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER,+ ),+ ).toBe(true);+ } finally {+ await rm(outputDir, { recursive: true, force: true });+ }+ }, 60000);++ it('bundles react into a front component when no shared dependencies are declared', async () => {+ const outputDir = await mkdtemp(join(tmpdir(), 'plain-component-'));++ try {+ const { output } = await buildFrontComponent({+ outputDir,+ sharedDependenciesBuildContext: null,+ });++ expect(output).not.toContain(FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER);+ expect(output).toContain(REACT_BUNDLED_MARKER);+ } finally {+ await rm(outputDir, { recursive: true, force: true });+ }+ }, 60000);++});diff --git a/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/__tests__/shared-dependencies-shim-default-export.spec.ts b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/__tests__/shared-dependencies-shim-default-export.spec.tsnew file mode 100644index 00000000000..ae73963d840--- /dev/null+++ b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/__tests__/shared-dependencies-shim-default-export.spec.ts@@ -0,0 +1,69 @@+import { mkdtemp, rm, writeFile } from 'node:fs/promises';+import { join } from 'path';++import * as esbuild from 'esbuild';+import { FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER } from 'twenty-shared/application';++import { MINIMAL_APP_PATH } from '@/cli/__tests__/apps/fixture-paths';+import { getBaseFrontComponentBuildOptions } from '@/cli/utilities/build/common/front-component-build/utils/get-base-front-component-build-options';+import { getFrontComponentBuildPlugins } from '@/cli/utilities/build/common/front-component-build/utils/get-front-component-build-plugins';+import { buildSharedDependenciesBundle } from '@/cli/utilities/build/common/front-component-build/shared-dependencies-build/build-shared-dependencies-bundle';+import { removeBuiltSharedDependenciesBundle } from '@/cli/utilities/build/common/front-component-build/shared-dependencies-build/__tests__/utils/remove-built-shared-dependencies-bundle';++const SHARED_DEPENDENCIES_MANIFEST = {+ dependencies: ['axios'],+ builtPath: 'default-export-shared-dependencies.mjs',+ builtChecksum: null,+};++describe('shared dependency shims for a dependency with a default export', () => {+ it('lets a component import the default of a shared es module', async () => {+ const outputDir = await mkdtemp(+ join(MINIMAL_APP_PATH, 'shared-dependencies-default-'),+ );+ const entryPoint = join(outputDir, 'entry.js');++ try {+ const sharedDependenciesBuildContext =+ await buildSharedDependenciesBundle({+ appPath: MINIMAL_APP_PATH,+ sharedDependencies: SHARED_DEPENDENCIES_MANIFEST,+ onFileBuilt: () => {},+ });++ await writeFile(+ entryPoint,+ 'import axios from "axios";\nexport default () => axios;\n',+ );++ const result = await esbuild.build({+ ...getBaseFrontComponentBuildOptions(),+ entryPoints: [entryPoint],+ outdir: outputDir,+ plugins: getFrontComponentBuildPlugins({+ getSharedDependenciesBuildContext: () =>+ sharedDependenciesBuildContext,+ }),+ });++ expect(result.errors).toEqual([]);++ const outputMeta = Object.values(result.metafile?.outputs ?? {}).find(+ (metaOutput) => metaOutput.entryPoint?.endsWith('entry.js'),+ );++ expect(+ outputMeta?.imports.some(+ (moduleImport) =>+ moduleImport.path === FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER,+ ),+ ).toBe(true);+ } finally {+ await rm(outputDir, { recursive: true, force: true });+ await removeBuiltSharedDependenciesBundle({+ appPath: MINIMAL_APP_PATH,+ builtPath: SHARED_DEPENDENCIES_MANIFEST.builtPath,+ });+ }+ }, 120000);+});diff --git a/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/__tests__/utils/remove-built-shared-dependencies-bundle.ts b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/__tests__/utils/remove-built-shared-dependencies-bundle.tsnew file mode 100644index 00000000000..d65ecb49a2d--- /dev/null+++ b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/__tests__/utils/remove-built-shared-dependencies-bundle.ts@@ -0,0 +1,17 @@+import { rm } from 'node:fs/promises';+import { join } from 'path';++import { OUTPUT_DIR } from 'twenty-shared/application';++export const removeBuiltSharedDependenciesBundle = async ({+ appPath,+ builtPath,+}: {+ appPath: string;+ builtPath: string;+}): Promise<void> => {+ const absoluteBuiltPath = join(appPath, OUTPUT_DIR, builtPath);++ await rm(absoluteBuiltPath, { force: true });+ await rm(`${absoluteBuiltPath}.map`, { force: true });+};diff --git a/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/build-shared-dependencies-bundle.ts b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/build-shared-dependencies-bundle.tsnew file mode 100644index 00000000000..4f1337fafbc--- /dev/null+++ b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/build-shared-dependencies-bundle.ts@@ -0,0 +1,86 @@+import { getBaseFrontComponentBuildOptions } from '@/cli/utilities/build/common/front-component-build/utils/get-base-front-component-build-options';+import { type OnFileBuiltCallback } from '@/cli/utilities/build/common/restartable-watcher-interface';+import { type SharedDependenciesBuildContext } from '@/cli/utilities/build/common/front-component-build/shared-dependencies-build/types/shared-dependencies-build-context.type';+import { enumerateSharedDependenciesExportNames } from '@/cli/utilities/build/common/front-component-build/shared-dependencies-build/utils/enumerate-shared-dependencies-export-names';+import { getSharedDependenciesEntrySource } from '@/cli/utilities/build/common/front-component-build/shared-dependencies-build/utils/get-shared-dependencies-entry-source';+import { getSharedDependenciesNamespaceCollisions } from '@/cli/utilities/build/common/front-component-build/shared-dependencies-build/utils/get-shared-dependencies-namespace-collisions';+import { ensureDir } from '@/cli/utilities/file/fs-utils';+import crypto from 'crypto';+import * as esbuild from 'esbuild';+import { readFile } from 'node:fs/promises';+import { dirname, join } from 'path';+import {+ OUTPUT_DIR,+ type FrontComponentSharedDependenciesManifest,+} from 'twenty-shared/application';+import { FileFolder } from 'twenty-shared/types';+import { isNonEmptyArray } from '@sniptt/guards';++export const buildSharedDependenciesBundle = async ({+ appPath,+ sharedDependencies,+ onFileBuilt,+}: {+ appPath: string;+ sharedDependencies: FrontComponentSharedDependenciesManifest;+ onFileBuilt: OnFileBuiltCallback;+}): Promise<SharedDependenciesBuildContext> => {+ const namespaceCollisions = getSharedDependenciesNamespaceCollisions(+ sharedDependencies.dependencies,+ );++ if (isNonEmptyArray(namespaceCollisions)) {+ throw new Error(+ `Shared dependencies map to the same bundle namespace: ${namespaceCollisions+ .map((specifiers) => specifiers.join(' and '))+ .join(', ')}`,+ );+ }++ const builtPath = join(OUTPUT_DIR, sharedDependencies.builtPath);+ const absoluteBuiltPath = join(appPath, builtPath);++ await ensureDir(dirname(absoluteBuiltPath));++ await esbuild.build({+ ...getBaseFrontComponentBuildOptions(),+ stdin: {+ contents: getSharedDependenciesEntrySource(+ sharedDependencies.dependencies,+ ),+ resolveDir: appPath,+ sourcefile: 'twenty-shared-dependencies-entry.js',+ loader: 'js',+ },+ outfile: absoluteBuiltPath,+ outExtension: undefined,+ external: [],+ });++ const exportNamesBySpecifier = new Map(+ await Promise.all(+ sharedDependencies.dependencies.map(+ async (specifier) =>+ [+ specifier,+ await enumerateSharedDependenciesExportNames({+ appPath,+ specifier,+ }),+ ] as const,+ ),+ ),+ );++ const content = await readFile(absoluteBuiltPath);+ const checksum = crypto.createHash('sha256').update(content).digest('hex');++ await onFileBuilt({+ fileFolder: FileFolder.BuiltFrontComponent,+ builtPath,+ sourcePath: 'package.json',+ checksum,+ });++ return { exportNamesBySpecifier };+};diff --git a/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/create-shared-dependencies-shim-plugin.ts b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/create-shared-dependencies-shim-plugin.tsnew file mode 100644index 00000000000..1a1f3a4218e--- /dev/null+++ b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/create-shared-dependencies-shim-plugin.ts@@ -0,0 +1,49 @@+import { type SharedDependenciesBuildContext } from '@/cli/utilities/build/common/front-component-build/shared-dependencies-build/types/shared-dependencies-build-context.type';+import { getSharedDependenciesShimSource } from '@/cli/utilities/build/common/front-component-build/shared-dependencies-build/utils/get-shared-dependencies-shim-source';+import type * as esbuild from 'esbuild';+import { isDefined } from 'twenty-shared/utils';++const SHARED_DEPENDENCIES_SHIM_NAMESPACE = 'twenty-shared-dependencies-shim';++export const createSharedDependenciesShimPlugin = (+ getSharedDependenciesBuildContext: () => SharedDependenciesBuildContext | null,+): esbuild.Plugin => ({+ name: 'twenty-shared-dependencies-shim',+ setup: (build) => {+ build.onResolve({ filter: /.*/ }, ({ path: specifier }) => {+ const sharedDependenciesBuildContext =+ getSharedDependenciesBuildContext();++ if (!isDefined(sharedDependenciesBuildContext)) {+ return undefined;+ }++ if (+ !sharedDependenciesBuildContext.exportNamesBySpecifier.has(specifier)+ ) {+ return undefined;+ }++ return { path: specifier, namespace: SHARED_DEPENDENCIES_SHIM_NAMESPACE };+ });++ build.onLoad(+ { filter: /.*/, namespace: SHARED_DEPENDENCIES_SHIM_NAMESPACE },+ ({ path: specifier }) => {+ const exportNames =+ getSharedDependenciesBuildContext()?.exportNamesBySpecifier.get(+ specifier,+ );++ if (!isDefined(exportNames)) {+ return undefined;+ }++ return {+ contents: getSharedDependenciesShimSource({ specifier, exportNames }),+ loader: 'js' as const,+ };+ },+ );+ },+});diff --git a/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/types/shared-dependencies-build-context.type.ts b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/types/shared-dependencies-build-context.type.tsnew file mode 100644index 00000000000..f379bbdb5b2--- /dev/null+++ b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/types/shared-dependencies-build-context.type.ts@@ -0,0 +1,5 @@+import { type SharedDependenciesExportNames } from '@/cli/utilities/build/common/front-component-build/shared-dependencies-build/types/shared-dependencies-export-names.type';++export type SharedDependenciesBuildContext = {+ exportNamesBySpecifier: Map<string, SharedDependenciesExportNames>;+};diff --git a/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/types/shared-dependencies-export-names.type.ts b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/types/shared-dependencies-export-names.type.tsnew file mode 100644index 00000000000..ece061905cc--- /dev/null+++ b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/types/shared-dependencies-export-names.type.ts@@ -0,0 +1,4 @@+export type SharedDependenciesExportNames = {+ namedExports: string[];+ hasDefaultExport: boolean;+};diff --git a/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/utils/enumerate-shared-dependencies-export-names.ts b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/utils/enumerate-shared-dependencies-export-names.tsnew file mode 100644index 00000000000..afbe5f22b2e--- /dev/null+++ b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/utils/enumerate-shared-dependencies-export-names.ts@@ -0,0 +1,91 @@+import { getBaseFrontComponentBuildOptions } from '@/cli/utilities/build/common/front-component-build/utils/get-base-front-component-build-options';+import { type SharedDependenciesExportNames } from '@/cli/utilities/build/common/front-component-build/shared-dependencies-build/types/shared-dependencies-export-names.type';+import * as esbuild from 'esbuild';+import { isDefined } from 'twenty-shared/utils';++const DEFAULT_EXPORT_NAME = 'default';++const PROBE_NAMESPACE_IDENTIFIER = 'sharedDependenciesNamespace';++const buildNamespaceProbeSource = (specifier: string): string =>+ `import * as ${PROBE_NAMESPACE_IDENTIFIER} from ${JSON.stringify(specifier)};\nexport { ${PROBE_NAMESPACE_IDENTIFIER} };`;++const buildProbeBundle = async ({+ appPath,+ specifier,+}: {+ appPath: string;+ specifier: string;+}): Promise<string | null> => {+ try {+ const probeResult = await esbuild.build({+ ...getBaseFrontComponentBuildOptions(),+ stdin: {+ contents: buildNamespaceProbeSource(specifier),+ resolveDir: appPath,+ sourcefile: 'shared-dependencies-export-probe.js',+ loader: 'js',+ },+ write: false,+ outfile: 'shared-dependencies-export-probe-out.js',+ outExtension: undefined,+ external: [],+ sourcemap: false,+ });++ return (+ probeResult.outputFiles?.find((outputFile) =>+ outputFile.path.endsWith('.js'),+ )?.text ?? null+ );+ } catch {+ return null;+ }+};++const importProbeNamespace = async (+ probeBundleSource: string,+): Promise<Record<string, unknown> | null> => {+ try {+ const probeModuleUrl = `data:text/javascript;base64,${Buffer.from(+ probeBundleSource,+ ).toString('base64')}`;+ const probeModule = (await import(probeModuleUrl)) as Record<+ string,+ Record<string, unknown> | undefined+ >;++ return probeModule[PROBE_NAMESPACE_IDENTIFIER] ?? null;+ } catch {+ return null;+ }+};++export const enumerateSharedDependenciesExportNames = async ({+ appPath,+ specifier,+}: {+ appPath: string;+ specifier: string;+}): Promise<SharedDependenciesExportNames> => {+ const probeBundleSource = await buildProbeBundle({ appPath, specifier });++ const sharedDependenciesNamespace = isDefined(probeBundleSource)+ ? await importProbeNamespace(probeBundleSource)+ : null;++ if (!isDefined(sharedDependenciesNamespace)) {+ throw new Error(+ `Unable to determine the exports of shared dependency "${specifier}". Check that it is installed and importable from the application.`,+ );+ }++ const namedExports = Object.keys(sharedDependenciesNamespace)+ .filter((exportName) => exportName !== DEFAULT_EXPORT_NAME)+ .sort();++ return {+ namedExports,+ hasDefaultExport: DEFAULT_EXPORT_NAME in sharedDependenciesNamespace,+ };+};diff --git a/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/utils/get-shared-dependencies-entry-source.ts b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/utils/get-shared-dependencies-entry-source.tsnew file mode 100644index 00000000000..c36d7193892--- /dev/null+++ b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/utils/get-shared-dependencies-entry-source.ts@@ -0,0 +1,13 @@+import { toSharedDependenciesNamespaceIdentifier } from '@/cli/utilities/build/common/front-component-build/shared-dependencies-build/utils/to-shared-dependencies-namespace-identifier';++export const getSharedDependenciesEntrySource = (+ dependencies: string[],+): string =>+ dependencies+ .map((specifier) => {+ const namespaceIdentifier =+ toSharedDependenciesNamespaceIdentifier(specifier);++ return `import * as ${namespaceIdentifier} from ${JSON.stringify(specifier)};\nexport { ${namespaceIdentifier} };`;+ })+ .join('\n');diff --git a/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/utils/get-shared-dependencies-namespace-collisions.ts b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/utils/get-shared-dependencies-namespace-collisions.tsnew file mode 100644index 00000000000..8b3d9f6c468--- /dev/null+++ b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/utils/get-shared-dependencies-namespace-collisions.ts@@ -0,0 +1,21 @@+import { toSharedDependenciesNamespaceIdentifier } from '@/cli/utilities/build/common/front-component-build/shared-dependencies-build/utils/to-shared-dependencies-namespace-identifier';++export const getSharedDependenciesNamespaceCollisions = (+ dependencies: string[],+): string[][] => {+ const specifiersByNamespaceIdentifier = new Map<string, string[]>();++ for (const specifier of dependencies) {+ const namespaceIdentifier =+ toSharedDependenciesNamespaceIdentifier(specifier);+ const specifiers =+ specifiersByNamespaceIdentifier.get(namespaceIdentifier) ?? [];++ specifiers.push(specifier);+ specifiersByNamespaceIdentifier.set(namespaceIdentifier, specifiers);+ }++ return [...specifiersByNamespaceIdentifier.values()].filter(+ (specifiers) => specifiers.length > 1,+ );+};diff --git a/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/utils/get-shared-dependencies-shim-source.ts b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/utils/get-shared-dependencies-shim-source.tsnew file mode 100644index 00000000000..7a1b8cde1a7--- /dev/null+++ b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/utils/get-shared-dependencies-shim-source.ts@@ -0,0 +1,31 @@+import { type SharedDependenciesExportNames } from '@/cli/utilities/build/common/front-component-build/shared-dependencies-build/types/shared-dependencies-export-names.type';+import { toSharedDependenciesNamespaceIdentifier } from '@/cli/utilities/build/common/front-component-build/shared-dependencies-build/utils/to-shared-dependencies-namespace-identifier';+import { FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER } from 'twenty-shared/application';++export const getSharedDependenciesShimSource = ({+ specifier,+ exportNames,+}: {+ specifier: string;+ exportNames: SharedDependenciesExportNames;+}): string => {+ const namespaceIdentifier =+ toSharedDependenciesNamespaceIdentifier(specifier);++ const lines = [+ `import { ${namespaceIdentifier} } from ${JSON.stringify(FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER)};`,+ ];++ for (const [index, exportName] of exportNames.namedExports.entries()) {+ lines.push(+ `const __sharedDependenciesExport${index} = ${namespaceIdentifier}[${JSON.stringify(exportName)}];`,+ `export { __sharedDependenciesExport${index} as ${JSON.stringify(exportName)} };`,+ );+ }++ if (exportNames.hasDefaultExport) {+ lines.push(`export default ${namespaceIdentifier}.default;`);+ }++ return lines.join('\n');+};diff --git a/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/utils/to-shared-dependencies-namespace-identifier.ts b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/utils/to-shared-dependencies-namespace-identifier.tsnew file mode 100644index 00000000000..055d6f064ec--- /dev/null+++ b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/shared-dependencies-build/utils/to-shared-dependencies-namespace-identifier.ts@@ -0,0 +1,4 @@+export const toSharedDependenciesNamespaceIdentifier = (+ specifier: string,+): string =>+ `__shared_dependencies_${specifier.replace(/[^A-Za-z0-9]/g, '_')}__`;diff --git a/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/utils/get-front-component-build-plugins.ts b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/utils/get-front-component-build-plugins.tsindex e93eaad622b..bb981e22054 100644--- a/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/utils/get-front-component-build-plugins.ts+++ b/packages/twenty-sdk/src/cli/utilities/build/common/front-component-build/utils/get-front-component-build-plugins.ts@@ -1,5 +1,8 @@import type * as esbuild from 'esbuild';+import { isDefined } from 'twenty-shared/utils';+import { createSharedDependenciesShimPlugin } from '@/cli/utilities/build/common/front-component-build/shared-dependencies-build/create-shared-dependencies-shim-plugin';+import { type SharedDependenciesBuildContext } from '@/cli/utilities/build/common/front-component-build/shared-dependencies-build/types/shared-dependencies-build-context.type';import { cssInjectionPlugin } from '../css-injection-plugin';import { createJsxRuntimeRemoteWrapperPlugin } from '../jsx-runtime-remote-wrapper-plugin';import { jsxTransformToRemoteDomWorkerFormatPlugin } from '../jsx-transform-to-remote-dom-worker-format-plugin';@@ -8,11 +11,19 @@ import { stripCommentsPlugin } from '../strip-comments-plugin';type GetFrontComponentBuildPluginsOptions = {usePreact?: boolean;+ getSharedDependenciesBuildContext?: () => SharedDependenciesBuildContext | null;};export const getFrontComponentBuildPlugins = (options?: GetFrontComponentBuildPluginsOptions,): esbuild.Plugin[] => [+ ...(isDefined(options?.getSharedDependenciesBuildContext)+ ? [+ createSharedDependenciesShimPlugin(+ options.getSharedDependenciesBuildContext,+ ),+ ]+ : []),createJsxRuntimeRemoteWrapperPlugin(options?.usePreact ? { usePreact: true } : undefined,),diff --git a/packages/twenty-sdk/src/cli/utilities/build/manifest/manifest-build.ts b/packages/twenty-sdk/src/cli/utilities/build/manifest/manifest-build.tsindex ab3cef101d4..6dc815d72b7 100644--- a/packages/twenty-sdk/src/cli/utilities/build/manifest/manifest-build.ts+++ b/packages/twenty-sdk/src/cli/utilities/build/manifest/manifest-build.ts@@ -9,6 +9,7 @@ import { extractManifestFromFile } from '@/cli/utilities/build/manifest/manifestimport { addMissingFieldOptionIds } from '@/cli/utilities/build/manifest/utils/add-missing-field-option-ids';import { fromRoleConfigToRoleManifest } from '@/cli/utilities/build/manifest/utils/from-role-config-to-role-manifest';import { getDefaultFieldsInObjectFields } from '@/cli/utilities/build/manifest/utils/get-default-fields-in-object-fields';+import { extractFrontComponentSharedDependencies } from '@/cli/utilities/build/manifest/utils/extract-front-component-shared-dependencies';import { validateConditionalAvailabilityUsage } from '@/cli/utilities/build/manifest/utils/validate-conditional-availability-usage';import { validateViewFilterOperands } from '@/cli/utilities/build/manifest/utils/validate-view-filter-operands';import { getEngineVersionRange } from '@/cli/utilities/version/get-engine-version-range';@@ -55,7 +56,7 @@ import {getInputSchemaFromSourceCode,jsonSchemaToInputSchema,} from 'twenty-shared/logic-function';-import { assertUnreachable } from 'twenty-shared/utils';+import { assertUnreachable, isDefined } from 'twenty-shared/utils';const loadSources = async (appPath: string): Promise<string[]> => {return await glob(['**/*.ts', '**/*.tsx'], {@@ -563,21 +564,24 @@ export const buildManifest = async (}if (uninstallLogicFunctions.length > 1) {- errors.push(- 'Only one uninstall logic function is allowed per application',- );+ errors.push('Only one uninstall logic function is allowed per application');}if (settingsFrontComponentUniversalIdentifiers.length > 1) {- errors.push(- 'Only one settings front component is allowed per application',- );+ errors.push('Only one settings front component is allowed per application');}if (applicationRoleUniversalIdentifiers.length > 1) {errors.push('Only one defineApplicationRole is allowed per application');}+ const {+ sharedDependencies,+ errors: sharedDependenciesErrors,+ } = await extractFrontComponentSharedDependencies(appPath);++ errors.push(...sharedDependenciesErrors);+const resolvedDefaultRoleUniversalIdentifier =applicationConfig?.defaultRoleUniversalIdentifier ??(applicationRoleUniversalIdentifiers.length === 1@@ -634,6 +638,9 @@ export const buildManifest = async (},}: {}),+ ...(isDefined(sharedDependencies)+ ? { frontComponentSharedDependencies: sharedDependencies }+ : {}),};})(): undefined;diff --git a/packages/twenty-sdk/src/cli/utilities/build/manifest/manifest-update-checksums.ts b/packages/twenty-sdk/src/cli/utilities/build/manifest/manifest-update-checksums.tsindex 4fc96b91b2c..771e3c7b465 100644--- a/packages/twenty-sdk/src/cli/utilities/build/manifest/manifest-update-checksums.ts+++ b/packages/twenty-sdk/src/cli/utilities/build/manifest/manifest-update-checksums.ts@@ -1,6 +1,7 @@import { relative } from 'path';import { type Manifest, OUTPUT_DIR } from 'twenty-shared/application';import { FileFolder } from 'twenty-shared/types';+import { isDefined } from 'twenty-shared/utils';import type { EntityFilePaths } from '@/cli/utilities/build/manifest/manifest-extract-config';@@ -65,6 +66,26 @@ export const manifestUpdateChecksums = ({}if (fileFolder === FileFolder.BuiltFrontComponent) {+ const sharedDependencies =+ result.application.frontComponentSharedDependencies;++ if (+ isDefined(sharedDependencies) &&+ sharedDependencies.builtPath === rootBuiltPath+ ) {+ result = {+ ...result,+ application: {+ ...result.application,+ frontComponentSharedDependencies: {+ ...sharedDependencies,+ builtChecksum: checksum,+ },+ },+ };+ continue;+ }+const frontComponents = result.frontComponents;const componentIndex =frontComponents.findIndex(diff --git a/packages/twenty-sdk/src/cli/utilities/build/manifest/utils/__tests__/extract-front-component-shared-dependencies.spec.ts b/packages/twenty-sdk/src/cli/utilities/build/manifest/utils/__tests__/extract-front-component-shared-dependencies.spec.tsnew file mode 100644index 00000000000..ea666b1d51d--- /dev/null+++ b/packages/twenty-sdk/src/cli/utilities/build/manifest/utils/__tests__/extract-front-component-shared-dependencies.spec.ts@@ -0,0 +1,91 @@+import { mkdtemp, rm, writeFile } from 'node:fs/promises';+import { tmpdir } from 'node:os';+import { join } from 'path';++import { afterEach, describe, expect, it } from 'vitest';++import { extractFrontComponentSharedDependencies } from '@/cli/utilities/build/manifest/utils/extract-front-component-shared-dependencies';+import { FRONT_COMPONENT_SHARED_DEPENDENCIES_BUILT_PATH } from 'twenty-shared/application';++const scratchDirs: string[] = [];++const writeAppPackageJson = async (packageJson: unknown): Promise<string> => {+ const appPath = await mkdtemp(join(tmpdir(), 'shared-dependencies-extract-'));++ scratchDirs.push(appPath);+ await writeFile(+ join(appPath, 'package.json'),+ JSON.stringify(packageJson),+ 'utf-8',+ );++ return appPath;+};++describe('extractFrontComponentSharedDependencies', () => {+ afterEach(async () => {+ await Promise.all(+ scratchDirs+ .splice(0)+ .map((dir) => rm(dir, { recursive: true, force: true })),+ );+ });++ it('extracts and normalizes the declared dependencies', async () => {+ const appPath = await writeAppPackageJson({+ frontComponentSharedDependencies: ['react', 'react-dom/client'],+ });++ const { sharedDependencies, errors } =+ await extractFrontComponentSharedDependencies(appPath);++ expect(errors).toEqual([]);+ expect(sharedDependencies).toEqual({+ dependencies: ['react', 'react-dom/client', 'react/jsx-runtime'],+ builtPath: FRONT_COMPONENT_SHARED_DEPENDENCIES_BUILT_PATH,+ builtChecksum: null,+ });+ });++ it.each([+ ['an absent key', {}],+ ['an empty array', { frontComponentSharedDependencies: [] }],+ ])('returns no bundle and no error for %s', async (_label, packageJson) => {+ const appPath = await writeAppPackageJson(packageJson);++ const { sharedDependencies, errors } =+ await extractFrontComponentSharedDependencies(appPath);++ expect(errors).toEqual([]);+ expect(sharedDependencies).toBeUndefined();+ });++ it('rejects a value that is not an array', async () => {+ const appPath = await writeAppPackageJson({+ frontComponentSharedDependencies: { react: '^19' },+ });++ const { sharedDependencies, errors } =+ await extractFrontComponentSharedDependencies(appPath);++ expect(sharedDependencies).toBeUndefined();+ expect(errors[0]).toContain('must be an array of package specifiers');+ });++ it.each([+ ['a relative path', ['./local-module']],+ ['a reserved package', ['twenty-sdk/define']],+ ['a duplicated dependency', ['react', 'react']],+ ['a non-string entry', ['react', 42]],+ ])('rejects %s', async (_label, dependencies) => {+ const appPath = await writeAppPackageJson({+ frontComponentSharedDependencies: dependencies,+ });++ const { sharedDependencies, errors } =+ await extractFrontComponentSharedDependencies(appPath);++ expect(sharedDependencies).toBeUndefined();+ expect(errors).not.toEqual([]);+ });+});diff --git a/packages/twenty-sdk/src/cli/utilities/build/manifest/utils/extract-front-component-shared-dependencies.ts b/packages/twenty-sdk/src/cli/utilities/build/manifest/utils/extract-front-component-shared-dependencies.tsnew file mode 100644index 00000000000..7de8c775e02--- /dev/null+++ b/packages/twenty-sdk/src/cli/utilities/build/manifest/utils/extract-front-component-shared-dependencies.ts@@ -0,0 +1,112 @@+import { normalizeFrontComponentSharedDependencies } from '@/cli/utilities/build/manifest/utils/normalize-front-component-shared-dependencies';+import { pathExists, readJson } from '@/cli/utilities/file/fs-utils';+import { isNonEmptyArray, isNonEmptyString } from '@sniptt/guards';+import path from 'path';+import {+ FRONT_COMPONENT_SHARED_DEPENDENCIES_BUILT_PATH,+ type FrontComponentSharedDependenciesManifest,+ FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER,+} from 'twenty-shared/application';++const RESERVED_DEPENDENCY_PREFIXES = ['twenty-client-sdk', 'twenty-sdk'];++type PackageJsonWithSharedDependencies = {+ frontComponentSharedDependencies?: unknown;+};++const getSharedDependenciesErrors = (dependencies: string[]): string[] => {+ const errors: string[] = [];+ const seenDependencies = new Set<string>();++ for (const dependency of dependencies) {+ if (!isNonEmptyString(dependency)) {+ errors.push(+ '"frontComponentSharedDependencies" entries in package.json must be non-empty strings',+ );+ continue;+ }++ if (dependency.startsWith('.') || dependency.startsWith('/')) {+ errors.push(+ `Shared dependency "${dependency}" must be a package specifier, not a relative or absolute path`,+ );+ continue;+ }++ if (dependency === FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER) {+ errors.push(+ `Shared dependency "${dependency}" is reserved and cannot be shared`,+ );+ continue;+ }++ if (+ RESERVED_DEPENDENCY_PREFIXES.some(+ (prefix) =>+ dependency === prefix || dependency.startsWith(`${prefix}/`),+ )+ ) {+ errors.push(+ `Shared dependency "${dependency}" is already served separately and cannot be shared`,+ );+ continue;+ }++ if (seenDependencies.has(dependency)) {+ errors.push(`Shared dependency "${dependency}" is declared twice`);+ continue;+ }++ seenDependencies.add(dependency);+ }++ return errors;+};++export const extractFrontComponentSharedDependencies = async (+ appPath: string,+): Promise<{+ sharedDependencies?: FrontComponentSharedDependenciesManifest;+ errors: string[];+}> => {+ const packageJsonPath = path.join(appPath, 'package.json');++ if (!(await pathExists(packageJsonPath))) {+ return { errors: [] };+ }++ const packageJson =+ await readJson<PackageJsonWithSharedDependencies>(packageJsonPath);+ const declaredDependencies = packageJson.frontComponentSharedDependencies;++ if (declaredDependencies === undefined) {+ return { errors: [] };+ }++ if (!Array.isArray(declaredDependencies)) {+ return {+ errors: [+ '"frontComponentSharedDependencies" in package.json must be an array of package specifiers',+ ],+ };+ }++ if (!isNonEmptyArray(declaredDependencies)) {+ return { errors: [] };+ }++ const errors = getSharedDependenciesErrors(declaredDependencies);++ if (isNonEmptyArray(errors)) {+ return { errors };+ }++ return {+ sharedDependencies: {+ dependencies: normalizeFrontComponentSharedDependencies(declaredDependencies),+ builtPath: FRONT_COMPONENT_SHARED_DEPENDENCIES_BUILT_PATH,+ builtChecksum: null,+ },+ errors: [],+ };+};diff --git a/packages/twenty-sdk/src/cli/utilities/build/manifest/utils/normalize-front-component-shared-dependencies.ts b/packages/twenty-sdk/src/cli/utilities/build/manifest/utils/normalize-front-component-shared-dependencies.tsnew file mode 100644index 00000000000..c05544766df--- /dev/null+++ b/packages/twenty-sdk/src/cli/utilities/build/manifest/utils/normalize-front-component-shared-dependencies.ts@@ -0,0 +1,11 @@+export const normalizeFrontComponentSharedDependencies = (+ dependencies: string[],+): string[] => {+ const normalizedDependencies = new Set(dependencies);++ if (normalizedDependencies.has('react')) {+ normalizedDependencies.add('react/jsx-runtime');+ }++ return [...normalizedDependencies].sort();+};diff --git a/packages/twenty-sdk/src/cli/utilities/dev/orchestrator/steps/start-watchers-orchestrator-step.ts b/packages/twenty-sdk/src/cli/utilities/dev/orchestrator/steps/start-watchers-orchestrator-step.tsindex ac3ded2997a..2180fdd8371 100644--- a/packages/twenty-sdk/src/cli/utilities/dev/orchestrator/steps/start-watchers-orchestrator-step.ts+++ b/packages/twenty-sdk/src/cli/utilities/dev/orchestrator/steps/start-watchers-orchestrator-step.ts@@ -1,9 +1,9 @@import {- createFrontComponentsWatcher,createLogicFunctionsWatcher,type EsbuildWatcher,} from '@/cli/utilities/build/common/esbuild-watcher';import { FileUploadWatcher } from '@/cli/utilities/build/common/file-upload-watcher';+import { FrontComponentsWatcher } from '@/cli/utilities/build/common/front-component-build/front-components-watcher';import { TscWatcher } from '@/cli/utilities/build/common/tsc-watcher';import { type TypecheckError } from '@/cli/utilities/build/common/typecheck-plugin';import { type ManifestBuildResult } from '@/cli/utilities/build/manifest/manifest-update-checksums';@@ -11,7 +11,10 @@ import { ManifestWatcher } from '@/cli/utilities/build/manifest/manifest-watcherimport { type OrchestratorState } from '@/cli/utilities/dev/orchestrator/dev-mode-orchestrator-state';import type { Location } from 'esbuild';import { type ChokidarFsEvent } from '@/cli/types';-import { ASSETS_DIR } from 'twenty-shared/application';+import {+ ASSETS_DIR,+ type FrontComponentSharedDependenciesManifest,+} from 'twenty-shared/application';import { FileFolder } from 'twenty-shared/types';export type FileBuiltEvent = {@@ -36,7 +39,7 @@ export class StartWatchersOrchestratorStep {private manifestWatcher: ManifestWatcher | null = null;private logicFunctionsWatcher: EsbuildWatcher | null = null;- private frontComponentsWatcher: EsbuildWatcher | null = null;+ private frontComponentsWatcher: FrontComponentsWatcher | null = null;private assetWatcher: FileUploadWatcher | null = null;private dependencyWatcher: FileUploadWatcher | null = null;private tscWatcher: TscWatcher | null = null;@@ -72,11 +75,17 @@ export class StartWatchersOrchestratorStep {async handleWatcherRestarts(result: ManifestBuildResult): Promise<void> {const { logicFunctions, frontComponents } = result.filePaths;+ const sharedDependencies =+ result.manifest?.application.frontComponentSharedDependencies;if (!this.state.steps.startWatchers.output.watchersStarted) {this.state.steps.startWatchers.output.watchersStarted = true;this.state.steps.startWatchers.status = 'done';- await this.startFileWatchers(logicFunctions, frontComponents);+ await this.startFileWatchers(+ logicFunctions,+ frontComponents,+ sharedDependencies,+ );return;}@@ -85,8 +94,16 @@ export class StartWatchersOrchestratorStep {await this.logicFunctionsWatcher.restart(logicFunctions);}- if (this.frontComponentsWatcher?.shouldRestart(frontComponents)) {- await this.frontComponentsWatcher.restart(frontComponents);+ if (+ this.frontComponentsWatcher?.shouldRestart(+ frontComponents,+ sharedDependencies,+ )+ ) {+ await this.frontComponentsWatcher.restart(+ frontComponents,+ sharedDependencies,+ );}}@@ -165,11 +182,12 @@ export class StartWatchersOrchestratorStep {private async startFileWatchers(logicFunctions: string[],frontComponents: string[],+ sharedDependencies: FrontComponentSharedDependenciesManifest | undefined,): Promise<void> {await Promise.all([this.startTscWatcher(),this.startLogicFunctionsWatcher(logicFunctions),- this.startFrontComponentsWatcher(frontComponents),+ this.startFrontComponentsWatcher(frontComponents, sharedDependencies),this.startAssetWatcher(),this.startDependencyWatcher(),]);@@ -191,10 +209,12 @@ export class StartWatchersOrchestratorStep {private async startFrontComponentsWatcher(sourcePaths: string[],+ sharedDependencies: FrontComponentSharedDependenciesManifest | undefined,): Promise<void> {- this.frontComponentsWatcher = createFrontComponentsWatcher({+ this.frontComponentsWatcher = new FrontComponentsWatcher({appPath: this.state.appPath,sourcePaths,+ sharedDependencies,shouldSkipTypecheck: this.shouldSkipTypecheck,handleBuildError: this.handleFileBuildError.bind(this),handleFileBuilt: this.handleFileBuilt.bind(this),diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-31/2-31-instance-command-fast-1786529082690-add-front-component-shared-dependencies-to-application.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-31/2-31-instance-command-fast-1786529082690-add-front-component-shared-dependencies-to-application.tsnew file mode 100644index 00000000000..d5b7a4ebcff--- /dev/null+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-31/2-31-instance-command-fast-1786529082690-add-front-component-shared-dependencies-to-application.ts@@ -0,0 +1,25 @@+import { type QueryRunner } from 'typeorm';++import { RegisteredInstanceCommand } from 'src/engine/core-modules/upgrade/decorators/registered-instance-command.decorator';+import { type FastInstanceCommand } from 'src/engine/core-modules/upgrade/interfaces/fast-instance-command.interface';++@RegisteredInstanceCommand('2.31.0', 1786529082690)+export class AddFrontComponentSharedDependenciesToApplicationFastInstanceCommand implements FastInstanceCommand {+ public async up(queryRunner: QueryRunner): Promise<void> {+ await queryRunner.query(+ 'ALTER TABLE "core"."application" ADD COLUMN IF NOT EXISTS "frontComponentSharedDependenciesChecksum" text',+ );+ await queryRunner.query(+ 'ALTER TABLE "core"."application" ADD COLUMN IF NOT EXISTS "frontComponentSharedDependenciesBuiltPath" text',+ );+ }++ public async down(queryRunner: QueryRunner): Promise<void> {+ await queryRunner.query(+ 'ALTER TABLE "core"."application" DROP COLUMN IF EXISTS "frontComponentSharedDependenciesChecksum"',+ );+ await queryRunner.query(+ 'ALTER TABLE "core"."application" DROP COLUMN IF EXISTS "frontComponentSharedDependenciesBuiltPath"',+ );+ }+}diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/instance-commands.constant.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/instance-commands.constant.tsindex b602840dbce..04c12ba5d33 100644--- a/packages/twenty-server/src/database/commands/upgrade-version-command/instance-commands.constant.ts+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/instance-commands.constant.ts@@ -61,6 +61,7 @@ import { CreateApplicationAuthorizationCoreTableFastInstanceCommand } from 'src/import { AddOnDisconnectLogicFunctionToConnectionProviderFastInstanceCommand } from 'src/database/commands/upgrade-version-command/2-27/2-27-instance-command-fast-1785810340935-add-on-disconnect-logic-function-to-connection-provider';import { AddCallRecordingWidgetTypesFastInstanceCommand } from 'src/database/commands/upgrade-version-command/2-29/2-29-instance-command-fast-1786009374684-add-call-recording-widget-types';import { AddIsSystemSideEffectToViewFieldGroupFastInstanceCommand } from 'src/database/commands/upgrade-version-command/2-31/2-31-instance-command-fast-1786437480000-add-is-system-side-effect-to-view-field-group';+import { AddFrontComponentSharedDependenciesToApplicationFastInstanceCommand } from 'src/database/commands/upgrade-version-command/2-31/2-31-instance-command-fast-1786529082690-add-front-component-shared-dependencies-to-application';import { AddSubFieldNameToViewSortEarlyFastInstanceCommand } from 'src/database/commands/upgrade-version-command/2-3/2-3-instance-command-fast-1747234200000-add-sub-field-name-to-view-sort';import { AddRelationTargetFieldMetadataIdToViewFilterEarlyFastInstanceCommand } from 'src/database/commands/upgrade-version-command/2-3/2-3-instance-command-fast-1747234300000-add-relation-target-field-metadata-id-to-view-filter';import { AddUpgradeMigrationWorkspaceIdIndexFastInstanceCommand } from 'src/database/commands/upgrade-version-command/2-3/2-3-instance-command-fast-1777308014234-add-upgrade-migration-workspace-id-index';@@ -280,4 +281,5 @@ export const INSTANCE_COMMANDS = [AddCallRecordingWidgetTypesFastInstanceCommand,AddListWidgetViewTypeFastInstanceCommand,AddIsSystemSideEffectToViewFieldGroupFastInstanceCommand,+ AddFrontComponentSharedDependenciesToApplicationFastInstanceCommand,];diff --git a/packages/twenty-server/src/engine/core-modules/application/application-install/utils/__tests__/build-application-file-list.util.spec.ts b/packages/twenty-server/src/engine/core-modules/application/application-install/utils/__tests__/build-application-file-list.util.spec.tsindex bbf819883b2..df6a2d6117e 100644--- a/packages/twenty-server/src/engine/core-modules/application/application-install/utils/__tests__/build-application-file-list.util.spec.ts+++ b/packages/twenty-server/src/engine/core-modules/application/application-install/utils/__tests__/build-application-file-list.util.spec.ts@@ -6,6 +6,7 @@ import { buildApplicationFileList } from 'src/engine/core-modules/application/apdescribe('buildApplicationFileList', () => {it('includes source and built files for logic functions and front components', () => {const manifest = {+ application: {},logicFunctions: [{sourceHandlerPath: 'src/send-email.function.ts',@@ -59,4 +60,26 @@ describe('buildApplicationFileList', () => {},]);});++ it('includes the shared dependencies bundle when the application declares one', () => {+ const manifest = {+ application: {+ frontComponentSharedDependencies: {+ dependencies: ['react'],+ builtPath: 'front-component-shared-dependencies.mjs',+ builtChecksum: 'checksum',+ },+ },+ } as Manifest;++ expect(buildApplicationFileList(manifest)).toEqual(+ expect.arrayContaining([+ {+ relativePath: 'front-component-shared-dependencies.mjs',+ fileFolder: FileFolder.BuiltFrontComponent,+ isRequired: true,+ },+ ]),+ );+ });});diff --git a/packages/twenty-server/src/engine/core-modules/application/application-install/utils/build-application-file-list.util.ts b/packages/twenty-server/src/engine/core-modules/application/application-install/utils/build-application-file-list.util.tsindex 158924c99d7..8dcc2faf885 100644--- a/packages/twenty-server/src/engine/core-modules/application/application-install/utils/build-application-file-list.util.ts+++ b/packages/twenty-server/src/engine/core-modules/application/application-install/utils/build-application-file-list.util.ts@@ -1,5 +1,6 @@import { type Manifest } from 'twenty-shared/application';import { FileFolder } from 'twenty-shared/types';+import { isDefined } from 'twenty-shared/utils';export type ApplicationFileToStore = {relativePath: string;@@ -53,6 +54,17 @@ export const buildApplicationFileList = ();}+ const sharedDependencies =+ manifest.application.frontComponentSharedDependencies;++ if (isDefined(sharedDependencies)) {+ files.push({+ relativePath: sharedDependencies.builtPath,+ fileFolder: FileFolder.BuiltFrontComponent,+ isRequired: true,+ });+ }+for (const publicAsset of manifest.publicAssets ?? []) {files.push({relativePath: publicAsset.filePath,diff --git a/packages/twenty-server/src/engine/core-modules/application/application-manifest/application-manifest.module.ts b/packages/twenty-server/src/engine/core-modules/application/application-manifest/application-manifest.module.tsindex 4a00998fd94..f3b1cbc7fe5 100644--- a/packages/twenty-server/src/engine/core-modules/application/application-manifest/application-manifest.module.ts+++ b/packages/twenty-server/src/engine/core-modules/application/application-manifest/application-manifest.module.ts@@ -15,13 +15,17 @@ import { FileStorageModule } from 'src/engine/core-modules/file-storage/file-stoimport { LogicFunctionExecutorModule } from 'src/engine/core-modules/logic-function/logic-function-executor/logic-function-executor.module';import { SecretEncryptionModule } from 'src/engine/core-modules/secret-encryption/secret-encryption.module';import { SdkClientModule } from 'src/engine/core-modules/sdk-client/sdk-client.module';+import { FrontComponentEntity } from 'src/engine/metadata-modules/front-component/entities/front-component.entity';import { PermissionsModule } from 'src/engine/metadata-modules/permissions/permissions.module';import { WorkspaceCacheModule } from 'src/engine/workspace-cache/workspace-cache.module';import { WorkspaceMigrationModule } from 'src/engine/workspace-manager/workspace-migration/workspace-migration.module';@Module({imports: [- TypeOrmModule.forFeature([ApplicationRegistrationEntity]),+ TypeOrmModule.forFeature([+ ApplicationRegistrationEntity,+ FrontComponentEntity,+ ]),ApplicationModule,ApplicationRegistrationModule,ApplicationTranslationModule,diff --git a/packages/twenty-server/src/engine/core-modules/application/application-manifest/application-sync.service.ts b/packages/twenty-server/src/engine/core-modules/application/application-manifest/application-sync.service.tsindex ff148f4281a..03c5167d9a2 100644--- a/packages/twenty-server/src/engine/core-modules/application/application-manifest/application-sync.service.ts+++ b/packages/twenty-server/src/engine/core-modules/application/application-manifest/application-sync.service.ts@@ -29,6 +29,8 @@ import { type LogicFunctionDriverFactory } from 'src/engine/core-modules/logic-fimport { LogicFunctionExecutorService } from 'src/engine/core-modules/logic-function/logic-function-executor/logic-function-executor.service';import { createEmptyAllFlatEntityMaps } from 'src/engine/metadata-modules/flat-entity/constant/create-empty-all-flat-entity-maps.constant';import { getMetadataFlatEntityMapsKey } from 'src/engine/metadata-modules/flat-entity/utils/get-metadata-flat-entity-maps-key.util';+import { FrontComponentEntity } from 'src/engine/metadata-modules/front-component/entities/front-component.entity';+import { WorkspaceEventBroadcaster } from 'src/engine/subscriptions/workspace-event-broadcaster/workspace-event-broadcaster.service';import { WorkspaceCacheService } from 'src/engine/workspace-cache/services/workspace-cache.service';import { WorkspaceMigrationBuilderException } from 'src/engine/workspace-manager/workspace-migration/exceptions/workspace-migration-builder-exception';import { WorkspaceMigrationValidateBuildAndRunService } from 'src/engine/workspace-manager/workspace-migration/services/workspace-migration-validate-build-and-run-service';@@ -51,6 +53,9 @@ export class ApplicationSyncService {private readonly logicFunctionExecutorService: LogicFunctionExecutorService,@InjectRepository(ApplicationRegistrationEntity)private readonly appRegistrationRepository: Repository<ApplicationRegistrationEntity>,+ @InjectRepository(FrontComponentEntity)+ private readonly frontComponentRepository: Repository<FrontComponentEntity>,+ private readonly workspaceEventBroadcaster: WorkspaceEventBroadcaster,) {}public async synchronizeFromManifest({@@ -171,6 +176,8 @@ export class ApplicationSyncService {autoUpgrade: false,isSdkLayerStale: false,sdkClientCoreChecksum: null,+ frontComponentSharedDependenciesChecksum: null,+ frontComponentSharedDependenciesBuiltPath: null,applicationRegistrationId: null,primaryPublicDomainId: null,createdAt: now,@@ -249,16 +256,78 @@ export class ApplicationSyncService {const resolvedRegistrationId =applicationRegistrationId ?? application.applicationRegistrationId;- return await this.applicationService.update(application.id, {- name,- description: manifest.application.description,- logo: manifest.application.logo ?? manifest.application.logoUrl ?? null,- version: packageJson.version,- packageJsonChecksum: manifest.application.packageJsonChecksum,- yarnLockChecksum: manifest.application.yarnLockChecksum,- applicationRegistrationId: resolvedRegistrationId,- workspaceId,- });+ const frontComponentSharedDependenciesChecksum =+ manifest.application.frontComponentSharedDependencies?.builtChecksum ??+ null;+ const frontComponentSharedDependenciesBuiltPath =+ manifest.application.frontComponentSharedDependencies?.builtPath ?? null;++ const updatedApplication = await this.applicationService.update(+ application.id,+ {+ name,+ description: manifest.application.description,+ logo: manifest.application.logo ?? manifest.application.logoUrl ?? null,+ version: packageJson.version,+ packageJsonChecksum: manifest.application.packageJsonChecksum,+ yarnLockChecksum: manifest.application.yarnLockChecksum,+ frontComponentSharedDependenciesChecksum,+ frontComponentSharedDependenciesBuiltPath,+ applicationRegistrationId: resolvedRegistrationId,+ workspaceId,+ },+ );++ if (+ application.frontComponentSharedDependenciesChecksum !==+ frontComponentSharedDependenciesChecksum+ ) {+ await this.broadcastFrontComponentSharedDependenciesChecksumUpdates({+ workspaceId,+ applicationId: application.id,+ frontComponentSharedDependenciesChecksum,+ });+ }++ return updatedApplication;+ }++ private async broadcastFrontComponentSharedDependenciesChecksumUpdates({+ workspaceId,+ applicationId,+ frontComponentSharedDependenciesChecksum,+ }: {+ workspaceId: string;+ applicationId: string;+ frontComponentSharedDependenciesChecksum: string | null;+ }): Promise<void> {+ try {+ const frontComponents = await this.frontComponentRepository.find({+ select: ['id'],+ where: { applicationId, workspaceId },+ });++ await this.workspaceEventBroadcaster.broadcast({+ workspaceId,+ events: frontComponents.map((frontComponent) => ({+ type: 'updated',+ entityName: 'frontComponent',+ recordId: frontComponent.id,+ properties: {+ updatedFields: ['frontComponentSharedDependenciesChecksum'],+ after: {+ id: frontComponent.id,+ frontComponentSharedDependenciesChecksum,+ },+ },+ })),+ });+ } catch (error) {+ this.logger.warn(+ `Failed to broadcast the shared dependencies checksum update for application ${applicationId} in workspace ${workspaceId}`,+ error,+ );+ }}public async uninstallApplication({diff --git a/packages/twenty-server/src/engine/core-modules/application/application.entity.ts b/packages/twenty-server/src/engine/core-modules/application/application.entity.tsindex 6e648449c86..4eed5edc7d6 100644--- a/packages/twenty-server/src/engine/core-modules/application/application.entity.ts+++ b/packages/twenty-server/src/engine/core-modules/application/application.entity.ts@@ -136,6 +136,20 @@ export class ApplicationEntity extends WorkspaceRelatedEntity {})sdkClientCoreChecksum: string | null;+ @Column({ nullable: true, type: 'text' })+ @WasIntroducedInUpgrade({+ upgradeCommandName:+ '2.31.0_AddFrontComponentSharedDependenciesToApplicationFastInstanceCommand_1786529082690',+ })+ frontComponentSharedDependenciesChecksum: string | null;++ @Column({ nullable: true, type: 'text' })+ @WasIntroducedInUpgrade({+ upgradeCommandName:+ '2.31.0_AddFrontComponentSharedDependenciesToApplicationFastInstanceCommand_1786529082690',+ })+ frontComponentSharedDependenciesBuiltPath: string | null;+@Column({ nullable: true, type: 'uuid' })applicationRegistrationId: string | null;diff --git a/packages/twenty-server/src/engine/core-modules/application/front-component-shared-dependencies/front-component-shared-dependencies.controller.ts b/packages/twenty-server/src/engine/core-modules/application/front-component-shared-dependencies/front-component-shared-dependencies.controller.tsnew file mode 100644index 00000000000..6f1901a046c--- /dev/null+++ b/packages/twenty-server/src/engine/core-modules/application/front-component-shared-dependencies/front-component-shared-dependencies.controller.ts@@ -0,0 +1,116 @@+import {+ Controller,+ Get,+ Logger,+ Param,+ Res,+ UseFilters,+ UseGuards,+} from '@nestjs/common';++import { pipeline } from 'stream/promises';++import { Response } from 'express';+import { ApiPath, FileFolder } from 'twenty-shared/types';++import { ApplicationRestApiExceptionFilter } from 'src/engine/core-modules/application/application-rest-api-exception.filter';+import { FrontComponentSharedDependenciesService } from 'src/engine/core-modules/application/front-component-shared-dependencies/front-component-shared-dependencies.service';+import { extractChecksumFromCacheKey } from 'src/engine/core-modules/application/front-component-shared-dependencies/utils/extract-checksum-from-cache-key.util';+import { getSharedDependenciesBundleCacheControl } from 'src/engine/core-modules/application/front-component-shared-dependencies/utils/get-shared-dependencies-bundle-cache-control.util';+import {+ ApplicationException,+ ApplicationExceptionCode,+} from 'src/engine/core-modules/application/application.exception';+import {+ FileStorageException,+ FileStorageExceptionCode,+} from 'src/engine/core-modules/file-storage/interfaces/file-storage-exception';+import { PRESIGNED_URL_NO_STORE_CACHE_CONTROL } from 'src/engine/core-modules/file/interfaces/file-folder.interface';+import { setFileResponseHeaders } from 'src/engine/core-modules/file/utils/set-file-response-headers.utils';+import { WorkspaceEntity } from 'src/engine/core-modules/workspace/workspace.entity';+import { AuthWorkspace } from 'src/engine/decorators/auth/auth-workspace.decorator';+import { NoPermissionGuard } from 'src/engine/guards/no-permission.guard';+import { WorkspaceAuthGuard } from 'src/engine/guards/workspace-auth.guard';++@Controller(`${ApiPath.Rest}/front-component-shared-dependencies`)+@UseGuards(WorkspaceAuthGuard)+@UseFilters(ApplicationRestApiExceptionFilter)+export class FrontComponentSharedDependenciesController {+ private readonly logger = new Logger(+ FrontComponentSharedDependenciesController.name,+ );++ constructor(+ private readonly frontComponentSharedDependenciesService: FrontComponentSharedDependenciesService,+ ) {}++ @Get([':applicationId', ':applicationId/:cacheKey'])+ @UseGuards(NoPermissionGuard)+ async getBuiltSharedDependencies(+ @Res() res: Response,+ @Param('applicationId') applicationId: string,+ @AuthWorkspace() workspace: WorkspaceEntity,+ @Param('cacheKey') cacheKey?: string,+ ) {+ const { fileResponse, frontComponentSharedDependenciesChecksum } =+ await this.frontComponentSharedDependenciesService+ .getBuiltSharedDependenciesPresignedUrlOrStream({+ applicationId,+ workspaceId: workspace.id,+ })+ .catch((error) => {+ if (+ error instanceof FileStorageException &&+ error.code === FileStorageExceptionCode.FILE_NOT_FOUND+ ) {+ throw new ApplicationException(+ `Shared dependencies bundle not found for application "${applicationId}"`,+ ApplicationExceptionCode.ENTITY_NOT_FOUND,+ );+ }++ if (!(error instanceof ApplicationException)) {+ this.logger.error(+ 'getBuiltSharedDependenciesPresignedUrlOrStream failed unexpectedly',+ { error },+ );+ }++ throw error;+ });++ if (fileResponse.type === 'redirect') {+ res.setHeader('Cache-Control', PRESIGNED_URL_NO_STORE_CACHE_CONTROL);++ return res.json({ url: fileResponse.presignedUrl });+ }++ setFileResponseHeaders(+ res,+ fileResponse.mimeType,+ FileFolder.BuiltFrontComponent,+ );+ res.setHeader(+ 'Cache-Control',+ getSharedDependenciesBundleCacheControl({+ requestedChecksum: extractChecksumFromCacheKey(cacheKey),+ frontComponentSharedDependenciesChecksum,+ }),+ );++ try {+ await pipeline(fileResponse.stream, res);+ } catch (error) {+ this.logger.error(+ 'Shared dependencies bundle stream failed mid-transfer',+ { error },+ );++ if (!res.headersSent) {+ throw error;+ }++ res.destroy();+ }+ }+}diff --git a/packages/twenty-server/src/engine/core-modules/application/front-component-shared-dependencies/front-component-shared-dependencies.module.ts b/packages/twenty-server/src/engine/core-modules/application/front-component-shared-dependencies/front-component-shared-dependencies.module.tsnew file mode 100644index 00000000000..b5416c68f3c--- /dev/null+++ b/packages/twenty-server/src/engine/core-modules/application/front-component-shared-dependencies/front-component-shared-dependencies.module.ts@@ -0,0 +1,14 @@+import { Module } from '@nestjs/common';++import { FrontComponentSharedDependenciesController } from 'src/engine/core-modules/application/front-component-shared-dependencies/front-component-shared-dependencies.controller';+import { FrontComponentSharedDependenciesService } from 'src/engine/core-modules/application/front-component-shared-dependencies/front-component-shared-dependencies.service';+import { ApplicationModule } from 'src/engine/core-modules/application/application.module';+import { FileStorageModule } from 'src/engine/core-modules/file-storage/file-storage.module';+import { TwentyConfigModule } from 'src/engine/core-modules/twenty-config/twenty-config.module';++@Module({+ imports: [ApplicationModule, FileStorageModule, TwentyConfigModule],+ controllers: [FrontComponentSharedDependenciesController],+ providers: [FrontComponentSharedDependenciesService],+})+export class FrontComponentSharedDependenciesModule {}diff --git a/packages/twenty-server/src/engine/core-modules/application/front-component-shared-dependencies/front-component-shared-dependencies.service.ts b/packages/twenty-server/src/engine/core-modules/application/front-component-shared-dependencies/front-component-shared-dependencies.service.tsnew file mode 100644index 00000000000..14a6a7fc93f--- /dev/null+++ b/packages/twenty-server/src/engine/core-modules/application/front-component-shared-dependencies/front-component-shared-dependencies.service.ts@@ -0,0 +1,88 @@+import { Injectable } from '@nestjs/common';++import { FileFolder } from 'twenty-shared/types';+import { isDefined } from 'twenty-shared/utils';++import {+ ApplicationException,+ ApplicationExceptionCode,+} from 'src/engine/core-modules/application/application.exception';+import { ApplicationService } from 'src/engine/core-modules/application/application.service';+import { FileStorageService } from 'src/engine/core-modules/file-storage/services/file-storage.service';+import { type FileResponse } from 'src/engine/core-modules/file/types/file-response.type';+import { getContentDisposition } from 'src/engine/core-modules/file/utils/get-content-disposition.utils';+import { TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service';++const SHARED_DEPENDENCIES_BUNDLE_MIME_TYPE = 'application/javascript';++@Injectable()+export class FrontComponentSharedDependenciesService {+ constructor(+ private readonly applicationService: ApplicationService,+ private readonly fileStorageService: FileStorageService,+ private readonly twentyConfigService: TwentyConfigService,+ ) {}++ async getBuiltSharedDependenciesPresignedUrlOrStream({+ applicationId,+ workspaceId,+ }: {+ applicationId: string;+ workspaceId: string;+ }): Promise<{+ fileResponse: FileResponse;+ frontComponentSharedDependenciesChecksum: string | null;+ }> {+ const application = await this.applicationService.findOneApplicationOrThrow(+ {+ id: applicationId,+ workspaceId,+ },+ );++ if (!isDefined(application.frontComponentSharedDependenciesBuiltPath)) {+ throw new ApplicationException(+ `Application "${applicationId}" does not declare shared dependencies`,+ ApplicationExceptionCode.ENTITY_NOT_FOUND,+ );+ }++ const resourceIdentifier = {+ workspaceId,+ applicationUniversalIdentifier: application.universalIdentifier,+ fileFolder: FileFolder.BuiltFrontComponent,+ resourcePath: application.frontComponentSharedDependenciesBuiltPath,+ };++ const presignedUrl = await this.fileStorageService.getPresignedUrl({+ ...resourceIdentifier,+ expiresInSeconds: this.twentyConfigService.get(+ 'STORAGE_S3_PRESIGNED_URL_EXPIRES_IN',+ ),+ responseContentType: SHARED_DEPENDENCIES_BUNDLE_MIME_TYPE,+ responseContentDisposition: getContentDisposition(+ SHARED_DEPENDENCIES_BUNDLE_MIME_TYPE,+ ),+ });++ if (isDefined(presignedUrl)) {+ return {+ fileResponse: { type: 'redirect', presignedUrl },+ frontComponentSharedDependenciesChecksum:+ application.frontComponentSharedDependenciesChecksum,+ };+ }++ const stream = await this.fileStorageService.readFile(resourceIdentifier);++ return {+ fileResponse: {+ type: 'stream',+ stream,+ mimeType: SHARED_DEPENDENCIES_BUNDLE_MIME_TYPE,+ },+ frontComponentSharedDependenciesChecksum:+ application.frontComponentSharedDependenciesChecksum,+ };+ }+}diff --git a/packages/twenty-server/src/engine/core-modules/application/front-component-shared-dependencies/utils/__tests__/extract-checksum-from-cache-key.util.spec.ts b/packages/twenty-server/src/engine/core-modules/application/front-component-shared-dependencies/utils/__tests__/extract-checksum-from-cache-key.util.spec.tsnew file mode 100644index 00000000000..d628f92ad5d--- /dev/null+++ b/packages/twenty-server/src/engine/core-modules/application/front-component-shared-dependencies/utils/__tests__/extract-checksum-from-cache-key.util.spec.ts@@ -0,0 +1,19 @@+import { extractChecksumFromCacheKey } from 'src/engine/core-modules/application/front-component-shared-dependencies/utils/extract-checksum-from-cache-key.util';++const VALID_CHECKSUM = 'a'.repeat(64);++describe('extractChecksumFromCacheKey', () => {+ it('extracts the checksum from a fingerprinted cache key', () => {+ expect(extractChecksumFromCacheKey(`${VALID_CHECKSUM}.js`)).toBe(+ VALID_CHECKSUM,+ );+ });++ it.each([+ ['no cache key', undefined],+ ['a non-checksum segment', `${'z'.repeat(64)}.js`],+ ['a path traversal', `../${VALID_CHECKSUM}.js`],+ ])('fails closed on %s', (_label, cacheKey) => {+ expect(extractChecksumFromCacheKey(cacheKey)).toBeUndefined();+ });+});diff --git a/packages/twenty-server/src/engine/core-modules/application/front-component-shared-dependencies/utils/__tests__/get-shared-dependencies-bundle-cache-control.util.spec.ts b/packages/twenty-server/src/engine/core-modules/application/front-component-shared-dependencies/utils/__tests__/get-shared-dependencies-bundle-cache-control.util.spec.tsnew file mode 100644index 00000000000..b9d02c7fcd1--- /dev/null+++ b/packages/twenty-server/src/engine/core-modules/application/front-component-shared-dependencies/utils/__tests__/get-shared-dependencies-bundle-cache-control.util.spec.ts@@ -0,0 +1,34 @@+import { getSharedDependenciesBundleCacheControl } from 'src/engine/core-modules/application/front-component-shared-dependencies/utils/get-shared-dependencies-bundle-cache-control.util';+import {+ IMMUTABLE_FILE_CACHE_CONTROL,+ PRESIGNED_URL_NO_STORE_CACHE_CONTROL,+} from 'src/engine/core-modules/file/interfaces/file-folder.interface';++const CHECKSUM = 'a'.repeat(64);++describe('getSharedDependenciesBundleCacheControl', () => {+ it('returns the immutable cache control when the requested checksum matches', () => {+ expect(+ getSharedDependenciesBundleCacheControl({+ requestedChecksum: CHECKSUM,+ frontComponentSharedDependenciesChecksum: CHECKSUM,+ }),+ ).toBe(IMMUTABLE_FILE_CACHE_CONTROL);+ });++ it.each([+ ['the requested checksum differs', 'b'.repeat(64), CHECKSUM],+ ['no checksum was requested', undefined, CHECKSUM],+ ['the application has no checksum', CHECKSUM, null],+ ])(+ 'returns no-store when %s',+ (_label, requestedChecksum, storedChecksum) => {+ expect(+ getSharedDependenciesBundleCacheControl({+ requestedChecksum,+ frontComponentSharedDependenciesChecksum: storedChecksum,+ }),+ ).toBe(PRESIGNED_URL_NO_STORE_CACHE_CONTROL);+ },+ );+});diff --git a/packages/twenty-server/src/engine/core-modules/application/front-component-shared-dependencies/utils/extract-checksum-from-cache-key.util.ts b/packages/twenty-server/src/engine/core-modules/application/front-component-shared-dependencies/utils/extract-checksum-from-cache-key.util.tsnew file mode 100644index 00000000000..b73745f3bb4--- /dev/null+++ b/packages/twenty-server/src/engine/core-modules/application/front-component-shared-dependencies/utils/extract-checksum-from-cache-key.util.ts@@ -0,0 +1,6 @@+const SHARED_DEPENDENCIES_CACHE_KEY_PATTERN = /^([0-9a-f]{64})\.js$/;++export const extractChecksumFromCacheKey = (+ cacheKey: string | undefined,+): string | undefined =>+ cacheKey?.match(SHARED_DEPENDENCIES_CACHE_KEY_PATTERN)?.[1];diff --git a/packages/twenty-server/src/engine/core-modules/application/front-component-shared-dependencies/utils/get-shared-dependencies-bundle-cache-control.util.ts b/packages/twenty-server/src/engine/core-modules/application/front-component-shared-dependencies/utils/get-shared-dependencies-bundle-cache-control.util.tsnew file mode 100644index 00000000000..6a61dbbec8c--- /dev/null+++ b/packages/twenty-server/src/engine/core-modules/application/front-component-shared-dependencies/utils/get-shared-dependencies-bundle-cache-control.util.ts@@ -0,0 +1,18 @@+import { isDefined } from 'twenty-shared/utils';++import {+ IMMUTABLE_FILE_CACHE_CONTROL,+ PRESIGNED_URL_NO_STORE_CACHE_CONTROL,+} from 'src/engine/core-modules/file/interfaces/file-folder.interface';++export const getSharedDependenciesBundleCacheControl = ({+ requestedChecksum,+ frontComponentSharedDependenciesChecksum,+}: {+ requestedChecksum: string | undefined;+ frontComponentSharedDependenciesChecksum: string | null;+}): string =>+ isDefined(requestedChecksum) &&+ requestedChecksum === frontComponentSharedDependenciesChecksum+ ? IMMUTABLE_FILE_CACHE_CONTROL+ : PRESIGNED_URL_NO_STORE_CACHE_CONTROL;diff --git a/packages/twenty-server/src/engine/core-modules/core-engine.module.ts b/packages/twenty-server/src/engine/core-modules/core-engine.module.tsindex a58c64cc56e..723455b9e92 100644--- a/packages/twenty-server/src/engine/core-modules/core-engine.module.ts+++ b/packages/twenty-server/src/engine/core-modules/core-engine.module.ts@@ -8,6 +8,7 @@ import { AdminPanelModule } from 'src/engine/core-modules/admin-panel/admin-paneimport { ApiKeyModule } from 'src/engine/core-modules/api-key/api-key.module';import { ApplicationAuthorizationModule } from 'src/engine/core-modules/application/application-authorization/application-authorization.module';import { ApplicationDevelopmentModule } from 'src/engine/core-modules/application/application-development/application-development.module';+import { FrontComponentSharedDependenciesModule } from 'src/engine/core-modules/application/front-component-shared-dependencies/front-component-shared-dependencies.module';import { ApplicationInstallModule } from 'src/engine/core-modules/application/application-install/application-install.module';import { MarketplaceModule } from 'src/engine/core-modules/application/application-marketplace/marketplace.module';import { ApplicationOAuthModule } from 'src/engine/core-modules/application/application-oauth/application-oauth.module';@@ -108,6 +109,7 @@ import { FileModule } from './file/file.module';ApplicationInstallModule,ApplicationUpgradeModule,ApplicationDevelopmentModule,+ FrontComponentSharedDependenciesModule,MarketplaceModule,TimelineMessagingModule,TimelineCalendarEventModule,diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__tests__/morph-relation-from-create-field-input-to-flat-field-metadatas-to-create.spec.ts b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__tests__/morph-relation-from-create-field-input-to-flat-field-metadatas-to-create.spec.tsindex 35ee4695f13..deeaac7312e 100644--- a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__tests__/morph-relation-from-create-field-input-to-flat-field-metadatas-to-create.spec.ts+++ b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/__tests__/morph-relation-from-create-field-input-to-flat-field-metadatas-to-create.spec.ts@@ -49,6 +49,8 @@ const MOCK_FLAT_APPLICATION: FlatApplication = {deletedAt: null,isSdkLayerStale: true,sdkClientCoreChecksum: null,+ frontComponentSharedDependenciesChecksum: null,+ frontComponentSharedDependenciesBuiltPath: null,};const flatObjectMetadataMaps = [diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/utils/__tests__/generate-morph-or-relation-flat-field-metadata-pair.spec.ts b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/utils/__tests__/generate-morph-or-relation-flat-field-metadata-pair.spec.tsindex c31e2643e71..276c487a904 100644--- a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/utils/__tests__/generate-morph-or-relation-flat-field-metadata-pair.spec.ts+++ b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/utils/__tests__/generate-morph-or-relation-flat-field-metadata-pair.spec.ts@@ -44,6 +44,8 @@ const MOCK_FLAT_APPLICATION: FlatApplication = {deletedAt: null,isSdkLayerStale: true,sdkClientCoreChecksum: null,+ frontComponentSharedDependenciesChecksum: null,+ frontComponentSharedDependenciesBuiltPath: null,};type GenerateMorphOrRelationFlatFieldMetadataPairTestInput = Parameters<diff --git a/packages/twenty-server/src/engine/metadata-modules/front-component/front-component.resolver.ts b/packages/twenty-server/src/engine/metadata-modules/front-component/front-component.resolver.tsindex b5f889f590b..13f45d1519d 100644--- a/packages/twenty-server/src/engine/metadata-modules/front-component/front-component.resolver.ts+++ b/packages/twenty-server/src/engine/metadata-modules/front-component/front-component.resolver.ts@@ -1,5 +1,5 @@import { Inject, UseGuards, UseInterceptors } from '@nestjs/common';-import { Args, Mutation, Query } from '@nestjs/graphql';+import { Args, Mutation, Parent, Query, ResolveField } from '@nestjs/graphql';import { PermissionFlagType } from 'twenty-shared/constants';@@ -22,6 +22,7 @@ import { FrontComponentDTO } from 'src/engine/metadata-modules/front-component/dimport { UpdateFrontComponentInput } from 'src/engine/metadata-modules/front-component/dtos/update-front-component.input';import { FrontComponentService } from 'src/engine/metadata-modules/front-component/front-component.service';import { FrontComponentGraphqlApiExceptionInterceptor } from 'src/engine/metadata-modules/front-component/interceptors/front-component-graphql-api-exception.interceptor';+import { WorkspaceCacheService } from 'src/engine/workspace-cache/services/workspace-cache.service';import { WorkspaceMigrationGraphqlApiExceptionInterceptor } from 'src/engine/workspace-manager/workspace-migration/interceptors/workspace-migration-graphql-api-exception.interceptor';@UseGuards(WorkspaceAuthGuard)@@ -37,8 +38,25 @@ export class FrontComponentResolver {@Inject(ApplicationTokenService)private readonly applicationTokenService: ApplicationTokenService,private readonly applicationVariableService: ApplicationVariableEntityService,+ private readonly workspaceCacheService: WorkspaceCacheService,) {}+ @ResolveField(() => String, { nullable: true })+ async frontComponentSharedDependenciesChecksum(+ @Parent() frontComponent: FrontComponentDTO,+ @AuthWorkspace() workspace: WorkspaceEntity,+ ): Promise<string | null> {+ const { flatApplicationMaps } =+ await this.workspaceCacheService.getOrRecompute(workspace.id, [+ 'flatApplicationMaps',+ ]);++ return (+ flatApplicationMaps.byId[frontComponent.applicationId]+ ?.frontComponentSharedDependenciesChecksum ?? null+ );+ }+@Query(() => [FrontComponentDTO])@UseGuards(NoPermissionGuard)async frontComponents(diff --git a/packages/twenty-server/test/integration/metadata/suites/application/utils/seed-built-front-component-shared-dependencies-file.util.ts b/packages/twenty-server/test/integration/metadata/suites/application/utils/seed-built-front-component-shared-dependencies-file.util.tsnew file mode 100644index 00000000000..45cf0adb180--- /dev/null+++ b/packages/twenty-server/test/integration/metadata/suites/application/utils/seed-built-front-component-shared-dependencies-file.util.ts@@ -0,0 +1,37 @@+import { existsSync, mkdirSync, rmSync, writeFileSync } from 'fs';+import { dirname, join } from 'path';++import { SEED_APPLE_WORKSPACE_ID } from 'src/engine/workspace-manager/dev-seeder/core/constants/seeder-workspaces.constant';++const STORAGE_LOCAL_PATH = join(process.cwd(), '.local-storage');++export const seedBuiltFrontComponentSharedDependenciesFile = ({+ workspaceId = SEED_APPLE_WORKSPACE_ID,+ applicationUniversalIdentifier,+ builtPath,+ content,+}: {+ workspaceId?: string;+ applicationUniversalIdentifier: string;+ builtPath: string;+ content: string;+}): { cleanup: () => void } => {+ const filePath = join(+ STORAGE_LOCAL_PATH,+ workspaceId,+ applicationUniversalIdentifier,+ 'built-front-component',+ builtPath,+ );++ mkdirSync(dirname(filePath), { recursive: true });+ writeFileSync(filePath, content);++ return {+ cleanup: () => {+ if (existsSync(filePath)) {+ rmSync(filePath);+ }+ },+ };+};diff --git a/packages/twenty-server/test/integration/rest/suites/front-component-shared-dependencies.integration-spec.ts b/packages/twenty-server/test/integration/rest/suites/front-component-shared-dependencies.integration-spec.tsnew file mode 100644index 00000000000..38c5005dd52--- /dev/null+++ b/packages/twenty-server/test/integration/rest/suites/front-component-shared-dependencies.integration-spec.ts@@ -0,0 +1,99 @@+import { seedBuiltFrontComponentSharedDependenciesFile } from 'test/integration/metadata/suites/application/utils/seed-built-front-component-shared-dependencies-file.util';+import { makeRestAPIRequest } from 'test/integration/rest/utils/make-rest-api-request.util';++import { SEED_APPLE_WORKSPACE_ID } from 'src/engine/workspace-manager/dev-seeder/core/constants/seeder-workspaces.constant';++const SHARED_DEPENDENCIES_BUILT_PATH =+ 'src/front-component-shared-dependencies.mjs';+const SHARED_DEPENDENCIES_CHECKSUM = 'a'.repeat(64);+const SHARED_DEPENDENCIES_BUNDLE_CONTENT =+ 'export const sharedDependenciesReady = true;\n';++describe('Front component shared dependencies endpoint', () => {+ let applicationId: string;+ let applicationUniversalIdentifier: string;+ let cleanupSharedDependenciesFile: (() => void) | undefined;++ beforeAll(async () => {+ const [workspace] = await global.testDataSource.query(+ 'SELECT "workspaceCustomApplicationId" FROM core.workspace WHERE id = $1',+ [SEED_APPLE_WORKSPACE_ID],+ );++ applicationUniversalIdentifier = workspace.workspaceCustomApplicationId;++ const [application] = await global.testDataSource.query(+ 'SELECT id FROM core."application" WHERE "universalIdentifier" = $1 AND "workspaceId" = $2',+ [applicationUniversalIdentifier, SEED_APPLE_WORKSPACE_ID],+ );++ applicationId = application.id;+ });++ afterAll(async () => {+ await global.testDataSource.query(+ 'UPDATE core."application" SET "frontComponentSharedDependenciesBuiltPath" = NULL, "frontComponentSharedDependenciesChecksum" = NULL WHERE id = $1',+ [applicationId],+ );++ cleanupSharedDependenciesFile?.();+ });++ it('should return 404 when the application declares no shared dependencies bundle', async () => {+ await makeRestAPIRequest({+ method: 'get',+ path: `/front-component-shared-dependencies/${applicationId}`,+ bearer: APPLE_JANE_ADMIN_ACCESS_TOKEN,+ }).expect(404);+ });++ describe('with a built shared dependencies bundle', () => {+ beforeAll(async () => {+ const { cleanup } = seedBuiltFrontComponentSharedDependenciesFile({+ applicationUniversalIdentifier,+ builtPath: SHARED_DEPENDENCIES_BUILT_PATH,+ content: SHARED_DEPENDENCIES_BUNDLE_CONTENT,+ });++ cleanupSharedDependenciesFile = cleanup;++ await global.testDataSource.query(+ 'UPDATE core."application" SET "frontComponentSharedDependenciesBuiltPath" = $1, "frontComponentSharedDependenciesChecksum" = $2 WHERE id = $3',+ [+ SHARED_DEPENDENCIES_BUILT_PATH,+ SHARED_DEPENDENCIES_CHECKSUM,+ applicationId,+ ],+ );+ });++ it('should serve the shared dependencies bundle with no-store on the plain path', async () => {+ await makeRestAPIRequest({+ method: 'get',+ path: `/front-component-shared-dependencies/${applicationId}`,+ bearer: APPLE_JANE_ADMIN_ACCESS_TOKEN,+ })+ .expect(200)+ .expect('Content-Type', /application\/javascript/)+ .expect('X-Content-Type-Options', 'nosniff')+ .expect('Content-Disposition', 'attachment')+ .expect('Cache-Control', 'private, no-store')+ .expect((res) => {+ expect(res.text).toBe(SHARED_DEPENDENCIES_BUNDLE_CONTENT);+ });+ });++ it('should serve the checksum-fingerprinted path with an immutable cache header', async () => {+ await makeRestAPIRequest({+ method: 'get',+ path: `/front-component-shared-dependencies/${applicationId}/${SHARED_DEPENDENCIES_CHECKSUM}.js`,+ bearer: APPLE_JANE_ADMIN_ACCESS_TOKEN,+ })+ .expect(200)+ .expect('Cache-Control', 'private, max-age=86400, immutable')+ .expect((res) => {+ expect(res.text).toBe(SHARED_DEPENDENCIES_BUNDLE_CONTENT);+ });+ });+ });+});diff --git a/packages/twenty-shared/src/application/applicationType.ts b/packages/twenty-shared/src/application/applicationType.tsindex 9ee1e108209..4200619c9c6 100644--- a/packages/twenty-shared/src/application/applicationType.ts+++ b/packages/twenty-shared/src/application/applicationType.ts@@ -2,6 +2,7 @@ import { type PostInstallLogicFunctionApplicationManifest } from '@/application/import { type PreInstallLogicFunctionApplicationManifest } from '@/application/preInstallLogicFunctionApplicationType';import { type SettingsFrontComponentApplicationManifest } from '@/application/settingsFrontComponentApplicationType';import { type UninstallLogicFunctionApplicationManifest } from '@/application/uninstallLogicFunctionApplicationType';+import { type FrontComponentSharedDependenciesManifest } from '@/application/frontComponentSharedDependenciesManifestType';import { type ApplicationCategory } from './applicationCategoryType';import { type ApplicationVariables } from './applicationVariablesType';import { type ServerVariables } from './server-variables.type';@@ -34,6 +35,7 @@ export type ApplicationManifest = SyncableEntityOptions & {preInstallLogicFunction?: PreInstallLogicFunctionApplicationManifest;uninstallLogicFunction?: UninstallLogicFunctionApplicationManifest;settingsFrontComponent?: SettingsFrontComponentApplicationManifest;+ frontComponentSharedDependencies?: FrontComponentSharedDependenciesManifest;/*** @deprecated Use `defineSettingsFrontComponent()` (exposed on the manifest* as `settingsFrontComponent`) instead. This property is ignored.diff --git a/packages/twenty-shared/src/application/constants/FrontComponentSharedDependenciesBuiltPath.ts b/packages/twenty-shared/src/application/constants/FrontComponentSharedDependenciesBuiltPath.tsnew file mode 100644index 00000000000..8cda4ae1bcd--- /dev/null+++ b/packages/twenty-shared/src/application/constants/FrontComponentSharedDependenciesBuiltPath.ts@@ -0,0 +1,2 @@+export const FRONT_COMPONENT_SHARED_DEPENDENCIES_BUILT_PATH =+ 'front-component-shared-dependencies.mjs';diff --git a/packages/twenty-shared/src/application/constants/FrontComponentSharedDependenciesImportSpecifier.ts b/packages/twenty-shared/src/application/constants/FrontComponentSharedDependenciesImportSpecifier.tsnew file mode 100644index 00000000000..ca34b0402e4--- /dev/null+++ b/packages/twenty-shared/src/application/constants/FrontComponentSharedDependenciesImportSpecifier.ts@@ -0,0 +1,2 @@+export const FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER =+ 'twenty:front-component-shared-dependencies';diff --git a/packages/twenty-shared/src/application/frontComponentSharedDependenciesManifestType.ts b/packages/twenty-shared/src/application/frontComponentSharedDependenciesManifestType.tsnew file mode 100644index 00000000000..fd024438273--- /dev/null+++ b/packages/twenty-shared/src/application/frontComponentSharedDependenciesManifestType.ts@@ -0,0 +1,5 @@+export type FrontComponentSharedDependenciesManifest = {+ dependencies: string[];+ builtPath: string;+ builtChecksum: string | null;+};diff --git a/packages/twenty-shared/src/application/index.ts b/packages/twenty-shared/src/application/index.tsindex 7414e2c1c58..504a67fd233 100644--- a/packages/twenty-shared/src/application/index.ts+++ b/packages/twenty-shared/src/application/index.ts@@ -36,6 +36,8 @@ export { DEFAULT_API_KEY_NAME } from './constants/DefaultApiKeyName';export { DEFAULT_API_URL_NAME } from './constants/DefaultApiUrlName';export { DEFAULT_APP_ACCESS_TOKEN_NAME } from './constants/DefaultAppAccessTokenName';export { DEFAULT_FUNCTIONS_URL_NAME } from './constants/DefaultFunctionsUrlName';+export { FRONT_COMPONENT_SHARED_DEPENDENCIES_BUILT_PATH } from './constants/FrontComponentSharedDependenciesBuiltPath';+export { FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER } from './constants/FrontComponentSharedDependenciesImportSpecifier';export { GENERATED_DIR } from './constants/GeneratedDirectory';export { NODE_ESM_CJS_BANNER } from './constants/NodeEsmCjsBanner';export { OUTPUT_DIR } from './constants/OutputDirectory';@@ -104,6 +106,7 @@ export type {CommandMenuItemManifest,FrontComponentManifest,} from './frontComponentManifestType';+export type { FrontComponentSharedDependenciesManifest } from './frontComponentSharedDependenciesManifestType';export type { IndexFieldManifest } from './indexFieldManifestType';export type { IndexManifest } from './indexManifestType';export type {